Commit 5f13f59c3d5500fa7c3b9af58a77fc747aeebf2f

Authored by Hacene SI HADJ MOHAND
1 parent 736a40f7

in progress working on axis

src/ParamOutputImpl/Plot/DrawingProperties.cc
... ... @@ -21,6 +21,7 @@ DrawingProperties::DrawingProperties() :
21 21 _errorBarProperties(),
22 22 _xAxisId(""),
23 23 _yAxisId(""),
  24 + _yleftAxisId(""),
24 25 _zAxisId(""),
25 26 _color(),
26 27 _min(nan("")),
... ... @@ -36,6 +37,7 @@ DrawingProperties::DrawingProperties(const DrawingProperties& ref_) :
36 37 _errorBarProperties(ref_._errorBarProperties),
37 38 _xAxisId(ref_._xAxisId),
38 39 _yAxisId(ref_._yAxisId),
  40 + _yleftAxisId(ref_._yleftAxisId),
39 41 _zAxisId(ref_._zAxisId),
40 42 _color(ref_._color),
41 43 _min(ref_._min),
... ... @@ -58,6 +60,7 @@ DrawingProperties& DrawingProperties::operator=(const DrawingProperties& ref_)
58 60 {
59 61 _xAxisId = ref_._xAxisId;
60 62 _yAxisId = ref_._yAxisId;
  63 + _yleftAxisId = ref_._yleftAxisId;
61 64 _zAxisId = ref_._zAxisId;
62 65 _lineProperties = ref_._lineProperties;
63 66 _symbolProperties = ref_._symbolProperties;
... ... @@ -174,6 +177,16 @@ void DrawingProperties::setYAxisId(const std::string& axisId)
174 177 _yAxisId = axisId;
175 178 }
176 179  
  180 +const std::string& DrawingProperties::getYleftAxisId() const
  181 +{
  182 + return _yleftAxisId;
  183 +}
  184 +
  185 +void DrawingProperties::setYleftAxisId(const std::string& axisId)
  186 +{
  187 + _yleftAxisId = axisId;
  188 +}
  189 +
177 190 const std::string& DrawingProperties::getZAxisId() const
178 191 {
179 192 return _zAxisId;
... ...
src/ParamOutputImpl/Plot/DrawingProperties.hh
... ... @@ -62,6 +62,9 @@ public:
62 62  
63 63 const std::string& getYAxisId() const;
64 64 void setYAxisId(const std::string& axisId);
  65 +
  66 + const std::string& getYleftAxisId() const;
  67 + void setYleftAxisId(const std::string& axisId);
65 68  
66 69 const std::string& getZAxisId() const;
67 70 void setZAxisId(const std::string& axisId);
... ... @@ -92,10 +95,11 @@ private:
92 95 ErrorBarProperties _errorBarProperties;
93 96 std::string _xAxisId;
94 97 std::string _yAxisId;
  98 + std::string _yleftAxisId;
95 99 std::string _zAxisId;
96 100 Color _color;
97   - double _min;
98   - double _max;
  101 + double _min;
  102 + double _max;
99 103  
100 104  
101 105 /**
... ...
src/ParamOutputImpl/Plot/DrawingPropertiesNode.hh
... ... @@ -81,6 +81,14 @@ protected:
81 81 props_.setYAxisId(std::string((const char*)value));
82 82 xmlFree(value);
83 83 }
  84 +
  85 + // -- yleftAxis information
  86 + value = xmlGetProp(pNode_, (const xmlChar *) "yleftAxis");
  87 + if( value ){
  88 + props_.setYleftAxisId(std::string((const char*)value));
  89 + xmlFree(value);
  90 + }
  91 +
84 92 // -- zAxis information
85 93 value = xmlGetProp(pNode_, (const xmlChar *) "zAxis");
86 94 if( value ){
... ...
src/ParamOutputImpl/Plot/PanelPlotOutput.cc
... ... @@ -1491,7 +1491,7 @@ void PanelPlotOutput::drawMatrix(MatrixGrid& matrixGrid, double minDataVal, doub
1491 1491  
1492 1492 /*
1493 1493 * @brief Draw a sauvaud
1494   - */
  1494 +
1495 1495 void PanelPlotOutput::draw2DMatrix(SauvaudGrid& sauvaudGrid, double minDataVal, double maxDataVal,
1496 1496 Color minValColor, Color maxValColor, int colorMapIndex, bool useLog0AsMin)
1497 1497 {
... ... @@ -1578,7 +1578,7 @@ void PanelPlotOutput::draw2DMatrix(SauvaudGrid& sauvaudGrid, double minDataVal,
1578 1578  
1579 1579 // Restore color.
1580 1580 restoreColor(_pls, lInitialColor, _panel->_page->_mode);
1581   -}
  1581 +}*/
1582 1582  
1583 1583 /**
1584 1584 * Draw errors segments
... ... @@ -2165,12 +2165,17 @@ void PanelPlotOutput::writeContext(ContextFileWriter& writer) {
2165 2165 if (!_parameterAxesList.empty())
2166 2166 {
2167 2167 bool hasSpectro = false;
  2168 + bool hasSauvaud = false;
2168 2169 for (auto parameter : _parameterAxesList)
2169 2170 {
2170 2171 if (parameter.getSpectroProperties() != nullptr) {
2171 2172 hasSpectro = true;
2172 2173 break;
2173 2174 }
  2175 + if (parameter.getSauvaudProperties() != nullptr) {
  2176 + hasSauvaud = true;
  2177 + break;
  2178 + }
2174 2179 }
2175 2180  
2176 2181  
... ... @@ -2191,6 +2196,7 @@ void PanelPlotOutput::writeContext(ContextFileWriter& writer) {
2191 2196 }
2192 2197  
2193 2198 writer.addAttribute("hasSpectro", hasSpectro ? "true" : "false");
  2199 + writer.addAttribute("hasSauvaud", hasSauvaud ? "true" : "false");
2194 2200  
2195 2201 for (Axes::iterator it = _panel->_axes.begin(); it != _panel->_axes.end(); ++it) {
2196 2202 boost::shared_ptr<Axis> lAxis = it->second;
... ... @@ -2313,7 +2319,7 @@ bool PanelPlotOutput::draw(double startTime, double stopTime, int intervalIndex,
2313 2319  
2314 2320 //Draw spectro
2315 2321 for (auto parameter : _parameterAxesList) {
2316   - if (parameter.getSpectroProperties() != nullptr) {
  2322 + if (parameter.getSpectroProperties() != nullptr) {
2317 2323 //draw spectro
2318 2324 LOG4CXX_DEBUG(gLogger, "Draw a spectro for parameter " << parameter._originalParamId);
2319 2325 // Draw (configure) window for this series.
... ... @@ -2321,18 +2327,36 @@ bool PanelPlotOutput::draw(double startTime, double stopTime, int intervalIndex,
2321 2327  
2322 2328 ParameterData &data = (*_pParameterValues)[parameter.getSpectroProperties()->getParamId()];
2323 2329  
2324   - if (parameter.getSpectroProperties()->getIndexes().empty()) {
  2330 + if (parameter.getSpectroProperties()->getIndexes().empty()) {
  2331 + noData = data.noData();
  2332 + }
  2333 + else {
  2334 + for (auto index : parameter.getSpectroProperties()->getIndexes()) {
  2335 + if (noData)
  2336 + noData = data.noData(index);
  2337 + }
  2338 + }
  2339 + }
  2340 + if (parameter.getSauvaudProperties() != nullptr) {
  2341 + //draw sauvaud
  2342 + LOG4CXX_DEBUG(gLogger, "Draw a sauvaud for parameter " << parameter._originalParamId);
  2343 + // Draw (configure) window for this series.
  2344 + drawSauvaud(startTime, stopTime, parameter._originalParamId, *(parameter.getSauvaudProperties()));
  2345 +
  2346 + ParameterData &data = (*_pParameterValues)[parameter.getSauvaudProperties()->getParamId()];
  2347 +
  2348 + if (parameter.getSauvaudProperties()->getIndexes().empty()) {
2325 2349 noData = data.noData();
2326 2350 }
2327 2351 else {
2328   - for (auto index : parameter.getSpectroProperties()->getIndexes()) {
  2352 + for (auto index : parameter.getSauvaudProperties()->getIndexes()) {
2329 2353 if (noData)
2330 2354 noData = data.noData(index);
2331 2355 }
2332 2356 }
2333 2357 }
2334 2358 }
2335   -
  2359 +
2336 2360 //Draw intervals
2337 2361 for (auto parameter : _parameterAxesList) {
2338 2362 if (parameter.getIntervalsProperties() != nullptr) {
... ... @@ -2405,6 +2429,7 @@ void PanelPlotOutput::drawSauvaud(double /*startDate*/, double /*stopDate*/, std
2405 2429 boost::shared_ptr<Axis> lXAxis(_panel->getAxis(pSauvaud.getXAxisId()));
2406 2430 boost::shared_ptr<Axis> lYAxis(_panel->getAxis(pSauvaud.getYAxisId()));
2407 2431 boost::shared_ptr<Axis> lZAxis(_panel->getAxis(pSauvaud.getZAxisId()));
  2432 +
2408 2433  
2409 2434 PlWindow lPlWindow;
2410 2435 Range lXRange, lYRange, lZRange;
... ... @@ -2741,6 +2766,30 @@ void PanelPlotOutput::drawAdditionalObjects() {
2741 2766 lXAxis->_additionalObjDrawn = true;
2742 2767 lYAxis->_additionalObjDrawn = true;
2743 2768 }
  2769 + if (parameter.getSauvaudProperties() != nullptr) {
  2770 + boost::shared_ptr<Axis> lXAxis(_panel->getAxis(parameter.getSauvaudProperties()->getXAxisId()));
  2771 + boost::shared_ptr<Axis> lYAxis(_panel->getAxis(parameter.getSauvaudProperties()->getYAxisId()));
  2772 +
  2773 + if ((lXAxis == nullptr) || (lYAxis == nullptr))
  2774 + continue;
  2775 +
  2776 + Range lXRange = lXAxis->getRange();
  2777 + Range lYRange = lYAxis->getRange();
  2778 +
  2779 + PlWindow lPlWindow = PlWindow(lXRange.getMin(), lXRange.getMax(), lYRange.getMin(), lYRange.getMax());
  2780 +
  2781 + if (!lXAxis->_additionalObjDrawn)
  2782 + drawXConstantLines (lXAxis, lPlWindow);
  2783 +
  2784 + if (!lYAxis->_additionalObjDrawn)
  2785 + drawYConstantLines (lYAxis, lPlWindow);
  2786 +
  2787 + if (!lXAxis->_additionalObjDrawn || !lYAxis->_additionalObjDrawn)
  2788 + drawTextPlots (lXAxis, lYAxis, lPlWindow, _panel->_textPlots);
  2789 +
  2790 + lXAxis->_additionalObjDrawn = true;
  2791 + lYAxis->_additionalObjDrawn = true;
  2792 + }
2744 2793 }
2745 2794  
2746 2795 SeriesProperties lSeries;
... ... @@ -3116,6 +3165,68 @@ void PanelPlotOutput::createParameters(std::list&lt;std::string&gt;&amp; usedParametersId_
3116 3165 }
3117 3166  
3118 3167 }
  3168 +
  3169 + //For sauvaud if defined
  3170 + std::shared_ptr<SauvaudProperties> pSauvaudProp = it->getSauvaudProperties();
  3171 + if (pSauvaudProp != nullptr)
  3172 + {
  3173 + AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(originalParam->getInfoId());
  3174 + boost::shared_ptr<AMDA::Info::ParamTable> tableSPtr;
  3175 + if (paramInfo != nullptr)
  3176 + tableSPtr = paramInfo->getTable(pSauvaudProp->getRelatedDim());
  3177 + //get corrected sampling value in relation with max resolution
  3178 + double correctedSamplingValue = getCorrectedSamplingValue(pSauvaudProp->getMaxResolution(), samplingValue);
  3179 + AMDA::Parameters::ParameterSPtr usedParam;
  3180 +
  3181 + if (abs(samplingValue - correctedSamplingValue) > 1.)
  3182 + {
  3183 + //more than one second between samplingValue and correctedSamplingValue
  3184 + //=> use resampling parameter
  3185 + usedParam = createSampledParameter(originalParam, correctedSamplingValue);
  3186 + if ((tableSPtr != nullptr) && tableSPtr->isVariable(&_parameterManager))
  3187 + {
  3188 + for (std::map<std::string, std::string>::iterator it = tableSPtr->getTableParams(&_parameterManager).begin(); it != tableSPtr->getTableParams(&_parameterManager).end(); ++it)
  3189 + {
  3190 + std::string tableParamKey = it->first;
  3191 + std::string tableParamName = it->second;
  3192 +
  3193 + AMDA::Parameters::ParameterSPtr originalTableParam = _parameterManager.getParameter(tableParamName);
  3194 + AMDA::Parameters::ParameterSPtr usedTableParam = createSampledParameter(originalTableParam, correctedSamplingValue);
  3195 + pSauvaudProp->addTableParam(tableParamKey, usedTableParam->getId());
  3196 + }
  3197 + }
  3198 + }
  3199 + else
  3200 + {
  3201 + //use original parameter
  3202 + usedParam = originalParam;
  3203 + if ((tableSPtr != nullptr) && tableSPtr->isVariable(&_parameterManager))
  3204 + {
  3205 + for (std::map<std::string, std::string>::iterator it = tableSPtr->getTableParams(&_parameterManager).begin(); it != tableSPtr->getTableParams(&_parameterManager).end(); ++it)
  3206 + {
  3207 + std::string tableParamKey = it->first;
  3208 + std::string tableParamName = it->second;
  3209 +
  3210 + AMDA::Parameters::ParameterSPtr originalTableParam = _parameterManager.getParameter(tableParamName);
  3211 + pSauvaudProp->addTableParam(tableParamKey, originalTableParam->getId());
  3212 + }
  3213 + }
  3214 + }
  3215 +
  3216 + //Add used parameter to parameters list
  3217 + if (std::find (usedParametersId_.begin(),usedParametersId_.end(),usedParam->getId()) == usedParametersId_.end())
  3218 + usedParametersId_.push_back(usedParam->getId());
  3219 + pSauvaudProp->setParamId(usedParam->getId());
  3220 + //Add table parameters to parameters list
  3221 + for (std::map<std::string, std::string>::iterator it = pSauvaudProp->getTableParams().begin(); it != pSauvaudProp->getTableParams().end(); ++it)
  3222 + {
  3223 + std::string tableParamId = it->second;
  3224 +
  3225 + if (std::find (usedParametersId_.begin(),usedParametersId_.end(),tableParamId) == usedParametersId_.end())
  3226 + usedParametersId_.push_back(tableParamId);
  3227 + }
  3228 +
  3229 + }
3119 3230  
3120 3231 //For intervals if defined
3121 3232 std::shared_ptr<IntervalsProperties> pIntProp = it->getIntervalsProperties();
... ... @@ -3218,6 +3329,30 @@ std::vector&lt;AMDA::Common::ParameterIndexComponent&gt; PanelPlotOutput::getParamUsed
3218 3329 }
3219 3330 }
3220 3331 }
  3332 +
  3333 + //get indexes for spectro
  3334 + std::shared_ptr<SauvaudProperties> pSauvaudProp = paramAxeIt->getSauvaudProperties();
  3335 + if (pSauvaudProp != nullptr)
  3336 + {
  3337 + if (pSauvaudProp->getParamId() == paramId)
  3338 + {
  3339 + if (pSauvaudProp->getIndexes().empty())
  3340 + {
  3341 + //get used indexes by the spectro thanks to the index definition in the request
  3342 + AMDA::Common::ParameterIndexComponentList indexList;
  3343 + AMDA::Common::ParameterIndexesTool::parse(pSauvaudProp->getIndexDef(),
  3344 + dim1Size, dim2Size, indexList);
  3345 + pSauvaudProp->setIndexes(indexList);
  3346 + }
  3347 +
  3348 + for (auto index : pSauvaudProp->getIndexes())
  3349 + {
  3350 + if (std::find(indexes.begin(),indexes.end(),index) != indexes.end())
  3351 + continue;
  3352 + indexes.push_back(index);
  3353 + }
  3354 + }
  3355 + }
