2015-11-27 10:18:30 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
2019-09-06 03:40:57 -05:00
|
|
|
//
|
2015-11-27 10:18:30 -06: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 03:40:57 -05:00
|
|
|
//
|
2015-11-27 10:18:30 -06: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 03:40:57 -05:00
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
2015-11-27 10:18:30 -06:00
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2016-09-21 04:44:28 -05:00
|
|
|
#include "RicNewPolylineIntersectionFeature.h"
|
2015-11-27 10:18:30 -06:00
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
|
|
#include "RimCase.h"
|
2019-11-26 04:35:21 -06:00
|
|
|
#include "RimExtrudedCurveIntersection.h"
|
2019-11-26 06:56:02 -06:00
|
|
|
#include "RimGridView.h"
|
2016-09-21 03:52:16 -05:00
|
|
|
#include "RimIntersectionCollection.h"
|
2015-11-27 10:18:30 -06:00
|
|
|
|
2018-02-27 08:21:14 -06:00
|
|
|
#include "Riu3DMainWindowTools.h"
|
2018-11-30 05:53:46 -06:00
|
|
|
#include "Riu3dSelectionManager.h"
|
2016-11-02 08:44:35 -05:00
|
|
|
#include "RiuViewer.h"
|
2015-11-27 10:18:30 -06:00
|
|
|
|
|
|
|
#include "cafCmdExecCommandManager.h"
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include "cvfAssert.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
CAF_CMD_SOURCE_INIT( RicNewPolylineIntersectionFeature, "RicNewPolylineIntersectionFeature" );
|
2015-11-27 10:18:30 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-11-27 10:18:30 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:13:38 -06:00
|
|
|
RicNewPolylineIntersectionFeature::RicNewPolylineIntersectionFeature()
|
|
|
|
{
|
|
|
|
}
|
2015-11-27 10:18:30 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-11-27 10:18:30 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 04:44:28 -05:00
|
|
|
bool RicNewPolylineIntersectionFeature::isCommandEnabled()
|
2015-11-27 10:18:30 -06:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-11-27 10:18:30 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicNewPolylineIntersectionFeature::onActionTriggered( bool isChecked )
|
2015-11-27 10:18:30 -06:00
|
|
|
{
|
2019-10-17 09:39:24 -05:00
|
|
|
RimGridView* activeView = RiaApplication::instance()->activeMainOrComparisonGridView();
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( !activeView ) return;
|
|
|
|
|
2023-02-26 03:48:40 -06:00
|
|
|
RicNewPolylineIntersectionFeatureCmd* cmd = new RicNewPolylineIntersectionFeatureCmd( activeView->intersectionCollection() );
|
2019-09-06 03:40:57 -05:00
|
|
|
caf::CmdExecCommandManager::instance()->processExecuteCommand( cmd );
|
2015-11-27 10:18:30 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-11-27 10:18:30 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
void RicNewPolylineIntersectionFeature::setupActionLook( QAction* actionToSetup )
|
2015-11-27 10:18:30 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
actionToSetup->setIcon( QIcon( ":/CrossSection16x16.png" ) );
|
|
|
|
actionToSetup->setText( "Polyline Intersection" );
|
2015-11-27 10:18:30 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-11-27 10:18:30 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
RicNewPolylineIntersectionFeatureCmd::RicNewPolylineIntersectionFeatureCmd( RimIntersectionCollection* intersectionCollection )
|
|
|
|
: CmdExecuteCommand( nullptr )
|
|
|
|
, m_intersectionCollection( intersectionCollection )
|
2015-11-27 10:18:30 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-11-27 10:18:30 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:13:38 -06:00
|
|
|
RicNewPolylineIntersectionFeatureCmd::~RicNewPolylineIntersectionFeatureCmd()
|
|
|
|
{
|
|
|
|
}
|
2015-11-27 10:18:30 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-11-27 10:18:30 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 04:44:28 -05:00
|
|
|
QString RicNewPolylineIntersectionFeatureCmd::name()
|
2015-11-27 10:18:30 -06:00
|
|
|
{
|
|
|
|
return "Start Polyline Intersection";
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-11-27 10:18:30 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 04:44:28 -05:00
|
|
|
void RicNewPolylineIntersectionFeatureCmd::redo()
|
2015-11-27 10:18:30 -06:00
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
CVF_ASSERT( m_intersectionCollection );
|
2015-11-27 10:18:30 -06:00
|
|
|
|
2019-11-26 04:35:21 -06:00
|
|
|
RimExtrudedCurveIntersection* intersection = new RimExtrudedCurveIntersection();
|
2019-11-12 08:10:41 -06:00
|
|
|
intersection->setName( "Polyline" );
|
2021-08-26 01:13:03 -05:00
|
|
|
intersection->configureForPolyLine();
|
2015-11-27 10:18:30 -06:00
|
|
|
|
2019-10-30 04:02:36 -05:00
|
|
|
m_intersectionCollection->appendIntersectionAndUpdate( intersection, false );
|
2015-11-27 10:18:30 -06:00
|
|
|
|
2018-11-30 05:53:46 -06:00
|
|
|
Riu3dSelectionManager::instance()->deleteAllItems();
|
2015-11-27 10:18:30 -06:00
|
|
|
|
2019-10-17 09:39:24 -05:00
|
|
|
Riu3DMainWindowTools::selectAsCurrentItem( intersection, false );
|
2015-11-27 10:18:30 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-11-27 10:18:30 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-02-12 04:13:38 -06:00
|
|
|
void RicNewPolylineIntersectionFeatureCmd::undo()
|
|
|
|
{
|
|
|
|
}
|