mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1231 Moved category handling to new class RimPropertyFilter
This commit is contained in:
@@ -18,8 +18,6 @@
|
||||
|
||||
#include "RimCellFilter.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
namespace caf
|
||||
@@ -47,8 +45,6 @@ RimCellFilter::RimCellFilter()
|
||||
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
||||
isActive.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_selectedCategoryValues, "SelectedValues", "Values", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&filterMode, "FilterType", "Filter Type", "", "", "");
|
||||
}
|
||||
|
||||
@@ -67,14 +63,6 @@ caf::PdmFieldHandle* RimCellFilter::userDescriptionField()
|
||||
return &name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<int> RimCellFilter::selectedCategoryValues() const
|
||||
{
|
||||
return m_selectedCategoryValues;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -123,67 +111,3 @@ caf::PdmFieldHandle* RimCellFilter::objectToggleField()
|
||||
return &isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RimCellFilter::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> options;
|
||||
|
||||
if (&m_selectedCategoryValues == fieldNeedingOptions)
|
||||
{
|
||||
if (useOptionsOnly) *useOptionsOnly = true;
|
||||
|
||||
if (m_categoryValues.size() == m_categoryNames.size())
|
||||
{
|
||||
for (size_t i = 0; i < m_categoryValues.size(); i++)
|
||||
{
|
||||
int categoryValue = m_categoryValues[i];
|
||||
QString categoryName = m_categoryNames[i];
|
||||
|
||||
options.push_back(caf::PdmOptionItemInfo(categoryName, categoryValue));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto it : m_categoryValues)
|
||||
{
|
||||
QString str = QString::number(it);
|
||||
options.push_back(caf::PdmOptionItemInfo(str, it));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::setCategoryValues(const std::vector<int>& categoryValues)
|
||||
{
|
||||
m_categoryValues = categoryValues;
|
||||
m_categoryNames.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::setCategoryNames(const std::vector<QString>& categoryNames)
|
||||
{
|
||||
m_categoryNames = categoryNames;
|
||||
|
||||
for (size_t i = 0; i < m_categoryNames.size(); i++)
|
||||
{
|
||||
m_categoryValues.push_back(static_cast<int>(i));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCellFilter::clearCategories()
|
||||
{
|
||||
m_categoryValues.clear();
|
||||
m_categoryNames.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user