dgeoutils 2.2.6 → 2.2.10
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 +6 -51
- package/dist/DPolygon.d.ts +1 -211
- package/dist/DPolygon.js +24 -252
- 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,119 +27,34 @@ 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
59
|
map(f: (r: DPoint) => DPoint): DPolygon;
|
|
186
60
|
map(f: (r: DPoint, index: number) => DPoint): DPolygon;
|
|
@@ -192,129 +66,45 @@ export declare class DPolygon {
|
|
|
192
66
|
reverse(): DPolygon;
|
|
193
67
|
getValue(): string;
|
|
194
68
|
toString(): string;
|
|
195
|
-
/**
|
|
196
|
-
* Add to the end of polygon point equal to first point if it not exist
|
|
197
|
-
*/
|
|
198
69
|
close(): DPolygon;
|
|
199
|
-
/**
|
|
200
|
-
* Remove from the end of polygon point equal to first point if it exist
|
|
201
|
-
*/
|
|
202
70
|
open(): DPolygon;
|
|
203
71
|
add(poly: DPolygon): DPolygon;
|
|
204
|
-
/**
|
|
205
|
-
* Check if has point in list of points
|
|
206
|
-
* @param p
|
|
207
|
-
*/
|
|
208
72
|
has(p: DPoint): boolean;
|
|
209
73
|
clone(): DPolygon;
|
|
210
|
-
/**
|
|
211
|
-
* Check is it fully equal.
|
|
212
|
-
* @param p
|
|
213
|
-
*/
|
|
214
74
|
equal(p: DPolygon | null): boolean;
|
|
215
|
-
/**
|
|
216
|
-
* Check is polygons are same. They can be with different directions and different start points.
|
|
217
|
-
* @param p
|
|
218
|
-
*/
|
|
219
75
|
same(p: DPolygon): boolean;
|
|
220
76
|
findIndex(p: DPoint): number;
|
|
221
|
-
/**
|
|
222
|
-
* Get polygon approximation by
|
|
223
|
-
* [Ramer–Douglas–Peucker algorithm](https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm)
|
|
224
|
-
* @param [e=Math.sqrt(this.perimeter)*APPROXIMATION_VALUE]
|
|
225
|
-
*/
|
|
226
77
|
approximation(e?: number): DPolygon;
|
|
227
78
|
insertAfter(index: number, ...points: DPoint[]): void;
|
|
228
79
|
removePart(index: number, count: number): DPoint[];
|
|
229
|
-
/**
|
|
230
|
-
* Check intersection with other polygon
|
|
231
|
-
* @param p
|
|
232
|
-
*/
|
|
233
80
|
hasSimpleIntersection(p: DPolygon): boolean;
|
|
234
|
-
/**
|
|
235
|
-
* Check if it possible to include point
|
|
236
|
-
* @param p
|
|
237
|
-
*/
|
|
238
81
|
simpleInclude(p: DPoint): boolean;
|
|
239
82
|
drawPolygonOnCanvas(canvas: HTMLCanvasElement | OffscreenCanvas, fillColor?: string, strokeColor?: string, shadowColor?: string, lineWidth?: number, steps?: number): void;
|
|
240
83
|
clearPolygonOnCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): void;
|
|
241
|
-
|
|
242
|
-
* Check if contain point
|
|
243
|
-
* @param p
|
|
244
|
-
* @param [isBorderInside=false]
|
|
245
|
-
* @param [move=(0,0)] Ignore this parameter
|
|
246
|
-
*/
|
|
247
|
-
contain(p: DPoint, isBorderInside?: boolean, move?: DPoint): boolean;
|
|
248
|
-
/**
|
|
249
|
-
* Check if point on border
|
|
250
|
-
* @param p
|
|
251
|
-
*/
|
|
84
|
+
contain(p: DPoint, isBorderInside?: boolean): boolean;
|
|
252
85
|
onBorder(p: DPoint): boolean;
|
|
253
|
-
/**
|
|
254
|
-
* Change start point to second point
|
|
255
|
-
*/
|
|
256
86
|
nextStart(): DPolygon;
|
|
257
|
-
/**
|
|
258
|
-
* Remove duplicates points
|
|
259
|
-
*/
|
|
260
87
|
removeDuplicates(): DPolygon;
|
|
261
|
-
/**
|
|
262
|
-
* Parse from [OpenLayers](https://openlayers.org/) coordinates
|
|
263
|
-
* @param a
|
|
264
|
-
*/
|
|
265
88
|
static parse(a: LatLng[]): DPolygon;
|
|
266
|
-
/**
|
|
267
|
-
* Parse from [GeoJSON](https://en.wikipedia.org/wiki/GeoJSON) coordinates
|
|
268
|
-
* @param a
|
|
269
|
-
*/
|
|
270
89
|
static parse(a: number[][]): DPolygon;
|
|
271
|
-
/**
|
|
272
|
-
* Parse from [OpenLayers](https://openlayers.org/) coordinates
|
|
273
|
-
* @param a
|
|
274
|
-
*/
|
|
275
90
|
static parse(a: DCoord[]): DPolygon;
|
|
276
|
-
/**
|
|
277
|
-
* Transform to array of coordinates for [OpenLayers](https://openlayers.org/) or
|
|
278
|
-
* [GeoJSON](https://en.wikipedia.org/wiki/GeoJSON)
|
|
279
|
-
*/
|
|
280
91
|
toArrayOfCoords(): DCoord[];
|
|
281
|
-
/**
|
|
282
|
-
* Divide line string to pieces by length
|
|
283
|
-
* @param piecesCount
|
|
284
|
-
*/
|
|
285
92
|
divideToPieces(piecesCount: number): DPolygon;
|
|
286
93
|
prepareToFastSearch(): void;
|
|
287
94
|
fastHas({ x, y, z }: DPoint): boolean;
|
|
288
|
-
/**
|
|
289
|
-
* Get line string as line string with growing length. For animation.
|
|
290
|
-
*/
|
|
291
95
|
get growingPiecesGenerator(): () => Generator<DPolygon, DPolygon>;
|
|
292
96
|
simpleUnion(p: DPolygon): DPolygon | null;
|
|
293
97
|
simpleIntersection(p: DPolygon): DPolygon | null | DPolygon[];
|
|
294
98
|
simpleDifference(p: DPolygon): DPolygon | null | DPolygon[];
|
|
295
99
|
smartUnion(p: DPolygon): DPolygon | null;
|
|
296
|
-
/**
|
|
297
|
-
* Divide polygon to triangles
|
|
298
|
-
*
|
|
299
|
-
* 
|
|
300
|
-
*/
|
|
301
100
|
toTriangles(): DPolygon[];
|
|
302
|
-
/**
|
|
303
|
-
* Divide polygon to triangles and return points indexes
|
|
304
|
-
*/
|
|
305
101
|
getTrianglesPointIndexes(): number[];
|
|
306
102
|
get closed(): boolean;
|
|
307
|
-
/**
|
|
308
|
-
* @param v
|
|
309
|
-
* @param [quadrantSegments=64]
|
|
310
|
-
* @param [type=DPolygon.CAP_ROUND] DPolygon.CAP_ROUND || DPolygon.CAP_FLAT || DPolygon.CAP_SQUARE
|
|
311
|
-
*/
|
|
312
103
|
buffer(v: number, quadrantSegments?: number, type?: number): DPolygon;
|
|
313
104
|
private simpleIncludeX;
|
|
314
105
|
private simpleIncludeY;
|
|
315
106
|
private douglasPeucker;
|
|
316
107
|
private goByPath;
|
|
317
|
-
private contain2;
|
|
318
108
|
private getJSTSGeometry;
|
|
319
109
|
private simpleLogicFunction;
|
|
320
110
|
}
|