VTK  9.2.5
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 
30 #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:
52 
54 
58  void PrintSelf(ostream& os, vtkIndent indent) override;
60 
62 
65  void SetWorldPosition(double p[3]) override;
66  void SetDisplayPosition(double p[3]) override;
68 
70 
75 
77 
82  vtkGetObjectMacro(Property, vtkProperty);
83  vtkGetObjectMacro(SelectedProperty, vtkProperty);
85 
91 
93 
96  void BuildRepresentation() override;
97  void StartWidgetInteraction(double eventPos[2]) override;
98  void WidgetInteraction(double eventPos[2]) override;
99  int ComputeInteractionState(int X, int Y, int modify = 0) override;
101 
103 
106  void ShallowCopy(vtkProp* prop) override;
107  void DeepCopy(vtkProp* prop) override;
108  void GetActors(vtkPropCollection*) override;
110  int RenderOpaqueGeometry(vtkViewport* viewport) override;
113  double* GetBounds() override;
115 
117 
121  vtkSetMacro(LabelVisibility, vtkTypeBool);
122  vtkGetMacro(LabelVisibility, vtkTypeBool);
123  vtkBooleanMacro(LabelVisibility, vtkTypeBool);
124  vtkSetMacro(SelectedLabelVisibility, vtkTypeBool);
125  vtkGetMacro(SelectedLabelVisibility, vtkTypeBool);
126  vtkBooleanMacro(SelectedLabelVisibility, vtkTypeBool);
127 
128  virtual void SetLabelTextInput(const char* label);
129  virtual char* GetLabelTextInput();
131 
133 
136  vtkGetObjectMacro(LabelText, vtkBillboardTextActor3D);
138 
140 
143  vtkSetMacro(HandleVisibility, vtkTypeBool);
144  vtkGetMacro(HandleVisibility, vtkTypeBool);
145  vtkBooleanMacro(HandleVisibility, vtkTypeBool);
147 
149 
152  void Highlight(int highlight) override;
154 
156 
166  vtkSetMacro(SmoothMotion, vtkTypeBool);
167  vtkGetMacro(SmoothMotion, vtkTypeBool);
168  vtkBooleanMacro(SmoothMotion, vtkTypeBool);
170 
172 
175  void SetSideLength(double);
176  vtkGetMacro(SideLength, double);
178 
180 
183  vtkSetMacro(AdaptiveScaling, vtkTypeBool);
184  vtkGetMacro(AdaptiveScaling, vtkTypeBool);
185  vtkBooleanMacro(AdaptiveScaling, vtkTypeBool);
187 
189 
193  vtkSetClampMacro(RescaleFactor, double, 1., VTK_DOUBLE_MAX);
194  vtkGetMacro(RescaleFactor, double);
196 
198 
206  vtkGetMacro(MinRelativeCubeScreenArea, double);
208  vtkGetMacro(MaxRelativeCubeScreenArea, double);
210 
212 
215  vtkSetStringMacro(LengthUnit);
216  vtkGetStringMacro(LengthUnit);
218 
219  /*
220  * Register internal Pickers within PickingManager
221  */
222  void RegisterPickers() override;
223 
224 protected:
227 
234  double LastPickPosition[3];
235  double LastEventPosition[2];
241  double Offset[3];
246  double SideLength;
247  char* LengthUnit;
248 
249  // Methods to manipulate the cursor
250  virtual void Scale(const double* p1, const double* p2, const double eventPos[2]);
251  virtual void MoveFocus(const double* p1, const double* p2);
252 
254 
261 
274  const double* p1, const double* p2, const double eventPos[2], double requestedDisplayPos[3]);
275 
281  virtual void SetUniformScale(double scale);
282 
292  virtual void UpdateHandle();
293 
297  virtual void UpdateLabel();
298 
299  // Handle the label.
305 
306 private:
309  void operator=(const vtkMeasurementCubeHandleRepresentation3D&) = delete;
310 };
311 
312 #endif
superclass for all geometric transformations
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
Renders pixel-aligned text, facing the camera, anchored at a 3D point.
ray-cast cell picker for all kinds of Prop3Ds
a subclass of actor that always faces the camera
Definition: vtkFollower.h:123
abstract class for representing widget handles
a simple class to control print indentation
Definition: vtkIndent.h:119
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:151
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:200
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
represent surface properties of a geometric object
Definition: vtkProperty.h:177
transform points and associated normals and vectors for polygonal dataset
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ scale
Definition: vtkX3D.h:235
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165