proland::GraphLayer Class Reference
[producer]

An abstract Layer sub class for layers using graphs. More...

#include <GraphLayer.h>

Inheritance diagram for proland::GraphLayer:
proland::ElevationGraphLayer proland::FieldsOrthoLayer proland::ForestOrthoLayer proland::LineOrthoLayer proland::MaskOrthoLayer proland::RoadOrthoLayer proland::WaterOrthoLayer proland::RoadElevationLayer proland::WaterElevationLayer

List of all members.

Public Member Functions

 GraphLayer (const char *name)
 Creates a new GraphLayer.
 GraphLayer (const char *name, ptr< GraphProducer > graphProducer, ptr< Program > layerProgram, int displayLevel=0, bool quality=true, bool storeGraphTiles=false, bool deform=false)
 Creates a new GraphLayer.
virtual ~GraphLayer ()
 Deletes this GraphLayer.
void drawCurve (const vec3d &tileCoords, CurvePtr p, CurveData *data, float l0, float l1, float width, float scale, ptr< FrameBuffer > fb, ptr< Program > prog, Mesh< vec4f, unsigned int > &mesh, vec2d *nx=NULL, vec2d *ny=NULL, vec2d *lx=NULL, vec2d *ly=NULL)
 Draws a curve in the given FrameBuffer.
void drawCurve (const vec3d &tileCoords, CurvePtr p, CurveData *data, float width, float cap, float scale, ptr< FrameBuffer > fb, ptr< Program > prog, Mesh< vec4f, unsigned int > &mesh, vec2d *nx=NULL, vec2d *ny=NULL, vec2d *lx=NULL, vec2d *ly=NULL)
 Draws a curve in the given FrameBuffer.
void drawCurve (const vec3d &tileCoords, CurvePtr p, float width, float scale, ptr< FrameBuffer > fb, ptr< Program > prog, Mesh< vec2f, unsigned int > &mesh, vec2d *nx=NULL, vec2d *ny=NULL, vec2d *lx=NULL, vec2d *ly=NULL)
 Draws a curve in the given FrameBuffer.
void drawCurve (const vec3d &tileCoords, CurvePtr p, const vec4f &part, ptr< FrameBuffer > fb, ptr< Program > prog, Mesh< vec4f, unsigned int > &mesh, vec2d *nx=NULL, vec2d *ny=NULL, vec2d *dx=NULL, vec2d *ly=NULL)
 Draws a curve in the given FrameBuffer.
bool extremity (CurvePtr curve, NodePtr p)
 Checks whether a Node is the extremity of a Curve.
void drawArea (const vec3d &tileCoords, AreaPtr a, Tesselator &tess)
 Draws an area.
void addUsedTiles (int level, int tx, int ty, TileProducer *producer, set< TileCache::Tile * > tiles)
 Adds a list of tiles used by each tile of this layer.

Protected Member Functions

void init (ptr< GraphProducer > graphProducer, ptr< Program > layerProgram, int displayLevel=0, bool quality=true, bool storeGraphTiles=false, bool deform=false)
 Initializes the fields of a GraphLayer.

Protected Attributes

ptr< GraphProducergraphProducer
 The GraphProducer that produces the Graph tiles that this Layer must draw.
ptr< Program > layerProgram
 The GLSL Program to be used to draw the graphs in this Layer.
int displayLevel
 The tile level to start display.
bool quality
 Determines the drawing method for layers.

Private Attributes

