Blame view

src/ParamOutputImpl/Plot/ParamsNode.hh 2.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
/*
 * ParamsNode.hh
 *
 *  Created on: 21 nov. 2013
 *      Author: CS
 */

#ifndef PARAMSNODE_HH_
#define PARAMSNODE_HH_

#include "NodeCfg.hh"
#include "PlotLogger.hh"
#include "CommonNode.hh"
#include "DefaultPlotConfiguration.hh"
#include "PanelPlotOutput.hh"
#include "DrawingPropertiesNode.hh"
#include "SeriesNode.hh"
#include "SpectroNode.hh"
5f13f59c   Hacene SI HADJ MOHAND   in progress worki...
19
#include "SauvaudNode.hh"
e257cfb9   Benjamin Renard   First implementat...
20
#include "IntervalsNode.hh"
fbe3c2bb   Benjamin Renard   First commit
21
22
23
24
25
26
27
28
29
30
31
32
33
34

namespace plot {

template<class PlotType>
class ParamNode: public AMDA::XMLConfigurator::NodeGrpCfg {
public:
	ParamNode() :
			AMDA::XMLConfigurator::NodeGrpCfg() {
		getChildList()["default"] = AMDA::XMLConfigurator::NodeCfgSPtr(
				new DrawingPropertiesNode<PlotType>());
		getChildList()["serie"] = AMDA::XMLConfigurator::NodeCfgSPtr(
				new SeriesNode<PlotType>());
		getChildList()["spectro"] = AMDA::XMLConfigurator::NodeCfgSPtr(
						new SpectroNode<PlotType>());
5f13f59c   Hacene SI HADJ MOHAND   in progress worki...
35
36
                                        getChildList()["sauvaud"] = AMDA::XMLConfigurator::NodeCfgSPtr(
						new SauvaudNode<PlotType>());
e257cfb9   Benjamin Renard   First implementat...
37
38
		getChildList()["intervals"] = AMDA::XMLConfigurator::NodeCfgSPtr(
						new IntervalsNode<PlotType>());
fbe3c2bb   Benjamin Renard   First commit
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
82
83
84
85
86
87
88
89
90
91
92
		getChildList()["colorserie"] = AMDA::XMLConfigurator::NodeCfgSPtr(
				new ColorSeriesNode<PlotType>());
	}

	virtual ~ParamNode() {
	}

	void proceed(xmlNodePtr pNode,
			const AMDA::Parameters::CfgContext& pContext) {
		LOG4CXX_DEBUG(gLogger, "ParamNode::proceed");
		PlotType* plotOutput = pContext.get<PlotType*>();
		xmlChar* name = NULL;
		// -- param id
		name = xmlGetProp(pNode, (const xmlChar *) "id");
		if (name) {
			plotOutput->addParam((const char*) name);
		}

		// initialize drawing default properties object:
		DrawingProperties props;
		// take default value during init...
		DefaultPlotConfiguration::getInstance().applyDefaultDrawingProperties(
				plotOutput->typeName(),
				props
				);
		// add default properties to parameter
		plotOutput->getParameter((const char*)name).setDefaultProperties( props );

		AMDA::Parameters::CfgContext context;
		context.push<xmlChar*>(name);
		context.push<PlotType*>(plotOutput);
		AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode, context);

		if (name) {
			xmlFree (name);
		}
	}
};

template<class PlotType>
class ParamsNode: public AMDA::XMLConfigurator::NodeGrpCfg {
public:
	ParamsNode() :
			AMDA::XMLConfigurator::NodeGrpCfg() {
		getChildList()["param"] = AMDA::XMLConfigurator::NodeCfgSPtr(
				new ParamNode<PlotType>());
	}

	virtual ~ParamsNode() {
	}
};

} /* namespace plot */
#endif /* PARAMSNODE_HH_ */