00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __itkPolygonCell_h
00021 #define __itkPolygonCell_h
00022
00023 #include "itkCellInterface.h"
00024 #include "itkLineCell.h"
00025 #include "itkPoint.h"
00026 #include <vector>
00027 #include <deque>
00028
00029 namespace itk
00030 {
00031
00046 template < typename TCellInterface >
00047 class ITK_EXPORT PolygonCell: public TCellInterface
00048 {
00049 public:
00051 itkCellCommonTypedefs(PolygonCell);
00052 itkCellInheritedTypedefs(TCellInterface);
00054
00056 itkTypeMacro(PolygonCell, CellInterface);
00057
00059 itkStaticConstMacro(CellDimension, unsigned int, 2);
00060
00062 typedef VertexCell< TCellInterface > VertexType;
00063 typedef typename VertexType::SelfAutoPointer VertexAutoPointer;
00064
00066 typedef LineCell< TCellInterface > EdgeType;
00067 typedef typename EdgeType::SelfAutoPointer EdgeAutoPointer;
00068
00069 typedef FixedArray<int,2> EdgeInfo;
00070 typedef std::deque<EdgeInfo> EdgeInfoDQ;
00071
00073 itkCellVisitMacro(Superclass::POLYGON_CELL);
00074
00076 virtual CellGeometry GetType(void) const
00077 {return Superclass::POLYGON_CELL;}
00078 virtual void MakeCopy( CellAutoPointer & ) const;
00079 virtual unsigned int GetDimension(void) const;
00080 virtual unsigned int GetNumberOfPoints(void) const;
00081 virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const;
00082 virtual bool GetBoundaryFeature(int dimension, CellFeatureIdentifier,CellAutoPointer &);
00084
00085 virtual void SetPointIds(PointIdConstIterator first);
00086 virtual void SetPointIds(PointIdConstIterator first,
00087 PointIdConstIterator last);
00088
00089 void AddPointId(PointIdentifier);
00090 void RemovePointId(PointIdentifier);
00091 void SetPointIds(int dummy, int num, PointIdConstIterator first);
00092 void BuildEdges(void);
00093 void ClearPoints(void);
00094
00095 virtual void SetPointId(int localId, PointIdentifier);
00096 virtual PointIdIterator PointIdsBegin(void);
00097 virtual PointIdConstIterator PointIdsBegin(void) const;
00098 virtual PointIdIterator PointIdsEnd(void);
00099 virtual PointIdConstIterator PointIdsEnd(void) const;
00100
00102 virtual CellFeatureCount GetNumberOfVertices(void) const;
00103 virtual CellFeatureCount GetNumberOfEdges(void) const;
00104 virtual bool GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
00105 virtual bool GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
00107
00108
00110 PolygonCell() {}
00111 PolygonCell(unsigned int NumberOfPoints)
00112 {
00113 for (unsigned int i = 0; i < NumberOfPoints; i++)
00114 {
00115 m_PointIds.push_back(NumericTraits<unsigned long>::max());
00116 }
00117 this->BuildEdges();
00118 }
00119 ~PolygonCell() {}
00121
00122 protected:
00123 std::vector<EdgeInfo> m_Edges;
00124 std::vector<PointIdentifier> m_PointIds;
00125
00126 private:
00127 PolygonCell(const Self&);
00128 void operator=(const Self&);
00129
00130 };
00131
00132 }
00133
00134 #ifndef ITK_MANUAL_INSTANTIATION
00135 #include "itkPolygonCell.txx"
00136 #endif
00137
00138 #endif
00139
00140
00141