overlaps.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
  3. // This file was modified by Oracle on 2014, 2015, 2017.
  4. // Modifications copyright (c) 2014-2017 Oracle and/or its affiliates.
  5. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  6. // Use, modification and distribution is subject to the Boost Software License,
  7. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. #include "test_overlaps.hpp"
  10. template <typename P>
  11. void test_pp()
  12. {
  13. typedef bg::model::multi_point<P> mpt;
  14. test_geometry<P, P>("POINT(0 0)", "POINT(0 0)", false);
  15. test_geometry<P, P>("POINT(0 0)", "POINT(1 1)", false);
  16. test_geometry<P, mpt>("POINT(0 0)", "MULTIPOINT(0 0, 1 1)", false);
  17. test_geometry<mpt, P>("MULTIPOINT(0 0, 1 1)", "POINT(0 0)", false);
  18. test_geometry<mpt, mpt>("MULTIPOINT(0 0,1 1,2 2)", "MULTIPOINT(1 1,3 3,4 4)", true);
  19. test_geometry<mpt, mpt>("MULTIPOINT(0 0,1 1,2 2)", "MULTIPOINT(1 1,2 2)", false);
  20. }
  21. template <typename P>
  22. void test_ll()
  23. {
  24. typedef bg::model::linestring<P> ls;
  25. typedef bg::model::multi_linestring<ls> mls;
  26. test_geometry<ls, ls>("LINESTRING(0 0,2 2,3 1)", "LINESTRING(1 1,2 2,4 4)", true);
  27. test_geometry<ls, ls>("LINESTRING(0 0,2 2,4 0)", "LINESTRING(0 1,2 1,3 2)", false);
  28. test_geometry<ls, mls>("LINESTRING(0 0,2 2,3 1)", "MULTILINESTRING((1 1,2 2),(2 2,4 4))", true);
  29. test_geometry<ls, mls>("LINESTRING(0 0,2 2,3 1)", "MULTILINESTRING((1 1,2 2),(3 3,4 4))", true);
  30. test_geometry<ls, mls>("LINESTRING(0 0,3 3,3 1)", "MULTILINESTRING((3 3,2 2),(0 0,1 1))", false);
  31. }
  32. template <typename P>
  33. void test_2d()
  34. {
  35. test_pp<P>();
  36. test_ll<P>();
  37. }
  38. int test_main( int , char* [] )
  39. {
  40. test_2d<bg::model::d2::point_xy<int> >();
  41. test_2d<bg::model::d2::point_xy<double> >();
  42. #if defined(HAVE_TTMATH)
  43. test_2d<bg::model::d2::point_xy<ttmath_big> >();
  44. #endif
  45. return 0;
  46. }