]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
2 | ||
3 | // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. | |
4 | ||
5 | // This file was modified by Oracle on 2014. | |
6 | // Modifications copyright (c) 2014 Oracle and/or its affiliates. | |
7 | ||
8 | // Use, modification and distribution is subject to the Boost Software License, | |
9 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
10 | // http://www.boost.org/LICENSE_1_0.txt) | |
11 | ||
12 | // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle | |
13 | ||
14 | #include "test_crosses.hpp" | |
15 | ||
16 | template <typename P> | |
17 | void test_pl() | |
18 | { | |
19 | /*typedef bg::model::multi_point<P> mpt; | |
20 | typedef bg::model::linestring<P> ls; | |
21 | ||
22 | // not implemented yet | |
23 | test_geometry<mpt, ls>("MULTIPOINT(0 0,1 1)", "LINESTRING(0 0,1 0,3 3)", true); | |
24 | test_geometry<mpt, ls>("MULTIPOINT(0 0,1 1)", "LINESTRING(0 0,1 1,3 3)", false);*/ | |
25 | } | |
26 | ||
27 | template <typename P> | |
28 | void test_pa() | |
29 | { | |
30 | /*typedef bg::model::multi_point<P> mpt; | |
31 | typedef bg::model::polygon<P> poly; | |
32 | typedef bg::model::multi_polygon<poly> mpoly; | |
33 | ||
34 | // not implemented yet | |
35 | test_geometry<mpt, poly>("MULTIPOINT(0 0,6 6)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true); | |
36 | test_geometry<mpt, poly>("MULTIPOINT(0 0,1 1)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", false);*/ | |
37 | } | |
38 | ||
39 | template <typename P> | |
40 | void test_ll() | |
41 | { | |
42 | typedef bg::model::linestring<P> ls; | |
43 | typedef bg::model::multi_linestring<ls> mls; | |
44 | ||
45 | test_geometry<ls, ls>("LINESTRING(0 0,2 2,4 4)", "LINESTRING(0 1,2 1,3 1)", true); | |
46 | test_geometry<ls, ls>("LINESTRING(0 0,2 2)", "LINESTRING(0 1,2 1)", true); | |
47 | test_geometry<ls, ls>("LINESTRING(0 0,2 2,4 4)", "LINESTRING(0 1,1 1,2 2,3 2)", false); | |
48 | ||
49 | test_geometry<ls, mls>("LINESTRING(0 0,2 2,4 4)", "MULTILINESTRING((0 1,4 1),(0 2,4 2))", true); | |
50 | test_geometry<mls, ls>("MULTILINESTRING((0 1,4 1),(0 2,4 2))", "LINESTRING(0 0,2 2,4 4)", true); | |
51 | ||
52 | test_geometry<mls, mls>("MULTILINESTRING((0 0,2 2,4 4),(3 0,3 4))", "MULTILINESTRING((0 1,4 1),(0 2,4 2))", true); | |
53 | ||
54 | // spike - boundary and interior on the same point | |
55 | test_geometry<ls, ls>("LINESTRING(3 7, 8 8, 2 6)", "LINESTRING(5 7, 10 7, 0 7)", true); | |
56 | } | |
57 | ||
58 | template <typename P> | |
59 | void test_la() | |
60 | { | |
61 | typedef bg::model::linestring<P> ls; | |
62 | typedef bg::model::multi_linestring<ls> mls; | |
63 | typedef bg::model::ring<P> ring; | |
64 | typedef bg::model::polygon<P> poly; | |
65 | typedef bg::model::multi_polygon<poly> mpoly; | |
66 | ||
67 | test_geometry<ls, ring>("LINESTRING(0 0, 10 10)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true); | |
68 | test_geometry<ls, poly>("LINESTRING(0 0, 10 10)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true); | |
69 | test_geometry<ls, mpoly>("LINESTRING(0 0, 10 10)", "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)))", true); | |
70 | ||
71 | test_geometry<ls, poly>("LINESTRING(0 0, 10 0)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", false); | |
72 | test_geometry<ls, poly>("LINESTRING(1 1, 5 5)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", false); | |
73 | ||
74 | test_geometry<mls, ring>("MULTILINESTRING((1 1, 5 5),(6 6,7 7))", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true); | |
75 | test_geometry<mls, poly>("MULTILINESTRING((1 1, 5 5),(6 6,7 7))", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true); | |
76 | test_geometry<mls, mpoly>("MULTILINESTRING((1 1, 5 5),(6 6,7 7))", "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)))", true); | |
77 | } | |
78 | ||
79 | template <typename P> | |
80 | void test_2d() | |
81 | { | |
82 | test_pl<P>(); | |
83 | test_pa<P>(); | |
84 | test_ll<P>(); | |
85 | test_la<P>(); | |
86 | } | |
87 | ||
88 | int test_main( int , char* [] ) | |
89 | { | |
90 | test_2d<bg::model::d2::point_xy<int> >(); | |
91 | test_2d<bg::model::d2::point_xy<double> >(); | |
92 | ||
93 | #if defined(HAVE_TTMATH) | |
94 | test_2d<bg::model::d2::point_xy<ttmath_big> >(); | |
95 | #endif | |
96 | ||
97 | //test_3d<bg::model::point<double, 3, bg::cs::cartesian> >(); | |
98 | ||
99 | return 0; | |
100 | } |