mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-12 08:25:03 -05: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:
1 parent
37e29a0f68
commit
0c90f67dcc
510 files changed
+1651
-3111
No files matched your search
@@ -103,9 +103,7 @@ RimSurface* RimEnsembleStatisticsSurface::createCopy()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEnsembleStatisticsSurface::updateSurfaceData()
|
||||
{
|
||||
RimEnsembleSurface* ensembleSurface;
|
||||
firstAncestorOrThisOfType( ensembleSurface );
|
||||
|
||||
auto ensembleSurface = firstAncestorOrThisOfType<RimEnsembleSurface>();
|
||||
if ( ensembleSurface )
|
||||
{
|
||||
const RigSurface* surface = ensembleSurface->statisticsSurface();
|
||||
|
||||
@@ -154,8 +154,7 @@ void RimEnsembleSurface::loadDataAndUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
RimSurfaceCollection* surfColl;
|
||||
this->firstAncestorOrThisOfTypeAsserted( surfColl );
|
||||
auto surfColl = firstAncestorOrThisOfTypeAsserted<RimSurfaceCollection>();
|
||||
|
||||
std::vector<RimSurface*> surfacesToUpdate;
|
||||
surfColl->updateViews( surfaces(), false );
|
||||
|
||||
@@ -105,8 +105,7 @@ void RimFileSurface::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
clearCachedNativeData();
|
||||
updateSurfaceData();
|
||||
|
||||
RimSurfaceCollection* surfColl;
|
||||
this->firstAncestorOrThisOfTypeAsserted( surfColl );
|
||||
auto surfColl = firstAncestorOrThisOfTypeAsserted<RimSurfaceCollection>();
|
||||
surfColl->updateViews( { this } );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,8 +143,7 @@ void RimGridCaseSurface::fieldChangedByUi( const caf::PdmFieldHandle* changedFie
|
||||
clearCachedNativeData();
|
||||
updateSurfaceData();
|
||||
|
||||
RimSurfaceCollection* surfColl;
|
||||
this->firstAncestorOrThisOfTypeAsserted( surfColl );
|
||||
auto surfColl = firstAncestorOrThisOfTypeAsserted<RimSurfaceCollection>();
|
||||
surfColl->updateViews( { this } );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,8 +213,7 @@ void RimSurface::fieldChangedByUi( const caf::PdmFieldHandle* changedField, cons
|
||||
|
||||
if ( updateViews )
|
||||
{
|
||||
RimSurfaceCollection* surfColl;
|
||||
this->firstAncestorOrThisOfTypeAsserted( surfColl );
|
||||
auto surfColl = firstAncestorOrThisOfTypeAsserted<RimSurfaceCollection>();
|
||||
surfColl->updateViews( { this } );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,11 +126,7 @@ void RimSurfaceCollection::addEnsembleSurface( RimEnsembleSurface* ensembleSurfa
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEnsembleSurface*> RimSurfaceCollection::ensembleSurfaces() const
|
||||
{
|
||||
std::vector<RimEnsembleSurface*> ensSurfaces;
|
||||
|
||||
this->descendantsIncludingThisOfType( ensSurfaces );
|
||||
|
||||
return ensSurfaces;
|
||||
return descendantsIncludingThisOfType<RimEnsembleSurface>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -269,7 +265,7 @@ RimSurface* RimSurfaceCollection::addGridCaseSurface( RimCase* sourceCase, int o
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSurface*> RimSurfaceCollection::surfaces() const
|
||||
{
|
||||
return m_surfaces.children();
|
||||
return m_surfaces.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -277,7 +273,7 @@ std::vector<RimSurface*> RimSurfaceCollection::surfaces() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSurfaceCollection*> RimSurfaceCollection::subCollections() const
|
||||
{
|
||||
return m_subCollections.children();
|
||||
return m_subCollections.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -318,16 +314,13 @@ void RimSurfaceCollection::updateViews( const std::vector<RimSurface*>& surfsToR
|
||||
|
||||
for ( auto surf : surfsToReload )
|
||||
{
|
||||
std::vector<RimSurfaceInView*> surfsInView;
|
||||
surf->objectsWithReferringPtrFieldsOfType( surfsInView );
|
||||
std::vector<RimSurfaceInView*> surfsInView = surf->objectsWithReferringPtrFieldsOfType<RimSurfaceInView>();
|
||||
for ( auto surfInView : surfsInView )
|
||||
{
|
||||
surfInView->clearGeometry();
|
||||
surfInView->surfaceResultDefinition()->legendConfig()->setShowLegend( showLegend );
|
||||
|
||||
RimGridView* gridView;
|
||||
surfInView->firstAncestorOrThisOfType( gridView );
|
||||
|
||||
auto gridView = surfInView->firstAncestorOrThisOfType<RimGridView>();
|
||||
if ( gridView ) viewsNeedingUpdate.insert( gridView );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,8 +221,7 @@ void RimSurfaceInView::fieldChangedByUi( const caf::PdmFieldHandle* changedField
|
||||
|
||||
if ( scheduleRedraw )
|
||||
{
|
||||
RimGridView* ownerView;
|
||||
this->firstAncestorOrThisOfTypeAsserted( ownerView );
|
||||
auto ownerView = firstAncestorOrThisOfTypeAsserted<RimGridView>();
|
||||
ownerView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
@@ -243,8 +242,7 @@ void RimSurfaceInView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimIntersectionResultsDefinitionCollection* RimSurfaceInView::findSeparateResultsCollection()
|
||||
{
|
||||
RimGridView* view;
|
||||
this->firstAncestorOrThisOfTypeAsserted( view );
|
||||
auto view = firstAncestorOrThisOfTypeAsserted<RimGridView>();
|
||||
return view->separateSurfaceResultsCollection();
|
||||
}
|
||||
|
||||
|
||||
@@ -80,11 +80,8 @@ caf::PdmFieldHandle* RimSurfaceInViewCollection::userDescriptionField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSurfaceInViewCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
|
||||
{
|
||||
RimGridView* gridView = nullptr;
|
||||
this->firstAncestorOfType( gridView );
|
||||
|
||||
RimSurfaceInViewCollection* surfViewColl = nullptr;
|
||||
this->firstAncestorOfType( surfViewColl );
|
||||
auto gridView = firstAncestorOfType<RimGridView>();
|
||||
auto surfViewColl = firstAncestorOfType<RimSurfaceInViewCollection>();
|
||||
|
||||
if ( gridView && !surfViewColl )
|
||||
{
|
||||
@@ -136,7 +133,7 @@ void RimSurfaceInViewCollection::updateAllViewItems()
|
||||
void RimSurfaceInViewCollection::syncCollectionsWithView()
|
||||
{
|
||||
// check that we have surface in view collections for all sub-collections
|
||||
std::vector<RimSurfaceInViewCollection*> colls = m_collectionsInView.children();
|
||||
std::vector<RimSurfaceInViewCollection*> colls = m_collectionsInView.childrenByType();
|
||||
|
||||
for ( auto surfcoll : colls )
|
||||
{
|
||||
@@ -187,7 +184,7 @@ void RimSurfaceInViewCollection::syncSurfacesWithView()
|
||||
{
|
||||
// Delete surfaceInView without any real Surface connection
|
||||
|
||||
std::vector<RimSurfaceInView*> surfsInView = m_surfacesInView.children();
|
||||
std::vector<RimSurfaceInView*> surfsInView = m_surfacesInView.childrenByType();
|
||||
|
||||
for ( auto surf : surfsInView )
|
||||
{
|
||||
@@ -314,8 +311,7 @@ void RimSurfaceInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
|
||||
if ( changedField == &m_isChecked )
|
||||
{
|
||||
RimGridView* ownerView;
|
||||
this->firstAncestorOrThisOfTypeAsserted( ownerView );
|
||||
auto ownerView = firstAncestorOrThisOfTypeAsserted<RimGridView>();
|
||||
ownerView->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,9 +143,7 @@ void RimSurfaceResultDefinition::fieldChangedByUi( const caf::PdmFieldHandle* ch
|
||||
updateMinMaxValues();
|
||||
}
|
||||
|
||||
Rim3dView* view = nullptr;
|
||||
this->firstAncestorOrThisOfType( view );
|
||||
|
||||
auto view = firstAncestorOrThisOfType<Rim3dView>();
|
||||
if ( view )
|
||||
{
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
|
||||
Reference in new issue
Block a user