Refresh cell filters when geomech grid is reloaded (#10924)

* Make sure the cell filters are refreshed when the geomech grid is reloaded to handle grid changes
This commit is contained in:
jonjenssen 2023-12-08 15:26:18 +01:00 committed by GitHub
parent 0a2f2da8b9
commit ea56ceaea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 38 additions and 0 deletions

View File

@ -91,6 +91,7 @@ public:
virtual void updateCompundFilter( cvf::CellRangeFilter* cellRangeFilter, int gridIndex ){};
virtual void updateCellIndexFilter( cvf::UByteArray* includeVisibility, cvf::UByteArray* excludeVisibility, int gridIndex ){};
virtual QString fullName() const;
virtual void onGridChanged(){};
protected:
caf::PdmFieldHandle* userDescriptionField() override;

View File

@ -384,6 +384,17 @@ void RimCellFilterCollection::removeFilter( RimCellFilter* filter )
m_cellFilters.removeChild( filter );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCellFilterCollection::notifyGridReload()
{
for ( RimCellFilter* filter : m_cellFilters )
{
filter->onGridChanged();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -59,6 +59,7 @@ public:
RimUserDefinedIndexFilter* addNewUserDefinedIndexFilter( RimCase* srcCase, const std::vector<size_t>& defCellIndexes = {} );
void removeFilter( RimCellFilter* filter );
void notifyGridReload();
bool isEmpty() const;
bool isActive() const;

View File

@ -176,3 +176,11 @@ void RimCellIndexFilter::updateCells()
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCellIndexFilter::onGridChanged()
{
m_cells.clear();
}

View File

@ -36,6 +36,8 @@ public:
void updateCellIndexFilter( cvf::UByteArray* includeVisibility, cvf::UByteArray* excludeVisibility, int gridIndex ) override;
void onGridChanged() override;
protected:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;

View File

@ -452,6 +452,14 @@ caf::PickEventHandler* RimPolygonFilter::pickEventHandler() const
return m_pickTargetsEventHandler.get();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPolygonFilter::onGridChanged()
{
m_cells.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -89,6 +89,7 @@ public:
caf::PickEventHandler* pickEventHandler() const override;
void updateCellIndexFilter( cvf::UByteArray* includeVisibility, cvf::UByteArray* excludeVisibility, int gridIndex ) override;
void onGridChanged() override;
cvf::ref<RigPolyLinesData> polyLinesData() const override;

View File

@ -101,10 +101,13 @@ void RimUserDefinedIndexFilter::updateCellIndexFilter( cvf::UByteArray* includeV
{
if ( gridIndex != m_gridIndex() ) return;
const auto filterSize = (int)includeVisibility->size();
if ( m_filterMode == FilterModeType::INCLUDE )
{
for ( auto cellIdx : m_individualCellIndexes() )
{
if ( cellIdx >= filterSize ) continue;
( *includeVisibility )[cellIdx] = true;
}
}
@ -112,6 +115,7 @@ void RimUserDefinedIndexFilter::updateCellIndexFilter( cvf::UByteArray* includeV
{
for ( auto cellIdx : m_individualCellIndexes() )
{
if ( cellIdx >= filterSize ) continue;
( *excludeVisibility )[cellIdx] = false;
}
}

View File

@ -35,6 +35,7 @@
#include "RigGeoMechCaseData.h"
#include "Rim2dIntersectionViewCollection.h"
#include "RimCellFilterCollection.h"
#include "RimFormationNames.h"
#include "RimGeoMechCellColors.h"
#include "RimGeoMechContourMapView.h"
@ -216,6 +217,7 @@ void RimGeoMechCase::reloadDataAndUpdate()
{
v->resetVizLogic();
v->loadDataAndUpdate();
v->cellFilterCollection()->notifyGridReload();
v->setCurrentTimeStep( v->currentTimeStep() );
}