umap-project 1.14.0a5__py3-none-any.whl → 2.0.0a0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of umap-project might be problematic. Click here for more details.

Files changed (224) hide show
  1. umap/__init__.py +1 -1
  2. umap/decorators.py +0 -14
  3. umap/locale/br/LC_MESSAGES/django.mo +0 -0
  4. umap/locale/br/LC_MESSAGES/django.po +137 -85
  5. umap/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
  6. umap/locale/cs_CZ/LC_MESSAGES/django.po +136 -84
  7. umap/locale/el/LC_MESSAGES/django.mo +0 -0
  8. umap/locale/el/LC_MESSAGES/django.po +136 -84
  9. umap/locale/en/LC_MESSAGES/django.po +128 -88
  10. umap/locale/es/LC_MESSAGES/django.mo +0 -0
  11. umap/locale/es/LC_MESSAGES/django.po +136 -84
  12. umap/locale/fr/LC_MESSAGES/django.mo +0 -0
  13. umap/locale/fr/LC_MESSAGES/django.po +131 -91
  14. umap/locale/hu/LC_MESSAGES/django.mo +0 -0
  15. umap/locale/hu/LC_MESSAGES/django.po +137 -85
  16. umap/locale/it/LC_MESSAGES/django.mo +0 -0
  17. umap/locale/it/LC_MESSAGES/django.po +136 -84
  18. umap/locale/ms/LC_MESSAGES/django.mo +0 -0
  19. umap/locale/ms/LC_MESSAGES/django.po +136 -84
  20. umap/locale/pl/LC_MESSAGES/django.mo +0 -0
  21. umap/locale/pl/LC_MESSAGES/django.po +136 -84
  22. umap/locale/sv/LC_MESSAGES/django.mo +0 -0
  23. umap/locale/sv/LC_MESSAGES/django.po +135 -83
  24. umap/locale/zh_TW/LC_MESSAGES/django.mo +0 -0
  25. umap/locale/zh_TW/LC_MESSAGES/django.po +143 -91
  26. umap/models.py +23 -1
  27. umap/settings/__init__.py +1 -4
  28. umap/settings/base.py +1 -0
  29. umap/static/umap/base.css +5 -0
  30. umap/static/umap/content.css +185 -13
  31. umap/static/umap/favicons/icon.svg +2 -2
  32. umap/static/umap/img/edit.svg +3 -3
  33. umap/static/umap/img/icon-delete.svg +4 -0
  34. umap/static/umap/img/icon-download.svg +13 -0
  35. umap/static/umap/img/icon-duplicate.svg +5 -0
  36. umap/static/umap/img/icon-edit.svg +12 -0
  37. umap/static/umap/img/icon-share.svg +11 -0
  38. umap/static/umap/img/icon-view.svg +12 -0
  39. umap/static/umap/img/logo.svg +2 -2
  40. umap/static/umap/img/logo_small.svg +2 -2
  41. umap/static/umap/img/marker.svg +4 -0
  42. umap/static/umap/img/opensource.svg +2 -2
  43. umap/static/umap/img/osm.svg +2 -2
  44. umap/static/umap/js/components/fragment.js +1 -1
  45. umap/static/umap/js/modules/browser.js +159 -0
  46. umap/static/umap/js/modules/global.js +3 -1
  47. umap/static/umap/js/modules/request.js +155 -0
  48. umap/static/umap/js/umap.autocomplete.js +28 -38
  49. umap/static/umap/js/umap.controls.js +73 -58
  50. umap/static/umap/js/umap.core.js +4 -9
  51. umap/static/umap/js/umap.datalayer.permissions.js +13 -12
  52. umap/static/umap/js/umap.features.js +51 -49
  53. umap/static/umap/js/umap.forms.js +19 -19
  54. umap/static/umap/js/umap.icon.js +17 -17
  55. umap/static/umap/js/umap.importer.js +2 -1
  56. umap/static/umap/js/umap.js +242 -291
  57. umap/static/umap/js/umap.layer.js +173 -141
  58. umap/static/umap/js/umap.permissions.js +24 -25
  59. umap/static/umap/js/umap.popup.js +14 -14
  60. umap/static/umap/js/umap.share.js +4 -4
  61. umap/static/umap/js/umap.slideshow.js +4 -4
  62. umap/static/umap/js/umap.tableeditor.js +2 -2
  63. umap/static/umap/js/umap.ui.js +1 -1
  64. umap/static/umap/locale/am_ET.js +1 -11
  65. umap/static/umap/locale/am_ET.json +1 -11
  66. umap/static/umap/locale/ar.js +1 -11
  67. umap/static/umap/locale/ar.json +1 -11
  68. umap/static/umap/locale/ast.js +1 -11
  69. umap/static/umap/locale/ast.json +1 -11
  70. umap/static/umap/locale/bg.js +1 -11
  71. umap/static/umap/locale/bg.json +1 -11
  72. umap/static/umap/locale/br.js +1 -11
  73. umap/static/umap/locale/br.json +1 -11
  74. umap/static/umap/locale/ca.js +1 -11
  75. umap/static/umap/locale/ca.json +1 -11
  76. umap/static/umap/locale/cs_CZ.js +1 -11
  77. umap/static/umap/locale/cs_CZ.json +1 -11
  78. umap/static/umap/locale/da.js +1 -11
  79. umap/static/umap/locale/da.json +1 -11
  80. umap/static/umap/locale/de.js +1 -11
  81. umap/static/umap/locale/de.json +1 -11
  82. umap/static/umap/locale/el.js +1 -11
  83. umap/static/umap/locale/el.json +1 -11
  84. umap/static/umap/locale/en.js +1 -11
  85. umap/static/umap/locale/en.json +1 -11
  86. umap/static/umap/locale/en_US.json +1 -11
  87. umap/static/umap/locale/es.js +1 -11
  88. umap/static/umap/locale/es.json +1 -11
  89. umap/static/umap/locale/et.js +1 -11
  90. umap/static/umap/locale/et.json +1 -11
  91. umap/static/umap/locale/fa_IR.js +6 -16
  92. umap/static/umap/locale/fa_IR.json +6 -16
  93. umap/static/umap/locale/fi.js +1 -11
  94. umap/static/umap/locale/fi.json +1 -11
  95. umap/static/umap/locale/fr.js +1 -11
  96. umap/static/umap/locale/fr.json +1 -11
  97. umap/static/umap/locale/gl.js +1 -11
  98. umap/static/umap/locale/gl.json +1 -11
  99. umap/static/umap/locale/he.js +1 -11
  100. umap/static/umap/locale/he.json +1 -11
  101. umap/static/umap/locale/hr.js +1 -11
  102. umap/static/umap/locale/hr.json +1 -11
  103. umap/static/umap/locale/hu.js +1 -11
  104. umap/static/umap/locale/hu.json +1 -11
  105. umap/static/umap/locale/id.js +1 -11
  106. umap/static/umap/locale/id.json +1 -11
  107. umap/static/umap/locale/is.js +1 -11
  108. umap/static/umap/locale/is.json +1 -11
  109. umap/static/umap/locale/it.js +1 -11
  110. umap/static/umap/locale/it.json +1 -11
  111. umap/static/umap/locale/ja.js +1 -11
  112. umap/static/umap/locale/ja.json +1 -11
  113. umap/static/umap/locale/ko.js +1 -11
  114. umap/static/umap/locale/ko.json +1 -11
  115. umap/static/umap/locale/lt.js +1 -11
  116. umap/static/umap/locale/lt.json +1 -11
  117. umap/static/umap/locale/ms.js +1 -11
  118. umap/static/umap/locale/ms.json +1 -11
  119. umap/static/umap/locale/nl.js +1 -11
  120. umap/static/umap/locale/nl.json +1 -11
  121. umap/static/umap/locale/no.js +1 -11
  122. umap/static/umap/locale/no.json +1 -11
  123. umap/static/umap/locale/pl.js +1 -11
  124. umap/static/umap/locale/pl.json +1 -11
  125. umap/static/umap/locale/pl_PL.json +1 -11
  126. umap/static/umap/locale/pt.js +1 -11
  127. umap/static/umap/locale/pt.json +1 -11
  128. umap/static/umap/locale/pt_BR.js +1 -11
  129. umap/static/umap/locale/pt_BR.json +1 -11
  130. umap/static/umap/locale/pt_PT.js +1 -11
  131. umap/static/umap/locale/pt_PT.json +1 -11
  132. umap/static/umap/locale/ro.js +1 -11
  133. umap/static/umap/locale/ro.json +1 -11
  134. umap/static/umap/locale/ru.js +1 -11
  135. umap/static/umap/locale/ru.json +1 -11
  136. umap/static/umap/locale/sk_SK.js +1 -11
  137. umap/static/umap/locale/sk_SK.json +1 -11
  138. umap/static/umap/locale/sl.js +1 -11
  139. umap/static/umap/locale/sl.json +1 -11
  140. umap/static/umap/locale/sr.js +1 -11
  141. umap/static/umap/locale/sr.json +1 -11
  142. umap/static/umap/locale/sv.js +1 -11
  143. umap/static/umap/locale/sv.json +1 -11
  144. umap/static/umap/locale/th_TH.js +1 -11
  145. umap/static/umap/locale/th_TH.json +1 -11
  146. umap/static/umap/locale/tr.js +1 -11
  147. umap/static/umap/locale/tr.json +1 -11
  148. umap/static/umap/locale/uk_UA.js +1 -11
  149. umap/static/umap/locale/uk_UA.json +1 -11
  150. umap/static/umap/locale/vi.js +1 -11
  151. umap/static/umap/locale/vi.json +1 -11
  152. umap/static/umap/locale/vi_VN.json +1 -11
  153. umap/static/umap/locale/zh.js +1 -11
  154. umap/static/umap/locale/zh.json +1 -11
  155. umap/static/umap/locale/zh_CN.json +1 -11
  156. umap/static/umap/locale/zh_TW.Big5.json +1 -11
  157. umap/static/umap/locale/zh_TW.js +17 -27
  158. umap/static/umap/locale/zh_TW.json +17 -27
  159. umap/static/umap/map.css +2 -2
  160. umap/static/umap/nav.css +2 -1
  161. umap/static/umap/test/.eslintrc +0 -1
  162. umap/static/umap/test/Choropleth.js +29 -27
  163. umap/static/umap/test/DataLayer.js +207 -239
  164. umap/static/umap/test/Feature.js +33 -58
  165. umap/static/umap/test/Map.Export.js +11 -11
  166. umap/static/umap/test/Map.js +66 -67
  167. umap/static/umap/test/Marker.js +36 -32
  168. umap/static/umap/test/Polygon.js +95 -95
  169. umap/static/umap/test/Polyline.js +31 -31
  170. umap/static/umap/test/TableEditor.js +29 -25
  171. umap/static/umap/test/_pre.js +2 -7
  172. umap/static/umap/test/index.html +4 -4
  173. umap/static/umap/vendors/contextmenu/leaflet.contextmenu.css +54 -0
  174. umap/static/umap/vendors/contextmenu/leaflet.contextmenu.js +586 -0
  175. umap/static/umap/vendors/csv2geojson/index.js +259 -0
  176. umap/static/umap/vendors/dompurify/purify.js +1633 -0
  177. umap/static/umap/vendors/locatecontrol/L.Control.Locate.css +63 -0
  178. umap/static/umap/vendors/locatecontrol/L.Control.Locate.js +950 -0
  179. umap/static/umap/vendors/minimap/Control.MiniMap.css +88 -0
  180. umap/static/umap/vendors/minimap/Control.MiniMap.js +352 -0
  181. umap/static/umap/vendors/togeojson/togeojson.js +2 -0
  182. umap/templates/auth/user_form.html +3 -2
  183. umap/templates/base.html +1 -0
  184. umap/templates/registration/login.html +51 -36
  185. umap/templates/umap/about_summary.html +1 -1
  186. umap/templates/umap/branding.html +3 -0
  187. umap/templates/umap/content.html +15 -39
  188. umap/templates/umap/header.html +0 -0
  189. umap/templates/umap/home.html +4 -2
  190. umap/templates/umap/js.html +0 -1
  191. umap/templates/umap/map_detail.html +9 -0
  192. umap/templates/umap/map_init.html +1 -1
  193. umap/templates/umap/map_messages.html +4 -2
  194. umap/templates/umap/map_table.html +130 -69
  195. umap/templates/umap/navigation.html +2 -4
  196. umap/templates/umap/user_dashboard.html +29 -6
  197. umap/tests/base.py +1 -1
  198. umap/tests/integration/conftest.py +18 -0
  199. umap/tests/integration/test_anonymous_owned_map.py +6 -3
  200. umap/tests/integration/test_browser.py +166 -6
  201. umap/tests/integration/test_collaborative_editing.py +23 -5
  202. umap/tests/integration/test_dashboard.py +17 -0
  203. umap/tests/integration/test_edit_datalayer.py +4 -3
  204. umap/tests/integration/test_export_map.py +1 -1
  205. umap/tests/integration/test_import.py +9 -4
  206. umap/tests/integration/test_map.py +64 -0
  207. umap/tests/integration/test_map_preview.py +75 -0
  208. umap/tests/integration/test_owned_map.py +11 -25
  209. umap/tests/integration/test_picto.py +3 -3
  210. umap/tests/integration/test_querystring.py +52 -0
  211. umap/tests/integration/test_share.py +22 -0
  212. umap/tests/test_map_views.py +157 -14
  213. umap/tests/test_views.py +50 -11
  214. umap/urls.py +6 -12
  215. umap/views.py +170 -47
  216. {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/METADATA +13 -15
  217. {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/RECORD +220 -199
  218. umap/static/umap/js/umap.browser.js +0 -148
  219. umap/static/umap/js/umap.xhr.js +0 -304
  220. umap/static/umap/test/Controls.js +0 -100
  221. umap/static/umap/test/Map.Init.js +0 -46
  222. {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/WHEEL +0 -0
  223. {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/entry_points.txt +0 -0
  224. {umap_project-1.14.0a5.dist-info → umap_project-2.0.0a0.dist-info}/licenses/LICENSE +0 -0
@@ -1,20 +1,24 @@
1
- describe('L.U.Marker', function () {
2
- before(function () {
3
- this.server = sinon.fakeServer.create()
4
- var datalayer_response = JSON.parse(JSON.stringify(RESPONSES.datalayer62_GET)) // Copy.
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
- this.server.respondWith(/\/datalayer\/62\/\?.*/, JSON.stringify(datalayer_response))
7
- this.map = initMap({ umap_id: 99 })
8
- this.datalayer = this.map.getDataLayerByUmapId(62)
9
- this.server.respond()
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(function () {
12
- this.server.restore()
15
+ after(() => {
16
+ fetchMock.restore()
13
17
  resetMap()
14
18
  })
15
19
 
16
- describe('#iconClassChange()', function () {
17
- it('should change icon class', function () {
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()', function () {
39
- it('should change icon symbol', function () {
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()', function () {
62
- it('should change icon class', function () {
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', function () {
84
- it('should clone marker', function () {
85
- var layer = new L.U.Marker(this.map, [10, 20], {
86
- datalayer: this.datalayer,
87
- }).addTo(this.datalayer)
88
- assert.equal(this.datalayer._index.length, 4)
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(this.map.hasLayer(other))
91
- assert.equal(this.datalayer._index.length, 5)
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', function () {
101
- var layer = new L.U.Marker(this.map, [10, 20], {
102
- datalayer: this.datalayer,
103
- }).addTo(this.datalayer)
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', function () {
111
- var layer = new L.U.Marker(this.map, [10, 20], {
112
- datalayer: this.datalayer,
113
- }).addTo(this.datalayer)
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')
@@ -1,14 +1,14 @@
1
- describe('L.U.Polygon', function () {
2
- var p2ll, map
1
+ describe('U.Polygon', function () {
2
+ var p2ll, map, datalayer
3
3
 
4
4
  before(function () {
5
- this.map = map = initMap({ umap_id: 99 })
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
- this.datalayer = this.map.createDataLayer()
11
- this.datalayer.connectToMap()
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
- this.datalayer.empty()
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 L.U.Polygon(
26
- this.map,
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: this.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 L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer })
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 L.U.Polygon(
45
- this.map,
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: this.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 L.U.Polygon(this.map, latLngs, { datalayer: this.datalayer })
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 L.U.Polygon(this.map, latLngs, { datalayer: this.datalayer })
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 L.U.Polygon(this.map, latlngs, {
124
- datalayer: this.datalayer,
125
- }).addTo(this.datalayer)
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 L.U.Polygon(this.map, latlngs, {
133
- datalayer: this.datalayer,
134
- }).addTo(this.datalayer)
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 L.U.Polygon(this.map, latlngs, {
142
- datalayer: this.datalayer,
143
- }).addTo(this.datalayer)
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 L.U.Polygon(this.map, latlngs, {
154
- datalayer: this.datalayer,
155
- }).addTo(this.datalayer)
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 L.U.Polygon(this.map, latlngs, {
166
- datalayer: this.datalayer,
167
- }).addTo(this.datalayer)
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 L.U.Polygon(this.map, latlngs, {
180
- datalayer: this.datalayer,
181
- }).addTo(this.datalayer)
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 L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer }).addTo(
189
- this.datalayer
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 L.U.Polygon(this.map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], {
197
- datalayer: this.datalayer,
198
- }).addTo(this.datalayer)
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 L.U.Polygon(
206
- this.map,
205
+ var layer = new U.Polygon(
206
+ map,
207
207
  [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)],
208
- { datalayer: this.datalayer }
209
- ).addTo(this.datalayer),
210
- other = new L.U.Polyline(this.map, [p2ll(200, 250), p2ll(200, 300)], {
211
- datalayer: this.datalayer,
212
- }).addTo(this.datalayer)
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
- this.datalayer.empty()
221
- var layer = new L.U.Polygon(
222
- this.map,
220
+ datalayer.empty()
221
+ var layer = new U.Polygon(
222
+ map,
223
223
  [p2ll(200, 300), p2ll(300, 200), p2ll(200, 100)],
224
- { datalayer: this.datalayer }
225
- ).addTo(this.datalayer)
224
+ { datalayer: datalayer }
225
+ ).addTo(datalayer)
226
226
  layer.edit() // This moves the map to put "other" at the center.
227
- var other = new L.U.Polygon(
228
- this.map,
227
+ var other = new U.Polygon(
228
+ map,
229
229
  [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)],
230
- { datalayer: this.datalayer }
231
- ).addTo(this.datalayer)
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 L.U.Polygon(this.map, [p2ll(100, 100), p2ll(100, 200)], {
246
- datalayer: this.datalayer,
247
- }).addTo(this.datalayer)
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 L.U.Polygon(
254
- this.map,
253
+ var layer = new U.Polygon(
254
+ map,
255
255
  [p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)],
256
- { datalayer: this.datalayer }
257
- ).addTo(this.datalayer)
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(this.datalayer._index.length, 1)
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 L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer }).addTo(
275
- this.datalayer
274
+ layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
275
+ datalayer
276
276
  ),
277
- other = new L.U.Polygon(
278
- this.map,
277
+ other = new U.Polygon(
278
+ map,
279
279
  [p2ll(200, 350), p2ll(200, 300), p2ll(300, 200)],
280
- { datalayer: this.datalayer }
281
- ).addTo(this.datalayer)
282
- assert.ok(this.map.hasLayer(layer))
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(this.map.hasLayer(layer))
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 L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer }).addTo(
298
- this.datalayer
297
+ layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
298
+ datalayer
299
299
  ),
300
- other = new L.U.Polygon(
301
- this.map,
300
+ other = new U.Polygon(
301
+ map,
302
302
  [p2ll(200, 350), p2ll(200, 300), p2ll(300, 200)],
303
- { datalayer: this.datalayer }
304
- ).addTo(this.datalayer)
305
- assert.ok(this.map.hasLayer(layer))
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(this.map.hasLayer(layer))
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 L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer }).addTo(
318
- this.datalayer
317
+ layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
318
+ datalayer
319
319
  )
320
- assert.equal(this.datalayer._index.length, 1)
321
- assert.ok(this.map.hasLayer(layer))
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(this.datalayer._index.length, 1)
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 L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer }).addTo(
336
- this.datalayer
335
+ layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
336
+ datalayer
337
337
  )
338
- assert.equal(this.datalayer._index.length, 1)
339
- assert.ok(this.map.hasLayer(layer))
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(this.datalayer._index.length, 2)
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(this.map.hasLayer(layer))
345
- assert.ok(this.map.hasLayer(other))
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 L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer }).addTo(
355
- this.datalayer
354
+ layer = new U.Polygon(map, latlngs, { datalayer: datalayer }).addTo(
355
+ datalayer
356
356
  )
357
- assert.equal(this.datalayer._index.length, 1)
357
+ assert.equal(datalayer._index.length, 1)
358
358
  other = layer.clone()
359
- assert.ok(this.map.hasLayer(other))
360
- assert.equal(this.datalayer._index.length, 2)
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)