VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes
makVrv::DtElementIDHierarchy Class Reference

Hierarchy that will keep track of parent/child element id relationships. Will emit signals when the tree is modified.

Inheritance diagram for makVrv::DtElementIDHierarchy:
Inheritance graph
[legend]

Public Types

typedef std::vector< DtElementIDElementIDs
 
typedef std::set< const
DtElementIDHierarchyNode * > 
VisibilityProcessingList
 
typedef boost::function
< DtElementIDHierarchyNode::DisplayState(const
DtElementIDHierarchyNode *)> 
ExpectedDisplayState
 

Public Member Functions

 DtElementIDHierarchy ()
 
virtual ~DtElementIDHierarchy ()
 
virtual void addToHierarchy (DtElementID elementID, DtElementID child, int flags=0, bool setAsNewChildren=true, bool processList=true)
 
virtual void addToHierarchy (DtElementID elementID, const ElementIDs &children=ElementIDs(), int flags=0, bool setAsNewChildren=true, bool processList=true)
 
void setFlags (DtElementID id, int flags)
 
int flags (DtElementID id) const
 
virtual void removeFromHierarchy (DtElementID id)
 
virtual bool isChild (DtElementID parentId, DtElementID childId, bool recurse=false) const
 
bool isInHierarchy (DtElementID id) const
 
DtElementIDHierarchyNodeparentOf (DtElementID id)
 
const DtElementIDHierarchyNodeparentOf (DtElementID id) const
 
DtElementIDHierarchyNodehierarchyNode (DtElementID id)
 
const DtElementIDHierarchyNodehierarchyNode (DtElementID elementID) const
 
bool hasChildren (DtElementID id) const
 
int level (const DtElementIDHierarchyNode *node) const
 
virtual
DtElementIDHierarchyNode::DisplayState 
displayState (DtElementID elementID) const
 
virtual void detachChildFromParent (DtElementID child)
 
virtual void attachChildToParent (DtElementID child, DtElementID parent, bool processList=true)
 
virtual void expand (DtElementID elementID, bool processList=true)
 
virtual void expandAll (DtElementID elementID, bool processList=true)
 
virtual void expandDown (DtElementID elementID, int numLevels=-1, bool processList=true)
 
virtual void collapseAll (DtElementID elementID, bool processList=true)
 
virtual void collapse (DtElementID elementID, bool processList=true)
 
virtual void processVisibilityList ()
 
void setInitiallyExpanded (bool)
 
virtual bool initiallyExpanded () const
 
virtual void processNode (DtElementIDHierarchyNode *node, bool forceUpdate=false)
 
void setExpectedDisplayStateFunction (ExpectedDisplayState)
 
virtual
DtElementIDHierarchyNode::DisplayState 
expectedDisplayStateFor (const DtElementIDHierarchyNode *node)
 
virtual void reprocessAllNodes ()
 
virtual void getLeafNodes (ElementIDs &leafNodeElements) const
 
virtual void updateHierarchyToMatch (DtElementID id, const ElementIDs &children, int flags)
 

Static Public Member Functions

static bool nodeElementIdSort (DtElementIDHierarchyNode *a, DtElementIDHierarchyNode *b)
 

Public Attributes

boost::signalslib::signal
< void(DtElementIDHierarchyNode *) > 
signal_hierarchyItemModified
 
boost::signalslib::signal
< void(DtElementIDHierarchyNode *) > 
signal_hierarchyItemToBeRemoved
 
boost::signalslib::signal
< void(DtElementIDHierarchyNode *) > 
signal_hierarchyItemAboutToBeRemoved
 
boost::signalslib::signal
< void(DtElementIDHierarchy *) > 
signal_hierarchyUpdated
 
boost::signalslib::signal
< void(DtElementID, const
ElementIDs &)> 
signal_updateHierarchy
 
boost::signalslib::signal
< void(DtElementID,
DtElementIDHierarchyNode::DisplayState)> 
signal_echelonVisibilityChange
 
boost::signalslib::signal
< void(VisibilityProcessingList)> 
signal_visibilityChanged
 

Protected Types

typedef boost::unordered_map
< DtElementID,
DtElementIDHierarchyNode * > 
HierarchyNodeMap
 

Protected Member Functions

virtual void processVisibilityState (const DtElementIDHierarchyNode *)
 
virtual void processSingleNode (DtElementIDHierarchyNode *node, bool forceUpdate=false)
 
virtual void processParentedNode (DtElementIDHierarchyNode *node, bool forceUpdate=false, bool processChildren=true)
 
virtual void processNodeWithChildren (DtElementIDHierarchyNode *node, bool forceUpdate=false)
 
virtual void attachParentToChildrenAndRemoveMissingChildren (DtElementID parentId, ElementIDs newChildren)
 
virtual void hierarchyUpdated ()
 
virtual void aboutToBeRemovedFromHierarchy (DtElementIDHierarchyNode *)
 
virtual void updateHierarchy (DtElementID id, const ElementIDs &children, bool setAsNewChildren=true)
 
virtual void attachParentToChildren (DtElementID parentId, const ElementIDs &children, bool setAsNewChildren=true)
 
virtual void removeAllChildrenFromParent (DtElementID)
 
virtual void hierarchyItemModified (DtElementIDHierarchyNode *)
 

Protected Attributes

HierarchyNodeMap myFlatHierarchy
 
VisibilityProcessingList myVisibilityProcessingList
 
ExpectedDisplayState myExpectedDisplayState
 
bool myInitiallyExpanded
 

Member Typedef Documentation

Constructor & Destructor Documentation

makVrv::DtElementIDHierarchy::DtElementIDHierarchy ( )
virtual makVrv::DtElementIDHierarchy::~DtElementIDHierarchy ( )
virtual

Member Function Documentation

virtual void makVrv::DtElementIDHierarchy::addToHierarchy ( DtElementID  elementID,
DtElementID  child,
int  flags = 0,
bool  setAsNewChildren = true,
bool  processList = true 
)
virtual

Adds a new root node (if missing) and modifies the children of that root node to contain (or remove) the element ids specified. If setAsNewChildren is true (the default), the children added will be considered the only children of the parent. If false, the children will be added (appended) if they are not already children.

virtual void makVrv::DtElementIDHierarchy::addToHierarchy ( DtElementID  elementID,
const ElementIDs children = ElementIDs(),
int  flags = 0,
bool  setAsNewChildren = true,
bool  processList = true 
)
virtual
void makVrv::DtElementIDHierarchy::setFlags ( DtElementID  id,
int  flags 
)

Sets the flags for the specified item.

int makVrv::DtElementIDHierarchy::flags ( DtElementID  id) const

Returns flags for specified item.

virtual void makVrv::DtElementIDHierarchy::removeFromHierarchy ( DtElementID  id)
virtual

Removes the specified item from the hierarchy.

virtual bool makVrv::DtElementIDHierarchy::isChild ( DtElementID  parentId,
DtElementID  childId,
bool  recurse = false 
) const
virtual

Returns true if the child is a child of the parent. If recurse flag is true, will also check the children of the parent to see if it is anywhere in the hierarchy.

bool makVrv::DtElementIDHierarchy::isInHierarchy ( DtElementID  id) const

Returns true if this element is in the hierarchy.

DtElementIDHierarchyNode* makVrv::DtElementIDHierarchy::parentOf ( DtElementID  id)
const DtElementIDHierarchyNode* makVrv::DtElementIDHierarchy::parentOf ( DtElementID  id) const
DtElementIDHierarchyNode* makVrv::DtElementIDHierarchy::hierarchyNode ( DtElementID  id)
const DtElementIDHierarchyNode* makVrv::DtElementIDHierarchy::hierarchyNode ( DtElementID  elementID) const
bool makVrv::DtElementIDHierarchy::hasChildren ( DtElementID  id) const
int makVrv::DtElementIDHierarchy::level ( const DtElementIDHierarchyNode node) const

