VTK  9.1.0
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 =========================================================================*/
91 #ifndef vtkPointSet_h
92 #define vtkPointSet_h
93 
94 #include "vtkCommonDataModelModule.h" // For export macro
95 #include "vtkDataSet.h"
96 
97 #include "vtkCellTypes.h" // For GetCellType
98 #include "vtkEmptyCell.h" // For GetCell
99 #include "vtkGenericCell.h" // For GetCell
100 #include "vtkPoints.h" // Needed for inline methods
101 
104 
105 class VTKCOMMONDATAMODEL_EXPORT vtkPointSet : public vtkDataSet
106 {
107 public:
111  static vtkPointSet* New();
113 
115 
118  vtkTypeMacro(vtkPointSet, vtkDataSet);
119  void PrintSelf(ostream& os, vtkIndent indent) override;
121 
123 
132  vtkSetMacro(Editable, bool);
133  vtkGetMacro(Editable, bool);
134  vtkBooleanMacro(Editable, bool);
136 
140  void Initialize() override;
141 
145  void CopyStructure(vtkDataSet* pd) override;
146 
148 
151  vtkIdType GetNumberOfPoints() override;
152  void GetPoint(vtkIdType ptId, double x[3]) override { this->Points->GetPoint(ptId, x); }
153  vtkIdType FindPoint(double x[3]) override;
154  vtkIdType FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z); }
155  vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
156  double pcoords[3], double* weights) override;
157  vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
158  double tol2, int& subId, double pcoords[3], double* weights) override;
160 
162 
165  vtkIdType GetNumberOfCells() override { return 0; }
166  int GetMaxCellSize() override { return 0; }
168 
169  using Superclass::GetCell;
174  vtkCell* GetCell(vtkIdType) override { return this->EmptyCell; }
175 
177 
180  void GetCellPoints(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
181  void GetPointCells(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
183 
187  void GetCell(vtkIdType, vtkGenericCell* cell) override { cell->SetCellTypeToEmptyCell(); }
188 
193  int GetCellType(vtkIdType) override { return VTK_EMPTY_CELL; }
194 
201  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override { return this->Points->GetPoint(ptId); }
202 
207 
209 
214  void BuildLocator() { this->BuildPointLocator(); }
216 
222 
224 
231  vtkGetObjectMacro(PointLocator, vtkAbstractPointLocator);
233 
235 
240  vtkGetObjectMacro(CellLocator, vtkAbstractCellLocator);
242 
246  vtkMTimeType GetMTime() override;
247 
251  void ComputeBounds() override;
252 
256  void Squeeze() override;
257 
259 
262  virtual void SetPoints(vtkPoints*);
263  vtkGetObjectMacro(Points, vtkPoints);
265 
274  unsigned long GetActualMemorySize() override;
275 
277 
280  void ShallowCopy(vtkDataObject* src) override;
281  void DeepCopy(vtkDataObject* src) override;
283 
285 
288  void Register(vtkObjectBase* o) override;
289  void UnRegister(vtkObjectBase* o) override;
291 
293 
297  static vtkPointSet* GetData(vtkInformationVector* v, int i = 0);
299 
300 protected:
302  ~vtkPointSet() override;
303 
304  bool Editable;
308 
310 
311 private:
312  void Cleanup();
313  vtkEmptyCell* EmptyCell;
314 
315  vtkPointSet(const vtkPointSet&) = delete;
316  void operator=(const vtkPointSet&) = delete;
317 };
318 
320 {
321  if (this->Points)
322  {
323  return this->Points->GetNumberOfPoints();
324  }
325  else
326  {
327  return 0;
328  }
329 }
330 
331 #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:147
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.
vtkIdType FindPoint(double x, double y, double z)
Locate the closest point to the global coordinate x.
Definition: vtkDataSet.h:310
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:30
Detect and break reference loops.
provides thread-safe access to cells
void SetCellTypeToEmptyCell()
list of point or cell ids
Definition: vtkIdList.h:140
void Reset()
Reset to an empty state but retain previously allocated memory.
Definition: vtkIdList.h:254
a simple class to control print indentation
Definition: vtkIndent.h:113
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract base class for most VTK objects
Definition: vtkObjectBase.h:70
concrete class for storing a set of points
Definition: vtkPointSet.h:106
void GetCellPoints(vtkIdType, vtkIdList *idList) override
This method resets parameter idList, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:180
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:154
void GetPointCells(vtkIdType, vtkIdList *idList) override
This method resets parameter idList, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:181
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:174
void BuildPointLocator()
Build the internal point locator .
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methdos 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.
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:306
void UnRegister(vtkObjectBase *o) override
Overwritten to handle the data/locator loop.
void Register(vtkObjectBase *o) override
Overwritten to handle the data/locator loop.
void BuildLocator()
Build the internal point locator .
Definition: vtkPointSet.h:214
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:307
void BuildCellLocator()
Build the cell locator.
void ComputeBounds() override
Compute the (X, Y, Z) bounds of the data.
vtkPoints * Points
Definition: vtkPointSet.h:305
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:165
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:319
double * GetPoint(vtkIdType ptId) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:201
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:152
void ReportReferences(vtkGarbageCollector *) override
void GetCell(vtkIdType, vtkGenericCell *cell) override
This method sets cell to be an empty cell.
Definition: vtkPointSet.h:187
int GetCellType(vtkIdType) override
This method always returns VTK_EMPTY_CELL, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:193
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:166
represent and manipulate 3D points
Definition: vtkPoints.h:143
vtkIdType GetNumberOfPoints() const
Return number of points in array.
Definition: vtkPoints.h:235
@ info
Definition: vtkX3D.h:382
@ VTK_EMPTY_CELL
Definition: vtkCellType.h:85
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)