umap-project 1.14.0a1__py3-none-any.whl → 1.14.0a2__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 (182) hide show
  1. umap/__init__.py +1 -1
  2. umap/static/.gitignore +0 -0
  3. umap/static/umap/base.css +994 -0
  4. umap/static/umap/bitbucket.png +0 -0
  5. umap/static/umap/content.css +395 -0
  6. umap/static/umap/favicons/apple-touch-icon.png +0 -0
  7. umap/static/umap/favicons/favicon.ico +0 -0
  8. umap/static/umap/favicons/icon-192.png +0 -0
  9. umap/static/umap/favicons/icon-512.png +0 -0
  10. umap/static/umap/favicons/icon.svg +5 -0
  11. umap/static/umap/font/FiraSans-Light.woff +0 -0
  12. umap/static/umap/font/FiraSans-Light.woff2 +0 -0
  13. umap/static/umap/font/FiraSans-LightItalic.woff +0 -0
  14. umap/static/umap/font/FiraSans-LightItalic.woff2 +0 -0
  15. umap/static/umap/font/FiraSans-SemiBold.woff +0 -0
  16. umap/static/umap/font/FiraSans-SemiBold.woff2 +0 -0
  17. umap/static/umap/font.css +33 -0
  18. umap/static/umap/github.png +0 -0
  19. umap/static/umap/img/16-white.svg +190 -0
  20. umap/static/umap/img/16.svg +182 -0
  21. umap/static/umap/img/24-white.svg +62 -0
  22. umap/static/umap/img/24.svg +90 -0
  23. umap/static/umap/img/edit.svg +7 -0
  24. umap/static/umap/img/icon-bg.png +0 -0
  25. umap/static/umap/img/logo.svg +4 -0
  26. umap/static/umap/img/logo_filigree.png +0 -0
  27. umap/static/umap/img/logo_small.svg +14 -0
  28. umap/static/umap/img/marker.png +0 -0
  29. umap/static/umap/img/opensource.svg +7 -0
  30. umap/static/umap/img/osm.svg +7 -0
  31. umap/static/umap/img/search.gif +0 -0
  32. umap/static/umap/img/source/16-white.svg +980 -0
  33. umap/static/umap/img/source/16.svg +201 -0
  34. umap/static/umap/img/source/24-white.svg +83 -0
  35. umap/static/umap/img/source/24.svg +110 -0
  36. umap/static/umap/js/components/fragment.js +13 -0
  37. umap/static/umap/js/modules/global.js +8 -0
  38. umap/static/umap/js/modules/urls.js +29 -0
  39. umap/static/umap/js/umap.autocomplete.js +336 -0
  40. umap/static/umap/js/umap.browser.js +148 -0
  41. umap/static/umap/js/umap.controls.js +1542 -0
  42. umap/static/umap/js/umap.core.js +851 -0
  43. umap/static/umap/js/umap.datalayer.permissions.js +72 -0
  44. umap/static/umap/js/umap.features.js +1216 -0
  45. umap/static/umap/js/umap.forms.js +1267 -0
  46. umap/static/umap/js/umap.icon.js +234 -0
  47. umap/static/umap/js/umap.importer.js +166 -0
  48. umap/static/umap/js/umap.js +2010 -0
  49. umap/static/umap/js/umap.layer.js +1636 -0
  50. umap/static/umap/js/umap.permissions.js +212 -0
  51. umap/static/umap/js/umap.popup.js +340 -0
  52. umap/static/umap/js/umap.share.js +254 -0
  53. umap/static/umap/js/umap.slideshow.js +165 -0
  54. umap/static/umap/js/umap.tableeditor.js +120 -0
  55. umap/static/umap/js/umap.ui.js +240 -0
  56. umap/static/umap/js/umap.xhr.js +304 -0
  57. umap/static/umap/locale/am_ET.js +447 -0
  58. umap/static/umap/locale/am_ET.json +445 -0
  59. umap/static/umap/locale/ar.js +447 -0
  60. umap/static/umap/locale/ar.json +445 -0
  61. umap/static/umap/locale/ast.js +447 -0
  62. umap/static/umap/locale/ast.json +445 -0
  63. umap/static/umap/locale/bg.js +447 -0
  64. umap/static/umap/locale/bg.json +445 -0
  65. umap/static/umap/locale/br.js +447 -0
  66. umap/static/umap/locale/br.json +445 -0
  67. umap/static/umap/locale/ca.js +447 -0
  68. umap/static/umap/locale/ca.json +445 -0
  69. umap/static/umap/locale/cs_CZ.js +447 -0
  70. umap/static/umap/locale/cs_CZ.json +445 -0
  71. umap/static/umap/locale/da.js +447 -0
  72. umap/static/umap/locale/da.json +445 -0
  73. umap/static/umap/locale/de.js +447 -0
  74. umap/static/umap/locale/de.json +445 -0
  75. umap/static/umap/locale/el.js +447 -0
  76. umap/static/umap/locale/el.json +445 -0
  77. umap/static/umap/locale/en.js +447 -0
  78. umap/static/umap/locale/en.json +445 -0
  79. umap/static/umap/locale/en_US.json +445 -0
  80. umap/static/umap/locale/es.js +447 -0
  81. umap/static/umap/locale/es.json +445 -0
  82. umap/static/umap/locale/et.js +447 -0
  83. umap/static/umap/locale/et.json +445 -0
  84. umap/static/umap/locale/eu.js +413 -0
  85. umap/static/umap/locale/eu.json +411 -0
  86. umap/static/umap/locale/fa_IR.js +447 -0
  87. umap/static/umap/locale/fa_IR.json +445 -0
  88. umap/static/umap/locale/fi.js +447 -0
  89. umap/static/umap/locale/fi.json +445 -0
  90. umap/static/umap/locale/fr.js +447 -0
  91. umap/static/umap/locale/fr.json +445 -0
  92. umap/static/umap/locale/gl.js +447 -0
  93. umap/static/umap/locale/gl.json +445 -0
  94. umap/static/umap/locale/he.js +447 -0
  95. umap/static/umap/locale/he.json +445 -0
  96. umap/static/umap/locale/hr.js +447 -0
  97. umap/static/umap/locale/hr.json +445 -0
  98. umap/static/umap/locale/hu.js +447 -0
  99. umap/static/umap/locale/hu.json +445 -0
  100. umap/static/umap/locale/id.js +447 -0
  101. umap/static/umap/locale/id.json +445 -0
  102. umap/static/umap/locale/is.js +447 -0
  103. umap/static/umap/locale/is.json +445 -0
  104. umap/static/umap/locale/it.js +447 -0
  105. umap/static/umap/locale/it.json +445 -0
  106. umap/static/umap/locale/ja.js +447 -0
  107. umap/static/umap/locale/ja.json +445 -0
  108. umap/static/umap/locale/ko.js +447 -0
  109. umap/static/umap/locale/ko.json +445 -0
  110. umap/static/umap/locale/lt.js +447 -0
  111. umap/static/umap/locale/lt.json +445 -0
  112. umap/static/umap/locale/ms.js +447 -0
  113. umap/static/umap/locale/ms.json +445 -0
  114. umap/static/umap/locale/nl.js +447 -0
  115. umap/static/umap/locale/nl.json +445 -0
  116. umap/static/umap/locale/no.js +447 -0
  117. umap/static/umap/locale/no.json +445 -0
  118. umap/static/umap/locale/pl.js +447 -0
  119. umap/static/umap/locale/pl.json +445 -0
  120. umap/static/umap/locale/pl_PL.json +445 -0
  121. umap/static/umap/locale/pt.js +447 -0
  122. umap/static/umap/locale/pt.json +445 -0
  123. umap/static/umap/locale/pt_BR.js +447 -0
  124. umap/static/umap/locale/pt_BR.json +445 -0
  125. umap/static/umap/locale/pt_PT.js +447 -0
  126. umap/static/umap/locale/pt_PT.json +445 -0
  127. umap/static/umap/locale/ro.js +447 -0
  128. umap/static/umap/locale/ro.json +445 -0
  129. umap/static/umap/locale/ru.js +447 -0
  130. umap/static/umap/locale/ru.json +445 -0
  131. umap/static/umap/locale/si.js +439 -0
  132. umap/static/umap/locale/si.json +437 -0
  133. umap/static/umap/locale/sk_SK.js +447 -0
  134. umap/static/umap/locale/sk_SK.json +445 -0
  135. umap/static/umap/locale/sl.js +447 -0
  136. umap/static/umap/locale/sl.json +445 -0
  137. umap/static/umap/locale/sr.js +447 -0
  138. umap/static/umap/locale/sr.json +445 -0
  139. umap/static/umap/locale/sv.js +447 -0
  140. umap/static/umap/locale/sv.json +445 -0
  141. umap/static/umap/locale/th_TH.js +447 -0
  142. umap/static/umap/locale/th_TH.json +445 -0
  143. umap/static/umap/locale/tr.js +447 -0
  144. umap/static/umap/locale/tr.json +445 -0
  145. umap/static/umap/locale/uk_UA.js +447 -0
  146. umap/static/umap/locale/uk_UA.json +445 -0
  147. umap/static/umap/locale/vi.js +447 -0
  148. umap/static/umap/locale/vi.json +445 -0
  149. umap/static/umap/locale/vi_VN.json +445 -0
  150. umap/static/umap/locale/zh.js +447 -0
  151. umap/static/umap/locale/zh.json +445 -0
  152. umap/static/umap/locale/zh_CN.json +445 -0
  153. umap/static/umap/locale/zh_TW.Big5.json +445 -0
  154. umap/static/umap/locale/zh_TW.js +447 -0
  155. umap/static/umap/locale/zh_TW.json +445 -0
  156. umap/static/umap/map.css +1843 -0
  157. umap/static/umap/nav.css +81 -0
  158. umap/static/umap/openstreetmap.png +0 -0
  159. umap/static/umap/test/.eslintrc +22 -0
  160. umap/static/umap/test/Choropleth.js +243 -0
  161. umap/static/umap/test/Controls.js +100 -0
  162. umap/static/umap/test/DataLayer.js +495 -0
  163. umap/static/umap/test/Feature.js +382 -0
  164. umap/static/umap/test/Map.Export.js +106 -0
  165. umap/static/umap/test/Map.Init.js +46 -0
  166. umap/static/umap/test/Map.js +342 -0
  167. umap/static/umap/test/Marker.js +122 -0
  168. umap/static/umap/test/Permissions.js +74 -0
  169. umap/static/umap/test/Polygon.js +367 -0
  170. umap/static/umap/test/Polyline.js +402 -0
  171. umap/static/umap/test/TableEditor.js +100 -0
  172. umap/static/umap/test/URLs.js +54 -0
  173. umap/static/umap/test/Util.js +549 -0
  174. umap/static/umap/test/_pre.js +460 -0
  175. umap/static/umap/test/index.html +135 -0
  176. umap/static/umap/theme.css +1 -0
  177. umap/static/umap/twitter.png +0 -0
  178. {umap_project-1.14.0a1.dist-info → umap_project-1.14.0a2.dist-info}/METADATA +1 -1
  179. {umap_project-1.14.0a1.dist-info → umap_project-1.14.0a2.dist-info}/RECORD +182 -6
  180. {umap_project-1.14.0a1.dist-info → umap_project-1.14.0a2.dist-info}/WHEEL +0 -0
  181. {umap_project-1.14.0a1.dist-info → umap_project-1.14.0a2.dist-info}/entry_points.txt +0 -0
  182. {umap_project-1.14.0a1.dist-info → umap_project-1.14.0a2.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,367 @@
1
+ describe('L.U.Polygon', 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 Polygon', function () {
25
+ var layer = new L.U.Polygon(
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 Polygon', function () {
38
+ var latlngs = [[[p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)]]],
39
+ layer = new L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer })
40
+ assert.notOk(layer.isMulti())
41
+ })
42
+
43
+ it('should return false for simple Polygon with hole', function () {
44
+ var layer = new L.U.Polygon(
45
+ this.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: this.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 L.U.Polygon(this.map, latLngs, { datalayer: this.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 L.U.Polygon(this.map, latLngs, { datalayer: this.datalayer })
107
+ assert.ok(layer.isMulti())
108
+ })
109
+ })
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 L.U.Polygon(this.map, latlngs, {
124
+ datalayer: this.datalayer,
125
+ }).addTo(this.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 L.U.Polygon(this.map, latlngs, {
133
+ datalayer: this.datalayer,
134
+ }).addTo(this.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 L.U.Polygon(this.map, latlngs, {
142
+ datalayer: this.datalayer,
143
+ }).addTo(this.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 L.U.Polygon(this.map, latlngs, {
154
+ datalayer: this.datalayer,
155
+ }).addTo(this.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 L.U.Polygon(this.map, latlngs, {
166
+ datalayer: this.datalayer,
167
+ }).addTo(this.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 L.U.Polygon(this.map, latlngs, {
180
+ datalayer: this.datalayer,
181
+ }).addTo(this.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 L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer }).addTo(
189
+ this.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 L.U.Polygon(this.map, [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)], {
197
+ datalayer: this.datalayer,
198
+ }).addTo(this.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 L.U.Polygon(
206
+ this.map,
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)
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
+ this.datalayer.empty()
221
+ var layer = new L.U.Polygon(
222
+ this.map,
223
+ [p2ll(200, 300), p2ll(300, 200), p2ll(200, 100)],
224
+ { datalayer: this.datalayer }
225
+ ).addTo(this.datalayer)
226
+ layer.edit() // This moves the map to put "other" at the center.
227
+ var other = new L.U.Polygon(
228
+ this.map,
229
+ [p2ll(100, 150), p2ll(100, 200), p2ll(200, 150)],
230
+ { datalayer: this.datalayer }
231
+ ).addTo(this.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 L.U.Polygon(this.map, [p2ll(100, 100), p2ll(100, 200)], {
246
+ datalayer: this.datalayer,
247
+ }).addTo(this.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 L.U.Polygon(
254
+ this.map,
255
+ [p2ll(100, 150), p2ll(150, 200), p2ll(200, 100)],
256
+ { datalayer: this.datalayer }
257
+ ).addTo(this.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(this.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 L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer }).addTo(
275
+ this.datalayer
276
+ ),
277
+ other = new L.U.Polygon(
278
+ this.map,
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))
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(this.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 L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer }).addTo(
298
+ this.datalayer
299
+ ),
300
+ other = new L.U.Polygon(
301
+ this.map,
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))
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(this.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 L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer }).addTo(
318
+ this.datalayer
319
+ )
320
+ assert.equal(this.datalayer._index.length, 1)
321
+ assert.ok(this.map.hasLayer(layer))
322
+ layer.isolateShape(p2ll(150, 150))
323
+ assert.equal(layer._latlngs[0].length, 3)
324
+ assert.equal(this.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 L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer }).addTo(
336
+ this.datalayer
337
+ )
338
+ assert.equal(this.datalayer._index.length, 1)
339
+ assert.ok(this.map.hasLayer(layer))
340
+ var other = layer.isolateShape(p2ll(150, 150))
341
+ assert.equal(this.datalayer._index.length, 2)
342
+ assert.equal(other._latlngs.length, 2)
343
+ assert.deepEqual(other._latlngs[0], latlngs[0][0])
344
+ assert.ok(this.map.hasLayer(layer))
345
+ assert.ok(this.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 L.U.Polygon(this.map, latlngs, { datalayer: this.datalayer }).addTo(
355
+ this.datalayer
356
+ )
357
+ assert.equal(this.datalayer._index.length, 1)
358
+ other = layer.clone()
359
+ assert.ok(this.map.hasLayer(other))
360
+ assert.equal(this.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
+ })