#1502 Fishbones : Add "New Perforation" to context menu when clicking on well path

This commit is contained in:
Magne Sjaastad 2017-05-19 11:03:22 +02:00
parent e67979bd23
commit 829df457ff
6 changed files with 149 additions and 2 deletions

View File

@ -7,11 +7,13 @@ endif()
set (SOURCE_GROUP_HEADER_FILES
${CEE_CURRENT_LIST_DIR}RicEditPerforationCollectionFeature.h
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalFeature.h
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CEE_CURRENT_LIST_DIR}RicEditPerforationCollectionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewPerforationIntervalAtMeasuredDepthFeature.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -0,0 +1,97 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// 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 "RicNewPerforationIntervalAtMeasuredDepthFeature.h"
#include "RimFishbonesMultipleSubs.h"
#include "RimPerforationCollection.h"
#include "RimPerforationInterval.h"
#include "RimProject.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RiuMainWindow.h"
#include "RiuSelectionManager.h"
#include "cafSelectionManager.h"
#include <QAction>
CAF_CMD_SOURCE_INIT(RicNewPerforationIntervalAtMeasuredDepthFeature, "RicNewPerforationIntervalAtMeasuredDepthFeature");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPerforationIntervalAtMeasuredDepthFeature::onActionTriggered(bool isChecked)
{
RiuWellPathSelectionItem* wellPathSelItem = wellPathSelectionItem();
CVF_ASSERT(wellPathSelItem);
RimWellPath* wellPath = wellPathSelItem->m_wellpath;
CVF_ASSERT(wellPath);
RimPerforationInterval* perforationInterval = new RimPerforationInterval;
int measuredDepth = wellPathSelItem->m_measuredDepth;
perforationInterval->setStartAndEndMD(measuredDepth, measuredDepth + 50);
wellPath->m_perforationCollection()->appendPerforation(perforationInterval);
RimWellPathCollection* wellPathCollection = nullptr;
wellPath->firstAncestorOrThisOfTypeAsserted(wellPathCollection);
wellPathCollection->uiCapability()->updateConnectedEditors();
wellPathCollection->scheduleGeometryRegenAndRedrawViews();
RiuMainWindow::instance()->selectAsCurrentItem(perforationInterval);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellPathSelectionItem* RicNewPerforationIntervalAtMeasuredDepthFeature::wellPathSelectionItem()
{
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
RiuWellPathSelectionItem* wellPathItem = dynamic_cast<RiuWellPathSelectionItem*>(selItem);
return wellPathItem;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPerforationIntervalAtMeasuredDepthFeature::setupActionLook(QAction* actionToSetup)
{
//actionToSetup->setIcon(QIcon(":/FractureSymbol16x16.png"));
actionToSetup->setText("New Perforation Interval");
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewPerforationIntervalAtMeasuredDepthFeature::isCommandEnabled()
{
if (wellPathSelectionItem())
{
return true;
}
return false;
}

View File

@ -0,0 +1,39 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// 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 RiuWellPathSelectionItem;
//==================================================================================================
///
//==================================================================================================
class RicNewPerforationIntervalAtMeasuredDepthFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:
virtual void onActionTriggered(bool isChecked) override;
virtual void setupActionLook(QAction* actionToSetup) override;
virtual bool isCommandEnabled() override;
private:
static RiuWellPathSelectionItem* wellPathSelectionItem();
};

View File

@ -48,6 +48,15 @@ RimPerforationInterval::~RimPerforationInterval()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPerforationInterval::setStartAndEndMD(double startMD, double endMD)
{
m_startMD = startMD;
m_endMD = endMD;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -36,7 +36,7 @@ public:
RimPerforationInterval();
virtual ~RimPerforationInterval();
void setStartAndEndMD(double startMD, double endMD);
double startMD() { return m_startMD(); }
double endMD() { return m_endMD(); }
@ -50,5 +50,4 @@ private:
caf::PdmField< double > m_endMD;
caf::PdmField< double > m_radius;
caf::PdmField< double > m_skinFactor;
};

View File

@ -305,6 +305,7 @@ void RiuViewerCommands::displayContextMenu(QMouseEvent* event)
commandIds << "Separator";
commandIds << "RicNewWellPathIntersectionFeature";
commandIds << "RicNewFishbonesSubsAtMeasuredDepthFeature";
commandIds << "RicNewPerforationIntervalAtMeasuredDepthFeature";
}
}