diff --git a/modules/globebrowsing/rendering/layermanager.cpp b/modules/globebrowsing/rendering/layermanager.cpp index 0f4a80d3b7..33a227aad2 100644 --- a/modules/globebrowsing/rendering/layermanager.cpp +++ b/modules/globebrowsing/rendering/layermanager.cpp @@ -60,8 +60,8 @@ namespace globebrowsing { layerDict.getValue("Name", layerName); setName(layerName); - - _tileProvider = std::shared_ptr(TileProvider::createFromDictionary(layerDict)); + _tileProvider = std::shared_ptr( + TileProvider::createFromDictionary(layerDict)); // Something else went wrong and no exception was thrown if (_tileProvider == nullptr) { @@ -80,11 +80,13 @@ namespace globebrowsing { } - ChunkTilePile Layer::getChunkTilePile(const TileIndex& tileIndex, int pileSize) const{ - return std::move(TileSelector::getHighestResolutionTilePile(_tileProvider.get(), tileIndex, pileSize)); + ChunkTilePile Layer::getChunkTilePile( + const TileIndex& tileIndex, + int pileSize) const { + return std::move(TileSelector::getHighestResolutionTilePile( + _tileProvider.get(), tileIndex, pileSize)); } - ////////////////////////////////////////////////////////////////////////////////////// // Layer Group // ////////////////////////////////////////////////////////////////////////////////////// @@ -158,19 +160,18 @@ namespace globebrowsing { setName("Layers"); + if (NUM_LAYER_GROUPS != layerGroupsDict.size()) { + throw ghoul::RuntimeError( + "Number of Layer Groups must be equal to " + NUM_LAYER_GROUPS); + } // Create all the categories of tile providers for (size_t i = 0; i < layerGroupsDict.size(); i++) { std::string groupName = LayerManager::LAYER_GROUP_NAMES[i]; - ghoul::Dictionary layerGroupDict = layerGroupsDict.value(groupName); + ghoul::Dictionary layerGroupDict = + layerGroupsDict.value(groupName); - TileProviderInitData initData; - initData.minimumPixelSize = 512; - initData.threads = 1; - initData.cacheSize = 5000; - initData.framesUntilRequestQueueFlush = 60; - initData.preprocessTiles = (i == LayerManager::HeightLayers); // Only preprocess height maps. - - _layerGroups.push_back(std::make_shared(groupName, layerGroupDict)); + _layerGroups.push_back( + std::make_shared(groupName, layerGroupDict)); } for(auto layerGroup : _layerGroups){ @@ -182,17 +183,18 @@ namespace globebrowsing { } - LayerGroup& LayerManager::layerGroup(size_t groupId) { + const LayerGroup& LayerManager::layerGroup(size_t groupId) { return *_layerGroups[groupId]; } - LayerGroup& LayerManager::layerGroup(LayerGroupId groupId) { + const LayerGroup& LayerManager::layerGroup(LayerGroupId groupId) { return *_layerGroups[groupId]; } bool LayerManager::hasAnyBlendingLayersEnabled() const { for (const auto& layerGroup : _layerGroups){ - if (layerGroup->layerBlendingEnabled() && layerGroup->activeLayers().size() > 0){ + if (layerGroup->layerBlendingEnabled() && + layerGroup->activeLayers().size() > 0){ return true; } } diff --git a/modules/globebrowsing/rendering/layermanager.h b/modules/globebrowsing/rendering/layermanager.h index aee0510bd6..e7df2fe6ca 100644 --- a/modules/globebrowsing/rendering/layermanager.h +++ b/modules/globebrowsing/rendering/layermanager.h @@ -58,7 +58,6 @@ namespace globebrowsing { */ class Layer : public properties::PropertyOwner { public: - Layer(const ghoul::Dictionary& layerDict); ~Layer(); @@ -69,7 +68,6 @@ namespace globebrowsing { const LayerRenderSettings& renderSettings() const { return _renderSettings; } private: - properties::BoolProperty _enabled; std::shared_ptr _tileProvider; LayerRenderSettings _renderSettings; @@ -79,7 +77,6 @@ namespace globebrowsing { * Convenience class for dealing with multiple Layers. */ struct LayerGroup : public properties::PropertyOwner { - LayerGroup(std::string name); LayerGroup(std::string name, const ghoul::Dictionary& dict); @@ -98,7 +95,6 @@ namespace globebrowsing { bool layerBlendingEnabled() const { return _levelBlendingEnabled.value(); } private: - std::vector> _layers; std::vector> _activeLayers; @@ -110,7 +106,6 @@ namespace globebrowsing { */ class LayerManager : public properties::PropertyOwner { public: - static const size_t NUM_LAYER_GROUPS = 7; static const std::string LAYER_GROUP_NAMES[NUM_LAYER_GROUPS]; static enum LayerGroupId{ @@ -126,8 +121,8 @@ namespace globebrowsing { LayerManager(const ghoul::Dictionary& textureCategoriesDictionary); ~LayerManager(); - LayerGroup& layerGroup(size_t groupId); - LayerGroup& layerGroup(LayerGroupId); + const LayerGroup& layerGroup(size_t groupId); + const LayerGroup& layerGroup(LayerGroupId); bool hasAnyBlendingLayersEnabled() const; @@ -137,9 +132,7 @@ namespace globebrowsing { void reset(bool includingDisabled = false); private: - std::vector> _layerGroups; - }; } // namespace globebrowsing diff --git a/modules/globebrowsing/tile/tileprovider/tileprovider.h b/modules/globebrowsing/tile/tileprovider/tileprovider.h index b82c555163..653d879b8f 100644 --- a/modules/globebrowsing/tile/tileprovider/tileprovider.h +++ b/modules/globebrowsing/tile/tileprovider/tileprovider.h @@ -147,14 +147,6 @@ namespace globebrowsing { typedef LRUCache TileCache; - struct TileProviderInitData { - int minimumPixelSize; - int threads; - int cacheSize; - int framesUntilRequestQueueFlush; - bool preprocessTiles = false; - }; - } // namespace globebrowsing } // namespace openspace