From 3235dc60da26ff8b8ec50656a4ba7feb2ee8ebe7 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 11 Nov 2010 17:15:52 +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 b2fc5e26e..7f212a85b 100755 --- a/src/Plot2d/Plot2d_ViewFrame.cxx +++ b/src/Plot2d/Plot2d_ViewFrame.cxx @@ -786,6 +786,7 @@ void Plot2d_ViewFrame::fitAll() myPlot->setAxisScale( QwtPlot::yRight, y2min, y2max ); } myPlot->replot(); + if ( myPlot->zoomer() ) myPlot->zoomer()->setZoomBase(); } /*! @@ -813,6 +814,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(); } /*! @@ -831,6 +833,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(); } /*! @@ -1700,6 +1703,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 ); @@ -1708,11 +1716,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