proland::EditGraphOrthoLayer Class Reference
[edit]

An OrthoGPUProducer layer to edit Graph objects. More...

#include <EditGraphOrthoLayer.h>

Inheritance diagram for proland::EditGraphOrthoLayer:
proland::EditHydroGraphOrthoLayer

List of all members.

Classes

class  EditGraphHandler
 The EventHandler associated to EditGraphOrthoLayer. More...
class  EditGraphHandlerList
 Handles the multiple EditGraphHandlers associated to each EditGraphOrthoLayer. More...
struct  SelectionData
 Contains Data on the current selection. More...
struct  VertexData
 Data for a given Vertex. More...

Public Member Functions

 EditGraphOrthoLayer (const vector< ptr< GraphProducer > > &graphs, ptr< Program > layerProg, int displayLevel=0, float tolerance=8.0f/192.0f, bool softEdition=true, double softEditionDelay=100000.0, bool deform=false, string terrain="", ptr< ResourceManager > manager=NULL)
 Creates a new EditGraphOrthoLayer.
virtual ~EditGraphOrthoLayer ()
 Deletes this EditGraphOrthoLayer.
virtual void setTileSize (int tileSize, int tileBorder, float rootQuadSize)
 Sets tileSize, tileBorder, and rootQuadSize values.
virtual void useTile (int level, int tx, int ty, unsigned int deadline)
 Notifies this Layer that the given tile of its TileProducer is in use.
virtual void unuseTile (int level, int tx, int ty)
 Notifies this Layer that the given tile of its TileProducer is unused.
virtual void startCreateTile (int level, int tx, int ty, unsigned int deadline, ptr< Task > task, ptr< TaskGraph > result)
 Calls the startCreateTile() method for the currently selected GraphProducer.
virtual void beginCreateTile ()
 Sets the execution context for the Task that produce the tile data.
virtual void drawGraph (const vec3d &tileCoords, GraphPtr g, float pointSize, ptr< Mesh< vec3f, unsigned int > >mesh, vec2d &nx, vec2d &ny, vec2d &lx, vec2d &ly)
 Iterative method which draws a given Graph on a given Mesh.
virtual bool doCreateTile (int level, int tx, int ty, TileStorage::Slot *data)
 Draws the edited graph onto the ortho tile.
virtual void endCreateTile ()
 Restores the execution context.
virtual void stopCreateTile (int level, int tx, int ty)
 Stops the creation of a tile of this producer.
vector< ptr< GraphProducer > > getGraphs ()
 Returns the Graph edited in this editor.
int getGraphCount ()
 Returns the number of graphs handled by this layer.
int getEditedGraph ()
 Gets the index of the currently edited graph.
void setEditedGraph (int index)
 Sets the index of the currently edited graph.
bool select (TileCache::Tile *t, double x, double y, float tolerance, GraphPtr &graph, list< AreaId > &areas, CurvePtr &curve, int &segment, int &point)
 Selects a node / segment in the graph corresponding to given coords.
bool select (double x, double y, float tolerance)
 Interface function for selecting a curve node/segment.
bool selection ()
 Returns true if a point or segment is currently selected.
void getSelection (CurvePtr &curve, int &point, int &segment)
 Returns the current selection.
void setSelection (CurvePtr curve, int point, int segment)
 Changed the current selection.
bool findCurve (GraphPtr p, double x, double y, float tolerance, GraphPtr &graph, list< AreaId > &areas, CurvePtr &curve, int &segment, int &point)
 Iterative method for finding a Curve at given coordinates.
bool select (double x, double y, float tolerance, GraphPtr &graph, list< AreaId > &areas, CurvePtr &curve, int &segment, int &point)
 Initiates the node / segment search through the graphs.
bool updateSelectedCurve ()
 Updates the root Graph::changes field according to the current selection.
bool movePoint (double x, double y, int i=-1)
 Moves the selected point to the given coords.
bool add (double x, double y, float tolerance)
 Interface function for adding elements to the graph.
bool change ()
 Interface function for changing a selected node.
bool remove ()
 Interface function for removing an element.
bool invert ()
 Interface function for inverting the selected curve.
