#7811 Modeled Well Path : Optionally show absolute coordinates

This commit is contained in:
Magne Sjaastad 2021-06-28 09:48:38 +02:00
parent eb3c52aeb1
commit 62d67a52c7
9 changed files with 241 additions and 99 deletions

View File

@ -57,14 +57,7 @@ RicWellTarget3dEditor::~RicWellTarget3dEditor()
ownerRiuViewer->removeStaticModel( m_cvfModel.p() );
}
RimWellPathTarget* oldTarget = dynamic_cast<RimWellPathTarget*>( this->pdmObject() );
if ( oldTarget )
{
oldTarget->m_targetType.uiCapability()->removeFieldEditor( this );
oldTarget->m_targetPoint.uiCapability()->removeFieldEditor( this );
oldTarget->m_azimuth.uiCapability()->removeFieldEditor( this );
oldTarget->m_inclination.uiCapability()->removeFieldEditor( this );
}
removeAllFieldEditors();
delete m_manipulator;
}
@ -88,10 +81,10 @@ void RicWellTarget3dEditor::configureAndUpdateUi( const QString& uiConfigName )
RimWellPathGeometryDef* geomDef;
target->firstAncestorOrThisOfTypeAsserted( geomDef );
target->m_targetType.uiCapability()->addFieldEditor( this );
target->m_targetPoint.uiCapability()->addFieldEditor( this );
target->m_azimuth.uiCapability()->addFieldEditor( this );
target->m_inclination.uiCapability()->addFieldEditor( this );
for ( auto field : target->fieldsFor3dManipulator() )
{
field->uiCapability()->addFieldEditor( this );
}
if ( m_manipulator.isNull() )
{
@ -127,14 +120,7 @@ void RicWellTarget3dEditor::configureAndUpdateUi( const QString& uiConfigName )
//--------------------------------------------------------------------------------------------------
void RicWellTarget3dEditor::cleanupBeforeSettingPdmObject()
{
RimWellPathTarget* oldTarget = dynamic_cast<RimWellPathTarget*>( this->pdmObject() );
if ( oldTarget )
{
oldTarget->m_targetType.uiCapability()->removeFieldEditor( this );
oldTarget->m_targetPoint.uiCapability()->removeFieldEditor( this );
oldTarget->m_azimuth.uiCapability()->removeFieldEditor( this );
oldTarget->m_inclination.uiCapability()->removeFieldEditor( this );
}
removeAllFieldEditors();
}
//--------------------------------------------------------------------------------------------------
@ -150,18 +136,38 @@ void RicWellTarget3dEditor::slotUpdated( const cvf::Vec3d& origin, const cvf::Ve
return;
}
cvf::ref<caf::DisplayCoordTransform> dispXf = view->displayCoordTransform();
RimWellPathGeometryDef* geomDef;
target->firstAncestorOrThisOfTypeAsserted( geomDef );
if ( !geomDef ) return;
cvf::Vec3d domainOrigin = dispXf->transformToDomainCoord( origin ) - geomDef->anchorPointXyz();
domainOrigin.z() = -domainOrigin.z();
QVariant originVariant = caf::PdmValueFieldSpecialization<cvf::Vec3d>::convert( domainOrigin );
cvf::ref<caf::DisplayCoordTransform> dispXf = view->displayCoordTransform();
target->enableFullUpdate( false );
caf::PdmUiCommandSystemProxy::instance()->setUiValueToField( target->m_targetPoint.uiCapability(), originVariant );
target->enableFullUpdate( true );
auto domainCoordXYZ = dispXf->transformToDomainCoord( origin );
// If CTRL is pressed, modify the reference point instead of the well path target
bool modifyReferencePoint = ( QApplication::keyboardModifiers() & Qt::ControlModifier );
if ( modifyReferencePoint )
{
auto relativePositionXYZ = domainCoordXYZ - geomDef->anchorPointXyz();
auto delta = target->targetPointXYZ() - relativePositionXYZ;
auto currentRefPointXyz = geomDef->anchorPointXyz();
auto newRefPointXyz = currentRefPointXyz - delta;
geomDef->setReferencePointXyz( newRefPointXyz );
geomDef->changed.send( false );
geomDef->updateWellPathVisualization( true );
for ( auto wt : geomDef->activeWellTargets() )
{
wt->updateConnectedEditors();
}
}
else
{
cvf::Vec3d relativePositionXYD = domainCoordXYZ - geomDef->anchorPointXyz();
relativePositionXYD.z() = -relativePositionXYD.z();
target->updateFrom3DManipulator( relativePositionXYD );
}
}
//--------------------------------------------------------------------------------------------------
@ -191,3 +197,17 @@ void RicWellTarget3dEditor::slotDragFinished()
target->onMoved();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicWellTarget3dEditor::removeAllFieldEditors()
{
if ( RimWellPathTarget* oldTarget = dynamic_cast<RimWellPathTarget*>( this->pdmObject() ) )
{
for ( auto field : oldTarget->fieldsFor3dManipulator() )
{
field->uiCapability()->removeFieldEditor( this );
}
}
}

