difference_pl_l.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 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. #ifndef BOOST_TEST_MODULE
  7. #define BOOST_TEST_MODULE test_difference_pointlike_linear
  8. #endif
  9. #include <iostream>
  10. #include <algorithm>
  11. #include <boost/test/included/unit_test.hpp>
  12. #include "../test_set_ops_pointlike.hpp"
  13. #include <boost/geometry/geometries/point.hpp>
  14. #include <boost/geometry/geometries/linestring.hpp>
  15. #include <boost/geometry/geometries/segment.hpp>
  16. #include <boost/geometry/geometries/multi_point.hpp>
  17. #include <boost/geometry/geometries/multi_linestring.hpp>
  18. typedef bg::model::point<double, 2, bg::cs::cartesian> point_type;
  19. typedef bg::model::segment<point_type> segment_type;
  20. typedef bg::model::linestring<point_type> linestring_type;
  21. typedef bg::model::multi_point<point_type> multi_point_type;
  22. typedef bg::model::multi_linestring<linestring_type> multi_linestring_type;
  23. //===========================================================================
  24. //===========================================================================
  25. //===========================================================================
  26. BOOST_AUTO_TEST_CASE( test_difference_point_segment )
  27. {
  28. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  29. std::cout << "size of std::size_t: " << sizeof(std::size_t) << std::endl;
  30. std::cout << "size of range_iterator<multipoint>: "
  31. << sizeof(boost::range_iterator<multi_point_type>::type)
  32. << std::endl;
  33. std::cout << "size of range_iterator<multilinestring>: "
  34. << sizeof(boost::range_iterator<multi_linestring_type>::type)
  35. << std::endl;
  36. std::cout << "size of point_iterator<multipoint>: "
  37. << sizeof(bg::point_iterator<multi_point_type>) << std::endl;
  38. std::cout << "size of point_iterator<linestring>: "
  39. << sizeof(bg::point_iterator<linestring_type>) << std::endl;
  40. std::cout << "size of point_iterator<multilinestring>: "
  41. << sizeof(bg::point_iterator<multi_linestring_type>) << std::endl;
  42. std::cout << "size of segment_iterator<linestring>: "
  43. << sizeof(bg::segment_iterator<linestring_type>) << std::endl;
  44. std::cout << "size of segment_iterator<multilinestring>: "
  45. << sizeof(bg::segment_iterator<multi_linestring_type>) << std::endl;
  46. std::cout << std::endl << std::endl << std::endl;
  47. std::cout << "*** POINT / SEGMENT DIFFERENCE ***" << std::endl;
  48. std::cout << std::endl;
  49. #endif
  50. typedef point_type P;
  51. typedef segment_type S;
  52. typedef multi_point_type MP;
  53. typedef test_set_op_of_pointlike_geometries
  54. <
  55. P, S, MP, bg::overlay_difference
  56. > tester;
  57. tester::apply
  58. ("psdf01",
  59. from_wkt<P>("POINT(0 0)"),
  60. from_wkt<S>("SEGMENT(1 1,2 2)"),
  61. from_wkt<MP>("MULTIPOINT(0 0)")
  62. );
  63. tester::apply
  64. ("psdf02",
  65. from_wkt<P>("POINT(0 0)"),
  66. from_wkt<S>("SEGMENT(0 0,1 1)"),
  67. from_wkt<MP>("MULTIPOINT()")
  68. );
  69. tester::apply
  70. ("psdf03",
  71. from_wkt<P>("POINT(1 1)"),
  72. from_wkt<S>("SEGMENT(0 0,2 2)"),
  73. from_wkt<MP>("MULTIPOINT()")
  74. );
  75. tester::apply
  76. ("psdf04",
  77. from_wkt<P>("POINT(3 3)"),
  78. from_wkt<S>("SEGMENT(0 0,2 2)"),
  79. from_wkt<MP>("MULTIPOINT(3 3)")
  80. );
  81. }
  82. BOOST_AUTO_TEST_CASE( test_difference_point_linestring )
  83. {
  84. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  85. std::cout << std::endl << std::endl << std::endl;
  86. std::cout << "*** POINT / LINESTRING DIFFERENCE ***" << std::endl;
  87. std::cout << std::endl;
  88. #endif
  89. typedef point_type P;
  90. typedef linestring_type L;
  91. typedef multi_point_type MP;
  92. typedef test_set_op_of_pointlike_geometries
  93. <
  94. P, L, MP, bg::overlay_difference
  95. > tester;
  96. tester::apply
  97. ("pldf01",
  98. from_wkt<P>("POINT(0 0)"),
  99. from_wkt<L>("LINESTRING(1 1,2 2)"),
  100. from_wkt<MP>("MULTIPOINT(0 0)")
  101. );
  102. tester::apply
  103. ("pldf02",
  104. from_wkt<P>("POINT(0 0)"),
  105. from_wkt<L>("LINESTRING(0 0,1 1)"),
  106. from_wkt<MP>("MULTIPOINT()")
  107. );
  108. tester::apply
  109. ("pldf03",
  110. from_wkt<P>("POINT(1 1)"),
  111. from_wkt<L>("LINESTRING(0 0,2 2)"),
  112. from_wkt<MP>("MULTIPOINT()")
  113. );
  114. tester::apply
  115. ("pldf04",
  116. from_wkt<P>("POINT(3 3)"),
  117. from_wkt<L>("LINESTRING(0 0,2 2)"),
  118. from_wkt<MP>("MULTIPOINT(3 3)")
  119. );
  120. // linestrings with more than two points
  121. tester::apply
  122. ("pldf05",
  123. from_wkt<P>("POINT(1 1)"),
  124. from_wkt<L>("LINESTRING(0 0,1 1,2 2)"),
  125. from_wkt<MP>("MULTIPOINT()")
  126. );
  127. tester::apply
  128. ("pldf06",
  129. from_wkt<P>("POINT(2 2)"),
  130. from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
  131. from_wkt<MP>("MULTIPOINT()")
  132. );
  133. tester::apply
  134. ("pldf07",
  135. from_wkt<P>("POINT(10 10)"),
  136. from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
  137. from_wkt<MP>("MULTIPOINT(10 10)")
  138. );
  139. tester::apply
  140. ("pldf08",
  141. from_wkt<P>("POINT(0 1)"),
  142. from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
  143. from_wkt<MP>("MULTIPOINT(0 1)")
  144. );
  145. tester::apply
  146. ("pldf09",
  147. from_wkt<P>("POINT(4 4)"),
  148. from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
  149. from_wkt<MP>("MULTIPOINT()")
  150. );
  151. tester::apply
  152. ("pldf10",
  153. from_wkt<P>("POINT(0 0)"),
  154. from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
  155. from_wkt<MP>("MULTIPOINT()")
  156. );
  157. }
  158. BOOST_AUTO_TEST_CASE( test_difference_point_multilinestring )
  159. {
  160. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  161. std::cout << std::endl << std::endl << std::endl;
  162. std::cout << "*** POINT / MULTILINESTRING DIFFERENCE ***" << std::endl;
  163. std::cout << std::endl;
  164. #endif
  165. typedef point_type P;
  166. typedef multi_linestring_type ML;
  167. typedef multi_point_type MP;
  168. typedef test_set_op_of_pointlike_geometries
  169. <
  170. P, ML, MP, bg::overlay_difference
  171. > tester;
  172. tester::apply
  173. ("pmldf01",
  174. from_wkt<P>("POINT(0 0)"),
  175. from_wkt<ML>("MULTILINESTRING((1 1,2 2))"),
  176. from_wkt<MP>("MULTIPOINT(0 0)")
  177. );
  178. tester::apply
  179. ("pmldf02",
  180. from_wkt<P>("POINT(0 0)"),
  181. from_wkt<ML>("MULTILINESTRING((0 0,1 1))"),
  182. from_wkt<MP>("MULTIPOINT()")
  183. );
  184. tester::apply
  185. ("pmldf03",
  186. from_wkt<P>("POINT(1 1)"),
  187. from_wkt<ML>("MULTILINESTRING((0 0,2 2))"),
  188. from_wkt<MP>("MULTIPOINT()")
  189. );
  190. tester::apply
  191. ("pmldf04",
  192. from_wkt<P>("POINT(3 3)"),
  193. from_wkt<ML>("MULTILINESTRING((0 0,2 2))"),
  194. from_wkt<MP>("MULTIPOINT(3 3)")
  195. );
  196. // linestrings with more than two points
  197. tester::apply
  198. ("pmldf05",
  199. from_wkt<P>("POINT(1 1)"),
  200. from_wkt<ML>("MULTILINESTRING((0 0,1 1,2 2))"),
  201. from_wkt<MP>("MULTIPOINT()")
  202. );
  203. tester::apply
  204. ("pmldf06",
  205. from_wkt<P>("POINT(2 2)"),
  206. from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
  207. from_wkt<MP>("MULTIPOINT()")
  208. );
  209. tester::apply
  210. ("pmldf07",
  211. from_wkt<P>("POINT(10 10)"),
  212. from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
  213. from_wkt<MP>("MULTIPOINT(10 10)")
  214. );
  215. tester::apply
  216. ("pmldf08",
  217. from_wkt<P>("POINT(0 1)"),
  218. from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
  219. from_wkt<MP>("MULTIPOINT(0 1)")
  220. );
  221. tester::apply
  222. ("pmldf09",
  223. from_wkt<P>("POINT(4 4)"),
  224. from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
  225. from_wkt<MP>("MULTIPOINT()")
  226. );
  227. tester::apply
  228. ("pmldf10",
  229. from_wkt<P>("POINT(0 0)"),
  230. from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
  231. from_wkt<MP>("MULTIPOINT()")
  232. );
  233. // multilinestrings with more than one linestring
  234. tester::apply
  235. ("pmldf11",
  236. from_wkt<P>("POINT(0 0)"),
  237. from_wkt<ML>("MULTILINESTRING((-10,-10),(0 0,1 1,4 4))"),
  238. from_wkt<MP>("MULTIPOINT()")
  239. );
  240. tester::apply
  241. ("pmldf12",
  242. from_wkt<P>("POINT(0 0)"),
  243. from_wkt<ML>("MULTILINESTRING((-10 0,0 0,10 0),(0 0,1 1,4 4))"),
  244. from_wkt<MP>("MULTIPOINT()")
  245. );
  246. tester::apply
  247. ("pmldf13",
  248. from_wkt<P>("POINT(0 0)"),
  249. from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
  250. from_wkt<MP>("MULTIPOINT()")
  251. );
  252. tester::apply
  253. ("pmldf14",
  254. from_wkt<P>("POINT(-20 0)"),
  255. from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
  256. from_wkt<MP>("MULTIPOINT(-20 0)")
  257. );
  258. tester::apply
  259. ("pmldf15",
  260. from_wkt<P>("POINT(0 1)"),
  261. from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
  262. from_wkt<MP>("MULTIPOINT(0 1)")
  263. );
  264. }
  265. BOOST_AUTO_TEST_CASE( test_difference_multipoint_segment )
  266. {
  267. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  268. std::cout << std::endl << std::endl << std::endl;
  269. std::cout << "*** MULTIPOINT / SEGMENT DIFFERENCE ***" << std::endl;
  270. std::cout << std::endl;
  271. #endif
  272. typedef multi_point_type MP;
  273. typedef segment_type S;
  274. typedef test_set_op_of_pointlike_geometries
  275. <
  276. MP, S, MP, bg::overlay_difference
  277. > tester;
  278. tester::apply
  279. ("mpsdf01",
  280. from_wkt<MP>("MULTIPOINT(0 0)"),
  281. from_wkt<S>("SEGMENT(1 1,2 2)"),
  282. from_wkt<MP>("MULTIPOINT(0 0)")
  283. );
  284. tester::apply
  285. ("mpsdf02",
  286. from_wkt<MP>("MULTIPOINT(0 0)"),
  287. from_wkt<S>("SEGMENT(0 0,1 1)"),
  288. from_wkt<MP>("MULTIPOINT()")
  289. );
  290. tester::apply
  291. ("mpsdf03",
  292. from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
  293. from_wkt<S>("SEGMENT(1 1,2 2)"),
  294. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  295. );
  296. tester::apply
  297. ("mpsdf04",
  298. from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
  299. from_wkt<S>("SEGMENT(0 0,1 1)"),
  300. from_wkt<MP>("MULTIPOINT()")
  301. );
  302. tester::apply
  303. ("mpsdf05",
  304. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
  305. from_wkt<S>("SEGMENT(1 1,2 2)"),
  306. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)")
  307. );
  308. tester::apply
  309. ("mpsf06",
  310. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
  311. from_wkt<S>("SEGMENT(1 0,2 0)"),
  312. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  313. );
  314. tester::apply
  315. ("mpsdf07",
  316. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  317. from_wkt<S>("SEGMENT(0 0,1 0)"),
  318. from_wkt<MP>("MULTIPOINT(2 0)")
  319. );
  320. tester::apply
  321. ("mpsdf08",
  322. from_wkt<MP>("MULTIPOINT()"),
  323. from_wkt<S>("SEGMENT(0 0,1 1)"),
  324. from_wkt<MP>("MULTIPOINT()")
  325. );
  326. tester::apply
  327. ("mpsdf09",
  328. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  329. from_wkt<S>("SEGMENT(-1 0,1 0)"),
  330. from_wkt<MP>("MULTIPOINT(2 0)")
  331. );
  332. tester::apply
  333. ("mpsdf10",
  334. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  335. from_wkt<S>("SEGMENT(1 0,3 0)"),
  336. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  337. );
  338. tester::apply
  339. ("mpsdf11",
  340. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  341. from_wkt<S>("SEGMENT(-1 0,3 0)"),
  342. from_wkt<MP>("MULTIPOINT()")
  343. );
  344. tester::apply
  345. ("mpsdf12",
  346. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  347. from_wkt<S>("SEGMENT(3 0,3 0)"),
  348. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
  349. );
  350. tester::apply
  351. ("mpsdf12a",
  352. from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0)"),
  353. from_wkt<S>("SEGMENT(3 0,3 0)"),
  354. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
  355. );
  356. tester::apply
  357. ("mpsdf12b",
  358. from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0)"),
  359. from_wkt<S>("SEGMENT(3 0,3 0)"),
  360. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0,2 0)")
  361. );
  362. tester::apply
  363. ("mpsdf12c",
  364. from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0,0 0)"),
  365. from_wkt<S>("SEGMENT(3 0,3 0)"),
  366. from_wkt<MP>("MULTIPOINT(0 0,0 0,0 0,2 0,2 0)")
  367. );
  368. tester::apply
  369. ("mpsdf13",
  370. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  371. from_wkt<S>("SEGMENT(2 0,2 0)"),
  372. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  373. );
  374. tester::apply
  375. ("mpsdf14",
  376. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  377. from_wkt<S>("SEGMENT(0 0,0 0)"),
  378. from_wkt<MP>("MULTIPOINT(2 0)")
  379. );
  380. tester::apply
  381. ("mpsdf15",
  382. from_wkt<MP>("MULTIPOINT()"),
  383. from_wkt<S>("SEGMENT(0 0,1 0)"),
  384. from_wkt<MP>("MULTIPOINT()")
  385. );
  386. }
  387. BOOST_AUTO_TEST_CASE( test_difference_multipoint_linestring )
  388. {
  389. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  390. std::cout << std::endl << std::endl << std::endl;
  391. std::cout << "*** MULTIPOINT / LINESTRING DIFFERENCE ***" << std::endl;
  392. std::cout << std::endl;
  393. #endif
  394. typedef multi_point_type MP;
  395. typedef linestring_type L;
  396. typedef test_set_op_of_pointlike_geometries
  397. <
  398. MP, L, MP, bg::overlay_difference
  399. > tester;
  400. tester::apply
  401. ("mpldf01",
  402. from_wkt<MP>("MULTIPOINT(0 0)"),
  403. from_wkt<L>("LINESTRING(1 1,2 2,3 3,4 4,5 5)"),
  404. from_wkt<MP>("MULTIPOINT(0 0)")
  405. );
  406. tester::apply
  407. ("mpldf02",
  408. from_wkt<MP>("MULTIPOINT(0 0)"),
  409. from_wkt<L>("LINESTRING(0 0,1 1)"),
  410. from_wkt<MP>("MULTIPOINT()")
  411. );
  412. tester::apply
  413. ("mpldf03",
  414. from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
  415. from_wkt<L>("LINESTRING(1 1,2 2)"),
  416. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  417. );
  418. tester::apply
  419. ("mpldf04",
  420. from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
  421. from_wkt<L>("LINESTRING(0 0,1 1)"),
  422. from_wkt<MP>("MULTIPOINT()")
  423. );
  424. tester::apply
  425. ("mpldf05",
  426. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
  427. from_wkt<L>("LINESTRING(1 1,2 2)"),
  428. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)")
  429. );
  430. tester::apply
  431. ("mplf06",
  432. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
  433. from_wkt<L>("LINESTRING(1 0,2 0)"),
  434. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  435. );
  436. tester::apply
  437. ("mpldf07",
  438. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  439. from_wkt<L>("LINESTRING(0 0,1 0)"),
  440. from_wkt<MP>("MULTIPOINT(2 0)")
  441. );
  442. tester::apply
  443. ("mpldf08",
  444. from_wkt<MP>("MULTIPOINT()"),
  445. from_wkt<L>("LINESTRING(0 0,1 1)"),
  446. from_wkt<MP>("MULTIPOINT()")
  447. );
  448. tester::apply
  449. ("mpldf09",
  450. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  451. from_wkt<L>("LINESTRING(-1 0,1 0)"),
  452. from_wkt<MP>("MULTIPOINT(2 0)")
  453. );
  454. tester::apply
  455. ("mpldf10",
  456. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  457. from_wkt<L>("LINESTRING(1 0,3 0)"),
  458. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  459. );
  460. tester::apply
  461. ("mpldf11",
  462. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  463. from_wkt<L>("LINESTRING(-1 0,3 0)"),
  464. from_wkt<MP>("MULTIPOINT()")
  465. );
  466. tester::apply
  467. ("mpldf12",
  468. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  469. from_wkt<L>("LINESTRING(3 0,3 0)"),
  470. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
  471. );
  472. tester::apply
  473. ("mpldf13",
  474. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  475. from_wkt<L>("LINESTRING(2 0,2 0)"),
  476. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  477. );
  478. tester::apply
  479. ("mpldf14",
  480. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  481. from_wkt<L>("LINESTRING(0 0,0 0)"),
  482. from_wkt<MP>("MULTIPOINT(2 0)")
  483. );
  484. tester::apply
  485. ("mpldf15",
  486. from_wkt<MP>("MULTIPOINT()"),
  487. from_wkt<L>("LINESTRING(0 0,1 0,2 0,3 0)"),
  488. from_wkt<MP>("MULTIPOINT()")
  489. );
  490. tester::apply
  491. ("mpldf16",
  492. from_wkt<MP>("MULTIPOINT()"),
  493. from_wkt<L>("LINESTRING()"),
  494. from_wkt<MP>("MULTIPOINT()")
  495. );
  496. }
  497. BOOST_AUTO_TEST_CASE( test_difference_multipoint_multilinestring )
  498. {
  499. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  500. std::cout << std::endl << std::endl << std::endl;
  501. std::cout << "*** MULTIPOINT / MULTILINESTRING DIFFERENCE ***" << std::endl;
  502. std::cout << std::endl;
  503. #endif
  504. typedef multi_point_type MP;
  505. typedef multi_linestring_type ML;
  506. typedef test_set_op_of_pointlike_geometries
  507. <
  508. MP, ML, MP, bg::overlay_difference
  509. > tester;
  510. tester::apply
  511. ("mpmldf01",
  512. from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0)"),
  513. from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
  514. from_wkt<MP>("MULTIPOINT(0 0,2 0)")
  515. );
  516. tester::apply
  517. ("mpmldf02",
  518. from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
  519. from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
  520. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  521. );
  522. tester::apply
  523. ("mpmldf03",
  524. from_wkt<MP>("MULTIPOINT(5 5,3 3,0 0,0 0,5 5,1 1,1 1,1 0,1 0)"),
  525. from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
  526. from_wkt<MP>("MULTIPOINT(5 5,5 5,0 0,0 0)")
  527. );
  528. tester::apply
  529. ("mpmldf04",
  530. from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
  531. from_wkt<ML>("MULTILINESTRING((1 0,0 0,1 1,0 0))"),
  532. from_wkt<MP>("MULTIPOINT()")
  533. );
  534. tester::apply
  535. ("mpmldf05",
  536. from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,5 0)"),
  537. from_wkt<ML>("MULTILINESTRING((0 1,0 0,1 2,1 0),\
  538. (0 1,2 0,0 10,2 0,2 10,5 10,5 0,5 10))"),
  539. from_wkt<MP>("MULTIPOINT()")
  540. );
  541. tester::apply
  542. ("mpmldf05a",
  543. from_wkt<MP>("MULTIPOINT(0 0,1 0,6 0,7 0,2 0,5 0,7 0,8 0)"),
  544. from_wkt<ML>("MULTILINESTRING((0 1,0 0,1 2,1 0),\
  545. (0 1,2 0,0 10,2 0,2 10,5 10,5 0,5 10))"),
  546. from_wkt<MP>("MULTIPOINT(7 0,7 0,8 0,6 0)")
  547. );
  548. tester::apply
  549. ("mpmldf06",
  550. from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
  551. from_wkt<ML>("MULTILINESTRING(())"),
  552. from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)")
  553. );
  554. tester::apply
  555. ("mpmldf07",
  556. from_wkt<MP>("MULTIPOINT()"),
  557. from_wkt<ML>("MULTILINESTRING(())"),
  558. from_wkt<MP>("MULTIPOINT()")
  559. );
  560. tester::apply
  561. ("mpmldf08",
  562. from_wkt<MP>("MULTIPOINT()"),
  563. from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0))"),
  564. from_wkt<MP>("MULTIPOINT()")
  565. );
  566. }