Skip to content

Commit f52676f

Browse files
committed
Work in progress
1 parent eebe856 commit f52676f

File tree

8 files changed

+109
-51
lines changed

8 files changed

+109
-51
lines changed

ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswTableData.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,23 +1570,28 @@ std::unique_ptr<RicMswBranch> RicWellPathExportMswTableData::createChildMswBranc
15701570
auto initialChildMD = childWellPath->wellPathTieIn()->tieInMeasuredDepth();
15711571
auto initialChildTVD = -childWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( initialChildMD ).z();
15721572

1573+
auto valveMD = childWellPath->wellPathTieIn()->branchValveMeasuredDepth();
1574+
auto valveTVD = -childWellPath->wellPathGeometry()->interpolatedPointAlongWellPath( valveMD ).z();
1575+
1576+
double offset = ( valveMD == initialChildMD ) ? internal::VALVE_SEGMENT_LENGTH : 0.0;
1577+
15731578
const RimWellPathValve* outletValve = childWellPath->wellPathTieIn()->outletValve();
15741579
if ( outletValve )
15751580
{
15761581
auto branchStartingWithValve =
15771582
RicMswValve::createTieInValve( QString( "%1 valve for %2" ).arg( outletValve->componentLabel() ).arg( childWellPath->name() ),
15781583
childWellPath,
1579-
initialChildMD,
1580-
initialChildTVD,
1584+
valveMD,
1585+
valveTVD,
15811586
outletValve );
15821587
if ( branchStartingWithValve )
15831588
{
1584-
const auto segmentEndMd = initialChildMD + internal::VALVE_SEGMENT_LENGTH;
1589+
const auto segmentEndMd = initialChildMD + offset;
15851590
auto dummySegment =
15861591
std::make_unique<RicMswSegment>( QString( "%1 segment" ).arg( outletValve->componentLabel() ),
1587-
initialChildMD,
1592+
valveMD,
15881593
segmentEndMd,
1589-
initialChildTVD,
1594+
valveTVD,
15901595
RicMswTableFormatterTools::tvdFromMeasuredDepth( childWellPath, segmentEndMd ) );
15911596
branchStartingWithValve->addSegment( std::move( dummySegment ) );
15921597

ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include "RimWellPathFractureCollection.h"
5656
#include "RimWellPathGeometryDef.h"
5757
#include "RimWellPathTarget.h"
58+
#include "RimWellPathTieIn.h"
5859
#include "RimWellPathValve.h"
5960

6061
#include "Riv3dWellLogPlanePartMgr.h"
@@ -69,7 +70,6 @@
6970
#include "RivTextLabelSourceInfo.h"
7071
#include "RivWellConnectionFactorPartMgr.h"
7172
#include "RivWellFracturePartMgr.h"
72-
#include "RivWellPathPartMgr.h"
7373
#include "RivWellPathSourceInfo.h"
7474

7575
#include "RiuViewer.h"
@@ -469,20 +469,21 @@ void RivWellPathPartMgr::appendPerforationsToModel( cvf::ModelBasicList*
469469
}
470470
}
471471

472-
appendPerforationValvesToModel( model, perforation, wellPathRadius, displayCoordTransform );
472+
appendValvesToModel( model, perforation->valves(), wellPathRadius, displayCoordTransform );
473473
}
474474
}
475475

