Improve visual appearance for ensemble curves (#9016)

* Ensemble Curves : Improve visual appearance
Set line thickness to 1
If ensemble curves are bright, use a high saturation color for the highlight curve
Increase line thickness for highlighted curve
* Use color by summary vector phase for ensemble curves
* Do not create curves for non-existing history vectors
This commit is contained in:
Magne Sjaastad
2022-06-13 15:08:15 +02:00
committed by GitHub
parent ccbda23b96
commit fe0d009b25
6 changed files with 165 additions and 34 deletions

View File

@@ -1703,6 +1703,7 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vector<RimSummaryCase
curve->setSummaryCaseY( sumCase );
curve->setSummaryAddressYAndApplyInterpolation( addr->address() );
curve->setResampling( m_resampling() );
curve->setLineThickness( 1 );
addCurve( curve );

View File

@@ -362,6 +362,31 @@ void RimSummaryCurveAppearanceCalculator::assignColorByPhase( RimSummaryCurve* c
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RimSummaryCurveAppearanceCalculator::assignColorByPhase( const RifEclipseSummaryAddress& address )
{
char secondChar = 0;
std::string vectorName = address.vectorName();
if ( vectorName.size() > 1 )
{
secondChar = vectorName[1];
if ( !isExcplicitHandled( secondChar ) )
{
secondChar = 0; // Consider all others as one group for coloring
}
}
if ( secondChar == 'W' ) return cycledBlueColor( 0 );
if ( secondChar == 'O' ) return cycledGreenColor( 0 );
if ( secondChar == 'G' ) return cycledRedColor( 0 );
if ( secondChar == 'V' ) return cycledBrownColor( 0 );
return cycledNoneRGBBrColor( 0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -60,6 +60,8 @@ public:
void setupCurveLook( RimSummaryCurve* curve );
static cvf::Color3f assignColorByPhase( const RifEclipseSummaryAddress& address );
void assignColorByPhase( RimSummaryCurve* curve, int colorIndex );
static cvf::Color3f cycledPaletteColor( int colorIndex );

View File

@@ -19,6 +19,7 @@
#include "RimSummaryPlot.h"
#include "RiaColorTables.h"
#include "RiaColorTools.h"
#include "RiaDefines.h"
#include "RiaFieldHandleTools.h"
#include "RiaPlotDefines.h"
@@ -30,6 +31,7 @@
#include "RiaSummaryCurveDefinition.h"
#include "RiaSummaryTools.h"
#include "RiaTimeHistoryCurveResampler.h"
#include "RifReaderEclipseSummary.h"
#include "RicfCommandObject.h"
@@ -763,7 +765,20 @@ void RimSummaryPlot::applyDefaultCurveAppearances()
for ( auto& curveSet : this->ensembleCurveSetCollection()->curveSets() )
{
if ( curveSet->colorMode() != RimEnsembleCurveSet::ColorMode::SINGLE_COLOR ) continue;
curveSet->setColor( RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex++ ) );
cvf::Color3f curveColor;
if ( RiaPreferencesSummary::current()->colorCurvesByPhase() )
{
auto basePhaseColor = RimSummaryCurveAppearanceCalculator::assignColorByPhase( curveSet->summaryAddress() );
curveColor = RiaColorTools::blendCvfColors( basePhaseColor, cvf::Color3f::WHITE, 1, 3 );
}
else
{
curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex++ );
}
curveSet->setColor( curveColor );
}
}
@@ -1942,7 +1957,11 @@ std::pair<int, std::vector<RimSummaryCurve*>> RimSummaryPlot::handleSummaryCaseD
{
auto historyAddr = addr;
historyAddr.setVectorName( addr.vectorName() + RifReaderEclipseSummary::historyIdentifier() );
dataVectorMap[historyAddr].insert( curve->summaryCaseY() );
if ( summaryCase->summaryReader() && summaryCase->summaryReader()->hasAddress( historyAddr ) )
{
dataVectorMap[historyAddr].insert( curve->summaryCaseY() );
}
}
}
@@ -2044,13 +2063,21 @@ std::pair<int, std::vector<RimSummaryCurve*>>
if ( curveDef.ensemble() )
{
addNewEnsembleCurveY( curveDef.summaryAddress(), curveDef.ensemble() );
newCurves++;
auto addresses = curveDef.ensemble()->ensembleSummaryAddresses();
if ( addresses.find( curveDef.summaryAddress() ) != addresses.end() )
{
addNewEnsembleCurveY( curveDef.summaryAddress(), curveDef.ensemble() );
newCurves++;
}
}
else if ( curveDef.summaryCase() )
{
curves.push_back( addNewCurveY( curveDef.summaryAddress(), curveDef.summaryCase() ) );
newCurves++;
if ( curveDef.summaryCase()->summaryReader() &&
curveDef.summaryCase()->summaryReader()->hasAddress( curveDef.summaryAddress() ) )
{
curves.push_back( addNewCurveY( curveDef.summaryAddress(), curveDef.summaryCase() ) );
newCurves++;
}
}
}
@@ -2089,8 +2116,10 @@ std::pair<int, std::vector<RimSummaryCurve*>> RimSummaryPlot::handleSummaryAddre
{
for ( const auto& droppedAddress : newCurveAddresses )
{
bool skipAddress = false;
auto addresses = ensemble->ensembleSummaryAddresses();
if ( addresses.find( droppedAddress ) == addresses.end() ) continue;
bool skipAddress = false;
if ( dataVectorMap.count( droppedAddress ) > 0 )
{
skipAddress = ( dataVectorMap[droppedAddress].count( ensemble ) > 0 );
@@ -2119,6 +2148,9 @@ std::pair<int, std::vector<RimSummaryCurve*>> RimSummaryPlot::handleSummaryAddre
{
for ( const auto& droppedAddress : newCurveAddresses )
{
if ( !summaryCase->summaryReader() || !summaryCase->summaryReader()->hasAddress( droppedAddress ) )
continue;
bool skipAddress = false;
if ( dataVectorMap.count( droppedAddress ) > 0 )
@@ -2192,14 +2224,6 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandl
{
applyDefaultCurveAppearances( curvesToUpdate );
// Ensemble curve sets
int colorIndex = 0;
for ( auto& curveSet : this->ensembleCurveSetCollection()->curveSets() )
{
if ( curveSet->colorMode() != RimEnsembleCurveSet::ColorMode::SINGLE_COLOR ) continue;
curveSet->setColor( RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex++ ) );
}
loadDataAndUpdate();
curvesChanged.send();
@@ -2230,6 +2254,21 @@ void RimSummaryPlot::addNewEnsembleCurveY( const RifEclipseSummaryAddress& addre
curveSet->setSummaryCaseCollection( ensemble );
curveSet->setSummaryAddress( address );
cvf::Color3f curveColor;
if ( RiaPreferencesSummary::current()->colorCurvesByPhase() )
{
auto basePhaseColor = RimSummaryCurveAppearanceCalculator::assignColorByPhase( curveSet->summaryAddress() );
curveColor = RiaColorTools::blendCvfColors( basePhaseColor, cvf::Color3f::WHITE, 1, 3 );
}
else
{
curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f(
ensembleCurveSetCollection()->curveSetCount() );
}
curveSet->setColor( curveColor );
ensembleCurveSetCollection()->addCurveSet( curveSet );
}