VTK
vtkAffineRepresentation2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAffineRepresentation2D.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 =========================================================================*/
46 #ifndef __vtkAffineRepresentation2D_h
47 #define __vtkAffineRepresentation2D_h
48 
50 
51 class vtkProperty2D;
52 class vtkActor2D;
54 class vtkPolyData;
55 class vtkPoints;
56 class vtkCellArray;
57 class vtkTextProperty;
58 class vtkLeaderActor2D;
59 class vtkTextMapper;
60 class vtkActor2D;
61 
62 
64 {
65 public:
68 
70 
72  void PrintSelf(ostream& os, vtkIndent indent);
74 
76 
81  vtkSetClampMacro(BoxWidth,int,10,VTK_LARGE_INTEGER);
82  vtkGetMacro(BoxWidth,int);
83  vtkSetClampMacro(CircleWidth,int,10,VTK_LARGE_INTEGER);
84  vtkGetMacro(CircleWidth,int);
85  vtkSetClampMacro(AxesWidth,int,10,VTK_LARGE_INTEGER);
86  vtkGetMacro(AxesWidth,int);
88 
90 
93  void SetOrigin(double o[3]) {this->SetOrigin(o[0],o[1],o[2]);}
94  void SetOrigin(double ox, double oy, double oz);
95  vtkGetVector3Macro(Origin,double);
97 
104  virtual void GetTransform(vtkTransform *t);
105 
107 
108  void SetProperty(vtkProperty2D*);
109  void SetSelectedProperty(vtkProperty2D*);
110  void SetTextProperty(vtkTextProperty*);
111  vtkGetObjectMacro(Property,vtkProperty2D);
112  vtkGetObjectMacro(SelectedProperty,vtkProperty2D);
113  vtkGetObjectMacro(TextProperty,vtkTextProperty);
115 
117 
121  vtkSetMacro(DisplayText,int);
122  vtkGetMacro(DisplayText,int);
123  vtkBooleanMacro(DisplayText,int);
125 
127 
132  virtual void PlaceWidget(double bounds[6]);
133  virtual void StartWidgetInteraction(double eventPos[2]);
134  virtual void WidgetInteraction(double eventPos[2]);
135  virtual void EndWidgetInteraction(double eventPos[2]);
136  virtual int ComputeInteractionState(int X, int Y, int modify=0);
137  virtual void BuildRepresentation();
139 
141 
142  virtual void ShallowCopy(vtkProp *prop);
143  virtual void GetActors2D(vtkPropCollection *);
144  virtual void ReleaseGraphicsResources(vtkWindow *);
145  virtual int RenderOverlay(vtkViewport *viewport);
147 
148 protected:
151 
152  // Methods to manipulate the cursor
153  void Translate(double eventPos[2]);
154  void Scale(double eventPos[2]);
155  void Rotate(double eventPos[2]);
156  void Shear(double eventPos[2]);
157  void Highlight(int highlight);
158  void UpdateText(const char *text, double eventPos[2]);
159 
160  // The width of the widget in normalized viewport coordinates.
161  int BoxWidth;
164 
165  // Display text
167 
168  // Internal variables for bookkeeping (in display coordinates unless noted)
169  double CurrentWidth;
172 
173  // The internal transformation matrix
177  double Origin[4]; //the current origin in world coordinates
178  double DisplayOrigin[3]; //the current origin in display coordinates
179  double CurrentTranslation[3]; //translation this movement
180  double StartWorldPosition[4]; //Start event position converted to world
181  double StartAngle; //The starting angle (always positive)
182  double CurrentAngle;
183  double CurrentScale[2];
184  double CurrentShear[2];
185  void ApplyShear(); //helper method to apply shear to matrix
186 
187  // Properties used to control the appearance of selected objects and
188  // the manipulator in general.
192  void CreateDefaultProperties();
193  double Opacity;
195 
196  // Support picking
197  double LastEventPosition[2];
198 
199  // These are the classes that form the geometric representation -----------
200  // The label
203 
204  // The outer box
210 
216 
217  // The circle
223 
229 
230  // The translation axes
235 
236 private:
237  vtkAffineRepresentation2D(const vtkAffineRepresentation2D&); //Not implemented
238  void operator=(const vtkAffineRepresentation2D&); //Not implemented
239 };
240 
241 #endif