Blame view

src/ParamOutputImpl/Plot/StatusPlot/StatusPlotNode.cc 1.87 KB
fbe3c2bb   Benjamin Renard   First commit
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
/*
 * StatusPlotNode.cc
 *
 *  Created on: 12 janv. 2015
 *      Author: AKKA
 */

#include "StatusPlotNode.hh"
#include "PanelPlotNodeRegistry.hh"
#include "StatusPlot.hh"
#include "PlotLogger.hh"
#include "ParamsNode.hh"
#include "PlotOutput.hh"
#include "PlotCommon.hh"
#include "NodeCfg.hh"
#include "StatusBarDecorator.hh"
#include "Time/TimePlot.hh"
#include <memory>

namespace plot {

const std::string StatusPlotNode::NODENAME = STATUSPLOT_NODENAME;

std::string StatusPlotNode::_key =
		PanelPlotNodeRegistry::getInstance().addElement(NODENAME,
				boost::shared_ptr<StatusPlotNode>(new StatusPlotNode()));

StatusPlotNode::StatusPlotNode() :
		AbstractDecoratorPlotNode() {
}

StatusPlotNode::~StatusPlotNode() {

}

boost::shared_ptr<DecoratorPlot> StatusPlotNode::createPlot(AMDA::Parameters::ParameterManager& manager, boost::shared_ptr<Panel> panel,
		bool isStandalone)
{
	LOG4CXX_DEBUG(gLogger, "StatusPlotNode::createPlot");
	return boost::shared_ptr<StatusPlot>(new StatusPlot(manager, panel, isStandalone));
}

void StatusPlotNode::parseAttributes(xmlNodePtr xmlNode_, boost::shared_ptr<DecoratorPlot> plot)
{
	LOG4CXX_DEBUG(gLogger, "StatusPlotNode::parseAttributes");
	// parse optional attribute :
	xmlChar* value = NULL;

	// colorMapIndex attribute
	value = xmlGetProp(xmlNode_, (const xmlChar *) "colorMapIndex");
	if (value != nullptr) {
		StatusBarDecorator *sbd = static_cast<StatusBarDecorator *>(plot->getTimeAxisDecorator().get());
		sbd->setColorMapIndex(atoi((const char*) value));
		xmlFree(value);
	}

	// position attribute
	value = xmlGetProp(xmlNode_, (const xmlChar *) "position");
	if (value != nullptr) {
		PlotCommon::Position position;
		PlotCommon::setPosition((const char*) value, position);
		StatusBarDecorator *sbd = static_cast<StatusBarDecorator *>(plot->getTimeAxisDecorator().get());
		sbd->setBarPosition(position);
		xmlFree(value);
	}
}

} /* namespace plot */