mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-24 07:16:53 -06:00
Renamed cell filter field from active to isActive
Removed the special handling of range filters when only exclude filters are active p4#: 22123
This commit is contained in:
parent
fea95940bf
commit
008842a1ee
@ -396,14 +396,14 @@ void RivReservoirViewPartMgr::createPropertyFilteredGeometry(size_t frameIndex)
|
||||
std::vector<RigGridBase*> grids;
|
||||
res->allGrids(&grids);
|
||||
|
||||
bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells();
|
||||
bool hasActiveRangeFilters = m_reservoirView->rangeFilterCollection()->hasActiveIncludeFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells();
|
||||
|
||||
for (size_t gIdx = 0; gIdx < grids.size(); ++gIdx)
|
||||
{
|
||||
cvf::ref<cvf::UByteArray> cellVisibility = m_propFilteredGeometryFrames[frameIndex]->cellVisibility(gIdx);
|
||||
cvf::ref<cvf::UByteArray> rangeVisibility;
|
||||
cvf::ref<cvf::UByteArray> fenceVisibility;
|
||||
cvf::cref<cvf::UByteArray> cellIsWellCellStatuses = res->wellCellsInGrid(gIdx);
|
||||
cvf::cref<cvf::UByteArray> isWellCell = res->wellCellsInGrid(gIdx);
|
||||
|
||||
if (m_geometriesNeedsRegen[RANGE_FILTERED]) createGeometry(RANGE_FILTERED);
|
||||
if (m_geometriesNeedsRegen[VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER]) createGeometry(VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER);
|
||||
@ -416,7 +416,7 @@ void RivReservoirViewPartMgr::createPropertyFilteredGeometry(size_t frameIndex)
|
||||
#pragma omp parallel for
|
||||
for (int cellIdx = 0; cellIdx < static_cast<int>(cellVisibility->size()); ++cellIdx)
|
||||
{
|
||||
(*cellVisibility)[cellIdx] = (!hasActiveRangeFilters && !(*cellIsWellCellStatuses)[cellIdx]) || (*rangeVisibility)[cellIdx] || (*fenceVisibility)[cellIdx];
|
||||
(*cellVisibility)[cellIdx] = (*rangeVisibility)[cellIdx] || (*fenceVisibility)[cellIdx];
|
||||
}
|
||||
computePropertyVisibility(cellVisibility.p(), grids[gIdx], frameIndex, cellVisibility.p(), m_reservoirView->propertyFilterCollection());
|
||||
|
||||
@ -580,6 +580,8 @@ void RivReservoirViewPartMgr::computeRangeVisibility(ReservoirGeometryCacheType
|
||||
parentGridVisibilities = reservoirGridPartMgr->cellVisibility(parentGridIndex);
|
||||
}
|
||||
|
||||
bool hasAdditiveRangeFilters = rangeFilterColl->hasActiveIncludeFilters() || m_reservoirView->wellCollection()->hasVisibleWellCells();
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int cellIndex = 0; cellIndex < static_cast<int>(grid->cellCount()); cellIndex++)
|
||||
{
|
||||
@ -600,7 +602,20 @@ void RivReservoirViewPartMgr::computeRangeVisibility(ReservoirGeometryCacheType
|
||||
|
||||
bool isInSubGridArea = cell.subGrid() != NULL;
|
||||
grid->ijkFromCellIndex(cellIndex, &mainGridI, &mainGridJ, &mainGridK);
|
||||
(*cellVisibility)[cellIndex] = (visibleDueToParentGrid || gridCellRangeFilter.isCellVisible(mainGridI, mainGridJ, mainGridK, isInSubGridArea))
|
||||
|
||||
bool nativeRangeVisibility = false;
|
||||
|
||||
if (hasAdditiveRangeFilters)
|
||||
{
|
||||
nativeRangeVisibility = gridCellRangeFilter.isCellVisible(mainGridI, mainGridJ, mainGridK, isInSubGridArea);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Special handling when no include filters are present. Use native visibility
|
||||
nativeRangeVisibility = (*nativeVisibility)[cellIndex];
|
||||
}
|
||||
|
||||
(*cellVisibility)[cellIndex] = (visibleDueToParentGrid || nativeRangeVisibility)
|
||||
&& !gridCellRangeFilter.isCellExcluded(mainGridI, mainGridJ, mainGridK, isInSubGridArea);
|
||||
}
|
||||
}
|
||||
@ -628,7 +643,7 @@ void RivReservoirViewPartMgr::computePropertyVisibility(cvf::UByteArray* cellVis
|
||||
std::list< caf::PdmPointer< RimCellPropertyFilter > >::const_iterator pfIt;
|
||||
for (pfIt = propFilterColl->propertyFilters().begin(); pfIt != propFilterColl->propertyFilters().end(); ++pfIt)
|
||||
{
|
||||
if ((*pfIt)->active()&& (*pfIt)->resultDefinition->hasResult())
|
||||
if ((*pfIt)->isActive()&& (*pfIt)->resultDefinition->hasResult())
|
||||
{
|
||||
const double lowerBound = (*pfIt)->lowerBound();
|
||||
const double upperBound = (*pfIt)->upperBound();
|
||||
|
@ -45,8 +45,8 @@ RimCellFilter::RimCellFilter()
|
||||
CAF_PDM_InitObject("Cell Filter", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&name, "UserDescription", QString("Filter Name"), "Name", "", "", "");
|
||||
CAF_PDM_InitField(&active, "Active", true, "Active", "", "", "");
|
||||
active.setUiHidden(true);
|
||||
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
||||
isActive.setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&filterMode, "FilterType", "Filter Type", "", "", "");
|
||||
}
|
||||
@ -96,7 +96,7 @@ void RimCellFilter::updateIconState()
|
||||
painter.drawPixmap(0,0, sign);
|
||||
}
|
||||
|
||||
if (!active)
|
||||
if (!isActive)
|
||||
{
|
||||
QIcon temp(icPixmap);
|
||||
icPixmap = temp.pixmap(16, 16, QIcon::Disabled);
|
||||
@ -111,5 +111,5 @@ void RimCellFilter::updateIconState()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCellFilter::objectToggleField()
|
||||
{
|
||||
return &active;
|
||||
return &isActive;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
virtual ~RimCellFilter();
|
||||
|
||||
caf::PdmField<QString> name;
|
||||
caf::PdmField<bool> active;
|
||||
caf::PdmField<bool> isActive;
|
||||
caf::PdmField< caf::AppEnum< FilterModeType > > filterMode;
|
||||
|
||||
void updateIconState();
|
||||
|
@ -109,7 +109,7 @@ void RimCellPropertyFilter::fieldChangedByUi(const caf::PdmFieldHandle* changedF
|
||||
if ( &lowerBound == changedField
|
||||
|| &upperBound == changedField
|
||||
|| &evaluationRegion == changedField
|
||||
|| &active == changedField
|
||||
|| &isActive == changedField
|
||||
|| &filterMode == changedField)
|
||||
{
|
||||
m_parentContainer->fieldChangedByUi(changedField, oldValue, newValue);
|
||||
@ -169,7 +169,7 @@ void RimCellPropertyFilter::defineUiOrdering(QString uiConfigName, caf::PdmUiOrd
|
||||
group1->add(&(resultDefinition->m_resultVariableUiField));
|
||||
|
||||
// Fields declared in RimCellFilter
|
||||
uiOrdering.add(&active);
|
||||
uiOrdering.add(&isActive);
|
||||
uiOrdering.add(&filterMode);
|
||||
|
||||
// Fields declared in this class (RimCellPropertyFilter)
|
||||
|
@ -158,7 +158,7 @@ bool RimCellPropertyFilterCollection::hasActiveFilters() const
|
||||
std::list< caf::PdmPointer< RimCellPropertyFilter > >::const_iterator it;
|
||||
for (it = propertyFilters.v().begin(); it != propertyFilters.v().end(); ++it)
|
||||
{
|
||||
if ((*it)->active() && (*it)->resultDefinition->hasResult()) return true;
|
||||
if ((*it)->isActive() && (*it)->resultDefinition->hasResult()) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -174,7 +174,7 @@ bool RimCellPropertyFilterCollection::hasActiveDynamicFilters() const
|
||||
std::list< caf::PdmPointer< RimCellPropertyFilter > >::const_iterator it;
|
||||
for (it = propertyFilters.v().begin(); it != propertyFilters.v().end(); ++it)
|
||||
{
|
||||
if ((*it)->active() && (*it)->resultDefinition->hasDynamicResult()) return true;
|
||||
if ((*it)->isActive() && (*it)->resultDefinition->hasDynamicResult()) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -75,14 +75,12 @@ void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter*
|
||||
{
|
||||
CVF_ASSERT(cellRangeFilter);
|
||||
|
||||
bool onlyExcludeFiltersActive = true;
|
||||
|
||||
std::list< caf::PdmPointer<RimCellRangeFilter> >::const_iterator it;
|
||||
for (it = rangeFilters.v().begin(); it != rangeFilters.v().end(); it++)
|
||||
{
|
||||
RimCellRangeFilter* rangeFilter = *it;
|
||||
|
||||
if (rangeFilter && rangeFilter->active() && static_cast<size_t>(rangeFilter->gridIndex()) == grid->gridIndex())
|
||||
if (rangeFilter && rangeFilter->isActive() && static_cast<size_t>(rangeFilter->gridIndex()) == grid->gridIndex())
|
||||
{
|
||||
if (rangeFilter->filterMode == RimCellFilter::INCLUDE)
|
||||
{
|
||||
@ -94,8 +92,6 @@ void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter*
|
||||
rangeFilter->startIndexJ - 1 + rangeFilter->cellCountJ,
|
||||
rangeFilter->startIndexK - 1 + rangeFilter->cellCountK,
|
||||
rangeFilter->propagateToSubGrids());
|
||||
|
||||
onlyExcludeFiltersActive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -110,22 +106,6 @@ void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter*
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If there are only exclude filters present, add active cell bounding box as an include filter
|
||||
if (onlyExcludeFiltersActive && activeCellInfo())
|
||||
{
|
||||
cvf::Vec3st min, max;
|
||||
activeCellInfo()->IJKBoundingBox(min, max);
|
||||
|
||||
cellRangeFilter->addCellIncludeRange(
|
||||
min.x(),
|
||||
min.y(),
|
||||
min.z(),
|
||||
max.x(),
|
||||
max.y(),
|
||||
max.z(),
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -234,7 +214,7 @@ bool RimCellRangeFilterCollection::hasActiveFilters() const
|
||||
std::list< caf::PdmPointer< RimCellRangeFilter > >::const_iterator it;
|
||||
for (it = rangeFilters.v().begin(); it != rangeFilters.v().end(); ++it)
|
||||
{
|
||||
if ((*it)->active()) return true;
|
||||
if ((*it)->isActive()) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -248,3 +228,20 @@ caf::PdmFieldHandle* RimCellRangeFilterCollection::objectToggleField()
|
||||
return &active;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCellRangeFilterCollection::hasActiveIncludeFilters() const
|
||||
{
|
||||
if (!active) return false;
|
||||
|
||||
std::list< caf::PdmPointer< RimCellRangeFilter > >::const_iterator it;
|
||||
for (it = rangeFilters.v().begin(); it != rangeFilters.v().end(); ++it)
|
||||
{
|
||||
if ((*it)->isActive() && (*it)->filterMode() == RimCellFilter::INCLUDE) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
|
||||
void compoundCellRangeFilter(cvf::CellRangeFilter* cellRangeFilter, const RigGridBase* grid) const;
|
||||
bool hasActiveFilters() const;
|
||||
bool hasActiveIncludeFilters() const;
|
||||
|
||||
void setReservoirView(RimReservoirView* reservoirView);
|
||||
RimReservoirView* reservoirView();
|
||||
|
@ -142,7 +142,7 @@ bool RimUiTreeModelPdm::deletePropertyFilter(const QModelIndex& itemIndex)
|
||||
RimCellPropertyFilterCollection* propertyFilterCollection = propertyFilter->parentContainer();
|
||||
CVF_ASSERT(propertyFilterCollection);
|
||||
|
||||
bool wasFilterActive = propertyFilter->active();
|
||||
bool wasFilterActive = propertyFilter->isActive();
|
||||
bool wasSomeFilterActive = propertyFilterCollection->hasActiveFilters();
|
||||
|
||||
// Remove Ui items pointing at the pdm object to delete
|
||||
@ -182,7 +182,7 @@ bool RimUiTreeModelPdm::deleteRangeFilter(const QModelIndex& itemIndex)
|
||||
RimCellRangeFilterCollection* rangeFilterCollection = rangeFilter->parentContainer();
|
||||
CVF_ASSERT(rangeFilterCollection);
|
||||
|
||||
bool wasFilterActive = rangeFilter->active();
|
||||
bool wasFilterActive = rangeFilter->isActive();
|
||||
bool wasSomeFilterActive = rangeFilterCollection->hasActiveFilters();
|
||||
|
||||
// Remove Ui items pointing at the pdm object to delete
|
||||
|
Loading…
Reference in New Issue
Block a user