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:
@@ -114,7 +114,7 @@ RimEclipseCase* RicAddEclipseInputPropertyFeature::getEclipseCase() const
|
||||
RimEclipseCellColors* cellColors = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseCellColors>();
|
||||
if ( cellColors )
|
||||
{
|
||||
cellColors->firstAncestorOrThisOfType( eclipseCase );
|
||||
eclipseCase = cellColors->firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
if ( eclipseCase )
|
||||
{
|
||||
return eclipseCase;
|
||||
@@ -124,7 +124,7 @@ RimEclipseCase* RicAddEclipseInputPropertyFeature::getEclipseCase() const
|
||||
RimEclipseView* eclipseView = caf::SelectionManager::instance()->selectedItemOfType<RimEclipseView>();
|
||||
if ( eclipseView )
|
||||
{
|
||||
eclipseView->firstAncestorOrThisOfType( eclipseCase );
|
||||
eclipseCase = eclipseView->firstAncestorOrThisOfType<RimEclipseCase>();
|
||||
if ( eclipseCase )
|
||||
{
|
||||
return eclipseCase;
|
||||
|
||||
@@ -76,8 +76,7 @@ void RicApplyPropertyFilterAsCellResultFeature::onActionTriggered( bool isChecke
|
||||
RimEclipsePropertyFilter* propertyFilter = objects[0];
|
||||
if ( !propertyFilter ) return;
|
||||
|
||||
RimEclipseView* rimEclipseView = nullptr;
|
||||
propertyFilter->firstAncestorOrThisOfType( rimEclipseView );
|
||||
RimEclipseView* rimEclipseView = propertyFilter->firstAncestorOrThisOfType<RimEclipseView>();
|
||||
if ( !rimEclipseView ) return;
|
||||
|
||||
rimEclipseView->cellResult()->simpleCopy( propertyFilter->resultDefinition() );
|
||||
@@ -98,8 +97,7 @@ void RicApplyPropertyFilterAsCellResultFeature::onActionTriggered( bool isChecke
|
||||
RimGeoMechPropertyFilter* propertyFilter = objects[0];
|
||||
if ( !propertyFilter ) return;
|
||||
|
||||
RimGeoMechView* geoMechView = nullptr;
|
||||
propertyFilter->firstAncestorOrThisOfType( geoMechView );
|
||||
RimGeoMechView* geoMechView = propertyFilter->firstAncestorOrThisOfType<RimGeoMechView>();
|
||||
if ( !geoMechView ) return;
|
||||
|
||||
geoMechView->cellResultResultDefinition()->setResultAddress( propertyFilter->resultDefinition()->resultAddress() );
|
||||
|
||||
@@ -43,8 +43,7 @@ bool RicComputeStatisticsFeature::isCommandEnabled()
|
||||
RimEclipseStatisticsCase* statisticsCase = selection[0];
|
||||
if ( statisticsCase )
|
||||
{
|
||||
RimIdenticalGridCaseGroup* gridCaseGroup = nullptr;
|
||||
statisticsCase->firstAncestorOrThisOfType( gridCaseGroup );
|
||||
RimIdenticalGridCaseGroup* gridCaseGroup = statisticsCase->firstAncestorOrThisOfType<RimIdenticalGridCaseGroup>();
|
||||
|
||||
RimCaseCollection* caseCollection = gridCaseGroup ? gridCaseGroup->caseCollection() : nullptr;
|
||||
return caseCollection ? caseCollection->reservoirs.size() > 0 : false;
|
||||
|
||||
@@ -94,8 +94,7 @@ void RicEclipsePropertyFilterFeatureImpl::insertPropertyFilter( RimEclipseProper
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicEclipsePropertyFilterFeatureImpl::isPropertyFilterCommandAvailable( caf::PdmObjectHandle* object )
|
||||
{
|
||||
Rim3dView* rimView = nullptr;
|
||||
object->firstAncestorOrThisOfType( rimView );
|
||||
auto rimView = object->firstAncestorOrThisOfType<Rim3dView>();
|
||||
if ( rimView )
|
||||
{
|
||||
RimViewController* vc = rimView->viewController();
|
||||
@@ -115,11 +114,7 @@ void RicEclipsePropertyFilterFeatureImpl::setDefaults( RimEclipsePropertyFilter*
|
||||
{
|
||||
CVF_ASSERT( propertyFilter );
|
||||
|
||||
RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
|
||||
propertyFilter->firstAncestorOrThisOfTypeAsserted( propertyFilterCollection );
|
||||
|
||||
RimEclipseView* reservoirView = nullptr;
|
||||
propertyFilter->firstAncestorOrThisOfTypeAsserted( reservoirView );
|
||||
auto reservoirView = propertyFilter->firstAncestorOrThisOfTypeAsserted<RimEclipseView>();
|
||||
|
||||
propertyFilter->resultDefinition()->setEclipseCase( reservoirView->eclipseCase() );
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ QString RicEclipsePropertyFilterInsertExec::name()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicEclipsePropertyFilterInsertExec::redo()
|
||||
{
|
||||
RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr;
|
||||
m_propertyFilter->firstAncestorOrThisOfTypeAsserted( propertyFilterCollection );
|
||||
RimEclipsePropertyFilterCollection* propertyFilterCollection =
|
||||
m_propertyFilter->firstAncestorOrThisOfTypeAsserted<RimEclipsePropertyFilterCollection>();
|
||||
|
||||
size_t index = propertyFilterCollection->propertyFiltersField().indexOf( m_propertyFilter );
|
||||
CVF_ASSERT( index < propertyFilterCollection->propertyFilters().size() );
|
||||
|
||||
@@ -57,8 +57,7 @@ void RicEclipsePropertyFilterNewExec::redo()
|
||||
{
|
||||
RicEclipsePropertyFilterFeatureImpl::addPropertyFilter( m_propertyFilterCollection );
|
||||
|
||||
RimGridView* view = nullptr;
|
||||
m_propertyFilterCollection->firstAncestorOrThisOfTypeAsserted( view );
|
||||
RimGridView* view = m_propertyFilterCollection->firstAncestorOrThisOfTypeAsserted<RimGridView>();
|
||||
|
||||
// Enable display of grid cells, to be able to show generated property filter
|
||||
view->showGridCells( true );
|
||||
|
||||
@@ -76,9 +76,7 @@ void RicEclipseShowOnlyFaultFeature::onActionTriggered( bool isChecked )
|
||||
if ( !rimFault ) return;
|
||||
if ( !rimFault->parentField() ) return;
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> children;
|
||||
rimFault->parentField()->children( &children );
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> children = rimFault->parentField()->children();
|
||||
for ( auto& child : children )
|
||||
{
|
||||
caf::PdmUiObjectHandle* childUiObject = uiObj( child );
|
||||
|
||||
Reference in New Issue
Block a user