@prushforth/map 1.0.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +89 -0
  3. package/demo/index.html +78 -0
  4. package/dist/cjs/AttributionButton-DgbgLHy4.js +106 -0
  5. package/dist/cjs/MapTileLayer-D4vp8bR4.js +454 -0
  6. package/dist/cjs/app-globals-DY--Q2Nl.js +775 -0
  7. package/dist/cjs/calculatePosition-CDcdNl7C.js +92 -0
  8. package/dist/cjs/gcds-ext-map.cjs.js +47 -0
  9. package/dist/cjs/gcds-ext-map_2.cjs.entry.js +8081 -0
  10. package/dist/cjs/index-CW_WOSnc.js +32697 -0
  11. package/dist/cjs/index.cjs.js +2 -0
  12. package/dist/cjs/loader.cjs.js +14 -0
  13. package/dist/cjs/locale-_4nEyxeO.js +153 -0
  14. package/dist/cjs/map-a.cjs.entry.js +16 -0
  15. package/dist/cjs/map-caption.cjs.entry.js +55 -0
  16. package/dist/cjs/map-extent.cjs.entry.js +993 -0
  17. package/dist/cjs/map-feature.cjs.entry.js +636 -0
  18. package/dist/cjs/map-featurecaption.cjs.entry.js +14 -0
  19. package/dist/cjs/map-geometry.cjs.entry.js +36 -0
  20. package/dist/cjs/map-input.cjs.entry.js +348 -0
  21. package/dist/cjs/map-link.cjs.entry.js +6055 -0
  22. package/dist/cjs/map-meta.cjs.entry.js +40 -0
  23. package/dist/cjs/map-properties.cjs.entry.js +14 -0
  24. package/dist/cjs/map-select.cjs.entry.js +100 -0
  25. package/dist/cjs/map-span.cjs.entry.js +14 -0
  26. package/dist/cjs/map-style.cjs.entry.js +127 -0
  27. package/dist/cjs/map-tile.cjs.entry.js +274 -0
  28. package/dist/cjs/renderStyles-yOMXvf12.js +59 -0
  29. package/dist/collection/assets/canada.json +1 -0
  30. package/dist/collection/assets/images/w3community.ico +0 -0
  31. package/dist/collection/assets/mapml/en/apstile/arctic +18 -0
  32. package/dist/collection/assets/mapml/en/cbmtile/canvec +22 -0
  33. package/dist/collection/assets/mapml/en/cbmtile/cbmt +24 -0
  34. package/dist/collection/assets/mapml/en/cbmtile/cbmtgeom +20 -0
  35. package/dist/collection/assets/mapml/en/cbmtile/cbmtsimple +20 -0
  36. package/dist/collection/assets/mapml/en/cbmtile/current_conditions +33 -0
  37. package/dist/collection/assets/mapml/en/cbmtile/toporama +25 -0
  38. package/dist/collection/assets/mapml/en/custom/arcticsdi.mapml +18 -0
  39. package/dist/collection/assets/mapml/en/osmtile/cbmt +24 -0
  40. package/dist/collection/assets/mapml/en/osmtile/current_conditions +32 -0
  41. package/dist/collection/assets/mapml/en/osmtile/dark.mapml +19 -0
  42. package/dist/collection/assets/mapml/en/osmtile/light.mapml +19 -0
  43. package/dist/collection/assets/mapml/en/osmtile/osm +19 -0
  44. package/dist/collection/assets/mapml/en/osmtile/toporama +25 -0
  45. package/dist/collection/assets/mapml/fr/apstile/arctic +19 -0
  46. package/dist/collection/assets/mapml/fr/cbmtile/canvec +22 -0
  47. package/dist/collection/assets/mapml/fr/cbmtile/cbmt +24 -0
  48. package/dist/collection/assets/mapml/fr/cbmtile/cbmtgeom +20 -0
  49. package/dist/collection/assets/mapml/fr/cbmtile/cbmtsimple +20 -0
  50. package/dist/collection/assets/mapml/fr/cbmtile/current_conditions +25 -0
  51. package/dist/collection/assets/mapml/fr/cbmtile/toporama +25 -0
  52. package/dist/collection/assets/mapml/fr/osmtile/cbmt +24 -0
  53. package/dist/collection/assets/mapml/fr/osmtile/current_conditions +24 -0
  54. package/dist/collection/assets/mapml/fr/osmtile/dark.mapml +19 -0
  55. package/dist/collection/assets/mapml/fr/osmtile/light.mapml +19 -0
  56. package/dist/collection/assets/mapml/fr/osmtile/osm +19 -0
  57. package/dist/collection/assets/mapml/fr/osmtile/toporama +25 -0
  58. package/dist/collection/assets/pmtiles/darkTheme.js +19 -0
  59. package/dist/collection/assets/pmtiles/lightTheme.js +19 -0
  60. package/dist/collection/collection-manifest.json +28 -0
  61. package/dist/collection/components/gcds-ext-map/assets/pmtiles/darkTheme.js +19 -0
  62. package/dist/collection/components/gcds-ext-map/assets/pmtiles/lightTheme.js +19 -0
  63. package/dist/collection/components/gcds-ext-map/gcds-ext-map.css +2138 -0
  64. package/dist/collection/components/gcds-ext-map/gcds-ext-map.js +1517 -0
  65. package/dist/collection/components/gcds-ext-map/stories/gcds-ext-map.stories.js +367 -0
  66. package/dist/collection/components/map-a/map-a.js +89 -0
  67. package/dist/collection/components/map-caption/map-caption.js +52 -0
  68. package/dist/collection/components/map-extent/map-extent.js +809 -0
  69. package/dist/collection/components/map-feature/map-feature.js +724 -0
  70. package/dist/collection/components/map-featurecaption/map-featurecaption.js +6 -0
  71. package/dist/collection/components/map-geometry/map-geometry.js +57 -0
  72. package/dist/collection/components/map-input/map-input.js +355 -0
  73. package/dist/collection/components/map-layer/map-layer.js +1245 -0
  74. package/dist/collection/components/map-layer/stories/map-layer.stories.js +101 -0
  75. package/dist/collection/components/map-link/map-link.js +1149 -0
  76. package/dist/collection/components/map-meta/map-meta.js +82 -0
  77. package/dist/collection/components/map-properties/map-properties.js +7 -0
  78. package/dist/collection/components/map-select/map-select.js +145 -0
  79. package/dist/collection/components/map-span/map-span.js +7 -0
  80. package/dist/collection/components/map-style/map-style.js +144 -0
  81. package/dist/collection/components/map-tile/map-tile.js +370 -0
  82. package/dist/collection/components/utils/mapml/DOMTokenList.js +123 -0
  83. package/dist/collection/components/utils/mapml/DefaultMapOptions.js +11 -0
  84. package/dist/collection/components/utils/mapml/Util.js +1601 -0
  85. package/dist/collection/components/utils/mapml/control/AttributionButton.js +101 -0
  86. package/dist/collection/components/utils/mapml/control/FullscreenButton.js +181 -0
  87. package/dist/collection/components/utils/mapml/control/GeolocationButton.js +70 -0
  88. package/dist/collection/components/utils/mapml/control/LayerControl.js +212 -0
  89. package/dist/collection/components/utils/mapml/control/ReloadButton.js +75 -0
  90. package/dist/collection/components/utils/mapml/control/ScaleBar.js +108 -0
  91. package/dist/collection/components/utils/mapml/control/SearchButton.js +565 -0
  92. package/dist/collection/components/utils/mapml/elementSupport/extents/createLayerControlForExtent.js +259 -0
  93. package/dist/collection/components/utils/mapml/elementSupport/inputs/heightInput.js +18 -0
  94. package/dist/collection/components/utils/mapml/elementSupport/inputs/hiddenInput.js +19 -0
  95. package/dist/collection/components/utils/mapml/elementSupport/inputs/locationInput.js +127 -0
  96. package/dist/collection/components/utils/mapml/elementSupport/inputs/widthInput.js +18 -0
  97. package/dist/collection/components/utils/mapml/elementSupport/inputs/zoomInput.js +30 -0
  98. package/dist/collection/components/utils/mapml/elementSupport/layers/calculatePosition.js +88 -0
  99. package/dist/collection/components/utils/mapml/elementSupport/layers/createLayerControlForLayer.js +326 -0
  100. package/dist/collection/components/utils/mapml/elementSupport/layers/renderStyles.js +55 -0
  101. package/dist/collection/components/utils/mapml/elementSupport/viewers/matchMedia.js +251 -0
  102. package/dist/collection/components/utils/mapml/features/featureRenderer.js +342 -0
  103. package/dist/collection/components/utils/mapml/features/geometry.js +268 -0
  104. package/dist/collection/components/utils/mapml/features/path.js +485 -0
  105. package/dist/collection/components/utils/mapml/handlers/AnnounceMovement.js +154 -0
  106. package/dist/collection/components/utils/mapml/handlers/ContextMenu.js +1436 -0
  107. package/dist/collection/components/utils/mapml/handlers/FeatureIndex.js +116 -0
  108. package/dist/collection/components/utils/mapml/handlers/QueryHandler.js +476 -0
  109. package/dist/collection/components/utils/mapml/handlers/keyboard.js +60 -0
  110. package/dist/collection/components/utils/mapml/layers/Crosshair.js +108 -0
  111. package/dist/collection/components/utils/mapml/layers/DebugOverlay.js +357 -0
  112. package/dist/collection/components/utils/mapml/layers/FeatureIndexOverlay.js +239 -0
  113. package/dist/collection/components/utils/mapml/layers/ImageLayer.js +136 -0
  114. package/dist/collection/components/utils/mapml/layers/MapExtentLayer.js +114 -0
  115. package/dist/collection/components/utils/mapml/layers/MapFeatureLayer.js +623 -0
  116. package/dist/collection/components/utils/mapml/layers/MapLayer.js +640 -0
  117. package/dist/collection/components/utils/mapml/layers/MapTileLayer.js +450 -0
  118. package/dist/collection/components/utils/mapml/layers/TemplatedFeaturesOrTilesLayer.js +346 -0
  119. package/dist/collection/components/utils/mapml/layers/TemplatedImageLayer.js +276 -0
  120. package/dist/collection/components/utils/mapml/layers/TemplatedPMTilesLayer.js +135 -0
  121. package/dist/collection/components/utils/mapml/layers/TemplatedTileLayer.js +664 -0
  122. package/dist/collection/components/utils/utils.js +26 -0
  123. package/dist/collection/fonts/icons/LICENSE.txt +92 -0
  124. package/dist/collection/fonts/icons/README.md +543 -0
  125. package/dist/collection/fonts/icons/gcds-icons.css +110 -0
  126. package/dist/collection/fonts/icons/gcds-icons.eot +0 -0
  127. package/dist/collection/fonts/icons/gcds-icons.svg +82 -0
  128. package/dist/collection/fonts/icons/gcds-icons.ttf +0 -0
  129. package/dist/collection/fonts/icons/gcds-icons.woff +0 -0
  130. package/dist/collection/fonts/lato/LICENSE.txt +48 -0
  131. package/dist/collection/fonts/lato/README.md +195 -0
  132. package/dist/collection/fonts/lato/gcds-lato-italic.woff +0 -0
  133. package/dist/collection/fonts/lato/gcds-lato-italic.woff2 +0 -0
  134. package/dist/collection/fonts/lato/gcds-lato.css +30 -0
  135. package/dist/collection/fonts/lato/gcds-lato.woff +0 -0
  136. package/dist/collection/fonts/lato/gcds-lato.woff2 +0 -0
  137. package/dist/collection/fonts/noto-sans/LICENSE.txt +43 -0
  138. package/dist/collection/fonts/noto-sans/README.md +423 -0
  139. package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold-italic.woff +0 -0
  140. package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold-italic.woff2 +0 -0
  141. package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold.woff +0 -0
  142. package/dist/collection/fonts/noto-sans/gcds-noto-sans-bold.woff2 +0 -0
  143. package/dist/collection/fonts/noto-sans/gcds-noto-sans-light-italic.woff +0 -0
  144. package/dist/collection/fonts/noto-sans/gcds-noto-sans-light-italic.woff2 +0 -0
  145. package/dist/collection/fonts/noto-sans/gcds-noto-sans-light.woff +0 -0
  146. package/dist/collection/fonts/noto-sans/gcds-noto-sans-light.woff2 +0 -0
  147. package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium-italic.woff +0 -0
  148. package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium-italic.woff2 +0 -0
  149. package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium.woff +0 -0
  150. package/dist/collection/fonts/noto-sans/gcds-noto-sans-medium.woff2 +0 -0
  151. package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular-italic.woff +0 -0
  152. package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular-italic.woff2 +0 -0
  153. package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular.woff +0 -0
  154. package/dist/collection/fonts/noto-sans/gcds-noto-sans-regular.woff2 +0 -0
  155. package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff +0 -0
  156. package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff2 +0 -0
  157. package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold.woff +0 -0
  158. package/dist/collection/fonts/noto-sans/gcds-noto-sans-semibold.woff2 +0 -0
  159. package/dist/collection/fonts/noto-sans/gcds-noto-sans.css +89 -0
  160. package/dist/collection/fonts/noto-sans-mono/LICENSE.txt +93 -0
  161. package/dist/collection/fonts/noto-sans-mono/README.md +135 -0
  162. package/dist/collection/fonts/noto-sans-mono/gcds-noto-sans-mono.css +17 -0
  163. package/dist/collection/fonts/noto-sans-mono/gcds-noto-sans-mono.woff +0 -0
  164. package/dist/collection/fonts/noto-sans-mono/gcds-noto-sans-mono.woff2 +0 -0
  165. package/dist/collection/generated/locale.js +148 -0
  166. package/dist/collection/global/mapml-globals.js +916 -0
  167. package/dist/collection/index.js +1 -0
  168. package/dist/collection/leaflet-src.esm.js +14419 -0
  169. package/dist/components/gcds-ext-map.d.ts +11 -0
  170. package/dist/components/gcds-ext-map.js +10 -0
  171. package/dist/components/index.d.ts +35 -0
  172. package/dist/components/index.js +1 -0
  173. package/dist/components/map-a.d.ts +11 -0
  174. package/dist/components/map-a.js +1 -0
  175. package/dist/components/map-caption.d.ts +11 -0
  176. package/dist/components/map-caption.js +1 -0
  177. package/dist/components/map-extent.d.ts +11 -0
  178. package/dist/components/map-extent.js +1 -0
  179. package/dist/components/map-feature.d.ts +11 -0
  180. package/dist/components/map-feature.js +1 -0
  181. package/dist/components/map-featurecaption.d.ts +11 -0
  182. package/dist/components/map-featurecaption.js +1 -0
  183. package/dist/components/map-geometry.d.ts +11 -0
  184. package/dist/components/map-geometry.js +1 -0
  185. package/dist/components/map-input.d.ts +11 -0
  186. package/dist/components/map-input.js +1 -0
  187. package/dist/components/map-layer.d.ts +11 -0
  188. package/dist/components/map-layer.js +1 -0
  189. package/dist/components/map-link.d.ts +11 -0
  190. package/dist/components/map-link.js +1 -0
  191. package/dist/components/map-meta.d.ts +11 -0
  192. package/dist/components/map-meta.js +1 -0
  193. package/dist/components/map-properties.d.ts +11 -0
  194. package/dist/components/map-properties.js +1 -0
  195. package/dist/components/map-select.d.ts +11 -0
  196. package/dist/components/map-select.js +1 -0
  197. package/dist/components/map-span.d.ts +11 -0
  198. package/dist/components/map-span.js +1 -0
  199. package/dist/components/map-style.d.ts +11 -0
  200. package/dist/components/map-style.js +1 -0
  201. package/dist/components/map-tile.d.ts +11 -0
  202. package/dist/components/map-tile.js +1 -0
  203. package/dist/components/p-B4YLD_Og.js +1 -0
  204. package/dist/components/p-BE41zrui.js +1 -0
  205. package/dist/components/p-Bpv_U_Lb.js +1 -0
  206. package/dist/components/p-CwRxGZga.js +5 -0
  207. package/dist/components/p-EYVT9Efh.js +1 -0
  208. package/dist/components/p-gwC_yeRa.js +1 -0
  209. package/dist/esm/AttributionButton-CfaoSLCu.js +103 -0
  210. package/dist/esm/MapTileLayer-DvC_iOIS.js +451 -0
  211. package/dist/esm/app-globals-De5ze2BD.js +773 -0
  212. package/dist/esm/calculatePosition-B4YLD_Og.js +90 -0
  213. package/dist/esm/gcds-ext-map.js +43 -0
  214. package/dist/esm/gcds-ext-map_2.entry.js +8078 -0
  215. package/dist/esm/index-BUsJ7i5g.js +32656 -0
  216. package/dist/esm/index.js +1 -0
  217. package/dist/esm/loader.js +12 -0
  218. package/dist/esm/locale-Bpv_U_Lb.js +150 -0
  219. package/dist/esm/map-a.entry.js +14 -0
  220. package/dist/esm/map-caption.entry.js +53 -0
  221. package/dist/esm/map-extent.entry.js +991 -0
  222. package/dist/esm/map-feature.entry.js +634 -0
  223. package/dist/esm/map-featurecaption.entry.js +12 -0
  224. package/dist/esm/map-geometry.entry.js +34 -0
  225. package/dist/esm/map-input.entry.js +346 -0
  226. package/dist/esm/map-link.entry.js +6035 -0
  227. package/dist/esm/map-meta.entry.js +38 -0
  228. package/dist/esm/map-properties.entry.js +12 -0
  229. package/dist/esm/map-select.entry.js +98 -0
  230. package/dist/esm/map-span.entry.js +12 -0
  231. package/dist/esm/map-style.entry.js +125 -0
  232. package/dist/esm/map-tile.entry.js +272 -0
  233. package/dist/esm/renderStyles-EYVT9Efh.js +57 -0
  234. package/dist/gcds-ext-map/assets/canada.json +1 -0
  235. package/dist/gcds-ext-map/assets/images/w3community.ico +0 -0
  236. package/dist/gcds-ext-map/assets/mapml/en/apstile/arctic +18 -0
  237. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/canvec +22 -0
  238. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/cbmt +24 -0
  239. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/cbmtgeom +20 -0
  240. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/cbmtsimple +20 -0
  241. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/current_conditions +33 -0
  242. package/dist/gcds-ext-map/assets/mapml/en/cbmtile/toporama +25 -0
  243. package/dist/gcds-ext-map/assets/mapml/en/custom/arcticsdi.mapml +18 -0
  244. package/dist/gcds-ext-map/assets/mapml/en/osmtile/cbmt +24 -0
  245. package/dist/gcds-ext-map/assets/mapml/en/osmtile/current_conditions +32 -0
  246. package/dist/gcds-ext-map/assets/mapml/en/osmtile/dark.mapml +19 -0
  247. package/dist/gcds-ext-map/assets/mapml/en/osmtile/light.mapml +19 -0
  248. package/dist/gcds-ext-map/assets/mapml/en/osmtile/osm +19 -0
  249. package/dist/gcds-ext-map/assets/mapml/en/osmtile/toporama +25 -0
  250. package/dist/gcds-ext-map/assets/mapml/fr/apstile/arctic +19 -0
  251. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/canvec +22 -0
  252. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/cbmt +24 -0
  253. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/cbmtgeom +20 -0
  254. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/cbmtsimple +20 -0
  255. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/current_conditions +25 -0
  256. package/dist/gcds-ext-map/assets/mapml/fr/cbmtile/toporama +25 -0
  257. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/cbmt +24 -0
  258. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/current_conditions +24 -0
  259. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/dark.mapml +19 -0
  260. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/light.mapml +19 -0
  261. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/osm +19 -0
  262. package/dist/gcds-ext-map/assets/mapml/fr/osmtile/toporama +25 -0
  263. package/dist/gcds-ext-map/assets/pmtiles/darkTheme.js +19 -0
  264. package/dist/gcds-ext-map/assets/pmtiles/lightTheme.js +19 -0
  265. package/dist/gcds-ext-map/fonts/icons/LICENSE.txt +92 -0
  266. package/dist/gcds-ext-map/fonts/icons/README.md +543 -0
  267. package/dist/gcds-ext-map/fonts/icons/gcds-icons.css +110 -0
  268. package/dist/gcds-ext-map/fonts/icons/gcds-icons.eot +0 -0
  269. package/dist/gcds-ext-map/fonts/icons/gcds-icons.svg +82 -0
  270. package/dist/gcds-ext-map/fonts/icons/gcds-icons.ttf +0 -0
  271. package/dist/gcds-ext-map/fonts/icons/gcds-icons.woff +0 -0
  272. package/dist/gcds-ext-map/fonts/lato/LICENSE.txt +48 -0
  273. package/dist/gcds-ext-map/fonts/lato/README.md +195 -0
  274. package/dist/gcds-ext-map/fonts/lato/gcds-lato-italic.woff +0 -0
  275. package/dist/gcds-ext-map/fonts/lato/gcds-lato-italic.woff2 +0 -0
  276. package/dist/gcds-ext-map/fonts/lato/gcds-lato.css +30 -0
  277. package/dist/gcds-ext-map/fonts/lato/gcds-lato.woff +0 -0
  278. package/dist/gcds-ext-map/fonts/lato/gcds-lato.woff2 +0 -0
  279. package/dist/gcds-ext-map/fonts/noto-sans/LICENSE.txt +43 -0
  280. package/dist/gcds-ext-map/fonts/noto-sans/README.md +423 -0
  281. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold-italic.woff +0 -0
  282. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold-italic.woff2 +0 -0
  283. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold.woff +0 -0
  284. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-bold.woff2 +0 -0
  285. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light-italic.woff +0 -0
  286. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light-italic.woff2 +0 -0
  287. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light.woff +0 -0
  288. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-light.woff2 +0 -0
  289. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium-italic.woff +0 -0
  290. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium-italic.woff2 +0 -0
  291. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium.woff +0 -0
  292. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-medium.woff2 +0 -0
  293. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular-italic.woff +0 -0
  294. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular-italic.woff2 +0 -0
  295. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular.woff +0 -0
  296. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-regular.woff2 +0 -0
  297. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff +0 -0
  298. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold-italic.woff2 +0 -0
  299. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold.woff +0 -0
  300. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans-semibold.woff2 +0 -0
  301. package/dist/gcds-ext-map/fonts/noto-sans/gcds-noto-sans.css +89 -0
  302. package/dist/gcds-ext-map/fonts/noto-sans-mono/LICENSE.txt +93 -0
  303. package/dist/gcds-ext-map/fonts/noto-sans-mono/README.md +135 -0
  304. package/dist/gcds-ext-map/fonts/noto-sans-mono/gcds-noto-sans-mono.css +17 -0
  305. package/dist/gcds-ext-map/fonts/noto-sans-mono/gcds-noto-sans-mono.woff +0 -0
  306. package/dist/gcds-ext-map/fonts/noto-sans-mono/gcds-noto-sans-mono.woff2 +0 -0
  307. package/dist/gcds-ext-map/gcds-ext-map.esm.js +1 -0
  308. package/dist/gcds-ext-map/index.esm.js +0 -0
  309. package/dist/gcds-ext-map/leaflet-src.esm.js +14419 -0
  310. package/dist/gcds-ext-map/p-1b22f774.entry.js +1 -0
  311. package/dist/gcds-ext-map/p-29b4ba34.entry.js +1 -0
  312. package/dist/gcds-ext-map/p-2dd09d44.entry.js +1 -0
  313. package/dist/gcds-ext-map/p-3fef47e5.entry.js +1 -0
  314. package/dist/gcds-ext-map/p-4e324a1d.entry.js +1 -0
  315. package/dist/gcds-ext-map/p-4f4a6873.entry.js +1 -0
  316. package/dist/gcds-ext-map/p-9cc5ad37.entry.js +1 -0
  317. package/dist/gcds-ext-map/p-9edfea7d.entry.js +1 -0
  318. package/dist/gcds-ext-map/p-B4YLD_Og.js +1 -0
  319. package/dist/gcds-ext-map/p-B8Id5Ptd.js +1 -0
  320. package/dist/gcds-ext-map/p-BUsJ7i5g.js +6 -0
  321. package/dist/gcds-ext-map/p-Bpv_U_Lb.js +1 -0
  322. package/dist/gcds-ext-map/p-CtOuMgy9.js +1 -0
  323. package/dist/gcds-ext-map/p-Dd474fsL.js +1 -0
  324. package/dist/gcds-ext-map/p-EYVT9Efh.js +1 -0
  325. package/dist/gcds-ext-map/p-a67d721d.entry.js +1 -0
  326. package/dist/gcds-ext-map/p-b16e862b.entry.js +1 -0
  327. package/dist/gcds-ext-map/p-b9cbf1e0.entry.js +10 -0
  328. package/dist/gcds-ext-map/p-cab5246e.entry.js +1 -0
  329. package/dist/gcds-ext-map/p-d58d409b.entry.js +1 -0
  330. package/dist/gcds-ext-map/p-dfa21368.entry.js +1 -0
  331. package/dist/gcds-ext-map/p-f211048a.entry.js +1 -0
  332. package/dist/index.cjs.js +1 -0
  333. package/dist/index.js +1 -0
  334. package/dist/types/components/gcds-ext-map/gcds-ext-map.d.ts +125 -0
  335. package/dist/types/components/gcds-ext-map/stories/gcds-ext-map.stories.d.ts +230 -0
  336. package/dist/types/components/map-a/map-a.d.ts +7 -0
  337. package/dist/types/components/map-caption/map-caption.d.ts +7 -0
  338. package/dist/types/components/map-extent/map-extent.d.ts +53 -0
  339. package/dist/types/components/map-feature/map-feature.d.ts +50 -0
  340. package/dist/types/components/map-featurecaption/map-featurecaption.d.ts +3 -0
  341. package/dist/types/components/map-geometry/map-geometry.d.ts +7 -0
  342. package/dist/types/components/map-input/map-input.d.ts +24 -0
  343. package/dist/types/components/map-layer/map-layer.d.ts +85 -0
  344. package/dist/types/components/map-layer/stories/map-layer.stories.d.ts +96 -0
  345. package/dist/types/components/map-link/map-link.d.ts +66 -0
  346. package/dist/types/components/map-meta/map-meta.d.ts +11 -0
  347. package/dist/types/components/map-properties/map-properties.d.ts +3 -0
  348. package/dist/types/components/map-select/map-select.d.ts +13 -0
  349. package/dist/types/components/map-span/map-span.d.ts +5 -0
  350. package/dist/types/components/map-style/map-style.d.ts +17 -0
  351. package/dist/types/components/map-tile/map-tile.d.ts +32 -0
  352. package/dist/types/components/utils/mapml/DOMTokenList.d.ts +30 -0
  353. package/dist/types/components/utils/mapml/elementSupport/inputs/heightInput.d.ts +7 -0
  354. package/dist/types/components/utils/mapml/elementSupport/inputs/hiddenInput.d.ts +7 -0
  355. package/dist/types/components/utils/mapml/elementSupport/inputs/locationInput.d.ts +14 -0
  356. package/dist/types/components/utils/mapml/elementSupport/inputs/widthInput.d.ts +7 -0
  357. package/dist/types/components/utils/mapml/elementSupport/inputs/zoomInput.d.ts +11 -0
  358. package/dist/types/components/utils/mapml/layers/MapLayer.d.ts +69 -0
  359. package/dist/types/components/utils/utils.d.ts +2 -0
  360. package/dist/types/components.d.ts +521 -0
  361. package/dist/types/gcds-ext-map.d.ts +17 -0
  362. package/dist/types/generated/locale.d.ts +146 -0
  363. package/dist/types/index.d.ts +11 -0
  364. package/dist/types/stencil-public-runtime.d.ts +1861 -0
  365. package/loader/cdn.js +1 -0
  366. package/loader/index.cjs.js +1 -0
  367. package/loader/index.d.ts +24 -0
  368. package/loader/index.es2017.js +1 -0
  369. package/loader/index.js +2 -0
  370. package/package.json +87 -0
