PLT plot. Fix crash when stacking curves containing NULL sample values

This commit is contained in:
Bjørn Erik Jensen
2017-11-09 15:34:05 +01:00
parent 4ad6198d42
commit 290458b77a

View File

@@ -214,30 +214,49 @@ void RimWellFlowRateCurve::updateStackedPlotData()
RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_NONE; RiaDefines::DepthUnitType displayUnit = RiaDefines::UNIT_NONE;
std::vector<double> depthValues = m_curveData->measuredDepthPlotValues(displayUnit); std::vector<double> depthValues;
std::vector< std::pair<size_t, size_t> > polyLineStartStopIndices = m_curveData->polylineStartStopIndices(); std::vector<double> stackedValues;
std::vector<double> stackedValues(depthValues.size(), 0.0); std::vector< std::pair<size_t, size_t> > polyLineStartStopIndices;
{
std::map<int, std::vector<RimWellFlowRateCurve*>> stackedCurveGroups = wellLogTrack->visibleStackedCurves(); std::map<int, std::vector<RimWellFlowRateCurve*>> stackedCurveGroups = wellLogTrack->visibleStackedCurves();
std::vector<RimWellFlowRateCurve*> stackedCurves; std::vector<RimWellFlowRateCurve*> stackedCurves;
if (stackedCurveGroups.count(groupId()) > 0) if (stackedCurveGroups.count(groupId()) > 0)
{ {
stackedCurves = stackedCurveGroups[groupId()]; stackedCurves = stackedCurveGroups[groupId()];
} }
std::vector<double> allDepthValues = m_curveData->measuredDepths();
std::vector<double> allStackedValues(allDepthValues.size());
double zPos = -0.1; double zPos = -0.1;
for ( RimWellFlowRateCurve * stCurve: stackedCurves ) for (RimWellFlowRateCurve * stCurve : stackedCurves)
{ {
std::vector<double> values = stCurve->curveData()->xPlotValues(); std::vector<double> allValues = stCurve->curveData()->xValues();
for ( size_t i = 0; i < values.size(); ++i )
for (size_t i = 0; i < allValues.size(); ++i)
{ {
stackedValues[i] += values[i]; if (allValues[i] != HUGE_VAL)
{
allStackedValues[i] += allValues[i];
}
} }
if ( stCurve == this ) break; if (stCurve == this) break;
zPos -= 1.0; zPos -= 1.0;
} }
RigWellLogCurveData tempCurveData;
tempCurveData.setValuesAndMD(allStackedValues, allDepthValues, RiaDefines::UNIT_NONE, false);
depthValues = tempCurveData.measuredDepthPlotValues(displayUnit);
stackedValues = tempCurveData.xPlotValues();
polyLineStartStopIndices = tempCurveData.polylineStartStopIndices();
}
double zPos = -0.1;
// Insert the first depth position again, to add a <maxdepth, 0.0> value pair // Insert the first depth position again, to add a <maxdepth, 0.0> value pair
if ( depthValues.size() ) // Should we really do this for all curve variants ? if ( depthValues.size() ) // Should we really do this for all curve variants ?