diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index 35f328c432..49a7935916 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -98,6 +98,8 @@ #ifdef WIN32 #include #endif +#include "RimSummaryPlotCollection.h" +#include "RimSummaryPlot.h" namespace caf { @@ -444,17 +446,39 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi } { + RimWellLogPlotCollection* wlpColl = nullptr; + RimSummaryPlotCollection* spColl = nullptr; + if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection()) { - RimWellLogPlotCollection* wlpColl = m_project->mainPlotCollection()->wellLogPlotCollection(); - caf::ProgressInfo plotProgress(wlpColl->wellLogPlots().size(), "Loading Plot Data"); + wlpColl = m_project->mainPlotCollection()->wellLogPlotCollection(); + } + if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->summaryPlotCollection()) + { + spColl = m_project->mainPlotCollection()->summaryPlotCollection(); + } + size_t plotCount = 0; + plotCount += wlpColl ? wlpColl->wellLogPlots().size(): 0; + plotCount += spColl ? spColl->m_summaryPlots().size(): 0; + caf::ProgressInfo plotProgress(plotCount, "Loading Plot Data"); + if (wlpColl) + { for (size_t wlpIdx = 0; wlpIdx < wlpColl->wellLogPlots().size(); ++wlpIdx) { wlpColl->wellLogPlots[wlpIdx]->loadDataAndUpdate(); plotProgress.incrementProgress(); } } + + if (spColl) + { + for (size_t wlpIdx = 0; wlpIdx < spColl->m_summaryPlots().size(); ++wlpIdx) + { + spColl->m_summaryPlots[wlpIdx]->loadDataAndUpdate(); + plotProgress.incrementProgress(); + } + } } // NB! This function must be called before executing command objects, // because the tree view state is restored from project file and sets diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp index 56c3a69736..cf815e9b6f 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp @@ -59,6 +59,7 @@ void RicNewSummaryPlotFeature::onActionTriggered(bool isChecked) plot->setDescription(QString("Well Log Plot %1").arg(summaryPlotColl->m_summaryPlots.size())); summaryPlotColl->updateConnectedEditors(); + plot->loadDataAndUpdate(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimProject.cpp b/ApplicationCode/ProjectDataModel/RimProject.cpp index c210fa63ec..fa599e8e05 100644 --- a/ApplicationCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationCode/ProjectDataModel/RimProject.cpp @@ -145,6 +145,11 @@ void RimProject::close() mainPlotCollection()->wellLogPlotCollection()->wellLogPlots.deleteAllChildObjects(); } + if (mainPlotCollection() && mainPlotCollection()->summaryPlotCollection()) + { + mainPlotCollection()->summaryPlotCollection()->m_summaryPlots.deleteAllChildObjects(); + } + oilFields.deleteAllChildObjects(); oilFields.push_back(new RimOilField);