Blame view

src/ParamOutputImpl/Plot/TickPlot/TickPlotNode.cc 1.45 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
/*
 * TickPlotNode.cc
 *
 *  Created on: 16 janv. 2014
 *      Author: CS
 */

#include "TickPlotNode.hh"
#include "PanelPlotNodeRegistry.hh"
#include "TickPlot.hh"
#include "PlotLogger.hh"
#include "ParamsNode.hh"
#include "PlotOutput.hh"
#include "NodeCfg.hh"
#include "TickMarkDecorator.hh"
#include "Time/TimePlot.hh"
#include <memory>

namespace plot {

const std::string TickPlotNode::NODENAME = TICKPLOT_NODENAME;

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

TickPlotNode::TickPlotNode() :
		AbstractDecoratorPlotNode() {
}

TickPlotNode::~TickPlotNode() {

}

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

void TickPlotNode::parseAttributes(xmlNodePtr xmlNode_, boost::shared_ptr<DecoratorPlot> plot)
{
	LOG4CXX_DEBUG(gLogger, "TickPlotNode::parseAttributes");
	// parse optional attribute :
	xmlChar* value = NULL;
	// format attribute
	value = xmlGetProp(xmlNode_, (const xmlChar *) "format");
	if (value != nullptr) {
		TickMarkDecorator *tmd = static_cast<TickMarkDecorator *>(plot->getTimeAxisDecorator().get());
		tmd->setValuesFormat(std::string((const char*) value));
		xmlFree(value);
	}
}

} /* namespace plot */