VTK  9.2.5
vtkPointCloudRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPointCloudRepresentation.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 =========================================================================*/
30 #ifndef vtkPointCloudRepresentation_h
31 #define vtkPointCloudRepresentation_h
32 
33 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
34 #include "vtkInteractionWidgetsModule.h" // For export macro
36 
37 class vtkActor;
38 class vtkPolyDataMapper;
39 class vtkOutlineFilter;
40 class vtkActor2D;
41 class vtkCoordinate;
43 class vtkProperty2D;
44 class vtkPolyData;
45 class vtkPicker;
46 class vtkPointPicker;
47 class vtkPointSet;
48 class vtkGlyphSource2D;
49 struct vtkPointCloudPicker;
50 
51 class VTKINTERACTIONWIDGETS_EXPORT vtkPointCloudRepresentation : public vtkWidgetRepresentation
52 {
53  friend struct vtkPointCloudPicker;
54 
55 public:
60 
62 
66  void PrintSelf(ostream& os, vtkIndent indent) override;
68 
70 
81 
83 
86  vtkGetObjectMacro(PointCloudActor, vtkActor);
87  vtkGetObjectMacro(PointCloudMapper, vtkPolyDataMapper);
89 
94  vtkIdType GetPointId() { return this->PointId; }
95 
97 
101  const double* GetPointCoordinates() { return this->PointCoordinates; }
102  void GetPointCoordinates(double x[3])
103  {
104  x[0] = this->PointCoordinates[0];
105  x[1] = this->PointCoordinates[1];
106  x[2] = this->PointCoordinates[2];
107  }
109 
111 
115  vtkSetMacro(Highlighting, bool);
116  vtkGetMacro(Highlighting, bool);
117  vtkBooleanMacro(Highlighting, bool);
119 
120  // Enums define the state of the representation relative to the mouse pointer
121  // position. Used by ComputeInteractionState() to communicate with the
122  // widget.
124  {
125  Outside = 0, // no points nor outline selected
126  OverOutline, // mouse is over the bounding box of the point cloud
127  Over, // mouse is over a point
128  Selecting // user has selected the point
129  };
130 #if !defined(VTK_LEGACY_REMOVE)
131  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
133 #endif
134 
136 
144  vtkSetClampMacro(InteractionState, int, Outside, Selecting);
146 
148 
151  double* GetBounds() VTK_SIZEHINT(6) override;
152  void BuildRepresentation() override {}
153  int ComputeInteractionState(int X, int Y, int modify = 0) override;
155 
157 
161  void GetActors(vtkPropCollection* pc) override;
162  void GetActors2D(vtkPropCollection* pc) override;
163  int RenderOpaqueGeometry(vtkViewport* viewport) override;
167  int RenderOverlay(vtkViewport*) override;
169 
171 
190  {
191  HARDWARE_PICKING = 0,
192  SOFTWARE_PICKING
193  };
194 #if !defined(VTK_LEGACY_REMOVE)
195  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
197 #endif
198  vtkSetClampMacro(PickingMode, int, HARDWARE_PICKING, SOFTWARE_PICKING);
199  vtkGetMacro(PickingMode, int);
200  void SetPickingModeToHardware() { this->SetPickingMode(HARDWARE_PICKING); }
201  void SetPickingModeToSoftware() { this->SetPickingMode(SOFTWARE_PICKING); }
203 
205 
215  vtkSetMacro(HardwarePickingTolerance, unsigned int);
216  vtkGetMacro(HardwarePickingTolerance, unsigned int);
218 
220 
228  vtkSetClampMacro(SoftwarePickingTolerance, double, 0.0, 100.0);
229  vtkGetMacro(SoftwarePickingTolerance, double);
231 
232  /*
233  * Register internal Pickers within PickingManager
234  */
235  void RegisterPickers() override;
236 
237 protected:
240 
241  // The point cloud that is being operated on
245 
246  // The selected point id and coordinates
248  double PointCoordinates[3];
249 
250  // Data members to manage state
256  vtkPointCloudPicker* PointCloudPicker;
257 
258  // Draw an outline around the point cloud
262 
263  // Highlight the selected point
268 
271 
272 private:
274  void operator=(const vtkPointCloudRepresentation&) = delete;
275 };
276 
277 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:155
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition: vtkIndent.h:119
create wireframe outline for an arbitrary data set or composite dataset
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:62
represent the vtkPointCloudWidget
double * GetBounds() override
Some methods required to satisfy the vtkWidgetRepresentation API.
const double * GetPointCoordinates()
Retrieve the point coordinates of the selected point.
int RenderOpaqueGeometry(vtkViewport *viewport) override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
void GetActors2D(vtkPropCollection *pc) override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
vtkIdType GetPointId()
Retrieve the point id from the selected point.
void GetPointCoordinates(double x[3])
Retrieve the point coordinates of the selected point.
void SetPickingModeToHardware()
Because point clouds can be very large, alternative point picking approaches can be used to select po...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK class methods for obtaining type information and printing.
void ReleaseGraphicsResources(vtkWindow *) override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
void GetActors(vtkPropCollection *pc) override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
void PlacePointCloud(vtkPointSet *ps)
Specify and place either an actor (vtkActor) or a point set (vtkPointSet) that represents the point c...
int ComputeInteractionState(int X, int Y, int modify=0) override
Some methods required to satisfy the vtkWidgetRepresentation API.
PickingModeType
Because point clouds can be very large, alternative point picking approaches can be used to select po...
void PlacePointCloud(vtkActor *a)
Specify and place either an actor (vtkActor) or a point set (vtkPointSet) that represents the point c...
static vtkPointCloudRepresentation * New()
Instantiate this class.
~vtkPointCloudRepresentation() override
vtkTypeBool HasTranslucentPolygonalGeometry() override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
int RenderOverlay(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
void SetPickingModeToSoftware()
Because point clouds can be very large, alternative point picking approaches can be used to select po...
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
select a point by shooting a ray into a graphics window
concrete class for storing a set of points
Definition: vtkPointSet.h:109
draw vtkPolyData onto the image plane
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
an ordered list of Props
represent surface properties of a 2D image
abstract specification for Viewports
Definition: vtkViewport.h:56
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition: vtkType.h:332
#define VTK_SIZEHINT(...)