ITK  5.2.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  * http://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 {
52 template <typename TCellInterface>
53 class ITK_TEMPLATE_EXPORT PolygonCell : public TCellInterface
54 {
55 public:
56  ITK_DISALLOW_COPY_AND_MOVE(PolygonCell);
57 
60  itkCellInheritedTypedefs(TCellInterface);
62 
64  itkTypeMacro(PolygonCell, CellInterface);
65 
67  static constexpr unsigned int CellDimension = 2;
68 
71  using VertexAutoPointer = typename VertexType::SelfAutoPointer;
72 
75  using EdgeAutoPointer = typename EdgeType::SelfAutoPointer;
76 
78  using EdgeInfoDQ = std::deque<EdgeInfo>;
79 
82 
85  GetType() const override
86  {
88  }
89  void
90  MakeCopy(CellAutoPointer &) const override;
92 
93  unsigned int
94  GetDimension() const override;
95 
96  unsigned int
97  GetNumberOfPoints() const override;
98 
99  CellFeatureCount
100  GetNumberOfBoundaryFeatures(int dimension) const override;
101 
102  bool
103  GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &) override;
104 
105  void
106  SetPointIds(PointIdConstIterator first) override;
107 
108  void
109  SetPointIds(PointIdConstIterator first, PointIdConstIterator last) override;
110 
111  void AddPointId(PointIdentifier);
112  void RemovePointId(PointIdentifier);
113  void
114  SetPointIds(int dummy, int num, PointIdConstIterator first);
115 
116  void
117  BuildEdges();
118 
119  void
120  ClearPoints();
121 
122  void
123  SetPointId(int localId, PointIdentifier) override;
124  PointIdIterator
125  PointIdsBegin() override;
126 
127  PointIdConstIterator
128  PointIdsBegin() const override;
129 
130  PointIdIterator
131  PointIdsEnd() override;
132 
133  PointIdConstIterator
134  PointIdsEnd() const override;
135 
137  virtual CellFeatureCount
138  GetNumberOfVertices() const;
139 
140  virtual CellFeatureCount
141  GetNumberOfEdges() const;
142 
143  virtual bool
144  GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
145  virtual bool
146  GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
147 
149  PolygonCell() = default;
150  PolygonCell(PointIdentifier NumberOfPoints)
151  {
152  for (PointIdentifier i = 0; i < NumberOfPoints; i++)
153  {
154  m_PointIds.push_back(NumericTraits<PointIdentifier>::max());
155  }
156  this->BuildEdges();
157  }
159 
160  ~PolygonCell() override = default;
161 
162 protected:
163  std::vector<EdgeInfo> m_Edges;
164  std::vector<PointIdentifier> m_PointIds;
165 };
166 } // namespace itk
167 
168 #ifndef ITK_MANUAL_INSTANTIATION
169 # include "itkPolygonCell.hxx"
170 #endif
171 
172 #endif
itk::PolygonCell::EdgeAutoPointer
typename EdgeType::SelfAutoPointer EdgeAutoPointer
Definition: itkPolygonCell.h:75
itk::VertexCell
Represents a single vertex for a Mesh.
Definition: itkVertexCell.h:39
itk::PolygonCell::VertexAutoPointer
typename VertexType::SelfAutoPointer VertexAutoPointer
Definition: itkPolygonCell.h:71
itkPoint.h
itkCellVisitMacro
#define itkCellVisitMacro(TopologyId)
Definition: itkCellInterface.h:32
itkLineCell.h
itk::PolygonCell::m_PointIds
std::vector< PointIdentifier > m_PointIds
Definition: itkPolygonCell.h:164
itk::PolygonCell
Represents a polygon in a Mesh.
Definition: itkPolygonCell.h:53
itk::PolygonCell::m_Edges
std::vector< EdgeInfo > m_Edges
Definition: itkPolygonCell.h:163
itkCellInheritedTypedefs
#define itkCellInheritedTypedefs(superclassArg)
Definition: itkCellInterface.h:55
itk::FixedArray
Simulate a standard C array with copy semantics.
Definition: itkFixedArray.h:52
itk::CommonEnums::CellGeometry
CellGeometry
Definition: itkCommonEnums.h:138
itk::LineCell
Represents a line segment for a Mesh.
Definition: itkLineCell.h:42
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itk::PolygonCell::GetType
CellGeometryEnum GetType() const override
Definition: itkPolygonCell.h:85
itk::CellInterface
An abstract interface for cells.
Definition: itkCellInterface.h:96
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:150
itk::PolygonCell::EdgeInfoDQ
std::deque< EdgeInfo > EdgeInfoDQ
Definition: itkPolygonCell.h:78
itk::CommonEnums::CellGeometry::POLYGON_CELL
itkCellCommonTypedefs
#define itkCellCommonTypedefs(celltype)
Definition: itkCellInterface.h:46