diff --git a/config/DataBaseParameters/xsd/request/plot.xsd b/config/DataBaseParameters/xsd/request/plot.xsd
index d15f095..4959633 100644
--- a/config/DataBaseParameters/xsd/request/plot.xsd
+++ b/config/DataBaseParameters/xsd/request/plot.xsd
@@ -386,7 +386,8 @@
-
+
+
-
@@ -635,6 +636,7 @@
+
diff --git a/config/DataBaseParameters/xsd/request/request.xsd b/config/DataBaseParameters/xsd/request/request.xsd
index b80dce0..2883965 100644
--- a/config/DataBaseParameters/xsd/request/request.xsd
+++ b/config/DataBaseParameters/xsd/request/request.xsd
@@ -11,7 +11,7 @@
-
+
diff --git a/src/ParamOutputImpl/Plot/CommonNode.cc b/src/ParamOutputImpl/Plot/CommonNode.cc
index 1ae49ce..51767c6 100644
--- a/src/ParamOutputImpl/Plot/CommonNode.cc
+++ b/src/ParamOutputImpl/Plot/CommonNode.cc
@@ -21,14 +21,14 @@ void MarginNode::proceed(xmlNodePtr pNode,
// -- horizontal margin
value = xmlGetProp(pNode, (const xmlChar *) "x");
if (value) {
- element->_xMargin = atof((const char*) value);
+ element->calculateRelativeXMargin(element->_orientation, element->_dimension, atof((const char*) value));
xmlFree(value);
}
// -- vertical margin
value = xmlGetProp(pNode, (const xmlChar *) "y");
if (value) {
- element->_yMargin = atof((const char*) value);
+ element->calculateRelativeYMargin(element->_orientation, element->_dimension, atof((const char*) value));
xmlFree(value);
}
}
diff --git a/src/ParamOutputImpl/Plot/Page.cc b/src/ParamOutputImpl/Plot/Page.cc
index d275fc3..116e0b1 100644
--- a/src/ParamOutputImpl/Plot/Page.cc
+++ b/src/ParamOutputImpl/Plot/Page.cc
@@ -262,13 +262,22 @@ void Page::draw(std::shared_ptr& pls, bool newFile, const char *plotFi
// write title with dedicated position and align settings
pls->col0(0);
+ Color lInitialColor = changeColor(pls, _title._color, _mode);
+
// use page font if title font is not set
pls->sfont(getPlFontFamily(_title._font.isSet() ? _title._font : _font),
- getPlFontStyle(_title._style), getPlFontWeight(_title._style));
- pls->schr(getPlFontDef(_font), getPlFontScaleFactor(_font));
+ (_title._font.isSet() ? getPlFontStyle(_title._style) : _font._style),
+ (_title._font.isSet() ? getPlFontWeight(_title._style) : _font._weight));
+ if (_title._font.isSet())
+ pls->schr(getPlFontDef(_title._font), getPlFontScaleFactor(_title._font));
+ else
+ pls->schr(getPlFontDef(_font), getPlFontScaleFactor(_font));
pls->mtex(getPlSide(_titlePosition).c_str(), -1., getPlPos(_titleAlign),
getPlJust(_titleAlign), _title._text.c_str());
+ // Restore initial color.
+ restoreColor(pls, lInitialColor, _mode);
+
// write Created by AMDA(c) on bottom write
// write it on bottom right
// if HIDE_AMDA_DATE is not defined (used for fitnesse automatic image comparison)
@@ -290,15 +299,26 @@ void Page::writeCopywrite(std::shared_ptr& pls) {
timeinfo = localtime(&rawtime);
strftime(buffer, 80, "%d/%m/%G %T", timeinfo);
+ //set viewport
+ pls->vpor(0, 1, 0, 1);
+
+ //use page font
+ std::vector styles;
+ pls->sfont(getPlFontFamily(_font), getPlFontStyle(styles), getPlFontWeight(styles));
+ pls->schr(getPlFontDef(_font), getPlFontScaleFactor(_font));
+
+
// write text on right bottom of the page
pls->mtex("b", -1., 1, 1,
std::string(createdby + " v" + version + " " + std::string(buffer)).c_str());
}
void Page::initPageParameters(std::shared_ptr& pls) {
- // calculate default margin if not set
- calculateXMargin(_orientation, _dimension);
- calculateYMargin(_orientation, _dimension);
+ // get default margin if not set
+ if (_xMargin == -1)
+ _xMargin = DefaultPlotConfiguration::getInstance()._defaultPage._xMargin;
+ if (_yMargin == -1)
+ _yMargin = DefaultPlotConfiguration::getInstance()._defaultPage._yMargin;
// set page size according to page format A4 or letter
// offset not seams to work
@@ -322,12 +342,8 @@ void Page::initPageParameters(std::shared_ptr& pls) {
pls->setopt("dpi", dpi.str().c_str());
}
-void Page::calculateXMargin(PlotCommon::Orientation& orientation,
- PlotCommon::Dimension& dimension) {
- if (_xMargin != -1) {
- return;
- }
-
+void Page::calculateRelativeXMargin(PlotCommon::Orientation& orientation,
+ PlotCommon::Dimension& dimension, float xMarginInMm) {
float xlengthInMm;
switch (dimension) {
case PlotCommon::Dimension::US_letter:
@@ -345,17 +361,11 @@ void Page::calculateXMargin(PlotCommon::Orientation& orientation,
xlengthInMm = Page::A4_Y_LENGTH_IN_MM;
}
}
- // default xmargin in mm, return margin as relative coordinate
- _xMargin = DefaultPlotConfiguration::getInstance()._defaultPage._xMargin
- / xlengthInMm;
+ _xMargin = xMarginInMm / xlengthInMm;
}
-void Page::calculateYMargin(PlotCommon::Orientation& orientation,
- PlotCommon::Dimension& dimension) {
- if (_yMargin != -1) {
- return;
- }
-
+void Page::calculateRelativeYMargin(PlotCommon::Orientation& orientation,
+ PlotCommon::Dimension& dimension, float yMarginInMm) {
float ylengthInMm;
switch (dimension) {
case PlotCommon::Dimension::US_letter:
@@ -373,9 +383,7 @@ void Page::calculateYMargin(PlotCommon::Orientation& orientation,
ylengthInMm = Page::A4_X_LENGTH_IN_MM;
}
}
- // default xmargin in mm, return margin as relative coordinate
- _yMargin = DefaultPlotConfiguration::getInstance()._defaultPage._yMargin
- / ylengthInMm;
+ _yMargin = yMarginInMm / ylengthInMm;
}
std::ostream& operator <<(std::ostream& out, Page& page) {
diff --git a/src/ParamOutputImpl/Plot/Page.hh b/src/ParamOutputImpl/Plot/Page.hh
index 8e565d3..a88e084 100644
--- a/src/ParamOutputImpl/Plot/Page.hh
+++ b/src/ParamOutputImpl/Plot/Page.hh
@@ -166,17 +166,17 @@ public:
*/
bool _superposeMode;
+ void calculateRelativeXMargin(PlotCommon::Orientation& orientation,
+ PlotCommon::Dimension& dimension, float xMarginInMm);
+ void calculateRelativeYMargin(PlotCommon::Orientation& orientation,
+ PlotCommon::Dimension& dimension, float yMarginInMm);
+
private:
void initPageParameters(std::shared_ptr& pls);
void writeCopywrite(std::shared_ptr& pls);
- void calculateXMargin(PlotCommon::Orientation& orientation,
- PlotCommon::Dimension& dimension);
- void calculateYMargin(PlotCommon::Orientation& orientation,
- PlotCommon::Dimension& dimension);
-
};
std::ostream& operator <<(std::ostream& out, Page& page);
diff --git a/src/ParamOutputImpl/Plot/PlotNode.cc b/src/ParamOutputImpl/Plot/PlotNode.cc
index d0105b2..b77cdfd 100644
--- a/src/ParamOutputImpl/Plot/PlotNode.cc
+++ b/src/ParamOutputImpl/Plot/PlotNode.cc
@@ -19,6 +19,7 @@ namespace plot {
PlotNode::PlotNode() :
NodeGrpCfg() {
getChildList()["outputStructure"] = AMDA::XMLConfigurator::NodeCfgSPtr(new OutputStructureNode());
+ getChildList()["filePrefix"] = AMDA::XMLConfigurator::NodeCfgSPtr(new FilePrefixNode());
getChildList()["page"] = AMDA::XMLConfigurator::NodeCfgSPtr(new PageNode());
getChildList()["postProcess"] = AMDA::XMLConfigurator::NodeCfgSPtr(
new postprocessing::PostProcessingNode());
@@ -55,4 +56,14 @@ void OutputStructureNode::proceed(xmlNodePtr pNode,
(const char*) pNode->children->content);
}
+void FilePrefixNode::proceed(xmlNodePtr pNode,
+ const AMDA::Parameters::CfgContext& pContext) {
+ LOG4CXX_DEBUG(gLogger, "FilePrefixNode::proceed")
+
+ PlotOutput* lPlotOutput =
+ pContext.get();
+ lPlotOutput->setFilePrefix(
+ (const char*) pNode->children->content);
+}
+
} /* namespace plot */
diff --git a/src/ParamOutputImpl/Plot/PlotNode.hh b/src/ParamOutputImpl/Plot/PlotNode.hh
index 555d179..beb976f 100644
--- a/src/ParamOutputImpl/Plot/PlotNode.hh
+++ b/src/ParamOutputImpl/Plot/PlotNode.hh
@@ -30,5 +30,16 @@ public:
const AMDA::Parameters::CfgContext& pContext);
};
+/**
+ * @class FilePrefixNode
+ * @brief read the "filePrefix" node.
+ */
+class FilePrefixNode: public AMDA::XMLConfigurator::NodeCfg {
+public:
+ void proceed(xmlNodePtr pNode,
+ const AMDA::Parameters::CfgContext& pContext);
+};
+
+
} /* namespace plot */
#endif /* PLOTNODE_HH_ */
diff --git a/src/ParamOutputImpl/Plot/PlotOutput.cc b/src/ParamOutputImpl/Plot/PlotOutput.cc
index 618fa4f..66e33bc 100644
--- a/src/ParamOutputImpl/Plot/PlotOutput.cc
+++ b/src/ParamOutputImpl/Plot/PlotOutput.cc
@@ -17,7 +17,7 @@ namespace plot {
PlotOutput::PlotOutput(AMDA::Parameters::ParameterManager& pParameterManager) :
AMDA::Parameters::VisitorOfParamData(), ParamOutput(pParameterManager),
- _currentParamId(""), _outputStructure(OutputStructure::ONE_FILE_PER_INTERVAL) {
+ _currentParamId(""), _outputStructure(OutputStructure::ONE_FILE_PER_INTERVAL), _filePrefix("plot") {
}
@@ -151,9 +151,9 @@ void PlotOutput::initNewPage(int intervalIndex)
if ((_timeIntervalList->size() > 1) &&
(_outputStructure == OutputStructure::ONE_FILE_PER_INTERVAL) &&
!_page->_superposeMode)
- plotFilePrefix << "plot_" << intervalIndex << "_";
+ plotFilePrefix << _filePrefix << "_" << intervalIndex << "_";
else
- plotFilePrefix << "plot_";
+ plotFilePrefix << _filePrefix << "_";
//draw page
_page->draw(_pls, newFile, plotFilePrefix.str().c_str());
diff --git a/src/ParamOutputImpl/Plot/PlotOutput.hh b/src/ParamOutputImpl/Plot/PlotOutput.hh
index 116364e..cbbeaa4 100644
--- a/src/ParamOutputImpl/Plot/PlotOutput.hh
+++ b/src/ParamOutputImpl/Plot/PlotOutput.hh
@@ -70,6 +70,15 @@ public:
}
}
+ /**
+ * @brief sets the file prefix to use.
+ */
+ void setFilePrefix(const std::string& filePrefix)
+ {
+ LOG4CXX_DEBUG(gLogger,"PlotOutput::setFilePrefix " << filePrefix);
+ _filePrefix = filePrefix;
+ }
+
AMDA::Parameters::ParameterManager& getParameterManager(){
return _parameterManager;
}
@@ -270,6 +279,11 @@ private:
* Files to output, default is ONE_FILE_PER_INTERVAL
*/
OutputStructure _outputStructure;
+
+ /**
+ * File prefix to use
+ */
+ std::string _filePrefix;
};
} /* namespace plot */
--
libgit2 0.21.2