Commit ec48a62a740c66bc041bd9002872d941b8478f3b

Authored by Benjamin Renard
2 parents 0baafd6e 3d47da02

Merge branch '9326' into develop

src/ExternLib/ttcat_to_param/CMakeLists.txt
... ... @@ -10,6 +10,7 @@ include_directories(
10 10 ${CMAKE_HOME_DIRECTORY}/src/Plugins/
11 11 ${CMAKE_HOME_DIRECTORY}/src/helpers/
12 12 ${CMAKE_HOME_DIRECTORY}/src/TimeTableCatalog/
  13 + ${CMAKE_HOME_DIRECTORY}/src/Info/
13 14 ${LOG4CXX_INCLUDE_DIR}
14 15 ${Boost_INCLUDE_DIR}
15 16 )
... ...
src/ExternLib/ttcat_to_param/ProcessTTCatToParam.cc
... ... @@ -16,6 +16,7 @@
16 16 #include "TTCatToParam.hh"
17 17 #include "TimeTableCatalogFactory.hh"
18 18 #include "Catalog.hh"
  19 +#include "ParamMgr.hh"
19 20  
20 21 using namespace std;
21 22 using namespace boost;
... ... @@ -84,7 +85,18 @@ TimeStamp ProcessTTCatToParam::init() {
84 85 return timeStamp;
85 86 }
86 87  
  88 +void ProcessTTCatToParam::updateInfo(Parameter &parameter)
  89 +{
  90 + SingleParamProcess::updateInfo(parameter);
87 91  
  92 + AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(parameter.getInfoId(), true);
  93 +
  94 + if (paramInfo == nullptr)
  95 + {
  96 + return;
  97 + }
  98 + paramInfo->addAdditionalInfo("TTCatToParamPath", _attributList[0]);
  99 +}
88 100  
89 101 } /* namespace Parameters */
90 102 } /* namespace AMDA */
... ...
src/ExternLib/ttcat_to_param/ProcessTTCatToParam.hh
... ... @@ -38,6 +38,7 @@ public:
38 38 */
39 39 TimeStamp init();
40 40  
  41 + virtual void updateInfo(Parameter &parameter);
41 42 };
42 43  
43 44 } /* namespace Parameters */
... ...
src/Info/ParamInfo.hh
... ... @@ -340,6 +340,19 @@ public:
340 340 return _processInfo;
341 341 }
342 342  
  343 + void addAdditionalInfo(std::string key, std::string value)
  344 + {
  345 + _additionalInfo[key] = value;
  346 + }
  347 +
  348 + /*
  349 + * @brief Get information about parameter process
  350 + */
  351 + const std::map<std::string, std::string> getAdditionInfo() const
  352 + {
  353 + return _additionalInfo;
  354 + }
  355 +
343 356 /*
344 357 * @brief Set a description of the parameter process
345 358 */
... ... @@ -425,7 +438,8 @@ protected:
425 438 std::vector<std::string> _linkedParamList;
426 439 std::string _dataset_id;
427 440 std::string _instrument_id;
428   - static log4cxx::LoggerPtr _logger;
  441 + std::map<std::string, std::string> _additionalInfo;
  442 + static log4cxx::LoggerPtr _logger;
429 443 };
430 444  
431 445 typedef boost::shared_ptr<ParamInfo> ParamInfoSPtr;
... ...
src/InternLib/MultiParamProcess.cc
... ... @@ -226,8 +226,21 @@ void MultiParamProcess::updateInfo(Parameter &amp; parameter)
226 226 }
227 227  
228 228 paramInfo->setProcessDescription(description);
229   -}
230 229  
  230 + if ((_paramNameList.size() == 1) && paramInfo->getAdditionInfo().empty())
  231 + {
  232 + AMDA::Info::ParamInfoSPtr inputParamInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(_paramNameList.begin()->second.first->getInfoId());
  233 + if (inputParamInfo != nullptr)
  234 + {
  235 + // Copy tables
  236 + std::map<std::string, std::string> inputAdditionals = inputParamInfo->getAdditionInfo();
  237 + for (std::map<std::string, std::string>::iterator it = inputAdditionals.begin(); it != inputAdditionals.end(); ++it)
  238 + {
  239 + paramInfo->addAdditionalInfo(it->first, it->second);
  240 + }
  241 + }
  242 + }
  243 +}
231 244 /*
232 245 * @brief Get min sampling
233 246 */
... ...
src/ParamOutputImpl/Plot/PanelPlotOutput.cc
... ... @@ -16,6 +16,8 @@
16 16 #include "ParamMgr.hh"
17 17 #include "DecoratorPlot.hh"
18 18 #include "PlPlotUtil.hh"
  19 +#include "Catalog.hh"
  20 +#include "TimeTableCatalogFactory.hh"
