mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6118 Automatic red, green and blue curve colors for oil, gas and water properties when using area fill
* Also removed green, red and blue from the cycled well log colors to avoid clashes. * Only automatic when area fill is on. * Potential color clashes for the general case with multiple Oil-curves in the same plot.
This commit is contained in:
@@ -168,7 +168,8 @@ enum class PhaseType
|
||||
{
|
||||
OIL_PHASE,
|
||||
GAS_PHASE,
|
||||
WATER_PHASE
|
||||
WATER_PHASE,
|
||||
PHASE_NOT_APPLICABLE
|
||||
};
|
||||
|
||||
enum class ImportFileType
|
||||
|
||||
@@ -386,20 +386,17 @@ const caf::ColorTable& RiaColorTables::summaryCurveNoneRedGreenBlueBrownPaletteC
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::ColorTable& RiaColorTables::wellLogPlotPaletteColors()
|
||||
{
|
||||
static std::vector<cvf::Color3ub> colors{caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkBlue ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkRed ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkGreen ) ),
|
||||
static std::vector<cvf::Color3ub> colors{caf::ColorTable::fromQColor( QColor( "peru" ) ),
|
||||
caf::ColorTable::fromQColor( QColor( "blueviolet" ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkYellow ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkMagenta ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkCyan ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkMagenta ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::darkGray ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::blue ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::red ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::green ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::yellow ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::magenta ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::cyan ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::gray ) ),
|
||||
caf::ColorTable::fromQColor( QColor( "yellowgreen" ) ),
|
||||
caf::ColorTable::fromQColor( Qt::GlobalColor( Qt::black ) )};
|
||||
|
||||
static caf::ColorTable colorTable = caf::ColorTable( colors );
|
||||
@@ -598,6 +595,16 @@ caf::ColorTable RiaColorTables::createBrightnessBasedColorTable( cvf::Color3ub b
|
||||
return caf::ColorTable( colors );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::map<RiaDefines::PhaseType, cvf::Color3f> RiaColorTables::phaseColors()
|
||||
{
|
||||
return {{RiaDefines::PhaseType::WATER_PHASE, cvf::Color3f( cvf::Color3::DARK_BLUE )},
|
||||
{RiaDefines::PhaseType::GAS_PHASE, cvf::Color3f( cvf::Color3::DARK_GREEN )},
|
||||
{RiaDefines::PhaseType::OIL_PHASE, cvf::Color3f( cvf::Color3::DARK_RED )}};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -74,6 +74,8 @@ public:
|
||||
|
||||
static caf::ColorTable createBrightnessBasedColorTable( cvf::Color3ub baseColor, int brightnessLevelCount );
|
||||
|
||||
static std::map<RiaDefines::PhaseType, cvf::Color3f> phaseColors();
|
||||
|
||||
private:
|
||||
static std::vector<cvf::Color3ub> categoryColors();
|
||||
static std::vector<cvf::Color3ub> contrastCategoryColors();
|
||||
|
||||
@@ -73,6 +73,8 @@
|
||||
#include "cafPdmUiTreeSelectionEditor.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
@@ -1305,6 +1307,27 @@ void RimEclipseResultDefinition::setResultVariable( const QString& val )
|
||||
m_resultVariableUiField = val;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Return phase type if the current result is known to be of a particular
|
||||
/// fluid phase type. Otherwise the method will return PHASE_NOT_APPLICABLE.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::PhaseType RimEclipseResultDefinition::resultPhaseType() const
|
||||
{
|
||||
if ( QRegularExpression( "OIL" ).match( m_resultVariable() ).hasMatch() )
|
||||
{
|
||||
return RiaDefines::PhaseType::OIL_PHASE;
|
||||
}
|
||||
else if ( QRegularExpression( "GAS" ).match( m_resultVariable() ).hasMatch() )
|
||||
{
|
||||
return RiaDefines::PhaseType::GAS_PHASE;
|
||||
}
|
||||
else if ( QRegularExpression( "WAT" ).match( m_resultVariable() ).hasMatch() )
|
||||
{
|
||||
return RiaDefines::PhaseType::WATER_PHASE;
|
||||
}
|
||||
return RiaDefines::PhaseType::PHASE_NOT_APPLICABLE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -85,6 +85,7 @@ public:
|
||||
void setPorosityModel( RiaDefines::PorosityModelType val );
|
||||
QString resultVariable() const { return m_resultVariable(); }
|
||||
virtual void setResultVariable( const QString& val );
|
||||
RiaDefines::PhaseType resultPhaseType() const;
|
||||
|
||||
void setFlowSolution( RimFlowDiagSolution* flowSol );
|
||||
RimFlowDiagSolution* flowDiagSolution() const;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaSimWellBranchTools.h"
|
||||
|
||||
@@ -358,6 +359,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
m_qwtPlotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() );
|
||||
|
||||
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
|
||||
checkAndApplyDefaultFillColor();
|
||||
|
||||
if ( isUsingPseudoLength )
|
||||
{
|
||||
@@ -627,6 +629,47 @@ void RimWellLogExtractionCurve::clearGeneratedSimWellPaths()
|
||||
m_wellPathsWithExtractors.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimWellLogExtractionCurve::isDefaultColor( const cvf::Color3f& color ) const
|
||||
{
|
||||
if ( RiaColorTables::wellLogPlotPaletteColors().contains( color ) ) return true;
|
||||
|
||||
auto phaseColors = RiaColorTables::phaseColors();
|
||||
for ( auto phaseColorPair : phaseColors )
|
||||
{
|
||||
if ( phaseColorPair.second == color ) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Certain data types can have a predefined color. Apply this if the curve currently has
|
||||
/// a default cycled color.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogExtractionCurve::checkAndApplyDefaultFillColor()
|
||||
{
|
||||
if ( !m_fillColor().isValid() )
|
||||
{
|
||||
m_fillColor = m_curveColor;
|
||||
}
|
||||
|
||||
if ( m_eclipseResultDefinition && m_fillStyle != Qt::BrushStyle::NoBrush )
|
||||
{
|
||||
auto phaseColors = RiaColorTables::phaseColors();
|
||||
auto it = phaseColors.find( m_eclipseResultDefinition->resultPhaseType() );
|
||||
cvf::Color3f phaseColor;
|
||||
if ( it != phaseColors.end() )
|
||||
{
|
||||
phaseColor = it->second;
|
||||
}
|
||||
|
||||
if ( isDefaultColor( m_curveColor() ) ) m_curveColor = phaseColor;
|
||||
if ( isDefaultColor( m_fillColor() ) ) m_fillColor = phaseColor;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -112,6 +112,8 @@ protected:
|
||||
void clampBranchIndex();
|
||||
std::set<QString> sortedSimWellNames();
|
||||
void clearGeneratedSimWellPaths();
|
||||
bool isDefaultColor( const cvf::Color3f& color ) const;
|
||||
void checkAndApplyDefaultFillColor() override;
|
||||
|
||||
caf::PdmPtrField<RimCase*> m_case;
|
||||
caf::PdmField<caf::AppEnum<TrajectoryType>> m_trajectoryType;
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "RimSummaryCalculation.h"
|
||||
#include "RimSummaryCalculationCollection.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
@@ -153,3 +155,24 @@ void RimSummaryAddress::ensureIdIsAssigned()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Return phase type if the current result is known to be of a particular
|
||||
/// fluid phase type. Otherwise the method will return PHASE_NOT_APPLICABLE.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaDefines::PhaseType RimSummaryAddress::addressPhaseType() const
|
||||
{
|
||||
if ( QRegularExpression( "^.OP" ).match( m_quantityName ).hasMatch() )
|
||||
{
|
||||
return RiaDefines::PhaseType::OIL_PHASE;
|
||||
}
|
||||
else if ( QRegularExpression( "^.GP" ).match( m_quantityName ).hasMatch() )
|
||||
{
|
||||
return RiaDefines::PhaseType::GAS_PHASE;
|
||||
}
|
||||
else if ( QRegularExpression( "^.WP" ).match( m_quantityName ).hasMatch() )
|
||||
{
|
||||
return RiaDefines::PhaseType::WATER_PHASE;
|
||||
}
|
||||
return RiaDefines::PhaseType::PHASE_NOT_APPLICABLE;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@ public:
|
||||
|
||||
void ensureIdIsAssigned();
|
||||
|
||||
RiaDefines::PhaseType addressPhaseType() const;
|
||||
|
||||
private:
|
||||
caf::PdmField<caf::AppEnum<RifEclipseSummaryAddress::SummaryVarCategory>> m_category;
|
||||
caf::PdmField<QString> m_quantityName;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "RimSummaryCurve.h"
|
||||
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaCurveMerger.h"
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
@@ -462,6 +463,7 @@ void RimSummaryCurve::updateZoomInParentPlot()
|
||||
void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
|
||||
{
|
||||
this->RimPlotCurve::updateCurvePresentation( updateParentPlot );
|
||||
checkAndApplyDefaultFillColor();
|
||||
|
||||
m_yValuesSummaryAddressUiField = m_yValuesSummaryAddress->address();
|
||||
m_xValuesSummaryAddressUiField = m_xValuesSummaryAddress->address();
|
||||
@@ -706,6 +708,46 @@ void RimSummaryCurve::appendOptionItemsForSummaryAddresses( QList<caf::PdmOption
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimSummaryCurve::isDefaultColor( const cvf::Color3f& color ) const
|
||||
{
|
||||
if ( RiaColorTables::summaryCurveDefaultPaletteColors().contains( color ) ) return true;
|
||||
|
||||
auto phaseColors = RiaColorTables::phaseColors();
|
||||
for ( auto phaseColorPair : phaseColors )
|
||||
{
|
||||
if ( phaseColorPair.second == color ) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCurve::checkAndApplyDefaultFillColor()
|
||||
{
|
||||
if ( !m_fillColor().isValid() )
|
||||
{
|
||||
m_fillColor = m_curveColor;
|
||||
}
|
||||
|
||||
if ( m_yValuesSummaryAddress && m_fillStyle != Qt::BrushStyle::NoBrush )
|
||||
{
|
||||
auto phaseColors = RiaColorTables::phaseColors();
|
||||
auto it = phaseColors.find( m_yValuesSummaryAddress->addressPhaseType() );
|
||||
cvf::Color3f phaseColor;
|
||||
if ( it != phaseColors.end() )
|
||||
{
|
||||
phaseColor = it->second;
|
||||
}
|
||||
|
||||
if ( isDefaultColor( m_curveColor() ) ) m_curveColor = phaseColor;
|
||||
if ( isDefaultColor( m_fillColor() ) ) m_fillColor = phaseColor;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -111,6 +111,8 @@ private:
|
||||
caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
static void appendOptionItemsForSummaryAddresses( QList<caf::PdmOptionItemInfo>* options, RimSummaryCase* summaryCase );
|
||||
bool isDefaultColor( const cvf::Color3f& color ) const;
|
||||
void checkAndApplyDefaultFillColor() override;
|
||||
|
||||
private:
|
||||
// Y values
|
||||
|
||||
Reference in New Issue
Block a user