476476
//--------------------------------------------------------------------------------------------------
477477
///
478478
//--------------------------------------------------------------------------------------------------
479-
void RivWellPathPartMgr::appendPerforationValvesToModel( cvf::ModelBasicList* model,
480-
RimPerforationInterval* perforation,
481-
double wellPathRadius,
482-
const caf::DisplayCoordTransform* displayCoordTransform )
479+
void RivWellPathPartMgr::appendValvesToModel( cvf::ModelBasicList* model,
480+
const std::vector<RimWellPathValve*>& valves,
481+
double wellPathRadius,
482+
const caf::DisplayCoordTransform* displayCoordTransform )
483483
{
484-
for ( RimWellPathValve* valve : perforation->valves() )
484+
for ( auto valve : valves )
485485
{
486+
if ( valve == nullptr ) continue;
486487
if ( !valve->isChecked() ) continue;
487488

488489
std::vector<double> measuredDepthsRelativeToStartMD;
@@ -512,7 +513,7 @@ void RivWellPathPartMgr::appendPerforationValvesToModel( cvf::ModelBasicList*
512513

513514
cvf::Collection<cvf::Part> parts;
514515
RivPipeGeometryGenerator::tubeWithCenterLinePartsAndVariableWidth( &parts, displayCoords, radii, valveColor );
515-
for ( auto part : parts )
516+
for ( auto& part : parts )
516517
{
517518
part->setSourceInfo( objectSourceInfo.p() );
518519
model->addPart( part.p() );
@@ -1029,6 +1030,14 @@ void RivWellPathPartMgr::appendStaticGeometryPartsToModel( cvf::ModelBasicList*
10291030
appendWellPathAttributesToModel( model, displayCoordTransform, characteristicCellSize );
10301031
appendWellIntegrityIntervalsToModel( model, displayCoordTransform, characteristicCellSize );
10311032

1033+
if ( auto tieIn = m_rimWellPath->wellPathTieIn() )
1034+
{
1035+
if ( auto valve = tieIn->outletValve() )
1036+
{
1037+
appendValvesToModel( model, { valve }, wellPathRadius( characteristicCellSize, wellPathCollection() ), displayCoordTransform );
1038+
}
1039+
}
1040+
10321041
RimGridView* gridView = dynamic_cast<RimGridView*>( m_rimView.p() );
10331042
if ( gridView )
10341043
{

ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class Rim3dView;
4949
class Riv3dWellLogPlanePartMgr;
5050
class RivWellConnectionFactorPartMgr;
5151
class RimWellMeasurementInView;
52+
class RimWellPathValve;
5253

5354
class QDateTime;
5455

@@ -104,10 +105,10 @@ class RivWellPathPartMgr : public cvf::Object
104105
double characteristicCellSize,
105106
bool doFlatten );
106107

107-
void appendPerforationValvesToModel( cvf::ModelBasicList* model,
108-
RimPerforationInterval* perforation,
109-
double wellPathRadius,
110-
const caf::DisplayCoordTransform* displayCoordTransform );
108+
void appendValvesToModel( cvf::ModelBasicList* model,
109+
const std::vector<RimWellPathValve*>& valves,
110+
double wellPathRadius,
111+
const caf::DisplayCoordTransform* displayCoordTransform );
111112

112113
void appendMswSegmentsToModel( cvf::ModelBasicList* model,
113114
const caf::DisplayCoordTransform* displayCoordTransform,

ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ RimWellPathValve::RimWellPathValve()
5151
CAF_PDM_InitFieldNoDefault( &m_valveTemplate, "ValveTemplate", "Valve Template" );
5252
CAF_PDM_InitScriptableField( &m_measuredDepth, "StartMeasuredDepth", 0.0, "Start MD" );
5353
CAF_PDM_InitFieldNoDefault( &m_multipleValveLocations, "ValveLocations", "Valve Locations" );
54-
CAF_PDM_InitField( &m_editValveTemplate, "EditTemplate", false, "Edit" );
55-
CAF_PDM_InitField( &m_createValveTemplate, "CreateTemplate", false, "Create" );
54+
// CAF_PDM_InitField( &m_editValveTemplate, "EditTemplate", false, "Edit" );
55+
// CAF_PDM_InitField( &m_createValveTemplate, "CreateTemplate", false, "Create" );
5656

5757
m_measuredDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
5858
m_multipleValveLocations = new RimMultipleValveLocations;
5959
m_multipleValveLocations.uiCapability()->setUiTreeChildrenHidden( true );
60-
m_editValveTemplate.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosition::HIDDEN );
61-
m_editValveTemplate.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() );
62-
m_createValveTemplate.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosition::HIDDEN );
63-
m_createValveTemplate.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() );
60+
// m_editValveTemplate.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosition::HIDDEN );
61+
// m_editValveTemplate.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() );
62+
// m_createValveTemplate.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosition::HIDDEN );
63+
// m_createValveTemplate.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() );
6464

6565
nameField()->uiCapability()->setUiReadOnly( true );
6666

@@ -523,15 +523,6 @@ void RimWellPathValve::fieldChangedByUi( const caf::PdmFieldHandle* changedField
523523
applyValveLabelAndIcon();
524524
updateConnectedEditors();
525525
}
526-
else if ( changedField == &m_createValveTemplate )
527-
{
528-
m_createValveTemplate = false;
529-
RicNewValveTemplateFeature::createNewValveTemplateForValveAndUpdate( this );
530-
}
531-
else if ( changedField == &m_editValveTemplate )
532-
{
533-
Riu3DMainWindowTools::selectAsCurrentItem( m_valveTemplate() );
534-
}
535526

536527
auto perfInterval = firstAncestorOrThisOfType<RimPerforationInterval>();
537528
if ( perfInterval )
@@ -550,14 +541,14 @@ void RimWellPathValve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
550541
{
551542
uiOrdering.skipRemainingFields( true );
552543

553-
uiOrdering.add( &m_valveTemplate, { .totalColumnSpan = 2, .leftLabelColumnSpan = 1 } );
544+
uiOrdering.add( &m_valveTemplate );
554545

555546
{
556547
if ( m_valveTemplate() != nullptr )
557548
{
558-
uiOrdering.appendToRow( &m_editValveTemplate );
549+
uiOrdering.addNewButton( "Edit Template", [this]() { Riu3DMainWindowTools::selectAsCurrentItem( m_valveTemplate() ); } );
559550
}
560-
uiOrdering.appendToRow( &m_createValveTemplate );
551+
uiOrdering.addNewButton( "Create Template", [this]() { RicNewValveTemplateFeature::createNewValveTemplateForValveAndUpdate( this ); } );
561552
}
562553

563554
if ( uiConfigName != "TemplateOnly" )

ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ class RimWellPathValve : public RimCheckableNamedObject, public RimWellPathCompo
9191
caf::PdmPtrField<RimValveTemplate*> m_valveTemplate;
9292
caf::PdmField<double> m_measuredDepth;
9393
caf::PdmChildField<RimMultipleValveLocations*> m_multipleValveLocations;
94-
caf::PdmField<bool> m_editValveTemplate;
95-
caf::PdmField<bool> m_createValveTemplate;
94+
// caf::PdmField<bool> m_editValveTemplate;
95+
// caf::PdmField<bool> m_createValveTemplate;
9696

9797
std::set<RiaDefines::WellPathComponentType> m_componentTypeFilter;
9898
};

ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
#include "RiuMainWindow.h"
6161

6262
#include "cafPdmFieldScriptingCapability.h"
63+
#include "cafPdmObjectScriptingCapability.h"
6364
#include "cafPdmUiTreeAttributes.h"
6465
#include "cafPdmUiTreeOrdering.h"
6566
#include "cafPdmUiTreeViewEditor.h"
@@ -147,7 +148,7 @@ RimWellPath::RimWellPath()
147148
m_wellPathAttributes = new RimWellPathAttributeCollection;
148149
m_wellPathAttributes->uiCapability()->setUiTreeHidden( true );
149150

150-
CAF_PDM_InitFieldNoDefault( &m_wellPathTieIn, "WellPathTieIn", "well Path Tie-In" );
151+
CAF_PDM_InitScriptableFieldNoDefault( &m_wellPathTieIn, "WellPathTieIn", "Well Path Tie-In" );
151152
m_wellPathTieIn = new RimWellPathTieIn;
152153
m_wellPathTieIn->connectWellPaths( nullptr, this, 0.0 );
153154

ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.cpp

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#include "RiuMainWindow.h"
3232

33+
#include "cafPdmFieldScriptingCapability.h"
34+
#include "cafPdmObjectScriptingCapability.h"
3335
#include "cafPdmUiDoubleSliderEditor.h"
3436
#include "cafPdmUiLabelEditor.h"
3537

@@ -40,7 +42,12 @@ CAF_PDM_SOURCE_INIT( RimWellPathTieIn, "RimWellPathTieIn" );
4042
//--------------------------------------------------------------------------------------------------
4143
RimWellPathTieIn::RimWellPathTieIn()
4244
{
43-
CAF_PDM_InitObject( "Well Path Tie In", ":/NotDefined.png", "", "Well Path Tie In description" );
45+
CAF_PDM_InitScriptableObjectWithNameAndComment( "Well Path Tie In",
46+
":/NotDefined.png",
47+
"",
48+
"Well Path Tie In description",
49+
"WellPathTimeIn",
50+
"A ResInsight Well Tie-in" );
4451

4552
CAF_PDM_InitFieldNoDefault( &m_infoLabel, "InfoLabel", "Use right-click menu of well to set parent well." );
4653
m_infoLabel.uiCapability()->setUiEditorTypeName( caf::PdmUiLabelEditor::uiEditorTypeName() );
@@ -51,12 +58,13 @@ RimWellPathTieIn::RimWellPathTieIn()
5158
m_parentWell.uiCapability()->setUiReadOnly( true );
5259

5360
CAF_PDM_InitFieldNoDefault( &m_childWell, "ChildWellPath", "ChildWellPath" );
54-
CAF_PDM_InitFieldNoDefault( &m_tieInMeasuredDepth, "TieInMeasuredDepth", "Tie In Measured Depth" );
61+
CAF_PDM_InitScriptableFieldNoDefault( &m_tieInMeasuredDepth, "TieInMeasuredDepth", "Tie In Measured Depth" );
5562
m_tieInMeasuredDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() );
5663

57-
CAF_PDM_InitField( &m_addValveAtConnection, "AddValveAtConnection", false, "Add Outlet Valve for Branches" );
64+
CAF_PDM_InitScriptableField( &m_addValveAtConnection, "AddValveAtConnection", false, "Add Outlet Valve for Branch" );
5865

59-
CAF_PDM_InitFieldNoDefault( &m_valve, "Valve", "Branch Outlet Valve" );
66+
CAF_PDM_InitScriptableFieldNoDefault( &m_valve, "Valve", "Branch Outlet Valve" );
67+
CAF_PDM_InitScriptableFieldNoDefault( &m_customTieInValveMD, "CustomTieInValveMeasuredDepth", "Outlet Valve Custom MD" );
6068

6169
m_valve = new RimWellPathValve;
6270
}
@@ -95,6 +103,34 @@ void RimWellPathTieIn::setTieInMeasuredDepth( double measuredDepth )
95103
m_tieInMeasuredDepth = measuredDepth;
96104
}
97105

