GenericHierarchy Class Reference
 
 
 
GenericHierarchy Class Reference

#include <genhier.h>

Inheritance diagram for GenericHierarchy:
MaxHeapOperators

Class Description

See also:
Class HierarchyEntry.

Description:
This is a utility class for describing hierarchies of shapes. All methods of this class are implemented by the system.

This is used in generating mesh objects from shapes. In order for a mesh object to be generated correctly, nested shapes must be oriented clockwise or counter-clockwise depending on their level of nesting. For example, a donut shape with two circular curves will have the outer shape going counter-clockwise and the inner shape going clockwise. If a third shape was nested inside both of these, its points would be going counter-clockwise.

Public Member Functions

  GenericHierarchy ()
UtilExport  ~GenericHierarchy ()
UtilExport void  AddEntry (int data, int parent=-1)
UtilExport int  Entries ()
UtilExport HierarchyEntry GetStart ()
UtilExport HierarchyEntry FindEntry (int data, HierarchyEntry *start=NULL)
UtilExport int  NumberOfChildren (int data)
UtilExport int  GetChild (int data, int index)
UtilExport void  New ()
UtilExport void  Sort ()
UtilExport BOOL  IsCompatible (GenericHierarchy &hier)
UtilExport void  Dump (HierarchyEntry *start=NULL)
UtilExport GenericHierarchy operator= (GenericHierarchy &from)
UtilExport MSTR SortKey ()

Constructor & Destructor Documentation

GenericHierarchy ( ) [inline]
Remarks:
Constructor. The hierarchy is set as initially empty.
{ root = HierarchyEntry(-1,NULL,NULL); isSorted = FALSE; }
UtilExport ~GenericHierarchy ( )

Member Function Documentation

UtilExport void AddEntry ( int  data,
int  parent = -1 
)
Remarks:
This method adds one entry given its parent.
Parameters:
int data

The polygon index of the entry to add.

int parent = -1

The index of the parent of the entry.
UtilExport int Entries ( )
Remarks:
Returns the total number of members in the hierarchy.
UtilExport HierarchyEntry* GetStart ( ) [inline]
Remarks:
Retrieves the first item under the root.
Returns:
The first HierarchyEntry under the root.
{ return root.child; } // Get the first item under the root
UtilExport HierarchyEntry* FindEntry ( int  data,
HierarchyEntry start = NULL 
)
Remarks:
Finds the specified entry in the hierarchy.
Parameters:
int data

The polygon index of the entry to find.

HierarchyEntry* start = NULL

The entry at which to begin the search. If NULL is specified the search starts at the root.
Returns:
A pointer to the HierarchyEntry of the found entry. If not found, NULL is returned.
UtilExport int NumberOfChildren ( int  data )
Remarks:
Returns the number of children for this item.
Parameters:
int data

The index of the polygon to return the number of children of.
UtilExport int GetChild ( int  data,
int  index 
)
Remarks:
Returns the specified child of the specified entry.
Parameters:
int data

The index of the polygon whose child is to be returned.

int index

Specifies which child to return.
Returns:
The specified child of the entry.
UtilExport void New ( )
Remarks:
Clear out the hierarchy tree.
UtilExport void Sort ( )
Remarks:
Sorts the hierarchy tree by children / siblings. This is used internally as all the sorting is done automatically as the hierarchy is generated.
UtilExport BOOL IsCompatible ( GenericHierarchy hier )
Remarks:
Determines if this hierarchy and the specified hierarchy are compatible.
Parameters:
GenericHierarchy& hier

The hierarchy to check for compatibility.
Returns:
TRUE if the hierarchies are compatible; otherwise FALSE.
UtilExport void Dump ( HierarchyEntry start = NULL )
Remarks:
This method is used internally to DebugPrint() the tree. See Debugging.
UtilExport GenericHierarchy& operator= ( GenericHierarchy from )
Remarks:
Copy operator.
Parameters:
GenericHierarchy& from

The hierarchy to copy from.
UtilExport MSTR& SortKey ( )
Remarks:
Returns the sort key for the hierarchy. This is used internally.
Operators: