Commit e1c12b22cce7ecc367f86b1f12aa3e86ee81156d
Exists in
amdadev
and in
1 other branch
Merge branch 'FER_11500' into amdadev
Showing
4 changed files
with
157 additions
and
101 deletions
Show diff stats
config/xsd/request/plot.xsd
... | ... | @@ -1016,6 +1016,7 @@ |
1016 | 1016 | <xs:element name="textLegend" type="TextLegendType" minOccurs="0" maxOccurs="1"/> |
1017 | 1017 | </xs:sequence> |
1018 | 1018 | <xs:attribute name="color" type="xs:string" use="optional"></xs:attribute> |
1019 | + <xs:attribute name="columnId" type="xs:string" use="optional"></xs:attribute> | |
1019 | 1020 | <xs:attribute name="index" type="xs:string" use="optional"></xs:attribute> |
1020 | 1021 | </xs:complexType> |
1021 | 1022 | ... | ... |
src/ParamOutputImpl/Plot/IntervalsNode.hh
... | ... | @@ -77,6 +77,28 @@ public: |
77 | 77 | xmlFree(value); |
78 | 78 | } |
79 | 79 | intervalsPropsPtr->setColor(color); |
80 | + | |
81 | + | |
82 | + // -- columnId | |
83 | + | |
84 | + value = xmlGetProp(pNode_, (const xmlChar *)"columnId"); | |
85 | + std::string columnIdStr; | |
86 | + if (value) | |
87 | + { | |
88 | + try | |
89 | + { | |
90 | + std::string strValue((const char *)value); | |
91 | + columnIdStr = strValue; | |
92 | + } | |
93 | + catch (std::logic_error &e) | |
94 | + { | |
95 | + LOG4CXX_WARN(gLogger, "Intervals Color : " << e.what()); | |
96 | + } | |
97 | + xmlFree(value); | |
98 | + } | |
99 | + intervalsPropsPtr->setColumnId(columnIdStr); | |
100 | + | |
101 | + | |
80 | 102 | // add intervals definition to parameter |
81 | 103 | plotOutput->getParameter((const char*)name).addIntervalsProperties(intervalsPropsPtr); |
82 | 104 | ... | ... |
src/ParamOutputImpl/Plot/IntervalsProperties.hh
... | ... | @@ -31,16 +31,16 @@ namespace plot { |
31 | 31 | */ |
32 | 32 | void dump(std::ostream &out_, std::string &prefix_); |
33 | 33 | |
34 | - IntervalsProperties() : DrawingProperties(), _paramId(""), _indexDef("") | |
34 | + IntervalsProperties() : DrawingProperties(), _paramId(""), _indexDef(""), _columnId("") | |
35 | 35 | { |
36 | 36 | } |
37 | 37 | |
38 | - IntervalsProperties(const DrawingProperties &ref_) : DrawingProperties(ref_), _paramId(""), _indexDef("") | |
38 | + IntervalsProperties(const DrawingProperties &ref_) : DrawingProperties(ref_), _paramId(""), _indexDef(""), _columnId("") | |
39 | 39 | { |
40 | 40 | } |
41 | 41 | |
42 | 42 | IntervalsProperties(const IntervalsProperties &pParamDrawingProperties_) : DrawingProperties(pParamDrawingProperties_), _paramId(""), |
43 | - _indexDef(pParamDrawingProperties_._indexDef) | |
43 | + _indexDef(pParamDrawingProperties_._indexDef), _columnId("") | |
44 | 44 | { |
45 | 45 | } |
46 | 46 | |
... | ... | @@ -49,6 +49,7 @@ namespace plot { |
49 | 49 | DrawingProperties::operator=(ref_); |
50 | 50 | _paramId = ref_._paramId; |
51 | 51 | _indexDef = ref_._indexDef; |
52 | + _columnId = ref_._columnId; | |
52 | 53 | return *this; |
53 | 54 | } |
54 | 55 | |
... | ... | @@ -96,6 +97,16 @@ namespace plot { |
96 | 97 | _indexList = indexList; |
97 | 98 | } |
98 | 99 | |
100 | + std::string getColumnId() | |
101 | + { | |
102 | + return _columnId; | |
103 | + } | |
104 | + | |
105 | + void setColumnId(std::string columnId_) | |
106 | + { | |
107 | + _columnId = columnId_; | |
108 | + } | |
109 | + | |
99 | 110 | private: |
100 | 111 | /** |
101 | 112 | * @brief Calculated paramId (from resolution). |
... | ... | @@ -107,6 +118,12 @@ namespace plot { |
107 | 118 | */ |
108 | 119 | std::string _indexDef; |
109 | 120 | |
121 | + /** | |
122 | + * @brief ID of the column to return info in context file . | |
123 | + */ | |
124 | + std::string _columnId; | |
125 | + | |
126 | + | |
110 | 127 | boost::shared_ptr<TextLegendProperties> _legend; |
111 | 128 | |
112 | 129 | /* | ... | ... |
src/ParamOutputImpl/Plot/PanelPlotOutput.cc
... | ... | @@ -2325,63 +2325,58 @@ namespace plot |
2325 | 2325 | if (!isStandalone()) |
2326 | 2326 | return; |
2327 | 2327 | |
2328 | - writer.startElement("panel"); | |
2328 | + writer.startElement("panel"); // OPENNODE panel | |
2329 | 2329 | _panel->writeContext(_pls, writer); |
2330 | 2330 | |
2331 | - writer.startElement("parameters"); | |
2332 | - | |
2333 | - for (ParameterAxesList::iterator it = _parameterAxesList.begin(); | |
2334 | - it != _parameterAxesList.end(); ++it) | |
2335 | - { | |
2336 | - AMDA::Parameters::ParameterSPtr originalParam = | |
2337 | - _parameterManager.getParameter(it->_originalParamId); | |
2338 | - | |
2339 | - // Retrieve ParamInfo Manager | |
2340 | - ParamMgr *piMgr = ParamMgr::getInstance(); | |
2341 | - ParamInfoSPtr paramInfo = piMgr->getParamInfoFromId(originalParam->getInfoId()); | |
2342 | - std::string name = ""; | |
2343 | - std::string shortname = ""; | |
2344 | - std::string unit = ""; | |
2345 | - if (paramInfo != nullptr) { | |
2346 | - name = paramInfo->getName(); | |
2347 | - shortname = paramInfo->getShortName(); | |
2348 | - unit = paramInfo->getUnits(); | |
2349 | - } | |
2350 | - | |
2351 | - double resol = originalParam->getDataWriterTemplate()->getMinSampling(); | |
2352 | - std::string resolstr = std::to_string(resol); | |
2353 | - writer.startElement("parameter"); | |
2354 | - writer.addAttribute("id", originalParam->getId().c_str()); | |
2355 | - writer.addAttribute("name", name.c_str()); | |
2356 | - writer.addAttribute("shortname", shortname.c_str()); | |
2357 | - writer.addAttribute("MinSampling", resolstr.c_str()); | |
2358 | - writer.addAttribute("unit", unit.c_str()); | |
2359 | - writer.endElement(); | |
2360 | - } | |
2361 | - writer.endElement(); | |
2362 | - | |
2363 | - if (!_parameterAxesList.empty()) | |
2331 | + if (!_parameterAxesList.empty()) | |
2364 | 2332 | { |
2365 | - bool hasSpectro = false; | |
2333 | + bool hasSpectro = false; | |
2366 | 2334 | bool hasSauvaud = false; |
2367 | - for (auto parameter : _parameterAxesList) | |
2368 | - { | |
2369 | - if (parameter.getSpectroProperties() != nullptr) | |
2335 | + | |
2336 | + writer.startElement("parameters"); // OPENNODE parameters | |
2337 | + | |
2338 | + | |
2339 | + for (ParameterAxesList::iterator it = _parameterAxesList.begin(); | |
2340 | + it != _parameterAxesList.end(); ++it) | |
2341 | + { | |
2342 | + AMDA::Parameters::ParameterSPtr originalParam = | |
2343 | + _parameterManager.getParameter(it->_originalParamId); | |
2344 | + | |
2345 | + // Retrieve ParamInfo Manager | |
2346 | + ParamMgr *piMgr = ParamMgr::getInstance(); | |
2347 | + ParamInfoSPtr paramInfo = piMgr->getParamInfoFromId(originalParam->getInfoId()); | |
2348 | + std::string name = ""; | |
2349 | + std::string shortname = ""; | |
2350 | + std::string unit = ""; | |
2351 | + if (paramInfo != nullptr) { | |
2352 | + name = paramInfo->getName(); | |
2353 | + shortname = paramInfo->getShortName(); | |
2354 | + unit = paramInfo->getUnits(); | |
2355 | + } | |
2356 | + | |
2357 | + double resol = originalParam->getDataWriterTemplate()->getMinSampling(); | |
2358 | + std::string resolstr = std::to_string(resol); | |
2359 | + writer.startElement("parameter"); // OPENNODE parameter | |
2360 | + writer.addAttribute("id", originalParam->getId().c_str()); | |
2361 | + writer.addAttribute("name", name.c_str()); | |
2362 | + writer.addAttribute("shortname", shortname.c_str()); | |
2363 | + writer.addAttribute("MinSampling", resolstr.c_str()); | |
2364 | + writer.addAttribute("unit", unit.c_str()); | |
2365 | + | |
2366 | + if (it->getSpectroProperties() != nullptr) | |
2370 | 2367 | { |
2371 | 2368 | hasSpectro = true; |
2372 | - break; | |
2373 | 2369 | } |
2374 | - if (parameter.getSauvaudProperties() != nullptr) | |
2370 | + if (it->getSauvaudProperties() != nullptr) | |
2375 | 2371 | { |
2376 | 2372 | hasSauvaud = true; |
2377 | - break; | |
2378 | 2373 | } |
2379 | - if (parameter.getIntervalsProperties() != nullptr) | |
2374 | + | |
2375 | + if (it->getIntervalsProperties() != nullptr) | |
2380 | 2376 | { |
2381 | - ParameterSPtr p = _parameterManager.getParameter(parameter._originalParamId); | |
2382 | - AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(p->getInfoId()); | |
2383 | 2377 | std::map<std::string, std::string> inputAdditionals = paramInfo->getAdditionInfo(); |
2384 | 2378 | std::string ttOrCatPath = inputAdditionals["TTCatToParamPath"]; |
2379 | + std::string intervalColumnId = it->getIntervalsProperties()->getColumnId(); | |
2385 | 2380 | |
2386 | 2381 | // Load TT or Catalog |
2387 | 2382 | std::string lReaderType = TimeTableCatalog::TimeTableCatalogFactory::getInstance().getReaderType(ttOrCatPath); |
... | ... | @@ -2389,74 +2384,95 @@ namespace plot |
2389 | 2384 | { |
2390 | 2385 | TimeTableCatalog::Catalog inputTTOrCat; |
2391 | 2386 | inputTTOrCat.read(ttOrCatPath, lReaderType); |
2392 | - for (std::vector<TimeTableCatalog::TimeInterval>::const_iterator it = inputTTOrCat.getIntervals().begin(); it != inputTTOrCat.getIntervals().end(); ++it) | |
2387 | + bool isCatalog = !inputTTOrCat.getParameterDescriptions().empty(); | |
2388 | + if (isCatalog) { | |
2389 | + writer.startElement("catalog"); // OPENNODE catalog | |
2390 | + } | |
2391 | + else { | |
2392 | + writer.startElement("timetable"); // OPENNODE catalog | |
2393 | + } | |
2394 | + writer.addAttribute("name", inputTTOrCat._name.c_str()); | |
2395 | + writer.addAttribute("columnToShow", intervalColumnId.c_str()); | |
2396 | + if (!inputTTOrCat.getParameterDescriptions().empty()) { | |
2397 | + writer.startElement("columns"); // OPENNODE columns | |
2398 | + for (auto &desc : inputTTOrCat.getParameterDescriptions()) { | |
2399 | + writer.startElement("column"); // OPENNODE column | |
2400 | + writer.addAttribute("id", desc.getId().c_str()); | |
2401 | + writer.addAttribute("name", desc.getName().c_str()); | |
2402 | + writer.addAttribute("size", desc.getSize().c_str()); | |
2403 | + writer.addAttribute("unit", desc.getUnit().c_str()); | |
2404 | + writer.addAttribute("description", desc.getDescription().c_str()); | |
2405 | + writer.addAttribute("ucd", desc.getUcd().c_str()); | |
2406 | + writer.addAttribute("utype", desc.getUtype().c_str()); | |
2407 | + writer.endElement(); // CLOSENODE column | |
2408 | + } | |
2409 | + writer.endElement(); // CLOSENODE columns | |
2410 | + } | |
2411 | + | |
2412 | + writer.startElement("intervals"); // OPENNODE intervals | |
2413 | + for (std::vector<TimeTableCatalog::TimeInterval>::const_iterator it2 = inputTTOrCat.getIntervals().begin(); it2 != inputTTOrCat.getIntervals().end(); ++it2) | |
2393 | 2414 | { |
2394 | 2415 | double acceptedRatio = 0.005; // if the interval is too small, no more info given |
2395 | 2416 | double timeRatio = (currentTimeInterval->_stopTime - currentTimeInterval->_startTime) / _plotAreaBounds._width; |
2396 | 2417 | |
2397 | 2418 | std::map<std::string, std::vector<std::string>> data; |
2398 | - bool needTTWriter = false; | |
2399 | - bool needCatWriter = false; | |
2400 | - double startTime = it->_startTime; | |
2401 | - double stopTime = it->_stopTime; | |
2402 | - | |
2403 | - if (it->_startTime >= currentTimeInterval->_startTime && it->_stopTime <= currentTimeInterval->_stopTime) // inside the interval | |
2419 | + | |
2420 | + double startTime = it2->_startTime; | |
2421 | + double stopTime = it2->_stopTime; | |
2422 | + if ((startTime < currentTimeInterval->_startTime && stopTime < currentTimeInterval->_startTime) || | |
2423 | + (startTime > currentTimeInterval->_stopTime && stopTime > currentTimeInterval->_stopTime)) { | |
2424 | + //outside the request interval | |
2425 | + continue; | |
2426 | + } | |
2427 | + else if (it2->_startTime < currentTimeInterval->_startTime) { | |
2428 | + //partially inside the request interval | |
2429 | + startTime = currentTimeInterval->_startTime; | |
2430 | + } | |
2431 | + else if (it2->_stopTime > currentTimeInterval->_stopTime) { | |
2432 | + //partially inside the request interval | |
2433 | + stopTime = currentTimeInterval->_stopTime; | |
2434 | + } | |
2435 | + | |
2436 | + if (timeRatio * acceptedRatio < (stopTime - startTime) / _plotAreaBounds._width) | |
2404 | 2437 | { |
2405 | - if (timeRatio * acceptedRatio < (stopTime - startTime) / _plotAreaBounds._width) | |
2406 | - { | |
2407 | - needTTWriter = true; | |
2408 | - data = it->getAllParameterData(); | |
2409 | - if (data.size() > 0) | |
2410 | - needCatWriter = true; | |
2411 | - } | |
2412 | - } | |
2413 | - else if (it->_startTime <= currentTimeInterval->_startTime && it->_stopTime <= currentTimeInterval->_stopTime && it->_stopTime >= currentTimeInterval->_startTime) // begins before, ends inside | |
2414 | - { | |
2415 | - startTime = currentTimeInterval->_startTime; | |
2416 | - if (timeRatio * acceptedRatio < (stopTime - startTime) / _plotAreaBounds._width) | |
2417 | - { | |
2418 | - needTTWriter = true; | |
2419 | - data = it->getAllParameterData(); | |
2420 | - if (data.size() > 0) | |
2421 | - needCatWriter = true; | |
2422 | - } | |
2423 | - } | |
2424 | - else if (it->_startTime >= currentTimeInterval->_startTime && it->_startTime <= currentTimeInterval->_stopTime && it->_stopTime >= currentTimeInterval->_stopTime) // begins inside, ends after | |
2425 | - { | |
2426 | - stopTime = currentTimeInterval->_stopTime; | |
2427 | - if (timeRatio * acceptedRatio < (stopTime - startTime) / _plotAreaBounds._width) | |
2428 | - { | |
2429 | - needTTWriter = true; | |
2430 | - data = it->getAllParameterData(); | |
2431 | - if (data.size() > 0) | |
2432 | - needCatWriter = true; | |
2433 | - } | |
2434 | - } | |
2438 | + writer.startElement("interval"); // OPENNODE interval | |
2435 | 2439 | |
2436 | - if (needTTWriter) | |
2437 | - { | |
2438 | - writer.startElement("intervals"); | |
2439 | - writer.addAttribute("name", inputTTOrCat._name.c_str()); | |
2440 | - writer.addAttribute("id", std::to_string(it->_index + 1).c_str()); | |
2441 | - writer.addAttribute("startTime", std::to_string(startTime).c_str()); | |
2442 | - writer.addAttribute("stopTime", std::to_string(stopTime).c_str()); | |
2443 | - if (needCatWriter) | |
2440 | + writer.addAttribute("id", std::to_string(it2->_index + 1).c_str()); | |
2441 | + writer.addAttribute("startTime", std::to_string(it2->_startTime).c_str()); | |
2442 | + writer.addAttribute("stopTime", std::to_string(it2->_stopTime).c_str()); | |
2443 | + if (isCatalog) | |
2444 | 2444 | { |
2445 | - std::string allParams; | |
2446 | - for (auto i : data) | |
2445 | + for (auto i : it2->getAllParameterData()) | |
2447 | 2446 | { |
2448 | - allParams += i.second[0] + "|"; | |
2447 | + writer.startElement("param"); // OPENNODE column | |
2448 | + writer.addAttribute("id", i.first.c_str()); | |
2449 | + std::string val; | |
2450 | + for (auto v : i.second) { | |
2451 | + if (!val.empty()) { | |
2452 | + val += ", "; | |
2453 | + } | |
2454 | + val += v.c_str(); | |
2455 | + } | |
2456 | + writer.addAttribute("val", val.c_str()); | |
2457 | + writer.endElement(); // CLOSENODE column | |
2449 | 2458 | } |
2450 | - writer.addAttribute("params", allParams.c_str()); | |
2451 | 2459 | } |
2452 | - writer.endElement(); | |
2460 | + writer.endElement(); // CLOSENODE interval | |
2453 | 2461 | } |
2454 | 2462 | } |
2463 | + writer.endElement(); // CLOSENODE intervals | |
2464 | + | |
2465 | + writer.endElement(); // CLOSENODE catalog or timetable | |
2455 | 2466 | } |
2456 | 2467 | } |
2457 | - } | |
2458 | 2468 | |
2459 | - writer.startElement("plotArea"); | |
2469 | + | |
2470 | + writer.endElement(); // CLOSENODE parameter | |
2471 | + } | |
2472 | + writer.endElement(); // CLOSENODE parameters | |
2473 | + | |
2474 | + | |
2475 | + writer.startElement("plotArea"); // OPEN plotArea NODE | |
2460 | 2476 | if (_panel->_page->_orientation == PlotCommon::Orientation::PORTRAIT) |
2461 | 2477 | { |
2462 | 2478 | writer.addAttribute("x", std::to_string(_plotAreaBounds._y * std::get<0>(_panel->_page->getSize())).c_str()); |
... | ... | @@ -2494,10 +2510,10 @@ namespace plot |
2494 | 2510 | } |
2495 | 2511 | } |
2496 | 2512 | |
2497 | - writer.endElement(); | |
2513 | + writer.endElement(); // CLOSENODE plotArea | |
2498 | 2514 | } |
2499 | 2515 | |
2500 | - writer.endElement(); | |
2516 | + writer.endElement(); // CLOSENODE panel | |
2501 | 2517 | } |
2502 | 2518 | |
2503 | 2519 | /** | ... | ... |