bool storeGraphTiles
 Forces the graph tiles produced by graphProducer to stay in cache as long as the tiles produced by this producer (i.e.
map< TileCache::Tile::Id, pair
< TileProducer *, set
< TileCache::Tile * > > > 
usedTiles
 The tiles currently in use.

Detailed Description

An abstract Layer sub class for layers using graphs.

Contains drawing methods to draw curves and areas using a user defined GLSL Program.

Author:
Antoine Begault, Guillaume Piolat

Constructor & Destructor Documentation

proland::GraphLayer::GraphLayer ( const char *  name  ) 

Creates a new GraphLayer.

Parameters:
name the name of the implementing class.
proland::GraphLayer::GraphLayer ( const char *  name,
ptr< GraphProducer graphProducer,
ptr< Program >  layerProgram,
int  displayLevel = 0,
bool  quality = true,
bool  storeGraphTiles = false,
bool  deform = false 
)

Creates a new GraphLayer.

Parameters:
name the name of the implementing class.
graphProducer the GraphProducer that produces the Graph tiles that this Layer must draw.
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.
quality enable or not the quality mode (better display).
storeGraphTiles forces the graph tiles produced by graphProducer to stay in cache as long as the tiles produced by this producer (i.e. the TileProducer to which this Layer belongs) are in use. When used with the storeParents option in graphProducer, this option ensures that the graph tiles corresponding to the tiles of this producer that are in use, and all their ancestors, are in cache. Boths options are required when an EditGraphOrthoLayer is used (to locate Node from x,y coordinates efficiently, and to take advantage of the incremental clipUpdate methods). Otherwise they are not mandatory.
deform whether we apply a spherical deformation on the layer or not.
virtual proland::GraphLayer::~GraphLayer (  )  [virtual]

Deletes this GraphLayer.


Member Function Documentation

void proland::GraphLayer::addUsedTiles ( int  level,
int  tx,
int  ty,
TileProducer *  producer,
set< TileCache::Tile * >  tiles 
)

Adds a list of tiles used by each tile of this layer.

They will require a call to TileProducer::put() when the task has been done.

Parameters:
level the level of the tile.
tx x coordinate of the tile.
ty y coordinate of the tile.
producer the Producer from which the Tiles were produced.
tiles the used tiles that will need to be released.
void proland::GraphLayer::drawArea ( const vec3d &  tileCoords,
AreaPtr  a,
Tesselator tess 
)

Draws an area.

Parameters:
a the Area to be drawn.
tess the tesselator associated to the drawing mesh.
void proland::GraphLayer::drawCurve ( const vec3d &  tileCoords,
CurvePtr  p,
const vec4f &  part,
ptr< FrameBuffer >  fb,
ptr< Program >  prog,
Mesh< vec4f, unsigned int > &  mesh,
vec2d *  nx = NULL,
vec2d *  ny = NULL,
vec2d *  dx = NULL,
vec2d *  ly = NULL 
)

Draws a curve in the given FrameBuffer.

Parameters:
p the curve to be drawn.
part coords to add to each of p's vertices.
fb a FrameBuffer.
prog a Program.
mesh a vec4 Mesh (containing vertex positions and UV attributes).
void proland::GraphLayer::drawCurve ( const vec3d &  tileCoords,
CurvePtr  p,
float  width,
float  scale,
ptr< FrameBuffer >  fb,
ptr< Program >  prog,
Mesh< vec2f, unsigned int > &  mesh,
vec2d *  nx = NULL,
vec2d *  ny = NULL,
vec2d *  lx = NULL,
vec2d *  ly = NULL 
)

Draws a curve in the given FrameBuffer.

Basic drawing, no stripes.

Parameters:
p the curve to be drawn.
width the curve's width (can be different from the initial curve's width).
scale the scale, depending of the display level.
fb a FrameBuffer.
prog a Program.
mesh a vec2 Mesh (containing vertex positions).
void proland::GraphLayer::drawCurve ( const vec3d &  tileCoords,
CurvePtr  p,
CurveData data,
float  width,
float  cap,
float  scale,
ptr< FrameBuffer >  fb,
ptr< Program >  prog,
Mesh< vec4f, unsigned int > &  mesh,
vec2d *  nx = NULL,
vec2d *  ny = NULL,
vec2d *  lx = NULL,
vec2d *  ly = NULL 
)

Draws a curve in the given FrameBuffer.

Adds UV coordinates to the mesh, in order to compute stripes inside the shader. Also adds a cap information, which is used to ... ?

Parameters:
p the curve to be drawn.
data the CurveData containing data about Curve p.
width the curve's width (can be different from the initial curve's width).
cap the width cap.
scale the scale, depending of the display level.
fb a FrameBuffer.
prog a Program.
mesh a vec4 Mesh (containing vertex positions and UV attributes).
void proland::GraphLayer::drawCurve ( const vec3d &  tileCoords,
CurvePtr  p,
CurveData data,
float  l0,
float  l1,
float  width,
float  scale,
ptr< FrameBuffer >  fb,
ptr< Program >  prog,
Mesh< vec4f, unsigned int > &  mesh,
vec2d *  nx = NULL,
vec2d *  ny = NULL,
vec2d *  lx = NULL,
vec2d *  ly = NULL 
)

Draws a curve in the given FrameBuffer.

Adds UV coordinates to the mesh, in order to compute stripes inside the shader. Allows to draw stripes only on a certain part of the curve.

Parameters:
p the curve to be drawn.
data the CurveData containing data about Curve p.
l0 the length without stripes at the begining of the curve.
l1 the length without stripes at the end of the curve.
width the curve's width (can be different from the initial curve's width).
scale the scale, depending of the display level.
fb a FrameBuffer.
prog a Program.
mesh a vec4 Mesh (containing vertex positions and UV attributes).
bool proland::GraphLayer::extremity ( CurvePtr  curve,
NodePtr  p 
)

Checks whether a Node is the extremity of a Curve.

Parameters:
curve the Curve to check.
p the node to check.
Returns:
true if curve is the only curve of p, or if all other curves sharing p are not roads (type == 0).
void proland::GraphLayer::init ( ptr< GraphProducer graphProducer,
ptr< Program >  layerProgram,
int  displayLevel = 0,
bool  quality = true,
bool  storeGraphTiles = false,
bool  deform = false 
) [protected]

Initializes the fields of a GraphLayer.

See GraphLayer.


Member Data Documentation

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.

The GraphProducer that produces the Graph tiles that this Layer must draw.

ptr<Program> proland::GraphLayer::layerProgram [protected]

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

bool proland::GraphLayer::quality [protected]

Determines the drawing method for layers.

If true, the display will be better, if implemented.

Forces the graph tiles produced by graphProducer to stay in cache as long as the tiles produced by this producer (i.e.

the TileProducer to which this Layer belongs) are in use. When used with the storeParents option in graphProducer, this option ensures that the graph tiles corresponding to the tiles of this producer that are in use, and all their ancestors, are in cache. Boths options are required when an EditGraphOrthoLayer is used (to locate Node from x,y coordinates efficiently, and to take advantage of the incremental clipUpdate methods). Otherwise they are not mandatory.

map<TileCache::Tile::Id, pair<TileProducer *, set<TileCache::Tile*> > > proland::GraphLayer::usedTiles [private]

The tiles currently in use.

These tiles cannot be evicted from the cache and from the TileStorage, until they become unused. Maps tile identifiers to used tiles and to the TileProducer that produces those tiles.


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