From c8ebb0a4d1f7181bfdf3a339ee58350beab0a97a Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Mon, 5 Nov 2018 16:13:33 +0100 Subject: [PATCH] #3626 2d Maps: Adjust min/max limits for all time steps and TOP result. --- .../ProjectDataModel/Rim2dEclipseView.cpp | 2 +- .../ProjectDataModel/Rim2dGridProjection.cpp | 31 ++++++++++++++++--- .../ProjectDataModel/Rim2dGridProjection.h | 3 +- .../RimRegularLegendConfig.cpp | 8 +++++ .../ProjectDataModel/RimRegularLegendConfig.h | 2 ++ 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/Rim2dEclipseView.cpp b/ApplicationCode/ProjectDataModel/Rim2dEclipseView.cpp index c24a1f8ac2..a3857efe3f 100644 --- a/ApplicationCode/ProjectDataModel/Rim2dEclipseView.cpp +++ b/ApplicationCode/ProjectDataModel/Rim2dEclipseView.cpp @@ -117,7 +117,7 @@ void Rim2dEclipseView::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrderi uiTreeOrdering.add(m_overlayInfoConfig()); uiTreeOrdering.add(m_2dGridProjection); uiTreeOrdering.add(cellResult()); - cellResult()->uiCapability()->setUiReadOnly(m_2dGridProjection->isColumnResult()); + cellResult()->uiCapability()->setUiReadOnly(m_2dGridProjection->isSummationResult()); uiTreeOrdering.add(wellCollection()); uiTreeOrdering.add(faultCollection()); uiTreeOrdering.add(m_rangeFilterCollection()); diff --git a/ApplicationCode/ProjectDataModel/Rim2dGridProjection.cpp b/ApplicationCode/ProjectDataModel/Rim2dGridProjection.cpp index 882704a5ba..e93b141bc1 100644 --- a/ApplicationCode/ProjectDataModel/Rim2dGridProjection.cpp +++ b/ApplicationCode/ProjectDataModel/Rim2dGridProjection.cpp @@ -319,11 +319,12 @@ const std::vector& Rim2dGridProjection::aggregatedResults() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool Rim2dGridProjection::isColumnResult() const +bool Rim2dGridProjection::isSummationResult() const { return m_resultAggregation() == RESULTS_OIL_COLUMN || m_resultAggregation() == RESULTS_GAS_COLUMN || - m_resultAggregation() == RESULTS_HC_COLUMN; + m_resultAggregation() == RESULTS_HC_COLUMN || + m_resultAggregation() == RESULTS_SUM; } //-------------------------------------------------------------------------------------------------- @@ -801,10 +802,18 @@ void Rim2dGridProjection::updateLegend() firstAncestorOrThisOfTypeAsserted(view); RimEclipseCellColors* cellColors = view->cellResult(); - double minVal = minValue(); - double maxVal = maxValue(); + if (isSummationResult() || (m_resultAggregation != RESULTS_TOP_VALUE && legendConfig()->rangeMode() != RimLegendConfig::AUTOMATIC_ALLTIMESTEPS)) + { + double minVal = minValue(); + double maxVal = maxValue(); + + legendConfig()->setAutomaticRanges(minVal, maxVal, minVal, maxVal); + } + else + { + cellColors->updateLegendData(view->currentTimeStep(), legendConfig()); + } - legendConfig()->setAutomaticRanges(minVal, maxVal, minVal, maxVal); if (m_resultAggregation() == RESULTS_OIL_COLUMN || m_resultAggregation() == RESULTS_GAS_COLUMN || m_resultAggregation() == RESULTS_HC_COLUMN) @@ -883,6 +892,10 @@ void Rim2dGridProjection::fieldChangedByUi(const caf::PdmFieldHandle* changedFie view->firstAncestorOrThisOfTypeAsserted(proj); proj->scheduleCreateDisplayModelAndRedrawAllViews(); } + if (changedField == &m_resultAggregation) + { + legendConfig()->disableAllTimeStepsRange(isSummationResult()); + } } //-------------------------------------------------------------------------------------------------- @@ -909,3 +922,11 @@ void Rim2dGridProjection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrd { uiTreeOrdering.skipRemainingChildren(true); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim2dGridProjection::initAfterRead() +{ + legendConfig()->disableAllTimeStepsRange(isSummationResult()); +} diff --git a/ApplicationCode/ProjectDataModel/Rim2dGridProjection.h b/ApplicationCode/ProjectDataModel/Rim2dGridProjection.h index af0d056829..7d3470bd16 100644 --- a/ApplicationCode/ProjectDataModel/Rim2dGridProjection.h +++ b/ApplicationCode/ProjectDataModel/Rim2dGridProjection.h @@ -71,7 +71,7 @@ public: double sampleSpacing() const; void updateDefaultSampleSpacingFromGrid(); const std::vector& aggregatedResults() const; - bool isColumnResult() const; + bool isSummationResult() const; double value(uint i, uint j) const; @@ -106,6 +106,7 @@ protected: void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override; + void initAfterRead() override; protected: caf::PdmField m_sampleSpacing; diff --git a/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.cpp index fb8f0e12b9..c4ddeac25b 100644 --- a/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.cpp @@ -752,6 +752,14 @@ const caf::TitledOverlayFrame* RimRegularLegendConfig::titledOverlayFrame() cons } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimLegendConfig::RangeModeType RimRegularLegendConfig::rangeMode() const +{ + return m_rangeMode(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.h b/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.h index 11453f9994..a1ba2857cd 100644 --- a/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.h @@ -126,6 +126,8 @@ public: const caf::TitledOverlayFrame* titledOverlayFrame() const override; caf::TitledOverlayFrame* titledOverlayFrame() override; + RangeModeType rangeMode() const; + private: void setNamedCategories(const std::vector& categoryNames, bool inverse); void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;