VTK  9.7.1
vtkEdgeTable.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
18 #ifndef vtkEdgeTable_h
19 #define vtkEdgeTable_h
20 
21 #include "vtkCommonDataModelModule.h" // For export macro
22 #include "vtkObject.h"
23 
24 #include <vector> // For std::vector
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkIdList;
28 class vtkPoints;
29 
30 class VTKCOMMONDATAMODEL_EXPORT vtkEdgeTable : public vtkObject
31 {
32 public:
36  static vtkEdgeTable* New();
37 
38  vtkTypeMacro(vtkEdgeTable, vtkObject);
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
44  void Initialize();
45 
59  int InitEdgeInsertion(vtkIdType numPoints, int storeAttributes = 0);
60 
70  vtkIdType InsertEdge(vtkIdType p1, vtkIdType p2);
71 
81  void InsertEdge(vtkIdType p1, vtkIdType p2, vtkIdType attributeId);
82 
92  void InsertEdge(vtkIdType p1, vtkIdType p2, void* ptr);
93 
101  vtkIdType IsEdge(vtkIdType p1, vtkIdType p2);
102 
108  void IsEdge(vtkIdType p1, vtkIdType p2, void*& ptr);
109 
115  int InitPointInsertion(vtkPoints* newPts, vtkIdType estSize);
116 
122  int InsertUniquePoint(vtkIdType p1, vtkIdType p2, double x[3], vtkIdType& ptId);
123 
125 
128  vtkGetMacro(NumberOfEdges, vtkIdType);
130 
134  void InitTraversal();
135 
141  vtkIdType GetNextEdge(vtkIdType& p1, vtkIdType& p2);
142 
148  int GetNextEdge(vtkIdType& p1, vtkIdType& p2, void*& ptr);
149 
154  void Reset();
155 
156 protected:
157  vtkEdgeTable();
158  ~vtkEdgeTable() override;
159 
160  std::vector<vtkSmartPointer<vtkIdList>> Table;
161  vtkIdType TableMaxId; // maximum point id inserted
162  int Position[2];
163  int Extend;
165  vtkPoints* Points; // support point insertion
166 
167  int StoreAttributes; //==0:no attributes stored;==1:vtkIdType;==2:void*
168  std::vector<vtkSmartPointer<vtkIdList>> Attributes; // used to store IdTypes attributes
169  std::vector<std::vector<void*>> PointerAttributes; // used to store void* pointers
170 
171  void Resize(vtkIdType size);
172 
173 private:
174  vtkEdgeTable(const vtkEdgeTable&) = delete;
175  void operator=(const vtkEdgeTable&) = delete;
176 };
177 
178 VTK_ABI_NAMESPACE_END
179 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int vtkIdType
Definition: vtkType.h:363
vtkIdType TableMaxId
Definition: vtkEdgeTable.h:161
keep track of edges (edge is pair of integer id's)
Definition: vtkEdgeTable.h:30
vtkIdType NumberOfEdges
Definition: vtkEdgeTable.h:164
a simple class to control print indentation
Definition: vtkIndent.h:28
list of point or cell ids
Definition: vtkIdList.h:25
vtkPoints * Points
Definition: vtkEdgeTable.h:165
std::vector< vtkSmartPointer< vtkIdList > > Attributes
Definition: vtkEdgeTable.h:168
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
std::vector< vtkSmartPointer< vtkIdList > > Table
Definition: vtkEdgeTable.h:160
represent and manipulate 3D points
Definition: vtkPoints.h:30
std::vector< std::vector< void * > > PointerAttributes
Definition: vtkEdgeTable.h:169