]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/DataStructures/QuadEdgeCell.h
...
[cpPlugins.git] / lib / cpExtensions / DataStructures / QuadEdgeCell.h
1 #ifndef __CPEXTENSIONS__DATASTRUCTURES__QUADEDGECELL__H__
2 #define __CPEXTENSIONS__DATASTRUCTURES__QUADEDGECELL__H__
3
4 #include <vector>
5
6 namespace cpExtensions
7   {
8     namespace DataStructures
9     {
10       /**
11        */
12       template< class I, class E >
13       class QuadEdgeCell
14         : public I
15       {
16       public:
17         // Base types
18         typedef QuadEdgeCell                   Self;
19         typedef I                              Superclass;
20         typedef itk::AutoPointer< Self >       SelfAutoPointer;
21         typedef itk::AutoPointer< const Self > ConstSelfAutoPointer;
22         typedef Self*                          RawPointer;
23         typedef const Self*                    ConstRawPointer;
24
25         // QuadEdge objects
26         typedef E                 TPrimalEdge;
27         typedef typename E::TDual TDualEdge;
28
29         // Inherited types
30         typedef typename I::PixelType                PixelType;
31         typedef typename I::CellType                 CellType;
32         typedef typename I::CellAutoPointer          CellAutoPointer;
33         typedef typename I::CellConstAutoPointer     CellConstAutoPointer;
34         typedef typename I::CellRawPointer           CellRawPointer;
35         typedef typename I::CellConstRawPointer      CellConstRawPointer;
36         typedef typename I::CellTraits               CellTraits;
37         typedef typename I::CoordRepType             CoordRepType;
38         typedef typename I::InterpolationWeightType  InterpolationWeightType;
39         typedef typename I::PointIdentifier          PointIdentifier;
40         typedef typename I::PointIdIterator          PointIdIterator;
41         typedef typename I::PointIdConstIterator     PointIdConstIterator;
42         typedef typename I::CellIdentifier           CellIdentifier;
43         typedef typename I::CellFeatureIdentifier    CellFeatureIdentifier;
44         typedef typename I::CellFeatureIdentifier    CellFeatureCount;
45         typedef typename I::PointType                PointType;
46         typedef typename I::VectorType               VectorType;
47         typedef typename I::PointsContainer          PointsContainer;
48         typedef typename I::UsingCellsContainer      UsingCellsContainer;
49         typedef typename I::CellGeometry             CellGeometry;
50         typedef typename I::ParametricCoordArrayType ParametricCoordArrayType;
51         typedef typename I::ShapeFunctionsArrayType  ShapeFunctionsArrayType;
52
53         itkStaticConstMacro( PointDimension, unsigned int, I::PointDimension );
54         itkStaticConstMacro( CellDimension, unsigned int, 2 );
55
56       public:
57         itkTypeMacro( QuadEdgeCell, I );
58
59       public:
60         QuadEdgeCell( );
61         QuadEdgeCell( E* entry );
62         virtual ~QuadEdgeCell( );
63
64         /// Implement the standard CellInterface.
65         virtual CellGeometry GetType( ) const;
66         virtual void MakeCopy( CellAutoPointer& other ) const;
67         virtual unsigned int GetDimension( ) const;
68         virtual unsigned int GetNumberOfPoints( ) const;
69         virtual CellFeatureCount GetNumberOfBoundaryFeatures(
70           int dimension
71           ) const;
72         virtual bool GetBoundaryFeature(
73           int dimension, CellFeatureIdentifier fId, CellAutoPointer& ptr
74           );
75         virtual void SetPointIds( PointIdConstIterator first );
76         virtual void SetPointIds(
77           PointIdConstIterator first, PointIdConstIterator last
78           );
79         virtual void AddPointId( PointIdentifier pId );
80         virtual void RemovePointId( PointIdentifier pId );
81         virtual void SetPointIds(
82           int dummy, int num, PointIdConstIterator first
83           );
84         virtual void BuildEdges( );
85         virtual void ClearPoints( );
86         virtual void SetPointId( int localId, PointIdentifier pId );
87
88         // Visitor methods
89         static int GetTopologyId( );
90         virtual void Accept(
91           CellIdentifier cellid,
92           typename itk::CellInterface< PixelType, CellTraits >::
93           MultiVisitor* mv
94           );
95
96         // Iterators
97         virtual PointIdIterator      PointIdsBegin( );
98         virtual PointIdConstIterator PointIdsBegin( ) const;
99         virtual PointIdIterator      PointIdsEnd( );
100         virtual PointIdConstIterator PointIdsEnd( ) const;
101
102         /// QuadEdgeCell-specific interface.
103         virtual E* GetEntryPrimalEdge( );
104         virtual const E* GetEntryPrimalEdge( ) const;
105         virtual void SetEntryPrimalEdge( E* entry );
106
107       private:
108         /// Purposely not implemented.
109       QuadEdgeCell( const Self& );
110         Self& operator=( const Self& );
111
112       protected:
113         E* m_EntryEdge;
114       };
115
116     } // ecapseman
117
118 } // ecapseman
119
120 #include <cpExtensions/DataStructures/QuadEdgeCell.hxx>
121
122 #endif // __CPEXTENSIONS__DATASTRUCTURES__QUADEDGECELL__H__
123
124 // eof - $RCSfile$