umap-project 3.4.0b3__py3-none-any.whl → 3.4.2__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/locale/da/LC_MESSAGES/django.mo +0 -0
- umap/locale/da/LC_MESSAGES/django.po +18 -14
- umap/locale/en/LC_MESSAGES/django.po +5 -1
- umap/locale/es/LC_MESSAGES/django.mo +0 -0
- umap/locale/es/LC_MESSAGES/django.po +20 -16
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +18 -14
- umap/locale/pl/LC_MESSAGES/django.mo +0 -0
- umap/locale/pl/LC_MESSAGES/django.po +72 -71
- umap/static/umap/content.css +0 -3
- umap/static/umap/css/bar.css +9 -6
- umap/static/umap/css/form.css +25 -9
- umap/static/umap/css/popup.css +1 -0
- umap/static/umap/js/components/copiable.js +47 -0
- umap/static/umap/js/modules/autocomplete.js +31 -58
- umap/static/umap/js/modules/browser.js +4 -4
- umap/static/umap/js/modules/data/features.js +32 -35
- umap/static/umap/js/modules/data/fields.js +189 -23
- umap/static/umap/js/modules/data/layer.js +72 -87
- umap/static/umap/js/modules/domutils.js +21 -1
- umap/static/umap/js/modules/filters.js +13 -40
- umap/static/umap/js/modules/form/fields.js +4 -4
- umap/static/umap/js/modules/formatter.js +9 -1
- umap/static/umap/js/modules/help.js +12 -13
- umap/static/umap/js/modules/importer.js +17 -26
- umap/static/umap/js/modules/importers/banfr.js +0 -1
- umap/static/umap/js/modules/importers/cadastrefr.js +19 -19
- umap/static/umap/js/modules/importers/communesfr.js +7 -8
- umap/static/umap/js/modules/importers/datasets.js +14 -14
- umap/static/umap/js/modules/importers/geodatamine.js +20 -22
- umap/static/umap/js/modules/importers/opendata.js +10 -0
- umap/static/umap/js/modules/importers/overpass.js +19 -18
- umap/static/umap/js/modules/managers.js +1 -1
- umap/static/umap/js/modules/permissions.js +5 -3
- umap/static/umap/js/modules/rendering/controls.js +2 -2
- umap/static/umap/js/modules/rendering/icon.js +5 -9
- umap/static/umap/js/modules/rendering/layers/base.js +1 -1
- umap/static/umap/js/modules/rendering/layers/classified.js +15 -10
- umap/static/umap/js/modules/rendering/layers/heat.js +1 -0
- umap/static/umap/js/modules/rendering/map.js +22 -22
- umap/static/umap/js/modules/rendering/popup.js +6 -3
- umap/static/umap/js/modules/rendering/template.js +28 -34
- umap/static/umap/js/modules/rendering/ui.js +1 -2
- umap/static/umap/js/modules/rules.js +34 -41
- umap/static/umap/js/modules/schema.js +0 -7
- umap/static/umap/js/modules/share.js +36 -69
- umap/static/umap/js/modules/slideshow.js +3 -3
- umap/static/umap/js/modules/tableeditor.js +0 -1
- umap/static/umap/js/modules/ui/bar.js +51 -32
- umap/static/umap/js/modules/ui/panel.js +26 -21
- umap/static/umap/js/modules/ui/tooltip.js +1 -1
- umap/static/umap/js/modules/umap.js +75 -80
- umap/static/umap/js/modules/utils.js +12 -3
- umap/static/umap/js/umap.controls.js +33 -14
- umap/static/umap/locale/am_ET.js +6 -4
- umap/static/umap/locale/am_ET.json +6 -4
- umap/static/umap/locale/ar.js +6 -4
- umap/static/umap/locale/ar.json +6 -4
- umap/static/umap/locale/ast.js +6 -4
- umap/static/umap/locale/ast.json +6 -4
- umap/static/umap/locale/bg.js +6 -4
- umap/static/umap/locale/bg.json +6 -4
- umap/static/umap/locale/br.js +19 -8
- umap/static/umap/locale/br.json +19 -8
- umap/static/umap/locale/ca.js +6 -4
- umap/static/umap/locale/ca.json +6 -4
- umap/static/umap/locale/cs_CZ.js +7 -5
- umap/static/umap/locale/cs_CZ.json +7 -5
- umap/static/umap/locale/da.js +8 -6
- umap/static/umap/locale/da.json +8 -6
- umap/static/umap/locale/de.js +38 -36
- umap/static/umap/locale/de.json +38 -36
- umap/static/umap/locale/el.js +7 -5
- umap/static/umap/locale/el.json +7 -5
- umap/static/umap/locale/en.js +7 -5
- umap/static/umap/locale/en.json +7 -5
- umap/static/umap/locale/en_US.json +6 -4
- umap/static/umap/locale/es.js +19 -17
- umap/static/umap/locale/es.json +19 -17
- umap/static/umap/locale/et.js +7 -5
- umap/static/umap/locale/et.json +7 -5
- umap/static/umap/locale/eu.js +23 -21
- umap/static/umap/locale/eu.json +23 -21
- umap/static/umap/locale/fa_IR.js +7 -5
- umap/static/umap/locale/fa_IR.json +7 -5
- umap/static/umap/locale/fi.js +6 -4
- umap/static/umap/locale/fi.json +6 -4
- umap/static/umap/locale/fr.js +8 -6
- umap/static/umap/locale/fr.json +8 -6
- umap/static/umap/locale/gl.js +147 -145
- umap/static/umap/locale/gl.json +147 -145
- umap/static/umap/locale/he.js +6 -4
- umap/static/umap/locale/he.json +6 -4
- umap/static/umap/locale/hr.js +6 -4
- umap/static/umap/locale/hr.json +6 -4
- umap/static/umap/locale/hu.js +7 -5
- umap/static/umap/locale/hu.json +7 -5
- umap/static/umap/locale/id.js +6 -4
- umap/static/umap/locale/id.json +6 -4
- umap/static/umap/locale/is.js +7 -5
- umap/static/umap/locale/is.json +7 -5
- umap/static/umap/locale/it.js +7 -5
- umap/static/umap/locale/it.json +7 -5
- umap/static/umap/locale/ja.js +6 -4
- umap/static/umap/locale/ja.json +6 -4
- umap/static/umap/locale/ko.js +6 -4
- umap/static/umap/locale/ko.json +6 -4
- umap/static/umap/locale/lt.js +6 -4
- umap/static/umap/locale/lt.json +6 -4
- umap/static/umap/locale/ms.js +7 -5
- umap/static/umap/locale/ms.json +7 -5
- umap/static/umap/locale/nl.js +7 -5
- umap/static/umap/locale/nl.json +7 -5
- umap/static/umap/locale/no.js +6 -4
- umap/static/umap/locale/no.json +6 -4
- umap/static/umap/locale/pl.js +53 -51
- umap/static/umap/locale/pl.json +53 -51
- umap/static/umap/locale/pl_PL.json +6 -4
- umap/static/umap/locale/pt.js +7 -5
- umap/static/umap/locale/pt.json +7 -5
- umap/static/umap/locale/pt_BR.js +6 -4
- umap/static/umap/locale/pt_BR.json +6 -4
- umap/static/umap/locale/pt_PT.js +6 -4
- umap/static/umap/locale/pt_PT.json +6 -4
- umap/static/umap/locale/ro.js +6 -4
- umap/static/umap/locale/ro.json +6 -4
- umap/static/umap/locale/ru.js +6 -4
- umap/static/umap/locale/ru.json +6 -4
- umap/static/umap/locale/sk_SK.js +6 -4
- umap/static/umap/locale/sk_SK.json +6 -4
- umap/static/umap/locale/sl.js +6 -4
- umap/static/umap/locale/sl.json +6 -4
- umap/static/umap/locale/sr.js +6 -4
- umap/static/umap/locale/sr.json +6 -4
- umap/static/umap/locale/sv.js +6 -4
- umap/static/umap/locale/sv.json +6 -4
- umap/static/umap/locale/th_TH.js +6 -4
- umap/static/umap/locale/th_TH.json +6 -4
- umap/static/umap/locale/tr.js +6 -4
- umap/static/umap/locale/tr.json +6 -4
- umap/static/umap/locale/uk_UA.js +6 -4
- umap/static/umap/locale/uk_UA.json +6 -4
- umap/static/umap/locale/vi.js +6 -4
- umap/static/umap/locale/vi.json +6 -4
- umap/static/umap/locale/vi_VN.json +6 -4
- umap/static/umap/locale/zh.js +6 -4
- umap/static/umap/locale/zh.json +6 -4
- umap/static/umap/locale/zh_CN.json +6 -4
- umap/static/umap/locale/zh_TW.Big5.json +6 -4
- umap/static/umap/locale/zh_TW.js +20 -18
- umap/static/umap/locale/zh_TW.json +20 -18
- umap/static/umap/map.css +5 -4
- umap/static/umap/unittests/utils.js +7 -7
- umap/templates/umap/content_footer.html +1 -0
- umap/templates/umap/css.html +0 -2
- umap/templates/umap/js.html +1 -3
- umap/tests/integration/conftest.py +3 -2
- umap/tests/integration/test_anonymous_owned_map.py +1 -1
- umap/tests/integration/test_conditional_rules.py +106 -51
- umap/tests/integration/test_draw_polygon.py +4 -0
- umap/tests/integration/test_draw_polyline.py +11 -0
- umap/tests/integration/test_edit_datalayer.py +1 -1
- umap/tests/integration/test_fields.py +19 -0
- umap/tests/integration/test_iframe.py +1 -1
- umap/tests/integration/test_import.py +23 -0
- umap/tests/integration/test_map.py +2 -2
- umap/tests/integration/test_owned_map.py +2 -2
- umap/tests/integration/test_popup.py +31 -0
- umap/tests/integration/test_remote_data.py +4 -4
- umap/tests/integration/test_search.py +41 -0
- umap/tests/integration/test_share.py +2 -2
- umap/tests/integration/test_team.py +1 -1
- umap/tests/integration/test_websocket_sync.py +6 -1
- umap/tests/test_utils.py +4 -1
- umap/utils.py +1 -0
- {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/METADATA +15 -15
- {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/RECORD +181 -183
- umap/static/umap/js/umap.core.js +0 -93
- umap/static/umap/vendors/editinosm/Leaflet.EditInOSM.css +0 -46
- umap/static/umap/vendors/editinosm/Leaflet.EditInOSM.js +0 -240
- umap/static/umap/vendors/editinosm/edit-in-osm.png +0 -0
- {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/WHEEL +0 -0
- {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/entry_points.txt +0 -0
- {umap_project-3.4.0b3.dist-info → umap_project-3.4.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
1
|
import { uMapAlert as Alert } from '../../components/alerts/alert.js'
|
|
3
2
|
import { BaseAjax, SingleMixin } from '../autocomplete.js'
|
|
4
3
|
import { translate } from '../i18n.js'
|
|
5
4
|
import * as Util from '../utils.js'
|
|
5
|
+
import * as DOMUtils from '../domutils.js'
|
|
6
6
|
import { AutocompleteCommunes } from './communesfr.js'
|
|
7
7
|
|
|
8
8
|
const TEMPLATE = `
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
<div>
|
|
10
|
+
<h3>Cadastre</h3>
|
|
11
|
+
<p>Importer les données cadastrales d’une commune française.</p>
|
|
12
|
+
<div class="formbox">
|
|
13
|
+
<select name="theme" data-ref="select">
|
|
14
|
+
<option value="batiments">Bâtiments</option>
|
|
15
|
+
<option value="communes">Communes</option>
|
|
16
|
+
<option value="feuilles">Feuilles</option>
|
|
17
|
+
<option value="lieux_dits">Lieux dits</option>
|
|
18
|
+
<option value="parcelles" selected>Parcelles</option>
|
|
19
|
+
<option value="prefixes_sections">Préfixes sections</option>
|
|
20
|
+
<option value="sections">Sections</option>
|
|
21
|
+
<option value="subdivisions_fiscales">Subdivisions fiscales</option>
|
|
22
|
+
</select>
|
|
23
|
+
<label id="boundary">
|
|
24
|
+
</label>
|
|
25
|
+
</div>
|
|
24
26
|
</div>
|
|
25
27
|
`
|
|
26
28
|
|
|
@@ -33,9 +35,7 @@ export class Importer {
|
|
|
33
35
|
async open(importer) {
|
|
34
36
|
let boundary = null
|
|
35
37
|
let boundaryName = null
|
|
36
|
-
const container =
|
|
37
|
-
container.innerHTML = TEMPLATE
|
|
38
|
-
const select = container.querySelector('select')
|
|
38
|
+
const [container, { select }] = DOMUtils.loadTemplateWithRefs(TEMPLATE)
|
|
39
39
|
const options = {
|
|
40
40
|
placeholder: 'Nom ou code INSEE…',
|
|
41
41
|
url: 'https://geo.api.gouv.fr/communes?nom={q}&limit=5',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
1
|
import { BaseAjax, SingleMixin } from '../autocomplete.js'
|
|
3
2
|
import * as Util from '../utils.js'
|
|
3
|
+
import * as DOMUtils from '../domutils.js'
|
|
4
4
|
|
|
5
5
|
export class AutocompleteCommunes extends SingleMixin(BaseAjax) {
|
|
6
6
|
createResult(item) {
|
|
@@ -29,13 +29,12 @@ export class Importer {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
async open(importer) {
|
|
32
|
-
const container =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})
|
|
32
|
+
const container = DOMUtils.loadTemplate(`
|
|
33
|
+
<div>
|
|
34
|
+
<h3>${this.name}</h3>
|
|
35
|
+
<p>Importer les contours d'une commune française.</p>
|
|
36
|
+
</div>
|
|
37
|
+
`)
|
|
39
38
|
const options = {
|
|
40
39
|
placeholder: 'Nom ou code INSEE…',
|
|
41
40
|
url: 'https://geo.api.gouv.fr/communes?nom={q}&limit=5',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
1
|
import { translate } from '../i18n.js'
|
|
2
|
+
import * as DOMUtils from '../domutils.js'
|
|
3
3
|
|
|
4
4
|
export class Importer {
|
|
5
5
|
constructor(map, options) {
|
|
@@ -9,20 +9,20 @@ export class Importer {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
async open(importer) {
|
|
12
|
-
const container =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
const [container, { select }] = DOMUtils.loadTemplateWithRefs(`
|
|
13
|
+
<div class="formbox">
|
|
14
|
+
<h3>${this.name}</h3>
|
|
15
|
+
<select data-ref="select">
|
|
16
|
+
<option value="">${translate('Choose a dataset')}</option>
|
|
17
|
+
</select>
|
|
18
|
+
</div>
|
|
19
|
+
`)
|
|
20
|
+
|
|
21
21
|
for (const dataset of this.choices) {
|
|
22
|
-
const option =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
option
|
|
22
|
+
const option = DOMUtils.loadTemplate(
|
|
23
|
+
`<option value="${dataset.url}" data-format="${dataset.format || 'geojson'}">${dataset.label}</option>`
|
|
24
|
+
)
|
|
25
|
+
select.appendChild(option)
|
|
26
26
|
}
|
|
27
27
|
const confirm = () => {
|
|
28
28
|
if (select.value) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DomEvent, DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
1
|
import { uMapAlert as Alert } from '../../components/alerts/alert.js'
|
|
3
2
|
import { BaseAjax, SingleMixin } from '../autocomplete.js'
|
|
4
3
|
import { translate } from '../i18n.js'
|
|
5
4
|
import * as Utils from '../utils.js'
|
|
5
|
+
import * as DOMUtils from '../domutils.js'
|
|
6
6
|
|
|
7
7
|
const BOUNDARY_TYPES = {
|
|
8
8
|
admin_6: 'département',
|
|
@@ -14,18 +14,20 @@ const BOUNDARY_TYPES = {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const TEMPLATE = `
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
<div>
|
|
18
|
+
<h3>GeoDataMine</h3>
|
|
19
|
+
<p>${translate('GeoDataMine: thematic data from OpenStreetMap')}.</p>
|
|
20
|
+
<div class="formbox">
|
|
21
|
+
<select name="theme" data-ref="select">
|
|
22
|
+
<option value="">${translate('Choose a theme')}</option>
|
|
23
|
+
</select>
|
|
24
|
+
<label>
|
|
25
|
+
<input type="checkbox" name="aspoint" />
|
|
26
|
+
${translate('Simplify all geometries to points')}
|
|
27
|
+
</label>
|
|
28
|
+
<label id="boundary">
|
|
29
|
+
</label>
|
|
30
|
+
</div>
|
|
29
31
|
</div>
|
|
30
32
|
`
|
|
31
33
|
|
|
@@ -49,20 +51,16 @@ export class Importer {
|
|
|
49
51
|
async open(importer) {
|
|
50
52
|
let boundary = null
|
|
51
53
|
let boundaryName = null
|
|
52
|
-
const container =
|
|
53
|
-
container.innerHTML = TEMPLATE
|
|
54
|
+
const [container, { select }] = DOMUtils.loadTemplateWithRefs(TEMPLATE)
|
|
54
55
|
const response = await this.umap.request.get(`${this.baseUrl}/themes`)
|
|
55
|
-
const select = container.querySelector('select')
|
|
56
56
|
if (response?.ok) {
|
|
57
57
|
const { themes } = await response.json()
|
|
58
58
|
themes.sort((a, b) => Utils.naturalSort(a['name:fr'], b['name:fr']))
|
|
59
59
|
for (const theme of themes) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
parent: select,
|
|
65
|
-
})
|
|
60
|
+
const option = DOMUtils.loadTemplate(
|
|
61
|
+
`<option value="${theme.id}">${theme['name:fr']}</option>`
|
|
62
|
+
)
|
|
63
|
+
select.appendChild(option)
|
|
66
64
|
}
|
|
67
65
|
} else {
|
|
68
66
|
console.error(response)
|
|
@@ -63,6 +63,16 @@ const PORTALS = [
|
|
|
63
63
|
url: 'https://admin.geospm.com',
|
|
64
64
|
platform: 'prodige',
|
|
65
65
|
},
|
|
66
|
+
{
|
|
67
|
+
name: 'SNCF',
|
|
68
|
+
url: 'https://ressources.data.sncf.com',
|
|
69
|
+
platform: 'opendatasoft',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'Réseau STAR Rennes',
|
|
73
|
+
url: 'https://data.explore.star.fr',
|
|
74
|
+
platform: 'opendatasoft',
|
|
75
|
+
},
|
|
66
76
|
{
|
|
67
77
|
name: 'Toulouse Métropole',
|
|
68
78
|
url: 'https://data.toulouse-metropole.fr',
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { DomUtil } from '../../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
1
|
import { uMapAlert as Alert } from '../../components/alerts/alert.js'
|
|
3
2
|
import { BaseAjax, SingleMixin } from '../autocomplete.js'
|
|
4
3
|
import { translate } from '../i18n.js'
|
|
4
|
+
import * as DOMUtils from '../domutils.js'
|
|
5
5
|
|
|
6
6
|
const TEMPLATE = `
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
<div>
|
|
8
|
+
<h3>Overpass</h3>
|
|
9
|
+
<label>
|
|
10
|
+
<span data-help="overpassImporter">${translate('Expression')}</span>
|
|
11
|
+
<input type="text" placeholder="amenity=drinking_water" name="tags" data-ref="tags" />
|
|
12
|
+
</label>
|
|
13
|
+
<label>
|
|
14
|
+
${translate('Geometry mode')}
|
|
15
|
+
<select name="out">
|
|
16
|
+
<option value="geom" selected>${translate('Default')}</option>
|
|
17
|
+
<option value="center">${translate('Only geometry centers')}</option>
|
|
18
|
+
</select>
|
|
19
|
+
</label>
|
|
20
|
+
<label data-ref="area" id="area"><span>${translate('Search area')}</span></label>
|
|
21
|
+
</div>
|
|
20
22
|
`
|
|
21
23
|
|
|
22
24
|
class Autocomplete extends SingleMixin(BaseAjax) {
|
|
@@ -57,12 +59,11 @@ export class Importer {
|
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
async open(importer) {
|
|
60
|
-
const container =
|
|
61
|
-
container.innerHTML = TEMPLATE
|
|
62
|
+
const [container, { area, tags }] = DOMUtils.loadTemplateWithRefs(TEMPLATE)
|
|
62
63
|
if (this.expression) {
|
|
63
|
-
|
|
64
|
+
tags.value = this.expression
|
|
64
65
|
}
|
|
65
|
-
this.autocomplete = new Autocomplete(
|
|
66
|
+
this.autocomplete = new Autocomplete(area, {
|
|
66
67
|
url: this.searchUrl,
|
|
67
68
|
placeholder: translate(
|
|
68
69
|
'Type area name, or let empty to load data in current map view'
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DomUtil } from '../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
1
|
import { uMapAlert as Alert } from '../components/alerts/alert.js'
|
|
3
2
|
import { MutatingForm } from './form/builder.js'
|
|
4
3
|
import { translate } from './i18n.js'
|
|
@@ -177,8 +176,11 @@ export class MapPermissions {
|
|
|
177
176
|
Alert.info(translate('Please save the map first'))
|
|
178
177
|
return
|
|
179
178
|
}
|
|
180
|
-
const container =
|
|
181
|
-
|
|
179
|
+
const container = DOMUtils.loadTemplate(`
|
|
180
|
+
<div class="umap-edit-permissions">
|
|
181
|
+
<h3><i class="icon icon-16 icon-key"></i> ${translate('Update permissions')}</h3>
|
|
182
|
+
</div>
|
|
183
|
+
`)
|
|
182
184
|
if (this.isAnonymousMap()) this._editAnonymous(container)
|
|
183
185
|
else this._editWithOwner(container)
|
|
184
186
|
this._editDatalayers(container)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Control } from '../../../vendors/leaflet/leaflet-src.esm.js'
|
|
1
|
+
import { Control, LayerGroup } from '../../../vendors/leaflet/leaflet-src.esm.js'
|
|
2
2
|
import * as Utils from '../utils.js'
|
|
3
3
|
import { translate } from '../i18n.js'
|
|
4
4
|
|
|
@@ -221,7 +221,7 @@ export const SearchControl = BaseButton.extend({
|
|
|
221
221
|
},
|
|
222
222
|
|
|
223
223
|
afterAdd(container, map) {
|
|
224
|
-
this.layer =
|
|
224
|
+
this.layer = new LayerGroup().addTo(map)
|
|
225
225
|
this.photonOptions = {
|
|
226
226
|
limit: 10,
|
|
227
227
|
noResultLabel: translate('No results'),
|
|
@@ -237,14 +237,7 @@ const Ball = DefaultIcon.extend({
|
|
|
237
237
|
_setIconStyles: function (img, name) {
|
|
238
238
|
BaseIcon.prototype._setIconStyles.call(this, img, name)
|
|
239
239
|
const color = this._getColor('color')
|
|
240
|
-
|
|
241
|
-
if (L.Browser.ielt9) {
|
|
242
|
-
background = color
|
|
243
|
-
} else if (L.Browser.webkit) {
|
|
244
|
-
background = `-webkit-gradient( radial, 6 38%, 0, 6 38%, 8, from(white), to(${color}) )`
|
|
245
|
-
} else {
|
|
246
|
-
background = `radial-gradient(circle at 6px 38% , white -4px, ${color} 8px) repeat scroll 0 0 transparent`
|
|
247
|
-
}
|
|
240
|
+
const background = `radial-gradient(circle at 6px 38% , white -4px, ${color} 8px) repeat scroll 0 0 transparent`
|
|
248
241
|
this.elements.ball.style.background = background
|
|
249
242
|
this.elements.ball.style.opacity = this._getOpacity()
|
|
250
243
|
},
|
|
@@ -309,5 +302,8 @@ export function setContrast(icon, parent, src, bgcolor) {
|
|
|
309
302
|
}
|
|
310
303
|
|
|
311
304
|
export function formatUrl(url, feature) {
|
|
312
|
-
|
|
305
|
+
if (Utils.hasVar(url)) {
|
|
306
|
+
return Utils.greedyTemplate(url || '', feature ? feature.extendedProperties() : {})
|
|
307
|
+
}
|
|
308
|
+
return url
|
|
313
309
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import colorbrewer from '../../../../vendors/colorbrewer/colorbrewer.js'
|
|
2
|
-
import {
|
|
2
|
+
import { FeatureGroup } from '../../../../vendors/leaflet/leaflet-src.esm.js'
|
|
3
3
|
import { translate } from '../../i18n.js'
|
|
4
4
|
import * as Utils from '../../utils.js'
|
|
5
5
|
import * as DOMUtils from '../../domutils.js'
|
|
@@ -346,7 +346,8 @@ export const Circles = FeatureGroup.extend({
|
|
|
346
346
|
},
|
|
347
347
|
|
|
348
348
|
renderLegend: function (container) {
|
|
349
|
-
const parent =
|
|
349
|
+
const parent = DOMUtils.loadTemplate('<ul class="circles-layer-legend"></ul>')
|
|
350
|
+
container.appendChild(parent)
|
|
350
351
|
const color = this.datalayer.getProperty('color')
|
|
351
352
|
const values = this.getValues()
|
|
352
353
|
if (!values.length) return
|
|
@@ -360,14 +361,18 @@ export const Circles = FeatureGroup.extend({
|
|
|
360
361
|
[this.options.maxPX, maxValue],
|
|
361
362
|
]
|
|
362
363
|
for (const [size, label] of items) {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
364
|
+
parent.appendChild(
|
|
365
|
+
DOMUtils.loadTemplate(`
|
|
366
|
+
<li>
|
|
367
|
+
<span class="circle"
|
|
368
|
+
style="background-color: ${color};
|
|
369
|
+
height: ${size * 2}px;
|
|
370
|
+
width: ${size * 2}px;
|
|
371
|
+
opacity: ${this.datalayer.getProperty('fillOpacity')};"></span>
|
|
372
|
+
<span class="label">${label}</span>
|
|
373
|
+
</li>
|
|
374
|
+
`)
|
|
375
|
+
)
|
|
371
376
|
}
|
|
372
377
|
},
|
|
373
378
|
})
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
// Goes here all code related to Leaflet, DOM and user interactions.
|
|
2
2
|
import {
|
|
3
3
|
Map as BaseMap,
|
|
4
|
+
Browser,
|
|
4
5
|
Control,
|
|
5
6
|
DomEvent,
|
|
6
|
-
DomUtil,
|
|
7
7
|
latLng,
|
|
8
|
-
|
|
8
|
+
LatLng,
|
|
9
|
+
LatLngBounds,
|
|
9
10
|
setOptions,
|
|
11
|
+
TileLayer,
|
|
10
12
|
} from '../../../vendors/leaflet/leaflet-src.esm.js'
|
|
11
13
|
import { uMapAlert as Alert } from '../../components/alerts/alert.js'
|
|
12
14
|
import DropControl from '../drop.js'
|
|
@@ -46,7 +48,6 @@ const ControlsMixin = {
|
|
|
46
48
|
'caption',
|
|
47
49
|
'locate',
|
|
48
50
|
'measure',
|
|
49
|
-
'editinosm',
|
|
50
51
|
'print',
|
|
51
52
|
'tilelayers',
|
|
52
53
|
],
|
|
@@ -91,17 +92,9 @@ const ControlsMixin = {
|
|
|
91
92
|
this._controls.embed = new EmbedControl(this._umap)
|
|
92
93
|
this._controls.print = new PrintControl(this._umap)
|
|
93
94
|
this._controls.tilelayersChooser = new TileLayerChooser(this._umap)
|
|
94
|
-
this._controls.editinosm = new Control.EditInOSM({
|
|
95
|
-
position: 'topleft',
|
|
96
|
-
widgetOptions: {
|
|
97
|
-
helpText: translate(
|
|
98
|
-
'Open this map extent in a map editor to provide more accurate data to OpenStreetMap'
|
|
99
|
-
),
|
|
100
|
-
},
|
|
101
|
-
})
|
|
102
95
|
this._controls.measure = new L.MeasureControl().initHandler(this)
|
|
103
96
|
this._controls.more = new MoreControl()
|
|
104
|
-
this._controls.scale =
|
|
97
|
+
this._controls.scale = new Control.Scale()
|
|
105
98
|
this._controls.permanentCredit = new PermanentCreditsControl(this)
|
|
106
99
|
this._umap.drop = new DropControl(this._umap, this, this._container)
|
|
107
100
|
this._controls.tilelayers = new U.TileLayerControl(this)
|
|
@@ -138,11 +131,10 @@ const ControlsMixin = {
|
|
|
138
131
|
const control = this._controls[name]
|
|
139
132
|
if (!control) continue
|
|
140
133
|
control.addTo(this)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
134
|
+
control._container.classList.toggle(
|
|
135
|
+
'display-on-more',
|
|
136
|
+
status === undefined || status === null
|
|
137
|
+
)
|
|
146
138
|
}
|
|
147
139
|
if (this._umap.getProperty('permanentCredit'))
|
|
148
140
|
this._controls.permanentCredit.addTo(this)
|
|
@@ -176,7 +168,7 @@ const ManageTilelayerMixin = {
|
|
|
176
168
|
if (this._controls) this._controls.tilelayers.setLayers()
|
|
177
169
|
},
|
|
178
170
|
|
|
179
|
-
createTileLayer: (tilelayer) => new
|
|
171
|
+
createTileLayer: (tilelayer) => new TileLayer(tilelayer.url_template, tilelayer),
|
|
180
172
|
|
|
181
173
|
selectTileLayer: function (tilelayer) {
|
|
182
174
|
if (tilelayer === this.selectedTilelayer) {
|
|
@@ -303,7 +295,7 @@ export const LeafletMap = BaseMap.extend({
|
|
|
303
295
|
// when scrolling the main page and touching the
|
|
304
296
|
// map in an iframe. May be a bit dumb, but let's
|
|
305
297
|
// try like this for now.
|
|
306
|
-
if (
|
|
298
|
+
if (Browser.mobile) this.dragging.disable()
|
|
307
299
|
}
|
|
308
300
|
// Needs tilelayer to exist for minimap
|
|
309
301
|
this.renderControls()
|
|
@@ -312,7 +304,7 @@ export const LeafletMap = BaseMap.extend({
|
|
|
312
304
|
|
|
313
305
|
latLng: (a, b, c) => {
|
|
314
306
|
// manage geojson case and call original method
|
|
315
|
-
if (!(a instanceof
|
|
307
|
+
if (!(a instanceof LatLng) && a.coordinates) {
|
|
316
308
|
// Guess it's a geojson
|
|
317
309
|
a = [a.coordinates[1], a.coordinates[0]]
|
|
318
310
|
}
|
|
@@ -361,7 +353,7 @@ export const LeafletMap = BaseMap.extend({
|
|
|
361
353
|
!Number.isNaN(north) &&
|
|
362
354
|
!Number.isNaN(east)
|
|
363
355
|
) {
|
|
364
|
-
const bounds =
|
|
356
|
+
const bounds = new LatLngBounds([
|
|
365
357
|
[south, west],
|
|
366
358
|
[north, east],
|
|
367
359
|
])
|
|
@@ -381,7 +373,7 @@ export const LeafletMap = BaseMap.extend({
|
|
|
381
373
|
setMaxBounds: function (bounds) {
|
|
382
374
|
// Hack. Remove me when fix is released:
|
|
383
375
|
// https://github.com/Leaflet/Leaflet/pull/4494
|
|
384
|
-
bounds =
|
|
376
|
+
bounds = new LatLngBounds(bounds)
|
|
385
377
|
|
|
386
378
|
if (!bounds.isValid()) {
|
|
387
379
|
this.options.maxBounds = null
|
|
@@ -390,6 +382,14 @@ export const LeafletMap = BaseMap.extend({
|
|
|
390
382
|
return BaseMap.prototype.setMaxBounds.call(this, bounds)
|
|
391
383
|
},
|
|
392
384
|
|
|
385
|
+
getLayersBounds: (layers) => {
|
|
386
|
+
const bounds = new LatLngBounds()
|
|
387
|
+
for (const layer of layers) {
|
|
388
|
+
bounds.extend(layer.getBounds())
|
|
389
|
+
}
|
|
390
|
+
return bounds
|
|
391
|
+
},
|
|
392
|
+
|
|
393
393
|
initEditTools: function () {
|
|
394
394
|
this.editTools = new U.Editable(this._umap)
|
|
395
395
|
},
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Popup as BasePopup,
|
|
3
3
|
DomEvent,
|
|
4
|
-
DomUtil,
|
|
5
4
|
Path,
|
|
6
5
|
} from '../../../vendors/leaflet/leaflet-src.esm.js'
|
|
7
6
|
import Browser from '../browser.js'
|
|
8
7
|
import loadTemplate from './template.js'
|
|
8
|
+
import * as DOMUtils from '../domutils.js'
|
|
9
9
|
|
|
10
10
|
export default function loadPopup(name) {
|
|
11
11
|
switch (name) {
|
|
@@ -25,7 +25,8 @@ const Popup = BasePopup.extend({
|
|
|
25
25
|
},
|
|
26
26
|
|
|
27
27
|
loadContent: async function () {
|
|
28
|
-
const container =
|
|
28
|
+
const container = document.createElement('div')
|
|
29
|
+
container.classList.add('umap-popup')
|
|
29
30
|
const name = this.feature.getOption('popupTemplate')
|
|
30
31
|
this.content = await loadTemplate(name, this.feature, container)
|
|
31
32
|
const elements = container.querySelectorAll('img,iframe')
|
|
@@ -34,7 +35,9 @@ const Popup = BasePopup.extend({
|
|
|
34
35
|
}
|
|
35
36
|
if (!elements.length && container.textContent.replace('\n', '') === '') {
|
|
36
37
|
container.innerHTML = ''
|
|
37
|
-
|
|
38
|
+
container.appendChild(
|
|
39
|
+
DOMUtils.loadTemplate(`<h3>${this.feature.getDisplayName()}</h3>`)
|
|
40
|
+
)
|
|
38
41
|
}
|
|
39
42
|
this.setContent(container)
|
|
40
43
|
},
|