proland::BasicGraph Class Reference
[graph]

A BasicGraph contains a list of nodes, curves and areas, which can also contain graphs. More...

#include <BasicGraph.h>

Inheritance diagram for proland::BasicGraph:
proland::Graph

List of all members.

Classes

class  BasicGraphIterator
 BasicGraph implementation for the abstract class GraphIterator. More...

Public Member Functions

 BasicGraph ()
 Creates a new BasicGraph.
virtual ~BasicGraph ()
 Deletes this BasicGraph.
virtual void clear ()
 Clears the Graph : erases all areas, curves and nodes.
int getNodeCount () const
 Returns the number of nodes in this graph.
int getCurveCount () const
 Returns the number of curves in this graph.
int getAreaCount () const
 Returns the number of areas in this graph.
NodePtr getNode (NodeId id)
 Returns a node.
CurvePtr getCurve (CurveId id)
 Returns a curve.
AreaPtr getArea (AreaId id)
 Returns an area.
ptr< CurveIteratorgetChildCurves (CurveId parentId)
 Returns the childs of a given curve.
AreaPtr getChildArea (AreaId parentId)
 Returns the child of a given area.
virtual void load (const string &file, bool loadSubgraphs=true)
 Loads a graph.
virtual void load (FileReader *fileReader, bool loadSubgraphs=true)
 Loads a graph from a basic file.
virtual void loadIndexed (FileReader *fileReader, bool loadSubgraphs=true)
 Loads a graph from an indexed file.
NodePtr newNode (const vec2d &p)
 Adds a node to this graph.
virtual CurvePtr newCurve (CurvePtr parent, bool setParent)
 Adds a curve to this graph.
virtual CurvePtr newCurve (CurvePtr model, NodePtr start, NodePtr end)
 Adds a curve to this graph.
AreaPtr newArea (AreaPtr parent, bool setParent)
 Adds an area to this graph.

Protected Member Functions

void removeNode (NodeId id)
 Removes a Node from this graph.
void removeCurve (CurveId id)
 Removes a Curve from this graph.
void removeArea (AreaId id)
 Removes an Area from this graph.
ptr< NodeIteratorgetNodes ()
 Returns an iterator containing the complete list of nodes in this graph.
ptr< CurveIteratorgetCurves ()
 Returns an iterator containing the complete list of curves in this graph.
ptr< AreaIteratorgetAreas ()
 Returns an iterator containing the complete list of areas in this graph.
void clean ()
 Clears the list of removedCurves and removedAreas.

Protected Attributes

vector< CurvePtr > removedCurves
 Curves that were removed.
vector< AreaPtr > removedAreas
 Areas that were removed.
map< NodeId, NodePtr > nodes
 List of nodes contained in this graph, mapped to their ID.
multimap< CurveId, CurvePtr > curves
 List of curves contained in this graph, mapped to their parents, or to themselves if no parent (for root graph for example).
map< AreaId, AreaPtr > areas
 List of areas contained in this graph, mapped to their parents, or to themselves if no parent (for root graph for example).

Detailed Description

A BasicGraph contains a list of nodes, curves and areas, which can also contain graphs.

See Graph. BasicGraphs DO store the information related to their components. It may be used as the level 0 Graph as well as any other level.

Author:
Antoine Begault, Guillaume Piolat

Constructor & Destructor Documentation

proland::BasicGraph::BasicGraph (  ) 

Creates a new BasicGraph.

virtual proland::BasicGraph::~BasicGraph (  )  [virtual]

Deletes this BasicGraph.


Member Function Documentation

void proland::BasicGraph::clean (  )  [protected, virtual]

Clears the list of removedCurves and removedAreas.

Implements proland::Graph.

virtual void proland::BasicGraph::clear (  )  [virtual]

Clears the Graph : erases all areas, curves and nodes.

Called when deleting a graph or when loading a new graph.

Implements proland::Graph.

AreaPtr proland::BasicGraph::getArea ( AreaId  id  )  [inline, virtual]

Returns an area.

Parameters:
id the id of the area to return.
Returns:
the area corresponding to this Id, NULL if not in this graph.

Implements proland::Graph.

int proland::BasicGraph::getAreaCount (  )  const [inline, virtual]

Returns the number of areas in this graph.

Implements proland::Graph.

ptr<AreaIterator> proland::BasicGraph::getAreas (  )  [inline, protected, virtual]

Returns an iterator containing the complete list of areas in this graph.

Implements proland::Graph.

AreaPtr proland::BasicGraph::getChildArea ( AreaId  parentId  )  [virtual]

Returns the child of a given area.

A child Area is an area that was created from another area by clipping.

Parameters:
parentId the parent area.
Returns:
the child area.

Implements proland::Graph.

ptr<CurveIterator> proland::BasicGraph::getChildCurves ( CurveId  parentId  )  [inline, virtual]

Returns the childs of a given curve.

