umap-project 2.9.2__py3-none-any.whl → 3.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of umap-project might be problematic. Click here for more details.
- umap/__init__.py +1 -1
- umap/context_processors.py +1 -0
- umap/forms.py +1 -2
- umap/locale/de/LC_MESSAGES/django.mo +0 -0
- umap/locale/de/LC_MESSAGES/django.po +218 -96
- umap/locale/en/LC_MESSAGES/django.po +131 -55
- umap/locale/et/LC_MESSAGES/django.mo +0 -0
- umap/locale/et/LC_MESSAGES/django.po +175 -130
- umap/locale/eu/LC_MESSAGES/django.mo +0 -0
- umap/locale/eu/LC_MESSAGES/django.po +117 -72
- umap/locale/fr/LC_MESSAGES/django.mo +0 -0
- umap/locale/fr/LC_MESSAGES/django.po +132 -56
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/hu/LC_MESSAGES/django.po +209 -88
- umap/locale/is/LC_MESSAGES/django.mo +0 -0
- umap/locale/is/LC_MESSAGES/django.po +296 -175
- umap/middleware.py +2 -1
- umap/migrations/0027_map_tags.py +23 -0
- umap/models.py +13 -2
- umap/settings/base.py +23 -5
- umap/static/umap/base.css +41 -8
- umap/static/umap/content.css +72 -37
- umap/static/umap/css/bar.css +43 -21
- umap/static/umap/css/dialog.css +4 -1
- umap/static/umap/css/form.css +40 -27
- umap/static/umap/css/icon.css +11 -1
- umap/static/umap/css/importers.css +7 -0
- umap/static/umap/img/16-white.svg +23 -2
- umap/static/umap/img/16.svg +1 -1
- umap/static/umap/img/24.svg +4 -4
- umap/static/umap/img/home.svg +7 -0
- umap/static/umap/img/importers/banfr.svg +1 -0
- umap/static/umap/img/marker.svg +2 -5
- umap/static/umap/img/source/16-white.svg +24 -3
- umap/static/umap/img/source/16.svg +1 -1
- umap/static/umap/img/source/24.svg +5 -5
- umap/static/umap/img/target.svg +1 -0
- umap/static/umap/js/components/alerts/alert.js +0 -1
- umap/static/umap/js/modules/browser.js +4 -4
- umap/static/umap/js/modules/caption.js +1 -1
- umap/static/umap/js/modules/data/features.js +25 -25
- umap/static/umap/js/modules/data/layer.js +91 -97
- umap/static/umap/js/modules/facets.js +9 -5
- umap/static/umap/js/modules/form/builder.js +21 -29
- umap/static/umap/js/modules/form/fields.js +40 -14
- umap/static/umap/js/modules/formatter.js +1 -1
- umap/static/umap/js/modules/global.js +9 -5
- umap/static/umap/js/modules/help.js +18 -5
- umap/static/umap/js/modules/importer.js +5 -2
- umap/static/umap/js/modules/importers/banfr.js +93 -0
- umap/static/umap/js/modules/importers/cadastrefr.js +2 -2
- umap/static/umap/js/modules/importers/communesfr.js +1 -1
- umap/static/umap/js/modules/permissions.js +20 -10
- umap/static/umap/js/modules/rendering/icon.js +15 -2
- umap/static/umap/js/modules/rendering/layers/classified.js +7 -7
- umap/static/umap/js/modules/rendering/layers/cluster.js +2 -2
- umap/static/umap/js/modules/rendering/layers/heat.js +4 -4
- umap/static/umap/js/modules/rendering/map.js +14 -6
- umap/static/umap/js/modules/rendering/popup.js +2 -2
- umap/static/umap/js/modules/rendering/template.js +3 -3
- umap/static/umap/js/modules/rendering/ui.js +17 -11
- umap/static/umap/js/modules/rules.js +13 -16
- umap/static/umap/js/modules/schema.js +23 -1
- umap/static/umap/js/modules/share.js +1 -1
- umap/static/umap/js/modules/slideshow.js +1 -0
- umap/static/umap/js/modules/sync/engine.js +141 -19
- umap/static/umap/js/modules/sync/undo.js +101 -0
- umap/static/umap/js/modules/sync/updaters.js +51 -28
- umap/static/umap/js/modules/tableeditor.js +1 -1
- umap/static/umap/js/modules/ui/bar.js +61 -21
- umap/static/umap/js/modules/ui/tooltip.js +1 -1
- umap/static/umap/js/modules/umap.js +190 -176
- umap/static/umap/js/modules/utils.js +30 -4
- umap/static/umap/js/umap.controls.js +82 -38
- umap/static/umap/locale/am_ET.js +13 -7
- umap/static/umap/locale/am_ET.json +13 -7
- umap/static/umap/locale/ar.js +13 -7
- umap/static/umap/locale/ar.json +13 -7
- umap/static/umap/locale/ast.js +13 -7
- umap/static/umap/locale/ast.json +13 -7
- umap/static/umap/locale/bg.js +13 -7
- umap/static/umap/locale/bg.json +13 -7
- umap/static/umap/locale/br.js +13 -8
- umap/static/umap/locale/br.json +13 -8
- umap/static/umap/locale/ca.js +13 -7
- umap/static/umap/locale/ca.json +13 -7
- umap/static/umap/locale/cs_CZ.js +26 -20
- umap/static/umap/locale/cs_CZ.json +26 -20
- umap/static/umap/locale/da.js +13 -7
- umap/static/umap/locale/da.json +13 -7
- umap/static/umap/locale/de.js +47 -41
- umap/static/umap/locale/de.json +47 -41
- umap/static/umap/locale/el.js +13 -7
- umap/static/umap/locale/el.json +13 -7
- umap/static/umap/locale/en.js +12 -7
- umap/static/umap/locale/en.json +12 -7
- umap/static/umap/locale/en_US.json +13 -7
- umap/static/umap/locale/es.js +19 -13
- umap/static/umap/locale/es.json +19 -13
- umap/static/umap/locale/et.js +13 -7
- umap/static/umap/locale/et.json +13 -7
- umap/static/umap/locale/eu.js +43 -37
- umap/static/umap/locale/eu.json +43 -37
- umap/static/umap/locale/fa_IR.js +13 -7
- umap/static/umap/locale/fa_IR.json +13 -7
- umap/static/umap/locale/fi.js +13 -7
- umap/static/umap/locale/fi.json +13 -7
- umap/static/umap/locale/fr.js +12 -7
- umap/static/umap/locale/fr.json +12 -7
- umap/static/umap/locale/gl.js +19 -13
- umap/static/umap/locale/gl.json +19 -13
- umap/static/umap/locale/he.js +13 -7
- umap/static/umap/locale/he.json +13 -7
- umap/static/umap/locale/hr.js +13 -7
- umap/static/umap/locale/hr.json +13 -7
- umap/static/umap/locale/hu.js +25 -19
- umap/static/umap/locale/hu.json +25 -19
- umap/static/umap/locale/id.js +13 -7
- umap/static/umap/locale/id.json +13 -7
- umap/static/umap/locale/is.js +151 -145
- umap/static/umap/locale/is.json +151 -145
- umap/static/umap/locale/it.js +13 -7
- umap/static/umap/locale/it.json +13 -7
- umap/static/umap/locale/ja.js +13 -7
- umap/static/umap/locale/ja.json +13 -7
- umap/static/umap/locale/ko.js +13 -7
- umap/static/umap/locale/ko.json +13 -7
- umap/static/umap/locale/lt.js +13 -7
- umap/static/umap/locale/lt.json +13 -7
- umap/static/umap/locale/ms.js +13 -7
- umap/static/umap/locale/ms.json +13 -7
- umap/static/umap/locale/nl.js +12 -7
- umap/static/umap/locale/nl.json +12 -7
- umap/static/umap/locale/no.js +13 -7
- umap/static/umap/locale/no.json +13 -7
- umap/static/umap/locale/pl.js +13 -7
- umap/static/umap/locale/pl.json +13 -7
- umap/static/umap/locale/pl_PL.json +13 -7
- umap/static/umap/locale/pt.js +12 -7
- umap/static/umap/locale/pt.json +12 -7
- umap/static/umap/locale/pt_BR.js +13 -7
- umap/static/umap/locale/pt_BR.json +13 -7
- umap/static/umap/locale/pt_PT.js +13 -7
- umap/static/umap/locale/pt_PT.json +13 -7
- umap/static/umap/locale/ro.js +13 -7
- umap/static/umap/locale/ro.json +13 -7
- umap/static/umap/locale/ru.js +13 -7
- umap/static/umap/locale/ru.json +13 -7
- umap/static/umap/locale/sk_SK.js +13 -7
- umap/static/umap/locale/sk_SK.json +13 -7
- umap/static/umap/locale/sl.js +13 -7
- umap/static/umap/locale/sl.json +13 -7
- umap/static/umap/locale/sr.js +13 -7
- umap/static/umap/locale/sr.json +13 -7
- umap/static/umap/locale/sv.js +13 -7
- umap/static/umap/locale/sv.json +13 -7
- umap/static/umap/locale/th_TH.js +13 -7
- umap/static/umap/locale/th_TH.json +13 -7
- umap/static/umap/locale/tr.js +13 -7
- umap/static/umap/locale/tr.json +13 -7
- umap/static/umap/locale/uk_UA.js +13 -7
- umap/static/umap/locale/uk_UA.json +13 -7
- umap/static/umap/locale/vi.js +13 -7
- umap/static/umap/locale/vi.json +13 -7
- umap/static/umap/locale/vi_VN.json +13 -7
- umap/static/umap/locale/zh.js +13 -7
- umap/static/umap/locale/zh.json +13 -7
- umap/static/umap/locale/zh_CN.json +13 -7
- umap/static/umap/locale/zh_TW.Big5.json +13 -7
- umap/static/umap/locale/zh_TW.js +19 -13
- umap/static/umap/locale/zh_TW.json +19 -13
- umap/static/umap/map.css +58 -28
- umap/static/umap/unittests/sync.js +0 -57
- umap/static/umap/unittests/utils.js +47 -0
- umap/static/umap/vars.css +5 -2
- umap/static/umap/vendors/photon/leaflet.photon.js +3 -0
- umap/sync/payloads.py +3 -2
- umap/templates/auth/user_detail.html +1 -1
- umap/templates/auth/user_stars.html +1 -1
- umap/templates/umap/content.html +17 -12
- umap/templates/umap/home.html +7 -5
- umap/templates/umap/map_fragment.html +1 -1
- umap/templates/umap/map_list.html +20 -13
- umap/templates/umap/search.html +7 -3
- umap/templates/umap/search_bar.html +13 -11
- umap/templates/umap/team_detail.html +1 -1
- umap/tests/base.py +2 -1
- umap/tests/fixtures/remote_data.umap +55 -0
- umap/tests/fixtures/test_upload_data_with_iconurl.umap +122 -0
- umap/tests/integration/test_browser.py +1 -3
- umap/tests/integration/test_conditional_rules.py +3 -0
- umap/tests/integration/test_edit_datalayer.py +2 -7
- umap/tests/integration/test_edit_map.py +15 -0
- umap/tests/integration/test_edit_polygon.py +1 -2
- umap/tests/integration/test_import.py +59 -2
- umap/tests/integration/test_optimistic_merge.py +4 -3
- umap/tests/integration/test_owned_map.py +0 -1
- umap/tests/integration/test_save.py +2 -4
- umap/tests/integration/test_undo_redo.py +267 -0
- umap/tests/integration/test_websocket_sync.py +78 -11
- umap/tests/settings.py +1 -3
- umap/tests/test_datalayer_s3.py +1 -0
- umap/tests/test_map_views.py +1 -0
- umap/tests/test_views.py +34 -0
- umap/utils.py +1 -1
- umap/views.py +23 -2
- {umap_project-2.9.2.dist-info → umap_project-3.0.0.dist-info}/METADATA +13 -12
- {umap_project-2.9.2.dist-info → umap_project-3.0.0.dist-info}/RECORD +211 -213
- umap/static/umap/js/modules/saving.js +0 -52
- umap/static/umap/test/.eslintrc +0 -21
- umap/static/umap/test/DataLayer.js +0 -463
- umap/static/umap/test/Feature.js +0 -131
- umap/static/umap/test/Map.js +0 -37
- umap/static/umap/test/Marker.js +0 -126
- umap/static/umap/test/Polygon.js +0 -111
- umap/static/umap/test/Polyline.js +0 -286
- umap/static/umap/test/Util.js +0 -28
- umap/static/umap/test/_pre.js +0 -455
- umap/static/umap/test/index.html +0 -139
- {umap_project-2.9.2.dist-info → umap_project-3.0.0.dist-info}/WHEEL +0 -0
- {umap_project-2.9.2.dist-info → umap_project-3.0.0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.9.2.dist-info → umap_project-3.0.0.dist-info}/licenses/LICENSE +0 -0
umap/static/umap/test/Marker.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
describe('U.Marker', () => {
|
|
2
|
-
let map, datalayer
|
|
3
|
-
before(async () => {
|
|
4
|
-
const datalayer_response = JSON.parse(JSON.stringify(RESPONSES.datalayer62_GET)) // Copy.
|
|
5
|
-
datalayer_response._umap_options.iconClass = 'Drop'
|
|
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)
|
|
14
|
-
})
|
|
15
|
-
after(() => {
|
|
16
|
-
fetchMock.restore()
|
|
17
|
-
resetMap()
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
describe('#iconClassChange()', () => {
|
|
21
|
-
it('should change icon class', () => {
|
|
22
|
-
enableEdit()
|
|
23
|
-
happen.click(qs('div.umap-drop-icon'))
|
|
24
|
-
happen.click(qs('ul.leaflet-inplace-toolbar a.umap-toggle-edit'))
|
|
25
|
-
changeSelectValue(
|
|
26
|
-
qs(
|
|
27
|
-
'form#umap-feature-shape-properties .umap-field-iconClass select[name=iconClass]'
|
|
28
|
-
),
|
|
29
|
-
'Circle'
|
|
30
|
-
)
|
|
31
|
-
assert.notOk(qs('div.umap-drop-icon'))
|
|
32
|
-
assert.ok(qs('div.umap-circle-icon'))
|
|
33
|
-
happen.click(
|
|
34
|
-
qs('form#umap-feature-shape-properties .umap-field-iconClass .undefine')
|
|
35
|
-
)
|
|
36
|
-
assert.notOk(qs('div.umap-circle-icon'))
|
|
37
|
-
assert.ok(qs('div.umap-drop-icon'))
|
|
38
|
-
clickCancel()
|
|
39
|
-
})
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
describe('#iconSymbolChange()', () => {
|
|
43
|
-
it('should change icon symbol', () => {
|
|
44
|
-
enableEdit()
|
|
45
|
-
happen.click(qs('div.umap-drop-icon'))
|
|
46
|
-
happen.click(qs('ul.leaflet-inplace-toolbar a.umap-toggle-edit'))
|
|
47
|
-
changeInputValue(
|
|
48
|
-
qs(
|
|
49
|
-
'form#umap-feature-shape-properties .umap-field-iconUrl input[name=iconUrl]'
|
|
50
|
-
),
|
|
51
|
-
'1'
|
|
52
|
-
)
|
|
53
|
-
assert.equal(qs('div.umap-drop-icon span').textContent, '1')
|
|
54
|
-
changeInputValue(
|
|
55
|
-
qs(
|
|
56
|
-
'form#umap-feature-shape-properties .umap-field-iconUrl input[name=iconUrl]'
|
|
57
|
-
),
|
|
58
|
-
'{name}'
|
|
59
|
-
)
|
|
60
|
-
assert.equal(qs('div.umap-drop-icon span').textContent, 'test')
|
|
61
|
-
clickCancel()
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
describe('#iconClassChange()', () => {
|
|
66
|
-
it('should change icon class', () => {
|
|
67
|
-
enableEdit()
|
|
68
|
-
happen.click(qs('div.umap-drop-icon'))
|
|
69
|
-
happen.click(qs('ul.leaflet-inplace-toolbar a.umap-toggle-edit'))
|
|
70
|
-
changeSelectValue(
|
|
71
|
-
qs(
|
|
72
|
-
'form#umap-feature-shape-properties .umap-field-iconClass select[name=iconClass]'
|
|
73
|
-
),
|
|
74
|
-
'Circle'
|
|
75
|
-
)
|
|
76
|
-
assert.notOk(qs('div.umap-drop-icon'))
|
|
77
|
-
assert.ok(qs('div.umap-circle-icon'))
|
|
78
|
-
happen.click(
|
|
79
|
-
qs('form#umap-feature-shape-properties .umap-field-iconClass .undefine')
|
|
80
|
-
)
|
|
81
|
-
assert.notOk(qs('div.umap-circle-icon'))
|
|
82
|
-
assert.ok(qs('div.umap-drop-icon'))
|
|
83
|
-
clickCancel()
|
|
84
|
-
})
|
|
85
|
-
})
|
|
86
|
-
|
|
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)
|
|
93
|
-
other = layer.clone()
|
|
94
|
-
assert.ok(map.hasLayer(other))
|
|
95
|
-
assert.equal(datalayer._index.length, 5)
|
|
96
|
-
// Must not be the same reference
|
|
97
|
-
assert.notEqual(layer._latlng, other._latlng)
|
|
98
|
-
assert.equal(L.Util.formatNum(layer._latlng.lat), other._latlng.lat)
|
|
99
|
-
assert.equal(L.Util.formatNum(layer._latlng.lng), other._latlng.lng)
|
|
100
|
-
})
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
describe('#edit()', function (done) {
|
|
104
|
-
it('should allow changing coordinates manually', () => {
|
|
105
|
-
var layer = new U.Marker(map, [10, 20], {
|
|
106
|
-
datalayer: datalayer,
|
|
107
|
-
}).addTo(datalayer)
|
|
108
|
-
enableEdit()
|
|
109
|
-
layer.edit()
|
|
110
|
-
changeInputValue(qs('form.umap-form input[name="lat"]'), '54.43')
|
|
111
|
-
assert.equal(layer._latlng.lat, 54.43)
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
it('should not allow invalid latitude nor longitude', () => {
|
|
115
|
-
var layer = new U.Marker(map, [10, 20], {
|
|
116
|
-
datalayer: datalayer,
|
|
117
|
-
}).addTo(datalayer)
|
|
118
|
-
enableEdit()
|
|
119
|
-
layer.edit()
|
|
120
|
-
changeInputValue(qs('form.umap-form input[name="lat"]'), '5443')
|
|
121
|
-
assert.equal(layer._latlng.lat, 10)
|
|
122
|
-
changeInputValue(qs('form.umap-form input[name="lng"]'), '5443')
|
|
123
|
-
assert.equal(layer._latlng.lng, 20)
|
|
124
|
-
})
|
|
125
|
-
})
|
|
126
|
-
})
|
umap/static/umap/test/Polygon.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
describe('U.Polygon', function () {
|
|
2
|
-
var p2ll, map, datalayer
|
|
3
|
-
|
|
4
|
-
before(function () {
|
|
5
|
-
map = initMap({ umap_id: 99 })
|
|
6
|
-
enableEdit()
|
|
7
|
-
p2ll = function (x, y) {
|
|
8
|
-
return map.containerPointToLatLng([x, y])
|
|
9
|
-
}
|
|
10
|
-
datalayer = map.createDataLayer()
|
|
11
|
-
datalayer.connectToMap()
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
after(function () {
|
|
15
|
-
clickCancel()
|
|
16
|
-
resetMap()
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
afterEach(function () {
|
|
20
|
-
datalayer.empty()
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
describe('#isMulti()', function () {
|
|
24
|
-
it('should return false for basic Polygon', function () {
|
|
25
|
-
var layer = new U.Polygon(
|
|
26
|
-
map,
|
|
27
|
-
[
|
|
28
|
-
[1, 2],
|
|
29
|
-
[3, 4],
|
|
30
|
-
[5, 6],
|
|
31
|
-
],
|
|
32
|
-
{ datalayer: datalayer }
|
|
33
|
-
)
|
|
34
|
-
assert.notOk(layer.isMulti())
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('should return false for nested basic Polygon', function () {
|
|
38
|
-
var latlngs = [[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]],
|
|
39
|
-
layer = new U.Polygon(map, latlngs, { datalayer: datalayer })
|
|
40
|
-
assert.notOk(layer.isMulti())
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
it('should return false for simple Polygon with hole', function () {
|
|
44
|
-
var layer = new U.Polygon(
|
|
45
|
-
map,
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
-
[1, 2],
|
|
49
|
-
[3, 4],
|
|
50
|
-
[5, 6],
|
|
51
|
-
],
|
|
52
|
-
[
|
|
53
|
-
[7, 8],
|
|
54
|
-
[9, 10],
|
|
55
|
-
[11, 12],
|
|
56
|
-
],
|
|
57
|
-
],
|
|
58
|
-
{ datalayer: datalayer }
|
|
59
|
-
)
|
|
60
|
-
assert.notOk(layer.isMulti())
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('should return true for multi Polygon', function () {
|
|
64
|
-
var latLngs = [
|
|
65
|
-
[
|
|
66
|
-
[
|
|
67
|
-
[1, 2],
|
|
68
|
-
[3, 4],
|
|
69
|
-
[5, 6],
|
|
70
|
-
],
|
|
71
|
-
],
|
|
72
|
-
[
|
|
73
|
-
[
|
|
74
|
-
[7, 8],
|
|
75
|
-
[9, 10],
|
|
76
|
-
[11, 12],
|
|
77
|
-
],
|
|
78
|
-
],
|
|
79
|
-
]
|
|
80
|
-
var layer = new U.Polygon(map, latLngs, { datalayer: datalayer })
|
|
81
|
-
assert.ok(layer.isMulti())
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
it('should return true for multi Polygon with hole', function () {
|
|
85
|
-
var latLngs = [
|
|
86
|
-
[
|
|
87
|
-
[
|
|
88
|
-
[10, 20],
|
|
89
|
-
[30, 40],
|
|
90
|
-
[50, 60],
|
|
91
|
-
],
|
|
92
|
-
],
|
|
93
|
-
[
|
|
94
|
-
[
|
|
95
|
-
[0, 10],
|
|
96
|
-
[10, 10],
|
|
97
|
-
[10, 0],
|
|
98
|
-
],
|
|
99
|
-
[
|
|
100
|
-
[2, 3],
|
|
101
|
-
[2, 4],
|
|
102
|
-
[3, 4],
|
|
103
|
-
],
|
|
104
|
-
],
|
|
105
|
-
]
|
|
106
|
-
var layer = new U.Polygon(map, latLngs, { datalayer: datalayer })
|
|
107
|
-
assert.ok(layer.isMulti())
|
|
108
|
-
})
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
})
|
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
describe('U.Polyline', function () {
|
|
2
|
-
var p2ll, map
|
|
3
|
-
|
|
4
|
-
before(function () {
|
|
5
|
-
this.map = map = initMap({ umap_id: 99 })
|
|
6
|
-
enableEdit()
|
|
7
|
-
p2ll = function (x, y) {
|
|
8
|
-
return map.containerPointToLatLng([x, y])
|
|
9
|
-
}
|
|
10
|
-
this.datalayer = this.map.createDataLayer()
|
|
11
|
-
this.datalayer.connectToMap()
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
after(function () {
|
|
15
|
-
clickCancel()
|
|
16
|
-
resetMap()
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
afterEach(function () {
|
|
20
|
-
this.datalayer.empty()
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
describe('#isMulti()', function () {
|
|
24
|
-
it('should return false for basic Polyline', function () {
|
|
25
|
-
var layer = new U.Polyline(
|
|
26
|
-
this.map,
|
|
27
|
-
[
|
|
28
|
-
[1, 2],
|
|
29
|
-
[3, 4],
|
|
30
|
-
[5, 6],
|
|
31
|
-
],
|
|
32
|
-
{ datalayer: this.datalayer }
|
|
33
|
-
)
|
|
34
|
-
assert.notOk(layer.isMulti())
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('should return false for nested basic Polyline', function () {
|
|
38
|
-
var layer = new U.Polyline(
|
|
39
|
-
this.map,
|
|
40
|
-
[
|
|
41
|
-
[
|
|
42
|
-
[1, 2],
|
|
43
|
-
[3, 4],
|
|
44
|
-
[5, 6],
|
|
45
|
-
],
|
|
46
|
-
],
|
|
47
|
-
{ datalayer: this.datalayer }
|
|
48
|
-
)
|
|
49
|
-
assert.notOk(layer.isMulti())
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
it('should return true for multi Polyline', function () {
|
|
53
|
-
var latLngs = [
|
|
54
|
-
[
|
|
55
|
-
[
|
|
56
|
-
[1, 2],
|
|
57
|
-
[3, 4],
|
|
58
|
-
[5, 6],
|
|
59
|
-
],
|
|
60
|
-
],
|
|
61
|
-
[
|
|
62
|
-
[
|
|
63
|
-
[7, 8],
|
|
64
|
-
[9, 10],
|
|
65
|
-
[11, 12],
|
|
66
|
-
],
|
|
67
|
-
],
|
|
68
|
-
]
|
|
69
|
-
var layer = new U.Polyline(this.map, latLngs, { datalayer: this.datalayer })
|
|
70
|
-
assert.ok(layer.isMulti())
|
|
71
|
-
})
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
describe('#contextmenu', function () {
|
|
75
|
-
afterEach(function () {
|
|
76
|
-
// Make sure contextmenu is hidden.
|
|
77
|
-
happen.once(document, { type: 'keydown', keyCode: 27 })
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
describe('#in edit mode', function () {
|
|
81
|
-
it('should allow to remove shape when multi', function () {
|
|
82
|
-
var latlngs = [
|
|
83
|
-
[p2ll(100, 100), p2ll(100, 200)],
|
|
84
|
-
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)],
|
|
85
|
-
],
|
|
86
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
87
|
-
datalayer: this.datalayer,
|
|
88
|
-
}).addTo(this.datalayer)
|
|
89
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
90
|
-
assert.equal(qst('Remove shape from the multi'), 1)
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
it('should not allow to remove shape when not multi', function () {
|
|
94
|
-
var latlngs = [[p2ll(100, 100), p2ll(100, 200)]],
|
|
95
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
96
|
-
datalayer: this.datalayer,
|
|
97
|
-
}).addTo(this.datalayer)
|
|
98
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
99
|
-
assert.notOk(qst('Remove shape from the multi'))
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
it('should not allow to isolate shape when not multi', function () {
|
|
103
|
-
var latlngs = [[p2ll(100, 100), p2ll(100, 200)]],
|
|
104
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
105
|
-
datalayer: this.datalayer,
|
|
106
|
-
}).addTo(this.datalayer)
|
|
107
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
108
|
-
assert.notOk(qst('Extract shape to separate feature'))
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
it('should allow to isolate shape when multi', function () {
|
|
112
|
-
var latlngs = [
|
|
113
|
-
[p2ll(100, 150), p2ll(100, 200)],
|
|
114
|
-
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)],
|
|
115
|
-
],
|
|
116
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
117
|
-
datalayer: this.datalayer,
|
|
118
|
-
}).addTo(this.datalayer)
|
|
119
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
120
|
-
assert.ok(qst('Extract shape to separate feature'))
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
it('should not allow to transform to polygon when multi', function () {
|
|
124
|
-
var latlngs = [
|
|
125
|
-
[p2ll(100, 150), p2ll(100, 200)],
|
|
126
|
-
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)],
|
|
127
|
-
],
|
|
128
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
129
|
-
datalayer: this.datalayer,
|
|
130
|
-
}).addTo(this.datalayer)
|
|
131
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
132
|
-
assert.notOk(qst('Transform to polygon'))
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
it('should allow to transform to polygon when not multi', function () {
|
|
136
|
-
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
137
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
138
|
-
datalayer: this.datalayer,
|
|
139
|
-
}).addTo(this.datalayer)
|
|
140
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
141
|
-
assert.equal(qst('Transform to polygon'), 1)
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
it('should not allow to transfer shape when not editedFeature', function () {
|
|
145
|
-
var layer = new U.Polyline(this.map, [p2ll(100, 150), p2ll(100, 200)], {
|
|
146
|
-
datalayer: this.datalayer,
|
|
147
|
-
}).addTo(this.datalayer)
|
|
148
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
149
|
-
assert.notOk(qst('Transfer shape to edited feature'))
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
it('should not allow to transfer shape when editedFeature is not a line', function () {
|
|
153
|
-
var layer = new U.Polyline(this.map, [p2ll(100, 150), p2ll(100, 200)], {
|
|
154
|
-
datalayer: this.datalayer,
|
|
155
|
-
}).addTo(this.datalayer),
|
|
156
|
-
other = new U.Polygon(
|
|
157
|
-
this.map,
|
|
158
|
-
[p2ll(200, 300), p2ll(300, 200), p2ll(200, 100)],
|
|
159
|
-
{ datalayer: this.datalayer }
|
|
160
|
-
).addTo(this.datalayer)
|
|
161
|
-
other.edit()
|
|
162
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
163
|
-
assert.notOk(qst('Transfer shape to edited feature'))
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
it('should allow to transfer shape when another line is edited', function () {
|
|
167
|
-
var layer = new U.Polyline(
|
|
168
|
-
this.map,
|
|
169
|
-
[p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
170
|
-
{ datalayer: this.datalayer }
|
|
171
|
-
).addTo(this.datalayer),
|
|
172
|
-
other = new U.Polyline(this.map, [p2ll(200, 300), p2ll(300, 200)], {
|
|
173
|
-
datalayer: this.datalayer,
|
|
174
|
-
}).addTo(this.datalayer)
|
|
175
|
-
other.edit()
|
|
176
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
177
|
-
assert.equal(qst('Transfer shape to edited feature'), 1)
|
|
178
|
-
other.remove()
|
|
179
|
-
layer.remove()
|
|
180
|
-
})
|
|
181
|
-
|
|
182
|
-
it('should allow to merge lines when multi', function () {
|
|
183
|
-
var latlngs = [
|
|
184
|
-
[p2ll(100, 100), p2ll(100, 200)],
|
|
185
|
-
[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)],
|
|
186
|
-
],
|
|
187
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
188
|
-
datalayer: this.datalayer,
|
|
189
|
-
}).addTo(this.datalayer)
|
|
190
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
191
|
-
assert.equal(qst('Merge lines'), 1)
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
it('should not allow to merge lines when not multi', function () {
|
|
195
|
-
var latlngs = [[p2ll(100, 100), p2ll(100, 200)]],
|
|
196
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
197
|
-
datalayer: this.datalayer,
|
|
198
|
-
}).addTo(this.datalayer)
|
|
199
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
200
|
-
assert.notOk(qst('Merge lines'))
|
|
201
|
-
})
|
|
202
|
-
|
|
203
|
-
it('should allow to split lines when clicking on vertex', function () {
|
|
204
|
-
var latlngs = [[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]],
|
|
205
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
206
|
-
datalayer: this.datalayer,
|
|
207
|
-
}).addTo(this.datalayer)
|
|
208
|
-
layer.enableEdit()
|
|
209
|
-
happen.at('contextmenu', 350, 400)
|
|
210
|
-
assert.equal(qst('Split line'), 1)
|
|
211
|
-
})
|
|
212
|
-
|
|
213
|
-
it('should not allow to split lines when clicking on first vertex', function () {
|
|
214
|
-
var latlngs = [[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]],
|
|
215
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
216
|
-
datalayer: this.datalayer,
|
|
217
|
-
}).addTo(this.datalayer)
|
|
218
|
-
layer.enableEdit()
|
|
219
|
-
happen.at('contextmenu', 300, 350)
|
|
220
|
-
assert.equal(qst('Delete this feature'), 1) // Make sure we have clicked on the vertex.
|
|
221
|
-
assert.notOk(qst('Split line'))
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
it('should not allow to split lines when clicking on last vertex', function () {
|
|
225
|
-
var latlngs = [[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]],
|
|
226
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
227
|
-
datalayer: this.datalayer,
|
|
228
|
-
}).addTo(this.datalayer)
|
|
229
|
-
layer.enableEdit()
|
|
230
|
-
happen.at('contextmenu', 400, 300)
|
|
231
|
-
assert.equal(qst('Delete this feature'), 1) // Make sure we have clicked on the vertex.
|
|
232
|
-
assert.notOk(qst('Split line'))
|
|
233
|
-
})
|
|
234
|
-
})
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
describe('#mergeShapes', function () {
|
|
238
|
-
it('should remove duplicated join point when merging', function () {
|
|
239
|
-
var latlngs = [
|
|
240
|
-
[
|
|
241
|
-
[0, 0],
|
|
242
|
-
[0, 1],
|
|
243
|
-
],
|
|
244
|
-
[
|
|
245
|
-
[0, 1],
|
|
246
|
-
[0, 2],
|
|
247
|
-
],
|
|
248
|
-
],
|
|
249
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
250
|
-
datalayer: this.datalayer,
|
|
251
|
-
}).addTo(this.datalayer)
|
|
252
|
-
layer.mergeShapes()
|
|
253
|
-
layer.disableEdit() // Remove vertex from latlngs to compare them.
|
|
254
|
-
assert.deepEqual(layer.getLatLngs(), [
|
|
255
|
-
L.latLng([0, 0]),
|
|
256
|
-
L.latLng([0, 1]),
|
|
257
|
-
L.latLng([0, 2]),
|
|
258
|
-
])
|
|
259
|
-
assert(this.map.isDirty)
|
|
260
|
-
})
|
|
261
|
-
|
|
262
|
-
it('should revert candidate if first point is closer', function () {
|
|
263
|
-
var latlngs = [
|
|
264
|
-
[
|
|
265
|
-
[0, 0],
|
|
266
|
-
[0, 1],
|
|
267
|
-
],
|
|
268
|
-
[
|
|
269
|
-
[0, 2],
|
|
270
|
-
[0, 1],
|
|
271
|
-
],
|
|
272
|
-
],
|
|
273
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
274
|
-
datalayer: this.datalayer,
|
|
275
|
-
}).addTo(this.datalayer)
|
|
276
|
-
layer.mergeShapes()
|
|
277
|
-
layer.disableEdit()
|
|
278
|
-
assert.deepEqual(layer.getLatLngs(), [
|
|
279
|
-
L.latLng([0, 0]),
|
|
280
|
-
L.latLng([0, 1]),
|
|
281
|
-
L.latLng([0, 2]),
|
|
282
|
-
])
|
|
283
|
-
})
|
|
284
|
-
})
|
|
285
|
-
|
|
286
|
-
})
|
umap/static/umap/test/Util.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
describe('L.Util', function () {
|
|
2
|
-
describe('#TextColorFromBackgroundColor', function () {
|
|
3
|
-
it('should output white for black', function () {
|
|
4
|
-
document.body.style.backgroundColor = 'black'
|
|
5
|
-
assert.equal(L.DomUtil.TextColorFromBackgroundColor(document.body), '#ffffff')
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
it('should output white for brown', function () {
|
|
9
|
-
document.body.style.backgroundColor = 'brown'
|
|
10
|
-
assert.equal(L.DomUtil.TextColorFromBackgroundColor(document.body), '#ffffff')
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('should output black for white', function () {
|
|
14
|
-
document.body.style.backgroundColor = 'white'
|
|
15
|
-
assert.equal(L.DomUtil.TextColorFromBackgroundColor(document.body), '#000000')
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
it('should output black for tan', function () {
|
|
19
|
-
document.body.style.backgroundColor = 'tan'
|
|
20
|
-
assert.equal(L.DomUtil.TextColorFromBackgroundColor(document.body), '#000000')
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
it('should output black by default', function () {
|
|
24
|
-
document.body.style.backgroundColor = 'transparent'
|
|
25
|
-
assert.equal(L.DomUtil.TextColorFromBackgroundColor(document.body), '#000000')
|
|
26
|
-
})
|
|
27
|
-
})
|
|
28
|
-
})
|