#1469 Use time step strings from case

This commit is contained in:
Magne Sjaastad 2017-05-15 09:17:06 +02:00
parent 7c1f9b90ba
commit e38b7329d1
3 changed files with 8 additions and 7 deletions

View File

@ -171,11 +171,11 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults(); RigFlowDiagResults* flowResult = m_flowDiagSolution->flowDiagResults();
std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps(); std::vector<int> calculatedTimesteps = flowResult->calculatedTimeSteps();
std::vector<QDateTime> timeStepDates = m_case->timeStepDates(); QStringList timeStepDates = m_case->timeStepStrings();
for ( int tsIdx : calculatedTimesteps ) for ( int tsIdx : calculatedTimesteps )
{ {
options.push_back(caf::PdmOptionItemInfo(timeStepDates[tsIdx].toString(), tsIdx)); options.push_back(caf::PdmOptionItemInfo(timeStepDates[tsIdx], tsIdx));
} }
} }
} }
@ -279,6 +279,7 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate()
m_currentlyPlottedTimeSteps = calculatedTimesteps; m_currentlyPlottedTimeSteps = calculatedTimesteps;
std::vector<QDateTime> timeStepDates = m_case->timeStepDates(); std::vector<QDateTime> timeStepDates = m_case->timeStepDates();
QStringList timeStepStrings = m_case->timeStepStrings();
std::vector<double> lorenzVals(timeStepDates.size(), HUGE_VAL); std::vector<double> lorenzVals(timeStepDates.size(), HUGE_VAL);
m_flowCharPlotWidget->removeAllCurves(); m_flowCharPlotWidget->removeAllCurves();
@ -287,7 +288,7 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate()
{ {
lorenzVals[timeStepIdx] = flowResult->flowCharacteristicsResults(timeStepIdx).m_lorenzCoefficient; lorenzVals[timeStepIdx] = flowResult->flowCharacteristicsResults(timeStepIdx).m_lorenzCoefficient;
} }
m_flowCharPlotWidget->setLorenzCurve(timeStepDates, lorenzVals); m_flowCharPlotWidget->setLorenzCurve(timeStepStrings, timeStepDates, lorenzVals);
for ( int timeStepIdx: calculatedTimesteps ) for ( int timeStepIdx: calculatedTimesteps )
{ {

View File

@ -114,7 +114,7 @@ RiuFlowCharacteristicsPlot::~RiuFlowCharacteristicsPlot()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuFlowCharacteristicsPlot::setLorenzCurve(const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues) void RiuFlowCharacteristicsPlot::setLorenzCurve(const QStringList& dateTimeStrings, const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues)
{ {
initializeColors(dateTimes); initializeColors(dateTimes);
@ -127,7 +127,7 @@ void RiuFlowCharacteristicsPlot::setLorenzCurve(const std::vector<QDateTime>& da
QDateTime dateTime = dateTimes[tsIdx]; QDateTime dateTime = dateTimes[tsIdx];
double timeHistoryValue = timeHistoryValues[tsIdx]; double timeHistoryValue = timeHistoryValues[tsIdx];
QString curveName = dateTime.toString(); QString curveName = dateTimeStrings[static_cast<int>(tsIdx)];
RiuFlowCharacteristicsPlot::addCurveWithLargeSymbol(m_lorenzPlot, curveName, m_dateToColorMap[dateTime], dateTime, timeHistoryValue); RiuFlowCharacteristicsPlot::addCurveWithLargeSymbol(m_lorenzPlot, curveName, m_dateToColorMap[dateTime], dateTime, timeHistoryValue);
} }
@ -145,7 +145,7 @@ void RiuFlowCharacteristicsPlot::addCurveWithLargeSymbol(QwtPlot* plot, const QS
QwtSymbol::Style style = QwtSymbol::Diamond; QwtSymbol::Style style = QwtSymbol::Diamond;
QwtSymbol* symbol = new QwtSymbol(style); QwtSymbol* symbol = new QwtSymbol(style);
symbol->setSize(20, 20); symbol->setSize(15, 15);
symbol->setColor(color); symbol->setColor(color);
curve->setSymbol(symbol); curve->setSymbol(symbol);

View File

@ -50,7 +50,7 @@ public:
RiuFlowCharacteristicsPlot(RimFlowCharacteristicsPlot* plotDefinition, QWidget* parent = NULL); RiuFlowCharacteristicsPlot(RimFlowCharacteristicsPlot* plotDefinition, QWidget* parent = NULL);
virtual ~RiuFlowCharacteristicsPlot(); virtual ~RiuFlowCharacteristicsPlot();
void setLorenzCurve(const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues); void setLorenzCurve(const QStringList& dateTimeStrings, const std::vector<QDateTime>& dateTimes, const std::vector<double>& timeHistoryValues);
void addFlowCapStorageCapCurve(const QDateTime& dateTime, const std::vector<double>& xVals, const std::vector<double>& yVals); void addFlowCapStorageCapCurve(const QDateTime& dateTime, const std::vector<double>& xVals, const std::vector<double>& yVals);
void addSweepEfficiencyCurve(const QDateTime& dateTime, const std::vector<double>& xVals, const std::vector<double>& yVals); void addSweepEfficiencyCurve(const QDateTime& dateTime, const std::vector<double>& xVals, const std::vector<double>& yVals);