From 6f04f70adec26775037e173326082c3f4318c88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 12 Jun 2013 13:42:36 +0200 Subject: [PATCH] Fixed missing update of the 3D view after deleting statistic results p4#: 21894 --- .../ProjectDataModel/RimReservoirView.cpp | 7 ++-- .../ProjectDataModel/RimResultDefinition.cpp | 33 +++++++++---------- .../ProjectDataModel/RimResultDefinition.h | 2 +- .../ProjectDataModel/RimStatisticsCase.cpp | 9 +++++ 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp index 6b2c3b7b75..6402bce527 100644 --- a/ApplicationCode/ProjectDataModel/RimReservoirView.cpp +++ b/ApplicationCode/ProjectDataModel/RimReservoirView.cpp @@ -527,7 +527,7 @@ void RimReservoirView::createDisplayModel() timeStepIndices.push_back(0); } - updateLegends(); + cvf::Collection frameModels; size_t timeIdx; @@ -644,6 +644,8 @@ void RimReservoirView::createDisplayModel() m_viewer->slotSetCurrentFrame(m_currentTimeStep); } + overlayInfoConfig()->update3DInfo(); + updateLegends(); } @@ -848,7 +850,6 @@ void RimReservoirView::loadDataAndUpdate() setDefaultView(); } - overlayInfoConfig()->update3DInfo(); } @@ -1443,8 +1444,6 @@ void RimReservoirView::updateDisplayModelForWellResults() createDisplayModel(); updateDisplayModelVisibility(); - overlayInfoConfig()->update3DInfo(); - if (animationMode && m_viewer) { m_viewer->slotSetCurrentFrame(m_currentTimeStep); diff --git a/ApplicationCode/ProjectDataModel/RimResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimResultDefinition.cpp index b39019e6af..58e52f9975 100644 --- a/ApplicationCode/ProjectDataModel/RimResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimResultDefinition.cpp @@ -44,7 +44,7 @@ CAF_PDM_SOURCE_INIT(RimResultDefinition, "ResultDefinition"); /// //-------------------------------------------------------------------------------------------------- RimResultDefinition::RimResultDefinition() - : m_gridScalarResultIndex(cvf::UNDEFINED_SIZE_T) + //: m_gridScalarResultIndex(cvf::UNDEFINED_SIZE_T) { CAF_PDM_InitObject("Result Definition", "", "", ""); @@ -180,12 +180,12 @@ QList RimResultDefinition::calculateValueOptions(const c //-------------------------------------------------------------------------------------------------- size_t RimResultDefinition::gridScalarIndex() const { - if (m_gridScalarResultIndex == cvf::UNDEFINED_SIZE_T) - { - const RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults(); - if (gridCellResults) m_gridScalarResultIndex = gridCellResults->cellResults()->findScalarResultIndex(m_resultType(), m_resultVariable()); - } - return m_gridScalarResultIndex; + size_t gridScalarResultIndex = cvf::UNDEFINED_SIZE_T; + + const RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults(); + if (gridCellResults) gridScalarResultIndex = gridCellResults->cellResults()->findScalarResultIndex(m_resultType(), m_resultVariable()); + + return gridScalarResultIndex; } //-------------------------------------------------------------------------------------------------- @@ -196,12 +196,9 @@ void RimResultDefinition::loadResult() RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults(); if (gridCellResults) { - m_gridScalarResultIndex = gridCellResults->findOrLoadScalarResult(m_resultType(), m_resultVariable); - } - else - { - m_gridScalarResultIndex = cvf::UNDEFINED_SIZE_T; + gridCellResults->findOrLoadScalarResult(m_resultType(), m_resultVariable); } + } @@ -212,7 +209,9 @@ void RimResultDefinition::loadResult() bool RimResultDefinition::hasStaticResult() const { const RimReservoirCellResultsStorage* gridCellResults = this->currentGridCellResults(); - if (hasResult() && gridCellResults->cellResults()->timeStepCount(m_gridScalarResultIndex) == 1 ) + size_t gridScalarResultIndex = this->gridScalarIndex(); + + if (hasResult() && gridCellResults->cellResults()->timeStepCount(gridScalarResultIndex) == 1 ) { return true; } @@ -227,13 +226,12 @@ bool RimResultDefinition::hasStaticResult() const //-------------------------------------------------------------------------------------------------- bool RimResultDefinition::hasResult() const { - if (m_gridScalarResultIndex != cvf::UNDEFINED_SIZE_T) return true; if (this->currentGridCellResults() && this->currentGridCellResults()->cellResults()) { const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults()->cellResults(); - m_gridScalarResultIndex = gridCellResults->findScalarResultIndex(m_resultType(), m_resultVariable()); - return m_gridScalarResultIndex != cvf::UNDEFINED_SIZE_T; + size_t gridScalarResultIndex = gridCellResults->findScalarResultIndex(m_resultType(), m_resultVariable()); + return gridScalarResultIndex != cvf::UNDEFINED_SIZE_T; } return false; @@ -255,7 +253,8 @@ bool RimResultDefinition::hasDynamicResult() const if (this->currentGridCellResults() && this->currentGridCellResults()->cellResults()) { const RigCaseCellResultsData* gridCellResults = this->currentGridCellResults()->cellResults(); - if (gridCellResults->timeStepCount(m_gridScalarResultIndex) > 1 ) + size_t gridScalarResultIndex = this->gridScalarIndex(); + if (gridCellResults->timeStepCount(gridScalarResultIndex) > 1 ) { return true; } diff --git a/ApplicationCode/ProjectDataModel/RimResultDefinition.h b/ApplicationCode/ProjectDataModel/RimResultDefinition.h index 7fb4dbda0b..2c7b6c28cf 100644 --- a/ApplicationCode/ProjectDataModel/RimResultDefinition.h +++ b/ApplicationCode/ProjectDataModel/RimResultDefinition.h @@ -74,7 +74,7 @@ protected: caf::PdmField m_resultVariableUiField; - mutable size_t m_gridScalarResultIndex; + //mutable size_t m_gridScalarResultIndex; caf::PdmPointer m_reservoirView; diff --git a/ApplicationCode/ProjectDataModel/RimStatisticsCase.cpp b/ApplicationCode/ProjectDataModel/RimStatisticsCase.cpp index 4ca841b957..bd18f8e4a0 100644 --- a/ApplicationCode/ProjectDataModel/RimStatisticsCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimStatisticsCase.cpp @@ -650,6 +650,15 @@ void RimStatisticsCase::clearComputedStatistics() reservoirData()->results(RifReaderInterface::MATRIX_RESULTS)->clearAllResults(); reservoirData()->results(RifReaderInterface::FRACTURE_RESULTS)->clearAllResults(); + for (size_t i = 0; i < reservoirViews().size(); i++) + { + RimReservoirView* reservoirView = reservoirViews()[i]; + CVF_ASSERT(reservoirView); + + reservoirView->scheduleGeometryRegen(RivReservoirViewPartMgr::ACTIVE); + reservoirView->createDisplayModelAndRedraw(); + } + this->updateConnectedEditors(); }