106+
//--------------------------------------------------------------------------------------------------
107+
///
108+
//--------------------------------------------------------------------------------------------------
109+
double RimWellPathTieIn::branchValveMeasuredDepth() const
110+
{
111+
if ( m_customTieInValveMD().first )
112+
{
113+
return m_customTieInValveMD().second;
114+
}
115+
return m_tieInMeasuredDepth();
116+
}
117+
118+
//--------------------------------------------------------------------------------------------------
119+
///
120+
//--------------------------------------------------------------------------------------------------
121+
void RimWellPathTieIn::setBranchValveMeasuredDepth( double measuredDepth )
122+
{
123+
m_customTieInValveMD = std::make_pair( true, measuredDepth );
124+
}
125+
126+
//--------------------------------------------------------------------------------------------------
127+
///
128+
//--------------------------------------------------------------------------------------------------
129+
void RimWellPathTieIn::useDefaultBranchValveMeasuredDepth()
130+
{
131+
m_customTieInValveMD = std::make_pair( false, m_tieInMeasuredDepth() );
132+
}
133+
98134
//--------------------------------------------------------------------------------------------------
99135
///
100136
//--------------------------------------------------------------------------------------------------
@@ -157,9 +193,16 @@ void RimWellPathTieIn::updateFirstTargetFromParentWell()
157193
//--------------------------------------------------------------------------------------------------
158194
///
159195
//--------------------------------------------------------------------------------------------------
160-
const RimWellPathValve* RimWellPathTieIn::outletValve() const
196+
RimWellPathValve* RimWellPathTieIn::outletValve() const
161197
{
162-
return m_addValveAtConnection() && m_valve() && m_valve->valveTemplate() ? m_valve() : nullptr;
198+
auto retVal = m_addValveAtConnection() && m_valve() && m_valve->valveTemplate() ? m_valve() : nullptr;
199+
200+
if ( retVal != nullptr )
201+
{
202+
retVal->setMeasuredDepthAndCount( branchValveMeasuredDepth(), 0.0, 1 );
203+
}
204+
205+
return retVal;
163206
}
164207

