VTK  9.2.20220703
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 =========================================================================*/
94 #ifndef vtkPointSet_h
95 #define vtkPointSet_h
96 
97 #include "vtkCommonDataModelModule.h" // For export macro
98 #include "vtkDataSet.h"
99 
100 #include "vtkCellTypes.h" // For GetCellType
101 #include "vtkEmptyCell.h" // For GetCell
102 #include "vtkGenericCell.h" // For GetCell
103 #include "vtkPoints.h" // Needed for inline methods
104 
107 
108 class VTKCOMMONDATAMODEL_EXPORT vtkPointSet : public vtkDataSet
109 {
110 public:
114  static vtkPointSet* New();
116 
118 
121  vtkTypeMacro(vtkPointSet, vtkDataSet);
122  void PrintSelf(ostream& os, vtkIndent indent) override;
124 
126 
135  vtkSetMacro(Editable, bool);
136  vtkGetMacro(Editable, bool);
137  vtkBooleanMacro(Editable, bool);
139 
143  void Initialize() override;
144 
148  void CopyStructure(vtkDataSet* pd) override;
149 
151 
154  vtkIdType GetNumberOfPoints() override;
155  void GetPoint(vtkIdType ptId, double x[3]) override { this->Points->GetPoint(ptId, x); }
156  vtkIdType FindPoint(double x[3]) override;
157  vtkIdType FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z); }
158  vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
159  double pcoords[3], double* weights) override;
160  vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
161  double tol2, int& subId, double pcoords[3], double* weights) override;
163 
165 
168  vtkIdType GetNumberOfCells() override { return 0; }
169  int GetMaxCellSize() override { return 0; }
171 
172  using Superclass::GetCell;
177  vtkCell* GetCell(vtkIdType) override { return this->EmptyCell; }
178 
180 
184  void GetCellPoints(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
185  void GetPointCells(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
187 
191  void GetCell(vtkIdType, vtkGenericCell* cell) override { cell->SetCellTypeToEmptyCell(); }
192 
197  int GetCellType(vtkIdType) override { return VTK_EMPTY_CELL; }
198 
203  vtkIdType GetCellSize(vtkIdType) override { return 1; }
204 
211  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override { return this->Points->GetPoint(ptId); }
212 
217 
219 
224  void BuildLocator() { this->BuildPointLocator(); }
226 
232 
234 
241  vtkGetObjectMacro(PointLocator, vtkAbstractPointLocator);
243 
245 
250  vtkGetObjectMacro(CellLocator, vtkAbstractCellLocator);
252 
256  vtkMTimeType GetMTime() override;
257 
261  void ComputeBounds() override;
262 
266  void Squeeze() override;
267 
269 
272  virtual void SetPoints(vtkPoints*);
273  vtkGetObjectMacro(Points, vtkPoints);
275 
284  unsigned long GetActualMemorySize() override;
285 
287 
290  void ShallowCopy(vtkDataObject* src) override;
291  void DeepCopy(vtkDataObject* src) override;
293 
295 
298  bool UsesGarbageCollector() const override { return true; }
300 
302 
306  static vtkPointSet* GetData(vtkInformationVector* v, int i = 0);
308 
309 protected:
311  ~vtkPointSet() override;
312 
313  bool Editable;
317 
319 
320 private:
321  void Cleanup();
322  vtkEmptyCell* EmptyCell;
323 
324  vtkPointSet(const vtkPointSet&) = delete;
325  void operator=(const vtkPointSet&) = delete;
326 };
327 
329 {
330  if (this->Points)
331  {
332  return this->Points->GetNumberOfPoints();
333  }
334  else
335  {
336  return 0;
337  }
338 }
339 
340 #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:150
general representation of visualization data
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
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:341
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:33
Detect and break reference loops.
provides thread-safe access to cells
void SetCellTypeToEmptyCell()
list of point or cell ids
Definition: vtkIdList.h:143
void Reset()
Reset to an empty state but retain previously allocated memory.
Definition: vtkIdList.h:257
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
concrete class for storing a set of points
Definition: vtkPointSet.h:109
void GetCellPoints(vtkIdType, vtkIdList *idList) override
This method resets parameter idList, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:184
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:157
void GetPointCells(vtkIdType, vtkIdList *idList) override
This method resets parameter idList, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:185
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.
Definition: vtkPointSet.h:177
void BuildPointLocator()
Build the internal point locator .
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:298
vtkIdType GetCellSize(vtkIdType) override
This method always returns 1, as all cells are point in a pure vtkPointSet.
Definition: vtkPointSet.h:203
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:315
void BuildLocator()
Build the internal point locator .
Definition: vtkPointSet.h:224
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:316
void BuildCellLocator()
Build the cell locator.
void ComputeBounds() override
Compute the (X, Y, Z) bounds of the data.
vtkPoints * Points
Definition: vtkPointSet.h:314
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:168
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:328
double * GetPoint(vtkIdType ptId) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:211
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:155
void ReportReferences(vtkGarbageCollector *) override
void GetCell(vtkIdType, vtkGenericCell *cell) override
This method sets cell to be an empty cell.
Definition: vtkPointSet.h:191
int GetCellType(vtkIdType) override
This method always returns VTK_EMPTY_CELL, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:197
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:169
represent and manipulate 3D points
Definition: vtkPoints.h:149
vtkIdType GetNumberOfPoints() const
Return number of points in array.
Definition: vtkPoints.h:241
@ info
Definition: vtkX3D.h:382
@ VTK_EMPTY_CELL
Definition: vtkCellType.h:85
int vtkIdType
Definition: vtkType.h:325
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:280
#define VTK_SIZEHINT(...)