From a3f9dd863e720ce194e341230efddf315a0494d0 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Thu, 19 Dec 2024 18:46:28 +0100 Subject: [PATCH] work in progress --- .../RimStatisticsContourMapProjection.cpp | 37 +++++++++++++++++-- .../RimStatisticsContourMapProjection.h | 1 + 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMapProjection.cpp index 0dd8f26151..9b53cbf9ff 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMapProjection.cpp @@ -147,6 +147,13 @@ double RimStatisticsContourMapProjection::sampleSpacing() const //-------------------------------------------------------------------------------------------------- void RimStatisticsContourMapProjection::clearGridMappingAndRedraw() { + clearGridMapping(); + updateConnectedEditors(); + generateResultsIfNecessary( view()->currentTimeStep() ); + updateLegend(); + + RimEclipseView* parentView = firstAncestorOrThisOfTypeAsserted(); + parentView->scheduleCreateDisplayModelAndRedraw(); } //-------------------------------------------------------------------------------------------------- @@ -260,10 +267,15 @@ std::pair RimStatisticsContourMapProjection::minmaxValuesAllTime { clearTimeStepRange(); - // TODO - step through all time steps here! - std::vector aggregatedResults = statisticsContourMap()->result( 0, m_statisticsType() ); - m_minResultAllTimeSteps = RigContourMapProjection::minValue( aggregatedResults ); - m_maxResultAllTimeSteps = RigContourMapProjection::maxValue( aggregatedResults ); + if ( auto map = statisticsContourMap() ) + { + for ( auto ts : map->selectedTimeSteps() ) + { + std::vector aggregatedResults = statisticsContourMap()->result( ts, m_statisticsType() ); + m_minResultAllTimeSteps = std::min( m_minResultAllTimeSteps, RigContourMapProjection::minValue( aggregatedResults ) ); + m_maxResultAllTimeSteps = std::max( m_maxResultAllTimeSteps, RigContourMapProjection::maxValue( aggregatedResults ) ); + } + } } return std::make_pair( m_minResultAllTimeSteps, m_maxResultAllTimeSteps ); @@ -303,3 +315,20 @@ QString RimStatisticsContourMapProjection::resultAggregationText() const else return ""; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimStatisticsContourMapProjection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) +{ + if ( changedField == &m_statisticsType ) + { + clearGridMappingAndRedraw(); + } + else + { + RimContourMapProjection::fieldChangedByUi( changedField, oldValue, newValue ); + } +} diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMapProjection.h index 110fd49bc7..200fc705df 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsContourMapProjection.h @@ -77,6 +77,7 @@ class RimStatisticsContourMapProjection : public RimContourMapProjection protected: // Framework overrides void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; protected: caf::PdmField> m_statisticsType;