Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkQuadEdgeMeshPolygonCell_h
00019 #define __itkQuadEdgeMeshPolygonCell_h
00020
00021 namespace itk
00022 {
00023
00035 template< class TCellInterface >
00036 class QuadEdgeMeshPolygonCell : public TCellInterface
00037 {
00038 public:
00040
00041 typedef QuadEdgeMeshPolygonCell Self;
00042 typedef AutoPointer< const Self > ConstSelfAutoPointer;
00043 typedef AutoPointer< Self > SelfAutoPointer;
00044 typedef Self* RawPointer;
00045 typedef const Self* ConstRawPointer;
00046
00047
00048 typedef TCellInterface Superclass;
00049 typedef typename Superclass::PixelType PixelType;
00050 typedef typename Superclass::CellType CellType;
00051 typedef typename Superclass::CellAutoPointer CellAutoPointer;
00052 typedef typename Superclass::CellConstAutoPointer CellConstAutoPointer;
00053 typedef typename Superclass::CellRawPointer CellRawPointer;
00054 typedef typename Superclass::CellConstRawPointer CellConstRawPointer;
00055 typedef typename Superclass::CellTraits CellTraits;
00056 typedef typename Superclass::CoordRepType CoordRepType;
00057 typedef typename Superclass::InterpolationWeightType InterpolationWeightType;
00058 typedef typename Superclass::PointIdentifier PointIdentifier;
00059 typedef typename Superclass::CellIdentifier CellIdentifier;
00060 typedef typename Superclass::CellFeatureIdentifier CellFeatureIdentifier;
00061 typedef typename Superclass::CellFeatureIdentifier CellFeatureCount;
00062 typedef typename Superclass::PointType PointType;
00063 typedef typename Superclass::PointsContainer PointsContainer;
00064 typedef typename Superclass::UsingCellsContainer UsingCellsContainer;
00065 typedef typename Superclass::CellGeometry CellGeometry;
00066 typedef typename Superclass::ParametricCoordArrayType ParametricCoordArrayType;
00067 typedef typename Superclass::ShapeFunctionsArrayType ShapeFunctionsArrayType;
00068 itkStaticConstMacro( PointDimension, unsigned int, Superclass::PointDimension );
00069 itkStaticConstMacro( CellDimension, unsigned int, 2 );
00070
00072 typedef typename CellType::MultiVisitor MultiVisitor;
00073
00074 typedef QuadEdgeMeshLineCell< CellType > EdgeCellType;
00075 typedef std::vector< EdgeCellType* > EdgeCellListType;
00076
00078 typedef typename CellTraits::PointIdIterator PointIdIterator;
00079 typedef typename CellTraits::PointIdConstIterator PointIdConstIterator;
00080 typedef typename CellTraits::PointIdInternalIterator PointIdInternalIterator;
00081 typedef typename CellTraits::PointIdInternalConstIterator PointIdInternalConstIterator;
00082
00084 typedef typename CellTraits::QuadEdgeType QuadEdgeType;
00085 typedef typename QuadEdgeType::OriginRefType VertexRefType;
00086 typedef typename QuadEdgeType::DualOriginRefType FaceRefType;
00087 typedef typename QuadEdgeType::PrimalDataType PrimalDataType;
00088 typedef typename QuadEdgeType::DualDataType DualDataType;
00089 typedef typename QuadEdgeType::DualType QEDual;
00090
00091 public:
00093 itkTypeMacro( QuadEdgeMeshPolygonCell, TCellInterface );
00094
00096 QuadEdgeMeshPolygonCell( PointIdentifier nPoints = 0 );
00097 QuadEdgeMeshPolygonCell( QuadEdgeType* e );
00098 virtual ~QuadEdgeMeshPolygonCell();
00100
00102 void SetIdent( CellIdentifier cid ) { m_Ident = cid; }
00103 CellIdentifier GetIdent() { return( m_Ident ); }
00105
00107 QuadEdgeType* GetEdgeRingEntry() const { return( m_EdgeRingEntry ); }
00108 void SetEdgeRingEntry( QuadEdgeType* entry ) { m_EdgeRingEntry = entry; }
00110
00112 SelfAutoPointer New();
00113
00115 virtual void Accept( unsigned long cellId, MultiVisitor* mv );
00116 virtual CellGeometry GetType() const { return( Superclass::POLYGON_CELL );}
00118
00120 static int GetTopologyId()
00121 {
00122 return( Superclass::POLYGON_CELL );
00123 }
00124 virtual unsigned int GetDimension() const
00125 {
00126 return( Self::CellDimension );
00127 }
00128 virtual unsigned int GetNumberOfPoints() const;
00129 virtual CellFeatureCount GetNumberOfBoundaryFeatures( int dimension ) const;
00130 virtual bool GetBoundaryFeature( int dimension,
00131 CellFeatureIdentifier cellId,
00132 CellAutoPointer& cell );
00134
00136 virtual void MakeCopy( CellAutoPointer& cell ) const
00137 {
00138 const unsigned long numberOfPoints = this->GetNumberOfPoints();
00139 Self * newPolygonCell = new Self( numberOfPoints );
00140 cell.TakeOwnership( newPolygonCell );
00141 if ( numberOfPoints )
00142 {
00143 for( unsigned long i = 0; i < numberOfPoints; i++ )
00144 {
00145 newPolygonCell->SetPointId( i, this->GetPointId( i ) );
00146 }
00147 }
00148 }
00150
00151
00153 virtual void SetPointIds( PointIdConstIterator first );
00154 virtual void SetPointIds( PointIdConstIterator first,
00155 PointIdConstIterator last );
00156 virtual void SetPointId( int localId, PointIdentifier pId );
00158
00159 virtual PointIdentifier GetPointId( int localId ) const;
00160
00161 virtual PointIdIterator PointIdsBegin()
00162 {
00163
00164 MakePointIds();
00165 if (m_PointIds.size() == 0)
00166 {
00167 return (static_cast<PointIdIterator>(0));
00168 }
00169 else
00170 {
00171 return &*(m_PointIds.begin());
00172 }
00173 }
00174
00175 virtual PointIdIterator PointIdsEnd()
00176 {
00177
00178 if (m_PointIds.size() == 0)
00179 {
00180 return (static_cast<PointIdIterator>(0));
00181 }
00182 else
00183 {
00184 return &m_PointIds[m_PointIds.size()-1] + 1;
00185 }
00186 }
00187
00188 virtual PointIdConstIterator PointIdsBegin() const
00189 {
00190
00191 MakePointIds();
00192 if (m_PointIds.size() == 0)
00193 {
00194 return (static_cast<PointIdIterator>(0));
00195 }
00196 else
00197 {
00198 return &*(m_PointIds.begin());
00199 }
00200 }
00201
00202 virtual PointIdConstIterator PointIdsEnd() const
00203 {
00204
00205 if (m_PointIds.size() == 0)
00206 {
00207 return (static_cast<PointIdIterator>(0));
00208 }
00209 else
00210 {
00211 return &m_PointIds[m_PointIds.size()-1] + 1;
00212 }
00213 }
00214
00216 virtual void InternalSetPointIds( PointIdInternalConstIterator first );
00217 virtual void InternalSetPointIds( PointIdInternalConstIterator first,
00218 PointIdInternalConstIterator last );
00220
00221 virtual PointIdInternalIterator InternalPointIdsBegin();
00222 virtual PointIdInternalIterator InternalPointIdsEnd();
00223
00224 virtual PointIdInternalConstIterator InternalGetPointIds() const;
00225 virtual PointIdInternalConstIterator InternalPointIdsBegin() const;
00226 virtual PointIdInternalConstIterator InternalPointIdsEnd() const;
00227
00228 protected:
00229 typedef std::vector<PointIdentifier> PointIDListType;
00230 mutable PointIDListType m_PointIds;
00231
00232 private:
00233 QuadEdgeMeshPolygonCell( const Self& );
00234 void operator=( const Self& );
00235
00236 void MakePointIds() const
00237 {
00238 if( !this->GetNumberOfPoints( ) )
00239 {
00240 return;
00241 }
00242
00243
00244
00245 m_PointIds.clear();
00246 for( PointIdentifier i = 0; i < this->GetNumberOfPoints( ); i++ )
00247 {
00248 m_PointIds.push_back( GetPointId( i ) );
00249 }
00250 }
00251
00255 CellIdentifier m_Ident;
00256
00260 QuadEdgeType * m_EdgeRingEntry;
00261
00265 EdgeCellListType m_EdgeCellList;
00266
00267 };
00268
00269 }
00270
00271 #ifndef ITK_MANUAL_INSTANTIATION
00272 #include "itkQuadEdgeMeshPolygonCell.txx"
00273 #endif
00274
00275 #endif
00276