annotate DEPENDENCIES/generic/include/boost/geometry/geometries/concepts/linestring_concept.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost.Geometry (aka GGL, Generic Geometry Library)
Chris@16 2
Chris@16 3 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
Chris@16 4 // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
Chris@16 5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
Chris@16 6
Chris@16 7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
Chris@16 8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
Chris@16 9
Chris@16 10 // Use, modification and distribution is subject to the Boost Software License,
Chris@16 11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 12 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 13
Chris@16 14
Chris@16 15 #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_LINESTRING_CONCEPT_HPP
Chris@16 16 #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_LINESTRING_CONCEPT_HPP
Chris@16 17
Chris@16 18
Chris@16 19 #include <boost/concept_check.hpp>
Chris@16 20 #include <boost/range/concepts.hpp>
Chris@16 21 #include <boost/type_traits/remove_const.hpp>
Chris@16 22
Chris@16 23 #include <boost/geometry/core/access.hpp>
Chris@16 24 #include <boost/geometry/core/mutable_range.hpp>
Chris@16 25 #include <boost/geometry/core/point_type.hpp>
Chris@16 26
Chris@16 27 #include <boost/geometry/geometries/concepts/point_concept.hpp>
Chris@16 28
Chris@16 29
Chris@16 30
Chris@16 31 namespace boost { namespace geometry { namespace concept
Chris@16 32 {
Chris@16 33
Chris@16 34
Chris@16 35 /*!
Chris@16 36 \brief Linestring concept
Chris@16 37 \ingroup concepts
Chris@16 38 \par Formal definition:
Chris@16 39 The linestring concept is defined as following:
Chris@16 40 - there must be a specialization of traits::tag defining linestring_tag as type
Chris@16 41 - it must behave like a Boost.Range
Chris@16 42 - it must implement a std::back_insert_iterator
Chris@16 43 - either by implementing push_back
Chris@16 44 - or by specializing std::back_insert_iterator
Chris@16 45
Chris@16 46 \note to fulfill the concepts, no traits class has to be specialized to
Chris@16 47 define the point type.
Chris@16 48
Chris@16 49 \par Example:
Chris@16 50
Chris@16 51 A custom linestring, defining the necessary specializations to fulfill to the concept.
Chris@16 52
Chris@16 53 Suppose that the following linestring is defined:
Chris@16 54 \dontinclude doxygen_5.cpp
Chris@16 55 \skip custom_linestring1
Chris@16 56 \until };
Chris@16 57
Chris@16 58 It can then be adapted to the concept as following:
Chris@16 59 \dontinclude doxygen_5.cpp
Chris@16 60 \skip adapt custom_linestring1
Chris@16 61 \until }}
Chris@16 62
Chris@16 63 \note
Chris@16 64 - There is also the registration macro BOOST_GEOMETRY_REGISTER_LINESTRING
Chris@16 65 - For registration of std::vector<P> (and deque, and list) it is enough to
Chris@16 66 include the header-file geometries/adapted/std_as_linestring.hpp. That registers
Chris@16 67 a vector as a linestring (so it cannot be registered as a linear ring then,
Chris@16 68 in the same source code).
Chris@16 69
Chris@16 70
Chris@16 71 */
Chris@16 72
Chris@16 73 template <typename Geometry>
Chris@16 74 class Linestring
Chris@16 75 {
Chris@16 76 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
Chris@16 77 typedef typename point_type<Geometry>::type point_type;
Chris@16 78
Chris@16 79 BOOST_CONCEPT_ASSERT( (concept::Point<point_type>) );
Chris@16 80 BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
Chris@16 81
Chris@16 82 public :
Chris@16 83
Chris@16 84 BOOST_CONCEPT_USAGE(Linestring)
Chris@16 85 {
Chris@16 86 Geometry* ls = 0;
Chris@16 87 traits::clear<Geometry>::apply(*ls);
Chris@16 88 traits::resize<Geometry>::apply(*ls, 0);
Chris@16 89 point_type* point = 0;
Chris@16 90 traits::push_back<Geometry>::apply(*ls, *point);
Chris@16 91 }
Chris@16 92 #endif
Chris@16 93 };
Chris@16 94
Chris@16 95
Chris@16 96 /*!
Chris@16 97 \brief Linestring concept (const version)
Chris@16 98 \ingroup const_concepts
Chris@16 99 \details The ConstLinestring concept check the same as the Linestring concept,
Chris@16 100 but does not check write access.
Chris@16 101 */
Chris@16 102 template <typename Geometry>
Chris@16 103 class ConstLinestring
Chris@16 104 {
Chris@16 105 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
Chris@16 106 typedef typename point_type<Geometry>::type point_type;
Chris@16 107
Chris@16 108 BOOST_CONCEPT_ASSERT( (concept::ConstPoint<point_type>) );
Chris@16 109 //BOOST_CONCEPT_ASSERT( (boost::RandomAccessRangeConcept<Geometry>) );
Chris@16 110 // Relaxed the concept.
Chris@16 111 BOOST_CONCEPT_ASSERT( (boost::ForwardRangeConcept<Geometry>) );
Chris@16 112
Chris@16 113
Chris@16 114 public :
Chris@16 115
Chris@16 116 BOOST_CONCEPT_USAGE(ConstLinestring)
Chris@16 117 {
Chris@16 118 }
Chris@16 119 #endif
Chris@16 120 };
Chris@16 121
Chris@16 122 }}} // namespace boost::geometry::concept
Chris@16 123
Chris@16 124
Chris@16 125 #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_LINESTRING_CONCEPT_HPP