visual01.txt 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. #!sqlite3
  2. #
  3. # This is a visual test case for the geopoly virtual table.
  4. #
  5. # Run this script in the sqlite3 CLI, and redirect output into an
  6. # HTML file. This display the HTML in a webbrowser.
  7. #
  8. /* Test data.
  9. ** Lots of shapes to be displayed over a 1000x800 canvas.
  10. */
  11. CREATE TEMP TABLE basis(name TEXT, jshape TEXT);
  12. INSERT INTO basis(name,jshape) VALUES
  13. ('box-20','[[0,0],[20,0],[20,20],[0,20],[0,0]]'),
  14. ('house-70','[[0,0],[50,0],[50,50],[25,70],[0,50],[0,0]]'),
  15. ('line-40','[[0,0],[40,0],[40,5],[0,5],[0,0]]'),
  16. ('line-80','[[0,0],[80,0],[80,7],[0,7],[0,0]]'),
  17. ('arrow-50','[[0,0],[25,25],[0,50],[15,25],[0,0]]'),
  18. ('triangle-30','[[0,0],[30,0],[15,30],[0,0]]'),
  19. ('angle-30','[[0,0],[30,0],[30,30],[26,30],[26,4],[0,4],[0,0]]'),
  20. ('star-10','[[1,0],[5,2],[9,0],[7,4],[10,8],[7,7],[5,10],[3,7],[0,8],[3,4],[1,0]]');
  21. CREATE TEMP TABLE xform(A,B,C,D,clr);
  22. INSERT INTO xform(A,B,clr) VALUES
  23. (1,0,'black'),
  24. (0.707,0.707,'blue'),
  25. (0.5,0.866,'red'),
  26. (-0.866,0.5,'green');
  27. CREATE TEMP TABLE xyoff(id1,id2,xoff,yoff,PRIMARY KEY(id1,id2,xoff,yoff))
  28. WITHOUT ROWID;
  29. INSERT INTO xyoff VALUES(1,1,811,659);
  30. INSERT INTO xyoff VALUES(1,1,235,550);
  31. INSERT INTO xyoff VALUES(1,1,481,620);
  32. INSERT INTO xyoff VALUES(1,1,106,494);
  33. INSERT INTO xyoff VALUES(1,1,487,106);
  34. INSERT INTO xyoff VALUES(1,1,817,595);
  35. INSERT INTO xyoff VALUES(1,1,240,504);
  36. INSERT INTO xyoff VALUES(1,1,806,457);
  37. INSERT INTO xyoff VALUES(1,1,608,107);
  38. INSERT INTO xyoff VALUES(1,1,768,662);
  39. INSERT INTO xyoff VALUES(1,2,808,528);
  40. INSERT INTO xyoff VALUES(1,2,768,528);
  41. INSERT INTO xyoff VALUES(1,2,771,171);
  42. INSERT INTO xyoff VALUES(1,2,275,671);
  43. INSERT INTO xyoff VALUES(1,2,326,336);
  44. INSERT INTO xyoff VALUES(1,2,690,688);
  45. INSERT INTO xyoff VALUES(1,2,597,239);
  46. INSERT INTO xyoff VALUES(1,2,317,528);
  47. INSERT INTO xyoff VALUES(1,2,366,223);
  48. INSERT INTO xyoff VALUES(1,2,621,154);
  49. INSERT INTO xyoff VALUES(1,3,829,469);
  50. INSERT INTO xyoff VALUES(1,3,794,322);
  51. INSERT INTO xyoff VALUES(1,3,358,387);
  52. INSERT INTO xyoff VALUES(1,3,184,444);
  53. INSERT INTO xyoff VALUES(1,3,729,500);
  54. INSERT INTO xyoff VALUES(1,3,333,523);
  55. INSERT INTO xyoff VALUES(1,3,117,595);
  56. INSERT INTO xyoff VALUES(1,3,496,201);
  57. INSERT INTO xyoff VALUES(1,3,818,601);
  58. INSERT INTO xyoff VALUES(1,3,541,343);
  59. INSERT INTO xyoff VALUES(1,4,603,248);
  60. INSERT INTO xyoff VALUES(1,4,761,649);
  61. INSERT INTO xyoff VALUES(1,4,611,181);
  62. INSERT INTO xyoff VALUES(1,4,607,233);
  63. INSERT INTO xyoff VALUES(1,4,860,206);
  64. INSERT INTO xyoff VALUES(1,4,310,231);
  65. INSERT INTO xyoff VALUES(1,4,727,539);
  66. INSERT INTO xyoff VALUES(1,4,660,661);
  67. INSERT INTO xyoff VALUES(1,4,403,133);
  68. INSERT INTO xyoff VALUES(1,4,619,331);
  69. INSERT INTO xyoff VALUES(2,1,712,578);
  70. INSERT INTO xyoff VALUES(2,1,567,313);
  71. INSERT INTO xyoff VALUES(2,1,231,423);
  72. INSERT INTO xyoff VALUES(2,1,490,175);
  73. INSERT INTO xyoff VALUES(2,1,898,353);
  74. INSERT INTO xyoff VALUES(2,1,589,483);
  75. INSERT INTO xyoff VALUES(2,1,188,462);
  76. INSERT INTO xyoff VALUES(2,1,720,106);
  77. INSERT INTO xyoff VALUES(2,1,793,380);
  78. INSERT INTO xyoff VALUES(2,1,154,396);
  79. INSERT INTO xyoff VALUES(2,2,324,218);
  80. INSERT INTO xyoff VALUES(2,2,120,327);
  81. INSERT INTO xyoff VALUES(2,2,655,133);
  82. INSERT INTO xyoff VALUES(2,2,516,603);
  83. INSERT INTO xyoff VALUES(2,2,529,572);
  84. INSERT INTO xyoff VALUES(2,2,481,212);
  85. INSERT INTO xyoff VALUES(2,2,802,107);
  86. INSERT INTO xyoff VALUES(2,2,234,509);
  87. INSERT INTO xyoff VALUES(2,2,501,269);
  88. INSERT INTO xyoff VALUES(2,2,349,553);
  89. INSERT INTO xyoff VALUES(2,3,495,685);
  90. INSERT INTO xyoff VALUES(2,3,897,372);
  91. INSERT INTO xyoff VALUES(2,3,350,681);
  92. INSERT INTO xyoff VALUES(2,3,832,257);
  93. INSERT INTO xyoff VALUES(2,3,778,149);
  94. INSERT INTO xyoff VALUES(2,3,683,426);
  95. INSERT INTO xyoff VALUES(2,3,693,217);
  96. INSERT INTO xyoff VALUES(2,3,746,317);
  97. INSERT INTO xyoff VALUES(2,3,805,369);
  98. INSERT INTO xyoff VALUES(2,3,336,585);
  99. INSERT INTO xyoff VALUES(2,4,890,255);
  100. INSERT INTO xyoff VALUES(2,4,556,565);
  101. INSERT INTO xyoff VALUES(2,4,865,555);
  102. INSERT INTO xyoff VALUES(2,4,230,293);
  103. INSERT INTO xyoff VALUES(2,4,247,251);
  104. INSERT INTO xyoff VALUES(2,4,730,563);
  105. INSERT INTO xyoff VALUES(2,4,318,282);
  106. INSERT INTO xyoff VALUES(2,4,220,431);
  107. INSERT INTO xyoff VALUES(2,4,828,336);
  108. INSERT INTO xyoff VALUES(2,4,278,525);
  109. INSERT INTO xyoff VALUES(3,1,324,656);
  110. INSERT INTO xyoff VALUES(3,1,625,362);
  111. INSERT INTO xyoff VALUES(3,1,155,570);
  112. INSERT INTO xyoff VALUES(3,1,267,433);
  113. INSERT INTO xyoff VALUES(3,1,599,121);
  114. INSERT INTO xyoff VALUES(3,1,873,498);
  115. INSERT INTO xyoff VALUES(3,1,789,520);
  116. INSERT INTO xyoff VALUES(3,1,656,378);
  117. INSERT INTO xyoff VALUES(3,1,831,601);
  118. INSERT INTO xyoff VALUES(3,1,256,471);
  119. INSERT INTO xyoff VALUES(3,2,332,258);
  120. INSERT INTO xyoff VALUES(3,2,305,463);
  121. INSERT INTO xyoff VALUES(3,2,796,341);
  122. INSERT INTO xyoff VALUES(3,2,830,229);
  123. INSERT INTO xyoff VALUES(3,2,413,271);
  124. INSERT INTO xyoff VALUES(3,2,269,140);
  125. INSERT INTO xyoff VALUES(3,2,628,441);
  126. INSERT INTO xyoff VALUES(3,2,747,643);
  127. INSERT INTO xyoff VALUES(3,2,584,435);
  128. INSERT INTO xyoff VALUES(3,2,784,314);
  129. INSERT INTO xyoff VALUES(3,3,722,233);
  130. INSERT INTO xyoff VALUES(3,3,815,421);
  131. INSERT INTO xyoff VALUES(3,3,401,267);
  132. INSERT INTO xyoff VALUES(3,3,451,650);
  133. INSERT INTO xyoff VALUES(3,3,329,485);
  134. INSERT INTO xyoff VALUES(3,3,878,370);
  135. INSERT INTO xyoff VALUES(3,3,162,616);
  136. INSERT INTO xyoff VALUES(3,3,844,183);
  137. INSERT INTO xyoff VALUES(3,3,161,216);
  138. INSERT INTO xyoff VALUES(3,3,176,676);
  139. INSERT INTO xyoff VALUES(3,4,780,128);
  140. INSERT INTO xyoff VALUES(3,4,566,121);
  141. INSERT INTO xyoff VALUES(3,4,646,120);
  142. INSERT INTO xyoff VALUES(3,4,223,557);
  143. INSERT INTO xyoff VALUES(3,4,251,117);
  144. INSERT INTO xyoff VALUES(3,4,139,209);
  145. INSERT INTO xyoff VALUES(3,4,813,597);
  146. INSERT INTO xyoff VALUES(3,4,454,538);
  147. INSERT INTO xyoff VALUES(3,4,616,198);
  148. INSERT INTO xyoff VALUES(3,4,210,159);
  149. INSERT INTO xyoff VALUES(4,1,208,415);
  150. INSERT INTO xyoff VALUES(4,1,326,665);
  151. INSERT INTO xyoff VALUES(4,1,612,133);
  152. INSERT INTO xyoff VALUES(4,1,537,513);
  153. INSERT INTO xyoff VALUES(4,1,638,438);
  154. INSERT INTO xyoff VALUES(4,1,808,269);
  155. INSERT INTO xyoff VALUES(4,1,552,121);
  156. INSERT INTO xyoff VALUES(4,1,100,189);
  157. INSERT INTO xyoff VALUES(4,1,643,664);
  158. INSERT INTO xyoff VALUES(4,1,726,378);
  159. INSERT INTO xyoff VALUES(4,2,478,409);
  160. INSERT INTO xyoff VALUES(4,2,497,507);
  161. INSERT INTO xyoff VALUES(4,2,233,148);
  162. INSERT INTO xyoff VALUES(4,2,587,237);
  163. INSERT INTO xyoff VALUES(4,2,604,166);
  164. INSERT INTO xyoff VALUES(4,2,165,455);
  165. INSERT INTO xyoff VALUES(4,2,320,258);
  166. INSERT INTO xyoff VALUES(4,2,353,496);
  167. INSERT INTO xyoff VALUES(4,2,347,495);
  168. INSERT INTO xyoff VALUES(4,2,166,622);
  169. INSERT INTO xyoff VALUES(4,3,461,332);
  170. INSERT INTO xyoff VALUES(4,3,685,278);
  171. INSERT INTO xyoff VALUES(4,3,427,594);
  172. INSERT INTO xyoff VALUES(4,3,467,346);
  173. INSERT INTO xyoff VALUES(4,3,125,548);
  174. INSERT INTO xyoff VALUES(4,3,597,680);
  175. INSERT INTO xyoff VALUES(4,3,820,445);
  176. INSERT INTO xyoff VALUES(4,3,144,330);
  177. INSERT INTO xyoff VALUES(4,3,557,434);
  178. INSERT INTO xyoff VALUES(4,3,254,315);
  179. INSERT INTO xyoff VALUES(4,4,157,339);
  180. INSERT INTO xyoff VALUES(4,4,249,220);
  181. INSERT INTO xyoff VALUES(4,4,391,323);
  182. INSERT INTO xyoff VALUES(4,4,589,429);
  183. INSERT INTO xyoff VALUES(4,4,859,592);
  184. INSERT INTO xyoff VALUES(4,4,337,680);
  185. INSERT INTO xyoff VALUES(4,4,410,288);
  186. INSERT INTO xyoff VALUES(4,4,636,596);
  187. INSERT INTO xyoff VALUES(4,4,734,433);
  188. INSERT INTO xyoff VALUES(4,4,559,549);
  189. INSERT INTO xyoff VALUES(5,1,549,607);
  190. INSERT INTO xyoff VALUES(5,1,584,498);
  191. INSERT INTO xyoff VALUES(5,1,699,116);
  192. INSERT INTO xyoff VALUES(5,1,525,524);
  193. INSERT INTO xyoff VALUES(5,1,304,667);
  194. INSERT INTO xyoff VALUES(5,1,302,232);
  195. INSERT INTO xyoff VALUES(5,1,403,149);
  196. INSERT INTO xyoff VALUES(5,1,824,403);
  197. INSERT INTO xyoff VALUES(5,1,697,203);
  198. INSERT INTO xyoff VALUES(5,1,293,689);
  199. INSERT INTO xyoff VALUES(5,2,199,275);
  200. INSERT INTO xyoff VALUES(5,2,395,393);
  201. INSERT INTO xyoff VALUES(5,2,657,642);
  202. INSERT INTO xyoff VALUES(5,2,200,655);
  203. INSERT INTO xyoff VALUES(5,2,882,234);
  204. INSERT INTO xyoff VALUES(5,2,483,565);
  205. INSERT INTO xyoff VALUES(5,2,755,640);
  206. INSERT INTO xyoff VALUES(5,2,810,305);
  207. INSERT INTO xyoff VALUES(5,2,731,655);
  208. INSERT INTO xyoff VALUES(5,2,466,690);
  209. INSERT INTO xyoff VALUES(5,3,563,584);
  210. INSERT INTO xyoff VALUES(5,3,491,117);
  211. INSERT INTO xyoff VALUES(5,3,779,292);
  212. INSERT INTO xyoff VALUES(5,3,375,637);
  213. INSERT INTO xyoff VALUES(5,3,253,553);
  214. INSERT INTO xyoff VALUES(5,3,797,514);
  215. INSERT INTO xyoff VALUES(5,3,229,480);
  216. INSERT INTO xyoff VALUES(5,3,257,194);
  217. INSERT INTO xyoff VALUES(5,3,449,555);
  218. INSERT INTO xyoff VALUES(5,3,849,630);
  219. INSERT INTO xyoff VALUES(5,4,329,286);
  220. INSERT INTO xyoff VALUES(5,4,640,197);
  221. INSERT INTO xyoff VALUES(5,4,104,150);
  222. INSERT INTO xyoff VALUES(5,4,438,272);
  223. INSERT INTO xyoff VALUES(5,4,773,226);
  224. INSERT INTO xyoff VALUES(5,4,441,650);
  225. INSERT INTO xyoff VALUES(5,4,242,340);
  226. INSERT INTO xyoff VALUES(5,4,301,435);
  227. INSERT INTO xyoff VALUES(5,4,171,397);
  228. INSERT INTO xyoff VALUES(5,4,541,619);
  229. INSERT INTO xyoff VALUES(6,1,651,301);
  230. INSERT INTO xyoff VALUES(6,1,637,137);
  231. INSERT INTO xyoff VALUES(6,1,765,643);
  232. INSERT INTO xyoff VALUES(6,1,173,296);
  233. INSERT INTO xyoff VALUES(6,1,263,192);
  234. INSERT INTO xyoff VALUES(6,1,791,302);
  235. INSERT INTO xyoff VALUES(6,1,860,601);
  236. INSERT INTO xyoff VALUES(6,1,780,445);
  237. INSERT INTO xyoff VALUES(6,1,462,214);
  238. INSERT INTO xyoff VALUES(6,1,802,207);
  239. INSERT INTO xyoff VALUES(6,2,811,685);
  240. INSERT INTO xyoff VALUES(6,2,533,531);
  241. INSERT INTO xyoff VALUES(6,2,390,614);
  242. INSERT INTO xyoff VALUES(6,2,260,580);
  243. INSERT INTO xyoff VALUES(6,2,116,377);
  244. INSERT INTO xyoff VALUES(6,2,860,458);
  245. INSERT INTO xyoff VALUES(6,2,438,590);
  246. INSERT INTO xyoff VALUES(6,2,604,562);
  247. INSERT INTO xyoff VALUES(6,2,241,242);
  248. INSERT INTO xyoff VALUES(6,2,667,298);
  249. INSERT INTO xyoff VALUES(6,3,787,698);
  250. INSERT INTO xyoff VALUES(6,3,868,521);
  251. INSERT INTO xyoff VALUES(6,3,412,587);
  252. INSERT INTO xyoff VALUES(6,3,640,131);
  253. INSERT INTO xyoff VALUES(6,3,748,410);
  254. INSERT INTO xyoff VALUES(6,3,257,244);
  255. INSERT INTO xyoff VALUES(6,3,411,195);
  256. INSERT INTO xyoff VALUES(6,3,464,356);
  257. INSERT INTO xyoff VALUES(6,3,157,339);
  258. INSERT INTO xyoff VALUES(6,3,434,505);
  259. INSERT INTO xyoff VALUES(6,4,480,671);
  260. INSERT INTO xyoff VALUES(6,4,519,228);
  261. INSERT INTO xyoff VALUES(6,4,404,513);
  262. INSERT INTO xyoff VALUES(6,4,120,538);
  263. INSERT INTO xyoff VALUES(6,4,403,663);
  264. INSERT INTO xyoff VALUES(6,4,477,677);
  265. INSERT INTO xyoff VALUES(6,4,690,154);
  266. INSERT INTO xyoff VALUES(6,4,606,498);
  267. INSERT INTO xyoff VALUES(6,4,430,665);
  268. INSERT INTO xyoff VALUES(6,4,499,273);
  269. INSERT INTO xyoff VALUES(7,1,118,526);
  270. INSERT INTO xyoff VALUES(7,1,817,522);
  271. INSERT INTO xyoff VALUES(7,1,388,638);
  272. INSERT INTO xyoff VALUES(7,1,181,265);
  273. INSERT INTO xyoff VALUES(7,1,442,332);
  274. INSERT INTO xyoff VALUES(7,1,475,282);
  275. INSERT INTO xyoff VALUES(7,1,722,633);
  276. INSERT INTO xyoff VALUES(7,1,104,394);
  277. INSERT INTO xyoff VALUES(7,1,631,262);
  278. INSERT INTO xyoff VALUES(7,1,372,392);
  279. INSERT INTO xyoff VALUES(7,2,600,413);
  280. INSERT INTO xyoff VALUES(7,2,386,223);
  281. INSERT INTO xyoff VALUES(7,2,839,174);
  282. INSERT INTO xyoff VALUES(7,2,293,410);
  283. INSERT INTO xyoff VALUES(7,2,281,391);
  284. INSERT INTO xyoff VALUES(7,2,859,387);
  285. INSERT INTO xyoff VALUES(7,2,478,347);
  286. INSERT INTO xyoff VALUES(7,2,646,690);
  287. INSERT INTO xyoff VALUES(7,2,713,234);
  288. INSERT INTO xyoff VALUES(7,2,199,588);
  289. INSERT INTO xyoff VALUES(7,3,389,256);
  290. INSERT INTO xyoff VALUES(7,3,349,542);
  291. INSERT INTO xyoff VALUES(7,3,363,345);
  292. INSERT INTO xyoff VALUES(7,3,751,302);
  293. INSERT INTO xyoff VALUES(7,3,423,386);
  294. INSERT INTO xyoff VALUES(7,3,267,444);
  295. INSERT INTO xyoff VALUES(7,3,243,182);
  296. INSERT INTO xyoff VALUES(7,3,453,658);
  297. INSERT INTO xyoff VALUES(7,3,126,345);
  298. INSERT INTO xyoff VALUES(7,3,120,472);
  299. INSERT INTO xyoff VALUES(7,4,359,654);
  300. INSERT INTO xyoff VALUES(7,4,339,516);
  301. INSERT INTO xyoff VALUES(7,4,710,452);
  302. INSERT INTO xyoff VALUES(7,4,810,560);
  303. INSERT INTO xyoff VALUES(7,4,644,692);
  304. INSERT INTO xyoff VALUES(7,4,826,327);
  305. INSERT INTO xyoff VALUES(7,4,465,462);
  306. INSERT INTO xyoff VALUES(7,4,310,456);
  307. INSERT INTO xyoff VALUES(7,4,577,613);
  308. INSERT INTO xyoff VALUES(7,4,502,555);
  309. INSERT INTO xyoff VALUES(8,1,601,620);
  310. INSERT INTO xyoff VALUES(8,1,372,683);
  311. INSERT INTO xyoff VALUES(8,1,758,399);
  312. INSERT INTO xyoff VALUES(8,1,485,552);
  313. INSERT INTO xyoff VALUES(8,1,159,563);
  314. INSERT INTO xyoff VALUES(8,1,536,303);
  315. INSERT INTO xyoff VALUES(8,1,122,263);
  316. INSERT INTO xyoff VALUES(8,1,836,435);
  317. INSERT INTO xyoff VALUES(8,1,544,146);
  318. INSERT INTO xyoff VALUES(8,1,270,277);
  319. INSERT INTO xyoff VALUES(8,2,849,281);
  320. INSERT INTO xyoff VALUES(8,2,563,242);
  321. INSERT INTO xyoff VALUES(8,2,704,463);
  322. INSERT INTO xyoff VALUES(8,2,102,165);
  323. INSERT INTO xyoff VALUES(8,2,797,524);
  324. INSERT INTO xyoff VALUES(8,2,612,426);
  325. INSERT INTO xyoff VALUES(8,2,345,372);
  326. INSERT INTO xyoff VALUES(8,2,820,376);
  327. INSERT INTO xyoff VALUES(8,2,789,156);
  328. INSERT INTO xyoff VALUES(8,2,321,466);
  329. INSERT INTO xyoff VALUES(8,3,150,332);
  330. INSERT INTO xyoff VALUES(8,3,136,152);
  331. INSERT INTO xyoff VALUES(8,3,468,528);
  332. INSERT INTO xyoff VALUES(8,3,409,192);
  333. INSERT INTO xyoff VALUES(8,3,820,216);
  334. INSERT INTO xyoff VALUES(8,3,847,249);
  335. INSERT INTO xyoff VALUES(8,3,801,267);
  336. INSERT INTO xyoff VALUES(8,3,181,670);
  337. INSERT INTO xyoff VALUES(8,3,398,563);
  338. INSERT INTO xyoff VALUES(8,3,439,576);
  339. INSERT INTO xyoff VALUES(8,4,123,309);
  340. INSERT INTO xyoff VALUES(8,4,190,496);
  341. INSERT INTO xyoff VALUES(8,4,571,531);
  342. INSERT INTO xyoff VALUES(8,4,290,255);
  343. INSERT INTO xyoff VALUES(8,4,244,412);
  344. INSERT INTO xyoff VALUES(8,4,264,596);
  345. INSERT INTO xyoff VALUES(8,4,253,420);
  346. INSERT INTO xyoff VALUES(8,4,847,536);
  347. INSERT INTO xyoff VALUES(8,4,120,288);
  348. INSERT INTO xyoff VALUES(8,4,331,639);
  349. /* Create the geopoly object from test data above */
  350. CREATE VIRTUAL TABLE geo1 USING geopoly(type,clr);
  351. INSERT INTO geo1(_shape,type,clr)
  352. SELECT geopoly_xform(jshape,A,B,-B,A,xoff,yoff), basis.name, xform.clr
  353. FROM basis, xform, xyoff
  354. WHERE xyoff.id1=basis.rowid AND xyoff.id2=xform.rowid;
  355. /* Query polygon */
  356. CREATE TEMP TABLE querypoly(poly JSON, clr TEXT);
  357. INSERT INTO querypoly(clr, poly) VALUES
  358. ('orange', '[[300,300],[400,350],[500,250],[480,500],[400,480],[300,550],[280,450],[320,400],[280,350],[300,300]]');
  359. /* Generate the HTML */
  360. .print '<html>'
  361. .print '<h1>Everything</h1>'
  362. .print '<svg width="1000" height="800" style="border:1px solid black">'
  363. SELECT geopoly_svg(_shape,
  364. printf('style="fill:none;stroke:%s;stroke-width:1"',clr)
  365. )
  366. FROM geo1;
  367. SELECT geopoly_svg(poly,
  368. printf('style="fill:%s;fill-opacity:0.5;"',clr)
  369. )
  370. FROM querypoly;
  371. .print '</svg>'
  372. .print '<h1>Overlap Query</h1>'
  373. .print '<pre>'
  374. .print 'SELECT *'
  375. .print ' FROM geo1, querypoly'
  376. .print ' WHERE geopoly_overlap(_shape, poly);'
  377. .print
  378. EXPLAIN QUERY PLAN
  379. SELECT geopoly_svg(_shape,
  380. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  381. )
  382. FROM geo1, querypoly
  383. WHERE geopoly_overlap(_shape, poly);
  384. .print '</pre>'
  385. .print '<svg width="1000" height="800" style="border:1px solid black">'
  386. SELECT geopoly_svg(_shape,
  387. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  388. )
  389. FROM geo1, querypoly
  390. WHERE geopoly_overlap(_shape, poly);
  391. SELECT geopoly_svg(poly,
  392. printf('style="fill:%s;fill-opacity:0.5;"',clr)
  393. )
  394. FROM querypoly;
  395. .print '</svg>'
  396. .print '<h1>Overlap Query And Result Bounding Box</h1>'
  397. .print '<svg width="1000" height="800" style="border:1px solid black">'
  398. SELECT geopoly_svg(_shape,
  399. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  400. )
  401. FROM geo1, querypoly
  402. WHERE geopoly_overlap(_shape, poly);
  403. SELECT geopoly_svg(geopoly_bbox(poly),
  404. 'style="fill:none;stroke:black;stroke-width:3"'
  405. )
  406. FROM querypoly;
  407. SELECT geopoly_svg(poly,
  408. printf('style="fill:%s;fill-opacity:0.5;"',clr)
  409. )
  410. FROM querypoly;
  411. SELECT geopoly_svg(geopoly_group_bbox(_shape),
  412. 'style="fill:none;stroke:red;stroke-width:3"'
  413. )
  414. FROM geo1, querypoly
  415. WHERE geopoly_overlap(_shape, poly);
  416. .print '</svg>'
  417. .print '<h1>Bounding-Box Overlap Query</h1>'
  418. .print '<svg width="1000" height="800" style="border:1px solid black">'
  419. SELECT geopoly_svg(_shape,
  420. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  421. ),
  422. geopoly_svg(geopoly_bbox(_shape),
  423. 'style="fill:none;stroke:black;stroke-width:1"'
  424. )
  425. FROM geo1, querypoly
  426. WHERE geopoly_overlap(geopoly_bbox(_shape), geopoly_bbox(poly));
  427. SELECT geopoly_svg(poly,
  428. printf('style="fill:%s;fill-opacity:0.5;"',clr)
  429. )
  430. FROM querypoly;
  431. SELECT geopoly_svg(geopoly_bbox(poly),
  432. 'style="fill:none;stroke:black;stroke-width:3"'
  433. )
  434. FROM querypoly;
  435. .print '</svg>'
  436. .print '<h1>Within Query</h1>'
  437. .print '<pre>'
  438. .print 'SELECT *'
  439. .print ' FROM geo1, querypoly'
  440. .print ' WHERE geopoly_within(_shape, poly);'
  441. .print
  442. EXPLAIN QUERY PLAN
  443. SELECT geopoly_svg(_shape,
  444. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  445. )
  446. FROM geo1, querypoly
  447. WHERE geopoly_within(_shape, poly);
  448. .print '</pre>'
  449. .print '<svg width="1000" height="800" style="border:1px solid black">'
  450. SELECT geopoly_svg(_shape,
  451. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  452. )
  453. FROM geo1, querypoly
  454. WHERE geopoly_within(_shape, poly);
  455. SELECT geopoly_svg(poly,
  456. printf('style="fill:%s;fill-opacity:0.5;"',clr)
  457. )
  458. FROM querypoly;
  459. .print '</svg>'
  460. .print '<h1>Bounding-Box WITHIN Query</h1>'
  461. .print '<svg width="1000" height="800" style="border:1px solid black">'
  462. SELECT geopoly_svg(_shape,
  463. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  464. ),
  465. geopoly_svg(geopoly_bbox(_shape),
  466. 'style="fill:none;stroke:black;stroke-width:1"'
  467. )
  468. FROM geo1, querypoly
  469. WHERE geopoly_within(geopoly_bbox(_shape), geopoly_bbox(poly));
  470. SELECT geopoly_svg(poly,
  471. printf('style="fill:%s;fill-opacity:0.5;"',clr)
  472. )
  473. FROM querypoly;
  474. SELECT geopoly_svg(geopoly_bbox(poly),
  475. 'style="fill:none;stroke:black;stroke-width:3"'
  476. )
  477. FROM querypoly;
  478. .print '</svg>'
  479. .print '<h1>Not Overlap Query</h1>'
  480. .print '<pre>'
  481. .print 'SELECT *'
  482. .print ' FROM geo1, querypoly'
  483. .print ' WHERE NOT geopoly_overlap(_shape, poly);'
  484. .print
  485. EXPLAIN QUERY PLAN
  486. SELECT geopoly_svg(_shape,
  487. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  488. )
  489. FROM geo1, querypoly
  490. WHERE NOT geopoly_overlap(_shape, poly);
  491. .print '</pre>'
  492. .print '<svg width="1000" height="800" style="border:1px solid black">'
  493. SELECT geopoly_svg(_shape,
  494. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  495. )
  496. FROM geo1, querypoly
  497. WHERE NOT geopoly_overlap(_shape, poly);
  498. SELECT geopoly_svg(poly,
  499. printf('style="fill:%s;fill-opacity:0.5;"',clr)
  500. )
  501. FROM querypoly;
  502. .print '</svg>'
  503. .print '<h1>Not Within Query</h1>'
  504. .print '<pre>'
  505. .print 'SELECT *'
  506. .print ' FROM geo1, querypoly'
  507. .print ' WHERE NOT geopoly_within(_shape, poly);'
  508. .print
  509. EXPLAIN QUERY PLAN
  510. SELECT geopoly_svg(_shape,
  511. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  512. )
  513. FROM geo1, querypoly
  514. WHERE NOT geopoly_within(_shape, poly);
  515. .print '</pre>'
  516. .print '<svg width="1000" height="800" style="border:1px solid black">'
  517. SELECT geopoly_svg(_shape,
  518. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  519. )
  520. FROM geo1, querypoly
  521. WHERE NOT geopoly_within(_shape, poly);
  522. SELECT geopoly_svg(poly,
  523. printf('style="fill:%s;fill-opacity:0.5;"',clr)
  524. )
  525. FROM querypoly;
  526. .print '</svg>'
  527. .print '<h1>Color-Change For Overlapping Elements</h1>'
  528. BEGIN;
  529. UPDATE geo1
  530. SET clr=CASE WHEN rowid IN (SELECT geo1.rowid FROM geo1, querypoly
  531. WHERE geopoly_overlap(_shape,poly))
  532. THEN 'red' ELSE 'blue' END;
  533. .print '<svg width="1000" height="800" style="border:1px solid black">'
  534. SELECT geopoly_svg(_shape,
  535. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  536. )
  537. FROM geo1;
  538. SELECT geopoly_svg(poly,'style="fill:none;stroke:black;stroke-width:2"')
  539. FROM querypoly;
  540. ROLLBACK;
  541. .print '</svg>'
  542. .print '<h1>Color-Change And Move Overlapping Elements</h1>'
  543. BEGIN;
  544. UPDATE geo1
  545. SET clr=CASE WHEN rowid IN (SELECT geo1.rowid FROM geo1, querypoly
  546. WHERE geopoly_overlap(_shape,poly))
  547. THEN 'red' ELSE '#76ccff' END;
  548. UPDATE geo1
  549. SET _shape=geopoly_xform(_shape,1,0,0,1,300,0)
  550. WHERE geopoly_overlap(_shape,(SELECT poly FROM querypoly));
  551. .print '<svg width="1000" height="800" style="border:1px solid black">'
  552. SELECT geopoly_svg(_shape,
  553. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  554. )
  555. FROM geo1;
  556. SELECT geopoly_svg(poly,'style="fill:none;stroke:black;stroke-width:2"')
  557. FROM querypoly;
  558. --ROLLBACK;
  559. .print '</svg>'
  560. .print '<h1>Overlap With Translated Query Polygon</h1>'
  561. UPDATE querypoly SET poly=geopoly_xform(poly,1,0,0,1,300,0);
  562. .print '<svg width="1000" height="800" style="border:1px solid black">'
  563. SELECT geopoly_svg(_shape,
  564. printf('style="fill:none;stroke:%s;stroke-width:1"',geo1.clr)
  565. )
  566. FROM geo1
  567. WHERE geopoly_overlap(_shape,(SELECT poly FROM querypoly));
  568. SELECT geopoly_svg(poly,'style="fill:none;stroke:black;stroke-width:2"')
  569. FROM querypoly;
  570. ROLLBACK;
  571. .print '</svg>'
  572. .print '<h1>Regular Polygons</h1>'
  573. .print '<svg width="1000" height="200" style="border:1px solid black">'
  574. SELECT geopoly_svg(geopoly_regular(100,100,40,3),'style="fill:none;stroke:red;stroke-width:1"');
  575. SELECT geopoly_svg(geopoly_regular(200,100,40,4),'style="fill:none;stroke:orange;stroke-width:1"');
  576. SELECT geopoly_svg(geopoly_regular(300,100,40,5),'style="fill:none;stroke:green;stroke-width:1"');
  577. SELECT geopoly_svg(geopoly_regular(400,100,40,6),'style="fill:none;stroke:blue;stroke-width:1"');
  578. SELECT geopoly_svg(geopoly_regular(500,100,40,7),'style="fill:none;stroke:purple;stroke-width:1"');
  579. SELECT geopoly_svg(geopoly_regular(600,100,40,8),'style="fill:none;stroke:red;stroke-width:1"');
  580. SELECT geopoly_svg(geopoly_regular(700,100,40,10),'style="fill:none;stroke:orange;stroke-width:1"');
  581. SELECT geopoly_svg(geopoly_regular(800,100,40,20),'style="fill:none;stroke:green;stroke-width:1"');
  582. SELECT geopoly_svg(geopoly_regular(900,100,40,30),'style="fill:none;stroke:blue;stroke-width:1"');
  583. .print '</svg>'
  584. .print '</html>'