From b0ccd57b16b5e4bba2359cdaf432c82ce44f5f2c Mon Sep 17 00:00:00 2001 From: Erdogan Furkan Date: Wed, 3 Aug 2022 12:29:43 +0000 Subject: [PATCH] #10098 - small changes --- src/ParamOutputImpl/Plot/PanelPlotOutput.cc | 63 +++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/src/ParamOutputImpl/Plot/PanelPlotOutput.cc b/src/ParamOutputImpl/Plot/PanelPlotOutput.cc index bf226bc..3487e3d 100644 --- a/src/ParamOutputImpl/Plot/PanelPlotOutput.cc +++ b/src/ParamOutputImpl/Plot/PanelPlotOutput.cc @@ -2111,34 +2111,46 @@ 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) { + double acceptedRatio = 0.005; // if the interval is too small, no more info given + double timeRatio = (currentTimeInterval->_stopTime - currentTimeInterval->_startTime) / _plotAreaBounds._width; + 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); + double startTime = it->_startTime; + double stopTime = it->_stopTime; if (it->_startTime >= currentTimeInterval->_startTime && it->_stopTime <= currentTimeInterval->_stopTime) // inside the interval { - needTTWriter = true; - data = it->getAllParameterData(); - if (data.size() > 0) - needCatWriter = true; + if (timeRatio * acceptedRatio < (stopTime - startTime) / _plotAreaBounds._width) + { + 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 { - needTTWriter = true; - startTime = std::to_string(currentTimeInterval->_startTime); - data = it->getAllParameterData(); - if (data.size() > 0) - needCatWriter = true; + startTime = currentTimeInterval->_startTime; + if (timeRatio * acceptedRatio < (stopTime - startTime) / _plotAreaBounds._width) + { + needTTWriter = true; + 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 { - needTTWriter = true; - stopTime = std::to_string(currentTimeInterval->_stopTime); - data = it->getAllParameterData(); - if (data.size() > 0) - needCatWriter = true; + stopTime = currentTimeInterval->_stopTime; + if (timeRatio * acceptedRatio < (stopTime - startTime) / _plotAreaBounds._width) + { + needTTWriter = true; + data = it->getAllParameterData(); + if (data.size() > 0) + needCatWriter = true; + } } if (needTTWriter) @@ -2146,20 +2158,19 @@ void PanelPlotOutput::writeContext(ContextFileWriter &writer, AMDA::Parameters:: 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("startTime", std::to_string(startTime).c_str()); + writer.addAttribute("stopTime", std::to_string(stopTime).c_str()); + if (needCatWriter) { - writer.addAttribute(i.first.c_str(), i.second[0].c_str()); + std::string allParams; + for (auto i : data) + { + allParams += i.second[0] + "|"; + } + writer.addAttribute("params", allParams.c_str()); } writer.endElement(); } - writer.endElement(); } } } -- libgit2 0.21.2