ErrorBarNode.cc 2.29 KB
/*
 * ErrorBarNode.cc
 *
 *  Created on: July 22, 2014
 *      Author: AKKA
 */


#include "ErrorBarNode.hh"

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

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


namespace plot {

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

	ErrorBarProperties* errorBarProps = pContext_.get<ErrorBarProperties*>();
	boost::shared_ptr<ErrorMinMaxProperties> errorMinMax(new ErrorMinMaxProperties ());


	xmlChar* value = NULL;

	// -- paramMin
	if ((value = xmlGetProp(pNode, (const xmlChar *) "paramMin"))) {
		errorMinMax->setOriginalParamMin((const char*) value);
		xmlFree(value);
	}

	// -- paramMax
	if ((value = xmlGetProp(pNode, (const xmlChar *) "paramMax"))) {
		errorMinMax->setOriginalParamMax((const char*) value);
		xmlFree(value);
	}

	errorBarProps->setErrorMinMax(errorMinMax);

	// proceed children
	AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode, pContext_);
}

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

	ErrorBarProperties* errorBarProps = pContext_.get<ErrorBarProperties*>();
	boost::shared_ptr<ErrorMinMaxProperties> errorDelta(new ErrorMinMaxProperties ());

	xmlChar* value = NULL;

	// -- param
	if ((value = xmlGetProp(pNode, (const xmlChar *) "param"))) {
		errorDelta->setOriginalParamMin((const char*) value);
		errorDelta->setOriginalParamMax((const char*) value);
		xmlFree(value);
	}

	errorBarProps->setErrorMinMax(errorDelta);

	// proceed children
	AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode, pContext_);
}

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

	DrawingProperties* props = pContext_.get<DrawingProperties*>();
	ErrorBarProperties & ebProps = props->getErrorBarProperties();

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

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

} /* namespace plot */