dgeoutils 2.4.32 → 2.4.34
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/DPolygon.d.ts +2 -0
- package/dist/cjs/DPolygon.js +14 -0
- package/dist/cjs/InterpolationMatrix.d.ts +3 -3
- package/dist/cjs/InterpolationMatrix.js +18 -18
- package/dist/es2015/DPolygon.js +6 -0
- package/dist/es2015/InterpolationMatrix.js +17 -5
- package/dist/esm/DPolygon.js +14 -0
- package/dist/esm/InterpolationMatrix.js +18 -18
- package/dist/umd/dgeoutils.js +59 -45
- package/dist/umd/dgeoutils.min.js +1 -1
- package/dist/umd/dgeoutils.min.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/DPolygon.d.ts
CHANGED
|
@@ -38,7 +38,9 @@ export declare class DPolygon {
|
|
|
38
38
|
get extend(): DPolygon;
|
|
39
39
|
get size(): DPoint;
|
|
40
40
|
get leftTop(): DPoint;
|
|
41
|
+
get minPoint(): DPoint;
|
|
41
42
|
get rightBottom(): DPoint;
|
|
43
|
+
get maxPoint(): DPoint;
|
|
42
44
|
get length(): number;
|
|
43
45
|
get fullLength(): number;
|
|
44
46
|
get perimeter(): number;
|
package/dist/cjs/DPolygon.js
CHANGED
|
@@ -340,6 +340,13 @@ var DPolygon = (function () {
|
|
|
340
340
|
enumerable: false,
|
|
341
341
|
configurable: true
|
|
342
342
|
});
|
|
343
|
+
Object.defineProperty(DPolygon.prototype, "minPoint", {
|
|
344
|
+
get: function () {
|
|
345
|
+
return this.leftTop;
|
|
346
|
+
},
|
|
347
|
+
enumerable: false,
|
|
348
|
+
configurable: true
|
|
349
|
+
});
|
|
343
350
|
Object.defineProperty(DPolygon.prototype, "rightBottom", {
|
|
344
351
|
get: function () {
|
|
345
352
|
var _a = this, maxX = _a.maxX, maxY = _a.maxY;
|
|
@@ -348,6 +355,13 @@ var DPolygon = (function () {
|
|
|
348
355
|
enumerable: false,
|
|
349
356
|
configurable: true
|
|
350
357
|
});
|
|
358
|
+
Object.defineProperty(DPolygon.prototype, "maxPoint", {
|
|
359
|
+
get: function () {
|
|
360
|
+
return this.rightBottom;
|
|
361
|
+
},
|
|
362
|
+
enumerable: false,
|
|
363
|
+
configurable: true
|
|
364
|
+
});
|
|
351
365
|
Object.defineProperty(DPolygon.prototype, "length", {
|
|
352
366
|
get: function () {
|
|
353
367
|
return this.pPoints.length;
|
|
@@ -3,19 +3,19 @@ import { DPoint } from './DPoint';
|
|
|
3
3
|
export declare class InterpolationMatrix {
|
|
4
4
|
private readonly stepSize;
|
|
5
5
|
private readonly p;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
readonly minPoint: DPoint;
|
|
7
|
+
readonly maxPoint: DPoint;
|
|
8
8
|
private points;
|
|
9
9
|
private cells;
|
|
10
10
|
private allCells;
|
|
11
11
|
private readonly sizePoly;
|
|
12
12
|
private readonly keys;
|
|
13
|
+
readonly size: DPoint;
|
|
13
14
|
constructor(bboxLike: DPolygon, stepSize: number, keys: string[] | string, p?: number);
|
|
14
15
|
setKnownPoints(points: DPoint[] | DPolygon): InterpolationMatrix;
|
|
15
16
|
positionToCellCoords(d: DPoint): DPoint;
|
|
16
17
|
calculate(): InterpolationMatrix;
|
|
17
18
|
getCellValue({ x, y }: DPoint, key?: string | string[]): (number | Record<string, number>);
|
|
18
|
-
get size(): DPoint;
|
|
19
19
|
get getCellData(): Record<number, Record<number, Record<string, number>>>;
|
|
20
20
|
get allCellsClone(): DPolygon[];
|
|
21
21
|
private interpolateValues;
|
|
@@ -37,15 +37,6 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
37
37
|
}
|
|
38
38
|
return ar;
|
|
39
39
|
};
|
|
40
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
41
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
42
|
-
if (ar || !(i in from)) {
|
|
43
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
44
|
-
ar[i] = from[i];
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
48
|
-
};
|
|
49
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
41
|
exports.InterpolationMatrix = void 0;
|
|
51
42
|
var DPolygon_1 = require("./DPolygon");
|
|
@@ -59,14 +50,30 @@ var InterpolationMatrix = (function () {
|
|
|
59
50
|
this.points = [];
|
|
60
51
|
this.cells = {};
|
|
61
52
|
this.allCells = [];
|
|
62
|
-
this.minPoint = bboxLike.
|
|
63
|
-
this.maxPoint = bboxLike.
|
|
53
|
+
this.minPoint = bboxLike.minPoint;
|
|
54
|
+
this.maxPoint = bboxLike.maxPoint;
|
|
64
55
|
this.sizePoly = DPolygon_1.DPolygon.createSquareBySize(new DPoint_1.DPoint(this.stepSize));
|
|
56
|
+
this.size = this.maxPoint.clone().move(this.minPoint.clone().minus())
|
|
57
|
+
.divide(this.stepSize)
|
|
58
|
+
.ceil();
|
|
65
59
|
this.keys = Array.isArray(keys) ? keys : [keys];
|
|
66
60
|
this.generateCells();
|
|
67
61
|
}
|
|
68
62
|
InterpolationMatrix.prototype.setKnownPoints = function (points) {
|
|
63
|
+
var _this = this;
|
|
69
64
|
this.points = points instanceof DPolygon_1.DPolygon ? points.points : points;
|
|
65
|
+
this.minPoint.setProperties(this.points.reduce(function (a, v) { return _this.keys
|
|
66
|
+
.reduce(function (aa, k) {
|
|
67
|
+
var _a;
|
|
68
|
+
aa[k] = Math.min((_a = a[k]) !== null && _a !== void 0 ? _a : Infinity, v.properties[k]);
|
|
69
|
+
return aa;
|
|
70
|
+
}, a); }, {}));
|
|
71
|
+
this.maxPoint.setProperties(this.points.reduce(function (a, v) { return _this.keys
|
|
72
|
+
.reduce(function (aa, k) {
|
|
73
|
+
var _a;
|
|
74
|
+
aa[k] = Math.max((_a = a[k]) !== null && _a !== void 0 ? _a : -Infinity, v.properties[k]);
|
|
75
|
+
return aa;
|
|
76
|
+
}, a); }, {}));
|
|
70
77
|
return this;
|
|
71
78
|
};
|
|
72
79
|
InterpolationMatrix.prototype.positionToCellCoords = function (d) {
|
|
@@ -94,13 +101,6 @@ var InterpolationMatrix = (function () {
|
|
|
94
101
|
}
|
|
95
102
|
return __assign({}, cell.properties);
|
|
96
103
|
};
|
|
97
|
-
Object.defineProperty(InterpolationMatrix.prototype, "size", {
|
|
98
|
-
get: function () {
|
|
99
|
-
return new DPoint_1.DPoint(Math.max.apply(Math, __spreadArray([], __read(Object.keys(this.cells).map(Number)), false)), Math.max.apply(Math, __spreadArray([], __read(Object.keys(this.cells[0]).map(Number)), false)));
|
|
100
|
-
},
|
|
101
|
-
enumerable: false,
|
|
102
|
-
configurable: true
|
|
103
|
-
});
|
|
104
104
|
Object.defineProperty(InterpolationMatrix.prototype, "getCellData", {
|
|
105
105
|
get: function () {
|
|
106
106
|
return this.allCells.reduce(function (a, c) {
|
package/dist/es2015/DPolygon.js
CHANGED
|
@@ -178,10 +178,16 @@ export class DPolygon {
|
|
|
178
178
|
const { minX, minY } = this;
|
|
179
179
|
return new DPoint(minX, minY);
|
|
180
180
|
}
|
|
181
|
+
get minPoint() {
|
|
182
|
+
return this.leftTop;
|
|
183
|
+
}
|
|
181
184
|
get rightBottom() {
|
|
182
185
|
const { maxX, maxY } = this;
|
|
183
186
|
return new DPoint(maxX, maxY);
|
|
184
187
|
}
|
|
188
|
+
get maxPoint() {
|
|
189
|
+
return this.rightBottom;
|
|
190
|
+
}
|
|
185
191
|
get length() {
|
|
186
192
|
return this.pPoints.length;
|
|
187
193
|
}
|
|
@@ -19,14 +19,29 @@ export class InterpolationMatrix {
|
|
|
19
19
|
this.points = [];
|
|
20
20
|
this.cells = {};
|
|
21
21
|
this.allCells = [];
|
|
22
|
-
this.minPoint = bboxLike.
|
|
23
|
-
this.maxPoint = bboxLike.
|
|
22
|
+
this.minPoint = bboxLike.minPoint;
|
|
23
|
+
this.maxPoint = bboxLike.maxPoint;
|
|
24
24
|
this.sizePoly = DPolygon.createSquareBySize(new DPoint(this.stepSize));
|
|
25
|
+
this.size = this.maxPoint.clone().move(this.minPoint.clone().minus())
|
|
26
|
+
.divide(this.stepSize)
|
|
27
|
+
.ceil();
|
|
25
28
|
this.keys = Array.isArray(keys) ? keys : [keys];
|
|
26
29
|
this.generateCells();
|
|
27
30
|
}
|
|
28
31
|
setKnownPoints(points) {
|
|
29
32
|
this.points = points instanceof DPolygon ? points.points : points;
|
|
33
|
+
this.minPoint.setProperties(this.points.reduce((a, v) => this.keys
|
|
34
|
+
.reduce((aa, k) => {
|
|
35
|
+
var _a;
|
|
36
|
+
aa[k] = Math.min((_a = a[k]) !== null && _a !== void 0 ? _a : Infinity, v.properties[k]);
|
|
37
|
+
return aa;
|
|
38
|
+
}, a), {}));
|
|
39
|
+
this.maxPoint.setProperties(this.points.reduce((a, v) => this.keys
|
|
40
|
+
.reduce((aa, k) => {
|
|
41
|
+
var _a;
|
|
42
|
+
aa[k] = Math.max((_a = a[k]) !== null && _a !== void 0 ? _a : -Infinity, v.properties[k]);
|
|
43
|
+
return aa;
|
|
44
|
+
}, a), {}));
|
|
30
45
|
return this;
|
|
31
46
|
}
|
|
32
47
|
positionToCellCoords(d) {
|
|
@@ -53,9 +68,6 @@ export class InterpolationMatrix {
|
|
|
53
68
|
}
|
|
54
69
|
return Object.assign({}, cell.properties);
|
|
55
70
|
}
|
|
56
|
-
get size() {
|
|
57
|
-
return new DPoint(Math.max(...Object.keys(this.cells).map(Number)), Math.max(...Object.keys(this.cells[0]).map(Number)));
|
|
58
|
-
}
|
|
59
71
|
get getCellData() {
|
|
60
72
|
return this.allCells.reduce((a, c) => {
|
|
61
73
|
const _a = c.properties, { x, y } = _a, props = __rest(_a, ["x", "y"]);
|
package/dist/esm/DPolygon.js
CHANGED
|
@@ -337,6 +337,13 @@ var DPolygon = (function () {
|
|
|
337
337
|
enumerable: false,
|
|
338
338
|
configurable: true
|
|
339
339
|
});
|
|
340
|
+
Object.defineProperty(DPolygon.prototype, "minPoint", {
|
|
341
|
+
get: function () {
|
|
342
|
+
return this.leftTop;
|
|
343
|
+
},
|
|
344
|
+
enumerable: false,
|
|
345
|
+
configurable: true
|
|
346
|
+
});
|
|
340
347
|
Object.defineProperty(DPolygon.prototype, "rightBottom", {
|
|
341
348
|
get: function () {
|
|
342
349
|
var _a = this, maxX = _a.maxX, maxY = _a.maxY;
|
|
@@ -345,6 +352,13 @@ var DPolygon = (function () {
|
|
|
345
352
|
enumerable: false,
|
|
346
353
|
configurable: true
|
|
347
354
|
});
|
|
355
|
+
Object.defineProperty(DPolygon.prototype, "maxPoint", {
|
|
356
|
+
get: function () {
|
|
357
|
+
return this.rightBottom;
|
|
358
|
+
},
|
|
359
|
+
enumerable: false,
|
|
360
|
+
configurable: true
|
|
361
|
+
});
|
|
348
362
|
Object.defineProperty(DPolygon.prototype, "length", {
|
|
349
363
|
get: function () {
|
|
350
364
|
return this.pPoints.length;
|
|
@@ -36,15 +36,6 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
36
36
|
}
|
|
37
37
|
return ar;
|
|
38
38
|
};
|
|
39
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
40
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
41
|
-
if (ar || !(i in from)) {
|
|
42
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
43
|
-
ar[i] = from[i];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
47
|
-
};
|
|
48
39
|
import { DPolygon } from './DPolygon';
|
|
49
40
|
import { DPoint } from './DPoint';
|
|
50
41
|
import { isDefAndNotNull } from './utils';
|
|
@@ -56,14 +47,30 @@ var InterpolationMatrix = (function () {
|
|
|
56
47
|
this.points = [];
|
|
57
48
|
this.cells = {};
|
|
58
49
|
this.allCells = [];
|
|
59
|
-
this.minPoint = bboxLike.
|
|
60
|
-
this.maxPoint = bboxLike.
|
|
50
|
+
this.minPoint = bboxLike.minPoint;
|
|
51
|
+
this.maxPoint = bboxLike.maxPoint;
|
|
61
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();
|
|
62
56
|
this.keys = Array.isArray(keys) ? keys : [keys];
|
|
63
57
|
this.generateCells();
|
|
64
58
|
}
|
|
65
59
|
InterpolationMatrix.prototype.setKnownPoints = function (points) {
|
|
60
|
+
var _this = this;
|
|
66
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); }, {}));
|
|
67
74
|
return this;
|
|
68
75
|
};
|
|
69
76
|
InterpolationMatrix.prototype.positionToCellCoords = function (d) {
|
|
@@ -91,13 +98,6 @@ var InterpolationMatrix = (function () {
|
|
|
91
98
|
}
|
|
92
99
|
return __assign({}, cell.properties);
|
|
93
100
|
};
|
|
94
|
-
Object.defineProperty(InterpolationMatrix.prototype, "size", {
|
|
95
|
-
get: function () {
|
|
96
|
-
return new DPoint(Math.max.apply(Math, __spreadArray([], __read(Object.keys(this.cells).map(Number)), false)), Math.max.apply(Math, __spreadArray([], __read(Object.keys(this.cells[0]).map(Number)), false)));
|
|
97
|
-
},
|
|
98
|
-
enumerable: false,
|
|
99
|
-
configurable: true
|
|
100
|
-
});
|
|
101
101
|
Object.defineProperty(InterpolationMatrix.prototype, "getCellData", {
|
|
102
102
|
get: function () {
|
|
103
103
|
return this.allCells.reduce(function (a, c) {
|