Level of node – recursively counts the number of parents.

virtual DtElementIDHierarchyNode::DisplayState makVrv::DtElementIDHierarchy::displayState ( DtElementID  elementID) const
virtual

Returns the expanded state of the element id. If not found, will return expanded.

virtual void makVrv::DtElementIDHierarchy::detachChildFromParent ( DtElementID  child)
virtual

Removes the parent/child relationship.

virtual void makVrv::DtElementIDHierarchy::attachChildToParent ( DtElementID  child,
DtElementID  parent,
bool  processList = true 
)
virtual

Hooks the child to the particular parent. If already a child of another element, will unhook that first.

virtual void makVrv::DtElementIDHierarchy::expand ( DtElementID  elementID,
bool  processList = true 
)
virtual

Expands specified element by showing children and hiding root. This will only show immediate children. If process list is false, will not emit signal to process the visibility changes. Call processVisibilityList to complete process. If expandAll is true, also expands anything underneath the node that has children.

virtual void makVrv::DtElementIDHierarchy::expandAll ( DtElementID  elementID,
bool  processList = true 
)
virtual

Expands all children and their children.

virtual void makVrv::DtElementIDHierarchy::expandDown ( DtElementID  elementID,
int  numLevels = -1,
bool  processList = true 
)
virtual

Expands all children from the given id down.

Parameters
[in]elementIDis the id of the node to start the expansion.
[in]numLevelsis the number of levels to expand (less than zero expands all levels).
[in]processListis a flag to emit visibility change signals.
virtual void makVrv::DtElementIDHierarchy::collapseAll ( DtElementID  elementID,
bool  processList = true 
)
virtual

Collapses parent and all parents.

virtual void makVrv::DtElementIDHierarchy::collapse ( DtElementID  elementID,
bool  processList = true 
)
virtual

Collapses all items that are expanded and shows parent. This will collapse all children of the parent recursively. If process list is false, will not emit signal to process the visibility changes. Call processVisibilityList to complete process.

virtual void makVrv::DtElementIDHierarchy::processVisibilityList ( )
virtual

Processes visibility state list by emitting signal.

void makVrv::DtElementIDHierarchy::setInitiallyExpanded ( bool  )

State flags to determine how items might be shown when first added to the list. Initially expanded is by default false.

virtual bool makVrv::DtElementIDHierarchy::initiallyExpanded ( ) const
virtual
virtual void makVrv::DtElementIDHierarchy::processNode ( DtElementIDHierarchyNode node,
bool  forceUpdate = false 
)
virtual

Modifies item given aggregate settings record.

void makVrv::DtElementIDHierarchy::setExpectedDisplayStateFunction ( ExpectedDisplayState  )

Sets the function to return the expected display state. Initially expectedDisplayState.

virtual DtElementIDHierarchyNode::DisplayState makVrv::DtElementIDHierarchy::expectedDisplayStateFor ( const DtElementIDHierarchyNode node)
virtual

Given the node, will return the expected display state based on parent information.

virtual void makVrv::DtElementIDHierarchy::reprocessAllNodes ( )
virtual

Reprocesses all the nodes, updating as need be due to settings changes.

virtual void makVrv::DtElementIDHierarchy::getLeafNodes ( ElementIDs leafNodeElements) const
virtual

Return a list of all the nodes that are leaf nodes (have a parent and no children)

virtual void makVrv::DtElementIDHierarchy::updateHierarchyToMatch ( DtElementID  id,
const ElementIDs children,
int  flags 
)
virtual

update the hierarchy using the id and children

static bool makVrv::DtElementIDHierarchy::nodeElementIdSort ( DtElementIDHierarchyNode a,
DtElementIDHierarchyNode b 
)
static
virtual void makVrv::DtElementIDHierarchy::processVisibilityState ( const DtElementIDHierarchyNode )
protectedvirtual