3221 3356  
3222 3357 //get indexes for intervals
3223 3358 std::shared_ptr<IntervalsProperties> pIntProp = paramAxeIt->getIntervalsProperties();
... ...
src/ParamOutputImpl/Plot/ParamsNode.hh
... ... @@ -16,6 +16,7 @@
16 16 #include "DrawingPropertiesNode.hh"
17 17 #include "SeriesNode.hh"
18 18 #include "SpectroNode.hh"
  19 +#include "SauvaudNode.hh"
19 20 #include "IntervalsNode.hh"
20 21  
21 22 namespace plot {
... ... @@ -31,6 +32,8 @@ public:
31 32 new SeriesNode<PlotType>());
32 33 getChildList()["spectro"] = AMDA::XMLConfigurator::NodeCfgSPtr(
33 34 new SpectroNode<PlotType>());
  35 + getChildList()["sauvaud"] = AMDA::XMLConfigurator::NodeCfgSPtr(
  36 + new SauvaudNode<PlotType>());
34 37 getChildList()["intervals"] = AMDA::XMLConfigurator::NodeCfgSPtr(
35 38 new IntervalsNode<PlotType>());
36 39 getChildList()["colorserie"] = AMDA::XMLConfigurator::NodeCfgSPtr(
... ...
src/ParamOutputImpl/Plot/PlotTools.hh 0 โ†’ 100644
... ... @@ -0,0 +1,91 @@
  1 +/*
  2 + * To change this license header, choose License Headers in Project Properties.
  3 + * To change this template file, choose Tools | Templates
  4 + * and open the template in the editor.
  5 + */
  6 +
  7 +/*
  8 + * File: PlotTools.hh
  9 + * Author: hacene
  10 + *
  11 + * Created on January 7, 2022, 4:30 PM
  12 + */
  13 +
  14 +#ifndef PLOTTOOLS_HH
  15 +#define PLOTTOOLS_HH
  16 +
  17 +#include"ParamTable.hh"
  18 +#include "Range.hh"
  19 +#include "Axis.hh"
  20 +namespace plot {
  21 +
  22 +class PlotTools{
  23 +public:
  24 + PlotTools(){
  25 + }
  26 + ~ PlotTools(){
  27 + }
  28 +
  29 + static void configureAxisRangeFromTable(Range & lYAxisRange, boost::shared_ptr<Axis> lYAxis,boost::shared_ptr<AMDA::Info::ParamTable> leftTableSPtr)
  30 +{
  31 + AMDA::Info::t_TableBound crtBound;
  32 + if (!tableSPtr->isVariable(&_parameterManager))
  33 + {
  34 + for (int i = 0; i < parameterDimension; ++i)
  35 + {
  36 + crtBound = tableSPtr->getBound(&_parameterManager, i);
  37 + if (!std::isnan(crtBound.min))
  38 + {
  39 + if (!((lYAxis->_scale == Axis::Scale::LOGARITHMIC) && (crtBound.min <= 0)))
  40 + lYAxisRange.setMin(std::min(crtBound.min, lYAxisRange.getMin()));
  41 + }
  42 + if (!std::isnan(crtBound.max))
  43 + {
  44 + if (!((lYAxis->_scale == Axis::Scale::LOGARITHMIC) && (crtBound.max <= 0)))
  45 + lYAxisRange.setMax(std::max(crtBound.max, lYAxisRange.getMax()));
  46 + }
  47 + }
  48 + }
  49 + else
  50 + {
  51 + //Variable table => we need to loop under all records to find axis min & max values
  52 + for (int i = 0; i < (*_pParameterValues)[sauvaudPropertiesPtr->getParamId()].getSize(); ++i)
  53 + {
  54 + std::map<std::string, std::vector<double>> paramsTableData;
  55 + for (std::map<std::string, std::string>::iterator it = sauvaudPropertiesPtr->getTableParams().begin(); it != sauvaudPropertiesPtr->getTableParams().end(); ++it)
  56 + {
  57 + ParameterData &data = (*_pParameterValues)[it->second];
  58 + std::vector<double> paramTableValues;
  59 + for (int j = 0; j < data.getDim1Size(); ++j)
  60 + {
  61 + if (i < data.getSize())
  62 + {
  63 + double *values = data.getValues(AMDA::Common::ParameterIndexComponent(j), i);
  64 + paramTableValues.push_back((*values));
  65 + }
  66 + }
  67 + paramsTableData[it->first] = paramTableValues;
  68 + }
  69 + for (int j = 0; j < parameterDimension; ++j)
  70 + {
  71 + crtBound = tableSPtr->getBound(&_parameterManager, j, &paramsTableData);
  72 + if (!std::isnan(crtBound.min))
  73 + {
  74 + if (!((lYAxis->_scale == Axis::Scale::LOGARITHMIC) && (crtBound.min <= 0)))
  75 + lYAxisRange.setMin(std::min(crtBound.min, lYAxisRange.getMin()));
  76 + }
  77 + if (!std::isnan(crtBound.max))
  78 + {
  79 + if (!((lYAxis->_scale == Axis::Scale::LOGARITHMIC) && (crtBound.max <= 0)))
  80 + lYAxisRange.setMax(std::max(crtBound.max, lYAxisRange.getMax()));
  81 + }
  82 + }
  83 + }
  84 + }
  85 + }
  86 +
  87 +};
  88 +}
  89 +
  90 +#endif /* PLOTTOOLS_HH */
  91 +
... ...
src/ParamOutputImpl/Plot/SauvaudNode.hh
... ... @@ -47,7 +47,7 @@ namespace plot
47 47 DrawingPropertiesNode<PlotType>::parseAttributes(pNode_, defaultProps);
48 48  
49 49 // spectro properties
50   - std::shared_ptr<SauvaudProperties> spectroPropsPtr =
  50 + std::shared_ptr<SauvaudProperties> sauvaudPropsPtr =
51 51 std::shared_ptr<SauvaudProperties>(new SauvaudProperties(defaultProps));
52 52  
53 53 xmlChar *value = NULL;
... ... @@ -56,7 +56,7 @@ namespace plot
56 56 value = xmlGetProp(pNode_, (const xmlChar *)"resolution");
57 57 if (value)
58 58 {
59   - spectroPropsPtr->setMaxResolution(atoi((const char *)value));
  59 + sauvaudPropsPtr->setMaxResolution(atoi((const char *)value));
60 60 xmlFree(value);
61 61 }
62 62  
... ... @@ -64,12 +64,12 @@ namespace plot
64 64 value = xmlGetProp(pNode_, (const xmlChar *)"index");
65 65 if (value)
66 66 {
67   - spectroPropsPtr->setIndexDef((const char *)value);
  67 + sauvaudPropsPtr->setIndexDef((const char *)value);
68 68 xmlFree(value);
69 69 }
70 70  
71 71 //set related dim
72   - spectroPropsPtr->setRelatedDim(AMDA::Common::ParameterIndexesTool::getRelatedDimForTab2D(spectroPropsPtr->getIndexDef()));
  72 + sauvaudPropsPtr->setRelatedDim(AMDA::Common::ParameterIndexesTool::getRelatedDimForTab2D(sauvaudPropsPtr->getIndexDef()));
73 73  
74 74 // read uselog0asmin
75 75 value = xmlGetProp(pNode_, (const xmlChar *)"uselog0asmin");
... ... @@ -81,7 +81,7 @@ namespace plot
81 81 std::istringstream is(strValue);
82 82 bool uselog0asmin;
83 83 is >> std::boolalpha >> uselog0asmin;
84   - spectroPropsPtr->setUseLog0AsMin(uselog0asmin);
  84 + sauvaudPropsPtr->setUseLog0AsMin(uselog0asmin);
85 85 xmlFree(value);
86 86 }
87 87  
... ... @@ -89,7 +89,7 @@ namespace plot
89 89 value = xmlGetProp(pNode_, (const xmlChar *)"normalization");
90 90 if (value)
91 91 {
92   - spectroPropsPtr->setNormalization((const char *)value);
  92 + sauvaudPropsPtr->setNormalization((const char *)value);
93 93 xmlFree(value);
94 94 }
95 95  
... ... @@ -100,11 +100,11 @@ namespace plot
100 100  
101 101 if (strcmp(valueString, BACKGROUND_SUB_TYPE_BY_CHANNEL) == 0)
102 102 {
103   - spectroPropsPtr->setBackgroundSubType(SauvaudProperties::BackgroundSubType::BYCHANNEL);
  103 + sauvaudPropsPtr->setBackgroundSubType(SauvaudProperties::BackgroundSubType::BYCHANNEL);
104 104 }
105 105 else if (strcmp(valueString, BACKGROUND_SUB_TYPE_BY_FIXED_VALUE) == 0)
106 106 {
107   - spectroPropsPtr->setBackgroundSubType(SauvaudProperties::BackgroundSubType::FIXEDVALUE);
  107 + sauvaudPropsPtr->setBackgroundSubType(SauvaudProperties::BackgroundSubType::FIXEDVALUE);
108 108 }
109 109  
110 110 xmlFree(value);
... ... @@ -115,7 +115,7 @@ namespace plot
115 115 {
116 116 char *newValueBrut = (char *)value;
117 117 double newValue = std::stod(newValueBrut);
118   - spectroPropsPtr->setBackgroundSubValue(newValue);
  118 + sauvaudPropsPtr->setBackgroundSubValue(newValue);
119 119 xmlFree(value);
120 120 }
121 121 //setRelatedDim
... ... @@ -124,11 +124,11 @@ namespace plot
124 124 {
125 125 char *newValueBrut = (char *)value;
126 126 int newValue = std::stoi(newValueBrut);
127   - spectroPropsPtr->setBackgroundSubDim(newValue);
  127 + sauvaudPropsPtr->setBackgroundSubDim(newValue);
128 128 xmlFree(value);
129 129 }
130 130 // add spectro definition to parameter
131   - plotOutput->getParameter((const char *)name).addSauvaudProperties(spectroPropsPtr);
  131 + plotOutput->getParameter((const char *)name).addSauvaudProperties(sauvaudPropsPtr);
