expand_segment.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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_STRATEGIES_GEOGRAPHIC_EXPAND_SEGMENT_HPP
  15. #define BOOST_GEOMETRY_STRATEGIES_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/strategies/expand.hpp>
  25. #include <boost/geometry/strategies/geographic/envelope_segment.hpp>
  26. #include <boost/geometry/strategies/geographic/parameters.hpp>
  27. #include <boost/geometry/strategies/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. private:
  53. strategy::envelope::geographic_segment
  54. <
  55. FormulaPolicy, Spheroid, CalculationType
  56. > m_envelope_strategy;
  57. };
  58. #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
  59. namespace services
  60. {
  61. template <typename CalculationType>
  62. struct default_strategy<segment_tag, geographic_tag, CalculationType>
  63. {
  64. typedef geographic_segment
  65. <
  66. strategy::andoyer,
  67. geometry::srs::spheroid<double>,
  68. CalculationType
  69. > type;
  70. };
  71. } // namespace services
  72. #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
  73. }} // namespace strategy::expand
  74. }} // namespace boost::geometry
  75. #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_EXPAND_SEGMENT_HPP