umap-project 3.4.0b1__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/context_processors.py +1 -1
- umap/locale/da/LC_MESSAGES/django.mo +0 -0
- umap/locale/da/LC_MESSAGES/django.po +20 -16
- umap/locale/en/LC_MESSAGES/django.po +18 -14
- 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/migrations/0018_datalayer_uuid.py +1 -1
- umap/models.py +7 -3
- umap/settings/local.py.sample +1 -1
- umap/static/umap/content.css +0 -3
- umap/static/umap/css/bar.css +9 -6
- umap/static/umap/css/form.css +27 -11
- umap/static/umap/css/popup.css +1 -0
- umap/static/umap/js/components/base.js +1 -1
- 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 +8 -8
- umap/static/umap/js/modules/data/features.js +33 -36
- umap/static/umap/js/modules/data/fields.js +446 -0
- umap/static/umap/js/modules/data/layer.js +76 -93
- umap/static/umap/js/modules/domutils.js +24 -4
- umap/static/umap/js/modules/filters.js +20 -47
- 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 +13 -14
- umap/static/umap/js/modules/i18n.js +1 -1
- umap/static/umap/js/modules/importer.js +18 -27
- 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 -265
- umap/static/umap/js/modules/permissions.js +5 -3
- umap/static/umap/js/modules/rendering/controls.js +6 -4
- 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 +16 -11
- umap/static/umap/js/modules/rendering/layers/heat.js +27 -21
- 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 +31 -37
- 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/dialog.js +10 -1
- umap/static/umap/js/modules/ui/panel.js +28 -23
- umap/static/umap/js/modules/ui/tooltip.js +1 -1
- umap/static/umap/js/modules/umap.js +84 -84
- umap/static/umap/js/modules/utils.js +13 -4
- umap/static/umap/js/umap.controls.js +33 -14
- umap/static/umap/locale/am_ET.js +19 -8
- umap/static/umap/locale/am_ET.json +19 -8
- umap/static/umap/locale/ar.js +19 -8
- umap/static/umap/locale/ar.json +19 -8
- umap/static/umap/locale/ast.js +19 -8
- umap/static/umap/locale/ast.json +19 -8
- umap/static/umap/locale/bg.js +19 -8
- umap/static/umap/locale/bg.json +19 -8
- umap/static/umap/locale/br.js +20 -9
- umap/static/umap/locale/br.json +20 -9
- umap/static/umap/locale/ca.js +19 -8
- umap/static/umap/locale/ca.json +19 -8
- umap/static/umap/locale/cs_CZ.js +20 -9
- umap/static/umap/locale/cs_CZ.json +20 -9
- umap/static/umap/locale/da.js +54 -43
- umap/static/umap/locale/da.json +54 -43
- umap/static/umap/locale/de.js +44 -33
- umap/static/umap/locale/de.json +44 -33
- umap/static/umap/locale/el.js +20 -9
- umap/static/umap/locale/el.json +20 -9
- umap/static/umap/locale/en.js +20 -9
- umap/static/umap/locale/en.json +20 -9
- umap/static/umap/locale/en_US.json +19 -8
- umap/static/umap/locale/es.js +55 -44
- umap/static/umap/locale/es.json +55 -44
- umap/static/umap/locale/et.js +20 -9
- umap/static/umap/locale/et.json +20 -9
- umap/static/umap/locale/eu.js +25 -14
- umap/static/umap/locale/eu.json +25 -14
- umap/static/umap/locale/fa_IR.js +20 -9
- umap/static/umap/locale/fa_IR.json +20 -9
- umap/static/umap/locale/fi.js +19 -8
- umap/static/umap/locale/fi.json +19 -8
- umap/static/umap/locale/fr.js +21 -10
- umap/static/umap/locale/fr.json +21 -10
- umap/static/umap/locale/gl.js +147 -136
- umap/static/umap/locale/gl.json +147 -136
- umap/static/umap/locale/he.js +19 -8
- umap/static/umap/locale/he.json +19 -8
- umap/static/umap/locale/hr.js +19 -8
- umap/static/umap/locale/hr.json +19 -8
- umap/static/umap/locale/hu.js +62 -51
- umap/static/umap/locale/hu.json +62 -51
- umap/static/umap/locale/id.js +19 -8
- umap/static/umap/locale/id.json +19 -8
- umap/static/umap/locale/is.js +20 -9
- umap/static/umap/locale/is.json +20 -9
- umap/static/umap/locale/it.js +20 -9
- umap/static/umap/locale/it.json +20 -9
- umap/static/umap/locale/ja.js +19 -8
- umap/static/umap/locale/ja.json +19 -8
- umap/static/umap/locale/ko.js +19 -8
- umap/static/umap/locale/ko.json +19 -8
- umap/static/umap/locale/lt.js +19 -8
- umap/static/umap/locale/lt.json +19 -8
- umap/static/umap/locale/ms.js +20 -9
- umap/static/umap/locale/ms.json +20 -9
- umap/static/umap/locale/nl.js +20 -9
- umap/static/umap/locale/nl.json +20 -9
- umap/static/umap/locale/no.js +19 -8
- umap/static/umap/locale/no.json +19 -8
- umap/static/umap/locale/pl.js +56 -45
- umap/static/umap/locale/pl.json +56 -45
- umap/static/umap/locale/pl_PL.json +19 -8
- umap/static/umap/locale/pt.js +20 -9
- umap/static/umap/locale/pt.json +20 -9
- umap/static/umap/locale/pt_BR.js +19 -8
- umap/static/umap/locale/pt_BR.json +19 -8
- umap/static/umap/locale/pt_PT.js +19 -8
- umap/static/umap/locale/pt_PT.json +19 -8
- umap/static/umap/locale/ro.js +19 -8
- umap/static/umap/locale/ro.json +19 -8
- umap/static/umap/locale/ru.js +19 -8
- umap/static/umap/locale/ru.json +19 -8
- umap/static/umap/locale/si.js +1 -1
- umap/static/umap/locale/si.json +1 -1
- umap/static/umap/locale/sk_SK.js +19 -8
- umap/static/umap/locale/sk_SK.json +19 -8
- umap/static/umap/locale/sl.js +19 -8
- umap/static/umap/locale/sl.json +19 -8
- umap/static/umap/locale/sr.js +19 -8
- umap/static/umap/locale/sr.json +19 -8
- umap/static/umap/locale/sv.js +19 -8
- umap/static/umap/locale/sv.json +19 -8
- umap/static/umap/locale/th_TH.js +19 -8
- umap/static/umap/locale/th_TH.json +19 -8
- umap/static/umap/locale/tr.js +19 -8
- umap/static/umap/locale/tr.json +19 -8
- umap/static/umap/locale/uk_UA.js +19 -8
- umap/static/umap/locale/uk_UA.json +19 -8
- umap/static/umap/locale/vi.js +19 -8
- umap/static/umap/locale/vi.json +19 -8
- umap/static/umap/locale/vi_VN.json +19 -8
- umap/static/umap/locale/zh.js +19 -8
- umap/static/umap/locale/zh.json +19 -8
- umap/static/umap/locale/zh_CN.json +19 -8
- umap/static/umap/locale/zh_TW.Big5.json +19 -8
- umap/static/umap/locale/zh_TW.js +53 -42
- umap/static/umap/locale/zh_TW.json +53 -42
- umap/static/umap/map.css +8 -7
- 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/templates/umap/login_popup_end.html +2 -2
- umap/tests/integration/conftest.py +11 -2
- umap/tests/integration/test_anonymous_owned_map.py +2 -2
- umap/tests/integration/test_conditional_rules.py +107 -52
- 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_filters.py +6 -7
- 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_map_preview.py +1 -1
- umap/tests/integration/test_owned_map.py +2 -2
- umap/tests/integration/test_picto.py +1 -1
- umap/tests/integration/test_popup.py +31 -0
- umap/tests/integration/test_remote_data.py +4 -4
- umap/tests/integration/test_save.py +1 -1
- 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 +69 -20
- umap/tests/test_dashboard.py +1 -1
- umap/tests/test_statics.py +2 -2
- umap/tests/test_utils.py +4 -1
- umap/tests/test_views.py +1 -1
- umap/utils.py +3 -2
- {umap_project-3.4.0b1.dist-info → umap_project-3.4.2.dist-info}/METADATA +17 -17
- {umap_project-3.4.0b1.dist-info → umap_project-3.4.2.dist-info}/RECORD +198 -199
- 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.0b1.dist-info → umap_project-3.4.2.dist-info}/WHEEL +0 -0
- {umap_project-3.4.0b1.dist-info → umap_project-3.4.2.dist-info}/entry_points.txt +0 -0
- {umap_project-3.4.0b1.dist-info → umap_project-3.4.2.dist-info}/licenses/LICENSE +0 -0
umap/static/umap/js/umap.core.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
L.DomUtil.add = (tagName, className, container, content) => {
|
|
2
|
-
const el = L.DomUtil.create(tagName, className, container)
|
|
3
|
-
if (content) {
|
|
4
|
-
if (content.nodeType && content.nodeType === 1) {
|
|
5
|
-
el.appendChild(content)
|
|
6
|
-
} else {
|
|
7
|
-
el.textContent = content
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return el
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
L.DomUtil.createFieldset = (container, legend, options) => {
|
|
14
|
-
options = options || {}
|
|
15
|
-
const details = L.DomUtil.create('details', options.className || '', container)
|
|
16
|
-
const summary = L.DomUtil.add('summary', '', details)
|
|
17
|
-
if (options.icon) L.DomUtil.createIcon(summary, options.icon)
|
|
18
|
-
L.DomUtil.add('h4', '', summary, legend)
|
|
19
|
-
const fieldset = L.DomUtil.add('fieldset', '', details)
|
|
20
|
-
details.open = options.on === true
|
|
21
|
-
if (options.callback) {
|
|
22
|
-
L.DomEvent.on(details, 'toggle', () => {
|
|
23
|
-
if (details.open) options.callback.call(options.context || this)
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
return fieldset
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
L.DomUtil.createButton = (className, container, content, callback, context) => {
|
|
30
|
-
const el = L.DomUtil.add('button', className, container, content)
|
|
31
|
-
el.type = 'button'
|
|
32
|
-
if (!content.nodeType) {
|
|
33
|
-
el.title = content
|
|
34
|
-
}
|
|
35
|
-
if (callback) {
|
|
36
|
-
L.DomEvent.on(el, 'click', L.DomEvent.stop).on(el, 'click', callback, context)
|
|
37
|
-
}
|
|
38
|
-
return el
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
L.DomUtil.createIcon = (parent, className, title, size = 16) => {
|
|
42
|
-
return L.DomUtil.element({
|
|
43
|
-
tagName: 'i',
|
|
44
|
-
parent: parent,
|
|
45
|
-
className: `icon icon-${size} ${className}`,
|
|
46
|
-
title: title || '',
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
L.DomUtil.createButtonIcon = (parent, className, title, callback, size = 16) => {
|
|
51
|
-
const el = L.DomUtil.element({
|
|
52
|
-
tagName: 'button',
|
|
53
|
-
parent: parent,
|
|
54
|
-
className: `icon icon-${size} ${className}`,
|
|
55
|
-
title: title || '',
|
|
56
|
-
})
|
|
57
|
-
if (callback) {
|
|
58
|
-
L.DomEvent.on(el, 'click', L.DomEvent.stop).on(el, 'click', callback)
|
|
59
|
-
}
|
|
60
|
-
return el
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
L.DomUtil.createTitle = (parent, text, iconClassName, className = '', tag = 'h3') => {
|
|
64
|
-
const title = L.DomUtil.create(tag, '', parent)
|
|
65
|
-
if (iconClassName) L.DomUtil.createIcon(title, iconClassName)
|
|
66
|
-
L.DomUtil.add('span', className, title, text)
|
|
67
|
-
return title
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
L.DomUtil.element = ({ tagName, parent, ...attrs }) => {
|
|
71
|
-
const el = document.createElement(tagName)
|
|
72
|
-
if (attrs.innerHTML) {
|
|
73
|
-
attrs.innerHTML = U.Utils.escapeHTML(attrs.innerHTML)
|
|
74
|
-
} else if (attrs.safeHTML) {
|
|
75
|
-
attrs.innerHTML = attrs.safeHTML
|
|
76
|
-
}
|
|
77
|
-
for (const attr in attrs) {
|
|
78
|
-
el[attr] = attrs[attr]
|
|
79
|
-
}
|
|
80
|
-
if (typeof parent !== 'undefined') {
|
|
81
|
-
parent.appendChild(el)
|
|
82
|
-
}
|
|
83
|
-
return el
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
L.LatLng.prototype.isValid = function () {
|
|
87
|
-
return (
|
|
88
|
-
Number.isFinite(this.lat) &&
|
|
89
|
-
Math.abs(this.lat) <= 90 &&
|
|
90
|
-
Number.isFinite(this.lng) &&
|
|
91
|
-
Math.abs(this.lng) <= 180
|
|
92
|
-
)
|
|
93
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
.leaflet-control-edit-in-osm-simple,
|
|
2
|
-
.leaflet-control-edit-in-osm {
|
|
3
|
-
background: none repeat scroll 0 0 #F8F8F9;
|
|
4
|
-
border: 1px solid #888888;
|
|
5
|
-
border-radius: 5px 5px 5px 5px;
|
|
6
|
-
box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
|
|
7
|
-
}
|
|
8
|
-
.leaflet-control-edit-in-osm .leaflet-control-edit-in-osm-toggle {
|
|
9
|
-
background-position: 50% 50%;
|
|
10
|
-
background-repeat: no-repeat;
|
|
11
|
-
height: 36px;
|
|
12
|
-
width: 36px;
|
|
13
|
-
display: block;
|
|
14
|
-
}
|
|
15
|
-
.leaflet-control-edit-in-osm .leaflet-control-edit-in-osm-toggle {
|
|
16
|
-
background-image: url("./edit-in-osm.png");
|
|
17
|
-
}
|
|
18
|
-
.leaflet-control-edit-in-osm .osm-editor + .osm-editor {
|
|
19
|
-
border-left: 1px solid black;
|
|
20
|
-
}
|
|
21
|
-
.leaflet-control-edit-in-osm-simple a.osm-editor,
|
|
22
|
-
.leaflet-control-edit-in-osm a.osm-editor {
|
|
23
|
-
display: none;
|
|
24
|
-
height: 36px;
|
|
25
|
-
min-width: 36px;
|
|
26
|
-
text-align: center;
|
|
27
|
-
line-height: 36px;
|
|
28
|
-
color: #333;
|
|
29
|
-
padding: 0 5px;
|
|
30
|
-
text-decoration: none;
|
|
31
|
-
font-family: sans-serif;
|
|
32
|
-
}
|
|
33
|
-
.leaflet-control-edit-in-osm-simple a.osm-editor,
|
|
34
|
-
.leaflet-control-edit-in-osm:hover a.osm-editor {
|
|
35
|
-
display: inline-block;
|
|
36
|
-
}
|
|
37
|
-
a.osm-editor:hover {
|
|
38
|
-
box-shadow: 0 0 2px 0 black inset;
|
|
39
|
-
}
|
|
40
|
-
.leaflet-control-edit-in-osm:hover .leaflet-control-edit-in-osm-toggle {
|
|
41
|
-
display: none;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.leaflet-control-edit-hidden {
|
|
45
|
-
display: none;
|
|
46
|
-
}
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
(function (factory) {
|
|
2
|
-
var L;
|
|
3
|
-
if (typeof define === 'function' && define.amd) {
|
|
4
|
-
// AMD
|
|
5
|
-
define(['leaflet'], function(L) {
|
|
6
|
-
factory(L, setTimeout);
|
|
7
|
-
});
|
|
8
|
-
} else if (typeof module !== 'undefined') {
|
|
9
|
-
// Node/CommonJS
|
|
10
|
-
L = require('leaflet');
|
|
11
|
-
module.exports = factory(L, setTimeout);
|
|
12
|
-
} else {
|
|
13
|
-
// Browser globals
|
|
14
|
-
if (typeof window.L === 'undefined')
|
|
15
|
-
throw 'Leaflet must be loaded first';
|
|
16
|
-
factory(window.L, setTimeout);
|
|
17
|
-
}
|
|
18
|
-
}(function (L, setTimeout) {
|
|
19
|
-
var _controlContainer,
|
|
20
|
-
_map,
|
|
21
|
-
_zoomThreshold,
|
|
22
|
-
_hideClass = 'leaflet-control-edit-hidden',
|
|
23
|
-
_anchorClass = 'leaflet-control-edit-in-osm-toggle',
|
|
24
|
-
|
|
25
|
-
_Widgets = {
|
|
26
|
-
SimpleButton: function (config) {
|
|
27
|
-
var className = (config && config.className) || 'leaflet-control-edit-in-osm-simple',
|
|
28
|
-
helpText = config && config.helpText,
|
|
29
|
-
addEditors = (config && config.addEditors) || function (container, editors) {
|
|
30
|
-
addEditorToWidget(container, editors[0], helpText);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
className: className,
|
|
35
|
-
helpText: helpText,
|
|
36
|
-
addEditors: addEditors
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
|
-
MultiButton: function (config) {
|
|
40
|
-
var className = 'leaflet-control-edit-in-osm',
|
|
41
|
-
helpText = "Open this map extent in a map editor to provide more accurate data to OpenStreetMap",
|
|
42
|
-
addEditors = function (container, editors) {
|
|
43
|
-
for (var i in editors) {
|
|
44
|
-
addEditorToWidget(container, editors[i]);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
className: (config && config.className) || className,
|
|
50
|
-
helpText: (config && config.helpText) || helpText,
|
|
51
|
-
addEditors: (config && config.addEditors) || addEditors
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
AttributionBox: function (config) {
|
|
55
|
-
var className = 'leaflet-control-attribution',
|
|
56
|
-
helpText = "Edit in OSM",
|
|
57
|
-
addEditors = function (container, editors) {
|
|
58
|
-
addEditorToWidget(container, editors[0], helpText);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
className: (config && config.className) || className,
|
|
63
|
-
helpText: (config && config.helpText) || helpText,
|
|
64
|
-
addEditors: (config && config.addEditors) || addEditors
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
_Editors = {
|
|
70
|
-
Id: function (config) {
|
|
71
|
-
var url = 'https://www.openstreetmap.org/edit?editor=id#map=',
|
|
72
|
-
displayName = "iD",
|
|
73
|
-
buildUrl = function (map) {
|
|
74
|
-
return this.url + [
|
|
75
|
-
map.getZoom(),
|
|
76
|
-
map.getCenter().wrap().lat,
|
|
77
|
-
map.getCenter().wrap().lng
|
|
78
|
-
].join('/');
|
|
79
|
-
};
|
|
80
|
-
return {
|
|
81
|
-
url: (config && config.url) || url,
|
|
82
|
-
displayName: (config && config.displayName) || displayName,
|
|
83
|
-
buildUrl: (config && config.buildUrl) || buildUrl
|
|
84
|
-
};
|
|
85
|
-
},
|
|
86
|
-
Josm: function (config) {
|
|
87
|
-
var url = 'http://127.0.0.1:8111/load_and_zoom',
|
|
88
|
-
timeout = 1000,
|
|
89
|
-
displayName = "JOSM",
|
|
90
|
-
buildUrl = function (map) {
|
|
91
|
-
var bounds = map.getBounds();
|
|
92
|
-
return this.url + L.Util.getParamString({
|
|
93
|
-
left: bounds.getNorthWest().lng,
|
|
94
|
-
right: bounds.getSouthEast().lng,
|
|
95
|
-
top: bounds.getNorthWest().lat,
|
|
96
|
-
bottom: bounds.getSouthEast().lat
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
return {
|
|
101
|
-
url: (config && config.url) || url,
|
|
102
|
-
timeout: (config && config.timeout) || timeout,
|
|
103
|
-
displayName: (config && config.displayName) || displayName,
|
|
104
|
-
buildUrl: (config && config.buildUrl) || buildUrl
|
|
105
|
-
};
|
|
106
|
-
},
|
|
107
|
-
Potlatch: function (config) {
|
|
108
|
-
var url = 'http://open.mapquestapi.com/dataedit/index_flash.html',
|
|
109
|
-
displayName = "P2",
|
|
110
|
-
buildUrl = function (map) {
|
|
111
|
-
return this.url + L.Util.getParamString({
|
|
112
|
-
lon: map.getCenter().wrap().lng,
|
|
113
|
-
lat: map.getCenter().wrap().lat,
|
|
114
|
-
zoom: map.getZoom()
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
return {
|
|
118
|
-
url: (config && config.url) || url,
|
|
119
|
-
displayName: (config && config.displayName) || displayName,
|
|
120
|
-
buildUrl: (config && config.buildUrl) || buildUrl
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
// Takes an editor, calls their buildUrl method
|
|
127
|
-
// and opens the url in the browser
|
|
128
|
-
function openRemote (editor) {
|
|
129
|
-
var url = editor.buildUrl(_map),
|
|
130
|
-
w = window.open(url);
|
|
131
|
-
if (editor.timeout) {
|
|
132
|
-
setTimeout(function() {w.close();}, editor.timeout);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function addEditorToWidget(widgetContainer, editor, text) {
|
|
137
|
-
var editorWidget = L.DomUtil.create('a', "osm-editor", widgetContainer);
|
|
138
|
-
editorWidget.href = "#";
|
|
139
|
-
editorWidget.innerHTML = text || editor.displayName;
|
|
140
|
-
L.DomEvent.on(editorWidget, "click", function (e) {
|
|
141
|
-
openRemote(editor);
|
|
142
|
-
L.DomEvent.stop(e);
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Make the EditInOSM widget visible or invisible after each
|
|
147
|
-
// zoom event.
|
|
148
|
-
//
|
|
149
|
-
// configurable by setting the *zoomThreshold* option.
|
|
150
|
-
function showOrHideUI() {
|
|
151
|
-
var zoom = _map.getZoom();
|
|
152
|
-
if (zoom < _zoomThreshold) {
|
|
153
|
-
L.DomUtil.addClass(_controlContainer, _hideClass);
|
|
154
|
-
} else {
|
|
155
|
-
L.DomUtil.removeClass(_controlContainer, _hideClass);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
L.Control.EditInOSM = L.Control.extend({
|
|
160
|
-
|
|
161
|
-
options: {
|
|
162
|
-
position: "topright",
|
|
163
|
-
zoomThreshold: 0,
|
|
164
|
-
widget: "multiButton",
|
|
165
|
-
editors: ["id", "josm"]
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
initialize: function (options) {
|
|
169
|
-
var newEditors = [],
|
|
170
|
-
widget,
|
|
171
|
-
widgetSmallName,
|
|
172
|
-
editor,
|
|
173
|
-
editorSmallName;
|
|
174
|
-
|
|
175
|
-
L.setOptions(this, options);
|
|
176
|
-
|
|
177
|
-
_zoomThreshold = this.options.zoomThreshold;
|
|
178
|
-
|
|
179
|
-
widget = this.options.widget;
|
|
180
|
-
widgetSmallName = typeof(widget) === 'string' ? widget.toLowerCase() : '';
|
|
181
|
-
|
|
182
|
-
// setup widget from string or object
|
|
183
|
-
if (widgetSmallName === "simplebutton") {
|
|
184
|
-
this.options.widget = new _Widgets.SimpleButton(this.options.widgetOptions);
|
|
185
|
-
} else if (widgetSmallName === "multibutton") {
|
|
186
|
-
this.options.widget = new _Widgets.MultiButton(this.options.widgetOptions);
|
|
187
|
-
} else if (widgetSmallName === "attributionbox") {
|
|
188
|
-
this.options.widget = new _Widgets.AttributionBox(this.options.widgetOptions);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// setup editors from strings or objects
|
|
192
|
-
for (var i in this.options.editors) {
|
|
193
|
-
editor = this.options.editors[i],
|
|
194
|
-
editorSmallName = typeof(editor) === "string" ? editor.toLowerCase() : null;
|
|
195
|
-
|
|
196
|
-
if (editorSmallName === "id") {
|
|
197
|
-
newEditors.push(new _Editors.Id());
|
|
198
|
-
} else if (editorSmallName === "josm") {
|
|
199
|
-
newEditors.push(new _Editors.Josm());
|
|
200
|
-
} else if (editorSmallName === "potlatch") {
|
|
201
|
-
newEditors.push(new _Editors.Potlatch());
|
|
202
|
-
} else {
|
|
203
|
-
newEditors.push(editor);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
this.options.editors = newEditors;
|
|
207
|
-
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
onAdd: function (map) {
|
|
211
|
-
_map = map;
|
|
212
|
-
map.on('zoomend', showOrHideUI);
|
|
213
|
-
|
|
214
|
-
_controlContainer = L.DomUtil.create('div', this.options.widget.className);
|
|
215
|
-
|
|
216
|
-
_controlContainer.title = this.options.widget.helpText || '';
|
|
217
|
-
|
|
218
|
-
L.DomUtil.create('a', _anchorClass, _controlContainer);
|
|
219
|
-
|
|
220
|
-
this.options.widget.addEditors(_controlContainer, this.options.editors);
|
|
221
|
-
return _controlContainer;
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
onRemove: function (map) {
|
|
225
|
-
map.off('zoomend', showOrHideUI);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
L.Control.EditInOSM.Widgets = _Widgets;
|
|
231
|
-
L.Control.EditInOSM.Editors = _Editors;
|
|
232
|
-
|
|
233
|
-
L.Map.addInitHook(function () {
|
|
234
|
-
if (this.options.editInOSMControlOptions) {
|
|
235
|
-
var options = this.options.editInOSMControlOptions || {};
|
|
236
|
-
this.editInOSMControl = (new L.Control.EditInOSM(options)).addTo(this);
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
}));
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|