VTK  9.3.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 "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 
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 #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;
154  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
156  void ReleaseGraphicsResources(vtkWindow*) 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:
229  ~vtkPointCloudRepresentation() override;
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 
260  void CreateDefaultProperties();
261 
262 private:
264  void operator=(const vtkPointCloudRepresentation&) = delete;
265 };
266 
267 VTK_ABI_NAMESPACE_END
268 #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:40
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract specification for Viewports
Definition: vtkViewport.h:44
void GetActors2D(vtkPropCollection *) override
#define VTK_DEPRECATED_IN_9_2_0(reason)
a actor that draws 2D data
Definition: vtkActor2D.h:34
concrete class for storing a set of points
Definition: vtkPointSet.h:58
int vtkIdType
Definition: vtkType.h:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
abstract class defines interface between the widget and widget representation classes ...
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:50
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:27
const double * GetPointCoordinates()
Retrieve the point coordinates of the selected point.
create wireframe outline for an arbitrary data set or composite dataset
int RenderTranslucentPolygonalGeometry(vtkViewport *vtkNotUsed(viewport)) override
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void RegisterPickers()
Register internal Pickers in the Picking Manager.
represent the vtkPointCloudWidget
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
int RenderOpaqueGeometry(vtkViewport *vtkNotUsed(viewport)) override
#define VTK_SIZEHINT(...)
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems ...
Definition: vtkCoordinate.h:68
vtkIdType GetPointId()
Retrieve the point id from the selected point.
int RenderOverlay(vtkViewport *vtkNotUsed(viewport)) override
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:29
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...