bool addVertex (double x, double y, GraphPtr g, CurvePtr &curve, int &segment, int &point, Graph::Changes &changes)
 Adds a Vertex inside the selected Curve.
bool transformVertex ()
 Interface function for changing the state of a Vertex.
bool transformVertex (GraphPtr g, CurvePtr &curve, int &point, Graph::Changes &changes)
 Changes the selected point into a node.
bool smoothCurve (bool smooth)
 Interface function for smoothing the Vertices of the selected Curve.
bool smoothNode (bool smooth)
 Interface function for smoothing the selected Node from the selected Curve.
bool smoothNode (GraphPtr g, CurvePtr &curve, int &point, Graph::Changes &changes, bool smooth)
 Adds ControlPoint around the given Node on the Curves where it is necessary to make the Node entirely smooth.
bool smoothCurve (GraphPtr g, CurvePtr &curve, int &point, int &segment, Graph::Changes &changes, bool smooth)
 Adds ControlPoint everywhere it is necessary to make the curve entirely smooth.
bool smoothArea (bool smooth)
 Interface function for smoothing the Vertices of all the Curves from the currently selected Curve's area.
bool smoothArea (GraphPtr g, CurvePtr &curve, int &point, int &segment, Graph::Changes &changes, bool smooth)
 Adds ControlPoint everywhere it is necessary to make the curves of an area entirely smooth.
bool addNode ()
 Splits the selected curve in two new curves by transforming the selected point into a node.
bool addNode (GraphPtr g, CurvePtr &curve, int &point, Graph::Changes &changes)
 Splits the selected curve in two new curves by transforming the selected point into a node.
bool removeNode (GraphPtr g, CurvePtr &curve, int &segment, int &point, Graph::Changes &changes)
 Removes the selected node.
virtual bool addCurve (double x, double y, float tolerance, GraphPtr g, CurvePtr &curve, int &point, Graph::Changes &changes)
 Adds a curve from selected point to given coords.
virtual bool addCurve (double x1, double y1, double x2, double y2, float tolerance, GraphPtr g, CurvePtr &curve, int &segment, int &point, Graph::Changes &changes)
 Adds a Curve between two new nodes.
virtual bool fitCurve ()
 Creates a bezier Curve that fits the points stored in displayedPoints.
bool removeCurve (GraphPtr g, CurvePtr &curve, Graph::Changes &changes)
 Removes the selected Curve, if any.
virtual void update ()
 Invalidates required tiles.
float getTolerance () const
 Returns tolerance selection parameter.
int getSelectedPoint () const
 Returns selectedPoint.
CurvePtr getSelectedCurve () const
 Returns selectedCurve.
int getSelectedSegment () const
 Returns selectedSegment.
ptr< GraphProducer > getEditedGraphPtr () const
 Returns editGraph.
int getDefaultCurveType () const
 Returns defaultCurveType.
void setDefaultCurveType (int t)
 Sets defaultCurveType.
float getDefaultCurveWidth () const
 Returns defaultCurveWidth.
void setDefaultCurveWidth (float t)
 Sets defaultCurveWidth.
virtual void getTypeNames (vector< string > &names)
 Returns customized type names for each curve type.

Public Attributes

vector< vec2i > displayedPoints
 List of points displayed on the Tile when drawing.

Static Public Attributes

static static_ptr
< EditGraphHandlerList
HANDLER
 The TweakGraphLayerList which contains each TweakGraphLayer handlers.
static static_ptr< Mesh< vec3f,
unsigned int > > 
mesh
 The mesh used for drawing curves.

Protected Member Functions

virtual void init (const vector< ptr< GraphProducer > > &graphs, ptr< Program > layerProg, int displayLevel=0, float tolerance=8.0f/192.0f, bool softEdition=true, double softEditionDelay=100000.0, bool deform=false, string terrain="", ptr< ResourceManager > manager=NULL)
 Initializes EditGraphOrthoLayer fields.
 EditGraphOrthoLayer ()
 Creates a new EditGraphOrthoLayer.
vec3d getTileCoords (int level, int tx, int ty)
 Returns the ox,oy,l coordinates of the given tile.

Protected Attributes

vector< ptr< GraphProducer > > graphs
 A vector of GraphProducers handled by this layer.
