From 18e9ef0558cb86c285df1438d1397c020d72f703 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 16 Oct 2023 13:59:44 +0200 Subject: [PATCH] Make sure seismic file reader is created in RiaApplication::loadProject() --- .../Application/RiaApplication.cpp | 11 ++++++++++- .../Seismic/RimSeismicData.cpp | 18 ++++++++++-------- .../ProjectDataModel/Seismic/RimSeismicData.h | 3 ++- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 26c5b71d07..dea00e24bb 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -68,6 +68,8 @@ #include "RimPlotWindow.h" #include "RimProject.h" #include "RimScriptCollection.h" +#include "RimSeismicData.h" +#include "RimSeismicDataCollection.h" #include "RimSeismicView.h" #include "RimSeismicViewCollection.h" #include "RimSimWellInViewCollection.h" @@ -526,7 +528,6 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct } } - // Add well paths for each oil field for ( size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++ ) { RimOilField* oilField = m_project->oilFields[oilFieldIdx]; @@ -536,8 +537,16 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct oilField->wellPathCollection = std::make_unique(); } + // Initialize well paths oilField->wellPathCollection->loadDataAndUpdate(); oilField->ensembleWellLogsCollection->loadDataAndUpdate(); + + // Initialize seismic data + auto& seisDataColl = oilField->seismicDataCollection(); + for ( auto seismicData : seisDataColl->seismicData() ) + { + seismicData->ensureFileReaderIsInitialized(); + } } { diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicData.cpp b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicData.cpp index 2ffc1c9906..72c0112dca 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicData.cpp @@ -145,14 +145,6 @@ void RimSeismicData::logError( QString msg ) m_nErrorsLogged++; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSeismicData::initAfterRead() -{ - updateMetaData(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -498,6 +490,16 @@ std::pair RimSeismicData::dataRangeMinMax() const return m_activeDataRange; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSeismicData::ensureFileReaderIsInitialized() +{ + if ( !openFileIfNotOpen() ) return; + + updateMetaData(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicData.h b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicData.h index b95a2af1a4..812b056761 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicData.h +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicData.h @@ -69,9 +69,10 @@ class RimSeismicData : public RimSeismicDataInterface std::pair dataRangeMinMax() const override; + void ensureFileReaderIsInitialized(); + protected: void updateMetaData(); - void initAfterRead() override; caf::PdmFieldHandle* userDescriptionField() override;