diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 7bef9598e1..86e2b1df0b 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -690,9 +690,7 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct } { - std::vector views; - m_project->allViews( views ); - + std::vector views = m_project->allViews(); for ( auto view : views ) { if ( auto eclipseView = dynamic_cast( view ) ) diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicNewValveTemplateFeature.cpp b/ApplicationLibCode/Commands/CompletionCommands/RicNewValveTemplateFeature.cpp index 30f846cf87..01deef6656 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicNewValveTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/CompletionCommands/RicNewValveTemplateFeature.cpp @@ -50,9 +50,7 @@ void RicNewValveTemplateFeature::selectValveTemplateAndUpdate( RimValveTemplate* RimProject* project = RimProject::current(); - std::vector views; - project->allVisibleViews( views ); - + std::vector views = project->allVisibleViews(); for ( Rim3dView* view : views ) { if ( dynamic_cast( view ) ) diff --git a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.cpp b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.cpp index fd3406b999..2fab89dc56 100644 --- a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.cpp +++ b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.cpp @@ -74,9 +74,7 @@ QList RicHoloLensExportToFolderUi::calculateValueOptions if ( fieldNeedingOptions == &m_viewForExport ) { - std::vector visibleViews; - RimProject::current()->allVisibleGridViews( visibleViews ); - + std::vector visibleViews = RimProject::current()->allVisibleGridViews(); for ( RimGridView* v : visibleViews ) { RiaOptionItemFactory::appendOptionItemFromViewNameAndCaseName( v, &options ); diff --git a/ApplicationLibCode/Commands/RicExportContourMapToTextFeature.cpp b/ApplicationLibCode/Commands/RicExportContourMapToTextFeature.cpp index 7d09675933..8773dd0450 100644 --- a/ApplicationLibCode/Commands/RicExportContourMapToTextFeature.cpp +++ b/ApplicationLibCode/Commands/RicExportContourMapToTextFeature.cpp @@ -277,10 +277,8 @@ caf::PdmScriptResponse RicExportContourMapToTextFeature::execute() RimProject* proj = app->project(); CAF_ASSERT( proj ); - std::vector allViews; - proj->allViews( allViews ); - - Rim3dView* myView = nullptr; + std::vector allViews = proj->allViews(); + Rim3dView* myView = nullptr; for ( auto view : allViews ) { if ( m_viewId == view->id() ) diff --git a/ApplicationLibCode/Commands/RicWellMeasurementImportTools.cpp b/ApplicationLibCode/Commands/RicWellMeasurementImportTools.cpp index 9f2f650c85..2906b7a661 100644 --- a/ApplicationLibCode/Commands/RicWellMeasurementImportTools.cpp +++ b/ApplicationLibCode/Commands/RicWellMeasurementImportTools.cpp @@ -102,8 +102,7 @@ void RicWellMeasurementImportTools::importWellMeasurementsFromFiles( const QStri auto proj = RimProject::current(); if ( proj ) { - std::vector views; - proj->allViews( views ); + std::vector views = proj->allViews(); for ( auto& view : views ) { RimGridView* gridView = dynamic_cast( view ); diff --git a/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.cpp b/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.cpp index 061321542c..c0d21855dc 100644 --- a/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.cpp +++ b/ApplicationLibCode/Commands/SeismicCommands/RicNewSeismicViewFeature.cpp @@ -85,8 +85,7 @@ RimSeismicView* RicNewSeismicViewFeature::createInitialViewIfNeeded( RimSeismicD { auto proj = RimProject::current(); - std::vector views; - proj->allViews( views ); + std::vector views = proj->allViews(); if ( !views.empty() ) return nullptr; return createSeismicView( seisData ); diff --git a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp index a1b68fb873..d6295c11c2 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp +++ b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp @@ -44,15 +44,13 @@ bool RicLinkVisibleViewsFeature::isCommandEnabled() const RimProject* proj = RimProject::current(); if ( !proj ) return false; - std::vector visibleViews; - proj->allVisibleViews( visibleViews ); - std::vector linkedviews; if ( proj->viewLinkerCollection() && proj->viewLinkerCollection()->viewLinker() ) { linkedviews = proj->viewLinkerCollection()->viewLinker()->allViews(); } + std::vector visibleViews = proj->allVisibleViews(); if ( visibleViews.size() >= 2 && ( linkedviews.size() < visibleViews.size() ) ) { return !findLinkableVisibleViews().empty(); @@ -88,9 +86,7 @@ std::vector RicLinkVisibleViewsFeature::findLinkableVisibleViews() std::vector views; - std::vector candidates; - proj->allVisibleViews( candidates ); - + std::vector candidates = proj->allVisibleViews(); for ( auto gridView : candidates ) { if ( gridView && !gridView->assosiatedViewLinker() ) views.push_back( gridView ); diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicNewPolylineTargetFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicNewPolylineTargetFeature.cpp index eec85c6ce3..0bf3de1c30 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicNewPolylineTargetFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicNewPolylineTargetFeature.cpp @@ -133,8 +133,7 @@ void RicNewPolylineTargetFeature::onActionTriggered( bool isChecked ) } else { - std::vector gridViews; - RimProject::current()->allVisibleGridViews( gridViews ); + std::vector gridViews = RimProject::current()->allVisibleGridViews(); if ( !gridViews.empty() ) { auto minPos = gridViews.front()->ownerCase()->allCellsBoundingBox().min(); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp index 79d1e39d19..7a39002cd6 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp @@ -132,9 +132,7 @@ std::vector RimAnnotationCollectionBase::viewsContainingAnnotations( RimProject* project = RimProject::current(); if ( !project ) return {}; - std::vector views; - project->allViews( views ); - return views; + return project->allViews(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp index 70111e999a..2b06de3325 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp @@ -316,8 +316,7 @@ void RimFractureTemplateCollection::onChildDeleted( caf::PdmChildArrayFieldHandl proj->scheduleCreateDisplayModelAndRedrawAllViews(); } - std::vector views; - proj->allVisibleViews( views ); + std::vector views = proj->allVisibleViews(); for ( Rim3dView* visibleView : views ) { if ( dynamic_cast( visibleView ) ) diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonCollection.cpp b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonCollection.cpp index ee52064c39..96c30a8218 100644 --- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonCollection.cpp @@ -189,8 +189,7 @@ void RimPolygonCollection::updateViewTreeItems() RimProject* proj = RimProject::current(); // Make sure the tree items are synchronized - std::vector views; - proj->allViews( views ); + std::vector views = proj->allViews(); for ( auto view : views ) { view->updateViewTreeItems( RiaDefines::ItemIn3dView::POLYGON ); diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 8d98b5067c..00ee9e06a9 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -197,9 +197,7 @@ Rim3dView::~Rim3dView() if ( auto proj = RimProject::current() ) { - std::vector allViews; - proj->allViews( allViews ); - + std::vector allViews = proj->allViews(); for ( auto v : allViews ) { if ( v->activeComparisonView() == this ) @@ -591,8 +589,7 @@ std::vector Rim3dView::validComparisonViews() const { auto isIntersectionView = []( const Rim3dView* view ) { return dynamic_cast( view ) != nullptr; }; - std::vector views; - RimProject::current()->allViews( views ); + std::vector views = RimProject::current()->allViews(); std::vector validComparisonViews; for ( auto view : views ) diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp index 7160b3d9ed..0dfe24312f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp @@ -344,9 +344,6 @@ QList RimGridCalculation::calculateValueOptions( const c { options.push_back( caf::PdmOptionItemInfo( "Disabled", nullptr ) ); - std::vector views; - RimProject::current()->allViews( views ); - RimEclipseCase* firstEclipseCase = nullptr; if ( !inputCases().empty() ) { @@ -361,6 +358,7 @@ QList RimGridCalculation::calculateValueOptions( const c if ( firstEclipseCase ) { + std::vector views = RimProject::current()->allViews(); for ( auto* view : views ) { auto eclipseView = dynamic_cast( view ); diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 2fa9253844..be14bb558e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -737,16 +737,17 @@ RimSummaryCaseMainCollection* RimProject::firstSummaryCaseMainCollection() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimProject::allNotLinkedViews( std::vector& views ) +std::vector RimProject::allNotLinkedViews() const { - std::vector cases = allGridCases(); - std::vector alreadyLinkedViews; if ( viewLinkerCollection->viewLinker() ) { alreadyLinkedViews = viewLinkerCollection->viewLinker()->allViews(); } + std::vector views; + + std::vector cases = allGridCases(); for ( size_t caseIdx = 0; caseIdx < cases.size(); caseIdx++ ) { RimCase* rimCase = cases[caseIdx]; @@ -773,15 +774,18 @@ void RimProject::allNotLinkedViews( std::vector& views ) } } } + + return views; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimProject::allViews( std::vector& views ) const +std::vector RimProject::allViews() const { - std::vector cases = allGridCases(); + std::vector views; + std::vector cases = allGridCases(); for ( size_t caseIdx = 0; caseIdx < cases.size(); caseIdx++ ) { RimCase* rimCase = cases[caseIdx]; @@ -808,15 +812,18 @@ void RimProject::allViews( std::vector& views ) const views.push_back( seisview ); } } + + return views; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimProject::allVisibleViews( std::vector& views ) const +std::vector RimProject::allVisibleViews() const { - std::vector cases = allGridCases(); + std::vector views; + std::vector cases = allGridCases(); for ( size_t caseIdx = 0; caseIdx < cases.size(); caseIdx++ ) { RimCase* rimCase = cases[caseIdx]; @@ -831,20 +838,24 @@ void RimProject::allVisibleViews( std::vector& views ) const } } } + + return views; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimProject::allVisibleGridViews( std::vector& views ) const +std::vector RimProject::allVisibleGridViews() const { - std::vector visibleViews; - allVisibleViews( visibleViews ); + std::vector views; + std::vector visibleViews = allVisibleViews(); for ( Rim3dView* view : visibleViews ) { RimGridView* gridView = dynamic_cast( view ); if ( gridView ) views.push_back( gridView ); } + + return views; } //-------------------------------------------------------------------------------------------------- @@ -878,13 +889,9 @@ void RimProject::scheduleCreateDisplayModelAndRedrawAllViews() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimProject::allOilFields( std::vector& allOilFields ) const +std::vector RimProject::allOilFields() const { - allOilFields.clear(); - for ( const auto& oilField : oilFields ) - { - allOilFields.push_back( oilField ); - } + return oilFields.childrenByType(); } //-------------------------------------------------------------------------------------------------- @@ -1176,8 +1183,7 @@ std::vector RimProject::textAnnotations() const } // 'Local' text annotations - std::vector visibleViews; - allVisibleGridViews( visibleViews ); + std::vector visibleViews = allVisibleGridViews(); for ( const auto& view : visibleViews ) { std::vector annotationColls = view->descendantsIncludingThisOfType(); @@ -1263,9 +1269,7 @@ std::vector RimProject::geoMechCases() const std::vector RimProject::allFractureTemplateCollections() const { std::vector templColls; - std::vector rimOilFields; - - allOilFields( rimOilFields ); + std::vector rimOilFields = allOilFields(); for ( RimOilField* oilField : rimOilFields ) { templColls.push_back( oilField->fractureDefinitionCollection() ); @@ -1295,9 +1299,7 @@ std::vector RimProject::allFractureTemplates() const std::vector RimProject::allValveTemplateCollections() const { std::vector templColls; - std::vector rimOilFields; - - allOilFields( rimOilFields ); + std::vector rimOilFields = allOilFields(); for ( RimOilField* oilField : rimOilFields ) { templColls.push_back( oilField->valveTemplateCollection() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.h b/ApplicationLibCode/ProjectDataModel/RimProject.h index ab87066486..6dbbcfe9d9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.h +++ b/ApplicationLibCode/ProjectDataModel/RimProject.h @@ -137,18 +137,18 @@ public: std::vector summaryGroups() const; RimSummaryCaseMainCollection* firstSummaryCaseMainCollection() const; - void allViews( std::vector& views ) const; - void allVisibleViews( std::vector& views ) const; - void allVisibleGridViews( std::vector& views ) const; - void allNotLinkedViews( std::vector& views ); + [[nodiscard]] std::vector allViews() const; + [[nodiscard]] std::vector allVisibleViews() const; + [[nodiscard]] std::vector allVisibleGridViews() const; + [[nodiscard]] std::vector allNotLinkedViews() const; void scheduleCreateDisplayModelAndRedrawAllViews(); void computeUtmAreaOfInterest(); - void allOilFields( std::vector& allOilFields ) const; - RimOilField* activeOilField(); - const RimOilField* activeOilField() const; + [[nodiscard]] std::vector allOilFields() const; + RimOilField* activeOilField(); + const RimOilField* activeOilField() const; void actionsBasedOnSelection( QMenu& contextMenu ); diff --git a/ApplicationLibCode/ProjectDataModel/RimViewController.cpp b/ApplicationLibCode/ProjectDataModel/RimViewController.cpp index 3e0f249dc2..1014876c87 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewController.cpp @@ -108,9 +108,8 @@ QList RimViewController::calculateValueOptions( const ca if ( fieldNeedingOptions == &m_managedView ) { - RimProject* proj = RimProject::current(); - std::vector views; - proj->allNotLinkedViews( views ); + RimProject* proj = RimProject::current(); + std::vector views = proj->allNotLinkedViews(); // Add currently linked view to list if ( managedView() ) diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataCollection.cpp b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataCollection.cpp index 935f165949..36ee35519c 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicDataCollection.cpp @@ -109,10 +109,8 @@ void RimSeismicDataCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* ch //-------------------------------------------------------------------------------------------------- void RimSeismicDataCollection::updateViews() { - RimProject* proj = RimProject::current(); - std::vector views; - proj->allVisibleGridViews( views ); - + RimProject* proj = RimProject::current(); + std::vector views = proj->allVisibleGridViews(); for ( auto view : views ) { view->scheduleCreateDisplayModelAndRedraw(); @@ -127,8 +125,7 @@ void RimSeismicDataCollection::updateTreeForAllViews() RimProject* proj = RimProject::current(); if ( proj != nullptr ) { - std::vector views; - proj->allVisibleGridViews( views ); + std::vector views = proj->allVisibleGridViews(); for ( auto view : views ) { view->updateAllRequiredEditors(); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp index b9b819be84..b024a6e570 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp @@ -132,8 +132,7 @@ void RimStimPlanModelTemplateCollection::onChildDeleted( caf::PdmChildArrayField proj->scheduleCreateDisplayModelAndRedrawAllViews(); } - std::vector views; - proj->allVisibleViews( views ); + std::vector views = proj->allVisibleViews(); for ( Rim3dView* visibleView : views ) { if ( dynamic_cast( visibleView ) ) diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp index 6332511ee5..f577a3746b 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp @@ -298,8 +298,7 @@ void RimSurfaceCollection::updateViews( const std::vector& surfsToR RimProject* proj = RimProject::current(); // Make sure the tree items are synchronized - std::vector views; - proj->allViews( views ); + std::vector views = proj->allViews(); for ( auto view : views ) { view->updateViewTreeItems( RiaDefines::ItemIn3dView::SURFACE ); @@ -347,9 +346,8 @@ void RimSurfaceCollection::updateViews( const std::vector& surfsToR //-------------------------------------------------------------------------------------------------- void RimSurfaceCollection::updateViews() { - RimProject* proj = RimProject::current(); - std::vector views; - proj->allViews( views ); + RimProject* proj = RimProject::current(); + std::vector views = proj->allViews(); // Make sure the tree items are synchronized diff --git a/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp b/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp index 62c7a5a7c4..f44f9e195c 100644 --- a/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp +++ b/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp @@ -325,8 +325,7 @@ void RiuSelectionChangedHandler::scheduleUpdateForAllVisibleViews() const RimProject* proj = RimProject::current(); if ( proj ) { - std::vector visibleViews; - proj->allVisibleViews( visibleViews ); + std::vector visibleViews = proj->allVisibleViews(); for ( size_t i = 0; i < visibleViews.size(); i++ ) { diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp index 8e08798a76..046059581d 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp @@ -552,10 +552,8 @@ QList { QList options; - RimProject* proj = RimProject::current(); - std::vector oilFields; - - proj->allOilFields( oilFields ); + RimProject* proj = RimProject::current(); + std::vector oilFields = proj->allOilFields(); for ( RimOilField* oilField : oilFields ) { RimSummaryCaseMainCollection* sumCaseMainColl = oilField->summaryCaseMainCollection();