VTK  9.0.2
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 
43 class vtkProperty;
44 class vtkActor;
45 class vtkPolyDataMapper;
46 class vtkPolyData;
47 class vtkGlyph3D;
48 class vtkPoints;
49 class vtkPolyData;
50 class vtkPlane;
51 class vtkPlaneCollection;
52 class vtkPlanes;
53 class vtkRenderer;
54 
55 class VTKINTERACTIONWIDGETS_EXPORT vtkConstrainedPointHandleRepresentation
57 {
58 public:
63 
65 
69  void PrintSelf(ostream& os, vtkIndent indent) override;
71 
73 
75 
80  void SetCursorShape(vtkPolyData* cursorShape);
83 
85 
90  void SetActiveCursorShape(vtkPolyData* activeShape);
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 
226  void GetActors(vtkPropCollection*) override;
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 
245 protected:
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 
296 private:
298  void operator=(const vtkConstrainedPointHandleRepresentation&) = delete;
299 };
300 
301 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
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
Shallow copy of this vtkProp.
void StartWidgetInteraction(double eventPos[2]) override
void Scale(const double *eventPos)
int ComputeInteractionState(int X, int Y, int modify) override
void Highlight(int highlight) override
void SetDisplayPosition(double pos[3]) override
Method overridden from Superclass.
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
void WidgetInteraction(double eventPos[2]) override
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
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
void SetProjectionPosition(double position)
The position of the bounding plane from the origin along the normal.
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 SetCursorShape(vtkPolyData *cursorShape)
Specify the cursor shape.
static vtkConstrainedPointHandleRepresentation * New()
Instantiate this class.
void SetBoundingPlanes(vtkPlanes *planes)
virtual void SetBoundingPlanes(vtkPlaneCollection *)
void RemoveBoundingPlane(vtkPlane *plane)
void GetProjectionOrigin(double origin[3])
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
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
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:106
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:34
maintain a list of planes
perform various plane computations
Definition: vtkPlane.h:32
implicit function for convex set of planes
Definition: vtkPlanes.h:50
represent and manipulate 3D points
Definition: vtkPoints.h:34
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:54
represent surface properties of a geometric object
Definition: vtkProperty.h:62
abstract specification for renderers
Definition: vtkRenderer.h:68
abstract specification for Viewports
Definition: vtkViewport.h:45
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
@ position
Definition: vtkX3D.h:267
int vtkTypeBool
Definition: vtkABI.h:69