/* * FillsNode.hh * * Created on: 14/08/2014 * Author: AKKA */ #ifndef FILLSNODE_HH_ #define FILLSNODE_HH_ #include "NodeCfg.hh" #include "CommonNode.hh" #include "FillSerieConstant.hh" #include "FillSerieSerie.hh" namespace plot { class FillSerieConstantNode: public AMDA::XMLConfigurator::NodeCfg { public: FillSerieConstantNode() : AMDA::XMLConfigurator::NodeCfg() { } virtual ~FillSerieConstantNode() {} void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { LOG4CXX_DEBUG(gLogger, "FillSerieConstantNode::proceed"); xmlChar* value = NULL; // Retrieve panel where to store fills informations Panel* panel = pContext.get(); // Build a new FillSerieConstant and populate it... boost::shared_ptr fillSerieConstant (new FillSerieConstant ()); // -- serieId value = xmlGetProp(pNode, (const xmlChar *) "serieId"); if (value) { fillSerieConstant->setSerieId(atoi((const char*) value)); xmlFree(value); } // -- constantId value = xmlGetProp(pNode, (const xmlChar *) "constantId"); if (value) { fillSerieConstant->setConstantId(atoi((const char*) value)); xmlFree(value); } // -- colorGreater (ColorGreaterSpecified set To false if no color specified in the request) value = xmlGetProp(pNode, (const xmlChar *) "colorGreater"); if (value) { fillSerieConstant->setColorGreaterSpecified(true); updateColor( fillSerieConstant->getColorGreater(), pNode,(const xmlChar*)"colorGreater",(const xmlChar*)"colorMapIndex"); xmlFree(value); } else { fillSerieConstant->setColorGreaterSpecified(false); } // -- colorLess (ColorLessSpecified set To false if no color specified in the request) value = xmlGetProp(pNode, (const xmlChar *) "colorLess"); if (value) { fillSerieConstant->setColorLessSpecified(true); updateColor( fillSerieConstant->getColorLess(), pNode,(const xmlChar*)"colorLess",(const xmlChar*)"colorMapIndex"); xmlFree(value); } else { fillSerieConstant->setColorLessSpecified(false); } // Add the new FillSerieConstant informations to the panel panel->_fillSerieConstants.push_back (fillSerieConstant); } }; class FillSerieSerieNode: public AMDA::XMLConfigurator::NodeCfg { public: FillSerieSerieNode() : AMDA::XMLConfigurator::NodeCfg() { } virtual ~FillSerieSerieNode() {} void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { LOG4CXX_DEBUG(gLogger, "FillSerieSerieNode::proceed"); xmlChar* value = NULL; // Retrieve panel where to store fills informations Panel* panel = pContext.get(); // Build a new FillSerieSerie and populate it... boost::shared_ptr fillSerieSerie (new FillSerieSerie ()); // -- firstSerieId value = xmlGetProp(pNode, (const xmlChar *) "firstSerieId"); if (value) { fillSerieSerie->setFirstSerieId(atoi((const char*) value)); xmlFree(value); } // -- secondSerieId value = xmlGetProp(pNode, (const xmlChar *) "secondSerieId"); if (value) { fillSerieSerie->setSecondSerieId(atoi((const char*) value)); xmlFree(value); } // -- colorGreater (ColorGreaterSpecified set To false if no color specified in the request) value = xmlGetProp(pNode, (const xmlChar *) "colorGreater"); if (value) { fillSerieSerie->setColorGreaterSpecified(true); updateColor( fillSerieSerie->getColorGreater(), pNode,(const xmlChar*)"colorGreater",(const xmlChar*)"colorMapIndex"); xmlFree(value); } else { fillSerieSerie->setColorGreaterSpecified(false); } // -- colorLess (ColorLessSpecified set To false if no color specified in the request) value = xmlGetProp(pNode, (const xmlChar *) "colorLess"); if (value) { fillSerieSerie->setColorLessSpecified(true); updateColor( fillSerieSerie->getColorLess(), pNode,(const xmlChar*)"colorLess",(const xmlChar*)"colorMapIndex"); xmlFree(value); } else { fillSerieSerie->setColorLessSpecified(false); } // Add the new FillSerieSerie informations to the panel panel->_fillSerieSeries.push_back (fillSerieSerie); } }; class FillsNode: public AMDA::XMLConfigurator::NodeGrpCfg { public: FillsNode() : NodeGrpCfg() { getChildList()["fillSerieConstant"] = AMDA::XMLConfigurator::NodeCfgSPtr(new FillSerieConstantNode()); getChildList()["fillSerieSerie"] = AMDA::XMLConfigurator::NodeCfgSPtr(new FillSerieSerieNode()); } virtual ~FillsNode() {} void proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { LOG4CXX_DEBUG(gLogger, "FillsNode::proceed"); // proceed children AMDA::XMLConfigurator::NodeGrpCfg::proceed(pNode, pContext); } }; } /* namespace plot */ #endif /* FILLSNODE_HH_ */