@kalisio/kdk 2.4.0 → 2.5.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 (647) hide show
  1. package/core/api/application.js +12 -12
  2. package/core/api/authentication.js +51 -7
  3. package/core/api/hooks/hooks.authentication.js +1 -59
  4. package/core/api/hooks/hooks.authorisations.js +8 -102
  5. package/core/api/hooks/hooks.model.js +4 -0
  6. package/core/api/hooks/hooks.push.js +18 -14
  7. package/core/api/hooks/hooks.users.js +0 -91
  8. package/core/api/hooks/index.js +0 -2
  9. package/core/api/services/account/account.service.js +1 -1
  10. package/core/api/services/authorisations/authorisations.service.js +28 -29
  11. package/core/api/services/index.js +38 -50
  12. package/core/api/services/messages/messages.hooks.js +4 -3
  13. package/core/api/services/users/users.service.js +5 -0
  14. package/core/client/api.js +182 -71
  15. package/core/client/broadcaster.js +20 -0
  16. package/core/client/capabilities.js +17 -7
  17. package/core/client/components/KActivity.vue +29 -34
  18. package/core/client/components/KAvatar.vue +0 -6
  19. package/core/client/components/KChip.vue +142 -39
  20. package/core/client/components/KContent.vue +13 -32
  21. package/core/client/components/KDialog.vue +29 -8
  22. package/core/client/components/KEditor.vue +120 -0
  23. package/core/client/components/KFollower.vue +75 -0
  24. package/core/client/components/KLogo.vue +2 -3
  25. package/core/client/components/KModal.vue +30 -10
  26. package/core/client/components/KSponsor.vue +1 -1
  27. package/core/client/components/KTextArea.vue +2 -5
  28. package/core/client/components/account/KDeleteAccountManager.vue +1 -1
  29. package/core/client/components/account/KProfile.vue +52 -14
  30. package/core/client/components/account/KSubscription.vue +19 -9
  31. package/core/client/components/account/KSubscriptionsManager.vue +10 -11
  32. package/core/client/components/action/KAction.vue +44 -24
  33. package/core/client/components/action/KBugReportAction.vue +4 -5
  34. package/core/client/components/action/KToggleStickyVisibility.vue +41 -0
  35. package/core/client/components/action/KToggleWidgetVisibility.vue +41 -0
  36. package/core/client/components/app/KPlatform.vue +122 -35
  37. package/core/client/components/app/KRequestProgressBar.vue +59 -0
  38. package/core/client/components/app/KSettings.vue +13 -2
  39. package/core/client/components/app/KTour.vue +2 -2
  40. package/core/client/components/chart/KTimeSeriesChart.vue +11 -3
  41. package/core/client/components/collection/KCard.vue +27 -33
  42. package/core/client/components/collection/KCardSection.vue +3 -23
  43. package/core/client/components/collection/KColumn.vue +0 -5
  44. package/core/client/components/collection/KDescriptionCardSection.vue +10 -5
  45. package/core/client/components/collection/KFilterView.vue +15 -0
  46. package/core/client/components/collection/KGrid.vue +4 -9
  47. package/core/client/components/collection/KHistory.vue +0 -5
  48. package/core/client/components/collection/KHistoryEntry.vue +0 -2
  49. package/core/client/components/collection/KItem.vue +1 -2
  50. package/core/client/components/collection/KSearchFilterControl.vue +139 -0
  51. package/core/client/components/collection/KTable.vue +1 -4
  52. package/core/client/components/collection/KTagsFilterControl.vue +70 -0
  53. package/core/client/components/collection/KTagsFilterView.vue +61 -0
  54. package/core/client/components/collection/KTimeFilterControl.vue +40 -0
  55. package/core/client/components/collection/KTimeFilterView.vue +106 -0
  56. package/core/client/components/collection/KTimeLine.vue +18 -11
  57. package/core/client/components/document/KBrowser.vue +283 -0
  58. package/core/client/components/document/KCsv.vue +52 -0
  59. package/core/client/components/document/KDocument.vue +19 -5
  60. package/core/client/components/document/KImage.vue +50 -19
  61. package/core/client/components/document/KMarkdown.vue +10 -2
  62. package/core/client/components/document/KUploader.vue +126 -0
  63. package/core/client/components/document/KVideo.vue +39 -0
  64. package/core/client/components/form/KDateField.vue +70 -0
  65. package/core/client/components/form/KDateTimeRangeField.vue +6 -17
  66. package/core/client/components/form/KDatetimeField.vue +6 -13
  67. package/core/client/components/form/KForm.vue +8 -8
  68. package/core/client/components/form/KOptionsField.vue +2 -0
  69. package/core/client/components/form/KResolutionField.vue +54 -52
  70. package/core/client/components/form/KSelectField.vue +27 -13
  71. package/core/client/components/form/KTextareaField.vue +23 -5
  72. package/core/client/components/graphics/KIcon.vue +64 -0
  73. package/core/client/components/index.js +1 -3
  74. package/core/client/components/input/KColorPicker.vue +70 -0
  75. package/core/client/components/input/KIconPicker.vue +188 -0
  76. package/core/client/components/input/KShapePicker.vue +81 -0
  77. package/core/client/components/input/index.js +7 -1
  78. package/core/client/components/layout/KFab.vue +1 -1
  79. package/core/client/components/layout/KLayout.vue +14 -2
  80. package/core/client/components/layout/KOpener.vue +9 -11
  81. package/core/client/components/layout/KPage.vue +31 -17
  82. package/core/client/components/layout/KWindow.vue +34 -18
  83. package/core/client/components/menu/KMenu.vue +52 -36
  84. package/core/client/components/menu/KSubMenu.vue +105 -0
  85. package/core/client/components/messages/KMessageCard.vue +207 -0
  86. package/core/client/components/messages/KMessageComposer.vue +199 -0
  87. package/core/client/components/messages/KMessagesTimeLine.vue +137 -0
  88. package/core/client/components/messages/index.js +7 -0
  89. package/core/client/components/screen/KErrorScreen.vue +2 -3
  90. package/core/client/components/screen/KLogoutScreen.vue +3 -1
  91. package/core/client/components/screen/KOAuthLoginScreen.vue +15 -0
  92. package/core/client/components/screen/KOAuthLogoutScreen.vue +33 -0
  93. package/core/client/components/screen/KUnauthorizedScreen.vue +16 -0
  94. package/core/client/components/time/KAbsoluteTimeRange.vue +7 -14
  95. package/core/client/components/time/KDate.vue +56 -26
  96. package/core/client/components/time/KDateTime.vue +93 -37
  97. package/core/client/components/time/KDateTimeRange.vue +197 -52
  98. package/core/client/components/time/KTime.vue +56 -26
  99. package/core/client/composables/activity.js +40 -30
  100. package/core/client/composables/{counter.js → collection-counter.js} +2 -4
  101. package/core/client/composables/collection-filter.js +111 -0
  102. package/core/client/composables/collection-timerange.js +56 -0
  103. package/core/client/composables/collection.js +13 -11
  104. package/core/client/composables/context.js +92 -0
  105. package/core/client/composables/errors.js +83 -0
  106. package/core/client/composables/index.js +5 -1
  107. package/core/client/composables/layout.js +14 -11
  108. package/core/client/composables/messages.js +4 -4
  109. package/core/client/composables/pwa.js +20 -27
  110. package/core/client/composables/schema.js +1 -1
  111. package/core/client/composables/screen.js +21 -9
  112. package/core/client/composables/selection.js +16 -4
  113. package/core/client/composables/session.js +13 -7
  114. package/core/client/composables/store.js +2 -1
  115. package/core/client/context.js +38 -0
  116. package/core/client/directives/v-hover.js +7 -4
  117. package/core/client/document.js +43 -15
  118. package/core/client/events.js +2 -2
  119. package/core/client/exporter.js +5 -4
  120. package/core/client/filter.js +1 -8
  121. package/core/client/guards.js +3 -3
  122. package/core/client/hooks/hooks.logger.js +1 -1
  123. package/core/client/hooks/hooks.offline.js +32 -0
  124. package/core/client/hooks/index.js +2 -1
  125. package/core/client/i18n/core_en.json +95 -268
  126. package/core/client/i18n/core_fr.json +181 -353
  127. package/core/client/index.js +22 -8
  128. package/core/client/layout.js +64 -25
  129. package/core/client/local-cache.js +67 -0
  130. package/core/client/local-storage.js +6 -2
  131. package/core/client/mixins/index.js +0 -1
  132. package/core/client/mixins/mixin.base-activity.js +22 -10
  133. package/core/client/mixins/mixin.base-editor.js +1 -1
  134. package/core/client/mixins/mixin.base-field.js +10 -1
  135. package/core/client/mixins/mixin.base-item.js +14 -11
  136. package/core/client/mixins/mixin.service.js +1 -5
  137. package/core/client/platform.js +44 -0
  138. package/core/client/readers/reader.blob.js +3 -3
  139. package/core/client/readers/reader.csv.js +2 -2
  140. package/core/client/readers/reader.json.js +2 -2
  141. package/core/client/services/index.js +7 -11
  142. package/core/client/storage.js +43 -8
  143. package/core/client/template-context.js +14 -14
  144. package/core/client/time.js +3 -3
  145. package/core/client/units.js +7 -4
  146. package/core/client/utils/index.js +6 -5
  147. package/core/client/utils/utils.collection.js +71 -0
  148. package/core/client/utils/utils.colors.js +29 -8
  149. package/core/client/utils/utils.content.js +14 -14
  150. package/core/client/utils/utils.files.js +17 -0
  151. package/core/client/utils/utils.items.js +4 -0
  152. package/core/client/utils/utils.math.js +18 -1
  153. package/core/client/utils/utils.push.js +22 -13
  154. package/core/client/utils/utils.screen.js +6 -2
  155. package/core/client/utils/utils.services.js +42 -0
  156. package/core/client/utils/utils.session.js +48 -12
  157. package/core/client/utils/utils.shapes.js +15 -11
  158. package/core/common/permissions.js +3 -108
  159. package/core/common/schemas/messages.update.json +16 -0
  160. package/core/common/schemas/settings.update.json +27 -8
  161. package/core/common/utils.js +2 -0
  162. package/core/common/utils.offline.js +38 -0
  163. package/coverage/core/api/application.js.html +296 -296
  164. package/coverage/core/api/authentication.js.html +206 -74
  165. package/coverage/core/api/db.js.html +61 -61
  166. package/coverage/core/api/hooks/hooks.authentication.js.html +15 -189
  167. package/coverage/core/api/hooks/hooks.authorisations.js.html +180 -462
  168. package/coverage/core/api/hooks/hooks.groups.js.html +1 -1
  169. package/coverage/core/api/hooks/hooks.logger.js.html +16 -16
  170. package/coverage/core/api/hooks/hooks.model.js.html +69 -57
  171. package/coverage/core/api/hooks/hooks.organisations.js.html +1 -1
  172. package/coverage/core/api/hooks/hooks.push.js.html +58 -46
  173. package/coverage/core/api/hooks/hooks.query.js.html +142 -142
  174. package/coverage/core/api/hooks/hooks.schemas.js.html +1 -1
  175. package/coverage/core/api/hooks/hooks.service.js.html +1 -1
  176. package/coverage/core/api/hooks/hooks.storage.js.html +1 -1
  177. package/coverage/core/api/hooks/hooks.users.js.html +54 -327
  178. package/coverage/core/api/hooks/index.html +64 -94
  179. package/coverage/core/api/hooks/index.js.html +4 -10
  180. package/coverage/core/api/index.html +41 -56
  181. package/coverage/core/api/index.js.html +1 -1
  182. package/coverage/core/api/marshall.js.html +9 -9
  183. package/coverage/core/api/models/groups.model.mongodb.js.html +1 -1
  184. package/coverage/core/api/models/index.html +13 -58
  185. package/coverage/core/api/models/messages.model.mongodb.js.html +35 -35
  186. package/coverage/core/api/models/organisations.model.mongodb.js.html +3 -3
  187. package/coverage/core/api/models/tags.model.mongodb.js.html +1 -1
  188. package/coverage/core/api/models/users.model.mongodb.js.html +1 -1
  189. package/coverage/core/api/services/account/account.hooks.js.html +1 -1
  190. package/coverage/core/api/services/account/account.service.js.html +67 -67
  191. package/coverage/core/api/services/account/index.html +16 -16
  192. package/coverage/core/api/services/authorisations/authorisations.hooks.js.html +1 -1
  193. package/coverage/core/api/services/authorisations/authorisations.service.js.html +141 -144
  194. package/coverage/core/api/services/authorisations/index.html +19 -19
  195. package/coverage/core/api/services/databases/databases.hooks.js.html +82 -82
  196. package/coverage/core/api/services/databases/databases.service.js.html +20 -20
  197. package/coverage/core/api/services/databases/index.html +32 -32
  198. package/coverage/core/api/services/groups/groups.hooks.js.html +1 -1
  199. package/coverage/core/api/services/groups/index.html +1 -1
  200. package/coverage/core/api/services/import-export/import-export.hooks.js.html +1 -1
  201. package/coverage/core/api/services/import-export/import-export.service.js.html +1 -1
  202. package/coverage/core/api/services/import-export/index.html +1 -1
  203. package/coverage/core/api/services/index.html +21 -21
  204. package/coverage/core/api/services/index.js.html +118 -154
  205. package/coverage/core/api/services/mailer/index.html +1 -1
  206. package/coverage/core/api/services/mailer/mailer.hooks.js.html +1 -1
  207. package/coverage/core/api/services/mailer/mailer.service.js.html +1 -1
  208. package/coverage/core/api/services/messages/index.html +21 -21
  209. package/coverage/core/api/services/messages/messages.hooks.js.html +89 -86
  210. package/coverage/core/api/services/organisations/index.html +1 -1
  211. package/coverage/core/api/services/organisations/organisations.hooks.js.html +1 -1
  212. package/coverage/core/api/services/organisations/organisations.service.js.html +23 -23
  213. package/coverage/core/api/services/push/index.html +1 -1
  214. package/coverage/core/api/services/push/push.hooks.js.html +1 -1
  215. package/coverage/core/api/services/push/push.service.js.html +1 -1
  216. package/coverage/core/api/services/storage/index.html +5 -5
  217. package/coverage/core/api/services/storage/storage.hooks.js.html +1 -1
  218. package/coverage/core/api/services/storage/storage.service.js.html +27 -27
  219. package/coverage/core/api/services/tags/index.html +1 -1
  220. package/coverage/core/api/services/tags/tags.hooks.js.html +1 -1
  221. package/coverage/core/api/services/users/index.html +23 -8
  222. package/coverage/core/api/services/users/users.hooks.js.html +1 -1
  223. package/coverage/core/api/services/users/users.service.js.html +100 -0
  224. package/coverage/core/api/utils.js.html +1 -1
  225. package/coverage/core/common/errors.js.html +1 -1
  226. package/coverage/core/common/index.html +42 -27
  227. package/coverage/core/common/index.js.html +1 -1
  228. package/coverage/core/common/permissions.js.html +195 -510
  229. package/coverage/core/common/schema.js.html +1 -1
  230. package/coverage/core/common/utils.js.html +12 -6
  231. package/coverage/core/common/utils.offline.js.html +199 -0
  232. package/coverage/index.html +142 -172
  233. package/coverage/lcov-report/core/api/application.js.html +296 -296
  234. package/coverage/lcov-report/core/api/authentication.js.html +206 -74
  235. package/coverage/lcov-report/core/api/db.js.html +61 -61
  236. package/coverage/lcov-report/core/api/hooks/hooks.authentication.js.html +15 -189
  237. package/coverage/lcov-report/core/api/hooks/hooks.authorisations.js.html +180 -462
  238. package/coverage/lcov-report/core/api/hooks/hooks.groups.js.html +1 -1
  239. package/coverage/lcov-report/core/api/hooks/hooks.logger.js.html +16 -16
  240. package/coverage/lcov-report/core/api/hooks/hooks.model.js.html +69 -57
  241. package/coverage/lcov-report/core/api/hooks/hooks.organisations.js.html +1 -1
  242. package/coverage/lcov-report/core/api/hooks/hooks.push.js.html +58 -46
  243. package/coverage/lcov-report/core/api/hooks/hooks.query.js.html +142 -142
  244. package/coverage/lcov-report/core/api/hooks/hooks.schemas.js.html +1 -1
  245. package/coverage/lcov-report/core/api/hooks/hooks.service.js.html +1 -1
  246. package/coverage/lcov-report/core/api/hooks/hooks.storage.js.html +1 -1
  247. package/coverage/lcov-report/core/api/hooks/hooks.users.js.html +54 -327
  248. package/coverage/lcov-report/core/api/hooks/index.html +64 -94
  249. package/coverage/lcov-report/core/api/hooks/index.js.html +4 -10
  250. package/coverage/lcov-report/core/api/index.html +41 -56
  251. package/coverage/lcov-report/core/api/index.js.html +1 -1
  252. package/coverage/lcov-report/core/api/marshall.js.html +9 -9
  253. package/coverage/lcov-report/core/api/models/groups.model.mongodb.js.html +1 -1
  254. package/coverage/lcov-report/core/api/models/index.html +13 -58
  255. package/coverage/lcov-report/core/api/models/messages.model.mongodb.js.html +35 -35
  256. package/coverage/lcov-report/core/api/models/organisations.model.mongodb.js.html +3 -3
  257. package/coverage/lcov-report/core/api/models/tags.model.mongodb.js.html +1 -1
  258. package/coverage/lcov-report/core/api/models/users.model.mongodb.js.html +1 -1
  259. package/coverage/lcov-report/core/api/services/account/account.hooks.js.html +1 -1
  260. package/coverage/lcov-report/core/api/services/account/account.service.js.html +67 -67
  261. package/coverage/lcov-report/core/api/services/account/index.html +16 -16
  262. package/coverage/lcov-report/core/api/services/authorisations/authorisations.hooks.js.html +1 -1
  263. package/coverage/lcov-report/core/api/services/authorisations/authorisations.service.js.html +141 -144
  264. package/coverage/lcov-report/core/api/services/authorisations/index.html +19 -19
  265. package/coverage/lcov-report/core/api/services/databases/databases.hooks.js.html +82 -82
  266. package/coverage/lcov-report/core/api/services/databases/databases.service.js.html +20 -20
  267. package/coverage/lcov-report/core/api/services/databases/index.html +32 -32
  268. package/coverage/lcov-report/core/api/services/groups/groups.hooks.js.html +1 -1
  269. package/coverage/lcov-report/core/api/services/groups/index.html +1 -1
  270. package/coverage/lcov-report/core/api/services/import-export/import-export.hooks.js.html +1 -1
  271. package/coverage/lcov-report/core/api/services/import-export/import-export.service.js.html +1 -1
  272. package/coverage/lcov-report/core/api/services/import-export/index.html +1 -1
  273. package/coverage/lcov-report/core/api/services/index.html +21 -21
  274. package/coverage/lcov-report/core/api/services/index.js.html +118 -154
  275. package/coverage/lcov-report/core/api/services/mailer/index.html +1 -1
  276. package/coverage/lcov-report/core/api/services/mailer/mailer.hooks.js.html +1 -1
  277. package/coverage/lcov-report/core/api/services/mailer/mailer.service.js.html +1 -1
  278. package/coverage/lcov-report/core/api/services/messages/index.html +21 -21
  279. package/coverage/lcov-report/core/api/services/messages/messages.hooks.js.html +89 -86
  280. package/coverage/lcov-report/core/api/services/organisations/index.html +1 -1
  281. package/coverage/lcov-report/core/api/services/organisations/organisations.hooks.js.html +1 -1
  282. package/coverage/lcov-report/core/api/services/organisations/organisations.service.js.html +23 -23
  283. package/coverage/lcov-report/core/api/services/push/index.html +1 -1
  284. package/coverage/lcov-report/core/api/services/push/push.hooks.js.html +1 -1
  285. package/coverage/lcov-report/core/api/services/push/push.service.js.html +1 -1
  286. package/coverage/lcov-report/core/api/services/storage/index.html +5 -5
  287. package/coverage/lcov-report/core/api/services/storage/storage.hooks.js.html +1 -1
  288. package/coverage/lcov-report/core/api/services/storage/storage.service.js.html +27 -27
  289. package/coverage/lcov-report/core/api/services/tags/index.html +1 -1
  290. package/coverage/lcov-report/core/api/services/tags/tags.hooks.js.html +1 -1
  291. package/coverage/lcov-report/core/api/services/users/index.html +23 -8
  292. package/coverage/lcov-report/core/api/services/users/users.hooks.js.html +1 -1
  293. package/coverage/lcov-report/core/api/services/users/users.service.js.html +100 -0
  294. package/coverage/lcov-report/core/api/utils.js.html +1 -1
  295. package/coverage/lcov-report/core/common/errors.js.html +1 -1
  296. package/coverage/lcov-report/core/common/index.html +42 -27
  297. package/coverage/lcov-report/core/common/index.js.html +1 -1
  298. package/coverage/lcov-report/core/common/permissions.js.html +195 -510
  299. package/coverage/lcov-report/core/common/schema.js.html +1 -1
  300. package/coverage/lcov-report/core/common/utils.js.html +12 -6
  301. package/coverage/lcov-report/core/common/utils.offline.js.html +199 -0
  302. package/coverage/lcov-report/index.html +142 -172
  303. package/coverage/lcov-report/map/api/hooks/hooks.catalog.js.html +125 -29
  304. package/coverage/lcov-report/map/api/hooks/hooks.features.js.html +1 -1
  305. package/coverage/lcov-report/map/api/hooks/hooks.query.js.html +20 -44
  306. package/coverage/lcov-report/map/api/hooks/index.html +7 -7
  307. package/coverage/lcov-report/map/api/hooks/index.js.html +1 -1
  308. package/coverage/lcov-report/map/api/index.html +1 -1
  309. package/coverage/lcov-report/map/api/index.js.html +1 -1
  310. package/coverage/lcov-report/map/api/marshall.js.html +1 -1
  311. package/coverage/lcov-report/map/api/models/alerts.model.mongodb.js.html +1 -1
  312. package/coverage/lcov-report/map/api/models/catalog.model.mongodb.js.html +49 -7
  313. package/coverage/lcov-report/map/api/models/features.model.mongodb.js.html +1 -1
  314. package/coverage/lcov-report/map/api/models/index.html +22 -7
  315. package/coverage/lcov-report/map/api/models/projects.model.mongodb.js.html +1 -1
  316. package/coverage/lcov-report/map/api/models/styles.model.mongodb.js.html +112 -0
  317. package/coverage/lcov-report/map/api/services/alerts/alerts.hooks.js.html +1 -1
  318. package/coverage/lcov-report/map/api/services/alerts/alerts.service.js.html +1 -1
  319. package/coverage/lcov-report/map/api/services/alerts/index.html +1 -1
  320. package/coverage/lcov-report/map/api/services/catalog/catalog.hooks.js.html +29 -11
  321. package/coverage/lcov-report/map/api/services/catalog/index.html +5 -5
  322. package/coverage/lcov-report/map/api/services/daptiles/daptiles.service.js.html +1 -1
  323. package/coverage/lcov-report/map/api/services/daptiles/index.html +1 -1
  324. package/coverage/lcov-report/map/api/services/features/features.hooks.js.html +78 -9
  325. package/coverage/lcov-report/map/api/services/features/features.service.js.html +307 -4
  326. package/coverage/lcov-report/map/api/services/features/index.html +7 -7
  327. package/coverage/lcov-report/map/api/services/index.html +5 -5
  328. package/coverage/lcov-report/map/api/services/index.js.html +287 -50
  329. package/coverage/lcov-report/map/api/services/projects/index.html +1 -1
  330. package/coverage/lcov-report/map/api/services/projects/projects.hooks.js.html +1 -1
  331. package/coverage/lcov-report/map/api/services/styles/index.html +116 -0
  332. package/coverage/lcov-report/map/api/services/styles/styles.hooks.js.html +196 -0
  333. package/coverage/lcov-report/map/common/dynamic-grid-source.js.html +1 -1
  334. package/coverage/lcov-report/map/common/errors.js.html +1 -1
  335. package/coverage/lcov-report/map/common/geotiff-grid-source.js.html +8 -5
  336. package/coverage/lcov-report/map/common/grid.js.html +1 -1
  337. package/coverage/lcov-report/map/common/index.html +7 -7
  338. package/coverage/lcov-report/map/common/index.js.html +1 -1
  339. package/coverage/lcov-report/map/common/meteo-model-grid-source.js.html +1 -1
  340. package/coverage/lcov-report/map/common/moment-utils.js.html +1 -1
  341. package/coverage/lcov-report/map/common/opendap-grid-source.js.html +1 -1
  342. package/coverage/lcov-report/map/common/opendap-utils.js.html +1 -1
  343. package/coverage/lcov-report/map/common/permissions.js.html +10 -4
  344. package/coverage/lcov-report/map/common/time-based-grid-source.js.html +1 -1
  345. package/coverage/lcov-report/map/common/tms-utils.js.html +6 -6
  346. package/coverage/lcov-report/map/common/wcs-grid-source.js.html +3 -3
  347. package/coverage/lcov-report/map/common/wcs-utils.js.html +9 -9
  348. package/coverage/lcov-report/map/common/weacast-grid-source.js.html +1 -1
  349. package/coverage/lcov-report/map/common/wfs-utils.js.html +11 -11
  350. package/coverage/lcov-report/map/common/wms-utils.js.html +8 -8
  351. package/coverage/lcov-report/map/common/wmts-utils.js.html +7 -7
  352. package/coverage/lcov.info +2581 -3278
  353. package/coverage/map/api/hooks/hooks.catalog.js.html +125 -29
  354. package/coverage/map/api/hooks/hooks.features.js.html +1 -1
  355. package/coverage/map/api/hooks/hooks.query.js.html +20 -44
  356. package/coverage/map/api/hooks/index.html +7 -7
  357. package/coverage/map/api/hooks/index.js.html +1 -1
  358. package/coverage/map/api/index.html +1 -1
  359. package/coverage/map/api/index.js.html +1 -1
  360. package/coverage/map/api/marshall.js.html +1 -1
  361. package/coverage/map/api/models/alerts.model.mongodb.js.html +1 -1
  362. package/coverage/map/api/models/catalog.model.mongodb.js.html +49 -7
  363. package/coverage/map/api/models/features.model.mongodb.js.html +1 -1
  364. package/coverage/map/api/models/index.html +22 -7
  365. package/coverage/map/api/models/projects.model.mongodb.js.html +1 -1
  366. package/coverage/map/api/models/styles.model.mongodb.js.html +112 -0
  367. package/coverage/map/api/services/alerts/alerts.hooks.js.html +1 -1
  368. package/coverage/map/api/services/alerts/alerts.service.js.html +1 -1
  369. package/coverage/map/api/services/alerts/index.html +1 -1
  370. package/coverage/map/api/services/catalog/catalog.hooks.js.html +29 -11
  371. package/coverage/map/api/services/catalog/index.html +5 -5
  372. package/coverage/map/api/services/daptiles/daptiles.service.js.html +1 -1
  373. package/coverage/map/api/services/daptiles/index.html +1 -1
  374. package/coverage/map/api/services/features/features.hooks.js.html +78 -9
  375. package/coverage/map/api/services/features/features.service.js.html +307 -4
  376. package/coverage/map/api/services/features/index.html +7 -7
  377. package/coverage/map/api/services/index.html +5 -5
  378. package/coverage/map/api/services/index.js.html +287 -50
  379. package/coverage/map/api/services/projects/index.html +1 -1
  380. package/coverage/map/api/services/projects/projects.hooks.js.html +1 -1
  381. package/coverage/map/api/services/styles/index.html +116 -0
  382. package/coverage/map/api/services/styles/styles.hooks.js.html +196 -0
  383. package/coverage/map/common/dynamic-grid-source.js.html +1 -1
  384. package/coverage/map/common/errors.js.html +1 -1
  385. package/coverage/map/common/geotiff-grid-source.js.html +8 -5
  386. package/coverage/map/common/grid.js.html +1 -1
  387. package/coverage/map/common/index.html +7 -7
  388. package/coverage/map/common/index.js.html +1 -1
  389. package/coverage/map/common/meteo-model-grid-source.js.html +1 -1
  390. package/coverage/map/common/moment-utils.js.html +1 -1
  391. package/coverage/map/common/opendap-grid-source.js.html +1 -1
  392. package/coverage/map/common/opendap-utils.js.html +1 -1
  393. package/coverage/map/common/permissions.js.html +10 -4
  394. package/coverage/map/common/time-based-grid-source.js.html +1 -1
  395. package/coverage/map/common/tms-utils.js.html +6 -6
  396. package/coverage/map/common/wcs-grid-source.js.html +3 -3
  397. package/coverage/map/common/wcs-utils.js.html +9 -9
  398. package/coverage/map/common/weacast-grid-source.js.html +1 -1
  399. package/coverage/map/common/wfs-utils.js.html +11 -11
  400. package/coverage/map/common/wms-utils.js.html +8 -8
  401. package/coverage/map/common/wmts-utils.js.html +7 -7
  402. package/coverage/tmp/coverage-323534-1747828879483-0.json +1 -0
  403. package/coverage/tmp/coverage-323546-1747828879453-0.json +1 -0
  404. package/coverage/tmp/coverage-323557-1747828879439-0.json +1 -0
  405. package/coverage/tmp/coverage-323569-1747828879416-0.json +1 -0
  406. package/coverage/tmp/coverage-323576-1747828879390-0.json +1 -0
  407. package/extras/configs/helpers.js +78 -0
  408. package/extras/configs/panes.left.js +118 -0
  409. package/extras/configs/panes.top.js +222 -0
  410. package/extras/configs/stickies.js +57 -0
  411. package/extras/configs/widgets.left.js +23 -0
  412. package/extras/configs/widgets.top.js +73 -0
  413. package/extras/css/core.variables.scss +8 -0
  414. package/extras/images/north.svg +3 -0
  415. package/extras/tours/map/side-nav.js +3 -3
  416. package/map/api/hooks/hooks.catalog.js +56 -23
  417. package/map/api/hooks/hooks.query.js +16 -24
  418. package/map/api/models/catalog.model.mongodb.js +16 -2
  419. package/{core/api/models/groups.model.mongodb.js → map/api/models/styles.model.mongodb.js} +2 -1
  420. package/map/api/services/catalog/catalog.hooks.js +13 -7
  421. package/map/api/services/features/features.hooks.js +28 -5
  422. package/map/api/services/features/features.service.js +101 -0
  423. package/map/api/services/index.js +125 -46
  424. package/map/api/services/styles/styles.hooks.js +37 -0
  425. package/map/client/cesium/utils/index.js +1 -0
  426. package/map/client/cesium/utils/utils.cesium.js +397 -0
  427. package/map/client/cesium/utils/utils.features.js +8 -0
  428. package/map/client/cesium/utils/utils.geojson.js +59 -0
  429. package/map/client/cesium/utils/utils.style.js +134 -17
  430. package/map/client/components/KEditLayerData.vue +17 -79
  431. package/map/client/components/KFeatureEditor.vue +2 -7
  432. package/map/client/components/KFeaturesChart.vue +2 -6
  433. package/map/client/components/KFeaturesFilterEditor.vue +300 -0
  434. package/map/client/components/KFeaturesFilterManager.vue +196 -0
  435. package/map/client/components/KFeaturesTable.vue +0 -5
  436. package/map/client/components/KFilterCondition.vue +303 -0
  437. package/map/client/components/KLayerEditionToolbar.vue +4 -3
  438. package/map/client/components/KLayerEditor.vue +451 -36
  439. package/map/client/components/KMeasureTool.vue +36 -9
  440. package/map/client/components/KProjectMenu.vue +14 -8
  441. package/map/client/components/catalog/KAddLayer.vue +0 -4
  442. package/map/client/components/catalog/KBaseLayersSelector.vue +42 -46
  443. package/map/client/components/catalog/KConnectLayer.vue +295 -291
  444. package/map/client/components/catalog/KCreateLayer.vue +141 -146
  445. package/map/client/components/catalog/KCreateOfflineView.vue +100 -0
  446. package/map/client/components/catalog/KCreateView.vue +2 -8
  447. package/map/client/components/catalog/KFilteredLayerItem.vue +72 -25
  448. package/map/client/components/catalog/KImportLayer.vue +121 -129
  449. package/map/client/components/catalog/KLayerItem.vue +44 -32
  450. package/map/client/components/catalog/KLayersPanel.vue +45 -17
  451. package/map/client/components/catalog/KLayersSelector.vue +51 -50
  452. package/map/client/components/catalog/KProjectManager.vue +4 -8
  453. package/map/client/components/catalog/KProjectSelector.vue +33 -2
  454. package/map/client/components/catalog/KProjectsPanel.vue +84 -106
  455. package/map/client/components/catalog/KSelectLayers.vue +56 -69
  456. package/map/client/components/catalog/KSelectViews.vue +56 -69
  457. package/map/client/components/catalog/KViewSelector.vue +32 -2
  458. package/map/client/components/catalog/KViewsPanel.vue +178 -110
  459. package/map/client/components/catalog/KWeatherLayersSelector.vue +77 -85
  460. package/map/client/components/form/KLocationField.vue +21 -2
  461. package/map/client/components/form/KOwsLayerField.vue +1 -1
  462. package/map/client/components/form/KOwsServiceField.vue +102 -63
  463. package/map/client/components/form/KSelectLayersField.vue +1 -1
  464. package/map/client/components/form/KSelectViewsField.vue +1 -1
  465. package/map/client/components/form/KTimezoneField.vue +0 -1
  466. package/map/client/components/legend/KLegend.vue +4 -4
  467. package/map/client/components/location/KLocationCardSection.vue +16 -0
  468. package/map/client/components/location/KLocationMap.vue +3 -2
  469. package/map/client/components/location/KLocationSearch.vue +46 -8
  470. package/map/client/components/location/KLocationTimeLineCard.vue +25 -3
  471. package/map/client/components/location/KLocationTip.vue +57 -10
  472. package/map/client/components/selection/KFeaturesSelection.vue +71 -0
  473. package/map/client/components/selection/KSelectedLayerFeatures.vue +343 -0
  474. package/map/client/components/{KAttribution.vue → stickies/KAttribution.vue} +39 -33
  475. package/map/client/components/stickies/KLevelSlider.vue +114 -0
  476. package/map/client/components/stickies/KNorthArrow.vue +26 -0
  477. package/map/client/components/stickies/KPosition.vue +103 -0
  478. package/map/client/components/stickies/KTarget.vue +34 -0
  479. package/map/client/components/styles/KLayerStyleAction.vue +58 -0
  480. package/map/client/components/styles/KStyleEditor.vue +273 -0
  481. package/map/client/components/styles/KStyleEditorSection.vue +79 -0
  482. package/map/client/components/styles/KStyleManager.vue +183 -0
  483. package/map/client/components/styles/KStylePreview.vue +64 -0
  484. package/map/client/components/styles/KStylePreviewItem.vue +68 -0
  485. package/map/client/components/styles/KStylePropertiesGroup.vue +76 -0
  486. package/map/client/components/styles/KStyleProperty.vue +136 -0
  487. package/map/client/components/styles/KStyleTip.vue +118 -0
  488. package/map/client/components/tools/KGeolocateTool.vue +3 -2
  489. package/map/client/components/tools/KSearchTool.vue +34 -6
  490. package/map/client/components/widget/KMapillaryViewer.vue +1 -1
  491. package/map/client/components/widget/KStackableTimeSeries.vue +8 -5
  492. package/map/client/composables/activity.js +29 -43
  493. package/map/client/composables/catalog.js +1 -1
  494. package/map/client/composables/highlight.js +117 -57
  495. package/map/client/composables/location.js +33 -14
  496. package/map/client/composables/project.js +9 -10
  497. package/map/client/composables/selection.js +136 -23
  498. package/map/client/geocoder.js +104 -0
  499. package/map/client/geolocation.js +1 -1
  500. package/map/client/globe.js +3 -0
  501. package/map/client/hooks/hooks.offline.js +95 -0
  502. package/map/client/hooks/index.js +1 -0
  503. package/map/client/i18n/map_en.json +159 -94
  504. package/map/client/i18n/map_fr.json +186 -127
  505. package/map/client/index.js +3 -0
  506. package/map/client/init.js +44 -8
  507. package/map/client/leaflet/BoxSelection.js +2 -2
  508. package/map/client/leaflet/GradientPath.js +84 -4
  509. package/map/client/leaflet/TiledFeatureLayer.js +2 -3
  510. package/map/client/leaflet/WindBarb.js +323 -0
  511. package/map/client/leaflet/utils/index.js +1 -0
  512. package/map/client/leaflet/utils/utils.events.js +8 -3
  513. package/map/client/leaflet/utils/utils.geojson.js +221 -0
  514. package/map/client/leaflet/utils/utils.style.js +10 -9
  515. package/map/client/map.js +3 -0
  516. package/map/client/mixins/globe/mixin.base-globe.js +151 -19
  517. package/map/client/mixins/globe/mixin.geojson-layers.js +208 -86
  518. package/map/client/mixins/globe/mixin.popup.js +3 -2
  519. package/map/client/mixins/globe/mixin.style.js +3 -1
  520. package/map/client/mixins/globe/mixin.tooltip.js +3 -2
  521. package/map/client/mixins/map/index.js +1 -3
  522. package/map/client/mixins/map/mixin.base-map.js +267 -79
  523. package/map/client/mixins/map/mixin.canvas-layers.js +44 -10
  524. package/map/client/mixins/map/mixin.edit-layers.js +142 -57
  525. package/map/client/mixins/map/mixin.geojson-layers.js +129 -205
  526. package/map/client/mixins/map/mixin.pmtiles-layers.js +24 -11
  527. package/map/client/mixins/map/mixin.tiled-mesh-layers.js +1 -2
  528. package/map/client/mixins/map/mixin.tiled-wind-layers.js +2 -1
  529. package/map/client/mixins/mixin.activity.js +61 -41
  530. package/map/client/mixins/mixin.context.js +19 -14
  531. package/map/client/mixins/mixin.feature-selection.js +0 -1
  532. package/map/client/mixins/mixin.feature-service.js +41 -59
  533. package/map/client/mixins/mixin.weacast.js +1 -1
  534. package/map/client/navigator.js +38 -0
  535. package/map/client/pixi-utils.js +1 -1
  536. package/map/client/planets.js +1 -1
  537. package/map/client/readers/reader.kml.js +57 -1
  538. package/map/client/utils/index.js +1 -0
  539. package/map/client/utils/utils.capture.js +10 -7
  540. package/map/client/utils/utils.catalog.js +2 -2
  541. package/map/client/utils/utils.features.js +193 -39
  542. package/map/client/utils/utils.js +8 -19
  543. package/map/client/utils/utils.layers.js +381 -4
  544. package/map/client/utils/utils.location.js +39 -74
  545. package/map/client/utils/utils.offline.js +89 -0
  546. package/map/client/utils/utils.style.js +133 -80
  547. package/map/client/utils/utils.time-series.js +99 -25
  548. package/map/common/geotiff-grid-source.js +2 -1
  549. package/map/common/permissions.js +2 -0
  550. package/map/common/schemas/capture.create.json +4 -4
  551. package/map/common/schemas/catalog.update.json +18 -2
  552. package/map/common/schemas/projects.create.json +2 -2
  553. package/map/common/schemas/projects.update.json +2 -2
  554. package/map/common/tms-utils.js +5 -5
  555. package/map/common/wcs-grid-source.js +2 -2
  556. package/map/common/wcs-utils.js +8 -8
  557. package/map/common/wfs-utils.js +10 -10
  558. package/map/common/wms-utils.js +7 -7
  559. package/map/common/wmts-utils.js +6 -6
  560. package/package.json +7 -4
  561. package/test/api/core/account.test.js +0 -72
  562. package/test/api/core/authentication.test.js +184 -0
  563. package/test/api/core/config/default.cjs +1 -3
  564. package/test/api/core/index.test.js +33 -96
  565. package/test/api/core/offline.test.js +55 -0
  566. package/test/api/core/push.test.js +3 -3
  567. package/test/api/core/{test-log-2024-06-06.log → test-log-2025-02-05.log} +3 -3
  568. package/test/api/core/{test-log-2024-11-15.log → test-log-2025-05-21.log} +1 -9
  569. package/test/api/map/alerts.test.js +1 -1
  570. package/test/api/map/config/default.cjs +2 -1
  571. package/test/api/map/data/vigicrues.observations.Q.json +47042 -0
  572. package/test/api/map/index.test.js +113 -9
  573. package/test/api/map/style.test.js +62 -0
  574. package/test/client/core/layout.js +2 -2
  575. package/test/client/core/runner.js +1 -1
  576. package/test/client/core/utils.js +52 -0
  577. package/test/client/map/catalog.js +1 -0
  578. package/core/api/hooks/hooks.groups.js +0 -48
  579. package/core/api/hooks/hooks.organisations.js +0 -152
  580. package/core/api/models/organisations.model.mongodb.js +0 -3
  581. package/core/api/models/tags.model.mongodb.js +0 -10
  582. package/core/api/services/groups/groups.hooks.js +0 -31
  583. package/core/api/services/organisations/organisations.hooks.js +0 -31
  584. package/core/api/services/organisations/organisations.service.js +0 -86
  585. package/core/api/services/tags/tags.hooks.js +0 -31
  586. package/core/api/utils.js +0 -11
  587. package/core/client/components/KChipsPane.vue +0 -103
  588. package/core/client/components/document/index.js +0 -9
  589. package/core/client/components/team/KAddMember.vue +0 -378
  590. package/core/client/components/team/KAddTag.vue +0 -121
  591. package/core/client/components/team/KChangeRole.vue +0 -118
  592. package/core/client/components/team/KGroupCard.vue +0 -110
  593. package/core/client/components/team/KGroupsActivity.vue +0 -78
  594. package/core/client/components/team/KJoinGroup.vue +0 -132
  595. package/core/client/components/team/KMemberCard.vue +0 -328
  596. package/core/client/components/team/KMemberFilter.vue +0 -49
  597. package/core/client/components/team/KMembersActivity.vue +0 -136
  598. package/core/client/components/team/KOrganisationsActivity.vue +0 -51
  599. package/core/client/components/team/KTagCard.vue +0 -72
  600. package/core/client/components/team/KTagsActivity.vue +0 -73
  601. package/core/client/components/team/index.js +0 -9
  602. package/core/client/mixins/mixin.base-context.js +0 -54
  603. package/core/client/utils/utils.platform.js +0 -12
  604. package/core/common/schemas/groups.create.json +0 -28
  605. package/core/common/schemas/groups.update.json +0 -28
  606. package/core/common/schemas/organisations.create.json +0 -28
  607. package/core/common/schemas/organisations.update.json +0 -49
  608. package/core/common/schemas/tags.create.json +0 -35
  609. package/core/common/schemas/tags.update.json +0 -35
  610. package/coverage/tmp/coverage-280506-1731704745613-0.json +0 -1
  611. package/coverage/tmp/coverage-280518-1731704745599-0.json +0 -1
  612. package/coverage/tmp/coverage-280529-1731704745588-0.json +0 -1
  613. package/coverage/tmp/coverage-280541-1731704745574-0.json +0 -1
  614. package/coverage/tmp/coverage-280548-1731704745545-0.json +0 -1
  615. package/map/client/components/KFeaturesFilter.vue +0 -259
  616. package/map/client/components/KLayerStyleEditor.vue +0 -118
  617. package/map/client/components/KLayerStyleForm.vue +0 -740
  618. package/map/client/components/KLevelSlider.vue +0 -100
  619. package/map/client/components/KNorth.vue +0 -31
  620. package/map/client/components/KPositionIndicator.vue +0 -83
  621. package/map/client/components/catalog/KCreateProject.vue +0 -100
  622. package/map/client/mixins/map/mixin.forecast-layers.js +0 -81
  623. package/map/client/mixins/map/mixin.georaster-layers.js +0 -107
  624. package/test/api/core/team.test.js +0 -670
  625. package/test/api/core/test-log-2023-12-19.log +0 -7
  626. package/test/api/core/test-log-2024-01-04.log +0 -14
  627. package/test/api/core/test-log-2024-05-14.log +0 -6
  628. package/test/api/core/test-log-2024-06-26.log +0 -25
  629. package/test/api/core/test-log-2024-06-28.log +0 -2
  630. package/test/api/core/test-log-2024-07-09.log +0 -0
  631. package/test/api/core/test-log-2024-08-13.log +0 -69
  632. package/test/api/core/test-log-2024-10-28.log +0 -53
  633. package/test/api/core/test-log-2024-11-05.log +0 -30
  634. package/test/api/map/test-log-2023-11-24.log +0 -121
  635. package/test/api/map/test-log-2023-12-12.log +0 -29
  636. package/test/api/map/test-log-2023-12-13.log +0 -5
  637. package/test/api/map/test-log-2024-01-04.log +0 -2
  638. package/test/api/map/test-log-2024-01-11.log +0 -1
  639. package/test/api/map/test-log-2024-01-25.log +0 -19
  640. package/test/api/map/test-log-2024-06-06.log +0 -39
  641. package/test/api/map/test-log-2024-08-13.log +0 -13
  642. package/test/api/map/test-log-2024-08-20.log +0 -55
  643. package/test/api/map/test-log-2024-09-09.log +0 -92
  644. package/test/api/map/test-log-2024-10-28.log +0 -11
  645. /package/extras/{logos → images}/kalisio.png +0 -0
  646. /package/extras/{icons → images}/target.svg +0 -0
  647. /package/test/api/map/data/{vigicrues.observations.json → vigicrues.observations.H.json} +0 -0
