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
ab9ba69391
commit
b9dac8da38
@ -74,11 +74,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 );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -147,6 +148,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;
|
||||
@ -162,7 +168,6 @@ cvf::ref<RigWellPath> RimWellPathGeometryDef::createWellPathGeometry()
|
||||
{
|
||||
wellPathGeometry->setDatumElevation( m_airGap );
|
||||
}
|
||||
updateTargetAtSeaLevel();
|
||||
|
||||
return wellPathGeometry;
|
||||
}
|
||||
@ -372,7 +377,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 )
|
||||
@ -393,7 +398,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() )
|
||||
{
|
||||
@ -407,27 +414,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 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -460,6 +467,7 @@ void RimWellPathGeometryDef::updateTargetAtSeaLevel()
|
||||
newPos.z() = -referencePointXyz().z();
|
||||
|
||||
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"
|
||||
@ -90,6 +91,7 @@ private:
|
||||
RiaLineArcWellPathCalculator lineArcWellPathCalculator() const;
|
||||
|
||||
void updateTargetAtSeaLevel();
|
||||
void test();
|
||||
|
||||
private:
|
||||
caf::PdmField<cvf::Vec3d> m_referencePointUtmXyd;
|
||||
@ -99,9 +101,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