VTK  9.7.1
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 
68  void PlacePointCloud(vtkActor* a);
69  void PlacePointCloud(vtkPointSet* ps);
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;
150  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
152  void ReleaseGraphicsResources(vtkWindow*) 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:
221  ~vtkPointCloudRepresentation() override;
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 
252  void CreateDefaultProperties();
253 
254 private:
256  void operator=(const vtkPointCloudRepresentation&) = delete;
257 };
258 
259 VTK_ABI_NAMESPACE_END
260 #endif
PickingModeType
Because point clouds can be very large, alternative point picking approaches can be used to select po...
void SetPickingModeToHardware()
Because point clouds can be very large, alternative point picking approaches can be used to select po...
void GetPointCoordinates(double x[3])
Retrieve the point coordinates of the selected point.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract specification for Viewports
Definition: vtkViewport.h:46
void GetActors2D(vtkPropCollection *) override
a actor that draws 2D data
Definition: vtkActor2D.h:35
concrete class for storing a set of points
Definition: vtkPointSet.h:58
int vtkIdType
Definition: vtkType.h:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
abstract class defines interface between the widget and widget representation classes ...
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:52
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
double * GetBounds() override
Methods to make this class behave as a vtkProp.
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
const double * GetPointCoordinates()
Retrieve the point coordinates of the selected point.
create wireframe outline for an arbitrary data set or composite dataset
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
represent the vtkPointCloudWidget
int RenderOverlay(vtkViewport *viewport) override
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
#define VTK_SIZEHINT(...)
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems ...
Definition: vtkCoordinate.h:69
vtkIdType GetPointId()
Retrieve the point id from the selected point.
select a point by shooting a ray into a graphics window
map vtkPolyData to graphics primitives
vtkTypeBool HasTranslucentPolygonalGeometry() override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
represent surface properties of a 2D image
Definition: vtkProperty2D.h:30
#define VTK_MARSHALAUTO
create 2D glyphs represented by vtkPolyData
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
draw vtkPolyData onto the image plane
void SetPickingModeToSoftware()
Because point clouds can be very large, alternative point picking approaches can be used to select po...