From 3b531e567cc26fc76a3b9e6a02db5b5b33a0ab6c Mon Sep 17 00:00:00 2001 From: Furkan Erdogan Date: Tue, 2 Aug 2022 09:36:49 +0000 Subject: [PATCH] Second Kernel modifcations - there will be changes --- src/ParamOutputImpl/Plot/PanelPlotOutput.cc | 72 +++++++++++++++++++++++++++++++++++++++++++++--------------------------- src/ParamOutputImpl/Plot/PanelPlotOutput.hh | 7 ------- 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/src/ParamOutputImpl/Plot/PanelPlotOutput.cc b/src/ParamOutputImpl/Plot/PanelPlotOutput.cc index 209de91..bf226bc 100644 --- a/src/ParamOutputImpl/Plot/PanelPlotOutput.cc +++ b/src/ParamOutputImpl/Plot/PanelPlotOutput.cc @@ -2071,29 +2071,6 @@ void PanelPlotOutput::drawCurvePlot(CurvePlot &/*curvePlot*/) { } /** - * @brief write TT/Cat info in context file - * @author Furkan, AKKA - */ - -void TTCatContextWriter(ContextFileWriter &writer, std::string name, int index, int startTime, int stopTime, std::map> &data) -{ - writer.startElement("intervals"); - writer.addAttribute("name", name.c_str()); - writer.addAttribute("id", std::to_string(index).c_str()); - writer.addAttribute("startTime", std::to_string(startTime).c_str()); - writer.addAttribute("stopTime", std::to_string(stopTime).c_str()); - if (data.size() > 0) - { - writer.startElement("parameter"); - for (auto i : data) - { - writer.addAttribute(i.first.c_str(), i.second[0].c_str()); - } - writer.endElement(); - } - writer.endElement(); -} -/** * @brief Write plot context */ void PanelPlotOutput::writeContext(ContextFileWriter &writer, AMDA::Parameters::TimeIntervalList::iterator currentTimeInterval) @@ -2134,14 +2111,55 @@ void PanelPlotOutput::writeContext(ContextFileWriter &writer, AMDA::Parameters:: inputTTOrCat.read(ttOrCatPath, lReaderType); for (std::vector::const_iterator it = inputTTOrCat.getIntervals().begin(); it != inputTTOrCat.getIntervals().end(); ++it) { - std::map> data = it->getAllParameterData(); + std::map> data; + bool needTTWriter = false; + bool needCatWriter = false; + std::string startTime = std::to_string(it->_startTime); + std::string stopTime = std::to_string(it->_stopTime); if (it->_startTime >= currentTimeInterval->_startTime && it->_stopTime <= currentTimeInterval->_stopTime) // inside the interval - TTCatContextWriter(writer, inputTTOrCat._name, it->_index, it->_startTime, it->_stopTime, data); + { + needTTWriter = true; + data = it->getAllParameterData(); + if (data.size() > 0) + needCatWriter = true; + } else if (it->_startTime <= currentTimeInterval->_startTime && it->_stopTime <= currentTimeInterval->_stopTime && it->_stopTime >= currentTimeInterval->_startTime) // begins before, ends inside - TTCatContextWriter(writer, inputTTOrCat._name, it->_index, currentTimeInterval->_startTime, it->_stopTime, data); + { + needTTWriter = true; + startTime = std::to_string(currentTimeInterval->_startTime); + data = it->getAllParameterData(); + if (data.size() > 0) + needCatWriter = true; + } else if (it->_startTime >= currentTimeInterval->_startTime && it->_startTime <= currentTimeInterval->_stopTime && it->_stopTime >= currentTimeInterval->_stopTime) // begins inside, ends after - TTCatContextWriter(writer, inputTTOrCat._name, it->_index, it->_startTime, currentTimeInterval->_stopTime, data); + { + needTTWriter = true; + stopTime = std::to_string(currentTimeInterval->_stopTime); + data = it->getAllParameterData(); + if (data.size() > 0) + needCatWriter = true; + } + + if (needTTWriter) + { + writer.startElement("intervals"); + writer.addAttribute("name", inputTTOrCat._name.c_str()); + writer.addAttribute("id", std::to_string(it->_index).c_str()); + writer.addAttribute("startTime", std::to_string(it->_startTime).c_str()); + writer.addAttribute("stopTime", std::to_string(it->_stopTime).c_str()); + } + + if (needCatWriter) + { + writer.startElement("parameter"); + for (auto i : data) + { + writer.addAttribute(i.first.c_str(), i.second[0].c_str()); + } + writer.endElement(); + } + writer.endElement(); } } } diff --git a/src/ParamOutputImpl/Plot/PanelPlotOutput.hh b/src/ParamOutputImpl/Plot/PanelPlotOutput.hh index d519cb4..3792343 100644 --- a/src/ParamOutputImpl/Plot/PanelPlotOutput.hh +++ b/src/ParamOutputImpl/Plot/PanelPlotOutput.hh @@ -110,13 +110,6 @@ public: */ void writeContext(ContextFileWriter &writer, AMDA::Parameters::TimeIntervalList::iterator currentTimeInterval); - /** - * @brief write TT/Cat info in context file - * @author Furkan, AKKA - */ - - void TTCatContextWriter(ContextFileWriter &writer, std::string name, int index, int startTime, int stopTime, std::map> &data); - /* * @brief Set a pointer to the time intervals list */ -- libgit2 0.21.2