VTK  9.1.20211115
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 =========================================================================*/
27 #ifndef vtkPointCloudRepresentation_h
28 #define vtkPointCloudRepresentation_h
29 
30 #include "vtkInteractionWidgetsModule.h" // For export macro
32 
33 class vtkActor;
34 class vtkPolyDataMapper;
35 class vtkOutlineFilter;
36 class vtkActor2D;
37 class vtkCoordinate;
39 class vtkProperty2D;
40 class vtkPolyData;
41 class vtkPicker;
42 class vtkPointPicker;
43 class vtkPointSet;
44 class vtkGlyphSource2D;
45 struct vtkPointCloudPicker;
46 
47 class VTKINTERACTIONWIDGETS_EXPORT vtkPointCloudRepresentation : public vtkWidgetRepresentation
48 {
49  friend struct vtkPointCloudPicker;
50 
51 public:
56 
58 
62  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
66 
77 
79 
82  vtkGetObjectMacro(PointCloudActor, vtkActor);
83  vtkGetObjectMacro(PointCloudMapper, vtkPolyDataMapper);
85 
90  vtkIdType GetPointId() { return this->PointId; }
91 
93 
97  const double* GetPointCoordinates() { return this->PointCoordinates; }
98  void GetPointCoordinates(double x[3])
99  {
100  x[0] = this->PointCoordinates[0];
101  x[1] = this->PointCoordinates[1];
102  x[2] = this->PointCoordinates[2];
103  }
105 
107 
111  vtkSetMacro(Highlighting, bool);
112  vtkGetMacro(Highlighting, bool);
113  vtkBooleanMacro(Highlighting, bool);
115 
116  // Enums define the state of the representation relative to the mouse pointer
117  // position. Used by ComputeInteractionState() to communicate with the
118  // widget.
120  {
121  Outside = 0, // no points nor outline selected
122  OverOutline, // mouse is over the bounding box of the point cloud
123  Over, // mouse is over a point
124  Selecting // user has selected the point
125  };
126 
128 
136  vtkSetClampMacro(InteractionState, int, Outside, Selecting);
138 
140 
143  double* GetBounds() VTK_SIZEHINT(6) override;
144  void BuildRepresentation() override {}
145  int ComputeInteractionState(int X, int Y, int modify = 0) override;
147 
149 
153  void GetActors2D(vtkPropCollection* pc) override;
154  int RenderOpaqueGeometry(vtkViewport* viewport) override;
158  int RenderOverlay(vtkViewport*) override;
160 
162 
181  {
182  HARDWARE_PICKING = 0,
183  SOFTWARE_PICKING
184  };
185  vtkSetClampMacro(PickingMode, int, HARDWARE_PICKING, SOFTWARE_PICKING);
186  vtkGetMacro(PickingMode, int);
187  void SetPickingModeToHardware() { this->SetPickingMode(HARDWARE_PICKING); }
188  void SetPickingModeToSoftware() { this->SetPickingMode(SOFTWARE_PICKING); }
190 
192 
202  vtkSetMacro(HardwarePickingTolerance, unsigned int);
203  vtkGetMacro(HardwarePickingTolerance, unsigned int);
205 
207 
215  vtkSetClampMacro(SoftwarePickingTolerance, double, 0.0, 100.0);
216  vtkGetMacro(SoftwarePickingTolerance, double);
218 
219  /*
220  * Register internal Pickers within PickingManager
221  */
222  void RegisterPickers() override;
223 
224 protected:
227 
228  // The point cloud that is being operated on
232 
233  // The selected point id and coordinates
235  double PointCoordinates[3];
236 
237  // Data members to manage state
243  vtkPointCloudPicker* PointCloudPicker;
244 
245  // Draw an outline around the point cloud
249 
250  // Highlight the selected point
255 
258 
259 private:
261  void operator=(const vtkPointCloudRepresentation&) = delete;
262 };
263 
264 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:149
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
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:113
create wireframe outline for an arbitrary data set or composite dataset
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:62
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.,...
_Picking_Mode
Because point clouds can be very large, alternative point picking approaches can be used to select po...
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 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.
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:106
draw vtkPolyData onto the image plane
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:194
an ordered list of Props
represent surface properties of a 2D image
abstract specification for Viewports
Definition: vtkViewport.h:47
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332
#define VTK_SIZEHINT(...)