12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- import {
- a as a2,
- r
- } from "./chunk-54X4RLMR.js";
- import {
- Z,
- ee,
- me,
- t
- } from "./chunk-MWIFVNKP.js";
- import {
- a
- } from "./chunk-TRK7CKWP.js";
- // node_modules/@arcgis/core/symbols/cim/Rasterizer.js
- var o = 512;
- var m = class {
- constructor(e) {
- this._resourceManager = e;
- }
- dispose() {
- this._rasterizationCanvas = null;
- }
- rasterizeJSONResource(s, o2, m2) {
- if (this._rasterizationCanvas || (this._rasterizationCanvas = document.createElement("canvas")), s.type === "simple-fill" || s.type === "esriSFS") {
- const [t2, r2, a3] = ee.rasterizeSimpleFill(this._rasterizationCanvas, s.style, o2);
- return { size: [r2, a3], image: new Uint32Array(t2.buffer), sdf: false, simplePattern: true, anchorX: 0, anchorY: 0 };
- }
- if (s.type === "simple-line" || s.type === "esriSLS" || s.type === "line" && s.dashTemplate) {
- let r2, a3;
- if (s.type === "simple-line" || s.type === "esriSLS")
- switch (r2 = me(s.style, s.cap), s.cap) {
- case "butt":
- a3 = "Butt";
- break;
- case "square":
- a3 = "Square";
- break;
- default:
- a3 = "Round";
- }
- else
- r2 = s.dashTemplate, a3 = s.cim.capStyle;
- const [i, n, o3] = ee.rasterizeSimpleLine(r2, a3);
- return { size: [n, o3], image: new Uint32Array(i.buffer), sdf: true, simplePattern: true, anchorX: 0, anchorY: 0 };
- }
- let l, c, f;
- if (s.type === "simple-marker" || s.type === "esriSMS" || s.type === "line-marker" ? (l = Z.fromSimpleMarker(s), f = r(l)) : s.cim && s.cim.type === "CIMHatchFill" ? (l = Z.fromCIMHatchFill(s.cim), c = new t(l.frame.xmin, -l.frame.ymax, l.frame.xmax - l.frame.xmin, l.frame.ymax - l.frame.ymin)) : s.cim.markerPlacement && s.cim.markerPlacement.type === "CIMMarkerPlacementInsidePolygon" ? (l = Z.fromCIMInsidePolygon(s.cim), c = new t(l.frame.xmin, -l.frame.ymax, l.frame.xmax - l.frame.xmin, l.frame.ymax - l.frame.ymin)) : (l = s.cim, f = r(l)), f && !m2) {
- const [e, t2, r2] = a2(f);
- return e ? { size: [t2, r2], image: new Uint32Array(e.buffer), sdf: true, simplePattern: true, anchorX: 0, anchorY: 0 } : null;
- }
- const [p, h, u, y, d] = Z.rasterize(this._rasterizationCanvas, l, c, this._resourceManager, !m2);
- return p ? { size: [h, u], image: new Uint32Array(p.buffer), sdf: false, simplePattern: false, anchorX: y, anchorY: d } : null;
- }
- rasterizeImageResource(e, t2, r2, a3) {
- this._rasterizationCanvas || (this._rasterizationCanvas = document.createElement("canvas")), this._rasterizationCanvas.width = e, this._rasterizationCanvas.height = t2;
- const i = this._rasterizationCanvas.getContext("2d");
- r2 instanceof ImageData ? i.putImageData(r2, 0, 0) : (r2.setAttribute("width", `${e}px`), r2.setAttribute("height", `${t2}px`), i.drawImage(r2, 0, 0, e, t2));
- const n = i.getImageData(0, 0, e, t2), m2 = new Uint8Array(n.data);
- if (a3) {
- for (const s of a3)
- if (s && s.oldColor && s.oldColor.length === 4 && s.newColor && s.newColor.length === 4) {
- const [e2, t3, r3, a4] = s.oldColor, [i2, n2, o2, l2] = s.newColor;
- if (e2 === i2 && t3 === n2 && r3 === o2 && a4 === l2)
- continue;
- for (let s2 = 0; s2 < m2.length; s2 += 4)
- e2 === m2[s2] && t3 === m2[s2 + 1] && r3 === m2[s2 + 2] && a4 === m2[s2 + 3] && (m2[s2] = i2, m2[s2 + 1] = n2, m2[s2 + 2] = o2, m2[s2 + 3] = l2);
- }
- }
- let l;
- for (let s = 0; s < m2.length; s += 4)
- l = m2[s + 3] / 255, m2[s] = m2[s] * l, m2[s + 1] = m2[s + 1] * l, m2[s + 2] = m2[s + 2] * l;
- let c = m2, f = e, p = t2;
- const h = o;
- if (f >= h || p >= h) {
- const r3 = f / p;
- r3 > 1 ? (f = h, p = Math.round(h / r3)) : (p = h, f = Math.round(h * r3)), c = new Uint8Array(4 * f * p);
- const a4 = new Uint8ClampedArray(c.buffer);
- a(m2, e, t2, a4, f, p, false);
- }
- return { size: [f, p], image: new Uint32Array(c.buffer), sdf: false, simplePattern: false, anchorX: 0, anchorY: 0 };
- }
- };
- export {
- m
- };
- //# sourceMappingURL=chunk-XWA3NEEY.js.map
|