mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7811 Modeled Well Path : Optionally use refpoint from top level well path
This commit is contained in:
@@ -140,6 +140,21 @@ void RicWellTarget3dEditor::slotUpdated( const cvf::Vec3d& origin, const cvf::Ve
|
||||
target->firstAncestorOrThisOfTypeAsserted( geomDef );
|
||||
if ( !geomDef ) return;
|
||||
|
||||
if ( geomDef->useReferencePointFromTopLevelWell() )
|
||||
{
|
||||
RimModeledWellPath* modeledWellPath = nullptr;
|
||||
geomDef->firstAncestorOfType( modeledWellPath );
|
||||
if ( modeledWellPath )
|
||||
{
|
||||
auto topLevelWellPath = dynamic_cast<RimModeledWellPath*>( modeledWellPath->topLevelWellPath() );
|
||||
if ( topLevelWellPath )
|
||||
{
|
||||
// Manipulate the reference point of top level well path
|
||||
geomDef = topLevelWellPath->geometryDefinition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf = view->displayCoordTransform();
|
||||
|
||||
auto domainCoordXYZ = dispXf->transformToDomainCoord( origin );
|
||||
|
||||
@@ -92,6 +92,7 @@ RimWellPath* RicNewWellPathLateralAtDepthFeature::createLateralAtMeasuredDepth(
|
||||
if ( project && wellPathColl )
|
||||
{
|
||||
auto newModeledWellPath = new RimModeledWellPath();
|
||||
newModeledWellPath->geometryDefinition()->enableReferencePointFromTopLevelWell( true );
|
||||
|
||||
if ( parentWellPath->wellPathGeometry() && parentWellPath->wellPathGeometry()->measuredDepths().size() > 2 )
|
||||
{
|
||||
@@ -100,7 +101,6 @@ RimWellPath* RicNewWellPathLateralAtDepthFeature::createLateralAtMeasuredDepth(
|
||||
->clippedPointSubset( parentWellPath->wellPathGeometry()->measuredDepths().front(), parentWellMD );
|
||||
|
||||
newModeledWellPath->geometryDefinition()->setMdAtFirstTarget( measuredDepths.back() );
|
||||
// newModeledWellPath->geometryDefinition()->setReferencePointXyz( pointVector.back() );
|
||||
newModeledWellPath->geometryDefinition()->setFixedWellPathPoints( pointVector );
|
||||
newModeledWellPath->geometryDefinition()->setFixedMeasuredDepths( measuredDepths );
|
||||
}
|
||||
|
||||
@@ -275,14 +275,21 @@ void RimModeledWellPath::updateTieInLocationFromParentWell()
|
||||
|
||||
if ( pointVector.size() >= 2u )
|
||||
{
|
||||
auto firstTarget = targets.front();
|
||||
firstTarget->setPointXYZ( pointVector.back() );
|
||||
|
||||
m_geometryDefinition->setIsAttachedToParentWell( true );
|
||||
m_geometryDefinition->setMdAtFirstTarget( measuredDepths.back() );
|
||||
m_geometryDefinition->setFixedWellPathPoints( pointVector );
|
||||
m_geometryDefinition->setFixedMeasuredDepths( measuredDepths );
|
||||
|
||||
updateReferencePoint();
|
||||
|
||||
auto lastPointXYZ = pointVector.back();
|
||||
|
||||
cvf::Vec3d referencePointXYZ = m_geometryDefinition->anchorPointXyz();
|
||||
cvf::Vec3d relativePointXYZ = lastPointXYZ - referencePointXYZ;
|
||||
|
||||
auto firstTarget = targets.front();
|
||||
firstTarget->setPointXYZ( relativePointXYZ );
|
||||
|
||||
updateGeometry( true );
|
||||
}
|
||||
}
|
||||
@@ -295,3 +302,20 @@ void RimModeledWellPath::updateTieInLocationFromParentWell()
|
||||
m_geometryDefinition->setFixedMeasuredDepths( {} );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimModeledWellPath::updateReferencePoint()
|
||||
{
|
||||
if ( !m_geometryDefinition->useReferencePointFromTopLevelWell() ) return;
|
||||
|
||||
RimWellPathTieIn* tieIn = wellPathTieIn();
|
||||
if ( !tieIn ) return;
|
||||
|
||||
auto topLevelModelledWell = dynamic_cast<RimModeledWellPath*>( this->topLevelWellPath() );
|
||||
if ( !topLevelModelledWell ) return;
|
||||
|
||||
auto refPoint = topLevelModelledWell->geometryDefinition()->anchorPointXyz();
|
||||
m_geometryDefinition->setReferencePointXyz( refPoint );
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
RimWellPathGeometryDef* geometryDefinition() const;
|
||||
QString wellPlanText();
|
||||
void updateTieInLocationFromParentWell();
|
||||
void updateReferencePoint();
|
||||
|
||||
private:
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
|
||||
|
||||
@@ -85,6 +85,13 @@ RimWellPathGeometryDef::RimWellPathGeometryDef()
|
||||
m_wellTargets.uiCapability()->setCustomContextMenuEnabled( true );
|
||||
|
||||
CAF_PDM_InitField( &m_showAbsolutePosForWellTargets, "ShowAbsolutePosForWellTargets", false, "Show UTM Coords", "", "", "" );
|
||||
CAF_PDM_InitField( &m_useTopLevelWellReferencePoint,
|
||||
"UseTopLevelWellReferencePoint",
|
||||
false,
|
||||
"Use Top Level Well Reference Point",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_useAutoGeneratedTargetAtSeaLevel,
|
||||
"UseAutoGeneratedTargetAtSeaLevel",
|
||||
@@ -145,6 +152,22 @@ void RimWellPathGeometryDef::setReferencePointXyz( const cvf::Vec3d& refPointXyz
|
||||
m_referencePointUtmXyd = xyd;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellPathGeometryDef::useReferencePointFromTopLevelWell() const
|
||||
{
|
||||
return m_useTopLevelWellReferencePoint;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathGeometryDef::enableReferencePointFromTopLevelWell( bool enable )
|
||||
{
|
||||
m_useTopLevelWellReferencePoint = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -464,9 +487,12 @@ void RimWellPathGeometryDef::fieldChangedByUi( const caf::PdmFieldHandle* change
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathGeometryDef::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_referencePointUtmXyd );
|
||||
uiOrdering.add( &m_useTopLevelWellReferencePoint );
|
||||
m_referencePointUtmXyd.uiCapability()->setUiReadOnly( m_useTopLevelWellReferencePoint );
|
||||
|
||||
if ( !m_isAttachedToParentWell )
|
||||
{
|
||||
uiOrdering.add( &m_referencePointUtmXyd );
|
||||
uiOrdering.add( &m_airGap );
|
||||
uiOrdering.add( &m_mdAtFirstTarget );
|
||||
uiOrdering.add( &m_useAutoGeneratedTargetAtSeaLevel );
|
||||
|
||||
@@ -52,6 +52,8 @@ public:
|
||||
cvf::Vec3d anchorPointXyz() const;
|
||||
cvf::Vec3d anchorPointXyd() const;
|
||||
void setReferencePointXyz( const cvf::Vec3d& refPointXyz );
|
||||
bool useReferencePointFromTopLevelWell() const;
|
||||
void enableReferencePointFromTopLevelWell( bool enable );
|
||||
|
||||
double airGap() const;
|
||||
void setAirGap( double airGap );
|
||||
@@ -122,6 +124,7 @@ private:
|
||||
|
||||
caf::PdmChildArrayField<RimWellPathTarget*> m_wellTargets;
|
||||
caf::PdmField<bool> m_showAbsolutePosForWellTargets;
|
||||
caf::PdmField<bool> m_useTopLevelWellReferencePoint;
|
||||
|
||||
caf::PdmField<bool> m_useAutoGeneratedTargetAtSeaLevel;
|
||||
caf::PdmChildField<RimWellPathTarget*> m_autoTargetAtSeaLevel;
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
|
||||
#include "cafPdmUiCommandSystemProxy.h"
|
||||
#include <cmath>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellPathTarget, "WellPathTarget" );
|
||||
|
||||
@@ -127,9 +127,15 @@ void RimWellPathTieIn::updateFirstTargetFromParentWell()
|
||||
newTarget = modeledWellPath->geometryDefinition()->activeWellTargets().front();
|
||||
}
|
||||
|
||||
auto lastPoint = pointVector.back();
|
||||
auto tangent = lastPoint - pointVector[pointVector.size() - 2];
|
||||
newTarget->setAsPointXYZAndTangentTarget( { lastPoint[0], lastPoint[1], lastPoint[2] }, tangent );
|
||||
auto lastPointXYZ = pointVector.back();
|
||||
auto tangent = lastPointXYZ - pointVector[pointVector.size() - 2];
|
||||
|
||||
modeledWellPath->updateReferencePoint();
|
||||
cvf::Vec3d referencePointXYZ = modeledWellPath->geometryDefinition()->anchorPointXyz();
|
||||
cvf::Vec3d relativePointXYZ = lastPointXYZ - referencePointXYZ;
|
||||
|
||||
newTarget->setAsPointXYZAndTangentTarget( { relativePointXYZ[0], relativePointXYZ[1], relativePointXYZ[2] },
|
||||
tangent );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user