@@ -1,3 +1,5 @@
1
+ import _ from 'lodash'
2
+
1
3
  // We need to dynamically import cesium to dynamically get constructors
2
4
  export let Cesium
3
5
 
@@ -6,3 +8,398 @@ async function loadCesium() {
6
8
  }
7
9
 
8
10
  loadCesium()
11
+
12
+ function createWallGeometry (positions, minimumHeights = [], maximumHeights = []) {
13
+ if (!positions || positions.length < 2) return
14
+
15
+ minimumHeights = minimumHeights || Array(positions.length).fill(0)
16
+ minimumHeights = Array.isArray(minimumHeights) ? minimumHeights : Array(positions.length).fill(minimumHeights)
17
+ if (!maximumHeights) {
18
+ maximumHeights = []
19
+ for (let i = 0, j = positions.length; i < j; ++i) {
20
+ const cartographic = Cesium.Cartographic.fromCartesian(positions[i])
21
+ maximumHeights.push(cartographic.height)
22
+ }
23
+ }
24
+ maximumHeights = Array.isArray(maximumHeights) ? maximumHeights : Array(positions.length).fill(maximumHeights)
25
+
26
+ const setHeight = (cartesian, height) => {
27
+ const cartographic = Cesium.Cartographic.fromCartesian(cartesian)
28
+ cartographic.height = height
29
+ return Cesium.Cartographic.toCartesian(cartographic)
30
+ }
31
+
32
+ // Generate positions and st
33
+ const indices = []
34
+ const distances = [0]
35
+ const times = (positions.length - 1) * 2
36
+ let lineLength = 0
37
+ let minHeight = -1
38
+ for (let i = 0; i < times; i++) {
39
+ if (i % 2) {
40
+ indices.push(i + 2, i - 1, i + 1)
41
+ } else {
42
+ indices.push(i + 1, i, i + 3)
43
+ }
44
+
45
+ if (positions[i + 1]) {
46
+ const distance = Cesium.Cartesian3.distance(positions[i], positions[i + 1])
47
+ distances.push(distance)
48
+ lineLength += distance
49
+ }
50
+ }
51
+
52
+ let percent = 0
53
+ const st = []
54
+ const wallPositions = []
55
+ for (let i = 0; i < positions.length; i++) {
56
+ // St
57
+ percent += distances[i] / lineLength
58
+ if (i === positions.length - 1) percent = 1
59
+ st.push(1 - percent, 0, 1 - percent, 1)
60
+
61
+ // Positions
62
+ const position = positions[i]
63
+ const bottomPoint = setHeight(position, minimumHeights[i])
64
+ const topPoint = setHeight(position, maximumHeights[i])
65
+ wallPositions.push(
66
+ bottomPoint.x,
67
+ bottomPoint.y,
68
+ bottomPoint.z,
69
+ topPoint.x,
70
+ topPoint.y,
71
+ topPoint.z
72
+ )
73
+
74
+ // Min height
75
+ const currentHeight = Math.abs(maximumHeights[i] - minimumHeights[i])
76
+ if (minHeight === -1 || currentHeight < minHeight) minHeight = currentHeight
77
+ }
78
+
79
+ return {
80
+ geometry: new Cesium.Geometry({
81
+ attributes: {
82
+ position: new Cesium.GeometryAttribute({
83
+ componentDatatype: Cesium.ComponentDatatype.DOUBLE,
84
+ componentsPerAttribute: 3,
85
+ values: wallPositions
86
+ }),
87
+ st: new Cesium.GeometryAttribute({
88
+ componentDatatype: Cesium.ComponentDatatype.FLOAT,
89
+ componentsPerAttribute: 2,
90
+ values: new Float64Array(st)
91
+ })
92
+ },
93
+ indices: new Uint16Array(indices),
94
+ primitiveType: Cesium.PrimitiveType.TRIANGLES,
95
+ boundingSphere: Cesium.BoundingSphere.fromVertices(wallPositions)
96
+ }),
97
+ dimensions: {
98
+ minHeight,
99
+ lineLength
100
+ }
101
+ }
102
+ }
103
+
104
+ function createCorridorGeometry (positions, width, height) {
105
+ if (!positions || positions.length < 2) return
106
+
107
+ const setHeight = (cartesian, height) => {
108
+ const cartographic = Cesium.Cartographic.fromCartesian(cartesian)
109
+ cartographic.height = height
110
+ return Cesium.Cartographic.toCartesian(cartographic)
111
+ }
112
+
113
+ const angleBetweenThreePoints = (A, B, C) => {
114
+ const AB = Cesium.Cartesian3.subtract(B, A, new Cesium.Cartesian3())
115
+ const AC = Cesium.Cartesian3.subtract(C, A, new Cesium.Cartesian3())
116
+ const dot = Cesium.Cartesian3.dot(AB, AC)
117
+ const lengthAB = Cesium.Cartesian3.magnitude(AB)
118
+ const lengthAC = Cesium.Cartesian3.magnitude(AC)
119
+ return Math.acos(dot / (lengthAB * lengthAC))
120
+ }
121
+
122
+ const computeOffset = (current, previous, next, offset, normal) => {
123
+ let direction
124
+
125
+ if (!previous) {
126
+ // If it's the first point, use only the direction to the next
127
+ direction = Cesium.Cartesian3.subtract(next, current, new Cesium.Cartesian3())
128
+ } else if (!next) {
129
+ // If it's the last point, use only the direction from the previous
130
+ direction = Cesium.Cartesian3.subtract(current, previous, new Cesium.Cartesian3())
131
+ } else {
132
+ // Intermediate points: average of the directions before and after
133
+ const forward = Cesium.Cartesian3.subtract(next, current, new Cesium.Cartesian3())
134
+ const backward = Cesium.Cartesian3.subtract(current, previous, new Cesium.Cartesian3())
135
+ direction = Cesium.Cartesian3.add(forward, backward, new Cesium.Cartesian3())
136
+ }
137
+
138
+ Cesium.Cartesian3.normalize(direction, direction)
139
+
140
+ // Compute the perpendicular vector
141
+ const up = normal || Cesium.Cartesian3.UNIT_Z
142
+ const perpendicular = Cesium.Cartesian3.cross(direction, up, new Cesium.Cartesian3())
143
+ Cesium.Cartesian3.normalize(perpendicular, perpendicular)
144
+
145
+ // Apply the offset
146
+ const offsetVector = Cesium.Cartesian3.multiplyByScalar(perpendicular, offset, new Cesium.Cartesian3())
147
+ return { direction, position: Cesium.Cartesian3.add(current, offsetVector, new Cesium.Cartesian3()) }
148
+ }
149
+
150
+ for (let i = 0; i < positions.length; i++) {
151
+ positions[i] = setHeight(positions[i], height)
152
+ }
153
+
154
+ // Find local normal
155
+ // Implies that if the corridor extends over very large distances, the normal may be incorrect
156
+ const normal = Cesium.Ellipsoid.WGS84.geodeticSurfaceNormal(positions[0])
157
+ const distances = [0]
158
+ let lineLength = 0
159
+ const corridorPositions = []
160
+
161
+ let lastLeftPoint = null
162
+ let lastRightPoint = null
163
+ let lastDirection = null
164
+ for (let i = 0; i < positions.length; i++) {
165
+ // Compute the offset positions to create the corridor
166
+ const left = computeOffset(positions[i], positions[i - 1], positions[i + 1], -width / 2, normal)
167
+ const right = computeOffset(positions[i], positions[i - 1], positions[i + 1], width / 2, normal)
168
+
169
+ // Check if [left, right] segment intersects with the previous one
170
+ if (i > 0) {
171
+ const turnLeft = Cesium.Cartesian3.cross(left.direction, lastDirection, new Cesium.Cartesian3()).z < 0
172
+
173
+ const previousAngle = angleBetweenThreePoints(positions[i - 1], positions[i], turnLeft ? lastLeftPoint : lastRightPoint)
174
+ const currentAngle = angleBetweenThreePoints(positions[i - 1], positions[i], turnLeft ? left.position : right.position)
175
+ if (currentAngle > previousAngle) {
176
+ if (turnLeft) left.position = lastLeftPoint
177
+ else right.position = lastRightPoint
178
+ }
179
+
180
+ const distance = Cesium.Cartesian3.distance(positions[i - 1], positions[i])
181
+ distances.push(distance)
182
+ lineLength += distance
183
+ }
184
+
185
+ corridorPositions.push(
186
+ left.position.x,
187
+ left.position.y,
188
+ left.position.z,
189
+ right.position.x,
190
+ right.position.y,
191
+ right.position.z
192
+ )
193
+
194
+ lastLeftPoint = left.position
195
+ lastRightPoint = right.position
196
+ lastDirection = left.direction
197
+ }
198
+
199
+ let percent = 0
200
+ const st = []
201
+ const indices = []
202
+ for (let i = 0; i < positions.length; i++) {
203
+ // Normalize distances for texture coordinates
204
+ percent += distances[i] / lineLength
205
+ if (i === positions.length - 1) percent = 1
206
+ st.push(1 - percent, 0, 1 - percent, 1)
207
+
208
+ // Add indices for triangulation
209
+ if (i < positions.length - 1) {
210
+ const baseIndex = i * 2
211
+ indices.push(
212
+ baseIndex, baseIndex + 1, baseIndex + 2,
213
+ baseIndex + 1, baseIndex + 3, baseIndex + 2
214
+ )
215
+ }
216
+ }
217
+
218
+ return {
219
+ geometry: new Cesium.Geometry({
220
+ attributes: {
221
+ position: new Cesium.GeometryAttribute({
222
+ componentDatatype: Cesium.ComponentDatatype.DOUBLE,
223
+ componentsPerAttribute: 3,
224
+ values: corridorPositions
225
+ }),
226
+ st: new Cesium.GeometryAttribute({
227
+ componentDatatype: Cesium.ComponentDatatype.FLOAT,
228
+ componentsPerAttribute: 2,
229
+ values: new Float64Array(st)
230
+ })
231
+ },
232
+ indices: new Uint16Array(indices),
233
+ primitiveType: Cesium.PrimitiveType.TRIANGLES,
234
+ boundingSphere: Cesium.BoundingSphere.fromVertices(corridorPositions)
235
+ }),
236
+ dimensions: {
237
+ lineLength,
238
+ width
239
+ }
240
+ }
241
+ }
242
+
243
+ function createMaterialWithMovingTexture (options) {
244
+ if (!options.image) return
245
+
246
+ let material = null
247
+ try {
248
+ // TODO : temporary throw to avoid to load material from type because it's not working
249
+ material = Cesium.Material.fromType('MovingMaterial')
250
+ material.uniforms.image = options.image
251
+ material.uniforms.repeat = new Cesium.Cartesian2(1.0, 1.0)
252
+ material.uniforms.offset = new Cesium.Cartesian2(0.0, 0.0)
253
+ material.translucent = options.translucent
254
+ throw new Error('Load material from type is not working')
255
+ } catch (e) {
256
+ const shaderSource = `
257
+ czm_material czm_getMaterial(czm_materialInput materialInput) {
258
+ czm_material material = czm_getDefaultMaterial(materialInput);
259
+
260
+ vec2 st = materialInput.st * repeat + offset;
261
+
262
+ // Loop texture with fract
263
+ st = fract(st);
264
+
265
+ vec4 color = texture(image, st);
266
+ material.${options.useAsDiffuse ? 'diffuse' : 'emission'} = color.rgb;
267
+ material.alpha = color.a;
268
+ return material;
269
+ }`
270
+
271
+ material = new Cesium.Material({
272
+ fabric: {
273
+ type: 'MovingMaterial',
274
+ source: shaderSource,
275
+ uniforms: {
276
+ image: options.image,
277
+ repeat: new Cesium.Cartesian2(1.0, 1.0),
278
+ offset: new Cesium.Cartesian2(0.0, 0.0)
279
+ }
280
+ },
281
+ translucent: _.get(options, 'translucent', false)
282
+ })
283
+ }
284
+
285
+ return material
286
+ }
287
+
288
+ export function createPrimitiveWithMovingTexture (type, options) {
289
+ if (!options.positions || !_.get(options, 'material.image', false)) return
290
+
291
+ const geometryOptions = {
292
+ positions: options.material.reverseAnimation === true ? options.positions.reverse() : options.positions
293
+ }
294
+
295
+ let geometry = null
296
+ switch (type) {
297
+ case 'wall':
298
+ geometryOptions.minimumHeights = _.get(options, 'minimumHeights', 0) // can be a single value
299
+ geometryOptions.maximumHeights = _.get(options, 'maximumHeights', null) // can be a single value
300
+ geometry = createWallGeometry(geometryOptions.positions, geometryOptions.minimumHeights, geometryOptions.maximumHeights)
301
+ break
302
+ case 'corridor':
303
+ geometryOptions.width = _.get(options, 'width', 10)
304
+ geometryOptions.height = _.get(options, 'height', 0)
305
+ geometry = createCorridorGeometry(geometryOptions.positions, geometryOptions.width, geometryOptions.height)
306
+ break
307
+ default:
308
+ break
309
+ }
310
+
311
+ if (!geometry) return
312
+ const dimensions = geometry.dimensions
313
+ geometry = geometry.geometry
314
+
315
+ // Create material
316
+ const material = createMaterialWithMovingTexture(_.get(options, 'material'))
317
+ if (!material) return
318
+
319
+ // By default, whole texture is mapped on the whole wall/corridor geometry
320
+ // Here we make it so texture keep it's aspect ratio, map 1 in the non animated
321
+ // direction, compute what goes in the other dimension
322
+ material.uniforms.repeat.x = dimensions.lineLength / (dimensions.minHeight || dimensions.width)
323
+ // Take potential scale into account
324
+ const scale = _.get(options, 'material.scale')
325
+ let animationSpeedScale = 1.0
326
+ if (scale) {
327
+ if (Array.isArray(scale)) {
328
+ material.uniforms.repeat.x *= scale[0]
329
+ material.uniforms.repeat.y *= scale[1]
330
+ animationSpeedScale = scale[0]
331
+ } else {
332
+ material.uniforms.repeat.x *= scale
333
+ material.uniforms.repeat.y *= scale
334
+ animationSpeedScale = scale
335
+ }
336
+ }
337
+
338
+ // Create primitive
339
+ return {
340
+ primitive: new Cesium.Primitive({
341
+ geometryInstances: new Cesium.GeometryInstance({
342
+ geometry
343
+ }),
344
+ appearance: new Cesium.MaterialAppearance({
345
+ material,
346
+ translucent: material.translucent
347
+ }),
348
+ asynchronous: false
349
+ }),
350
+ material: {
351
+ material,
352
+ animationSpeed: _.get(options, 'material.animationSpeed') * animationSpeedScale,
353
+ length: dimensions.lineLength
354
+ }
355
+ }
356
+ }
357
+
358
+ export function findPrimitiveForEntity (entity, viewer) {
359
+ const deepSearch = function (object, id, ids = []) {
360
+ if (object._id) {
361
+ if (object._id._id === id) return object
362
+ return null
363
+ }
364
+ if (object._guid) {
365
+ if (ids.includes(object._guid)) {
366
+ return null
367
+ }
368
+ ids.push(object._guid)
369
+ }
370
+ if (object._external) {
371
+ return deepSearch(object._external, id, ids)
372
+ }
373
+ if (object.collection) {
374
+ return deepSearch(object.collection, id, ids)
375
+ }
376
+
377
+ if (object._composites) {
378
+ for (const k in object._composites) {
379
+ const primitive = deepSearch(object._composites[k], id, ids)
380
+ if (primitive) return primitive
381
+ }
382
+ }
383
+
384
+ if (object._primitives) {
385
+ for (const o of object._primitives) {
386
+ if (o._guid) {
387
+ if (ids.includes(o._guid)) {
388
+ continue
389
+ }
390
+ ids.push(o._guid)
391
+ }
392
+ const primitive = deepSearch(o, id, ids)
393
+ if (primitive) return primitive
394
+ }
395
+ }
396
+ }
397
+
398
+ const primitives = viewer.scene.primitives
399
+ for (let i = 0; i < primitives.length; i++) {
400
+ const out = deepSearch(primitives.get(i), entity.id)
401
+ if (out) return out
402
+ }
403
+
404
+ return null
405
+ }
@@ -2,6 +2,14 @@ import { kml } from '@tmcw/togeojson'
2
2
  import { exportKml } from 'cesium'
