Blame view

src/ParamOutputImpl/Plot/TimeTickNode.cc 1.58 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
/*
 * TimeTickNode.cc
 *
 *  Created on: July 22, 2014
 *      Author: AKKA
 */


#include "TimeTickNode.hh"

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

#include "NodeCfg.hh"
#include "PlotLogger.hh"
#include "SeriesProperties.hh"
#include "CommonNode.hh"


namespace plot {

void TimeTickNode::proceed(xmlNodePtr pNode_,const AMDA::Parameters::CfgContext& pContext_){
	LOG4CXX_DEBUG(gLogger, "TimeTickNode::proceed");

	DrawingProperties* props = pContext_.get<DrawingProperties*>();
	TimeTickProperties & ttProps = props->getTimeTickProperties();

	// read attributes :
	xmlChar* value = NULL;

	// TODO see if we have some default config values to retrieve...

	// overwrites default values if any...
	// step
	value = xmlGetProp(pNode_, (const xmlChar *)"step");
	if( value ){
		ttProps.setStep((const char*)value);
		xmlFree(value);
	}

	// number
	value = xmlGetProp(pNode_, (const xmlChar *)"number");
	if( value ){
		ttProps.setNumber( atoi((const char*)value) );
		xmlFree(value);
	}

	// minor
	value = xmlGetProp(pNode_, (const xmlChar *)"minor");
	if( value ){
		ttProps.setMinor( atoi((const char*)value) );
		xmlFree(value);
	}

	// -- color attributes
	updateColor (ttProps.getColor(), pNode_, (const xmlChar *)"color", (const xmlChar *)"colorMapIndex");

	// Push DrawingProperties & TimeTickProperties in a new context
	// before proceeding childs node
	AMDA::Parameters::CfgContext context;
	context.push<DrawingProperties *> (props);
	context.push<TimeTickProperties *> (&ttProps);

	// proceed children
	AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode_, context);
}

} /* namespace plot */