expand_segment.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. // Copyright (c) 2014-2015 Samuel Debionne, Grenoble, France.
  6. // This file was modified by Oracle on 2015, 2016, 2017, 2018.
  7. // Modifications copyright (c) 2015-2018, Oracle and/or its affiliates.
  8. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
  9. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
  10. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  11. // Distributed under the Boost Software License, Version 1.0.
  12. // (See accompanying file LICENSE_1_0.txt or copy at
  13. // http://www.boost.org/LICENSE_1_0.txt)
  14. #ifndef BOOST_GEOMETRY_STRATEGY_GEOGRAPHIC_EXPAND_SEGMENT_HPP
  15. #define BOOST_GEOMETRY_STRATEGY_GEOGRAPHIC_EXPAND_SEGMENT_HPP
  16. #include <cstddef>
  17. #include <functional>
  18. #include <boost/geometry/core/access.hpp>
  19. #include <boost/geometry/core/tags.hpp>
  20. #include <boost/geometry/algorithms/detail/envelope/box.hpp>
  21. #include <boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp>
  22. #include <boost/geometry/algorithms/detail/envelope/segment.hpp>
  23. #include <boost/geometry/srs/spheroid.hpp>
  24. #include <boost/geometry/strategy/expand.hpp>
  25. #include <boost/geometry/strategy/geographic/envelope_segment.hpp>
  26. #include <boost/geometry/strategies/geographic/parameters.hpp>
  27. #include <boost/geometry/strategy/spherical/expand_segment.hpp>
  28. namespace boost { namespace geometry
  29. {
  30. namespace strategy { namespace expand
  31. {
  32. template
  33. <
  34. typename FormulaPolicy = strategy::andoyer,
  35. typename Spheroid = geometry::srs::spheroid<double>,
  36. typename CalculationType = void
  37. >
  38. class geographic_segment
  39. {
  40. public:
  41. inline geographic_segment()
  42. : m_envelope_strategy()
  43. {}
  44. explicit inline geographic_segment(Spheroid const& spheroid)
  45. : m_envelope_strategy(spheroid)
  46. {}
  47. template <typename Box, typename Segment>
  48. inline void apply(Box& box, Segment const& segment) const
  49. {
  50. detail::segment_on_spheroid::apply(box, segment, m_envelope_strategy);
  51. }
  52. Spheroid model() const
  53. {
  54. return m_envelope_strategy.model();
  55. }
  56. private:
  57. strategy::envelope::geographic_segment
  58. <
  59. FormulaPolicy, Spheroid, CalculationType
  60. > m_envelope_strategy;
  61. };
  62. #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
  63. namespace services
  64. {
  65. template <typename CalculationType>
  66. struct default_strategy<segment_tag, geographic_tag, CalculationType>
  67. {
  68. typedef geographic_segment
  69. <
  70. strategy::andoyer,
  71. geometry::srs::spheroid<double>,
  72. CalculationType
  73. > type;
  74. };
  75. } // namespace services
  76. #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
  77. }} // namespace strategy::expand
  78. }} // namespace boost::geometry
  79. #endif // BOOST_GEOMETRY_STRATEGY_GEOGRAPHIC_EXPAND_SEGMENT_HPP