DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SetOfSurfels.h
1 
17 #pragma once
18 
31 #if defined(SetOfSurfels_RECURSES)
32 #error Recursive header files inclusion detected in SetOfSurfels.h
33 #else // defined(SetOfSurfels_RECURSES)
34 
35 #define SetOfSurfels_RECURSES
36 
37 #if !defined SetOfSurfels_h
38 
39 #define SetOfSurfels_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <vector>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/topology/Topology.h"
47 #include "DGtal/topology/SurfelAdjacency.h"
48 #include "DGtal/topology/SurfelNeighborhood.h"
49 #include "DGtal/topology/SurfelSetPredicate.h"
51 
52 namespace DGtal
53 {
54 
56  // template class SetOfSurfels
70  template < typename TKSpace,
71  typename TSurfelSet = typename TKSpace::SurfelSet >
73  {
74  public:
75 
79  class Tracker
80  {
81  public:
82  // -------------------- associated types --------------------
83  typedef Tracker Self;
85  typedef typename TKSpace::SCell Surfel;
86 
87  // -------------------- inner types --------------------
88  typedef TKSpace KSpace;
90 
91  public:
97  Tracker( const DigitalSurfaceContainer & aSurface,
98  const Surfel & s );
99 
104  Tracker( const Tracker & other );
105 
109  ~Tracker();
110 
112  const DigitalSurfaceContainer & surface() const;
114  const Surfel & current() const;
116  Dimension orthDir() const;
117 
123  void move( const Surfel & s );
124 
141  uint8_t adjacent( Surfel & s, Dimension d, bool pos ) const;
142 
143  private:
150 
151  };
152 
153  // ----------------------- associated types ------------------------------
154  public:
157  typedef TKSpace KSpace;
159  typedef typename KSpace::SCell Surfel;
161  typedef typename KSpace::Size Size;
162  // Model of CSurfelSet
163  typedef TSurfelSet SurfelSet;
164 
165  // BOOST_CONCEPT_ASSERT(( CCellularGridSpaceND< KSpace > ));
166  // BOOST_CONCEPT_ASSERT(( CSurfelSet< SurfelSet > ));
167 
168  // -------------------- specific types ------------------------------
169  typedef typename SurfelSet::const_iterator SurfelConstIterator;
170  typedef typename KSpace::Space Space;
171  typedef typename KSpace::Point Point;
173 
174  // ----------------------- other types ------------------------------
175  public:
177  typedef typename KSpace::Cell Cell;
178  typedef typename KSpace::SCell SCell;
179  typedef typename KSpace::CellSet CellSet;
180  typedef typename KSpace::SCellSet SCellSet;
182 
183  // ----------------------- Standard services ------------------------------
184  public:
185 
189  ~SetOfSurfels();
190 
197  SetOfSurfels ( const SetOfSurfels & other );
198 
211  SetOfSurfels( const KSpace & aKSpace,
212  const Adjacency & adj,
213  SurfelSet aSetOfSurfels = SurfelSet() );
214 
215  // Mutator to set of surfels.
216  SurfelSet & surfelSet();
217  // Accessor to set of surfels.
218  const SurfelSet & surfelSet() const;
219 
221  const Adjacency & surfelAdjacency() const;
225  const SurfelPredicate & surfelPredicate() const;
226 
227  // --------- CDigitalSurfaceContainer realization -------------------------
228  public:
229 
231  const KSpace & space() const;
236  bool isInside( const Surfel & s ) const;
237 
240  SurfelConstIterator begin() const;
241 
244  SurfelConstIterator end() const;
245 
248  Size nbSurfels() const;
249 
252  bool empty() const;
253 
259  DigitalSurfaceTracker* newTracker( const Surfel & s ) const;
260 
266 
267  // ----------------------- Interface --------------------------------------
268  public:
269 
274  void selfDisplay ( std::ostream & out ) const;
275 
280  bool isValid() const;
281 
282  // ------------------------- Protected Datas ------------------------------
283  private:
284  // ------------------------- Private Datas --------------------------------
285  private:
287  const KSpace & myKSpace;
294 
295  // ------------------------- Hidden services ------------------------------
296  protected:
297 
298  private:
299 
306  SetOfSurfels & operator= ( const SetOfSurfels & other );
307 
308  // ------------------------- Internals ------------------------------------
309  private:
310 
311  }; // end of class SetOfSurfels
312 
313 
326  template <typename TKSpace, typename TSurfelSet>
327  std::ostream&
328  operator<< ( std::ostream & out,
329  const SetOfSurfels<TKSpace, TSurfelSet> & object );
330 
331 } // namespace DGtal
332 
333 
335 // Includes inline functions.
336 #include "DGtal/topology/SetOfSurfels.ih"
337 
338 // //
340 
341 #endif // !defined SetOfSurfels_h
342 
343 #undef SetOfSurfels_RECURSES
344 #endif // else defined(SetOfSurfels_RECURSES)