#6236 Change Correlation plots to use caf::Signals

This commit is contained in:
Gaute Lindkvist 2020-07-29 15:24:25 +02:00
parent 658cffd8e0
commit eee30f3d1d
7 changed files with 19 additions and 30 deletions

View File

@ -25,10 +25,4 @@ list(APPEND CODE_SOURCE_FILES
${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
)
source_group( "ProjectDataModel\\CorrelationPlots" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@ -148,6 +148,7 @@ using CorrelationMatrixRow = CorrelationMatrixRowOrColumn<RiaSummaryCurveDefi
//--------------------------------------------------------------------------------------------------
RimCorrelationMatrixPlot::RimCorrelationMatrixPlot()
: RimAbstractCorrelationPlot()
, matrixCellSelected( this )
{
CAF_PDM_InitObject( "Correlation Plot", ":/CorrelationMatrixPlot16x16.png", "", "" );
@ -686,6 +687,6 @@ void RimCorrelationMatrixPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool t
CorrelationMatrixShapeItem* matrixItem = dynamic_cast<CorrelationMatrixShapeItem*>( plotItem );
if ( matrixItem )
{
emit matrixCellSelected( matrixItem->parameter, matrixItem->curveDef );
matrixCellSelected.send( std::make_pair( matrixItem->parameter, matrixItem->curveDef ) );
}
}

View File

@ -33,9 +33,11 @@ class RiuGroupedBarChartBuilder;
//==================================================================================================
class RimCorrelationMatrixPlot : public RimAbstractCorrelationPlot
{
Q_OBJECT;
CAF_PDM_HEADER_INIT;
public:
caf::Signal<std::pair<QString, RiaSummaryCurveDefinition>> matrixCellSelected;
public:
using CorrelationFactor = RimCorrelationPlot::CorrelationFactor;
using CorrelationFactorEnum = RimCorrelationPlot::CorrelationFactorEnum;
@ -61,9 +63,6 @@ public:
bool showTopNCorrelations() const;
int topNFilterCount() const;
signals:
void matrixCellSelected( const QString&, const RiaSummaryCurveDefinition& );
private:
// Overridden PDM methods

View File

@ -67,6 +67,7 @@ CAF_PDM_SOURCE_INIT( RimCorrelationPlot, "CorrelationPlot" );
//--------------------------------------------------------------------------------------------------
RimCorrelationPlot::RimCorrelationPlot()
: RimAbstractCorrelationPlot()
, tornadoItemSelected( this )
{
CAF_PDM_InitObject( "Correlation Tornado Plot", ":/CorrelationTornadoPlot16x16.png", "", "" );
@ -372,7 +373,7 @@ void RimCorrelationPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle,
{
if ( barTitle.text() == param.name )
{
emit tornadoItemSelected( param.name, curveDef );
tornadoItemSelected.send( std::make_pair( param.name, curveDef ) );
}
}
}

View File

@ -35,9 +35,11 @@ class RiuGroupedBarChartBuilder;
//==================================================================================================
class RimCorrelationPlot : public RimAbstractCorrelationPlot
{
Q_OBJECT;
CAF_PDM_HEADER_INIT;
public:
caf::Signal<std::pair<QString, RiaSummaryCurveDefinition>> tornadoItemSelected;
public:
enum class CorrelationFactor
{
@ -63,9 +65,6 @@ public:
void setShowOnlyTopNCorrelations( bool showOnlyTopNCorrelations );
void setTopNFilterCount( int filterCount );
signals:
void tornadoItemSelected( const QString&, const RiaSummaryCurveDefinition& curveDef );
private:
// Overridden PDM methods

View File

@ -88,13 +88,8 @@ RimCorrelationReportPlot::RimCorrelationReportPlot()
this->uiCapability()->setUiTreeChildrenHidden( true );
this->connect( m_correlationMatrixPlot(),
SIGNAL( matrixCellSelected( const QString&, const RiaSummaryCurveDefinition& ) ),
SLOT( onDataSelection( const QString&, const RiaSummaryCurveDefinition& ) ) );
this->connect( m_correlationPlot(),
SIGNAL( tornadoItemSelected( const QString&, const RiaSummaryCurveDefinition& ) ),
SLOT( onDataSelection( const QString&, const RiaSummaryCurveDefinition& ) ) );
m_correlationMatrixPlot->matrixCellSelected.connect( this, &RimCorrelationReportPlot::onDataSelection );
m_correlationPlot->tornadoItemSelected.connect( this, &RimCorrelationReportPlot::onDataSelection );
}
//--------------------------------------------------------------------------------------------------
@ -402,11 +397,12 @@ QList<caf::PdmOptionItemInfo>
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimCorrelationReportPlot::onDataSelection( const QString& paramName, const RiaSummaryCurveDefinition& curveDef )
void RimCorrelationReportPlot::onDataSelection( const caf::SignalEmitter* emitter,
std::pair<QString, RiaSummaryCurveDefinition> parameterAndCurveDef )
{
auto paramName = parameterAndCurveDef.first;
auto curveDef = parameterAndCurveDef.second;
m_correlationPlot->setCurveDefinitions( {curveDef} );
m_correlationPlot->loadDataAndUpdate();
m_parameterResultCrossPlot->setCurveDefinitions( {curveDef} );

View File

@ -37,7 +37,6 @@ class RiuMultiPlotPage;
class RimCorrelationReportPlot : public QObject, public RimPlotWindow
{
Q_OBJECT;
CAF_PDM_HEADER_INIT;
using CorrelationFactor = RimCorrelationPlot::CorrelationFactor;
using CorrelationFactorEnum = RimCorrelationPlot::CorrelationFactorEnum;
@ -78,8 +77,8 @@ private:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
private slots:
void onDataSelection( const QString& paramName, const RiaSummaryCurveDefinition& curveDef );
void onDataSelection( const caf::SignalEmitter* emitter,
std::pair<QString, RiaSummaryCurveDefinition> parameterAndCurveDef );
private:
caf::PdmProxyValueField<QString> m_plotWindowTitle;