ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkPolygonCell.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 PolygonCell:public TCellInterface
54 {
55 public:
58  itkCellInheritedTypedefs(TCellInterface);
60 
62  itkTypeMacro(PolygonCell, CellInterface);
63 
65  itkStaticConstMacro(CellDimension, unsigned int, 2);
66 
69  typedef typename VertexType::SelfAutoPointer VertexAutoPointer;
70 
73  typedef typename EdgeType::SelfAutoPointer EdgeAutoPointer;
74 
76  typedef std::deque< EdgeInfo > EdgeInfoDQ;
77 
79  itkCellVisitMacro(Superclass::POLYGON_CELL);
80 
82  virtual CellGeometry GetType(void) const ITK_OVERRIDE
83  { return Superclass::POLYGON_CELL; }
84  virtual void MakeCopy(CellAutoPointer &) const ITK_OVERRIDE;
86 
87  virtual unsigned int GetDimension(void) const ITK_OVERRIDE;
88 
89  virtual unsigned int GetNumberOfPoints(void) const ITK_OVERRIDE;
90 
91  virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const ITK_OVERRIDE;
92 
93  virtual bool GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &) ITK_OVERRIDE;
94 
95  virtual void SetPointIds(PointIdConstIterator first) ITK_OVERRIDE;
96 
97  virtual void SetPointIds(PointIdConstIterator first,
98  PointIdConstIterator last) ITK_OVERRIDE;
99 
100  void AddPointId(PointIdentifier);
101  void RemovePointId(PointIdentifier);
102  void SetPointIds(int dummy, int num, PointIdConstIterator first);
103 
104  void BuildEdges();
105 
106  void ClearPoints();
107 
108  virtual void SetPointId(int localId, PointIdentifier) ITK_OVERRIDE;
109  virtual PointIdIterator PointIdsBegin(void) ITK_OVERRIDE;
110 
111  virtual PointIdConstIterator PointIdsBegin(void) const ITK_OVERRIDE;
112 
113  virtual PointIdIterator PointIdsEnd(void) ITK_OVERRIDE;
114 
115  virtual PointIdConstIterator PointIdsEnd(void) const ITK_OVERRIDE;
116 
118  virtual CellFeatureCount GetNumberOfVertices() const;
119 
120  virtual CellFeatureCount GetNumberOfEdges() const;
121 
122  virtual bool GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
123  virtual bool GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
124 
127  PolygonCell(PointIdentifier NumberOfPoints)
128  {
129  for ( PointIdentifier i = 0; i < NumberOfPoints; i++ )
130  {
132  }
133  this->BuildEdges();
134  }
136 
138 
139 protected:
140  std::vector< EdgeInfo > m_Edges;
141  std::vector< PointIdentifier > m_PointIds;
142 
143 private:
144  PolygonCell(const Self &); //purposely not implemented
145  void operator=(const Self &); //purposely not implemented
146 };
147 } //end namespace
148 
149 #ifndef ITK_MANUAL_INSTANTIATION
150 #include "itkPolygonCell.hxx"
151 #endif
152 
153 #endif
virtual CellGeometry GetType(void) const override
Represents a line segment for a Mesh.
Definition: itkLineCell.h:42
VertexType::SelfAutoPointer VertexAutoPointer
virtual bool GetEdge(CellFeatureIdentifier, EdgeAutoPointer &)
virtual CellFeatureCount GetNumberOfEdges() const
itkCellVisitMacro(Superclass::POLYGON_CELL)
virtual void SetPointId(int localId, PointIdentifier) override
virtual void SetPointIds(PointIdConstIterator first) override
virtual PointIdIterator PointIdsEnd(void) override
An abstract interface for cells.
std::deque< EdgeInfo > EdgeInfoDQ
PolygonCell(PointIdentifier NumberOfPoints)
virtual bool GetBoundaryFeature(int dimension, CellFeatureIdentifier, CellAutoPointer &) override
static const unsigned int CellDimension
Simulate a standard C array with copy semnatics.
Definition: itkFixedArray.h:50
itkCellInheritedTypedefs(TCellInterface)
virtual void MakeCopy(CellAutoPointer &) const override
virtual PointIdIterator PointIdsBegin(void) override
LineCell< TCellInterface > EdgeType
virtual unsigned int GetDimension(void) const override
EdgeType::SelfAutoPointer EdgeAutoPointer
VertexCell< TCellInterface > VertexType
void RemovePointId(PointIdentifier)
void operator=(const Self &)
Represents a polygon in a Mesh.
virtual bool GetVertex(CellFeatureIdentifier, VertexAutoPointer &)
std::vector< PointIdentifier > m_PointIds
std::vector< EdgeInfo > m_Edges
Represents a single vertex for a Mesh.
Definition: itkVertexCell.h:39
FixedArray< int, 2 > EdgeInfo
Define additional traits for native types such as int or float.
virtual unsigned int GetNumberOfPoints(void) const override
itkCellCommonTypedefs(PolygonCell)
virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const override
virtual CellFeatureCount GetNumberOfVertices() const
void AddPointId(PointIdentifier)