From db4a6b56e11566c5d00efb1241c201895dbe06aa Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Fri, 8 Jul 2016 10:22:18 +0200 Subject: [PATCH] Get the possibility to use a TimeTable for an epoch plot request --- src/ParamOutputImpl/Plot/Epoch/EpochPlot.cc | 30 +++++++++++++++++------------- src/ParamOutputImpl/Plot/Epoch/EpochPlotNode.cc | 5 ----- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/ParamOutputImpl/Plot/Epoch/EpochPlot.cc b/src/ParamOutputImpl/Plot/Epoch/EpochPlot.cc index b234cb0..1a14b05 100644 --- a/src/ParamOutputImpl/Plot/Epoch/EpochPlot.cc +++ b/src/ParamOutputImpl/Plot/Epoch/EpochPlot.cc @@ -111,18 +111,23 @@ void EpochPlot::configureSeriesAxis() { while (crtTimeInterval != _timeIntervalListPtr->end()) { //get center time data for this interval + double leftDeltaTime = 0.; + double rightDeltaTime = 0.; + std::vector& crtCenterTimeData = _parameterManager.getInputIntervalDataList(crtTimeInterval->_index, _centerTimeId); if (crtCenterTimeData.empty()) { - std::stringstream lError; - lError << "EpochPlot::configureSeriesAxis: Cannot get center time data for interval with index: " << crtTimeInterval->_index; - BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str())); + leftDeltaTime = (crtTimeInterval->_stopTime-crtTimeInterval->_startTime) / 2.; + rightDeltaTime = leftDeltaTime; + } + else + { + //compute left and right delta times (relative to the center time) + double crtCenterTime = AMDA::TimeUtil::readTimeInIso((char*)crtCenterTimeData[0].c_str()); + leftDeltaTime = crtCenterTime-crtTimeInterval->_startTime; + rightDeltaTime = crtTimeInterval->_stopTime-crtCenterTime; } - //compute left and right delta times (relative to the center time) - double crtCenterTime = AMDA::TimeUtil::readTimeInIso((char*)crtCenterTimeData[0].c_str()); - double leftDeltaTime = crtCenterTime-crtTimeInterval->_startTime; - double rightDeltaTime = crtTimeInterval->_stopTime-crtCenterTime; if ((leftDeltaTime < 0) || (rightDeltaTime < 0)) { LOG4CXX_WARN(gLogger, "EpochPlot::configureSeriesAxis - centerTime not contained in the interval for the interval with index : " << crtTimeInterval->_index << " => skip this interval"); @@ -286,13 +291,12 @@ void EpochPlot::drawSeries(double startDate, double stopDate, int intervalIndex, //get center time data for this interval std::vector& crtCenterTimeData = _parameterManager.getInputIntervalDataList(intervalIndex, _centerTimeId); + + double crtCenterTime = 0.; if (crtCenterTimeData.empty()) - { - std::stringstream lError; - lError << "EpochPlot::configureSeriesAxis: Cannot get center time data for interval with index: " << intervalIndex; - BOOST_THROW_EXCEPTION(PanelPlotOutputException() << AMDA::ex_msg(lError.str())); - } - double crtCenterTime = AMDA::TimeUtil::readTimeInIso((char*)crtCenterTimeData[0].c_str()); + crtCenterTime = startDate + (stopDate - startDate) / 2.; + else + crtCenterTime = AMDA::TimeUtil::readTimeInIso((char*)crtCenterTimeData[0].c_str()); //set the current center time to the epoch axis epochAxis->setCrtCenterTime(crtCenterTime); diff --git a/src/ParamOutputImpl/Plot/Epoch/EpochPlotNode.cc b/src/ParamOutputImpl/Plot/Epoch/EpochPlotNode.cc index ec61619..839366c 100644 --- a/src/ParamOutputImpl/Plot/Epoch/EpochPlotNode.cc +++ b/src/ParamOutputImpl/Plot/Epoch/EpochPlotNode.cc @@ -55,11 +55,6 @@ boost::shared_ptr EpochPlotNode::proceed(xmlNodePtr pNode_, Plo plot->setCenterTimeId(std::string((const char*) value)); xmlFree(value); } - else - { - LOG4CXX_ERROR(gLogger, "EpochPlotNode::proceed - centerTimeId not defined"); - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("centerTimeId not defined for epochPlot")); - } // Copy default pages values for the panel if not already specified if (panel_->_leftMargin == -1) -- libgit2 0.21.2