int defaultCurveType
 Default Curve Type when creating a new Curve.
float defaultCurveWidth
 Default Curve Width when creating a new Curve.
float tolerance
 Tolerance parameter for screen selection of points.
int editedGraph
 Index of currently edited graph in graphs, or -1 if not graph currently edited.
ptr< GraphProducer > editGraph
 The GraphProducer of the currently edited graph.
set< TileCache::Tile::Id > usedTiles
 List of used Tiles.
vec3f curveStart
 Position of the begining of a Curve being created.
int displayLevel
 The tile level to start display.
GraphPtr selectedGraph
 Graph containing the selected Curve.
list< AreaId > selectedArea
 Iterative list of areas to which the selected graph belongs.
CurvePtr selectedCurve
 Selected Curve.
int selectedSegment
 Selected segment's index in the selected curve.
int selectedPoint
 Selected node's index in the selected curve.
ptr< Uniform3f > tileOffsetU
 Uniform used to convert the coordinates of each points into texture coordinates inside the shader.
ptr< Program > layerProgram
 The GLSL Program to be used to draw the graphs in this Layer.
bool softEdition
 True to only call the update() method once the user release the mouse when editing.
double softEditionDelay
 Minimum amount of time between two updates if softEdition is false.

Detailed Description

An OrthoGPUProducer layer to edit Graph objects.

It handles :

Authors:
Antoine Begault, Eric Bruneton, Guillaume Piolat

Constructor & Destructor Documentation

proland::EditGraphOrthoLayer::EditGraphOrthoLayer ( const vector< ptr< GraphProducer > > &  graphs,
ptr< Program >  layerProg,
int  displayLevel = 0,
float  tolerance = 8.0f/192.0f,
bool  softEdition = true,
double  softEditionDelay = 100000.0,
bool  deform = false,
string  terrain = "",
ptr< ResourceManager >  manager = NULL 
)

Creates a new EditGraphOrthoLayer.

Parameters:
graphs a vector of GraphProducers that will be handled by this layer.
layerProgram the GLSL Program to be used to draw the graphs in this Layer.
displayLevel the tile level to start display. Tiles whole level is less than displayLevel are not drawn by this Layer, and graphProducer is not asked to produce the corresponding graph tiles.
tolerance tolerance parameter for screen selection of points.
softEdition true to only call the update() method once the user release the mouse when editing. Usefull for avoiding costly updates when editing.
softEditionDelay minimum amount of time between two updates if softEdition is false.
bool deform whether we apply a spherical deformation on the layer or not.
terrain name of the terrain on which this EditGraphOrthoLayer is located. only required if the terrainNode has been deformed or moved.
manager the ResourceManager used to create the scene.
virtual proland::EditGraphOrthoLayer::~EditGraphOrthoLayer (  )  [virtual]

Deletes this EditGraphOrthoLayer.

proland::EditGraphOrthoLayer::EditGraphOrthoLayer (  )  [protected]

Creates a new EditGraphOrthoLayer.


Member Function Documentation

bool proland::EditGraphOrthoLayer::add ( double  x,
double  y,
float  tolerance 
)

Interface function for adding elements to the graph.

Adds elements to the graph depending on selectedCurve, selectedPoint and selectedSegment values :

  • If selectedCurve == NULL : adds a new curve with 2 new points.
  • else if selectedPoint == NULL && selectedSegment != NULL : adds a new Vertex into the curve.
  • else if selectedPoint != NULL && selectedSegment == NULL : adds a new curve with the existing node and a node at pos (XY). If no Node was there, a new one will be created.
Parameters:
x X coord of the mouse.
y Y coord of the mouse.
tolerance tolerance for node search.
Returns:
true if changes occured.
virtual bool proland::EditGraphOrthoLayer::addCurve ( double  x1,
double  y1,
double  x2,
double  y2,
float  tolerance,
GraphPtr  g,
CurvePtr &  curve,
int &  segment,
int &  point,
Graph::Changes &  changes 
) [virtual]

Adds a Curve between two new nodes.

Also returns the new selection for interface functions.

