dgeoutils 2.4.16 → 2.4.19
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/DPoint.d.ts +7 -1
- package/dist/cjs/DPoint.js +25 -0
- package/dist/es2015/DPoint.js +25 -0
- package/dist/esm/DPoint.js +25 -0
- package/dist/umd/dgeoutils.js +26 -1
- 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/DPoint.d.ts
CHANGED
|
@@ -9,6 +9,11 @@ export interface LatLng {
|
|
|
9
9
|
lon?: number;
|
|
10
10
|
alt?: number;
|
|
11
11
|
}
|
|
12
|
+
export interface XYZ extends Record<string, any> {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
z?: number;
|
|
16
|
+
}
|
|
12
17
|
export declare const HALF_PI_IN_DEGREE = 90;
|
|
13
18
|
export declare const PI_IN_DEGREE = 180;
|
|
14
19
|
export declare const DOUBLE_PI_IN_DEGREE = 360;
|
|
@@ -25,7 +30,7 @@ export declare class DPoint {
|
|
|
25
30
|
constructor(x: number, y: number);
|
|
26
31
|
constructor(x: number, y: number, z?: number);
|
|
27
32
|
static zero(): DPoint;
|
|
28
|
-
static parse(c: LatLng | number[] | DCoord | Point, format?: string): DPoint;
|
|
33
|
+
static parse(c: LatLng | number[] | DCoord | Point | Feature<Point> | XYZ, format?: string): DPoint;
|
|
29
34
|
static parseFromWKT(wkt: string): DPoint;
|
|
30
35
|
static random(): DPoint;
|
|
31
36
|
static getTileFromQuadKey(quadKey: string): DPoint;
|
|
@@ -120,6 +125,7 @@ export declare class DPoint {
|
|
|
120
125
|
set alt(v: number | undefined);
|
|
121
126
|
simple<T extends Record<string, number>>(xKey?: string, yKey?: string, zKey?: string): T;
|
|
122
127
|
setIfLessThan(p: DPoint): DPoint;
|
|
128
|
+
setIfMoreThan(p: DPoint): DPoint;
|
|
123
129
|
minus(): DPoint;
|
|
124
130
|
orthodromicPath(point: DPoint, pointsCount?: number): DPolygon;
|
|
125
131
|
sortByDistance(p: DPolygon): DPolygon;
|
package/dist/cjs/DPoint.js
CHANGED
|
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
13
24
|
var __read = (this && this.__read) || function (o, n) {
|
|
14
25
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
26
|
if (!m) return o;
|
|
@@ -63,10 +74,19 @@ var DPoint = (function () {
|
|
|
63
74
|
if (lat && lng) {
|
|
64
75
|
return new DPoint(lng, lat, alt !== null && alt !== void 0 ? alt : 0);
|
|
65
76
|
}
|
|
77
|
+
var _c = c, x = _c.x, y = _c.y, z = _c.z, properties = __rest(_c, ["x", "y", "z"]);
|
|
78
|
+
if ((0, utils_1.isDefAndNotNull)(x) && (0, utils_1.isDefAndNotNull)(y)) {
|
|
79
|
+
return new DPoint(x, y, z).setProperties(properties);
|
|
80
|
+
}
|
|
66
81
|
var t = c;
|
|
67
82
|
if (c.type === 'Point') {
|
|
68
83
|
t = c.coordinates;
|
|
69
84
|
}
|
|
85
|
+
if (c.type === 'Feature') {
|
|
86
|
+
var f = DPoint.parse(c.geometry, format);
|
|
87
|
+
f.properties = __assign({}, c.properties);
|
|
88
|
+
return f;
|
|
89
|
+
}
|
|
70
90
|
return format.replace(/[^x-z]/gmiu, '')
|
|
71
91
|
.split('')
|
|
72
92
|
.reduce(function (a, k, index) {
|
|
@@ -713,6 +733,11 @@ var DPoint = (function () {
|
|
|
713
733
|
this.y = Math.max(this.y, p.y);
|
|
714
734
|
return this;
|
|
715
735
|
};
|
|
736
|
+
DPoint.prototype.setIfMoreThan = function (p) {
|
|
737
|
+
this.x = Math.min(this.x, p.x);
|
|
738
|
+
this.y = Math.min(this.y, p.y);
|
|
739
|
+
return this;
|
|
740
|
+
};
|
|
716
741
|
DPoint.prototype.minus = function () {
|
|
717
742
|
return this.scale(-1);
|
|
718
743
|
};
|
package/dist/es2015/DPoint.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { DLine } from './DLine';
|
|
2
13
|
import { DPolygon } from './DPolygon';
|
|
3
14
|
import { checkFunction, createArray, DGeo, div, isDefAndNotNull } from './utils';
|
|
@@ -30,10 +41,19 @@ export class DPoint {
|
|
|
30
41
|
if (lat && lng) {
|
|
31
42
|
return new DPoint(lng, lat, alt !== null && alt !== void 0 ? alt : 0);
|
|
32
43
|
}
|
|
44
|
+
const _a = c, { x, y, z } = _a, properties = __rest(_a, ["x", "y", "z"]);
|
|
45
|
+
if (isDefAndNotNull(x) && isDefAndNotNull(y)) {
|
|
46
|
+
return new DPoint(x, y, z).setProperties(properties);
|
|
47
|
+
}
|
|
33
48
|
let t = c;
|
|
34
49
|
if (c.type === 'Point') {
|
|
35
50
|
t = c.coordinates;
|
|
36
51
|
}
|
|
52
|
+
if (c.type === 'Feature') {
|
|
53
|
+
const f = DPoint.parse(c.geometry, format);
|
|
54
|
+
f.properties = Object.assign({}, c.properties);
|
|
55
|
+
return f;
|
|
56
|
+
}
|
|
37
57
|
return format.replace(/[^x-z]/gmiu, '')
|
|
38
58
|
.split('')
|
|
39
59
|
.reduce((a, k, index) => {
|
|
@@ -590,6 +610,11 @@ export class DPoint {
|
|
|
590
610
|
this.y = Math.max(this.y, p.y);
|
|
591
611
|
return this;
|
|
592
612
|
}
|
|
613
|
+
setIfMoreThan(p) {
|
|
614
|
+
this.x = Math.min(this.x, p.x);
|
|
615
|
+
this.y = Math.min(this.y, p.y);
|
|
616
|
+
return this;
|
|
617
|
+
}
|
|
593
618
|
minus() {
|
|
594
619
|
return this.scale(-1);
|
|
595
620
|
}
|
package/dist/esm/DPoint.js
CHANGED
|
@@ -9,6 +9,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
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
|
+
};
|
|
12
23
|
var __read = (this && this.__read) || function (o, n) {
|
|
13
24
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
25
|
if (!m) return o;
|
|
@@ -60,10 +71,19 @@ var DPoint = (function () {
|
|
|
60
71
|
if (lat && lng) {
|
|
61
72
|
return new DPoint(lng, lat, alt !== null && alt !== void 0 ? alt : 0);
|
|
62
73
|
}
|
|
74
|
+
var _c = c, x = _c.x, y = _c.y, z = _c.z, properties = __rest(_c, ["x", "y", "z"]);
|
|
75
|
+
if (isDefAndNotNull(x) && isDefAndNotNull(y)) {
|
|
76
|
+
return new DPoint(x, y, z).setProperties(properties);
|
|
77
|
+
}
|
|
63
78
|
var t = c;
|
|
64
79
|
if (c.type === 'Point') {
|
|
65
80
|
t = c.coordinates;
|
|
66
81
|
}
|
|
82
|
+
if (c.type === 'Feature') {
|
|
83
|
+
var f = DPoint.parse(c.geometry, format);
|
|
84
|
+
f.properties = __assign({}, c.properties);
|
|
85
|
+
return f;
|
|
86
|
+
}
|
|
67
87
|
return format.replace(/[^x-z]/gmiu, '')
|
|
68
88
|
.split('')
|
|
69
89
|
.reduce(function (a, k, index) {
|
|
@@ -710,6 +730,11 @@ var DPoint = (function () {
|
|
|
710
730
|
this.y = Math.max(this.y, p.y);
|
|
711
731
|
return this;
|
|
712
732
|
};
|
|
733
|
+
DPoint.prototype.setIfMoreThan = function (p) {
|
|
734
|
+
this.x = Math.min(this.x, p.x);
|
|
735
|
+
this.y = Math.min(this.y, p.y);
|
|
736
|
+
return this;
|
|
737
|
+
};
|
|
713
738
|
DPoint.prototype.minus = function () {
|
|
714
739
|
return this.scale(-1);
|
|
715
740
|
};
|