DGtal  0.9.2
DigitalSurface2DSlice.h
1 
17 #pragma once
18 
31 #if defined(DigitalSurface2DSlice_RECURSES)
32 #error Recursive header files inclusion detected in DigitalSurface2DSlice.h
33 #else // defined(DigitalSurface2DSlice_RECURSES)
34 
35 #define DigitalSurface2DSlice_RECURSES
36 
37 #if !defined DigitalSurface2DSlice_h
38 
39 #define DigitalSurface2DSlice_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <deque>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/base/Circulator.h"
47 #include "DGtal/topology/CDigitalSurfaceTracker.h"
49 
50 namespace DGtal
51 {
52 
54  // template class DigitalSurface2DSlice
91  template <typename TDigitalSurfaceTracker>
93  {
94  public:
95  typedef TDigitalSurfaceTracker DigitalSurfaceTracker;
97 
99  typedef typename DigitalSurfaceTracker::DigitalSurfaceContainer DigitalSurfaceContainer;
100  typedef typename DigitalSurfaceContainer::KSpace KSpace;
101  typedef typename DigitalSurfaceContainer::Surfel Surfel;
102  typedef typename DigitalSurfaceContainer::Size Size;
104 
105  typedef std::deque<Surfel> Storage;
106  typedef typename Storage::const_iterator ConstIterator;
107  typedef typename Storage::const_reverse_iterator ConstReverseIterator;
110 
111 
112  // ----------------------- Standard services ------------------------------
113  public:
114 
119 
139  DigitalSurface2DSlice( DigitalSurfaceTracker* tracker, Dimension i );
140 
160  bool init( DigitalSurfaceTracker* tracker, Dimension i );
161 
163  Size size() const;
164 
166  bool isClosed() const;
167 
171  ConstIterator start() const;
172 
177  ConstReverseIterator rstart() const;
178 
182  ConstCirculator cstart() const;
183 
188  ConstReverseCirculator rcstart() const;
189 
190  // ------------------------- iterator services ----------------------------
191  public:
192 
197  ConstIterator begin() const;
198 
203  ConstIterator end() const;
204 
209  ConstReverseIterator rbegin() const;
210 
215  ConstReverseIterator rend() const;
216 
221  ConstCirculator c() const;
222 
227  ConstReverseCirculator rc() const;
228 
229  // ----------------------- Interface --------------------------------------
230  public:
231 
236  void selfDisplay ( std::ostream & out ) const;
237 
242  bool isValid() const;
243 
244  // ------------------------- Protected Datas ------------------------------
245  private:
246  // ------------------------- Private Datas --------------------------------
247  private:
249  std::deque<Surfel> mySurfels;
254  ConstIterator myStart;
255  // ------------------------- Hidden services ------------------------------
256  protected:
257 
263 
264  private:
265 
272 
280 
281  // ------------------------- Internals ------------------------------------
282  private:
283 
284  }; // end of class DigitalSurface2DSlice
285 
286 
293  template <typename TDigitalSurfaceTracker>
294  std::ostream&
295  operator<< ( std::ostream & out, const DigitalSurface2DSlice<TDigitalSurfaceTracker> & object );
296 
297 } // namespace DGtal
298 
299 
301 // Includes inline functions.
302 #include "DGtal/topology/DigitalSurface2DSlice.ih"
303 
304 // //
306 
307 #endif // !defined DigitalSurface2DSlice_h
308 
309 #undef DigitalSurface2DSlice_RECURSES
310 #endif // else defined(DigitalSurface2DSlice_RECURSES)
bool myIsClosed
Tells if the slice is closed (true) or open (false).
DigitalSurface2DSlice & operator=(const DigitalSurface2DSlice &other)
bool init(DigitalSurfaceTracker *tracker, Dimension i)
ConstIterator start() const
DGtal::uint32_t Dimension
Definition: Common.h:113
ConstCirculator c() const
ConstReverseCirculator rc() const
ConstReverseIterator rstart() const
Aim: Represents a set of n-1-cells in a nD space, together with adjacency relation between these cell...
Circulator< ConstReverseIterator > ConstReverseCirculator
ConstReverseCirculator rcstart() const
DigitalSurfaceContainer::KSpace KSpace
DigitalSurface< DigitalSurfaceContainer > TheDigitalSurface
Storage::const_iterator ConstIterator
ConstIterator begin() const
ConstReverseIterator rend() const
Aim: Represents a 2-dimensional slice in a DigitalSurface. In a sense, it is a 4-connected contour...
DigitalSurfaceContainer::Surfel Surfel
Aim: Provides an adapter for classical iterators that can iterate through the underlying data structu...
Definition: Circulator.h:85
std::deque< Surfel > mySurfels
The container that stores the surfels of this slice.
DGtal is the top-level namespace which contains all DGtal functions and types.
Size size() const
The number of surfels of this slice.
ConstIterator end() const
DigitalSurfaceTracker::DigitalSurfaceContainer DigitalSurfaceContainer
ConstReverseIterator rbegin() const
TDigitalSurfaceTracker DigitalSurfaceTracker
DigitalSurface2DSlice< DigitalSurfaceTracker > Self
BOOST_CONCEPT_ASSERT((concepts::CDigitalSurfaceTracker< DigitalSurfaceTracker >))
void selfDisplay(std::ostream &out) const
DigitalSurfaceContainer::Size Size
Storage::const_reverse_iterator ConstReverseIterator
Circulator< ConstIterator > ConstCirculator
ConstCirculator cstart() const