VTK  9.3.20240418
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
82 #ifndef vtkPointSet_h
83 #define vtkPointSet_h
84 
85 #include "vtkCommonDataModelModule.h" // For export macro
86 #include "vtkDataSet.h"
87 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
88 
89 #include "vtkCellTypes.h" // For GetCellType
90 #include "vtkGenericCell.h" // For GetCell
91 #include "vtkPoints.h" // Needed for inline methods
92 
93 VTK_ABI_NAMESPACE_BEGIN
96 
97 class VTKCOMMONDATAMODEL_EXPORT VTK_MARSHALAUTO vtkPointSet : public vtkDataSet
98 {
99 public:
103  static vtkPointSet* New();
105 
107 
110  vtkTypeMacro(vtkPointSet, vtkDataSet);
111  void PrintSelf(ostream& os, vtkIndent indent) override;
113 
117  int GetDataObjectType() override { return VTK_POINT_SET; }
118 
120 
129  vtkSetMacro(Editable, bool);
130  vtkGetMacro(Editable, bool);
131  vtkBooleanMacro(Editable, bool);
133 
137  void Initialize() override;
138 
142  void CopyStructure(vtkDataSet* pd) override;
143 
145 
148  vtkIdType GetNumberOfPoints() override;
149  void GetPoint(vtkIdType ptId, double x[3]) override { this->Points->GetPoint(ptId, x); }
150  vtkIdType FindPoint(double x[3]) override;
151  vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
152  double pcoords[3], double* weights) override;
153  vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
154  double tol2, int& subId, double pcoords[3], double* weights) override;
156 
158 
161  vtkIdType GetNumberOfCells() override { return 0; }
162  int GetMaxCellSize() override { return 0; }
164 
165  using Superclass::GetCell;
171 
173 
177  void GetCellPoints(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
178  void GetPointCells(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
180 
184  void GetCell(vtkIdType, vtkGenericCell* cell) override { cell->SetCellTypeToEmptyCell(); }
185 
190  int GetCellType(vtkIdType) override { return VTK_EMPTY_CELL; }
191 
196  vtkIdType GetCellSize(vtkIdType) override { return 1; }
197 
204  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override { return this->Points->GetPoint(ptId); }
205 
210 
212 
217  void BuildLocator() { this->BuildPointLocator(); }
219 
225 
227 
234  vtkGetObjectMacro(PointLocator, vtkAbstractPointLocator);
236 
238 
243  vtkGetObjectMacro(CellLocator, vtkAbstractCellLocator);
245 
249  vtkMTimeType GetMTime() override;
250 
254  void ComputeBounds() override;
255 
259  void Squeeze() override;
260 
262 
265  virtual void SetPoints(vtkPoints*);
266  vtkPoints* GetPoints() override { return this->Points; }
268 
277  unsigned long GetActualMemorySize() override;
278 
280 
283  void ShallowCopy(vtkDataObject* src) override;
284  void DeepCopy(vtkDataObject* src) override;
286 
288 
291  bool UsesGarbageCollector() const override { return true; }
293 
295 
299  static vtkPointSet* GetData(vtkInformationVector* v, int i = 0);
301 
302 protected:
304  ~vtkPointSet() override;
305 
306  bool Editable;
310 
312 
313 private:
314  void Cleanup();
315 
316  vtkPointSet(const vtkPointSet&) = delete;
317  void operator=(const vtkPointSet&) = delete;
318 };
319 
321 {
322  if (this->Points)
323  {
324  return this->Points->GetNumberOfPoints();
325  }
326  else
327  {
328  return 0;
329  }
330 }
331 
332 VTK_ABI_NAMESPACE_END
333 #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:130
general representation of visualization data
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
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.
Detect and break reference loops.
provides thread-safe access to cells
void SetCellTypeToEmptyCell()
list of point or cell ids
Definition: vtkIdList.h:133
void Reset()
Reset to an empty state but retain previously allocated memory.
Definition: vtkIdList.h:244
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
concrete class for storing a set of points
Definition: vtkPointSet.h:98
void GetCellPoints(vtkIdType, vtkIdList *idList) override
This method resets parameter idList, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:177
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.
void GetPointCells(vtkIdType, vtkIdList *idList) override
This method resets parameter idList, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:178
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:117
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:291
vtkIdType GetCellSize(vtkIdType) override
This method always returns 1, as all cells are point in a pure vtkPointSet.
Definition: vtkPointSet.h:196
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:308
void BuildLocator()
Build the internal point locator .
Definition: vtkPointSet.h:217
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:309
void BuildCellLocator()
Build the cell locator.
void ComputeBounds() override
Compute the (X, Y, Z) bounds of the data.
vtkPoints * Points
Definition: vtkPointSet.h:307
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:161
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:320
double * GetPoint(vtkIdType ptId) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:204
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:149
void ReportReferences(vtkGarbageCollector *) override
void GetCell(vtkIdType, vtkGenericCell *cell) override
This method sets cell to be an empty cell.
Definition: vtkPointSet.h:184
vtkPoints * GetPoints() override
Specify point array to define point coordinates.
Definition: vtkPointSet.h:266
int GetCellType(vtkIdType) override
This method always returns VTK_EMPTY_CELL, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:190
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:162
represent and manipulate 3D points
Definition: vtkPoints.h:139
vtkIdType GetNumberOfPoints() const
Return number of points in array.
Definition: vtkPoints.h:231
@ info
Definition: vtkX3D.h:376
@ VTK_EMPTY_CELL
Definition: vtkCellType.h:56
int vtkIdType
Definition: vtkType.h:315
#define VTK_POINT_SET
Definition: vtkType.h:74
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO