2015-11-18 15:09:50 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2015-11-18 15:09:50 +01:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
2015-11-18 15:09:50 +01:00
|
|
|
// 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.
|
2019-09-06 10:40:57 +02:00
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2015-11-18 15:09:50 +01:00
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2016-09-21 11:38:37 +02:00
|
|
|
#include "RicNewWellPathIntersectionFeature.h"
|
2015-11-18 15:09:50 +01:00
|
|
|
|
2015-11-19 18:57:32 +01:00
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
2019-11-26 11:35:21 +01:00
|
|
|
#include "RimExtrudedCurveIntersection.h"
|
2019-11-26 13:56:02 +01:00
|
|
|
#include "RimGridView.h"
|
2016-09-21 10:52:16 +02:00
|
|
|
#include "RimIntersectionCollection.h"
|
2015-11-18 15:09:50 +01:00
|
|
|
#include "RimWellPath.h"
|
|
|
|
|
|
|
|
|
|
#include "cafCmdExecCommandManager.h"
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
|
|
#include "cvfAssert.h"
|
|
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
2019-09-06 10:40:57 +02:00
|
|
|
CAF_CMD_SOURCE_INIT( RicNewWellPathIntersectionFeature, "RicNewWellPathIntersectionFeature" );
|
2015-11-18 15:09:50 +01:00
|
|
|
|
2015-11-18 17:55:05 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-18 17:55:05 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 11:13:38 +01:00
|
|
|
RicNewWellPathIntersectionFeature::RicNewWellPathIntersectionFeature()
|
|
|
|
|
{
|
|
|
|
|
}
|
2015-11-18 17:55:05 +01:00
|
|
|
|
2015-11-18 15:09:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-18 15:09:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 11:38:37 +02:00
|
|
|
bool RicNewWellPathIntersectionFeature::isCommandEnabled()
|
2015-11-18 15:09:50 +01:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-18 15:09:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RicNewWellPathIntersectionFeature::onActionTriggered( bool isChecked )
|
2015-11-18 15:09:50 +01:00
|
|
|
{
|
2019-10-24 12:46:07 +02:00
|
|
|
RimGridView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
2019-09-06 10:40:57 +02:00
|
|
|
if ( !activeView ) return;
|
2015-11-18 17:55:05 +01:00
|
|
|
|
|
|
|
|
std::vector<RimWellPath*> collection;
|
2019-09-06 10:40:57 +02:00
|
|
|
caf::SelectionManager::instance()->objectsByType( &collection );
|
|
|
|
|
CVF_ASSERT( collection.size() == 1 );
|
2015-11-18 15:09:50 +01:00
|
|
|
|
2015-11-18 17:55:05 +01:00
|
|
|
RimWellPath* wellPath = collection[0];
|
2019-09-06 10:40:57 +02:00
|
|
|
|
|
|
|
|
RicNewWellPathIntersectionFeatureCmd* cmd =
|
2019-11-26 12:30:44 +01:00
|
|
|
new RicNewWellPathIntersectionFeatureCmd( activeView->intersectionCollection(), wellPath );
|
2019-09-06 10:40:57 +02:00
|
|
|
caf::CmdExecCommandManager::instance()->processExecuteCommand( cmd );
|
2015-11-18 15:09:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-18 15:09:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
void RicNewWellPathIntersectionFeature::setupActionLook( QAction* actionToSetup )
|
2015-11-18 15:09:50 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
actionToSetup->setIcon( QIcon( ":/CrossSection16x16.png" ) );
|
|
|
|
|
actionToSetup->setText( "Create Intersection" );
|
2015-11-18 15:09:50 +01:00
|
|
|
}
|
|
|
|
|
|
2015-11-18 17:55:05 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-18 15:09:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-11-04 14:35:41 +01:00
|
|
|
RicNewWellPathIntersectionFeatureCmd::RicNewWellPathIntersectionFeatureCmd( RimIntersectionCollection* intersectionCollection,
|
|
|
|
|
RimWellPath* wellPath )
|
2019-09-06 10:40:57 +02:00
|
|
|
: CmdExecuteCommand( nullptr )
|
|
|
|
|
, m_intersectionCollection( intersectionCollection )
|
|
|
|
|
, m_wellPath( wellPath )
|
2015-11-18 15:09:50 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-18 15:09:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 11:13:38 +01:00
|
|
|
RicNewWellPathIntersectionFeatureCmd::~RicNewWellPathIntersectionFeatureCmd()
|
|
|
|
|
{
|
|
|
|
|
}
|
2015-11-18 15:09:50 +01:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-18 15:09:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 11:38:37 +02:00
|
|
|
QString RicNewWellPathIntersectionFeatureCmd::name()
|
2015-11-18 15:09:50 +01:00
|
|
|
{
|
2015-11-23 09:07:35 +01:00
|
|
|
return "Create Intersection From Well Path";
|
2015-11-18 15:09:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-18 15:09:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 11:38:37 +02:00
|
|
|
void RicNewWellPathIntersectionFeatureCmd::redo()
|
2015-11-18 15:09:50 +01:00
|
|
|
{
|
2019-09-06 10:40:57 +02:00
|
|
|
CVF_ASSERT( m_intersectionCollection );
|
|
|
|
|
CVF_ASSERT( m_wellPath );
|
2015-11-18 15:09:50 +01:00
|
|
|
|
2019-11-26 11:35:21 +01:00
|
|
|
RimExtrudedCurveIntersection* intersection = new RimExtrudedCurveIntersection();
|
2019-11-12 15:10:41 +01:00
|
|
|
intersection->setName( m_wellPath->name() );
|
2021-08-26 08:13:03 +02:00
|
|
|
intersection->configureForWellPath( m_wellPath );
|
2015-11-18 15:09:50 +01:00
|
|
|
|
2019-10-24 12:46:07 +02:00
|
|
|
m_intersectionCollection->appendIntersectionAndUpdate( intersection, false );
|
2015-11-18 15:09:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 10:40:57 +02:00
|
|
|
///
|
2015-11-18 15:09:50 +01:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 11:13:38 +01:00
|
|
|
void RicNewWellPathIntersectionFeatureCmd::undo()
|
|
|
|
|
{
|
|
|
|
|
}
|