mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2844 Ensemble curve set. Show only relevant color modes. Use gray curves for cases without emsemble params
This commit is contained in:
parent
8b6c226f5b
commit
dd23fa2ead
@ -539,9 +539,19 @@ QList<caf::PdmOptionItemInfo> RimEnsembleCurveSet::calculateValueOptions(const c
|
||||
|
||||
options.push_front(caf::PdmOptionItemInfo("None", nullptr));
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_colorMode)
|
||||
{
|
||||
auto singleColorOption = caf::AppEnum<RimEnsembleCurveSet::ColorMode>(RimEnsembleCurveSet::SINGLE_COLOR);
|
||||
auto byEnsParamOption = caf::AppEnum<RimEnsembleCurveSet::ColorMode>(RimEnsembleCurveSet::BY_ENSEMBLE_PARAM);
|
||||
|
||||
options.push_back(caf::PdmOptionItemInfo(singleColorOption.uiText(), RimEnsembleCurveSet::SINGLE_COLOR));
|
||||
if (!ensembleParameters().empty())
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(byEnsParamOption.uiText(), RimEnsembleCurveSet::BY_ENSEMBLE_PARAM));
|
||||
}
|
||||
}
|
||||
else if (fieldNeedingOptions == &m_ensembleParameter)
|
||||
{
|
||||
|
||||
for (auto param : ensembleParameters())
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(param, param));
|
||||
@ -668,13 +678,19 @@ void RimEnsembleCurveSet::updateCurveColors()
|
||||
for (auto& curve : m_curves)
|
||||
{
|
||||
RimSummaryCase* rimCase = curve->summaryCaseY();
|
||||
QString tValue = rimCase->caseRealizationParameters()->parameterValue(parameterName).textValue();
|
||||
QString tValue = rimCase->hasCaseRealizationParameters() ?
|
||||
rimCase->caseRealizationParameters()->parameterValue(parameterName).textValue() :
|
||||
"";
|
||||
double nValue = m_legendConfig->categoryValueFromCategoryName(tValue);
|
||||
if (nValue != HUGE_VAL)
|
||||
{
|
||||
int iValue = static_cast<int>(nValue);
|
||||
curve->setColor(cvf::Color3f(m_legendConfig->scalarMapper()->mapToColor(iValue)));
|
||||
}
|
||||
else
|
||||
{
|
||||
curve->setColor(cvf::Color3f::GRAY);
|
||||
}
|
||||
curve->updateCurveAppearance();
|
||||
}
|
||||
}
|
||||
@ -705,8 +721,11 @@ void RimEnsembleCurveSet::updateCurveColors()
|
||||
for (auto& curve : m_curves)
|
||||
{
|
||||
RimSummaryCase* rimCase = curve->summaryCaseY();
|
||||
double value = rimCase->caseRealizationParameters()->parameterValue(parameterName).numericValue();
|
||||
curve->setColor(cvf::Color3f(m_legendConfig->scalarMapper()->mapToColor(value)));
|
||||
double value = rimCase->hasCaseRealizationParameters() ?
|
||||
rimCase->caseRealizationParameters()->parameterValue(parameterName).numericValue() :
|
||||
HUGE_VAL;
|
||||
if(value != HUGE_VAL) curve->setColor(cvf::Color3f(m_legendConfig->scalarMapper()->mapToColor(value)));
|
||||
else curve->setColor(cvf::Color3f::GRAY);
|
||||
curve->updateCurveAppearance();
|
||||
}
|
||||
}
|
||||
@ -725,7 +744,7 @@ void RimEnsembleCurveSet::updateCurveColors()
|
||||
firstAncestorOrThisOfType(plot);
|
||||
if (plot && plot->qwtPlot())
|
||||
{
|
||||
if (isCurvesVisible() && m_colorMode == BY_ENSEMBLE_PARAM && m_legendConfig->showLegend())
|
||||
if (m_yValuesSummaryGroup() && isCurvesVisible() && m_colorMode == BY_ENSEMBLE_PARAM && m_legendConfig->showLegend())
|
||||
{
|
||||
plot->qwtPlot()->addOrUpdateEnsembleCurveSetLegend(this);
|
||||
}
|
||||
|
@ -99,6 +99,14 @@ std::shared_ptr<RigCaseRealizationParameters> RimSummaryCase::caseRealizationPar
|
||||
return m_crlParameters;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryCase::hasCaseRealizationParameters() const
|
||||
{
|
||||
return m_crlParameters != nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
|
||||
void setCaseRealizationParameters(const std::shared_ptr<RigCaseRealizationParameters>& crlParameters);
|
||||
std::shared_ptr<RigCaseRealizationParameters> caseRealizationParameters() const;
|
||||
bool hasCaseRealizationParameters() const;
|
||||
|
||||
protected:
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
|
@ -76,7 +76,7 @@ void RimSummaryPlotNameHelper::appendEnsembleCases(const std::vector<RimSummaryC
|
||||
|
||||
for (auto c : ensembleCases)
|
||||
{
|
||||
m_ensembleCases.insert(c);
|
||||
if(c) m_ensembleCases.insert(c);
|
||||
}
|
||||
|
||||
extractPlotTitleSubStrings();
|
||||
|
Loading…
Reference in New Issue
Block a user