]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/area/area_multi.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / area / area_multi.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 //
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 //
5 // This file was modified by Oracle on 2015, 2016.
6 // Modifications copyright (c) 2015-2016, Oracle and/or its affiliates.
7 //
8 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
9 //
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
13
14
15 #include <algorithms/area/test_area.hpp>
16
17 #include <boost/geometry/geometries/geometries.hpp>
18 #include <boost/geometry/geometries/point_xy.hpp>
19 #include <boost/geometry/geometries/multi_polygon.hpp>
20
21 #include <boost/geometry/io/wkt/wkt.hpp>
22
23
24
25
26 template <typename CT>
27 void test_all()
28 {
29 typedef typename bg::model::d2::point_xy<CT> pt_crt;
30 typedef typename bg::model::point<CT, 2, bg::cs::spherical_equatorial<bg::degree> > pt_sph;
31 typedef typename bg::model::point<CT, 2, bg::cs::geographic<bg::degree> > pt_geo;
32
33 typedef bg::model::multi_polygon<bg::model::polygon<pt_crt> > mp_crt;
34 typedef bg::model::multi_polygon<bg::model::polygon<pt_sph> > mp_sph;
35 typedef bg::model::multi_polygon<bg::model::polygon<pt_geo> > mp_geo;
36
37 // mean Earth's radius^2
38 double r2 = bg::math::sqr(bg::get_radius<0>(bg::srs::sphere<double>()));
39
40 std::string poly = "MULTIPOLYGON(((0 0,0 7,4 2,2 0,0 0)))";
41 test_geometry<mp_crt>(poly, 16.0);
42 test_geometry<mp_sph>(poly, 197897454752.69489 / r2);
43 test_geometry<mp_geo>(poly, 197018888665.8331);
44 }
45
46 int test_main( int , char* [] )
47 {
48 test_all<double>();
49
50 return 0;
51 }