Skip to content
Snippets Groups Projects
Commit 71a4cf58 authored by Jan Möbius's avatar Jan Möbius
Browse files

Added a function to find a node in the objects

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9105 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b3d10993
Branches
Tags
No related merge requests found
......@@ -233,6 +233,28 @@ SeparatorNode* BaseObjectData::baseNode() {
return separatorNode_;
}
bool BaseObjectData::hasNode(BaseNode* _node) {
QList< BaseNode* > list;
list.push_back(separatorNode_);
BaseNode* currentNode;
while (!list.empty()) {
currentNode = list.front();
if ( currentNode->find(_node) == currentNode->childrenEnd() ) {
for ( BaseNode::ChildIter child = currentNode->childrenBegin() ; child != currentNode->childrenEnd(); ++child )
list.push_back(*child);
} else
return true;
list.pop_front();
}
return false;
}
BaseNode* BaseObjectData::primaryNode() {
return separatorNode_;
}
......
......@@ -188,6 +188,13 @@ class DLLEXPORT BaseObjectData : public BaseObject
*/
SeparatorNode* baseNode();
/** \brief Check if the given node is owned by this object
*
* You can overload this function and return true, if your object generated the given node.
* Don't forget to call this baseclass function on overload!
*/
virtual bool hasNode(BaseNode* _node);
/** get the primary node of this object (Use this node to change drawModes)
*/
virtual BaseNode* primaryNode();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment