diff --git a/ApplicationCode/Application/Tools/RiaColorTables.cpp b/ApplicationCode/Application/Tools/RiaColorTables.cpp index 8f6754a8fb..b69ee8eef2 100644 --- a/ApplicationCode/Application/Tools/RiaColorTables.cpp +++ b/ApplicationCode/Application/Tools/RiaColorTables.cpp @@ -498,6 +498,22 @@ const caf::ColorTable& RiaColorTables::waterAndRockPaletteColors() return colorTable; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const caf::ColorTable& RiaColorTables::correlationPaletteColors() +{ + static std::vector colors{ + cvf::Color3ub( 255, 25, 50 ), // Bluish red + cvf::Color3ub( 240, 240, 240 ), // Light Gray + cvf::Color3ub( 255, 100, 50 ), // Dark red Orange + }; + + static caf::ColorTable colorTable = caf::ColorTable( colors ); + + return colorTable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Application/Tools/RiaColorTables.h b/ApplicationCode/Application/Tools/RiaColorTables.h index d4a449a767..65b58b04af 100644 --- a/ApplicationCode/Application/Tools/RiaColorTables.h +++ b/ApplicationCode/Application/Tools/RiaColorTables.h @@ -60,6 +60,7 @@ public: static const caf::ColorTable& editableWellPathsPaletteColors(); static const caf::ColorTable& wellPathsPaletteColors(); static const caf::ColorTable& waterAndRockPaletteColors(); + static const caf::ColorTable& correlationPaletteColors(); static cvf::Color3f undefinedCellColor(); diff --git a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp index 54dda39ef9..cb3e943c08 100644 --- a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp +++ b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp @@ -152,6 +152,7 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot() CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "", "", "", "" ); m_legendConfig = new RimRegularLegendConfig(); m_legendConfig->setAutomaticRanges( -1.0, 1.0, -1.0, 1.0 ); + m_legendConfig->setColorLegend( RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::CORRELATION ) ); m_selectMultipleVectors = true; } @@ -190,6 +191,14 @@ bool RimCorrelationMatrixPlot::sortByAbsoluteValues() const return m_sortByAbsoluteValues; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimRegularLegendConfig* RimCorrelationMatrixPlot::legendConfig() +{ + return m_legendConfig(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -275,10 +284,10 @@ void RimCorrelationMatrixPlot::onLoadDataAndUpdate() m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotScale ); m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotItem ); + updateLegend(); createMatrix(); m_plotWidget->insertLegend( nullptr ); - m_plotWidget->updateLegend(); this->updateAxes(); this->updatePlotTitle(); @@ -547,11 +556,15 @@ void RimCorrelationMatrixPlot::updatePlotTitle() { m_description = QString( "%1 Matrix for Parameters vs Result Vectors" ).arg( m_correlationFactor().uiText() ); } - m_plotWidget->setPlotTitle( m_description ); - m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() ); - if ( isMdiWindow() ) + + if ( m_plotWidget ) { - m_plotWidget->setPlotTitleFontSize( titleFontSize() ); + m_plotWidget->setPlotTitle( m_description ); + m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() ); + if ( isMdiWindow() ) + { + m_plotWidget->setPlotTitleFontSize( titleFontSize() ); + } } } @@ -560,14 +573,7 @@ void RimCorrelationMatrixPlot::updatePlotTitle() //-------------------------------------------------------------------------------------------------- void RimCorrelationMatrixPlot::updateLegend() { - if ( m_showAbsoluteValues ) - { - m_legendConfig->setAutomaticRanges( -1.0, 1.0, -1.0, 1.0 ); - } - else - { - m_legendConfig->setAutomaticRanges( 0.0, 1.0, 0.0, 1.0 ); - } + if ( m_plotWidget ) m_plotWidget->updateLegend(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h index 35c1a3d7cf..9c05d135d5 100644 --- a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h +++ b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h @@ -44,9 +44,10 @@ public: RimCorrelationMatrixPlot(); ~RimCorrelationMatrixPlot() override; - CorrelationFactor correlationFactor() const; - bool showAbsoluteValues() const; - bool sortByAbsoluteValues() const; + CorrelationFactor correlationFactor() const; + bool showAbsoluteValues() const; + bool sortByAbsoluteValues() const; + RimRegularLegendConfig* legendConfig(); signals: void matrixCellSelected( const EnsembleParameter&, const RiaSummaryCurveDefinition& ); diff --git a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp index 1fe94f989e..5a12d59b59 100644 --- a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp +++ b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp @@ -22,6 +22,7 @@ #include "RimCorrelationMatrixPlot.h" #include "RimParameterResultCrossPlot.h" +#include "RimRegularLegendConfig.h" #include "RiuMultiPlotPage.h" @@ -329,8 +330,8 @@ void RimCorrelationReportPlot::onLoadDataAndUpdate() void RimCorrelationReportPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { m_correlationMatrixPlot->uiOrdering( "report", uiOrdering ); - auto plotGroup = uiOrdering.addNewGroup( "Plot Settings" ); - RimPlotWindow::uiOrderingForPlotLayout( uiConfigName, *plotGroup ); + auto plotGroup = uiOrdering.addNewGroup( "Font Settings" ); + plotGroup->add( &m_titleFontSize ); plotGroup->add( &m_subTitleFontSize ); plotGroup->add( &m_labelFontSize ); plotGroup->add( &m_axisTitleFontSize ); @@ -344,6 +345,7 @@ void RimCorrelationReportPlot::defineUiOrdering( QString uiConfigName, caf::PdmU void RimCorrelationReportPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= "" */ ) { + uiTreeOrdering.add( m_correlationMatrixPlot->legendConfig() ); uiTreeOrdering.skipRemainingChildren( true ); } diff --git a/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.cpp b/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.cpp index c18ecab904..b52e2e4f7e 100644 --- a/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.cpp @@ -94,6 +94,7 @@ void RimRegularLegendConfig::ColorRangeEnum::setUp() addItem( RimRegularLegendConfig::BLUE_LIGHT_DARK, "BLUE_DARK_LIGHT", "Blue Light to Dark" ); addItem( RimRegularLegendConfig::GREEN_RED, "GREEN_RED", "Green to Red" ); addItem( RimRegularLegendConfig::BLUE_MAGENTA, "BLUE_MAGENTA", "Blue to Magenta" ); + addItem( RimRegularLegendConfig::CORRELATION, "CORRELATION", "Correlation colors" ); addItem( RimRegularLegendConfig::UNDEFINED, "UNDEFINED", "Undefined" ); setDefault( RimRegularLegendConfig::UNDEFINED ); } @@ -928,6 +929,9 @@ cvf::Color3ubArray RimRegularLegendConfig::colorArrayFromColorType( ColorRangesT case RimRegularLegendConfig::STIMPLAN: return RiaColorTables::stimPlanPaletteColors().color3ubArray(); break; + case RimRegularLegendConfig::CORRELATION: + return RiaColorTables::correlationPaletteColors().color3ubArray(); + break; default: if ( ColorManager::isEnsembleColorRange( colorType ) ) return ColorManager::EnsembleColorRanges().at( colorType ); diff --git a/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.h b/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.h index 397729f1e0..989ce41e94 100644 --- a/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.h +++ b/ApplicationCode/ProjectDataModel/RimRegularLegendConfig.h @@ -86,6 +86,9 @@ public: RED_LIGHT_DARK, GREEN_LIGHT_DARK, BLUE_LIGHT_DARK, + + CORRELATION, + UNDEFINED };