Parameters:
x1 X coord of first node.
y1 Y coord of first node.
x2 X coord of second node.
y2 Y coord of second node.
g the graph to modify.
[out] curve will contain the selected curve, NULL if none.
[out] point will contain the selected point's rank in 'curve', -1 if none.
[out] changes will contain the list of changes that occured in g.
Returns:
true if changes occured.

Reimplemented in proland::EditHydroGraphOrthoLayer.

virtual bool proland::EditGraphOrthoLayer::addCurve ( double  x,
double  y,
float  tolerance,
GraphPtr  g,
CurvePtr &  curve,
int &  point,
Graph::Changes &  changes 
) [virtual]

Adds a curve from selected point to given coords.

If given coords doesn't corresponds to a given node, it creates it. Also returns the new selection for interface functions.

Parameters:
x X coord of second node.
y Y coord of second node.
tolerance tolerance parameter for node searching.
g the graph to modify.
[out] curve will contain the selected curve, NULL if none.
[out] point will contain the selected point's rank in 'curve', -1 if none.
[out] changes will contain the list of changes that occured in g.
Returns:
true if changes occured.

Reimplemented in proland::EditHydroGraphOrthoLayer.

bool proland::EditGraphOrthoLayer::addNode ( GraphPtr  g,
CurvePtr &  curve,
int &  point,
Graph::Changes &  changes 
)

Splits the selected curve in two new curves by transforming the selected point into a node.

Also returns the new selection for interface functions.

Parameters:
g the graph to modify.
[out] curve will contain the selected curve, NULL if none.
[out] point will contain the selected point's rank in 'curve', -1 if none.
[out] changes will contain the list of changes that occured in g.
Returns:
true if changes occured.
bool proland::EditGraphOrthoLayer::addNode (  ) 

Splits the selected curve in two new curves by transforming the selected point into a node.

Calls addNode with current selection parameters.

bool proland::EditGraphOrthoLayer::addVertex ( double  x,
double  y,
GraphPtr  g,
CurvePtr &  curve,
int &  segment,
int &  point,
Graph::Changes &  changes 
)

Adds a Vertex inside the selected Curve.

Also returns the new selection for interface functions.

Parameters:
x X coord of the new point.
y Y coord of the new point.
g the graph to modify.
[out] curve will contain the selected curve, NULL if none.
[out] segment will contain the selected segment's rank in 'curve', -1 if none.
[out] point will contain the selected point's rank in 'curve', -1 if none.
[out] changes will contain the list of changes that occured in g.
Returns:
true if changes occured.
virtual void proland::EditGraphOrthoLayer::beginCreateTile (  )  [virtual]

Sets the execution context for the Task that produce the tile data.

This is only needed for GPU tasks (see Task::begin). The default implementation of this method does nothing.

bool proland::EditGraphOrthoLayer::change (  ) 

Interface function for changing a selected node.

If selectedPoint is a node, the method turns it into a ControlPoint, and vice-versa.

Returns:
true if changes occured.
virtual bool proland::EditGraphOrthoLayer::doCreateTile ( int  level,
int  tx,
int  ty,
TileStorage::Slot *  data 
) [virtual]

Draws the edited graph onto the ortho tile.

Parameters:
level the tile's quadtree level.
tx the tile's quadtree x coordinate.
ty the tile's quadtree y coordinate.
data the tile to modify.
virtual void proland::EditGraphOrthoLayer::drawGraph ( const vec3d &  tileCoords,
GraphPtr  g,
float  pointSize,
ptr< Mesh< vec3f, unsigned int > >  mesh,
vec2d &  nx,
vec2d &  ny,
vec2d &  lx,
vec2d &  ly 
) [virtual]

Iterative method which draws a given Graph on a given Mesh.

Parameters:
g the Graph to be drawn.
pointSize drawing size of each point.
mesh the mesh to draw into.
virtual void proland::EditGraphOrthoLayer::endCreateTile (  )  [virtual]

Restores the execution context.

bool proland::EditGraphOrthoLayer::findCurve ( GraphPtr  p,
double  x,
double  y,
float  tolerance,
GraphPtr &  graph,
list< AreaId > &  areas,
CurvePtr &  curve,
int &  segment,
int &  point 
)

