#include <TreeNode.h>
Public Member Functions | |
void | addChild (boost::shared_ptr< TreeNode > pChild) |
boost::shared_ptr< TreeNode > | f () |
std::vector< boost::shared_ptr< TreeNode > > | getChildren () |
unsigned int | getNumberOfNodes () |
boost::shared_ptr< ISM::ObjectSet > | getObjectSet () |
void | printTreeToConsole (unsigned int space) |
void | setIDs () |
boost::shared_ptr< TreeNode > | setNewRootNodeByType (std::string pType) |
TreeNode (boost::shared_ptr< ISM::ObjectSet > pObjectSet) | |
TreeNode (boost::shared_ptr< TreeNode > pRoot) | |
~TreeNode () | |
Public Attributes | |
std::vector< boost::shared_ptr< TreeNode > > | mChildren |
unsigned int | mID |
bool | mIsReference = false |
boost::shared_ptr< ISM::ObjectSet > | mObjectSet |
boost::shared_ptr< TreeNode > | mParent |
boost::shared_ptr< TreeNode > | mReferenceTo |
Private Member Functions | |
void | reassignNewParentNode (boost::shared_ptr< TreeNode > pParent) |
void | updateIDs (unsigned int &pID, bool pUpdateReferencIDs) |
std::vector< boost::shared_ptr< TreeNode > > | updateReferences (boost::shared_ptr< TreeNode > pRoot) |
The data structure representing the object relation tree. The nodes represented by this class are objects with a given type and instance id. Edges from this node (represented by a list of nodes) are references to child-objects one level deeper down the tree.
Definition at line 40 of file TreeNode.h.
SceneModel::TreeNode::TreeNode | ( | boost::shared_ptr< ISM::ObjectSet > | pObjectSet | ) |
Constructor.
pObjectSet | An object set containing all observations of a single object over time. |
Definition at line 22 of file TreeNode.cpp.
SceneModel::TreeNode::TreeNode | ( | boost::shared_ptr< TreeNode > | pRoot | ) |
Copy Constructor.
pRoot | The root node of the tree to copy. |
Definition at line 27 of file TreeNode.cpp.
SceneModel::TreeNode::~TreeNode | ( | ) |
Destructor.
Definition at line 36 of file TreeNode.cpp.
void SceneModel::TreeNode::addChild | ( | boost::shared_ptr< TreeNode > | pChild | ) |
Adds a child to the node.
child | The node to add as a child. |
Definition at line 100 of file TreeNode.cpp.
boost::shared_ptr< TreeNode > SceneModel::TreeNode::f | ( | ) |
Returns a boost shared pointer from this.
Definition at line 116 of file TreeNode.cpp.
std::vector< boost::shared_ptr< TreeNode > > SceneModel::TreeNode::getChildren | ( | ) |
Returns the children of this node.
Definition at line 95 of file TreeNode.cpp.
unsigned int SceneModel::TreeNode::getNumberOfNodes | ( | ) |
Returns the number of nodes in the tree.
Definition at line 106 of file TreeNode.cpp.
boost::shared_ptr< ISM::ObjectSet > SceneModel::TreeNode::getObjectSet | ( | ) |
Returns the object set associated with the node.
Definition at line 90 of file TreeNode.cpp.
void SceneModel::TreeNode::printTreeToConsole | ( | unsigned int | space | ) |
Prints the generated tree to console.
node | The root of tree that should be printed. |
space | The number of leading spaces. |
Definition at line 121 of file TreeNode.cpp.
|
private |
Recursively reassigns a new parent node.
pParent | the new parent node. |
Definition at line 139 of file TreeNode.cpp.
void SceneModel::TreeNode::setIDs | ( | ) |
Assigns unique IDs to all nodes so references can later be expressed through IDs only.
Definition at line 163 of file TreeNode.cpp.
boost::shared_ptr< TreeNode > SceneModel::TreeNode::setNewRootNodeByType | ( | std::string | pType | ) |
Rebuilds the tree so that the node with the given type is the new root node.
pType | The type of the new node. |
Definition at line 40 of file TreeNode.cpp.
|
private |
Recursively updates the IDs of the nodes through DFS. Used in setIDs().
pID | If conditions are met, pID+1 is assigned as the node's ID. |
pUpdateReferenceIDs | Whether to update only the non-reference or only the reference node IDs. |
Definition at line 171 of file TreeNode.cpp.
|
private |
Recursively checks all references in the tree. If they point into pRoot, they are flipped to point out of it instead to avoid circles.
pRoot | A root which should only have references pointing out from it. |
Definition at line 182 of file TreeNode.cpp.
std::vector<boost::shared_ptr<TreeNode> > SceneModel::TreeNode::mChildren |
A list of all child nodes.
Definition at line 134 of file TreeNode.h.
unsigned int SceneModel::TreeNode::mID |
A unique ID of this node.
Definition at line 149 of file TreeNode.h.
bool SceneModel::TreeNode::mIsReference = false |
Whether this node is a reference to another.
Definition at line 139 of file TreeNode.h.
boost::shared_ptr<ISM::ObjectSet> SceneModel::TreeNode::mObjectSet |
An object trajectory containing all observations of a single object over time.
Definition at line 123 of file TreeNode.h.
boost::shared_ptr<TreeNode> SceneModel::TreeNode::mParent |
A reference to the parent node. Required for changing the structure of the tree later.
Definition at line 129 of file TreeNode.h.
boost::shared_ptr<TreeNode> SceneModel::TreeNode::mReferenceTo |
If this node is a reference, this is the node it points to.
Definition at line 144 of file TreeNode.h.