@dra2020/baseclient 1.0.12 → 1.0.13

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.
Files changed (120) hide show
  1. package/package.json +16 -15
  2. package/LICENSE +0 -21
  3. package/README.md +0 -26
  4. package/dist/all/all.d.ts +0 -20
  5. package/dist/baseclient.js +0 -10113
  6. package/dist/baseclient.js.map +0 -1
  7. package/dist/context/all.d.ts +0 -1
  8. package/dist/context/context.d.ts +0 -13
  9. package/dist/filterexpr/all.d.ts +0 -1
  10. package/dist/filterexpr/filterexpr.d.ts +0 -67
  11. package/dist/fsm/all.d.ts +0 -1
  12. package/dist/fsm/fsm.d.ts +0 -119
  13. package/dist/geo/all.d.ts +0 -2
  14. package/dist/geo/geo.d.ts +0 -67
  15. package/dist/geo/vfeature.d.ts +0 -4
  16. package/dist/logabstract/all.d.ts +0 -1
  17. package/dist/logabstract/log.d.ts +0 -26
  18. package/dist/logclient/all.d.ts +0 -1
  19. package/dist/logclient/log.d.ts +0 -6
  20. package/dist/ot-editutil/all.d.ts +0 -2
  21. package/dist/ot-editutil/oteditutil.d.ts +0 -14
  22. package/dist/ot-editutil/otmaputil.d.ts +0 -21
  23. package/dist/ot-js/all.d.ts +0 -9
  24. package/dist/ot-js/otarray.d.ts +0 -111
  25. package/dist/ot-js/otclientengine.d.ts +0 -38
  26. package/dist/ot-js/otcomposite.d.ts +0 -37
  27. package/dist/ot-js/otcounter.d.ts +0 -17
  28. package/dist/ot-js/otengine.d.ts +0 -22
  29. package/dist/ot-js/otmap.d.ts +0 -19
  30. package/dist/ot-js/otserverengine.d.ts +0 -38
  31. package/dist/ot-js/otsession.d.ts +0 -114
  32. package/dist/ot-js/ottypes.d.ts +0 -29
  33. package/dist/poly/all.d.ts +0 -15
  34. package/dist/poly/blend.d.ts +0 -1
  35. package/dist/poly/boundbox.d.ts +0 -16
  36. package/dist/poly/cartesian.d.ts +0 -5
  37. package/dist/poly/graham-scan.d.ts +0 -8
  38. package/dist/poly/hash.d.ts +0 -1
  39. package/dist/poly/matrix.d.ts +0 -24
  40. package/dist/poly/minbound.d.ts +0 -1
  41. package/dist/poly/poly.d.ts +0 -52
  42. package/dist/poly/polybin.d.ts +0 -5
  43. package/dist/poly/polylabel.d.ts +0 -7
  44. package/dist/poly/polypack.d.ts +0 -30
  45. package/dist/poly/polyround.d.ts +0 -1
  46. package/dist/poly/polysimplify.d.ts +0 -1
  47. package/dist/poly/quad.d.ts +0 -48
  48. package/dist/poly/selfintersect.d.ts +0 -1
  49. package/dist/poly/shamos.d.ts +0 -1
  50. package/dist/poly/simplify.d.ts +0 -2
  51. package/dist/poly/topo.d.ts +0 -46
  52. package/dist/poly/union.d.ts +0 -49
  53. package/dist/util/all.d.ts +0 -5
  54. package/dist/util/bintrie.d.ts +0 -93
  55. package/dist/util/countedhash.d.ts +0 -19
  56. package/dist/util/gradient.d.ts +0 -15
  57. package/dist/util/indexedarray.d.ts +0 -15
  58. package/dist/util/util.d.ts +0 -68
  59. package/docs/context.md +0 -2
  60. package/docs/filterexpr.md +0 -22
  61. package/docs/fsm.md +0 -243
  62. package/docs/logabstract.md +0 -2
  63. package/docs/logclient.md +0 -2
  64. package/docs/ot-editutil.md +0 -2
  65. package/docs/ot-js.md +0 -95
  66. package/docs/poly.md +0 -103
  67. package/docs/util.md +0 -2
  68. package/lib/all/all.ts +0 -21
  69. package/lib/context/all.ts +0 -1
  70. package/lib/context/context.ts +0 -82
  71. package/lib/filterexpr/all.ts +0 -1
  72. package/lib/filterexpr/filterexpr.ts +0 -699
  73. package/lib/fsm/all.ts +0 -1
  74. package/lib/fsm/fsm.ts +0 -559
  75. package/lib/geo/all.ts +0 -2
  76. package/lib/geo/geo.ts +0 -452
  77. package/lib/geo/vfeature.ts +0 -34
  78. package/lib/logabstract/all.ts +0 -1
  79. package/lib/logabstract/log.ts +0 -55
  80. package/lib/logclient/all.ts +0 -1
  81. package/lib/logclient/log.ts +0 -105
  82. package/lib/ot-editutil/all.ts +0 -2
  83. package/lib/ot-editutil/oteditutil.ts +0 -180
  84. package/lib/ot-editutil/otmaputil.ts +0 -209
  85. package/lib/ot-js/all.ts +0 -9
  86. package/lib/ot-js/otarray.ts +0 -1168
  87. package/lib/ot-js/otclientengine.ts +0 -327
  88. package/lib/ot-js/otcomposite.ts +0 -247
  89. package/lib/ot-js/otcounter.ts +0 -145
  90. package/lib/ot-js/otengine.ts +0 -71
  91. package/lib/ot-js/otmap.ts +0 -144
  92. package/lib/ot-js/otserverengine.ts +0 -329
  93. package/lib/ot-js/otsession.ts +0 -202
  94. package/lib/ot-js/ottypes.ts +0 -98
  95. package/lib/poly/all.ts +0 -15
  96. package/lib/poly/blend.ts +0 -27
  97. package/lib/poly/boundbox.ts +0 -102
  98. package/lib/poly/cartesian.ts +0 -130
  99. package/lib/poly/graham-scan.ts +0 -401
  100. package/lib/poly/hash.ts +0 -15
  101. package/lib/poly/matrix.ts +0 -309
  102. package/lib/poly/minbound.ts +0 -211
  103. package/lib/poly/poly.ts +0 -767
  104. package/lib/poly/polybin.ts +0 -218
  105. package/lib/poly/polylabel.ts +0 -204
  106. package/lib/poly/polypack.ts +0 -468
  107. package/lib/poly/polyround.ts +0 -30
  108. package/lib/poly/polysimplify.ts +0 -24
  109. package/lib/poly/quad.ts +0 -272
  110. package/lib/poly/selfintersect.ts +0 -87
  111. package/lib/poly/shamos.ts +0 -297
  112. package/lib/poly/simplify.ts +0 -119
  113. package/lib/poly/topo.ts +0 -499
  114. package/lib/poly/union.ts +0 -388
  115. package/lib/util/all.ts +0 -5
  116. package/lib/util/bintrie.ts +0 -603
  117. package/lib/util/countedhash.ts +0 -83
  118. package/lib/util/gradient.ts +0 -108
  119. package/lib/util/indexedarray.ts +0 -80
  120. package/lib/util/util.ts +0 -695
