2015-11-18 08:09:50 -06: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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "RicNewWellPathCrossSectionFeature.h"
|
|
|
|
|
2015-11-19 11:57:32 -06:00
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
2015-11-18 08:09:50 -06:00
|
|
|
#include "RimCrossSection.h"
|
|
|
|
#include "RimCrossSectionCollection.h"
|
|
|
|
#include "RimWellPath.h"
|
2015-11-19 11:57:32 -06:00
|
|
|
#include "RimView.h"
|
2015-11-18 08:09:50 -06:00
|
|
|
|
|
|
|
#include "cafCmdExecCommandManager.h"
|
|
|
|
#include "cafSelectionManager.h"
|
|
|
|
|
|
|
|
#include "cvfAssert.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
|
|
|
|
CAF_CMD_SOURCE_INIT(RicNewWellPathCrossSectionFeature, "RicNewWellPathCrossSectionFeature");
|
|
|
|
|
2015-11-18 10:55:05 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RicNewWellPathCrossSectionFeature::RicNewWellPathCrossSectionFeature()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-18 08:09:50 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
bool RicNewWellPathCrossSectionFeature::isCommandEnabled()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicNewWellPathCrossSectionFeature::onActionTriggered(bool isChecked)
|
|
|
|
{
|
2015-11-19 11:57:32 -06:00
|
|
|
RimView* activeView = RiaApplication::instance()->activeReservoirView();
|
|
|
|
if (!activeView) return;
|
2015-11-18 10:55:05 -06:00
|
|
|
|
|
|
|
std::vector<RimWellPath*> collection;
|
2015-11-18 08:09:50 -06:00
|
|
|
caf::SelectionManager::instance()->objectsByType(&collection);
|
|
|
|
CVF_ASSERT(collection.size() == 1);
|
|
|
|
|
2015-11-18 10:55:05 -06:00
|
|
|
RimWellPath* wellPath = collection[0];
|
2015-11-18 08:09:50 -06:00
|
|
|
|
2015-11-19 11:57:32 -06:00
|
|
|
RicNewWellPathCrossSectionFeatureCmd* cmd = new RicNewWellPathCrossSectionFeatureCmd(activeView->crossSectionCollection, wellPath);
|
2015-11-18 08:09:50 -06:00
|
|
|
caf::CmdExecCommandManager::instance()->processExecuteCommand(cmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicNewWellPathCrossSectionFeature::setupActionLook(QAction* actionToSetup)
|
|
|
|
{
|
|
|
|
// actionToSetup->setIcon(QIcon(":/CellFilter_Values.png"));
|
|
|
|
actionToSetup->setText("New Cross Section");
|
|
|
|
}
|
|
|
|
|
2015-11-18 10:55:05 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-11-18 08:09:50 -06:00
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RicNewWellPathCrossSectionFeatureCmd::RicNewWellPathCrossSectionFeatureCmd(RimCrossSectionCollection* crossSectionCollection, RimWellPath* wellPath)
|
|
|
|
: CmdExecuteCommand(NULL),
|
|
|
|
m_crossSectionCollection(crossSectionCollection),
|
|
|
|
m_wellPath(wellPath)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
RicNewWellPathCrossSectionFeatureCmd::~RicNewWellPathCrossSectionFeatureCmd()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString RicNewWellPathCrossSectionFeatureCmd::name()
|
|
|
|
{
|
|
|
|
return "Create Cross Section From Well Path";
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicNewWellPathCrossSectionFeatureCmd::redo()
|
|
|
|
{
|
|
|
|
CVF_ASSERT(m_crossSectionCollection);
|
|
|
|
CVF_ASSERT(m_wellPath);
|
|
|
|
|
|
|
|
RimCrossSection* crossSection = new RimCrossSection();
|
|
|
|
crossSection->name = m_wellPath->name;
|
2015-11-18 08:55:05 -06:00
|
|
|
crossSection->type = RimCrossSection::CS_WELL_PATH;
|
2015-11-18 08:09:50 -06:00
|
|
|
crossSection->wellPath = m_wellPath;
|
|
|
|
|
2015-11-19 06:40:45 -06:00
|
|
|
m_crossSectionCollection->appendCrossSection(crossSection);
|
2015-11-18 08:09:50 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RicNewWellPathCrossSectionFeatureCmd::undo()
|
|
|
|
{
|
|
|
|
}
|