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 "itkCellBoundary.h"
00025 #include "itkLineCell.h"
00026 #include "itkPoint.h"
00027 #include <vector>
00028 #include <queue>
00029
00030
00031 namespace itk
00032 {
00033
00048 template < typename TCellInterface >
00049 class PolygonCell: public TCellInterface
00050 {
00051 public:
00053 itkCellCommonTypedefs(PolygonCell);
00054 itkCellInheritedTypedefs(TCellInterface);
00055
00057 itkTypeMacro(PolygonCell, CellInterface);
00058
00060 itkStaticConstMacro(CellDimension, unsigned int, 2);
00061
00063 typedef VertexBoundary< TCellInterface > VertexType;
00064 typedef typename VertexType::SelfAutoPointer VertexAutoPointer;
00065
00067 typedef LineBoundary< TCellInterface > EdgeType;
00068 typedef typename EdgeType::SelfAutoPointer EdgeAutoPointer;
00069
00070 typedef FixedArray<int,2> EdgeInfo;
00071 typedef std::deque<EdgeInfo> EdgeInfoDQ;
00072
00074 itkCellVisitMacro(POLYGON_CELL);
00075
00077 virtual CellGeometry GetType(void) const
00078 {return Superclass::POLYGON_CELL;}
00079 virtual void MakeCopy( CellAutoPointer & ) const;
00080 virtual unsigned int GetDimension(void) const;
00081 virtual unsigned int GetNumberOfPoints(void) const;
00082 virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const;
00083 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 SetPointIds(int dummy, int num, PointIdConstIterator first);
00091 void BuildEdges(void);
00092 void ClearPoints(void);
00093
00094 virtual void SetPointId(int localId, PointIdentifier);
00095 virtual PointIdIterator PointIdsBegin(void);
00096 virtual PointIdConstIterator PointIdsBegin(void) const;
00097 virtual PointIdIterator PointIdsEnd(void);
00098 virtual PointIdConstIterator PointIdsEnd(void) const;
00099
00101 virtual CellFeatureCount GetNumberOfVertices(void) const;
00102 virtual CellFeatureCount GetNumberOfEdges(void) const;
00103 virtual bool GetVertex(CellFeatureIdentifier, VertexAutoPointer &);
00104 virtual bool GetEdge(CellFeatureIdentifier, EdgeAutoPointer &);
00105
00106
00108 PolygonCell() {}
00109 ~PolygonCell() {}
00110
00111 protected:
00112 std::vector<EdgeInfo> m_Edges;
00113 std::vector<PointIdentifier> m_PointIds;
00114
00115 private:
00116 PolygonCell(const Self&);
00117 void operator=(const Self&);
00118
00119 };
00120
00126 template <typename TCellInterface >
00127 class PolygonBoundary:
00128 public CellBoundary< PolygonCell< TCellInterface > >
00129 {
00130 public:
00132 itkCellCommonTypedefs(PolygonBoundary);
00133
00135 itkTypeMacro(PolygonBoundary, CellBoundary);
00136
00138 PolygonBoundary() {}
00139 ~PolygonBoundary() {}
00140
00141 };
00142
00143 }
00144
00145 #ifndef ITK_MANUAL_INSTANTIATION
00146 #include "itkPolygonCell.txx"
00147 #endif
00148
00149 #endif
00150
00151