Fix for range filter exclude behaviour

Use active cells as range include filter when there are range exclude filters present and no include filters
p4#: 22095
This commit is contained in:
Magne Sjaastad 2013-08-05 12:48:11 +02:00
parent ffbb0b6a46
commit f2be4dedaf
2 changed files with 23 additions and 7 deletions

View File

@ -551,10 +551,11 @@ void RivReservoirViewPartMgr::computeRangeVisibility(ReservoirGeometryCacheType
CVF_ASSERT(grid != NULL);
CVF_ASSERT(nativeVisibility->size() == grid->cellCount());
// Initialize range filter with native visibility
if (cellVisibility != nativeVisibility) (*cellVisibility) = (*nativeVisibility);
if (rangeFilterColl->hasActiveFilters())
{
if (cellVisibility != nativeVisibility) (*cellVisibility) = (*nativeVisibility);
// Build range filter for current grid
cvf::CellRangeFilter gridCellRangeFilter;
rangeFilterColl->compoundCellRangeFilter(&gridCellRangeFilter, grid);
@ -604,11 +605,6 @@ void RivReservoirViewPartMgr::computeRangeVisibility(ReservoirGeometryCacheType
}
}
}
else
{
cellVisibility->resize(grid->cellCount());
cellVisibility->setAll(false);
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -75,6 +75,8 @@ 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++)
{
@ -92,6 +94,8 @@ void RimCellRangeFilterCollection::compoundCellRangeFilter(cvf::CellRangeFilter*
rangeFilter->startIndexJ - 1 + rangeFilter->cellCountJ,
rangeFilter->startIndexK - 1 + rangeFilter->cellCountK,
rangeFilter->propagateToSubGrids());
onlyExcludeFiltersActive = false;
}
else
{
@ -106,6 +110,22 @@ 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);
}
}