From 4a9fec49bff454097318a753673304b3d91abaad Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 11 Jan 2017 21:07:03 +0100 Subject: [PATCH] #1056 Added cell edge picking text info --- .../Rim3dOverlayInfoConfig.cpp | 2 +- .../ProjectDataModel/RimCellEdgeColors.cpp | 15 ++++++ .../ProjectDataModel/RimCellEdgeColors.h | 1 + .../ProjectDataModel/RimEclipseView.cpp | 2 +- .../UserInterface/RiuResultTextBuilder.cpp | 51 +++++++++++-------- 5 files changed, 48 insertions(+), 23 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index a9d6db3ed5..9fac1aacc5 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -414,7 +414,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView) if (eclipseView->hasUserRequestedAnimation() && eclipseView->cellEdgeResult()->hasResult()) { double min, max; - QString cellEdgeName = eclipseView->cellEdgeResult()->resultVariable(); + QString cellEdgeName = eclipseView->cellEdgeResult()->resultVariableUiName(); eclipseView->cellEdgeResult()->minMaxCellEdgeValues(min, max); infoText += QString("Cell Edge Property: %1 ").arg(cellEdgeName); infoText += QString("" diff --git a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp index e86f24920d..27378e3a88 100644 --- a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp +++ b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.cpp @@ -528,6 +528,21 @@ QString RimCellEdgeColors::resultVariable() const } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimCellEdgeColors::resultVariableUiName() const +{ + if (isUsingSingleVariable()) + { + return m_singleVarEdgeResultColors->resultVariableUiName(); + } + else + { + return m_resultVariable; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.h b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.h index ac97c486fc..b39724b93f 100644 --- a/ApplicationCode/ProjectDataModel/RimCellEdgeColors.h +++ b/ApplicationCode/ProjectDataModel/RimCellEdgeColors.h @@ -73,6 +73,7 @@ public: void setResultVariable(const QString& variableName); QString resultVariable() const; + QString resultVariableUiName() const; caf::PdmField enableCellEdgeColors; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 089ae0c828..12bb2b78fe 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -989,7 +989,7 @@ void RimEclipseView::updateLegends() } m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend()); - this->cellEdgeResult()->legendConfig()->setTitle(cvfqt::Utils::toString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariable())); + this->cellEdgeResult()->legendConfig()->setTitle(cvfqt::Utils::toString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariableUiName())); } else { diff --git a/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp index a870232f5f..c5ca780486 100644 --- a/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp @@ -516,33 +516,42 @@ QString RiuResultTextBuilder::cellEdgeResultDetails() if (m_reservoirView->cellEdgeResult()->hasResult()) { - std::vector metaData; - m_reservoirView->cellEdgeResult()->cellEdgeMetaData(&metaData); - - std::set uniqueResultIndices; - text += "-- Cell edge result data --\n"; - for (int idx = 0; idx < 6; idx++) + + if (m_reservoirView->cellEdgeResult()->isUsingSingleVariable()) { - size_t resultIndex = metaData[idx].m_resultIndex; - if (resultIndex == cvf::UNDEFINED_SIZE_T) continue; + text += cellResultText(m_reservoirView->cellEdgeResult()->singleVarEdgeResultColors()); + text += "\n"; + } + else + { + std::vector metaData; + m_reservoirView->cellEdgeResult()->cellEdgeMetaData(&metaData); + + std::set uniqueResultIndices; + + for (int idx = 0; idx < 6; idx++) + { + size_t resultIndex = metaData[idx].m_resultIndex; + if (resultIndex == cvf::UNDEFINED_SIZE_T) continue; - if (uniqueResultIndices.find(resultIndex) != uniqueResultIndices.end()) continue; + if (uniqueResultIndices.find(resultIndex) != uniqueResultIndices.end()) continue; - size_t adjustedTimeStep = m_timeStepIndex; - if (metaData[idx].m_isStatic) - { - adjustedTimeStep = 0; - } + size_t adjustedTimeStep = m_timeStepIndex; + if (metaData[idx].m_isStatic) + { + adjustedTimeStep = 0; + } - RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_reservoirView->cellResult()->porosityModel()); - cvf::ref resultAccessor = RigResultAccessorFactory::createFromResultIdx(m_reservoirView->eclipseCase()->reservoirData(), m_gridIndex, porosityModel, adjustedTimeStep, resultIndex); - if (resultAccessor.notNull()) - { - double scalarValue = resultAccessor->cellScalar(m_cellIndex); - text.append(QString("%1 : %2\n").arg(metaData[idx].m_resultVariable).arg(scalarValue)); + RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_reservoirView->cellResult()->porosityModel()); + cvf::ref resultAccessor = RigResultAccessorFactory::createFromResultIdx(m_reservoirView->eclipseCase()->reservoirData(), m_gridIndex, porosityModel, adjustedTimeStep, resultIndex); + if (resultAccessor.notNull()) + { + double scalarValue = resultAccessor->cellScalar(m_cellIndex); + text.append(QString("%1 : %2\n").arg(metaData[idx].m_resultVariable).arg(scalarValue)); - uniqueResultIndices.insert(resultIndex); + uniqueResultIndices.insert(resultIndex); + } } } }