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:
parent
447d335fc8
commit
aeecaa3ff1
@ -18,9 +18,13 @@
|
|||||||
|
|
||||||
#include "RicNewCorrelationMatrixPlotFeature.h"
|
#include "RicNewCorrelationMatrixPlotFeature.h"
|
||||||
|
|
||||||
|
#include "RicNewCorrelationPlotFeature.h"
|
||||||
|
|
||||||
#include "RimCorrelationMatrixPlot.h"
|
#include "RimCorrelationMatrixPlot.h"
|
||||||
#include "RimCorrelationPlot.h"
|
#include "RimCorrelationPlot.h"
|
||||||
#include "RimCorrelationPlotCollection.h"
|
#include "RimCorrelationPlotCollection.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
|
||||||
#include "RiuPlotMainWindowTools.h"
|
#include "RiuPlotMainWindowTools.h"
|
||||||
|
|
||||||
@ -45,6 +49,10 @@ bool RicNewCorrelationMatrixPlotFeature::isCommandEnabled()
|
|||||||
|
|
||||||
if ( correlationPlotColl ) return true;
|
if ( correlationPlotColl ) return true;
|
||||||
|
|
||||||
|
RimSummaryPlot* summaryPlot = nullptr;
|
||||||
|
selObj->firstAncestorOrThisOfType( summaryPlot );
|
||||||
|
if ( summaryPlot ) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,9 +69,32 @@ void RicNewCorrelationMatrixPlotFeature::onActionTriggered( bool isChecked )
|
|||||||
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !correlationPlotColl ) return;
|
RimSummaryCaseCollection* ensemble = nullptr;
|
||||||
|
std::time_t timeStep = 0;
|
||||||
|
|
||||||
|
RimCorrelationMatrixPlot* 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;
|
||||||
|
timeStep = params.timeStep;
|
||||||
|
|
||||||
|
newPlot = correlationPlotColl->createCorrelationMatrixPlot( ensemble, timeStep );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newPlot = correlationPlotColl->createCorrelationMatrixPlot();
|
||||||
|
}
|
||||||
|
|
||||||
auto newPlot = correlationPlotColl->createCorrelationMatrixPlot();
|
|
||||||
newPlot->loadDataAndUpdate();
|
newPlot->loadDataAndUpdate();
|
||||||
|
|
||||||
correlationPlotColl->updateConnectedEditors();
|
correlationPlotColl->updateConnectedEditors();
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include "RimCorrelationPlot.h"
|
#include "RimCorrelationPlot.h"
|
||||||
#include "RimCorrelationPlotCollection.h"
|
#include "RimCorrelationPlotCollection.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
|
||||||
#include "RiuPlotMainWindowTools.h"
|
#include "RiuPlotMainWindowTools.h"
|
||||||
|
|
||||||
@ -44,6 +46,10 @@ bool RicNewCorrelationPlotFeature::isCommandEnabled()
|
|||||||
|
|
||||||
if ( correlationPlotColl ) return true;
|
if ( correlationPlotColl ) return true;
|
||||||
|
|
||||||
|
RimSummaryPlot* summaryPlot = nullptr;
|
||||||
|
selObj->firstAncestorOrThisOfType( summaryPlot );
|
||||||
|
if ( summaryPlot ) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,9 +66,34 @@ void RicNewCorrelationPlotFeature::onActionTriggered( bool isChecked )
|
|||||||
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
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();
|
newPlot->loadDataAndUpdate();
|
||||||
|
|
||||||
correlationPlotColl->updateConnectedEditors();
|
correlationPlotColl->updateConnectedEditors();
|
||||||
@ -79,3 +110,27 @@ void RicNewCorrelationPlotFeature::setupActionLook( QAction* actionToSetup )
|
|||||||
actionToSetup->setText( "New Correlation Tornado Plot" );
|
actionToSetup->setText( "New Correlation Tornado Plot" );
|
||||||
actionToSetup->setIcon( QIcon( ":/CorrelationTornadoPlot16x16.png" ) );
|
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 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -20,6 +20,27 @@
|
|||||||
|
|
||||||
#include "cafCmdFeature.h"
|
#include "cafCmdFeature.h"
|
||||||
|
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
|
class RimSummaryCaseCollection;
|
||||||
|
|
||||||
|
class CorrelationPlotParams
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RimSummaryCaseCollection* ensemble;
|
||||||
|
QString quantityName;
|
||||||
|
QString ensembleParameter;
|
||||||
|
std::time_t timeStep;
|
||||||
|
|
||||||
|
CorrelationPlotParams();
|
||||||
|
CorrelationPlotParams( const CorrelationPlotParams& rhs ) = default;
|
||||||
|
|
||||||
|
CorrelationPlotParams( RimSummaryCaseCollection* ensemble, const QString& quantityName, const std::time_t& timeStep );
|
||||||
|
~CorrelationPlotParams() = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE( CorrelationPlotParams );
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
@ -17,9 +17,12 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "RicNewCorrelationReportPlotFeature.h"
|
#include "RicNewCorrelationReportPlotFeature.h"
|
||||||
|
#include "RicNewCorrelationPlotFeature.h"
|
||||||
|
|
||||||
#include "RimCorrelationPlotCollection.h"
|
#include "RimCorrelationPlotCollection.h"
|
||||||
#include "RimCorrelationReportPlot.h"
|
#include "RimCorrelationReportPlot.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
|
||||||
#include "RiuPlotMainWindowTools.h"
|
#include "RiuPlotMainWindowTools.h"
|
||||||
|
|
||||||
@ -44,6 +47,10 @@ bool RicNewCorrelationReportPlotFeature::isCommandEnabled()
|
|||||||
|
|
||||||
if ( correlationPlotColl ) return true;
|
if ( correlationPlotColl ) return true;
|
||||||
|
|
||||||
|
RimSummaryPlot* summaryPlot = nullptr;
|
||||||
|
selObj->firstAncestorOrThisOfType( summaryPlot );
|
||||||
|
if ( summaryPlot ) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,9 +67,33 @@ void RicNewCorrelationReportPlotFeature::onActionTriggered( bool isChecked )
|
|||||||
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !correlationPlotColl ) return;
|
RimSummaryCaseCollection* ensemble = nullptr;
|
||||||
|
QString quantityName;
|
||||||
|
std::time_t timeStep = 0;
|
||||||
|
|
||||||
auto newPlot = correlationPlotColl->createCorrelationReportPlot();
|
RimCorrelationReportPlot* 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->createCorrelationReportPlot( ensemble, quantityName, timeStep );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newPlot = correlationPlotColl->createCorrelationReportPlot();
|
||||||
|
}
|
||||||
newPlot->loadDataAndUpdate();
|
newPlot->loadDataAndUpdate();
|
||||||
|
|
||||||
correlationPlotColl->updateConnectedEditors();
|
correlationPlotColl->updateConnectedEditors();
|
||||||
|
@ -18,8 +18,12 @@
|
|||||||
|
|
||||||
#include "RicNewParameterResultCrossPlotFeature.h"
|
#include "RicNewParameterResultCrossPlotFeature.h"
|
||||||
|
|
||||||
|
#include "RicNewCorrelationPlotFeature.h"
|
||||||
|
|
||||||
#include "RimCorrelationPlotCollection.h"
|
#include "RimCorrelationPlotCollection.h"
|
||||||
#include "RimParameterResultCrossPlot.h"
|
#include "RimParameterResultCrossPlot.h"
|
||||||
|
#include "RimProject.h"
|
||||||
|
#include "RimSummaryPlot.h"
|
||||||
|
|
||||||
#include "RiuPlotMainWindowTools.h"
|
#include "RiuPlotMainWindowTools.h"
|
||||||
|
|
||||||
@ -44,6 +48,10 @@ bool RicNewParameterResultCrossPlotFeature::isCommandEnabled()
|
|||||||
|
|
||||||
if ( correlationPlotColl ) return true;
|
if ( correlationPlotColl ) return true;
|
||||||
|
|
||||||
|
RimSummaryPlot* summaryPlot = nullptr;
|
||||||
|
selObj->firstAncestorOrThisOfType( summaryPlot );
|
||||||
|
if ( summaryPlot ) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,9 +68,38 @@ void RicNewParameterResultCrossPlotFeature::onActionTriggered( bool isChecked )
|
|||||||
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
selObj->firstAncestorOrThisOfType( correlationPlotColl );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !correlationPlotColl ) return;
|
RimSummaryCaseCollection* ensemble = nullptr;
|
||||||
|
QString quantityName;
|
||||||
|
QString ensembleParameter;
|
||||||
|
std::time_t timeStep = 0;
|
||||||
|
|
||||||
|
RimParameterResultCrossPlot* 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;
|
||||||
|
ensembleParameter = params.ensembleParameter;
|
||||||
|
|
||||||
|
timeStep = params.timeStep;
|
||||||
|
|
||||||
|
newPlot =
|
||||||
|
correlationPlotColl->createParameterResultCrossPlot( ensemble, ensembleParameter, quantityName, timeStep );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newPlot = correlationPlotColl->createParameterResultCrossPlot();
|
||||||
|
}
|
||||||
|
|
||||||
auto newPlot = correlationPlotColl->createParameterResultCrossPlot();
|
|
||||||
newPlot->loadDataAndUpdate();
|
newPlot->loadDataAndUpdate();
|
||||||
|
|
||||||
correlationPlotColl->updateConnectedEditors();
|
correlationPlotColl->updateConnectedEditors();
|
||||||
|
@ -80,12 +80,20 @@ void RimAbstractCorrelationPlot::setCurveDefinitions( const std::vector<RiaSumma
|
|||||||
m_analysisPlotDataSelection.push_back( dataEntry );
|
m_analysisPlotDataSelection.push_back( dataEntry );
|
||||||
}
|
}
|
||||||
auto timeSteps = allAvailableTimeSteps();
|
auto timeSteps = allAvailableTimeSteps();
|
||||||
if ( !timeSteps.empty() )
|
if ( m_timeStep().isNull() && !timeSteps.empty() )
|
||||||
{
|
{
|
||||||
m_timeStep = QDateTime::fromTime_t( *timeSteps.rbegin() );
|
m_timeStep = QDateTime::fromTime_t( *timeSteps.rbegin() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimAbstractCorrelationPlot::setTimeStep( std::time_t timeStep )
|
||||||
|
{
|
||||||
|
m_timeStep = QDateTime::fromTime_t( timeStep );
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
class RiaSummaryCurveDefinition;
|
class RiaSummaryCurveDefinition;
|
||||||
class RiaSummaryCurveDefinitionAnalyser;
|
class RiaSummaryCurveDefinitionAnalyser;
|
||||||
class RimAnalysisPlotDataEntry;
|
class RimAnalysisPlotDataEntry;
|
||||||
@ -43,6 +45,7 @@ public:
|
|||||||
public:
|
public:
|
||||||
std::vector<RiaSummaryCurveDefinition> curveDefinitions() const;
|
std::vector<RiaSummaryCurveDefinition> curveDefinitions() const;
|
||||||
void setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions );
|
void setCurveDefinitions( const std::vector<RiaSummaryCurveDefinition>& curveDefinitions );
|
||||||
|
void setTimeStep( std::time_t timeStep );
|
||||||
std::set<RimSummaryCaseCollection*> ensembles();
|
std::set<RimSummaryCaseCollection*> ensembles();
|
||||||
RiuQwtPlotWidget* viewer() override;
|
RiuQwtPlotWidget* viewer() override;
|
||||||
void detachAllCurves() override;
|
void detachAllCurves() override;
|
||||||
|
@ -64,6 +64,24 @@ RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( bool de
|
|||||||
return plot;
|
return plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( RimSummaryCaseCollection* ensemble,
|
||||||
|
const QString& quantityName,
|
||||||
|
std::time_t timeStep )
|
||||||
|
{
|
||||||
|
RimCorrelationPlot* plot = new RimCorrelationPlot();
|
||||||
|
plot->setAsPlotMdiWindow();
|
||||||
|
|
||||||
|
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityName.toStdString(), timeStep );
|
||||||
|
plot->selectAllParameters();
|
||||||
|
|
||||||
|
m_correlationPlots.push_back( plot );
|
||||||
|
|
||||||
|
return plot;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -79,6 +97,22 @@ RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixP
|
|||||||
return plot;
|
return plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixPlot( RimSummaryCaseCollection* ensemble,
|
||||||
|
std::time_t timeStep )
|
||||||
|
{
|
||||||
|
RimCorrelationMatrixPlot* plot = new RimCorrelationMatrixPlot();
|
||||||
|
plot->setAsPlotMdiWindow();
|
||||||
|
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, "", timeStep );
|
||||||
|
plot->selectAllParameters();
|
||||||
|
|
||||||
|
m_correlationPlots.push_back( plot );
|
||||||
|
|
||||||
|
return plot;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -92,6 +126,23 @@ RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResult
|
|||||||
return plot;
|
return plot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResultCrossPlot( RimSummaryCaseCollection* ensemble,
|
||||||
|
const QString& paramName,
|
||||||
|
const QString& quantityName,
|
||||||
|
std::time_t timeStep )
|
||||||
|
{
|
||||||
|
RimParameterResultCrossPlot* plot = new RimParameterResultCrossPlot;
|
||||||
|
plot->setAsPlotMdiWindow();
|
||||||
|
applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityName.toStdString(), timeStep );
|
||||||
|
plot->setEnsembleParameter( paramName );
|
||||||
|
|
||||||
|
m_correlationPlots.push_back( plot );
|
||||||
|
return plot;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -102,6 +153,23 @@ RimCorrelationReportPlot*
|
|||||||
report->setAsPlotMdiWindow();
|
report->setAsPlotMdiWindow();
|
||||||
if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToReport( report, "FOPT" );
|
if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToReport( report, "FOPT" );
|
||||||
report->matrixPlot()->selectAllParameters();
|
report->matrixPlot()->selectAllParameters();
|
||||||
|
report->correlationPlot()->selectAllParameters();
|
||||||
|
m_correlationReports.push_back( report );
|
||||||
|
return report;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
RimCorrelationReportPlot* RimCorrelationPlotCollection::createCorrelationReportPlot( RimSummaryCaseCollection* ensemble,
|
||||||
|
const QString& quantityName,
|
||||||
|
std::time_t timeStep )
|
||||||
|
{
|
||||||
|
RimCorrelationReportPlot* report = new RimCorrelationReportPlot;
|
||||||
|
report->setAsPlotMdiWindow();
|
||||||
|
applyEnsembleFieldAndTimeStepToReport( report, ensemble, quantityName.toStdString(), timeStep );
|
||||||
|
report->matrixPlot()->selectAllParameters();
|
||||||
|
report->correlationPlot()->selectAllParameters();
|
||||||
m_correlationReports.push_back( report );
|
m_correlationReports.push_back( report );
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
@ -171,6 +239,33 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToPlot( RimAb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToPlot( RimAbstractCorrelationPlot* plot,
|
||||||
|
RimSummaryCaseCollection* ensemble,
|
||||||
|
const std::string& quantityName,
|
||||||
|
std::time_t timeStep )
|
||||||
|
{
|
||||||
|
if ( ensemble )
|
||||||
|
{
|
||||||
|
std::set<RifEclipseSummaryAddress> allAddresses = ensemble->ensembleSummaryAddresses();
|
||||||
|
std::vector<RiaSummaryCurveDefinition> curveDefs;
|
||||||
|
for ( auto address : allAddresses )
|
||||||
|
{
|
||||||
|
if ( address.category() == RifEclipseSummaryAddress::SUMMARY_FIELD )
|
||||||
|
{
|
||||||
|
if ( quantityName.empty() || quantityName == address.quantityName() )
|
||||||
|
{
|
||||||
|
curveDefs.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plot->setCurveDefinitions( curveDefs );
|
||||||
|
plot->setTimeStep( timeStep );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -199,6 +294,40 @@ void RimCorrelationPlotCollection::applyFirstEnsembleFieldAddressesToReport( Rim
|
|||||||
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );
|
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );
|
||||||
plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||||
plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||||
plot->crossPlot()->setEnsembleParameter( ensembles.front()->alphabeticEnsembleParameters().front().name );
|
plot->crossPlot()->setEnsembleParameter( ensembles.front()->variationSortedEnsembleParameters().front().name );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimCorrelationPlotCollection::applyEnsembleFieldAndTimeStepToReport( RimCorrelationReportPlot* plot,
|
||||||
|
RimSummaryCaseCollection* ensemble,
|
||||||
|
const std::string& quantityName,
|
||||||
|
std::time_t timeStep )
|
||||||
|
{
|
||||||
|
if ( ensemble )
|
||||||
|
{
|
||||||
|
std::set<RifEclipseSummaryAddress> allAddresses = ensemble->ensembleSummaryAddresses();
|
||||||
|
std::vector<RiaSummaryCurveDefinition> curveDefsMatrix;
|
||||||
|
std::vector<RiaSummaryCurveDefinition> curveDefsTornadoAndCrossPlot;
|
||||||
|
for ( auto address : allAddresses )
|
||||||
|
{
|
||||||
|
if ( address.category() == RifEclipseSummaryAddress::SUMMARY_FIELD )
|
||||||
|
{
|
||||||
|
curveDefsMatrix.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) );
|
||||||
|
if ( quantityName.empty() || quantityName == address.quantityName() )
|
||||||
|
{
|
||||||
|
curveDefsTornadoAndCrossPlot.push_back( RiaSummaryCurveDefinition( nullptr, address, ensemble ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plot->matrixPlot()->setCurveDefinitions( curveDefsMatrix );
|
||||||
|
plot->matrixPlot()->setTimeStep( timeStep );
|
||||||
|
plot->correlationPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||||
|
plot->correlationPlot()->setTimeStep( timeStep );
|
||||||
|
plot->crossPlot()->setCurveDefinitions( curveDefsTornadoAndCrossPlot );
|
||||||
|
plot->crossPlot()->setTimeStep( timeStep );
|
||||||
|
plot->crossPlot()->setEnsembleParameter( ensemble->variationSortedEnsembleParameters().front().name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,14 @@
|
|||||||
#include "cafPdmChildArrayField.h"
|
#include "cafPdmChildArrayField.h"
|
||||||
#include "cafPdmObject.h"
|
#include "cafPdmObject.h"
|
||||||
|
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
class RimAbstractCorrelationPlot;
|
class RimAbstractCorrelationPlot;
|
||||||
class RimCorrelationPlot;
|
class RimCorrelationPlot;
|
||||||
class RimCorrelationMatrixPlot;
|
class RimCorrelationMatrixPlot;
|
||||||
class RimCorrelationReportPlot;
|
class RimCorrelationReportPlot;
|
||||||
class RimParameterResultCrossPlot;
|
class RimParameterResultCrossPlot;
|
||||||
|
class RimSummaryCaseCollection;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@ -39,12 +42,26 @@ public:
|
|||||||
RimCorrelationPlotCollection();
|
RimCorrelationPlotCollection();
|
||||||
~RimCorrelationPlotCollection() override;
|
~RimCorrelationPlotCollection() override;
|
||||||
|
|
||||||
RimCorrelationPlot* createCorrelationPlot( bool defaultToFirstEnsembleFopt = true );
|
RimCorrelationPlot* createCorrelationPlot( bool defaultToFirstEnsembleFopt = true );
|
||||||
RimCorrelationMatrixPlot* createCorrelationMatrixPlot( bool defaultToFirstEnsembleField = true );
|
RimCorrelationPlot*
|
||||||
|
createCorrelationPlot( RimSummaryCaseCollection* ensemble, const QString& quantityName, std::time_t timeStep );
|
||||||
|
|
||||||
|
RimCorrelationMatrixPlot* createCorrelationMatrixPlot( bool defaultToFirstEnsembleField = true );
|
||||||
|
RimCorrelationMatrixPlot* createCorrelationMatrixPlot( RimSummaryCaseCollection* ensemble, std::time_t timeStep );
|
||||||
|
|
||||||
RimParameterResultCrossPlot* createParameterResultCrossPlot( bool defaultToFirstEnsembleFopt = true );
|
RimParameterResultCrossPlot* createParameterResultCrossPlot( bool defaultToFirstEnsembleFopt = true );
|
||||||
RimCorrelationReportPlot* createCorrelationReportPlot( bool defaultToFirstEnsembleFopt = true );
|
RimParameterResultCrossPlot* createParameterResultCrossPlot( RimSummaryCaseCollection* ensemble,
|
||||||
void removePlot( RimAbstractCorrelationPlot* correlationPlot );
|
const QString& paramName,
|
||||||
void removeReport( RimCorrelationReportPlot* correlationReport );
|
const QString& quantityName,
|
||||||
|
std::time_t timeStep );
|
||||||
|
|
||||||
|
RimCorrelationReportPlot* createCorrelationReportPlot( bool defaultToFirstEnsembleFopt = true );
|
||||||
|
RimCorrelationReportPlot* createCorrelationReportPlot( RimSummaryCaseCollection* ensemble,
|
||||||
|
const QString& quantityName,
|
||||||
|
std::time_t timeStep );
|
||||||
|
|
||||||
|
void removePlot( RimAbstractCorrelationPlot* correlationPlot );
|
||||||
|
void removeReport( RimCorrelationReportPlot* correlationReport );
|
||||||
|
|
||||||
std::vector<RimAbstractCorrelationPlot*> plots();
|
std::vector<RimAbstractCorrelationPlot*> plots();
|
||||||
std::vector<RimCorrelationReportPlot*> reports();
|
std::vector<RimCorrelationReportPlot*> reports();
|
||||||
@ -53,7 +70,15 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void applyFirstEnsembleFieldAddressesToPlot( RimAbstractCorrelationPlot* plot, const std::string& quantityName = "" );
|
void applyFirstEnsembleFieldAddressesToPlot( RimAbstractCorrelationPlot* plot, const std::string& quantityName = "" );
|
||||||
|
void applyEnsembleFieldAndTimeStepToPlot( RimAbstractCorrelationPlot* plot,
|
||||||
|
RimSummaryCaseCollection* ensemble,
|
||||||
|
const std::string& quantityName,
|
||||||
|
std::time_t timeStep );
|
||||||
void applyFirstEnsembleFieldAddressesToReport( RimCorrelationReportPlot* plot, const std::string& quantityName = "" );
|
void applyFirstEnsembleFieldAddressesToReport( RimCorrelationReportPlot* plot, const std::string& quantityName = "" );
|
||||||
|
void applyEnsembleFieldAndTimeStepToReport( RimCorrelationReportPlot* plot,
|
||||||
|
RimSummaryCaseCollection* ensemble,
|
||||||
|
const std::string& quantityName,
|
||||||
|
std::time_t timeStep );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmChildArrayField<RimAbstractCorrelationPlot*> m_correlationPlots;
|
caf::PdmChildArrayField<RimAbstractCorrelationPlot*> m_correlationPlots;
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cfloat>
|
#include <limits>
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
@ -968,7 +968,7 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos,
|
|||||||
// Force empty defaults
|
// Force empty defaults
|
||||||
*closestItem = nullptr;
|
*closestItem = nullptr;
|
||||||
*closestCurvePoint = -1;
|
*closestCurvePoint = -1;
|
||||||
*distanceFromClick = DBL_MAX;
|
*distanceFromClick = std::numeric_limits<double>::infinity();
|
||||||
|
|
||||||
const QwtPlotItemList& itmList = itemList();
|
const QwtPlotItemList& itmList = itemList();
|
||||||
for ( QwtPlotItemIterator it = itmList.begin(); it != itmList.end(); it++ )
|
for ( QwtPlotItemIterator it = itmList.begin(); it != itmList.end(); it++ )
|
||||||
@ -976,7 +976,7 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos,
|
|||||||
if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotCurve )
|
if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotCurve )
|
||||||
{
|
{
|
||||||
QwtPlotCurve* candidateCurve = static_cast<QwtPlotCurve*>( *it );
|
QwtPlotCurve* candidateCurve = static_cast<QwtPlotCurve*>( *it );
|
||||||
double dist = DBL_MAX;
|
double dist = std::numeric_limits<double>::infinity();
|
||||||
int curvePoint = candidateCurve->closestPoint( pos, &dist );
|
int curvePoint = candidateCurve->closestPoint( pos, &dist );
|
||||||
if ( dist < *distanceFromClick )
|
if ( dist < *distanceFromClick )
|
||||||
{
|
{
|
||||||
@ -1023,7 +1023,7 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos,
|
|||||||
void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItemInSelection /*= false*/ )
|
void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItemInSelection /*= false*/ )
|
||||||
{
|
{
|
||||||
QwtPlotItem* closestItem = nullptr;
|
QwtPlotItem* closestItem = nullptr;
|
||||||
double distanceFromClick = DBL_MAX;
|
double distanceFromClick = std::numeric_limits<double>::infinity();
|
||||||
int closestCurvePoint = -1;
|
int closestCurvePoint = -1;
|
||||||
|
|
||||||
findClosestPlotItem( pos, &closestItem, &closestCurvePoint, &distanceFromClick );
|
findClosestPlotItem( pos, &closestItem, &closestCurvePoint, &distanceFromClick );
|
||||||
|
@ -161,12 +161,12 @@ protected:
|
|||||||
virtual bool isZoomerActive() const;
|
virtual bool isZoomerActive() const;
|
||||||
virtual void endZoomOperations();
|
virtual void endZoomOperations();
|
||||||
|
|
||||||
private:
|
|
||||||
void findClosestPlotItem( const QPoint& pos,
|
void findClosestPlotItem( const QPoint& pos,
|
||||||
QwtPlotItem** closestItem,
|
QwtPlotItem** closestItem,
|
||||||
int* closestCurvePoint,
|
int* closestCurvePoint,
|
||||||
double* distanceFromClick ) const;
|
double* distanceFromClick ) const;
|
||||||
|
|
||||||
|
private:
|
||||||
void selectClosestPlotItem( const QPoint& pos, bool toggleItemInSelection = false );
|
void selectClosestPlotItem( const QPoint& pos, bool toggleItemInSelection = false );
|
||||||
static int defaultMinimumWidth();
|
static int defaultMinimumWidth();
|
||||||
void replot() override;
|
void replot() override;
|
||||||
|
@ -20,12 +20,16 @@
|
|||||||
#include "RiaApplication.h"
|
#include "RiaApplication.h"
|
||||||
#include "RiaPreferences.h"
|
#include "RiaPreferences.h"
|
||||||
|
|
||||||
|
#include "Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.h"
|
||||||
|
|
||||||
#include "RimEnsembleCurveSet.h"
|
#include "RimEnsembleCurveSet.h"
|
||||||
#include "RimEnsembleCurveSetCollection.h"
|
#include "RimEnsembleCurveSetCollection.h"
|
||||||
|
#include "RimEnsembleStatisticsCase.h"
|
||||||
#include "RimMainPlotCollection.h"
|
#include "RimMainPlotCollection.h"
|
||||||
#include "RimPlot.h"
|
#include "RimPlot.h"
|
||||||
#include "RimRegularLegendConfig.h"
|
#include "RimRegularLegendConfig.h"
|
||||||
#include "RimSummaryCase.h"
|
#include "RimSummaryCase.h"
|
||||||
|
#include "RimSummaryCaseCollection.h"
|
||||||
#include "RimSummaryCurve.h"
|
#include "RimSummaryCurve.h"
|
||||||
#include "RimSummaryCurveCollection.h"
|
#include "RimSummaryCurveCollection.h"
|
||||||
#include "RimSummaryPlot.h"
|
#include "RimSummaryPlot.h"
|
||||||
@ -46,6 +50,7 @@
|
|||||||
#include "RimProject.h"
|
#include "RimProject.h"
|
||||||
|
|
||||||
#include "cafCmdFeatureMenuBuilder.h"
|
#include "cafCmdFeatureMenuBuilder.h"
|
||||||
|
#include "cafIconProvider.h"
|
||||||
#include "cafSelectionManager.h"
|
#include "cafSelectionManager.h"
|
||||||
#include "cafTitledOverlayFrame.h"
|
#include "cafTitledOverlayFrame.h"
|
||||||
|
|
||||||
@ -66,6 +71,8 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -176,6 +183,73 @@ void RiuSummaryQwtPlot::contextMenuEvent( QContextMenuEvent* event )
|
|||||||
menuBuilder << "RicShowPlotDataFeature";
|
menuBuilder << "RicShowPlotDataFeature";
|
||||||
menuBuilder << "RicSavePlotTemplateFeature";
|
menuBuilder << "RicSavePlotTemplateFeature";
|
||||||
|
|
||||||
|
QwtPlotItem* closestItem = nullptr;
|
||||||
|
double distanceFromClick = std::numeric_limits<double>::infinity();
|
||||||
|
int closestCurvePoint = -1;
|
||||||
|
QPoint globalPos = event->globalPos();
|
||||||
|
QPoint localPos = this->canvas()->mapFromGlobal( globalPos );
|
||||||
|
|
||||||
|
findClosestPlotItem( localPos, &closestItem, &closestCurvePoint, &distanceFromClick );
|
||||||
|
if ( closestItem && closestCurvePoint >= 0 )
|
||||||
|
{
|
||||||
|
RiuRimQwtPlotCurve* plotCurve = dynamic_cast<RiuRimQwtPlotCurve*>( closestItem );
|
||||||
|
if ( plotCurve )
|
||||||
|
{
|
||||||
|
RimSummaryCurve* summaryCurve = dynamic_cast<RimSummaryCurve*>( plotCurve->ownerRimCurve() );
|
||||||
|
if ( summaryCurve && closestCurvePoint < (int)summaryCurve->timeStepsY().size() )
|
||||||
|
{
|
||||||
|
std::time_t timeStep = summaryCurve->timeStepsY()[closestCurvePoint];
|
||||||
|
|
||||||
|
RimEnsembleCurveSet* ensembleCurveSet = nullptr;
|
||||||
|
summaryCurve->firstAncestorOrThisOfType( ensembleCurveSet );
|
||||||
|
|
||||||
|
if ( ensembleCurveSet )
|
||||||
|
{
|
||||||
|
RimSummaryCaseCollection* ensemble = ensembleCurveSet->summaryCaseCollection();
|
||||||
|
if ( ensemble && ensemble->isEnsemble() )
|
||||||
|
{
|
||||||
|
CorrelationPlotParams params( ensemble,
|
||||||
|
QString::fromStdString(
|
||||||
|
ensembleCurveSet->summaryAddress().quantityName() ),
|
||||||
|
timeStep );
|
||||||
|
QVariant variant = QVariant::fromValue( params );
|
||||||
|
menuBuilder.subMenuStart( "Create Correlation Plot From Curve Point",
|
||||||
|
*caf::IconProvider( ":/CorrelationPlots16x16.png" ).icon() );
|
||||||
|
{
|
||||||
|
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<EnsembleParameter> ensembleParameters =
|
||||||
|
ensemble->variationSortedEnsembleParameters();
|
||||||
|
for ( const EnsembleParameter& param : ensembleParameters )
|
||||||
|
{
|
||||||
|
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.appendToMenu( &menu );
|
menuBuilder.appendToMenu( &menu );
|
||||||
|
|
||||||
if ( menu.actions().size() > 0 )
|
if ( menu.actions().size() > 0 )
|
||||||
|
Loading…
Reference in New Issue
Block a user