Working clicking on Tornado Plots

This commit is contained in:
Gaute Lindkvist
2020-05-05 12:43:44 +02:00
parent 70685b73b4
commit 3240c24f2c
13 changed files with 95 additions and 63 deletions

View File

@@ -26,6 +26,7 @@ ${SOURCE_GROUP_SOURCE_FILES}
)
list(APPEND QT_MOC_HEADERS
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationMatrixPlot.h
${CMAKE_CURRENT_LIST_DIR}/RimCorrelationReportPlot.h
)

View File

@@ -549,7 +549,7 @@ void RimCorrelationMatrixPlot::updateLegend()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationMatrixPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle )
void RimCorrelationMatrixPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex )
{
CorrelationMatrixShapeItem* matrixItem = dynamic_cast<CorrelationMatrixShapeItem*>( plotItem );
if ( matrixItem )

View File

@@ -71,7 +71,7 @@ private:
void createMatrix();
void updatePlotTitle() override;
void updateLegend() override;
void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle ) override;
void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ) override;
private:
caf::PdmField<CorrelationFactorEnum> m_correlationFactor;

View File

@@ -39,6 +39,8 @@
#include "cafPdmUiComboBoxEditor.h"
#include "qwt_plot_barchart.h"
#include <limits>
#include <map>
#include <set>
@@ -295,6 +297,26 @@ void RimCorrelationPlot::updatePlotTitle()
m_plotWidget->setPlotTitleFontSize( isMdiWindow() ? 8 : 10 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex )
{
QwtPlotBarChart* barChart = dynamic_cast<QwtPlotBarChart*>( plotItem );
if ( barChart && !curveDefinitions().empty() )
{
auto curveDef = curveDefinitions().front();
auto barTitle = barChart->title();
for ( auto param : ensembleParameters() )
{
if ( barTitle.text() == param.name )
{
emit tornadoItemSelected( param, curveDef );
}
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -18,7 +18,9 @@
#pragma once
#include "RiaSummaryCurveDefinition.h"
#include "RimAbstractCorrelationPlot.h"
#include "RimSummaryCaseCollection.h"
#include "cafAppEnum.h"
#include <QDateTime>
@@ -32,6 +34,7 @@ class RiuGroupedBarChartBuilder;
//==================================================================================================
class RimCorrelationPlot : public RimAbstractCorrelationPlot
{
Q_OBJECT;
CAF_PDM_HEADER_INIT;
public:
@@ -55,6 +58,9 @@ public:
bool sortByAbsoluteValues() const;
void setSortByAbsoluteValues( bool sortByAbsoluteValues );
signals:
void tornadoItemSelected( const EnsembleParameter&, const RiaSummaryCurveDefinition& curveDef );
private:
// Overridden PDM methods
@@ -71,6 +77,7 @@ private:
// Private methods
void addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder );
void updatePlotTitle() override;
void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ) override;
private:
caf::PdmField<CorrelationFactorEnum> m_correlationFactor;

View File

@@ -65,7 +65,11 @@ RimCorrelationReportPlot::RimCorrelationReportPlot()
this->connect( m_correlationMatrixPlot(),
SIGNAL( matrixCellSelected( const EnsembleParameter&, const RiaSummaryCurveDefinition& ) ),
SLOT( onMatrixCellSelected( const EnsembleParameter&, const RiaSummaryCurveDefinition& ) ) );
SLOT( onDataSelection( const EnsembleParameter&, const RiaSummaryCurveDefinition& ) ) );
this->connect( m_correlationPlot(),
SIGNAL( tornadoItemSelected( const EnsembleParameter&, const RiaSummaryCurveDefinition& ) ),
SLOT( onDataSelection( const EnsembleParameter&, const RiaSummaryCurveDefinition& ) ) );
}
//--------------------------------------------------------------------------------------------------
@@ -304,8 +308,7 @@ void RimCorrelationReportPlot::childFieldChangedByUi( const caf::PdmFieldHandle*
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationReportPlot::onMatrixCellSelected( const EnsembleParameter& param,
const RiaSummaryCurveDefinition& curveDef )
void RimCorrelationReportPlot::onDataSelection( const EnsembleParameter& param, const RiaSummaryCurveDefinition& curveDef )
{
m_correlationPlot->setCurveDefinitions( { curveDef } );
m_correlationPlot->loadDataAndUpdate();

View File

@@ -74,7 +74,7 @@ private:
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
private slots:
void onMatrixCellSelected( const EnsembleParameter& param, const RiaSummaryCurveDefinition& curveDef );
void onDataSelection( const EnsembleParameter& param, const RiaSummaryCurveDefinition& curveDef );
private:
caf::PdmProxyValueField<QString> m_plotWindowTitle;

View File

@@ -163,8 +163,8 @@ void RimPlot::attachPlotWidgetSignals( RimPlot* plot, RiuQwtPlotWidget* plotWidg
plot->connect( plotWidget, SIGNAL( plotSelected( bool ) ), SLOT( onPlotSelected( bool ) ) );
plot->connect( plotWidget, SIGNAL( axisSelected( int, bool ) ), SLOT( onAxisSelected( int, bool ) ) );
plot->connect( plotWidget,
SIGNAL( plotItemSelected( QwtPlotItem*, bool ) ),
SLOT( onPlotItemSelected( QwtPlotItem*, bool ) ) );
SIGNAL( plotItemSelected( QwtPlotItem*, bool, int ) ),
SLOT( onPlotItemSelected( QwtPlotItem*, bool, int ) ) );
plot->connect( plotWidget, SIGNAL( onKeyPressEvent( QKeyEvent* ) ), SLOT( onKeyPressEvent( QKeyEvent* ) ) );
plot->connect( plotWidget, SIGNAL( onWheelEvent( QWheelEvent* ) ), SLOT( onWheelEvent( QWheelEvent* ) ) );
plot->connect( plotWidget, SIGNAL( destroyed() ), SLOT( onViewerDestroyed() ) );
@@ -199,7 +199,7 @@ void RimPlot::onPlotSelected( bool toggle )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle )
void RimPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex )
{
QwtPlotCurve* curve = dynamic_cast<QwtPlotCurve*>( plotItem );
if ( curve )

View File

@@ -105,7 +105,7 @@ private:
private slots:
void onPlotSelected( bool toggle );
virtual void onAxisSelected( int axis, bool toggle ) {}
virtual void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle );
virtual void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex );
void onViewerDestroyed();
void onKeyPressEvent( QKeyEvent* event );
void onWheelEvent( QWheelEvent* event );