From 96372c907792a2bb7d3c3f8d59a7306369beb204 Mon Sep 17 00:00:00 2001 From: astridkbjorke Date: Tue, 21 Mar 2017 10:45:19 +0100 Subject: [PATCH] #1339 - pre-proto - Extracting function for azimuth angle of well --- .../ProjectDataModel/RimSimWellFracture.cpp | 14 ++++++++-- .../ProjectDataModel/RimSimWellFracture.h | 2 ++ .../ProjectDataModel/RimWellPathFracture.cpp | 26 +++++++++++++------ .../ProjectDataModel/RimWellPathFracture.h | 2 ++ 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimSimWellFracture.cpp b/ApplicationCode/ProjectDataModel/RimSimWellFracture.cpp index d0c5d0c57f..af5d5a196a 100644 --- a/ApplicationCode/ProjectDataModel/RimSimWellFracture.cpp +++ b/ApplicationCode/ProjectDataModel/RimSimWellFracture.cpp @@ -81,8 +81,8 @@ void RimSimWellFracture::updateAzimuthFromFractureDefinition() if (orientation == RimFractureTemplate::ALONG_WELL_PATH || orientation== RimFractureTemplate::TRANSVERSE_WELL_PATH) { - updateBranchGeometry(); - double simWellAzimuth = m_branchCenterLines[m_branchIndex].simWellAzimuthAngle(fracturePosition()); + double simWellAzimuth = wellAzimuthAtFracturePosition(); + if (orientation == RimFractureTemplate::TRANSVERSE_WELL_PATH ) { azimuth = simWellAzimuth; @@ -100,6 +100,16 @@ void RimSimWellFracture::updateAzimuthFromFractureDefinition() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimSimWellFracture::wellAzimuthAtFracturePosition() +{ + updateBranchGeometry(); + double simWellAzimuth = m_branchCenterLines[m_branchIndex].simWellAzimuthAngle(fracturePosition()); + return simWellAzimuth; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimSimWellFracture.h b/ApplicationCode/ProjectDataModel/RimSimWellFracture.h index 1e4e414c3d..1da336e7e7 100644 --- a/ApplicationCode/ProjectDataModel/RimSimWellFracture.h +++ b/ApplicationCode/ProjectDataModel/RimSimWellFracture.h @@ -44,6 +44,8 @@ public: void updateFracturePositionFromLocation(); void updateAzimuthFromFractureDefinition() override; + double wellAzimuthAtFracturePosition() override; + protected: virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; diff --git a/ApplicationCode/ProjectDataModel/RimWellPathFracture.cpp b/ApplicationCode/ProjectDataModel/RimWellPathFracture.cpp index 75f5554535..4269733930 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathFracture.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathFracture.cpp @@ -96,15 +96,8 @@ void RimWellPathFracture::updateAzimuthFromFractureDefinition() if (orientation == RimFractureTemplate::ALONG_WELL_PATH || orientation == RimFractureTemplate::TRANSVERSE_WELL_PATH) { - caf::PdmObjectHandle* objHandle = dynamic_cast(this); - if (!objHandle) return; + double wellPathAzimuth = wellAzimuthAtFracturePosition(); - RimWellPath* wellPath = nullptr; - objHandle->firstAncestorOrThisOfType(wellPath); - if (!wellPath) return; - - RigWellPath* wellPathGeometry = wellPath->wellPathGeometry(); - double wellPathAzimuth = wellPathGeometry->wellPathAzimuthAngle(fracturePosition()); if (orientation == RimFractureTemplate::TRANSVERSE_WELL_PATH) { azimuth = wellPathAzimuth; @@ -122,6 +115,23 @@ void RimWellPathFracture::updateAzimuthFromFractureDefinition() // } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimWellPathFracture::wellAzimuthAtFracturePosition() +{ + caf::PdmObjectHandle* objHandle = dynamic_cast(this); + if (!objHandle) return cvf::UNDEFINED_DOUBLE; + + RimWellPath* wellPath = nullptr; + objHandle->firstAncestorOrThisOfType(wellPath); + if (!wellPath) return cvf::UNDEFINED_DOUBLE; + + RigWellPath* wellPathGeometry = wellPath->wellPathGeometry(); + double wellPathAzimuth = wellPathGeometry->wellPathAzimuthAngle(fracturePosition()); + return wellPathAzimuth; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimWellPathFracture.h b/ApplicationCode/ProjectDataModel/RimWellPathFracture.h index 23b1c508c6..c1ee5dc43f 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathFracture.h +++ b/ApplicationCode/ProjectDataModel/RimWellPathFracture.h @@ -43,6 +43,8 @@ public: virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; virtual void updateAzimuthFromFractureDefinition() override; + double wellAzimuthAtFracturePosition() override; + protected: virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;