@kalisio/kdk 2.4.1 → 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.
- package/core/api/application.js +12 -12
- package/core/api/authentication.js +51 -7
- package/core/api/hooks/hooks.authentication.js +1 -59
- package/core/api/hooks/hooks.authorisations.js +8 -102
- package/core/api/hooks/hooks.model.js +4 -0
- package/core/api/hooks/hooks.push.js +18 -14
- package/core/api/hooks/hooks.users.js +0 -91
- package/core/api/hooks/index.js +0 -2
- package/core/api/services/account/account.service.js +1 -1
- package/core/api/services/authorisations/authorisations.service.js +28 -29
- package/core/api/services/index.js +38 -50
- package/core/api/services/messages/messages.hooks.js +4 -3
- package/core/api/services/users/users.service.js +5 -0
- package/core/client/api.js +182 -71
- package/core/client/broadcaster.js +20 -0
- package/core/client/capabilities.js +17 -7
- package/core/client/components/KActivity.vue +29 -34
- package/core/client/components/KAvatar.vue +0 -6
- package/core/client/components/KChip.vue +142 -39
- package/core/client/components/KContent.vue +13 -32
- package/core/client/components/KDialog.vue +29 -8
- package/core/client/components/KEditor.vue +120 -0
- package/core/client/components/KFollower.vue +75 -0
- package/core/client/components/KLogo.vue +2 -3
- package/core/client/components/KModal.vue +30 -10
- package/core/client/components/KSponsor.vue +1 -1
- package/core/client/components/KTextArea.vue +2 -5
- package/core/client/components/account/KDeleteAccountManager.vue +1 -1
- package/core/client/components/account/KProfile.vue +52 -14
- package/core/client/components/account/KSubscription.vue +19 -9
- package/core/client/components/account/KSubscriptionsManager.vue +10 -11
- package/core/client/components/action/KAction.vue +44 -24
- package/core/client/components/action/KBugReportAction.vue +4 -5
- package/core/client/components/action/KToggleStickyVisibility.vue +41 -0
- package/core/client/components/action/KToggleWidgetVisibility.vue +41 -0
- package/core/client/components/app/KPlatform.vue +122 -35
- package/core/client/components/app/KRequestProgressBar.vue +59 -0
- package/core/client/components/app/KSettings.vue +13 -2
- package/core/client/components/app/KTour.vue +2 -2
- package/core/client/components/chart/KTimeSeriesChart.vue +11 -3
- package/core/client/components/collection/KCard.vue +27 -33
- package/core/client/components/collection/KCardSection.vue +3 -23
- package/core/client/components/collection/KColumn.vue +0 -5
- package/core/client/components/collection/KDescriptionCardSection.vue +10 -5
- package/core/client/components/collection/KFilterView.vue +15 -0
- package/core/client/components/collection/KGrid.vue +4 -9
- package/core/client/components/collection/KHistory.vue +0 -5
- package/core/client/components/collection/KHistoryEntry.vue +0 -2
- package/core/client/components/collection/KItem.vue +1 -2
- package/core/client/components/collection/KSearchFilterControl.vue +139 -0
- package/core/client/components/collection/KTable.vue +1 -4
- package/core/client/components/collection/KTagsFilterControl.vue +70 -0
- package/core/client/components/collection/KTagsFilterView.vue +61 -0
- package/core/client/components/collection/KTimeFilterControl.vue +40 -0
- package/core/client/components/collection/KTimeFilterView.vue +106 -0
- package/core/client/components/collection/KTimeLine.vue +18 -11
- package/core/client/components/document/KBrowser.vue +283 -0
- package/core/client/components/document/KCsv.vue +52 -0
- package/core/client/components/document/KDocument.vue +19 -5
- package/core/client/components/document/KImage.vue +50 -19
- package/core/client/components/document/KMarkdown.vue +10 -2
- package/core/client/components/document/KUploader.vue +126 -0
- package/core/client/components/document/KVideo.vue +39 -0
- package/core/client/components/form/KDateField.vue +70 -0
- package/core/client/components/form/KDateTimeRangeField.vue +6 -17
- package/core/client/components/form/KDatetimeField.vue +6 -13
- package/core/client/components/form/KForm.vue +8 -8
- package/core/client/components/form/KOptionsField.vue +2 -0
- package/core/client/components/form/KResolutionField.vue +54 -52
- package/core/client/components/form/KSelectField.vue +27 -13
- package/core/client/components/form/KTextareaField.vue +23 -5
- package/core/client/components/graphics/KIcon.vue +64 -0
- package/core/client/components/index.js +1 -3
- package/core/client/components/input/KColorPicker.vue +70 -0
- package/core/client/components/input/KIconPicker.vue +188 -0
- package/core/client/components/input/KShapePicker.vue +81 -0
- package/core/client/components/input/index.js +7 -1
- package/core/client/components/layout/KFab.vue +1 -1
- package/core/client/components/layout/KLayout.vue +14 -2
- package/core/client/components/layout/KOpener.vue +9 -11
- package/core/client/components/layout/KPage.vue +31 -17
- package/core/client/components/layout/KWindow.vue +34 -18
- package/core/client/components/menu/KMenu.vue +52 -36
- package/core/client/components/menu/KSubMenu.vue +105 -0
- package/core/client/components/messages/KMessageCard.vue +207 -0
- package/core/client/components/messages/KMessageComposer.vue +199 -0
- package/core/client/components/messages/KMessagesTimeLine.vue +137 -0
- package/core/client/components/messages/index.js +7 -0
- package/core/client/components/screen/KErrorScreen.vue +2 -3
- package/core/client/components/screen/KLogoutScreen.vue +3 -1
- package/core/client/components/screen/KOAuthLoginScreen.vue +15 -0
- package/core/client/components/screen/KOAuthLogoutScreen.vue +33 -0
- package/core/client/components/screen/KUnauthorizedScreen.vue +16 -0
- package/core/client/components/time/KAbsoluteTimeRange.vue +7 -14
- package/core/client/components/time/KDate.vue +55 -28
- package/core/client/components/time/KDateTime.vue +93 -37
- package/core/client/components/time/KDateTimeRange.vue +197 -52
- package/core/client/components/time/KTime.vue +55 -27
- package/core/client/composables/activity.js +40 -30
- package/core/client/composables/{counter.js → collection-counter.js} +2 -4
- package/core/client/composables/collection-filter.js +111 -0
- package/core/client/composables/collection-timerange.js +56 -0
- package/core/client/composables/collection.js +13 -11
- package/core/client/composables/context.js +92 -0
- package/core/client/composables/errors.js +83 -0
- package/core/client/composables/index.js +5 -1
- package/core/client/composables/layout.js +14 -11
- package/core/client/composables/messages.js +4 -4
- package/core/client/composables/pwa.js +20 -27
- package/core/client/composables/schema.js +1 -1
- package/core/client/composables/screen.js +21 -9
- package/core/client/composables/selection.js +16 -4
- package/core/client/composables/session.js +13 -7
- package/core/client/composables/store.js +2 -1
- package/core/client/context.js +38 -0
- package/core/client/directives/v-hover.js +7 -4
- package/core/client/document.js +43 -15
- package/core/client/events.js +2 -2
- package/core/client/exporter.js +5 -4
- package/core/client/filter.js +1 -8
- package/core/client/guards.js +3 -3
- package/core/client/hooks/hooks.logger.js +1 -1
- package/core/client/hooks/hooks.offline.js +32 -0
- package/core/client/hooks/index.js +2 -1
- package/core/client/i18n/core_en.json +95 -268
- package/core/client/i18n/core_fr.json +181 -353
- package/core/client/index.js +22 -8
- package/core/client/layout.js +64 -25
- package/core/client/local-cache.js +67 -0
- package/core/client/local-storage.js +6 -2
- package/core/client/mixins/index.js +0 -1
- package/core/client/mixins/mixin.base-activity.js +22 -10
- package/core/client/mixins/mixin.base-editor.js +1 -1
- package/core/client/mixins/mixin.base-field.js +10 -1
- package/core/client/mixins/mixin.base-item.js +14 -11
- package/core/client/mixins/mixin.service.js +1 -5
- package/core/client/platform.js +44 -0
- package/core/client/readers/reader.blob.js +3 -3
- package/core/client/readers/reader.csv.js +2 -2
- package/core/client/readers/reader.json.js +2 -2
- package/core/client/services/index.js +7 -11
- package/core/client/storage.js +43 -8
- package/core/client/template-context.js +14 -14
- package/core/client/time.js +2 -2
- package/core/client/units.js +7 -4
- package/core/client/utils/index.js +6 -5
- package/core/client/utils/utils.collection.js +71 -0
- package/core/client/utils/utils.colors.js +29 -8
- package/core/client/utils/utils.content.js +14 -14
- package/core/client/utils/utils.files.js +17 -0
- package/core/client/utils/utils.items.js +4 -0
- package/core/client/utils/utils.math.js +18 -1
- package/core/client/utils/utils.push.js +22 -13
- package/core/client/utils/utils.screen.js +6 -2
- package/core/client/utils/utils.services.js +42 -0
- package/core/client/utils/utils.session.js +48 -12
- package/core/client/utils/utils.shapes.js +15 -11
- package/core/common/permissions.js +3 -108
- package/core/common/schemas/messages.update.json +16 -0
- package/core/common/schemas/settings.update.json +27 -8
- package/core/common/utils.js +2 -0
- package/core/common/utils.offline.js +38 -0
- package/coverage/core/api/application.js.html +296 -296
- package/coverage/core/api/authentication.js.html +206 -74
- package/coverage/core/api/db.js.html +61 -61
- package/coverage/core/api/hooks/hooks.authentication.js.html +15 -189
- package/coverage/core/api/hooks/hooks.authorisations.js.html +180 -462
- package/coverage/core/api/hooks/hooks.groups.js.html +1 -1
- package/coverage/core/api/hooks/hooks.logger.js.html +16 -16
- package/coverage/core/api/hooks/hooks.model.js.html +69 -57
- package/coverage/core/api/hooks/hooks.organisations.js.html +1 -1
- package/coverage/core/api/hooks/hooks.push.js.html +58 -46
- package/coverage/core/api/hooks/hooks.query.js.html +142 -142
- package/coverage/core/api/hooks/hooks.schemas.js.html +1 -1
- package/coverage/core/api/hooks/hooks.service.js.html +1 -1
- package/coverage/core/api/hooks/hooks.storage.js.html +1 -1
- package/coverage/core/api/hooks/hooks.users.js.html +54 -327
- package/coverage/core/api/hooks/index.html +64 -94
- package/coverage/core/api/hooks/index.js.html +4 -10
- package/coverage/core/api/index.html +41 -56
- package/coverage/core/api/index.js.html +1 -1
- package/coverage/core/api/marshall.js.html +9 -9
- package/coverage/core/api/models/groups.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/index.html +13 -58
- package/coverage/core/api/models/messages.model.mongodb.js.html +35 -35
- package/coverage/core/api/models/organisations.model.mongodb.js.html +3 -3
- package/coverage/core/api/models/tags.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/users.model.mongodb.js.html +1 -1
- package/coverage/core/api/services/account/account.hooks.js.html +1 -1
- package/coverage/core/api/services/account/account.service.js.html +67 -67
- package/coverage/core/api/services/account/index.html +16 -16
- package/coverage/core/api/services/authorisations/authorisations.hooks.js.html +1 -1
- package/coverage/core/api/services/authorisations/authorisations.service.js.html +141 -144
- package/coverage/core/api/services/authorisations/index.html +19 -19
- package/coverage/core/api/services/databases/databases.hooks.js.html +82 -82
- package/coverage/core/api/services/databases/databases.service.js.html +20 -20
- package/coverage/core/api/services/databases/index.html +32 -32
- package/coverage/core/api/services/groups/groups.hooks.js.html +1 -1
- package/coverage/core/api/services/groups/index.html +1 -1
- package/coverage/core/api/services/import-export/import-export.hooks.js.html +1 -1
- package/coverage/core/api/services/import-export/import-export.service.js.html +1 -1
- package/coverage/core/api/services/import-export/index.html +1 -1
- package/coverage/core/api/services/index.html +21 -21
- package/coverage/core/api/services/index.js.html +118 -154
- package/coverage/core/api/services/mailer/index.html +1 -1
- package/coverage/core/api/services/mailer/mailer.hooks.js.html +1 -1
- package/coverage/core/api/services/mailer/mailer.service.js.html +1 -1
- package/coverage/core/api/services/messages/index.html +21 -21
- package/coverage/core/api/services/messages/messages.hooks.js.html +89 -86
- package/coverage/core/api/services/organisations/index.html +1 -1
- package/coverage/core/api/services/organisations/organisations.hooks.js.html +1 -1
- package/coverage/core/api/services/organisations/organisations.service.js.html +23 -23
- package/coverage/core/api/services/push/index.html +1 -1
- package/coverage/core/api/services/push/push.hooks.js.html +1 -1
- package/coverage/core/api/services/push/push.service.js.html +1 -1
- package/coverage/core/api/services/storage/index.html +5 -5
- package/coverage/core/api/services/storage/storage.hooks.js.html +1 -1
- package/coverage/core/api/services/storage/storage.service.js.html +27 -27
- package/coverage/core/api/services/tags/index.html +1 -1
- package/coverage/core/api/services/tags/tags.hooks.js.html +1 -1
- package/coverage/core/api/services/users/index.html +23 -8
- package/coverage/core/api/services/users/users.hooks.js.html +1 -1
- package/coverage/core/api/services/users/users.service.js.html +100 -0
- package/coverage/core/api/utils.js.html +1 -1
- package/coverage/core/common/errors.js.html +1 -1
- package/coverage/core/common/index.html +42 -27
- package/coverage/core/common/index.js.html +1 -1
- package/coverage/core/common/permissions.js.html +195 -510
- package/coverage/core/common/schema.js.html +1 -1
- package/coverage/core/common/utils.js.html +12 -6
- package/coverage/core/common/utils.offline.js.html +199 -0
- package/coverage/index.html +142 -172
- package/coverage/lcov-report/core/api/application.js.html +296 -296
- package/coverage/lcov-report/core/api/authentication.js.html +206 -74
- package/coverage/lcov-report/core/api/db.js.html +61 -61
- package/coverage/lcov-report/core/api/hooks/hooks.authentication.js.html +15 -189
- package/coverage/lcov-report/core/api/hooks/hooks.authorisations.js.html +180 -462
- package/coverage/lcov-report/core/api/hooks/hooks.groups.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.logger.js.html +16 -16
- package/coverage/lcov-report/core/api/hooks/hooks.model.js.html +69 -57
- package/coverage/lcov-report/core/api/hooks/hooks.organisations.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.push.js.html +58 -46
- package/coverage/lcov-report/core/api/hooks/hooks.query.js.html +142 -142
- package/coverage/lcov-report/core/api/hooks/hooks.schemas.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.service.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.storage.js.html +1 -1
- package/coverage/lcov-report/core/api/hooks/hooks.users.js.html +54 -327
- package/coverage/lcov-report/core/api/hooks/index.html +64 -94
- package/coverage/lcov-report/core/api/hooks/index.js.html +4 -10
- package/coverage/lcov-report/core/api/index.html +41 -56
- package/coverage/lcov-report/core/api/index.js.html +1 -1
- package/coverage/lcov-report/core/api/marshall.js.html +9 -9
- package/coverage/lcov-report/core/api/models/groups.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/index.html +13 -58
- package/coverage/lcov-report/core/api/models/messages.model.mongodb.js.html +35 -35
- package/coverage/lcov-report/core/api/models/organisations.model.mongodb.js.html +3 -3
- package/coverage/lcov-report/core/api/models/tags.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/users.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/services/account/account.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/account/account.service.js.html +67 -67
- package/coverage/lcov-report/core/api/services/account/index.html +16 -16
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.service.js.html +141 -144
- package/coverage/lcov-report/core/api/services/authorisations/index.html +19 -19
- package/coverage/lcov-report/core/api/services/databases/databases.hooks.js.html +82 -82
- package/coverage/lcov-report/core/api/services/databases/databases.service.js.html +20 -20
- package/coverage/lcov-report/core/api/services/databases/index.html +32 -32
- package/coverage/lcov-report/core/api/services/groups/groups.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/groups/index.html +1 -1
- package/coverage/lcov-report/core/api/services/import-export/import-export.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/import-export/import-export.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/import-export/index.html +1 -1
- package/coverage/lcov-report/core/api/services/index.html +21 -21
- package/coverage/lcov-report/core/api/services/index.js.html +118 -154
- package/coverage/lcov-report/core/api/services/mailer/index.html +1 -1
- package/coverage/lcov-report/core/api/services/mailer/mailer.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/mailer/mailer.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/messages/index.html +21 -21
- package/coverage/lcov-report/core/api/services/messages/messages.hooks.js.html +89 -86
- package/coverage/lcov-report/core/api/services/organisations/index.html +1 -1
- package/coverage/lcov-report/core/api/services/organisations/organisations.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/organisations/organisations.service.js.html +23 -23
- package/coverage/lcov-report/core/api/services/push/index.html +1 -1
- package/coverage/lcov-report/core/api/services/push/push.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/push/push.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/storage/index.html +5 -5
- package/coverage/lcov-report/core/api/services/storage/storage.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/storage/storage.service.js.html +27 -27
- package/coverage/lcov-report/core/api/services/tags/index.html +1 -1
- package/coverage/lcov-report/core/api/services/tags/tags.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/users/index.html +23 -8
- package/coverage/lcov-report/core/api/services/users/users.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/users/users.service.js.html +100 -0
- package/coverage/lcov-report/core/api/utils.js.html +1 -1
- package/coverage/lcov-report/core/common/errors.js.html +1 -1
- package/coverage/lcov-report/core/common/index.html +42 -27
- package/coverage/lcov-report/core/common/index.js.html +1 -1
- package/coverage/lcov-report/core/common/permissions.js.html +195 -510
- package/coverage/lcov-report/core/common/schema.js.html +1 -1
- package/coverage/lcov-report/core/common/utils.js.html +12 -6
- package/coverage/lcov-report/core/common/utils.offline.js.html +199 -0
- package/coverage/lcov-report/index.html +142 -172
- package/coverage/lcov-report/map/api/hooks/hooks.catalog.js.html +125 -29
- package/coverage/lcov-report/map/api/hooks/hooks.features.js.html +1 -1
- package/coverage/lcov-report/map/api/hooks/hooks.query.js.html +20 -44
- package/coverage/lcov-report/map/api/hooks/index.html +7 -7
- package/coverage/lcov-report/map/api/hooks/index.js.html +1 -1
- package/coverage/lcov-report/map/api/index.html +1 -1
- package/coverage/lcov-report/map/api/index.js.html +1 -1
- package/coverage/lcov-report/map/api/marshall.js.html +1 -1
- package/coverage/lcov-report/map/api/models/alerts.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/map/api/models/catalog.model.mongodb.js.html +49 -7
- package/coverage/lcov-report/map/api/models/features.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/map/api/models/index.html +22 -7
- package/coverage/lcov-report/map/api/models/projects.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/map/api/models/styles.model.mongodb.js.html +112 -0
- package/coverage/lcov-report/map/api/services/alerts/alerts.hooks.js.html +1 -1
- package/coverage/lcov-report/map/api/services/alerts/alerts.service.js.html +1 -1
- package/coverage/lcov-report/map/api/services/alerts/index.html +1 -1
- package/coverage/lcov-report/map/api/services/catalog/catalog.hooks.js.html +29 -11
- package/coverage/lcov-report/map/api/services/catalog/index.html +5 -5
- package/coverage/lcov-report/map/api/services/daptiles/daptiles.service.js.html +1 -1
- package/coverage/lcov-report/map/api/services/daptiles/index.html +1 -1
- package/coverage/lcov-report/map/api/services/features/features.hooks.js.html +78 -9
- package/coverage/lcov-report/map/api/services/features/features.service.js.html +307 -4
- package/coverage/lcov-report/map/api/services/features/index.html +7 -7
- package/coverage/lcov-report/map/api/services/index.html +5 -5
- package/coverage/lcov-report/map/api/services/index.js.html +287 -50
- package/coverage/lcov-report/map/api/services/projects/index.html +1 -1
- package/coverage/lcov-report/map/api/services/projects/projects.hooks.js.html +1 -1
- package/coverage/lcov-report/map/api/services/styles/index.html +116 -0
- package/coverage/lcov-report/map/api/services/styles/styles.hooks.js.html +196 -0
- package/coverage/lcov-report/map/common/dynamic-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/errors.js.html +1 -1
- package/coverage/lcov-report/map/common/geotiff-grid-source.js.html +8 -5
- package/coverage/lcov-report/map/common/grid.js.html +1 -1
- package/coverage/lcov-report/map/common/index.html +7 -7
- package/coverage/lcov-report/map/common/index.js.html +1 -1
- package/coverage/lcov-report/map/common/meteo-model-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/moment-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/opendap-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/opendap-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/permissions.js.html +10 -4
- package/coverage/lcov-report/map/common/time-based-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/tms-utils.js.html +6 -6
- package/coverage/lcov-report/map/common/wcs-grid-source.js.html +3 -3
- package/coverage/lcov-report/map/common/wcs-utils.js.html +9 -9
- package/coverage/lcov-report/map/common/weacast-grid-source.js.html +1 -1
- package/coverage/lcov-report/map/common/wfs-utils.js.html +11 -11
- package/coverage/lcov-report/map/common/wms-utils.js.html +8 -8
- package/coverage/lcov-report/map/common/wmts-utils.js.html +7 -7
- package/coverage/lcov.info +2581 -3278
- package/coverage/map/api/hooks/hooks.catalog.js.html +125 -29
- package/coverage/map/api/hooks/hooks.features.js.html +1 -1
- package/coverage/map/api/hooks/hooks.query.js.html +20 -44
- package/coverage/map/api/hooks/index.html +7 -7
- package/coverage/map/api/hooks/index.js.html +1 -1
- package/coverage/map/api/index.html +1 -1
- package/coverage/map/api/index.js.html +1 -1
- package/coverage/map/api/marshall.js.html +1 -1
- package/coverage/map/api/models/alerts.model.mongodb.js.html +1 -1
- package/coverage/map/api/models/catalog.model.mongodb.js.html +49 -7
- package/coverage/map/api/models/features.model.mongodb.js.html +1 -1
- package/coverage/map/api/models/index.html +22 -7
- package/coverage/map/api/models/projects.model.mongodb.js.html +1 -1
- package/coverage/map/api/models/styles.model.mongodb.js.html +112 -0
- package/coverage/map/api/services/alerts/alerts.hooks.js.html +1 -1
- package/coverage/map/api/services/alerts/alerts.service.js.html +1 -1
- package/coverage/map/api/services/alerts/index.html +1 -1
- package/coverage/map/api/services/catalog/catalog.hooks.js.html +29 -11
- package/coverage/map/api/services/catalog/index.html +5 -5
- package/coverage/map/api/services/daptiles/daptiles.service.js.html +1 -1
- package/coverage/map/api/services/daptiles/index.html +1 -1
- package/coverage/map/api/services/features/features.hooks.js.html +78 -9
- package/coverage/map/api/services/features/features.service.js.html +307 -4
- package/coverage/map/api/services/features/index.html +7 -7
- package/coverage/map/api/services/index.html +5 -5
- package/coverage/map/api/services/index.js.html +287 -50
- package/coverage/map/api/services/projects/index.html +1 -1
- package/coverage/map/api/services/projects/projects.hooks.js.html +1 -1
- package/coverage/map/api/services/styles/index.html +116 -0
- package/coverage/map/api/services/styles/styles.hooks.js.html +196 -0
- package/coverage/map/common/dynamic-grid-source.js.html +1 -1
- package/coverage/map/common/errors.js.html +1 -1
- package/coverage/map/common/geotiff-grid-source.js.html +8 -5
- package/coverage/map/common/grid.js.html +1 -1
- package/coverage/map/common/index.html +7 -7
- package/coverage/map/common/index.js.html +1 -1
- package/coverage/map/common/meteo-model-grid-source.js.html +1 -1
- package/coverage/map/common/moment-utils.js.html +1 -1
- package/coverage/map/common/opendap-grid-source.js.html +1 -1
- package/coverage/map/common/opendap-utils.js.html +1 -1
- package/coverage/map/common/permissions.js.html +10 -4
- package/coverage/map/common/time-based-grid-source.js.html +1 -1
- package/coverage/map/common/tms-utils.js.html +6 -6
- package/coverage/map/common/wcs-grid-source.js.html +3 -3
- package/coverage/map/common/wcs-utils.js.html +9 -9
- package/coverage/map/common/weacast-grid-source.js.html +1 -1
- package/coverage/map/common/wfs-utils.js.html +11 -11
- package/coverage/map/common/wms-utils.js.html +8 -8
- package/coverage/map/common/wmts-utils.js.html +7 -7
- package/coverage/tmp/coverage-323534-1747828879483-0.json +1 -0
- package/coverage/tmp/coverage-323546-1747828879453-0.json +1 -0
- package/coverage/tmp/coverage-323557-1747828879439-0.json +1 -0
- package/coverage/tmp/coverage-323569-1747828879416-0.json +1 -0
- package/coverage/tmp/coverage-323576-1747828879390-0.json +1 -0
- package/extras/configs/helpers.js +78 -0
- package/extras/configs/panes.left.js +118 -0
- package/extras/configs/panes.top.js +222 -0
- package/extras/configs/stickies.js +57 -0
- package/extras/configs/widgets.left.js +23 -0
- package/extras/configs/widgets.top.js +73 -0
- package/extras/css/core.variables.scss +8 -0
- package/extras/images/north.svg +3 -0
- package/extras/tours/map/side-nav.js +3 -3
- package/map/api/hooks/hooks.catalog.js +56 -23
- package/map/api/hooks/hooks.query.js +16 -24
- package/map/api/models/catalog.model.mongodb.js +16 -2
- package/{core/api/models/groups.model.mongodb.js → map/api/models/styles.model.mongodb.js} +2 -1
- package/map/api/services/catalog/catalog.hooks.js +13 -7
- package/map/api/services/features/features.hooks.js +28 -5
- package/map/api/services/features/features.service.js +101 -0
- package/map/api/services/index.js +125 -46
- package/map/api/services/styles/styles.hooks.js +37 -0
- package/map/client/cesium/utils/index.js +1 -0
- package/map/client/cesium/utils/utils.cesium.js +397 -0
- package/map/client/cesium/utils/utils.features.js +8 -0
- package/map/client/cesium/utils/utils.geojson.js +59 -0
- package/map/client/cesium/utils/utils.style.js +134 -17
- package/map/client/components/KEditLayerData.vue +17 -79
- package/map/client/components/KFeatureEditor.vue +2 -7
- package/map/client/components/KFeaturesChart.vue +2 -6
- package/map/client/components/KFeaturesFilterEditor.vue +300 -0
- package/map/client/components/KFeaturesFilterManager.vue +196 -0
- package/map/client/components/KFeaturesTable.vue +0 -5
- package/map/client/components/KFilterCondition.vue +303 -0
- package/map/client/components/KLayerEditionToolbar.vue +4 -3
- package/map/client/components/KLayerEditor.vue +451 -36
- package/map/client/components/KMeasureTool.vue +36 -9
- package/map/client/components/KProjectMenu.vue +14 -8
- package/map/client/components/catalog/KAddLayer.vue +0 -4
- package/map/client/components/catalog/KBaseLayersSelector.vue +42 -46
- package/map/client/components/catalog/KConnectLayer.vue +295 -291
- package/map/client/components/catalog/KCreateLayer.vue +141 -146
- package/map/client/components/catalog/KCreateOfflineView.vue +100 -0
- package/map/client/components/catalog/KCreateView.vue +2 -8
- package/map/client/components/catalog/KFilteredLayerItem.vue +72 -25
- package/map/client/components/catalog/KImportLayer.vue +121 -129
- package/map/client/components/catalog/KLayerItem.vue +44 -32
- package/map/client/components/catalog/KLayersPanel.vue +45 -17
- package/map/client/components/catalog/KLayersSelector.vue +51 -50
- package/map/client/components/catalog/KProjectManager.vue +4 -8
- package/map/client/components/catalog/KProjectSelector.vue +33 -2
- package/map/client/components/catalog/KProjectsPanel.vue +84 -106
- package/map/client/components/catalog/KSelectLayers.vue +56 -69
- package/map/client/components/catalog/KSelectViews.vue +56 -69
- package/map/client/components/catalog/KViewSelector.vue +32 -2
- package/map/client/components/catalog/KViewsPanel.vue +178 -110
- package/map/client/components/catalog/KWeatherLayersSelector.vue +77 -85
- package/map/client/components/form/KLocationField.vue +21 -2
- package/map/client/components/form/KOwsLayerField.vue +1 -1
- package/map/client/components/form/KOwsServiceField.vue +102 -63
- package/map/client/components/form/KSelectLayersField.vue +1 -1
- package/map/client/components/form/KSelectViewsField.vue +1 -1
- package/map/client/components/form/KTimezoneField.vue +0 -1
- package/map/client/components/legend/KLegend.vue +4 -4
- package/map/client/components/location/KLocationCardSection.vue +16 -0
- package/map/client/components/location/KLocationMap.vue +3 -2
- package/map/client/components/location/KLocationSearch.vue +46 -8
- package/map/client/components/location/KLocationTimeLineCard.vue +25 -3
- package/map/client/components/location/KLocationTip.vue +57 -10
- package/map/client/components/selection/KFeaturesSelection.vue +71 -0
- package/map/client/components/selection/KSelectedLayerFeatures.vue +343 -0
- package/map/client/components/{KAttribution.vue → stickies/KAttribution.vue} +39 -33
- package/map/client/components/stickies/KLevelSlider.vue +114 -0
- package/map/client/components/stickies/KNorthArrow.vue +26 -0
- package/map/client/components/stickies/KPosition.vue +103 -0
- package/map/client/components/stickies/KTarget.vue +34 -0
- package/map/client/components/styles/KLayerStyleAction.vue +58 -0
- package/map/client/components/styles/KStyleEditor.vue +273 -0
- package/map/client/components/styles/KStyleEditorSection.vue +79 -0
- package/map/client/components/styles/KStyleManager.vue +183 -0
- package/map/client/components/styles/KStylePreview.vue +64 -0
- package/map/client/components/styles/KStylePreviewItem.vue +68 -0
- package/map/client/components/styles/KStylePropertiesGroup.vue +76 -0
- package/map/client/components/styles/KStyleProperty.vue +136 -0
- package/map/client/components/styles/KStyleTip.vue +118 -0
- package/map/client/components/tools/KGeolocateTool.vue +3 -2
- package/map/client/components/tools/KSearchTool.vue +34 -6
- package/map/client/components/widget/KMapillaryViewer.vue +1 -1
- package/map/client/components/widget/KStackableTimeSeries.vue +8 -5
- package/map/client/composables/activity.js +29 -43
- package/map/client/composables/catalog.js +1 -1
- package/map/client/composables/highlight.js +117 -57
- package/map/client/composables/location.js +33 -14
- package/map/client/composables/project.js +9 -10
- package/map/client/composables/selection.js +136 -23
- package/map/client/geocoder.js +104 -0
- package/map/client/geolocation.js +1 -1
- package/map/client/globe.js +3 -0
- package/map/client/hooks/hooks.offline.js +95 -0
- package/map/client/hooks/index.js +1 -0
- package/map/client/i18n/map_en.json +159 -94
- package/map/client/i18n/map_fr.json +186 -127
- package/map/client/index.js +3 -0
- package/map/client/init.js +44 -8
- package/map/client/leaflet/BoxSelection.js +2 -2
- package/map/client/leaflet/GradientPath.js +84 -4
- package/map/client/leaflet/WindBarb.js +323 -0
- package/map/client/leaflet/utils/index.js +1 -0
- package/map/client/leaflet/utils/utils.events.js +8 -3
- package/map/client/leaflet/utils/utils.geojson.js +221 -0
- package/map/client/leaflet/utils/utils.style.js +10 -9
- package/map/client/map.js +3 -0
- package/map/client/mixins/globe/mixin.base-globe.js +151 -19
- package/map/client/mixins/globe/mixin.geojson-layers.js +208 -86
- package/map/client/mixins/globe/mixin.popup.js +3 -2
- package/map/client/mixins/globe/mixin.style.js +3 -1
- package/map/client/mixins/globe/mixin.tooltip.js +3 -2
- package/map/client/mixins/map/index.js +1 -3
- package/map/client/mixins/map/mixin.base-map.js +267 -79
- package/map/client/mixins/map/mixin.canvas-layers.js +44 -10
- package/map/client/mixins/map/mixin.edit-layers.js +142 -57
- package/map/client/mixins/map/mixin.geojson-layers.js +127 -204
- package/map/client/mixins/map/mixin.pmtiles-layers.js +24 -11
- package/map/client/mixins/map/mixin.tiled-mesh-layers.js +1 -2
- package/map/client/mixins/map/mixin.tiled-wind-layers.js +2 -1
- package/map/client/mixins/mixin.activity.js +61 -41
- package/map/client/mixins/mixin.context.js +19 -14
- package/map/client/mixins/mixin.feature-selection.js +0 -1
- package/map/client/mixins/mixin.feature-service.js +41 -59
- package/map/client/mixins/mixin.weacast.js +1 -1
- package/map/client/navigator.js +38 -0
- package/map/client/pixi-utils.js +1 -1
- package/map/client/planets.js +1 -1
- package/map/client/readers/reader.kml.js +57 -1
- package/map/client/utils/index.js +1 -0
- package/map/client/utils/utils.capture.js +10 -7
- package/map/client/utils/utils.catalog.js +2 -2
- package/map/client/utils/utils.features.js +193 -39
- package/map/client/utils/utils.js +0 -21
- package/map/client/utils/utils.layers.js +381 -4
- package/map/client/utils/utils.location.js +39 -74
- package/map/client/utils/utils.offline.js +89 -0
- package/map/client/utils/utils.style.js +133 -80
- package/map/common/geotiff-grid-source.js +2 -1
- package/map/common/permissions.js +2 -0
- package/map/common/schemas/capture.create.json +4 -4
- package/map/common/schemas/catalog.update.json +18 -2
- package/map/common/schemas/projects.create.json +2 -2
- package/map/common/schemas/projects.update.json +2 -2
- package/map/common/tms-utils.js +5 -5
- package/map/common/wcs-grid-source.js +2 -2
- package/map/common/wcs-utils.js +8 -8
- package/map/common/wfs-utils.js +10 -10
- package/map/common/wms-utils.js +7 -7
- package/map/common/wmts-utils.js +6 -6
- package/package.json +7 -4
- package/test/api/core/account.test.js +0 -72
- package/test/api/core/authentication.test.js +184 -0
- package/test/api/core/config/default.cjs +1 -3
- package/test/api/core/index.test.js +33 -96
- package/test/api/core/offline.test.js +55 -0
- package/test/api/core/push.test.js +3 -3
- package/test/api/core/{test-log-2024-06-06.log → test-log-2025-02-05.log} +3 -3
- package/test/api/core/{test-log-2024-11-15.log → test-log-2025-05-21.log} +1 -9
- package/test/api/map/alerts.test.js +1 -1
- package/test/api/map/config/default.cjs +2 -1
- package/test/api/map/data/vigicrues.observations.Q.json +47042 -0
- package/test/api/map/index.test.js +113 -9
- package/test/api/map/style.test.js +62 -0
- package/test/client/core/layout.js +2 -2
- package/test/client/core/runner.js +1 -1
- package/test/client/core/utils.js +52 -0
- package/test/client/map/catalog.js +1 -0
- package/core/api/hooks/hooks.groups.js +0 -48
- package/core/api/hooks/hooks.organisations.js +0 -152
- package/core/api/models/organisations.model.mongodb.js +0 -3
- package/core/api/models/tags.model.mongodb.js +0 -10
- package/core/api/services/groups/groups.hooks.js +0 -31
- package/core/api/services/organisations/organisations.hooks.js +0 -31
- package/core/api/services/organisations/organisations.service.js +0 -86
- package/core/api/services/tags/tags.hooks.js +0 -31
- package/core/api/utils.js +0 -11
- package/core/client/components/KChipsPane.vue +0 -103
- package/core/client/components/document/index.js +0 -9
- package/core/client/components/team/KAddMember.vue +0 -378
- package/core/client/components/team/KAddTag.vue +0 -121
- package/core/client/components/team/KChangeRole.vue +0 -118
- package/core/client/components/team/KGroupCard.vue +0 -110
- package/core/client/components/team/KGroupsActivity.vue +0 -78
- package/core/client/components/team/KJoinGroup.vue +0 -132
- package/core/client/components/team/KMemberCard.vue +0 -328
- package/core/client/components/team/KMemberFilter.vue +0 -49
- package/core/client/components/team/KMembersActivity.vue +0 -136
- package/core/client/components/team/KOrganisationsActivity.vue +0 -51
- package/core/client/components/team/KTagCard.vue +0 -72
- package/core/client/components/team/KTagsActivity.vue +0 -73
- package/core/client/components/team/index.js +0 -9
- package/core/client/mixins/mixin.base-context.js +0 -54
- package/core/client/utils/utils.platform.js +0 -12
- package/core/common/schemas/groups.create.json +0 -28
- package/core/common/schemas/groups.update.json +0 -28
- package/core/common/schemas/organisations.create.json +0 -28
- package/core/common/schemas/organisations.update.json +0 -49
- package/core/common/schemas/tags.create.json +0 -35
- package/core/common/schemas/tags.update.json +0 -35
- package/coverage/tmp/coverage-280506-1731704745613-0.json +0 -1
- package/coverage/tmp/coverage-280518-1731704745599-0.json +0 -1
- package/coverage/tmp/coverage-280529-1731704745588-0.json +0 -1
- package/coverage/tmp/coverage-280541-1731704745574-0.json +0 -1
- package/coverage/tmp/coverage-280548-1731704745545-0.json +0 -1
- package/map/client/components/KFeaturesFilter.vue +0 -259
- package/map/client/components/KLayerStyleEditor.vue +0 -118
- package/map/client/components/KLayerStyleForm.vue +0 -740
- package/map/client/components/KLevelSlider.vue +0 -100
- package/map/client/components/KNorth.vue +0 -31
- package/map/client/components/KPositionIndicator.vue +0 -83
- package/map/client/components/catalog/KCreateProject.vue +0 -100
- package/map/client/mixins/map/mixin.forecast-layers.js +0 -81
- package/map/client/mixins/map/mixin.georaster-layers.js +0 -107
- package/test/api/core/team.test.js +0 -670
- package/test/api/core/test-log-2023-12-19.log +0 -7
- package/test/api/core/test-log-2024-01-04.log +0 -14
- package/test/api/core/test-log-2024-05-14.log +0 -6
- package/test/api/core/test-log-2024-06-26.log +0 -25
- package/test/api/core/test-log-2024-06-28.log +0 -2
- package/test/api/core/test-log-2024-07-09.log +0 -0
- package/test/api/core/test-log-2024-08-13.log +0 -69
- package/test/api/core/test-log-2024-10-28.log +0 -53
- package/test/api/core/test-log-2024-11-05.log +0 -30
- package/test/api/core/test-log-2024-11-18.log +0 -0
- package/test/api/core/test-log-2024-12-03.log +0 -30
- package/test/api/map/test-log-2023-11-24.log +0 -121
- package/test/api/map/test-log-2023-12-12.log +0 -29
- package/test/api/map/test-log-2023-12-13.log +0 -5
- package/test/api/map/test-log-2024-01-04.log +0 -2
- package/test/api/map/test-log-2024-01-11.log +0 -1
- package/test/api/map/test-log-2024-01-25.log +0 -19
- package/test/api/map/test-log-2024-06-06.log +0 -39
- package/test/api/map/test-log-2024-08-13.log +0 -13
- package/test/api/map/test-log-2024-08-20.log +0 -55
- package/test/api/map/test-log-2024-09-09.log +0 -92
- package/test/api/map/test-log-2024-10-28.log +0 -11
- /package/extras/{logos → images}/kalisio.png +0 -0
- /package/extras/{icons → images}/target.svg +0 -0
- /package/test/api/map/data/{vigicrues.observations.json → vigicrues.observations.H.json} +0 -0
|
@@ -2,100 +2,18 @@ import L from 'leaflet'
|
|
|
2
2
|
import _ from 'lodash'
|
|
3
3
|
import sift from 'sift'
|
|
4
4
|
import logger from 'loglevel'
|
|
5
|
-
import
|
|
6
|
-
import 'leaflet-realtime'
|
|
5
|
+
import { point, rhumbDistance, rhumbBearing, rhumbDestination } from '@turf/turf'
|
|
7
6
|
import { Time, Units, utils as kdkCoreUtils } from '../../../../core.client.js'
|
|
8
|
-
import {
|
|
7
|
+
import { getUpdateFeatureFunction, hasUnitInLeafletLayerTemplate, GeoJsonLeafletLayerFilters } from '../../leaflet/utils/utils.geojson.js'
|
|
9
8
|
import { MaskLayer } from '../../leaflet/MaskLayer.js'
|
|
10
9
|
import { TiledFeatureLayer } from '../../leaflet/TiledFeatureLayer.js'
|
|
11
10
|
import {
|
|
12
11
|
fetchGeoJson, LeafletEvents, bindLeafletEvents, unbindLeafletEvents, getFeatureId, isInMemoryLayer, getFeatureStyleType,
|
|
13
12
|
convertSimpleStyleToPointStyle, convertSimpleStyleToLineStyle, convertSimpleStyleToPolygonStyle, createMarkerFromPointStyle
|
|
14
13
|
} from '../../utils.map.js'
|
|
14
|
+
import * as maths from '../../../../core/client/utils/utils.math.js'
|
|
15
15
|
import * as wfs from '../../../common/wfs-utils.js'
|
|
16
16
|
|
|
17
|
-
// Override default remove handler for leaflet-realtime due to
|
|
18
|
-
// https://github.com/perliedman/leaflet-realtime/issues/177
|
|
19
|
-
const Realtime = L.Realtime.extend({
|
|
20
|
-
remove: function (geojson) {
|
|
21
|
-
if (typeof geojson === 'undefined') {
|
|
22
|
-
return L.Layer.prototype.remove.call(this)
|
|
23
|
-
} else {
|
|
24
|
-
return L.Realtime.prototype.remove.call(this, geojson)
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
L.realtime = function (src, options) {
|
|
29
|
-
return new Realtime(src, options)
|
|
30
|
-
}
|
|
31
|
-
// Override default Polyline simplify function to manage offset
|
|
32
|
-
const simplifyPoints = L.Polyline.prototype._simplifyPoints
|
|
33
|
-
L.Polyline.include({
|
|
34
|
-
_simplifyPoints: function () {
|
|
35
|
-
simplifyPoints.call(this)
|
|
36
|
-
// Offset simplified version
|
|
37
|
-
if (this.options.offset) {
|
|
38
|
-
// We'd like to ensure a pixel constant offset when zooming
|
|
39
|
-
// Zoom 0 resolution is 156 543 m/pixel at equator in default map tiles,
|
|
40
|
-
// we take latitude into account to account for a convergence factor
|
|
41
|
-
const latitude = this.getBounds().getCenter().lat
|
|
42
|
-
const factor = 156543 / Math.pow(2, this._map.getZoom()) / Math.cos(latitude * Math.PI / 180)
|
|
43
|
-
const offset = Math.max(1, this.options.offset * factor)
|
|
44
|
-
|
|
45
|
-
for (let i = 0; i < this._parts.length; i++) {
|
|
46
|
-
let latLngs = this._parts[i].map(point => this._map.layerPointToLatLng(point))
|
|
47
|
-
// Ensure a large enough precision for computation (defaults to 6 in Leaflet)
|
|
48
|
-
const coords = L.GeoJSON.latLngsToCoords(latLngs, 0, false, 12)
|
|
49
|
-
const feature = lineOffset({ type: 'LineString', coordinates: coords }, offset, { units: 'meters' })
|
|
50
|
-
latLngs = L.GeoJSON.coordsToLatLngs(feature.geometry.coordinates, 0)
|
|
51
|
-
this._parts[i] = latLngs.map(latlng => this._map.latLngToLayerPoint(latlng))
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
// Override default Leaflet GeoJson utility to manage some specific use cases
|
|
58
|
-
const geometryToLayer = L.GeoJSON.geometryToLayer
|
|
59
|
-
L.GeoJSON.geometryToLayer = function (geojson, options) {
|
|
60
|
-
const geometry = geojson.geometry
|
|
61
|
-
const properties = geojson.properties
|
|
62
|
-
if (geometry && properties && properties.geodesic) {
|
|
63
|
-
if (geometry.type === 'LineString') {
|
|
64
|
-
return new L.Geodesic([L.GeoJSON.coordsToLatLngs(geometry.coordinates, 0)],
|
|
65
|
-
Object.assign({ steps: 4 }, options.style(geojson)))
|
|
66
|
-
} else if (geometry.type === 'MultiLineString') {
|
|
67
|
-
const coords = geometry.coordinates.map((lineString) => L.GeoJSON.coordsToLatLngs(lineString, 0))
|
|
68
|
-
return new L.Geodesic(coords, Object.assign({ steps: 4 }, options.style(geojson)))
|
|
69
|
-
} else if (geometry.type === 'Point') {
|
|
70
|
-
const layer = new L.GeodesicCircle(L.GeoJSON.coordsToLatLng(geometry.coordinates),
|
|
71
|
-
Object.assign({ fill: true, steps: 360, radius: properties.radius }, options.style(geojson)))
|
|
72
|
-
return layer
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (geometry && properties && properties.gradient) {
|
|
76
|
-
if (geometry.type === 'LineString') {
|
|
77
|
-
return new GradientPath(geojson, options.style(geojson))
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (geometry && properties && properties.mask) {
|
|
81
|
-
if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {
|
|
82
|
-
return new MaskLayer(geojson, options.style(geojson))
|
|
83
|
-
}
|
|
84
|
-
}// Automate Leaflet.PolylineOffset plugin use
|
|
85
|
-
if (geometry && properties && properties.offset) {
|
|
86
|
-
if (geometry.type === 'LineString') {
|
|
87
|
-
options = Object.assign({ offset: properties.offset }, options)
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// As we do so this breaks leaflet-arrowheads plugin
|
|
91
|
-
const layer = geometryToLayer(geojson, options)
|
|
92
|
-
if (geometry && (options.arrowheads || (properties && properties.arrowheads))) {
|
|
93
|
-
if (layer instanceof L.Polyline) layer.arrowheads(options.arrowheads || properties.arrowheads)
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return layer
|
|
97
|
-
}
|
|
98
|
-
|
|
99
17
|
export const geojsonLayers = {
|
|
100
18
|
emits: [
|
|
101
19
|
'layer-updated'
|
|
@@ -116,75 +34,7 @@ export const geojsonLayers = {
|
|
|
116
34
|
}
|
|
117
35
|
// Custom update function to ensure dynamic styling works as expected
|
|
118
36
|
if (!_.has(leafletOptions, 'updateFeature')) {
|
|
119
|
-
leafletOptions.updateFeature =
|
|
120
|
-
// A new feature is coming, create it
|
|
121
|
-
if (!oldLayer) return
|
|
122
|
-
const staticGeometry = _.get(leafletOptions, 'staticGeometry', false)
|
|
123
|
-
// Keep track of previous geometry if we don't want to update it
|
|
124
|
-
// Indeed, styling might depend on it
|
|
125
|
-
if (staticGeometry) feature.geometry = _.get(oldLayer, 'feature.geometry')
|
|
126
|
-
|
|
127
|
-
// An existing one is found, simply update styling, properties, etc.
|
|
128
|
-
leafletOptions.onEachFeature(feature, oldLayer)
|
|
129
|
-
if (oldLayer.setStyle) {
|
|
130
|
-
// Some vector layers can be used for points, eg circleMarker,
|
|
131
|
-
// in this case we use marker styling instead of lines/polygons styling
|
|
132
|
-
if (feature.geometry.type === 'Point') {
|
|
133
|
-
// FIXME: updating style in place does not seem to work, so for now we recreate the whole marker
|
|
134
|
-
// oldLayer.setStyle(leafletOptions.pointToLayer(feature))
|
|
135
|
-
return
|
|
136
|
-
} else {
|
|
137
|
-
oldLayer.setStyle(leafletOptions.style(feature))
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
// We want to restore values that were there till now but are missing from the input feature.
|
|
141
|
-
// Deep for time and runtime that might contain objects with variables
|
|
142
|
-
_.defaultsDeep(feature, _.pick(oldLayer.feature, ['time', 'runTime']))
|
|
143
|
-
// _NOT_ deep for properties, otherwise it'll merge array and object properties between the two
|
|
144
|
-
const oldProps = _.get(oldLayer.feature, 'properties')
|
|
145
|
-
if (oldProps) {
|
|
146
|
-
if (!feature.properties) feature.properties = {}
|
|
147
|
-
_.defaults(feature.properties, oldProps)
|
|
148
|
-
}
|
|
149
|
-
if (oldLayer.setIcon) {
|
|
150
|
-
// FIXME: updating icon in place requires to recreate it anyway, so for now we recreate the whole marker
|
|
151
|
-
// oldLayer.setIcon(_.get(leafletOptions.pointToLayer(feature, oldLayer.getLatLng()), 'options.icon'))
|
|
152
|
-
return
|
|
153
|
-
}
|
|
154
|
-
// Now update coordinates if not static geometry
|
|
155
|
-
if (staticGeometry) return oldLayer
|
|
156
|
-
// The feature is changing its geometry type, recreate it
|
|
157
|
-
const oldType = _.get(oldLayer, 'feature.geometry.type')
|
|
158
|
-
const type = _.get(feature, 'geometry.type')
|
|
159
|
-
if (type !== oldType) return
|
|
160
|
-
const coordinates = feature.geometry.coordinates
|
|
161
|
-
// FIXME: support others geometry types ?
|
|
162
|
-
switch (type) {
|
|
163
|
-
case 'Point':
|
|
164
|
-
oldLayer.setLatLng(L.GeoJSON.coordsToLatLngs(coordinates))
|
|
165
|
-
break
|
|
166
|
-
case 'LineString':
|
|
167
|
-
case 'MultiLineString':
|
|
168
|
-
if (typeof oldLayer.setData === 'function') {
|
|
169
|
-
// Support Gradient Path
|
|
170
|
-
oldLayer.setData(feature)
|
|
171
|
-
} else if (feature.properties.geodesic) {
|
|
172
|
-
// Support geodesic line & linestrings
|
|
173
|
-
const latlngs = type === 'LineString'
|
|
174
|
-
? [L.GeoJSON.coordsToLatLngs(coordinates, 0)]
|
|
175
|
-
: coordinates.map((linestring) => L.GeoJSON.coordsToLatLngs(linestring, 0))
|
|
176
|
-
oldLayer.setLatLngs(latlngs)
|
|
177
|
-
} else {
|
|
178
|
-
oldLayer.setLatLngs(L.GeoJSON.coordsToLatLngs(coordinates, type === 'LineString' ? 0 : 1))
|
|
179
|
-
}
|
|
180
|
-
break
|
|
181
|
-
case 'Polygon':
|
|
182
|
-
case 'MultiPolygon':
|
|
183
|
-
oldLayer.setLatLngs(L.GeoJSON.coordsToLatLngs(coordinates, type === 'Polygon' ? 1 : 2))
|
|
184
|
-
break
|
|
185
|
-
}
|
|
186
|
-
return oldLayer
|
|
187
|
-
}
|
|
37
|
+
leafletOptions.updateFeature = getUpdateFeatureFunction(leafletOptions)
|
|
188
38
|
}
|
|
189
39
|
// Check for feature service layers
|
|
190
40
|
if (options.service) {
|
|
@@ -209,7 +59,11 @@ export const geojsonLayers = {
|
|
|
209
59
|
if (!initialized) {
|
|
210
60
|
try {
|
|
211
61
|
// Use probes as reference
|
|
212
|
-
|
|
62
|
+
const geoJson = await this.getProbeFeatures(options)
|
|
63
|
+
// When probes are fetched, we flag them with a 'measureRequestIssued' property that we may use in dynamic styling
|
|
64
|
+
const features = (geoJson.type === 'FeatureCollection' ? geoJson.features : [geoJson])
|
|
65
|
+
features.forEach(feature => { feature.measureRequestIssued = true })
|
|
66
|
+
successCallback(geoJson)
|
|
213
67
|
initialized = true
|
|
214
68
|
} catch (error) {
|
|
215
69
|
errorCallback(error)
|
|
@@ -217,7 +71,8 @@ export const geojsonLayers = {
|
|
|
217
71
|
}
|
|
218
72
|
try {
|
|
219
73
|
// Then update features
|
|
220
|
-
|
|
74
|
+
const geoJson = await this.getFeatures(options)
|
|
75
|
+
successCallback(geoJson)
|
|
221
76
|
} catch (error) {
|
|
222
77
|
errorCallback(error)
|
|
223
78
|
}
|
|
@@ -237,7 +92,7 @@ export const geojsonLayers = {
|
|
|
237
92
|
SRSNAME: 'EPSG:4326', // result in 4326
|
|
238
93
|
BBOX: `${query.south},${query.west},${query.north},${query.east},urn:ogc:def:crs:EPSG::4326` // request bbox
|
|
239
94
|
}, options.wfs.searchParams)
|
|
240
|
-
return wfs.GetFeature(options.wfs.url, options.wfs.version, options.wfs.layer, searchParams, { xml2json: false })
|
|
95
|
+
return wfs.GetFeature(options.wfs.url, options.wfs.version, options.wfs.layer, searchParams, options.wfs.headers, { xml2json: false })
|
|
241
96
|
}
|
|
242
97
|
}
|
|
243
98
|
} else if (_.has(leafletOptions, 'sourceTemplate')) {
|
|
@@ -396,7 +251,9 @@ export const geojsonLayers = {
|
|
|
396
251
|
// Add FeatureGroup interface so that layer edition works as well
|
|
397
252
|
layer.toGeoJSON = () => ({ type: 'FeatureCollection', features: _.values(layer._features) })
|
|
398
253
|
layer.clearLayers = () => layer._onNewData(true, { type: 'FeatureCollection', features: [] })
|
|
399
|
-
layer.
|
|
254
|
+
layer.getLayers = () => _.values(layer._featureLayers)
|
|
255
|
+
layer.addLayer = (geoJsonLayer) => layer._onNewData(false, geoJsonLayer.toGeoJSON())
|
|
256
|
+
layer.removeLayer = (geoJsonLayer) => layer.remove(geoJsonLayer.toGeoJSON())
|
|
400
257
|
// We launch a first update to initialize data
|
|
401
258
|
layer.update()
|
|
402
259
|
} else {
|
|
@@ -465,6 +322,93 @@ export const geojsonLayers = {
|
|
|
465
322
|
}
|
|
466
323
|
return geojsonOptions
|
|
467
324
|
},
|
|
325
|
+
getUpdateAnimation(name, layer, options, geoJson) {
|
|
326
|
+
const { duration, removeMissing, animate } = options
|
|
327
|
+
const animatedProperties = _.keys(animate)
|
|
328
|
+
const features = (Array.isArray(geoJson) ? geoJson : (geoJson.type === 'FeatureCollection' ? geoJson.features : [geoJson]))
|
|
329
|
+
features.forEach(feature => {
|
|
330
|
+
const previousLayer = layer.getLayer(layer.options.getFeatureId(feature))
|
|
331
|
+
const previousFeature = (previousLayer ? previousLayer.feature : null)
|
|
332
|
+
if (previousFeature) {
|
|
333
|
+
Object.assign(feature, { previousFeature })
|
|
334
|
+
const startLongitude = _.get(feature.previousFeature, 'geometry.coordinates[0]')
|
|
335
|
+
const startLatitude = _.get(feature.previousFeature, 'geometry.coordinates[1]')
|
|
336
|
+
const endLongitude = _.get(feature, 'geometry.coordinates[0]')
|
|
337
|
+
const endLatitude = _.get(feature, 'geometry.coordinates[1]')
|
|
338
|
+
const rhumbStart = point([startLongitude, startLatitude])
|
|
339
|
+
const rhumbEnd = point([endLongitude, endLatitude])
|
|
340
|
+
Object.assign(feature, {
|
|
341
|
+
rhumbStart,
|
|
342
|
+
rhumbEnd,
|
|
343
|
+
rhumbBearing: rhumbBearing(rhumbStart, rhumbEnd),
|
|
344
|
+
rhumbDistance: rhumbDistance(rhumbStart, rhumbEnd)
|
|
345
|
+
})
|
|
346
|
+
}
|
|
347
|
+
})
|
|
348
|
+
return (timestamp) => {
|
|
349
|
+
// Initialize animation time origin
|
|
350
|
+
if (!options.startTime) options.startTime = timestamp
|
|
351
|
+
const { id, startTime } = options
|
|
352
|
+
const elapsed = timestamp - startTime
|
|
353
|
+
const percent = Math.abs(elapsed / (1000 * duration))
|
|
354
|
+
if (percent <= 1) {
|
|
355
|
+
const animatedFeatures = []
|
|
356
|
+
features.forEach(feature => {
|
|
357
|
+
if (!feature.previousFeature) {
|
|
358
|
+
animatedFeatures.push(feature)
|
|
359
|
+
return
|
|
360
|
+
}
|
|
361
|
+
const endLongitude = _.get(feature, 'geometry.coordinates[0]')
|
|
362
|
+
const endLatitude = _.get(feature, 'geometry.coordinates[1]')
|
|
363
|
+
let dLongitude = endLongitude, dLatitude = endLatitude
|
|
364
|
+
if (animate.geometry) {
|
|
365
|
+
const easingGeometryFunction = _.get(animate.geometry, 'easing.function')
|
|
366
|
+
const easingGeometryParameters = _.get(animate.geometry, 'easing.parameters', [])
|
|
367
|
+
const percentGeometry = maths[easingGeometryFunction](percent, ...easingGeometryParameters)
|
|
368
|
+
if (animate.geometry.rhumb) {
|
|
369
|
+
const destination = rhumbDestination(feature.rhumbStart, percentGeometry * feature.rhumbDistance, feature.rhumbBearing)
|
|
370
|
+
dLongitude = _.get(destination, 'geometry.coordinates[0]')
|
|
371
|
+
dLatitude = _.get(destination, 'geometry.coordinates[1]')
|
|
372
|
+
} else {
|
|
373
|
+
const startLongitude = _.get(feature.previousFeature, 'geometry.coordinates[0]')
|
|
374
|
+
const startLatitude = _.get(feature.previousFeature, 'geometry.coordinates[1]')
|
|
375
|
+
const dLongitude = startLongitude + percentGeometry * (endLongitude - startLongitude)
|
|
376
|
+
const dLatitude = startLatitude + percentGeometry * (endLatitude - startLatitude)
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
const properties = {}
|
|
380
|
+
animatedProperties.forEach(property => {
|
|
381
|
+
// Skip geometry as specifically managed above
|
|
382
|
+
if (property === 'geometry') return
|
|
383
|
+
const easingPropertyFunction = _.get(animate, `${property}.easing.function`, 'cubicBezier')
|
|
384
|
+
const easingPropertyParameters = _.get(animate, `${property}.easing.parameters`, [])
|
|
385
|
+
const percentProperty = maths[easingPropertyFunction](percent, ...easingPropertyParameters)
|
|
386
|
+
const startValue = _.get(feature.previousFeature, `properties.${property}`)
|
|
387
|
+
const endValue = _.get(feature, `properties.${property}`)
|
|
388
|
+
let dValue = startValue + percentProperty * (endValue - startValue)
|
|
389
|
+
if (_.get(animate, `${property}.bearing`, false)) {
|
|
390
|
+
// Take care to animate using the shortest "path", eg from 355° to 5° avoid running counterclockwise
|
|
391
|
+
// First computes the smallest angle difference, either clockwise or counterclockwise.
|
|
392
|
+
const bearingDifference = (endValue - startValue + 540) % 360 - 180
|
|
393
|
+
// Then normalize the final result to be between 0 and 360
|
|
394
|
+
dValue = (startValue + percentProperty * bearingDifference + 360) % 360
|
|
395
|
+
}
|
|
396
|
+
_.set(properties, property, dValue)
|
|
397
|
+
})
|
|
398
|
+
animatedFeatures.push(_.defaultsDeep({
|
|
399
|
+
geometry: {
|
|
400
|
+
coordinates: [dLongitude, dLatitude]
|
|
401
|
+
},
|
|
402
|
+
properties
|
|
403
|
+
}, feature))
|
|
404
|
+
})
|
|
405
|
+
layer._onNewData(_.isNil(removeMissing) ? layer.options.removeMissing : removeMissing, animatedFeatures)
|
|
406
|
+
options.id = requestAnimationFrame(options.step)
|
|
407
|
+
} else {
|
|
408
|
+
options.id = null
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
},
|
|
468
412
|
updateLayer (name, geoJson, options = {}) {
|
|
469
413
|
// Retrieve the layer
|
|
470
414
|
let layer = this.getLeafletLayerByName(name)
|
|
@@ -485,7 +429,7 @@ export const geojsonLayers = {
|
|
|
485
429
|
const removeMissing = _.get(options, 'removeMissing', layer.options.removeMissing)
|
|
486
430
|
// Check if clustering on top of a realtime layer, in this case we have a top-level container
|
|
487
431
|
let container
|
|
488
|
-
if (
|
|
432
|
+
if (layer instanceof L.MarkerClusterGroup) {
|
|
489
433
|
container = layer
|
|
490
434
|
layer = container.getLayers().find(layer => layer._container === container)
|
|
491
435
|
}
|
|
@@ -501,7 +445,23 @@ export const geojsonLayers = {
|
|
|
501
445
|
features = features.filter(feature => layer.getLayer(layer.options.getFeatureId(feature)))
|
|
502
446
|
layer.remove(features)
|
|
503
447
|
} else if (geoJson) {
|
|
504
|
-
if (typeof layer._onNewData === 'function')
|
|
448
|
+
if (typeof layer._onNewData === 'function') {
|
|
449
|
+
const duration = _.get(options, 'duration', 0)
|
|
450
|
+
if (duration) {
|
|
451
|
+
_.defaultsDeep(options, {
|
|
452
|
+
animate: {
|
|
453
|
+
geometry: { easing: { function: 'cubicBezier' }, rhumb: true }
|
|
454
|
+
}
|
|
455
|
+
})
|
|
456
|
+
// Stop any scheduled animation on the same layer
|
|
457
|
+
if (_.has(this.updateAnimations, `${name}.id`)) cancelAnimationFrame(_.get(this.updateAnimations, `${name}.id`))
|
|
458
|
+
options.step = this.getUpdateAnimation(name, layer, options, geoJson)
|
|
459
|
+
options.id = requestAnimationFrame(options.step)
|
|
460
|
+
_.set(this.updateAnimations, name, options)
|
|
461
|
+
} else {
|
|
462
|
+
layer._onNewData(removeMissing, geoJson)
|
|
463
|
+
}
|
|
464
|
+
}
|
|
505
465
|
} else { // Fetch new data or update in place
|
|
506
466
|
if (layer.tiledLayer) layer.tiledLayer.redraw()
|
|
507
467
|
else if (typeof layer.update === 'function') layer.update()
|
|
@@ -524,19 +484,7 @@ export const geojsonLayers = {
|
|
|
524
484
|
},
|
|
525
485
|
onCurrentTimeChangedGeoJsonLayers (time) {
|
|
526
486
|
// Need to update layers that require an update at a given frequency
|
|
527
|
-
const geoJsonlayers = _.values(this.layers).filter(sift(
|
|
528
|
-
// Possible for realtime layers only
|
|
529
|
-
'leaflet.type': 'geoJson',
|
|
530
|
-
'leaflet.realtime': true,
|
|
531
|
-
$or: [ // Supported by template URL or time-based features service
|
|
532
|
-
{ 'leaflet.sourceTemplate': { $exists: true } },
|
|
533
|
-
{ service: { $exists: true } }
|
|
534
|
-
],
|
|
535
|
-
// Skip layers powered by realtime service events
|
|
536
|
-
serviceEvents: { $ne: true },
|
|
537
|
-
// Skip invisible layers
|
|
538
|
-
isVisible: true
|
|
539
|
-
}))
|
|
487
|
+
const geoJsonlayers = _.values(this.layers).filter(sift(GeoJsonLeafletLayerFilters.TimeUpdate))
|
|
540
488
|
geoJsonlayers.forEach(async geoJsonlayer => {
|
|
541
489
|
// Retrieve the layer
|
|
542
490
|
const layer = this.getLeafletLayerByName(geoJsonlayer.name)
|
|
@@ -573,27 +521,10 @@ export const geojsonLayers = {
|
|
|
573
521
|
const units = _.map(Units.getUnits(quantity), 'name')
|
|
574
522
|
// Need to update layers with variables affected by the unit change,
|
|
575
523
|
// ie which style depends on it
|
|
576
|
-
let geoJsonlayers = _.values(this.layers).filter(sift(
|
|
577
|
-
'leaflet.type': 'geoJson',
|
|
578
|
-
'leaflet.realtime': true,
|
|
579
|
-
// Not sure why but this does not seem to work with sift
|
|
580
|
-
//'variables': { $elemMatch: { unit: { $in: units } } },
|
|
581
|
-
'variables': { $exists: true },
|
|
582
|
-
isVisible: true,
|
|
583
|
-
'leaflet.style': { $exists: true },
|
|
584
|
-
'leaflet.template': { $exists: true }
|
|
585
|
-
}))
|
|
524
|
+
let geoJsonlayers = _.values(this.layers).filter(sift(GeoJsonLeafletLayerFilters.UnitUpdate))
|
|
586
525
|
// Check for each layer if it uses the target unit and templated style uses the unit system or not
|
|
587
526
|
geoJsonlayers = geoJsonlayers.filter(layer => {
|
|
588
|
-
|
|
589
|
-
if (_.isEmpty(unit)) return false
|
|
590
|
-
for (const template of layer.leaflet.template) {
|
|
591
|
-
if (template.startsWith('style.')) {
|
|
592
|
-
const style = _.get(layer.leaflet, template)
|
|
593
|
-
if ((typeof style === 'string') && style.includes('Units')) return true
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
return false
|
|
527
|
+
return hasUnitInLeafletLayerTemplate(units, layer)
|
|
597
528
|
})
|
|
598
529
|
// Then retrieve the engine layers and update
|
|
599
530
|
geoJsonlayers.forEach(layer => {
|
|
@@ -609,17 +540,7 @@ export const geojsonLayers = {
|
|
|
609
540
|
onMapZoomChangedGeoJsonLayers () {
|
|
610
541
|
// Need to update layers with tooltip defining a minZoom/maxZoom
|
|
611
542
|
// as we cannot do that in template because tooltip needs to be recreated/destroyed dynamically
|
|
612
|
-
const geoJsonlayers = _.values(this.layers).filter(sift(
|
|
613
|
-
'leaflet.type': 'geoJson',
|
|
614
|
-
'leaflet.realtime': true,
|
|
615
|
-
isVisible: true,
|
|
616
|
-
// Supported by permanent tooltips only
|
|
617
|
-
'leaflet.tooltip.options.permanent': true,
|
|
618
|
-
$or: [
|
|
619
|
-
{ 'leaflet.tooltip.minZoom': { $exists: true } },
|
|
620
|
-
{ 'leaflet.tooltip.maxZoom': { $exists: true } }
|
|
621
|
-
]
|
|
622
|
-
}))
|
|
543
|
+
const geoJsonlayers = _.values(this.layers).filter(sift(GeoJsonLeafletLayerFilters.TooltipUpdate))
|
|
623
544
|
geoJsonlayers.forEach(async geoJsonlayer => {
|
|
624
545
|
// Retrieve the layer
|
|
625
546
|
const layer = this.getLeafletLayerByName(geoJsonlayer.name)
|
|
@@ -645,7 +566,7 @@ export const geojsonLayers = {
|
|
|
645
566
|
// Restore geojson data for in-memory layers that was hidden
|
|
646
567
|
// Directly deal with the leaflet layer instead of calling updateLayer, we are just restoring data
|
|
647
568
|
// Handle case where there's clustering on top (cf. updateLayer)
|
|
648
|
-
if (
|
|
569
|
+
if (engineLayer instanceof L.MarkerClusterGroup) {
|
|
649
570
|
const container = engineLayer
|
|
650
571
|
engineLayer = container.getLayers().find(layer => layer._container === container)
|
|
651
572
|
}
|
|
@@ -672,6 +593,8 @@ export const geojsonLayers = {
|
|
|
672
593
|
this.$engineEvents.on('layer-shown', this.onLayerShownGeoJsonLayers)
|
|
673
594
|
this.$engineEvents.on('layer-removed', this.onLayerRemovedGeoJsonLayers)
|
|
674
595
|
|
|
596
|
+
// Used to store animation options when animating a layer
|
|
597
|
+
this.updateAnimations = {}
|
|
675
598
|
// Cache where we'll store geojson data for in memory layers we'll hide
|
|
676
599
|
this.geojsonCache = {}
|
|
677
600
|
},
|
|
@@ -5,7 +5,7 @@ import sift from 'sift'
|
|
|
5
5
|
import L from 'leaflet'
|
|
6
6
|
import * as protomaps from 'protomaps-leaflet'
|
|
7
7
|
import { mapbox_style } from '@kalisio/leaflet-pmtiles'
|
|
8
|
-
import { Time, Units, TemplateContext } from '../../../../core/client/index.js'
|
|
8
|
+
import { api, Time, Units, TemplateContext } from '../../../../core/client/index.js'
|
|
9
9
|
|
|
10
10
|
export const pmtilesLayers = {
|
|
11
11
|
methods: {
|
|
@@ -13,6 +13,17 @@ export const pmtilesLayers = {
|
|
|
13
13
|
const leafletOptions = options.leaflet || options
|
|
14
14
|
// Check for valid types
|
|
15
15
|
if (leafletOptions.type !== 'pmtiles') return
|
|
16
|
+
|
|
17
|
+
// Token required by templating
|
|
18
|
+
const planetApi = (typeof options.getPlanetApi === 'function' ? options.getPlanetApi() : api)
|
|
19
|
+
const apiJwt = (planetApi.hasConfig('apiJwt') ? await planetApi.get('storage').getItem(planetApi.getConfig('apiJwt')) : null)
|
|
20
|
+
const gatewayJwt = (planetApi.hasConfig('gatewayJwt') ? await planetApi.get('storage').getItem(planetApi.getConfig('gatewayJwt')) : null)
|
|
21
|
+
|
|
22
|
+
const urlTemplate = _.get(leafletOptions, 'urlTemplate')
|
|
23
|
+
if (urlTemplate) leafletOptions.url = _.template(urlTemplate)({ apiJwt, gatewayJwt })
|
|
24
|
+
const styleTemplate = _.get(leafletOptions, 'styleTemplate')
|
|
25
|
+
if (styleTemplate) leafletOptions.style = _.template(styleTemplate)({ apiJwt, gatewayJwt })
|
|
26
|
+
|
|
16
27
|
// Optimize templating by creating compilers up-front
|
|
17
28
|
const layerStyleTemplate = _.get(leafletOptions, 'template')
|
|
18
29
|
if (layerStyleTemplate) {
|
|
@@ -37,7 +48,7 @@ export const pmtilesLayers = {
|
|
|
37
48
|
rules = mapbox_style(style, {})
|
|
38
49
|
} else {
|
|
39
50
|
// Manage templating
|
|
40
|
-
leafletOptions
|
|
51
|
+
_.get(leafletOptions, 'template', []).forEach(entry => {
|
|
41
52
|
// protomaps allows property functions with zomm/feature as input
|
|
42
53
|
const f = (zoom, feature) => {
|
|
43
54
|
const context = Object.assign({ properties: feature.props, feature, chroma, moment, Units, Time, level: this.selectedLevel }, TemplateContext.get())
|
|
@@ -45,15 +56,17 @@ export const pmtilesLayers = {
|
|
|
45
56
|
}
|
|
46
57
|
_.set(leafletOptions, entry.property, f)
|
|
47
58
|
})
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
if (style) {
|
|
60
|
+
const styleRules = _.map(style, rule => Object.assign(_.omit(rule, ['symbolizer']), {
|
|
61
|
+
symbolizer: new protomaps[rule.symbolizer.type](rule.symbolizer)
|
|
62
|
+
})
|
|
63
|
+
)
|
|
64
|
+
const isLabelSymbolizer = (rule) => typeof rule.symbolizer.place === 'function'
|
|
65
|
+
const isNotLabelSymbolizer = (rule) => !isLabelSymbolizer(rule)
|
|
66
|
+
// Support v1.x as well as v2.x
|
|
67
|
+
rules.paint_rules = rules.paintRules = _.filter(styleRules, isNotLabelSymbolizer)
|
|
68
|
+
rules.label_rules = rules.labelRules = _.filter(styleRules, isLabelSymbolizer)
|
|
69
|
+
}
|
|
57
70
|
}
|
|
58
71
|
|
|
59
72
|
return this.createLeafletLayer({
|
|
@@ -15,11 +15,10 @@ export const tiledMeshLayers = {
|
|
|
15
15
|
const colorMap = _.get(options, 'variables[0].chromajs', null)
|
|
16
16
|
if (colorMap) Object.assign(layerOptions, { chromajs: colorMap })
|
|
17
17
|
|
|
18
|
-
const apiToken = await this.$api.get('storage').getItem(this.$config('gatewayJwt'))
|
|
19
|
-
|
|
20
18
|
// Build grid source
|
|
21
19
|
const [gridKey, gridConf] = extractGridSourceConfig(options)
|
|
22
20
|
const weacastApi = (typeof options.getPlanetApi === 'function' ? options.getPlanetApi() : this.getWeacastApi())
|
|
21
|
+
const apiToken = (weacastApi.hasConfig('gatewayJwt') ? await weacastApi.get('storage').getItem(weacastApi.getConfig('gatewayJwt')) : null)
|
|
23
22
|
const gridSource = makeGridSource(gridKey, { weacastApi, apiToken })
|
|
24
23
|
gridSource.setup(gridConf)
|
|
25
24
|
if (gridSource.updateCtx) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash'
|
|
2
|
+
import 'leaflet-velocity'
|
|
2
3
|
import { Time } from '../../../../core/client/time.js'
|
|
3
4
|
import { makeGridSource, extractGridSourceConfig } from '../../../common/grid.js'
|
|
4
5
|
import { TiledWindLayer } from '../../leaflet/TiledWindLayer.js'
|
|
@@ -25,7 +26,7 @@ export const tiledWindLayers = {
|
|
|
25
26
|
vSource.setup(gridConf)
|
|
26
27
|
if (uSource.updateCtx) {
|
|
27
28
|
// define variables for source's dynamic properties
|
|
28
|
-
const gatewayToken = await
|
|
29
|
+
const gatewayToken = (weacastApi.hasConfig('gatewayJwt') ? await weacastApi.get('storage').getItem(weacastApi.getConfig('gatewayJwt')) : null)
|
|
29
30
|
if (gatewayToken) {
|
|
30
31
|
uSource.updateCtx.jwtToken = gatewayToken
|
|
31
32
|
vSource.updateCtx.jwtToken = gatewayToken
|