InstantPlotNode.cc
2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* InstantPlotNode.cc
*
* Created on: Dec 6, 2013
* Author: amdadev
*/
#include "InstantPlotNode.hh"
#include "PlotLogger.hh"
#include "PanelPlotNodeRegistry.hh"
#include "InstantPlot.hh"
#include "AxesNode.hh"
#include "PlotLegendNode.hh"
#include "FillsNode.hh"
// DD_Client_r_lib module includes
#include "TimeUtil.hh"
namespace plot {
const std::string InstantPlotNode::NODENAME = INSTANTPLOT_NODENAME;
std::string InstantPlotNode::_key = PanelPlotNodeRegistry::getInstance().addElement(
NODENAME, boost::shared_ptr<InstantPlotNode>(new InstantPlotNode()));
InstantPlotNode::InstantPlotNode() :
AbstractPanelPlotNode() {
getChildList()["legends"] = AMDA::XMLConfigurator::NodeCfgSPtr(
new PlotLegendNode());
getChildList()["params"] = AMDA::XMLConfigurator::NodeCfgSPtr(
new InstantPlotParamsNode<InstantPlot>());
getChildList()["axes"] = AMDA::XMLConfigurator::NodeCfgSPtr(new AxesNode());
getChildList()["fills"] = AMDA::XMLConfigurator::NodeCfgSPtr(new FillsNode());
}
InstantPlotNode::~InstantPlotNode() {
}
boost::shared_ptr<PanelPlotOutput> InstantPlotNode::proceed(xmlNodePtr pNode_,
PlotOutput* plotManager_, Panel* panel_) {
LOG4CXX_DEBUG(gLogger, "InstantPlotNode::proceed");
boost::shared_ptr<InstantPlot> plot(
new InstantPlot(plotManager_->getParameterManager(),
boost::shared_ptr<Panel>(panel_)));
// Copy default pages values for the panel if not already specified
if (panel_->_leftMargin == -1)
panel_->_leftMargin = panel_->_page->_defaultXYPlotLeftMargin;
if (panel_->_rightMargin == -1)
panel_->_rightMargin = panel_->_page->_defaultXYPlotRightMargin;
if (panel_->_topMargin == -1)
panel_->_topMargin = panel_->_page->_defaultXYPlotTopMargin;
if (panel_->_bottomMargin == -1)
panel_->_bottomMargin = panel_->_page->_defaultXYPlotBottomMargin;
if (panel_->_preferedWidth == -1)
panel_->_preferedWidth = panel_->_page->_defaultXYPlotWidth;
if (panel_->_preferedHeight == -1)
panel_->_preferedHeight = panel_->_page->_defaultXYPlotHeight;
// -- read time attribute
xmlChar* value;
value = xmlGetProp(pNode_, (const xmlChar *) "time");
if (value) {
plot->setTime(DD_Time2Double((const char*)value));
xmlFree(value);
}
AMDA::Parameters::CfgContext context;
context.push<PanelPlotOutput*>(plot.get());
context.push<InstantPlot*>(plot.get());
context.push<Panel*>(panel_);
AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode_, context);
return plot;
}
} /* namespace plot */