@hybridcore/ui 1.6.13 → 1.6.16
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/AccordionSummary-DUtr16g6.js +781 -0
- package/dist/Add-Bk8R160M.js +403 -0
- package/dist/Button-Cem3nbwc.js +357 -0
- package/dist/ButtonBase-DObmf4Q_.js +886 -0
- package/dist/Delete-CVJ6FeDn.js +203 -0
- package/dist/FormGroup-BRj1o7-E.js +89 -0
- package/dist/InputLabel-CjD30ZHz.js +341 -0
- package/dist/MenuItem-BKvRGLvM.js +233 -0
- package/dist/Modal-BVYydOr5.js +1156 -0
- package/dist/Paper-B1HV8GyO.js +582 -0
- package/dist/Select-Bfhvigsx.js +3914 -0
- package/dist/Source-BSZST_GH.js +4410 -0
- package/dist/SwitchBase-BEK49kdS.js +235 -0
- package/dist/Text-ChJRuaD8.js +2197 -0
- package/dist/TextField-Ca9ykixI.js +696 -0
- package/dist/TransitionGroupContext-Ja2CgIob.js +96 -0
- package/dist/Typography-D3X-Y5fh.js +178 -0
- package/dist/Vector-BmuhQO4p.js +3606 -0
- package/dist/Vector-DfTqQEln.js +1735 -0
- package/dist/WKT-2wsDT-nq.js +2310 -0
- package/dist/{_commonjsHelpers-BVfed4GL.js → _commonjsHelpers-BkfeUUK-.js} +2 -2
- package/dist/assertThisInitialized-C1dAyb4j.js +7 -0
- package/dist/assets/index.css +1 -1
- package/dist/assets/index2.css +1 -1
- package/dist/assets/index3.css +1 -0
- package/dist/assets/index4.css +1 -0
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/components/button/styled.js +1 -1
- package/dist/components/charts/_common/format.js +126 -82
- package/dist/components/charts/_common/tooltip.js +44 -35
- package/dist/components/charts/chart-wrapper/index.js +44 -43
- package/dist/components/charts/donut-chart/logic.js +53 -40
- package/dist/components/charts/drill-down-voronoi-treemap/logic.js +1 -1
- package/dist/components/charts/xy-chart/logic.js +135 -134
- package/dist/components/collapsible-card/index.js +30 -21
- package/dist/components/collapsible-card/styled.js +14 -16
- package/dist/components/color-picker/index.js +3358 -2228
- package/dist/components/color-picker/styled.js +7 -87
- package/dist/components/confirm/dialog.js +7 -89
- package/dist/components/confirm/index.js +1 -1
- package/dist/components/data-map/index.js +1 -1
- package/dist/components/data-map/logic.js +20 -20
- package/dist/components/data-security-selectors/dissemination-list/index.js +3117 -32
- package/dist/components/date-range-picker/index.js +454 -466
- package/dist/components/document-viewer/components/viewer/index.js +1 -1
- package/dist/components/duration-select/index.js +10 -10
- package/dist/components/duration-select/styled.js +1 -1
- package/dist/components/geometry-picker/coordinate/index.js +14 -14
- package/dist/components/geometry-picker/edit/index.js +1 -1
- package/dist/components/geometry-picker/geometry/index.js +1 -1
- package/dist/components/geometry-picker/kml/index.js +11 -11
- package/dist/components/geometry-picker/map/logic.js +3656 -145
- package/dist/components/geometry-picker/map/style.js +17 -18
- package/dist/components/geometry-picker/parser/coordinate-input/logic.js +1255 -43
- package/dist/components/heat-map/index.js +1 -1
- package/dist/components/heat-map/logic.js +1924 -77
- package/dist/components/instance-form/components/composite-matrix/components/json-editor/index.js +8737 -8722
- package/dist/components/instance-hierarchy-table/styled.js +16 -18
- package/dist/components/map/helpers/mapbox.js +15 -17
- package/dist/components/map/helpers/ol.js +27 -386
- package/dist/components/map/index.js +10 -11
- package/dist/components/map/logic.js +22 -22
- package/dist/components/map/styled.js +27 -31
- package/dist/components/phone-input/index.js +9 -10
- package/dist/components/property-mapping/index.js +1 -1
- package/dist/components/prr-map/index.js +1 -1
- package/dist/components/prr-map/logic.js +26 -27
- package/dist/components/raster-grid-map/index.js +1 -1
- package/dist/components/raster-grid-map/logic.js +57 -60
- package/dist/components/sortable-list/index.js +1264 -1091
- package/dist/components/template-form/components/property-list/index.js +32 -36
- package/dist/components/template-form/components/property-list/property-list-columns.js +17 -19
- package/dist/components/template-form/components/property-list/property-list-form.js +600 -137
- package/dist/components/template-form/components/recognition-property-list/index.js +36 -40
- package/dist/components/template-form/components/recognition-property-list/recognition-property-list-columns.js +9 -11
- package/dist/components/template-form/components/recognition-property-list/recognition-property-list-form.js +64 -57
- package/dist/components/tree-select/index.js +16 -16
- package/dist/createChainedFunction-C0nujS3O.js +9 -0
- package/dist/createSvgIcon-BghzB2Y9.js +93 -0
- package/dist/createSvgIcon-D7U1nd99.js +185 -0
- package/dist/debounce-46wSf_lW.js +15 -0
- package/dist/dialog-BtJhjyF5.js +664 -0
- package/dist/extends-C3382pL0.js +22 -0
- package/dist/formControlState-vgaj2ksH.js +10 -0
- package/dist/generateUtilityClasses-Cc-owZ4J.js +2971 -0
- package/dist/{index-C__OZmYy.js → index-CblbdqjE.js} +1 -1
- package/dist/index-DH6qsPBn.js +153 -0
- package/dist/index.esm-DAf19hyR.js +318 -0
- package/dist/main.d.ts +9 -1
- package/dist/math-Bvt2Ubuz.js +704 -0
- package/dist/ol-yOE-NV0X.js +7465 -0
- package/dist/ownerWindow-wg6foiOE.js +10 -0
- package/dist/setPrototypeOf-NPgp4cYc.js +8 -0
- package/dist/styled-DD4BkuVf.js +350 -0
- package/dist/useControlled-BYdyS7Pn.js +31 -0
- package/dist/useFormControl-CatNKXAi.js +10 -0
- package/dist/useId-BW-oWmul.js +19 -0
- package/dist/useSlot-u4t0X96G.js +42 -0
- package/package.json +1 -1
- package/dist/index.esm-UfGMjYOL.js +0 -197
|
@@ -0,0 +1,2197 @@
|
|
|
1
|
+
import { W as j, b as m, a as w, m as v, n as N, I as ae, u as le, E as O, o as he, g as ce, B as oe, j as ue } from "./math-Bvt2Ubuz.js";
|
|
2
|
+
function L(i, e, t, n) {
|
|
3
|
+
let s;
|
|
4
|
+
return t && t.length ? s = t.shift() : j ? s = new OffscreenCanvas(i || 300, e || 300) : s = document.createElement("canvas"), i && (s.width = i), e && (s.height = e), /** @type {CanvasRenderingContext2D} */
|
|
5
|
+
s.getContext("2d", n);
|
|
6
|
+
}
|
|
7
|
+
function Me(i) {
|
|
8
|
+
const e = i.canvas;
|
|
9
|
+
e.width = 1, e.height = 1, i.clearRect(0, 0, 1, 1);
|
|
10
|
+
}
|
|
11
|
+
function Ee(i, e) {
|
|
12
|
+
const t = e.parentNode;
|
|
13
|
+
t && t.replaceChild(i, e);
|
|
14
|
+
}
|
|
15
|
+
function Re(i) {
|
|
16
|
+
return i && i.parentNode ? i.parentNode.removeChild(i) : null;
|
|
17
|
+
}
|
|
18
|
+
function be(i) {
|
|
19
|
+
for (; i.lastChild; )
|
|
20
|
+
i.removeChild(i.lastChild);
|
|
21
|
+
}
|
|
22
|
+
function Fe(i, e) {
|
|
23
|
+
const t = i.childNodes;
|
|
24
|
+
for (let n = 0; ; ++n) {
|
|
25
|
+
const s = t[n], r = e[n];
|
|
26
|
+
if (!s && !r)
|
|
27
|
+
break;
|
|
28
|
+
if (s !== r) {
|
|
29
|
+
if (!s) {
|
|
30
|
+
i.appendChild(r);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (!r) {
|
|
34
|
+
i.removeChild(s), --n;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
i.insertBefore(r, s);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const We = "ol-hidden", Te = "ol-unselectable", Pe = "ol-control", Ve = "ol-collapsed", ge = new RegExp(
|
|
42
|
+
[
|
|
43
|
+
"^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)",
|
|
44
|
+
"(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)",
|
|
45
|
+
"(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)",
|
|
46
|
+
"(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?",
|
|
47
|
+
"(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))",
|
|
48
|
+
"(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))",
|
|
49
|
+
`?\\s*([-,\\"\\'\\sa-z]+?)\\s*$`
|
|
50
|
+
].join(""),
|
|
51
|
+
"i"
|
|
52
|
+
), J = [
|
|
53
|
+
"style",
|
|
54
|
+
"variant",
|
|
55
|
+
"weight",
|
|
56
|
+
"size",
|
|
57
|
+
"lineHeight",
|
|
58
|
+
"family"
|
|
59
|
+
], $ = function(i) {
|
|
60
|
+
const e = i.match(ge);
|
|
61
|
+
if (!e)
|
|
62
|
+
return null;
|
|
63
|
+
const t = (
|
|
64
|
+
/** @type {FontParameters} */
|
|
65
|
+
{
|
|
66
|
+
lineHeight: "normal",
|
|
67
|
+
size: "1.2em",
|
|
68
|
+
style: "normal",
|
|
69
|
+
weight: "normal",
|
|
70
|
+
variant: "normal"
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
for (let n = 0, s = J.length; n < s; ++n) {
|
|
74
|
+
const r = e[n + 1];
|
|
75
|
+
r !== void 0 && (t[J[n]] = r);
|
|
76
|
+
}
|
|
77
|
+
return t.families = t.family.split(/,\s?/), t;
|
|
78
|
+
};
|
|
79
|
+
class C {
|
|
80
|
+
/**
|
|
81
|
+
* @param {Options} [options] Options.
|
|
82
|
+
*/
|
|
83
|
+
constructor(e) {
|
|
84
|
+
e = e || {}, this.color_ = e.color !== void 0 ? e.color : null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Clones the style. The color is not cloned if it is an {@link module:ol/colorlike~ColorLike}.
|
|
88
|
+
* @return {Fill} The cloned style.
|
|
89
|
+
* @api
|
|
90
|
+
*/
|
|
91
|
+
clone() {
|
|
92
|
+
const e = this.getColor();
|
|
93
|
+
return new C({
|
|
94
|
+
color: Array.isArray(e) ? e.slice() : e || void 0
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get the fill color.
|
|
99
|
+
* @return {import("../color.js").Color|import("../colorlike.js").ColorLike|null} Color.
|
|
100
|
+
* @api
|
|
101
|
+
*/
|
|
102
|
+
getColor() {
|
|
103
|
+
return this.color_;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Set the color.
|
|
107
|
+
*
|
|
108
|
+
* @param {import("../color.js").Color|import("../colorlike.js").ColorLike|null} color Color.
|
|
109
|
+
* @api
|
|
110
|
+
*/
|
|
111
|
+
setColor(e) {
|
|
112
|
+
this.color_ = e;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const _ = {
|
|
116
|
+
IDLE: 0,
|
|
117
|
+
LOADING: 1,
|
|
118
|
+
LOADED: 2,
|
|
119
|
+
ERROR: 3,
|
|
120
|
+
EMPTY: 4
|
|
121
|
+
};
|
|
122
|
+
function He(i) {
|
|
123
|
+
return i[0] > 0 && i[1] > 0;
|
|
124
|
+
}
|
|
125
|
+
function Be(i, e, t) {
|
|
126
|
+
return t === void 0 && (t = [0, 0]), t[0] = i[0] * e + 0.5 | 0, t[1] = i[1] * e + 0.5 | 0, t;
|
|
127
|
+
}
|
|
128
|
+
function x(i, e) {
|
|
129
|
+
return Array.isArray(i) ? i : (e === void 0 ? e = [i, i] : (e[0] = i, e[1] = i), e);
|
|
130
|
+
}
|
|
131
|
+
class E {
|
|
132
|
+
/**
|
|
133
|
+
* @param {Options} options Options.
|
|
134
|
+
*/
|
|
135
|
+
constructor(e) {
|
|
136
|
+
this.opacity_ = e.opacity, this.rotateWithView_ = e.rotateWithView, this.rotation_ = e.rotation, this.scale_ = e.scale, this.scaleArray_ = x(e.scale), this.displacement_ = e.displacement, this.declutterMode_ = e.declutterMode;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Clones the style.
|
|
140
|
+
* @return {ImageStyle} The cloned style.
|
|
141
|
+
* @api
|
|
142
|
+
*/
|
|
143
|
+
clone() {
|
|
144
|
+
const e = this.getScale();
|
|
145
|
+
return new E({
|
|
146
|
+
opacity: this.getOpacity(),
|
|
147
|
+
scale: Array.isArray(e) ? e.slice() : e,
|
|
148
|
+
rotation: this.getRotation(),
|
|
149
|
+
rotateWithView: this.getRotateWithView(),
|
|
150
|
+
displacement: this.getDisplacement().slice(),
|
|
151
|
+
declutterMode: this.getDeclutterMode()
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Get the symbolizer opacity.
|
|
156
|
+
* @return {number} Opacity.
|
|
157
|
+
* @api
|
|
158
|
+
*/
|
|
159
|
+
getOpacity() {
|
|
160
|
+
return this.opacity_;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Determine whether the symbolizer rotates with the map.
|
|
164
|
+
* @return {boolean} Rotate with map.
|
|
165
|
+
* @api
|
|
166
|
+
*/
|
|
167
|
+
getRotateWithView() {
|
|
168
|
+
return this.rotateWithView_;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Get the symoblizer rotation.
|
|
172
|
+
* @return {number} Rotation.
|
|
173
|
+
* @api
|
|
174
|
+
*/
|
|
175
|
+
getRotation() {
|
|
176
|
+
return this.rotation_;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Get the symbolizer scale.
|
|
180
|
+
* @return {number|import("../size.js").Size} Scale.
|
|
181
|
+
* @api
|
|
182
|
+
*/
|
|
183
|
+
getScale() {
|
|
184
|
+
return this.scale_;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Get the symbolizer scale array.
|
|
188
|
+
* @return {import("../size.js").Size} Scale array.
|
|
189
|
+
*/
|
|
190
|
+
getScaleArray() {
|
|
191
|
+
return this.scaleArray_;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get the displacement of the shape
|
|
195
|
+
* @return {Array<number>} Shape's center displacement
|
|
196
|
+
* @api
|
|
197
|
+
*/
|
|
198
|
+
getDisplacement() {
|
|
199
|
+
return this.displacement_;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get the declutter mode of the shape
|
|
203
|
+
* @return {"declutter"|"obstacle"|"none"|undefined} Shape's declutter mode
|
|
204
|
+
* @api
|
|
205
|
+
*/
|
|
206
|
+
getDeclutterMode() {
|
|
207
|
+
return this.declutterMode_;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Get the anchor point in pixels. The anchor determines the center point for the
|
|
211
|
+
* symbolizer.
|
|
212
|
+
* @abstract
|
|
213
|
+
* @return {Array<number>} Anchor.
|
|
214
|
+
*/
|
|
215
|
+
getAnchor() {
|
|
216
|
+
return m();
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Get the image element for the symbolizer.
|
|
220
|
+
* @abstract
|
|
221
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
222
|
+
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
|
|
223
|
+
*/
|
|
224
|
+
getImage(e) {
|
|
225
|
+
return m();
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* @abstract
|
|
229
|
+
* @return {HTMLCanvasElement|HTMLVideoElement|HTMLImageElement} Image element.
|
|
230
|
+
*/
|
|
231
|
+
getHitDetectionImage() {
|
|
232
|
+
return m();
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Get the image pixel ratio.
|
|
236
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
237
|
+
* @return {number} Pixel ratio.
|
|
238
|
+
*/
|
|
239
|
+
getPixelRatio(e) {
|
|
240
|
+
return 1;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* @abstract
|
|
244
|
+
* @return {import("../ImageState.js").default} Image state.
|
|
245
|
+
*/
|
|
246
|
+
getImageState() {
|
|
247
|
+
return m();
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* @abstract
|
|
251
|
+
* @return {import("../size.js").Size} Image size.
|
|
252
|
+
*/
|
|
253
|
+
getImageSize() {
|
|
254
|
+
return m();
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Get the origin of the symbolizer.
|
|
258
|
+
* @abstract
|
|
259
|
+
* @return {Array<number>} Origin.
|
|
260
|
+
*/
|
|
261
|
+
getOrigin() {
|
|
262
|
+
return m();
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Get the size of the symbolizer (in pixels).
|
|
266
|
+
* @abstract
|
|
267
|
+
* @return {import("../size.js").Size} Size.
|
|
268
|
+
*/
|
|
269
|
+
getSize() {
|
|
270
|
+
return m();
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Set the displacement.
|
|
274
|
+
*
|
|
275
|
+
* @param {Array<number>} displacement Displacement.
|
|
276
|
+
* @api
|
|
277
|
+
*/
|
|
278
|
+
setDisplacement(e) {
|
|
279
|
+
this.displacement_ = e;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Set the opacity.
|
|
283
|
+
*
|
|
284
|
+
* @param {number} opacity Opacity.
|
|
285
|
+
* @api
|
|
286
|
+
*/
|
|
287
|
+
setOpacity(e) {
|
|
288
|
+
this.opacity_ = e;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Set whether to rotate the style with the view.
|
|
292
|
+
*
|
|
293
|
+
* @param {boolean} rotateWithView Rotate with map.
|
|
294
|
+
* @api
|
|
295
|
+
*/
|
|
296
|
+
setRotateWithView(e) {
|
|
297
|
+
this.rotateWithView_ = e;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Set the rotation.
|
|
301
|
+
*
|
|
302
|
+
* @param {number} rotation Rotation.
|
|
303
|
+
* @api
|
|
304
|
+
*/
|
|
305
|
+
setRotation(e) {
|
|
306
|
+
this.rotation_ = e;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Set the scale.
|
|
310
|
+
*
|
|
311
|
+
* @param {number|import("../size.js").Size} scale Scale.
|
|
312
|
+
* @api
|
|
313
|
+
*/
|
|
314
|
+
setScale(e) {
|
|
315
|
+
this.scale_ = e, this.scaleArray_ = x(e);
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* @abstract
|
|
319
|
+
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
|
320
|
+
*/
|
|
321
|
+
listenImageChange(e) {
|
|
322
|
+
m();
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Load not yet loaded URI.
|
|
326
|
+
* @abstract
|
|
327
|
+
*/
|
|
328
|
+
load() {
|
|
329
|
+
m();
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* @abstract
|
|
333
|
+
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
|
334
|
+
*/
|
|
335
|
+
unlistenImageChange(e) {
|
|
336
|
+
m();
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
const fe = /^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i, de = /^([a-z]*)$|^hsla?\(.*\)$/i;
|
|
340
|
+
function Q(i) {
|
|
341
|
+
return typeof i == "string" ? i : te(i);
|
|
342
|
+
}
|
|
343
|
+
function _e(i) {
|
|
344
|
+
const e = document.createElement("div");
|
|
345
|
+
if (e.style.color = i, e.style.color !== "") {
|
|
346
|
+
document.body.appendChild(e);
|
|
347
|
+
const t = getComputedStyle(e).color;
|
|
348
|
+
return document.body.removeChild(e), t;
|
|
349
|
+
}
|
|
350
|
+
return "";
|
|
351
|
+
}
|
|
352
|
+
const me = /* @__PURE__ */ function() {
|
|
353
|
+
const e = {};
|
|
354
|
+
let t = 0;
|
|
355
|
+
return (
|
|
356
|
+
/**
|
|
357
|
+
* @param {string} s String.
|
|
358
|
+
* @return {Color} Color.
|
|
359
|
+
*/
|
|
360
|
+
function(n) {
|
|
361
|
+
let s;
|
|
362
|
+
if (e.hasOwnProperty(n))
|
|
363
|
+
s = e[n];
|
|
364
|
+
else {
|
|
365
|
+
if (t >= 1024) {
|
|
366
|
+
let r = 0;
|
|
367
|
+
for (const a in e)
|
|
368
|
+
r++ & 3 || (delete e[a], --t);
|
|
369
|
+
}
|
|
370
|
+
s = ye(n), e[n] = s, ++t;
|
|
371
|
+
}
|
|
372
|
+
return s;
|
|
373
|
+
}
|
|
374
|
+
);
|
|
375
|
+
}();
|
|
376
|
+
function ee(i) {
|
|
377
|
+
return Array.isArray(i) ? i : me(i);
|
|
378
|
+
}
|
|
379
|
+
function ye(i) {
|
|
380
|
+
let e, t, n, s, r;
|
|
381
|
+
if (de.exec(i) && (i = _e(i)), fe.exec(i)) {
|
|
382
|
+
const a = i.length - 1;
|
|
383
|
+
let l;
|
|
384
|
+
a <= 4 ? l = 1 : l = 2;
|
|
385
|
+
const o = a === 4 || a === 8;
|
|
386
|
+
e = parseInt(i.substr(1 + 0 * l, l), 16), t = parseInt(i.substr(1 + 1 * l, l), 16), n = parseInt(i.substr(1 + 2 * l, l), 16), o ? s = parseInt(i.substr(1 + 3 * l, l), 16) : s = 255, l == 1 && (e = (e << 4) + e, t = (t << 4) + t, n = (n << 4) + n, o && (s = (s << 4) + s)), r = [e, t, n, s / 255];
|
|
387
|
+
} else i.startsWith("rgba(") ? (r = i.slice(5, -1).split(",").map(Number), X(r)) : i.startsWith("rgb(") ? (r = i.slice(4, -1).split(",").map(Number), r.push(1), X(r)) : w(!1, 14);
|
|
388
|
+
return r;
|
|
389
|
+
}
|
|
390
|
+
function X(i) {
|
|
391
|
+
return i[0] = v(i[0] + 0.5 | 0, 0, 255), i[1] = v(i[1] + 0.5 | 0, 0, 255), i[2] = v(i[2] + 0.5 | 0, 0, 255), i[3] = v(i[3], 0, 1), i;
|
|
392
|
+
}
|
|
393
|
+
function te(i) {
|
|
394
|
+
let e = i[0];
|
|
395
|
+
e != (e | 0) && (e = e + 0.5 | 0);
|
|
396
|
+
let t = i[1];
|
|
397
|
+
t != (t | 0) && (t = t + 0.5 | 0);
|
|
398
|
+
let n = i[2];
|
|
399
|
+
n != (n | 0) && (n = n + 0.5 | 0);
|
|
400
|
+
const s = i[3] === void 0 ? 1 : Math.round(i[3] * 100) / 100;
|
|
401
|
+
return "rgba(" + e + "," + t + "," + n + "," + s + ")";
|
|
402
|
+
}
|
|
403
|
+
class Se {
|
|
404
|
+
constructor() {
|
|
405
|
+
this.cache_ = {}, this.cacheSize_ = 0, this.maxCacheSize_ = 32;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* FIXME empty description for jsdoc
|
|
409
|
+
*/
|
|
410
|
+
clear() {
|
|
411
|
+
this.cache_ = {}, this.cacheSize_ = 0;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* @return {boolean} Can expire cache.
|
|
415
|
+
*/
|
|
416
|
+
canExpireCache() {
|
|
417
|
+
return this.cacheSize_ > this.maxCacheSize_;
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* FIXME empty description for jsdoc
|
|
421
|
+
*/
|
|
422
|
+
expire() {
|
|
423
|
+
if (this.canExpireCache()) {
|
|
424
|
+
let e = 0;
|
|
425
|
+
for (const t in this.cache_) {
|
|
426
|
+
const n = this.cache_[t];
|
|
427
|
+
!(e++ & 3) && !n.hasListener() && (delete this.cache_[t], --this.cacheSize_);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* @param {string} src Src.
|
|
433
|
+
* @param {?string} crossOrigin Cross origin.
|
|
434
|
+
* @param {import("../color.js").Color} color Color.
|
|
435
|
+
* @return {import("./IconImage.js").default} Icon image.
|
|
436
|
+
*/
|
|
437
|
+
get(e, t, n) {
|
|
438
|
+
const s = U(e, t, n);
|
|
439
|
+
return s in this.cache_ ? this.cache_[s] : null;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* @param {string} src Src.
|
|
443
|
+
* @param {?string} crossOrigin Cross origin.
|
|
444
|
+
* @param {import("../color.js").Color} color Color.
|
|
445
|
+
* @param {import("./IconImage.js").default} iconImage Icon image.
|
|
446
|
+
*/
|
|
447
|
+
set(e, t, n, s) {
|
|
448
|
+
const r = U(e, t, n);
|
|
449
|
+
this.cache_[r] = s, ++this.cacheSize_;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Set the cache size of the icon cache. Default is `32`. Change this value when
|
|
453
|
+
* your map uses more than 32 different icon images and you are not caching icon
|
|
454
|
+
* styles on the application level.
|
|
455
|
+
* @param {number} maxCacheSize Cache max size.
|
|
456
|
+
* @api
|
|
457
|
+
*/
|
|
458
|
+
setSize(e) {
|
|
459
|
+
this.maxCacheSize_ = e, this.expire();
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function U(i, e, t) {
|
|
463
|
+
const n = t ? Q(t) : "null";
|
|
464
|
+
return e + ":" + i + ":" + n;
|
|
465
|
+
}
|
|
466
|
+
const Y = new Se();
|
|
467
|
+
function Ie(i, e, t) {
|
|
468
|
+
const n = (
|
|
469
|
+
/** @type {HTMLImageElement} */
|
|
470
|
+
i
|
|
471
|
+
);
|
|
472
|
+
let s = !0, r = !1, a = !1;
|
|
473
|
+
const l = [
|
|
474
|
+
N(n, O.LOAD, function() {
|
|
475
|
+
a = !0, r || e();
|
|
476
|
+
})
|
|
477
|
+
];
|
|
478
|
+
return n.src && ae ? (r = !0, n.decode().then(function() {
|
|
479
|
+
s && e();
|
|
480
|
+
}).catch(function(o) {
|
|
481
|
+
s && (a ? e() : t());
|
|
482
|
+
})) : l.push(N(n, O.ERROR, t)), function() {
|
|
483
|
+
s = !1, l.forEach(le);
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
let z = null;
|
|
487
|
+
class De extends he {
|
|
488
|
+
/**
|
|
489
|
+
* @param {HTMLImageElement|HTMLCanvasElement} image Image.
|
|
490
|
+
* @param {string|undefined} src Src.
|
|
491
|
+
* @param {import("../size.js").Size} size Size.
|
|
492
|
+
* @param {?string} crossOrigin Cross origin.
|
|
493
|
+
* @param {import("../ImageState.js").default} imageState Image state.
|
|
494
|
+
* @param {import("../color.js").Color} color Color.
|
|
495
|
+
*/
|
|
496
|
+
constructor(e, t, n, s, r, a) {
|
|
497
|
+
super(), this.hitDetectionImage_ = null, this.image_ = e, this.crossOrigin_ = s, this.canvas_ = {}, this.color_ = a, this.unlisten_ = null, this.imageState_ = r, this.size_ = n, this.src_ = t, this.tainted_;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* @private
|
|
501
|
+
*/
|
|
502
|
+
initializeImage_() {
|
|
503
|
+
this.image_ = new Image(), this.crossOrigin_ !== null && (this.image_.crossOrigin = this.crossOrigin_);
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* @private
|
|
507
|
+
* @return {boolean} The image canvas is tainted.
|
|
508
|
+
*/
|
|
509
|
+
isTainted_() {
|
|
510
|
+
if (this.tainted_ === void 0 && this.imageState_ === _.LOADED) {
|
|
511
|
+
z || (z = L(1, 1, void 0, {
|
|
512
|
+
willReadFrequently: !0
|
|
513
|
+
})), z.drawImage(this.image_, 0, 0);
|
|
514
|
+
try {
|
|
515
|
+
z.getImageData(0, 0, 1, 1), this.tainted_ = !1;
|
|
516
|
+
} catch {
|
|
517
|
+
z = null, this.tainted_ = !0;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
return this.tainted_ === !0;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* @private
|
|
524
|
+
*/
|
|
525
|
+
dispatchChangeEvent_() {
|
|
526
|
+
this.dispatchEvent(O.CHANGE);
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* @private
|
|
530
|
+
*/
|
|
531
|
+
handleImageError_() {
|
|
532
|
+
this.imageState_ = _.ERROR, this.unlistenImage_(), this.dispatchChangeEvent_();
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* @private
|
|
536
|
+
*/
|
|
537
|
+
handleImageLoad_() {
|
|
538
|
+
this.imageState_ = _.LOADED, this.size_ ? (this.image_.width = this.size_[0], this.image_.height = this.size_[1]) : this.size_ = [this.image_.width, this.image_.height], this.unlistenImage_(), this.dispatchChangeEvent_();
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
542
|
+
* @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
|
|
543
|
+
*/
|
|
544
|
+
getImage(e) {
|
|
545
|
+
return this.image_ || this.initializeImage_(), this.replaceColor_(e), this.canvas_[e] ? this.canvas_[e] : this.image_;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
549
|
+
* @return {number} Image or Canvas element.
|
|
550
|
+
*/
|
|
551
|
+
getPixelRatio(e) {
|
|
552
|
+
return this.replaceColor_(e), this.canvas_[e] ? e : 1;
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* @return {import("../ImageState.js").default} Image state.
|
|
556
|
+
*/
|
|
557
|
+
getImageState() {
|
|
558
|
+
return this.imageState_;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* @return {HTMLImageElement|HTMLCanvasElement} Image element.
|
|
562
|
+
*/
|
|
563
|
+
getHitDetectionImage() {
|
|
564
|
+
if (this.image_ || this.initializeImage_(), !this.hitDetectionImage_)
|
|
565
|
+
if (this.isTainted_()) {
|
|
566
|
+
const e = this.size_[0], t = this.size_[1], n = L(e, t);
|
|
567
|
+
n.fillRect(0, 0, e, t), this.hitDetectionImage_ = n.canvas;
|
|
568
|
+
} else
|
|
569
|
+
this.hitDetectionImage_ = this.image_;
|
|
570
|
+
return this.hitDetectionImage_;
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Get the size of the icon (in pixels).
|
|
574
|
+
* @return {import("../size.js").Size} Image size.
|
|
575
|
+
*/
|
|
576
|
+
getSize() {
|
|
577
|
+
return this.size_;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* @return {string|undefined} Image src.
|
|
581
|
+
*/
|
|
582
|
+
getSrc() {
|
|
583
|
+
return this.src_;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Load not yet loaded URI.
|
|
587
|
+
*/
|
|
588
|
+
load() {
|
|
589
|
+
if (this.imageState_ === _.IDLE) {
|
|
590
|
+
this.image_ || this.initializeImage_(), this.imageState_ = _.LOADING;
|
|
591
|
+
try {
|
|
592
|
+
this.image_.src = this.src_;
|
|
593
|
+
} catch {
|
|
594
|
+
this.handleImageError_();
|
|
595
|
+
}
|
|
596
|
+
this.unlisten_ = Ie(
|
|
597
|
+
this.image_,
|
|
598
|
+
this.handleImageLoad_.bind(this),
|
|
599
|
+
this.handleImageError_.bind(this)
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
605
|
+
* @private
|
|
606
|
+
*/
|
|
607
|
+
replaceColor_(e) {
|
|
608
|
+
if (!this.color_ || this.canvas_[e] || this.imageState_ !== _.LOADED)
|
|
609
|
+
return;
|
|
610
|
+
const t = this.image_, n = document.createElement("canvas");
|
|
611
|
+
n.width = Math.ceil(t.width * e), n.height = Math.ceil(t.height * e);
|
|
612
|
+
const s = n.getContext("2d");
|
|
613
|
+
s.scale(e, e), s.drawImage(t, 0, 0), s.globalCompositeOperation = "multiply", s.fillStyle = Q(this.color_), s.fillRect(0, 0, n.width / e, n.height / e), s.globalCompositeOperation = "destination-in", s.drawImage(t, 0, 0), this.canvas_[e] = n;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Discards event handlers which listen for load completion or errors.
|
|
617
|
+
*
|
|
618
|
+
* @private
|
|
619
|
+
*/
|
|
620
|
+
unlistenImage_() {
|
|
621
|
+
this.unlisten_ && (this.unlisten_(), this.unlisten_ = null);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
function we(i, e, t, n, s, r) {
|
|
625
|
+
let a = Y.get(e, n, r);
|
|
626
|
+
return a || (a = new De(i, e, t, n, s, r), Y.set(e, n, r, a)), a;
|
|
627
|
+
}
|
|
628
|
+
function G(i, e, t, n) {
|
|
629
|
+
return t !== void 0 && n !== void 0 ? [t / i, n / e] : t !== void 0 ? t / i : n !== void 0 ? n / e : 1;
|
|
630
|
+
}
|
|
631
|
+
class ie extends E {
|
|
632
|
+
/**
|
|
633
|
+
* @param {Options} [options] Options.
|
|
634
|
+
*/
|
|
635
|
+
constructor(e) {
|
|
636
|
+
e = e || {};
|
|
637
|
+
const t = e.opacity !== void 0 ? e.opacity : 1, n = e.rotation !== void 0 ? e.rotation : 0, s = e.scale !== void 0 ? e.scale : 1, r = e.rotateWithView !== void 0 ? e.rotateWithView : !1;
|
|
638
|
+
super({
|
|
639
|
+
opacity: t,
|
|
640
|
+
rotation: n,
|
|
641
|
+
scale: s,
|
|
642
|
+
displacement: e.displacement !== void 0 ? e.displacement : [0, 0],
|
|
643
|
+
rotateWithView: r,
|
|
644
|
+
declutterMode: e.declutterMode
|
|
645
|
+
}), this.anchor_ = e.anchor !== void 0 ? e.anchor : [0.5, 0.5], this.normalizedAnchor_ = null, this.anchorOrigin_ = e.anchorOrigin !== void 0 ? e.anchorOrigin : "top-left", this.anchorXUnits_ = e.anchorXUnits !== void 0 ? e.anchorXUnits : "fraction", this.anchorYUnits_ = e.anchorYUnits !== void 0 ? e.anchorYUnits : "fraction", this.crossOrigin_ = e.crossOrigin !== void 0 ? e.crossOrigin : null;
|
|
646
|
+
const a = e.img !== void 0 ? e.img : null;
|
|
647
|
+
this.imgSize_ = e.imgSize;
|
|
648
|
+
let l = e.src;
|
|
649
|
+
w(!(l !== void 0 && a), 4), w(!a || a && this.imgSize_, 5), (l === void 0 || l.length === 0) && a && (l = /** @type {HTMLImageElement} */
|
|
650
|
+
a.src || ce(a)), w(l !== void 0 && l.length > 0, 6), w(
|
|
651
|
+
!((e.width !== void 0 || e.height !== void 0) && e.scale !== void 0),
|
|
652
|
+
69
|
|
653
|
+
);
|
|
654
|
+
const o = e.src !== void 0 ? _.IDLE : _.LOADED;
|
|
655
|
+
if (this.color_ = e.color !== void 0 ? ee(e.color) : null, this.iconImage_ = we(
|
|
656
|
+
a,
|
|
657
|
+
/** @type {string} */
|
|
658
|
+
l,
|
|
659
|
+
this.imgSize_ !== void 0 ? this.imgSize_ : null,
|
|
660
|
+
this.crossOrigin_,
|
|
661
|
+
o,
|
|
662
|
+
this.color_
|
|
663
|
+
), this.offset_ = e.offset !== void 0 ? e.offset : [0, 0], this.offsetOrigin_ = e.offsetOrigin !== void 0 ? e.offsetOrigin : "top-left", this.origin_ = null, this.size_ = e.size !== void 0 ? e.size : null, e.width !== void 0 || e.height !== void 0) {
|
|
664
|
+
let c, h;
|
|
665
|
+
if (e.size)
|
|
666
|
+
[c, h] = e.size;
|
|
667
|
+
else {
|
|
668
|
+
const u = this.getImage(1);
|
|
669
|
+
if (u instanceof HTMLCanvasElement || u.src && u.complete)
|
|
670
|
+
c = u.width, h = u.height;
|
|
671
|
+
else {
|
|
672
|
+
this.initialOptions_ = e;
|
|
673
|
+
const f = () => {
|
|
674
|
+
if (this.unlistenImageChange(f), !this.initialOptions_)
|
|
675
|
+
return;
|
|
676
|
+
const g = this.iconImage_.getSize();
|
|
677
|
+
this.setScale(
|
|
678
|
+
G(
|
|
679
|
+
g[0],
|
|
680
|
+
g[1],
|
|
681
|
+
e.width,
|
|
682
|
+
e.height
|
|
683
|
+
)
|
|
684
|
+
);
|
|
685
|
+
};
|
|
686
|
+
this.listenImageChange(f);
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
c !== void 0 && this.setScale(
|
|
691
|
+
G(c, h, e.width, e.height)
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Clones the style. The underlying Image/HTMLCanvasElement is not cloned.
|
|
697
|
+
* @return {Icon} The cloned style.
|
|
698
|
+
* @api
|
|
699
|
+
*/
|
|
700
|
+
clone() {
|
|
701
|
+
let e, t, n;
|
|
702
|
+
return this.initialOptions_ ? (t = this.initialOptions_.width, n = this.initialOptions_.height) : (e = this.getScale(), e = Array.isArray(e) ? e.slice() : e), new ie({
|
|
703
|
+
anchor: this.anchor_.slice(),
|
|
704
|
+
anchorOrigin: this.anchorOrigin_,
|
|
705
|
+
anchorXUnits: this.anchorXUnits_,
|
|
706
|
+
anchorYUnits: this.anchorYUnits_,
|
|
707
|
+
color: this.color_ && this.color_.slice ? this.color_.slice() : this.color_ || void 0,
|
|
708
|
+
crossOrigin: this.crossOrigin_,
|
|
709
|
+
imgSize: this.imgSize_,
|
|
710
|
+
offset: this.offset_.slice(),
|
|
711
|
+
offsetOrigin: this.offsetOrigin_,
|
|
712
|
+
opacity: this.getOpacity(),
|
|
713
|
+
rotateWithView: this.getRotateWithView(),
|
|
714
|
+
rotation: this.getRotation(),
|
|
715
|
+
scale: e,
|
|
716
|
+
width: t,
|
|
717
|
+
height: n,
|
|
718
|
+
size: this.size_ !== null ? this.size_.slice() : void 0,
|
|
719
|
+
src: this.getSrc(),
|
|
720
|
+
displacement: this.getDisplacement().slice(),
|
|
721
|
+
declutterMode: this.getDeclutterMode()
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Get the anchor point in pixels. The anchor determines the center point for the
|
|
726
|
+
* symbolizer.
|
|
727
|
+
* @return {Array<number>} Anchor.
|
|
728
|
+
* @api
|
|
729
|
+
*/
|
|
730
|
+
getAnchor() {
|
|
731
|
+
let e = this.normalizedAnchor_;
|
|
732
|
+
if (!e) {
|
|
733
|
+
e = this.anchor_;
|
|
734
|
+
const s = this.getSize();
|
|
735
|
+
if (this.anchorXUnits_ == "fraction" || this.anchorYUnits_ == "fraction") {
|
|
736
|
+
if (!s)
|
|
737
|
+
return null;
|
|
738
|
+
e = this.anchor_.slice(), this.anchorXUnits_ == "fraction" && (e[0] *= s[0]), this.anchorYUnits_ == "fraction" && (e[1] *= s[1]);
|
|
739
|
+
}
|
|
740
|
+
if (this.anchorOrigin_ != "top-left") {
|
|
741
|
+
if (!s)
|
|
742
|
+
return null;
|
|
743
|
+
e === this.anchor_ && (e = this.anchor_.slice()), (this.anchorOrigin_ == "top-right" || this.anchorOrigin_ == "bottom-right") && (e[0] = -e[0] + s[0]), (this.anchorOrigin_ == "bottom-left" || this.anchorOrigin_ == "bottom-right") && (e[1] = -e[1] + s[1]);
|
|
744
|
+
}
|
|
745
|
+
this.normalizedAnchor_ = e;
|
|
746
|
+
}
|
|
747
|
+
const t = this.getDisplacement(), n = this.getScaleArray();
|
|
748
|
+
return [
|
|
749
|
+
e[0] - t[0] / n[0],
|
|
750
|
+
e[1] + t[1] / n[1]
|
|
751
|
+
];
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Set the anchor point. The anchor determines the center point for the
|
|
755
|
+
* symbolizer.
|
|
756
|
+
*
|
|
757
|
+
* @param {Array<number>} anchor Anchor.
|
|
758
|
+
* @api
|
|
759
|
+
*/
|
|
760
|
+
setAnchor(e) {
|
|
761
|
+
this.anchor_ = e, this.normalizedAnchor_ = null;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Get the icon color.
|
|
765
|
+
* @return {import("../color.js").Color} Color.
|
|
766
|
+
* @api
|
|
767
|
+
*/
|
|
768
|
+
getColor() {
|
|
769
|
+
return this.color_;
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Get the image icon.
|
|
773
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
774
|
+
* @return {HTMLImageElement|HTMLCanvasElement} Image or Canvas element.
|
|
775
|
+
* @api
|
|
776
|
+
*/
|
|
777
|
+
getImage(e) {
|
|
778
|
+
return this.iconImage_.getImage(e);
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Get the pixel ratio.
|
|
782
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
783
|
+
* @return {number} The pixel ratio of the image.
|
|
784
|
+
* @api
|
|
785
|
+
*/
|
|
786
|
+
getPixelRatio(e) {
|
|
787
|
+
return this.iconImage_.getPixelRatio(e);
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* @return {import("../size.js").Size} Image size.
|
|
791
|
+
*/
|
|
792
|
+
getImageSize() {
|
|
793
|
+
return this.iconImage_.getSize();
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* @return {import("../ImageState.js").default} Image state.
|
|
797
|
+
*/
|
|
798
|
+
getImageState() {
|
|
799
|
+
return this.iconImage_.getImageState();
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* @return {HTMLImageElement|HTMLCanvasElement} Image element.
|
|
803
|
+
*/
|
|
804
|
+
getHitDetectionImage() {
|
|
805
|
+
return this.iconImage_.getHitDetectionImage();
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Get the origin of the symbolizer.
|
|
809
|
+
* @return {Array<number>} Origin.
|
|
810
|
+
* @api
|
|
811
|
+
*/
|
|
812
|
+
getOrigin() {
|
|
813
|
+
if (this.origin_)
|
|
814
|
+
return this.origin_;
|
|
815
|
+
let e = this.offset_;
|
|
816
|
+
if (this.offsetOrigin_ != "top-left") {
|
|
817
|
+
const t = this.getSize(), n = this.iconImage_.getSize();
|
|
818
|
+
if (!t || !n)
|
|
819
|
+
return null;
|
|
820
|
+
e = e.slice(), (this.offsetOrigin_ == "top-right" || this.offsetOrigin_ == "bottom-right") && (e[0] = n[0] - t[0] - e[0]), (this.offsetOrigin_ == "bottom-left" || this.offsetOrigin_ == "bottom-right") && (e[1] = n[1] - t[1] - e[1]);
|
|
821
|
+
}
|
|
822
|
+
return this.origin_ = e, this.origin_;
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Get the image URL.
|
|
826
|
+
* @return {string|undefined} Image src.
|
|
827
|
+
* @api
|
|
828
|
+
*/
|
|
829
|
+
getSrc() {
|
|
830
|
+
return this.iconImage_.getSrc();
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Get the size of the icon (in pixels).
|
|
834
|
+
* @return {import("../size.js").Size} Image size.
|
|
835
|
+
* @api
|
|
836
|
+
*/
|
|
837
|
+
getSize() {
|
|
838
|
+
return this.size_ ? this.size_ : this.iconImage_.getSize();
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Get the width of the icon (in pixels). Will return undefined when the icon image is not yet loaded.
|
|
842
|
+
* @return {number} Icon width (in pixels).
|
|
843
|
+
* @api
|
|
844
|
+
*/
|
|
845
|
+
getWidth() {
|
|
846
|
+
const e = this.getScaleArray();
|
|
847
|
+
if (this.size_)
|
|
848
|
+
return this.size_[0] * e[0];
|
|
849
|
+
if (this.iconImage_.getImageState() == _.LOADED)
|
|
850
|
+
return this.iconImage_.getSize()[0] * e[0];
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Get the height of the icon (in pixels). Will return undefined when the icon image is not yet loaded.
|
|
854
|
+
* @return {number} Icon height (in pixels).
|
|
855
|
+
* @api
|
|
856
|
+
*/
|
|
857
|
+
getHeight() {
|
|
858
|
+
const e = this.getScaleArray();
|
|
859
|
+
if (this.size_)
|
|
860
|
+
return this.size_[1] * e[1];
|
|
861
|
+
if (this.iconImage_.getImageState() == _.LOADED)
|
|
862
|
+
return this.iconImage_.getSize()[1] * e[1];
|
|
863
|
+
}
|
|
864
|
+
/**
|
|
865
|
+
* Set the scale.
|
|
866
|
+
*
|
|
867
|
+
* @param {number|import("../size.js").Size} scale Scale.
|
|
868
|
+
* @api
|
|
869
|
+
*/
|
|
870
|
+
setScale(e) {
|
|
871
|
+
delete this.initialOptions_, super.setScale(e);
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
|
875
|
+
*/
|
|
876
|
+
listenImageChange(e) {
|
|
877
|
+
this.iconImage_.addEventListener(O.CHANGE, e);
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Load not yet loaded URI.
|
|
881
|
+
* When rendering a feature with an icon style, the vector renderer will
|
|
882
|
+
* automatically call this method. However, you might want to call this
|
|
883
|
+
* method yourself for preloading or other purposes.
|
|
884
|
+
* @api
|
|
885
|
+
*/
|
|
886
|
+
load() {
|
|
887
|
+
this.iconImage_.load();
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
|
891
|
+
*/
|
|
892
|
+
unlistenImageChange(e) {
|
|
893
|
+
this.iconImage_.removeEventListener(O.CHANGE, e);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
class A {
|
|
897
|
+
/**
|
|
898
|
+
* @param {Options} [options] Options.
|
|
899
|
+
*/
|
|
900
|
+
constructor(e) {
|
|
901
|
+
e = e || {}, this.color_ = e.color !== void 0 ? e.color : null, this.lineCap_ = e.lineCap, this.lineDash_ = e.lineDash !== void 0 ? e.lineDash : null, this.lineDashOffset_ = e.lineDashOffset, this.lineJoin_ = e.lineJoin, this.miterLimit_ = e.miterLimit, this.width_ = e.width;
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* Clones the style.
|
|
905
|
+
* @return {Stroke} The cloned style.
|
|
906
|
+
* @api
|
|
907
|
+
*/
|
|
908
|
+
clone() {
|
|
909
|
+
const e = this.getColor();
|
|
910
|
+
return new A({
|
|
911
|
+
color: Array.isArray(e) ? e.slice() : e || void 0,
|
|
912
|
+
lineCap: this.getLineCap(),
|
|
913
|
+
lineDash: this.getLineDash() ? this.getLineDash().slice() : void 0,
|
|
914
|
+
lineDashOffset: this.getLineDashOffset(),
|
|
915
|
+
lineJoin: this.getLineJoin(),
|
|
916
|
+
miterLimit: this.getMiterLimit(),
|
|
917
|
+
width: this.getWidth()
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Get the stroke color.
|
|
922
|
+
* @return {import("../color.js").Color|import("../colorlike.js").ColorLike} Color.
|
|
923
|
+
* @api
|
|
924
|
+
*/
|
|
925
|
+
getColor() {
|
|
926
|
+
return this.color_;
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* Get the line cap type for the stroke.
|
|
930
|
+
* @return {CanvasLineCap|undefined} Line cap.
|
|
931
|
+
* @api
|
|
932
|
+
*/
|
|
933
|
+
getLineCap() {
|
|
934
|
+
return this.lineCap_;
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Get the line dash style for the stroke.
|
|
938
|
+
* @return {Array<number>|null} Line dash.
|
|
939
|
+
* @api
|
|
940
|
+
*/
|
|
941
|
+
getLineDash() {
|
|
942
|
+
return this.lineDash_;
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Get the line dash offset for the stroke.
|
|
946
|
+
* @return {number|undefined} Line dash offset.
|
|
947
|
+
* @api
|
|
948
|
+
*/
|
|
949
|
+
getLineDashOffset() {
|
|
950
|
+
return this.lineDashOffset_;
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Get the line join type for the stroke.
|
|
954
|
+
* @return {CanvasLineJoin|undefined} Line join.
|
|
955
|
+
* @api
|
|
956
|
+
*/
|
|
957
|
+
getLineJoin() {
|
|
958
|
+
return this.lineJoin_;
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Get the miter limit for the stroke.
|
|
962
|
+
* @return {number|undefined} Miter limit.
|
|
963
|
+
* @api
|
|
964
|
+
*/
|
|
965
|
+
getMiterLimit() {
|
|
966
|
+
return this.miterLimit_;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* Get the stroke width.
|
|
970
|
+
* @return {number|undefined} Width.
|
|
971
|
+
* @api
|
|
972
|
+
*/
|
|
973
|
+
getWidth() {
|
|
974
|
+
return this.width_;
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Set the color.
|
|
978
|
+
*
|
|
979
|
+
* @param {import("../color.js").Color|import("../colorlike.js").ColorLike} color Color.
|
|
980
|
+
* @api
|
|
981
|
+
*/
|
|
982
|
+
setColor(e) {
|
|
983
|
+
this.color_ = e;
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* Set the line cap.
|
|
987
|
+
*
|
|
988
|
+
* @param {CanvasLineCap|undefined} lineCap Line cap.
|
|
989
|
+
* @api
|
|
990
|
+
*/
|
|
991
|
+
setLineCap(e) {
|
|
992
|
+
this.lineCap_ = e;
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Set the line dash.
|
|
996
|
+
*
|
|
997
|
+
* @param {Array<number>|null} lineDash Line dash.
|
|
998
|
+
* @api
|
|
999
|
+
*/
|
|
1000
|
+
setLineDash(e) {
|
|
1001
|
+
this.lineDash_ = e;
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* Set the line dash offset.
|
|
1005
|
+
*
|
|
1006
|
+
* @param {number|undefined} lineDashOffset Line dash offset.
|
|
1007
|
+
* @api
|
|
1008
|
+
*/
|
|
1009
|
+
setLineDashOffset(e) {
|
|
1010
|
+
this.lineDashOffset_ = e;
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Set the line join.
|
|
1014
|
+
*
|
|
1015
|
+
* @param {CanvasLineJoin|undefined} lineJoin Line join.
|
|
1016
|
+
* @api
|
|
1017
|
+
*/
|
|
1018
|
+
setLineJoin(e) {
|
|
1019
|
+
this.lineJoin_ = e;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Set the miter limit.
|
|
1023
|
+
*
|
|
1024
|
+
* @param {number|undefined} miterLimit Miter limit.
|
|
1025
|
+
* @api
|
|
1026
|
+
*/
|
|
1027
|
+
setMiterLimit(e) {
|
|
1028
|
+
this.miterLimit_ = e;
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Set the width.
|
|
1032
|
+
*
|
|
1033
|
+
* @param {number|undefined} width Width.
|
|
1034
|
+
* @api
|
|
1035
|
+
*/
|
|
1036
|
+
setWidth(e) {
|
|
1037
|
+
this.width_ = e;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
function p(i) {
|
|
1041
|
+
return Array.isArray(i) ? te(i) : i;
|
|
1042
|
+
}
|
|
1043
|
+
const Ne = "10px sans-serif", q = "#000", Je = "round", Xe = [], Ue = 0, Z = "round", Ae = 10, Ce = "#000", Ye = "center", Ge = "middle", pe = [0, 0, 0, 0], ke = 1, y = new oe();
|
|
1044
|
+
let D = null, T;
|
|
1045
|
+
const P = {}, qe = function() {
|
|
1046
|
+
const e = "32px ", t = ["monospace", "serif"], n = t.length, s = "wmytzilWMYTZIL@#/&?$%10";
|
|
1047
|
+
let r, a;
|
|
1048
|
+
function l(c, h, u) {
|
|
1049
|
+
let f = !0;
|
|
1050
|
+
for (let g = 0; g < n; ++g) {
|
|
1051
|
+
const d = t[g];
|
|
1052
|
+
if (a = M(
|
|
1053
|
+
c + " " + h + " " + e + d,
|
|
1054
|
+
s
|
|
1055
|
+
), u != d) {
|
|
1056
|
+
const I = M(
|
|
1057
|
+
c + " " + h + " " + e + u + "," + d,
|
|
1058
|
+
s
|
|
1059
|
+
);
|
|
1060
|
+
f = f && I != a;
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
return !!f;
|
|
1064
|
+
}
|
|
1065
|
+
function o() {
|
|
1066
|
+
let c = !0;
|
|
1067
|
+
const h = y.getKeys();
|
|
1068
|
+
for (let u = 0, f = h.length; u < f; ++u) {
|
|
1069
|
+
const g = h[u];
|
|
1070
|
+
y.get(g) < 100 && (l.apply(this, g.split(`
|
|
1071
|
+
`)) ? (ue(P), D = null, T = void 0, y.set(g, 100)) : (y.set(g, y.get(g) + 1, !0), c = !1));
|
|
1072
|
+
}
|
|
1073
|
+
c && (clearInterval(r), r = void 0);
|
|
1074
|
+
}
|
|
1075
|
+
return function(c) {
|
|
1076
|
+
const h = $(c);
|
|
1077
|
+
if (!h)
|
|
1078
|
+
return;
|
|
1079
|
+
const u = h.families;
|
|
1080
|
+
for (let f = 0, g = u.length; f < g; ++f) {
|
|
1081
|
+
const d = u[f], I = h.style + `
|
|
1082
|
+
` + h.weight + `
|
|
1083
|
+
` + d;
|
|
1084
|
+
y.get(I) === void 0 && (y.set(I, 100, !0), l(h.style, h.weight, d) || (y.set(I, 0, !0), r === void 0 && (r = setInterval(o, 32))));
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1087
|
+
}(), ze = /* @__PURE__ */ function() {
|
|
1088
|
+
let i;
|
|
1089
|
+
return function(e) {
|
|
1090
|
+
let t = P[e];
|
|
1091
|
+
if (t == null) {
|
|
1092
|
+
if (j) {
|
|
1093
|
+
const n = $(e), s = ne(e, "Žg");
|
|
1094
|
+
t = (isNaN(Number(n.lineHeight)) ? 1.2 : Number(n.lineHeight)) * (s.actualBoundingBoxAscent + s.actualBoundingBoxDescent);
|
|
1095
|
+
} else
|
|
1096
|
+
i || (i = document.createElement("div"), i.innerHTML = "M", i.style.minHeight = "0", i.style.maxHeight = "none", i.style.height = "auto", i.style.padding = "0", i.style.border = "none", i.style.position = "absolute", i.style.display = "block", i.style.left = "-99999px"), i.style.font = e, document.body.appendChild(i), t = i.offsetHeight, document.body.removeChild(i);
|
|
1097
|
+
P[e] = t;
|
|
1098
|
+
}
|
|
1099
|
+
return t;
|
|
1100
|
+
};
|
|
1101
|
+
}();
|
|
1102
|
+
function ne(i, e) {
|
|
1103
|
+
return D || (D = L(1, 1)), i != T && (D.font = i, T = D.font), D.measureText(e);
|
|
1104
|
+
}
|
|
1105
|
+
function M(i, e) {
|
|
1106
|
+
return ne(i, e).width;
|
|
1107
|
+
}
|
|
1108
|
+
function Ze(i, e, t) {
|
|
1109
|
+
if (e in t)
|
|
1110
|
+
return t[e];
|
|
1111
|
+
const n = e.split(`
|
|
1112
|
+
`).reduce((s, r) => Math.max(s, M(i, r)), 0);
|
|
1113
|
+
return t[e] = n, n;
|
|
1114
|
+
}
|
|
1115
|
+
function Ke(i, e) {
|
|
1116
|
+
const t = [], n = [], s = [];
|
|
1117
|
+
let r = 0, a = 0, l = 0, o = 0;
|
|
1118
|
+
for (let c = 0, h = e.length; c <= h; c += 2) {
|
|
1119
|
+
const u = e[c];
|
|
1120
|
+
if (u === `
|
|
1121
|
+
` || c === h) {
|
|
1122
|
+
r = Math.max(r, a), s.push(a), a = 0, l += o;
|
|
1123
|
+
continue;
|
|
1124
|
+
}
|
|
1125
|
+
const f = e[c + 1] || i.font, g = M(f, u);
|
|
1126
|
+
t.push(g), a += g;
|
|
1127
|
+
const d = ze(f);
|
|
1128
|
+
n.push(d), o = Math.max(o, d);
|
|
1129
|
+
}
|
|
1130
|
+
return { width: r, height: l, widths: t, heights: n, lineWidths: s };
|
|
1131
|
+
}
|
|
1132
|
+
function je(i, e, t, n, s, r, a, l, o, c, h) {
|
|
1133
|
+
i.save(), t !== 1 && (i.globalAlpha *= t), e && i.setTransform.apply(i, e), /** @type {*} */
|
|
1134
|
+
n.contextInstructions ? (i.translate(o, c), i.scale(h[0], h[1]), Oe(
|
|
1135
|
+
/** @type {Label} */
|
|
1136
|
+
n,
|
|
1137
|
+
i
|
|
1138
|
+
)) : h[0] < 0 || h[1] < 0 ? (i.translate(o, c), i.scale(h[0], h[1]), i.drawImage(
|
|
1139
|
+
/** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */
|
|
1140
|
+
n,
|
|
1141
|
+
s,
|
|
1142
|
+
r,
|
|
1143
|
+
a,
|
|
1144
|
+
l,
|
|
1145
|
+
0,
|
|
1146
|
+
0,
|
|
1147
|
+
a,
|
|
1148
|
+
l
|
|
1149
|
+
)) : i.drawImage(
|
|
1150
|
+
/** @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} */
|
|
1151
|
+
n,
|
|
1152
|
+
s,
|
|
1153
|
+
r,
|
|
1154
|
+
a,
|
|
1155
|
+
l,
|
|
1156
|
+
o,
|
|
1157
|
+
c,
|
|
1158
|
+
a * h[0],
|
|
1159
|
+
l * h[1]
|
|
1160
|
+
), i.restore();
|
|
1161
|
+
}
|
|
1162
|
+
function Oe(i, e) {
|
|
1163
|
+
const t = i.contextInstructions;
|
|
1164
|
+
for (let n = 0, s = t.length; n < s; n += 2)
|
|
1165
|
+
Array.isArray(t[n + 1]) ? e[t[n]].apply(
|
|
1166
|
+
e,
|
|
1167
|
+
t[n + 1]
|
|
1168
|
+
) : e[t[n]] = t[n + 1];
|
|
1169
|
+
}
|
|
1170
|
+
class V extends E {
|
|
1171
|
+
/**
|
|
1172
|
+
* @param {Options} options Options.
|
|
1173
|
+
*/
|
|
1174
|
+
constructor(e) {
|
|
1175
|
+
const t = e.rotateWithView !== void 0 ? e.rotateWithView : !1;
|
|
1176
|
+
super({
|
|
1177
|
+
opacity: 1,
|
|
1178
|
+
rotateWithView: t,
|
|
1179
|
+
rotation: e.rotation !== void 0 ? e.rotation : 0,
|
|
1180
|
+
scale: e.scale !== void 0 ? e.scale : 1,
|
|
1181
|
+
displacement: e.displacement !== void 0 ? e.displacement : [0, 0],
|
|
1182
|
+
declutterMode: e.declutterMode
|
|
1183
|
+
}), this.canvas_ = void 0, this.hitDetectionCanvas_ = null, this.fill_ = e.fill !== void 0 ? e.fill : null, this.origin_ = [0, 0], this.points_ = e.points, this.radius_ = e.radius !== void 0 ? e.radius : e.radius1, this.radius2_ = e.radius2, this.angle_ = e.angle !== void 0 ? e.angle : 0, this.stroke_ = e.stroke !== void 0 ? e.stroke : null, this.size_ = null, this.renderOptions_ = null, this.render();
|
|
1184
|
+
}
|
|
1185
|
+
/**
|
|
1186
|
+
* Clones the style.
|
|
1187
|
+
* @return {RegularShape} The cloned style.
|
|
1188
|
+
* @api
|
|
1189
|
+
*/
|
|
1190
|
+
clone() {
|
|
1191
|
+
const e = this.getScale(), t = new V({
|
|
1192
|
+
fill: this.getFill() ? this.getFill().clone() : void 0,
|
|
1193
|
+
points: this.getPoints(),
|
|
1194
|
+
radius: this.getRadius(),
|
|
1195
|
+
radius2: this.getRadius2(),
|
|
1196
|
+
angle: this.getAngle(),
|
|
1197
|
+
stroke: this.getStroke() ? this.getStroke().clone() : void 0,
|
|
1198
|
+
rotation: this.getRotation(),
|
|
1199
|
+
rotateWithView: this.getRotateWithView(),
|
|
1200
|
+
scale: Array.isArray(e) ? e.slice() : e,
|
|
1201
|
+
displacement: this.getDisplacement().slice(),
|
|
1202
|
+
declutterMode: this.getDeclutterMode()
|
|
1203
|
+
});
|
|
1204
|
+
return t.setOpacity(this.getOpacity()), t;
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Get the anchor point in pixels. The anchor determines the center point for the
|
|
1208
|
+
* symbolizer.
|
|
1209
|
+
* @return {Array<number>} Anchor.
|
|
1210
|
+
* @api
|
|
1211
|
+
*/
|
|
1212
|
+
getAnchor() {
|
|
1213
|
+
const e = this.size_;
|
|
1214
|
+
if (!e)
|
|
1215
|
+
return null;
|
|
1216
|
+
const t = this.getDisplacement(), n = this.getScaleArray();
|
|
1217
|
+
return [
|
|
1218
|
+
e[0] / 2 - t[0] / n[0],
|
|
1219
|
+
e[1] / 2 + t[1] / n[1]
|
|
1220
|
+
];
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Get the angle used in generating the shape.
|
|
1224
|
+
* @return {number} Shape's rotation in radians.
|
|
1225
|
+
* @api
|
|
1226
|
+
*/
|
|
1227
|
+
getAngle() {
|
|
1228
|
+
return this.angle_;
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Get the fill style for the shape.
|
|
1232
|
+
* @return {import("./Fill.js").default} Fill style.
|
|
1233
|
+
* @api
|
|
1234
|
+
*/
|
|
1235
|
+
getFill() {
|
|
1236
|
+
return this.fill_;
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Set the fill style.
|
|
1240
|
+
* @param {import("./Fill.js").default} fill Fill style.
|
|
1241
|
+
* @api
|
|
1242
|
+
*/
|
|
1243
|
+
setFill(e) {
|
|
1244
|
+
this.fill_ = e, this.render();
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* @return {HTMLCanvasElement} Image element.
|
|
1248
|
+
*/
|
|
1249
|
+
getHitDetectionImage() {
|
|
1250
|
+
return this.hitDetectionCanvas_ || this.createHitDetectionCanvas_(this.renderOptions_), this.hitDetectionCanvas_;
|
|
1251
|
+
}
|
|
1252
|
+
/**
|
|
1253
|
+
* Get the image icon.
|
|
1254
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
1255
|
+
* @return {HTMLCanvasElement} Image or Canvas element.
|
|
1256
|
+
* @api
|
|
1257
|
+
*/
|
|
1258
|
+
getImage(e) {
|
|
1259
|
+
let t = this.canvas_[e];
|
|
1260
|
+
if (!t) {
|
|
1261
|
+
const n = this.renderOptions_, s = L(
|
|
1262
|
+
n.size * e,
|
|
1263
|
+
n.size * e
|
|
1264
|
+
);
|
|
1265
|
+
this.draw_(n, s, e), t = s.canvas, this.canvas_[e] = t;
|
|
1266
|
+
}
|
|
1267
|
+
return t;
|
|
1268
|
+
}
|
|
1269
|
+
/**
|
|
1270
|
+
* Get the image pixel ratio.
|
|
1271
|
+
* @param {number} pixelRatio Pixel ratio.
|
|
1272
|
+
* @return {number} Pixel ratio.
|
|
1273
|
+
*/
|
|
1274
|
+
getPixelRatio(e) {
|
|
1275
|
+
return e;
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* @return {import("../size.js").Size} Image size.
|
|
1279
|
+
*/
|
|
1280
|
+
getImageSize() {
|
|
1281
|
+
return this.size_;
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* @return {import("../ImageState.js").default} Image state.
|
|
1285
|
+
*/
|
|
1286
|
+
getImageState() {
|
|
1287
|
+
return _.LOADED;
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Get the origin of the symbolizer.
|
|
1291
|
+
* @return {Array<number>} Origin.
|
|
1292
|
+
* @api
|
|
1293
|
+
*/
|
|
1294
|
+
getOrigin() {
|
|
1295
|
+
return this.origin_;
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* Get the number of points for generating the shape.
|
|
1299
|
+
* @return {number} Number of points for stars and regular polygons.
|
|
1300
|
+
* @api
|
|
1301
|
+
*/
|
|
1302
|
+
getPoints() {
|
|
1303
|
+
return this.points_;
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* Get the (primary) radius for the shape.
|
|
1307
|
+
* @return {number} Radius.
|
|
1308
|
+
* @api
|
|
1309
|
+
*/
|
|
1310
|
+
getRadius() {
|
|
1311
|
+
return this.radius_;
|
|
1312
|
+
}
|
|
1313
|
+
/**
|
|
1314
|
+
* Get the secondary radius for the shape.
|
|
1315
|
+
* @return {number|undefined} Radius2.
|
|
1316
|
+
* @api
|
|
1317
|
+
*/
|
|
1318
|
+
getRadius2() {
|
|
1319
|
+
return this.radius2_;
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Get the size of the symbolizer (in pixels).
|
|
1323
|
+
* @return {import("../size.js").Size} Size.
|
|
1324
|
+
* @api
|
|
1325
|
+
*/
|
|
1326
|
+
getSize() {
|
|
1327
|
+
return this.size_;
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Get the stroke style for the shape.
|
|
1331
|
+
* @return {import("./Stroke.js").default} Stroke style.
|
|
1332
|
+
* @api
|
|
1333
|
+
*/
|
|
1334
|
+
getStroke() {
|
|
1335
|
+
return this.stroke_;
|
|
1336
|
+
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Set the stroke style.
|
|
1339
|
+
* @param {import("./Stroke.js").default} stroke Stroke style.
|
|
1340
|
+
* @api
|
|
1341
|
+
*/
|
|
1342
|
+
setStroke(e) {
|
|
1343
|
+
this.stroke_ = e, this.render();
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
|
1347
|
+
*/
|
|
1348
|
+
listenImageChange(e) {
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Load not yet loaded URI.
|
|
1352
|
+
*/
|
|
1353
|
+
load() {
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* @param {function(import("../events/Event.js").default): void} listener Listener function.
|
|
1357
|
+
*/
|
|
1358
|
+
unlistenImageChange(e) {
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Calculate additional canvas size needed for the miter.
|
|
1362
|
+
* @param {string} lineJoin Line join
|
|
1363
|
+
* @param {number} strokeWidth Stroke width
|
|
1364
|
+
* @param {number} miterLimit Miter limit
|
|
1365
|
+
* @return {number} Additional canvas size needed
|
|
1366
|
+
* @private
|
|
1367
|
+
*/
|
|
1368
|
+
calculateLineJoinSize_(e, t, n) {
|
|
1369
|
+
if (t === 0 || this.points_ === 1 / 0 || e !== "bevel" && e !== "miter")
|
|
1370
|
+
return t;
|
|
1371
|
+
let s = this.radius_, r = this.radius2_ === void 0 ? s : this.radius2_;
|
|
1372
|
+
if (s < r) {
|
|
1373
|
+
const F = s;
|
|
1374
|
+
s = r, r = F;
|
|
1375
|
+
}
|
|
1376
|
+
const a = this.radius2_ === void 0 ? this.points_ : this.points_ * 2, l = 2 * Math.PI / a, o = r * Math.sin(l), c = Math.sqrt(r * r - o * o), h = s - c, u = Math.sqrt(o * o + h * h), f = u / o;
|
|
1377
|
+
if (e === "miter" && f <= n)
|
|
1378
|
+
return f * t;
|
|
1379
|
+
const g = t / 2 / f, d = t / 2 * (h / u), b = Math.sqrt((s + g) * (s + g) + d * d) - s;
|
|
1380
|
+
if (this.radius2_ === void 0 || e === "bevel")
|
|
1381
|
+
return b * 2;
|
|
1382
|
+
const k = s * Math.sin(l), re = Math.sqrt(s * s - k * k), H = r - re, B = Math.sqrt(k * k + H * H) / k;
|
|
1383
|
+
if (B <= n) {
|
|
1384
|
+
const F = B * t / 2 - r - s;
|
|
1385
|
+
return 2 * Math.max(b, F);
|
|
1386
|
+
}
|
|
1387
|
+
return b * 2;
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* @return {RenderOptions} The render options
|
|
1391
|
+
* @protected
|
|
1392
|
+
*/
|
|
1393
|
+
createRenderOptions() {
|
|
1394
|
+
let e = Z, t = 0, n = null, s = 0, r, a = 0;
|
|
1395
|
+
this.stroke_ && (r = this.stroke_.getColor(), r === null && (r = Ce), r = p(r), a = this.stroke_.getWidth(), a === void 0 && (a = ke), n = this.stroke_.getLineDash(), s = this.stroke_.getLineDashOffset(), e = this.stroke_.getLineJoin(), e === void 0 && (e = Z), t = this.stroke_.getMiterLimit(), t === void 0 && (t = Ae));
|
|
1396
|
+
const l = this.calculateLineJoinSize_(e, a, t), o = Math.max(this.radius_, this.radius2_ || 0), c = Math.ceil(2 * o + l);
|
|
1397
|
+
return {
|
|
1398
|
+
strokeStyle: r,
|
|
1399
|
+
strokeWidth: a,
|
|
1400
|
+
size: c,
|
|
1401
|
+
lineDash: n,
|
|
1402
|
+
lineDashOffset: s,
|
|
1403
|
+
lineJoin: e,
|
|
1404
|
+
miterLimit: t
|
|
1405
|
+
};
|
|
1406
|
+
}
|
|
1407
|
+
/**
|
|
1408
|
+
* @protected
|
|
1409
|
+
*/
|
|
1410
|
+
render() {
|
|
1411
|
+
this.renderOptions_ = this.createRenderOptions();
|
|
1412
|
+
const e = this.renderOptions_.size;
|
|
1413
|
+
this.canvas_ = {}, this.size_ = [e, e];
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* @private
|
|
1417
|
+
* @param {RenderOptions} renderOptions Render options.
|
|
1418
|
+
* @param {CanvasRenderingContext2D} context The rendering context.
|
|
1419
|
+
* @param {number} pixelRatio The pixel ratio.
|
|
1420
|
+
*/
|
|
1421
|
+
draw_(e, t, n) {
|
|
1422
|
+
if (t.scale(n, n), t.translate(e.size / 2, e.size / 2), this.createPath_(t), this.fill_) {
|
|
1423
|
+
let s = this.fill_.getColor();
|
|
1424
|
+
s === null && (s = q), t.fillStyle = p(s), t.fill();
|
|
1425
|
+
}
|
|
1426
|
+
this.stroke_ && (t.strokeStyle = e.strokeStyle, t.lineWidth = e.strokeWidth, e.lineDash && (t.setLineDash(e.lineDash), t.lineDashOffset = e.lineDashOffset), t.lineJoin = e.lineJoin, t.miterLimit = e.miterLimit, t.stroke());
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1429
|
+
* @private
|
|
1430
|
+
* @param {RenderOptions} renderOptions Render options.
|
|
1431
|
+
*/
|
|
1432
|
+
createHitDetectionCanvas_(e) {
|
|
1433
|
+
if (this.fill_) {
|
|
1434
|
+
let t = this.fill_.getColor(), n = 0;
|
|
1435
|
+
if (typeof t == "string" && (t = ee(t)), t === null ? n = 1 : Array.isArray(t) && (n = t.length === 4 ? t[3] : 1), n === 0) {
|
|
1436
|
+
const s = L(
|
|
1437
|
+
e.size,
|
|
1438
|
+
e.size
|
|
1439
|
+
);
|
|
1440
|
+
this.hitDetectionCanvas_ = s.canvas, this.drawHitDetectionCanvas_(e, s);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
this.hitDetectionCanvas_ || (this.hitDetectionCanvas_ = this.getImage(1));
|
|
1444
|
+
}
|
|
1445
|
+
/**
|
|
1446
|
+
* @private
|
|
1447
|
+
* @param {CanvasRenderingContext2D} context The context to draw in.
|
|
1448
|
+
*/
|
|
1449
|
+
createPath_(e) {
|
|
1450
|
+
let t = this.points_;
|
|
1451
|
+
const n = this.radius_;
|
|
1452
|
+
if (t === 1 / 0)
|
|
1453
|
+
e.arc(0, 0, n, 0, 2 * Math.PI);
|
|
1454
|
+
else {
|
|
1455
|
+
const s = this.radius2_ === void 0 ? n : this.radius2_;
|
|
1456
|
+
this.radius2_ !== void 0 && (t *= 2);
|
|
1457
|
+
const r = this.angle_ - Math.PI / 2, a = 2 * Math.PI / t;
|
|
1458
|
+
for (let l = 0; l < t; l++) {
|
|
1459
|
+
const o = r + l * a, c = l % 2 === 0 ? n : s;
|
|
1460
|
+
e.lineTo(c * Math.cos(o), c * Math.sin(o));
|
|
1461
|
+
}
|
|
1462
|
+
e.closePath();
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
/**
|
|
1466
|
+
* @private
|
|
1467
|
+
* @param {RenderOptions} renderOptions Render options.
|
|
1468
|
+
* @param {CanvasRenderingContext2D} context The context.
|
|
1469
|
+
*/
|
|
1470
|
+
drawHitDetectionCanvas_(e, t) {
|
|
1471
|
+
t.translate(e.size / 2, e.size / 2), this.createPath_(t), t.fillStyle = q, t.fill(), this.stroke_ && (t.strokeStyle = e.strokeStyle, t.lineWidth = e.strokeWidth, e.lineDash && (t.setLineDash(e.lineDash), t.lineDashOffset = e.lineDashOffset), t.lineJoin = e.lineJoin, t.miterLimit = e.miterLimit, t.stroke());
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
class R extends V {
|
|
1475
|
+
/**
|
|
1476
|
+
* @param {Options} [options] Options.
|
|
1477
|
+
*/
|
|
1478
|
+
constructor(e) {
|
|
1479
|
+
e = e || { radius: 5 }, super({
|
|
1480
|
+
points: 1 / 0,
|
|
1481
|
+
fill: e.fill,
|
|
1482
|
+
radius: e.radius,
|
|
1483
|
+
stroke: e.stroke,
|
|
1484
|
+
scale: e.scale !== void 0 ? e.scale : 1,
|
|
1485
|
+
rotation: e.rotation !== void 0 ? e.rotation : 0,
|
|
1486
|
+
rotateWithView: e.rotateWithView !== void 0 ? e.rotateWithView : !1,
|
|
1487
|
+
displacement: e.displacement !== void 0 ? e.displacement : [0, 0],
|
|
1488
|
+
declutterMode: e.declutterMode
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Clones the style.
|
|
1493
|
+
* @return {CircleStyle} The cloned style.
|
|
1494
|
+
* @api
|
|
1495
|
+
*/
|
|
1496
|
+
clone() {
|
|
1497
|
+
const e = this.getScale(), t = new R({
|
|
1498
|
+
fill: this.getFill() ? this.getFill().clone() : void 0,
|
|
1499
|
+
stroke: this.getStroke() ? this.getStroke().clone() : void 0,
|
|
1500
|
+
radius: this.getRadius(),
|
|
1501
|
+
scale: Array.isArray(e) ? e.slice() : e,
|
|
1502
|
+
rotation: this.getRotation(),
|
|
1503
|
+
rotateWithView: this.getRotateWithView(),
|
|
1504
|
+
displacement: this.getDisplacement().slice(),
|
|
1505
|
+
declutterMode: this.getDeclutterMode()
|
|
1506
|
+
});
|
|
1507
|
+
return t.setOpacity(this.getOpacity()), t;
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* Set the circle radius.
|
|
1511
|
+
*
|
|
1512
|
+
* @param {number} radius Circle radius.
|
|
1513
|
+
* @api
|
|
1514
|
+
*/
|
|
1515
|
+
setRadius(e) {
|
|
1516
|
+
this.radius_ = e, this.render();
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
class S {
|
|
1520
|
+
/**
|
|
1521
|
+
* @param {Options} [options] Style options.
|
|
1522
|
+
*/
|
|
1523
|
+
constructor(e) {
|
|
1524
|
+
e = e || {}, this.geometry_ = null, this.geometryFunction_ = K, e.geometry !== void 0 && this.setGeometry(e.geometry), this.fill_ = e.fill !== void 0 ? e.fill : null, this.image_ = e.image !== void 0 ? e.image : null, this.renderer_ = e.renderer !== void 0 ? e.renderer : null, this.hitDetectionRenderer_ = e.hitDetectionRenderer !== void 0 ? e.hitDetectionRenderer : null, this.stroke_ = e.stroke !== void 0 ? e.stroke : null, this.text_ = e.text !== void 0 ? e.text : null, this.zIndex_ = e.zIndex;
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1527
|
+
* Clones the style.
|
|
1528
|
+
* @return {Style} The cloned style.
|
|
1529
|
+
* @api
|
|
1530
|
+
*/
|
|
1531
|
+
clone() {
|
|
1532
|
+
let e = this.getGeometry();
|
|
1533
|
+
return e && typeof e == "object" && (e = /** @type {import("../geom/Geometry.js").default} */
|
|
1534
|
+
e.clone()), new S({
|
|
1535
|
+
geometry: e,
|
|
1536
|
+
fill: this.getFill() ? this.getFill().clone() : void 0,
|
|
1537
|
+
image: this.getImage() ? this.getImage().clone() : void 0,
|
|
1538
|
+
renderer: this.getRenderer(),
|
|
1539
|
+
stroke: this.getStroke() ? this.getStroke().clone() : void 0,
|
|
1540
|
+
text: this.getText() ? this.getText().clone() : void 0,
|
|
1541
|
+
zIndex: this.getZIndex()
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* Get the custom renderer function that was configured with
|
|
1546
|
+
* {@link #setRenderer} or the `renderer` constructor option.
|
|
1547
|
+
* @return {RenderFunction|null} Custom renderer function.
|
|
1548
|
+
* @api
|
|
1549
|
+
*/
|
|
1550
|
+
getRenderer() {
|
|
1551
|
+
return this.renderer_;
|
|
1552
|
+
}
|
|
1553
|
+
/**
|
|
1554
|
+
* Sets a custom renderer function for this style. When set, `fill`, `stroke`
|
|
1555
|
+
* and `image` options of the style will be ignored.
|
|
1556
|
+
* @param {RenderFunction|null} renderer Custom renderer function.
|
|
1557
|
+
* @api
|
|
1558
|
+
*/
|
|
1559
|
+
setRenderer(e) {
|
|
1560
|
+
this.renderer_ = e;
|
|
1561
|
+
}
|
|
1562
|
+
/**
|
|
1563
|
+
* Sets a custom renderer function for this style used
|
|
1564
|
+
* in hit detection.
|
|
1565
|
+
* @param {RenderFunction|null} renderer Custom renderer function.
|
|
1566
|
+
* @api
|
|
1567
|
+
*/
|
|
1568
|
+
setHitDetectionRenderer(e) {
|
|
1569
|
+
this.hitDetectionRenderer_ = e;
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* Get the custom renderer function that was configured with
|
|
1573
|
+
* {@link #setHitDetectionRenderer} or the `hitDetectionRenderer` constructor option.
|
|
1574
|
+
* @return {RenderFunction|null} Custom renderer function.
|
|
1575
|
+
* @api
|
|
1576
|
+
*/
|
|
1577
|
+
getHitDetectionRenderer() {
|
|
1578
|
+
return this.hitDetectionRenderer_;
|
|
1579
|
+
}
|
|
1580
|
+
/**
|
|
1581
|
+
* Get the geometry to be rendered.
|
|
1582
|
+
* @return {string|import("../geom/Geometry.js").default|GeometryFunction}
|
|
1583
|
+
* Feature property or geometry or function that returns the geometry that will
|
|
1584
|
+
* be rendered with this style.
|
|
1585
|
+
* @api
|
|
1586
|
+
*/
|
|
1587
|
+
getGeometry() {
|
|
1588
|
+
return this.geometry_;
|
|
1589
|
+
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Get the function used to generate a geometry for rendering.
|
|
1592
|
+
* @return {!GeometryFunction} Function that is called with a feature
|
|
1593
|
+
* and returns the geometry to render instead of the feature's geometry.
|
|
1594
|
+
* @api
|
|
1595
|
+
*/
|
|
1596
|
+
getGeometryFunction() {
|
|
1597
|
+
return this.geometryFunction_;
|
|
1598
|
+
}
|
|
1599
|
+
/**
|
|
1600
|
+
* Get the fill style.
|
|
1601
|
+
* @return {import("./Fill.js").default} Fill style.
|
|
1602
|
+
* @api
|
|
1603
|
+
*/
|
|
1604
|
+
getFill() {
|
|
1605
|
+
return this.fill_;
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* Set the fill style.
|
|
1609
|
+
* @param {import("./Fill.js").default} fill Fill style.
|
|
1610
|
+
* @api
|
|
1611
|
+
*/
|
|
1612
|
+
setFill(e) {
|
|
1613
|
+
this.fill_ = e;
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Get the image style.
|
|
1617
|
+
* @return {import("./Image.js").default} Image style.
|
|
1618
|
+
* @api
|
|
1619
|
+
*/
|
|
1620
|
+
getImage() {
|
|
1621
|
+
return this.image_;
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Set the image style.
|
|
1625
|
+
* @param {import("./Image.js").default} image Image style.
|
|
1626
|
+
* @api
|
|
1627
|
+
*/
|
|
1628
|
+
setImage(e) {
|
|
1629
|
+
this.image_ = e;
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* Get the stroke style.
|
|
1633
|
+
* @return {import("./Stroke.js").default} Stroke style.
|
|
1634
|
+
* @api
|
|
1635
|
+
*/
|
|
1636
|
+
getStroke() {
|
|
1637
|
+
return this.stroke_;
|
|
1638
|
+
}
|
|
1639
|
+
/**
|
|
1640
|
+
* Set the stroke style.
|
|
1641
|
+
* @param {import("./Stroke.js").default} stroke Stroke style.
|
|
1642
|
+
* @api
|
|
1643
|
+
*/
|
|
1644
|
+
setStroke(e) {
|
|
1645
|
+
this.stroke_ = e;
|
|
1646
|
+
}
|
|
1647
|
+
/**
|
|
1648
|
+
* Get the text style.
|
|
1649
|
+
* @return {import("./Text.js").default} Text style.
|
|
1650
|
+
* @api
|
|
1651
|
+
*/
|
|
1652
|
+
getText() {
|
|
1653
|
+
return this.text_;
|
|
1654
|
+
}
|
|
1655
|
+
/**
|
|
1656
|
+
* Set the text style.
|
|
1657
|
+
* @param {import("./Text.js").default} text Text style.
|
|
1658
|
+
* @api
|
|
1659
|
+
*/
|
|
1660
|
+
setText(e) {
|
|
1661
|
+
this.text_ = e;
|
|
1662
|
+
}
|
|
1663
|
+
/**
|
|
1664
|
+
* Get the z-index for the style.
|
|
1665
|
+
* @return {number|undefined} ZIndex.
|
|
1666
|
+
* @api
|
|
1667
|
+
*/
|
|
1668
|
+
getZIndex() {
|
|
1669
|
+
return this.zIndex_;
|
|
1670
|
+
}
|
|
1671
|
+
/**
|
|
1672
|
+
* Set a geometry that is rendered instead of the feature's geometry.
|
|
1673
|
+
*
|
|
1674
|
+
* @param {string|import("../geom/Geometry.js").default|GeometryFunction} geometry
|
|
1675
|
+
* Feature property or geometry or function returning a geometry to render
|
|
1676
|
+
* for this style.
|
|
1677
|
+
* @api
|
|
1678
|
+
*/
|
|
1679
|
+
setGeometry(e) {
|
|
1680
|
+
typeof e == "function" ? this.geometryFunction_ = e : typeof e == "string" ? this.geometryFunction_ = function(t) {
|
|
1681
|
+
return (
|
|
1682
|
+
/** @type {import("../geom/Geometry.js").default} */
|
|
1683
|
+
t.get(e)
|
|
1684
|
+
);
|
|
1685
|
+
} : e ? e !== void 0 && (this.geometryFunction_ = function() {
|
|
1686
|
+
return (
|
|
1687
|
+
/** @type {import("../geom/Geometry.js").default} */
|
|
1688
|
+
e
|
|
1689
|
+
);
|
|
1690
|
+
}) : this.geometryFunction_ = K, this.geometry_ = e;
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* Set the z-index.
|
|
1694
|
+
*
|
|
1695
|
+
* @param {number|undefined} zIndex ZIndex.
|
|
1696
|
+
* @api
|
|
1697
|
+
*/
|
|
1698
|
+
setZIndex(e) {
|
|
1699
|
+
this.zIndex_ = e;
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
function $e(i) {
|
|
1703
|
+
let e;
|
|
1704
|
+
if (typeof i == "function")
|
|
1705
|
+
e = i;
|
|
1706
|
+
else {
|
|
1707
|
+
let t;
|
|
1708
|
+
Array.isArray(i) ? t = i : (w(typeof /** @type {?} */
|
|
1709
|
+
i.getZIndex == "function", 41), t = [
|
|
1710
|
+
/** @type {Style} */
|
|
1711
|
+
i
|
|
1712
|
+
]), e = function() {
|
|
1713
|
+
return t;
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1716
|
+
return e;
|
|
1717
|
+
}
|
|
1718
|
+
let W = null;
|
|
1719
|
+
function Qe(i, e) {
|
|
1720
|
+
if (!W) {
|
|
1721
|
+
const t = new C({
|
|
1722
|
+
color: "rgba(255,255,255,0.4)"
|
|
1723
|
+
}), n = new A({
|
|
1724
|
+
color: "#3399CC",
|
|
1725
|
+
width: 1.25
|
|
1726
|
+
});
|
|
1727
|
+
W = [
|
|
1728
|
+
new S({
|
|
1729
|
+
image: new R({
|
|
1730
|
+
fill: t,
|
|
1731
|
+
stroke: n,
|
|
1732
|
+
radius: 5
|
|
1733
|
+
}),
|
|
1734
|
+
fill: t,
|
|
1735
|
+
stroke: n
|
|
1736
|
+
})
|
|
1737
|
+
];
|
|
1738
|
+
}
|
|
1739
|
+
return W;
|
|
1740
|
+
}
|
|
1741
|
+
function et() {
|
|
1742
|
+
const i = {}, e = [255, 255, 255, 1], t = [0, 153, 255, 1], n = 3;
|
|
1743
|
+
return i.Polygon = [
|
|
1744
|
+
new S({
|
|
1745
|
+
fill: new C({
|
|
1746
|
+
color: [255, 255, 255, 0.5]
|
|
1747
|
+
})
|
|
1748
|
+
})
|
|
1749
|
+
], i.MultiPolygon = i.Polygon, i.LineString = [
|
|
1750
|
+
new S({
|
|
1751
|
+
stroke: new A({
|
|
1752
|
+
color: e,
|
|
1753
|
+
width: n + 2
|
|
1754
|
+
})
|
|
1755
|
+
}),
|
|
1756
|
+
new S({
|
|
1757
|
+
stroke: new A({
|
|
1758
|
+
color: t,
|
|
1759
|
+
width: n
|
|
1760
|
+
})
|
|
1761
|
+
})
|
|
1762
|
+
], i.MultiLineString = i.LineString, i.Circle = i.Polygon.concat(i.LineString), i.Point = [
|
|
1763
|
+
new S({
|
|
1764
|
+
image: new R({
|
|
1765
|
+
radius: n * 2,
|
|
1766
|
+
fill: new C({
|
|
1767
|
+
color: t
|
|
1768
|
+
}),
|
|
1769
|
+
stroke: new A({
|
|
1770
|
+
color: e,
|
|
1771
|
+
width: n / 2
|
|
1772
|
+
})
|
|
1773
|
+
}),
|
|
1774
|
+
zIndex: 1 / 0
|
|
1775
|
+
})
|
|
1776
|
+
], i.MultiPoint = i.Point, i.GeometryCollection = i.Polygon.concat(
|
|
1777
|
+
i.LineString,
|
|
1778
|
+
i.Point
|
|
1779
|
+
), i;
|
|
1780
|
+
}
|
|
1781
|
+
function K(i) {
|
|
1782
|
+
return i.getGeometry();
|
|
1783
|
+
}
|
|
1784
|
+
const Le = "#333";
|
|
1785
|
+
class se {
|
|
1786
|
+
/**
|
|
1787
|
+
* @param {Options} [options] Options.
|
|
1788
|
+
*/
|
|
1789
|
+
constructor(e) {
|
|
1790
|
+
e = e || {}, this.font_ = e.font, this.rotation_ = e.rotation, this.rotateWithView_ = e.rotateWithView, this.scale_ = e.scale, this.scaleArray_ = x(e.scale !== void 0 ? e.scale : 1), this.text_ = e.text, this.textAlign_ = e.textAlign, this.justify_ = e.justify, this.repeat_ = e.repeat, this.textBaseline_ = e.textBaseline, this.fill_ = e.fill !== void 0 ? e.fill : new C({ color: Le }), this.maxAngle_ = e.maxAngle !== void 0 ? e.maxAngle : Math.PI / 4, this.placement_ = e.placement !== void 0 ? e.placement : "point", this.overflow_ = !!e.overflow, this.stroke_ = e.stroke !== void 0 ? e.stroke : null, this.offsetX_ = e.offsetX !== void 0 ? e.offsetX : 0, this.offsetY_ = e.offsetY !== void 0 ? e.offsetY : 0, this.backgroundFill_ = e.backgroundFill ? e.backgroundFill : null, this.backgroundStroke_ = e.backgroundStroke ? e.backgroundStroke : null, this.padding_ = e.padding === void 0 ? null : e.padding;
|
|
1791
|
+
}
|
|
1792
|
+
/**
|
|
1793
|
+
* Clones the style.
|
|
1794
|
+
* @return {Text} The cloned style.
|
|
1795
|
+
* @api
|
|
1796
|
+
*/
|
|
1797
|
+
clone() {
|
|
1798
|
+
const e = this.getScale();
|
|
1799
|
+
return new se({
|
|
1800
|
+
font: this.getFont(),
|
|
1801
|
+
placement: this.getPlacement(),
|
|
1802
|
+
repeat: this.getRepeat(),
|
|
1803
|
+
maxAngle: this.getMaxAngle(),
|
|
1804
|
+
overflow: this.getOverflow(),
|
|
1805
|
+
rotation: this.getRotation(),
|
|
1806
|
+
rotateWithView: this.getRotateWithView(),
|
|
1807
|
+
scale: Array.isArray(e) ? e.slice() : e,
|
|
1808
|
+
text: this.getText(),
|
|
1809
|
+
textAlign: this.getTextAlign(),
|
|
1810
|
+
justify: this.getJustify(),
|
|
1811
|
+
textBaseline: this.getTextBaseline(),
|
|
1812
|
+
fill: this.getFill() ? this.getFill().clone() : void 0,
|
|
1813
|
+
stroke: this.getStroke() ? this.getStroke().clone() : void 0,
|
|
1814
|
+
offsetX: this.getOffsetX(),
|
|
1815
|
+
offsetY: this.getOffsetY(),
|
|
1816
|
+
backgroundFill: this.getBackgroundFill() ? this.getBackgroundFill().clone() : void 0,
|
|
1817
|
+
backgroundStroke: this.getBackgroundStroke() ? this.getBackgroundStroke().clone() : void 0,
|
|
1818
|
+
padding: this.getPadding() || void 0
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
/**
|
|
1822
|
+
* Get the `overflow` configuration.
|
|
1823
|
+
* @return {boolean} Let text overflow the length of the path they follow.
|
|
1824
|
+
* @api
|
|
1825
|
+
*/
|
|
1826
|
+
getOverflow() {
|
|
1827
|
+
return this.overflow_;
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* Get the font name.
|
|
1831
|
+
* @return {string|undefined} Font.
|
|
1832
|
+
* @api
|
|
1833
|
+
*/
|
|
1834
|
+
getFont() {
|
|
1835
|
+
return this.font_;
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* Get the maximum angle between adjacent characters.
|
|
1839
|
+
* @return {number} Angle in radians.
|
|
1840
|
+
* @api
|
|
1841
|
+
*/
|
|
1842
|
+
getMaxAngle() {
|
|
1843
|
+
return this.maxAngle_;
|
|
1844
|
+
}
|
|
1845
|
+
/**
|
|
1846
|
+
* Get the label placement.
|
|
1847
|
+
* @return {TextPlacement} Text placement.
|
|
1848
|
+
* @api
|
|
1849
|
+
*/
|
|
1850
|
+
getPlacement() {
|
|
1851
|
+
return this.placement_;
|
|
1852
|
+
}
|
|
1853
|
+
/**
|
|
1854
|
+
* Get the repeat interval of the text.
|
|
1855
|
+
* @return {number|undefined} Repeat interval in pixels.
|
|
1856
|
+
* @api
|
|
1857
|
+
*/
|
|
1858
|
+
getRepeat() {
|
|
1859
|
+
return this.repeat_;
|
|
1860
|
+
}
|
|
1861
|
+
/**
|
|
1862
|
+
* Get the x-offset for the text.
|
|
1863
|
+
* @return {number} Horizontal text offset.
|
|
1864
|
+
* @api
|
|
1865
|
+
*/
|
|
1866
|
+
getOffsetX() {
|
|
1867
|
+
return this.offsetX_;
|
|
1868
|
+
}
|
|
1869
|
+
/**
|
|
1870
|
+
* Get the y-offset for the text.
|
|
1871
|
+
* @return {number} Vertical text offset.
|
|
1872
|
+
* @api
|
|
1873
|
+
*/
|
|
1874
|
+
getOffsetY() {
|
|
1875
|
+
return this.offsetY_;
|
|
1876
|
+
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Get the fill style for the text.
|
|
1879
|
+
* @return {import("./Fill.js").default} Fill style.
|
|
1880
|
+
* @api
|
|
1881
|
+
*/
|
|
1882
|
+
getFill() {
|
|
1883
|
+
return this.fill_;
|
|
1884
|
+
}
|
|
1885
|
+
/**
|
|
1886
|
+
* Determine whether the text rotates with the map.
|
|
1887
|
+
* @return {boolean|undefined} Rotate with map.
|
|
1888
|
+
* @api
|
|
1889
|
+
*/
|
|
1890
|
+
getRotateWithView() {
|
|
1891
|
+
return this.rotateWithView_;
|
|
1892
|
+
}
|
|
1893
|
+
/**
|
|
1894
|
+
* Get the text rotation.
|
|
1895
|
+
* @return {number|undefined} Rotation.
|
|
1896
|
+
* @api
|
|
1897
|
+
*/
|
|
1898
|
+
getRotation() {
|
|
1899
|
+
return this.rotation_;
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* Get the text scale.
|
|
1903
|
+
* @return {number|import("../size.js").Size|undefined} Scale.
|
|
1904
|
+
* @api
|
|
1905
|
+
*/
|
|
1906
|
+
getScale() {
|
|
1907
|
+
return this.scale_;
|
|
1908
|
+
}
|
|
1909
|
+
/**
|
|
1910
|
+
* Get the symbolizer scale array.
|
|
1911
|
+
* @return {import("../size.js").Size} Scale array.
|
|
1912
|
+
*/
|
|
1913
|
+
getScaleArray() {
|
|
1914
|
+
return this.scaleArray_;
|
|
1915
|
+
}
|
|
1916
|
+
/**
|
|
1917
|
+
* Get the stroke style for the text.
|
|
1918
|
+
* @return {import("./Stroke.js").default} Stroke style.
|
|
1919
|
+
* @api
|
|
1920
|
+
*/
|
|
1921
|
+
getStroke() {
|
|
1922
|
+
return this.stroke_;
|
|
1923
|
+
}
|
|
1924
|
+
/**
|
|
1925
|
+
* Get the text to be rendered.
|
|
1926
|
+
* @return {string|Array<string>|undefined} Text.
|
|
1927
|
+
* @api
|
|
1928
|
+
*/
|
|
1929
|
+
getText() {
|
|
1930
|
+
return this.text_;
|
|
1931
|
+
}
|
|
1932
|
+
/**
|
|
1933
|
+
* Get the text alignment.
|
|
1934
|
+
* @return {CanvasTextAlign|undefined} Text align.
|
|
1935
|
+
* @api
|
|
1936
|
+
*/
|
|
1937
|
+
getTextAlign() {
|
|
1938
|
+
return this.textAlign_;
|
|
1939
|
+
}
|
|
1940
|
+
/**
|
|
1941
|
+
* Get the justification.
|
|
1942
|
+
* @return {TextJustify|undefined} Justification.
|
|
1943
|
+
* @api
|
|
1944
|
+
*/
|
|
1945
|
+
getJustify() {
|
|
1946
|
+
return this.justify_;
|
|
1947
|
+
}
|
|
1948
|
+
/**
|
|
1949
|
+
* Get the text baseline.
|
|
1950
|
+
* @return {CanvasTextBaseline|undefined} Text baseline.
|
|
1951
|
+
* @api
|
|
1952
|
+
*/
|
|
1953
|
+
getTextBaseline() {
|
|
1954
|
+
return this.textBaseline_;
|
|
1955
|
+
}
|
|
1956
|
+
/**
|
|
1957
|
+
* Get the background fill style for the text.
|
|
1958
|
+
* @return {import("./Fill.js").default} Fill style.
|
|
1959
|
+
* @api
|
|
1960
|
+
*/
|
|
1961
|
+
getBackgroundFill() {
|
|
1962
|
+
return this.backgroundFill_;
|
|
1963
|
+
}
|
|
1964
|
+
/**
|
|
1965
|
+
* Get the background stroke style for the text.
|
|
1966
|
+
* @return {import("./Stroke.js").default} Stroke style.
|
|
1967
|
+
* @api
|
|
1968
|
+
*/
|
|
1969
|
+
getBackgroundStroke() {
|
|
1970
|
+
return this.backgroundStroke_;
|
|
1971
|
+
}
|
|
1972
|
+
/**
|
|
1973
|
+
* Get the padding for the text.
|
|
1974
|
+
* @return {Array<number>|null} Padding.
|
|
1975
|
+
* @api
|
|
1976
|
+
*/
|
|
1977
|
+
getPadding() {
|
|
1978
|
+
return this.padding_;
|
|
1979
|
+
}
|
|
1980
|
+
/**
|
|
1981
|
+
* Set the `overflow` property.
|
|
1982
|
+
*
|
|
1983
|
+
* @param {boolean} overflow Let text overflow the path that it follows.
|
|
1984
|
+
* @api
|
|
1985
|
+
*/
|
|
1986
|
+
setOverflow(e) {
|
|
1987
|
+
this.overflow_ = e;
|
|
1988
|
+
}
|
|
1989
|
+
/**
|
|
1990
|
+
* Set the font.
|
|
1991
|
+
*
|
|
1992
|
+
* @param {string|undefined} font Font.
|
|
1993
|
+
* @api
|
|
1994
|
+
*/
|
|
1995
|
+
setFont(e) {
|
|
1996
|
+
this.font_ = e;
|
|
1997
|
+
}
|
|
1998
|
+
/**
|
|
1999
|
+
* Set the maximum angle between adjacent characters.
|
|
2000
|
+
*
|
|
2001
|
+
* @param {number} maxAngle Angle in radians.
|
|
2002
|
+
* @api
|
|
2003
|
+
*/
|
|
2004
|
+
setMaxAngle(e) {
|
|
2005
|
+
this.maxAngle_ = e;
|
|
2006
|
+
}
|
|
2007
|
+
/**
|
|
2008
|
+
* Set the x offset.
|
|
2009
|
+
*
|
|
2010
|
+
* @param {number} offsetX Horizontal text offset.
|
|
2011
|
+
* @api
|
|
2012
|
+
*/
|
|
2013
|
+
setOffsetX(e) {
|
|
2014
|
+
this.offsetX_ = e;
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Set the y offset.
|
|
2018
|
+
*
|
|
2019
|
+
* @param {number} offsetY Vertical text offset.
|
|
2020
|
+
* @api
|
|
2021
|
+
*/
|
|
2022
|
+
setOffsetY(e) {
|
|
2023
|
+
this.offsetY_ = e;
|
|
2024
|
+
}
|
|
2025
|
+
/**
|
|
2026
|
+
* Set the text placement.
|
|
2027
|
+
*
|
|
2028
|
+
* @param {TextPlacement} placement Placement.
|
|
2029
|
+
* @api
|
|
2030
|
+
*/
|
|
2031
|
+
setPlacement(e) {
|
|
2032
|
+
this.placement_ = e;
|
|
2033
|
+
}
|
|
2034
|
+
/**
|
|
2035
|
+
* Set the repeat interval of the text.
|
|
2036
|
+
* @param {number|undefined} [repeat] Repeat interval in pixels.
|
|
2037
|
+
* @api
|
|
2038
|
+
*/
|
|
2039
|
+
setRepeat(e) {
|
|
2040
|
+
this.repeat_ = e;
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* Set whether to rotate the text with the view.
|
|
2044
|
+
*
|
|
2045
|
+
* @param {boolean} rotateWithView Rotate with map.
|
|
2046
|
+
* @api
|
|
2047
|
+
*/
|
|
2048
|
+
setRotateWithView(e) {
|
|
2049
|
+
this.rotateWithView_ = e;
|
|
2050
|
+
}
|
|
2051
|
+
/**
|
|
2052
|
+
* Set the fill.
|
|
2053
|
+
*
|
|
2054
|
+
* @param {import("./Fill.js").default} fill Fill style.
|
|
2055
|
+
* @api
|
|
2056
|
+
*/
|
|
2057
|
+
setFill(e) {
|
|
2058
|
+
this.fill_ = e;
|
|
2059
|
+
}
|
|
2060
|
+
/**
|
|
2061
|
+
* Set the rotation.
|
|
2062
|
+
*
|
|
2063
|
+
* @param {number|undefined} rotation Rotation.
|
|
2064
|
+
* @api
|
|
2065
|
+
*/
|
|
2066
|
+
setRotation(e) {
|
|
2067
|
+
this.rotation_ = e;
|
|
2068
|
+
}
|
|
2069
|
+
/**
|
|
2070
|
+
* Set the scale.
|
|
2071
|
+
*
|
|
2072
|
+
* @param {number|import("../size.js").Size|undefined} scale Scale.
|
|
2073
|
+
* @api
|
|
2074
|
+
*/
|
|
2075
|
+
setScale(e) {
|
|
2076
|
+
this.scale_ = e, this.scaleArray_ = x(e !== void 0 ? e : 1);
|
|
2077
|
+
}
|
|
2078
|
+
/**
|
|
2079
|
+
* Set the stroke.
|
|
2080
|
+
*
|
|
2081
|
+
* @param {import("./Stroke.js").default} stroke Stroke style.
|
|
2082
|
+
* @api
|
|
2083
|
+
*/
|
|
2084
|
+
setStroke(e) {
|
|
2085
|
+
this.stroke_ = e;
|
|
2086
|
+
}
|
|
2087
|
+
/**
|
|
2088
|
+
* Set the text.
|
|
2089
|
+
*
|
|
2090
|
+
* @param {string|Array<string>|undefined} text Text.
|
|
2091
|
+
* @api
|
|
2092
|
+
*/
|
|
2093
|
+
setText(e) {
|
|
2094
|
+
this.text_ = e;
|
|
2095
|
+
}
|
|
2096
|
+
/**
|
|
2097
|
+
* Set the text alignment.
|
|
2098
|
+
*
|
|
2099
|
+
* @param {CanvasTextAlign|undefined} textAlign Text align.
|
|
2100
|
+
* @api
|
|
2101
|
+
*/
|
|
2102
|
+
setTextAlign(e) {
|
|
2103
|
+
this.textAlign_ = e;
|
|
2104
|
+
}
|
|
2105
|
+
/**
|
|
2106
|
+
* Set the justification.
|
|
2107
|
+
*
|
|
2108
|
+
* @param {TextJustify|undefined} justify Justification.
|
|
2109
|
+
* @api
|
|
2110
|
+
*/
|
|
2111
|
+
setJustify(e) {
|
|
2112
|
+
this.justify_ = e;
|
|
2113
|
+
}
|
|
2114
|
+
/**
|
|
2115
|
+
* Set the text baseline.
|
|
2116
|
+
*
|
|
2117
|
+
* @param {CanvasTextBaseline|undefined} textBaseline Text baseline.
|
|
2118
|
+
* @api
|
|
2119
|
+
*/
|
|
2120
|
+
setTextBaseline(e) {
|
|
2121
|
+
this.textBaseline_ = e;
|
|
2122
|
+
}
|
|
2123
|
+
/**
|
|
2124
|
+
* Set the background fill.
|
|
2125
|
+
*
|
|
2126
|
+
* @param {import("./Fill.js").default} fill Fill style.
|
|
2127
|
+
* @api
|
|
2128
|
+
*/
|
|
2129
|
+
setBackgroundFill(e) {
|
|
2130
|
+
this.backgroundFill_ = e;
|
|
2131
|
+
}
|
|
2132
|
+
/**
|
|
2133
|
+
* Set the background stroke.
|
|
2134
|
+
*
|
|
2135
|
+
* @param {import("./Stroke.js").default} stroke Stroke style.
|
|
2136
|
+
* @api
|
|
2137
|
+
*/
|
|
2138
|
+
setBackgroundStroke(e) {
|
|
2139
|
+
this.backgroundStroke_ = e;
|
|
2140
|
+
}
|
|
2141
|
+
/**
|
|
2142
|
+
* Set the padding (`[top, right, bottom, left]`).
|
|
2143
|
+
*
|
|
2144
|
+
* @param {Array<number>|null} padding Padding.
|
|
2145
|
+
* @api
|
|
2146
|
+
*/
|
|
2147
|
+
setPadding(e) {
|
|
2148
|
+
this.padding_ = e;
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
export {
|
|
2152
|
+
Me as A,
|
|
2153
|
+
Re as B,
|
|
2154
|
+
R as C,
|
|
2155
|
+
Te as D,
|
|
2156
|
+
Pe as E,
|
|
2157
|
+
C as F,
|
|
2158
|
+
Ve as G,
|
|
2159
|
+
be as H,
|
|
2160
|
+
ie as I,
|
|
2161
|
+
Ee as J,
|
|
2162
|
+
We as K,
|
|
2163
|
+
Ie as L,
|
|
2164
|
+
Y as M,
|
|
2165
|
+
y as N,
|
|
2166
|
+
Fe as O,
|
|
2167
|
+
He as P,
|
|
2168
|
+
V as R,
|
|
2169
|
+
S,
|
|
2170
|
+
se as T,
|
|
2171
|
+
A as a,
|
|
2172
|
+
_ as b,
|
|
2173
|
+
Qe as c,
|
|
2174
|
+
L as d,
|
|
2175
|
+
et as e,
|
|
2176
|
+
x as f,
|
|
2177
|
+
ee as g,
|
|
2178
|
+
p as h,
|
|
2179
|
+
q as i,
|
|
2180
|
+
Ce as j,
|
|
2181
|
+
Je as k,
|
|
2182
|
+
Xe as l,
|
|
2183
|
+
Ue as m,
|
|
2184
|
+
Z as n,
|
|
2185
|
+
ke as o,
|
|
2186
|
+
Ae as p,
|
|
2187
|
+
pe as q,
|
|
2188
|
+
Ye as r,
|
|
2189
|
+
Be as s,
|
|
2190
|
+
$e as t,
|
|
2191
|
+
Ge as u,
|
|
2192
|
+
Ne as v,
|
|
2193
|
+
qe as w,
|
|
2194
|
+
Ke as x,
|
|
2195
|
+
je as y,
|
|
2196
|
+
Ze as z
|
|
2197
|
+
};
|