VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkQtChartContentsSpace.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*------------------------------------------------------------------------- 00016 Copyright 2008 Sandia Corporation. 00017 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00018 the U.S. Government retains certain rights in this software. 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: 00049 vtkQtChartContentsSpace(QObject *parent=0); 00050 virtual ~vtkQtChartContentsSpace(); 00051 00053 00054 00055 00056 00057 00058 float getXOffset() const {return this->OffsetX;} 00059 00064 float getYOffset() const {return this->OffsetY;} 00065 00070 float getMaximumXOffset() const {return this->MaximumX;} 00071 00076 float getMaximumYOffset() const {return this->MaximumY;} 00077 00082 float getContentsWidth() const; 00083 00088 float getContentsHeight() const; 00089 00097 void translateToLayerContents(QPointF &point) const; 00098 00107 void translateToLayerContents(QRectF &area) const; 00109 00111 00112 00113 00114 00115 00116 float getChartWidth() const {return this->Width;} 00117 00122 float getChartHeight() const {return this->Height;} 00123 00132 void setChartSize(float width, float height); 00133 00137 void getChartLayerBounds(QRectF &bounds) const; 00138 00142 void setChartLayerBounds(const QRectF &bounds); 00144 00146 00147 00148 00149 00150 00151 float getXZoomFactor() const {return this->ZoomFactorX;} 00152 00157 float getYZoomFactor() const {return this->ZoomFactorY;} 00158 00163 void zoomToFactor(float factor); 00164 00180 void zoomToFactor(float xFactor, float yFactor); 00181 00186 void zoomToFactorX(float factor); 00187 00192 void zoomToFactorY(float factor); 00194 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 void startInteraction(); 00206 00213 bool isInInteraction() const; 00214 00218 void finishInteraction(); 00220 00222 00223 00224 00225 00226 00227 bool isHistoryPreviousAvailable() const; 00228 00233 bool isHistoryNextAvailable() const; 00235 00236 public slots: 00240 void setXOffset(float offset); 00241 00245 void setYOffset(float offset); 00246 00250 void setMaximumXOffset(float maximum); 00251 00255 void setMaximumYOffset(float maximum); 00256 00258 void panUp(); 00259 00261 void panDown(); 00262 00264 void panLeft(); 00265 00267 void panRight(); 00268 00270 void resetZoom(); 00271 00273 void historyNext(); 00274 00276 void historyPrevious(); 00277 00278 public: 00283 static float getZoomFactorStep(); 00284 00288 static void setZoomFactorStep(float step); 00289 00298 static float getPanStep(); 00299 00303 static void setPanStep(float step); 00304 00305 signals: 00309 void xOffsetChanged(float offset); 00310 00314 void yOffsetChanged(float offset); 00315 00324 void maximumChanged(float xMaximum, float yMaximum); 00325 00330 void historyPreviousAvailabilityChanged(bool available); 00331 00336 void historyNextAvailabilityChanged(bool available); 00337 00338 private: 00340 void addHistory(); 00341 00342 private: 00344 vtkQtChartContentsSpaceInternal *Internal; 00345 float OffsetX; 00346 float OffsetY; 00347 float MaximumX; 00348 float MaximumY; 00349 float Width; 00350 float Height; 00351 float ZoomFactorX; 00352 float ZoomFactorY; 00353 00354 static float ZoomFactorStep; 00355 static float PanStep; 00356 }; 00357 00358 #endif