columbus3 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (344) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/README.md +122 -0
  4. data/bin/console +0 -0
  5. data/bin/setup +0 -0
  6. data/bower.json +25 -0
  7. data/bower_components/jquery/.bower.json +7 -20
  8. data/bower_components/jquery/AUTHORS.txt +301 -0
  9. data/bower_components/jquery/{MIT-LICENSE.txt → LICENSE.txt} +17 -2
  10. data/bower_components/jquery/README.md +67 -0
  11. data/bower_components/jquery/bower.json +2 -16
  12. data/bower_components/jquery/dist/core.js +476 -0
  13. data/bower_components/jquery/dist/jquery.js +3861 -2818
  14. data/bower_components/jquery/dist/jquery.min.js +4 -5
  15. data/bower_components/jquery/dist/jquery.min.map +1 -1
  16. data/bower_components/jquery/dist/jquery.slim.js +8160 -0
  17. data/bower_components/jquery/dist/jquery.slim.min.js +4 -0
  18. data/bower_components/jquery/dist/jquery.slim.min.map +1 -0
  19. data/bower_components/jquery/external/sizzle/LICENSE.txt +36 -0
  20. data/bower_components/jquery/{src → external}/sizzle/dist/sizzle.js +445 -240
  21. data/bower_components/jquery/external/sizzle/dist/sizzle.min.js +3 -0
  22. data/bower_components/jquery/external/sizzle/dist/sizzle.min.map +1 -0
  23. data/bower_components/jquery/src/.eslintrc.json +5 -0
  24. data/bower_components/jquery/src/ajax.js +174 -105
  25. data/bower_components/jquery/src/ajax/jsonp.js +27 -14
  26. data/bower_components/jquery/src/ajax/load.js +24 -23
  27. data/bower_components/jquery/src/ajax/parseXML.js +8 -6
  28. data/bower_components/jquery/src/ajax/script.js +25 -12
  29. data/bower_components/jquery/src/ajax/var/location.js +5 -0
  30. data/bower_components/jquery/src/ajax/var/nonce.js +4 -2
  31. data/bower_components/jquery/src/ajax/var/rquery.js +5 -3
  32. data/bower_components/jquery/src/ajax/xhr.js +76 -43
  33. data/bower_components/jquery/src/attributes.js +4 -2
  34. data/bower_components/jquery/src/attributes/attr.js +60 -60
  35. data/bower_components/jquery/src/attributes/classes.js +87 -71
  36. data/bower_components/jquery/src/attributes/prop.js +81 -32
  37. data/bower_components/jquery/src/attributes/support.js +11 -13
  38. data/bower_components/jquery/src/attributes/val.js +66 -37
  39. data/bower_components/jquery/src/callbacks.js +119 -90
  40. data/bower_components/jquery/src/core.js +108 -134
  41. data/bower_components/jquery/src/core/DOMEval.js +16 -0
  42. data/bower_components/jquery/src/core/access.js +21 -11
  43. data/bower_components/jquery/src/core/init.js +33 -28
  44. data/bower_components/jquery/src/core/nodeName.js +13 -0
  45. data/bower_components/jquery/src/core/parseHTML.js +39 -13
  46. data/bower_components/jquery/src/core/ready-no-deferred.js +96 -0
  47. data/bower_components/jquery/src/core/ready.js +40 -51
  48. data/bower_components/jquery/src/core/readyException.js +13 -0
  49. data/bower_components/jquery/src/core/stripAndCollapse.js +14 -0
  50. data/bower_components/jquery/src/core/support.js +20 -0
  51. data/bower_components/jquery/src/core/var/rsingleTag.js +5 -3
  52. data/bower_components/jquery/src/css.js +146 -158
  53. data/bower_components/jquery/src/css/addGetHookIf.js +7 -3
  54. data/bower_components/jquery/src/css/adjustCSS.js +71 -0
  55. data/bower_components/jquery/src/css/curCSS.js +22 -14
  56. data/bower_components/jquery/src/css/hiddenVisibleSelectors.js +8 -8
  57. data/bower_components/jquery/src/css/showHide.js +105 -0
  58. data/bower_components/jquery/src/css/support.js +69 -76
  59. data/bower_components/jquery/src/css/var/cssExpand.js +4 -2
  60. data/bower_components/jquery/src/css/var/getStyles.js +11 -6
  61. data/bower_components/jquery/src/css/var/isHiddenWithinTree.js +34 -0
  62. data/bower_components/jquery/src/css/var/rmargin.js +5 -3
  63. data/bower_components/jquery/src/css/var/rnumnonpx.js +4 -2
  64. data/bower_components/jquery/src/css/{swap.js → var/swap.js} +5 -7
  65. data/bower_components/jquery/src/data.js +67 -66
  66. data/bower_components/jquery/src/data/Data.js +87 -107
  67. data/bower_components/jquery/src/data/{accepts.js → var/acceptData.js} +6 -7
  68. data/bower_components/jquery/src/data/var/{data_priv.js → dataPriv.js} +4 -2
  69. data/bower_components/jquery/src/data/var/{data_user.js → dataUser.js} +4 -2
  70. data/bower_components/jquery/src/deferred.js +314 -72
  71. data/bower_components/jquery/src/deferred/exceptionHook.js +21 -0
  72. data/bower_components/jquery/src/deprecated.js +36 -9
  73. data/bower_components/jquery/src/dimensions.js +16 -10
  74. data/bower_components/jquery/src/effects.js +257 -206
  75. data/bower_components/jquery/src/effects/Tween.js +18 -9
  76. data/bower_components/jquery/src/effects/animatedSelector.js +7 -5
  77. data/bower_components/jquery/src/event.js +297 -419
  78. data/bower_components/jquery/src/event/ajax.js +13 -4
  79. data/bower_components/jquery/src/event/alias.js +13 -23
  80. data/bower_components/jquery/src/event/focusin.js +55 -0
  81. data/bower_components/jquery/src/event/support.js +5 -3
  82. data/bower_components/jquery/src/event/trigger.js +185 -0
  83. data/bower_components/jquery/src/exports/amd.js +5 -3
  84. data/bower_components/jquery/src/exports/global.js +8 -6
  85. data/bower_components/jquery/src/jquery.js +6 -2
  86. data/bower_components/jquery/src/manipulation.js +218 -310
  87. data/bower_components/jquery/src/manipulation/_evalUrl.js +9 -4
  88. data/bower_components/jquery/src/manipulation/buildFragment.js +104 -0
  89. data/bower_components/jquery/src/manipulation/getAll.js +32 -0
  90. data/bower_components/jquery/src/manipulation/setGlobalEval.js +22 -0
  91. data/bower_components/jquery/src/manipulation/support.js +11 -8
  92. data/bower_components/jquery/src/manipulation/var/rcheckableType.js +5 -3
  93. data/bower_components/jquery/src/manipulation/var/rscriptType.js +5 -0
  94. data/bower_components/jquery/src/manipulation/var/rtagName.js +5 -0
  95. data/bower_components/jquery/src/manipulation/wrapMap.js +29 -0
  96. data/bower_components/jquery/src/offset.js +75 -53
  97. data/bower_components/jquery/src/queue.js +26 -23
  98. data/bower_components/jquery/src/queue/delay.js +8 -6
  99. data/bower_components/jquery/src/selector-native.js +133 -68
  100. data/bower_components/jquery/src/selector-sizzle.js +10 -5
  101. data/bower_components/jquery/src/selector.js +3 -1
  102. data/bower_components/jquery/src/serialize.js +52 -33
  103. data/bower_components/jquery/src/traversing.js +61 -69
  104. data/bower_components/jquery/src/traversing/findFilter.js +37 -31
  105. data/bower_components/jquery/src/traversing/var/dir.js +22 -0
  106. data/bower_components/jquery/src/traversing/var/rneedsContext.js +4 -2
  107. data/bower_components/jquery/src/traversing/var/siblings.js +17 -0
  108. data/bower_components/jquery/src/var/ObjectFunctionString.js +7 -0
  109. data/bower_components/jquery/src/var/arr.js +4 -2
  110. data/bower_components/jquery/src/var/class2type.js +4 -2
  111. data/bower_components/jquery/src/var/concat.js +4 -2
  112. data/bower_components/jquery/src/var/document.js +5 -0
  113. data/bower_components/jquery/src/var/documentElement.js +7 -0
  114. data/bower_components/jquery/src/var/fnToString.js +7 -0
  115. data/bower_components/jquery/src/var/getProto.js +5 -0
  116. data/bower_components/jquery/src/var/hasOwn.js +4 -2
  117. data/bower_components/jquery/src/var/indexOf.js +4 -2
  118. data/bower_components/jquery/src/var/pnum.js +5 -3
  119. data/bower_components/jquery/src/var/push.js +4 -2
  120. data/bower_components/jquery/src/var/rcssNum.js +9 -0
  121. data/bower_components/jquery/src/var/rnothtmlwhite.js +8 -0
  122. data/bower_components/jquery/src/var/slice.js +4 -2
  123. data/bower_components/jquery/src/var/support.js +4 -2
  124. data/bower_components/jquery/src/var/toString.js +4 -2
  125. data/bower_components/jquery/src/wrap.js +24 -26
  126. data/bower_components/leaflet-providers/.bower.json +6 -7
  127. data/bower_components/leaflet-providers/CHANGELOG.md +62 -0
  128. data/bower_components/leaflet-providers/README.md +12 -3
  129. data/bower_components/leaflet-providers/bower.json +1 -1
  130. data/bower_components/leaflet-providers/leaflet-providers.js +133 -92
  131. data/bower_components/leaflet-providers/package.json +14 -7
  132. data/bower_components/leaflet/.bower.json +10 -14
  133. data/bower_components/leaflet/CHANGELOG.md +648 -3
  134. data/bower_components/leaflet/CONTRIBUTING.md +88 -33
  135. data/bower_components/leaflet/ISSUE_TEMPLATE.md +25 -0
  136. data/bower_components/leaflet/Jakefile.js +73 -14
  137. data/bower_components/leaflet/LICENSE +1 -1
  138. data/bower_components/leaflet/PLUGIN-GUIDE.md +97 -3
  139. data/bower_components/leaflet/README.md +6 -8
  140. data/bower_components/leaflet/bower.json +3 -9
  141. data/bower_components/leaflet/dist/images/layers-2x.png +0 -0
  142. data/bower_components/leaflet/dist/images/layers.png +0 -0
  143. data/bower_components/leaflet/dist/images/marker-icon-2x.png +0 -0
  144. data/bower_components/leaflet/dist/images/marker-icon.png +0 -0
  145. data/bower_components/leaflet/dist/images/marker-shadow.png +0 -0
  146. data/bower_components/leaflet/dist/leaflet-src.js +12301 -7898
  147. data/bower_components/leaflet/dist/leaflet-src.js.map +1 -0
  148. data/bower_components/leaflet/dist/leaflet.css +196 -43
  149. data/bower_components/leaflet/dist/leaflet.js +6 -9
  150. data/bower_components/leaflet/dist/leaflet.js.map +1 -0
  151. data/bower_components/leaflet/docs/CNAME +1 -0
  152. data/bower_components/leaflet/docs/Gemfile +4 -0
  153. data/bower_components/leaflet/docs/_config.yml +19 -0
  154. data/bower_components/leaflet/docs/_includes/frame.html +9 -0
  155. data/bower_components/leaflet/docs/_includes/tutorial_link.html +8 -0
  156. data/bower_components/leaflet/docs/_layouts/post.html +30 -0
  157. data/bower_components/leaflet/docs/_layouts/redirected.html +14 -0
  158. data/bower_components/leaflet/docs/_layouts/tutorial.html +9 -0
  159. data/bower_components/leaflet/docs/_layouts/tutorial_frame.html +32 -0
  160. data/bower_components/leaflet/docs/_layouts/tutorial_v2.html +9 -0
  161. data/bower_components/leaflet/docs/_layouts/v2.html +159 -0
  162. data/bower_components/leaflet/docs/_posts/2012-07-30-leaflet-0-4-released.md +240 -0
  163. data/bower_components/leaflet/docs/_posts/2012-08-07-leaflet-0-4-3-and-a-new-tutorial.md +47 -0
  164. data/bower_components/leaflet/docs/_posts/2012-08-20-guest-post-markerclusterer-0-1-released.md +112 -0
  165. data/bower_components/leaflet/docs/_posts/2012-10-25-leaflet-0-4-5-bugfix-release-and-plans-for-0.5.md +36 -0
  166. data/bower_components/leaflet/docs/_posts/2013-01-17-leaflet-0-5-released.md +24 -0
  167. data/bower_components/leaflet/docs/_posts/2013-02-20-guest-post-draw.md +146 -0
  168. data/bower_components/leaflet/docs/_posts/2013-06-26-leaflet-0-6-released-dc-code-sprint-mapbox.md +31 -0
  169. data/bower_components/leaflet/docs/_posts/2013-06-28-leaflet-plugin-authoring-guide.md +111 -0
  170. data/bower_components/leaflet/docs/_posts/2013-11-18-leaflet-0-7-released-plans-for-future.md +56 -0
  171. data/bower_components/leaflet/docs/_posts/2015-07-01-leaflet-is-alive-and-kicking.md +21 -0
  172. data/bower_components/leaflet/docs/_posts/2015-07-15-leaflet-1.0-beta1-released.md +60 -0
  173. data/bower_components/leaflet/docs/_posts/2015-09-01-leaflet-0.7.4-released.md +29 -0
  174. data/bower_components/leaflet/docs/_posts/2015-10-14-leaflet-1.0-beta2-released.md +35 -0
  175. data/bower_components/leaflet/docs/_posts/2016-03-20-debugging-touch-interactions.md +101 -0
  176. data/bower_components/leaflet/docs/_posts/2016-04-18-leaflet-1.0-rc1.md +78 -0
  177. data/bower_components/leaflet/docs/_posts/2016-07-16-leaflet-1.0-rc2.md +60 -0
  178. data/bower_components/leaflet/docs/_posts/2016-08-05-leaflet-1.0-rc3.md +53 -0
  179. data/bower_components/leaflet/docs/_posts/2016-09-27-leaflet-1.0-final.md +50 -0
  180. data/bower_components/leaflet/docs/_posts/2016-11-21-leaflet-1.0.2.md +25 -0
  181. data/bower_components/leaflet/docs/_posts/2017-01-23-leaflet-1.0.3.md +27 -0
  182. data/bower_components/leaflet/docs/atom.xml +29 -0
  183. data/bower_components/leaflet/docs/blog.md +24 -0
  184. data/bower_components/leaflet/docs/docs/css/main.css +1092 -0
  185. data/bower_components/leaflet/docs/docs/css/normalize.css +426 -0
  186. data/bower_components/leaflet/docs/docs/highlight/LICENSE +24 -0
  187. data/bower_components/leaflet/docs/docs/highlight/highlight.pack.js +1 -0
  188. data/bower_components/leaflet/docs/docs/highlight/styles/github-gist.css +211 -0
  189. data/bower_components/leaflet/docs/docs/images/2016-03-20-prosthetic-hand-zooming.gif +0 -0
  190. data/bower_components/leaflet/docs/docs/images/2016-04-18-inheritances.gif +0 -0
  191. data/bower_components/leaflet/docs/docs/images/2016-04-18-leaflet-toilet-paper.jpeg +0 -0
  192. data/bower_components/leaflet/docs/docs/images/2016-04-18-madrid-leaflet-864px.jpg +0 -0
  193. data/bower_components/leaflet/docs/docs/images/2016-07-18-remote-session.png +0 -0
  194. data/bower_components/leaflet/docs/docs/images/2016-07-18-tooltip.png +0 -0
  195. data/bower_components/leaflet/docs/docs/images/2016-08-03-iraq-hacking.jpg +0 -0
  196. data/bower_components/leaflet/docs/docs/images/favicon.ico +0 -0
  197. data/bower_components/leaflet/docs/docs/images/forum-round.png +0 -0
  198. data/bower_components/leaflet/docs/docs/images/github-round.png +0 -0
  199. data/bower_components/leaflet/docs/docs/images/logo.png +0 -0
  200. data/bower_components/leaflet/docs/docs/images/logos.png +0 -0
  201. data/bower_components/leaflet/docs/docs/images/sprite.png +0 -0
  202. data/bower_components/leaflet/docs/docs/images/sprite.svg +75 -0
  203. data/bower_components/leaflet/docs/docs/images/twitter-round.png +0 -0
  204. data/bower_components/leaflet/docs/docs/images/twitter.png +0 -0
  205. data/bower_components/leaflet/docs/docs/js/docs.js +52 -0
  206. data/bower_components/leaflet/docs/download.md +95 -0
  207. data/bower_components/leaflet/docs/examples.md +125 -0
  208. data/bower_components/leaflet/docs/examples/choropleth-example.md +5 -0
  209. data/bower_components/leaflet/docs/examples/choropleth.md +5 -0
  210. data/bower_components/leaflet/docs/examples/choropleth/example-basic.md +20 -0
  211. data/bower_components/leaflet/docs/examples/choropleth/example-color.md +46 -0
  212. data/bower_components/leaflet/docs/examples/choropleth/example.md +159 -0
  213. data/bower_components/leaflet/docs/examples/choropleth/index.md +232 -0
  214. data/bower_components/leaflet/docs/examples/choropleth/thumbnail.png +0 -0
  215. data/bower_components/leaflet/docs/examples/choropleth/us-states.js +54 -0
  216. data/bower_components/leaflet/docs/examples/crs-simple/crs-simple-example1.md +16 -0
  217. data/bower_components/leaflet/docs/examples/crs-simple/crs-simple-example2.md +20 -0
  218. data/bower_components/leaflet/docs/examples/crs-simple/crs-simple-example3.md +38 -0
  219. data/bower_components/leaflet/docs/examples/crs-simple/crs-simple.md +117 -0
  220. data/bower_components/leaflet/docs/examples/crs-simple/thumbnail.png +0 -0
  221. data/bower_components/leaflet/docs/examples/crs-simple/uqm_map_400px.png +0 -0
  222. data/bower_components/leaflet/docs/examples/crs-simple/uqm_map_detail.png +0 -0
  223. data/bower_components/leaflet/docs/examples/crs-simple/uqm_map_full.png +0 -0
  224. data/bower_components/leaflet/docs/examples/custom-icons-example.md +5 -0
  225. data/bower_components/leaflet/docs/examples/custom-icons.md +5 -0
  226. data/bower_components/leaflet/docs/examples/custom-icons/example-one-icon.md +27 -0
  227. data/bower_components/leaflet/docs/examples/custom-icons/example.md +31 -0
  228. data/bower_components/leaflet/docs/examples/custom-icons/index.md +79 -0
  229. data/bower_components/leaflet/docs/examples/custom-icons/leaf-green.png +0 -0
  230. data/bower_components/leaflet/docs/examples/custom-icons/leaf-orange.png +0 -0
  231. data/bower_components/leaflet/docs/examples/custom-icons/leaf-red.png +0 -0
  232. data/bower_components/leaflet/docs/examples/custom-icons/leaf-shadow.png +0 -0
  233. data/bower_components/leaflet/docs/examples/custom-icons/thumbnail.png +0 -0
  234. data/bower_components/leaflet/docs/examples/extending/canvascircles.md +37 -0
  235. data/bower_components/leaflet/docs/examples/extending/class-diagram.md +24 -0
  236. data/bower_components/leaflet/docs/examples/extending/class-diagram.png +0 -0
  237. data/bower_components/leaflet/docs/examples/extending/class-diagram.txt +100 -0
  238. data/bower_components/leaflet/docs/examples/extending/extending-1-classes.md +196 -0
  239. data/bower_components/leaflet/docs/examples/extending/extending-2-layers.md +210 -0
  240. data/bower_components/leaflet/docs/examples/extending/extending-3-controls.md +100 -0
  241. data/bower_components/leaflet/docs/examples/extending/gridcoords.md +32 -0
  242. data/bower_components/leaflet/docs/examples/extending/kittenlayer.md +29 -0
  243. data/bower_components/leaflet/docs/examples/extending/pixelorigin.md +90 -0
  244. data/bower_components/leaflet/docs/examples/extending/thumbnail-1.png +0 -0
  245. data/bower_components/leaflet/docs/examples/extending/thumbnail-2.png +0 -0
  246. data/bower_components/leaflet/docs/examples/extending/thumbnail-3.png +0 -0
  247. data/bower_components/leaflet/docs/examples/extending/tilt.md +59 -0
  248. data/bower_components/leaflet/docs/examples/extending/watermark.md +36 -0
  249. data/bower_components/leaflet/docs/examples/geojson-example.md +5 -0
  250. data/bower_components/leaflet/docs/examples/geojson.md +5 -0
  251. data/bower_components/leaflet/docs/examples/geojson/baseball-marker.png +0 -0
  252. data/bower_components/leaflet/docs/examples/geojson/example.md +78 -0
  253. data/bower_components/leaflet/docs/examples/geojson/geojson-example.html +89 -0
  254. data/bower_components/leaflet/docs/examples/geojson/geojson.html +281 -0
  255. data/bower_components/leaflet/docs/examples/geojson/index.md +205 -0
  256. data/bower_components/leaflet/docs/examples/geojson/sample-geojson.js +248 -0
  257. data/bower_components/leaflet/docs/examples/geojson/thumbnail.png +0 -0
  258. data/bower_components/leaflet/docs/examples/layers-control-example.md +5 -0
  259. data/bower_components/leaflet/docs/examples/layers-control.md +5 -0
  260. data/bower_components/leaflet/docs/examples/layers-control/example.md +38 -0
  261. data/bower_components/leaflet/docs/examples/layers-control/index.md +72 -0
  262. data/bower_components/leaflet/docs/examples/layers-control/thumbnail.png +0 -0
  263. data/bower_components/leaflet/docs/examples/map-panes-example.md +5 -0
  264. data/bower_components/leaflet/docs/examples/map-panes.md +5 -0
  265. data/bower_components/leaflet/docs/examples/map-panes/eu-countries.js +79 -0
  266. data/bower_components/leaflet/docs/examples/map-panes/example.md +38 -0
  267. data/bower_components/leaflet/docs/examples/map-panes/index.md +105 -0
  268. data/bower_components/leaflet/docs/examples/map-panes/thumbnail.png +0 -0
  269. data/bower_components/leaflet/docs/examples/mobile-example.md +5 -0
  270. data/bower_components/leaflet/docs/examples/mobile.md +5 -0
  271. data/bower_components/leaflet/docs/examples/mobile/example.md +42 -0
  272. data/bower_components/leaflet/docs/examples/mobile/index.md +72 -0
  273. data/bower_components/leaflet/docs/examples/mobile/thumbnail.png +0 -0
  274. data/bower_components/leaflet/docs/examples/quick-start-example.md +5 -0
  275. data/bower_components/leaflet/docs/examples/quick-start.md +5 -0
  276. data/bower_components/leaflet/docs/examples/quick-start/example-basic.md +19 -0
  277. data/bower_components/leaflet/docs/examples/quick-start/example-overlays.md +35 -0
  278. data/bower_components/leaflet/docs/examples/quick-start/example-popups.md +37 -0
  279. data/bower_components/leaflet/docs/examples/quick-start/example.md +46 -0
  280. data/bower_components/leaflet/docs/examples/quick-start/index.md +143 -0
  281. data/bower_components/leaflet/docs/examples/quick-start/thumbnail.png +0 -0
  282. data/bower_components/leaflet/docs/examples/video-overlay/example-bounds.md +23 -0
  283. data/bower_components/leaflet/docs/examples/video-overlay/example-nocontrols.md +31 -0
  284. data/bower_components/leaflet/docs/examples/video-overlay/example.md +58 -0
  285. data/bower_components/leaflet/docs/examples/video-overlay/index.md +122 -0
  286. data/bower_components/leaflet/docs/examples/video-overlay/thumbnail.gif +0 -0
  287. data/bower_components/leaflet/docs/examples/wms/qgis-wms-layers.png +0 -0
  288. data/bower_components/leaflet/docs/examples/wms/thumbnail.png +0 -0
  289. data/bower_components/leaflet/docs/examples/wms/wms-example-crs.md +18 -0
  290. data/bower_components/leaflet/docs/examples/wms/wms-example1.md +16 -0
  291. data/bower_components/leaflet/docs/examples/wms/wms-example2.md +16 -0
  292. data/bower_components/leaflet/docs/examples/wms/wms-example3.md +34 -0
  293. data/bower_components/leaflet/docs/examples/wms/wms-example4.md +29 -0
  294. data/bower_components/leaflet/docs/examples/wms/wms.md +157 -0
  295. data/bower_components/leaflet/docs/examples/zoom-levels/example-delta.md +40 -0
  296. data/bower_components/leaflet/docs/examples/zoom-levels/example-fractional.md +56 -0
  297. data/bower_components/leaflet/docs/examples/zoom-levels/example-scale.md +29 -0
  298. data/bower_components/leaflet/docs/examples/zoom-levels/example-setzoom.md +44 -0
  299. data/bower_components/leaflet/docs/examples/zoom-levels/example-zero.md +19 -0
  300. data/bower_components/leaflet/docs/examples/zoom-levels/index.md +275 -0
  301. data/bower_components/leaflet/docs/examples/zoom-levels/thumbnail.png +0 -0
  302. data/bower_components/leaflet/docs/index.html +218 -0
  303. data/bower_components/leaflet/docs/plugins.md +3854 -0
  304. data/bower_components/leaflet/docs/reference-0.7.7.html +6424 -0
  305. data/bower_components/leaflet/docs/reference-1.0.0.html +22889 -0
  306. data/bower_components/leaflet/docs/reference-1.0.2.html +23382 -0
  307. data/bower_components/leaflet/docs/reference-1.0.3.html +23495 -0
  308. data/bower_components/leaflet/docs/reference-tpl.html +89 -0
  309. data/bower_components/leaflet/docs/reference-versions.html +16 -0
  310. data/bower_components/leaflet/docs/reference.html +3 -0
  311. data/bower_components/leaflet/package.json +77 -16
  312. data/columbus3.gemspec +1 -1
  313. data/doc/ChangeLog.org +10 -0
  314. data/doc/manual.txt +122 -0
  315. data/doc/todo.org +63 -0
  316. data/exe/columbus3 +2 -246
  317. data/lib/columbus3.rb +12 -7
  318. data/lib/columbus3/cli/command_semantics.rb +352 -0
  319. data/lib/columbus3/cli/command_syntax.rb +103 -0
  320. data/lib/columbus3/metadata/query_parser.racc +21 -7
  321. data/lib/columbus3/metadata/query_parser.tab.rb +34 -34
  322. data/lib/columbus3/metadata/sidecar.rb +1 -1
  323. data/lib/columbus3/renderer/flot_renderer.rb +3 -8
  324. data/lib/columbus3/renderer/leaflet_renderer.rb +18 -29
  325. data/lib/columbus3/renderer/sanitizer.rb +8 -0
  326. data/lib/columbus3/v900track/gpx2v900.rb +31 -0
  327. data/lib/columbus3/v900track/v900track.rb +34 -8
  328. data/lib/columbus3/v900track/v900waypoint.rb +9 -0
  329. data/lib/columbus3/version.rb +1 -1
  330. data/lib/html/flot.html.erb +6 -6
  331. data/lib/html/show.html.erb +53 -76
  332. data/lib/html/track.js.erb +58 -12
  333. metadata +222 -23
  334. data/README.textile +0 -67
  335. data/bower_components/jquery/src/ajax/parseJSON.js +0 -13
  336. data/bower_components/jquery/src/css/defaultDisplay.js +0 -70
  337. data/bower_components/jquery/src/css/var/isHidden.js +0 -13
  338. data/bower_components/jquery/src/intro.js +0 -44
  339. data/bower_components/jquery/src/outro.js +0 -1
  340. data/bower_components/jquery/src/sizzle/dist/sizzle.min.js +0 -3
  341. data/bower_components/jquery/src/sizzle/dist/sizzle.min.map +0 -1
  342. data/bower_components/jquery/src/var/rnotwhite.js +0 -3
  343. data/bower_components/jquery/src/var/strundefined.js +0 -3
  344. data/bower_components/leaflet/component.json +0 -20
