mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Implement signal handler
This commit is contained in:
@@ -86,6 +86,7 @@
|
||||
#include "cafSelectionManager.h"
|
||||
#include "cvfAssert.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QWheelEvent>
|
||||
|
||||
#include <algorithm>
|
||||
@@ -283,6 +284,10 @@ RimWellLogTrack::RimWellLogTrack()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellLogTrack::~RimWellLogTrack()
|
||||
{
|
||||
for ( auto curve : m_curves )
|
||||
{
|
||||
disconnectCurveSignals( curve );
|
||||
}
|
||||
m_curves.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
@@ -730,14 +735,26 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField )
|
||||
void RimWellLogTrack::curveVisibilityChanged( const caf::SignalEmitter* emitter, bool visible )
|
||||
{
|
||||
qDebug() << "Curve turned " << ( visible ? "on" : "off" );
|
||||
if ( m_stackCurves )
|
||||
{
|
||||
updateStackedCurveData();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::curveAppearanceChanged( const caf::SignalEmitter* emitter )
|
||||
{
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
m_plotWidget->scheduleReplot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1040,6 +1057,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogTrack::calculateValueOptions( const caf:
|
||||
void RimWellLogTrack::addCurve( RimWellLogCurve* curve )
|
||||
{
|
||||
m_curves.push_back( curve );
|
||||
connectCurveSignals( curve );
|
||||
|
||||
if ( m_plotWidget )
|
||||
{
|
||||
@@ -1053,6 +1071,7 @@ void RimWellLogTrack::addCurve( RimWellLogCurve* curve )
|
||||
void RimWellLogTrack::insertCurve( RimWellLogCurve* curve, size_t index )
|
||||
{
|
||||
m_curves.insert( index, curve );
|
||||
connectCurveSignals( curve );
|
||||
// Todo: Mark curve data to use either TVD or MD
|
||||
|
||||
if ( m_plotWidget )
|
||||
@@ -1071,6 +1090,7 @@ void RimWellLogTrack::removeCurve( RimWellLogCurve* curve )
|
||||
{
|
||||
m_curves[index]->detachQwtCurve();
|
||||
m_curves.removeChildObject( curve );
|
||||
disconnectCurveSignals( curve );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1823,6 +1843,11 @@ void RimWellLogTrack::initAfterRead()
|
||||
{
|
||||
m_colorShadingLegend = RimRegularLegendConfig::mapToColorLegend( m_colorShadingPalette_OBSOLETE() );
|
||||
}
|
||||
|
||||
for ( auto curve : m_curves )
|
||||
{
|
||||
connectCurveSignals( curve );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1987,6 +2012,24 @@ std::vector<std::pair<double, double>> RimWellLogTrack::waterAndRockRegions( Ria
|
||||
return {};
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::connectCurveSignals( RimWellLogCurve* curve )
|
||||
{
|
||||
curve->visibilityChanged.connect( this, &RimWellLogTrack::curveVisibilityChanged );
|
||||
curve->appearanceChanged.connect( this, &RimWellLogTrack::curveAppearanceChanged );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::disconnectCurveSignals( RimWellLogCurve* curve )
|
||||
{
|
||||
curve->visibilityChanged.disconnect( this );
|
||||
curve->appearanceChanged.disconnect( this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user