umap-project 1.14.0a4__py3-none-any.whl → 2.0.0a0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of umap-project might be problematic. Click here for more details.
- umap/__init__.py +1 -1
- umap/decorators.py +0 -14
- umap/locale/br/LC_MESSAGES/django.mo +0 -0
- umap/locale/br/LC_MESSAGES/django.po +137 -85
- umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
- umap/locale/cs_CZ/LC_MESSAGES/django.po +136 -84
- umap/locale/el/LC_MESSAGES/django.mo +0 -0
- umap/locale/el/LC_MESSAGES/django.po +136 -84
- umap/locale/en/LC_MESSAGES/django.po +128 -88
- umap/locale/es/LC_MESSAGES/django.mo +0 -0
- umap/locale/es/LC_MESSAGES/django.po +136 -84
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +131 -91
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/hu/LC_MESSAGES/django.po +137 -85
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.po +136 -84
- umap/locale/ms/LC_MESSAGES/django.mo +0 -0
- umap/locale/ms/LC_MESSAGES/django.po +136 -84
- umap/locale/pl/LC_MESSAGES/django.mo +0 -0
- umap/locale/pl/LC_MESSAGES/django.po +136 -84
- umap/locale/sv/LC_MESSAGES/django.mo +0 -0
- umap/locale/sv/LC_MESSAGES/django.po +135 -83
- umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
- umap/locale/zh_TW/LC_MESSAGES/django.po +143 -91
- umap/models.py +23 -1
- umap/settings/__init__.py +1 -4
- umap/settings/base.py +1 -0
- umap/static/umap/base.css +5 -0
- umap/static/umap/content.css +185 -13
- umap/static/umap/favicons/icon.svg +2 -2
- umap/static/umap/img/edit.svg +3 -3
- umap/static/umap/img/icon-delete.svg +4 -0
- umap/static/umap/img/icon-download.svg +13 -0
- umap/static/umap/img/icon-duplicate.svg +5 -0
- umap/static/umap/img/icon-edit.svg +12 -0
- umap/static/umap/img/icon-share.svg +11 -0
- umap/static/umap/img/icon-view.svg +12 -0
- umap/static/umap/img/logo.svg +2 -2
- umap/static/umap/img/logo_small.svg +2 -2
- umap/static/umap/img/marker.svg +4 -0
- umap/static/umap/img/opensource.svg +2 -2
- umap/static/umap/img/osm.svg +2 -2
- umap/static/umap/js/components/fragment.js +1 -1
- umap/static/umap/js/modules/browser.js +159 -0
- umap/static/umap/js/modules/global.js +3 -1
- umap/static/umap/js/modules/request.js +155 -0
- umap/static/umap/js/umap.autocomplete.js +28 -38
- umap/static/umap/js/umap.controls.js +73 -58
- umap/static/umap/js/umap.core.js +4 -9
- umap/static/umap/js/umap.datalayer.permissions.js +13 -12
- umap/static/umap/js/umap.features.js +51 -49
- umap/static/umap/js/umap.forms.js +19 -19
- umap/static/umap/js/umap.icon.js +17 -17
- umap/static/umap/js/umap.importer.js +2 -1
- umap/static/umap/js/umap.js +242 -291
- umap/static/umap/js/umap.layer.js +173 -140
- umap/static/umap/js/umap.permissions.js +24 -25
- umap/static/umap/js/umap.popup.js +14 -14
- umap/static/umap/js/umap.share.js +4 -4
- umap/static/umap/js/umap.slideshow.js +4 -4
- umap/static/umap/js/umap.tableeditor.js +2 -2
- umap/static/umap/js/umap.ui.js +1 -1
- umap/static/umap/locale/am_ET.js +1 -11
- umap/static/umap/locale/am_ET.json +1 -11
- umap/static/umap/locale/ar.js +1 -11
- umap/static/umap/locale/ar.json +1 -11
- umap/static/umap/locale/ast.js +1 -11
- umap/static/umap/locale/ast.json +1 -11
- umap/static/umap/locale/bg.js +1 -11
- umap/static/umap/locale/bg.json +1 -11
- umap/static/umap/locale/br.js +1 -11
- umap/static/umap/locale/br.json +1 -11
- umap/static/umap/locale/ca.js +1 -11
- umap/static/umap/locale/ca.json +1 -11
- umap/static/umap/locale/cs_CZ.js +1 -11
- umap/static/umap/locale/cs_CZ.json +1 -11
- umap/static/umap/locale/da.js +1 -11
- umap/static/umap/locale/da.json +1 -11
- umap/static/umap/locale/de.js +1 -11
- umap/static/umap/locale/de.json +1 -11
- umap/static/umap/locale/el.js +1 -11
- umap/static/umap/locale/el.json +1 -11
- umap/static/umap/locale/en.js +1 -11
- umap/static/umap/locale/en.json +1 -11
- umap/static/umap/locale/en_US.json +1 -11
- umap/static/umap/locale/es.js +1 -11
- umap/static/umap/locale/es.json +1 -11
- umap/static/umap/locale/et.js +1 -11
- umap/static/umap/locale/et.json +1 -11
- umap/static/umap/locale/fa_IR.js +6 -16
- umap/static/umap/locale/fa_IR.json +6 -16
- umap/static/umap/locale/fi.js +1 -11
- umap/static/umap/locale/fi.json +1 -11
- umap/static/umap/locale/fr.js +1 -11
- umap/static/umap/locale/fr.json +1 -11
- umap/static/umap/locale/gl.js +1 -11
- umap/static/umap/locale/gl.json +1 -11
- umap/static/umap/locale/he.js +1 -11
- umap/static/umap/locale/he.json +1 -11
- umap/static/umap/locale/hr.js +1 -11
- umap/static/umap/locale/hr.json +1 -11
- umap/static/umap/locale/hu.js +1 -11
- umap/static/umap/locale/hu.json +1 -11
- umap/static/umap/locale/id.js +1 -11
- umap/static/umap/locale/id.json +1 -11
- umap/static/umap/locale/is.js +1 -11
- umap/static/umap/locale/is.json +1 -11
- umap/static/umap/locale/it.js +1 -11
- umap/static/umap/locale/it.json +1 -11
- umap/static/umap/locale/ja.js +1 -11
- umap/static/umap/locale/ja.json +1 -11
- umap/static/umap/locale/ko.js +1 -11
- umap/static/umap/locale/ko.json +1 -11
- umap/static/umap/locale/lt.js +1 -11
- umap/static/umap/locale/lt.json +1 -11
- umap/static/umap/locale/ms.js +1 -11
- umap/static/umap/locale/ms.json +1 -11
- umap/static/umap/locale/nl.js +1 -11
- umap/static/umap/locale/nl.json +1 -11
- umap/static/umap/locale/no.js +1 -11
- umap/static/umap/locale/no.json +1 -11
- umap/static/umap/locale/pl.js +1 -11
- umap/static/umap/locale/pl.json +1 -11
- umap/static/umap/locale/pl_PL.json +1 -11
- umap/static/umap/locale/pt.js +1 -11
- umap/static/umap/locale/pt.json +1 -11
- umap/static/umap/locale/pt_BR.js +1 -11
- umap/static/umap/locale/pt_BR.json +1 -11
- umap/static/umap/locale/pt_PT.js +1 -11
- umap/static/umap/locale/pt_PT.json +1 -11
- umap/static/umap/locale/ro.js +1 -11
- umap/static/umap/locale/ro.json +1 -11
- umap/static/umap/locale/ru.js +1 -11
- umap/static/umap/locale/ru.json +1 -11
- umap/static/umap/locale/sk_SK.js +1 -11
- umap/static/umap/locale/sk_SK.json +1 -11
- umap/static/umap/locale/sl.js +1 -11
- umap/static/umap/locale/sl.json +1 -11
- umap/static/umap/locale/sr.js +1 -11
- umap/static/umap/locale/sr.json +1 -11
- umap/static/umap/locale/sv.js +1 -11
- umap/static/umap/locale/sv.json +1 -11
- umap/static/umap/locale/th_TH.js +1 -11
- umap/static/umap/locale/th_TH.json +1 -11
- umap/static/umap/locale/tr.js +1 -11
- umap/static/umap/locale/tr.json +1 -11
- umap/static/umap/locale/uk_UA.js +1 -11
- umap/static/umap/locale/uk_UA.json +1 -11
- umap/static/umap/locale/vi.js +1 -11
- umap/static/umap/locale/vi.json +1 -11
- umap/static/umap/locale/vi_VN.json +1 -11
- umap/static/umap/locale/zh.js +1 -11
- umap/static/umap/locale/zh.json +1 -11
- umap/static/umap/locale/zh_CN.json +1 -11
- umap/static/umap/locale/zh_TW.Big5.json +1 -11
- umap/static/umap/locale/zh_TW.js +17 -27
- umap/static/umap/locale/zh_TW.json +17 -27
- umap/static/umap/map.css +2 -2
- umap/static/umap/nav.css +2 -1
- umap/static/umap/test/.eslintrc +0 -1
- umap/static/umap/test/Choropleth.js +29 -27
- umap/static/umap/test/DataLayer.js +207 -239
- umap/static/umap/test/Feature.js +33 -58
- umap/static/umap/test/Map.Export.js +11 -11
- umap/static/umap/test/Map.js +66 -67
- umap/static/umap/test/Marker.js +36 -32
- umap/static/umap/test/Polygon.js +95 -95
- umap/static/umap/test/Polyline.js +31 -31
- umap/static/umap/test/TableEditor.js +29 -25
- umap/static/umap/test/_pre.js +2 -7
- umap/static/umap/test/index.html +4 -4
- umap/static/umap/vendors/contextmenu/leaflet.contextmenu.css +54 -0
- umap/static/umap/vendors/contextmenu/leaflet.contextmenu.js +586 -0
- umap/static/umap/vendors/csv2geojson/index.js +259 -0
- umap/static/umap/vendors/dompurify/purify.js +1633 -0
- umap/static/umap/vendors/locatecontrol/L.Control.Locate.css +63 -0
- umap/static/umap/vendors/locatecontrol/L.Control.Locate.js +950 -0
- umap/static/umap/vendors/minimap/Control.MiniMap.css +88 -0
- umap/static/umap/vendors/minimap/Control.MiniMap.js +352 -0
- umap/static/umap/vendors/togeojson/togeojson.js +2 -0
- umap/templates/auth/user_form.html +3 -2
- umap/templates/base.html +1 -0
- umap/templates/registration/login.html +51 -36
- umap/templates/umap/about_summary.html +1 -1
- umap/templates/umap/branding.html +3 -0
- umap/templates/umap/content.html +15 -39
- umap/templates/umap/header.html +0 -0
- umap/templates/umap/home.html +4 -2
- umap/templates/umap/js.html +0 -1
- umap/templates/umap/map_detail.html +9 -0
- umap/templates/umap/map_init.html +1 -1
- umap/templates/umap/map_messages.html +4 -2
- umap/templates/umap/map_table.html +130 -69
- umap/templates/umap/navigation.html +2 -4
- umap/templates/umap/user_dashboard.html +29 -6
- umap/tests/base.py +1 -1
- umap/tests/integration/conftest.py +18 -0
- umap/tests/integration/test_anonymous_owned_map.py +6 -3
- umap/tests/integration/test_browser.py +166 -6
- umap/tests/integration/test_collaborative_editing.py +142 -0
- umap/tests/integration/test_dashboard.py +17 -0
- umap/tests/integration/test_edit_datalayer.py +4 -3
- umap/tests/integration/test_export_map.py +1 -1
- umap/tests/integration/test_import.py +9 -4
- umap/tests/integration/test_map.py +64 -0
- umap/tests/integration/test_map_preview.py +75 -0
- umap/tests/integration/test_owned_map.py +11 -25
- umap/tests/integration/test_picto.py +3 -3
- umap/tests/integration/test_querystring.py +52 -0
- umap/tests/integration/test_share.py +22 -0
- umap/tests/test_map_views.py +157 -14
- umap/tests/test_merge_features.py +5 -5
- umap/tests/test_views.py +50 -11
- umap/urls.py +6 -12
- umap/utils.py +1 -1
- umap/views.py +170 -47
- {umap_project-1.14.0a4.dist-info → umap_project-2.0.0a0.dist-info}/METADATA +13 -15
- {umap_project-1.14.0a4.dist-info → umap_project-2.0.0a0.dist-info}/RECORD +222 -200
- umap/static/umap/js/umap.browser.js +0 -148
- umap/static/umap/js/umap.xhr.js +0 -304
- umap/static/umap/test/Controls.js +0 -100
- umap/static/umap/test/Map.Init.js +0 -46
- {umap_project-1.14.0a4.dist-info → umap_project-2.0.0a0.dist-info}/WHEEL +0 -0
- {umap_project-1.14.0a4.dist-info → umap_project-2.0.0a0.dist-info}/entry_points.txt +0 -0
- {umap_project-1.14.0a4.dist-info → umap_project-2.0.0a0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
.leaflet-control-minimap {
|
|
2
|
+
border:solid rgba(255, 255, 255, 1.0) 4px;
|
|
3
|
+
box-shadow: 0 1px 5px rgba(0,0,0,0.65);
|
|
4
|
+
border-radius: 3px;
|
|
5
|
+
background: #f8f8f9;
|
|
6
|
+
transition: all .6s;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.leaflet-control-minimap a {
|
|
10
|
+
background-color: rgba(255, 255, 255, 1.0);
|
|
11
|
+
background-repeat: no-repeat;
|
|
12
|
+
z-index: 99999;
|
|
13
|
+
transition: all .6s;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.leaflet-control-minimap a.minimized-bottomright {
|
|
17
|
+
-webkit-transform: rotate(180deg);
|
|
18
|
+
transform: rotate(180deg);
|
|
19
|
+
border-radius: 0px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.leaflet-control-minimap a.minimized-topleft {
|
|
23
|
+
-webkit-transform: rotate(0deg);
|
|
24
|
+
transform: rotate(0deg);
|
|
25
|
+
border-radius: 0px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.leaflet-control-minimap a.minimized-bottomleft {
|
|
29
|
+
-webkit-transform: rotate(270deg);
|
|
30
|
+
transform: rotate(270deg);
|
|
31
|
+
border-radius: 0px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.leaflet-control-minimap a.minimized-topright {
|
|
35
|
+
-webkit-transform: rotate(90deg);
|
|
36
|
+
transform: rotate(90deg);
|
|
37
|
+
border-radius: 0px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.leaflet-control-minimap-toggle-display{
|
|
41
|
+
background-image: url("images/toggle.svg");
|
|
42
|
+
background-size: cover;
|
|
43
|
+
position: absolute;
|
|
44
|
+
border-radius: 3px 0px 0px 0px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.leaflet-oldie .leaflet-control-minimap-toggle-display{
|
|
48
|
+
background-image: url("images/toggle.png");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.leaflet-control-minimap-toggle-display-bottomright {
|
|
52
|
+
bottom: 0;
|
|
53
|
+
right: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.leaflet-control-minimap-toggle-display-topleft{
|
|
57
|
+
top: 0;
|
|
58
|
+
left: 0;
|
|
59
|
+
-webkit-transform: rotate(180deg);
|
|
60
|
+
transform: rotate(180deg);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.leaflet-control-minimap-toggle-display-bottomleft{
|
|
64
|
+
bottom: 0;
|
|
65
|
+
left: 0;
|
|
66
|
+
-webkit-transform: rotate(90deg);
|
|
67
|
+
transform: rotate(90deg);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.leaflet-control-minimap-toggle-display-topright{
|
|
71
|
+
top: 0;
|
|
72
|
+
right: 0;
|
|
73
|
+
-webkit-transform: rotate(270deg);
|
|
74
|
+
transform: rotate(270deg);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Old IE */
|
|
78
|
+
.leaflet-oldie .leaflet-control-minimap {
|
|
79
|
+
border: 1px solid #999;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.leaflet-oldie .leaflet-control-minimap a {
|
|
83
|
+
background-color: #fff;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.leaflet-oldie .leaflet-control-minimap a.minimized {
|
|
87
|
+
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);
|
|
88
|
+
}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
// Following https://github.com/Leaflet/Leaflet/blob/master/PLUGIN-GUIDE.md
|
|
2
|
+
(function (factory, window) {
|
|
3
|
+
|
|
4
|
+
// define an AMD module that relies on 'leaflet'
|
|
5
|
+
if (typeof define === 'function' && define.amd) {
|
|
6
|
+
define(['leaflet'], factory);
|
|
7
|
+
|
|
8
|
+
// define a Common JS module that relies on 'leaflet'
|
|
9
|
+
} else if (typeof exports === 'object') {
|
|
10
|
+
module.exports = factory(require('leaflet'));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// attach your plugin to the global 'L' variable
|
|
14
|
+
if (typeof window !== 'undefined' && window.L) {
|
|
15
|
+
window.L.Control.MiniMap = factory(L);
|
|
16
|
+
window.L.control.minimap = function (layer, options) {
|
|
17
|
+
return new window.L.Control.MiniMap(layer, options);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}(function (L) {
|
|
21
|
+
|
|
22
|
+
var MiniMap = L.Control.extend({
|
|
23
|
+
|
|
24
|
+
includes: L.Evented ? L.Evented.prototype : L.Mixin.Events,
|
|
25
|
+
|
|
26
|
+
options: {
|
|
27
|
+
position: 'bottomright',
|
|
28
|
+
toggleDisplay: false,
|
|
29
|
+
zoomLevelOffset: -5,
|
|
30
|
+
zoomLevelFixed: false,
|
|
31
|
+
centerFixed: false,
|
|
32
|
+
zoomAnimation: false,
|
|
33
|
+
autoToggleDisplay: false,
|
|
34
|
+
minimized: false,
|
|
35
|
+
width: 150,
|
|
36
|
+
height: 150,
|
|
37
|
+
collapsedWidth: 19,
|
|
38
|
+
collapsedHeight: 19,
|
|
39
|
+
aimingRectOptions: {color: '#ff7800', weight: 1, clickable: false},
|
|
40
|
+
shadowRectOptions: {color: '#000000', weight: 1, clickable: false, opacity: 0, fillOpacity: 0},
|
|
41
|
+
strings: {hideText: 'Hide MiniMap', showText: 'Show MiniMap'},
|
|
42
|
+
mapOptions: {} // Allows definition / override of Leaflet map options.
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
// layer is the map layer to be shown in the minimap
|
|
46
|
+
initialize: function (layer, options) {
|
|
47
|
+
L.Util.setOptions(this, options);
|
|
48
|
+
// Make sure the aiming rects are non-clickable even if the user tries to set them clickable (most likely by forgetting to specify them false)
|
|
49
|
+
this.options.aimingRectOptions.clickable = false;
|
|
50
|
+
this.options.shadowRectOptions.clickable = false;
|
|
51
|
+
this._layer = layer;
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
onAdd: function (map) {
|
|
55
|
+
|
|
56
|
+
this._mainMap = map;
|
|
57
|
+
|
|
58
|
+
// Creating the container and stopping events from spilling through to the main map.
|
|
59
|
+
this._container = L.DomUtil.create('div', 'leaflet-control-minimap');
|
|
60
|
+
this._container.style.width = this.options.width + 'px';
|
|
61
|
+
this._container.style.height = this.options.height + 'px';
|
|
62
|
+
L.DomEvent.disableClickPropagation(this._container);
|
|
63
|
+
L.DomEvent.on(this._container, 'mousewheel', L.DomEvent.stopPropagation);
|
|
64
|
+
|
|
65
|
+
var mapOptions = {
|
|
66
|
+
attributionControl: false,
|
|
67
|
+
dragging: !this.options.centerFixed,
|
|
68
|
+
zoomControl: false,
|
|
69
|
+
zoomAnimation: this.options.zoomAnimation,
|
|
70
|
+
autoToggleDisplay: this.options.autoToggleDisplay,
|
|
71
|
+
touchZoom: this.options.centerFixed ? 'center' : !this._isZoomLevelFixed(),
|
|
72
|
+
scrollWheelZoom: this.options.centerFixed ? 'center' : !this._isZoomLevelFixed(),
|
|
73
|
+
doubleClickZoom: this.options.centerFixed ? 'center' : !this._isZoomLevelFixed(),
|
|
74
|
+
boxZoom: !this._isZoomLevelFixed(),
|
|
75
|
+
crs: map.options.crs
|
|
76
|
+
};
|
|
77
|
+
mapOptions = L.Util.extend(this.options.mapOptions, mapOptions); // merge with priority of the local mapOptions object.
|
|
78
|
+
|
|
79
|
+
this._miniMap = new L.Map(this._container, mapOptions);
|
|
80
|
+
|
|
81
|
+
this._miniMap.addLayer(this._layer);
|
|
82
|
+
|
|
83
|
+
// These bools are used to prevent infinite loops of the two maps notifying each other that they've moved.
|
|
84
|
+
this._mainMapMoving = false;
|
|
85
|
+
this._miniMapMoving = false;
|
|
86
|
+
|
|
87
|
+
// Keep a record of this to prevent auto toggling when the user explicitly doesn't want it.
|
|
88
|
+
this._userToggledDisplay = false;
|
|
89
|
+
this._minimized = false;
|
|
90
|
+
|
|
91
|
+
if (this.options.toggleDisplay) {
|
|
92
|
+
this._addToggleButton();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
this._miniMap.whenReady(L.Util.bind(function () {
|
|
96
|
+
this._aimingRect = L.rectangle(this._mainMap.getBounds(), this.options.aimingRectOptions).addTo(this._miniMap);
|
|
97
|
+
this._shadowRect = L.rectangle(this._mainMap.getBounds(), this.options.shadowRectOptions).addTo(this._miniMap);
|
|
98
|
+
this._mainMap.on('moveend', this._onMainMapMoved, this);
|
|
99
|
+
this._mainMap.on('move', this._onMainMapMoving, this);
|
|
100
|
+
this._miniMap.on('movestart', this._onMiniMapMoveStarted, this);
|
|
101
|
+
this._miniMap.on('move', this._onMiniMapMoving, this);
|
|
102
|
+
this._miniMap.on('moveend', this._onMiniMapMoved, this);
|
|
103
|
+
}, this));
|
|
104
|
+
|
|
105
|
+
return this._container;
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
addTo: function (map) {
|
|
109
|
+
L.Control.prototype.addTo.call(this, map);
|
|
110
|
+
|
|
111
|
+
var center = this.options.centerFixed || this._mainMap.getCenter();
|
|
112
|
+
this._miniMap.setView(center, this._decideZoom(true));
|
|
113
|
+
this._setDisplay(this.options.minimized);
|
|
114
|
+
return this;
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
onRemove: function (map) {
|
|
118
|
+
this._mainMap.off('moveend', this._onMainMapMoved, this);
|
|
119
|
+
this._mainMap.off('move', this._onMainMapMoving, this);
|
|
120
|
+
this._miniMap.off('moveend', this._onMiniMapMoved, this);
|
|
121
|
+
|
|
122
|
+
this._miniMap.removeLayer(this._layer);
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
changeLayer: function (layer) {
|
|
126
|
+
this._miniMap.removeLayer(this._layer);
|
|
127
|
+
this._layer = layer;
|
|
128
|
+
this._miniMap.addLayer(this._layer);
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
_addToggleButton: function () {
|
|
132
|
+
this._toggleDisplayButton = this.options.toggleDisplay ? this._createButton(
|
|
133
|
+
'', this._toggleButtonInitialTitleText(), ('leaflet-control-minimap-toggle-display leaflet-control-minimap-toggle-display-' +
|
|
134
|
+
this.options.position), this._container, this._toggleDisplayButtonClicked, this) : undefined;
|
|
135
|
+
|
|
136
|
+
this._toggleDisplayButton.style.width = this.options.collapsedWidth + 'px';
|
|
137
|
+
this._toggleDisplayButton.style.height = this.options.collapsedHeight + 'px';
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
_toggleButtonInitialTitleText: function () {
|
|
141
|
+
if (this.options.minimized) {
|
|
142
|
+
return this.options.strings.showText;
|
|
143
|
+
} else {
|
|
144
|
+
return this.options.strings.hideText;
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
_createButton: function (html, title, className, container, fn, context) {
|
|
149
|
+
var link = L.DomUtil.create('a', className, container);
|
|
150
|
+
link.innerHTML = html;
|
|
151
|
+
link.href = '#';
|
|
152
|
+
link.title = title;
|
|
153
|
+
|
|
154
|
+
var stop = L.DomEvent.stopPropagation;
|
|
155
|
+
|
|
156
|
+
L.DomEvent
|
|
157
|
+
.on(link, 'click', stop)
|
|
158
|
+
.on(link, 'mousedown', stop)
|
|
159
|
+
.on(link, 'dblclick', stop)
|
|
160
|
+
.on(link, 'click', L.DomEvent.preventDefault)
|
|
161
|
+
.on(link, 'click', fn, context);
|
|
162
|
+
|
|
163
|
+
return link;
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
_toggleDisplayButtonClicked: function () {
|
|
167
|
+
this._userToggledDisplay = true;
|
|
168
|
+
if (!this._minimized) {
|
|
169
|
+
this._minimize();
|
|
170
|
+
} else {
|
|
171
|
+
this._restore();
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
_setDisplay: function (minimize) {
|
|
176
|
+
if (minimize !== this._minimized) {
|
|
177
|
+
if (!this._minimized) {
|
|
178
|
+
this._minimize();
|
|
179
|
+
} else {
|
|
180
|
+
this._restore();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
_minimize: function () {
|
|
186
|
+
// hide the minimap
|
|
187
|
+
if (this.options.toggleDisplay) {
|
|
188
|
+
this._container.style.width = this.options.collapsedWidth + 'px';
|
|
189
|
+
this._container.style.height = this.options.collapsedHeight + 'px';
|
|
190
|
+
this._toggleDisplayButton.className += (' minimized-' + this.options.position);
|
|
191
|
+
this._toggleDisplayButton.title = this.options.strings.showText;
|
|
192
|
+
} else {
|
|
193
|
+
this._container.style.display = 'none';
|
|
194
|
+
}
|
|
195
|
+
this._minimized = true;
|
|
196
|
+
this._onToggle();
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
_restore: function () {
|
|
200
|
+
if (this.options.toggleDisplay) {
|
|
201
|
+
this._container.style.width = this.options.width + 'px';
|
|
202
|
+
this._container.style.height = this.options.height + 'px';
|
|
203
|
+
this._toggleDisplayButton.className = this._toggleDisplayButton.className
|
|
204
|
+
.replace('minimized-' + this.options.position, '');
|
|
205
|
+
this._toggleDisplayButton.title = this.options.strings.hideText;
|
|
206
|
+
} else {
|
|
207
|
+
this._container.style.display = 'block';
|
|
208
|
+
}
|
|
209
|
+
this._minimized = false;
|
|
210
|
+
this._onToggle();
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
_onMainMapMoved: function (e) {
|
|
214
|
+
if (!this._miniMapMoving) {
|
|
215
|
+
var center = this.options.centerFixed || this._mainMap.getCenter();
|
|
216
|
+
|
|
217
|
+
this._mainMapMoving = true;
|
|
218
|
+
this._miniMap.setView(center, this._decideZoom(true));
|
|
219
|
+
this._setDisplay(this._decideMinimized());
|
|
220
|
+
} else {
|
|
221
|
+
this._miniMapMoving = false;
|
|
222
|
+
}
|
|
223
|
+
this._aimingRect.setBounds(this._mainMap.getBounds());
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
_onMainMapMoving: function (e) {
|
|
227
|
+
this._aimingRect.setBounds(this._mainMap.getBounds());
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
_onMiniMapMoveStarted: function (e) {
|
|
231
|
+
if (!this.options.centerFixed) {
|
|
232
|
+
var lastAimingRect = this._aimingRect.getBounds();
|
|
233
|
+
var sw = this._miniMap.latLngToContainerPoint(lastAimingRect.getSouthWest());
|
|
234
|
+
var ne = this._miniMap.latLngToContainerPoint(lastAimingRect.getNorthEast());
|
|
235
|
+
this._lastAimingRectPosition = {sw: sw, ne: ne};
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
|
|
239
|
+
_onMiniMapMoving: function (e) {
|
|
240
|
+
if (!this.options.centerFixed) {
|
|
241
|
+
if (!this._mainMapMoving && this._lastAimingRectPosition) {
|
|
242
|
+
this._shadowRect.setBounds(new L.LatLngBounds(this._miniMap.containerPointToLatLng(this._lastAimingRectPosition.sw), this._miniMap.containerPointToLatLng(this._lastAimingRectPosition.ne)));
|
|
243
|
+
this._shadowRect.setStyle({opacity: 1, fillOpacity: 0.3});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
_onMiniMapMoved: function (e) {
|
|
249
|
+
if (!this._mainMapMoving) {
|
|
250
|
+
this._miniMapMoving = true;
|
|
251
|
+
this._mainMap.setView(this._miniMap.getCenter(), this._decideZoom(false));
|
|
252
|
+
this._shadowRect.setStyle({opacity: 0, fillOpacity: 0});
|
|
253
|
+
} else {
|
|
254
|
+
this._mainMapMoving = false;
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
_isZoomLevelFixed: function () {
|
|
259
|
+
var zoomLevelFixed = this.options.zoomLevelFixed;
|
|
260
|
+
return this._isDefined(zoomLevelFixed) && this._isInteger(zoomLevelFixed);
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
_decideZoom: function (fromMaintoMini) {
|
|
264
|
+
if (!this._isZoomLevelFixed()) {
|
|
265
|
+
if (fromMaintoMini) {
|
|
266
|
+
return this._mainMap.getZoom() + this.options.zoomLevelOffset;
|
|
267
|
+
} else {
|
|
268
|
+
var currentDiff = this._miniMap.getZoom() - this._mainMap.getZoom();
|
|
269
|
+
var proposedZoom = this._miniMap.getZoom() - this.options.zoomLevelOffset;
|
|
270
|
+
var toRet;
|
|
271
|
+
|
|
272
|
+
if (currentDiff > this.options.zoomLevelOffset && this._mainMap.getZoom() < this._miniMap.getMinZoom() - this.options.zoomLevelOffset) {
|
|
273
|
+
// This means the miniMap is zoomed out to the minimum zoom level and can't zoom any more.
|
|
274
|
+
if (this._miniMap.getZoom() > this._lastMiniMapZoom) {
|
|
275
|
+
// This means the user is trying to zoom in by using the minimap, zoom the main map.
|
|
276
|
+
toRet = this._mainMap.getZoom() + 1;
|
|
277
|
+
// Also we cheat and zoom the minimap out again to keep it visually consistent.
|
|
278
|
+
this._miniMap.setZoom(this._miniMap.getZoom() - 1);
|
|
279
|
+
} else {
|
|
280
|
+
// Either the user is trying to zoom out past the mini map's min zoom or has just panned using it, we can't tell the difference.
|
|
281
|
+
// Therefore, we ignore it!
|
|
282
|
+
toRet = this._mainMap.getZoom();
|
|
283
|
+
}
|
|
284
|
+
} else {
|
|
285
|
+
// This is what happens in the majority of cases, and always if you configure the min levels + offset in a sane fashion.
|
|
286
|
+
toRet = proposedZoom;
|
|
287
|
+
}
|
|
288
|
+
this._lastMiniMapZoom = this._miniMap.getZoom();
|
|
289
|
+
return toRet;
|
|
290
|
+
}
|
|
291
|
+
} else {
|
|
292
|
+
if (fromMaintoMini) {
|
|
293
|
+
return this.options.zoomLevelFixed;
|
|
294
|
+
} else {
|
|
295
|
+
return this._mainMap.getZoom();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
_decideMinimized: function () {
|
|
301
|
+
if (this._userToggledDisplay) {
|
|
302
|
+
return this._minimized;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (this.options.autoToggleDisplay) {
|
|
306
|
+
if (this._mainMap.getBounds().contains(this._miniMap.getBounds())) {
|
|
307
|
+
return true;
|
|
308
|
+
}
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return this._minimized;
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
_isInteger: function (value) {
|
|
316
|
+
return typeof value === 'number';
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
_isDefined: function (value) {
|
|
320
|
+
return typeof value !== 'undefined';
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
_onToggle: function () {
|
|
324
|
+
L.Util.requestAnimFrame(function () {
|
|
325
|
+
L.DomEvent.on(this._container, 'transitionend', this._fireToggleEvents, this);
|
|
326
|
+
if (!L.Browser.any3d) {
|
|
327
|
+
L.Util.requestAnimFrame(this._fireToggleEvents, this);
|
|
328
|
+
}
|
|
329
|
+
}, this);
|
|
330
|
+
},
|
|
331
|
+
|
|
332
|
+
_fireToggleEvents: function () {
|
|
333
|
+
L.DomEvent.off(this._container, 'transitionend', this._fireToggleEvents, this);
|
|
334
|
+
var data = { minimized: this._minimized };
|
|
335
|
+
this.fire(this._minimized ? 'minimize' : 'restore', data);
|
|
336
|
+
this.fire('toggle', data);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
L.Map.mergeOptions({
|
|
341
|
+
miniMapControl: false
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
L.Map.addInitHook(function () {
|
|
345
|
+
if (this.options.miniMapControl) {
|
|
346
|
+
this.miniMapControl = (new MiniMap()).addTo(this);
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
return MiniMap;
|
|
351
|
+
|
|
352
|
+
}, window));
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).toGeoJSON={})}(this,(function(t){"use strict";function e(t,e){return Array.from(t.getElementsByTagName(e))}function n(t){return"#"===t[0]?t:`#${t}`}function o(t){return t?.normalize(),t&&t.textContent||""}function r(t,e,n){const o=t.getElementsByTagName(e),r=o.length?o[0]:null;return r&&n&&n(r),r}function i(t,e,n){const o={};if(!t)return o;const r=t.getElementsByTagName(e),i=r.length?r[0]:null;return i&&n?n(i,o):o}function s(t,e,n){const i=o(r(t,e));return i&&n&&n(i)||{}}function c(t,e,n){const i=parseFloat(o(r(t,e)));if(!isNaN(i))return i&&n&&n(i)||{}}function a(t,e,n){const i=parseFloat(o(r(t,e)));if(!isNaN(i))return n&&n(i),i}function l(t,e){const n={};for(const o of e)s(t,o,(t=>{n[o]=t}));return n}function u(t){return 1===t?.nodeType}function f(t){return i(t,"line",(t=>Object.assign({},s(t,"color",(t=>({stroke:`#${t}`}))),c(t,"opacity",(t=>({"stroke-opacity":t}))),c(t,"width",(t=>({"stroke-width":96*t/25.4}))))))}function p(t){let e=[];if(null===t)return e;for(const n of Array.from(t.childNodes)){if(!u(n))continue;const t=g(n.nodeName);if("gpxtpx:TrackPointExtension"===t)e=e.concat(p(n));else{const r=o(n);e.push([t,d(r)])}}return e}function g(t){return["heart","gpxtpx:hr","hr"].includes(t)?"heart":t}function d(t){const e=parseFloat(t);return isNaN(e)?t:e}function m(t){const e=[parseFloat(t.getAttribute("lon")||""),parseFloat(t.getAttribute("lat")||"")];if(isNaN(e[0])||isNaN(e[1]))return null;a(t,"ele",(t=>{e.push(t)}));const n=r(t,"time");return{coordinates:e,time:n?o(n):null,extendedValues:p(r(t,"extensions"))}}function h(t){const n=l(t,["name","cmt","desc","type","time","keywords"]),r=Array.from(t.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3","*"));for(const e of r)e.parentNode?.parentNode===t&&(n[e.tagName.replace(":","_")]=o(e));const i=e(t,"link");return i.length&&(n.links=i.map((t=>Object.assign({href:t.getAttribute("href")},l(t,["text","type"]))))),n}function y(t,n){const o=e(t,n),r=[],i=[],s={};for(let t=0;t<o.length;t++){const e=m(o[t]);if(e){r.push(e.coordinates),e.time&&i.push(e.time);for(const[n,r]of e.extendedValues){const e="heart"===n?n:n.replace("gpxtpx:","")+"s";s[e]||(s[e]=Array(o.length).fill(null)),s[e][t]=r}}}if(!(r.length<2))return{line:r,times:i,extendedValues:s}}function b(t){const e=y(t,"rtept");if(e)return{type:"Feature",properties:Object.assign({_gpxType:"rte"},h(t),f(r(t,"extensions"))),geometry:{type:"LineString",coordinates:e.line}}}function N(t){const n=e(t,"trkseg"),o=[],i=[],s=[];for(const t of n){const e=y(t,"trkpt");e&&(s.push(e),e.times&&e.times.length&&i.push(e.times))}if(0===s.length)return null;const c=s.length>1,a=Object.assign({_gpxType:"trk"},h(t),f(r(t,"extensions")),i.length?{coordinateProperties:{times:c?i:i[0]}}:{});for(const t of s){o.push(t.line),a.coordinateProperties||(a.coordinateProperties={});const e=a.coordinateProperties,n=Object.entries(t.extendedValues);for(let t=0;t<n.length;t++){const[o,r]=n[t];c?(e[o]||(e[o]=s.map((t=>new Array(t.line.length).fill(null)))),e[o][t]=r):e[o]=r}}return{type:"Feature",properties:a,geometry:c?{type:"MultiLineString",coordinates:o}:{type:"LineString",coordinates:o[0]}}}function x(t){const e=Object.assign(h(t),l(t,["sym"])),n=m(t);return n?{type:"Feature",properties:e,geometry:{type:"Point",coordinates:n.coordinates}}:null}function*k(t){for(const n of e(t,"trk")){const t=N(n);t&&(yield t)}for(const n of e(t,"rte")){const t=b(n);t&&(yield t)}for(const n of e(t,"wpt")){const t=x(n);t&&(yield t)}}const A=[["heartRate","heartRates"],["Cadence","cadences"],["Speed","speeds"],["Watts","watts"]],S=[["TotalTimeSeconds","totalTimeSeconds"],["DistanceMeters","distanceMeters"],["MaximumSpeed","maxSpeed"],["AverageHeartRateBpm","avgHeartRate"],["MaximumHeartRateBpm","maxHeartRate"],["AvgSpeed","avgSpeed"],["AvgWatts","avgWatts"],["MaxWatts","maxWatts"]];function v(t,e){const n=[];for(const[i,s]of e){let e=r(t,i);if(!e){const n=t.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/ActivityExtension/v2",i);n.length&&(e=n[0])}const c=parseFloat(o(e));isNaN(c)||n.push([s,c])}return n}function T(t){const e=[a(t,"LongitudeDegrees"),a(t,"LatitudeDegrees")];if(void 0===e[0]||isNaN(e[0])||void 0===e[1]||isNaN(e[1]))return null;const n=r(t,"HeartRateBpm"),i=o(r(t,"Time"));return r(t,"AltitudeMeters",(t=>{const n=parseFloat(o(t));isNaN(n)||e.push(n)})),{coordinates:e,time:i||null,heartRate:n?parseFloat(o(n)):null,extensions:v(t,A)}}function F(t){const n=e(t,"Trackpoint"),o=[],r=[],i=[];if(n.length<2)return null;const s={},c={extendedProperties:s};for(let t=0;t<n.length;t++){const e=T(n[t]);if(null===e)continue;o.push(e.coordinates);const{time:c,heartRate:a,extensions:l}=e;c&&r.push(c),a&&i.push(a);for(const[e,o]of l)s[e]||(s[e]=Array(n.length).fill(null)),s[e][t]=o}return o.length<2?null:Object.assign(c,{line:o,times:r,heartRates:i})}function P(t){const n=e(t,"Track"),r=[],s=[],c=[],a=[];let l;const u=Object.assign(Object.fromEntries(v(t,S)),i(t,"Name",(t=>({name:o(t)}))));for(const t of n)l=F(t),l&&(r.push(l.line),l.times.length&&s.push(l.times),l.heartRates.length&&c.push(l.heartRates),a.push(l.extendedProperties));for(let t=0;t<a.length;t++){const e=a[t];for(const o in e)1===n.length?l&&(u[o]=l.extendedProperties[o]):(u[o]||(u[o]=r.map((t=>Array(t.length).fill(null)))),u[o][t]=e[o])}return 0===r.length?null:((s.length||c.length)&&(u.coordinateProperties=Object.assign(s.length?{times:1===r.length?s[0]:s}:{},c.length?{heart:1===r.length?c[0]:c}:{})),{type:"Feature",properties:u,geometry:1===r.length?{type:"LineString",coordinates:r[0]}:{type:"MultiLineString",coordinates:r}})}function*O(t){for(const n of e(t,"Lap")){const t=P(n);t&&(yield t)}for(const n of e(t,"Courses")){const t=P(n);t&&(yield t)}}function w(t,e){const n={},o="stroke"==e||"fill"===e?e:e+"-color";return"#"===t[0]&&(t=t.substring(1)),6===t.length||3===t.length?n[o]="#"+t:8===t.length&&(n[e+"-opacity"]=parseInt(t.substring(0,2),16)/255,n[o]="#"+t.substring(6,8)+t.substring(4,6)+t.substring(2,4)),n}function M(t,e,n){const o={};return a(t,e,(t=>{o[n]=t})),o}function j(t,e){return i(t,"color",(t=>w(o(t),e)))}function L(t){return i(t,"Icon",((t,e)=>(s(t,"href",(t=>{e.icon=t})),e)))}function G(t){return Object.assign({},function(t){return i(t,"PolyStyle",((t,e)=>Object.assign(e,i(t,"color",(t=>w(o(t),"fill"))),s(t,"fill",(t=>{if("0"===t)return{"fill-opacity":0}})),s(t,"outline",(t=>{if("0"===t)return{"stroke-opacity":0}})))))}(t),function(t){return i(t,"LineStyle",(t=>Object.assign(j(t,"stroke"),M(t,"width","stroke-width"))))}(t),function(t){return i(t,"LabelStyle",(t=>Object.assign(j(t,"label"),M(t,"scale","label-scale"))))}(t),function(t){return i(t,"IconStyle",(t=>Object.assign(j(t,"icon"),M(t,"scale","icon-scale"),M(t,"heading","icon-heading"),i(t,"hotSpot",(t=>{const e=parseFloat(t.getAttribute("x")||""),n=parseFloat(t.getAttribute("y")||""),o=t.getAttribute("xunits")||"",r=t.getAttribute("yunits")||"";return isNaN(e)||isNaN(n)?{}:{"icon-offset":[e,n],"icon-offset-units":[o,r]}})),L(t))))}(t))}const R=t=>Number(t),B={string:t=>t,int:R,uint:R,short:R,ushort:R,float:R,double:R,bool:t=>Boolean(t)};function E(t,n){return i(t,"ExtendedData",((t,i)=>{for(const n of e(t,"Data"))i[n.getAttribute("name")||""]=o(r(n,"value"));for(const r of e(t,"SimpleData")){const t=r.getAttribute("name")||"",e=n[t]||B.string;i[t]=e(o(r))}return i}))}function C(t){const e=r(t,"description");for(const t of Array.from(e?.childNodes||[]))if(4===t.nodeType)return{description:{"@type":"html",value:o(t)}};return{}}function D(t){return i(t,"TimeSpan",(t=>({timespan:{begin:o(r(t,"begin")),end:o(r(t,"end"))}})))}function W(t){return i(t,"TimeStamp",(t=>({timestamp:o(r(t,"when"))})))}function H(t,e){return s(t,"styleUrl",(t=>(t=n(t),e[t]?Object.assign({styleUrl:t},e[t]):{styleUrl:t})))}const _=/\s*/g,I=/^\s*|\s*$/g,U=/\s+/;function V(t){return t.replace(_,"").split(",").map(parseFloat).filter((t=>!isNaN(t))).slice(0,3)}function $(t){return t.replace(I,"").split(U).map(V).filter((t=>t.length>=2))}function q(t){let n=e(t,"coord");var r,i,s;0===n.length&&(r=t,i="coord",s="*",n=Array.from(r.getElementsByTagNameNS(s,i)));const c=n.map((t=>o(t).split(" ").map(parseFloat)));return 0===c.length?null:{geometry:c.length>2?{type:"LineString",coordinates:c}:{type:"Point",coordinates:c[0]},times:e(t,"when").map((t=>o(t)))}}function z(t){if(0===t.length)return t;const e=t[0],n=t[t.length-1];let o=!0;for(let t=0;t<Math.max(e.length,n.length);t++)if(e[t]!==n[t]){o=!1;break}return o?t:t.concat([t[0]])}function J(t){return o(r(t,"coordinates"))}function Q(t){let n=[],o=[];for(let r=0;r<t.childNodes.length;r++){const i=t.childNodes.item(r);if(u(i))switch(i.tagName){case"MultiGeometry":case"MultiTrack":case"gx:MultiTrack":{const t=Q(i);n=n.concat(t.geometries),o=o.concat(t.coordTimes);break}case"Point":{const t=V(J(i));t.length>=2&&n.push({type:"Point",coordinates:t});break}case"LinearRing":case"LineString":{const t=$(J(i));t.length>=2&&n.push({type:"LineString",coordinates:t});break}case"Polygon":{const t=[];for(const n of e(i,"LinearRing")){const e=z($(J(n)));e.length>=4&&t.push(e)}t.length&&n.push({type:"Polygon",coordinates:t});break}case"Track":case"gx:Track":{const t=q(i);if(!t)break;const{times:e,geometry:r}=t;n.push(r),e.length&&o.push(e);break}}}return{geometries:n,coordTimes:o}}function K(t,e,n,o){const{coordTimes:r,geometries:i}=Q(t),s=function(t){return 0===t.length?null:1===t.length?t[0]:{type:"GeometryCollection",geometries:t}}(i);if(!s&&o.skipNullGeometry)return null;const c={type:"Feature",geometry:s,properties:Object.assign(l(t,["name","address","visibility","open","phoneNumber","description"]),C(t),H(t,e),G(t),E(t,n),D(t),W(t),r.length?{coordinateProperties:{times:1===r.length?r[0]:r}}:{})};void 0!==c.properties?.visibility&&(c.properties.visibility="0"!==c.properties.visibility);const a=t.getAttribute("id");return null!==a&&""!==a&&(c.id=a),c}function X(t){if(r(t,"gx:LatLonQuad")){return{geometry:{type:"Polygon",coordinates:[z($(J(t)))]}}}return function(t){const e=r(t,"LatLonBox");if(e){const t=a(e,"north"),n=a(e,"west"),o=a(e,"east"),r=a(e,"south"),i=a(e,"rotation");if("number"==typeof t&&"number"==typeof r&&"number"==typeof n&&"number"==typeof o){const e=[n,r,o,t];let s=[[[n,t],[o,t],[o,r],[n,r],[n,t]]];return"number"==typeof i&&(s=function(t,e,n){const o=[(t[0]+t[2])/2,(t[1]+t[3])/2];return[e[0].map((t=>{const e=t[1]-o[1],r=t[0]-o[0],i=Math.sqrt(Math.pow(e,2)+Math.pow(r,2)),s=Math.atan2(e,r)+n*Y;return[o[0]+Math.cos(s)*i,o[1]+Math.sin(s)*i]}))]}(e,s,i)),{bbox:e,geometry:{type:"Polygon",coordinates:s}}}}return null}(t)}const Y=Math.PI/180;function Z(t,e,n,o){const r=X(t),i=r?.geometry||null;if(!i&&o.skipNullGeometry)return null;const s={type:"Feature",geometry:i,properties:Object.assign({"@geometry-type":"groundoverlay"},l(t,["name","address","visibility","open","phoneNumber","description"]),C(t),H(t,e),G(t),L(t),E(t,n),D(t),W(t))};r?.bbox&&(s.bbox=r.bbox),void 0!==s.properties?.visibility&&(s.properties.visibility="0"!==s.properties.visibility);const c=t.getAttribute("id");return null!==c&&""!==c&&(s.id=c),s}function tt(t){let e=t.getAttribute("id");const o=t.parentNode;return!e&&u(o)&&"CascadingStyle"===o.localName&&(e=o.getAttribute("kml:id")||o.getAttribute("id")),n(e||"")}function et(t){const o={};for(const n of e(t,"Style"))o[tt(n)]=G(n);for(const r of e(t,"StyleMap")){const t=n(r.getAttribute("id")||"");s(r,"styleUrl",(e=>{e=n(e),o[e]&&(o[t]=o[e])}))}return o}function nt(t){const n={};for(const o of e(t,"SimpleField"))n[o.getAttribute("name")||""]=B[o.getAttribute("type")||""]||B.string;return n}const ot=["name","visibility","open","address","description","phoneNumber","visibility"];function*rt(t,n={skipNullGeometry:!1}){const o=et(t),r=nt(t);for(const i of e(t,"Placemark")){const t=K(i,o,r,n);t&&(yield t)}for(const i of e(t,"GroundOverlay")){const t=Z(i,o,r,n);t&&(yield t)}}t.gpx=function(t){return{type:"FeatureCollection",features:Array.from(k(t))}},t.gpxGen=k,t.kml=function(t,e={skipNullGeometry:!1}){return{type:"FeatureCollection",features:Array.from(rt(t,e))}},t.kmlGen=rt,t.kmlWithFolders=function(t,e={skipNullGeometry:!1}){const n=et(t),r=nt(t),i={type:"root",children:[]};return function t(e,i,s){if(u(e))switch(e.tagName){case"GroundOverlay":{const t=Z(e,n,r,s);t&&i.children.push(t);break}case"Placemark":{const t=K(e,n,r,s);t&&i.children.push(t);break}case"Folder":{const t=function(t){const e={};for(const n of Array.from(t.childNodes))u(n)&&ot.includes(n.tagName)&&(e[n.tagName]=o(n));return{type:"folder",meta:e,children:[]}}(e);i.children.push(t),i=t;break}}if(e.childNodes)for(let n=0;n<e.childNodes.length;n++)t(e.childNodes[n],i,s)}(t,i,e),i},t.tcx=function(t){return{type:"FeatureCollection",features:Array.from(O(t))}},t.tcxGen=O,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
2
|
+
//# sourceMappingURL=togeojson.umd.js.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{% extends "umap/content.html" %}
|
|
2
2
|
{% load i18n %}
|
|
3
3
|
{% block maincontent %}
|
|
4
|
-
<div class="
|
|
4
|
+
<div class="row">
|
|
5
5
|
<h2 class="section tabs">
|
|
6
|
-
<a href="{% url "user_dashboard" %}">{% trans "My
|
|
6
|
+
<a href="{% url "user_dashboard" %}">{% trans "My Maps" %}</a>
|
|
7
|
+
<a class="selected" href="{% url 'user_profile' %}">{% trans "My Profile" %}</a>
|
|
7
8
|
</h2>
|
|
8
9
|
</div>
|
|
9
10
|
<div class="wrapper">
|
umap/templates/base.html
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
content="{% trans "uMap lets you create maps with OpenStreetMap layers in a minute and embed them in your site." %}">
|
|
13
13
|
<meta name="keywords" content="map, umap">
|
|
14
14
|
{% block extra_head %}
|
|
15
|
+
{% include "umap/header.html" %}
|
|
15
16
|
{% endblock extra_head %}
|
|
16
17
|
<meta name="viewport"
|
|
17
18
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
|
@@ -1,37 +1,52 @@
|
|
|
1
|
-
{%
|
|
2
|
-
{%
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
{% extends "base.html" %}
|
|
2
|
+
{% load umap_tags i18n %}
|
|
3
|
+
{% block extra_head %}
|
|
4
|
+
{% umap_css %}
|
|
5
|
+
{{ block.super }}
|
|
6
|
+
{% endblock extra_head %}
|
|
7
|
+
{% block body_class %}
|
|
8
|
+
login
|
|
9
|
+
{% endblock body_class %}
|
|
10
|
+
{% block content %}
|
|
11
|
+
<section>
|
|
12
|
+
<header class="umap-nav">
|
|
13
|
+
{% include "umap/branding.html" %}
|
|
14
|
+
</header>
|
|
15
|
+
{% if ENABLE_ACCOUNT_LOGIN %}
|
|
16
|
+
<h2>{% trans "Please log in with your account" %}</h2>
|
|
17
|
+
<div>
|
|
18
|
+
{% if form.non_field_errors %}
|
|
19
|
+
<ul class="form-errors">
|
|
20
|
+
{% for error in form.non_field_errors %}<li>{{ error }}</li>{% endfor %}
|
|
21
|
+
</ul>
|
|
22
|
+
{% endif %}
|
|
23
|
+
<form id="login_form" action="{% url "login" %}" method="post">
|
|
24
|
+
{% csrf_token %}
|
|
25
|
+
{{ form.username.errors }}
|
|
26
|
+
<input type="text"
|
|
27
|
+
name="username"
|
|
28
|
+
placeholder="{% trans "Username" %}"
|
|
29
|
+
autofocus />
|
|
30
|
+
{{ form.password.errors }}
|
|
31
|
+
<input type="password" name="password" placeholder="{% trans "Password" %}" />
|
|
32
|
+
<input type="submit" value="{% trans "Login" %}" />
|
|
33
|
+
</form>
|
|
34
|
+
</div>
|
|
35
|
+
{% endif %}
|
|
36
|
+
{% if backends.backends|length %}
|
|
37
|
+
<h2>{% trans "Please choose a provider" %}</h2>
|
|
38
|
+
<div>
|
|
39
|
+
<ul class="login-grid block-grid">
|
|
40
|
+
{% for name in backends.backends %}
|
|
41
|
+
<li>
|
|
42
|
+
<a rel="nofollow"
|
|
43
|
+
href="{% url "social:begin" name %}"
|
|
44
|
+
class="umap-login-popup login-{{ name }}"
|
|
45
|
+
title="{{ name|title }}"></a>
|
|
46
|
+
</li>
|
|
47
|
+
{% endfor %}
|
|
8
48
|
</ul>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<input type="text"
|
|
14
|
-
name="username"
|
|
15
|
-
placeholder="{% trans "Username" %}"
|
|
16
|
-
autofocus />
|
|
17
|
-
{{ form.password.errors }}
|
|
18
|
-
<input type="password" name="password" placeholder="{% trans "Password" %}" />
|
|
19
|
-
<input type="submit" value="{% trans "Login" %}" />
|
|
20
|
-
</form>
|
|
21
|
-
</div>
|
|
22
|
-
{% endif %}
|
|
23
|
-
{% if backends.backends|length %}
|
|
24
|
-
<h5>{% trans "Please choose a provider" %}</h5>
|
|
25
|
-
<div>
|
|
26
|
-
<ul class="login-grid block-grid">
|
|
27
|
-
{% for name in backends.backends %}
|
|
28
|
-
<li>
|
|
29
|
-
<a rel="nofollow"
|
|
30
|
-
href="{% url "social:begin" name %}"
|
|
31
|
-
class="umap-login-popup login-{{ name }}"
|
|
32
|
-
title="{{ name|title }}"></a>
|
|
33
|
-
</li>
|
|
34
|
-
{% endfor %}
|
|
35
|
-
</ul>
|
|
36
|
-
</div>
|
|
37
|
-
{% endif %}
|
|
49
|
+
</div>
|
|
50
|
+
{% endif %}
|
|
51
|
+
</section>
|
|
52
|
+
{% endblock content %}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
{% spaceless %}
|
|
46
46
|
<div class="button-bar {% if demo_map %}half{% endif %}">
|
|
47
47
|
{% if not UMAP_READONLY %}
|
|
48
|
-
<a href="{% url 'map_new' %}" class="button half">{% trans "Create a map" %}</a>
|
|
48
|
+
<a href="{% url 'map_new' %}" class="button button-primary half">{% trans "Create a map" %}</a>
|
|
49
49
|
{% endif %}
|
|
50
50
|
{% if demo_map %}
|
|
51
51
|
<a href="{{ demo_map.get_absolute_url }}" class="button half neutral">{% trans "Play with the demo" %}</a>
|
umap/templates/umap/content.html
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
{% endblock body_class %}
|
|
6
6
|
{% block extra_head %}
|
|
7
7
|
{% umap_css %}
|
|
8
|
+
{{ block.super }}
|
|
8
9
|
{% umap_js %}
|
|
9
10
|
{% endblock extra_head %}
|
|
10
11
|
{% block header %}
|
|
@@ -36,51 +37,26 @@
|
|
|
36
37
|
{% block bottom_js %}
|
|
37
38
|
{{ block.super }}
|
|
38
39
|
<script type="text/javascript">
|
|
39
|
-
window.addEventListener('DOMContentLoaded',
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const xhr = new L.U.Xhr(ui)
|
|
44
|
-
const login = document.querySelector('a.login')
|
|
45
|
-
if (login) {
|
|
46
|
-
L.DomEvent.on(login, 'click', function (e) {
|
|
47
|
-
L.DomEvent.stop(e)
|
|
48
|
-
xhr.login({
|
|
49
|
-
login_required: this.getAttribute('href'),
|
|
50
|
-
redirect: '/',
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
const logout = document.querySelector('a.logout')
|
|
55
|
-
if (logout) {
|
|
56
|
-
L.DomEvent.on(logout, 'click', function (e) {
|
|
57
|
-
L.DomEvent.stop(e)
|
|
58
|
-
xhr.logout(this.getAttribute('href'))
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
const getMore = function (e) {
|
|
40
|
+
window.addEventListener('DOMContentLoaded', event => {
|
|
41
|
+
const ui = new U.UI(document.querySelector('header'))
|
|
42
|
+
const server = new U.ServerRequest(ui)
|
|
43
|
+
const getMore = async function (e) {
|
|
62
44
|
L.DomEvent.stop(e)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
context: this,
|
|
75
|
-
})
|
|
45
|
+
const [{html}, response, error] = await server.get(this.href)
|
|
46
|
+
if (!error) {
|
|
47
|
+
const container = this.parentNode
|
|
48
|
+
container.innerHTML = html
|
|
49
|
+
const more = document.querySelector('.more_button')
|
|
50
|
+
if (more) {
|
|
51
|
+
L.DomEvent.on(more, 'click', getMore, more)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
76
54
|
}
|
|
77
55
|
const more = document.querySelector('.more_button')
|
|
78
56
|
if (more) {
|
|
79
57
|
L.DomEvent.on(more, 'click', getMore, more)
|
|
80
58
|
}
|
|
81
|
-
})
|
|
82
|
-
}
|
|
83
|
-
))
|
|
59
|
+
})
|
|
84
60
|
</script>
|
|
85
61
|
{% endblock bottom_js %}
|
|
86
62
|
{% block footer %}
|
|
File without changes
|