Adds item to list to be processed.

virtual void makVrv::DtElementIDHierarchy::processSingleNode ( DtElementIDHierarchyNode node,
bool  forceUpdate = false 
)
protectedvirtual
virtual void makVrv::DtElementIDHierarchy::processParentedNode ( DtElementIDHierarchyNode node,
bool  forceUpdate = false,
bool  processChildren = true 
)
protectedvirtual
virtual void makVrv::DtElementIDHierarchy::processNodeWithChildren ( DtElementIDHierarchyNode node,
bool  forceUpdate = false 
)
protectedvirtual
virtual void makVrv::DtElementIDHierarchy::attachParentToChildrenAndRemoveMissingChildren ( DtElementID  parentId,
ElementIDs  newChildren 
)
protectedvirtual

Internal utility function for processing a child that needs to be added to a parent and remove any missing children.

virtual void makVrv::DtElementIDHierarchy::hierarchyUpdated ( )
protectedvirtual

Called when hierarchy is updated. Default is no-op.

virtual void makVrv::DtElementIDHierarchy::aboutToBeRemovedFromHierarchy ( DtElementIDHierarchyNode )
protectedvirtual

Called when a hieararchy item is about to be removed. Default is no-op.

virtual void makVrv::DtElementIDHierarchy::updateHierarchy ( DtElementID  id,
const ElementIDs children,
bool  setAsNewChildren = true 
)
protectedvirtual

Update the hierarchy with the parent/child information. If setAsNewChildren is true (the default), the children added will be considered the only children of the parent. If false, the children will be added (appended) if they are not already children.

virtual void makVrv::DtElementIDHierarchy::attachParentToChildren ( DtElementID  parentId,
const ElementIDs children,
bool  setAsNewChildren = true 
)
protectedvirtual

Hook up parent to children. Unhook children that are no longer part of this parent. If the child list is empty, tries to find all children that should have this parent that are not hooked to it. If setAsNewChildren is true (the default), the children added will be considered the only children of the parent. If false, the children will be added (appended) if they are not already children.

virtual void makVrv::DtElementIDHierarchy::removeAllChildrenFromParent ( DtElementID  )
protectedvirtual
virtual void makVrv::DtElementIDHierarchy::hierarchyItemModified ( DtElementIDHierarchyNode )
protectedvirtual

Called when a hierarchy item is modified. Default no-ops.

Member Data Documentation

boost::signalslib::signal<void (DtElementIDHierarchyNode*) > makVrv::DtElementIDHierarchy::signal_hierarchyItemModified
boost::signalslib::signal<void (DtElementIDHierarchyNode*) > makVrv::DtElementIDHierarchy::signal_hierarchyItemToBeRemoved

Called before disconnecting from tree and before signal_hierarchyItemAboutToBeRemoved.

boost::signalslib::signal<void (DtElementIDHierarchyNode*) > makVrv::DtElementIDHierarchy::signal_hierarchyItemAboutToBeRemoved
boost::signalslib::signal<void (DtElementIDHierarchy*) > makVrv::DtElementIDHierarchy::signal_hierarchyUpdated
boost::signalslib::signal<void (DtElementID, const ElementIDs&)> makVrv::DtElementIDHierarchy::signal_updateHierarchy
boost::signalslib::signal<void (DtElementID, DtElementIDHierarchyNode::DisplayState)> makVrv::DtElementIDHierarchy::signal_echelonVisibilityChange
boost::signalslib::signal<void (VisibilityProcessingList)> makVrv::DtElementIDHierarchy::signal_visibilityChanged
HierarchyNodeMap makVrv::DtElementIDHierarchy::myFlatHierarchy
protected
VisibilityProcessingList makVrv::DtElementIDHierarchy::myVisibilityProcessingList
protected
ExpectedDisplayState makVrv::DtElementIDHierarchy::myExpectedDisplayState
protected
bool makVrv::DtElementIDHierarchy::myInitiallyExpanded
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)