25 if ( max - min < minRange )
27 min = 0.5 * ( min + max - minRange );
35 double minBounded = transform->
bounded( min );
36 double maxBounded = transform->
bounded( max );
38 if ( minBounded != min )
40 maxBounded = transform->
bounded( minBounded + minRange );
42 else if ( maxBounded != max )
44 minBounded = transform->
bounded( maxBounded - minRange );
60 if ( minSize.width() > r.width() )
63 r.left(), r.right(), minSize.width(), transformX );
69 if ( minSize.height() > r.height() )
72 zoomRect.top(), zoomRect.bottom(), minSize.height(), transformY );
134 QWidget *
canvas,
bool doReplot ):
152 if ( doReplot &&
plot() )
268 const QRectF bRect = base | sRect;
318 const QRectF
zoomRect = rect.normalized();
332 Q_EMIT
zoomed( zoomRect );
386 if ( zoomStack.isEmpty() )
395 if ( zoomRectIndex < 0 || zoomRectIndex > zoomStack.count() )
396 zoomRectIndex = zoomStack.count() - 1;
428 double x1 = rect.left();
429 double x2 = rect.right();
435 double y1 = rect.top();
436 double y2 = rect.bottom();
523 moveTo( QPointF( rect.left() + dx, rect.top() + dy ) );
569 if ( pa.count() < 2 )
572 QRect rect = QRect( pa.first(), pa.last() );
573 rect = rect.normalized();
575 const int minSize = 2;
576 if ( rect.width() < minSize && rect.height() < minSize )
581 const QPoint center = rect.center();
582 rect.setSize( rect.size().expandedTo( QSize( minZoomSize, minZoomSize ) ) );
583 rect.moveCenter( center );
586 pa[0] = rect.topLeft();
587 pa[1] = rect.bottomRight();
618 if ( minSize.isValid() )
623 if ( minSize.width() >= sz.width() &&
624 minSize.height() >= sz.height() )
654 if ( pa.count() < 2 )
657 QRect rect = QRect( pa.first(), pa.last() );
658 rect = rect.normalized();
int yAxis() const
Return y axis.
virtual void widgetKeyPressEvent(QKeyEvent *)
QwtPlotZoomer(QWidget *, bool doReplot=true)
Create a zoomer for a plot canvas.
void setZoomStack(const QStack< QRectF > &, int zoomRectIndex=-1)
Assign a zoom stack.
virtual void zoom(const QRectF &)
Zoom in.
const QwtScaleDiv & axisScaleDiv(int axisId) const
Return the scale division of a specified axis.
void setRubberBand(RubberBand)
uint zoomRectIndex() const
A class representing an interval.
const QStack< QRectF > & zoomStack() const
void setTrackerMode(DisplayMode)
Set the display mode of the tracker.
void setAutoReplot(bool=true)
Set or reset the autoReplot option.
virtual bool end(bool ok=true)
virtual QSizeF minZoomSize() const
Limit zooming by a minimum rectangle.
virtual void replot()
Redraw the plot.
QPolygon selection() const
virtual void widgetKeyPressEvent(QKeyEvent *) override
TFSIMD_FORCE_INLINE const tfScalar & y() const
virtual void setAxis(int xAxis, int yAxis)
virtual void setAxis(int xAxis, int yAxis) override
virtual bool end(bool ok=true) override
A state machine for rectangle selections.
void setStateMachine(QwtPickerMachine *)
virtual QwtScaleMap canvasMap(int axisId) const
TFSIMD_FORCE_INLINE const tfScalar & x() const
QwtPlotPicker provides selections on a plot canvas.
QStack< QRectF > zoomStack
const QwtTransform * transformation() const
Get the transformation.
double invTransform(double p) const
bool mouseMatch(MousePatternCode, const QMouseEvent *) const
Compare a mouse event with an event pattern.
int maxStackDepth() const
void setMaxStackDepth(int)
Limit the number of recursive zoom operations to depth.
bool isIncreasing() const
Check if the scale division is increasing( lowerBound() <= upperBound() )
void moveBy(double dx, double dy)
static QRectF qwtExpandedZoomRect(const QRectF &zoomRect, const QSizeF &minSize, const QwtTransform *transformX, const QwtTransform *transformY)
int xAxis() const
Return x axis.
virtual void setZoomBase(bool doReplot=true)
A rectangle ( only for QwtPickerMachine::RectSelection )
virtual void widgetMouseReleaseEvent(QMouseEvent *) override
static QwtInterval qwtExpandedZoomInterval(double v1, double v2, double minRange, const QwtTransform *transform)
virtual void widgetMouseReleaseEvent(QMouseEvent *)
bool keyMatch(KeyPatternCode, const QKeyEvent *) const
Compare a key event with an event pattern.
void init(bool doReplot)
Init the zoomer, used by the constructors.
virtual bool accept(QPolygon &) const override
Check and correct a selected rectangle.
virtual void begin() override
void setAxisScale(int axisId, double min, double max, double step=0)
Disable autoscaling and specify a fixed scale for a selected axis.
void zoomed(const QRectF &rect)
virtual void moveTo(const QPointF &)
Display only when the selection is active.