Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
0006 
0007 // This file was modified by Oracle on 2020.
0008 // Modifications copyright (c) 2020, Oracle and/or its affiliates.
0009 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0010 
0011 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
0012 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
0013 
0014 // Use, modification and distribution is subject to the Boost Software License,
0015 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0016 // http://www.boost.org/LICENSE_1_0.txt)
0017 
0018 #ifndef BOOST_GEOMETRY_GEOMETRIES_REGISTER_POINT_HPP
0019 #define BOOST_GEOMETRY_GEOMETRIES_REGISTER_POINT_HPP
0020 
0021 #include <boost/geometry/core/access.hpp>
0022 #include <boost/geometry/core/coordinate_dimension.hpp>
0023 #include <boost/geometry/core/coordinate_system.hpp>
0024 #include <boost/geometry/core/coordinate_type.hpp>
0025 #include <boost/geometry/core/cs.hpp>
0026 
0027 #include <cstddef>
0028 #include <type_traits>
0029 
0030 #ifndef DOXYGEN_NO_SPECIALIZATIONS
0031 
0032 // Starting point, specialize basic traits necessary to register a point
0033 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, Dim, CoordinateType, CoordinateSystem) \
0034     template<> struct tag<Point> { typedef point_tag type; }; \
0035     template<> struct dimension<Point> : std::integral_constant<std::size_t, Dim> {}; \
0036     template<> struct coordinate_type<Point> { typedef CoordinateType type; }; \
0037     template<> struct coordinate_system<Point> { typedef CoordinateSystem type; };
0038 
0039 // Specialize access class per dimension
0040 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS(Point, Dim, CoordinateType, Get, Set) \
0041     template<> struct access<Point, Dim> \
0042     { \
0043         static inline CoordinateType get(Point const& p) { return p. Get; } \
0044         static inline void set(Point& p, CoordinateType const& value) { p. Set = value; } \
0045     };
0046 
0047 // Const version
0048 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_CONST(Point, Dim, CoordinateType, Get) \
0049     template<> struct access<Point, Dim> \
0050     { \
0051         static inline CoordinateType get(Point const& p) { return p. Get; } \
0052     };
0053 
0054 
0055 // Getter/setter version
0056 #define BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_GET_SET(Point, Dim, CoordinateType, Get, Set) \
0057     template<> struct access<Point, Dim> \
0058     { \
0059         static inline CoordinateType get(Point const& p) \
0060         { return  p. Get (); } \
0061         static inline void set(Point& p, CoordinateType const& value) \
0062         { p. Set ( value ); } \
0063     };
0064 
0065 #endif // DOXYGEN_NO_SPECIALIZATIONS
0066 
0067 
0068 /*!
0069 \brief \brief_macro{2D point type}
0070 \ingroup register
0071 \details \details_macro{BOOST_GEOMETRY_REGISTER_POINT_2D, two-dimensional point type}
0072 \param Point \param_macro_type{Point}
0073 \param CoordinateType \param_macro_coortype{point}
0074 \param CoordinateSystem \param_macro_coorsystem
0075 \param Field0 \param_macro_member{\macro_x}
0076 \param Field1 \param_macro_member{\macro_y}
0077 
0078 \qbk{[include reference/geometries/register/point.qbk]}
0079 */
0080 #define BOOST_GEOMETRY_REGISTER_POINT_2D(Point, CoordinateType, CoordinateSystem, Field0, Field1) \
0081 namespace boost { namespace geometry { namespace traits {  \
0082     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, 2, CoordinateType, CoordinateSystem) \
0083     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS(Point, 0, CoordinateType, Field0, Field0) \
0084     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS(Point, 1, CoordinateType, Field1, Field1) \
0085 }}}
0086 
0087 /*!
0088 \brief \brief_macro{3D point type}
0089 \ingroup register
0090 \details \details_macro{BOOST_GEOMETRY_REGISTER_POINT_3D, three-dimensional point type}
0091 \param Point \param_macro_type{Point}
0092 \param CoordinateType \param_macro_coortype{point}
0093 \param CoordinateSystem \param_macro_coorsystem
0094 \param Field0 \param_macro_member{\macro_x}
0095 \param Field1 \param_macro_member{\macro_y}
0096 \param Field2 \param_macro_member{\macro_z}
0097 */
0098 #define BOOST_GEOMETRY_REGISTER_POINT_3D(Point, CoordinateType, CoordinateSystem, Field0, Field1, Field2) \
0099 namespace boost { namespace geometry { namespace traits {  \
0100     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, 3, CoordinateType, CoordinateSystem) \
0101     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS(Point, 0, CoordinateType, Field0, Field0) \
0102     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS(Point, 1, CoordinateType, Field1, Field1) \
0103     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS(Point, 2, CoordinateType, Field2, Field2) \
0104 }}}
0105 
0106 /*!
0107 \brief \brief_macro{2D point type} \brief_macro_const
0108 \ingroup register
0109 \details \details_macro{BOOST_GEOMETRY_REGISTER_POINT_2D_CONST, two-dimensional point type}. \details_macro_const
0110 \param Point \param_macro_type{Point}
0111 \param CoordinateType \param_macro_coortype{point}
0112 \param CoordinateSystem \param_macro_coorsystem
0113 \param Field0 \param_macro_member{\macro_x}
0114 \param Field1 \param_macro_member{\macro_y}
0115 */
0116 #define BOOST_GEOMETRY_REGISTER_POINT_2D_CONST(Point, CoordinateType, CoordinateSystem, Field0, Field1) \
0117 namespace boost { namespace geometry { namespace traits {  \
0118     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, 2, CoordinateType, CoordinateSystem) \
0119     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_CONST(Point, 0, CoordinateType, Field0) \
0120     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_CONST(Point, 1, CoordinateType, Field1) \
0121 }}}
0122 
0123 /*!
0124 \brief \brief_macro{3D point type} \brief_macro_const
0125 \ingroup register
0126 \details \details_macro{BOOST_GEOMETRY_REGISTER_POINT_3D_CONST, three-dimensional point type}. \details_macro_const
0127 \param Point \param_macro_type{Point}
0128 \param CoordinateType \param_macro_coortype{point}
0129 \param CoordinateSystem \param_macro_coorsystem
0130 \param Field0 \param_macro_member{\macro_x}
0131 \param Field1 \param_macro_member{\macro_y}
0132 \param Field2 \param_macro_member{\macro_z}
0133 */
0134 #define BOOST_GEOMETRY_REGISTER_POINT_3D_CONST(Point, CoordinateType, CoordinateSystem, Field0, Field1, Field2) \
0135 namespace boost { namespace geometry { namespace traits {  \
0136     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, 3, CoordinateType, CoordinateSystem) \
0137     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_CONST(Point, 0, CoordinateType, Field0) \
0138     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_CONST(Point, 1, CoordinateType, Field1) \
0139     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_CONST(Point, 2, CoordinateType, Field2) \
0140 }}}
0141 
0142 /*!
0143 \brief \brief_macro{2D point type} \brief_macro_getset
0144 \ingroup register
0145 \details \details_macro{BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET, two-dimensional point type}. \details_macro_getset
0146 \param Point \param_macro_type{Point}
0147 \param CoordinateType \param_macro_coortype{point}
0148 \param CoordinateSystem \param_macro_coorsystem
0149 \param Get0 \param_macro_getset{get, \macro_x}
0150 \param Get1 \param_macro_getset{get, \macro_y}
0151 \param Set0 \param_macro_getset{set, \macro_x}
0152 \param Set1 \param_macro_getset{set, \macro_y}
0153 */
0154 #define BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET(Point, CoordinateType, CoordinateSystem, Get0, Get1, Set0, Set1) \
0155 namespace boost { namespace geometry { namespace traits {  \
0156     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, 2, CoordinateType, CoordinateSystem) \
0157     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_GET_SET(Point, 0, CoordinateType, Get0, Set0) \
0158     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_GET_SET(Point, 1, CoordinateType, Get1, Set1) \
0159 }}}
0160 
0161 /*!
0162 \brief \brief_macro{3D point type} \brief_macro_getset
0163 \ingroup register
0164 \details \details_macro{BOOST_GEOMETRY_REGISTER_POINT_3D_GET_SET, three-dimensional point type}. \details_macro_getset
0165 \param Point \param_macro_type{Point}
0166 \param CoordinateType \param_macro_coortype{point}
0167 \param CoordinateSystem \param_macro_coorsystem
0168 \param Get0 \param_macro_getset{get, \macro_x}
0169 \param Get1 \param_macro_getset{get, \macro_y}
0170 \param Get2 \param_macro_getset{get, \macro_z}
0171 \param Set0 \param_macro_getset{set, \macro_x}
0172 \param Set1 \param_macro_getset{set, \macro_y}
0173 \param Set2 \param_macro_getset{set, \macro_z}
0174 */
0175 #define BOOST_GEOMETRY_REGISTER_POINT_3D_GET_SET(Point, CoordinateType, CoordinateSystem, Get0, Get1, Get2, Set0, Set1, Set2) \
0176 namespace boost { namespace geometry { namespace traits {  \
0177     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(Point, 3, CoordinateType, CoordinateSystem) \
0178     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_GET_SET(Point, 0, CoordinateType, Get0, Set0) \
0179     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_GET_SET(Point, 1, CoordinateType, Get1, Set1) \
0180     BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_ACCESS_GET_SET(Point, 2, CoordinateType, Get2, Set2) \
0181 }}}
0182 
0183 #endif // BOOST_GEOMETRY_GEOMETRIES_REGISTER_POINT_HPP