165208
//--------------------------------------------------------------------------------------------------
@@ -183,7 +226,9 @@ void RimWellPathTieIn::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
183226

184227
if ( m_addValveAtConnection )
185228
{
186-
m_valve->uiOrdering( "TemplateOnly", *tieInGroup );
229+
auto valveGrp = tieInGroup->addNewGroup( "Valve Options" );
230+
valveGrp->add( &m_customTieInValveMD );
231+
m_valve->uiOrdering( "TemplateOnly", *valveGrp );
187232
}
188233
}
189234

ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,20 @@ class RimWellPathTieIn : public caf::PdmObject
3535

3636
void connectWellPaths( RimWellPath* parentWell, RimWellPath* childWell, double tieInMeasuredDepth );
3737
RimWellPath* parentWell() const;
38-
double tieInMeasuredDepth() const;
39-
void setTieInMeasuredDepth( double measuredDepth );
38+
39+
double tieInMeasuredDepth() const;
40+
void setTieInMeasuredDepth( double measuredDepth );
41+
42+
double branchValveMeasuredDepth() const;
43+
void setBranchValveMeasuredDepth( double measuredDepth );
44+
void useDefaultBranchValveMeasuredDepth();
4045

4146
RimWellPath* childWell() const;
4247
void updateChildWellGeometry();
4348

4449
void updateFirstTargetFromParentWell();
4550

46-
const RimWellPathValve* outletValve() const;
51+
RimWellPathValve* outletValve() const;
4752

4853
private:
4954
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
@@ -57,9 +62,10 @@ class RimWellPathTieIn : public caf::PdmObject
5762
private:
5863
caf::PdmField<QString> m_infoLabel;
5964

60-
caf::PdmPtrField<RimWellPath*> m_parentWell;
61-
caf::PdmPtrField<RimWellPath*> m_childWell;
62-
caf::PdmField<double> m_tieInMeasuredDepth;
65+
caf::PdmPtrField<RimWellPath*> m_parentWell;
66+
caf::PdmPtrField<RimWellPath*> m_childWell;
67+
caf::PdmField<double> m_tieInMeasuredDepth;
68+
caf::PdmField<std::pair<bool, double>> m_customTieInValveMD;
6369

6470
caf::PdmField<bool> m_addValveAtConnection;
6571
caf::PdmChildField<RimWellPathValve*> m_valve;

0 commit comments

Comments
 (0)