A Curve is made of 2 nodes (start and end points) and a set of controlPoints. More...
#include <LazyCurve.h>
Public Member Functions | |
LazyCurve (Graph *owner, CurveId id) | |
Creates a new LazyCurve. | |
LazyCurve (Graph *owner, CurveId id, NodeId s, NodeId e) | |
Creates a new LazyCurve. | |
virtual | ~LazyCurve () |
Deletes this LazyCurve. | |
virtual CurveId | getId () const |
Returns this curve's Id For LazyCurve, a CurveId is a unique number, assigned by the owner Graph, (in opposition to Curves, for which Ids are a direct reference to the Curve). | |
virtual CurvePtr | getParent () const |
Returns this curve's parent. | |
virtual NodePtr | getStart () const |
Returns the starting Node. | |
virtual NodePtr | getEnd () const |
Returns the ending Node. | |
virtual void | addVertex (NodeId id, bool isEnd=1) |
Adds a vertex to the curve. | |
virtual void | loadVertex (NodeId id, bool isEnd=1) |
Adds a vertex to the curve. | |
virtual void | addVertex (double x, double y, float s, bool isControl) |
Adds a vertex to the curve. | |
virtual void | addVertex (vec2d pt, int rank, bool isControl) |
Adds a vertex to the curve. | |
virtual void | addVertex (const vec2d &p, float s, float l, bool isControl) |
Adds a vertex to the curve. | |
virtual void | addVertex (const Vertex &pt) |
Adds a vertex to the curve. | |
virtual void | addVertices (const vector< vec2d > &v) |
Adds a list of vertex to the curve. | |
virtual void | removeVertex (int i) |
Remove the i'th vertex from the list. | |
virtual void | setIsControl (int i, bool c) |
Sets the state of a Vertex. | |
virtual void | setS (int i, float s) |
Changes the S coordinate of a Vertex. | |
virtual void | setXY (int i, const vec2d &p) |
Sets the XY coords of a vertex. | |
virtual void | setWidth (float width) |
Sets this curve's width. | |
virtual void | setType (int type) |
Sets this curve's type. | |
void | loadVertex (float x, float y, float s, bool isControl) |
Adds a vertex to the curve. | |
virtual void | clear () |
Removes the references to this curve from its nodes. | |
virtual void | invert () |
Changes the orientation of this curve. | |
virtual void | addArea (AreaId a) |
Adds an area to the curve. | |
void | loadArea (AreaId a) |
Adds an area to the curve. | |
Protected Member Functions | |
virtual void | doRelease () |
Calls the LazyGraph::releaseCurve() method. | |
Private Member Functions | |
virtual void | removeArea (AreaId a) |
Removes an area from the curve. | |
virtual void | setParentId (CurveId id) |
Sets the parent Id. | |
Private Attributes | |
CurveId | parentId |
The parent Area's id. | |
NodeId | startId |
The start NodeId. | |
NodeId | endId |
The end NodeId. |
A Curve is made of 2 nodes (start and end points) and a set of controlPoints.
It may be used to represent Areas, but can also be used independently. This is the 'Lazy' version of Curves. Allows real-time loading for LazyGraphs. Can be deleted and reloaded at any time depending on the needs.
Creates a new LazyCurve.
owner | the graph containing this curve. | |
c | the parent curve, from which this curve was clipped. | |
s | the start node. | |
e | the end node. |
virtual proland::LazyCurve::~LazyCurve | ( | ) | [virtual] |
Deletes this LazyCurve.
virtual void proland::LazyCurve::addArea | ( | AreaId | a | ) | [virtual] |
Adds an area to the curve.
2 Areas can be stored (one for each side of the curve).
a | the id of the area to add. |
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::addVertex | ( | const Vertex & | pt | ) | [virtual] |
Adds a vertex to the curve.
pt | a model Vertex, from which the values will be copied. |
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::addVertex | ( | const vec2d & | p, | |
float | s, | |||
float | l, | |||
bool | isControl | |||
) | [virtual] |
Adds a vertex to the curve.
p | a vector containing the x&y coordinates of the vertex. | |
s | the s coordinate. | |
l | the l coordinate. | |
isControl | if true, the vertex will be a control point of this curve. |
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::addVertex | ( | vec2d | pt, | |
int | rank, | |||
bool | isControl | |||
) | [virtual] |
Adds a vertex to the curve.
rank | where to insert the Vertex. | |
x | Xcoord. | |
y | Ycoord. | |
s | pseudo curvilinear value. | |
isControl | if true, the vertex will be a control point of this curve. |
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::addVertex | ( | double | x, | |
double | y, | |||
float | s, | |||
bool | isControl | |||
) | [virtual] |
Adds a vertex to the curve.
x | Xcoord. | |
y | Ycoord. | |
s | pseudo curvilinear value. | |
isControl | if true, the vertex will be a control point of this curve. |
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::addVertex | ( | NodeId | id, | |
bool | isEnd = 1 | |||
) | [virtual] |
Adds a vertex to the curve.
id | a NodeId. Will be stored in start if start == NULL, else in end. | |
isEnd | determines if the node is the end node. if false, it will change this->start; if true && start != NULL, this->end. Default is true. |
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::addVertices | ( | const vector< vec2d > & | v | ) | [virtual] |
Adds a list of vertex to the curve.
v | the list of vertices. |
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::clear | ( | ) | [virtual] |
Removes the references to this curve from its nodes.
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::doRelease | ( | ) | [protected, virtual] |
Calls the LazyGraph::releaseCurve() method.
See Object::doRelease().
virtual NodePtr proland::LazyCurve::getEnd | ( | ) | const [virtual] |
Returns the ending Node.
Reimplemented from proland::Curve.
virtual CurveId proland::LazyCurve::getId | ( | ) | const [virtual] |
Returns this curve's Id For LazyCurve, a CurveId is a unique number, assigned by the owner Graph, (in opposition to Curves, for which Ids are a direct reference to the Curve).
Reimplemented from proland::Curve.
virtual CurvePtr proland::LazyCurve::getParent | ( | ) | const [virtual] |
Returns this curve's parent.
Should allways return NULL, because LazyGraph are only used on top of the graph, and thus have no parent.
Reimplemented from proland::Curve.
virtual NodePtr proland::LazyCurve::getStart | ( | ) | const [virtual] |
Returns the starting Node.
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::invert | ( | ) | [virtual] |
Changes the orientation of this curve.
Reimplemented from proland::Curve.
void proland::LazyCurve::loadArea | ( | AreaId | a | ) |
Adds an area to the curve.
2 Areas can be stored (one for each side of the curve).
a | the id of the area to add. |
void proland::LazyCurve::loadVertex | ( | float | x, | |
float | y, | |||
float | s, | |||
bool | isControl | |||
) |
Adds a vertex to the curve.
x | Xcoord. | |
y | Ycoord. | |
s | pseudo curvilinear value. | |
isControl | if true, the vertex will be a control point of this curve. |
virtual void proland::LazyCurve::loadVertex | ( | NodeId | id, | |
bool | isEnd = 1 | |||
) | [virtual] |
Adds a vertex to the curve.
id | a NodeId. Will be stored in start if start == NULL, else in end. | |
isEnd | determines if the node is the end node. if false, it will change this->start; if true && start != NULL, this->end. Default is true. |
virtual void proland::LazyCurve::removeArea | ( | AreaId | a | ) | [private, virtual] |
Removes an area from the curve.
a | the id of the area to remove. |
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::removeVertex | ( | int | i | ) | [virtual] |
Remove the i'th vertex from the list.
i | the rank of the vertex to remove. |
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::setIsControl | ( | int | i, | |
bool | c | |||
) | [virtual] |
Sets the state of a Vertex.
i | the rank of the vertex to change. | |
c | whether the vertex must be a control point or not. |
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::setParentId | ( | CurveId | id | ) | [private, virtual] |
Sets the parent Id.
See setParent().
id | a curve's Id. |
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::setS | ( | int | i, | |
float | s | |||
) | [virtual] |
Changes the S coordinate of a Vertex.
i | the rank of the vertex to edit. | |
s | the new S coordinate. |
Reimplemented from proland::Curve.
virtual void proland::LazyCurve::setType | ( | int | type | ) | [virtual] |
virtual void proland::LazyCurve::setWidth | ( | float | width | ) | [virtual] |
virtual void proland::LazyCurve::setXY | ( | int | i, | |
const vec2d & | p | |||
) | [virtual] |
Sets the XY coords of a vertex.
i | the rank of the vertex to move. | |
p | the new positions. |
Reimplemented from proland::Curve.
NodeId proland::LazyCurve::endId [private] |
CurveId proland::LazyCurve::parentId [private] |
The parent Area's id.
If parentId == id, there's no parent.
NodeId proland::LazyCurve::startId [private] |