VTK
dox/Rendering/Context2D/vtkContextTransform.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkContextItem.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 
00028 #ifndef __vtkContextTransform_h
00029 #define __vtkContextTransform_h
00030 
00031 #include "vtkRenderingContext2DModule.h" // For export macro
00032 #include "vtkAbstractContextItem.h"
00033 #include "vtkSmartPointer.h" // Needed for SP ivars.
00034 #include "vtkVector.h" // Needed for ivars.
00035 
00036 class vtkTransform2D;
00037 
00038 class VTKRENDERINGCONTEXT2D_EXPORT vtkContextTransform : public vtkAbstractContextItem
00039 {
00040 public:
00041   vtkTypeMacro(vtkContextTransform, vtkAbstractContextItem);
00042   virtual void PrintSelf(ostream &os, vtkIndent indent);
00043 
00045   static vtkContextTransform *New();
00046 
00050   virtual void Update();
00051 
00053   virtual bool Paint(vtkContext2D *painter);
00054 
00057   virtual void Translate(float dx, float dy);
00058 
00061   virtual void Scale(float dx, float dy);
00062 
00064   virtual void Rotate(float angle);
00065 
00067   virtual vtkTransform2D* GetTransform();
00068 
00070   virtual vtkVector2f MapToParent(const vtkVector2f& point);
00071 
00073   virtual vtkVector2f MapFromParent(const vtkVector2f& point);
00074 
00076 
00078   vtkSetMacro(PanMouseButton, int);
00079   vtkGetMacro(PanMouseButton, int);
00081 
00083 
00085   vtkSetMacro(PanModifier, int);
00086   vtkGetMacro(PanModifier, int);
00088 
00090 
00092   vtkSetMacro(SecondaryPanMouseButton, int);
00093   vtkGetMacro(SecondaryPanMouseButton, int);
00095 
00097 
00099   vtkSetMacro(SecondaryPanModifier, int);
00100   vtkGetMacro(SecondaryPanModifier, int);
00102 
00104 
00106   vtkSetMacro(ZoomMouseButton, int);
00107   vtkGetMacro(ZoomMouseButton, int);
00109 
00111 
00113   vtkSetMacro(ZoomModifier, int);
00114   vtkGetMacro(ZoomModifier, int);
00116 
00118 
00120   vtkSetMacro(SecondaryZoomMouseButton, int);
00121   vtkGetMacro(SecondaryZoomMouseButton, int);
00123 
00125 
00127   vtkSetMacro(SecondaryZoomModifier, int);
00128   vtkGetMacro(SecondaryZoomModifier, int);
00130 
00132 
00133   vtkSetMacro(ZoomOnMouseWheel, bool);
00134   vtkGetMacro(ZoomOnMouseWheel, bool);
00135   vtkBooleanMacro(ZoomOnMouseWheel, bool);
00137 
00139 
00140   vtkSetMacro(PanYOnMouseWheel, bool);
00141   vtkGetMacro(PanYOnMouseWheel, bool);
00142   vtkBooleanMacro(PanYOnMouseWheel, bool);
00144 
00145 //BTX
00147   virtual bool Hit(const vtkContextMouseEvent &mouse);
00148 
00150   virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse);
00151 
00154   virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse);
00155 
00157 
00159   virtual bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta);
00160 //ETX
00162 
00163 //BTX
00164 protected:
00165   vtkContextTransform();
00166   ~vtkContextTransform();
00167 
00168   vtkSmartPointer<vtkTransform2D> Transform;
00169 
00170   int PanMouseButton;
00171   int PanModifier;
00172   int ZoomMouseButton;
00173   int ZoomModifier;
00174   int SecondaryPanMouseButton;
00175   int SecondaryPanModifier;
00176   int SecondaryZoomMouseButton;
00177   int SecondaryZoomModifier;
00178 
00179   bool ZoomOnMouseWheel;
00180   bool PanYOnMouseWheel;
00181 
00182   vtkVector2f ZoomAnchor;
00183 
00184 private:
00185   vtkContextTransform(const vtkContextTransform &); // Not implemented.
00186   void operator=(const vtkContextTransform &);   // Not implemented.
00187 //ETX
00188 };
00189 
00190 #endif //__vtkContextTransform_h