umap-project 2.1.2__py3-none-any.whl → 2.2.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/locale/br/LC_MESSAGES/django.mo +0 -0
- umap/locale/en/LC_MESSAGES/django.po +32 -32
- umap/locale/hu/LC_MESSAGES/django.mo +0 -0
- umap/locale/it/LC_MESSAGES/django.mo +0 -0
- umap/locale/ms/LC_MESSAGES/django.mo +0 -0
- umap/migrations/0020_alter_tilelayer_url_template.py +19 -0
- umap/migrations/0021_remove_map_description.py +16 -0
- umap/models.py +10 -6
- umap/settings/base.py +1 -0
- umap/static/umap/base.css +43 -156
- umap/static/umap/content.css +7 -25
- umap/static/umap/css/icon.css +112 -0
- umap/static/umap/css/panel.css +140 -0
- umap/static/umap/img/16-white.svg +5 -1
- umap/static/umap/img/16.svg +7 -4
- umap/static/umap/img/24-white.svg +3 -1
- umap/static/umap/img/24.svg +3 -4
- umap/static/umap/img/source/16-white.svg +176 -940
- umap/static/umap/img/source/16.svg +8 -5
- umap/static/umap/img/source/24-white.svg +5 -3
- umap/static/umap/img/source/24.svg +6 -7
- umap/static/umap/js/modules/browser.js +97 -73
- umap/static/umap/js/modules/dompurify.js +12 -0
- umap/static/umap/js/modules/facets.js +149 -0
- umap/static/umap/js/modules/global.js +9 -1
- umap/static/umap/js/modules/i18n.js +7 -0
- umap/static/umap/js/modules/orderable.js +84 -0
- umap/static/umap/js/modules/panel.js +76 -0
- umap/static/umap/js/modules/request.js +0 -1
- umap/static/umap/js/modules/schema.js +324 -223
- umap/static/umap/js/modules/urls.js +1 -16
- umap/static/umap/js/modules/utils.js +340 -0
- umap/static/umap/js/umap.autocomplete.js +40 -25
- umap/static/umap/js/umap.controls.js +248 -361
- umap/static/umap/js/umap.core.js +77 -366
- umap/static/umap/js/umap.datalayer.permissions.js +1 -1
- umap/static/umap/js/umap.features.js +65 -43
- umap/static/umap/js/umap.forms.js +128 -36
- umap/static/umap/js/umap.icon.js +11 -4
- umap/static/umap/js/umap.importer.js +78 -58
- umap/static/umap/js/umap.js +206 -192
- umap/static/umap/js/umap.layer.js +86 -46
- umap/static/umap/js/umap.permissions.js +13 -9
- umap/static/umap/js/umap.popup.js +26 -30
- umap/static/umap/js/umap.share.js +12 -9
- umap/static/umap/js/umap.tableeditor.js +4 -6
- umap/static/umap/js/umap.ui.js +10 -60
- umap/static/umap/locale/am_ET.js +243 -227
- umap/static/umap/locale/am_ET.json +21 -9
- umap/static/umap/locale/ar.js +243 -227
- umap/static/umap/locale/ar.json +21 -9
- umap/static/umap/locale/ast.js +243 -227
- umap/static/umap/locale/ast.json +21 -9
- umap/static/umap/locale/bg.js +243 -227
- umap/static/umap/locale/bg.json +21 -9
- umap/static/umap/locale/br.js +253 -237
- umap/static/umap/locale/br.json +25 -13
- umap/static/umap/locale/ca.js +243 -227
- umap/static/umap/locale/ca.json +21 -9
- umap/static/umap/locale/cs_CZ.js +243 -227
- umap/static/umap/locale/cs_CZ.json +21 -9
- umap/static/umap/locale/da.js +243 -227
- umap/static/umap/locale/da.json +21 -9
- umap/static/umap/locale/de.js +243 -227
- umap/static/umap/locale/de.json +21 -9
- umap/static/umap/locale/el.js +243 -227
- umap/static/umap/locale/el.json +21 -9
- umap/static/umap/locale/en.js +243 -234
- umap/static/umap/locale/en.json +22 -10
- umap/static/umap/locale/en_US.json +21 -9
- umap/static/umap/locale/es.js +243 -227
- umap/static/umap/locale/es.json +21 -9
- umap/static/umap/locale/et.js +243 -227
- umap/static/umap/locale/et.json +21 -9
- umap/static/umap/locale/eu.js +227 -199
- umap/static/umap/locale/eu.json +1 -1
- umap/static/umap/locale/fa_IR.js +243 -227
- umap/static/umap/locale/fa_IR.json +21 -9
- umap/static/umap/locale/fi.js +243 -227
- umap/static/umap/locale/fi.json +21 -9
- umap/static/umap/locale/fr.js +243 -234
- umap/static/umap/locale/fr.json +21 -9
- umap/static/umap/locale/gl.js +243 -227
- umap/static/umap/locale/gl.json +21 -9
- umap/static/umap/locale/he.js +243 -227
- umap/static/umap/locale/he.json +21 -9
- umap/static/umap/locale/hr.js +243 -227
- umap/static/umap/locale/hr.json +21 -9
- umap/static/umap/locale/hu.js +243 -234
- umap/static/umap/locale/hu.json +21 -9
- umap/static/umap/locale/id.js +243 -227
- umap/static/umap/locale/id.json +21 -9
- umap/static/umap/locale/is.js +243 -227
- umap/static/umap/locale/is.json +21 -9
- umap/static/umap/locale/it.js +243 -234
- umap/static/umap/locale/it.json +21 -9
- umap/static/umap/locale/ja.js +243 -227
- umap/static/umap/locale/ja.json +21 -9
- umap/static/umap/locale/ko.js +243 -227
- umap/static/umap/locale/ko.json +21 -9
- umap/static/umap/locale/lt.js +243 -227
- umap/static/umap/locale/lt.json +21 -9
- umap/static/umap/locale/ms.js +243 -234
- umap/static/umap/locale/ms.json +22 -10
- umap/static/umap/locale/nl.js +246 -230
- umap/static/umap/locale/nl.json +21 -9
- umap/static/umap/locale/no.js +243 -227
- umap/static/umap/locale/no.json +21 -9
- umap/static/umap/locale/pl.js +243 -227
- umap/static/umap/locale/pl.json +21 -9
- umap/static/umap/locale/pl_PL.json +21 -9
- umap/static/umap/locale/pt.js +243 -227
- umap/static/umap/locale/pt.json +21 -9
- umap/static/umap/locale/pt_BR.js +243 -227
- umap/static/umap/locale/pt_BR.json +21 -9
- umap/static/umap/locale/pt_PT.js +243 -227
- umap/static/umap/locale/pt_PT.json +21 -9
- umap/static/umap/locale/ro.js +243 -227
- umap/static/umap/locale/ro.json +21 -9
- umap/static/umap/locale/ru.js +243 -227
- umap/static/umap/locale/ru.json +21 -9
- umap/static/umap/locale/si.js +1 -1
- umap/static/umap/locale/si.json +1 -1
- umap/static/umap/locale/sk_SK.js +243 -227
- umap/static/umap/locale/sk_SK.json +21 -9
- umap/static/umap/locale/sl.js +243 -227
- umap/static/umap/locale/sl.json +21 -9
- umap/static/umap/locale/sr.js +243 -227
- umap/static/umap/locale/sr.json +21 -9
- umap/static/umap/locale/sv.js +243 -227
- umap/static/umap/locale/sv.json +21 -9
- umap/static/umap/locale/th_TH.js +243 -227
- umap/static/umap/locale/th_TH.json +21 -9
- umap/static/umap/locale/tr.js +243 -227
- umap/static/umap/locale/tr.json +21 -9
- umap/static/umap/locale/uk_UA.js +243 -227
- umap/static/umap/locale/uk_UA.json +21 -9
- umap/static/umap/locale/vi.js +243 -227
- umap/static/umap/locale/vi.json +21 -9
- umap/static/umap/locale/vi_VN.json +21 -9
- umap/static/umap/locale/zh.js +243 -227
- umap/static/umap/locale/zh.json +21 -9
- umap/static/umap/locale/zh_CN.json +21 -9
- umap/static/umap/locale/zh_TW.Big5.json +21 -9
- umap/static/umap/locale/zh_TW.js +243 -234
- umap/static/umap/locale/zh_TW.json +21 -9
- umap/static/umap/map.css +124 -264
- umap/static/umap/test/DataLayer.js +1 -1
- umap/static/umap/test/Feature.js +0 -226
- umap/static/umap/test/Map.js +0 -304
- umap/static/umap/test/Polygon.js +0 -256
- umap/static/umap/test/Polyline.js +0 -116
- umap/static/umap/test/TableEditor.js +10 -10
- umap/static/umap/test/Util.js +0 -521
- umap/static/umap/test/index.html +1 -5
- umap/static/umap/unittests/URLs.js +1 -1
- umap/static/umap/unittests/utils.js +610 -0
- umap/static/umap/vars.css +9 -0
- umap/static/umap/vendors/dompurify/purify.es.mjs +1525 -0
- umap/static/umap/vendors/formbuilder/Leaflet.FormBuilder.js +1 -0
- umap/static/umap/vendors/iconlayers/iconLayers.js +1 -1
- umap/templates/umap/css.html +2 -0
- umap/templates/umap/js.html +0 -1
- umap/templates/umap/map_detail.html +4 -0
- umap/templates/umap/map_table.html +12 -10
- umap/templatetags/umap_tags.py +5 -0
- umap/tests/conftest.py +9 -0
- umap/tests/fixtures/test_upload_data.csv +2 -1
- umap/tests/fixtures/test_upload_data.umap +171 -0
- umap/tests/fixtures/test_upload_data_osm.json +33 -0
- umap/tests/integration/conftest.py +16 -0
- umap/tests/integration/test_anonymous_owned_map.py +30 -5
- umap/tests/integration/test_basics.py +21 -0
- umap/tests/integration/test_browser.py +16 -36
- umap/tests/integration/test_choropleth.py +89 -0
- umap/tests/integration/test_collaborative_editing.py +30 -1
- umap/tests/integration/test_dashboard.py +10 -0
- umap/tests/integration/test_datalayer.py +132 -0
- umap/tests/integration/test_draw_polygon.py +363 -0
- umap/tests/integration/test_draw_polyline.py +325 -0
- umap/tests/integration/test_edit_datalayer.py +145 -6
- umap/tests/integration/test_edit_map.py +202 -0
- umap/tests/integration/test_edit_marker.py +120 -0
- umap/tests/integration/test_edit_polygon.py +122 -0
- umap/tests/integration/test_facets_browser.py +132 -11
- umap/tests/integration/test_import.py +407 -10
- umap/tests/integration/test_map.py +36 -54
- umap/tests/integration/test_map_list.py +28 -0
- umap/tests/integration/test_owned_map.py +24 -6
- umap/tests/integration/test_picto.py +25 -38
- umap/tests/integration/test_querystring.py +9 -15
- umap/tests/integration/test_slideshow.py +0 -5
- umap/tests/integration/test_statics.py +3 -2
- umap/tests/integration/test_tableeditor.py +23 -0
- umap/tests/integration/test_tilelayer.py +10 -0
- umap/tests/integration/test_view_marker.py +64 -0
- umap/tests/integration/test_view_polygon.py +59 -0
- umap/tests/integration/test_view_polyline.py +51 -0
- umap/tests/test_map_views.py +13 -0
- {umap_project-2.1.2.dist-info → umap_project-2.2.0.dist-info}/METADATA +12 -12
- {umap_project-2.1.2.dist-info → umap_project-2.2.0.dist-info}/RECORD +206 -187
- {umap_project-2.1.2.dist-info → umap_project-2.2.0.dist-info}/WHEEL +1 -1
- umap/static/umap/test/Choropleth.js +0 -245
- umap/static/umap/test/Permissions.js +0 -74
- umap/static/umap/vendors/dompurify/purify.min.js +0 -3
- umap/static/umap/vendors/dompurify/purify.min.js.map +0 -1
- umap/tests/integration/test_drawing.py +0 -243
- {umap_project-2.1.2.dist-info → umap_project-2.2.0.dist-info}/entry_points.txt +0 -0
- {umap_project-2.1.2.dist-info → umap_project-2.2.0.dist-info}/licenses/LICENSE +0 -0
umap/static/umap/test/Polygon.js
CHANGED
|
@@ -108,260 +108,4 @@ describe('U.Polygon', function () {
|
|
|
108
108
|
})
|
|
109
109
|
})
|
|
110
110
|
|
|
111
|
-
describe('#contextmenu', function () {
|
|
112
|
-
afterEach(function () {
|
|
113
|
-
// Make sure contextmenu is hidden
|
|
114
|
-
happen.once(document, { type: 'keydown', keyCode: 27 })
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
describe('#in edit mode', function () {
|
|
118
|
-
it('should allow to remove shape when multi', function () {
|
|
119
|
-
var latlngs = [
|
|
120
|
-
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]],
|
|
121
|
-
[[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]],
|
|
122
|
-
],
|
|
123
|
-
layer = new U.Polygon(map, latlngs, {
|
|
124
|
-
datalayer: datalayer,
|
|
125
|
-
}).addTo(datalayer)
|
|
126
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
127
|
-
assert.equal(qst('Remove shape from the multi'), 1)
|
|
128
|
-
})
|
|
129
|
-
|
|
130
|
-
it('should not allow to remove shape when not multi', function () {
|
|
131
|
-
var latlngs = [[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]],
|
|
132
|
-
layer = new U.Polygon(map, latlngs, {
|
|
133
|
-
datalayer: datalayer,
|
|
134
|
-
}).addTo(datalayer)
|
|
135
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
136
|
-
assert.notOk(qst('Remove shape from the multi'))
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
it('should not allow to isolate shape when not multi', function () {
|
|
140
|
-
var latlngs = [[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]],
|
|
141
|
-
layer = new U.Polygon(map, latlngs, {
|
|
142
|
-
datalayer: datalayer,
|
|
143
|
-
}).addTo(datalayer)
|
|
144
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
145
|
-
assert.notOk(qst('Extract shape to separate feature'))
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
it('should allow to isolate shape when multi', function () {
|
|
149
|
-
var latlngs = [
|
|
150
|
-
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]],
|
|
151
|
-
[[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]],
|
|
152
|
-
],
|
|
153
|
-
layer = new U.Polygon(map, latlngs, {
|
|
154
|
-
datalayer: datalayer,
|
|
155
|
-
}).addTo(datalayer)
|
|
156
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
157
|
-
assert.ok(qst('Extract shape to separate feature'))
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
it('should not allow to transform to lines when multi', function () {
|
|
161
|
-
var latlngs = [
|
|
162
|
-
[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]],
|
|
163
|
-
[[p2ll(300, 350), p2ll(350, 400), p2ll(400, 300)]],
|
|
164
|
-
],
|
|
165
|
-
layer = new U.Polygon(map, latlngs, {
|
|
166
|
-
datalayer: datalayer,
|
|
167
|
-
}).addTo(datalayer)
|
|
168
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
169
|
-
assert.notOk(qst('Transform to lines'))
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
it('should not allow to transform to lines when hole', function () {
|
|
173
|
-
var latlngs = [
|
|
174
|
-
[
|
|
175
|
-
[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)],
|
|
176
|
-
[p2ll(120, 150), p2ll(150, 180), p2ll(180, 120)],
|
|
177
|
-
],
|
|
178
|
-
],
|
|
179
|
-
layer = new U.Polygon(map, latlngs, {
|
|
180
|
-
datalayer: datalayer,
|
|
181
|
-
}).addTo(datalayer)
|
|
182
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
183
|
-
assert.notOk(qst('Transform to lines'))
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
it('should allow to transform to lines when not multi', function () {
|
|
187
|
-
var latlngs = [[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]]
|
|
188
|
-
new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
|
|
189
|
-
datalayer
|
|
190
|
-
)
|
|
191
|
-
happen.at('contextmenu', 150, 150)
|
|
192
|
-
assert.equal(qst('Transform to lines'), 1)
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
it('should not allow to transfer shape when not editedFeature', function () {
|
|
196
|
-
new U.Polygon(map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], {
|
|
197
|
-
datalayer: datalayer,
|
|
198
|
-
}).addTo(datalayer)
|
|
199
|
-
happen.at('contextmenu', 110, 160)
|
|
200
|
-
assert.equal(qst('Delete this feature'), 1) // Make sure we have right clicked on the polygon.
|
|
201
|
-
assert.notOk(qst('Transfer shape to edited feature'))
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
it('should not allow to transfer shape when editedFeature is not a polygon', function () {
|
|
205
|
-
var layer = new U.Polygon(
|
|
206
|
-
map,
|
|
207
|
-
[p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)],
|
|
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
|
-
other.edit()
|
|
214
|
-
happen.once(layer._path, { type: 'contextmenu' })
|
|
215
|
-
assert.equal(qst('Delete this feature'), 1) // Make sure we have right clicked on the polygon.
|
|
216
|
-
assert.notOk(qst('Transfer shape to edited feature'))
|
|
217
|
-
})
|
|
218
|
-
|
|
219
|
-
it('should allow to transfer shape when another polygon is edited', function () {
|
|
220
|
-
datalayer.empty()
|
|
221
|
-
var layer = new U.Polygon(
|
|
222
|
-
map,
|
|
223
|
-
[p2ll(200, 300), p2ll(300, 200), p2ll(200, 100)],
|
|
224
|
-
{ datalayer: datalayer }
|
|
225
|
-
).addTo(datalayer)
|
|
226
|
-
layer.edit() // This moves the map to put "other" at the center.
|
|
227
|
-
var other = new U.Polygon(
|
|
228
|
-
map,
|
|
229
|
-
[p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)],
|
|
230
|
-
{ datalayer: datalayer }
|
|
231
|
-
).addTo(datalayer)
|
|
232
|
-
happen.once(other._path, { type: 'contextmenu' })
|
|
233
|
-
assert.equal(qst('Transfer shape to edited feature'), 1)
|
|
234
|
-
layer.remove()
|
|
235
|
-
})
|
|
236
|
-
})
|
|
237
|
-
})
|
|
238
|
-
|
|
239
|
-
describe('#addShape', function () {
|
|
240
|
-
it('"add shape" control should not be visible by default', function () {
|
|
241
|
-
assert.notOk(qs('.umap-draw-polygon-multi'))
|
|
242
|
-
})
|
|
243
|
-
|
|
244
|
-
it('"add shape" control should be visible when editing a Polygon', function () {
|
|
245
|
-
var layer = new U.Polygon(map, [p2ll(100, 100), p2ll(100, 200)], {
|
|
246
|
-
datalayer: datalayer,
|
|
247
|
-
}).addTo(datalayer)
|
|
248
|
-
layer.edit()
|
|
249
|
-
assert.ok(qs('.umap-draw-polygon-multi'))
|
|
250
|
-
})
|
|
251
|
-
|
|
252
|
-
it('"add shape" control should extend the same multi', function () {
|
|
253
|
-
var layer = new U.Polygon(
|
|
254
|
-
map,
|
|
255
|
-
[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)],
|
|
256
|
-
{ datalayer: datalayer }
|
|
257
|
-
).addTo(datalayer)
|
|
258
|
-
layer.edit()
|
|
259
|
-
assert.notOk(layer.isMulti())
|
|
260
|
-
happen.click(qs('.umap-draw-polygon-multi'))
|
|
261
|
-
happen.at('mousemove', 300, 300)
|
|
262
|
-
happen.at('click', 300, 300)
|
|
263
|
-
happen.at('mousemove', 350, 300)
|
|
264
|
-
happen.at('click', 350, 300)
|
|
265
|
-
happen.at('click', 350, 300)
|
|
266
|
-
assert.ok(layer.isMulti())
|
|
267
|
-
assert.equal(datalayer._index.length, 1)
|
|
268
|
-
})
|
|
269
|
-
})
|
|
270
|
-
|
|
271
|
-
describe('#transferShape', function () {
|
|
272
|
-
it('should transfer simple polygon shape to another polygon', function () {
|
|
273
|
-
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
274
|
-
layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
|
|
275
|
-
datalayer
|
|
276
|
-
),
|
|
277
|
-
other = new U.Polygon(
|
|
278
|
-
map,
|
|
279
|
-
[p2ll(200, 350), p2ll(200, 300), p2ll(300, 200)],
|
|
280
|
-
{ datalayer: datalayer }
|
|
281
|
-
).addTo(datalayer)
|
|
282
|
-
assert.ok(map.hasLayer(layer))
|
|
283
|
-
layer.transferShape(p2ll(150, 150), other)
|
|
284
|
-
assert.equal(other._latlngs.length, 2)
|
|
285
|
-
assert.deepEqual(other._latlngs[1][0], latlngs)
|
|
286
|
-
assert.notOk(map.hasLayer(layer))
|
|
287
|
-
})
|
|
288
|
-
|
|
289
|
-
it('should transfer multipolygon shape to another polygon', function () {
|
|
290
|
-
var latlngs = [
|
|
291
|
-
[
|
|
292
|
-
[p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
293
|
-
[p2ll(120, 150), p2ll(150, 180), p2ll(180, 120)],
|
|
294
|
-
],
|
|
295
|
-
[[p2ll(200, 300), p2ll(300, 200)]],
|
|
296
|
-
],
|
|
297
|
-
layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
|
|
298
|
-
datalayer
|
|
299
|
-
),
|
|
300
|
-
other = new U.Polygon(
|
|
301
|
-
map,
|
|
302
|
-
[p2ll(200, 350), p2ll(200, 300), p2ll(300, 200)],
|
|
303
|
-
{ datalayer: datalayer }
|
|
304
|
-
).addTo(datalayer)
|
|
305
|
-
assert.ok(map.hasLayer(layer))
|
|
306
|
-
layer.transferShape(p2ll(150, 150), other)
|
|
307
|
-
assert.equal(other._latlngs.length, 2)
|
|
308
|
-
assert.deepEqual(other._latlngs[1][0], latlngs[0][0])
|
|
309
|
-
assert.ok(map.hasLayer(layer))
|
|
310
|
-
assert.equal(layer._latlngs.length, 1)
|
|
311
|
-
})
|
|
312
|
-
})
|
|
313
|
-
|
|
314
|
-
describe('#isolateShape', function () {
|
|
315
|
-
it('should not allow to isolate simple polygon', function () {
|
|
316
|
-
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
317
|
-
layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
|
|
318
|
-
datalayer
|
|
319
|
-
)
|
|
320
|
-
assert.equal(datalayer._index.length, 1)
|
|
321
|
-
assert.ok(map.hasLayer(layer))
|
|
322
|
-
layer.isolateShape(p2ll(150, 150))
|
|
323
|
-
assert.equal(layer._latlngs[0].length, 3)
|
|
324
|
-
assert.equal(datalayer._index.length, 1)
|
|
325
|
-
})
|
|
326
|
-
|
|
327
|
-
it('should isolate multipolygon shape', function () {
|
|
328
|
-
var latlngs = [
|
|
329
|
-
[
|
|
330
|
-
[p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
331
|
-
[p2ll(120, 150), p2ll(150, 180), p2ll(180, 120)],
|
|
332
|
-
],
|
|
333
|
-
[[p2ll(200, 300), p2ll(300, 200)]],
|
|
334
|
-
],
|
|
335
|
-
layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
|
|
336
|
-
datalayer
|
|
337
|
-
)
|
|
338
|
-
assert.equal(datalayer._index.length, 1)
|
|
339
|
-
assert.ok(map.hasLayer(layer))
|
|
340
|
-
var other = layer.isolateShape(p2ll(150, 150))
|
|
341
|
-
assert.equal(datalayer._index.length, 2)
|
|
342
|
-
assert.equal(other._latlngs.length, 2)
|
|
343
|
-
assert.deepEqual(other._latlngs[0], latlngs[0][0])
|
|
344
|
-
assert.ok(map.hasLayer(layer))
|
|
345
|
-
assert.ok(map.hasLayer(other))
|
|
346
|
-
assert.equal(layer._latlngs.length, 1)
|
|
347
|
-
other.remove()
|
|
348
|
-
})
|
|
349
|
-
})
|
|
350
|
-
|
|
351
|
-
describe('#clone', function () {
|
|
352
|
-
it('should clone polygon', function () {
|
|
353
|
-
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
354
|
-
layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
|
|
355
|
-
datalayer
|
|
356
|
-
)
|
|
357
|
-
assert.equal(datalayer._index.length, 1)
|
|
358
|
-
other = layer.clone()
|
|
359
|
-
assert.ok(map.hasLayer(other))
|
|
360
|
-
assert.equal(datalayer._index.length, 2)
|
|
361
|
-
// Must not be the same reference
|
|
362
|
-
assert.notEqual(layer._latlngs, other._latlngs)
|
|
363
|
-
assert.equal(L.Util.formatNum(layer._latlngs[0][0].lat), other._latlngs[0][0].lat)
|
|
364
|
-
assert.equal(L.Util.formatNum(layer._latlngs[0][0].lng), other._latlngs[0][0].lng)
|
|
365
|
-
})
|
|
366
|
-
})
|
|
367
111
|
})
|
|
@@ -234,72 +234,6 @@ describe('U.Polyline', function () {
|
|
|
234
234
|
})
|
|
235
235
|
})
|
|
236
236
|
|
|
237
|
-
describe('#addShape', function () {
|
|
238
|
-
it('"add shape" control should not be visible by default', function () {
|
|
239
|
-
assert.notOk(qs('.umap-draw-polyline-multi'))
|
|
240
|
-
})
|
|
241
|
-
|
|
242
|
-
it('"add shape" control should be visible when editing a Polyline', function () {
|
|
243
|
-
var layer = new U.Polyline(this.map, [p2ll(100, 100), p2ll(100, 200)], {
|
|
244
|
-
datalayer: this.datalayer,
|
|
245
|
-
}).addTo(this.datalayer)
|
|
246
|
-
layer.edit()
|
|
247
|
-
assert.ok(qs('.umap-draw-polyline-multi'))
|
|
248
|
-
})
|
|
249
|
-
|
|
250
|
-
it('"add shape" control should extend the same multi', function () {
|
|
251
|
-
var layer = new U.Polyline(this.map, [p2ll(100, 100), p2ll(100, 200)], {
|
|
252
|
-
datalayer: this.datalayer,
|
|
253
|
-
}).addTo(this.datalayer)
|
|
254
|
-
layer.edit()
|
|
255
|
-
assert.notOk(layer.isMulti())
|
|
256
|
-
happen.click(qs('.umap-draw-polyline-multi'))
|
|
257
|
-
happen.at('mousemove', 300, 300)
|
|
258
|
-
happen.at('click', 300, 300)
|
|
259
|
-
happen.at('mousemove', 350, 300)
|
|
260
|
-
happen.at('click', 350, 300)
|
|
261
|
-
happen.at('click', 350, 300)
|
|
262
|
-
assert.ok(layer.isMulti())
|
|
263
|
-
assert.equal(this.datalayer._index.length, 1)
|
|
264
|
-
})
|
|
265
|
-
})
|
|
266
|
-
|
|
267
|
-
describe('#transferShape', function () {
|
|
268
|
-
it('should transfer simple line shape to another line', function () {
|
|
269
|
-
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
270
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
271
|
-
datalayer: this.datalayer,
|
|
272
|
-
}).addTo(this.datalayer),
|
|
273
|
-
other = new U.Polyline(this.map, [p2ll(200, 300), p2ll(300, 200)], {
|
|
274
|
-
datalayer: this.datalayer,
|
|
275
|
-
}).addTo(this.datalayer)
|
|
276
|
-
assert.ok(this.map.hasLayer(layer))
|
|
277
|
-
layer.transferShape(p2ll(150, 150), other)
|
|
278
|
-
assert.equal(other._latlngs.length, 2)
|
|
279
|
-
assert.deepEqual(other._latlngs[1], latlngs)
|
|
280
|
-
assert.notOk(this.map.hasLayer(layer))
|
|
281
|
-
})
|
|
282
|
-
|
|
283
|
-
it('should transfer multi line shape to another line', function () {
|
|
284
|
-
var latlngs = [
|
|
285
|
-
[p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
286
|
-
[p2ll(200, 300), p2ll(300, 200)],
|
|
287
|
-
],
|
|
288
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
289
|
-
datalayer: this.datalayer,
|
|
290
|
-
}).addTo(this.datalayer),
|
|
291
|
-
other = new U.Polyline(this.map, [p2ll(250, 300), p2ll(350, 200)], {
|
|
292
|
-
datalayer: this.datalayer,
|
|
293
|
-
}).addTo(this.datalayer)
|
|
294
|
-
assert.ok(this.map.hasLayer(layer))
|
|
295
|
-
layer.transferShape(p2ll(150, 150), other)
|
|
296
|
-
assert.equal(other._latlngs.length, 2)
|
|
297
|
-
assert.deepEqual(other._latlngs[1], latlngs[0])
|
|
298
|
-
assert.ok(this.map.hasLayer(layer))
|
|
299
|
-
assert.equal(layer._latlngs.length, 1)
|
|
300
|
-
})
|
|
301
|
-
})
|
|
302
|
-
|
|
303
237
|
describe('#mergeShapes', function () {
|
|
304
238
|
it('should remove duplicated join point when merging', function () {
|
|
305
239
|
var latlngs = [
|
|
@@ -349,54 +283,4 @@ describe('U.Polyline', function () {
|
|
|
349
283
|
})
|
|
350
284
|
})
|
|
351
285
|
|
|
352
|
-
describe('#isolateShape', function () {
|
|
353
|
-
it('should not allow to isolate simple line', function () {
|
|
354
|
-
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
355
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
356
|
-
datalayer: this.datalayer,
|
|
357
|
-
}).addTo(this.datalayer)
|
|
358
|
-
assert.equal(this.datalayer._index.length, 1)
|
|
359
|
-
assert.ok(this.map.hasLayer(layer))
|
|
360
|
-
layer.isolateShape(p2ll(150, 150))
|
|
361
|
-
assert.equal(layer._latlngs.length, 3)
|
|
362
|
-
assert.equal(this.datalayer._index.length, 1)
|
|
363
|
-
})
|
|
364
|
-
|
|
365
|
-
it('should isolate multipolyline shape', function () {
|
|
366
|
-
var latlngs = [
|
|
367
|
-
[p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
368
|
-
[[p2ll(200, 300), p2ll(300, 200)]],
|
|
369
|
-
],
|
|
370
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
371
|
-
datalayer: this.datalayer,
|
|
372
|
-
}).addTo(this.datalayer)
|
|
373
|
-
assert.equal(this.datalayer._index.length, 1)
|
|
374
|
-
assert.ok(this.map.hasLayer(layer))
|
|
375
|
-
var other = layer.isolateShape(p2ll(150, 150))
|
|
376
|
-
assert.equal(this.datalayer._index.length, 2)
|
|
377
|
-
assert.equal(other._latlngs.length, 3)
|
|
378
|
-
assert.deepEqual(other._latlngs, latlngs[0])
|
|
379
|
-
assert.ok(this.map.hasLayer(layer))
|
|
380
|
-
assert.ok(this.map.hasLayer(other))
|
|
381
|
-
assert.equal(layer._latlngs.length, 1)
|
|
382
|
-
other.remove()
|
|
383
|
-
})
|
|
384
|
-
})
|
|
385
|
-
|
|
386
|
-
describe('#clone', function () {
|
|
387
|
-
it('should clone polyline', function () {
|
|
388
|
-
var latlngs = [p2ll(100, 150), p2ll(100, 200), p2ll(200, 100)],
|
|
389
|
-
layer = new U.Polyline(this.map, latlngs, {
|
|
390
|
-
datalayer: this.datalayer,
|
|
391
|
-
}).addTo(this.datalayer)
|
|
392
|
-
assert.equal(this.datalayer._index.length, 1)
|
|
393
|
-
other = layer.clone()
|
|
394
|
-
assert.ok(this.map.hasLayer(other))
|
|
395
|
-
assert.equal(this.datalayer._index.length, 2)
|
|
396
|
-
// Must not be the same reference
|
|
397
|
-
assert.notEqual(layer._latlngs, other._latlngs)
|
|
398
|
-
assert.equal(L.Util.formatNum(layer._latlngs[0].lat), other._latlngs[0].lat)
|
|
399
|
-
assert.equal(L.Util.formatNum(layer._latlngs[0].lng), other._latlngs[0].lng)
|
|
400
|
-
})
|
|
401
|
-
})
|
|
402
286
|
})
|
|
@@ -27,16 +27,16 @@ describe('L.TableEditor', () => {
|
|
|
27
27
|
|
|
28
28
|
it('should exist table click on edit mode', () => {
|
|
29
29
|
button = qs(
|
|
30
|
-
'#browse_data_toggle_' + L.stamp(datalayer) + ' .
|
|
30
|
+
'#browse_data_toggle_' + L.stamp(datalayer) + ' .icon-table'
|
|
31
31
|
)
|
|
32
32
|
expect(button).to.be.ok
|
|
33
33
|
})
|
|
34
34
|
|
|
35
35
|
it('should open table button click', () => {
|
|
36
36
|
happen.click(button)
|
|
37
|
-
expect(qs('
|
|
38
|
-
expect(qsa('
|
|
39
|
-
expect(qsa('
|
|
37
|
+
expect(qs('.panel.full.on div.table')).to.be.ok
|
|
38
|
+
expect(qsa('.panel.full.on div.table form').length).to.eql(3) // One per feature.
|
|
39
|
+
expect(qsa('.panel.full.on div.table input').length).to.eql(3) // One per feature and per property.
|
|
40
40
|
})
|
|
41
41
|
})
|
|
42
42
|
describe('#properties()', () => {
|
|
@@ -53,10 +53,10 @@ describe('L.TableEditor', () => {
|
|
|
53
53
|
}
|
|
54
54
|
var oldPrompt = window.prompt
|
|
55
55
|
window.prompt = newPrompt
|
|
56
|
-
var button = qs('
|
|
56
|
+
var button = qs('.panel.full.on .add-property')
|
|
57
57
|
expect(button).to.be.ok
|
|
58
58
|
happen.click(button)
|
|
59
|
-
expect(qsa('
|
|
59
|
+
expect(qsa('.panel.full.on div.table input').length).to.eql(6) // One per feature and per property.
|
|
60
60
|
window.prompt = oldPrompt
|
|
61
61
|
})
|
|
62
62
|
|
|
@@ -74,10 +74,10 @@ describe('L.TableEditor', () => {
|
|
|
74
74
|
}
|
|
75
75
|
var oldPrompt = window.prompt
|
|
76
76
|
window.prompt = newPrompt
|
|
77
|
-
var button = qs('
|
|
77
|
+
var button = qs('.panel.full.on div.thead div.tcell:last-of-type .umap-edit')
|
|
78
78
|
expect(button).to.be.ok
|
|
79
79
|
happen.click(button)
|
|
80
|
-
expect(qsa('
|
|
80
|
+
expect(qsa('.panel.full.on div.table input').length).to.eql(6)
|
|
81
81
|
expect(feature.properties.newprop).to.be.undefined
|
|
82
82
|
expect(feature.properties.newname).to.eql('the value')
|
|
83
83
|
window.prompt = oldPrompt
|
|
@@ -91,12 +91,12 @@ describe('L.TableEditor', () => {
|
|
|
91
91
|
oldConfirm = window.confirm
|
|
92
92
|
window.confirm = newConfirm
|
|
93
93
|
var button = qs(
|
|
94
|
-
'
|
|
94
|
+
'.panel.full.on div.thead div.tcell:last-of-type .umap-delete'
|
|
95
95
|
)
|
|
96
96
|
expect(button).to.be.ok
|
|
97
97
|
happen.click(button)
|
|
98
98
|
FEATURE = feature
|
|
99
|
-
expect(qsa('
|
|
99
|
+
expect(qsa('.panel.full.on div.table input').length).to.eql(3)
|
|
100
100
|
expect(feature.properties.newname).to.be.undefined
|
|
101
101
|
window.confirm = oldConfirm
|
|
102
102
|
})
|