previewSymbol3D-NMNELBZQ.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. import {
  2. h
  3. } from "./chunk-DT4QPJHF.js";
  4. import "./chunk-4HL6BBWO.js";
  5. import {
  6. d as d4,
  7. h as h4
  8. } from "./chunk-DX5KJRJR.js";
  9. import {
  10. L,
  11. c,
  12. e,
  13. h as h3,
  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-K3NLQPKD.js";
  23. import {
  24. d as d2,
  25. d2 as d3,
  26. g,
  27. g2,
  28. h as h2
  29. } from "./chunk-I26BWYY3.js";
  30. import {
  31. p,
  32. y
  33. } from "./chunk-NDUYF7XW.js";
  34. import "./chunk-JEA4MMTV.js";
  35. import "./chunk-RG3AHHRL.js";
  36. import "./chunk-XHRNCFJT.js";
  37. import "./chunk-OKUFE7TO.js";
  38. import "./chunk-GZBNC76D.js";
  39. import "./chunk-RVCE264D.js";
  40. import "./chunk-HKJ7X3BD.js";
  41. import {
  42. d,
  43. j
  44. } from "./chunk-3Z755LKF.js";
  45. import "./chunk-LTZ5XXDV.js";
  46. import "./chunk-DLMAGHHC.js";
  47. import "./chunk-JOYXMSKE.js";
  48. import "./chunk-ECY35CJI.js";
  49. import "./chunk-PT62335L.js";
  50. import "./chunk-MCWCB5IY.js";
  51. import "./chunk-4ONPMX2F.js";
  52. import "./chunk-CRGY2SDS.js";
  53. import "./chunk-4T5ZGMEN.js";
  54. import "./chunk-3OSQ6GXO.js";
  55. import "./chunk-3WQOA5CB.js";
  56. import "./chunk-FZQZIM7U.js";
  57. import "./chunk-CZBRZ6SU.js";
  58. import "./chunk-VGWC3IKZ.js";
  59. import "./chunk-2H5MD622.js";
  60. import {
  61. u
  62. } from "./chunk-UVVU4UUO.js";
  63. import "./chunk-X4SA4ELJ.js";
  64. import "./chunk-5N7JLUJJ.js";
  65. import "./chunk-ZAY3CMAZ.js";
  66. import "./chunk-P3XKUGLS.js";
  67. import "./chunk-2ZSOO377.js";
  68. import "./chunk-LU5IJZB4.js";
  69. import "./chunk-7IBV2TRE.js";
  70. import {
  71. a
  72. } from "./chunk-ZLNEXZAN.js";
  73. import "./chunk-5UVJ64RB.js";
  74. import "./chunk-SFEFRQCL.js";
  75. import "./chunk-ZYRIJWLX.js";
  76. import "./chunk-RYY6632W.js";
  77. import "./chunk-DW42UVIT.js";
  78. import "./chunk-YAEIHDJH.js";
  79. import "./chunk-TJNOJH33.js";
  80. import "./chunk-OSHI574D.js";
  81. import "./chunk-ETGAZ7LF.js";
  82. import "./chunk-75U5LM2V.js";
  83. import "./chunk-RMDDCMKS.js";
  84. import "./chunk-VCH45Q2I.js";
  85. import "./chunk-LBW34VZ2.js";
  86. import "./chunk-GSSTTHIT.js";
  87. import "./chunk-YFSLJIO4.js";
  88. import "./chunk-IM3LVQXV.js";
  89. import "./chunk-55RWC67C.js";
  90. import "./chunk-HZRKBTHJ.js";
  91. import "./chunk-DVUG3KID.js";
  92. import "./chunk-FWSQEIAR.js";
  93. import "./chunk-VEGAOVMY.js";
  94. import "./chunk-6T6G6LCQ.js";
  95. import "./chunk-YEJL5NEF.js";
  96. import "./chunk-PQFTYGF5.js";
  97. import "./chunk-2Z2TG5CU.js";
  98. import "./chunk-6KZ2LTDA.js";
  99. import "./chunk-U2XHEJM7.js";
  100. import "./chunk-SQOPWYIT.js";
  101. import {
  102. E
  103. } from "./chunk-V6P2MAQQ.js";
  104. import {
  105. s2 as s,
  106. s3 as s2
  107. } from "./chunk-E5O6P5I2.js";
  108. import "./chunk-SPWQ3AWG.js";
  109. import "./chunk-2TIUKVZN.js";
  110. import {
  111. f,
  112. r,
  113. t
  114. } from "./chunk-YXWMMD76.js";
  115. import "./chunk-S5KM4IGW.js";
  116. // node_modules/@arcgis/core/symbols/support/previewSymbol3D.js
  117. var C = t2.size;
  118. var I = t2.maxSize;
  119. var R = t2.maxOutlineSize;
  120. var E2 = t2.lineWidth;
  121. var Z = t2.tallSymbolWidth;
  122. function q(e2) {
  123. const t3 = e2.outline, s4 = r(e2.material) ? e2.material.color : null, r2 = r(s4) ? s4.toHex() : null;
  124. if (t(t3) || "pattern" in t3 && r(t3.pattern) && "style" === t3.pattern.type && "none" === t3.pattern.style)
  125. return "fill" === e2.type && "#ffffff" === r2 ? { color: "#bdc3c7", width: 0.75 } : null;
  126. const a2 = u(t3.size) || 0;
  127. return { color: "rgba(" + (r(t3.color) ? t3.color.toRgba() : "255,255,255,1") + ")", width: Math.min(a2, R), style: "pattern" in t3 && r(t3.pattern) && "style" === t3.pattern.type ? d2(t3.pattern.style) : null, join: "butt", cap: "patternCap" in t3 ? t3.patternCap : "butt" };
  128. }
  129. function A(t3, s4) {
  130. const r2 = s4 && s4.resource, a2 = r2 && r2.href;
  131. if (t3.thumbnail && t3.thumbnail.url)
  132. return Promise.resolve(t3.thumbnail.url);
  133. if (a2 && "object" !== s4.type)
  134. return Promise.resolve(g2(t3, s4));
  135. const o2 = a("esri/images/Legend/legend3dsymboldefault.png");
  136. return t3.styleOrigin && (t3.styleOrigin.styleName || t3.styleOrigin.styleUrl) ? h(t3.styleOrigin, { portal: t3.styleOrigin.portal }, "webRef").catch((e2) => e2).then((e2) => {
  137. var _a;
  138. return ((_a = e2 == null ? void 0 : e2.thumbnail) == null ? void 0 : _a.url) || o2;
  139. }) : Promise.resolve(o2);
  140. }
  141. function H(e2, r2 = 1) {
  142. const a2 = e2.a, o2 = y(e2), n2 = o2.h, l2 = o2.s / r2, i = 100 - (100 - o2.v) / r2, { r: c2, g: p3, b: u3 } = p({ h: n2, s: l2, v: i });
  143. return [c2, p3, u3, a2];
  144. }
  145. function N(e2) {
  146. return "water" === e2.type ? t(e2.color) ? null : e2.color : t(e2.material) || t(e2.material.color) ? null : e2.material.color;
  147. }
  148. function T(e2, t3 = 0) {
  149. const s4 = N(e2);
  150. if (!s4) {
  151. if ("fill" === e2.type)
  152. return null;
  153. const s5 = g.r, r3 = h3(s5, t3);
  154. return [r3, r3, r3, 100];
  155. }
  156. const r2 = s4.toRgba();
  157. for (let a2 = 0; a2 < 3; a2++)
  158. r2[a2] = h3(r2[a2], t3);
  159. return r2;
  160. }
  161. async function W(t3, s4) {
  162. const r2 = t3.style;
  163. if ("none" === r2)
  164. return null;
  165. return { type: "pattern", x: 0, y: 0, src: await h2(a(`esri/symbols/patterns/${r2}.png`), s4.toCss(true)), width: 5, height: 5 };
  166. }
  167. function $(e2) {
  168. return e2.outline ? q(e2) : { color: "rgba(0, 0, 0, 1)", width: 1.5 };
  169. }
  170. function B(e2, t3) {
  171. const s4 = N(e2);
  172. if (!s4)
  173. return null;
  174. let r2 = "rgba(";
  175. return r2 += h3(s4.r, t3) + ",", r2 += h3(s4.g, t3) + ",", r2 += h3(s4.b, t3) + ",", r2 + s4.a + ");";
  176. }
  177. function F(e2, t3) {
  178. const s4 = B(e2, t3);
  179. if (!s4)
  180. return {};
  181. if ("pattern" in e2 && r(e2.pattern) && "style" === e2.pattern.type && "none" === e2.pattern.style)
  182. return null;
  183. return { color: s4, width: Math.min(e2.size ? u(e2.size) : 0.75, R), style: "pattern" in e2 && r(e2.pattern) && "style" === e2.pattern.type ? d2(e2.pattern.style) : null, cap: "cap" in e2 ? e2.cap : null, join: "join" in e2 ? "miter" === e2.join ? u(2) : e2.join : null };
  184. }
  185. function G(e2, t3, s4) {
  186. const r2 = null != s4 ? 0.75 * s4 : 0;
  187. 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 }] };
  188. }
  189. function J(e2) {
  190. const t3 = e2.depth, s4 = e2.height, r2 = e2.width;
  191. return 0 !== r2 && 0 !== t3 && 0 !== s4 && r2 === t3 && null != r2 && null != s4 && r2 < s4;
  192. }
  193. function K(e2, t3, s4) {
  194. const r2 = [];
  195. if (!e2)
  196. return r2;
  197. switch (e2.type) {
  198. case "icon": {
  199. const s5 = 0, a2 = 0, o2 = t3, n2 = t3;
  200. switch (e2.resource && e2.resource.primitive || j) {
  201. case "circle":
  202. r2.push({ shape: { type: "circle", cx: 0, cy: 0, r: 0.5 * t3 }, fill: T(e2, 0), stroke: q(e2) });
  203. break;
  204. case "square":
  205. 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) });
  206. break;
  207. case "triangle":
  208. 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) });
  209. break;
  210. case "cross":
  211. 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) });
  212. break;
  213. case "x":
  214. 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) });
  215. break;
  216. case "kite":
  217. 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) });
  218. }
  219. break;
  220. }
  221. case "object":
  222. switch (e2.resource && e2.resource.primitive || d) {
  223. case "cone": {
  224. const a2 = G(T(e2, 0), T(e2, -0.6), s4 ? Z : t3), o2 = l(t3, s4);
  225. r2.push({ shape: o2[0], fill: a2 }), r2.push({ shape: o2[1], fill: a2 });
  226. break;
  227. }
  228. case "inverted-cone": {
  229. const s5 = T(e2, 0), a2 = G(s5, T(e2, -0.6), t3), o2 = o(t3);
  230. r2.push({ shape: o2[0], fill: a2 }), r2.push({ shape: o2[1], fill: s5 });
  231. break;
  232. }
  233. case "cube": {
  234. const a2 = p2(t3, s4);
  235. 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) });
  236. break;
  237. }
  238. case "cylinder": {
  239. const a2 = G(T(e2, 0), T(e2, -0.6), s4 ? Z : t3), o2 = L(t3, s4);
  240. r2.push({ shape: o2[0], fill: a2 }), r2.push({ shape: o2[1], fill: a2 }), r2.push({ shape: o2[2], fill: T(e2, 0) });
  241. break;
  242. }
  243. case "diamond": {
  244. const s5 = s3(t3);
  245. 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) });
  246. break;
  247. }
  248. case "sphere": {
  249. const s5 = G(T(e2, 0), T(e2, -0.6));
  250. 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 });
  251. break;
  252. }
  253. case "tetrahedron": {
  254. const s5 = u2(t3);
  255. 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) });
  256. break;
  257. }
  258. }
  259. break;
  260. }
  261. return r2;
  262. }
  263. function Q(e2) {
  264. const t3 = "number" == typeof (e2 == null ? void 0 : e2.size) ? e2 == null ? void 0 : e2.size : null;
  265. return t3 ? u(t3) : null;
  266. }
  267. function V(e2) {
  268. return "icon" === e2.type ? "multiply" : "tint";
  269. }
  270. function X(e2, t3) {
  271. var _a;
  272. const s4 = Q(t3), r2 = (t3 == null ? void 0 : t3.maxSize) ? u(t3.maxSize) : null, o2 = (_a = t3 == null ? void 0 : t3.disableUpsampling) != null ? _a : false, n2 = e2.symbolLayers, l2 = [];
  273. let p3 = 0, u3 = 0;
  274. const h5 = n2.getItemAt(n2.length - 1);
  275. let m2;
  276. return h5 && "icon" === h5.type && (m2 = h5.size && u(h5.size)), n2.forEach((a2) => {
  277. var _a2;
  278. if ("icon" !== a2.type && "object" !== a2.type)
  279. return;
  280. const n3 = "icon" === a2.type ? a2.size && u(a2.size) : 0, i = s4 || n3 ? Math.ceil(Math.min(s4 || n3, r2 || I)) : C;
  281. if (a2 && a2.resource && a2.resource.href) {
  282. const t4 = A(e2, a2).then((e3) => {
  283. const t5 = a2.get("material.color"), s5 = V(a2);
  284. return d4(e3, i, t5, s5, o2);
  285. }).then((e3) => {
  286. const t5 = e3.width, s5 = e3.height;
  287. return p3 = Math.max(p3, t5), u3 = Math.max(u3, s5), [{ shape: { type: "image", x: 0, y: 0, width: t5, height: s5, src: e3.url }, fill: null, stroke: null }];
  288. });
  289. l2.push(t4);
  290. } else {
  291. let e3 = i;
  292. "icon" === a2.type && m2 && s4 && (e3 = i * (n3 / m2));
  293. const r3 = "tall" === (t3 == null ? void 0 : t3.symbolConfig) || ((_a2 = t3 == null ? void 0 : t3.symbolConfig) == null ? void 0 : _a2.isTall) || "object" === a2.type && J(a2);
  294. p3 = Math.max(p3, r3 ? Z : e3), u3 = Math.max(u3, e3), l2.push(Promise.resolve(K(a2, e3, r3)));
  295. }
  296. }), E(l2).then((e3) => {
  297. const s5 = [];
  298. return e3.forEach((e4) => {
  299. e4.value ? s5.push(e4.value) : e4.error && s.getLogger("esri.symbols.support.previewSymbol3D").warn("error while building swatchInfo!", e4.error);
  300. }), h4(s5, [p3, u3], { node: t3 && t3.node, scale: false, opacity: t3 && t3.opacity });
  301. });
  302. }
  303. function Y(e2, t3) {
  304. const s4 = e2.symbolLayers, r2 = [], a2 = d3(e2), n2 = Q(t3), l2 = (t3 && t3.maxSize ? u(t3.maxSize) : null) || R;
  305. let i, p3 = 0, u3 = 0;
  306. return s4.forEach((e3, t4) => {
  307. if (!e3)
  308. return;
  309. if ("line" !== e3.type && "path" !== e3.type)
  310. return;
  311. const s5 = [];
  312. switch (e3.type) {
  313. case "line": {
  314. const r3 = F(e3, 0);
  315. if (t(r3))
  316. break;
  317. const a3 = r3 && r3.width || 0;
  318. 0 === t4 && (i = a3);
  319. const c2 = Math.min(n2 || a3, l2), h5 = 0 === t4 ? c2 : n2 ? c2 * (a3 / i) : c2, m2 = h5 > E2 / 2 ? 2 * h5 : E2;
  320. u3 = Math.max(u3, h5), p3 = Math.max(p3, m2), r3.width = h5, s5.push({ shape: { type: "path", path: [{ command: "M", values: [0, 0.5 * u3] }, { command: "L", values: [p3, 0.5 * u3] }] }, stroke: r3 });
  321. break;
  322. }
  323. case "path": {
  324. const t5 = Math.min(n2 || C, l2), r3 = T(e3, 0), a3 = T(e3, -0.2), o2 = B(e3, -0.4), i2 = o2 ? { color: o2, width: 1 } : {};
  325. if ("quad" === e3.profile) {
  326. const t6 = e3.width, o3 = e3.height, n3 = m(t6 && o3 ? t6 / o3 : 1, 0 === o3, 0 === t6), l3 = { ...i2, join: "bevel" };
  327. s5.push({ shape: n3[0], fill: a3, stroke: l3 }), s5.push({ shape: n3[1], fill: a3, stroke: l3 }), s5.push({ shape: n3[2], fill: r3, stroke: l3 });
  328. } else
  329. s5.push({ shape: e.pathSymbol3DLayer[0], fill: a3, stroke: i2 }), s5.push({ shape: e.pathSymbol3DLayer[1], fill: r3, stroke: i2 });
  330. u3 = Math.max(u3, t5), p3 = u3;
  331. }
  332. }
  333. r2.push(s5);
  334. }), Promise.resolve(h4(r2, [p3, u3], { node: t3 && t3.node, scale: a2, opacity: t3 && t3.opacity }));
  335. }
  336. async function _(e2, t3) {
  337. const s4 = "mesh-3d" === e2.type, r2 = e2.symbolLayers, a2 = Q(t3), i = t3 && t3.maxSize ? u(t3.maxSize) : null, p3 = a2 || C, u3 = [];
  338. let h5 = 0, m2 = 0, f2 = false;
  339. for (let c2 = 0; c2 < r2.length; c2++) {
  340. const e3 = r2.getItemAt(c2), t4 = [];
  341. if (s4 && "fill" !== e3.type)
  342. continue;
  343. const a3 = e.fill[0];
  344. switch (e3.type) {
  345. case "fill": {
  346. const r3 = q(e3), o2 = Math.min(p3, i || I);
  347. h5 = Math.max(h5, o2), m2 = Math.max(m2, o2), f2 = true;
  348. let n2 = T(e3, 0);
  349. const c3 = "pattern" in e3 ? e3.pattern : null, u4 = N(e3);
  350. !s4 && r(c3) && "style" === c3.type && "solid" !== c3.style && u4 && (n2 = await W(c3, u4)), t4.push({ shape: a3, fill: n2, stroke: r3 });
  351. break;
  352. }
  353. case "line": {
  354. const s5 = F(e3, 0);
  355. if (t(s5))
  356. break;
  357. const r3 = { stroke: s5, shape: a3 };
  358. h5 = Math.max(h5, C), m2 = Math.max(m2, C), t4.push(r3);
  359. break;
  360. }
  361. case "extrude": {
  362. const s5 = { join: "round", width: 1, ...F(e3, -0.4) }, r3 = T(e3, 0), a4 = T(e3, -0.2), o2 = Math.min(p3, i || I), n2 = c(o2);
  363. 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 });
  364. const l2 = C, c3 = 0.7 * C + 0.5 * o2;
  365. h5 = Math.max(h5, l2), m2 = Math.max(m2, c3);
  366. break;
  367. }
  368. case "water": {
  369. const s5 = f(N(e3)), r3 = H(s5), a4 = H(s5, 2), o2 = H(s5, 3), l2 = n();
  370. f2 = true, t4.push({ shape: l2[0], fill: r3 }), t4.push({ shape: l2[1], fill: a4 }), t4.push({ shape: l2[2], fill: o2 });
  371. const c3 = Math.min(p3, i || I);
  372. h5 = Math.max(h5, c3), m2 = Math.max(m2, c3);
  373. break;
  374. }
  375. }
  376. u3.push(t4);
  377. }
  378. return h4(u3, [h5, m2], { node: t3 && t3.node, scale: f2, opacity: t3 && t3.opacity });
  379. }
  380. function ee(e2, t3) {
  381. if (0 === e2.symbolLayers.length)
  382. return Promise.reject(new s2("symbolPreview: renderPreviewHTML3D", "No symbolLayers in the symbol."));
  383. switch (e2.type) {
  384. case "point-3d":
  385. return X(e2, t3);
  386. case "line-3d":
  387. return Y(e2, t3);
  388. case "polygon-3d":
  389. case "mesh-3d":
  390. return _(e2, t3);
  391. }
  392. return Promise.reject(new s2("symbolPreview: swatchInfo3D", "symbol not supported."));
  393. }
  394. export {
  395. W as getPatternDescriptor,
  396. Q as getSizeFromOptions,
  397. T as getSymbolLayerFill,
  398. ee as previewSymbol3D
  399. };
  400. //# sourceMappingURL=previewSymbol3D-NMNELBZQ.js.map