umap-project 1.14.0a5__py3-none-any.whl → 2.0.0a1__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 -141
- 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/storage.py +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 -2
- 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 +23 -5
- 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_views.py +50 -11
- umap/urls.py +6 -12
- umap/views.py +170 -47
- {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a1.dist-info}/METADATA +13 -15
- {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a1.dist-info}/RECORD +212 -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.0a5.dist-info → umap_project-2.0.0a1.dist-info}/WHEEL +0 -0
- {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a1.dist-info}/entry_points.txt +0 -0
- {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a1.dist-info}/licenses/LICENSE +0 -0
umap/static/umap/test/Marker.js
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
describe('
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
describe('U.Marker', () => {
|
|
2
|
+
let map, datalayer
|
|
3
|
+
before(async () => {
|
|
4
|
+
const datalayer_response = JSON.parse(JSON.stringify(RESPONSES.datalayer62_GET)) // Copy.
|
|
5
5
|
datalayer_response._umap_options.iconClass = 'Drop'
|
|
6
|
-
|
|
7
|
-
this.
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
await fetchMock.mock(/\/datalayer\/62\/\?.*/, datalayer_response)
|
|
7
|
+
this.options = {
|
|
8
|
+
umap_id: 99,
|
|
9
|
+
}
|
|
10
|
+
MAP = map = initMap({ umap_id: 99 })
|
|
11
|
+
const datalayer_options = defaultDatalayerData()
|
|
12
|
+
await map.initDataLayers([datalayer_options])
|
|
13
|
+
datalayer = map.getDataLayerByUmapId(62)
|
|
10
14
|
})
|
|
11
|
-
after(
|
|
12
|
-
|
|
15
|
+
after(() => {
|
|
16
|
+
fetchMock.restore()
|
|
13
17
|
resetMap()
|
|
14
18
|
})
|
|
15
19
|
|
|
16
|
-
describe('#iconClassChange()',
|
|
17
|
-
it('should change icon class',
|
|
20
|
+
describe('#iconClassChange()', () => {
|
|
21
|
+
it('should change icon class', () => {
|
|
18
22
|
enableEdit()
|
|
19
23
|
happen.click(qs('div.umap-drop-icon'))
|
|
20
24
|
happen.click(qs('ul.leaflet-inplace-toolbar a.umap-toggle-edit'))
|
|
@@ -35,8 +39,8 @@ describe('L.U.Marker', function () {
|
|
|
35
39
|
})
|
|
36
40
|
})
|
|
37
41
|
|
|
38
|
-
describe('#iconSymbolChange()',
|
|
39
|
-
it('should change icon symbol',
|
|
42
|
+
describe('#iconSymbolChange()', () => {
|
|
43
|
+
it('should change icon symbol', () => {
|
|
40
44
|
enableEdit()
|
|
41
45
|
happen.click(qs('div.umap-drop-icon'))
|
|
42
46
|
happen.click(qs('ul.leaflet-inplace-toolbar a.umap-toggle-edit'))
|
|
@@ -58,8 +62,8 @@ describe('L.U.Marker', function () {
|
|
|
58
62
|
})
|
|
59
63
|
})
|
|
60
64
|
|
|
61
|
-
describe('#iconClassChange()',
|
|
62
|
-
it('should change icon class',
|
|
65
|
+
describe('#iconClassChange()', () => {
|
|
66
|
+
it('should change icon class', () => {
|
|
63
67
|
enableEdit()
|
|
64
68
|
happen.click(qs('div.umap-drop-icon'))
|
|
65
69
|
happen.click(qs('ul.leaflet-inplace-toolbar a.umap-toggle-edit'))
|
|
@@ -80,15 +84,15 @@ describe('L.U.Marker', function () {
|
|
|
80
84
|
})
|
|
81
85
|
})
|
|
82
86
|
|
|
83
|
-
describe('#clone',
|
|
84
|
-
it('should clone marker',
|
|
85
|
-
var layer = new
|
|
86
|
-
datalayer:
|
|
87
|
-
}).addTo(
|
|
88
|
-
assert.equal(
|
|
87
|
+
describe('#clone', () => {
|
|
88
|
+
it('should clone marker', () => {
|
|
89
|
+
var layer = new U.Marker(map, [10, 20], {
|
|
90
|
+
datalayer: datalayer,
|
|
91
|
+
}).addTo(datalayer)
|
|
92
|
+
assert.equal(datalayer._index.length, 4)
|
|
89
93
|
other = layer.clone()
|
|
90
|
-
assert.ok(
|
|
91
|
-
assert.equal(
|
|
94
|
+
assert.ok(map.hasLayer(other))
|
|
95
|
+
assert.equal(datalayer._index.length, 5)
|
|
92
96
|
// Must not be the same reference
|
|
93
97
|
assert.notEqual(layer._latlng, other._latlng)
|
|
94
98
|
assert.equal(L.Util.formatNum(layer._latlng.lat), other._latlng.lat)
|
|
@@ -97,20 +101,20 @@ describe('L.U.Marker', function () {
|
|
|
97
101
|
})
|
|
98
102
|
|
|
99
103
|
describe('#edit()', function (done) {
|
|
100
|
-
it('should allow changing coordinates manually',
|
|
101
|
-
var layer = new
|
|
102
|
-
datalayer:
|
|
103
|
-
}).addTo(
|
|
104
|
+
it('should allow changing coordinates manually', () => {
|
|
105
|
+
var layer = new U.Marker(map, [10, 20], {
|
|
106
|
+
datalayer: datalayer,
|
|
107
|
+
}).addTo(datalayer)
|
|
104
108
|
enableEdit()
|
|
105
109
|
layer.edit()
|
|
106
110
|
changeInputValue(qs('form.umap-form input[name="lat"]'), '54.43')
|
|
107
111
|
assert.equal(layer._latlng.lat, 54.43)
|
|
108
112
|
})
|
|
109
113
|
|
|
110
|
-
it('should not allow invalid latitude nor longitude',
|
|
111
|
-
var layer = new
|
|
112
|
-
datalayer:
|
|
113
|
-
}).addTo(
|
|
114
|
+
it('should not allow invalid latitude nor longitude', () => {
|
|
115
|
+
var layer = new U.Marker(map, [10, 20], {
|
|
116
|
+
datalayer: datalayer,
|
|
117
|
+
}).addTo(datalayer)
|
|
114
118
|
enableEdit()
|
|
115
119
|
layer.edit()
|
|
116
120
|
changeInputValue(qs('form.umap-form input[name="lat"]'), '5443')
|
umap/static/umap/test/Polygon.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
describe('
|
|
2
|
-
var p2ll, map
|
|
1
|
+
describe('U.Polygon', function () {
|
|
2
|
+
var p2ll, map, datalayer
|
|
3
3
|
|
|
4
4
|
before(function () {
|
|
5
|
-
|
|
5
|
+
map = initMap({ umap_id: 99 })
|
|
6
6
|
enableEdit()
|
|
7
7
|
p2ll = function (x, y) {
|
|
8
8
|
return map.containerPointToLatLng([x, y])
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
datalayer = map.createDataLayer()
|
|
11
|
+
datalayer.connectToMap()
|
|
12
12
|
})
|
|
13
13
|
|
|
14
14
|
after(function () {
|
|
@@ -17,32 +17,32 @@ describe('L.U.Polygon', function () {
|
|
|
17
17
|
})
|
|
18
18
|
|
|
19
19
|
afterEach(function () {
|
|
20
|
-
|
|
20
|
+
datalayer.empty()
|
|
21
21
|
})
|
|
22
22
|
|
|
23
23
|
describe('#isMulti()', function () {
|
|
24
24
|
it('should return false for basic Polygon', function () {
|
|
25
|
-
var layer = new
|
|
26
|
-
|
|
25
|
+
var layer = new U.Polygon(
|
|
26
|
+
map,
|
|
27
27
|
[
|
|
28
28
|
[1, 2],
|
|
29
29
|
[3, 4],
|
|
30
30
|
[5, 6],
|
|
31
31
|
],
|
|
32
|
-
{ datalayer:
|
|
32
|
+
{ datalayer: datalayer }
|
|
33
33
|
)
|
|
34
34
|
assert.notOk(layer.isMulti())
|
|
35
35
|
})
|
|
36
36
|
|
|
37
37
|
it('should return false for nested basic Polygon', function () {
|
|
38
38
|
var latlngs = [[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]],
|
|
39
|
-
layer = new
|
|
39
|
+
layer = new U.Polygon(map, latlngs, { datalayer: datalayer })
|
|
40
40
|
assert.notOk(layer.isMulti())
|
|
41
41
|
})
|
|
42
42
|
|
|
43
43
|
it('should return false for simple Polygon with hole', function () {
|
|
44
|
-
var layer = new
|
|
45
|
-
|
|
44
|
+
var layer = new U.Polygon(
|
|
45
|
+
map,
|
|
46
46
|
[
|
|
47
47
|
[
|
|
48
48
|
[1, 2],
|
|
@@ -55,7 +55,7 @@ describe('L.U.Polygon', function () {
|
|
|
55
55
|
[11, 12],
|
|
56
56
|
],
|
|
57
57
|
],
|
|
58
|
-
{ datalayer:
|
|
58
|
+
{ datalayer: datalayer }
|
|
59
59
|
)
|
|
60
60
|
assert.notOk(layer.isMulti())
|
|
61
61
|
})
|
|
@@ -77,7 +77,7 @@ describe('L.U.Polygon', function () {
|
|
|
77
77
|
],
|
|
78
78
|
],
|
|
79
79
|
]
|
|
80
|
-
var layer = new
|
|
80
|
+
var layer = new U.Polygon(map, latLngs, { datalayer: datalayer })
|
|
81
81
|
assert.ok(layer.isMulti())
|
|
82
82
|
})
|
|
83
83
|
|
|
@@ -103,7 +103,7 @@ describe('L.U.Polygon', function () {
|
|
|
103
103
|
],
|
|
104
104
|
],
|
|
105
105
|
]
|
|
106
|
-
var layer = new
|
|
106
|
+
var layer = new U.Polygon(map, latLngs, { datalayer: datalayer })
|
|
107
107
|
assert.ok(layer.isMulti())
|
|
108
108
|
})
|
|
109
109
|
})
|
|
@@ -120,27 +120,27 @@ describe('L.U.Polygon', function () {
|
|
|
120
120
|
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]],
|
|
121
121
|
[[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]],
|
|
122
122
|
],
|
|
123
|
-
layer = new
|
|
124
|
-
datalayer:
|
|
125
|
-
}).addTo(
|
|
123
|
+
layer = new U.Polygon(map, latlngs, {
|
|
124
|
+
datalayer: datalayer,
|
|
125
|
+
}).addTo(datalayer)
|
|
126
126
|
happen.once(layer._path, { type: 'contextmenu' })
|
|
127
127
|
assert.equal(qst('Remove shape from the multi'), 1)
|
|
128
128
|
})
|
|
129
129
|
|
|
130
130
|
it('should not allow to remove shape when not multi', function () {
|
|
131
131
|
var latlngs = [[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]],
|
|
132
|
-
layer = new
|
|
133
|
-
datalayer:
|
|
134
|
-
}).addTo(
|
|
132
|
+
layer = new U.Polygon(map, latlngs, {
|
|
133
|
+
datalayer: datalayer,
|
|
134
|
+
}).addTo(datalayer)
|
|
135
135
|
happen.once(layer._path, { type: 'contextmenu' })
|
|
136
136
|
assert.notOk(qst('Remove shape from the multi'))
|
|
137
137
|
})
|
|
138
138
|
|
|
139
139
|
it('should not allow to isolate shape when not multi', function () {
|
|
140
140
|
var latlngs = [[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]],
|
|
141
|
-
layer = new
|
|
142
|
-
datalayer:
|
|
143
|
-
}).addTo(
|
|
141
|
+
layer = new U.Polygon(map, latlngs, {
|
|
142
|
+
datalayer: datalayer,
|
|
143
|
+
}).addTo(datalayer)
|
|
144
144
|
happen.once(layer._path, { type: 'contextmenu' })
|
|
145
145
|
assert.notOk(qst('Extract shape to separate feature'))
|
|
146
146
|
})
|
|
@@ -150,9 +150,9 @@ describe('L.U.Polygon', function () {
|
|
|
150
150
|
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]],
|
|
151
151
|
[[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]],
|
|
152
152
|
],
|
|
153
|
-
layer = new
|
|
154
|
-
datalayer:
|
|
155
|
-
}).addTo(
|
|
153
|
+
layer = new U.Polygon(map, latlngs, {
|
|
154
|
+
datalayer: datalayer,
|
|
155
|
+
}).addTo(datalayer)
|
|
156
156
|
happen.once(layer._path, { type: 'contextmenu' })
|
|
157
157
|
assert.ok(qst('Extract shape to separate feature'))
|
|
158
158
|
})
|
|
@@ -162,9 +162,9 @@ describe('L.U.Polygon', function () {
|
|
|
162
162
|
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]],
|
|
163
163
|
[[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]],
|
|
164
164
|
],
|
|
165
|
-
layer = new
|
|
166
|
-
datalayer:
|
|
167
|
-
}).addTo(
|
|
165
|
+
layer = new U.Polygon(map, latlngs, {
|
|
166
|
+
datalayer: datalayer,
|
|
167
|
+
}).addTo(datalayer)
|
|
168
168
|
happen.once(layer._path, { type: 'contextmenu' })
|
|
169
169
|
assert.notOk(qst('Transform to lines'))
|
|
170
170
|
})
|
|
@@ -176,40 +176,40 @@ describe('L.U.Polygon', function () {
|
|
|
176
176
|
[p2ll(120, 150), p2ll(150, 180), p2ll(180, 120)],
|
|
177
177
|
],
|
|
178
178
|
],
|
|
179
|
-
layer = new
|
|
180
|
-
datalayer:
|
|
181
|
-
}).addTo(
|
|
179
|
+
layer = new U.Polygon(map, latlngs, {
|
|
180
|
+
datalayer: datalayer,
|
|
181
|
+
}).addTo(datalayer)
|
|
182
182
|
happen.once(layer._path, { type: 'contextmenu' })
|
|
183
183
|
assert.notOk(qst('Transform to lines'))
|
|
184
184
|
})
|
|
185
185
|
|
|
186
186
|
it('should allow to transform to lines when not multi', function () {
|
|
187
187
|
var latlngs = [[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]]
|
|
188
|
-
new
|
|
189
|
-
|
|
188
|
+
new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
|
|
189
|
+
datalayer
|
|
190
190
|
)
|
|
191
191
|
happen.at('contextmenu', 150, 150)
|
|
192
192
|
assert.equal(qst('Transform to lines'), 1)
|
|
193
193
|
})
|
|
194
194
|
|
|
195
195
|
it('should not allow to transfer shape when not editedFeature', function () {
|
|
196
|
-
new
|
|
197
|
-
datalayer:
|
|
198
|
-
}).addTo(
|
|
196
|
+
new U.Polygon(map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], {
|
|
197
|
+
datalayer: datalayer,
|
|
198
|
+
}).addTo(datalayer)
|
|
199
199
|
happen.at('contextmenu', 110, 160)
|
|
200
200
|
assert.equal(qst('Delete this feature'), 1) // Make sure we have right clicked on the polygon.
|
|
201
201
|
assert.notOk(qst('Transfer shape to edited feature'))
|
|
202
202
|
})
|
|
203
203
|
|
|
204
204
|
it('should not allow to transfer shape when editedFeature is not a polygon', function () {
|
|
205
|
-
var layer = new
|
|
206
|
-
|
|
205
|
+
var layer = new U.Polygon(
|
|
206
|
+
map,
|
|
207
207
|
[p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)],
|
|
208
|
-
{ datalayer:
|
|
209
|
-
).addTo(
|
|
210
|
-
other = new
|
|
211
|
-
datalayer:
|
|
212
|
-
}).addTo(
|
|
208
|
+
{ datalayer: datalayer }
|
|
209
|
+
).addTo(datalayer),
|
|
210
|
+
other = new U.Polyline(map, [p2ll(200, 250), p2ll(200, 300)], {
|
|
211
|
+
datalayer: datalayer,
|
|
212
|
+
}).addTo(datalayer)
|
|
213
213
|
other.edit()
|
|
214
214
|
happen.once(layer._path, { type: 'contextmenu' })
|
|
215
215
|
assert.equal(qst('Delete this feature'), 1) // Make sure we have right clicked on the polygon.
|
|
@@ -217,18 +217,18 @@ describe('L.U.Polygon', function () {
|
|
|
217
217
|
})
|
|
218
218
|
|
|
219
219
|
it('should allow to transfer shape when another polygon is edited', function () {
|
|
220
|
-
|
|
221
|
-
var layer = new
|
|
222
|
-
|
|
220
|
+
datalayer.empty()
|
|
221
|
+
var layer = new U.Polygon(
|
|
222
|
+
map,
|
|
223
223
|
[p2ll(200, 300), p2ll(300, 200), p2ll(200, 100)],
|
|
224
|
-
{ datalayer:
|
|
225
|
-
).addTo(
|
|
224
|
+
{ datalayer: datalayer }
|
|
225
|
+
).addTo(datalayer)
|
|
226
226
|
layer.edit() // This moves the map to put "other" at the center.
|
|
227
|
-
var other = new
|
|
228
|
-
|
|
227
|
+
var other = new U.Polygon(
|
|
228
|
+
map,
|
|
229
229
|
[p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)],
|
|
230
|
-
{ datalayer:
|
|
231
|
-
).addTo(
|
|
230
|
+
{ datalayer: datalayer }
|
|
231
|
+
).addTo(datalayer)
|
|
232
232
|
happen.once(other._path, { type: 'contextmenu' })
|
|
233
233
|
assert.equal(qst('Transfer shape to edited feature'), 1)
|
|
234
234
|
layer.remove()
|
|
@@ -242,19 +242,19 @@ describe('L.U.Polygon', function () {
|
|
|
242
242
|
})
|
|
243
243
|
|
|
244
244
|
it('"add shape" control should be visible when editing a Polygon', function () {
|
|
245
|
-
var layer = new
|
|
246
|
-
datalayer:
|
|
247
|
-
}).addTo(
|
|
245
|
+
var layer = new U.Polygon(map, [p2ll(100, 100), p2ll(100, 200)], {
|
|
246
|
+
datalayer: datalayer,
|
|
247
|
+
}).addTo(datalayer)
|
|
248
248
|
layer.edit()
|
|
249
249
|
assert.ok(qs('.umap-draw-polygon-multi'))
|
|
250
250
|
})
|
|
251
251
|
|
|
252
252
|
it('"add shape" control should extend the same multi', function () {
|
|
253
|
-
var layer = new
|
|
254
|
-
|
|
253
|
+
var layer = new U.Polygon(
|
|
254
|
+
map,
|
|
255
255
|
[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)],
|
|
256
|
-
{ datalayer:
|
|
257
|
-
).addTo(
|
|
256
|
+
{ datalayer: datalayer }
|
|
257
|
+
).addTo(datalayer)
|
|
258
258
|
layer.edit()
|
|
259
259
|
assert.notOk(layer.isMulti())
|
|
260
260
|
happen.click(qs('.umap-draw-polygon-multi'))
|
|
@@ -264,26 +264,26 @@ describe('L.U.Polygon', function () {
|
|
|
264
264
|
happen.at('click', 350, 300)
|
|
265
265
|
happen.at('click', 350, 300)
|
|
266
266
|
assert.ok(layer.isMulti())
|
|
267
|
-
assert.equal(
|
|
267
|
+
assert.equal(datalayer._index.length, 1)
|
|
268
268
|
})
|
|
269
269
|
})
|
|
270
270
|
|
|
271
271
|
describe('#transferShape', function () {
|
|
272
272
|
it('should transfer simple polygon shape to another polygon', function () {
|
|
273
273
|
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
274
|
-
layer = new
|
|
275
|
-
|
|
274
|
+
layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
|
|
275
|
+
datalayer
|
|
276
276
|
),
|
|
277
|
-
other = new
|
|
278
|
-
|
|
277
|
+
other = new U.Polygon(
|
|
278
|
+
map,
|
|
279
279
|
[p2ll(200, 350), p2ll(200, 300), p2ll(300, 200)],
|
|
280
|
-
{ datalayer:
|
|
281
|
-
).addTo(
|
|
282
|
-
assert.ok(
|
|
280
|
+
{ datalayer: datalayer }
|
|
281
|
+
).addTo(datalayer)
|
|
282
|
+
assert.ok(map.hasLayer(layer))
|
|
283
283
|
layer.transferShape(p2ll(150, 150), other)
|
|
284
284
|
assert.equal(other._latlngs.length, 2)
|
|
285
285
|
assert.deepEqual(other._latlngs[1][0], latlngs)
|
|
286
|
-
assert.notOk(
|
|
286
|
+
assert.notOk(map.hasLayer(layer))
|
|
287
287
|
})
|
|
288
288
|
|
|
289
289
|
it('should transfer multipolygon shape to another polygon', function () {
|
|
@@ -294,19 +294,19 @@ describe('L.U.Polygon', function () {
|
|
|
294
294
|
],
|
|
295
295
|
[[p2ll(200, 300), p2ll(300, 200)]],
|
|
296
296
|
],
|
|
297
|
-
layer = new
|
|
298
|
-
|
|
297
|
+
layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
|
|
298
|
+
datalayer
|
|
299
299
|
),
|
|
300
|
-
other = new
|
|
301
|
-
|
|
300
|
+
other = new U.Polygon(
|
|
301
|
+
map,
|
|
302
302
|
[p2ll(200, 350), p2ll(200, 300), p2ll(300, 200)],
|
|
303
|
-
{ datalayer:
|
|
304
|
-
).addTo(
|
|
305
|
-
assert.ok(
|
|
303
|
+
{ datalayer: datalayer }
|
|
304
|
+
).addTo(datalayer)
|
|
305
|
+
assert.ok(map.hasLayer(layer))
|
|
306
306
|
layer.transferShape(p2ll(150, 150), other)
|
|
307
307
|
assert.equal(other._latlngs.length, 2)
|
|
308
308
|
assert.deepEqual(other._latlngs[1][0], latlngs[0][0])
|
|
309
|
-
assert.ok(
|
|
309
|
+
assert.ok(map.hasLayer(layer))
|
|
310
310
|
assert.equal(layer._latlngs.length, 1)
|
|
311
311
|
})
|
|
312
312
|
})
|
|
@@ -314,14 +314,14 @@ describe('L.U.Polygon', function () {
|
|
|
314
314
|
describe('#isolateShape', function () {
|
|
315
315
|
it('should not allow to isolate simple polygon', function () {
|
|
316
316
|
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
317
|
-
layer = new
|
|
318
|
-
|
|
317
|
+
layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
|
|
318
|
+
datalayer
|
|
319
319
|
)
|
|
320
|
-
assert.equal(
|
|
321
|
-
assert.ok(
|
|
320
|
+
assert.equal(datalayer._index.length, 1)
|
|
321
|
+
assert.ok(map.hasLayer(layer))
|
|
322
322
|
layer.isolateShape(p2ll(150, 150))
|
|
323
323
|
assert.equal(layer._latlngs[0].length, 3)
|
|
324
|
-
assert.equal(
|
|
324
|
+
assert.equal(datalayer._index.length, 1)
|
|
325
325
|
})
|
|
326
326
|
|
|
327
327
|
it('should isolate multipolygon shape', function () {
|
|
@@ -332,17 +332,17 @@ describe('L.U.Polygon', function () {
|
|
|
332
332
|
],
|
|
333
333
|
[[p2ll(200, 300), p2ll(300, 200)]],
|
|
334
334
|
],
|
|
335
|
-
layer = new
|
|
336
|
-
|
|
335
|
+
layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
|
|
336
|
+
datalayer
|
|
337
337
|
)
|
|
338
|
-
assert.equal(
|
|
339
|
-
assert.ok(
|
|
338
|
+
assert.equal(datalayer._index.length, 1)
|
|
339
|
+
assert.ok(map.hasLayer(layer))
|
|
340
340
|
var other = layer.isolateShape(p2ll(150, 150))
|
|
341
|
-
assert.equal(
|
|
341
|
+
assert.equal(datalayer._index.length, 2)
|
|
342
342
|
assert.equal(other._latlngs.length, 2)
|
|
343
343
|
assert.deepEqual(other._latlngs[0], latlngs[0][0])
|
|
344
|
-
assert.ok(
|
|
345
|
-
assert.ok(
|
|
344
|
+
assert.ok(map.hasLayer(layer))
|
|
345
|
+
assert.ok(map.hasLayer(other))
|
|
346
346
|
assert.equal(layer._latlngs.length, 1)
|
|
347
347
|
other.remove()
|
|
348
348
|
})
|
|
@@ -351,13 +351,13 @@ describe('L.U.Polygon', function () {
|
|
|
351
351
|
describe('#clone', function () {
|
|
352
352
|
it('should clone polygon', function () {
|
|
353
353
|
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
354
|
-
layer = new
|
|
355
|
-
|
|
354
|
+
layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
|
|
355
|
+
datalayer
|
|
356
356
|
)
|
|
357
|
-
assert.equal(
|
|
357
|
+
assert.equal(datalayer._index.length, 1)
|
|
358
358
|
other = layer.clone()
|
|
359
|
-
assert.ok(
|
|
360
|
-
assert.equal(
|
|
359
|
+
assert.ok(map.hasLayer(other))
|
|
360
|
+
assert.equal(datalayer._index.length, 2)
|
|
361
361
|
// Must not be the same reference
|
|
362
362
|
assert.notEqual(layer._latlngs, other._latlngs)
|
|
363
363
|
assert.equal(L.Util.formatNum(layer._latlngs[0][0].lat), other._latlngs[0][0].lat)
|