(#829) Use std::vector instead of std::set for categories. Added categoryNames to RimLegendConfig

This commit is contained in:
Magne Sjaastad
2016-09-07 10:28:57 +02:00
parent 3e40db6ef0
commit f1c214c1d7
9 changed files with 65 additions and 95 deletions

View File

@@ -948,16 +948,20 @@ void RimEclipseView::updateLegends()
{
if(cellEdgeResult()->singleVarEdgeResultColors()->resultType() != RimDefines::FORMATION_NAMES)
{
cellEdgeResult()->legendConfig()->setCategories(results->uniqueCellScalarValues(cellEdgeResult()->singleVarEdgeResultColors()->scalarResultIndex()),
results->uniqueCellScalarValues(cellEdgeResult()->singleVarEdgeResultColors()->scalarResultIndex(), 0));
cellEdgeResult()->legendConfig()->setCategories(results->uniqueCellScalarValues(cellEdgeResult()->singleVarEdgeResultColors()->scalarResultIndex()));
}
else
{
const std::vector<QString>& fnVector =
eclipseCase->activeFormationNames()->formationNames();
std::set<int> nameIndices;
for(int i = 0; i < fnVector.size(); ++i) nameIndices.insert(i);
cellEdgeResult()->legendConfig()->setCategories(nameIndices, nameIndices);
const std::vector<QString>& fnVector = eclipseCase->activeFormationNames()->formationNames();
std::vector<int> nameIndices;
std::vector<cvf::String> names;
for (int i = 0; i < fnVector.size(); ++i)
{
nameIndices.push_back(i);
names.push_back(cvfqt::Utils::toString(fnVector[i]));
}
cellEdgeResult()->legendConfig()->setCategoriesWithNames(nameIndices, names);
}
}
@@ -1006,21 +1010,22 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
if (resultColors->hasCategoryResult())
{
size_t adjustedTimeStep = m_currentTimeStep;
if (resultColors->hasStaticResult()) adjustedTimeStep = 0;
if(resultColors->resultType() != RimDefines::FORMATION_NAMES)
{
resultColors->legendConfig()->setCategories(cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex()),
cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex(), adjustedTimeStep));
resultColors->legendConfig()->setCategories(cellResultsData->uniqueCellScalarValues(resultColors->scalarResultIndex()));
}
else
{
const std::vector<QString>& fnVector =
eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
std::set<int> nameIndices;
for(int i = 0; i < fnVector.size(); ++i) nameIndices.insert(i);
resultColors->legendConfig()->setCategories(nameIndices, nameIndices);
const std::vector<QString>& fnVector = eclipseCase()->reservoirData()->activeFormationNames()->formationNames();
std::vector<int> nameIndices;
std::vector<cvf::String> names;
for (int i = 0; i < fnVector.size(); ++i)
{
nameIndices.push_back(i);
names.push_back(cvfqt::Utils::toString(fnVector[i]));
}
resultColors->legendConfig()->setCategoriesWithNames(nameIndices, names);
}
}