mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix problem with assignment of view id for plots on console runs
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -407,6 +407,7 @@ void RiaConsoleApplication::onProjectOpeningError( const QString& errMsg )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::onProjectOpened()
|
||||
{
|
||||
loadAndUpdatePlotData();
|
||||
processEvents();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -162,8 +162,6 @@ private:
|
||||
void createMainPlotWindow();
|
||||
void deleteMainPlotWindow();
|
||||
|
||||
void loadAndUpdatePlotData();
|
||||
|
||||
void storeTreeViewState();
|
||||
|
||||
bool notify( QObject*, QEvent* ) override;
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user