VTK  9.3.0
vtkMeasurementCubeHandleRepresentation3D.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
14 #ifndef vtkMeasurementCubeHandleRepresentation3D_h
15 #define vtkMeasurementCubeHandleRepresentation3D_h
16 
18 #include "vtkInteractionWidgetsModule.h" // For export macro
19 
20 VTK_ABI_NAMESPACE_BEGIN
21 class vtkProperty;
22 class vtkPolyDataMapper;
23 class vtkCellPicker;
26 class vtkMatrix4x4;
27 class vtkPolyData;
29 class vtkActor;
30 class vtkFollower;
32 
33 class VTKINTERACTIONWIDGETS_EXPORT vtkMeasurementCubeHandleRepresentation3D
35 {
36 public:
41 
43 
47  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
54  void SetWorldPosition(double p[3]) override;
55  void SetDisplayPosition(double p[3]) override;
57 
59 
64 
66 
71  vtkGetObjectMacro(Property, vtkProperty);
72  vtkGetObjectMacro(SelectedProperty, vtkProperty);
74 
80 
82 
85  void BuildRepresentation() override;
86  void StartWidgetInteraction(double eventPos[2]) override;
87  void WidgetInteraction(double eventPos[2]) override;
88  int ComputeInteractionState(int X, int Y, int modify = 0) override;
90 
92 
95  void ShallowCopy(vtkProp* prop) override;
96  void DeepCopy(vtkProp* prop) override;
97  void GetActors(vtkPropCollection*) override;
99  int RenderOpaqueGeometry(vtkViewport* viewport) override;
102  double* GetBounds() override;
104 
106 
110  vtkSetMacro(LabelVisibility, vtkTypeBool);
111  vtkGetMacro(LabelVisibility, vtkTypeBool);
112  vtkBooleanMacro(LabelVisibility, vtkTypeBool);
113  vtkSetMacro(SelectedLabelVisibility, vtkTypeBool);
114  vtkGetMacro(SelectedLabelVisibility, vtkTypeBool);
115  vtkBooleanMacro(SelectedLabelVisibility, vtkTypeBool);
116 
117  virtual void SetLabelTextInput(const char* label);
118  virtual char* GetLabelTextInput();
120 
122 
125  vtkGetObjectMacro(LabelText, vtkBillboardTextActor3D);
127 
129 
132  vtkSetMacro(HandleVisibility, vtkTypeBool);
133  vtkGetMacro(HandleVisibility, vtkTypeBool);
134  vtkBooleanMacro(HandleVisibility, vtkTypeBool);
136 
138 
141  void Highlight(int highlight) override;
143 
145 
155  vtkSetMacro(SmoothMotion, vtkTypeBool);
156  vtkGetMacro(SmoothMotion, vtkTypeBool);
157  vtkBooleanMacro(SmoothMotion, vtkTypeBool);
159 
161 
164  void SetSideLength(double);
165  vtkGetMacro(SideLength, double);
167 
169 
172  vtkSetMacro(AdaptiveScaling, vtkTypeBool);
173  vtkGetMacro(AdaptiveScaling, vtkTypeBool);
174  vtkBooleanMacro(AdaptiveScaling, vtkTypeBool);
176 
178 
182  vtkSetClampMacro(RescaleFactor, double, 1., VTK_DOUBLE_MAX);
183  vtkGetMacro(RescaleFactor, double);
185 
187 
195  vtkGetMacro(MinRelativeCubeScreenArea, double);
197  vtkGetMacro(MaxRelativeCubeScreenArea, double);
199 
201 
204  vtkSetStringMacro(LengthUnit);
205  vtkGetStringMacro(LengthUnit);
207 
208  /*
209  * Register internal Pickers within PickingManager
210  */
211  void RegisterPickers() override;
212 
213 protected:
216 
223  double LastPickPosition[3];
224  double LastEventPosition[2];
230  double Offset[3];
235  double SideLength;
236  char* LengthUnit;
237 
238  // Methods to manipulate the cursor
239  virtual void Scale(const double* p1, const double* p2, const double eventPos[2]);
240  virtual void MoveFocus(const double* p1, const double* p2);
241 
243 
250 
263  const double* p1, const double* p2, const double eventPos[2], double requestedDisplayPos[3]);
264 
270  virtual void SetUniformScale(double scale);
271 
281  virtual void UpdateHandle();
282 
286  virtual void UpdateLabel();
287 
288  // Handle the label.
294 
295 private:
298  void operator=(const vtkMeasurementCubeHandleRepresentation3D&) = delete;
299 };
300 
301 VTK_ABI_NAMESPACE_END
302 #endif
superclass for all geometric transformations
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:50
Renders pixel-aligned text, facing the camera, anchored at a 3D point.
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:71
a subclass of actor that always faces the camera
Definition: vtkFollower.h:42
abstract class for representing widget handles
a simple class to control print indentation
Definition: vtkIndent.h:38
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:40
convert a matrix to a transform
represent a unit cube for measuring/comparing to data.
void BuildRepresentation() override
Methods to make this class properly act like a vtkWidgetRepresentation.
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
Methods to make this class behave as a vtkProp.
void SetSelectedProperty(vtkProperty *)
Set/Get the handle properties when unselected and selected.
void GetActors(vtkPropCollection *) override
Methods to make this class behave as a vtkProp.
int RenderOpaqueGeometry(vtkViewport *viewport) override
Methods to make this class behave as a vtkProp.
int ComputeInteractionState(int X, int Y, int modify=0) override
Methods to make this class properly act like a vtkWidgetRepresentation.
virtual void SetLabelTextInput(const char *label)
A label may be associated with the cube.
virtual vtkAbstractTransform * GetTransform()
Get the transform used to transform the generic handle polydata before placing it in the render windo...
virtual void Scale(const double *p1, const double *p2, const double eventPos[2])
void SetMinRelativeCubeScreenArea(double)
Set the min/max cube representational area relative to the render window area.
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
void SetMaxRelativeCubeScreenArea(double)
Set the min/max cube representational area relative to the render window area.
void ScaleIfNecessary(vtkViewport *)
If adaptive scaling is enabled, rescale the cube so that its representational area in the display win...
static vtkMeasurementCubeHandleRepresentation3D * New()
Instantiate this class.
void SetSideLength(double)
Set the length of a side of the cube (default is 1).
virtual void MoveFocus(const double *p1, const double *p2)
void SetProperty(vtkProperty *)
Set/Get the handle properties when unselected and selected.
vtkPolyData * GetHandle()
Get the handle polydata.
virtual void SetUniformScale(double scale)
The handle may be scaled uniformly in all three dimensions using this API.
void StartWidgetInteraction(double eventPos[2]) override
Methods to make this class properly act like a vtkWidgetRepresentation.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods to make this class behave as a vtkProp.
virtual char * GetLabelTextInput()
A label may be associated with the cube.
double * GetBounds() override
Methods to make this class behave as a vtkProp.
void Highlight(int highlight) override
Toggle highlighting (used when the cube is selected).
void ShallowCopy(vtkProp *prop) override
Methods to make this class behave as a vtkProp.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
void DeepCopy(vtkProp *prop) override
Methods to make this class behave as a vtkProp.
void MoveFocusRequest(const double *p1, const double *p2, const double eventPos[2], double requestedDisplayPos[3])
Given a motion vector defined by p1 --> p2 (p1 and p2 are in world coordinates), the new display posi...
void SetDisplayPosition(double p[3]) override
Set the position of the point in world and display coordinates.
virtual void UpdateLabel()
Opportunity to update the label position and text during each render.
virtual void UpdateHandle()
Update the actor position.
void WidgetInteraction(double eventPos[2]) override
Methods to make this class properly act like a vtkWidgetRepresentation.
void SetWorldPosition(double p[3]) override
Set the position of the point in world and display coordinates.
void ReleaseGraphicsResources(vtkWindow *) override
Methods to make this class behave as a vtkProp.
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:55
represent surface properties of a geometric object
Definition: vtkProperty.h:66
transform points and associated normals and vectors for polygonal dataset
abstract specification for Viewports
Definition: vtkViewport.h:54
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
@ scale
Definition: vtkX3D.h:229
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_DOUBLE_MAX
Definition: vtkType.h:154