ITK  6.0.0
Insight Toolkit
itkPolygonCell.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * https://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 /*=========================================================================
19  *
20  * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21  *
22  * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  *
24  * For complete copyright, license and disclaimer of warranty information
25  * please refer to the NOTICE file at the top of the ITK source tree.
26  *
27  *=========================================================================*/
28 #ifndef itkPolygonCell_h
29 #define itkPolygonCell_h
30 
31 #include "itkLineCell.h"
32 #include "itkPoint.h"
33 #include <vector>
34 #include <deque>
35 
36 namespace itk
37 {
48 template <typename TCellInterface>
49 class ITK_TEMPLATE_EXPORT PolygonCell : public TCellInterface
50 {
51 public:
52  ITK_DISALLOW_COPY_AND_MOVE(PolygonCell);
53 
56  itkCellInheritedTypedefs(TCellInterface);
60  itkOverrideGetNameOfClassMacro(PolygonCell);
61 
63  static constexpr unsigned int CellDimension = 2;
64 
67  using VertexAutoPointer = typename VertexType::SelfAutoPointer;
68 
71  using EdgeAutoPointer = typename EdgeType::SelfAutoPointer;
72 
74  using EdgeInfoDQ = std::deque<EdgeInfo>;
75 
78 
81  GetType() const override
82  {
84  }
85  void
86  MakeCopy(CellAutoPointer &) const override;
89  unsigned int
90  GetDimension() const override;
91 
92  unsigned int
93  GetNumberOfPoints() const override;
94 
95  CellFeatureCount
96  GetNumberOfBoundaryFeatures(int dimension) const override;
97 
98  bool
99  GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &) override;
100 
101  void
102  SetPointIds(PointIdConstIterator first) override;
103 
104  void
105  SetPointIds(PointIdConstIterator first, PointIdConstIterator last) override;
106 
107  void AddPointId(PointIdentifier);
108  void RemovePointId(PointIdentifier);
109  void
110  SetPointIds(int dummy, int num, PointIdConstIterator first);
111 
112  void
113  BuildEdges();
114 
115  void
116  ClearPoints();
117 
118  void
119  SetPointId(int localId, PointIdentifier) override;
120  PointIdIterator
121  PointIdsBegin() override;
122 
123  PointIdConstIterator
124  PointIdsBegin() const override;
125 
126  PointIdIterator
127  PointIdsEnd() override;
128 
129  PointIdConstIterator
130  PointIdsEnd() const override;
131 
133  virtual CellFeatureCount
134  GetNumberOfVertices() const;
135 
136  virtual CellFeatureCount
137  GetNumberOfEdges() const;
138 
139  virtual bool
140  GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
141  virtual bool
142  GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
143 
145  PolygonCell() = default;
146  PolygonCell(PointIdentifier NumberOfPoints)
147  {
148  for (PointIdentifier i = 0; i < NumberOfPoints; ++i)
149  {
150  m_PointIds.push_back(NumericTraits<PointIdentifier>::max());
151  }
152  this->BuildEdges();
153  }
156  ~PolygonCell() override = default;
157 
158 protected:
159  std::vector<EdgeInfo> m_Edges{};
160  std::vector<PointIdentifier> m_PointIds{};
161 };
162 } // namespace itk
163 
164 #ifndef ITK_MANUAL_INSTANTIATION
165 # include "itkPolygonCell.hxx"
166 #endif
167 
168 #endif
itk::PolygonCell::EdgeAutoPointer
typename EdgeType::SelfAutoPointer EdgeAutoPointer
Definition: itkPolygonCell.h:71
itk::VertexCell
Represents a single vertex for a Mesh.
Definition: itkVertexCell.h:37
itk::PolygonCell::VertexAutoPointer
typename VertexType::SelfAutoPointer VertexAutoPointer
Definition: itkPolygonCell.h:67
itkPoint.h
itkCellVisitMacro
#define itkCellVisitMacro(TopologyId)
Definition: itkCellInterface.h:32
itkLineCell.h
itk::PolygonCell
Represents a polygon in a Mesh.
Definition: itkPolygonCell.h:49
itkCellInheritedTypedefs
#define itkCellInheritedTypedefs(superclassArg)
Definition: itkCellInterface.h:56
itk::FixedArray
Simulate a standard C array with copy semantics.
Definition: itkFixedArray.h:53
itk::CommonEnums::CellGeometry
CellGeometry
Definition: itkCommonEnums.h:138
itk::LineCell
Represents a line segment for a Mesh.
Definition: itkLineCell.h:40
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itk::PolygonCell::GetType
CellGeometryEnum GetType() const override
Definition: itkPolygonCell.h:81
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::PolygonCell::PolygonCell
PolygonCell(PointIdentifier NumberOfPoints)
Definition: itkPolygonCell.h:146
itk::PolygonCell::EdgeInfoDQ
std::deque< EdgeInfo > EdgeInfoDQ
Definition: itkPolygonCell.h:74
itk::CommonEnums::CellGeometry::POLYGON_CELL
itkCellCommonTypedefs
#define itkCellCommonTypedefs(celltype)
Definition: itkCellInterface.h:47