previewSymbol3D-OLUW2YQW.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. import {
  2. j as j2
  3. } from "./chunk-LHFSJ6EZ.js";
  4. import "./chunk-ILP23N26.js";
  5. import {
  6. f,
  7. l as l2
  8. } from "./chunk-AEFA3FTZ.js";
  9. import {
  10. L,
  11. c,
  12. e,
  13. h,
  14. l,
  15. m,
  16. n,
  17. o,
  18. p as p2,
  19. s as s3,
  20. t as t2,
  21. u as u2
  22. } from "./chunk-Z6GWVH7Z.js";
  23. import "./chunk-XBH7TGC2.js";
  24. import "./chunk-K3NA3LQS.js";
  25. import {
  26. d as d2,
  27. g,
  28. k,
  29. w,
  30. x
  31. } from "./chunk-7SW2GQFP.js";
  32. import "./chunk-TRK7CKWP.js";
  33. import {
  34. p,
  35. y
  36. } from "./chunk-EGVIPYN2.js";
  37. import "./chunk-7IKYLNB5.js";
  38. import "./chunk-7256PFPA.js";
  39. import "./chunk-27P5ZSC7.js";
  40. import "./chunk-UPD4MTCL.js";
  41. import {
  42. d,
  43. j
  44. } from "./chunk-EN7YGJWG.js";
  45. import "./chunk-VBNMTM7L.js";
  46. import "./chunk-3D3QEPRE.js";
  47. import "./chunk-JFNNSBWL.js";
  48. import "./chunk-522WBHUO.js";
  49. import "./chunk-WNCU6BFU.js";
  50. import "./chunk-C43UE3Z5.js";
  51. import "./chunk-7XXXCK2A.js";
  52. import "./chunk-7ZIDBK7B.js";
  53. import "./chunk-65BYCSII.js";
  54. import "./chunk-WZQZRKNH.js";
  55. import "./chunk-LRDX4TO7.js";
  56. import "./chunk-6A4U74YA.js";
  57. import "./chunk-GJXW4HL5.js";
  58. import "./chunk-WJW5DUN6.js";
  59. import "./chunk-PJ7ZQ4VD.js";
  60. import "./chunk-WDLTDV2L.js";
  61. import "./chunk-TERAW6FT.js";
  62. import "./chunk-N2663GRX.js";
  63. import {
  64. u
  65. } from "./chunk-WEMIK25H.js";
  66. import "./chunk-JXW4QTJA.js";
  67. import "./chunk-UXF37FQ4.js";
  68. import "./chunk-ZOEK6QHJ.js";
  69. import "./chunk-XNLG7T2T.js";
  70. import "./chunk-IR4PV7VK.js";
  71. import "./chunk-2Z6LERTI.js";
  72. import "./chunk-OWVBLVP3.js";
  73. import "./chunk-AFZ7XSEW.js";
  74. import "./chunk-4NKD334K.js";
  75. import "./chunk-65K7LC56.js";
  76. import "./chunk-ATPLLI5W.js";
  77. import "./chunk-WJ3OEUD3.js";
  78. import {
  79. a
  80. } from "./chunk-MXB2XLKV.js";
  81. import "./chunk-XH7RUGVZ.js";
  82. import "./chunk-TBBTRX4O.js";
  83. import "./chunk-YBSUITLL.js";
  84. import "./chunk-ALDCDSPV.js";
  85. import "./chunk-DT6EAZQ5.js";
  86. import "./chunk-HNOZUNJ4.js";
  87. import "./chunk-VNFRAYHO.js";
  88. import "./chunk-R5IG2D6H.js";
  89. import "./chunk-VBRY5KJM.js";
  90. import "./chunk-PDKDCAAD.js";
  91. import "./chunk-ECW2QABR.js";
  92. import "./chunk-GCDJLKH4.js";
  93. import "./chunk-MRJEICT6.js";
  94. import "./chunk-Y3WMVFTW.js";
  95. import "./chunk-SAS7RONY.js";
  96. import "./chunk-WSRBH7BF.js";
  97. import "./chunk-IHXECKQQ.js";
  98. import {
  99. E
  100. } from "./chunk-ULGDPLM2.js";
  101. import {
  102. s,
  103. s3 as s2
  104. } from "./chunk-EMJ4ZSM2.js";
  105. import "./chunk-IKP3YN53.js";
  106. import {
  107. r,
  108. t
  109. } from "./chunk-GZT4BVFP.js";
  110. import "./chunk-A5ICIBVI.js";
  111. // node_modules/@arcgis/core/symbols/support/previewSymbol3D.js
  112. var O = t2.size;
  113. var C = t2.maxSize;
  114. var I = t2.maxOutlineSize;
  115. var R = t2.lineWidth;
  116. var E2 = t2.tallSymbolWidth;
  117. var Z = s.getLogger("esri.symbols.support.previewSymbol3D");
  118. function q(e2) {
  119. const t3 = e2.outline, s4 = r(e2.material) ? e2.material.color : null, r2 = r(s4) ? s4.toHex() : null;
  120. if (t(t3) || "pattern" in t3 && r(t3.pattern) && t3.pattern.type === "style" && t3.pattern.style === "none")
  121. return e2.type === "fill" && r2 === "#ffffff" ? { color: "#bdc3c7", width: 0.75 } : null;
  122. const a2 = u(t3.size) || 0;
  123. return { color: "rgba(" + (r(t3.color) ? t3.color.toRgba() : "255,255,255,1") + ")", width: Math.min(a2, I), style: "pattern" in t3 && r(t3.pattern) && t3.pattern.type === "style" ? x(t3.pattern.style) : null, join: "butt", cap: "patternCap" in t3 ? t3.patternCap : "butt" };
  124. }
  125. function A(t3, s4) {
  126. const r2 = s4 && s4.resource, a2 = r2 && r2.href;
  127. if (t3.thumbnail && t3.thumbnail.url)
  128. return Promise.resolve(t3.thumbnail.url);
  129. if (a2 && s4.type !== "object")
  130. return Promise.resolve(g(t3, s4));
  131. const o2 = a("esri/images/Legend/legend3dsymboldefault.png");
  132. return t3.styleOrigin && (t3.styleOrigin.styleName || t3.styleOrigin.styleUrl) ? j2(t3.styleOrigin, { portal: t3.styleOrigin.portal }, "webRef").catch((e2) => e2).then((e2) => e2?.thumbnail?.url || o2) : Promise.resolve(o2);
  133. }
  134. function H(e2, r2 = 1) {
  135. const a2 = e2.a, o2 = y(e2), n2 = o2.h, l3 = o2.s / r2, i = 100 - (100 - o2.v) / r2, { r: c2, g: p3, b: h2 } = p({ h: n2, s: l3, v: i });
  136. return [c2, p3, h2, a2];
  137. }
  138. function N(e2) {
  139. return e2.type === "water" ? t(e2.color) ? null : e2.color : t(e2.material) || t(e2.material.color) ? null : e2.material.color;
  140. }
  141. function T(e2, t3 = 0) {
  142. const s4 = N(e2);
  143. if (!s4) {
  144. if (e2.type === "fill")
  145. return null;
  146. const s5 = k.r, r3 = h(s5, t3);
  147. return [r3, r3, r3, 100];
  148. }
  149. const r2 = s4.toRgba();
  150. for (let a2 = 0; a2 < 3; a2++)
  151. r2[a2] = h(r2[a2], t3);
  152. return r2;
  153. }
  154. async function W(t3, s4) {
  155. const r2 = t3.style;
  156. if (r2 === "none")
  157. return null;
  158. return { type: "pattern", x: 0, y: 0, src: await w(a(`esri/symbols/patterns/${r2}.png`), s4.toCss(true)), width: 5, height: 5 };
  159. }
  160. function $(e2) {
  161. return e2.outline ? q(e2) : { color: "rgba(0, 0, 0, 1)", width: 1.5 };
  162. }
  163. function B(e2, t3) {
  164. const s4 = N(e2);
  165. if (!s4)
  166. return null;
  167. let r2 = "rgba(";
  168. return r2 += h(s4.r, t3) + ",", r2 += h(s4.g, t3) + ",", r2 += h(s4.b, t3) + ",", r2 + s4.a + ");";
  169. }
  170. function F(e2, t3) {
  171. const s4 = B(e2, t3);
  172. if (!s4)
  173. return {};
  174. if ("pattern" in e2 && r(e2.pattern) && e2.pattern.type === "style" && e2.pattern.style === "none")
  175. return null;
  176. return { color: s4, width: Math.min(e2.size ? u(e2.size) : 0.75, I), style: "pattern" in e2 && r(e2.pattern) && e2.pattern.type === "style" ? x(e2.pattern.style) : null, cap: "cap" in e2 ? e2.cap : null, join: "join" in e2 ? e2.join === "miter" ? u(2) : e2.join : null };
  177. }
  178. function G(e2, t3, s4) {
  179. const r2 = 0.75 * s4;
  180. return { type: "linear", x1: r2 ? 0.25 * r2 : 0, y1: r2 ? 0.5 * r2 : 0, x2: r2 || 4, y2: r2 ? 0.5 * r2 : 4, colors: [{ color: e2, offset: 0 }, { color: t3, offset: 1 }] };
  181. }
  182. function J(e2) {
  183. const t3 = e2.depth, s4 = e2.height, r2 = e2.width;
  184. return r2 && t3 && s4 && r2 === t3 && r2 < s4;
  185. }
  186. function K(e2, t3, s4) {
  187. const r2 = [];
  188. if (!e2)
  189. return r2;
  190. switch (e2.type) {
  191. case "icon": {
  192. const s5 = 0, a2 = 0, o2 = t3, n2 = t3;
  193. switch (e2.resource && e2.resource.primitive || j) {
  194. case "circle":
  195. r2.push({ shape: { type: "circle", cx: 0, cy: 0, r: 0.5 * t3 }, fill: T(e2, 0), stroke: q(e2) });
  196. break;
  197. case "square":
  198. r2.push({ shape: { type: "path", path: [{ command: "M", values: [s5, n2] }, { command: "L", values: [s5, a2] }, { command: "L", values: [o2, a2] }, { command: "L", values: [o2, n2] }, { command: "Z", values: [] }] }, fill: T(e2, 0), stroke: q(e2) });
  199. break;
  200. case "triangle":
  201. r2.push({ shape: { type: "path", path: [{ command: "M", values: [s5, n2] }, { command: "L", values: [0.5 * o2, a2] }, { command: "L", values: [o2, n2] }, { command: "Z", values: [] }] }, fill: T(e2, 0), stroke: q(e2) });
  202. break;
  203. case "cross":
  204. r2.push({ shape: { type: "path", path: [{ command: "M", values: [0.5 * o2, a2] }, { command: "L", values: [0.5 * o2, n2] }, { command: "M", values: [s5, 0.5 * n2] }, { command: "L", values: [o2, 0.5 * n2] }] }, stroke: $(e2) });
  205. break;
  206. case "x":
  207. r2.push({ shape: { type: "path", path: [{ command: "M", values: [s5, a2] }, { command: "L", values: [o2, n2] }, { command: "M", values: [o2, a2] }, { command: "L", values: [s5, n2] }] }, stroke: $(e2) });
  208. break;
  209. case "kite":
  210. r2.push({ shape: { type: "path", path: [{ command: "M", values: [s5, 0.5 * n2] }, { command: "L", values: [0.5 * o2, a2] }, { command: "L", values: [o2, 0.5 * n2] }, { command: "L", values: [0.5 * o2, n2] }, { command: "Z", values: [] }] }, fill: T(e2, 0), stroke: q(e2) });
  211. }
  212. break;
  213. }
  214. case "object":
  215. switch (e2.resource && e2.resource.primitive || d) {
  216. case "cone": {
  217. const a2 = G(T(e2, 0), T(e2, -0.6), s4 ? E2 : t3), o2 = l(t3, s4);
  218. r2.push({ shape: o2[0], fill: a2 }), r2.push({ shape: o2[1], fill: a2 });
  219. break;
  220. }
  221. case "inverted-cone": {
  222. const s5 = T(e2, 0), a2 = G(s5, T(e2, -0.6), t3), o2 = o(t3);
  223. r2.push({ shape: o2[0], fill: a2 }), r2.push({ shape: o2[1], fill: s5 });
  224. break;
  225. }
  226. case "cube": {
  227. const a2 = n(t3, s4);
  228. r2.push({ shape: a2[0], fill: T(e2, 0) }), r2.push({ shape: a2[1], fill: T(e2, -0.3) }), r2.push({ shape: a2[2], fill: T(e2, -0.5) });
  229. break;
  230. }
  231. case "cylinder": {
  232. const a2 = G(T(e2, 0), T(e2, -0.6), s4 ? E2 : t3), o2 = L(t3, s4);
  233. r2.push({ shape: o2[0], fill: a2 }), r2.push({ shape: o2[1], fill: a2 }), r2.push({ shape: o2[2], fill: T(e2, 0) });
  234. break;
  235. }
  236. case "diamond": {
  237. const s5 = s3(t3);
  238. r2.push({ shape: s5[0], fill: T(e2, -0.3) }), r2.push({ shape: s5[1], fill: T(e2, 0) }), r2.push({ shape: s5[2], fill: T(e2, -0.3) }), r2.push({ shape: s5[3], fill: T(e2, -0.7) });
  239. break;
  240. }
  241. case "sphere": {
  242. const s5 = G(T(e2, 0), T(e2, -0.6));
  243. s5.x1 = 0, s5.y1 = 0, s5.x2 = 0.25 * t3, s5.y2 = 0.25 * t3, r2.push({ shape: { type: "circle", cx: 0, cy: 0, r: 0.5 * t3 }, fill: s5 });
  244. break;
  245. }
  246. case "tetrahedron": {
  247. const s5 = u2(t3);
  248. r2.push({ shape: s5[0], fill: T(e2, -0.3) }), r2.push({ shape: s5[1], fill: T(e2, 0) }), r2.push({ shape: s5[2], fill: T(e2, -0.6) });
  249. break;
  250. }
  251. }
  252. break;
  253. }
  254. return r2;
  255. }
  256. function Q(e2) {
  257. const t3 = typeof e2?.size == "number" ? e2?.size : null;
  258. return t3 ? u(t3) : null;
  259. }
  260. function V(e2) {
  261. return e2.type === "icon" ? "multiply" : "tint";
  262. }
  263. function X(e2, t3) {
  264. const s4 = Q(t3), r2 = t3 && t3.maxSize ? u(t3.maxSize) : null, a2 = t3 && t3.disableUpsampling, o2 = e2.symbolLayers, n2 = [];
  265. let c2 = 0, p3 = 0;
  266. const h2 = o2.getItemAt(o2.length - 1);
  267. let u3;
  268. return h2 && h2.type === "icon" && (u3 = h2.size && u(h2.size)), o2.forEach((o3) => {
  269. if (o3.type !== "icon" && o3.type !== "object")
  270. return;
  271. const l3 = o3.type === "icon" ? o3.size && u(o3.size) : 0, h3 = s4 || l3 ? Math.ceil(Math.min(s4 || l3, r2 || C)) : O;
  272. if (o3 && o3.resource && o3.resource.href) {
  273. const t4 = A(e2, o3).then((e3) => {
  274. const t5 = o3.get("material.color"), s5 = V(o3);
  275. return f(e3, h3, t5, s5, a2);
  276. }).then((e3) => {
  277. const t5 = e3.width, s5 = e3.height;
  278. return c2 = Math.max(c2, t5), p3 = Math.max(p3, s5), [{ shape: { type: "image", x: 0, y: 0, width: t5, height: s5, src: e3.url }, fill: null, stroke: null }];
  279. });
  280. n2.push(t4);
  281. } else {
  282. let e3 = h3;
  283. o3.type === "icon" && u3 && s4 && (e3 = h3 * (l3 / u3));
  284. const r3 = t3?.symbolConfig === "tall" || t3?.symbolConfig?.isTall || o3.type === "object" && J(o3);
  285. c2 = Math.max(c2, r3 ? E2 : e3), p3 = Math.max(p3, e3), n2.push(Promise.resolve(K(o3, e3, r3)));
  286. }
  287. }), E(n2).then((e3) => {
  288. const s5 = [];
  289. return e3.forEach((e4) => {
  290. e4.value ? s5.push(e4.value) : e4.error && Z.warn("error while building swatchInfo!", e4.error);
  291. }), l2(s5, [c2, p3], { node: t3 && t3.node, scale: false, opacity: t3 && t3.opacity });
  292. });
  293. }
  294. function Y(e2, t3) {
  295. const s4 = e2.symbolLayers, r2 = [], a2 = d2(e2), n2 = Q(t3), l3 = (t3 && t3.maxSize ? u(t3.maxSize) : null) || I;
  296. let c2, p3 = 0, h2 = 0;
  297. return s4.forEach((e3, t4) => {
  298. if (!e3)
  299. return;
  300. if (e3.type !== "line" && e3.type !== "path")
  301. return;
  302. const s5 = [];
  303. switch (e3.type) {
  304. case "line": {
  305. const r3 = F(e3, 0);
  306. if (t(r3))
  307. break;
  308. const a3 = r3 && r3.width || 0;
  309. t4 === 0 && (c2 = a3);
  310. const i = Math.min(n2 || a3, l3), u3 = t4 === 0 ? i : n2 ? i * (a3 / c2) : i, m2 = u3 > R / 2 ? 2 * u3 : R;
  311. h2 = Math.max(h2, u3), p3 = Math.max(p3, m2), r3.width = u3, s5.push({ shape: { type: "path", path: [{ command: "M", values: [0, 0.5 * h2] }, { command: "L", values: [p3, 0.5 * h2] }] }, stroke: r3 });
  312. break;
  313. }
  314. case "path": {
  315. const t5 = Math.min(n2 || O, l3), r3 = T(e3, 0), a3 = T(e3, -0.2), o2 = B(e3, -0.4), i = o2 ? { color: o2, width: 1 } : {};
  316. if (e3.profile === "quad") {
  317. const t6 = e3.width, o3 = e3.height, n3 = m(t6 && o3 ? t6 / o3 : 1, o3 === 0, t6 === 0), l4 = { ...i, join: "bevel" };
  318. s5.push({ shape: n3[0], fill: a3, stroke: l4 }), s5.push({ shape: n3[1], fill: a3, stroke: l4 }), s5.push({ shape: n3[2], fill: r3, stroke: l4 });
  319. } else
  320. s5.push({ shape: e.pathSymbol3DLayer[0], fill: a3, stroke: i }), s5.push({ shape: e.pathSymbol3DLayer[1], fill: r3, stroke: i });
  321. h2 = Math.max(h2, t5), p3 = h2;
  322. }
  323. }
  324. r2.push(s5);
  325. }), Promise.resolve(l2(r2, [p3, h2], { node: t3 && t3.node, scale: a2, opacity: t3 && t3.opacity }));
  326. }
  327. async function _(e2, t3) {
  328. const s4 = e2.type === "mesh-3d", r2 = e2.symbolLayers, a2 = Q(t3), l3 = t3 && t3.maxSize ? u(t3.maxSize) : null, c2 = a2 || O, p3 = [];
  329. let h2 = 0, u3 = 0, m2 = false;
  330. for (let i = 0; i < r2.length; i++) {
  331. const e3 = r2.getItemAt(i), t4 = [];
  332. if (s4 && e3.type !== "fill")
  333. continue;
  334. const a3 = e.fill[0];
  335. switch (e3.type) {
  336. case "fill": {
  337. const r3 = q(e3), o2 = Math.min(c2, l3 || C);
  338. h2 = Math.max(h2, o2), u3 = Math.max(u3, o2), m2 = true;
  339. let i2 = T(e3, 0);
  340. const p4 = "pattern" in e3 && e3.pattern, f2 = N(e3);
  341. !s4 && r(p4) && p4.type === "style" && p4.style !== "solid" && f2 && (i2 = await W(p4, f2)), t4.push({ shape: a3, fill: i2, stroke: r3 });
  342. break;
  343. }
  344. case "line": {
  345. const s5 = F(e3, 0);
  346. if (t(s5))
  347. break;
  348. const r3 = { stroke: s5, shape: a3 };
  349. h2 = Math.max(h2, O), u3 = Math.max(u3, O), t4.push(r3);
  350. break;
  351. }
  352. case "extrude": {
  353. const s5 = { join: "round", width: 1, ...F(e3, -0.4) }, r3 = T(e3, 0), a4 = T(e3, -0.2), o2 = Math.min(c2, l3 || C), n2 = c(o2);
  354. s5.width = 1, t4.push({ shape: n2[0], fill: a4, stroke: s5 }), t4.push({ shape: n2[1], fill: a4, stroke: s5 }), t4.push({ shape: n2[2], fill: r3, stroke: s5 });
  355. const i2 = O, p4 = 0.7 * O + 0.5 * o2;
  356. h2 = Math.max(h2, i2), u3 = Math.max(u3, p4);
  357. break;
  358. }
  359. case "water": {
  360. const s5 = N(e3), r3 = H(s5), a4 = H(s5, 2), o2 = H(s5, 3), n2 = p2();
  361. m2 = true, t4.push({ shape: n2[0], fill: r3 }), t4.push({ shape: n2[1], fill: a4 }), t4.push({ shape: n2[2], fill: o2 });
  362. const i2 = Math.min(c2, l3 || C);
  363. h2 = Math.max(h2, i2), u3 = Math.max(u3, i2);
  364. break;
  365. }
  366. }
  367. p3.push(t4);
  368. }
  369. return l2(p3, [h2, u3], { node: t3 && t3.node, scale: m2, opacity: t3 && t3.opacity });
  370. }
  371. function ee(e2, t3) {
  372. if (e2.symbolLayers.length === 0)
  373. return Promise.reject(new s2("symbolPreview: renderPreviewHTML3D", "No symbolLayers in the symbol."));
  374. switch (e2.type) {
  375. case "point-3d":
  376. return X(e2, t3);
  377. case "line-3d":
  378. return Y(e2, t3);
  379. case "polygon-3d":
  380. case "mesh-3d":
  381. return _(e2, t3);
  382. }
  383. return Promise.reject(new s2("symbolPreview: swatchInfo3D", "symbol not supported."));
  384. }
  385. export {
  386. W as getPatternDescriptor,
  387. Q as getSizeFromOptions,
  388. T as getSymbolLayerFill,
  389. ee as previewSymbol3D
  390. };
  391. //# sourceMappingURL=previewSymbol3D-OLUW2YQW.js.map