VTK  9.0.20210508
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 =========================================================================*/
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 
65 
66 class VTKCOMMONDATAMODEL_EXPORT vtkPointSet : public vtkDataSet
67 {
68 public:
72  static vtkPointSet* New();
74 
76 
79  vtkTypeMacro(vtkPointSet, vtkDataSet);
80  void PrintSelf(ostream& os, vtkIndent indent) override;
82 
84 
93  vtkSetMacro(Editable, bool);
94  vtkGetMacro(Editable, bool);
95  vtkBooleanMacro(Editable, bool);
97 
101  void Initialize() override;
102 
106  void CopyStructure(vtkDataSet* pd) override;
107 
109 
112  vtkIdType GetNumberOfPoints() override;
113  void GetPoint(vtkIdType ptId, double x[3]) override { this->Points->GetPoint(ptId, x); }
114  vtkIdType FindPoint(double x[3]) override;
115  vtkIdType FindPoint(double x, double y, double z) { return this->vtkDataSet::FindPoint(x, y, z); }
116  vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
117  double pcoords[3], double* weights) override;
118  vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
119  double tol2, int& subId, double pcoords[3], double* weights) override;
121 
123 
126  vtkIdType GetNumberOfCells() override { return 0; }
127  int GetMaxCellSize() override { return 0; }
129 
130  using Superclass::GetCell;
135  vtkCell* GetCell(vtkIdType) override { return this->EmptyCell; }
136 
138 
141  void GetCellPoints(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
142  void GetPointCells(vtkIdType, vtkIdList* idList) override { idList->Reset(); }
144 
148  void GetCell(vtkIdType, vtkGenericCell* cell) override { cell->SetCellTypeToEmptyCell(); }
149 
154  int GetCellType(vtkIdType) override { return VTK_EMPTY_CELL; }
155 
162  double* GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override { return this->Points->GetPoint(ptId); }
163 
168 
170 
175  void BuildLocator() { this->BuildPointLocator(); }
177 
183 
185 
192  vtkGetObjectMacro(PointLocator, vtkAbstractPointLocator);
194 
196 
201  vtkGetObjectMacro(CellLocator, vtkAbstractCellLocator);
203 
207  vtkMTimeType GetMTime() override;
208 
212  void ComputeBounds() override;
213 
217  void Squeeze() override;
218 
220 
223  virtual void SetPoints(vtkPoints*);
224  vtkGetObjectMacro(Points, vtkPoints);
226 
235  unsigned long GetActualMemorySize() override;
236 
238 
241  void ShallowCopy(vtkDataObject* src) override;
242  void DeepCopy(vtkDataObject* src) override;
244 
246 
249  void Register(vtkObjectBase* o) override;
250  void UnRegister(vtkObjectBase* o) override;
252 
254 
258  static vtkPointSet* GetData(vtkInformationVector* v, int i = 0);
260 
261 protected:
263  ~vtkPointSet() override;
264 
265  bool Editable;
269 
271 
272 private:
273  void Cleanup();
274  vtkEmptyCell* EmptyCell;
275 
276  vtkPointSet(const vtkPointSet&) = delete;
277  void operator=(const vtkPointSet&) = delete;
278 };
279 
281 {
282  if (this->Points)
283  {
284  return this->Points->GetNumberOfPoints();
285  }
286  else
287  {
288  return 0;
289  }
290 }
291 
292 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:34
vtkDataSet::GetNumberOfPoints
virtual vtkIdType GetNumberOfPoints()=0
Determine the number of points composing the dataset.
vtkPointSet::FindCell
vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights) override
See vtkDataSet for additional information.
vtkPointSet::BuildCellLocator
void BuildCellLocator()
Build the cell locator.
vtkIdType
int vtkIdType
Definition: vtkType.h:338
vtkCellTypes.h
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:36
vtkEmptyCell
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:30
vtkPoints.h
vtkPointSet::GetNumberOfCells
vtkIdType GetNumberOfCells() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:126
vtkPointSet::SetPoints
virtual void SetPoints(vtkPoints *)
Specify point array to define point coordinates.
vtkPointSet::Squeeze
void Squeeze() override
Reclaim any unused memory.
vtkPointSet::PointLocator
vtkAbstractPointLocator * PointLocator
Definition: vtkPointSet.h:267
vtkPointSet::FindPoint
vtkIdType FindPoint(double x, double y, double z)
See vtkDataSet for additional information.
Definition: vtkPointSet.h:115
vtkPointSet::Register
void Register(vtkObjectBase *o) override
Overwritten to handle the data/locator loop.
vtkPointSet::GetCellPoints
void GetCellPoints(vtkIdType, vtkIdList *idList) override
This method resets parameter idList, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:141
vtkPointSet::GetPoint
double * GetPoint(vtkIdType ptId) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:162
vtkPointSet::GetData
static vtkPointSet * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
vtkPointSet::GetCell
void GetCell(vtkIdType, vtkGenericCell *cell) override
This method sets cell to be an empty cell.
Definition: vtkPointSet.h:148
vtkEmptyCell.h
vtkPointSet::GetCellType
int GetCellType(vtkIdType) override
This method always returns VTK_EMPTY_CELL, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:154
vtkPointSet::~vtkPointSet
~vtkPointSet() override
vtkPointSet::FindCell
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.
vtkPointSet::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methdos for type information and printing.
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:48
VTK_EMPTY_CELL
@ VTK_EMPTY_CELL
Definition: vtkCellType.h:46
vtkDataSet::FindPoint
vtkIdType FindPoint(double x, double y, double z)
Locate the closest point to the global coordinate x.
Definition: vtkDataSet.h:201
vtkPointSet::SetPointLocator
virtual void SetPointLocator(vtkAbstractPointLocator *)
Set / get an instance of vtkAbstractPointLocator which is used to support the FindPoint() and FindCel...
vtkPointSet::DeepCopy
void DeepCopy(vtkDataObject *src) override
Shallow and Deep copy.
vtkObjectBase
abstract base class for most VTK objects
Definition: vtkObjectBase.h:70
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:58
vtkPointSet::vtkPointSet
vtkPointSet()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkPointSet::New
static vtkPointSet * New()
Standard instantiation method.
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:31
vtkPointSet::Initialize
void Initialize() override
Reset to an empty state and free any memory.
vtkPointSet::GetMTime
vtkMTimeType GetMTime() override
Get MTime which also considers its vtkPoints MTime.
vtkPointSet::GetPoint
void GetPoint(vtkIdType ptId, double x[3]) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:113
vtkPointSet::Points
vtkPoints * Points
Definition: vtkPointSet.h:266
vtkAbstractCellLocator
an abstract base class for locators which find cells
Definition: vtkAbstractCellLocator.h:49
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:95
vtkPointSet::UnRegister
void UnRegister(vtkObjectBase *o) override
Overwritten to handle the data/locator loop.
vtkPointSet::BuildLocator
void BuildLocator()
Build the internal point locator .
Definition: vtkPointSet.h:175
vtkDataSet.h
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
vtkPointSet::NewCellIterator
vtkCellIterator * NewCellIterator() override
Return an iterator that traverses the cells in this data set.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:74
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkPointSet::GetMaxCellSize
int GetMaxCellSize() override
This method always returns 0, as there are no cells in a vtkPointSet.
Definition: vtkPointSet.h:127
vtkPointSet::ExtendedNew
static vtkPointSet * ExtendedNew()
vtkPointSet
concrete class for storing a set of points
Definition: vtkPointSet.h:67
vtkGenericCell::SetCellTypeToEmptyCell
void SetCellTypeToEmptyCell()
Definition: vtkGenericCell.h:114
vtkPointSet::BuildPointLocator
void BuildPointLocator()
Build the internal point locator .
vtkPointSet::ShallowCopy
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
vtkAbstractPointLocator
abstract class to quickly locate points in 3-space
Definition: vtkAbstractPointLocator.h:39
vtkPointSet::GetCell
vtkCell * GetCell(vtkIdType) override
This method always return a vtkEmptyCell, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:135
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:37
vtkPointSet::GetPointCells
void GetPointCells(vtkIdType, vtkIdList *idList) override
This method resets parameter idList, as there is no cell in a vtkPointSet.
Definition: vtkPointSet.h:142
vtkGenericCell.h
vtkCellIterator
Efficient cell iterator for vtkDataSet topologies.
Definition: vtkCellIterator.h:78
vtkPointSet::SetCellLocator
virtual void SetCellLocator(vtkAbstractCellLocator *)
Set / get an instance of vtkAbstractCellLocator which may be used when a vtkCellLocatorStrategy is us...
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:60
vtkPointSet::GetActualMemorySize
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
vtkPointSet::CopyStructure
void CopyStructure(vtkDataSet *pd) override
Copy the geometric structure of an input point set object.
vtkPointSet::CellLocator
vtkAbstractCellLocator * CellLocator
Definition: vtkPointSet.h:268
vtkPointSet::ReportReferences
void ReportReferences(vtkGarbageCollector *) override
vtkPointSet::GetData
static vtkPointSet * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
vtkPoints::GetNumberOfPoints
vtkIdType GetNumberOfPoints() const
Return number of points in array.
Definition: vtkPoints.h:126
vtkPointSet::ComputeBounds
void ComputeBounds() override
Compute the (X, Y, Z) bounds of the data.
vtkIdList::Reset
void Reset()
Reset to an empty state but retain previously allocated memory.
Definition: vtkIdList.h:139
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293
vtkPointSet::FindPoint
vtkIdType FindPoint(double x[3]) override
See vtkDataSet for additional information.
vtkPointSet::GetNumberOfPoints
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:280
vtkPointSet::Editable
bool Editable
Definition: vtkPointSet.h:265