File: area_multi.cpp

package info (click to toggle)
boost1.90 1.90.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 593,156 kB
  • sloc: cpp: 4,190,642; xml: 196,648; python: 34,618; ansic: 23,145; asm: 5,468; sh: 3,776; makefile: 1,161; perl: 1,020; sql: 728; ruby: 676; yacc: 478; java: 77; lisp: 24; csh: 6
file content (51 lines) | stat: -rw-r--r-- 1,675 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Boost.Geometry (aka GGL, Generic Geometry Library)
//
// Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
//
// This file was modified by Oracle on 2015, 2016.
// Modifications copyright (c) 2015-2016, Oracle and/or its affiliates.
//
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
//
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)


#include <algorithms/area/test_area.hpp>

#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/multi_polygon.hpp>

#include <boost/geometry/io/wkt/wkt.hpp>




template <typename CT>
void test_all()
{
    typedef typename bg::model::d2::point_xy<CT> pt_crt;
    typedef typename bg::model::point<CT, 2, bg::cs::spherical_equatorial<bg::degree> > pt_sph;
    typedef typename bg::model::point<CT, 2, bg::cs::geographic<bg::degree> > pt_geo;

    typedef bg::model::multi_polygon<bg::model::polygon<pt_crt> > mp_crt;
    typedef bg::model::multi_polygon<bg::model::polygon<pt_sph> > mp_sph;
    typedef bg::model::multi_polygon<bg::model::polygon<pt_geo> > mp_geo;

    // mean Earth's radius^2
    double r2 = bg::math::sqr(bg::get_radius<0>(bg::srs::sphere<double>()));

    std::string poly = "MULTIPOLYGON(((0 0,0 7,4 2,2 0,0 0)))";
    test_geometry<mp_crt>(poly, 16.0);
    test_geometry<mp_sph>(poly, 197897454752.69489 / r2);
    test_geometry<mp_geo>(poly, 197022195785.33771);
}

int test_main( int , char* [] )
{
    test_all<double>();

    return 0;
}