VTK
vtkAbstractPolygonalHandleRepresentation3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAbstractPolygonalHandleRepresentation3D.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 =========================================================================*/
33 #ifndef __vtkAbstractPolygonalHandleRepresentation3D_h
34 #define __vtkAbstractPolygonalHandleRepresentation3D_h
35 
37 
38 class vtkProperty;
39 class vtkPolyDataMapper;
40 class vtkCellPicker;
43 class vtkMatrix4x4;
44 class vtkPolyData;
46 class vtkActor;
47 class vtkFollower;
48 class vtkVectorText;
49 
52 {
53 public:
54 
56 
58  void PrintSelf(ostream& os, vtkIndent indent);
60 
62 
63  virtual void SetWorldPosition(double p[3]);
64  virtual void SetDisplayPosition(double p[3]);
66 
68 
69  void SetHandle( vtkPolyData * );
70  vtkPolyData * GetHandle();
72 
74 
75  void SetProperty(vtkProperty*);
76  void SetSelectedProperty(vtkProperty*);
77  vtkGetObjectMacro(Property,vtkProperty);
78  vtkGetObjectMacro(SelectedProperty,vtkProperty);
80 
83  virtual vtkAbstractTransform * GetTransform();
84 
86 
88  virtual void BuildRepresentation();
89  virtual void StartWidgetInteraction(double eventPos[2]);
90  virtual void WidgetInteraction(double eventPos[2]);
91  virtual int ComputeInteractionState(int X, int Y, int modify=0);
93 
95 
96  virtual void ShallowCopy(vtkProp *prop);
97  virtual void DeepCopy(vtkProp *prop);
98  virtual void GetActors(vtkPropCollection *);
99  virtual void ReleaseGraphicsResources(vtkWindow *);
100  virtual int RenderOpaqueGeometry(vtkViewport *viewport);
101  virtual int RenderTranslucentPolygonalGeometry(vtkViewport *viewport);
102  virtual int HasTranslucentPolygonalGeometry();
103  virtual double *GetBounds();
105 
107 
109  vtkSetMacro( LabelVisibility, int );
110  vtkGetMacro( LabelVisibility, int );
111  vtkBooleanMacro( LabelVisibility, int );
112  virtual void SetLabelText( const char * label );
113  virtual char * GetLabelText();
115 
117 
118  virtual void SetLabelTextScale( double scale[3] );
119  void SetLabelTextScale(double x, double y, double z)
120  {
121  double scale[3] = {x, y, z};
122  this->SetLabelTextScale(scale);
123  }
124  virtual double * GetLabelTextScale();
126 
128 
129  vtkGetObjectMacro( LabelTextActor, vtkFollower );
131 
135  virtual void SetUniformScale( double scale );
136 
138 
139  vtkSetMacro( HandleVisibility, int );
140  vtkGetMacro( HandleVisibility, int );
141  vtkBooleanMacro( HandleVisibility, int );
143 
144  void Highlight(int highlight);
145 
147 
157  vtkSetMacro( SmoothMotion, int );
158  vtkGetMacro( SmoothMotion, int );
159  vtkBooleanMacro( SmoothMotion, int );
161 
162 protected:
165 
172  double LastPickPosition[3];
173  double LastEventPosition[2];
180 
181 
182  // Methods to manipulate the cursor
183  virtual void Translate(double *p1, double *p2);
184  virtual void Scale(double *p1, double *p2, double eventPos[2]);
185  virtual void MoveFocus(double *p1, double *p2);
186 
187  void CreateDefaultProperties();
188 
189  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
190  // world coordinates), the new display position of the handle center is
191  // populated into requestedDisplayPos. This is again only a request for the
192  // new display position. It is up to the point placer to deduce the
193  // appropriate world co-ordinates that this display position will map into.
194  // The placer may even disallow such a movement.
195  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
196  // as the event position, ie the location of the mouse cursor. If its OFF,
197  // incremental offsets as described above are used to compute it.
198  void MoveFocusRequest( double *p1, double *p2,
199  double eventPos[2], double requestedDisplayPos[3] );
200 
201  int DetermineConstraintAxis(int constraint, double *x, double *startPickPos);
202 
210  virtual void UpdateHandle();
211 
213  virtual void UpdateLabel();
214 
215  // Handle the label.
222 
223 private:
225  void operator=(const vtkAbstractPolygonalHandleRepresentation3D&); //Not implemented
226 };
227 
228 #endif
229 
230