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

http://hadesmem.googlecode.com/ · C++ · 83 lines · 57 code · 18 blank · 8 comment · 0 complexity · 83b25723cdab511d5512490f4b0862f6 MD5 · raw file

  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. //
  3. // Copyright (c) 2007-2011 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/for_each.hpp>
  9. #include <boost/geometry/multi/algorithms/for_each.hpp>
  10. #include <boost/geometry/domains/gis/io/wkt/wkt.hpp>
  11. #include <boost/geometry/geometries/box.hpp>
  12. #include <boost/geometry/geometries/ring.hpp>
  13. #include <boost/geometry/geometries/linestring.hpp>
  14. #include <boost/geometry/geometries/point.hpp>
  15. #include <boost/geometry/geometries/point_xy.hpp>
  16. #include <boost/geometry/geometries/polygon.hpp>
  17. #include <boost/geometry/multi/geometries/multi_point.hpp>
  18. #include <boost/geometry/multi/geometries/multi_linestring.hpp>
  19. #include <boost/geometry/multi/geometries/multi_polygon.hpp>
  20. #include <algorithms/test_for_each.hpp>
  21. template <typename P>
  22. void test_all()
  23. {
  24. test_geometry<bg::model::multi_point<P> >
  25. (
  26. "MULTIPOINT((1 1))"
  27. // per point
  28. , 1
  29. , "MULTIPOINT((101 1))"
  30. , "MULTIPOINT((101 100))"
  31. // per segment
  32. , ""
  33. , 0
  34. , "MULTIPOINT((1 1))"
  35. );
  36. test_geometry<bg::model::multi_linestring<bg::model::linestring<P> > >
  37. (
  38. "MULTILINESTRING((1 1,2 2))"
  39. , 3
  40. , "MULTILINESTRING((101 1,102 2))"
  41. , "MULTILINESTRING((101 100,102 200))"
  42. , "((1, 1), (2, 2))"
  43. , std::sqrt(2.0)
  44. , "MULTILINESTRING((10 1,2 2))"
  45. );
  46. typedef bg::model::multi_polygon<bg::model::polygon<P> > mp;
  47. test_geometry<mp>
  48. (
  49. "MULTIPOLYGON(((1 1,1 4,4 4,4 1,1 1)))"
  50. , 11
  51. , "MULTIPOLYGON(((101 1,101 4,104 4,104 1,101 1)))"
  52. , "MULTIPOLYGON(((101 100,101 400,104 400,104 100,101 100)))"
  53. , "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
  54. , 4 * 3.0
  55. , "MULTIPOLYGON(((10 1,10 4,4 4,4 1,1 1)))"
  56. );
  57. }
  58. int test_main( int , char* [] )
  59. {
  60. test_all<bg::model::d2::point_xy<double> >();
  61. #ifdef HAVE_TTMATH
  62. test_all<bg::model::d2::point_xy<ttmath_big> >();
  63. #endif
  64. return 0;
  65. }