dgeoutils 2.3.6 → 2.4.1

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.
@@ -36,366 +36,361 @@ var LoopFunctions;
36
36
  LoopFunctions[LoopFunctions["metersToDegree"] = 30] = "metersToDegree";
37
37
  LoopFunctions[LoopFunctions["flipVertically"] = 31] = "flipVertically";
38
38
  })(LoopFunctions || (LoopFunctions = {}));
39
- var decodePoolRecord = function (a, _a) {
40
- var functionName = _a.functionName, pointArg = _a.pointArg, numberPointArg = _a.numberPointArg, numberArg = _a.numberArg, setterArg = _a.setterArg;
41
- var res = a;
39
+ const decodePoolRecord = (a, { functionName, pointArg, numberPointArg, numberArg, setterArg }) => {
40
+ let res = a;
42
41
  switch (functionName) {
43
42
  case LoopFunctions.getTileFromCoords:
44
- res = function (k) { return a(k)
45
- .getTileFromCoords(numberArg); };
43
+ res = (k) => a(k)
44
+ .getTileFromCoords(numberArg);
46
45
  break;
47
46
  case LoopFunctions.getCoordsFromTile:
48
- res = function (k) { return a(k)
49
- .getCoordsFromTile(numberArg); };
47
+ res = (k) => a(k)
48
+ .getCoordsFromTile(numberArg);
50
49
  break;
51
50
  case LoopFunctions.height:
52
- res = function (k) { return a(k)
53
- .height(numberArg); };
51
+ res = (k) => a(k)
52
+ .height(numberArg);
54
53
  break;
55
54
  case LoopFunctions.setX:
56
- res = function (k) { return a(k)
57
- .setX(setterArg); };
55
+ res = (k) => a(k)
56
+ .setX(setterArg);
58
57
  break;
59
58
  case LoopFunctions.setY:
60
- res = function (k) { return a(k)
61
- .setY(setterArg); };
59
+ res = (k) => a(k)
60
+ .setY(setterArg);
62
61
  break;
63
62
  case LoopFunctions.setZ:
64
- res = function (k) { return a(k)
65
- .setZ(setterArg); };
63
+ res = (k) => a(k)
64
+ .setZ(setterArg);
66
65
  break;
67
66
  case LoopFunctions.rotate:
68
- res = function (k) { return a(k)
69
- .rotate(numberArg); };
67
+ res = (k) => a(k)
68
+ .rotate(numberArg);
70
69
  break;
71
70
  case LoopFunctions.rotate3dX:
72
- res = function (k) { return a(k)
73
- .rotate3dX(numberArg); };
71
+ res = (k) => a(k)
72
+ .rotate3dX(numberArg);
74
73
  break;
75
74
  case LoopFunctions.rotate3dY:
76
- res = function (k) { return a(k)
77
- .rotate3dY(numberArg); };
75
+ res = (k) => a(k)
76
+ .rotate3dY(numberArg);
78
77
  break;
79
78
  case LoopFunctions.rotate3dZ:
80
- res = function (k) { return a(k)
81
- .rotate3dZ(numberArg); };
79
+ res = (k) => a(k)
80
+ .rotate3dZ(numberArg);
82
81
  break;
83
82
  case LoopFunctions.move:
84
- res = function (k) { return a(k)
85
- .move(numberPointArg, numberArg); };
83
+ res = (k) => a(k)
84
+ .move(numberPointArg, numberArg);
86
85
  break;
87
86
  case LoopFunctions.round:
88
- res = function (k) { return a(k)
89
- .round(); };
87
+ res = (k) => a(k)
88
+ .round();
90
89
  break;
91
90
  case LoopFunctions.ceil:
92
- res = function (k) { return a(k)
93
- .ceil(); };
91
+ res = (k) => a(k)
92
+ .ceil();
94
93
  break;
95
94
  case LoopFunctions.floor:
96
- res = function (k) { return a(k)
97
- .floor(); };
95
+ res = (k) => a(k)
96
+ .floor();
98
97
  break;
99
98
  case LoopFunctions.toFixed:
100
- res = function (k) { return a(k)
101
- .toFixed(numberArg); };
99
+ res = (k) => a(k)
100
+ .toFixed(numberArg);
102
101
  break;
103
102
  case LoopFunctions.abs:
104
- res = function (k) { return a(k)
105
- .abs(); };
103
+ res = (k) => a(k)
104
+ .abs();
106
105
  break;
107
106
  case LoopFunctions.scale:
108
- res = function (k) { return a(k)
109
- .scale(numberPointArg, numberArg); };
107
+ res = (k) => a(k)
108
+ .scale(numberPointArg, numberArg);
110
109
  break;
111
110
  case LoopFunctions.divide:
112
- res = function (k) { return a(k)
113
- .divide(numberPointArg, numberArg); };
111
+ res = (k) => a(k)
112
+ .divide(numberPointArg, numberArg);
114
113
  break;
115
114
  case LoopFunctions.degreeToRadians:
116
- res = function (k) { return a(k)
117
- .degreeToRadians(); };
115
+ res = (k) => a(k)
116
+ .degreeToRadians();
118
117
  break;
119
118
  case LoopFunctions.radiansToDegrees:
120
- res = function (k) { return a(k)
121
- .radiansToDegrees(); };
119
+ res = (k) => a(k)
120
+ .radiansToDegrees();
122
121
  break;
123
122
  case LoopFunctions.radiansToMeters:
124
- res = function (k) { return a(k)
125
- .radiansToMeters(); };
123
+ res = (k) => a(k)
124
+ .radiansToMeters();
126
125
  break;
127
126
  case LoopFunctions.metersToRadians:
128
- res = function (k) { return a(k)
129
- .metersToRadians(); };
127
+ res = (k) => a(k)
128
+ .metersToRadians();
130
129
  break;
131
130
  case LoopFunctions.hipPoint:
132
- res = function (k) { return a(k)
133
- .hipPoint; };
131
+ res = (k) => a(k)
132
+ .hipPoint;
134
133
  break;
135
134
  case LoopFunctions.xPoint:
136
- res = function (k) { return a(k)
137
- .xPoint; };
135
+ res = (k) => a(k)
136
+ .xPoint;
138
137
  break;
139
138
  case LoopFunctions.yPoint:
140
- res = function (k) { return a(k)
141
- .yPoint; };
139
+ res = (k) => a(k)
140
+ .yPoint;
142
141
  break;
143
142
  case LoopFunctions.wPoint:
144
- res = function (k) { return a(k)
145
- .wPoint; };
143
+ res = (k) => a(k)
144
+ .wPoint;
146
145
  break;
147
146
  case LoopFunctions.hPoint:
148
- res = function (k) { return a(k)
149
- .hPoint; };
147
+ res = (k) => a(k)
148
+ .hPoint;
150
149
  break;
151
150
  case LoopFunctions.setIfLessThan:
152
- res = function (k) { return a(k)
153
- .setIfLessThan(pointArg); };
151
+ res = (k) => a(k)
152
+ .setIfLessThan(pointArg);
154
153
  break;
155
154
  case LoopFunctions.minus:
156
- res = function (k) { return a(k)
157
- .minus(); };
155
+ res = (k) => a(k)
156
+ .minus();
158
157
  break;
159
158
  case LoopFunctions.degreeToMeters:
160
- res = function (k) { return a(k)
161
- .degreeToMeters(); };
159
+ res = (k) => a(k)
160
+ .degreeToMeters();
162
161
  break;
163
162
  case LoopFunctions.metersToDegree:
164
- res = function (k) { return a(k)
165
- .metersToDegree(); };
163
+ res = (k) => a(k)
164
+ .metersToDegree();
166
165
  break;
167
166
  case LoopFunctions.flipVertically:
168
- res = function (k) { return a(k)
169
- .flipVertically(numberPointArg); };
167
+ res = (k) => a(k)
168
+ .flipVertically(numberPointArg);
170
169
  break;
171
170
  }
172
171
  return res;
173
172
  };
174
- var DPolygonLoop = (function () {
175
- function DPolygonLoop(parent) {
173
+ class DPolygonLoop {
174
+ constructor(parent) {
176
175
  this.parent = parent;
177
176
  this.pool = [];
178
177
  }
179
- DPolygonLoop.prototype.getLoopFunction = function () {
180
- return this.pool.reduce(decodePoolRecord, function (k) { return k; });
181
- };
182
- DPolygonLoop.prototype.run = function () {
178
+ getLoopFunction() {
179
+ return this.pool.reduce(decodePoolRecord, (k) => k);
180
+ }
181
+ run() {
183
182
  return this.parent.map(this.getLoopFunction());
184
- };
185
- DPolygonLoop.prototype.getTileFromCoords = function (zoom) {
183
+ }
184
+ getTileFromCoords(zoom) {
186
185
  this.pool.push({
187
186
  functionName: LoopFunctions.getTileFromCoords,
188
187
  numberArg: zoom
189
188
  });
190
189
  return this;
191
- };
192
- DPolygonLoop.prototype.getCoordsFromTile = function (zoom) {
190
+ }
191
+ getCoordsFromTile(zoom) {
193
192
  this.pool.push({
194
193
  functionName: LoopFunctions.getCoordsFromTile,
195
194
  numberArg: zoom
196
195
  });
197
196
  return this;
198
- };
199
- DPolygonLoop.prototype.height = function (z) {
197
+ }
198
+ height(z) {
200
199
  this.pool.push({
201
200
  functionName: LoopFunctions.height,
202
201
  numberArg: z
203
202
  });
204
203
  return this;
205
- };
206
- DPolygonLoop.prototype.setX = function (x) {
204
+ }
205
+ setX(x) {
207
206
  this.pool.push({
208
207
  functionName: LoopFunctions.setX,
209
208
  setterArg: x
210
209
  });
211
210
  return this;
212
- };
213
- DPolygonLoop.prototype.setY = function (y) {
211
+ }
212
+ setY(y) {
214
213
  this.pool.push({
215
214
  functionName: LoopFunctions.setY,
216
215
  setterArg: y
217
216
  });
218
217
  return this;
219
- };
220
- DPolygonLoop.prototype.setZ = function (z) {
218
+ }
219
+ setZ(z) {
221
220
  this.pool.push({
222
221
  functionName: LoopFunctions.setZ,
223
222
  setterArg: z
224
223
  });
225
224
  return this;
226
- };
227
- DPolygonLoop.prototype.rotate = function (a) {
225
+ }
226
+ rotate(a) {
228
227
  this.pool.push({
229
228
  functionName: LoopFunctions.rotate,
230
229
  numberArg: a
231
230
  });
232
231
  return this;
233
- };
234
- DPolygonLoop.prototype.rotate3dX = function (a) {
232
+ }
233
+ rotate3dX(a) {
235
234
  this.pool.push({
236
235
  functionName: LoopFunctions.rotate3dX,
237
236
  numberArg: a
238
237
  });
239
238
  return this;
240
- };
241
- DPolygonLoop.prototype.rotate3dY = function (a) {
239
+ }
240
+ rotate3dY(a) {
242
241
  this.pool.push({
243
242
  functionName: LoopFunctions.rotate3dY,
244
243
  numberArg: a
245
244
  });
246
245
  return this;
247
- };
248
- DPolygonLoop.prototype.rotate3dZ = function (a) {
246
+ }
247
+ rotate3dZ(a) {
249
248
  this.pool.push({
250
249
  functionName: LoopFunctions.rotate3dZ,
251
250
  numberArg: a
252
251
  });
253
252
  return this;
254
- };
255
- DPolygonLoop.prototype.move = function (x, y) {
256
- if (y === void 0) { y = x; }
253
+ }
254
+ move(x, y = x) {
257
255
  this.pool.push({
258
256
  functionName: LoopFunctions.move,
259
257
  numberPointArg: x,
260
258
  numberArg: y
261
259
  });
262
260
  return this;
263
- };
264
- DPolygonLoop.prototype.round = function () {
261
+ }
262
+ round() {
265
263
  this.pool.push({
266
264
  functionName: LoopFunctions.round
267
265
  });
268
266
  return this;
269
- };
270
- DPolygonLoop.prototype.ceil = function () {
267
+ }
268
+ ceil() {
271
269
  this.pool.push({
272
270
  functionName: LoopFunctions.ceil
273
271
  });
274
272
  return this;
275
- };
276
- DPolygonLoop.prototype.floor = function () {
273
+ }
274
+ floor() {
277
275
  this.pool.push({
278
276
  functionName: LoopFunctions.floor
279
277
  });
280
278
  return this;
281
- };
282
- DPolygonLoop.prototype.toFixed = function (n) {
283
- if (n === void 0) { n = 2; }
279
+ }
280
+ toFixed(n = 2) {
284
281
  this.pool.push({
285
282
  functionName: LoopFunctions.toFixed,
286
283
  numberArg: n
287
284
  });
288
285
  return this;
289
- };
290
- DPolygonLoop.prototype.abs = function () {
286
+ }
287
+ abs() {
291
288
  this.pool.push({
292
289
  functionName: LoopFunctions.abs
293
290
  });
294
291
  return this;
295
- };
296
- DPolygonLoop.prototype.scale = function (x, y) {
297
- if (y === void 0) { y = x; }
292
+ }
293
+ scale(x, y = x) {
298
294
  this.pool.push({
299
295
  functionName: LoopFunctions.scale,
300
296
  numberPointArg: x,
301
297
  numberArg: y
302
298
  });
303
299
  return this;
304
- };
305
- DPolygonLoop.prototype.divide = function (x, y) {
300
+ }
301
+ divide(x, y) {
306
302
  this.pool.push({
307
303
  functionName: LoopFunctions.divide,
308
304
  numberPointArg: x,
309
305
  numberArg: y
310
306
  });
311
307
  return this;
312
- };
313
- DPolygonLoop.prototype.degreeToRadians = function () {
308
+ }
309
+ degreeToRadians() {
314
310
  this.pool.push({
315
311
  functionName: LoopFunctions.degreeToRadians
316
312
  });
317
313
  return this;
318
- };
319
- DPolygonLoop.prototype.radiansToDegrees = function () {
314
+ }
315
+ radiansToDegrees() {
320
316
  this.pool.push({
321
317
  functionName: LoopFunctions.radiansToDegrees
322
318
  });
323
319
  return this;
324
- };
325
- DPolygonLoop.prototype.radiansToMeters = function () {
320
+ }
321
+ radiansToMeters() {
326
322
  this.pool.push({
327
323
  functionName: LoopFunctions.radiansToMeters
328
324
  });
329
325
  return this;
330
- };
331
- DPolygonLoop.prototype.metersToRadians = function () {
326
+ }
327
+ metersToRadians() {
332
328
  this.pool.push({
333
329
  functionName: LoopFunctions.metersToRadians
334
330
  });
335
331
  return this;
336
- };
337
- DPolygonLoop.prototype.getHipPoint = function () {
332
+ }
333
+ getHipPoint() {
338
334
  this.pool.push({
339
335
  functionName: LoopFunctions.hipPoint
340
336
  });
341
337
  return this;
342
- };
343
- DPolygonLoop.prototype.getXPoint = function () {
338
+ }
339
+ getXPoint() {
344
340
  this.pool.push({
345
341
  functionName: LoopFunctions.xPoint
346
342
  });
347
343
  return this;
348
- };
349
- DPolygonLoop.prototype.getYPoint = function () {
344
+ }
345
+ getYPoint() {
350
346
  this.pool.push({
351
347
  functionName: LoopFunctions.yPoint
352
348
  });
353
349
  return this;
354
- };
355
- DPolygonLoop.prototype.getWPoint = function () {
350
+ }
351
+ getWPoint() {
356
352
  this.pool.push({
357
353
  functionName: LoopFunctions.wPoint
358
354
  });
359
355
  return this;
360
- };
361
- DPolygonLoop.prototype.getHPoint = function () {
356
+ }
357
+ getHPoint() {
362
358
  this.pool.push({
363
359
  functionName: LoopFunctions.hPoint
364
360
  });
365
361
  return this;
366
- };
367
- DPolygonLoop.prototype.setIfLessThan = function (p) {
362
+ }
363
+ setIfLessThan(p) {
368
364
  this.pool.push({
369
365
  functionName: LoopFunctions.setIfLessThan,
370
366
  pointArg: p
371
367
  });
372
368
  return this;
373
- };
374
- DPolygonLoop.prototype.minus = function () {
369
+ }
370
+ minus() {
375
371
  this.pool.push({
376
372
  functionName: LoopFunctions.minus
377
373
  });
378
374
  return this;
379
- };
380
- DPolygonLoop.prototype.degreeToMeters = function () {
375
+ }
376
+ degreeToMeters() {
381
377
  this.pool.push({
382
378
  functionName: LoopFunctions.degreeToMeters
383
379
  });
384
380
  return this;
385
- };
386
- DPolygonLoop.prototype.metersToDegree = function () {
381
+ }
382
+ metersToDegree() {
387
383
  this.pool.push({
388
384
  functionName: LoopFunctions.metersToDegree
389
385
  });
390
386
  return this;
391
- };
392
- DPolygonLoop.prototype.flipVertically = function (size) {
387
+ }
388
+ flipVertically(size) {
393
389
  this.pool.push({
394
390
  functionName: LoopFunctions.flipVertically,
395
391
  numberPointArg: size
396
392
  });
397
393
  return this;
398
- };
399
- return DPolygonLoop;
400
- }());
394
+ }
395
+ }
401
396
  exports.DPolygonLoop = DPolygonLoop;
@@ -1,45 +1,22 @@
1
1
  "use strict";
2
- var __values = (this && this.__values) || function(o) {
3
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
- if (m) return m.call(o);
5
- if (o && typeof o.length === "number") return {
6
- next: function () {
7
- if (o && i >= o.length) o = void 0;
8
- return { value: o && o[i++], done: !o };
9
- }
10
- };
11
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
3
  exports.FastSearch = void 0;
15
- var FastSearch = (function () {
16
- function FastSearch() {
4
+ class FastSearch {
5
+ constructor() {
17
6
  this.searchStore = {};
18
7
  }
19
- FastSearch.prototype.add = function (points) {
20
- var e_1, _a;
21
- try {
22
- for (var points_1 = __values(points), points_1_1 = points_1.next(); !points_1_1.done; points_1_1 = points_1.next()) {
23
- var _b = points_1_1.value, x = _b.x, y = _b.y, z = _b.z;
24
- if (!this.searchStore[x]) {
25
- this.searchStore[x] = {};
26
- }
27
- if (!this.searchStore[x][y]) {
28
- this.searchStore[x][y] = {};
29
- }
30
- this.searchStore[x][y][z || 'undefined'] = true;
8
+ add(points) {
9
+ for (const { x, y, z } of points) {
10
+ if (!this.searchStore[x]) {
11
+ this.searchStore[x] = {};
31
12
  }
32
- }
33
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
34
- finally {
35
- try {
36
- if (points_1_1 && !points_1_1.done && (_a = points_1.return)) _a.call(points_1);
13
+ if (!this.searchStore[x][y]) {
14
+ this.searchStore[x][y] = {};
37
15
  }
38
- finally { if (e_1) throw e_1.error; }
16
+ this.searchStore[x][y][z || 'undefined'] = true;
39
17
  }
40
- };
41
- FastSearch.prototype.find = function (_a) {
42
- var x = _a.x, y = _a.y, z = _a.z;
18
+ }
19
+ find({ x, y, z }) {
43
20
  if (!this.searchStore[x]) {
44
21
  return false;
45
22
  }
@@ -47,7 +24,6 @@ var FastSearch = (function () {
47
24
  return false;
48
25
  }
49
26
  return this.searchStore[x][y][z || 'undefined'];
50
- };
51
- return FastSearch;
52
- }());
27
+ }
28
+ }
53
29
  exports.FastSearch = FastSearch;