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,8 +114,7 @@ QString RimAsciiDataCurve::createCurveAutoName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAsciiDataCurve::updateZoomInParentPlot()
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
|
||||
plot->updateZoomInParentPlot();
|
||||
}
|
||||
@@ -132,8 +131,7 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
std::vector<time_t> dateTimes = this->timeSteps();
|
||||
std::vector<double> values = this->yValues();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
bool useLogarithmicScale = plot->isLogarithmicScaleEnabled( this->yAxis() );
|
||||
|
||||
if ( dateTimes.size() > 0 && dateTimes.size() == values.size() )
|
||||
@@ -244,8 +242,7 @@ void RimAsciiDataCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel
|
||||
{
|
||||
RimPlotCurve::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
|
||||
if ( changedField == &m_plotAxis )
|
||||
{
|
||||
|
||||
@@ -575,9 +575,8 @@ RimSummaryCase* RimDerivedEnsembleCaseCollection::findCaseByRealizationNumber( c
|
||||
std::vector<RimDerivedEnsembleCaseCollection*> RimDerivedEnsembleCaseCollection::findReferringEnsembles() const
|
||||
{
|
||||
std::vector<RimDerivedEnsembleCaseCollection*> referringEnsembles;
|
||||
RimSummaryCaseMainCollection* mainColl;
|
||||
|
||||
firstAncestorOrThisOfType( mainColl );
|
||||
auto mainColl = firstAncestorOrThisOfType<RimSummaryCaseMainCollection>();
|
||||
if ( mainColl )
|
||||
{
|
||||
for ( auto group : mainColl->summaryCaseCollections() )
|
||||
|
||||
@@ -535,14 +535,12 @@ void RimDerivedSummaryCase::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
||||
|
||||
m_dataCache.clear();
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> referringObjects;
|
||||
this->objectsWithReferringPtrFields( referringObjects );
|
||||
std::vector<caf::PdmObjectHandle*> referringObjects = objectsWithReferringPtrFields();
|
||||
|
||||
std::set<RimSummaryPlot*> plotsToUpdate;
|
||||
for ( auto o : referringObjects )
|
||||
{
|
||||
RimSummaryPlot* sumPlot = nullptr;
|
||||
o->firstAncestorOrThisOfType( sumPlot );
|
||||
RimSummaryPlot* sumPlot = o->firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
|
||||
if ( sumPlot )
|
||||
{
|
||||
|
||||
@@ -126,8 +126,7 @@ RimEnsembleCurveFilter::RimEnsembleCurveFilter( const QString& ensembleParameter
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEnsembleCurveFilter::isActive() const
|
||||
{
|
||||
RimEnsembleCurveFilterCollection* coll;
|
||||
firstAncestorOrThisOfType( coll );
|
||||
auto coll = firstAncestorOrThisOfType<RimEnsembleCurveFilterCollection>();
|
||||
|
||||
return ( !coll || coll->isActive() ) && m_active;
|
||||
}
|
||||
@@ -376,7 +375,7 @@ void RimEnsembleCurveFilter::fieldChangedByUi( const caf::PdmFieldHandle* change
|
||||
RimSummaryCaseCollection* candidateEnsemble = parentCurveSet()->summaryCaseCollection();
|
||||
|
||||
std::vector<RifEclipseSummaryAddress> candidateAddresses;
|
||||
for ( auto address : m_objectiveValuesSummaryAddresses().children() )
|
||||
for ( auto address : m_objectiveValuesSummaryAddresses().childrenByType() )
|
||||
{
|
||||
candidateAddresses.push_back( address->address() );
|
||||
}
|
||||
@@ -600,9 +599,7 @@ caf::PdmFieldHandle* RimEnsembleCurveFilter::objectToggleField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleCurveSet* RimEnsembleCurveFilter::parentCurveSet() const
|
||||
{
|
||||
RimEnsembleCurveSet* curveSet;
|
||||
firstAncestorOrThisOfType( curveSet );
|
||||
return curveSet;
|
||||
return firstAncestorOrThisOfType<RimEnsembleCurveSet>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -629,9 +626,7 @@ void RimEnsembleCurveFilter::updateMaxMinAndDefaultValuesFromParent()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEnsembleCurveFilterCollection* RimEnsembleCurveFilter::parentCurveFilterCollection() const
|
||||
{
|
||||
RimEnsembleCurveFilterCollection* coll;
|
||||
firstAncestorOrThisOfType( coll );
|
||||
return coll;
|
||||
return firstAncestorOrThisOfType<RimEnsembleCurveFilterCollection>();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -67,7 +67,7 @@ RimEnsembleCurveFilter* RimEnsembleCurveFilterCollection::addFilter( const QStri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEnsembleCurveFilter*> RimEnsembleCurveFilterCollection::filters() const
|
||||
{
|
||||
return m_filters.children();
|
||||
return m_filters.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -109,8 +109,7 @@ QList<caf::PdmOptionItemInfo> RimEnsembleCurveFilterCollection::calculateValueOp
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveFilterCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
RimEnsembleCurveSet* curveSet = nullptr;
|
||||
firstAncestorOrThisOfType( curveSet );
|
||||
RimEnsembleCurveSet* curveSet = firstAncestorOrThisOfType<RimEnsembleCurveSet>();
|
||||
if ( !curveSet ) return;
|
||||
|
||||
if ( changedField == &m_active )
|
||||
@@ -266,11 +265,9 @@ caf::PdmFieldHandle* RimEnsembleCurveFilterCollection::objectToggleField()
|
||||
void RimEnsembleCurveFilterCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
RimSummaryPlot* plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( plot ) plot->loadDataAndUpdate();
|
||||
|
||||
RimEnsembleCurveSet* curveSet = nullptr;
|
||||
firstAncestorOrThisOfType( curveSet );
|
||||
RimEnsembleCurveSet* curveSet = firstAncestorOrThisOfType<RimEnsembleCurveSet>();
|
||||
if ( curveSet ) curveSet->updateConnectedEditors();
|
||||
}
|
||||
|
||||
@@ -246,8 +246,7 @@ RimEnsembleCurveSet::~RimEnsembleCurveSet()
|
||||
{
|
||||
m_curves.deleteChildren();
|
||||
|
||||
RimSummaryPlot* parentPlot;
|
||||
firstAncestorOrThisOfType( parentPlot );
|
||||
auto parentPlot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( parentPlot && parentPlot->plotWidget() )
|
||||
{
|
||||
if ( m_plotCurveForLegendText ) m_plotCurveForLegendText->detach();
|
||||
@@ -278,8 +277,7 @@ RimEnsembleCurveSet::~RimEnsembleCurveSet()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimEnsembleCurveSet::isCurvesVisible() const
|
||||
{
|
||||
RimEnsembleCurveSetCollection* coll = nullptr;
|
||||
firstAncestorOrThisOfType( coll );
|
||||
auto coll = firstAncestorOrThisOfType<RimEnsembleCurveSetCollection>();
|
||||
return m_showCurves() && ( coll ? coll->isCurveSetsVisible() : true );
|
||||
}
|
||||
|
||||
@@ -327,8 +325,7 @@ void RimEnsembleCurveSet::loadDataAndUpdate( bool updateParentPlot )
|
||||
|
||||
if ( updateParentPlot )
|
||||
{
|
||||
RimSummaryPlot* parentPlot;
|
||||
firstAncestorOrThisOfTypeAsserted( parentPlot );
|
||||
auto parentPlot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
parentPlot->updateAll();
|
||||
}
|
||||
}
|
||||
@@ -379,8 +376,7 @@ void RimEnsembleCurveSet::addCurve( RimSummaryCurve* curve )
|
||||
{
|
||||
if ( curve )
|
||||
{
|
||||
RimSummaryPlot* plot;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( plot && plot->plotWidget() ) curve->setParentPlotNoReplot( plot->plotWidget() );
|
||||
|
||||
curve->setColor( m_colorForRealizations );
|
||||
@@ -434,7 +430,7 @@ RifEclipseSummaryAddress RimEnsembleCurveSet::summaryAddress() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryCurve*> RimEnsembleCurveSet::curves() const
|
||||
{
|
||||
return m_curves.children();
|
||||
return m_curves.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -646,9 +642,7 @@ std::vector<time_t> RimEnsembleCurveSet::selectedTimeSteps() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
CVF_ASSERT( plot );
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
|
||||
bool updateTextInPlot = false;
|
||||
|
||||
@@ -837,7 +831,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
RimSummaryCaseCollection* candidateEnsemble = m_yValuesSummaryCaseCollection();
|
||||
|
||||
std::vector<RifEclipseSummaryAddress> candidateAddresses;
|
||||
for ( auto address : m_objectiveValuesSummaryAddresses().children() )
|
||||
for ( auto address : m_objectiveValuesSummaryAddresses().childrenByType() )
|
||||
{
|
||||
candidateAddresses.push_back( address->address() );
|
||||
}
|
||||
@@ -1152,8 +1146,7 @@ void RimEnsembleCurveSet::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOr
|
||||
caf::IconProvider iconProvider = this->uiIconProvider();
|
||||
if ( !iconProvider.valid() ) return;
|
||||
|
||||
RimEnsembleCurveSetCollection* coll = nullptr;
|
||||
this->firstAncestorOrThisOfType( coll );
|
||||
auto coll = firstAncestorOrThisOfType<RimEnsembleCurveSetCollection>();
|
||||
if ( coll && coll->curveSetForSourceStepping() == this )
|
||||
{
|
||||
iconProvider.setOverlayResourceString( ":/StepUpDownCorner16x16.png" );
|
||||
@@ -1335,9 +1328,7 @@ QList<caf::PdmOptionItemInfo> RimEnsembleCurveSet::calculateValueOptions( const
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_plotAxisProperties )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
for ( auto axis : plot->plotAxes() )
|
||||
{
|
||||
options.push_back( caf::PdmOptionItemInfo( axis->objectName(), axis ) );
|
||||
@@ -1454,8 +1445,7 @@ void RimEnsembleCurveSet::appendOptionItemsForSummaryAddresses( QList<caf::PdmOp
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSet::updateFilterLegend()
|
||||
{
|
||||
RimSummaryPlot* plot;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( plot && plot->plotWidget() )
|
||||
{
|
||||
if ( m_curveFilters()->isActive() && m_curveFilters()->countActiveFilters() > 0 )
|
||||
@@ -1483,8 +1473,7 @@ void RimEnsembleCurveSet::updateFilterLegend()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSet::updateObjectiveFunctionLegend()
|
||||
{
|
||||
RimSummaryPlot* plot;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( plot && plot->plotWidget() )
|
||||
{
|
||||
if ( ( m_colorMode == ColorMode::BY_OBJECTIVE_FUNCTION || m_colorMode == ColorMode::BY_CUSTOM_OBJECTIVE_FUNCTION ) &&
|
||||
@@ -1499,7 +1488,7 @@ void RimEnsembleCurveSet::updateObjectiveFunctionLegend()
|
||||
if ( m_colorMode() == ColorMode::BY_OBJECTIVE_FUNCTION )
|
||||
{
|
||||
std::vector<RifEclipseSummaryAddress> addresses;
|
||||
for ( auto address : m_objectiveValuesSummaryAddresses().children() )
|
||||
for ( auto address : m_objectiveValuesSummaryAddresses().childrenByType() )
|
||||
{
|
||||
addresses.push_back( address->address() );
|
||||
}
|
||||
@@ -1511,7 +1500,7 @@ void RimEnsembleCurveSet::updateObjectiveFunctionLegend()
|
||||
else if ( m_colorMode() == ColorMode::BY_CUSTOM_OBJECTIVE_FUNCTION && m_customObjectiveFunction() )
|
||||
{
|
||||
std::vector<RifEclipseSummaryAddress> addresses;
|
||||
for ( auto address : m_objectiveValuesSummaryAddresses().children() )
|
||||
for ( auto address : m_objectiveValuesSummaryAddresses().childrenByType() )
|
||||
{
|
||||
addresses.push_back( address->address() );
|
||||
}
|
||||
@@ -1703,8 +1692,7 @@ void RimEnsembleCurveSet::updateCurveColors()
|
||||
m_plotCurveForLegendText->setColor( mainEnsembleColor() );
|
||||
}
|
||||
|
||||
RimSummaryPlot* plot;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( plot && plot->plotWidget() )
|
||||
{
|
||||
if ( m_yValuesSummaryCaseCollection() && isCurvesVisible() &&
|
||||
@@ -1734,10 +1722,7 @@ void RimEnsembleCurveSet::updateCurveColors()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSet::updateTimeAnnotations()
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
CVF_ASSERT( plot );
|
||||
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
plot->removeAllTimeAnnotations();
|
||||
|
||||
if ( ( m_colorMode() == ColorMode::BY_OBJECTIVE_FUNCTION &&
|
||||
@@ -1790,9 +1775,7 @@ void RimEnsembleCurveSet::updatePlotAxis()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSet::updateEnsembleCurves( const std::vector<RimSummaryCase*>& sumCases )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
CVF_ASSERT( plot );
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
|
||||
deleteEnsembleCurves();
|
||||
if ( m_plotCurveForLegendText ) m_plotCurveForLegendText->detach();
|
||||
@@ -1906,8 +1889,7 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vector<RimSummaryCa
|
||||
|
||||
deleteStatisticsCurves();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( plot && plot->plotWidget() )
|
||||
{
|
||||
for ( auto address : addresses )
|
||||
@@ -1983,8 +1965,7 @@ void RimEnsembleCurveSet::updateAllTextInPlot()
|
||||
{
|
||||
updateEnsembleLegendItem();
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfTypeAsserted( summaryPlot );
|
||||
auto summaryPlot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
if ( summaryPlot->plotWidget() )
|
||||
{
|
||||
summaryPlot->updatePlotTitle();
|
||||
@@ -2164,8 +2145,7 @@ QString RimEnsembleCurveSet::name() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimEnsembleCurveSet::createAutoName() const
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
|
||||
QString curveSetName =
|
||||
m_summaryAddressNameTools->curveNameY( m_yValuesSummaryAddress->address(), plot->plotTitleHelper(), plot->plotTitleHelper() );
|
||||
@@ -2241,8 +2221,7 @@ RiuPlotAxis RimEnsembleCurveSet::axisY() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSet::setLeftOrRightAxisY( RiuPlotAxis plotAxis )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
m_plotAxisProperties = plot->axisPropertiesForPlotAxis( plotAxis );
|
||||
|
||||
for ( RimSummaryCurve* curve : curves() )
|
||||
@@ -2258,8 +2237,7 @@ void RimEnsembleCurveSet::initAfterRead()
|
||||
{
|
||||
if ( m_plotAxisProperties.value() == nullptr )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( plot )
|
||||
{
|
||||
m_plotAxisProperties = plot->axisPropertiesForPlotAxis( RiuPlotAxis( m_plotAxis_OBSOLETE() ) );
|
||||
|
||||
@@ -83,8 +83,7 @@ void RimEnsembleCurveSetCollection::loadDataAndUpdate( bool updateParentPlot )
|
||||
|
||||
if ( updateParentPlot )
|
||||
{
|
||||
RimSummaryPlot* parentPlot;
|
||||
firstAncestorOrThisOfTypeAsserted( parentPlot );
|
||||
auto parentPlot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
parentPlot->updateAll();
|
||||
}
|
||||
}
|
||||
@@ -206,7 +205,7 @@ void RimEnsembleCurveSetCollection::deleteCurveSets( const std::vector<RimEnsemb
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimEnsembleCurveSet*> RimEnsembleCurveSetCollection::curveSets() const
|
||||
{
|
||||
return m_curveSets.children();
|
||||
return m_curveSets.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -337,7 +336,6 @@ caf::PdmFieldHandle* RimEnsembleCurveSetCollection::objectToggleField()
|
||||
void RimEnsembleCurveSetCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
this->firstAncestorOrThisOfType( plot );
|
||||
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( plot ) plot->updateConnectedEditors();
|
||||
}
|
||||
|
||||
@@ -116,8 +116,7 @@ RimEclipseCase* RimGridSummaryCase_obsolete::associatedEclipseCase()
|
||||
{
|
||||
// Find a possible associated eclipse case
|
||||
|
||||
RimProject* project;
|
||||
firstAncestorOrThisOfTypeAsserted( project );
|
||||
RimProject* project = RimProject::current();
|
||||
std::vector<RimCase*> allCases;
|
||||
project->allCases( allCases );
|
||||
for ( RimCase* someCase : allCases )
|
||||
@@ -221,9 +220,7 @@ void RimGridSummaryCase_obsolete::convertGridCasesToSummaryFileCases( RimProject
|
||||
RimFileSummaryCase* fileSummaryCase = createFileSummaryCaseCopy( *gridCase );
|
||||
summaryCaseMainCollection->addCase( fileSummaryCase );
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> referringFields;
|
||||
gridCase->referringPtrFields( referringFields );
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> referringFields = gridCase->referringPtrFields();
|
||||
for ( caf::PdmFieldHandle* field : referringFields )
|
||||
{
|
||||
auto ptrField = dynamic_cast<caf::PdmPtrField<RimSummaryCase*>*>( field );
|
||||
|
||||
@@ -82,8 +82,7 @@ QString RimRftCase::dataDeckFilePath() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimRftCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
RimSummaryCase* parentCase = nullptr;
|
||||
firstAncestorOfType( parentCase );
|
||||
auto parentCase = firstAncestorOfType<RimSummaryCase>();
|
||||
|
||||
if ( parentCase ) RicReloadSummaryCaseFeature::reloadSummaryCase( parentCase );
|
||||
|
||||
|
||||
@@ -445,7 +445,7 @@ int RimSummaryAddressCollection::ensembleId() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryAddressCollection*> RimSummaryAddressCollection::subFolders() const
|
||||
{
|
||||
return m_subfolders.children();
|
||||
return m_subfolders.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -159,8 +159,7 @@ bool RimSummaryCase::hasCaseRealizationParameters() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryCaseCollection* RimSummaryCase::ensemble() const
|
||||
{
|
||||
RimSummaryCaseCollection* e;
|
||||
firstAncestorOrThisOfType( e );
|
||||
RimSummaryCaseCollection* e = firstAncestorOrThisOfType<RimSummaryCaseCollection>();
|
||||
return e && e->isEnsemble() ? e : nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -190,8 +190,7 @@ void RimSummaryCaseCollection::addCase( RimSummaryCase* summaryCase )
|
||||
m_analyzer.reset();
|
||||
|
||||
// Update derived ensemble cases (if any)
|
||||
std::vector<RimDerivedEnsembleCaseCollection*> referringObjects;
|
||||
objectsWithReferringPtrFieldsOfType( referringObjects );
|
||||
std::vector<RimDerivedEnsembleCaseCollection*> referringObjects = objectsWithReferringPtrFieldsOfType<RimDerivedEnsembleCaseCollection>();
|
||||
for ( auto derivedEnsemble : referringObjects )
|
||||
{
|
||||
if ( !derivedEnsemble ) continue;
|
||||
@@ -216,7 +215,7 @@ void RimSummaryCaseCollection::addCase( RimSummaryCase* summaryCase )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryCase*> RimSummaryCaseCollection::allSummaryCases() const
|
||||
{
|
||||
return m_cases.children();
|
||||
return m_cases.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -936,8 +935,7 @@ void RimSummaryCaseCollection::onLoadDataAndUpdate()
|
||||
void RimSummaryCaseCollection::updateReferringCurveSets()
|
||||
{
|
||||
// Update curve set referring to this group
|
||||
std::vector<caf::PdmObject*> referringObjects;
|
||||
objectsWithReferringPtrFieldsOfType( referringObjects );
|
||||
std::vector<caf::PdmObject*> referringObjects = objectsWithReferringPtrFieldsOfType<PdmObject>();
|
||||
|
||||
for ( auto object : referringObjects )
|
||||
{
|
||||
|
||||
@@ -243,9 +243,7 @@ RimSummaryCaseCollection* RimSummaryCaseMainCollection::addCaseCollection( std::
|
||||
|
||||
for ( RimSummaryCase* summaryCase : summaryCases )
|
||||
{
|
||||
RimSummaryCaseCollection* currentSummaryCaseCollection = nullptr;
|
||||
summaryCase->firstAncestorOrThisOfType( currentSummaryCaseCollection );
|
||||
|
||||
auto currentSummaryCaseCollection = summaryCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
|
||||
if ( currentSummaryCaseCollection )
|
||||
{
|
||||
currentSummaryCaseCollection->removeCase( summaryCase );
|
||||
|
||||
@@ -58,7 +58,7 @@ void RimSummaryCrossPlotCollection::deleteAllPlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryPlot*> RimSummaryCrossPlotCollection::plots() const
|
||||
{
|
||||
return m_summaryCrossPlots.children();
|
||||
return m_summaryCrossPlots.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -262,9 +262,8 @@ std::vector<double> RimSummaryCurve::valuesY() const
|
||||
|
||||
if ( values.empty() ) return values;
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
bool isNormalized = plot->isNormalizationEnabled();
|
||||
RimSummaryPlot* plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
bool isNormalized = plot->isNormalizationEnabled();
|
||||
if ( isNormalized )
|
||||
{
|
||||
auto minMaxPair = std::minmax_element( values.begin(), values.end() );
|
||||
@@ -433,8 +432,7 @@ void RimSummaryCurve::setLeftOrRightAxisY( RiuPlotAxis plotAxis )
|
||||
{
|
||||
m_plotAxis_OBSOLETE = plotAxis.axis();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
RimSummaryPlot* plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
m_plotAxisProperties = plot->axisPropertiesForPlotAxis( plotAxis );
|
||||
}
|
||||
|
||||
@@ -504,8 +502,7 @@ QList<caf::PdmOptionItemInfo> RimSummaryCurve::calculateValueOptions( const caf:
|
||||
}
|
||||
else if ( fieldNeedingOptions == &m_plotAxisProperties )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
|
||||
for ( auto axis : plot->plotAxes() )
|
||||
{
|
||||
@@ -527,8 +524,7 @@ QString RimSummaryCurve::createCurveAutoName()
|
||||
const RimSummaryNameHelper* currentPlotNameHelper = nullptr;
|
||||
std::vector<const RimSummaryNameHelper*> plotNameHelpers;
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( plot )
|
||||
{
|
||||
currentPlotNameHelper = plot->plotTitleHelper();
|
||||
@@ -536,8 +532,7 @@ QString RimSummaryCurve::createCurveAutoName()
|
||||
}
|
||||
}
|
||||
{
|
||||
RimSummaryMultiPlot* summaryMultiPlot = nullptr;
|
||||
firstAncestorOrThisOfType( summaryMultiPlot );
|
||||
RimSummaryMultiPlot* summaryMultiPlot = firstAncestorOrThisOfType<RimSummaryMultiPlot>();
|
||||
if ( summaryMultiPlot )
|
||||
{
|
||||
auto nameHelper = summaryMultiPlot->nameHelper();
|
||||
@@ -579,8 +574,7 @@ QString RimSummaryCurve::createCurveAutoName()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::updateZoomInParentPlot()
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
|
||||
plot->updateZoomInParentPlot();
|
||||
}
|
||||
@@ -603,8 +597,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
std::vector<double> curveValuesY = this->valuesY();
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
bool useLogarithmicScale = plot->isLogarithmicScaleEnabled( this->axisY() );
|
||||
|
||||
bool shouldPopulateViewWithEmptyData = false;
|
||||
@@ -738,8 +731,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::updateLegendsInPlot()
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfTypeAsserted( plot );
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
plot->updateLegend();
|
||||
}
|
||||
|
||||
@@ -753,8 +745,7 @@ void RimSummaryCurve::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderi
|
||||
caf::IconProvider iconProvider = this->uiIconProvider();
|
||||
if ( !iconProvider.valid() ) return;
|
||||
|
||||
RimSummaryCurveCollection* coll = nullptr;
|
||||
this->firstAncestorOrThisOfType( coll );
|
||||
RimSummaryCurveCollection* coll = firstAncestorOrThisOfType<RimSummaryCurveCollection>();
|
||||
if ( coll && coll->curveForSourceStepping() == this )
|
||||
{
|
||||
iconProvider.setOverlayResourceString( ":/StepUpDownCorner16x16.png" );
|
||||
@@ -776,8 +767,7 @@ void RimSummaryCurve::initAfterRead()
|
||||
|
||||
if ( m_plotAxisProperties.value() == nullptr )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( plot ) m_plotAxisProperties = plot->axisPropertiesForPlotAxis( RiuPlotAxis( m_plotAxis_OBSOLETE() ) );
|
||||
}
|
||||
|
||||
@@ -966,8 +956,7 @@ QString RimSummaryCurve::curveExportDescription( const RifEclipseSummaryAddress&
|
||||
{
|
||||
auto addr = address.isValid() ? address : m_yValuesSummaryAddress->address();
|
||||
|
||||
RimEnsembleCurveSetCollection* coll;
|
||||
firstAncestorOrThisOfType( coll );
|
||||
RimEnsembleCurveSetCollection* coll = firstAncestorOrThisOfType<RimEnsembleCurveSetCollection>();
|
||||
|
||||
auto curveSet = coll ? coll->findCurveSetFromPlotCurve( m_plotCurve ) : nullptr;
|
||||
auto group = curveSet ? curveSet->summaryCaseCollection() : nullptr;
|
||||
@@ -1033,8 +1022,7 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::setDefaultCurveAppearance()
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( plot ) plot->applyDefaultCurveAppearances( { this } );
|
||||
}
|
||||
|
||||
@@ -1053,9 +1041,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
{
|
||||
RimStackablePlotCurve::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
CVF_ASSERT( plot );
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
|
||||
bool loadAndUpdate = false;
|
||||
bool crossPlotTestForMatchingTimeSteps = false;
|
||||
@@ -1244,9 +1230,7 @@ void RimSummaryCurve::loadAndUpdateDataAndPlot()
|
||||
{
|
||||
this->loadDataAndUpdate( true );
|
||||
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
firstAncestorOrThisOfType( plot );
|
||||
CVF_ASSERT( plot );
|
||||
auto plot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
|
||||
plot->updateAxes();
|
||||
plot->updatePlotTitle();
|
||||
|
||||
@@ -75,8 +75,7 @@ QString RimSummaryCurveAutoName::curveNameY( const RifEclipseSummaryAddress& sum
|
||||
const RimSummaryNameHelper* currentNameHelper,
|
||||
const RimSummaryNameHelper* plotNameHelper ) const
|
||||
{
|
||||
RimSummaryCurve* summaryCurve = nullptr;
|
||||
this->firstAncestorOrThisOfType( summaryCurve );
|
||||
auto summaryCurve = firstAncestorOrThisOfType<RimSummaryCurve>();
|
||||
|
||||
std::string unitNameY;
|
||||
if ( summaryCurve )
|
||||
@@ -91,8 +90,7 @@ QString RimSummaryCurveAutoName::curveNameY( const RifEclipseSummaryAddress& sum
|
||||
}
|
||||
|
||||
{
|
||||
RimEnsembleCurveSet* ensembleCurveSet = nullptr;
|
||||
this->firstAncestorOrThisOfType( ensembleCurveSet );
|
||||
auto ensembleCurveSet = firstAncestorOrThisOfType<RimEnsembleCurveSet>();
|
||||
if ( ensembleCurveSet && ensembleCurveSet->summaryCaseCollection() )
|
||||
{
|
||||
caseNameY = ensembleCurveSet->summaryCaseCollection()->name().toStdString();
|
||||
@@ -111,8 +109,7 @@ QString RimSummaryCurveAutoName::curveNameX( const RifEclipseSummaryAddress& sum
|
||||
const RimSummaryNameHelper* currentNameHelper,
|
||||
const RimSummaryNameHelper* plotNameHelper ) const
|
||||
{
|
||||
RimSummaryCurve* summaryCurve = nullptr;
|
||||
this->firstAncestorOrThisOfType( summaryCurve );
|
||||
auto summaryCurve = firstAncestorOrThisOfType<RimSummaryCurve>();
|
||||
|
||||
std::string unitNameX;
|
||||
if ( summaryCurve )
|
||||
@@ -127,8 +124,7 @@ QString RimSummaryCurveAutoName::curveNameX( const RifEclipseSummaryAddress& sum
|
||||
}
|
||||
|
||||
{
|
||||
RimEnsembleCurveSet* ensembleCurveSet = nullptr;
|
||||
this->firstAncestorOrThisOfType( ensembleCurveSet );
|
||||
auto ensembleCurveSet = firstAncestorOrThisOfType<RimEnsembleCurveSet>();
|
||||
if ( ensembleCurveSet && ensembleCurveSet->summaryCaseCollection() )
|
||||
{
|
||||
caseNameX = ensembleCurveSet->summaryCaseCollection()->name().toStdString();
|
||||
|
||||
@@ -115,8 +115,7 @@ void RimSummaryCurveCollection::loadDataAndUpdate( bool updateParentPlot )
|
||||
|
||||
if ( updateParentPlot )
|
||||
{
|
||||
RimSummaryPlot* parentPlot;
|
||||
firstAncestorOrThisOfTypeAsserted( parentPlot );
|
||||
auto parentPlot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
parentPlot->updateAll();
|
||||
}
|
||||
}
|
||||
@@ -133,8 +132,7 @@ void RimSummaryCurveCollection::onChildrenUpdated( caf::PdmChildArrayFieldHandle
|
||||
curve->updateCurveAppearance();
|
||||
}
|
||||
|
||||
RimSummaryPlot* parentPlot;
|
||||
firstAncestorOrThisOfTypeAsserted( parentPlot );
|
||||
auto parentPlot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
parentPlot->plotWidget()->scheduleReplot();
|
||||
}
|
||||
}
|
||||
@@ -252,7 +250,7 @@ void RimSummaryCurveCollection::removeCurve( RimSummaryCurve* curve )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryCurve*> RimSummaryCurveCollection::curves() const
|
||||
{
|
||||
return m_curves.children();
|
||||
return m_curves.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -362,8 +360,7 @@ void RimSummaryCurveCollection::updateCaseNameHasChanged()
|
||||
curve->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RimSummaryPlot* parentPlot;
|
||||
firstAncestorOrThisOfTypeAsserted( parentPlot );
|
||||
auto parentPlot = firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
|
||||
parentPlot->updatePlotTitle();
|
||||
if ( parentPlot->plotWidget() ) parentPlot->plotWidget()->updateLegend();
|
||||
@@ -384,9 +381,7 @@ void RimSummaryCurveCollection::setCurrentSummaryCurve( RimSummaryCurve* curve )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmFieldHandle*> RimSummaryCurveCollection::fieldsToShowInToolbar()
|
||||
{
|
||||
RimSummaryCrossPlot* parentCrossPlot;
|
||||
firstAncestorOrThisOfType( parentCrossPlot );
|
||||
|
||||
auto parentCrossPlot = firstAncestorOrThisOfType<RimSummaryCrossPlot>();
|
||||
if ( parentCrossPlot )
|
||||
{
|
||||
return m_unionSourceStepping->fieldsToShowInToolbar();
|
||||
@@ -463,8 +458,7 @@ void RimSummaryCurveCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha
|
||||
}
|
||||
else if ( changedField == &m_editPlot )
|
||||
{
|
||||
RimSummaryPlot* plot = nullptr;
|
||||
this->firstAncestorOrThisOfType( plot );
|
||||
auto plot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( plot )
|
||||
{
|
||||
RicEditSummaryPlotFeature::editSummaryPlot( plot );
|
||||
|
||||
@@ -71,7 +71,7 @@ void RimSummaryMultiPlotCollection::deleteAllPlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryMultiPlot*> RimSummaryMultiPlotCollection::multiPlots() const
|
||||
{
|
||||
return m_summaryMultiPlots.children();
|
||||
return m_summaryMultiPlots.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -97,7 +97,7 @@ void RimSummaryMultiPlotCollection::removePlotNoUpdate( RimSummaryMultiPlot* plo
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlotCollection::loadDataAndUpdateAllPlots()
|
||||
{
|
||||
for ( const auto& p : m_summaryMultiPlots.children() )
|
||||
for ( const auto& p : m_summaryMultiPlots.childrenByType() )
|
||||
p->loadDataAndUpdate();
|
||||
}
|
||||
|
||||
|
||||
@@ -359,11 +359,10 @@ QString RimSummaryPlot::asciiDataForPlotExport() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimSummaryPlot::asciiDataForSummaryPlotExport( RiaDefines::DateTimePeriod resamplingPeriod, bool showTimeAsLongString ) const
|
||||
{
|
||||
std::vector<RimSummaryCurve*> curves;
|
||||
this->descendantsIncludingThisOfType( curves );
|
||||
std::vector<RimSummaryCurve*> curves = descendantsIncludingThisOfType<RimSummaryCurve>();
|
||||
|
||||
auto gridCurves = m_gridTimeHistoryCurves.children();
|
||||
auto asciiCurves = m_asciiDataCurves.children();
|
||||
auto gridCurves = m_gridTimeHistoryCurves.childrenByType();
|
||||
auto asciiCurves = m_asciiDataCurves.childrenByType();
|
||||
|
||||
QString text = RimSummaryCurvesData::createTextForExport( curves, asciiCurves, gridCurves, resamplingPeriod, showTimeAsLongString );
|
||||
|
||||
@@ -438,9 +437,7 @@ void RimSummaryPlot::moveCurvesToPlot( RimSummaryPlot* plot, const std::vector<R
|
||||
|
||||
for ( auto curve : curves )
|
||||
{
|
||||
RimSummaryPlot* srcPlot = nullptr;
|
||||
|
||||
curve->firstAncestorOrThisOfTypeAsserted( srcPlot );
|
||||
auto srcPlot = curve->firstAncestorOrThisOfTypeAsserted<RimSummaryPlot>();
|
||||
|
||||
srcPlot->removeCurve( curve );
|
||||
srcPlots.insert( srcPlot );
|
||||
@@ -594,11 +591,10 @@ void RimSummaryPlot::updatePlotTitle()
|
||||
|
||||
if ( m_description().isEmpty() )
|
||||
{
|
||||
RimMultiPlot* plotWindow = nullptr;
|
||||
firstAncestorOrThisOfType( plotWindow );
|
||||
auto multiPlot = firstAncestorOrThisOfType<RimMultiPlot>();
|
||||
|
||||
size_t index = 0;
|
||||
if ( plotWindow ) index = plotWindow->plotIndex( this );
|
||||
if ( multiPlot ) index = multiPlot->plotIndex( this );
|
||||
|
||||
QString title = QString( "Sub Plot %1" ).arg( index + 1 );
|
||||
m_fallbackPlotName = title;
|
||||
@@ -1575,7 +1571,7 @@ void RimSummaryPlot::addGridTimeHistoryCurveNoUpdate( RimGridTimeHistoryCurve* c
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimGridTimeHistoryCurve*> RimSummaryPlot::gridTimeHistoryCurves() const
|
||||
{
|
||||
return m_gridTimeHistoryCurves.children();
|
||||
return m_gridTimeHistoryCurves.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1817,8 +1813,7 @@ void RimSummaryPlot::onLoadDataAndUpdate()
|
||||
{
|
||||
updatePlotTitle();
|
||||
|
||||
RimMultiPlot* plotWindow = nullptr;
|
||||
firstAncestorOrThisOfType( plotWindow );
|
||||
auto plotWindow = firstAncestorOrThisOfType<RimMultiPlot>();
|
||||
if ( plotWindow == nullptr ) updateMdiWindowVisibility();
|
||||
|
||||
if ( m_summaryCurveCollection )
|
||||
@@ -2980,8 +2975,7 @@ size_t RimSummaryPlot::curveCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryPlot::isDeletable() const
|
||||
{
|
||||
RimMultiPlot* plotWindow = nullptr;
|
||||
firstAncestorOrThisOfType( plotWindow );
|
||||
auto plotWindow = firstAncestorOrThisOfType<RimMultiPlot>();
|
||||
return plotWindow == nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ void RimSummaryPlotCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* ch
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryPlot*> RimSummaryPlotCollection::plots() const
|
||||
{
|
||||
return m_summaryPlots.children();
|
||||
return m_summaryPlots.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -447,7 +447,7 @@ void RimSummaryPlotManager::updateUiFromSelection()
|
||||
auto destinationObject = dynamic_cast<caf::PdmObjectHandle*>( caf::SelectionManager::instance()->selectedItem() );
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
if ( destinationObject ) destinationObject->firstAncestorOrThisOfType( summaryPlot );
|
||||
if ( destinationObject ) summaryPlot = destinationObject->firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
|
||||
if ( summaryPlot && ( m_summaryPlot() != summaryPlot ) )
|
||||
{
|
||||
|
||||
@@ -335,15 +335,13 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
|
||||
if ( changedField == &m_includeEnsembleCasesForCaseStepping )
|
||||
{
|
||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
||||
this->firstAncestorOrThisOfType( curveCollection );
|
||||
auto curveCollection = firstAncestorOrThisOfType<RimSummaryCurveCollection>();
|
||||
if ( curveCollection )
|
||||
{
|
||||
curveCollection->updateConnectedEditors();
|
||||
}
|
||||
|
||||
RimEnsembleCurveSetCollection* ensembleCurveColl = nullptr;
|
||||
this->firstAncestorOrThisOfType( ensembleCurveColl );
|
||||
auto ensembleCurveColl = firstAncestorOrThisOfType<RimEnsembleCurveSetCollection>();
|
||||
if ( ensembleCurveColl )
|
||||
{
|
||||
ensembleCurveColl->updateConnectedEditors();
|
||||
@@ -504,8 +502,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
|
||||
if ( triggerLoadDataAndUpdate )
|
||||
{
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( summaryPlot );
|
||||
auto summaryPlot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
|
||||
RimSummaryMultiPlot* summaryMultiPlot = dynamic_cast<RimSummaryMultiPlot*>( m_objectForSourceStepping.p() );
|
||||
if ( summaryMultiPlot )
|
||||
@@ -526,8 +523,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
summaryPlot->curvesChanged.send();
|
||||
}
|
||||
|
||||
RimEnsembleCurveSetCollection* ensembleCurveColl = nullptr;
|
||||
this->firstAncestorOrThisOfType( ensembleCurveColl );
|
||||
auto ensembleCurveColl = firstAncestorOrThisOfType<RimEnsembleCurveSetCollection>();
|
||||
if ( ensembleCurveColl )
|
||||
{
|
||||
ensembleCurveColl->updateConnectedEditors();
|
||||
@@ -538,8 +534,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle*
|
||||
{
|
||||
// Trigger update of curve collection (and summary toolbar in main window), as the visibility of combo
|
||||
// boxes might have been changed due to the updates in this function
|
||||
RimSummaryCurveCollection* curveCollection = nullptr;
|
||||
this->firstAncestorOrThisOfType( curveCollection );
|
||||
auto curveCollection = firstAncestorOrThisOfType<RimSummaryCurveCollection>();
|
||||
if ( curveCollection )
|
||||
{
|
||||
curveCollection->updateConnectedEditors();
|
||||
@@ -898,9 +893,7 @@ std::vector<RimSummaryCase*> RimSummaryPlotSourceStepping::summaryCasesForSource
|
||||
{
|
||||
if ( sumCase->isObservedData() ) continue;
|
||||
|
||||
RimSummaryCaseCollection* sumCaseColl = nullptr;
|
||||
sumCase->firstAncestorOrThisOfType( sumCaseColl );
|
||||
|
||||
auto sumCaseColl = sumCase->firstAncestorOrThisOfType<RimSummaryCaseCollection>();
|
||||
if ( sumCaseColl && sumCaseColl->isEnsemble() )
|
||||
{
|
||||
if ( m_includeEnsembleCasesForCaseStepping() )
|
||||
@@ -1287,8 +1280,7 @@ void RimSummaryPlotSourceStepping::updateVectorNameInCurves( std::vector<RimSumm
|
||||
|
||||
if ( m_autoUpdateAppearance )
|
||||
{
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
curve->firstAncestorOfType( summaryPlot );
|
||||
auto summaryPlot = curve->firstAncestorOfType<RimSummaryPlot>();
|
||||
if ( summaryPlot )
|
||||
{
|
||||
if ( curvesInPlot.count( summaryPlot ) )
|
||||
|
||||
@@ -80,7 +80,7 @@ size_t RimSummaryTableCollection::plotCount() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryTable*> RimSummaryTableCollection::tables() const
|
||||
{
|
||||
return m_summaryTables.children();
|
||||
return m_summaryTables.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -197,9 +197,7 @@ caf::FontTools::FontSize RimSummaryTimeAxisProperties::plotFontSize() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryTimeAxisProperties::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
RimSummaryMultiPlot* summaryMultiPlot = nullptr;
|
||||
firstAncestorOfType( summaryMultiPlot );
|
||||
|
||||
auto summaryMultiPlot = firstAncestorOfType<RimSummaryMultiPlot>();
|
||||
if ( summaryMultiPlot && summaryMultiPlot->isTimeAxisLinked() )
|
||||
{
|
||||
auto* treeItemAttribute = dynamic_cast<caf::PdmUiTreeViewItemAttribute*>( attribute );
|
||||
@@ -317,9 +315,8 @@ void RimSummaryTimeAxisProperties::updateDateVisibleRange()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QDateTime RimSummaryTimeAxisProperties::fromDisplayTimeToDate( double displayTime )
|
||||
{
|
||||
RimSummaryPlot* rimSummaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( rimSummaryPlot );
|
||||
time_t startOfSimulation = rimSummaryPlot->firstTimeStepOfFirstCurve();
|
||||
RimSummaryPlot* rimSummaryPlot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
time_t startOfSimulation = rimSummaryPlot->firstTimeStepOfFirstCurve();
|
||||
|
||||
time_t secsSinceSimulationStart = displayTime / fromTimeTToDisplayUnitScale();
|
||||
QDateTime date;
|
||||
@@ -335,9 +332,8 @@ double RimSummaryTimeAxisProperties::fromDateToDisplayTime( const QDateTime& dis
|
||||
{
|
||||
time_t secsSinceEpoc = displayTime.toSecsSinceEpoch();
|
||||
|
||||
RimSummaryPlot* rimSummaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( rimSummaryPlot );
|
||||
time_t startOfSimulation = rimSummaryPlot->firstTimeStepOfFirstCurve();
|
||||
RimSummaryPlot* rimSummaryPlot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
time_t startOfSimulation = rimSummaryPlot->firstTimeStepOfFirstCurve();
|
||||
|
||||
return fromTimeTToDisplayUnitScale() * ( secsSinceEpoc - startOfSimulation );
|
||||
}
|
||||
@@ -743,7 +739,7 @@ RiaDefines::TimeFormatComponents RimSummaryTimeAxisProperties::timeComponents( R
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimPlotAxisAnnotation*> RimSummaryTimeAxisProperties::annotations() const
|
||||
{
|
||||
return m_annotations.children();
|
||||
return m_annotations.childrenByType();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -851,8 +847,7 @@ void RimSummaryTimeAxisProperties::defineUiOrdering( QString uiConfigName, caf::
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryTimeAxisProperties::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
RimSummaryPlot* rimSummaryPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( rimSummaryPlot );
|
||||
RimSummaryPlot* rimSummaryPlot = firstAncestorOrThisOfType<RimSummaryPlot>();
|
||||
if ( !rimSummaryPlot ) return;
|
||||
|
||||
if ( changedField == &m_visibleDateRangeMax )
|
||||
|
||||
Reference in New Issue
Block a user