2015-11-27 17:18:30 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2015- Statoil ASA
|
|
|
|
|
// Copyright (C) 2015- Ceetron Solutions AS
|
|
|
|
|
//
|
|
|
|
|
// 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.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2016-09-21 11:44:28 +02:00
|
|
|
#include "RicNewPolylineIntersectionFeature.h"
|
2015-11-27 17:18:30 +01:00
|
|
|
|
|
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
|
|
|
|
|
#include "RimCase.h"
|
2016-09-21 10:48:25 +02:00
|
|
|
#include "RimIntersection.h"
|
2016-09-21 10:52:16 +02:00
|
|
|
#include "RimIntersectionCollection.h"
|
2018-01-16 09:37:08 +01:00
|
|
|
#include "RimGridView.h"
|
2015-11-27 17:18:30 +01:00
|
|
|
|
2018-02-27 15:21:14 +01:00
|
|
|
#include "Riu3DMainWindowTools.h"
|
2015-11-27 17:18:30 +01:00
|
|
|
#include "RiuSelectionManager.h"
|
2016-11-02 14:44:35 +01:00
|
|
|
#include "RiuViewer.h"
|
2015-11-27 17:18:30 +01:00
|
|
|
|
|
|
|
|
#include "cafCmdExecCommandManager.h"
|
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
|
|
#include "cvfAssert.h"
|
|
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
2016-09-21 11:44:28 +02:00
|
|
|
CAF_CMD_SOURCE_INIT(RicNewPolylineIntersectionFeature, "RicNewPolylineIntersectionFeature");
|
2015-11-27 17:18:30 +01:00
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 11:44:28 +02:00
|
|
|
RicNewPolylineIntersectionFeature::RicNewPolylineIntersectionFeature()
|
2015-11-27 17:18:30 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 11:44:28 +02:00
|
|
|
bool RicNewPolylineIntersectionFeature::isCommandEnabled()
|
2015-11-27 17:18:30 +01:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 11:44:28 +02:00
|
|
|
void RicNewPolylineIntersectionFeature::onActionTriggered(bool isChecked)
|
2015-11-27 17:18:30 +01:00
|
|
|
{
|
2018-01-15 14:52:22 +01:00
|
|
|
RimGridView* activeView = RiaApplication::instance()->activeGridView();
|
2015-11-27 17:18:30 +01:00
|
|
|
if (!activeView) return;
|
|
|
|
|
|
2018-01-16 08:44:15 +01:00
|
|
|
RicNewPolylineIntersectionFeatureCmd* cmd = new RicNewPolylineIntersectionFeatureCmd(activeView->crossSectionCollection());
|
2015-11-27 17:18:30 +01:00
|
|
|
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 11:44:28 +02:00
|
|
|
void RicNewPolylineIntersectionFeature::setupActionLook(QAction* actionToSetup)
|
2015-11-27 17:18:30 +01:00
|
|
|
{
|
|
|
|
|
actionToSetup->setIcon(QIcon(":/CrossSection16x16.png"));
|
2017-11-21 18:36:55 +01:00
|
|
|
actionToSetup->setText("Polyline Intersection");
|
2015-11-27 17:18:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-10-25 10:03:55 +02:00
|
|
|
RicNewPolylineIntersectionFeatureCmd::RicNewPolylineIntersectionFeatureCmd(RimIntersectionCollection* intersectionCollection)
|
2018-02-18 18:56:43 +01:00
|
|
|
: CmdExecuteCommand(nullptr),
|
2016-10-25 10:03:55 +02:00
|
|
|
m_intersectionCollection(intersectionCollection)
|
2015-11-27 17:18:30 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 11:44:28 +02:00
|
|
|
RicNewPolylineIntersectionFeatureCmd::~RicNewPolylineIntersectionFeatureCmd()
|
2015-11-27 17:18:30 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 11:44:28 +02:00
|
|
|
QString RicNewPolylineIntersectionFeatureCmd::name()
|
2015-11-27 17:18:30 +01:00
|
|
|
{
|
|
|
|
|
return "Start Polyline Intersection";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 11:44:28 +02:00
|
|
|
void RicNewPolylineIntersectionFeatureCmd::redo()
|
2015-11-27 17:18:30 +01:00
|
|
|
{
|
2016-10-25 10:03:55 +02:00
|
|
|
CVF_ASSERT(m_intersectionCollection);
|
2015-11-27 17:18:30 +01:00
|
|
|
|
2016-10-25 10:03:55 +02:00
|
|
|
RimIntersection* intersection = new RimIntersection();
|
|
|
|
|
intersection->name = "Polyline";
|
|
|
|
|
intersection->type = RimIntersection::CS_POLYLINE;
|
|
|
|
|
intersection->inputPolyLineFromViewerEnabled = true;
|
2015-11-27 17:18:30 +01:00
|
|
|
|
2018-01-24 10:48:23 +01:00
|
|
|
m_intersectionCollection->appendIntersectionAndUpdate(intersection);
|
2015-11-27 17:18:30 +01:00
|
|
|
|
|
|
|
|
RiuSelectionManager::instance()->deleteAllItems();
|
|
|
|
|
|
2018-02-27 15:21:14 +01:00
|
|
|
Riu3DMainWindowTools::selectAsCurrentItem(intersection);
|
2015-11-27 17:18:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
|
///
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2016-09-21 11:44:28 +02:00
|
|
|
void RicNewPolylineIntersectionFeatureCmd::undo()
|
2015-11-27 17:18:30 +01:00
|
|
|
{
|
|
|
|
|
}
|