VTK  9.2.5
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 =========================================================================*/
40 #ifndef vtkConstrainedPointHandleRepresentation_h
41 #define vtkConstrainedPointHandleRepresentation_h
42 
44 #include "vtkInteractionWidgetsModule.h" // For export macro
45 
46 class vtkProperty;
47 class vtkActor;
48 class vtkPolyDataMapper;
49 class vtkPolyData;
50 class vtkGlyph3D;
51 class vtkPoints;
52 class vtkPolyData;
53 class vtkPlane;
54 class vtkPlaneCollection;
55 class vtkPlanes;
56 class vtkRenderer;
57 
58 class VTKINTERACTIONWIDGETS_EXPORT vtkConstrainedPointHandleRepresentation
60 {
61 public:
66 
68 
72  void PrintSelf(ostream& os, vtkIndent indent) override;
74 
76 
78 
83  void SetCursorShape(vtkPolyData* cursorShape);
86 
88 
93  void SetActiveCursorShape(vtkPolyData* activeShape);
96 
98 
103  vtkSetClampMacro(ProjectionNormal, int, vtkConstrainedPointHandleRepresentation::XAxis,
105  vtkGetMacro(ProjectionNormal, int);
107 
109  {
110  this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::XAxis);
111  }
113  {
114  this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::YAxis);
115  }
117  {
118  this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::ZAxis);
119  }
121  {
122  this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::Oblique);
123  }
124 
126 
131  vtkGetObjectMacro(ObliquePlane, vtkPlane);
133 
135 
143  vtkGetMacro(ProjectionPosition, double);
145 
147 
159  vtkGetObjectMacro(BoundingPlanes, vtkPlaneCollection);
162 
168  int CheckConstraint(vtkRenderer* renderer, double pos[2]) override;
169 
171 
176  void SetPosition(double x, double y, double z);
177  void SetPosition(double xyz[3]);
178  double* GetPosition();
179  void GetPosition(double xyz[3]);
181 
183 
187  vtkGetObjectMacro(Property, vtkProperty);
189 
191 
195  vtkGetObjectMacro(SelectedProperty, vtkProperty);
197 
199 
203  vtkGetObjectMacro(ActiveProperty, vtkProperty);
205 
207 
212  void SetRenderer(vtkRenderer* ren) override;
213  void BuildRepresentation() override;
214  void StartWidgetInteraction(double eventPos[2]) override;
215  void WidgetInteraction(double eventPos[2]) override;
216  int ComputeInteractionState(int X, int Y, int modify) override;
218 
223  void SetDisplayPosition(double pos[3]) override;
224 
226 
229  void GetActors(vtkPropCollection*) override;
231  int RenderOverlay(vtkViewport* viewport) override;
232  int RenderOpaqueGeometry(vtkViewport* viewport) override;
235  void ShallowCopy(vtkProp* prop) override;
237 
238  enum
239  {
240  XAxis = 0,
243  Oblique
244  };
245 
246  void Highlight(int highlight) override;
247 
248 protected:
251 
252  // Render the cursor
260 
261  // Support picking
262  double LastPickPosition[3];
263  double LastEventPosition[2];
264 
265  // Methods to manipulate the cursor
266  void Translate(const double* eventPos) override;
267  void Scale(const double* eventPos);
268 
269  // Properties used to control the appearance of selected objects and
270  // the manipulator in general.
275 
276  // Controlling vars
281 
283 
284  // Internal method for computing 3D location from 2D screen position
285  int GetIntersectionPosition(const double eventPos[2], double worldPos[3], double tolerance = 0.0,
286  vtkRenderer* renderer = nullptr);
287 
288  // Internal method for getting the project normal as a vector
289  void GetProjectionNormal(double normal[3]);
290 
291  // Internal method for getting the origin of the
292  // constraining plane as a 3-tuple
293  void GetProjectionOrigin(double origin[3]);
294 
295  // Distance between where the mouse event happens and where the
296  // widget is focused - maintain this distance during interaction.
297  double InteractionOffset[2];
298 
299 private:
301  void operator=(const vtkConstrainedPointHandleRepresentation&) = delete;
302 };
303 
304 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
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.
double * GetPosition()
Set/Get the position of the point in display coordinates.
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
void SetDisplayPosition(double pos[3]) override
Method overridden from Superclass.
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.
void BuildRepresentation() override
Subclasses of vtkConstrainedPointHandleRepresentation must implement these methods.
void SetCursorShape(vtkPolyData *cursorShape)
Specify the cursor shape.
static vtkConstrainedPointHandleRepresentation * New()
Instantiate this class.
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])
vtkPolyData * GetActiveCursorShape()
Specify the shape of the cursor (handle) when it is active.
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:222
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:119
maintain a list of planes
perform various plane computations
Definition: vtkPlane.h:146
implicit function for convex set of planes
Definition: vtkPlanes.h:162
represent and manipulate 3D points
Definition: vtkPoints.h:149
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
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:177
abstract specification for renderers
Definition: vtkRenderer.h:182
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
@ position
Definition: vtkX3D.h:267
int vtkTypeBool
Definition: vtkABI.h:69