#1451 Add command for adding new perforation interval

This commit is contained in:
Bjørnar Grip Fjær 2017-05-11 13:34:00 +02:00
parent d3bcc1644c
commit 5a8a632082
6 changed files with 171 additions and 0 deletions

View File

@ -124,6 +124,7 @@ list( APPEND REFERENCED_CMAKE_FILES
Commands/EclipseCommands/CMakeLists_files.cmake
Commands/EclipseCommands/EclipseWell/CMakeLists_files.cmake
Commands/FishbonesCommands/CMakeLists_files.cmake
Commands/PerforationCommands/CMakeLists_files.cmake
Commands/FlowCommands/CMakeLists_files.cmake
Commands/IntersectionBoxCommands/CMakeLists_files.cmake
Commands/OctaveScriptCommands/CMakeLists_files.cmake

View File

@ -0,0 +1,23 @@
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalFeature.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
source_group( "CommandFeature\\Perforations" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )

View File

@ -0,0 +1,96 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicNewPerforationIntervalFeature.h"
#include "RiuMainWindow.h"
#include "RimPerforationInterval.h"
#include "RimPerforationCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "cafSelectionManager.h"
#include <QAction>
namespace caf
{
CAF_CMD_SOURCE_INIT(RicNewPerforationIntervalFeature, "RicNewPerforationIntervalFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewPerforationIntervalFeature::isCommandEnabled()
{
return selectedWellPath() != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPerforationIntervalFeature::onActionTriggered(bool isChecked)
{
RimWellPath* wellPath = selectedWellPath();
if (wellPath == nullptr) return;
RimPerforationInterval* perforationInterval = new RimPerforationInterval;
wellPath->m_perforationCollection()->appendPerforation(perforationInterval);
RimWellPathCollection* wellPathCollection = nullptr;
wellPath->firstAncestorOrThisOfType(wellPathCollection);
if (!wellPathCollection) return;
wellPathCollection->uiCapability()->updateConnectedEditors();
wellPathCollection->scheduleGeometryRegenAndRedrawViews();
RiuMainWindow::instance()->selectAsCurrentItem(perforationInterval);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPerforationIntervalFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("New Perforation Interval");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath * RicNewPerforationIntervalFeature::selectedWellPath()
{
RimWellPath* wellPath = nullptr;
caf::PdmUiItem* pdmUiItem = caf::SelectionManager::instance()->selectedItem();
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(pdmUiItem);
if (objHandle)
{
objHandle->firstAncestorOrThisOfType(wellPath);
}
return wellPath;
}
} // end namespace caf

View File

@ -0,0 +1,48 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafCmdFeature.h"
class RimWellPath;
namespace caf
{
//==================================================================================================
///
//==================================================================================================
class RicNewPerforationIntervalFeature : public CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
// Overrides
virtual bool isCommandEnabled();
virtual void onActionTriggered( bool isChecked );
virtual void setupActionLook( QAction* actionToSetup );
private:
RimWellPath* selectedWellPath();
};
} // end namespace caf

View File

@ -44,6 +44,7 @@
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPathCompletion.h"
#include "RimPerforationInterval.h"
#include "cafCmdExecCommandManager.h"
#include "cafCmdSelectionHelper.h"
@ -96,6 +97,7 @@ bool isDeletable(PdmUiItem * uiItem)
if (dynamic_cast<RimFormationNamesCollection*>(uiItem)) return true;
if (dynamic_cast<RimWellPathCompletion*>(uiItem)) return true;
if (dynamic_cast<RimFishbonesMultipleSubs*>(uiItem)) return true;
if (dynamic_cast<RimPerforationInterval*>(uiItem)) return true;
return false;
}

View File

@ -396,6 +396,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
commandIds << "RicSummaryCurveSwitchAxisFeature";
commandIds << "RicNewFishbonesSubsFeature";
commandIds << "RicNewPerforationIntervalFeature";
commandIds << "RicExportFishbonesLateralsFeature";
commandIds << "RicWellPathImportCompletionsFileFeature";