VTK
vtkMeasurementCubeHandleRepresentation3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkMeasurementCubeHandleRepresentation3D.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 =========================================================================*/
26 #ifndef vtkMeasurementCubeHandleRepresentation3D_h
27 #define vtkMeasurementCubeHandleRepresentation3D_h
28 
29 #include "vtkInteractionWidgetsModule.h" // For export macro
31 
32 class vtkProperty;
33 class vtkPolyDataMapper;
34 class vtkCellPicker;
37 class vtkMatrix4x4;
38 class vtkPolyData;
40 class vtkActor;
41 class vtkFollower;
43 
44 class VTKINTERACTIONWIDGETS_EXPORT vtkMeasurementCubeHandleRepresentation3D
46 {
47 public:
48 
53 
55 
60  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
62 
64 
67  void SetWorldPosition(double p[3]) VTK_OVERRIDE;
68  void SetDisplayPosition(double p[3]) VTK_OVERRIDE;
70 
72 
75  vtkPolyData * GetHandle();
77 
79 
82  void SetProperty(vtkProperty*);
83  void SetSelectedProperty(vtkProperty*);
84  vtkGetObjectMacro(Property,vtkProperty);
85  vtkGetObjectMacro(SelectedProperty,vtkProperty);
87 
92  virtual vtkAbstractTransform * GetTransform();
93 
95 
98  void BuildRepresentation() VTK_OVERRIDE;
99  void StartWidgetInteraction(double eventPos[2]) VTK_OVERRIDE;
100  void WidgetInteraction(double eventPos[2]) VTK_OVERRIDE;
101  int ComputeInteractionState(int X, int Y, int modify=0) VTK_OVERRIDE;
103 
105 
108  void ShallowCopy(vtkProp *prop) VTK_OVERRIDE;
109  void DeepCopy(vtkProp *prop) VTK_OVERRIDE;
110  void GetActors(vtkPropCollection *) VTK_OVERRIDE;
111  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
112  int RenderOpaqueGeometry(vtkViewport *viewport) VTK_OVERRIDE;
113  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) VTK_OVERRIDE;
114  int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
115  double *GetBounds() VTK_OVERRIDE;
117 
119 
123  vtkSetMacro( LabelVisibility, int );
124  vtkGetMacro( LabelVisibility, int );
125  vtkBooleanMacro( LabelVisibility, int );
126  vtkSetMacro( SelectedLabelVisibility, int );
127  vtkGetMacro( SelectedLabelVisibility, int );
128  vtkBooleanMacro( SelectedLabelVisibility, int );
129 
130  virtual void SetLabelTextInput( const char * label );
131  virtual char * GetLabelTextInput();
133 
135 
138  vtkGetObjectMacro( LabelText, vtkBillboardTextActor3D );
140 
142 
145  vtkSetMacro( HandleVisibility, int );
146  vtkGetMacro( HandleVisibility, int );
147  vtkBooleanMacro( HandleVisibility, int );
149 
151 
154  void Highlight(int highlight) VTK_OVERRIDE;
156 
158 
168  vtkSetMacro( SmoothMotion, int );
169  vtkGetMacro( SmoothMotion, int );
170  vtkBooleanMacro( SmoothMotion, int );
172 
174 
177  void SetSideLength(double);
178  vtkGetMacro( SideLength, double );
180 
182 
185  vtkSetMacro( AdaptiveScaling, int );
186  vtkGetMacro( AdaptiveScaling, int );
187  vtkBooleanMacro( AdaptiveScaling, int );
189 
191 
195  vtkSetClampMacro( RescaleFactor, double, 1., VTK_DOUBLE_MAX );
196  vtkGetMacro( RescaleFactor, double );
198 
200 
207  void SetMinRelativeCubeScreenArea(double);
208  vtkGetMacro( MinRelativeCubeScreenArea, double );
209  void SetMaxRelativeCubeScreenArea(double);
210  vtkGetMacro( MaxRelativeCubeScreenArea, double );
212 
214 
217  vtkSetStringMacro(LengthUnit);
218  vtkGetStringMacro(LengthUnit);
220 
221 protected:
223  ~vtkMeasurementCubeHandleRepresentation3D() VTK_OVERRIDE;
224 
225  vtkActor * Actor;
227  vtkTransformPolyDataFilter * HandleTransformFilter;
228  vtkMatrixToLinearTransform * HandleTransform;
229  vtkMatrix4x4 * HandleTransformMatrix;
230  vtkCellPicker * HandlePicker;
231  double LastPickPosition[3];
232  double LastEventPosition[2];
233  vtkProperty * Property;
234  vtkProperty * SelectedProperty;
235  int WaitingForMotion;
236  int WaitCount;
237  int HandleVisibility;
238  double Offset[3];
239  int AdaptiveScaling;
240  double RescaleFactor;
241  double MinRelativeCubeScreenArea;
242  double MaxRelativeCubeScreenArea;
243  double SideLength;
244  char * LengthUnit;
245 
246  // Register internal Pickers within PickingManager
247  void RegisterPickers() VTK_OVERRIDE;
248 
249  // Methods to manipulate the cursor
250  virtual void Translate(double *p1, double *p2);
251  virtual void Scale(double *p1, double *p2, double eventPos[2]);
252  virtual void MoveFocus(double *p1, double *p2);
253 
254  void CreateDefaultProperties();
255 
261  void ScaleIfNecessary(vtkViewport*);
262 
274  void MoveFocusRequest( double *p1, double *p2,
275  double eventPos[2], double requestedDisplayPos[3] );
276 
282  virtual void SetUniformScale( double scale );
283 
293  virtual void UpdateHandle();
294 
298  virtual void UpdateLabel();
299 
300  // Handle the label.
301  int LabelVisibility;
302  int SelectedLabelVisibility;
303  vtkBillboardTextActor3D *LabelText;
304  bool LabelAnnotationTextScaleInitialized;
305  int SmoothMotion;
306 
307 private:
308  vtkMeasurementCubeHandleRepresentation3D(
309  const vtkMeasurementCubeHandleRepresentation3D&) VTK_DELETE_FUNCTION;
310  void operator=(
311  const vtkMeasurementCubeHandleRepresentation3D&) VTK_DELETE_FUNCTION;
312 };
313 
314 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:50
virtual void SetWorldPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
abstract class for representing widget handles
#define VTK_DOUBLE_MAX
Definition: vtkType.h:167
abstract specification for Viewports
Definition: vtkViewport.h:47
represent surface properties of a geometric object
Definition: vtkProperty.h:64
Renders pixel-aligned text, facing the camera, anchored at a 3D point.
transform points and associated normals and vectors for polygonal dataset
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
an ordered list of Props
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
a simple class to control print indentation
Definition: vtkIndent.h:39
superclass for all geometric transformations
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
represent a unit cube for measuring/comparing to data.
map vtkPolyData to graphics primitives
a subclass of actor that always faces the camera
Definition: vtkFollower.h:46
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:69
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void SetDisplayPosition(double pos[3])
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
convert a matrix to a transform