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
36namespace itk
37{
48template <typename TCellInterface>
49class ITK_TEMPLATE_EXPORT PolygonCell : public TCellInterface
50{
51public:
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
114
115 void
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
135
136 virtual CellFeatureCount
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
158protected:
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
Simulate a standard C array with copy semantics.
Definition: itkFixedArray.h:54
Represents a line segment for a Mesh.
Definition: itkLineCell.h:41
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:38
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....