mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6237 Implement creation of correlation plot from ensemble plots
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "RimCorrelationPlot.h"
|
||||
#include "RimCorrelationPlotCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimSummaryPlot.h"
|
||||
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
|
||||
@@ -44,6 +46,10 @@ bool RicNewCorrelationPlotFeature::isCommandEnabled()
|
||||
|
||||
if ( correlationPlotColl ) return true;
|
||||
|
||||
RimSummaryPlot* summaryPlot = nullptr;
|
||||
selObj->firstAncestorOrThisOfType( summaryPlot );
|
||||
if ( summaryPlot ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -60,9 +66,34 @@ void RicNewCorrelationPlotFeature::onActionTriggered( bool isChecked )
|
||||
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
||||
}
|
||||
|
||||
if ( !correlationPlotColl ) return;
|
||||
RimSummaryCaseCollection* ensemble = nullptr;
|
||||
QString quantityName;
|
||||
std::time_t timeStep = 0;
|
||||
|
||||
RimCorrelationPlot* newPlot = nullptr;
|
||||
if ( !correlationPlotColl )
|
||||
{
|
||||
QVariant userData = this->userData();
|
||||
if ( !userData.isNull() && userData.canConvert<CorrelationPlotParams>() )
|
||||
{
|
||||
std::vector<RimCorrelationPlotCollection*> correlationPlotCollections;
|
||||
RimProject::current()->descendantsOfType( correlationPlotCollections );
|
||||
CAF_ASSERT( !correlationPlotCollections.empty() );
|
||||
correlationPlotColl = correlationPlotCollections.front();
|
||||
|
||||
CorrelationPlotParams params = userData.value<CorrelationPlotParams>();
|
||||
ensemble = params.ensemble;
|
||||
quantityName = params.quantityName;
|
||||
timeStep = params.timeStep;
|
||||
|
||||
newPlot = correlationPlotColl->createCorrelationPlot( ensemble, quantityName, timeStep );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newPlot = correlationPlotColl->createCorrelationPlot();
|
||||
}
|
||||
|
||||
auto newPlot = correlationPlotColl->createCorrelationPlot();
|
||||
newPlot->loadDataAndUpdate();
|
||||
|
||||
correlationPlotColl->updateConnectedEditors();
|
||||
@@ -79,3 +110,27 @@ void RicNewCorrelationPlotFeature::setupActionLook( QAction* actionToSetup )
|
||||
actionToSetup->setText( "New Correlation Tornado Plot" );
|
||||
actionToSetup->setIcon( QIcon( ":/CorrelationTornadoPlot16x16.png" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CorrelationPlotParams::CorrelationPlotParams()
|
||||
: ensemble( nullptr )
|
||||
, quantityName( "" )
|
||||
, ensembleParameter( "" )
|
||||
, timeStep( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
CorrelationPlotParams::CorrelationPlotParams( RimSummaryCaseCollection* ensemble,
|
||||
const QString& quantityName,
|
||||
const std::time_t& timeStep )
|
||||
: ensemble( ensemble )
|
||||
, quantityName( quantityName )
|
||||
, ensembleParameter( "" )
|
||||
, timeStep( timeStep )
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user