mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5830 Fix auto-generated target at sea level
This commit is contained in:
parent
cc1f157e09
commit
52a2ed545e
@ -75,11 +75,12 @@ RimWellPathGeometryDef::RimWellPathGeometryDef()
|
||||
"",
|
||||
"" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_autoTargetAtSeaLevel, "AutoGeneratedTarget", "Auto Generated Target", "", "", "" );
|
||||
m_autoTargetAtSeaLevel = new RimWellPathTarget;
|
||||
m_autoTargetAtSeaLevel->setEnabled( false );
|
||||
|
||||
CAF_PDM_InitField( &m_pickPointsEnabled, "m_pickPointsEnabled", false, "", "", "", "" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorForField( &m_pickPointsEnabled );
|
||||
|
||||
m_autoTargetAtSeaLevel.reset( new RimWellPathTarget );
|
||||
m_autoTargetAtSeaLevel->setEnabled( false );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -148,6 +149,11 @@ cvf::ref<RigWellPath> RimWellPathGeometryDef::createWellPathGeometry()
|
||||
{
|
||||
cvf::ref<RigWellPath> wellPathGeometry = new RigWellPath;
|
||||
|
||||
if ( m_useAutoGeneratedTargetAtSeaLevel )
|
||||
{
|
||||
updateTargetAtSeaLevel();
|
||||
}
|
||||
|
||||
RiaLineArcWellPathCalculator wellPathCalculator = lineArcWellPathCalculator();
|
||||
|
||||
if ( wellPathCalculator.lineArcEndpoints().size() < 2 ) return wellPathGeometry;
|
||||
@ -163,7 +169,6 @@ cvf::ref<RigWellPath> RimWellPathGeometryDef::createWellPathGeometry()
|
||||
{
|
||||
wellPathGeometry->setDatumElevation( m_airGap );
|
||||
}
|
||||
updateTargetAtSeaLevel();
|
||||
|
||||
return wellPathGeometry;
|
||||
}
|
||||
@ -211,7 +216,7 @@ std::pair<RimWellPathTarget*, RimWellPathTarget*>
|
||||
if ( wt->isEnabled() && !foundTarget ) before = wt;
|
||||
}
|
||||
|
||||
return { before, after };
|
||||
return {before, after};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -365,7 +370,7 @@ std::vector<RimWellPathTarget*> RimWellPathGeometryDef::activeWellTargets() cons
|
||||
|
||||
if ( m_useAutoGeneratedTargetAtSeaLevel && !m_wellTargets.empty() && m_autoTargetAtSeaLevel )
|
||||
{
|
||||
active.push_back( m_autoTargetAtSeaLevel.get() );
|
||||
active.push_back( m_autoTargetAtSeaLevel );
|
||||
}
|
||||
|
||||
for ( const auto& wt : m_wellTargets )
|
||||
@ -386,7 +391,9 @@ RiaLineArcWellPathCalculator RimWellPathGeometryDef::lineArcWellPathCalculator()
|
||||
{
|
||||
std::vector<RiaLineArcWellPathCalculator::WellTarget> targetDatas;
|
||||
|
||||
for ( auto wellTarget : m_wellTargets )
|
||||
std::vector<RimWellPathTarget*> wellTargets = activeWellTargets();
|
||||
|
||||
for ( auto wellTarget : wellTargets )
|
||||
{
|
||||
if ( wellTarget->isEnabled() )
|
||||
{
|
||||
@ -400,27 +407,27 @@ RiaLineArcWellPathCalculator RimWellPathGeometryDef::lineArcWellPathCalculator()
|
||||
|
||||
for ( size_t tIdx = 0; tIdx < m_wellTargets.size(); ++tIdx )
|
||||
{
|
||||
m_wellTargets[tIdx]->flagRadius1AsIncorrect( targetStatuses[tIdx].isRadius1Editable, false, 0 );
|
||||
m_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 )
|
||||
{
|
||||
m_wellTargets[tIdx]->setDerivedTangent( targetStatuses[tIdx].resultAzimuth,
|
||||
targetStatuses[tIdx].resultInclination );
|
||||
wellTargets[tIdx]->setDerivedTangent( targetStatuses[tIdx].resultAzimuth,
|
||||
targetStatuses[tIdx].resultInclination );
|
||||
}
|
||||
|
||||
if ( targetStatuses[tIdx].hasOverriddenRadius1 )
|
||||
{
|
||||
m_wellTargets[tIdx]->flagRadius1AsIncorrect( targetStatuses[tIdx].isRadius1Editable,
|
||||
true,
|
||||
targetStatuses[tIdx].resultRadius1 );
|
||||
wellTargets[tIdx]->flagRadius1AsIncorrect( targetStatuses[tIdx].isRadius1Editable,
|
||||
true,
|
||||
targetStatuses[tIdx].resultRadius1 );
|
||||
}
|
||||
|
||||
if ( targetStatuses[tIdx].hasOverriddenRadius2 )
|
||||
{
|
||||
m_wellTargets[tIdx]->flagRadius2AsIncorrect( targetStatuses[tIdx].isRadius2Editable,
|
||||
true,
|
||||
targetStatuses[tIdx].resultRadius2 );
|
||||
wellTargets[tIdx]->flagRadius2AsIncorrect( targetStatuses[tIdx].isRadius2Editable,
|
||||
true,
|
||||
targetStatuses[tIdx].resultRadius2 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -452,7 +459,8 @@ void RimWellPathGeometryDef::updateTargetAtSeaLevel()
|
||||
newPos = firstTarget->targetPointXYZ() - horizontalLengthFromTarget * tangentInHorizontalPlane;
|
||||
newPos.z() = -referencePointXyz().z();
|
||||
|
||||
m_autoTargetAtSeaLevel->setAsPointXYZAndTangentTarget( { newPos[0], newPos[1], newPos[2] }, 0, 0 );
|
||||
m_autoTargetAtSeaLevel->setAsPointXYZAndTangentTarget( {newPos[0], newPos[1], newPos[2]}, 0, 0 );
|
||||
m_autoTargetAtSeaLevel->setEnabled( true );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmChildField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
#include "cafPdmObject.h"
|
||||
@ -89,6 +90,7 @@ private:
|
||||
RiaLineArcWellPathCalculator lineArcWellPathCalculator() const;
|
||||
|
||||
void updateTargetAtSeaLevel();
|
||||
void test();
|
||||
|
||||
private:
|
||||
caf::PdmField<cvf::Vec3d> m_referencePointUtmXyd;
|
||||
@ -98,9 +100,8 @@ private:
|
||||
caf::PdmField<double> m_mdAtFirstTarget;
|
||||
caf::PdmChildArrayField<RimWellPathTarget*> m_wellTargets;
|
||||
caf::PdmField<bool> m_useAutoGeneratedTargetAtSeaLevel;
|
||||
|
||||
caf::PdmField<bool> m_pickPointsEnabled;
|
||||
caf::PdmChildField<RimWellPathTarget*> m_autoTargetAtSeaLevel;
|
||||
caf::PdmField<bool> m_pickPointsEnabled;
|
||||
|
||||
std::shared_ptr<RicCreateWellTargetsPickEventHandler> m_pickTargetsEventHandler;
|
||||
std::unique_ptr<RimWellPathTarget> m_autoTargetAtSeaLevel;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user