]>
Commit | Line | Data |
---|---|---|
92f5a8d4 TL |
1 | // Boost.Geometry |
2 | ||
3 | // Copyright (c) 2019, Oracle and/or its affiliates. | |
4 | ||
5 | // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle | |
6 | ||
7 | // Licensed under the Boost Software License version 1.0. | |
8 | // http://www.boost.org/users/license.html | |
9 | ||
10 | #ifndef BOOST_GEOMETRY_EXTENSIONS_STRATEGIES_GEOGRAPHIC_IO_HPP | |
11 | #define BOOST_GEOMETRY_EXTENSIONS_STRATEGIES_GEOGRAPHIC_IO_HPP | |
12 | ||
13 | ||
14 | #include <boost/geometry/strategies/io.hpp> | |
15 | ||
16 | #include <boost/geometry/strategies/geographic/point_order.hpp> | |
17 | #include <boost/geometry/strategies/geographic/point_in_poly_winding.hpp> | |
18 | ||
19 | ||
20 | namespace boost { namespace geometry | |
21 | { | |
22 | ||
23 | namespace strategy { namespace io | |
24 | { | |
25 | ||
26 | template | |
27 | < | |
28 | typename FormulaPolicy = strategy::andoyer, | |
29 | typename Spheroid = srs::spheroid<double>, | |
30 | typename CalculationType = void | |
31 | > | |
32 | struct geographic | |
33 | { | |
34 | typedef strategy::point_order::geographic | |
35 | < | |
36 | FormulaPolicy, | |
37 | Spheroid, | |
38 | CalculationType | |
39 | > point_order_strategy_type; | |
40 | ||
41 | point_order_strategy_type get_point_order_strategy() const | |
42 | { | |
43 | return point_order_strategy_type(m_spheroid); | |
44 | } | |
45 | ||
46 | template <typename Geometry1, typename Geometry2> | |
47 | struct point_in_geometry_strategy | |
48 | { | |
49 | typedef strategy::within::geographic_winding | |
50 | < | |
51 | typename point_type<Geometry1>::type, | |
52 | typename point_type<Geometry2>::type, | |
53 | FormulaPolicy, | |
54 | Spheroid, | |
55 | CalculationType | |
56 | > type; | |
57 | }; | |
58 | ||
59 | template <typename Geometry1, typename Geometry2> | |
60 | typename point_in_geometry_strategy<Geometry1, Geometry2>::type | |
61 | get_point_in_geometry_strategy() const | |
62 | { | |
63 | typedef typename point_in_geometry_strategy | |
64 | < | |
65 | Geometry1, Geometry2 | |
66 | >::type strategy_type; | |
67 | return strategy_type(m_spheroid); | |
68 | } | |
69 | ||
70 | geographic() | |
71 | {} | |
72 | ||
73 | geographic(Spheroid const& spheroid) | |
74 | : m_spheroid(spheroid) | |
75 | {} | |
76 | ||
77 | private: | |
78 | Spheroid m_spheroid; | |
79 | }; | |
80 | ||
81 | namespace services | |
82 | { | |
83 | ||
84 | template <> | |
85 | struct default_strategy<geographic_tag> | |
86 | { | |
87 | typedef geographic<> type; | |
88 | }; | |
89 | ||
90 | } // namespace services | |
91 | ||
92 | }} // namespace strategy::io | |
93 | ||
94 | }} // namespace boost::geometry | |
95 | ||
96 | #endif // BOOST_GEOMETRY_EXTENSIONS_STRATEGIES_GEOGRAPHIC_IO_HPP |