Iterative method for finding a Curve at given coordinates.

Parameters:
p the Graph to search into.
x x coordinate of the point to search.
y y coordinate of the point to search.
[out] graph owner graph of the selected Curve, if any.
[out] areas see selectedArea.
[out] curve will contain the selected curve, NULL if none.
[out] segment will contain the selected segment's rank in 'curve', -1 if none.
[out] point will contain the selected point's rank in 'curve', -1 if none.
Returns:
true if something was selected.
virtual bool proland::EditGraphOrthoLayer::fitCurve (  )  [virtual]

Creates a bezier Curve that fits the points stored in displayedPoints.

int proland::EditGraphOrthoLayer::getDefaultCurveType (  )  const [inline]

Returns defaultCurveType.

float proland::EditGraphOrthoLayer::getDefaultCurveWidth (  )  const [inline]
int proland::EditGraphOrthoLayer::getEditedGraph (  ) 

Gets the index of the currently edited graph.

ptr<GraphProducer> proland::EditGraphOrthoLayer::getEditedGraphPtr (  )  const [inline]

Returns editGraph.

int proland::EditGraphOrthoLayer::getGraphCount (  ) 

Returns the number of graphs handled by this layer.

vector< ptr<GraphProducer> > proland::EditGraphOrthoLayer::getGraphs (  ) 

Returns the Graph edited in this editor.

CurvePtr proland::EditGraphOrthoLayer::getSelectedCurve (  )  const [inline]

Returns selectedCurve.

int proland::EditGraphOrthoLayer::getSelectedPoint (  )  const [inline]

Returns selectedPoint.

int proland::EditGraphOrthoLayer::getSelectedSegment (  )  const [inline]

Returns selectedSegment.

void proland::EditGraphOrthoLayer::getSelection ( CurvePtr &  curve,
int &  point,
int &  segment 
)

Returns the current selection.

Parameters:
[out] curve will contain the current selected curve.
[out] point will contain the current selected point.
[out] segment will contain the current selected segment.
vec3d proland::EditGraphOrthoLayer::getTileCoords ( int  level,
int  tx,
int  ty 
) [protected]

Returns the ox,oy,l coordinates of the given tile.

float proland::EditGraphOrthoLayer::getTolerance (  )  const [inline]

Returns tolerance selection parameter.

virtual void proland::EditGraphOrthoLayer::getTypeNames ( vector< string > &  names  )  [virtual]

Returns customized type names for each curve type.

Parameters:
[out] will contain the names for each type.
virtual void proland::EditGraphOrthoLayer::init ( const vector< ptr< GraphProducer > > &  graphs,
ptr< Program >  layerProg,
int  displayLevel = 0,
float  tolerance = 8.0f/192.0f,
bool  softEdition = true,
double  softEditionDelay = 100000.0,
bool  deform = false,
string  terrain = "",
ptr< ResourceManager >  manager = NULL 
) [protected, virtual]

Initializes EditGraphOrthoLayer fields.

Parameters:
graphs a vector of GraphProducers that will be handled by this layer.
layerProgram the GLSL Program to be used to draw the graphs in this Layer.
displayLevel the tile level to start display. Tiles whole level is less than displayLevel are not drawn by this Layer, and graphProducer is not asked to produce the corresponding graph tiles.
tolerance tolerance parameter for screen selection of points.
softEdition true to only call the update() method once the user release the mouse when editing. Usefull for avoiding costly updates when editing.
softEditionDelay minimum amount of time between two updates if softEdition is false.
deform whether we apply a spherical deformation on the layer or not.
terrain name of the terrain on which this EditGraphOrthoLayer is located. only required if the terrainNode has been deformed or moved.
manager the ResourceManager used to create the scene.

Reimplemented in proland::EditHydroGraphOrthoLayer.

bool proland::EditGraphOrthoLayer::invert (  ) 

Interface function for inverting the selected curve.

Inverts every vertices from the selected Curve.

Returns:
true if changes occured.
bool proland::EditGraphOrthoLayer::movePoint ( double  x,
double  y,
int  i = -1 
)

Moves the selected point to the given coords.

