VTK
vtkQtChartContentsSpace.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQtChartContentsSpace.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
20 
23 
24 #ifndef _vtkQtChartContentsSpace_h
25 #define _vtkQtChartContentsSpace_h
26 
27 
28 #include "vtkQtChartExport.h"
29 #include <QObject>
30 
31 class vtkQtChartContentsSpaceInternal;
32 class QPoint;
33 class QPointF;
34 class QRectF;
35 
36 
41 class VTKQTCHART_EXPORT vtkQtChartContentsSpace : public QObject
42 {
43  Q_OBJECT
44 
45 public:
49  vtkQtChartContentsSpace(QObject *parent=0);
50  virtual ~vtkQtChartContentsSpace();
51 
53 
54  float getXOffset() const {return this->OffsetX;}
59 
64  float getYOffset() const {return this->OffsetY;}
65 
70  float getMaximumXOffset() const {return this->MaximumX;}
71 
76  float getMaximumYOffset() const {return this->MaximumY;}
77 
82  float getContentsWidth() const;
83 
88  float getContentsHeight() const;
89 
97  void translateToLayerContents(QPointF &point) const;
98 
107  void translateToLayerContents(QRectF &area) const;
109 
111 
112  float getChartWidth() const {return this->Width;}
117 
122  float getChartHeight() const {return this->Height;}
123 
132  void setChartSize(float width, float height);
133 
137  void getChartLayerBounds(QRectF &bounds) const;
138 
142  void setChartLayerBounds(const QRectF &bounds);
144 
146 
147  float getXZoomFactor() const {return this->ZoomFactorX;}
152 
157  float getYZoomFactor() const {return this->ZoomFactorY;}
158 
163  void zoomToFactor(float factor);
164 
180  void zoomToFactor(float xFactor, float yFactor);
181 
186  void zoomToFactorX(float factor);
187 
192  void zoomToFactorY(float factor);
194 
196 
197  void startInteraction();
206 
213  bool isInInteraction() const;
214 
218  void finishInteraction();
220 
222 
223  bool isHistoryPreviousAvailable() const;
228 
233  bool isHistoryNextAvailable() const;
235 
236 public slots:
240  void setXOffset(float offset);
241 
245  void setYOffset(float offset);
246 
250  void setMaximumXOffset(float maximum);
251 
255  void setMaximumYOffset(float maximum);
256 
258  void panUp();
259 
261  void panDown();
262 
264  void panLeft();
265 
267  void panRight();
268 
270  void resetZoom();
271 
273  void historyNext();
274 
276  void historyPrevious();
277 
278 public:
283  static float getZoomFactorStep();
284 
288  static void setZoomFactorStep(float step);
289 
298  static float getPanStep();
299 
303  static void setPanStep(float step);
304 
305 signals:
309  void xOffsetChanged(float offset);
310 
314  void yOffsetChanged(float offset);
315 
324  void maximumChanged(float xMaximum, float yMaximum);
325 
330  void historyPreviousAvailabilityChanged(bool available);
331 
336  void historyNextAvailabilityChanged(bool available);
337 
338 private:
340  void addHistory();
341 
342 private:
344  vtkQtChartContentsSpaceInternal *Internal;
345  float OffsetX;
346  float OffsetY;
347  float MaximumX;
348  float MaximumY;
349  float Width;
350  float Height;
351  float ZoomFactorX;
352  float ZoomFactorY;
353 
354  static float ZoomFactorStep;
355  static float PanStep;
356 };
357 
358 #endif