]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/perimeter/perimeter_geo.cpp
403f87b0b9ad2376b34e3c28cf43bfd1abd302f2
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2016-2017 Oracle and/or its affiliates.
5 // Contributed and/or modified by Vissarion Fisikopoulos, on behalf of Oracle
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #include <algorithms/test_perimeter.hpp>
12 #include <algorithms/perimeter/perimeter_polygon_cases.hpp>
14 #include <boost/geometry/geometries/geometries.hpp>
15 #include <boost/geometry/geometries/point_xy.hpp>
20 // Set radius type, but for integer coordinates we want to have floating
22 typedef typename
bg::promote_floating_point
24 typename
bg::coordinate_type
<P
>::type
27 typedef bg::srs::spheroid
<rtype
> stype
;
28 typedef bg::strategy::distance::andoyer
<stype
> andoyer_type
;
29 typedef bg::strategy::distance::thomas
<stype
> thomas_type
;
30 typedef bg::strategy::distance::vincenty
<stype
> vincenty_type
;
34 void test_default() //this should use andoyer strategy
36 for (std::size_t i
= 0; i
<= 2; ++i
)
38 test_geometry
<bg::model::polygon
<P
> >(poly_data_geo
[i
],
39 1116814.237 + 1116152.605);
42 //since the geodesic distance is the shortest path it should go over the pole
43 //in this case; thus the correct perimeter is the meridian length (below)
44 //and not 40075160 which is the legth of the equator
45 test_geometry
<bg::model::polygon
<P
> >(poly_data_geo
[3],
48 //force to use equator path
49 test_geometry
<bg::model::polygon
<P
> >(poly_data_geo
[4],
53 test_geometry
<bg::model::multi_polygon
<bg::model::polygon
<P
> > >
54 (multipoly_data
[0], 60011752.0709);
56 // Geometries with length zero
57 test_geometry
<P
>("POINT(0 0)", 0);
58 test_geometry
<bg::model::linestring
<P
> >("LINESTRING(0 0,0 1,1 1,1 0,0 0)",
62 template <typename P
, typename N
, typename Strategy
>
63 void test_with_strategy(N exp_length
, Strategy strategy
)
65 for (std::size_t i
= 0; i
<= 2; ++i
)
67 test_geometry
<bg::model::polygon
<P
> >(poly_data_geo
[i
],
71 // Geometries with length zero
72 test_geometry
<P
>("POINT(0 0)", 0, strategy
);
73 test_geometry
<bg::model::linestring
<P
> >("LINESTRING(0 0,0 1,1 1,1 0,0 0)",
81 typename geo_strategies
<P
>::andoyer_type andoyer
;
82 test_with_strategy
<P
>(1116814.237 + 1116152.605, andoyer
);
88 typename geo_strategies
<P
>::thomas_type thomas
;
89 test_with_strategy
<P
>(1116825.795 + 1116158.7417, thomas
);
95 typename geo_strategies
<P
>::vincenty_type vincenty
;
96 test_with_strategy
<P
>(1116825.857 + 1116159.144, vincenty
);
108 int test_main(int, char* [])
110 // Works only for double(?!)
111 //test_all<bg::model::d2::point_xy<int,
112 // bg::cs::geographic<bg::degree> > >();
113 //test_all<bg::model::d2::point_xy<float,
114 // bg::cs::geographic<bg::degree> > >();
115 test_all
<bg::model::d2::point_xy
<double,
116 bg::cs::geographic
<bg::degree
> > >();
118 #if defined(HAVE_TTMATH)
119 test_all
<bg::model::d2::point_xy
<ttmath_big
> >();