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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// This file was modified by Oracle on 2020.
// Modifications copyright (c) 2020, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, 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/test_for_each.hpp>
#include <boost/geometry/geometries/geometries.hpp>
template <typename P>
void test_all()
{
test_geometry<P>
(
"POINT(1 1)"
// per point
, 1
, "POINT(101 1)"
, "POINT(101 100)"
// per segment
, ""
, 0
, "POINT(1 1)"
);
test_geometry<bg::model::linestring<P> >
(
"LINESTRING(1 1,2 2)"
, 3
, "LINESTRING(101 1,102 2)"
, "LINESTRING(101 100,102 200)"
, "((1, 1), (2, 2))"
, std::sqrt(2.0)
, "LINESTRING(10 1,2 2)"
);
test_geometry<bg::model::linestring<P> >
(
"LINESTRING(1 1)"
, 1
, "LINESTRING(101 1)"
, "LINESTRING(101 100)"
, "((1, 1), (1, 1))"
, 0
, "LINESTRING(10 1)"
);
test_geometry<bg::model::linestring<P> >
(
"LINESTRING EMPTY"
, 0
, "LINESTRING()"
, "LINESTRING()"
, ""
, 0
, "LINESTRING()"
);
test_geometry<bg::model::ring<P> >
(
"POLYGON((1 1,1 4,4 4,4 1,1 1))"
, 11
, "POLYGON((101 1,101 4,104 4,104 1,101 1))"
, "POLYGON((101 100,101 400,104 400,104 100,101 100))"
, "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
, 4 * 3.0
, "POLYGON((10 1,10 4,4 4,4 1,1 1))"
);
test_geometry<bg::model::ring<P> >
(
"POLYGON EMPTY"
, 0
, "POLYGON()"
, "POLYGON()"
, ""
, 0
, "POLYGON()"
);
test_geometry<bg::model::ring<P, true, false> > // open ring
(
"POLYGON((1 1,1 4,4 4,4 1))"
, 10
, "POLYGON((101 1,101 4,104 4,104 1))"
, "POLYGON((101 100,101 400,104 400,104 100))"
, "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
, 4 * 3.0
, "POLYGON((10 1,10 4,4 4,4 1))"
);
test_geometry<bg::model::polygon<P> >
(
"POLYGON((1 1,1 4,4 4,4 1,1 1),(2 2,3 2,3 3,2 3,2 2))"
, 23
, "POLYGON((101 1,101 4,104 4,104 1,101 1),(102 2,103 2,103 3,102 3,102 2))"
, "POLYGON((101 100,101 400,104 400,104 100,101 100),(102 200,103 200,103 300,102 300,102 200))"
, "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1)) "
"((2, 2), (3, 2)) ((3, 2), (3, 3)) ((3, 3), (2, 3)) ((2, 3), (2, 2))"
, 4 * 3.0 + 4 * 1.0
, "POLYGON((10 1,10 4,4 4,4 1,1 1,10 1),(2 2,3 2,3 3,2 3,2 2))"
);
test_geometry<bg::model::polygon<P, true, false> > // open polygon
(
"POLYGON((1 1,1 4,4 4,4 1),(2 2,3 2,3 3,2 3))"
, 20
, "POLYGON((101 1,101 4,104 4,104 1,101 1),(102 2,103 2,103 3,102 3,102 2))"
, "POLYGON((101 100,101 400,104 400,104 100,101 100),(102 200,103 200,103 300,102 300,102 200))"
, "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1)) "
"((2, 2), (3, 2)) ((3, 2), (3, 3)) ((3, 3), (2, 3)) ((2, 3), (2, 2))"
, 4 * 3.0 + 4 * 1.0
, "POLYGON((10 1,10 4,4 4,4 1,10 1),(2 2,3 2,3 3,2 3,2 2))"
);
}
int test_main(int, char* [])
{
test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
return 0;
}
|