diff --git a/ApplicationCode/ProjectDataModel/RimIntersection.cpp b/ApplicationCode/ProjectDataModel/RimIntersection.cpp index 668ec506ce..6d288fdcbe 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersection.cpp +++ b/ApplicationCode/ProjectDataModel/RimIntersection.cpp @@ -155,9 +155,7 @@ void RimIntersection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, || changedField == &isActive || changedField == &type) { - m_wellBranchCenterlines.clear(); - updateWellCenterline(); - m_branchIndex = -1; + recomputeSimulationWellBranchData(); } if (changedField == &simulationWell @@ -231,8 +229,8 @@ void RimIntersection::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& else if (type == CS_SIMULATION_WELL) { geometryGroup->add(&simulationWell); - updateWellCenterline(); - if (simulationWell() && m_wellBranchCenterlines.size() > 1) + updateSimulationWellCenterline(); + if (simulationWell() && m_simulationWellBranchCenterlines.size() > 1) { geometryGroup->add(&m_branchIndex); } @@ -322,9 +320,9 @@ QList<caf::PdmOptionItemInfo> RimIntersection::calculateValueOptions(const caf:: } else if (fieldNeedingOptions == &m_branchIndex) { - updateWellCenterline(); + updateSimulationWellCenterline(); - size_t branchCount = m_wellBranchCenterlines.size(); + size_t branchCount = m_simulationWellBranchCenterlines.size(); options.push_back(caf::PdmOptionItemInfo("All", -1)); @@ -411,16 +409,16 @@ std::vector< std::vector <cvf::Vec3d> > RimIntersection::polyLines(double * hori { if (simulationWell()) { - updateWellCenterline(); + updateSimulationWellCenterline(); - if (0 <= m_branchIndex && m_branchIndex < static_cast<int>(m_wellBranchCenterlines.size())) + if (0 <= m_branchIndex && m_branchIndex < static_cast<int>(m_simulationWellBranchCenterlines.size())) { - lines.push_back(m_wellBranchCenterlines[m_branchIndex]); + lines.push_back(m_simulationWellBranchCenterlines[m_branchIndex]); } if (m_branchIndex == -1) { - lines = m_wellBranchCenterlines; + lines = m_simulationWellBranchCenterlines; } } } @@ -488,32 +486,35 @@ std::vector< std::vector <cvf::Vec3d> > RimIntersection::polyLinesForExtrusionDi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimIntersection::updateWellCenterline() const +void RimIntersection::updateSimulationWellCenterline() const { if (isActive() && type == CS_SIMULATION_WELL && simulationWell()) { - if (m_wellBranchCenterlines.size() == 0) + if (m_simulationWellBranchCenterlines.size() == 0) { RimEclipseCase* rimEclCase = nullptr; simulationWell->firstAncestorOrThisOfType(rimEclCase); if (rimEclCase) { - bool includeCellCenters = false; - bool detectBrances = true; + RimSimWellInViewCollection* simWellCollection = nullptr; + simulationWell->firstAncestorOrThisOfTypeAsserted(simWellCollection); + + bool includeCellCenters = simulationWell->isUsingCellCenterForPipe(); + bool detectBrances = simWellCollection->isAutoDetectingBranches; RigEclipseCaseData* caseData = rimEclCase->eclipseCaseData(); auto branches = caseData->simulationWellBranches(simulationWell->name, includeCellCenters, detectBrances); for (auto b : branches) { - m_wellBranchCenterlines.push_back(b->m_wellPathPoints); + m_simulationWellBranchCenterlines.push_back(b->m_wellPathPoints); } } } } else { - m_wellBranchCenterlines.clear(); + m_simulationWellBranchCenterlines.clear(); } } @@ -884,6 +885,21 @@ void RimIntersection::setLengthDown(double lengthDown) m_lengthDown = lengthDown; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimIntersection::recomputeSimulationWellBranchData() +{ + if (type() == CS_SIMULATION_WELL) + { + m_simulationWellBranchCenterlines.clear(); + updateSimulationWellCenterline(); + m_branchIndex = -1; + + m_crossSectionPartMgr = nullptr; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimIntersection.h b/ApplicationCode/ProjectDataModel/RimIntersection.h index 7942eaa659..3c23c61c49 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersection.h +++ b/ApplicationCode/ProjectDataModel/RimIntersection.h @@ -101,6 +101,8 @@ public: void setLengthUp(double heightUp); void setLengthDown(double heightDown); + void recomputeSimulationWellBranchData(); + protected: virtual caf::PdmFieldHandle* userDescriptionField(); virtual caf::PdmFieldHandle* objectToggleField(); @@ -130,7 +132,7 @@ private: RimSimWellInViewCollection* simulationWellCollection(); void updateAzimuthLine(); - void updateWellCenterline() const; + void updateSimulationWellCenterline() const; void updateWellExtentDefaultValue(); void addExtents(std::vector<cvf::Vec3d> &polyLine) const; void clipToReservoir(std::vector<cvf::Vec3d> &polyLinee, double * horizontalLengthAlongWellToClipPoint) const; @@ -141,5 +143,5 @@ private: cvf::ref<RivIntersectionPartMgr> m_crossSectionPartMgr; mutable - std::vector< std::vector <cvf::Vec3d> > m_wellBranchCenterlines; + std::vector< std::vector <cvf::Vec3d> > m_simulationWellBranchCenterlines; }; diff --git a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp index 15182e532f..10e015a828 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.cpp @@ -19,8 +19,8 @@ #include "RimIntersectionCollection.h" -#include "Rim2dIntersectionViewCollection.h" #include "Rim2dIntersectionView.h" +#include "Rim2dIntersectionViewCollection.h" #include "Rim3dView.h" #include "RimCase.h" #include "RimIntersection.h" @@ -167,6 +167,17 @@ std::vector<RimIntersectionBox*> RimIntersectionCollection::intersectionBoxes() return m_intersectionBoxes.childObjects(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimIntersectionCollection::recomputeSimWellBranchData() +{ + for (const auto& intersection : intersections()) + { + intersection->recomputeSimulationWellBranchData(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h index 5a0f362e1a..bb463c263a 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h +++ b/ApplicationCode/ProjectDataModel/RimIntersectionCollection.h @@ -62,6 +62,7 @@ public: void syncronize2dIntersectionViews(); void scheduleCreateDisplayModelAndRedraw2dIntersectionViews(); + void recomputeSimWellBranchData(); // Visualization interface diff --git a/ApplicationCode/ProjectDataModel/RimSimWellInViewCollection.cpp b/ApplicationCode/ProjectDataModel/RimSimWellInViewCollection.cpp index a89ea132d6..287e3301b7 100644 --- a/ApplicationCode/ProjectDataModel/RimSimWellInViewCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimSimWellInViewCollection.cpp @@ -28,12 +28,14 @@ #include "RigSimWellData.h" #include "RimEclipseCase.h" +#include "RimEclipseResultCase.h" #include "RimEclipseView.h" +#include "RimIntersectionCollection.h" #include "RimProject.h" -#include "RimSimWellInView.h" -#include "RimWellAllocationPlot.h" #include "RimSimWellFracture.h" #include "RimSimWellFractureCollection.h" +#include "RimSimWellInView.h" +#include "RimWellAllocationPlot.h" #include "RiuMainWindow.h" @@ -41,7 +43,6 @@ #include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiCheckBoxTristateEditor.h" -#include "RimEclipseResultCase.h" namespace caf @@ -460,8 +461,13 @@ void RimSimWellInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle* cha if (m_reservoirView) m_reservoirView->scheduleCreateDisplayModelAndRedraw(); } - if (&wellPipeCoordType == changedField) + if (&wellPipeCoordType == changedField || &isAutoDetectingBranches == changedField) { + if (m_reservoirView) + { + m_reservoirView->crossSectionCollection()->recomputeSimWellBranchData(); + } + for (RimSimWellInView* w : wells) { for (RimSimWellFracture* frac : w->simwellFractureCollection()->simwellFractures())