VTK  9.3.1
vtkPointSet.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
43 #ifndef vtkPointSet_h
44 #define vtkPointSet_h
45 
46 #include "vtkCommonDataModelModule.h" // For export macro
47 #include "vtkDataSet.h"
48 
49 #include "vtkCellTypes.h" // For GetCellType
50 #include "vtkEmptyCell.h" // For GetCell
51 #include "vtkGenericCell.h" // For GetCell
52 #include "vtkPoints.h" // Needed for inline methods
53 
54 VTK_ABI_NAMESPACE_BEGIN
57 
58 class VTKCOMMONDATAMODEL_EXPORT vtkPointSet : public vtkDataSet
59 {
60 public:
64  static vtkPointSet* New();
65  static vtkPointSet* ExtendedNew();
66 
68 
71  vtkTypeMacro(vtkPointSet, vtkDataSet);
72  void PrintSelf(ostream& os, vtkIndent indent) override;
74 
78  int GetDataObjectType() override { return VTK_POINT_SET; }
79 
81 
90  vtkSetMacro(Editable, bool);
91  vtkGetMacro(Editable, bool);
92  vtkBooleanMacro(Editable, bool);
94 
98  void Initialize() override;
99 
103  void CopyStructure(vtkDataSet* pd) override;
104 
106 
109  vtkIdType GetNumberOfPoints() override;
110  void GetPoint(vtkIdType ptId, double x[3]) override { this->Points->GetPoint(ptId, x); }
111  vtkIdType FindPoint(double x[3]) override;
112  vtkIdType FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z); }
113  vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
114  double pcoords[3], double* weights) override;
115  vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
116  double tol2, int& subId, double pcoords[3], double* weights) override;
118 
120 
123  vtkIdType GetNumberOfCells() override { return 0; }
124  int GetMaxCellSize() override { return 0; }
126 
127  using Superclass::GetCell;
132  vtkCell* GetCell(vtkIdType) override;
133 
135 
139  void GetCellPoints(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
140  void GetPointCells(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
142 
146  void GetCell(vtkIdType, vtkGenericCell* cell) override { cell->SetCellTypeToEmptyCell(); }
147 
152  int GetCellType(vtkIdType) override { return VTK_EMPTY_CELL; }
153 
158  vtkIdType GetCellSize(vtkIdType) override { return 1; }
159 
166  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override { return this->Points->GetPoint(ptId); }
167 
171  vtkCellIterator* NewCellIterator() override;
172 
174 
178  void BuildPointLocator();
179  void BuildLocator() { this->BuildPointLocator(); }
181 
186  void BuildCellLocator();
187 
189 
195  virtual void SetPointLocator(vtkAbstractPointLocator*);
196  vtkGetObjectMacro(PointLocator, vtkAbstractPointLocator);
198 
200 
204  virtual void SetCellLocator(vtkAbstractCellLocator*);
205  vtkGetObjectMacro(CellLocator, vtkAbstractCellLocator);
207 
211  vtkMTimeType GetMTime() override;
212 
216  void ComputeBounds() override;
217 
221  void Squeeze() override;
222 
224 
227  virtual void SetPoints(vtkPoints*);
228  vtkGetObjectMacro(Points, vtkPoints);
230 
239  unsigned long GetActualMemorySize() override;
240 
242 
245  void ShallowCopy(vtkDataObject* src) override;
246  void DeepCopy(vtkDataObject* src) override;
248 
250 
253  bool UsesGarbageCollector() const override { return true; }
255 
257 
261  static vtkPointSet* GetData(vtkInformationVector* v, int i = 0);
263 
264 protected:
265  vtkPointSet();
266  ~vtkPointSet() override;
267 
268  bool Editable;
272 
273  void ReportReferences(vtkGarbageCollector*) override;
274 
275 private:
276  void Cleanup();
277  vtkEmptyCell* EmptyCell;
278 
279  vtkPointSet(const vtkPointSet&) = delete;
280  void operator=(const vtkPointSet&) = delete;
281 };
282 
284 {
285  if (this->Points)
286  {
287  return this->Points->GetNumberOfPoints();
288  }
289  else
290  {
291  return 0;
292  }
293 }
294 
295 VTK_ABI_NAMESPACE_END
296 #endif
vtkIdType GetCellSize(vtkIdType) override
This method always returns 1, as all cells are point in a pure vtkPointSet.
Definition: vtkPointSet.h:158
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:283
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:270
virtual vtkIdType GetNumberOfPoints()=0
Determine the number of points composing the dataset.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
int GetDataObjectType() override
Standard vtkDataSet API methods.
Definition: vtkPointSet.h:78
void Reset()
Reset to an empty state but retain previously allocated memory.
Definition: vtkIdList.h:134
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:139
virtual void ComputeBounds()
Compute the data bounding box from data points.
concrete class for storing a set of points
Definition: vtkPointSet.h:58
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:123
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:21
int vtkIdType
Definition: vtkType.h:315
vtkAbstractPointLocator * PointLocator
Definition: vtkPointSet.h:270
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:152
vtkIdType FindPoint(double x, double y, double z)
See vtkDataSet for additional information.
Definition: vtkPointSet.h:112
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:166
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:146
bool UsesGarbageCollector() const override
Overwritten to handle the data/locator loop.
Definition: vtkPointSet.h:253
abstract class to specify cell behavior
Definition: vtkCell.h:49
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:28
virtual void ReportReferences(vtkGarbageCollector *)
abstract class to quickly locate points in 3-space
list of point or cell ids
Definition: vtkIdList.h:22
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:269
void DeepCopy(vtkDataObject *src) override
Shallow and Deep copy.
#define VTK_SIZEHINT(...)
vtkIdType GetNumberOfPoints() const
Return number of points in array.
Definition: vtkPoints.h:121
void GetPoint(vtkIdType ptId, double x[3]) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:110
int GetMaxCellSize() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:124
void Initialize() override
Restore data object to initial state.
void BuildLocator()
Build the internal point locator .
Definition: vtkPointSet.h:179
#define VTK_POINT_SET
Definition: vtkType.h:74
void GetPointCells(vtkIdType, vtkIdList *idList) override
Topological inquiry to get cells using point.
Definition: vtkPointSet.h:140
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.
general representation of visualization data
Definition: vtkDataObject.h:54
vtkIdType FindPoint(double x, double y, double z)
Locate the closest point to the global coordinate x.
Definition: vtkDataSet.h:233
virtual vtkCell * GetCell(vtkIdType cellId)=0
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
represent and manipulate 3D points
Definition: vtkPoints.h:28
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:271