PageRenderTime 48ms CodeModel.GetById 43ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

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

http://hadesmem.googlecode.com/
C++ | 57 lines | 33 code | 16 blank | 8 comment | 0 complexity | 156d8b4dc6649dfb541eeb1dfbcce6eb MD5 | raw file
 1// Boost.Geometry (aka GGL, Generic Geometry Library)
 2//
 3// Copyright (c) 2010 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
 9#include <algorithms/test_equals.hpp>
10
11#include <boost/geometry/multi/algorithms/area.hpp>
12#include <boost/geometry/multi/algorithms/equals.hpp>
13
14#include <boost/geometry/geometries/geometries.hpp>
15#include <boost/geometry/geometries/point_xy.hpp>
16#include <boost/geometry/multi/geometries/multi_polygon.hpp>
17
18#include <boost/geometry/domains/gis/io/wkt/read_wkt_multi.hpp>
19
20
21
22template <typename P>
23void test_all()
24{
25    std::string case1 = "MULTIPOLYGON(((0 0,0 7,4 2,2 0,0 0)))";
26    std::string case1_p     = "POLYGON((0 0,0 7,4 2,2 0,0 0))";
27
28    typedef bg::model::polygon<P> polygon;
29    typedef bg::model::multi_polygon<polygon> mp;
30    test_geometry<mp, mp>("c1", case1, case1, true);
31
32    test_geometry<mp, mp>("c2",
33            "MULTIPOLYGON(((0 0,0 7.01,4 2,2 0,0 0)))",
34            case1, false);
35
36    // Different order == equal
37    test_geometry<mp, mp>("c3",
38            "MULTIPOLYGON(((0 0,0 7,4 2,2 0,0 0)),((10 10,10 12,12 10,10 10)))",
39            "MULTIPOLYGON(((10 10,10 12,12 10,10 10)),((0 0,0 7,4 2,2 0,0 0)))",
40            true);
41
42    // check different types
43    test_geometry<polygon, mp>("c1_p_mp", case1_p, case1, true);
44    test_geometry<mp, polygon>("c1_mp_p", case1, case1_p, true);
45
46}
47
48int test_main( int , char* [] )
49{
50    test_all<bg::model::d2::point_xy<double> >();
51
52#ifdef HAVE_TTMATH
53    test_all<bg::model::d2::point_xy<ttmath_big> >();
54#endif
55
56    return 0;
57}