Commit 46858100de6f31fbd111f82a883cad1b55f2bd0c

Authored by Benjamin Renard
1 parent 505546bc

Tickplot: Add mission name and frame

src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.cc
... ... @@ -56,7 +56,6 @@ TickMarkDecorator& TickMarkDecorator::operator=(const TickMarkDecorator& ref_) {
56 56 } else {
57 57 _pTimeInfo->_timeFormat = ref_._pTimeInfo->_timeFormat;
58 58 _pTimeInfo->_timeTitle = ref_._pTimeInfo->_timeTitle;
59   - _pTimeInfo->_isFirstLabel = ref_._pTimeInfo->_isFirstLabel;
60 59 _pTimeInfo->_maxLen = ref_._pTimeInfo->_maxLen;
61 60 }
62 61 _seriesInfoList = ref_._seriesInfoList;
... ... @@ -281,6 +280,12 @@ void TickMarkDecorator::draw(PanelPlotOutput* pplot_, Axis* axis_,
281 280 LOG4CXX_TRACE(_logger, " virtual axis ["<<i<<"]");
282 281 // install label generator specific for that virtual axis
283 282 pls_->slabelfunc(generateYLabel, _seriesInfoList[i].get());
  283 + if (!_seriesInfoList[i]->_description.empty()) {
  284 + // draw additionnal description
  285 + drawVirtualAxis(yDelta * dir, yInc, _seriesInfoList[i]->_description.c_str(), 0, 0, "", pls_);
  286 + // increment offset
  287 + yDelta = yDelta + yInc;
  288 + }
284 289 // draw virtual axis
285 290 drawVirtualAxis(yDelta * dir, yInc, _seriesInfoList[i]->_name.c_str(), xtick, nxsub, options.c_str(), pls_);
286 291 // increment offset
... ... @@ -327,7 +332,6 @@ void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeA
327 332 // install time format
328 333 _pTimeInfo->_timeFormat = getPlFormat();
329 334 _pTimeInfo->_timeTitle = timeAxis_->_legend.getText();
330   - _pTimeInfo->_isFirstLabel = true;
331 335  
332 336 unsigned int maxNameLen = _pTimeInfo->_timeTitle.size();
333 337 // init maximum value len with formatted time :
... ... @@ -348,19 +352,18 @@ void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeA
348 352 const std::string name = p._originalParamId;
349 353 LOG4CXX_DEBUG(_logger, " inspecting parameter : " << name);
350 354 for(auto lSeriesProperties : p.getYSeriePropertiesList()) {
  355 + bool isFirstIndex = true;
351 356 for (auto index : lSeriesProperties.getIndexList(_pParameterValues)) {
352 357 boost::shared_ptr<SeriesInfo> pSerie =
353 358 boost::shared_ptr<SeriesInfo>(new SeriesInfo());
354 359  
  360 + AMDA::Parameters::ParameterSPtr param = _decoratorPlot->_parameterManager.getParameter(lSeriesProperties.getParamId());
355 361 AMDA::Info::ParamMgr* piMgr = AMDA::Info::ParamMgr::getInstance();
356   - AMDA::Info::ParamInfoSPtr paramInfo = piMgr->getParamInfoFromId(lSeriesProperties.getParamId());
  362 + AMDA::Info::ParamInfoSPtr paramInfo = piMgr->getParamInfoFromId(param->getInfoId());
357 363  
358 364 std::ostringstream osstr;
359 365 bool skipIndex = false;
360   - if (paramInfo == nullptr) {
361   - osstr << name;
362   - }
363   - else {
  366 + if (paramInfo != nullptr) {
364 367 if (paramInfo->getComponents(index).empty() == false) {
365 368 osstr << paramInfo->getComponents(index);
366 369 skipIndex = true;
... ... @@ -370,6 +373,10 @@ void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeA
370 373 }
371 374 }
372 375  
  376 + if (osstr.str().empty()) {
  377 + osstr << name;
  378 + }
  379 +
373 380 if (!skipIndex) {
374 381 if(index.getDim1Index() != -1){
375 382 osstr << "[" << index.getDim1Index() ;
... ... @@ -390,7 +397,37 @@ void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeA
390 397 if (pSerie->_name.size() > maxNameLen) {
391 398 maxNameLen = pSerie->_name.size();
392 399 }
393   - pSerie->_isFirstLabel = true;
  400 +
  401 + if (isFirstIndex) {
  402 + std::string description;
  403 + if (paramInfo != nullptr) {
  404 + description = paramInfo->getInstrumentId();
  405 + if (!description.empty()) {
  406 + if (description.find('_') != std::string::npos) {
  407 + description = description.substr(0, description.find('_'));
  408 + }
  409 + std::transform(description.begin(), description.end(), description.begin(), ::toupper);
  410 + }
  411 + else {
  412 + description = paramInfo->getShortName();
  413 + }
  414 + }
  415 +
  416 + if ((index.getDim1Index() != -1) || (index.getDim2Index() != -1)) {
  417 + if (description.empty()) {
  418 + description = name;
  419 + }
  420 + if ((paramInfo != nullptr) && (paramInfo->getCoordinatesSystem().empty() == false)) {
  421 + description += ", ";
  422 + description += paramInfo->getCoordinatesSystem();
  423 + }
  424 + }
  425 + pSerie->_description = description;
  426 + if (pSerie->_description.size() > maxNameLen) {
  427 + maxNameLen = pSerie->_description.size();
  428 + }
  429 + }
  430 +
394 431 pSerie->_valuesFormat = getValuesFormat();
395 432  
396 433 //Compute max len
... ... @@ -403,6 +440,7 @@ void TickMarkDecorator::installLabelGenerator(PanelPlotOutput* /*pplot_*/, TimeA
403 440 }
404 441  
405 442 _seriesInfoList.push_back(pSerie);
  443 + isFirstIndex = false;
406 444 }
407 445 }
408 446 }
... ...
src/ParamOutputImpl/Plot/TickPlot/TickMarkDecorator.hh
... ... @@ -28,6 +28,12 @@ struct SeriesInfo{
28 28 * @brief name of that series (i.e. name of parameter and index if not a scalar parameter).
29 29 */
30 30 std::string _name;
  31 +
  32 + /**
  33 + * @brief description
  34 + */
  35 + std::string _description;
  36 +
31 37 /**
32 38 * @brief maximum len for name.
33 39 */
... ... @@ -42,11 +48,6 @@ struct SeriesInfo{
42 48 unsigned int _maxValueLen;
43 49  
44 50 /**
45   - * @brief to know if it's the first label to draw
46   - */
47   - bool _isFirstLabel;
48   -
49   - /**
50 51 * @brief link to the parameter data
51 52 */
52 53 ParameterData* _parameterData;
... ...