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 =========================================================================*/
64 #ifndef vtkPointSet_h
65 #define vtkPointSet_h
66 
67 #include "vtkCommonDataModelModule.h" // For export macro
68 #include "vtkDataSet.h"
69 
70 #include "vtkCellTypes.h" // For GetCellType
71 #include "vtkEmptyCell.h" // For GetCell
72 #include "vtkGenericCell.h" // For GetCell
73 #include "vtkPoints.h" // Needed for inline methods
74 
77 
78 class VTKCOMMONDATAMODEL_EXPORT vtkPointSet : public vtkDataSet
79 {
80 public:
84  static vtkPointSet* New();
86 
88 
91  vtkTypeMacro(vtkPointSet, vtkDataSet);
92  void PrintSelf(ostream& os, vtkIndent indent) override;
94 
96 
105  vtkSetMacro(Editable, bool);
106  vtkGetMacro(Editable, bool);
107  vtkBooleanMacro(Editable, bool);
109 
113  void Initialize() override;
114 
118  void CopyStructure(vtkDataSet* pd) override;
119 
121 
124  vtkIdType GetNumberOfPoints() override;
125  void GetPoint(vtkIdType ptId, double x[3]) override { this->Points->GetPoint(ptId, x); }
126  vtkIdType FindPoint(double x[3]) override;
127  vtkIdType FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z); }
128  vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
129  double pcoords[3], double* weights) override;
130  vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
131  double tol2, int& subId, double pcoords[3], double* weights) override;
133 
135 
138  vtkIdType GetNumberOfCells() override { return 0; }
139  int GetMaxCellSize() override { return 0; }
141 
142  using Superclass::GetCell;
147  vtkCell* GetCell(vtkIdType) override { return this->EmptyCell; }
148 
150 
154  void GetCellPoints(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
155  void GetPointCells(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
157 
161  void GetCell(vtkIdType, vtkGenericCell* cell) override { cell->SetCellTypeToEmptyCell(); }
162 
167  int GetCellType(vtkIdType) override { return VTK_EMPTY_CELL; }
168 
173  vtkIdType GetCellSize(vtkIdType) override { return 1; }
174 
181  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override { return this->Points->GetPoint(ptId); }
182 
187 
189 
194  void BuildLocator() { this->BuildPointLocator(); }
196 
202 
204 
211  vtkGetObjectMacro(PointLocator, vtkAbstractPointLocator);
213 
215 
220  vtkGetObjectMacro(CellLocator, vtkAbstractCellLocator);
222 
226  vtkMTimeType GetMTime() override;
227 
231  void ComputeBounds() override;
232 
236  void Squeeze() override;
237 
239 
242  virtual void SetPoints(vtkPoints*);
243  vtkGetObjectMacro(Points, vtkPoints);
245 
254  unsigned long GetActualMemorySize() override;
255 
257 
260  void ShallowCopy(vtkDataObject* src) override;
261  void DeepCopy(vtkDataObject* src) override;
263 
265 
268  bool UsesGarbageCollector() const override { return true; }
270 
272 
276  static vtkPointSet* GetData(vtkInformationVector* v, int i = 0);
278 
279 protected:
281  ~vtkPointSet() override;
282 
283  bool Editable;
287 
289 
290 private:
291  void Cleanup();
292  vtkEmptyCell* EmptyCell;
293 
294  vtkPointSet(const vtkPointSet&) = delete;
295  void operator=(const vtkPointSet&) = delete;
296 };
297 
299 {
300  if (this->Points)
301  {
302  return this->Points->GetNumberOfPoints();
303  }
304  else
305  {
306  return 0;
307  }
308 }
309 
310 #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:70
general representation of visualization data
Definition: vtkDataObject.h:75
abstract class to specify dataset behavior
Definition: vtkDataSet.h:72
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:241
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:43
void Reset()
Reset to an empty state but retain previously allocated memory.
Definition: vtkIdList.h:157
a simple class to control print indentation
Definition: vtkIndent.h:49
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
concrete class for storing a set of points
Definition: vtkPointSet.h:79
void GetCellPoints(vtkIdType, vtkIdList *idList) override
This method resets parameter idList, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:154
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:127
void GetPointCells(vtkIdType, vtkIdList *idList) override
This method resets parameter idList, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:155
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:147
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:268
vtkIdType GetCellSize(vtkIdType) override
This method always returns 1, as all cells are point in a pure vtkPointSet.
Definition: vtkPointSet.h:173
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:285
void BuildLocator()
Build the internal point locator .
Definition: vtkPointSet.h:194
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:286
void BuildCellLocator()
Build the cell locator.
void ComputeBounds() override
Compute the (X, Y, Z) bounds of the data.
vtkPoints * Points
Definition: vtkPointSet.h:284
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:138
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:298
double * GetPoint(vtkIdType ptId) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:181
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:125
void ReportReferences(vtkGarbageCollector *) override
void GetCell(vtkIdType, vtkGenericCell *cell) override
This method sets cell to be an empty cell.
Definition: vtkPointSet.h:161
int GetCellType(vtkIdType) override
This method always returns VTK_EMPTY_CELL, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:167
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:139
represent and manipulate 3D points
Definition: vtkPoints.h:49
vtkIdType GetNumberOfPoints() const
Return number of points in array.
Definition: vtkPoints.h:141
@ info
Definition: vtkX3D.h:382
@ VTK_EMPTY_CELL
Definition: vtkCellType.h:46
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)