Add multi axis zoom class

Add class used to zoom all axis in a plot based on a screen rectangle.
This commit is contained in:
Magne Sjaastad
2023-09-15 13:35:04 +02:00
parent 70dcb48830
commit cc59eba6e0
8 changed files with 171 additions and 37 deletions

View File

@@ -81,15 +81,9 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*=
connect( m_plotWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( showContextMenu( QPoint ) ) );
// LeftButton for the zooming
m_zoomerLeft = new RiuQwtPlotZoomer( m_plotWidget->qwtPlot()->canvas() );
m_zoomerLeft->setTrackerMode( QwtPicker::AlwaysOff );
m_zoomerLeft->initMousePattern( 1 );
// Attach a zoomer for the right axis
m_zoomerRight = new RiuQwtPlotZoomer( m_plotWidget->qwtPlot()->canvas() );
m_zoomerRight->setAxes( QwtAxis::XTop, QwtAxis::YRight );
m_zoomerRight->setTrackerMode( QwtPicker::AlwaysOff );
m_zoomerRight->initMousePattern( 1 );
m_plotZoomer = new RiuQwtPlotZoomer( m_plotWidget->qwtPlot()->canvas() );
m_plotZoomer->setTrackerMode( QwtPicker::AlwaysOff );
m_plotZoomer->initMousePattern( 1 );
// MidButton for the panning
QwtPlotPanner* panner = new QwtPlotPanner( m_plotWidget->qwtPlot()->canvas() );
@@ -98,8 +92,7 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*=
m_wheelZoomer = new RiuQwtPlotWheelZoomer( m_plotWidget->qwtPlot() );
connect( m_wheelZoomer, SIGNAL( zoomUpdated() ), SLOT( onZoomedSlot() ) );
connect( m_zoomerLeft, SIGNAL( zoomed( const QRectF& ) ), SLOT( onZoomedSlot() ) );
connect( m_zoomerRight, SIGNAL( zoomed( const QRectF& ) ), SLOT( onZoomedSlot() ) );
connect( m_plotZoomer, SIGNAL( zoomed() ), SLOT( onZoomedSlot() ) );
connect( panner, SIGNAL( panned( int, int ) ), SLOT( onZoomedSlot() ) );
setDefaults();
@@ -194,7 +187,7 @@ void RiuSummaryQwtPlot::setDefaults()
//--------------------------------------------------------------------------------------------------
bool RiuSummaryQwtPlot::isZoomerActive() const
{
return m_zoomerLeft->isActiveAndValid() || m_zoomerRight->isActiveAndValid();
return m_plotZoomer->isActiveAndValid();
}
//--------------------------------------------------------------------------------------------------
@@ -202,8 +195,7 @@ bool RiuSummaryQwtPlot::isZoomerActive() const
//--------------------------------------------------------------------------------------------------
void RiuSummaryQwtPlot::endZoomOperations()
{
m_zoomerLeft->endZoomOperation();
m_zoomerRight->endZoomOperation();
m_plotZoomer->endZoomOperation();
}
//--------------------------------------------------------------------------------------------------