VTK  9.3.0
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
52 #ifndef vtkPointSet_h
53 #define vtkPointSet_h
54 
55 #include "vtkCommonDataModelModule.h" // For export macro
56 #include "vtkDataSet.h"
57 
58 #include "vtkCellTypes.h" // For GetCellType
59 #include "vtkEmptyCell.h" // For GetCell
60 #include "vtkGenericCell.h" // For GetCell
61 #include "vtkPoints.h" // Needed for inline methods
62 
63 VTK_ABI_NAMESPACE_BEGIN
66 
67 class VTKCOMMONDATAMODEL_EXPORT vtkPointSet : public vtkDataSet
68 {
69 public:
73  static vtkPointSet* New();
75 
77 
80  vtkTypeMacro(vtkPointSet, vtkDataSet);
81  void PrintSelf(ostream& os, vtkIndent indent) override;
83 
87  int GetDataObjectType() override { return VTK_POINT_SET; }
88 
90 
99  vtkSetMacro(Editable, bool);
100  vtkGetMacro(Editable, bool);
101  vtkBooleanMacro(Editable, bool);
103 
107  void Initialize() override;
108 
112  void CopyStructure(vtkDataSet* pd) override;
113 
115 
118  vtkIdType GetNumberOfPoints() override;
119  void GetPoint(vtkIdType ptId, double x[3]) override { this->Points->GetPoint(ptId, x); }
120  vtkIdType FindPoint(double x[3]) override;
121  vtkIdType FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z); }
122  vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
123  double pcoords[3], double* weights) override;
124  vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
125  double tol2, int& subId, double pcoords[3], double* weights) override;
127 
129 
132  vtkIdType GetNumberOfCells() override { return 0; }
133  int GetMaxCellSize() override { return 0; }
135 
136  using Superclass::GetCell;
142 
144 
148  void GetCellPoints(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
149  void GetPointCells(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
151 
155  void GetCell(vtkIdType, vtkGenericCell* cell) override { cell->SetCellTypeToEmptyCell(); }
156 
161  int GetCellType(vtkIdType) override { return VTK_EMPTY_CELL; }
162 
167  vtkIdType GetCellSize(vtkIdType) override { return 1; }
168 
175  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override { return this->Points->GetPoint(ptId); }
176 
181 
183 
188  void BuildLocator() { this->BuildPointLocator(); }
190 
196 
198 
205  vtkGetObjectMacro(PointLocator, vtkAbstractPointLocator);
207 
209 
214  vtkGetObjectMacro(CellLocator, vtkAbstractCellLocator);
216 
220  vtkMTimeType GetMTime() override;
221 
225  void ComputeBounds() override;
226 
230  void Squeeze() override;
231 
233 
236  virtual void SetPoints(vtkPoints*);
237  vtkGetObjectMacro(Points, vtkPoints);
239 
248  unsigned long GetActualMemorySize() override;
249 
251 
254  void ShallowCopy(vtkDataObject* src) override;
255  void DeepCopy(vtkDataObject* src) override;
257 
259 
262  bool UsesGarbageCollector() const override { return true; }
264 
266 
270  static vtkPointSet* GetData(vtkInformationVector* v, int i = 0);
272 
273 protected:
275  ~vtkPointSet() override;
276 
277  bool Editable;
281 
283 
284 private:
285  void Cleanup();
286  vtkEmptyCell* EmptyCell;
287 
288  vtkPointSet(const vtkPointSet&) = delete;
289  void operator=(const vtkPointSet&) = delete;
290 };
291 
293 {
294  if (this->Points)
295  {
296  return this->Points->GetNumberOfPoints();
297  }
298  else
299  {
300  return 0;
301  }
302 }
303 
304 VTK_ABI_NAMESPACE_END
305 #endif
an abstract base class for locators which find cells
abstract class to quickly locate points in 3-space
Efficient cell iterator for vtkDataSet topologies.
abstract class to specify cell behavior
Definition: vtkCell.h:59
general representation of visualization data
Definition: vtkDataObject.h:64
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
virtual vtkIdType GetNumberOfPoints()=0
Determine the number of points composing the dataset.
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
vtkIdType FindPoint(double x, double y, double z)
Locate the closest point to the global coordinate x.
Definition: vtkDataSet.h:242
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:22
Detect and break reference loops.
provides thread-safe access to cells
void SetCellTypeToEmptyCell()
list of point or cell ids
Definition: vtkIdList.h:32
void Reset()
Reset to an empty state but retain previously allocated memory.
Definition: vtkIdList.h:143
a simple class to control print indentation
Definition: vtkIndent.h:38
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
concrete class for storing a set of points
Definition: vtkPointSet.h:68
void GetCellPoints(vtkIdType, vtkIdList *idList) override
This method resets parameter idList, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:148
void CopyStructure(vtkDataSet *pd) override
Copy the geometric structure of an input point set object.
void Initialize() override
Reset to an empty state and free any memory.
vtkIdType FindPoint(double x, double y, double z)
See vtkDataSet for additional information.
Definition: vtkPointSet.h:121
void GetPointCells(vtkIdType, vtkIdList *idList) override
This method resets parameter idList, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:149
virtual void SetCellLocator(vtkAbstractCellLocator *)
Set / get an instance of vtkAbstractCellLocator which may be used when a vtkCellLocatorStrategy is us...
vtkCell * GetCell(vtkIdType) override
This method always return a vtkEmptyCell, as there is no cell in a vtkPointSet.
void BuildPointLocator()
Build the internal point locator .
int GetDataObjectType() override
Standard vtkDataSet API methods.
Definition: vtkPointSet.h:87
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for type information and printing.
virtual void SetPoints(vtkPoints *)
Specify point array to define point coordinates.
~vtkPointSet() override
static vtkPointSet * ExtendedNew()
virtual void SetPointLocator(vtkAbstractPointLocator *)
Set / get an instance of vtkAbstractPointLocator which is used to support the FindPoint() and FindCel...
static vtkPointSet * New()
Standard instantiation method.
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
bool UsesGarbageCollector() const override
Overwritten to handle the data/locator loop.
Definition: vtkPointSet.h:262
vtkIdType GetCellSize(vtkIdType) override
This method always returns 1, as all cells are point in a pure vtkPointSet.
Definition: vtkPointSet.h:167
void Squeeze() override
Reclaim any unused memory.
static vtkPointSet * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
vtkIdType FindPoint(double x[3]) override
See vtkDataSet for additional information.
vtkIdType FindCell(double x[3], vtkCell *cell, vtkGenericCell *gencell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights) override
See vtkDataSet for additional information.
vtkCellIterator * NewCellIterator() override
Return an iterator that traverses the cells in this data set.
vtkAbstractPointLocator * PointLocator
Definition: vtkPointSet.h:279
void BuildLocator()
Build the internal point locator .
Definition: vtkPointSet.h:188
vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights) override
See vtkDataSet for additional information.
vtkAbstractCellLocator * CellLocator
Definition: vtkPointSet.h:280
void BuildCellLocator()
Build the cell locator.
void ComputeBounds() override
Compute the (X, Y, Z) bounds of the data.
vtkPoints * Points
Definition: vtkPointSet.h:278
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:132
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:292
double * GetPoint(vtkIdType ptId) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:175
vtkMTimeType GetMTime() override
Get MTime which also considers its vtkPoints MTime.
void DeepCopy(vtkDataObject *src) override
Shallow and Deep copy.
void GetPoint(vtkIdType ptId, double x[3]) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:119
void ReportReferences(vtkGarbageCollector *) override
void GetCell(vtkIdType, vtkGenericCell *cell) override
This method sets cell to be an empty cell.
Definition: vtkPointSet.h:155
int GetCellType(vtkIdType) override
This method always returns VTK_EMPTY_CELL, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:161
static vtkPointSet * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
int GetMaxCellSize() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:133
represent and manipulate 3D points
Definition: vtkPoints.h:38
vtkIdType GetNumberOfPoints() const
Return number of points in array.
Definition: vtkPoints.h:130
@ info
Definition: vtkX3D.h:376
@ VTK_EMPTY_CELL
Definition: vtkCellType.h:46
int vtkIdType
Definition: vtkType.h:315
#define VTK_POINT_SET
Definition: vtkType.h:74
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_SIZEHINT(...)