dgeoutils 2.4.47 → 2.4.52
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/cjs/DCircle.d.ts +18 -0
- package/dist/cjs/DCircle.js +102 -0
- package/dist/cjs/DLine.d.ts +39 -0
- package/dist/cjs/DLine.js +343 -0
- package/dist/cjs/DNumbers.d.ts +8 -0
- package/dist/cjs/DNumbers.js +30 -0
- package/dist/cjs/DPlane.d.ts +25 -0
- package/dist/cjs/DPlane.js +132 -0
- package/dist/cjs/DPoint.d.ts +138 -0
- package/dist/cjs/DPoint.js +803 -0
- package/dist/cjs/DPolygon.d.ts +137 -0
- package/dist/cjs/DPolygon.js +1745 -0
- package/dist/cjs/DPolygonLoop.d.ts +60 -0
- package/dist/cjs/DPolygonLoop.js +439 -0
- package/dist/cjs/FastSearch.d.ts +6 -0
- package/dist/cjs/FastSearch.js +53 -0
- package/dist/cjs/InterpolationMatrix.d.ts +24 -0
- package/dist/cjs/InterpolationMatrix.js +173 -0
- package/dist/cjs/TraceMatrix.d.ts +22 -0
- package/dist/cjs/TraceMatrix.js +285 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.js +37 -0
- package/dist/cjs/utils.d.ts +49 -0
- package/dist/cjs/utils.js +281 -0
- package/dist/es2015/DCircle.js +87 -0
- package/dist/es2015/DLine.js +290 -0
- package/dist/es2015/DNumbers.js +22 -0
- package/dist/es2015/DPlane.js +105 -0
- package/dist/es2015/DPoint.js +676 -0
- package/dist/es2015/DPolygon.js +1193 -0
- package/dist/es2015/DPolygonLoop.js +430 -0
- package/dist/es2015/FastSearch.js +25 -0
- package/dist/es2015/InterpolationMatrix.js +128 -0
- package/dist/es2015/TraceMatrix.js +229 -0
- package/dist/es2015/index.js +11 -0
- package/dist/es2015/utils.js +208 -0
- package/dist/esm/DCircle.js +99 -0
- package/dist/esm/DLine.js +340 -0
- package/dist/esm/DNumbers.js +27 -0
- package/dist/esm/DPlane.js +129 -0
- package/dist/esm/DPoint.js +800 -0
- package/dist/esm/DPolygon.js +1742 -0
- package/dist/esm/DPolygonLoop.js +436 -0
- package/dist/esm/FastSearch.js +50 -0
- package/dist/esm/InterpolationMatrix.js +170 -0
- package/dist/esm/TraceMatrix.js +282 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/utils.js +266 -0
- package/dist/umd/dgeoutils.js +4348 -0
- package/dist/umd/dgeoutils.min.js +1 -0
- package/dist/umd/dgeoutils.min.js.map +1 -0
- package/package.json +9 -1
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
var LoopFunctions;
|
|
2
|
+
(function (LoopFunctions) {
|
|
3
|
+
LoopFunctions[LoopFunctions["getTileFromCoords"] = 0] = "getTileFromCoords";
|
|
4
|
+
LoopFunctions[LoopFunctions["getCoordsFromTile"] = 1] = "getCoordsFromTile";
|
|
5
|
+
LoopFunctions[LoopFunctions["height"] = 2] = "height";
|
|
6
|
+
LoopFunctions[LoopFunctions["setX"] = 3] = "setX";
|
|
7
|
+
LoopFunctions[LoopFunctions["setY"] = 4] = "setY";
|
|
8
|
+
LoopFunctions[LoopFunctions["setZ"] = 5] = "setZ";
|
|
9
|
+
LoopFunctions[LoopFunctions["rotate"] = 6] = "rotate";
|
|
10
|
+
LoopFunctions[LoopFunctions["rotate3dX"] = 7] = "rotate3dX";
|
|
11
|
+
LoopFunctions[LoopFunctions["rotate3dY"] = 8] = "rotate3dY";
|
|
12
|
+
LoopFunctions[LoopFunctions["rotate3dZ"] = 9] = "rotate3dZ";
|
|
13
|
+
LoopFunctions[LoopFunctions["move"] = 10] = "move";
|
|
14
|
+
LoopFunctions[LoopFunctions["round"] = 11] = "round";
|
|
15
|
+
LoopFunctions[LoopFunctions["ceil"] = 12] = "ceil";
|
|
16
|
+
LoopFunctions[LoopFunctions["floor"] = 13] = "floor";
|
|
17
|
+
LoopFunctions[LoopFunctions["toFixed"] = 14] = "toFixed";
|
|
18
|
+
LoopFunctions[LoopFunctions["abs"] = 15] = "abs";
|
|
19
|
+
LoopFunctions[LoopFunctions["scale"] = 16] = "scale";
|
|
20
|
+
LoopFunctions[LoopFunctions["divide"] = 17] = "divide";
|
|
21
|
+
LoopFunctions[LoopFunctions["degreeToRadians"] = 18] = "degreeToRadians";
|
|
22
|
+
LoopFunctions[LoopFunctions["radiansToDegrees"] = 19] = "radiansToDegrees";
|
|
23
|
+
LoopFunctions[LoopFunctions["radiansToMeters"] = 20] = "radiansToMeters";
|
|
24
|
+
LoopFunctions[LoopFunctions["metersToRadians"] = 21] = "metersToRadians";
|
|
25
|
+
LoopFunctions[LoopFunctions["hipPoint"] = 22] = "hipPoint";
|
|
26
|
+
LoopFunctions[LoopFunctions["xPoint"] = 23] = "xPoint";
|
|
27
|
+
LoopFunctions[LoopFunctions["yPoint"] = 24] = "yPoint";
|
|
28
|
+
LoopFunctions[LoopFunctions["wPoint"] = 25] = "wPoint";
|
|
29
|
+
LoopFunctions[LoopFunctions["hPoint"] = 26] = "hPoint";
|
|
30
|
+
LoopFunctions[LoopFunctions["setIfLessThan"] = 27] = "setIfLessThan";
|
|
31
|
+
LoopFunctions[LoopFunctions["minus"] = 28] = "minus";
|
|
32
|
+
LoopFunctions[LoopFunctions["degreeToMeters"] = 29] = "degreeToMeters";
|
|
33
|
+
LoopFunctions[LoopFunctions["metersToDegree"] = 30] = "metersToDegree";
|
|
34
|
+
LoopFunctions[LoopFunctions["flipVertically"] = 31] = "flipVertically";
|
|
35
|
+
LoopFunctions[LoopFunctions["setProperties"] = 32] = "setProperties";
|
|
36
|
+
LoopFunctions[LoopFunctions["div"] = 33] = "div";
|
|
37
|
+
LoopFunctions[LoopFunctions["mod"] = 34] = "mod";
|
|
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, setterArgByObject = _a.setterArgByObject;
|
|
41
|
+
var res = a;
|
|
42
|
+
switch (functionName) {
|
|
43
|
+
case LoopFunctions.getTileFromCoords:
|
|
44
|
+
res = function (k, index) { return a(k, index)
|
|
45
|
+
.getTileFromCoords(numberArg); };
|
|
46
|
+
break;
|
|
47
|
+
case LoopFunctions.getCoordsFromTile:
|
|
48
|
+
res = function (k, index) { return a(k, index)
|
|
49
|
+
.getCoordsFromTile(numberArg); };
|
|
50
|
+
break;
|
|
51
|
+
case LoopFunctions.height:
|
|
52
|
+
res = function (k, index) { return a(k, index)
|
|
53
|
+
.height(numberArg); };
|
|
54
|
+
break;
|
|
55
|
+
case LoopFunctions.setX:
|
|
56
|
+
res = function (k, index) { return typeof setterArg === 'number' ? a(k, index)
|
|
57
|
+
.setX(setterArg) : a(k, index).setX(function (p) { return setterArg(p, index); }); };
|
|
58
|
+
break;
|
|
59
|
+
case LoopFunctions.setY:
|
|
60
|
+
res = function (k, index) { return typeof setterArg === 'number' ? a(k, index)
|
|
61
|
+
.setY(setterArg) : a(k, index).setY(function (p) { return setterArg(p, index); }); };
|
|
62
|
+
break;
|
|
63
|
+
case LoopFunctions.setZ:
|
|
64
|
+
res = function (k, index) { return typeof setterArg === 'number' ? a(k, index)
|
|
65
|
+
.setZ(setterArg) : a(k, index).setZ(function (p) { return setterArg(p, index); }); };
|
|
66
|
+
break;
|
|
67
|
+
case LoopFunctions.rotate:
|
|
68
|
+
res = function (k, index) { return a(k, index)
|
|
69
|
+
.rotate(numberArg); };
|
|
70
|
+
break;
|
|
71
|
+
case LoopFunctions.rotate3dX:
|
|
72
|
+
res = function (k, index) { return a(k, index)
|
|
73
|
+
.rotate3dX(numberArg); };
|
|
74
|
+
break;
|
|
75
|
+
case LoopFunctions.rotate3dY:
|
|
76
|
+
res = function (k, index) { return a(k, index)
|
|
77
|
+
.rotate3dY(numberArg); };
|
|
78
|
+
break;
|
|
79
|
+
case LoopFunctions.rotate3dZ:
|
|
80
|
+
res = function (k, index) { return a(k, index)
|
|
81
|
+
.rotate3dZ(numberArg); };
|
|
82
|
+
break;
|
|
83
|
+
case LoopFunctions.move:
|
|
84
|
+
res = function (k, index) { return a(k, index)
|
|
85
|
+
.move(numberPointArg, numberArg); };
|
|
86
|
+
break;
|
|
87
|
+
case LoopFunctions.round:
|
|
88
|
+
res = function (k, index) { return a(k, index)
|
|
89
|
+
.round(); };
|
|
90
|
+
break;
|
|
91
|
+
case LoopFunctions.ceil:
|
|
92
|
+
res = function (k, index) { return a(k, index)
|
|
93
|
+
.ceil(); };
|
|
94
|
+
break;
|
|
95
|
+
case LoopFunctions.floor:
|
|
96
|
+
res = function (k, index) { return a(k, index)
|
|
97
|
+
.floor(); };
|
|
98
|
+
break;
|
|
99
|
+
case LoopFunctions.toFixed:
|
|
100
|
+
res = function (k, index) { return a(k, index)
|
|
101
|
+
.toFixed(numberArg); };
|
|
102
|
+
break;
|
|
103
|
+
case LoopFunctions.abs:
|
|
104
|
+
res = function (k, index) { return a(k, index)
|
|
105
|
+
.abs(); };
|
|
106
|
+
break;
|
|
107
|
+
case LoopFunctions.scale:
|
|
108
|
+
res = function (k, index) { return a(k, index)
|
|
109
|
+
.scale(numberPointArg, numberArg); };
|
|
110
|
+
break;
|
|
111
|
+
case LoopFunctions.divide:
|
|
112
|
+
res = function (k, index) { return a(k, index)
|
|
113
|
+
.divide(numberPointArg, numberArg); };
|
|
114
|
+
break;
|
|
115
|
+
case LoopFunctions.div:
|
|
116
|
+
res = function (k, index) { return a(k, index)
|
|
117
|
+
.div(numberPointArg, numberArg); };
|
|
118
|
+
break;
|
|
119
|
+
case LoopFunctions.mod:
|
|
120
|
+
res = function (k, index) { return a(k, index)
|
|
121
|
+
.mod(numberPointArg, numberArg); };
|
|
122
|
+
break;
|
|
123
|
+
case LoopFunctions.degreeToRadians:
|
|
124
|
+
res = function (k, index) { return a(k, index)
|
|
125
|
+
.degreeToRadians(); };
|
|
126
|
+
break;
|
|
127
|
+
case LoopFunctions.radiansToDegrees:
|
|
128
|
+
res = function (k, index) { return a(k, index)
|
|
129
|
+
.radiansToDegrees(); };
|
|
130
|
+
break;
|
|
131
|
+
case LoopFunctions.radiansToMeters:
|
|
132
|
+
res = function (k, index) { return a(k, index)
|
|
133
|
+
.radiansToMeters(); };
|
|
134
|
+
break;
|
|
135
|
+
case LoopFunctions.metersToRadians:
|
|
136
|
+
res = function (k, index) { return a(k, index)
|
|
137
|
+
.metersToRadians(); };
|
|
138
|
+
break;
|
|
139
|
+
case LoopFunctions.hipPoint:
|
|
140
|
+
res = function (k, index) { return a(k, index)
|
|
141
|
+
.hipPoint; };
|
|
142
|
+
break;
|
|
143
|
+
case LoopFunctions.xPoint:
|
|
144
|
+
res = function (k, index) { return a(k, index)
|
|
145
|
+
.xPoint; };
|
|
146
|
+
break;
|
|
147
|
+
case LoopFunctions.yPoint:
|
|
148
|
+
res = function (k, index) { return a(k, index)
|
|
149
|
+
.yPoint; };
|
|
150
|
+
break;
|
|
151
|
+
case LoopFunctions.wPoint:
|
|
152
|
+
res = function (k, index) { return a(k, index)
|
|
153
|
+
.wPoint; };
|
|
154
|
+
break;
|
|
155
|
+
case LoopFunctions.hPoint:
|
|
156
|
+
res = function (k, index) { return a(k, index)
|
|
157
|
+
.hPoint; };
|
|
158
|
+
break;
|
|
159
|
+
case LoopFunctions.setIfLessThan:
|
|
160
|
+
res = function (k, index) { return a(k, index)
|
|
161
|
+
.setIfLessThan(pointArg); };
|
|
162
|
+
break;
|
|
163
|
+
case LoopFunctions.minus:
|
|
164
|
+
res = function (k, index) { return a(k, index)
|
|
165
|
+
.minus(); };
|
|
166
|
+
break;
|
|
167
|
+
case LoopFunctions.degreeToMeters:
|
|
168
|
+
res = function (k, index) { return a(k, index)
|
|
169
|
+
.degreeToMeters(); };
|
|
170
|
+
break;
|
|
171
|
+
case LoopFunctions.metersToDegree:
|
|
172
|
+
res = function (k, index) { return a(k, index)
|
|
173
|
+
.metersToDegree(); };
|
|
174
|
+
break;
|
|
175
|
+
case LoopFunctions.flipVertically:
|
|
176
|
+
res = function (k, index) { return a(k, index)
|
|
177
|
+
.flipVertically(numberPointArg); };
|
|
178
|
+
break;
|
|
179
|
+
case LoopFunctions.setProperties:
|
|
180
|
+
res = function (k, index) { return typeof setterArgByObject === 'object' ? a(k, index)
|
|
181
|
+
.setProperties(setterArgByObject) : a(k, index).setProperties(function (p) { return setterArgByObject(p, index); }); };
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
return res;
|
|
185
|
+
};
|
|
186
|
+
var DPolygonLoop = (function () {
|
|
187
|
+
function DPolygonLoop(parent) {
|
|
188
|
+
this.parent = parent;
|
|
189
|
+
this.pool = [];
|
|
190
|
+
}
|
|
191
|
+
DPolygonLoop.prototype.getLoopFunction = function () {
|
|
192
|
+
return this.pool.reduce(decodePoolRecord, function (k) { return k; });
|
|
193
|
+
};
|
|
194
|
+
DPolygonLoop.prototype.run = function () {
|
|
195
|
+
return this.parent.map(this.getLoopFunction());
|
|
196
|
+
};
|
|
197
|
+
DPolygonLoop.prototype.getTileFromCoords = function (zoom) {
|
|
198
|
+
this.pool.push({
|
|
199
|
+
functionName: LoopFunctions.getTileFromCoords,
|
|
200
|
+
numberArg: zoom
|
|
201
|
+
});
|
|
202
|
+
return this;
|
|
203
|
+
};
|
|
204
|
+
DPolygonLoop.prototype.getCoordsFromTile = function (zoom) {
|
|
205
|
+
this.pool.push({
|
|
206
|
+
functionName: LoopFunctions.getCoordsFromTile,
|
|
207
|
+
numberArg: zoom
|
|
208
|
+
});
|
|
209
|
+
return this;
|
|
210
|
+
};
|
|
211
|
+
DPolygonLoop.prototype.height = function (z) {
|
|
212
|
+
this.pool.push({
|
|
213
|
+
functionName: LoopFunctions.height,
|
|
214
|
+
numberArg: z
|
|
215
|
+
});
|
|
216
|
+
return this;
|
|
217
|
+
};
|
|
218
|
+
DPolygonLoop.prototype.setX = function (x) {
|
|
219
|
+
this.pool.push({
|
|
220
|
+
functionName: LoopFunctions.setX,
|
|
221
|
+
setterArg: x
|
|
222
|
+
});
|
|
223
|
+
return this;
|
|
224
|
+
};
|
|
225
|
+
DPolygonLoop.prototype.setProperties = function (setterArgByObject) {
|
|
226
|
+
this.pool.push({
|
|
227
|
+
functionName: LoopFunctions.setProperties,
|
|
228
|
+
setterArgByObject: setterArgByObject
|
|
229
|
+
});
|
|
230
|
+
return this;
|
|
231
|
+
};
|
|
232
|
+
DPolygonLoop.prototype.setY = function (y) {
|
|
233
|
+
this.pool.push({
|
|
234
|
+
functionName: LoopFunctions.setY,
|
|
235
|
+
setterArg: y
|
|
236
|
+
});
|
|
237
|
+
return this;
|
|
238
|
+
};
|
|
239
|
+
DPolygonLoop.prototype.setZ = function (z) {
|
|
240
|
+
this.pool.push({
|
|
241
|
+
functionName: LoopFunctions.setZ,
|
|
242
|
+
setterArg: z
|
|
243
|
+
});
|
|
244
|
+
return this;
|
|
245
|
+
};
|
|
246
|
+
DPolygonLoop.prototype.rotate = function (a) {
|
|
247
|
+
this.pool.push({
|
|
248
|
+
functionName: LoopFunctions.rotate,
|
|
249
|
+
numberArg: a
|
|
250
|
+
});
|
|
251
|
+
return this;
|
|
252
|
+
};
|
|
253
|
+
DPolygonLoop.prototype.rotate3dX = function (a) {
|
|
254
|
+
this.pool.push({
|
|
255
|
+
functionName: LoopFunctions.rotate3dX,
|
|
256
|
+
numberArg: a
|
|
257
|
+
});
|
|
258
|
+
return this;
|
|
259
|
+
};
|
|
260
|
+
DPolygonLoop.prototype.rotate3dY = function (a) {
|
|
261
|
+
this.pool.push({
|
|
262
|
+
functionName: LoopFunctions.rotate3dY,
|
|
263
|
+
numberArg: a
|
|
264
|
+
});
|
|
265
|
+
return this;
|
|
266
|
+
};
|
|
267
|
+
DPolygonLoop.prototype.rotate3dZ = function (a) {
|
|
268
|
+
this.pool.push({
|
|
269
|
+
functionName: LoopFunctions.rotate3dZ,
|
|
270
|
+
numberArg: a
|
|
271
|
+
});
|
|
272
|
+
return this;
|
|
273
|
+
};
|
|
274
|
+
DPolygonLoop.prototype.move = function (x, y) {
|
|
275
|
+
if (y === void 0) { y = x; }
|
|
276
|
+
this.pool.push({
|
|
277
|
+
functionName: LoopFunctions.move,
|
|
278
|
+
numberPointArg: x,
|
|
279
|
+
numberArg: y
|
|
280
|
+
});
|
|
281
|
+
return this;
|
|
282
|
+
};
|
|
283
|
+
DPolygonLoop.prototype.round = function () {
|
|
284
|
+
this.pool.push({
|
|
285
|
+
functionName: LoopFunctions.round
|
|
286
|
+
});
|
|
287
|
+
return this;
|
|
288
|
+
};
|
|
289
|
+
DPolygonLoop.prototype.ceil = function () {
|
|
290
|
+
this.pool.push({
|
|
291
|
+
functionName: LoopFunctions.ceil
|
|
292
|
+
});
|
|
293
|
+
return this;
|
|
294
|
+
};
|
|
295
|
+
DPolygonLoop.prototype.floor = function () {
|
|
296
|
+
this.pool.push({
|
|
297
|
+
functionName: LoopFunctions.floor
|
|
298
|
+
});
|
|
299
|
+
return this;
|
|
300
|
+
};
|
|
301
|
+
DPolygonLoop.prototype.toFixed = function (n) {
|
|
302
|
+
if (n === void 0) { n = 2; }
|
|
303
|
+
this.pool.push({
|
|
304
|
+
functionName: LoopFunctions.toFixed,
|
|
305
|
+
numberArg: n
|
|
306
|
+
});
|
|
307
|
+
return this;
|
|
308
|
+
};
|
|
309
|
+
DPolygonLoop.prototype.abs = function () {
|
|
310
|
+
this.pool.push({
|
|
311
|
+
functionName: LoopFunctions.abs
|
|
312
|
+
});
|
|
313
|
+
return this;
|
|
314
|
+
};
|
|
315
|
+
DPolygonLoop.prototype.scale = function (x, y) {
|
|
316
|
+
if (y === void 0) { y = x; }
|
|
317
|
+
this.pool.push({
|
|
318
|
+
functionName: LoopFunctions.scale,
|
|
319
|
+
numberPointArg: x,
|
|
320
|
+
numberArg: y
|
|
321
|
+
});
|
|
322
|
+
return this;
|
|
323
|
+
};
|
|
324
|
+
DPolygonLoop.prototype.divide = function (x, y) {
|
|
325
|
+
this.pool.push({
|
|
326
|
+
functionName: LoopFunctions.divide,
|
|
327
|
+
numberPointArg: x,
|
|
328
|
+
numberArg: y
|
|
329
|
+
});
|
|
330
|
+
return this;
|
|
331
|
+
};
|
|
332
|
+
DPolygonLoop.prototype.div = function (x, y) {
|
|
333
|
+
this.pool.push({
|
|
334
|
+
functionName: LoopFunctions.div,
|
|
335
|
+
numberPointArg: x,
|
|
336
|
+
numberArg: y
|
|
337
|
+
});
|
|
338
|
+
return this;
|
|
339
|
+
};
|
|
340
|
+
DPolygonLoop.prototype.mod = function (x, y) {
|
|
341
|
+
this.pool.push({
|
|
342
|
+
functionName: LoopFunctions.mod,
|
|
343
|
+
numberPointArg: x,
|
|
344
|
+
numberArg: y
|
|
345
|
+
});
|
|
346
|
+
return this;
|
|
347
|
+
};
|
|
348
|
+
DPolygonLoop.prototype.degreeToRadians = function () {
|
|
349
|
+
this.pool.push({
|
|
350
|
+
functionName: LoopFunctions.degreeToRadians
|
|
351
|
+
});
|
|
352
|
+
return this;
|
|
353
|
+
};
|
|
354
|
+
DPolygonLoop.prototype.radiansToDegrees = function () {
|
|
355
|
+
this.pool.push({
|
|
356
|
+
functionName: LoopFunctions.radiansToDegrees
|
|
357
|
+
});
|
|
358
|
+
return this;
|
|
359
|
+
};
|
|
360
|
+
DPolygonLoop.prototype.radiansToMeters = function () {
|
|
361
|
+
this.pool.push({
|
|
362
|
+
functionName: LoopFunctions.radiansToMeters
|
|
363
|
+
});
|
|
364
|
+
return this;
|
|
365
|
+
};
|
|
366
|
+
DPolygonLoop.prototype.metersToRadians = function () {
|
|
367
|
+
this.pool.push({
|
|
368
|
+
functionName: LoopFunctions.metersToRadians
|
|
369
|
+
});
|
|
370
|
+
return this;
|
|
371
|
+
};
|
|
372
|
+
DPolygonLoop.prototype.getHipPoint = function () {
|
|
373
|
+
this.pool.push({
|
|
374
|
+
functionName: LoopFunctions.hipPoint
|
|
375
|
+
});
|
|
376
|
+
return this;
|
|
377
|
+
};
|
|
378
|
+
DPolygonLoop.prototype.getXPoint = function () {
|
|
379
|
+
this.pool.push({
|
|
380
|
+
functionName: LoopFunctions.xPoint
|
|
381
|
+
});
|
|
382
|
+
return this;
|
|
383
|
+
};
|
|
384
|
+
DPolygonLoop.prototype.getYPoint = function () {
|
|
385
|
+
this.pool.push({
|
|
386
|
+
functionName: LoopFunctions.yPoint
|
|
387
|
+
});
|
|
388
|
+
return this;
|
|
389
|
+
};
|
|
390
|
+
DPolygonLoop.prototype.getWPoint = function () {
|
|
391
|
+
this.pool.push({
|
|
392
|
+
functionName: LoopFunctions.wPoint
|
|
393
|
+
});
|
|
394
|
+
return this;
|
|
395
|
+
};
|
|
396
|
+
DPolygonLoop.prototype.getHPoint = function () {
|
|
397
|
+
this.pool.push({
|
|
398
|
+
functionName: LoopFunctions.hPoint
|
|
399
|
+
});
|
|
400
|
+
return this;
|
|
401
|
+
};
|
|
402
|
+
DPolygonLoop.prototype.setIfLessThan = function (p) {
|
|
403
|
+
this.pool.push({
|
|
404
|
+
functionName: LoopFunctions.setIfLessThan,
|
|
405
|
+
pointArg: p
|
|
406
|
+
});
|
|
407
|
+
return this;
|
|
408
|
+
};
|
|
409
|
+
DPolygonLoop.prototype.minus = function () {
|
|
410
|
+
this.pool.push({
|
|
411
|
+
functionName: LoopFunctions.minus
|
|
412
|
+
});
|
|
413
|
+
return this;
|
|
414
|
+
};
|
|
415
|
+
DPolygonLoop.prototype.degreeToMeters = function () {
|
|
416
|
+
this.pool.push({
|
|
417
|
+
functionName: LoopFunctions.degreeToMeters
|
|
418
|
+
});
|
|
419
|
+
return this;
|
|
420
|
+
};
|
|
421
|
+
DPolygonLoop.prototype.metersToDegree = function () {
|
|
422
|
+
this.pool.push({
|
|
423
|
+
functionName: LoopFunctions.metersToDegree
|
|
424
|
+
});
|
|
425
|
+
return this;
|
|
426
|
+
};
|
|
427
|
+
DPolygonLoop.prototype.flipVertically = function (size) {
|
|
428
|
+
this.pool.push({
|
|
429
|
+
functionName: LoopFunctions.flipVertically,
|
|
430
|
+
numberPointArg: size
|
|
431
|
+
});
|
|
432
|
+
return this;
|
|
433
|
+
};
|
|
434
|
+
return DPolygonLoop;
|
|
435
|
+
}());
|
|
436
|
+
export { DPolygonLoop };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __values = (this && this.__values) || function(o) {
|
|
2
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
3
|
+
if (m) return m.call(o);
|
|
4
|
+
if (o && typeof o.length === "number") return {
|
|
5
|
+
next: function () {
|
|
6
|
+
if (o && i >= o.length) o = void 0;
|
|
7
|
+
return { value: o && o[i++], done: !o };
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
11
|
+
};
|
|
12
|
+
var FastSearch = (function () {
|
|
13
|
+
function FastSearch() {
|
|
14
|
+
this.searchStore = {};
|
|
15
|
+
}
|
|
16
|
+
FastSearch.prototype.add = function (points) {
|
|
17
|
+
var e_1, _a;
|
|
18
|
+
try {
|
|
19
|
+
for (var points_1 = __values(points), points_1_1 = points_1.next(); !points_1_1.done; points_1_1 = points_1.next()) {
|
|
20
|
+
var _b = points_1_1.value, x = _b.x, y = _b.y, z = _b.z;
|
|
21
|
+
if (!this.searchStore[x]) {
|
|
22
|
+
this.searchStore[x] = {};
|
|
23
|
+
}
|
|
24
|
+
if (!this.searchStore[x][y]) {
|
|
25
|
+
this.searchStore[x][y] = {};
|
|
26
|
+
}
|
|
27
|
+
this.searchStore[x][y][z || 'undefined'] = true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
31
|
+
finally {
|
|
32
|
+
try {
|
|
33
|
+
if (points_1_1 && !points_1_1.done && (_a = points_1.return)) _a.call(points_1);
|
|
34
|
+
}
|
|
35
|
+
finally { if (e_1) throw e_1.error; }
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
FastSearch.prototype.find = function (_a) {
|
|
39
|
+
var x = _a.x, y = _a.y, z = _a.z;
|
|
40
|
+
if (!this.searchStore[x]) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
if (!this.searchStore[x][y]) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return this.searchStore[x][y][z || 'undefined'];
|
|
47
|
+
};
|
|
48
|
+
return FastSearch;
|
|
49
|
+
}());
|
|
50
|
+
export { FastSearch };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
24
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
25
|
+
if (!m) return o;
|
|
26
|
+
var i = m.call(o), r, ar = [], e;
|
|
27
|
+
try {
|
|
28
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
29
|
+
}
|
|
30
|
+
catch (error) { e = { error: error }; }
|
|
31
|
+
finally {
|
|
32
|
+
try {
|
|
33
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
34
|
+
}
|
|
35
|
+
finally { if (e) throw e.error; }
|
|
36
|
+
}
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
import { DPolygon } from './DPolygon';
|
|
40
|
+
import { DPoint } from './DPoint';
|
|
41
|
+
import { isDefAndNotNull } from './utils';
|
|
42
|
+
var InterpolationMatrix = (function () {
|
|
43
|
+
function InterpolationMatrix(bboxLike, stepSize, keys, p) {
|
|
44
|
+
if (p === void 0) { p = 2; }
|
|
45
|
+
this.stepSize = stepSize;
|
|
46
|
+
this.p = p;
|
|
47
|
+
this.points = [];
|
|
48
|
+
this.cells = {};
|
|
49
|
+
this.allCells = [];
|
|
50
|
+
this.minPoint = bboxLike.minPoint;
|
|
51
|
+
this.maxPoint = bboxLike.maxPoint;
|
|
52
|
+
this.sizePoly = DPolygon.createSquareBySize(new DPoint(this.stepSize));
|
|
53
|
+
this.size = this.maxPoint.clone().move(this.minPoint.clone().minus())
|
|
54
|
+
.divide(this.stepSize)
|
|
55
|
+
.ceil();
|
|
56
|
+
this.keys = Array.isArray(keys) ? keys : [keys];
|
|
57
|
+
this.generateCells();
|
|
58
|
+
}
|
|
59
|
+
InterpolationMatrix.prototype.setKnownPoints = function (points) {
|
|
60
|
+
var _this = this;
|
|
61
|
+
this.points = points instanceof DPolygon ? points.points : points;
|
|
62
|
+
this.minPoint.setProperties(this.points.reduce(function (a, v) { return _this.keys
|
|
63
|
+
.reduce(function (aa, k) {
|
|
64
|
+
var _a;
|
|
65
|
+
aa[k] = Math.min((_a = a[k]) !== null && _a !== void 0 ? _a : Infinity, v.properties[k]);
|
|
66
|
+
return aa;
|
|
67
|
+
}, a); }, {}));
|
|
68
|
+
this.maxPoint.setProperties(this.points.reduce(function (a, v) { return _this.keys
|
|
69
|
+
.reduce(function (aa, k) {
|
|
70
|
+
var _a;
|
|
71
|
+
aa[k] = Math.max((_a = a[k]) !== null && _a !== void 0 ? _a : -Infinity, v.properties[k]);
|
|
72
|
+
return aa;
|
|
73
|
+
}, a); }, {}));
|
|
74
|
+
return this;
|
|
75
|
+
};
|
|
76
|
+
InterpolationMatrix.prototype.positionToCellCoords = function (d) {
|
|
77
|
+
return d.clone()
|
|
78
|
+
.move(this.minPoint.clone().minus())
|
|
79
|
+
.divide(this.stepSize)
|
|
80
|
+
.floor();
|
|
81
|
+
};
|
|
82
|
+
InterpolationMatrix.prototype.calculate = function () {
|
|
83
|
+
this.setKnownValues();
|
|
84
|
+
this.interpolateValues();
|
|
85
|
+
return this;
|
|
86
|
+
};
|
|
87
|
+
InterpolationMatrix.prototype.getCellValue = function (_a, key) {
|
|
88
|
+
var x = _a.x, y = _a.y;
|
|
89
|
+
var cell = this.cells[x][y];
|
|
90
|
+
if (key) {
|
|
91
|
+
if (Array.isArray(key)) {
|
|
92
|
+
return key.reduce(function (a, k) {
|
|
93
|
+
a[k] = cell.properties[k];
|
|
94
|
+
return a;
|
|
95
|
+
}, {});
|
|
96
|
+
}
|
|
97
|
+
return cell.properties[key];
|
|
98
|
+
}
|
|
99
|
+
return __assign({}, cell.properties);
|
|
100
|
+
};
|
|
101
|
+
Object.defineProperty(InterpolationMatrix.prototype, "getCellData", {
|
|
102
|
+
get: function () {
|
|
103
|
+
return this.allCells.reduce(function (a, c) {
|
|
104
|
+
var _a = c.properties, x = _a.x, y = _a.y, props = __rest(_a, ["x", "y"]);
|
|
105
|
+
a[x] = a[x] || {};
|
|
106
|
+
a[x][y] = __assign({}, props);
|
|
107
|
+
return a;
|
|
108
|
+
}, {});
|
|
109
|
+
},
|
|
110
|
+
enumerable: false,
|
|
111
|
+
configurable: true
|
|
112
|
+
});
|
|
113
|
+
Object.defineProperty(InterpolationMatrix.prototype, "allCellsClone", {
|
|
114
|
+
get: function () {
|
|
115
|
+
return this.allCells.map(function (p) { return p.clone(); });
|
|
116
|
+
},
|
|
117
|
+
enumerable: false,
|
|
118
|
+
configurable: true
|
|
119
|
+
});
|
|
120
|
+
InterpolationMatrix.prototype.interpolateValues = function () {
|
|
121
|
+
var _this = this;
|
|
122
|
+
var points = this.points.map(function (p) { return _this.positionToCellCoords(p); });
|
|
123
|
+
this.allCells.forEach(function (cell) {
|
|
124
|
+
var t = new DPoint(cell.properties.x, cell.properties.y);
|
|
125
|
+
var distances = points.map(function (p) { return Math.pow(t.distance(p), _this.p); });
|
|
126
|
+
_this.keys.forEach(function (k) {
|
|
127
|
+
if (isDefAndNotNull(cell.properties[k])) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
var _a = __read(distances.reduce(function (a, d, i) {
|
|
131
|
+
if (isDefAndNotNull(_this.points[i].properties[k])) {
|
|
132
|
+
a[0] += _this.points[i].properties[k] / d;
|
|
133
|
+
a[1] += 1 / d;
|
|
134
|
+
}
|
|
135
|
+
return a;
|
|
136
|
+
}, [0, 0]), 2), valueSum = _a[0], oneSum = _a[1];
|
|
137
|
+
cell.properties[k] = valueSum / oneSum;
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
InterpolationMatrix.prototype.setKnownValues = function () {
|
|
142
|
+
var _this = this;
|
|
143
|
+
this.points.forEach(function (p) {
|
|
144
|
+
var _a = _this.positionToCellCoords(p), x = _a.x, y = _a.y;
|
|
145
|
+
_this.keys.forEach(function (k) {
|
|
146
|
+
_this.cells[x][y].properties[k] = p.properties[k];
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
InterpolationMatrix.prototype.generateCells = function () {
|
|
151
|
+
for (var i = this.minPoint.x, x = 0; i < this.maxPoint.x; i += this.stepSize, x++) {
|
|
152
|
+
this.cells[x] = this.cells[x] || {};
|
|
153
|
+
for (var j = this.minPoint.y, y = 0; j < this.maxPoint.y; j += this.stepSize, y++) {
|
|
154
|
+
var t = this.sizePoly
|
|
155
|
+
.clone()
|
|
156
|
+
.loop()
|
|
157
|
+
.move(i, j)
|
|
158
|
+
.run()
|
|
159
|
+
.setProperties({
|
|
160
|
+
x: x,
|
|
161
|
+
y: y
|
|
162
|
+
});
|
|
163
|
+
this.cells[x][y] = t;
|
|
164
|
+
this.allCells.push(t);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
return InterpolationMatrix;
|
|
169
|
+
}());
|
|
170
|
+
export { InterpolationMatrix };
|