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 
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
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:37
vtkMeasurementCubeHandleRepresentation3D::SetMaxRelativeCubeScreenArea
void SetMaxRelativeCubeScreenArea(double)
vtkMeasurementCubeHandleRepresentation3D::WaitingForMotion
int WaitingForMotion
Definition: vtkMeasurementCubeHandleRepresentation3D.h:235
vtkFollower
a subclass of actor that always faces the camera
Definition: vtkFollower.h:41
vtkMeasurementCubeHandleRepresentation3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkMeasurementCubeHandleRepresentation3D::MoveFocusRequest
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...
vtkAbstractTransform
superclass for all geometric transformations
Definition: vtkAbstractTransform.h:51
vtkMeasurementCubeHandleRepresentation3D::~vtkMeasurementCubeHandleRepresentation3D
~vtkMeasurementCubeHandleRepresentation3D() override
vtkX3D::scale
@ scale
Definition: vtkX3D.h:235
vtkMeasurementCubeHandleRepresentation3D::SideLength
double SideLength
Definition: vtkMeasurementCubeHandleRepresentation3D.h:243
vtkMeasurementCubeHandleRepresentation3D::Highlight
void Highlight(int highlight) override
Toggle highlighting (used when the cube is selected).
vtkMeasurementCubeHandleRepresentation3D::RegisterPickers
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
vtkMeasurementCubeHandleRepresentation3D::SelectedLabelVisibility
vtkTypeBool SelectedLabelVisibility
Definition: vtkMeasurementCubeHandleRepresentation3D.h:298
vtkMeasurementCubeHandleRepresentation3D::Actor
vtkActor * Actor
Definition: vtkMeasurementCubeHandleRepresentation3D.h:225
vtkMeasurementCubeHandleRepresentation3D::LengthUnit
char * LengthUnit
Definition: vtkMeasurementCubeHandleRepresentation3D.h:244
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:56
vtkMeasurementCubeHandleRepresentation3D::Property
vtkProperty * Property
Definition: vtkMeasurementCubeHandleRepresentation3D.h:233
vtkMeasurementCubeHandleRepresentation3D::GetActors
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes.
vtkMeasurementCubeHandleRepresentation3D::UpdateLabel
virtual void UpdateLabel()
Opportunity to update the label position and text during each render.
vtkMeasurementCubeHandleRepresentation3D::SetDisplayPosition
void SetDisplayPosition(double p[3]) override
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
vtkBillboardTextActor3D
Renders pixel-aligned text, facing the camera, anchored at a 3D point.
Definition: vtkBillboardTextActor3D.h:38
vtkMeasurementCubeHandleRepresentation3D::StartWidgetInteraction
void StartWidgetInteraction(double eventPos[2]) override
vtkHandleRepresentation.h
vtkMeasurementCubeHandleRepresentation3D::UpdateHandle
virtual void UpdateHandle()
Update the actor position.
vtkMeasurementCubeHandleRepresentation3D::New
static vtkMeasurementCubeHandleRepresentation3D * New()
Instantiate this class.
vtkMeasurementCubeHandleRepresentation3D::BuildRepresentation
void BuildRepresentation() override
Methods to make this class properly act like a vtkWidgetRepresentation.
vtkMeasurementCubeHandleRepresentation3D::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Methods to make this class behave as a vtkProp.
vtkMeasurementCubeHandleRepresentation3D::CreateDefaultProperties
void CreateDefaultProperties()
vtkMeasurementCubeHandleRepresentation3D::Scale
virtual void Scale(const double *p1, const double *p2, const double eventPos[2])
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkMeasurementCubeHandleRepresentation3D::SetMinRelativeCubeScreenArea
void SetMinRelativeCubeScreenArea(double)
Set the min/max cube representational area relative to the render window area.
vtkMeasurementCubeHandleRepresentation3D::HandleTransformMatrix
vtkMatrix4x4 * HandleTransformMatrix
Definition: vtkMeasurementCubeHandleRepresentation3D.h:229
vtkMeasurementCubeHandleRepresentation3D::RescaleFactor
double RescaleFactor
Definition: vtkMeasurementCubeHandleRepresentation3D.h:240
vtkMeasurementCubeHandleRepresentation3D::DeepCopy
void DeepCopy(vtkProp *prop) override
vtkMatrixToLinearTransform
convert a matrix to a transform
Definition: vtkMatrixToLinearTransform.h:38
vtkMeasurementCubeHandleRepresentation3D::SetWorldPosition
void SetWorldPosition(double p[3]) override
Set the position of the point in world and display coordinates.
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
vtkMeasurementCubeHandleRepresentation3D::HandleTransform
vtkMatrixToLinearTransform * HandleTransform
Definition: vtkMeasurementCubeHandleRepresentation3D.h:228
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:36
vtkMeasurementCubeHandleRepresentation3D::GetLabelTextInput
virtual char * GetLabelTextInput()
vtkMeasurementCubeHandleRepresentation3D
represent a unit cube for measuring/comparing to data.
Definition: vtkMeasurementCubeHandleRepresentation3D.h:43
vtkMeasurementCubeHandleRepresentation3D::SetUniformScale
virtual void SetUniformScale(double scale)
The handle may be scaled uniformly in all three dimensions using this API.
vtkMeasurementCubeHandleRepresentation3D::ComputeInteractionState
int ComputeInteractionState(int X, int Y, int modify=0) override
vtkMeasurementCubeHandleRepresentation3D::MinRelativeCubeScreenArea
double MinRelativeCubeScreenArea
Definition: vtkMeasurementCubeHandleRepresentation3D.h:241
vtkMeasurementCubeHandleRepresentation3D::HandlePicker
vtkCellPicker * HandlePicker
Definition: vtkMeasurementCubeHandleRepresentation3D.h:230
vtkMeasurementCubeHandleRepresentation3D::WidgetInteraction
void WidgetInteraction(double eventPos[2]) override
vtkTransformPolyDataFilter
transform points and associated normals and vectors for polygonal dataset
Definition: vtkTransformPolyDataFilter.h:46
vtkMeasurementCubeHandleRepresentation3D::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
vtkMeasurementCubeHandleRepresentation3D::LabelText
vtkBillboardTextActor3D * LabelText
Definition: vtkMeasurementCubeHandleRepresentation3D.h:299
vtkMeasurementCubeHandleRepresentation3D::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkMeasurementCubeHandleRepresentation3D::SetLabelTextInput
virtual void SetLabelTextInput(const char *label)
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:45
vtkMeasurementCubeHandleRepresentation3D::vtkMeasurementCubeHandleRepresentation3D
vtkMeasurementCubeHandleRepresentation3D()
vtkMeasurementCubeHandleRepresentation3D::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
vtkMeasurementCubeHandleRepresentation3D::LabelAnnotationTextScaleInitialized
bool LabelAnnotationTextScaleInitialized
Definition: vtkMeasurementCubeHandleRepresentation3D.h:300
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
vtkMeasurementCubeHandleRepresentation3D::SetProperty
void SetProperty(vtkProperty *)
Set/Get the handle properties when unselected and selected.
vtkMeasurementCubeHandleRepresentation3D::SmoothMotion
vtkTypeBool SmoothMotion
Definition: vtkMeasurementCubeHandleRepresentation3D.h:301
vtkMeasurementCubeHandleRepresentation3D::GetBounds
double * GetBounds() override
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
vtkMeasurementCubeHandleRepresentation3D::WaitCount
int WaitCount
Definition: vtkMeasurementCubeHandleRepresentation3D.h:236
vtkMeasurementCubeHandleRepresentation3D::SetSideLength
void SetSideLength(double)
Set the length of a side of the cube (default is 1).
vtkMeasurementCubeHandleRepresentation3D::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkMeasurementCubeHandleRepresentation3D::AdaptiveScaling
vtkTypeBool AdaptiveScaling
Definition: vtkMeasurementCubeHandleRepresentation3D.h:239
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkMeasurementCubeHandleRepresentation3D::LabelVisibility
vtkTypeBool LabelVisibility
Definition: vtkMeasurementCubeHandleRepresentation3D.h:297
vtkMeasurementCubeHandleRepresentation3D::SelectedProperty
vtkProperty * SelectedProperty
Definition: vtkMeasurementCubeHandleRepresentation3D.h:234
vtkMeasurementCubeHandleRepresentation3D::Mapper
vtkPolyDataMapper * Mapper
Definition: vtkMeasurementCubeHandleRepresentation3D.h:226
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:62
vtkMeasurementCubeHandleRepresentation3D::SetSelectedProperty
void SetSelectedProperty(vtkProperty *)
vtkMeasurementCubeHandleRepresentation3D::GetHandle
vtkPolyData * GetHandle()
Get the handle polydata.
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:36
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:67
vtkMeasurementCubeHandleRepresentation3D::HandleTransformFilter
vtkTransformPolyDataFilter * HandleTransformFilter
Definition: vtkMeasurementCubeHandleRepresentation3D.h:227
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:165
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkMeasurementCubeHandleRepresentation3D::ScaleIfNecessary
void ScaleIfNecessary(vtkViewport *)
If adaptive scaling is enabled, rescale the cube so that its representational area in the display win...
vtkMeasurementCubeHandleRepresentation3D::GetTransform
virtual vtkAbstractTransform * GetTransform()
Get the transform used to transform the generic handle polydata before placing it in the render windo...
vtkMeasurementCubeHandleRepresentation3D::MoveFocus
virtual void MoveFocus(const double *p1, const double *p2)
vtkMeasurementCubeHandleRepresentation3D::HandleVisibility
vtkTypeBool HandleVisibility
Definition: vtkMeasurementCubeHandleRepresentation3D.h:237
vtkMeasurementCubeHandleRepresentation3D::MaxRelativeCubeScreenArea
double MaxRelativeCubeScreenArea
Definition: vtkMeasurementCubeHandleRepresentation3D.h:242