@bino-bi/bn-template-engine 1.0.0-alpha.0 → 1.0.0-alpha.2

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 (278) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-_LBTIfNN.js → p--PSoPbDM.js} +1 -1
  3. package/dist/bn-template-engine/p-05a82a77.entry.js +1 -0
  4. package/dist/bn-template-engine/p-0ca8dc17.entry.js +1 -0
  5. package/dist/bn-template-engine/p-0f1504f3.entry.js +1 -0
  6. package/dist/bn-template-engine/p-1d9a3be9.entry.js +1 -0
  7. package/dist/bn-template-engine/p-35638ad0.entry.js +1 -0
  8. package/dist/bn-template-engine/p-37881d05.entry.js +1 -0
  9. package/dist/bn-template-engine/{p-65f8962a.entry.js → p-3b894997.entry.js} +1 -1
  10. package/dist/bn-template-engine/p-50e49732.entry.js +1 -0
  11. package/dist/bn-template-engine/p-60a7fc59.entry.js +1 -0
  12. package/dist/bn-template-engine/{p-ad94cf63.entry.js → p-6c7c0455.entry.js} +1 -1
  13. package/dist/bn-template-engine/p-6da93eae.entry.js +1 -0
  14. package/dist/bn-template-engine/p-701e1578.entry.js +1 -0
  15. package/dist/bn-template-engine/p-BSfqOkN_.js +1 -0
  16. package/dist/bn-template-engine/{p--TeDldm8.js → p-CRLgp9-v.js} +1 -1
  17. package/dist/bn-template-engine/p-CYjZRKdI.js +1 -0
  18. package/dist/bn-template-engine/{p-Cp4MVxCu.js → p-CvXqez4D.js} +1 -1
  19. package/dist/bn-template-engine/p-DG-1MR_T.js +1 -0
  20. package/dist/bn-template-engine/{p-CnI71OA9.js → p-DRikHQE-.js} +1 -1
  21. package/dist/bn-template-engine/p-DVMu6dEy.js +1 -0
  22. package/dist/bn-template-engine/p-DVo6aZUE.js +1 -0
  23. package/dist/bn-template-engine/p-DdexOqTs.js +1 -0
  24. package/dist/bn-template-engine/p-DgfL-ffj.js +1 -0
  25. package/dist/bn-template-engine/p-DyRaC0MB.js +1 -0
  26. package/dist/bn-template-engine/p-JNHhIe7t.js +2 -0
  27. package/dist/bn-template-engine/p-a95ccc16.entry.js +1 -0
  28. package/dist/bn-template-engine/p-b7bec050.entry.js +1 -0
  29. package/dist/bn-template-engine/p-bc59ea5c.entry.js +1 -0
  30. package/dist/bn-template-engine/p-d279b578.entry.js +1 -0
  31. package/dist/bn-template-engine/p-dd9dd407.entry.js +1 -0
  32. package/dist/bn-template-engine/p-e102a490.entry.js +1 -0
  33. package/dist/bn-template-engine/p-f27995c9.entry.js +1 -0
  34. package/dist/bn-template-engine/p-f89e55c6.entry.js +1 -0
  35. package/dist/bn-template-engine/{p-CY1RzLjU.js → p-tzFCK9qn.js} +1 -1
  36. package/dist/cjs/{DataFormatDigits-DmTbhF8q.js → DataFormatDigits-CbIVfGEH.js} +1 -1
  37. package/dist/cjs/{DateStringFactory-Dn0aRj2Y.js → DateStringFactory-CfkXYAMN.js} +4 -5
  38. package/dist/cjs/{luxon-8hyy5YD7.js → Order-DtpbD8mQ.js} +282 -0
  39. package/dist/cjs/{SVGVariancesStyleGroup-Czizhngt.js → SVGVariancesStyleGroup-D-rTWlDo.js} +1 -1
  40. package/dist/cjs/{StringAdapter-0EbYMkR0.js → StringAdapter-ByCHdlDO.js} +1 -1
  41. package/dist/cjs/bn-asset.cjs.entry.js +5 -6
  42. package/dist/cjs/{bn-body_3.cjs.entry.js → bn-body_4.cjs.entry.js} +360 -27
  43. package/dist/cjs/bn-card.cjs.entry.js +5 -6
  44. package/dist/cjs/bn-chart-structure.cjs.entry.js +17 -22
  45. package/dist/cjs/bn-chart-time.cjs.entry.js +38 -51
  46. package/dist/cjs/bn-component-style.cjs.entry.js +5 -6
  47. package/dist/cjs/bn-context_5.cjs.entry.js +36 -40
  48. package/dist/cjs/bn-dataset.cjs.entry.js +5 -6
  49. package/dist/cjs/bn-grid.cjs.entry.js +8 -11
  50. package/dist/cjs/bn-image.cjs.entry.js +8 -11
  51. package/dist/cjs/bn-internationalization.cjs.entry.js +5 -6
  52. package/dist/cjs/bn-layout-card.cjs.entry.js +3 -3
  53. package/dist/cjs/bn-layout-page.cjs.entry.js +2 -2
  54. package/dist/cjs/bn-message.cjs.entry.js +6 -7
  55. package/dist/cjs/bn-template-engine.cjs.js +2 -2
  56. package/dist/cjs/bn-template.cjs.entry.js +4 -5
  57. package/dist/cjs/bn-text.cjs.entry.js +12 -16
  58. package/dist/cjs/bn-tree.cjs.entry.js +8 -11
  59. package/dist/cjs/{context-protocol-BkYHFkXE.js → context-protocol-CRPmux5D.js} +1 -1
  60. package/dist/cjs/editor-companion.cjs.entry.js +3 -3
  61. package/dist/cjs/ibcs-chart-structure.cjs.entry.js +31 -33
  62. package/dist/cjs/ibcs-chart-time.cjs.entry.js +42 -44
  63. package/dist/cjs/{index-CScBFiS1.js → index-Cjw0q6gP.js} +1 -2
  64. package/dist/cjs/loader.cjs.js +2 -2
  65. package/dist/cjs/{withDataset-ZdN-RRTx.js → scaling-D8sIIKft.js} +68 -3
  66. package/dist/cjs/{withBodyObserver-B0_W1VOf.js → withBodyObserver-C6gLgq_e.js} +2 -2
  67. package/dist/cjs/{componentRegister-C17UFNPh.js → withComponentStatus-_x4LQZ0N.js} +43 -6
  68. package/dist/cjs/{withComponentStyle-C6KHnZHt.js → withComponentStyle-DMtic_9Y.js} +3 -3
  69. package/dist/cjs/{withHasError-Dspb3lIV.js → withHasError-B8gHkfV2.js} +1 -1
  70. package/dist/cjs/{withStyled-Bf-stJTR.js → withStyled-BBtMesx3.js} +14 -63
  71. package/dist/cjs/{withTranslation-Cz0M5maV.js → withTranslation-CWPAIRjh.js} +3 -3
  72. package/dist/collection/collection-manifest.json +1 -10
  73. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +2 -3
  74. package/dist/collection/components/bn-chart-time/bn-chart-time.js +21 -30
  75. package/dist/collection/components/bn-message/bn-message.js +1 -1
  76. package/dist/collection/components/bn-page/bn-page.js +1 -1
  77. package/dist/collection/components/bn-table/bn-table.js +1 -1
  78. package/dist/collection/components/bn-template/bn-template.js +1 -1
  79. package/dist/collection/components/bn-text/bn-text.js +1 -1
  80. package/dist/collection/components/bn-title/bn-title.js +1 -9
  81. package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +1 -1
  82. package/dist/collection/components/editor-companion/editor-companion.js +1 -1
  83. package/dist/collection/utils/DateStringFactory.js +0 -1
  84. package/dist/components/DateStringFactory.js +1 -1
  85. package/dist/components/bn-chart-structure.js +1 -1
  86. package/dist/components/bn-chart-time.js +1 -1
  87. package/dist/components/bn-message2.js +1 -1
  88. package/dist/components/bn-page2.js +1 -1
  89. package/dist/components/bn-table.js +1 -1
  90. package/dist/components/bn-template.js +1 -1
  91. package/dist/components/bn-text.js +1 -1
  92. package/dist/components/bn-title2.js +1 -1
  93. package/dist/components/editor-companion.js +1 -1
  94. package/dist/components/ibcs-title2.js +1 -1
  95. package/dist/components/scaling.js +1 -1
  96. package/dist/components/validate.js +1 -1
  97. package/dist/components/withHasError.js +1 -1
  98. package/dist/esm/{DataFormatDigits-Dt6gpIiZ.js → DataFormatDigits-DYdbRX-1.js} +1 -1
  99. package/dist/esm/{DateStringFactory-_Qiv0IvF.js → DateStringFactory-DRcbojUT.js} +1 -2
  100. package/dist/esm/{luxon-DbyXf6dF.js → Order-DdexOqTs.js} +280 -1
  101. package/dist/esm/{SVGVariancesStyleGroup-DlWgvpzs.js → SVGVariancesStyleGroup-D0Cwprv1.js} +1 -1
  102. package/dist/esm/{StringAdapter-BLvo1Krl.js → StringAdapter-CTL-Dvzp.js} +1 -1
  103. package/dist/esm/bn-asset.entry.js +5 -6
  104. package/dist/esm/{bn-body_3.entry.js → bn-body_4.entry.js} +356 -24
  105. package/dist/esm/bn-card.entry.js +5 -6
  106. package/dist/esm/bn-chart-structure.entry.js +12 -17
  107. package/dist/esm/bn-chart-time.entry.js +31 -44
  108. package/dist/esm/bn-component-style.entry.js +5 -6
  109. package/dist/esm/bn-context_5.entry.js +15 -19
  110. package/dist/esm/bn-dataset.entry.js +5 -6
  111. package/dist/esm/bn-grid.entry.js +8 -11
  112. package/dist/esm/bn-image.entry.js +8 -11
  113. package/dist/esm/bn-internationalization.entry.js +5 -6
  114. package/dist/esm/bn-layout-card.entry.js +3 -3
  115. package/dist/esm/bn-layout-page.entry.js +2 -2
  116. package/dist/esm/bn-message.entry.js +6 -7
  117. package/dist/esm/bn-template-engine.js +3 -3
  118. package/dist/esm/bn-template.entry.js +4 -5
  119. package/dist/esm/bn-text.entry.js +11 -15
  120. package/dist/esm/bn-tree.entry.js +8 -11
  121. package/dist/esm/{context-protocol-DzeqZxg6.js → context-protocol-Bz5klD-F.js} +1 -1
  122. package/dist/esm/editor-companion.entry.js +3 -3
  123. package/dist/esm/ibcs-chart-structure.entry.js +5 -7
  124. package/dist/esm/ibcs-chart-time.entry.js +6 -8
  125. package/dist/esm/{index-B27Ax6P_.js → index-JNHhIe7t.js} +2 -2
  126. package/dist/esm/loader.js +3 -3
  127. package/dist/esm/{withDataset-BT2VQCsG.js → scaling-C6K8FYSF.js} +67 -4
  128. package/dist/esm/{withBodyObserver-gZpZiEIK.js → withBodyObserver-DczL5ia8.js} +2 -2
  129. package/dist/esm/{componentRegister-BtVfu16B.js → withComponentStatus-DodoSXe-.js} +36 -1
  130. package/dist/esm/{withComponentStyle-NaxfakAG.js → withComponentStyle-BerJY64r.js} +3 -3
  131. package/dist/esm/{withHasError-C48fTE2k.js → withHasError-B3QX2emi.js} +1 -1
  132. package/dist/esm/{withStyled-CpUTv74m.js → withStyled-DCipbf2O.js} +5 -51
  133. package/dist/esm/{withTranslation-Do4GhleK.js → withTranslation-mimbJdER.js} +3 -3
  134. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +1 -2
  135. package/dist/types/components/bn-title/bn-title.d.ts +0 -1
  136. package/dist/types/components.d.ts +0 -401
  137. package/package.json +2 -3
  138. package/readme.md +0 -1
  139. package/dist/bn-template-engine/assets/gpx/Chasing_Legends.gpx +0 -195076
  140. package/dist/bn-template-engine/assets/gpx/Fahrt_am_Nachmittag.gpx +0 -142007
  141. package/dist/bn-template-engine/assets/icons/gpx-finish.png +0 -0
  142. package/dist/bn-template-engine/assets/icons/gpx-shadow.png +0 -0
  143. package/dist/bn-template-engine/assets/icons/gpx-start.png +0 -0
  144. package/dist/bn-template-engine/assets/icons/marker-example.png +0 -0
  145. package/dist/bn-template-engine/assets/icons/pin-icon-end.png +0 -0
  146. package/dist/bn-template-engine/assets/icons/pin-icon-start.png +0 -0
  147. package/dist/bn-template-engine/assets/icons/pin-icon-wpt.png +0 -0
  148. package/dist/bn-template-engine/assets/icons/pin-shadow.png +0 -0
  149. package/dist/bn-template-engine/assets/icons/pin.png +0 -0
  150. package/dist/bn-template-engine/p-0e7dc113.entry.js +0 -1
  151. package/dist/bn-template-engine/p-264c6bad.entry.js +0 -1
  152. package/dist/bn-template-engine/p-326a0902.entry.js +0 -1
  153. package/dist/bn-template-engine/p-38a8bde3.entry.js +0 -1
  154. package/dist/bn-template-engine/p-577eafcd.entry.js +0 -1
  155. package/dist/bn-template-engine/p-5905cc43.entry.js +0 -1
  156. package/dist/bn-template-engine/p-5d155a72.entry.js +0 -1
  157. package/dist/bn-template-engine/p-6b8d1ebf.entry.js +0 -1
  158. package/dist/bn-template-engine/p-7995acb2.entry.js +0 -1
  159. package/dist/bn-template-engine/p-7afe431e.entry.js +0 -1
  160. package/dist/bn-template-engine/p-8014b1ac.entry.js +0 -1
  161. package/dist/bn-template-engine/p-80423fc8.entry.js +0 -1
  162. package/dist/bn-template-engine/p-91e74d42.entry.js +0 -1
  163. package/dist/bn-template-engine/p-930a9e29.entry.js +0 -1
  164. package/dist/bn-template-engine/p-93C9jL8R.js +0 -1
  165. package/dist/bn-template-engine/p-93ff8584.entry.js +0 -1
  166. package/dist/bn-template-engine/p-B0m0U4wJ.js +0 -1
  167. package/dist/bn-template-engine/p-B27Ax6P_.js +0 -2
  168. package/dist/bn-template-engine/p-B79VcHiT.js +0 -1
  169. package/dist/bn-template-engine/p-BBd0ZVLL.js +0 -1
  170. package/dist/bn-template-engine/p-BFatTBqh.js +0 -1
  171. package/dist/bn-template-engine/p-BQp6ZPYW.js +0 -1
  172. package/dist/bn-template-engine/p-BhEQy-2D.js +0 -1
  173. package/dist/bn-template-engine/p-BtVfu16B.js +0 -1
  174. package/dist/bn-template-engine/p-CfWnag33.js +0 -1
  175. package/dist/bn-template-engine/p-DbyXf6dF.js +0 -1
  176. package/dist/bn-template-engine/p-TdL-LRR9.js +0 -1
  177. package/dist/bn-template-engine/p-a342cd3c.entry.js +0 -1
  178. package/dist/bn-template-engine/p-bc37d750.entry.js +0 -1
  179. package/dist/bn-template-engine/p-c9f050bf.entry.js +0 -1
  180. package/dist/bn-template-engine/p-d07a0ca3.entry.js +0 -1
  181. package/dist/bn-template-engine/p-e5f372af.entry.js +0 -1
  182. package/dist/bn-template-engine/p-e620028c.entry.js +0 -1
  183. package/dist/bn-template-engine/p-e81e116a.entry.js +0 -1
  184. package/dist/bn-template-engine/p-eca98070.entry.js +0 -1
  185. package/dist/bn-template-engine/p-ee6de950.entry.js +0 -1
  186. package/dist/bn-template-engine/p-efe0ef1e.entry.js +0 -1
  187. package/dist/bn-template-engine/p-f034f1b8.entry.js +0 -1
  188. package/dist/bn-template-engine/p-f1c1a8a3.entry.js +0 -1
  189. package/dist/bn-template-engine/p-fe573a1a.entry.js +0 -1
  190. package/dist/bn-template-engine/p-kMyLevYy.js +0 -1
  191. package/dist/cjs/Order-B4NIqQWe.js +0 -129
  192. package/dist/cjs/bn-map.cjs.entry.js +0 -425
  193. package/dist/cjs/constants-DHqQXSSd.js +0 -158
  194. package/dist/cjs/ibcs-map.cjs.entry.js +0 -1075
  195. package/dist/cjs/ibcs-title.cjs.entry.js +0 -352
  196. package/dist/cjs/scaling-B23eOtsC.js +0 -67
  197. package/dist/cjs/test-runner-card.cjs.entry.js +0 -27
  198. package/dist/cjs/test-runner-chart-time.cjs.entry.js +0 -230
  199. package/dist/cjs/test-runner-chart.cjs.entry.js +0 -326
  200. package/dist/cjs/test-runner-map.cjs.entry.js +0 -1862
  201. package/dist/cjs/test-runner-table.cjs.entry.js +0 -477
  202. package/dist/cjs/test-runner-time.cjs.entry.js +0 -381
  203. package/dist/cjs/test-runner-title.cjs.entry.js +0 -115
  204. package/dist/cjs/withComponentStatus-BrxL7usr.js +0 -39
  205. package/dist/collection/components/bn-map/bn-map.css +0 -4
  206. package/dist/collection/components/bn-map/bn-map.js +0 -725
  207. package/dist/collection/components/bn-map/ibcs-map/assets/gpx/Chasing_Legends.gpx +0 -195076
  208. package/dist/collection/components/bn-map/ibcs-map/assets/gpx/Fahrt_am_Nachmittag.gpx +0 -142007
  209. package/dist/collection/components/bn-map/ibcs-map/assets/icons/gpx-finish.png +0 -0
  210. package/dist/collection/components/bn-map/ibcs-map/assets/icons/gpx-shadow.png +0 -0
  211. package/dist/collection/components/bn-map/ibcs-map/assets/icons/gpx-start.png +0 -0
  212. package/dist/collection/components/bn-map/ibcs-map/assets/icons/marker-example.png +0 -0
  213. package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-icon-end.png +0 -0
  214. package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-icon-start.png +0 -0
  215. package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-icon-wpt.png +0 -0
  216. package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-shadow.png +0 -0
  217. package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin.png +0 -0
  218. package/dist/collection/components/bn-map/ibcs-map/ibcs-map.css +0 -674
  219. package/dist/collection/components/bn-map/ibcs-map/ibcs-map.js +0 -744
  220. package/dist/collection/components/bn-map/ibcs-map/utils/model/GeoJsonLayer.js +0 -9
  221. package/dist/collection/components/bn-map/ibcs-map/utils/model/GpxLayer.js +0 -13
  222. package/dist/collection/components/bn-map/ibcs-map/utils/model/Marker.js +0 -11
  223. package/dist/collection/components/bn-map/ibcs-map/utils/model/index.js +0 -2
  224. package/dist/collection/test-runner/test-runner-card.js +0 -36
  225. package/dist/collection/test-runner/test-runner-chart-time.js +0 -234
  226. package/dist/collection/test-runner/test-runner-chart.js +0 -364
  227. package/dist/collection/test-runner/test-runner-map.js +0 -1901
  228. package/dist/collection/test-runner/test-runner-table.js +0 -469
  229. package/dist/collection/test-runner/test-runner-time.js +0 -399
  230. package/dist/collection/test-runner/test-runner-title.js +0 -108
  231. package/dist/components/bn-map.d.ts +0 -11
  232. package/dist/components/bn-map.js +0 -1
  233. package/dist/components/componentRegister.js +0 -1
  234. package/dist/components/ibcs-map.d.ts +0 -11
  235. package/dist/components/ibcs-map.js +0 -1
  236. package/dist/components/ibcs-map2.js +0 -1
  237. package/dist/components/test-runner-card.d.ts +0 -11
  238. package/dist/components/test-runner-card.js +0 -1
  239. package/dist/components/test-runner-chart-time.d.ts +0 -11
  240. package/dist/components/test-runner-chart-time.js +0 -1
  241. package/dist/components/test-runner-chart.d.ts +0 -11
  242. package/dist/components/test-runner-chart.js +0 -1
  243. package/dist/components/test-runner-map.d.ts +0 -11
  244. package/dist/components/test-runner-map.js +0 -1
  245. package/dist/components/test-runner-table.d.ts +0 -11
  246. package/dist/components/test-runner-table.js +0 -1
  247. package/dist/components/test-runner-time.d.ts +0 -11
  248. package/dist/components/test-runner-time.js +0 -1
  249. package/dist/components/test-runner-title.d.ts +0 -11
  250. package/dist/components/test-runner-title.js +0 -1
  251. package/dist/components/withDataset.js +0 -1
  252. package/dist/esm/Order-B4fpLe_f.js +0 -125
  253. package/dist/esm/bn-map.entry.js +0 -423
  254. package/dist/esm/constants-kMyLevYy.js +0 -158
  255. package/dist/esm/ibcs-map.entry.js +0 -1073
  256. package/dist/esm/ibcs-title.entry.js +0 -350
  257. package/dist/esm/scaling-BBd0ZVLL.js +0 -64
  258. package/dist/esm/test-runner-card.entry.js +0 -25
  259. package/dist/esm/test-runner-chart-time.entry.js +0 -228
  260. package/dist/esm/test-runner-chart.entry.js +0 -324
  261. package/dist/esm/test-runner-map.entry.js +0 -1860
  262. package/dist/esm/test-runner-table.entry.js +0 -475
  263. package/dist/esm/test-runner-time.entry.js +0 -379
  264. package/dist/esm/test-runner-title.entry.js +0 -113
  265. package/dist/esm/withComponentStatus-elELReKt.js +0 -37
  266. package/dist/types/components/bn-map/bn-map.d.ts +0 -122
  267. package/dist/types/components/bn-map/ibcs-map/ibcs-map.d.ts +0 -73
  268. package/dist/types/components/bn-map/ibcs-map/utils/model/GeoJsonLayer.d.ts +0 -8
  269. package/dist/types/components/bn-map/ibcs-map/utils/model/GpxLayer.d.ts +0 -11
  270. package/dist/types/components/bn-map/ibcs-map/utils/model/Marker.d.ts +0 -9
  271. package/dist/types/components/bn-map/ibcs-map/utils/model/index.d.ts +0 -2
  272. package/dist/types/test-runner/test-runner-card.d.ts +0 -3
  273. package/dist/types/test-runner/test-runner-chart-time.d.ts +0 -3
  274. package/dist/types/test-runner/test-runner-chart.d.ts +0 -3
  275. package/dist/types/test-runner/test-runner-map.d.ts +0 -3
  276. package/dist/types/test-runner/test-runner-table.d.ts +0 -3
  277. package/dist/types/test-runner/test-runner-time.d.ts +0 -3
  278. package/dist/types/test-runner/test-runner-title.d.ts +0 -3
