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:
@@ -71,9 +71,7 @@ void RimPlotCellFilterCollection::setCase( RimCase* gridCase )
|
||||
RimEclipseResultCase* eclipseResultCase = dynamic_cast<RimEclipseResultCase*>( gridCase );
|
||||
if ( eclipseResultCase )
|
||||
{
|
||||
std::vector<RimEclipseResultDefinition*> resultDefinitions;
|
||||
|
||||
this->descendantsIncludingThisOfType( resultDefinitions );
|
||||
auto resultDefinitions = descendantsIncludingThisOfType<RimEclipseResultDefinition>();
|
||||
for ( auto r : resultDefinitions )
|
||||
{
|
||||
r->setEclipseCase( eclipseResultCase );
|
||||
|
||||
@@ -143,7 +143,7 @@ void RimGridCrossPlot::addDataSet( RimGridCrossPlotDataSet* dataSet )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGridCrossPlotDataSet*> RimGridCrossPlot::dataSets() const
|
||||
{
|
||||
return m_crossPlotDataSets.children();
|
||||
return m_crossPlotDataSets.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1041,8 +1041,7 @@ void RimGridCrossPlot::cleanupBeforeClose()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGridCrossPlot::isDeletable() const
|
||||
{
|
||||
RimMultiPlot* plotWindow = nullptr;
|
||||
firstAncestorOrThisOfType( plotWindow );
|
||||
auto plotWindow = firstAncestorOrThisOfType<RimMultiPlot>();
|
||||
return plotWindow == nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ RimGridCrossPlotCollection::~RimGridCrossPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGridCrossPlot*> RimGridCrossPlotCollection::plots() const
|
||||
{
|
||||
return m_gridCrossPlots.children();
|
||||
return m_gridCrossPlots.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -93,9 +93,8 @@ void RimGridCrossPlotCurve::determineLegendIcon()
|
||||
{
|
||||
if ( !m_plotCurve ) return;
|
||||
|
||||
RimGridCrossPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
int fontSize = plot->legendFontSize();
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
|
||||
int fontSize = plot->legendFontSize();
|
||||
m_plotCurve->setLegendIconSize( QSize( fontSize, fontSize ) );
|
||||
}
|
||||
|
||||
@@ -124,8 +123,7 @@ void RimGridCrossPlotCurve::determineSymbol()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotCurve::updateZoomInParentPlot()
|
||||
{
|
||||
RimGridCrossPlot* plot;
|
||||
this->firstAncestorOrThisOfTypeAsserted( plot );
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
|
||||
plot->calculateZoomRangeAndUpdateQwt();
|
||||
}
|
||||
|
||||
|
||||
@@ -191,8 +191,7 @@ void RimGridCrossPlotDataSet::setCellFilterView( RimGridView* cellFilterView )
|
||||
m_yAxisProperty->setResultVariable( "DEPTH" );
|
||||
m_timeStep = eclipseView->currentTimeStep();
|
||||
|
||||
RimGridCrossPlot* parentPlot = nullptr;
|
||||
firstAncestorOrThisOfType( parentPlot );
|
||||
auto parentPlot = firstAncestorOrThisOfType<RimGridCrossPlot>();
|
||||
if ( parentPlot )
|
||||
{
|
||||
parentPlot->setYAxisInverted( true );
|
||||
@@ -271,8 +270,7 @@ QString RimGridCrossPlotDataSet::infoText() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
int RimGridCrossPlotDataSet::indexInPlot() const
|
||||
{
|
||||
RimGridCrossPlot* parent;
|
||||
this->firstAncestorOrThisOfTypeAsserted( parent );
|
||||
auto parent = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
|
||||
return parent->indexOfDataSet( this );
|
||||
}
|
||||
|
||||
@@ -385,7 +383,7 @@ RimRegularLegendConfig* RimGridCrossPlotDataSet::legendConfig() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGridCrossPlotCurve*> RimGridCrossPlotDataSet::curves() const
|
||||
{
|
||||
return m_crossPlotCurves.children();
|
||||
return m_crossPlotCurves.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -940,8 +938,7 @@ void RimGridCrossPlotDataSet::childFieldChangedByUi( const caf::PdmFieldHandle*
|
||||
{
|
||||
if ( m_yAxisProperty->resultVariable() == "DEPTH" )
|
||||
{
|
||||
RimGridCrossPlot* plot;
|
||||
this->firstAncestorOrThisOfTypeAsserted( plot );
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
|
||||
plot->setYAxisInverted( true );
|
||||
triggerPlotNameUpdateAndReplot();
|
||||
}
|
||||
@@ -979,7 +976,7 @@ QList<caf::PdmOptionItemInfo> RimGridCrossPlotDataSet::calculateValueOptions( co
|
||||
if ( eclipseCase )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( "Disabled", nullptr ) );
|
||||
for ( RimEclipseView* view : eclipseCase->reservoirViews.children() )
|
||||
for ( RimEclipseView* view : eclipseCase->reservoirViews.childrenByType() )
|
||||
{
|
||||
CVF_ASSERT( view && "Really always should have a valid view pointer in ReservoirViews" );
|
||||
options.push_back( caf::PdmOptionItemInfo( view->name(), view, false, view->uiIconProvider() ) );
|
||||
@@ -1017,8 +1014,7 @@ void RimGridCrossPlotDataSet::updateLegendRange()
|
||||
legendConfig()->setTitle( groupParameter() );
|
||||
legendConfig()->disableAllTimeStepsRange( !hasMultipleTimeSteps() );
|
||||
|
||||
RimGridCrossPlot* parent;
|
||||
this->firstAncestorOrThisOfTypeAsserted( parent );
|
||||
auto parent = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
|
||||
if ( parent->plotWidget() )
|
||||
{
|
||||
if ( groupingEnabled() && m_case() && isChecked() && legendConfig()->showLegend() )
|
||||
@@ -1194,8 +1190,7 @@ void RimGridCrossPlotDataSet::exportFormattedData( RifTextDataTableFormatter& fo
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGridCrossPlotDataSet::isXAxisLogarithmic() const
|
||||
{
|
||||
RimGridCrossPlot* parent = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( parent );
|
||||
auto parent = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
|
||||
return parent->isXAxisLogarithmic();
|
||||
}
|
||||
|
||||
@@ -1204,8 +1199,7 @@ bool RimGridCrossPlotDataSet::isXAxisLogarithmic() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimGridCrossPlotDataSet::isYAxisLogarithmic() const
|
||||
{
|
||||
RimGridCrossPlot* parent = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( parent );
|
||||
auto parent = firstAncestorOrThisOfTypeAsserted<RimGridCrossPlot>();
|
||||
return parent->isYAxisLogarithmic();
|
||||
}
|
||||
|
||||
@@ -1260,8 +1254,7 @@ void RimGridCrossPlotDataSet::setCustomColor( const cvf::Color3f color )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGridCrossPlotDataSet::triggerPlotNameUpdateAndReplot()
|
||||
{
|
||||
RimGridCrossPlot* parent;
|
||||
this->firstAncestorOrThisOfType( parent );
|
||||
auto parent = firstAncestorOrThisOfType<RimGridCrossPlot>();
|
||||
if ( parent )
|
||||
{
|
||||
parent->updateCurveNamesAndPlotTitle();
|
||||
|
||||
@@ -193,11 +193,8 @@ void RimSaturationPressurePlot::fixPointersAfterCopy( RimSaturationPressurePlot*
|
||||
{
|
||||
CAF_ASSERT( source && copy );
|
||||
|
||||
std::vector<RimPlotCellPropertyFilter*> sourceFilters;
|
||||
source->descendantsIncludingThisOfType( sourceFilters );
|
||||
|
||||
std::vector<RimPlotCellPropertyFilter*> copyFilters;
|
||||
copy->descendantsIncludingThisOfType( copyFilters );
|
||||
auto sourceFilters = source->descendantsIncludingThisOfType<RimPlotCellPropertyFilter>();
|
||||
auto copyFilters = copy->descendantsIncludingThisOfType<RimPlotCellPropertyFilter>();
|
||||
|
||||
if ( !sourceFilters.empty() && ( sourceFilters.size() == copyFilters.size() ) )
|
||||
{
|
||||
|
||||
@@ -109,7 +109,7 @@ std::vector<RimSaturationPressurePlot*>
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSaturationPressurePlot*> RimSaturationPressurePlotCollection::plots() const
|
||||
{
|
||||
return m_saturationPressurePlots.children();
|
||||
return m_saturationPressurePlots.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user