VTK  9.3.0
vtkPointCloudRepresentation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
18 #ifndef vtkPointCloudRepresentation_h
19 #define vtkPointCloudRepresentation_h
20 
21 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
22 #include "vtkInteractionWidgetsModule.h" // For export macro
23 #include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkActor;
28 class vtkPolyDataMapper;
29 class vtkOutlineFilter;
30 class vtkActor2D;
31 class vtkCoordinate;
33 class vtkProperty2D;
34 class vtkPolyData;
35 class vtkPicker;
36 class vtkPointPicker;
37 class vtkPointSet;
38 class vtkGlyphSource2D;
39 struct vtkPointCloudPicker;
40 
41 class VTKINTERACTIONWIDGETS_EXPORT vtkPointCloudRepresentation : public vtkWidgetRepresentation
42 {
43  friend struct vtkPointCloudPicker;
44 
45 public:
50 
52 
56  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
60 
71 
73 
76  vtkGetObjectMacro(PointCloudActor, vtkActor);
77  vtkGetObjectMacro(PointCloudMapper, vtkPolyDataMapper);
79 
84  vtkIdType GetPointId() { return this->PointId; }
85 
87 
91  const double* GetPointCoordinates() { return this->PointCoordinates; }
92  void GetPointCoordinates(double x[3])
93  {
94  x[0] = this->PointCoordinates[0];
95  x[1] = this->PointCoordinates[1];
96  x[2] = this->PointCoordinates[2];
97  }
99 
101 
105  vtkSetMacro(Highlighting, bool);
106  vtkGetMacro(Highlighting, bool);
107  vtkBooleanMacro(Highlighting, bool);
109 
110  // Enums define the state of the representation relative to the mouse pointer
111  // position. Used by ComputeInteractionState() to communicate with the
112  // widget.
114  {
115  Outside = 0, // no points nor outline selected
116  OverOutline, // mouse is over the bounding box of the point cloud
117  Over, // mouse is over a point
118  Selecting // user has selected the point
119  };
120 #if !defined(VTK_LEGACY_REMOVE)
121  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
123 #endif
124 
126 
134  vtkSetClampMacro(InteractionState, int, Outside, Selecting);
136 
138 
141  double* GetBounds() VTK_SIZEHINT(6) override;
142  void BuildRepresentation() override {}
143  int ComputeInteractionState(int X, int Y, int modify = 0) override;
145 
147 
151  void GetActors(vtkPropCollection* pc) override;
152  void GetActors2D(vtkPropCollection* pc) override;
153  int RenderOpaqueGeometry(vtkViewport* viewport) override;
157  int RenderOverlay(vtkViewport*) override;
159 
161 
180  {
181  HARDWARE_PICKING = 0,
182  SOFTWARE_PICKING
183  };
184 #if !defined(VTK_LEGACY_REMOVE)
185  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
187 #endif
188  vtkSetClampMacro(PickingMode, int, HARDWARE_PICKING, SOFTWARE_PICKING);
189  vtkGetMacro(PickingMode, int);
190  void SetPickingModeToHardware() { this->SetPickingMode(HARDWARE_PICKING); }
191  void SetPickingModeToSoftware() { this->SetPickingMode(SOFTWARE_PICKING); }
193 
195 
205  vtkSetMacro(HardwarePickingTolerance, unsigned int);
206  vtkGetMacro(HardwarePickingTolerance, unsigned int);
208 
210 
218  vtkSetClampMacro(SoftwarePickingTolerance, double, 0.0, 100.0);
219  vtkGetMacro(SoftwarePickingTolerance, double);
221 
222  /*
223  * Register internal Pickers within PickingManager
224  */
225  void RegisterPickers() override;
226 
227 protected:
230 
231  // The point cloud that is being operated on
235 
236  // The selected point id and coordinates
238  double PointCoordinates[3];
239 
240  // Data members to manage state
246  vtkPointCloudPicker* PointCloudPicker;
247 
248  // Draw an outline around the point cloud
252 
253  // Highlight the selected point
258 
261 
262 private:
264  void operator=(const vtkPointCloudRepresentation&) = delete;
265 };
266 
267 VTK_ABI_NAMESPACE_END
268 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:35
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:69
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition: vtkIndent.h:29
create wireframe outline for an arbitrary data set or composite dataset
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:51
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:59
draw vtkPolyData onto the image plane
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:80
an ordered list of Props
represent surface properties of a 2D image
Definition: vtkProperty2D.h:30
abstract specification for Viewports
Definition: vtkViewport.h:45
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:28
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition: vtkType.h:315
#define VTK_SIZEHINT(...)