@@ -1,1073 +0,0 @@
1
- import { r as registerInstance, d as createEvent, h, H as Host } from './index-B27Ax6P_.js';
2
- import { a as ComponentStatus } from './componentRegister-BtVfu16B.js';
3
-
4
- /**
5
- * Copyright (C) 2011-2012 Pavel Shramov
6
- * Copyright (C) 2013-2017 Maxime Petazzoni <maxime.petazzoni@bulix.org>
7
- * All Rights Reserved.
8
- *
9
- * Redistribution and use in source and binary forms, with or without
10
- * modification, are permitted provided that the following conditions are met:
11
- *
12
- * - Redistributions of source code must retain the above copyright notice,
13
- * this list of conditions and the following disclaimer.
14
- *
15
- * - Redistributions in binary form must reproduce the above copyright notice,
16
- * this list of conditions and the following disclaimer in the documentation
17
- * and/or other materials provided with the distribution.
18
- *
19
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
- * POSSIBILITY OF SUCH DAMAGE.
30
- */
31
-
32
-
33
- var _MAX_POINT_INTERVAL_MS = 15000;
34
- var _SECOND_IN_MILLIS = 1000;
35
- var _MINUTE_IN_MILLIS = 60 * _SECOND_IN_MILLIS;
36
- var _HOUR_IN_MILLIS = 60 * _MINUTE_IN_MILLIS;
37
- var _DAY_IN_MILLIS = 24 * _HOUR_IN_MILLIS;
38
-
39
- var _GPX_STYLE_NS = 'http://www.topografix.com/GPX/gpx_style/0/2';
40
- var _DEFAULT_ICON = new L.Icon.Default;
41
-
42
- var _DEFAULT_MARKERS = {
43
- startIcon: _DEFAULT_ICON,
44
- endIcon: _DEFAULT_ICON,
45
-
46
- // Based on 'sym' waypoint key
47
- wptIcons: {
48
- '': _DEFAULT_ICON,
49
- },
50
-
51
- // Based on 'type' waypoint key
52
- wptTypeIcons: {
53
- '': _DEFAULT_ICON
54
- },
55
-
56
- // Based on a regex over the waypoint's name
57
- pointMatchers: [],
58
- };
59
-
60
- var _DEFAULT_MARKER_OPTS = {
61
- iconSize: [33, 45],
62
- iconAnchor: [16, 45],
63
- clickable: false
64
- };
65
-
66
- var _DEFAULT_POLYLINE_OPTS = {
67
- color: 'blue'
68
- };
69
-
70
- var _DEFAULT_GPX_OPTS = {
71
- parseElements: ['track', 'route', 'waypoint'],
72
- joinTrackSegments: true
73
- };
74
-
75
- L.GPX = L.FeatureGroup.extend({
76
- initialize: function(gpx, options) {
77
- options.max_point_interval = options.max_point_interval || _MAX_POINT_INTERVAL_MS;
78
- options.markers = this._merge_objs(
79
- _DEFAULT_MARKERS,
80
- options.markers || {});
81
- options.marker_options = this._merge_objs(
82
- _DEFAULT_MARKER_OPTS,
83
- options.marker_options || {});
84
- options.polyline_options = options.polyline_options || [];
85
- options.gpx_options = this._merge_objs(
86
- _DEFAULT_GPX_OPTS,
87
- options.gpx_options || {});
88
-
89
- L.Util.setOptions(this, options);
90
-
91
- // Base icon class for track pins.
92
- L.GPXTrackIcon = L.Icon.extend({ options: options.marker_options });
93
-
94
- this._gpx = gpx;
95
- this._layers = {};
96
- this._prepare_markers(options.markers);
97
- this._init_info();
98
-
99
- if (gpx) {
100
- this._parse(gpx, options, this.options.async);
101
- }
102
- },
103
-
104
- get_duration_string: function(duration, hidems) {
105
- var s = '';
106
-
107
- if (duration >= _DAY_IN_MILLIS) {
108
- s += Math.floor(duration / _DAY_IN_MILLIS) + 'd ';
109
- duration = duration % _DAY_IN_MILLIS;
110
- }
111
-
112
- if (duration >= _HOUR_IN_MILLIS) {
113
- s += Math.floor(duration / _HOUR_IN_MILLIS) + ':';
114
- duration = duration % _HOUR_IN_MILLIS;
115
- }
116
-
117
- var mins = Math.floor(duration / _MINUTE_IN_MILLIS);
118
- duration = duration % _MINUTE_IN_MILLIS;
119
- if (mins < 10) s += '0';
120
- s += mins + '\'';
121
-
122
- var secs = Math.floor(duration / _SECOND_IN_MILLIS);
123
- duration = duration % _SECOND_IN_MILLIS;
124
- if (secs < 10) s += '0';
125
- s += secs;
126
-
127
- if (!hidems && duration > 0) s += '.' + Math.round(Math.floor(duration)*1000)/1000;
128
- else s += '"';
129
-
130
- return s;
131
- },
132
-
133
- get_duration_string_iso: function(duration, hidems) {
134
- var s = this.get_duration_string(duration, hidems);
135
- return s.replace("'",':').replace('"','');
136
- },
137
- _toFixed_helper: function(v, unit = 0) {
138
- if (typeof(v) == 'number'){
139
- return v.toFixed(unit);
140
- }
141
- return "?";
142
- },
143
- // Public methods
144
- to_miles: function(v) { return v / 1.60934; },
145
- to_ft: function(v) { return v * 3.28084; },
146
- m_to_km: function(v) { return v / 1000; },
147
- m_to_mi: function(v) { return v / 1609.34; },
148
- ms_to_kmh: function(v) { return v * 3.6; },
149
- ms_to_mih: function(v) { return v / 1609.34 * 3600; },
150
-
151
- get_name: function() { return this._info.name; },
152
- get_desc: function() { return this._info.desc; },
153
- get_author: function() { return this._info.author; },
154
- get_copyright: function() { return this._info.copyright; },
155
- get_distance: function() { return this._info.length; },
156
- get_distance_imp: function() { return this.to_miles(this.m_to_km(this.get_distance())); },
157
-
158
- get_start_time: function() { return this._info.duration.start; },
159
- get_end_time: function() { return this._info.duration.end; },
160
- get_moving_time: function() { return this._info.duration.moving; },
161
- get_total_time: function() { return this._info.duration.total; },
162
-
163
- get_moving_pace: function() { return this.get_moving_time() / this.m_to_km(this.get_distance()); },
164
- get_moving_pace_imp: function() { return this.get_moving_time() / this.get_distance_imp(); },
165
-
166
- get_moving_speed: function() { return this.m_to_km(this.get_distance()) / (this.get_moving_time() / (3600 * 1000)) ; },
167
- get_moving_speed_imp:function() { return this.to_miles(this.m_to_km(this.get_distance())) / (this.get_moving_time() / (3600 * 1000)) ; },
168
-
169
- get_total_speed: function() { return this.m_to_km(this.get_distance()) / (this.get_total_time() / (3600 * 1000)); },
170
- get_total_speed_imp: function() { return this.to_miles(this.m_to_km(this.get_distance())) / (this.get_total_time() / (3600 * 1000)); },
171
-
172
- get_elevation_gain: function() { return this._info.elevation.gain; },
173
- get_elevation_loss: function() { return this._info.elevation.loss; },
174
- get_elevation_gain_imp: function() { return this.to_ft(this.get_elevation_gain()); },
175
- get_elevation_loss_imp: function() { return this.to_ft(this.get_elevation_loss()); },
176
- get_elevation_data: function() {
177
- var _this = this;
178
- return this._info.elevation._points.map(
179
- function(p) { return _this._prepare_data_point(p, _this.m_to_km, null,
180
- function(a, b) { return _this._toFixed_helper(a, 2) + ' km, ' + _this._toFixed_helper(b, 0) + ' m'; });
181
- });
182
- },
183
- get_elevation_data_imp: function() {
184
- var _this = this;
185
- return this._info.elevation._points.map(
186
- function(p) { return _this._prepare_data_point(p, _this.m_to_mi, _this.to_ft,
187
- function(a, b) { return _this._toFixed_helper(a, 2) + ' mi, ' + _this._toFixed_helper(b, 0) + ' ft'; });
188
- });
189
- },
190
- get_elevation_max: function() { return this._info.elevation.max; },
191
- get_elevation_min: function() { return this._info.elevation.min; },
192
- get_elevation_max_imp: function() { return this.to_ft(this.get_elevation_max()); },
193
- get_elevation_min_imp: function() { return this.to_ft(this.get_elevation_min()); },
194
-
195
- get_speed_data: function() {
196
- var _this = this;
197
- return this._info.speed._points.map(
198
- function(p) { return _this._prepare_data_point(p, _this.m_to_km, _this.ms_to_kmh,
199
- function(a, b) { return _this._toFixed_helper(a, 2) + ' km, ' + _this._toFixed_helper(b, 2) + ' km/h'; });
200
- });
201
- },
202
- get_speed_data_imp: function() {
203
- var _this = this;
204
- return this._info.speed._points.map(
205
- function(p) { return _this._prepare_data_point(p, _this.m_to_mi, _this.ms_to_mih,
206
- function(a, b) { return _this._toFixed_helper(a, 2) + ' mi, ' + _this._toFixed_helper(b, 2) + ' mi/h'; });
207
- });
208
- },
209
- get_speed_max: function() { return this.m_to_km(this._info.speed.max) * 3600; },
210
- get_speed_max_imp: function() { return this.to_miles(this.get_speed_max()); },
211
-
212
- get_average_hr: function() { return this._info.hr.avg; },
213
- get_average_temp: function() { return this._info.atemp.avg; },
214
- get_average_cadence: function() { return this._info.cad.avg; },
215
- get_heartrate_data: function() {
216
- var _this = this;
217
- return this._info.hr._points.map(
218
- function(p) { return _this._prepare_data_point(p, _this.m_to_km, null,
219
- function(a, b) { return _this._toFixed_helper(a, 2) + ' km, ' + _this._toFixed_helper(b, 0) + ' bpm'; });
220
- });
221
- },
222
- get_heartrate_data_imp: function() {
223
- var _this = this;
224
- return this._info.hr._points.map(
225
- function(p) { return _this._prepare_data_point(p, _this.m_to_mi, null,
226
- function(a, b) { return _this._toFixed_helper(a, 2) + ' mi, ' + _this._toFixed_helper(b, 0) + ' bpm'; });
227
- });
228
- },
229
- get_cadence_data: function() {
230
- var _this = this;
231
- return this._info.cad._points.map(
232
- function(p) { return _this._prepare_data_point(p, _this.m_to_km, null,
233
- function(a, b) { return _this._toFixed_helper(a, 2) + ' km, ' + _this._toFixed_helper(b, 0) + ' rpm'; });
234
- });
235
- },
236
- get_temp_data: function() {
237
- var _this = this;
238
- return this._info.atemp._points.map(
239
- function(p) { return _this._prepare_data_point(p, _this.m_to_km, null,
240
- function(a, b) { return _this._toFixed_helper(a, 2) + ' km, ' + _this._toFixed_helper(b, 0) + ' degrees'; });
241
- });
242
- },
243
- get_cadence_data_imp: function() {
244
- var _this = this;
245
- return this._info.cad._points.map(
246
- function(p) { return _this._prepare_data_point(p, _this.m_to_mi, null,
247
- function(a, b) { return _this._toFixed_helper(a, 2) + ' mi, ' + _this._toFixed_helper(b, 0) + ' rpm'; });
248
- });
249
- },
250
- get_temp_data_imp: function() {
251
- var _this = this;
252
- return this._info.atemp._points.map(
253
- function(p) { return _this._prepare_data_point(p, _this.m_to_mi, null,
254
- function(a, b) { return _this._toFixed_helper(a, 2) + ' mi, ' + _this._toFixed_helper(b, 0) + ' degrees'; });
255
- });
256
- },
257
-
258
- reload: function() {
259
- this._init_info();
260
- this.clearLayers();
261
- this._parse(this._gpx, this.options, this.options.async);
262
- },
263
-
264
- // Private methods
265
- _merge_objs: function(a, b) {
266
- var _ = {};
267
- for (var attr in a) { _[attr] = a[attr]; }
268
- for (var attr in b) { _[attr] = b[attr]; }
269
- return _;
270
- },
271
-
272
- _prepare_data_point: function(p, trans1, trans2, trans_tooltip) {
273
- var r = [trans1 && trans1(p[0]) || p[0], trans2 && trans2(p[1]) || p[1]];
274
- r.push(trans_tooltip && trans_tooltip(r[0], r[1]) || (r[0] + ': ' + r[1]));
275
- return r;
276
- },
277
-
278
- _prepare_markers: function(markers) {
279
- function iconize(url) {
280
- return new L.GPXTrackIcon({iconUrl: url});
281
- }
282
-
283
- Object.entries(markers).forEach(([key, value]) => {
284
- if (key === 'wptIcons' || key === 'wptTypeIcons') {
285
- markers[key] = this._prepare_markers(value);
286
- } else if (key === 'pointMatchers') {
287
- markers[key] = value.map(e => {
288
- if (typeof(e.icon) === 'string') {
289
- e.icon = iconize(e.icon);
290
- }
291
- return e;
292
- });
293
- } else if (typeof(value) === 'string') {
294
- markers[key] = iconize(value);
295
- } else if (typeof(value) === 'object' && value !== null) {
296
- markers[key] = value;
297
- }
298
- });
299
-
300
- return markers;
301
- },
302
-
303
- _init_info: function() {
304
- this._info = {
305
- name: null,
306
- length: 0.0,
307
- elevation: {gain: 0.0, loss: 0.0, max: 0.0, min: Infinity, _points: []},
308
- speed : {max: 0.0, _points: []},
309
- hr: {avg: 0, _total: 0, _points: []},
310
- duration: {start: null, end: null, moving: 0, total: 0},
311
- atemp: {avg: 0, _total: 0, _points: []},
312
- cad: {avg: 0, _total: 0, _points: []}
313
- };
314
- },
315
-
316
- _load_xml: function(url, cb, options, async) {
317
- if (async == undefined) async = this.options.async;
318
- if (options == undefined) options = this.options;
319
-
320
- var _this = this;
321
- var req = new window.XMLHttpRequest();
322
- req.open('GET', url, async);
323
- try {
324
- req.overrideMimeType('text/xml'); // unsupported by IE
325
- } catch(e) {}
326
- req.onloadend = function() {
327
- if (req.status == 200) {
328
- cb(req.responseXML, options);
329
- } else {
330
- _this.fire('error', { err: 'Error fetching resource: ' + url });
331
- }
332
- };
333
- req.send(null);
334
- },
335
-
336
- _parse: function(input, options, async) {
337
- var _this = this;
338
- var cb = function(gpx, options) {
339
- var layers = _this._parse_gpx_data(gpx, options);
340
- if (!layers) {
341
- _this.fire('error', { err: 'No parseable layers of type(s) ' + JSON.stringify(options.gpx_options.parseElements) });
342
- return;
343
- }
344
- _this.addLayer(layers);
345
- _this.fire('loaded', { layers: layers, element: gpx });
346
- };
347
- if (input.substr(0,1)==='<') { // direct XML has to start with a <
348
- var parser = new DOMParser();
349
- if (async) {
350
- setTimeout(function() {
351
- cb(parser.parseFromString(input, "text/xml"), options);
352
- });
353
- } else {
354
- cb(parser.parseFromString(input, "text/xml"), options);
355
- }
356
- } else {
357
- this._load_xml(input, cb, options, async);
358
- }
359
- },
360
-
361
- _parse_gpx_data: function(xml, options) {
362
- var i, el, layers = [];
363
-
364
- var name = xml.getElementsByTagName('name');
365
- if (name.length > 0) {
366
- this._info.name = name[0].textContent;
367
- }
368
- var desc = xml.getElementsByTagName('desc');
369
- if (desc.length > 0) {
370
- this._info.desc = desc[0].textContent;
371
- }
372
- var author = xml.getElementsByTagName('author');
373
- if (author.length > 0) {
374
- this._info.author = author[0].textContent;
375
- }
376
- var copyright = xml.getElementsByTagName('copyright');
377
- if (copyright.length > 0) {
378
- this._info.copyright = copyright[0].textContent;
379
- }
380
-
381
- var parseElements = options.gpx_options.parseElements;
382
- if (parseElements.indexOf('route') > -1) {
383
- // routes are <rtept> tags inside <rte> sections
384
- var routes = xml.getElementsByTagName('rte');
385
- for (i = 0; i < routes.length; i++) {
386
- var route = routes[i];
387
- var base_style = this._extract_styling(route);
388
- var polyline_options = this._get_polyline_options(options.polyline_options, i);
389
- layers = layers.concat(this._parse_segment(routes[i], options, base_style, polyline_options, 'rtept'));
390
- }
391
- }
392
-
393
- if (parseElements.indexOf('track') > -1) {
394
- // tracks are <trkpt> tags in one or more <trkseg> sections in each <trk>
395
- var tracks = xml.getElementsByTagName('trk');
396
- for (i = 0; i < tracks.length; i++) {
397
- var track = tracks[i];
398
- var base_style = this._extract_styling(track);
399
- var polyline_options = this._get_polyline_options(options.polyline_options, i);
400
-
401
- if (options.gpx_options.joinTrackSegments) {
402
- layers = layers.concat(this._parse_segment(track, options, base_style, polyline_options, 'trkpt'));
403
- } else {
404
- var segments = track.getElementsByTagName('trkseg');
405
- for (j = 0; j < segments.length; j++) {
406
- layers = layers.concat(this._parse_segment(segments[j], options, base_style, polyline_options, 'trkpt'));
407
- }
408
- }
409
- }
410
- }
411
-
412
- this._info.hr.avg = Math.round(this._info.hr._total / this._info.hr._points.length);
413
- this._info.cad.avg = Math.round(this._info.cad._total / this._info.cad._points.length);
414
- this._info.atemp.avg = Math.round(this._info.atemp._total / this._info.atemp._points.length);
415
-
416
- // parse waypoints and add markers for each of them
417
- if (parseElements.indexOf('waypoint') > -1) {
418
- el = xml.getElementsByTagName('wpt');
419
- for (i = 0; i < el.length; i++) {
420
- var ll = new L.LatLng(
421
- el[i].getAttribute('lat'),
422
- el[i].getAttribute('lon'));
423
-
424
- var nameEl = el[i].getElementsByTagName('name');
425
- var name = nameEl.length > 0 ? nameEl[0].textContent : '';
426
-
427
- var descEl = el[i].getElementsByTagName('desc');
428
- var desc = descEl.length > 0 ? descEl[0].textContent : '';
429
-
430
- var symEl = el[i].getElementsByTagName('sym');
431
- var symKey = symEl.length > 0 ? symEl[0].textContent : null;
432
-
433
- var typeEl = el[i].getElementsByTagName('type');
434
- var typeKey = typeEl.length > 0 ? typeEl[0].textContent : null;
435
-
436
- /*
437
- * Add waypoint marker based on the waypoint symbol key.
438
- *
439
- * First look for a configured icon for that symKey. If not found, look
440
- * for a configured icon URL for that symKey and build an icon from it.
441
- * If none of those match, look through the point matchers for a match
442
- * on the waypoint's name.
443
- *
444
- * Otherwise, fall back to the default icon if one was configured, or
445
- * finally to the default icon URL, if one was configured.
446
- */
447
- var wptIcons = options.markers.wptIcons;
448
- var wptTypeIcons = options.markers.wptTypeIcons;
449
- var ptMatchers = options.markers.pointMatchers || [];
450
- var symIcon;
451
- if (wptIcons && symKey && wptIcons[symKey]) {
452
- symIcon = wptIcons[symKey];
453
- } else if (wptTypeIcons && typeKey && wptTypeIcons[typeKey]) {
454
- symIcon = wptTypeIcons[typeKey];
455
- } else if (ptMatchers.length > 0) {
456
- for (var j = 0; j < ptMatchers.length; j++) {
457
- if (ptMatchers[j].regex.test(name)) {
458
- symIcon = ptMatchers[j].icon;
459
- break;
460
- }
461
- }
462
- } else if (wptIcons && wptIcons['']) {
463
- symIcon = wptIcons[''];
464
- }
465
-
466
- if (!symIcon) {
467
- console.log(
468
- 'No waypoint icon could be matched for symKey=%s,typeKey=%s,name=%s on waypoint %o',
469
- symKey, typeKey, name, el[i]);
470
- continue;
471
- }
472
-
473
- var marker = new L.Marker(ll, {
474
- clickable: options.marker_options.clickable,
475
- title: name,
476
- icon: symIcon,
477
- type: 'waypoint'
478
- });
479
- marker.bindPopup("<b>" + name + "</b>" + (desc.length > 0 ? '<br>' + desc : '')).openPopup();
480
- this.fire('addpoint', { point: marker, point_type: 'waypoint', element: el[i] });
481
- layers.push(marker);
482
- }
483
- }
484
-
485
- if (layers.length > 1) {
486
- return new L.FeatureGroup(layers);
487
- } else if (layers.length == 1) {
488
- return layers[0];
489
- }
490
- },
491
-
492
- _parse_segment: function(line, options, base_style, polyline_options, tag) {
493
- var el = line.getElementsByTagName(tag);
494
- if (!el.length) return [];
495
-
496
- var coords = [];
497
- var markers = [];
498
- var layers = [];
499
- var last = null;
500
-
501
- for (var i = 0; i < el.length; i++) {
502
- var _, ll = new L.LatLng(
503
- el[i].getAttribute('lat'),
504
- el[i].getAttribute('lon'));
505
- ll.meta = { time: null, ele: null, hr: null, cad: null, atemp: null, speed: null };
506
-
507
- _ = el[i].getElementsByTagName('time');
508
- if (_.length > 0) {
509
- ll.meta.time = new Date(Date.parse(_[0].textContent));
510
- } else {
511
- ll.meta.time = new Date('1970-01-01T00:00:00');
512
- }
513
- var time_diff = last != null ? Math.abs(ll.meta.time - last.meta.time) : 0;
514
-
515
- _ = el[i].getElementsByTagName('ele');
516
- if (_.length > 0) {
517
- ll.meta.ele = parseFloat(_[0].textContent);
518
- } else {
519
- // If the point doesn't have an <ele> tag, assume it has the same
520
- // elevation as the point before it (if it had one).
521
- ll.meta.ele = last != null ? last.meta.ele : null;
522
- }
523
- var ele_diff = last != null ? ll.meta.ele - last.meta.ele : 0;
524
- var dist_3d = last != null ? this._dist3d(last, ll) : 0;
525
-
526
- _ = el[i].getElementsByTagName('speed');
527
- if (_.length > 0) {
528
- ll.meta.speed = parseFloat(_[0].textContent);
529
- } else {
530
- // speed in meter per second
531
- ll.meta.speed = time_diff > 0 ? 1000.0 * dist_3d / time_diff : 0;
532
- }
533
-
534
- _ = el[i].getElementsByTagName('name');
535
- if (_.length > 0) {
536
- var name = _[0].textContent;
537
- var ptMatchers = options.markers.pointMatchers || [];
538
-
539
- for (var j = 0; j < ptMatchers.length; j++) {
540
- if (ptMatchers[j].regex.test(name)) {
541
- markers.push({ label: name, coords: ll, icon: ptMatchers[j].icon, element: el[i] });
542
- break;
543
- }
544
- }
545
- }
546
-
547
- this._info.length += dist_3d;
548
-
549
- _ = el[i].getElementsByTagNameNS('*', 'hr');
550
- if (_.length > 0) {
551
- ll.meta.hr = parseInt(_[0].textContent);
552
- this._info.hr._points.push([this._info.length, ll.meta.hr]);
553
- this._info.hr._total += ll.meta.hr;
554
- }
555
-
556
- _ = el[i].getElementsByTagNameNS('*', 'cad');
557
- if (_.length > 0) {
558
- ll.meta.cad = parseInt(_[0].textContent);
559
- this._info.cad._points.push([this._info.length, ll.meta.cad]);
560
- this._info.cad._total += ll.meta.cad;
561
- }
562
-
563
- _ = el[i].getElementsByTagNameNS('*', 'atemp');
564
- if (_.length > 0) {
565
- ll.meta.atemp = parseInt(_[0].textContent);
566
- this._info.atemp._points.push([this._info.length, ll.meta.atemp]);
567
- this._info.atemp._total += ll.meta.atemp;
568
- }
569
-
570
- if (ll.meta.ele > this._info.elevation.max) {
571
- this._info.elevation.max = ll.meta.ele;
572
- }
573
- if (ll.meta.ele < this._info.elevation.min) {
574
- this._info.elevation.min = ll.meta.ele;
575
- }
576
- this._info.elevation._points.push([this._info.length, ll.meta.ele]);
577
-
578
- if (ll.meta.speed > this._info.speed.max) {
579
- this._info.speed.max = ll.meta.speed;
580
- }
581
- this._info.speed._points.push([this._info.length, ll.meta.speed]);
582
-
583
- if ((last == null) && (this._info.duration.start == null)) {
584
- this._info.duration.start = ll.meta.time;
585
- }
586
- this._info.duration.end = ll.meta.time;
587
- this._info.duration.total += time_diff;
588
- if (time_diff < options.max_point_interval) {
589
- this._info.duration.moving += time_diff;
590
- }
591
-
592
- if (ele_diff > 0) {
593
- this._info.elevation.gain += ele_diff;
594
- } else {
595
- this._info.elevation.loss += Math.abs(ele_diff);
596
- }
597
-
598
- last = ll;
599
- coords.push(ll);
600
- }
601
-
602
- // add track
603
- var l = new L.Polyline(coords, this._extract_styling(line, base_style, polyline_options));
604
- this.fire('addline', { line: l, element: line });
605
- layers.push(l);
606
-
607
- if (options.markers.startIcon) {
608
- // add start pin
609
- var marker = new L.Marker(coords[0], {
610
- clickable: options.marker_options.clickable,
611
- icon: options.markers.startIcon,
612
- });
613
- this.fire('addpoint', { point: marker, point_type: 'start', element: el[0], line: line });
614
- layers.push(marker);
615
- }
616
-
617
- if (options.markers.endIcon) {
618
- // add end pin
619
- var marker = new L.Marker(coords[coords.length-1], {
620
- clickable: options.marker_options.clickable,
621
- icon: options.markers.endIcon,
622
- });
623
- this.fire('addpoint', { point: marker, point_type: 'end', element: el[el.length-1], line: line });
624
- layers.push(marker);
625
- }
626
-
627
- // add named markers
628
- for (var i = 0; i < markers.length; i++) {
629
- var marker = new L.Marker(markers[i].coords, {
630
- clickable: options.marker_options.clickable,
631
- title: markers[i].label,
632
- icon: markers[i].icon
633
- });
634
- this.fire('addpoint', { point: marker, point_type: 'label', element: markers[i].element });
635
- layers.push(marker);
636
- }
637
-
638
- return layers;
639
- },
640
-
641
- _get_polyline_options: function(polyline_options, i) {
642
- /*
643
- * Handle backwards compatibility with polyline_options being provided as a single object.
644
- * In this situation, the provided style is expected to apply to all routes and tracks in the file.
645
- */
646
- if (! Array.isArray(polyline_options)) {
647
- return polyline_options;
648
- }
649
- return polyline_options[i] || {};
650
- },
651
-
652
- _extract_styling: function(el, base, overrides) {
653
- var style = this._merge_objs(_DEFAULT_POLYLINE_OPTS, base);
654
- var e = el.getElementsByTagNameNS(_GPX_STYLE_NS, 'line');
655
- if (e.length > 0) {
656
- var _ = e[0].getElementsByTagName('color');
657
- if (_.length > 0) style.color = '#' + _[0].textContent;
658
- var _ = e[0].getElementsByTagName('opacity');
659
- if (_.length > 0) style.opacity = _[0].textContent;
660
- var _ = e[0].getElementsByTagName('weight');
661
- if (_.length > 0) style.weight = _[0].textContent;
662
- var _ = e[0].getElementsByTagName('linecap');
663
- if (_.length > 0) style.lineCap = _[0].textContent;
664
- var _ = e[0].getElementsByTagName('linejoin');
665
- if (_.length > 0) style.lineJoin = _[0].textContent;
666
- var _ = e[0].getElementsByTagName('dasharray');
667
- if (_.length > 0) style.dashArray = _[0].textContent;
668
- var _ = e[0].getElementsByTagName('dashoffset');
669
- if (_.length > 0) style.dashOffset = _[0].textContent;
670
- }
671
- return this._merge_objs(style, overrides)
672
- },
673
-
674
- _dist2d: function(a, b) {
675
- var R = 6371000;
676
- var dLat = this._deg2rad(b.lat - a.lat);
677
- var dLon = this._deg2rad(b.lng - a.lng);
678
- var r = Math.sin(dLat/2) *
679
- Math.sin(dLat/2) +
680
- Math.cos(this._deg2rad(a.lat)) *
681
- Math.cos(this._deg2rad(b.lat)) *
682
- Math.sin(dLon/2) *
683
- Math.sin(dLon/2);
684
- var c = 2 * Math.atan2(Math.sqrt(r), Math.sqrt(1-r));
685
- var d = R * c;
686
- return d;
687
- },
688
-
689
- _dist3d: function(a, b) {
690
- var planar = this._dist2d(a, b);
691
- var height = Math.abs(b.meta.ele - a.meta.ele);
692
- return Math.sqrt(Math.pow(planar, 2) + Math.pow(height, 2));
693
- },
694
-
695
- _deg2rad: function(deg) {
696
- return deg * Math.PI / 180;
697
- }
698
- });
699
-
700
- const ibcsMapCss = () => `.leaflet-pane,.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-tile-container,.leaflet-pane>svg,.leaflet-pane>canvas,.leaflet-zoom-box,.leaflet-image-layer,.leaflet-layer{position:absolute;left:0;top:0}.leaflet-container{overflow:hidden}.leaflet-tile,.leaflet-marker-icon,.leaflet-marker-shadow{-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none}.leaflet-tile::selection{background:transparent}.leaflet-safari .leaflet-tile{image-rendering:-webkit-optimize-contrast}.leaflet-safari .leaflet-tile-container{width:1600px;height:1600px;-webkit-transform-origin:0 0}.leaflet-marker-icon,.leaflet-marker-shadow{display:block}.leaflet-container .leaflet-overlay-pane svg{max-width:none !important;max-height:none !important}.leaflet-container .leaflet-marker-pane img,.leaflet-container .leaflet-shadow-pane img,.leaflet-container .leaflet-tile-pane img,.leaflet-container img.leaflet-image-layer,.leaflet-container .leaflet-tile{max-width:none !important;max-height:none !important;width:auto;padding:0}.leaflet-container img.leaflet-tile{mix-blend-mode:plus-lighter}.leaflet-container.leaflet-touch-zoom{-ms-touch-action:pan-x pan-y;touch-action:pan-x pan-y}.leaflet-container.leaflet-touch-drag{-ms-touch-action:pinch-zoom;touch-action:none;touch-action:pinch-zoom}.leaflet-container.leaflet-touch-drag.leaflet-touch-zoom{-ms-touch-action:none;touch-action:none}.leaflet-container{-webkit-tap-highlight-color:transparent}.leaflet-container a{-webkit-tap-highlight-color:rgba(51, 181, 229, 0.4)}.leaflet-tile{filter:inherit;visibility:hidden}.leaflet-tile-loaded{visibility:inherit}.leaflet-zoom-box{width:0;height:0;-moz-box-sizing:border-box;box-sizing:border-box;z-index:800}.leaflet-overlay-pane svg{-moz-user-select:none}.leaflet-pane{z-index:400}.leaflet-tile-pane{z-index:200}.leaflet-overlay-pane{z-index:400}.leaflet-shadow-pane{z-index:500}.leaflet-marker-pane{z-index:600}.leaflet-tooltip-pane{z-index:650}.leaflet-popup-pane{z-index:700}.leaflet-map-pane canvas{z-index:100}.leaflet-map-pane svg{z-index:200}.leaflet-vml-shape{width:1px;height:1px}.lvml{behavior:url(#default#VML);display:inline-block;position:absolute}.leaflet-control{position:relative;z-index:800;pointer-events:visiblePainted;pointer-events:auto}.leaflet-top,.leaflet-bottom{position:absolute;z-index:1000;pointer-events:none}.leaflet-top{top:0}.leaflet-right{right:0}.leaflet-bottom{bottom:0}.leaflet-left{left:0}.leaflet-control{float:left;clear:both}.leaflet-right .leaflet-control{float:right}.leaflet-top .leaflet-control{margin-top:10px}.leaflet-bottom .leaflet-control{margin-bottom:10px}.leaflet-left .leaflet-control{margin-left:10px}.leaflet-right .leaflet-control{margin-right:10px}.leaflet-fade-anim .leaflet-popup{opacity:0;-webkit-transition:opacity 0.2s linear;-moz-transition:opacity 0.2s linear;transition:opacity 0.2s linear}.leaflet-fade-anim .leaflet-map-pane .leaflet-popup{opacity:1}.leaflet-zoom-animated{-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0}svg.leaflet-zoom-animated{will-change:transform}.leaflet-zoom-anim .leaflet-zoom-animated{-webkit-transition:-webkit-transform 0.25s cubic-bezier(0,0,0.25,1);-moz-transition:-moz-transform 0.25s cubic-bezier(0,0,0.25,1);transition:transform 0.25s cubic-bezier(0,0,0.25,1)}.leaflet-zoom-anim .leaflet-tile,.leaflet-pan-anim .leaflet-tile{-webkit-transition:none;-moz-transition:none;transition:none}.leaflet-zoom-anim .leaflet-zoom-hide{visibility:hidden}.leaflet-interactive{cursor:pointer}.leaflet-grab{cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.leaflet-crosshair,.leaflet-crosshair .leaflet-interactive{cursor:crosshair}.leaflet-popup-pane,.leaflet-control{cursor:auto}.leaflet-dragging .leaflet-grab,.leaflet-dragging .leaflet-grab .leaflet-interactive,.leaflet-dragging .leaflet-marker-draggable{cursor:move;cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.leaflet-marker-icon,.leaflet-marker-shadow,.leaflet-image-layer,.leaflet-pane>svg path,.leaflet-tile-container{pointer-events:none}.leaflet-marker-icon.leaflet-interactive,.leaflet-image-layer.leaflet-interactive,.leaflet-pane>svg path.leaflet-interactive,svg.leaflet-image-layer.leaflet-interactive path{pointer-events:visiblePainted;pointer-events:auto}.leaflet-container{background:#ddd;outline-offset:1px}.leaflet-container a{color:#0078A8}.leaflet-zoom-box{border:2px dotted #38f;background:rgba(255,255,255,0.5)}.leaflet-container{font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;font-size:12px;font-size:0.75rem;line-height:1.5}.leaflet-bar{box-shadow:0 1px 5px rgba(0,0,0,0.65);border-radius:4px}.leaflet-bar a{background-color:#fff;border-bottom:1px solid #ccc;width:26px;height:26px;line-height:26px;display:block;text-align:center;text-decoration:none;color:black}.leaflet-bar a,.leaflet-control-layers-toggle{background-position:50% 50%;background-repeat:no-repeat;display:block}.leaflet-bar a:hover,.leaflet-bar a:focus{background-color:#f4f4f4}.leaflet-bar a:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.leaflet-bar a:last-child{border-bottom-left-radius:4px;border-bottom-right-radius:4px;border-bottom:none}.leaflet-bar a.leaflet-disabled{cursor:default;background-color:#f4f4f4;color:#bbb}.leaflet-touch .leaflet-bar a{width:30px;height:30px;line-height:30px}.leaflet-touch .leaflet-bar a:first-child{border-top-left-radius:2px;border-top-right-radius:2px}.leaflet-touch .leaflet-bar a:last-child{border-bottom-left-radius:2px;border-bottom-right-radius:2px}.leaflet-control-zoom-in,.leaflet-control-zoom-out{font:bold 18px 'Lucida Console', Monaco, monospace;text-indent:1px}.leaflet-touch .leaflet-control-zoom-in,.leaflet-touch .leaflet-control-zoom-out{font-size:22px}.leaflet-control-layers{box-shadow:0 1px 5px rgba(0,0,0,0.4);background:#fff;border-radius:5px}.leaflet-control-layers-toggle{background-image:url(images/layers.png);width:36px;height:36px}.leaflet-retina .leaflet-control-layers-toggle{background-image:url(images/layers-2x.png);background-size:26px 26px}.leaflet-touch .leaflet-control-layers-toggle{width:44px;height:44px}.leaflet-control-layers .leaflet-control-layers-list,.leaflet-control-layers-expanded .leaflet-control-layers-toggle{display:none}.leaflet-control-layers-expanded .leaflet-control-layers-list{display:block;position:relative}.leaflet-control-layers-expanded{padding:6px 10px 6px 6px;color:#333;background:#fff}.leaflet-control-layers-scrollbar{overflow-y:scroll;overflow-x:hidden;padding-right:5px}.leaflet-control-layers-selector{margin-top:2px;position:relative;top:1px}.leaflet-control-layers label{display:block;font-size:13px;font-size:1.08333em}.leaflet-control-layers-separator{height:0;border-top:1px solid #ddd;margin:5px -10px 5px -6px}.leaflet-default-icon-path{background-image:url(images/marker-icon.png)}.leaflet-container .leaflet-control-attribution{background:#fff;background:rgba(255, 255, 255, 0.8);margin:0}.leaflet-control-attribution,.leaflet-control-scale-line{padding:0 5px;color:#333;line-height:1.4}.leaflet-control-attribution a{text-decoration:none}.leaflet-control-attribution a:hover,.leaflet-control-attribution a:focus{text-decoration:underline}.leaflet-attribution-flag{display:inline !important;vertical-align:baseline !important;width:1em;height:0.6669em}.leaflet-left .leaflet-control-scale{margin-left:5px}.leaflet-bottom .leaflet-control-scale{margin-bottom:5px}.leaflet-control-scale-line{border:2px solid #777;border-top:none;line-height:1.1;padding:2px 5px 1px;white-space:nowrap;-moz-box-sizing:border-box;box-sizing:border-box;background:rgba(255, 255, 255, 0.8);text-shadow:1px 1px #fff}.leaflet-control-scale-line:not(:first-child){border-top:2px solid #777;border-bottom:none;margin-top:-2px}.leaflet-control-scale-line:not(:first-child):not(:last-child){border-bottom:2px solid #777}.leaflet-touch .leaflet-control-attribution,.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{box-shadow:none}.leaflet-touch .leaflet-control-layers,.leaflet-touch .leaflet-bar{border:2px solid rgba(0,0,0,0.2);background-clip:padding-box}.leaflet-popup{position:absolute;text-align:center;margin-bottom:20px}.leaflet-popup-content-wrapper{padding:1px;text-align:left;border-radius:12px}.leaflet-popup-content{margin:13px 24px 13px 20px;line-height:1.3;font-size:13px;font-size:1.08333em;min-height:1px}.leaflet-popup-content p{margin:17px 0;margin:1.3em 0}.leaflet-popup-tip-container{width:40px;height:20px;position:absolute;left:50%;margin-top:-1px;margin-left:-20px;overflow:hidden;pointer-events:none}.leaflet-popup-tip{width:17px;height:17px;padding:1px;margin:-10px auto 0;pointer-events:auto;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:white;color:#333;box-shadow:0 3px 14px rgba(0,0,0,0.4)}.leaflet-container a.leaflet-popup-close-button{position:absolute;top:0;right:0;border:none;text-align:center;width:24px;height:24px;font:16px/24px Tahoma, Verdana, sans-serif;color:#757575;text-decoration:none;background:transparent}.leaflet-container a.leaflet-popup-close-button:hover,.leaflet-container a.leaflet-popup-close-button:focus{color:#585858}.leaflet-popup-scrolled{overflow:auto}.leaflet-oldie .leaflet-popup-content-wrapper{-ms-zoom:1}.leaflet-oldie .leaflet-popup-tip{width:24px;margin:0 auto;-ms-filter:"progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)";filter:progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)}.leaflet-oldie .leaflet-control-zoom,.leaflet-oldie .leaflet-control-layers,.leaflet-oldie .leaflet-popup-content-wrapper,.leaflet-oldie .leaflet-popup-tip{border:1px solid #999}.leaflet-div-icon{background:#fff;border:1px solid #666}.leaflet-tooltip{position:absolute;padding:6px;background-color:#fff;border:1px solid #fff;border-radius:3px;color:#222;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;box-shadow:0 1px 3px rgba(0,0,0,0.4)}.leaflet-tooltip.leaflet-interactive{cursor:pointer;pointer-events:auto}.leaflet-tooltip-top:before,.leaflet-tooltip-bottom:before,.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{position:absolute;pointer-events:none;border:6px solid transparent;background:transparent;content:""}.leaflet-tooltip-bottom{margin-top:6px}.leaflet-tooltip-top{margin-top:-6px}.leaflet-tooltip-bottom:before,.leaflet-tooltip-top:before{left:50%;margin-left:-6px}.leaflet-tooltip-top:before{bottom:0;margin-bottom:-12px;border-top-color:#fff}.leaflet-tooltip-bottom:before{top:0;margin-top:-12px;margin-left:-6px;border-bottom-color:#fff}.leaflet-tooltip-left{margin-left:-6px}.leaflet-tooltip-right{margin-left:6px}.leaflet-tooltip-left:before,.leaflet-tooltip-right:before{top:50%;margin-top:-6px}.leaflet-tooltip-left:before{right:0;margin-right:-12px;border-left-color:#fff}.leaflet-tooltip-right:before{left:0;margin-left:-12px;border-right-color:#fff}@media print{.leaflet-control{-webkit-print-color-adjust:exact;print-color-adjust:exact}}:host{position:relative;display:block}.map{display:block;width:100%;height:100%;min-width:100px;min-height:100px}`;
701
-
702
- const IbcsMap = class {
703
- constructor(hostRef) {
704
- registerInstance(this, hostRef);
705
- this.stateUpdated = createEvent(this, "stateUpdated", 7);
706
- this.dragZoomEnded = createEvent(this, "dragZoomEnded", 7);
707
- //@Prop() tileLayer: string = 'https://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}{r}.png';
708
- this._tileLayer = "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
709
- this.tileLayer = this._tileLayer;
710
- this._manualPosOverride = true;
711
- this.manualPosOverride = this._manualPosOverride;
712
- this._latitude = 50.137634;
713
- this.latitude = this._latitude;
714
- this._longitude = 8.679129;
715
- this.longitude = this._longitude;
716
- this._scale = 11;
717
- this.scale = this._scale;
718
- this._customView = false;
719
- this.customView = this._customView;
720
- this._showScale = false;
721
- this.showScale = this._showScale;
722
- this._showZoom = false;
723
- this.showZoom = this._showZoom;
724
- this._attribution = "";
725
- this.attribution = this._attribution;
726
- this._gpxs = [];
727
- this.gpxs = this._gpxs;
728
- this._markers = [];
729
- this.markers = this._markers;
730
- this._geojsons = [];
731
- this.geojsons = this._geojsons;
732
- this.lmap = null;
733
- this.gpxLayer = [];
734
- this.mapMarker = [];
735
- this.geoJsonLayer = [];
736
- // @ts-ignore
737
- this.scaleControl = undefined.scale();
738
- // @ts-ignore
739
- this.zoomControl = undefined.zoom();
740
- // @ts-ignore
741
- this.tileLayerControl = undefined(this._tileLayer);
742
- this.cumlatedBounds = {
743
- northEast: null,
744
- southWest: null,
745
- };
746
- }
747
- async setProps(data) {
748
- Object.keys(data).forEach((key) => {
749
- //@ts-ignore
750
- this[key] = data[key];
751
- });
752
- }
753
- async unSetProps(data) {
754
- Object.keys(data).forEach((key) => {
755
- //@ts-ignore
756
- this[key] = undefined;
757
- });
758
- }
759
- parseTileLayer(tileLayer) {
760
- this._tileLayer = tileLayer;
761
- }
762
- parseManualPosOverride(manualPosOverride) {
763
- this._manualPosOverride = JSON.parse(manualPosOverride);
764
- }
765
- parseLatitude(latitude) {
766
- this._latitude = Number(latitude);
767
- }
768
- parseLongitude(longitude) {
769
- this._longitude = Number(longitude);
770
- }
771
- parseScale(scale) {
772
- this._scale = Number(scale);
773
- }
774
- parseCustomView(customView) {
775
- this._customView = JSON.parse(customView);
776
- }
777
- parseShowScale(showScale) {
778
- this._showScale = JSON.parse(showScale);
779
- }
780
- parseShowZoom(showZoom) {
781
- this._showZoom = JSON.parse(showZoom);
782
- }
783
- parseAttribution(attribution) {
784
- this._attribution = attribution;
785
- }
786
- parseGpxLayers(gpxs) {
787
- if (typeof gpxs === "string") {
788
- this._gpxs = JSON.parse(gpxs);
789
- }
790
- else {
791
- this._gpxs = gpxs;
792
- }
793
- this.gpxLayerUpdate(this._gpxs);
794
- }
795
- parseMarkers(markers) {
796
- if (typeof markers === "string") {
797
- this._markers = JSON.parse(markers);
798
- }
799
- else {
800
- this._markers = markers;
801
- }
802
- this.mapMarkerUpdate(this._markers);
803
- }
804
- parseGeoJson(geojsons) {
805
- if (typeof geojsons === "string") {
806
- this._geojsons = JSON.parse(geojsons);
807
- }
808
- else {
809
- this._geojsons = geojsons;
810
- }
811
- this.geoJsonUpdate(this._geojsons);
812
- }
813
- render() {
814
- return (h(Host, { key: '955a4572190c7e73f4dd654e42814a260f6e4062' }, h("div", { key: 'ca831888a3202fe8877dd98a00042be6ae58903f', ref: (el) => (this.drawElement = el), id: "map", class: "map" })));
815
- }
816
- gpxLayerUpdate(gpxOptionsLayers) {
817
- this.gpxLayer.forEach((layer) => {
818
- layer.remove();
819
- });
820
- this.gpxLayer = [];
821
- for (const gpxOptions of gpxOptionsLayers) {
822
- if (gpxOptions === undefined) {
823
- continue;
824
- }
825
- const regex = /^data:application\/octet-stream;/;
826
- let decodedData = gpxOptions.file;
827
- if (regex.test(gpxOptions.file)) {
828
- const dataPart = gpxOptions.file.split(",")[1];
829
- decodedData = atob(dataPart);
830
- }
831
- // @ts-ignore
832
- this.gpxLayer.push(new undefined(decodedData, {
833
- async: true,
834
- marker_options: {
835
- startIconUrl: gpxOptions.startIconUrl,
836
- endIconUrl: gpxOptions.endIconUrl,
837
- shadowUrl: gpxOptions.shadowUrl,
838
- },
839
- polyline_options: {
840
- color: gpxOptions.color,
841
- opacity: gpxOptions.opacity,
842
- lineCap: gpxOptions.lineCap,
843
- weight: gpxOptions.weight,
844
- },
845
- }).on("loaded", (e) => {
846
- this.updateCumulatedBounds(e);
847
- if (this._manualPosOverride === false) {
848
- this.lmap.fitBounds([this.cumlatedBounds.northEast, this.cumlatedBounds.southWest]);
849
- }
850
- this.stateUpdated.emit(ComponentStatus.SUCCESSFUL);
851
- }));
852
- }
853
- }
854
- updateCumulatedBounds(e) {
855
- if (this.cumlatedBounds.northEast == null) {
856
- this.cumlatedBounds.northEast = {
857
- lat: e.target.getBounds().getNorthEast().lat,
858
- lng: e.target.getBounds().getNorthEast().lng,
859
- };
860
- }
861
- if (this.cumlatedBounds.southWest == null) {
862
- this.cumlatedBounds.southWest = {
863
- lat: e.target.getBounds().getSouthWest().lat,
864
- lng: e.target.getBounds().getSouthWest().lng,
865
- };
866
- }
867
- if (e.target.getBounds().getNorthEast().lat > this.cumlatedBounds.northEast.lat) {
868
- this.cumlatedBounds.northEast.lat = e.target.getBounds().getNorthEast().lat;
869
- }
870
- if (e.target.getBounds().getNorthEast().lng > this.cumlatedBounds.northEast.lng) {
871
- this.cumlatedBounds.northEast.lng = e.target.getBounds().getNorthEast().lng;
872
- }
873
- if (e.target.getBounds().getSouthWest().lat < this.cumlatedBounds.southWest.lat) {
874
- this.cumlatedBounds.southWest.lat = e.target.getBounds().getSouthWest().lat;
875
- }
876
- if (e.target.getBounds().getSouthWest().lng < this.cumlatedBounds.southWest.lng) {
877
- this.cumlatedBounds.southWest.lng = e.target.getBounds().getSouthWest().lng;
878
- }
879
- }
880
- mapMarkerUpdate(markes) {
881
- this.mapMarker.forEach((layer) => {
882
- layer.remove();
883
- });
884
- this.mapMarker = [];
885
- for (const markerOptions of markes) {
886
- // Icon options
887
- const iconOptions = {
888
- iconUrl: markerOptions.iconUrl,
889
- iconSize: [markerOptions.iconWidth, markerOptions.iconHeight],
890
- };
891
- // @ts-ignore
892
- const customIcon = undefined(iconOptions);
893
- const options = {
894
- title: markerOptions.title,
895
- icon: customIcon,
896
- };
897
- // @ts-ignore
898
- this.mapMarker.push(undefined([markerOptions.latitude, markerOptions.longitude], options));
899
- }
900
- }
901
- geoJsonUpdate(geojsons) {
902
- this.geoJsonLayer.forEach((layer) => {
903
- layer.remove();
904
- });
905
- this.geoJsonLayer = [];
906
- for (const geoJson of geojsons) {
907
- const jsonStyle = {
908
- color: geoJson.color,
909
- weight: geoJson.weight,
910
- opacity: geoJson.opacity,
911
- lineCap: geoJson.lineCap,
912
- };
913
- const options = {
914
- style: jsonStyle,
915
- };
916
- // @ts-ignore
917
- this.geoJsonLayer.push(undefined(DataUriUtil.dataURItoObject(geoJson.file), options));
918
- }
919
- }
920
- componentWillLoad() {
921
- this.stateUpdated.emit(ComponentStatus.RUNNING);
922
- this.parseMarkers(this.markers);
923
- this.parseGeoJson(this.geojsons);
924
- this.parseGpxLayers(this.gpxs);
925
- this.parseAttribution(this.attribution);
926
- this.parseShowZoom(this.showZoom);
927
- this.parseShowScale(this.showScale);
928
- this.parseScale(this.scale);
929
- this.parseLongitude(this.longitude);
930
- this.parseLatitude(this.latitude);
931
- this.parseTileLayer(this.tileLayer);
932
- }
933
- componentDidLoad() {
934
- if (this.drawElement == null) {
935
- return;
936
- }
937
- // @ts-ignore
938
- this.lmap = undefined(this.drawElement, { zoomControl: false });
939
- this.setView();
940
- this.setTileLayer();
941
- this.setGeoJsonLayer();
942
- this.setGPXLayer();
943
- this.setMarker();
944
- this.setShowScale();
945
- this.setShowZoom();
946
- this.setAttribution();
947
- this.lmap.addEventListener("dragend", this.dragZoomEnd.bind(this));
948
- this.lmap.addEventListener("zoomend", this.dragZoomEnd.bind(this));
949
- }
950
- disconnectedCallback() {
951
- this.lmap.removeEventListener("dragend", this.dragZoomEnd.bind(this));
952
- this.lmap.removeEventListener("zoomend", this.dragZoomEnd.bind(this));
953
- }
954
- componentDidUpdate() {
955
- if (this.drawElement == null) {
956
- return;
957
- }
958
- this.setView();
959
- this.setTileLayer();
960
- this.setGeoJsonLayer();
961
- this.setGPXLayer();
962
- this.setMarker();
963
- this.setShowScale();
964
- this.setShowZoom();
965
- this.setAttribution();
966
- }
967
- dragZoomEnd() {
968
- const { lat, lng } = this.lmap.getCenter();
969
- const zoom = this.lmap.getZoom();
970
- this.dragZoomEnded.emit({
971
- longitude: lng,
972
- latitude: lat,
973
- scale: zoom,
974
- });
975
- }
976
- setView() {
977
- //if(this._customView == false) {
978
- // return;
979
- //}
980
- this.lmap.setView([this._latitude, this._longitude], this._scale);
981
- }
982
- setTileLayer() {
983
- this.tileLayerControl.setUrl(this._tileLayer, true);
984
- this.tileLayerControl.addTo(this.lmap);
985
- }
986
- setAttribution() {
987
- this.lmap.attributionControl.setPrefix(this._attribution);
988
- }
989
- setShowScale() {
990
- this.scaleControl.remove();
991
- if (this._showScale === true) {
992
- this.scaleControl.addTo(this.lmap);
993
- }
994
- }
995
- setShowZoom() {
996
- this.zoomControl.remove();
997
- if (this._showZoom === true) {
998
- this.zoomControl.addTo(this.lmap);
999
- }
1000
- }
1001
- setGPXLayer() {
1002
- this.gpxLayer.forEach((layer) => {
1003
- try {
1004
- layer.addTo(this.lmap);
1005
- }
1006
- catch (e) {
1007
- console.error("gpxLayer", e);
1008
- }
1009
- });
1010
- }
1011
- setMarker() {
1012
- this.mapMarker.forEach((layer) => {
1013
- try {
1014
- layer.addTo(this.lmap);
1015
- }
1016
- catch (e) {
1017
- console.error("markerLayer", e);
1018
- }
1019
- });
1020
- }
1021
- setGeoJsonLayer() {
1022
- this.geoJsonLayer.forEach((layer) => {
1023
- try {
1024
- layer.addTo(this.lmap);
1025
- }
1026
- catch (e) {
1027
- console.error("gpxLayer", e);
1028
- }
1029
- });
1030
- }
1031
- static get assetsDirs() { return ["assets"]; }
1032
- static get watchers() { return {
1033
- "tileLayer": [{
1034
- "parseTileLayer": 0
1035
- }],
1036
- "manualPosOverride": [{
1037
- "parseManualPosOverride": 0
1038
- }],
1039
- "latitude": [{
1040
- "parseLatitude": 0
1041
- }],
1042
- "longitude": [{
1043
- "parseLongitude": 0
1044
- }],
1045
- "scale": [{
1046
- "parseScale": 0
1047
- }],
1048
- "customView": [{
1049
- "parseCustomView": 0
1050
- }],
1051
- "showScale": [{
1052
- "parseShowScale": 0
1053
- }],
1054
- "showZoom": [{
1055
- "parseShowZoom": 0
1056
- }],
1057
- "attribution": [{
1058
- "parseAttribution": 0
1059
- }],
1060
- "gpxs": [{
1061
- "parseGpxLayers": 0
1062
- }],
1063
- "markers": [{
1064
- "parseMarkers": 0
1065
- }],
1066
- "geojsons": [{
1067
- "parseGeoJson": 0
1068
- }]
1069
- }; }
1070
- };
1071
- IbcsMap.style = ibcsMapCss();
1072
-
1073
- export { IbcsMap as ibcs_map };