A Node is described by it's XY coordinates. More...
#include <Node.h>
Public Member Functions | |
Node (Graph *owner, double x, double y) | |
Creates a new Node. | |
virtual | ~Node () |
Deletes this Node. | |
virtual NodeId | getId () const |
Returns this Node's Id. | |
vec2d | getPos () const |
Returns the XY coordinates of this Node. | |
virtual int | getCurveCount () const |
Returns the number of Curves using this Node. | |
int | getCurveCount (const set< CurveId > &includedCurves) const |
Returns the number of curves of a given set that use this Node. | |
virtual CurvePtr | getCurve (int i) const |
Gets a curve at a given index. | |
CurvePtr | getCurve (const NodePtr n) const |
Returns a curve that connects this node to the given node. | |
NodePtr | getOpposite (const NodePtr n) const |
Returns the opposite of the given curve extremity. | |
void | setPos (const vec2d &v) |
Sets the coordinates of this Node. | |
virtual void | addCurve (CurveId c) |
Adds a Curve to the Curves list. | |
virtual void | removeCurve (CurveId c) |
Removes a Curve from the Curves list. | |
Private Attributes | |
Graph * | owner |
The graph containing this Node. | |
vec2d | pos |
X & Y coordinates of this Node. | |
vector< CurveId > | curves |
List of Curves that use this Node. |
A Node is described by it's XY coordinates.
It is used to represent start and end points of curves, intersections... Several Curves can share the same Node.
proland::Node::Node | ( | Graph * | owner, | |
double | x, | |||
double | y | |||
) |
Creates a new Node.
owner | the graph containing this node. | |
x | this node's X coord. | |
y | this node's Y coord. |
virtual proland::Node::~Node | ( | ) | [virtual] |
Deletes this Node.
virtual void proland::Node::addCurve | ( | CurveId | c | ) | [virtual] |
Adds a Curve to the Curves list.
c | the id of the Curve to add. |
Reimplemented in proland::LazyNode.
CurvePtr proland::Node::getCurve | ( | const NodePtr | n | ) | const |
Returns a curve that connects this node to the given node.
There may be zero or more such curve. This method returns only one of them, or NULL is there is no such curve.
n | a graph node. |
virtual CurvePtr proland::Node::getCurve | ( | int | i | ) | const [virtual] |
Gets a curve at a given index.
i | the index of the curve to return. |
int proland::Node::getCurveCount | ( | const set< CurveId > & | includedCurves | ) | const |
virtual int proland::Node::getCurveCount | ( | ) | const [virtual] |
Returns the number of Curves using this Node.
virtual NodeId proland::Node::getId | ( | ) | const [virtual] |
Returns this Node's Id.
For Node, a NodeId is a direct reference to the Node (in opposition to LazyNodes, for which Ids are a unique integer).
Reimplemented in proland::LazyNode.
NodePtr proland::Node::getOpposite | ( | const NodePtr | n | ) | const |
Returns the opposite of the given curve extremity.
This method must be used only for nodes that connect exactly two curves. Given the extremity of one of these two curves, it returns the extremity of the other curve (here "the extremity of a curve" is the extremity that is not equal to this node).
n | the extremity of one of the two curves connected to this node. |
vec2d proland::Node::getPos | ( | ) | const [inline] |
Returns the XY coordinates of this Node.
virtual void proland::Node::removeCurve | ( | CurveId | c | ) | [virtual] |
Removes a Curve from the Curves list.
c | the id of the Curve to remove. |
Reimplemented in proland::LazyNode.
void proland::Node::setPos | ( | const vec2d & | v | ) |
Sets the coordinates of this Node.
v | a vector containing X&Y coordinates. |
vector<CurveId> proland::Node::curves [mutable, private] |
List of Curves that use this Node.
Graph* proland::Node::owner [private] |
The graph containing this Node.
vec2d proland::Node::pos [private] |
X & Y coordinates of this Node.