qwt_plot_rescaler.h
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #ifndef QWT_PLOT_RESCALER_H
11 #define QWT_PLOT_RESCALER_H
12 
13 #include "qwt_global.h"
14 #include "qwt_plot.h"
15 
16 #include <qobject.h>
17 
18 class QwtPlot;
19 class QwtInterval;
20 class QResizeEvent;
21 
29 class QWT_EXPORT QwtPlotRescaler: public QObject
30 {
31  Q_OBJECT
32 
33 public:
41  {
48 
58 
63  Fitting
64  };
65 
71  {
74 
77 
79  ExpandBoth
80  };
81 
82  explicit QwtPlotRescaler( QWidget *canvas,
83  int referenceAxis = QwtPlot::xBottom,
84  RescalePolicy = Expanding );
85 
86  virtual ~QwtPlotRescaler();
87 
88  void setEnabled( bool );
89  bool isEnabled() const;
90 
91  void setRescalePolicy( RescalePolicy );
92  RescalePolicy rescalePolicy() const;
93 
94  void setExpandingDirection( ExpandingDirection );
95  void setExpandingDirection( int axis, ExpandingDirection );
96  ExpandingDirection expandingDirection( int axis ) const;
97 
98  void setReferenceAxis( int axis );
99  int referenceAxis() const;
100 
101  void setAspectRatio( double ratio );
102  void setAspectRatio( int axis, double ratio );
103  double aspectRatio( int axis ) const;
104 
105  void setIntervalHint( int axis, const QwtInterval& );
106  QwtInterval intervalHint( int axis ) const;
107 
108  QWidget *canvas();
109  const QWidget *canvas() const;
110 
111  QwtPlot *plot();
112  const QwtPlot *plot() const;
113 
114  virtual bool eventFilter( QObject *, QEvent * ) QWT_OVERRIDE;
115 
116  void rescale() const;
117 
118 protected:
119  virtual void canvasResizeEvent( QResizeEvent * );
120 
121  virtual void rescale( const QSize &oldSize, const QSize &newSize ) const;
122  virtual QwtInterval expandScale(
123  int axis, const QSize &oldSize, const QSize &newSize ) const;
124 
125  virtual QwtInterval syncScale(
126  int axis, const QwtInterval& reference,
127  const QSize &size ) const;
128 
129  virtual void updateScales(
130  QwtInterval intervals[QwtPlot::axisCnt] ) const;
131 
132  Qt::Orientation orientation( int axis ) const;
133  QwtInterval interval( int axis ) const;
134  QwtInterval expandInterval( const QwtInterval &,
135  double width, ExpandingDirection ) const;
136 
137 private:
138  double pixelDist( int axis, const QSize & ) const;
139 
140  class AxisData;
141  class PrivateData;
142  PrivateData *d_data;
143 };
144 
145 #endif
A class representing an interval.
Definition: qwt_interval.h:22
#define QWT_EXPORT
Definition: qwt_global.h:38
A 2-D plotting widget.
Definition: qwt_plot.h:75
The lower limit of the scale is adjusted.
basic_reference< false > reference
Definition: forward.hpp:610
QwtPlotRescaler takes care of fixed aspect ratios for plot scales.
The upper limit of the scale is adjusted.
#define QWT_OVERRIDE
Definition: qwt_global.h:53
X axis below the canvas.
Definition: qwt_plot.h:103


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10