dgeoutils 2.4.0 → 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/cjs/DCircle.js +1 -1
- package/dist/cjs/DLine.js +2 -2
- package/dist/cjs/DPoint.js +2 -2
- package/dist/cjs/DPolygon.js +11 -11
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/utils.js +6 -6
- package/dist/es2015/DPolygon.js +1 -1
- 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 +3 -9
package/dist/cjs/DCircle.js
CHANGED
|
@@ -12,7 +12,7 @@ var DCircle = (function () {
|
|
|
12
12
|
this.r = r;
|
|
13
13
|
}
|
|
14
14
|
DCircle.prototype.toString = function () {
|
|
15
|
-
return "("
|
|
15
|
+
return "(".concat(this.center.toString(), ", ").concat(this.r, ")");
|
|
16
16
|
};
|
|
17
17
|
DCircle.prototype.getValue = function () {
|
|
18
18
|
return { center: this.center, r: this.r };
|
package/dist/cjs/DLine.js
CHANGED
|
@@ -159,7 +159,7 @@ var DLine = (function () {
|
|
|
159
159
|
configurable: true
|
|
160
160
|
});
|
|
161
161
|
DLine.prototype.toString = function () {
|
|
162
|
-
return "("
|
|
162
|
+
return "(".concat(this.a, ", ").concat(this.b, ", ").concat(this.c, ")");
|
|
163
163
|
};
|
|
164
164
|
DLine.prototype.getValue = function () {
|
|
165
165
|
return [this.a, this.b, this.c];
|
|
@@ -260,7 +260,7 @@ var DLine = (function () {
|
|
|
260
260
|
};
|
|
261
261
|
DLine.prototype.toWKT = function () {
|
|
262
262
|
var _a = this, _b = _a.begin, x1 = _b.x, y1 = _b.y, _c = _a.end, x2 = _c.x, y2 = _c.y;
|
|
263
|
-
return "LINESTRING ("
|
|
263
|
+
return "LINESTRING (".concat(x1, " ").concat(y1, ", ").concat(x2, " ").concat(y2, ")");
|
|
264
264
|
};
|
|
265
265
|
DLine.prototype.movePoint = function (i, k) {
|
|
266
266
|
var isArray = Array.isArray(i);
|
package/dist/cjs/DPoint.js
CHANGED
|
@@ -136,7 +136,7 @@ var DPoint = (function () {
|
|
|
136
136
|
return a2 + Math.PI * 2 - a1;
|
|
137
137
|
};
|
|
138
138
|
DPoint.prototype.toString = function () {
|
|
139
|
-
return this.x
|
|
139
|
+
return "".concat(this.x, " ").concat(this.y);
|
|
140
140
|
};
|
|
141
141
|
DPoint.prototype.getValue = function () {
|
|
142
142
|
return [this.x, this.y];
|
|
@@ -147,7 +147,7 @@ var DPoint = (function () {
|
|
|
147
147
|
};
|
|
148
148
|
DPoint.prototype.toWKT = function () {
|
|
149
149
|
var _a = this, x = _a.x, y = _a.y;
|
|
150
|
-
return "POINT ("
|
|
150
|
+
return "POINT (".concat(x, " ").concat(y, ")");
|
|
151
151
|
};
|
|
152
152
|
DPoint.prototype.distance = function (p) {
|
|
153
153
|
(0, utils_1.checkFunction)('distance')
|
package/dist/cjs/DPolygon.js
CHANGED
|
@@ -68,10 +68,10 @@ var DPoint_1 = require("./DPoint");
|
|
|
68
68
|
var DLine_1 = require("./DLine");
|
|
69
69
|
var DCircle_1 = require("./DCircle");
|
|
70
70
|
var DNumbers_1 = require("./DNumbers");
|
|
71
|
-
var
|
|
71
|
+
var jsts_js_1 = require("jsts/dist/jsts.js");
|
|
72
72
|
var DPolygonLoop_1 = require("./DPolygonLoop");
|
|
73
73
|
var utils_1 = require("./utils");
|
|
74
|
-
var _a =
|
|
74
|
+
var _a = jsts_js_1.operation.buffer.BufferParameters, CAP_ROUND = _a.CAP_ROUND, CAP_FLAT = _a.CAP_FLAT, CAP_SQUARE = _a.CAP_SQUARE;
|
|
75
75
|
exports.MIN_POINTS_IN_VALID_POLYGON = 3;
|
|
76
76
|
var APPROXIMATION_VALUE = 0.1;
|
|
77
77
|
var MAX_CONVEX_ITERATIONS = 100;
|
|
@@ -676,14 +676,14 @@ var DPolygon = (function () {
|
|
|
676
676
|
if (type === DPolygon.WKT_POLYGON) {
|
|
677
677
|
var h = '';
|
|
678
678
|
if (this.holes && this.holes.length) {
|
|
679
|
-
h = ", "
|
|
680
|
-
.join(', ');
|
|
679
|
+
h = ", ".concat(this.holes.map(function (hole) { return hole.toString(); })
|
|
680
|
+
.join(', '));
|
|
681
681
|
}
|
|
682
|
-
return "POLYGON (("
|
|
683
|
-
.join(', ')
|
|
682
|
+
return "POLYGON ((".concat(this.deintersection.mapArray(function (r) { return "".concat(r.x, " ").concat(r.y).concat(withZ ? " ".concat(r.z) : ''); })
|
|
683
|
+
.join(', '), ")").concat(h, ")");
|
|
684
684
|
}
|
|
685
|
-
return "LINESTRING ("
|
|
686
|
-
.join(', ')
|
|
685
|
+
return "LINESTRING (".concat(this.mapArray(function (r) { return "".concat(r.x, " ").concat(r.y).concat(withZ ? " ".concat(r.z) : ''); })
|
|
686
|
+
.join(', '), ")");
|
|
687
687
|
};
|
|
688
688
|
DPolygon.prototype.filter = function (f) {
|
|
689
689
|
this.pPoints = this.pPoints.filter(f);
|
|
@@ -737,7 +737,7 @@ var DPolygon = (function () {
|
|
|
737
737
|
.reduce(function (a, h) { return a + h.getValue(); }, ''));
|
|
738
738
|
};
|
|
739
739
|
DPolygon.prototype.toString = function () {
|
|
740
|
-
return "("
|
|
740
|
+
return "(".concat(this.mapArray(function (r) { return r.toString(); }).join(', '), ")");
|
|
741
741
|
};
|
|
742
742
|
DPolygon.prototype.close = function () {
|
|
743
743
|
var p0 = this.first;
|
|
@@ -1283,7 +1283,7 @@ var DPolygon = (function () {
|
|
|
1283
1283
|
DPolygon.prototype.buffer = function (v, quadrantSegments, type) {
|
|
1284
1284
|
if (quadrantSegments === void 0) { quadrantSegments = 64; }
|
|
1285
1285
|
if (type === void 0) { type = DPolygon.CAP_ROUND; }
|
|
1286
|
-
var reader = new
|
|
1286
|
+
var reader = new jsts_js_1.io.WKTReader();
|
|
1287
1287
|
var _a = this, noHoles = _a.noHoles, closed = _a.closed;
|
|
1288
1288
|
var points = reader
|
|
1289
1289
|
.read(noHoles.toWKT(closed ? DPolygon.WKT_POLYGON : DPolygon.WKT_LINESTRING))
|
|
@@ -1415,7 +1415,7 @@ var DPolygon = (function () {
|
|
|
1415
1415
|
};
|
|
1416
1416
|
DPolygon.prototype.getJSTSGeometry = function (p, unionThis, unionThat) {
|
|
1417
1417
|
var unionOrIntersection = unionThat === unionThis;
|
|
1418
|
-
var reader = new
|
|
1418
|
+
var reader = new jsts_js_1.io.WKTReader();
|
|
1419
1419
|
var a = reader.read(this.noHoles.toWKT());
|
|
1420
1420
|
var b = reader.read(p.noHoles.toWKT());
|
|
1421
1421
|
if (!unionOrIntersection) {
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/cjs/utils.js
CHANGED
|
@@ -46,38 +46,38 @@ var hook = function (scope) { return function () { return scope; }; };
|
|
|
46
46
|
var shouldBeInt = function (scope, funcName, argName) { return function (p) {
|
|
47
47
|
if (!p.clone().round()
|
|
48
48
|
.equal(p)) {
|
|
49
|
-
(0, exports.warn)("\""
|
|
49
|
+
(0, exports.warn)("\"".concat(funcName, "\" -> \"").concat(argName, "\" should be Int!"));
|
|
50
50
|
}
|
|
51
51
|
return scope;
|
|
52
52
|
}; };
|
|
53
53
|
var shouldBeUInt = function (scope, funcName, argName) { return function (p) {
|
|
54
54
|
if (!p.clone().round()
|
|
55
55
|
.equal(p) || !p.gtOrEqual(DPoint_1.DPoint.zero())) {
|
|
56
|
-
(0, exports.warn)("\""
|
|
56
|
+
(0, exports.warn)("\"".concat(funcName, "\" -> \"").concat(argName, "\" should be UInt!"));
|
|
57
57
|
}
|
|
58
58
|
return scope;
|
|
59
59
|
}; };
|
|
60
60
|
var shouldBeDegree = function (scope, funcName, argName) { return function (p) {
|
|
61
61
|
if (!p.likeWorldGeodeticSystem) {
|
|
62
|
-
(0, exports.warn)("\""
|
|
62
|
+
(0, exports.warn)("\"".concat(funcName, "\" -> \"").concat(argName, "\" should be degree!"));
|
|
63
63
|
}
|
|
64
64
|
return scope;
|
|
65
65
|
}; };
|
|
66
66
|
var shouldBeRadians = function (scope, funcName, argName) { return function (p) {
|
|
67
67
|
if (!p.likeRadians) {
|
|
68
|
-
(0, exports.warn)("\""
|
|
68
|
+
(0, exports.warn)("\"".concat(funcName, "\" -> \"").concat(argName, "\" should be radians!"));
|
|
69
69
|
}
|
|
70
70
|
return scope;
|
|
71
71
|
}; };
|
|
72
72
|
var shouldExist = function (scope, funcName, argName) { return function (p) {
|
|
73
73
|
if (!(0, exports.isDefAndNotNull)(p)) {
|
|
74
|
-
(0, exports.warn)("\""
|
|
74
|
+
(0, exports.warn)("\"".concat(funcName, "\" -> \"").concat(argName, "\" should exist!"));
|
|
75
75
|
}
|
|
76
76
|
return scope;
|
|
77
77
|
}; };
|
|
78
78
|
var shouldBeMeters = function (scope, funcName, argName) { return function (p) {
|
|
79
79
|
if (!p.likePseudoMercator) {
|
|
80
|
-
(0, exports.warn)("\""
|
|
80
|
+
(0, exports.warn)("\"".concat(funcName, "\" -> \"").concat(argName, "\" should be meters!"));
|
|
81
81
|
}
|
|
82
82
|
return scope;
|
|
83
83
|
}; };
|
package/dist/es2015/DPolygon.js
CHANGED
|
@@ -2,7 +2,7 @@ import { DPoint } from './DPoint';
|
|
|
2
2
|
import { DLine } from './DLine';
|
|
3
3
|
import { DCircle } from './DCircle';
|
|
4
4
|
import { DNumbers } from './DNumbers';
|
|
5
|
-
import { io as jstsIo, operation } from 'jsts';
|
|
5
|
+
import { io as jstsIo, operation } from 'jsts/dist/jsts.js';
|
|
6
6
|
import { DPolygonLoop } from './DPolygonLoop';
|
|
7
7
|
import { isDefAndNotNull } from './utils';
|
|
8
8
|
const { buffer: { BufferParameters: { CAP_ROUND, CAP_FLAT, CAP_SQUARE } } } = operation;
|
package/dist/esm/DCircle.js
CHANGED
|
@@ -9,7 +9,7 @@ var DCircle = (function () {
|
|
|
9
9
|
this.r = r;
|
|
10
10
|
}
|
|
11
11
|
DCircle.prototype.toString = function () {
|
|
12
|
-
return "("
|
|
12
|
+
return "(".concat(this.center.toString(), ", ").concat(this.r, ")");
|
|
13
13
|
};
|
|
14
14
|
DCircle.prototype.getValue = function () {
|
|
15
15
|
return { center: this.center, r: this.r };
|
package/dist/esm/DLine.js
CHANGED
|
@@ -156,7 +156,7 @@ var DLine = (function () {
|
|
|
156
156
|
configurable: true
|
|
157
157
|
});
|
|
158
158
|
DLine.prototype.toString = function () {
|
|
159
|
-
return "("
|
|
159
|
+
return "(".concat(this.a, ", ").concat(this.b, ", ").concat(this.c, ")");
|
|
160
160
|
};
|
|
161
161
|
DLine.prototype.getValue = function () {
|
|
162
162
|
return [this.a, this.b, this.c];
|
|
@@ -257,7 +257,7 @@ var DLine = (function () {
|
|
|
257
257
|
};
|
|
258
258
|
DLine.prototype.toWKT = function () {
|
|
259
259
|
var _a = this, _b = _a.begin, x1 = _b.x, y1 = _b.y, _c = _a.end, x2 = _c.x, y2 = _c.y;
|
|
260
|
-
return "LINESTRING ("
|
|
260
|
+
return "LINESTRING (".concat(x1, " ").concat(y1, ", ").concat(x2, " ").concat(y2, ")");
|
|
261
261
|
};
|
|
262
262
|
DLine.prototype.movePoint = function (i, k) {
|
|
263
263
|
var isArray = Array.isArray(i);
|
package/dist/esm/DPoint.js
CHANGED
|
@@ -133,7 +133,7 @@ var DPoint = (function () {
|
|
|
133
133
|
return a2 + Math.PI * 2 - a1;
|
|
134
134
|
};
|
|
135
135
|
DPoint.prototype.toString = function () {
|
|
136
|
-
return this.x
|
|
136
|
+
return "".concat(this.x, " ").concat(this.y);
|
|
137
137
|
};
|
|
138
138
|
DPoint.prototype.getValue = function () {
|
|
139
139
|
return [this.x, this.y];
|
|
@@ -144,7 +144,7 @@ var DPoint = (function () {
|
|
|
144
144
|
};
|
|
145
145
|
DPoint.prototype.toWKT = function () {
|
|
146
146
|
var _a = this, x = _a.x, y = _a.y;
|
|
147
|
-
return "POINT ("
|
|
147
|
+
return "POINT (".concat(x, " ").concat(y, ")");
|
|
148
148
|
};
|
|
149
149
|
DPoint.prototype.distance = function (p) {
|
|
150
150
|
checkFunction('distance')
|
package/dist/esm/DPolygon.js
CHANGED
|
@@ -65,7 +65,7 @@ import { DPoint } from './DPoint';
|
|
|
65
65
|
import { DLine } from './DLine';
|
|
66
66
|
import { DCircle } from './DCircle';
|
|
67
67
|
import { DNumbers } from './DNumbers';
|
|
68
|
-
import { io as jstsIo, operation } from 'jsts';
|
|
68
|
+
import { io as jstsIo, operation } from 'jsts/dist/jsts.js';
|
|
69
69
|
import { DPolygonLoop } from './DPolygonLoop';
|
|
70
70
|
import { isDefAndNotNull } from './utils';
|
|
71
71
|
var _a = operation.buffer.BufferParameters, CAP_ROUND = _a.CAP_ROUND, CAP_FLAT = _a.CAP_FLAT, CAP_SQUARE = _a.CAP_SQUARE;
|
|
@@ -673,14 +673,14 @@ var DPolygon = (function () {
|
|
|
673
673
|
if (type === DPolygon.WKT_POLYGON) {
|
|
674
674
|
var h = '';
|
|
675
675
|
if (this.holes && this.holes.length) {
|
|
676
|
-
h = ", "
|
|
677
|
-
.join(', ');
|
|
676
|
+
h = ", ".concat(this.holes.map(function (hole) { return hole.toString(); })
|
|
677
|
+
.join(', '));
|
|
678
678
|
}
|
|
679
|
-
return "POLYGON (("
|
|
680
|
-
.join(', ')
|
|
679
|
+
return "POLYGON ((".concat(this.deintersection.mapArray(function (r) { return "".concat(r.x, " ").concat(r.y).concat(withZ ? " ".concat(r.z) : ''); })
|
|
680
|
+
.join(', '), ")").concat(h, ")");
|
|
681
681
|
}
|
|
682
|
-
return "LINESTRING ("
|
|
683
|
-
.join(', ')
|
|
682
|
+
return "LINESTRING (".concat(this.mapArray(function (r) { return "".concat(r.x, " ").concat(r.y).concat(withZ ? " ".concat(r.z) : ''); })
|
|
683
|
+
.join(', '), ")");
|
|
684
684
|
};
|
|
685
685
|
DPolygon.prototype.filter = function (f) {
|
|
686
686
|
this.pPoints = this.pPoints.filter(f);
|
|
@@ -734,7 +734,7 @@ var DPolygon = (function () {
|
|
|
734
734
|
.reduce(function (a, h) { return a + h.getValue(); }, ''));
|
|
735
735
|
};
|
|
736
736
|
DPolygon.prototype.toString = function () {
|
|
737
|
-
return "("
|
|
737
|
+
return "(".concat(this.mapArray(function (r) { return r.toString(); }).join(', '), ")");
|
|
738
738
|
};
|
|
739
739
|
DPolygon.prototype.close = function () {
|
|
740
740
|
var p0 = this.first;
|
package/dist/esm/utils.js
CHANGED
|
@@ -41,38 +41,38 @@ var hook = function (scope) { return function () { return scope; }; };
|
|
|
41
41
|
var shouldBeInt = function (scope, funcName, argName) { return function (p) {
|
|
42
42
|
if (!p.clone().round()
|
|
43
43
|
.equal(p)) {
|
|
44
|
-
warn("\""
|
|
44
|
+
warn("\"".concat(funcName, "\" -> \"").concat(argName, "\" should be Int!"));
|
|
45
45
|
}
|
|
46
46
|
return scope;
|
|
47
47
|
}; };
|
|
48
48
|
var shouldBeUInt = function (scope, funcName, argName) { return function (p) {
|
|
49
49
|
if (!p.clone().round()
|
|
50
50
|
.equal(p) || !p.gtOrEqual(DPoint.zero())) {
|
|
51
|
-
warn("\""
|
|
51
|
+
warn("\"".concat(funcName, "\" -> \"").concat(argName, "\" should be UInt!"));
|
|
52
52
|
}
|
|
53
53
|
return scope;
|
|
54
54
|
}; };
|
|
55
55
|
var shouldBeDegree = function (scope, funcName, argName) { return function (p) {
|
|
56
56
|
if (!p.likeWorldGeodeticSystem) {
|
|
57
|
-
warn("\""
|
|
57
|
+
warn("\"".concat(funcName, "\" -> \"").concat(argName, "\" should be degree!"));
|
|
58
58
|
}
|
|
59
59
|
return scope;
|
|
60
60
|
}; };
|
|
61
61
|
var shouldBeRadians = function (scope, funcName, argName) { return function (p) {
|
|
62
62
|
if (!p.likeRadians) {
|
|
63
|
-
warn("\""
|
|
63
|
+
warn("\"".concat(funcName, "\" -> \"").concat(argName, "\" should be radians!"));
|
|
64
64
|
}
|
|
65
65
|
return scope;
|
|
66
66
|
}; };
|
|
67
67
|
var shouldExist = function (scope, funcName, argName) { return function (p) {
|
|
68
68
|
if (!isDefAndNotNull(p)) {
|
|
69
|
-
warn("\""
|
|
69
|
+
warn("\"".concat(funcName, "\" -> \"").concat(argName, "\" should exist!"));
|
|
70
70
|
}
|
|
71
71
|
return scope;
|
|
72
72
|
}; };
|
|
73
73
|
var shouldBeMeters = function (scope, funcName, argName) { return function (p) {
|
|
74
74
|
if (!p.likePseudoMercator) {
|
|
75
|
-
warn("\""
|
|
75
|
+
warn("\"".concat(funcName, "\" -> \"").concat(argName, "\" should be meters!"));
|
|
76
76
|
}
|
|
77
77
|
return scope;
|
|
78
78
|
}; };
|