proland::TileLayer Class Reference
[producer]

An abstract layer for a TileProducer. More...

#include <TileLayer.h>

List of all members.

Public Member Functions

 TileLayer (const char *type, bool deform=false)
 Creates a new TileLayer.
virtual ~TileLayer ()
 Deletes this TileLayer.
ptr< TileCachegetCache ()
 Returns the TileCache that stores the tiles produced by the producer using this TileLayer.
int getProducerId ()
 Returns the id of the producer using this TileLayer.
int getTileSize ()
 Returns the tile size, i.e.
int getTileBorder ()
 Returns the size in pixels of the border of each tile.
float getRootQuadSize ()
 Returns the size in meters of the root quad produced by the producer using this Layer.
vec3d getTileCoords (int level, int tx, int ty)
 Returns the ox,oy,l coordinates of the given tile.
bool isDeformed ()
 Returns true if a spherical deformation is applied on the layer or not.
bool isEnabled ()
 Returns true if this TileLayer is enabled.
void setIsEnabled (bool enabled)
 Enables or disables this TileLayer.
virtual void setCache (ptr< TileCache > cache, int producerId)
 Sets the TileCache that stores the tiles produced by this Layer.
virtual void getReferencedProducers (vector< ptr< TileProducer > > &producers) const
 Returns the tile producers used by this TileLayer.
virtual void setTileSize (int tileSize, int tileBorder, float rootQuadSize)
 Sets the tile size value.
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 prefetchTile (int level, int tx, int ty)
 Schedules a prefetch task to create the given tile.
virtual void startCreateTile (int level, int tx, int ty, unsigned int deadline, ptr< Task > task, ptr< TaskGraph > owner)
 Starts the creation of a tile.
virtual void beginCreateTile ()
 Sets the execution context for the Task that produces the tile data.
virtual bool doCreateTile (int level, int tx, int ty, TileStorage::Slot *data)=0
 Creates the given tile.
virtual void endCreateTile ()
 Restores the execution context for the Task that produces the tile data.
virtual void stopCreateTile (int level, int tx, int ty)
 Stops the creation of a tile.
virtual void invalidateTiles ()
 Invalidates the tiles modified by this layer.

Protected Member Functions

void init (bool deform=false)
 Initializes TileLayer fields.

Private Attributes

ptr< TileCachecache
 The TileCache of the TileProducer to which this TileLayer belongs.
int producerId
 The id of the TileProducer to which this TileLayer belongs in cache.
int tileSize
 Size in pixels of each tile of the producer to which this layer belongs.
int tileBorder
 Size in pixels of the border of each tile of the producer to which this layer belongs.
float rootQuadSize
 Size in meters of the root quad produced by the producer to which this layer belongs.
bool deform
 Whether we apply a spherical deformation on the layer or not.

Detailed Description

An abstract layer for a TileProducer.

Some tile producers can be customized with layers modifying the default tile production algorithm (for instance to add roads or rivers to an orthographic tile producer). For these kind of producers, each method of this class is called during the corresponding method in the TileProducer. The default implementation of these methods in this class is empty.

Authors:
Eric Bruneton, Antoine Begault

Constructor & Destructor Documentation

proland::TileLayer::TileLayer ( const char *  type,
bool  deform = false 
)

Creates a new TileLayer.

Parameters:
type the layer's type.
deform whether we apply a spherical deformation on the layer or not.
virtual proland::TileLayer::~TileLayer (  )  [virtual]

Deletes this TileLayer.


Member Function Documentation

virtual void proland::TileLayer::beginCreateTile (  )  [virtual]

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

See TileProducer::beginCreateTile.

virtual bool proland::TileLayer::doCreateTile ( int  level,
int  tx,
int  ty,
TileStorage::Slot data 
) [pure virtual]

Creates the given tile.

See TileProducer::doCreateTile.

virtual void proland::TileLayer::endCreateTile (  )  [virtual]

Restores the execution context for the Task that produces the tile data.

See TileProducer::endCreateTile.

