Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2010-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 
0005 // This file was modified by Oracle on 2020.
0006 // Modifications copyright (c) 2020, Oracle and/or its affiliates.
0007 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0008 
0009 // Use, modification and distribution is subject to the Boost Software License,
0010 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0011 // http://www.boost.org/LICENSE_1_0.txt)
0012 
0013 #ifndef BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POINT_HPP
0014 #define BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POINT_HPP
0015 
0016 // Adapts Geometries from Boost.Polygon for usage in Boost.Geometry
0017 // boost::polygon::point_data -> boost::geometry::point
0018 
0019 
0020 #include <type_traits>
0021 
0022 #include <boost/polygon/polygon.hpp>
0023 
0024 #include <boost/geometry/core/access.hpp>
0025 #include <boost/geometry/core/cs.hpp>
0026 #include <boost/geometry/core/coordinate_dimension.hpp>
0027 #include <boost/geometry/core/coordinate_type.hpp>
0028 #include <boost/geometry/core/tags.hpp>
0029 
0030 
0031 namespace boost { namespace geometry
0032 {
0033 
0034 
0035 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0036 namespace traits
0037 {
0038 
0039 
0040 template <typename CoordinateType>
0041 struct tag<boost::polygon::point_data<CoordinateType> >
0042 {
0043     typedef point_tag type;
0044 };
0045 
0046 
0047 template <typename CoordinateType>
0048 struct coordinate_type<boost::polygon::point_data<CoordinateType> >
0049 {
0050     typedef CoordinateType type;
0051 };
0052 
0053 
0054 template <typename CoordinateType>
0055 struct coordinate_system<boost::polygon::point_data<CoordinateType> >
0056 {
0057     typedef cs::cartesian type;
0058 };
0059 
0060 
0061 template <typename CoordinateType>
0062 struct dimension<boost::polygon::point_data<CoordinateType> >
0063     : std::integral_constant<std::size_t, 2>
0064 {};
0065 
0066 
0067 template <typename CoordinateType>
0068 struct access<boost::polygon::point_data<CoordinateType>, 0>
0069 {
0070     typedef boost::polygon::point_data<CoordinateType> point_type;
0071 
0072     static inline CoordinateType get(point_type const& p)
0073     {
0074         return p.x();
0075     }
0076 
0077     static inline void set(point_type& p, CoordinateType const& value)
0078     {
0079         p.x(value);
0080     }
0081 };
0082 
0083 
0084 template <typename CoordinateType>
0085 struct access<boost::polygon::point_data<CoordinateType>, 1>
0086 {
0087     typedef boost::polygon::point_data<CoordinateType> point_type;
0088 
0089     static inline CoordinateType get(point_type const& p)
0090     {
0091         return p.y();
0092     }
0093 
0094     static inline void set(point_type& p, CoordinateType const& value)
0095     {
0096         p.y(value);
0097     }
0098 };
0099 
0100 
0101 } // namespace traits
0102 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
0103 
0104 
0105 }} // namespace boost::geometry
0106 
0107 
0108 #endif // BOOST_GEOMETRY_GEOMETRIES_ADAPTED_BOOST_POLYGON_POINT_HPP