From 0b6216831705afc2bf8af1cf74ad8e2b548f9734 Mon Sep 17 00:00:00 2001 From: Erik Broberg Date: Thu, 2 Jun 2016 12:31:57 -0400 Subject: [PATCH] rename TileProvider -> CachingTileProvider --- .../globebrowsing/globes/renderableglobe.cpp | 8 +++---- .../other/TileProviderManager.cpp | 12 +++++----- .../globebrowsing/other/TileProviderManager.h | 14 ++++++------ .../other/temporaltileprovider.cpp | 8 +++---- .../other/temporaltileprovider.h | 6 ++--- modules/globebrowsing/other/tileprovider.cpp | 22 +++++++++---------- modules/globebrowsing/other/tileprovider.h | 6 ++--- 7 files changed, 38 insertions(+), 38 deletions(-) diff --git a/modules/globebrowsing/globes/renderableglobe.cpp b/modules/globebrowsing/globes/renderableglobe.cpp index 5686fe715a..6a39539e6a 100644 --- a/modules/globebrowsing/globes/renderableglobe.cpp +++ b/modules/globebrowsing/globes/renderableglobe.cpp @@ -127,8 +127,8 @@ namespace openspace { std::shared_ptr tileReader = std::shared_ptr( new AsyncTileDataProvider(tileDataset, threadPool)); - std::shared_ptr colorTextureProvider = std::shared_ptr( - new TileProvider(tileReader, cacheSize, frameUntilFlushRequestQueue)); + std::shared_ptr colorTextureProvider = std::shared_ptr( + new CachingTileProvider(tileReader, cacheSize, frameUntilFlushRequestQueue)); _tileProviderManager->addColorTexture(name, colorTextureProvider, true); @@ -159,8 +159,8 @@ namespace openspace { std::shared_ptr tileReader = std::shared_ptr( new AsyncTileDataProvider(tileDataset, threadPool)); - std::shared_ptr heightMapProvider = std::shared_ptr( - new TileProvider(tileReader, cacheSize, frameUntilFlushRequestQueue)); + std::shared_ptr heightMapProvider = std::shared_ptr( + new CachingTileProvider(tileReader, cacheSize, frameUntilFlushRequestQueue)); _tileProviderManager->addHeightMap(name, heightMapProvider, true); diff --git a/modules/globebrowsing/other/TileProviderManager.cpp b/modules/globebrowsing/other/TileProviderManager.cpp index b4afd69e77..d7195257cb 100644 --- a/modules/globebrowsing/other/TileProviderManager.cpp +++ b/modules/globebrowsing/other/TileProviderManager.cpp @@ -44,7 +44,7 @@ namespace openspace { void TileProviderManager::addHeightMap( std::string name, - std::shared_ptr tileProvider, + std::shared_ptr tileProvider, bool isActive) { _heightMapProviders.push_back({ name , tileProvider, isActive}); @@ -52,7 +52,7 @@ namespace openspace { void TileProviderManager::addColorTexture( std::string name, - std::shared_ptr tileProvider, + std::shared_ptr tileProvider, bool isActive) { _colorTextureProviders.push_back({ name , tileProvider, isActive }); @@ -70,10 +70,10 @@ namespace openspace { return _colorTextureProviders; } - const std::vector > + const std::vector > TileProviderManager::getActiveHeightMapProviders() { - std::vector > tileProviders; + std::vector > tileProviders; for (auto it = _heightMapProviders.begin(); it != _heightMapProviders.end(); it++) { if (it->isActive) { @@ -83,10 +83,10 @@ namespace openspace { return tileProviders; } - const std::vector > + const std::vector > TileProviderManager::getActiveColorTextureProviders() { - std::vector > tileProviders; + std::vector > tileProviders; for (auto it = _colorTextureProviders.begin(); it != _colorTextureProviders.end(); it++) { if (it->isActive) { diff --git a/modules/globebrowsing/other/TileProviderManager.h b/modules/globebrowsing/other/TileProviderManager.h index 40aa8bef57..779c5b40c9 100644 --- a/modules/globebrowsing/other/TileProviderManager.h +++ b/modules/globebrowsing/other/TileProviderManager.h @@ -39,7 +39,7 @@ namespace openspace { public: struct TileProviderWithName { std::string name; - std::shared_ptr tileProvider; + std::shared_ptr tileProvider; bool isActive; }; @@ -50,18 +50,18 @@ namespace openspace { void addHeightMap( std::string name, - std::shared_ptr tileProvider, + std::shared_ptr tileProvider, bool isActive); void addColorTexture( std::string name, - std::shared_ptr tileProvider, + std::shared_ptr tileProvider, bool isActive); /* - std::shared_ptr getHeightMap(std::string name); - std::shared_ptr getColorTexture(std::string name); + std::shared_ptr getHeightMap(std::string name); + std::shared_ptr getColorTexture(std::string name); */ - const std::vector > getActiveHeightMapProviders(); - const std::vector > getActiveColorTextureProviders(); + const std::vector > getActiveHeightMapProviders(); + const std::vector > getActiveColorTextureProviders(); std::vector& heightMapProviders(); std::vector& colorTextureProviders(); diff --git a/modules/globebrowsing/other/temporaltileprovider.cpp b/modules/globebrowsing/other/temporaltileprovider.cpp index f951dffd3d..75f808993a 100644 --- a/modules/globebrowsing/other/temporaltileprovider.cpp +++ b/modules/globebrowsing/other/temporaltileprovider.cpp @@ -63,7 +63,7 @@ namespace openspace { } - std::shared_ptr TemporalTileProvider::getTileProvider(Time t) { + std::shared_ptr TemporalTileProvider::getTileProvider(Time t) { TimeKey timekey = getTimeKey(t); auto it = _tileProviderMap.find(timekey); if (it != _tileProviderMap.end()) { @@ -76,7 +76,7 @@ namespace openspace { } } - std::shared_ptr TemporalTileProvider::initTileProvider(TimeKey timekey) { + std::shared_ptr TemporalTileProvider::initTileProvider(TimeKey timekey) { std::string gdalDatasetXml = getGdalDatasetXML(timekey); std::shared_ptr tileDataset = std::shared_ptr( @@ -88,8 +88,8 @@ namespace openspace { std::shared_ptr tileReader = std::shared_ptr( new AsyncTileDataProvider(tileDataset, threadPool)); - std::shared_ptr tileProvider= std::shared_ptr( - new TileProvider(tileReader, + std::shared_ptr tileProvider= std::shared_ptr( + new CachingTileProvider(tileReader, _tileProviderInitData.cacheSize, _tileProviderInitData.framesUntilRequestQueueFlush)); diff --git a/modules/globebrowsing/other/temporaltileprovider.h b/modules/globebrowsing/other/temporaltileprovider.h index e679a77659..4e22d5c45c 100644 --- a/modules/globebrowsing/other/temporaltileprovider.h +++ b/modules/globebrowsing/other/temporaltileprovider.h @@ -58,7 +58,7 @@ namespace openspace { public: TemporalTileProvider(const std::string& datasetFile, const TileProviderInitData& tileProviderInitData); - std::shared_ptr getTileProvider(Time t = Time::ref()); + std::shared_ptr getTileProvider(Time t = Time::ref()); private: @@ -71,7 +71,7 @@ namespace openspace { TimeKey getTimeKey(const Time& t); - std::shared_ptr initTileProvider(TimeKey timekey); + std::shared_ptr initTileProvider(TimeKey timekey); ////////////////////////////////////////////////////////////////////////////////// @@ -82,7 +82,7 @@ namespace openspace { std::string _dataSourceXmlTemplate; - std::unordered_map > _tileProviderMap; + std::unordered_map > _tileProviderMap; TileProviderInitData _tileProviderInitData; diff --git a/modules/globebrowsing/other/tileprovider.cpp b/modules/globebrowsing/other/tileprovider.cpp index b7a77cc9d9..facdd3a4ce 100644 --- a/modules/globebrowsing/other/tileprovider.cpp +++ b/modules/globebrowsing/other/tileprovider.cpp @@ -46,7 +46,7 @@ namespace { namespace openspace { - TileProvider::TileProvider(std::shared_ptr tileReader, int tileCacheSize, + CachingTileProvider::CachingTileProvider(std::shared_ptr tileReader, int tileCacheSize, int framesUntilFlushRequestQueue) : _asyncTextureDataProvider(tileReader) , _tileCache(tileCacheSize) @@ -56,32 +56,32 @@ namespace openspace { } - TileProvider::~TileProvider(){ + CachingTileProvider::~CachingTileProvider(){ clearRequestQueue(); } - void TileProvider::prerender() { + void CachingTileProvider::prerender() { initTexturesFromLoadedData(); if (_framesSinceLastRequestFlush++ > _framesUntilRequestFlush) { clearRequestQueue(); } } - void TileProvider::initTexturesFromLoadedData() { + void CachingTileProvider::initTexturesFromLoadedData() { while (_asyncTextureDataProvider->hasLoadedTextureData()) { std::shared_ptr tileIOResult = _asyncTextureDataProvider->nextTileIOResult(); initializeAndAddToCache(tileIOResult); } } - void TileProvider::clearRequestQueue() { + void CachingTileProvider::clearRequestQueue() { _asyncTextureDataProvider->clearRequestQueue(); _framesSinceLastRequestFlush = 0; } - Tile TileProvider::getHighestResolutionTile(ChunkIndex chunkIndex, int parents, TileUvTransform uvTransform) { + Tile CachingTileProvider::getHighestResolutionTile(ChunkIndex chunkIndex, int parents, TileUvTransform uvTransform) { for (int i = 0; i < parents && chunkIndex.level > 1; i++) { transformFromParent(chunkIndex, uvTransform); chunkIndex = chunkIndex.parent(); @@ -96,7 +96,7 @@ namespace openspace { return getOrEnqueueHighestResolutionTile(chunkIndex, uvTransform); } - Tile TileProvider::getOrEnqueueHighestResolutionTile(const ChunkIndex& chunkIndex, + Tile CachingTileProvider::getOrEnqueueHighestResolutionTile(const ChunkIndex& chunkIndex, TileUvTransform& uvTransform) { @@ -124,7 +124,7 @@ namespace openspace { - void TileProvider::transformFromParent(const ChunkIndex& chunkIndex, TileUvTransform& uv) const { + void CachingTileProvider::transformFromParent(const ChunkIndex& chunkIndex, TileUvTransform& uv) const { uv.uvOffset *= 0.5; uv.uvScale *= 0.5; @@ -139,7 +139,7 @@ namespace openspace { } - std::shared_ptr TileProvider::getOrStartFetchingTile(ChunkIndex chunkIndex) { + std::shared_ptr CachingTileProvider::getOrStartFetchingTile(ChunkIndex chunkIndex) { HashKey hashkey = chunkIndex.hashKey(); if (_tileCache.exist(hashkey)) { return _tileCache.get(hashkey).texture; @@ -150,12 +150,12 @@ namespace openspace { } } - TileDepthTransform TileProvider::depthTransform() { + TileDepthTransform CachingTileProvider::depthTransform() { return _asyncTextureDataProvider->getTextureDataProvider()->getDepthTransform(); } - void TileProvider::initializeAndAddToCache(std::shared_ptr tileIOResult) { + void CachingTileProvider::initializeAndAddToCache(std::shared_ptr tileIOResult) { std::shared_ptr tileData = tileIOResult->rawTileData; HashKey key = tileData->chunkIndex.hashKey(); diff --git a/modules/globebrowsing/other/tileprovider.h b/modules/globebrowsing/other/tileprovider.h index 6a8844c350..a5a8943b97 100644 --- a/modules/globebrowsing/other/tileprovider.h +++ b/modules/globebrowsing/other/tileprovider.h @@ -71,13 +71,13 @@ namespace openspace { Provides tiles through GDAL datasets which can be defined with xml files for example for wms. */ - class TileProvider { + class CachingTileProvider { public: - TileProvider(std::shared_ptr tileReader, int tileCacheSize, + CachingTileProvider(std::shared_ptr tileReader, int tileCacheSize, int framesUntilFlushRequestQueue); - ~TileProvider(); + ~CachingTileProvider(); Tile getHighestResolutionTile(ChunkIndex chunkIndex, int parents = 0,