@kalisio/kdk 1.3.5 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nyc_output/2c5b7c8e-81db-4d2c-a7a4-02dc640d301f.json +1 -0
- package/.nyc_output/{0b8aa700-8daa-49ce-85e7-a8f8965d55f0.json → 2e74ca23-8cf0-4161-9536-f71c2a1a74bb.json} +0 -0
- package/.nyc_output/{20df4355-911a-4b16-a8ab-d3392e9f0a7f.json → 81d21e46-766a-46bc-b1b7-143ca577347a.json} +0 -0
- package/.nyc_output/a762cb58-70dc-4d39-ab69-928635affa98.json +1 -0
- package/.nyc_output/{257af0bb-96c3-465a-b5ef-a1df60078d5f.json → aaf3ebbb-f895-4d7b-9255-bc5dee832570.json} +0 -0
- package/.nyc_output/{284aebfa-23fd-425f-9d72-e4b8904dc224.json → dbeb2602-0ac2-4e66-978b-0d29548359ca.json} +0 -0
- package/.nyc_output/{5cbee06e-be6e-468a-bd78-4793ee785fe4.json → e47d1e4c-2fff-4dcb-908f-d3081162547c.json} +0 -0
- package/.nyc_output/processinfo/{2bece194-92f7-4971-a688-10604044a7fa.json → 2c5b7c8e-81db-4d2c-a7a4-02dc640d301f.json} +1 -1
- package/.nyc_output/processinfo/2e74ca23-8cf0-4161-9536-f71c2a1a74bb.json +1 -0
- package/.nyc_output/processinfo/81d21e46-766a-46bc-b1b7-143ca577347a.json +1 -0
- package/.nyc_output/processinfo/a762cb58-70dc-4d39-ab69-928635affa98.json +1 -0
- package/.nyc_output/processinfo/aaf3ebbb-f895-4d7b-9255-bc5dee832570.json +1 -0
- package/.nyc_output/processinfo/dbeb2602-0ac2-4e66-978b-0d29548359ca.json +1 -0
- package/.nyc_output/processinfo/e47d1e4c-2fff-4dcb-908f-d3081162547c.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/CHANGELOG.md +189 -67
- package/README.md +1 -1
- package/coverage/core/api/application.js.html +145 -145
- package/coverage/core/api/authentication.js.html +37 -37
- package/coverage/core/api/db.js.html +74 -74
- package/coverage/core/api/hooks/hooks.account.js.html +15 -15
- package/coverage/core/api/hooks/hooks.authentication.js.html +16 -16
- package/coverage/core/api/hooks/hooks.authorisations.js.html +112 -121
- package/coverage/core/api/hooks/hooks.devices.js.html +5 -5
- package/coverage/core/api/hooks/hooks.groups.js.html +3 -3
- package/coverage/core/api/hooks/hooks.logger.js.html +7 -7
- package/coverage/core/api/hooks/hooks.model.js.html +149 -149
- package/coverage/core/api/hooks/hooks.organisations.js.html +13 -61
- package/coverage/core/api/hooks/hooks.pusher.js.html +7 -7
- package/coverage/core/api/hooks/hooks.query.js.html +68 -32
- package/coverage/core/api/hooks/hooks.service.js.html +15 -15
- package/coverage/core/api/hooks/hooks.storage.js.html +5 -5
- package/coverage/core/api/hooks/hooks.tags.js.html +7 -7
- package/coverage/core/api/hooks/hooks.users.js.html +111 -63
- package/coverage/core/api/hooks/index.html +72 -72
- package/coverage/core/api/hooks/index.js.html +15 -15
- package/coverage/core/api/index.html +35 -35
- package/coverage/core/api/index.js.html +13 -13
- package/coverage/core/api/marshall.js.html +81 -81
- package/coverage/core/api/models/groups.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/index.html +1 -1
- package/coverage/core/api/models/organisations.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/tags.model.mongodb.js.html +1 -1
- package/coverage/core/api/models/users.model.mongodb.js.html +7 -7
- package/coverage/core/api/oauth2-handler.js.html +3 -3
- package/coverage/core/api/oauth2-verifier.js.html +5 -5
- package/coverage/core/api/services/account/account.hooks.js.html +1 -1
- package/coverage/core/api/services/account/account.service.js.html +34 -34
- package/coverage/core/api/services/account/index.html +17 -17
- package/coverage/core/api/services/authorisations/authorisations.hooks.js.html +3 -3
- package/coverage/core/api/services/authorisations/authorisations.service.js.html +40 -37
- package/coverage/core/api/services/authorisations/index.html +17 -17
- package/coverage/core/api/services/databases/databases.hooks.js.html +1 -1
- package/coverage/core/api/services/databases/databases.service.js.html +1 -1
- package/coverage/core/api/services/databases/index.html +1 -1
- package/coverage/core/api/services/devices/devices.hooks.js.html +1 -1
- package/coverage/core/api/services/devices/devices.service.js.html +1 -1
- package/coverage/core/api/services/devices/index.html +1 -1
- 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/index.html +5 -5
- package/coverage/core/api/services/index.js.html +40 -40
- 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/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 +1 -1
- package/coverage/core/api/services/pusher/index.html +1 -1
- package/coverage/core/api/services/pusher/pusher.channels.js.html +1 -1
- package/coverage/core/api/services/pusher/pusher.hooks.js.html +1 -1
- package/coverage/core/api/services/pusher/pusher.service.js.html +1 -1
- package/coverage/core/api/services/storage/index.html +1 -1
- package/coverage/core/api/services/storage/storage.hooks.js.html +4 -4
- 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 +1 -1
- package/coverage/core/api/services/users/users.hooks.js.html +12 -12
- package/coverage/core/common/index.html +32 -32
- package/coverage/core/common/index.js.html +27 -27
- package/coverage/core/common/permissions.js.html +135 -75
- package/coverage/index.html +157 -157
- package/coverage/lcov-report/core/api/application.js.html +145 -145
- package/coverage/lcov-report/core/api/authentication.js.html +37 -37
- package/coverage/lcov-report/core/api/db.js.html +74 -74
- package/coverage/lcov-report/core/api/hooks/hooks.account.js.html +15 -15
- package/coverage/lcov-report/core/api/hooks/hooks.authentication.js.html +16 -16
- package/coverage/lcov-report/core/api/hooks/hooks.authorisations.js.html +112 -121
- package/coverage/lcov-report/core/api/hooks/hooks.devices.js.html +5 -5
- package/coverage/lcov-report/core/api/hooks/hooks.groups.js.html +3 -3
- package/coverage/lcov-report/core/api/hooks/hooks.logger.js.html +7 -7
- package/coverage/lcov-report/core/api/hooks/hooks.model.js.html +149 -149
- package/coverage/lcov-report/core/api/hooks/hooks.organisations.js.html +13 -61
- package/coverage/lcov-report/core/api/hooks/hooks.pusher.js.html +7 -7
- package/coverage/lcov-report/core/api/hooks/hooks.query.js.html +68 -32
- package/coverage/lcov-report/core/api/hooks/hooks.service.js.html +15 -15
- package/coverage/lcov-report/core/api/hooks/hooks.storage.js.html +5 -5
- package/coverage/lcov-report/core/api/hooks/hooks.tags.js.html +7 -7
- package/coverage/lcov-report/core/api/hooks/hooks.users.js.html +111 -63
- package/coverage/lcov-report/core/api/hooks/index.html +72 -72
- package/coverage/lcov-report/core/api/hooks/index.js.html +15 -15
- package/coverage/lcov-report/core/api/index.html +35 -35
- package/coverage/lcov-report/core/api/index.js.html +13 -13
- package/coverage/lcov-report/core/api/marshall.js.html +81 -81
- package/coverage/lcov-report/core/api/models/groups.model.mongodb.js.html +1 -1
- package/coverage/lcov-report/core/api/models/index.html +1 -1
- package/coverage/lcov-report/core/api/models/organisations.model.mongodb.js.html +1 -1
- 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 +7 -7
- package/coverage/lcov-report/core/api/oauth2-handler.js.html +3 -3
- package/coverage/lcov-report/core/api/oauth2-verifier.js.html +5 -5
- 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 +34 -34
- package/coverage/lcov-report/core/api/services/account/index.html +17 -17
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.hooks.js.html +3 -3
- package/coverage/lcov-report/core/api/services/authorisations/authorisations.service.js.html +40 -37
- package/coverage/lcov-report/core/api/services/authorisations/index.html +17 -17
- package/coverage/lcov-report/core/api/services/databases/databases.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/databases/databases.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/databases/index.html +1 -1
- package/coverage/lcov-report/core/api/services/devices/devices.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/devices/devices.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/devices/index.html +1 -1
- 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/index.html +5 -5
- package/coverage/lcov-report/core/api/services/index.js.html +40 -40
- 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/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 +1 -1
- package/coverage/lcov-report/core/api/services/pusher/index.html +1 -1
- package/coverage/lcov-report/core/api/services/pusher/pusher.channels.js.html +1 -1
- package/coverage/lcov-report/core/api/services/pusher/pusher.hooks.js.html +1 -1
- package/coverage/lcov-report/core/api/services/pusher/pusher.service.js.html +1 -1
- package/coverage/lcov-report/core/api/services/storage/index.html +1 -1
- package/coverage/lcov-report/core/api/services/storage/storage.hooks.js.html +4 -4
- 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 +1 -1
- package/coverage/lcov-report/core/api/services/users/users.hooks.js.html +12 -12
- package/coverage/lcov-report/core/common/index.html +32 -32
- package/coverage/lcov-report/core/common/index.js.html +27 -27
- package/coverage/lcov-report/core/common/permissions.js.html +135 -75
- package/coverage/lcov-report/index.html +157 -157
- package/coverage/lcov-report/map/api/hooks/hooks.catalog.js.html +55 -55
- package/coverage/lcov-report/map/api/hooks/hooks.query.js.html +337 -274
- package/coverage/lcov-report/map/api/hooks/index.html +43 -43
- package/coverage/lcov-report/map/api/hooks/index.js.html +12 -12
- package/coverage/lcov-report/map/api/index.html +31 -31
- package/coverage/lcov-report/map/api/index.js.html +24 -24
- package/coverage/lcov-report/map/api/marshall.js.html +39 -39
- package/coverage/lcov-report/map/api/models/alerts.model.mongodb.js.html +20 -20
- package/coverage/lcov-report/map/api/models/catalog.model.mongodb.js.html +22 -22
- package/coverage/lcov-report/map/api/models/features.model.mongodb.js.html +24 -24
- package/coverage/lcov-report/map/api/models/index.html +43 -43
- package/coverage/lcov-report/map/api/services/alerts/alerts.hooks.js.html +21 -21
- package/coverage/lcov-report/map/api/services/alerts/alerts.service.js.html +156 -156
- package/coverage/lcov-report/map/api/services/alerts/index.html +30 -30
- package/coverage/lcov-report/map/api/services/catalog/catalog.hooks.js.html +19 -19
- package/coverage/lcov-report/map/api/services/catalog/index.html +17 -17
- 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 +20 -20
- package/coverage/lcov-report/map/api/services/features/index.html +21 -21
- package/coverage/lcov-report/map/api/services/geocoder/geocoder.hooks.js.html +8 -8
- package/coverage/lcov-report/map/api/services/geocoder/geocoder.service.js.html +99 -99
- package/coverage/lcov-report/map/api/services/geocoder/index.html +28 -28
- package/coverage/lcov-report/map/api/services/index.html +21 -21
- package/coverage/lcov-report/map/api/services/index.js.html +71 -71
- package/coverage/lcov-report/map/common/dynamic-grid-source.js.html +68 -68
- package/coverage/lcov-report/map/common/errors.js.html +9 -9
- package/coverage/lcov-report/map/common/geotiff-grid-source.js.html +120 -120
- package/coverage/lcov-report/map/common/grid.js.html +268 -268
- package/coverage/lcov-report/map/common/index.html +149 -149
- package/coverage/lcov-report/map/common/index.js.html +31 -31
- package/coverage/lcov-report/map/common/meteo-model-grid-source.js.html +71 -71
- package/coverage/lcov-report/map/common/moment-utils.js.html +14 -14
- package/coverage/lcov-report/map/common/opendap-grid-source.js.html +280 -280
- package/coverage/lcov-report/map/common/opendap-utils.js.html +220 -220
- package/coverage/lcov-report/map/common/permissions.js.html +21 -21
- package/coverage/lcov-report/map/common/time-based-grid-source.js.html +51 -51
- package/coverage/lcov-report/map/common/tms-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/wcs-grid-source.js.html +99 -99
- package/coverage/lcov-report/map/common/wcs-utils.js.html +66 -66
- package/coverage/lcov-report/map/common/weacast-grid-source.js.html +196 -196
- package/coverage/lcov-report/map/common/wfs-utils.js.html +8 -5
- package/coverage/lcov-report/map/common/wms-utils.js.html +1 -1
- package/coverage/lcov-report/map/common/wmts-utils.js.html +71 -11
- package/coverage/lcov.info +3588 -3659
- package/coverage/map/api/hooks/hooks.catalog.js.html +55 -55
- package/coverage/map/api/hooks/hooks.query.js.html +337 -274
- package/coverage/map/api/hooks/index.html +43 -43
- package/coverage/map/api/hooks/index.js.html +12 -12
- package/coverage/map/api/index.html +31 -31
- package/coverage/map/api/index.js.html +24 -24
- package/coverage/map/api/marshall.js.html +39 -39
- package/coverage/map/api/models/alerts.model.mongodb.js.html +20 -20
- package/coverage/map/api/models/catalog.model.mongodb.js.html +22 -22
- package/coverage/map/api/models/features.model.mongodb.js.html +24 -24
- package/coverage/map/api/models/index.html +43 -43
- package/coverage/map/api/services/alerts/alerts.hooks.js.html +21 -21
- package/coverage/map/api/services/alerts/alerts.service.js.html +156 -156
- package/coverage/map/api/services/alerts/index.html +30 -30
- package/coverage/map/api/services/catalog/catalog.hooks.js.html +19 -19
- package/coverage/map/api/services/catalog/index.html +17 -17
- 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 +20 -20
- package/coverage/map/api/services/features/index.html +21 -21
- package/coverage/map/api/services/geocoder/geocoder.hooks.js.html +8 -8
- package/coverage/map/api/services/geocoder/geocoder.service.js.html +99 -99
- package/coverage/map/api/services/geocoder/index.html +28 -28
- package/coverage/map/api/services/index.html +21 -21
- package/coverage/map/api/services/index.js.html +71 -71
- package/coverage/map/common/dynamic-grid-source.js.html +68 -68
- package/coverage/map/common/errors.js.html +9 -9
- package/coverage/map/common/geotiff-grid-source.js.html +120 -120
- package/coverage/map/common/grid.js.html +268 -268
- package/coverage/map/common/index.html +149 -149
- package/coverage/map/common/index.js.html +31 -31
- package/coverage/map/common/meteo-model-grid-source.js.html +71 -71
- package/coverage/map/common/moment-utils.js.html +14 -14
- package/coverage/map/common/opendap-grid-source.js.html +280 -280
- package/coverage/map/common/opendap-utils.js.html +220 -220
- package/coverage/map/common/permissions.js.html +21 -21
- package/coverage/map/common/time-based-grid-source.js.html +51 -51
- package/coverage/map/common/tms-utils.js.html +1 -1
- package/coverage/map/common/wcs-grid-source.js.html +99 -99
- package/coverage/map/common/wcs-utils.js.html +66 -66
- package/coverage/map/common/weacast-grid-source.js.html +196 -196
- package/coverage/map/common/wfs-utils.js.html +8 -5
- package/coverage/map/common/wms-utils.js.html +1 -1
- package/coverage/map/common/wmts-utils.js.html +71 -11
- package/extras/icons/kanban.png +0 -0
- package/extras/testcafe/page-models/map/catalog.js +2 -2
- package/extras/tours/core/add-member.js +10 -1
- package/extras/tours/core/{tag-member.js → edit-member-tags.js} +4 -3
- package/extras/tours/core/groups.js +8 -2
- package/extras/tours/core/members.js +11 -21
- package/extras/tours/core/tags.js +7 -1
- package/extras/tours/map/catalog-categories.js +4 -4
- package/extras/tours/map/catalog-panel.js +16 -16
- package/extras/tours/map/favorite-views.js +3 -3
- package/lib/core/api/hooks/hooks.authorisations.js +149 -140
- package/lib/core/api/hooks/hooks.authorisations.js.map +1 -1
- package/lib/core/api/hooks/hooks.organisations.js +1 -23
- package/lib/core/api/hooks/hooks.organisations.js.map +1 -1
- package/lib/core/api/hooks/hooks.query.js +22 -0
- package/lib/core/api/hooks/hooks.query.js.map +1 -1
- package/lib/core/api/hooks/hooks.users.js +34 -18
- package/lib/core/api/hooks/hooks.users.js.map +1 -1
- package/lib/core/api/services/authorisations/authorisations.service.js +34 -25
- package/lib/core/api/services/authorisations/authorisations.service.js.map +1 -1
- package/lib/core/client/api.js +1 -0
- package/lib/core/client/api.js.map +1 -1
- package/lib/core/client/components/account/KAccountDZ.vue +3 -4
- package/lib/core/client/components/account/KAccountDevices.vue +5 -6
- package/lib/core/client/components/account/KDeviceCard.vue +2 -1
- package/lib/core/client/components/account/KIdentityPanel.vue +1 -7
- package/lib/core/client/components/collection/KBoard.vue +26 -155
- package/lib/core/client/components/collection/KCard.vue +144 -42
- package/lib/core/client/components/collection/KCardSection.vue +52 -0
- package/lib/core/client/components/collection/KColumn.vue +181 -0
- package/lib/core/client/components/collection/KGrid.vue +13 -18
- package/lib/core/client/components/collection/KHistory.vue +61 -89
- package/lib/core/client/components/collection/KHistoryEntry.vue +90 -66
- package/lib/core/client/components/collection/KItem.vue +21 -2
- package/lib/core/client/components/collection/KList.vue +9 -12
- package/lib/core/client/components/collection/KTable.vue +33 -39
- package/lib/core/client/components/collection/index.js +6 -1
- package/lib/core/client/components/collection/index.js.map +1 -1
- package/lib/core/client/components/editor/KEditor.vue +0 -6
- package/lib/core/client/components/editor/KModalEditor.vue +4 -4
- package/lib/core/client/components/editor/KSettingsEditor.vue +49 -0
- package/lib/core/client/components/form/KAttachmentField.vue +10 -10
- package/lib/core/client/components/form/KChipsField.vue +28 -23
- package/lib/core/client/components/form/KColorField.vue +30 -25
- package/lib/core/client/components/form/KForm.vue +0 -12
- package/lib/core/client/components/form/KIconField.vue +1 -0
- package/lib/core/client/components/form/KItemField.vue +8 -4
- package/lib/core/client/components/form/KRoleField.vue +56 -0
- package/lib/core/client/components/form/KSelectField.vue +16 -1
- package/lib/core/client/components/form/KView.vue +5 -14
- package/lib/core/client/components/frame/KAction.vue +18 -12
- package/lib/core/client/components/frame/KAvatar.vue +3 -3
- package/lib/core/client/components/frame/KChart.vue +60 -0
- package/lib/core/client/components/frame/KChipsPane.vue +80 -0
- package/lib/core/client/components/frame/KContent.vue +1 -1
- package/lib/core/client/components/frame/KModal.vue +30 -44
- package/lib/core/client/components/frame/KPanel.vue +1 -1
- package/lib/core/client/components/frame/{KMenu.vue → KPopupAction.vue} +6 -7
- package/lib/core/client/components/frame/KSpot.vue +31 -0
- package/lib/core/client/components/frame/KStamp.vue +62 -0
- package/lib/core/client/components/frame/index.js +56 -1
- package/lib/core/client/components/frame/index.js.map +1 -1
- package/lib/core/client/components/input/KColorChooser.vue +16 -8
- package/lib/core/client/components/input/KIconChooser.vue +2 -1
- package/lib/core/client/components/input/KUploader.vue +14 -5
- package/lib/core/client/components/layout/KAbout.vue +9 -3
- package/lib/core/client/components/layout/KFab.vue +1 -1
- package/lib/core/client/components/layout/KPage.vue +44 -19
- package/lib/core/client/components/layout/KTour.vue +2 -2
- package/lib/core/client/components/layout/KWelcome.vue +13 -12
- package/lib/core/client/components/layout/KWindow.vue +1 -1
- package/lib/core/client/components/media/KImageViewer.vue +9 -7
- package/lib/core/client/components/media/KMediaBrowser.vue +12 -8
- package/lib/core/client/components/menu/KMenu.vue +103 -0
- package/lib/core/client/components/team/KAddMember.vue +17 -9
- package/lib/core/client/components/team/KChangeRole.vue +5 -7
- package/lib/core/client/components/team/KGroupCard.vue +34 -51
- package/lib/core/client/components/team/KGroupsActivity.vue +9 -2
- package/lib/core/client/components/team/KJoinGroup.vue +5 -7
- package/lib/core/client/components/team/KMemberCard.vue +104 -63
- package/lib/core/client/components/team/KMembersActivity.vue +9 -2
- package/lib/core/client/components/team/KOrganisationsActivity.vue +8 -1
- package/lib/core/client/components/team/KTagCard.vue +26 -26
- package/lib/core/client/components/team/KTagsActivity.vue +9 -2
- package/lib/core/client/components/time/KTimeRange.vue +144 -0
- package/lib/core/client/components/viewer/KModalViewer.vue +6 -0
- package/lib/core/client/components/viewer/KViewer.vue +0 -6
- package/lib/core/client/i18n/core_en.json +133 -93
- package/lib/core/client/i18n/core_fr.json +56 -16
- package/lib/core/client/index.js +28 -14
- package/lib/core/client/index.js.map +1 -1
- package/lib/core/client/mixins/mixin.authorisation.js +28 -18
- package/lib/core/client/mixins/mixin.authorisation.js.map +1 -1
- package/lib/core/client/mixins/mixin.base-collection.js +57 -9
- package/lib/core/client/mixins/mixin.base-collection.js.map +1 -1
- package/lib/core/client/mixins/mixin.base-context.js +1 -1
- package/lib/core/client/mixins/mixin.base-context.js.map +1 -1
- package/lib/core/client/mixins/mixin.base-editor.js +26 -16
- package/lib/core/client/mixins/mixin.base-editor.js.map +1 -1
- package/lib/core/client/mixins/mixin.base-field.js +0 -4
- package/lib/core/client/mixins/mixin.base-field.js.map +1 -1
- package/lib/core/client/mixins/mixin.base-item.js +29 -14
- package/lib/core/client/mixins/mixin.base-item.js.map +1 -1
- package/lib/core/client/mixins/mixin.base-viewer.js +0 -2
- package/lib/core/client/mixins/mixin.base-viewer.js.map +1 -1
- package/lib/core/client/mixins/mixin.object-proxy.js +17 -3
- package/lib/core/client/mixins/mixin.object-proxy.js.map +1 -1
- package/lib/core/client/mixins/mixin.schema-proxy.js +31 -0
- package/lib/core/client/mixins/mixin.schema-proxy.js.map +1 -1
- package/lib/core/client/mixins/mixin.service.js +5 -33
- package/lib/core/client/mixins/mixin.service.js.map +1 -1
- package/lib/core/client/services/index.js +23 -0
- package/lib/core/client/services/index.js.map +1 -1
- package/lib/core/client/services/local-settings.service.js +4 -0
- package/lib/core/client/services/local-settings.service.js.map +1 -1
- package/lib/core/client/time.js +131 -0
- package/lib/core/client/time.js.map +1 -0
- package/lib/core/common/permissions.js +65 -23
- package/lib/core/common/permissions.js.map +1 -1
- package/lib/core/common/schemas/groups.create.json +1 -1
- package/lib/core/common/schemas/groups.update.json +1 -1
- package/lib/core/common/schemas/organisations.create.json +1 -1
- package/lib/core/common/schemas/organisations.update.json +2 -2
- package/lib/core/common/schemas/settings.update.json +139 -0
- package/lib/core/common/schemas/tags.update.json +9 -1
- package/lib/map/api/hooks/hooks.query.js +48 -27
- package/lib/map/api/hooks/hooks.query.js.map +1 -1
- package/lib/map/api/services/features/features.hooks.js +1 -1
- package/lib/map/api/services/features/features.hooks.js.map +1 -1
- package/lib/map/client/components/KColorLegend.vue +25 -23
- package/lib/map/client/components/KFavoriteViews.vue +71 -35
- package/lib/map/client/components/KFeaturesChart.vue +11 -9
- package/lib/map/client/components/KFeaturesFilter.vue +15 -7
- package/lib/map/client/components/KFeaturesTable.vue +27 -2
- package/lib/map/client/components/KLayerEditionToolbar.vue +43 -0
- package/lib/map/client/components/KLayerStyleEditor.vue +10 -4
- package/lib/map/client/components/KLayerStyleForm.vue +14 -11
- package/lib/map/client/components/KLocationInput.vue +126 -65
- package/lib/map/client/components/KLocationMap.vue +199 -84
- package/lib/map/client/components/KPositionIndicator.vue +1 -0
- package/lib/map/client/components/KTimeline.vue +41 -36
- package/lib/map/client/components/KUrlLegend.vue +21 -19
- package/lib/map/client/components/catalog/KBaseLayersSelector.vue +105 -0
- package/lib/map/client/components/catalog/KCatalog.vue +14 -2
- package/lib/map/client/components/catalog/KConnectLayer.vue +31 -11
- package/lib/map/client/components/catalog/KCreateLayer.vue +37 -14
- package/lib/map/client/components/catalog/KImportLayer.vue +28 -8
- package/lib/map/client/components/catalog/KLayerCategories.vue +86 -62
- package/lib/map/client/components/catalog/KLayersSelector.vue +42 -42
- package/lib/map/client/components/catalog/KWeatherLayersSelector.vue +3 -3
- package/lib/map/client/components/form/KLocationField.vue +1 -1
- package/lib/map/client/components/form/KOwsLayerField.vue +21 -2
- package/lib/map/client/components/form/KOwsServiceField.vue +1 -0
- package/lib/map/client/components/widget/KInformationBox.vue +10 -16
- package/lib/map/client/components/widget/KMapillaryViewer.vue +59 -49
- package/lib/map/client/components/widget/KTimeSeries.vue +39 -29
- package/lib/map/client/i18n/map_en.json +65 -17
- package/lib/map/client/i18n/map_fr.json +67 -20
- package/lib/map/client/init.js +18 -6
- package/lib/map/client/init.js.map +1 -1
- package/lib/map/client/leaflet/GSMaPLayer.js +4 -9
- package/lib/map/client/leaflet/GSMaPLayer.js.map +1 -1
- package/lib/map/client/leaflet/GradientPath.js.map +1 -1
- package/lib/map/client/leaflet/MaskLayer.js +64 -0
- package/lib/map/client/leaflet/MaskLayer.js.map +1 -0
- package/lib/map/client/mixins/globe/mixin.base-globe.js +4 -1
- package/lib/map/client/mixins/globe/mixin.base-globe.js.map +1 -1
- package/lib/map/client/mixins/globe/mixin.geojson-layers.js +7 -9
- package/lib/map/client/mixins/globe/mixin.geojson-layers.js.map +1 -1
- package/lib/map/client/mixins/index.js +8 -13
- package/lib/map/client/mixins/index.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.base-map.js +30 -6
- package/lib/map/client/mixins/map/mixin.base-map.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.canvas-layers.js +274 -51
- package/lib/map/client/mixins/map/mixin.canvas-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.edit-layers.js +218 -121
- package/lib/map/client/mixins/map/mixin.edit-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.file-layers.js +25 -18
- package/lib/map/client/mixins/map/mixin.file-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.geojson-layers.js +18 -10
- package/lib/map/client/mixins/map/mixin.geojson-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.georaster-layers.js +7 -4
- package/lib/map/client/mixins/map/mixin.georaster-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.gsmap-layers.js +3 -3
- package/lib/map/client/mixins/map/mixin.gsmap-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.heatmap-layers.js +8 -10
- package/lib/map/client/mixins/map/mixin.heatmap-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.mapillary-layers.js +25 -40
- package/lib/map/client/mixins/map/mixin.mapillary-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.tiled-mesh-layers.js +5 -3
- package/lib/map/client/mixins/map/mixin.tiled-mesh-layers.js.map +1 -1
- package/lib/map/client/mixins/map/mixin.tiled-wind-layers.js +5 -3
- package/lib/map/client/mixins/map/mixin.tiled-wind-layers.js.map +1 -1
- package/lib/map/client/mixins/mixin.activity.js +60 -68
- package/lib/map/client/mixins/mixin.activity.js.map +1 -1
- package/lib/map/client/mixins/mixin.feature-selection.js +8 -10
- package/lib/map/client/mixins/mixin.feature-selection.js.map +1 -1
- package/lib/map/client/mixins/mixin.feature-service.js +7 -5
- package/lib/map/client/mixins/mixin.feature-service.js.map +1 -1
- package/lib/map/client/mixins/mixin.weacast.js +6 -4
- package/lib/map/client/mixins/mixin.weacast.js.map +1 -1
- package/lib/map/client/pixi-utils.js +9 -0
- package/lib/map/client/pixi-utils.js.map +1 -1
- package/lib/map/client/utils.js +50 -0
- package/lib/map/client/utils.js.map +1 -1
- package/lib/map/common/wfs-utils.js +1 -1
- package/lib/map/common/wfs-utils.js.map +1 -1
- package/lib/map/common/wmts-utils.js +31 -7
- package/lib/map/common/wmts-utils.js.map +1 -1
- package/lib/test/client/core/account.js +100 -0
- package/lib/test/client/core/account.js.map +1 -0
- package/lib/test/client/core/api.js +400 -0
- package/lib/test/client/core/api.js.map +1 -0
- package/lib/test/client/core/collection.js +109 -0
- package/lib/test/client/core/collection.js.map +1 -0
- package/lib/test/client/core/index.js +90 -0
- package/lib/test/client/core/index.js.map +1 -0
- package/lib/test/client/core/layout.js +221 -0
- package/lib/test/client/core/layout.js.map +1 -0
- package/lib/test/client/core/runner.js +204 -0
- package/lib/test/client/core/runner.js.map +1 -0
- package/lib/test/client/core/screens.js +68 -0
- package/lib/test/client/core/screens.js.map +1 -0
- package/lib/test/client/core/utils.js +304 -0
- package/lib/test/client/core/utils.js.map +1 -0
- package/lib/test/client/index.js +20 -0
- package/lib/test/client/index.js.map +1 -0
- package/lib/test/client/map/catalog.js +191 -0
- package/lib/test/client/map/catalog.js.map +1 -0
- package/lib/test/client/map/controls.js +54 -0
- package/lib/test/client/map/controls.js.map +1 -0
- package/lib/test/client/map/index.js +30 -0
- package/lib/test/client/map/index.js.map +1 -0
- package/package.json +17 -9
- package/test.client.js +1 -0
- package/tests/core/test-log-2021-07-15.log +71 -0
- package/tests/core/test-log-2021-09-02.log +47 -0
- package/tests/map/test-log-%DATE%.logYYYY-07-DD +12 -0
- package/tests/map/test-log-%DATE%.logYYYY-09-DD +6 -0
- package/tests/map/test-log-2021-07-12.log +12 -0
- package/tests/map/test-log-2021-07-15.log +5 -0
- package/tests/map/test-log-2021-09-02.log +3 -0
- package/.nyc_output/11cd93d8-69cb-405c-98a3-d249ea35b6da.json +0 -1
- package/.nyc_output/2bece194-92f7-4971-a688-10604044a7fa.json +0 -1
- package/.nyc_output/5ddee33e-b658-4c8e-a247-54f575ac67e8.json +0 -1
- package/.nyc_output/78760ae4-555f-4d9c-a6a1-acf5e2f0fe45.json +0 -1
- package/.nyc_output/d0bb2559-084e-4c92-b9e6-29a9abd41f7c.json +0 -1
- package/.nyc_output/processinfo/0b8aa700-8daa-49ce-85e7-a8f8965d55f0.json +0 -1
- package/.nyc_output/processinfo/11cd93d8-69cb-405c-98a3-d249ea35b6da.json +0 -1
- package/.nyc_output/processinfo/20df4355-911a-4b16-a8ab-d3392e9f0a7f.json +0 -1
- package/.nyc_output/processinfo/257af0bb-96c3-465a-b5ef-a1df60078d5f.json +0 -1
- package/.nyc_output/processinfo/284aebfa-23fd-425f-9d72-e4b8904dc224.json +0 -1
- package/.nyc_output/processinfo/5cbee06e-be6e-468a-bd78-4793ee785fe4.json +0 -1
- package/.nyc_output/processinfo/5ddee33e-b658-4c8e-a247-54f575ac67e8.json +0 -1
- package/.nyc_output/processinfo/78760ae4-555f-4d9c-a6a1-acf5e2f0fe45.json +0 -1
- package/.nyc_output/processinfo/d0bb2559-084e-4c92-b9e6-29a9abd41f7c.json +0 -1
- package/lib/core/client/components/frame/KLabel.vue +0 -56
- package/lib/core/client/components/team/KTagsPane.vue +0 -35
- package/lib/map/client/leaflet/TiledMapillaryLayer.js +0 -137
- package/lib/map/client/leaflet/TiledMapillaryLayer.js.map +0 -1
- package/lib/map/client/mixins/mixin.time.js +0 -73
- package/lib/map/client/mixins/mixin.time.js.map +0 -1
- package/tests/core/account.test.js +0 -415
- package/tests/core/client.test.js.skip +0 -37
- package/tests/core/config/default.js +0 -97
- package/tests/core/config/email-templates/confirmInvitation/html.ejs +0 -18
- package/tests/core/config/email-templates/identityChange/html.ejs +0 -12
- package/tests/core/config/email-templates/newDevice/html.ejs +0 -7
- package/tests/core/config/email-templates/passwordChange/html.ejs +0 -5
- package/tests/core/config/email-templates/resendVerifySignup/html.ejs +0 -10
- package/tests/core/config/email-templates/resetPwd/html.ejs +0 -5
- package/tests/core/config/email-templates/sendResetPwd/html.ejs +0 -8
- package/tests/core/config/email-templates/verifySignup/html.ejs +0 -3
- package/tests/core/data/10k_most_common_passwords.txt +0 -10000
- package/tests/core/data/logo.png +0 -0
- package/tests/core/hooks.test.js +0 -175
- package/tests/core/index.test.js +0 -418
- package/tests/core/notifications.test.js +0 -465
- package/tests/core/storage.test.js +0 -134
- package/tests/core/team.test.js +0 -610
- package/tests/core/utils.js +0 -59
- package/tests/map/alerts.test.js +0 -554
- package/tests/map/config/default.js +0 -112
- package/tests/map/config/layers.json +0 -37
- package/tests/map/daptiles.test.js +0 -41
- package/tests/map/data/DescribeCoverage.xml +0 -55
- package/tests/map/data/GetCoverage.tif +0 -0
- package/tests/map/data/adsb.observations.json +0 -132
- package/tests/map/data/dataset.grb.das +0 -55
- package/tests/map/data/dataset.grb.dds +0 -17
- package/tests/map/data/dataset.grb.dods +0 -0
- package/tests/map/data/lat_lon_bounds.grb.dods +0 -0
- package/tests/map/data/subdataset.grb.dods +0 -0
- package/tests/map/data/vigicrues.observations.json +0 -47042
- package/tests/map/data/vigicrues.stations.json +0 -15422
- package/tests/map/data/zones.json +0 -1228
- package/tests/map/grid-sources.test.js +0 -304
- package/tests/map/hooks.test.js +0 -96
- package/tests/map/index.test.js +0 -333
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../map/client/mixins/map/mixin.gsmap-layers.js"],"names":["methods","createLeafletGSMaPLayer","options","leafletOptions","leaflet","type","colorMap","_","get","Object","assign","chromajs","time","
|
|
1
|
+
{"version":3,"sources":["../../../../../map/client/mixins/map/mixin.gsmap-layers.js"],"names":["methods","createLeafletGSMaPLayer","options","leafletOptions","leaflet","type","colorMap","_","get","Object","assign","chromajs","time","Time","getCurrentTime","GSMaPLayer","created","registerLeafletConstructor"],"mappings":";;;;;;AAAA;;;;AACA;;AACA;;;;;;kBAEe;AACbA,WAAS;AACDC,2BAAN,CAA+BC,OAA/B,EAAwC;AAAA;AACtC,cAAMC,iBAAiBD,QAAQE,OAAR,IAAmBF,OAA1C;AACA;AACA,YAAIC,eAAeE,IAAf,KAAwB,YAA5B,EAA0C;;AAE1C;AACA,cAAMC,WAAWC,iBAAEC,GAAF,CAAMN,OAAN,EAAe,uBAAf,EAAwC,IAAxC,CAAjB;AACA,YAAII,QAAJ,EAAcG,OAAOC,MAAP,CAAcP,cAAd,EAA8B,EAAEQ,UAAUL,QAAZ,EAA9B;;AAEd;AACAH,uBAAeS,IAAf,GAAsBC,WAAKC,cAAL,EAAtB;;AAEA;AACA,eAAO,IAAIC,sBAAJ,CAAeZ,cAAf,CAAP;AAbsC;AAcvC;AAfM,GADI;AAkBba,YAAW;AACT;AACA,SAAKC,0BAAL,CAAgC,KAAKhB,uBAArC;AACD;AArBY,C","file":"mixin.gsmap-layers.js","sourcesContent":["import _ from 'lodash'\r\nimport { Time } from '../../../../core/client/time'\r\nimport { GSMaPLayer } from '../../leaflet/GSMaPLayer'\r\n\r\nexport default {\r\n methods: {\r\n async createLeafletGSMaPLayer (options) {\r\n const leafletOptions = options.leaflet || options\r\n // Check for valid type\r\n if (leafletOptions.type !== 'gsmapLayer') return\r\n\r\n // Copy options\r\n const colorMap = _.get(options, 'variables[0].chromajs', null)\r\n if (colorMap) Object.assign(leafletOptions, { chromajs: colorMap })\r\n\r\n // Add current time to options\r\n leafletOptions.time = Time.getCurrentTime()\r\n\r\n // Then create layer\r\n return new GSMaPLayer(leafletOptions)\r\n }\r\n },\r\n created () {\r\n // Register the new layer constructor\r\n this.registerLeafletConstructor(this.createLeafletGSMaPLayer)\r\n }\r\n}\r\n"]}
|
|
@@ -12,10 +12,6 @@ var _leaflet = require('leaflet');
|
|
|
12
12
|
|
|
13
13
|
var _leaflet2 = _interopRequireDefault(_leaflet);
|
|
14
14
|
|
|
15
|
-
var _moment = require('moment');
|
|
16
|
-
|
|
17
|
-
var _moment2 = _interopRequireDefault(_moment);
|
|
18
|
-
|
|
19
15
|
var _sift = require('sift');
|
|
20
16
|
|
|
21
17
|
var _sift2 = _interopRequireDefault(_sift);
|
|
@@ -28,6 +24,8 @@ var _leafletHeatmap = require('leaflet-heatmap');
|
|
|
28
24
|
|
|
29
25
|
var _leafletHeatmap2 = _interopRequireDefault(_leafletHeatmap);
|
|
30
26
|
|
|
27
|
+
var _time = require('../../../../core/client/time');
|
|
28
|
+
|
|
31
29
|
var _utils = require('../../utils');
|
|
32
30
|
|
|
33
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -53,7 +51,7 @@ exports.default = {
|
|
|
53
51
|
|
|
54
52
|
if (options.service) {
|
|
55
53
|
// Check for feature service layers
|
|
56
|
-
layer.lastUpdateTime =
|
|
54
|
+
layer.lastUpdateTime = _time.Time.getCurrentTime().clone();
|
|
57
55
|
const geoJson = yield _this.getFeatures(options);
|
|
58
56
|
_this.updateLeafletHeatmap(layer, geoJson);
|
|
59
57
|
} else if (!_lodash2.default.isNil(source)) {
|
|
@@ -62,7 +60,7 @@ exports.default = {
|
|
|
62
60
|
_this.updateLeafletHeatmap(layer, geoJson);
|
|
63
61
|
} else if (!_lodash2.default.isNil(sourceTemplate)) {
|
|
64
62
|
// Source is an URL returning GeoJson possibly templated by time
|
|
65
|
-
const sourceToFetch = layer.sourceCompiler({ time:
|
|
63
|
+
const sourceToFetch = layer.sourceCompiler({ time: _time.Time.getCurrentTime() });
|
|
66
64
|
layer.lastFetchedSource = sourceToFetch;
|
|
67
65
|
const geoJson = yield (0, _utils.fetchGeoJson)(sourceToFetch);
|
|
68
66
|
_this.updateLeafletHeatmap(layer, geoJson);
|
|
@@ -114,12 +112,12 @@ exports.default = {
|
|
|
114
112
|
// Check for feature service layers
|
|
115
113
|
// Update only the first time or when required according to data update interval
|
|
116
114
|
if (!layer.lastUpdateTime || !_this2.shouldSkipFeaturesUpdate(layer.lastUpdateTime, options)) {
|
|
117
|
-
layer.lastUpdateTime =
|
|
115
|
+
layer.lastUpdateTime = _time.Time.getCurrentTime().clone();
|
|
118
116
|
const geoJson = yield _this2.getFeatures(options);
|
|
119
117
|
_this2.updateLeafletHeatmap(layer, geoJson);
|
|
120
118
|
}
|
|
121
119
|
} else if (layer.sourceCompiler) {
|
|
122
|
-
const sourceToFetch = layer.sourceCompiler({ time:
|
|
120
|
+
const sourceToFetch = layer.sourceCompiler({ time: _time.Time.getCurrentTime() });
|
|
123
121
|
if (!layer.lastFetchedSource || layer.lastFetchedSource !== sourceToFetch) {
|
|
124
122
|
layer.lastFetchedSource = sourceToFetch;
|
|
125
123
|
const geoJson = yield (0, _utils.fetchGeoJson)(sourceToFetch);
|
|
@@ -136,10 +134,10 @@ exports.default = {
|
|
|
136
134
|
},
|
|
137
135
|
created() {
|
|
138
136
|
this.registerLeafletConstructor(this.createLeafletHeatmapLayer);
|
|
139
|
-
this.$on('current-time-changed', this.onCurrentTimeChangedHeatmapLayers);
|
|
137
|
+
this.$events.$on('time-current-time-changed', this.onCurrentTimeChangedHeatmapLayers);
|
|
140
138
|
},
|
|
141
139
|
beforeDestroy() {
|
|
142
|
-
this.$off('current-time-changed', this.onCurrentTimeChangedHeatmapLayers);
|
|
140
|
+
this.$events.$off('time-current-time-changed', this.onCurrentTimeChangedHeatmapLayers);
|
|
143
141
|
}
|
|
144
142
|
};
|
|
145
143
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../map/client/mixins/map/mixin.heatmap-layers.js"],"names":["methods","createLeafletHeatmapLayer","options","leafletOptions","leaflet","type","layer","createLeafletLayer","source","_","get","sourceTemplate","sourceCompiler","template","valueTemplate","valueCompiler","service","lastUpdateTime","currentTime","clone","moment","utc","geoJson","getFeatures","updateLeafletHeatmap","isNil","sourceToFetch","time","lastFetchedSource","valueField","min","max","values","features","map","feature","toNumber","properties","setData","data","index","location","lng","lat","updateHeatmap","name","getLeafletLayerByName","onCurrentTimeChangedHeatmapLayers","heatmaps","layers","filter","$or","$exists","variables","isVisible","forEach","shouldSkipFeaturesUpdate","created","registerLeafletConstructor","$on","beforeDestroy","$off","L","heatmap","HeatmapOverlay"],"mappings":";;;;;;AAAA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;;;kBAEe;AACbA,WAAS;AACDC,6BAAN,CAAiCC,OAAjC,EAA0C;AAAA;;AAAA;AACxC,cAAMC,iBAAiBD,QAAQE,OAAR,IAAmBF,OAA1C;AACA;AACA,YAAIC,eAAeE,IAAf,KAAwB,SAA5B,EAAuC;AACvC,cAAMC,QAAQ,MAAKC,kBAAL,CAAwBL,OAAxB,CAAd;AACA;AACA,cAAMM,SAASC,iBAAEC,GAAF,CAAMP,cAAN,EAAsB,KAAtB,CAAf;AACA,cAAMQ,iBAAiBF,iBAAEC,GAAF,CAAMP,cAAN,EAAsB,aAAtB,CAAvB;AACA,YAAIQ,cAAJ,EAAoBL,MAAMM,cAAN,GAAuBH,iBAAEI,QAAF,CAAWF,cAAX,CAAvB;AACpB,cAAMG,gBAAgBL,iBAAEC,GAAF,CAAMP,cAAN,EAAsB,eAAtB,CAAtB;AACA,YAAIW,aAAJ,EAAmBR,MAAMS,aAAN,GAAsBN,iBAAEI,QAAF,CAAWC,aAAX,CAAtB;;AAEnB,YAAIZ,QAAQc,OAAZ,EAAqB;AAAE;AACrBV,gBAAMW,cAAN,GAAwB,MAAKC,WAAL,GAAmB,MA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C,KAAKd,iCAAvC;AACD;AAhGY,C;;AAmGf;;AACAe,kBAAEC,OAAF,GAAY,UAAU7D,OAAV,EAAmB;AAC7B,SAAO,IAAI8D,wBAAJ,CAAmB9D,OAAnB,CAAP;AACD,CAFD","file":"mixin.heatmap-layers.js","sourcesContent":["import _ from 'lodash'\r\nimport L from 'leaflet'\r\nimport moment from 'moment'\r\nimport sift from 'sift'\r\nimport centroid from '@turf/centroid'\r\nimport HeatmapOverlay from 'leaflet-heatmap'\r\nimport { fetchGeoJson } from '../../utils'\r\n\r\nexport default {\r\n methods: {\r\n async createLeafletHeatmapLayer (options) {\r\n const leafletOptions = options.leaflet || options\r\n // Check for valid types\r\n if (leafletOptions.type !== 'heatmap') return\r\n const layer = this.createLeafletLayer(options)\r\n // Optimize templating by creating compilers up-front\r\n const source = _.get(leafletOptions, 'url')\r\n const sourceTemplate = _.get(leafletOptions, 'urlTemplate')\r\n if (sourceTemplate) layer.sourceCompiler = _.template(sourceTemplate)\r\n const valueTemplate = _.get(leafletOptions, 'valueTemplate')\r\n if (valueTemplate) layer.valueCompiler = _.template(valueTemplate)\r\n\r\n if (options.service) { // Check for feature service layers\r\n layer.lastUpdateTime = (this.currentTime ? this.currentTime.clone() : moment.utc())\r\n const geoJson = await this.getFeatures(options)\r\n this.updateLeafletHeatmap(layer, geoJson)\r\n } else if (!_.isNil(source)) {\r\n // Assume source is an URL returning GeoJson\r\n const geoJson = await fetchGeoJson(source)\r\n this.updateLeafletHeatmap(layer, geoJson)\r\n } else if (!_.isNil(sourceTemplate)) {\r\n // Source is an URL returning GeoJson possibly templated by time\r\n const sourceToFetch = layer.sourceCompiler({ time: this.currentTime || moment.utc() })\r\n layer.lastFetchedSource = sourceToFetch\r\n const geoJson = await fetchGeoJson(sourceToFetch)\r\n this.updateLeafletHeatmap(layer, geoJson)\r\n }\r\n\r\n return layer\r\n },\r\n updateLeafletHeatmap (layer, geoJson) {\r\n const valueField = _.get(layer, 'cfg.valueField', 'value')\r\n const min = _.get(layer, 'cfg.min')\r\n const max = _.get(layer, 'cfg.max')\r\n const values = (layer.valueCompiler\r\n ? geoJson.features.map(feature => _.toNumber(layer.valueCompiler({ properties: feature.properties, feature })))\r\n : geoJson.features.map(feature => _.toNumber(_.get(feature, `properties.${valueField}`, 1))))\r\n // By default our intensity is based on the number of points only\r\n // otherwise when provided we use target value\r\n layer.setData({\r\n min: (min || (valueField ? _.min(values) : 0)),\r\n max: (max || (valueField ? _.max(values) : 1)),\r\n data: geoJson.features.map((feature, index) => {\r\n const location = centroid(feature)\r\n return {\r\n lng: _.get(location, 'geometry.coordinates[0]'),\r\n lat: _.get(location, 'geometry.coordinates[1]'),\r\n [valueField]: values[index]\r\n }\r\n })\r\n })\r\n },\r\n updateHeatmap (name, geoJson) {\r\n // Retrieve the layer\r\n const layer = this.getLeafletLayerByName(name)\r\n if (!layer) return // Cannot update invisible layer\r\n this.updateLeafletHeatmap(layer, geoJson)\r\n },\r\n onCurrentTimeChangedHeatmapLayers (time) {\r\n const heatmaps = _.values(this.layers).filter(sift({\r\n 'leaflet.type': 'heatmap',\r\n $or: [ // Supported by template URL or time-based features\r\n { 'leaflet.urlTemplate': { $exists: true } },\r\n { service: { $exists: true }, variables: { $exists: true } }\r\n ],\r\n isVisible: true\r\n }))\r\n heatmaps.forEach(async options => {\r\n // Retrieve the layer\r\n const layer = this.getLeafletLayerByName(options.name)\r\n if (options.service) { // Check for feature service layers\r\n // Update only the first time or when required according to data update interval\r\n if (!layer.lastUpdateTime || !this.shouldSkipFeaturesUpdate(layer.lastUpdateTime, options)) {\r\n layer.lastUpdateTime = (this.currentTime ? this.currentTime.clone() : moment.utc())\r\n const geoJson = await this.getFeatures(options)\r\n this.updateLeafletHeatmap(layer, geoJson)\r\n }\r\n } else if (layer.sourceCompiler) {\r\n const sourceToFetch = layer.sourceCompiler({ time: this.currentTime || moment.utc() })\r\n if (!layer.lastFetchedSource || (layer.lastFetchedSource !== sourceToFetch)) {\r\n layer.lastFetchedSource = sourceToFetch\r\n const geoJson = await fetchGeoJson(sourceToFetch)\r\n this.updateLeafletHeatmap(layer, geoJson)\r\n }\r\n }\r\n })\r\n }\r\n },\r\n created () {\r\n this.registerLeafletConstructor(this.createLeafletHeatmapLayer)\r\n this.$on('current-time-changed', this.onCurrentTimeChangedHeatmapLayers)\r\n },\r\n beforeDestroy () {\r\n this.$off('current-time-changed', this.onCurrentTimeChangedHeatmapLayers)\r\n }\r\n}\r\n\r\n// Not automatically declared by leaflet plugin\r\nL.heatmap = function (options) {\r\n return new HeatmapOverlay(options)\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../map/client/mixins/map/mixin.heatmap-layers.js"],"names":["methods","createLeafletHeatmapLayer","options","leafletOptions","leaflet","type","layer","createLeafletLayer","source","_","get","sourceTemplate","sourceCompiler","template","valueTemplate","valueCompiler","service","lastUpdateTime","Time","getCurrentTime","clone","geoJson","getFeatures","updateLeafletHeatmap","isNil","sourceToFetch","time","lastFetchedSource","valueField","min","max","values","features","map","feature","toNumber","properties","setData","data","index","location","lng","lat","updateHeatmap","name","getLeafletLayerByName","onCurrentTimeChangedHeatmapLayers","heatmaps","layers","filter","$or","$exists","variables","isVisible","forEach","shouldSkipFeaturesUpdate","created","registerLeafletConstructor","$events","$on","beforeDestroy","$off","L","heatmap","HeatmapOverlay"],"mappings":";;;;;;AAAA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;AACA;;;;;;kBAEe;AACbA,WAAS;AACDC,6BAAN,CAAiCC,OAAjC,EAA0C;AAAA;;AAAA;AACxC,cAAMC,iBAAiBD,QAAQE,OAAR,IAAmBF,OAA1C;AACA;AACA,YAAIC,eAAeE,IAAf,KAAwB,SAA5B,EAAuC;AACvC,cAAMC,QAAQ,MAAKC,kBAAL,CAAwBL,OAAxB,CAAd;AACA;AACA,cAAMM,SAASC,iBAAEC,GAAF,CAAMP,cAAN,EAAsB,KAAtB,CAAf;AACA,cAAMQ,iBAAiBF,iBAAEC,GAAF,C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AA;AAAA;AAAA;AAmBD;AAvFM,GADI;AA0FbmC,YAAW;AACT,SAAKC,0BAAL,CAAgC,KAAKxD,yBAArC;AACA,SAAKyD,OAAL,CAAaC,GAAb,CAAiB,2BAAjB,EAA8C,KAAKb,iCAAnD;AACD,GA7FY;AA8Fbc,kBAAiB;AACf,SAAKF,OAAL,CAAaG,IAAb,CAAkB,2BAAlB,EAA+C,KAAKf,iCAApD;AACD;AAhGY,C;;AAmGf;;AACAgB,kBAAEC,OAAF,GAAY,UAAU7D,OAAV,EAAmB;AAC7B,SAAO,IAAI8D,wBAAJ,CAAmB9D,OAAnB,CAAP;AACD,CAFD","file":"mixin.heatmap-layers.js","sourcesContent":["import _ from 'lodash'\r\nimport L from 'leaflet'\r\nimport sift from 'sift'\r\nimport centroid from '@turf/centroid'\r\nimport HeatmapOverlay from 'leaflet-heatmap'\r\nimport { Time } from '../../../../core/client/time'\r\nimport { fetchGeoJson } from '../../utils'\r\n\r\nexport default {\r\n methods: {\r\n async createLeafletHeatmapLayer (options) {\r\n const leafletOptions = options.leaflet || options\r\n // Check for valid types\r\n if (leafletOptions.type !== 'heatmap') return\r\n const layer = this.createLeafletLayer(options)\r\n // Optimize templating by creating compilers up-front\r\n const source = _.get(leafletOptions, 'url')\r\n const sourceTemplate = _.get(leafletOptions, 'urlTemplate')\r\n if (sourceTemplate) layer.sourceCompiler = _.template(sourceTemplate)\r\n const valueTemplate = _.get(leafletOptions, 'valueTemplate')\r\n if (valueTemplate) layer.valueCompiler = _.template(valueTemplate)\r\n\r\n if (options.service) { // Check for feature service layers\r\n layer.lastUpdateTime = Time.getCurrentTime().clone()\r\n const geoJson = await this.getFeatures(options)\r\n this.updateLeafletHeatmap(layer, geoJson)\r\n } else if (!_.isNil(source)) {\r\n // Assume source is an URL returning GeoJson\r\n const geoJson = await fetchGeoJson(source)\r\n this.updateLeafletHeatmap(layer, geoJson)\r\n } else if (!_.isNil(sourceTemplate)) {\r\n // Source is an URL returning GeoJson possibly templated by time\r\n const sourceToFetch = layer.sourceCompiler({ time: Time.getCurrentTime() })\r\n layer.lastFetchedSource = sourceToFetch\r\n const geoJson = await fetchGeoJson(sourceToFetch)\r\n this.updateLeafletHeatmap(layer, geoJson)\r\n }\r\n\r\n return layer\r\n },\r\n updateLeafletHeatmap (layer, geoJson) {\r\n const valueField = _.get(layer, 'cfg.valueField', 'value')\r\n const min = _.get(layer, 'cfg.min')\r\n const max = _.get(layer, 'cfg.max')\r\n const values = (layer.valueCompiler\r\n ? geoJson.features.map(feature => _.toNumber(layer.valueCompiler({ properties: feature.properties, feature })))\r\n : geoJson.features.map(feature => _.toNumber(_.get(feature, `properties.${valueField}`, 1))))\r\n // By default our intensity is based on the number of points only\r\n // otherwise when provided we use target value\r\n layer.setData({\r\n min: (min || (valueField ? _.min(values) : 0)),\r\n max: (max || (valueField ? _.max(values) : 1)),\r\n data: geoJson.features.map((feature, index) => {\r\n const location = centroid(feature)\r\n return {\r\n lng: _.get(location, 'geometry.coordinates[0]'),\r\n lat: _.get(location, 'geometry.coordinates[1]'),\r\n [valueField]: values[index]\r\n }\r\n })\r\n })\r\n },\r\n updateHeatmap (name, geoJson) {\r\n // Retrieve the layer\r\n const layer = this.getLeafletLayerByName(name)\r\n if (!layer) return // Cannot update invisible layer\r\n this.updateLeafletHeatmap(layer, geoJson)\r\n },\r\n onCurrentTimeChangedHeatmapLayers (time) {\r\n const heatmaps = _.values(this.layers).filter(sift({\r\n 'leaflet.type': 'heatmap',\r\n $or: [ // Supported by template URL or time-based features\r\n { 'leaflet.urlTemplate': { $exists: true } },\r\n { service: { $exists: true }, variables: { $exists: true } }\r\n ],\r\n isVisible: true\r\n }))\r\n heatmaps.forEach(async options => {\r\n // Retrieve the layer\r\n const layer = this.getLeafletLayerByName(options.name)\r\n if (options.service) { // Check for feature service layers\r\n // Update only the first time or when required according to data update interval\r\n if (!layer.lastUpdateTime || !this.shouldSkipFeaturesUpdate(layer.lastUpdateTime, options)) {\r\n layer.lastUpdateTime = Time.getCurrentTime().clone()\r\n const geoJson = await this.getFeatures(options)\r\n this.updateLeafletHeatmap(layer, geoJson)\r\n }\r\n } else if (layer.sourceCompiler) {\r\n const sourceToFetch = layer.sourceCompiler({ time: Time.getCurrentTime() })\r\n if (!layer.lastFetchedSource || (layer.lastFetchedSource !== sourceToFetch)) {\r\n layer.lastFetchedSource = sourceToFetch\r\n const geoJson = await fetchGeoJson(sourceToFetch)\r\n this.updateLeafletHeatmap(layer, geoJson)\r\n }\r\n }\r\n })\r\n }\r\n },\r\n created () {\r\n this.registerLeafletConstructor(this.createLeafletHeatmapLayer)\r\n this.$events.$on('time-current-time-changed', this.onCurrentTimeChangedHeatmapLayers)\r\n },\r\n beforeDestroy () {\r\n this.$events.$off('time-current-time-changed', this.onCurrentTimeChangedHeatmapLayers)\r\n }\r\n}\r\n\r\n// Not automatically declared by leaflet plugin\r\nL.heatmap = function (options) {\r\n return new HeatmapOverlay(options)\r\n}\r\n"]}
|
|
@@ -12,13 +12,7 @@ var _loglevel = require('loglevel');
|
|
|
12
12
|
|
|
13
13
|
var _loglevel2 = _interopRequireDefault(_loglevel);
|
|
14
14
|
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
var Mapillary = _interopRequireWildcard(_mapillaryJs);
|
|
18
|
-
|
|
19
|
-
var _TiledMapillaryLayer = require('../../leaflet/TiledMapillaryLayer');
|
|
20
|
-
|
|
21
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
15
|
+
var _utils = require('../../utils');
|
|
22
16
|
|
|
23
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
18
|
|
|
@@ -26,58 +20,49 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, a
|
|
|
26
20
|
|
|
27
21
|
exports.default = {
|
|
28
22
|
methods: {
|
|
29
|
-
|
|
23
|
+
createLeafletMapillaryLayer(options) {
|
|
30
24
|
var _this = this;
|
|
31
25
|
|
|
32
26
|
return _asyncToGenerator(function* () {
|
|
33
27
|
const leafletOptions = options.leaflet || options;
|
|
34
28
|
// Check for valid type
|
|
35
29
|
if (leafletOptions.type !== 'mapillary') return;
|
|
36
|
-
if (typeof _this.createLeafletGeoJsonLayer !== 'function') {
|
|
37
|
-
throw new Error('Mapillary layer needs support of GeoJson layer to work correctly');
|
|
38
|
-
}
|
|
39
30
|
// Based on real-time geojson to be created first
|
|
40
|
-
const layer = yield _this.
|
|
41
|
-
featureId: 'key',
|
|
31
|
+
const layer = yield _this.createLeafletLayer(_lodash2.default.merge(options, {
|
|
42
32
|
leaflet: {
|
|
43
|
-
type: '
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
type: 'vectorGrid.protobuf',
|
|
34
|
+
source: 'https://tiles.mapillary.com/maps/vtp/mly1_public/2/{z}/{x}/{y}?access_token=' + _this.mapillaryToken,
|
|
35
|
+
interactive: true,
|
|
36
|
+
minZoom: 13,
|
|
37
|
+
maxNativeZoom: 14,
|
|
38
|
+
vectorTileLayerStyles: {
|
|
39
|
+
sequence: function (properties, zoom) {
|
|
40
|
+
return {
|
|
41
|
+
weight: zoom > 13 ? 1 : 2,
|
|
42
|
+
color: '#44BB44',
|
|
43
|
+
opacity: zoom > 13 ? 0.5 : 1
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
image: []
|
|
47
|
+
}
|
|
47
48
|
}
|
|
48
49
|
}));
|
|
49
|
-
|
|
50
|
-
const tiledLayer = new _TiledMapillaryLayer.TiledMapillaryLayer(leafletOptions);
|
|
51
|
-
tiledLayer.setup(_this, options);
|
|
52
|
-
layer.tiledLayer = tiledLayer;
|
|
53
|
-
tiledLayer.addTo(_this.map);
|
|
54
|
-
layer.on('add', function () {
|
|
55
|
-
return tiledLayer.addTo(_this.map);
|
|
56
|
-
});
|
|
57
|
-
layer.on('remove', function () {
|
|
58
|
-
return tiledLayer.removeFrom(_this.map);
|
|
59
|
-
});
|
|
60
|
-
_this.mapillaryLayer = options;
|
|
50
|
+
(0, _utils.bindLeafletEvents)(layer, _utils.LeafletEvents.Feature, _this, options);
|
|
61
51
|
return layer;
|
|
62
52
|
})();
|
|
63
53
|
}
|
|
64
54
|
},
|
|
65
55
|
created() {
|
|
66
56
|
// Initialize the component
|
|
67
|
-
this.
|
|
68
|
-
// Check whether
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
// Check whether the clientID is initailized
|
|
74
|
-
this.mapillaryClientID = this.$store.get('capabilities.api.mapillary.clientID');
|
|
75
|
-
if (!this.mapillaryClientID) {
|
|
76
|
-
_loglevel2.default.warn('You must provide a clientID to use Mapillary');
|
|
57
|
+
this.mapillaryToken = undefined;
|
|
58
|
+
// Check whether the token is initailized
|
|
59
|
+
this.mapillaryToken = this.$store.get('capabilities.api.mapillary.token');
|
|
60
|
+
if (!this.mapillaryToken) {
|
|
61
|
+
_loglevel2.default.warn('You must provide a client token to use Mapillary');
|
|
77
62
|
return;
|
|
78
63
|
}
|
|
79
64
|
// Register the mapillary coverage
|
|
80
|
-
this.registerLeafletConstructor(this.
|
|
65
|
+
this.registerLeafletConstructor(this.createLeafletMapillaryLayer);
|
|
81
66
|
}
|
|
82
67
|
};
|
|
83
68
|
module.exports = exports['default'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../map/client/mixins/map/mixin.mapillary-layers.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../../../../map/client/mixins/map/mixin.mapillary-layers.js"],"names":["methods","createLeafletMapillaryLayer","options","leafletOptions","leaflet","type","layer","createLeafletLayer","_","merge","source","mapillaryToken","interactive","minZoom","maxNativeZoom","vectorTileLayerStyles","sequence","properties","zoom","weight","color","opacity","image","LeafletEvents","Feature","created","undefined","$store","get","logger","warn","registerLeafletConstructor"],"mappings":";;;;;;AAAA;;;;AACA;;;;AACA;;;;;;kBAEe;AACbA,WAAS;AACDC,+BAAN,CAAmCC,OAAnC,EAA4C;AAAA;;AAAA;AAC1C,cAAMC,iBAAiBD,QAAQE,OAAR,IAAmBF,OAA1C;AACA;AACA,YAAIC,eAAeE,IAAf,KAAwB,WAA5B,EAAyC;AACzC;AACA,cAAMC,QAAQ,MAAM,MAAKC,kBAAL,CAAwBC,iBAAEC,KAAF,CAAQP,OAAR,EAAiB;AAC3DE,mBAAS;AACPC,kBAAM,qBADC;AAEPK,oBAAQ,iFAAiF,MAAKC,cAFvF;AAGPC,yBAAa,IAHN;AAIPC,qBAAS,EAJF;AAKPC,2BAAe,EALR;AAMPC,mCAAuB;AACrBC,wBAAU,UAAUC,UAAV,EAAsBC,IAAtB,EAA4B;AACpC,uBAAO;AACLC,0BAAQD,OAAO,EAAP,GAAY,CAAZ,GAAgB,CADnB;AAELE,yBAAO,SAFF;AAGLC,2BAASH,OAAO,EAAP,GAAY,GAAZ,GAAkB;AAHtB,iBAAP;AAKD,eAPoB;AAQrBI,qBAAO;AARc;AANhB;AADkD,SAAjB,CAAxB,CAApB;AAmBA,sCAAkBhB,KAAlB,EAAyBiB,qBAAcC,OAAvC,EAAgD,KAAhD,EAAsDtB,OAAtD;AACA,eAAOI,KAAP;AAzB0C;AA0B3C;AA3BM,GADI;AA8BbmB,YAAW;AACT;AACA,SAAKd,cAAL,GAAsBe,SAAtB;AACA;AACA,SAAKf,cAAL,GAAsB,KAAKgB,MAAL,CAAYC,GAAZ,CAAgB,kCAAhB,CAAtB;AACA,QAAI,CAAC,KAAKjB,cAAV,EAA0B;AACxBkB,yBAAOC,IAAP,CAAY,kDAAZ;AACA;AACD;AACD;AACA,SAAKC,0BAAL,CAAgC,KAAK9B,2BAArC;AACD;AAzCY,C","file":"mixin.mapillary-layers.js","sourcesContent":["import _ from 'lodash'\r\nimport logger from 'loglevel'\r\nimport { LeafletEvents, bindLeafletEvents } from '../../utils'\r\n\r\nexport default {\r\n methods: {\r\n async createLeafletMapillaryLayer (options) {\r\n const leafletOptions = options.leaflet || options\r\n // Check for valid type\r\n if (leafletOptions.type !== 'mapillary') return\r\n // Based on real-time geojson to be created first\r\n const layer = await this.createLeafletLayer(_.merge(options, {\r\n leaflet: {\r\n type: 'vectorGrid.protobuf',\r\n source: 'https://tiles.mapillary.com/maps/vtp/mly1_public/2/{z}/{x}/{y}?access_token=' + this.mapillaryToken,\r\n interactive: true,\r\n minZoom: 13,\r\n maxNativeZoom: 14,\r\n vectorTileLayerStyles: {\r\n sequence: function (properties, zoom) {\r\n return {\r\n weight: zoom > 13 ? 1 : 2,\r\n color: '#44BB44',\r\n opacity: zoom > 13 ? 0.5 : 1\r\n }\r\n },\r\n image: []\r\n }\r\n }\r\n }))\r\n bindLeafletEvents(layer, LeafletEvents.Feature, this, options)\r\n return layer\r\n }\r\n },\r\n created () {\r\n // Initialize the component\r\n this.mapillaryToken = undefined\r\n // Check whether the token is initailized\r\n this.mapillaryToken = this.$store.get('capabilities.api.mapillary.token')\r\n if (!this.mapillaryToken) {\r\n logger.warn('You must provide a client token to use Mapillary')\r\n return\r\n }\r\n // Register the mapillary coverage\r\n this.registerLeafletConstructor(this.createLeafletMapillaryLayer)\r\n }\r\n}\r\n"]}
|
|
@@ -8,6 +8,8 @@ var _lodash = require('lodash');
|
|
|
8
8
|
|
|
9
9
|
var _lodash2 = _interopRequireDefault(_lodash);
|
|
10
10
|
|
|
11
|
+
var _time = require('../../../../core/client/time');
|
|
12
|
+
|
|
11
13
|
var _grid = require('../../../common/grid');
|
|
12
14
|
|
|
13
15
|
var _TiledMeshLayer = require('../../leaflet/TiledMeshLayer');
|
|
@@ -73,7 +75,7 @@ exports.default = {
|
|
|
73
75
|
}
|
|
74
76
|
// setup layer
|
|
75
77
|
engineLayer.setModel(this.forecastModel);
|
|
76
|
-
engineLayer.setTime(
|
|
78
|
+
engineLayer.setTime(_time.Time.getCurrentTime());
|
|
77
79
|
},
|
|
78
80
|
|
|
79
81
|
onHideTiledMeshLayer(layer, engineLayer) {
|
|
@@ -124,7 +126,7 @@ exports.default = {
|
|
|
124
126
|
this.$on('layer-hidden', this.onHideTiledMeshLayer);
|
|
125
127
|
this.$on('selected-level-changed', this.onSelectedLevelChangedTiledMeshLayer);
|
|
126
128
|
this.$on('forecast-model-changed', this.onForecastModelChangedTiledMeshLayer);
|
|
127
|
-
this.$on('current-time-changed', this.onCurrentTimeChangedTiledMeshLayer);
|
|
129
|
+
this.$events.$on('time-current-time-changed', this.onCurrentTimeChangedTiledMeshLayer);
|
|
128
130
|
},
|
|
129
131
|
|
|
130
132
|
beforeDestroy() {
|
|
@@ -133,7 +135,7 @@ exports.default = {
|
|
|
133
135
|
this.$off('layer-hidden', this.onHideTiledMeshLayer);
|
|
134
136
|
this.$off('selected-level-changed', this.onSelectedLevelChangedTiledMeshLayer);
|
|
135
137
|
this.$off('forecast-model-changed', this.onForecastModelChangedTiledMeshLayer);
|
|
136
|
-
this.$off('current-time-changed', this.onCurrentTimeChangedTiledMeshLayer);
|
|
138
|
+
this.$events.$off('time-current-time-changed', this.onCurrentTimeChangedTiledMeshLayer);
|
|
137
139
|
}
|
|
138
140
|
};
|
|
139
141
|
module.exports = exports['default'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../map/client/mixins/map/mixin.tiled-mesh-layers.js"],"names":["methods","createLeafletTiledMeshLayer","options","layerOptions","leaflet","type","colorMap","_","get","Object","assign","chromajs","gridKey","gridConf","gridSource","weacastApi","setup","updateCtx","gatewayToken","$api","getItem","$config","jwtToken","meteoElements","TiledMeshLayer","updateTiledMeshLayerZoomBounds","layer","model","minZoom","name","maxZoom","updateLayerDisabled","engineLayer","getLeafletLayerByName","onAddTiledMeshLayer","forecastModel","onShowTiledMeshLayer","isTiledMeshLayer","tiledMeshLayers","set","_id","levels","setSelectableLevels","setModel","setTime","currentTime","onHideTiledMeshLayer","delete","clearSelectableLevels","onSelectedLevelChangedTiledMeshLayer","value","selectableLevelsLayer","setLevel","onForecastModelChangedTiledMeshLayer","filter","layers","forEach","onCurrentTimeChangedTiledMeshLayer","time","created","Map","registerLeafletConstructor","$on","beforeDestroy","$off"],"mappings":";;;;;;AAAA;;;;AAEA;;AACA;;;;kBAEe;AACbA,WAAS;AACPC,gCAA6BC,OAA7B,EAAsC;AACpC,YAAMC,eAAeD,QAAQE,OAAR,IAAmBF,OAAxC;;AAEA;AACA,UAAIC,aAAaE,IAAb,KAAsB,gBAA1B,EAA4C;;AAE5C;AACA,YAAMC,WAAWC,iBAAEC,GAAF,CAAMN,OAAN,EAAe,uBAAf,EAAwC,IAAxC,CAAjB;AACA,UAAII,QAAJ,EAAcG,OAAOC,MAAP,CAAcP,YAAd,EAA4B,EAAEQ,UAAUL,QAAZ,EAA5B;;AAEd;AACA,YAAM,CAACM,OAAD,EAAUC,QAAV,IAAsB,mCAAwBX,OAAxB,CAA5B;AACA,YAAMY,aAAa,0BAAeF,OAAf,EAAwB,EAAEG,YAAY,KAAKA,UAAnB,EAAxB,CAAnB;AACAD,iBAAWE,KAAX,CAAiBH,QAAjB;AACA,UAAIC,WAAWG,SAAf,EAA0B;AACxB;AACA,cAAMC,eAAe,KAAKC,IAAL,CAAUX,GAAV,CAAc,SAAd,EAAyBY,OAAzB,CAAiC,KAAKC,OAAL,CAAa,YAAb,CAAjC,CAArB;AACA,YAAIH,YAAJ,EAAkBJ,WAAWG,SAAX,CAAqBK,QAArB,GAAgCJ,YAAhC;AAClBJ,mBAAWG,SAAX,CAAqBM,aAArB,GAAqChB,iBAAEC,GAAF,CAAMN,OAAN,EAAe,eAAf,CAArC;AACD;;AAED,aAAO,IAAIsB,8BAAJ,CAAmBrB,YAAnB,EAAiCW,UAAjC,CAAP;AACD,KAvBM;;AAyBPW,mCAAgCC,KAAhC,EAAuCC,KAAvC,EAA8C;AAC5C,YAAMC,UAAUrB,iBAAEC,GAAF,CAAMkB,KAAN,EAAc,6BAA4BC,MAAME,IAAK,GAArD,CAAh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CAA8BxB,WAAD,IAAiB;AAAEA,oBAAYY,OAAZ,CAAoBc,IAApB;AAA2B,OAA3E;AACD;AAjGM,GADI;;AAqGbC,YAAW;AACT,SAAKrB,eAAL,GAAuB,IAAIsB,GAAJ,EAAvB;AACA,SAAKC,0BAAL,CAAgC,KAAK5D,2BAArC;;AAEA,SAAK6D,GAAL,CAAS,aAAT,EAAwB,KAAK5B,mBAA7B;AACA,SAAK4B,GAAL,CAAS,aAAT,EAAwB,KAAK1B,oBAA7B;AACA,SAAK0B,GAAL,CAAS,cAAT,EAAyB,KAAKhB,oBAA9B;AACA,SAAKgB,GAAL,CAAS,wBAAT,EAAmC,KAAKb,oCAAxC;AACA,SAAKa,GAAL,CAAS,wBAAT,EAAmC,KAAKT,oCAAxC;AACA,SAAKS,GAAL,CAAS,sBAAT,EAAiC,KAAKL,kCAAtC;AACD,GA/GY;;AAiHbM,kBAAiB;AACf,SAAKC,IAAL,CAAU,aAAV,EAAyB,KAAK9B,mBAA9B;AACA,SAAK8B,IAAL,CAAU,aAAV,EAAyB,KAAK5B,oBAA9B;AACA,SAAK4B,IAAL,CAAU,cAAV,EAA0B,KAAKlB,oBAA/B;AACA,SAAKkB,IAAL,CAAU,wBAAV,EAAoC,KAAKf,oCAAzC;AACA,SAAKe,IAAL,CAAU,wBAAV,EAAoC,KAAKX,oCAAzC;AACA,SAAKW,IAAL,CAAU,sBAAV,EAAkC,KAAKP,kCAAvC;AACD;AAxHY,C","file":"mixin.tiled-mesh-layers.js","sourcesContent":["import _ from 'lodash'\r\n\r\nimport { makeGridSource, extractGridSourceConfig } from '../../../common/grid'\r\nimport { TiledMeshLayer } from '../../leaflet/TiledMeshLayer'\r\n\r\nexport default {\r\n methods: {\r\n createLeafletTiledMeshLayer (options) {\r\n const layerOptions = options.leaflet || options\r\n\r\n // Check for valid type\r\n if (layerOptions.type !== 'tiledMeshLayer') return\r\n\r\n // Copy options\r\n const colorMap = _.get(options, 'variables[0].chromajs', null)\r\n if (colorMap) Object.assign(layerOptions, { chromajs: colorMap })\r\n\r\n // Build grid source\r\n const [gridKey, gridConf] = extractGridSourceConfig(options)\r\n const gridSource = makeGridSource(gridKey, { weacastApi: this.weacastApi })\r\n gridSource.setup(gridConf)\r\n if (gridSource.updateCtx) {\r\n // define variables for source's dynamic properties\r\n const gatewayToken = this.$api.get('storage').getItem(this.$config('gatewayJwt'))\r\n if (gatewayToken) gridSource.updateCtx.jwtToken = gatewayToken\r\n gridSource.updateCtx.meteoElements = _.get(options, 'meteoElements')\r\n }\r\n\r\n return new TiledMeshLayer(layerOptions, gridSource)\r\n },\r\n\r\n updateTiledMeshLayerZoomBounds (layer, model) {\r\n const minZoom = _.get(layer, `leaflet.meteoModelMinZoom[${model.name}]`)\r\n const maxZoom = _.get(layer, `leaflet.meteoModelMaxZoom[${model.name}]`)\r\n\r\n if (minZoom) layer.leaflet.minZoom = minZoom\r\n else delete layer.leaflet.minZoom\r\n if (maxZoom) layer.leaflet.maxZoom = maxZoom\r\n else delete layer.leaflet.maxZoom\r\n this.updateLayerDisabled(layer)\r\n\r\n // reflect on engine layers\r\n const engineLayer = this.getLeafletLayerByName(layer.name)\r\n if (engineLayer) {\r\n if (minZoom) engineLayer.options.minZoom = minZoom\r\n else delete engineLayer.options.minZoom\r\n if (maxZoom) engineLayer.options.maxZoom = maxZoom\r\n else delete engineLayer.options.maxZoom\r\n }\r\n },\r\n\r\n onAddTiledMeshLayer (layer) {\r\n if (!this.forecastModel || _.get(layer, 'leaflet.type') !== 'tiledMeshLayer') return\r\n this.updateTiledMeshLayerZoomBounds(layer, this.forecastModel)\r\n },\r\n\r\n onShowTiledMeshLayer (layer, engineLayer) {\r\n const isTiledMeshLayer = engineLayer instanceof TiledMeshLayer\r\n if (!isTiledMeshLayer) return\r\n\r\n // store displayed layers\r\n this.tiledMeshLayers.set(layer._id, engineLayer)\r\n const levels = _.get(layer, 'levels')\r\n if ((typeof this.setSelectableLevels === 'function') && levels) {\r\n this.setSelectableLevels(layer, levels)\r\n }\r\n // setup layer\r\n engineLayer.setModel(this.forecastModel)\r\n engineLayer.setTime(this.currentTime)\r\n },\r\n\r\n onHideTiledMeshLayer (layer, engineLayer) {\r\n const isTiledMeshLayer = engineLayer instanceof TiledMeshLayer\r\n if (!isTiledMeshLayer) return\r\n\r\n this.tiledMeshLayers.delete(layer._id)\r\n // layer being hidden, hide slider if any was required\r\n if (typeof this.clearSelectableLevels === 'function') {\r\n this.clearSelectableLevels(layer)\r\n }\r\n },\r\n\r\n onSelectedLevelChangedTiledMeshLayer (value) {\r\n if (!this.selectableLevelsLayer) return\r\n\r\n // send selected value only to associated layer\r\n const layer = this.tiledMeshLayers.get(this.selectableLevelsLayer._id)\r\n if (!layer) return\r\n\r\n layer.setLevel(value)\r\n },\r\n\r\n onForecastModelChangedTiledMeshLayer (model) {\r\n // update layer & engine layer {min,max}Zoom if required\r\n const tiledMeshLayers = _.filter(this.layers, (layer) => _.get(layer, 'leaflet.type') === 'tiledMeshLayer')\r\n for (const layer of tiledMeshLayers) this.updateTiledMeshLayerZoomBounds(layer, model)\r\n // broadcast model to visible layers\r\n this.tiledMeshLayers.forEach((engineLayer) => { engineLayer.setModel(model) })\r\n },\r\n\r\n onCurrentTimeChangedTiledMeshLayer (time) {\r\n // broadcast time to visible layers\r\n this.tiledMeshLayers.forEach((engineLayer) => { engineLayer.setTime(time) })\r\n }\r\n },\r\n\r\n created () {\r\n this.tiledMeshLayers = new Map()\r\n this.registerLeafletConstructor(this.createLeafletTiledMeshLayer)\r\n\r\n this.$on('layer-added', this.onAddTiledMeshLayer)\r\n this.$on('layer-shown', this.onShowTiledMeshLayer)\r\n this.$on('layer-hidden', this.onHideTiledMeshLayer)\r\n this.$on('selected-level-changed', this.onSelectedLevelChangedTiledMeshLayer)\r\n this.$on('forecast-model-changed', this.onForecastModelChangedTiledMeshLayer)\r\n this.$on('current-time-changed', this.onCurrentTimeChangedTiledMeshLayer)\r\n },\r\n\r\n beforeDestroy () {\r\n this.$off('layer-added', this.onAddTiledMeshLayer)\r\n this.$off('layer-shown', this.onShowTiledMeshLayer)\r\n this.$off('layer-hidden', this.onHideTiledMeshLayer)\r\n this.$off('selected-level-changed', this.onSelectedLevelChangedTiledMeshLayer)\r\n this.$off('forecast-model-changed', this.onForecastModelChangedTiledMeshLayer)\r\n this.$off('current-time-changed', this.onCurrentTimeChangedTiledMeshLayer)\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../map/client/mixins/map/mixin.tiled-mesh-layers.js"],"names":["methods","createLeafletTiledMeshLayer","options","layerOptions","leaflet","type","colorMap","_","get","Object","assign","chromajs","gridKey","gridConf","gridSource","weacastApi","setup","updateCtx","gatewayToken","$api","getItem","$config","jwtToken","meteoElements","TiledMeshLayer","updateTiledMeshLayerZoomBounds","layer","model","minZoom","name","maxZoom","updateLayerDisabled","engineLayer","getLeafletLayerByName","onAddTiledMeshLayer","forecastModel","onShowTiledMeshLayer","isTiledMeshLayer","tiledMeshLayers","set","_id","levels","setSelectableLevels","setModel","setTime","Time","getCurrentTime","onHideTiledMeshLayer","delete","clearSelectableLevels","onSelectedLevelChangedTiledMeshLayer","value","selectableLevelsLayer","setLevel","onForecastModelChangedTiledMeshLayer","filter","layers","forEach","onCurrentTimeChangedTiledMeshLayer","time","created","Map","registerLeafletConstructor","$on","$events","beforeDestroy","$off"],"mappings":";;;;;;AAAA;;;;AACA;;AACA;;AACA;;;;kBAEe;AACbA,WAAS;AACPC,gCAA6BC,OAA7B,EAAsC;AACpC,YAAMC,eAAeD,QAAQE,OAAR,IAAmBF,OAAxC;;AAEA;AACA,UAAIC,aAAaE,IAAb,KAAsB,gBAA1B,EAA4C;;AAE5C;AACA,YAAMC,WAAWC,iBAAEC,GAAF,CAAMN,OAAN,EAAe,uBAAf,EAAwC,IAAxC,CAAjB;AACA,UAAII,QAAJ,EAAcG,OAAOC,MAAP,CAAcP,YAAd,EAA4B,EAAEQ,UAAUL,QAAZ,EAA5B;;AAEd;AACA,YAAM,CAACM,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B,2BAAjB,EAA8C,KAAKL,kCAAnD;AACD,GA/GY;;AAiHbO,kBAAiB;AACf,SAAKC,IAAL,CAAU,aAAV,EAAyB,KAAKhC,mBAA9B;AACA,SAAKgC,IAAL,CAAU,aAAV,EAAyB,KAAK9B,oBAA9B;AACA,SAAK8B,IAAL,CAAU,cAAV,EAA0B,KAAKnB,oBAA/B;AACA,SAAKmB,IAAL,CAAU,wBAAV,EAAoC,KAAKhB,oCAAzC;AACA,SAAKgB,IAAL,CAAU,wBAAV,EAAoC,KAAKZ,oCAAzC;AACA,SAAKU,OAAL,CAAaE,IAAb,CAAkB,2BAAlB,EAA+C,KAAKR,kCAApD;AACD;AAxHY,C","file":"mixin.tiled-mesh-layers.js","sourcesContent":["import _ from 'lodash'\r\nimport { Time } from '../../../../core/client/time'\r\nimport { makeGridSource, extractGridSourceConfig } from '../../../common/grid'\r\nimport { TiledMeshLayer } from '../../leaflet/TiledMeshLayer'\r\n\r\nexport default {\r\n methods: {\r\n createLeafletTiledMeshLayer (options) {\r\n const layerOptions = options.leaflet || options\r\n\r\n // Check for valid type\r\n if (layerOptions.type !== 'tiledMeshLayer') return\r\n\r\n // Copy options\r\n const colorMap = _.get(options, 'variables[0].chromajs', null)\r\n if (colorMap) Object.assign(layerOptions, { chromajs: colorMap })\r\n\r\n // Build grid source\r\n const [gridKey, gridConf] = extractGridSourceConfig(options)\r\n const gridSource = makeGridSource(gridKey, { weacastApi: this.weacastApi })\r\n gridSource.setup(gridConf)\r\n if (gridSource.updateCtx) {\r\n // define variables for source's dynamic properties\r\n const gatewayToken = this.$api.get('storage').getItem(this.$config('gatewayJwt'))\r\n if (gatewayToken) gridSource.updateCtx.jwtToken = gatewayToken\r\n gridSource.updateCtx.meteoElements = _.get(options, 'meteoElements')\r\n }\r\n\r\n return new TiledMeshLayer(layerOptions, gridSource)\r\n },\r\n\r\n updateTiledMeshLayerZoomBounds (layer, model) {\r\n const minZoom = _.get(layer, `leaflet.meteoModelMinZoom[${model.name}]`)\r\n const maxZoom = _.get(layer, `leaflet.meteoModelMaxZoom[${model.name}]`)\r\n\r\n if (minZoom) layer.leaflet.minZoom = minZoom\r\n else delete layer.leaflet.minZoom\r\n if (maxZoom) layer.leaflet.maxZoom = maxZoom\r\n else delete layer.leaflet.maxZoom\r\n this.updateLayerDisabled(layer)\r\n\r\n // reflect on engine layers\r\n const engineLayer = this.getLeafletLayerByName(layer.name)\r\n if (engineLayer) {\r\n if (minZoom) engineLayer.options.minZoom = minZoom\r\n else delete engineLayer.options.minZoom\r\n if (maxZoom) engineLayer.options.maxZoom = maxZoom\r\n else delete engineLayer.options.maxZoom\r\n }\r\n },\r\n\r\n onAddTiledMeshLayer (layer) {\r\n if (!this.forecastModel || _.get(layer, 'leaflet.type') !== 'tiledMeshLayer') return\r\n this.updateTiledMeshLayerZoomBounds(layer, this.forecastModel)\r\n },\r\n\r\n onShowTiledMeshLayer (layer, engineLayer) {\r\n const isTiledMeshLayer = engineLayer instanceof TiledMeshLayer\r\n if (!isTiledMeshLayer) return\r\n\r\n // store displayed layers\r\n this.tiledMeshLayers.set(layer._id, engineLayer)\r\n const levels = _.get(layer, 'levels')\r\n if ((typeof this.setSelectableLevels === 'function') && levels) {\r\n this.setSelectableLevels(layer, levels)\r\n }\r\n // setup layer\r\n engineLayer.setModel(this.forecastModel)\r\n engineLayer.setTime(Time.getCurrentTime())\r\n },\r\n\r\n onHideTiledMeshLayer (layer, engineLayer) {\r\n const isTiledMeshLayer = engineLayer instanceof TiledMeshLayer\r\n if (!isTiledMeshLayer) return\r\n\r\n this.tiledMeshLayers.delete(layer._id)\r\n // layer being hidden, hide slider if any was required\r\n if (typeof this.clearSelectableLevels === 'function') {\r\n this.clearSelectableLevels(layer)\r\n }\r\n },\r\n\r\n onSelectedLevelChangedTiledMeshLayer (value) {\r\n if (!this.selectableLevelsLayer) return\r\n\r\n // send selected value only to associated layer\r\n const layer = this.tiledMeshLayers.get(this.selectableLevelsLayer._id)\r\n if (!layer) return\r\n\r\n layer.setLevel(value)\r\n },\r\n\r\n onForecastModelChangedTiledMeshLayer (model) {\r\n // update layer & engine layer {min,max}Zoom if required\r\n const tiledMeshLayers = _.filter(this.layers, (layer) => _.get(layer, 'leaflet.type') === 'tiledMeshLayer')\r\n for (const layer of tiledMeshLayers) this.updateTiledMeshLayerZoomBounds(layer, model)\r\n // broadcast model to visible layers\r\n this.tiledMeshLayers.forEach((engineLayer) => { engineLayer.setModel(model) })\r\n },\r\n\r\n onCurrentTimeChangedTiledMeshLayer (time) {\r\n // broadcast time to visible layers\r\n this.tiledMeshLayers.forEach((engineLayer) => { engineLayer.setTime(time) })\r\n }\r\n },\r\n\r\n created () {\r\n this.tiledMeshLayers = new Map()\r\n this.registerLeafletConstructor(this.createLeafletTiledMeshLayer)\r\n\r\n this.$on('layer-added', this.onAddTiledMeshLayer)\r\n this.$on('layer-shown', this.onShowTiledMeshLayer)\r\n this.$on('layer-hidden', this.onHideTiledMeshLayer)\r\n this.$on('selected-level-changed', this.onSelectedLevelChangedTiledMeshLayer)\r\n this.$on('forecast-model-changed', this.onForecastModelChangedTiledMeshLayer)\r\n this.$events.$on('time-current-time-changed', this.onCurrentTimeChangedTiledMeshLayer)\r\n },\r\n\r\n beforeDestroy () {\r\n this.$off('layer-added', this.onAddTiledMeshLayer)\r\n this.$off('layer-shown', this.onShowTiledMeshLayer)\r\n this.$off('layer-hidden', this.onHideTiledMeshLayer)\r\n this.$off('selected-level-changed', this.onSelectedLevelChangedTiledMeshLayer)\r\n this.$off('forecast-model-changed', this.onForecastModelChangedTiledMeshLayer)\r\n this.$events.$off('time-current-time-changed', this.onCurrentTimeChangedTiledMeshLayer)\r\n }\r\n}\r\n"]}
|
|
@@ -8,6 +8,8 @@ var _lodash = require('lodash');
|
|
|
8
8
|
|
|
9
9
|
var _lodash2 = _interopRequireDefault(_lodash);
|
|
10
10
|
|
|
11
|
+
var _time = require('../../../../core/client/time');
|
|
12
|
+
|
|
11
13
|
var _grid = require('../../../common/grid');
|
|
12
14
|
|
|
13
15
|
var _TiledWindLayer = require('../../leaflet/TiledWindLayer');
|
|
@@ -81,7 +83,7 @@ exports.default = {
|
|
|
81
83
|
|
|
82
84
|
// setup layer
|
|
83
85
|
engineLayer.setModel(this.forecastModel);
|
|
84
|
-
engineLayer.setTime(
|
|
86
|
+
engineLayer.setTime(_time.Time.getCurrentTime());
|
|
85
87
|
if (this.selectedLevel !== null) engineLayer.setLevel(this.selectedLevel);
|
|
86
88
|
},
|
|
87
89
|
|
|
@@ -134,7 +136,7 @@ exports.default = {
|
|
|
134
136
|
this.$on('layer-hidden', this.onHideTiledWindLayer);
|
|
135
137
|
this.$on('selected-level-changed', this.onSelectedLevelChangedTiledWindLayer);
|
|
136
138
|
this.$on('forecast-model-changed', this.onForecastModelChangedTiledWindLayer);
|
|
137
|
-
this.$on('current-time-changed', this.onCurrentTimeChangedTiledWindLayer);
|
|
139
|
+
this.$events.$on('time-current-time-changed', this.onCurrentTimeChangedTiledWindLayer);
|
|
138
140
|
},
|
|
139
141
|
|
|
140
142
|
beforeDestroy() {
|
|
@@ -143,7 +145,7 @@ exports.default = {
|
|
|
143
145
|
this.$off('layer-hidden', this.onHideTiledWindLayer);
|
|
144
146
|
this.$off('selected-level-changed', this.onSelectedLevelChangedTiledWindLayer);
|
|
145
147
|
this.$off('forecast-model-changed', this.onForecastModelChangedTiledWindLayer);
|
|
146
|
-
this.$off('current-time-changed', this.onCurrentTimeChangedTiledWindLayer);
|
|
148
|
+
this.$events.$off('time-current-time-changed', this.onCurrentTimeChangedTiledWindLayer);
|
|
147
149
|
}
|
|
148
150
|
};
|
|
149
151
|
module.exports = exports['default'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../map/client/mixins/map/mixin.tiled-wind-layers.js"],"names":["methods","createLeafletTiledWindLayer","options","layerOptions","leaflet","type","colorMap","_","get","Object","assign","chromajs","gridKey","gridConf","uSource","weacastApi","vSource","setup","updateCtx","gatewayToken","$api","getItem","$config","jwtToken","windComponent","TiledWindLayer","updateTiledWindLayerZoomBounds","layer","model","minZoom","name","maxZoom","updateLayerDisabled","engineLayer","getLeafletLayerByName","onAddTiledWindLayer","forecastModel","onShowTiledWindLayer","isTiledWindLayer","tiledWindLayers","set","_id","levels","setSelectableLevels","setModel","setTime","currentTime","selectedLevel","setLevel","onHideTiledWindLayer","delete","clearSelectableLevels","onForecastModelChangedTiledWindLayer","filter","layers","forEach","onCurrentTimeChangedTiledWindLayer","time","onSelectedLevelChangedTiledWindLayer","value","selectableLevelsLayer","created","Map","registerLeafletConstructor","$on","beforeDestroy","$off"],"mappings":";;;;;;AAAA;;;;AAEA;;AACA;;;;kBAEe;AACbA,WAAS;AACPC,gCAA6BC,OAA7B,EAAsC;AACpC,YAAMC,eAAeD,QAAQE,OAAR,IAAmBF,OAAxC;;AAEA;AACA,UAAIC,aAAaE,IAAb,KAAsB,gBAA1B,EAA4C;;AAE5C;AACA,YAAMC,WAAWC,iBAAEC,GAAF,CAAMN,OAAN,EAAe,uBAAf,EAAwC,IAAxC,CAAjB;AACA,UAAII,QAAJ,EAAcG,OAAOC,MAAP,CAAcP,YAAd,EAA4B,EAAEQ,UAAUL,QAAZ,EAA5B;;AAEd;AACA,YAAM,CAACM,OAAD,EAAUC,QAAV,IAAsB,mCAAwBX,OAAxB,CAA5B;AACA,YAAMY,UAAU,0BAAeF,OAAf,EAAwB,EAAEG,YAAY,KAAKA,UAAnB,EAAxB,CAAhB;AACA,YAAMC,UAAU,0BAAeJ,OAAf,EAAwB,EAAEG,YAAY,KAAKA,UAAnB,EAAxB,CAAhB;AACAD,cAAQG,KAAR,CAAcJ,QAAd;AACAG,cAAQC,KAAR,CAAcJ,QAAd;AACA,UAAIC,QAAQI,SAAZ,EAAuB;AACrB;AACA,cAAMC,eAAe,KAAKC,IAAL,CAAUZ,GAAV,CAAc,SAAd,EAAyBa,OAAzB,CAAiC,KAAKC,OAAL,CAAa,YAAb,CAAjC,CAArB;AACA,YAAIH,YAAJ,EAAk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K/B,mBAA9B;AACA,SAAK+B,IAAL,CAAU,aAAV,EAAyB,KAAK7B,oBAA9B;AACA,SAAK6B,IAAL,CAAU,cAAV,EAA0B,KAAKjB,oBAA/B;AACA,SAAKiB,IAAL,CAAU,wBAAV,EAAoC,KAAKR,oCAAzC;AACA,SAAKQ,IAAL,CAAU,wBAAV,EAAoC,KAAKd,oCAAzC;AACA,SAAKc,IAAL,CAAU,sBAAV,EAAkC,KAAKV,kCAAvC;AACD;AAlIY,C","file":"mixin.tiled-wind-layers.js","sourcesContent":["import _ from 'lodash'\r\n\r\nimport { makeGridSource, extractGridSourceConfig } from '../../../common/grid'\r\nimport { TiledWindLayer } from '../../leaflet/TiledWindLayer'\r\n\r\nexport default {\r\n methods: {\r\n createLeafletTiledWindLayer (options) {\r\n const layerOptions = options.leaflet || options\r\n\r\n // Check for valid type\r\n if (layerOptions.type !== 'tiledWindLayer') return\r\n\r\n // Copy options\r\n const colorMap = _.get(options, 'variables[0].chromajs', null)\r\n if (colorMap) Object.assign(layerOptions, { chromajs: colorMap })\r\n\r\n // Build u & v grid sources\r\n const [gridKey, gridConf] = extractGridSourceConfig(options)\r\n const uSource = makeGridSource(gridKey, { weacastApi: this.weacastApi })\r\n const vSource = makeGridSource(gridKey, { weacastApi: this.weacastApi })\r\n uSource.setup(gridConf)\r\n vSource.setup(gridConf)\r\n if (uSource.updateCtx) {\r\n // define variables for source's dynamic properties\r\n const gatewayToken = this.$api.get('storage').getItem(this.$config('gatewayJwt'))\r\n if (gatewayToken) {\r\n uSource.updateCtx.jwtToken = gatewayToken\r\n vSource.updateCtx.jwtToken = gatewayToken\r\n }\r\n uSource.updateCtx.windComponent = _.get(options, 'meteoElements[0]')\r\n vSource.updateCtx.windComponent = _.get(options, 'meteoElements[1]')\r\n }\r\n\r\n return new TiledWindLayer(layerOptions, uSource, vSource)\r\n },\r\n\r\n updateTiledWindLayerZoomBounds (layer, model) {\r\n const minZoom = _.get(layer, `leaflet.meteoModelMinZoom[${model.name}]`)\r\n const maxZoom = _.get(layer, `leaflet.meteoModelMaxZoom[${model.name}]`)\r\n\r\n if (minZoom) layer.leaflet.minZoom = minZoom\r\n else delete layer.leaflet.minZoom\r\n if (maxZoom) layer.leaflet.maxZoom = maxZoom\r\n else delete layer.leaflet.maxZoom\r\n this.updateLayerDisabled(layer)\r\n\r\n // reflect on engine layers\r\n const engineLayer = this.getLeafletLayerByName(layer.name)\r\n if (engineLayer) {\r\n if (minZoom) engineLayer.options.minZoom = minZoom\r\n else delete engineLayer.options.minZoom\r\n if (maxZoom) engineLayer.options.maxZoom = maxZoom\r\n else delete engineLayer.options.maxZoom\r\n }\r\n },\r\n\r\n onAddTiledWindLayer (layer) {\r\n if (!this.forecastModel || _.get(layer, 'leaflet.type') !== 'tiledWindLayer') return\r\n this.updateTiledWindLayerZoomBounds(layer, this.forecastModel)\r\n },\r\n\r\n onShowTiledWindLayer (layer, engineLayer) {\r\n const isTiledWindLayer = engineLayer instanceof TiledWindLayer\r\n if (!isTiledWindLayer) return\r\n\r\n // store displayed layers\r\n this.tiledWindLayers.set(layer._id, engineLayer)\r\n\r\n const levels = _.get(layer, 'levels')\r\n if ((typeof this.setSelectableLevels === 'function') && levels) {\r\n this.setSelectableLevels(layer, levels)\r\n }\r\n\r\n // setup layer\r\n engineLayer.setModel(this.forecastModel)\r\n engineLayer.setTime(this.currentTime)\r\n if (this.selectedLevel !== null) engineLayer.setLevel(this.selectedLevel)\r\n },\r\n\r\n onHideTiledWindLayer (layer, engineLayer) {\r\n const isTiledWindLayer = engineLayer instanceof TiledWindLayer\r\n if (!isTiledWindLayer) return\r\n\r\n this.tiledWindLayers.delete(layer._id)\r\n\r\n // layer being hidden, hide slider if any was required\r\n if (typeof this.clearSelectableLevels === 'function') {\r\n this.clearSelectableLevels(layer)\r\n }\r\n },\r\n\r\n onForecastModelChangedTiledWindLayer (model) {\r\n // update layer & engine layer {min,max}Zoom if required\r\n const tiledWindLayers = _.filter(this.layers, (layer) => _.get(layer, 'leaflet.type') === 'tiledWindLayer')\r\n for (const layer of tiledWindLayers) this.updateTiledWindLayerZoomBounds(layer, model)\r\n // broadcast model to visible layers\r\n this.tiledWindLayers.forEach((engineLayer) => { engineLayer.setModel(model) })\r\n },\r\n\r\n onCurrentTimeChangedTiledWindLayer (time) {\r\n // broadcast time to visible layers\r\n this.tiledWindLayers.forEach((engineLayer) => { engineLayer.setTime(time) })\r\n },\r\n\r\n onSelectedLevelChangedTiledWindLayer (value) {\r\n if (!this.selectableLevelsLayer) return\r\n\r\n // send selected value only to associated layer\r\n const layer = this.tiledWindLayers.get(this.selectableLevelsLayer._id)\r\n if (!layer) return\r\n\r\n layer.setLevel(value)\r\n }\r\n },\r\n\r\n created () {\r\n this.tiledWindLayers = new Map()\r\n this.registerLeafletConstructor(this.createLeafletTiledWindLayer)\r\n\r\n this.$on('layer-added', this.onAddTiledWindLayer)\r\n this.$on('layer-shown', this.onShowTiledWindLayer)\r\n this.$on('layer-hidden', this.onHideTiledWindLayer)\r\n this.$on('selected-level-changed', this.onSelectedLevelChangedTiledWindLayer)\r\n this.$on('forecast-model-changed', this.onForecastModelChangedTiledWindLayer)\r\n this.$on('current-time-changed', this.onCurrentTimeChangedTiledWindLayer)\r\n },\r\n\r\n beforeDestroy () {\r\n this.$off('layer-added', this.onAddTiledWindLayer)\r\n this.$off('layer-shown', this.onShowTiledWindLayer)\r\n this.$off('layer-hidden', this.onHideTiledWindLayer)\r\n this.$off('selected-level-changed', this.onSelectedLevelChangedTiledWindLayer)\r\n this.$off('forecast-model-changed', this.onForecastModelChangedTiledWindLayer)\r\n this.$off('current-time-changed', this.onCurrentTimeChangedTiledWindLayer)\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../map/client/mixins/map/mixin.tiled-wind-layers.js"],"names":["methods","createLeafletTiledWindLayer","options","layerOptions","leaflet","type","colorMap","_","get","Object","assign","chromajs","gridKey","gridConf","uSource","weacastApi","vSource","setup","updateCtx","gatewayToken","$api","getItem","$config","jwtToken","windComponent","TiledWindLayer","updateTiledWindLayerZoomBounds","layer","model","minZoom","name","maxZoom","updateLayerDisabled","engineLayer","getLeafletLayerByName","onAddTiledWindLayer","forecastModel","onShowTiledWindLayer","isTiledWindLayer","tiledWindLayers","set","_id","levels","setSelectableLevels","setModel","setTime","Time","getCurrentTime","selectedLevel","setLevel","onHideTiledWindLayer","delete","clearSelectableLevels","onForecastModelChangedTiledWindLayer","filter","layers","forEach","onCurrentTimeChangedTiledWindLayer","time","onSelectedLevelChangedTiledWindLayer","value","selectableLevelsLayer","created","Map","registerLeafletConstructor","$on","$events","beforeDestroy","$off"],"mappings":";;;;;;AAAA;;;;AACA;;AACA;;AACA;;;;kBAEe;AACbA,WAAS;AACPC,gCAA6BC,OAA7B,EAAsC;AACpC,YAAMC,eAAeD,QAAQE,OAAR,IAAmBF,OAAxC;;AAEA;AACA,UAAIC,aAAaE,IAAb,KAAsB,gBAA1B,EAA4C;;AAE5C;AACA,YAAMC,WAAWC,iBAAEC,GAAF,CAAMN,OAAN,EAAe,uBAAf,EAAwC,IAAxC,CAAjB;AACA,UAAII,QAAJ,EAAcG,OAAOC,MAAP,CAAcP,YAAd,EAA4B,EAAEQ,UAAUL,QAAZ,EAA5B;;AAEd;AACA,YAAM,CAACM,OAAD,EAAUC,QAAV,IAAsB,mCAAwBX,OAAxB,CAA5B;AACA,YAAMY,UAAU,0BAAeF,OAAf,EAAwB,EAAEG,YAAY,KAAKA,UAAnB,EAAxB,CAAhB;AACA,YAAMC,UAAU,0BAAeJ,OAAf,EAAwB,EAAEG,YAAY,KAAKA,UAAnB,EAAxB,CAAhB;AACAD,cAAQG,KAAR,CAAcJ,QAAd;AACAG,cAAQC,KAAR,CAAcJ,QAAd;AACA,UAAIC,QAAQI,SAAZ,EAAuB;AACrB;AACA,cAAMC,eAAe,KAAKC,IAAL,CAAUZ,GAAV,CAAc,SAAd,EAAyBa,OAAzB,CAAiC,KAAKC,OAAL,CAAa,YAAb,CAAjC,CAArB;A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AiB;AACf,SAAKC,IAAL,CAAU,aAAV,EAAyB,KAAKjC,mBAA9B;AACA,SAAKiC,IAAL,CAAU,aAAV,EAAyB,KAAK/B,oBAA9B;AACA,SAAK+B,IAAL,CAAU,cAAV,EAA0B,KAAKlB,oBAA/B;AACA,SAAKkB,IAAL,CAAU,wBAAV,EAAoC,KAAKT,oCAAzC;AACA,SAAKS,IAAL,CAAU,wBAAV,EAAoC,KAAKf,oCAAzC;AACA,SAAKa,OAAL,CAAaE,IAAb,CAAkB,2BAAlB,EAA+C,KAAKX,kCAApD;AACD;AAlIY,C","file":"mixin.tiled-wind-layers.js","sourcesContent":["import _ from 'lodash'\r\nimport { Time } from '../../../../core/client/time'\r\nimport { makeGridSource, extractGridSourceConfig } from '../../../common/grid'\r\nimport { TiledWindLayer } from '../../leaflet/TiledWindLayer'\r\n\r\nexport default {\r\n methods: {\r\n createLeafletTiledWindLayer (options) {\r\n const layerOptions = options.leaflet || options\r\n\r\n // Check for valid type\r\n if (layerOptions.type !== 'tiledWindLayer') return\r\n\r\n // Copy options\r\n const colorMap = _.get(options, 'variables[0].chromajs', null)\r\n if (colorMap) Object.assign(layerOptions, { chromajs: colorMap })\r\n\r\n // Build u & v grid sources\r\n const [gridKey, gridConf] = extractGridSourceConfig(options)\r\n const uSource = makeGridSource(gridKey, { weacastApi: this.weacastApi })\r\n const vSource = makeGridSource(gridKey, { weacastApi: this.weacastApi })\r\n uSource.setup(gridConf)\r\n vSource.setup(gridConf)\r\n if (uSource.updateCtx) {\r\n // define variables for source's dynamic properties\r\n const gatewayToken = this.$api.get('storage').getItem(this.$config('gatewayJwt'))\r\n if (gatewayToken) {\r\n uSource.updateCtx.jwtToken = gatewayToken\r\n vSource.updateCtx.jwtToken = gatewayToken\r\n }\r\n uSource.updateCtx.windComponent = _.get(options, 'meteoElements[0]')\r\n vSource.updateCtx.windComponent = _.get(options, 'meteoElements[1]')\r\n }\r\n\r\n return new TiledWindLayer(layerOptions, uSource, vSource)\r\n },\r\n\r\n updateTiledWindLayerZoomBounds (layer, model) {\r\n const minZoom = _.get(layer, `leaflet.meteoModelMinZoom[${model.name}]`)\r\n const maxZoom = _.get(layer, `leaflet.meteoModelMaxZoom[${model.name}]`)\r\n\r\n if (minZoom) layer.leaflet.minZoom = minZoom\r\n else delete layer.leaflet.minZoom\r\n if (maxZoom) layer.leaflet.maxZoom = maxZoom\r\n else delete layer.leaflet.maxZoom\r\n this.updateLayerDisabled(layer)\r\n\r\n // reflect on engine layers\r\n const engineLayer = this.getLeafletLayerByName(layer.name)\r\n if (engineLayer) {\r\n if (minZoom) engineLayer.options.minZoom = minZoom\r\n else delete engineLayer.options.minZoom\r\n if (maxZoom) engineLayer.options.maxZoom = maxZoom\r\n else delete engineLayer.options.maxZoom\r\n }\r\n },\r\n\r\n onAddTiledWindLayer (layer) {\r\n if (!this.forecastModel || _.get(layer, 'leaflet.type') !== 'tiledWindLayer') return\r\n this.updateTiledWindLayerZoomBounds(layer, this.forecastModel)\r\n },\r\n\r\n onShowTiledWindLayer (layer, engineLayer) {\r\n const isTiledWindLayer = engineLayer instanceof TiledWindLayer\r\n if (!isTiledWindLayer) return\r\n\r\n // store displayed layers\r\n this.tiledWindLayers.set(layer._id, engineLayer)\r\n\r\n const levels = _.get(layer, 'levels')\r\n if ((typeof this.setSelectableLevels === 'function') && levels) {\r\n this.setSelectableLevels(layer, levels)\r\n }\r\n\r\n // setup layer\r\n engineLayer.setModel(this.forecastModel)\r\n engineLayer.setTime(Time.getCurrentTime())\r\n if (this.selectedLevel !== null) engineLayer.setLevel(this.selectedLevel)\r\n },\r\n\r\n onHideTiledWindLayer (layer, engineLayer) {\r\n const isTiledWindLayer = engineLayer instanceof TiledWindLayer\r\n if (!isTiledWindLayer) return\r\n\r\n this.tiledWindLayers.delete(layer._id)\r\n\r\n // layer being hidden, hide slider if any was required\r\n if (typeof this.clearSelectableLevels === 'function') {\r\n this.clearSelectableLevels(layer)\r\n }\r\n },\r\n\r\n onForecastModelChangedTiledWindLayer (model) {\r\n // update layer & engine layer {min,max}Zoom if required\r\n const tiledWindLayers = _.filter(this.layers, (layer) => _.get(layer, 'leaflet.type') === 'tiledWindLayer')\r\n for (const layer of tiledWindLayers) this.updateTiledWindLayerZoomBounds(layer, model)\r\n // broadcast model to visible layers\r\n this.tiledWindLayers.forEach((engineLayer) => { engineLayer.setModel(model) })\r\n },\r\n\r\n onCurrentTimeChangedTiledWindLayer (time) {\r\n // broadcast time to visible layers\r\n this.tiledWindLayers.forEach((engineLayer) => { engineLayer.setTime(time) })\r\n },\r\n\r\n onSelectedLevelChangedTiledWindLayer (value) {\r\n if (!this.selectableLevelsLayer) return\r\n\r\n // send selected value only to associated layer\r\n const layer = this.tiledWindLayers.get(this.selectableLevelsLayer._id)\r\n if (!layer) return\r\n\r\n layer.setLevel(value)\r\n }\r\n },\r\n\r\n created () {\r\n this.tiledWindLayers = new Map()\r\n this.registerLeafletConstructor(this.createLeafletTiledWindLayer)\r\n\r\n this.$on('layer-added', this.onAddTiledWindLayer)\r\n this.$on('layer-shown', this.onShowTiledWindLayer)\r\n this.$on('layer-hidden', this.onHideTiledWindLayer)\r\n this.$on('selected-level-changed', this.onSelectedLevelChangedTiledWindLayer)\r\n this.$on('forecast-model-changed', this.onForecastModelChangedTiledWindLayer)\r\n this.$events.$on('time-current-time-changed', this.onCurrentTimeChangedTiledWindLayer)\r\n },\r\n\r\n beforeDestroy () {\r\n this.$off('layer-added', this.onAddTiledWindLayer)\r\n this.$off('layer-shown', this.onShowTiledWindLayer)\r\n this.$off('layer-hidden', this.onHideTiledWindLayer)\r\n this.$off('selected-level-changed', this.onSelectedLevelChangedTiledWindLayer)\r\n this.$off('forecast-model-changed', this.onForecastModelChangedTiledWindLayer)\r\n this.$events.$off('time-current-time-changed', this.onCurrentTimeChangedTiledWindLayer)\r\n }\r\n}\r\n"]}
|