equals_multi.cpp 1.5 KB

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