dtTerrain::PagedTerrainTile Class Reference

This class is the base class for a tile of data. More...

#include <pagedterraintile.h>

List of all members.

Public Member Functions

void SetGeoCoordinates (const GeoCoordinates &cs)
 Sets the origin with which this tile maps to.
const GeoCoordinatesGetGeoCoordinates () const
 Gets this tile's coordinate system.
void SetHeightField (HeightField *hf)
 Sets the heightfield that maps to this terrain tile.
const HeightFieldGetHeightField () const
 Gets the heightfield currently assigned to this terrain tile.
void SetBaseTextureImage (osg::Image *image)
 Sets the base texture for this terrain tile.
osg::Image * GetBaseTextureImage ()
 Gets the image currently being used by this tile as its base texture.
virtual void WriteToCache ()
 This method provides the paged tile with an opportunity to cache any data that it wants to retrieve later.
virtual void ReadFromCache ()
 This method provides the paged tile with an opportunity to restore any data that was previously cached.
const std::string & GetCachePath () const
 Gets the cache path assigned to this tile.
bool IsCachingEnabled () const
 Gets the status of this tile's caching.
void SetUpdateCache (bool flag)
 Sets whether or not the cache needs to be updated to reflect the current state of the tile.
bool GetUpdateCache () const
 Gets whether or not this tile's cache is out of sync with its data.
const TerrainGetParentTerrain () const
 Gets the terrain that created this terrain tile and therefore owns it.
TerrainGetParentTerrain ()
 Gets the terrain that created this terrain tile and therefore owns it.

Protected Member Functions

 PagedTerrainTile (Terrain *terrain)
 Constructs a terrain tile.
virtual ~PagedTerrainTile ()
 Destroys the terrain tile.
void SetCachePath (const std::string &path)
 Sets the cache path for this tile.

Friends

class PagedTerrainTileFactory
 Allow the factory and terrain to have access to this class.
class Terrain


Detailed Description

This class is the base class for a tile of data.

Instances of this class are the atomic data elements the terrain manages when navigating through its data. Paging and disk caching (if enabled) is handled transparently when needed by the terrain and it provides, by default, access to its heightfield, base texture, and other fundamental data structures. Although this base class has many features, application dependent data and behavior can still be added to this base tile through subclasses.


Constructor & Destructor Documentation

dtTerrain::PagedTerrainTile::PagedTerrainTile ( Terrain terrain  )  [protected]

Constructs a terrain tile.

Note, the constrmUpdateCacheuctor is protected as to enforce the use of the terrain class in order to create a new tile.

dtTerrain::PagedTerrainTile::~PagedTerrainTile (  )  [protected, virtual]

Destroys the terrain tile.

Since most internal data is managed by smart pointers, this method does practically nothing.


Member Function Documentation

void dtTerrain::PagedTerrainTile::SetGeoCoordinates ( const GeoCoordinates cs  )  [inline]

Sets the origin with which this tile maps to.

Parameters:
cs The coordinate system containing this tile's origin.

const GeoCoordinates& dtTerrain::PagedTerrainTile::GetGeoCoordinates (  )  const [inline]

Gets this tile's coordinate system.

Returns:
Constant reference to this tile's coordinate system.

void dtTerrain::PagedTerrainTile::SetHeightField ( HeightField hf  )  [inline]

Sets the heightfield that maps to this terrain tile.

Parameters:
hf The new heightfield.

const HeightField* dtTerrain::PagedTerrainTile::GetHeightField (  )  const [inline]

Gets the heightfield currently assigned to this terrain tile.

Returns:
A pointer to the heightfield or NULL if it is not valid.

void dtTerrain::PagedTerrainTile::SetBaseTextureImage ( osg::Image *  image  )  [inline]

Sets the base texture for this terrain tile.

The base texture will be draped over the tile when it is rendered.

Parameters:
image The image to use as the base texure of this tile.

osg::Image* dtTerrain::PagedTerrainTile::GetBaseTextureImage (  )  [inline]

Gets the image currently being used by this tile as its base texture.

Returns:
A pointer to the image or NULL if it is not valid.

void dtTerrain::PagedTerrainTile::WriteToCache (  )  [virtual]

This method provides the paged tile with an opportunity to cache any data that it wants to retrieve later.

Note:
The terrain reader and renderers handle data tracking of the tile's basic needs. For example, the terrain reader will load/save the heightfield to the cache when needed. This method is intended to be used for application specific data in subclasses of the pagedterraintile.

Any errors should be tracked by throwing exceptions.

void dtTerrain::PagedTerrainTile::ReadFromCache (  )  [virtual]

This method provides the paged tile with an opportunity to restore any data that was previously cached.

Note:
The terrain readers and renderers handle data tracking of the tile's basic needs. This method provides a hook into the tile loading process by giving the tile an opportunity to load any application specific resources it may need.

Any errors should be tracked by throwing exceptions.

const std::string& dtTerrain::PagedTerrainTile::GetCachePath (  )  const [inline]

Gets the cache path assigned to this tile.

Returns:
The current cache path or the empty string if caching is disabled.

bool dtTerrain::PagedTerrainTile::IsCachingEnabled (  )  const [inline]

Gets the status of this tile's caching.

Returns:
True if enabled, false otherwise.

void dtTerrain::PagedTerrainTile::SetUpdateCache ( bool  flag  )  [inline]

Sets whether or not the cache needs to be updated to reflect the current state of the tile.

This should be set to true when new data is set or added to the tile that needs to be cached.

Parameters:
flag True if the cache should be updated, false otherwise.
Note:
If this value is false, the parent terrain will not call the tile's WriteToCache() method.

bool dtTerrain::PagedTerrainTile::GetUpdateCache (  )  const [inline]

Gets whether or not this tile's cache is out of sync with its data.

Returns:
True if this tile's cache needs updating.

const Terrain* dtTerrain::PagedTerrainTile::GetParentTerrain (  )  const [inline]

Gets the terrain that created this terrain tile and therefore owns it.

Returns:
A const pointer to the parent terrain.

Terrain* dtTerrain::PagedTerrainTile::GetParentTerrain (  )  [inline]

Gets the terrain that created this terrain tile and therefore owns it.

Returns:
A pointer to the parent terrain.

void dtTerrain::PagedTerrainTile::SetCachePath ( const std::string &  path  )  [protected]

Sets the cache path for this tile.

Any data corresponding to this tile can be cached by terrain readers and renderers when needed.

Parameters:
path The path assigned to this tile.
Note:
This path is most likely set by the terrain reader loading it. In most cases, this should not be modified by any other classes.


Friends And Related Function Documentation

friend class PagedTerrainTileFactory [friend]

Allow the factory and terrain to have access to this class.

friend class Terrain [friend]


http://www.delta3d.org
2.0.0 generated 14 Feb 2008