#2000 Curve Creator : Use descriptive texts for variable shortnames

This commit is contained in:
Magne Sjaastad 2017-10-24 18:33:16 +02:00
parent 95a0c47d1c
commit 4c223defec
2 changed files with 21 additions and 5 deletions

View File

@ -36,6 +36,7 @@
#include "RimSummaryCaseMainCollection.h"
#include "RiuSummaryCurveDefinitionKeywords.h"
#include "RiuSummaryVectorDescriptionMap.h"
#include "cafPdmUiTreeSelectionEditor.h"
@ -450,14 +451,16 @@ QList<caf::PdmOptionItemInfo> RiuSummaryCurveDefSelection::calculateValueOptions
addrUnion[OBS_DATA] = findPossibleSummaryAddressesFromSelectedObservedData(identifierAndField);
addrUnion[CALCULATED_CURVES] = findPossibleSummaryAddressesFromCalculated();
std::set<QString> itemNames[itemCount];
std::set<std::string> itemNames[itemCount];
for (int i = 0; i < itemCount; i++)
{
for (const auto& address : addrUnion[i])
{
auto name = QString::fromStdString(address.uiText(identifierAndField->summaryIdentifier()));
if (!name.isEmpty())
auto name = address.uiText(identifierAndField->summaryIdentifier());
if (name.size() > 0)
{
itemNames[i].insert(name);
}
}
}
@ -485,7 +488,20 @@ QList<caf::PdmOptionItemInfo> RiuSummaryCurveDefSelection::calculateValueOptions
auto itemPostfix = (isVectorField && i == OBS_DATA) ? QString(OBSERVED_DATA_AVALUE_POSTFIX) : QString("");
for (const auto& iName : itemNames[i])
{
auto optionItem = caf::PdmOptionItemInfo(iName, iName + itemPostfix);
QString displayName;
if (isVectorField)
{
std::string descriptiveName = RiuSummaryVectorDescriptionMap::instance()->fieldInfo(iName);
displayName = QString::fromStdString(descriptiveName);
displayName += QString(" [%1]").arg(QString::fromStdString(iName));
}
else
{
displayName = QString::fromStdString(iName);
}
auto optionItem = caf::PdmOptionItemInfo(displayName, QString::fromStdString(iName) + itemPostfix);
if (groupItems)
optionItem.setLevel(1);
options.push_back(optionItem);

View File

@ -51,7 +51,7 @@ std::string RiuSummaryVectorDescriptionMap::fieldInfo(const std::string &vectorN
}
}
return std::string();
return vectorName;
}
//--------------------------------------------------------------------------------------------------