From ebddaa31e66071ca33e389b557a9cf02607d1d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 4 Jan 2017 13:13:06 +0100 Subject: [PATCH] #1054 Added sensible information to the Result Info window when picking Flow Diag results. Also rolled out the use of resultVariableUiName() to places that should use it. --- ...icSaveEclipseResultAsInputPropertyExec.cpp | 4 +++- .../RicExportMultipleSnapshotsFeature.cpp | 2 +- .../RifEclipseInputFileTools.cpp | 8 +++++++- .../Rim3dOverlayInfoConfig.cpp | 6 +++--- .../RimEclipsePropertyFilter.cpp | 2 +- .../RimEclipseResultDefinition.cpp | 13 ++++++++++++ .../RimEclipseResultDefinition.h | 2 ++ .../ProjectDataModel/RimEclipseView.cpp | 20 +++++++++---------- .../RimWellLogExtractionCurve.cpp | 3 ++- .../UserInterface/RiuResultTextBuilder.cpp | 11 +++++----- .../RiuSelectionChangedHandler.cpp | 2 +- 11 files changed, 48 insertions(+), 25 deletions(-) diff --git a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.cpp b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.cpp index 49f274112a..aa8fef57e5 100644 --- a/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.cpp +++ b/ApplicationCode/Commands/EclipseCommands/RicSaveEclipseResultAsInputPropertyExec.cpp @@ -37,6 +37,7 @@ #include #include +#include "cafUtils.h" //-------------------------------------------------------------------------------------------------- /// @@ -84,12 +85,13 @@ void RicSaveEclipseResultAsInputPropertyExec::redo() projectFolder = m_cellColors->reservoirView()->eclipseCase()->locationOnDisc(); } - QString outputFileName = projectFolder + "/" + m_cellColors->resultVariable(); + QString outputFileName = projectFolder + "/" + caf::Utils::makeValidFileBasename( m_cellColors->resultVariableUiName()); exportSettings.fileName = outputFileName; } caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Binary Eclipse Data to Text File", ""); + if (propertyDialog.exec() == QDialog::Accepted) { size_t timeStep = m_cellColors->reservoirView()->currentTimeStep(); diff --git a/ApplicationCode/Commands/RicExportMultipleSnapshotsFeature.cpp b/ApplicationCode/Commands/RicExportMultipleSnapshotsFeature.cpp index 789f22d4f2..76c441c870 100644 --- a/ApplicationCode/Commands/RicExportMultipleSnapshotsFeature.cpp +++ b/ApplicationCode/Commands/RicExportMultipleSnapshotsFeature.cpp @@ -293,7 +293,7 @@ QString RicExportMultipleSnapshotsFeature::resultName(RimView* rimView) { RimEclipseView* eclView = dynamic_cast(rimView); - return eclView->cellResult()->resultVariable(); + return caf::Utils::makeValidFileBasename(eclView->cellResult()->resultVariableUiName()); } else if (dynamic_cast(rimView)) { diff --git a/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp b/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp index 55a4d894fa..deb5de8404 100644 --- a/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp +++ b/ApplicationCode/FileInterface/RifEclipseInputFileTools.cpp @@ -472,7 +472,13 @@ bool RifEclipseInputFileTools::writePropertyToTextFile(const QString& fileName, /// Create and write a result vector with values for all cells. /// undefinedValue is used for cells with no result //-------------------------------------------------------------------------------------------------- -bool RifEclipseInputFileTools::writeBinaryResultToTextFile(const QString& fileName, RigCaseData* eclipseCase, RifReaderInterface::PorosityModelResultType porosityModel, size_t timeStep, const QString& resultName, const QString& eclipseKeyWord, const double undefinedValue) +bool RifEclipseInputFileTools::writeBinaryResultToTextFile(const QString& fileName, + RigCaseData* eclipseCase, + RifReaderInterface::PorosityModelResultType porosityModel, + size_t timeStep, + const QString& resultName, + const QString& eclipseKeyWord, + const double undefinedValue) { CVF_ASSERT(eclipseCase); diff --git a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index d4021d87f2..d318791e0d 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -360,13 +360,13 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView) if (eclipseView->cellResult()->isTernarySaturationSelected()) { - QString propName = eclipseView->cellResult()->resultVariable(); + QString propName = eclipseView->cellResult()->resultVariableUiName(); infoText += QString("Cell Property: %1 ").arg(propName); } if (isResultsInfoRelevant) { - QString propName = eclipseView->cellResult()->resultVariable(); + QString propName = eclipseView->cellResult()->resultVariableUiName(); QString timeRangeText = m_statisticsTimeRange().uiText(); if ( eclipseView->cellResult()->resultType() == RimDefines::FLOW_DIAGNOSTICS ) { @@ -406,7 +406,7 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView) } infoText += QString("Fault results: %1
").arg(faultMapping); - infoText += QString("Fault Property: %1
").arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariable()); + infoText += QString("Fault Property: %1
").arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariableUiName()); } } diff --git a/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilter.cpp b/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilter.cpp index f8c11becd1..9c47f1c756 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilter.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipsePropertyFilter.cpp @@ -353,7 +353,7 @@ void RimEclipsePropertyFilter::computeResultValueRange() //-------------------------------------------------------------------------------------------------- void RimEclipsePropertyFilter::updateFilterName() { - QString newFiltername = resultDefinition->resultVariable(); + QString newFiltername = resultDefinition->resultVariableUiName(); if (isCategorySelectionActive()) { diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 6220eaf6bb..985670e728 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -515,6 +515,19 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const return RigFlowDiagResultAddress(m_resultVariable().toStdString(), selTracerNames); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimEclipseResultDefinition::resultVariableUiName() +{ + if (resultType() == RimDefines::FLOW_DIAGNOSTICS) + { + return QString::fromStdString(flowDiagResAddress().uiText()); + } + + return m_resultVariable(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h index ca4c638294..26c6cc3cba 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h +++ b/ApplicationCode/ProjectDataModel/RimEclipseResultDefinition.h @@ -59,6 +59,8 @@ public: RimFlowDiagSolution* flowDiagSolution(); RigFlowDiagResultAddress flowDiagResAddress() const; + QString resultVariableUiName(); + void loadResult(); size_t scalarResultIndex() const; bool hasStaticResult() const; diff --git a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp index 71e01a8b9e..f4369d56de 100644 --- a/ApplicationCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/RimEclipseView.cpp @@ -1000,18 +1000,18 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R { double globalMin, globalMax; double globalPosClosestToZero, globalNegClosestToZero; - RigFlowDiagResults* cellResultsData = resultColors->flowDiagSolution()->flowDiagResults(); + RigFlowDiagResults* flowResultsData = resultColors->flowDiagSolution()->flowDiagResults(); RigFlowDiagResultAddress resAddr = resultColors->flowDiagResAddress(); - cellResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &globalMin, &globalMax); - cellResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &globalPosClosestToZero, &globalNegClosestToZero); + flowResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &globalMin, &globalMax); + flowResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &globalPosClosestToZero, &globalNegClosestToZero); double localMin, localMax; double localPosClosestToZero, localNegClosestToZero; if ( resultColors->hasDynamicResult() ) { - cellResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &localMin, &localMax); - cellResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &localPosClosestToZero, &localNegClosestToZero); + flowResultsData->minMaxScalarValues(resAddr, m_currentTimeStep, &localMin, &localMax); + flowResultsData->posNegClosestToZero(resAddr, m_currentTimeStep, &localPosClosestToZero, &localNegClosestToZero); } else { @@ -1033,9 +1033,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R resultColors->legendConfig()->setNamedCategories(resultColors->flowDiagSolution()->tracerNames()); } - m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend()); - resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + QString::fromStdString( resultColors->flowDiagResAddress().uiText()))); - } + } else { double globalMin, globalMax; @@ -1077,10 +1075,10 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R resultColors->legendConfig()->setNamedCategoriesInverse(fnVector); } } - - m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend()); - resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariable())); } + + m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend()); + resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariableUiName())); } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index fb76e70358..461aca615d 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -51,6 +51,7 @@ #include "cafPdmUiTreeOrdering.h" #include +#include "cafUtils.h" //================================================================================================== /// @@ -570,7 +571,7 @@ QString RimWellLogExtractionCurve::wellLogChannelName() const QString name; if (eclipseCase) { - name = m_eclipseResultDefinition->resultVariable(); + name = caf::Utils::makeValidFileBasename( m_eclipseResultDefinition->resultVariableUiName()); } else if (geoMechCase) { diff --git a/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp index cece373605..e8f791b9ec 100644 --- a/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationCode/UserInterface/RiuResultTextBuilder.cpp @@ -345,7 +345,7 @@ QString RiuResultTextBuilder::nncResultText() const std::vector* nncValues = nncData->connectionScalarResult(scalarResultIdx); if (nncValues) { - QString resultVar = m_reservoirView->currentFaultResultColors()->resultVariable(); + QString resultVar = m_reservoirView->currentFaultResultColors()->resultVariableUiName(); double scalarValue = (*nncValues)[m_nncIndex]; text = QString("%1 : %2").arg(resultVar).arg(scalarValue); @@ -489,14 +489,14 @@ void RiuResultTextBuilder::appendTextFromResultColors(RigCaseData* eclipseCase, } else { - resultAccessor = RigResultAccessorFactory::createFromResultIdx(eclipseCase, gridIndex, porosityModel, timeStepIndex, resultColors->scalarResultIndex()); + resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCase, gridIndex, timeStepIndex, resultColors); } if (resultAccessor.notNull()) { double scalarValue = resultAccessor->cellScalar(cellIndex); resultInfoText->append("Cell result : "); - resultInfoText->append(resultColors->resultVariable()); + resultInfoText->append(resultColors->resultVariableUiName()); resultInfoText->append(QString(" : %1\n").arg(scalarValue)); } } @@ -649,7 +649,6 @@ QString RiuResultTextBuilder::cellResultText(RimEclipseCellColors* resultColors) RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(resultColors->porosityModel()); - QString resultVar = resultColors->resultVariable(); if (resultColors->isTernarySaturationSelected()) { @@ -687,10 +686,12 @@ QString RiuResultTextBuilder::cellResultText(RimEclipseCellColors* resultColors) adjustedTimeStep = 0; } - cvf::ref resultAccessor = RigResultAccessorFactory::createFromUiResultName(eclipseCaseData, m_gridIndex, porosityModel, adjustedTimeStep, resultVar); + cvf::ref resultAccessor = RigResultAccessorFactory::createFromResultDefinition(eclipseCaseData, m_gridIndex, adjustedTimeStep, resultColors); if (resultAccessor.notNull()) { double scalarValue = resultAccessor->cellFaceScalar(m_cellIndex, m_face); + QString resultVar = resultColors->resultVariableUiName(); + text = QString("%1 : %2").arg(resultVar).arg(scalarValue); } } diff --git a/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp b/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp index e24c06dcaf..35e3bce98b 100644 --- a/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp +++ b/ApplicationCode/UserInterface/RiuSelectionChangedHandler.cpp @@ -123,7 +123,7 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuEclipseSelec QString curveName = eclipseView->eclipseCase()->caseUserDescription(); curveName += ", "; - curveName += eclipseView->cellResult()->resultVariable(); + curveName += eclipseView->cellResult()->resultVariableUiName(); curveName += ", "; curveName += QString("Grid index %1").arg(eclipseSelectionItem->m_gridIndex); curveName += ", ";