diff --git a/ApplicationCode/Commands/AnalysisPlotCommands/RicNewAnalysisPlotFeature.cpp b/ApplicationCode/Commands/AnalysisPlotCommands/RicNewAnalysisPlotFeature.cpp index 85d91593a4..6e47b88ffa 100644 --- a/ApplicationCode/Commands/AnalysisPlotCommands/RicNewAnalysisPlotFeature.cpp +++ b/ApplicationCode/Commands/AnalysisPlotCommands/RicNewAnalysisPlotFeature.cpp @@ -85,7 +85,7 @@ void RicNewAnalysisPlotFeature::onActionTriggered( bool isChecked ) EnsemblePlotParams params = userData.value(); ensemble = params.ensemble; - quantityName = params.quantityName; + quantityName = params.mainQuantityName; timeStep = params.timeStep; newPlot = analysisPlotColl->createAnalysisPlot( ensemble, quantityName, timeStep ); diff --git a/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationMatrixPlotFeature.cpp b/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationMatrixPlotFeature.cpp index 2aeec20747..c3d609f043 100644 --- a/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationMatrixPlotFeature.cpp +++ b/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationMatrixPlotFeature.cpp @@ -70,6 +70,7 @@ void RicNewCorrelationMatrixPlotFeature::onActionTriggered( bool isChecked ) } RimSummaryCaseCollection* ensemble = nullptr; + std::vector includedQuantityNames; std::time_t timeStep = 0; RimCorrelationMatrixPlot* newPlot = nullptr; @@ -84,10 +85,13 @@ void RicNewCorrelationMatrixPlotFeature::onActionTriggered( bool isChecked ) correlationPlotColl = correlationPlotCollections.front(); EnsemblePlotParams params = userData.value(); - ensemble = params.ensemble; - timeStep = params.timeStep; - newPlot = correlationPlotColl->createCorrelationMatrixPlot( ensemble, timeStep ); + includedQuantityNames = + std::vector( params.includedQuantityNames.begin(), params.includedQuantityNames.end() ); + ensemble = params.ensemble; + timeStep = params.timeStep; + + newPlot = correlationPlotColl->createCorrelationMatrixPlot( ensemble, includedQuantityNames, timeStep ); } } else diff --git a/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.cpp b/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.cpp index 7735b9ebcd..41ef52cf85 100644 --- a/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.cpp +++ b/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.cpp @@ -83,7 +83,7 @@ void RicNewCorrelationPlotFeature::onActionTriggered( bool isChecked ) EnsemblePlotParams params = userData.value(); ensemble = params.ensemble; - quantityName = params.quantityName; + quantityName = params.mainQuantityName; timeStep = params.timeStep; newPlot = correlationPlotColl->createCorrelationPlot( ensemble, quantityName, timeStep ); @@ -116,7 +116,7 @@ void RicNewCorrelationPlotFeature::setupActionLook( QAction* actionToSetup ) //-------------------------------------------------------------------------------------------------- EnsemblePlotParams::EnsemblePlotParams() : ensemble( nullptr ) - , quantityName( "" ) + , mainQuantityName( "" ) , ensembleParameter( "" ) , timeStep( 0 ) { @@ -126,10 +126,12 @@ EnsemblePlotParams::EnsemblePlotParams() /// //-------------------------------------------------------------------------------------------------- EnsemblePlotParams::EnsemblePlotParams( RimSummaryCaseCollection* ensemble, - const QString& quantityName, + const QStringList& includedQuantityNames, + const QString& mainQuantityName, const std::time_t& timeStep ) : ensemble( ensemble ) - , quantityName( quantityName ) + , includedQuantityNames( includedQuantityNames ) + , mainQuantityName( mainQuantityName ) , ensembleParameter( "" ) , timeStep( timeStep ) { diff --git a/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.h b/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.h index 1e2b8780b9..72eda7591e 100644 --- a/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.h +++ b/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.h @@ -28,14 +28,18 @@ class EnsemblePlotParams { public: RimSummaryCaseCollection* ensemble; - QString quantityName; + QStringList includedQuantityNames; + QString mainQuantityName; QString ensembleParameter; std::time_t timeStep; EnsemblePlotParams(); EnsemblePlotParams( const EnsemblePlotParams& rhs ) = default; - EnsemblePlotParams( RimSummaryCaseCollection* ensemble, const QString& quantityName, const std::time_t& timeStep ); + EnsemblePlotParams( RimSummaryCaseCollection* ensemble, + const QStringList& includedQuantityNames, + const QString& mainQuantityName, + const std::time_t& timeStep ); ~EnsemblePlotParams() = default; }; diff --git a/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationReportPlotFeature.cpp b/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationReportPlotFeature.cpp index 05ce59003a..a825784fba 100644 --- a/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationReportPlotFeature.cpp +++ b/ApplicationCode/Commands/CorrelationPlotCommands/RicNewCorrelationReportPlotFeature.cpp @@ -68,7 +68,8 @@ void RicNewCorrelationReportPlotFeature::onActionTriggered( bool isChecked ) } RimSummaryCaseCollection* ensemble = nullptr; - QString quantityName; + std::vector includedQuantityNames; + QString mainQuantityName; std::time_t timeStep = 0; RimCorrelationReportPlot* newPlot = nullptr; @@ -84,10 +85,16 @@ void RicNewCorrelationReportPlotFeature::onActionTriggered( bool isChecked ) EnsemblePlotParams params = userData.value(); ensemble = params.ensemble; - quantityName = params.quantityName; - timeStep = params.timeStep; + includedQuantityNames = + std::vector( params.includedQuantityNames.begin(), params.includedQuantityNames.end() ); - newPlot = correlationPlotColl->createCorrelationReportPlot( ensemble, quantityName, timeStep ); + mainQuantityName = params.mainQuantityName; + timeStep = params.timeStep; + + newPlot = correlationPlotColl->createCorrelationReportPlot( ensemble, + includedQuantityNames, + mainQuantityName, + timeStep ); } } else diff --git a/ApplicationCode/Commands/CorrelationPlotCommands/RicNewParameterResultCrossPlotFeature.cpp b/ApplicationCode/Commands/CorrelationPlotCommands/RicNewParameterResultCrossPlotFeature.cpp index 5b687c626c..d8718baf3f 100644 --- a/ApplicationCode/Commands/CorrelationPlotCommands/RicNewParameterResultCrossPlotFeature.cpp +++ b/ApplicationCode/Commands/CorrelationPlotCommands/RicNewParameterResultCrossPlotFeature.cpp @@ -86,7 +86,7 @@ void RicNewParameterResultCrossPlotFeature::onActionTriggered( bool isChecked ) EnsemblePlotParams params = userData.value(); ensemble = params.ensemble; - quantityName = params.quantityName; + quantityName = params.mainQuantityName; ensembleParameter = params.ensembleParameter; timeStep = params.timeStep; diff --git a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp index d0dd867b88..7e21bd7150 100644 --- a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp +++ b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp @@ -56,7 +56,7 @@ RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( bool de RimCorrelationPlot* plot = new RimCorrelationPlot(); plot->setAsPlotMdiWindow(); - if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, "FOPT" ); + if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, {"FOPT"} ); plot->selectAllParameters(); m_correlationPlots.push_back( plot ); @@ -74,7 +74,7 @@ RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( RimSumm RimCorrelationPlot* plot = new RimCorrelationPlot(); plot->setAsPlotMdiWindow(); - applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityName.toStdString(), timeStep ); + applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, {quantityName}, timeStep ); plot->selectAllParameters(); m_correlationPlots.push_back( plot ); @@ -101,11 +101,12 @@ RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixP /// //-------------------------------------------------------------------------------------------------- RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixPlot( RimSummaryCaseCollection* ensemble, + const std::vector& quantityNames, std::time_t timeStep ) { RimCorrelationMatrixPlot* plot = new RimCorrelationMatrixPlot(); plot->setAsPlotMdiWindow(); - applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, "", timeStep ); + applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityNames, timeStep ); plot->selectAllParameters(); m_correlationPlots.push_back( plot ); @@ -120,7 +121,7 @@ RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResult { RimParameterResultCrossPlot* plot = new RimParameterResultCrossPlot; plot->setAsPlotMdiWindow(); - if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, "FOPT" ); + if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, {"FOPT"} ); m_correlationPlots.push_back( plot ); return plot; @@ -136,7 +137,7 @@ RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResult { RimParameterResultCrossPlot* plot = new RimParameterResultCrossPlot; plot->setAsPlotMdiWindow(); - applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityName.toStdString(), timeStep ); + applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, {quantityName}, timeStep ); plot->setEnsembleParameter( paramName ); m_correlationPlots.push_back( plot ); @@ -151,7 +152,7 @@ RimCorrelationReportPlot* { RimCorrelationReportPlot* report = new RimCorrelationReportPlot; report->setAsPlotMdiWindow(); - if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToReport( report, "FOPT" ); + if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToReport( report, {"FOPT"}, "FOPT" ); report->matrixPlot()->selectAllParameters(); report->correlationPlot()->selectAllParameters(); m_correlationReports.push_back( report ); @@ -161,13 +162,15 @@ RimCorrelationReportPlot* //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimCorrelationReportPlot* RimCorrelationPlotCollection::createCorrelationReportPlot( RimSummaryCaseCollection* ensemble, - const QString& quantityName, - std::time_t timeStep ) +RimCorrelationReportPlot* + RimCorrelationPlotCollection::createCorrelationReportPlot( RimSummaryCaseCollection* ensemble, + const std::vector& matrixQuantityNames, + const QString& tornadoAndCrossPlotQuantityName, + std::time_t timeStep ) { RimCorrelationReportPlot* report = new RimCorrelationReportPlot; report->setAsPlotMdiWindow(); - applyEnsembleFieldAndTimeStepToReport( report, ensemble, quantityName.toStdString(), timeStep ); + applyEnsembleFieldAndTimeStepToReport( report, ensemble, matrixQuantityNames, tornadoAndCrossPlotQuantityName, timeStep ); report->matrixPlot()->selectAllParameters(); report->correlationPlot()->selectAllParameters(); m_correlationReports.push_back( report ); @@ -211,7 +214,7 @@ void RimCorrelationPlotCollection::deleteAllChildObjects() /// //-------------------------------------------------------------------------------------------------- void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToPlot( RimAbstractCorrelationPlot* plot, - const std::string& quantityName /*= "FOPT" */ ) + const std::vector& quantityNames /*= {} */ ) { std::vector ensembles; RimProject::current()->descendantsIncludingThisOfType( ensembles ); @@ -221,12 +224,10 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToPlot( RimAb std::vector curveDefs; for ( auto address : allAddresses ) { - if ( address.category() == RifEclipseSummaryAddress::SUMMARY_FIELD ) + auto it = std::find( quantityNames.begin(), quantityNames.end(), QString::fromStdString( address.uiText() ) ); + if ( it != quantityNames.end() || quantityNames.empty() ) { - if ( quantityName.empty() || quantityName == address.quantityName() ) - { - curveDefs.push_back( RiaSummaryCurveDefinition( nullptr, address, ensembles.front() ) ); - } + curveDefs.push_back( RiaSummaryCurveDefinition( nullptr, address, ensembles.front() ) ); } } plot->setCurveDefinitions( curveDefs ); @@ -244,7 +245,7 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToPlot( RimAb //-------------------------------------------------------------------------------------------------- void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAbstractCorrelationPlot* plot, RimSummaryCaseCollection* ensemble, - const std::string& quantityName, + const std::vector& quantityNames, std::time_t timeStep ) { if ( ensemble ) @@ -253,12 +254,10 @@ void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAbstr std::vector curveDefs; for ( auto address : allAddresses ) { - if ( address.category() == RifEclipseSummaryAddress::SUMMARY_FIELD ) + auto it = std::find( quantityNames.begin(), quantityNames.end(), QString::fromStdString( address.uiText() ) ); + if ( it != quantityNames.end() || quantityNames.empty() ) { - if ( quantityName.empty() || quantityName == address.quantityName() ) - { - curveDefs.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) ); - } + curveDefs.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) ); } } plot->setCurveDefinitions( curveDefs ); @@ -270,7 +269,8 @@ void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAbstr /// //-------------------------------------------------------------------------------------------------- void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToReport( RimCorrelationReportPlot* plot, - const std::string& quantityName /*= "" */ ) + const std::vector& matrixQuantityNames, + const QString& tornadoAndCrossPlotQuantityName ) { std::vector ensembles; RimProject::current()->descendantsIncludingThisOfType( ensembles ); @@ -281,16 +281,21 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToReport( Rim std::vector curveDefsTornadoAndCrossPlot; for ( auto address : allAddresses ) { - if ( address.category() == RifEclipseSummaryAddress::SUMMARY_FIELD ) + auto it = std::find( matrixQuantityNames.begin(), + matrixQuantityNames.end(), + QString::fromStdString( address.uiText() ) ); + if ( it != matrixQuantityNames.end() || matrixQuantityNames.empty() ) { curveDefsMatrix.push_back( RiaSummaryCurveDefinition( nullptr, address, ensembles.front() ) ); - if ( quantityName.empty() || quantityName == address.quantityName() ) - { - curveDefsTornadoAndCrossPlot.push_back( - RiaSummaryCurveDefinition( nullptr, address, ensembles.front() ) ); - } + } + + if ( tornadoAndCrossPlotQuantityName.isEmpty() || + tornadoAndCrossPlotQuantityName == QString::fromStdString( address.uiText() ) ) + { + curveDefsTornadoAndCrossPlot.push_back( RiaSummaryCurveDefinition( nullptr, address, ensembles.front() ) ); } } + plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix ); plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot ); plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot ); @@ -301,10 +306,11 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToReport( Rim //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToReport( RimCorrelationReportPlot* plot, - RimSummaryCaseCollection* ensemble, - const std::string& quantityName, - std::time_t timeStep ) +void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToReport( RimCorrelationReportPlot* plot, + RimSummaryCaseCollection* ensemble, + const std::vector& matrixQuantityNames, + const QString& tornadoAndCrossPlotQuantityName, + std::time_t timeStep ) { if ( ensemble ) { @@ -313,13 +319,18 @@ void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToReport( RimCor std::vector curveDefsTornadoAndCrossPlot; for ( auto address : allAddresses ) { - if ( address.category() == RifEclipseSummaryAddress::SUMMARY_FIELD ) + auto it = std::find( matrixQuantityNames.begin(), + matrixQuantityNames.end(), + QString::fromStdString( address.uiText() ) ); + if ( it != matrixQuantityNames.end() || matrixQuantityNames.empty() ) { curveDefsMatrix.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) ); - if ( quantityName.empty() || quantityName == address.quantityName() ) - { - curveDefsTornadoAndCrossPlot.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) ); - } + } + + if ( tornadoAndCrossPlotQuantityName.isEmpty() || + tornadoAndCrossPlotQuantityName == QString::fromStdString( address.uiText() ) ) + { + curveDefsTornadoAndCrossPlot.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) ); } } plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix ); diff --git a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.h b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.h index 63d55c4b68..e4a29fa5ec 100644 --- a/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.h +++ b/ApplicationCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.h @@ -22,6 +22,7 @@ #include "cafPdmObject.h" #include +#include class RimAbstractCorrelationPlot; class RimCorrelationPlot; @@ -47,7 +48,9 @@ public: createCorrelationPlot( RimSummaryCaseCollection* ensemble, const QString& quantityName, std::time_t timeStep ); RimCorrelationMatrixPlot* createCorrelationMatrixPlot( bool defaultToFirstEnsembleField = true ); - RimCorrelationMatrixPlot* createCorrelationMatrixPlot( RimSummaryCaseCollection* ensemble, std::time_t timeStep ); + RimCorrelationMatrixPlot* createCorrelationMatrixPlot( RimSummaryCaseCollection* ensemble, + const std::vector& quantityNames, + std::time_t timeStep ); RimParameterResultCrossPlot* createParameterResultCrossPlot( bool defaultToFirstEnsembleFopt = true ); RimParameterResultCrossPlot* createParameterResultCrossPlot( RimSummaryCaseCollection* ensemble, @@ -56,9 +59,10 @@ public: std::time_t timeStep ); RimCorrelationReportPlot* createCorrelationReportPlot( bool defaultToFirstEnsembleFopt = true ); - RimCorrelationReportPlot* createCorrelationReportPlot( RimSummaryCaseCollection* ensemble, - const QString& quantityName, - std::time_t timeStep ); + RimCorrelationReportPlot* createCorrelationReportPlot( RimSummaryCaseCollection* ensemble, + const std::vector& matrixQuantityNames, + const QString& tornadoAndCrossPlotQuantityName, + std::time_t timeStep ); void removePlot( RimAbstractCorrelationPlot* correlationPlot ); void removeReport( RimCorrelationReportPlot* correlationReport ); @@ -69,16 +73,20 @@ public: void deleteAllChildObjects(); private: - void applyFirstEnsembleFieldAddressesToPlot( RimAbstractCorrelationPlot* plot, const std::string& quantityName = "" ); + void applyFirstEnsembleFieldAddressesToPlot( RimAbstractCorrelationPlot* plot, + const std::vector& quantityNames = {} ); void applyEnsembleFieldAndTimeStepToPlot( RimAbstractCorrelationPlot* plot, RimSummaryCaseCollection* ensemble, - const std::string& quantityName, + const std::vector& quantityNames, std::time_t timeStep ); - void applyFirstEnsembleFieldAddressesToReport( RimCorrelationReportPlot* plot, const std::string& quantityName = "" ); - void applyEnsembleFieldAndTimeStepToReport( RimCorrelationReportPlot* plot, - RimSummaryCaseCollection* ensemble, - const std::string& quantityName, - std::time_t timeStep ); + void applyFirstEnsembleFieldAddressesToReport( RimCorrelationReportPlot* plot, + const std::vector& matrixQuantityNames, + const QString& tornadoAndCrossPlotQuantityName ); + void applyEnsembleFieldAndTimeStepToReport( RimCorrelationReportPlot* plot, + RimSummaryCaseCollection* ensemble, + const std::vector& matrixQuantityNames, + const QString& tornadoAndCrossPlotQuantityName, + std::time_t timeStep ); private: caf::PdmChildArrayField m_correlationPlots; diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index 3935e10099..16c3417880 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -961,7 +961,7 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, //-------------------------------------------------------------------------------------------------- void RimWellPltPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) { - uiTreeOrdering.skipRemainingChildren( true ); + // uiTreeOrdering.skipRemainingChildren( true ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp index 96097be823..979dfe5430 100644 --- a/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -199,18 +199,42 @@ void RiuSummaryQwtPlot::contextMenuEvent( QContextMenuEvent* event ) { std::time_t timeStep = summaryCurve->timeStepsY()[closestCurvePoint]; - RimEnsembleCurveSet* ensembleCurveSet = nullptr; - summaryCurve->firstAncestorOrThisOfType( ensembleCurveSet ); + RimSummaryCaseCollection* ensemble = nullptr; + QString clickedQuantityName; + QStringList allQuantityNamesInPlot; - if ( ensembleCurveSet ) + RimEnsembleCurveSet* clickedEnsembleCurveSet = nullptr; + summaryCurve->firstAncestorOrThisOfType( clickedEnsembleCurveSet ); + + if ( clickedEnsembleCurveSet ) { - RimSummaryCaseCollection* ensemble = ensembleCurveSet->summaryCaseCollection(); + ensemble = clickedEnsembleCurveSet->summaryCaseCollection(); if ( ensemble && ensemble->isEnsemble() ) { - EnsemblePlotParams params( ensemble, - QString::fromStdString( - ensembleCurveSet->summaryAddress().quantityName() ), - timeStep ); + clickedQuantityName = QString::fromStdString( clickedEnsembleCurveSet->summaryAddress().uiText() ); + } + } + + if ( distanceFromClick > 20 ) + { + RimSummaryPlot* summaryPlot = static_cast( plotDefinition() ); + std::vector allCurveSetsInPlot; + summaryPlot->descendantsOfType( allCurveSetsInPlot ); + for ( auto curveSet : allCurveSetsInPlot ) + { + allQuantityNamesInPlot.push_back( QString::fromStdString( curveSet->summaryAddress().uiText() ) ); + } + } + else + { + allQuantityNamesInPlot.push_back( clickedQuantityName ); + } + + if ( !clickedQuantityName.isEmpty() || !allQuantityNamesInPlot.isEmpty() ) + { + if ( ensemble && ensemble->isEnsemble() ) + { + EnsemblePlotParams params( ensemble, allQuantityNamesInPlot, clickedQuantityName, timeStep ); QVariant variant = QVariant::fromValue( params ); menuBuilder.addCmdFeatureWithUserData( "RicNewAnalysisPlotFeature", "New Analysis Plot", variant ); @@ -218,32 +242,38 @@ void RiuSummaryQwtPlot::contextMenuEvent( QContextMenuEvent* event ) menuBuilder.subMenuStart( "Create Correlation Plot From Curve Point", *caf::IconProvider( ":/CorrelationPlots16x16.png" ).icon() ); { - menuBuilder.addCmdFeatureWithUserData( "RicNewCorrelationPlotFeature", - "New Tornado Plot", - variant ); + if ( !clickedQuantityName.isEmpty() ) + { + menuBuilder.addCmdFeatureWithUserData( "RicNewCorrelationPlotFeature", + "New Tornado Plot", + variant ); + } menuBuilder.addCmdFeatureWithUserData( "RicNewCorrelationMatrixPlotFeature", "New Matrix Plot", variant ); menuBuilder.addCmdFeatureWithUserData( "RicNewCorrelationReportPlotFeature", "New Report Plot", variant ); - menuBuilder.subMenuStart( "Cross Plots", - *caf::IconProvider( ":/CorrelationCrossPlot16x16.png" ).icon() ); - std::vector ensembleParameters = - ensemble->variationSortedEnsembleParameters(); - for ( const EnsembleParameter& param : ensembleParameters ) + if ( !clickedQuantityName.isEmpty() ) { - if ( param.variationBin >= (int)EnsembleParameter::LOW_VARIATION ) + menuBuilder.subMenuStart( "Cross Plots", + *caf::IconProvider( ":/CorrelationCrossPlot16x16.png" ).icon() ); + std::vector ensembleParameters = + ensemble->variationSortedEnsembleParameters(); + for ( const EnsembleParameter& param : ensembleParameters ) { - params.ensembleParameter = param.name; - variant = QVariant::fromValue( params ); - menuBuilder.addCmdFeatureWithUserData( "RicNewParameterResultCrossPlotFeature", - QString( "New Cross Plot Against %1" ) - .arg( param.uiName() ), - variant ); + if ( param.variationBin >= (int)EnsembleParameter::LOW_VARIATION ) + { + params.ensembleParameter = param.name; + variant = QVariant::fromValue( params ); + menuBuilder.addCmdFeatureWithUserData( "RicNewParameterResultCrossPlotFeature", + QString( "New Cross Plot Against %1" ) + .arg( param.uiName() ), + variant ); + } } + menuBuilder.subMenuEnd(); } - menuBuilder.subMenuEnd(); } menuBuilder.subMenuEnd(); }