VTK
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 
43 #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 : public vtkHandleRepresentation
59 {
60 public:
65 
67 
71  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
75 
80  void SetCursorShape(vtkPolyData *cursorShape);
83 
85 
90  void SetActiveCursorShape(vtkPolyData *activeShape);
93 
95 
100  vtkSetClampMacro(ProjectionNormal,int,
103  vtkGetMacro(ProjectionNormal,int);
105 
107  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::XAxis); }
109  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::YAxis); }
111  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::ZAxis); }
113  { this->SetProjectionNormal(vtkConstrainedPointHandleRepresentation::Oblique); }
114 
116 
121  vtkGetObjectMacro(ObliquePlane, vtkPlane);
123 
125 
133  vtkGetMacro(ProjectionPosition, double);
135 
137 
149  vtkGetObjectMacro(BoundingPlanes,vtkPlaneCollection);
152 
158  int CheckConstraint(vtkRenderer *renderer, double pos[2]) override;
159 
161 
166  void SetPosition(double x, double y, double z);
167  void SetPosition(double xyz[3]);
168  double* GetPosition();
169  void GetPosition(double xyz[3]);
171 
173 
177  vtkGetObjectMacro(Property,vtkProperty);
179 
181 
185  vtkGetObjectMacro(SelectedProperty,vtkProperty);
187 
189 
193  vtkGetObjectMacro(ActiveProperty,vtkProperty);
195 
197 
202  void SetRenderer(vtkRenderer *ren) override;
203  void BuildRepresentation() override;
204  void StartWidgetInteraction(double eventPos[2]) override;
205  void WidgetInteraction(double eventPos[2]) override;
206  int ComputeInteractionState(int X, int Y, int modify) override;
208 
213  void SetDisplayPosition(double pos[3]) override;
214 
216 
219  void GetActors(vtkPropCollection *) override;
221  int RenderOverlay(vtkViewport *viewport) override;
222  int RenderOpaqueGeometry(vtkViewport *viewport) override;
225  void ShallowCopy(vtkProp* prop) override;
227 
228  enum {XAxis=0,YAxis,ZAxis,Oblique};
229 
230  void Highlight(int highlight) override;
231 
232 protected:
235 
236  // Render the cursor
244 
245  // Support picking
246  double LastPickPosition[3];
247  double LastEventPosition[2];
248 
249  // Methods to manipulate the cursor
250  void Translate(double eventPos[2]);
251  void Scale(double eventPos[2]);
252 
253 
254  // Properties used to control the appearance of selected objects and
255  // the manipulator in general.
260 
261  // Controlling vars
266 
268 
269  // Internal method for computing 3D location from 2D screen position
270  int GetIntersectionPosition( double eventPos[2],
271  double worldPos[3],
272  double tolerance = 0.0,
273  vtkRenderer *renderer=nullptr);
274 
275  // Internal method for getting the project normal as a vector
276  void GetProjectionNormal( double normal[3] );
277 
278  // Internal method for getting the origin of the
279  // constraining plane as a 3-tuple
280  void GetProjectionOrigin( double origin[3] );
281 
282 
283 
284  // Distance between where the mouse event happens and where the
285  // widget is focused - maintain this distance during interaction.
286  double InteractionOffset[2];
287 
288 private:
290  void operator=(const vtkConstrainedPointHandleRepresentation&) = delete;
291 };
292 
293 #endif
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:43
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:40
vtkConstrainedPointHandleRepresentation
point representation constrained to a 2D plane
Definition: vtkConstrainedPointHandleRepresentation.h:59
vtkConstrainedPointHandleRepresentation::~vtkConstrainedPointHandleRepresentation
~vtkConstrainedPointHandleRepresentation() override
vtkPlane
perform various plane computations
Definition: vtkPlane.h:38
vtkConstrainedPointHandleRepresentation::SelectedProperty
vtkProperty * SelectedProperty
Definition: vtkConstrainedPointHandleRepresentation.h:257
vtkConstrainedPointHandleRepresentation::WidgetInteraction
void WidgetInteraction(double eventPos[2]) override
vtkConstrainedPointHandleRepresentation::CreateDefaultProperties
void CreateDefaultProperties()
vtkConstrainedPointHandleRepresentation::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkConstrainedPointHandleRepresentation::Oblique
@ Oblique
Definition: vtkConstrainedPointHandleRepresentation.h:228
vtkConstrainedPointHandleRepresentation::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkConstrainedPointHandleRepresentation::SetProjectionNormalToXAxis
void SetProjectionNormalToXAxis()
Definition: vtkConstrainedPointHandleRepresentation.h:106
vtkConstrainedPointHandleRepresentation::SetPosition
void SetPosition(double x, double y, double z)
Set/Get the position of the point in display coordinates.
vtkConstrainedPointHandleRepresentation::RemoveAllBoundingPlanes
void RemoveAllBoundingPlanes()
vtkConstrainedPointHandleRepresentation::Scale
void Scale(double eventPos[2])
vtkConstrainedPointHandleRepresentation::Actor
vtkActor * Actor
Definition: vtkConstrainedPointHandleRepresentation.h:237
vtkConstrainedPointHandleRepresentation::SetBoundingPlanes
void SetBoundingPlanes(vtkPlanes *planes)
vtkConstrainedPointHandleRepresentation::ProjectionPosition
double ProjectionPosition
Definition: vtkConstrainedPointHandleRepresentation.h:263
vtkConstrainedPointHandleRepresentation::ComputeInteractionState
int ComputeInteractionState(int X, int Y, int modify) override
vtkHandleRepresentation
abstract class for representing widget handles
Definition: vtkHandleRepresentation.h:59
vtkConstrainedPointHandleRepresentation::GetPosition
double * GetPosition()
vtkConstrainedPointHandleRepresentation::Mapper
vtkPolyDataMapper * Mapper
Definition: vtkConstrainedPointHandleRepresentation.h:238
vtkConstrainedPointHandleRepresentation::CursorShape
vtkPolyData * CursorShape
Definition: vtkConstrainedPointHandleRepresentation.h:240
vtkConstrainedPointHandleRepresentation::ActiveCursorShape
vtkPolyData * ActiveCursorShape
Definition: vtkConstrainedPointHandleRepresentation.h:241
vtkHandleRepresentation.h
vtkPlanes
implicit function for convex set of planes
Definition: vtkPlanes.h:56
vtkConstrainedPointHandleRepresentation::YAxis
@ YAxis
Definition: vtkConstrainedPointHandleRepresentation.h:228
vtkConstrainedPointHandleRepresentation::ProjectToPlane
int ProjectToPlane
Definition: vtkConstrainedPointHandleRepresentation.h:264
vtkConstrainedPointHandleRepresentation::Property
vtkProperty * Property
Definition: vtkConstrainedPointHandleRepresentation.h:256
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
vtkConstrainedPointHandleRepresentation::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
vtkConstrainedPointHandleRepresentation::SetPosition
void SetPosition(double xyz[3])
vtkConstrainedPointHandleRepresentation::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp.
vtkConstrainedPointHandleRepresentation::Translate
void Translate(double eventPos[2])
vtkX3D::position
@ position
Definition: vtkX3D.h:261
vtkConstrainedPointHandleRepresentation::New
static vtkConstrainedPointHandleRepresentation * New()
Instantiate this class.
vtkConstrainedPointHandleRepresentation::RemoveBoundingPlane
void RemoveBoundingPlane(vtkPlane *plane)
vtkConstrainedPointHandleRepresentation::vtkConstrainedPointHandleRepresentation
vtkConstrainedPointHandleRepresentation()
vtkConstrainedPointHandleRepresentation::SetProjectionNormalToOblique
void SetProjectionNormalToOblique()
Definition: vtkConstrainedPointHandleRepresentation.h:112
vtkConstrainedPointHandleRepresentation::SetRenderer
void SetRenderer(vtkRenderer *ren) override
Subclasses of vtkConstrainedPointHandleRepresentation must implement these methods.
vtkConstrainedPointHandleRepresentation::ObliquePlane
vtkPlane * ObliquePlane
Definition: vtkConstrainedPointHandleRepresentation.h:265
vtkConstrainedPointHandleRepresentation::ZAxis
@ ZAxis
Definition: vtkConstrainedPointHandleRepresentation.h:228
vtkConstrainedPointHandleRepresentation::ActiveProperty
vtkProperty * ActiveProperty
Definition: vtkConstrainedPointHandleRepresentation.h:258
vtkConstrainedPointHandleRepresentation::SetActiveCursorShape
void SetActiveCursorShape(vtkPolyData *activeShape)
Specify the shape of the cursor (handle) when it is active.
vtkConstrainedPointHandleRepresentation::SetProjectionNormalToZAxis
void SetProjectionNormalToZAxis()
Definition: vtkConstrainedPointHandleRepresentation.h:110
vtkConstrainedPointHandleRepresentation::AddBoundingPlane
void AddBoundingPlane(vtkPlane *plane)
A collection of plane equations used to bound the position of the point.
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:52
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkConstrainedPointHandleRepresentation::GetProjectionNormal
void GetProjectionNormal(double normal[3])
vtkConstrainedPointHandleRepresentation::GetActiveCursorShape
vtkPolyData * GetActiveCursorShape()
vtkConstrainedPointHandleRepresentation::BoundingPlanes
vtkPlaneCollection * BoundingPlanes
Definition: vtkConstrainedPointHandleRepresentation.h:267
vtkConstrainedPointHandleRepresentation::GetPosition
void GetPosition(double xyz[3])
vtkConstrainedPointHandleRepresentation::CheckConstraint
int CheckConstraint(vtkRenderer *renderer, double pos[2]) override
Overridden from the base class.
vtkConstrainedPointHandleRepresentation::FocalData
vtkPolyData * FocalData
Definition: vtkConstrainedPointHandleRepresentation.h:242
vtkConstrainedPointHandleRepresentation::SetProjectionNormalToYAxis
void SetProjectionNormalToYAxis()
Definition: vtkConstrainedPointHandleRepresentation.h:108
vtkConstrainedPointHandleRepresentation::RenderOverlay
int RenderOverlay(vtkViewport *viewport) override
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:48
vtkConstrainedPointHandleRepresentation::GetIntersectionPosition
int GetIntersectionPosition(double eventPos[2], double worldPos[3], double tolerance=0.0, vtkRenderer *renderer=nullptr)
vtkConstrainedPointHandleRepresentation::SetDisplayPosition
void SetDisplayPosition(double pos[3]) override
Method overridden from Superclass.
vtkGlyph3D
copy oriented and scaled glyph geometry to every input point
Definition: vtkGlyph3D.h:112
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
vtkConstrainedPointHandleRepresentation::SetCursorShape
void SetCursorShape(vtkPolyData *cursorShape)
Specify the cursor shape.
vtkConstrainedPointHandleRepresentation::BuildRepresentation
void BuildRepresentation() override
vtkConstrainedPointHandleRepresentation::Glypher
vtkGlyph3D * Glypher
Definition: vtkConstrainedPointHandleRepresentation.h:239
vtkConstrainedPointHandleRepresentation::StartWidgetInteraction
void StartWidgetInteraction(double eventPos[2]) override
vtkConstrainedPointHandleRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkConstrainedPointHandleRepresentation::GetActors
void GetActors(vtkPropCollection *) override
Methods to make this class behave as a vtkProp.
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
vtkProperty
represent surface properties of a geometric object
Definition: vtkProperty.h:67
vtkConstrainedPointHandleRepresentation::GetProjectionOrigin
void GetProjectionOrigin(double origin[3])
vtkConstrainedPointHandleRepresentation::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
vtkPlaneCollection
maintain a list of planes
Definition: vtkPlaneCollection.h:37
vtkConstrainedPointHandleRepresentation::SetBoundingPlanes
virtual void SetBoundingPlanes(vtkPlaneCollection *)
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:42
vtkConstrainedPointHandleRepresentation::ProjectionNormal
int ProjectionNormal
Definition: vtkConstrainedPointHandleRepresentation.h:262
vtkConstrainedPointHandleRepresentation::GetCursorShape
vtkPolyData * GetCursorShape()
vtkConstrainedPointHandleRepresentation::XAxis
@ XAxis
Definition: vtkConstrainedPointHandleRepresentation.h:228
vtkConstrainedPointHandleRepresentation::FocalPoint
vtkPoints * FocalPoint
Definition: vtkConstrainedPointHandleRepresentation.h:243
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkConstrainedPointHandleRepresentation::SetProjectionPosition
void SetProjectionPosition(double position)
The position of the bounding plane from the origin along the normal.
vtkConstrainedPointHandleRepresentation::SetObliquePlane
void SetObliquePlane(vtkPlane *)
If the ProjectionNormal is set to Oblique, then this is the oblique plane used to constrain the handl...
vtkConstrainedPointHandleRepresentation::Highlight
void Highlight(int highlight) override