From 81bcc2657d3a91aa3678c38c0878c1071753de77 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 19 Oct 2026 12:09:24 +0200 Subject: [PATCH] #14962: Update MSW segments when segment intervals change Segment interval edits, creation and deletion did not trigger the automatic MSW segment update, so the segment visualization along the well path was stale. --- .../RicCreateSegmentIntervalFeature.cpp | 1 + .../RicDeleteSegmentIntervalFeature.cpp | 1 + .../Completions/RimSegmentCollection.cpp | 22 +++++++++++++++++++ .../Completions/RimSegmentCollection.h | 3 +++ 4 files changed, 27 insertions(+) diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicCreateSegmentIntervalFeature.cpp b/ApplicationLibCode/Commands/CompletionCommands/RicCreateSegmentIntervalFeature.cpp index 94953ab4d4..f238e35c7f 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicCreateSegmentIntervalFeature.cpp +++ b/ApplicationLibCode/Commands/CompletionCommands/RicCreateSegmentIntervalFeature.cpp @@ -35,6 +35,7 @@ void RicCreateSegmentIntervalFeature::onActionTriggered( bool isChecked ) auto* interval = collection->createInterval( 0.0, 2000.0, collection->linerDiameter(), collection->roughnessFactor() ); collection->updateConnectedEditors(); + collection->updateMswSegments(); Riu3DMainWindowTools::selectAsCurrentItem( interval ); if ( auto* project = RimProject::current() ) project->scheduleCreateDisplayModelAndRedrawAllViews(); diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicDeleteSegmentIntervalFeature.cpp b/ApplicationLibCode/Commands/CompletionCommands/RicDeleteSegmentIntervalFeature.cpp index 4344244486..bcc8787474 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicDeleteSegmentIntervalFeature.cpp +++ b/ApplicationLibCode/Commands/CompletionCommands/RicDeleteSegmentIntervalFeature.cpp @@ -48,6 +48,7 @@ void RicDeleteSegmentIntervalFeature::onActionTriggered( bool isChecked ) if ( !collection ) return; collection->updateConnectedEditors(); + collection->updateMswSegments(); Riu3DMainWindowTools::selectAsCurrentItem( collection ); if ( auto* project = RimProject::current() ) project->scheduleCreateDisplayModelAndRedrawAllViews(); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.cpp index e2cfd14306..4d48d01be9 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.cpp @@ -26,6 +26,7 @@ #include "RimMswCompletionParameters.h" #include "RimSegmentInterval.h" #include "RimWellPath.h" +#include "RimWellPathCollection.h" #include "cafCmdFeatureMenuBuilder.h" #include "cafPdmFieldScriptingCapability.h" @@ -533,6 +534,27 @@ void RimSegmentCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedF m_maxSegmentLength.uiCapability()->setUiHidden( !m_enforceMaxSegmentLength() ); caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); } + + updateMswSegments(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSegmentCollection::childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) +{ + updateMswSegments(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSegmentCollection::updateMswSegments() +{ + if ( auto* wellPathCollection = RimWellPathCollection::instance() ) + { + wellPathCollection->updateMswSegmentsForObject( this ); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.h b/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.h index 6fa1982d4c..5be54e2633 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSegmentCollection.h @@ -103,8 +103,11 @@ public: static double defaultRoughnessFactor( RiaDefines::EclipseUnitSystem unitSystem ); void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override; void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override; + void updateMswSegments(); + protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;