mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#7333 Well Log Plot: Improve Stack Curve with Phase Colors
Improve curve colors when only one curve of a given phase is displayed Make sure to call the base class directly above current inheritance level Improve colors
This commit is contained in:
parent
93a3060757
commit
084835ce66
@ -16,7 +16,7 @@ $quinaryColor: #0ce5d5; // Quinary color
|
||||
$senaryColor: #a54ce5; // Senary color
|
||||
$borderColor: #394046; // Main border color
|
||||
$curveColorGas: #a91210; // Curve color for gas plot
|
||||
$curveColorGas2: #a91210; // Curve color for gas plot
|
||||
$curveColorGas2: #c91210; // Curve color for gas plot
|
||||
$curveColorOil: #7ba700; // Curve color for oil plot
|
||||
$curveColorOil2: #7ba700; // Curve color for oil plot
|
||||
$curveColorWater: #3e7aa7; // Curve color for water plot
|
||||
|
@ -13,7 +13,7 @@ $quinaryColor: #0ce5d5; // Quinary color
|
||||
$senaryColor: #a54ce5; // Senary color
|
||||
$borderColor: #394046; // Main border color
|
||||
$curveColorGas: #c80000; // Curve color for gas plot
|
||||
$curveColorGas2: #a91210; // Curve color for gas plot
|
||||
$curveColorGas2: #c91210; // Curve color for gas plot
|
||||
$curveColorOil: #00c800; // Curve color for oil plot
|
||||
$curveColorOil2: #7ba700; // Curve color for oil plot
|
||||
$curveColorWater: #0000c8; // Curve color for water plot
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
#include "RiuGuiTheme.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QColor>
|
||||
@ -630,6 +632,40 @@ std::map<RiaDefines::PhaseType, caf::ColorTable> RiaColorTables::phaseColors()
|
||||
{ RiaDefines::PhaseType::OIL_PHASE, caf::ColorTable( oilColors ) } };
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3f RiaColorTables::phaseColor( RiaDefines::PhaseType phase )
|
||||
{
|
||||
cvf::Color3ub col = cvf::Color3::DARK_GRAY;
|
||||
QColor themeCol;
|
||||
|
||||
if ( phase == RiaDefines::PhaseType::GAS_PHASE )
|
||||
{
|
||||
themeCol = RiuGuiTheme::getColorByVariableName( "curveColorGas2" );
|
||||
col = cvf::Color3ub( 212, 0, 0 );
|
||||
}
|
||||
else if ( phase == RiaDefines::PhaseType::OIL_PHASE )
|
||||
{
|
||||
themeCol = RiuGuiTheme::getColorByVariableName( "curveColorOil2" );
|
||||
col = cvf::Color3ub( 0, 204, 0 );
|
||||
}
|
||||
else if ( phase == RiaDefines::PhaseType::WATER_PHASE )
|
||||
{
|
||||
themeCol = RiuGuiTheme::getColorByVariableName( "curveColorWater2" );
|
||||
col = cvf::Color3ub( 0, 0, 205 );
|
||||
}
|
||||
|
||||
if ( themeCol.isValid() )
|
||||
{
|
||||
return RiaColorTools::fromQColorTo3f( themeCol );
|
||||
}
|
||||
else
|
||||
{
|
||||
return cvf::Color3f( col );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -76,6 +76,7 @@ public:
|
||||
static caf::ColorTable createBrightnessBasedColorTable( cvf::Color3ub baseColor, int brightnessLevelCount );
|
||||
|
||||
static std::map<RiaDefines::PhaseType, caf::ColorTable> phaseColors();
|
||||
static cvf::Color3f phaseColor( RiaDefines::PhaseType phase );
|
||||
|
||||
private:
|
||||
static std::vector<cvf::Color3ub> categoryColors();
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "RiuGuiTheme.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
#include "cvfMath.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
@ -67,9 +66,7 @@ cvf::Color3f RiaColorTools::computeOffsetColor( cvf::Color3f color, float offset
|
||||
gridB = color.b() + ( 1.0f - color.b() ) * offsetFactor;
|
||||
}
|
||||
|
||||
return cvf::Color3f( cvf::Math::clamp( gridR, 0.0f, 1.0f ),
|
||||
cvf::Math::clamp( gridG, 0.0f, 1.0f ),
|
||||
cvf::Math::clamp( gridB, 0.0f, 1.0f ) );
|
||||
return cvf::Color3f( std::clamp( gridR, 0.0f, 1.0f ), std::clamp( gridG, 0.0f, 1.0f ), std::clamp( gridB, 0.0f, 1.0f ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -187,6 +184,21 @@ QColor RiaColorTools::blendQColors( const QColor& color1, const QColor& color2,
|
||||
( color1.blue() * weight1 + color2.blue() * weight2 ) / weightsum );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QColor RiaColorTools::modifySaturation( const QColor& color, double factor )
|
||||
{
|
||||
auto colorSaturation( color );
|
||||
qreal h, s, v;
|
||||
color.getHsvF( &h, &s, &v );
|
||||
|
||||
s = std::clamp( s * factor, 0.0, 1.0 );
|
||||
|
||||
colorSaturation.setHsvF( h, s, v );
|
||||
return colorSaturation;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -49,6 +49,9 @@ public:
|
||||
blendCvfColors( const cvf::Color3f& color1, const cvf::Color3f& color2, int weight1 = 1, int weight2 = 1 );
|
||||
static QColor blendQColors( const QColor& color1, const QColor& color2, int weight1 = 1, int weight2 = 1 );
|
||||
|
||||
// Factor > 1 increases saturation, a factor < 1 decreases saturation
|
||||
static QColor modifySaturation( const QColor& color, double factor );
|
||||
|
||||
private:
|
||||
static float relativeLuminance( cvf::Color3f backgroundColor );
|
||||
static float calculateNonLinearColorValue( float colorFraction );
|
||||
|
@ -46,16 +46,33 @@ RiaDefines::PhaseType RimStackablePlotCurve::phaseType() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimStackablePlotCurve::assignStackColor( size_t index, size_t count )
|
||||
{
|
||||
auto allPhaseColors = RiaColorTables::phaseColors();
|
||||
auto it = allPhaseColors.find( phaseType() );
|
||||
if ( it != allPhaseColors.end() )
|
||||
{
|
||||
caf::ColorTable interpolatedPhaseColors = it->second.interpolated( count );
|
||||
cvf::Color3f curveColor( cvf::Color3::BROWN );
|
||||
|
||||
auto color = interpolatedPhaseColors.cycledColor3f( index );
|
||||
this->setColor( color );
|
||||
this->setFillColor( color );
|
||||
if ( count == 1 )
|
||||
{
|
||||
curveColor = RiaColorTables::phaseColor( phaseType() );
|
||||
}
|
||||
else
|
||||
{
|
||||
auto allPhaseColors = RiaColorTables::phaseColors();
|
||||
auto it = allPhaseColors.find( phaseType() );
|
||||
if ( it != allPhaseColors.end() )
|
||||
{
|
||||
caf::ColorTable interpolatedPhaseColors = it->second.interpolated( count );
|
||||
|
||||
curveColor = interpolatedPhaseColors.cycledColor3f( index );
|
||||
}
|
||||
}
|
||||
|
||||
m_fillColor = curveColor;
|
||||
|
||||
{
|
||||
auto moreSaturatedColor = RiaColorTools::toQColor( curveColor );
|
||||
moreSaturatedColor = RiaColorTools::modifySaturation( moreSaturatedColor, 1.2 );
|
||||
|
||||
m_curveColor = RiaColorTools::fromQColorTo3f( moreSaturatedColor );
|
||||
}
|
||||
|
||||
this->updateCurveAppearance();
|
||||
}
|
||||
|
||||
|
@ -312,9 +312,15 @@ void RimWellLogCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
const QVariant& oldValue,
|
||||
const QVariant& newValue )
|
||||
{
|
||||
RimPlotCurve::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
RimStackablePlotCurve::fieldChangedByUi( changedField, oldValue, newValue );
|
||||
|
||||
if ( changedField == &m_showCurve && m_showCurve() )
|
||||
{
|
||||
updateZoomInParentPlot();
|
||||
}
|
||||
|
||||
if ( changedField == &m_isStacked )
|
||||
{
|
||||
loadDataAndUpdate( true );
|
||||
}
|
||||
}
|
||||
|
@ -2027,6 +2027,7 @@ void RimWellLogTrack::connectCurveSignals( RimWellLogCurve* curve )
|
||||
curve->visibilityChanged.connect( this, &RimWellLogTrack::curveVisibilityChanged );
|
||||
curve->appearanceChanged.connect( this, &RimWellLogTrack::curveAppearanceChanged );
|
||||
curve->stackingChanged.connect( this, &RimWellLogTrack::curveStackingChanged );
|
||||
curve->stackingColorsChanged.connect( this, &RimWellLogTrack::curveStackingChanged );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user