From 04315400737be4f7bd686a9151ab56232a1df17e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 12 Sep 2018 13:18:48 +0200 Subject: [PATCH] #3312 Well Path Creation: Update intersections, completion type result and fractures when moving the wellpath --- .../RicPointTangentManipulator.cpp | 38 ++++++++++++------- .../RicPointTangentManipulator.h | 3 +- .../Completions/RimFracture.cpp | 30 +++++++-------- .../ProjectDataModel/RimIntersection.h | 3 +- .../ProjectDataModel/RimModeledWellPath.cpp | 34 +++++++++++++++-- .../ProjectDataModel/RimModeledWellPath.h | 1 + .../ProjectDataModel/RimWellPathTarget.cpp | 13 +++++++ .../ProjectDataModel/RimWellPathTarget.h | 2 + 8 files changed, 89 insertions(+), 35 deletions(-) diff --git a/ApplicationCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.cpp b/ApplicationCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.cpp index 9001dc8615..3493f400a0 100644 --- a/ApplicationCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.cpp +++ b/ApplicationCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.cpp @@ -32,6 +32,7 @@ #include #include "RivPartPriority.h" #include "cafPdmUiCommandSystemProxy.h" +#include "RimModeledWellPath.h" //-------------------------------------------------------------------------------------------------- /// @@ -58,8 +59,6 @@ RicPointTangentManipulator::~RicPointTangentManipulator() void RicPointTangentManipulator::setOrigin(const cvf::Vec3d& origin) { m_partManager->setOrigin(origin); - - emit notifyRedraw(); } //-------------------------------------------------------------------------------------------------- @@ -68,8 +67,6 @@ void RicPointTangentManipulator::setOrigin(const cvf::Vec3d& origin) void RicPointTangentManipulator::setTangent(const cvf::Vec3d& tangent) { m_partManager->setTangent(tangent); - - emit notifyRedraw(); } //-------------------------------------------------------------------------------------------------- @@ -78,7 +75,6 @@ void RicPointTangentManipulator::setTangent(const cvf::Vec3d& tangent) void RicPointTangentManipulator::setHandleSize(double handleSize) { m_partManager->setHandleSize(handleSize); - emit notifyRedraw(); } //-------------------------------------------------------------------------------------------------- @@ -108,7 +104,6 @@ bool RicPointTangentManipulator::eventFilter(QObject *obj, QEvent* inputEvent) if(m_partManager->isManipulatorActive()) { emit notifySelected(); - emit notifyRedraw(); return true; } @@ -137,8 +132,6 @@ bool RicPointTangentManipulator::eventFilter(QObject *obj, QEvent* inputEvent) emit notifyUpdate(origin, tangent); - emit notifyRedraw(); - return true; } } @@ -154,6 +147,7 @@ bool RicPointTangentManipulator::eventFilter(QObject *obj, QEvent* inputEvent) m_partManager->originAndTangent(&origin, &tangent); emit notifyUpdate(origin, tangent); + emit notifyDragFinished(); return true; } @@ -809,6 +803,10 @@ void RicWellTarget3dEditor::configureAndUpdateUi(const QString& uiConfigName) SIGNAL( notifySelected() ), this, SLOT( slotSelectedIn3D() ) ); + QObject::connect(m_manipulator, + SIGNAL( notifyDragFinished() ), + this, + SLOT( slotDragFinished() ) ); m_cvfModel = new cvf::ModelBasicList; m_ownerViewer->addStaticModelOnce(m_cvfModel.p()); } @@ -871,11 +869,9 @@ void RicWellTarget3dEditor::slotUpdated(const cvf::Vec3d& origin, const cvf::Vec domainOrigin.z() = -domainOrigin.z(); QVariant originVariant = caf::PdmValueFieldSpecialization < cvf::Vec3d >::convert(domainOrigin); - std::cout << "RicWellTarget3dEditor::slotUpdated() start" << std::endl; - + target->enableFullUpdate(false); caf::PdmUiCommandSystemProxy::instance()->setUiValueToField(target->m_targetPoint.uiCapability(), originVariant); - std::cout << "RicWellTarget3dEditor::slotUpdated() end" << std::endl; - + target->enableFullUpdate(true); } void RicWellTarget3dEditor::slotSelectedIn3D() @@ -887,4 +883,20 @@ void RicWellTarget3dEditor::slotSelectedIn3D() } caf::SelectionManager::instance()->setSelectedItemAtLevel(target, caf::SelectionManager::FIRST_LEVEL); -} \ No newline at end of file +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicWellTarget3dEditor::slotDragFinished() +{ + RimWellPathTarget* target = dynamic_cast(this->pdmObject()); + if ( !target) + { + return; + } + + RimModeledWellPath* wellpath; + target->firstAncestorOrThisOfTypeAsserted(wellpath); + wellpath->scheduleUpdateOfDependentVisualization(); +} diff --git a/ApplicationCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.h b/ApplicationCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.h index 4d53c2a9fb..213862c1f6 100644 --- a/ApplicationCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.h +++ b/ApplicationCode/Commands/WellPathCommands/PointTangentManipulator/RicPointTangentManipulator.h @@ -60,7 +60,7 @@ public: signals: void notifySelected(); - void notifyRedraw(); + void notifyDragFinished(); void notifyUpdate(const cvf::Vec3d& origin, const cvf::Vec3d& tangent); protected: @@ -286,6 +286,7 @@ protected: private slots: void slotUpdated(const cvf::Vec3d& origin, const cvf::Vec3d& tangent); void slotSelectedIn3D(); + void slotDragFinished(); private: QPointer m_manipulator; cvf::ref m_cvfModel; diff --git a/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp b/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp index 1fe3c2daab..413a455c6b 100644 --- a/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp +++ b/ApplicationCode/ProjectDataModel/Completions/RimFracture.cpp @@ -209,30 +209,26 @@ void RimFracture::fieldChangedByUi(const caf::PdmFieldHandle* changedField, cons setDefaultFractureColorResult(); } - if (changedField == &m_azimuth || changedField == &m_fractureTemplate || changedField == &m_stimPlanTimeIndexToPlot || - changedField == this->objectToggleField() || changedField == &m_dip || changedField == &m_tilt || - changedField == &m_perforationLength) + if ( changedField == &m_azimuth + || changedField == &m_fractureTemplate + || changedField == &m_stimPlanTimeIndexToPlot + || changedField == this->objectToggleField() + || changedField == &m_dip + || changedField == &m_tilt + || changedField == &m_perforationLength) { clearCachedNonDarcyProperties(); - RimEclipseView* rimView = nullptr; - this->firstAncestorOrThisOfType(rimView); - if (rimView) + RimEclipseCase* eclipseCase = nullptr; + this->firstAncestorOrThisOfType(eclipseCase); + if ( eclipseCase ) { - RimEclipseCase* eclipseCase = nullptr; - rimView->firstAncestorOrThisOfType(eclipseCase); - if (eclipseCase) - { - RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews( - eclipseCase); - } + RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews( + eclipseCase); } else { - // Can be triggered from well path, find active view - RimProject* proj; - this->firstAncestorOrThisOfTypeAsserted(proj); - proj->reloadCompletionTypeResultsInAllViews(); + RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews(); } } } diff --git a/ApplicationCode/ProjectDataModel/RimIntersection.h b/ApplicationCode/ProjectDataModel/RimIntersection.h index 3d30d1c1c3..d6bd64867a 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersection.h +++ b/ApplicationCode/ProjectDataModel/RimIntersection.h @@ -105,6 +105,8 @@ public: bool hasDefiningPoints() const; int branchIndex() const; + void rebuildGeometryAndScheduleCreateDisplayModel(); + protected: virtual caf::PdmFieldHandle* userDescriptionField(); virtual caf::PdmFieldHandle* objectToggleField(); @@ -140,7 +142,6 @@ private: void updateWellExtentDefaultValue(); void addExtents(std::vector &polyLine) const; void updateName(); - void rebuildGeometryAndScheduleCreateDisplayModel(); static double azimuthInRadians(cvf::Vec3d vec); private: cvf::ref m_crossSectionPartMgr; diff --git a/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp b/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp index 8b876a21be..1fc4620e2b 100644 --- a/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp +++ b/ApplicationCode/ProjectDataModel/RimModeledWellPath.cpp @@ -25,6 +25,11 @@ #include "cafPdmUiTreeOrdering.h" #include "RimPlotCurve.h" +#include "RiaCompletionTypeCalculationScheduler.h" +#include "RimIntersection.h" +#include "RimWellPath.h" +#include "RimWellPathFractureCollection.h" +#include "RimWellPathFracture.h" CAF_PDM_SOURCE_INIT(RimModeledWellPath, "ModeledWellPath"); @@ -67,9 +72,6 @@ void RimModeledWellPath::createWellPathGeometry() void RimModeledWellPath::updateWellPathVisualization() { this->setWellPathGeometry(m_geometryDefinition->createWellPathGeometry().p()); - RimProject* proj; - this->firstAncestorOrThisOfTypeAsserted(proj); - proj->scheduleCreateDisplayModelAndRedrawAllViews(); std::vector refferingCurves; this->objectsWithReferringPtrFieldsOfType(refferingCurves); @@ -78,6 +80,32 @@ void RimModeledWellPath::updateWellPathVisualization() { curve->loadDataAndUpdate(false); } + + for ( auto fracture : this->fractureCollection()->activeFractures() ) + { + fracture->loadDataAndUpdate(); + } + + std::vector refferingIntersections; + this->objectsWithReferringPtrFieldsOfType(refferingIntersections); + + for (auto intersection: refferingIntersections) + { + intersection->rebuildGeometryAndScheduleCreateDisplayModel(); + } + + RimProject* proj; + this->firstAncestorOrThisOfTypeAsserted(proj); + proj->scheduleCreateDisplayModelAndRedrawAllViews(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimModeledWellPath::scheduleUpdateOfDependentVisualization() +{ + + RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimModeledWellPath.h b/ApplicationCode/ProjectDataModel/RimModeledWellPath.h index 4f0b4f181c..a80df0ac48 100644 --- a/ApplicationCode/ProjectDataModel/RimModeledWellPath.h +++ b/ApplicationCode/ProjectDataModel/RimModeledWellPath.h @@ -35,6 +35,7 @@ public: void createWellPathGeometry(); void updateWellPathVisualization(); + void scheduleUpdateOfDependentVisualization(); RimWellPathGeometryDef* geometryDefinition(); private: diff --git a/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp b/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp index b6df9688a0..7ce1fbd177 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp @@ -24,6 +24,7 @@ RimWellPathTarget::RimWellPathTarget() , m_targetPoint(cvf::Vec3d::ZERO) , m_azimuth(0.0) , m_inclination(0.0) + , m_isFullUpdateEnabled(true) { CAF_PDM_InitField(&m_isEnabled, "IsEnabled", true, "", "", "", ""); @@ -173,6 +174,14 @@ double RimWellPathTarget::radius2() const return 30.0/cvf::Math::toRadians(m_dogleg2); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathTarget::enableFullUpdate(bool enable) +{ + m_isFullUpdateEnabled = enable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -195,6 +204,10 @@ void RimWellPathTarget::fieldChangedByUi(const caf::PdmFieldHandle* changedField RimModeledWellPath* wellPath; firstAncestorOrThisOfTypeAsserted(wellPath); wellPath->updateWellPathVisualization(); + if (m_isFullUpdateEnabled) + { + wellPath->scheduleUpdateOfDependentVisualization(); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellPathTarget.h b/ApplicationCode/ProjectDataModel/RimWellPathTarget.h index 6c0306e08f..fec1fdeda3 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathTarget.h +++ b/ApplicationCode/ProjectDataModel/RimWellPathTarget.h @@ -54,6 +54,8 @@ private: private: friend class RicWellTarget3dEditor; + void enableFullUpdate(bool enable); + bool m_isFullUpdateEnabled; caf::PdmField m_isEnabled; caf::PdmField > m_targetType; caf::PdmField m_targetPoint;