ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkQuadEdgeMeshLineCell.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkQuadEdgeMeshLineCell_h
19 #define __itkQuadEdgeMeshLineCell_h
20 
21 #include "itkAutoPointer.h"
22 #include "itkGeometricalQuadEdge.h"
23 
24 namespace itk
25 {
38 template< class TCellInterface >
39 class ITK_EXPORT QuadEdgeMeshLineCell:
40  public TCellInterface, public TCellInterface::CellTraits::QuadEdgeType
41 {
42 public:
43 
45  // itkCellCommonTypedefs
49  typedef Self * RawPointer;
50  typedef const Self * ConstRawPointer;
51 
52  // itkCellInheritedTypedefs
53  typedef TCellInterface Superclass;
54  typedef typename Superclass::PixelType PixelType;
55  typedef typename Superclass::CellType CellType;
56  typedef typename Superclass::CellAutoPointer CellAutoPointer;
57  typedef typename Superclass::CellConstAutoPointer CellConstAutoPointer;
58  typedef typename Superclass::CellRawPointer CellRawPointer;
59  typedef typename Superclass::CellConstRawPointer CellConstRawPointer;
60  typedef typename Superclass::CellTraits CellTraits;
61  typedef typename Superclass::CoordRepType CoordRepType;
62  typedef typename Superclass::InterpolationWeightType InterpolationWeightType;
63  typedef typename Superclass::PointIdentifier PointIdentifier;
64  typedef typename Superclass::CellIdentifier CellIdentifier;
65  typedef typename Superclass::CellFeatureIdentifier CellFeatureIdentifier;
66  typedef typename Superclass::CellFeatureIdentifier CellFeatureCount;
67  typedef typename Superclass::PointType PointType;
68  typedef typename Superclass::PointsContainer PointsContainer;
69  typedef typename Superclass::UsingCellsContainer UsingCellsContainer;
70  typedef typename Superclass::CellGeometry CellGeometry;
71  typedef typename Superclass::ParametricCoordArrayType ParametricCoordArrayType;
72  typedef typename Superclass::ShapeFunctionsArrayType ShapeFunctionsArrayType;
73  itkStaticConstMacro(PointDimension, unsigned int, Superclass::PointDimension);
74  itkStaticConstMacro(CellDimension, unsigned int, 2);
75 
77  typedef typename CellType::MultiVisitor MultiVisitor;
78 
80  typedef typename CellTraits::PointIdIterator PointIdIterator;
81  typedef typename CellTraits::PointIdConstIterator PointIdConstIterator;
82  typedef typename CellTraits::PointIdInternalIterator PointIdInternalIterator;
83  typedef typename CellTraits::PointIdInternalConstIterator PointIdInternalConstIterator;
84 
86  typedef typename CellTraits::QuadEdgeType QEType;
87  typedef typename QEType::OriginRefType VertexRefType;
88  typedef typename QEType::DualOriginRefType FaceRefType;
89  typedef typename QEType::PrimalDataType PrimalDataType;
90  typedef typename QEType::DualDataType DualDataType;
91  typedef typename QEType::DualType QEDual;
92 public:
93 
95  itkTypeMacro(QuadEdgeMeshLineCell, TCellInterface);
96 
97  // accessor to the new QEGeom link that replaces now inheritance.
98  QEType * GetQEGeom() const { return ( m_QuadEdgeGeom ); }
99 public:
102  virtual ~QuadEdgeMeshLineCell();
104 
106  void SetIdent(CellIdentifier cid);
107 
108  CellIdentifier GetIdent();
109 
111  virtual void Accept(CellIdentifier cellId, MultiVisitor *mv);
112 
113  virtual CellGeometry GetType() const;
114 
116  static int GetTopologyId();
117 
118  virtual unsigned int GetDimension() const;
119 
120  virtual unsigned int GetNumberOfPoints() const;
121 
122  virtual CellFeatureCount GetNumberOfBoundaryFeatures(int dimension) const;
123 
124  virtual bool GetBoundaryFeature(int dimension,
125  CellFeatureIdentifier cellId,
126  CellAutoPointer & cell);
127 
129  virtual void MakeCopy(CellAutoPointer & cell) const
130  {
131  cell.TakeOwnership(new Self);
132  cell->SetPointId( 0, this->GetQEGeom()->GetOrigin() );
133  cell->SetPointId( 1, this->GetQEGeom()->GetDestination() );
134  }
136 
141  virtual void SetPointIds(PointIdConstIterator first);
142 
143  virtual void SetPointIds(PointIdConstIterator first,
144  PointIdConstIterator last);
145 
146  virtual void SetPointId(int localId, PointIdentifier pId);
147 
148  virtual PointIdIterator PointIdsBegin()
149  {
150  SynchronizePointsAPI();
151  return &m_PointIds[0];
152  }
153 
154  virtual PointIdIterator PointIdsEnd()
155  {
156  SynchronizePointsAPI();
157  return ( &m_PointIds[1] + 1 );
158  }
159 
160  virtual PointIdConstIterator GetPointIds() const
161  {
162  SynchronizePointsAPI();
163  return &m_PointIds[0];
164  }
165 
166  virtual PointIdConstIterator PointIdsBegin() const
167  {
168  SynchronizePointsAPI();
169  return &m_PointIds[0];
170  }
171 
172  virtual PointIdConstIterator PointIdsEnd() const
173  {
174  SynchronizePointsAPI();
175  return ( &m_PointIds[1] + 1 );
176  }
177 
179  void SynchronizePointsAPI() const
180  {
181  m_PointIds[0] = GetQEGeom()->GetOrigin();
182  m_PointIds[1] = GetQEGeom()->GetDestination();
183  }
185 
187  virtual void InternalSetPointIds(PointIdInternalConstIterator first);
188 
189  virtual void InternalSetPointIds(
190  PointIdInternalConstIterator first,
191  PointIdInternalConstIterator last);
192 
193  virtual PointIdInternalIterator InternalPointIdsBegin();
194 
195  virtual PointIdInternalIterator InternalPointIdsEnd();
196 
197  virtual PointIdInternalConstIterator InternalGetPointIds() const;
198 
199  virtual PointIdInternalConstIterator InternalPointIdsBegin() const;
200 
201  virtual PointIdInternalConstIterator InternalPointIdsEnd() const;
202 
203 private:
204  QuadEdgeMeshLineCell(const Self &); //purposely not implemented
205  void operator=(const Self &); //purposely not implemented
206 
213  mutable PointIdentifier m_PointIds[2];
214 };
215 } // end namespace itk
216 
217 #ifndef ITK_MANUAL_INSTANTIATION
218 #include "itkQuadEdgeMeshLineCell.hxx"
219 #endif
220 
221 #endif
222