dgeoutils 2.2.5 → 2.2.9
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 +0 -60
- package/dist/DLine.js +1 -67
- package/dist/DPoint.d.ts +2 -129
- package/dist/DPoint.js +4 -50
- package/dist/DPolygon.d.ts +4 -209
- package/dist/DPolygon.js +87 -249
- package/dist/DPolygonLoop.d.ts +2 -72
- package/dist/DPolygonLoop.js +35 -35
- package/dist/TraceMatrix.js +0 -1
- package/dist/utils.js +0 -3
- package/package.json +1 -1
package/dist/DPolygon.d.ts
CHANGED
|
@@ -11,53 +11,12 @@ export declare class DPolygon {
|
|
|
11
11
|
holes: DPolygon[];
|
|
12
12
|
private searchStore;
|
|
13
13
|
constructor(pPoints?: DPoint[]);
|
|
14
|
-
/**
|
|
15
|
-
* Specifies a round line buffer end cap style.
|
|
16
|
-
*/
|
|
17
14
|
static CAP_ROUND: number;
|
|
18
|
-
/**
|
|
19
|
-
* Specifies a flat line buffer end cap style.
|
|
20
|
-
*/
|
|
21
15
|
static CAP_FLAT: number;
|
|
22
|
-
/**
|
|
23
|
-
* Specifies a square line buffer end cap style.
|
|
24
|
-
*/
|
|
25
16
|
static CAP_SQUARE: number;
|
|
26
|
-
/**
|
|
27
|
-
* Transform array of triangles to Three.JS vertices
|
|
28
|
-
*
|
|
29
|
-
* ```
|
|
30
|
-
* const geometry = new THREE.BufferGeometry();
|
|
31
|
-
* // create a simple square shape. We duplicate the top left and bottom right
|
|
32
|
-
* // vertices because each vertex needs to appear once per triangle.
|
|
33
|
-
* const vertices = new Float32Array( DPolygon.arrayOfTrianglesToVertices(triangles, 10) );
|
|
34
|
-
*
|
|
35
|
-
* // itemSize = 3 because there are 3 values (components) per vertex
|
|
36
|
-
* geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
|
|
37
|
-
* const material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
|
|
38
|
-
* mesh = new THREE.Mesh( geometry, material );
|
|
39
|
-
*
|
|
40
|
-
* scene.add( mesh );
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @param triangles
|
|
44
|
-
* @param [height=0]
|
|
45
|
-
*/
|
|
46
17
|
static arrayOfTrianglesToVertices(triangles: DPolygon[], height?: number): number[];
|
|
47
|
-
/**
|
|
48
|
-
* Get size of min area rectangle.
|
|
49
|
-
* @param poly should be `minAreaRectangle`
|
|
50
|
-
*/
|
|
51
18
|
static minAreaRectangleSize(poly: DPolygon): DPoint;
|
|
52
|
-
/**
|
|
53
|
-
* Slice line string to dashes.
|
|
54
|
-
* @param poly should be `divideToPieces` at first
|
|
55
|
-
*/
|
|
56
19
|
static toDash(poly: DPolygon): DPolygon[];
|
|
57
|
-
/**
|
|
58
|
-
* Get min area rectangle direction
|
|
59
|
-
* @param poly should be `minAreaRectangle`
|
|
60
|
-
*/
|
|
61
20
|
static minAreaRectangleDirection(poly: DPolygon): number;
|
|
62
21
|
static parseFromWKT(wkt: string): DPolygon;
|
|
63
22
|
static createSquareBySize(size: DPoint): DPolygon;
|
|
@@ -68,121 +27,37 @@ export declare class DPolygon {
|
|
|
68
27
|
get minX(): number;
|
|
69
28
|
get maxY(): number;
|
|
70
29
|
get minY(): number;
|
|
71
|
-
/**
|
|
72
|
-
* Get center coordinates
|
|
73
|
-
*/
|
|
74
30
|
get center(): DPoint;
|
|
75
|
-
/**
|
|
76
|
-
* Difference between `maxY` and `minY`. Equal `ΔY` (`dY`)
|
|
77
|
-
*/
|
|
78
31
|
get h(): number;
|
|
79
|
-
/**
|
|
80
|
-
* Difference between `maxX` and `minX`. Equal `ΔX` (`dX`)
|
|
81
|
-
*/
|
|
82
32
|
get w(): number;
|
|
83
|
-
/**
|
|
84
|
-
* Difference between `maxY` and `minY`. Equal `height` (`h`)
|
|
85
|
-
*/
|
|
86
33
|
get dY(): number;
|
|
87
|
-
/**
|
|
88
|
-
* Difference between `maxX` and `minX`. Equal `width` (`w`)
|
|
89
|
-
*/
|
|
90
34
|
get dX(): number;
|
|
91
|
-
/**
|
|
92
|
-
* Get closed extend polygon
|
|
93
|
-
*/
|
|
94
35
|
get extend(): DPolygon;
|
|
95
|
-
/**
|
|
96
|
-
* Point with `width` value as `x` and `height` value as `y`
|
|
97
|
-
*/
|
|
98
36
|
get size(): DPoint;
|
|
99
|
-
/**
|
|
100
|
-
* Point with minimal `x` and `y`
|
|
101
|
-
*/
|
|
102
37
|
get leftTop(): DPoint;
|
|
103
|
-
/**
|
|
104
|
-
* Point with maximal `x` and `y`
|
|
105
|
-
*/
|
|
106
38
|
get rightBottom(): DPoint;
|
|
107
|
-
/**
|
|
108
|
-
* Next point index
|
|
109
|
-
*/
|
|
110
39
|
get length(): number;
|
|
111
|
-
/**
|
|
112
|
-
* Get length of line string.
|
|
113
|
-
*/
|
|
114
40
|
get fullLength(): number;
|
|
115
|
-
/**
|
|
116
|
-
* Get perimeter.
|
|
117
|
-
*/
|
|
118
41
|
get perimeter(): number;
|
|
119
|
-
/**
|
|
120
|
-
* Get polygon area
|
|
121
|
-
*/
|
|
122
42
|
get area(): number;
|
|
123
|
-
/**
|
|
124
|
-
* Get deintesected polygon.
|
|
125
|
-
*/
|
|
126
43
|
get deintersection(): DPolygon;
|
|
127
|
-
/**
|
|
128
|
-
* Check if polygon contain more than three points
|
|
129
|
-
*/
|
|
130
44
|
get valid(): boolean;
|
|
131
|
-
/**
|
|
132
|
-
* Get first point
|
|
133
|
-
*/
|
|
134
45
|
get first(): DPoint;
|
|
135
|
-
/**
|
|
136
|
-
* Get second point
|
|
137
|
-
*/
|
|
138
46
|
get second(): DPoint;
|
|
139
|
-
/**
|
|
140
|
-
* Get last point
|
|
141
|
-
*/
|
|
142
47
|
get last(): DPoint;
|
|
143
|
-
/**
|
|
144
|
-
* Get min area rectangle
|
|
145
|
-
*/
|
|
146
48
|
get minAreaRectangle(): DPolygon;
|
|
147
|
-
/**
|
|
148
|
-
* Get convex polygon
|
|
149
|
-
*/
|
|
150
49
|
get convex(): DPolygon;
|
|
151
|
-
/**
|
|
152
|
-
* Check polygon direction
|
|
153
|
-
*/
|
|
154
50
|
get isClockwise(): boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Get clockwise polygon
|
|
157
|
-
*/
|
|
158
51
|
get clockWise(): DPolygon;
|
|
159
|
-
/**
|
|
160
|
-
* Get polygon clone without holes
|
|
161
|
-
*/
|
|
162
52
|
get noHoles(): DPolygon;
|
|
163
|
-
/**
|
|
164
|
-
* Check polygon intersection with line
|
|
165
|
-
* @param l
|
|
166
|
-
* @param [includeOnly=false]
|
|
167
|
-
*/
|
|
168
53
|
intersection(l: DLine, includeOnly?: boolean): DPoint[];
|
|
169
|
-
/**
|
|
170
|
-
* Set polygon center
|
|
171
|
-
* @param newCenter
|
|
172
|
-
*/
|
|
173
54
|
setCenter(newCenter: DPoint): DPolygon;
|
|
174
55
|
static WKT_LINESTRING: string;
|
|
175
56
|
static WKT_POLYGON: string;
|
|
176
|
-
/**
|
|
177
|
-
* @param [type = DPolygon.WKT_POLYGON] Available values `DPolygon.WKT_POLYGON`, `DPolygon.WKT_LINESTRING`
|
|
178
|
-
*/
|
|
179
57
|
toWKT(type?: string): string;
|
|
180
|
-
/**
|
|
181
|
-
* Filter points
|
|
182
|
-
* @param f
|
|
183
|
-
*/
|
|
184
58
|
filter(f: (p: DPoint) => boolean): DPolygon;
|
|
185
|
-
map(f: (r: DPoint
|
|
59
|
+
map(f: (r: DPoint) => DPoint): DPolygon;
|
|
60
|
+
map(f: (r: DPoint, index: number) => DPoint): DPolygon;
|
|
186
61
|
at(index: number): DPoint;
|
|
187
62
|
pop(): DPoint;
|
|
188
63
|
push(...args: DPoint[]): number;
|
|
@@ -191,125 +66,45 @@ export declare class DPolygon {
|
|
|
191
66
|
reverse(): DPolygon;
|
|
192
67
|
getValue(): string;
|
|
193
68
|
toString(): string;
|
|
194
|
-
/**
|
|
195
|
-
* Add to the end of polygon point equal to first point if it not exist
|
|
196
|
-
*/
|
|
197
69
|
close(): DPolygon;
|
|
198
|
-
/**
|
|
199
|
-
* Remove from the end of polygon point equal to first point if it exist
|
|
200
|
-
*/
|
|
201
70
|
open(): DPolygon;
|
|
202
71
|
add(poly: DPolygon): DPolygon;
|
|
203
|
-
/**
|
|
204
|
-
* Check if has point in list of points
|
|
205
|
-
* @param p
|
|
206
|
-
*/
|
|
207
72
|
has(p: DPoint): boolean;
|
|
208
73
|
clone(): DPolygon;
|
|
209
|
-
/**
|
|
210
|
-
* Check is it fully equal.
|
|
211
|
-
* @param p
|
|
212
|
-
*/
|
|
213
74
|
equal(p: DPolygon | null): boolean;
|
|
214
|
-
/**
|
|
215
|
-
* Check is polygons are same. They can be with different directions and different start points.
|
|
216
|
-
* @param p
|
|
217
|
-
*/
|
|
218
75
|
same(p: DPolygon): boolean;
|
|
219
76
|
findIndex(p: DPoint): number;
|
|
220
|
-
/**
|
|
221
|
-
* Get polygon approximation by
|
|
222
|
-
* [Ramer–Douglas–Peucker algorithm](https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm)
|
|
223
|
-
* @param [e=Math.sqrt(this.perimeter)*APPROXIMATION_VALUE]
|
|
224
|
-
*/
|
|
225
77
|
approximation(e?: number): DPolygon;
|
|
226
78
|
insertAfter(index: number, ...points: DPoint[]): void;
|
|
227
79
|
removePart(index: number, count: number): DPoint[];
|
|
228
|
-
/**
|
|
229
|
-
* Check intersection with other polygon
|
|
230
|
-
* @param p
|
|
231
|
-
*/
|
|
232
80
|
hasSimpleIntersection(p: DPolygon): boolean;
|
|
233
|
-
/**
|
|
234
|
-
* Check if it possible to include point
|
|
235
|
-
* @param p
|
|
236
|
-
*/
|
|
237
81
|
simpleInclude(p: DPoint): boolean;
|
|
238
82
|
drawPolygonOnCanvas(canvas: HTMLCanvasElement | OffscreenCanvas, fillColor?: string, strokeColor?: string, shadowColor?: string, lineWidth?: number, steps?: number): void;
|
|
239
83
|
clearPolygonOnCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): void;
|
|
240
|
-
|
|
241
|
-
* Check if contain point
|
|
242
|
-
* @param p
|
|
243
|
-
* @param [isBorderInside=false]
|
|
244
|
-
* @param [move=(0,0)] Ignore this parameter
|
|
245
|
-
*/
|
|
246
|
-
contain(p: DPoint, isBorderInside?: boolean, move?: DPoint): boolean;
|
|
247
|
-
/**
|
|
248
|
-
* Check if point on border
|
|
249
|
-
* @param p
|
|
250
|
-
*/
|
|
84
|
+
contain(p: DPoint, isBorderInside?: boolean): boolean;
|
|
251
85
|
onBorder(p: DPoint): boolean;
|
|
252
|
-
/**
|
|
253
|
-
* Change start point to second point
|
|
254
|
-
*/
|
|
255
86
|
nextStart(): DPolygon;
|
|
256
|
-
/**
|
|
257
|
-
* Remove duplicates points
|
|
258
|
-
*/
|
|
259
87
|
removeDuplicates(): DPolygon;
|
|
260
|
-
/**
|
|
261
|
-
* Parse from [OpenLayers](https://openlayers.org/) coordinates
|
|
262
|
-
* @param a
|
|
263
|
-
*/
|
|
264
88
|
static parse(a: LatLng[]): DPolygon;
|
|
265
|
-
/**
|
|
266
|
-
* Parse from [GeoJSON](https://en.wikipedia.org/wiki/GeoJSON) coordinates
|
|
267
|
-
* @param a
|
|
268
|
-
*/
|
|
269
89
|
static parse(a: number[][]): DPolygon;
|
|
270
|
-
/**
|
|
271
|
-
* Parse from [OpenLayers](https://openlayers.org/) coordinates
|
|
272
|
-
* @param a
|
|
273
|
-
*/
|
|
274
90
|
static parse(a: DCoord[]): DPolygon;
|
|
275
|
-
/**
|
|
276
|
-
* Transform to array of coordinates for [OpenLayers](https://openlayers.org/) or
|
|
277
|
-
* [GeoJSON](https://en.wikipedia.org/wiki/GeoJSON)
|
|
278
|
-
*/
|
|
279
91
|
toArrayOfCoords(): DCoord[];
|
|
280
|
-
/**
|
|
281
|
-
* Divide line string to pieces by length
|
|
282
|
-
* @param piecesCount
|
|
283
|
-
*/
|
|
284
92
|
divideToPieces(piecesCount: number): DPolygon;
|
|
285
93
|
prepareToFastSearch(): void;
|
|
286
94
|
fastHas({ x, y, z }: DPoint): boolean;
|
|
287
|
-
/**
|
|
288
|
-
* Get line string as line string with growing length. For animation.
|
|
289
|
-
*/
|
|
290
95
|
get growingPiecesGenerator(): () => Generator<DPolygon, DPolygon>;
|
|
291
96
|
simpleUnion(p: DPolygon): DPolygon | null;
|
|
292
97
|
simpleIntersection(p: DPolygon): DPolygon | null | DPolygon[];
|
|
293
98
|
simpleDifference(p: DPolygon): DPolygon | null | DPolygon[];
|
|
294
99
|
smartUnion(p: DPolygon): DPolygon | null;
|
|
295
|
-
/**
|
|
296
|
-
* Divide polygon to triangles
|
|
297
|
-
*
|
|
298
|
-
* 
|
|
299
|
-
*/
|
|
300
100
|
toTriangles(): DPolygon[];
|
|
101
|
+
getTrianglesPointIndexes(): number[];
|
|
301
102
|
get closed(): boolean;
|
|
302
|
-
/**
|
|
303
|
-
* @param v
|
|
304
|
-
* @param [quadrantSegments=64]
|
|
305
|
-
* @param [type=DPolygon.CAP_ROUND] DPolygon.CAP_ROUND || DPolygon.CAP_FLAT || DPolygon.CAP_SQUARE
|
|
306
|
-
*/
|
|
307
103
|
buffer(v: number, quadrantSegments?: number, type?: number): DPolygon;
|
|
308
104
|
private simpleIncludeX;
|
|
309
105
|
private simpleIncludeY;
|
|
310
106
|
private douglasPeucker;
|
|
311
107
|
private goByPath;
|
|
312
|
-
private contain2;
|
|
313
108
|
private getJSTSGeometry;
|
|
314
109
|
private simpleLogicFunction;
|
|
315
110
|
}
|