ol 10.7.1-dev.1767564213089 → 10.7.1-dev.1768058236017
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/coordinate.d.ts +8 -0
- package/coordinate.d.ts.map +1 -1
- package/coordinate.js +31 -1
- package/dist/ol.d.ts +4 -0
- package/dist/ol.d.ts.map +1 -1
- package/dist/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/geom/flat/lineoffset.d.ts +45 -0
- package/geom/flat/lineoffset.d.ts.map +1 -0
- package/geom/flat/lineoffset.js +173 -0
- package/package.json +1 -1
- package/render/canvas/Builder.d.ts.map +1 -1
- package/render/canvas/Builder.js +8 -1
- package/render/canvas/Executor.d.ts.map +1 -1
- package/render/canvas/Executor.js +49 -2
- package/render/canvas/Immediate.d.ts +2 -0
- package/render/canvas/Immediate.d.ts.map +1 -1
- package/render/canvas/Immediate.js +28 -4
- package/render/canvas/LineStringBuilder.d.ts +1 -0
- package/render/canvas/LineStringBuilder.d.ts.map +1 -1
- package/render/canvas/LineStringBuilder.js +13 -5
- package/render/canvas/PolygonBuilder.d.ts +2 -0
- package/render/canvas/PolygonBuilder.d.ts.map +1 -1
- package/render/canvas/PolygonBuilder.js +72 -6
- package/render/canvas/style.d.ts.map +1 -1
- package/render/canvas/style.js +10 -0
- package/render/canvas.d.ts +20 -0
- package/render/canvas.d.ts.map +1 -1
- package/render/canvas.js +9 -0
- package/render/webgl/bufferUtil.d.ts.map +1 -1
- package/render/webgl/bufferUtil.js +1 -31
- package/style/Stroke.d.ts +25 -0
- package/style/Stroke.d.ts.map +1 -1
- package/style/Stroke.js +28 -0
- package/style/flat.d.ts +2 -2
- package/style/flat.js +1 -1
- package/util.js +1 -1
- package/worker/webgl.js +1 -1
|
@@ -31,10 +31,11 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
|
|
31
31
|
* @param {number} offset Offset.
|
|
32
32
|
* @param {Array<number>} ends Ends.
|
|
33
33
|
* @param {number} stride Stride.
|
|
34
|
+
* @param {number} [strokeOffset] Stroke Offset in pixels.
|
|
34
35
|
* @private
|
|
35
36
|
* @return {number} End.
|
|
36
37
|
*/
|
|
37
|
-
drawFlatCoordinatess_(flatCoordinates, offset, ends, stride) {
|
|
38
|
+
drawFlatCoordinatess_(flatCoordinates, offset, ends, stride, strokeOffset) {
|
|
38
39
|
const state = this.state;
|
|
39
40
|
const fill = state.fillStyle !== undefined;
|
|
40
41
|
const stroke = state.strokeStyle !== undefined;
|
|
@@ -52,13 +53,20 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
|
|
52
53
|
true,
|
|
53
54
|
!stroke,
|
|
54
55
|
);
|
|
55
|
-
|
|
56
|
+
this.instructions.push([
|
|
56
57
|
CanvasInstruction.MOVE_TO_LINE_TO,
|
|
57
58
|
myBegin,
|
|
58
59
|
myEnd,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
strokeOffset * this.pixelRatio,
|
|
61
|
+
true,
|
|
62
|
+
]);
|
|
63
|
+
this.hitDetectionInstructions.push([
|
|
64
|
+
CanvasInstruction.MOVE_TO_LINE_TO,
|
|
65
|
+
myBegin,
|
|
66
|
+
myEnd,
|
|
67
|
+
strokeOffset,
|
|
68
|
+
true,
|
|
69
|
+
]);
|
|
62
70
|
if (stroke) {
|
|
63
71
|
// Performance optimization: only call closePath() when we have a stroke.
|
|
64
72
|
// Otherwise the ring is closed already (see appendFlatLineCoordinates above).
|
|
@@ -88,9 +96,18 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
|
|
88
96
|
const state = this.state;
|
|
89
97
|
const fillStyle = state.fillStyle;
|
|
90
98
|
const strokeStyle = state.strokeStyle;
|
|
99
|
+
const strokeOffset = state.strokeOffset;
|
|
91
100
|
if (fillStyle === undefined && strokeStyle === undefined) {
|
|
92
101
|
return;
|
|
93
102
|
}
|
|
103
|
+
|
|
104
|
+
if (
|
|
105
|
+
this.handleStrokeOffset_(() =>
|
|
106
|
+
this.drawCircle(circleGeometry, feature, index),
|
|
107
|
+
)
|
|
108
|
+
) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
94
111
|
this.setFillStrokeStyles_();
|
|
95
112
|
this.beginGeometry(circleGeometry, feature, index);
|
|
96
113
|
if (state.fillStyle !== undefined) {
|
|
@@ -122,7 +139,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
|
|
122
139
|
false,
|
|
123
140
|
false,
|
|
124
141
|
);
|
|
125
|
-
const circleInstruction = [CanvasInstruction.CIRCLE, myBegin];
|
|
142
|
+
const circleInstruction = [CanvasInstruction.CIRCLE, myBegin, strokeOffset];
|
|
126
143
|
this.instructions.push(beginPathInstruction, circleInstruction);
|
|
127
144
|
this.hitDetectionInstructions.push(beginPathInstruction, circleInstruction);
|
|
128
145
|
if (state.fillStyle !== undefined) {
|
|
@@ -146,9 +163,18 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
|
|
146
163
|
const state = this.state;
|
|
147
164
|
const fillStyle = state.fillStyle;
|
|
148
165
|
const strokeStyle = state.strokeStyle;
|
|
166
|
+
const strokeOffset = state.strokeOffset;
|
|
149
167
|
if (fillStyle === undefined && strokeStyle === undefined) {
|
|
150
168
|
return;
|
|
151
169
|
}
|
|
170
|
+
if (
|
|
171
|
+
this.handleStrokeOffset_(() =>
|
|
172
|
+
this.drawPolygon(polygonGeometry, feature, index),
|
|
173
|
+
)
|
|
174
|
+
) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
152
178
|
this.setFillStrokeStyles_();
|
|
153
179
|
this.beginGeometry(polygonGeometry, feature, index);
|
|
154
180
|
if (state.fillStyle !== undefined) {
|
|
@@ -177,6 +203,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
|
|
177
203
|
0,
|
|
178
204
|
/** @type {Array<number>} */ (ends),
|
|
179
205
|
stride,
|
|
206
|
+
strokeOffset,
|
|
180
207
|
);
|
|
181
208
|
this.endGeometry(feature);
|
|
182
209
|
}
|
|
@@ -191,9 +218,17 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
|
|
191
218
|
const state = this.state;
|
|
192
219
|
const fillStyle = state.fillStyle;
|
|
193
220
|
const strokeStyle = state.strokeStyle;
|
|
221
|
+
const strokeOffset = state.strokeOffset;
|
|
194
222
|
if (fillStyle === undefined && strokeStyle === undefined) {
|
|
195
223
|
return;
|
|
196
224
|
}
|
|
225
|
+
if (
|
|
226
|
+
this.handleStrokeOffset_(() =>
|
|
227
|
+
this.drawMultiPolygon(multiPolygonGeometry, feature, index),
|
|
228
|
+
)
|
|
229
|
+
) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
197
232
|
this.setFillStrokeStyles_();
|
|
198
233
|
this.beginGeometry(multiPolygonGeometry, feature, index);
|
|
199
234
|
if (state.fillStyle !== undefined) {
|
|
@@ -224,6 +259,7 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
|
|
224
259
|
offset,
|
|
225
260
|
endss[i],
|
|
226
261
|
stride,
|
|
262
|
+
strokeOffset,
|
|
227
263
|
);
|
|
228
264
|
}
|
|
229
265
|
this.endGeometry(feature);
|
|
@@ -258,6 +294,36 @@ class CanvasPolygonBuilder extends CanvasBuilder {
|
|
|
258
294
|
this.updateFillStyle(state, this.createFill);
|
|
259
295
|
this.updateStrokeStyle(state, this.applyStroke);
|
|
260
296
|
}
|
|
297
|
+
|
|
298
|
+
handleStrokeOffset_(drawGeometryCallback) {
|
|
299
|
+
const state = this.state;
|
|
300
|
+
const fillStyle = state.fillStyle;
|
|
301
|
+
const strokeStyle = state.strokeStyle;
|
|
302
|
+
const strokeOffset = state.strokeOffset;
|
|
303
|
+
|
|
304
|
+
// In case both fill style and stroke style are defined and the stroke style has an offset,
|
|
305
|
+
// the stroke and fill should be done in separate steps, because offset stroke shape will
|
|
306
|
+
// be different from the original shape used for the fill.
|
|
307
|
+
if (
|
|
308
|
+
Math.abs(strokeOffset) > 0 &&
|
|
309
|
+
fillStyle !== undefined &&
|
|
310
|
+
strokeStyle !== undefined
|
|
311
|
+
) {
|
|
312
|
+
// First do only fill
|
|
313
|
+
state.strokeStyle = undefined;
|
|
314
|
+
state.strokeOffset = 0;
|
|
315
|
+
drawGeometryCallback();
|
|
316
|
+
// Now separately do the stroke
|
|
317
|
+
state.fillStyle = undefined;
|
|
318
|
+
state.strokeStyle = strokeStyle;
|
|
319
|
+
state.strokeOffset = strokeOffset;
|
|
320
|
+
drawGeometryCallback();
|
|
321
|
+
// Reset the state to the original
|
|
322
|
+
state.fillStyle = fillStyle;
|
|
323
|
+
return true;
|
|
324
|
+
}
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
261
327
|
}
|
|
262
328
|
|
|
263
329
|
export default CanvasPolygonBuilder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["style.js"],"names":[],"mappings":"AAiEA;;;;;;;GAOG;AACH,4CAHW,KAAK,CAAC,OAAO,qBAAqB,EAAE,IAAI,CAAC,GACxC,OAAO,sBAAsB,EAAE,aAAa,CAwBvD;AAED;;;;;;;GAOG;AACH,sDAHW,KAAK,CAAC,OAAO,qBAAqB,EAAE,SAAS,CAAC,GAC7C,OAAO,sBAAsB,EAAE,aAAa,CA0CvD;AAED;;GAEG;AAEH;;;;GAIG;AAEH;;;;GAIG;AACH,oCAJW,KAAK,CAAC,OAAO,qBAAqB,EAAE,IAAI,CAAC,WACzC,cAAc,GACb,gBAAgB,CA6D3B;AAED;;GAEG;AAEH;;;;;GAKG;AACH,sCALW,SAAS,WACT,cAAc,GACb,cAAc,CAgEzB;wBApQY,OAAO,qBAAqB,EAAE,SAAS;gCAIvC,OAAO,0BAA0B,EAAE,iBAAiB;6BAIpD,OAAO,0BAA0B,EAAE,cAAc;6BAIjD,OAAO,0BAA0B,EAAE,cAAc;gCAIjD,OAAO,mBAAmB,EAAE,iBAAiB;kCAI7C,OAAO,mBAAmB,EAAE,mBAAmB;+BA8F/C,CAAS,IAAiB,EAAjB,iBAAiB,KAAE,KAAK,CAAC,KAAK,CAAC;;;;;YAKvC,mBAAmB;;;;YACnB,KAAK,CAAC,cAAc,CAAC;;6BAsEtB,CAAS,IAAiB,EAAjB,iBAAiB,KAAE,KAAK,GAAC,IAAI;4BAyEtC,CAAS,IAAiB,EAAjB,iBAAiB,KAAE,IAAI,GAAC,IAAI;8BAyCrC,CAAS,IAAiB,EAAjB,iBAAiB,KAAE,MAAM,GAAC,IAAI;
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["style.js"],"names":[],"mappings":"AAiEA;;;;;;;GAOG;AACH,4CAHW,KAAK,CAAC,OAAO,qBAAqB,EAAE,IAAI,CAAC,GACxC,OAAO,sBAAsB,EAAE,aAAa,CAwBvD;AAED;;;;;;;GAOG;AACH,sDAHW,KAAK,CAAC,OAAO,qBAAqB,EAAE,SAAS,CAAC,GAC7C,OAAO,sBAAsB,EAAE,aAAa,CA0CvD;AAED;;GAEG;AAEH;;;;GAIG;AAEH;;;;GAIG;AACH,oCAJW,KAAK,CAAC,OAAO,qBAAqB,EAAE,IAAI,CAAC,WACzC,cAAc,GACb,gBAAgB,CA6D3B;AAED;;GAEG;AAEH;;;;;GAKG;AACH,sCALW,SAAS,WACT,cAAc,GACb,cAAc,CAgEzB;wBApQY,OAAO,qBAAqB,EAAE,SAAS;gCAIvC,OAAO,0BAA0B,EAAE,iBAAiB;6BAIpD,OAAO,0BAA0B,EAAE,cAAc;6BAIjD,OAAO,0BAA0B,EAAE,cAAc;gCAIjD,OAAO,mBAAmB,EAAE,iBAAiB;kCAI7C,OAAO,mBAAmB,EAAE,mBAAmB;+BA8F/C,CAAS,IAAiB,EAAjB,iBAAiB,KAAE,KAAK,CAAC,KAAK,CAAC;;;;;YAKvC,mBAAmB;;;;YACnB,KAAK,CAAC,cAAc,CAAC;;6BAsEtB,CAAS,IAAiB,EAAjB,iBAAiB,KAAE,KAAK,GAAC,IAAI;4BAyEtC,CAAS,IAAiB,EAAjB,iBAAiB,KAAE,IAAI,GAAC,IAAI;8BAyCrC,CAAS,IAAiB,EAAjB,iBAAiB,KAAE,MAAM,GAAC,IAAI;4BAqHvC,CAAS,IAAiB,EAAjB,iBAAiB,KAAE,IAAI;6BA0OhC,CAAS,IAAiB,EAAjB,iBAAiB,KAAE,OAAO,sBAAsB,EAAE,OAAO;kBA3pB7D,sBAAsB;iBAJvB,qBAAqB;mBAGnB,uBAAuB;iBAEzB,qBAAqB"}
|
package/render/canvas/style.js
CHANGED
|
@@ -392,6 +392,12 @@ function buildStroke(flatStyle, prefix, context) {
|
|
|
392
392
|
context,
|
|
393
393
|
);
|
|
394
394
|
|
|
395
|
+
const evaluateOffset = numberEvaluator(
|
|
396
|
+
flatStyle,
|
|
397
|
+
prefix + 'stroke-offset',
|
|
398
|
+
context,
|
|
399
|
+
);
|
|
400
|
+
|
|
395
401
|
const stroke = new Stroke();
|
|
396
402
|
return function (context) {
|
|
397
403
|
if (evaluateColor) {
|
|
@@ -438,6 +444,10 @@ function buildStroke(flatStyle, prefix, context) {
|
|
|
438
444
|
stroke.setMiterLimit(evaluateMiterLimit(context));
|
|
439
445
|
}
|
|
440
446
|
|
|
447
|
+
if (evaluateOffset) {
|
|
448
|
+
stroke.setOffset(evaluateOffset(context));
|
|
449
|
+
}
|
|
450
|
+
|
|
441
451
|
return stroke;
|
|
442
452
|
};
|
|
443
453
|
}
|
package/render/canvas.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export function drawImageOrLabel(context: CanvasRenderingContext2D | import("../
|
|
|
70
70
|
* @property {CanvasLineJoin} [currentLineJoin] Current LineJoin.
|
|
71
71
|
* @property {number} [currentLineWidth] Current LineWidth.
|
|
72
72
|
* @property {number} [currentMiterLimit] Current MiterLimit.
|
|
73
|
+
* @property {number} [currentStrokeOffset] Current StrokeOffset.
|
|
73
74
|
* @property {number} [lastStroke] Last stroke.
|
|
74
75
|
* @property {import("../colorlike.js").ColorLike} [fillStyle] FillStyle.
|
|
75
76
|
* @property {import("../colorlike.js").ColorLike} [strokeStyle] StrokeStyle.
|
|
@@ -79,6 +80,7 @@ export function drawImageOrLabel(context: CanvasRenderingContext2D | import("../
|
|
|
79
80
|
* @property {CanvasLineJoin} [lineJoin] LineJoin.
|
|
80
81
|
* @property {number} [lineWidth] LineWidth.
|
|
81
82
|
* @property {number} [miterLimit] MiterLimit.
|
|
83
|
+
* @property {number} [strokeOffset] StrokeOffset.
|
|
82
84
|
* @property {number} [fillPatternScale] Fill pattern scale.
|
|
83
85
|
*/
|
|
84
86
|
/**
|
|
@@ -89,6 +91,7 @@ export function drawImageOrLabel(context: CanvasRenderingContext2D | import("../
|
|
|
89
91
|
* @property {CanvasLineJoin} lineJoin LineJoin.
|
|
90
92
|
* @property {number} lineWidth LineWidth.
|
|
91
93
|
* @property {number} miterLimit MiterLimit.
|
|
94
|
+
* @property {number} [strokeOffset] StrokeOffset.
|
|
92
95
|
* @property {import("../colorlike.js").ColorLike} strokeStyle StrokeStyle.
|
|
93
96
|
*/
|
|
94
97
|
/**
|
|
@@ -153,6 +156,11 @@ export const defaultLineJoin: CanvasLineJoin;
|
|
|
153
156
|
* @type {number}
|
|
154
157
|
*/
|
|
155
158
|
export const defaultMiterLimit: number;
|
|
159
|
+
/**
|
|
160
|
+
* @const
|
|
161
|
+
* @type {number}
|
|
162
|
+
*/
|
|
163
|
+
export const defaultStrokeOffset: number;
|
|
156
164
|
/**
|
|
157
165
|
* @const
|
|
158
166
|
* @type {import("../colorlike.js").ColorLike}
|
|
@@ -244,6 +252,10 @@ export type FillStrokeState = {
|
|
|
244
252
|
* Current MiterLimit.
|
|
245
253
|
*/
|
|
246
254
|
currentMiterLimit?: number | undefined;
|
|
255
|
+
/**
|
|
256
|
+
* Current StrokeOffset.
|
|
257
|
+
*/
|
|
258
|
+
currentStrokeOffset?: number | undefined;
|
|
247
259
|
/**
|
|
248
260
|
* Last stroke.
|
|
249
261
|
*/
|
|
@@ -280,6 +292,10 @@ export type FillStrokeState = {
|
|
|
280
292
|
* MiterLimit.
|
|
281
293
|
*/
|
|
282
294
|
miterLimit?: number | undefined;
|
|
295
|
+
/**
|
|
296
|
+
* StrokeOffset.
|
|
297
|
+
*/
|
|
298
|
+
strokeOffset?: number | undefined;
|
|
283
299
|
/**
|
|
284
300
|
* Fill pattern scale.
|
|
285
301
|
*/
|
|
@@ -310,6 +326,10 @@ export type StrokeState = {
|
|
|
310
326
|
* MiterLimit.
|
|
311
327
|
*/
|
|
312
328
|
miterLimit: number;
|
|
329
|
+
/**
|
|
330
|
+
* StrokeOffset.
|
|
331
|
+
*/
|
|
332
|
+
strokeOffset?: number | undefined;
|
|
313
333
|
/**
|
|
314
334
|
* StrokeStyle.
|
|
315
335
|
*/
|
package/render/canvas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["canvas.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["canvas.js"],"names":[],"mappings":"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"}
|
package/render/canvas.js
CHANGED
|
@@ -33,6 +33,7 @@ import {clear} from '../obj.js';
|
|
|
33
33
|
* @property {CanvasLineJoin} [currentLineJoin] Current LineJoin.
|
|
34
34
|
* @property {number} [currentLineWidth] Current LineWidth.
|
|
35
35
|
* @property {number} [currentMiterLimit] Current MiterLimit.
|
|
36
|
+
* @property {number} [currentStrokeOffset] Current StrokeOffset.
|
|
36
37
|
* @property {number} [lastStroke] Last stroke.
|
|
37
38
|
* @property {import("../colorlike.js").ColorLike} [fillStyle] FillStyle.
|
|
38
39
|
* @property {import("../colorlike.js").ColorLike} [strokeStyle] StrokeStyle.
|
|
@@ -42,6 +43,7 @@ import {clear} from '../obj.js';
|
|
|
42
43
|
* @property {CanvasLineJoin} [lineJoin] LineJoin.
|
|
43
44
|
* @property {number} [lineWidth] LineWidth.
|
|
44
45
|
* @property {number} [miterLimit] MiterLimit.
|
|
46
|
+
* @property {number} [strokeOffset] StrokeOffset.
|
|
45
47
|
* @property {number} [fillPatternScale] Fill pattern scale.
|
|
46
48
|
*/
|
|
47
49
|
|
|
@@ -53,6 +55,7 @@ import {clear} from '../obj.js';
|
|
|
53
55
|
* @property {CanvasLineJoin} lineJoin LineJoin.
|
|
54
56
|
* @property {number} lineWidth LineWidth.
|
|
55
57
|
* @property {number} miterLimit MiterLimit.
|
|
58
|
+
* @property {number} [strokeOffset] StrokeOffset.
|
|
56
59
|
* @property {import("../colorlike.js").ColorLike} strokeStyle StrokeStyle.
|
|
57
60
|
*/
|
|
58
61
|
|
|
@@ -128,6 +131,12 @@ export const defaultLineJoin = 'round';
|
|
|
128
131
|
*/
|
|
129
132
|
export const defaultMiterLimit = 10;
|
|
130
133
|
|
|
134
|
+
/**
|
|
135
|
+
* @const
|
|
136
|
+
* @type {number}
|
|
137
|
+
*/
|
|
138
|
+
export const defaultStrokeOffset = 0;
|
|
139
|
+
|
|
131
140
|
/**
|
|
132
141
|
* @const
|
|
133
142
|
* @type {import("../colorlike.js").ColorLike}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bufferUtil.d.ts","sourceRoot":"","sources":["bufferUtil.js"],"names":[],"mappings":"AA0BA;;;;;;;;;;;GAWG;AACH,yDAVW,YAAY,gBACZ,MAAM,4BACN,YAAY,wBACZ,MAAM,oBACN,eAAe,GACd,eAAe,CAmC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wDAbW,YAAY,qBACZ,MAAM,mBACN,MAAM,sBACN,MAAM,GAAC,IAAI,qBACX,MAAM,GAAC,IAAI,2BACX,KAAK,CAAC,MAAM,CAAC,oBACb,KAAK,CAAC,MAAM,CAAC,oBACb,OAAO,oBAAoB,EAAE,SAAS,iBACtC,MAAM,0BACN,MAAM,GACL;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,
|
|
1
|
+
{"version":3,"file":"bufferUtil.d.ts","sourceRoot":"","sources":["bufferUtil.js"],"names":[],"mappings":"AA0BA;;;;;;;;;;;GAWG;AACH,yDAVW,YAAY,gBACZ,MAAM,4BACN,YAAY,wBACZ,MAAM,oBACN,eAAe,GACd,eAAe,CAmC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wDAbW,YAAY,qBACZ,MAAM,mBACN,MAAM,sBACN,MAAM,GAAC,IAAI,qBACX,MAAM,GAAC,IAAI,2BACX,KAAK,CAAC,MAAM,CAAC,oBACb,KAAK,CAAC,MAAM,CAAC,oBACb,OAAO,oBAAoB,EAAE,SAAS,iBACtC,MAAM,0BACN,MAAM,GACL;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAkG1C;AAED;;;;;;;;;GASG;AACH,6DARW,YAAY,qBACZ,MAAM,eACN,KAAK,CAAC,MAAM,CAAC,cACb,KAAK,CAAC,MAAM,CAAC,wBACb,MAAM,GACL,MAAM,CA0CjB;AAjPD,6CAA8C,KAAK,CAAC;;;;;;;;8BAQtC,MAAM;;;;gCACN,MAAM;;;;qBACN,MAAM"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @module ol/render/webgl/bufferUtil
|
|
4
4
|
*/
|
|
5
5
|
import earcut from 'earcut';
|
|
6
|
-
import {
|
|
6
|
+
import {angleBetween} from '../../coordinate.js';
|
|
7
7
|
import {apply as applyTransform} from '../../transform.js';
|
|
8
8
|
|
|
9
9
|
export const LINESTRING_ANGLE_COSINE_CUTOFF = 0.985;
|
|
@@ -129,36 +129,6 @@ export function writeLineSegmentToBuffers(
|
|
|
129
129
|
const p0world = applyTransform(toWorldTransform, [...p0]);
|
|
130
130
|
const p1world = applyTransform(toWorldTransform, [...p1]);
|
|
131
131
|
|
|
132
|
-
/**
|
|
133
|
-
* Compute the angle between p0pA and p0pB
|
|
134
|
-
* @param {import("../../coordinate.js").Coordinate} p0 Point 0
|
|
135
|
-
* @param {import("../../coordinate.js").Coordinate} pA Point A
|
|
136
|
-
* @param {import("../../coordinate.js").Coordinate} pB Point B
|
|
137
|
-
* @return {number} a value in [0, 2PI]
|
|
138
|
-
*/
|
|
139
|
-
function angleBetween(p0, pA, pB) {
|
|
140
|
-
const lenA = Math.sqrt(
|
|
141
|
-
(pA[0] - p0[0]) * (pA[0] - p0[0]) + (pA[1] - p0[1]) * (pA[1] - p0[1]),
|
|
142
|
-
);
|
|
143
|
-
const tangentA = [(pA[0] - p0[0]) / lenA, (pA[1] - p0[1]) / lenA];
|
|
144
|
-
const orthoA = [-tangentA[1], tangentA[0]];
|
|
145
|
-
const lenB = Math.sqrt(
|
|
146
|
-
(pB[0] - p0[0]) * (pB[0] - p0[0]) + (pB[1] - p0[1]) * (pB[1] - p0[1]),
|
|
147
|
-
);
|
|
148
|
-
const tangentB = [(pB[0] - p0[0]) / lenB, (pB[1] - p0[1]) / lenB];
|
|
149
|
-
|
|
150
|
-
// this angle can be clockwise or anticlockwise; hence the computation afterwards
|
|
151
|
-
let angle =
|
|
152
|
-
lenA === 0 || lenB === 0
|
|
153
|
-
? 0
|
|
154
|
-
: Math.acos(
|
|
155
|
-
clamp(tangentB[0] * tangentA[0] + tangentB[1] * tangentA[1], -1, 1),
|
|
156
|
-
);
|
|
157
|
-
angle = Math.max(angle, 0.00001); // avoid a zero angle otherwise this is detected as a line cap
|
|
158
|
-
const isClockwise = tangentB[0] * orthoA[0] + tangentB[1] * orthoA[1] > 0;
|
|
159
|
-
return !isClockwise ? Math.PI * 2 - angle : angle;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
132
|
// a negative angle indicates a line cap
|
|
163
133
|
let angle0 = -1;
|
|
164
134
|
let angle1 = -1;
|
package/style/Stroke.d.ts
CHANGED
|
@@ -26,6 +26,11 @@ export type Options = {
|
|
|
26
26
|
* Miter limit.
|
|
27
27
|
*/
|
|
28
28
|
miterLimit?: number | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Line offset in pixels along the normal. A positive value offsets the line to the right,
|
|
31
|
+
* relative to the direction of the line. Default is `null` (no offset).
|
|
32
|
+
*/
|
|
33
|
+
offset?: number | undefined;
|
|
29
34
|
/**
|
|
30
35
|
* Width.
|
|
31
36
|
*/
|
|
@@ -44,6 +49,8 @@ export type Options = {
|
|
|
44
49
|
* @property {Array<number>} [lineDash] Line dash pattern. Default is `null` (no dash).
|
|
45
50
|
* @property {number} [lineDashOffset=0] Line dash offset.
|
|
46
51
|
* @property {number} [miterLimit=10] Miter limit.
|
|
52
|
+
* @property {number} [offset] Line offset in pixels along the normal. A positive value offsets the line to the right,
|
|
53
|
+
* relative to the direction of the line. Default is `null` (no offset).
|
|
47
54
|
* @property {number} [width] Width.
|
|
48
55
|
*/
|
|
49
56
|
/**
|
|
@@ -89,6 +96,11 @@ declare class Stroke {
|
|
|
89
96
|
* @type {number|undefined}
|
|
90
97
|
*/
|
|
91
98
|
private miterLimit_;
|
|
99
|
+
/**
|
|
100
|
+
* @private
|
|
101
|
+
* @type {number|undefined}
|
|
102
|
+
*/
|
|
103
|
+
private offset_;
|
|
92
104
|
/**
|
|
93
105
|
* @private
|
|
94
106
|
* @type {number|undefined}
|
|
@@ -136,6 +148,12 @@ declare class Stroke {
|
|
|
136
148
|
* @api
|
|
137
149
|
*/
|
|
138
150
|
getMiterLimit(): number | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* Get the line offset in pixels.
|
|
153
|
+
* @return {number|undefined} Offset.
|
|
154
|
+
* @api
|
|
155
|
+
*/
|
|
156
|
+
getOffset(): number | undefined;
|
|
139
157
|
/**
|
|
140
158
|
* Get the stroke width.
|
|
141
159
|
* @return {number|undefined} Width.
|
|
@@ -184,6 +202,13 @@ declare class Stroke {
|
|
|
184
202
|
* @api
|
|
185
203
|
*/
|
|
186
204
|
setMiterLimit(miterLimit: number | undefined): void;
|
|
205
|
+
/**
|
|
206
|
+
* Set the line offset in pixels.
|
|
207
|
+
*
|
|
208
|
+
* @param {number|undefined} offset Offset.
|
|
209
|
+
* @api
|
|
210
|
+
*/
|
|
211
|
+
setOffset(offset: number | undefined): void;
|
|
187
212
|
/**
|
|
188
213
|
* Set the width.
|
|
189
214
|
*
|
package/style/Stroke.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stroke.d.ts","sourceRoot":"","sources":["Stroke.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Stroke.d.ts","sourceRoot":"","sources":["Stroke.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;;;;GAOG;AACH;IACE;;OAEG;IACH,sBAFW,OAAO,EAoDjB;IA/CC;;;OAGG;IACH,eAAgE;IAEhE;;;OAGG;IACH,iBAA+B;IAE/B;;;OAGG;IACH,kBAAyE;IAEzE;;;OAGG;IACH,wBAA6C;IAE7C;;;OAGG;IACH,kBAAiC;IAEjC;;;OAGG;IACH,oBAAqC;IAErC;;;OAGG;IACH,gBAA6B;IAE7B;;;OAGG;IACH,eAA2B;IAG7B;;;;OAIG;IACH,SAHY,MAAM,CAejB;IAED;;;;OAIG;IACH,YAHY,OAAO,aAAa,EAAE,KAAK,GAAC,OAAO,iBAAiB,EAAE,SAAS,CAK1E;IAED;;;;OAIG;IACH,cAHY,aAAa,GAAC,SAAS,CAKlC;IAED;;;;OAIG;IACH,eAHY,KAAK,CAAC,MAAM,CAAC,GAAC,IAAI,CAK7B;IAED;;;;OAIG;IACH,qBAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,eAHY,cAAc,GAAC,SAAS,CAKnC;IAED;;;;OAIG;IACH,iBAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,aAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,YAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;;OAKG;IACH,gBAHW,OAAO,aAAa,EAAE,KAAK,GAAC,OAAO,iBAAiB,EAAE,SAAS,QAKzE;IAED;;;;;OAKG;IACH,oBAHW,aAAa,GAAC,SAAS,QAKjC;IAED;;;;;OAKG;IACH,sBAHW,KAAK,CAAC,MAAM,CAAC,GAAC,IAAI,QAK5B;IAED;;;;;OAKG;IACH,kCAHW,MAAM,GAAC,SAAS,QAK1B;IAED;;;;;OAKG;IACH,sBAHW,cAAc,GAAC,SAAS,QAKlC;IAED;;;;;OAKG;IACH,0BAHW,MAAM,GAAC,SAAS,QAK1B;IAED;;;;;OAKG;IACH,kBAHW,MAAM,GAAC,SAAS,QAK1B;IAED;;;;;OAKG;IACH,gBAHW,MAAM,GAAC,SAAS,QAK1B;CACF"}
|
package/style/Stroke.js
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* @property {Array<number>} [lineDash] Line dash pattern. Default is `null` (no dash).
|
|
13
13
|
* @property {number} [lineDashOffset=0] Line dash offset.
|
|
14
14
|
* @property {number} [miterLimit=10] Miter limit.
|
|
15
|
+
* @property {number} [offset] Line offset in pixels along the normal. A positive value offsets the line to the right,
|
|
16
|
+
* relative to the direction of the line. Default is `null` (no offset).
|
|
15
17
|
* @property {number} [width] Width.
|
|
16
18
|
*/
|
|
17
19
|
|
|
@@ -66,6 +68,12 @@ class Stroke {
|
|
|
66
68
|
*/
|
|
67
69
|
this.miterLimit_ = options.miterLimit;
|
|
68
70
|
|
|
71
|
+
/**
|
|
72
|
+
* @private
|
|
73
|
+
* @type {number|undefined}
|
|
74
|
+
*/
|
|
75
|
+
this.offset_ = options.offset;
|
|
76
|
+
|
|
69
77
|
/**
|
|
70
78
|
* @private
|
|
71
79
|
* @type {number|undefined}
|
|
@@ -87,6 +95,7 @@ class Stroke {
|
|
|
87
95
|
lineDashOffset: this.getLineDashOffset(),
|
|
88
96
|
lineJoin: this.getLineJoin(),
|
|
89
97
|
miterLimit: this.getMiterLimit(),
|
|
98
|
+
offset: this.getOffset(),
|
|
90
99
|
width: this.getWidth(),
|
|
91
100
|
});
|
|
92
101
|
}
|
|
@@ -145,6 +154,15 @@ class Stroke {
|
|
|
145
154
|
return this.miterLimit_;
|
|
146
155
|
}
|
|
147
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Get the line offset in pixels.
|
|
159
|
+
* @return {number|undefined} Offset.
|
|
160
|
+
* @api
|
|
161
|
+
*/
|
|
162
|
+
getOffset() {
|
|
163
|
+
return this.offset_;
|
|
164
|
+
}
|
|
165
|
+
|
|
148
166
|
/**
|
|
149
167
|
* Get the stroke width.
|
|
150
168
|
* @return {number|undefined} Width.
|
|
@@ -214,6 +232,16 @@ class Stroke {
|
|
|
214
232
|
this.miterLimit_ = miterLimit;
|
|
215
233
|
}
|
|
216
234
|
|
|
235
|
+
/**
|
|
236
|
+
* Set the line offset in pixels.
|
|
237
|
+
*
|
|
238
|
+
* @param {number|undefined} offset Offset.
|
|
239
|
+
* @api
|
|
240
|
+
*/
|
|
241
|
+
setOffset(offset) {
|
|
242
|
+
this.offset_ = offset;
|
|
243
|
+
}
|
|
244
|
+
|
|
217
245
|
/**
|
|
218
246
|
* Set the width.
|
|
219
247
|
*
|
package/style/flat.d.ts
CHANGED
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
* @property {NumberExpression} [stroke-line-dash-offset=0] Line dash offset.
|
|
114
114
|
* @property {NumberExpression} [stroke-miter-limit=10] Miter limit.
|
|
115
115
|
* @property {NumberExpression} [stroke-offset] Stroke offset in pixel along the normal. A positive value offsets the line to the right,
|
|
116
|
-
* relative to the direction of the line.
|
|
116
|
+
* relative to the direction of the line.
|
|
117
117
|
* @property {string} [stroke-pattern-src] Stroke pattern image source URI. If `stroke-color` is defined as well,
|
|
118
118
|
* it will be used to tint this image. (WebGL only)
|
|
119
119
|
* @property {SizeExpression} [stroke-pattern-offset=[0, 0]] Offset, which, together with the size and the offset origin,
|
|
@@ -378,7 +378,7 @@ export type FlatStroke = {
|
|
|
378
378
|
"stroke-miter-limit"?: NumberExpression | undefined;
|
|
379
379
|
/**
|
|
380
380
|
* Stroke offset in pixel along the normal. A positive value offsets the line to the right,
|
|
381
|
-
* relative to the direction of the line.
|
|
381
|
+
* relative to the direction of the line.
|
|
382
382
|
*/
|
|
383
383
|
"stroke-offset"?: NumberExpression | undefined;
|
|
384
384
|
/**
|
package/style/flat.js
CHANGED
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
* @property {NumberExpression} [stroke-line-dash-offset=0] Line dash offset.
|
|
125
125
|
* @property {NumberExpression} [stroke-miter-limit=10] Miter limit.
|
|
126
126
|
* @property {NumberExpression} [stroke-offset] Stroke offset in pixel along the normal. A positive value offsets the line to the right,
|
|
127
|
-
* relative to the direction of the line.
|
|
127
|
+
* relative to the direction of the line.
|
|
128
128
|
* @property {string} [stroke-pattern-src] Stroke pattern image source URI. If `stroke-color` is defined as well,
|
|
129
129
|
* it will be used to tint this image. (WebGL only)
|
|
130
130
|
* @property {SizeExpression} [stroke-pattern-offset=[0, 0]] Offset, which, together with the size and the offset origin,
|
package/util.js
CHANGED
package/worker/webgl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
export function create() {
|
|
3
|
-
const source = "function t(t,n,x=2){const o=n&&n.length,i=o?n[0]*x:t.length;let f=e(t,0,i,x,!0);const l=[];if(!f||f.next===f.prev)return l;let c,y,h;if(o&&(f=function(t,n,r,x){const o=[];for(let r=0,i=n.length;r<i;r++){const f=e(t,n[r]*x,r<i-1?n[r+1]*x:t.length,x,!1);f===f.next&&(f.steiner=!0),o.push(a(f))}o.sort(u);for(let t=0;t<o.length;t++)r=s(o[t],r);return r}(t,n,f,x)),t.length>80*x){c=t[0],y=t[1];let e=c,n=y;for(let r=x;r<i;r+=x){const x=t[r],o=t[r+1];x<c&&(c=x),o<y&&(y=o),x>e&&(e=x),o>n&&(n=o)}h=Math.max(e-c,n-y),h=0!==h?32767/h:0}return r(f,l,x,c,y,h,0),l}function e(t,e,n,r,x){let o;if(x===function(t,e,n,r){let x=0;for(let o=e,i=n-r;o<n;o+=r)x+=(t[i]-t[o])*(t[o+1]+t[i+1]),i=o;return x}(t,e,n,r)>0)for(let x=e;x<n;x+=r)o=d(x/r|0,t[x],t[x+1],o);else for(let x=n-r;x>=e;x-=r)o=d(x/r|0,t[x],t[x+1],o);return o&&b(o,o.next)&&(w(o),o=o.next),o}function n(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!b(r,r.next)&&0!==v(r.prev,r,r.next))r=r.next;else{if(w(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function r(t,e,u,s,l,a,y){if(!t)return;!y&&a&&function(t,e,n,r){let x=t;do{0===x.z&&(x.z=c(x.x,x.y,e,n,r)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next}while(x!==t);x.prevZ.nextZ=null,x.prevZ=null,function(t){let e,n=1;do{let r,x=t;t=null;let o=null;for(e=0;x;){e++;let i=x,f=0;for(let t=0;t<n&&(f++,i=i.nextZ,i);t++);let u=n;for(;f>0||u>0&&i;)0!==f&&(0===u||!i||x.z<=i.z)?(r=x,x=x.nextZ,f--):(r=i,i=i.nextZ,u--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;x=i}o.nextZ=null,n*=2}while(e>1)}(x)}(t,s,l,a);let h=t;for(;t.prev!==t.next;){const c=t.prev,p=t.next;if(a?o(t,s,l,a):x(t))e.push(c.i,t.i,p.i),w(t),t=p.next,h=p.next;else if((t=p)===h){y?1===y?r(t=i(n(t),e),e,u,s,l,a,2):2===y&&f(t,e,u,s,l,a):r(n(t),e,u,s,l,a,1);break}}}function x(t){const e=t.prev,n=t,r=t.next;if(v(e,n,r)>=0)return!1;const x=e.x,o=n.x,i=r.x,f=e.y,u=n.y,s=r.y,l=Math.min(x,o,i),c=Math.min(f,u,s),a=Math.max(x,o,i),y=Math.max(f,u,s);let p=r.next;for(;p!==e;){if(p.x>=l&&p.x<=a&&p.y>=c&&p.y<=y&&h(x,f,o,u,i,s,p.x,p.y)&&v(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function o(t,e,n,r){const x=t.prev,o=t,i=t.next;if(v(x,o,i)>=0)return!1;const f=x.x,u=o.x,s=i.x,l=x.y,a=o.y,y=i.y,p=Math.min(f,u,s),b=Math.min(l,a,y),M=Math.max(f,u,s),m=Math.max(l,a,y),A=c(p,b,e,n,r),g=c(M,m,e,n,r);let Z=t.prevZ,d=t.nextZ;for(;Z&&Z.z>=A&&d&&d.z<=g;){if(Z.x>=p&&Z.x<=M&&Z.y>=b&&Z.y<=m&&Z!==x&&Z!==i&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;if(Z=Z.prevZ,d.x>=p&&d.x<=M&&d.y>=b&&d.y<=m&&d!==x&&d!==i&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;Z&&Z.z>=A;){if(Z.x>=p&&Z.x<=M&&Z.y>=b&&Z.y<=m&&Z!==x&&Z!==i&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;d&&d.z<=g;){if(d.x>=p&&d.x<=M&&d.y>=b&&d.y<=m&&d!==x&&d!==i&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function i(t,e){let r=t;do{const n=r.prev,x=r.next.next;!b(n,x)&&M(n,r,r.next,x)&&g(n,x)&&g(x,n)&&(e.push(n.i,r.i,x.i),w(r),w(r.next),r=t=x),r=r.next}while(r!==t);return n(r)}function f(t,e,x,o,i,f){let u=t;do{let t=u.next.next;for(;t!==u.prev;){if(u.i!==t.i&&p(u,t)){let s=Z(u,t);return u=n(u,u.next),s=n(s,s.next),r(u,e,x,o,i,f,0),void r(s,e,x,o,i,f,0)}t=t.next}u=u.next}while(u!==t)}function u(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function s(t,e){const r=function(t,e){let n=e;const r=t.x,x=t.y;let o,i=-1/0;if(b(t,n))return n;do{if(b(t,n.next))return n.next;if(x<=n.y&&x>=n.next.y&&n.next.y!==n.y){const t=n.x+(x-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>i&&(i=t,o=n.x<n.next.x?n:n.next,t===r))return o}n=n.next}while(n!==e);if(!o)return null;const f=o,u=o.x,s=o.y;let c=1/0;n=o;do{if(r>=n.x&&n.x>=u&&r!==n.x&&y(x<s?r:i,x,u,s,x<s?i:r,x,n.x,n.y)){const e=Math.abs(x-n.y)/(r-n.x);g(n,t)&&(e<c||e===c&&(n.x>o.x||n.x===o.x&&l(o,n)))&&(o=n,c=e)}n=n.next}while(n!==f);return o}(t,e);if(!r)return e;const x=Z(r,t);return n(x,x.next),n(r,r.next)}function l(t,e){return v(t.prev,t,e.prev)<0&&v(e.next,t,t.next)<0}function c(t,e,n,r,x){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*x|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*x|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function a(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function y(t,e,n,r,x,o,i,f){return(x-i)*(e-f)>=(t-i)*(o-f)&&(t-i)*(r-f)>=(n-i)*(e-f)&&(n-i)*(o-f)>=(x-i)*(r-f)}function h(t,e,n,r,x,o,i,f){return!(t===i&&e===f)&&y(t,e,n,r,x,o,i,f)}function p(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&M(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(g(t,e)&&g(e,t)&&function(t,e){let n=t,r=!1;const x=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&x<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(v(t.prev,t,e.prev)||v(t,e.prev,e))||b(t,e)&&v(t.prev,t,t.next)>0&&v(e.prev,e,e.next)>0)}function v(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function b(t,e){return t.x===e.x&&t.y===e.y}function M(t,e,n,r){const x=A(v(t,e,n)),o=A(v(t,e,r)),i=A(v(n,r,t)),f=A(v(n,r,e));return x!==o&&i!==f||(!(0!==x||!m(t,n,e))||(!(0!==o||!m(t,r,e))||(!(0!==i||!m(n,t,r))||!(0!==f||!m(n,e,r)))))}function m(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function A(t){return t>0?1:t<0?-1:0}function g(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function Z(t,e){const n=F(t.i,t.x,t.y),r=F(e.i,e.x,e.y),x=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=x,x.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function d(t,e,n,r){const x=F(t,e,n);return r?(x.next=r.next,x.prev=r,r.next.prev=x,r.next=x):(x.prev=x,x.next=x),x}function w(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function F(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function E(t,e){const n=e[0],r=e[1];return e[0]=t[0]*n+t[2]*r+t[4],e[1]=t[1]*n+t[3]*r+t[5],e}function
|
|
3
|
+
const source = "function t(t,n,x=2){const o=n&&n.length,i=o?n[0]*x:t.length;let f=e(t,0,i,x,!0);const l=[];if(!f||f.next===f.prev)return l;let c,y,h;if(o&&(f=function(t,n,r,x){const o=[];for(let r=0,i=n.length;r<i;r++){const f=e(t,n[r]*x,r<i-1?n[r+1]*x:t.length,x,!1);f===f.next&&(f.steiner=!0),o.push(a(f))}o.sort(u);for(let t=0;t<o.length;t++)r=s(o[t],r);return r}(t,n,f,x)),t.length>80*x){c=t[0],y=t[1];let e=c,n=y;for(let r=x;r<i;r+=x){const x=t[r],o=t[r+1];x<c&&(c=x),o<y&&(y=o),x>e&&(e=x),o>n&&(n=o)}h=Math.max(e-c,n-y),h=0!==h?32767/h:0}return r(f,l,x,c,y,h,0),l}function e(t,e,n,r,x){let o;if(x===function(t,e,n,r){let x=0;for(let o=e,i=n-r;o<n;o+=r)x+=(t[i]-t[o])*(t[o+1]+t[i+1]),i=o;return x}(t,e,n,r)>0)for(let x=e;x<n;x+=r)o=d(x/r|0,t[x],t[x+1],o);else for(let x=n-r;x>=e;x-=r)o=d(x/r|0,t[x],t[x+1],o);return o&&b(o,o.next)&&(w(o),o=o.next),o}function n(t,e){if(!t)return t;e||(e=t);let n,r=t;do{if(n=!1,r.steiner||!b(r,r.next)&&0!==v(r.prev,r,r.next))r=r.next;else{if(w(r),r=e=r.prev,r===r.next)break;n=!0}}while(n||r!==e);return e}function r(t,e,u,s,l,a,y){if(!t)return;!y&&a&&function(t,e,n,r){let x=t;do{0===x.z&&(x.z=c(x.x,x.y,e,n,r)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next}while(x!==t);x.prevZ.nextZ=null,x.prevZ=null,function(t){let e,n=1;do{let r,x=t;t=null;let o=null;for(e=0;x;){e++;let i=x,f=0;for(let t=0;t<n&&(f++,i=i.nextZ,i);t++);let u=n;for(;f>0||u>0&&i;)0!==f&&(0===u||!i||x.z<=i.z)?(r=x,x=x.nextZ,f--):(r=i,i=i.nextZ,u--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;x=i}o.nextZ=null,n*=2}while(e>1)}(x)}(t,s,l,a);let h=t;for(;t.prev!==t.next;){const c=t.prev,p=t.next;if(a?o(t,s,l,a):x(t))e.push(c.i,t.i,p.i),w(t),t=p.next,h=p.next;else if((t=p)===h){y?1===y?r(t=i(n(t),e),e,u,s,l,a,2):2===y&&f(t,e,u,s,l,a):r(n(t),e,u,s,l,a,1);break}}}function x(t){const e=t.prev,n=t,r=t.next;if(v(e,n,r)>=0)return!1;const x=e.x,o=n.x,i=r.x,f=e.y,u=n.y,s=r.y,l=Math.min(x,o,i),c=Math.min(f,u,s),a=Math.max(x,o,i),y=Math.max(f,u,s);let p=r.next;for(;p!==e;){if(p.x>=l&&p.x<=a&&p.y>=c&&p.y<=y&&h(x,f,o,u,i,s,p.x,p.y)&&v(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function o(t,e,n,r){const x=t.prev,o=t,i=t.next;if(v(x,o,i)>=0)return!1;const f=x.x,u=o.x,s=i.x,l=x.y,a=o.y,y=i.y,p=Math.min(f,u,s),b=Math.min(l,a,y),M=Math.max(f,u,s),m=Math.max(l,a,y),A=c(p,b,e,n,r),g=c(M,m,e,n,r);let Z=t.prevZ,d=t.nextZ;for(;Z&&Z.z>=A&&d&&d.z<=g;){if(Z.x>=p&&Z.x<=M&&Z.y>=b&&Z.y<=m&&Z!==x&&Z!==i&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;if(Z=Z.prevZ,d.x>=p&&d.x<=M&&d.y>=b&&d.y<=m&&d!==x&&d!==i&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;Z&&Z.z>=A;){if(Z.x>=p&&Z.x<=M&&Z.y>=b&&Z.y<=m&&Z!==x&&Z!==i&&h(f,l,u,a,s,y,Z.x,Z.y)&&v(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;d&&d.z<=g;){if(d.x>=p&&d.x<=M&&d.y>=b&&d.y<=m&&d!==x&&d!==i&&h(f,l,u,a,s,y,d.x,d.y)&&v(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function i(t,e){let r=t;do{const n=r.prev,x=r.next.next;!b(n,x)&&M(n,r,r.next,x)&&g(n,x)&&g(x,n)&&(e.push(n.i,r.i,x.i),w(r),w(r.next),r=t=x),r=r.next}while(r!==t);return n(r)}function f(t,e,x,o,i,f){let u=t;do{let t=u.next.next;for(;t!==u.prev;){if(u.i!==t.i&&p(u,t)){let s=Z(u,t);return u=n(u,u.next),s=n(s,s.next),r(u,e,x,o,i,f,0),void r(s,e,x,o,i,f,0)}t=t.next}u=u.next}while(u!==t)}function u(t,e){let n=t.x-e.x;if(0===n&&(n=t.y-e.y,0===n)){n=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return n}function s(t,e){const r=function(t,e){let n=e;const r=t.x,x=t.y;let o,i=-1/0;if(b(t,n))return n;do{if(b(t,n.next))return n.next;if(x<=n.y&&x>=n.next.y&&n.next.y!==n.y){const t=n.x+(x-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>i&&(i=t,o=n.x<n.next.x?n:n.next,t===r))return o}n=n.next}while(n!==e);if(!o)return null;const f=o,u=o.x,s=o.y;let c=1/0;n=o;do{if(r>=n.x&&n.x>=u&&r!==n.x&&y(x<s?r:i,x,u,s,x<s?i:r,x,n.x,n.y)){const e=Math.abs(x-n.y)/(r-n.x);g(n,t)&&(e<c||e===c&&(n.x>o.x||n.x===o.x&&l(o,n)))&&(o=n,c=e)}n=n.next}while(n!==f);return o}(t,e);if(!r)return e;const x=Z(r,t);return n(x,x.next),n(r,r.next)}function l(t,e){return v(t.prev,t,e.prev)<0&&v(e.next,t,t.next)<0}function c(t,e,n,r,x){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*x|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*x|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function a(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function y(t,e,n,r,x,o,i,f){return(x-i)*(e-f)>=(t-i)*(o-f)&&(t-i)*(r-f)>=(n-i)*(e-f)&&(n-i)*(o-f)>=(x-i)*(r-f)}function h(t,e,n,r,x,o,i,f){return!(t===i&&e===f)&&y(t,e,n,r,x,o,i,f)}function p(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&M(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(g(t,e)&&g(e,t)&&function(t,e){let n=t,r=!1;const x=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&x<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(v(t.prev,t,e.prev)||v(t,e.prev,e))||b(t,e)&&v(t.prev,t,t.next)>0&&v(e.prev,e,e.next)>0)}function v(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function b(t,e){return t.x===e.x&&t.y===e.y}function M(t,e,n,r){const x=A(v(t,e,n)),o=A(v(t,e,r)),i=A(v(n,r,t)),f=A(v(n,r,e));return x!==o&&i!==f||(!(0!==x||!m(t,n,e))||(!(0!==o||!m(t,r,e))||(!(0!==i||!m(n,t,r))||!(0!==f||!m(n,e,r)))))}function m(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function A(t){return t>0?1:t<0?-1:0}function g(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function Z(t,e){const n=F(t.i,t.x,t.y),r=F(e.i,e.x,e.y),x=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=x,x.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function d(t,e,n,r){const x=F(t,e,n);return r?(x.next=r.next,x.prev=r,r.next.prev=x,r.next=x):(x.prev=x,x.next=x),x}function w(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function F(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function E(t,e,n){const r=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),x=[(e[0]-t[0])/r,(e[1]-t[1])/r],o=[-x[1],x[0]],i=Math.sqrt((n[0]-t[0])*(n[0]-t[0])+(n[1]-t[1])*(n[1]-t[1])),f=[(n[0]-t[0])/i,(n[1]-t[1])/i];let u=0===r||0===i?0:Math.acos((s=f[0]*x[0]+f[1]*x[1],l=-1,c=1,Math.min(Math.max(s,l),c)));var s,l,c;u=Math.max(u,1e-5);return f[0]*o[0]+f[1]*o[1]>0?u:2*Math.PI-u}function I(t,e){const n=e[0],r=e[1];return e[0]=t[0]*n+t[2]*r+t[4],e[1]=t[1]*n+t[3]*r+t[5],e}function z(t,e){const n=(r=e)[0]*r[3]-r[1]*r[2];var r;!function(t,e){if(!t)throw new Error(e)}(0!==n,\"Transformation matrix cannot be inverted\");const x=e[0],o=e[1],i=e[2],f=e[3],u=e[4],s=e[5];return t[0]=f/n,t[1]=-o/n,t[2]=-i/n,t[3]=x/n,t[4]=(i*s-f*u)/n,t[5]=-(x*s-o*u)/n,t}new Array(6);const B=[],P={vertexAttributesPosition:0,instanceAttributesPosition:0,indicesPosition:0};function N(t,e,n,r,x){const o=t[e++],i=t[e++],f=B;f.length=r;for(let n=0;n<f.length;n++)f[n]=t[e+n];let u=x?x.instanceAttributesPosition:0;return n[u++]=o,n[u++]=i,f.length&&(n.set(f,u),u+=f.length),P.instanceAttributesPosition=u,P}function R(t,e,n,r,x,o,i,f,u,s){const l=[t[e],t[e+1]],c=[t[n],t[n+1]],a=t[e+2],y=t[n+2],h=I(f,[...l]),p=I(f,[...c]);let v=-1,b=-1,M=s;const m=null!==x;if(null!==r){v=E(h,p,I(f,[...[t[r],t[r+1]]])),Math.cos(v)<=.985&&(M+=Math.tan((v-Math.PI)/2))}if(m){b=E(p,h,I(f,[...[t[x],t[x+1]]])),Math.cos(b)<=.985&&(M+=Math.tan((Math.PI-b)/2))}const A=Math.pow(2,24),g=u%A,Z=Math.floor(u/A)*A;return o.push(l[0],l[1],a,c[0],c[1],y,v,b,g,Z,s),o.push(...i),{length:u+Math.sqrt((p[0]-h[0])*(p[0]-h[0])+(p[1]-h[1])*(p[1]-h[1])),angle:M}}function S(e,n,r,x,o){const i=2+o;let f=n;const u=e.slice(f,f+o);f+=o;const s=e[f++];let l=0;const c=new Array(s-1);for(let t=0;t<s;t++)l+=e[f++],t<s-1&&(c[t]=l);const a=e.slice(f,f+2*l),y=t(a,c,2);for(let t=0;t<y.length;t++)x.push(y[t]+r.length/i);for(let t=0;t<a.length;t+=2)r.push(a[t],a[t+1],...u);return f+2*l}const T=\"GENERATE_POLYGON_BUFFERS\",_=\"GENERATE_POINT_BUFFERS\",O=\"GENERATE_LINE_STRING_BUFFERS\",U=self;U.onmessage=t=>{const e=t.data;switch(e.type){case _:{const t=2,n=2,r=e.customAttributesSize,x=n+r,o=new Float32Array(e.renderInstructions),i=o.length/x*(t+r),f=Uint32Array.from([0,1,3,1,2,3]),u=Float32Array.from([-1,-1,1,-1,1,1,-1,1]),s=new Float32Array(i);let l;for(let t=0;t<o.length;t+=x)l=N(o,t,s,r,l);const c=Object.assign({indicesBuffer:f.buffer,vertexAttributesBuffer:u.buffer,instanceAttributesBuffer:s.buffer,renderInstructions:o.buffer},e);U.postMessage(c,[u.buffer,s.buffer,f.buffer,o.buffer]);break}case O:{const t=[],n=e.customAttributesSize,r=3,x=new Float32Array(e.renderInstructions);let o=0;const i=[1,0,0,1,0,0];let f,u;for(z(i,e.renderInstructionsTransform);o<x.length;){u=Array.from(x.slice(o,o+n)),o+=n,f=x[o++];const e=o,s=o+(f-1)*r,l=x[e]===x[s]&&x[e+1]===x[s+1];let c=0,a=0;for(let n=0;n<f-1;n++){let y=null;n>0?y=o+(n-1)*r:l&&(y=s-r);let h=null;n<f-2?h=o+(n+2)*r:l&&(h=e+r);const p=R(x,o+n*r,o+(n+1)*r,y,h,t,u,i,c,a);c=p.length,a=p.angle}o+=f*r}const s=Uint32Array.from([0,1,3,1,2,3]),l=Float32Array.from([-1,-1,1,-1,1,1,-1,1]),c=Float32Array.from(t),a=Object.assign({indicesBuffer:s.buffer,vertexAttributesBuffer:l.buffer,instanceAttributesBuffer:c.buffer,renderInstructions:x.buffer},e);U.postMessage(a,[l.buffer,c.buffer,s.buffer,x.buffer]);break}case T:{const t=[],n=[],r=e.customAttributesSize,x=new Float32Array(e.renderInstructions);let o=0;for(;o<x.length;)o=S(x,o,t,n,r);const i=Uint32Array.from(n),f=Float32Array.from(t),u=Float32Array.from([]),s=Object.assign({indicesBuffer:i.buffer,vertexAttributesBuffer:f.buffer,instanceAttributesBuffer:u.buffer,renderInstructions:x.buffer},e);U.postMessage(s,[f.buffer,u.buffer,i.buffer,x.buffer]);break}}};";
|
|
4
4
|
return new Worker(typeof Blob === 'undefined'
|
|
5
5
|
? 'data:application/javascript;base64,' + Buffer.from(source, 'binary').toString('base64')
|
|
6
6
|
: URL.createObjectURL(new Blob([source], {type: 'application/javascript'})));
|