unique_multi.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. //
  3. // Copyright (c) 2007-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 <geometry_test_common.hpp>
  8. #include <boost/geometry/algorithms/unique.hpp>
  9. #include <boost/geometry/geometries/geometries.hpp>
  10. #include <boost/geometry/geometries/point_xy.hpp>
  11. #include <algorithms/test_unique.hpp>
  12. template <typename P>
  13. void test_all()
  14. {
  15. // Multi point, should happen nothing, even if there are duplicate points
  16. test_geometry<bg::model::multi_point<P> >(
  17. "MULTIPOINT((0 0),(0 0),(1 1))",
  18. "MULTIPOINT((0 0),(0 0),(1 1))");
  19. test_geometry<bg::model::multi_linestring<bg::model::linestring<P> > >(
  20. "MULTILINESTRING((0 0,1 1,1 1),(3 3,3 3,4 4))",
  21. "MULTILINESTRING((0 0,1 1),(3 3,4 4))");
  22. typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
  23. test_geometry<mp>(
  24. "MULTIPOLYGON(((0 0,0 1,1 1,1 1,1 1,1 0,0 0,0 0)))",
  25. "MULTIPOLYGON(((0 0,0 1,1 1,1 0,0 0)))");
  26. // With holes
  27. test_geometry<mp>(
  28. "MULTIPOLYGON(((0 0,0 10,10 10,10 10,10 10,10 0,0 0,0 0)))",
  29. "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))");
  30. }
  31. int test_main( int , char* [] )
  32. {
  33. test_all<bg::model::d2::point_xy<int> >();
  34. test_all<bg::model::d2::point_xy<double> >();
  35. #ifdef HAVE_TTMATH
  36. test_all<bg::model::d2::point_xy<ttmath_big> >();
  37. #endif
  38. return 0;
  39. }