Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:47

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2019-2021, Oracle and/or its affiliates.
0004 
0005 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0006 
0007 // Licensed under the Boost Software License version 1.0.
0008 // http://www.boost.org/users/license.html
0009 
0010 #ifndef BOOST_GEOMETRY_STRATEGIES_IO_GEOGRAPHIC_HPP
0011 #define BOOST_GEOMETRY_STRATEGIES_IO_GEOGRAPHIC_HPP
0012 
0013 
0014 #include <boost/geometry/strategies/detail.hpp>
0015 #include <boost/geometry/strategies/io/services.hpp>
0016 
0017 #include <boost/geometry/strategies/geographic/point_order.hpp>
0018 #include <boost/geometry/strategies/geographic/point_in_poly_winding.hpp>
0019 #include <boost/geometry/strategies/spherical/point_in_point.hpp>
0020 
0021 
0022 namespace boost { namespace geometry
0023 {
0024 
0025 namespace strategies { namespace io
0026 {
0027 
0028 template
0029     <
0030         typename FormulaPolicy = strategy::andoyer,
0031         typename Spheroid = srs::spheroid<double>,
0032         typename CalculationType = void
0033     >
0034 class geographic
0035     : public strategies::detail::geographic_base<Spheroid>
0036 {
0037     using base_t = strategies::detail::geographic_base<Spheroid>;
0038 
0039 public:
0040     geographic() = default;
0041 
0042     explicit geographic(Spheroid const& spheroid)
0043         : base_t(spheroid)
0044     {}
0045 
0046     auto point_order() const
0047     {
0048         return strategy::point_order::geographic
0049                 <
0050                     FormulaPolicy, Spheroid, CalculationType
0051                 >(base_t::m_spheroid);
0052     }
0053 
0054     template <typename Geometry1, typename Geometry2>
0055     static auto relate(Geometry1 const&, Geometry2 const&,
0056                        std::enable_if_t
0057                             <
0058                                 util::is_pointlike<Geometry1>::value
0059                              && util::is_pointlike<Geometry2>::value
0060                             > * = nullptr)
0061     {
0062         return strategy::within::spherical_point_point();
0063     }
0064 
0065     template <typename Geometry1, typename Geometry2>
0066     auto relate(Geometry1 const&, Geometry2 const&,
0067                 std::enable_if_t
0068                     <
0069                         util::is_pointlike<Geometry1>::value
0070                         && ( util::is_linear<Geometry2>::value
0071                         || util::is_polygonal<Geometry2>::value )
0072                     > * = nullptr) const
0073     {
0074         return strategy::within::geographic_winding
0075             <
0076                 void, void,
0077                 FormulaPolicy, Spheroid, CalculationType
0078             >(base_t::m_spheroid);
0079     }
0080 };
0081 
0082 namespace services
0083 {
0084 
0085 template <typename Geometry>
0086 struct default_strategy<Geometry, geographic_tag>
0087 {
0088     typedef geographic<> type;
0089 };
0090 
0091 } // namespace services
0092 
0093 }} // namespace strategies::io
0094 
0095 }} // namespace boost::geometry
0096 
0097 #endif // BOOST_GEOMETRY_STRATEGIES_IO_GEOGRAPHIC_HPP