#include <Node.h>
Collaboration diagram for Node:
Public Member Functions | |
Node (float=1.f, const std::string &="", Color color=defaultColor) | |
Constructor: weightfactor, name and color for the node are passed as arguments. | |
Node (const Node &) | |
Copy constructor. | |
Node & | operator= (const Node &) |
Overloaded assignment operator. | |
bool | addChild (const Node &) |
Adds a child to the node's child list (child is appended at the end of the list). | |
bool | addChild (size_t, const Node &) |
Adds a child at the given index. | |
bool | removeChild (size_t) |
Remove the node's child at given index. | |
size_t | getNumChildren () const |
Returns the number of children. | |
const Node & | getChild (size_t) const |
Returns reference to the child in the node's childlist at given index. | |
void | doLayout (float=2.f *M_PI) |
Calculates the layout for the tree. | |
operator Polar () const | |
Returns the node's position in polar coordinates. | |
const std::string & | getName () const |
Returns the node's name. | |
List< Node > | doRestructedLayouts (const Node &, float=2.f *M_PI, bool=true) |
bool | findNode (const Node &, List< size_t > &) const |
bool | findNode (const Node &, Node &) const |
Recursively searches tree for node refNode. | |
bool | findNode (const Node &) const |
Recursively searches tree for node refNode. | |
bool | operator== (const Node &) const |
Overwritten relational "equal to" operator; comparison is made by comparing nodes' ids, which are unique. | |
bool | operator!= (const Node &) const |
Overwritten relational "not equal to" operator; comparison is made by comparing nodes' ids, which are unique. | |
void | getPhiRange (float &, float &) const |
Returns node's phi range. | |
float | getWeight () const |
Returns the node's weight. | |
Color | getColor () const |
Returns the node's color. | |
int | getDepth () const |
Returns the depth of a node's subtree. | |
Static Public Attributes | |
static Color | defaultColor = {0.f,0.f,0.f,1.f} |
default colour for nodes | |
Protected Member Functions | |
float | calculateWeight (int) const |
Calculates the weight of a node; the weight of a node is the maximum of the sum of the node's childs' weights and the node's weightfactor divided by the nodes depth. | |
void | doPlacement (float, float, float, int, bool=false, float=0.f) |
Does the placement of the node. | |
Node | restruct (size_t) const |
void | doFixedLayout (float=0.f, float=2.f *M_PI, bool=true) |
Calculates the layout for the tree, given an orientation angle. | |
Private Types | |
typedef unsigned int | Id |
Private Attributes | |
float | weightFactor |
weight factor of the node as read from the XML file | |
float | r |
float | phi |
float | phi0 |
float | phi1 |
Color | color |
node's color | |
List< Node > | children |
list of node's children | |
std::string | name |
each node has an unique name as read from the XML file | |
Id | id |
each Node-instance has an unique id | |
Static Private Attributes | |
static float | childPadding = 0.01f |
static Id | idCounter = 0 |
Classes | |
struct | Color |
typedef unsigned int Node::Id [private] |
Node::Node | ( | float | = 1.f , |
|
const std::string & | = "" , |
|||
Color | color = defaultColor | |||
) | [explicit] |
Constructor: weightfactor, name and color for the node are passed as arguments.
Node::Node | ( | const Node & | ) |
Copy constructor.
bool Node::addChild | ( | const Node & | ) |
Adds a child to the node's child list (child is appended at the end of the list).
bool Node::addChild | ( | size_t | , | |
const Node & | ||||
) |
Adds a child at the given index.
bool Node::removeChild | ( | size_t | ) |
Remove the node's child at given index.
size_t Node::getNumChildren | ( | ) | const |
Returns the number of children.
const Node & Node::getChild | ( | size_t | ) | const |
Returns reference to the child in the node's childlist at given index.
void Node::doLayout | ( | float | = 2.f *M_PI |
) |
Calculates the layout for the tree.
Node::operator Polar< float > | ( | ) | const |
Returns the node's position in polar coordinates.
const std::string & Node::getName | ( | ) | const |
Returns the node's name.
List< Node > Node::doRestructedLayouts | ( | const Node & | node, | |
float | fullRange = 2.f * M_PI , |
|||
bool | displacementHint = true | |||
) |
Returns a list of restructured layouts of the graph. These are the keyframe-layouts for the transition animation between the old root node and the node selected as the new focus node. If the new focus node does not lie on the most inner ring (i.e. the new focus does not have a network distance of 1 to the old root node), a series of transitions between intermediate (temporal) focus nodes is performed along the path in the graph from the old focus node to the new focus node. The returned list contains all these intermediate steps of the transition animation.
Searches a node, creates a path to the nodes, in terms of child indecis to each parents' childlist. Recursively called on node's children.
bool Node::findNode | ( | const Node & | ) | const |
Recursively searches tree for node refNode.
bool Node::operator== | ( | const Node & | ) | const |
Overwritten relational "equal to" operator; comparison is made by comparing nodes' ids, which are unique.
bool Node::operator!= | ( | const Node & | ) | const |
Overwritten relational "not equal to" operator; comparison is made by comparing nodes' ids, which are unique.
void Node::getPhiRange | ( | float & | , | |
float & | ||||
) | const |
Returns node's phi range.
float Node::getWeight | ( | ) | const |
Returns the node's weight.
Node::Color Node::getColor | ( | ) | const |
Returns the node's color.
int Node::getDepth | ( | ) | const |
Returns the depth of a node's subtree.
float Node::calculateWeight | ( | int | ) | const [protected] |
Calculates the weight of a node; the weight of a node is the maximum of the sum of the node's childs' weights and the node's weightfactor divided by the nodes depth.
void Node::doPlacement | ( | float | , | |
float | , | |||
float | , | |||
int | , | |||
bool | = false , |
|||
float | = 0.f | |||
) | [protected] |
Does the placement of the node.
Node Node::restruct | ( | size_t | index | ) | const [protected] |
Restructures the graph and returns the root-node of the new graph. The node at given index in the current root-node's childlist (the node, this function is being called) is the new root-node and the graph is restructured such that the old root node (the new root's parent node) becomes a child of the new root node.
void Node::doFixedLayout | ( | float | = 0.f , |
|
float | = 2.f *M_PI , |
|||
bool | = true | |||
) | [protected] |
Calculates the layout for the tree, given an orientation angle.
Node::Color Node::defaultColor = {0.f,0.f,0.f,1.f} [static] |
default colour for nodes
float Node::weightFactor [private] |
weight factor of the node as read from the XML file
float Node::r [private] |
float Node::phi [private] |
float Node::phi0 [private] |
float Node::phi1 [private] |
Color Node::color [private] |
node's color
List<Node> Node::children [private] |
list of node's children
std::string Node::name [private] |
each node has an unique name as read from the XML file
float Node::childPadding = 0.01f [static, private] |
Node::Id Node::idCounter = 0 [static, private] |