#1213 Well allocation plot is now only created when requested.

Also made the fields in FlowPlotCollection private.
This commit is contained in:
Jacob Støren 2017-02-13 14:49:52 +01:00
parent df35335744
commit a25bfd4513
5 changed files with 79 additions and 24 deletions

View File

@ -575,7 +575,7 @@ void RiaApplication::loadAndUpdatePlotData()
size_t plotCount = 0; size_t plotCount = 0;
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0; plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
plotCount += spColl ? spColl->summaryPlots().size() : 0; plotCount += spColl ? spColl->summaryPlots().size() : 0;
plotCount += flowColl ? flowColl->flowPlots().size() : 0; plotCount += flowColl ? flowColl->plotCount() : 0;
caf::ProgressInfo plotProgress(plotCount, "Loading Plot Data"); caf::ProgressInfo plotProgress(plotCount, "Loading Plot Data");
if (wlpColl) if (wlpColl)
@ -596,16 +596,14 @@ void RiaApplication::loadAndUpdatePlotData()
} }
} }
plotProgress.setNextProgressIncrement(flowColl->plotCount());
if (flowColl) if (flowColl)
{ {
flowColl->defaultPlot->loadDataAndUpdate(); flowColl->loadDataAndUpdate();
for (RimWellAllocationPlot* p : flowColl->flowPlots())
{
p->loadDataAndUpdate();
plotProgress.incrementProgress();
}
} }
plotProgress.incrementProgress();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -70,7 +70,7 @@ void RicAddStoredWellAllocationPlotFeature::onActionTriggered(bool isChecked)
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(sourceObject->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance())); RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(sourceObject->copyByXmlSerialization(caf::PdmDefaultObjectFactory::instance()));
CVF_ASSERT(wellAllocationPlot); CVF_ASSERT(wellAllocationPlot);
flowPlotColl->flowPlots.push_back(wellAllocationPlot); flowPlotColl->addPlot(wellAllocationPlot);
wellAllocationPlot->resolveReferencesRecursively(); wellAllocationPlot->resolveReferencesRecursively();
wellAllocationPlot->loadDataAndUpdate(); wellAllocationPlot->loadDataAndUpdate();

View File

@ -59,13 +59,13 @@ void RicShowWellAllocationPlotFeature::onActionTriggered(bool isChecked)
RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection(); RimFlowPlotCollection* flowPlotColl = RiaApplication::instance()->project()->mainPlotCollection->flowPlotCollection();
if (flowPlotColl) if (flowPlotColl)
{ {
flowPlotColl->defaultPlot->setFromSimulationWell(eclWell); flowPlotColl->defaultPlot()->setFromSimulationWell(eclWell);
flowPlotColl->defaultPlot->updateConnectedEditors(); flowPlotColl->defaultPlot()->updateConnectedEditors();
// Make sure the summary plot window is created and visible // Make sure the summary plot window is created and visible
RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow(); RiuMainPlotWindow* plotwindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
//RiaApplication::instance()->project()->updateConnectedEditors(); //RiaApplication::instance()->project()->updateConnectedEditors();
plotwindow->selectAsCurrentItem(flowPlotColl->defaultPlot); plotwindow->selectAsCurrentItem(flowPlotColl->defaultPlot());
} }
} }
} }

View File

@ -22,6 +22,7 @@
#include "cvfAssert.h" #include "cvfAssert.h"
#include "cafProgressInfo.h"
CAF_PDM_SOURCE_INIT(RimFlowPlotCollection, "FlowPlotCollection"); CAF_PDM_SOURCE_INIT(RimFlowPlotCollection, "FlowPlotCollection");
@ -32,12 +33,10 @@ RimFlowPlotCollection::RimFlowPlotCollection()
{ {
CAF_PDM_InitObject("Flow Diagnostics Plots", ":/newIcon16x16.png", "", ""); CAF_PDM_InitObject("Flow Diagnostics Plots", ":/newIcon16x16.png", "", "");
CAF_PDM_InitFieldNoDefault(&defaultPlot, "DefaultFlowPlot", "", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_defaultPlot, "DefaultFlowPlot", "", "", "", "");
defaultPlot = new RimWellAllocationPlot; m_defaultPlot.uiCapability()->setUiHidden(true);
defaultPlot->setDescription("Default Flow Diagnostics Plot");
defaultPlot.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&flowPlots, "FlowPlots", "Stored Plots", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_flowPlots, "FlowPlots", "Stored Plots", "", "", "");
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -45,9 +44,9 @@ RimFlowPlotCollection::RimFlowPlotCollection()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimFlowPlotCollection::~RimFlowPlotCollection() RimFlowPlotCollection::~RimFlowPlotCollection()
{ {
delete defaultPlot(); delete m_defaultPlot();
flowPlots.deleteAllChildObjects(); m_flowPlots.deleteAllChildObjects();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -55,7 +54,59 @@ RimFlowPlotCollection::~RimFlowPlotCollection()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots() void RimFlowPlotCollection::closeDefaultPlotWindowAndDeletePlots()
{ {
defaultPlot->removeFromMdiAreaAndDeleteViewWidget(); if ( m_defaultPlot )
{
flowPlots.deleteAllChildObjects(); m_defaultPlot->removeFromMdiAreaAndDeleteViewWidget();
delete m_defaultPlot();
}
m_flowPlots.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFlowPlotCollection::loadDataAndUpdate()
{
caf::ProgressInfo plotProgress(m_flowPlots.size() + 1, "");
if (m_defaultPlot) m_defaultPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
for (RimWellAllocationPlot* p : m_flowPlots)
{
p->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimFlowPlotCollection::plotCount() const
{
return m_flowPlots.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimFlowPlotCollection::addPlot(RimWellAllocationPlot* plot)
{
m_flowPlots.push_back(plot);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlot* RimFlowPlotCollection::defaultPlot()
{
if ( !m_defaultPlot() )
{
m_defaultPlot = new RimWellAllocationPlot;
m_defaultPlot->setDescription("Default Flow Diagnostics Plot");
}
this->updateConnectedEditors();
return m_defaultPlot();
} }

View File

@ -36,7 +36,13 @@ public:
virtual ~RimFlowPlotCollection(); virtual ~RimFlowPlotCollection();
void closeDefaultPlotWindowAndDeletePlots(); void closeDefaultPlotWindowAndDeletePlots();
void loadDataAndUpdate();
size_t plotCount() const;
caf::PdmChildField<RimWellAllocationPlot*> defaultPlot; void addPlot(RimWellAllocationPlot* plot);
caf::PdmChildArrayField<RimWellAllocationPlot*> flowPlots; RimWellAllocationPlot* defaultPlot();
private:
caf::PdmChildField<RimWellAllocationPlot*> m_defaultPlot;
caf::PdmChildArrayField<RimWellAllocationPlot*> m_flowPlots;
}; };