SHAPER  9.12.0
ModuleBase_ITreeNode Class Referenceabstract
Inheritance diagram for ModuleBase_ITreeNode:
Inheritance graph

Public Types

enum  VisibilityState { NoneState , Visible , SemiVisible , Hidden }
 

Public Member Functions

 ModuleBase_ITreeNode (ModuleBase_ITreeNode *theParent=0)
 Default constructor. More...
 
virtual std::string type () const =0
 
virtual QVariant data (int theColumn, int theRole) const
 Returns the node representation according to theRole. More...
 
virtual Qt::ItemFlags flags (int theColumn) const
 Returns properties flag of the item. More...
 
ModuleBase_ITreeNodeparent () const
 Returns parent node of the current node. More...
 
QTreeNodesList children () const
 Returns list of the node children. More...
 
ModuleBase_ITreeNodesubNode (int theRow) const
 Returns a children node according to given row (index) More...
 
ModuleBase_ITreeNodesubNode (const ObjectPtr &theObj, bool allLevels=true) const
 Finds a node which contains the referenced object. More...
 
bool hasSubNode (ModuleBase_ITreeNode *theNode, bool allLevels=true) const
 Returns true if the given node is found within children. More...
 
int childrenCount () const
 Returns number of children. More...
 
int nodeRow (ModuleBase_ITreeNode *theNode) const
 
virtual ObjectPtr object () const
 Returns object referenced by the node (can be null) More...
 
virtual void update ()
 Updates all sub-nodes of the node (checks whole sub-tree) More...
 
virtual QTreeNodesList objectCreated (const QObjectPtrList &theObjects)
 Process creation of objects. More...
 
virtual QTreeNodesList objectsDeleted (const DocumentPtr &theDoc, const QString &theGroup)
 Process deletion of objects. More...
 
virtual ModuleBase_IWorkshopworkshop () const
 Returns workshop object. Has to be reimplemented in a root node. More...
 
virtual DocumentPtr document () const
 Returns document object of the sub-tree. Has to be reimplemented in sub-tree root object. More...
 
virtual ModuleBase_ITreeNodefindParent (const DocumentPtr &theDoc, QString theGroup)
 Returns a node which belongs to the given document and contains objects of the given group. More...
 
virtual ModuleBase_ITreeNodefindRoot (const DocumentPtr &theDoc)
 Returns root node of a data tree of the given document. More...
 
virtual VisibilityState visibilityState () const
 Returns visibilitystate of the node in viewer 3d. More...
 

Protected Member Functions

virtual void deleteChildren ()
 deletes all children nodes (called in destructor.) More...
 
void sortChildren ()
 

Protected Attributes

ModuleBase_ITreeNodemyParent
 Parent of the node. More...
 
QTreeNodesList myChildren
 Children of the node. More...
 

Constructor & Destructor Documentation

◆ ModuleBase_ITreeNode()

ModuleBase_ITreeNode::ModuleBase_ITreeNode ( ModuleBase_ITreeNode theParent = 0)
inline

Default constructor.

Member Function Documentation

◆ data()

virtual QVariant ModuleBase_ITreeNode::data ( int  theColumn,
int  theRole 
) const
inlinevirtual

Returns the node representation according to theRole.

Reimplemented in PartSet_StepNode, PartSet_ObjectFolderNode, PartSet_PartRootNode, PartSet_FolderNode, PartSet_ObjectNode, and PartSet_TreeNode.

◆ flags()

virtual Qt::ItemFlags ModuleBase_ITreeNode::flags ( int  theColumn) const
inlinevirtual

Returns properties flag of the item.

Reimplemented in PartSet_PartRootNode, PartSet_FolderNode, and PartSet_ObjectNode.

◆ parent()

ModuleBase_ITreeNode* ModuleBase_ITreeNode::parent ( ) const
inline

Returns parent node of the current node.

◆ children()

QTreeNodesList ModuleBase_ITreeNode::children ( ) const
inline

Returns list of the node children.

◆ subNode() [1/2]

ModuleBase_ITreeNode* ModuleBase_ITreeNode::subNode ( int  theRow) const
inline

Returns a children node according to given row (index)

◆ subNode() [2/2]