Child Curves are the curves that were created from another curve by clipping.

Parameters:
parentId the parent curve.
Returns:
a CurveIterator containing the child curves.

Implements proland::Graph.

CurvePtr proland::BasicGraph::getCurve ( CurveId  id  )  [inline, virtual]

Returns a curve.

Parameters:
id the id of the curve to return.
Returns:
the curve corresponding to this Id, NULL if not in this graph.

Implements proland::Graph.

int proland::BasicGraph::getCurveCount (  )  const [inline, virtual]

Returns the number of curves in this graph.

Implements proland::Graph.

ptr<CurveIterator> proland::BasicGraph::getCurves (  )  [inline, protected, virtual]

Returns an iterator containing the complete list of curves in this graph.

Implements proland::Graph.

NodePtr proland::BasicGraph::getNode ( NodeId  id  )  [inline, virtual]

Returns a node.

Parameters:
id the id of the node to return.
Returns:
the node corresponding to this Id, NULL if not in this graph.

Implements proland::Graph.

int proland::BasicGraph::getNodeCount (  )  const [inline, virtual]

Returns the number of nodes in this graph.

Implements proland::Graph.

ptr<NodeIterator> proland::BasicGraph::getNodes (  )  [inline, protected, virtual]

Returns an iterator containing the complete list of nodes in this graph.

Implements proland::Graph.

virtual void proland::BasicGraph::load ( FileReader fileReader,
bool  loadSubgraphs = true 
) [virtual]

Loads a graph from a basic file.

Parameters:
the stream to read the data from.
loadSubgraphs if true, will load the subgraphs.

Implements proland::Graph.

virtual void proland::BasicGraph::load ( const string &  file,
bool  loadSubgraphs = true 
) [virtual]

Loads a graph.

This method determines whether to call load() or loadIndexed() method.

Parameters:
file the file to load from.
loadSubgraphs if true, will load the subgraphs.

Implements proland::Graph.

virtual void proland::BasicGraph::loadIndexed ( FileReader fileReader,
bool  loadSubgraphs = true 
) [virtual]

Loads a graph from an indexed file.

Indexed files are used to load LazyGraphs faster. It contains the indexes of each element in the file.

Parameters:
the stream to read the data from.
loadSubgraphs if true, will load the subgraphs.
AreaPtr proland::BasicGraph::newArea ( AreaPtr  parent,
bool  setParent 
) [virtual]

Adds an area to this graph.

Parameters:
parent the parent area (NULL if none).
setParent if true, the new area's parent will be s et to the 'parent' parameter.

Implements proland::Graph.

virtual CurvePtr proland::BasicGraph::newCurve ( CurvePtr  model,
NodePtr  start,
NodePtr  end 
) [virtual]

Adds a curve to this graph.

Parameters:
model a model curve : the new curve will have the same vertices, if any.
start the start node.
end the end node.
Returns:
the new curve.

Implements proland::Graph.

virtual CurvePtr proland::BasicGraph::newCurve ( CurvePtr  parent,
bool  setParent 
) [virtual]

Adds a curve to this graph.

Parameters:
parent the parent curve (NULL if none).
setParent if true, the new curve's parent will be set to the 'parent' parameter.
Returns:
the new curve.

Implements proland::Graph.

NodePtr proland::BasicGraph::newNode ( const vec2d &  p  )  [virtual]

Adds a node to this graph.

Parameters:
p a vector containing the coordinates of the new node.
Returns:
the new node.

Implements proland::Graph.

void proland::BasicGraph::removeArea ( AreaId  id  )  [protected, virtual]

Removes an Area from this graph.

This method is called when editing the Graph.

Parameters:
id the id of an Area that is currently being deleted.

Implements proland::Graph.

void proland::BasicGraph::removeCurve ( CurveId  id  )  [protected, virtual]

Removes a Curve from this graph.

This method is called when editing the Graph.

Parameters:
id the id of a Curve that is currently being deleted.

Implements proland::Graph.

void proland::BasicGraph::removeNode ( NodeId  id  )  [protected, virtual]

Removes a Node from this graph.

This method is called when editing the Graph.

Parameters:
id the id of a Node that is currently being deleted.

Implements proland::Graph.


Member Data Documentation

map<AreaId, AreaPtr> proland::BasicGraph::areas [protected]

List of areas contained in this graph, mapped to their parents, or to themselves if no parent (for root graph for example).

multimap<CurveId, CurvePtr> proland::BasicGraph::curves [protected]

List of curves contained in this graph, mapped to their parents, or to themselves if no parent (for root graph for example).

map<NodeId, NodePtr> proland::BasicGraph::nodes [protected]

List of nodes contained in this graph, mapped to their ID.

vector<AreaPtr> proland::BasicGraph::removedAreas [protected]

Areas that were removed.

Used to update the graph.

vector<CurvePtr> proland::BasicGraph::removedCurves [protected]

Curves that were removed.

Used to update the graph.


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