#739 Show sum plot on creation. Load when opening project. Delete on close project

This commit is contained in:
Jacob Støren 2016-05-25 14:05:31 +02:00
parent f8729a035c
commit 38c15f57f2
3 changed files with 32 additions and 2 deletions

View File

@ -98,6 +98,8 @@
#ifdef WIN32
#include <fcntl.h>
#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

View File

@ -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();
}
//--------------------------------------------------------------------------------------------------

View File

@ -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);