qwt_plot_rescaler.h
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ***************************** 00002 * Qwt Widget Library 00003 * Copyright (C) 1997 Josef Wilgen 00004 * Copyright (C) 2002 Uwe Rathmann 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the Qwt License, Version 1.0 00008 *****************************************************************************/ 00009 00010 #ifndef QWT_PLOT_RESCALER_H 00011 #define QWT_PLOT_RESCALER_H 1 00012 00013 #include "qwt_global.h" 00014 #include "qwt_double_rect.h" 00015 #include "qwt_double_interval.h" 00016 #include "qwt_plot.h" 00017 #include <qobject.h> 00018 00019 class QwtPlotCanvas; 00020 class QResizeEvent; 00021 00029 class QWT_EXPORT QwtPlotRescaler: public QObject 00030 { 00031 public: 00058 enum RescalePolicy 00059 { 00060 Fixed, 00061 Expanding, 00062 Fitting 00063 }; 00064 00065 enum ExpandingDirection 00066 { 00067 ExpandUp, 00068 ExpandDown, 00069 ExpandBoth 00070 }; 00071 00072 explicit QwtPlotRescaler(QwtPlotCanvas *, 00073 int referenceAxis = QwtPlot::xBottom, 00074 RescalePolicy = Expanding ); 00075 00076 virtual ~QwtPlotRescaler(); 00077 00078 void setEnabled(bool); 00079 bool isEnabled() const; 00080 00081 void setRescalePolicy(RescalePolicy); 00082 RescalePolicy rescalePolicy() const; 00083 00084 void setExpandingDirection(ExpandingDirection); 00085 void setExpandingDirection(int axis, ExpandingDirection); 00086 ExpandingDirection expandingDirection(int axis) const; 00087 00088 void setReferenceAxis(int axis); 00089 int referenceAxis() const; 00090 00091 void setAspectRatio(double ratio); 00092 void setAspectRatio(int axis, double ratio); 00093 double aspectRatio(int axis) const; 00094 00095 void setIntervalHint(int axis, const QwtDoubleInterval&); 00096 QwtDoubleInterval intervalHint(int axis) const; 00097 00098 QwtPlotCanvas *canvas(); 00099 const QwtPlotCanvas *canvas() const; 00100 00101 QwtPlot *plot(); 00102 const QwtPlot *plot() const; 00103 00104 virtual bool eventFilter(QObject *, QEvent *); 00105 00106 void rescale() const; 00107 00108 protected: 00109 virtual void canvasResizeEvent(QResizeEvent *); 00110 00111 virtual void rescale(const QSize &oldSize, const QSize &newSize) const; 00112 virtual QwtDoubleInterval expandScale( int axis, 00113 const QSize &oldSize, const QSize &newSize) const; 00114 00115 virtual QwtDoubleInterval syncScale( 00116 int axis, const QwtDoubleInterval& reference, 00117 const QSize &size) const; 00118 00119 virtual void updateScales( 00120 QwtDoubleInterval intervals[QwtPlot::axisCnt]) const; 00121 00122 Qt::Orientation orientation(int axis) const; 00123 QwtDoubleInterval interval(int axis) const; 00124 QwtDoubleInterval expandInterval(const QwtDoubleInterval &, 00125 double width, ExpandingDirection) const; 00126 00127 private: 00128 double pixelDist(int axis, const QSize &) const; 00129 00130 class AxisData; 00131 class PrivateData; 00132 PrivateData *d_data; 00133 }; 00134 00135 #endif
Generated on Wed Sep 2 18:37:22 2009 for Qwt User's Guide by 1.6.1