VTK  9.3.20240416
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 "vtkInteractionWidgetsModule.h" // For export macro
23 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkActor;
27 class vtkPolyDataMapper;
28 class vtkOutlineFilter;
29 class vtkActor2D;
30 class vtkCoordinate;
32 class vtkProperty2D;
33 class vtkPolyData;
34 class vtkPicker;
35 class vtkPointPicker;
36 class vtkPointSet;
37 class vtkGlyphSource2D;
38 struct vtkPointCloudPicker;
39 
40 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkPointCloudRepresentation
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 
122 
130  vtkSetClampMacro(InteractionState, int, Outside, Selecting);
132 
134 
137  double* GetBounds() VTK_SIZEHINT(6) override;
138  void BuildRepresentation() override {}
139  int ComputeInteractionState(int X, int Y, int modify = 0) override;
141 
143 
147  void GetActors(vtkPropCollection* pc) override;
148  void GetActors2D(vtkPropCollection* pc) override;
149  int RenderOpaqueGeometry(vtkViewport* viewport) override;
153  int RenderOverlay(vtkViewport*) override;
155 
157 
176  {
177  HARDWARE_PICKING = 0,
178  SOFTWARE_PICKING
179  };
180  vtkSetClampMacro(PickingMode, int, HARDWARE_PICKING, SOFTWARE_PICKING);
181  vtkGetMacro(PickingMode, int);
182  void SetPickingModeToHardware() { this->SetPickingMode(HARDWARE_PICKING); }
183  void SetPickingModeToSoftware() { this->SetPickingMode(SOFTWARE_PICKING); }
185 
187 
197  vtkSetMacro(HardwarePickingTolerance, unsigned int);
198  vtkGetMacro(HardwarePickingTolerance, unsigned int);
200 
202 
210  vtkSetClampMacro(SoftwarePickingTolerance, double, 0.0, 100.0);
211  vtkGetMacro(SoftwarePickingTolerance, double);
213 
214  /*
215  * Register internal Pickers within PickingManager
216  */
217  void RegisterPickers() override;
218 
219 protected:
222 
223  // The point cloud that is being operated on
227 
228  // The selected point id and coordinates
230  double PointCoordinates[3];
231 
232  // Data members to manage state
238  vtkPointCloudPicker* PointCloudPicker;
239 
240  // Draw an outline around the point cloud
244 
245  // Highlight the selected point
250 
253 
254 private:
256  void operator=(const vtkPointCloudRepresentation&) = delete;
257 };
258 
259 VTK_ABI_NAMESPACE_END
260 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:145
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:151
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:108
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:98
draw vtkPolyData onto the image plane
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:181
an ordered list of Props
represent surface properties of a 2D image
abstract specification for Viewports
Definition: vtkViewport.h:65
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
int vtkTypeBool
Definition: vtkABI.h:64
int vtkIdType
Definition: vtkType.h:315
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO