VTK  9.0.1
vtkAbstractPolygonalHandleRepresentation3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAbstractPolygonalHandleRepresentation3D.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 =========================================================================*/
32 #ifndef vtkAbstractPolygonalHandleRepresentation3D_h
33 #define vtkAbstractPolygonalHandleRepresentation3D_h
34 
36 #include "vtkInteractionWidgetsModule.h" // For export macro
37 
38 class vtkProperty;
39 class vtkPolyDataMapper;
40 class vtkCellPicker;
43 class vtkMatrix4x4;
44 class vtkPolyData;
46 class vtkActor;
47 class vtkFollower;
48 class vtkVectorText;
49 
50 class VTKINTERACTIONWIDGETS_EXPORT vtkAbstractPolygonalHandleRepresentation3D
52 {
53 public:
55 
59  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
63 
65 
68  void SetWorldPosition(double p[3]) override;
69  void SetDisplayPosition(double p[3]) override;
71 
73 
79 
81 
86  vtkGetObjectMacro(Property, vtkProperty);
87  vtkGetObjectMacro(SelectedProperty, vtkProperty);
89 
95 
97 
100  void BuildRepresentation() override;
101  void StartWidgetInteraction(double eventPos[2]) override;
102  void WidgetInteraction(double eventPos[2]) override;
103  int ComputeInteractionState(int X, int Y, int modify = 0) override;
105 
107 
110  void ShallowCopy(vtkProp* prop) override;
111  void DeepCopy(vtkProp* prop) override;
112  void GetActors(vtkPropCollection*) override;
114  int RenderOpaqueGeometry(vtkViewport* viewport) override;
117  double* GetBounds() override;
119 
121 
125  vtkSetMacro(LabelVisibility, vtkTypeBool);
126  vtkGetMacro(LabelVisibility, vtkTypeBool);
127  vtkBooleanMacro(LabelVisibility, vtkTypeBool);
128  virtual void SetLabelText(const char* label);
129  virtual char* GetLabelText();
131 
133 
136  virtual void SetLabelTextScale(double scale[3]);
137  void SetLabelTextScale(double x, double y, double z)
138  {
139  double scale[3] = { x, y, z };
140  this->SetLabelTextScale(scale);
141  }
142  virtual double* GetLabelTextScale();
144 
146 
149  vtkGetObjectMacro(LabelTextActor, vtkFollower);
151 
157  virtual void SetUniformScale(double scale);
158 
160 
163  vtkSetMacro(HandleVisibility, vtkTypeBool);
164  vtkGetMacro(HandleVisibility, vtkTypeBool);
165  vtkBooleanMacro(HandleVisibility, vtkTypeBool);
167 
168  void Highlight(int highlight) override;
169 
171 
182  vtkSetMacro(SmoothMotion, vtkTypeBool);
183  vtkGetMacro(SmoothMotion, vtkTypeBool);
184  vtkBooleanMacro(SmoothMotion, vtkTypeBool);
186 
187  /*
188  * Register internal Pickers within PickingManager
189  */
190  void RegisterPickers() override;
191 
192 protected:
195 
202  double LastPickPosition[3];
203  double LastEventPosition[2];
210 
211  // Methods to manipulate the cursor
212  virtual void Translate(const double* p1, const double* p2) override;
213  virtual void Scale(const double* p1, const double* p2, const double eventPos[2]);
214  virtual void MoveFocus(const double* p1, const double* p2);
215 
217 
218  // Given a motion vector defined by p1 --> p2 (p1 and p2 are in
219  // world coordinates), the new display position of the handle center is
220  // populated into requestedDisplayPos. This is again only a request for the
221  // new display position. It is up to the point placer to deduce the
222  // appropriate world co-ordinates that this display position will map into.
223  // The placer may even disallow such a movement.
224  // If "SmoothMotion" is OFF, the returned requestedDisplayPos is the same
225  // as the event position, ie the location of the mouse cursor. If its OFF,
226  // incremental offsets as described above are used to compute it.
228  const double* p1, const double* p2, const double eventPos[2], double requestedDisplayPos[3]);
229 
230  int DetermineConstraintAxis(int constraint, double* x, double* startPickPos);
231 
241  virtual void UpdateHandle();
242 
246  virtual void UpdateLabel();
247 
248  // Handle the label.
255 
256 private:
259  void operator=(const vtkAbstractPolygonalHandleRepresentation3D&) = delete;
260 };
261 
262 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:37
vtkAbstractPolygonalHandleRepresentation3D::WaitingForMotion
int WaitingForMotion
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:207
vtkAbstractPolygonalHandleRepresentation3D::Actor
vtkActor * Actor
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:196
vtkAbstractPolygonalHandleRepresentation3D::SetSelectedProperty
void SetSelectedProperty(vtkProperty *)
vtkAbstractPolygonalHandleRepresentation3D::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkFollower
a subclass of actor that always faces the camera
Definition: vtkFollower.h:41
vtkAbstractPolygonalHandleRepresentation3D::MoveFocusRequest
void MoveFocusRequest(const double *p1, const double *p2, const double eventPos[2], double requestedDisplayPos[3])
vtkAbstractPolygonalHandleRepresentation3D::HandleVisibility
vtkTypeBool HandleVisibility
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:209
vtkAbstractPolygonalHandleRepresentation3D::~vtkAbstractPolygonalHandleRepresentation3D
~vtkAbstractPolygonalHandleRepresentation3D() override
vtkAbstractTransform
superclass for all geometric transformations
Definition: vtkAbstractTransform.h:51
vtkAbstractPolygonalHandleRepresentation3D::WidgetInteraction
void WidgetInteraction(double eventPos[2]) override
vtkAbstractPolygonalHandleRepresentation3D::Mapper
vtkPolyDataMapper * Mapper
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:197
vtkX3D::scale
@ scale
Definition: vtkX3D.h:235
vtkAbstractPolygonalHandleRepresentation3D::Highlight
void Highlight(int highlight) override
vtkAbstractPolygonalHandleRepresentation3D::DeepCopy
void DeepCopy(vtkProp *prop) override
vtkAbstractPolygonalHandleRepresentation3D::LabelAnnotationTextScaleInitialized
bool LabelAnnotationTextScaleInitialized
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:253
vtkAbstractPolygonalHandleRepresentation3D::BuildRepresentation
void BuildRepresentation() override
Methods to make this class properly act like a vtkWidgetRepresentation.
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:56
vtkAbstractPolygonalHandleRepresentation3D::StartWidgetInteraction
void StartWidgetInteraction(double eventPos[2]) override
vtkAbstractPolygonalHandleRepresentation3D
represent a user defined handle geometry in 3D while maintaining a fixed orientation w....
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:52
vtkAbstractPolygonalHandleRepresentation3D::SetLabelTextScale
virtual void SetLabelTextScale(double scale[3])
Scale text (font size along each dimension).
vtkAbstractPolygonalHandleRepresentation3D::RegisterPickers
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
vtkAbstractPolygonalHandleRepresentation3D::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
vtkAbstractPolygonalHandleRepresentation3D::SetProperty
void SetProperty(vtkProperty *)
Set/Get the handle properties when unselected and selected.
vtkHandleRepresentation.h
vtkVectorText
create polygonal text
Definition: vtkVectorText.h:42
vtkAbstractPolygonalHandleRepresentation3D::HandleTransformFilter
vtkTransformPolyDataFilter * HandleTransformFilter
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:198
vtkAbstractPolygonalHandleRepresentation3D::GetHandle
vtkPolyData * GetHandle()
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
vtkAbstractPolygonalHandleRepresentation3D::SetUniformScale
virtual void SetUniformScale(double scale)
The handle may be scaled uniformly in all three dimensions using this API.
vtkAbstractPolygonalHandleRepresentation3D::SelectedProperty
vtkProperty * SelectedProperty
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:206
vtkAbstractPolygonalHandleRepresentation3D::CreateDefaultProperties
void CreateDefaultProperties()
vtkAbstractPolygonalHandleRepresentation3D::GetActors
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes.
vtkAbstractPolygonalHandleRepresentation3D::DetermineConstraintAxis
int DetermineConstraintAxis(int constraint, double *x, double *startPickPos)
vtkAbstractPolygonalHandleRepresentation3D::HandleTransform
vtkMatrixToLinearTransform * HandleTransform
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:199
vtkAbstractPolygonalHandleRepresentation3D::LabelTextActor
vtkFollower * LabelTextActor
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:250
vtkAbstractPolygonalHandleRepresentation3D::SetLabelText
virtual void SetLabelText(const char *label)
vtkMatrixToLinearTransform
convert a matrix to a transform
Definition: vtkMatrixToLinearTransform.h:38
vtkAbstractPolygonalHandleRepresentation3D::UpdateHandle
virtual void UpdateHandle()
Update the actor position.
vtkAbstractPolygonalHandleRepresentation3D::Scale
virtual void Scale(const double *p1, const double *p2, const double eventPos[2])
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:36
vtkAbstractPolygonalHandleRepresentation3D::GetTransform
virtual vtkAbstractTransform * GetTransform()
Get the transform used to transform the generic handle polydata before placing it in the render windo...
vtkAbstractPolygonalHandleRepresentation3D::GetLabelText
virtual char * GetLabelText()
vtkTransformPolyDataFilter
transform points and associated normals and vectors for polygonal dataset
Definition: vtkTransformPolyDataFilter.h:46
vtkAbstractPolygonalHandleRepresentation3D::vtkAbstractPolygonalHandleRepresentation3D
vtkAbstractPolygonalHandleRepresentation3D()
vtkAbstractPolygonalHandleRepresentation3D::MoveFocus
virtual void MoveFocus(const double *p1, const double *p2)
vtkAbstractPolygonalHandleRepresentation3D::Property
vtkProperty * Property
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:205
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:45
vtkAbstractPolygonalHandleRepresentation3D::LabelTextInput
vtkVectorText * LabelTextInput
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:252
vtkAbstractPolygonalHandleRepresentation3D::LabelVisibility
vtkTypeBool LabelVisibility
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:249
vtkAbstractPolygonalHandleRepresentation3D::SetWorldPosition
void SetWorldPosition(double p[3]) override
Set the position of the point in world and display coordinates.
vtkAbstractPolygonalHandleRepresentation3D::LabelTextMapper
vtkPolyDataMapper * LabelTextMapper
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:251
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
vtkAbstractPolygonalHandleRepresentation3D::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Methods to make this class behave as a vtkProp.
vtkHandleRepresentation::Translate
virtual void Translate(const double *p1, const double *p2)
Translates world position by vector p1p2 projected on the constraint axis if any.
vtkAbstractPolygonalHandleRepresentation3D::ConstraintAxis
int ConstraintAxis
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:204
vtkAbstractPolygonalHandleRepresentation3D::SetLabelTextScale
void SetLabelTextScale(double x, double y, double z)
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:137
vtkAbstractPolygonalHandleRepresentation3D::HandlePicker
vtkCellPicker * HandlePicker
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:201
vtkAbstractPolygonalHandleRepresentation3D::GetLabelTextScale
virtual double * GetLabelTextScale()
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkAbstractPolygonalHandleRepresentation3D::ComputeInteractionState
int ComputeInteractionState(int X, int Y, int modify=0) override
vtkAbstractPolygonalHandleRepresentation3D::WaitCount
int WaitCount
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:208
vtkAbstractPolygonalHandleRepresentation3D::HandleTransformMatrix
vtkMatrix4x4 * HandleTransformMatrix
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:200
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:62
vtkAbstractPolygonalHandleRepresentation3D::Translate
virtual void Translate(const double *p1, const double *p2) override
Translates world position by vector p1p2 projected on the constraint axis if any.
vtkAbstractPolygonalHandleRepresentation3D::SmoothMotion
vtkTypeBool SmoothMotion
Definition: vtkAbstractPolygonalHandleRepresentation3D.h:254
vtkAbstractPolygonalHandleRepresentation3D::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:36
vtkCellPicker
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:67
vtkAbstractPolygonalHandleRepresentation3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractPolygonalHandleRepresentation3D::GetBounds
double * GetBounds() override
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
vtkAbstractPolygonalHandleRepresentation3D::SetHandle
void SetHandle(vtkPolyData *)
Set/get the handle polydata.
vtkAbstractPolygonalHandleRepresentation3D::SetDisplayPosition
void SetDisplayPosition(double p[3]) override
Handles usually have their coordinates set in display coordinates (generally by an associated widget)...
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkAbstractPolygonalHandleRepresentation3D::UpdateLabel
virtual void UpdateLabel()
Opportunity to update the label position and text during each render.
vtkAbstractPolygonalHandleRepresentation3D::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override