proland::GraphProducer Class Reference
[producer]

Produces the required graphs at a given tile and at a given level. More...

#include <GraphProducer.h>

Inheritance diagram for proland::GraphProducer:
proland::GraphListener

List of all members.

Classes

class  GraphCache
 Cache that manages the precomputed Graphs (including root Graph). More...
class  GraphFactory
 Creates Graph objects. More...
class  LazyGraphFactory
 A GraphFactory that creates LazyGraph. More...

Public Member Functions

 GraphProducer (string name, ptr< TileCache > cache, ptr< GraphCache > precomputedGraphs, set< int > precomputedLevels, bool doFlatten=false, float flatnessFactor=0.5f, bool storeParents=false, int maxNodes=0)
 Creates a new GraphProducer.
 GraphProducer (string name, ptr< TileCache > cache, ptr< GraphCache > precomputedGraphs, bool doFlatten=false, float flatnessFactor=0.5f, bool storeParents=false, int maxNodes=0)
 Creates a new GraphProducer.
virtual ~GraphProducer ()
 Deletes this GraphProducer.
GraphPtr getRoot ()
 Returns the level 0 Graph.
void setTileSize (int tileSize)
 Sets tileSize value.
virtual void addMargin (Margin *m)
 Adds a margin to this graphProducer.
virtual void removeMargin (Margin *m)
 Removes a given margin.
virtual void graphChanged ()
 Invalidates the root tile and thus forces to recompute changed tiles (and only changed tiles).
ptr< GraphCachegetPrecomputedGraphs ()
 Returns the precomputed graphs cache.
int getFirstPrecomputedLevel ()
 Returns the first precomputed level after level 0.
CurvePtr getFlattenCurve (CurvePtr c)
 Returns the flattened Curve corresponding to a given Curve.
void putFlattenCurve (CurveId id)
 Releases a given FlattenCurve.
string getName ()
 Returns the name of this Resource.

Protected Member Functions

 GraphProducer ()
 Creates a new GraphProducer.
void init (string name, ptr< TileCache > cache, ptr< GraphCache > precomputedGraphs, set< int > precomputedLevels, bool doFlatten=false, float flatnessFactor=0.5f, bool storeParents=false, int maxNodes=0)
 Initializes the fields of a GraphProducer.

Private Member Functions

void updateFlattenCurve (const set< CurveId > &changedCurves)
 Updates the cache of flatten curves and their associated CurveDatas.

Private Attributes

string name
 The name of this resource.
int tileSize
 Root Tile size.
set< int > precomputedLevels
 Levels at which we can directly load the graphs from the disk.
int maxNodes
 Maximum amount of nodes allowed in a Graph.
ComposedMarginmargins
 List of margins associated to this GraphProducer (added from each layer associated to this GraphProducer).
bool doFlatten
 If true, the producer will call flatten() on each produced subgraph after clipping.
float flatnessFactor
 Factor for flatten() method (square of the maximum allowed distance between a limit curve and its polyline approximation).
bool storeParents
 If true, will store parent tiles when creating a new one (call to useTile()) so it won't be deleted if temporarily not used.
ptr< GraphCacheprecomputedGraphs
 The cache that manages the precomputed Graphs (including root Graph).
map< CurveId, CurvePtr > flattenCurves
 lists of every used flattened Curves, mapped to their Id.
map< CurvePtr, int > flattenCurveCount
 Reference counts for each flattened Curve.

Detailed Description

Produces the required graphs at a given tile and at a given level.

Produced tiles will be used in layers (elevation, normals, ortho...) to display corresponding elements (edit, road, rivers...).

Author:
Antoine Begault, Guillaume Piolat

Constructor & Destructor Documentation

proland::GraphProducer::GraphProducer ( string  name,
ptr< TileCache >  cache,
ptr< GraphCache precomputedGraphs,
set< int >  precomputedLevels,
bool  doFlatten = false,
float  flatnessFactor = 0.5f,
bool  storeParents = false,
int  maxNodes = 0 
)

Creates a new GraphProducer.

Parameters:
name the name of this resource.
cache the tile cache that stores the tiles produced by this producer.
precomputedGraphs the precomputed graphs cache. Manages the precomputed Graphs (including root Graph).
precomputedLevels levels at which we can directly load the graphs from the disk. For each tile of those levels, the corresponding graph must be precomputed and stored in a directory with the name of the graph. If not existing, it will be computed from the root tile and stored in cache. level 1 -> l-1 will be computed from the root tile if required afterwards.
doFlatten if true, the producer will call Graph::flatten() on each produced subgraph after clipping. Default = false.
flatnessFactor factor for flatten() method (square of the maximum allowed distance between a limit curve and its polyline approximation). Default = 0.5f.
storeParents if true, we keep each tile in the memory cache instead of deleting them when temporarily not used. Default = false.
maxNodes maximum amount of nodes allowed in a Graph. If under that number, the graph is considered small enough to not have to be clipped, and will be used for all its children. If set to 0, the Graph will be clipped as usual.
proland::GraphProducer::GraphProducer ( string  name,
ptr< TileCache >  cache,
ptr< GraphCache precomputedGraphs,
bool  doFlatten = false,
float  flatnessFactor = 0.5f,
bool  storeParents = false,
int  maxNodes = 0 
)

