io.hpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // Boost.Geometry
  2. // Copyright (c) 2019, Oracle and/or its affiliates.
  3. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  4. // Licensed under the Boost Software License version 1.0.
  5. // http://www.boost.org/users/license.html
  6. #ifndef BOOST_GEOMETRY_EXTENSIONS_STRATEGIES_GEOGRAPHIC_IO_HPP
  7. #define BOOST_GEOMETRY_EXTENSIONS_STRATEGIES_GEOGRAPHIC_IO_HPP
  8. #include <boost/geometry/strategies/io.hpp>
  9. #include <boost/geometry/strategies/geographic/point_order.hpp>
  10. #include <boost/geometry/strategies/geographic/point_in_poly_winding.hpp>
  11. namespace boost { namespace geometry
  12. {
  13. namespace strategy { namespace io
  14. {
  15. template
  16. <
  17. typename FormulaPolicy = strategy::andoyer,
  18. typename Spheroid = srs::spheroid<double>,
  19. typename CalculationType = void
  20. >
  21. struct geographic
  22. {
  23. typedef strategy::point_order::geographic
  24. <
  25. FormulaPolicy,
  26. Spheroid,
  27. CalculationType
  28. > point_order_strategy_type;
  29. point_order_strategy_type get_point_order_strategy() const
  30. {
  31. return point_order_strategy_type(m_spheroid);
  32. }
  33. template <typename Geometry1, typename Geometry2>
  34. struct point_in_geometry_strategy
  35. {
  36. typedef strategy::within::geographic_winding
  37. <
  38. typename point_type<Geometry1>::type,
  39. typename point_type<Geometry2>::type,
  40. FormulaPolicy,
  41. Spheroid,
  42. CalculationType
  43. > type;
  44. };
  45. template <typename Geometry1, typename Geometry2>
  46. typename point_in_geometry_strategy<Geometry1, Geometry2>::type
  47. get_point_in_geometry_strategy() const
  48. {
  49. typedef typename point_in_geometry_strategy
  50. <
  51. Geometry1, Geometry2
  52. >::type strategy_type;
  53. return strategy_type(m_spheroid);
  54. }
  55. geographic()
  56. {}
  57. geographic(Spheroid const& spheroid)
  58. : m_spheroid(spheroid)
  59. {}
  60. private:
  61. Spheroid m_spheroid;
  62. };
  63. namespace services
  64. {
  65. template <>
  66. struct default_strategy<geographic_tag>
  67. {
  68. typedef geographic<> type;
  69. };
  70. } // namespace services
  71. }} // namespace strategy::io
  72. }} // namespace boost::geometry
  73. #endif // BOOST_GEOMETRY_EXTENSIONS_STRATEGIES_GEOGRAPHIC_IO_HPP