From 2700ef6ea8bc1bc6cad7388403c876fff3401cb2 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 4 Jun 2016 13:45:55 +0200 Subject: [PATCH] Moving potential targets into ProjectionComponent --- .../rendering/renderableplanetprojection.cpp | 14 -------------- modules/newhorizons/util/projectioncomponent.cpp | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/modules/newhorizons/rendering/renderableplanetprojection.cpp b/modules/newhorizons/rendering/renderableplanetprojection.cpp index 9110a85376..e4954dcc6e 100644 --- a/modules/newhorizons/rendering/renderableplanetprojection.cpp +++ b/modules/newhorizons/rendering/renderableplanetprojection.cpp @@ -38,7 +38,6 @@ namespace { const std::string _loggerCat = "RenderablePlanetProjection"; - const std::string keyPotentialTargets = "PotentialTargets"; const std::string keyFrame = "Frame"; const std::string keyGeometry = "Geometry"; @@ -84,18 +83,6 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary& success = initializeProjectionSettings(dictionary); ghoul_assert(success, ""); - // @TODO copy-n-paste from renderablefov ---abock - ghoul::Dictionary potentialTargets; - success = dictionary.getValue(keyPotentialTargets, potentialTargets); - ghoul_assert(success, ""); - - _potentialTargets.resize(potentialTargets.size()); - for (int i = 0; i < potentialTargets.size(); ++i) { - std::string target; - potentialTargets.getValue(std::to_string(i + 1), target); - _potentialTargets[i] = target; - } - // TODO: textures need to be replaced by a good system similar to the geometry as soon // as the requirements are fixed (ab) std::string texturePath = ""; @@ -113,7 +100,6 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary& addProperty(_performProjection); addProperty(_clearAllProjections); - addProperty(_colorTexturePath); _colorTexturePath.onChange(std::bind(&RenderablePlanetProjection::loadTextures, this)); diff --git a/modules/newhorizons/util/projectioncomponent.cpp b/modules/newhorizons/util/projectioncomponent.cpp index 769bbf1616..5b212223b4 100644 --- a/modules/newhorizons/util/projectioncomponent.cpp +++ b/modules/newhorizons/util/projectioncomponent.cpp @@ -36,6 +36,8 @@ #include namespace { + const std::string keyPotentialTargets = "PotentialTargets"; + const std::string keyInstrument = "Instrument.Name"; const std::string keyInstrumentFovy = "Instrument.Fovy"; const std::string keyInstrumentAspect = "Instrument.Aspect"; @@ -99,6 +101,19 @@ bool ProjectionComponent::initializeProjectionSettings(const Dictionary& diction completeSuccess &= s; ghoul_assert(completeSuccess, "All neccessary attributes not found in modfile"); + + if (dictionary.hasKeyAndValue(keyPotentialTargets)) { + ghoul::Dictionary potentialTargets = dictionary.value( + keyPotentialTargets + ); + + _potentialTargets.resize(potentialTargets.size()); + for (int i = 0; i < potentialTargets.size(); ++i) { + std::string target; + potentialTargets.getValue(std::to_string(i + 1), target); + _potentialTargets[i] = target; + } + } return completeSuccess; }