ptr<TileCache> proland::TileLayer::getCache (  ) 

Returns the TileCache that stores the tiles produced by the producer using this TileLayer.

int proland::TileLayer::getProducerId (  ) 

Returns the id of the producer using this TileLayer.

This id is local to the TileCache used by this producer, and is used to distinguish all the producers that use this cache.

virtual void proland::TileLayer::getReferencedProducers ( vector< ptr< TileProducer > > &  producers  )  const [virtual]

Returns the tile producers used by this TileLayer.

Parameters:
[out] producers the tile producers used by this TileLayer.
float proland::TileLayer::getRootQuadSize (  ) 

Returns the size in meters of the root quad produced by the producer using this Layer.

int proland::TileLayer::getTileBorder (  ) 

Returns the size in pixels of the border of each tile.

Tiles made of raster data may have a border that contains the value of the neighboring pixels of the tile. For instance if the tile size (returned by TileStorage::getTileSize) is 196, and if the tile border is 2, this means that the actual tile data is 192x192 pixels, with a 2 pixel border that contains the value of the neighboring pixels. Using a border introduces data redundancy but is usefull to get the value of the neighboring pixels of a tile without needing to load the neighboring tiles.

vec3d proland::TileLayer::getTileCoords ( int  level,
int  tx,
int  ty 
)

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

int proland::TileLayer::getTileSize (  ) 

Returns the tile size, i.e.

the size in pixels of each tile of the producer to which this layer belongs. This size includes borders.

void proland::TileLayer::init ( bool  deform = false  )  [protected]

Initializes TileLayer fields.

Parameters:
deform whether we apply a spherical deformation on the layer or not.
virtual void proland::TileLayer::invalidateTiles (  )  [virtual]

Invalidates the tiles modified by this layer.

This means that the tasks to produce the actual data of these tiles will be automatically reexecuted before the data can be used.

bool proland::TileLayer::isDeformed (  ) 

Returns true if a spherical deformation is applied on the layer or not.

bool proland::TileLayer::isEnabled (  ) 

Returns true if this TileLayer is enabled.

virtual void proland::TileLayer::prefetchTile ( int  level,
int  tx,
int  ty 
) [virtual]

Schedules a prefetch task to create the given tile.

If the requested tile is currently in use or in cache but unused, this method does nothing. Otherwise it gets an unused tile storage (evicting an unused tile if necessary), and then creates and schedules a task to produce the data of the requested tile.

Parameters:
level the tile's quadtree level.
tx the tile's quadtree x coordinate.
ty the tile's quadtree y coordinate.
Returns:
true if this method has been able to schedule a prefetch task for the given tile.
virtual void proland::TileLayer::setCache ( ptr< TileCache cache,
int  producerId 
) [virtual]

Sets the TileCache that stores the tiles produced by this Layer.

void proland::TileLayer::setIsEnabled ( bool  enabled  ) 

Enables or disables this TileLayer.

Parameters:
enabled true to enable this TileLayer, false otherwise.
virtual void proland::TileLayer::setTileSize ( int  tileSize,
int  tileBorder,
float  rootQuadSize 
) [virtual]

Sets the tile size value.

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

Starts the creation of a tile.

See TileProducer::startCreateTile.

virtual void proland::TileLayer::stopCreateTile ( int  level,
int  tx,
int  ty 
) [virtual]

Stops the creation of a tile.

See TileProducer::stopCreateTile.

virtual void proland::TileLayer::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::TileLayer::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

The TileCache of the TileProducer to which this TileLayer belongs.

Whether we apply a spherical deformation on the layer or not.

The id of the TileProducer to which this TileLayer belongs in cache.

Size in meters of the root quad produced by the producer to which this layer belongs.

Size in pixels of the border of each tile of the producer to which this layer belongs.

See TileProducer::getTileBorder.

Size in pixels of each tile of the producer to which this layer belongs.

This size includes borders.


Generated on Sat May 12 09:41:38 2012 for proland by  doxygen 1.6.1