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:
Magne Sjaastad
2013-08-08 08:49:29 +02:00
parent fea95940bf
commit 008842a1ee
8 changed files with 51 additions and 38 deletions

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -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)

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -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