TickPlotNode.cc 1.45 KB
/*
 * TickPlotNode.cc
 *
 *  Created on: 16 janv. 2014
 *      Author: CS
 */

#include "TickPlotNode.hh"
#include "PanelPlotNodeRegistry.hh"
#include "TickPlot.hh"
#include "PlotLogger.hh"
#include "ParamsNode.hh"
#include "PlotOutput.hh"
#include "NodeCfg.hh"
#include "TickMarkDecorator.hh"
#include "Time/TimePlot.hh"
#include <memory>

namespace plot {

const std::string TickPlotNode::NODENAME = TICKPLOT_NODENAME;

std::string TickPlotNode::_key =
		PanelPlotNodeRegistry::getInstance().addElement(NODENAME,
				boost::shared_ptr<TickPlotNode>(new TickPlotNode()));

TickPlotNode::TickPlotNode() :
		AbstractDecoratorPlotNode() {
}

TickPlotNode::~TickPlotNode() {

}

boost::shared_ptr<DecoratorPlot> TickPlotNode::createPlot(AMDA::Parameters::ParameterManager& manager, boost::shared_ptr<Panel> panel,
		bool isStandalone)
{
	LOG4CXX_DEBUG(gLogger, "TickPlotNode::createPlot");
	return boost::shared_ptr<TickPlot>(new TickPlot(manager, panel, isStandalone));
}

void TickPlotNode::parseAttributes(xmlNodePtr xmlNode_, boost::shared_ptr<DecoratorPlot> plot)
{
	LOG4CXX_DEBUG(gLogger, "TickPlotNode::parseAttributes");
	// parse optional attribute :
	xmlChar* value = NULL;
	// format attribute
	value = xmlGetProp(xmlNode_, (const xmlChar *) "format");
	if (value != nullptr) {
		TickMarkDecorator *tmd = static_cast<TickMarkDecorator *>(plot->getTimeAxisDecorator().get());
		tmd->setValuesFormat(std::string((const char*) value));
		xmlFree(value);
	}
}

} /* namespace plot */