diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index da409da9f5..869ec9af12 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -528,7 +528,7 @@ bool RiaApplication::loadProject( const QString& projectFileName, } { - RimMainPlotCollection* mainPlotColl = m_project->mainPlotCollection(); + RimMainPlotCollection* mainPlotColl = RimMainPlotCollection::current(); mainPlotColl->ensureCalculationIdsAreAssigned(); mainPlotColl->ensureDefaultFlowPlotsAreCreated(); @@ -1532,10 +1532,7 @@ int RiaApplication::launchUnitTestsWithConsole() //-------------------------------------------------------------------------------------------------- void RiaApplication::loadAndUpdatePlotData() { - if ( m_project->mainPlotCollection() ) - { - m_project->mainPlotCollection()->loadDataAndUpdateAllPlots(); - } + RimMainPlotCollection::current()->loadDataAndUpdateAllPlots(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaExtractionTools.cpp b/ApplicationLibCode/Application/Tools/RiaExtractionTools.cpp index 85c25cc1f2..9f50065a48 100644 --- a/ApplicationLibCode/Application/Tools/RiaExtractionTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaExtractionTools.cpp @@ -21,7 +21,6 @@ #include "RigWellPath.h" #include "RimEclipseCase.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RimSimWellInView.h" #include "RimWellLogPlotCollection.h" @@ -84,12 +83,5 @@ RigEclipseWellLogExtractor* RiaExtractionTools::findOrCreateSimWellExtractor( co //-------------------------------------------------------------------------------------------------- RimWellLogPlotCollection* RiaExtractionTools::wellLogPlotCollection() { - auto proj = RimProject::current(); - if ( !proj ) return nullptr; - - auto plotCollection = proj->mainPlotCollection(); - if ( !plotCollection ) return nullptr; - - auto wellLogPlotCollection = plotCollection->wellLogPlotCollection(); - return wellLogPlotCollection; + return RimMainPlotCollection::current()->wellLogPlotCollection(); } diff --git a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp index 211199f370..569e8365c1 100644 --- a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp @@ -97,10 +97,7 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList& if ( !openedFiles.empty() ) { - if ( project && project->mainPlotCollection() ) - { - project->mainPlotCollection()->ensureDefaultFlowPlotsAreCreated(); - } + RimMainPlotCollection::current()->ensureDefaultFlowPlotsAreCreated(); } // Import summary cases diff --git a/ApplicationLibCode/Application/Tools/RiaOptionItemFactory.cpp b/ApplicationLibCode/Application/Tools/RiaOptionItemFactory.cpp index 35d3f9f61c..647a0db844 100644 --- a/ApplicationLibCode/Application/Tools/RiaOptionItemFactory.cpp +++ b/ApplicationLibCode/Application/Tools/RiaOptionItemFactory.cpp @@ -22,7 +22,6 @@ #include "RimCase.h" #include "RimEnsembleCurveSet.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" //-------------------------------------------------------------------------------------------------- /// @@ -46,7 +45,7 @@ void RiaOptionItemFactory::appendOptionItemsForEnsembleCurveSets( QListpush_back( caf::PdmOptionItemInfo( "None", nullptr ) ); - RimMainPlotCollection* mainPlotColl = RimProject::current()->mainPlotCollection(); + RimMainPlotCollection* mainPlotColl = RimMainPlotCollection::current(); std::vector ensembleCurveSets; mainPlotColl->descendantsOfType( ensembleCurveSets ); for ( auto ensembleCurveSet : ensembleCurveSets ) diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp index 8c43701ea3..9e8e8129db 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp @@ -49,9 +49,7 @@ //-------------------------------------------------------------------------------------------------- RimSummaryMultiPlotCollection* RiaSummaryTools::summaryMultiPlotCollection() { - RimProject* project = RimProject::current(); - - return project->mainPlotCollection()->summaryMultiPlotCollection(); + return RimMainPlotCollection::current()->summaryMultiPlotCollection(); } //-------------------------------------------------------------------------------------------------- @@ -59,9 +57,7 @@ RimSummaryMultiPlotCollection* RiaSummaryTools::summaryMultiPlotCollection() //-------------------------------------------------------------------------------------------------- RimSummaryCrossPlotCollection* RiaSummaryTools::summaryCrossPlotCollection() { - RimProject* project = RimProject::current(); - - return project->mainPlotCollection()->summaryCrossPlotCollection(); + return RimMainPlotCollection::current()->summaryCrossPlotCollection(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfCreateSaturationPressurePlots.cpp b/ApplicationLibCode/CommandFileInterface/RicfCreateSaturationPressurePlots.cpp index 970ea54de0..2457d3416e 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfCreateSaturationPressurePlots.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfCreateSaturationPressurePlots.cpp @@ -91,7 +91,7 @@ caf::PdmScriptResponse RicfCreateSaturationPressurePlots::execute() } } - RimSaturationPressurePlotCollection* collection = project->mainPlotCollection()->saturationPressurePlotCollection(); + RimSaturationPressurePlotCollection* collection = RimMainPlotCollection::current()->saturationPressurePlotCollection(); collection->updateAllRequiredEditors(); RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow(); diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportFlowCharacteristics.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportFlowCharacteristics.cpp index 954c246ff1..a3b9b1ef64 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportFlowCharacteristics.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportFlowCharacteristics.cpp @@ -27,7 +27,6 @@ #include "RimFlowCharacteristicsPlot.h" #include "RimFlowPlotCollection.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "cafPdmFieldScriptingCapability.h" @@ -88,7 +87,7 @@ caf::PdmScriptResponse RicfExportFlowCharacteristics::execute() exportFileName = exportFolder + "/" + fi.fileName(); } - RimFlowPlotCollection* flowPlotColl = RimProject::current()->mainPlotCollection->flowPlotCollection(); + RimFlowPlotCollection* flowPlotColl = RimMainPlotCollection::current()->flowPlotCollection(); if ( flowPlotColl ) { RimFlowCharacteristicsPlot* plot = flowPlotColl->defaultFlowCharacteristicsPlot(); diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp index a446daaa2b..6674d07271 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp +++ b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp @@ -37,7 +37,6 @@ #include "RimFaciesProperties.h" #include "RimMainPlotCollection.h" #include "RimModeledWellPath.h" -#include "RimProject.h" #include "RimStimPlanModel.h" #include "RimStimPlanModelCurve.h" #include "RimStimPlanModelPlot.h" @@ -469,16 +468,7 @@ RimStimPlanModelPlot* RicNewStimPlanModelPlotFeature::createStimPlanModelPlot( b //-------------------------------------------------------------------------------------------------- RimStimPlanModelPlotCollection* RicNewStimPlanModelPlotFeature::stimPlanModelPlotCollection() { - RimProject* project = RiaApplication::instance()->project(); - CVF_ASSERT( project ); - - RimMainPlotCollection* mainPlotColl = project->mainPlotCollection(); - CVF_ASSERT( mainPlotColl ); - - RimStimPlanModelPlotCollection* stimPlanModelPlotColl = mainPlotColl->stimPlanModelPlotCollection(); - CVF_ASSERT( stimPlanModelPlotColl ); - - return mainPlotColl->stimPlanModelPlotCollection(); + return RimMainPlotCollection::current()->stimPlanModelPlotCollection(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp index 737184d716..becdce76f3 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp @@ -87,7 +87,7 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( const QS const QString absSnapshotPath = snapshotPath.absolutePath(); std::vector viewWindows; - proj->mainPlotCollection()->descendantsIncludingThisOfType( viewWindows ); + RimMainPlotCollection::current()->descendantsIncludingThisOfType( viewWindows ); for ( auto viewWindow : viewWindows ) { diff --git a/ApplicationLibCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.cpp index 4c71357e59..18bcd70f6c 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.cpp @@ -21,7 +21,6 @@ #include "RimFlowCharacteristicsPlot.h" #include "RimFlowPlotCollection.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RiuPlotMainWindowTools.h" @@ -38,18 +37,15 @@ CAF_CMD_SOURCE_INIT( RicAddStoredFlowCharacteristicsPlotFeature, "RicAddStoredFl //-------------------------------------------------------------------------------------------------- bool RicAddStoredFlowCharacteristicsPlotFeature::isCommandEnabled() { - if ( RimProject::current() ) + RimFlowPlotCollection* flowPlotColl = RimMainPlotCollection::current()->flowPlotCollection(); + if ( flowPlotColl ) { - RimFlowPlotCollection* flowPlotColl = RimProject::current()->mainPlotCollection->flowPlotCollection(); - if ( flowPlotColl ) - { - RimFlowCharacteristicsPlot* flowCharacteristicsPlot = - dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); + RimFlowCharacteristicsPlot* flowCharacteristicsPlot = + dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); - if ( flowPlotColl->defaultFlowCharacteristicsPlot() == flowCharacteristicsPlot ) - { - return true; - } + if ( flowPlotColl->defaultFlowCharacteristicsPlot() == flowCharacteristicsPlot ) + { + return true; } } @@ -61,28 +57,25 @@ bool RicAddStoredFlowCharacteristicsPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicAddStoredFlowCharacteristicsPlotFeature::onActionTriggered( bool isChecked ) { - if ( RimProject::current() ) + RimFlowPlotCollection* flowPlotColl = RimMainPlotCollection::current()->flowPlotCollection(); + if ( flowPlotColl ) { - RimFlowPlotCollection* flowPlotColl = RimProject::current()->mainPlotCollection->flowPlotCollection(); - if ( flowPlotColl ) - { - RimFlowCharacteristicsPlot* sourceObject = - dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); + RimFlowCharacteristicsPlot* sourceObject = + dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); - RimFlowCharacteristicsPlot* flowCharacteristicsPlot = dynamic_cast( - sourceObject->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); - CVF_ASSERT( flowCharacteristicsPlot ); + RimFlowCharacteristicsPlot* flowCharacteristicsPlot = dynamic_cast( + sourceObject->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + CVF_ASSERT( flowCharacteristicsPlot ); - flowPlotColl->addFlowCharacteristicsPlotToStoredPlots( flowCharacteristicsPlot ); - flowCharacteristicsPlot->resolveReferencesRecursively(); + flowPlotColl->addFlowCharacteristicsPlotToStoredPlots( flowCharacteristicsPlot ); + flowCharacteristicsPlot->resolveReferencesRecursively(); - flowCharacteristicsPlot->loadDataAndUpdate(); + flowCharacteristicsPlot->loadDataAndUpdate(); - flowPlotColl->updateConnectedEditors(); + flowPlotColl->updateConnectedEditors(); - RiuPlotMainWindowTools::showPlotMainWindow(); - RiuPlotMainWindowTools::onObjectAppended( flowCharacteristicsPlot ); - } + RiuPlotMainWindowTools::showPlotMainWindow(); + RiuPlotMainWindowTools::onObjectAppended( flowCharacteristicsPlot ); } } diff --git a/ApplicationLibCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp index f1297e64e6..045f966eb1 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp @@ -38,18 +38,15 @@ CAF_CMD_SOURCE_INIT( RicAddStoredWellAllocationPlotFeature, "RicAddStoredWellAll //-------------------------------------------------------------------------------------------------- bool RicAddStoredWellAllocationPlotFeature::isCommandEnabled() { - if ( RimProject::current() ) + RimFlowPlotCollection* flowPlotColl = RimMainPlotCollection::current()->flowPlotCollection(); + if ( flowPlotColl ) { - RimFlowPlotCollection* flowPlotColl = RimProject::current()->mainPlotCollection->flowPlotCollection(); - if ( flowPlotColl ) - { - RimWellAllocationPlot* wellAllocationPlot = - dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); + RimWellAllocationPlot* wellAllocationPlot = + dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); - if ( flowPlotColl->defaultWellAllocPlot() == wellAllocationPlot ) - { - return true; - } + if ( flowPlotColl->defaultWellAllocPlot() == wellAllocationPlot ) + { + return true; } } @@ -61,28 +58,25 @@ bool RicAddStoredWellAllocationPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicAddStoredWellAllocationPlotFeature::onActionTriggered( bool isChecked ) { - if ( RimProject::current() ) + RimFlowPlotCollection* flowPlotColl = RimMainPlotCollection::current()->flowPlotCollection(); + if ( flowPlotColl ) { - RimFlowPlotCollection* flowPlotColl = RimProject::current()->mainPlotCollection->flowPlotCollection(); - if ( flowPlotColl ) - { - RimWellAllocationPlot* sourceObject = - dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); + RimWellAllocationPlot* sourceObject = + dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); - RimWellAllocationPlot* wellAllocationPlot = dynamic_cast( - sourceObject->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + RimWellAllocationPlot* wellAllocationPlot = dynamic_cast( + sourceObject->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); - CVF_ASSERT( wellAllocationPlot ); + CVF_ASSERT( wellAllocationPlot ); - flowPlotColl->addWellAllocPlotToStoredPlots( wellAllocationPlot ); - wellAllocationPlot->resolveReferencesRecursively(); + flowPlotColl->addWellAllocPlotToStoredPlots( wellAllocationPlot ); + wellAllocationPlot->resolveReferencesRecursively(); - wellAllocationPlot->loadDataAndUpdate(); + wellAllocationPlot->loadDataAndUpdate(); - flowPlotColl->updateConnectedEditors(); + flowPlotColl->updateConnectedEditors(); - RiuPlotMainWindowTools::onObjectAppended( wellAllocationPlot ); - } + RiuPlotMainWindowTools::onObjectAppended( wellAllocationPlot ); } } diff --git a/ApplicationLibCode/Commands/FlowCommands/RicShowCumulativePhasePlotFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicShowCumulativePhasePlotFeature.cpp index 24be96ce2f..e197d65675 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicShowCumulativePhasePlotFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicShowCumulativePhasePlotFeature.cpp @@ -22,7 +22,6 @@ #include "RimEclipseView.h" #include "RimFlowPlotCollection.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RimSimWellInView.h" #include "RimWellAllocationPlot.h" #include "RimWellDistributionPlotCollection.h" @@ -72,10 +71,7 @@ void RicShowCumulativePhasePlotFeature::onActionTriggered( bool isChecked ) } } - RimProject* proj = RimProject::current(); - if ( !proj ) return; - - RimFlowPlotCollection* flowPlotColl = proj->mainPlotCollection()->flowPlotCollection(); + RimFlowPlotCollection* flowPlotColl = RimMainPlotCollection::current()->flowPlotCollection(); if ( !flowPlotColl ) return; RimWellDistributionPlotCollection* wdp = flowPlotColl->wellDistributionPlotCollection(); diff --git a/ApplicationLibCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.cpp index 7e2ea1e591..bb3a5c60b9 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.cpp @@ -30,7 +30,6 @@ #include "RimFlowDiagSolution.h" #include "RimFlowPlotCollection.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RiuPlotMainWindowTools.h" @@ -86,18 +85,15 @@ void RicShowFlowCharacteristicsPlotFeature::onActionTriggered( bool isChecked ) } } - if ( RimProject::current() ) + RimFlowPlotCollection* flowPlotColl = RimMainPlotCollection::current()->flowPlotCollection(); + if ( flowPlotColl ) { - RimFlowPlotCollection* flowPlotColl = RimProject::current()->mainPlotCollection->flowPlotCollection(); - if ( flowPlotColl ) - { - RiuPlotMainWindowTools::showPlotMainWindow(); + RiuPlotMainWindowTools::showPlotMainWindow(); - flowPlotColl->defaultFlowCharacteristicsPlot()->setFromFlowSolution( eclCase->defaultFlowDiagSolution() ); - flowPlotColl->defaultFlowCharacteristicsPlot()->updateConnectedEditors(); + flowPlotColl->defaultFlowCharacteristicsPlot()->setFromFlowSolution( eclCase->defaultFlowDiagSolution() ); + flowPlotColl->defaultFlowCharacteristicsPlot()->updateConnectedEditors(); - RiuPlotMainWindowTools::onObjectAppended( flowPlotColl->defaultFlowCharacteristicsPlot() ); - } + RiuPlotMainWindowTools::onObjectAppended( flowPlotColl->defaultFlowCharacteristicsPlot() ); } } } diff --git a/ApplicationLibCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp index 2acbcf571f..cd11add6a0 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.cpp @@ -22,19 +22,18 @@ #include "Rim3dView.h" #include "RimEclipseResultCase.h" +#include "RimEclipseView.h" #include "RimFlowPlotCollection.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RimSimWellInView.h" +#include "RimSimWellInViewCollection.h" #include "RimWellAllocationPlot.h" +#include "RimWellPath.h" #include "RiuPlotMainWindowTools.h" #include "cafSelectionManager.h" -#include "RimEclipseView.h" -#include "RimSimWellInViewCollection.h" -#include "RimWellPath.h" #include CAF_CMD_SOURCE_INIT( RicShowWellAllocationPlotFeature, "RicShowWellAllocationPlotFeature" ); @@ -103,17 +102,14 @@ void RicShowWellAllocationPlotFeature::onActionTriggered( bool isChecked ) else return; - if ( RimProject::current() ) + RimFlowPlotCollection* flowPlotColl = RimMainPlotCollection::current()->flowPlotCollection(); + if ( flowPlotColl ) { - RimFlowPlotCollection* flowPlotColl = RimProject::current()->mainPlotCollection->flowPlotCollection(); - if ( flowPlotColl ) - { - flowPlotColl->defaultWellAllocPlot()->setFromSimulationWell( simWell ); - flowPlotColl->defaultWellAllocPlot()->updateConnectedEditors(); + flowPlotColl->defaultWellAllocPlot()->setFromSimulationWell( simWell ); + flowPlotColl->defaultWellAllocPlot()->updateConnectedEditors(); - RiuPlotMainWindowTools::showPlotMainWindow(); - RiuPlotMainWindowTools::onObjectAppended( flowPlotColl->defaultWellAllocPlot() ); - } + RiuPlotMainWindowTools::showPlotMainWindow(); + RiuPlotMainWindowTools::onObjectAppended( flowPlotColl->defaultWellAllocPlot() ); } } diff --git a/ApplicationLibCode/Commands/GridCrossPlotCommands/RicCreateGridCrossPlotFeature.cpp b/ApplicationLibCode/Commands/GridCrossPlotCommands/RicCreateGridCrossPlotFeature.cpp index eeed0ccaf7..2c122d7907 100644 --- a/ApplicationLibCode/Commands/GridCrossPlotCommands/RicCreateGridCrossPlotFeature.cpp +++ b/ApplicationLibCode/Commands/GridCrossPlotCommands/RicCreateGridCrossPlotFeature.cpp @@ -25,7 +25,6 @@ #include "RimGridCrossPlotDataSet.h" #include "RimGridView.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RiuPlotMainWindowTools.h" #include "RiuViewer.h" @@ -50,12 +49,11 @@ bool RicCreateGridCrossPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicCreateGridCrossPlotFeature::onActionTriggered( bool isChecked ) { - RimProject* project = RimProject::current(); RimGridCrossPlotCollection* collection = caf::SelectionManager::instance()->selectedItemAncestorOfType(); if ( !collection ) { - collection = project->mainPlotCollection()->gridCrossPlotCollection(); + collection = RimMainPlotCollection::current()->gridCrossPlotCollection(); } RimGridCrossPlot* plot = collection->createGridCrossPlot(); RimGridCrossPlotDataSet* dataSet = plot->createDataSet(); diff --git a/ApplicationLibCode/Commands/GridCrossPlotCommands/RicCreateSaturationPressurePlotsFeature.cpp b/ApplicationLibCode/Commands/GridCrossPlotCommands/RicCreateSaturationPressurePlotsFeature.cpp index a325fab989..09ecfcfc42 100644 --- a/ApplicationLibCode/Commands/GridCrossPlotCommands/RicCreateSaturationPressurePlotsFeature.cpp +++ b/ApplicationLibCode/Commands/GridCrossPlotCommands/RicCreateSaturationPressurePlotsFeature.cpp @@ -58,9 +58,7 @@ std::vector return plots; } - RimProject* project = RimProject::current(); - - RimSaturationPressurePlotCollection* collection = project->mainPlotCollection()->saturationPressurePlotCollection(); + RimSaturationPressurePlotCollection* collection = RimMainPlotCollection::current()->saturationPressurePlotCollection(); if ( eclipseResultCase && eclipseResultCase->ensureReservoirCaseIsOpen() ) { @@ -123,9 +121,7 @@ bool RicCreateSaturationPressurePlotsFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicCreateSaturationPressurePlotsFeature::onActionTriggered( bool isChecked ) { - RimProject* project = RimProject::current(); - - RimSaturationPressurePlotCollection* collection = project->mainPlotCollection()->saturationPressurePlotCollection(); + RimSaturationPressurePlotCollection* collection = RimMainPlotCollection::current()->saturationPressurePlotCollection(); std::vector eclipseCases; { diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index 0cec5d2ae8..22fdfc2e1f 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -36,7 +36,6 @@ #include "RimMultiPlot.h" #include "RimMultiPlotCollection.h" #include "RimPlot.h" -#include "RimProject.h" #include "RimSaturationPressurePlot.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" @@ -327,8 +326,7 @@ std::vector RicSummaryPlotBuilder::duplicateSummaryPlots( const //-------------------------------------------------------------------------------------------------- RimMultiPlot* RicSummaryPlotBuilder::createAndAppendMultiPlot( const std::vector& plots ) { - RimProject* project = RimProject::current(); - RimMultiPlotCollection* plotCollection = project->mainPlotCollection()->multiPlotCollection(); + RimMultiPlotCollection* plotCollection = RimMainPlotCollection::current()->multiPlotCollection(); auto* plotWindow = new RimMultiPlot; plotWindow->setMultiPlotTitle( QString( "Multi Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) ); @@ -358,8 +356,7 @@ RimMultiPlot* RicSummaryPlotBuilder::createAndAppendMultiPlot( const std::vector RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( const std::vector& objects ) { - RimProject* project = RimProject::current(); - RimSummaryMultiPlotCollection* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); + RimSummaryMultiPlotCollection* plotCollection = RimMainPlotCollection::current()->summaryMultiPlotCollection(); auto* plotWindow = new RimSummaryMultiPlot; plotWindow->setMultiPlotTitle( QString( "Multi Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) ); @@ -439,8 +436,7 @@ RimSummaryMultiPlot* if ( skipCreationOfPlotBasedOnPreferences && prefs->defaultSummaryCurvesTextFilter().trimmed().isEmpty() ) return nullptr; - RimProject* project = RimProject::current(); - auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); + auto* plotCollection = RimMainPlotCollection::current()->summaryMultiPlotCollection(); auto* summaryMultiPlot = new RimSummaryMultiPlot(); summaryMultiPlot->setAsPlotMdiWindow(); @@ -483,8 +479,7 @@ RimSummaryMultiPlot* //-------------------------------------------------------------------------------------------------- RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlotNoAutoSettings( RimSummaryPlot* plot ) { - RimProject* project = RimProject::current(); - auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); + auto* plotCollection = RimMainPlotCollection::current()->summaryMultiPlotCollection(); auto* summaryMultiPlot = new RimSummaryMultiPlot(); summaryMultiPlot->setColumnCount( RiaDefines::ColumnCount::COLUMNS_1 ); @@ -521,8 +516,7 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlo //-------------------------------------------------------------------------------------------------- RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( const std::vector& plots ) { - RimProject* project = RimProject::current(); - auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); + auto* plotCollection = RimMainPlotCollection::current()->summaryMultiPlotCollection(); auto* summaryMultiPlot = new RimSummaryMultiPlot(); summaryMultiPlot->setAsPlotMdiWindow(); @@ -554,8 +548,7 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con //-------------------------------------------------------------------------------------------------- RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( RimSummaryPlot* plot ) { - RimProject* project = RimProject::current(); - auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); + auto* plotCollection = RimMainPlotCollection::current()->summaryMultiPlotCollection(); auto* summaryMultiPlot = new RimSummaryMultiPlot(); summaryMultiPlot->setColumnCount( RiaDefines::ColumnCount::COLUMNS_1 ); diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index ef44991554..13c2d73547 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -34,7 +34,6 @@ #include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSetCollection.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RimSummaryAddressCollection.h" #include "RimSummaryCase.h" #include "RimSummaryCurve.h" @@ -153,8 +152,7 @@ RimSummaryMultiPlot* RicSummaryPlotTemplateTools::create( const QString& fileNam sumCaseCollections.push_back( sumCaseCollection ); } - auto proj = RimProject::current(); - auto collections = proj->mainPlotCollection()->summaryMultiPlotCollection(); + auto collections = RimMainPlotCollection::current()->summaryMultiPlotCollection(); auto newSummaryPlot = RicSummaryPlotTemplateTools::createMultiPlotFromTemplateFile( fileName ); if ( !newSummaryPlot ) return nullptr; @@ -213,8 +211,7 @@ RimSummaryMultiPlot* RicSummaryPlotTemplateTools::create( const QString& if ( !analyzer.regionNumbers().empty() ) regions.push_back( QString::number( *( analyzer.regionNumbers().begin() ) ) ); - auto proj = RimProject::current(); - auto collections = proj->mainPlotCollection()->summaryMultiPlotCollection(); + auto collections = RimMainPlotCollection::current()->summaryMultiPlotCollection(); auto newSummaryPlot = RicSummaryPlotTemplateTools::createMultiPlotFromTemplateFile( fileName ); if ( !newSummaryPlot ) return nullptr; @@ -241,11 +238,6 @@ void RicSummaryPlotTemplateTools::setValuesForPlaceholders( RimSummaryMultiPlot* const std::vector& regions ) { - // Assumes this plot is inserted into the project. This is required when assigning the ptrFields - RimProject* proj = nullptr; - summaryMultiPlot->firstAncestorOfType( proj ); - CAF_ASSERT( proj ); - auto plots = summaryMultiPlot->plots(); for ( auto p : plots ) { @@ -265,11 +257,6 @@ void RicSummaryPlotTemplateTools::setValuesForPlaceholders( RimSummaryPlot* const std::vector& groupNames, const std::vector& regions ) { - // Assumes this plot is inserted into the project. This is required when assigning the ptrFields - RimProject* proj = nullptr; - summaryPlot->firstAncestorOfType( proj ); - CAF_ASSERT( proj ); - { // Replace single summary curves data sources diff --git a/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp b/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp index 0b0f0da643..17d74162a5 100644 --- a/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp @@ -24,7 +24,6 @@ #include "RimObservedDataCollection.h" #include "RimObservedFmuRftData.h" #include "RimObservedSummaryData.h" -#include "RimProject.h" #include "RimRftPlotCollection.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryMultiPlotCollection.h" @@ -80,8 +79,7 @@ void RicCloseObservedDataFeature::deleteObservedSummaryData( const std::vector& data ) { - RimProject* proj = RimProject::current(); - RimRftPlotCollection* rftPlotColl = proj->mainPlotCollection()->rftPlotCollection(); + RimRftPlotCollection* rftPlotColl = RimMainPlotCollection::current()->rftPlotCollection(); for ( RimObservedFmuRftData* observedData : data ) { diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleFractureStatisticsPlotFeature.cpp b/ApplicationLibCode/Commands/RicCreateEnsembleFractureStatisticsPlotFeature.cpp index 165edf718c..5b4e0106ad 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleFractureStatisticsPlotFeature.cpp +++ b/ApplicationLibCode/Commands/RicCreateEnsembleFractureStatisticsPlotFeature.cpp @@ -23,7 +23,6 @@ #include "RimEnsembleFractureStatisticsPlot.h" #include "RimEnsembleFractureStatisticsPlotCollection.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RiuPlotMainWindow.h" #include "RiuPlotMainWindowTools.h" @@ -45,10 +44,8 @@ bool RicCreateEnsembleFractureStatisticsPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicCreateEnsembleFractureStatisticsPlotFeature::onActionTriggered( bool isChecked ) { - RimProject* project = RimProject::current(); - RimEnsembleFractureStatisticsPlotCollection* collection = - project->mainPlotCollection()->ensembleFractureStatisticsPlotCollection(); + RimMainPlotCollection::current()->ensembleFractureStatisticsPlotCollection(); RimEnsembleFractureStatisticsPlot* plot = new RimEnsembleFractureStatisticsPlot(); plot->zoomAll(); diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogFeature.cpp b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogFeature.cpp index 0b7cf3cd02..a7a1aec470 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogFeature.cpp +++ b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogFeature.cpp @@ -121,7 +121,7 @@ void RicCreateEnsembleWellLogFeature::executeCommand( const RicCreateEnsembleWel std::vector> properties = ui.properties(); - RimWellLogPlotCollection* plotCollection = RimProject::current()->mainPlotCollection()->wellLogPlotCollection(); + RimWellLogPlotCollection* plotCollection = RimMainPlotCollection::current()->wellLogPlotCollection(); RimWellPath* wellPath = nullptr; diff --git a/ApplicationLibCode/Commands/RicCreateGridStatisticsPlotFeature.cpp b/ApplicationLibCode/Commands/RicCreateGridStatisticsPlotFeature.cpp index 63bc5c7192..df226a8722 100644 --- a/ApplicationLibCode/Commands/RicCreateGridStatisticsPlotFeature.cpp +++ b/ApplicationLibCode/Commands/RicCreateGridStatisticsPlotFeature.cpp @@ -25,7 +25,6 @@ #include "RimGridStatisticsPlot.h" #include "RimGridStatisticsPlotCollection.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RiuPlotMainWindow.h" #include "RiuPlotMainWindowTools.h" @@ -47,9 +46,7 @@ bool RicCreateGridStatisticsPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicCreateGridStatisticsPlotFeature::onActionTriggered( bool isChecked ) { - RimProject* project = RimProject::current(); - - RimGridStatisticsPlotCollection* collection = project->mainPlotCollection()->gridStatisticsPlotCollection(); + RimGridStatisticsPlotCollection* collection = RimMainPlotCollection::current()->gridStatisticsPlotCollection(); RimGridStatisticsPlot* plot = new RimGridStatisticsPlot(); diff --git a/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.cpp b/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.cpp index ed557c19a7..3365ac2826 100644 --- a/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.cpp +++ b/ApplicationLibCode/Commands/RicCreateTemporaryLgrFeature.cpp @@ -44,7 +44,6 @@ #include "RimEclipseCase.h" #include "RimEclipseView.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RimWellLogPlotCollection.h" #include "RimWellPath.h" #include "RimWellPathCollection.h" @@ -123,10 +122,10 @@ void RicCreateTemporaryLgrFeature::updateViews( RimEclipseCase* eclipseCase ) if ( guiApp ) guiApp->clearAllSelections(); deleteAllCachedData( eclipseCase ); - RimProject::current()->mainPlotCollection()->deleteAllCachedData(); + RimMainPlotCollection::current()->deleteAllCachedData(); computeCachedData( eclipseCase ); - RimProject::current()->mainPlotCollection()->wellLogPlotCollection()->loadDataAndUpdateAllPlots(); + RimMainPlotCollection::current()->wellLogPlotCollection()->loadDataAndUpdateAllPlots(); if ( guiApp ) eclipseCase->createDisplayModelAndUpdateAllViews(); } diff --git a/ApplicationLibCode/Commands/RicNewVfpPlotFeature.cpp b/ApplicationLibCode/Commands/RicNewVfpPlotFeature.cpp index b7ec8f0e1a..11279a5ce6 100644 --- a/ApplicationLibCode/Commands/RicNewVfpPlotFeature.cpp +++ b/ApplicationLibCode/Commands/RicNewVfpPlotFeature.cpp @@ -22,7 +22,6 @@ #include "RiaGuiApplication.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RimSimWellInView.h" #include "RimVfpPlot.h" #include "RimVfpPlotCollection.h" @@ -57,8 +56,6 @@ bool RicNewVfpPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicNewVfpPlotFeature::onActionTriggered( bool isChecked ) { - RimProject* proj = RiaApplication::instance()->project(); - RiaApplication* app = RiaGuiApplication::instance(); RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); @@ -73,7 +70,7 @@ void RicNewVfpPlotFeature::onActionTriggered( bool isChecked ) app->setLastUsedDialogDirectory( vfpDataKey, QFileInfo( fileNames.last() ).absolutePath() ); - RimVfpPlotCollection* vfpPlotColl = proj->mainPlotCollection()->vfpPlotCollection(); + RimVfpPlotCollection* vfpPlotColl = RimMainPlotCollection::current()->vfpPlotCollection(); if ( vfpPlotColl ) { std::vector vfpPlots; diff --git a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp index 4e9b22e805..74cc26264a 100644 --- a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp @@ -25,7 +25,6 @@ #include "RimMainPlotCollection.h" #include "RimObservedDataCollection.h" #include "RimObservedSummaryData.h" -#include "RimProject.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" @@ -40,6 +39,18 @@ CAF_CMD_SOURCE_INIT( RicReloadSummaryCaseFeature, "RicReloadSummaryCaseFeature" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicReloadSummaryCaseFeature::reloadSummaryCase( RimSummaryCase* summaryCase ) +{ + summaryCase->createSummaryReaderInterface(); + summaryCase->createRftReaderInterface(); + summaryCase->refreshMetaData(); + + RicReplaceSummaryCaseFeature::updateRequredCalculatedCurves( summaryCase ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -60,22 +71,12 @@ void RicReloadSummaryCaseFeature::onActionTriggered( bool isChecked ) std::vector caseSelection = selectedSummaryCases(); for ( RimSummaryCase* summaryCase : caseSelection ) { - summaryCase->createSummaryReaderInterface(); - summaryCase->createRftReaderInterface(); - summaryCase->refreshMetaData(); - - RicReplaceSummaryCaseFeature::updateRequredCalculatedCurves( summaryCase ); + reloadSummaryCase( summaryCase ); RiaLogging::info( QString( "Reloaded data for %1" ).arg( summaryCase->summaryHeaderFilename() ) ); } - for ( RimSummaryMultiPlot* multiPlot : summaryPlotColl->multiPlots() ) - { - for ( RimSummaryPlot* summaryPlot : multiPlot->summaryPlots() ) - { - summaryPlot->loadDataAndUpdate(); - } - } + RimMainPlotCollection::current()->loadDataAndUpdateAllPlots(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.h b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.h index 9868352ccf..7d4ae63a63 100644 --- a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.h +++ b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.h @@ -28,6 +28,9 @@ class RicReloadSummaryCaseFeature : public caf::CmdFeature { CAF_CMD_HEADER_INIT; +public: + static void reloadSummaryCase( RimSummaryCase* summaryCase ); + protected: bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; diff --git a/ApplicationLibCode/Commands/RicReloadWellPathFormationNamesFeature.cpp b/ApplicationLibCode/Commands/RicReloadWellPathFormationNamesFeature.cpp index ac655b7dbd..1cc1d000a7 100644 --- a/ApplicationLibCode/Commands/RicReloadWellPathFormationNamesFeature.cpp +++ b/ApplicationLibCode/Commands/RicReloadWellPathFormationNamesFeature.cpp @@ -19,7 +19,6 @@ #include "RicReloadWellPathFormationNamesFeature.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RimWellPath.h" #include "RimWellPathCollection.h" @@ -65,14 +64,7 @@ void RicReloadWellPathFormationNamesFeature::onActionTriggered( bool isChecked ) wellPathCollections[0]->reloadAllWellPathFormations(); } - RimProject* project = RimProject::current(); - if ( project ) - { - if ( project->mainPlotCollection() ) - { - project->mainPlotCollection->updatePlotsWithFormations(); - } - } + RimMainPlotCollection::current()->updatePlotsWithFormations(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotFeature.cpp index 5304487c80..51e34b25fc 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotFeature.cpp @@ -25,7 +25,6 @@ #include "RicSummaryPlotEditorUi.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCrossPlotCollection.h" @@ -75,10 +74,7 @@ bool RicNewSummaryCrossPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicNewSummaryCrossPlotFeature::onActionTriggered( bool isChecked ) { - RimProject* project = RimProject::current(); - CVF_ASSERT( project ); - - RimSummaryCrossPlotCollection* summaryCrossPlotColl = project->mainPlotCollection()->summaryCrossPlotCollection(); + RimSummaryCrossPlotCollection* summaryCrossPlotColl = RimMainPlotCollection::current()->summaryCrossPlotCollection(); RimSummaryPlot* summaryPlot = summaryCrossPlotColl->createSummaryPlot(); summaryCrossPlotColl->addPlot( summaryPlot ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp index 37b4fcbda3..4a253d65a2 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp @@ -144,8 +144,7 @@ std::vector openEclipseCasesForCellPlotting( QStringList gridFi std::vector openedCases; RiaApplication* app = RiaApplication::instance(); - RimProject* project = app->project(); - RimEclipseCaseCollection* analysisModels = project->activeOilField()->analysisModels(); + RimEclipseCaseCollection* analysisModels = RimProject::current()->activeOilField()->analysisModels(); for ( const QString& fileName : gridFileNames ) { QFileInfo gridFileInfo( fileName ); @@ -488,7 +487,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin if ( lastPlotCreated ) { - RimProject::current()->mainPlotCollection()->summaryMultiPlotCollection()->updateConnectedEditors(); + RimMainPlotCollection::current()->summaryMultiPlotCollection()->updateConnectedEditors(); RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); // Needed to avoid unnecessary activation of sub windows (plots) diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp index f073a79496..ae885b90da 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp @@ -83,9 +83,7 @@ bool RicNewPltPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicNewPltPlotFeature::onActionTriggered( bool isChecked ) { - RimProject* proj = RimProject::current(); - - RimPltPlotCollection* pltPlotColl = proj->mainPlotCollection()->pltPlotCollection(); + RimPltPlotCollection* pltPlotColl = RimMainPlotCollection::current()->pltPlotCollection(); if ( pltPlotColl ) { QString wellPathName; @@ -98,7 +96,7 @@ void RicNewPltPlotFeature::onActionTriggered( bool isChecked ) } else if ( ( eclipseWell = caf::firstAncestorOfTypeFromSelectedObject() ) != nullptr ) { - wellPath = proj->wellPathFromSimWellName( eclipseWell->name() ); + wellPath = RimProject::current()->wellPathFromSimWellName( eclipseWell->name() ); if ( !wellPath ) return; wellPathName = wellPath->name(); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp index 79013707a1..1ab7214719 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp @@ -19,7 +19,6 @@ #include "RicNewRftPlotFeature.h" #include "RimMainPlotCollection.h" -#include "RimProject.h" #include "RimRftPlotCollection.h" #include "RimSimWellInView.h" #include "RimWellLogPlot.h" @@ -58,9 +57,7 @@ bool RicNewRftPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicNewRftPlotFeature::onActionTriggered( bool isChecked ) { - RimProject* proj = RimProject::current(); - - RimRftPlotCollection* rftPlotColl = proj->mainPlotCollection()->rftPlotCollection(); + RimRftPlotCollection* rftPlotColl = RimMainPlotCollection::current()->rftPlotCollection(); if ( rftPlotColl ) { QString wellName = selectedWellName(); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp index 3e8115408a..1c62731ea1 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp @@ -249,14 +249,5 @@ void RicNewWellLogPlotFeatureImpl::updateAfterCreation( RimDepthTrackPlot* plot //-------------------------------------------------------------------------------------------------- RimWellLogPlotCollection* RicNewWellLogPlotFeatureImpl::wellLogPlotCollection() { - RimProject* project = RimProject::current(); - CVF_ASSERT( project ); - - RimMainPlotCollection* mainPlotColl = project->mainPlotCollection(); - CVF_ASSERT( mainPlotColl ); - - RimWellLogPlotCollection* wellLogPlotColl = mainPlotColl->wellLogPlotCollection(); - CVF_ASSERT( wellLogPlotColl ); - - return mainPlotColl->wellLogPlotCollection(); + return RimMainPlotCollection::current()->wellLogPlotCollection(); } diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicWellPathFormationsImportFileFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicWellPathFormationsImportFileFeature.cpp index 7154634b13..e82cabb6de 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicWellPathFormationsImportFileFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicWellPathFormationsImportFileFeature.cpp @@ -69,10 +69,7 @@ void RicWellPathFormationsImportFileFeature::onActionTriggered( bool isChecked ) if ( project ) { project->scheduleCreateDisplayModelAndRedrawAllViews(); - if ( project->mainPlotCollection() ) - { - project->mainPlotCollection->updatePlotsWithFormations(); - } + RimMainPlotCollection::current()->updatePlotsWithFormations(); RimOilField* oilField = project->activeOilField(); diff --git a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp index beb04230f7..2a155229ef 100644 --- a/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp +++ b/ApplicationLibCode/GeoMech/GeoMechDataModel/RigFemPartResultsCollection.cpp @@ -66,7 +66,6 @@ #include "RimMainPlotCollection.h" #include "RimMudWeightWindowParameters.h" -#include "RimProject.h" #include "RimWellLogPlot.h" #include "RimWellLogPlotCollection.h" @@ -216,20 +215,10 @@ void RigFemPartResultsCollection::setActiveFormationNames( RigFormationNames* ac { m_activeFormationNamesData = activeFormationNames; - RimProject* project = RimProject::current(); - if ( project ) + RimWellLogPlotCollection* plotCollection = RimMainPlotCollection::current()->wellLogPlotCollection(); + for ( auto wellLogPlot : plotCollection->wellLogPlots() ) { - if ( project->mainPlotCollection() ) - { - RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection(); - if ( plotCollection ) - { - for ( auto wellLogPlot : plotCollection->wellLogPlots() ) - { - wellLogPlot->loadDataAndUpdate(); - } - } - } + wellLogPlot->loadDataAndUpdate(); } this->deleteResult( RigFemResultAddress( RIG_FORMATION_NAMES, "Active Formation Names", "" ) ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index 559e403232..686341a276 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -281,7 +281,7 @@ protected: { RimProject* proj = RimProject::current(); RimWellPath* wellPath = proj->wellPathByName( wellPathName ); - RimWellLogPlotCollection* wellLogCollection = proj->mainPlotCollection()->wellLogPlotCollection(); + RimWellLogPlotCollection* wellLogCollection = RimMainPlotCollection::current()->wellLogPlotCollection(); RigEclipseWellLogExtractor* eclExtractor = wellLogCollection->findOrCreateExtractor( wellPath, eclCase ); return eclExtractor; diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp index 1b7bd744e9..c4da91d3cf 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp @@ -185,17 +185,10 @@ RimGeoMechCase::~RimGeoMechCase( void ) { geoMechViews.deleteChildren(); - RimProject* project = RimProject::current(); - if ( project ) + RimWellLogPlotCollection* plotCollection = RimMainPlotCollection::current()->wellLogPlotCollection(); + if ( plotCollection ) { - if ( project->mainPlotCollection() ) - { - RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection(); - if ( plotCollection ) - { - plotCollection->removeExtractors( this->geoMechData() ); - } - } + plotCollection->removeExtractors( this->geoMechData() ); } if ( this->geoMechData() ) diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 7379a6ced6..2230f21b7e 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -606,9 +606,7 @@ void Rim3dView::updateDisplayModelForCurrentTimeStepAndRedraw() m_isCallingUpdateDisplayModelForCurrentTimestepAndRedraw = false; - RimProject* project; - firstAncestorOrThisOfTypeAsserted( project ); - project->mainPlotCollection()->updateCurrentTimeStepInPlots(); + RimMainPlotCollection::current()->updateCurrentTimeStepInPlots(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp index e82478abc6..069f322b6e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp @@ -152,17 +152,10 @@ RimEclipseCase::~RimEclipseCase() delete m_fractureModelResults(); delete m_inputPropertyCollection; - RimProject* project = RimProject::current(); - if ( project ) + RimWellLogPlotCollection* plotCollection = RimMainPlotCollection::current()->wellLogPlotCollection(); + if ( plotCollection ) { - if ( project->mainPlotCollection() ) - { - RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection(); - if ( plotCollection ) - { - plotCollection->removeExtractors( this->eclipseCaseData() ); - } - } + plotCollection->removeExtractors( this->eclipseCaseData() ); } if ( this->eclipseCaseData() ) @@ -511,16 +504,7 @@ void RimEclipseCase::updateFormationNamesData() } // Update plots based on formations - { - RimProject* project = RimProject::current(); - if ( project ) - { - if ( project->mainPlotCollection() ) - { - project->mainPlotCollection->updatePlotsWithFormations(); - } - } - } + RimMainPlotCollection::current()->updatePlotsWithFormations(); std::vector views = this->views(); for ( Rim3dView* view : views ) diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp index 3a6e11c20f..d4f0456cf7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp @@ -155,6 +155,14 @@ RimMainPlotCollection::~RimMainPlotCollection() { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimMainPlotCollection* RimMainPlotCollection::current() +{ + return RimProject::current()->mainPlotCollection(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h index a76ee3c1ba..ec2b378b74 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h @@ -61,6 +61,8 @@ public: RimMainPlotCollection(); ~RimMainPlotCollection() override; + static RimMainPlotCollection* current(); + RimWellLogPlotCollection* wellLogPlotCollection() const; RimRftPlotCollection* rftPlotCollection() const; RimPltPlotCollection* pltPlotCollection() const; diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 67955902b0..e0b9ea8085 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -154,8 +154,8 @@ RimProject::RimProject( void ) wellPathImport.uiCapability()->setUiTreeHidden( true ); wellPathImport.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &mainPlotCollection, "MainPlotCollection", "Plots" ); - mainPlotCollection.uiCapability()->setUiTreeHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_mainPlotCollection, "MainPlotCollection", "Plots" ); + m_mainPlotCollection.uiCapability()->setUiTreeHidden( true ); CAF_PDM_InitFieldNoDefault( &viewLinkerCollection, "LinkedViews", "Linked Views", ":/LinkView.svg" ); viewLinkerCollection.uiCapability()->setUiTreeHidden( true ); @@ -212,7 +212,7 @@ RimProject::RimProject( void ) scriptCollection->uiCapability()->setUiName( "Scripts" ); scriptCollection->uiCapability()->setUiIconFromResourceString( ":/octave.png" ); - mainPlotCollection = new RimMainPlotCollection(); + m_mainPlotCollection = new RimMainPlotCollection(); CAF_PDM_InitFieldNoDefault( &m_plotTemplateTopFolder, "PlotTemplateCollection", "Plot Templates" ); m_plotTemplateTopFolder = new RimPlotTemplateFolderItem(); @@ -244,9 +244,9 @@ RimProject* RimProject::current() //-------------------------------------------------------------------------------------------------- void RimProject::close() { - if ( mainPlotCollection() ) + if ( m_mainPlotCollection() ) { - mainPlotCollection()->deleteAllContainedObjects(); + m_mainPlotCollection()->deleteAllContainedObjects(); } oilFields.deleteChildren(); @@ -361,6 +361,14 @@ void RimProject::setupBeforeSave() m_projectFileVersionString = STRPRODUCTVER; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimMainPlotCollection* RimProject::mainPlotCollection() const +{ + return m_mainPlotCollection(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -998,7 +1006,7 @@ void RimProject::reloadCompletionTypeResultsInAllViews() RiaCompletionTypeCalculationScheduler::instance()->clearCompletionTypeResultsInAllCases(); scheduleCreateDisplayModelAndRedrawAllViews(); - mainPlotCollection()->scheduleUpdatePlotsWithCompletions(); + m_mainPlotCollection()->scheduleUpdatePlotsWithCompletions(); } //-------------------------------------------------------------------------------------------------- @@ -1364,82 +1372,82 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q { if ( uiConfigName == "PlotWindow.Plots" ) { - if ( mainPlotCollection ) + if ( m_mainPlotCollection ) { - if ( mainPlotCollection->summaryMultiPlotCollection() ) + if ( m_mainPlotCollection->summaryMultiPlotCollection() ) { - uiTreeOrdering.add( mainPlotCollection->summaryMultiPlotCollection() ); + uiTreeOrdering.add( m_mainPlotCollection->summaryMultiPlotCollection() ); } - if ( mainPlotCollection->analysisPlotCollection() ) + if ( m_mainPlotCollection->analysisPlotCollection() ) { - uiTreeOrdering.add( mainPlotCollection->analysisPlotCollection() ); + uiTreeOrdering.add( m_mainPlotCollection->analysisPlotCollection() ); } - if ( mainPlotCollection->correlationPlotCollection() ) + if ( m_mainPlotCollection->correlationPlotCollection() ) { - uiTreeOrdering.add( mainPlotCollection->correlationPlotCollection() ); + uiTreeOrdering.add( m_mainPlotCollection->correlationPlotCollection() ); } - if ( mainPlotCollection->summaryCrossPlotCollection() ) + if ( m_mainPlotCollection->summaryCrossPlotCollection() ) { - uiTreeOrdering.add( mainPlotCollection->summaryCrossPlotCollection() ); + uiTreeOrdering.add( m_mainPlotCollection->summaryCrossPlotCollection() ); } - if ( mainPlotCollection->wellLogPlotCollection() ) + if ( m_mainPlotCollection->wellLogPlotCollection() ) { - uiTreeOrdering.add( mainPlotCollection->wellLogPlotCollection() ); + uiTreeOrdering.add( m_mainPlotCollection->wellLogPlotCollection() ); } - if ( mainPlotCollection->rftPlotCollection() ) + if ( m_mainPlotCollection->rftPlotCollection() ) { - uiTreeOrdering.add( mainPlotCollection->rftPlotCollection() ); + uiTreeOrdering.add( m_mainPlotCollection->rftPlotCollection() ); } - if ( mainPlotCollection->pltPlotCollection() ) + if ( m_mainPlotCollection->pltPlotCollection() ) { - uiTreeOrdering.add( mainPlotCollection->pltPlotCollection() ); + uiTreeOrdering.add( m_mainPlotCollection->pltPlotCollection() ); } - if ( mainPlotCollection->flowPlotCollection() ) + if ( m_mainPlotCollection->flowPlotCollection() ) { - uiTreeOrdering.add( mainPlotCollection->flowPlotCollection() ); + uiTreeOrdering.add( m_mainPlotCollection->flowPlotCollection() ); } - if ( mainPlotCollection->gridCrossPlotCollection() ) + if ( m_mainPlotCollection->gridCrossPlotCollection() ) { - uiTreeOrdering.add( mainPlotCollection->gridCrossPlotCollection() ); + uiTreeOrdering.add( m_mainPlotCollection->gridCrossPlotCollection() ); } - if ( mainPlotCollection->saturationPressurePlotCollection() ) + if ( m_mainPlotCollection->saturationPressurePlotCollection() ) { - uiTreeOrdering.add( mainPlotCollection->saturationPressurePlotCollection() ); + uiTreeOrdering.add( m_mainPlotCollection->saturationPressurePlotCollection() ); } - if ( mainPlotCollection->multiPlotCollection() ) + if ( m_mainPlotCollection->multiPlotCollection() ) { - uiTreeOrdering.add( mainPlotCollection->multiPlotCollection() ); + uiTreeOrdering.add( m_mainPlotCollection->multiPlotCollection() ); } - if ( mainPlotCollection->stimPlanModelPlotCollection() ) + if ( m_mainPlotCollection->stimPlanModelPlotCollection() ) { - uiTreeOrdering.add( mainPlotCollection->stimPlanModelPlotCollection() ); + uiTreeOrdering.add( m_mainPlotCollection->stimPlanModelPlotCollection() ); } - if ( mainPlotCollection->vfpPlotCollection() ) + if ( m_mainPlotCollection->vfpPlotCollection() ) { - uiTreeOrdering.add( mainPlotCollection->vfpPlotCollection() ); + uiTreeOrdering.add( m_mainPlotCollection->vfpPlotCollection() ); } #ifdef USE_QTCHARTS - if ( mainPlotCollection->gridStatisticsPlotCollection() || - mainPlotCollection->ensembleFractureStatisticsPlotCollection() ) + if ( m_mainPlotCollection->gridStatisticsPlotCollection() || + m_mainPlotCollection->ensembleFractureStatisticsPlotCollection() ) { auto statisticsItemCollection = uiTreeOrdering.add( "Statistics Plots", ":/Folder.png" ); - if ( mainPlotCollection->gridStatisticsPlotCollection() ) - statisticsItemCollection->add( mainPlotCollection->gridStatisticsPlotCollection() ); + if ( m_mainPlotCollection->gridStatisticsPlotCollection() ) + statisticsItemCollection->add( m_mainPlotCollection->gridStatisticsPlotCollection() ); - if ( mainPlotCollection->ensembleFractureStatisticsPlotCollection() ) - statisticsItemCollection->add( mainPlotCollection->ensembleFractureStatisticsPlotCollection() ); + if ( m_mainPlotCollection->ensembleFractureStatisticsPlotCollection() ) + statisticsItemCollection->add( m_mainPlotCollection->ensembleFractureStatisticsPlotCollection() ); } #endif } diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.h b/ApplicationLibCode/ProjectDataModel/RimProject.h index 89d64e4651..1cb50af490 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.h +++ b/ApplicationLibCode/ProjectDataModel/RimProject.h @@ -97,12 +97,13 @@ public: caf::PdmChildField colorLegendCollection; caf::PdmChildField scriptCollection; caf::PdmChildField wellPathImport; - caf::PdmChildField mainPlotCollection; caf::PdmChildField viewLinkerCollection; caf::PdmChildField calculationCollection; caf::PdmChildField gridCalculationCollection; caf::PdmChildArrayField commandObjects; + RimMainPlotCollection* mainPlotCollection() const; + caf::PdmChildArrayField multiSnapshotDefinitions; caf::PdmField mainWindowTreeViewStates; @@ -208,6 +209,8 @@ private: void distributePathsFromGlobalPathList(); private: + caf::PdmChildField m_mainPlotCollection; + caf::PdmField m_globalPathList; caf::PdmField m_projectFileVersionString; diff --git a/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.cpp b/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.cpp index be0c9ea10b..9b7cfb6b44 100644 --- a/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.cpp @@ -30,18 +30,8 @@ #include "RimEclipseContourMapView.h" #include "RimEclipseContourMapViewCollection.h" #include "RimEclipseView.h" -#include "RimFlowPlotCollection.h" -#include "RimGridCrossPlot.h" -#include "RimGridCrossPlotCollection.h" #include "RimMainPlotCollection.h" -#include "RimMultiPlot.h" -#include "RimMultiPlotCollection.h" -#include "RimProject.h" #include "RimSummaryCaseMainCollection.h" -#include "RimSummaryMultiPlot.h" -#include "RimSummaryMultiPlotCollection.h" -#include "RimWellLogPlot.h" -#include "RimWellLogPlotCollection.h" //-------------------------------------------------------------------------------------------------- /// @@ -143,51 +133,5 @@ void RimReloadCaseTools::updateAll3dViews( RimEclipseCase* eclipseCase ) //-------------------------------------------------------------------------------------------------- void RimReloadCaseTools::updateAllPlots() { - RimProject* project = RimProject::current(); - if ( project && project->mainPlotCollection() ) - { - RimWellLogPlotCollection* wellPlotCollection = project->mainPlotCollection()->wellLogPlotCollection(); - - if ( wellPlotCollection ) - { - for ( RimWellLogPlot* wellLogPlot : wellPlotCollection->wellLogPlots() ) - { - wellLogPlot->loadDataAndUpdate(); - } - } - - RimSummaryMultiPlotCollection* summaryMultiPlotCollection = - project->mainPlotCollection()->summaryMultiPlotCollection(); - if ( summaryMultiPlotCollection ) - { - for ( RimSummaryMultiPlot* summaryPlot : summaryMultiPlotCollection->multiPlots() ) - { - summaryPlot->loadDataAndUpdate(); - } - } - - RimGridCrossPlotCollection* gridCrossPlotCollection = project->mainPlotCollection()->gridCrossPlotCollection(); - if ( gridCrossPlotCollection ) - { - for ( RimGridCrossPlot* crossPlot : gridCrossPlotCollection->plots() ) - { - crossPlot->loadDataAndUpdate(); - } - } - - RimFlowPlotCollection* flowPlotCollection = project->mainPlotCollection()->flowPlotCollection(); - if ( flowPlotCollection ) - { - flowPlotCollection->loadDataAndUpdateAllPlots(); - } - - RimMultiPlotCollection* multiPlotCollection = project->mainPlotCollection()->multiPlotCollection(); - if ( multiPlotCollection ) - { - for ( RimMultiPlot* plotWindow : multiPlotCollection->multiPlots() ) - { - plotWindow->loadDataAndUpdate(); - } - } - } + RimMainPlotCollection::current()->loadDataAndUpdateAllPlots(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.cpp index 24ca0e0e5f..7605ea8bc0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.cpp @@ -18,6 +18,13 @@ #include "RimRftCase.h" +#include "RicReloadSummaryCaseFeature.h" + +#include "RimMainPlotCollection.h" +#include "RimSummaryCase.h" + +#include "cafPdmUiFilePathEditor.h" + //================================================================================================== // // @@ -69,3 +76,33 @@ QString RimRftCase::dataDeckFilePath() const { return m_dataDeckFilePath().path(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimRftCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) +{ + RimSummaryCase* parentCase = nullptr; + firstAncestorOfType( parentCase ); + + if ( parentCase ) RicReloadSummaryCaseFeature::reloadSummaryCase( parentCase ); + + RimMainPlotCollection::current()->loadDataAndUpdateAllPlots(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimRftCase::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) +{ + if ( field == &m_dataDeckFilePath ) + { + auto* myAttr = dynamic_cast( attribute ); + if ( myAttr ) + { + myAttr->m_defaultPath = rftFilePath(); + } + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.h index 6ccffc3b57..4a2d0040df 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimRftCase.h @@ -39,6 +39,13 @@ public: QString rftFilePath() const; QString dataDeckFilePath() const; +private: + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + + void defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) override; + private: caf::PdmField m_rftFilePath; caf::PdmField m_dataDeckFilePath; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 9ec6e4af23..ce99e4bbdf 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -39,7 +39,6 @@ #include "RimMultiPlotCollection.h" #include "RimMultipleSummaryPlotNameHelper.h" #include "RimPlotAxisProperties.h" -#include "RimProject.h" #include "RimSummaryAddress.h" #include "RimSummaryAddressCollection.h" #include "RimSummaryAddressModifier.h" @@ -533,8 +532,7 @@ void RimSummaryMultiPlot::updatePlotWindowTitle() if ( title.isEmpty() ) { - auto proj = RimProject::current(); - auto collections = proj->mainPlotCollection()->summaryMultiPlotCollection(); + auto collections = RimMainPlotCollection::current()->summaryMultiPlotCollection(); size_t index = 0; for ( auto p : collections->multiPlots() ) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index 203f94626e..9fb92da788 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -46,8 +46,6 @@ #include "RimGeoMechResultDefinition.h" #include "RimGeoMechView.h" #include "RimMainPlotCollection.h" -#include "RimOilField.h" -#include "RimProject.h" #include "RimTools.h" #include "RimWellBoreStabilityPlot.h" #include "RimWellLogCurve.h" @@ -438,10 +436,7 @@ void RimWellLogExtractionCurve::extractData( bool* isUsingPseudoLength, clampBranchIndex(); - RimMainPlotCollection* mainPlotCollection; - this->firstAncestorOrThisOfTypeAsserted( mainPlotCollection ); - - RimWellLogPlotCollection* wellLogCollection = mainPlotCollection->wellLogPlotCollection(); + RimWellLogPlotCollection* wellLogCollection = RimMainPlotCollection::current()->wellLogPlotCollection(); cvf::ref eclExtractor; cvf::ref geomExtractor; @@ -696,15 +691,7 @@ std::set RimWellLogExtractionCurve::sortedSimWellNames() //-------------------------------------------------------------------------------------------------- void RimWellLogExtractionCurve::clearGeneratedSimWellPaths() { - RimWellLogPlotCollection* wellLogCollection = nullptr; - - // Need to use this approach, and not firstAnchestor because the curve might not be inside the hierarchy when - // deleted. - - RimProject* proj = RimProject::current(); - if ( proj && proj->mainPlotCollection() ) wellLogCollection = proj->mainPlotCollection()->wellLogPlotCollection(); - - if ( !wellLogCollection ) return; + RimWellLogPlotCollection* wellLogCollection = RimMainPlotCollection::current()->wellLogPlotCollection(); for ( auto wellPath : m_wellPathsWithExtractors ) { diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index 8ebaee2800..b9353640f1 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -173,8 +173,8 @@ RimWellLogRftCurve::RimWellLogRftCurve() CAF_PDM_InitFieldNoDefault( &m_wellLogChannelName, "WellLogChannelName", "Well Property" ); CAF_PDM_InitFieldNoDefault( &m_rftDataType, "RftDataType", "Data Type" ); - CAF_PDM_InitField( &m_segmentResultName, "SegmentResultName", RiaResultNames::undefinedResultName(), "Segment Result Name" ); - CAF_PDM_InitField( &m_segmentBranchIndex, "SegmentBranchIndex", -1, "Segment Branch" ); + CAF_PDM_InitField( &m_segmentResultName, "SegmentResultName", RiaResultNames::undefinedResultName(), "Result Name" ); + CAF_PDM_InitField( &m_segmentBranchIndex, "SegmentBranchIndex", -1, "Branch" ); CAF_PDM_InitFieldNoDefault( &m_segmentBranchType, "SegmentBranchType", "Branch Type" ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp index 01c1c411b8..2faf58c13c 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp @@ -60,9 +60,7 @@ RimWellMeasurementCollection::~RimWellMeasurementCollection() //-------------------------------------------------------------------------------------------------- void RimWellMeasurementCollection::updateAllCurves() { - RimProject* proj; - this->firstAncestorOrThisOfTypeAsserted( proj ); - RimMainPlotCollection* plotCollection = proj->mainPlotCollection(); + RimMainPlotCollection* plotCollection = RimMainPlotCollection::current(); std::vector measurementCurves; plotCollection->descendantsIncludingThisOfType( measurementCurves ); @@ -80,9 +78,7 @@ void RimWellMeasurementCollection::updateAllCurves() //-------------------------------------------------------------------------------------------------- void RimWellMeasurementCollection::deleteAllEmptyCurves() { - RimProject* proj; - this->firstAncestorOrThisOfTypeAsserted( proj ); - RimMainPlotCollection* plotCollection = proj->mainPlotCollection(); + RimMainPlotCollection* plotCollection = RimMainPlotCollection::current(); std::vector measurementCurves; plotCollection->descendantsIncludingThisOfType( measurementCurves ); @@ -269,8 +265,6 @@ void RimWellMeasurementCollection::removeMeasurementsForFilePath( RimWellMeasure delete measurementsToRemove[i]; } - RimProject* proj; - this->firstAncestorOrThisOfTypeAsserted( proj ); - proj->scheduleCreateDisplayModelAndRedrawAllViews(); + RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews(); this->updateAllCurves(); } diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp index 764bed1621..ce4a2399ad 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp @@ -165,18 +165,10 @@ RimWellPath::~RimWellPath() delete file; } - RimProject* project; - firstAncestorOrThisOfType( project ); - if ( project ) + RimWellLogPlotCollection* plotCollection = RimMainPlotCollection::current()->wellLogPlotCollection(); + if ( plotCollection ) { - if ( project->mainPlotCollection() ) - { - RimWellLogPlotCollection* plotCollection = project->mainPlotCollection()->wellLogPlotCollection(); - if ( plotCollection ) - { - plotCollection->removeExtractors( m_wellPathGeometry.p() ); - } - } + plotCollection->removeExtractors( m_wellPathGeometry.p() ); } } diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index d87ce4ce99..5ddaee005c 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -154,10 +154,7 @@ void RiuPlotMainWindow::onWellSelected( QString wellName ) if ( !plotWnd->selection3DLinkEnabled() ) return; - RimProject* project = RimProject::current(); - if ( !project ) return; - - project->mainPlotCollection()->updateSelectedWell( wellName ); + RimMainPlotCollection::current()->updateSelectedWell( wellName ); } //--------------------------------------------------------------------------------------------------