#12999 Add spacing to system parameters

Add spacing to RicFishbonesSystemParameters
Use 12.5 as default, use 18.5 for drillingExtendedParameters
Remove duplicated code
This commit is contained in:
Magne Sjaastad committed 2025-11-10 14:58:55 +01:00
1 parent c921299305
commit f81a2d8967
7 files changed
+186 -86

No files matched your search

@@ -1,6 +1,7 @@
set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicEditPerforationCollectionFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicExportFishbonesLateralsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicFishbonesCreateHelper.h
${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsAtMeasuredDepthFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewPerforationIntervalFeature.h
@@ -20,6 +21,7 @@ set(SOURCE_GROUP_HEADER_FILES
set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicEditPerforationCollectionFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicExportFishbonesLateralsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicFishbonesCreateHelper.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsAtMeasuredDepthFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewPerforationIntervalFeature.cpp
@@ -0,0 +1,110 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025 Equinor 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 "RicFishbonesCreateHelper.h"
#include "RicNewFishbonesSubsFeature.h"
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RimFishbones.h"
#include "RimFishbonesCollection.h"
#include "RimProject.h"
#include "RimTools.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "Riu3DMainWindowTools.h"
#include "RiuMainWindow.h"
#include <QAction>
#include <QIcon>
#include <QMenu>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFishbones* RicFishbonesCreateHelper::createAndConfigureFishbones( RimFishbonesCollection* fishbonesCollection,
const RimFishbonesDefines::RicFishbonesSystemParameters& customParameters,
double measuredDepth )
{
if ( !fishbonesCollection ) return nullptr;
RimWellPath* wellPath = fishbonesCollection->firstAncestorOrThisOfTypeAsserted<RimWellPath>();
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return nullptr;
auto* obj = new RimFishbones;
fishbonesCollection->appendFishbonesSubs( obj );
obj->setSystemParameters( customParameters.lateralsPerSub,
customParameters.lateralLength,
customParameters.holeDiameter,
customParameters.buildAngle,
customParameters.icdsPerSub );
obj->setMeasuredDepthAndCount( measuredDepth, customParameters.spacing, 13 );
finalizeFishbonesCreation( obj, fishbonesCollection );
return obj;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicFishbonesCreateHelper::setupFishbonesSubMenu( QAction* actionToSetup, const QString& actionText )
{
auto icon = QIcon( ":/FishBoneGroup16x16.png" );
actionToSetup->setIcon( icon );
actionToSetup->setText( actionText );
auto subMenu = new QMenu;
{
auto action = subMenu->addAction( "Drilling Standard" );
action->setIcon( icon );
}
{
auto action = subMenu->addAction( "Drilling Extended" );
action->setIcon( icon );
}
{
auto action = subMenu->addAction( "Acid Jetting" );
action->setIcon( icon );
}
actionToSetup->setMenu( subMenu );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicFishbonesCreateHelper::finalizeFishbonesCreation( RimFishbones* fishbones, RimFishbonesCollection* fishbonesCollection )
{
RicNewFishbonesSubsFeature::adjustWellPathScaling( fishbonesCollection );
if ( auto wellPathCollection = RimTools::wellPathCollection() )
{
wellPathCollection->uiCapability()->updateConnectedEditors();
}
Riu3DMainWindowTools::selectAsCurrentItem( fishbones );
RimProject* proj = RimProject::current();
proj->reloadCompletionTypeResultsInAllViews();
}
@@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2025 Equinor 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 "RimFishbonesDefines.h"
class RimFishbones;
class RimFishbonesCollection;
class RimWellPath;
class QAction;
class QMenu;
class QString;
//==================================================================================================
/// Helper class for common fishbones creation functionality
//==================================================================================================
class RicFishbonesCreateHelper
{
public:
static RimFishbones* createAndConfigureFishbones( RimFishbonesCollection* fishbonesCollection,
const RimFishbonesDefines::RicFishbonesSystemParameters& customParameters,
double measuredDepth );
static void setupFishbonesSubMenu( QAction* actionToSetup, const QString& actionText );
private:
static void finalizeFishbonesCreation( RimFishbones* fishbones, RimFishbonesCollection* fishbonesCollection );
};
@@ -18,6 +18,9 @@
#include "RicNewFishbonesSubsAtMeasuredDepthFeature.h"
#include "RiaLogging.h"
#include "RicFishbonesCreateHelper.h"
#include "RicNewFishbonesSubsFeature.h"
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
@@ -48,30 +51,20 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered( bool isChecke
//--------------------------------------------------------------------------------------------------
void RicNewFishbonesSubsAtMeasuredDepthFeature::setupActionLook( QAction* actionToSetup )
{
auto icon = QIcon( ":/FishBoneGroup16x16.png" );
actionToSetup->setIcon( icon );
actionToSetup->setText( "Create Fishbones at this Depth" );
RicFishbonesCreateHelper::setupFishbonesSubMenu( actionToSetup, "Create Fishbones at this Depth" );
auto subMenu = new QMenu;
QMenu* subMenu = actionToSetup->menu();
auto actions = subMenu->actions();
if ( actions.size() < 3 )
{
auto action = subMenu->addAction( "Drilling Standard" );
action->setIcon( icon );
connect( action, &QAction::triggered, this, &RicNewFishbonesSubsAtMeasuredDepthFeature::onDrillingStandard );
RiaLogging::error( "RicNewFishbonesSubsAtMeasuredDepthFeature::setupActionLook: Unexpected number of actions in submenu." );
return;
}
{
auto action = subMenu->addAction( "Drilling Extended" );
action->setIcon( icon );
connect( action, &QAction::triggered, this, &RicNewFishbonesSubsAtMeasuredDepthFeature::onDrillingExtended );
}
{
auto action = subMenu->addAction( "Acid Jetting" );
action->setIcon( icon );
connect( action, &QAction::triggered, this, &RicNewFishbonesSubsAtMeasuredDepthFeature::onAcidJetting );
}
actionToSetup->setMenu( subMenu );
connect( actions[0], &QAction::triggered, this, &RicNewFishbonesSubsAtMeasuredDepthFeature::onDrillingStandard );
connect( actions[1], &QAction::triggered, this, &RicNewFishbonesSubsAtMeasuredDepthFeature::onDrillingExtended );
connect( actions[2], &QAction::triggered, this, &RicNewFishbonesSubsAtMeasuredDepthFeature::onAcidJetting );
}
//--------------------------------------------------------------------------------------------------
@@ -93,26 +86,7 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::createFishbones( const RimFishbo
RimWellPath* wellPath = wellPathSelItem->m_wellpath;
CVF_ASSERT( wellPath );
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
auto* obj = new RimFishbones;
wellPath->fishbonesCollection()->appendFishbonesSubs( obj );
obj->setSystemParameters( customParameters.lateralsPerSub,
customParameters.lateralLength,
customParameters.holeDiameter,
customParameters.buildAngle,
customParameters.icdsPerSub );
obj->setMeasuredDepthAndCount( wellPathSelItem->m_measuredDepth, 12.5, 13 );
RicNewFishbonesSubsFeature::adjustWellPathScaling( wellPath->fishbonesCollection() );
wellPath->updateConnectedEditors();
Riu3DMainWindowTools::selectAsCurrentItem( obj );
RimProject* proj = RimProject::current();
proj->reloadCompletionTypeResultsInAllViews();
RicFishbonesCreateHelper::createAndConfigureFishbones( wellPath->fishbonesCollection(), customParameters, wellPathSelItem->m_measuredDepth );
}
//--------------------------------------------------------------------------------------------------
@@ -18,6 +18,7 @@
#include "RicNewFishbonesSubsFeature.h"
#include "RicFishbonesCreateHelper.h"
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
#include "RiaApplication.h"
@@ -87,38 +88,17 @@ void RicNewFishbonesSubsFeature::createFishbones( const RimFishbonesDefines::Ric
CVF_ASSERT( fishbonesCollection );
RimWellPath* wellPath = fishbonesCollection->firstAncestorOrThisOfTypeAsserted<RimWellPath>();
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
auto* obj = new RimFishbones;
fishbonesCollection->appendFishbonesSubs( obj );
obj->setSystemParameters( customParameters.lateralsPerSub,
customParameters.lateralLength,
customParameters.holeDiameter,
customParameters.buildAngle,
customParameters.icdsPerSub );
double measuredDepth = 100;
double wellPathTipMd = wellPath->uniqueEndMD();
if ( wellPathTipMd != HUGE_VAL )
{
double startMd = wellPathTipMd - 150 - 100;
if ( startMd < 100 ) startMd = 100;
obj->setMeasuredDepthAndCount( startMd, 12.5, 13 );
measuredDepth = startMd;
}
RicNewFishbonesSubsFeature::adjustWellPathScaling( fishbonesCollection );
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
if ( wellPathCollection )
{
wellPathCollection->uiCapability()->updateConnectedEditors();
}
RiuMainWindow::instance()->selectAsCurrentItem( obj );
RimProject* proj = RimProject::current();
proj->reloadCompletionTypeResultsInAllViews();
RicFishbonesCreateHelper::createAndConfigureFishbones( fishbonesCollection, customParameters, measuredDepth );
}
//--------------------------------------------------------------------------------------------------
@@ -161,30 +141,19 @@ RimFishbonesCollection* RicNewFishbonesSubsFeature::selectedFishbonesCollection(
//--------------------------------------------------------------------------------------------------
void RicNewFishbonesSubsFeature::setupActionLook( QAction* actionToSetup )
{
auto icon = QIcon( ":/FishBoneGroup16x16.png" );
actionToSetup->setIcon( icon );
actionToSetup->setText( "Create Fishbones" );
auto subMenu = new QMenu;
RicFishbonesCreateHelper::setupFishbonesSubMenu( actionToSetup, "Create Fishbones" );
QMenu* subMenu = actionToSetup->menu();
auto actions = subMenu->actions();
if ( actions.size() < 3 )
{
auto action = subMenu->addAction( "Drilling Standard" );
action->setIcon( icon );
connect( action, &QAction::triggered, this, &RicNewFishbonesSubsFeature::onDrillingStandard );
RiaLogging::error( "RicNewFishbonesSubsAtMeasuredDepthFeature::setupActionLook: Unexpected number of actions in submenu." );
return;
}
{
auto action = subMenu->addAction( "Drilling Extended" );
action->setIcon( icon );
connect( action, &QAction::triggered, this, &RicNewFishbonesSubsFeature::onDrillingExtended );
}
{
auto action = subMenu->addAction( "Acid Jetting" );
action->setIcon( icon );
connect( action, &QAction::triggered, this, &RicNewFishbonesSubsFeature::onAcidJetting );
}
actionToSetup->setMenu( subMenu );
connect( actions[0], &QAction::triggered, this, &RicNewFishbonesSubsFeature::onDrillingStandard );
connect( actions[1], &QAction::triggered, this, &RicNewFishbonesSubsFeature::onDrillingExtended );
connect( actions[2], &QAction::triggered, this, &RicNewFishbonesSubsFeature::onAcidJetting );
}
//--------------------------------------------------------------------------------------------------
@@ -64,7 +64,7 @@ void caf::AppEnum<RimFishbonesDefines::ValueSource>::setUp()
//--------------------------------------------------------------------------------------------------
RimFishbonesDefines::RicFishbonesSystemParameters RimFishbonesDefines::drillingStandardParameters()
{
return { .lateralsPerSub = 3, .lateralLength = 11.0, .holeDiameter = 12.5, .buildAngle = 6.0, .icdsPerSub = 3 };
return { .lateralsPerSub = 3, .lateralLength = 11.0, .holeDiameter = 12.5, .buildAngle = 6.0, .icdsPerSub = 3, .spacing = 12.5 };
}
//--------------------------------------------------------------------------------------------------
@@ -72,7 +72,7 @@ RimFishbonesDefines::RicFishbonesSystemParameters RimFishbonesDefines::drillingS
//--------------------------------------------------------------------------------------------------
RimFishbonesDefines::RicFishbonesSystemParameters RimFishbonesDefines::drillingExtendedParameters()
{
return { .lateralsPerSub = 3, .lateralLength = 18.0, .holeDiameter = 12.5, .buildAngle = 4.0, .icdsPerSub = 3 };
return { .lateralsPerSub = 3, .lateralLength = 18.0, .holeDiameter = 12.5, .buildAngle = 4.0, .icdsPerSub = 3, .spacing = 18.5 };
}
//--------------------------------------------------------------------------------------------------
@@ -80,5 +80,5 @@ RimFishbonesDefines::RicFishbonesSystemParameters RimFishbonesDefines::drillingE
//--------------------------------------------------------------------------------------------------
RimFishbonesDefines::RicFishbonesSystemParameters RimFishbonesDefines::acidJettingParameters()
{
return { .lateralsPerSub = 4, .lateralLength = 12.0, .holeDiameter = 15.0, .buildAngle = 6.0, .icdsPerSub = 4 };
return { .lateralsPerSub = 4, .lateralLength = 12.0, .holeDiameter = 15.0, .buildAngle = 6.0, .icdsPerSub = 4, .spacing = 12.5 };
}
@@ -54,6 +54,7 @@ struct RicFishbonesSystemParameters
double holeDiameter;
double buildAngle;
int icdsPerSub;
double spacing;
};
RicFishbonesSystemParameters drillingStandardParameters();