intersection_pl_l.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  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_intersection_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_intersection_point_segment )
  27. {
  28. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  29. std::cout << std::endl << std::endl << std::endl;
  30. std::cout << "*** POINT / SEGMENT INTERSECTION ***" << std::endl;
  31. std::cout << std::endl;
  32. #endif
  33. typedef point_type P;
  34. typedef segment_type S;
  35. typedef multi_point_type MP;
  36. typedef test_set_op_of_pointlike_geometries
  37. <
  38. P, S, MP, bg::overlay_intersection
  39. > tester;
  40. tester::apply
  41. ("psi01",
  42. from_wkt<P>("POINT(0 0)"),
  43. from_wkt<S>("SEGMENT(1 1,2 2)"),
  44. from_wkt<MP>("MULTIPOINT()")
  45. );
  46. tester::apply
  47. ("psi02",
  48. from_wkt<P>("POINT(0 0)"),
  49. from_wkt<S>("SEGMENT(0 0,1 1)"),
  50. from_wkt<MP>("MULTIPOINT(0 0)")
  51. );
  52. tester::apply
  53. ("psi03",
  54. from_wkt<P>("POINT(1 1)"),
  55. from_wkt<S>("SEGMENT(0 0,2 2)"),
  56. from_wkt<MP>("MULTIPOINT(1 1)")
  57. );
  58. tester::apply
  59. ("psi04",
  60. from_wkt<P>("POINT(3 3)"),
  61. from_wkt<S>("SEGMENT(0 0,2 2)"),
  62. from_wkt<MP>("MULTIPOINT()")
  63. );
  64. }
  65. BOOST_AUTO_TEST_CASE( test_intersection_point_linestring )
  66. {
  67. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  68. std::cout << std::endl << std::endl << std::endl;
  69. std::cout << "*** POINT / LINESTRING INTERSECTION ***" << std::endl;
  70. std::cout << std::endl;
  71. #endif
  72. typedef point_type P;
  73. typedef linestring_type L;
  74. typedef multi_point_type MP;
  75. typedef test_set_op_of_pointlike_geometries
  76. <
  77. P, L, MP, bg::overlay_intersection
  78. > tester;
  79. tester::apply
  80. ("pli01",
  81. from_wkt<P>("POINT(0 0)"),
  82. from_wkt<L>("LINESTRING(1 1,2 2)"),
  83. from_wkt<MP>("MULTIPOINT()")
  84. );
  85. tester::apply
  86. ("pli02",
  87. from_wkt<P>("POINT(0 0)"),
  88. from_wkt<L>("LINESTRING(0 0,1 1)"),
  89. from_wkt<MP>("MULTIPOINT(0 0)")
  90. );
  91. tester::apply
  92. ("pli03",
  93. from_wkt<P>("POINT(1 1)"),
  94. from_wkt<L>("LINESTRING(0 0,2 2)"),
  95. from_wkt<MP>("MULTIPOINT(1 1)")
  96. );
  97. tester::apply
  98. ("pli04",
  99. from_wkt<P>("POINT(3 3)"),
  100. from_wkt<L>("LINESTRING(0 0,2 2)"),
  101. from_wkt<MP>("MULTIPOINT()")
  102. );
  103. // linestrings with more than two points
  104. tester::apply
  105. ("pli05",
  106. from_wkt<P>("POINT(1 1)"),
  107. from_wkt<L>("LINESTRING(0 0,1 1,2 2)"),
  108. from_wkt<MP>("MULTIPOINT(1 1)")
  109. );
  110. tester::apply
  111. ("pli06",
  112. from_wkt<P>("POINT(2 2)"),
  113. from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
  114. from_wkt<MP>("MULTIPOINT(2 2)")
  115. );
  116. tester::apply
  117. ("pli07",
  118. from_wkt<P>("POINT(10 10)"),
  119. from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
  120. from_wkt<MP>("MULTIPOINT()")
  121. );
  122. tester::apply
  123. ("pli08",
  124. from_wkt<P>("POINT(0 1)"),
  125. from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
  126. from_wkt<MP>("MULTIPOINT()")
  127. );
  128. tester::apply
  129. ("pli09",
  130. from_wkt<P>("POINT(4 4)"),
  131. from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
  132. from_wkt<MP>("MULTIPOINT(4 4)")
  133. );
  134. tester::apply
  135. ("pli10",
  136. from_wkt<P>("POINT(0 0)"),
  137. from_wkt<L>("LINESTRING(0 0,1 1,4 4)"),
  138. from_wkt<MP>("MULTIPOINT(0 0)")
  139. );
  140. }
  141. BOOST_AUTO_TEST_CASE( test_intersection_point_multilinestring )
  142. {
  143. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  144. std::cout << std::endl << std::endl << std::endl;
  145. std::cout << "*** POINT / MULTILINESTRING INTERSECTION ***" << std::endl;
  146. std::cout << std::endl;
  147. #endif
  148. typedef point_type P;
  149. typedef multi_linestring_type ML;
  150. typedef multi_point_type MP;
  151. typedef test_set_op_of_pointlike_geometries
  152. <
  153. P, ML, MP, bg::overlay_intersection
  154. > tester;
  155. tester::apply
  156. ("pmli01",
  157. from_wkt<P>("POINT(0 0)"),
  158. from_wkt<ML>("MULTILINESTRING((1 1,2 2))"),
  159. from_wkt<MP>("MULTIPOINT()")
  160. );
  161. tester::apply
  162. ("pmli02",
  163. from_wkt<P>("POINT(0 0)"),
  164. from_wkt<ML>("MULTILINESTRING((0 0,1 1))"),
  165. from_wkt<MP>("MULTIPOINT(0 0)")
  166. );
  167. tester::apply
  168. ("pmli03",
  169. from_wkt<P>("POINT(1 1)"),
  170. from_wkt<ML>("MULTILINESTRING((0 0,2 2))"),
  171. from_wkt<MP>("MULTIPOINT(1 1)")
  172. );
  173. tester::apply
  174. ("pmli04",
  175. from_wkt<P>("POINT(3 3)"),
  176. from_wkt<ML>("MULTILINESTRING((0 0,2 2))"),
  177. from_wkt<MP>("MULTIPOINT()")
  178. );
  179. // linestrings with more than two points
  180. tester::apply
  181. ("pmli05",
  182. from_wkt<P>("POINT(1 1)"),
  183. from_wkt<ML>("MULTILINESTRING((0 0,1 1,2 2))"),
  184. from_wkt<MP>("MULTIPOINT(1 1)")
  185. );
  186. tester::apply
  187. ("pmli06",
  188. from_wkt<P>("POINT(2 2)"),
  189. from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
  190. from_wkt<MP>("MULTIPOINT(2 2)")
  191. );
  192. tester::apply
  193. ("pmli07",
  194. from_wkt<P>("POINT(10 10)"),
  195. from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
  196. from_wkt<MP>("MULTIPOINT()")
  197. );
  198. tester::apply
  199. ("pmli08",
  200. from_wkt<P>("POINT(0 1)"),
  201. from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
  202. from_wkt<MP>("MULTIPOINT()")
  203. );
  204. tester::apply
  205. ("pmli09",
  206. from_wkt<P>("POINT(4 4)"),
  207. from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
  208. from_wkt<MP>("MULTIPOINT(4 4)")
  209. );
  210. tester::apply
  211. ("pmli10",
  212. from_wkt<P>("POINT(0 0)"),
  213. from_wkt<ML>("MULTILINESTRING((0 0,1 1,4 4))"),
  214. from_wkt<MP>("MULTIPOINT(0 0)")
  215. );
  216. // multilinestrings with more than one linestring
  217. tester::apply
  218. ("pmli11",
  219. from_wkt<P>("POINT(0 0)"),
  220. from_wkt<ML>("MULTILINESTRING((-10,-10),(0 0,1 1,4 4))"),
  221. from_wkt<MP>("MULTIPOINT(0 0)")
  222. );
  223. tester::apply
  224. ("pmli12",
  225. from_wkt<P>("POINT(0 0)"),
  226. from_wkt<ML>("MULTILINESTRING((-10 0,0 0,10 0),(0 0,1 1,4 4))"),
  227. from_wkt<MP>("MULTIPOINT(0 0)")
  228. );
  229. tester::apply
  230. ("pmli13",
  231. from_wkt<P>("POINT(0 0)"),
  232. from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
  233. from_wkt<MP>("MULTIPOINT(0 0)")
  234. );
  235. tester::apply
  236. ("pmli14",
  237. from_wkt<P>("POINT(-20 0)"),
  238. from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
  239. from_wkt<MP>("MULTIPOINT()")
  240. );
  241. tester::apply
  242. ("pmli15",
  243. from_wkt<P>("POINT(0 1)"),
  244. from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 0,1 1,4 4))"),
  245. from_wkt<MP>("MULTIPOINT()")
  246. );
  247. tester::apply
  248. ("pmli16",
  249. from_wkt<P>("POINT(1 0)"),
  250. from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(-1 0,2 0,20 0))"),
  251. from_wkt<MP>("MULTIPOINT(1 0)")
  252. );
  253. tester::apply
  254. ("pmli17",
  255. from_wkt<P>("POINT(1 0)"),
  256. from_wkt<ML>("MULTILINESTRING((-10 0,10 0),(0 -1,0 2,0 4))"),
  257. from_wkt<MP>("MULTIPOINT(1 0)")
  258. );
  259. }
  260. BOOST_AUTO_TEST_CASE( test_intersection_multipoint_segment )
  261. {
  262. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  263. std::cout << std::endl << std::endl << std::endl;
  264. std::cout << "*** MULTIPOINT / SEGMENT INTERSECTION ***" << std::endl;
  265. std::cout << std::endl;
  266. #endif
  267. typedef multi_point_type MP;
  268. typedef segment_type S;
  269. typedef test_set_op_of_pointlike_geometries
  270. <
  271. MP, S, MP, bg::overlay_intersection
  272. > tester;
  273. tester::apply
  274. ("mpsi01",
  275. from_wkt<MP>("MULTIPOINT(0 0)"),
  276. from_wkt<S>("SEGMENT(1 1,2 2)"),
  277. from_wkt<MP>("MULTIPOINT()")
  278. );
  279. tester::apply
  280. ("mpsi02",
  281. from_wkt<MP>("MULTIPOINT(0 0)"),
  282. from_wkt<S>("SEGMENT(0 0,1 1)"),
  283. from_wkt<MP>("MULTIPOINT(0 0)")
  284. );
  285. tester::apply
  286. ("mpsi03",
  287. from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
  288. from_wkt<S>("SEGMENT(1 1,2 2)"),
  289. from_wkt<MP>("MULTIPOINT()")
  290. );
  291. tester::apply
  292. ("mpsi04",
  293. from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
  294. from_wkt<S>("SEGMENT(0 0,1 1)"),
  295. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  296. );
  297. tester::apply
  298. ("mpsi05",
  299. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
  300. from_wkt<S>("SEGMENT(1 1,2 2)"),
  301. from_wkt<MP>("MULTIPOINT()")
  302. );
  303. tester::apply
  304. ("mpsf06",
  305. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
  306. from_wkt<S>("SEGMENT(1 0,2 0)"),
  307. from_wkt<MP>("MULTIPOINT(1 0)")
  308. );
  309. tester::apply
  310. ("mpsi07",
  311. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  312. from_wkt<S>("SEGMENT(0 0,1 0)"),
  313. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  314. );
  315. tester::apply
  316. ("mpsi07a",
  317. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  318. from_wkt<S>("SEGMENT(0 0,3 0)"),
  319. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
  320. );
  321. tester::apply
  322. ("mpsi08",
  323. from_wkt<MP>("MULTIPOINT()"),
  324. from_wkt<S>("SEGMENT(0 0,1 1)"),
  325. from_wkt<MP>("MULTIPOINT()")
  326. );
  327. tester::apply
  328. ("mpsi09",
  329. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  330. from_wkt<S>("SEGMENT(-1 0,1 0)"),
  331. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  332. );
  333. tester::apply
  334. ("mpsi10",
  335. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  336. from_wkt<S>("SEGMENT(1 0,3 0)"),
  337. from_wkt<MP>("MULTIPOINT(2 0)")
  338. );
  339. tester::apply
  340. ("mpsi11",
  341. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  342. from_wkt<S>("SEGMENT(-1 0,3 0)"),
  343. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)")
  344. );
  345. tester::apply
  346. ("mpsi12",
  347. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  348. from_wkt<S>("SEGMENT(3 0,3 0)"),
  349. from_wkt<MP>("MULTIPOINT()")
  350. );
  351. tester::apply
  352. ("mpsi12a",
  353. from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0)"),
  354. from_wkt<S>("SEGMENT(3 0,3 0)"),
  355. from_wkt<MP>("MULTIPOINT()")
  356. );
  357. tester::apply
  358. ("mpsi12b",
  359. from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0)"),
  360. from_wkt<S>("SEGMENT(3 0,3 0)"),
  361. from_wkt<MP>("MULTIPOINT()")
  362. );
  363. tester::apply
  364. ("mpsi12c",
  365. from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0,0 0)"),
  366. from_wkt<S>("SEGMENT(3 0,3 0)"),
  367. from_wkt<MP>("MULTIPOINT()")
  368. );
  369. tester::apply
  370. ("mpsi13",
  371. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  372. from_wkt<S>("SEGMENT(2 0,2 0)"),
  373. from_wkt<MP>("MULTIPOINT(2 0)")
  374. );
  375. tester::apply
  376. ("mpsi14",
  377. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  378. from_wkt<S>("SEGMENT(0 0,0 0)"),
  379. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  380. );
  381. tester::apply
  382. ("mpsi15",
  383. from_wkt<MP>("MULTIPOINT()"),
  384. from_wkt<S>("SEGMENT(0 0,1 0)"),
  385. from_wkt<MP>("MULTIPOINT()")
  386. );
  387. tester::apply
  388. ("mpsi16",
  389. from_wkt<MP>("MULTIPOINT(0 0,2 0,0 0,2 0,0 0)"),
  390. from_wkt<S>("SEGMENT(-1 0,10 0)"),
  391. from_wkt<MP>("MULTIPOINT(0 0,0 0,0 0,2 0,2 0)")
  392. );
  393. }
  394. BOOST_AUTO_TEST_CASE( test_intersection_multipoint_linestring )
  395. {
  396. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  397. std::cout << std::endl << std::endl << std::endl;
  398. std::cout << "*** MULTIPOINT / LINESTRING INTERSECTION ***" << std::endl;
  399. std::cout << std::endl;
  400. #endif
  401. typedef multi_point_type MP;
  402. typedef linestring_type L;
  403. typedef test_set_op_of_pointlike_geometries
  404. <
  405. MP, L, MP, bg::overlay_intersection
  406. > tester;
  407. tester::apply
  408. ("mpli01",
  409. from_wkt<MP>("MULTIPOINT(0 0)"),
  410. from_wkt<L>("LINESTRING(1 1,2 2,3 3,4 4,5 5)"),
  411. from_wkt<MP>("MULTIPOINT()")
  412. );
  413. tester::apply
  414. ("mpli02",
  415. from_wkt<MP>("MULTIPOINT(0 0)"),
  416. from_wkt<L>("LINESTRING(0 0,1 1)"),
  417. from_wkt<MP>("MULTIPOINT(0 0)")
  418. );
  419. tester::apply
  420. ("mpli03",
  421. from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
  422. from_wkt<L>("LINESTRING(1 1,2 2)"),
  423. from_wkt<MP>("MULTIPOINT()")
  424. );
  425. tester::apply
  426. ("mpli04",
  427. from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
  428. from_wkt<L>("LINESTRING(0 0,1 1)"),
  429. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  430. );
  431. tester::apply
  432. ("mpli05",
  433. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
  434. from_wkt<L>("LINESTRING(1 1,2 2)"),
  435. from_wkt<MP>("MULTIPOINT()")
  436. );
  437. tester::apply
  438. ("mpli06",
  439. from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
  440. from_wkt<L>("LINESTRING(1 0,2 0)"),
  441. from_wkt<MP>("MULTIPOINT(1 0)")
  442. );
  443. tester::apply
  444. ("mpli07",
  445. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  446. from_wkt<L>("LINESTRING(0 0,1 0)"),
  447. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  448. );
  449. tester::apply
  450. ("mpli08",
  451. from_wkt<MP>("MULTIPOINT()"),
  452. from_wkt<L>("LINESTRING(0 0,1 1)"),
  453. from_wkt<MP>("MULTIPOINT()")
  454. );
  455. tester::apply
  456. ("mpli09",
  457. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  458. from_wkt<L>("LINESTRING(-1 0,1 0)"),
  459. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  460. );
  461. tester::apply
  462. ("mpli10",
  463. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  464. from_wkt<L>("LINESTRING(1 0,3 0)"),
  465. from_wkt<MP>("MULTIPOINT(2 0)")
  466. );
  467. tester::apply
  468. ("mpli10a",
  469. from_wkt<MP>("MULTIPOINT(2 0,0 0,2 0,0 0,2 0)"),
  470. from_wkt<L>("LINESTRING(1 0,3 0)"),
  471. from_wkt<MP>("MULTIPOINT(2 0,2 0,2 0)")
  472. );
  473. tester::apply
  474. ("mpli11",
  475. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  476. from_wkt<L>("LINESTRING(-1 0,3 0)"),
  477. from_wkt<MP>("MULTIPOINT(2 0,0 0,0 0)")
  478. );
  479. tester::apply
  480. ("mpli12",
  481. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  482. from_wkt<L>("LINESTRING(3 0,3 0)"),
  483. from_wkt<MP>("MULTIPOINT()")
  484. );
  485. tester::apply
  486. ("mpli13",
  487. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  488. from_wkt<L>("LINESTRING(2 0,2 0)"),
  489. from_wkt<MP>("MULTIPOINT(2 0)")
  490. );
  491. tester::apply
  492. ("mpli14",
  493. from_wkt<MP>("MULTIPOINT(0 0,0 0,2 0)"),
  494. from_wkt<L>("LINESTRING(0 0,0 0)"),
  495. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  496. );
  497. tester::apply
  498. ("mpli15",
  499. from_wkt<MP>("MULTIPOINT()"),
  500. from_wkt<L>("LINESTRING(0 0,1 0,2 0,3 0)"),
  501. from_wkt<MP>("MULTIPOINT()")
  502. );
  503. tester::apply
  504. ("mpli16",
  505. from_wkt<MP>("MULTIPOINT()"),
  506. from_wkt<L>("LINESTRING()"),
  507. from_wkt<MP>("MULTIPOINT()")
  508. );
  509. }
  510. BOOST_AUTO_TEST_CASE( test_intersection_multipoint_multilinestring )
  511. {
  512. #ifdef BOOST_GEOMETRY_TEST_DEBUG
  513. std::cout << std::endl << std::endl << std::endl;
  514. std::cout << "*** MULTIPOINT / MULTILINESTRING INTERSECTION ***"
  515. << std::endl;
  516. std::cout << std::endl;
  517. #endif
  518. typedef multi_point_type MP;
  519. typedef multi_linestring_type ML;
  520. typedef test_set_op_of_pointlike_geometries
  521. <
  522. MP, ML, MP, bg::overlay_intersection
  523. > tester;
  524. tester::apply
  525. ("mpmli01",
  526. from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0)"),
  527. from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
  528. from_wkt<MP>("MULTIPOINT(1 0)")
  529. );
  530. tester::apply
  531. ("mpmli02",
  532. from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
  533. from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
  534. from_wkt<MP>("MULTIPOINT(2 2,2 2,3 3,1 1,1 1,1 0,1 0)")
  535. );
  536. tester::apply
  537. ("mpmli03",
  538. from_wkt<MP>("MULTIPOINT(5 5,3 3,0 0,0 0,5 5,1 1,1 1,1 0,1 0)"),
  539. from_wkt<ML>("MULTILINESTRING((1 0,1 1,1 1,4 4))"),
  540. from_wkt<MP>("MULTIPOINT(1 0,1 0,3 3,1 1,1 1)")
  541. );
  542. tester::apply
  543. ("mpmli04",
  544. from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
  545. from_wkt<ML>("MULTILINESTRING((1 0,0 0,1 1,0 0))"),
  546. from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,1 1)")
  547. );
  548. tester::apply
  549. ("mpmli05",
  550. from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,5 0)"),
  551. from_wkt<ML>("MULTILINESTRING((0 1,0 0,1 2,1 0),\
  552. (0 1,2 0,0 10,2 0,2 10,5 10,5 0,5 10))"),
  553. from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,5 0)")
  554. );
  555. tester::apply
  556. ("mpmli06",
  557. from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
  558. from_wkt<ML>("MULTILINESTRING(())"),
  559. from_wkt<MP>("MULTIPOINT()")
  560. );
  561. tester::apply
  562. ("mpmli07",
  563. from_wkt<MP>("MULTIPOINT()"),
  564. from_wkt<ML>("MULTILINESTRING(())"),
  565. from_wkt<MP>("MULTIPOINT()")
  566. );
  567. tester::apply
  568. ("mpmli08",
  569. from_wkt<MP>("MULTIPOINT()"),
  570. from_wkt<ML>("MULTILINESTRING((0 0,1 0),(9 0,10 0))"),
  571. from_wkt<MP>("MULTIPOINT()")
  572. );
  573. tester::apply
  574. ("mpmli09",
  575. from_wkt<MP>("MULTIPOINT(0 0,1 1,0 0,0 0,0 0,0 0,0 0,0 0,\
  576. 0 0,0 0,0 0,0 0,0 0)"),
  577. from_wkt<ML>("MULTILINESTRING((0 0,0 1),(0 0,2 0),(0 0,0 3),\
  578. (0 0,4 0),(0 0,0 5),(0 0,6 0),(0 0,7 0),(0 0,8 0))"),
  579. from_wkt<MP>("MULTIPOINT(0 0,0 0,0 0,0 0,0 0,0 0,0 0,\
  580. 0 0,0 0,0 0,0 0,0 0)")
  581. );
  582. tester::apply
  583. ("mpmli09a",
  584. from_wkt<MP>("MULTIPOINT(0 0,1 1,0 0)"),
  585. from_wkt<ML>("MULTILINESTRING((0 0,0 1),(0 0,2 0),(0 0,0 3),\
  586. (0 0,4 0),(0 0,0 5),(0 0,6 0),(0 0,7 0),(0 0,8 0))"),
  587. from_wkt<MP>("MULTIPOINT(0 0,0 0)")
  588. );
  589. }