umap-project 2.1.2__py3-none-any.whl → 2.1.3__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/models.py +2 -0
- umap/static/umap/js/umap.controls.js +29 -0
- umap/static/umap/js/umap.features.js +3 -1
- umap/static/umap/js/umap.importer.js +4 -5
- umap/static/umap/js/umap.js +27 -36
- umap/static/umap/js/umap.layer.js +7 -6
- 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/index.html +1 -4
- 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 +5 -0
- umap/tests/integration/test_anonymous_owned_map.py +3 -0
- umap/tests/integration/test_browser.py +4 -11
- umap/tests/integration/test_choropleth.py +89 -0
- umap/tests/integration/test_collaborative_editing.py +30 -1
- umap/tests/integration/test_datalayer.py +130 -0
- umap/tests/integration/test_edit_datalayer.py +134 -0
- umap/tests/integration/test_edit_map.py +15 -0
- umap/tests/integration/test_facets_browser.py +31 -0
- umap/tests/integration/test_import.py +347 -2
- umap/tests/integration/test_map.py +17 -37
- umap/tests/integration/test_owned_map.py +18 -0
- umap/tests/integration/test_picto.py +20 -33
- umap/tests/integration/test_polygon.py +363 -0
- umap/tests/integration/test_polyline.py +325 -0
- umap/tests/integration/test_tableeditor.py +27 -0
- {umap_project-2.1.2.dist-info → umap_project-2.1.3.dist-info}/METADATA +4 -4
- {umap_project-2.1.2.dist-info → umap_project-2.1.3.dist-info}/RECORD +36 -33
- umap/static/umap/test/Choropleth.js +0 -245
- umap/static/umap/test/DataLayer.js +0 -463
- umap/static/umap/test/Permissions.js +0 -74
- umap/static/umap/test/TableEditor.js +0 -104
- umap/tests/integration/test_drawing.py +0 -243
- {umap_project-2.1.2.dist-info → umap_project-2.1.3.dist-info}/WHEEL +0 -0
- {umap_project-2.1.2.dist-info → umap_project-2.1.3.dist-info}/entry_points.txt +0 -0
- {umap_project-2.1.2.dist-info → umap_project-2.1.3.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
|
})
|
umap/static/umap/test/index.html
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<title>Umap front Tests</title>
|
|
5
5
|
<meta charset="utf-8" />
|
|
6
|
+
<script type="module" src="../js/modules/leaflet-configure.js" defer></script>
|
|
6
7
|
<script type="module" src="../js/modules/global.js" defer></script>
|
|
7
8
|
|
|
8
9
|
<script src="../vendors/editable/Path.Drag.js" defer></script>
|
|
@@ -88,15 +89,11 @@
|
|
|
88
89
|
</script>
|
|
89
90
|
<script src="./_pre.js" defer></script>
|
|
90
91
|
<script src="./Map.js" defer></script>
|
|
91
|
-
<script src="./DataLayer.js" defer></script>
|
|
92
|
-
<script src="./TableEditor.js" defer></script>
|
|
93
92
|
<script src="./Feature.js" defer></script>
|
|
94
93
|
<script src="./Marker.js" defer></script>
|
|
95
94
|
<script src="./Polyline.js" defer></script>
|
|
96
95
|
<script src="./Polygon.js" defer></script>
|
|
97
96
|
<script src="./Util.js" defer></script>
|
|
98
|
-
<script src="./Permissions.js" defer></script>
|
|
99
|
-
<script src="./Choropleth.js" defer></script>
|
|
100
97
|
<script type="module" src="./URLs.js" defer></script>
|
|
101
98
|
<style type="text/css">
|
|
102
99
|
#mocha {
|
umap/tests/conftest.py
CHANGED
|
@@ -5,6 +5,8 @@ import pytest
|
|
|
5
5
|
from django.core.cache import cache
|
|
6
6
|
from django.core.signing import get_cookie_signer
|
|
7
7
|
|
|
8
|
+
from umap.models import Map
|
|
9
|
+
|
|
8
10
|
from .base import (
|
|
9
11
|
DataLayerFactory,
|
|
10
12
|
LicenceFactory,
|
|
@@ -48,6 +50,13 @@ def map(licence, tilelayer):
|
|
|
48
50
|
return MapFactory(owner=user, licence=licence)
|
|
49
51
|
|
|
50
52
|
|
|
53
|
+
@pytest.fixture
|
|
54
|
+
def openmap(map):
|
|
55
|
+
map.edit_status = Map.ANONYMOUS
|
|
56
|
+
map.save()
|
|
57
|
+
return map
|
|
58
|
+
|
|
59
|
+
|
|
51
60
|
@pytest.fixture
|
|
52
61
|
def anonymap(map):
|
|
53
62
|
map.owner = None
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "umap",
|
|
3
|
+
"geometry": {
|
|
4
|
+
"type": "Point",
|
|
5
|
+
"coordinates": [
|
|
6
|
+
3.0528,
|
|
7
|
+
50.6269
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"properties": {
|
|
11
|
+
"umap_id": 666,
|
|
12
|
+
"longCredit": "the illustrious mapmaker",
|
|
13
|
+
"shortCredit": "the mapmaker",
|
|
14
|
+
"slideshow": {},
|
|
15
|
+
"captionBar": true,
|
|
16
|
+
"dashArray": "5,5",
|
|
17
|
+
"fillOpacity": "0.5",
|
|
18
|
+
"fillColor": "Crimson",
|
|
19
|
+
"fill": true,
|
|
20
|
+
"weight": "2",
|
|
21
|
+
"opacity": "0.9",
|
|
22
|
+
"smoothFactor": "1",
|
|
23
|
+
"iconClass": "Drop",
|
|
24
|
+
"color": "Red",
|
|
25
|
+
"limitBounds": {},
|
|
26
|
+
"tilelayer": {
|
|
27
|
+
"maxZoom": 20,
|
|
28
|
+
"url_template": "https://tile.openstreetmap.fr/hot/{z}/{x}/{y}.png",
|
|
29
|
+
"minZoom": 0,
|
|
30
|
+
"attribution": "map data © [[https://osm.org/copyright|OpenStreetMap contributors]] under ODbL - Tiles © HOT",
|
|
31
|
+
"name": "OSM Humanitarian (OSM-FR)"
|
|
32
|
+
},
|
|
33
|
+
"licence": {
|
|
34
|
+
"url": "",
|
|
35
|
+
"name": "No licence set"
|
|
36
|
+
},
|
|
37
|
+
"description": "Map description",
|
|
38
|
+
"name": "Imported map",
|
|
39
|
+
"tilelayersControl": true,
|
|
40
|
+
"onLoadPanel": "caption",
|
|
41
|
+
"displayPopupFooter": true,
|
|
42
|
+
"miniMap": true,
|
|
43
|
+
"moreControl": true,
|
|
44
|
+
"scaleControl": true,
|
|
45
|
+
"zoomControl": true,
|
|
46
|
+
"scrollWheelZoom": true,
|
|
47
|
+
"datalayersControl": true,
|
|
48
|
+
"zoom": 6
|
|
49
|
+
},
|
|
50
|
+
"layers": [
|
|
51
|
+
{
|
|
52
|
+
"type": "FeatureCollection",
|
|
53
|
+
"features": [
|
|
54
|
+
{
|
|
55
|
+
"type": "Feature",
|
|
56
|
+
"geometry": {
|
|
57
|
+
"type": "Polygon",
|
|
58
|
+
"coordinates": [
|
|
59
|
+
[
|
|
60
|
+
[
|
|
61
|
+
4.2939,
|
|
62
|
+
50.8893
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
4.2441,
|
|
66
|
+
50.8196
|
|
67
|
+
],
|
|
68
|
+
[
|
|
69
|
+
4.3869,
|
|
70
|
+
50.7642
|
|
71
|
+
],
|
|
72
|
+
[
|
|
73
|
+
4.4813,
|
|
74
|
+
50.7929
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
4.413,
|
|
78
|
+
50.9119
|
|
79
|
+
],
|
|
80
|
+
[
|
|
81
|
+
4.2939,
|
|
82
|
+
50.8893
|
|
83
|
+
]
|
|
84
|
+
]
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"properties": {
|
|
88
|
+
"name": "Bruxelles",
|
|
89
|
+
"description": "polygon"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"type": "Feature",
|
|
94
|
+
"geometry": {
|
|
95
|
+
"type": "Point",
|
|
96
|
+
"coordinates": [
|
|
97
|
+
3.0528,
|
|
98
|
+
50.6269
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"properties": {
|
|
102
|
+
"_umap_options": {
|
|
103
|
+
"color": "Orange"
|
|
104
|
+
},
|
|
105
|
+
"name": "Lille",
|
|
106
|
+
"description": "une ville"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"_umap_options": {
|
|
111
|
+
"displayOnLoad": true,
|
|
112
|
+
"name": "Cities",
|
|
113
|
+
"id": 108,
|
|
114
|
+
"remoteData": {},
|
|
115
|
+
"description": "A layer with some cities",
|
|
116
|
+
"color": "Navy",
|
|
117
|
+
"iconClass": "Drop",
|
|
118
|
+
"smoothFactor": "1",
|
|
119
|
+
"dashArray": "5,1",
|
|
120
|
+
"fillOpacity": "0.5",
|
|
121
|
+
"fillColor": "Blue",
|
|
122
|
+
"fill": true
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"type": "FeatureCollection",
|
|
127
|
+
"features": [
|
|
128
|
+
{
|
|
129
|
+
"type": "Feature",
|
|
130
|
+
"geometry": {
|
|
131
|
+
"type": "LineString",
|
|
132
|
+
"coordinates": [
|
|
133
|
+
[
|
|
134
|
+
1.7715,
|
|
135
|
+
50.9255
|
|
136
|
+
],
|
|
137
|
+
[
|
|
138
|
+
1.6589,
|
|
139
|
+
50.9696
|
|
140
|
+
],
|
|
141
|
+
[
|
|
142
|
+
1.4941,
|
|
143
|
+
51.0128
|
|
144
|
+
],
|
|
145
|
+
[
|
|
146
|
+
1.4199,
|
|
147
|
+
51.0638
|
|
148
|
+
],
|
|
149
|
+
[
|
|
150
|
+
1.2881,
|
|
151
|
+
51.1104
|
|
152
|
+
]
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
"properties": {
|
|
156
|
+
"_umap_options": {
|
|
157
|
+
"weight": "4"
|
|
158
|
+
},
|
|
159
|
+
"name": "tunnel sous la Manche"
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"_umap_options": {
|
|
164
|
+
"displayOnLoad": true,
|
|
165
|
+
"name": "Tunnels",
|
|
166
|
+
"id": 109,
|
|
167
|
+
"remoteData": {}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 0.6,
|
|
3
|
+
"generator": "Overpass API 0.7.55.4 3079d8ea",
|
|
4
|
+
"osm3s": {
|
|
5
|
+
"timestamp_osm_base": "2018-09-22T05:26:02Z",
|
|
6
|
+
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
|
|
7
|
+
},
|
|
8
|
+
"elements": [
|
|
9
|
+
{
|
|
10
|
+
"type": "node",
|
|
11
|
+
"id": 3619112991,
|
|
12
|
+
"lat": 48.9352995,
|
|
13
|
+
"lon": 2.3570684,
|
|
14
|
+
"tags": {
|
|
15
|
+
"information": "map",
|
|
16
|
+
"map_size": "city",
|
|
17
|
+
"map_type": "scheme",
|
|
18
|
+
"tourism": "information"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "node",
|
|
23
|
+
"id": 3682500756,
|
|
24
|
+
"lat": 48.9804426,
|
|
25
|
+
"lon": 2.2719725,
|
|
26
|
+
"tags": {
|
|
27
|
+
"information": "map",
|
|
28
|
+
"level": "0",
|
|
29
|
+
"tourism": "information"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -92,6 +92,9 @@ def test_owner_permissions_form(map, datalayer, live_server, owner_session):
|
|
|
92
92
|
".datalayer-permissions select[name='edit_status'] option:checked"
|
|
93
93
|
)
|
|
94
94
|
expect(option).to_have_text("Inherit")
|
|
95
|
+
# Those fields should not be present in anonymous maps
|
|
96
|
+
expect(owner_session.locator(".umap-field-share_status select")).to_be_hidden()
|
|
97
|
+
expect(owner_session.locator(".umap-field-owner")).to_be_hidden()
|
|
95
98
|
|
|
96
99
|
|
|
97
100
|
def test_anonymous_can_add_marker_on_editable_layer(
|