diff --git a/config/xsd/request/plot.xsd b/config/xsd/request/plot.xsd
index 2ffafee..3eeae44 100644
--- a/config/xsd/request/plot.xsd
+++ b/config/xsd/request/plot.xsd
@@ -874,9 +874,12 @@
-
+
+
+
-
+
+
diff --git a/src/ParamOutputImpl/Plot/IntervalsNode.hh b/src/ParamOutputImpl/Plot/IntervalsNode.hh
index e960bf9..4bb3117 100644
--- a/src/ParamOutputImpl/Plot/IntervalsNode.hh
+++ b/src/ParamOutputImpl/Plot/IntervalsNode.hh
@@ -76,6 +76,68 @@ public:
intervalsPropsPtr->setColor(color);
// add intervals definition to parameter
plotOutput->getParameter((const char*)name).addIntervalsProperties(intervalsPropsPtr);
+
+ // -- Position
+ value = xmlGetProp(pNode_, (const xmlChar *)"position");
+ if (value)
+ {
+ try
+ {
+ std::string strValue((const char *)value);
+ if (strValue == "POS_RIGHT" || strValue == "POS_LEFT" || strValue == "POS_TOP" || strValue == "POS_BOTTOM")
+ intervalsPropsPtr->setPosition(strValue);
+ else
+ intervalsPropsPtr->setPosition("POS_RIGHT");
+ }
+ catch (std::logic_error &e)
+ {
+ LOG4CXX_WARN(gLogger, "Intervals Legend position : " << e.what());
+ }
+ xmlFree(value);
+ }
+ // -- text
+ value = xmlGetProp(pNode_, (const xmlChar *)"text");
+ if (value)
+ {
+ intervalsPropsPtr->setText((const char *)value);
+ // label->_text = (const char *)value;
+ xmlFree(value);
+ }
+ // -- font name
+ Font labelFont("sans-serif", 12);
+ value = xmlGetProp(pNode_, (const xmlChar *)"fontName");
+ if (value)
+ {
+ labelFont.setName((const char *)value);
+ xmlFree(value);
+ }
+
+ // -- font size
+ value = xmlGetProp(pNode_, (const xmlChar *)"fontSize");
+ if (value)
+ {
+
+ labelFont.setSize(atoi((const char *)value));
+ xmlFree(value);
+ }
+
+ // -- font style
+ value = xmlGetProp(pNode_, (const xmlChar *)"fontStyle");
+ if (value)
+ {
+ labelFont.setStyle(Font::getStyleByStr((const char *)value));
+ xmlFree(value);
+ }
+
+ // -- font weight
+ value = xmlGetProp(pNode_, (const xmlChar *)"fontWeight");
+ if (value)
+ {
+ labelFont.setWeight(Font::getWeightByStr((const char *)value));
+ xmlFree(value);
+ }
+
+ intervalsPropsPtr->setFont(labelFont);
}
};
diff --git a/src/ParamOutputImpl/Plot/IntervalsProperties.hh b/src/ParamOutputImpl/Plot/IntervalsProperties.hh
index 597058d..d069b3e 100644
--- a/src/ParamOutputImpl/Plot/IntervalsProperties.hh
+++ b/src/ParamOutputImpl/Plot/IntervalsProperties.hh
@@ -16,86 +16,127 @@
namespace plot {
-/**
- * Drawing properties for a parameter intervals.
- */
-class IntervalsProperties: public DrawingProperties {
-public:
-
- friend std::ostream& operator<<(std::ostream& out_,
- const IntervalsProperties& lprop_);
-
- /*
- * @brief Dumps properties for test.
- */
- void dump(std::ostream& out_, std::string& prefix_);
-
- IntervalsProperties() :
- DrawingProperties(), _paramId(""), _indexDef("") {
- }
-
- IntervalsProperties(const DrawingProperties& ref_) :
- DrawingProperties(ref_), _paramId(""), _indexDef("") {
-
- }
-
- IntervalsProperties(const IntervalsProperties& pParamDrawingProperties_) :
- DrawingProperties(pParamDrawingProperties_), _paramId(""),
- _indexDef(pParamDrawingProperties_._indexDef) {
- }
-
- IntervalsProperties& operator=(const IntervalsProperties& ref_) {
- DrawingProperties::operator=(ref_);
- _paramId = ref_._paramId;
- _indexDef = ref_._indexDef;
- return *this;
- }
-
- virtual ~IntervalsProperties() {
- }
-
- std::string getParamId(){
- return _paramId;
- }
-
- void setParamId(std::string paramId_) {
- _paramId = paramId_;
- }
-
- std::string getIndexDef() const {
- return _indexDef;
- }
-
- void setIndexDef(std::string indexDef) {
- _indexDef = indexDef;
- }
-
- AMDA::Common::ParameterIndexComponentList& getIndexes()
- {
- return _indexList;
- }
-
- void setIndexes(AMDA::Common::ParameterIndexComponentList indexList)
- {
- _indexList = indexList;
- }
-
-private:
/**
- * @brief Calculated paramId (from resolution).
+ * Drawing properties for a parameter intervals.
*/
- std::string _paramId;
-
- /**
- * @brief Index definition (give by the request)
- */
- std::string _indexDef;
-
- /*
- * @brief List of components used by the spectro
- */
- AMDA::Common::ParameterIndexComponentList _indexList;
-};
+ class IntervalsProperties : public DrawingProperties
+ {
+ public:
+ friend std::ostream &operator<<(std::ostream &out_,
+ const IntervalsProperties &lprop_);
+
+ /*
+ * @brief Dumps properties for test.
+ */
+ void dump(std::ostream &out_, std::string &prefix_);
+
+ IntervalsProperties() : DrawingProperties(), _paramId(""), _indexDef(""), _font("sans-serif", 12)
+ {
+ }
+
+ IntervalsProperties(const DrawingProperties &ref_) : DrawingProperties(ref_), _paramId(""), _indexDef(""), _font("sans-serif", 12)
+ {
+ }
+
+ IntervalsProperties(const IntervalsProperties &pParamDrawingProperties_) : DrawingProperties(pParamDrawingProperties_), _paramId(""),
+ _indexDef(pParamDrawingProperties_._indexDef), _font("sans-serif", 12)
+ {
+ }
+
+ IntervalsProperties &operator=(const IntervalsProperties &ref_)
+ {
+ DrawingProperties::operator=(ref_);
+ _paramId = ref_._paramId;
+ _indexDef = ref_._indexDef;
+ return *this;
+ }
+
+ virtual ~IntervalsProperties()
+ {
+ }
+
+ std::string getParamId()
+ {
+ return _paramId;
+ }
+
+ void setParamId(std::string paramId_)
+ {
+ _paramId = paramId_;
+ }
+
+ std::string getIndexDef() const
+ {
+ return _indexDef;
+ }
+
+ void setIndexDef(std::string indexDef)
+ {
+ _indexDef = indexDef;
+ }
+
+ std::string getPosition() const
+ {
+ return _position;
+ }
+
+ void setPosition(std::string position)
+ {
+ _position = position;
+ }
+
+ std::string getText() const
+ {
+ return _text;
+ }
+
+ void setText(std::string text)
+ {
+ _text = text;
+ }
+
+ Font getFont() const
+ {
+ return _font;
+ }
+
+ void setFont(Font font)
+ {
+ _font = font;
+ }
+
+ AMDA::Common::ParameterIndexComponentList &getIndexes()
+ {
+ return _indexList;
+ }
+
+ void setIndexes(AMDA::Common::ParameterIndexComponentList indexList)
+ {
+ _indexList = indexList;
+ }
+
+ private:
+ /**
+ * @brief Calculated paramId (from resolution).
+ */
+ std::string _paramId;
+
+ /**
+ * @brief Index definition (give by the request)
+ */
+ std::string _indexDef;
+
+ std::string _position;
+
+ std::string _text = "";
+
+ Font _font;
+
+ /*
+ * @brief List of components used by the spectro
+ */
+ AMDA::Common::ParameterIndexComponentList _indexList;
+ };
} /* namespace plot */
diff --git a/src/ParamOutputImpl/Plot/PanelPlotOutput.cc b/src/ParamOutputImpl/Plot/PanelPlotOutput.cc
index 1abcb43..2d32fec 100644
--- a/src/ParamOutputImpl/Plot/PanelPlotOutput.cc
+++ b/src/ParamOutputImpl/Plot/PanelPlotOutput.cc
@@ -1980,10 +1980,10 @@ void PanelPlotOutput::drawTextLegends(void) {
double ymin = _plotAreaBounds._y;
double ymax = _plotAreaBounds._y + _plotAreaBounds._height;
- bool leftTextLegendFound = false;
+ /*bool leftTextLegendFound = false;
bool rightTextLegendFound = false;
bool topTextLegendFound = false;
- bool bottomTextLegendFound = false;
+ bool bottomTextLegendFound = false;*/
for (auto textLegend : _panel->_textLegendPropertiesList) {
if (textLegend->isDrawn())
@@ -2011,8 +2011,8 @@ void PanelPlotOutput::drawTextLegends(void) {
_pls->mtex("l", disp, 0.5, 0.5, textLines.at(textLines.size() - 1 - i).c_str());
disp += 1.5;
}
- leftTextLegendFound = true;
- //}
+ // leftTextLegendFound = true;
+ // }
break;
case TextLegendPosition::POS_RIGHT :
@@ -2023,9 +2023,9 @@ void PanelPlotOutput::drawTextLegends(void) {
_pls->mtex("r", disp, 0.5, 0.5, textLines.at(i).c_str());
disp += 1.5;
}
- rightTextLegendFound = true;
- //}
- break;
+ // rightTextLegendFound = true;
+ // }
+ break;
case TextLegendPosition::POS_TOP :
// if (topTextLegendFound == false) {
@@ -2035,9 +2035,9 @@ void PanelPlotOutput::drawTextLegends(void) {
_pls->mtex("t", disp, 0.5, 0.5, textLines.at(textLines.size() - 1 - i).c_str());
disp += 1.5;
}
- topTextLegendFound = true;
- //}
- break;
+ // topTextLegendFound = true;
+ // }
+ break;
case TextLegendPosition::POS_BOTTOM :
// if (bottomTextLegendFound == false) {
@@ -2047,9 +2047,9 @@ void PanelPlotOutput::drawTextLegends(void) {
_pls->mtex("b", disp, 0.5, 0.5, textLines.at(i).c_str());
disp += 1.5;
}
- bottomTextLegendFound = true;
- //}
- break;
+ // bottomTextLegendFound = true;
+ // }
+ break;
default :
break;
diff --git a/src/ParamOutputImpl/Plot/Time/TimePlot.cc b/src/ParamOutputImpl/Plot/Time/TimePlot.cc
index aa4c4c0..2c7bc39 100644
--- a/src/ParamOutputImpl/Plot/Time/TimePlot.cc
+++ b/src/ParamOutputImpl/Plot/Time/TimePlot.cc
@@ -276,16 +276,42 @@ namespace plot
void TimePlot::configureIntervalsLegend()
{
+ ParamMgr *piMgr = ParamMgr::getInstance();
for (auto param : _parameterAxesList)
{
- if (param.getIntervalsProperties() != nullptr)
- {
- std::cout << "BRE - INTERVALS LEGEND" << std::endl;
+ std::shared_ptr intervalsPropertiesPtr = param.getIntervalsProperties();
+ ParameterSPtr p = _parameterManager.getParameter(param._originalParamId);
+ AMDA::Info::ParamInfoSPtr paramInfo = piMgr->getParamInfoFromId(p->getInfoId());
+ if (intervalsPropertiesPtr != nullptr)
+ {
boost::shared_ptr pTextLegendProperties(new TextLegendProperties());
- pTextLegendProperties->setText("Coucou");
- pTextLegendProperties->setPosition(TextLegendPosition::POS_RIGHT);
- pTextLegendProperties->setFont(_panel->getFont());
+
+ if (intervalsPropertiesPtr->getText() != "")
+ {
+ pTextLegendProperties->setText(intervalsPropertiesPtr->getText());
+ }
+ else
+ {
+ pTextLegendProperties->setText(paramInfo->getShortName());
+ }
+
+ pTextLegendProperties->setColor(intervalsPropertiesPtr->getColor());
+ std::string Pos = intervalsPropertiesPtr->getPosition();
+
+ if (Pos == "POS_RIGHT")
+ pTextLegendProperties->setPosition(TextLegendPosition::POS_RIGHT);
+ else if (Pos == "POS_LEFT")
+ pTextLegendProperties->setPosition(TextLegendPosition::POS_LEFT);
+ else if (Pos == "POS_TOP")
+ pTextLegendProperties->setPosition(TextLegendPosition::POS_TOP);
+ else if (Pos == "POS_BOTTOM")
+ pTextLegendProperties->setPosition(TextLegendPosition::POS_BOTTOM);
+ else
+ pTextLegendProperties->setPosition(TextLegendPosition::POS_TOP);
+
+ pTextLegendProperties->setFont(intervalsPropertiesPtr->getFont());
+
_panel->_textLegendPropertiesList.push_back(pTextLegendProperties);
}
}
@@ -337,33 +363,36 @@ namespace plot
//set Y axis range
Range lYAxisRequestRange = lYAxis->Axis::getRequestedRange();
Range lYAxisRange = lYAxis->Axis::getRange();
-
+
AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(p->getInfoId());
-
-
-
+
if (isnan(lYAxisRequestRange.getMin()) && isnan(lYAxisRequestRange.getMax()))
{
boost::shared_ptr tableSPtr;
if (paramInfo != nullptr)
tableSPtr = paramInfo->getTable(spectroPropertiesPtr->getRelatedDim());
-
- if (tableSPtr == nullptr){
- // look for unique embedded table
- boost::shared_ptr linkedTableSPtr;
- int counter = 0;
- for (auto pInfo :paramInfo->getLinkedParamList()){
- linkedTableSPtr = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(pInfo)->getTable(spectroPropertiesPtr->getRelatedDim());
- if (linkedTableSPtr == nullptr)
- continue;
- counter ++;
- }
- if(linkedTableSPtr == nullptr || counter !=1){
- LOG4CXX_DEBUG(gLogger, "table cannot be defined from linked info params");
- }else{
- tableSPtr = linkedTableSPtr;
- }
- }
+
+ if (tableSPtr == nullptr)
+ {
+ // look for unique embedded table
+ boost::shared_ptr linkedTableSPtr;
+ int counter = 0;
+ for (auto pInfo : paramInfo->getLinkedParamList())
+ {
+ linkedTableSPtr = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(pInfo)->getTable(spectroPropertiesPtr->getRelatedDim());
+ if (linkedTableSPtr == nullptr)
+ continue;
+ counter++;
+ }
+ if (linkedTableSPtr == nullptr || counter != 1)
+ {
+ LOG4CXX_DEBUG(gLogger, "table cannot be defined from linked info params");
+ }
+ else
+ {
+ tableSPtr = linkedTableSPtr;
+ }
+ }
if (tableSPtr == nullptr)
{
@@ -484,9 +513,8 @@ namespace plot
lZAxis->setRange(lParamRange);
}
}
-
-
- void TimePlot::configureSauvaudAxis()
+
+ void TimePlot::configureSauvaudAxis()
{
// Parse each parameter to define on which axis to draw Sauvaud
for (auto param : _parameterAxesList)
@@ -509,7 +537,7 @@ namespace plot
}
lYAxis->_used = true;
-
+
//set Z axis range
boost::shared_ptr lZAxis = _panel->getAxis(sauvaudPropertiesPtr->getZAxisId());
if (lZAxis.get() == nullptr)
@@ -524,39 +552,37 @@ namespace plot
ParameterSPtr p = _parameterManager.getParameter(param._originalParamId);
int rightParameterDimension;
- int rightDim = sauvaudPropertiesPtr->getRightDim();
+ int rightDim = sauvaudPropertiesPtr->getRightDim();
if (rightDim == 0){
rightParameterDimension = (*_pParameterValues)[sauvaudPropertiesPtr->getParamId()].getDim1Size();
}else{
rightParameterDimension = (*_pParameterValues)[sauvaudPropertiesPtr->getParamId()].getDim2Size();
- }
+ }
//set Y axis range
-
AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(p->getInfoId());
-
- // configure right axis
- Range lYAxisRequestRange = lYAxis->Axis::getRequestedRange();
+
+ // configure right axis
+ Range lYAxisRequestRange = lYAxis->Axis::getRequestedRange();
Range lYAxisRange = lYAxis->Axis::getRange();
if (isnan(lYAxisRequestRange.getMin()) && isnan(lYAxisRequestRange.getMax()))
{
boost::shared_ptr rightTableSPtr;
-
- if (paramInfo != nullptr){
-
-
- rightTableSPtr = paramInfo->getTable(rightDim);
-
-
- }
+
+ if (paramInfo != nullptr)
+ {
+
+ rightTableSPtr = paramInfo->getTable(rightDim);
+ }
if (rightTableSPtr == nullptr)
{
LOG4CXX_DEBUG(gLogger, "No table defined => use index");
lYAxisRange.setMin(std::min(0., lYAxisRange.getMin()));
lYAxisRange.setMax(std::max((double)rightParameterDimension, lYAxisRange.getMax()));
}
- else{
- AMDA::Info::t_TableBound crtBound;
+ else
+ {
+ AMDA::Info::t_TableBound crtBound;
if (!rightTableSPtr->isVariable(&_parameterManager))
{
for (int i = 0; i < rightParameterDimension; ++i)
@@ -576,7 +602,7 @@ namespace plot
}
else
{
- //Variable table => we need to loop under all records to find axis min & max values
+ // Variable table => we need to loop under all records to find axis min & max values
for (int i = 0; i < (*_pParameterValues)[sauvaudPropertiesPtr->getParamId()].getSize(); ++i)
{
std::map> paramsTableData;
@@ -611,18 +637,17 @@ namespace plot
}
}
}
-
- }
-
+ }
+
//do not extend the axis
- lYAxisRange._extend = false;
+ lYAxisRange._extend = false;
fixRange(lYAxisRange, lYAxis->_scale == Axis::Scale::LOGARITHMIC);
lYAxis->setRange(lYAxisRange);
- LOG4CXX_DEBUG(gLogger, "Y right axis range : min = " << lYAxisRange.getMin() << ", max = " << lYAxisRange.getMax());
-
+ LOG4CXX_DEBUG(gLogger, "Y right axis range : min = " << lYAxisRange.getMin() << ", max = " << lYAxisRange.getMax());
+
Range lParamRange = lZAxis->Axis::getRange();
if (isnan(lParamRange.getMin()) && isnan(lParamRange.getMax()))
{
@@ -634,10 +659,10 @@ namespace plot
}
else
{
- //auto range
+ // auto range
for (auto index : sauvaudPropertiesPtr->getIndexes())
{
- //compute global range for all indexes
+ // compute global range for all indexes
double minVal, maxVal;
if (lZAxis->_scale == Axis::Scale::LOGARITHMIC)
minVal = (*_pParameterValues)[sauvaudPropertiesPtr->getParamId()].getMinStrictPos(index);
@@ -646,11 +671,11 @@ namespace plot
maxVal = (*_pParameterValues)[sauvaudPropertiesPtr->getParamId()].getMax(index);
if (!isnan(minVal))
lParamRange.setMin(std::min(minVal, lParamRange.getMin()));
- //else
+ // else
// lParamRange.setMin(0);
if (!isnan(maxVal))
lParamRange.setMax(std::max(maxVal, lParamRange.getMax()));
- //else
+ // else
// lParamRange.setMax(10);
}
if (isnan(lParamRange.getMin()))
diff --git a/src/ParamOutputImpl/Plot/Time/TimePlot.hh b/src/ParamOutputImpl/Plot/Time/TimePlot.hh
index b06a4b6..dbec0be 100644
--- a/src/ParamOutputImpl/Plot/Time/TimePlot.hh
+++ b/src/ParamOutputImpl/Plot/Time/TimePlot.hh
@@ -187,7 +187,7 @@ namespace plot
* @brief configure the TT/Catalogue intervals legend
*
*/
- void TimePlot::configureIntervalsLegend();
+ void configureIntervalsLegend();
/**
* @brief Retrieve ConstantLine informations for a given serieId and constantId.
*/
--
libgit2 0.21.2