diff --git a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.cpp b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.cpp index f3f9abf07d..5d2dfa14f8 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.cpp @@ -111,6 +111,8 @@ RimEclipseStatisticsCase::RimEclipseStatisticsCase() CAF_PDM_InitField(&m_wellDataSourceCase, "WellDataSourceCase", RimDefines::undefinedResultName(), "Well Data Source Case", "", "", "" ); CAF_PDM_InitField(&m_useZeroAsInactiveCellValue, "UseZeroAsInactiveCellValue", false, "Use Zero as Inactive Cell Value", "", "", ""); + + m_populateSelectionAfterLoadingGrid = false; } //-------------------------------------------------------------------------------------------------- @@ -156,7 +158,12 @@ bool RimEclipseStatisticsCase::openEclipseGridFile() this->setReservoirData( eclipseCase.p() ); - this->populateWithDefaultsIfNeeded(); + if (m_populateSelectionAfterLoadingGrid) + { + this->populateResultSelection(); + + m_populateSelectionAfterLoadingGrid = false; + } return true; } @@ -169,6 +176,14 @@ RimCaseCollection* RimEclipseStatisticsCase::parentStatisticsCaseCollection() return dynamic_cast(this->parentField()->ownerObject()); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseStatisticsCase::populateResultSelectionAfterLoadingGrid() +{ + m_populateSelectionAfterLoadingGrid = true; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -684,12 +699,12 @@ void RimEclipseStatisticsCase::computeStatisticsAndUpdateViews() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEclipseStatisticsCase::populateWithDefaultsIfNeeded() +void RimEclipseStatisticsCase::populateResultSelection() { RimIdenticalGridCaseGroup* idgcg = caseGroup(); if (!(caseGroup() && caseGroup()->mainCase() && caseGroup()->mainCase()->reservoirData())) { - return ; + return; } RigCaseData* caseData = idgcg->mainCase()->reservoirData(); diff --git a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.h b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.h index 1b252f40e2..68aa5854b3 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseStatisticsCase.h @@ -71,6 +71,8 @@ public: caf::PdmField< bool > m_calculateEditCommand; virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath){} + + void populateResultSelectionAfterLoadingGrid(); private: void scheduleACTIVEGeometryRegenOnReservoirViews(); @@ -79,7 +81,7 @@ private: void getSourceCases(std::vector& sourceCases); - void populateWithDefaultsIfNeeded(); + void populateResultSelection(); void updateSelectionListVisibilities(); void updateSelectionSummaryLabel(); @@ -121,4 +123,6 @@ private: caf::PdmField m_wellDataSourceCase; caf::PdmField< bool > m_useZeroAsInactiveCellValue; + + bool m_populateSelectionAfterLoadingGrid; }; diff --git a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp index 7d777bf6c7..671aadd93d 100644 --- a/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp +++ b/ApplicationCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp @@ -378,7 +378,8 @@ RimEclipseStatisticsCase* RimIdenticalGridCaseGroup::createAndAppendStatisticsCa newStatisticsCase->caseUserDescription = QString("Statistics ") + QString::number(statisticsCaseCollection()->reservoirs.size()+1); statisticsCaseCollection()->reservoirs.push_back(newStatisticsCase); - + + newStatisticsCase->populateResultSelectionAfterLoadingGrid(); newStatisticsCase->openEclipseGridFile(); return newStatisticsCase;