diff --git a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp index 65ae5e5ea2..1884f87fea 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp @@ -46,7 +46,7 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack(RimWellLogTrac curve->firstAncestorOrThisOfType(wellLogPlotTrack); if (wellLogPlotTrack) { - wellLogPlotTrack->removeCurve(curve); + wellLogPlotTrack->takeOutCurve(curve); wellLogPlotTrack->updateConnectedEditors(); srcTracks.insert(wellLogPlotTrack); RimWellLogPlot* plot; diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index 358468bcff..52943e6304 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -521,10 +521,7 @@ void RimWellRftPlot::updateCurvesInPlot(const std::set RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0); // Delete curves - for (RimWellLogCurve* const curve : curvesToDelete) - { - plotTrack->removeCurve(curve); - } + plotTrack->deleteAllCurves(); // Add new curves for (const RiaRftPltCurveDefinition& curveDefToAdd : curveDefsToAdd) @@ -796,10 +793,8 @@ void RimWellRftPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c if (changedField == &m_wellPathNameOrSimWellName || changedField == &m_branchIndex) { RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex(0); - for (RimWellLogCurve* const curve : plotTrack->curvesVector()) - { - plotTrack->removeCurve(curve); - } + plotTrack->deleteAllCurves(); + m_timeStepsToAddresses.clear(); updateEditorsFromCurves(); updateFormationsOnPlot(); diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index 94f3eb629c..735c8bf914 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -391,7 +391,7 @@ void RimWellLogTrack::insertCurve(RimWellLogCurve* curve, size_t index) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::removeCurve(RimWellLogCurve* curve) +void RimWellLogTrack::takeOutCurve(RimWellLogCurve* curve) { size_t index = curves.index(curve); if ( index < curves.size()) @@ -401,6 +401,14 @@ void RimWellLogTrack::removeCurve(RimWellLogCurve* curve) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::deleteAllCurves() +{ + curves.deleteAllChildObjects(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h index 101f35a56e..06db1c3e10 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h @@ -73,7 +73,9 @@ public: bool isVisible(); void addCurve(RimWellLogCurve* curve); void insertCurve(RimWellLogCurve* curve, size_t index); - void removeCurve(RimWellLogCurve* curve); + void takeOutCurve(RimWellLogCurve* curve); + void deleteAllCurves(); + size_t curveIndex(RimWellLogCurve* curve); size_t curveCount() { return curves.size(); } void setXAxisTitle(const QString& text);