mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Ensure default analysis filter works and changes are propagated properly
This commit is contained in:
parent
c5255b4008
commit
3269537f25
@ -168,7 +168,7 @@ RimAnalysisPlot::RimAnalysisPlot()
|
||||
m_plotDataFilterCollection = new RimPlotDataFilterCollection;
|
||||
|
||||
connectAxisSignals( m_valueAxisProperties() );
|
||||
|
||||
m_plotDataFilterCollection->filtersChanged.connect( this, &RimAnalysisPlot::onFiltersChanged );
|
||||
setDeletable( true );
|
||||
}
|
||||
|
||||
@ -416,7 +416,7 @@ void RimAnalysisPlot::maxMinValueFromAddress( const RifEclipseSummaryAddress&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnalysisPlot::onFiltersChanged()
|
||||
void RimAnalysisPlot::onFiltersChanged( const caf::SignalEmitter* emitter )
|
||||
{
|
||||
this->loadDataAndUpdate();
|
||||
}
|
||||
@ -1082,7 +1082,7 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter,
|
||||
std::map<RimSummaryCase*, double> casesToKeepWithValue;
|
||||
std::map<RifEclipseSummaryAddress, double> sumItemsToKeepWithValue;
|
||||
|
||||
if ( filter->filterTarget() == RimPlotDataFilterItem::ENSEMBLE_CASE )
|
||||
if ( filter->filterTarget() == RimPlotDataFilterItem::ENSEMBLE_CASE && !filter->ensembleParameterName().isEmpty() )
|
||||
{
|
||||
sumItemsToKeep = ( *filteredSummaryItems ); // Not filtering items
|
||||
|
||||
|
@ -92,8 +92,6 @@ public:
|
||||
double* min,
|
||||
double* max );
|
||||
|
||||
void onFiltersChanged();
|
||||
|
||||
std::vector<time_t> selectedTimeSteps();
|
||||
|
||||
private:
|
||||
@ -114,6 +112,8 @@ private:
|
||||
std::set<RimSummaryCase*> timestepDefiningSourceCases();
|
||||
std::set<RimSummaryCase*> allSourceCases();
|
||||
|
||||
void onFiltersChanged( const caf::SignalEmitter* emitter );
|
||||
|
||||
// RimViewWindow overrides
|
||||
|
||||
QWidget* viewWidget() override;
|
||||
|
@ -51,11 +51,15 @@ RimAnalysisPlot* RimAnalysisPlotCollection::createAnalysisPlot()
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
applyFirstEnsembleFieldAddressesToPlot( plot, "FOPT" );
|
||||
auto filter = plot->plotDataFilterCollection()->addFilter();
|
||||
|
||||
// plot->enableAutoPlotTitle( true );
|
||||
m_analysisPlots.push_back( plot );
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
auto filter = plot->plotDataFilterCollection()->addFilter();
|
||||
filter->updateMaxMinAndDefaultValues( true );
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
@ -73,13 +77,15 @@ RimAnalysisPlot* RimAnalysisPlotCollection::createAnalysisPlot( RimSummaryCaseCo
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityName.toStdString(), timeStep );
|
||||
auto filter = plot->plotDataFilterCollection()->addFilter();
|
||||
|
||||
// plot->enableAutoPlotTitle( true );
|
||||
m_analysisPlots.push_back( plot );
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
|
||||
auto filter = plot->plotDataFilterCollection()->addFilter();
|
||||
filter->updateMaxMinAndDefaultValues( true );
|
||||
|
||||
plot->loadDataAndUpdate();
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
|
@ -25,6 +25,7 @@ CAF_PDM_SOURCE_INIT( RimPlotDataFilterCollection, "PlotDataFilterCollection" );
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPlotDataFilterCollection::RimPlotDataFilterCollection()
|
||||
: filtersChanged( this )
|
||||
{
|
||||
CAF_PDM_InitObject( "Plot Data Filters", ":/AnalysisPlotFilter16x16.png", "", "" );
|
||||
|
||||
@ -41,6 +42,12 @@ RimPlotDataFilterItem* RimPlotDataFilterCollection::addFilter()
|
||||
{
|
||||
auto newFilter = new RimPlotDataFilterItem();
|
||||
m_filters.push_back( newFilter );
|
||||
|
||||
newFilter->updateMaxMinAndDefaultValues( false );
|
||||
newFilter->filterChanged.connect( this, &RimPlotDataFilterCollection::onFilterChanged );
|
||||
|
||||
filtersChanged.send();
|
||||
|
||||
return newFilter;
|
||||
}
|
||||
|
||||
@ -49,8 +56,12 @@ RimPlotDataFilterItem* RimPlotDataFilterCollection::addFilter()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotDataFilterCollection::removeFilter( RimPlotDataFilterItem* filter )
|
||||
{
|
||||
filter->filterChanged.disconnect( this );
|
||||
|
||||
m_filters.removeChildObject( filter );
|
||||
delete filter;
|
||||
|
||||
filtersChanged.send();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -76,3 +87,8 @@ caf::PdmFieldHandle* RimPlotDataFilterCollection::objectToggleField()
|
||||
{
|
||||
return &m_isActive;
|
||||
}
|
||||
|
||||
void RimPlotDataFilterCollection::onFilterChanged( const caf::SignalEmitter* emitter )
|
||||
{
|
||||
filtersChanged.send();
|
||||
}
|
||||
|
@ -30,6 +30,9 @@ class RimPlotDataFilterCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
caf::Signal<> filtersChanged;
|
||||
|
||||
public:
|
||||
RimPlotDataFilterCollection();
|
||||
|
||||
@ -41,6 +44,8 @@ public:
|
||||
private:
|
||||
caf::PdmFieldHandle* objectToggleField() override;
|
||||
|
||||
void onFilterChanged( const caf::SignalEmitter* emitter );
|
||||
|
||||
private:
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmChildArrayField<RimPlotDataFilterItem*> m_filters;
|
||||
|
@ -79,6 +79,7 @@ CAF_PDM_SOURCE_INIT( RimPlotDataFilterItem, "PlotDataFilterItem" );
|
||||
RimPlotDataFilterItem::RimPlotDataFilterItem()
|
||||
: m_lowerLimit( -std::numeric_limits<double>::infinity() )
|
||||
, m_upperLimit( std::numeric_limits<double>::infinity() )
|
||||
, filterChanged( this )
|
||||
{
|
||||
CAF_PDM_InitObject( "Plot Data Filter", ":/AnalysisPlotFilter16x16.png", "", "" );
|
||||
|
||||
@ -223,48 +224,32 @@ void RimPlotDataFilterItem::fieldChangedByUi( const caf::PdmFieldHandle* changed
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimAnalysisPlot* parentPlot;
|
||||
this->firstAncestorOrThisOfTypeAsserted( parentPlot );
|
||||
|
||||
if ( changedField == &m_filterTarget )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( true );
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
else if ( changedField == &m_filterQuantityUiField )
|
||||
{
|
||||
m_filterAddress->setAddress( m_filterQuantityUiField );
|
||||
this->updateMaxMinAndDefaultValues( true );
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
else if ( changedField == &m_filterEnsembleParameter )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( true );
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
else if ( changedField == &m_useAbsoluteValue )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( false );
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
else if ( changedField == &m_filterOperation )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( false );
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
else if ( changedField == &m_consideredTimestepsType || changedField == &m_explicitlySelectedTimeSteps )
|
||||
{
|
||||
this->updateMaxMinAndDefaultValues( false );
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
else if ( changedField == &m_isActive )
|
||||
{
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
else if ( changedField == &m_min || changedField == &m_max )
|
||||
{
|
||||
parentPlot->onFiltersChanged();
|
||||
}
|
||||
filterChanged.send();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -55,6 +55,9 @@ class RimPlotDataFilterItem : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
caf::Signal<> filterChanged;
|
||||
|
||||
public:
|
||||
RimPlotDataFilterItem();
|
||||
~RimPlotDataFilterItem() override;
|
||||
|
Loading…
Reference in New Issue
Block a user