annotate DEPENDENCIES/generic/include/boost/geometry/geometries/concepts/segment_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 #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_SEGMENT_CONCEPT_HPP
Chris@16 15 #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_SEGMENT_CONCEPT_HPP
Chris@16 16
Chris@16 17
Chris@16 18 #include <boost/concept_check.hpp>
Chris@16 19
Chris@16 20 #include <boost/geometry/geometries/concepts/point_concept.hpp>
Chris@16 21
Chris@16 22 #include <boost/geometry/core/access.hpp>
Chris@16 23 #include <boost/geometry/core/point_type.hpp>
Chris@16 24
Chris@16 25
Chris@16 26 namespace boost { namespace geometry { namespace concept
Chris@16 27 {
Chris@16 28
Chris@16 29
Chris@16 30 /*!
Chris@16 31 \brief Segment concept.
Chris@16 32 \ingroup concepts
Chris@16 33 \details Formal definition:
Chris@16 34 The segment concept is defined as following:
Chris@16 35 - there must be a specialization of traits::tag defining segment_tag as type
Chris@16 36 - there must be a specialization of traits::point_type to define the
Chris@16 37 underlying point type (even if it does not consist of points, it should define
Chris@16 38 this type, to indicate the points it can work with)
Chris@16 39 - there must be a specialization of traits::indexed_access, per index
Chris@16 40 and per dimension, with two functions:
Chris@16 41 - get to get a coordinate value
Chris@16 42 - set to set a coordinate value (this one is not checked for ConstSegment)
Chris@16 43
Chris@16 44 \note The segment concept is similar to the box concept, defining another tag.
Chris@16 45 However, the box concept assumes the index as min_corner, max_corner, while
Chris@16 46 for the segment concept there is no assumption.
Chris@16 47 */
Chris@16 48 template <typename Geometry>
Chris@16 49 class Segment
Chris@16 50 {
Chris@16 51 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
Chris@16 52 typedef typename point_type<Geometry>::type point_type;
Chris@16 53
Chris@16 54 BOOST_CONCEPT_ASSERT( (concept::Point<point_type>) );
Chris@16 55
Chris@16 56
Chris@16 57 template <size_t Index, size_t Dimension, size_t DimensionCount>
Chris@16 58 struct dimension_checker
Chris@16 59 {
Chris@16 60 static void apply()
Chris@16 61 {
Chris@16 62 Geometry* s = 0;
Chris@16 63 geometry::set<Index, Dimension>(*s, geometry::get<Index, Dimension>(*s));
Chris@16 64 dimension_checker<Index, Dimension + 1, DimensionCount>::apply();
Chris@16 65 }
Chris@16 66 };
Chris@16 67
Chris@16 68 template <size_t Index, size_t DimensionCount>
Chris@16 69 struct dimension_checker<Index, DimensionCount, DimensionCount>
Chris@16 70 {
Chris@16 71 static void apply() {}
Chris@16 72 };
Chris@16 73
Chris@16 74 public :
Chris@16 75
Chris@16 76 BOOST_CONCEPT_USAGE(Segment)
Chris@16 77 {
Chris@16 78 static const size_t n = dimension<point_type>::type::value;
Chris@16 79 dimension_checker<0, 0, n>::apply();
Chris@16 80 dimension_checker<1, 0, n>::apply();
Chris@16 81 }
Chris@16 82 #endif
Chris@16 83 };
Chris@16 84
Chris@16 85
Chris@16 86 /*!
Chris@16 87 \brief Segment concept (const version).
Chris@16 88 \ingroup const_concepts
Chris@16 89 \details The ConstSegment concept verifies the same as the Segment concept,
Chris@16 90 but does not verify write access.
Chris@16 91 */
Chris@16 92 template <typename Geometry>
Chris@16 93 class ConstSegment
Chris@16 94 {
Chris@16 95 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
Chris@16 96 typedef typename point_type<Geometry>::type point_type;
Chris@16 97 typedef typename coordinate_type<Geometry>::type coordinate_type;
Chris@16 98
Chris@16 99 BOOST_CONCEPT_ASSERT( (concept::ConstPoint<point_type>) );
Chris@16 100
Chris@16 101
Chris@16 102 template <size_t Index, size_t Dimension, size_t DimensionCount>
Chris@16 103 struct dimension_checker
Chris@16 104 {
Chris@16 105 static void apply()
Chris@16 106 {
Chris@16 107 const Geometry* s = 0;
Chris@16 108 coordinate_type coord(geometry::get<Index, Dimension>(*s));
Chris@16 109 boost::ignore_unused_variable_warning(coord);
Chris@16 110 dimension_checker<Index, Dimension + 1, DimensionCount>::apply();
Chris@16 111 }
Chris@16 112 };
Chris@16 113
Chris@16 114 template <size_t Index, size_t DimensionCount>
Chris@16 115 struct dimension_checker<Index, DimensionCount, DimensionCount>
Chris@16 116 {
Chris@16 117 static void apply() {}
Chris@16 118 };
Chris@16 119
Chris@16 120 public :
Chris@16 121
Chris@16 122 BOOST_CONCEPT_USAGE(ConstSegment)
Chris@16 123 {
Chris@16 124 static const size_t n = dimension<point_type>::type::value;
Chris@16 125 dimension_checker<0, 0, n>::apply();
Chris@16 126 dimension_checker<1, 0, n>::apply();
Chris@16 127 }
Chris@16 128 #endif
Chris@16 129 };
Chris@16 130
Chris@16 131
Chris@16 132 }}} // namespace boost::geometry::concept
Chris@16 133
Chris@16 134
Chris@16 135 #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_SEGMENT_CONCEPT_HPP