mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
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:
parent
7acbc86a39
commit
2bcdc62931
@ -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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -46,8 +46,6 @@ protected:
|
||||
QString timeStepName( int frameIdx ) const override;
|
||||
QStringList timeStepStrings() const override;
|
||||
|
||||
void onUpdateLegends() override;
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimStatisticsContourMap*> m_statisticsContourMap;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user