difference_pl_pl.cpp 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2014-2015, Oracle and/or its affiliates.
  3. // Licensed under the Boost Software License version 1.0.
  4. // http://www.boost.org/users/license.html
  5. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
  6. #include <iostream>
  7. #ifndef BOOST_TEST_MODULE
  8. #define BOOST_TEST_MODULE test_difference_pointlike_pointlike
  9. #endif
  10. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  11. #define BOOST_GEOMETRY_DEBUG_TURNS
  12. #define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
  13. #endif
  14. #include <boost/test/included/unit_test.hpp>
  15. #include "../test_set_ops_pointlike.hpp"
  16. #include <boost/geometry/geometries/multi_point.hpp>
  17. typedef bg::model::point<double,2,bg::cs::cartesian> point_type;
  18. typedef bg::model::multi_point<point_type> multi_point_type;
  19. //===========================================================================
  20. //===========================================================================
  21. //===========================================================================
  22. BOOST_AUTO_TEST_CASE( test_difference_point_point )
  23. {
  24. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  25. std::cout << std::endl << std::endl << std::endl;
  26. std::cout << "*** POINT / POINT DIFFERENCE ***" << std::endl;
  27. std::cout << std::endl;
  28. #endif
  29. typedef point_type P;
  30. typedef multi_point_type MP;
  31. typedef test_set_op_of_pointlike_geometries
  32. <
  33. P, P, MP, bg::overlay_difference
  34. > tester;
  35. tester::apply
  36. ("ppdf01",
  37. from_wkt<P>("POINT(0 0)"),
  38. from_wkt<P>("POINT(1 1)"),
  39. from_wkt<MP>("MULTIPOINT(0 0)"),
  40. from_wkt<MP>("MULTIPOINT(1 1)")
  41. );
  42. tester::apply
  43. ("ppdf02",
  44. from_wkt<P>("POINT(0 0)"),
  45. from_wkt<P>("POINT(0 0)"),
  46. from_wkt<MP>("MULTIPOINT()")
  47. );
  48. }
  49. BOOST_AUTO_TEST_CASE( test_difference_multipoint_point )
  50. {
  51. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  52. std::cout << std::endl << std::endl << std::endl;
  53. std::cout << "*** MULTIPOINT / POINT DIFFERENCE ***" << std::endl;
  54. std::cout << std::endl;
  55. #endif
  56. typedef point_type P;
  57. typedef multi_point_type MP;
  58. typedef test_set_op_of_pointlike_geometries
  59. <
  60. MP, P, MP, bg::overlay_difference
  61. > tester;
  62. tester::apply
  63. ("mppdf01",
  64. from_wkt<MP>("MULTIPOINT(0 0)"),
  65. from_wkt<P>("POINT(1 1)"),
  66. from_wkt<MP>("MULTIPOINT(0 0)"),
  67. from_wkt<MP>("MULTIPOINT(1 1)")
  68. );
  69. tester::apply
  70. ("mppdf02",
  71. from_wkt<MP>("MULTIPOINT(0 0)"),
  72. from_wkt<P>("POINT(0 0)"),
  73. from_wkt<MP>("MULTIPOINT()")
  74. );
  75. tester::apply
  76. ("mppdf03",
  77. from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
  78. from_wkt<P>("POINT(1 1)"),
  79. from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
  80. from_wkt<MP>("MULTIPOINT(1 1)")
  81. );
  82. tester::apply
  83. ("mppdf04",
  84. from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
  85. from_wkt<P>("POINT(0 0)"),
  86. from_wkt<MP>("MULTIPOINT()")
  87. );
  88. tester::apply
  89. ("mppdf05",
  90. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
  91. from_wkt<P>("POINT(1 1)"),
  92. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
  93. from_wkt<MP>("MULTIPOINT(1 1)")
  94. );
  95. tester::apply
  96. ("mppdf06",
  97. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
  98. from_wkt<P>("POINT(1 0)"),
  99. from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
  100. from_wkt<MP>("MULTIPOINT()")
  101. );
  102. tester::apply
  103. ("mppdf07",
  104. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
  105. from_wkt<P>("POINT(0 0)"),
  106. from_wkt<MP>("MULTIPOINT(1 0)"),
  107. from_wkt<MP>("MULTIPOINT()")
  108. );
  109. tester::apply
  110. ("mppdf08",
  111. from_wkt<MP>("MULTIPOINT()"),
  112. from_wkt<P>("POINT(0 0)"),
  113. from_wkt<MP>("MULTIPOINT()"),
  114. from_wkt<MP>("MULTIPOINT(0 0)")
  115. );
  116. }
  117. BOOST_AUTO_TEST_CASE( test_difference_point_multipoint )
  118. {
  119. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  120. std::cout << std::endl << std::endl << std::endl;
  121. std::cout << "*** POINT / MULTIPOINT DIFFERENCE ***" << std::endl;
  122. std::cout << std::endl;
  123. #endif
  124. typedef point_type P;
  125. typedef multi_point_type MP;
  126. typedef test_set_op_of_pointlike_geometries
  127. <
  128. P, MP, MP, bg::overlay_difference
  129. > tester;
  130. tester::apply
  131. ("pmpdf01",
  132. from_wkt<P>("POINT(0 0)"),
  133. from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1)"),
  134. from_wkt<MP>("MULTIPOINT(0 0)"),
  135. from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1)")
  136. );
  137. tester::apply
  138. ("pmpdf02",
  139. from_wkt<P>("POINT(0 0)"),
  140. from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
  141. from_wkt<MP>("MULTIPOINT()"),
  142. from_wkt<MP>("MULTIPOINT(1 0,1 1)")
  143. );
  144. tester::apply
  145. ("pmpdf03",
  146. from_wkt<P>("POINT(0 0)"),
  147. from_wkt<MP>("MULTIPOINT()"),
  148. from_wkt<MP>("MULTIPOINT(0 0)"),
  149. from_wkt<MP>("MULTIPOINT()")
  150. );
  151. }
  152. BOOST_AUTO_TEST_CASE( test_difference_multipoint_multipoint )
  153. {
  154. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  155. std::cout << std::endl << std::endl << std::endl;
  156. std::cout << "*** MULTIPOINT / MULTIPOINT DIFFERENCE ***" << std::endl;
  157. std::cout << std::endl;
  158. #endif
  159. typedef multi_point_type MP;
  160. typedef test_set_op_of_pointlike_geometries
  161. <
  162. MP, MP, MP, bg::overlay_difference
  163. > tester;
  164. tester::apply
  165. ("mpmpdf01",
  166. from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
  167. from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1,4 4)"),
  168. from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2)"),
  169. from_wkt<MP>("MULTIPOINT(4 4)")
  170. );
  171. tester::apply
  172. ("mpmpdf02",
  173. from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
  174. from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
  175. from_wkt<MP>("MULTIPOINT()")
  176. );
  177. tester::apply
  178. ("mpmpdf03",
  179. from_wkt<MP>("MULTIPOINT()"),
  180. from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
  181. from_wkt<MP>("MULTIPOINT()"),
  182. from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)")
  183. );
  184. tester::apply
  185. ("mpmpdf04",
  186. from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
  187. from_wkt<MP>("MULTIPOINT()"),
  188. from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
  189. from_wkt<MP>("MULTIPOINT()")
  190. );
  191. tester::apply
  192. ("mpmpdf05",
  193. from_wkt<MP>("MULTIPOINT()"),
  194. from_wkt<MP>("MULTIPOINT()"),
  195. from_wkt<MP>("MULTIPOINT()")
  196. );
  197. }