VTK  9.1.0
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
38class vtkProperty;
40class vtkCellPicker;
43class vtkMatrix4x4;
44class vtkPolyData;
46class vtkActor;
47class vtkFollower;
48class vtkVectorText;
49
50class VTKINTERACTIONWIDGETS_EXPORT vtkAbstractPolygonalHandleRepresentation3D
52{
53public:
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;
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
192protected:
195
202 double LastPickPosition[3];
203 double LastEventPosition[2];
210
211 // Methods to manipulate the cursor
212 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
256private:
259 void operator=(const vtkAbstractPolygonalHandleRepresentation3D&) = delete;
260};
261
262#endif
represent a user defined handle geometry in 3D while maintaining a fixed orientation w....
int ComputeInteractionState(int X, int Y, int modify=0) override
Methods to make this class properly act like a vtkWidgetRepresentation.
void MoveFocusRequest(const double *p1, const double *p2, const double eventPos[2], double requestedDisplayPos[3])
virtual void SetLabelTextScale(double scale[3])
Scale text (font size along each dimension).
virtual vtkAbstractTransform * GetTransform()
Get the transform used to transform the generic handle polydata before placing it in the render windo...
void Highlight(int highlight) override
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
virtual void Scale(const double *p1, const double *p2, const double eventPos[2])
void SetLabelTextScale(double x, double y, double z)
Scale text (font size along each dimension).
void StartWidgetInteraction(double eventPos[2]) override
Methods to make this class properly act like a vtkWidgetRepresentation.
void GetActors(vtkPropCollection *) override
Methods to make this class behave as a vtkProp.
double * GetBounds() override
Methods to make this class behave as a vtkProp.
int DetermineConstraintAxis(int constraint, double *x, double *startPickPos)
virtual void MoveFocus(const double *p1, const double *p2)
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.
virtual void SetLabelText(const char *label)
A label may be associated with the seed.
void DeepCopy(vtkProp *prop) override
Methods to make this class behave as a vtkProp.
void Translate(const double *p1, const double *p2) override
Translates world position by vector p1p2 projected on the constraint axis if any.
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
Methods to make this class behave as a vtkProp.
void ShallowCopy(vtkProp *prop) override
Methods to make this class behave as a vtkProp.
void WidgetInteraction(double eventPos[2]) override
Methods to make this class properly act like a vtkWidgetRepresentation.
void BuildRepresentation() override
Methods to make this class properly act like a vtkWidgetRepresentation.
int RenderOpaqueGeometry(vtkViewport *viewport) override
Methods to make this class behave as a vtkProp.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods to make this class behave as a vtkProp.
virtual void UpdateHandle()
Update the actor position.
virtual void UpdateLabel()
Opportunity to update the label position and text during each render.
virtual double * GetLabelTextScale()
Scale text (font size along each dimension).
void SetSelectedProperty(vtkProperty *)
Set/Get the handle properties when unselected and selected.
virtual void SetUniformScale(double scale)
The handle may be scaled uniformly in all three dimensions using this API.
void SetDisplayPosition(double p[3]) override
Set the position of the point in world and display coordinates.
virtual char * GetLabelText()
A label may be associated with the seed.
vtkPolyData * GetHandle()
Set/get the handle polydata.
void SetHandle(vtkPolyData *)
Set/get the handle polydata.
void SetProperty(vtkProperty *)
Set/Get the handle properties when unselected and selected.
superclass for all geometric transformations
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
ray-cast cell picker for all kinds of Prop3Ds
Definition: vtkCellPicker.h:96
a subclass of actor that always faces the camera
Definition: vtkFollower.h:120
abstract class for representing widget handles
virtual void Translate(const double *p1, const double *p2)
Translates world position by vector p1p2 projected on the constraint axis if any.
a simple class to control print indentation
Definition: vtkIndent.h:113
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:145
convert a matrix to a transform
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
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:171
transform points and associated normals and vectors for polygonal dataset
create polygonal text
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
int vtkTypeBool
Definition: vtkABI.h:69