VTK  9.0.2
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 
72 
74 
79  vtkGetObjectMacro(Property, vtkProperty);
80  vtkGetObjectMacro(SelectedProperty, vtkProperty);
82 
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;
107  int RenderOpaqueGeometry(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 
203  vtkGetMacro(MinRelativeCubeScreenArea, 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 
251 
258 
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
superclass for all geometric transformations
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
Renders pixel-aligned text, facing the camera, anchored at a 3D point.
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:67
a subclass of actor that always faces the camera
Definition: vtkFollower.h:41
abstract class for representing widget handles
a simple class to control print indentation
Definition: vtkIndent.h:34
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:36
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
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes.
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
int ComputeInteractionState(int X, int Y, int modify=0) override
virtual void SetLabelTextInput(const char *label)
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 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
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
double * GetBounds() override
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
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
Methods invoked by print to print information about the object including superclasses.
void DeepCopy(vtkProp *prop) override
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
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
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
void SetWorldPosition(double p[3]) override
Set the position of the point in world and display coordinates.
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:54
represent surface properties of a geometric object
Definition: vtkProperty.h:62
transform points and associated normals and vectors for polygonal dataset
abstract specification for Viewports
Definition: vtkViewport.h:45
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
@ scale
Definition: vtkX3D.h:235
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165