mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Change API for PdmObjectHandle and PdmFieldHandle
* Refactor interface to PdmObjectHandle and PdmFieldHandle Return objects instead of passing in structures as parameters * Add nodiscard to several functions * Remove redundant this-> * Rename to ptrReferencedObjectsByType
This commit is contained in:
@@ -398,8 +398,7 @@ std::vector<Rim3dView*> RimGeoMechCase::allSpecialViews() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
|
||||
{
|
||||
std::vector<PdmObjectHandle*> children;
|
||||
geoMechViews.children( &children );
|
||||
std::vector<PdmObjectHandle*> children = geoMechViews.children();
|
||||
|
||||
for ( auto child : children )
|
||||
uiTreeOrdering.add( child );
|
||||
|
||||
@@ -51,10 +51,7 @@ RimGeoMechCellColors::~RimGeoMechCellColors()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechCellColors::updateIconState()
|
||||
{
|
||||
Rim3dView* rimView = nullptr;
|
||||
this->firstAncestorOrThisOfType( rimView );
|
||||
CVF_ASSERT( rimView );
|
||||
|
||||
auto rimView = firstAncestorOrThisOfTypeAsserted<Rim3dView>();
|
||||
if ( rimView )
|
||||
{
|
||||
RimViewController* viewController = rimView->viewController();
|
||||
|
||||
@@ -568,9 +568,7 @@ std::vector<double> RimGeoMechContourMapProjection::gridCellValues( RigFemResult
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechCase* RimGeoMechContourMapProjection::geoMechCase() const
|
||||
{
|
||||
RimGeoMechCase* geoMechCase = nullptr;
|
||||
firstAncestorOrThisOfType( geoMechCase );
|
||||
return geoMechCase;
|
||||
return firstAncestorOrThisOfType<RimGeoMechCase>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -578,9 +576,7 @@ RimGeoMechCase* RimGeoMechContourMapProjection::geoMechCase() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechContourMapView* RimGeoMechContourMapProjection::view() const
|
||||
{
|
||||
RimGeoMechContourMapView* view = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( view );
|
||||
return view;
|
||||
return firstAncestorOrThisOfTypeAsserted<RimGeoMechContourMapView>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -104,8 +104,7 @@ QString RimGeoMechContourMapView::createAutoName() const
|
||||
|
||||
QStringList generatedAutoTags;
|
||||
|
||||
RimCase* ownerCase = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( ownerCase );
|
||||
auto ownerCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
|
||||
if ( nameConfig()->addCaseName() )
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ RimGeoMechContourMapViewCollection::~RimGeoMechContourMapViewCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGeoMechContourMapView*> RimGeoMechContourMapViewCollection::views()
|
||||
{
|
||||
return m_contourMapViews.children();
|
||||
return m_contourMapViews.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -52,7 +52,7 @@ RimGeoMechModels::~RimGeoMechModels()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGeoMechCase*> RimGeoMechModels::cases() const
|
||||
{
|
||||
return m_cases.children();
|
||||
return m_cases.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -72,8 +72,7 @@ void RimGeoMechPart::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
|
||||
if ( changedField == objectToggleField() )
|
||||
{
|
||||
RimGeoMechView* ownerView;
|
||||
firstAncestorOrThisOfType( ownerView );
|
||||
auto ownerView = firstAncestorOrThisOfType<RimGeoMechView>();
|
||||
if ( ownerView ) ownerView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ void RimGeoMechPartCollection::syncWithCase( RimGeoMechCase* geoCase )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGeoMechPart*> RimGeoMechPartCollection::parts() const
|
||||
{
|
||||
return m_parts.children();
|
||||
return m_parts.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -351,13 +351,10 @@ void RimGeoMechResultDefinition::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
}
|
||||
|
||||
// Get the possible property filter owner
|
||||
RimGeoMechPropertyFilter* propFilter = dynamic_cast<RimGeoMechPropertyFilter*>( this->parentField()->ownerObject() );
|
||||
RimGridView* view = nullptr;
|
||||
this->firstAncestorOrThisOfType( view );
|
||||
RimPlotCurve* curve = nullptr;
|
||||
this->firstAncestorOrThisOfType( curve );
|
||||
Rim3dWellLogCurve* rim3dWellLogCurve = nullptr;
|
||||
this->firstAncestorOrThisOfType( rim3dWellLogCurve );
|
||||
auto propFilter = dynamic_cast<RimGeoMechPropertyFilter*>( this->parentField()->ownerObject() );
|
||||
auto view = firstAncestorOrThisOfType<RimGridView>();
|
||||
auto curve = firstAncestorOrThisOfType<RimPlotCurve>();
|
||||
auto rim3dWellLogCurve = firstAncestorOrThisOfType<Rim3dWellLogCurve>();
|
||||
|
||||
if ( &m_resultVariableUiField == changedField || &m_compactionRefLayerUiField == changedField ||
|
||||
&m_timeLapseBaseTimestep == changedField || &m_normalizeByHydrostaticPressure == changedField ||
|
||||
|
||||
@@ -229,8 +229,7 @@ QString RimGeoMechView::createAutoName() const
|
||||
|
||||
QStringList generatedAutoTags;
|
||||
|
||||
RimCase* ownerCase = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( ownerCase );
|
||||
RimCase* ownerCase = firstAncestorOrThisOfTypeAsserted<RimCase>();
|
||||
|
||||
if ( nameConfig()->addCaseName() )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user