From 627b8e635bcd97adb83592b3a3e7d8cd655da964 Mon Sep 17 00:00:00 2001 From: Kalle Bladin Date: Tue, 14 Jun 2016 14:00:21 -0400 Subject: [PATCH] Activated texture layers can be set from mod file. --- data/scene/debugglobe/debugglobe.mod | 22 ++++++++++++++----- .../globebrowsing/globes/renderableglobe.cpp | 2 +- .../tile/TileProviderManager.cpp | 6 +++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/data/scene/debugglobe/debugglobe.mod b/data/scene/debugglobe/debugglobe.mod index 3b890b5075..217221c849 100644 --- a/data/scene/debugglobe/debugglobe.mod +++ b/data/scene/debugglobe/debugglobe.mod @@ -32,58 +32,68 @@ return { SegmentsPerPatch = 64, TextureInitData = { ColorTextureMinimumSize = 1024, - OverlayMinimumSize = 4096, + OverlayMinimumSize = 2048, HeightMapMinimumSize = 64, }, Textures = { ColorTextures = { { Name = "Temporal VIIRS SNPP", - FilePath = "map_service_configs/Temporal_VIIRS_SNPP_CorrectedReflectance_TrueColor.xml" + FilePath = "map_service_configs/Temporal_VIIRS_SNPP_CorrectedReflectance_TrueColor.xml", + Enabled = false, }, { Name = "Temporal MODIS Aqua CorrectedRecflectance TrueColor", - FilePath = "map_service_configs/Temporal_MODIS_Aqua_CorrectedReflectance_TrueColor.xml" + FilePath = "map_service_configs/Temporal_MODIS_Aqua_CorrectedReflectance_TrueColor.xml", + Enabled = false, }, { Name = "MODIS_Terra_CorrectedReflectance_TrueColor", - FilePath = "map_service_configs/MODIS_Terra_CorrectedReflectance_TrueColor.xml" + FilePath = "map_service_configs/MODIS_Terra_CorrectedReflectance_TrueColor.xml", + Enabled = false, }, { Name = "ESRI Imagery World 2D", FilePath = "map_service_configs/ESRI_Imagery_World_2D.wms", + Enabled = true, }, }, NightTextures = { { - Name = "Earth at Night 2012", + Name = "Earth at Night 2012", FilePath = "map_service_configs/VIIRS_CityLights_2012.xml", + Enabled = false, }, }, HeightMaps = { { Name = "Terrain tileset", FilePath = "map_service_configs/TERRAIN.wms", + Enabled = true, }, }, WaterMasks = { { Name = "MODIS_Water_Mask", - FilePath = "map_service_configs/MODIS_Water_Mask.xml" + FilePath = "map_service_configs/MODIS_Water_Mask.xml", + Enabled = false, }, }, Overlays = { { Name = "Coastlines", FilePath = "map_service_configs/Coastlines.xml", + Enabled = false, }, { Name = "Reference_Features", FilePath = "map_service_configs/Reference_Features.xml", + Enabled = false, }, { Name = "Reference_Labels", FilePath = "map_service_configs/Reference_Labels.xml", + Enabled = false, }, }, }, diff --git a/modules/globebrowsing/globes/renderableglobe.cpp b/modules/globebrowsing/globes/renderableglobe.cpp index f9ce38e0df..33eef9b7dc 100644 --- a/modules/globebrowsing/globes/renderableglobe.cpp +++ b/modules/globebrowsing/globes/renderableglobe.cpp @@ -146,7 +146,7 @@ namespace openspace { std::vector& dest) { for (size_t i = 0; i < tileProviders.size(); i++) { - bool enabled = i == 0; // Only enable first layer + bool enabled = tileProviders[i].isActive; std::string name = tileProviders[i].name; dest.push_back(properties::BoolProperty(name, name, enabled)); } diff --git a/modules/globebrowsing/tile/TileProviderManager.cpp b/modules/globebrowsing/tile/TileProviderManager.cpp index a47b2a098f..0bfb4c77de 100644 --- a/modules/globebrowsing/tile/TileProviderManager.cpp +++ b/modules/globebrowsing/tile/TileProviderManager.cpp @@ -90,15 +90,17 @@ namespace openspace { // Create TileProviders for all textures within this category for (size_t i = 0; i < texturesDict.size(); i++) { std::string name, path; + // Default to enabled = true on case it's not defined in the dictionary + bool enabled = true; std::string dictKey = std::to_string(i + 1); ghoul::Dictionary texDict = texturesDict.value(dictKey); texDict.getValue("Name", name); texDict.getValue("FilePath", path); - + texDict.getValue("Enabled", enabled); std::shared_ptr tileProvider = initProvider(path, initData); - bool enabled = dest.size() == 0; // Only enable first layer + //bool enabled = dest.size() == 0; // Only enable first layer dest.push_back({ name, tileProvider, enabled }); } }