#5002 Ensemble RFT curve sets with parameter coloring and separate legends

This commit is contained in:
Gaute Lindkvist
2019-12-02 15:26:24 +01:00
parent f56a34843a
commit 7fd4aa1ce9
16 changed files with 643 additions and 167 deletions

View File

@@ -766,11 +766,10 @@ QList<caf::PdmOptionItemInfo> RimEnsembleCurveSet::calculateValueOptions( const
auto singleColorOption = ColorModeEnum( ColorMode::SINGLE_COLOR );
auto byEnsParamOption = ColorModeEnum( ColorMode::BY_ENSEMBLE_PARAM );
options.push_back( caf::PdmOptionItemInfo::fromEnumClass( singleColorOption.uiText(), ColorMode::SINGLE_COLOR ) );
options.push_back( caf::PdmOptionItemInfo( singleColorOption.uiText(), ColorMode::SINGLE_COLOR ) );
if ( !ensembleParameters().empty() )
{
options.push_back(
caf::PdmOptionItemInfo::fromEnumClass( byEnsParamOption.uiText(), ColorMode::BY_ENSEMBLE_PARAM ) );
options.push_back( caf::PdmOptionItemInfo( byEnsParamOption.uiText(), ColorMode::BY_ENSEMBLE_PARAM ) );
}
}
else if ( fieldNeedingOptions == &m_ensembleParameter )
@@ -851,72 +850,18 @@ void RimEnsembleCurveSet::updateCurveColors()
if ( group && !parameterName.isEmpty() && !group->allSummaryCases().empty() )
{
auto ensembleParam = group->ensembleParameter( parameterName );
if ( ensembleParam.isText() )
if ( ensembleParam.isText() || ensembleParam.isNumeric() )
{
std::set<QString> categories;
for ( auto value : ensembleParam.values )
{
categories.insert( value.toString() );
}
std::vector<QString> categoryNames = std::vector<QString>( categories.begin(), categories.end() );
m_legendConfig->setNamedCategories( categoryNames );
m_legendConfig->setAutomaticRanges( 0, categoryNames.size() - 1, 0, categoryNames.size() - 1 );
RimEnsembleCurveSetColorManager::initializeLegendConfig( m_legendConfig, ensembleParam );
for ( auto& curve : m_curves )
{
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
continue;
RimSummaryCase* rimCase = curve->summaryCaseY();
QString tValue = rimCase->hasCaseRealizationParameters()
? rimCase->caseRealizationParameters()->parameterValue( parameterName ).textValue()
: "";
double nValue = m_legendConfig->categoryValueFromCategoryName( tValue );
if ( nValue != DOUBLE_INF )
{
int iValue = static_cast<int>( nValue );
curve->setColor( cvf::Color3f( m_legendConfig->scalarMapper()->mapToColor( iValue ) ) );
}
else
{
curve->setColor( RiaColorTables::undefinedCellColor() );
}
curve->updateCurveAppearance();
}
}
else if ( ensembleParam.isNumeric() )
{
double minValue = DOUBLE_INF;
double maxValue = -DOUBLE_INF;
for ( auto value : ensembleParam.values )
{
double nValue = value.toDouble();
if ( nValue != DOUBLE_INF )
{
if ( nValue < minValue ) minValue = nValue;
if ( nValue > maxValue ) maxValue = nValue;
}
}
m_legendConfig->setAutomaticRanges( minValue, maxValue, minValue, maxValue );
for ( auto& curve : m_curves )
{
if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS )
continue;
RimSummaryCase* rimCase = curve->summaryCaseY();
double value = rimCase->hasCaseRealizationParameters()
? rimCase->caseRealizationParameters()->parameterValue( parameterName ).numericValue()
: DOUBLE_INF;
if ( value != DOUBLE_INF )
curve->setColor( cvf::Color3f( m_legendConfig->scalarMapper()->mapToColor( value ) ) );
else
curve->setColor( RiaColorTables::undefinedCellColor() );
RimSummaryCase* rimCase = curve->summaryCaseY();
cvf::Color3f curveColor = RimEnsembleCurveSetColorManager::caseColor( m_legendConfig,
rimCase,
ensembleParam );
curve->setColor( curveColor );
curve->updateCurveAppearance();
}
}
@@ -950,7 +895,7 @@ void RimEnsembleCurveSet::updateCurveColors()
}
else
{
if ( !m_legendOverlayFrame.isNull() )
if ( m_legendOverlayFrame )
{
plot->viewer()->removeOverlayFrame( m_legendOverlayFrame );
}