From c690e1f194718094b10ca114f406da4b5641e6ba Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 17 Nov 2010 09:19:58 +0000 Subject: [PATCH] 0021061: [CEA 433] Problem with "fit Area" in plot2D --- src/Plot2d/Plot2d_ViewFrame.cxx | 13 ++++++++----- src/Plot2d/Plot2d_ViewFrame.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Plot2d/Plot2d_ViewFrame.cxx b/src/Plot2d/Plot2d_ViewFrame.cxx index 51c2639d2..7de8c5813 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -790,6 +790,7 @@ void Plot2d_ViewFrame::fitAll() myPlot->setAxisScale( QwtPlot::yRight, y2min, y2max ); } myPlot->replot(); + if ( myPlot->zoomer() ) myPlot->zoomer()->setZoomBase(); } /*! @@ -817,6 +818,7 @@ void Plot2d_ViewFrame::fitArea( const QRect& area ) myPlot->invTransform( QwtPlot::xBottom, rect.left() ), myPlot->invTransform( QwtPlot::xBottom, rect.right() ) ); myPlot->replot(); + if ( myPlot->zoomer() ) myPlot->zoomer()->setZoomBase(); } /*! @@ -835,6 +837,7 @@ void Plot2d_ViewFrame::fitData(const int mode, if ( mode == 0 || mode == 1 ) myPlot->setAxisScale( QwtPlot::xBottom, xMin, xMax ); myPlot->replot(); + if ( myPlot->zoomer() ) myPlot->zoomer()->setZoomBase(); } /*! @@ -1706,6 +1709,11 @@ Plot2d_Plot2d::Plot2d_Plot2d( QWidget* parent ) : QwtPlot( parent ), myIsPolished( false ) { + // Create alternative scales + setAxisScaleDraw( QwtPlot::yLeft, new Plot2d_ScaleDraw() ); + setAxisScaleDraw( QwtPlot::xBottom, new Plot2d_ScaleDraw() ); + setAxisScaleDraw( QwtPlot::yRight, new Plot2d_ScaleDraw() ); + myPlotZoomer = new Plot2d_QwtPlotZoomer( QwtPlot::xBottom, QwtPlot::yLeft, canvas() ); myPlotZoomer->setSelectionFlags( QwtPicker::DragSelection | QwtPicker::CornerToCorner ); myPlotZoomer->setTrackerMode( QwtPicker::AlwaysOff ); @@ -1714,11 +1722,6 @@ Plot2d_Plot2d::Plot2d_Plot2d( QWidget* parent ) defaultPicker(); - // Create alternative scales - setAxisScaleDraw( QwtPlot::yLeft, new Plot2d_ScaleDraw() ); - setAxisScaleDraw( QwtPlot::xBottom, new Plot2d_ScaleDraw() ); - setAxisScaleDraw( QwtPlot::yRight, new Plot2d_ScaleDraw() ); - // auto scaling by default setAxisAutoScale( QwtPlot::yLeft ); setAxisAutoScale( QwtPlot::yRight ); diff --git a/src/Plot2d/Plot2d_ViewFrame.h b/src/Plot2d/Plot2d_ViewFrame.h index bb25204f4..a903be0b8 100755 --- a/src/Plot2d/Plot2d_ViewFrame.h +++ b/src/Plot2d/Plot2d_ViewFrame.h @@ -229,6 +229,7 @@ public: QwtPlotGrid* grid() { return myGrid; }; CurveDict& getCurves() { return myCurves; } Plot2d_Curve* getClosestCurve( QPoint p, double& distance, int& index ); + QwtPlotZoomer* zoomer() const { return myPlotZoomer; } virtual void updateYAxisIdentifiers(); -- 2.39.2