Skip to content

Commit e785be6

Browse files
committed
#12999 Add spacing to system parameters
Add spacing to RicFishbonesSystemParameters Use 12.5 as default, use 18.5 for drillingExtendedParameters Remove duplicated code
1 parent 5fd210e commit e785be6

7 files changed

Lines changed: 186 additions & 86 deletions

File tree

ApplicationLibCode/Commands/CompletionCommands/CMakeLists_files.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
set(SOURCE_GROUP_HEADER_FILES
22
${CMAKE_CURRENT_LIST_DIR}/RicEditPerforationCollectionFeature.h
33
${CMAKE_CURRENT_LIST_DIR}/RicExportFishbonesLateralsFeature.h
4+
${CMAKE_CURRENT_LIST_DIR}/RicFishbonesCreateHelper.h
45
${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsAtMeasuredDepthFeature.h
56
${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsFeature.h
67
${CMAKE_CURRENT_LIST_DIR}/RicNewPerforationIntervalFeature.h
@@ -20,6 +21,7 @@ set(SOURCE_GROUP_HEADER_FILES
2021
set(SOURCE_GROUP_SOURCE_FILES
2122
${CMAKE_CURRENT_LIST_DIR}/RicEditPerforationCollectionFeature.cpp
2223
${CMAKE_CURRENT_LIST_DIR}/RicExportFishbonesLateralsFeature.cpp
24+
${CMAKE_CURRENT_LIST_DIR}/RicFishbonesCreateHelper.cpp
2325
${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsAtMeasuredDepthFeature.cpp
2426
${CMAKE_CURRENT_LIST_DIR}/RicNewFishbonesSubsFeature.cpp
2527
${CMAKE_CURRENT_LIST_DIR}/RicNewPerforationIntervalFeature.cpp
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (C) 2025 Equinor ASA
4+
//
5+
// ResInsight is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
11+
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
// FITNESS FOR A PARTICULAR PURPOSE.
13+
//
14+
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
15+
// for more details.
16+
//
17+
/////////////////////////////////////////////////////////////////////////////////
18+
19+
#include "RicFishbonesCreateHelper.h"
20+
21+
#include "RicNewFishbonesSubsFeature.h"
22+
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
23+
24+
#include "RimFishbones.h"
25+
#include "RimFishbonesCollection.h"
26+
#include "RimProject.h"
27+
#include "RimTools.h"
28+
#include "RimWellPath.h"
29+
#include "RimWellPathCollection.h"
30+
31+
#include "Riu3DMainWindowTools.h"
32+
#include "RiuMainWindow.h"
33+
34+
#include <QAction>
35+
#include <QIcon>
36+
#include <QMenu>
37+
38+
//--------------------------------------------------------------------------------------------------
39+
///
40+
//--------------------------------------------------------------------------------------------------
41+
RimFishbones* RicFishbonesCreateHelper::createAndConfigureFishbones( RimFishbonesCollection* fishbonesCollection,
42+
const RimFishbonesDefines::RicFishbonesSystemParameters& customParameters,
43+
double measuredDepth )
44+
{
45+
if ( !fishbonesCollection ) return nullptr;
46+
47+
RimWellPath* wellPath = fishbonesCollection->firstAncestorOrThisOfTypeAsserted<RimWellPath>();
48+
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return nullptr;
49+
50+
auto* obj = new RimFishbones;
51+
fishbonesCollection->appendFishbonesSubs( obj );
52+
53+
obj->setSystemParameters( customParameters.lateralsPerSub,
54+
customParameters.lateralLength,
55+
customParameters.holeDiameter,
56+
customParameters.buildAngle,
57+
customParameters.icdsPerSub );
58+
59+
obj->setMeasuredDepthAndCount( measuredDepth, customParameters.spacing, 13 );
60+
61+
finalizeFishbonesCreation( obj, fishbonesCollection );
62+
63+
return obj;
64+
}
65+
66+
//--------------------------------------------------------------------------------------------------
67+
///
68+
//--------------------------------------------------------------------------------------------------
69+
void RicFishbonesCreateHelper::setupFishbonesSubMenu( QAction* actionToSetup, const QString& actionText )
70+
{
71+
auto icon = QIcon( ":/FishBoneGroup16x16.png" );
72+
actionToSetup->setIcon( icon );
73+
actionToSetup->setText( actionText );
74+
75+
auto subMenu = new QMenu;
76+
77+
{
78+
auto action = subMenu->addAction( "Drilling Standard" );
79+
action->setIcon( icon );
80+
}
81+
82+
{
83+
auto action = subMenu->addAction( "Drilling Extended" );
84+
action->setIcon( icon );
85+
}
86+
{
87+
auto action = subMenu->addAction( "Acid Jetting" );
88+
action->setIcon( icon );
89+
}
90+
91+
actionToSetup->setMenu( subMenu );
92+
}
93+
94+
//--------------------------------------------------------------------------------------------------
95+
///
96+
//--------------------------------------------------------------------------------------------------
97+
void RicFishbonesCreateHelper::finalizeFishbonesCreation( RimFishbones* fishbones, RimFishbonesCollection* fishbonesCollection )
98+
{
99+
RicNewFishbonesSubsFeature::adjustWellPathScaling( fishbonesCollection );
100+
101+
if ( auto wellPathCollection = RimTools::wellPathCollection() )
102+
{
103+
wellPathCollection->uiCapability()->updateConnectedEditors();
104+
}
105+
106+
Riu3DMainWindowTools::selectAsCurrentItem( fishbones );
107+
108+
RimProject* proj = RimProject::current();
109+
proj->reloadCompletionTypeResultsInAllViews();
110+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/////////////////////////////////////////////////////////////////////////////////
2+
//
3+
// Copyright (C) 2025 Equinor ASA
4+
//
5+
// ResInsight is free software: you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation, either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
11+
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
// FITNESS FOR A PARTICULAR PURPOSE.
13+
//
14+
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
15+
// for more details.
16+
//
17+
/////////////////////////////////////////////////////////////////////////////////
18+
19+
#pragma once
20+
21+
#include "RimFishbonesDefines.h"
22+
23+
class RimFishbones;
24+
class RimFishbonesCollection;
25+
class RimWellPath;
26+
class QAction;
27+
class QMenu;
28+
class QString;
29+
30+
//==================================================================================================
31+
/// Helper class for common fishbones creation functionality
32+
//==================================================================================================
33+
class RicFishbonesCreateHelper
34+
{
35+
public:
36+
static RimFishbones* createAndConfigureFishbones( RimFishbonesCollection* fishbonesCollection,
37+
const RimFishbonesDefines::RicFishbonesSystemParameters& customParameters,
38+
double measuredDepth );
39+
40+
static void setupFishbonesSubMenu( QAction* actionToSetup, const QString& actionText );
41+
42+
private:
43+
static void finalizeFishbonesCreation( RimFishbones* fishbones, RimFishbonesCollection* fishbonesCollection );
44+
};

ApplicationLibCode/Commands/CompletionCommands/RicNewFishbonesSubsAtMeasuredDepthFeature.cpp

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818

1919
#include "RicNewFishbonesSubsAtMeasuredDepthFeature.h"
2020

21+
#include "RiaLogging.h"
22+
23+
#include "RicFishbonesCreateHelper.h"
2124
#include "RicNewFishbonesSubsFeature.h"
2225
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
2326

@@ -48,30 +51,20 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::onActionTriggered( bool isChecke
4851
//--------------------------------------------------------------------------------------------------
4952
void RicNewFishbonesSubsAtMeasuredDepthFeature::setupActionLook( QAction* actionToSetup )
5053
{
51-
auto icon = QIcon( ":/FishBoneGroup16x16.png" );
52-
actionToSetup->setIcon( icon );
53-
actionToSetup->setText( "Create Fishbones at this Depth" );
54-
55-
auto subMenu = new QMenu;
54+
RicFishbonesCreateHelper::setupFishbonesSubMenu( actionToSetup, "Create Fishbones at this Depth" );
5655

57-
{
58-
auto action = subMenu->addAction( "Drilling Standard" );
59-
action->setIcon( icon );
60-
connect( action, &QAction::triggered, this, &RicNewFishbonesSubsAtMeasuredDepthFeature::onDrillingStandard );
61-
}
56+
QMenu* subMenu = actionToSetup->menu();
57+
auto actions = subMenu->actions();
6258

59+
if ( actions.size() < 3 )
6360
{
64-
auto action = subMenu->addAction( "Drilling Extended" );
65-
action->setIcon( icon );
66-
connect( action, &QAction::triggered, this, &RicNewFishbonesSubsAtMeasuredDepthFeature::onDrillingExtended );
67-
}
68-
{
69-
auto action = subMenu->addAction( "Acid Jetting" );
70-
action->setIcon( icon );
71-
connect( action, &QAction::triggered, this, &RicNewFishbonesSubsAtMeasuredDepthFeature::onAcidJetting );
61+
RiaLogging::error( "RicNewFishbonesSubsAtMeasuredDepthFeature::setupActionLook: Unexpected number of actions in submenu." );
62+
return;
7263
}
7364

74-
actionToSetup->setMenu( subMenu );
65+
connect( actions[0], &QAction::triggered, this, &RicNewFishbonesSubsAtMeasuredDepthFeature::onDrillingStandard );
66+
connect( actions[1], &QAction::triggered, this, &RicNewFishbonesSubsAtMeasuredDepthFeature::onDrillingExtended );
67+
connect( actions[2], &QAction::triggered, this, &RicNewFishbonesSubsAtMeasuredDepthFeature::onAcidJetting );
7568
}
7669

7770
//--------------------------------------------------------------------------------------------------
@@ -93,26 +86,7 @@ void RicNewFishbonesSubsAtMeasuredDepthFeature::createFishbones( const RimFishbo
9386
RimWellPath* wellPath = wellPathSelItem->m_wellpath;
9487
CVF_ASSERT( wellPath );
9588

96-
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
97-
98-
auto* obj = new RimFishbones;
99-
wellPath->fishbonesCollection()->appendFishbonesSubs( obj );
100-
101-
obj->setSystemParameters( customParameters.lateralsPerSub,
102-
customParameters.lateralLength,
103-
customParameters.holeDiameter,
104-
customParameters.buildAngle,
105-
customParameters.icdsPerSub );
106-
107-
obj->setMeasuredDepthAndCount( wellPathSelItem->m_measuredDepth, 12.5, 13 );
108-
109-
RicNewFishbonesSubsFeature::adjustWellPathScaling( wellPath->fishbonesCollection() );
110-
111-
wellPath->updateConnectedEditors();
112-
Riu3DMainWindowTools::selectAsCurrentItem( obj );
113-
114-
RimProject* proj = RimProject::current();
115-
proj->reloadCompletionTypeResultsInAllViews();
89+
RicFishbonesCreateHelper::createAndConfigureFishbones( wellPath->fishbonesCollection(), customParameters, wellPathSelItem->m_measuredDepth );
11690
}
11791

11892
//--------------------------------------------------------------------------------------------------

ApplicationLibCode/Commands/CompletionCommands/RicNewFishbonesSubsFeature.cpp

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "RicNewFishbonesSubsFeature.h"
2020

21+
#include "RicFishbonesCreateHelper.h"
2122
#include "WellPathCommands/RicWellPathsUnitSystemSettingsImpl.h"
2223

2324
#include "RiaApplication.h"
@@ -87,38 +88,17 @@ void RicNewFishbonesSubsFeature::createFishbones( const RimFishbonesDefines::Ric
8788
CVF_ASSERT( fishbonesCollection );
8889

8990
RimWellPath* wellPath = fishbonesCollection->firstAncestorOrThisOfTypeAsserted<RimWellPath>();
90-
if ( !RicWellPathsUnitSystemSettingsImpl::ensureHasUnitSystem( wellPath ) ) return;
91-
92-
auto* obj = new RimFishbones;
93-
fishbonesCollection->appendFishbonesSubs( obj );
94-
95-
obj->setSystemParameters( customParameters.lateralsPerSub,
96-
customParameters.lateralLength,
97-
customParameters.holeDiameter,
98-
customParameters.buildAngle,
99-
customParameters.icdsPerSub );
10091

92+
double measuredDepth = 100;
10193
double wellPathTipMd = wellPath->uniqueEndMD();
10294
if ( wellPathTipMd != HUGE_VAL )
10395
{
10496
double startMd = wellPathTipMd - 150 - 100;
10597
if ( startMd < 100 ) startMd = 100;
106-
107-
obj->setMeasuredDepthAndCount( startMd, 12.5, 13 );
108-
}
109-
110-
RicNewFishbonesSubsFeature::adjustWellPathScaling( fishbonesCollection );
111-
112-
RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection();
113-
if ( wellPathCollection )
114-
{
115-
wellPathCollection->uiCapability()->updateConnectedEditors();
98+
measuredDepth = startMd;
11699
}
117100

118-
RiuMainWindow::instance()->selectAsCurrentItem( obj );
119-
120-
RimProject* proj = RimProject::current();
121-
proj->reloadCompletionTypeResultsInAllViews();
101+
RicFishbonesCreateHelper::createAndConfigureFishbones( fishbonesCollection, customParameters, measuredDepth );
122102
}
123103

124104
//--------------------------------------------------------------------------------------------------
@@ -161,30 +141,19 @@ RimFishbonesCollection* RicNewFishbonesSubsFeature::selectedFishbonesCollection(
161141
//--------------------------------------------------------------------------------------------------
162142
void RicNewFishbonesSubsFeature::setupActionLook( QAction* actionToSetup )
163143
{
164-
auto icon = QIcon( ":/FishBoneGroup16x16.png" );
165-
actionToSetup->setIcon( icon );
166-
actionToSetup->setText( "Create Fishbones" );
167-
168-
auto subMenu = new QMenu;
144+
RicFishbonesCreateHelper::setupFishbonesSubMenu( actionToSetup, "Create Fishbones" );
169145

146+
QMenu* subMenu = actionToSetup->menu();
147+
auto actions = subMenu->actions();
148+
if ( actions.size() < 3 )
170149
{
171-
auto action = subMenu->addAction( "Drilling Standard" );
172-
action->setIcon( icon );
173-
connect( action, &QAction::triggered, this, &RicNewFishbonesSubsFeature::onDrillingStandard );
174-
}
175-
176-
{
177-
auto action = subMenu->addAction( "Drilling Extended" );
178-
action->setIcon( icon );
179-
connect( action, &QAction::triggered, this, &RicNewFishbonesSubsFeature::onDrillingExtended );
180-
}
181-
{
182-
auto action = subMenu->addAction( "Acid Jetting" );
183-
action->setIcon( icon );
184-
connect( action, &QAction::triggered, this, &RicNewFishbonesSubsFeature::onAcidJetting );
150+
RiaLogging::error( "RicNewFishbonesSubsAtMeasuredDepthFeature::setupActionLook: Unexpected number of actions in submenu." );
151+
return;
185152
}
186153

187-
actionToSetup->setMenu( subMenu );
154+
connect( actions[0], &QAction::triggered, this, &RicNewFishbonesSubsFeature::onDrillingStandard );
155+
connect( actions[1], &QAction::triggered, this, &RicNewFishbonesSubsFeature::onDrillingExtended );
156+
connect( actions[2], &QAction::triggered, this, &RicNewFishbonesSubsFeature::onAcidJetting );
188157
}
189158

190159
//--------------------------------------------------------------------------------------------------

ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesDefines.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,21 @@ void caf::AppEnum<RimFishbonesDefines::ValueSource>::setUp()
6464
//--------------------------------------------------------------------------------------------------
6565
RimFishbonesDefines::RicFishbonesSystemParameters RimFishbonesDefines::drillingStandardParameters()
6666
{
67-
return { .lateralsPerSub = 3, .lateralLength = 11.0, .holeDiameter = 12.5, .buildAngle = 6.0, .icdsPerSub = 3 };
67+
return { .lateralsPerSub = 3, .lateralLength = 11.0, .holeDiameter = 12.5, .buildAngle = 6.0, .icdsPerSub = 3, .spacing = 12.5 };
6868
}
6969

7070
//--------------------------------------------------------------------------------------------------
7171
///
7272
//--------------------------------------------------------------------------------------------------
7373
RimFishbonesDefines::RicFishbonesSystemParameters RimFishbonesDefines::drillingExtendedParameters()
7474
{
75-
return { .lateralsPerSub = 3, .lateralLength = 18.0, .holeDiameter = 12.5, .buildAngle = 4.0, .icdsPerSub = 3 };
75+
return { .lateralsPerSub = 3, .lateralLength = 18.0, .holeDiameter = 12.5, .buildAngle = 4.0, .icdsPerSub = 3, .spacing = 18.5 };
7676
}
7777

7878
//--------------------------------------------------------------------------------------------------
7979
///
8080
//--------------------------------------------------------------------------------------------------
8181
RimFishbonesDefines::RicFishbonesSystemParameters RimFishbonesDefines::acidJettingParameters()
8282
{
83-
return { .lateralsPerSub = 4, .lateralLength = 12.0, .holeDiameter = 15.0, .buildAngle = 6.0, .icdsPerSub = 4 };
83+
return { .lateralsPerSub = 4, .lateralLength = 12.0, .holeDiameter = 15.0, .buildAngle = 6.0, .icdsPerSub = 4, .spacing = 12.5 };
8484
}

ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesDefines.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct RicFishbonesSystemParameters
5454
double holeDiameter;
5555
double buildAngle;
5656
int icdsPerSub;
57+
double spacing;
5758
};
5859

5960
RicFishbonesSystemParameters drillingStandardParameters();

0 commit comments

Comments
 (0)