VTK  9.1.0
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
vtkPolyDataMapper
map vtkPolyData to graphics primitives
Definition: vtkPolyDataMapper.h:146
vtkWidgetRepresentation.h
vtkGlyphSource2D
create 2D glyphs represented by vtkPolyData
Definition: vtkGlyphSource2D.h:76
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:154
vtkPointCloudRepresentation::SetPickingModeToHardware
void SetPickingModeToHardware()
Because point clouds can be very large, alternative point picking approaches can be used to select po...
Definition: vtkPointCloudRepresentation.h:187
vtkPointCloudRepresentation::GetActors2D
void GetActors2D(vtkPropCollection *pc) override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
vtkPointCloudRepresentation::GetBounds
double * GetBounds() override
Some methods required to satisfy the vtkWidgetRepresentation API.
vtkPointCloudRepresentation::SetPickingModeToSoftware
void SetPickingModeToSoftware()
Because point clouds can be very large, alternative point picking approaches can be used to select po...
Definition: vtkPointCloudRepresentation.h:188
vtkPointCloudRepresentation::RenderOverlay
int RenderOverlay(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkPointCloudRepresentation::GetPointCoordinates
void GetPointCoordinates(double x[3])
Retrieve the point coordinates of the selected point.
Definition: vtkPointCloudRepresentation.h:98
vtkPointCloudRepresentation::PickingMode
int PickingMode
Definition: vtkPointCloudRepresentation.h:239
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:60
vtkPointPicker
select a point by shooting a ray into a graphics window
Definition: vtkPointPicker.h:111
vtkPointCloudRepresentation::ComputeInteractionState
int ComputeInteractionState(int X, int Y, int modify=0) override
Some methods required to satisfy the vtkWidgetRepresentation API.
vtkPointCloudRepresentation::_InteractionState
_InteractionState
Definition: vtkPointCloudRepresentation.h:120
vtkPicker
superclass for 3D geometric pickers (uses ray cast)
Definition: vtkPicker.h:62
vtkPointCloudRepresentation::vtkPointCloudRepresentation
vtkPointCloudRepresentation()
vtkPointCloudRepresentation::~vtkPointCloudRepresentation
~vtkPointCloudRepresentation() override
vtkPointCloudRepresentation::GetPointId
vtkIdType GetPointId()
Retrieve the point id from the selected point.
Definition: vtkPointCloudRepresentation.h:90
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
vtkPointCloudRepresentation::OutlineMapper
vtkPolyDataMapper * OutlineMapper
Definition: vtkPointCloudRepresentation.h:247
vtkPointCloudRepresentation::PointCloudPicker
vtkPointCloudPicker * PointCloudPicker
Definition: vtkPointCloudRepresentation.h:243
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:48
vtkPointCloudRepresentation::SelectionProperty
vtkProperty2D * SelectionProperty
Definition: vtkPointCloudRepresentation.h:256
vtkPointCloudRepresentation::GetPointCoordinates
const double * GetPointCoordinates()
Retrieve the point coordinates of the selected point.
Definition: vtkPointCloudRepresentation.h:97
vtkPointCloudRepresentation::HardwarePickingTolerance
unsigned int HardwarePickingTolerance
Definition: vtkPointCloudRepresentation.h:240
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:155
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkPointCloudRepresentation::OverOutline
@ OverOutline
Definition: vtkPointCloudRepresentation.h:122
vtkPointCloudRepresentation
represent the vtkPointCloudWidget
Definition: vtkPointCloudRepresentation.h:48
vtkCoordinate
perform coordinate transformation, and represent position, in a variety of vtk coordinate systems
Definition: vtkCoordinate.h:186
vtkPointCloudRepresentation::SoftwarePickingTolerance
double SoftwarePickingTolerance
Definition: vtkPointCloudRepresentation.h:241
vtkPointCloudRepresentation::PointId
vtkIdType PointId
Definition: vtkPointCloudRepresentation.h:234
vtkPointCloudRepresentation::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
vtkPointCloudRepresentation::SelectionActor
vtkActor2D * SelectionActor
Definition: vtkPointCloudRepresentation.h:251
vtkPointCloudRepresentation::RegisterPickers
void RegisterPickers() override
Register internal Pickers in the Picking Manager.
vtkPointCloudRepresentation::PointCloudMapper
vtkPolyDataMapper * PointCloudMapper
Definition: vtkPointCloudRepresentation.h:230
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkPointCloudRepresentation::OutlineActor
vtkActor * OutlineActor
Definition: vtkPointCloudRepresentation.h:246
vtkPointCloudRepresentation::_Picking_Mode
_Picking_Mode
Because point clouds can be very large, alternative point picking approaches can be used to select po...
Definition: vtkPointCloudRepresentation.h:181
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:147
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:149
vtkPointCloudRepresentation::OutlinePicker
vtkPicker * OutlinePicker
Definition: vtkPointCloudRepresentation.h:242
vtkPointCloudRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK class methods for obtaining type information and printing.
vtkPointCloudRepresentation::SelectionMapper
vtkPolyDataMapper2D * SelectionMapper
Definition: vtkPointCloudRepresentation.h:253
vtkPointCloudRepresentation::Over
@ Over
Definition: vtkPointCloudRepresentation.h:123
vtkPointCloudRepresentation::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *viewport) override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
vtkPointSet
concrete class for storing a set of points
Definition: vtkPointSet.h:106
vtkPointCloudRepresentation::PlacePointCloud
void PlacePointCloud(vtkActor *a)
Specify and place either an actor (vtkActor) or a point set (vtkPointSet) that represents the point c...
vtkPointCloudRepresentation::PointCloudActor
vtkActor * PointCloudActor
Definition: vtkPointCloudRepresentation.h:229
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
vtkOutlineFilter
create wireframe outline for an arbitrary data set or composite dataset
Definition: vtkOutlineFilter.h:151
vtkPointCloudRepresentation::SelectionShape
vtkGlyphSource2D * SelectionShape
Definition: vtkPointCloudRepresentation.h:254
vtkPointCloudRepresentation::PointCloud
vtkPointSet * PointCloud
Definition: vtkPointCloudRepresentation.h:231
vtkPointCloudRepresentation::PlacePointCloud
void PlacePointCloud(vtkPointSet *ps)
Specify and place either an actor (vtkActor) or a point set (vtkPointSet) that represents the point c...
vtkPointCloudRepresentation::Highlighting
bool Highlighting
Definition: vtkPointCloudRepresentation.h:238
vtkPointCloudRepresentation::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
vtkPointCloudRepresentation::SelectionCoordinate
vtkCoordinate * SelectionCoordinate
Definition: vtkPointCloudRepresentation.h:252
vtkPropCollection
an ordered list of Props
Definition: vtkPropCollection.h:85
vtkPointCloudRepresentation::CreateDefaultProperties
void CreateDefaultProperties()
vtkPointCloudRepresentation::OutlineFilter
vtkOutlineFilter * OutlineFilter
Definition: vtkPointCloudRepresentation.h:248
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPointCloudRepresentation::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
These methods are necessary to make this representation behave as a vtkProp (i.e.,...
vtkPointCloudRepresentation::New
static vtkPointCloudRepresentation * New()
Instantiate this class.