Parameters:
x x coord.
y y coord.
i rank of the point to move in the curve. if i = -1, selectedPoint will be used.
Returns:
true if changes occured.
bool proland::EditGraphOrthoLayer::remove (  ) 

Interface function for removing an element.

Removes elements to the graph depending on selectedCurve, selectedPoint and selectedSegment values. If a curve if selected but with no specific node, we remove the whole curve. Otherwise only the Node/Vertex is removed.

Returns:
true if changes occured.
bool proland::EditGraphOrthoLayer::removeCurve ( GraphPtr  g,
CurvePtr &  curve,
Graph::Changes &  changes 
)

Removes the selected Curve, if any.

Also returns the new selection for interface functions.

Parameters:
g the graph to modify.
[out] curve will contain the selected curve, NULL if none.
[out] changes will contain the list of changes that occured in g.
Returns:
true if changes occured.
bool proland::EditGraphOrthoLayer::removeNode ( GraphPtr  g,
CurvePtr &  curve,
int &  segment,
int &  point,
Graph::Changes &  changes 
)

Removes the selected node.

The effect depends on the number of curves linked to this node :

  • if 2 curves = Merges the curves.
  • else removes all curves and the selected node. Also returns the new selection for interface functions.
Parameters:
g the graph to modify.
[out] curve will contain the selected curve, NULL if none.
[out] segment will contain the selected segment's rank in 'curve', -1 if none.
[out] point will contain the selected point's rank in 'curve', -1 if none.
[out] changes will contain the list of changes that occured in g.
Returns:
true if changes occured.
bool proland::EditGraphOrthoLayer::select ( double  x,
double  y,
float  tolerance,
GraphPtr &  graph,
list< AreaId > &  areas,
CurvePtr &  curve,
int &  segment,
int &  point 
)

Initiates the node / segment search through the graphs.

Parameters:
x x coord.
y y coord.
tolerance tolerance parameter for node / segment search.
[out] graph owner graph of the selected Curve, if any.
[out] areas see selectedArea.
[out] curve will contain the selected curve, NULL if none.
[out] segment will contain the selected segment's rank in 'curve', -1 if none.
[out] point will contain the selected point's rank in 'curve', -1 if none.
Returns:
true if something was selected.
bool proland::EditGraphOrthoLayer::select ( double  x,
double  y,
float  tolerance 
)

Interface function for selecting a curve node/segment.

Calls select(float, float, float, CurvePtr&, int&, int&).

Parameters:
x x coord.
y y coord.
tolerance tolerance parameter for node / segment search.
Returns:
true if something was selected.
bool proland::EditGraphOrthoLayer::select ( TileCache::Tile *  t,
double  x,
double  y,
float  tolerance,
GraphPtr &  graph,
list< AreaId > &  areas,
CurvePtr &  curve,
int &  segment,
int &  point 
)

Selects a node / segment in the graph corresponding to given coords.

This function finds node XOR segment (if selected point != NULL, selected segment == NULL for example).

Parameters:
t the tile to search into.
x x coord.
y y coord.
tolerance tolerance parameter for node / segment search.
curve will contain the selected curve, NULL if none.
segment will contain the selected segment's rank in 'curve', -1 if none.
point will contain the selected point's rank in 'curve', -1 if none.
Returns:
true if something was selected.
bool proland::EditGraphOrthoLayer::selection (  ) 

Returns true if a point or segment is currently selected.

void proland::EditGraphOrthoLayer::setDefaultCurveType ( int  t  )  [inline]
void proland::EditGraphOrthoLayer::setDefaultCurveWidth ( float  t  )  [inline]
void proland::EditGraphOrthoLayer::setEditedGraph ( int  index  ) 

Sets the index of the currently edited graph.

void proland::EditGraphOrthoLayer::setSelection ( CurvePtr  curve,
int  point,
int  segment 
)

Changed the current selection.

Parameters:
[out] curve the newly selected curve.
[out] point the newly selected point.
[out] segment the newly selected segment.
virtual void proland::EditGraphOrthoLayer::setTileSize ( int  tileSize,
int  tileBorder,
float  rootQuadSize 
) [virtual]

Sets tileSize, tileBorder, and rootQuadSize values.