132 132 }
133 133 };
134 134  
... ...
src/ParamOutputImpl/Plot/SauvaudProperties.hh
... ... @@ -14,27 +14,52 @@
14 14 #ifndef SAUVAUDPROPERTIES_HH
15 15 #define SAUVAUDPROPERTIES_HH
16 16 #include "SpectroProperties.hh"
17   -namespace plot
18   -{
19   -class SauvaudProperties: public SpectroProperties{
20   -
21   -public:
22   - SauvaudProperties() : SpectroProperties(){
23   -
24   - }
25   -
26   - SauvaudProperties(const SpectroProperties& orig) : SpectroProperties(orig){
  17 +namespace plot {
  18 +
  19 + class SauvaudProperties : public SpectroProperties {
  20 + public:
  21 +
  22 + SauvaudProperties() : SpectroProperties(),_rightDim(0),_hasYleftAxis(true) {
  23 +
  24 + }
  25 +
  26 + SauvaudProperties(const SpectroProperties& orig) : SpectroProperties(orig) {
  27 +
  28 + }
  29 +
  30 + SauvaudProperties(const SauvaudProperties& orig) : SpectroProperties(orig) {
  31 +
  32 + }
  33 +
  34 + virtual ~SauvaudProperties() {
  35 +
  36 + }
  37 +
  38 + int getRightDim() {
  39 + return _rightDim;
  40 + }
  41 +
  42 + void setRightDim(int dim) {
  43 + _rightDim = dim;
  44 + }
  45 +
  46 + bool hasYleftAxis() const {
  47 + return _hasYleftAxis;
  48 + }
  49 +
  50 + void setYAxis(bool hasYAxis) {
  51 + _hasYleftAxis = hasYAxis;
  52 + }
27 53  
28   - }
29   -
30   - SauvaudProperties(const SauvaudProperties& orig) : SpectroProperties(orig){
  54 + private:
31 55  
32   - }
33   - virtual ~SauvaudProperties(){
  56 + /***/
  57 + int _rightDim;
  58 +
  59 + bool _hasYleftAxis;
34 60  
35   - }
  61 + };
36 62  
37   -};
38 63  
39 64 } /* namespace plot */
40 65 #endif /* SAUVAUDPROPERTIES_HH */
... ...
src/ParamOutputImpl/Plot/Time/TimePlot.cc
... ... @@ -24,6 +24,7 @@
24 24 #include <cstddef>
25 25 #include <fstream>
26 26 #include <limits>
  27 +#include "PlotTools.hh"
27 28  
28 29 #include <sstream>
29 30 #include <string>
... ... @@ -481,6 +482,7 @@ namespace plot
481 482  
482 483 LOG4CXX_DEBUG(gLogger, "Sauvaud Y axis is " << sauvaudPropertiesPtr->getYAxisId());
483 484 boost::shared_ptr<Axis> lYAxis = _panel->getAxis(sauvaudPropertiesPtr->getYAxisId());
  485 + boost::shared_ptr<Axis> lYleftAxis = _panel->getAxis(sauvaudPropertiesPtr->getYleftAxisId());
484 486 if (lYAxis.get() == nullptr)
485 487 {
486 488 std::stringstream lError;
... ... @@ -490,6 +492,17 @@ namespace plot
490 492 }
491 493  
492 494 lYAxis->_used = true;
  495 +
  496 + if (lYleftAxis.get() == nullptr)
  497 + {
  498 + std::stringstream lError;
  499 + lError << "TimePlot::configureSauvaudAxis"
  500 + << ": Y left axis with id '" << sauvaudPropertiesPtr->getYAxisId() << "' not found.";
  501 + BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str()));
  502 + }
  503 +
  504 + lYleftAxis->_used = true;
  505 +