19 21  
20 22 #include <string>
21 23 #include <boost/range/adaptor/reversed.hpp>
... ... @@ -2071,7 +2073,8 @@ void PanelPlotOutput::drawCurvePlot(CurvePlot &amp;/*curvePlot*/) {
2071 2073 /**
2072 2074 * @brief Write plot context
2073 2075 */
2074   -void PanelPlotOutput::writeContext(ContextFileWriter& writer) {
  2076 +void PanelPlotOutput::writeContext(ContextFileWriter &writer, AMDA::Parameters::TimeIntervalList::iterator currentTimeInterval)
  2077 +{
2075 2078 if (!isStandalone())
2076 2079 return;
2077 2080  
... ... @@ -2088,10 +2091,57 @@ void PanelPlotOutput::writeContext(ContextFileWriter&amp; writer) {
2088 2091 hasSpectro = true;
2089 2092 break;
2090 2093 }
2091   - if (parameter.getSauvaudProperties() != nullptr) {
  2094 + if (parameter.getSauvaudProperties() != nullptr)
  2095 + {
2092 2096 hasSauvaud = true;
2093 2097 break;
2094 2098 }
  2099 + if (parameter.getIntervalsProperties() != nullptr)
  2100 + {
  2101 + ParameterSPtr p = _parameterManager.getParameter(parameter._originalParamId);
  2102 + AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(p->getInfoId());
  2103 + std::map<std::string, std::string> inputAdditionals = paramInfo->getAdditionInfo();
  2104 + std::string ttOrCatPath = inputAdditionals["TTCatToParamPath"];
  2105 +
  2106 + // Load TT or Catalog
  2107 + std::string lReaderType = TimeTableCatalog::TimeTableCatalogFactory::getInstance().getReaderType(ttOrCatPath);
  2108 + if (!lReaderType.empty())
  2109 + {
  2110 + TimeTableCatalog::Catalog inputTTOrCat;
  2111 + inputTTOrCat.read(ttOrCatPath, lReaderType);
  2112 +
  2113 + for (std::vector<TimeTableCatalog::TimeInterval>::const_iterator it = inputTTOrCat.getIntervals().begin(); it != inputTTOrCat.getIntervals().end(); ++it)
  2114 + {
  2115 + if (it->_startTime >= currentTimeInterval->_startTime && it->_stopTime <= currentTimeInterval->_stopTime) // inside the interval
  2116 + {
  2117 + writer.startElement("intervals");
  2118 + writer.addAttribute("name", inputTTOrCat._name.c_str());
  2119 + writer.addAttribute("id", std::to_string(it->_index).c_str());
  2120 + writer.addAttribute("startTime", std::to_string(it->_startTime).c_str());
  2121 + writer.addAttribute("stopTime", std::to_string(it->_stopTime).c_str());
  2122 + writer.endElement();
  2123 + }
  2124 + else if (it->_startTime <= currentTimeInterval->_startTime && it->_stopTime <= currentTimeInterval->_stopTime && it->_stopTime >= currentTimeInterval->_startTime) // begins before, ends inside
  2125 + {
  2126 + writer.startElement("intervals");
  2127 + writer.addAttribute("name", inputTTOrCat._name.c_str());
  2128 + writer.addAttribute("id", std::to_string(it->_index).c_str());
  2129 + writer.addAttribute("startTime", std::to_string(currentTimeInterval->_startTime).c_str());
  2130 + writer.addAttribute("stopTime", std::to_string(it->_stopTime).c_str());
  2131 + writer.endElement();
  2132 + }
  2133 + else if (it->_startTime >= currentTimeInterval->_startTime && it->_startTime <= currentTimeInterval->_stopTime && it->_stopTime >= currentTimeInterval->_stopTime) // begins inside, ends after
  2134 + {
  2135 + writer.startElement("intervals");
  2136 + writer.addAttribute("name", inputTTOrCat._name.c_str());
  2137 + writer.addAttribute("id", std::to_string(it->_index).c_str());
  2138 + writer.addAttribute("startTime", std::to_string(it->_startTime).c_str());
  2139 + writer.addAttribute("stopTime", std::to_string(currentTimeInterval->_stopTime).c_str());
  2140 + writer.endElement();
  2141 + }
  2142 + }
  2143 + }
  2144 + }
2095 2145 }
2096 2146  
2097 2147  
... ...
src/ParamOutputImpl/Plot/PanelPlotOutput.hh
... ... @@ -108,7 +108,7 @@ public:
108 108 /**
109 109 * @brief Write plot context
110 110 */
111   - void writeContext(ContextFileWriter& writer);
  111 + void writeContext(ContextFileWriter &writer, AMDA::Parameters::TimeIntervalList::iterator currentTimeInterval);
112 112  
113 113 /*
114 114 * @brief Set a pointer to the time intervals list
... ...
src/ParamOutputImpl/Plot/PlotOutput.cc
... ... @@ -242,7 +242,7 @@ void PlotOutput::drawOneIntervalByPage()
242 242 }
243 243 //write plot context
244 244 if (_writeContextFile)
245   - plot->writeContext(_contextWriter);
  245 + plot->writeContext(_contextWriter, _currentTimeInterval);
246 246 //prepare for the next time interval
247 247 plot->resetPlot();
248 248 }
... ... @@ -347,7 +347,7 @@ void PlotOutput::drawAllIntervalsInOnePage()
347 347 dataPloted[plotIndex] = dataPlotedForInt;
348 348 if (_writeContextFile && (_currentTimeInterval == _timeIntervalList->begin()))
349 349 //write plot context
350   - plot->writeContext(_contextWriter);
  350 + plot->writeContext(_contextWriter, _currentTimeInterval);
351 351 ++plotIndex;
352 352 }
353 353  
... ...