Fix problem with assignment of view id for plots on console runs

This commit is contained in:
Gaute Lindkvist
2020-01-27 13:12:28 +01:00
parent 98dfa8a72b
commit 54f1ed32de
6 changed files with 164 additions and 154 deletions

View File

@@ -55,10 +55,13 @@
#include "RimGridCrossPlotCollection.h"
#include "RimIdenticalGridCaseGroup.h"
#include "RimMainPlotCollection.h"
#include "RimMultiPlot.h"
#include "RimMultiPlotCollection.h"
#include "RimObservedDataCollection.h"
#include "RimObservedFmuRftData.h"
#include "RimObservedSummaryData.h"
#include "RimOilField.h"
#include "RimPlotWindow.h"
#include "RimPltPlotCollection.h"
#include "RimProject.h"
#include "RimRftPlotCollection.h"
@@ -71,6 +74,7 @@
#include "RimSummaryCaseMainCollection.h"
#include "RimSummaryCrossPlotCollection.h"
#include "RimSummaryPlot.h"
#include "RimSummaryPlotCollection.h"
#include "RimSurfaceCollection.h"
#include "RimTextAnnotation.h"
#include "RimTextAnnotationInView.h"
@@ -1505,3 +1509,153 @@ int RiaApplication::launchUnitTestsWithConsole()
{
return launchUnitTests();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaApplication::loadAndUpdatePlotData()
{
RimWellLogPlotCollection* wlpColl = nullptr;
RimSummaryPlotCollection* spColl = nullptr;
RimSummaryCrossPlotCollection* scpColl = nullptr;
RimFlowPlotCollection* flowColl = nullptr;
RimRftPlotCollection* rftColl = nullptr;
RimPltPlotCollection* pltColl = nullptr;
RimGridCrossPlotCollection* gcpColl = nullptr;
RimSaturationPressurePlotCollection* sppColl = nullptr;
RimMultiPlotCollection* gpwColl = nullptr;
if ( m_project->mainPlotCollection() )
{
if ( m_project->mainPlotCollection()->wellLogPlotCollection() )
{
wlpColl = m_project->mainPlotCollection()->wellLogPlotCollection();
}
if ( m_project->mainPlotCollection()->summaryPlotCollection() )
{
spColl = m_project->mainPlotCollection()->summaryPlotCollection();
}
if ( m_project->mainPlotCollection()->summaryCrossPlotCollection() )
{
scpColl = m_project->mainPlotCollection()->summaryCrossPlotCollection();
}
if ( m_project->mainPlotCollection()->flowPlotCollection() )
{
flowColl = m_project->mainPlotCollection()->flowPlotCollection();
}
if ( m_project->mainPlotCollection()->rftPlotCollection() )
{
rftColl = m_project->mainPlotCollection()->rftPlotCollection();
}
if ( m_project->mainPlotCollection()->pltPlotCollection() )
{
pltColl = m_project->mainPlotCollection()->pltPlotCollection();
}
if ( m_project->mainPlotCollection()->gridCrossPlotCollection() )
{
gcpColl = m_project->mainPlotCollection()->gridCrossPlotCollection();
}
if ( m_project->mainPlotCollection()->saturationPressurePlotCollection() )
{
sppColl = m_project->mainPlotCollection()->saturationPressurePlotCollection();
}
if ( m_project->mainPlotCollection()->multiPlotCollection() )
{
gpwColl = m_project->mainPlotCollection()->multiPlotCollection();
}
}
size_t plotCount = 0;
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
plotCount += spColl ? spColl->summaryPlots().size() : 0;
plotCount += scpColl ? scpColl->summaryPlots().size() : 0;
plotCount += flowColl ? flowColl->plotCount() : 0;
plotCount += rftColl ? rftColl->rftPlots().size() : 0;
plotCount += pltColl ? pltColl->pltPlots().size() : 0;
plotCount += gcpColl ? gcpColl->gridCrossPlots().size() : 0;
plotCount += sppColl ? sppColl->plots().size() : 0;
plotCount += gpwColl ? gpwColl->multiPlots().size() : 0;
if ( plotCount > 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->summaryPlots().size(); ++wlpIdx )
{
spColl->summaryPlots[wlpIdx]->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( scpColl )
{
for ( auto plot : scpColl->summaryPlots() )
{
plot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( flowColl )
{
plotProgress.setNextProgressIncrement( flowColl->plotCount() );
flowColl->loadDataAndUpdate();
plotProgress.incrementProgress();
}
if ( rftColl )
{
for ( const auto& rftPlot : rftColl->rftPlots() )
{
rftPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( pltColl )
{
for ( const auto& pltPlot : pltColl->pltPlots() )
{
pltPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( gcpColl )
{
for ( const auto& gcpPlot : gcpColl->gridCrossPlots() )
{
gcpPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( sppColl )
{
for ( const auto& sppPlot : sppColl->plots() )
{
sppPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( gpwColl )
{
for ( const auto& multiPlot : gpwColl->multiPlots() )
{
multiPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
}
}

View File

@@ -223,6 +223,8 @@ protected:
virtual void startMonitoringWorkProgress( caf::UiProcess* uiProcess ) {}
virtual void stopMonitoringWorkProgress() {}
void loadAndUpdatePlotData();
protected:
cvf::ref<cvf::Font> m_defaultSceneFont;
cvf::ref<cvf::Font> m_defaultAnnotationFont;

View File

@@ -407,6 +407,7 @@ void RiaConsoleApplication::onProjectOpeningError( const QString& errMsg )
//--------------------------------------------------------------------------------------------------
void RiaConsoleApplication::onProjectOpened()
{
loadAndUpdatePlotData();
processEvents();
}

View File

@@ -301,156 +301,6 @@ bool RiaGuiApplication::saveProjectAs( const QString& fileName )
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaGuiApplication::loadAndUpdatePlotData()
{
RimWellLogPlotCollection* wlpColl = nullptr;
RimSummaryPlotCollection* spColl = nullptr;
RimSummaryCrossPlotCollection* scpColl = nullptr;
RimFlowPlotCollection* flowColl = nullptr;
RimRftPlotCollection* rftColl = nullptr;
RimPltPlotCollection* pltColl = nullptr;
RimGridCrossPlotCollection* gcpColl = nullptr;
RimSaturationPressurePlotCollection* sppColl = nullptr;
RimMultiPlotCollection* gpwColl = nullptr;
if ( m_project->mainPlotCollection() )
{
if ( m_project->mainPlotCollection()->wellLogPlotCollection() )
{
wlpColl = m_project->mainPlotCollection()->wellLogPlotCollection();
}
if ( m_project->mainPlotCollection()->summaryPlotCollection() )
{
spColl = m_project->mainPlotCollection()->summaryPlotCollection();
}
if ( m_project->mainPlotCollection()->summaryCrossPlotCollection() )
{
scpColl = m_project->mainPlotCollection()->summaryCrossPlotCollection();
}
if ( m_project->mainPlotCollection()->flowPlotCollection() )
{
flowColl = m_project->mainPlotCollection()->flowPlotCollection();
}
if ( m_project->mainPlotCollection()->rftPlotCollection() )
{
rftColl = m_project->mainPlotCollection()->rftPlotCollection();
}
if ( m_project->mainPlotCollection()->pltPlotCollection() )
{
pltColl = m_project->mainPlotCollection()->pltPlotCollection();
}
if ( m_project->mainPlotCollection()->gridCrossPlotCollection() )
{
gcpColl = m_project->mainPlotCollection()->gridCrossPlotCollection();
}
if ( m_project->mainPlotCollection()->saturationPressurePlotCollection() )
{
sppColl = m_project->mainPlotCollection()->saturationPressurePlotCollection();
}
if ( m_project->mainPlotCollection()->multiPlotCollection() )
{
gpwColl = m_project->mainPlotCollection()->multiPlotCollection();
}
}
size_t plotCount = 0;
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
plotCount += spColl ? spColl->summaryPlots().size() : 0;
plotCount += scpColl ? scpColl->summaryPlots().size() : 0;
plotCount += flowColl ? flowColl->plotCount() : 0;
plotCount += rftColl ? rftColl->rftPlots().size() : 0;
plotCount += pltColl ? pltColl->pltPlots().size() : 0;
plotCount += gcpColl ? gcpColl->gridCrossPlots().size() : 0;
plotCount += sppColl ? sppColl->plots().size() : 0;
plotCount += gpwColl ? gpwColl->multiPlots().size() : 0;
if ( plotCount > 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->summaryPlots().size(); ++wlpIdx )
{
spColl->summaryPlots[wlpIdx]->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( scpColl )
{
for ( auto plot : scpColl->summaryPlots() )
{
plot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( flowColl )
{
plotProgress.setNextProgressIncrement( flowColl->plotCount() );
flowColl->loadDataAndUpdate();
plotProgress.incrementProgress();
}
if ( rftColl )
{
for ( const auto& rftPlot : rftColl->rftPlots() )
{
rftPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( pltColl )
{
for ( const auto& pltPlot : pltColl->pltPlots() )
{
pltPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( gcpColl )
{
for ( const auto& gcpPlot : gcpColl->gridCrossPlots() )
{
gcpPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( sppColl )
{
for ( const auto& sppPlot : sppColl->plots() )
{
sppPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
if ( gpwColl )
{
for ( const auto& multiPlot : gpwColl->multiPlots() )
{
multiPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -162,8 +162,6 @@ private:
void createMainPlotWindow();
void deleteMainPlotWindow();
void loadAndUpdatePlotData();
void storeTreeViewState();
bool notify( QObject*, QEvent* ) override;

View File

@@ -32,10 +32,15 @@ def test_well_log_plots(rips_instance, initialize_test):
with tempfile.TemporaryDirectory(prefix="rips") as tmpdirname:
for well_log_plot in well_log_plots:
well_log_plot.set_depth_type("TRUE_VERTICAL_DEPTH_RKB")
well_log_plot.export_snapshot(tmpdirname)
if rips_instance.is_gui():
well_log_plot.export_snapshot(tmpdirname)
well_log_plot.export_data_as_las(tmpdirname)
files = os.listdir(tmpdirname)
assert(len(files) == 4)
print (files)
if rips_instance.is_gui():
assert(len(files) == 4)
else:
assert(len(files) == 2)
plots2 = project.plots()
for plot2 in plots2: