VTK  9.2.20230606
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
35 #include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
37 
38 VTK_ABI_NAMESPACE_BEGIN
39 class vtkActor;
40 class vtkPolyDataMapper;
41 class vtkOutlineFilter;
42 class vtkActor2D;
43 class vtkCoordinate;
45 class vtkProperty2D;
46 class vtkPolyData;
47 class vtkPicker;
48 class vtkPointPicker;
49 class vtkPointSet;
50 class vtkGlyphSource2D;
51 struct vtkPointCloudPicker;
52 
53 class VTKINTERACTIONWIDGETS_EXPORT vtkPointCloudRepresentation : public vtkWidgetRepresentation
54 {
55  friend struct vtkPointCloudPicker;
56 
57 public:
62 
64 
68  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
72 
83 
85 
88  vtkGetObjectMacro(PointCloudActor, vtkActor);
89  vtkGetObjectMacro(PointCloudMapper, vtkPolyDataMapper);
91 
96  vtkIdType GetPointId() { return this->PointId; }
97 
99 
103  const double* GetPointCoordinates() { return this->PointCoordinates; }
104  void GetPointCoordinates(double x[3])
105  {
106  x[0] = this->PointCoordinates[0];
107  x[1] = this->PointCoordinates[1];
108  x[2] = this->PointCoordinates[2];
109  }
111 
113 
117  vtkSetMacro(Highlighting, bool);
118  vtkGetMacro(Highlighting, bool);
119  vtkBooleanMacro(Highlighting, bool);
121 
122  // Enums define the state of the representation relative to the mouse pointer
123  // position. Used by ComputeInteractionState() to communicate with the
124  // widget.
126  {
127  Outside = 0, // no points nor outline selected
128  OverOutline, // mouse is over the bounding box of the point cloud
129  Over, // mouse is over a point
130  Selecting // user has selected the point
131  };
132 #if !defined(VTK_LEGACY_REMOVE)
133  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
135 #endif
136 
138 
146  vtkSetClampMacro(InteractionState, int, Outside, Selecting);
148 
150 
153  double* GetBounds() VTK_SIZEHINT(6) override;
154  void BuildRepresentation() override {}
155  int ComputeInteractionState(int X, int Y, int modify = 0) override;
157 
159 
163  void GetActors(vtkPropCollection* pc) override;
164  void GetActors2D(vtkPropCollection* pc) override;
165  int RenderOpaqueGeometry(vtkViewport* viewport) override;
169  int RenderOverlay(vtkViewport*) override;
171 
173 
192  {
193  HARDWARE_PICKING = 0,
194  SOFTWARE_PICKING
195  };
196 #if !defined(VTK_LEGACY_REMOVE)
197  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
199 #endif
200  vtkSetClampMacro(PickingMode, int, HARDWARE_PICKING, SOFTWARE_PICKING);
201  vtkGetMacro(PickingMode, int);
202  void SetPickingModeToHardware() { this->SetPickingMode(HARDWARE_PICKING); }
203  void SetPickingModeToSoftware() { this->SetPickingMode(SOFTWARE_PICKING); }
205 
207 
217  vtkSetMacro(HardwarePickingTolerance, unsigned int);
218  vtkGetMacro(HardwarePickingTolerance, unsigned int);
220 
222 
230  vtkSetClampMacro(SoftwarePickingTolerance, double, 0.0, 100.0);
231  vtkGetMacro(SoftwarePickingTolerance, double);
233 
234  /*
235  * Register internal Pickers within PickingManager
236  */
237  void RegisterPickers() override;
238 
239 protected:
242 
243  // The point cloud that is being operated on
247 
248  // The selected point id and coordinates
250  double PointCoordinates[3];
251 
252  // Data members to manage state
258  vtkPointCloudPicker* PointCloudPicker;
259 
260  // Draw an outline around the point cloud
264 
265  // Highlight the selected point
270 
273 
274 private:
276  void operator=(const vtkPointCloudRepresentation&) = delete;
277 };
278 
279 VTK_ABI_NAMESPACE_END
280 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:156
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:162
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:120
create wireframe outline for an arbitrary data set or composite dataset
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:63
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:110
draw vtkPolyData onto the image plane
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:201
an ordered list of Props
represent surface properties of a 2D image
abstract specification for Viewports
Definition: vtkViewport.h:57
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:40
int vtkTypeBool
Definition: vtkABI.h:71
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition: vtkType.h:327
#define VTK_SIZEHINT(...)