@@ -1,468 +0,0 @@
1
- // Shared libraries
2
- import * as Util from '../util/all';
3
-
4
- // Format for efficient packing of multipolygon coordinates
5
- //
6
- // [n] number of polygons
7
- // [n polygon headers]...
8
- // [n] number of rings
9
- // [n]... number of coordinates in ring
10
- // followed by [x,y]... for all the coordinates
11
-
12
- export interface PolyPack
13
- {
14
- offset: number;
15
- length: number;
16
- buffer: any;
17
- }
18
-
19
- export function polyPackSize(coords: any): number
20
- {
21
- // Null feature?
22
- if (coords == null || (coords.length !== undefined && coords.length == 0)) return 0;
23
-
24
- let depth = Util.depthof(coords);
25
- if (depth == 3) coords = [[ coords ]];
26
- else if (depth == 4) coords = [ coords ]; // normalize to multipolygon
27
- let nFloats: number = 2; // for number of polygons and size of header block
28
- let i: number, j: number;
29
- let p: any, r: any;
30
- for (i = 0; i < coords.length; i++)
31
- {
32
- p = coords[i];
33
- nFloats++; // For number of rings in this polygon
34
- for (j = 0; j < p.length; j++)
35
- {
36
- nFloats++; // For number of coordinates in this ring
37
- r = p[j];
38
- nFloats += r.length * 2; // for each x, y pair
39
- }
40
- }
41
- return nFloats;
42
- }
43
-
44
- type EachRingCB = (buffer: Float64Array, iPoly: number, iRing: number, iOffset: number, nPoints: number) => void;
45
- type EachPointCB = (buffer: Float64Array, iPoly: number, iRing: number, iOffset: number) => void;
46
-
47
- export function polyPackEachRing(pack: PolyPack, cb: EachRingCB): void
48
- {
49
- if (pack == null || pack.buffer == null) return;
50
-
51
- if (pack.offset === undefined) throw 'oops: not a PolyPack';
52
-
53
- let b = pack.buffer;
54
- let iRing: number;
55
- let iOffset: number = pack.offset;
56
- let cOffset: number = b[iOffset+1] + pack.offset;
57
-
58
- // Grab number of polygons
59
- let nPoly: number = b[iOffset++];
60
- // Move past header length
61
- iOffset++;
62
- for (let iPoly: number = 0; iPoly < nPoly; iPoly++)
63
- {
64
- // Grab number of rings in this polygon
65
- let nRing: number = b[iOffset++];
66
- for (let iRing: number = 0; iRing < nRing; iRing++)
67
- {
68
- // Grab number of points in this ring
69
- let nPoints: number = b[iOffset++];
70
- cb(b, iPoly, iRing, cOffset, nPoints);
71
- cOffset += nPoints * 2;
72
- }
73
- }
74
- }
75
-
76
- export function polyPackEachPoint(pack: PolyPack, cb: EachPointCB): void
77
- {
78
- polyPackEachRing(pack, (b: Float64Array, iPoly: number, iRing: number, iOffset: number, nPoints: number) => {
79
- let iEnd: number = iOffset + (nPoints * 2);
80
- for (; iOffset < iEnd; iOffset += 2)
81
- cb(b, iPoly, iRing, iOffset);
82
- });
83
- }
84
-
85
- export function polyPackCountPoints(pack: PolyPack): number
86
- {
87
- let n = 0;
88
- polyPackEachRing(pack, (b: Float64Array, iPoly: number, iRing: number, iOffset: number, nPoints: number) => { n += nPoints });
89
- return n;
90
- }
91
-
92
- export function polyPacked(f: any): boolean
93
- {
94
- if (f == null) return false;
95
- if (f.offset !== undefined) return true;
96
- if (f.geometry !== undefined) return f.geometry.packed !== undefined;
97
- if (f.type === 'FeatureCollection' && f.features !== undefined && f.features.length > 0)
98
- return polyPacked(f.features[0]);
99
- return false;
100
- }
101
-
102
- // Convert to multi-polygon format if necessary
103
- export function normalizeArcs(arcs: any): any
104
- {
105
- let d = Util.depthof(arcs);
106
- while (d < 4) { arcs = [arcs], d++ } // note that depth is n-1 compared to coords because leaf is just number, not [x,y]
107
- return arcs;
108
- }
109
-
110
- export function countArcPolygons(arcs: any): number
111
- {
112
- arcs = normalizeArcs(arcs);
113
- return arcs.length;
114
- }
115
-
116
- export function countArcRings(arcs: any, iPoly?: number): number
117
- {
118
- arcs = normalizeArcs(arcs);
119
- let r = 0;
120
- arcs.forEach((a: any, ip: number) => { if (iPoly === undefined || iPoly === ip) r += a.length })
121
- return r;
122
- }
123
-
124
- export function countOneArcPoints(topo: any, ring: any): number
125
- {
126
- // for each ring
127
- let n = 0;
128
- ring.forEach((i: number, index: number) => {
129
- // for each arc
130
- let a = topo.arcs[i < 0 ? ~i : i];
131
- if (index > 0) n--;
132
- n += a.length;
133
- });
134
- if (n < 4) n = 4;
135
- return n;
136
- }
137
-
138
- export function countArcPoints(topo: any, arcs: any, iPoly?: number): number
139
- {
140
- arcs = normalizeArcs(arcs);
141
- let npoints = 0;
142
- arcs.forEach((polygon: any, ip: number) => {
143
- if (iPoly === undefined || iPoly === ip)
144
- polygon.forEach((ring: any) => { npoints += countOneArcPoints(topo, ring) })
145
- });
146
- return npoints;
147
- }
148
-
149
- // This packs the TopoJSON arc format into a PolyPack. Basics:
150
- // 1) Negative indices indicate arc should be traversed backward.
151
- // 2) First and last point of sequential arcs are duplicated, so only include one instance. Easiest way
152
- // of implementing this (to match topojson implementation) is first delete last point.
153
- // 3) If total number of points < 4, duplicate the first point until you get 4 to meet GeoJSON standard.
154
- // 4) Can also request to pack just a single polygon of a multi-polygon
155
- //
156
- export function polyPackTopoArcs(topo: any, arcs: any, iPoly?: number): PolyPack
157
- {
158
- if (topo == null || arcs == null || arcs.length == 0) return null;
159
- arcs = normalizeArcs(arcs);
160
- let nPoints = countArcPoints(topo, arcs, iPoly);
161
- if (nPoints == 0) return null;
162
- let nFloats = 2 + (2 * countArcRings(arcs, iPoly)) + (2 * nPoints);
163
- let ab = new ArrayBuffer(nFloats * 8);
164
- let prepack: PolyPack = { offset: 0, length: nFloats, buffer: new Float64Array(ab) };
165
- let af = prepack.buffer as Float64Array;
166
- let z = 0;
167
- af[z++] = iPoly === undefined ? countArcPolygons(arcs) : 1;
168
- z++; // spot for header size
169
-
170
- // Fill in header - number of rings in each polygon and number of points in each ring
171
- arcs.forEach((polygon: any, ip: number) => {
172
- if (iPoly === undefined || iPoly === ip)
173
- {
174
- af[z++] = polygon.length;
175
- polygon.forEach((ring: any) => af[z++] = countOneArcPoints(topo, ring));
176
- }
177
- });
178
-
179
- // go back and fill in header size
180
- af[1] = z;
181
-
182
- // now copy in the points
183
- arcs.forEach((polygon: any, ip: number) => {
184
- if (iPoly === undefined || iPoly === ip)
185
- polygon.forEach((ring: any) => {
186
- let b = z;
187
- ring.forEach((i: number, index: number) => {
188
- let a = topo.arcs[i < 0 ? ~i : i];
189
- if (index > 0) z -= 2;
190
- let n = a.length;
191
- let j;
192
- if (i < 0)
193
- for (j = n-1; j >= 0; j--) { let pt: any = a[j]; af[z++] = pt[0], af[z++] = pt[1] }
194
- else
195
- for (j = 0; j < n; j++) { let pt: any = a[j]; af[z++] = pt[0], af[z++] = pt[1] }
196
- });
197
- // need at least 4 points in each ring
198
- if (z != b)
199
- while (z < b+8) { af[z++] = af[b], af[z++] = af[b+1] }
200
- });
201
- });
202
-
203
- return prepack;
204
- }
205
-
206
- export function polyPack(coords: any, prepack?: PolyPack): PolyPack
207
- {
208
- // Null feature?
209
- if (coords == null || (coords.length !== undefined && coords.length == 0)) return null;
210
-
211
- // Actually already a PolyPack?
212
- if (coords.offset !== undefined) return coords as PolyPack;
213
-
214
- // Packed feature?
215
- if (coords && coords.geometry && coords.geometry.packed !== undefined)
216
- return coords.geometry.packed as PolyPack;
217
-
218
- // Unpacked feature, grab the coordinates array
219
- if (coords && coords.geometry)
220
- coords = coords.geometry.coordinates;
221
-
222
- // Transparently handle polygon or multi-polygon
223
- let depth = Util.depthof(coords);
224
- if (depth == 2) coords = [ [ [ coords ] ] ];
225
- else if (depth == 3) coords = [ [ coords ] ];
226
- else if (depth == 4) coords = [ coords ];
227
-
228
- let nFloats = polyPackSize(coords);
229
- let i: number, j: number, k: number;
230
- let p: any, r: any;
231
-
232
- // Allocate typed buffer if not passed in
233
- if (prepack === undefined)
234
- {
235
- let ab = new ArrayBuffer(nFloats * 8);
236
- prepack = { offset: 0, length: nFloats, buffer: new Float64Array(ab) };
237
- }
238
- else
239
- {
240
- prepack = Util.shallowCopy(prepack);
241
- prepack.length = nFloats;
242
- }
243
-
244
- let af: Float64Array = prepack.buffer as Float64Array;
245
-
246
- // Fill in header
247
- let z: number = prepack.offset;
248
- af[z++] = coords.length;
249
- z++; // spot for header size
250
- for (i = 0; i < coords.length; i++)
251
- {
252
- p = coords[i];
253
- af[z++] = p.length;
254
- for (j = 0; j < p.length; j++)
255
- af[z++] = p[j].length;
256
- }
257
-
258
- // set header size back in header
259
- af[prepack.offset+1] = z - prepack.offset;
260
-
261
- // Fill in coords
262
- for (i = 0; i < coords.length; i++)
263
- {
264
- p = coords[i];
265
- for (j = 0; j < p.length; j++)
266
- {
267
- r = p[j];
268
- for (k = 0; k < r.length; k++)
269
- {
270
- af[z++] = r[k][0];
271
- af[z++] = r[k][1];
272
- }
273
- }
274
- }
275
-
276
- return prepack;
277
- }
278
-
279
- export function polyPackCopy(coords: any): PolyPack
280
- {
281
- let pp = polyPack(coords);
282
-
283
- if (pp == null) return null;
284
-
285
- let copy: PolyPack = { offset: 0, length: pp.length, buffer: null };
286
- let ab = new ArrayBuffer(pp.length * 8);
287
- let afDst = new Float64Array(ab);
288
- copy.buffer = afDst;
289
- let afSrc = pp.buffer as Float64Array;
290
- for (let i = 0; i < pp.length; i++)
291
- afDst[i] = afSrc[i+pp.offset];
292
- return copy;
293
- }
294
-
295
- export function polyUnpack(prepack: any): any
296
- {
297
- // Check if not packed
298
- if (prepack == null) return [];
299
- if (prepack.offset === undefined) return prepack;
300
-
301
- let i: number, j: number, k: number;
302
- let nPolys: number, nRings: number, nCoords: number;
303
- let p: any, r: any;
304
- let af: Float64Array = prepack.buffer as Float64Array;
305
- let coords: any = [];
306
- let h: number = prepack.offset as number;
307
- nPolys = af[h++];
308
- let z = af[h++] + prepack.offset; // start of coordinates
309
- for (i = 0; i < nPolys; i++)
310
- {
311
- p = [];
312
- coords[i] = p;
313
- nRings = af[h++];
314
- for (j = 0; j < nRings; j++)
315
- {
316
- r = [];
317
- p[j] = r;
318
- nCoords = af[h++];
319
- for (k = 0; k < nCoords; k++)
320
- r[k] = [ af[z++], af[z++] ];
321
- }
322
- }
323
-
324
- return coords.length > 1 ? coords : coords[0];
325
- }
326
-
327
- export function featurePackSize(f: any): number
328
- {
329
- if (f && f.geometry && f.geometry.coordinates)
330
- return polyPackSize(f.geometry.coordinates);
331
- return 0;
332
- }
333
-
334
- export function featurePack(f: any, prepack?: PolyPack): any
335
- {
336
- if (f && f.type === 'Feature')
337
- {
338
- if (f.geometry && f.geometry.coordinates)
339
- {
340
- f.geometry.packed = polyPack(f.geometry.coordinates, prepack);
341
- delete f.geometry.coordinates;
342
- }
343
- else if (f.geometry === undefined)
344
- {
345
- f.geometry = {}
346
- f.geometry.packed = prepack ? { offset: prepack.offset, length: 0, buffer: prepack.buffer } : { offset: 0, length: 0, buffer: null };
347
- }
348
- return f.geometry.packed;
349
- }
350
- else if (f.type && f.type === 'FeatureCollection' && f.features)
351
- {
352
- // Allocate one large buffer
353
- let nFloats: number = 0;
354
- let i: number;
355
- for (i = 0; i < f.features.length; i++)
356
- nFloats += featurePackSize(f.features[i]);
357
- let ab = new ArrayBuffer(nFloats * 8);
358
- prepack = { offset: 0, length: nFloats, buffer: new Float64Array(ab) };
359
-
360
- // Now pack
361
- for (i = 0; i < f.features.length; i++)
362
- {
363
- let postpack = featurePack(f.features[i], prepack);
364
- prepack.offset += postpack ? postpack.length : 0;
365
- }
366
- if (prepack.offset != nFloats)
367
- throw 'oops, packing bug';
368
- return prepack;
369
- }
370
- return null;
371
- }
372
-
373
- export function featureUnpack(f: any): any
374
- {
375
- if (f && f.geometry && f.geometry.packed !== undefined)
376
- {
377
- f.geometry.coordinates = polyUnpack(f.geometry.packed);
378
- let depth = Util.depthof(f.geometry.coordinates);
379
- // Check for oops, optimized away the multipolygon in polyUnpack
380
- if (f.geometry.type === 'MultiPolygon' && depth === 4)
381
- f.geometry.coordinates = [ f.geometry.coordinates ];
382
- else if (f.geometry.type === 'Point' && depth != 2)
383
- {
384
- while (depth > 2)
385
- {
386
- f.geometry.coordinates = f.geometry.coordinates[0];
387
- depth = Util.depthof(f.geometry.coordinates);
388
- }
389
- }
390
- delete f.geometry.packed;
391
- }
392
- else if (f.type && f.type === 'FeatureCollection' && f.features)
393
- {
394
- for (let i: number = 0; i < f.features.length; i++)
395
- featureUnpack(f.features[i]);
396
- }
397
- return f;
398
- }
399
-
400
- export type SavePack = WeakMap<any,any>;
401
-
402
- export function featureUnpackTemporarily(f: any, save?: SavePack): SavePack
403
- {
404
- if (save === undefined) save = new WeakMap<any,any>();
405
-
406
- if (f && f.type === 'Feature')
407
- {
408
- if (f.geometry && f.geometry.packed)
409
- {
410
- save.set(f, f.geometry.packed);
411
- featureUnpack(f);
412
- }
413
- }
414
- else if (f.type && f.type === 'FeatureCollection' && f.features)
415
- {
416
- f.features.forEach((ff: any) => {
417
- if (ff.geometry && ff.geometry.packed)
418
- save.set(ff, ff.geometry.packed);
419
- });
420
- featureUnpack(f);
421
- }
422
- return save;
423
- }
424
-
425
- export function featureRepack(f: any, save: SavePack): any
426
- {
427
- if (f && f.type === 'Feature')
428
- {
429
- if (f.geometry)
430
- {
431
- let packed = save.get(f);
432
- if (packed)
433
- {
434
- f.geometry.packed = packed;
435
- delete f.geometry.coordinates;
436
- }
437
- }
438
- }
439
- else if (f.type && f.type === 'FeatureCollection' && f.features)
440
- {
441
- f.features.forEach((ff: any) => featureRepack(ff, save));
442
- }
443
- return f;
444
- }
445
-
446
- export function featurePackString(f: any): string
447
- {
448
- let packed = f.offset ? f : (f.geometry.packed ? f.geometry.packed : polyPack(f.geometry.coordinates));
449
- let af = packed.buffer as Float64Array;
450
- let a: string[] = [];
451
- for (let i: number = 0; i < packed.length; i++)
452
- a.push(String(af[i]));
453
- return a.join(' ');
454
- }
455
-
456
- export function featureUnpackString(s: string): any
457
- {
458
- let a = s.split(' ');
459
- let ab = new ArrayBuffer(a.length * 8);
460
- let af = new Float64Array(ab);
461
- let i: number = 0;
462
- a.forEach((n: string) => { af[i++] = Number(n) });
463
- let f: any = { type: 'Feature', geometry: {type: 'Polygon', packed: { offset: 0, length: a.length, buffer: af } } };
464
- f = featureUnpack(f);
465
- if (Util.depthof(f.geometry.coordinates) === 5)
466
- f.geometry.type = 'MultiPolygon';
467
- return f;
468
- }
@@ -1,30 +0,0 @@
1
- import * as Util from '../util/all';
2
- import * as PP from './polypack';
3
-
4
- // Round feature geometry to 6 decimal precision
5
- export function polyRound(o: any): any
6
- {
7
- if (o)
8
- {
9
- if (Array.isArray(o))
10
- {
11
- if (o.length && typeof o[0] === 'number')
12
- {
13
- for (let i = 0; i < o.length; i++)
14
- o[i] = Util.precisionRound(o[i], 6);
15
- }
16
- else
17
- o.forEach((e: any) => { polyRound(e) });
18
- }
19
- else if (o.features !== undefined && Array.isArray(o.features))
20
- o.features.forEach((f: any) => { polyRound(f) });
21
- else if (o.geometry !== undefined && o.geometry.coordinates !== undefined)
22
- polyRound(o.geometry.coordinates);
23
- else if (o.geometry !== undefined && o.geometry.packed !== undefined)
24
- PP.polyPackEachPoint(o.geometry.packed, (b: Float64Array, iPoly: number, iRing: number, iOffset: number) => {
25
- b[iOffset] = Util.precisionRound(b[iOffset], 6);
26
- b[iOffset+1] = Util.precisionRound(b[iOffset+1], 6);
27
- });
28
- }
29
- return o;
30
- }
@@ -1,24 +0,0 @@
1
- import * as Util from '../util/all';
2
-
3
- import { simplify } from './simplify';
4
-
5
- export function polySimplify(poly: any, tolerance: number = 0.0001): void
6
- {
7
- if (poly == null) return;
8
- if (poly.geometry && poly.geometry.coordinates) poly = poly.geometry.coordinates;
9
- let depth = Util.depthof(poly);
10
- if (depth == 4)
11
- poly = [ poly ];
12
- else if (depth != 5)
13
- return;
14
-
15
- // Poly is multi-polygon, array of polygons
16
- for (let i: number = 0; i < poly.length; i++)
17
- {
18
- // p is polygon, array of rings, each ring is array of points which is what gets fed to underlying simplify routine.
19
- let p = poly[i];
20
-
21
- for (let j: number = 0; j < p.length; j++)
22
- p[j] = simplify(p[j], tolerance, true);
23
- }
24
- }