]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/clear_multi.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2011-2015 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)
8 #include <geometry_test_common.hpp>
10 #include <boost/geometry/algorithms/clear.hpp>
11 #include <boost/geometry/algorithms/num_points.hpp>
13 #include <boost/geometry/io/wkt/wkt.hpp>
15 #include <boost/geometry/geometries/geometries.hpp>
16 #include <boost/geometry/geometries/point_xy.hpp>
18 #include <boost/variant/variant.hpp>
21 template <typename Geometry
>
22 void test_geometry(std::string
const& wkt
, unsigned int expected
)
25 bg::read_wkt(wkt
, geometry
);
26 boost::variant
<Geometry
> variant_geometry(geometry
);
29 BOOST_CHECK_EQUAL(bg::num_points(geometry
), expected
);
31 bg::clear(variant_geometry
);
32 BOOST_CHECK_EQUAL(bg::num_points(variant_geometry
), expected
);
36 template <typename Point
>
39 typedef bg::model::polygon
<Point
> poly
;
40 typedef bg::model::linestring
<Point
> ls
;
41 typedef bg::model::multi_point
<Point
> mpoint
;
42 typedef bg::model::multi_linestring
<ls
> mls
;
43 typedef bg::model::multi_polygon
<poly
> mpoly
;
45 test_geometry
<Point
>("POINT(0 0)", 1);
46 test_geometry
<ls
>("LINESTRING(0 0,0 1)", 0);
47 test_geometry
<poly
>("POLYGON((0 0,0 1,1 0,0 0))", 0);
48 test_geometry
<mpoint
>("MULTIPOINT((0 0),(0 1),(1 0),(0 0))", 0);
49 test_geometry
<mls
>("MULTILINESTRING((0 0,0 1),(1 0,0 0))", 0);
50 test_geometry
<mpoly
>("MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((10 0,10 1,11 0,10 0)))", 0);
54 int test_main( int , char* [] )
56 test_all
<bg::model::d2::point_xy
<double> >();