Commit b0ccd57b16b5e4bba2359cdaf432c82ce44f5f2c
1 parent
3b531e56
Exists in
master
and in
46 other branches
#10098 - small changes
Showing
1 changed file
with
37 additions
and
26 deletions
Show diff stats
src/ParamOutputImpl/Plot/PanelPlotOutput.cc
... | ... | @@ -2111,34 +2111,46 @@ void PanelPlotOutput::writeContext(ContextFileWriter &writer, AMDA::Parameters:: |
2111 | 2111 | inputTTOrCat.read(ttOrCatPath, lReaderType); |
2112 | 2112 | for (std::vector<TimeTableCatalog::TimeInterval>::const_iterator it = inputTTOrCat.getIntervals().begin(); it != inputTTOrCat.getIntervals().end(); ++it) |
2113 | 2113 | { |
2114 | + double acceptedRatio = 0.005; // if the interval is too small, no more info given | |
2115 | + double timeRatio = (currentTimeInterval->_stopTime - currentTimeInterval->_startTime) / _plotAreaBounds._width; | |
2116 | + | |
2114 | 2117 | std::map<std::string, std::vector<std::string>> data; |
2115 | 2118 | bool needTTWriter = false; |
2116 | 2119 | bool needCatWriter = false; |
2117 | - std::string startTime = std::to_string(it->_startTime); | |
2118 | - std::string stopTime = std::to_string(it->_stopTime); | |
2120 | + double startTime = it->_startTime; | |
2121 | + double stopTime = it->_stopTime; | |
2119 | 2122 | |
2120 | 2123 | if (it->_startTime >= currentTimeInterval->_startTime && it->_stopTime <= currentTimeInterval->_stopTime) // inside the interval |
2121 | 2124 | { |
2122 | - needTTWriter = true; | |
2123 | - data = it->getAllParameterData(); | |
2124 | - if (data.size() > 0) | |
2125 | - needCatWriter = true; | |
2125 | + if (timeRatio * acceptedRatio < (stopTime - startTime) / _plotAreaBounds._width) | |
2126 | + { | |
2127 | + needTTWriter = true; | |
2128 | + data = it->getAllParameterData(); | |
2129 | + if (data.size() > 0) | |
2130 | + needCatWriter = true; | |
2131 | + } | |
2126 | 2132 | } |
2127 | 2133 | else if (it->_startTime <= currentTimeInterval->_startTime && it->_stopTime <= currentTimeInterval->_stopTime && it->_stopTime >= currentTimeInterval->_startTime) // begins before, ends inside |
2128 | 2134 | { |
2129 | - needTTWriter = true; | |
2130 | - startTime = std::to_string(currentTimeInterval->_startTime); | |
2131 | - data = it->getAllParameterData(); | |
2132 | - if (data.size() > 0) | |
2133 | - needCatWriter = true; | |
2135 | + startTime = currentTimeInterval->_startTime; | |
2136 | + if (timeRatio * acceptedRatio < (stopTime - startTime) / _plotAreaBounds._width) | |
2137 | + { | |
2138 | + needTTWriter = true; | |
2139 | + data = it->getAllParameterData(); | |
2140 | + if (data.size() > 0) | |
2141 | + needCatWriter = true; | |
2142 | + } | |
2134 | 2143 | } |
2135 | 2144 | else if (it->_startTime >= currentTimeInterval->_startTime && it->_startTime <= currentTimeInterval->_stopTime && it->_stopTime >= currentTimeInterval->_stopTime) // begins inside, ends after |
2136 | 2145 | { |
2137 | - needTTWriter = true; | |
2138 | - stopTime = std::to_string(currentTimeInterval->_stopTime); | |
2139 | - data = it->getAllParameterData(); | |
2140 | - if (data.size() > 0) | |
2141 | - needCatWriter = true; | |
2146 | + stopTime = currentTimeInterval->_stopTime; | |
2147 | + if (timeRatio * acceptedRatio < (stopTime - startTime) / _plotAreaBounds._width) | |
2148 | + { | |
2149 | + needTTWriter = true; | |
2150 | + data = it->getAllParameterData(); | |
2151 | + if (data.size() > 0) | |
2152 | + needCatWriter = true; | |
2153 | + } | |
2142 | 2154 | } |
2143 | 2155 | |
2144 | 2156 | if (needTTWriter) |
... | ... | @@ -2146,20 +2158,19 @@ void PanelPlotOutput::writeContext(ContextFileWriter &writer, AMDA::Parameters:: |
2146 | 2158 | writer.startElement("intervals"); |
2147 | 2159 | writer.addAttribute("name", inputTTOrCat._name.c_str()); |
2148 | 2160 | writer.addAttribute("id", std::to_string(it->_index).c_str()); |
2149 | - writer.addAttribute("startTime", std::to_string(it->_startTime).c_str()); | |
2150 | - writer.addAttribute("stopTime", std::to_string(it->_stopTime).c_str()); | |
2151 | - } | |
2152 | - | |
2153 | - if (needCatWriter) | |
2154 | - { | |
2155 | - writer.startElement("parameter"); | |
2156 | - for (auto i : data) | |
2161 | + writer.addAttribute("startTime", std::to_string(startTime).c_str()); | |
2162 | + writer.addAttribute("stopTime", std::to_string(stopTime).c_str()); | |
2163 | + if (needCatWriter) | |
2157 | 2164 | { |
2158 | - writer.addAttribute(i.first.c_str(), i.second[0].c_str()); | |
2165 | + std::string allParams; | |
2166 | + for (auto i : data) | |
2167 | + { | |
2168 | + allParams += i.second[0] + "|"; | |
2169 | + } | |
2170 | + writer.addAttribute("params", allParams.c_str()); | |
2159 | 2171 | } |
2160 | 2172 | writer.endElement(); |
2161 | 2173 | } |
2162 | - writer.endElement(); | |
2163 | 2174 | } |
2164 | 2175 | } |
2165 | 2176 | } | ... | ... |