mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Curve Colors : Add support for color assignment based on summary phase (oil, gas or water)
This commit is contained in:
parent
ed87c9028c
commit
caaca138c0
@ -262,6 +262,9 @@ RiaPreferences::RiaPreferences()
|
|||||||
|
|
||||||
CAF_PDM_InitFieldNoDefault( &m_systemPreferences, "systemPreferences", "systemPreferences" );
|
CAF_PDM_InitFieldNoDefault( &m_systemPreferences, "systemPreferences", "systemPreferences" );
|
||||||
m_systemPreferences = new RiaPreferencesSystem;
|
m_systemPreferences = new RiaPreferencesSystem;
|
||||||
|
|
||||||
|
CAF_PDM_InitField( &m_curveColorByPhase, "curveColorByPhase", true, "Curve Color By Phase" );
|
||||||
|
caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_curveColorByPhase );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -385,6 +388,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
|||||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Plot Templates" );
|
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Plot Templates" );
|
||||||
group->add( &m_plotTemplateFolders );
|
group->add( &m_plotTemplateFolders );
|
||||||
group->add( &m_searchPlotTemplateFoldersRecursively );
|
group->add( &m_searchPlotTemplateFoldersRecursively );
|
||||||
|
group->add( &m_curveColorByPhase );
|
||||||
|
|
||||||
caf::PdmUiGroup* pageSetup = uiOrdering.addNewGroup( "Page Setup" );
|
caf::PdmUiGroup* pageSetup = uiOrdering.addNewGroup( "Page Setup" );
|
||||||
pageSetup->add( &m_pageSize );
|
pageSetup->add( &m_pageSize );
|
||||||
@ -746,6 +750,14 @@ bool RiaPreferences::useQtChartsAsDefaultPlotType() const
|
|||||||
return m_useQtChartsPlotByDefault;
|
return m_useQtChartsPlotByDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RiaPreferences::colorCurvesByPhase() const
|
||||||
|
{
|
||||||
|
return m_curveColorByPhase();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -83,6 +83,7 @@ public:
|
|||||||
void setDefaultPlotTemplatePath( const QString& templatePath );
|
void setDefaultPlotTemplatePath( const QString& templatePath );
|
||||||
bool openExportedPdfInViewer() const;
|
bool openExportedPdfInViewer() const;
|
||||||
bool useQtChartsAsDefaultPlotType() const;
|
bool useQtChartsAsDefaultPlotType() const;
|
||||||
|
bool colorCurvesByPhase() const;
|
||||||
|
|
||||||
RiaDefines::ThemeEnum guiTheme() const;
|
RiaDefines::ThemeEnum guiTheme() const;
|
||||||
|
|
||||||
@ -187,6 +188,7 @@ private:
|
|||||||
caf::PdmField<bool> m_searchPlotTemplateFoldersRecursively;
|
caf::PdmField<bool> m_searchPlotTemplateFoldersRecursively;
|
||||||
caf::PdmField<caf::FilePath> m_defaultPlotTemplate;
|
caf::PdmField<caf::FilePath> m_defaultPlotTemplate;
|
||||||
caf::PdmField<bool> m_useQtChartsPlotByDefault;
|
caf::PdmField<bool> m_useQtChartsPlotByDefault;
|
||||||
|
caf::PdmField<bool> m_curveColorByPhase;
|
||||||
|
|
||||||
// Script paths
|
// Script paths
|
||||||
caf::PdmField<QString> m_octaveExecutable;
|
caf::PdmField<QString> m_octaveExecutable;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "RimSummaryCurveAppearanceCalculator.h"
|
#include "RimSummaryCurveAppearanceCalculator.h"
|
||||||
|
|
||||||
#include "RiaColorTables.h"
|
#include "RiaColorTables.h"
|
||||||
|
#include "RiaPreferences.h"
|
||||||
#include "RiaSummaryCurveDefinition.h"
|
#include "RiaSummaryCurveDefinition.h"
|
||||||
|
|
||||||
#include "RiuQwtPlotCurve.h"
|
#include "RiuQwtPlotCurve.h"
|
||||||
@ -62,99 +63,28 @@ bool isExcplicitHandled( char secondChar )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimSummaryCurveAppearanceCalculator::RimSummaryCurveAppearanceCalculator(
|
||||||
|
const std::vector<RiaSummaryCurveDefinition>& curveDefinitions )
|
||||||
|
{
|
||||||
|
init( curveDefinitions );
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RimSummaryCurveAppearanceCalculator::RimSummaryCurveAppearanceCalculator( const std::set<RiaSummaryCurveDefinition>& curveDefinitions )
|
RimSummaryCurveAppearanceCalculator::RimSummaryCurveAppearanceCalculator( const std::set<RiaSummaryCurveDefinition>& curveDefinitions )
|
||||||
{
|
{
|
||||||
m_allSummaryCaseNames = getAllSummaryCaseNames();
|
std::vector<RiaSummaryCurveDefinition> curveDefVector;
|
||||||
m_allSummaryWellNames = getAllSummaryWellNames();
|
|
||||||
|
|
||||||
for ( const RiaSummaryCurveDefinition& curveDef : curveDefinitions )
|
for ( auto c : curveDefinitions )
|
||||||
{
|
{
|
||||||
if ( curveDef.summaryCase() ) m_caseToAppearanceIdxMap[curveDef.summaryCase()] = -1;
|
curveDefVector.emplace_back( c );
|
||||||
if ( !curveDef.summaryAddress().wellName().empty() )
|
|
||||||
m_welToAppearanceIdxMap[curveDef.summaryAddress().wellName()] = -1;
|
|
||||||
if ( !curveDef.summaryAddress().groupName().empty() )
|
|
||||||
m_grpToAppearanceIdxMap[curveDef.summaryAddress().groupName()] = -1;
|
|
||||||
if ( !( curveDef.summaryAddress().regionNumber() == -1 ) )
|
|
||||||
m_regToAppearanceIdxMap[curveDef.summaryAddress().regionNumber()] = -1;
|
|
||||||
|
|
||||||
if ( !curveDef.summaryAddress().quantityName().empty() )
|
|
||||||
{
|
|
||||||
std::string varname = curveDef.summaryAddress().quantityName();
|
|
||||||
|
|
||||||
if ( curveDef.summaryAddress().isHistoryQuantity() )
|
|
||||||
{
|
|
||||||
varname = varname.substr( 0, varname.size() - 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_varToAppearanceIdxMap[varname] = -1;
|
|
||||||
|
|
||||||
// Indexes for sub color ranges
|
|
||||||
char secondChar = 0;
|
|
||||||
if ( varname.size() > 1 )
|
|
||||||
{
|
|
||||||
secondChar = varname[1];
|
|
||||||
if ( !isExcplicitHandled( secondChar ) )
|
|
||||||
{
|
|
||||||
secondChar = 0; // Consider all others as one group for coloring
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_secondCharToVarToAppearanceIdxMap[secondChar][varname] = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select the default appearance type for each data "dimension"
|
init( curveDefVector );
|
||||||
m_caseAppearanceType = NONE;
|
|
||||||
m_varAppearanceType = NONE;
|
|
||||||
m_wellAppearanceType = NONE;
|
|
||||||
m_groupAppearanceType = NONE;
|
|
||||||
m_regionAppearanceType = NONE;
|
|
||||||
|
|
||||||
std::set<RimSummaryCurveAppearanceCalculator::CurveAppearanceType> unusedAppearTypes;
|
|
||||||
unusedAppearTypes.insert( COLOR );
|
|
||||||
unusedAppearTypes.insert( GRADIENT );
|
|
||||||
unusedAppearTypes.insert( LINE_STYLE );
|
|
||||||
unusedAppearTypes.insert( SYMBOL );
|
|
||||||
unusedAppearTypes.insert( LINE_THICKNESS );
|
|
||||||
m_currentCurveGradient = 0.0f;
|
|
||||||
|
|
||||||
m_dimensionCount = 0;
|
|
||||||
if ( m_varToAppearanceIdxMap.size() > 1 )
|
|
||||||
{
|
|
||||||
m_varAppearanceType = *( unusedAppearTypes.begin() );
|
|
||||||
unusedAppearTypes.erase( unusedAppearTypes.begin() );
|
|
||||||
m_dimensionCount++;
|
|
||||||
}
|
|
||||||
if ( m_caseToAppearanceIdxMap.size() > 1 )
|
|
||||||
{
|
|
||||||
m_caseAppearanceType = *( unusedAppearTypes.begin() );
|
|
||||||
unusedAppearTypes.erase( unusedAppearTypes.begin() );
|
|
||||||
m_dimensionCount++;
|
|
||||||
}
|
|
||||||
if ( m_welToAppearanceIdxMap.size() > 1 )
|
|
||||||
{
|
|
||||||
m_wellAppearanceType = *( unusedAppearTypes.begin() );
|
|
||||||
unusedAppearTypes.erase( unusedAppearTypes.begin() );
|
|
||||||
m_dimensionCount++;
|
|
||||||
}
|
|
||||||
if ( m_grpToAppearanceIdxMap.size() > 1 )
|
|
||||||
{
|
|
||||||
m_groupAppearanceType = *( unusedAppearTypes.begin() );
|
|
||||||
unusedAppearTypes.erase( unusedAppearTypes.begin() );
|
|
||||||
m_dimensionCount++;
|
|
||||||
}
|
|
||||||
if ( m_regToAppearanceIdxMap.size() > 1 )
|
|
||||||
{
|
|
||||||
m_regionAppearanceType = *( unusedAppearTypes.begin() );
|
|
||||||
unusedAppearTypes.erase( unusedAppearTypes.begin() );
|
|
||||||
m_dimensionCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_dimensionCount == 0 ) m_varAppearanceType = COLOR; // basically one curve
|
|
||||||
|
|
||||||
updateApperanceIndices();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -347,8 +277,14 @@ void RimSummaryCurveAppearanceCalculator::setupCurveLook( RimSummaryCurve* curve
|
|||||||
m_currentCurveBaseColor = cvf::Color3f( 0.5f, 0.5f, 0.5f );
|
m_currentCurveBaseColor = cvf::Color3f( 0.5f, 0.5f, 0.5f );
|
||||||
m_currentCurveGradient = 0.0f;
|
m_currentCurveGradient = 0.0f;
|
||||||
|
|
||||||
|
std::string quantityName = curve->summaryAddressY().quantityName();
|
||||||
|
if ( curve->summaryAddressY().isHistoryQuantity() )
|
||||||
|
{
|
||||||
|
quantityName = quantityName.substr( 0, quantityName.size() - 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
int varAppearanceIdx = m_varToAppearanceIdxMap[quantityName];
|
||||||
int caseAppearanceIdx = m_caseToAppearanceIdxMap[curve->summaryCaseY()];
|
int caseAppearanceIdx = m_caseToAppearanceIdxMap[curve->summaryCaseY()];
|
||||||
int varAppearanceIdx = m_varToAppearanceIdxMap[curve->summaryAddressY().quantityName()];
|
|
||||||
int welAppearanceIdx = m_welToAppearanceIdxMap[curve->summaryAddressY().wellName()];
|
int welAppearanceIdx = m_welToAppearanceIdxMap[curve->summaryAddressY().wellName()];
|
||||||
int grpAppearanceIdx = m_grpToAppearanceIdxMap[curve->summaryAddressY().groupName()];
|
int grpAppearanceIdx = m_grpToAppearanceIdxMap[curve->summaryAddressY().groupName()];
|
||||||
int regAppearanceIdx = m_regToAppearanceIdxMap[curve->summaryAddressY().regionNumber()];
|
int regAppearanceIdx = m_regToAppearanceIdxMap[curve->summaryAddressY().regionNumber()];
|
||||||
@ -363,52 +299,15 @@ void RimSummaryCurveAppearanceCalculator::setupCurveLook( RimSummaryCurve* curve
|
|||||||
setOneCurveAppearance( m_groupAppearanceType, m_grpToAppearanceIdxMap.size(), grpAppearanceIdx, curve );
|
setOneCurveAppearance( m_groupAppearanceType, m_grpToAppearanceIdxMap.size(), grpAppearanceIdx, curve );
|
||||||
setOneCurveAppearance( m_regionAppearanceType, m_regToAppearanceIdxMap.size(), regAppearanceIdx, curve );
|
setOneCurveAppearance( m_regionAppearanceType, m_regToAppearanceIdxMap.size(), regAppearanceIdx, curve );
|
||||||
|
|
||||||
if ( m_varAppearanceType == COLOR && m_secondCharToVarToAppearanceIdxMap.size() > 1 )
|
bool assignByPhase = false;
|
||||||
|
if ( RiaPreferences::current()->colorCurvesByPhase() )
|
||||||
{
|
{
|
||||||
int subColorIndex = -1;
|
assignByPhase = ( m_varAppearanceType == COLOR );
|
||||||
char secondChar = 0;
|
}
|
||||||
std::string varname = curve->summaryAddressY().quantityName();
|
|
||||||
|
|
||||||
if ( curve->summaryAddressY().isHistoryQuantity() )
|
if ( assignByPhase )
|
||||||
{
|
{
|
||||||
varname = varname.substr( 0, varname.size() - 1 );
|
assignColorByPhase( curve, varAppearanceIdx );
|
||||||
}
|
|
||||||
|
|
||||||
if ( varname.size() > 1 )
|
|
||||||
{
|
|
||||||
secondChar = varname[1];
|
|
||||||
if ( !isExcplicitHandled( secondChar ) )
|
|
||||||
{
|
|
||||||
secondChar = 0; // Consider all others as one group for coloring
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
subColorIndex = m_secondCharToVarToAppearanceIdxMap[secondChar][varname];
|
|
||||||
|
|
||||||
if ( secondChar == 'W' )
|
|
||||||
{
|
|
||||||
// Pick blue
|
|
||||||
m_currentCurveBaseColor = cycledBlueColor( subColorIndex );
|
|
||||||
}
|
|
||||||
else if ( secondChar == 'O' )
|
|
||||||
{
|
|
||||||
// Pick Green
|
|
||||||
m_currentCurveBaseColor = cycledGreenColor( subColorIndex );
|
|
||||||
}
|
|
||||||
else if ( secondChar == 'G' )
|
|
||||||
{
|
|
||||||
// Pick Red
|
|
||||||
m_currentCurveBaseColor = cycledRedColor( subColorIndex );
|
|
||||||
}
|
|
||||||
else if ( secondChar == 'V' )
|
|
||||||
{
|
|
||||||
// Pick Brown
|
|
||||||
m_currentCurveBaseColor = cycledBrownColor( subColorIndex );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_currentCurveBaseColor = cycledNoneRGBBrColor( subColorIndex );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -420,6 +319,144 @@ void RimSummaryCurveAppearanceCalculator::setupCurveLook( RimSummaryCurve* curve
|
|||||||
curve->setCurveAppearanceFromCaseType();
|
curve->setCurveAppearanceFromCaseType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCurveAppearanceCalculator::assignColorByPhase( RimSummaryCurve* curve, int colorIndex )
|
||||||
|
{
|
||||||
|
char secondChar = 0;
|
||||||
|
std::string varname = curve->summaryAddressY().quantityName();
|
||||||
|
|
||||||
|
if ( varname.size() > 1 )
|
||||||
|
{
|
||||||
|
secondChar = varname[1];
|
||||||
|
if ( !isExcplicitHandled( secondChar ) )
|
||||||
|
{
|
||||||
|
secondChar = 0; // Consider all others as one group for coloring
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( secondChar == 'W' )
|
||||||
|
{
|
||||||
|
// Pick blue
|
||||||
|
m_currentCurveBaseColor = cycledBlueColor( colorIndex );
|
||||||
|
}
|
||||||
|
else if ( secondChar == 'O' )
|
||||||
|
{
|
||||||
|
// Pick Green
|
||||||
|
m_currentCurveBaseColor = cycledGreenColor( colorIndex );
|
||||||
|
}
|
||||||
|
else if ( secondChar == 'G' )
|
||||||
|
{
|
||||||
|
// Pick Red
|
||||||
|
m_currentCurveBaseColor = cycledRedColor( colorIndex );
|
||||||
|
}
|
||||||
|
else if ( secondChar == 'V' )
|
||||||
|
{
|
||||||
|
// Pick Brown
|
||||||
|
m_currentCurveBaseColor = cycledBrownColor( colorIndex );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_currentCurveBaseColor = cycledNoneRGBBrColor( colorIndex );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryCurveAppearanceCalculator::init( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions )
|
||||||
|
{
|
||||||
|
m_allSummaryCaseNames = getAllSummaryCaseNames();
|
||||||
|
m_allSummaryWellNames = getAllSummaryWellNames();
|
||||||
|
|
||||||
|
for ( const RiaSummaryCurveDefinition& curveDef : curveDefinitions )
|
||||||
|
{
|
||||||
|
if ( curveDef.summaryCase() ) m_caseToAppearanceIdxMap[curveDef.summaryCase()] = -1;
|
||||||
|
if ( !curveDef.summaryAddress().wellName().empty() )
|
||||||
|
m_welToAppearanceIdxMap[curveDef.summaryAddress().wellName()] = -1;
|
||||||
|
if ( !curveDef.summaryAddress().groupName().empty() )
|
||||||
|
m_grpToAppearanceIdxMap[curveDef.summaryAddress().groupName()] = -1;
|
||||||
|
if ( !( curveDef.summaryAddress().regionNumber() == -1 ) )
|
||||||
|
m_regToAppearanceIdxMap[curveDef.summaryAddress().regionNumber()] = -1;
|
||||||
|
|
||||||
|
if ( !curveDef.summaryAddress().quantityName().empty() )
|
||||||
|
{
|
||||||
|
std::string varname = curveDef.summaryAddress().quantityName();
|
||||||
|
|
||||||
|
if ( curveDef.summaryAddress().isHistoryQuantity() )
|
||||||
|
{
|
||||||
|
varname = varname.substr( 0, varname.size() - 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_varToAppearanceIdxMap[varname] = -1;
|
||||||
|
|
||||||
|
// Indexes for sub color ranges
|
||||||
|
char secondChar = 0;
|
||||||
|
if ( varname.size() > 1 )
|
||||||
|
{
|
||||||
|
secondChar = varname[1];
|
||||||
|
if ( !isExcplicitHandled( secondChar ) )
|
||||||
|
{
|
||||||
|
secondChar = 0; // Consider all others as one group for coloring
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_secondCharToVarToAppearanceIdxMap[secondChar][varname] = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select the default appearance type for each data "dimension"
|
||||||
|
m_caseAppearanceType = NONE;
|
||||||
|
m_varAppearanceType = NONE;
|
||||||
|
m_wellAppearanceType = NONE;
|
||||||
|
m_groupAppearanceType = NONE;
|
||||||
|
m_regionAppearanceType = NONE;
|
||||||
|
|
||||||
|
std::set<RimSummaryCurveAppearanceCalculator::CurveAppearanceType> unusedAppearTypes;
|
||||||
|
unusedAppearTypes.insert( COLOR );
|
||||||
|
unusedAppearTypes.insert( GRADIENT );
|
||||||
|
unusedAppearTypes.insert( LINE_STYLE );
|
||||||
|
unusedAppearTypes.insert( SYMBOL );
|
||||||
|
unusedAppearTypes.insert( LINE_THICKNESS );
|
||||||
|
m_currentCurveGradient = 0.0f;
|
||||||
|
|
||||||
|
m_dimensionCount = 0;
|
||||||
|
if ( m_varToAppearanceIdxMap.size() > 1 )
|
||||||
|
{
|
||||||
|
m_varAppearanceType = *( unusedAppearTypes.begin() );
|
||||||
|
unusedAppearTypes.erase( unusedAppearTypes.begin() );
|
||||||
|
m_dimensionCount++;
|
||||||
|
}
|
||||||
|
if ( m_caseToAppearanceIdxMap.size() > 1 )
|
||||||
|
{
|
||||||
|
m_caseAppearanceType = *( unusedAppearTypes.begin() );
|
||||||
|
unusedAppearTypes.erase( unusedAppearTypes.begin() );
|
||||||
|
m_dimensionCount++;
|
||||||
|
}
|
||||||
|
if ( m_welToAppearanceIdxMap.size() > 1 )
|
||||||
|
{
|
||||||
|
m_wellAppearanceType = *( unusedAppearTypes.begin() );
|
||||||
|
unusedAppearTypes.erase( unusedAppearTypes.begin() );
|
||||||
|
m_dimensionCount++;
|
||||||
|
}
|
||||||
|
if ( m_grpToAppearanceIdxMap.size() > 1 )
|
||||||
|
{
|
||||||
|
m_groupAppearanceType = *( unusedAppearTypes.begin() );
|
||||||
|
unusedAppearTypes.erase( unusedAppearTypes.begin() );
|
||||||
|
m_dimensionCount++;
|
||||||
|
}
|
||||||
|
if ( m_regToAppearanceIdxMap.size() > 1 )
|
||||||
|
{
|
||||||
|
m_regionAppearanceType = *( unusedAppearTypes.begin() );
|
||||||
|
unusedAppearTypes.erase( unusedAppearTypes.begin() );
|
||||||
|
m_dimensionCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_dimensionCount == 0 ) m_varAppearanceType = COLOR; // basically one curve
|
||||||
|
|
||||||
|
updateApperanceIndices();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <unordered_map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class RimSummaryCurve;
|
class RimSummaryCurve;
|
||||||
class RimSummaryCase;
|
class RimSummaryCase;
|
||||||
@ -34,6 +36,7 @@ class RimSummaryCurveAppearanceCalculator
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit RimSummaryCurveAppearanceCalculator( const std::set<RiaSummaryCurveDefinition>& curveDefinitions );
|
explicit RimSummaryCurveAppearanceCalculator( const std::set<RiaSummaryCurveDefinition>& curveDefinitions );
|
||||||
|
explicit RimSummaryCurveAppearanceCalculator( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions );
|
||||||
enum CurveAppearanceType
|
enum CurveAppearanceType
|
||||||
{
|
{
|
||||||
NONE,
|
NONE,
|
||||||
@ -57,6 +60,8 @@ public:
|
|||||||
|
|
||||||
void setupCurveLook( RimSummaryCurve* curve );
|
void setupCurveLook( RimSummaryCurve* curve );
|
||||||
|
|
||||||
|
void assignColorByPhase( RimSummaryCurve* curve, int colorIndex );
|
||||||
|
|
||||||
static cvf::Color3f cycledPaletteColor( int colorIndex );
|
static cvf::Color3f cycledPaletteColor( int colorIndex );
|
||||||
static cvf::Color3f cycledNoneRGBBrColor( int colorIndex );
|
static cvf::Color3f cycledNoneRGBBrColor( int colorIndex );
|
||||||
static cvf::Color3f cycledGreenColor( int colorIndex );
|
static cvf::Color3f cycledGreenColor( int colorIndex );
|
||||||
@ -66,6 +71,7 @@ public:
|
|||||||
static RiuPlotCurveSymbol::PointSymbolEnum cycledSymbol( int index );
|
static RiuPlotCurveSymbol::PointSymbolEnum cycledSymbol( int index );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void init( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions );
|
||||||
void setOneCurveAppearance( CurveAppearanceType appeaType, size_t totalCount, int appeaIdx, RimSummaryCurve* curve );
|
void setOneCurveAppearance( CurveAppearanceType appeaType, size_t totalCount, int appeaIdx, RimSummaryCurve* curve );
|
||||||
void updateApperanceIndices();
|
void updateApperanceIndices();
|
||||||
std::map<std::string, size_t> mapNameToAppearanceIndex( CurveAppearanceType& appearance,
|
std::map<std::string, size_t> mapNameToAppearanceIndex( CurveAppearanceType& appearance,
|
||||||
@ -91,11 +97,11 @@ private:
|
|||||||
CurveAppearanceType m_groupAppearanceType;
|
CurveAppearanceType m_groupAppearanceType;
|
||||||
CurveAppearanceType m_regionAppearanceType;
|
CurveAppearanceType m_regionAppearanceType;
|
||||||
|
|
||||||
std::map<RimSummaryCase*, int> m_caseToAppearanceIdxMap;
|
std::map<RimSummaryCase*, int> m_caseToAppearanceIdxMap;
|
||||||
std::map<std::string, int> m_varToAppearanceIdxMap;
|
std::unordered_map<std::string, int> m_varToAppearanceIdxMap;
|
||||||
std::map<std::string, int> m_welToAppearanceIdxMap;
|
std::unordered_map<std::string, int> m_welToAppearanceIdxMap;
|
||||||
std::map<std::string, int> m_grpToAppearanceIdxMap;
|
std::unordered_map<std::string, int> m_grpToAppearanceIdxMap;
|
||||||
std::map<int, int> m_regToAppearanceIdxMap;
|
std::unordered_map<int, int> m_regToAppearanceIdxMap;
|
||||||
|
|
||||||
std::map<char, std::map<std::string, int>> m_secondCharToVarToAppearanceIdxMap;
|
std::map<char, std::map<std::string, int>> m_secondCharToVarToAppearanceIdxMap;
|
||||||
|
|
||||||
|
@ -774,6 +774,27 @@ void RimSummaryPlot::applyDefaultCurveAppearances()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimSummaryPlot::applyDefaultCurveAppearances( std::vector<RimSummaryCurve*> curvesToUpdate )
|
||||||
|
{
|
||||||
|
std::vector<RiaSummaryCurveDefinition> allCurveDefs;
|
||||||
|
|
||||||
|
for ( const auto& curve : this->summaryAndEnsembleCurves() )
|
||||||
|
{
|
||||||
|
allCurveDefs.emplace_back( curve->summaryCaseY(), curve->summaryAddressY(), curve->isEnsembleCurve() );
|
||||||
|
}
|
||||||
|
|
||||||
|
RimSummaryCurveAppearanceCalculator curveLookCalc( allCurveDefs );
|
||||||
|
|
||||||
|
for ( auto& curve : curvesToUpdate )
|
||||||
|
{
|
||||||
|
curve->resetAppearance();
|
||||||
|
curveLookCalc.setupCurveLook( curve );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -1914,9 +1935,10 @@ bool RimSummaryPlot::autoPlotTitle() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
int RimSummaryPlot::handleSummaryCaseDrop( RimSummaryCase* summaryCase )
|
std::pair<int, std::vector<RimSummaryCurve*>> RimSummaryPlot::handleSummaryCaseDrop( RimSummaryCase* summaryCase )
|
||||||
{
|
{
|
||||||
int newCurves = 0;
|
int newCurves = 0;
|
||||||
|
std::vector<RimSummaryCurve*> curves;
|
||||||
|
|
||||||
std::map<RifEclipseSummaryAddress, std::set<RimSummaryCase*>> dataVectorMap;
|
std::map<RifEclipseSummaryAddress, std::set<RimSummaryCase*>> dataVectorMap;
|
||||||
|
|
||||||
@ -1930,19 +1952,22 @@ int RimSummaryPlot::handleSummaryCaseDrop( RimSummaryCase* summaryCase )
|
|||||||
{
|
{
|
||||||
if ( cases.count( summaryCase ) > 0 ) continue;
|
if ( cases.count( summaryCase ) > 0 ) continue;
|
||||||
|
|
||||||
addNewCurveY( addr, summaryCase );
|
curves.push_back( addNewCurveY( addr, summaryCase ) );
|
||||||
newCurves++;
|
newCurves++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return newCurves;
|
return { newCurves, curves };
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
int RimSummaryPlot::handleAddressCollectionDrop( RimSummaryAddressCollection* addressCollection )
|
std::pair<int, std::vector<RimSummaryCurve*>>
|
||||||
|
RimSummaryPlot::handleAddressCollectionDrop( RimSummaryAddressCollection* addressCollection )
|
||||||
{
|
{
|
||||||
int newCurves = 0;
|
int newCurves = 0;
|
||||||
|
std::vector<RimSummaryCurve*> curves;
|
||||||
|
|
||||||
auto droppedName = addressCollection->name().toStdString();
|
auto droppedName = addressCollection->name().toStdString();
|
||||||
|
|
||||||
auto summaryCase = RiaSummaryTools::summaryCaseById( addressCollection->caseId() );
|
auto summaryCase = RiaSummaryTools::summaryCaseById( addressCollection->caseId() );
|
||||||
@ -2013,20 +2038,21 @@ int RimSummaryPlot::handleAddressCollectionDrop( RimSummaryAddressCollection* ad
|
|||||||
}
|
}
|
||||||
else if ( curveDef.summaryCase() )
|
else if ( curveDef.summaryCase() )
|
||||||
{
|
{
|
||||||
addNewCurveY( curveDef.summaryAddress(), curveDef.summaryCase() );
|
curves.push_back( addNewCurveY( curveDef.summaryAddress(), curveDef.summaryCase() ) );
|
||||||
newCurves++;
|
newCurves++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return newCurves;
|
return { newCurves, curves };
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
int RimSummaryPlot::handleSummaryAddressDrop( RimSummaryAddress* summaryAddr )
|
std::pair<int, std::vector<RimSummaryCurve*>> RimSummaryPlot::handleSummaryAddressDrop( RimSummaryAddress* summaryAddr )
|
||||||
{
|
{
|
||||||
int newCurves = 0;
|
int newCurves = 0;
|
||||||
|
std::vector<RimSummaryCurve*> curves;
|
||||||
|
|
||||||
if ( summaryAddr->isEnsemble() )
|
if ( summaryAddr->isEnsemble() )
|
||||||
{
|
{
|
||||||
@ -2042,11 +2068,11 @@ int RimSummaryPlot::handleSummaryAddressDrop( RimSummaryAddress* summaryAddr )
|
|||||||
auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAddr->caseId() );
|
auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAddr->caseId() );
|
||||||
if ( summaryCase )
|
if ( summaryCase )
|
||||||
{
|
{
|
||||||
addNewCurveY( summaryAddr->address(), summaryCase );
|
curves.push_back( addNewCurveY( summaryAddr->address(), summaryCase ) );
|
||||||
newCurves++;
|
newCurves++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return newCurves;
|
return { newCurves, curves };
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -2054,35 +2080,51 @@ int RimSummaryPlot::handleSummaryAddressDrop( RimSummaryAddress* summaryAddr )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandle*>& objects )
|
void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandle*>& objects )
|
||||||
{
|
{
|
||||||
int newCurves = 0;
|
int accumulatedCurveCount = 0;
|
||||||
|
std::vector<RimSummaryCurve*> curvesToUpdate;
|
||||||
|
|
||||||
for ( auto obj : objects )
|
for ( auto obj : objects )
|
||||||
{
|
{
|
||||||
auto summaryCase = dynamic_cast<RimSummaryCase*>( obj );
|
auto summaryCase = dynamic_cast<RimSummaryCase*>( obj );
|
||||||
if ( summaryCase )
|
if ( summaryCase )
|
||||||
{
|
{
|
||||||
newCurves += handleSummaryCaseDrop( summaryCase );
|
auto [curveCount, curvesCreated] = handleSummaryCaseDrop( summaryCase );
|
||||||
|
accumulatedCurveCount += curveCount;
|
||||||
|
curvesToUpdate.insert( curvesToUpdate.end(), curvesCreated.begin(), curvesCreated.end() );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto summaryAddr = dynamic_cast<RimSummaryAddress*>( obj );
|
auto summaryAddr = dynamic_cast<RimSummaryAddress*>( obj );
|
||||||
if ( summaryAddr )
|
if ( summaryAddr )
|
||||||
{
|
{
|
||||||
newCurves += handleSummaryAddressDrop( summaryAddr );
|
auto [curveCount, curvesCreated] = handleSummaryAddressDrop( summaryAddr );
|
||||||
|
accumulatedCurveCount += curveCount;
|
||||||
|
curvesToUpdate.insert( curvesToUpdate.end(), curvesCreated.begin(), curvesCreated.end() );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto addressCollection = dynamic_cast<RimSummaryAddressCollection*>( obj );
|
auto addressCollection = dynamic_cast<RimSummaryAddressCollection*>( obj );
|
||||||
if ( addressCollection )
|
if ( addressCollection )
|
||||||
{
|
{
|
||||||
newCurves += handleAddressCollectionDrop( addressCollection );
|
auto [curveCount, curvesCreated] = handleAddressCollectionDrop( addressCollection );
|
||||||
|
accumulatedCurveCount += curveCount;
|
||||||
|
curvesToUpdate.insert( curvesToUpdate.end(), curvesCreated.begin(), curvesCreated.end() );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( newCurves > 0 )
|
if ( accumulatedCurveCount > 0 )
|
||||||
{
|
{
|
||||||
applyDefaultCurveAppearances();
|
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();
|
loadDataAndUpdate();
|
||||||
|
|
||||||
curvesChanged.send();
|
curvesChanged.send();
|
||||||
@ -2094,12 +2136,14 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandl
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimSummaryPlot::addNewCurveY( const RifEclipseSummaryAddress& address, RimSummaryCase* summaryCase )
|
RimSummaryCurve* RimSummaryPlot::addNewCurveY( const RifEclipseSummaryAddress& address, RimSummaryCase* summaryCase )
|
||||||
{
|
{
|
||||||
auto* newCurve = new RimSummaryCurve();
|
auto* newCurve = new RimSummaryCurve();
|
||||||
newCurve->setSummaryCaseY( summaryCase );
|
newCurve->setSummaryCaseY( summaryCase );
|
||||||
newCurve->setSummaryAddressYAndApplyInterpolation( address );
|
newCurve->setSummaryAddressYAndApplyInterpolation( address );
|
||||||
addCurveNoUpdate( newCurve );
|
addCurveNoUpdate( newCurve );
|
||||||
|
|
||||||
|
return newCurve;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -229,7 +229,6 @@ private:
|
|||||||
RimPlotAxisProperties* addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name );
|
RimPlotAxisProperties* addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Overridden PDM methods
|
|
||||||
caf::PdmFieldHandle* userDescriptionField() override;
|
caf::PdmFieldHandle* userDescriptionField() override;
|
||||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||||
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
|
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
|
||||||
@ -281,16 +280,17 @@ private:
|
|||||||
|
|
||||||
void assignPlotAxis( RimSummaryCurve* curve );
|
void assignPlotAxis( RimSummaryCurve* curve );
|
||||||
|
|
||||||
void addNewCurveY( const RifEclipseSummaryAddress& address, RimSummaryCase* summaryCase );
|
RimSummaryCurve* addNewCurveY( const RifEclipseSummaryAddress& address, RimSummaryCase* summaryCase );
|
||||||
void addNewEnsembleCurveY( const RifEclipseSummaryAddress& address, RimSummaryCaseCollection* ensemble );
|
void addNewEnsembleCurveY( const RifEclipseSummaryAddress& address, RimSummaryCaseCollection* ensemble );
|
||||||
|
|
||||||
void updateStackedCurveData();
|
void updateStackedCurveData();
|
||||||
bool updateStackedCurveDataForAxis( RiuPlotAxis plotAxis );
|
bool updateStackedCurveDataForAxis( RiuPlotAxis plotAxis );
|
||||||
bool updateStackedCurveDataForRelevantAxes();
|
bool updateStackedCurveDataForRelevantAxes();
|
||||||
|
|
||||||
int handleSummaryCaseDrop( RimSummaryCase* summaryCase );
|
std::pair<int, std::vector<RimSummaryCurve*>> handleSummaryCaseDrop( RimSummaryCase* summaryCase );
|
||||||
int handleAddressCollectionDrop( RimSummaryAddressCollection* addrColl );
|
std::pair<int, std::vector<RimSummaryCurve*>> handleAddressCollectionDrop( RimSummaryAddressCollection* addrColl );
|
||||||
int handleSummaryAddressDrop( RimSummaryAddress* summaryAddr );
|
std::pair<int, std::vector<RimSummaryCurve*>> handleSummaryAddressDrop( RimSummaryAddress* summaryAddr );
|
||||||
|
void applyDefaultCurveAppearances( std::vector<RimSummaryCurve*> curvesToUpdate );
|
||||||
|
|
||||||
bool isOnlyWaterCutCurvesVisible( RiuPlotAxis plotAxis );
|
bool isOnlyWaterCutCurvesVisible( RiuPlotAxis plotAxis );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user