ModuleBase_ITreeNode* ModuleBase_ITreeNode::subNode ( const ObjectPtr &  theObj,
bool  allLevels = true 
) const
inline

Finds a node which contains the referenced object.

Parameters
theObjan object to find
allLevelsif true then all sub-trees will be processed

◆ hasSubNode()

bool ModuleBase_ITreeNode::hasSubNode ( ModuleBase_ITreeNode theNode,
bool  allLevels = true 
) const
inline

Returns true if the given node is found within children.

Parameters
theNodea node to find
allLevelsif true then all sub-trees will be processed

◆ childrenCount()

int ModuleBase_ITreeNode::childrenCount ( ) const
inline

Returns number of children.

◆ object()

virtual ObjectPtr ModuleBase_ITreeNode::object ( ) const
inlinevirtual

Returns object referenced by the node (can be null)

Reimplemented in PartSet_PartRootNode, and PartSet_ObjectNode.

◆ update()

virtual void ModuleBase_ITreeNode::update ( )
inlinevirtual

Updates all sub-nodes of the node (checks whole sub-tree)

Reimplemented in PartSet_ObjectFolderNode, PartSet_PartRootNode, PartSet_RootNode, PartSet_FolderNode, and PartSet_ObjectNode.

◆ objectCreated()

virtual QTreeNodesList ModuleBase_ITreeNode::objectCreated ( const QObjectPtrList &  theObjects)
inlinevirtual

Process creation of objects.

Parameters
theObjectsa list of created objects
Returns
a list of nodes which corresponds to the created objects

Reimplemented in PartSet_ObjectFolderNode, PartSet_PartRootNode, PartSet_FeatureFolderNode, PartSet_FolderNode, and PartSet_ObjectNode.

◆ objectsDeleted()

virtual QTreeNodesList ModuleBase_ITreeNode::objectsDeleted ( const DocumentPtr &  theDoc,
const QString &  theGroup 
)
inlinevirtual

Process deletion of objects.

Parameters
theDoca document where objects were deleted
theGroupa name of group where objects were deleted
Returns
a list of parents where nodes were deleted

Reimplemented in PartSet_ObjectFolderNode, PartSet_PartRootNode, PartSet_FeatureFolderNode, PartSet_FolderNode, and PartSet_ObjectNode.

◆ workshop()

virtual ModuleBase_IWorkshop* ModuleBase_ITreeNode::workshop ( ) const
inlinevirtual

Returns workshop object. Has to be reimplemented in a root node.

Reimplemented in PartSet_RootNode.

◆ document()

virtual DocumentPtr ModuleBase_ITreeNode::document ( ) const
inlinevirtual

Returns document object of the sub-tree. Has to be reimplemented in sub-tree root object.

Reimplemented in PartSet_PartRootNode, and PartSet_RootNode.

◆ findParent()

virtual ModuleBase_ITreeNode* ModuleBase_ITreeNode::findParent ( const DocumentPtr &  theDoc,
QString  theGroup 
)
inlinevirtual

Returns a node which belongs to the given document and contains objects of the given group.

Parameters
theDoca document
theGroupa name of objects group
Returns
a parent node if it is found

Reimplemented in PartSet_FeatureFolderNode, and PartSet_FolderNode.

◆ findRoot()

virtual ModuleBase_ITreeNode* ModuleBase_ITreeNode::findRoot ( const DocumentPtr &  theDoc)
inlinevirtual

Returns root node of a data tree of the given document.

Parameters
theDoca document
Returns
a tree node which is a root of the document structure

◆ visibilityState()

virtual VisibilityState ModuleBase_ITreeNode::visibilityState ( ) const
inlinevirtual

Returns visibilitystate of the node in viewer 3d.

Reimplemented in PartSet_StepNode, and PartSet_ObjectNode.

◆ deleteChildren()

virtual void ModuleBase_ITreeNode::deleteChildren ( )
inlineprotectedvirtual

deletes all children nodes (called in destructor.)

Reimplemented in PartSet_PartRootNode.

Field Documentation

◆ myParent

ModuleBase_ITreeNode* ModuleBase_ITreeNode::myParent
protected

Parent of the node.

◆ myChildren

QTreeNodesList ModuleBase_ITreeNode::myChildren
protected

Children of the node.