Blame view

src/ParamOutputImpl/Plot/IntervalsNode.hh 2.46 KB
e257cfb9   Benjamin Renard   First implementat...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * IntervalsNode.hh
 *
 *  Created on: Feb 4, 2019
 *      Author: AKKA
 */

#ifndef INTERVALSNODE_HH_
#define INTERVALSNODE_HH_

#include <libxml/globals.h>
#include <libxml/tree.h>
#include <libxml/xmlstring.h>
#include <iosfwd>

#include "FileConfigurator.hh"
#include "DrawingPropertiesNode.hh"
#include "PlotLogger.hh"
#include "IntervalsProperties.hh"
ac0e4b16   Erdogan Furkan   Some modifications
20
#include "PlotLegendNode.hh"
e257cfb9   Benjamin Renard   First implementat...
21
22
23
24
25
26
27
28
29
30
31
32

namespace plot {
/**
 * Class that handle a <intervals> xml node.
 * Template class that should be instanciated for each subclass of PanelOutputPanel.
 */

template<class PlotType>
class IntervalsNode: public plot::DrawingPropertiesNode<PlotType> {
public:
	IntervalsNode():
		DrawingPropertiesNode<PlotType>() {
ac0e4b16   Erdogan Furkan   Some modifications
33
34
		DrawingPropertiesNode<PlotType>::getChildList()["textLegend"] = AMDA::XMLConfigurator::NodeCfgSPtr(
			new TextLegendNode());
e257cfb9   Benjamin Renard   First implementat...
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
	}
	virtual ~IntervalsNode() {
	}

	void proceed(xmlNodePtr pNode_,const AMDA::Parameters::CfgContext& pContext_) {
		LOG4CXX_DEBUG(gLogger, "IntervalsNode::proceed");
		PlotType* plotOutput = pContext_.get<PlotType*>();
		xmlChar* name = pContext_.get<xmlChar*>();

		// initialize intervals with default properties
		DrawingProperties defaultProps = plotOutput->getParameter(
				(const char*) name).getDefaultProperties();

		// read parent attributes
		DrawingPropertiesNode<PlotType>::parseAttributes(pNode_, defaultProps);

		// intervals properties
		std::shared_ptr<IntervalsProperties> intervalsPropsPtr =
				std::shared_ptr<IntervalsProperties>(new IntervalsProperties(defaultProps));

		// read index definition
		xmlChar * value = NULL;

		value = xmlGetProp(pNode_, (const xmlChar*) "index");
		if (value) {
			intervalsPropsPtr->setIndexDef((const char*) value);
			xmlFree(value);
		}
2c182978   Erdogan Furkan   First step
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
		// -- color
		Color color(255, 0, 0);
		value = xmlGetProp(pNode_, (const xmlChar *)"color");
		if (value)
		{
			try
			{
				std::string strValue((const char *)value);
				createColor(color, strValue);
			}
			catch (std::logic_error &e)
			{
				LOG4CXX_WARN(gLogger, "Intervals Color : " << e.what());
			}
			xmlFree(value);
		}
		intervalsPropsPtr->setColor(color);
e257cfb9   Benjamin Renard   First implementat...
80
81
		// add intervals definition to parameter
		plotOutput->getParameter((const char*)name).addIntervalsProperties(intervalsPropsPtr);
0fa2d990   Erdogan Furkan   7616 - Adding lab...
82

ac0e4b16   Erdogan Furkan   Some modifications
83
84
85
		AMDA::Parameters::CfgContext context;
		context.push<Panel *>(plotOutput->_panel.get());
		context.push<IntervalsProperties *>(intervalsPropsPtr.get());
0fa2d990   Erdogan Furkan   7616 - Adding lab...
86

ac0e4b16   Erdogan Furkan   Some modifications
87
		AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode_, context);
e257cfb9   Benjamin Renard   First implementat...
88
89
90
91
92
93
94
	}
};

}
/* namespace plot */

#endif /* INTERVALSNODE_HH_ */