dgeoutils 2.2.4 → 2.2.8
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 +0 -28
- package/dist/DCircle.js +0 -30
- package/dist/DLine.d.ts +5 -58
- package/dist/DLine.js +48 -128
- package/dist/DPoint.d.ts +2 -129
- package/dist/DPoint.js +4 -50
- package/dist/DPolygon.d.ts +12 -171
- package/dist/DPolygon.js +104 -178
- package/dist/DPolygonLoop.d.ts +2 -72
- package/dist/DPolygonLoop.js +35 -34
- package/dist/TraceMatrix.d.ts +1 -1
- package/dist/TraceMatrix.js +1 -2
- package/dist/utils.js +0 -3
- package/package.json +2 -2
package/dist/DPoint.d.ts
CHANGED
|
@@ -19,53 +19,17 @@ export declare class DPoint {
|
|
|
19
19
|
properties: {
|
|
20
20
|
[key: string]: any;
|
|
21
21
|
};
|
|
22
|
-
/**
|
|
23
|
-
* Create point with zero coords `(0, 0)`
|
|
24
|
-
*/
|
|
25
22
|
constructor();
|
|
26
|
-
/**
|
|
27
|
-
* Create point
|
|
28
|
-
* @param xy - `x` and `y` value
|
|
29
|
-
*/
|
|
30
23
|
constructor(xy: number);
|
|
31
|
-
/**
|
|
32
|
-
* Create point
|
|
33
|
-
* @param x - lng, meters to East, radians to East or width
|
|
34
|
-
* @param y - lat, meters to North, radians to North or height
|
|
35
|
-
*/
|
|
36
24
|
constructor(x: number, y: number);
|
|
37
|
-
/**
|
|
38
|
-
* Create point
|
|
39
|
-
* @param x - lng, meters to East, radians to East or width
|
|
40
|
-
* @param y - lat, meters to North, radians to North or height
|
|
41
|
-
* @param z - height
|
|
42
|
-
*/
|
|
43
25
|
constructor(x: number, y: number, z?: number);
|
|
44
26
|
static zero(): DPoint;
|
|
45
27
|
static parse(c: LatLng | number[] | DCoord): DPoint;
|
|
46
28
|
static parseFromWKT(wkt: string): DPoint;
|
|
47
29
|
static random(): DPoint;
|
|
48
|
-
/**
|
|
49
|
-
* @remark Point should be Lng/Lat.
|
|
50
|
-
*
|
|
51
|
-
* @remark `z` value default for `zoom` argument.
|
|
52
|
-
*
|
|
53
|
-
* @param [zoom=this.z]
|
|
54
|
-
*/
|
|
55
30
|
getTileFromCoords(zoom?: number): DPoint;
|
|
56
|
-
/**
|
|
57
|
-
* Result would be Lng/Lat.
|
|
58
|
-
*
|
|
59
|
-
* @remark `z` value default for `zoom` argument.
|
|
60
|
-
*
|
|
61
|
-
* @param [zoom=this.z]
|
|
62
|
-
*/
|
|
63
31
|
getCoordsFromTile(zoom?: number): DPoint;
|
|
64
32
|
toCoords(): DCoord;
|
|
65
|
-
/**
|
|
66
|
-
* Find line between two points.
|
|
67
|
-
* @param p
|
|
68
|
-
*/
|
|
69
33
|
findLine(p: DPoint): DLine;
|
|
70
34
|
findInnerAngle(p1: DPoint, p3: DPoint): number;
|
|
71
35
|
toString(): string;
|
|
@@ -73,51 +37,20 @@ export declare class DPoint {
|
|
|
73
37
|
height(z: number): DPoint;
|
|
74
38
|
toWKT(): string;
|
|
75
39
|
distance(p: DPoint): number;
|
|
76
|
-
/**
|
|
77
|
-
* Set `x` value
|
|
78
|
-
* @param x
|
|
79
|
-
*/
|
|
80
40
|
setX(x: number): DPoint;
|
|
81
|
-
/**
|
|
82
|
-
* Transform `x` value by function
|
|
83
|
-
* @param f
|
|
84
|
-
*/
|
|
85
41
|
setX(f: SetterFunction): DPoint;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
* @param y
|
|
89
|
-
*/
|
|
42
|
+
setZ(z: number): DPoint;
|
|
43
|
+
setZ(f: SetterFunction): DPoint;
|
|
90
44
|
setY(y: number): DPoint;
|
|
91
|
-
/**
|
|
92
|
-
* Transform `y` value by function
|
|
93
|
-
* @param f
|
|
94
|
-
*/
|
|
95
45
|
setY(f: SetterFunction): DPoint;
|
|
96
46
|
clone(): DPoint;
|
|
97
47
|
gt(p: DPoint): boolean;
|
|
98
48
|
lt(p: DPoint): boolean;
|
|
99
49
|
gtOrEqual(p: DPoint): boolean;
|
|
100
50
|
ltOrEqual(p: DPoint): boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Clockwise rotation
|
|
103
|
-
* @param a radians
|
|
104
|
-
*/
|
|
105
51
|
rotate(a: number): DPoint;
|
|
106
|
-
/**
|
|
107
|
-
* Add `v` to `x` and `y`
|
|
108
|
-
* @param v
|
|
109
|
-
*/
|
|
110
52
|
move(v: number): DPoint;
|
|
111
|
-
/**
|
|
112
|
-
* Add `p.x` to `x` field and `p.y` to `y` field.
|
|
113
|
-
* @param p
|
|
114
|
-
*/
|
|
115
53
|
move(p: DPoint): DPoint;
|
|
116
|
-
/**
|
|
117
|
-
* Add `x` to `x` field and `y` to `y` field.
|
|
118
|
-
* @param x
|
|
119
|
-
* @param y
|
|
120
|
-
*/
|
|
121
54
|
move(x: number, y: number): DPoint;
|
|
122
55
|
degreeToMeters(): DPoint;
|
|
123
56
|
metersToDegree(): DPoint;
|
|
@@ -128,70 +61,20 @@ export declare class DPoint {
|
|
|
128
61
|
round(): DPoint;
|
|
129
62
|
ceil(): DPoint;
|
|
130
63
|
floor(): DPoint;
|
|
131
|
-
/**
|
|
132
|
-
* @param [n=2]
|
|
133
|
-
*/
|
|
134
64
|
toFixed(n?: number): DPoint;
|
|
135
65
|
abs(): DPoint;
|
|
136
|
-
/**
|
|
137
|
-
* Multiply `v` to `x` and `y`
|
|
138
|
-
* @param v
|
|
139
|
-
*/
|
|
140
66
|
scale(v: number): DPoint;
|
|
141
|
-
/**
|
|
142
|
-
* Multiply `p.x` to `x` field and `p.y` to `y` field.
|
|
143
|
-
* @param p
|
|
144
|
-
*/
|
|
145
67
|
scale(p: DPoint): DPoint;
|
|
146
|
-
/**
|
|
147
|
-
* Multiply `x` to `x` field and `y` to `y` field.
|
|
148
|
-
* @param x
|
|
149
|
-
* @param y
|
|
150
|
-
*/
|
|
151
68
|
scale(x: number, y: number): DPoint;
|
|
152
|
-
/**
|
|
153
|
-
* Divide `x` and `y` to `v`
|
|
154
|
-
* @param v
|
|
155
|
-
*/
|
|
156
69
|
divide(v: number): DPoint;
|
|
157
|
-
/**
|
|
158
|
-
* Divide `x` field to `p.x` and `y` field to `p.y`.
|
|
159
|
-
* @param p
|
|
160
|
-
*/
|
|
161
70
|
divide(p: DPoint): DPoint;
|
|
162
|
-
/**
|
|
163
|
-
* Divide `x` field to `x` and `y` field to `y`.
|
|
164
|
-
* @param x
|
|
165
|
-
* @param y
|
|
166
|
-
*/
|
|
167
71
|
divide(x: number, y: number): DPoint;
|
|
168
72
|
equal(p: DPoint): boolean;
|
|
169
|
-
/**
|
|
170
|
-
* @param p
|
|
171
|
-
* @param [d=0.001]
|
|
172
|
-
*/
|
|
173
73
|
like(p: DPoint, d?: number): boolean;
|
|
174
|
-
/**
|
|
175
|
-
* Flip vertically
|
|
176
|
-
* @param size canvas size
|
|
177
|
-
*/
|
|
178
74
|
flipVertically(size: DPoint): DPoint;
|
|
179
|
-
/**
|
|
180
|
-
* Flip vertically
|
|
181
|
-
* @param height canvas height
|
|
182
|
-
*/
|
|
183
75
|
flipVertically(height: number): DPoint;
|
|
184
|
-
/**
|
|
185
|
-
* Check if point looks like radians
|
|
186
|
-
*/
|
|
187
76
|
get likeRadians(): boolean;
|
|
188
|
-
/**
|
|
189
|
-
* Check if point looks like `EPSG:4326` (degrees)
|
|
190
|
-
*/
|
|
191
77
|
get likeWorldGeodeticSystem(): boolean;
|
|
192
|
-
/**
|
|
193
|
-
* Check if point looks like `EPSG:3857` (meters)
|
|
194
|
-
*/
|
|
195
78
|
get likePseudoMercator(): boolean;
|
|
196
79
|
get w(): number;
|
|
197
80
|
set w(x: number);
|
|
@@ -211,15 +94,5 @@ export declare class DPoint {
|
|
|
211
94
|
};
|
|
212
95
|
setIfLessThan(p: DPoint): DPoint;
|
|
213
96
|
minus(): DPoint;
|
|
214
|
-
/**
|
|
215
|
-
* Find [orthodromic path](https://en.wikipedia.org/wiki/Great-circle_navigation) between to points.
|
|
216
|
-
*
|
|
217
|
-
* @remark Points should be Lng/Lat.
|
|
218
|
-
*
|
|
219
|
-
* 
|
|
220
|
-
*
|
|
221
|
-
* @param point
|
|
222
|
-
* @param [pointsCount=360]
|
|
223
|
-
*/
|
|
224
97
|
orthodromicPath(point: DPoint, pointsCount?: number): DPolygon;
|
|
225
98
|
}
|
package/dist/DPoint.js
CHANGED
|
@@ -19,12 +19,10 @@ exports.DOUBLE_PI_IN_DEGREE = 360;
|
|
|
19
19
|
exports.PI_TO_DEGREE = Math.PI / exports.PI_IN_DEGREE;
|
|
20
20
|
exports.DEGREE_TO_PI = exports.PI_IN_DEGREE / Math.PI;
|
|
21
21
|
class DPoint {
|
|
22
|
-
// eslint-disable-next-line no-empty-function,no-useless-constructor
|
|
23
22
|
constructor(x = 0, y = x, z) {
|
|
24
23
|
this.x = x;
|
|
25
24
|
this.y = y;
|
|
26
25
|
this.z = z;
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
26
|
this.properties = {};
|
|
29
27
|
}
|
|
30
28
|
static zero() {
|
|
@@ -48,13 +46,6 @@ class DPoint {
|
|
|
48
46
|
static random() {
|
|
49
47
|
return new DPoint(Math.random(), Math.random());
|
|
50
48
|
}
|
|
51
|
-
/**
|
|
52
|
-
* @remark Point should be Lng/Lat.
|
|
53
|
-
*
|
|
54
|
-
* @remark `z` value default for `zoom` argument.
|
|
55
|
-
*
|
|
56
|
-
* @param [zoom=this.z]
|
|
57
|
-
*/
|
|
58
49
|
getTileFromCoords(zoom = this.z) {
|
|
59
50
|
(0, utils_1.checkFunction)('getTileFromCoords')
|
|
60
51
|
.checkArgument('this')
|
|
@@ -63,13 +54,6 @@ class DPoint {
|
|
|
63
54
|
const y = Math.floor((1 - Math.log(Math.tan(this.y * exports.PI_TO_DEGREE) + 1 / Math.cos(this.y * exports.PI_TO_DEGREE)) / Math.PI) / 2 * (Math.pow(2, zoom)));
|
|
64
55
|
return new DPoint(x, y, zoom);
|
|
65
56
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Result would be Lng/Lat.
|
|
68
|
-
*
|
|
69
|
-
* @remark `z` value default for `zoom` argument.
|
|
70
|
-
*
|
|
71
|
-
* @param [zoom=this.z]
|
|
72
|
-
*/
|
|
73
57
|
getCoordsFromTile(zoom = this.z) {
|
|
74
58
|
(0, utils_1.checkFunction)('getCoordsFromTile')
|
|
75
59
|
.checkArgument('this')
|
|
@@ -85,10 +69,6 @@ class DPoint {
|
|
|
85
69
|
}
|
|
86
70
|
return [this.x, this.y, this.z];
|
|
87
71
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Find line between two points.
|
|
90
|
-
* @param p
|
|
91
|
-
*/
|
|
92
72
|
findLine(p) {
|
|
93
73
|
(0, utils_1.checkFunction)('findLine')
|
|
94
74
|
.checkArgument('this')
|
|
@@ -152,6 +132,10 @@ class DPoint {
|
|
|
152
132
|
this.x = typeof x === 'number' ? x : x(this);
|
|
153
133
|
return this;
|
|
154
134
|
}
|
|
135
|
+
setZ(z) {
|
|
136
|
+
this.z = typeof z === 'number' ? z : z(this);
|
|
137
|
+
return this;
|
|
138
|
+
}
|
|
155
139
|
setY(y) {
|
|
156
140
|
this.y = typeof y === 'number' ? y : y(this);
|
|
157
141
|
return this;
|
|
@@ -173,10 +157,6 @@ class DPoint {
|
|
|
173
157
|
ltOrEqual(p) {
|
|
174
158
|
return this.lt(p) || this.equal(p);
|
|
175
159
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Clockwise rotation
|
|
178
|
-
* @param a radians
|
|
179
|
-
*/
|
|
180
160
|
rotate(a) {
|
|
181
161
|
const x = this.x * Math.cos(a) - this.y * Math.sin(a);
|
|
182
162
|
const y = this.x * Math.sin(a) + this.y * Math.cos(a);
|
|
@@ -260,9 +240,6 @@ class DPoint {
|
|
|
260
240
|
this.y = Math.floor(this.y);
|
|
261
241
|
return this;
|
|
262
242
|
}
|
|
263
|
-
/**
|
|
264
|
-
* @param [n=2]
|
|
265
|
-
*/
|
|
266
243
|
toFixed(n = 2) {
|
|
267
244
|
this.x = parseFloat(this.x.toFixed(n));
|
|
268
245
|
this.y = parseFloat(this.y.toFixed(n));
|
|
@@ -306,10 +283,6 @@ class DPoint {
|
|
|
306
283
|
equal(p) {
|
|
307
284
|
return this.x === p.x && this.y === p.y && this.z === p.z;
|
|
308
285
|
}
|
|
309
|
-
/**
|
|
310
|
-
* @param p
|
|
311
|
-
* @param [d=0.001]
|
|
312
|
-
*/
|
|
313
286
|
like(p, d = 0.001) {
|
|
314
287
|
if (this.equal(p)) {
|
|
315
288
|
return true;
|
|
@@ -327,27 +300,18 @@ class DPoint {
|
|
|
327
300
|
this.y = v - this.y;
|
|
328
301
|
return this;
|
|
329
302
|
}
|
|
330
|
-
/**
|
|
331
|
-
* Check if point looks like radians
|
|
332
|
-
*/
|
|
333
303
|
get likeRadians() {
|
|
334
304
|
if (radiansPolygon.length === 0) {
|
|
335
305
|
radiansPolygon.push(new DPoint(-Math.PI, -Math.PI / 2), new DPoint(Math.PI, Math.PI / 2));
|
|
336
306
|
}
|
|
337
307
|
return radiansPolygon.simpleInclude(this);
|
|
338
308
|
}
|
|
339
|
-
/**
|
|
340
|
-
* Check if point looks like `EPSG:4326` (degrees)
|
|
341
|
-
*/
|
|
342
309
|
get likeWorldGeodeticSystem() {
|
|
343
310
|
if (worldGeodeticPolygon.length === 0) {
|
|
344
311
|
worldGeodeticPolygon.push(new DPoint(-180, -90), new DPoint(180, 90));
|
|
345
312
|
}
|
|
346
313
|
return !this.likeRadians && worldGeodeticPolygon.simpleInclude(this);
|
|
347
314
|
}
|
|
348
|
-
/**
|
|
349
|
-
* Check if point looks like `EPSG:3857` (meters)
|
|
350
|
-
*/
|
|
351
315
|
get likePseudoMercator() {
|
|
352
316
|
if (pseudoMercatorPolygon.length === 0) {
|
|
353
317
|
pseudoMercatorPolygon.push(new DPoint(-20026376.39, -20048966.10), new DPoint(20026376.39, 20048966.10));
|
|
@@ -416,16 +380,6 @@ class DPoint {
|
|
|
416
380
|
minus() {
|
|
417
381
|
return this.clone().scale(-1);
|
|
418
382
|
}
|
|
419
|
-
/**
|
|
420
|
-
* Find [orthodromic path](https://en.wikipedia.org/wiki/Great-circle_navigation) between to points.
|
|
421
|
-
*
|
|
422
|
-
* @remark Points should be Lng/Lat.
|
|
423
|
-
*
|
|
424
|
-
* 
|
|
425
|
-
*
|
|
426
|
-
* @param point
|
|
427
|
-
* @param [pointsCount=360]
|
|
428
|
-
*/
|
|
429
383
|
orthodromicPath(point, pointsCount = 360) {
|
|
430
384
|
(0, utils_1.checkFunction)('orthodromicPath')
|
|
431
385
|
.checkArgument('this')
|
package/dist/DPolygon.d.ts
CHANGED
|
@@ -11,20 +11,12 @@ export declare class DPolygon {
|
|
|
11
11
|
holes: DPolygon[];
|
|
12
12
|
private searchStore;
|
|
13
13
|
constructor(pPoints?: DPoint[]);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
static CAP_ROUND: number;
|
|
15
|
+
static CAP_FLAT: number;
|
|
16
|
+
static CAP_SQUARE: number;
|
|
17
|
+
static arrayOfTrianglesToVertices(triangles: DPolygon[], height?: number): number[];
|
|
18
18
|
static minAreaRectangleSize(poly: DPolygon): DPoint;
|
|
19
|
-
/**
|
|
20
|
-
* Slice line string to dashes.
|
|
21
|
-
* @param poly should be `divideToPieces` at first
|
|
22
|
-
*/
|
|
23
19
|
static toDash(poly: DPolygon): DPolygon[];
|
|
24
|
-
/**
|
|
25
|
-
* Get min area rectangle direction
|
|
26
|
-
* @param poly should be `minAreaRectangle`
|
|
27
|
-
*/
|
|
28
20
|
static minAreaRectangleDirection(poly: DPolygon): number;
|
|
29
21
|
static parseFromWKT(wkt: string): DPolygon;
|
|
30
22
|
static createSquareBySize(size: DPoint): DPolygon;
|
|
@@ -35,116 +27,37 @@ export declare class DPolygon {
|
|
|
35
27
|
get minX(): number;
|
|
36
28
|
get maxY(): number;
|
|
37
29
|
get minY(): number;
|
|
38
|
-
/**
|
|
39
|
-
* Get center coordinates
|
|
40
|
-
*/
|
|
41
30
|
get center(): DPoint;
|
|
42
|
-
/**
|
|
43
|
-
* Difference between `maxY` and `minY`. Equal `ΔY` (`dY`)
|
|
44
|
-
*/
|
|
45
31
|
get h(): number;
|
|
46
|
-
/**
|
|
47
|
-
* Difference between `maxX` and `minX`. Equal `ΔX` (`dX`)
|
|
48
|
-
*/
|
|
49
32
|
get w(): number;
|
|
50
|
-
/**
|
|
51
|
-
* Difference between `maxY` and `minY`. Equal `height` (`h`)
|
|
52
|
-
*/
|
|
53
33
|
get dY(): number;
|
|
54
|
-
/**
|
|
55
|
-
* Difference between `maxX` and `minX`. Equal `width` (`w`)
|
|
56
|
-
*/
|
|
57
34
|
get dX(): number;
|
|
58
|
-
/**
|
|
59
|
-
* Get closed extend polygon
|
|
60
|
-
*/
|
|
61
35
|
get extend(): DPolygon;
|
|
62
|
-
/**
|
|
63
|
-
* Point with `width` value as `x` and `height` value as `y`
|
|
64
|
-
*/
|
|
65
36
|
get size(): DPoint;
|
|
66
|
-
/**
|
|
67
|
-
* Point with minimal `x` and `y`
|
|
68
|
-
*/
|
|
69
37
|
get leftTop(): DPoint;
|
|
70
|
-
/**
|
|
71
|
-
* Point with maximal `x` and `y`
|
|
72
|
-
*/
|
|
73
38
|
get rightBottom(): DPoint;
|
|
74
|
-
/**
|
|
75
|
-
* Next point index
|
|
76
|
-
*/
|
|
77
39
|
get length(): number;
|
|
78
|
-
/**
|
|
79
|
-
* Get length of line string.
|
|
80
|
-
*/
|
|
81
40
|
get fullLength(): number;
|
|
82
|
-
/**
|
|
83
|
-
* Get perimeter.
|
|
84
|
-
*/
|
|
85
41
|
get perimeter(): number;
|
|
86
|
-
/**
|
|
87
|
-
* Get polygon area
|
|
88
|
-
*/
|
|
89
42
|
get area(): number;
|
|
90
|
-
/**
|
|
91
|
-
* Get deintesected polygon.
|
|
92
|
-
*/
|
|
93
43
|
get deintersection(): DPolygon;
|
|
94
|
-
/**
|
|
95
|
-
* Check if polygon contain more than three points
|
|
96
|
-
*/
|
|
97
44
|
get valid(): boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Get first point
|
|
100
|
-
*/
|
|
101
45
|
get first(): DPoint;
|
|
102
|
-
/**
|
|
103
|
-
* Get second point
|
|
104
|
-
*/
|
|
105
46
|
get second(): DPoint;
|
|
106
|
-
/**
|
|
107
|
-
* Get last point
|
|
108
|
-
*/
|
|
109
47
|
get last(): DPoint;
|
|
110
|
-
/**
|
|
111
|
-
* Get min area rectangle
|
|
112
|
-
*/
|
|
113
48
|
get minAreaRectangle(): DPolygon;
|
|
114
|
-
/**
|
|
115
|
-
* Get convex polygon
|
|
116
|
-
*/
|
|
117
49
|
get convex(): DPolygon;
|
|
118
|
-
/**
|
|
119
|
-
* Check polygon direction
|
|
120
|
-
*/
|
|
121
50
|
get isClockwise(): boolean;
|
|
122
|
-
/**
|
|
123
|
-
* Get clockwise polygon
|
|
124
|
-
*/
|
|
125
51
|
get clockWise(): DPolygon;
|
|
126
|
-
/**
|
|
127
|
-
* Get polygon clone without holes
|
|
128
|
-
*/
|
|
129
52
|
get noHoles(): DPolygon;
|
|
130
|
-
/**
|
|
131
|
-
* Check polygon intersection with line
|
|
132
|
-
* @param l
|
|
133
|
-
* @param [includeOnly=false]
|
|
134
|
-
*/
|
|
135
53
|
intersection(l: DLine, includeOnly?: boolean): DPoint[];
|
|
136
|
-
/**
|
|
137
|
-
* Set polygon center
|
|
138
|
-
* @param newCenter
|
|
139
|
-
*/
|
|
140
54
|
setCenter(newCenter: DPoint): DPolygon;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
* @param f
|
|
145
|
-
*/
|
|
55
|
+
static WKT_LINESTRING: string;
|
|
56
|
+
static WKT_POLYGON: string;
|
|
57
|
+
toWKT(type?: string): string;
|
|
146
58
|
filter(f: (p: DPoint) => boolean): DPolygon;
|
|
147
|
-
map(f: (r: DPoint
|
|
59
|
+
map(f: (r: DPoint) => DPoint): DPolygon;
|
|
60
|
+
map(f: (r: DPoint, index: number) => DPoint): DPolygon;
|
|
148
61
|
at(index: number): DPoint;
|
|
149
62
|
pop(): DPoint;
|
|
150
63
|
push(...args: DPoint[]): number;
|
|
@@ -153,113 +66,41 @@ export declare class DPolygon {
|
|
|
153
66
|
reverse(): DPolygon;
|
|
154
67
|
getValue(): string;
|
|
155
68
|
toString(): string;
|
|
156
|
-
/**
|
|
157
|
-
* Add to the end of polygon point equal to first point if it not exist
|
|
158
|
-
*/
|
|
159
69
|
close(): DPolygon;
|
|
160
|
-
/**
|
|
161
|
-
* Remove from the end of polygon point equal to first point if it exist
|
|
162
|
-
*/
|
|
163
70
|
open(): DPolygon;
|
|
164
71
|
add(poly: DPolygon): DPolygon;
|
|
165
|
-
/**
|
|
166
|
-
* Check if has point in list of points
|
|
167
|
-
* @param p
|
|
168
|
-
*/
|
|
169
72
|
has(p: DPoint): boolean;
|
|
170
73
|
clone(): DPolygon;
|
|
171
|
-
/**
|
|
172
|
-
* Check is it fully equal.
|
|
173
|
-
* @param p
|
|
174
|
-
*/
|
|
175
74
|
equal(p: DPolygon | null): boolean;
|
|
176
|
-
/**
|
|
177
|
-
* Check is polygons are same. They can be with different directions and different start points.
|
|
178
|
-
* @param p
|
|
179
|
-
*/
|
|
180
75
|
same(p: DPolygon): boolean;
|
|
181
76
|
findIndex(p: DPoint): number;
|
|
182
|
-
/**
|
|
183
|
-
* Get polygon approximation by
|
|
184
|
-
* [Ramer–Douglas–Peucker algorithm](https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm)
|
|
185
|
-
* @param [e=Math.sqrt(this.perimeter)*APPROXIMATION_VALUE]
|
|
186
|
-
*/
|
|
187
77
|
approximation(e?: number): DPolygon;
|
|
188
78
|
insertAfter(index: number, ...points: DPoint[]): void;
|
|
189
79
|
removePart(index: number, count: number): DPoint[];
|
|
190
|
-
/**
|
|
191
|
-
* Check intersection with other polygon
|
|
192
|
-
* @param p
|
|
193
|
-
*/
|
|
194
80
|
hasSimpleIntersection(p: DPolygon): boolean;
|
|
195
|
-
/**
|
|
196
|
-
* Check if it possible to include point
|
|
197
|
-
* @param p
|
|
198
|
-
*/
|
|
199
81
|
simpleInclude(p: DPoint): boolean;
|
|
200
82
|
drawPolygonOnCanvas(canvas: HTMLCanvasElement | OffscreenCanvas, fillColor?: string, strokeColor?: string, shadowColor?: string, lineWidth?: number, steps?: number): void;
|
|
201
83
|
clearPolygonOnCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): void;
|
|
202
|
-
/**
|
|
203
|
-
* Check if contain point
|
|
204
|
-
* @param p
|
|
205
|
-
* @param [isBorderInside=false]
|
|
206
|
-
* @param [move=(0,0)] Ignore this parameter
|
|
207
|
-
*/
|
|
208
84
|
contain(p: DPoint, isBorderInside?: boolean, move?: DPoint): boolean;
|
|
209
|
-
/**
|
|
210
|
-
* Check if point on border
|
|
211
|
-
* @param p
|
|
212
|
-
*/
|
|
213
85
|
onBorder(p: DPoint): boolean;
|
|
214
|
-
/**
|
|
215
|
-
* Change start point to second point
|
|
216
|
-
*/
|
|
217
86
|
nextStart(): DPolygon;
|
|
218
|
-
/**
|
|
219
|
-
* Remove duplicates points
|
|
220
|
-
*/
|
|
221
87
|
removeDuplicates(): DPolygon;
|
|
222
|
-
/**
|
|
223
|
-
* Parse from [OpenLayers](https://openlayers.org/) coordinates
|
|
224
|
-
* @param a
|
|
225
|
-
*/
|
|
226
88
|
static parse(a: LatLng[]): DPolygon;
|
|
227
|
-
/**
|
|
228
|
-
* Parse from [GeoJSON](https://en.wikipedia.org/wiki/GeoJSON) coordinates
|
|
229
|
-
* @param a
|
|
230
|
-
*/
|
|
231
89
|
static parse(a: number[][]): DPolygon;
|
|
232
|
-
/**
|
|
233
|
-
* Parse from [OpenLayers](https://openlayers.org/) coordinates
|
|
234
|
-
* @param a
|
|
235
|
-
*/
|
|
236
90
|
static parse(a: DCoord[]): DPolygon;
|
|
237
|
-
/**
|
|
238
|
-
* Transform to array of coordinates for [OpenLayers](https://openlayers.org/) or
|
|
239
|
-
* [GeoJSON](https://en.wikipedia.org/wiki/GeoJSON)
|
|
240
|
-
*/
|
|
241
91
|
toArrayOfCoords(): DCoord[];
|
|
242
|
-
/**
|
|
243
|
-
* Divide line string to pieces by length
|
|
244
|
-
* @param piecesCount
|
|
245
|
-
*/
|
|
246
92
|
divideToPieces(piecesCount: number): DPolygon;
|
|
247
93
|
prepareToFastSearch(): void;
|
|
248
94
|
fastHas({ x, y, z }: DPoint): boolean;
|
|
249
|
-
/**
|
|
250
|
-
* Get line string as line string with growing length. For animation.
|
|
251
|
-
*/
|
|
252
95
|
get growingPiecesGenerator(): () => Generator<DPolygon, DPolygon>;
|
|
253
96
|
simpleUnion(p: DPolygon): DPolygon | null;
|
|
254
97
|
simpleIntersection(p: DPolygon): DPolygon | null | DPolygon[];
|
|
255
98
|
simpleDifference(p: DPolygon): DPolygon | null | DPolygon[];
|
|
256
99
|
smartUnion(p: DPolygon): DPolygon | null;
|
|
257
|
-
/**
|
|
258
|
-
* Divide polygon to triangles
|
|
259
|
-
*
|
|
260
|
-
* 
|
|
261
|
-
*/
|
|
262
100
|
toTriangles(): DPolygon[];
|
|
101
|
+
getTrianglesPointIndexes(): number[];
|
|
102
|
+
get closed(): boolean;
|
|
103
|
+
buffer(v: number, quadrantSegments?: number, type?: number): DPolygon;
|
|
263
104
|
private simpleIncludeX;
|
|
264
105
|
private simpleIncludeY;
|
|
265
106
|
private douglasPeucker;
|