From f6675b7c455d2b3c6075d8d2aa034a7f3723a095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Thu, 14 Nov 2019 17:23:52 +0100 Subject: [PATCH] #4789, #5045 Made wellpath calculator control dogleg editability Making them correct. Doglegs with an actual value less than the user provided value are colored green. Removed the text stating that the constraint is not met. --- .../RiaLineArcWellPathCalculator.cpp | 11 ++++ .../RiaLineArcWellPathCalculator.h | 3 + .../RimWellPathGeometryDef.cpp | 9 +-- .../ProjectDataModel/RimWellPathTarget.cpp | 64 +++++++++++++------ .../ProjectDataModel/RimWellPathTarget.h | 4 +- 5 files changed, 65 insertions(+), 26 deletions(-) diff --git a/ApplicationCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.cpp b/ApplicationCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.cpp index 4b3fb3a949..88c06fcce1 100644 --- a/ApplicationCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.cpp +++ b/ApplicationCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.cpp @@ -46,8 +46,10 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& {!activeWellPathTargets[0].isTangentConstrained, 0.0, 0.0, + false, true, std::numeric_limits::infinity(), + false, true, std::numeric_limits::infinity()} ); } @@ -60,8 +62,10 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& 0.0, 0.0, false, + false, std::numeric_limits::infinity(), false, + false, std::numeric_limits::infinity()} ); std::vector adjustedWellPathTargets = activeWellPathTargets; @@ -130,6 +134,8 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& target1Status.hasDerivedTangent = true; target1Status.resultAzimuth = jCurve.endAzimuth() + M_PI; target1Status.resultInclination = M_PI - jCurve.endInclination(); + + target2Status.isRadius1Editable = true; } else // The complete wellpath is a straight line from target 1 to 2 { @@ -210,6 +216,9 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& m_lineArcEndpoints.push_back( sCurveCalc.firstArcEndpoint() + referencePointXyz ); m_lineArcEndpoints.push_back( sCurveCalc.secondArcStartpoint() + referencePointXyz ); m_lineArcEndpoints.push_back( target2.targetPointXYZ + referencePointXyz ); + + target1Status.isRadius2Editable = true; + target2Status.isRadius1Editable = true; } } } @@ -244,6 +253,8 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& m_lineArcEndpoints.push_back( target2.targetPointXYZ + referencePointXyz ); + target1Status.isRadius2Editable = true; + target2Status.hasDerivedTangent = true; target2Status.resultAzimuth = jCurve.endAzimuth(); target2Status.resultInclination = jCurve.endInclination(); diff --git a/ApplicationCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.h b/ApplicationCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.h index 854cd83a76..fb51480317 100644 --- a/ApplicationCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.h +++ b/ApplicationCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.h @@ -45,8 +45,11 @@ public: double resultAzimuth; double resultInclination; + bool isRadius1Editable; bool hasOverriddenRadius1; double resultRadius1; + + bool isRadius2Editable; bool hasOverriddenRadius2; double resultRadius2; }; diff --git a/ApplicationCode/ProjectDataModel/RimWellPathGeometryDef.cpp b/ApplicationCode/ProjectDataModel/RimWellPathGeometryDef.cpp index 1a4c76d4c2..01972a43a2 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathGeometryDef.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathGeometryDef.cpp @@ -159,6 +159,7 @@ cvf::ref RimWellPathGeometryDef::createWellPathGeometry() RiaPolyArcLineSampler arcLineSampler( wellPathCalculator.startTangent(), wellPathCalculator.lineArcEndpoints() ); + arcLineSampler.sampledPointsAndMDs( 30, false, &( wellPathGeometry->m_wellPathPoints ), @@ -562,8 +563,8 @@ RiaLineArcWellPathCalculator RimWellPathGeometryDef::lineArcWellPathCalculator() for ( size_t tIdx = 0; tIdx < wellTargets.size(); ++tIdx ) { - wellTargets[tIdx]->flagRadius1AsIncorrect( false, 0 ); - wellTargets[tIdx]->flagRadius2AsIncorrect( false, 0 ); + wellTargets[tIdx]->flagRadius1AsIncorrect(targetStatuses[tIdx].isRadius1Editable, false, 0 ); + wellTargets[tIdx]->flagRadius2AsIncorrect(targetStatuses[tIdx].isRadius2Editable, false, 0 ); if ( targetStatuses[tIdx].hasDerivedTangent ) { @@ -573,12 +574,12 @@ RiaLineArcWellPathCalculator RimWellPathGeometryDef::lineArcWellPathCalculator() if ( targetStatuses[tIdx].hasOverriddenRadius1 ) { - wellTargets[tIdx]->flagRadius1AsIncorrect( true, targetStatuses[tIdx].resultRadius1 ); + wellTargets[tIdx]->flagRadius1AsIncorrect( targetStatuses[tIdx].isRadius1Editable, true, targetStatuses[tIdx].resultRadius1 ); } if ( targetStatuses[tIdx].hasOverriddenRadius2 ) { - wellTargets[tIdx]->flagRadius2AsIncorrect( true, targetStatuses[tIdx].resultRadius2 ); + wellTargets[tIdx]->flagRadius2AsIncorrect( targetStatuses[tIdx].isRadius2Editable, true, targetStatuses[tIdx].resultRadius2 ); } } diff --git a/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp b/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp index b5b825da5d..85848c8e4b 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellPathTarget.cpp @@ -201,37 +201,61 @@ double doglegFromRadius( double radius ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPathTarget::flagRadius1AsIncorrect( bool isIncorrect, double actualRadius ) +void RimWellPathTarget::flagRadius1AsIncorrect( bool isEditable, bool isIncorrect, double actualRadius ) { if ( isIncorrect ) { - m_dogleg1.uiCapability()->setUiContentTextColor( Qt::red ); - m_dogleg1.uiCapability()->setUiToolTip( "The dogleg constraint is not satisfied! Actual Dogleg: " + - QString::number( doglegFromRadius( actualRadius ) ) ); + if ( actualRadius < radius1() ) + { + m_dogleg1.uiCapability()->setUiContentTextColor( Qt::red ); + m_dogleg1.uiCapability()->setUiToolTip( + "Actual Dogleg: " + QString::number( doglegFromRadius( actualRadius ) ) + + "\nThe dogleg constraint is not satisfied!" ); + } + else + { + m_dogleg1.uiCapability()->setUiContentTextColor( Qt::darkGreen ); + m_dogleg1.uiCapability()->setUiToolTip( "Actual Dogleg: " + + QString::number( doglegFromRadius( actualRadius ) ) ); + } } else { m_dogleg1.uiCapability()->setUiContentTextColor( QColor() ); m_dogleg1.uiCapability()->setUiToolTip( "" ); } + + m_dogleg1.uiCapability()->setUiReadOnly( !isEditable ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPathTarget::flagRadius2AsIncorrect( bool isIncorrect, double actualRadius ) +void RimWellPathTarget::flagRadius2AsIncorrect( bool isEditable, bool isIncorrect, double actualRadius ) { if ( isIncorrect ) { - m_dogleg2.uiCapability()->setUiContentTextColor( Qt::red ); - m_dogleg2.uiCapability()->setUiToolTip( "The dogleg constraint is not satisfied! Actual Dogleg: " + - QString::number( doglegFromRadius( actualRadius ) ) ); + if ( actualRadius < radius2() ) + { + m_dogleg2.uiCapability()->setUiContentTextColor( Qt::red ); + m_dogleg2.uiCapability()->setUiToolTip( + "Actual Dogleg: " + QString::number( doglegFromRadius( actualRadius ) ) + + "\nThe dogleg constraint is not satisfied!" ); + } + else + { + m_dogleg2.uiCapability()->setUiContentTextColor( Qt::darkGreen ); + m_dogleg2.uiCapability()->setUiToolTip( "Actual Dogleg: " + + QString::number( doglegFromRadius( actualRadius ) ) ); + } } else { m_dogleg2.uiCapability()->setUiContentTextColor( QColor() ); m_dogleg2.uiCapability()->setUiToolTip( "" ); } + + m_dogleg2.uiCapability()->setUiReadOnly( !isEditable ); } //-------------------------------------------------------------------------------------------------- @@ -296,33 +320,33 @@ void RimWellPathTarget::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi m_hasTangentConstraintUiField.uiCapability()->setUiReadOnly( false ); m_targetType.uiCapability()->setUiReadOnly( false ); m_targetPoint.uiCapability()->setUiReadOnly( false ); - m_dogleg2.uiCapability()->setUiReadOnly( false ); + // m_dogleg2.uiCapability()->setUiReadOnly( false ); if ( m_targetType == POINT ) { m_azimuth.uiCapability()->setUiReadOnly( true ); m_inclination.uiCapability()->setUiReadOnly( true ); - m_dogleg1.uiCapability()->setUiReadOnly( true ); + // m_dogleg1.uiCapability()->setUiReadOnly( true ); } else { m_azimuth.uiCapability()->setUiReadOnly( false ); m_inclination.uiCapability()->setUiReadOnly( false ); - m_dogleg1.uiCapability()->setUiReadOnly( false ); + // m_dogleg1.uiCapability()->setUiReadOnly( false ); } RimWellPathGeometryDef* geomDef = nullptr; firstAncestorOrThisOfTypeAsserted( geomDef ); - if ( this == geomDef->firstActiveTarget() ) - { - m_dogleg1.uiCapability()->setUiReadOnly( true ); - } - - if ( this == geomDef->lastActiveTarget() ) - { - m_dogleg2.uiCapability()->setUiReadOnly( true ); - } + // if ( this == geomDef->firstActiveTarget() ) + //{ + // m_dogleg1.uiCapability()->setUiReadOnly( true ); + //} + // + // if ( this == geomDef->lastActiveTarget() ) + //{ + // m_dogleg2.uiCapability()->setUiReadOnly( true ); + //} } else { diff --git a/ApplicationCode/ProjectDataModel/RimWellPathTarget.h b/ApplicationCode/ProjectDataModel/RimWellPathTarget.h index 93926d680f..7f444f37aa 100644 --- a/ApplicationCode/ProjectDataModel/RimWellPathTarget.h +++ b/ApplicationCode/ProjectDataModel/RimWellPathTarget.h @@ -53,8 +53,8 @@ public: cvf::Vec3d tangent() const; double radius1() const; double radius2() const; - void flagRadius1AsIncorrect( bool isIncorrect, double actualRadius ); - void flagRadius2AsIncorrect( bool isIncorrect, double actualRadius ); + void flagRadius1AsIncorrect( bool isEditable, bool isIncorrect, double actualRadius ); + void flagRadius2AsIncorrect( bool isEditable, bool isIncorrect, double actualRadius ); private: QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,