envelope.hpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 Spheroid model_type;
  37. inline geographic()
  38. : m_spheroid()
  39. {}
  40. explicit inline geographic(Spheroid const& spheroid)
  41. : m_spheroid(spheroid)
  42. {}
  43. typedef geographic_segment
  44. <
  45. FormulaPolicy, Spheroid, CalculationType
  46. > element_envelope_strategy_type;
  47. inline element_envelope_strategy_type get_element_envelope_strategy() const
  48. {
  49. return element_envelope_strategy_type(m_spheroid);
  50. }
  51. typedef expand::geographic_segment
  52. <
  53. FormulaPolicy, Spheroid, CalculationType
  54. > element_expand_strategy_type;
  55. inline element_expand_strategy_type get_element_expand_strategy() const
  56. {
  57. return element_expand_strategy_type(m_spheroid);
  58. }
  59. template <typename Point1, typename Point2, typename Box>
  60. inline void apply(Point1 const& point1, Point2 const& point2, Box& box) const
  61. {
  62. geographic_segment
  63. <
  64. FormulaPolicy,
  65. Spheroid,
  66. CalculationType
  67. >(m_spheroid).apply(point1, point2, box);
  68. }
  69. private:
  70. Spheroid m_spheroid;
  71. };
  72. #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
  73. namespace services
  74. {
  75. template <typename Tag, typename CalculationType>
  76. struct default_strategy<Tag, geographic_tag, CalculationType>
  77. {
  78. typedef strategy::envelope::geographic
  79. <
  80. strategy::andoyer,
  81. geometry::srs::spheroid<double>,
  82. CalculationType
  83. > type;
  84. };
  85. }
  86. #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
  87. }} // namespace strategy::envelope
  88. }} //namepsace boost::geometry
  89. #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_ENVELOPE_HPP