CODBspTree Class

class CODBspTree

A binary space partitioning tree that stores the bounding rectangles of the components in a model. Only rectangles are used, and the z-order of components are not stored to speed up the population and searches on the tree. This tree must be updated whenever the bounding box of a component changes.

Defined in: OdBspTree.h

See Also

CODBspNode, CODBspRect

Class Members

Construction

VIEWS_API CODBspTree()

Constructor.

VIEWS_API BOOL Create(CRect rcSpace)

Creates the BSP tree representing a rectangle of space.

VIEWS_API BOOL Create(CRect rcSpace, int nThreshold)

Creates the BSP tree setting the threshold explicitly.

VIEWS_API BOOL Create(CRect rcSpace, float fThresholdPct)

Creates the BSP tree setting the threshold as a percentage.

Attributes

int m_nThreshold

The minimum dimension threshold of a BSP node in this tree.

CODBspNode* m_pRootNode

A pointer to the root node of this tree.

VIEWS_API int GetThreshold()

Retrieves the minimum dimension threshold of a BSP node in this tree.

Operations

VIEWS_API void AddComponent(CODComponent* pComp)

Stores the position information of a component in the tree.

VIEWS_API void AddComponents(CODComponentSet* pCompSet)

Stores the position information of a set of components in the tree.

VIEWS_API void RemoveComponent(CODComponent* pComp)

Removes the position information of a component from the tree.

VIEWS_API void RemoveComponents(CODComponentSet* pCompSet)

Removes the position information of a set of components from the tree.

VIEWS_API void GetContaining(CODComponentSet* pCompSet, CPoint point, int nPadding = 0)

Retrieves the set of components which contain the point passed in.

VIEWS_API void GetWithin(CODComponentSet* pCompSet, CRect rect)

Retrieves the set of components which are within the rectangle passed in.

VIEWS_API void GetIntersecting(CODComponentSet* pCompSet, CRect rect)

Retrieves the set of componetns which intersect with the rectangle passed in.

Implementation

VIEWS_API virtual ~CODBspTree()

Destructor.

VIEWS_API void MapToSet(CODComponentMap* pCompMap, CODComponentSet* pCompSet)

Transfers the components in a map to a set.

VIEWS_API void GetBspRects(CODComponentSet* pCompSet, CODBspRectArray* pRectArray)

Creates BSP rectangles based on the bounding boxes of components.