LayoutNode.cc
1.82 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* LayoutNode.cc
*
* Created on: Sep, 2, 2014
* Author: AKKA
*/
#ifndef LAYOUTNODE_CC_
#define LAYOUTNODE_CC_
#include "LayoutNode.hh"
#include <libxml/tree.h>
#include <iosfwd>
#include "Page.hh"
#include "NodeCfg.hh"
#include "PlotLogger.hh"
#include "CommonNode.hh"
namespace plot {
void LayoutNode::proceed(xmlNodePtr pNode_,const AMDA::Parameters::CfgContext& pContext_){
LOG4CXX_DEBUG(gLogger, "LayoutNode::proceed");
Page *page = pContext_.get<Page*>();
// read attributes :
xmlChar* value = NULL;
// overwrites default values if any...
// type
value = xmlGetProp(pNode_, (const xmlChar *)"type");
if( value ){
try{
page->_layoutProperties.setType( stoLayoutType.at(std::string((const char*)value)) );
// std::cout << "@type="<< value<< std::endl;
}
catch( std::out_of_range& err ){
std::ostringstream msg {};
msg << "LayoutNode::proceed invalid LayoutType value:" << value <<". Using default value.";
LOG4CXX_DEBUG(gLogger, msg.str());
}
xmlFree(value);
}
// panelHeight
value = xmlGetProp(pNode_, (const xmlChar *)"panelHeight");
if( value ){
page->_layoutProperties.setPanelHeight( std::stod ((const char*)value));
xmlFree(value);
}
// panelSpacing
value = xmlGetProp(pNode_, (const xmlChar *)"panelSpacing");
if( value ){
page->_layoutProperties.setPanelSpacing( std::stod ((const char*)value));
xmlFree(value);
}
// firstPanelHeightFactor
value = xmlGetProp(pNode_, (const xmlChar *)"firstPanelHeightFactor");
if( value ){
page->_layoutProperties.setFirstPanelHeightFactor( std::stod ((const char*)value));
xmlFree(value);
}
// expand
value = xmlGetProp(pNode_, (const xmlChar *)"expand");
if( value ){
page->_layoutProperties.setExpand( strcasecmp ((const char*)value, "true") == 0);
xmlFree(value);
}
}
} /* namespace plot */
#endif /* LAYOUTNODE_CC_ */