/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. #include <algorithms/test_equals.hpp>
  8. #include <boost/geometry/multi/algorithms/area.hpp>
  9. #include <boost/geometry/multi/algorithms/equals.hpp>
  10. #include <boost/geometry/geometries/geometries.hpp>
  11. #include <boost/geometry/geometries/point_xy.hpp>
  12. #include <boost/geometry/multi/geometries/multi_polygon.hpp>
  13. #include <boost/geometry/domains/gis/io/wkt/read_wkt_multi.hpp>
  14. template <typename P>
  15. void test_all()
  16. {
  17. std::string case1 = "MULTIPOLYGON(((0 0,0 7,4 2,2 0,0 0)))";
  18. std::string case1_p = "POLYGON((0 0,0 7,4 2,2 0,0 0))";
  19. typedef bg::model::polygon<P> polygon;
  20. typedef bg::model::multi_polygon<polygon> mp;
  21. test_geometry<mp, mp>("c1", case1, case1, true);
  22. test_geometry<mp, mp>("c2",
  23. "MULTIPOLYGON(((0 0,0 7.01,4 2,2 0,0 0)))",
  24. case1, false);
  25. // Different order == equal
  26. test_geometry<mp, mp>("c3",
  27. "MULTIPOLYGON(((0 0,0 7,4 2,2 0,0 0)),((10 10,10 12,12 10,10 10)))",
  28. "MULTIPOLYGON(((10 10,10 12,12 10,10 10)),((0 0,0 7,4 2,2 0,0 0)))",
  29. true);
  30. // check different types
  31. test_geometry<polygon, mp>("c1_p_mp", case1_p, case1, true);
  32. test_geometry<mp, polygon>("c1_mp_p", case1, case1_p, true);
  33. }
  34. int test_main( int , char* [] )
  35. {
  36. test_all<bg::model::d2::point_xy<double> >();
  37. #ifdef HAVE_TTMATH
  38. test_all<bg::model::d2::point_xy<ttmath_big> >();
  39. #endif
  40. return 0;
  41. }