Parameters:
tileSize current tile size.
tileBorder size of the tiles' border.
rootQuadSize size of the root tile.
bool proland::EditGraphOrthoLayer::smoothArea ( GraphPtr  g,
CurvePtr &  curve,
int &  point,
int &  segment,
Graph::Changes &  changes,
bool  smooth 
)

Adds ControlPoint everywhere it is necessary to make the curves of an area entirely smooth.

Also returns the new selection for interface functions.

Parameters:
g the graph to modify.
[out] curve will contain the selected curve, NULL if none.
[out] point will contain the selected point's rank in 'curve', -1 if none.
[out] changes will contain the list of changes that occured in g.
smooth whether we want to smooth or to unsmooth the curve.
Returns:
true if changes occured.
bool proland::EditGraphOrthoLayer::smoothArea ( bool  smooth  ) 

Interface function for smoothing the Vertices of all the Curves from the currently selected Curve's area.

Calls smoothArea(GraphPtr, CurvePtr &, int&, int&, Graph::Changes &, bool);

bool proland::EditGraphOrthoLayer::smoothCurve ( GraphPtr  g,
CurvePtr &  curve,
int &  point,
int &  segment,
Graph::Changes &  changes,
bool  smooth 
)

Adds ControlPoint everywhere it is necessary to make the curve entirely smooth.

Also returns the new selection for interface functions.

Parameters:
g the graph to modify.
[out] curve will contain the selected curve, NULL if none.
[out] point will contain the selected point's rank in 'curve', -1 if none.
[out] changes will contain the list of changes that occured in g.
smooth whether we want to smooth or to unsmooth the curve.
Returns:
true if changes occured.
bool proland::EditGraphOrthoLayer::smoothCurve ( bool  smooth  ) 

Interface function for smoothing the Vertices of the selected Curve.

Calls smoothCurve(GraphPtr, CurvePtr &, int&, int&, Graph::Changes &, bool);

bool proland::EditGraphOrthoLayer::smoothNode ( GraphPtr  g,
CurvePtr &  curve,
int &  point,
Graph::Changes &  changes,
bool  smooth 
)

Adds ControlPoint around the given Node on the Curves where it is necessary to make the Node entirely smooth.

Also returns the new selection for interface functions.

Parameters:
g the graph to modify.
[out] curve will contain the selected curve, NULL if none.
[out] point will contain the selected point's rank in 'curve', -1 if none.
[out] changes will contain the list of changes that occured in g.
smooth whether we want to smooth or to unsmooth the curve.
Returns:
true if changes occured.
bool proland::EditGraphOrthoLayer::smoothNode ( bool  smooth  ) 

Interface function for smoothing the selected Node from the selected Curve.

Calls smoothNode(GraphPtr, CurvePtr &, int&, int&, Graph::Changes &, bool);

virtual void proland::EditGraphOrthoLayer::startCreateTile ( int  level,
int  tx,
int  ty,
unsigned int  deadline,
ptr< Task >  task,
ptr< TaskGraph >  result 
) [virtual]

Calls the startCreateTile() method for the currently selected GraphProducer.

Parameters:
level the tile's quadtree level.
tx the tile's quadtree x coordinate.
ty the tile's quadtree y coordinate.
deadline the deadline at which the tile data must be ready. 0 means the current frame.
task the task to produce the tile itself.
result the taskgraph that contains the dependencies and tasks to execute. This method adds the graph-clipping task in this taskgraph.
virtual void proland::EditGraphOrthoLayer::stopCreateTile ( int  level,
int  tx,
int  ty 
) [virtual]

Stops the creation of a tile of this producer.

This method is used for producers that need tiles produced by other producers to create a tile. In these cases this method must release these other tiles with putTile so that these tiles can be evicted from the cache after use.

Parameters:
level the tile's quadtree level.
tx the tile's quadtree x coordinate.
ty the tile's quadtree y coordinate.
bool proland::EditGraphOrthoLayer::transformVertex ( GraphPtr  g,
CurvePtr &  curve,
int &  point,
Graph::Changes &  changes 
)

Changes the selected point into a node.

Also returns the new selection for interface functions.

