umap-project 3.2.0__py3-none-any.whl → 3.3.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.
Potentially problematic release.
This version of umap-project might be problematic. Click here for more details.
- umap/__init__.py +1 -1
- umap/locale/en/LC_MESSAGES/django.mo +0 -0
- umap/locale/en/LC_MESSAGES/django.po +15 -15
- umap/settings/base.py +2 -0
- umap/static/umap/css/contextmenu.css +58 -2
- umap/static/umap/css/form.css +175 -45
- umap/static/umap/css/icon.css +20 -0
- umap/static/umap/img/16-white.svg +21 -40
- umap/static/umap/img/16.svg +1 -1
- umap/static/umap/img/24-white.svg +9 -9
- umap/static/umap/img/24.svg +23 -10
- umap/static/umap/img/source/16-white.svg +23 -41
- umap/static/umap/img/source/16.svg +1 -1
- umap/static/umap/img/source/24-white.svg +11 -11
- umap/static/umap/img/source/24.svg +25 -12
- umap/static/umap/js/modules/caption.js +8 -0
- umap/static/umap/js/modules/data/features.js +317 -173
- umap/static/umap/js/modules/data/layer.js +17 -18
- umap/static/umap/js/modules/form/builder.js +11 -7
- umap/static/umap/js/modules/form/fields.js +10 -7
- umap/static/umap/js/modules/formatter.js +42 -20
- umap/static/umap/js/modules/importer.js +6 -1
- umap/static/umap/js/modules/importers/opendata.js +125 -37
- umap/static/umap/js/modules/importers/openrouteservice.js +140 -0
- umap/static/umap/js/modules/managers.js +12 -4
- umap/static/umap/js/modules/printer.js +107 -0
- umap/static/umap/js/modules/rendering/controls.js +78 -2
- umap/static/umap/js/modules/rendering/icon.js +113 -82
- umap/static/umap/js/modules/rendering/layers/cluster.js +199 -63
- umap/static/umap/js/modules/rendering/map.js +5 -1
- umap/static/umap/js/modules/rendering/template.js +71 -1
- umap/static/umap/js/modules/rendering/ui.js +98 -34
- umap/static/umap/js/modules/schema.js +24 -0
- umap/static/umap/js/modules/share.js +19 -12
- umap/static/umap/js/modules/ui/bar.js +6 -1
- umap/static/umap/js/modules/ui/base.js +24 -9
- umap/static/umap/js/modules/ui/contextmenu.js +17 -7
- umap/static/umap/js/modules/ui/dialog.js +7 -4
- umap/static/umap/js/modules/umap.js +67 -61
- umap/static/umap/js/umap.controls.js +22 -57
- umap/static/umap/locale/am_ET.js +39 -4
- umap/static/umap/locale/am_ET.json +39 -4
- umap/static/umap/locale/ar.js +39 -4
- umap/static/umap/locale/ar.json +39 -4
- umap/static/umap/locale/ast.js +39 -4
- umap/static/umap/locale/ast.json +39 -4
- umap/static/umap/locale/bg.js +39 -4
- umap/static/umap/locale/bg.json +39 -4
- umap/static/umap/locale/br.js +39 -4
- umap/static/umap/locale/br.json +39 -4
- umap/static/umap/locale/ca.js +39 -4
- umap/static/umap/locale/ca.json +39 -4
- umap/static/umap/locale/cs_CZ.js +39 -4
- umap/static/umap/locale/cs_CZ.json +39 -4
- umap/static/umap/locale/da.js +47 -12
- umap/static/umap/locale/da.json +47 -12
- umap/static/umap/locale/de.js +39 -4
- umap/static/umap/locale/de.json +39 -4
- umap/static/umap/locale/el.js +39 -4
- umap/static/umap/locale/el.json +39 -4
- umap/static/umap/locale/en.js +39 -4
- umap/static/umap/locale/en.json +39 -4
- umap/static/umap/locale/en_US.json +39 -4
- umap/static/umap/locale/es.js +47 -12
- umap/static/umap/locale/es.json +47 -12
- umap/static/umap/locale/et.js +39 -4
- umap/static/umap/locale/et.json +39 -4
- umap/static/umap/locale/eu.js +79 -44
- umap/static/umap/locale/eu.json +79 -44
- umap/static/umap/locale/fa_IR.js +39 -4
- umap/static/umap/locale/fa_IR.json +39 -4
- umap/static/umap/locale/fi.js +39 -4
- umap/static/umap/locale/fi.json +39 -4
- umap/static/umap/locale/fr.js +39 -4
- umap/static/umap/locale/fr.json +39 -4
- umap/static/umap/locale/gl.js +39 -4
- umap/static/umap/locale/gl.json +39 -4
- umap/static/umap/locale/he.js +39 -4
- umap/static/umap/locale/he.json +39 -4
- umap/static/umap/locale/hr.js +39 -4
- umap/static/umap/locale/hr.json +39 -4
- umap/static/umap/locale/hu.js +39 -4
- umap/static/umap/locale/hu.json +39 -4
- umap/static/umap/locale/id.js +39 -4
- umap/static/umap/locale/id.json +39 -4
- umap/static/umap/locale/is.js +39 -4
- umap/static/umap/locale/is.json +39 -4
- umap/static/umap/locale/it.js +39 -4
- umap/static/umap/locale/it.json +39 -4
- umap/static/umap/locale/ja.js +39 -4
- umap/static/umap/locale/ja.json +39 -4
- umap/static/umap/locale/ko.js +39 -4
- umap/static/umap/locale/ko.json +39 -4
- umap/static/umap/locale/lt.js +39 -4
- umap/static/umap/locale/lt.json +39 -4
- umap/static/umap/locale/ms.js +39 -4
- umap/static/umap/locale/ms.json +39 -4
- umap/static/umap/locale/nl.js +39 -4
- umap/static/umap/locale/nl.json +39 -4
- umap/static/umap/locale/no.js +39 -4
- umap/static/umap/locale/no.json +39 -4
- umap/static/umap/locale/pl.js +39 -4
- umap/static/umap/locale/pl.json +39 -4
- umap/static/umap/locale/pl_PL.json +39 -4
- umap/static/umap/locale/pt.js +39 -4
- umap/static/umap/locale/pt.json +39 -4
- umap/static/umap/locale/pt_BR.js +39 -4
- umap/static/umap/locale/pt_BR.json +39 -4
- umap/static/umap/locale/pt_PT.js +39 -4
- umap/static/umap/locale/pt_PT.json +39 -4
- umap/static/umap/locale/ro.js +39 -4
- umap/static/umap/locale/ro.json +39 -4
- umap/static/umap/locale/ru.js +39 -4
- umap/static/umap/locale/ru.json +39 -4
- umap/static/umap/locale/sk_SK.js +39 -4
- umap/static/umap/locale/sk_SK.json +39 -4
- umap/static/umap/locale/sl.js +39 -4
- umap/static/umap/locale/sl.json +39 -4
- umap/static/umap/locale/sr.js +39 -4
- umap/static/umap/locale/sr.json +39 -4
- umap/static/umap/locale/sv.js +39 -4
- umap/static/umap/locale/sv.json +39 -4
- umap/static/umap/locale/th_TH.js +39 -4
- umap/static/umap/locale/th_TH.json +39 -4
- umap/static/umap/locale/tr.js +39 -4
- umap/static/umap/locale/tr.json +39 -4
- umap/static/umap/locale/uk_UA.js +39 -4
- umap/static/umap/locale/uk_UA.json +39 -4
- umap/static/umap/locale/vi.js +39 -4
- umap/static/umap/locale/vi.json +39 -4
- umap/static/umap/locale/vi_VN.json +39 -4
- umap/static/umap/locale/zh.js +39 -4
- umap/static/umap/locale/zh.json +39 -4
- umap/static/umap/locale/zh_CN.json +39 -4
- umap/static/umap/locale/zh_TW.Big5.json +39 -4
- umap/static/umap/locale/zh_TW.js +98 -63
- umap/static/umap/locale/zh_TW.json +98 -63
- umap/static/umap/map.css +90 -41
- umap/static/umap/vars.css +1 -0
- umap/static/umap/vendors/editable/Leaflet.Editable.js +3 -1
- umap/static/umap/vendors/openrouteservice/ors-js-client.js +521 -0
- umap/static/umap/vendors/openrouteservice/ors-js-client.js.map +1 -0
- umap/static/umap/vendors/simple-elevation-chart/elevation.js +63 -0
- umap/static/umap/vendors/simple-elevation-chart/elevation.svg +8 -0
- umap/static/umap/vendors/snapdom/snapdom.min.mjs +3 -0
- umap/storage/staticfiles.py +12 -0
- umap/templates/umap/css.html +0 -4
- umap/templates/umap/js.html +1 -3
- umap/tests/integration/test_basics.py +2 -0
- umap/tests/integration/test_conditional_rules.py +17 -17
- umap/tests/integration/test_datalayer.py +1 -1
- umap/tests/integration/test_draw_polygon.py +3 -5
- umap/tests/integration/test_draw_polyline.py +4 -6
- umap/tests/integration/test_draw_route.py +178 -0
- umap/tests/integration/test_edit_map.py +1 -1
- umap/tests/integration/test_edit_marker.py +7 -7
- umap/tests/integration/test_edit_polygon.py +2 -2
- umap/tests/integration/test_export_map.py +74 -10
- umap/tests/integration/test_map_preview.py +1 -1
- umap/tests/integration/test_share.py +1 -1
- umap/tests/integration/test_tableeditor.py +4 -4
- umap/tests/integration/test_websocket_sync.py +4 -4
- umap/utils.py +5 -1
- umap/views.py +2 -0
- {umap_project-3.2.0.dist-info → umap_project-3.3.0.dist-info}/METADATA +8 -8
- {umap_project-3.2.0.dist-info → umap_project-3.3.0.dist-info}/RECORD +169 -165
- umap/static/umap/vendors/markercluster/MarkerCluster.Default.css +0 -60
- umap/static/umap/vendors/markercluster/MarkerCluster.css +0 -14
- umap/static/umap/vendors/markercluster/leaflet.markercluster.js +0 -2
- umap/static/umap/vendors/markercluster/leaflet.markercluster.js.map +0 -1
- {umap_project-3.2.0.dist-info → umap_project-3.3.0.dist-info}/WHEEL +0 -0
- {umap_project-3.2.0.dist-info → umap_project-3.3.0.dist-info}/entry_points.txt +0 -0
- {umap_project-3.2.0.dist-info → umap_project-3.3.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -43,7 +43,7 @@ export default class Share {
|
|
|
43
43
|
const list = document.createElement('ul')
|
|
44
44
|
list.classList.add('downloads')
|
|
45
45
|
this.container.appendChild(list)
|
|
46
|
-
for (const format of Object.keys(EXPORT_FORMATS)) {
|
|
46
|
+
for (const format of Object.keys(EXPORT_FORMATS).concat('jpg', 'png')) {
|
|
47
47
|
const button = Utils.loadTemplate(`
|
|
48
48
|
<li>
|
|
49
49
|
<button class="flat" type="button">
|
|
@@ -142,22 +142,29 @@ export default class Share {
|
|
|
142
142
|
|
|
143
143
|
async format(mode) {
|
|
144
144
|
const type = EXPORT_FORMATS[mode]
|
|
145
|
-
const
|
|
145
|
+
const features = this._umap.datalayers
|
|
146
|
+
.visible()
|
|
147
|
+
.reduce((acc, dl) => acc.concat(dl.features.visible()), [])
|
|
148
|
+
const content = await this._umap.formatter.stringify(features, mode)
|
|
146
149
|
const filename = Utils.slugify(this._umap.properties.name) + type.ext
|
|
147
150
|
return { content, filetype: type.filetype, filename }
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
async download(mode) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
154
|
+
if (!(mode in EXPORT_FORMATS)) {
|
|
155
|
+
this._umap.openPrinter(mode)
|
|
156
|
+
} else {
|
|
157
|
+
const { content, filetype, filename } = await this.format(mode)
|
|
158
|
+
const blob = new Blob([content], { type: filetype })
|
|
159
|
+
window.URL = window.URL || window.webkitURL
|
|
160
|
+
const el = document.createElement('a')
|
|
161
|
+
el.download = filename
|
|
162
|
+
el.href = window.URL.createObjectURL(blob)
|
|
163
|
+
el.style.display = 'none'
|
|
164
|
+
document.body.appendChild(el)
|
|
165
|
+
el.click()
|
|
166
|
+
document.body.removeChild(el)
|
|
167
|
+
}
|
|
161
168
|
}
|
|
162
169
|
}
|
|
163
170
|
|
|
@@ -213,7 +213,9 @@ export class BottomBar extends WithTemplate {
|
|
|
213
213
|
const selected = select.options[select.selectedIndex].value
|
|
214
214
|
if (!selected) return
|
|
215
215
|
this._umap.datalayers.active().map((datalayer) => {
|
|
216
|
-
|
|
216
|
+
if (datalayer.properties.inCaption !== false) {
|
|
217
|
+
datalayer.toggle(datalayer.id === selected)
|
|
218
|
+
}
|
|
217
219
|
})
|
|
218
220
|
})
|
|
219
221
|
this.redraw()
|
|
@@ -263,6 +265,7 @@ const EDIT_BAR_TEMPLATE = `
|
|
|
263
265
|
<li data-ref="multipolygon" hidden>
|
|
264
266
|
<button type="button" title="${translate('Add a polygon to the current multi')}"><i class="icon icon-24 icon-multipolygon"></i></button>
|
|
265
267
|
</li>
|
|
268
|
+
<li data-ref="route" hidden><button type="button" data-getstarted title="${translate('Draw along routes')}"><i class="icon icon-24 icon-route"></i></button></li>
|
|
266
269
|
<hr>
|
|
267
270
|
<li data-ref="caption" hidden><button data-getstarted type="button" title="${translate('Edit map name and caption')}"><i class="icon icon-24 icon-caption"></i></button></li>
|
|
268
271
|
<li data-ref="import" hidden><button type="button"><i class="icon icon-24 icon-upload"></i></button></li>
|
|
@@ -293,6 +296,7 @@ export class EditBar extends WithTemplate {
|
|
|
293
296
|
this._onClick('multiline', () => this._umap.editedFeature.ui.editor.newShape())
|
|
294
297
|
this._onClick('polygon', () => this._leafletMap.editTools.startPolygon())
|
|
295
298
|
this._onClick('multipolygon', () => this._umap.editedFeature.ui.editor.newShape())
|
|
299
|
+
this._onClick('route', () => this._leafletMap.editTools.startRoute())
|
|
296
300
|
this._onClick('caption', () => this._umap.editCaption())
|
|
297
301
|
this._onClick('import', () => this._umap.importer.open())
|
|
298
302
|
this._onClick('templates', () => this.templateIimporter.open())
|
|
@@ -321,6 +325,7 @@ export class EditBar extends WithTemplate {
|
|
|
321
325
|
this.elements.center.hidden = this._umap.properties.editMode !== 'advanced'
|
|
322
326
|
this.elements.permissions.hidden = this._umap.properties.editMode !== 'advanced'
|
|
323
327
|
this.elements.settings.hidden = this._umap.properties.editMode !== 'advanced'
|
|
328
|
+
this.elements.route.hidden = !this._umap.properties.ORSAPIKey
|
|
324
329
|
}
|
|
325
330
|
|
|
326
331
|
_addTitle(ref, label) {
|
|
@@ -12,9 +12,19 @@ export class Positioned {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
toggleClassPosition(position) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const positions = [
|
|
16
|
+
'bottom',
|
|
17
|
+
'top',
|
|
18
|
+
'left',
|
|
19
|
+
'right',
|
|
20
|
+
'bottom-right',
|
|
21
|
+
'bottom-left',
|
|
22
|
+
'top-right',
|
|
23
|
+
'top-left',
|
|
24
|
+
]
|
|
25
|
+
for (const known of positions) {
|
|
26
|
+
this.container.classList.toggle(`tooltip-${known}`, position === known)
|
|
27
|
+
}
|
|
18
28
|
}
|
|
19
29
|
|
|
20
30
|
anchorTop(el) {
|
|
@@ -39,7 +49,6 @@ export class Positioned {
|
|
|
39
49
|
anchorRight(el) {
|
|
40
50
|
this.toggleClassPosition('right')
|
|
41
51
|
const coords = this.getPosition(el)
|
|
42
|
-
console.log(coords)
|
|
43
52
|
this.setPosition({
|
|
44
53
|
left: coords.right + 11,
|
|
45
54
|
top: coords.top,
|
|
@@ -71,18 +80,24 @@ export class Positioned {
|
|
|
71
80
|
}
|
|
72
81
|
|
|
73
82
|
computePosition([x, y]) {
|
|
83
|
+
let tooltip = ''
|
|
74
84
|
let left
|
|
75
85
|
let top
|
|
76
|
-
if (x < window.innerWidth / 2) {
|
|
77
|
-
left = x
|
|
78
|
-
} else {
|
|
79
|
-
left = x - this.container.offsetWidth
|
|
80
|
-
}
|
|
81
86
|
if (y < window.innerHeight / 2) {
|
|
82
87
|
top = Math.min(y, window.innerHeight - this.container.offsetHeight)
|
|
88
|
+
tooltip += 'top'
|
|
83
89
|
} else {
|
|
84
90
|
top = Math.max(0, y - this.container.offsetHeight)
|
|
91
|
+
tooltip += 'bottom'
|
|
92
|
+
}
|
|
93
|
+
if (x < window.innerWidth / 2) {
|
|
94
|
+
left = x
|
|
95
|
+
tooltip += '-left'
|
|
96
|
+
} else {
|
|
97
|
+
left = x - this.container.offsetWidth
|
|
98
|
+
tooltip += '-right'
|
|
85
99
|
}
|
|
100
|
+
this.toggleClassPosition(tooltip)
|
|
86
101
|
this.setPosition({ left, top })
|
|
87
102
|
}
|
|
88
103
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadTemplate } from '../utils.js'
|
|
1
|
+
import { loadTemplate, loadTemplateWithRefs } from '../utils.js'
|
|
2
2
|
import { Positioned } from './base.js'
|
|
3
3
|
|
|
4
4
|
export default class ContextMenu extends Positioned {
|
|
@@ -29,16 +29,21 @@ export default class ContextMenu extends Positioned {
|
|
|
29
29
|
this.openAt([coords.left, coords.bottom], items)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
this.container.innerHTML = ''
|
|
32
|
+
addItems(items, container) {
|
|
34
33
|
for (const item of items) {
|
|
35
34
|
if (item === '-') {
|
|
36
|
-
|
|
35
|
+
container.appendChild(document.createElement('hr'))
|
|
36
|
+
} else if (item.items) {
|
|
37
|
+
const [li, { bar }] = loadTemplateWithRefs(
|
|
38
|
+
`<li class="dark"><ul data-ref=bar class="icon-bar"></ul></li>`
|
|
39
|
+
)
|
|
40
|
+
this.addItems(item.items, bar)
|
|
41
|
+
container.appendChild(li)
|
|
37
42
|
} else if (typeof item.action === 'string') {
|
|
38
43
|
const li = loadTemplate(
|
|
39
44
|
`<li class="${item.className || ''}"><a tabindex="0" href="${item.action}">${item.label}</a></li>`
|
|
40
45
|
)
|
|
41
|
-
|
|
46
|
+
container.appendChild(li)
|
|
42
47
|
} else {
|
|
43
48
|
let content = item.label || ''
|
|
44
49
|
if (item.icon) {
|
|
@@ -51,9 +56,14 @@ export default class ContextMenu extends Positioned {
|
|
|
51
56
|
this.close()
|
|
52
57
|
item.action()
|
|
53
58
|
})
|
|
54
|
-
|
|
59
|
+
container.appendChild(li)
|
|
55
60
|
}
|
|
56
61
|
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
openAt([left, top], items) {
|
|
65
|
+
this.container.innerHTML = ''
|
|
66
|
+
this.addItems(items, this.container)
|
|
57
67
|
// When adding contextmenu below the map container, clicking on any link will send the
|
|
58
68
|
// "focusout" element on link click, preventing to trigger the click action
|
|
59
69
|
const parent = document
|
|
@@ -65,7 +75,7 @@ export default class ContextMenu extends Positioned {
|
|
|
65
75
|
} else {
|
|
66
76
|
this.computePosition([left, top])
|
|
67
77
|
}
|
|
68
|
-
this.container.querySelector('
|
|
78
|
+
this.container.querySelector('button, a').focus()
|
|
69
79
|
this.container.addEventListener(
|
|
70
80
|
'keydown',
|
|
71
81
|
(event) => {
|
|
@@ -37,7 +37,8 @@ export default class Dialog extends WithTemplate {
|
|
|
37
37
|
this.init()
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
collectFormData(
|
|
40
|
+
collectFormData() {
|
|
41
|
+
const formData = new FormData(this.elements.form)
|
|
41
42
|
const object = {}
|
|
42
43
|
formData.forEach((value, key) => {
|
|
43
44
|
if (!Reflect.has(object, key)) {
|
|
@@ -145,6 +146,10 @@ export default class Dialog extends WithTemplate {
|
|
|
145
146
|
return this.waitForUser()
|
|
146
147
|
}
|
|
147
148
|
|
|
149
|
+
on(...args) {
|
|
150
|
+
this.dialog.addEventListener(...args)
|
|
151
|
+
}
|
|
152
|
+
|
|
148
153
|
close() {
|
|
149
154
|
this.toggle(false)
|
|
150
155
|
this.dialog.returnValue = undefined
|
|
@@ -171,9 +176,7 @@ export default class Dialog extends WithTemplate {
|
|
|
171
176
|
'close',
|
|
172
177
|
(event) => {
|
|
173
178
|
if (this.dialog.returnValue === 'accept') {
|
|
174
|
-
const value = this.hasFormData
|
|
175
|
-
? this.collectFormData(new FormData(this.elements.form))
|
|
176
|
-
: true
|
|
179
|
+
const value = this.hasFormData ? this.collectFormData() : true
|
|
177
180
|
resolve(value)
|
|
178
181
|
}
|
|
179
182
|
},
|
|
@@ -33,6 +33,7 @@ import Tooltip from './ui/tooltip.js'
|
|
|
33
33
|
import URLs from './urls.js'
|
|
34
34
|
import * as Utils from './utils.js'
|
|
35
35
|
import { DataLayerManager } from './managers.js'
|
|
36
|
+
import { Importer as OpenRouteService } from './importers/openrouteservice.js'
|
|
36
37
|
|
|
37
38
|
export default class Umap {
|
|
38
39
|
constructor(element, geojson) {
|
|
@@ -128,7 +129,6 @@ export default class Umap {
|
|
|
128
129
|
)
|
|
129
130
|
this.tooltip = new Tooltip(this._leafletMap._controlContainer)
|
|
130
131
|
this.contextmenu = new ContextMenu()
|
|
131
|
-
this.editContextmenu = new ContextMenu({ className: 'dark', orientation: 'rows' })
|
|
132
132
|
this.server = new ServerRequest()
|
|
133
133
|
this.request = new Request()
|
|
134
134
|
this.facets = new Facets(this)
|
|
@@ -210,7 +210,7 @@ export default class Umap {
|
|
|
210
210
|
|
|
211
211
|
if (!this.properties.noControl) {
|
|
212
212
|
this.initShortcuts()
|
|
213
|
-
this._leafletMap.on('contextmenu', (
|
|
213
|
+
this._leafletMap.on('contextmenu', (event) => this.onContextMenu(event))
|
|
214
214
|
this.onceDataLoaded(this.setViewFromQueryString)
|
|
215
215
|
this.bottomBar.setup()
|
|
216
216
|
this.propagate()
|
|
@@ -391,48 +391,28 @@ export default class Umap {
|
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
|
|
394
|
-
|
|
394
|
+
getOwnContextMenu(event) {
|
|
395
395
|
const items = []
|
|
396
|
-
if (this.
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
})
|
|
403
|
-
}
|
|
404
|
-
if (this.properties.enableMarkerDraw) {
|
|
405
|
-
items.push({
|
|
406
|
-
label: this.help.displayLabel('DRAW_MARKER'),
|
|
396
|
+
if (this.editEnabled) {
|
|
397
|
+
items.push({
|
|
398
|
+
items: [
|
|
399
|
+
{
|
|
400
|
+
title: this.help.displayLabel('DRAW_MARKER', false),
|
|
401
|
+
icon: 'icon-marker',
|
|
407
402
|
action: () => this._leafletMap.editTools.startMarker(),
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
label: this.help.displayLabel('DRAW_POLYGON'),
|
|
413
|
-
action: () => this._leafletMap.editTools.startPolygon(),
|
|
414
|
-
})
|
|
415
|
-
}
|
|
416
|
-
if (this.properties.enablePolygonDraw) {
|
|
417
|
-
items.push({
|
|
418
|
-
label: this.help.displayLabel('DRAW_LINE'),
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
title: this.help.displayLabel('DRAW_LINE', false),
|
|
406
|
+
icon: 'icon-polyline',
|
|
419
407
|
action: () => this._leafletMap.editTools.startPolyline(),
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
}
|
|
428
|
-
items.push({
|
|
429
|
-
label: this.help.displayLabel('TOGGLE_EDIT'),
|
|
430
|
-
action: () => this.enableEdit(),
|
|
431
|
-
})
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
if (items.length) {
|
|
435
|
-
items.push('-')
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
title: this.help.displayLabel('DRAW_POLYGON', false),
|
|
411
|
+
icon: 'icon-polygon',
|
|
412
|
+
action: () => this._leafletMap.editTools.startPolygon(),
|
|
413
|
+
},
|
|
414
|
+
],
|
|
415
|
+
})
|
|
436
416
|
}
|
|
437
417
|
items.push(
|
|
438
418
|
{
|
|
@@ -463,27 +443,32 @@ export default class Umap {
|
|
|
463
443
|
return items
|
|
464
444
|
}
|
|
465
445
|
|
|
466
|
-
|
|
446
|
+
getSharedContextMenu(event) {
|
|
467
447
|
const items = []
|
|
468
448
|
if (this.properties.urls.routing) {
|
|
469
|
-
items.push(
|
|
449
|
+
items.push({
|
|
470
450
|
label: translate('Directions from here'),
|
|
471
451
|
action: () => this.openExternalRouting(event),
|
|
472
452
|
})
|
|
473
453
|
}
|
|
454
|
+
if (this.properties.ORSAPIKey) {
|
|
455
|
+
items.push({
|
|
456
|
+
label: translate('Compute isochrone from here'),
|
|
457
|
+
action: () => this.askForIsochrone(event),
|
|
458
|
+
})
|
|
459
|
+
}
|
|
474
460
|
if (this.properties.urls.edit_in_osm) {
|
|
475
|
-
items.push(
|
|
461
|
+
items.push({
|
|
476
462
|
label: translate('Edit in OpenStreetMap'),
|
|
477
463
|
action: () => this.editInOSM(event),
|
|
478
464
|
})
|
|
479
465
|
}
|
|
466
|
+
if (items.length) items.unshift('-')
|
|
480
467
|
return items
|
|
481
468
|
}
|
|
482
469
|
|
|
483
470
|
onContextMenu(event) {
|
|
484
|
-
const items = this.
|
|
485
|
-
this.getSharedContextMenuItems(event)
|
|
486
|
-
)
|
|
471
|
+
const items = this.getOwnContextMenu(event).concat(this.getSharedContextMenu(event))
|
|
487
472
|
this.contextmenu.open(event.originalEvent, items)
|
|
488
473
|
}
|
|
489
474
|
|
|
@@ -863,6 +848,7 @@ export default class Umap {
|
|
|
863
848
|
const shapeOptions = [
|
|
864
849
|
'properties.color',
|
|
865
850
|
'properties.iconClass',
|
|
851
|
+
'properties.iconSize',
|
|
866
852
|
'properties.iconUrl',
|
|
867
853
|
'properties.iconOpacity',
|
|
868
854
|
'properties.opacity',
|
|
@@ -1276,20 +1262,6 @@ export default class Umap {
|
|
|
1276
1262
|
}
|
|
1277
1263
|
}
|
|
1278
1264
|
|
|
1279
|
-
toGeoJSON() {
|
|
1280
|
-
let features = []
|
|
1281
|
-
this.datalayers.active().map((datalayer) => {
|
|
1282
|
-
if (datalayer.isVisible()) {
|
|
1283
|
-
features = features.concat(datalayer.featuresToGeoJSON())
|
|
1284
|
-
}
|
|
1285
|
-
})
|
|
1286
|
-
const geojson = {
|
|
1287
|
-
type: 'FeatureCollection',
|
|
1288
|
-
features: features,
|
|
1289
|
-
}
|
|
1290
|
-
return geojson
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
1265
|
enableEdit() {
|
|
1294
1266
|
this.editBar.redraw()
|
|
1295
1267
|
document.body.classList.add('umap-edit-enabled')
|
|
@@ -1746,6 +1718,12 @@ export default class Umap {
|
|
|
1746
1718
|
if (url) window.open(url)
|
|
1747
1719
|
}
|
|
1748
1720
|
|
|
1721
|
+
async askForIsochrone(event) {
|
|
1722
|
+
if (!this.properties.ORSAPIKey) return
|
|
1723
|
+
const importer = new OpenRouteService(this)
|
|
1724
|
+
importer.isochrone(event.latlng)
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1749
1727
|
setCenterAndZoom() {
|
|
1750
1728
|
this._setCenterAndZoom(true)
|
|
1751
1729
|
Alert.success(translate('The zoom and center have been modified.'))
|
|
@@ -1776,4 +1754,32 @@ export default class Umap {
|
|
|
1776
1754
|
redo() {
|
|
1777
1755
|
this.sync._undoManager.redo()
|
|
1778
1756
|
}
|
|
1757
|
+
|
|
1758
|
+
async screenshot() {
|
|
1759
|
+
const { snapdom, preCache } = await import('../../vendors/snapdom/snapdom.min.mjs')
|
|
1760
|
+
const el = document.querySelector('#map')
|
|
1761
|
+
await preCache(el)
|
|
1762
|
+
const result = await snapdom(el, {
|
|
1763
|
+
scale: 1,
|
|
1764
|
+
type: 'jpg',
|
|
1765
|
+
fast: false,
|
|
1766
|
+
exclude: [
|
|
1767
|
+
'.leaflet-control',
|
|
1768
|
+
'.umap-loader',
|
|
1769
|
+
'.panel',
|
|
1770
|
+
'.umap-caption-bar',
|
|
1771
|
+
'.umap-main-edit-toolbox',
|
|
1772
|
+
'.umap-edit-bar',
|
|
1773
|
+
],
|
|
1774
|
+
})
|
|
1775
|
+
return result
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
async openPrinter(action) {
|
|
1779
|
+
if (!this._printer) {
|
|
1780
|
+
const Printer = (await import('./printer.js')).default
|
|
1781
|
+
this._printer = new Printer(this)
|
|
1782
|
+
}
|
|
1783
|
+
this._printer.open(action)
|
|
1784
|
+
}
|
|
1779
1785
|
}
|
|
@@ -210,57 +210,6 @@ U.Search = L.PhotonSearch.extend({
|
|
|
210
210
|
},
|
|
211
211
|
})
|
|
212
212
|
|
|
213
|
-
U.SearchControl = L.Control.extend({
|
|
214
|
-
options: {
|
|
215
|
-
position: 'topleft',
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
onAdd: function (map) {
|
|
219
|
-
this.map = map
|
|
220
|
-
const container = L.DomUtil.create('div', 'leaflet-control-search umap-control')
|
|
221
|
-
L.DomEvent.disableClickPropagation(container)
|
|
222
|
-
L.DomUtil.createButton(
|
|
223
|
-
'',
|
|
224
|
-
container,
|
|
225
|
-
L._('Search location'),
|
|
226
|
-
(e) => {
|
|
227
|
-
L.DomEvent.stop(e)
|
|
228
|
-
this.open()
|
|
229
|
-
},
|
|
230
|
-
this
|
|
231
|
-
)
|
|
232
|
-
this.layer = L.layerGroup().addTo(map)
|
|
233
|
-
return container
|
|
234
|
-
},
|
|
235
|
-
|
|
236
|
-
onRemove: function () {
|
|
237
|
-
this.layer.remove()
|
|
238
|
-
},
|
|
239
|
-
|
|
240
|
-
open: function () {
|
|
241
|
-
const options = {
|
|
242
|
-
limit: 10,
|
|
243
|
-
noResultLabel: L._('No results'),
|
|
244
|
-
}
|
|
245
|
-
if (this.map.options.photonUrl) options.url = this.map.options.photonUrl
|
|
246
|
-
const container = L.DomUtil.create('div', '')
|
|
247
|
-
|
|
248
|
-
L.DomUtil.createTitle(container, L._('Search location'), 'icon-search')
|
|
249
|
-
const input = L.DomUtil.create('input', 'photon-input', container)
|
|
250
|
-
const resultsContainer = L.DomUtil.create('div', 'photon-autocomplete', container)
|
|
251
|
-
this.search = new U.Search(this.map, input, this.layer, options)
|
|
252
|
-
const id = Math.random()
|
|
253
|
-
this.search.on('ajax:send', () => {
|
|
254
|
-
this.map.fire('dataloading', { id: id })
|
|
255
|
-
})
|
|
256
|
-
this.search.on('ajax:return', () => {
|
|
257
|
-
this.map.fire('dataload', { id: id })
|
|
258
|
-
})
|
|
259
|
-
this.search.resultsContainer = resultsContainer
|
|
260
|
-
this.map._umap.panel.open({ content: container }).then(input.focus())
|
|
261
|
-
},
|
|
262
|
-
})
|
|
263
|
-
|
|
264
213
|
L.Control.MiniMap.include({
|
|
265
214
|
initialize: function (layer, options) {
|
|
266
215
|
L.Util.setOptions(this, options)
|
|
@@ -306,7 +255,14 @@ U.Editable = L.Editable.extend({
|
|
|
306
255
|
if (event.layer instanceof U.LeafletMarker) event.layer.feature.del()
|
|
307
256
|
})
|
|
308
257
|
this.on('editable:drawing:commit', function (event) {
|
|
309
|
-
if (this._umap.editedFeature !== event.layer)
|
|
258
|
+
if (this._umap.editedFeature !== event.layer) {
|
|
259
|
+
const promise = event.layer.feature.edit(event)
|
|
260
|
+
if (event.layer.feature.isRoute?.()) {
|
|
261
|
+
promise.then((panel) => {
|
|
262
|
+
panel.scrollTo('details#edit-route')
|
|
263
|
+
})
|
|
264
|
+
}
|
|
265
|
+
}
|
|
310
266
|
})
|
|
311
267
|
this.on('editable:vertex:ctrlclick', (event) => {
|
|
312
268
|
const index = event.vertex.getIndex()
|
|
@@ -322,13 +278,24 @@ U.Editable = L.Editable.extend({
|
|
|
322
278
|
this.on('editable:vertex:rawclick', this.onVertexRawClick)
|
|
323
279
|
},
|
|
324
280
|
|
|
325
|
-
|
|
281
|
+
startRoute: function (latlng) {
|
|
282
|
+
const feature = this.createLineString()
|
|
283
|
+
feature.askForRouteSettings().then(async () => {
|
|
284
|
+
feature.ui.enableEdit(this.map).newShape(latlng)
|
|
285
|
+
})
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
createLineString: function () {
|
|
326
289
|
const datalayer = this._umap.defaultEditDataLayer()
|
|
327
290
|
const line = new U.LineString(this._umap, datalayer, {
|
|
328
291
|
geometry: { type: 'LineString', coordinates: [] },
|
|
329
292
|
})
|
|
330
293
|
line._needs_upsert = true
|
|
331
|
-
return line
|
|
294
|
+
return line
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
createPolyline: function (latlngs, properties = {}) {
|
|
298
|
+
return this.createLineString().ui
|
|
332
299
|
},
|
|
333
300
|
|
|
334
301
|
createPolygon: function (latlngs) {
|
|
@@ -372,7 +339,6 @@ U.Editable = L.Editable.extend({
|
|
|
372
339
|
// only continue with Polylines and Polygons
|
|
373
340
|
return
|
|
374
341
|
}
|
|
375
|
-
|
|
376
342
|
let content = L._('Drawing')
|
|
377
343
|
let measure
|
|
378
344
|
if (e.layer.editor._drawnLatLngs) {
|
|
@@ -422,8 +388,7 @@ U.Editable = L.Editable.extend({
|
|
|
422
388
|
},
|
|
423
389
|
|
|
424
390
|
onVertexRawClick: (e) => {
|
|
425
|
-
|
|
426
|
-
L.DomEvent.stop(e)
|
|
391
|
+
// Do not delete the vertex on click (but on alt-click only)
|
|
427
392
|
e.cancel()
|
|
428
393
|
},
|
|
429
394
|
|
umap/static/umap/locale/am_ET.js
CHANGED
|
@@ -57,7 +57,6 @@ const locale = {
|
|
|
57
57
|
"Click last point to finish shape": "ቅርፁን ለማስጨረስ የመጨረሻውን ነጥብ ጠቅ ያድርጉ",
|
|
58
58
|
"Click to add a marker": "መለያ ለመጨመር ጠቅ አድርግ",
|
|
59
59
|
"Click to continue drawing": "መሳል ለመቀጠል ጠቅ አድርግ",
|
|
60
|
-
"Click to edit": "ለማረም ጠቅ አድርግ",
|
|
61
60
|
"Click to start drawing a line": "መስመር ለመሳል ጠቅ አድርግ",
|
|
62
61
|
"Click to start drawing a polygon": "ፖሊጎን ለመሳል ጠቅ አድርግ",
|
|
63
62
|
"Clone of {name}": "የ {name} ድቃይ",
|
|
@@ -209,7 +208,6 @@ const locale = {
|
|
|
209
208
|
"Link with text: [[https://example.com|text of the link]]": "Link with text: [[https://example.com|text of the link]]",
|
|
210
209
|
"Long credits": "ክሬዲቶች በመጫን ላይ",
|
|
211
210
|
"Longitude": "ሎንጊትዩድ",
|
|
212
|
-
"Make main shape": "ዋና ቅርፅ አድርግ",
|
|
213
211
|
"Manage layers": "Manage layers",
|
|
214
212
|
"Manual": "Manual",
|
|
215
213
|
"Map background credits": "የካርታ የጀርባ ክሬዲትስ",
|
|
@@ -285,7 +283,6 @@ const locale = {
|
|
|
285
283
|
"Quantiles": "Quantiles",
|
|
286
284
|
"Recent": "Recent",
|
|
287
285
|
"Remote data": "ሪሞት ዳታ",
|
|
288
|
-
"Remove shape from the multi": "ከብዝሀው ላይ ቅርፁን አስወግድ",
|
|
289
286
|
"Replace layer content": "Replace layer content",
|
|
290
287
|
"Restore this version": "ይህንን እትም መልስ",
|
|
291
288
|
"Save current edits": "የአሁኑን እርማቶች አስቀምጥ/አድን",
|
|
@@ -580,7 +577,45 @@ const locale = {
|
|
|
580
577
|
"Manage Fields": "Manage Fields",
|
|
581
578
|
"Rename this field": "Rename this field",
|
|
582
579
|
"Delete this field": "Delete this field",
|
|
583
|
-
"Double click to edit the name": "Double click to edit the name"
|
|
580
|
+
"Double click to edit the name": "Double click to edit the name",
|
|
581
|
+
"Print map": "Print map",
|
|
582
|
+
"Choose a format": "Choose a format",
|
|
583
|
+
"Scale map": "Scale map",
|
|
584
|
+
"portrait": "portrait",
|
|
585
|
+
"landscape": "landscape",
|
|
586
|
+
"Print": "Print",
|
|
587
|
+
"Preparing the print…": "Preparing the print…",
|
|
588
|
+
"Large Circle": "Large Circle",
|
|
589
|
+
"Icon size": "Icon size",
|
|
590
|
+
"Will only affect raw and large circle icons.": "Will only affect raw and large circle icons.",
|
|
591
|
+
"Route": "Route",
|
|
592
|
+
"Display the print control": "Display the print control",
|
|
593
|
+
"Compute isochrone from here": "Compute isochrone from here",
|
|
594
|
+
"Route settings": "Route settings",
|
|
595
|
+
"Transform to regular line": "Transform to regular line",
|
|
596
|
+
"Transform to route": "Transform to route",
|
|
597
|
+
"Restore route": "Restore route",
|
|
598
|
+
"Compute elevation": "Compute elevation",
|
|
599
|
+
"Profile": "Profile",
|
|
600
|
+
"Compute elevations": "Compute elevations",
|
|
601
|
+
"Route preference": "Route preference",
|
|
602
|
+
"Compute route": "Compute route",
|
|
603
|
+
"Walking": "Walking",
|
|
604
|
+
"Hiking": "Hiking",
|
|
605
|
+
"By car": "By car",
|
|
606
|
+
"Cycling": "Cycling",
|
|
607
|
+
"Wheelchair": "Wheelchair",
|
|
608
|
+
"Recommended": "Recommended",
|
|
609
|
+
"Fastest": "Fastest",
|
|
610
|
+
"Shortest": "Shortest",
|
|
611
|
+
"Max time (in minutes)": "Max time (in minutes)",
|
|
612
|
+
"Number of lines": "Number of lines",
|
|
613
|
+
"Distance:": "Distance:",
|
|
614
|
+
"Gain:": "Gain:",
|
|
615
|
+
"Loss:": "Loss:",
|
|
616
|
+
"Altitude:": "Altitude:",
|
|
617
|
+
"Right-click to edit": "Right-click to edit",
|
|
618
|
+
"Draw along routes": "Draw along routes"
|
|
584
619
|
}
|
|
585
620
|
L.registerLocale("am_ET", locale)
|
|
586
621
|
L.setLocale("am_ET")
|