DGtal  1.1.0
DomainAdjacency.h
1 
17 #pragma once
18 
31 #if defined(DomainAdjacency_RECURSES)
32 #error Recursive header files inclusion detected in DomainAdjacency.h
33 #else // defined(DomainAdjacency_RECURSES)
34 
35 #define DomainAdjacency_RECURSES
36 
37 #if !defined DomainAdjacency_h
38 
39 #define DomainAdjacency_h
40 
42 // Inclusions
43 #include <iostream>
44 #include <map>
45 #include "DGtal/base/Common.h"
46 #include "DGtal/base/ConstAlias.h"
47 #include "DGtal/kernel/domains/CDomain.h"
48 #include "DGtal/kernel/domains/DomainPredicate.h"
49 #include "DGtal/topology/CAdjacency.h"
50 #include "DGtal/kernel/sets/DigitalSetSelector.h"
52 
53 namespace DGtal
54 {
55 
57  // template class DomainAdjacency
72  template <typename TDomain, typename TAdjacency>
74  {
77  public:
78 
79  // Required as model of CAdjacency
80  typedef typename TDomain::Space Space;
81  typedef TAdjacency Adjacency;
82  typedef typename TDomain::Point Point;
83 
84  // Required as model of CDomainAdjacency
85  typedef TDomain Domain;
87 
88  // Required by CUndirectedSimpleLocalGraph
89  typedef Point Vertex;
90  typedef typename Space::Size Size;
91  typedef typename DigitalSetSelector< Domain,
93  template <typename Value> struct VertexMap {
94  typedef typename std::map<Vertex, Value> Type;
95  };
96 
97  // ----------------------- Standard services ------------------------------
98  public:
99 
109 
115 
120 
124  const Domain & domain() const;
125 
126  // ----------------------- Adjacency services -----------------------------
127  public:
128 
135  const Predicate & predicate() const;
136 
144  bool isAdjacentTo( const Point & p1, const Point & p2 ) const;
145 
153  bool isProperlyAdjacentTo( const Point & p1, const Point & p2 ) const;
154 
155 // ----------------------- Local graph services --------------------------
156 
161 
167  Size degree( const Vertex & v ) const;
168 
180  template <typename OutputIterator>
181  void
182  writeNeighbors( OutputIterator &it ,
183  const Vertex & v ) const;
184 
201  template <typename OutputIterator, typename VertexPredicate>
202  void
203  writeNeighbors( OutputIterator &it ,
204  const Vertex & v,
205  const VertexPredicate & pred) const;
206 
207  // ----------------------- Interface --------------------------------------
208  public:
209 
214  void selfDisplay ( std::ostream & out ) const;
215 
220  bool isValid() const;
221 
222  // ------------------------- Protected Datas ------------------------------
223  private:
224  // ------------------------- Private Datas --------------------------------
225  private:
230 
235 
236  // ------------------------- Hidden services ------------------------------
237  protected:
238 
244 
245  private:
246 
254 
255  // ------------------------- Internals ------------------------------------
256  private:
257 
258  }; // end of class DomainAdjacency
259 
260 
267  template <typename TDomain, typename TAdjacency>
268  std::ostream&
269  operator<< ( std::ostream & out,
270  const DomainAdjacency<TDomain, TAdjacency> & object );
271 
272 } // namespace DGtal
273 
274 
276 // Includes inline functions.
277 #include "DGtal/topology/DomainAdjacency.ih"
278 
279 // //
281 
282 #endif // !defined DomainAdjacency_h
283 
284 #undef DomainAdjacency_RECURSES
285 #endif // else defined(DomainAdjacency_RECURSES)
DGtal::DomainAdjacency::writeNeighbors
void writeNeighbors(OutputIterator &it, const Vertex &v) const
DGtal::DomainAdjacency::isValid
bool isValid() const
DGtal::DomainAdjacency::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CAdjacency< TAdjacency >))
DGtal::ConstAlias
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:187
DGtal::DomainAdjacency::VertexMap
Definition: DomainAdjacency.h:93
DGtal::DomainAdjacency::Adjacency
TAdjacency Adjacency
Definition: DomainAdjacency.h:81
DGtal::DigitalSetSelector
Aim: Automatically defines an adequate digital set type according to the hints given by the user.
Definition: DigitalSetSelector.h:89
DGtal::DomainAdjacency::domain
const Domain & domain() const
DGtal::DomainAdjacency::Predicate
functors::DomainPredicate< Domain > Predicate
Definition: DomainAdjacency.h:86
DGtal::DomainAdjacency::Space
TDomain::Space Space
Definition: DomainAdjacency.h:80
DGtal::DomainAdjacency::Size
Space::Size Size
Definition: DomainAdjacency.h:90
DGtal::SpaceND::Size
UnsignedInteger Size
Type used to represent sizes in the digital space.
Definition: SpaceND.h:107
DGtal::DomainAdjacency::isProperlyAdjacentTo
bool isProperlyAdjacentTo(const Point &p1, const Point &p2) const
DGtal::DomainAdjacency
Aim: Given a domain and an adjacency, limits the given adjacency to the specified domain for all adja...
Definition: DomainAdjacency.h:74
DGtal::SMALL_DS
@ SMALL_DS
Definition: DigitalSetSelector.h:60
DGtal::DomainAdjacency::isAdjacentTo
bool isAdjacentTo(const Point &p1, const Point &p2) const
DGtal::functors::DomainPredicate< Domain >
DGtal::DomainAdjacency::degree
Size degree(const Vertex &v) const
DGtal::DomainAdjacency::DomainAdjacency
DomainAdjacency(ConstAlias< Domain > aDomain, ConstAlias< Adjacency > adjacency)
DGtal::concepts::CDomain
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Definition: CDomain.h:130
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::DomainAdjacency::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::DomainAdjacency::myAdjacency
const Adjacency & myAdjacency
Definition: DomainAdjacency.h:234
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::DomainAdjacency::Domain
TDomain Domain
Definition: DomainAdjacency.h:85
DGtal::DomainAdjacency::bestCapacity
Size bestCapacity() const
DGtal::DomainAdjacency::Point
TDomain::Point Point
Definition: DomainAdjacency.h:82
DGtal::DomainAdjacency::writeNeighbors
void writeNeighbors(OutputIterator &it, const Vertex &v, const VertexPredicate &pred) const
DGtal::DomainAdjacency::predicate
const Predicate & predicate() const
DGtal::concepts::CAdjacency
Aim: The concept CAdjacency defines an elementary adjacency relation between points of a digital spac...
Definition: CAdjacency.h:100
DGtal::DomainAdjacency::myPred
Predicate myPred
Definition: DomainAdjacency.h:229
DGtal::HIGH_ITER_DS
@ HIGH_ITER_DS
Definition: DigitalSetSelector.h:62
DGtal::DomainAdjacency::VertexMap::Type
std::map< Vertex, Value > Type
Definition: DomainAdjacency.h:94
Space
SpaceND< 2 > Space
Definition: testSimpleRandomAccessRangeFromPoint.cpp:42
DGtal::DomainAdjacency::Vertex
Point Vertex
Definition: DomainAdjacency.h:89
Point
MyPointD Point
Definition: testClone2.cpp:383
DGtal::DomainAdjacency::DomainAdjacency
DomainAdjacency()
DGtal::DomainAdjacency::operator=
DomainAdjacency & operator=(const DomainAdjacency &other)
DGtal::DomainAdjacency::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CDomain< TDomain >))
DGtal::DomainAdjacency::DomainAdjacency
DomainAdjacency(const DomainAdjacency &other)
DGtal::DomainAdjacency::~DomainAdjacency
~DomainAdjacency()
DGtal::DomainAdjacency::VertexSet
DigitalSetSelector< Domain, SMALL_DS+HIGH_ITER_DS >::Type VertexSet
Definition: DomainAdjacency.h:92