proland::Node Class Reference
[graph]

A Node is described by it's XY coordinates. More...

#include <Node.h>

Inheritance diagram for proland::Node:
proland::LazyNode

List of all members.

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

Graphowner
 The graph containing this Node.
vec2d pos
 X & Y coordinates of this Node.
vector< CurveIdcurves
 List of Curves that use this Node.

Detailed Description

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.

Author:
Antoine Begault

Constructor & Destructor Documentation

proland::Node::Node ( Graph owner,
double  x,
double  y 
)

Creates a new Node.

Parameters:
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.


Member Function Documentation

virtual void proland::Node::addCurve ( CurveId  c  )  [virtual]

Adds a Curve to the Curves list.

Parameters:
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.

Parameters:
n a graph node.
virtual CurvePtr proland::Node::getCurve ( int  i  )  const [virtual]

Gets a curve at a given index.

Parameters:
i the index of the curve to return.
Returns:
the i'th curve, or NULL if i is out of range.
int proland::Node::getCurveCount ( const set< CurveId > &  includedCurves  )  const

Returns the number of curves of a given set that use this Node.

Parameters:
includedCurves a set of Curves.
Returns:
the number of Curves that uses this Node amongst the given set.
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).

Parameters:
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.

Parameters:
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.

Parameters:
v a vector containing X&Y coordinates.

Member Data Documentation

vector<CurveId> proland::Node::curves [mutable, private]

List of Curves that use this Node.

The graph containing this Node.

vec2d proland::Node::pos [private]

X & Y coordinates of this Node.


Generated on Sat May 12 09:42:48 2012 for proland by  doxygen 1.6.1