1 // Boost.Geometry (aka GGL, Generic Geometry Library) 2 3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. 4 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. 5 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. 6 // Copyright (c) 2014-2015 Samuel Debionne, Grenoble, France. 7 8 // This file was modified by Oracle on 2015, 2016, 2017, 2018. 9 // Modifications copyright (c) 2015-2018, Oracle and/or its affiliates. 10 11 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle 12 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle 13 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle 14 15 // Distributed under the Boost Software License, Version 1.0. 16 // (See accompanying file LICENSE_1_0.txt or copy at 17 // http://www.boost.org/LICENSE_1_0.txt) 18 19 #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_EXPAND_SEGMENT_HPP 20 #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_EXPAND_SEGMENT_HPP 21 22 #include <cstddef> 23 #include <functional> 24 25 #include <boost/geometry/core/access.hpp> 26 #include <boost/geometry/core/tags.hpp> 27 28 #include <boost/geometry/algorithms/detail/envelope/box.hpp> 29 #include <boost/geometry/algorithms/detail/envelope/range_of_boxes.hpp> 30 #include <boost/geometry/algorithms/detail/envelope/segment.hpp> 31 32 #include <boost/geometry/srs/spheroid.hpp> 33 34 #include <boost/geometry/strategies/expand.hpp> 35 #include <boost/geometry/strategies/geographic/envelope_segment.hpp> 36 #include <boost/geometry/strategies/geographic/parameters.hpp> 37 #include <boost/geometry/strategies/spherical/expand_segment.hpp> 38 39 40 namespace boost { namespace geometry 41 { 42 43 namespace strategy { namespace expand 44 { 45 46 template 47 < 48 typename FormulaPolicy = strategy::andoyer, 49 typename Spheroid = geometry::srs::spheroid<double>, 50 typename CalculationType = void 51 > 52 class geographic_segment 53 { 54 public: geographic_segment()55 inline geographic_segment() 56 : m_envelope_strategy() 57 {} 58 geographic_segment(Spheroid const & spheroid)59 explicit inline geographic_segment(Spheroid const& spheroid) 60 : m_envelope_strategy(spheroid) 61 {} 62 63 template <typename Box, typename Segment> apply(Box & box,Segment const & segment) const64 inline void apply(Box& box, Segment const& segment) const 65 { 66 detail::segment_on_spheroid::apply(box, segment, m_envelope_strategy); 67 } 68 69 private: 70 strategy::envelope::geographic_segment 71 < 72 FormulaPolicy, Spheroid, CalculationType 73 > m_envelope_strategy; 74 }; 75 76 77 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS 78 79 namespace services 80 { 81 82 template <typename CalculationType> 83 struct default_strategy<segment_tag, geographic_tag, CalculationType> 84 { 85 typedef geographic_segment 86 < 87 strategy::andoyer, 88 geometry::srs::spheroid<double>, 89 CalculationType 90 > type; 91 }; 92 93 } // namespace services 94 95 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS 96 97 98 }} // namespace strategy::expand 99 100 }} // namespace boost::geometry 101 102 #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_EXPAND_SEGMENT_HPP 103