493 506  
494 507 //set Z axis range
495 508 boost::shared_ptr<Axis> lZAxis = _panel->getAxis(sauvaudPropertiesPtr->getZAxisId());
... ... @@ -520,90 +533,23 @@ namespace plot
520 533  
521 534 if (isnan(lYAxisRequestRange.getMin()) && isnan(lYAxisRequestRange.getMax()))
522 535 {
523   - boost::shared_ptr<AMDA::Info::ParamTable> tableSPtr;
524   - if (paramInfo != nullptr)
525   - tableSPtr = paramInfo->getTable(sauvaudPropertiesPtr->getRelatedDim());
526   -
527   - if (tableSPtr == nullptr){
528   - // look for unique embedded table
529   - boost::shared_ptr<AMDA::Info::ParamTable> linkedTableSPtr;
530   - int counter = 0;
531   - for (auto pInfo :paramInfo->getLinkedParamList()){
532   - linkedTableSPtr = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(pInfo)->getTable(sauvaudPropertiesPtr->getRelatedDim());
533   - if (linkedTableSPtr == nullptr)
534   - continue;
535   - counter ++;
536   - }
537   - if(linkedTableSPtr == nullptr || counter !=1){
538   - LOG4CXX_DEBUG(gLogger, "table cannot be defined from linked info params");
539   - }else{
540   - tableSPtr = linkedTableSPtr;
541   - }
  536 + boost::shared_ptr<AMDA::Info::ParamTable> rightTableSPtr;
  537 + boost::shared_ptr<AMDA::Info::ParamTable> leftTableSPtr;
  538 + if (paramInfo != nullptr){
  539 + int rightDim = pSauvaud.getRightDim();
  540 + int leftDim = (rightDim ==0) ? 1 :0;
  541 + rightTableSPtr = paramInfo->getTable(rightDim);
  542 + leftTableSPtr = paramInfo->getTable(leftDim);
  543 +
542 544 }
543   -
544   - if (tableSPtr == nullptr)
  545 + if (rightTableSPtr == nullptr)
545 546 {
546 547 LOG4CXX_DEBUG(gLogger, "No table defined => use index");
547 548 lYAxisRange.setMin(std::min(0., lYAxisRange.getMin()));
548 549 lYAxisRange.setMax(std::max((double)parameterDimension, lYAxisRange.getMax()));
549 550 }
550 551 else
551   - {
552   - AMDA::Info::t_TableBound crtBound;
553   - if (!tableSPtr->isVariable(&_parameterManager))
554   - {
555   - for (int i = 0; i < parameterDimension; ++i)
556   - {
557   - crtBound = tableSPtr->getBound(&_parameterManager, i);
558   - if (!std::isnan(crtBound.min))
559   - {
560   - if (!((lYAxis->_scale == Axis::Scale::LOGARITHMIC) && (crtBound.min <= 0)))
561   - lYAxisRange.setMin(std::min(crtBound.min, lYAxisRange.getMin()));
562   - }
563   - if (!std::isnan(crtBound.max))
564   - {
565   - if (!((lYAxis->_scale == Axis::Scale::LOGARITHMIC) && (crtBound.max <= 0)))
566   - lYAxisRange.setMax(std::max(crtBound.max, lYAxisRange.getMax()));
567   - }
568   - }
569   - }
570   - else
571   - {
572   - //Variable table => we need to loop under all records to find axis min & max values
573   - for (int i = 0; i < (*_pParameterValues)[sauvaudPropertiesPtr->getParamId()].getSize(); ++i)
574   - {
575   - std::map<std::string, std::vector<double>> paramsTableData;
576   - for (std::map<std::string, std::string>::iterator it = sauvaudPropertiesPtr->getTableParams().begin(); it != sauvaudPropertiesPtr->getTableParams().end(); ++it)
577   - {
578   - ParameterData &data = (*_pParameterValues)[it->second];
579   - std::vector<double> paramTableValues;
580   - for (int j = 0; j < data.getDim1Size(); ++j)
581   - {
582   - if (i < data.getSize())
583   - {
584   - double *values = data.getValues(AMDA::Common::ParameterIndexComponent(j), i);
585   - paramTableValues.push_back((*values));
586   - }
587   - }
588   - paramsTableData[it->first] = paramTableValues;
589   - }
590   - for (int j = 0; j < parameterDimension; ++j)
591   - {
592   - crtBound = tableSPtr->getBound(&_parameterManager, j, &paramsTableData);
593   - if (!std::isnan(crtBound.min))
594   - {
595   - if (!((lYAxis->_scale == Axis::Scale::LOGARITHMIC) && (crtBound.min <= 0)))
596   - lYAxisRange.setMin(std::min(crtBound.min, lYAxisRange.getMin()));
597   - }
598   - if (!std::isnan(crtBound.max))
599   - {
600   - if (!((lYAxis->_scale == Axis::Scale::LOGARITHMIC) && (crtBound.max <= 0)))
601   - lYAxisRange.setMax(std::max(crtBound.max, lYAxisRange.getMax()));
602   - }
603   - }
604   - }
605   - }
606   - }
  552 + PlotTools::configureAxisRangeFromTable(lYAxisRange,lYAxis, rightTableSPtr );
607 553 }
608 554  
609 555 //do not extend the axis
... ... @@ -1381,59 +1327,41 @@ namespace plot
1381 1327  
1382 1328 ParameterData &data = (*_pParameterValues)[pSauvaud.getParamId()];
1383 1329  
1384   - boost::shared_ptr<AMDA::Info::ParamTable> tableSPtr;
  1330 + boost::shared_ptr<AMDA::Info::ParamTable> rightTableSPtr;
  1331 + boost::shared_ptr<AMDA::Info::ParamTable> leftTableSPtr;
1385 1332 AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(p->getInfoId());
1386   - if (paramInfo != nullptr)
1387   - tableSPtr = paramInfo->getTable(pSauvaud.getRelatedDim());
1388   -
1389   - if (tableSPtr == nullptr){
1390   - boost::shared_ptr<AMDA::Info::ParamTable> linkedTableSPtr;
1391   - int counter = 0;
1392   - // work on this
1393   - for (auto pInfo :paramInfo->getLinkedParamList()){
1394   - linkedTableSPtr = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(pInfo)->getTable(pSauvaud.getRelatedDim());
1395   - if (linkedTableSPtr == nullptr)
1396   - continue;
1397   - counter ++;
1398   - }
1399   - if(linkedTableSPtr == nullptr || counter !=1){
1400   - LOG4CXX_DEBUG(gLogger, "table cannot be defined from linked info params");
1401   - }else{
1402   - tableSPtr = linkedTableSPtr;
1403   - }
1404   - }
1405   -
  1333 + if (paramInfo != nullptr){
  1334 + int rightDim = pSauvaud.getRightDim();
  1335 + int leftDim = (rightDim ==0) ? 1 :0;
  1336 + rightTableSPtr = paramInfo->getTable(rightDim);
  1337 + leftTableSPtr = paramInfo->getTable(leftDim);
  1338 + }
  1339 +
1406 1340 //get axis
1407 1341 boost::shared_ptr<Axis> lXAxis = _panel->getAxis(pSauvaud.getXAxisId());
1408 1342 boost::shared_ptr<Axis> lYAxis = _panel->getAxis(pSauvaud.getYAxisId());
  1343 + boost::shared_ptr<Axis> lYAxis = _panel->getAxis(pSauvaud.getYleftAxisId());
1409 1344 boost::shared_ptr<ColorAxis> lZAxis = _panel->getColorAxis();
  1345 +
  1346 + int dim1Size = data.getDim1Size() ;
  1347 +
  1348 + int dim2Size = data.getDim2Size() ;
1410 1349  
1411   - //Check dimensions
1412   - if (pSauvaud.getRelatedDim() == 0)
1413   - {
1414   - if (data.getDim1Size() + 1 <= 0)
1415   - {
1416   - LOG4CXX_INFO(gLogger, "TimePlot::drawSauvaud - No data to plot");
1417   - return;
1418   - }
1419   - }
1420   - else
1421   - {
1422   - if (data.getDim2Size() + 1 <= 0)
1423   - {
1424   - LOG4CXX_INFO(gLogger, "TimePlot::drawSauvaud - No data to plot");
1425   - return;
1426   - }
1427   - }
1428 1350  
  1351 +
  1352 + if ( dim1Size < 0 && dim2Size<0 )
  1353 + {
  1354 + LOG4CXX_INFO(gLogger, "TimePlot::drawSauvaud - No data to plot");
  1355 + return;
  1356 + }
1429 1357 LOG4CXX_DEBUG(gLogger, "TimePlot::drawSauvaud - Build data grid");
1430   - SauvaudGrid sauvaudGrid;
  1358 + MatrixGrid matrixGrid;
1431 1359  
1432 1360 //get specific colors for min / max values
1433 1361 Color minValColor = lZAxis->getMinValColor();
1434 1362 Color maxValColor = lZAxis->getMaxValColor();
1435 1363  
1436   - if ((tableSPtr == nullptr) || !tableSPtr->isVariable(&_parameterManager))
  1364 + if ((rightTableSPtr == nullptr) || !rightTableSPtr->isVariable(&_parameterManager))
1437 1365 {
1438 1366 int startIndex;
1439 1367 int nbValues;
... ... @@ -1441,7 +1369,7 @@ namespace plot
1441 1369 for (auto index : pSauvaud.getIndexes())
1442 1370 {
1443 1371 GridPart part;
1444   - if (tableSPtr == nullptr)
  1372 + if ( rightTableSPtr== nullptr)
1445 1373 {
1446 1374 if (pSauvaud.getRelatedDim() == 0)
1447 1375 part.y[0] = index.getDim1Index();
... ... @@ -1453,9 +1381,9 @@ namespace plot
1453 1381 {
1454 1382 AMDA::Info::t_TableBound crtBound;
1455 1383 if (pSauvaud.getRelatedDim() == 0)
1456   - crtBound = tableSPtr->getBound(&_parameterManager, index.getDim1Index());
  1384 + crtBound = rightTableSPtr->getBound(&_parameterManager, index.getDim1Index());
1457 1385 else
1458   - crtBound = tableSPtr->getBound(&_parameterManager, index.getDim2Index());
  1386 + crtBound = rightTableSPtr->getBound(&_parameterManager, index.getDim2Index());
1459 1387 if (std::isnan(crtBound.min) || std::isnan(crtBound.max))
1460 1388 continue;
1461 1389 part.y[0] = crtBound.min;
... ... @@ -1501,7 +1429,7 @@ namespace plot
1501 1429 std::string normalization = pSauvaud.getNormalization();
1502 1430 if (!normalization.empty())
1503 1431 normalize(matrixGrid, normalization);
1504   - draw2DMatrix(matrixGrid, pSauvaud.getMin(), pSauvaud.getMax(),
  1432 + drawMatrix(matrixGrid, pSauvaud.getMin(), pSauvaud.getMax(),
1505 1433 minValColor, maxValColor, lZAxis->_color._colorMapIndex, pSauvaud.getUseLog0AsMin());
1506 1434 matrixGrid.clear();
1507 1435 }
... ... @@ -1540,9 +1468,9 @@ namespace plot
1540 1468 part.value = data.getValues(index, startIndex)[i];
1541 1469  
1542 1470 if (pSauvaud.getRelatedDim() == 0)
1543   - crtBound = tableSPtr->getBound(&_parameterManager, index.getDim1Index(), &paramsTableData);
  1471 + crtBound = rightTableSPtr->getBound(&_parameterManager, index.getDim1Index(), &paramsTableData);
1544 1472 else
1545   - crtBound = tableSPtr->getBound(&_parameterManager, index.getDim2Index(), &paramsTableData);
  1473 + crtBound = rightTableSPtr->getBound(&_parameterManager, index.getDim2Index(), &paramsTableData);
1546 1474  
1547 1475 part.y[0] = crtBound.min;
1548 1476 part.y[1] = crtBound.max;
... ...
src/ParamOutputImpl/Plot/Time/TimePlot.hh
... ... @@ -119,6 +119,10 @@ namespace plot
119 119 */
120 120 virtual void drawSpectro(double startDate, double stopDate, std::string pParamId,
121 121 SpectroProperties &pSpectro);
  122 +
  123 + virtual void drawSauvaud(double startDate, double stopDate, std::string pParamId,
  124 + SauvaudProperties &pSauvaud);
  125 +
122 126  
123 127 /**
124 128 * @overload PanelPlotOutput::drawIntervals(double startDate, double stopDate, std::string pParamId, IntervalsProperties& pIntervals)
... ...