mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #5059 from OPM/feature-well-path-modeling-improvements
Feature well path modeling improvements
This commit is contained in:
commit
470dab8d58
@ -22,6 +22,9 @@ CAF_CMD_SOURCE_INIT( RicNewWellPathListTargetFeature, "RicNewWellPathListTargetF
|
||||
#include "RimModeledWellPath.h"
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
#include "RimWellPathTarget.h"
|
||||
|
||||
#include "RiaOffshoreSphericalCoords.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
#include <QAction>
|
||||
|
||||
@ -61,7 +64,7 @@ void RicNewWellPathListTargetFeature::onActionTriggered( bool isChecked )
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedTargets, caf::SelectionManager::FIRST_LEVEL );
|
||||
if ( selectedTargets.size() > 0 )
|
||||
{
|
||||
auto firstTarget = selectedTargets.front();
|
||||
RimWellPathTarget* firstTarget = selectedTargets.front();
|
||||
RimWellPathGeometryDef* wellGeomDef = nullptr;
|
||||
firstTarget->firstAncestorOrThisOfTypeAsserted( wellGeomDef );
|
||||
|
||||
@ -69,10 +72,30 @@ void RicNewWellPathListTargetFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
cvf::Vec3d newPos = cvf::Vec3d::ZERO;
|
||||
|
||||
bool isSeaLevelTarget = false;
|
||||
|
||||
if ( !afterBeforePair.first && afterBeforePair.second )
|
||||
{
|
||||
newPos = afterBeforePair.second->targetPointXYZ();
|
||||
if ( afterBeforePair.second->targetPointXYZ().z() == -wellGeomDef->referencePointXyz().z() )
|
||||
{
|
||||
return; // We already have a target at sealevel.
|
||||
}
|
||||
|
||||
cvf::Vec3d targetTangent = afterBeforePair.second->tangent();
|
||||
double radius = afterBeforePair.second->radius1();
|
||||
|
||||
cvf::Vec3d tangentInHorizontalPlane = targetTangent;
|
||||
tangentInHorizontalPlane[2] = 0.0;
|
||||
tangentInHorizontalPlane.normalize();
|
||||
|
||||
RiaOffshoreSphericalCoords sphTangent( targetTangent );
|
||||
double inc = sphTangent.inc();
|
||||
double horizontalLengthFromTarget = radius - radius * cvf::Math::cos( inc );
|
||||
|
||||
newPos = afterBeforePair.second->targetPointXYZ() - horizontalLengthFromTarget * tangentInHorizontalPlane;
|
||||
newPos.z() = -wellGeomDef->referencePointXyz().z();
|
||||
|
||||
isSeaLevelTarget = true;
|
||||
}
|
||||
else if ( afterBeforePair.first && afterBeforePair.second )
|
||||
{
|
||||
@ -95,7 +118,14 @@ void RicNewWellPathListTargetFeature::onActionTriggered( bool isChecked )
|
||||
}
|
||||
|
||||
RimWellPathTarget* newTarget = new RimWellPathTarget;
|
||||
newTarget->setAsPointTargetXYD( {newPos[0], newPos[1], -newPos[2]} );
|
||||
if ( isSeaLevelTarget )
|
||||
{
|
||||
newTarget->setAsPointXYZAndTangentTarget( {newPos[0], newPos[1], newPos[2]}, 0, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
newTarget->setAsPointTargetXYD( {newPos[0], newPos[1], -newPos[2]} );
|
||||
}
|
||||
|
||||
wellGeomDef->insertTarget( firstTarget, newTarget );
|
||||
wellGeomDef->updateConnectedEditors();
|
||||
@ -147,6 +177,25 @@ void RicNewWellPathListTargetFeature::onActionTriggered( bool isChecked )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewWellPathListTargetFeature::setupActionLook( QAction* actionToSetup )
|
||||
{
|
||||
actionToSetup->setText( "New Target" );
|
||||
actionToSetup->setIcon( QIcon( ":/Well.png" ) );
|
||||
std::vector<RimWellPathTarget*> selectedTargets;
|
||||
caf::SelectionManager::instance()->objectsByType( &selectedTargets, caf::SelectionManager::FIRST_LEVEL );
|
||||
|
||||
if ( selectedTargets.size() > 0 )
|
||||
{
|
||||
auto firstTarget = selectedTargets.front();
|
||||
RimWellPathGeometryDef* wellGeomDef = nullptr;
|
||||
firstTarget->firstAncestorOrThisOfTypeAsserted( wellGeomDef );
|
||||
|
||||
auto afterBeforePair = wellGeomDef->findActiveTargetsAroundInsertionPoint( firstTarget );
|
||||
|
||||
if ( !afterBeforePair.first )
|
||||
{
|
||||
actionToSetup->setText( "Insert New Target At Sea Level" );
|
||||
actionToSetup->setIcon( QIcon( ":/WellTargets.png" ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
actionToSetup->setText( "Insert New Target Above" );
|
||||
actionToSetup->setIcon( QIcon( ":/WellTargets.png" ) );
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include "WellPathCommands/PointTangentManipulator/RicWellPathGeometry3dEditor.h"
|
||||
#include "cafCmdFeatureMenuBuilder.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTableViewEditor.h"
|
||||
#include "cafPdmUiTreeOrdering.h"
|
||||
@ -159,7 +160,6 @@ cvf::ref<RigWellPath> RimWellPathGeometryDef::createWellPathGeometry()
|
||||
|
||||
RiaPolyArcLineSampler arcLineSampler( wellPathCalculator.startTangent(), wellPathCalculator.lineArcEndpoints() );
|
||||
|
||||
|
||||
arcLineSampler.sampledPointsAndMDs( 30,
|
||||
false,
|
||||
&( wellPathGeometry->m_wellPathPoints ),
|
||||
@ -563,8 +563,8 @@ RiaLineArcWellPathCalculator RimWellPathGeometryDef::lineArcWellPathCalculator()
|
||||
|
||||
for ( size_t tIdx = 0; tIdx < wellTargets.size(); ++tIdx )
|
||||
{
|
||||
wellTargets[tIdx]->flagRadius1AsIncorrect(targetStatuses[tIdx].isRadius1Editable, false, 0 );
|
||||
wellTargets[tIdx]->flagRadius2AsIncorrect(targetStatuses[tIdx].isRadius2Editable, false, 0 );
|
||||
wellTargets[tIdx]->flagRadius1AsIncorrect( targetStatuses[tIdx].isRadius1Editable, false, 0 );
|
||||
wellTargets[tIdx]->flagRadius2AsIncorrect( targetStatuses[tIdx].isRadius2Editable, false, 0 );
|
||||
|
||||
if ( targetStatuses[tIdx].hasDerivedTangent )
|
||||
{
|
||||
@ -574,12 +574,16 @@ RiaLineArcWellPathCalculator RimWellPathGeometryDef::lineArcWellPathCalculator()
|
||||
|
||||
if ( targetStatuses[tIdx].hasOverriddenRadius1 )
|
||||
{
|
||||
wellTargets[tIdx]->flagRadius1AsIncorrect( targetStatuses[tIdx].isRadius1Editable, true, targetStatuses[tIdx].resultRadius1 );
|
||||
wellTargets[tIdx]->flagRadius1AsIncorrect( targetStatuses[tIdx].isRadius1Editable,
|
||||
true,
|
||||
targetStatuses[tIdx].resultRadius1 );
|
||||
}
|
||||
|
||||
if ( targetStatuses[tIdx].hasOverriddenRadius2 )
|
||||
{
|
||||
wellTargets[tIdx]->flagRadius2AsIncorrect( targetStatuses[tIdx].isRadius2Editable, true, targetStatuses[tIdx].resultRadius2 );
|
||||
wellTargets[tIdx]->flagRadius2AsIncorrect( targetStatuses[tIdx].isRadius2Editable,
|
||||
true,
|
||||
targetStatuses[tIdx].resultRadius2 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -639,6 +643,18 @@ void RimWellPathGeometryDef::defineEditorAttribute( const caf::PdmFieldHandle* f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( field == &m_referencePointUtmXyd )
|
||||
{
|
||||
auto uiDisplayStringAttr = dynamic_cast<caf::PdmUiLineEditorAttributeUiDisplayString*>( attribute );
|
||||
|
||||
if ( uiDisplayStringAttr )
|
||||
{
|
||||
uiDisplayStringAttr->m_displayString = QString::number( m_referencePointUtmXyd()[0], 'f', 2 ) + " " +
|
||||
QString::number( m_referencePointUtmXyd()[1], 'f', 2 ) + " " +
|
||||
QString::number( m_referencePointUtmXyd()[2], 'f', 2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -2,7 +2,12 @@
|
||||
#include "RimModeledWellPath.h"
|
||||
|
||||
#include "RimWellPathGeometryDef.h"
|
||||
|
||||
#include "RiaOffshoreSphericalCoords.h"
|
||||
|
||||
#include "cafPdmUiCheckBoxEditor.h"
|
||||
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include <cmath>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimWellPathTarget, "WellPathTarget" );
|
||||
@ -159,7 +164,8 @@ cvf::Vec3d RimWellPathTarget::tangent() const
|
||||
{
|
||||
double aziRad = cvf::Math::toRadians( m_azimuth );
|
||||
double incRad = cvf::Math::toRadians( m_inclination );
|
||||
return cvf::Vec3d( sin( aziRad ) * sin( incRad ), cos( aziRad ) * sin( incRad ), -cos( incRad ) );
|
||||
|
||||
return RiaOffshoreSphericalCoords::unitVectorFromAziInc( aziRad, incRad );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -266,6 +272,27 @@ void RimWellPathTarget::enableFullUpdate( bool enable )
|
||||
m_isFullUpdateEnabled = enable;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellPathTarget::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( field == &m_targetPoint )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -320,33 +347,20 @@ 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 );
|
||||
|
||||
if ( m_targetType == POINT )
|
||||
{
|
||||
m_azimuth.uiCapability()->setUiReadOnly( true );
|
||||
m_inclination.uiCapability()->setUiReadOnly( true );
|
||||
// m_dogleg1.uiCapability()->setUiReadOnly( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_azimuth.uiCapability()->setUiReadOnly( false );
|
||||
m_inclination.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 );
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -63,6 +63,9 @@ private:
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue ) override;
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
private:
|
||||
friend class RicWellTarget3dEditor;
|
||||
|
@ -427,6 +427,7 @@ void PdmUiTableViewQModel::setArrayFieldAndBuildEditors(PdmChildArrayFieldHandle
|
||||
else
|
||||
{
|
||||
fieldEditor = it->second;
|
||||
fieldEditor->setUiField(field);
|
||||
}
|
||||
|
||||
if (fieldEditor)
|
||||
@ -575,7 +576,7 @@ void PdmUiTableViewQModel::notifyDataChanged(const QModelIndex& topLeft, const Q
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmUiTableViewQModel::recreateTableItemEditors()
|
||||
{
|
||||
for (auto tableItemEditor : m_tableRowEditors)
|
||||
for (PdmUiTableRowEditor* tableItemEditor : m_tableRowEditors)
|
||||
{
|
||||
delete tableItemEditor;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user