Enable value filter in statistics contourmap (#12078)

* Enable value filtering in stat contourmap and fix map redraw logic
* Make switching case in contourmap  work
This commit is contained in:
jonjenssen 2025-01-21 11:40:37 +01:00 committed by GitHub
parent 7acbc86a39
commit 2bcdc62931
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 31 additions and 58 deletions

View File

@ -382,8 +382,8 @@ bool RimContourMapProjection::gridMappingNeedsUpdating() const
if ( cellGridIdxVisibility.isNull() ) return true;
cvf::ref<cvf::UByteArray> currentVisibility = getCellVisibility();
if ( currentVisibility->size() != cellGridIdxVisibility->size() ) return true;
CVF_ASSERT( currentVisibility->size() == cellGridIdxVisibility->size() );
for ( size_t i = 0; i < currentVisibility->size(); ++i )
{
if ( ( *currentVisibility )[i] != ( *cellGridIdxVisibility )[i] ) return true;
@ -540,9 +540,7 @@ void RimContourMapProjection::fieldChangedByUi( const caf::PdmFieldHandle* chang
}
baseView()->updateConnectedEditors();
RimProject* proj = RimProject::current();
proj->scheduleCreateDisplayModelAndRedrawAllViews();
baseView()->scheduleCreateDisplayModelAndRedraw();
}
//--------------------------------------------------------------------------------------------------

View File

@ -125,9 +125,10 @@ protected:
void appendValueFilterGroup( caf::PdmUiOrdering& uiOrdering );
virtual bool gridMappingNeedsUpdating() const;
private:
bool resultsNeedsUpdating( int timeStep ) const;
bool gridMappingNeedsUpdating() const;
bool geometryNeedsUpdating() const;
void clearResults();
void clearMinMaxValueRange();

View File

@ -154,9 +154,9 @@ double RimStatisticsContourMapProjection::sampleSpacing() const
void RimStatisticsContourMapProjection::clearGridMappingAndRedraw()
{
clearGridMapping();
updateConnectedEditors();
generateResultsIfNecessary( view()->currentTimeStep() );
updateLegend();
updateConnectedEditors();
RimEclipseView* parentView = firstAncestorOrThisOfTypeAsserted<RimEclipseView>();
parentView->scheduleCreateDisplayModelAndRedraw();
@ -292,6 +292,8 @@ void RimStatisticsContourMapProjection::defineUiOrdering( QString uiConfigName,
{
uiOrdering.add( &m_statisticsType );
appendValueFilterGroup( uiOrdering );
caf::PdmUiGroup* mainGroup = uiOrdering.addNewGroup( "Projection Settings" );
mainGroup->add( &m_showContourLines );
mainGroup->add( &m_showContourLabels );
@ -326,8 +328,7 @@ void RimStatisticsContourMapProjection::fieldChangedByUi( const caf::PdmFieldHan
const QVariant& oldValue,
const QVariant& newValue )
{
if ( ( changedField == &m_statisticsType ) || ( changedField == &m_showContourLines ) || ( changedField == &m_showContourLabels ) ||
( changedField == &m_smoothContourLines ) )
if ( changedField == &m_statisticsType )
{
clearGridMappingAndRedraw();
}
@ -336,3 +337,24 @@ void RimStatisticsContourMapProjection::fieldChangedByUi( const caf::PdmFieldHan
RimContourMapProjection::fieldChangedByUi( changedField, oldValue, newValue );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimStatisticsContourMapProjection::gridMappingNeedsUpdating() const
{
if ( !m_contourMapProjection ) return true;
auto cellGridIdxVisibility = m_contourMapProjection->getCellVisibility();
if ( cellGridIdxVisibility.isNull() ) return true;
cvf::ref<cvf::UByteArray> currentVisibility = getCellVisibility();
if ( currentVisibility->size() != cellGridIdxVisibility->size() ) return true;
for ( size_t i = 0; i < currentVisibility->size(); ++i )
{
if ( ( *currentVisibility )[i] != ( *cellGridIdxVisibility )[i] ) return true;
}
return false;
}

View File

@ -75,6 +75,8 @@ protected:
void updateAfterResultGeneration( int timeStep ) override;
bool gridMappingNeedsUpdating() const override;
protected:
// Framework overrides
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;

View File

@ -163,54 +163,6 @@ void RimStatisticsContourMapView::defineUiTreeOrdering( caf::PdmUiTreeOrdering&
uiTreeOrdering.skipRemainingChildren();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimStatisticsContourMapView::onUpdateLegends()
{
if ( auto viewer = nativeOrOverrideViewer() )
{
if ( !isUsingOverrideViewer() )
{
viewer->removeAllColorLegends();
}
else if ( cellResult() && cellResult()->legendConfig() )
{
viewer->removeColorLegend( cellResult()->legendConfig()->titledOverlayFrame() );
}
if ( m_contourMapProjection && m_contourMapProjection->isChecked() )
{
RimRegularLegendConfig* projectionLegend = m_contourMapProjection->legendConfig();
if ( projectionLegend )
{
m_contourMapProjection->updateLegend();
if ( projectionLegend->showLegend() )
{
viewer->addColorLegendToBottomLeftCorner( projectionLegend->titledOverlayFrame(), isUsingOverrideViewer() );
}
}
}
// Hide the scale widget if any 3D views are present, as the display of the scale widget is only working for
// default rotation. The update is triggered in RimViewLinker::updateScaleWidgetVisibility()
bool any3DViewsLinked = false;
if ( auto viewLinker = assosiatedViewLinker() )
{
auto views = viewLinker->allViews();
for ( auto v : views )
{
if ( dynamic_cast<RimStatisticsContourMapView*>( v ) ) continue;
any3DViewsLinked = true;
}
}
viewer->showScaleLegend( any3DViewsLinked ? false : m_showScaleLegend() );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -46,8 +46,6 @@ protected:
QString timeStepName( int frameIdx ) const override;
QStringList timeStepStrings() const override;
void onUpdateLegends() override;
private:
caf::PdmPtrField<RimStatisticsContourMap*> m_statisticsContourMap;
};