PageRenderTime 13ms CodeModel.GetById 8ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/geometry/test/multi/algorithms/multi_for_each.cpp

http://hadesmem.googlecode.com/
C++ | 83 lines | 57 code | 18 blank | 8 comment | 0 complexity | 83b25723cdab511d5512490f4b0862f6 MD5 | raw file
 1// Boost.Geometry (aka GGL, Generic Geometry Library)
 2//
 3// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
 4// Use, modification and distribution is subject to the Boost Software License,
 5// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 6// http://www.boost.org/LICENSE_1_0.txt)
 7
 8#include <geometry_test_common.hpp>
 9
10#include <boost/geometry/algorithms/for_each.hpp>
11#include <boost/geometry/multi/algorithms/for_each.hpp>
12
13#include <boost/geometry/domains/gis/io/wkt/wkt.hpp>
14
15#include <boost/geometry/geometries/box.hpp>
16#include <boost/geometry/geometries/ring.hpp>
17#include <boost/geometry/geometries/linestring.hpp>
18#include <boost/geometry/geometries/point.hpp>
19#include <boost/geometry/geometries/point_xy.hpp>
20#include <boost/geometry/geometries/polygon.hpp>
21
22#include <boost/geometry/multi/geometries/multi_point.hpp>
23#include <boost/geometry/multi/geometries/multi_linestring.hpp>
24#include <boost/geometry/multi/geometries/multi_polygon.hpp>
25
26#include <algorithms/test_for_each.hpp>
27
28
29template <typename P>
30void test_all()
31{
32    test_geometry<bg::model::multi_point<P> >
33        (
34            "MULTIPOINT((1 1))"
35
36            // per point
37            , 1
38            , "MULTIPOINT((101 1))"
39            , "MULTIPOINT((101 100))"
40            // per segment
41            , ""
42            , 0
43            , "MULTIPOINT((1 1))"
44        );
45
46    test_geometry<bg::model::multi_linestring<bg::model::linestring<P> > >
47        (
48        "MULTILINESTRING((1 1,2 2))"
49
50            , 3
51            , "MULTILINESTRING((101 1,102 2))"
52            , "MULTILINESTRING((101 100,102 200))"
53
54            , "((1, 1), (2, 2))"
55            , std::sqrt(2.0)
56            , "MULTILINESTRING((10 1,2 2))"
57        );
58
59    typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
60    test_geometry<mp>
61        (
62            "MULTIPOLYGON(((1 1,1 4,4 4,4 1,1 1)))"
63
64            , 11
65            , "MULTIPOLYGON(((101 1,101 4,104 4,104 1,101 1)))"
66            , "MULTIPOLYGON(((101 100,101 400,104 400,104 100,101 100)))"
67
68            , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
69            , 4 * 3.0
70            , "MULTIPOLYGON(((10 1,10 4,4 4,4 1,1 1)))"
71        );
72}
73
74int test_main( int , char* [] )
75{
76    test_all<bg::model::d2::point_xy<double> >();
77
78#ifdef HAVE_TTMATH
79    test_all<bg::model::d2::point_xy<ttmath_big> >();
80#endif
81
82    return 0;
83}