diff --git a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp index 7ea8385610..f350b387b9 100644 --- a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp +++ b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp @@ -80,7 +80,7 @@ public: } public: - EnsembleParameter parameter; + QString parameter; RiaSummaryCurveDefinition curveDef; }; @@ -140,8 +140,8 @@ public: double m_correlationAbsSum; }; -using CorrelationMatrixColumn = CorrelationMatrixRowOrColumn; -using CorrelationMatrixRow = CorrelationMatrixRowOrColumn; +using CorrelationMatrixColumn = CorrelationMatrixRowOrColumn; +using CorrelationMatrixRow = CorrelationMatrixRowOrColumn; //-------------------------------------------------------------------------------------------------- /// @@ -493,12 +493,12 @@ void RimCorrelationMatrixPlot::createMatrix() auto curveDefs = curveDefinitions(); if ( curveDefs.empty() ) return; + QStringList ensembleNames; + std::vector correlationMatrixColumns; for ( QString paramName : m_selectedParametersList() ) { - EnsembleParameter parameter; - bool anyValidResults = false; std::vector correlations; std::vector selectedCurveDefs; @@ -513,10 +513,7 @@ void RimCorrelationMatrixPlot::createMatrix() std::vector caseValuesAtTimestep; std::vector parameterValues; - if ( !parameter.isValid() ) - { - parameter = ensemble->ensembleParameter( paramName ); - } + EnsembleParameter parameter = ensemble->ensembleParameter( paramName ); if ( parameter.isValid() ) { @@ -572,12 +569,13 @@ void RimCorrelationMatrixPlot::createMatrix() } correlations.push_back( correlation ); selectedCurveDefs.push_back( curveDef ); + ensembleNames.push_back( ensemble->name() ); } } } if ( anyValidResults ) { - correlationMatrixColumns.push_back( CorrelationMatrixColumn( parameter, correlations, selectedCurveDefs ) ); + correlationMatrixColumns.push_back( CorrelationMatrixColumn( paramName, correlations, selectedCurveDefs ) ); } } @@ -606,13 +604,16 @@ void RimCorrelationMatrixPlot::createMatrix() } } + ensembleNames.removeDuplicates(); + QString combinedEnsembleNames = ensembleNames.join( ";; " ); for ( size_t rowIdx = 0u; rowIdx < correlationMatrixRows.size(); ++rowIdx ) { for ( size_t colIdx = 0u; colIdx < correlationMatrixRows[rowIdx].m_correlations.size(); ++colIdx ) { - double correlation = correlationMatrixRows[rowIdx].m_correlations[colIdx]; - auto label = QString( "%1" ).arg( correlation, 0, 'f', 2 ); - cvf::Color3ub color = m_legendConfig->scalarMapper()->mapToColor( correlation ); + double correlation = correlationMatrixRows[rowIdx].m_correlations[colIdx]; + auto label = QString( "%1" ).arg( correlation, 0, 'f', 2 ); + + cvf::Color3ub color = m_legendConfig->scalarMapper()->mapToColor( correlation ); QColor qColor( color.r(), color.g(), color.b() ); auto rectangle = RiuQwtPlotTools::createBoxShapeT( label, (double)colIdx, @@ -634,9 +635,15 @@ void RimCorrelationMatrixPlot::createMatrix() marker->setYValue( rowIdx + 0.5 ); rectangle->attach( m_plotWidget ); marker->attach( m_plotWidget ); - m_paramLabels[colIdx] = correlationMatrixRows[rowIdx].m_values[colIdx].name; + + m_paramLabels[colIdx] = correlationMatrixRows[rowIdx].m_values[colIdx]; } - m_resultLabels[rowIdx] = correlationMatrixRows[rowIdx].m_key.curveDefinitionText(); + // Remove ensemble name from label if we only have one ensemble + // If we have multiple ensembles, no labels contain the combined ensemble names. + QString resultLabel = correlationMatrixRows[rowIdx].m_key.curveDefinitionText(); + resultLabel.remove( combinedEnsembleNames + ", " ); + + m_resultLabels[rowIdx] = resultLabel; } } diff --git a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h index c55de64170..ce1ee2d355 100644 --- a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h +++ b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h @@ -62,7 +62,7 @@ public: int topNFilterCount() const; signals: - void matrixCellSelected( const EnsembleParameter&, const RiaSummaryCurveDefinition& ); + void matrixCellSelected( const QString&, const RiaSummaryCurveDefinition& ); private: // Overridden PDM methods diff --git a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp index dc32964927..e6ab8175fa 100644 --- a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp @@ -340,10 +340,14 @@ void RimCorrelationPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chart //-------------------------------------------------------------------------------------------------- void RimCorrelationPlot::updatePlotTitle() { - if ( m_useAutoPlotTitle ) + if ( m_useAutoPlotTitle && !ensembles().empty() ) { - m_description = - QString( "%1 for %2 at %3" ).arg( m_correlationFactor().uiText() ).arg( m_selectedVarsUiField ).arg( timeStepString() ); + auto ensemble = *ensembles().begin(); + m_description = QString( "%1 for %2, %3 at %4" ) + .arg( m_correlationFactor().uiText() ) + .arg( ensemble->name() ) + .arg( m_selectedVarsUiField ) + .arg( timeStepString() ); } m_plotWidget->setPlotTitle( m_description ); m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() ); @@ -368,7 +372,7 @@ void RimCorrelationPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, { if ( barTitle.text() == param.name ) { - emit tornadoItemSelected( param, curveDef ); + emit tornadoItemSelected( param.name, curveDef ); } } } diff --git a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h index 6175c75852..ce08884c8b 100644 --- a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h +++ b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h @@ -64,7 +64,7 @@ public: void setTopNFilterCount( int filterCount ); signals: - void tornadoItemSelected( const EnsembleParameter&, const RiaSummaryCurveDefinition& curveDef ); + void tornadoItemSelected( const QString&, const RiaSummaryCurveDefinition& curveDef ); private: // Overridden PDM methods diff --git a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp index 65d246ee85..ddfc03fe85 100644 --- a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp +++ b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp @@ -89,12 +89,12 @@ RimCorrelationReportPlot::RimCorrelationReportPlot() this->uiCapability()->setUiTreeChildrenHidden( true ); this->connect( m_correlationMatrixPlot(), - SIGNAL( matrixCellSelected( const EnsembleParameter&, const RiaSummaryCurveDefinition& ) ), - SLOT( onDataSelection( const EnsembleParameter&, const RiaSummaryCurveDefinition& ) ) ); + SIGNAL( matrixCellSelected( const QString&, const RiaSummaryCurveDefinition& ) ), + SLOT( onDataSelection( const QString&, const RiaSummaryCurveDefinition& ) ) ); this->connect( m_correlationPlot(), - SIGNAL( tornadoItemSelected( const EnsembleParameter&, const RiaSummaryCurveDefinition& ) ), - SLOT( onDataSelection( const EnsembleParameter&, const RiaSummaryCurveDefinition& ) ) ); + SIGNAL( tornadoItemSelected( const QString&, const RiaSummaryCurveDefinition& ) ), + SLOT( onDataSelection( const QString&, const RiaSummaryCurveDefinition& ) ) ); } //-------------------------------------------------------------------------------------------------- @@ -405,12 +405,12 @@ QList //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimCorrelationReportPlot::onDataSelection( const EnsembleParameter& param, const RiaSummaryCurveDefinition& curveDef ) +void RimCorrelationReportPlot::onDataSelection( const QString& paramName, const RiaSummaryCurveDefinition& curveDef ) { m_correlationPlot->setCurveDefinitions( {curveDef} ); m_correlationPlot->loadDataAndUpdate(); m_parameterResultCrossPlot->setCurveDefinitions( {curveDef} ); - m_parameterResultCrossPlot->setEnsembleParameter( param.name ); + m_parameterResultCrossPlot->setEnsembleParameter( paramName ); m_parameterResultCrossPlot->loadDataAndUpdate(); if ( m_viewer ) { diff --git a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.h b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.h index cd63abf9d4..d75e7985a0 100644 --- a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.h +++ b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.h @@ -79,7 +79,7 @@ private: QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) override; private slots: - void onDataSelection( const EnsembleParameter& param, const RiaSummaryCurveDefinition& curveDef ); + void onDataSelection( const QString& paramName, const RiaSummaryCurveDefinition& curveDef ); private: caf::PdmProxyValueField m_plotWindowTitle; diff --git a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp index e1d00cf9b7..03986112c9 100644 --- a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp +++ b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp @@ -300,10 +300,14 @@ void RimParameterResultCrossPlot::createPoints() //-------------------------------------------------------------------------------------------------- void RimParameterResultCrossPlot::updatePlotTitle() { - if ( m_useAutoPlotTitle ) + if ( m_useAutoPlotTitle && !ensembles().empty() ) { - m_description = - QString( "Cross Plot %1 x %2 at %3" ).arg( m_ensembleParameter ).arg( m_selectedVarsUiField ).arg( timeStepString() ); + auto ensemble = *ensembles().begin(); + m_description = QString( "Cross Plot %1, %2 x %3 at %4" ) + .arg( ensemble->name() ) + .arg( m_ensembleParameter ) + .arg( m_selectedVarsUiField ) + .arg( timeStepString() ); } m_plotWidget->setPlotTitle( m_description ); m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && isMdiWindow() );