ITK  5.4.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
36namespace itk
37{
52template <typename TCellInterface>
53class ITK_TEMPLATE_EXPORT PolygonCell : public TCellInterface
54{
55public:
56 ITK_DISALLOW_COPY_AND_MOVE(PolygonCell);
57
60 itkCellInheritedTypedefs(TCellInterface);
64 itkOverrideGetNameOfClassMacro(PolygonCell);
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;
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
118
119 void
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
139
140 virtual CellFeatureCount
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 }
160 ~PolygonCell() override = default;
161
162protected:
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
Simulate a standard C array with copy semantics.
Definition: itkFixedArray.h:54
Represents a line segment for a Mesh.
Definition: itkLineCell.h:46
Define additional traits for native types such as int or float.
Represents a polygon in a Mesh.
unsigned int GetNumberOfPoints() const override
unsigned int GetDimension() const override
CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const override
~PolygonCell() override=default
PolygonCell()=default
itkCellCommonTypedefs(PolygonCell)
typename EdgeType::SelfAutoPointer EdgeAutoPointer
itkCellVisitMacro(CellGeometryEnum::POLYGON_CELL)
void RemovePointId(PointIdentifier)
PointIdConstIterator PointIdsEnd() const override
PointIdIterator PointIdsEnd() override
std::deque< EdgeInfo > EdgeInfoDQ
virtual CellFeatureCount GetNumberOfEdges() const
PolygonCell(PointIdentifier NumberOfPoints)
void SetPointIds(PointIdConstIterator first) override
CellGeometryEnum GetType() const override
virtual bool GetEdge(CellFeatureIdentifier, EdgeAutoPointer &)
itkCellInheritedTypedefs(TCellInterface)
void SetPointId(int localId, PointIdentifier) override
PointIdConstIterator PointIdsBegin() const override
void SetPointIds(int dummy, int num, PointIdConstIterator first)
virtual bool GetVertex(CellFeatureIdentifier, VertexAutoPointer &)
PointIdIterator PointIdsBegin() override
void SetPointIds(PointIdConstIterator first, PointIdConstIterator last) override
virtual CellFeatureCount GetNumberOfVertices() const
typename VertexType::SelfAutoPointer VertexAutoPointer
void AddPointId(PointIdentifier)
bool GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &) override
void MakeCopy(CellAutoPointer &) const override
Represents a single vertex for a Mesh.
Definition: itkVertexCell.h:43
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....