VTK  9.2.6
vtkPointCloudRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPointCloudRepresentation.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
30 #ifndef vtkPointCloudRepresentation_h
31 #define vtkPointCloudRepresentation_h
32 
33 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
34 #include "vtkInteractionWidgetsModule.h" // For export macro
36 
37 class vtkActor;
38 class vtkPolyDataMapper;
39 class vtkOutlineFilter;
40 class vtkActor2D;
41 class vtkCoordinate;
43 class vtkProperty2D;
44 class vtkPolyData;
45 class vtkPicker;
46 class vtkPointPicker;
47 class vtkPointSet;
48 class vtkGlyphSource2D;
49 struct vtkPointCloudPicker;
50 
51 class VTKINTERACTIONWIDGETS_EXPORT vtkPointCloudRepresentation : public vtkWidgetRepresentation
52 {
53  friend struct vtkPointCloudPicker;
54 
55 public:
60 
62 
66  void PrintSelf(ostream& os, vtkIndent indent) override;
68 
70 
78  void PlacePointCloud(vtkActor* a);
79  void PlacePointCloud(vtkPointSet* ps);
81 
83 
86  vtkGetObjectMacro(PointCloudActor, vtkActor);
87  vtkGetObjectMacro(PointCloudMapper, vtkPolyDataMapper);
89 
94  vtkIdType GetPointId() { return this->PointId; }
95 
97 
101  const double* GetPointCoordinates() { return this->PointCoordinates; }
102  void GetPointCoordinates(double x[3])
103  {
104  x[0] = this->PointCoordinates[0];
105  x[1] = this->PointCoordinates[1];
106  x[2] = this->PointCoordinates[2];
107  }
109 
111 
115  vtkSetMacro(Highlighting, bool);
116  vtkGetMacro(Highlighting, bool);
117  vtkBooleanMacro(Highlighting, bool);
119 
120  // Enums define the state of the representation relative to the mouse pointer
121  // position. Used by ComputeInteractionState() to communicate with the
122  // widget.
124  {
125  Outside = 0, // no points nor outline selected
126  OverOutline, // mouse is over the bounding box of the point cloud
127  Over, // mouse is over a point
128  Selecting // user has selected the point
129  };
130 #if !defined(VTK_LEGACY_REMOVE)
131  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
133 #endif
134 
136 
144  vtkSetClampMacro(InteractionState, int, Outside, Selecting);
146 
148 
151  double* GetBounds() VTK_SIZEHINT(6) override;
152  void BuildRepresentation() override {}
153  int ComputeInteractionState(int X, int Y, int modify = 0) override;
155 
157 
161  void GetActors(vtkPropCollection* pc) override;
162  void GetActors2D(vtkPropCollection* pc) override;
163  int RenderOpaqueGeometry(vtkViewport* viewport) override;
164  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
166  void ReleaseGraphicsResources(vtkWindow*) override;
167  int RenderOverlay(vtkViewport*) override;
169 
171 
190  {
191  HARDWARE_PICKING = 0,
192  SOFTWARE_PICKING
193  };
194 #if !defined(VTK_LEGACY_REMOVE)
195  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
197 #endif
198  vtkSetClampMacro(PickingMode, int, HARDWARE_PICKING, SOFTWARE_PICKING);
199  vtkGetMacro(PickingMode, int);
200  void SetPickingModeToHardware() { this->SetPickingMode(HARDWARE_PICKING); }
201  void SetPickingModeToSoftware() { this->SetPickingMode(SOFTWARE_PICKING); }
203 
205 
215  vtkSetMacro(HardwarePickingTolerance, unsigned int);
216  vtkGetMacro(HardwarePickingTolerance, unsigned int);
218 
220 
228  vtkSetClampMacro(SoftwarePickingTolerance, double, 0.0, 100.0);
229  vtkGetMacro(SoftwarePickingTolerance, double);
231 
232  /*
233  * Register internal Pickers within PickingManager
234  */
235  void RegisterPickers() override;
236 
237 protected:
239  ~vtkPointCloudRepresentation() override;
240 
241  // The point cloud that is being operated on
245 
246  // The selected point id and coordinates
248  double PointCoordinates[3];
249 
250  // Data members to manage state
256  vtkPointCloudPicker* PointCloudPicker;
257 
258  // Draw an outline around the point cloud
262 
263  // Highlight the selected point
268 
270  void CreateDefaultProperties();
271 
272 private:
274  void operator=(const vtkPointCloudRepresentation&) = delete;
275 };
276 
277 #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:51
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract specification for Viewports
Definition: vtkViewport.h:55
void GetActors2D(vtkPropCollection *) override
#define VTK_DEPRECATED_IN_9_2_0(reason)
a actor that draws 2D data
Definition: vtkActor2D.h:45
concrete class for storing a set of points
Definition: vtkPointSet.h:69
int vtkIdType
Definition: vtkType.h:332
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
abstract class defines interface between the widget and widget representation classes ...
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:61
double * GetBounds() override
Methods to make this class behave as a vtkProp.
an ordered list of Props
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
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:39
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:79
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:40
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...