@@ -0,0 +1,346 @@
1
+ import {
2
+ LayerGroup,
3
+ DomUtil,
4
+ extend,
5
+ setOptions,
6
+ Util as LeafletUtil
7
+ } from 'leaflet';
8
+ import { Util } from '../Util.js';
9
+ import { mapTileLayer } from './MapTileLayer.js';
10
+ import { renderStyles } from '../elementSupport/layers/renderStyles.js';
11
+
12
+ /**
13
+ * LayerGroup for managing map-tile and map-feature elements retrieved via
14
+ * <map-link rel="features" tref="..."></map-link>
15
+ *
16
+ * Layers in this layer group will correspond to the following MapML elements
17
+ * retrieved by the template processing:
18
+ *
19
+ * <map-tile row="10" col="12" src="url1"></map-tile> LayerGroup._layers[0] <- each set of adjacent tiles
20
+ * <map-tile row="11" col="12" src="url2"></map-tile> LayerGroup._layers[0] <- is a single MapTileLayer
21
+ * <map-feature id="a"> LayerGroup._layers[1] <- each set of adjacent features
22
+ * <map-feature id="b"> LayerGroup._layers[1] <- is a single MapFeatureLayer
23
+ * <map-tile row="10" col="12" src="url3"></map-tile> LayerGroup._layers[2]
24
+ * <map-tile row="11" col="12" src="url4"></map-tile> LayerGroup._layers[2]
25
+ * <map-feature id="c"> LayerGroup._layers[3]
26
+ * <map-feature id="d"> LayerGroup._layers[3]
27
+ * etc
28
+ *
29
+ *
30
+ *
31
+ * Extends LayerGroup
32
+ */
33
+ export var TemplatedFeaturesOrTilesLayer = LayerGroup.extend({
34
+ initialize: function (template, options) {
35
+ LayerGroup.prototype.initialize.call(this, []);
36
+ this._template = template;
37
+ this._container = DomUtil.create('div', 'leaflet-layer');
38
+ DomUtil.addClass(this._container, 'mapml-features-tiles-container');
39
+ this.zoomBounds = options.zoomBounds;
40
+ this.extentBounds = options.extentBounds;
41
+ // get rid of duplicate info, it can be confusing
42
+ delete options.zoomBounds;
43
+ delete options.extentBounds;
44
+
45
+ this._linkEl = options.linkEl;
46
+ setOptions(this, extend(options, this._setUpTemplateVars(template)));
47
+ },
48
+ /**
49
+ * @override
50
+ * According to https://leafletjs.com/reference.html#layer-extension-methods
51
+ * every Layer instance should override onAdd, onRemove, getEvents, getAttribution
52
+ * and beforeAdd
53
+ *
54
+ * @param {Map} map - the Leaflet map to which this layer is added
55
+ */
56
+ onAdd: function (map) {
57
+ this._map = map;
58
+ // this causes the layer to actually render...
59
+ this.options.pane.appendChild(this._container);
60
+ this._onMoveEnd(); // load content
61
+
62
+ // The parent method adds constituent layers to the map
63
+ LayerGroup.prototype.onAdd.call(this, map);
64
+ },
65
+
66
+ onRemove: function (map) {
67
+ // Remove container from DOM, but don't delete it
68
+ DomUtil.remove(this._container);
69
+ // clean up the container
70
+ for (let child of this._container.children) {
71
+ DomUtil.remove(child);
72
+ }
73
+
74
+ // Remove each layer from the map, but does not clearLayers
75
+ LayerGroup.prototype.onRemove.call(this, map);
76
+ },
77
+ getContainer: function () {
78
+ return this._container;
79
+ },
80
+ getEvents: function () {
81
+ var events = {
82
+ moveend: this._onMoveEnd
83
+ };
84
+ return events;
85
+ },
86
+ isVisible: function () {
87
+ let map = this._linkEl.getMapEl()._map;
88
+ let mapZoom = map.getZoom();
89
+ let mapBounds = Util.pixelToPCRSBounds(
90
+ map.getPixelBounds(),
91
+ mapZoom,
92
+ map.options.projection
93
+ );
94
+ return (
95
+ mapZoom <= this.zoomBounds.maxZoom &&
96
+ mapZoom >= this.zoomBounds.minZoom &&
97
+ this.extentBounds.overlaps(mapBounds)
98
+ );
99
+ },
100
+ redraw: function () {
101
+ this._onMoveEnd();
102
+ },
103
+ _onMoveEnd: function () {
104
+ let history = this._map.options.mapEl._history;
105
+ let current = history[history.length - 1];
106
+ let previous = history[history.length - 2] ?? current;
107
+ let step = this._template.step;
108
+ let mapZoom = this._map.getZoom();
109
+ let steppedZoom = mapZoom;
110
+ //If zooming out from one step interval into a lower one or panning, set the stepped zoom
111
+ if (
112
+ (step !== '1' &&
113
+ (mapZoom + 1) % step === 0 &&
114
+ current.zoom === previous.zoom - 1) ||
115
+ current.zoom === previous.zoom ||
116
+ Math.floor(mapZoom / step) * step !==
117
+ Math.floor(previous.zoom / step) * step
118
+ ) {
119
+ steppedZoom = Math.floor(mapZoom / step) * step;
120
+ }
121
+ //No request needed if in a step interval (unless panning)
122
+ else if (mapZoom % this._template.step !== 0) return;
123
+
124
+ let scaleBounds = this._map.getPixelBounds(
125
+ this._map.getCenter(),
126
+ steppedZoom
127
+ );
128
+
129
+ const getUrl = ((zoom, bounds) => {
130
+ if (zoom === undefined) zoom = this._map.getZoom();
131
+ if (bounds === undefined) bounds = this._map.getPixelBounds();
132
+ const _TCRSToPCRS = (coords, zoom) => {
133
+ // TCRS pixel point to Projected CRS point (in meters, presumably)
134
+ var map = this._map,
135
+ crs = map.options.crs,
136
+ loc = crs.transformation.untransform(coords, crs.scale(zoom));
137
+ return loc;
138
+ };
139
+ var obj = {};
140
+ if (this.options.param.zoom) {
141
+ obj[this.options.param.zoom] = zoom;
142
+ }
143
+ if (this.options.param.width) {
144
+ obj[this.options.param.width] = this._map.getSize().x;
145
+ }
146
+ if (this.options.param.height) {
147
+ obj[this.options.param.height] = this._map.getSize().y;
148
+ }
149
+ if (this.options.param.bottom) {
150
+ obj[this.options.param.bottom] = _TCRSToPCRS(bounds.max, zoom).y;
151
+ }
152
+ if (this.options.param.left) {
153
+ obj[this.options.param.left] = _TCRSToPCRS(bounds.min, zoom).x;
154
+ }
155
+ if (this.options.param.top) {
156
+ obj[this.options.param.top] = _TCRSToPCRS(bounds.min, zoom).y;
157
+ }
158
+ if (this.options.param.right) {
159
+ obj[this.options.param.right] = _TCRSToPCRS(bounds.max, zoom).x;
160
+ }
161
+ // hidden and other variables that may be associated
162
+ for (var v in this.options.param) {
163
+ if (
164
+ ['width', 'height', 'left', 'right', 'top', 'bottom', 'zoom'].indexOf(
165
+ v
166
+ ) < 0
167
+ ) {
168
+ obj[v] = this.options.param[v];
169
+ }
170
+ }
171
+ return LeafletUtil.template(this._template.template, obj);
172
+ }).bind(this);
173
+ var url = getUrl(steppedZoom, scaleBounds);
174
+ this._url = url;
175
+
176
+ // do cleaning up for new request
177
+ this.clearLayers();
178
+ // shadow may has not yet attached to <map-extent> for the first-time rendering
179
+ if (this._linkEl.shadowRoot) {
180
+ this._linkEl.shadowRoot.innerHTML = '';
181
+ }
182
+ const removeCSS = (container) => {
183
+ const styleElements = container.querySelectorAll(
184
+ 'link[rel=stylesheet],style'
185
+ );
186
+ styleElements.forEach((element) => element.remove());
187
+ };
188
+ removeCSS(this._container);
189
+
190
+ //Leave the layers cleared if the layer is not visible
191
+ if (!this.isVisible()) {
192
+ this._url = '';
193
+ return;
194
+ }
195
+
196
+ let mapml,
197
+ headers = new Headers({
198
+ Accept: 'text/mapml'
199
+ }),
200
+ linkEl = this._linkEl,
201
+ getMapML = (url) => {
202
+ return fetch(url, { redirect: 'follow', headers: headers })
203
+ .then(function (response) {
204
+ return response.text();
205
+ })
206
+ .then(function (text) {
207
+ let parser = new DOMParser();
208
+ mapml = parser.parseFromString(text, 'application/xml');
209
+ let frag = document.createDocumentFragment();
210
+ const legalContentQuery = `
211
+ map-head > map-link,
212
+ map-body > map-link,
213
+ map-head > map-meta,
214
+ map-body > map-meta,
215
+ map-head > map-style,
216
+ map-body > map-style,
217
+ map-tile,
218
+ map-feature
219
+ `.trim(); // excludes map-extent
220
+ let elements = mapml.querySelectorAll(legalContentQuery);
221
+ for (let i = 0; i < elements.length; i++) {
222
+ frag.appendChild(elements[i]);
223
+ }
224
+ linkEl.shadowRoot.appendChild(frag);
225
+ });
226
+ };
227
+ const map = this._map;
228
+ getMapML(this._url)
229
+ .then(() => {
230
+ // ATTENTION: different approach needed wrt MapML.js due to stencil
231
+ // slowness - templated features are not found by the FeatureIndexOverlay
232
+ // unless you wait for them to be ready before firing templatedfeatureslayeradd event
233
+ // Wait for all map-feature elements to complete their async setup
234
+ // before firing the event to check feature index overlay
235
+ const features = linkEl.shadowRoot.querySelectorAll('map-feature');
236
+ const featurePromises = Array.from(features).map(feature => {
237
+ // Each feature has a whenReady() that resolves when geometry is added
238
+ return feature.whenReady ? feature.whenReady() : Promise.resolve();
239
+ });
240
+
241
+ Promise.all(featurePromises).then(() => {
242
+ //Fires event for feature index overlay to check overlaps
243
+ map.fire('templatedfeatureslayeradd');
244
+ });
245
+
246
+ this.eachLayer(function (layer) {
247
+ if (layer._path) {
248
+ if (layer._path.getAttribute('d') !== 'M0 0') {
249
+ layer._path.setAttribute('tabindex', 0);
250
+ } else {
251
+ layer._path.removeAttribute('tabindex');
252
+ }
253
+ if (layer._path.childElementCount === 0) {
254
+ let title = document.createElement('title');
255
+ title.innerText = this._linkEl.getMapEl().locale.dfFeatureCaption;
256
+ layer._path.appendChild(title);
257
+ }
258
+ }
259
+ }, this);
260
+ })
261
+ .catch(function (error) {
262
+ console.log(error);
263
+ });
264
+ },
265
+ _setUpTemplateVars: function (template) {
266
+ // process the inputs and create an object named "param"
267
+ // with member properties as follows:
268
+ // {width: {name: 'widthvarname'}, // value supplied by map if necessary
269
+ // height: {name: 'heightvarname'}, // value supplied by map if necessary
270
+ // left: {name: 'leftvarname', axis: 'leftaxisname'}, // axis name drives (coordinate system of) the value supplied by the map
271
+ // right: {name: 'rightvarname', axis: 'rightaxisname'}, // axis name (coordinate system of) drives the value supplied by the map
272
+ // top: {name: 'topvarname', axis: 'topaxisname'}, // axis name drives (coordinate system of) the value supplied by the map
273
+ // bottom: {name: 'bottomvarname', axis: 'bottomaxisname'} // axis name drives (coordinate system of) the value supplied by the map
274
+ // zoom: {name: 'zoomvarname'}
275
+ // hidden: [{name: name, value: value}]}
276
+
277
+ var templateVarNames = { param: {} },
278
+ inputs = template.values;
279
+ templateVarNames.param.hidden = [];
280
+ for (var i = 0; i < inputs.length; i++) {
281
+ // this can be removed when the spec removes the deprecated inputs...
282
+ var type = inputs[i].getAttribute('type'),
283
+ units = inputs[i].getAttribute('units'),
284
+ axis = inputs[i].getAttribute('axis'),
285
+ name = inputs[i].getAttribute('name'),
286
+ position = inputs[i].getAttribute('position'),
287
+ value = inputs[i].getAttribute('value'),
288
+ select = inputs[i].tagName.toLowerCase() === 'map-select';
289
+ if (type === 'width') {
290
+ templateVarNames.param.width = name;
291
+ } else if (type === 'height') {
292
+ templateVarNames.param.height = name;
293
+ } else if (type === 'zoom') {
294
+ templateVarNames.param.zoom = name;
295
+ } else if (
296
+ type === 'location' &&
297
+ (units === 'pcrs' || units === 'gcrs')
298
+ ) {
299
+ //<input name="..." units="pcrs" type="location" position="top|bottom-left|right" axis="northing|easting">
300
+ switch (axis) {
301
+ case 'x':
302
+ case 'longitude':
303
+ case 'easting':
304
+ if (position) {
305
+ if (position.match(/.*?-left/i)) {
306
+ templateVarNames.param.left = name;
307
+ } else if (position.match(/.*?-right/i)) {
308
+ templateVarNames.param.right = name;
309
+ }
310
+ }
311
+ break;
312
+ case 'y':
313
+ case 'latitude':
314
+ case 'northing':
315
+ if (position) {
316
+ if (position.match(/top-.*?/i)) {
317
+ templateVarNames.param.top = name;
318
+ } else if (position.match(/bottom-.*?/i)) {
319
+ templateVarNames.param.bottom = name;
320
+ }
321
+ }
322
+ break;
323
+ }
324
+ } else if (select) {
325
+ /*jshint -W104 */
326
+ const parsedselect = inputs[i].htmlselect;
327
+ templateVarNames.param[name] = function () {
328
+ return parsedselect.value;
329
+ };
330
+ // projection is deprecated, make it hidden
331
+ } else {
332
+ /*jshint -W104 */
333
+ const input = inputs[i];
334
+ templateVarNames.param[name] = function () {
335
+ return input.getAttribute('value');
336
+ };
337
+ }
338
+ }
339
+ return templateVarNames;
340
+ },
341
+ renderStyles
342
+ });
343
+
344
+ export var templatedFeaturesOrTilesLayer = function (template, options) {
345
+ return new TemplatedFeaturesOrTilesLayer(template, options);
346
+ };
@@ -0,0 +1,276 @@
1
+ import {
2
+ Layer,
3
+ DomUtil,
4
+ extend,
5
+ setOptions,
6
+ point,
7
+ Util as LeafletUtil
8
+ } from 'leaflet';
9
+
10
+ import { Util } from '../Util.js';
11
+ import { ImageLayer, imageLayer } from './ImageLayer.js';
12
+
13
+ export var TemplatedImageLayer = Layer.extend({
14
+ initialize: function (template, options) {
15
+ this._template = template;
16
+ this._container = DomUtil.create('div', 'leaflet-layer');
17
+ DomUtil.addClass(this._container, 'mapml-image-container');
18
+ this._linkEl = options.linkEl;
19
+ this.zoomBounds = options.zoomBounds;
20
+ this.extentBounds = options.extentBounds;
21
+ // get rid of unused duplicate information that can be confusing
22
+ delete options.zoomBounds;
23
+ delete options.extentBounds;
24
+ setOptions(this, extend(options, this._setUpExtentTemplateVars(template)));
25
+ },
26
+ getEvents: function () {
27
+ var events = {
28
+ moveend: this._onMoveEnd,
29
+ zoomstart: this._clearLayer
30
+ };
31
+ return events;
32
+ },
33
+ onAdd: function (map) {
34
+ this._map = map;
35
+ // TODO: set this._map by ourselves
36
+ this.options.pane.appendChild(this._container);
37
+ this.setZIndex(this.options.zIndex);
38
+ this._onAdd();
39
+ },
40
+ redraw: function () {
41
+ this._onMoveEnd();
42
+ },
43
+ isVisible: function () {
44
+ let map = this._linkEl.getMapEl()._map;
45
+ let mapZoom = map.getZoom();
46
+ let mapBounds = Util.pixelToPCRSBounds(
47
+ map.getPixelBounds(),
48
+ mapZoom,
49
+ map.options.projection
50
+ );
51
+ return (
52
+ mapZoom <= this.zoomBounds.maxZoom &&
53
+ mapZoom >= this.zoomBounds.minZoom &&
54
+ this.extentBounds.overlaps(mapBounds)
55
+ );
56
+ },
57
+ _clearLayer: function () {
58
+ let containerImages = this._container.querySelectorAll('img');
59
+ for (let i = 0; i < containerImages.length; i++) {
60
+ this._container.removeChild(containerImages[i]);
61
+ }
62
+ },
63
+
64
+ _addImage: function (bounds, zoom, loc) {
65
+ let map = this._map;
66
+ let overlayToRemove = this._imageOverlay;
67
+ let src = this.getImageUrl(bounds, zoom);
68
+ let size = map.getSize();
69
+ this._imageOverlay = imageLayer(src, loc, size, 0, this._container);
70
+ this._imageOverlay._step = this._template.step;
71
+ this._imageOverlay.addTo(map);
72
+ if (overlayToRemove) {
73
+ this._imageOverlay._overlayToRemove = overlayToRemove._url;
74
+ this._imageOverlay.on('load error', function () {
75
+ map.removeLayer(overlayToRemove);
76
+ });
77
+ }
78
+ },
79
+
80
+ _scaleImage: function (bounds, zoom) {
81
+ let obj = this;
82
+ setTimeout(function () {
83
+ if (!obj._map) return;
84
+ let step = obj._template.step;
85
+ let steppedZoom = Math.floor(zoom / step) * step;
86
+ let scale = obj._map.getZoomScale(zoom, steppedZoom);
87
+ let translate = bounds.min
88
+ .multiplyBy(scale)
89
+ .subtract(obj._map._getNewPixelOrigin(obj._map.getCenter(), zoom))
90
+ .round();
91
+ DomUtil.setTransform(obj._imageOverlay._image, translate, scale);
92
+ });
93
+ },
94
+
95
+ _onAdd: function () {
96
+ let zoom = this._map.getZoom();
97
+ let steppedZoom = zoom;
98
+ let step = this._template.step;
99
+
100
+ if (zoom % step !== 0) steppedZoom = Math.floor(zoom / step) * step;
101
+ let bounds = this._map.getPixelBounds(this._map.getCenter(), steppedZoom);
102
+ this._pixelOrigins = {};
103
+ this._pixelOrigins[steppedZoom] = bounds.min;
104
+ // if the map is panned before the new image layer is added,
105
+ // the location that the layer should be added to is no longer (0,0) but need to be calculated
106
+ let loc = this._map
107
+ .getPixelBounds()
108
+ .min.subtract(this._map.getPixelOrigin());
109
+ this._addImage(bounds, steppedZoom, loc);
110
+ if (zoom !== steppedZoom) {
111
+ this._scaleImage(bounds, zoom);
112
+ }
113
+ },
114
+
115
+ _onMoveEnd: function (e) {
116
+ let mapZoom = this._map.getZoom();
117
+ let history = this._map.options.mapEl._history;
118
+ let current = history[history.length - 1];
119
+ let previous = history[history.length - 2];
120
+ if (!previous) previous = current;
121
+ let step = this._template.step;
122
+ let steppedZoom = Math.floor(mapZoom / step) * step;
123
+ let bounds = this._map.getPixelBounds(this._map.getCenter(), steppedZoom);
124
+ //Zooming from one step increment into a lower one
125
+ if (
126
+ step !== '1' &&
127
+ (mapZoom + 1) % step === 0 &&
128
+ current.zoom === previous.zoom - 1
129
+ ) {
130
+ this._addImage(bounds, steppedZoom, point(0, 0));
131
+ this._scaleImage(bounds, mapZoom);
132
+ //Zooming or panning within a step increment
133
+ } else if (e && mapZoom % step !== 0) {
134
+ this._imageOverlay._overlayToRemove = this._imageOverlay._url;
135
+ if (current.zoom !== previous.zoom) {
136
+ //Zoomed from within one step increment into another
137
+ this._addImage(bounds, steppedZoom, point(0, 0));
138
+ this._pixelOrigins[steppedZoom] = bounds.min;
139
+ this._scaleImage(bounds, mapZoom);
140
+ } else {
141
+ // Panning within a step increment
142
+ let pixelOrigin = this._pixelOrigins[steppedZoom];
143
+ let loc = bounds.min.subtract(pixelOrigin);
144
+ if (this.getImageUrl(bounds, steppedZoom) === this._imageOverlay._url)
145
+ return;
146
+ this._addImage(bounds, steppedZoom, loc);
147
+ this._scaleImage(bounds, mapZoom);
148
+ }
149
+ // Zooming from one step decrement into a higher one
150
+ // OR panning when mapZoom % step === 0
151
+ } else {
152
+ if (!this.isVisible) {
153
+ this._clearLayer();
154
+ return;
155
+ }
156
+ var map = this._map,
157
+ loc = map.getPixelBounds().min.subtract(map.getPixelOrigin());
158
+ this._addImage(map.getPixelBounds(), mapZoom, loc);
159
+ this._pixelOrigins[mapZoom] = map.getPixelOrigin();
160
+ }
161
+ },
162
+ setZIndex: function (zIndex) {
163
+ this.options.zIndex = zIndex;
164
+ this._updateZIndex();
165
+
166
+ return this;
167
+ },
168
+ _updateZIndex: function () {
169
+ if (
170
+ this._container &&
171
+ this.options.zIndex !== undefined &&
172
+ this.options.zIndex !== null
173
+ ) {
174
+ this._container.style.zIndex = this.options.zIndex;
175
+ }
176
+ },
177
+ onRemove: function (map) {
178
+ DomUtil.remove(this._container);
179
+ this._clearLayer();
180
+ },
181
+ getImageUrl: function (pixelBounds, zoom) {
182
+ var obj = {};
183
+ obj[this.options.extent.width] = this._map.getSize().x;
184
+ obj[this.options.extent.height] = this._map.getSize().y;
185
+ obj[this.options.extent.bottom] = this._TCRSToPCRS(pixelBounds.max, zoom).y;
186
+ obj[this.options.extent.left] = this._TCRSToPCRS(pixelBounds.min, zoom).x;
187
+ obj[this.options.extent.top] = this._TCRSToPCRS(pixelBounds.min, zoom).y;
188
+ obj[this.options.extent.right] = this._TCRSToPCRS(pixelBounds.max, zoom).x;
189
+ // hidden and other variables that may be associated
190
+ for (var v in this.options.extent) {
191
+ if (
192
+ ['width', 'height', 'left', 'right', 'top', 'bottom'].indexOf(v) < 0
193
+ ) {
194
+ obj[v] = this.options.extent[v];
195
+ }
196
+ }
197
+ return LeafletUtil.template(this._template.template, obj);
198
+ },
199
+ _TCRSToPCRS: function (coords, zoom) {
200
+ // TCRS pixel point to Projected CRS point (in meters, presumably)
201
+ var map = this._map,
202
+ crs = map.options.crs,
203
+ loc = crs.transformation.untransform(coords, crs.scale(zoom));
204
+ return loc;
205
+ },
206
+ _setUpExtentTemplateVars: function (template) {
207
+ // process the inputs associated to template and create an object named
208
+ // extent with member properties as follows:
209
+ // {width: 'widthvarname',
210
+ // height: 'heightvarname',
211
+ // left: 'leftvarname',
212
+ // right: 'rightvarname',
213
+ // top: 'topvarname',
214
+ // bottom: 'bottomvarname'}
215
+
216
+ var extentVarNames = { extent: {} },
217
+ inputs = template.values;
218
+
219
+ for (var i = 0; i < template.values.length; i++) {
220
+ var type = inputs[i].getAttribute('type'),
221
+ units = inputs[i].getAttribute('units'),
222
+ axis = inputs[i].getAttribute('axis'),
223
+ name = inputs[i].getAttribute('name'),
224
+ position = inputs[i].getAttribute('position'),
225
+ select = inputs[i].tagName.toLowerCase() === 'map-select';
226
+ if (type === 'width') {
227
+ extentVarNames.extent.width = name;
228
+ } else if (type === 'height') {
229
+ extentVarNames.extent.height = name;
230
+ } else if (
231
+ type === 'location' &&
232
+ (units === 'pcrs' || units === 'gcrs')
233
+ ) {
234
+ //<input name="..." units="pcrs" type="location" position="top|bottom-left|right" axis="northing|easting|latitude|longitude">
235
+ switch (axis) {
236
+ case 'longitude':
237
+ case 'easting':
238
+ if (position) {
239
+ if (position.match(/.*?-left/i)) {
240
+ extentVarNames.extent.left = name;
241
+ } else if (position.match(/.*?-right/i)) {
242
+ extentVarNames.extent.right = name;
243
+ }
244
+ }
245
+ break;
246
+ case 'latitude':
247
+ case 'northing':
248
+ if (position) {
249
+ if (position.match(/top-.*?/i)) {
250
+ extentVarNames.extent.top = name;
251
+ } else if (position.match(/bottom-.*?/i)) {
252
+ extentVarNames.extent.bottom = name;
253
+ }
254
+ }
255
+ break;
256
+ }
257
+ } else if (select) {
258
+ /*jshint -W104 */
259
+ const parsedselect = inputs[i].htmlselect;
260
+ extentVarNames.extent[name] = function () {
261
+ return parsedselect.value;
262
+ };
263
+ } else {
264
+ /*jshint -W104 */
265
+ const input = inputs[i];
266
+ extentVarNames.extent[name] = function () {
267
+ return input.getAttribute('value');
268
+ };
269
+ }
270
+ }
271
+ return extentVarNames;
272
+ }
273
+ });
274
+ export var templatedImageLayer = function (template, options) {
275
+ return new TemplatedImageLayer(template, options);
276
+ };