#991 Statistics: Do not modify selected results when loading project file

This commit is contained in:
Magne Sjaastad 2016-11-23 10:23:59 +01:00
parent 57aa47ecdd
commit 1b1831e5e1
3 changed files with 25 additions and 5 deletions

View File

@ -111,6 +111,8 @@ RimEclipseStatisticsCase::RimEclipseStatisticsCase()
CAF_PDM_InitField(&m_wellDataSourceCase, "WellDataSourceCase", RimDefines::undefinedResultName(), "Well Data Source Case", "", "", "" ); 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", "", "", ""); 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->setReservoirData( eclipseCase.p() );
this->populateWithDefaultsIfNeeded(); if (m_populateSelectionAfterLoadingGrid)
{
this->populateResultSelection();
m_populateSelectionAfterLoadingGrid = false;
}
return true; return true;
} }
@ -169,6 +176,14 @@ RimCaseCollection* RimEclipseStatisticsCase::parentStatisticsCaseCollection()
return dynamic_cast<RimCaseCollection*>(this->parentField()->ownerObject()); return dynamic_cast<RimCaseCollection*>(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(); RimIdenticalGridCaseGroup* idgcg = caseGroup();
if (!(caseGroup() && caseGroup()->mainCase() && caseGroup()->mainCase()->reservoirData())) if (!(caseGroup() && caseGroup()->mainCase() && caseGroup()->mainCase()->reservoirData()))
{ {
return ; return;
} }
RigCaseData* caseData = idgcg->mainCase()->reservoirData(); RigCaseData* caseData = idgcg->mainCase()->reservoirData();

View File

@ -72,6 +72,8 @@ public:
caf::PdmField< bool > m_calculateEditCommand; caf::PdmField< bool > m_calculateEditCommand;
virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath){} virtual void updateFilePathsFromProjectPath(const QString& projectPath, const QString& oldProjectPath){}
void populateResultSelectionAfterLoadingGrid();
private: private:
void scheduleACTIVEGeometryRegenOnReservoirViews(); void scheduleACTIVEGeometryRegenOnReservoirViews();
@ -79,7 +81,7 @@ private:
void getSourceCases(std::vector<RimEclipseCase*>& sourceCases); void getSourceCases(std::vector<RimEclipseCase*>& sourceCases);
void populateWithDefaultsIfNeeded(); void populateResultSelection();
void updateSelectionListVisibilities(); void updateSelectionListVisibilities();
void updateSelectionSummaryLabel(); void updateSelectionSummaryLabel();
@ -121,4 +123,6 @@ private:
caf::PdmField<QString> m_wellDataSourceCase; caf::PdmField<QString> m_wellDataSourceCase;
caf::PdmField< bool > m_useZeroAsInactiveCellValue; caf::PdmField< bool > m_useZeroAsInactiveCellValue;
bool m_populateSelectionAfterLoadingGrid;
}; };

View File

@ -379,6 +379,7 @@ RimEclipseStatisticsCase* RimIdenticalGridCaseGroup::createAndAppendStatisticsCa
newStatisticsCase->caseUserDescription = QString("Statistics ") + QString::number(statisticsCaseCollection()->reservoirs.size()+1); newStatisticsCase->caseUserDescription = QString("Statistics ") + QString::number(statisticsCaseCollection()->reservoirs.size()+1);
statisticsCaseCollection()->reservoirs.push_back(newStatisticsCase); statisticsCaseCollection()->reservoirs.push_back(newStatisticsCase);
newStatisticsCase->populateResultSelectionAfterLoadingGrid();
newStatisticsCase->openEclipseGridFile(); newStatisticsCase->openEclipseGridFile();
return newStatisticsCase; return newStatisticsCase;