/* * AxesNode.cc * * Created on: 26 nov. 2013 * Author: CS */ #include "AxesNode.hh" #include "Panel.hh" #include "DefaultPlotConfiguration.hh" namespace plot { void TimeAxisNode::proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx) { Panel* panel = pCtx.get(); TimeAxis* axis = new TimeAxis( *DefaultPlotConfiguration::getInstance().getDefaultTimeAxis()); // read dedicated attributes xmlChar* value = NULL; // -- axis id value = xmlGetProp(pNode, (const xmlChar *) "id"); if (value && std::string((const char*)value).size() != 0) { axis->_id = (const char*) value; xmlFree(value); } // Let default configuration of TimeAxis // else { // axis->_id = DefaultPlotConfiguration::TIME_DEFAULT_ID; // } panel->addAxis(axis->_id, boost::shared_ptr(axis)); // -- time format type value = xmlGetProp(pNode, (const xmlChar *) "format"); if (value) { axis->_timeFormat = (const char*) value; xmlFree(value); } AMDA::Parameters::CfgContext context; context.push(axis); context.push(panel); AnyAxisNode::proceed(pNode, context); } void EpochAxisNode::proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx) { Panel* panel = pCtx.get(); EpochAxis* axis = new EpochAxis( *DefaultPlotConfiguration::getInstance().getDefaultEpochAxis()); // read dedicated attributes xmlChar* value = NULL; // -- axis id value = xmlGetProp(pNode, (const xmlChar *) "id"); if (value && std::string((const char*)value).size() != 0) { axis->_id = (const char*) value; } if (value != NULL) xmlFree(value); // -- normalized value = xmlGetProp(pNode, (const xmlChar *) "normalized"); if (value != NULL) { axis->setNormalized(strcmp((char*)value,"true") == 0); xmlFree(value); } panel->addAxis(axis->_id, boost::shared_ptr(axis)); AMDA::Parameters::CfgContext context; context.push(axis); context.push(panel); AnyAxisNode::proceed(pNode, context); } void DigitalAxisNode::proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx) { LOG4CXX_DEBUG(gLogger, "DigitalAxisNode::proceed"); Panel* panel = pCtx.get(); const xmlChar * tagName = pCtx.get(); DigitalAxis* axis = new DigitalAxis( strcmp((const char *)tagName, (const char *)"xAxis") == 0 ? *DefaultPlotConfiguration::getInstance().getDefaultXAxis() : *DefaultPlotConfiguration::getInstance().getDefaultYAxis()); // read dedicated attributes xmlChar* value = NULL; // -- axis id value = xmlGetProp(pNode, (const xmlChar *) "id"); if (value) { axis->_id = (const char*) value; xmlFree(value); } panel->addAxis(axis->_id, boost::shared_ptr(axis)); AMDA::Parameters::CfgContext context; context.push(axis); context.push(panel); AnyAxisNode::proceed(pNode, context); } void ColorAxisNode::proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pCtx) { LOG4CXX_DEBUG(gLogger, "ColorAxisNode::proceed"); Panel* panel = pCtx.get(); ColorAxis* axis = new ColorAxis( *DefaultPlotConfiguration::getInstance().getDefaultColorAxis()); xmlChar * value = NULL; Color color; std::string colorStr; // -- minValColor - all value lower than this value will be draw with this color value = xmlGetProp(pNode, (const xmlChar *) "minValColor"); if( value ) { colorStr = (const char*)value; createColor(color, colorStr); axis->setMinValColor(color); xmlFree(value); } // -- maxValColor - all value greater than this value will be draw with this color value = xmlGetProp(pNode, (const xmlChar *) "maxValColor"); if( value ) { colorStr = (const char*)value; createColor(color, colorStr); axis->setMaxValColor(color); xmlFree(value); } panel->addColorAxis(axis->_id, boost::shared_ptr(axis)); AMDA::Parameters::CfgContext context; context.push(axis); context.push(panel); AnyAxisNode::proceed(pNode, context); } void XAxisNode::proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { Panel* panel = pContext.get(); AMDA::Parameters::CfgContext context; context.push(panel); context.push(pNode->name); NodeGrpCfg::proceed(pNode, context); } void YAxisNode::proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { Panel* panel = pContext.get(); AMDA::Parameters::CfgContext context; context.push(panel); context.push(pNode->name); NodeGrpCfg::proceed(pNode, context); } void ZAxisNode::proceed(xmlNodePtr pNode, const AMDA::Parameters::CfgContext& pContext) { Panel* panel = pContext.get(); AMDA::Parameters::CfgContext context; context.push(panel); context.push(pNode->name); NodeGrpCfg::proceed(pNode, context); } }