#1125 Limit size of string in legend and info, reordered tracer combo

This commit is contained in:
Magne Sjaastad 2017-01-12 15:00:18 +01:00
parent 8ce8b4e7f1
commit 894b4468b4
12 changed files with 98 additions and 28 deletions

View File

@ -84,7 +84,7 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
projectFolder = m_cellColors->reservoirView()->eclipseCase()->locationOnDisc();
}
QString outputFileName = projectFolder + "/" + caf::Utils::makeValidFileBasename( m_cellColors->resultVariableUiName());
QString outputFileName = projectFolder + "/" + caf::Utils::makeValidFileBasename( m_cellColors->resultVariableUiShortName());
exportSettings.fileName = outputFileName;
}

View File

@ -293,7 +293,7 @@ QString RicExportMultipleSnapshotsFeature::resultName(RimView* rimView)
{
RimEclipseView* eclView = dynamic_cast<RimEclipseView*>(rimView);
return caf::Utils::makeValidFileBasename(eclView->cellResult()->resultVariableUiName());
return caf::Utils::makeValidFileBasename(eclView->cellResult()->resultVariableUiShortName());
}
else if (dynamic_cast<RimGeoMechView*>(rimView))
{

View File

@ -361,18 +361,17 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
if (eclipseView->cellResult()->isTernarySaturationSelected())
{
QString propName = eclipseView->cellResult()->resultVariableUiName();
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName);
}
if (isResultsInfoRelevant)
{
QString propName = eclipseView->cellResult()->resultVariableUiName();
QString propName = eclipseView->cellResult()->resultVariableUiShortName();
QString timeRangeText = m_statisticsTimeRange().uiText();
if ( eclipseView->cellResult()->resultType() == RimDefines::FLOW_DIAGNOSTICS )
{
timeRangeText = caf::AppEnum<StatisticsTimeRangeType>::uiText(CURRENT_TIMESTEP);
propName = QString::fromStdString( eclipseView->cellResult()->flowDiagResAddress().uiText());
}
infoText += QString("<b>Cell Property:</b> %1 ").arg(propName);
@ -407,14 +406,14 @@ void Rim3dOverlayInfoConfig::updateEclipse3DInfo(RimEclipseView * eclipseView)
}
infoText += QString("<b>Fault results: </b> %1<br>").arg(faultMapping);
infoText += QString("<b>Fault Property:</b> %1 <br>").arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariableUiName());
infoText += QString("<b>Fault Property:</b> %1 <br>").arg(eclipseView->faultResultSettings()->customFaultResult()->resultVariableUiShortName());
}
}
if (eclipseView->hasUserRequestedAnimation() && eclipseView->cellEdgeResult()->hasResult())
{
double min, max;
QString cellEdgeName = eclipseView->cellEdgeResult()->resultVariableUiName();
QString cellEdgeName = eclipseView->cellEdgeResult()->resultVariableUiShortName();
eclipseView->cellEdgeResult()->minMaxCellEdgeValues(min, max);
infoText += QString("<b>Cell Edge Property:</b> %1 ").arg(cellEdgeName);
infoText += QString("<table border=0 cellspacing=5 >"

View File

@ -543,6 +543,21 @@ QString RimCellEdgeColors::resultVariableUiName() const
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimCellEdgeColors::resultVariableUiShortName() const
{
if (isUsingSingleVariable())
{
return m_singleVarEdgeResultColors->resultVariableUiShortName();
}
else
{
return m_resultVariable;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -74,6 +74,7 @@ public:
void setResultVariable(const QString& variableName);
QString resultVariable() const;
QString resultVariableUiName() const;
QString resultVariableUiShortName() const;
caf::PdmField<bool> enableCellEdgeColors;

View File

@ -353,7 +353,7 @@ void RimEclipsePropertyFilter::computeResultValueRange()
//--------------------------------------------------------------------------------------------------
void RimEclipsePropertyFilter::updateFilterName()
{
QString newFiltername = resultDefinition->resultVariableUiName();
QString newFiltername = resultDefinition->resultVariableUiShortName();
if (isCategorySelectionActive())
{

View File

@ -45,12 +45,12 @@ namespace caf
template<>
void RimEclipseResultDefinition::FlowTracerSelectionEnum::setUp()
{
addItem(RimEclipseResultDefinition::FLOW_TR_INDIVIDUAL, "FLOW_TR_INDIVIDUAL", "Individual");
addItem(RimEclipseResultDefinition::FLOW_TR_INJECTORS, "FLOW_TR_INJECTORS", "All Injectors");
addItem(RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD, "FLOW_TR_INJ_AND_PROD", "All Injectors and Producers");
addItem(RimEclipseResultDefinition::FLOW_TR_PRODUCERS, "FLOW_TR_PRODUCERS", "All Producers");
addItem(RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD, "FLOW_TR_INJ_AND_PROD", "Injectors and Producers");
addItem(RimEclipseResultDefinition::FLOW_TR_INJECTORS, "FLOW_TR_INJECTORS", "All Injectors");
addItem(RimEclipseResultDefinition::FLOW_TR_BY_SELECTION, "FLOW_TR_BY_SELECTION", "By Selection");
setDefault(RimEclipseResultDefinition::FLOW_TR_INDIVIDUAL);
setDefault(RimEclipseResultDefinition::FLOW_TR_INJ_AND_PROD);
}
}
@ -79,7 +79,7 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
CAF_PDM_InitFieldNoDefault(&m_selectedTracers, "SelectedTracers", "Tracers", "", "", "");
m_selectedTracers.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_flowTracerSelectionMode, "FlowTracerSelectionMode", "Selection Type", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_flowTracerSelectionMode, "FlowTracerSelectionMode", "Tracers", "", "", "");
// Ui only fields
@ -101,11 +101,10 @@ RimEclipseResultDefinition::RimEclipseResultDefinition()
m_flowSolutionUiField.xmlCapability()->setIOReadable(false);
m_flowSolutionUiField.xmlCapability()->setIOWritable(false);
CAF_PDM_InitFieldNoDefault(&m_selectedTracersUiField, "MSelectedTracers", "Tracers", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_selectedTracersUiField, "MSelectedTracers", " ", "", "", "");
m_selectedTracersUiField.xmlCapability()->setIOReadable(false);
m_selectedTracersUiField.xmlCapability()->setIOWritable(false);
m_selectedTracersUiField.uiCapability()->setUiEditorTypeName(caf::PdmUiListEditor::uiEditorTypeName());
}
//--------------------------------------------------------------------------------------------------
@ -562,7 +561,7 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
size_t timeStep = rimView->currentTimeStep();
std::set<std::string> selTracerNames;
if (m_flowTracerSelectionMode == FLOW_TR_INDIVIDUAL)
if (m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION)
{
for (const QString& tName : m_selectedTracers())
{
@ -608,11 +607,57 @@ RigFlowDiagResultAddress RimEclipseResultDefinition::flowDiagResAddress() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::resultVariableUiName()
QString RimEclipseResultDefinition::resultVariableUiName() const
{
if (resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
return QString::fromStdString(flowDiagResAddress().uiText());
QString fullName;
if (m_flowTracerSelectionMode() == FLOW_TR_BY_SELECTION)
{
fullName = QString::fromStdString(flowDiagResAddress().uiText());
}
else
{
fullName = QString::fromStdString(flowDiagResAddress().uiShortText());
fullName += QString(" (%1)").arg(m_flowTracerSelectionMode().uiText());
}
return fullName;
}
return m_resultVariable();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEclipseResultDefinition::resultVariableUiShortName() const
{
if (resultType() == RimDefines::FLOW_DIAGNOSTICS)
{
QString shortName;
if (m_flowTracerSelectionMode() == FLOW_TR_BY_SELECTION)
{
QString candidate = QString::fromStdString(flowDiagResAddress().uiText());
int stringSizeLimit = 32;
if (candidate.size() > stringSizeLimit)
{
candidate = candidate.left(stringSizeLimit);
candidate += "...";
}
shortName = candidate;
}
else
{
shortName = QString::fromStdString(flowDiagResAddress().uiShortText());
shortName += QString(" (%1)").arg(m_flowTracerSelectionMode().uiText());
}
return shortName;
}
return m_resultVariable();
@ -838,7 +883,7 @@ void RimEclipseResultDefinition::defineUiOrdering(QString uiConfigName, caf::Pdm
uiOrdering.add(&m_flowTracerSelectionMode);
if (m_flowTracerSelectionMode == FLOW_TR_INDIVIDUAL)
if (m_flowTracerSelectionMode == FLOW_TR_BY_SELECTION)
{
uiOrdering.add(&m_selectedTracersUiField);
}

View File

@ -47,10 +47,10 @@ class RimEclipseResultDefinition : public caf::PdmObject
public:
enum FlowTracerSelectionType
{
FLOW_TR_INDIVIDUAL,
FLOW_TR_INJECTORS,
FLOW_TR_INJ_AND_PROD,
FLOW_TR_PRODUCERS,
FLOW_TR_INJ_AND_PROD
FLOW_TR_INJECTORS,
FLOW_TR_BY_SELECTION
};
typedef caf::AppEnum<RimEclipseResultDefinition::FlowTracerSelectionType> FlowTracerSelectionEnum;
@ -71,7 +71,8 @@ public:
RimFlowDiagSolution* flowDiagSolution();
RigFlowDiagResultAddress flowDiagResAddress() const;
QString resultVariableUiName();
QString resultVariableUiName() const;
QString resultVariableUiShortName() const;
void loadResult();
size_t scalarResultIndex() const;

View File

@ -989,7 +989,7 @@ void RimEclipseView::updateLegends()
}
m_viewer->addColorLegendToBottomLeftCorner(this->cellEdgeResult()->legendConfig()->legend());
this->cellEdgeResult()->legendConfig()->setTitle(cvfqt::Utils::toString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariableUiName()));
this->cellEdgeResult()->legendConfig()->setTitle(cvfqt::Utils::toString(QString("Edge Results: \n") + this->cellEdgeResult()->resultVariableUiShortName()));
}
else
{
@ -1008,7 +1008,7 @@ void RimEclipseView::updateMinMaxValuesAndAddLegendToView(QString legendLabel, R
resultColors->updateLegendData(m_currentTimeStep);
m_viewer->addColorLegendToBottomLeftCorner(resultColors->legendConfig()->legend());
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariableUiName()));
resultColors->legendConfig()->setTitle(cvfqt::Utils::toString(legendLabel + resultColors->resultVariableUiShortName()));
}
size_t maxTimeStepCount = cellResultsData->maxTimeStepCount();

View File

@ -30,7 +30,7 @@ bool RigFlowDiagResultAddress::isNativeResult() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RigFlowDiagResultAddress::uiText()
std::string RigFlowDiagResultAddress::uiText() const
{
std::string uiVarname = variableName;
@ -44,4 +44,11 @@ std::string RigFlowDiagResultAddress::uiText()
return uitext;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::string RigFlowDiagResultAddress::uiShortText() const
{
return variableName;
}

View File

@ -40,7 +40,9 @@ public:
bool isNativeResult() const;
std::string uiText();
std::string uiText() const;
std::string uiShortText() const;
std::string variableName;
std::set<std::string> selectedTracerNames;

View File

@ -121,7 +121,7 @@ void RiuSelectionChangedHandler::addCurveFromSelectionItem(const RiuEclipseSelec
QString curveName = eclipseView->eclipseCase()->caseUserDescription();
curveName += ", ";
curveName += eclipseView->cellResult()->resultVariableUiName();
curveName += eclipseView->cellResult()->resultVariableUiShortName();
curveName += ", ";
curveName += QString("Grid index %1").arg(eclipseSelectionItem->m_gridIndex);
curveName += ", ";