Setup a simple working demo with TemporalTileProvider as a TileProvider

This commit is contained in:
Erik Broberg
2016-06-02 14:00:11 -04:00
parent 2eaea4c7a9
commit 678e91816b
5 changed files with 53 additions and 8 deletions

View File

@@ -40,5 +40,4 @@ return {
},
GuiName = "/Solar/Planets/DebugGlobe"
},
}

View File

@@ -6,11 +6,16 @@ function preInitialization()
critical objects.
]]--
openspace.time.setTime("2011 AUG 06 00:00:00")
openspace.time.setTime("2015 NOV 24 00:00:00")
dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua'))
openspace.bindKey("v", "openspace.setPropertyValue('DebugGlobe.saveOrThrowCamera', true)")
end
function postInitialization()
end
return {
ScenePath = ".",
CommonFolder = "common",

View File

@@ -23,10 +23,9 @@
****************************************************************************************/
#include <modules/globebrowsing/globes/renderableglobe.h>
#include <modules/globebrowsing/globes/globemesh.h>
#include <modules/globebrowsing/other/threadpool.h>
#include <modules/globebrowsing/other/temporaltileprovider.h>
// open space includes
#include <openspace/engine/openspaceengine.h>
@@ -107,6 +106,25 @@ namespace openspace {
int frameUntilFlushRequestQueue = 60;
int cacheSize = 5000;
// manually add a temporal tile provider for testing
std::string filename = "map_service_configs/VIIRS_SNPP_CorrectedReflectance_TrueColor_temporal.xml";
TileProviderInitData initData;
initData.minimumPixelSize = minimumTextureSide;
initData.threads = 1;
initData.cacheSize = 50;
initData.framesUntilRequestQueueFlush = 60;
std::shared_ptr<TileProvider> colorTextureProvider = std::shared_ptr<TemporalTileProvider>(
new TemporalTileProvider(filename, initData));
std::string name = "Temporal VIIRS SNPP";
_tileProviderManager->addColorTexture(name, colorTextureProvider, true);
_activeColorLayers.push_back(properties::BoolProperty(name, name, true));
// Create TileProviders for all color textures
for (size_t i = 0; i < colorTexturesDictionary.size(); i++)
@@ -133,10 +151,12 @@ namespace openspace {
_tileProviderManager->addColorTexture(name, colorTextureProvider, true);
// Create property for this tile provider
bool enabled = i == 0; // Only enable first layer
bool enabled = _activeColorLayers.size() == 0; // Only enable first layer
_activeColorLayers.push_back(properties::BoolProperty(name, name, enabled));
}
ghoul::Dictionary heightMapsDictionary;
texturesDictionary.getValue(keyHeightMaps, heightMapsDictionary);
@@ -166,7 +186,7 @@ namespace openspace {
_tileProviderManager->addHeightMap(name, heightMapProvider, true);
// Create property for this tile provider
bool enabled = i == 0; // Only enable first layer
bool enabled = _activeHeightMapLayers.size() == 0; // Only enable first layer
_activeHeightMapLayers.push_back(properties::BoolProperty(name, name, enabled));
}

View File

@@ -63,6 +63,19 @@ namespace openspace {
}
Tile TemporalTileProvider::getHighestResolutionTile(ChunkIndex chunkIndex, int parents) {
return getTileProvider()->getHighestResolutionTile(chunkIndex, parents);
}
TileDepthTransform TemporalTileProvider::depthTransform() {
return getTileProvider()->depthTransform();
}
void TemporalTileProvider::prerender() {
return getTileProvider()->prerender();
}
std::shared_ptr<CachingTileProvider> TemporalTileProvider::getTileProvider(Time t) {
TimeKey timekey = getTimeKey(t);
auto it = _tileProviderMap.find(timekey);

View File

@@ -35,7 +35,6 @@
#include <unordered_map>
#include "gdal_priv.h"
#include "vrtdataset.h"
@@ -54,10 +53,19 @@ namespace openspace {
};
class TemporalTileProvider {
class TemporalTileProvider : public TileProvider {
public:
TemporalTileProvider(const std::string& datasetFile, const TileProviderInitData& tileProviderInitData);
// These methods implements TileProvider
virtual Tile getHighestResolutionTile(ChunkIndex chunkIndex, int parents = 0);
virtual TileDepthTransform depthTransform();
virtual void prerender();
// Provider other convenient methods
std::shared_ptr<CachingTileProvider> getTileProvider(Time t = Time::ref());
private: