mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8817 Summary Multiplot: Add filter to control plot visibility
This commit is contained in:
@@ -146,6 +146,12 @@ RimSummaryMultiPlot::RimSummaryMultiPlot()
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Aggregation" );
|
||||
|
||||
CAF_PDM_InitField( &m_hidePlotsWithValuesBelow, "HidePlotsWithValuesBelow", false, "Hide Plots With Values Below" );
|
||||
m_hidePlotsWithValuesBelow.xmlCapability()->disableIO();
|
||||
m_hidePlotsWithValuesBelow.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &m_plotFilterYAxisThreshold, "PlotFilterYAxisThreshold", 0.0, "Y-Axis Threshold" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" );
|
||||
|
||||
m_sourceStepping = new RimSummaryPlotSourceStepping;
|
||||
@@ -358,7 +364,12 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde
|
||||
m_linkSubPlotAxes.uiCapability()->setUiReadOnly( m_autoAdjustAppearance() );
|
||||
if ( m_autoAdjustAppearance() ) m_linkSubPlotAxes = false;
|
||||
|
||||
auto plotVisibilityFilterGroup = uiOrdering.addNewGroup( "Plot Visibility Filter" );
|
||||
plotVisibilityFilterGroup->add( &m_hidePlotsWithValuesBelow );
|
||||
plotVisibilityFilterGroup->add( &m_plotFilterYAxisThreshold );
|
||||
|
||||
auto dataSourceGroup = uiOrdering.addNewGroup( "Data Source" );
|
||||
dataSourceGroup->setCollapsedByDefault( true );
|
||||
m_sourceStepping()->uiOrdering( uiConfigName, *dataSourceGroup );
|
||||
|
||||
auto titlesGroup = uiOrdering.addNewGroup( "Main Plot Settings" );
|
||||
@@ -399,6 +410,11 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
{
|
||||
syncAxisRanges();
|
||||
}
|
||||
else if ( changedField == &m_hidePlotsWithValuesBelow )
|
||||
{
|
||||
m_hidePlotsWithValuesBelow = false;
|
||||
updatePlotVisibility();
|
||||
}
|
||||
else if ( changedField == &m_createPlotDuplicate )
|
||||
{
|
||||
m_createPlotDuplicate = false;
|
||||
@@ -438,6 +454,23 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
if ( &m_hidePlotsWithValuesBelow == field )
|
||||
{
|
||||
auto attrib = dynamic_cast<caf::PdmUiPushButtonEditorAttribute*>( attribute );
|
||||
if ( attrib )
|
||||
{
|
||||
attrib->m_buttonText = "Apply Filter";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -944,6 +977,32 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryMultiPlot::updatePlotVisibility()
|
||||
{
|
||||
auto hasValuesAboveLimit = []( RimSummaryPlot* plot, double limit ) {
|
||||
for ( auto curve : plot->summaryAndEnsembleCurves() )
|
||||
{
|
||||
auto address = curve->valuesY();
|
||||
auto maxValue = std::max_element( address.begin(), address.end() );
|
||||
|
||||
if ( *maxValue > limit ) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
for ( auto plot : summaryPlots() )
|
||||
{
|
||||
bool hasValueAboveLimit = hasValuesAboveLimit( plot, m_plotFilterYAxisThreshold );
|
||||
plot->setShowWindow( hasValueAboveLimit );
|
||||
}
|
||||
|
||||
if ( !m_viewer.isNull() ) m_viewer->scheduleUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -117,12 +117,18 @@ protected:
|
||||
|
||||
private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
QString uiConfigName,
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
void populateNameHelper( RimSummaryPlotNameHelper* nameHelper );
|
||||
|
||||
void computeAggregatedAxisRange();
|
||||
void updateSourceStepper();
|
||||
|
||||
void updatePlotVisibility();
|
||||
|
||||
void duplicate();
|
||||
|
||||
void appendSubPlotByStepping( int direction );
|
||||
@@ -141,6 +147,9 @@ private:
|
||||
caf::PdmField<bool> m_linkSubPlotAxes;
|
||||
caf::PdmField<bool> m_autoAdjustAppearance;
|
||||
|
||||
caf::PdmField<bool> m_hidePlotsWithValuesBelow;
|
||||
caf::PdmField<double> m_plotFilterYAxisThreshold;
|
||||
|
||||
caf::PdmField<bool> m_appendNextPlot;
|
||||
caf::PdmField<bool> m_appendPrevPlot;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user