VTK  9.1.0
vtkConstrainedPointHandleRepresentation.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkConstrainedPointHandleRepresentation.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=========================================================================*/
37#ifndef vtkConstrainedPointHandleRepresentation_h
38#define vtkConstrainedPointHandleRepresentation_h
39
41#include "vtkInteractionWidgetsModule.h" // For export macro
42
43class vtkProperty;
44class vtkActor;
46class vtkPolyData;
47class vtkGlyph3D;
48class vtkPoints;
49class vtkPolyData;
50class vtkPlane;
52class vtkPlanes;
53class vtkRenderer;
54
55class VTKINTERACTIONWIDGETS_EXPORT vtkConstrainedPointHandleRepresentation
57{
58public:
63
65
69 void PrintSelf(ostream& os, vtkIndent indent) override;
71
73
75
80 void SetCursorShape(vtkPolyData* cursorShape);
83
85
93
95
100 vtkSetClampMacro(ProjectionNormal, int, vtkConstrainedPointHandleRepresentation::XAxis,
102 vtkGetMacro(ProjectionNormal, int);
104
106 {
107 this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::XAxis);
108 }
110 {
111 this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::YAxis);
112 }
114 {
115 this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::ZAxis);
116 }
118 {
119 this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::Oblique);
120 }
121
123
128 vtkGetObjectMacro(ObliquePlane, vtkPlane);
130
132
140 vtkGetMacro(ProjectionPosition, double);
142
144
156 vtkGetObjectMacro(BoundingPlanes, vtkPlaneCollection);
159
165 int CheckConstraint(vtkRenderer* renderer, double pos[2]) override;
166
168
173 void SetPosition(double x, double y, double z);
174 void SetPosition(double xyz[3]);
175 double* GetPosition();
176 void GetPosition(double xyz[3]);
178
180
184 vtkGetObjectMacro(Property, vtkProperty);
186
188
192 vtkGetObjectMacro(SelectedProperty, vtkProperty);
194
196
200 vtkGetObjectMacro(ActiveProperty, vtkProperty);
202
204
209 void SetRenderer(vtkRenderer* ren) override;
210 void BuildRepresentation() override;
211 void StartWidgetInteraction(double eventPos[2]) override;
212 void WidgetInteraction(double eventPos[2]) override;
213 int ComputeInteractionState(int X, int Y, int modify) override;
215
220 void SetDisplayPosition(double pos[3]) override;
221
223
228 int RenderOverlay(vtkViewport* viewport) override;
229 int RenderOpaqueGeometry(vtkViewport* viewport) override;
232 void ShallowCopy(vtkProp* prop) override;
234
235 enum
236 {
237 XAxis = 0,
240 Oblique
241 };
242
243 void Highlight(int highlight) override;
244
245protected:
248
249 // Render the cursor
257
258 // Support picking
259 double LastPickPosition[3];
260 double LastEventPosition[2];
261
262 // Methods to manipulate the cursor
263 void Translate(const double* eventPos) override;
264 void Scale(const double* eventPos);
265
266 // Properties used to control the appearance of selected objects and
267 // the manipulator in general.
272
273 // Controlling vars
278
280
281 // Internal method for computing 3D location from 2D screen position
282 int GetIntersectionPosition(const double eventPos[2], double worldPos[3], double tolerance = 0.0,
283 vtkRenderer* renderer = nullptr);
284
285 // Internal method for getting the project normal as a vector
286 void GetProjectionNormal(double normal[3]);
287
288 // Internal method for getting the origin of the
289 // constraining plane as a 3-tuple
290 void GetProjectionOrigin(double origin[3]);
291
292 // Distance between where the mouse event happens and where the
293 // widget is focused - maintain this distance during interaction.
294 double InteractionOffset[2];
295
296private:
298 void operator=(const vtkConstrainedPointHandleRepresentation&) = delete;
299};
300
301#endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
point representation constrained to a 2D plane
void Translate(const double *eventPos) override
Translates world position by vector v projected on the constraint axis if any.
void ShallowCopy(vtkProp *prop) override
Methods to make this class behave as a vtkProp.
vtkPolyData * GetCursorShape()
Specify the cursor shape.
void StartWidgetInteraction(double eventPos[2]) override
Subclasses of vtkConstrainedPointHandleRepresentation must implement these methods.
void RemoveAllBoundingPlanes()
A collection of plane equations used to bound the position of the point.
void Scale(const double *eventPos)
int ComputeInteractionState(int X, int Y, int modify) override
Subclasses of vtkConstrainedPointHandleRepresentation must implement these methods.
void Highlight(int highlight) override
double * GetPosition()
Set/Get the position of the point in display coordinates.
void SetDisplayPosition(double pos[3]) override
Method overridden from Superclass.
vtkPolyData * GetActiveCursorShape()
Specify the shape of the cursor (handle) when it is active.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Methods to make this class behave as a vtkProp.
void WidgetInteraction(double eventPos[2]) override
Subclasses of vtkConstrainedPointHandleRepresentation must implement these methods.
void AddBoundingPlane(vtkPlane *plane)
A collection of plane equations used to bound the position of the point.
void GetActors(vtkPropCollection *) override
Methods to make this class behave as a vtkProp.
int CheckConstraint(vtkRenderer *renderer, double pos[2]) override
Overridden from the base class.
int RenderOpaqueGeometry(vtkViewport *viewport) override
Methods to make this class behave as a vtkProp.
void GetPosition(double xyz[3])
Set/Get the position of the point in display coordinates.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
Methods to make this class behave as a vtkProp.
void SetProjectionPosition(double position)
The position of the bounding plane from the origin along the normal.
void SetPosition(double xyz[3])
Set/Get the position of the point in display coordinates.
void SetRenderer(vtkRenderer *ren) override
Subclasses of vtkConstrainedPointHandleRepresentation must implement these methods.
void SetPosition(double x, double y, double z)
Set/Get the position of the point in display coordinates.
void SetActiveCursorShape(vtkPolyData *activeShape)
Specify the shape of the cursor (handle) when it is active.
static vtkConstrainedPointHandleRepresentation * New()
Instantiate this class.
void BuildRepresentation() override
Subclasses of vtkConstrainedPointHandleRepresentation must implement these methods.
void SetCursorShape(vtkPolyData *cursorShape)
Specify the cursor shape.
void SetBoundingPlanes(vtkPlanes *planes)
A collection of plane equations used to bound the position of the point.
virtual void SetBoundingPlanes(vtkPlaneCollection *)
A collection of plane equations used to bound the position of the point.
void RemoveBoundingPlane(vtkPlane *plane)
A collection of plane equations used to bound the position of the point.
void GetProjectionOrigin(double origin[3])
void ReleaseGraphicsResources(vtkWindow *) override
Methods to make this class behave as a vtkProp.
int GetIntersectionPosition(const double eventPos[2], double worldPos[3], double tolerance=0.0, vtkRenderer *renderer=nullptr)
void GetProjectionNormal(double normal[3])
int RenderOverlay(vtkViewport *viewport) override
Methods to make this class behave as a vtkProp.
void SetObliquePlane(vtkPlane *)
If the ProjectionNormal is set to Oblique, then this is the oblique plane used to constrain the handl...
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:216
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
maintain a list of planes
perform various plane computations
Definition: vtkPlane.h:143
implicit function for convex set of planes
Definition: vtkPlanes.h:159
represent and manipulate 3D points
Definition: vtkPoints.h:143
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:67
represent surface properties of a geometric object
Definition: vtkProperty.h:171
abstract specification for renderers
Definition: vtkRenderer.h:173
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
@ position
Definition: vtkX3D.h:267
int vtkTypeBool
Definition: vtkABI.h:69