Move Reference Well functionality to WellLogExtractionCurve

* Remove reference well feature from plot objects
* Move Reference Well functionality to WellLogExtractionCurve
* Reset reference well selection if new selected well path equals ref
This commit is contained in:
Jørgen Herje 2023-01-23 15:07:48 +01:00 committed by GitHub
parent f48eca9ef5
commit 632107e77c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 30 additions and 135 deletions

View File

@ -628,9 +628,8 @@ std::map<QString, QString> RimDepthTrackPlot::createNameKeyValueMap() const
{
std::map<QString, QString> variableValueMap;
RimCase* commonCase = m_commonDataSource->caseToApply();
RimWellPath* commonWellPath = m_commonDataSource->wellPathToApply();
RimWellPath* commonRefWellPath = m_commonDataSource->referenceWellPathToApply();
RimCase* commonCase = m_commonDataSource->caseToApply();
RimWellPath* commonWellPath = m_commonDataSource->wellPathToApply();
if ( commonCase )
{
@ -676,11 +675,6 @@ std::map<QString, QString> RimDepthTrackPlot::createNameKeyValueMap() const
variableValueMap[RiaDefines::namingVariableWell()] = m_commonDataSource->simWellNameToApply();
}
if ( commonRefWellPath && !commonRefWellPath->name().isEmpty() )
{
variableValueMap[RiaDefines::namingVariableRefWell()] = QString( "Ref. Well: %1" ).arg( commonRefWellPath->name() );
}
if ( commonWellPath )
{
RigWellPath* wellPathGeometry = commonWellPath->wellPathGeometry();
@ -1275,7 +1269,6 @@ void RimDepthTrackPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::onLoadDataAndUpdate()
{
updateReferenceWellPathInCurves();
updateMdiWindowVisibility();
performAutoNameUpdate();
updatePlots();
@ -1307,21 +1300,6 @@ caf::PdmFieldHandle* RimDepthTrackPlot::userDescriptionField()
return &m_plotWindowTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimDepthTrackPlot::updateReferenceWellPathInCurves()
{
for ( auto plot : this->plots() )
{
auto wellLogTrack = dynamic_cast<RimWellLogTrack*>( plot );
for ( auto curve : wellLogTrack->curves() )
{
curve->setReferenceWellPath( m_commonDataSource->referenceWellPathToApply() );
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -197,8 +197,6 @@ protected:
void updatePlots();
caf::PdmFieldHandle* userDescriptionField() override;
void updateReferenceWellPathInCurves();
private:
void cleanupBeforeClose();
void updateSubPlotNames();

View File

@ -27,11 +27,9 @@
#include "RimGeoMechCase.h"
#include "RimTools.h"
#include "RimWbsParameters.h"
#include "RimWellLogCurve.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogFile.h"
#include "RimWellLogPlotNameConfig.h"
#include "RimWellLogTrack.h"
#include "cafPdmBase.h"
#include "cafPdmFieldScriptingCapability.h"
@ -50,7 +48,7 @@ RimWellBoreStabilityPlot::RimWellBoreStabilityPlot()
CAF_PDM_InitScriptableObject( "Well Bore Stability Plot",
":/WellBoreStability16x16.png",
"",
"A GeoMechanical Well Bore Stabilit Plot" );
"A GeoMechanical Well Bore Stability Plot" );
CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_wbsParameters,
"WbsParameters",
@ -221,6 +219,5 @@ void RimWellBoreStabilityPlot::applyDataSource()
m_wbsParameters->setTimeStep( m_commonDataSource->timeStepToApply() );
m_wbsParameters->setFrameIndex( -1 );
this->updateReferenceWellPathInCurves();
this->updateConnectedEditors();
}

View File

@ -57,15 +57,6 @@ RimWellLogCurve::RimWellLogCurve()
m_curveDataPropertyValueRange =
std::make_pair( std::numeric_limits<double>::infinity(), -std::numeric_limits<double>::infinity() );
// Ref well path as Ui element for debug purpose. If not needed: Remove use of caf::PdmPtrField,
// and replace with regular non-ui ptr. The remove related code in calculateValueOptions() and
// defineUiOrdering().
CAF_PDM_InitFieldNoDefault( &m_refWellPath, "ReferenceWellPath", "Reference Well Path" );
m_refWellPath.uiCapability()->setUiHidden( !RiaApplication::enableDevelopmentFeatures() );
m_refWellPath.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitField( &m_useRefWell, "UseReferenceWellPath", true, "Use Reference Well Path" );
setDeletable( true );
}
@ -234,24 +225,6 @@ const RigWellLogCurveData* RimWellLogCurve::curveData() const
return m_curveData.p();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::setReferenceWellPath( RimWellPath* refWellPath )
{
m_refWellPath = refWellPath;
if ( m_refWellPath == nullptr )
{
m_useRefWell.uiCapability()->setUiHidden( true );
m_useRefWell = true;
}
else
{
m_useRefWell.uiCapability()->setUiHidden( false );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -439,37 +412,6 @@ void RimWellLogCurve::calculateCurveDataPropertyValueRange()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellLogCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions )
{
auto options = RimStackablePlotCurve::calculateValueOptions( fieldNeedingOptions );
if ( fieldNeedingOptions == &m_refWellPath )
{
options.push_back( caf::PdmOptionItemInfo( QString( "None" ), nullptr ) );
RimTools::wellPathOptionItems( &options );
}
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
RimStackablePlotCurve::defineUiOrdering( uiConfigName, uiOrdering );
auto group = uiOrdering.findGroup( "DataSource" );
if ( group != nullptr )
{
group->add( &m_refWellPath );
group->add( &m_useRefWell );
}
uiOrdering.skipRemainingFields( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -491,12 +433,6 @@ void RimWellLogCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
{
loadDataAndUpdate( true );
}
if ( changedField == &m_useRefWell )
{
loadDataAndUpdate( true );
updateConnectedEditors();
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -49,7 +49,6 @@ public:
const RigWellLogCurveData* curveData() const;
void setReferenceWellPath( RimWellPath* refWellPath );
void updateCurveAppearance() override;
virtual QString wellName() const = 0;
@ -67,13 +66,11 @@ public:
double closestYValueForX( double xValue ) const override;
protected:
void updateZoomInParentPlot() override;
void updateLegendsInPlot() override;
void setOverrideCurveDataPropertyValueRange( double minimumValue, double maximumValue );
void calculateCurveDataPropertyValueRange();
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
void updateZoomInParentPlot() override;
void updateLegendsInPlot() override;
void setOverrideCurveDataPropertyValueRange( double minimumValue, double maximumValue );
void calculateCurveDataPropertyValueRange();
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
void setPropertyValuesAndDepths( const std::vector<double>& propertyValues,
@ -113,10 +110,6 @@ protected:
RiuPlotAxis depthAxis() const;
RiuPlotAxis valueAxis() const;
protected:
caf::PdmPtrField<RimWellPath*> m_refWellPath;
caf::PdmField<bool> m_useRefWell;
private:
cvf::ref<RigWellLogCurveData> m_curveData;
std::pair<double, double> m_curveDataPropertyValueRange;

View File

@ -83,7 +83,6 @@ RimWellLogCurveCommonDataSource::RimWellLogCurveCommonDataSource()
CAF_PDM_InitFieldNoDefault( &m_trajectoryType, "TrajectoryType", "Trajectory Type" );
CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Path" );
CAF_PDM_InitFieldNoDefault( &m_refWellPath, "CurveReferenceWellPath", "Reference Well Path" );
CAF_PDM_InitFieldNoDefault( &m_simWellName, "SimulationWellName", "Well Name" );
CAF_PDM_InitFieldNoDefault( &m_branchDetection,
@ -112,9 +111,8 @@ RimWellLogCurveCommonDataSource::RimWellLogCurveCommonDataSource()
CAF_PDM_InitFieldNoDefault( &m_rftSegmentBranchIndex, "SegmentBranchIndex", "RFT Branch" );
CAF_PDM_InitFieldNoDefault( &m_rftSegmentBranchType, "SegmentBranchType", "RFT Completion" );
m_case = nullptr;
m_wellPath = nullptr;
m_refWellPath = nullptr;
m_case = nullptr;
m_wellPath = nullptr;
}
//--------------------------------------------------------------------------------------------------
@ -189,14 +187,6 @@ void RimWellLogCurveCommonDataSource::setWellPathToApply( RimWellPath* val )
m_wellPath = val;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RimWellLogCurveCommonDataSource::referenceWellPathToApply() const
{
return m_refWellPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -848,10 +838,6 @@ void RimWellLogCurveCommonDataSource::fieldChangedByUi( const caf::PdmFieldHandl
RimWellLogPlot* parentPlot = nullptr;
this->firstAncestorOrThisOfType( parentPlot );
if ( changedField == &m_wellPath && m_wellPath() == m_refWellPath() )
{
m_refWellPath = nullptr;
}
if ( changedField == &m_branchDetection && m_branchDetection().isPartiallyTrue() )
{
// The Tristate is cycled from false -> partially true -> true
@ -944,11 +930,6 @@ QList<caf::PdmOptionItemInfo>
}
}
}
else if ( fieldNeedingOptions == &m_refWellPath )
{
options.push_back( caf::PdmOptionItemInfo( QString( "None" ), nullptr ) );
RimTools::wellPathOptionItemsSubset( { m_wellPath() }, &options );
}
else if ( fieldNeedingOptions == &m_timeStep )
{
if ( m_case() )
@ -1053,7 +1034,6 @@ void RimWellLogCurveCommonDataSource::defineUiOrdering( QString uiConfigName, ca
if ( trajectoryTypeToApply() == RimWellLogExtractionCurve::WELL_PATH )
{
group->add( &m_wellPath );
group->add( &m_refWellPath );
}
else if ( trajectoryTypeToApply() == RimWellLogExtractionCurve::SIMULATION_WELL )
{
@ -1080,7 +1060,6 @@ void RimWellLogCurveCommonDataSource::defineUiOrdering( QString uiConfigName, ca
else
{
if ( m_wellPath() ) group->add( &m_wellPath );
group->add( &m_refWellPath );
}
if ( uiConfigName == smoothingUiOrderinglabel() )
@ -1108,8 +1087,8 @@ void RimWellLogCurveCommonDataSource::defineEditorAttribute( const caf::PdmField
if ( myAttr )
{
if ( field == &m_case || field == &m_summaryCase || field == &m_simWellName || field == &m_wellPath ||
field == &m_refWellPath || field == &m_timeStep || field == &m_rftTimeStep ||
field == &m_rftSegmentBranchIndex || field == &m_rftWellName )
field == &m_timeStep || field == &m_rftTimeStep || field == &m_rftSegmentBranchIndex ||
field == &m_rftWellName )
{
myAttr->showPreviousAndNextButtons = true;
myAttr->nextIcon = QIcon( ":/ComboBoxDown.svg" );

View File

@ -67,7 +67,6 @@ public:
void setTrajectoryTypeToApply( int val );
RimWellPath* wellPathToApply() const;
void setWellPathToApply( RimWellPath* val );
RimWellPath* referenceWellPathToApply() const;
int branchIndexToApply() const;
void setBranchIndexToApply( int val );
caf::Tristate branchDetectionToApply() const;
@ -123,7 +122,6 @@ private:
caf::PdmPtrField<RimSummaryCase*> m_summaryCase;
caf::PdmField<int> m_trajectoryType;
caf::PdmPtrField<RimWellPath*> m_wellPath;
caf::PdmPtrField<RimWellPath*> m_refWellPath;
caf::PdmField<QString> m_simWellName;
caf::PdmField<bool> m_allow3DSelectionLink;
caf::PdmField<int> m_branchIndex;

View File

@ -101,6 +101,8 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve()
CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Name" );
m_wellPath.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitFieldNoDefault( &m_refWellPath, "ReferenceWellPath", "Reference Well Path" );
CAF_PDM_InitField( &m_simWellName, "SimulationWellName", QString( "" ), "Well Name" );
CAF_PDM_InitField( &m_branchDetection,
"BranchDetection",
@ -153,6 +155,7 @@ RimWellLogExtractionCurve::~RimWellLogExtractionCurve()
void RimWellLogExtractionCurve::setWellPath( RimWellPath* wellPath )
{
m_wellPath = wellPath;
if ( m_wellPath == m_refWellPath ) m_refWellPath = nullptr;
}
//--------------------------------------------------------------------------------------------------
@ -302,6 +305,11 @@ void RimWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* cha
this->loadDataAndUpdate( true );
}
else if ( changedField == &m_wellPath )
{
if ( m_wellPath == m_refWellPath ) m_refWellPath = nullptr;
this->loadDataAndUpdate( true );
}
else if ( changedField == &m_refWellPath )
{
this->loadDataAndUpdate( true );
}
@ -549,7 +557,7 @@ RimWellLogExtractionCurve::WellLogExtractionCurveData
}
// Reference well adjustment does not support simulated wells
if ( m_trajectoryType == WELL_PATH && wellExtractor.notNull() && refWellExtractor.notNull() && m_useRefWell )
if ( m_trajectoryType == WELL_PATH && wellExtractor.notNull() && refWellExtractor.notNull() )
{
RigEclipseResultAddress indexKResAdr( RiaDefines::ResultCatType::STATIC_NATIVE,
RiaResultNames::indexKResultName() );
@ -639,7 +647,7 @@ RimWellLogExtractionCurve::WellLogExtractionCurveData
const std::string fieldName = m_geomResultDefinition->resultAddress().fieldName;
const bool isNeglectedFieldName = fieldName == RiaResultNames::wbsAzimuthResult().toStdString() ||
fieldName == RiaResultNames::wbsInclinationResult().toStdString();
if ( !isNeglectedFieldName && wellExtractor.notNull() && refWellExtractor.notNull() && m_useRefWell )
if ( !isNeglectedFieldName && wellExtractor.notNull() && refWellExtractor.notNull() )
{
RigFemResultAddress indexKResAdr( RigFemResultPosEnum::RIG_ELEMENT_NODAL, "INDEX", "INDEX_K" );
@ -968,6 +976,11 @@ QList<caf::PdmOptionItemInfo>
{
RimTools::wellPathOptionItems( &options );
}
if ( fieldNeedingOptions == &m_refWellPath )
{
options.push_back( caf::PdmOptionItemInfo( QString( "None" ), nullptr ) );
RimTools::wellPathOptionItemsSubset( { m_wellPath() }, &options );
}
else if ( fieldNeedingOptions == &m_case )
{
RimTools::caseOptionItems( &options );
@ -1015,6 +1028,7 @@ void RimWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::Pdm
if ( m_trajectoryType() == WELL_PATH )
{
curveDataGroup->add( &m_wellPath );
curveDataGroup->add( &m_refWellPath );
RimWellLogCurve::defineUiOrdering( uiConfigName, uiOrdering );
}
else
@ -1031,6 +1045,7 @@ void RimWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::Pdm
else if ( geomCase )
{
curveDataGroup->add( &m_wellPath );
curveDataGroup->add( &m_refWellPath );
RimWellLogCurve::defineUiOrdering( uiConfigName, uiOrdering );
m_geomResultDefinition->uiOrdering( uiConfigName, *curveDataGroup );
@ -1171,7 +1186,7 @@ QString RimWellLogExtractionCurve::createCurveAutoName()
}
}
if ( m_useRefWell && m_refWellPath && !m_refWellPath->name().isEmpty() )
if ( m_refWellPath() != nullptr && !m_refWellPath->name().isEmpty() )
{
generatedCurveName.push_back( QString( "Ref. Well: %1" ).arg( m_refWellPath->name() ) );
}

View File

@ -125,6 +125,7 @@ protected:
caf::PdmPtrField<RimCase*> m_case;
caf::PdmField<caf::AppEnum<TrajectoryType>> m_trajectoryType;
caf::PdmPtrField<RimWellPath*> m_wellPath;
caf::PdmPtrField<RimWellPath*> m_refWellPath;
caf::PdmField<QString> m_simWellName;
caf::PdmField<int> m_branchIndex;
caf::PdmField<bool> m_branchDetection;