PointCloudWorker-M5JXFAS4.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. import {
  2. a2 as a,
  3. a3 as a2,
  4. d
  5. } from "./chunk-PFW4FYZV.js";
  6. import {
  7. I,
  8. c,
  9. e,
  10. f,
  11. g
  12. } from "./chunk-RMZNH22Z.js";
  13. import {
  14. n,
  15. r as r2
  16. } from "./chunk-A22ACVMF.js";
  17. import "./chunk-RUM3DXFX.js";
  18. import {
  19. S
  20. } from "./chunk-W3XAGTM6.js";
  21. import "./chunk-XFDO4CMR.js";
  22. import "./chunk-GHN7C53L.js";
  23. import {
  24. xn
  25. } from "./chunk-P24XEEHY.js";
  26. import "./chunk-SAJAEMIJ.js";
  27. import "./chunk-JPUFJK2B.js";
  28. import "./chunk-HZ2WKB3G.js";
  29. import "./chunk-VGWC3IKZ.js";
  30. import "./chunk-2H5MD622.js";
  31. import "./chunk-3RSFVUKZ.js";
  32. import "./chunk-X4SA4ELJ.js";
  33. import "./chunk-5N7JLUJJ.js";
  34. import "./chunk-ZLNEXZAN.js";
  35. import "./chunk-ZYRIJWLX.js";
  36. import "./chunk-RYY6632W.js";
  37. import {
  38. E
  39. } from "./chunk-DW42UVIT.js";
  40. import "./chunk-YAEIHDJH.js";
  41. import "./chunk-TJNOJH33.js";
  42. import "./chunk-OSHI574D.js";
  43. import "./chunk-VCH45Q2I.js";
  44. import "./chunk-GSSTTHIT.js";
  45. import "./chunk-HZRKBTHJ.js";
  46. import "./chunk-DVUG3KID.js";
  47. import "./chunk-FWSQEIAR.js";
  48. import "./chunk-VEGAOVMY.js";
  49. import "./chunk-6T6G6LCQ.js";
  50. import "./chunk-YEJL5NEF.js";
  51. import {
  52. k2 as k
  53. } from "./chunk-PQFTYGF5.js";
  54. import "./chunk-2Z2TG5CU.js";
  55. import "./chunk-6KZ2LTDA.js";
  56. import "./chunk-U2XHEJM7.js";
  57. import "./chunk-SQOPWYIT.js";
  58. import "./chunk-V6P2MAQQ.js";
  59. import "./chunk-E5O6P5I2.js";
  60. import "./chunk-SPWQ3AWG.js";
  61. import {
  62. o
  63. } from "./chunk-2TIUKVZN.js";
  64. import {
  65. r,
  66. t
  67. } from "./chunk-YXWMMD76.js";
  68. import "./chunk-S5KM4IGW.js";
  69. // node_modules/@arcgis/core/views/3d/layers/i3s/PointCloudWorkerUtil.js
  70. function f2(e2, o2, n2, s) {
  71. const { rendererJSON: i, isRGBRenderer: u } = e2;
  72. let f3 = null, c4 = null;
  73. if (o2 && u)
  74. f3 = o2;
  75. else if (o2 && "pointCloudUniqueValueRenderer" === i.type) {
  76. c4 = a2.fromJSON(i);
  77. const e3 = c4.colorUniqueValueInfos;
  78. f3 = new Uint8Array(3 * s);
  79. const r3 = p(c4.fieldTransformType);
  80. for (let t2 = 0; t2 < s; t2++) {
  81. const l = (r3 ? r3(o2[t2]) : o2[t2]) + "";
  82. for (let o3 = 0; o3 < e3.length; o3++)
  83. if (e3[o3].values.includes(l)) {
  84. f3[3 * t2] = e3[o3].color.r, f3[3 * t2 + 1] = e3[o3].color.g, f3[3 * t2 + 2] = e3[o3].color.b;
  85. break;
  86. }
  87. }
  88. } else if (o2 && "pointCloudStretchRenderer" === i.type) {
  89. c4 = a.fromJSON(i);
  90. const e3 = c4.stops;
  91. f3 = new Uint8Array(3 * s);
  92. const r3 = p(c4.fieldTransformType);
  93. for (let t2 = 0; t2 < s; t2++) {
  94. const l = r3 ? r3(o2[t2]) : o2[t2], n3 = e3.length - 1;
  95. if (l < e3[0].value)
  96. f3[3 * t2] = e3[0].color.r, f3[3 * t2 + 1] = e3[0].color.g, f3[3 * t2 + 2] = e3[0].color.b;
  97. else if (l >= e3[n3].value)
  98. f3[3 * t2] = e3[n3].color.r, f3[3 * t2 + 1] = e3[n3].color.g, f3[3 * t2 + 2] = e3[n3].color.b;
  99. else
  100. for (let o3 = 1; o3 < e3.length; o3++)
  101. if (l < e3[o3].value) {
  102. const r4 = (l - e3[o3 - 1].value) / (e3[o3].value - e3[o3 - 1].value);
  103. f3[3 * t2] = e3[o3].color.r * r4 + e3[o3 - 1].color.r * (1 - r4), f3[3 * t2 + 1] = e3[o3].color.g * r4 + e3[o3 - 1].color.g * (1 - r4), f3[3 * t2 + 2] = e3[o3].color.b * r4 + e3[o3 - 1].color.b * (1 - r4);
  104. break;
  105. }
  106. }
  107. } else if (o2 && "pointCloudClassBreaksRenderer" === i.type) {
  108. c4 = d.fromJSON(i);
  109. const e3 = c4.colorClassBreakInfos;
  110. f3 = new Uint8Array(3 * s);
  111. const t2 = p(c4.fieldTransformType);
  112. for (let r3 = 0; r3 < s; r3++) {
  113. const l = t2 ? t2(o2[r3]) : o2[r3];
  114. for (let o3 = 0; o3 < e3.length; o3++)
  115. if (l >= e3[o3].minValue && l <= e3[o3].maxValue) {
  116. f3[3 * r3] = e3[o3].color.r, f3[3 * r3 + 1] = e3[o3].color.g, f3[3 * r3 + 2] = e3[o3].color.b;
  117. break;
  118. }
  119. }
  120. } else {
  121. f3 = new Uint8Array(3 * s);
  122. for (let e3 = 0; e3 < f3.length; e3++)
  123. f3[e3] = 255;
  124. }
  125. if (n2 && c4 && c4.colorModulation) {
  126. const e3 = c4.colorModulation.minValue, o3 = c4.colorModulation.maxValue, r3 = 0.3;
  127. for (let t2 = 0; t2 < s; t2++) {
  128. const l = n2[t2], s2 = l >= o3 ? 1 : l <= e3 ? r3 : r3 + (1 - r3) * (l - e3) / (o3 - e3);
  129. f3[3 * t2] = s2 * f3[3 * t2], f3[3 * t2 + 1] = s2 * f3[3 * t2 + 1], f3[3 * t2 + 2] = s2 * f3[3 * t2 + 2];
  130. }
  131. }
  132. return f3;
  133. }
  134. function c2(o2, r3) {
  135. if (null == o2.encoding || "" === o2.encoding) {
  136. const t2 = g(r3, o2);
  137. if (t(t2.vertexAttributes.position))
  138. return;
  139. const l = f(r3, t2.vertexAttributes.position), i = t2.header.fields, u = [i.offsetX, i.offsetY, i.offsetZ], f3 = [i.scaleX, i.scaleY, i.scaleZ], c4 = l.length / 3, a4 = new Float64Array(3 * c4);
  140. for (let e2 = 0; e2 < c4; e2++)
  141. a4[3 * e2] = l[3 * e2] * f3[0] + u[0], a4[3 * e2 + 1] = l[3 * e2 + 1] * f3[1] + u[1], a4[3 * e2 + 2] = l[3 * e2 + 2] * f3[2] + u[2];
  142. return a4;
  143. }
  144. if ("lepcc-xyz" === o2.encoding)
  145. return c(r3).result;
  146. }
  147. function a3(e2, r3, t2) {
  148. return r(e2) && e2.attributeInfo.useElevation ? d2(r3, t2) : r(e2) ? I(e2.attributeInfo.storageInfo, e2.buffer, t2) : null;
  149. }
  150. function d2(e2, o2) {
  151. const r3 = new Float64Array(o2);
  152. for (let t2 = 0; t2 < o2; t2++)
  153. r3[t2] = e2[3 * t2 + 2];
  154. return r3;
  155. }
  156. function m(e2, o2, r3, t2, l) {
  157. const n2 = e2.length / 3;
  158. let s = 0;
  159. for (let i = 0; i < n2; i++) {
  160. let n3 = true;
  161. for (let e3 = 0; e3 < t2.length && n3; e3++) {
  162. const { filterJSON: o3 } = t2[e3], r4 = l[e3].values[i];
  163. switch (o3.type) {
  164. case "pointCloudValueFilter": {
  165. const e4 = "exclude" === o3.mode;
  166. o3.values.includes(r4) === e4 && (n3 = false);
  167. break;
  168. }
  169. case "pointCloudBitfieldFilter": {
  170. const e4 = b(o3.requiredSetBits), t3 = b(o3.requiredClearBits);
  171. (r4 & e4) === e4 && 0 == (r4 & t3) || (n3 = false);
  172. break;
  173. }
  174. case "pointCloudReturnFilter": {
  175. const e4 = 15 & r4, t3 = r4 >>> 4 & 15, l2 = t3 > 1, s2 = 1 === e4, i2 = e4 === t3;
  176. let u = false;
  177. for (const r5 of o3.includedReturns)
  178. if ("last" === r5 && i2 || "firstOfMany" === r5 && s2 && l2 || "lastOfMany" === r5 && i2 && l2 || "single" === r5 && !l2) {
  179. u = true;
  180. break;
  181. }
  182. u || (n3 = false);
  183. break;
  184. }
  185. }
  186. }
  187. n3 && (r3[s] = i, e2[3 * s] = e2[3 * i], e2[3 * s + 1] = e2[3 * i + 1], e2[3 * s + 2] = e2[3 * i + 2], o2[3 * s] = o2[3 * i], o2[3 * s + 1] = o2[3 * i + 1], o2[3 * s + 2] = o2[3 * i + 2], s++);
  188. }
  189. return s;
  190. }
  191. function p(e2) {
  192. return null == e2 || "none" === e2 ? null : "low-four-bit" === e2 ? (e3) => 15 & e3 : "high-four-bit" === e2 ? (e3) => (240 & e3) >> 4 : "absolute-value" === e2 ? (e3) => Math.abs(e3) : "modulo-ten" === e2 ? (e3) => e3 % 10 : null;
  193. }
  194. function b(e2) {
  195. let o2 = 0;
  196. for (const r3 of e2 || [])
  197. o2 |= 1 << r3;
  198. return o2;
  199. }
  200. // node_modules/@arcgis/core/views/3d/layers/PointCloudWorker.js
  201. var c3 = class {
  202. transform(e2) {
  203. const a4 = this._transform(e2), o2 = [a4.points.buffer, a4.rgb.buffer];
  204. r(a4.pointIdFilterMap) && o2.push(a4.pointIdFilterMap.buffer);
  205. for (const t2 of a4.attributes)
  206. "buffer" in t2.values && o(t2.values.buffer) && t2.values.buffer !== a4.rgb.buffer && o2.push(t2.values.buffer);
  207. return Promise.resolve({ result: a4, transferList: o2 });
  208. }
  209. _transform(r3) {
  210. const e2 = c2(r3.schema, r3.geometryBuffer);
  211. let a4 = e2.length / 3, o2 = null;
  212. const f3 = [], n2 = a3(r3.primaryAttributeData, e2, a4);
  213. r(r3.primaryAttributeData) && n2 && f3.push({ attributeInfo: r3.primaryAttributeData.attributeInfo, values: n2 });
  214. const s = a3(r3.modulationAttributeData, e2, a4);
  215. r(r3.modulationAttributeData) && s && f3.push({ attributeInfo: r3.modulationAttributeData.attributeInfo, values: s });
  216. let c4 = f2(r3.rendererInfo, n2, s, a4);
  217. if (r3.filterInfo && r3.filterInfo.length > 0 && r(r3.filterAttributesData)) {
  218. const t2 = r3.filterAttributesData.map((t3) => {
  219. const r4 = a3(t3, e2, a4), o3 = { attributeInfo: t3.attributeInfo, values: r4 };
  220. return f3.push(o3), o3;
  221. });
  222. o2 = new Uint32Array(a4), a4 = m(e2, c4, o2, r3.filterInfo, t2);
  223. }
  224. for (const t2 of r3.userAttributesData) {
  225. const r4 = a3(t2, e2, a4);
  226. f3.push({ attributeInfo: t2.attributeInfo, values: r4 });
  227. }
  228. 3 * a4 < c4.length && (c4 = new Uint8Array(c4.buffer.slice(0, 3 * a4))), this._applyElevationOffsetInPlace(e2, a4, r3.elevationOffset);
  229. const p3 = this._transformCoordinates(e2, a4, r3.obb, k.fromJSON(r3.inSR), k.fromJSON(r3.outSR));
  230. return { obb: r3.obb, points: p3, rgb: c4, attributes: f3, pointIdFilterMap: o2 };
  231. }
  232. _transformCoordinates(t2, r3, a4, i, u) {
  233. if (!xn(t2, i, 0, t2, u, 0, r3))
  234. throw new Error("Can't reproject");
  235. const l = r2(a4.center[0], a4.center[1], a4.center[2]), b2 = n(), m2 = n();
  236. S(p2, a4.quaternion);
  237. const c4 = new Float32Array(3 * r3);
  238. for (let e2 = 0; e2 < r3; e2++)
  239. b2[0] = t2[3 * e2] - l[0], b2[1] = t2[3 * e2 + 1] - l[1], b2[2] = t2[3 * e2 + 2] - l[2], E(m2, b2, p2), a4.halfSize[0] = Math.max(a4.halfSize[0], Math.abs(m2[0])), a4.halfSize[1] = Math.max(a4.halfSize[1], Math.abs(m2[1])), a4.halfSize[2] = Math.max(a4.halfSize[2], Math.abs(m2[2])), c4[3 * e2] = b2[0], c4[3 * e2 + 1] = b2[1], c4[3 * e2 + 2] = b2[2];
  240. return c4;
  241. }
  242. _applyElevationOffsetInPlace(t2, r3, e2) {
  243. if (0 !== e2)
  244. for (let a4 = 0; a4 < r3; a4++)
  245. t2[3 * a4 + 2] += e2;
  246. }
  247. };
  248. var p2 = e();
  249. function h() {
  250. return new c3();
  251. }
  252. export {
  253. h as default
  254. };
  255. //# sourceMappingURL=PointCloudWorker-M5JXFAS4.js.map