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