osgEarth 2.1.1
|
Public Member Functions | |
virtual bool | getImage (const TileKey &key, const CacheSpec &spec, osg::ref_ptr< const osg::Image > &out_image)=0 |
virtual void | setImage (const TileKey &key, const CacheSpec &spec, const osg::Image *image)=0 |
virtual bool | getHeightField (const TileKey &key, const CacheSpec &spec, osg::ref_ptr< const osg::HeightField > &out_hf) |
virtual void | setHeightField (const TileKey &key, const CacheSpec &spec, const osg::HeightField *hf) |
virtual const std::string & | getReferenceURI () |
virtual void | setReferenceURI (const std::string &value) |
virtual bool | isCached (const TileKey &key, const CacheSpec &spec) const |
virtual void | storeProperties (const CacheSpec &spec, const Profile *profile, unsigned int tileSize) |
virtual bool | loadProperties (const std::string &cacheId, CacheSpec &out_spec, osg::ref_ptr< const Profile > &out_profile, unsigned int &out_tileSize) |
virtual bool | compact (bool async=true) |
virtual bool | purge (const std::string &cacheId, int olderThanTimeStamp=0L, bool async=true) |
const CacheOptions & | getCacheOptions () const |
Cache (const CacheOptions &options=CacheOptions()) | |
Cache (const Cache &rhs, const osg::CopyOp &op=osg::CopyOp::DEEP_COPY_ALL) | |
Protected Attributes | |
CacheOptions | _options |
std::string | _refURI |
A Cache is an object that stores and retrieves image or heightfield rasters. This is the base class for all such implementations.
Cache::Cache | ( | const CacheOptions & | options = CacheOptions() | ) |
Definition at line 41 of file Caching.cpp.
: osg::Object( true ), _options(options) { //NOP }
Cache::Cache | ( | const Cache & | rhs, |
const osg::CopyOp & | op = osg::CopyOp::DEEP_COPY_ALL |
||
) |
Definition at line 48 of file Caching.cpp.
virtual bool osgEarth::Cache::compact | ( | bool | async = true | ) | [inline, virtual] |
Compact the cache, if supported by the underlying implementation. You can optionally specify that the compaction operation run in a background thread if supported.
This method will return false if the implementation does not support compaction.
Definition at line 270 of file Caching.
{ return false; }
const CacheOptions& osgEarth::Cache::getCacheOptions | ( | ) | const [inline] |
bool Cache::getHeightField | ( | const TileKey & | key, |
const CacheSpec & | spec, | ||
osg::ref_ptr< const osg::HeightField > & | out_hf | ||
) | [virtual] |
Gets the cached heightfield for the given TileKey
Reimplemented in osgEarth::MemCache.
Definition at line 56 of file Caching.cpp.
{ //Try to get an image from the cache osg::ref_ptr<const osg::Image> image; if ( getImage( key, spec, image ) ) { OE_DEBUG << LC << "Read cached heightfield " << std::endl; ImageToHeightFieldConverter conv; out_hf = conv.convert(image.get()); return out_hf.valid(); } else return false; }
virtual bool osgEarth::Cache::getImage | ( | const TileKey & | key, |
const CacheSpec & | spec, | ||
osg::ref_ptr< const osg::Image > & | out_image | ||
) | [pure virtual] |
Gets the cached image for the given TileKey
Implemented in osgEarth::MemCache, osgEarth::DiskCache, and Sqlite3Cache.
virtual const std::string& osgEarth::Cache::getReferenceURI | ( | ) | [inline, virtual] |
virtual bool osgEarth::Cache::isCached | ( | const TileKey & | key, |
const CacheSpec & | spec | ||
) | const [inline, virtual] |
Gets whether the given TileKey is cached or not
Reimplemented in osgEarth::MemCache, osgEarth::DiskCache, and Sqlite3Cache.
Definition at line 245 of file Caching.
{ return false; }
virtual bool osgEarth::Cache::loadProperties | ( | const std::string & | cacheId, |
CacheSpec & | out_spec, | ||
osg::ref_ptr< const Profile > & | out_profile, | ||
unsigned int & | out_tileSize | ||
) | [inline, virtual] |
Loads the TileMap for the given cacheId.
Reimplemented in osgEarth::DiskCache, and Sqlite3Cache.
Definition at line 256 of file Caching.
{ return false; }
virtual bool osgEarth::Cache::purge | ( | const std::string & | cacheId, |
int | olderThanTimeStamp = 0L , |
||
bool | async = true |
||
) | [inline, virtual] |
Delete old entries from the cache. The timestamp is UTC, second since epoch. You can optionally control whether the purge operation should run in the background (async=true) if supported.
This method will return false if the implementation does not support the operation.
Reimplemented in osgEarth::MemCache, and Sqlite3Cache.
Definition at line 280 of file Caching.
{ return false; }
void Cache::setHeightField | ( | const TileKey & | key, |
const CacheSpec & | spec, | ||
const osg::HeightField * | hf | ||
) | [virtual] |
Sets the cached heightfield for the given TileKey
Reimplemented in osgEarth::MemCache.
Definition at line 71 of file Caching.cpp.
{ ImageToHeightFieldConverter conv; //Take a reference to the returned image so it gets deleted properly osg::ref_ptr<osg::Image> image = conv.convert(hf); setImage( key, spec, image.get() ); }
virtual void osgEarth::Cache::setImage | ( | const TileKey & | key, |
const CacheSpec & | spec, | ||
const osg::Image * | image | ||
) | [pure virtual] |
Sets the cached image for the given TileKey
Implemented in osgEarth::MemCache, osgEarth::DiskCache, and Sqlite3Cache.
virtual void osgEarth::Cache::setReferenceURI | ( | const std::string & | value | ) | [inline, virtual] |
virtual void osgEarth::Cache::storeProperties | ( | const CacheSpec & | spec, |
const Profile * | profile, | ||
unsigned int | tileSize | ||
) | [inline, virtual] |
Store the TileMap for the given profile.
Reimplemented in osgEarth::DiskCache, and Sqlite3Cache.
Definition at line 250 of file Caching.
{ }
CacheOptions osgEarth::Cache::_options [protected] |
Reimplemented in osgEarth::DiskCache, osgEarth::TMSCache, and Sqlite3Cache.
std::string osgEarth::Cache::_refURI [protected] |