diff --git a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp index 8d5b1d426a..50c0c99452 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp @@ -47,6 +47,8 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack( RimWellLogTra { RimWellLogCurve* curve = curves[cIdx]; + if ( curve == curveToInsertBeforeOrAfter ) continue; + RimWellLogTrack* wellLogPlotTrack; curve->firstAncestorOrThisOfType( wellLogPlotTrack ); if ( wellLogPlotTrack ) diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index 971ba09f80..052941a639 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -1078,13 +1078,20 @@ void RimWellLogTrack::addCurve( RimWellLogCurve* curve ) //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::insertCurve( RimWellLogCurve* curve, size_t index ) { - m_curves.insert( index, curve ); - connectCurveSignals( curve ); - // Todo: Mark curve data to use either TVD or MD - - if ( m_plotWidget ) + if ( index >= m_curves.size() ) { - curve->setParentQwtPlotAndReplot( m_plotWidget ); + addCurve( curve ); + } + else + { + m_curves.insert( index, curve ); + connectCurveSignals( curve ); + // Todo: Mark curve data to use either TVD or MD + + if ( m_plotWidget ) + { + curve->setParentQwtPlotAndReplot( m_plotWidget ); + } } } diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index 487b2cd389..6c770fe6c3 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -444,6 +444,9 @@ void RimSummaryCurveCollection::moveCurvesToCollection( RimSummaryCurveCollectio for ( auto curve : curves ) { RimSummaryCurveCollection* srcCollection = nullptr; + + if ( curve == curveToInsertBeforeOrAfter ) continue; + curve->firstAncestorOrThisOfTypeAsserted( srcCollection ); srcCollection->removeCurve( curve );