umap-project 2.7.2__py3-none-any.whl → 2.8.0__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 +35 -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 +23 -3
- umap/settings/local_s3.py +45 -0
- 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 +620 -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 +120 -78
- umap/static/umap/js/modules/data/layer.js +195 -153
- 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 +133 -56
- 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/icon.js +2 -1
- 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 +19 -19
- umap/static/umap/js/modules/rendering/template.js +88 -21
- umap/static/umap/js/modules/rendering/ui.js +63 -14
- umap/static/umap/js/modules/request.js +2 -2
- 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 +6 -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/dialog.js +6 -1
- umap/static/umap/js/modules/ui/panel.js +10 -9
- umap/static/umap/js/modules/umap.js +1691 -0
- umap/static/umap/js/modules/urls.js +2 -2
- umap/static/umap/js/modules/utils.js +22 -6
- umap/static/umap/js/umap.controls.js +81 -305
- umap/static/umap/js/umap.core.js +29 -50
- umap/static/umap/js/umap.forms.js +78 -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 +14 -9
- umap/static/umap/locale/en.json +14 -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 +14 -9
- umap/static/umap/locale/fr.json +14 -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 +39 -530
- umap/static/umap/unittests/URLs.js +15 -15
- umap/static/umap/unittests/utils.js +23 -1
- umap/static/umap/vars.css +2 -1
- umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +5 -1
- umap/storage/__init__.py +3 -0
- umap/storage/fs.py +101 -0
- umap/storage/s3.py +61 -0
- umap/templates/base.html +2 -0
- umap/templates/registration/login.html +7 -6
- umap/templates/umap/components/alerts/alert.html +4 -0
- umap/templates/umap/css.html +6 -0
- umap/templates/umap/js.html +3 -2
- umap/templates/umap/map_init.html +6 -5
- umap/templates/umap/user_dashboard.html +20 -19
- umap/tests/base.py +11 -1
- umap/tests/fixtures/empty_tile.png +0 -0
- umap/tests/fixtures/test_upload_simple_marker.json +19 -0
- umap/tests/integration/conftest.py +4 -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 +29 -7
- umap/tests/integration/test_import.py +28 -4
- 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_dashboard.py +82 -0
- 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_statics.py +1 -1
- umap/tests/test_team_views.py +35 -1
- umap/tests/test_views.py +31 -52
- umap/urls.py +3 -3
- umap/views.py +126 -90
- {umap_project-2.7.2.dist-info → umap_project-2.8.0.dist-info}/METADATA +16 -14
- {umap_project-2.7.2.dist-info → umap_project-2.8.0.dist-info}/RECORD +290 -269
- {umap_project-2.7.2.dist-info → umap_project-2.8.0.dist-info}/WHEEL +1 -1
- 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/{storage.py → storage/staticfiles.py} +0 -0
- {umap_project-2.7.2.dist-info → umap_project-2.8.0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.7.2.dist-info → umap_project-2.8.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -2,7 +2,7 @@ U.BaseAction = L.ToolbarAction.extend({
|
|
|
2
2
|
initialize: function (map) {
|
|
3
3
|
this.map = map
|
|
4
4
|
if (this.options.label) {
|
|
5
|
-
this.options.tooltip = this.map.help.displayLabel(
|
|
5
|
+
this.options.tooltip = this.map._umap.help.displayLabel(
|
|
6
6
|
this.options.label,
|
|
7
7
|
(withKbdTag = false)
|
|
8
8
|
)
|
|
@@ -12,8 +12,8 @@ U.BaseAction = L.ToolbarAction.extend({
|
|
|
12
12
|
tooltip: this.options.tooltip,
|
|
13
13
|
}
|
|
14
14
|
L.ToolbarAction.prototype.initialize.call(this)
|
|
15
|
-
if (this.options.helpMenu && !
|
|
16
|
-
|
|
15
|
+
if (this.options.helpMenu && !U.Help.MENU_ACTIONS[this.options.className])
|
|
16
|
+
U.Help.MENU_ACTIONS[this.options.className] = this
|
|
17
17
|
},
|
|
18
18
|
})
|
|
19
19
|
|
|
@@ -25,7 +25,7 @@ U.ImportAction = U.BaseAction.extend({
|
|
|
25
25
|
},
|
|
26
26
|
|
|
27
27
|
addHooks: function () {
|
|
28
|
-
this.map.importer.open()
|
|
28
|
+
this.map._umap.importer.open()
|
|
29
29
|
},
|
|
30
30
|
})
|
|
31
31
|
|
|
@@ -37,7 +37,7 @@ U.EditLayersAction = U.BaseAction.extend({
|
|
|
37
37
|
},
|
|
38
38
|
|
|
39
39
|
addHooks: function () {
|
|
40
|
-
this.map.editDatalayers()
|
|
40
|
+
this.map._umap.editDatalayers()
|
|
41
41
|
},
|
|
42
42
|
})
|
|
43
43
|
|
|
@@ -49,7 +49,7 @@ U.EditCaptionAction = U.BaseAction.extend({
|
|
|
49
49
|
},
|
|
50
50
|
|
|
51
51
|
addHooks: function () {
|
|
52
|
-
this.map.editCaption()
|
|
52
|
+
this.map._umap.editCaption()
|
|
53
53
|
},
|
|
54
54
|
})
|
|
55
55
|
|
|
@@ -61,7 +61,7 @@ U.EditPropertiesAction = U.BaseAction.extend({
|
|
|
61
61
|
},
|
|
62
62
|
|
|
63
63
|
addHooks: function () {
|
|
64
|
-
this.map.edit()
|
|
64
|
+
this.map._umap.edit()
|
|
65
65
|
},
|
|
66
66
|
})
|
|
67
67
|
|
|
@@ -84,7 +84,7 @@ U.UpdateExtentAction = U.BaseAction.extend({
|
|
|
84
84
|
},
|
|
85
85
|
|
|
86
86
|
addHooks: function () {
|
|
87
|
-
this.map.setCenterAndZoom()
|
|
87
|
+
this.map._umap.setCenterAndZoom()
|
|
88
88
|
},
|
|
89
89
|
})
|
|
90
90
|
|
|
@@ -95,7 +95,7 @@ U.UpdatePermsAction = U.BaseAction.extend({
|
|
|
95
95
|
},
|
|
96
96
|
|
|
97
97
|
addHooks: function () {
|
|
98
|
-
this.map.permissions.edit()
|
|
98
|
+
this.map._umap.permissions.edit()
|
|
99
99
|
},
|
|
100
100
|
})
|
|
101
101
|
|
|
@@ -107,7 +107,7 @@ U.DrawMarkerAction = U.BaseAction.extend({
|
|
|
107
107
|
},
|
|
108
108
|
|
|
109
109
|
addHooks: function () {
|
|
110
|
-
this.map.startMarker()
|
|
110
|
+
this.map.editTools.startMarker()
|
|
111
111
|
},
|
|
112
112
|
})
|
|
113
113
|
|
|
@@ -119,7 +119,7 @@ U.DrawPolylineAction = U.BaseAction.extend({
|
|
|
119
119
|
},
|
|
120
120
|
|
|
121
121
|
addHooks: function () {
|
|
122
|
-
this.map.startPolyline()
|
|
122
|
+
this.map.editTools.startPolyline()
|
|
123
123
|
},
|
|
124
124
|
})
|
|
125
125
|
|
|
@@ -131,7 +131,7 @@ U.DrawPolygonAction = U.BaseAction.extend({
|
|
|
131
131
|
},
|
|
132
132
|
|
|
133
133
|
addHooks: function () {
|
|
134
|
-
this.map.startPolygon()
|
|
134
|
+
this.map.editTools.startPolygon()
|
|
135
135
|
},
|
|
136
136
|
})
|
|
137
137
|
|
|
@@ -142,7 +142,8 @@ U.AddPolylineShapeAction = U.BaseAction.extend({
|
|
|
142
142
|
},
|
|
143
143
|
|
|
144
144
|
addHooks: function () {
|
|
145
|
-
|
|
145
|
+
// FIXME: smells bad
|
|
146
|
+
this.map._umap.editedFeature.ui.editor.newShape()
|
|
146
147
|
},
|
|
147
148
|
})
|
|
148
149
|
|
|
@@ -305,18 +306,24 @@ U.DrawToolbar = L.Toolbar.Control.extend({
|
|
|
305
306
|
|
|
306
307
|
appendToContainer: function (container) {
|
|
307
308
|
this.options.actions = []
|
|
308
|
-
if (this.map.
|
|
309
|
+
if (this.map._umap.properties.enableMarkerDraw) {
|
|
309
310
|
this.options.actions.push(U.DrawMarkerAction)
|
|
310
311
|
}
|
|
311
|
-
if (this.map.
|
|
312
|
+
if (this.map._umap.properties.enablePolylineDraw) {
|
|
312
313
|
this.options.actions.push(U.DrawPolylineAction)
|
|
313
|
-
if (
|
|
314
|
+
if (
|
|
315
|
+
this.map._umap.editedFeature &&
|
|
316
|
+
this.map._umap.editedFeature instanceof U.LineString
|
|
317
|
+
) {
|
|
314
318
|
this.options.actions.push(U.AddPolylineShapeAction)
|
|
315
319
|
}
|
|
316
320
|
}
|
|
317
|
-
if (this.map.
|
|
321
|
+
if (this.map._umap.properties.enablePolygonDraw) {
|
|
318
322
|
this.options.actions.push(U.DrawPolygonAction)
|
|
319
|
-
if (
|
|
323
|
+
if (
|
|
324
|
+
this.map._umap.editedFeature &&
|
|
325
|
+
this.map._umap.editedFeature instanceof U.Polygon
|
|
326
|
+
) {
|
|
320
327
|
this.options.actions.push(U.AddPolygonShapeAction)
|
|
321
328
|
}
|
|
322
329
|
}
|
|
@@ -350,24 +357,24 @@ U.DropControl = L.Class.extend({
|
|
|
350
357
|
L.DomEvent.off(this.dropzone, 'dragleave', this.dragleave, this)
|
|
351
358
|
},
|
|
352
359
|
|
|
353
|
-
dragenter: function (
|
|
354
|
-
L.DomEvent.stop(
|
|
360
|
+
dragenter: function (event) {
|
|
361
|
+
L.DomEvent.stop(event)
|
|
355
362
|
this.map.scrollWheelZoom.disable()
|
|
356
363
|
this.dropzone.classList.add('umap-dragover')
|
|
357
364
|
},
|
|
358
365
|
|
|
359
|
-
dragover: (
|
|
360
|
-
L.DomEvent.stop(
|
|
366
|
+
dragover: (event) => {
|
|
367
|
+
L.DomEvent.stop(event)
|
|
361
368
|
},
|
|
362
369
|
|
|
363
|
-
drop: function (
|
|
370
|
+
drop: function (event) {
|
|
364
371
|
this.map.scrollWheelZoom.enable()
|
|
365
372
|
this.dropzone.classList.remove('umap-dragover')
|
|
366
|
-
L.DomEvent.stop(
|
|
367
|
-
for (
|
|
368
|
-
this.map.processFileToImport(file)
|
|
373
|
+
L.DomEvent.stop(event)
|
|
374
|
+
for (const file of event.dataTransfer.files) {
|
|
375
|
+
this.map._umap.processFileToImport(file)
|
|
369
376
|
}
|
|
370
|
-
this.map.onceDataLoaded(this.map.fitDataBounds)
|
|
377
|
+
this.map._umap.onceDataLoaded(this.map._umap.fitDataBounds)
|
|
371
378
|
},
|
|
372
379
|
|
|
373
380
|
dragleave: function () {
|
|
@@ -382,20 +389,20 @@ U.EditControl = L.Control.extend({
|
|
|
382
389
|
},
|
|
383
390
|
|
|
384
391
|
onAdd: function (map) {
|
|
385
|
-
const container = L.DomUtil.create('div', '
|
|
392
|
+
const container = L.DomUtil.create('div', 'edit-enable')
|
|
386
393
|
const enableEditing = L.DomUtil.createButton(
|
|
387
394
|
'',
|
|
388
395
|
container,
|
|
389
396
|
L._('Edit'),
|
|
390
|
-
map.enableEdit,
|
|
391
|
-
map
|
|
397
|
+
map._umap.enableEdit,
|
|
398
|
+
map._umap
|
|
392
399
|
)
|
|
393
400
|
L.DomEvent.on(
|
|
394
401
|
enableEditing,
|
|
395
402
|
'mouseover',
|
|
396
403
|
() => {
|
|
397
|
-
map.tooltip.open({
|
|
398
|
-
content: map.help.displayLabel('TOGGLE_EDIT'),
|
|
404
|
+
map._umap.tooltip.open({
|
|
405
|
+
content: map._umap.help.displayLabel('TOGGLE_EDIT'),
|
|
399
406
|
anchor: enableEditing,
|
|
400
407
|
position: 'bottom',
|
|
401
408
|
delay: 750,
|
|
@@ -476,8 +483,8 @@ U.PermanentCreditsControl = L.Control.extend({
|
|
|
476
483
|
})
|
|
477
484
|
|
|
478
485
|
L.Control.Button = L.Control.extend({
|
|
479
|
-
initialize: function (
|
|
480
|
-
this.
|
|
486
|
+
initialize: function (umap, options) {
|
|
487
|
+
this._umap = umap
|
|
481
488
|
L.Control.prototype.initialize.call(this, options)
|
|
482
489
|
},
|
|
483
490
|
|
|
@@ -510,11 +517,11 @@ U.DataLayersControl = L.Control.Button.extend({
|
|
|
510
517
|
},
|
|
511
518
|
|
|
512
519
|
afterAdd: function (container) {
|
|
513
|
-
U.Utils.toggleBadge(container, this.
|
|
520
|
+
U.Utils.toggleBadge(container, this._umap.browser?.hasFilters())
|
|
514
521
|
},
|
|
515
522
|
|
|
516
523
|
onClick: function () {
|
|
517
|
-
this.
|
|
524
|
+
this._umap.openBrowser()
|
|
518
525
|
},
|
|
519
526
|
})
|
|
520
527
|
|
|
@@ -526,7 +533,7 @@ U.CaptionControl = L.Control.Button.extend({
|
|
|
526
533
|
},
|
|
527
534
|
|
|
528
535
|
onClick: function () {
|
|
529
|
-
this.
|
|
536
|
+
this._umap.openCaption()
|
|
530
537
|
},
|
|
531
538
|
})
|
|
532
539
|
|
|
@@ -537,12 +544,12 @@ U.StarControl = L.Control.Button.extend({
|
|
|
537
544
|
},
|
|
538
545
|
|
|
539
546
|
getClassName: function () {
|
|
540
|
-
const status = this.
|
|
547
|
+
const status = this._umap.properties.starred ? ' starred' : ''
|
|
541
548
|
return `leaflet-control-star umap-control${status}`
|
|
542
549
|
},
|
|
543
550
|
|
|
544
551
|
onClick: function () {
|
|
545
|
-
this.
|
|
552
|
+
this._umap.star()
|
|
546
553
|
},
|
|
547
554
|
})
|
|
548
555
|
|
|
@@ -554,248 +561,10 @@ L.Control.Embed = L.Control.Button.extend({
|
|
|
554
561
|
},
|
|
555
562
|
|
|
556
563
|
onClick: function () {
|
|
557
|
-
this.
|
|
564
|
+
this._umap.share.open()
|
|
558
565
|
},
|
|
559
566
|
})
|
|
560
567
|
|
|
561
|
-
const ControlsMixin = {
|
|
562
|
-
HIDDABLE_CONTROLS: [
|
|
563
|
-
'zoom',
|
|
564
|
-
'search',
|
|
565
|
-
'fullscreen',
|
|
566
|
-
'embed',
|
|
567
|
-
'datalayers',
|
|
568
|
-
'caption',
|
|
569
|
-
'locate',
|
|
570
|
-
'measure',
|
|
571
|
-
'editinosm',
|
|
572
|
-
'star',
|
|
573
|
-
'tilelayers',
|
|
574
|
-
],
|
|
575
|
-
|
|
576
|
-
renderEditToolbar: function () {
|
|
577
|
-
const className = 'umap-main-edit-toolbox'
|
|
578
|
-
const container =
|
|
579
|
-
document.querySelector(`.${className}`) ||
|
|
580
|
-
L.DomUtil.create(
|
|
581
|
-
'div',
|
|
582
|
-
`${className} with-transition dark`,
|
|
583
|
-
this._controlContainer
|
|
584
|
-
)
|
|
585
|
-
container.innerHTML = ''
|
|
586
|
-
const leftContainer = L.DomUtil.create('div', 'umap-left-edit-toolbox', container)
|
|
587
|
-
const rightContainer = L.DomUtil.create('div', 'umap-right-edit-toolbox', container)
|
|
588
|
-
const logo = L.DomUtil.create('div', 'logo', leftContainer)
|
|
589
|
-
L.DomUtil.createLink('', logo, 'uMap', '/', null, L._('Go to the homepage'))
|
|
590
|
-
const nameButton = L.DomUtil.createButton('map-name', leftContainer, '')
|
|
591
|
-
L.DomEvent.on(
|
|
592
|
-
nameButton,
|
|
593
|
-
'mouseover',
|
|
594
|
-
function () {
|
|
595
|
-
this.tooltip.open({
|
|
596
|
-
content: L._('Edit the title of the map'),
|
|
597
|
-
anchor: nameButton,
|
|
598
|
-
position: 'bottom',
|
|
599
|
-
delay: 500,
|
|
600
|
-
duration: 5000,
|
|
601
|
-
})
|
|
602
|
-
},
|
|
603
|
-
this
|
|
604
|
-
)
|
|
605
|
-
const shareStatusButton = L.DomUtil.createButton(
|
|
606
|
-
'share-status',
|
|
607
|
-
leftContainer,
|
|
608
|
-
'',
|
|
609
|
-
this.permissions.edit,
|
|
610
|
-
this.permissions
|
|
611
|
-
)
|
|
612
|
-
L.DomEvent.on(
|
|
613
|
-
shareStatusButton,
|
|
614
|
-
'mouseover',
|
|
615
|
-
function () {
|
|
616
|
-
this.tooltip.open({
|
|
617
|
-
content: L._('Update who can see and edit the map'),
|
|
618
|
-
anchor: shareStatusButton,
|
|
619
|
-
position: 'bottom',
|
|
620
|
-
delay: 500,
|
|
621
|
-
duration: 5000,
|
|
622
|
-
})
|
|
623
|
-
},
|
|
624
|
-
this
|
|
625
|
-
)
|
|
626
|
-
if (this.options.editMode === 'advanced') {
|
|
627
|
-
L.DomEvent.on(nameButton, 'click', this.editCaption, this)
|
|
628
|
-
L.DomEvent.on(shareStatusButton, 'click', this.permissions.edit, this.permissions)
|
|
629
|
-
}
|
|
630
|
-
if (this.options.user?.id) {
|
|
631
|
-
const button = U.Utils.loadTemplate(`
|
|
632
|
-
<button class="umap-user flat" type="button">
|
|
633
|
-
<i class="icon icon-16 icon-profile"></i>
|
|
634
|
-
<span>${this.options.user.name}</span>
|
|
635
|
-
</button>
|
|
636
|
-
`)
|
|
637
|
-
rightContainer.appendChild(button)
|
|
638
|
-
const menu = new U.ContextMenu({ className: 'dark', fixed: true })
|
|
639
|
-
const actions = [
|
|
640
|
-
{
|
|
641
|
-
label: L._('New map'),
|
|
642
|
-
action: this.urls.get('map_new'),
|
|
643
|
-
},
|
|
644
|
-
{
|
|
645
|
-
label: L._('My maps'),
|
|
646
|
-
action: this.urls.get('user_dashboard'),
|
|
647
|
-
},
|
|
648
|
-
{
|
|
649
|
-
label: L._('My teams'),
|
|
650
|
-
action: this.urls.get('user_teams'),
|
|
651
|
-
},
|
|
652
|
-
]
|
|
653
|
-
if (this.urls.has('user_profile')) {
|
|
654
|
-
actions.push({
|
|
655
|
-
label: L._('My profile'),
|
|
656
|
-
action: this.urls.get('user_profile'),
|
|
657
|
-
})
|
|
658
|
-
}
|
|
659
|
-
button.addEventListener('click', () => {
|
|
660
|
-
menu.openBelow(button, actions)
|
|
661
|
-
})
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
const connectedPeers = this.sync.getNumberOfConnectedPeers()
|
|
665
|
-
if (connectedPeers !== 0) {
|
|
666
|
-
const connectedPeersCount = L.DomUtil.createButton(
|
|
667
|
-
'leaflet-control-connected-peers',
|
|
668
|
-
rightContainer,
|
|
669
|
-
''
|
|
670
|
-
)
|
|
671
|
-
L.DomEvent.on(connectedPeersCount, 'mouseover', () => {
|
|
672
|
-
this.tooltip.open({
|
|
673
|
-
content: L._('{connectedPeers} peer(s) currently connected to this map', {
|
|
674
|
-
connectedPeers: connectedPeers,
|
|
675
|
-
}),
|
|
676
|
-
anchor: connectedPeersCount,
|
|
677
|
-
position: 'bottom',
|
|
678
|
-
delay: 500,
|
|
679
|
-
duration: 5000,
|
|
680
|
-
})
|
|
681
|
-
})
|
|
682
|
-
|
|
683
|
-
const updateConnectedPeersCount = () => {
|
|
684
|
-
connectedPeersCount.innerHTML =
|
|
685
|
-
'<span>' + this.sync.getNumberOfConnectedPeers() + '</span>'
|
|
686
|
-
}
|
|
687
|
-
updateConnectedPeersCount()
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
this.help.getStartedLink(rightContainer)
|
|
691
|
-
const controlEditCancel = L.DomUtil.createButton(
|
|
692
|
-
'leaflet-control-edit-cancel',
|
|
693
|
-
rightContainer,
|
|
694
|
-
L.DomUtil.add('span', '', null, L._('Cancel edits')),
|
|
695
|
-
this.askForReset,
|
|
696
|
-
this
|
|
697
|
-
)
|
|
698
|
-
L.DomEvent.on(
|
|
699
|
-
controlEditCancel,
|
|
700
|
-
'mouseover',
|
|
701
|
-
function () {
|
|
702
|
-
this.tooltip.open({
|
|
703
|
-
content: this.help.displayLabel('CANCEL'),
|
|
704
|
-
anchor: controlEditCancel,
|
|
705
|
-
position: 'bottom',
|
|
706
|
-
delay: 500,
|
|
707
|
-
duration: 5000,
|
|
708
|
-
})
|
|
709
|
-
},
|
|
710
|
-
this
|
|
711
|
-
)
|
|
712
|
-
const controlEditDisable = L.DomUtil.createButton(
|
|
713
|
-
'leaflet-control-edit-disable',
|
|
714
|
-
rightContainer,
|
|
715
|
-
L.DomUtil.add('span', '', null, L._('View')),
|
|
716
|
-
this.disableEdit,
|
|
717
|
-
this
|
|
718
|
-
)
|
|
719
|
-
L.DomEvent.on(
|
|
720
|
-
controlEditDisable,
|
|
721
|
-
'mouseover',
|
|
722
|
-
function () {
|
|
723
|
-
this.tooltip.open({
|
|
724
|
-
content: this.help.displayLabel('PREVIEW'),
|
|
725
|
-
anchor: controlEditDisable,
|
|
726
|
-
position: 'bottom',
|
|
727
|
-
delay: 500,
|
|
728
|
-
duration: 5000,
|
|
729
|
-
})
|
|
730
|
-
},
|
|
731
|
-
this
|
|
732
|
-
)
|
|
733
|
-
const controlEditSave = L.DomUtil.createButton(
|
|
734
|
-
'leaflet-control-edit-save button',
|
|
735
|
-
rightContainer,
|
|
736
|
-
L.DomUtil.add('span', '', null, L._('Save')),
|
|
737
|
-
this.save,
|
|
738
|
-
this
|
|
739
|
-
)
|
|
740
|
-
L.DomEvent.on(
|
|
741
|
-
controlEditSave,
|
|
742
|
-
'mouseover',
|
|
743
|
-
function () {
|
|
744
|
-
this.tooltip.open({
|
|
745
|
-
content: this.help.displayLabel('SAVE'),
|
|
746
|
-
anchor: controlEditSave,
|
|
747
|
-
position: 'bottom',
|
|
748
|
-
delay: 500,
|
|
749
|
-
duration: 5000,
|
|
750
|
-
})
|
|
751
|
-
},
|
|
752
|
-
this
|
|
753
|
-
)
|
|
754
|
-
},
|
|
755
|
-
|
|
756
|
-
editDatalayers: function () {
|
|
757
|
-
if (!this.editEnabled) return
|
|
758
|
-
const container = L.DomUtil.create('div')
|
|
759
|
-
L.DomUtil.createTitle(container, L._('Manage layers'), 'icon-layers')
|
|
760
|
-
const ul = L.DomUtil.create('ul', '', container)
|
|
761
|
-
this.eachDataLayerReverse((datalayer) => {
|
|
762
|
-
const row = L.DomUtil.create('li', 'orderable', ul)
|
|
763
|
-
L.DomUtil.createIcon(row, 'icon-drag', L._('Drag to reorder'))
|
|
764
|
-
datalayer.renderToolbox(row)
|
|
765
|
-
const title = L.DomUtil.add('span', '', row, datalayer.options.name)
|
|
766
|
-
row.classList.toggle('off', !datalayer.isVisible())
|
|
767
|
-
title.textContent = datalayer.options.name
|
|
768
|
-
row.dataset.id = L.stamp(datalayer)
|
|
769
|
-
})
|
|
770
|
-
const onReorder = (src, dst, initialIndex, finalIndex) => {
|
|
771
|
-
const layer = this.datalayers[src.dataset.id]
|
|
772
|
-
const other = this.datalayers[dst.dataset.id]
|
|
773
|
-
const minIndex = Math.min(layer.getRank(), other.getRank())
|
|
774
|
-
const maxIndex = Math.max(layer.getRank(), other.getRank())
|
|
775
|
-
if (finalIndex === 0) layer.bringToTop()
|
|
776
|
-
else if (finalIndex > initialIndex) layer.insertBefore(other)
|
|
777
|
-
else layer.insertAfter(other)
|
|
778
|
-
this.eachDataLayerReverse((datalayer) => {
|
|
779
|
-
if (datalayer.getRank() >= minIndex && datalayer.getRank() <= maxIndex)
|
|
780
|
-
datalayer.isDirty = true
|
|
781
|
-
})
|
|
782
|
-
this.indexDatalayers()
|
|
783
|
-
}
|
|
784
|
-
const orderable = new U.Orderable(ul, onReorder)
|
|
785
|
-
|
|
786
|
-
const bar = L.DomUtil.create('div', 'button-bar', container)
|
|
787
|
-
L.DomUtil.createButton(
|
|
788
|
-
'show-on-edit block add-datalayer button',
|
|
789
|
-
bar,
|
|
790
|
-
L._('Add a layer'),
|
|
791
|
-
this.newDataLayer,
|
|
792
|
-
this
|
|
793
|
-
)
|
|
794
|
-
|
|
795
|
-
this.editPanel.open({ content: container })
|
|
796
|
-
},
|
|
797
|
-
}
|
|
798
|
-
|
|
799
568
|
/* Used in view mode to define the current tilelayer */
|
|
800
569
|
U.TileLayerControl = L.Control.IconLayers.extend({
|
|
801
570
|
initialize: function (map, options) {
|
|
@@ -819,7 +588,7 @@ U.TileLayerControl = L.Control.IconLayers.extend({
|
|
|
819
588
|
// Fixme when https://github.com/Leaflet/Leaflet/pull/9201 is released
|
|
820
589
|
const icon = U.Utils.template(
|
|
821
590
|
layer.options.url_template,
|
|
822
|
-
this.map.demoTileInfos
|
|
591
|
+
this.map.options.demoTileInfos
|
|
823
592
|
)
|
|
824
593
|
layers.push({
|
|
825
594
|
title: layer.options.name,
|
|
@@ -885,7 +654,7 @@ U.TileLayerChooser = L.Control.extend({
|
|
|
885
654
|
L.DomUtil.createTitle(container, L._('Change tilelayers'), 'icon-tilelayer')
|
|
886
655
|
this._tilelayers_container = L.DomUtil.create('ul', '', container)
|
|
887
656
|
this.buildList(options)
|
|
888
|
-
const panel = options.edit ? this.map.editPanel : this.map.panel
|
|
657
|
+
const panel = options.edit ? this.map._umap.editPanel : this.map._umap.panel
|
|
889
658
|
panel.open({ content: container })
|
|
890
659
|
},
|
|
891
660
|
|
|
@@ -905,16 +674,22 @@ U.TileLayerChooser = L.Control.extend({
|
|
|
905
674
|
const el = L.DomUtil.create('li', selectedClass, this._tilelayers_container)
|
|
906
675
|
const img = L.DomUtil.create('img', '', el)
|
|
907
676
|
const name = L.DomUtil.create('div', '', el)
|
|
908
|
-
img.src = U.Utils.template(
|
|
677
|
+
img.src = U.Utils.template(
|
|
678
|
+
tilelayer.options.url_template,
|
|
679
|
+
this.map.options.demoTileInfos
|
|
680
|
+
)
|
|
909
681
|
img.loading = 'lazy'
|
|
910
682
|
name.textContent = tilelayer.options.name
|
|
911
683
|
L.DomEvent.on(
|
|
912
684
|
el,
|
|
913
685
|
'click',
|
|
914
|
-
|
|
686
|
+
() => {
|
|
915
687
|
this.map.selectTileLayer(tilelayer)
|
|
916
688
|
this.map._controls.tilelayers.setLayers()
|
|
917
|
-
if (options?.
|
|
689
|
+
if (options?.edit) {
|
|
690
|
+
this.map._umap.properties.tilelayer = tilelayer.toJSON()
|
|
691
|
+
this.map._umap.isDirty = true
|
|
692
|
+
}
|
|
918
693
|
},
|
|
919
694
|
this
|
|
920
695
|
)
|
|
@@ -935,8 +710,8 @@ U.AttributionControl = L.Control.Attribution.extend({
|
|
|
935
710
|
this._container.innerHTML = ''
|
|
936
711
|
const container = L.DomUtil.create('div', 'attribution-container', this._container)
|
|
937
712
|
container.innerHTML = credits
|
|
938
|
-
const shortCredit = this._map.
|
|
939
|
-
const captionMenus = this._map.
|
|
713
|
+
const shortCredit = this._map._umap.getProperty('shortCredit')
|
|
714
|
+
const captionMenus = this._map._umap.getProperty('captionMenus')
|
|
940
715
|
if (shortCredit) {
|
|
941
716
|
L.DomUtil.element({
|
|
942
717
|
tagName: 'span',
|
|
@@ -947,7 +722,7 @@ U.AttributionControl = L.Control.Attribution.extend({
|
|
|
947
722
|
if (captionMenus) {
|
|
948
723
|
const link = L.DomUtil.add('a', '', container, ` — ${L._('Open caption')}`)
|
|
949
724
|
L.DomEvent.on(link, 'click', L.DomEvent.stop)
|
|
950
|
-
.on(link, 'click', this._map.openCaption
|
|
725
|
+
.on(link, 'click', () => this._map._umap.openCaption())
|
|
951
726
|
.on(link, 'dblclick', L.DomEvent.stop)
|
|
952
727
|
}
|
|
953
728
|
if (window.top === window.self && captionMenus) {
|
|
@@ -1139,7 +914,7 @@ U.SearchControl = L.Control.extend({
|
|
|
1139
914
|
this.map.fire('dataload', { id: id })
|
|
1140
915
|
})
|
|
1141
916
|
this.search.resultsContainer = resultsContainer
|
|
1142
|
-
this.map.panel.open({ content: container }).then(input.focus())
|
|
917
|
+
this.map._umap.panel.open({ content: container }).then(input.focus())
|
|
1143
918
|
},
|
|
1144
919
|
})
|
|
1145
920
|
|
|
@@ -1170,17 +945,18 @@ L.Control.Loading.include({
|
|
|
1170
945
|
},
|
|
1171
946
|
|
|
1172
947
|
_showIndicator: function () {
|
|
1173
|
-
|
|
948
|
+
this._map._container.classList.add('umap-loading')
|
|
1174
949
|
},
|
|
1175
950
|
|
|
1176
951
|
_hideIndicator: function () {
|
|
1177
|
-
|
|
952
|
+
this._map._container.classList.remove('umap-loading')
|
|
1178
953
|
},
|
|
1179
954
|
})
|
|
1180
955
|
|
|
1181
956
|
U.Editable = L.Editable.extend({
|
|
1182
|
-
initialize: function (
|
|
1183
|
-
|
|
957
|
+
initialize: function (umap, options) {
|
|
958
|
+
this._umap = umap
|
|
959
|
+
L.Editable.prototype.initialize.call(this, umap._leafletMap, options)
|
|
1184
960
|
this.on('editable:drawing:click editable:drawing:move', this.drawingTooltip)
|
|
1185
961
|
// Layer for items added by users
|
|
1186
962
|
this.on('editable:drawing:cancel', (event) => {
|
|
@@ -1188,7 +964,7 @@ U.Editable = L.Editable.extend({
|
|
|
1188
964
|
})
|
|
1189
965
|
this.on('editable:drawing:commit', function (event) {
|
|
1190
966
|
event.layer.feature.isDirty = true
|
|
1191
|
-
if (this.
|
|
967
|
+
if (this._umap.editedFeature !== event.layer) event.layer.feature.edit(event)
|
|
1192
968
|
})
|
|
1193
969
|
this.on('editable:editing', (event) => {
|
|
1194
970
|
const feature = event.layer.feature
|
|
@@ -1210,24 +986,24 @@ U.Editable = L.Editable.extend({
|
|
|
1210
986
|
},
|
|
1211
987
|
|
|
1212
988
|
createPolyline: function (latlngs) {
|
|
1213
|
-
const datalayer = this.
|
|
1214
|
-
const point = new U.LineString(datalayer, {
|
|
989
|
+
const datalayer = this._umap.defaultEditDataLayer()
|
|
990
|
+
const point = new U.LineString(this._umap, datalayer, {
|
|
1215
991
|
geometry: { type: 'LineString', coordinates: [] },
|
|
1216
992
|
})
|
|
1217
993
|
return point.ui
|
|
1218
994
|
},
|
|
1219
995
|
|
|
1220
996
|
createPolygon: function (latlngs) {
|
|
1221
|
-
const datalayer = this.
|
|
1222
|
-
const point = new U.Polygon(datalayer, {
|
|
997
|
+
const datalayer = this._umap.defaultEditDataLayer()
|
|
998
|
+
const point = new U.Polygon(this._umap, datalayer, {
|
|
1223
999
|
geometry: { type: 'Polygon', coordinates: [] },
|
|
1224
1000
|
})
|
|
1225
1001
|
return point.ui
|
|
1226
1002
|
},
|
|
1227
1003
|
|
|
1228
1004
|
createMarker: function (latlng) {
|
|
1229
|
-
const datalayer = this.
|
|
1230
|
-
const point = new U.Point(datalayer, {
|
|
1005
|
+
const datalayer = this._umap.defaultEditDataLayer()
|
|
1006
|
+
const point = new U.Point(this._umap, datalayer, {
|
|
1231
1007
|
geometry: { type: 'Point', coordinates: [latlng.lng, latlng.lat] },
|
|
1232
1008
|
})
|
|
1233
1009
|
return point.ui
|
|
@@ -1235,15 +1011,15 @@ U.Editable = L.Editable.extend({
|
|
|
1235
1011
|
|
|
1236
1012
|
_getDefaultProperties: function () {
|
|
1237
1013
|
const result = {}
|
|
1238
|
-
if (this.
|
|
1239
|
-
result.geojson = { properties: { owner: this.
|
|
1014
|
+
if (this._umap.properties.featuresHaveOwner?.user) {
|
|
1015
|
+
result.geojson = { properties: { owner: this._umap.properties.user.id } }
|
|
1240
1016
|
}
|
|
1241
1017
|
return result
|
|
1242
1018
|
},
|
|
1243
1019
|
|
|
1244
1020
|
connectCreatedToMap: function (layer) {
|
|
1245
1021
|
// Overrided from Leaflet.Editable
|
|
1246
|
-
const datalayer = this.
|
|
1022
|
+
const datalayer = this._umap.defaultEditDataLayer()
|
|
1247
1023
|
datalayer.addFeature(layer.feature)
|
|
1248
1024
|
layer.isDirty = true
|
|
1249
1025
|
return layer
|
|
@@ -1251,7 +1027,7 @@ U.Editable = L.Editable.extend({
|
|
|
1251
1027
|
|
|
1252
1028
|
drawingTooltip: function (e) {
|
|
1253
1029
|
if (e.layer instanceof L.Marker && e.type === 'editable:drawing:start') {
|
|
1254
|
-
this.
|
|
1030
|
+
this._umap.tooltip.open({ content: L._('Click to add a marker') })
|
|
1255
1031
|
}
|
|
1256
1032
|
if (!(e.layer instanceof L.Polyline)) {
|
|
1257
1033
|
// only continue with Polylines and Polygons
|
|
@@ -1298,12 +1074,12 @@ U.Editable = L.Editable.extend({
|
|
|
1298
1074
|
}
|
|
1299
1075
|
}
|
|
1300
1076
|
if (content) {
|
|
1301
|
-
this.
|
|
1077
|
+
this._umap.tooltip.open({ content: content })
|
|
1302
1078
|
}
|
|
1303
1079
|
},
|
|
1304
1080
|
|
|
1305
1081
|
closeTooltip: function () {
|
|
1306
|
-
this.
|
|
1082
|
+
this._umap.closeTooltip()
|
|
1307
1083
|
},
|
|
1308
1084
|
|
|
1309
1085
|
onVertexRawClick: (e) => {
|
|
@@ -1314,7 +1090,7 @@ U.Editable = L.Editable.extend({
|
|
|
1314
1090
|
|
|
1315
1091
|
onEscape: function () {
|
|
1316
1092
|
this.once('editable:drawing:end', (event) => {
|
|
1317
|
-
this.
|
|
1093
|
+
this._umap.tooltip.close()
|
|
1318
1094
|
// Leaflet.Editable will delete the drawn shape if invalid
|
|
1319
1095
|
// (eg. line has only one drawn point)
|
|
1320
1096
|
// So let's check if the layer has no more shape
|