umap-project 2.7.3__py3-none-any.whl → 2.8.0a0__py3-none-any.whl
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.
- umap/__init__.py +1 -1
- umap/forms.py +4 -14
- umap/locale/am_ET/LC_MESSAGES/django.mo +0 -0
- umap/locale/am_ET/LC_MESSAGES/django.po +278 -151
- umap/locale/ar/LC_MESSAGES/django.mo +0 -0
- umap/locale/ar/LC_MESSAGES/django.po +335 -141
- umap/locale/bg/LC_MESSAGES/django.mo +0 -0
- umap/locale/bg/LC_MESSAGES/django.po +279 -152
- umap/locale/br/LC_MESSAGES/django.mo +0 -0
- umap/locale/br/LC_MESSAGES/django.po +95 -79
- umap/locale/ca/LC_MESSAGES/django.mo +0 -0
- umap/locale/ca/LC_MESSAGES/django.po +85 -68
- umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
- umap/locale/cs_CZ/LC_MESSAGES/django.po +78 -66
- umap/locale/da/LC_MESSAGES/django.mo +0 -0
- umap/locale/da/LC_MESSAGES/django.po +280 -153
- umap/locale/de/LC_MESSAGES/django.mo +0 -0
- umap/locale/de/LC_MESSAGES/django.po +80 -64
- umap/locale/el/LC_MESSAGES/django.mo +0 -0
- umap/locale/el/LC_MESSAGES/django.po +82 -66
- umap/locale/en/LC_MESSAGES/django.po +73 -61
- umap/locale/es/LC_MESSAGES/django.mo +0 -0
- umap/locale/es/LC_MESSAGES/django.po +75 -63
- umap/locale/et/LC_MESSAGES/django.mo +0 -0
- umap/locale/et/LC_MESSAGES/django.po +280 -153
- umap/locale/eu/LC_MESSAGES/django.mo +0 -0
- umap/locale/eu/LC_MESSAGES/django.po +82 -66
- umap/locale/fa_IR/LC_MESSAGES/django.mo +0 -0
- umap/locale/fa_IR/LC_MESSAGES/django.po +80 -64
- umap/locale/fi/LC_MESSAGES/django.mo +0 -0
- umap/locale/fi/LC_MESSAGES/django.po +278 -151
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +75 -63
- umap/locale/gl/LC_MESSAGES/django.mo +0 -0
- umap/locale/gl/LC_MESSAGES/django.po +280 -153
- umap/locale/he/LC_MESSAGES/django.mo +0 -0
- umap/locale/he/LC_MESSAGES/django.po +281 -154
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/hu/LC_MESSAGES/django.po +80 -64
- umap/locale/is/LC_MESSAGES/django.mo +0 -0
- umap/locale/is/LC_MESSAGES/django.po +280 -153
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.po +82 -66
- umap/locale/ja/LC_MESSAGES/django.mo +0 -0
- umap/locale/ja/LC_MESSAGES/django.po +280 -153
- umap/locale/ko/LC_MESSAGES/django.mo +0 -0
- umap/locale/ko/LC_MESSAGES/django.po +280 -153
- umap/locale/lt/LC_MESSAGES/django.mo +0 -0
- umap/locale/lt/LC_MESSAGES/django.po +280 -153
- umap/locale/ms/LC_MESSAGES/django.mo +0 -0
- umap/locale/ms/LC_MESSAGES/django.po +82 -66
- umap/locale/nl/LC_MESSAGES/django.mo +0 -0
- umap/locale/nl/LC_MESSAGES/django.po +280 -153
- umap/locale/pl/LC_MESSAGES/django.mo +0 -0
- umap/locale/pl/LC_MESSAGES/django.po +82 -66
- umap/locale/pt/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt/LC_MESSAGES/django.po +75 -63
- umap/locale/pt_BR/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt_BR/LC_MESSAGES/django.po +280 -153
- umap/locale/pt_PT/LC_MESSAGES/django.mo +0 -0
- umap/locale/pt_PT/LC_MESSAGES/django.po +280 -153
- umap/locale/ru/LC_MESSAGES/django.mo +0 -0
- umap/locale/ru/LC_MESSAGES/django.po +280 -153
- umap/locale/sk_SK/LC_MESSAGES/django.mo +0 -0
- umap/locale/sk_SK/LC_MESSAGES/django.po +280 -153
- umap/locale/sl/LC_MESSAGES/django.mo +0 -0
- umap/locale/sl/LC_MESSAGES/django.po +280 -153
- umap/locale/sr/LC_MESSAGES/django.mo +0 -0
- umap/locale/sr/LC_MESSAGES/django.po +280 -153
- umap/locale/sv/LC_MESSAGES/django.mo +0 -0
- umap/locale/sv/LC_MESSAGES/django.po +81 -65
- umap/locale/th_TH/LC_MESSAGES/django.mo +0 -0
- umap/locale/th_TH/LC_MESSAGES/django.po +257 -185
- umap/locale/tr/LC_MESSAGES/django.mo +0 -0
- umap/locale/tr/LC_MESSAGES/django.po +280 -153
- umap/locale/uk_UA/LC_MESSAGES/django.mo +0 -0
- umap/locale/uk_UA/LC_MESSAGES/django.po +280 -153
- umap/locale/vi/LC_MESSAGES/django.mo +0 -0
- umap/locale/vi/LC_MESSAGES/django.po +278 -151
- umap/locale/zh/LC_MESSAGES/django.mo +0 -0
- umap/locale/zh/LC_MESSAGES/django.po +278 -151
- umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
- umap/locale/zh_TW/LC_MESSAGES/django.po +97 -81
- umap/management/commands/empty_trash.py +32 -0
- umap/management/commands/migrate_to_S3.py +29 -0
- umap/migrations/0023_alter_datalayer_uuid.py +19 -0
- umap/migrations/0024_alter_map_share_status.py +30 -0
- umap/migrations/0025_alter_datalayer_geojson.py +24 -0
- umap/models.py +68 -116
- umap/settings/base.py +22 -2
- umap/static/umap/base.css +3 -603
- umap/static/umap/content.css +5 -3
- umap/static/umap/css/bar.css +202 -0
- umap/static/umap/css/form.css +617 -0
- umap/static/umap/css/icon.css +21 -1
- umap/static/umap/css/popup.css +125 -0
- umap/static/umap/img/16-white.svg +16 -4
- umap/static/umap/img/16.svg +1 -1
- umap/static/umap/img/source/16-white.svg +46 -45
- umap/static/umap/img/source/16.svg +1 -753
- umap/static/umap/js/components/fragment.js +3 -1
- umap/static/umap/js/modules/browser.js +20 -19
- umap/static/umap/js/modules/caption.js +21 -22
- umap/static/umap/js/modules/data/features.js +101 -74
- umap/static/umap/js/modules/data/layer.js +157 -137
- umap/static/umap/js/modules/facets.js +9 -9
- umap/static/umap/js/modules/formatter.js +5 -5
- umap/static/umap/js/modules/global.js +4 -52
- umap/static/umap/js/modules/help.js +18 -21
- umap/static/umap/js/modules/importer.js +71 -39
- umap/static/umap/js/modules/importers/cadastrefr.js +4 -0
- umap/static/umap/js/modules/importers/geodatamine.js +3 -3
- umap/static/umap/js/modules/importers/overpass.js +5 -0
- umap/static/umap/js/modules/permissions.js +85 -87
- umap/static/umap/js/modules/rendering/layers/base.js +15 -15
- umap/static/umap/js/modules/rendering/layers/classified.js +1 -1
- umap/static/umap/js/modules/rendering/layers/cluster.js +1 -1
- umap/static/umap/js/modules/rendering/layers/heat.js +1 -1
- umap/static/umap/js/modules/rendering/map.js +390 -0
- umap/static/umap/js/modules/rendering/popup.js +10 -9
- umap/static/umap/js/modules/rendering/template.js +35 -12
- umap/static/umap/js/modules/rendering/ui.js +57 -12
- umap/static/umap/js/modules/rules.js +22 -25
- umap/static/umap/js/modules/saving.js +47 -0
- umap/static/umap/js/modules/schema.js +5 -0
- umap/static/umap/js/modules/share.js +21 -24
- umap/static/umap/js/modules/slideshow.js +24 -20
- umap/static/umap/js/modules/sync/updaters.js +7 -9
- umap/static/umap/js/modules/tableeditor.js +20 -19
- umap/static/umap/js/modules/ui/bar.js +196 -0
- umap/static/umap/js/modules/ui/panel.js +10 -9
- umap/static/umap/js/modules/umap.js +1668 -0
- umap/static/umap/js/modules/urls.js +2 -2
- umap/static/umap/js/modules/utils.js +20 -6
- umap/static/umap/js/umap.controls.js +74 -301
- umap/static/umap/js/umap.core.js +29 -50
- umap/static/umap/js/umap.forms.js +34 -27
- umap/static/umap/keycloak.png +0 -0
- umap/static/umap/locale/am_ET.js +26 -10
- umap/static/umap/locale/am_ET.json +26 -10
- umap/static/umap/locale/ar.js +26 -10
- umap/static/umap/locale/ar.json +26 -10
- umap/static/umap/locale/ast.js +26 -10
- umap/static/umap/locale/ast.json +26 -10
- umap/static/umap/locale/bg.js +26 -10
- umap/static/umap/locale/bg.json +26 -10
- umap/static/umap/locale/br.js +27 -20
- umap/static/umap/locale/br.json +27 -20
- umap/static/umap/locale/ca.js +32 -29
- umap/static/umap/locale/ca.json +32 -29
- umap/static/umap/locale/cs_CZ.js +24 -17
- umap/static/umap/locale/cs_CZ.json +24 -17
- umap/static/umap/locale/da.js +26 -10
- umap/static/umap/locale/da.json +26 -10
- umap/static/umap/locale/de.js +21 -14
- umap/static/umap/locale/de.json +21 -14
- umap/static/umap/locale/el.js +28 -12
- umap/static/umap/locale/el.json +28 -12
- umap/static/umap/locale/en.js +12 -9
- umap/static/umap/locale/en.json +12 -9
- umap/static/umap/locale/en_US.json +26 -10
- umap/static/umap/locale/es.js +16 -13
- umap/static/umap/locale/es.json +16 -13
- umap/static/umap/locale/et.js +26 -10
- umap/static/umap/locale/et.json +26 -10
- umap/static/umap/locale/eu.js +16 -9
- umap/static/umap/locale/eu.json +16 -9
- umap/static/umap/locale/fa_IR.js +16 -9
- umap/static/umap/locale/fa_IR.json +16 -9
- umap/static/umap/locale/fi.js +26 -10
- umap/static/umap/locale/fi.json +26 -10
- umap/static/umap/locale/fr.js +12 -9
- umap/static/umap/locale/fr.json +12 -9
- umap/static/umap/locale/gl.js +26 -10
- umap/static/umap/locale/gl.json +26 -10
- umap/static/umap/locale/he.js +26 -10
- umap/static/umap/locale/he.json +26 -10
- umap/static/umap/locale/hr.js +26 -10
- umap/static/umap/locale/hr.json +26 -10
- umap/static/umap/locale/hu.js +16 -9
- umap/static/umap/locale/hu.json +16 -9
- umap/static/umap/locale/id.js +26 -10
- umap/static/umap/locale/id.json +26 -10
- umap/static/umap/locale/is.js +26 -10
- umap/static/umap/locale/is.json +26 -10
- umap/static/umap/locale/it.js +26 -10
- umap/static/umap/locale/it.json +26 -10
- umap/static/umap/locale/ja.js +26 -10
- umap/static/umap/locale/ja.json +26 -10
- umap/static/umap/locale/ko.js +26 -10
- umap/static/umap/locale/ko.json +26 -10
- umap/static/umap/locale/lt.js +26 -10
- umap/static/umap/locale/lt.json +26 -10
- umap/static/umap/locale/ms.js +28 -12
- umap/static/umap/locale/ms.json +28 -12
- umap/static/umap/locale/nl.js +28 -12
- umap/static/umap/locale/nl.json +28 -12
- umap/static/umap/locale/no.js +26 -10
- umap/static/umap/locale/no.json +26 -10
- umap/static/umap/locale/pl.js +28 -12
- umap/static/umap/locale/pl.json +28 -12
- umap/static/umap/locale/pl_PL.json +26 -10
- umap/static/umap/locale/pt.js +16 -9
- umap/static/umap/locale/pt.json +16 -9
- umap/static/umap/locale/pt_BR.js +26 -10
- umap/static/umap/locale/pt_BR.json +26 -10
- umap/static/umap/locale/pt_PT.js +16 -9
- umap/static/umap/locale/pt_PT.json +16 -9
- umap/static/umap/locale/ro.js +26 -10
- umap/static/umap/locale/ro.json +26 -10
- umap/static/umap/locale/ru.js +26 -10
- umap/static/umap/locale/ru.json +26 -10
- umap/static/umap/locale/si.js +7 -7
- umap/static/umap/locale/si.json +7 -7
- umap/static/umap/locale/sk_SK.js +26 -10
- umap/static/umap/locale/sk_SK.json +26 -10
- umap/static/umap/locale/sl.js +26 -10
- umap/static/umap/locale/sl.json +26 -10
- umap/static/umap/locale/sr.js +26 -10
- umap/static/umap/locale/sr.json +26 -10
- umap/static/umap/locale/sv.js +27 -11
- umap/static/umap/locale/sv.json +27 -11
- umap/static/umap/locale/th_TH.js +28 -12
- umap/static/umap/locale/th_TH.json +28 -12
- umap/static/umap/locale/tr.js +26 -10
- umap/static/umap/locale/tr.json +26 -10
- umap/static/umap/locale/uk_UA.js +26 -10
- umap/static/umap/locale/uk_UA.json +26 -10
- umap/static/umap/locale/vi.js +26 -10
- umap/static/umap/locale/vi.json +26 -10
- umap/static/umap/locale/vi_VN.json +26 -10
- umap/static/umap/locale/zh.js +26 -10
- umap/static/umap/locale/zh.json +26 -10
- umap/static/umap/locale/zh_CN.json +26 -10
- umap/static/umap/locale/zh_TW.Big5.json +26 -10
- umap/static/umap/locale/zh_TW.js +34 -27
- umap/static/umap/locale/zh_TW.json +34 -27
- umap/static/umap/map.css +5 -364
- umap/static/umap/unittests/URLs.js +15 -15
- umap/static/umap/unittests/utils.js +23 -1
- umap/static/umap/vars.css +2 -0
- umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +5 -1
- umap/storage.py +152 -0
- umap/templates/registration/login.html +7 -6
- umap/templates/umap/css.html +3 -0
- umap/templates/umap/js.html +1 -2
- umap/templates/umap/map_init.html +4 -5
- umap/templates/umap/user_dashboard.html +18 -19
- umap/tests/base.py +5 -1
- umap/tests/integration/conftest.py +2 -1
- umap/tests/integration/test_anonymous_owned_map.py +18 -10
- umap/tests/integration/test_browser.py +16 -1
- umap/tests/integration/test_dashboard.py +1 -1
- umap/tests/integration/test_edit_datalayer.py +18 -7
- umap/tests/integration/test_import.py +8 -5
- umap/tests/integration/test_optimistic_merge.py +31 -8
- umap/tests/integration/test_owned_map.py +22 -16
- umap/tests/integration/test_popup.py +44 -0
- umap/tests/integration/test_save.py +35 -0
- umap/tests/integration/test_view_marker.py +12 -0
- umap/tests/integration/test_view_polyline.py +257 -0
- umap/tests/integration/test_websocket_sync.py +81 -9
- umap/tests/test_datalayer.py +6 -7
- umap/tests/test_datalayer_s3.py +135 -0
- umap/tests/test_datalayer_views.py +28 -10
- umap/tests/test_empty_trash.py +34 -0
- umap/tests/test_map.py +12 -3
- umap/tests/test_map_views.py +69 -37
- umap/tests/test_views.py +53 -0
- umap/urls.py +3 -3
- umap/views.py +107 -76
- {umap_project-2.7.3.dist-info → umap_project-2.8.0a0.dist-info}/METADATA +16 -13
- {umap_project-2.7.3.dist-info → umap_project-2.8.0a0.dist-info}/RECORD +276 -262
- umap/management/commands/purge_purgatory.py +0 -28
- umap/static/umap/js/umap.js +0 -1903
- umap/tests/test_purge_purgatory.py +0 -25
- {umap_project-2.7.3.dist-info → umap_project-2.8.0a0.dist-info}/WHEEL +0 -0
- {umap_project-2.7.3.dist-info → umap_project-2.8.0a0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.7.3.dist-info → umap_project-2.8.0a0.dist-info}/licenses/LICENSE +0 -0
|
@@ -18,8 +18,9 @@ import {
|
|
|
18
18
|
import loadPopup from '../rendering/popup.js'
|
|
19
19
|
|
|
20
20
|
class Feature {
|
|
21
|
-
constructor(datalayer, geojson = {}, id = null) {
|
|
22
|
-
this.
|
|
21
|
+
constructor(umap, datalayer, geojson = {}, id = null) {
|
|
22
|
+
this._umap = umap
|
|
23
|
+
this.sync = umap.sync_engine.proxy(this)
|
|
23
24
|
this._marked_for_deletion = false
|
|
24
25
|
this._isDirty = false
|
|
25
26
|
this._ui = null
|
|
@@ -69,10 +70,6 @@ class Feature {
|
|
|
69
70
|
return this._ui
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
get map() {
|
|
73
|
-
return this.datalayer?.map
|
|
74
|
-
}
|
|
75
|
-
|
|
76
73
|
get center() {
|
|
77
74
|
return this.ui.getCenter()
|
|
78
75
|
}
|
|
@@ -139,7 +136,7 @@ class Feature {
|
|
|
139
136
|
subject: 'feature',
|
|
140
137
|
metadata: {
|
|
141
138
|
id: this.id,
|
|
142
|
-
layerId: this.datalayer
|
|
139
|
+
layerId: this.datalayer.id,
|
|
143
140
|
featureType: this.getClassName(),
|
|
144
141
|
},
|
|
145
142
|
}
|
|
@@ -168,7 +165,9 @@ class Feature {
|
|
|
168
165
|
}
|
|
169
166
|
|
|
170
167
|
getSlug() {
|
|
171
|
-
return
|
|
168
|
+
return (
|
|
169
|
+
this.properties[this._umap.getProperty('slugKey') || U.DEFAULT_LABEL_KEY] || ''
|
|
170
|
+
)
|
|
172
171
|
}
|
|
173
172
|
|
|
174
173
|
getPermalink() {
|
|
@@ -196,10 +195,10 @@ class Feature {
|
|
|
196
195
|
return
|
|
197
196
|
}
|
|
198
197
|
// TODO deal with an event instead?
|
|
199
|
-
if (this.
|
|
200
|
-
this.
|
|
198
|
+
if (this._umap.slideshow) {
|
|
199
|
+
this._umap.slideshow.current = this
|
|
201
200
|
}
|
|
202
|
-
this.
|
|
201
|
+
this._umap.currentFeature = this
|
|
203
202
|
this.attachPopup()
|
|
204
203
|
this.ui.openPopup(latlng || this.center)
|
|
205
204
|
}
|
|
@@ -209,7 +208,7 @@ class Feature {
|
|
|
209
208
|
return field.startsWith('properties.')
|
|
210
209
|
})
|
|
211
210
|
if (impactData) {
|
|
212
|
-
if (this.
|
|
211
|
+
if (this._umap.currentFeature === this) {
|
|
213
212
|
this.view()
|
|
214
213
|
}
|
|
215
214
|
}
|
|
@@ -217,7 +216,7 @@ class Feature {
|
|
|
217
216
|
}
|
|
218
217
|
|
|
219
218
|
edit(event) {
|
|
220
|
-
if (!this.
|
|
219
|
+
if (!this._umap.editEnabled || this.isReadOnly()) return
|
|
221
220
|
const container = DomUtil.create('div', 'umap-feature-container')
|
|
222
221
|
DomUtil.createTitle(
|
|
223
222
|
container,
|
|
@@ -237,15 +236,23 @@ class Feature {
|
|
|
237
236
|
container.appendChild(builder.build())
|
|
238
237
|
|
|
239
238
|
const properties = []
|
|
239
|
+
let labelKeyFound = undefined
|
|
240
240
|
for (const property of this.datalayer._propertiesIndex) {
|
|
241
|
-
if (
|
|
241
|
+
if (!labelKeyFound && U.LABEL_KEYS.includes(property)) {
|
|
242
|
+
labelKeyFound = property
|
|
243
|
+
continue
|
|
244
|
+
}
|
|
245
|
+
if (property === 'description') {
|
|
242
246
|
continue
|
|
243
247
|
}
|
|
244
248
|
properties.push([`properties.${property}`, { label: property }])
|
|
245
249
|
}
|
|
246
250
|
// We always want name and description for now (properties management to come)
|
|
247
251
|
properties.unshift('properties.description')
|
|
248
|
-
|
|
252
|
+
if (!labelKeyFound) {
|
|
253
|
+
labelKeyFound = U.DEFAULT_LABEL_KEY
|
|
254
|
+
}
|
|
255
|
+
properties.unshift([`properties.${labelKeyFound}`, { label: labelKeyFound }])
|
|
249
256
|
builder = new U.FormBuilder(this, properties, {
|
|
250
257
|
id: 'umap-feature-properties',
|
|
251
258
|
})
|
|
@@ -256,12 +263,12 @@ class Feature {
|
|
|
256
263
|
translate('Advanced actions')
|
|
257
264
|
)
|
|
258
265
|
this.getAdvancedEditActions(advancedActions)
|
|
259
|
-
const onLoad = this.
|
|
266
|
+
const onLoad = this._umap.editPanel.open({ content: container })
|
|
260
267
|
onLoad.then(() => {
|
|
261
|
-
builder.helpers[
|
|
268
|
+
builder.helpers[`properties.${labelKeyFound}`].input.focus()
|
|
262
269
|
})
|
|
263
|
-
this.
|
|
264
|
-
if (!this.ui.isOnScreen(this.
|
|
270
|
+
this._umap.editedFeature = this
|
|
271
|
+
if (!this.ui.isOnScreen(this._umap._leafletMap.getBounds())) this.zoomTo(event)
|
|
265
272
|
}
|
|
266
273
|
|
|
267
274
|
getAdvancedEditActions(container) {
|
|
@@ -270,7 +277,7 @@ class Feature {
|
|
|
270
277
|
<i class="icon icon-24 icon-delete"></i>${translate('Delete')}
|
|
271
278
|
</button>`)
|
|
272
279
|
button.addEventListener('click', () => {
|
|
273
|
-
this.confirmDelete().then(() => this.
|
|
280
|
+
this.confirmDelete().then(() => this._umap.editPanel.close())
|
|
274
281
|
})
|
|
275
282
|
container.appendChild(button)
|
|
276
283
|
}
|
|
@@ -319,21 +326,28 @@ class Feature {
|
|
|
319
326
|
|
|
320
327
|
endEdit() {}
|
|
321
328
|
|
|
322
|
-
getDisplayName(
|
|
323
|
-
|
|
324
|
-
const
|
|
329
|
+
getDisplayName() {
|
|
330
|
+
const keys = U.LABEL_KEYS.slice() // Copy.
|
|
331
|
+
const labelKey = this.getOption('labelKey')
|
|
325
332
|
// Variables mode.
|
|
326
|
-
if (
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
333
|
+
if (labelKey) {
|
|
334
|
+
if (Utils.hasVar(labelKey)) {
|
|
335
|
+
return Utils.greedyTemplate(labelKey, this.extendedProperties())
|
|
336
|
+
}
|
|
337
|
+
keys.unshift(labelKey)
|
|
338
|
+
}
|
|
339
|
+
for (const key of keys) {
|
|
340
|
+
const value = this.properties[key]
|
|
341
|
+
if (value) return value
|
|
342
|
+
}
|
|
343
|
+
return this.datalayer.getName()
|
|
330
344
|
}
|
|
331
345
|
|
|
332
346
|
hasPopupFooter() {
|
|
333
347
|
if (this.datalayer.isRemoteLayer() && this.datalayer.options.remoteData.dynamic) {
|
|
334
348
|
return false
|
|
335
349
|
}
|
|
336
|
-
return this.
|
|
350
|
+
return this._umap.getProperty('displayPopupFooter')
|
|
337
351
|
}
|
|
338
352
|
|
|
339
353
|
getPopupClass() {
|
|
@@ -347,7 +361,7 @@ class Feature {
|
|
|
347
361
|
}
|
|
348
362
|
|
|
349
363
|
async confirmDelete() {
|
|
350
|
-
const confirmed = await this.
|
|
364
|
+
const confirmed = await this._umap.dialog.confirm(
|
|
351
365
|
translate('Are you sure you want to delete the feature?')
|
|
352
366
|
)
|
|
353
367
|
if (confirmed) {
|
|
@@ -359,7 +373,7 @@ class Feature {
|
|
|
359
373
|
|
|
360
374
|
del(sync) {
|
|
361
375
|
this.isDirty = true
|
|
362
|
-
this.
|
|
376
|
+
this._umap._leafletMap.closePopup()
|
|
363
377
|
if (this.datalayer) {
|
|
364
378
|
this.datalayer.removeFeature(this, sync)
|
|
365
379
|
}
|
|
@@ -417,34 +431,37 @@ class Feature {
|
|
|
417
431
|
let value = fallback
|
|
418
432
|
if (typeof this.staticOptions[option] !== 'undefined') {
|
|
419
433
|
value = this.staticOptions[option]
|
|
420
|
-
} else if (
|
|
434
|
+
} else if (Utils.usableOption(this.properties._umap_options, option)) {
|
|
421
435
|
value = this.properties._umap_options[option]
|
|
422
436
|
} else if (this.datalayer) {
|
|
423
437
|
value = this.datalayer.getOption(option, this)
|
|
424
438
|
} else {
|
|
425
|
-
value = this.
|
|
439
|
+
value = this._umap.getProperty(option)
|
|
426
440
|
}
|
|
427
441
|
return value
|
|
428
442
|
}
|
|
429
443
|
|
|
430
|
-
getDynamicOption(
|
|
431
|
-
let value = this.getOption(
|
|
444
|
+
getDynamicOption(key, fallback) {
|
|
445
|
+
let value = this.getOption(key, fallback)
|
|
432
446
|
// There is a variable inside.
|
|
433
|
-
if (
|
|
434
|
-
value =
|
|
435
|
-
if (
|
|
447
|
+
if (Utils.hasVar(value)) {
|
|
448
|
+
value = Utils.greedyTemplate(value, this.properties, true)
|
|
449
|
+
if (Utils.hasVar(value)) value = SCHEMA[key]?.default
|
|
436
450
|
}
|
|
437
451
|
return value
|
|
438
452
|
}
|
|
439
453
|
|
|
440
454
|
zoomTo({ easing, latlng, callback } = {}) {
|
|
441
|
-
if (easing === undefined) easing = this.
|
|
442
|
-
if (callback) this.
|
|
455
|
+
if (easing === undefined) easing = this._umap.getProperty('easing')
|
|
456
|
+
if (callback) this._umap._leafletMap.once('moveend', callback.bind(this))
|
|
443
457
|
if (easing) {
|
|
444
|
-
this.
|
|
458
|
+
this._umap._leafletMap.flyTo(this.center, this.getBestZoom())
|
|
445
459
|
} else {
|
|
446
460
|
latlng = latlng || this.center
|
|
447
|
-
this.
|
|
461
|
+
this._umap._leafletMap.setView(
|
|
462
|
+
latlng,
|
|
463
|
+
this.getBestZoom() || this._umap._leafletMap.getZoom()
|
|
464
|
+
)
|
|
448
465
|
}
|
|
449
466
|
}
|
|
450
467
|
|
|
@@ -494,13 +511,9 @@ class Feature {
|
|
|
494
511
|
return [U.ToggleEditAction, U.DeleteFeatureAction]
|
|
495
512
|
}
|
|
496
513
|
|
|
497
|
-
getMap() {
|
|
498
|
-
return this.map
|
|
499
|
-
}
|
|
500
|
-
|
|
501
514
|
isFiltered() {
|
|
502
515
|
const filterKeys = this.datalayer.getFilterKeys()
|
|
503
|
-
const filter = this.
|
|
516
|
+
const filter = this._umap.browser.options.filter
|
|
504
517
|
if (filter && !this.matchFilter(filter, filterKeys)) return true
|
|
505
518
|
if (!this.matchFacets()) return true
|
|
506
519
|
return false
|
|
@@ -525,10 +538,10 @@ class Feature {
|
|
|
525
538
|
}
|
|
526
539
|
|
|
527
540
|
matchFacets() {
|
|
528
|
-
const selected = this.
|
|
541
|
+
const selected = this._umap.facets.selected
|
|
529
542
|
for (const [name, { type, min, max, choices }] of Object.entries(selected)) {
|
|
530
543
|
let value = this.properties[name]
|
|
531
|
-
const parser = this.
|
|
544
|
+
const parser = this._umap.facets.getParser(type)
|
|
532
545
|
value = parser(value)
|
|
533
546
|
switch (type) {
|
|
534
547
|
case 'date':
|
|
@@ -562,10 +575,10 @@ class Feature {
|
|
|
562
575
|
|
|
563
576
|
extendedProperties() {
|
|
564
577
|
// Include context properties
|
|
565
|
-
const properties = this.
|
|
578
|
+
const properties = this._umap.getGeoContext()
|
|
566
579
|
const locale = L.getLocale()
|
|
567
580
|
if (locale) properties.locale = locale
|
|
568
|
-
if (
|
|
581
|
+
if (U.lang) properties.lang = U.lang
|
|
569
582
|
properties.rank = this.getRank() + 1
|
|
570
583
|
properties.layer = this.datalayer.getName()
|
|
571
584
|
if (this.ui._map && this.hasGeom()) {
|
|
@@ -578,7 +591,7 @@ class Feature {
|
|
|
578
591
|
properties.measure = this.ui.getMeasure()
|
|
579
592
|
}
|
|
580
593
|
}
|
|
581
|
-
return
|
|
594
|
+
return Object.assign(properties, this.properties)
|
|
582
595
|
}
|
|
583
596
|
|
|
584
597
|
getRank() {
|
|
@@ -612,10 +625,10 @@ class Feature {
|
|
|
612
625
|
label: translate('Copy as GeoJSON'),
|
|
613
626
|
action: () => {
|
|
614
627
|
L.Util.copyToClipboard(JSON.stringify(this.toGeoJSON()))
|
|
615
|
-
this.
|
|
628
|
+
this._umap.tooltip.open({ content: L._('✅ Copied!') })
|
|
616
629
|
},
|
|
617
630
|
})
|
|
618
|
-
if (this.
|
|
631
|
+
if (this._umap.editEnabled && !this.isReadOnly()) {
|
|
619
632
|
items = items.concat(this.getContextMenuEditItems(event))
|
|
620
633
|
}
|
|
621
634
|
return items
|
|
@@ -623,7 +636,7 @@ class Feature {
|
|
|
623
636
|
|
|
624
637
|
getContextMenuEditItems() {
|
|
625
638
|
let items = ['-']
|
|
626
|
-
if (this.
|
|
639
|
+
if (this._umap.editedFeature !== this) {
|
|
627
640
|
items.push({
|
|
628
641
|
label: `${translate('Edit this feature')} (⇧+Click)`,
|
|
629
642
|
action: () => this.edit(),
|
|
@@ -631,7 +644,7 @@ class Feature {
|
|
|
631
644
|
}
|
|
632
645
|
items = items.concat(
|
|
633
646
|
{
|
|
634
|
-
label: this.
|
|
647
|
+
label: this._umap.help.displayLabel('EDIT_FEATURE_LAYER'),
|
|
635
648
|
action: () => this.datalayer.edit(),
|
|
636
649
|
},
|
|
637
650
|
{
|
|
@@ -648,8 +661,8 @@ class Feature {
|
|
|
648
661
|
}
|
|
649
662
|
|
|
650
663
|
export class Point extends Feature {
|
|
651
|
-
constructor(datalayer, geojson, id) {
|
|
652
|
-
super(datalayer, geojson, id)
|
|
664
|
+
constructor(umap, datalayer, geojson, id) {
|
|
665
|
+
super(umap, datalayer, geojson, id)
|
|
653
666
|
this.staticOptions = {
|
|
654
667
|
mainColor: 'color',
|
|
655
668
|
className: 'marker',
|
|
@@ -750,17 +763,17 @@ class Path extends Feature {
|
|
|
750
763
|
}
|
|
751
764
|
|
|
752
765
|
edit(event) {
|
|
753
|
-
if (this.
|
|
766
|
+
if (this._umap.editEnabled) {
|
|
754
767
|
super.edit(event)
|
|
755
768
|
if (!this.ui.editEnabled()) this.ui.makeGeometryEditable()
|
|
756
769
|
}
|
|
757
770
|
}
|
|
758
771
|
|
|
759
772
|
_toggleEditing(event) {
|
|
760
|
-
if (this.
|
|
773
|
+
if (this._umap.editEnabled) {
|
|
761
774
|
if (this.ui.editEnabled()) {
|
|
762
775
|
this.endEdit()
|
|
763
|
-
this.
|
|
776
|
+
this._umap.editPanel.close()
|
|
764
777
|
} else {
|
|
765
778
|
this.edit(event)
|
|
766
779
|
}
|
|
@@ -786,7 +799,10 @@ class Path extends Feature {
|
|
|
786
799
|
}
|
|
787
800
|
|
|
788
801
|
getBestZoom() {
|
|
789
|
-
return
|
|
802
|
+
return (
|
|
803
|
+
this.getOption('zoomTo') ||
|
|
804
|
+
this._umap._leafletMap.getBoundsZoom(this.bounds, true)
|
|
805
|
+
)
|
|
790
806
|
}
|
|
791
807
|
|
|
792
808
|
endEdit() {
|
|
@@ -825,11 +841,14 @@ class Path extends Feature {
|
|
|
825
841
|
|
|
826
842
|
zoomTo({ easing, callback }) {
|
|
827
843
|
// Use bounds instead of centroid for paths.
|
|
828
|
-
easing = easing || this.
|
|
844
|
+
easing = easing || this._umap.getProperty('easing')
|
|
829
845
|
if (easing) {
|
|
830
|
-
this.
|
|
846
|
+
this._umap._leafletMap.flyToBounds(this.bounds, this.getBestZoom())
|
|
831
847
|
} else {
|
|
832
|
-
this.
|
|
848
|
+
this._umap._leafletMap.fitBounds(
|
|
849
|
+
this.bounds,
|
|
850
|
+
this.getBestZoom() || this._umap._leafletMap.getZoom()
|
|
851
|
+
)
|
|
833
852
|
}
|
|
834
853
|
if (callback) callback.call(this)
|
|
835
854
|
}
|
|
@@ -840,7 +859,7 @@ class Path extends Feature {
|
|
|
840
859
|
label: translate('Display measure'),
|
|
841
860
|
action: () => Alert.info(this.ui.getMeasure()),
|
|
842
861
|
})
|
|
843
|
-
if (this.
|
|
862
|
+
if (this._umap.editEnabled && !this.isReadOnly() && this.isMulti()) {
|
|
844
863
|
items.push(...this.getContextMenuMultiItems(event))
|
|
845
864
|
}
|
|
846
865
|
return items
|
|
@@ -871,11 +890,14 @@ class Path extends Feature {
|
|
|
871
890
|
|
|
872
891
|
getContextMenuEditItems(event) {
|
|
873
892
|
const items = super.getContextMenuEditItems(event)
|
|
874
|
-
if (
|
|
893
|
+
if (
|
|
894
|
+
this._umap?.editedFeature !== this &&
|
|
895
|
+
this.isSameClass(this._umap.editedFeature)
|
|
896
|
+
) {
|
|
875
897
|
items.push({
|
|
876
898
|
label: translate('Transfer shape to edited feature'),
|
|
877
899
|
action: () => {
|
|
878
|
-
this.transferShape(event.latlng, this.
|
|
900
|
+
this.transferShape(event.latlng, this._umap.editedFeature)
|
|
879
901
|
},
|
|
880
902
|
})
|
|
881
903
|
}
|
|
@@ -892,8 +914,8 @@ class Path extends Feature {
|
|
|
892
914
|
}
|
|
893
915
|
|
|
894
916
|
export class LineString extends Path {
|
|
895
|
-
constructor(datalayer, geojson, id) {
|
|
896
|
-
super(datalayer, geojson, id)
|
|
917
|
+
constructor(umap, datalayer, geojson, id) {
|
|
918
|
+
super(umap, datalayer, geojson, id)
|
|
897
919
|
this.staticOptions = {
|
|
898
920
|
stroke: true,
|
|
899
921
|
fill: false,
|
|
@@ -977,8 +999,8 @@ export class LineString extends Path {
|
|
|
977
999
|
}
|
|
978
1000
|
const a = toMerge[0]
|
|
979
1001
|
const b = toMerge[1]
|
|
980
|
-
const p1 = this.
|
|
981
|
-
const p2 = this.
|
|
1002
|
+
const p1 = this._umap._leafletMap.latLngToContainerPoint(a[a.length - 1])
|
|
1003
|
+
const p2 = this._umap._leafletMap.latLngToContainerPoint(b[0])
|
|
982
1004
|
const tolerance = 5 // px on screen
|
|
983
1005
|
if (Math.abs(p1.x - p2.x) <= tolerance && Math.abs(p1.y - p2.y) <= tolerance) {
|
|
984
1006
|
a.pop()
|
|
@@ -1022,7 +1044,7 @@ export class LineString extends Path {
|
|
|
1022
1044
|
})
|
|
1023
1045
|
} else if (index === 0 || index === event.vertex.getLastIndex()) {
|
|
1024
1046
|
items.push({
|
|
1025
|
-
label: this.
|
|
1047
|
+
label: this._umap.help.displayLabel('CONTINUE_LINE'),
|
|
1026
1048
|
action: () => event.vertex.continue(),
|
|
1027
1049
|
})
|
|
1028
1050
|
}
|
|
@@ -1038,11 +1060,16 @@ export class LineString extends Path {
|
|
|
1038
1060
|
})
|
|
1039
1061
|
return items
|
|
1040
1062
|
}
|
|
1063
|
+
|
|
1064
|
+
extendedProperties() {
|
|
1065
|
+
const [gain, loss] = this.ui.getElevation()
|
|
1066
|
+
return Object.assign({ gain, loss }, super.extendedProperties())
|
|
1067
|
+
}
|
|
1041
1068
|
}
|
|
1042
1069
|
|
|
1043
1070
|
export class Polygon extends Path {
|
|
1044
|
-
constructor(datalayer, geojson, id) {
|
|
1045
|
-
super(datalayer, geojson, id)
|
|
1071
|
+
constructor(umap, datalayer, geojson, id) {
|
|
1072
|
+
super(umap, datalayer, geojson, id)
|
|
1046
1073
|
this.staticOptions = {
|
|
1047
1074
|
mainColor: 'fillColor',
|
|
1048
1075
|
className: 'polygon',
|