VTK
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 
29 #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:
48 
53 
55 
60  void PrintSelf(ostream& os, vtkIndent indent) override;
62 
64 
67  void SetWorldPosition(double p[3]) override;
68  void SetDisplayPosition(double p[3]) override;
70 
72 
77 
79 
84  vtkGetObjectMacro(Property,vtkProperty);
85  vtkGetObjectMacro(SelectedProperty,vtkProperty);
87 
93 
95 
98  void BuildRepresentation() override;
99  void StartWidgetInteraction(double eventPos[2]) override;
100  void WidgetInteraction(double eventPos[2]) override;
101  int ComputeInteractionState(int X, int Y, int modify=0) override;
103 
105 
108  void ShallowCopy(vtkProp *prop) override;
109  void DeepCopy(vtkProp *prop) override;
110  void GetActors(vtkPropCollection *) override;
112  int RenderOpaqueGeometry(vtkViewport *viewport) override;
115  double *GetBounds() override;
117 
119 
123  vtkSetMacro( LabelVisibility, vtkTypeBool );
124  vtkGetMacro( LabelVisibility, vtkTypeBool );
125  vtkBooleanMacro( LabelVisibility, vtkTypeBool );
126  vtkSetMacro( SelectedLabelVisibility, vtkTypeBool );
127  vtkGetMacro( SelectedLabelVisibility, vtkTypeBool );
128  vtkBooleanMacro( SelectedLabelVisibility, vtkTypeBool );
129 
130  virtual void SetLabelTextInput( const char * label );
131  virtual char * GetLabelTextInput();
133 
135 
138  vtkGetObjectMacro( LabelText, vtkBillboardTextActor3D );
140 
142 
145  vtkSetMacro( HandleVisibility, vtkTypeBool );
146  vtkGetMacro( HandleVisibility, vtkTypeBool );
147  vtkBooleanMacro( HandleVisibility, vtkTypeBool );
149 
151 
154  void Highlight(int highlight) override;
156 
158 
168  vtkSetMacro( SmoothMotion, vtkTypeBool );
169  vtkGetMacro( SmoothMotion, vtkTypeBool );
170  vtkBooleanMacro( SmoothMotion, vtkTypeBool );
172 
174 
177  void SetSideLength(double);
178  vtkGetMacro( SideLength, double );
180 
182 
185  vtkSetMacro( AdaptiveScaling, vtkTypeBool );
186  vtkGetMacro( AdaptiveScaling, vtkTypeBool );
187  vtkBooleanMacro( AdaptiveScaling, vtkTypeBool );
189 
191 
195  vtkSetClampMacro( RescaleFactor, double, 1., VTK_DOUBLE_MAX );
196  vtkGetMacro( RescaleFactor, double );
198 
200 
208  vtkGetMacro( MinRelativeCubeScreenArea, double );
210  vtkGetMacro( MaxRelativeCubeScreenArea, double );
212 
214 
217  vtkSetStringMacro(LengthUnit);
218  vtkGetStringMacro(LengthUnit);
220 
221  /*
222  * Register internal Pickers within PickingManager
223  */
224  void RegisterPickers() override;
225 
226 protected:
229 
236  double LastPickPosition[3];
237  double LastEventPosition[2];
243  double Offset[3];
248  double SideLength;
249  char * LengthUnit;
250 
251  // Methods to manipulate the cursor
252  virtual void Translate(double *p1, double *p2);
253  virtual void Scale(double *p1, double *p2, double eventPos[2]);
254  virtual void MoveFocus(double *p1, double *p2);
255 
257 
264 
276  void MoveFocusRequest( double *p1, double *p2,
277  double eventPos[2], double requestedDisplayPos[3] );
278 
284  virtual void SetUniformScale( double scale );
285 
295  virtual void UpdateHandle();
296 
300  virtual void UpdateLabel();
301 
302  // Handle the label.
308 
309 private:
312  void operator=(
314 };
315 
316 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:43
vtkMeasurementCubeHandleRepresentation3D::SetMaxRelativeCubeScreenArea
void SetMaxRelativeCubeScreenArea(double)
vtkMeasurementCubeHandleRepresentation3D::WaitingForMotion
int WaitingForMotion
Definition: vtkMeasurementCubeHandleRepresentation3D.h:240
vtkFollower
a subclass of actor that always faces the camera
Definition: vtkFollower.h:47
vtkMeasurementCubeHandleRepresentation3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractTransform
superclass for all geometric transformations
Definition: vtkAbstractTransform.h:51
vtkMeasurementCubeHandleRepresentation3D::~vtkMeasurementCubeHandleRepresentation3D
~vtkMeasurementCubeHandleRepresentation3D() override
vtkMeasurementCubeHandleRepresentation3D::MoveFocus
virtual void MoveFocus(double *p1, double *p2)
vtkX3D::scale
@ scale
Definition: vtkX3D.h:229
vtkMeasurementCubeHandleRepresentation3D::Scale
virtual void Scale(double *p1, double *p2, double eventPos[2])
vtkMeasurementCubeHandleRepresentation3D::SideLength
double SideLength
Definition: vtkMeasurementCubeHandleRepresentation3D.h:248
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:304
vtkMeasurementCubeHandleRepresentation3D::Actor
vtkActor * Actor
Definition: vtkMeasurementCubeHandleRepresentation3D.h:230
vtkMeasurementCubeHandleRepresentation3D::LengthUnit
char * LengthUnit
Definition: vtkMeasurementCubeHandleRepresentation3D.h:249
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:59
vtkMeasurementCubeHandleRepresentation3D::Property
vtkProperty * Property
Definition: vtkMeasurementCubeHandleRepresentation3D.h:238
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::Translate
virtual void Translate(double *p1, double *p2)
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()
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
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:234
vtkMeasurementCubeHandleRepresentation3D::RescaleFactor
double RescaleFactor
Definition: vtkMeasurementCubeHandleRepresentation3D.h:245
vtkMeasurementCubeHandleRepresentation3D::DeepCopy
void DeepCopy(vtkProp *prop) override
vtkMatrixToLinearTransform
convert a matrix to a transform
Definition: vtkMatrixToLinearTransform.h:41
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:52
vtkMeasurementCubeHandleRepresentation3D::HandleTransform
vtkMatrixToLinearTransform * HandleTransform
Definition: vtkMeasurementCubeHandleRepresentation3D.h:233
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
vtkMeasurementCubeHandleRepresentation3D::GetLabelTextInput
virtual char * GetLabelTextInput()
vtkMeasurementCubeHandleRepresentation3D
represent a unit cube for measuring/comparing to data.
Definition: vtkMeasurementCubeHandleRepresentation3D.h:46
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::MoveFocusRequest
void MoveFocusRequest(double *p1, double *p2, 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...
vtkMeasurementCubeHandleRepresentation3D::MinRelativeCubeScreenArea
double MinRelativeCubeScreenArea
Definition: vtkMeasurementCubeHandleRepresentation3D.h:246
vtkMeasurementCubeHandleRepresentation3D::HandlePicker
vtkCellPicker * HandlePicker
Definition: vtkMeasurementCubeHandleRepresentation3D.h:235
vtkMeasurementCubeHandleRepresentation3D::WidgetInteraction
void WidgetInteraction(double eventPos[2]) override
vtkTransformPolyDataFilter
transform points and associated normals and vectors for polygonal dataset
Definition: vtkTransformPolyDataFilter.h:52
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:305
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:48
vtkMeasurementCubeHandleRepresentation3D::vtkMeasurementCubeHandleRepresentation3D
vtkMeasurementCubeHandleRepresentation3D()
vtkMeasurementCubeHandleRepresentation3D::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
vtkMeasurementCubeHandleRepresentation3D::LabelAnnotationTextScaleInitialized
bool LabelAnnotationTextScaleInitialized
Definition: vtkMeasurementCubeHandleRepresentation3D.h:306
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
vtkMeasurementCubeHandleRepresentation3D::SetProperty
void SetProperty(vtkProperty *)
Set/Get the handle properties when unselected and selected.
vtkMeasurementCubeHandleRepresentation3D::SmoothMotion
vtkTypeBool SmoothMotion
Definition: vtkMeasurementCubeHandleRepresentation3D.h:307
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:241
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:244
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
vtkMeasurementCubeHandleRepresentation3D::LabelVisibility
vtkTypeBool LabelVisibility
Definition: vtkMeasurementCubeHandleRepresentation3D.h:303
vtkMeasurementCubeHandleRepresentation3D::SelectedProperty
vtkProperty * SelectedProperty
Definition: vtkMeasurementCubeHandleRepresentation3D.h:239
vtkMeasurementCubeHandleRepresentation3D::Mapper
vtkPolyDataMapper * Mapper
Definition: vtkMeasurementCubeHandleRepresentation3D.h:231
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:67
vtkMeasurementCubeHandleRepresentation3D::SetSelectedProperty
void SetSelectedProperty(vtkProperty *)
vtkMeasurementCubeHandleRepresentation3D::GetHandle
vtkPolyData * GetHandle()
Get the handle polydata.
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:42
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:70
vtkMeasurementCubeHandleRepresentation3D::HandleTransformFilter
vtkTransformPolyDataFilter * HandleTransformFilter
Definition: vtkMeasurementCubeHandleRepresentation3D.h:232
VTK_DOUBLE_MAX
#define VTK_DOUBLE_MAX
Definition: vtkType.h:169
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::HandleVisibility
vtkTypeBool HandleVisibility
Definition: vtkMeasurementCubeHandleRepresentation3D.h:242
vtkMeasurementCubeHandleRepresentation3D::MaxRelativeCubeScreenArea
double MaxRelativeCubeScreenArea
Definition: vtkMeasurementCubeHandleRepresentation3D.h:247