#7446 MLW: Add "Create Well Path Lateral" to well in Project Tree

This commit is contained in:
Magne Sjaastad 2021-05-09 08:07:16 +02:00
parent b116247273
commit 082d6500ad
7 changed files with 138 additions and 22 deletions

View File

@ -21,6 +21,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineTargetFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicDeletePolylineTargetFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicImportWellMeasurementsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathLateralAtDepthFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathLateralFeature.h
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/Ric3dObjectEditorHandle.h
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulator.h
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellTarget3dEditor.h
@ -52,6 +53,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewPolylineTargetFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicDeletePolylineTargetFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicImportWellMeasurementsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathLateralAtDepthFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathLateralFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/Ric3dObjectEditorHandle.cpp
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulator.cpp
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellTarget3dEditor.cpp

View File

@ -67,24 +67,45 @@ void RicNewWellPathLateralAtDepthFeature::onActionTriggered( bool isChecked )
RimWellPath* parentWellPath = wellPathSelItem->m_wellpath;
CVF_ASSERT( parentWellPath );
double parentWellMD = wellPathSelItem->m_measuredDepth;
createLateralAtMeasuredDepth( parentWellPath, parentWellMD );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathLateralAtDepthFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Create Well Path Lateral at this Depth" );
actionToSetup->setIcon( QIcon( ":/Well.svg" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicNewWellPathLateralAtDepthFeature::createLateralAtMeasuredDepth( RimWellPath* parentWellPath,
double parentWellMD )
{
RimProject* project = RimProject::current();
RimWellPathCollection* wellPathColl = RimTools::wellPathCollection();
if ( project && wellPathColl )
{
double parentWellMD = wellPathSelItem->m_measuredDepth;
auto newModeledWellPath = new RimModeledWellPath();
auto [pointVector, measuredDepths] =
parentWellPath->wellPathGeometry()
->clippedPointSubset( parentWellPath->wellPathGeometry()->measuredDepths().front(), parentWellMD );
if ( pointVector.size() < 2u ) return;
if ( parentWellPath->wellPathGeometry() && parentWellPath->wellPathGeometry()->measuredDepths().size() > 2 )
{
auto [pointVector, measuredDepths] =
parentWellPath->wellPathGeometry()
->clippedPointSubset( parentWellPath->wellPathGeometry()->measuredDepths().front(), parentWellMD );
newModeledWellPath->geometryDefinition()->setMdAtFirstTarget( measuredDepths.back() );
newModeledWellPath->geometryDefinition()->setFixedWellPathPoints( pointVector );
newModeledWellPath->geometryDefinition()->setFixedMeasuredDepths( measuredDepths );
}
newModeledWellPath->geometryDefinition()->setIsAttachedToParentWell( true );
newModeledWellPath->geometryDefinition()->setMdAtFirstTarget( measuredDepths.back() );
newModeledWellPath->geometryDefinition()->setUseAutoGeneratedTargetAtSeaLevel( false );
newModeledWellPath->geometryDefinition()->setFixedWellPathPoints( pointVector );
newModeledWellPath->geometryDefinition()->setFixedMeasuredDepths( measuredDepths );
auto nameOfNewWell = updateNameOfParentAndFindNameOfSideStep( parentWellPath );
newModeledWellPath->setName( nameOfNewWell );
@ -102,16 +123,11 @@ void RicNewWellPathLateralAtDepthFeature::onActionTriggered( bool isChecked )
project->scheduleCreateDisplayModelAndRedrawAllViews();
Riu3DMainWindowTools::selectAsCurrentItem( newModeledWellPath->geometryDefinition() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathLateralAtDepthFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Create Well Path Lateral at this Depth" );
actionToSetup->setIcon( QIcon( ":/Well.svg" ) );
return newModeledWellPath;
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------

View File

@ -30,13 +30,14 @@ class RicNewWellPathLateralAtDepthFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
public:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
static RimWellPath* createLateralAtMeasuredDepth( RimWellPath* parentWellPath, double parentWellMD );
private:
static RiuWellPathSelectionItem* wellPathSelectionItem();
QString updateNameOfParentAndFindNameOfSideStep( RimWellPath* parentwWellPath );
static QString updateNameOfParentAndFindNameOfSideStep( RimWellPath* parentwWellPath );
};

View File

@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicNewWellPathLateralFeature.h"
#include "RicNewWellPathLateralAtDepthFeature.h"
#include "RimWellPath.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicNewWellPathLateralFeature, "RicNewWellPathLateralFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewWellPathLateralFeature::isCommandEnabled()
{
RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>();
return wellPath != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathLateralFeature::onActionTriggered( bool isChecked )
{
RimWellPath* parentWellPath = caf::SelectionManager::instance()->selectedItemOfType<RimWellPath>();
if ( !parentWellPath ) return;
double measuredDepth = 0.0;
RicNewWellPathLateralAtDepthFeature::createLateralAtMeasuredDepth( parentWellPath, measuredDepth );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewWellPathLateralFeature::setupActionLook( QAction* actionToSetup )
{
actionToSetup->setText( "Create Well Path Lateral" );
actionToSetup->setIcon( QIcon( ":/Well.svg" ) );
}

View File

@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2018- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicNewWellPathLateralFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
};

View File

@ -358,7 +358,9 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
else if ( dynamic_cast<RimWellPath*>( firstUiItem ) )
{
menuBuilder << "RicNewEditableWellPathFeature";
menuBuilder << "RicNewWellPathLateralFeature";
menuBuilder << "RicNewWellPathIntersectionFeature";
appendCreateCompletions( menuBuilder );
menuBuilder.addSeparator();
appendImportMenu( menuBuilder );

View File

@ -113,7 +113,8 @@ void RimWellPathTieIn::updateFirstTargetFromParentWell()
if ( !parentWellPath ) return;
auto modeledWellPath = dynamic_cast<RimModeledWellPath*>( m_childWell() );
if ( modeledWellPath && modeledWellPath->geometryDefinition() )
if ( modeledWellPath && modeledWellPath->geometryDefinition() && parentWellPath->wellPathGeometry() &&
parentWellPath->wellPathGeometry()->measuredDepths().size() > 2 )
{
auto [pointVector, measuredDepths] =
parentWellPath->wellPathGeometry()