#14345 Add Data Filters to grid ensembles

Add a data filter collection to RimReservoirGridEnsemble, so filters can be defined once for the ensemble. The filters are bound to the main case of the ensemble for configuration.

Expose filter creation commands from a Data Filters submenu on the ensemble node, and hide the collection node while empty, matching the case-level behavior. Grid calculation integration is intentionally left for the dependent calculation-filtering change.
This commit is contained in:
Kristian Bendiksen committed 2026-09-09 10:14:41 +02:00
1 parent 2f2f0fd4e8
commit ab43e67f0f
4 files changed
+59 -6

No files matched your search

@@ -28,6 +28,7 @@
#include "RimEclipseCase.h"
#include "RimFilterInViewCollection.h"
#include "RimGridView.h"
#include "RimReservoirGridEnsemble.h"
#include "Riu3DMainWindowTools.h"
@@ -84,10 +85,10 @@ inline RimCellFilterCollection* resolveTargetCellFilterCollection()
}
//--------------------------------------------------------------------------------------------------
/// Resolve the case-level RimDataFilterCollection to target from the current selection: either the
/// data-filter collection node itself, or a selected RimEclipseCase (whose "Data Filters" node is
/// hidden while empty, so the case node is right-clicked to create the first filter). Returns
/// nullptr if neither is selected.
/// Resolve the RimDataFilterCollection to target from the current selection: either the data-filter
/// collection node itself, or a selected RimEclipseCase or RimReservoirGridEnsemble (whose "Data
/// Filters" node is hidden while empty, so the owner node is right-clicked to create the first
/// filter). Returns nullptr if none is selected.
//--------------------------------------------------------------------------------------------------
inline RimDataFilterCollection* selectedDataFilterCollection()
{
@@ -97,6 +98,9 @@ inline RimDataFilterCollection* selectedDataFilterCollection()
auto cases = caf::selectedObjectsByTypeStrict<RimEclipseCase*>();
if ( !cases.empty() && cases.front() ) return cases.front()->dataFilterCollection();
auto ensembles = caf::selectedObjectsByTypeStrict<RimReservoirGridEnsemble*>();
if ( !ensembles.empty() && ensembles.front() ) return ensembles.front()->dataFilterCollection();
return nullptr;
}
@@ -104,8 +104,9 @@ void RicNewPolygonFilterFeature::onActionTriggered( bool isChecked )
return;
}
// If a case-level Data Filter Collection is selected, add polygon filters there.
auto* dataCollection = caf::SelectionManager::instance()->selectedItemOfType<RimDataFilterCollection>();
// If a case or ensemble level Data Filter Collection is selected (or its owner node), add
// polygon filters there.
auto* dataCollection = RicCellFilterFeatureTools::selectedDataFilterCollection();
if ( dataCollection )
{
if ( polygons.empty() ) polygons.push_back( nullptr );