Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:50:15

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2015-2022, Oracle and/or its affiliates.
0004 
0005 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
0006 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0007 
0008 // Licensed under the Boost Software License version 1.0.
0009 // http://www.boost.org/users/license.html
0010 
0011 #ifndef BOOST_GEOMETRY_GEOMETRIES_HELPER_GEOMETRY_HPP
0012 #define BOOST_GEOMETRY_GEOMETRIES_HELPER_GEOMETRY_HPP
0013 
0014 
0015 #include <boost/geometry/core/closure.hpp>
0016 #include <boost/geometry/core/coordinate_dimension.hpp>
0017 #include <boost/geometry/core/coordinate_type.hpp>
0018 #include <boost/geometry/core/cs.hpp>
0019 #include <boost/geometry/core/point_order.hpp>
0020 #include <boost/geometry/core/point_type.hpp>
0021 #include <boost/geometry/core/tag.hpp>
0022 #include <boost/geometry/core/tags.hpp>
0023 
0024 #include <boost/geometry/geometries/box.hpp>
0025 #include <boost/geometry/geometries/linestring.hpp>
0026 #include <boost/geometry/geometries/point.hpp>
0027 #include <boost/geometry/geometries/ring.hpp>
0028 
0029 #include <boost/geometry/algorithms/not_implemented.hpp>
0030 
0031 
0032 namespace boost { namespace geometry
0033 {
0034 
0035 namespace detail { namespace helper_geometries
0036 {
0037 
0038 template
0039 <
0040     typename Point,
0041     typename NewCoordinateType,
0042     typename NewUnits,
0043     typename CS_Tag = cs_tag_t<Point>
0044 >
0045 struct helper_point
0046 {
0047     typedef model::point
0048         <
0049             NewCoordinateType,
0050             dimension<Point>::value,
0051             cs_tag_to_coordinate_system_t<NewUnits, CS_Tag>
0052         > type;
0053 };
0054 
0055 
0056 }} // detail::helper_geometries
0057 
0058 
0059 namespace detail_dispatch
0060 {
0061 
0062 
0063 template
0064 <
0065     typename Geometry,
0066     typename NewCoordinateType,
0067     typename NewUnits,
0068     typename Tag = tag_t<Geometry>
0069 >
0070 struct helper_geometry : not_implemented<Geometry>
0071 {};
0072 
0073 
0074 template <typename Point, typename NewCoordinateType, typename NewUnits>
0075 struct helper_geometry<Point, NewCoordinateType, NewUnits, point_tag>
0076 {
0077     using type = typename detail::helper_geometries::helper_point
0078         <
0079             Point, NewCoordinateType, NewUnits
0080         >::type;
0081 };
0082 
0083 
0084 template <typename Box, typename NewCoordinateType, typename NewUnits>
0085 struct helper_geometry<Box, NewCoordinateType, NewUnits, box_tag>
0086 {
0087     using type = model::box
0088         <
0089             typename helper_geometry
0090                 <
0091                     point_type_t<Box>, NewCoordinateType, NewUnits
0092                 >::type
0093         >;
0094 };
0095 
0096 
0097 template <typename Linestring, typename NewCoordinateType, typename NewUnits>
0098 struct helper_geometry<Linestring, NewCoordinateType, NewUnits, linestring_tag>
0099 {
0100     using type = model::linestring
0101         <
0102             typename helper_geometry
0103                 <
0104                     point_type_t<Linestring>, NewCoordinateType, NewUnits
0105                 >::type
0106         >;
0107 };
0108 
0109 template <typename Ring, typename NewCoordinateType, typename NewUnits>
0110 struct helper_geometry<Ring, NewCoordinateType, NewUnits, ring_tag>
0111 {
0112     using type = model::ring
0113         <
0114             typename helper_geometry
0115                 <
0116                     point_type_t<Ring>, NewCoordinateType, NewUnits
0117                 >::type,
0118             point_order<Ring>::value != counterclockwise,
0119             closure<Ring>::value != open
0120         >;
0121 };
0122 
0123 
0124 } // detail_dispatch
0125 
0126 
0127 // Meta-function that provides a new helper geometry of the same kind as
0128 // the input geometry and the same coordinate system type,
0129 // but with a possibly different coordinate type and coordinate system units
0130 template
0131 <
0132     typename Geometry,
0133     typename NewCoordinateType = coordinate_type_t<Geometry>,
0134     typename NewUnits = typename detail::cs_angular_units<Geometry>::type
0135 >
0136 struct helper_geometry
0137 {
0138     using type = typename detail_dispatch::helper_geometry
0139         <
0140             Geometry, NewCoordinateType, NewUnits
0141         >::type;
0142 };
0143 
0144 
0145 }} // namespace boost::geometry
0146 
0147 #endif // BOOST_GEOMETRY_GEOMETRIES_HELPER_GEOMETRY_HPP