diff --git a/source/config/config.cpp b/source/config/config.cpp index dc7604c8..eb5a733e 100644 --- a/source/config/config.cpp +++ b/source/config/config.cpp @@ -965,6 +965,25 @@ template<> Bool readConfig(Config &config, const std::string &name, std::string /***********************************************/ +// read std::string +template<> Bool readConfig(Config &config, const std::string &name, std::pair &var, Config::Appearance mustSet, const std::string &defaultValue, const std::string &annotation) +{ + std::string text; + Bool found = config.getConfigText(name, "string", mustSet, defaultValue, annotation, FALSE, text); + if(found) + { + Bool resolved = TRUE; + std::string textResolved = StringParser::parse(name, text, VariableList(), resolved); + if(resolved) + var = std::pair(textResolved, VariableList()); + else + var = std::pair(text, config.getVarList()); + } + return found; +} + +/***********************************************/ + // read Bool template<> Bool readConfig(Config &config, const std::string &name, Bool &var, Config::Appearance mustSet, const std::string &defaultValue, const std::string &annotation) { diff --git a/source/plot/plotGraphLayer.cpp b/source/plot/plotGraphLayer.cpp index cf1c01df..4619ae18 100644 --- a/source/plot/plotGraphLayer.cpp +++ b/source/plot/plotGraphLayer.cpp @@ -14,12 +14,14 @@ #define DOCSTRING_PlotGraphLayer #include "base/import.h" +#include "parser/stringParser.h" #include "parser/dataVariables.h" #include "config/configRegister.h" #include "inputOutput/logging.h" #include "inputOutput/file.h" #include "inputOutput/system.h" #include "files/fileMatrix.h" +#include "classes/gravityfield/gravityfield.h" #include "plot/plotMisc.h" #include "plotGraphLayer.h" @@ -42,7 +44,7 @@ See \program{Gravityfield2AreaMeanTimeSeries} for an example plot. class PlotGraphLayerLinesAndPoints : public PlotGraphLayer { protected: - std::string description; + std::pair description; PlotLinePtr line; PlotSymbolPtr symbol; Bool hasZValues, hasErrors; @@ -89,9 +91,9 @@ PlotGraphLayerLinesAndPoints::PlotGraphLayerLinesAndPoints(Config &config) // -------------------- if(!System::exists(fileName)) { - if(description.empty()) - description = fileName.str(); - description += " (file not found)"; + if(description.first.empty()) + description.first = fileName.str(); + description.first += " (file not found)"; logWarning<<"file <"< not found!"< is empty!"<simplify(varList); @@ -168,7 +171,7 @@ std::string PlotGraphLayerLinesAndPoints::legendEntry() const try { std::stringstream ss; - if(description.empty() || (!line && !symbol)) + if(description.first.empty() || (!line && !symbol)) return ss.str(); if(line) ss<<"S 0.3c - 0.5c - "<str()<<" 0.7c " ; @@ -178,7 +181,7 @@ std::string PlotGraphLayerLinesAndPoints::legendEntry() const ss<legendStr()<<"\t0.7c\t"; } - ss< description; PlotColorPtr fillColor; PlotLinePtr edgeLine; @@ -239,9 +242,9 @@ PlotGraphLayerErrorEnvelope::PlotGraphLayerErrorEnvelope(Config &config) // -------------------- if(!System::exists(fileName)) { - if(description.empty()) - description = fileName.str(); - description += " (file not found)"; + if(description.first.empty()) + description.first = fileName.str(); + description.first += " (file not found)"; logWarning<<"file <"< not found!"< is empty!"< expressions = {exprX, exprY, exprErrors}; for(ExpressionVariablePtr expr : expressions) @@ -317,7 +321,7 @@ std::string PlotGraphLayerErrorEnvelope::legendEntry() const { try { - if(description.empty()) + if(description.first.empty()) return std::string(); std::stringstream ss; @@ -326,7 +330,7 @@ std::string PlotGraphLayerErrorEnvelope::legendEntry() const ss<str(); else ss<<"0p,"<str(); - ss<<"\t0.7c\t"< description; public: PlotGraphLayerBars(Config &config); @@ -393,9 +397,9 @@ PlotGraphLayerBars::PlotGraphLayerBars(Config &config) // -------------------- if(!System::exists(fileName)) { - if(description.empty()) - description = fileName.str(); - description += " (file not found)"; + if(description.first.empty()) + description.first = fileName.str(); + description.first += " (file not found)"; logWarning<<"file <"< not found!"< is empty!"<simplify(varList); @@ -493,7 +498,7 @@ std::string PlotGraphLayerBars::legendEntry() const { try { - if(description.empty()) + if(description.first.empty()) return std::string(); if(!color) @@ -506,7 +511,7 @@ std::string PlotGraphLayerBars::legendEntry() const ss<<"S 0.3c r 5p "<str()<<" "; if(edgeLine) ss<str(); else ss<<"-"; - ss<<"\t0.7c\t"< description; PlotLinePtr lineSignal, lineErrors; public: @@ -896,9 +901,9 @@ PlotGraphLayerDegreeAmplitudes::PlotGraphLayerDegreeAmplitudes(Config &config) // -------------------- if(!System::exists(fileName)) { - if(description.empty()) - description = fileName.str(); - description += " (file not found)"; + if(description.first.empty()) + description.first = fileName.str(); + description.first += " (file not found)"; logWarning<<"file <"< not found!"< is empty!"< expressions = {exprDegree, exprSignal, exprErrors}; for(ExpressionVariablePtr expr : expressions)