mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#1359 Sort tracers in category selection list in property editor
This commit is contained in:
parent
da53183f41
commit
fcd2d96907
@ -279,6 +279,30 @@ bool RimEclipsePropertyFilter::isPropertyFilterControlled()
|
||||
return isPropertyFilterControlled;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilter::setCategoriesFromTracerNames(const std::vector<QString>& tracerNames)
|
||||
{
|
||||
std::vector<std::pair<QString, int>> tracerNameValuesSorted;
|
||||
|
||||
{
|
||||
std::set<std::pair<QString, int>> tracerNameSet;
|
||||
|
||||
for (size_t i = 0; i < tracerNames.size(); i++)
|
||||
{
|
||||
tracerNameSet.insert(std::make_pair(tracerNames[i], static_cast<int>(i)));
|
||||
}
|
||||
|
||||
for (auto it : tracerNameSet)
|
||||
{
|
||||
tracerNameValuesSorted.push_back(it);
|
||||
}
|
||||
}
|
||||
|
||||
setCategoryNamesAndValues(tracerNameValuesSorted);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -337,7 +361,7 @@ void RimEclipsePropertyFilter::computeResultValueRange()
|
||||
|
||||
if ( resultDefinition->hasCategoryResult() )
|
||||
{
|
||||
setCategoryNames(resultDefinition->flowDiagSolution()->tracerNames());
|
||||
setCategoriesFromTracerNames(resultDefinition->flowDiagSolution()->tracerNames());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -423,7 +447,7 @@ void RimEclipsePropertyFilter::updateFromCurrentTimeStep()
|
||||
|
||||
if (resultDefinition->hasCategoryResult())
|
||||
{
|
||||
setCategoryNames(resultDefinition->flowDiagSolution()->tracerNames());
|
||||
setCategoriesFromTracerNames(resultDefinition->flowDiagSolution()->tracerNames());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,7 @@ private:
|
||||
void updateReadOnlyStateOfAllFields();
|
||||
void updateRangeLabel();
|
||||
bool isPropertyFilterControlled();
|
||||
void setCategoriesFromTracerNames(const std::vector<QString>& tracerNames);
|
||||
|
||||
RimEclipsePropertyFilterCollection* parentContainer();
|
||||
|
||||
|
@ -102,6 +102,20 @@ void RimPropertyFilter::setCategoryNames(const std::vector<QString>& categoryNam
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPropertyFilter::setCategoryNamesAndValues(const std::vector<std::pair<QString, int>>& categoryNamesAndValues)
|
||||
{
|
||||
clearCategories();
|
||||
|
||||
for (auto it : categoryNamesAndValues)
|
||||
{
|
||||
m_categoryNames.push_back(it.first);
|
||||
m_categoryValues.push_back(it.second);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
protected:
|
||||
void setCategoryValues(const std::vector<int>& categoryValues);
|
||||
void setCategoryNames(const std::vector<QString>& categoryNames);
|
||||
void setCategoryNamesAndValues(const std::vector<std::pair<QString, int>>& categoryNamesAndValues);
|
||||
void clearCategories();
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
Loading…
Reference in New Issue
Block a user