#7824 Modeled Well Path : Optional support for linking of wells

#7824 Modeled Well Path : Add to context menu in 3D view
This commit is contained in:
Magne Sjaastad
2021-06-29 14:17:35 +02:00
parent 3a1f2c8a05
commit a3d5847733
10 changed files with 291 additions and 8 deletions

View File

@@ -22,6 +22,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathLateralFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicPasteModeledWellPathFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateMultipleWellPathLaterals.h
${CMAKE_CURRENT_LIST_DIR}/RicCreateMultipleWellPathLateralsUi.h
${CMAKE_CURRENT_LIST_DIR}/RicLinkWellPathFeature.h
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/Ric3dObjectEditorHandle.h
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulator.h
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellTarget3dEditor.h
@@ -54,6 +55,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathLateralFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicPasteModeledWellPathFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateMultipleWellPathLaterals.cpp
${CMAKE_CURRENT_LIST_DIR}/RicCreateMultipleWellPathLateralsUi.cpp
${CMAKE_CURRENT_LIST_DIR}/RicLinkWellPathFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/Ric3dObjectEditorHandle.cpp
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPointTangentManipulator.cpp
${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicWellTarget3dEditor.cpp

View File

@@ -24,6 +24,7 @@
#include "RimCase.h"
#include "RimModeledWellPath.h"
#include "RimWellPathGeometryDef.h"
#include "RimWellPathGeometryDefTools.h"
#include "RimWellPathTarget.h"
#include "RiuViewer.h"
@@ -166,15 +167,19 @@ void RicWellTarget3dEditor::slotUpdated( const cvf::Vec3d& origin, const cvf::Ve
auto relativePositionXYZ = domainCoordXYZ - geomDef->anchorPointXyz();
auto delta = target->targetPointXYZ() - relativePositionXYZ;
auto currentRefPointXyz = geomDef->anchorPointXyz();
auto newRefPointXyz = currentRefPointXyz - delta;
geomDef->setReferencePointXyz( newRefPointXyz );
geomDef->changed.send( false );
geomDef->updateWellPathVisualization( true );
for ( auto wt : geomDef->activeWellTargets() )
// Find all linked wells and update with delta change
std::vector<RimWellPathGeometryDef*> linkedWellPathGeoDefs;
if ( geomDef->isReferencePointUpdatesLinked() )
{
wt->updateConnectedEditors();
linkedWellPathGeoDefs = RimWellPathGeometryDefTools::linkedDefinitions();
}
else
{
linkedWellPathGeoDefs.push_back( geomDef );
}
RimWellPathGeometryDefTools::updateLinkedGeometryDefinitions( linkedWellPathGeoDefs, delta );
}
else
{

View File

@@ -0,0 +1,87 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 "RicLinkWellPathFeature.h"
#include "RimModeledWellPath.h"
#include "RimWellPathGeometryDef.h"
#include "Riu3dSelectionManager.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT( RicLinkWellPathFeature, "RicLinkWellPathFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicLinkWellPathFeature::isCommandEnabled()
{
return ( wellPathGeometryDef() != nullptr );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLinkWellPathFeature::onActionTriggered( bool isChecked )
{
if ( auto geoDef = wellPathGeometryDef() )
{
geoDef->enableLinkOfReferencePointUpdates( isChecked );
geoDef->updateConnectedEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicLinkWellPathFeature::setupActionLook( QAction* actionToSetup )
{
QString text = "Link Reference Point";
actionToSetup->setText( text );
actionToSetup->setCheckable( true );
actionToSetup->setChecked( isCommandChecked() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicLinkWellPathFeature::isCommandChecked()
{
if ( auto geoDef = wellPathGeometryDef() )
{
return geoDef->isReferencePointUpdatesLinked();
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathGeometryDef* RicLinkWellPathFeature::wellPathGeometryDef()
{
auto wellPathSelectionItem = RiuWellPathSelectionItem::wellPathSelectionItem();
if ( wellPathSelectionItem && wellPathSelectionItem->m_wellpath )
{
auto modeledWellPath = dynamic_cast<RimModeledWellPath*>( wellPathSelectionItem->m_wellpath );
return modeledWellPath->geometryDefinition();
}
}

View File

@@ -0,0 +1,40 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021- 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 RimWellPathGeometryDef;
//==================================================================================================
///
//==================================================================================================
class RicLinkWellPathFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
public:
bool isCommandEnabled() override;
void onActionTriggered( bool isChecked ) override;
void setupActionLook( QAction* actionToSetup ) override;
bool isCommandChecked() override;
private:
static RimWellPathGeometryDef* wellPathGeometryDef();
};