envelope.hpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
  5. // This file was modified by Oracle on 2015, 2016, 2018, 2019.
  6. // Modifications copyright (c) 2015-2019, Oracle and/or its affiliates.
  7. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
  8. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
  9. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  10. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  11. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  12. // Distributed under the Boost Software License, Version 1.0.
  13. // (See accompanying file LICENSE_1_0.txt or copy at
  14. // http://www.boost.org/LICENSE_1_0.txt)
  15. #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_ENVELOPE_HPP
  16. #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_ENVELOPE_HPP
  17. #include <boost/geometry/srs/spheroid.hpp>
  18. #include <boost/geometry/strategies/geographic/envelope_segment.hpp>
  19. #include <boost/geometry/strategies/geographic/expand_segment.hpp>
  20. #include <boost/geometry/strategies/geographic/parameters.hpp>
  21. #include <boost/geometry/strategies/spherical/envelope.hpp>
  22. namespace boost { namespace geometry
  23. {
  24. namespace strategy { namespace envelope
  25. {
  26. template
  27. <
  28. typename FormulaPolicy = strategy::andoyer,
  29. typename Spheroid = geometry::srs::spheroid<double>,
  30. typename CalculationType = void
  31. >
  32. class geographic
  33. : public spherical<CalculationType>
  34. {
  35. public:
  36. typedef geographic_tag cs_tag;
  37. typedef Spheroid model_type;
  38. inline geographic()
  39. : m_spheroid()
  40. {}
  41. explicit inline geographic(Spheroid const& spheroid)
  42. : m_spheroid(spheroid)
  43. {}
  44. typedef geographic_segment
  45. <
  46. FormulaPolicy, Spheroid, CalculationType
  47. > element_envelope_strategy_type;
  48. inline element_envelope_strategy_type get_element_envelope_strategy() const
  49. {
  50. return element_envelope_strategy_type(m_spheroid);
  51. }
  52. typedef expand::geographic_segment
  53. <
  54. FormulaPolicy, Spheroid, CalculationType
  55. > element_expand_strategy_type;
  56. inline element_expand_strategy_type get_element_expand_strategy() const
  57. {
  58. return element_expand_strategy_type(m_spheroid);
  59. }
  60. template <typename Point1, typename Point2, typename Box>
  61. inline void apply(Point1 const& point1, Point2 const& point2, Box& box) const
  62. {
  63. geographic_segment
  64. <
  65. FormulaPolicy,
  66. Spheroid,
  67. CalculationType
  68. >(m_spheroid).apply(point1, point2, box);
  69. }
  70. private:
  71. Spheroid m_spheroid;
  72. };
  73. #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
  74. namespace services
  75. {
  76. template <typename Tag, typename CalculationType>
  77. struct default_strategy<Tag, geographic_tag, CalculationType>
  78. {
  79. typedef strategy::envelope::geographic
  80. <
  81. strategy::andoyer,
  82. geometry::srs::spheroid<double>,
  83. CalculationType
  84. > type;
  85. };
  86. }
  87. #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
  88. }} // namespace strategy::envelope
  89. }} //namepsace boost::geometry
  90. #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_ENVELOPE_HPP