@@ -0,0 +1,24 @@
1
+ ---
2
+ layout: tutorial_frame
3
+ title: Leaflet class diagram
4
+ ---
5
+ <script type='text/javascript'>
6
+
7
+ var bounds = [[0,0], [1570,1910]];
8
+
9
+ var map = L.map('map', {
10
+ crs: L.CRS.Simple,
11
+ maxZoom: 0,
12
+ minZoom: -4,
13
+ maxBounds: bounds
14
+ });
15
+
16
+ map.getContainer().style.width = '100vw';
17
+ map.getContainer().style.height= '100vh';
18
+ document.body.style.margin = 0;
19
+
20
+ var image = L.imageOverlay('class-diagram.png', bounds).addTo(map);
21
+
22
+ map.fitBounds(bounds);
23
+
24
+ </script>
@@ -0,0 +1,100 @@
1
+
2
+ // Class inheritances in a format that
3
+ // http://www.yuml.me/diagram/class/draw
4
+ // understands and draws things from
5
+
6
+
7
+ [L.Util]
8
+ [L.Browser]
9
+ [L.LatLng|lat;lng]
10
+ [L.LatLngBounds] has 2 -.-> [L.LatLng]
11
+ [L.Point|x;y]
12
+ [L.Bounds] has 2 -.-> [L.Point]
13
+ [L.DomUtil]
14
+ [L.DomEvent]
15
+
16
+
17
+
18
+ [L.Class|options|extend();include();initialize()]
19
+
20
+ [L.Class] ^- [L.Control|onAdd();onRemove()]
21
+ [L.Control] ^- [L.Control.Attribution;L.Control.Layers;L.Control.Scale;L.Control.Zoom]
22
+
23
+ // L.Control] ^- L.Control.Attribution]
24
+ // L.Control] ^- L.Control.Layers]
25
+ // L.Control] ^- L.Control.Scale]
26
+ // L.Control] ^- L.Control.Zoom]
27
+
28
+
29
+ [L.Class] ^- [L.Evented]
30
+ [L.Evented|on();off();fire()]
31
+
32
+
33
+ [L.CRS] ^- [L.CRS.Earth]
34
+ [L.CRS] ^- [L.CRS.Simple]
35
+ [L.CRS.Earth] ^- [L.CRS.EPSG3395;L.CRS.EPSG3857;L.CRS.EPSG4326]
36
+
37
+ // L.CRS] ^- L.CRS.Earth]
38
+ // L.CRS] ^- L.CRS.Simple]
39
+ // L.CRS.Earth] ^- L.CRS.EPSG3395]
40
+ // L.CRS.Earth] ^- L.CRS.EPSG3857]
41
+ // L.CRS.EPSG3857] ^- L.CRS.EPSG900913]
42
+ // L.CRS.Earth] ^- L.CRS.EPSG4326]
43
+
44
+ [L.Evented] ^- [L.Layer]
45
+
46
+ [L.Layer|onAdd();onRemove();getEvents();getAttribution();beforeAdd()]
47
+
48
+ [L.Evented] ^- [L.Map|addHandler();addControl();removeControl();addLayer();removeLayer()]
49
+ [L.Map] contains -.-> [L.Layer]
50
+ [L.Map] contains -.-> [L.Control]
51
+ [L.Map] contains -.-> [L.Handler]
52
+ [L.Map] has one -.-> [L.CRS]
53
+
54
+ [L.Class] ^- [L.Handler|addHooks();removeHooks()]
55
+ [L.Handler] ^- [L.Map.BoxZoom;L.Map.DoubleClickZoom;L.Map.Drag;L.Map.Keyboard;L.Map.ScrollWheelZoom;L.Map.Tap;L.Map.TouchZoom]
56
+
57
+ // L.Handler] ^- L.Map.BoxZoom]
58
+ // L.Handler] ^- L.Map.DoubleClickZoom]
59
+ // L.Handler] ^- L.Map.Drag]
60
+ // L.Handler] ^- L.Map.Keyboard]
61
+ // L.Handler] ^- L.Map.ScrollWheelZoom]
62
+ // L.Handler] ^- L.Map.Tap]
63
+ // L.Handler] ^- L.Map.TouchZoom]
64
+
65
+ [L.Layer] ^- [L.Marker]
66
+ [L.Icon] ^- [L.Icon.Default]
67
+ [L.Icon] ^- [L.DivIcon]
68
+
69
+ [L.Marker] drawn as a -.-> [L.Icon]
70
+
71
+
72
+ [L.Layer] ^- [L.GridLayer|createTile()]
73
+ [L.GridLayer] ^- [L.TileLayer|getTileUrl()]
74
+ [L.TileLayer] ^- [L.TileLayer.WMS]
75
+
76
+
77
+ [L.Layer] ^- [L.Renderer]
78
+ [L.Renderer] ^- [L.Canvas]
79
+ [L.Renderer] ^- [L.SVG]
80
+
81
+ [L.Layer] ^- [L.Path]
82
+ [L.CircleMarker] ^- [L.Circle]
83
+ [L.Path] ^- [L.CircleMarker]
84
+ [L.Path] ^- [L.Polyline]
85
+ [L.Polyline] ^- [L.Polygon]
86
+ [L.Polygon] ^- [L.Rectangle]
87
+ [L.Path] drawn in a -.-> [L.Renderer]
88
+
89
+
90
+ [L.Layer] ^- [L.LayerGroup]
91
+ [L.LayerGroup] ^- [L.FeatureGroup]
92
+ [L.FeatureGroup] ^- [L.GeoJSON]
93
+
94
+ [L.Layer] ^- [L.DivOverlay]
95
+ [L.DivOverlay] ^- [L.Popup]
96
+ [L.DivOverlay] ^- [L.Tooltip]
97
+
98
+ [L.Layer] ^- [L.ImageOverlay]
99
+
100
+
@@ -0,0 +1,196 @@
1
+ ---
2
+ layout: tutorial_v2
3
+ title: Extending Leaflet, Class Theory
4
+ ---
5
+
6
+ ## Extending Leaflet
7
+
8
+ Leaflet has literally hundreds of plugins. These expand the capabilities of Leaflet: sometimes in a generic way, sometimes in a very use-case-specific way.
9
+
10
+ Part of the reason there are so many plugins is that Leaflet is easy to extend. This tutorial will cover the most commonly used ways of doing so.
11
+
12
+ Please note that this tutorial assumes you have a good grasp of:
13
+
14
+ * [JavaScript](https://developer.mozilla.org/en-US/Learn/JavaScript)
15
+ * [DOM handling](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction)
16
+ * [Object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented_programming) (understanding concepts like classes, instances, inheritance, methods and properties)
17
+
18
+
19
+ ## Leaflet architecture
20
+
21
+ Let's have a look at a simplified UML Class diagram for Leaflet 1.0.0. There are more than 60 JavaScript classes, so the diagram is a bit big. Luckily we can make a zoomable image with a `L.ImageOverlay`:
22
+
23
+ {% include frame.html url="class-diagram.html" %}
24
+
25
+
26
+ From a technical point of view, Leaflet can be extended in different ways:
27
+
28
+ * The most common: creating a new subclass of `L.Layer`, `L.Handler` or `L.Control`, with `L.Class.extend()`
29
+ * Layers move when the map is moved/zoomed
30
+ * Handlers are invisible and interpret browser events
31
+ * Controls are fixed interface elements
32
+ * Including more functionality in an existing class with `L.Class.include()`
33
+ * Adding new methods and options
34
+ * Changing some methods
35
+ * Using `addInitHook` to run extra constructor code.
36
+ * Changing parts of an existing class (replacing how a class method works) with `L.Class.include()`.
37
+
38
+ This tutorial covers some classes and methods available only in Leaflet 1.0.0. Use caution if you are developing a plugin for a previous version.
39
+
40
+ ## `L.Class`
41
+
42
+ JavaScript is a bit of a weird language. It's not really an object-oriented language, but rather a [prototype-oriented language](https://en.wikipedia.org/wiki/Prototype-based_programming). This has made JavaScript historically difficult to use class inheritance in the classic OOP meaning of the term.
43
+
44
+ Leaflet works around this by having `L.Class`, which eases up class inheritance.
45
+
46
+ Even though modern JavaScript can use ES6 classes, Leaflet is not designed around them.
47
+
48
+ ### `L.Class.extend()`
49
+
50
+ In order to create a subclass of anything in Leaflet, use the `.extend()` method. This accepts one parameter: a plain object with key-value pairs, each key being the name of a property or method, and each value being the initial value of a property, or the implementation of a method:
51
+
52
+ var MyDemoClass = L.Class.extend({
53
+
54
+ // A property with initial value = 42
55
+ myDemoProperty: 42,
56
+
57
+ // A method
58
+ myDemoMethod: function() { return this.myDemoProperty; }
59
+
60
+ });
61
+
62
+ var myDemoInstance = new MyDemoClass();
63
+
64
+ // This will output "42" to the development console
65
+ console.log( myDemoInstance.myDemoMethod() );
66
+
67
+ When naming classes, methods and properties, adhere to the following conventions:
68
+
69
+ * Function, method, property and factory names should be in [`lowerCamelCase`](https://en.wikipedia.org/wiki/CamelCase).
70
+ * Class names should be in [`UpperCamelCase`](https://en.wikipedia.org/wiki/CamelCase).
71
+ * Private properties and methods start with an underscore (`_`). This doesn't make them private, just recommends developers not to use them directly.
72
+
73
+ ### `L.Class.include()`
74
+
75
+ If a class is already defined, existing properties/methods can be redefined, or new ones can be added by using `.include()`:
76
+
77
+ MyDemoClass.include({
78
+
79
+ // Adding a new property to the class
80
+ _myPrivateProperty: 78,
81
+
82
+ // Redefining a method
83
+ myDemoMethod: function() { return this._myPrivateProperty; }
84
+
85
+ });
86
+
87
+ var mySecondDemoInstance = new MyDemoClass();
88
+
89
+ // This will output "78"
90
+ console.log( mySecondDemoInstance.myDemoMethod() );
91
+
92
+ // However, properties and methods from before still exist
93
+ // This will output "42"
94
+ console.log( mySecondDemoInstance.myDemoProperty );
95
+
96
+ ### `L.Class.initialize()`
97
+
98
+ In OOP, classes have a constructor method. In Leaflet's `L.Class`, the constructor method is always named `initialize`.
99
+
100
+ If your class has some specific `options`, it's a good idea to initialize them with `L.setOptions()` in the constructor. This utility function will merge the provided options with the default options of the class.
101
+
102
+
103
+ var MyBoxClass = L.Class.extend({
104
+
105
+ options: {
106
+ width: 1,
107
+ height: 1
108
+ },
109
+
110
+ initialize: function(name, options) {
111
+ this.name = name;
112
+ L.setOptions(this, options);
113
+ }
114
+
115
+ });
116
+
117
+ var instance = new MyBoxClass('Red', {width: 10});
118
+
119
+ console.log(instance.name); // Outputs "Red"
120
+ console.log(instance.options.width); // Outputs "10"
121
+ console.log(instance.options.height); // Outputs "1", the default
122
+
123
+ Leaflet handles the `options` property in a special way: options available for a parent class will be inherited by a children class:.
124
+
125
+ var MyCubeClass = MyBoxClass.extend({
126
+ options: {
127
+ depth: 1
128
+ }
129
+ });
130
+
131
+ var instance = new MyCubeClass('Blue');
132
+
133
+ console.log(instance.options.width);
134
+ console.log(instance.options.height);
135
+ console.log(instance.options.depth);
136
+
137
+
138
+ It's quite common for child classes to run the parent's constructor, and then their own constructor. In Leaflet this is achieved using `L.Class.addInitHook()`. This method can be used to "hook" initialization functions that run right after the class' `initialize()`, for example:
139
+
140
+ MyBoxClass.addInitHook(function(){
141
+ this._area = this.options.width * this.options.length;
142
+ });
143
+
144
+ That will run after `initialize()` is called (which calls `setOptions()`). This means that `this.options` exist and is valid when the init hook runs.
145
+
146
+ `addInitHook` has an alternate syntax, which uses method names and can fill method arguments in:
147
+
148
+ MyCubeClass.include({
149
+ _calculateVolume: function(arg1, arg2) {
150
+ this._volume = this.options.width * this.options.length * this.options.depth;
151
+ }
152
+ });
153
+
154
+ MyCubeClass.addInitHook('_calculateVolume', argValue1, argValue2);
155
+
156
+
157
+ ### Methods of the parent class
158
+
159
+ Calling a method of a parent class is achieved by reaching into the prototype of the parent class and using [`Function.call(…)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call). This can be seen, for example, in the code for `L.FeatureGroup`:
160
+
161
+ L.FeatureGroup = L.LayerGroup.extend({
162
+
163
+ addLayer: function (layer) {
164
+
165
+ L.LayerGroup.prototype.addLayer.call(this, layer);
166
+ },
167
+
168
+ removeLayer: function (layer) {
169
+
170
+ L.LayerGroup.prototype.removeLayer.call(this, layer);
171
+ },
172
+
173
+
174
+ });
175
+
176
+ Calling the parent's constructor is done in a similar way, but using `ParentClass.prototype.initialize.call(this, …)` instead.
177
+
178
+
179
+ ### Factories
180
+
181
+ Most Leaflet classes have a corresponding [factory function](https://en.wikipedia.org/wiki/Factory_%28object-oriented_programming%29). A factory function has the same name as the class, but in `lowerCamelCase` instead of `UpperCamelCase`:
182
+
183
+ function myBoxClass(name, options) {
184
+ return new MyBoxClass(name, options);
185
+ }
186
+
187
+
188
+ ### Naming conventions
189
+
190
+ When naming classes for Leaflet plugins, please adhere to the following naming conventions:
191
+
192
+ * Never expose global variables in your plugin.
193
+ * If you have a new class, put it directly in the `L` namespace (`L.MyPlugin`).
194
+ * If you inherit one of the existing classes, make it a sub-property (`L.TileLayer.Banana`).
195
+
196
+
@@ -0,0 +1,210 @@
1
+ ---
2
+ layout: tutorial_v2
3
+ title: Extending Leaflet, New Layers
4
+ ---
5
+
6
+ <br>
7
+
8
+ This tutorial assumes you've read the [theory of Leaflet class inheritance](./extending-1-classes.html).
9
+
10
+ In Leaflet, a "layer" is anything that moves around when the map is moved around. Before seeing how to create them from scratch, it's easier to explain how to do simple extensions.
11
+
12
+ ## "Extension methods"
13
+
14
+ A few of the Leaflet classes have so-called "extension methods": entry points for writing code for sub-classes.
15
+
16
+ One of them is `L.TileLayer.getTileUrl()`. This method is called internally by `L.TileLayer` whenever a new tile needs to know which image to load. By making a subclass of `L.TileLayer` and rewriting its `getTileUrl()` function, we can create custom behaviour.
17
+
18
+ Let's illustrate with a custom `L.TileLayer` that will display random kitten images from [PlaceKitten]():
19
+
20
+ L.TileLayer.Kitten = L.TileLayer.extend({
21
+ getTileUrl: function(coords) {
22
+ var i = Math.ceil( Math.random() * 4 );
23
+ return "http://placekitten.com/256/256?image=" + i;
24
+ },
25
+ getAttribution: function() {
26
+ return "<a href='http://placekitten.com/attribution.html'>PlaceKitten</a>"
27
+ }
28
+ });
29
+
30
+ L.tileLayer.kitten = function() {
31
+ return new L.TileLayer.Kitten();
32
+ }
33
+
34
+ L.tileLayer.kitten().addTo(map);
35
+
36
+ {% include frame.html url="kittenlayer.html" %}
37
+
38
+ Normally, `getTileLayer()` receives the tile coordinates (as `coords.x`, `coords.y` and `coords.z`) and generates a tile URL from them. In our example, we ignore those and simply use a random number to get a different kitten every time.
39
+
40
+ ### Splitting away the plugin code
41
+
42
+ In the previous example, `L.TileLayer.Kitten` is defined in the same place as it's used. For plugins, it's better to split the plugin code into its own file, and include that file when it's used.
43
+
44
+ For the KittenLayer, you should create a file like `L.KittenLayer.js` with:
45
+
46
+ L.TileLayer.Kitten = L.TileLayer.extend({
47
+ getTileUrl: function(coords) {
48
+ var i = Math.ceil( Math.random() * 4 );
49
+ return "http://placekitten.com/256/256?image=" + i;
50
+ },
51
+ getAttribution: function() {
52
+ return "<a href='http://placekitten.com/attribution.html'>PlaceKitten</a>"
53
+ }
54
+ });
55
+
56
+ And then, include that file when showing a map:
57
+
58
+ <html>
59
+
60
+ <script src='leaflet.js'>
61
+ <script src='L.KittenLayer.js'>
62
+ <script>
63
+ var map = L.map('map-div-id');
64
+ L.tileLayer.kitten().addTo(map);
65
+ </script>
66
+
67
+
68
+
69
+ ### `L.GridLayer` and DOM elements
70
+
71
+ Another extension method is `L.GridLayer.createTile()`. Where `L.TileLayer` assumes that there is a grid of images (as `<img>` elements), `L.GridLayer` doesn't assume that - it allows creating grids of any kind of [HTML Elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element).
72
+
73
+ `L.GridLayer` allows creating grids of `<img>`s, but grids of [`<div>`s](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div), [`<canvas>`es](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas) or [`<picture>`s](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture) (or anything) are possible. `createTile()` just has to return an instance of [`HTMLElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement) given the tile coordinates. Knowing how to manipulate elements in the [DOM](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Introduction) is important here: Leaflet expects instances of `HTMLElement`, so elements created with libraries like jQuery will be problematic.
74
+
75
+ An example of a custom `GridLayer` is showing the tile coordinates in a `<div>`. This is particularly useful when debugging the internals of Leaflet, and for understanding how the tile coordinates work:
76
+
77
+ L.GridLayer.DebugCoords = L.GridLayer.extend({
78
+ createTile: function (coords) {
79
+ var tile = document.createElement('div');
80
+ tile.innerHTML = [coords.x, coords.y, coords.z].join(', ');
81
+ tile.style.outline = '1px solid red';
82
+ return tile;
83
+ }
84
+ });
85
+
86
+ L.gridLayer.debugCoords = function(opts) {
87
+ return new L.GridLayer.DebugCoords(opts);
88
+ };
89
+
90
+ map.addLayer( L.gridLayer.debugCoords() );
91
+
92
+
93
+ If the element has to do some asynchronous initialization, then use the second function parameter `done` and call it back when the tile is ready (for example, when an image has been fully loaded) or when there is an error. In here, we'll just delay the tiles artificially:
94
+
95
+ createTile: function (coords, done) {
96
+ var tile = document.createElement('div');
97
+ tile.innerHTML = [coords.x, coords.y, coords.z].join(', ');
98
+ tile.style.outline = '1px solid red';
99
+
100
+ setTimeout(function () {
101
+ done(null, tile); // Syntax is 'done(error, tile)'
102
+ }, 500 + Math.random() * 1500);
103
+
104
+ return tile;
105
+ }
106
+
107
+ {% include frame.html url="gridcoords.html" %}
108
+
109
+ With these custom `GridLayer`s, a plugin can have full control of the HTML elements that make up the grid. A few plugins already use `<canvas>`es in this way to do advanced rendering.
110
+
111
+ A very basic `<canvas>` `GridLayer` looks like:
112
+
113
+ L.GridLayer.CanvasCircles = L.GridLayer.extend({
114
+ createTile: function (coords) {
115
+ var tile = document.createElement('canvas');
116
+
117
+ var tileSize = this.getTileSize();
118
+ tile.setAttribute('width', tileSize.x);
119
+ tile.setAttribute('height', tileSize.y);
120
+
121
+ var ctx = tile.getContext('2d');
122
+
123
+ // Draw whatever is needed in the canvas context
124
+ // For example, circles which get bigger as we zoom in
125
+ ctx.beginPath();
126
+ ctx.arc(tileSize.x/2, tileSize.x/2, 4 + coords.z*4, 0, 2*Math.PI, false);
127
+ ctx.fill();
128
+
129
+ return tile;
130
+ }
131
+ });
132
+
133
+ {% include frame.html url="canvascircles.html" %}
134
+
135
+
136
+ ## The pixel origin
137
+
138
+ Creating custom `L.Layer`s is possible, but needs a deeper knowledge of how Leaflet positions HTML elements. The abridged version is:
139
+
140
+ * The `L.Map` container has "map panes", which are `<div>`s.
141
+ * `L.Layer`s are HTML elements inside a map pane
142
+ * The map transforms all `LatLng`s to coordinates in the map's CRS, and from that into absolute "pixel coordinates" (the origin of the CRS is the same as the origin of the pixel coordinates)
143
+ * When the `L.Map` is ready (has a center `LatLng` and a zoom level), the absolute pixel coordinates of the top-left corner become the "pixel origin"
144
+ * Each `L.Layer` is offset from its map pane according to the pixel origin and the absolute pixel coordinates of the layer's `LatLng`s
145
+ * The pixel origin is reset after each `zoomend` or `viewreset` event on the `L.Map`, and every `L.Layer` has to recalculate its position (if needed)
146
+ * The pixel origin is *not* reset when panning the map around; instead, the whole panes are repositioned.
147
+
148
+ This might be a bit overwhelming, so consider the following explanatory map:
149
+
150
+ {% include frame.html url="pixelorigin.html" %}
151
+
152
+ The CRS origin (green) stays in the same `LatLng`. The pixel origin (red) always starts at the top-left corner. The pixel origin moves around when the map is panned (map panes are repositioned relative to the map's container), and stays in the same place in the screen when zooming (map panes are *not* repositioned, but layers might redraw themselves). The absolute pixel coordinate to the pixel origin is updated when zooming, but is not updated when panning. Note how the absolute pixel coordinates (the distance to the green bracket) double every time the map is zoomed in.
153
+
154
+ To position anything (for example, a blue `L.Marker`), its `LatLng` is converted to an absolute pixel coordinate inside the map's `L.CRS`. Then the absolute pixel coordinate of the pixel origin is subtracted from its absolute pixel coordinate, giving an offset relative to the pixel origin (light blue). As the pixel origin is the top-left corner of all map panes, this offset can be applied to the HTML element of the marker's icon. The marker's `iconAnchor` (dark blue line) is achieved via negative CSS margins.
155
+
156
+ The `L.Map.project()` and `L.Map.unproject()` methods operate with these absolute pixel coordinates. Likewise, `L.Map.latLngToLayerPoint()` and `L.Map.layerPointToLatLng()` work with the offset relative to the pixel origin.
157
+
158
+ Different layers apply these calculations in different ways. `L.Marker`s simply reposition their icons; `L.GridLayer`s calculate the bounds of the map (in absolute pixel coordinates) and then calculate the list of tile coordinates to request; vector layers (polylines, polygons, circle markers, etc) transform each `LatLng` to pixels and draw the geometries using SVG or `<canvas>`.
159
+
160
+
161
+ ### `onAdd` and `onRemove`
162
+
163
+ At their core, all `L.Layer`s are HTML elements inside a map pane, their positions and contents defined by the layer's code. However, HTML elements cannot be created when a layer is instantiated; rather, this is done when the layer is added to the map - the layer doesn't know about the map (or even about the `document`) until then.
164
+
165
+ In other words: the map calls the `onAdd()` method of the layer, then the layer creates its HTML element(s) (commonly named 'container' element) and adds them to the map pane. Conversely, when the layer is removed from the map, its `onRemove()` method is called. The layer must update its contents when added to the map, and reposition them when the map view is updated. A layer skeleton looks like:
166
+
167
+ L.CustomLayer = L.Layer.extend({
168
+ onAdd: function(map) {
169
+ var pane = map.getPane(this.options.pane);
170
+ this._container = L.DomUtil.create(…);
171
+
172
+ pane.appendChild(this._container);
173
+
174
+ // Calculate initial position of container with `L.Map.latLngToLayerPoint()`, `getPixelOrigin()` and/or `getPixelBounds()`
175
+
176
+ L.DomUtil.setPosition(this._container, point);
177
+
178
+ // Add and position children elements if needed
179
+
180
+ map.on('zoomend viewreset', this._update, this);
181
+ },
182
+
183
+ onRemove: function(map) {
184
+ L.DomUtil.remove(this._container);
185
+ map.off('zoomend viewreset', this._update, this);
186
+ },
187
+
188
+ _update: function() {
189
+ // Recalculate position of container
190
+
191
+ L.DomUtil.setPosition(this._container, point);
192
+
193
+ // Add/remove/reposition children elements if needed
194
+ }
195
+ });
196
+
197
+ How to exactly position the HTML elements for a layer depends on the specifics of the layer, but this introduction should help you to read Leaflet's layer code, and create new layers.
198
+
199
+ ### Using the parent's `onAdd`
200
+
201
+ Some use cases don't need the whole `onAdd` code to be recreated, but instead the code for the parent can be reused, then some specifics can be added before _or_ after that initialization (as needed).
202
+
203
+ To give an example, we can have a subclass of `L.Polyline` that will always be red (ignoring the options), like:
204
+
205
+ L.Polyline.Red = L.Polyline.extend({
206
+ onAdd: function(map) {
207
+ this.options.color = 'red';
208
+ L.Polyline.prototype.onAdd.call(this, map);
209
+ }
210
+ });