VTK  9.2.6
vtkPointSet.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPointSet.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 =========================================================================*/
55 #ifndef vtkPointSet_h
56 #define vtkPointSet_h
57 
58 #include "vtkCommonDataModelModule.h" // For export macro
59 #include "vtkDataSet.h"
60 
61 #include "vtkCellTypes.h" // For GetCellType
62 #include "vtkEmptyCell.h" // For GetCell
63 #include "vtkGenericCell.h" // For GetCell
64 #include "vtkPoints.h" // Needed for inline methods
65 
68 
69 class VTKCOMMONDATAMODEL_EXPORT vtkPointSet : public vtkDataSet
70 {
71 public:
75  static vtkPointSet* New();
76  static vtkPointSet* ExtendedNew();
77 
79 
82  vtkTypeMacro(vtkPointSet, vtkDataSet);
83  void PrintSelf(ostream& os, vtkIndent indent) override;
85 
87 
96  vtkSetMacro(Editable, bool);
97  vtkGetMacro(Editable, bool);
98  vtkBooleanMacro(Editable, bool);
100 
104  void Initialize() override;
105 
109  void CopyStructure(vtkDataSet* pd) override;
110 
112 
115  vtkIdType GetNumberOfPoints() override;
116  void GetPoint(vtkIdType ptId, double x[3]) override { this->Points->GetPoint(ptId, x); }
117  vtkIdType FindPoint(double x[3]) override;
118  vtkIdType FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z); }
119  vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
120  double pcoords[3], double* weights) override;
121  vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
122  double tol2, int& subId, double pcoords[3], double* weights) override;
124 
126 
129  vtkIdType GetNumberOfCells() override { return 0; }
130  int GetMaxCellSize() override { return 0; }
132 
133  using Superclass::GetCell;
138  vtkCell* GetCell(vtkIdType) override { return this->EmptyCell; }
139 
141 
145  void GetCellPoints(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
146  void GetPointCells(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
148 
152  void GetCell(vtkIdType, vtkGenericCell* cell) override { cell->SetCellTypeToEmptyCell(); }
153 
158  int GetCellType(vtkIdType) override { return VTK_EMPTY_CELL; }
159 
164  vtkIdType GetCellSize(vtkIdType) override { return 1; }
165 
172  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override { return this->Points->GetPoint(ptId); }
173 
177  vtkCellIterator* NewCellIterator() override;
178 
180 
184  void BuildPointLocator();
185  void BuildLocator() { this->BuildPointLocator(); }
187 
192  void BuildCellLocator();
193 
195 
201  virtual void SetPointLocator(vtkAbstractPointLocator*);
202  vtkGetObjectMacro(PointLocator, vtkAbstractPointLocator);
204 
206 
210  virtual void SetCellLocator(vtkAbstractCellLocator*);
211  vtkGetObjectMacro(CellLocator, vtkAbstractCellLocator);
213 
217  vtkMTimeType GetMTime() override;
218 
222  void ComputeBounds() override;
223 
227  void Squeeze() override;
228 
230 
233  virtual void SetPoints(vtkPoints*);
234  vtkGetObjectMacro(Points, vtkPoints);
236 
245  unsigned long GetActualMemorySize() override;
246 
248 
251  void ShallowCopy(vtkDataObject* src) override;
252  void DeepCopy(vtkDataObject* src) override;
254 
256 
259  bool UsesGarbageCollector() const override { return true; }
261 
263 
267  static vtkPointSet* GetData(vtkInformationVector* v, int i = 0);
269 
270 protected:
271  vtkPointSet();
272  ~vtkPointSet() override;
273 
274  bool Editable;
278 
279  void ReportReferences(vtkGarbageCollector*) override;
280 
281 private:
282  void Cleanup();
283  vtkEmptyCell* EmptyCell;
284 
285  vtkPointSet(const vtkPointSet&) = delete;
286  void operator=(const vtkPointSet&) = delete;
287 };
288 
290 {
291  if (this->Points)
292  {
293  return this->Points->GetNumberOfPoints();
294  }
295  else
296  {
297  return 0;
298  }
299 }
300 
301 #endif
vtkIdType GetCellSize(vtkIdType) override
This method always returns 1, as all cells are point in a pure vtkPointSet.
Definition: vtkPointSet.h:164
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:289
static vtkDataObject * New()
virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights)=0
Locate cell based on global coordinate x and tolerance squared.
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
virtual vtkIdType GetNumberOfPoints()=0
Determine the number of points composing the dataset.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
void Reset()
Reset to an empty state but retain previously allocated memory.
Definition: vtkIdList.h:148
an abstract base class for locators which find cells
void GetCellPoints(vtkIdType, vtkIdList *idList) override
Topological inquiry to get points defining cell.
Definition: vtkPointSet.h:145
virtual void ComputeBounds()
Compute the data bounding box from data points.
concrete class for storing a set of points
Definition: vtkPointSet.h:69
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:129
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:32
int vtkIdType
Definition: vtkType.h:332
vtkAbstractPointLocator * PointLocator
Definition: vtkPointSet.h:276
virtual void Squeeze()
Reclaim any extra memory used to store data.
int GetCellType(vtkIdType) override
This method always returns VTK_EMPTY_CELL, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:158
vtkIdType FindPoint(double x, double y, double z)
See vtkDataSet for additional information.
Definition: vtkPointSet.h:118
static vtkDataSet * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
double * GetPoint(vtkIdType ptId) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:172
Detect and break reference loops.
provides thread-safe access to cells
void GetCell(vtkIdType, vtkGenericCell *cell) override
This method sets cell to be an empty cell.
Definition: vtkPointSet.h:152
bool UsesGarbageCollector() const override
Overwritten to handle the data/locator loop.
Definition: vtkPointSet.h:259
abstract class to specify cell behavior
Definition: vtkCell.h:60
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void ReportReferences(vtkGarbageCollector *)
abstract class to quickly locate points in 3-space
list of point or cell ids
Definition: vtkIdList.h:33
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
vtkMTimeType GetMTime() override
Datasets are composite objects and need to check each part for MTime THIS METHOD IS THREAD SAFE...
virtual vtkCellIterator * NewCellIterator()
Return an iterator that traverses the cells in this data set.
vtkPoints * Points
Definition: vtkPointSet.h:275
void DeepCopy(vtkDataObject *src) override
Shallow and Deep copy.
#define VTK_SIZEHINT(...)
vtkIdType GetNumberOfPoints() const
Return number of points in array.
Definition: vtkPoints.h:132
void GetPoint(vtkIdType ptId, double x[3]) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:116
int GetMaxCellSize() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:130
void Initialize() override
Restore data object to initial state.
void BuildLocator()
Build the internal point locator .
Definition: vtkPointSet.h:185
void GetPointCells(vtkIdType, vtkIdList *idList) override
Topological inquiry to get cells using point.
Definition: vtkPointSet.h:146
virtual void CopyStructure(vtkDataSet *ds)=0
Copy the geometric and topological structure of an object.
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
Store zero or more vtkInformation instances.
Efficient cell iterator for vtkDataSet topologies.
vtkCell * GetCell(vtkIdType) override
This method always return a vtkEmptyCell, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:138
general representation of visualization data
Definition: vtkDataObject.h:65
vtkIdType FindPoint(double x, double y, double z)
Locate the closest point to the global coordinate x.
Definition: vtkDataSet.h:232
represent and manipulate 3D points
Definition: vtkPoints.h:39
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetCellTypeToEmptyCell()
vtkAbstractCellLocator * CellLocator
Definition: vtkPointSet.h:277