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