Parameters:
g the graph to modify.
[out] curve will contain the selected curve, NULL if none.
[out] point will contain the selected point's rank in 'curve', -1 if none.
[out] changes will contain the list of changes that occured in g.
Returns:
true if changes occured.
bool proland::EditGraphOrthoLayer::transformVertex (  ) 

Interface function for changing the state of a Vertex.

Calls transformVertex(GraphPtr, CurvePtr &, int&, Graph::Changes &);

virtual void proland::EditGraphOrthoLayer::unuseTile ( int  level,
int  tx,
int  ty 
) [virtual]

Notifies this Layer that the given tile of its TileProducer is unused.

This happens when the number of users of this tile becomes null, after a call to TileProducer::putTile (see also TileCache::putTile).

Parameters:
level the tile's quadtree level.
tx the tile's quadtree x coordinate.
ty the tile's quadtree y coordinate.
virtual void proland::EditGraphOrthoLayer::update (  )  [virtual]

Invalidates required tiles.

Called each time a change occured (if any of the above functions returned true).

bool proland::EditGraphOrthoLayer::updateSelectedCurve (  ) 

Updates the root Graph::changes field according to the current selection.

virtual void proland::EditGraphOrthoLayer::useTile ( int  level,
int  tx,
int  ty,
unsigned int  deadline 
) [virtual]

Notifies this Layer that the given tile of its TileProducer is in use.

This happens when this tile was not previously used, and has been requested with TileProducer::getTile (see also TileCache::getTile).

Parameters:
level the tile's quadtree level.
tx the tile's quadtree x coordinate.
ty the tile's quadtree y coordinate.
deadline the deadline at which the tile data must be ready. 0 means the current frame.

Member Data Documentation

Position of the begining of a Curve being created.

curveStart.xy contains the coordinates. curveStart.z indicates whether we are creating a new Curve or not.

Default Curve Type when creating a new Curve.

Default Curve Width when creating a new Curve.

List of points displayed on the Tile when drawing.

They indicates current edition.

The tile level to start display.

Tiles whole level is less than displayLevel are not drawn by this Layer, and graphProducer is not asked to produce the corresponding graph tiles.

Index of currently edited graph in graphs, or -1 if not graph currently edited.

ptr<GraphProducer> proland::EditGraphOrthoLayer::editGraph [protected]

The GraphProducer of the currently edited graph.

This GraphProducer is not directly one of the graphs elements, because it may need different options (such as no doFlatten).

vector< ptr<GraphProducer> > proland::EditGraphOrthoLayer::graphs [protected]

A vector of GraphProducers handled by this layer.

The TweakGraphLayerList which contains each TweakGraphLayer handlers.

The GLSL Program to be used to draw the graphs in this Layer.

static_ptr<Mesh<vec3f, unsigned int> > proland::EditGraphOrthoLayer::mesh [static]

The mesh used for drawing curves.

Iterative list of areas to which the selected graph belongs.

If selectedGraph == editGraph->getRoot(), selectedArea will be empty. Otherwise, it will contain the ordered areas to explore until we can find selectedGraph. (i.e. root->getArea(selectedArea[0])->getSubgraph()->getArea(selectedArea[1])->getSubgraph()...)

Selected Curve.

Modified in select() and used in interface functions. If NULL, no curve was selected

Graph containing the selected Curve.

Modified in select and used in interface functions. This is required for subgraph edition, and always used with selectedArea if selectedGraph is different from root graph.

Selected node's index in the selected curve.

Modified in Xselect() and used in interface functions.

Selected segment's index in the selected curve.

Modified in Xselect() and used in interface functions.

True to only call the update() method once the user release the mouse when editing.

Usefull for avoiding costly updates when editing.

Minimum amount of time between two updates if softEdition is false.

ptr<Uniform3f> proland::EditGraphOrthoLayer::tileOffsetU [protected]

Uniform used to convert the coordinates of each points into texture coordinates inside the shader.

Tolerance parameter for screen selection of points.

set<TileCache::Tile::Id> proland::EditGraphOrthoLayer::usedTiles [protected]

List of used Tiles.

Used to know on which tiles the useTile() method was called, so they can be released when not used anymore.


Generated on Sat May 12 09:43:14 2012 for proland by  doxygen 1.6.1