VTK  9.3.20231204
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 
24 VTK_ABI_NAMESPACE_BEGIN
25 class vtkActor;
26 class vtkPolyDataMapper;
27 class vtkOutlineFilter;
28 class vtkActor2D;
29 class vtkCoordinate;
31 class vtkProperty2D;
32 class vtkPolyData;
33 class vtkPicker;
34 class vtkPointPicker;
35 class vtkPointSet;
36 class vtkGlyphSource2D;
37 struct vtkPointCloudPicker;
38 
39 class VTKINTERACTIONWIDGETS_EXPORT vtkPointCloudRepresentation : public vtkWidgetRepresentation
40 {
41  friend struct vtkPointCloudPicker;
42 
43 public:
48 
50 
54  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
69 
71 
74  vtkGetObjectMacro(PointCloudActor, vtkActor);
75  vtkGetObjectMacro(PointCloudMapper, vtkPolyDataMapper);
77 
82  vtkIdType GetPointId() { return this->PointId; }
83 
85 
89  const double* GetPointCoordinates() { return this->PointCoordinates; }
90  void GetPointCoordinates(double x[3])
91  {
92  x[0] = this->PointCoordinates[0];
93  x[1] = this->PointCoordinates[1];
94  x[2] = this->PointCoordinates[2];
95  }
97 
99 
103  vtkSetMacro(Highlighting, bool);
104  vtkGetMacro(Highlighting, bool);
105  vtkBooleanMacro(Highlighting, bool);
107 
108  // Enums define the state of the representation relative to the mouse pointer
109  // position. Used by ComputeInteractionState() to communicate with the
110  // widget.
112  {
113  Outside = 0, // no points nor outline selected
114  OverOutline, // mouse is over the bounding box of the point cloud
115  Over, // mouse is over a point
116  Selecting // user has selected the point
117  };
118 
120 
128  vtkSetClampMacro(InteractionState, int, Outside, Selecting);
130 
132 
135  double* GetBounds() VTK_SIZEHINT(6) override;
136  void BuildRepresentation() override {}
137  int ComputeInteractionState(int X, int Y, int modify = 0) override;
139 
141 
145  void GetActors(vtkPropCollection* pc) override;
146  void GetActors2D(vtkPropCollection* pc) override;
147  int RenderOpaqueGeometry(vtkViewport* viewport) override;
151  int RenderOverlay(vtkViewport*) override;
153 
155 
174  {
175  HARDWARE_PICKING = 0,
176  SOFTWARE_PICKING
177  };
178  vtkSetClampMacro(PickingMode, int, HARDWARE_PICKING, SOFTWARE_PICKING);
179  vtkGetMacro(PickingMode, int);
180  void SetPickingModeToHardware() { this->SetPickingMode(HARDWARE_PICKING); }
181  void SetPickingModeToSoftware() { this->SetPickingMode(SOFTWARE_PICKING); }
183 
185 
195  vtkSetMacro(HardwarePickingTolerance, unsigned int);
196  vtkGetMacro(HardwarePickingTolerance, unsigned int);
198 
200 
208  vtkSetClampMacro(SoftwarePickingTolerance, double, 0.0, 100.0);
209  vtkGetMacro(SoftwarePickingTolerance, double);
211 
212  /*
213  * Register internal Pickers within PickingManager
214  */
215  void RegisterPickers() override;
216 
217 protected:
220 
221  // The point cloud that is being operated on
225 
226  // The selected point id and coordinates
228  double PointCoordinates[3];
229 
230  // Data members to manage state
236  vtkPointCloudPicker* PointCloudPicker;
237 
238  // Draw an outline around the point cloud
242 
243  // Highlight the selected point
248 
251 
252 private:
254  void operator=(const vtkPointCloudRepresentation&) = delete;
255 };
256 
257 VTK_ABI_NAMESPACE_END
258 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:144
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:150
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:97
draw vtkPolyData onto the image plane
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:180
an ordered list of Props
represent surface properties of a 2D image
abstract specification for Viewports
Definition: vtkViewport.h:64
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:47
int vtkTypeBool
Definition: vtkABI.h:64
int vtkIdType
Definition: vtkType.h:315
#define VTK_SIZEHINT(...)