@kalisio/kdk 2.1.9 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.test.sh +42 -10
- package/README.md +2 -2
- package/core/api/application.js +7 -2
- package/core/api/authentication.js +17 -1
- package/core/api/db.js +7 -2
- package/core/api/hooks/hooks.authentication.js +4 -2
- package/core/api/hooks/hooks.authorisations.js +12 -2
- package/core/api/hooks/hooks.model.js +5 -5
- package/core/api/hooks/hooks.organisations.js +0 -4
- package/core/api/services/account/account.hooks.js +10 -6
- package/core/api/services/account/account.service.js +1 -1
- package/{map/api/services/geocoder/geocoder.hooks.js → core/api/services/import-export/import-export.hooks.js} +7 -5
- package/core/api/services/import-export/import-export.service.js +11 -0
- package/core/api/services/index.js +13 -1
- package/core/api/services/users/users.hooks.js +2 -3
- package/core/client/api.js +16 -14
- package/core/client/capabilities.js +6 -2
- package/core/client/components/KContent.vue +11 -1
- package/core/client/components/KDialog.vue +17 -15
- package/core/client/components/KModal.vue +1 -1
- package/core/client/components/KSponsor.vue +1 -1
- package/core/client/components/KTextArea.vue +5 -1
- package/core/client/components/app/KAbout.vue +1 -2
- package/core/client/components/app/KWelcome.vue +3 -5
- package/core/client/components/chart/KTimeSeriesChart.vue +24 -37
- package/core/client/components/collection/KColumn.vue +20 -17
- package/core/client/components/editor/KModalEditor.vue +0 -2
- package/core/client/components/form/KChipsField.vue +12 -2
- package/core/client/components/form/KColorField.vue +12 -2
- package/core/client/components/form/KColorScaleField.vue +12 -2
- package/core/client/components/form/KDateTimeRangeField.vue +12 -2
- package/core/client/components/form/KDatetimeField.vue +12 -2
- package/core/client/components/form/KEmailField.vue +12 -2
- package/core/client/components/form/KFileField.vue +12 -2
- package/core/client/components/form/KForm.vue +47 -9
- package/core/client/components/form/KIconField.vue +12 -2
- package/core/client/components/form/KItemField.vue +25 -4
- package/core/client/components/form/KNumberField.vue +12 -2
- package/core/client/components/form/KOptionsField.vue +12 -2
- package/core/client/components/form/KPasswordField.vue +12 -2
- package/core/client/components/form/KPhoneField.vue +13 -3
- package/core/client/components/form/KPropertyItemField.vue +12 -2
- package/core/client/components/form/KResolutionField.vue +126 -0
- package/core/client/components/form/KRoleField.vue +12 -2
- package/core/client/components/form/KSelectField.vue +14 -4
- package/core/client/components/form/KTextField.vue +12 -2
- package/core/client/components/form/KTextareaField.vue +13 -3
- package/core/client/components/form/KToggleField.vue +12 -2
- package/core/client/components/form/KTokenField.vue +12 -2
- package/core/client/components/form/KUnitField.vue +12 -2
- package/core/client/components/form/KUrlField.vue +12 -2
- package/core/client/components/input/KIconChooser.vue +10 -12
- package/core/client/components/input/KPalette.vue +2 -1
- package/core/client/components/layout/KPage.vue +5 -4
- package/core/client/components/layout/KWindow.vue +10 -10
- package/core/client/components/media/KColorScale.vue +25 -19
- package/core/client/components/media/KImageViewer.vue +57 -33
- package/core/client/components/media/KShape.vue +14 -103
- package/core/client/components/screen/KRegisterScreen.vue +0 -1
- package/core/client/components/screen/KScreenFooter.vue +0 -18
- package/core/client/components/team/KAddMember.vue +16 -22
- package/core/client/components/team/KGroupsActivity.vue +14 -0
- package/core/client/components/team/KMembersActivity.vue +12 -0
- package/core/client/components/team/KTagsActivity.vue +14 -0
- package/core/client/components/time/KDateTime.vue +23 -7
- package/core/client/components/time/KTimeControl.vue +142 -0
- package/core/client/components/tool/KExportTool.vue +57 -0
- package/core/client/composables/collection.js +0 -1
- package/core/client/composables/pwa.js +0 -1
- package/core/client/composables/schema.js +1 -1
- package/core/client/composables/session.js +30 -6
- package/core/client/exporter.js +147 -0
- package/core/client/i18n/core_en.json +91 -23
- package/core/client/i18n/core_fr.json +92 -23
- package/core/client/index.js +3 -0
- package/core/client/layout.js +34 -14
- package/core/client/local-storage.js +8 -6
- package/core/client/mixins/index.js +0 -1
- package/core/client/mixins/mixin.base-field.js +24 -2
- package/core/client/mixins/mixin.object-proxy.js +0 -1
- package/core/client/search.js +2 -1
- package/core/client/services/index.js +2 -1
- package/core/client/services/local-settings.service.js +4 -4
- package/core/client/theme.js +3 -3
- package/core/client/time.js +4 -0
- package/core/client/units.js +150 -5
- package/core/client/utils/index.js +13 -6
- package/core/client/utils/utils.account.js +1 -1
- package/core/client/utils/utils.colors.js +43 -0
- package/core/client/utils/utils.platform.js +0 -1
- package/core/client/utils/utils.pwa.js +14 -14
- package/core/client/utils/utils.session.js +1 -1
- package/core/client/utils/utils.shapes.js +270 -0
- package/core/client/utils/utils.time.js +37 -0
- package/core/common/permissions.js +3 -0
- package/core/common/schemas/settings.update.json +50 -29
- package/extras/css/core.variables.scss +3 -1
- package/extras/icons/wind-speed-0.svg +8 -0
- package/extras/icons/wind-speed-10.svg +8 -0
- package/extras/icons/wind-speed-100.svg +12 -0
- package/extras/icons/wind-speed-105.svg +13 -0
- package/extras/icons/wind-speed-15.svg +9 -0
- package/extras/icons/wind-speed-20.svg +9 -0
- package/extras/icons/wind-speed-25.svg +10 -0
- package/extras/icons/wind-speed-30.svg +10 -0
- package/extras/icons/wind-speed-35.svg +11 -0
- package/extras/icons/wind-speed-40.svg +11 -0
- package/extras/icons/wind-speed-45.svg +12 -0
- package/extras/icons/wind-speed-5.svg +9 -0
- package/extras/icons/wind-speed-50.svg +9 -0
- package/extras/icons/wind-speed-55.svg +10 -0
- package/extras/icons/wind-speed-60.svg +10 -0
- package/extras/icons/wind-speed-65.svg +11 -0
- package/extras/icons/wind-speed-70.svg +11 -0
- package/extras/icons/wind-speed-75.svg +12 -0
- package/extras/icons/wind-speed-80.svg +12 -0
- package/extras/icons/wind-speed-85.svg +13 -0
- package/extras/icons/wind-speed-90.svg +13 -0
- package/extras/icons/wind-speed-95.svg +14 -0
- package/extras/tours/map/navigation-bar.js +17 -15
- package/extras/tours/map/timeline.js +33 -33
- package/map/api/config/categories.cjs +4 -1
- package/map/api/hooks/hooks.catalog.js +39 -0
- package/map/api/hooks/hooks.features.js +23 -3
- package/map/api/hooks/hooks.query.js +65 -21
- package/map/api/models/projects.model.mongodb.js +8 -0
- package/map/api/services/catalog/catalog.hooks.js +5 -3
- package/map/api/services/features/features.hooks.js +18 -6
- package/map/api/services/index.js +22 -6
- package/map/api/services/projects/projects.hooks.js +118 -0
- package/map/client/capture.js +16 -0
- package/map/client/cesium/utils/index.js +4 -0
- package/map/client/cesium/utils/utils.events.js +30 -0
- package/map/client/cesium/utils/utils.features.js +8 -0
- package/map/client/cesium/utils/utils.popup.js +17 -0
- package/map/client/cesium/utils/utils.style.js +137 -0
- package/map/client/components/KCapture.vue +50 -0
- package/map/client/components/KCaptureTextArea.vue +53 -0
- package/map/client/components/KCompass.vue +2 -2
- package/map/client/components/KFeaturesChart.vue +1 -1
- package/map/client/components/KFeaturesFilter.vue +2 -2
- package/map/client/components/KLayerStyleForm.vue +288 -454
- package/map/client/components/KLevelSlider.vue +1 -1
- package/map/client/components/KNorth.vue +31 -0
- package/map/client/components/KProjectMenu.vue +88 -0
- package/map/client/components/KTimezoneMap.vue +36 -24
- package/map/client/components/catalog/KAddLayer.vue +3 -4
- package/map/client/components/catalog/KConnectLayer.vue +20 -4
- package/map/client/components/catalog/KCreateLayer.vue +1 -2
- package/map/client/components/catalog/KCreateProject.vue +100 -0
- package/map/client/components/catalog/KCreateView.vue +25 -2
- package/map/client/components/catalog/KLayersPanel.vue +24 -27
- package/map/client/components/catalog/KLayersSelector.vue +1 -1
- package/map/client/components/catalog/KProjectEditor.vue +91 -0
- package/map/client/components/catalog/KProjectManager.vue +60 -0
- package/map/client/components/catalog/KProjectSelector.vue +38 -0
- package/map/client/components/catalog/KProjectsPanel.vue +153 -0
- package/map/client/components/catalog/KSelectLayers.vue +96 -0
- package/map/client/components/catalog/KSelectViews.vue +96 -0
- package/map/client/components/catalog/KViewsPanel.vue +66 -30
- package/map/client/components/form/KDirectionField.vue +24 -5
- package/map/client/components/form/KLayerCategoryField.vue +12 -2
- package/map/client/components/form/KLocationField.vue +20 -5
- package/map/client/components/form/KOwsLayerField.vue +12 -2
- package/map/client/components/form/KOwsServiceField.vue +12 -2
- package/map/client/components/form/KSelectLayersField.vue +159 -0
- package/map/client/components/form/KSelectViewsField.vue +121 -0
- package/map/client/components/form/KTimezoneField.vue +24 -17
- package/map/client/components/legend/KColorScaleLegend.vue +6 -2
- package/map/client/components/legend/KLayerLegend.vue +71 -0
- package/map/client/components/legend/KLegend.vue +54 -51
- package/map/client/components/legend/KLegendRenderer.vue +5 -3
- package/map/client/components/legend/KSymbolsLegend.vue +12 -10
- package/map/client/components/legend/KVariablesLegend.vue +78 -0
- package/map/client/components/location/KGeocodersFilter.vue +2 -4
- package/map/client/components/location/KLocationCardSection.vue +8 -4
- package/map/client/components/location/KLocationMap.vue +48 -17
- package/map/client/components/location/KLocationSearch.vue +13 -3
- package/map/client/components/tools/KSearchTool.vue +17 -12
- package/map/client/components/widget/KElevationProfile.vue +16 -19
- package/map/client/components/widget/KMapillaryViewer.vue +21 -22
- package/map/client/components/widget/KTimeSeries.vue +35 -29
- package/map/client/composables/activity.js +15 -2
- package/map/client/composables/catalog.js +81 -0
- package/map/client/composables/highlight.js +45 -30
- package/map/client/composables/index.js +2 -0
- package/map/client/composables/location.js +25 -18
- package/map/client/composables/probe.js +4 -1
- package/map/client/composables/project.js +122 -0
- package/map/client/composables/weather.js +3 -3
- package/map/client/geolocation.js +1 -1
- package/map/client/globe.js +2 -0
- package/map/client/i18n/map_en.json +127 -76
- package/map/client/i18n/map_fr.json +128 -72
- package/map/client/index.js +3 -0
- package/map/client/init.js +17 -0
- package/map/client/leaflet/GSMaPLayer.js +16 -17
- package/map/client/leaflet/ShapeMarker.js +51 -0
- package/map/client/leaflet/TiledFeatureLayer.js +39 -9
- package/map/client/leaflet/TiledMeshLayer.js +13 -15
- package/map/client/leaflet/TiledWindLayer.js +6 -10
- package/map/client/leaflet/utils/index.js +4 -0
- package/map/client/leaflet/utils/utils.events.js +41 -0
- package/map/client/leaflet/utils/utils.popup.js +21 -0
- package/map/client/leaflet/utils/utils.style.js +195 -0
- package/map/client/leaflet/utils/utils.tiles.js +87 -0
- package/map/client/map.js +2 -0
- package/map/client/mixins/globe/mixin.base-globe.js +39 -18
- package/map/client/mixins/globe/mixin.geojson-layers.js +139 -69
- package/map/client/mixins/globe/mixin.popup.js +2 -1
- package/map/client/mixins/globe/mixin.style.js +6 -4
- package/map/client/mixins/globe/mixin.tooltip.js +8 -3
- package/map/client/mixins/map/mixin.base-map.js +53 -28
- package/map/client/mixins/map/mixin.edit-layers.js +15 -15
- package/map/client/mixins/map/mixin.forecast-layers.js +3 -1
- package/map/client/mixins/map/mixin.geojson-layers.js +60 -20
- package/map/client/mixins/map/mixin.georaster-layers.js +4 -11
- package/map/client/mixins/map/mixin.heatmap-layers.js +1 -1
- package/map/client/mixins/map/mixin.popup.js +2 -1
- package/map/client/mixins/map/mixin.style.js +4 -67
- package/map/client/mixins/map/mixin.tiled-mesh-layers.js +2 -1
- package/map/client/mixins/map/mixin.tiled-wind-layers.js +4 -2
- package/map/client/mixins/map/mixin.tooltip.js +2 -1
- package/map/client/mixins/mixin.activity.js +71 -192
- package/map/client/mixins/mixin.catalog-panel.js +6 -6
- package/map/client/mixins/mixin.context.js +12 -9
- package/map/client/mixins/mixin.feature-service.js +29 -300
- package/map/client/mixins/mixin.weacast.js +11 -17
- package/map/client/pixi-utils.js +1 -1
- package/map/client/planets.js +66 -0
- package/map/client/utils/index.js +6 -0
- package/map/client/utils/utils.capture.js +176 -0
- package/map/client/utils/utils.catalog.js +166 -0
- package/map/client/utils/utils.features.js +364 -0
- package/map/client/utils/utils.js +0 -151
- package/map/client/utils/utils.layers.js +175 -0
- package/map/client/utils/utils.location.js +91 -23
- package/map/client/utils/utils.project.js +8 -0
- package/map/client/utils/utils.schema.js +0 -1
- package/map/client/utils/utils.style.js +309 -0
- package/map/client/utils.all.js +2 -2
- package/map/client/utils.globe.js +1 -1
- package/map/client/utils.map.js +1 -1
- package/map/common/permissions.js +2 -0
- package/map/common/schemas/capture.create.json +132 -0
- package/map/common/schemas/projects.create.json +52 -0
- package/map/common/schemas/projects.update.json +52 -0
- package/map/common/wms-utils.js +8 -3
- package/package.json +6 -5
- package/test/api/core/account.test.js +20 -0
- package/test/api/core/config/default.cjs +16 -3
- package/test/api/core/import-export.test.js +86 -0
- package/test/api/core/test-log-2024-01-04.log +14 -0
- package/test/api/map/catalog.test.js +164 -0
- package/test/api/map/index.test.js +25 -61
- package/test/api/map/test-log-2024-01-04.log +2 -0
- package/test/api/map/test-log-2024-01-11.log +1 -0
- package/test/api/map/test-log-2024-01-25.log +19 -0
- package/test/client/core/layout.js +24 -5
- package/test/client/core/utils.js +7 -0
- package/test/client/map/catalog.js +78 -1
- package/test/client/map/time.js +2 -1
- package/core/client/components/screen/KEndpointScreen.vue +0 -80
- package/core/client/mixins/mixin.account.js +0 -61
- package/extras/icons/kdk.png +0 -0
- package/map/api/services/geocoder/geocoder.service.js +0 -79
- package/map/client/cesium/utils.js +0 -133
- package/map/client/components/KCaptureToolbar.vue +0 -155
- package/map/client/components/KColorLegend.vue +0 -349
- package/map/client/components/KTimeline.vue +0 -293
- package/map/client/components/KUrlLegend.vue +0 -122
- package/map/client/leaflet/utils.js +0 -246
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export function convertCesiumHandlerEvent (type) {
|
|
2
|
+
const buttonMapping = {
|
|
3
|
+
left: 0,
|
|
4
|
+
middle: 1,
|
|
5
|
+
right: 2
|
|
6
|
+
}
|
|
7
|
+
const buttonMovement = type.split('_')
|
|
8
|
+
const movement = buttonMovement[1].toLowerCase()
|
|
9
|
+
let button = buttonMovement[0].toLowerCase()
|
|
10
|
+
let name
|
|
11
|
+
if (type.startsWith('PINCH')) name = 'pinch'
|
|
12
|
+
else if (type.endsWith('CLICK')) name = 'click'
|
|
13
|
+
else if (type.endsWith('DOUBLE_CLICK')) name = 'dblclick'
|
|
14
|
+
else if (type.startsWith('WHEEL')) name = 'wheel'
|
|
15
|
+
else name = 'mouse'
|
|
16
|
+
|
|
17
|
+
if (name === 'mouse') {
|
|
18
|
+
name += movement
|
|
19
|
+
button = buttonMapping[button]
|
|
20
|
+
} else if (name.endsWith('click')) {
|
|
21
|
+
button = buttonMapping[button]
|
|
22
|
+
} else if (name === 'pinch') {
|
|
23
|
+
name += movement
|
|
24
|
+
button = undefined
|
|
25
|
+
} else {
|
|
26
|
+
button = 1 // wheel
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return { name, button }
|
|
30
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { kml } from '@tmcw/togeojson'
|
|
2
|
+
import Cesium from 'cesium/Source/Cesium.js'
|
|
3
|
+
|
|
4
|
+
export async function convertEntitiesToGeoJson(entities) {
|
|
5
|
+
const kmlEntities = await Cesium.exportKml({ entities, modelCallback: () => '' })
|
|
6
|
+
const parser = new DOMParser()
|
|
7
|
+
return kml(parser.parseFromString(kmlEntities.kml, 'application/xml'))
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
import { utils as kdkCoreUtils } from '../../../../core/client/index.js'
|
|
3
|
+
|
|
4
|
+
export function getTextTable (properties) {
|
|
5
|
+
properties = kdkCoreUtils.dotify(properties)
|
|
6
|
+
properties = _.pickBy(properties, value => !_.isNil(value))
|
|
7
|
+
const keys = _.keys(properties)
|
|
8
|
+
let text
|
|
9
|
+
if (keys.length === 0) return null
|
|
10
|
+
else if (keys.length === 1) text = _.get(properties, keys[0])
|
|
11
|
+
else {
|
|
12
|
+
text = keys
|
|
13
|
+
.map(key => key + ': ' + _.get(properties, key))
|
|
14
|
+
.join('\n')
|
|
15
|
+
}
|
|
16
|
+
return text
|
|
17
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
import chroma from 'chroma-js'
|
|
3
|
+
import moment from 'moment'
|
|
4
|
+
import Cesium from 'cesium/Source/Cesium.js'
|
|
5
|
+
import { Time, Units } from '../../../../core/client/index.js'
|
|
6
|
+
import { convertPointStyleToSimpleStyle, convertLineStyleToSimpleStyle, convertPolygonStyleToSimpleStyle, convertSimpleStyleColors,
|
|
7
|
+
convertSimpleStyleToPointStyle, convertSimpleStyleToLineStyle, convertSimpleStyleToPolygonStyle,
|
|
8
|
+
PointStyleTemplateMappings, LineStyleTemplateMappings, PolygonStyleTemplateMappings } from '../../utils/utils.style.js'
|
|
9
|
+
|
|
10
|
+
export const CesiumStyleMappings = {
|
|
11
|
+
stroke: 'stroke',
|
|
12
|
+
'stroke-color': 'stroke',
|
|
13
|
+
'stroke-opaciy': 'stroke.alpha',
|
|
14
|
+
'stroke-width': 'strokeWidth',
|
|
15
|
+
fill: 'fill',
|
|
16
|
+
'fill-color': 'fill',
|
|
17
|
+
'fill-opacity': 'fill.alpha',
|
|
18
|
+
'marker-size': 'markerSize',
|
|
19
|
+
'marker-symbol': 'markerSymbol',
|
|
20
|
+
'marker-color': 'markerColor'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const CesiumStyleOptions = _.values(CesiumStyleMappings)
|
|
24
|
+
export const CesiumEntityTypes = ['billboard', 'box', 'corridor', 'cylinder', 'ellipse', 'ellipsoid',
|
|
25
|
+
'label', 'model', 'path', 'plane', 'point', 'polygon', 'polyline', 'rectangle', 'wall']
|
|
26
|
+
|
|
27
|
+
export function convertToCesiumFromSimpleStyle (style, inPlace) {
|
|
28
|
+
if (!style) return {}
|
|
29
|
+
const convertedStyle = (inPlace ? style : {})
|
|
30
|
+
_.forOwn(style, (value, key) => {
|
|
31
|
+
if (_.has(CesiumStyleMappings, key)) {
|
|
32
|
+
const mapping = _.get(CesiumStyleMappings, key)
|
|
33
|
+
_.set(convertedStyle, mapping, value)
|
|
34
|
+
if (inPlace) _.unset(style, key)
|
|
35
|
+
// Convert from string to color object as required by cesium
|
|
36
|
+
if ((typeof value === 'string') && ['markerColor', 'fill', 'stroke'].includes(mapping)) {
|
|
37
|
+
_.set(convertedStyle, mapping, Cesium.Color.fromCssColorString(value))
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
return convertedStyle
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function processStyle (style, feature, options, mappings) {
|
|
45
|
+
if (!options) return
|
|
46
|
+
const cesiumOptions = options.cesium || options
|
|
47
|
+
// We allow to template style properties according to feature,
|
|
48
|
+
// because it can be slow you have to specify a subset of properties
|
|
49
|
+
const context = { properties: feature.properties, feature, chroma, moment, Units, Time }
|
|
50
|
+
if (cesiumOptions.template) {
|
|
51
|
+
// Create the map of variables
|
|
52
|
+
if (options.variables) context.variables = _.reduce(options.variables,
|
|
53
|
+
(result, variable) => Object.assign(result, { [variable.name]: variable }), {})
|
|
54
|
+
cesiumOptions.template.forEach(entry => {
|
|
55
|
+
_.set(style, _.get(mappings, _.kebabCase(entry.property), entry.property), entry.compiler(context))
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
return style
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function getPointSimpleStyle (feature, options, engine, engineStylePath = 'style.point') {
|
|
62
|
+
const engineStyle = _.get(engine, engineStylePath, {})
|
|
63
|
+
const layerStyle = options ? _.get(options.cesium || options, 'layerPointStyle') : {}
|
|
64
|
+
const featureStyle = feature.style ? _.get(feature, 'style', {}) : convertSimpleStyleToPointStyle(feature.properties)
|
|
65
|
+
const style = _.merge({}, engineStyle, layerStyle, featureStyle)
|
|
66
|
+
processStyle({ style: { point: style } }, feature, options, PointStyleTemplateMappings)
|
|
67
|
+
return convertSimpleStyleColors(convertPointStyleToSimpleStyle(style))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function getLineSimpleStyle (feature, options, engine, engineStylePath = 'style.line') {
|
|
71
|
+
const engineStyle = _.get(engine, engineStylePath, {})
|
|
72
|
+
const layerStyle = options ? _.get(options.cesium || options, 'layerLineStyle') : {}
|
|
73
|
+
const featureStyle = feature.style ? _.get(feature, 'style', {}) : convertSimpleStyleToLineStyle(feature.properties)
|
|
74
|
+
const style = _.merge({}, engineStyle, layerStyle, featureStyle)
|
|
75
|
+
processStyle({ style: { line: style } }, feature, options, LineStyleTemplateMappings)
|
|
76
|
+
return convertSimpleStyleColors(convertLineStyleToSimpleStyle(style))
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function getPolygonSimpleStyle (feature, options, engine, engineStylePath = 'style.polygon') {
|
|
80
|
+
const engineStyle = _.get(engine, engineStylePath, {})
|
|
81
|
+
const layerStyle = options ? _.get(options.cesium || options, 'layerPolygonStyle') : {}
|
|
82
|
+
const featureStyle = feature.style ? _.get(feature, 'style', {}) : convertSimpleStyleToPolygonStyle(feature.properties)
|
|
83
|
+
const style = _.merge({}, engineStyle, layerStyle, featureStyle)
|
|
84
|
+
processStyle({ style: { polygon: style } }, feature, options, PolygonStyleTemplateMappings)
|
|
85
|
+
return convertSimpleStyleColors(convertPolygonStyleToSimpleStyle(style))
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function convertToCesiumObjects (style) {
|
|
89
|
+
// Helper to convert from string to objects
|
|
90
|
+
function createCesiumObject () {
|
|
91
|
+
const args = Array.from(arguments)
|
|
92
|
+
const constructor = args[0]
|
|
93
|
+
args.shift()
|
|
94
|
+
const Class = _.get(Cesium, constructor)
|
|
95
|
+
// Can be callable, constructable or constant
|
|
96
|
+
let object
|
|
97
|
+
if (typeof Class === 'function') {
|
|
98
|
+
try { object = Class(...args) } catch (error) { /* Simply avoid raising any error */ }
|
|
99
|
+
try { object = new Class(...args) } catch (error) { /* Simply avoid raising any error */ }
|
|
100
|
+
} else object = Class
|
|
101
|
+
return object
|
|
102
|
+
}
|
|
103
|
+
const mapValue = (value) => {
|
|
104
|
+
if (typeof value === 'object') {
|
|
105
|
+
const type = value.type
|
|
106
|
+
const options = value.options
|
|
107
|
+
if (type && options) {
|
|
108
|
+
const constructor = type.replace('Cesium.', '')
|
|
109
|
+
// Take care to nested objects as constructor arguments
|
|
110
|
+
let args
|
|
111
|
+
if (options.type) {
|
|
112
|
+
// Create argument object
|
|
113
|
+
args = convertToCesiumObjects({ object: options })
|
|
114
|
+
args = args.object
|
|
115
|
+
} else {
|
|
116
|
+
args = convertToCesiumObjects(options)
|
|
117
|
+
}
|
|
118
|
+
if (Array.isArray(options)) return createCesiumObject(constructor, ...args)
|
|
119
|
+
else return createCesiumObject(constructor, args)
|
|
120
|
+
} else return convertToCesiumObjects(value)
|
|
121
|
+
} else if (typeof value === 'string') {
|
|
122
|
+
if (value.startsWith('Cesium.')) {
|
|
123
|
+
const constructor = value.replace('Cesium.', '')
|
|
124
|
+
return createCesiumObject(constructor)
|
|
125
|
+
}
|
|
126
|
+
const n = _.toNumber(value)
|
|
127
|
+
if (_.isFinite(n)) value = n
|
|
128
|
+
}
|
|
129
|
+
return value
|
|
130
|
+
}
|
|
131
|
+
if (typeof style === 'object') {
|
|
132
|
+
if (Array.isArray(style)) return style.map(mapValue)
|
|
133
|
+
else return _.mapValues(style, mapValue)
|
|
134
|
+
} else {
|
|
135
|
+
return _.mapValues({ value: style }, mapValue).value
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--
|
|
3
|
+
Form section
|
|
4
|
+
-->
|
|
5
|
+
<KForm
|
|
6
|
+
ref="formRef"
|
|
7
|
+
:schema="schema"
|
|
8
|
+
class="q-pa-sm"
|
|
9
|
+
/>
|
|
10
|
+
</template>
|
|
11
|
+
<script setup>
|
|
12
|
+
import { ref, computed } from 'vue'
|
|
13
|
+
import { Capture } from '../capture.js'
|
|
14
|
+
import moment from 'moment'
|
|
15
|
+
import captureSchema from '../../common/schemas/capture.create.json'
|
|
16
|
+
import KForm from '../../../core/client/components/form/KForm.vue'
|
|
17
|
+
|
|
18
|
+
// Data
|
|
19
|
+
const formRef = ref(null)
|
|
20
|
+
|
|
21
|
+
// computed
|
|
22
|
+
const schema = computed(() => {
|
|
23
|
+
const dateTimePropertie = captureSchema.properties.dateTime
|
|
24
|
+
dateTimePropertie.default = {
|
|
25
|
+
start: moment.utc().toISOString(),
|
|
26
|
+
end: moment.utc().toISOString()
|
|
27
|
+
}
|
|
28
|
+
// TODO: could be dynamically computed from layers
|
|
29
|
+
// For archived data we have typically 10 years in layers
|
|
30
|
+
// For forecast data we have at most couple of weeks
|
|
31
|
+
dateTimePropertie.field = {
|
|
32
|
+
...dateTimePropertie.field,
|
|
33
|
+
min: moment.utc().subtract(10, 'years').toISOString(),
|
|
34
|
+
max: moment.utc().add(1, 'months').toISOString()
|
|
35
|
+
}
|
|
36
|
+
return captureSchema
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// Functions
|
|
40
|
+
async function apply () {
|
|
41
|
+
const { isValid, values } = formRef.value.validate()
|
|
42
|
+
if (isValid) Capture.process(values)
|
|
43
|
+
return true
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Expose
|
|
47
|
+
defineExpose({
|
|
48
|
+
apply
|
|
49
|
+
})
|
|
50
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="k-textarea-capture"
|
|
4
|
+
v-html="sanitizedText"
|
|
5
|
+
/>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script setup>
|
|
9
|
+
import { computed } from 'vue'
|
|
10
|
+
import _ from 'lodash'
|
|
11
|
+
import config from 'config'
|
|
12
|
+
import sanitizeHtml from 'sanitize-html'
|
|
13
|
+
|
|
14
|
+
// props
|
|
15
|
+
const props = defineProps({
|
|
16
|
+
text: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: ''
|
|
19
|
+
},
|
|
20
|
+
position: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'header'
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
// data
|
|
27
|
+
const sanitizeHtmlOptions = {
|
|
28
|
+
...sanitizeHtml.defaults,
|
|
29
|
+
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['strike']),
|
|
30
|
+
allowedAttributes: _.merge(sanitizeHtml.defaults.allowedAttributes, { '*': ['style'] }),
|
|
31
|
+
allowedStyles: { '*': { 'text-align': [/^left$/, /^right$/, /^center$/] } }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// computed
|
|
35
|
+
const sanitizedText = computed(() => {
|
|
36
|
+
return sanitizeHtml(props.text, sanitizeHtmlOptions)
|
|
37
|
+
})
|
|
38
|
+
const cssBackgroundColor = computed(() => {
|
|
39
|
+
return _.get(config, `capture.${props.position}.backgroundColor`)
|
|
40
|
+
})
|
|
41
|
+
const cssColor = computed(() => {
|
|
42
|
+
return _.get(config, `capture.${props.position}.color`)
|
|
43
|
+
})
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style lang="scss" scoped>
|
|
47
|
+
.k-textarea-capture {
|
|
48
|
+
background-color: v-bind(cssBackgroundColor);
|
|
49
|
+
color: v-bind(cssColor);
|
|
50
|
+
width: 100%;
|
|
51
|
+
padding: 5px 20px;
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
points="50,25 40,70 50,60 60,70"
|
|
17
17
|
:fill="getCssVar('primary')"
|
|
18
18
|
:stroke="getCssVar('primary')"
|
|
19
|
-
:transform="`rotate(${direction}, 50, 50)`"
|
|
19
|
+
:transform="`rotate(${direction+180}, 50, 50)`"
|
|
20
20
|
/>
|
|
21
21
|
<text x="50" y="7" text-anchor="middle" alignment-baseline="middle" font-size="8px" fill="white">
|
|
22
22
|
{{ $t('KCompass.NORTH') }}
|
|
@@ -116,7 +116,7 @@ function computeDirection (x, y) {
|
|
|
116
116
|
if (!center) return
|
|
117
117
|
const dx = x - center.x
|
|
118
118
|
const dy = y - center.y
|
|
119
|
-
direction.value = (Math.round(Math.atan2(dy, dx) * 180 / Math.PI) +
|
|
119
|
+
direction.value = (Math.round(Math.atan2(dy, dx) * 180 / Math.PI) + 270) % 360
|
|
120
120
|
}
|
|
121
121
|
function onHandleDrag (event) {
|
|
122
122
|
const { x, y } = event.type.startsWith('touch') ? event.changedTouches[0] : event
|
|
@@ -108,7 +108,7 @@ export default {
|
|
|
108
108
|
properties () {
|
|
109
109
|
const properties = []
|
|
110
110
|
_.forOwn(_.get(this.layer, 'schema.content.properties', {}), (value, key) => {
|
|
111
|
-
const label = _.get(value, 'field.label',
|
|
111
|
+
const label = _.get(value, 'field.label', '')
|
|
112
112
|
// Check if we have a translation key or directly the label content
|
|
113
113
|
properties.push({ value: key, label: this.$tie(label) })
|
|
114
114
|
})
|
|
@@ -94,9 +94,9 @@ export default {
|
|
|
94
94
|
properties () {
|
|
95
95
|
const properties = []
|
|
96
96
|
_.forOwn(this.fields, (value, key) => {
|
|
97
|
-
// Use
|
|
97
|
+
// Use label or ID
|
|
98
98
|
properties.push({
|
|
99
|
-
label: _.get(value, 'field.
|
|
99
|
+
label: _.get(value, 'field.label', key),
|
|
100
100
|
value: key
|
|
101
101
|
})
|
|
102
102
|
})
|