File indexing completed on 2025-01-18 09:35:27
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POINT_CONCEPT_HPP
0021 #define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POINT_CONCEPT_HPP
0022
0023 #include <cstddef>
0024
0025 #include <boost/concept_check.hpp>
0026 #include <boost/core/ignore_unused.hpp>
0027
0028 #include <boost/geometry/core/access.hpp>
0029 #include <boost/geometry/core/coordinate_dimension.hpp>
0030 #include <boost/geometry/core/coordinate_system.hpp>
0031
0032 #include <boost/geometry/geometries/concepts/concept_type.hpp>
0033
0034
0035 namespace boost { namespace geometry { namespace concepts
0036 {
0037
0038 template <typename Geometry>
0039 class Point
0040 {
0041 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
0042
0043 typedef typename coordinate_type<Geometry>::type ctype;
0044 typedef typename coordinate_system<Geometry>::type csystem;
0045
0046
0047
0048
0049 enum { cs_check = sizeof(csystem) };
0050
0051 enum { ccount = dimension<Geometry>::value };
0052
0053 template <typename P, std::size_t Dimension, std::size_t DimensionCount>
0054 struct dimension_checker
0055 {
0056 static void apply()
0057 {
0058 P* p = 0;
0059 geometry::set<Dimension>(*p, geometry::get<Dimension>(*p));
0060 dimension_checker<P, Dimension+1, DimensionCount>::apply();
0061 }
0062 };
0063
0064
0065 template <typename P, std::size_t DimensionCount>
0066 struct dimension_checker<P, DimensionCount, DimensionCount>
0067 {
0068 static void apply() {}
0069 };
0070
0071 public:
0072
0073
0074 BOOST_CONCEPT_USAGE(Point)
0075 {
0076 dimension_checker<Geometry, 0, ccount>::apply();
0077 }
0078 #endif
0079 };
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091 template <typename Geometry>
0092 class ConstPoint
0093 {
0094 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
0095
0096 typedef typename coordinate_type<Geometry>::type ctype;
0097 typedef typename coordinate_system<Geometry>::type csystem;
0098
0099
0100
0101
0102 enum { cs_check = sizeof(csystem) };
0103
0104 enum { ccount = dimension<Geometry>::value };
0105
0106 template <typename P, std::size_t Dimension, std::size_t DimensionCount>
0107 struct dimension_checker
0108 {
0109 static void apply()
0110 {
0111 const P* p = 0;
0112 ctype coord(geometry::get<Dimension>(*p));
0113 boost::ignore_unused(p, coord);
0114 dimension_checker<P, Dimension+1, DimensionCount>::apply();
0115 }
0116 };
0117
0118
0119 template <typename P, std::size_t DimensionCount>
0120 struct dimension_checker<P, DimensionCount, DimensionCount>
0121 {
0122 static void apply() {}
0123 };
0124
0125 public:
0126
0127
0128 BOOST_CONCEPT_USAGE(ConstPoint)
0129 {
0130 dimension_checker<Geometry, 0, ccount>::apply();
0131 }
0132 #endif
0133 };
0134
0135
0136 template <typename Geometry>
0137 struct concept_type<Geometry, point_tag>
0138 {
0139 using type = Point<Geometry>;
0140 };
0141
0142 template <typename Geometry>
0143 struct concept_type<Geometry const, point_tag>
0144 {
0145 using type = ConstPoint<Geometry>;
0146 };
0147
0148
0149 }}}
0150
0151 #endif