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 =========================================================================*/
23 #ifndef vtkMeasurementCubeHandleRepresentation3D_h
24 #define vtkMeasurementCubeHandleRepresentation3D_h
25 
26 #include "vtkInteractionWidgetsModule.h" // For export macro
28 
29 class vtkProperty;
30 class vtkPolyDataMapper;
31 class vtkCellPicker;
34 class vtkMatrix4x4;
35 class vtkPolyData;
37 class vtkActor;
38 class vtkFollower;
40 
41 class VTKINTERACTIONWIDGETS_EXPORT vtkMeasurementCubeHandleRepresentation3D
43 {
44 public:
45 
50 
52 
57  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
59 
61 
64  void SetWorldPosition(double p[3]) VTK_OVERRIDE;
65  void SetDisplayPosition(double p[3]) VTK_OVERRIDE;
67 
69 
72  vtkPolyData * GetHandle();
74 
76 
79  void SetProperty(vtkProperty*);
80  void SetSelectedProperty(vtkProperty*);
81  vtkGetObjectMacro(Property,vtkProperty);
82  vtkGetObjectMacro(SelectedProperty,vtkProperty);
84 
89  virtual vtkAbstractTransform * GetTransform();
90 
92 
95  void BuildRepresentation() VTK_OVERRIDE;
96  void StartWidgetInteraction(double eventPos[2]) VTK_OVERRIDE;
97  void WidgetInteraction(double eventPos[2]) VTK_OVERRIDE;
98  int ComputeInteractionState(int X, int Y, int modify=0) VTK_OVERRIDE;
100 
102 
105  void ShallowCopy(vtkProp *prop) VTK_OVERRIDE;
106  void DeepCopy(vtkProp *prop) VTK_OVERRIDE;
107  void GetActors(vtkPropCollection *) VTK_OVERRIDE;
108  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
109  int RenderOpaqueGeometry(vtkViewport *viewport) VTK_OVERRIDE;
110  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) VTK_OVERRIDE;
111  int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
112  double *GetBounds() VTK_OVERRIDE;
114 
116 
120  vtkSetMacro( LabelVisibility, int );
121  vtkGetMacro( LabelVisibility, int );
122  vtkBooleanMacro( LabelVisibility, int );
123  vtkSetMacro( SelectedLabelVisibility, int );
124  vtkGetMacro( SelectedLabelVisibility, int );
125  vtkBooleanMacro( SelectedLabelVisibility, int );
126 
127  virtual void SetLabelTextInput( const char * label );
128  virtual char * GetLabelTextInput();
130 
132 
135  vtkGetObjectMacro( LabelText, vtkBillboardTextActor3D );
137 
139 
142  vtkSetMacro( HandleVisibility, int );
143  vtkGetMacro( HandleVisibility, int );
144  vtkBooleanMacro( HandleVisibility, int );
146 
148 
151  void Highlight(int highlight) VTK_OVERRIDE;
153 
155 
165  vtkSetMacro( SmoothMotion, int );
166  vtkGetMacro( SmoothMotion, int );
167  vtkBooleanMacro( SmoothMotion, int );
169 
171 
174  void SetSideLength(double);
175  vtkGetMacro( SideLength, double );
177 
179 
182  vtkSetMacro( AdaptiveScaling, int );
183  vtkGetMacro( AdaptiveScaling, int );
184  vtkBooleanMacro( AdaptiveScaling, int );
186 
188 
192  vtkSetClampMacro( RescaleFactor, double, 1., VTK_DOUBLE_MAX );
193  vtkGetMacro( RescaleFactor, double );
195 
197 
204  void SetMinRelativeCubeScreenArea(double);
205  vtkGetMacro( MinRelativeCubeScreenArea, double );
206  void SetMaxRelativeCubeScreenArea(double);
207  vtkGetMacro( MaxRelativeCubeScreenArea, double );
209 
211 
214  vtkSetStringMacro(LengthUnit);
215  vtkGetStringMacro(LengthUnit);
217 
218 protected:
220  ~vtkMeasurementCubeHandleRepresentation3D() VTK_OVERRIDE;
221 
222  vtkActor * Actor;
224  vtkTransformPolyDataFilter * HandleTransformFilter;
225  vtkMatrixToLinearTransform * HandleTransform;
226  vtkMatrix4x4 * HandleTransformMatrix;
227  vtkCellPicker * HandlePicker;
228  double LastPickPosition[3];
229  double LastEventPosition[2];
230  vtkProperty * Property;
231  vtkProperty * SelectedProperty;
232  int WaitingForMotion;
233  int WaitCount;
234  int HandleVisibility;
235  double Offset[3];
236  int AdaptiveScaling;
237  double RescaleFactor;
238  double MinRelativeCubeScreenArea;
239  double MaxRelativeCubeScreenArea;
240  double SideLength;
241  char * LengthUnit;
242 
243  // Register internal Pickers within PickingManager
244  void RegisterPickers() VTK_OVERRIDE;
245 
246  // Methods to manipulate the cursor
247  virtual void Translate(double *p1, double *p2);
248  virtual void Scale(double *p1, double *p2, double eventPos[2]);
249  virtual void MoveFocus(double *p1, double *p2);
250 
251  void CreateDefaultProperties();
252 
258  void ScaleIfNecessary(vtkViewport*);
259 
271  void MoveFocusRequest( double *p1, double *p2,
272  double eventPos[2], double requestedDisplayPos[3] );
273 
279  virtual void SetUniformScale( double scale );
280 
290  virtual void UpdateHandle();
291 
295  virtual void UpdateLabel();
296 
297  // Handle the label.
298  int LabelVisibility;
299  int SelectedLabelVisibility;
300  vtkBillboardTextActor3D *LabelText;
301  bool LabelAnnotationTextScaleInitialized;
302  int SmoothMotion;
303 
304 private:
305  vtkMeasurementCubeHandleRepresentation3D(
306  const vtkMeasurementCubeHandleRepresentation3D&) VTK_DELETE_FUNCTION;
307  void operator=(
308  const vtkMeasurementCubeHandleRepresentation3D&) VTK_DELETE_FUNCTION;
309 };
310 
311 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
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:45
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
abstract class for representing widget handles
#define VTK_DOUBLE_MAX
Definition: vtkType.h:167
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:58
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:79
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:34
a simple class to control print indentation
Definition: vtkIndent.h:33
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:40
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:63
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