diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp index ac76b4c206..b8cbb0d76f 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp @@ -457,7 +457,7 @@ void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle* if ( changedField == &m_simulationWell || changedField == &m_isActive || changedField == &m_type ) { - recomputeSimulationWellBranchData(); + rebuildGeometryAndScheduleCreateDisplayModel(); } if ( changedField == &m_simulationWell || changedField == &m_wellPath || changedField == &m_branchIndex || @@ -546,10 +546,14 @@ void RimExtrudedCurveIntersection::defineUiOrdering( QString uiConfigName, caf:: else if ( type() == CrossSectionEnum::CS_SIMULATION_WELL ) { geometryGroup->add( &m_simulationWell ); - updateSimulationWellCenterline(); - if ( m_simulationWell() && m_simulationWellBranchCenterlines.size() > 1 ) + + if ( m_simulationWell() ) { - geometryGroup->add( &m_branchIndex ); + auto branchCenterLines = simulationWellBranchCenterlines(); + if ( branchCenterLines.size() > 1 ) + { + geometryGroup->add( &m_branchIndex ); + } } } else if ( type() == CrossSectionEnum::CS_POLYLINE ) @@ -705,9 +709,8 @@ QList RimExtrudedCurveIntersection::calculateValueOption } else if ( fieldNeedingOptions == &m_branchIndex ) { - updateSimulationWellCenterline(); - - size_t branchCount = m_simulationWellBranchCenterlines.size(); + auto branchCenterLines = simulationWellBranchCenterlines(); + size_t branchCount = branchCenterLines.size(); options.push_back( caf::PdmOptionItemInfo( "All", -1 ) ); @@ -812,14 +815,16 @@ std::vector> RimExtrudedCurveIntersection::polyLines( cv { int branchIndexToUse = branchIndex(); - if ( 0 <= branchIndexToUse && branchIndexToUse < static_cast( m_simulationWellBranchCenterlines.size() ) ) + auto branchCenterLines = simulationWellBranchCenterlines(); + + if ( 0 <= branchIndexToUse && branchIndexToUse < static_cast( branchCenterLines.size() ) ) { - lines.push_back( m_simulationWellBranchCenterlines[branchIndexToUse] ); + lines.push_back( branchCenterLines[branchIndexToUse] ); } if ( branchIndexToUse == -1 ) { - lines = m_simulationWellBranchCenterlines; + lines = branchCenterLines; } } } @@ -900,27 +905,6 @@ std::vector RimExtrudedCurveIntersection::polyLinesForExtrusionDirec return m_customExtrusionPoints; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimExtrudedCurveIntersection::updateSimulationWellCenterline() -{ - if ( m_isActive() && type() == CrossSectionEnum::CS_SIMULATION_WELL && m_simulationWell() ) - { - if ( m_simulationWellBranchCenterlines.empty() ) - { - auto simWells = m_simulationWell()->wellBranchesForVisualization(); - const auto& [coords, wellCells] = RigSimulationWellCenterLineCalculator::extractBranchData( simWells ); - - m_simulationWellBranchCenterlines = coords; - } - } - else - { - m_simulationWellBranchCenterlines.clear(); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1019,7 +1003,8 @@ int RimExtrudedCurveIntersection::branchIndex() const return -1; } - if ( m_branchIndex >= static_cast( m_simulationWellBranchCenterlines.size() ) ) + auto branchCenterLines = simulationWellBranchCenterlines(); + if ( m_branchIndex >= static_cast( branchCenterLines.size() ) ) { return -1; } @@ -1279,20 +1264,6 @@ double RimExtrudedCurveIntersection::extentLength() return m_extentLength(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimExtrudedCurveIntersection::recomputeSimulationWellBranchData() -{ - if ( m_type() == CrossSectionEnum::CS_SIMULATION_WELL ) - { - m_simulationWellBranchCenterlines.clear(); - updateSimulationWellCenterline(); - - m_crossSectionPartMgr = nullptr; - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1426,3 +1397,16 @@ RimEclipseView* RimExtrudedCurveIntersection::eclipseView() const { return firstAncestorOrThisOfType(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector> RimExtrudedCurveIntersection::simulationWellBranchCenterlines() const +{ + if ( !m_simulationWell() ) return {}; + + const auto simWells = m_simulationWell()->wellBranchesForVisualization(); + const auto& [branchCenterLines, wellCells] = RigSimulationWellCenterLineCalculator::extractBranchData( simWells ); + + return branchCenterLines; +} diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h index 22d6836593..5e0388b90a 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h @@ -127,7 +127,6 @@ public: void setLengthUp( double heightUp ); void setLengthDown( double heightDown ); double extentLength(); - void recomputeSimulationWellBranchData(); bool hasDefiningPoints() const; std::vector surfaceIntersectionCurves() const; @@ -152,7 +151,6 @@ private: RimSimWellInViewCollection* simulationWellCollection() const; void updateAzimuthLine(); - void updateSimulationWellCenterline(); void addExtents( std::vector& polyLine ) const; void updateName(); static double azimuthInRadians( cvf::Vec3d vec ); @@ -166,6 +164,8 @@ private: RimEclipseView* eclipseView() const; + std::vector> simulationWellBranchCenterlines() const; + private: caf::PdmField m_name; diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp index e54c331853..3157f32f49 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp @@ -295,17 +295,6 @@ std::vector RimIntersectionCollection::intersectionBoxes() return m_intersectionBoxes.childrenByType(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimIntersectionCollection::recomputeSimWellBranchData() -{ - for ( const auto& intersection : intersections() ) - { - intersection->recomputeSimulationWellBranchData(); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h index a634f2e2d9..47e67d35e9 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h @@ -68,7 +68,6 @@ public: void syncronize2dIntersectionViews(); void scheduleCreateDisplayModelAndRedraw2dIntersectionViews(); - void recomputeSimWellBranchData(); bool shouldApplyCellFiltersToIntersections() const; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp index 45e4e8498e..60585a4d47 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -49,7 +49,6 @@ #include "RimEclipseInputPropertyCollection.h" #include "RimEclipseView.h" #include "RimFlowDiagSolution.h" -#include "RimIntersectionCollection.h" #include "RimMockModelSettings.h" #include "RimProject.h" #include "RimReservoirCellResultsStorage.h" @@ -660,7 +659,6 @@ void RimEclipseResultCase::fieldChangedByUi( const caf::PdmFieldHandle* changedF { resView->scheduleSimWellGeometryRegen(); resView->scheduleCreateDisplayModelAndRedraw(); - resView->intersectionCollection()->recomputeSimWellBranchData(); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp index 0b3f0d472f..4124a28645 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp @@ -31,7 +31,6 @@ #include "RimEclipseContourMapView.h" #include "RimEclipseResultCase.h" #include "RimEclipseView.h" -#include "RimIntersectionCollection.h" #include "RimProject.h" #include "RimSimWellFractureCollection.h" #include "RimSimWellInView.h" @@ -483,10 +482,7 @@ void RimSimWellInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* ch if ( &wellPipeCoordType == changedField || &isAutoDetectingBranches == changedField ) { - if ( m_reservoirView ) - { - m_reservoirView->intersectionCollection()->recomputeSimWellBranchData(); - } + if ( m_reservoirView ) m_reservoirView->scheduleCreateDisplayModelAndRedraw(); for ( RimSimWellInView* w : wells ) {