123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393 |
- import {
- c as c2,
- o
- } from "./chunk-4O76IJGT.js";
- import "./chunk-42RTSVHV.js";
- import "./chunk-T5IRDDBF.js";
- import {
- O,
- T,
- W,
- ie,
- me,
- oe,
- s
- } from "./chunk-67RFR4NT.js";
- import "./chunk-WPDBODJM.js";
- import "./chunk-5IVP3KUS.js";
- import "./chunk-UCPKJYXN.js";
- import "./chunk-KFLNKWNF.js";
- import "./chunk-YQBYWPBD.js";
- import "./chunk-UO3LS2M5.js";
- import "./chunk-QISOH77W.js";
- import "./chunk-XO5VJRK4.js";
- import "./chunk-27YO3FKC.js";
- import "./chunk-UMUHMVL4.js";
- import {
- h
- } from "./chunk-DX5KJRJR.js";
- import {
- t as t2
- } from "./chunk-K3NLQPKD.js";
- import {
- m
- } from "./chunk-I26BWYY3.js";
- import "./chunk-NDUYF7XW.js";
- import "./chunk-JEA4MMTV.js";
- import "./chunk-RG3AHHRL.js";
- import {
- G,
- c,
- r,
- t
- } from "./chunk-XHRNCFJT.js";
- import "./chunk-UDYHZLTE.js";
- import "./chunk-E3G7BRZB.js";
- import "./chunk-OKUFE7TO.js";
- import "./chunk-GZBNC76D.js";
- import {
- p
- } from "./chunk-3Z755LKF.js";
- import "./chunk-LTZ5XXDV.js";
- import "./chunk-DLMAGHHC.js";
- import "./chunk-JOYXMSKE.js";
- import "./chunk-ECY35CJI.js";
- import "./chunk-PT62335L.js";
- import "./chunk-MCWCB5IY.js";
- import "./chunk-4ONPMX2F.js";
- import "./chunk-CRGY2SDS.js";
- import "./chunk-4T5ZGMEN.js";
- import "./chunk-3OSQ6GXO.js";
- import "./chunk-3WQOA5CB.js";
- import "./chunk-FZQZIM7U.js";
- import "./chunk-CZBRZ6SU.js";
- import "./chunk-VGWC3IKZ.js";
- import "./chunk-2H5MD622.js";
- import {
- e,
- u
- } from "./chunk-UVVU4UUO.js";
- import {
- l
- } from "./chunk-X4SA4ELJ.js";
- import "./chunk-5N7JLUJJ.js";
- import "./chunk-ZAY3CMAZ.js";
- import "./chunk-P3XKUGLS.js";
- import "./chunk-2ZSOO377.js";
- import "./chunk-LU5IJZB4.js";
- import "./chunk-7IBV2TRE.js";
- import "./chunk-ZLNEXZAN.js";
- import "./chunk-5UVJ64RB.js";
- import "./chunk-SFEFRQCL.js";
- import "./chunk-ZYRIJWLX.js";
- import "./chunk-RYY6632W.js";
- import "./chunk-DW42UVIT.js";
- import "./chunk-YAEIHDJH.js";
- import "./chunk-TJNOJH33.js";
- import "./chunk-OSHI574D.js";
- import "./chunk-ETGAZ7LF.js";
- import "./chunk-75U5LM2V.js";
- import "./chunk-RMDDCMKS.js";
- import "./chunk-VCH45Q2I.js";
- import "./chunk-LBW34VZ2.js";
- import "./chunk-GSSTTHIT.js";
- import "./chunk-YFSLJIO4.js";
- import "./chunk-IM3LVQXV.js";
- import "./chunk-55RWC67C.js";
- import "./chunk-HZRKBTHJ.js";
- import {
- U
- } from "./chunk-DVUG3KID.js";
- import "./chunk-FWSQEIAR.js";
- import "./chunk-VEGAOVMY.js";
- import "./chunk-6T6G6LCQ.js";
- import "./chunk-YEJL5NEF.js";
- import "./chunk-PQFTYGF5.js";
- import "./chunk-2Z2TG5CU.js";
- import "./chunk-6KZ2LTDA.js";
- import "./chunk-U2XHEJM7.js";
- import "./chunk-SQOPWYIT.js";
- import {
- f as f2
- } from "./chunk-V6P2MAQQ.js";
- import "./chunk-E5O6P5I2.js";
- import "./chunk-SPWQ3AWG.js";
- import "./chunk-2TIUKVZN.js";
- import {
- f
- } from "./chunk-YXWMMD76.js";
- import "./chunk-S5KM4IGW.js";
- // node_modules/@arcgis/core/symbols/cim/CIMSymbolRasterizer.js
- var M;
- !function(e2) {
- e2.Legend = "legend", e2.Preview = "preview";
- }(M || (M = {}));
- var _ = (e2) => e2 && e2.scaleFactor ? e2.scaleFactor : 1;
- var v = 96 / 72;
- var z = class {
- constructor(e2, t3) {
- this._spatialReference = e2, this._avoidSDF = t3, this._resourceCache = /* @__PURE__ */ new Map(), this._imageDataCanvas = null, this._pictureMarkerCache = /* @__PURE__ */ new Map(), this._textRasterizer = new s(), this._cimResourceManager = new o(), this._rasterizer = new c2(this._cimResourceManager);
- }
- get resourceManager() {
- return this._cimResourceManager;
- }
- async rasterizeCIMSymbolAsync(e2, t3, a, i, r2, s2, o2, n) {
- if (!e2)
- return null;
- const { data: g } = e2;
- if (!g || "CIMSymbolReference" !== g.type || !g.symbol)
- return null;
- const { symbol: u3 } = g;
- s2 || (s2 = G(u3));
- const d2 = await ie.resolveSymbolOverrides(g, t3, this._spatialReference, r2, s2, o2, n);
- this._imageDataCanvas || (this._imageDataCanvas = document.createElement("canvas"));
- const p2 = this._imageDataCanvas, y2 = this._cimResourceManager, w = [];
- oe.fetchResources(d2, y2, w), w.length > 0 && await Promise.all(w);
- const { width: C, height: M2 } = a, _2 = I(s2, C, M2, i), z2 = oe.getEnvelope(d2, _2, y2);
- if (!z2)
- return null;
- const x2 = (window.devicePixelRatio || 1) * v;
- let R = 1, b = 0, P = 0;
- switch (u3.type) {
- case "CIMPointSymbol":
- case "CIMTextSymbol":
- {
- let e3 = 1;
- z2.width > C && (e3 = C / z2.width);
- let t4 = 1;
- z2.height > M2 && (t4 = M2 / z2.height), "preview" === i && (z2.width < C && (e3 = C / z2.width), z2.height < M2 && (t4 = M2 / z2.height)), R = Math.min(e3, t4), b = z2.x + z2.width / 2, P = z2.y + z2.height / 2;
- }
- break;
- case "CIMLineSymbol":
- {
- let e3 = 1;
- z2.height > M2 && (e3 = M2 / z2.height), R = e3, P = z2.y + z2.height / 2;
- const t4 = z2.x * R + C / 2, a2 = (z2.x + z2.width) * R + C / 2;
- if (t4 < 0) {
- const { paths: e4 } = _2;
- e4[0][0][0] -= t4;
- }
- if (a2 > C) {
- const { paths: e4 } = _2;
- e4[0][2][0] -= a2 - C;
- }
- }
- break;
- case "CIMPolygonSymbol": {
- b = z2.x + z2.width / 2, P = z2.y + z2.height / 2;
- const e3 = z2.x * R + C / 2, t4 = (z2.x + z2.width) * R + C / 2, a2 = z2.y * R + M2 / 2, i2 = (z2.y + z2.height) * R + M2 / 2, { rings: r3 } = _2;
- e3 < 0 && (r3[0][0][0] -= e3, r3[0][3][0] -= e3, r3[0][4][0] -= e3), a2 < 0 && (r3[0][0][1] += a2, r3[0][1][1] += a2, r3[0][4][1] += a2), t4 > C && (r3[0][1][0] -= t4 - C, r3[0][2][0] -= t4 - C), i2 > M2 && (r3[0][2][1] += i2 - M2, r3[0][3][1] += i2 - M2);
- }
- }
- p2.width = C * x2, p2.height = M2 * x2;
- const D = 1;
- p2.width += 2 * D, p2.height += 2 * D;
- const S = p2.getContext("2d"), k = O.createIdentity();
- k.translate(-b, -P), k.scale(R * x2, -R * x2), k.translate(C * x2 / 2 + D, M2 * x2 / 2 + D), S.clearRect(0, 0, p2.width, p2.height);
- return new W(S, y2, k, true).drawSymbol(d2, _2), S.getImageData(0, 0, p2.width, p2.height);
- }
- async analyzeCIMSymbol(e2, t3, a, r2, o2) {
- const n = [], c4 = t3 ? { geometryType: r2, spatialReference: this._spatialReference, fields: t3 } : null;
- let h3;
- await T(e2.data, c4, this._cimResourceManager, n, this._avoidSDF), f2(o2);
- for (const i of n)
- "CIMPictureMarker" !== i.cim.type && "CIMPictureFill" !== i.cim.type && "CIMPictureStroke" !== i.cim.type || (h3 || (h3 = []), h3.push(this._fetchPictureMarkerResource(i, o2))), a && "text" === i.type && "string" == typeof i.text && i.text.includes("[") && (i.text = c(a, i.text, i.cim.textCase));
- return h3 && await Promise.all(h3), n;
- }
- rasterizeCIMSymbol3D(e2, t3, a, i, r2, s2) {
- const o2 = [];
- for (const n of e2) {
- i && "function" == typeof i.scaleFactor && (i.scaleFactor = i.scaleFactor(t3, r2, s2));
- const e3 = this._getRasterizedResource(n, t3, a, i, r2, s2);
- if (!e3)
- continue;
- let c4 = 0, h3 = e3.anchorX || 0, l2 = e3.anchorY || 0, m3 = false, g = 0, u3 = 0;
- if ("esriGeometryPoint" === a) {
- const e4 = _(i);
- if (g = t(n.offsetX, t3, r2, s2) * e4 || 0, u3 = t(n.offsetY, t3, r2, s2) * e4 || 0, "marker" === n.type)
- c4 = t(n.rotation, t3, r2, s2) || 0, m3 = !!n.rotateClockwise && n.rotateClockwise;
- else if ("text" === n.type) {
- if (c4 = t(n.angle, t3, r2, s2) || 0, void 0 !== n.horizontalAlignment)
- switch (n.horizontalAlignment) {
- case "left":
- h3 = -0.5;
- break;
- case "right":
- h3 = 0.5;
- break;
- default:
- h3 = 0;
- }
- if (void 0 !== n.verticalAlignment)
- switch (n.verticalAlignment) {
- case "top":
- l2 = 0.5;
- break;
- case "bottom":
- l2 = -0.5;
- break;
- case "baseline":
- l2 = -0.25;
- break;
- default:
- l2 = 0;
- }
- }
- }
- null != e3 && o2.push({ angle: c4, rotateClockWise: m3, anchorX: h3, anchorY: l2, offsetX: g, offsetY: u3, rasterizedResource: e3 });
- }
- return this.getSymbolImage(o2);
- }
- getSymbolImage(e2) {
- const t3 = document.createElement("canvas"), i = f(t3.getContext("2d"));
- let s2 = 0, o2 = 0, n = 0, c4 = 0;
- const h3 = [];
- for (let a = 0; a < e2.length; a++) {
- const t4 = e2[a], l3 = t4.rasterizedResource;
- if (!l3)
- continue;
- const m4 = l3.size, g2 = t4.offsetX, u3 = t4.offsetY, f4 = t4.anchorX, d2 = t4.anchorY, p2 = t4.rotateClockWise || false;
- let y2 = t4.angle, w = u(g2) - m4[0] * (0.5 + f4), C = u(u3) - m4[1] * (0.5 + d2), M2 = w + m4[0], _2 = C + m4[1];
- if (y2) {
- p2 && (y2 = -y2);
- const e3 = Math.sin(y2 * Math.PI / 180), t5 = Math.cos(y2 * Math.PI / 180), a2 = w * t5 - C * e3, i2 = w * e3 + C * t5, r2 = w * t5 - _2 * e3, s3 = w * e3 + _2 * t5, o3 = M2 * t5 - _2 * e3, n2 = M2 * e3 + _2 * t5, c5 = M2 * t5 - C * e3, h4 = M2 * e3 + C * t5;
- w = Math.min(a2, r2, o3, c5), C = Math.min(i2, s3, n2, h4), M2 = Math.max(a2, r2, o3, c5), _2 = Math.max(i2, s3, n2, h4);
- }
- s2 = w < s2 ? w : s2, o2 = C < o2 ? C : o2, n = M2 > n ? M2 : n, c4 = _2 > c4 ? _2 : c4;
- const v2 = i.createImageData(l3.size[0], l3.size[1]);
- v2.data.set(new Uint8ClampedArray(l3.image.buffer));
- const z2 = { offsetX: g2, offsetY: u3, rotateClockwise: p2, angle: y2, rasterizedImage: v2, anchorX: f4, anchorY: d2 };
- h3.push(z2);
- }
- t3.width = n - s2, t3.height = c4 - o2;
- const l2 = -s2, m3 = c4;
- for (let a = 0; a < h3.length; a++) {
- const e3 = h3[a], t4 = this._imageDataToCanvas(e3.rasterizedImage), s3 = e3.rasterizedImage.width, o3 = e3.rasterizedImage.height, n2 = l2 - s3 * (0.5 + e3.anchorX), c5 = m3 - o3 * (0.5 - e3.anchorY);
- if (e3.angle) {
- const a2 = (360 - e3.angle) * Math.PI / 180;
- i.save(), i.translate(u(e3.offsetX), -u(e3.offsetY)), i.translate(l2, m3), i.rotate(a2), i.translate(-l2, -m3), i.drawImage(t4, n2, c5), i.restore();
- } else
- i.drawImage(t4, n2 + u(e3.offsetX), c5 - u(e3.offsetY));
- }
- const g = new p({ x: l2 / t3.width - 0.5, y: m3 / t3.height - 0.5 });
- return { imageData: 0 !== t3.width && 0 !== t3.height ? i.getImageData(0, 0, t3.width, t3.height) : i.createImageData(1, 1), anchorPosition: g };
- }
- async _fetchPictureMarkerResource(e2, a) {
- const i = e2.materialHash;
- if (!this._pictureMarkerCache.get(i)) {
- const r2 = (await U(e2.cim.url, { responseType: "image", signal: a && a.signal })).data;
- this._pictureMarkerCache.set(i, r2);
- }
- }
- _imageDataToCanvas(e2) {
- this._imageDataCanvas || (this._imageDataCanvas = document.createElement("canvas"));
- const t3 = this._imageDataCanvas, i = f(t3.getContext("2d"));
- return t3.width = e2.width, t3.height = e2.height, i.putImageData(e2, 0, 0), t3;
- }
- _imageTo32Array(t3, i, r2, s2) {
- this._imageDataCanvas || (this._imageDataCanvas = document.createElement("canvas"));
- const o2 = this._imageDataCanvas, n = f(o2.getContext("2d"));
- if (o2.width = i, o2.height = r2, n.drawImage(t3, 0, 0, i, r2), s2) {
- n.save();
- const a = new l(s2);
- n.fillStyle = a.toHex(), n.globalCompositeOperation = "multiply", n.fillRect(0, 0, i, r2), n.globalCompositeOperation = "destination-atop", n.drawImage(t3, 0, 0, i, r2), n.restore();
- }
- return new Uint32Array(n.getImageData(0, 0, i, r2).data.buffer);
- }
- _getRasterizedResource(e2, t3, i, r2, s2, o2) {
- let n, c4, h3;
- const l2 = null, m3 = null;
- if ("text" === e2.type)
- return this._rasterizeTextResource(e2, t3, r2, s2, o2);
- ({ analyzedCIM: n, hash: c4 } = x(e2, t3, s2, o2));
- const g = _(r2);
- if ("CIMPictureMarker" === e2.cim.type) {
- const i2 = t(e2.size, t3, s2, o2) * g, { image: r3, width: n2, height: c5 } = f(this._getPictureResource(e2, i2, t(e2.color, t3, s2, o2)));
- return h3 = { image: r3, size: [n2, c5], sdf: false, simplePattern: false, anchorX: e2.anchorPoint ? e2.anchorPoint.x : 0, anchorY: e2.anchorPoint ? e2.anchorPoint.y : 0 }, h3;
- }
- m(n, g, { preserveOutlineWidth: false });
- const u3 = n;
- c4 += i, r2 && (c4 += JSON.stringify(r2));
- const f4 = this._resourceCache;
- return f4.has(c4) ? f4.get(c4) : (h3 = this._rasterizer.rasterizeJSONResource({ cim: u3, type: e2.type, url: e2.url, mosaicHash: c4, size: l2, path: m3 }, window.devicePixelRatio || 1, this._avoidSDF), f4.set(c4, h3), h3);
- }
- _rasterizeTextResource(e2, t3, a, i, r2) {
- const s2 = _(a), o2 = t(e2.text, t3, i, r2);
- if (!o2 || 0 === o2.length)
- return null;
- const n = t(e2.fontName, t3, i, r2), c4 = t(e2.style, t3, i, r2), h3 = t(e2.weight, t3, i, r2), l2 = t(e2.decoration, t3, i, r2), m3 = t(e2.size, t3, i, r2) * s2, g = t(e2.horizontalAlignment, t3, i, r2), u3 = t(e2.verticalAlignment, t3, i, r2), f4 = r(t(e2.color, t3, i, r2)), d2 = r(t(e2.outlineColor, t3, i, r2)), w = { color: f4, size: m3, horizontalAlignment: g, verticalAlignment: u3, font: { family: n, style: c4, weight: h3, decoration: l2 }, halo: { size: t(e2.outlineSize, t3, i, r2) || 0, color: d2, style: c4 }, pixelRatio: 1, premultiplyColors: !this._avoidSDF };
- return this._textRasterizer.rasterizeText(o2, w);
- }
- _getPictureResource(e2, t3, a) {
- const i = this._pictureMarkerCache.get(e2.materialHash);
- if (!i)
- return null;
- const s2 = i.height / i.width, o2 = t3 ? s2 > 1 ? u(t3) : u(t3) / s2 : i.width, n = t3 ? s2 > 1 ? u(t3) * s2 : u(t3) : i.height;
- return { image: this._imageTo32Array(i, o2, n, a), width: o2, height: n };
- }
- };
- function I(e2, t3, a, i) {
- const r2 = 1, s2 = -t3 / 2 + r2, o2 = t3 / 2 - r2, n = a / 2 - r2, c4 = -a / 2 + r2;
- switch (e2) {
- case "esriGeometryPoint":
- return { x: 0, y: 0 };
- case "esriGeometryPolyline":
- return { paths: [[[s2, 0], [0, 0], [o2, 0]]] };
- default:
- return "legend" === i ? { rings: [[[s2, n], [o2, 0], [o2, c4], [s2, c4], [s2, n]]] } : { rings: [[[s2, n], [o2, n], [o2, c4], [s2, c4], [s2, n]]] };
- }
- }
- function x(e2, t3, a, i) {
- let r2, s2;
- if ("function" == typeof e2.materialHash) {
- r2 = (0, e2.materialHash)(t3, a, i), s2 = me(e2.cim, e2.materialOverrides);
- } else
- r2 = e2.materialHash, s2 = e2.cim;
- return { analyzedCIM: s2, hash: r2 };
- }
- // node_modules/@arcgis/core/symbols/support/previewCIMSymbol.js
- var h2 = new z(null, true);
- var m2 = e(t2.size);
- var c3 = e(t2.maxSize);
- var u2 = e(t2.lineWidth);
- var f3 = 1;
- function y(e2) {
- const t3 = e2 == null ? void 0 : e2.size;
- if ("number" == typeof t3)
- return { width: t3, height: t3 };
- return { width: null != t3 && "object" == typeof t3 && "width" in t3 ? t3.width : null, height: null != t3 && "object" == typeof t3 && "height" in t3 ? t3.height : null };
- }
- async function d(e2, n = {}) {
- var _a;
- const { node: s2, opacity: d2, symbolConfig: p2 } = n, g = "object" == typeof p2 && "isSquareFill" in p2 && p2.isSquareFill, w = n.cimOptions || n, b = w.geometryType || G((_a = e2 == null ? void 0 : e2.data) == null ? void 0 : _a.symbol), M2 = y(n), { feature: j, fieldMap: v2 } = w;
- if (null == M2.width || null == M2.height) {
- const t3 = await ie.resolveSymbolOverrides(e2.data, j, null, v2, b);
- if (!t3)
- return null;
- (e2 = e2.clone()).data = { type: "CIMSymbolReference", symbol: t3 }, e2.data.primitiveOverrides = null;
- const n2 = [];
- oe.fetchResources(t3, h2.resourceManager, n2), n2.length > 0 && await Promise.all(n2);
- const { width: o2, height: r2 } = oe.getEnvelope(t3, null, h2.resourceManager);
- M2.width = "esriGeometryPolygon" === b ? m2 : "esriGeometryPolyline" === b ? u2 : null != o2 && isFinite(o2) ? Math.min(o2, c3) : m2, M2.height = "esriGeometryPolygon" === b ? m2 : null != r2 && isFinite(r2) ? Math.max(Math.min(r2, c3), f3) : m2;
- }
- const S = await h2.rasterizeCIMSymbolAsync(e2, j, M2, g || "esriGeometryPolygon" !== b ? M.Preview : M.Legend, v2, b);
- if (!S)
- return null;
- const { width: C, height: I2 } = S, P = document.createElement("canvas");
- P.width = C, P.height = I2;
- P.getContext("2d").putImageData(S, 0, 0);
- const x2 = u(M2.width), z2 = u(M2.height), F = new Image(x2, z2);
- F.src = P.toDataURL(), null != d2 && (F.style.opacity = `${d2}`);
- let G2 = F;
- if (null != n.effectView) {
- const e3 = { shape: { type: "image", x: 0, y: 0, width: x2, height: z2, src: F.src }, fill: null, stroke: null, offset: [0, 0] };
- G2 = h([[e3]], [x2, z2], { effectView: n.effectView });
- }
- return s2 && G2 && s2.appendChild(G2), G2;
- }
- export {
- d as previewCIMSymbol
- };
- //# sourceMappingURL=previewCIMSymbol-FM35ROYT.js.map
|