00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00023
00024 #ifndef _vtkQtChartContentsSpace_h
00025 #define _vtkQtChartContentsSpace_h
00026
00027
00028 #include "vtkQtChartExport.h"
00029 #include <QObject>
00030
00031 class vtkQtChartContentsSpaceInternal;
00032 class QPoint;
00033 class QPointF;
00034 class QRectF;
00035
00036
00041 class VTKQTCHART_EXPORT vtkQtChartContentsSpace : public QObject
00042 {
00043 Q_OBJECT
00044
00045 public:
00046 enum ZoomFlags
00047 {
00048 ZoomBoth,
00049 ZoomXOnly,
00050 ZoomYOnly
00051 };
00052
00053 public:
00057 vtkQtChartContentsSpace(QObject *parent=0);
00058 virtual ~vtkQtChartContentsSpace();
00059
00061
00062
00063
00064
00065
00066 float getXOffset() const {return this->OffsetX;}
00067
00072 float getYOffset() const {return this->OffsetY;}
00073
00078 float getMaximumXOffset() const {return this->MaximumX;}
00079
00084 float getMaximumYOffset() const {return this->MaximumY;}
00085
00090 float getContentsWidth() const;
00091
00096 float getContentsHeight() const;
00097
00105 void translateToLayerContents(QPointF &point) const;
00106
00115 void translateToLayerContents(QRectF &area) const;
00117
00119
00120
00121
00122
00123
00124 float getChartWidth() const {return this->Width;}
00125
00130 float getChartHeight() const {return this->Height;}
00131
00140 void setChartSize(float width, float height);
00141
00145 void getChartLayerBounds(QRectF &bounds) const;
00146
00150 void setChartLayerBounds(const QRectF &bounds);
00152
00154
00155
00156
00157
00158
00159 float getXZoomFactor() const {return this->ZoomFactorX;}
00160
00165 float getYZoomFactor() const {return this->ZoomFactorY;}
00166
00171 void zoomToFactor(float factor);
00172
00188 void zoomToFactor(float xFactor, float yFactor);
00189
00194 void zoomToFactorX(float factor);
00195
00200 void zoomToFactorY(float factor);
00201
00205 void zoomIn(ZoomFlags flags);
00206
00210 void zoomOut(ZoomFlags flags);
00212
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223 void startInteraction();
00224
00231 bool isInInteraction() const;
00232
00236 void finishInteraction();
00238
00240
00241
00242
00243
00244
00245 bool isHistoryPreviousAvailable() const;
00246
00251 bool isHistoryNextAvailable() const;
00253
00254 public slots:
00258 void setXOffset(float offset);
00259
00263 void setYOffset(float offset);
00264
00268 void setMaximumXOffset(float maximum);
00269
00273 void setMaximumYOffset(float maximum);
00274
00276 void panUp();
00277
00279 void panDown();
00280
00282 void panLeft();
00283
00285 void panRight();
00286
00288 void resetZoom();
00289
00291 void historyNext();
00292
00294 void historyPrevious();
00295
00296 public:
00303 static float getZoomFactorStep();
00304
00308 static void setZoomFactorStep(float step);
00309
00318 static float getPanStep();
00319
00323 static void setPanStep(float step);
00324
00325 signals:
00329 void xOffsetChanged(float offset);
00330
00334 void yOffsetChanged(float offset);
00335
00344 void maximumChanged(float xMaximum, float yMaximum);
00345
00350 void historyPreviousAvailabilityChanged(bool available);
00351
00356 void historyNextAvailabilityChanged(bool available);
00357
00358 private:
00360 void addHistory();
00361
00362 private:
00364 vtkQtChartContentsSpaceInternal *Internal;
00365 float OffsetX;
00366 float OffsetY;
00367 float MaximumX;
00368 float MaximumY;
00369 float Width;
00370 float Height;
00371 float ZoomFactorX;
00372 float ZoomFactorY;
00373
00374 static float ZoomFactorStep;
00375 static float PanStep;
00376 };
00377
00378 #endif