/* * IntervalsNode.hh * * Created on: Feb 4, 2019 * Author: AKKA */ #ifndef INTERVALSNODE_HH_ #define INTERVALSNODE_HH_ #include #include #include #include #include "FileConfigurator.hh" #include "DrawingPropertiesNode.hh" #include "PlotLogger.hh" #include "IntervalsProperties.hh" #include "PlotLegendNode.hh" namespace plot { /** * Class that handle a xml node. * Template class that should be instanciated for each subclass of PanelOutputPanel. */ template class IntervalsNode: public plot::DrawingPropertiesNode { public: IntervalsNode(): DrawingPropertiesNode() { DrawingPropertiesNode::getChildList()["textLegend"] = AMDA::XMLConfigurator::NodeCfgSPtr( new TextLegendNode()); } virtual ~IntervalsNode() { } void proceed(xmlNodePtr pNode_,const AMDA::Parameters::CfgContext& pContext_) { LOG4CXX_DEBUG(gLogger, "IntervalsNode::proceed"); PlotType* plotOutput = pContext_.get(); xmlChar* name = pContext_.get(); // initialize intervals with default properties DrawingProperties defaultProps = plotOutput->getParameter( (const char*) name).getDefaultProperties(); // read parent attributes DrawingPropertiesNode::parseAttributes(pNode_, defaultProps); // intervals properties std::shared_ptr intervalsPropsPtr = std::shared_ptr(new IntervalsProperties(defaultProps)); // read index definition xmlChar * value = NULL; value = xmlGetProp(pNode_, (const xmlChar*) "index"); if (value) { intervalsPropsPtr->setIndexDef((const char*) value); xmlFree(value); } // -- color Color color(255, 0, 0); value = xmlGetProp(pNode_, (const xmlChar *)"color"); if (value) { try { std::string strValue((const char *)value); createColor(color, strValue); } catch (std::logic_error &e) { LOG4CXX_WARN(gLogger, "Intervals Color : " << e.what()); } xmlFree(value); } intervalsPropsPtr->setColor(color); // add intervals definition to parameter plotOutput->getParameter((const char*)name).addIntervalsProperties(intervalsPropsPtr); AMDA::Parameters::CfgContext context; context.push(plotOutput->_panel.get()); context.push(intervalsPropsPtr.get()); AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode_, context); } }; } /* namespace plot */ #endif /* INTERVALSNODE_HH_ */