VTK  9.0.1
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 
27 #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:
49 
51 
55  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
59 
62  void SetWorldPosition(double p[3]) override;
63  void SetDisplayPosition(double p[3]) override;
65 
67 
70  vtkPolyData* GetHandle();
72 
74 
77  void SetProperty(vtkProperty*);
78  void SetSelectedProperty(vtkProperty*);
79  vtkGetObjectMacro(Property, vtkProperty);
80  vtkGetObjectMacro(SelectedProperty, vtkProperty);
82 
87  virtual vtkAbstractTransform* GetTransform();
88 
90 
93  void BuildRepresentation() override;
94  void StartWidgetInteraction(double eventPos[2]) override;
95  void WidgetInteraction(double eventPos[2]) override;
96  int ComputeInteractionState(int X, int Y, int modify = 0) override;
98 
100 
103  void ShallowCopy(vtkProp* prop) override;
104  void DeepCopy(vtkProp* prop) override;
105  void GetActors(vtkPropCollection*) override;
106  void ReleaseGraphicsResources(vtkWindow*) override;
107  int RenderOpaqueGeometry(vtkViewport* viewport) override;
108  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
110  double* GetBounds() override;
112 
114 
118  vtkSetMacro(LabelVisibility, vtkTypeBool);
119  vtkGetMacro(LabelVisibility, vtkTypeBool);
120  vtkBooleanMacro(LabelVisibility, vtkTypeBool);
121  vtkSetMacro(SelectedLabelVisibility, vtkTypeBool);
122  vtkGetMacro(SelectedLabelVisibility, vtkTypeBool);
123  vtkBooleanMacro(SelectedLabelVisibility, vtkTypeBool);
124 
125  virtual void SetLabelTextInput(const char* label);
126  virtual char* GetLabelTextInput();
128 
130 
133  vtkGetObjectMacro(LabelText, vtkBillboardTextActor3D);
135 
137 
140  vtkSetMacro(HandleVisibility, vtkTypeBool);
141  vtkGetMacro(HandleVisibility, vtkTypeBool);
142  vtkBooleanMacro(HandleVisibility, vtkTypeBool);
144 
146 
149  void Highlight(int highlight) override;
151 
153 
163  vtkSetMacro(SmoothMotion, vtkTypeBool);
164  vtkGetMacro(SmoothMotion, vtkTypeBool);
165  vtkBooleanMacro(SmoothMotion, vtkTypeBool);
167 
169 
172  void SetSideLength(double);
173  vtkGetMacro(SideLength, double);
175 
177 
180  vtkSetMacro(AdaptiveScaling, vtkTypeBool);
181  vtkGetMacro(AdaptiveScaling, vtkTypeBool);
182  vtkBooleanMacro(AdaptiveScaling, vtkTypeBool);
184 
186 
190  vtkSetClampMacro(RescaleFactor, double, 1., VTK_DOUBLE_MAX);
191  vtkGetMacro(RescaleFactor, double);
193 
195 
202  void SetMinRelativeCubeScreenArea(double);
203  vtkGetMacro(MinRelativeCubeScreenArea, double);
204  void SetMaxRelativeCubeScreenArea(double);
205  vtkGetMacro(MaxRelativeCubeScreenArea, double);
207 
209 
212  vtkSetStringMacro(LengthUnit);
213  vtkGetStringMacro(LengthUnit);
215 
216  /*
217  * Register internal Pickers within PickingManager
218  */
219  void RegisterPickers() override;
220 
221 protected:
224 
231  double LastPickPosition[3];
232  double LastEventPosition[2];
238  double Offset[3];
243  double SideLength;
244  char* LengthUnit;
245 
246  // Methods to manipulate the cursor
247  virtual void Scale(const double* p1, const double* p2, const double eventPos[2]);
248  virtual void MoveFocus(const double* p1, const double* p2);
249 
250  void CreateDefaultProperties();
251 
257  void ScaleIfNecessary(vtkViewport*);
258 
270  void MoveFocusRequest(
271  const double* p1, const double* p2, const double eventPos[2], double requestedDisplayPos[3]);
272 
278  virtual void SetUniformScale(double scale);
279 
289  virtual void UpdateHandle();
290 
294  virtual void UpdateLabel();
295 
296  // Handle the label.
302 
303 private:
306  void operator=(const vtkMeasurementCubeHandleRepresentation3D&) = delete;
307 };
308 
309 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
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
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract class for representing widget handles
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165
abstract specification for Viewports
Definition: vtkViewport.h:44
represent surface properties of a geometric object
Definition: vtkProperty.h:61
virtual void StartWidgetInteraction(double eventPos[2])
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:84
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.
double * GetBounds() override
Methods to make this class behave as a vtkProp.
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
a simple class to control print indentation
Definition: vtkIndent.h:33
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
superclass for all geometric transformations
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
virtual void WidgetInteraction(double newEventPos[2])
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
represent a unit cube for measuring/comparing to data.
virtual void DeepCopy(vtkProp *prop)
Methods to make this class properly act like a vtkWidgetRepresentation.
map vtkPolyData to graphics primitives
a subclass of actor that always faces the camera
Definition: vtkFollower.h:40
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:66
void ShallowCopy(vtkProp *prop) override
Methods to make this class properly act like a vtkWidgetRepresentation.
virtual void Highlight(int vtkNotUsed(highlightOn))
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes...
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