3
3
 
4
4
  export async function convertEntitiesToGeoJson(entities) {
5
+ const features = []
6
+ if (entities.values.length === 0) return { type: 'FeatureCollection', features }
7
+ // As cesium does not we usually keep track of original feature associated with an entity
8
+ _.forEach(entities.values, entity => {
9
+ if (entity.feature) features.push(entity.feature)
10
+ })
11
+ if (features.length > 0) return { type: 'FeatureCollection', features }
12
+ // Otherwise try to export as KML then convert to GeoJson
5
13
  const kmlEntities = await exportKml({ entities, modelCallback: () => '' })
6
14
  const parser = new DOMParser()
7
15
  return kml(parser.parseFromString(kmlEntities.kml, 'application/xml'))
@@ -0,0 +1,59 @@
1
+ import _ from 'lodash'
2
+
3
+ export const GeoJsonCesiumLayerFilters = {
4
+ // Filter to identify layers that require an update at a given frequency
5
+ TimeUpdate: {
6
+ // Possible for realtime layers only
7
+ 'cesium.type': 'geoJson',
8
+ 'cesium.realtime': true,
9
+ $or: [ // Supported by template URL or time-based features service
10
+ { 'cesium.sourceTemplate': { $exists: true } },
11
+ { service: { $exists: true } }
12
+ ],
13
+ // Skip layers powered by realtime service events
14
+ serviceEvents: { $ne: true },
15
+ // Skip invisible layers
16
+ isVisible: true
17
+ },
18
+ // Filter to identify layers with variables affected by a unit change
19
+ UnitUpdate: {
20
+ 'cesium.type': 'geoJson',
21
+ 'cesium.realtime': true,
22
+ // Not sure why but this does not seem to work with sift
23
+ //'variables': { $elemMatch: { unit: { $in: units } } },
24
+ 'variables': { $exists: true },
25
+ isVisible: true,
26
+ $or: [{
27
+ 'cesium.style': { $exists: true },
28
+ 'cesium.template': { $exists: true }
29
+ }, {
30
+ 'cesium.tooltip.template': { $exists: true }
31
+ }]
32
+ }
33
+ }
34
+
35
+ export function updateCesiumGeoJsonEntity (source, destination) {
36
+ destination.position = source.position
37
+ destination.orientation = source.orientation
38
+ destination.properties = source.properties
39
+ destination.description = source.description
40
+ // Points
41
+ if (source.billboard) destination.billboard = source.billboard
42
+ // Lines
43
+ if (source.polyline) destination.polyline = source.polyline
44
+ // Polygons
45
+ if (source.polygon) destination.polygon = source.polygon
46
+ }
47
+
48
+ export function hasUnitInCesiumLayerTemplate(units, layer) {
49
+ const unit = _.intersection(units, _.map(layer.variables, 'unit'))
50
+ if (_.isEmpty(unit)) return false
51
+ if (_.get(layer, 'cesium.tooltip.template', '').includes('Units')) return true
52
+ for (const template of layer.cesium.template) {
53
+ if (template.startsWith('style.')) {
54
+ const style = _.get(layer.cesium, template)
55
+ if ((typeof style === 'string') && style.includes('Units')) return true
56
+ }
57
+ }
58
+ return false
59
+ }
@@ -2,7 +2,8 @@ import _ from 'lodash'
2
2
  import chroma from 'chroma-js'
3
3
  import moment from 'moment'
4
4
  import { Color } from 'cesium'
5
- import { Time, Units, TemplateContext } from '../../../../core/client/index.js'
5
+ import { Time, Units, TemplateContext, utils as kdkCoreUtils } from '../../../../core/client/index.js'
6
+ import { getFeatureStyleType } from '../../utils/utils.features.js'
6
7
  import { convertPointStyleToSimpleStyle, convertLineStyleToSimpleStyle, convertPolygonStyleToSimpleStyle, convertSimpleStyleColors,
7
8
  convertSimpleStyleToPointStyle, convertSimpleStyleToLineStyle, convertSimpleStyleToPolygonStyle,
8
9
  PointStyleTemplateMappings, LineStyleTemplateMappings, PolygonStyleTemplateMappings } from '../../utils/utils.style.js'
@@ -11,7 +12,7 @@ import { Cesium } from './utils.cesium.js'
11
12
  export const CesiumStyleMappings = {
12
13
  stroke: 'stroke',
13
14
  'stroke-color': 'stroke',
14
- 'stroke-opaciy': 'stroke.alpha',
15
+ 'stroke-opacity': 'stroke.alpha',
15
16
  'stroke-width': 'strokeWidth',
16
17
  fill: 'fill',
17
18
  'fill-color': 'fill',
@@ -25,20 +26,132 @@ export const CesiumStyleOptions = _.values(CesiumStyleMappings)
25
26
  export const CesiumEntityTypes = ['billboard', 'box', 'corridor', 'cylinder', 'ellipse', 'ellipsoid',
26
27
  'label', 'model', 'path', 'plane', 'point', 'polygon', 'polyline', 'rectangle', 'wall']
27
28
 
29
+ const GeoJsonGeometryTypesToCesiumEntityMappings = {
30
+ Point: 'point',
31
+ LineString: 'polyline',
32
+ Polygon: 'polygon'
33
+ }
34
+
35
+ const StyleToCesiumEntityStyleMappings = {
36
+ altitudeMode: 'heightReference',
37
+ width: 'width',
38
+ color: 'material'
39
+ }
40
+
41
+ const AltitudeModesMappings = {
42
+ clampToGround: 'Cesium.HeightReference.CLAMP_TO_GROUND',
43
+ relativeToGround: 'Cesium.HeightReference.RELATIVE_TO_GROUND',
44
+ absolute: 'Cesium.HeightReference.NONE'
45
+ }
46
+
28
47
  export function convertToCesiumFromSimpleStyle (style, inPlace) {
29
48
  if (!style) return {}
30
49
  const convertedStyle = (inPlace ? style : {})
31
50
  _.forOwn(style, (value, key) => {
32
51
  if (_.has(CesiumStyleMappings, key)) {
33
52
  const mapping = _.get(CesiumStyleMappings, key)
34
- _.set(convertedStyle, mapping, value)
35
- if (inPlace) _.unset(style, key)
36
53
  // Convert from string to color object as required by cesium
37
54
  if ((typeof value === 'string') && ['markerColor', 'fill', 'stroke'].includes(mapping)) {
38
- _.set(convertedStyle, mapping, Color.fromCssColorString(value))
55
+ value = kdkCoreUtils.getHtmlColor(value)
56
+ _.set(convertedStyle, mapping, Color.fromCssColorString(chroma(value).alpha(_.get(convertedStyle, [mapping, 'alpha'], 1)).css()))
57
+ } else {
58
+ _.set(convertedStyle, mapping, value)
59
+ }
60
+ if (inPlace) _.unset(style, key)
61
+ }
62
+ })
63
+ return convertedStyle
64
+ }
65
+
66
+ export function convertToCesiumFromStyle (feature, options) {
67
+ let style = _.get(feature, 'style', false)
68
+ if (!style || !_.get(feature, 'geometry')) return {}
69
+
70
+ let geometryType = _.get(GeoJsonGeometryTypesToCesiumEntityMappings, _.get(feature, 'geometry.type'))
71
+ if (!geometryType) return {}
72
+
73
+ const kdkStyle = geometryType === 'point'
74
+ ? convertSimpleStyleToPointStyle(feature.properties)
75
+ : geometryType === 'polyline'
76
+ ? convertSimpleStyleToLineStyle(feature.properties)
77
+ : convertSimpleStyleToPolygonStyle(feature.properties)
78
+ style = Object.assign({}, style, kdkStyle)
79
+
80
+ const convertedStyle = {}
81
+
82
+ const entityStyle = {}
83
+
84
+ // Check for options to apply to all features
85
+ if (_.get(options, 'cesium.minZoom') || _.get(options, 'cesium.maxZoom')) {
86
+ entityStyle.distanceDisplayCondition = {
87
+ type: 'Cesium.DistanceDisplayCondition',
88
+ options: [
89
+ _.get(options, 'cesium.minZoom', 0) || 0,
90
+ _.get(options, 'cesium.maxZoom', Number.MAX_VALUE) || Number.MAX_VALUE]
91
+ }
92
+ }
93
+
94
+ _.forOwn(style, (value, key) => {
95
+ if ((typeof value === 'string') && ['color'].includes(key)) {
96
+ let cesiumColor = Color.fromCssColorString(kdkCoreUtils.getColorFromPalette(value))
97
+
98
+ if (_.has(style, 'opacity')) {
99
+ cesiumColor = Color.fromAlpha(cesiumColor, _.get(style, 'opacity'))
39
100
  }
101
+ _.set(entityStyle, _.get(StyleToCesiumEntityStyleMappings, key), cesiumColor)
102
+ } else if (key === 'altitudeMode') {
103
+ _.set(entityStyle, _.get(StyleToCesiumEntityStyleMappings, key), _.get(AltitudeModesMappings, value))
104
+ // Clamp to ground is used by polylines
105
+ _.set(entityStyle, 'clampToGround', value === 'clampToGround')
106
+ } else if (key === 'extrude') {
107
+ switch (geometryType) {
108
+ case 'polygon':
109
+ // Extrude from ellipsoid to point height
110
+ _.set(entityStyle, 'extrudedHeight', 0)
111
+ _.set(entityStyle, 'perPositionHeight', true)
112
+ break
113
+ case 'polyline':
114
+ // Convert polyline to wall if extruded
115
+ geometryType = 'wall'
116
+ break
117
+ }
118
+ } else if (key === 'icon') {
119
+ // Convert to billboard if entity has an icon
120
+ geometryType = 'billboard'
121
+ _.set(entityStyle, 'image', _.get(value, 'url'))
122
+ } else {
123
+ const target = _.get(StyleToCesiumEntityStyleMappings, key)
124
+ if (target) _.set(entityStyle, target, value)
40
125
  }
41
126
  })
127
+
128
+ if (geometryType === 'polygon' && !_.has(style, 'extrude') && (!_.has(style, 'altitudeMode') || style.altitudeMode === 'clampToGround')) {
129
+ // Force perPositionHeight to false, for clamped to ground polygons
130
+ _.set(entityStyle, 'perPositionHeight', false)
131
+
132
+ // Force altitude to 0.0 for clamped to ground polygons
133
+ if (_.get(feature, 'geometry.coordinates[0][0]', []).length < 3) {
134
+ _.forEach(_.get(feature, 'geometry.coordinates', []), (coordinates, index) => {
135
+ feature.geometry.coordinates[index] = _.map(coordinates, (coord) => {
136
+ return [coord[0], coord[1], 0.0]
137
+ })
138
+ })
139
+ }
140
+
141
+ // Cesium does not support outlines for clamped to ground polygons, so we convert them to polylines
142
+ // In the case of a clamped to ground filled polygon with outline, the outline will not display
143
+ if (_.get(style, 'opacity') === 0) {
144
+ geometryType = 'polyline'
145
+ _.set(convertedStyle, 'geometry.type', 'LineString')
146
+ _.set(convertedStyle, 'geometry.coordinates', _.get(feature, 'geometry.coordinates[0]'))
147
+ _.set(convertedStyle, 'style.opacity', _.get(style, 'stroke.opacity', 1))
148
+ _.set(entityStyle, 'clampToGround', true)
149
+ }
150
+ }
151
+
152
+ _.set(convertedStyle, ['properties', 'entityStyle', geometryType], entityStyle)
153
+ _.defaults(convertedStyle.properties.entityStyle, _.get(feature, 'properties.entityStyle', {}))
154
+
42
155
  return convertedStyle
43
156
  }
44
157
 
@@ -51,16 +164,20 @@ function processStyle (style, feature, options, mappings) {
51
164
  if (cesiumOptions.template) {
52
165
  // Create the map of variables
53
166
  if (options.variables) context.variables = _.reduce(options.variables,
54
- (result, variable) => Object.assign(result, { [variable.name]: variable }), {})
167
+ (result, variable) => Object.assign(result, { [variable.name]: variable }), {})
55
168
  cesiumOptions.template.forEach(entry => {
56
169
  _.set(style, _.get(mappings, _.kebabCase(entry.property), entry.property), entry.compiler(context))
57
170
  })
58
171
  }
59
172
 
173
+ // FIXME: type may be incorrect for walls or corridors
174
+ // since their geometries are lines, but they are rendered as polygons
175
+ const type = getFeatureStyleType(feature)
176
+
60
177
  // visibility attribute can be used to hide individual features
61
178
  // visibility is true by default but can also be a string when it's
62
- // a result of a lodash steing template evaluation
63
- let visibility = _.get(style, 'style.visibility', true)
179
+ // a result of a lodash string template evaluation
180
+ let visibility = _.get(style, `style.${type}.visibility`, _.get(style, 'style.visibility', true))
64
181
  if (typeof visibility === 'string') visibility = visibility === 'true'
65
182
  // The 'kdk-hidden-features' pane is created when the leaflet map is initialized
66
183
  // if (!visibility) _.set(style, `style.${type}.pane`, 'kdk-hidden-features')
@@ -71,27 +188,27 @@ function processStyle (style, feature, options, mappings) {
71
188
  export function getPointSimpleStyle (feature, options, engine, engineStylePath = 'style.point') {
72
189
  const engineStyle = _.get(engine, engineStylePath, {})
73
190
  const layerStyle = options ? _.get(options.cesium || options, 'layerPointStyle') : {}
74
- const featureStyle = feature.style ? _.get(feature, 'style', {}) : convertSimpleStyleToPointStyle(feature.properties)
75
- const style = _.merge({}, engineStyle, layerStyle, featureStyle)
76
- processStyle({ style: { point: style } }, feature, options, PointStyleTemplateMappings)
191
+ const templateStyle = processStyle({ style: { point: _.merge({}, engineStyle, layerStyle) } }, feature, options, PointStyleTemplateMappings)
192
+ const featureStyle = _.get(feature, 'style', {})
193
+ const style = _.merge({}, engineStyle, layerStyle, templateStyle ? templateStyle.style.point : {}, featureStyle)
77
194
  return convertSimpleStyleColors(convertPointStyleToSimpleStyle(style))
78
195
  }
79
196
 
80
197
  export function getLineSimpleStyle (feature, options, engine, engineStylePath = 'style.line') {
81
198
  const engineStyle = _.get(engine, engineStylePath, {})
82
199
  const layerStyle = options ? _.get(options.cesium || options, 'layerLineStyle') : {}
83
- const featureStyle = feature.style ? _.get(feature, 'style', {}) : convertSimpleStyleToLineStyle(feature.properties)
84
- const style = _.merge({}, engineStyle, layerStyle, featureStyle)
85
- processStyle({ style: { line: style } }, feature, options, LineStyleTemplateMappings)
200
+ const templateStyle = processStyle({ style: { line: _.merge({}, engineStyle, layerStyle) } }, feature, options, LineStyleTemplateMappings)
201
+ const featureStyle = _.get(feature, 'style', {})
202
+ const style = _.merge({}, engineStyle, layerStyle, templateStyle ? templateStyle.style.line : {}, featureStyle)
86
203
  return convertSimpleStyleColors(convertLineStyleToSimpleStyle(style))
87
204
  }
88
205
 
89
206
  export function getPolygonSimpleStyle (feature, options, engine, engineStylePath = 'style.polygon') {
90
207
  const engineStyle = _.get(engine, engineStylePath, {})
91
208
  const layerStyle = options ? _.get(options.cesium || options, 'layerPolygonStyle') : {}
92
- const featureStyle = feature.style ? _.get(feature, 'style', {}) : convertSimpleStyleToPolygonStyle(feature.properties)
93
- const style = _.merge({}, engineStyle, layerStyle, featureStyle)
94
- processStyle({ style: { polygon: style } }, feature, options, PolygonStyleTemplateMappings)
209
+ const templateStyle = processStyle({ style: { polygon: _.merge({}, engineStyle, layerStyle) } }, feature, options, PolygonStyleTemplateMappings)
210
+ const featureStyle = _.get(feature, 'style', {})
211
+ const style = _.merge({}, engineStyle, layerStyle, templateStyle ? templateStyle.style.polygon : {}, featureStyle)
95
212
  return convertSimpleStyleColors(convertPolygonStyleToSimpleStyle(style))
96
213
  }
97
214