Creates a new GraphProducer.

No precomputed levels.

Parameters:
name the name of this resource.
cache the tile cache that stores the tiles produced by this producer.
precomputedGraphs the precomputed graphs cache. Manages the precomputed Graphs (including root Graph).
doFlatten if true, the producer will call Graph::flatten() on each produced subgraph after clipping. Default = false.
flatnessFactor factor for flatten() method (square of the maximum allowed distance between a limit curve and its polyline approximation). Default = 0.5f.
storeParents if true, we keep each tile in the memory cache instead of deleting them when temporarily not used. Default = false.
maxNodes maximum amount of nodes allowed in a Graph. If under that number, the graph is considered small enough to not have to be clipped, and will be used for all its children. If set to 0, the Graph will be clipped as usual.
virtual proland::GraphProducer::~GraphProducer (  )  [virtual]

Deletes this GraphProducer.

proland::GraphProducer::GraphProducer (  )  [protected]

Creates a new GraphProducer.


Member Function Documentation

virtual void proland::GraphProducer::addMargin ( Margin m  )  [virtual]

Adds a margin to this graphProducer.

Each layer may have a different margin, and only the largest will be used for the Graph::clip() method.

int proland::GraphProducer::getFirstPrecomputedLevel (  )  [inline]

Returns the first precomputed level after level 0.

Returns level 0 if no other precomputed levels are specified. First Level at which we can directly load the graphs from the disk. For each tile of those levels, the corresponding graph must be precomputed and stored in a directory with the name of the graph. If not existing, it will be computed from the root tile and stored in cache. level 1 -> l-1 will be computed from the root tile if required afterwards.

CurvePtr proland::GraphProducer::getFlattenCurve ( CurvePtr  c  ) 

Returns the flattened Curve corresponding to a given Curve.

Handles a reference count of flattenCurves.

Parameters:
c the Curve for which we want a flattened version.
string proland::GraphProducer::getName (  ) 

Returns the name of this Resource.

ptr<GraphCache> proland::GraphProducer::getPrecomputedGraphs (  )  [inline]

Returns the precomputed graphs cache.

GraphPtr proland::GraphProducer::getRoot (  ) 

Returns the level 0 Graph.

virtual void proland::GraphProducer::graphChanged (  )  [virtual]

Invalidates the root tile and thus forces to recompute changed tiles (and only changed tiles).

Implements proland::GraphListener.

void proland::GraphProducer::init ( string  name,
ptr< TileCache >  cache,
ptr< GraphCache precomputedGraphs,
set< int >  precomputedLevels,
bool  doFlatten = false,
float  flatnessFactor = 0.5f,
bool  storeParents = false,
int  maxNodes = 0 
) [protected]

Initializes the fields of a GraphProducer.

See GraphProducer.

void proland::GraphProducer::putFlattenCurve ( CurveId  id  ) 

Releases a given FlattenCurve.

Parameters:
id the id of the corresponding Curve.
virtual void proland::GraphProducer::removeMargin ( Margin m  )  [virtual]

Removes a given margin.

Parameters:
m a margin.
void proland::GraphProducer::setTileSize ( int  tileSize  ) 

Sets tileSize value.

Parameters:
tileSize the new tileSize.
void proland::GraphProducer::updateFlattenCurve ( const set< CurveId > &  changedCurves  )  [private]

Updates the cache of flatten curves and their associated CurveDatas.

When a Curve is changed, it's data will need to be recomputed. To simply do that, it is just removed from the cache and will be rebuilt when required.

Parameters:
changes list of curves that changed during last update and for which the CurveData is outdated.

Member Data Documentation

If true, the producer will call flatten() on each produced subgraph after clipping.

Factor for flatten() method (square of the maximum allowed distance between a limit curve and its polyline approximation).

map<CurvePtr, int> proland::GraphProducer::flattenCurveCount [private]

Reference counts for each flattened Curve.

lists of every used flattened Curves, mapped to their Id.

List of margins associated to this GraphProducer (added from each layer associated to this GraphProducer).

Maximum amount of nodes allowed in a Graph.

If under that number, the graph is considered small enough to not have to be clipped, and will be used for all its children. If set to 0, the Graph will be clipped as usual.

string proland::GraphProducer::name [private]

The name of this resource.

The cache that manages the precomputed Graphs (including root Graph).

Levels at which we can directly load the graphs from the disk.

For each tile in those levels, the corresponding graph must be precomputed and stored in a directory with the name of the graph. If not existing, it will be computed from the root tile and stored in cache. level 1 -> l-1 will be computed from the root tile if required afterwards.

If true, will store parent tiles when creating a new one (call to useTile()) so it won't be deleted if temporarily not used.

Root Tile size.


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