1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
3// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
4// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
5// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
6
7// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
9
10// Use, modification and distribution is subject to the Boost Software License,
11// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12// http://www.boost.org/LICENSE_1_0.txt)
13
14
15#ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_RING_CONCEPT_HPP
16#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_RING_CONCEPT_HPP
17
18
19#include <boost/concept_check.hpp>
20#include <boost/range/concepts.hpp>
21#include <boost/type_traits/remove_const.hpp>
22
23#include <boost/geometry/core/access.hpp>
24#include <boost/geometry/core/mutable_range.hpp>
25#include <boost/geometry/core/point_type.hpp>
26
27#include <boost/geometry/geometries/concepts/point_concept.hpp>
28
29
30namespace boost { namespace geometry { namespace concept
31{
32
33
34/*!
35\brief ring concept
36\ingroup concepts
37\par Formal definition:
38The ring concept is defined as following:
39- there must be a specialization of traits::tag defining ring_tag as type
40- it must behave like a Boost.Range
41- there can optionally be a specialization of traits::point_order defining the
42 order or orientation of its points, clockwise or counterclockwise.
43- it must implement a std::back_insert_iterator
44 (This is the same as the for the concept Linestring, and described there)
45
46\note to fulfill the concepts, no traits class has to be specialized to
47define the point type.
48*/
49template <typename Geometry>
50class Ring
51{
52#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
53 typedef typename point_type<Geometry>::type point_type;
54
55 BOOST_CONCEPT_ASSERT( (concept::Point<point_type>) );
56 BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
57
58public :
59
60 BOOST_CONCEPT_USAGE(Ring)
61 {
62 Geometry* ring = 0;
63 traits::clear<Geometry>::apply(*ring);
64 traits::resize<Geometry>::apply(*ring, 0);
65 point_type* point = 0;
66 traits::push_back<Geometry>::apply(*ring, *point);
67 }
68#endif
69};
70
71
72/*!
73\brief (linear) ring concept (const version)
74\ingroup const_concepts
75\details The ConstLinearRing concept check the same as the Geometry concept,
76but does not check write access.
77*/
78template <typename Geometry>
79class ConstRing
80{
81#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
82 typedef typename point_type<Geometry>::type point_type;
83
84 BOOST_CONCEPT_ASSERT( (concept::ConstPoint<point_type>) );
85 BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
86
87
88public :
89
90 BOOST_CONCEPT_USAGE(ConstRing)
91 {
92 }
93#endif
94};
95
96}}} // namespace boost::geometry::concept
97
98
99#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_RING_CONCEPT_HPP
100

source code of boost/boost/geometry/geometries/concepts/ring_concept.hpp