View File

@ -20,18 +20,19 @@
#include "Ric3dObjectEditorHandle.h"
class RicPointTangentManipulator;
#include "cvfObject.h"
#include "cvfVector3.h"
#include <QPointer>
class RicPointTangentManipulator;
namespace cvf
{
class ModelBasicList;
}
class QString;
#include <QPointer>
class RicWellTarget3dEditor : public Ric3dObjectEditorHandle
{
@ -50,6 +51,9 @@ private slots:
void slotSelectedIn3D();
void slotDragFinished();
private:
void removeAllFieldEditors();
private:
QPointer<RicPointTangentManipulator> m_manipulator;
cvf::ref<cvf::ModelBasicList> m_cvfModel;

View File

@ -100,6 +100,7 @@ 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 );
}

View File

@ -265,14 +265,15 @@ void RimModeledWellPath::updateTieInLocationFromParentWell()
parentWellPath = tieIn->parentWell();
auto targets = m_geometryDefinition->activeWellTargets();
if ( parentWellPath && !targets.empty() )
if ( parentWellPath && !targets.empty() && parentWellPath->wellPathGeometry() &&
!parentWellPath->wellPathGeometry()->measuredDepths().empty() )
{
auto [pointVector, measuredDepths] =
parentWellPath->wellPathGeometry()
->clippedPointSubset( parentWellPath->wellPathGeometry()->measuredDepths().front(),
tieIn->tieInMeasuredDepth() );
if ( pointVector.size() > 2u )
if ( pointVector.size() >= 2u )
{
auto firstTarget = targets.front();
firstTarget->setPointXYZ( pointVector.back() );

View File

@ -84,6 +84,8 @@ RimWellPathGeometryDef::RimWellPathGeometryDef()
m_wellTargets.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP );
m_wellTargets.uiCapability()->setCustomContextMenuEnabled( true );
CAF_PDM_InitField( &m_showAbsolutePosForWellTargets, "ShowAbsolutePosForWellTargets", false, "Show UTM Coords", "", "", "" );
CAF_PDM_InitScriptableField( &m_useAutoGeneratedTargetAtSeaLevel,
"UseAutoGeneratedTargetAtSeaLevel",
true,
@ -125,6 +127,14 @@ cvf::Vec3d RimWellPathGeometryDef::anchorPointXyz() const
return xyz;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimWellPathGeometryDef::anchorPointXyd() const
{
return m_referencePointUtmXyd();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -284,6 +294,14 @@ double RimWellPathGeometryDef::sphereRadiusFactor() const
return m_sphereRadiusFactor();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellPathGeometryDef::showAbsoluteCoordinates() const
{
return m_showAbsolutePosForWellTargets;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -459,6 +477,7 @@ void RimWellPathGeometryDef::defineUiOrdering( QString uiConfigName, caf::PdmUiO
group->add( &m_sphereColor );
group->add( &m_sphereRadiusFactor );
uiOrdering.add( &m_showAbsolutePosForWellTargets );
uiOrdering.add( &m_wellTargets );
uiOrdering.add( &m_pickPointsEnabled );

View File

@ -50,6 +50,7 @@ public:
~RimWellPathGeometryDef() override;
cvf::Vec3d anchorPointXyz() const;
cvf::Vec3d anchorPointXyd() const;
void setReferencePointXyz( const cvf::Vec3d& refPointXyz );
double airGap() const;
@ -87,6 +88,7 @@ public:
bool showSpheres() const;
cvf::Color3f sphereColor() const;
double sphereRadiusFactor() const;
bool showAbsoluteCoordinates() const;
protected:
void defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget ) override;
@ -116,13 +118,16 @@ private:
caf::PdmField<double> m_airGap;
caf::PdmField<double> m_mdAtFirstTarget;
caf::PdmField<double> m_mdAtFirstTarget;
caf::PdmChildArrayField<RimWellPathTarget*> m_wellTargets;
caf::PdmField<bool> m_useAutoGeneratedTargetAtSeaLevel;
caf::PdmChildField<RimWellPathTarget*> m_autoTargetAtSeaLevel;
caf::PdmField<bool> m_pickPointsEnabled;
caf::PdmField<std::vector<cvf::Vec3d>> m_fixedWellPathPoints;
caf::PdmField<std::vector<double>> m_fixedMeasuredDepths;
caf::PdmField<bool> m_showAbsolutePosForWellTargets;
caf::PdmField<bool> m_useAutoGeneratedTargetAtSeaLevel;
caf::PdmChildField<RimWellPathTarget*> m_autoTargetAtSeaLevel;
caf::PdmField<bool> m_pickPointsEnabled;
caf::PdmField<std::vector<cvf::Vec3d>> m_fixedWellPathPoints;
caf::PdmField<std::vector<double>> m_fixedMeasuredDepths;
caf::PdmField<bool> m_isAttachedToParentWell;

View File

@ -32,6 +32,7 @@
#include "cafPdmUiCheckBoxEditor.h"
#include "cafPdmUiLineEditor.h"
#include "cafPdmUiCommandSystemProxy.h"
#include <cmath>
CAF_PDM_SOURCE_INIT( RimWellPathTarget, "WellPathTarget" );
@ -41,9 +42,9 @@ namespace caf
template <>
void caf::AppEnum<RimWellPathTarget::TargetTypeEnum>::setUp()
{
addItem( RimWellPathTarget::POINT_AND_TANGENT, "POINT_AND_TANGENT", "Point and Tangent" );
addItem( RimWellPathTarget::POINT, "POINT", "Point" );
setDefault( RimWellPathTarget::POINT_AND_TANGENT );
addItem( RimWellPathTarget::TargetTypeEnum::POINT_AND_TANGENT, "POINT_AND_TANGENT", "Point and Tangent" );
addItem( RimWellPathTarget::TargetTypeEnum::POINT, "POINT", "Point" );
setDefault( RimWellPathTarget::TargetTypeEnum::POINT_AND_TANGENT );
}
} // namespace caf
//--------------------------------------------------------------------------------------------------
@ -51,8 +52,8 @@ void caf::AppEnum<RimWellPathTarget::TargetTypeEnum>::setUp()
//--------------------------------------------------------------------------------------------------
RimWellPathTarget::RimWellPathTarget()
: moved( this )
, m_targetType( POINT_AND_TANGENT )
, m_targetPoint( cvf::Vec3d::ZERO )
, m_targetType( TargetTypeEnum::POINT_AND_TANGENT )
, m_targetPointXYD( cvf::Vec3d::ZERO )
, m_azimuth( 0.0 )
, m_inclination( 0.0 )
, m_isFullUpdateEnabled( true )
@ -67,20 +68,22 @@ RimWellPathTarget::RimWellPathTarget()
CAF_PDM_InitField( &m_isEnabled, "IsEnabled", true, "", "", "", "" );
CAF_PDM_InitField( &m_isLocked, "IsLocked", false, "", "", "", "" );
m_isLocked.uiCapability()->setUiHidden( true );
// m_targetType.uiCapability()->setUiHidden(true);
CAF_PDM_InitScriptableFieldNoDefault( &m_targetPoint, "TargetPoint", "Point", "", "", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_targetPointXYD, "TargetPoint", "Relative Coord", "", "", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_targetPointForDisplay, "TargetPointForDisplay", "UTM Coord", "", "", "" );
m_targetPointForDisplay.registerGetMethod( this, &RimWellPathTarget::targetPointForDisplayXYD );
m_targetPointForDisplay.registerSetMethod( this, &RimWellPathTarget::setTargetPointFromDisplayCoord );
CAF_PDM_InitScriptableField( &m_dogleg1, "Dogleg1", 3.0, "DL in", "", "[deg/30m]", "" );
CAF_PDM_InitScriptableField( &m_dogleg2, "Dogleg2", 3.0, "DL out", "", "[deg/30m]", "" );
CAF_PDM_InitFieldNoDefault( &m_targetType, "TargetType", "Type", "", "", "" );
m_targetType.uiCapability()->setUiHidden( true );
CAF_PDM_InitField( &m_hasTangentConstraintUiField, "HasTangentConstraint", false, "Dir", "", "", "" );
m_hasTangentConstraintUiField.xmlCapability()->disableIO();
CAF_PDM_InitScriptableField( &m_azimuth, "Azimuth", 0.0, "Azi(deg)", "", "", "" );
CAF_PDM_InitScriptableField( &m_inclination, "Inclination", 0.0, "Inc(deg)", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_parentWellPath, "ParentWellPath", "Parent Well Path", "", "", "" );
m_parentWellPath.uiCapability()->setUiHidden( true );
}
//--------------------------------------------------------------------------------------------------
@ -111,7 +114,7 @@ bool RimWellPathTarget::isEnabled() const
//--------------------------------------------------------------------------------------------------
void RimWellPathTarget::setPointXYZ( const cvf::Vec3d& point )
{
m_targetPoint = { point.x(), point.y(), -point.z() };
m_targetPointXYD = { point.x(), point.y(), -point.z() };
}
//--------------------------------------------------------------------------------------------------
@ -119,10 +122,10 @@ void RimWellPathTarget::setPointXYZ( const cvf::Vec3d& point )
//--------------------------------------------------------------------------------------------------
void RimWellPathTarget::setAsPointTargetXYD( const cvf::Vec3d& point )
{
m_targetType = POINT;
m_targetPoint = point;
m_azimuth = 0.0;
m_inclination = 0.0;
m_targetType = TargetTypeEnum::POINT;
m_targetPointXYD = point;
m_azimuth = 0.0;
m_inclination = 0.0;
}
//--------------------------------------------------------------------------------------------------
@ -130,10 +133,10 @@ void RimWellPathTarget::setAsPointTargetXYD( const cvf::Vec3d& point )
//--------------------------------------------------------------------------------------------------
void RimWellPathTarget::setAsPointTargetXYZ( const cvf::Vec3d& point )
{
m_targetType = POINT;
m_targetPoint = cvf::Vec3d( point.x(), point.y(), -point.z() );
m_azimuth = 0.0;
m_inclination = 0.0;
m_targetType = TargetTypeEnum::POINT;
m_targetPointXYD = cvf::Vec3d( point.x(), point.y(), -point.z() );
m_azimuth = 0.0;
m_inclination = 0.0;
}
//--------------------------------------------------------------------------------------------------
@ -150,10 +153,10 @@ void RimWellPathTarget::setAsPointXYZAndTangentTarget( const cvf::Vec3d& point,
//--------------------------------------------------------------------------------------------------
void RimWellPathTarget::setAsPointXYZAndTangentTarget( const cvf::Vec3d& point, double azimuth, double inclination )
{
m_targetType = POINT_AND_TANGENT;
m_targetPoint = cvf::Vec3d( point.x(), point.y(), -point.z() );
m_azimuth = cvf::Math::toDegrees( azimuth );
m_inclination = cvf::Math::toDegrees( inclination );
m_targetType = TargetTypeEnum::POINT_AND_TANGENT;
m_targetPointXYD = cvf::Vec3d( point.x(), point.y(), -point.z() );
m_azimuth = cvf::Math::toDegrees( azimuth );
m_inclination = cvf::Math::toDegrees( inclination );
}
//--------------------------------------------------------------------------------------------------
@ -161,13 +164,23 @@ void RimWellPathTarget::setAsPointXYZAndTangentTarget( const cvf::Vec3d& point,
//--------------------------------------------------------------------------------------------------
void RimWellPathTarget::setDerivedTangent( double azimuth, double inclination )
{
if ( m_targetType == POINT )
if ( m_targetType == TargetTypeEnum::POINT )
{
m_azimuth = cvf::Math::toDegrees( azimuth );
m_inclination = cvf::Math::toDegrees( inclination );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathTarget::updateFrom3DManipulator( const cvf::Vec3d& pointXYD )
{
enableFullUpdate( false );
m_targetPointXYD.setValueWithFieldChanged( pointXYD );
enableFullUpdate( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -176,7 +189,7 @@ RiaLineArcWellPathCalculator::WellTarget RimWellPathTarget::wellTargetData()
RiaLineArcWellPathCalculator::WellTarget targetData;
targetData.targetPointXYZ = targetPointXYZ();
targetData.isTangentConstrained = ( targetType() == POINT_AND_TANGENT );
targetData.isTangentConstrained = ( targetType() == TargetTypeEnum::POINT_AND_TANGENT );
targetData.azimuth = azimuth();
targetData.inclination = inclination();
targetData.radius1 = radius1();
@ -198,7 +211,7 @@ RimWellPathTarget::TargetTypeEnum RimWellPathTarget::targetType() const
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimWellPathTarget::targetPointXYZ() const
{
cvf::Vec3d xyzPoint( m_targetPoint() );
cvf::Vec3d xyzPoint( m_targetPointXYD() );
xyzPoint.z() = -xyzPoint.z();
return xyzPoint;
}
@ -208,7 +221,7 @@ cvf::Vec3d RimWellPathTarget::targetPointXYZ() const
//--------------------------------------------------------------------------------------------------
double RimWellPathTarget::azimuth() const
{
if ( m_targetType() == POINT_AND_TANGENT )
if ( m_targetType() == TargetTypeEnum::POINT_AND_TANGENT )
{
return cvf::Math::toRadians( m_azimuth );
}
@ -223,7 +236,7 @@ double RimWellPathTarget::azimuth() const
//--------------------------------------------------------------------------------------------------
double RimWellPathTarget::inclination() const
{
if ( m_targetType() == POINT_AND_TANGENT )
if ( m_targetType() == TargetTypeEnum::POINT_AND_TANGENT )
{
return cvf::Math::toRadians( m_inclination );
}
@ -338,6 +351,14 @@ void RimWellPathTarget::flagRadius2AsIncorrect( bool isEditable, bool isIncorrec
m_dogleg2.uiCapability()->setUiReadOnly( !isEditable );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<caf::PdmFieldHandle*> RimWellPathTarget::fieldsFor3dManipulator()
{
return { &m_targetType, &m_targetPointXYD, &m_azimuth, &m_inclination };
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -361,17 +382,75 @@ void RimWellPathTarget::defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute )
{
if ( field == &m_targetPoint )
if ( field == &m_targetPointXYD )
{
auto uiDisplayStringAttr = dynamic_cast<caf::PdmUiLineEditorAttributeUiDisplayString*>( attribute );
if ( uiDisplayStringAttr )
{
uiDisplayStringAttr->m_displayString = QString::number( m_targetPoint()[0], 'f', 2 ) + " " +
QString::number( m_targetPoint()[1], 'f', 2 ) + " " +
QString::number( m_targetPoint()[2], 'f', 2 );
uiDisplayStringAttr->m_displayString = QString::number( m_targetPointXYD()[0], 'f', 2 ) + " " +
QString::number( m_targetPointXYD()[1], 'f', 2 ) + " " +
QString::number( m_targetPointXYD()[2], 'f', 2 );
}
}
else if ( field == &m_targetPointForDisplay )
{
auto uiDisplayStringAttr = dynamic_cast<caf::PdmUiLineEditorAttributeUiDisplayString*>( attribute );
if ( uiDisplayStringAttr )
{
uiDisplayStringAttr->m_displayString = QString::number( m_targetPointForDisplay()[0], 'f', 2 ) + " " +
QString::number( m_targetPointForDisplay()[1], 'f', 2 ) + " " +
QString::number( m_targetPointForDisplay()[2], 'f', 2 );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RimWellPathTarget::targetPointForDisplayXYD() const
{
auto geoDef = geometryDefinition();
if ( geoDef && geoDef->showAbsoluteCoordinates() )
{
auto offsetXYZ = geoDef->anchorPointXyz();
auto coordXYD = targetPointXYZ() + offsetXYZ;
coordXYD.z() = -coordXYD.z();
return coordXYD;
}
return m_targetPointXYD();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPathTarget::setTargetPointFromDisplayCoord( const cvf::Vec3d& coordInXYD )
{
cvf::Vec3d offsetXYD = cvf::Vec3d::ZERO;
auto geoDef = geometryDefinition();
if ( geoDef && geoDef->showAbsoluteCoordinates() )
{
offsetXYD = geoDef->anchorPointXyd();
}
auto newCoordInXYD = coordInXYD - offsetXYD;
m_targetPointXYD = newCoordInXYD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathGeometryDef* RimWellPathTarget::geometryDefinition() const
{
RimWellPathGeometryDef* geoDef = nullptr;
this->firstAncestorOfType( geoDef );
return geoDef;
}
//--------------------------------------------------------------------------------------------------
@ -385,11 +464,12 @@ QList<caf::PdmOptionItemInfo> RimWellPathTarget::calculateValueOptions( const ca
{
options.push_back(
caf::PdmOptionItemInfo( "o->",
RimWellPathTarget::POINT_AND_TANGENT ) ); //, false,
// QIcon(":/WellTargetPointTangent16x16.png")
//));
options.push_back( caf::PdmOptionItemInfo( "o", RimWellPathTarget::POINT ) ); //, false,
// QIcon(":/WellTargetPoint16x16.png")));
RimWellPathTarget::TargetTypeEnum::POINT_AND_TANGENT ) ); //, false,
// QIcon(":/WellTargetPointTangent16x16.png")
//));
options.push_back(
caf::PdmOptionItemInfo( "o", RimWellPathTarget::TargetTypeEnum::POINT ) ); //, false,
// QIcon(":/WellTargetPoint16x16.png")));
}
return options;
}
@ -404,9 +484,9 @@ void RimWellPathTarget::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
if ( changedField == &m_hasTangentConstraintUiField )
{
if ( m_hasTangentConstraintUiField )
m_targetType = POINT_AND_TANGENT;
m_targetType = TargetTypeEnum::POINT_AND_TANGENT;
else
m_targetType = POINT;
m_targetType = TargetTypeEnum::POINT;
}
moved.send( m_isFullUpdateEnabled );
@ -417,15 +497,15 @@ void RimWellPathTarget::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
//--------------------------------------------------------------------------------------------------
void RimWellPathTarget::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
m_hasTangentConstraintUiField = ( m_targetType == POINT_AND_TANGENT );
m_hasTangentConstraintUiField = ( m_targetType == TargetTypeEnum::POINT_AND_TANGENT );
if ( m_isEnabled() && !m_isLocked() )
{
m_hasTangentConstraintUiField.uiCapability()->setUiReadOnly( false );
m_targetType.uiCapability()->setUiReadOnly( false );
m_targetPoint.uiCapability()->setUiReadOnly( false );
m_targetPointXYD.uiCapability()->setUiReadOnly( false );
if ( m_targetType == POINT )
if ( m_targetType == TargetTypeEnum::POINT )
{
m_azimuth.uiCapability()->setUiReadOnly( true );
m_inclination.uiCapability()->setUiReadOnly( true );
@ -440,7 +520,7 @@ void RimWellPathTarget::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi
{
m_dogleg1.uiCapability()->setUiReadOnly( true );
m_targetType.uiCapability()->setUiReadOnly( true );
m_targetPoint.uiCapability()->setUiReadOnly( true );
m_targetPointXYD.uiCapability()->setUiReadOnly( true );
m_azimuth.uiCapability()->setUiReadOnly( true );
m_inclination.uiCapability()->setUiReadOnly( true );
m_dogleg2.uiCapability()->setUiReadOnly( true );
@ -451,4 +531,15 @@ void RimWellPathTarget::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi
{
m_isEnabled.uiCapability()->setUiReadOnly( true );
}
{
bool showAbsCoords = false;
auto geoDef = geometryDefinition();
if ( geoDef && geoDef->showAbsoluteCoordinates() )
{
showAbsCoords = true;
}
m_targetPointForDisplay.uiCapability()->setUiHidden( !showAbsCoords );
}
}

View File

@ -20,13 +20,15 @@
#include "cafPdmObject.h"
#include "RiaLineArcWellPathCalculator.h"
#include "cafAppEnum.h"
#include "cafPdmCoreVec3d.h"
#include "cafPdmField.h"
#include "cafPdmProxyValueField.h"
#include "cafPdmPtrField.h"
#include "cvfVector3.h"
class RimWellPath;
class RimWellPathGeometryDef;
class RimWellPathTarget : public caf::PdmObject
{
@ -48,14 +50,16 @@ public:
void setAsPointXYZAndTangentTarget( const cvf::Vec3d& point, const cvf::Vec3d& tangent );
void setAsPointXYZAndTangentTarget( const cvf::Vec3d& point, double azimuth, double inclination );
void setDerivedTangent( double azimuth, double inclination );
void updateFrom3DManipulator( const cvf::Vec3d& pointXYD );
RiaLineArcWellPathCalculator::WellTarget wellTargetData();
enum TargetTypeEnum
enum class TargetTypeEnum
{
POINT_AND_TANGENT,
POINT
};
TargetTypeEnum targetType() const;
cvf::Vec3d targetPointXYZ() const;
double azimuth() const;
@ -66,6 +70,8 @@ public:
void flagRadius1AsIncorrect( bool isEditable, bool isIncorrect, double actualRadius );
void flagRadius2AsIncorrect( bool isEditable, bool isIncorrect, double actualRadius );
std::vector<caf::PdmFieldHandle*> fieldsFor3dManipulator();
void onMoved();
private:
@ -77,19 +83,22 @@ private:
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
cvf::Vec3d targetPointForDisplayXYD() const;
void setTargetPointFromDisplayCoord( const cvf::Vec3d& coordInXYZ );
RimWellPathGeometryDef* geometryDefinition() const;
private:
friend class RicWellTarget3dEditor;
void enableFullUpdate( bool enable );
bool m_isFullUpdateEnabled;
caf::PdmField<bool> m_isEnabled;
caf::PdmField<bool> m_isLocked;
caf::PdmField<caf::AppEnum<TargetTypeEnum>> m_targetType;
caf::PdmField<cvf::Vec3d> m_targetPoint;
caf::PdmField<cvf::Vec3d> m_targetPointXYD;
caf::PdmProxyValueField<cvf::Vec3d> m_targetPointForDisplay;
caf::PdmField<double> m_azimuth;
caf::PdmField<double> m_inclination;
caf::PdmField<double> m_dogleg1;
caf::PdmField<double> m_dogleg2;
caf::PdmField<bool> m_hasTangentConstraintUiField;
caf::PdmPtrField<RimWellPath*> m_parentWellPath;
};

View File

@ -30,8 +30,6 @@
#include "RiuMainWindow.h"
#include "cafPdmFieldScriptingCapability.h"
#include "cafPdmObjectScriptingCapability.h"
#include "cafPdmUiDoubleValueEditor.h"
CAF_PDM_SOURCE_INIT( RimWellPathTieIn, "RimWellPathTieIn" );
@ -48,15 +46,9 @@ RimWellPathTieIn::RimWellPathTieIn()
CAF_PDM_InitFieldNoDefault( &m_tieInMeasuredDepth, "TieInMeasuredDepth", "Tie In Measured Depth", "", "", "" );
m_tieInMeasuredDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() );
CAF_PDM_InitScriptableField( &m_addValveAtConnection,
"AddValveAtConnection",
false,
"Add Outlet Valve for Branches",
"",
"",
"" );
CAF_PDM_InitField( &m_addValveAtConnection, "AddValveAtConnection", false, "Add Outlet Valve for Branches", "", "", "" );
CAF_PDM_InitScriptableFieldNoDefault( &m_valve, "Valve", "Branch Outlet Valve", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_valve, "Valve", "Branch Outlet Valve", "", "", "" );
m_valve = new RimWellPathValve;
}