~ubuntu-branches/debian/sid/boost1.49/sid

« back to all changes in this revision

Viewing changes to libs/geometry/test/multi/algorithms/multi_for_each.cpp

  • Committer: Package Import Robot
  • Author(s): Steve M. Robbins
  • Date: 2012-02-26 00:31:44 UTC
  • Revision ID: package-import@ubuntu.com-20120226003144-eaytp12cbf6ubpms
Tags: upstream-1.49.0
ImportĀ upstreamĀ versionĀ 1.49.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Boost.Geometry (aka GGL, Generic Geometry Library)
 
2
//
 
3
// Copyright (c) 2007-2012 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/io/wkt/wkt.hpp>
 
14
#include <boost/geometry/multi/io/wkt/wkt.hpp>
 
15
 
 
16
#include <boost/geometry/geometries/box.hpp>
 
17
#include <boost/geometry/geometries/ring.hpp>
 
18
#include <boost/geometry/geometries/linestring.hpp>
 
19
#include <boost/geometry/geometries/point.hpp>
 
20
#include <boost/geometry/geometries/point_xy.hpp>
 
21
#include <boost/geometry/geometries/polygon.hpp>
 
22
 
 
23
#include <boost/geometry/multi/geometries/multi_point.hpp>
 
24
#include <boost/geometry/multi/geometries/multi_linestring.hpp>
 
25
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
 
26
 
 
27
#include <algorithms/test_for_each.hpp>
 
28
 
 
29
 
 
30
template <typename P>
 
31
void test_all()
 
32
{
 
33
    test_geometry<bg::model::multi_point<P> >
 
34
        (
 
35
            "MULTIPOINT((1 1))"
 
36
 
 
37
            // per point
 
38
            , 1
 
39
            , "MULTIPOINT((101 1))"
 
40
            , "MULTIPOINT((101 100))"
 
41
            // per segment
 
42
            , ""
 
43
            , 0
 
44
            , "MULTIPOINT((1 1))"
 
45
        );
 
46
 
 
47
    test_geometry<bg::model::multi_linestring<bg::model::linestring<P> > >
 
48
        (
 
49
        "MULTILINESTRING((1 1,2 2))"
 
50
 
 
51
            , 3
 
52
            , "MULTILINESTRING((101 1,102 2))"
 
53
            , "MULTILINESTRING((101 100,102 200))"
 
54
 
 
55
            , "((1, 1), (2, 2))"
 
56
            , std::sqrt(2.0)
 
57
            , "MULTILINESTRING((10 1,2 2))"
 
58
        );
 
59
 
 
60
    typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
 
61
    test_geometry<mp>
 
62
        (
 
63
            "MULTIPOLYGON(((1 1,1 4,4 4,4 1,1 1)))"
 
64
 
 
65
            , 11
 
66
            , "MULTIPOLYGON(((101 1,101 4,104 4,104 1,101 1)))"
 
67
            , "MULTIPOLYGON(((101 100,101 400,104 400,104 100,101 100)))"
 
68
 
 
69
            , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
 
70
            , 4 * 3.0
 
71
            , "MULTIPOLYGON(((10 1,10 4,4 4,4 1,1 1)))"
 
72
        );
 
73
}
 
74
 
 
75
int test_main( int , char* [] )
 
76
{
 
77
    test_all<bg::model::d2::point_xy<double> >();
 
78
 
 
79
#ifdef HAVE_TTMATH
 
80
    test_all<bg::model::d2::point_xy<ttmath_big> >();
 
81
#endif
 
82
 
 
83
    return 0;
 
84
}