mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7134 Create modelled well path from well path
From an existing well path, find some coordinates along the geometry and create a new modelled well path based on these coordinates.
This commit is contained in:
parent
94f7bd3c1a
commit
2776012bce
@ -31,6 +31,7 @@ set(SOURCE_GROUP_HEADER_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolyline3dEditor.h
|
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolyline3dEditor.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.h
|
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.h
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicAppendPointsToPolygonFilterFeature.h
|
${CMAKE_CURRENT_LIST_DIR}/RicAppendPointsToPolygonFilterFeature.h
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicDuplicateWellPathFeature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCE_GROUP_SOURCE_FILES
|
set(SOURCE_GROUP_SOURCE_FILES
|
||||||
@ -66,6 +67,7 @@ set(SOURCE_GROUP_SOURCE_FILES
|
|||||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolyline3dEditor.cpp
|
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolyline3dEditor.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.cpp
|
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.cpp
|
||||||
${CMAKE_CURRENT_LIST_DIR}/RicAppendPointsToPolygonFilterFeature.cpp
|
${CMAKE_CURRENT_LIST_DIR}/RicAppendPointsToPolygonFilterFeature.cpp
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/RicDuplicateWellPathFeature.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
||||||
|
@ -0,0 +1,111 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2023- 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 "RicDuplicateWellPathFeature.h"
|
||||||
|
|
||||||
|
#include "RiaColorTables.h"
|
||||||
|
|
||||||
|
#include "RigWellPath.h"
|
||||||
|
|
||||||
|
#include "RimModeledWellPath.h"
|
||||||
|
#include "RimOilField.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimTools.h"
|
||||||
|
#include "RimWellPathCollection.h"
|
||||||
|
#include "RimWellPathGeometryDef.h"
|
||||||
|
|
||||||
|
#include "Riu3DMainWindowTools.h"
|
||||||
|
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
#include "cafSelectionManagerTools.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT( RicDuplicateWellPathFeature, "RicDuplicateWellPathFeature" );
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicDuplicateWellPathFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
auto wellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath>();
|
||||||
|
|
||||||
|
return wellPath != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicDuplicateWellPathFeature::onActionTriggered( bool isChecked )
|
||||||
|
{
|
||||||
|
auto sourceWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath>();
|
||||||
|
if ( !sourceWellPath ) return;
|
||||||
|
|
||||||
|
RimProject* project = RimProject::current();
|
||||||
|
if ( project && RimProject::current()->activeOilField() )
|
||||||
|
{
|
||||||
|
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
|
||||||
|
if ( wellPathCollection )
|
||||||
|
{
|
||||||
|
auto newModeledWellPath = new RimModeledWellPath();
|
||||||
|
|
||||||
|
newModeledWellPath->setUnitSystem( project->commonUnitSystemForAllCases() );
|
||||||
|
|
||||||
|
size_t modelledWellpathCount = wellPathCollection->modelledWellPathCount();
|
||||||
|
|
||||||
|
newModeledWellPath->setName( "Well-" + QString::number( modelledWellpathCount + 1 ) );
|
||||||
|
newModeledWellPath->setWellPathColor( RiaColorTables::editableWellPathsPaletteColors().cycledColor3f( modelledWellpathCount ) );
|
||||||
|
|
||||||
|
wellPathCollection->addWellPaths( { newModeledWellPath } );
|
||||||
|
wellPathCollection->uiCapability()->updateConnectedEditors();
|
||||||
|
|
||||||
|
if ( sourceWellPath->wellPathGeometry() && sourceWellPath->wellPathGeometry()->measuredDepths().size() > 2 )
|
||||||
|
{
|
||||||
|
auto destinationGeometryDef = newModeledWellPath->geometryDefinition();
|
||||||
|
|
||||||
|
const int targetCount = 8;
|
||||||
|
const auto sourceMDs = sourceWellPath->wellPathGeometry()->measuredDepths();
|
||||||
|
const double distanceBetweenTargets = ( sourceMDs.back() - sourceMDs.front() ) / targetCount;
|
||||||
|
|
||||||
|
std::vector<cvf::Vec3d> targetCoordinates;
|
||||||
|
|
||||||
|
for ( int targetIdx = 0; targetIdx <= targetCount; targetIdx++ )
|
||||||
|
{
|
||||||
|
double measuredDepth = sourceMDs.front() + targetIdx * distanceBetweenTargets;
|
||||||
|
auto sourceCoord = sourceWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( measuredDepth );
|
||||||
|
targetCoordinates.push_back( sourceCoord );
|
||||||
|
}
|
||||||
|
destinationGeometryDef->createAndInsertTargets( targetCoordinates );
|
||||||
|
newModeledWellPath->createWellPathGeometry();
|
||||||
|
}
|
||||||
|
|
||||||
|
project->scheduleCreateDisplayModelAndRedrawAllViews();
|
||||||
|
|
||||||
|
Riu3DMainWindowTools::selectAsCurrentItem( newModeledWellPath->geometryDefinition() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicDuplicateWellPathFeature::setupActionLook( QAction* actionToSetup )
|
||||||
|
{
|
||||||
|
actionToSetup->setText( "Duplicate Well Path" );
|
||||||
|
actionToSetup->setIcon( QIcon( ":/caf/duplicate.svg" ) );
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (C) 2023- 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 RicDuplicateWellPathFeature : public caf::CmdFeature
|
||||||
|
{
|
||||||
|
CAF_CMD_HEADER_INIT;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool isCommandEnabled() override;
|
||||||
|
void onActionTriggered( bool isChecked ) override;
|
||||||
|
void setupActionLook( QAction* actionToSetup ) override;
|
||||||
|
};
|
@ -381,6 +381,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection()
|
|||||||
menuBuilder << "RicNewEditableWellPathFeature";
|
menuBuilder << "RicNewEditableWellPathFeature";
|
||||||
menuBuilder << "RicNewWellPathLateralFeature";
|
menuBuilder << "RicNewWellPathLateralFeature";
|
||||||
menuBuilder << "RicLinkWellPathFeature";
|
menuBuilder << "RicLinkWellPathFeature";
|
||||||
|
menuBuilder << "RicDuplicateWellPathFeature";
|
||||||
|
|
||||||
menuBuilder.addSeparator();
|
menuBuilder.addSeparator();
|
||||||
menuBuilder << "RicNewWellPathIntersectionFeature";
|
menuBuilder << "RicNewWellPathIntersectionFeature";
|
||||||
|
@ -534,6 +534,7 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event )
|
|||||||
menuBuilder << "RicNewWellPathLateralAtDepthFeature";
|
menuBuilder << "RicNewWellPathLateralAtDepthFeature";
|
||||||
menuBuilder << "RicNewWellPathIntersectionFeature";
|
menuBuilder << "RicNewWellPathIntersectionFeature";
|
||||||
menuBuilder << "RicLinkWellPathFeature";
|
menuBuilder << "RicLinkWellPathFeature";
|
||||||
|
menuBuilder << "RicDuplicateWellPathFeature";
|
||||||
}
|
}
|
||||||
|
|
||||||
const RivSimWellPipeSourceInfo* eclipseWellSourceInfo = dynamic_cast<const RivSimWellPipeSourceInfo*>( firstHitPart->sourceInfo() );
|
const RivSimWellPipeSourceInfo* eclipseWellSourceInfo = dynamic_cast<const RivSimWellPipeSourceInfo*>( firstHitPart->sourceInfo() );
|
||||||
|
Loading…
Reference in New Issue
Block a user