From decc49d52266dc485fc5ae18d9e56479fa41026a Mon Sep 17 00:00:00 2001 From: Kollberg Date: Mon, 1 Jul 2019 13:35:54 -0400 Subject: [PATCH] Added the possibility to read coloringmethod to field line asset file --- data/assets/testwsa/pfss_io.asset | 3 ++- data/assets/testwsa/pfss_oi.asset | 3 ++- data/assets/testwsa/scs_oi.asset | 1 + .../renderablefieldlinessequence.cpp | 20 +++++++++++++++++-- .../rendering/renderablefieldlinessequence.h | 1 + 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/data/assets/testwsa/pfss_io.asset b/data/assets/testwsa/pfss_io.asset index 0992ba4d7e..c982364b76 100755 --- a/data/assets/testwsa/pfss_io.asset +++ b/data/assets/testwsa/pfss_io.asset @@ -30,7 +30,8 @@ local fieldlines = { SimulationModel = "wsa", Color = { Uniform = {0.1, 0.725, 0, 1} - } + }, + ColoringMethod = "Uniform", }, GUI = { Path = "/Solar System/Heliosphere", diff --git a/data/assets/testwsa/pfss_oi.asset b/data/assets/testwsa/pfss_oi.asset index 62fa41c40d..4e7ddf956a 100755 --- a/data/assets/testwsa/pfss_oi.asset +++ b/data/assets/testwsa/pfss_oi.asset @@ -30,7 +30,8 @@ local fieldlines = { SimulationModel = "wsa", Color = { Uniform = {0.725, 0.1, 0, 1} - } + }, + ColoringMethod = "Quantity", }, GUI = { Path = "/Solar System/Heliosphere", diff --git a/data/assets/testwsa/scs_oi.asset b/data/assets/testwsa/scs_oi.asset index 082de703a4..62b5d7d42f 100755 --- a/data/assets/testwsa/scs_oi.asset +++ b/data/assets/testwsa/scs_oi.asset @@ -31,6 +31,7 @@ local fieldlines = { Color = { Uniform = {0, 0.725, 0.75, 1} }, + ColoringMethod = "Quantity", }, GUI = { Path = "/Solar System/Heliosphere", diff --git a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp index 01d3f40d7d..4cf6dbb65a 100644 --- a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp +++ b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.cpp @@ -81,6 +81,8 @@ namespace { // [STRING] Value should be path to folder where states are saved (JSON/CDF input // => osfls output & oslfs input => JSON output) constexpr const char* KeyOutputFolder = "OutputFolder"; + // [STRING] Value should either be "Quantity" or "Uniform" + constexpr const char* KeyColoringMethod = "ColoringMethod"; // ------------- POSSIBLE STRING VALUES FOR CORRESPONDING MODFILE KEY ------------- // constexpr const char* ValueInputFileTypeCdf = "cdf"; @@ -330,8 +332,7 @@ void RenderableFieldlinesSequence::initializeGL() { return; } - // dictionary is no longer needed as everything is extracted - _dictionary.reset(); + // No need to store source paths in memory if they are already in RAM! if (!_loadingStatesDynamically) { @@ -349,6 +350,11 @@ void RenderableFieldlinesSequence::initializeGL() { setupProperties(); + extractPropertyInfoFromDictionary(); + + // dictionary is no longer needed as everything is extracted + _dictionary.reset(); + // Setup shader program _shaderProgram = global::renderEngine.buildRenderProgram( "FieldlinesSequence", @@ -522,6 +528,16 @@ void RenderableFieldlinesSequence::extractOptionalInfoFromDictionary( else { _maskingRanges.push_back(glm::vec2(-100000, 100000)); // Just some default values! } + +} + +void RenderableFieldlinesSequence::extractPropertyInfoFromDictionary() { + // Specified weather to use uniform coloring or by specified quantity. + std::string coloringMethodDictionary; + if (_dictionary->getValue(KeyColoringMethod, coloringMethodDictionary)) { + if(coloringMethodDictionary == "Quantity") + _pColorMethod = static_cast(ColorMethod::ByQuantity); + } } /** diff --git a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.h b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.h index 7690849d77..775f270111 100644 --- a/modules/fieldlinessequence/rendering/renderablefieldlinessequence.h +++ b/modules/fieldlinessequence/rendering/renderablefieldlinessequence.h @@ -214,6 +214,7 @@ private: std::vector& extraMagVars); bool extractMandatoryInfoFromDictionary(SourceFileType& sourceFileType); void extractOptionalInfoFromDictionary(std::string& outputFolderPath); + void extractPropertyInfoFromDictionary(); void extractOsflsInfoFromDictionary(); bool extractSeedPointsFromFile(const std::string& path, std::vector& outVec);