Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:27

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 //
0003 // Copyright (c) 2008-2014 Bruno Lalande, Paris, France.
0004 // Copyright (c) 2008-2014 Barend Gehrels, Amsterdam, the Netherlands.
0005 // Copyright (c) 2009-2014 Mateusz Loskot, London, UK.
0006 
0007 // This file was modified by Oracle on 2014-2021.
0008 // Modifications copyright (c) 2014-2021, Oracle and/or its affiliates.
0009 
0010 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0011 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0012 
0013 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0014 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0015 
0016 // Use, modification and distribution is subject to the Boost Software License,
0017 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0018 // http://www.boost.org/LICENSE_1_0.txt)
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     // The following enum is used to fully instantiate the coordinate
0047     // system class; this is needed in order to check the units passed
0048     // to it for non-Cartesian coordinate systems.
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     /// BCCL macro to apply the Point concept
0074     BOOST_CONCEPT_USAGE(Point)
0075     {
0076         dimension_checker<Geometry, 0, ccount>::apply();
0077     }
0078 #endif
0079 };
0080 
0081 
0082 /*!
0083 \brief point concept (const version).
0084 
0085 \ingroup const_concepts
0086 
0087 \details The ConstPoint concept apply the same as the Point concept,
0088 but does not apply write access.
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     // The following enum is used to fully instantiate the coordinate
0100     // system class; this is needed in order to check the units passed
0101     // to it for non-Cartesian coordinate systems.
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     /// BCCL macro to apply the ConstPoint concept
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 }}} // namespace boost::geometry::concepts
0150 
0151 #endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_POINT_CONCEPT_HPP