mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1486 Add 'New Fishbone' to context menu when clicking on well path
This commit is contained in:
parent
0b872dbf3a
commit
d0ab854534
@ -7,11 +7,13 @@ endif()
|
|||||||
set (SOURCE_GROUP_HEADER_FILES
|
set (SOURCE_GROUP_HEADER_FILES
|
||||||
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsFeature.h
|
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsFeature.h
|
||||||
${CEE_CURRENT_LIST_DIR}RicExportFishbonesLateralsFeature.h
|
${CEE_CURRENT_LIST_DIR}RicExportFishbonesLateralsFeature.h
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsAtMeasuredDepthFeature.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SOURCE_GROUP_SOURCE_FILES
|
set (SOURCE_GROUP_SOURCE_FILES
|
||||||
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsFeature.cpp
|
||||||
${CEE_CURRENT_LIST_DIR}RicExportFishbonesLateralsFeature.cpp
|
${CEE_CURRENT_LIST_DIR}RicExportFishbonesLateralsFeature.cpp
|
||||||
|
${CEE_CURRENT_LIST_DIR}RicNewFishbonesSubsAtMeasuredDepthFeature.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND CODE_HEADER_FILES
|
list(APPEND CODE_HEADER_FILES
|
||||||
|
@ -0,0 +1,94 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// 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 "RicNewFishbonesSubsAtMeasuredDepthFeature.h"
|
||||||
|
|
||||||
|
#include "RimFishbonesMultipleSubs.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimWellPath.h"
|
||||||
|
|
||||||
|
#include "RiuMainWindow.h"
|
||||||
|
#include "RiuSelectionManager.h"
|
||||||
|
|
||||||
|
#include "cafSelectionManager.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
|
||||||
|
CAF_CMD_SOURCE_INIT(RicNewFishbonesSubsAtMeasuredDepthFeature, "RicNewFishbonesSubsAtMeasuredDepthFeature");
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered(bool isChecked)
|
||||||
|
{
|
||||||
|
RiuWellPathSelectionItem* wellPathSelItem = wellPathSelectionItem();
|
||||||
|
CVF_ASSERT(wellPathSelItem);
|
||||||
|
|
||||||
|
RimWellPath* wellPath = wellPathSelItem->m_wellpath;
|
||||||
|
CVF_ASSERT(wellPath);
|
||||||
|
|
||||||
|
RimFishbonesMultipleSubs* obj = new RimFishbonesMultipleSubs;
|
||||||
|
wellPath->fishbonesSubs.push_back(obj);
|
||||||
|
|
||||||
|
obj->setName(QString("Fishbones Subs (%1)").arg(wellPath->fishbonesSubs.size()));
|
||||||
|
int integerValue = wellPathSelItem->m_measuredDepth;
|
||||||
|
obj->setMeasuredDepthAndCount(integerValue, 24, 5);
|
||||||
|
|
||||||
|
wellPath->updateConnectedEditors();
|
||||||
|
RiuMainWindow::instance()->selectAsCurrentItem(obj);
|
||||||
|
|
||||||
|
RimProject* proj;
|
||||||
|
wellPath->firstAncestorOrThisOfTypeAsserted(proj);
|
||||||
|
proj->createDisplayModelAndRedrawAllViews();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RiuWellPathSelectionItem* RicNewFishbonesSubsAtMeasuredDepthFeature::wellPathSelectionItem()
|
||||||
|
{
|
||||||
|
RiuSelectionManager* riuSelManager = RiuSelectionManager::instance();
|
||||||
|
RiuSelectionItem* selItem = riuSelManager->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
|
||||||
|
|
||||||
|
RiuWellPathSelectionItem* wellPathItem = dynamic_cast<RiuWellPathSelectionItem*>(selItem);
|
||||||
|
|
||||||
|
return wellPathItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RicNewFishbonesSubsAtMeasuredDepthFeature::setupActionLook(QAction* actionToSetup)
|
||||||
|
{
|
||||||
|
//actionToSetup->setIcon(QIcon(":/FractureSymbol16x16.png"));
|
||||||
|
actionToSetup->setText("New Fishbones Subs Definition");
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RicNewFishbonesSubsAtMeasuredDepthFeature::isCommandEnabled()
|
||||||
|
{
|
||||||
|
if (wellPathSelectionItem())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
@ -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 RicNewFishbonesSubsAtMeasuredDepthFeature : 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();
|
||||||
|
};
|
@ -18,8 +18,10 @@
|
|||||||
|
|
||||||
#include "RimFishbonesMultipleSubs.h"
|
#include "RimFishbonesMultipleSubs.h"
|
||||||
|
|
||||||
#include "RimProject.h"
|
|
||||||
#include "RigFishbonesGeometry.h"
|
#include "RigFishbonesGeometry.h"
|
||||||
|
#include "RigWellPath.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimWellPath.h"
|
||||||
|
|
||||||
#include "cafPdmUiListEditor.h"
|
#include "cafPdmUiListEditor.h"
|
||||||
|
|
||||||
@ -37,7 +39,7 @@ namespace caf {
|
|||||||
addItem(RimFishbonesMultipleSubs::FB_SUB_COUNT_END, "FB_SUB_COUNT", "Start/End/Number of Subs");
|
addItem(RimFishbonesMultipleSubs::FB_SUB_COUNT_END, "FB_SUB_COUNT", "Start/End/Number of Subs");
|
||||||
addItem(RimFishbonesMultipleSubs::FB_SUB_SPACING_END, "FB_SUB_SPACING", "Start/End/Spacing");
|
addItem(RimFishbonesMultipleSubs::FB_SUB_SPACING_END, "FB_SUB_SPACING", "Start/End/Spacing");
|
||||||
addItem(RimFishbonesMultipleSubs::FB_SUB_USER_DEFINED, "FB_SUB_CUSTOM", "User Specification");
|
addItem(RimFishbonesMultipleSubs::FB_SUB_USER_DEFINED, "FB_SUB_CUSTOM", "User Specification");
|
||||||
setDefault(RimFishbonesMultipleSubs::FB_SUB_USER_DEFINED);
|
setDefault(RimFishbonesMultipleSubs::FB_SUB_COUNT_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
@ -79,7 +81,7 @@ RimFishbonesMultipleSubs::RimFishbonesMultipleSubs()
|
|||||||
CAF_PDM_InitFieldNoDefault(&m_locationOfSubs, "LocationOfSubs", "Measured Depths [m]", "", "", "");
|
CAF_PDM_InitFieldNoDefault(&m_locationOfSubs, "LocationOfSubs", "Measured Depths [m]", "", "", "");
|
||||||
m_locationOfSubs.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
m_locationOfSubs.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
|
||||||
|
|
||||||
CAF_PDM_InitField(&m_subsLocationMode, "SubsLocationMode", caf::AppEnum<LocationType>(FB_SUB_USER_DEFINED), "Location Defined By", "", "", "");
|
CAF_PDM_InitField(&m_subsLocationMode, "SubsLocationMode", caf::AppEnum<LocationType>(FB_SUB_COUNT_END), "Location Defined By", "", "", "");
|
||||||
CAF_PDM_InitField(&m_rangeStart, "RangeStart", 100.0, "Start MD [m]", "", "", "");
|
CAF_PDM_InitField(&m_rangeStart, "RangeStart", 100.0, "Start MD [m]", "", "", "");
|
||||||
CAF_PDM_InitField(&m_rangeEnd, "RangeEnd", 250.0, "End MD [m]", "", "", "");
|
CAF_PDM_InitField(&m_rangeEnd, "RangeEnd", 250.0, "End MD [m]", "", "", "");
|
||||||
CAF_PDM_InitField(&m_rangeSubSpacing, "RangeSubSpacing", 40.0, "Spacing [m]", "", "", "");
|
CAF_PDM_InitField(&m_rangeSubSpacing, "RangeSubSpacing", 40.0, "Spacing [m]", "", "", "");
|
||||||
@ -102,6 +104,21 @@ RimFishbonesMultipleSubs::~RimFishbonesMultipleSubs()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimFishbonesMultipleSubs::setMeasuredDepthAndCount(double measuredDepth, double spacing, int subCount)
|
||||||
|
{
|
||||||
|
m_subsLocationMode = FB_SUB_SPACING_END;
|
||||||
|
|
||||||
|
m_rangeStart = measuredDepth;
|
||||||
|
m_rangeEnd = measuredDepth + spacing * subCount;
|
||||||
|
m_rangeSubCount = subCount;
|
||||||
|
|
||||||
|
computeRangesAndLocations();
|
||||||
|
computeRotationAngles();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -235,28 +252,7 @@ void RimFishbonesMultipleSubs::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
|||||||
|
|
||||||
if (recomputeLocations)
|
if (recomputeLocations)
|
||||||
{
|
{
|
||||||
if (m_subsLocationMode == FB_SUB_COUNT_END)
|
computeRangesAndLocations();
|
||||||
{
|
|
||||||
size_t divisor = 1;
|
|
||||||
if (m_rangeSubCount > 2) divisor = m_rangeSubCount - 1;
|
|
||||||
|
|
||||||
m_rangeSubSpacing = fabs(m_rangeStart - m_rangeEnd) / divisor;
|
|
||||||
}
|
|
||||||
else if (m_subsLocationMode == FB_SUB_SPACING_END)
|
|
||||||
{
|
|
||||||
m_rangeSubCount = (fabs(m_rangeStart - m_rangeEnd) / m_rangeSubSpacing) + 1;
|
|
||||||
|
|
||||||
if (m_rangeSubCount < 1)
|
|
||||||
{
|
|
||||||
m_rangeSubCount = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_subsLocationMode == FB_SUB_COUNT_END || m_subsLocationMode == FB_SUB_SPACING_END)
|
|
||||||
{
|
|
||||||
std::vector<double> measuredDepths = locationsFromStartSpacingAndCount(m_rangeStart, m_rangeSubSpacing, m_rangeSubCount);
|
|
||||||
m_locationOfSubs = measuredDepths;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recomputeLocations ||
|
if (recomputeLocations ||
|
||||||
@ -271,6 +267,55 @@ void RimFishbonesMultipleSubs::fieldChangedByUi(const caf::PdmFieldHandle* chang
|
|||||||
proj->createDisplayModelAndRedrawAllViews();
|
proj->createDisplayModelAndRedrawAllViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimFishbonesMultipleSubs::computeRangesAndLocations()
|
||||||
|
{
|
||||||
|
if (m_subsLocationMode == FB_SUB_COUNT_END)
|
||||||
|
{
|
||||||
|
size_t divisor = 1;
|
||||||
|
if (m_rangeSubCount > 2) divisor = m_rangeSubCount - 1;
|
||||||
|
|
||||||
|
m_rangeSubSpacing = fabs(m_rangeStart - m_rangeEnd) / divisor;
|
||||||
|
}
|
||||||
|
else if (m_subsLocationMode == FB_SUB_SPACING_END)
|
||||||
|
{
|
||||||
|
m_rangeSubCount = (fabs(m_rangeStart - m_rangeEnd) / m_rangeSubSpacing) + 1;
|
||||||
|
|
||||||
|
if (m_rangeSubCount < 1)
|
||||||
|
{
|
||||||
|
m_rangeSubCount = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_subsLocationMode == FB_SUB_COUNT_END || m_subsLocationMode == FB_SUB_SPACING_END)
|
||||||
|
{
|
||||||
|
std::vector<double> validMeasuredDepths;
|
||||||
|
{
|
||||||
|
RimWellPath* wellPath = nullptr;
|
||||||
|
this->firstAncestorOrThisOfTypeAsserted(wellPath);
|
||||||
|
|
||||||
|
RigWellPath* rigWellPathGeo = wellPath->wellPathGeometry();
|
||||||
|
if (rigWellPathGeo && rigWellPathGeo->m_measuredDepths.size() > 1)
|
||||||
|
{
|
||||||
|
double firstWellPathMD = rigWellPathGeo->m_measuredDepths.front();
|
||||||
|
double lastWellPathMD = rigWellPathGeo->m_measuredDepths.back();
|
||||||
|
|
||||||
|
for (auto md : locationsFromStartSpacingAndCount(m_rangeStart, m_rangeSubSpacing, m_rangeSubCount))
|
||||||
|
{
|
||||||
|
if (md > firstWellPathMD && md < lastWellPathMD)
|
||||||
|
{
|
||||||
|
validMeasuredDepths.push_back(md);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_locationOfSubs = validMeasuredDepths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -54,6 +54,8 @@ public:
|
|||||||
RimFishbonesMultipleSubs();
|
RimFishbonesMultipleSubs();
|
||||||
virtual ~RimFishbonesMultipleSubs();
|
virtual ~RimFishbonesMultipleSubs();
|
||||||
|
|
||||||
|
void setMeasuredDepthAndCount(double measuredDepth, double spacing, int subCount);
|
||||||
|
|
||||||
std::vector<double> locationOfSubs() const;
|
std::vector<double> locationOfSubs() const;
|
||||||
|
|
||||||
double rotationAngle(size_t index) const;
|
double rotationAngle(size_t index) const;
|
||||||
@ -69,10 +71,12 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||||
|
|
||||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||||
virtual void initAfterRead() override;
|
virtual void initAfterRead() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void computeRangesAndLocations();
|
||||||
void computeRotationAngles();
|
void computeRotationAngles();
|
||||||
|
|
||||||
static std::vector<double> locationsFromStartSpacingAndCount(double start, double spacing, size_t count);
|
static std::vector<double> locationsFromStartSpacingAndCount(double start, double spacing, size_t count);
|
||||||
|
Loading…
Reference in New Issue
Block a user