mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve well path modeling
* Improve handling of MD at first target * When sea level well target is disabled, update MD of first target * Show well target spheres by default, allow toggling of spheres * Activate well target modifiers when clicking on well targets * Remove selection update causing an unstable 3D view * Improve display and handling of multiple locations * Add special 3D target for tie in well target * Add slider to tie in MD input field * Show MD in well path target table * Delete all well path laterals when deleting a well path * Python : Add lateral to parent well * Python : Add perforation interval
This commit is contained in:
@@ -79,6 +79,14 @@ void RicPointTangentManipulator::setHandleSize( double handleSize )
|
||||
m_partManager->setHandleSize( handleSize );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulator::setPolyline( const std::vector<cvf::Vec3d>& polyline )
|
||||
{
|
||||
m_partManager->setPolyline( polyline );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -94,7 +102,7 @@ bool RicPointTangentManipulator::eventFilter( QObject* obj, QEvent* inputEvent )
|
||||
{
|
||||
if ( inputEvent->type() == QEvent::MouseButtonPress )
|
||||
{
|
||||
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>( inputEvent );
|
||||
auto* mouseEvent = static_cast<QMouseEvent*>( inputEvent );
|
||||
|
||||
if ( mouseEvent->button() == Qt::LeftButton )
|
||||
{
|
||||
@@ -119,7 +127,7 @@ bool RicPointTangentManipulator::eventFilter( QObject* obj, QEvent* inputEvent )
|
||||
{
|
||||
if ( m_partManager->isManipulatorActive() )
|
||||
{
|
||||
QMouseEvent* mouseEvent = static_cast<QMouseEvent*>( inputEvent );
|
||||
auto* mouseEvent = static_cast<QMouseEvent*>( inputEvent );
|
||||
|
||||
cvf::ref<cvf::RayIntersectSpec> rayIs =
|
||||
m_viewer->rayIntersectSpecFromWindowCoordinates( mouseEvent->pos().x(),
|
||||
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
void setOrigin( const cvf::Vec3d& origin );
|
||||
void setTangent( const cvf::Vec3d& tangent );
|
||||
void setHandleSize( double handleSize );
|
||||
void setPolyline( const std::vector<cvf::Vec3d>& polyline );
|
||||
|
||||
void appendPartsToModel( cvf::ModelBasicList* model );
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RicPointTangentManipulatorPartMgr.h"
|
||||
|
||||
#include "RivPartPriority.h"
|
||||
@@ -36,17 +37,16 @@
|
||||
#include "cvfPrimitiveSetIndexedUInt.h"
|
||||
#include "cvfRay.h"
|
||||
|
||||
#include "cvfGeometryTools.h"
|
||||
#include "cvfMath.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicPointTangentManipulatorPartMgr::RicPointTangentManipulatorPartMgr()
|
||||
: m_tangentOnStartManipulation( cvf::Vec3d::UNDEFINED )
|
||||
, m_originOnStartManipulation( cvf::Vec3d::UNDEFINED )
|
||||
, m_activeHandle( NONE )
|
||||
, m_activeHandle( HandleType::NONE )
|
||||
, m_handleSize( 1.0 )
|
||||
, m_isGeometryUpdateNeeded( true )
|
||||
{
|
||||
@@ -104,12 +104,20 @@ void RicPointTangentManipulatorPartMgr::originAndTangent( cvf::Vec3d* origin, cv
|
||||
*tangent = m_tangent;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::setPolyline( const std::vector<cvf::Vec3d>& polyline )
|
||||
{
|
||||
m_polyline = polyline;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicPointTangentManipulatorPartMgr::isManipulatorActive() const
|
||||
{
|
||||
return m_activeHandle != NONE;
|
||||
return m_activeHandle != HandleType::NONE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -172,7 +180,37 @@ void RicPointTangentManipulatorPartMgr::updateManipulatorFromRay( const cvf::Ray
|
||||
{
|
||||
if ( !isManipulatorActive() ) return;
|
||||
|
||||
if ( m_activeHandle == HORIZONTAL_PLANE )
|
||||
if ( m_activeHandle == HandleType::PRESCRIBED_POLYLINE )
|
||||
{
|
||||
cvf::Plane plane;
|
||||
plane.setFromPointAndNormal( m_origin, newMouseRay->direction() );
|
||||
cvf::Vec3d newIntersection;
|
||||
newMouseRay->planeIntersect( plane, &newIntersection );
|
||||
|
||||
const cvf::Vec3d newOrigin = m_originOnStartManipulation + ( newIntersection - m_initialPickPoint );
|
||||
|
||||
double closestDistance = std::numeric_limits<double>::max();
|
||||
cvf::Vec3d closestPoint;
|
||||
|
||||
for ( size_t i = 1; i < m_polyline.size(); i++ )
|
||||
{
|
||||
const auto& p1 = m_polyline[i];
|
||||
const auto& p2 = m_polyline[i - 1];
|
||||
|
||||
double normalizedIntersection;
|
||||
const auto pointOnLine = cvf::GeometryTools::projectPointOnLine( p1, p2, newOrigin, &normalizedIntersection );
|
||||
|
||||
const double candidateDistance = pointOnLine.pointDistanceSquared( newOrigin );
|
||||
if ( candidateDistance < closestDistance )
|
||||
{
|
||||
closestDistance = candidateDistance;
|
||||
closestPoint = pointOnLine;
|
||||
}
|
||||
}
|
||||
|
||||
m_origin = closestPoint;
|
||||
}
|
||||
else if ( m_activeHandle == HandleType::HORIZONTAL_PLANE )
|
||||
{
|
||||
cvf::Plane plane;
|
||||
plane.setFromPointAndNormal( m_origin, cvf::Vec3d::Z_AXIS );
|
||||
@@ -183,7 +221,7 @@ void RicPointTangentManipulatorPartMgr::updateManipulatorFromRay( const cvf::Ray
|
||||
|
||||
m_origin = newOrigin;
|
||||
}
|
||||
else if ( m_activeHandle == VERTICAL_AXIS )
|
||||
else if ( m_activeHandle == HandleType::VERTICAL_AXIS )
|
||||
{
|
||||
cvf::Plane plane;
|
||||
cvf::Vec3d planeNormal = ( newMouseRay->direction() ^ cvf::Vec3d::Z_AXIS ) ^ cvf::Vec3d::Z_AXIS;
|
||||
@@ -201,7 +239,6 @@ void RicPointTangentManipulatorPartMgr::updateManipulatorFromRay( const cvf::Ray
|
||||
|
||||
m_origin = newOrigin;
|
||||
}
|
||||
// m_tangent = newTangent;
|
||||
|
||||
m_isGeometryUpdateNeeded = true;
|
||||
}
|
||||
@@ -211,7 +248,7 @@ void RicPointTangentManipulatorPartMgr::updateManipulatorFromRay( const cvf::Ray
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::endManipulator()
|
||||
{
|
||||
m_activeHandle = NONE;
|
||||
m_activeHandle = HandleType::NONE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -219,8 +256,15 @@ void RicPointTangentManipulatorPartMgr::endManipulator()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::recreateAllGeometryAndParts()
|
||||
{
|
||||
createHorizontalPlaneHandle();
|
||||
createVerticalAxisHandle();
|
||||
if ( m_polyline.empty() )
|
||||
{
|
||||
createHorizontalPlaneHandle();
|
||||
createVerticalAxisHandle();
|
||||
}
|
||||
else
|
||||
{
|
||||
createPolylineHandle();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -228,8 +272,15 @@ void RicPointTangentManipulatorPartMgr::recreateAllGeometryAndParts()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::createGeometryOnly()
|
||||
{
|
||||
m_handleParts[HORIZONTAL_PLANE]->setDrawable( createHorizontalPlaneGeo().p() );
|
||||
m_handleParts[VERTICAL_AXIS]->setDrawable( createVerticalAxisGeo().p() );
|
||||
if ( m_polyline.empty() )
|
||||
{
|
||||
m_handleParts[HandleType::HORIZONTAL_PLANE]->setDrawable( createHorizontalPlaneGeo().p() );
|
||||
m_handleParts[HandleType::VERTICAL_AXIS]->setDrawable( createVerticalAxisGeo().p() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_handleParts[HandleType::PRESCRIBED_POLYLINE]->setDrawable( createPolylineGeo().p() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -241,7 +292,7 @@ void RicPointTangentManipulatorPartMgr::createHorizontalPlaneHandle()
|
||||
|
||||
ref<cvf::DrawableGeo> geo = createHorizontalPlaneGeo();
|
||||
|
||||
HandleType handleId = HORIZONTAL_PLANE;
|
||||
HandleType handleId = HandleType::HORIZONTAL_PLANE;
|
||||
cvf::Color4f color = cvf::Color4f( 1.0f, 0.0f, 1.0f, 0.7f );
|
||||
cvf::String partName( "PointTangentManipulator Horizontal Plane Handle" );
|
||||
|
||||
@@ -318,7 +369,7 @@ void RicPointTangentManipulatorPartMgr::createVerticalAxisHandle()
|
||||
using namespace cvf;
|
||||
cvf::ref<cvf::DrawableGeo> geo = createVerticalAxisGeo();
|
||||
|
||||
HandleType handleId = VERTICAL_AXIS;
|
||||
HandleType handleId = HandleType::VERTICAL_AXIS;
|
||||
cvf::Color4f color = cvf::Color4f( 0.0f, 0.7f, 0.8f, 0.7f );
|
||||
cvf::String partName( "PointTangentManipulator Vertical Axis Handle" );
|
||||
|
||||
@@ -362,6 +413,42 @@ cvf::ref<cvf::DrawableGeo> RicPointTangentManipulatorPartMgr::createVerticalAxis
|
||||
return createIndexedTriangelDrawableGeo( vertexArray.p(), indexArray.p() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::createPolylineHandle()
|
||||
{
|
||||
cvf::ref<cvf::DrawableGeo> geo = createPolylineGeo();
|
||||
|
||||
HandleType handleId = HandleType::PRESCRIBED_POLYLINE;
|
||||
cvf::Color4f color = cvf::Color4f( 0.8f, 0.7f, 0.8f, 0.7f );
|
||||
cvf::String partName( "PointTangentManipulator Polyline Handle" );
|
||||
|
||||
addHandlePart( geo.p(), color, handleId, partName );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RicPointTangentManipulatorPartMgr::createPolylineGeo()
|
||||
{
|
||||
using namespace cvf;
|
||||
|
||||
cvf::ref<cvf::GeometryBuilderTriangles> geomBuilder = new cvf::GeometryBuilderTriangles;
|
||||
|
||||
double radius = m_handleSize * 0.3;
|
||||
cvf::GeometryUtils::createSphere( radius, 10, 10, geomBuilder.p() );
|
||||
|
||||
Vec3f origin( m_origin );
|
||||
|
||||
geomBuilder->transformVertexRange( 0, geomBuilder->vertexCount() - 1, cvf::Mat4f::fromTranslation( origin ) );
|
||||
|
||||
cvf::ref<cvf::Vec3fArray> vertexArray = geomBuilder->vertices();
|
||||
cvf::ref<cvf::UIntArray> indexArray = geomBuilder->triangles();
|
||||
|
||||
return createIndexedTriangelDrawableGeo( vertexArray.p(), indexArray.p() );
|
||||
}
|
||||
|
||||
#if 0
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
||||
@@ -38,18 +38,19 @@ class String;
|
||||
|
||||
template <typename>
|
||||
class Array;
|
||||
typedef Array<Vec3f> Vec3fArray;
|
||||
typedef Array<uint> UIntArray;
|
||||
using Vec3fArray = Array<Vec3f>;
|
||||
using UIntArray = Array<uint>;
|
||||
|
||||
} // namespace cvf
|
||||
|
||||
class RicPointTangentManipulatorPartMgr : public cvf::Object
|
||||
{
|
||||
public:
|
||||
enum HandleType
|
||||
enum class HandleType
|
||||
{
|
||||
HORIZONTAL_PLANE,
|
||||
VERTICAL_AXIS,
|
||||
PRESCRIBED_POLYLINE,
|
||||
AZIMUTH,
|
||||
INCLINATION,
|
||||
NONE
|
||||
@@ -63,6 +64,7 @@ public:
|
||||
void setTangent( const cvf::Vec3d& tangent );
|
||||
void setHandleSize( double handleSize );
|
||||
void originAndTangent( cvf::Vec3d* origin, cvf::Vec3d* tangent );
|
||||
void setPolyline( const std::vector<cvf::Vec3d>& polyline );
|
||||
|
||||
bool isManipulatorActive() const;
|
||||
void tryToActivateManipulator( const cvf::HitItem* hitItem );
|
||||
@@ -81,6 +83,9 @@ private:
|
||||
void createVerticalAxisHandle();
|
||||
cvf::ref<cvf::DrawableGeo> createVerticalAxisGeo();
|
||||
|
||||
void createPolylineHandle();
|
||||
cvf::ref<cvf::DrawableGeo> createPolylineGeo();
|
||||
|
||||
void addHandlePart( cvf::DrawableGeo* geo, const cvf::Color4f& color, HandleType handleId, const cvf::String& partName );
|
||||
|
||||
void addActiveModePart( cvf::DrawableGeo* geo, const cvf::Color4f& color, HandleType handleId, const cvf::String& partName );
|
||||
@@ -99,6 +104,8 @@ private:
|
||||
double m_handleSize;
|
||||
bool m_isGeometryUpdateNeeded;
|
||||
|
||||
std::vector<cvf::Vec3d> m_polyline;
|
||||
|
||||
HandleType m_activeHandle;
|
||||
cvf::Vec3d m_initialPickPoint;
|
||||
cvf::Vec3d m_tangentOnStartManipulation;
|
||||
|
||||
@@ -20,12 +20,15 @@
|
||||
|
||||
#include "RicPointTangentManipulator.h"
|
||||
|
||||
#include "RigWellPath.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
#include "RimModeledWellPath.h"
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
#include "RimWellPathGeometryDefTools.h"
|
||||
#include "RimWellPathTarget.h"
|
||||
#include "RimWellPathTieIn.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
|
||||
@@ -50,7 +53,7 @@ RicWellTarget3dEditor::RicWellTarget3dEditor()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicWellTarget3dEditor::~RicWellTarget3dEditor()
|
||||
{
|
||||
RiuViewer* ownerRiuViewer = dynamic_cast<RiuViewer*>( ownerViewer() );
|
||||
auto* ownerRiuViewer = dynamic_cast<RiuViewer*>( ownerViewer() );
|
||||
|
||||
if ( m_cvfModel.notNull() && ownerRiuViewer )
|
||||
{
|
||||
@@ -68,9 +71,9 @@ RicWellTarget3dEditor::~RicWellTarget3dEditor()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
{
|
||||
RimWellPathTarget* target = dynamic_cast<RimWellPathTarget*>( this->pdmObject() );
|
||||
RiuViewer* ownerRiuViewer = dynamic_cast<RiuViewer*>( ownerViewer() );
|
||||
Rim3dView* view = mainOrComparisonView();
|
||||
auto* target = dynamic_cast<RimWellPathTarget*>( this->pdmObject() );
|
||||
auto* ownerRiuViewer = dynamic_cast<RiuViewer*>( ownerViewer() );
|
||||
Rim3dView* view = mainOrComparisonView();
|
||||
|
||||
if ( !target || !target->isEnabled() || !view )
|
||||
{
|
||||
@@ -110,6 +113,29 @@ void RicWellTarget3dEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
m_manipulator->setTangent( target->tangent() );
|
||||
m_manipulator->setHandleSize( handleSize );
|
||||
|
||||
{
|
||||
RimWellPath* wellPath = nullptr;
|
||||
target->firstAncestorOrThisOfType( wellPath );
|
||||
|
||||
if ( wellPath && !wellPath->isTopLevelWellPath() && geomDef->firstActiveTarget() == target )
|
||||
{
|
||||
if ( auto parentWellPath = wellPath->wellPathTieIn()->parentWell() )
|
||||
{
|
||||
auto geo = parentWellPath->wellPathGeometry();
|
||||
auto points = geo->wellPathPoints();
|
||||
|
||||
for ( auto& p : points )
|
||||
{
|
||||
p = dispXf->transformToDisplayCoord( p );
|
||||
}
|
||||
|
||||
// For the first target of a lateral, use the coordinates from the parent well as snap-to locations for
|
||||
// the 3D manipulator sphere
|
||||
m_manipulator->setPolyline( points );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_cvfModel->removeAllParts();
|
||||
m_manipulator->appendPartsToModel( m_cvfModel.p() );
|
||||
|
||||
@@ -129,64 +155,167 @@ void RicWellTarget3dEditor::cleanupBeforeSettingPdmObject()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::slotUpdated( const cvf::Vec3d& origin, const cvf::Vec3d& tangent )
|
||||
{
|
||||
RimWellPathTarget* target = dynamic_cast<RimWellPathTarget*>( this->pdmObject() );
|
||||
Rim3dView* view = mainOrComparisonView();
|
||||
auto* manipulatedTarget = dynamic_cast<RimWellPathTarget*>( this->pdmObject() );
|
||||
Rim3dView* view = mainOrComparisonView();
|
||||
|
||||
if ( !target || !view )
|
||||
if ( !manipulatedTarget || !view )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RimWellPathGeometryDef* geomDef;
|
||||
target->firstAncestorOrThisOfTypeAsserted( geomDef );
|
||||
manipulatedTarget->firstAncestorOrThisOfTypeAsserted( geomDef );
|
||||
if ( !geomDef ) return;
|
||||
|
||||
if ( geomDef->useReferencePointFromTopLevelWell() )
|
||||
RimModeledWellPath* modeledWellPath = nullptr;
|
||||
geomDef->firstAncestorOfType( modeledWellPath );
|
||||
|
||||
cvf::Vec3d domainCoordXYZ; // domain coordinate of the new location
|
||||
cvf::Vec3d deltaManipulatorMovement; // delta change relative current location of target
|
||||
cvf::Vec3d relativePositionXYZ; // position of well target relative to anchor point
|
||||
{
|
||||
RimModeledWellPath* modeledWellPath = nullptr;
|
||||
geomDef->firstAncestorOfType( modeledWellPath );
|
||||
if ( modeledWellPath )
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf = view->displayCoordTransform();
|
||||
domainCoordXYZ = dispXf->transformToDomainCoord( origin );
|
||||
|
||||
relativePositionXYZ = domainCoordXYZ - geomDef->anchorPointXyz();
|
||||
deltaManipulatorMovement = manipulatedTarget->targetPointXYZ() - relativePositionXYZ;
|
||||
}
|
||||
|
||||
if ( geomDef->activeWellTargets().front() == manipulatedTarget )
|
||||
{
|
||||
// The first well target of a lateral is the tie-in well target
|
||||
|
||||
if ( modeledWellPath && modeledWellPath->wellPathTieIn() && modeledWellPath->wellPathTieIn()->parentWell() )
|
||||
{
|
||||
auto topLevelWellPath = dynamic_cast<RimModeledWellPath*>( modeledWellPath->topLevelWellPath() );
|
||||
if ( topLevelWellPath )
|
||||
auto parentWell = modeledWellPath->wellPathTieIn()->parentWell();
|
||||
auto wellPathGeo = parentWell->wellPathGeometry();
|
||||
auto closestMD = wellPathGeo->closestMeasuredDepth( domainCoordXYZ );
|
||||
|
||||
modeledWellPath->wellPathTieIn()->setTieInMeasuredDepth( closestMD );
|
||||
modeledWellPath->wellPathTieIn()->updateChildWellGeometry();
|
||||
}
|
||||
|
||||
bool modifyAllTargetsOnAllWells = ( ( QApplication::keyboardModifiers() & Qt::ControlModifier ) &&
|
||||
( QApplication::keyboardModifiers() & Qt::SHIFT ) );
|
||||
|
||||
if ( modifyAllTargetsOnAllWells )
|
||||
{
|
||||
for ( auto wellLateral : modeledWellPath->wellPathLaterals() )
|
||||
{
|
||||
// Manipulate the reference point of top level well path
|
||||
geomDef = topLevelWellPath->geometryDefinition();
|
||||
if ( auto modeledLateral = dynamic_cast<RimModeledWellPath*>( wellLateral ) )
|
||||
{
|
||||
auto activeTargets = modeledLateral->geometryDefinition()->activeWellTargets();
|
||||
for ( auto t : activeTargets )
|
||||
{
|
||||
if ( t == activeTargets.front() ) continue;
|
||||
if ( t == manipulatedTarget ) continue;
|
||||
|
||||
// Does not work very well
|
||||
// Must update the tie-in MD also
|
||||
updateTargetWithDeltaChange( t, deltaManipulatorMovement );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( QApplication::keyboardModifiers() & Qt::ControlModifier )
|
||||
{
|
||||
for ( auto target : geomDef->activeWellTargets() )
|
||||
{
|
||||
if ( target == geomDef->activeWellTargets().front() ) continue;
|
||||
|
||||
updateTargetWithDeltaChange( target, deltaManipulatorMovement );
|
||||
}
|
||||
}
|
||||
|
||||
cvf::Vec3d relativePositionXYD = relativePositionXYZ;
|
||||
relativePositionXYD.z() = -relativePositionXYD.z();
|
||||
|
||||
manipulatedTarget->updateFrom3DManipulator( relativePositionXYD );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( modeledWellPath && modeledWellPath->isTopLevelWellPath() )
|
||||
{
|
||||
// Modification of top level well path
|
||||
|
||||
bool modifyReferencePoint = ( ( QApplication::keyboardModifiers() & Qt::ControlModifier ) &&
|
||||
( QApplication::keyboardModifiers() & Qt::SHIFT ) );
|
||||
if ( modifyReferencePoint )
|
||||
{
|
||||
// Find all linked wells and update reference point with delta change
|
||||
std::vector<RimWellPathGeometryDef*> linkedWellPathGeoDefs;
|
||||
if ( geomDef->isReferencePointUpdatesLinked() )
|
||||
{
|
||||
linkedWellPathGeoDefs = RimWellPathGeometryDefTools::linkedDefinitions();
|
||||
}
|
||||
else
|
||||
{
|
||||
linkedWellPathGeoDefs.push_back( geomDef );
|
||||
}
|
||||
|
||||
RimWellPathGeometryDefTools::updateLinkedGeometryDefinitions( linkedWellPathGeoDefs, deltaManipulatorMovement );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool modifyAllTargetOnWell = ( QApplication::keyboardModifiers() & Qt::ControlModifier );
|
||||
if ( modifyAllTargetOnWell )
|
||||
{
|
||||
for ( auto t : geomDef->activeWellTargets() )
|
||||
{
|
||||
if ( t == manipulatedTarget ) continue;
|
||||
|
||||
updateTargetWithDeltaChange( t, deltaManipulatorMovement );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( modeledWellPath && !modeledWellPath->isTopLevelWellPath() )
|
||||
{
|
||||
bool modifyAllTargetsOnAllWells = ( ( QApplication::keyboardModifiers() & Qt::ControlModifier ) &&
|
||||
( QApplication::keyboardModifiers() & Qt::SHIFT ) );
|
||||
if ( modifyAllTargetsOnAllWells )
|
||||
{
|
||||
// Update all well targets on all connected laterals
|
||||
|
||||
for ( auto wellLateral : modeledWellPath->wellPathLaterals() )
|
||||
{
|
||||
if ( auto modeledLateral = dynamic_cast<RimModeledWellPath*>( wellLateral ) )
|
||||
{
|
||||
auto activeTargets = modeledLateral->geometryDefinition()->activeWellTargets();
|
||||
for ( auto t : activeTargets )
|
||||
{
|
||||
if ( t == activeTargets.front() ) continue;
|
||||
if ( t == manipulatedTarget ) continue;
|
||||
|
||||
updateTargetWithDeltaChange( t, deltaManipulatorMovement );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool modifyAllTargets = ( QApplication::keyboardModifiers() & Qt::ControlModifier );
|
||||
if ( modifyAllTargets )
|
||||
{
|
||||
// Update all well targets on current well path
|
||||
|
||||
for ( auto t : geomDef->activeWellTargets() )
|
||||
{
|
||||
if ( t == geomDef->activeWellTargets().front() ) continue;
|
||||
if ( t == manipulatedTarget ) continue;
|
||||
|
||||
updateTargetWithDeltaChange( t, deltaManipulatorMovement );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> dispXf = view->displayCoordTransform();
|
||||
|
||||
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 )
|
||||
// Modify a single well target
|
||||
{
|
||||
auto relativePositionXYZ = domainCoordXYZ - geomDef->anchorPointXyz();
|
||||
auto delta = target->targetPointXYZ() - relativePositionXYZ;
|
||||
|
||||
// Find all linked wells and update with delta change
|
||||
|
||||
std::vector<RimWellPathGeometryDef*> linkedWellPathGeoDefs;
|
||||
if ( geomDef->isReferencePointUpdatesLinked() )
|
||||
{
|
||||
linkedWellPathGeoDefs = RimWellPathGeometryDefTools::linkedDefinitions();
|
||||
}
|
||||
else
|
||||
{
|
||||
linkedWellPathGeoDefs.push_back( geomDef );
|
||||
}
|
||||
|
||||
RimWellPathGeometryDefTools::updateLinkedGeometryDefinitions( linkedWellPathGeoDefs, delta );
|
||||
}
|
||||
else
|
||||
{
|
||||
cvf::Vec3d relativePositionXYD = domainCoordXYZ - geomDef->anchorPointXyz();
|
||||
cvf::Vec3d relativePositionXYD = relativePositionXYZ;
|
||||
relativePositionXYD.z() = -relativePositionXYD.z();
|
||||
|
||||
target->updateFrom3DManipulator( relativePositionXYD );
|
||||
manipulatedTarget->updateFrom3DManipulator( relativePositionXYD );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +324,7 @@ void RicWellTarget3dEditor::slotUpdated( const cvf::Vec3d& origin, const cvf::Ve
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::slotSelectedIn3D()
|
||||
{
|
||||
RimWellPathTarget* target = dynamic_cast<RimWellPathTarget*>( this->pdmObject() );
|
||||
auto* target = dynamic_cast<RimWellPathTarget*>( this->pdmObject() );
|
||||
if ( !target )
|
||||
{
|
||||
return;
|
||||
@@ -209,7 +338,7 @@ void RicWellTarget3dEditor::slotSelectedIn3D()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::slotDragFinished()
|
||||
{
|
||||
RimWellPathTarget* target = dynamic_cast<RimWellPathTarget*>( this->pdmObject() );
|
||||
auto* target = dynamic_cast<RimWellPathTarget*>( this->pdmObject() );
|
||||
if ( !target )
|
||||
{
|
||||
return;
|
||||
@@ -223,7 +352,7 @@ void RicWellTarget3dEditor::slotDragFinished()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::removeAllFieldEditors()
|
||||
{
|
||||
if ( RimWellPathTarget* oldTarget = dynamic_cast<RimWellPathTarget*>( this->pdmObject() ) )
|
||||
if ( auto* oldTarget = dynamic_cast<RimWellPathTarget*>( this->pdmObject() ) )
|
||||
{
|
||||
for ( auto field : oldTarget->fieldsFor3dManipulator() )
|
||||
{
|
||||
@@ -231,3 +360,13 @@ void RicWellTarget3dEditor::removeAllFieldEditors()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicWellTarget3dEditor::updateTargetWithDeltaChange( RimWellPathTarget* target, const cvf::Vec3d& delta )
|
||||
{
|
||||
auto coordXYZ = target->targetPointXYZ() - delta;
|
||||
target->setPointXYZ( coordXYZ );
|
||||
target->updateConnectedEditors();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <QPointer>
|
||||
|
||||
class RicPointTangentManipulator;
|
||||
class RimWellPathTarget;
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
@@ -54,6 +55,8 @@ private slots:
|
||||
private:
|
||||
void removeAllFieldEditors();
|
||||
|
||||
static void updateTargetWithDeltaChange( RimWellPathTarget* target, const cvf::Vec3d& delta );
|
||||
|
||||
private:
|
||||
QPointer<RicPointTangentManipulator> m_manipulator;
|
||||
cvf::ref<cvf::ModelBasicList> m_cvfModel;
|
||||
|
||||
Reference in New Issue
Block a user