MediaLayerView2D-NAXGI6LP.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. import {
  2. p as p2
  3. } from "./chunk-CR67YDNV.js";
  4. import {
  5. W,
  6. a as a3
  7. } from "./chunk-H3QCF24A.js";
  8. import {
  9. f as f4,
  10. u as u3
  11. } from "./chunk-MNZXIBJ7.js";
  12. import {
  13. a as a2
  14. } from "./chunk-YJKEIUMW.js";
  15. import "./chunk-JH3PLIM6.js";
  16. import "./chunk-FCDUTNBY.js";
  17. import "./chunk-LL6JU3GU.js";
  18. import "./chunk-ZIWBDWEW.js";
  19. import "./chunk-IQNZZCQJ.js";
  20. import "./chunk-Q4LKAPDF.js";
  21. import "./chunk-TODU7HVH.js";
  22. import {
  23. I
  24. } from "./chunk-23ONSYIH.js";
  25. import "./chunk-3T4BXU2T.js";
  26. import "./chunk-YLVXZ2PS.js";
  27. import "./chunk-EE6TL7XD.js";
  28. import {
  29. c as c3,
  30. f as f3
  31. } from "./chunk-GDB2KX4Y.js";
  32. import {
  33. n as n2,
  34. u as u2
  35. } from "./chunk-546QCRS4.js";
  36. import "./chunk-QXZVBSBH.js";
  37. import {
  38. r as r6
  39. } from "./chunk-T4GXZJ3D.js";
  40. import "./chunk-773XI6MQ.js";
  41. import "./chunk-WFSV2B2I.js";
  42. import "./chunk-J525NRN3.js";
  43. import {
  44. D,
  45. F,
  46. G,
  47. L,
  48. P
  49. } from "./chunk-MI7HWWFL.js";
  50. import {
  51. mt
  52. } from "./chunk-7BTL34ZE.js";
  53. import {
  54. e as e3
  55. } from "./chunk-ZHRMTKME.js";
  56. import "./chunk-ZVHTCCQC.js";
  57. import {
  58. r as r5
  59. } from "./chunk-PCGDLSZ4.js";
  60. import {
  61. p
  62. } from "./chunk-CAYFEZCR.js";
  63. import {
  64. t as t2
  65. } from "./chunk-MFFE4I2S.js";
  66. import "./chunk-K3NA3LQS.js";
  67. import "./chunk-LMCIAW5S.js";
  68. import "./chunk-OTS3UE5B.js";
  69. import "./chunk-6RAL4JPQ.js";
  70. import "./chunk-LGW7TID4.js";
  71. import "./chunk-3OHML7FO.js";
  72. import "./chunk-G5AI6ZNE.js";
  73. import "./chunk-FIYKFRB2.js";
  74. import {
  75. z
  76. } from "./chunk-P4UZNLD5.js";
  77. import "./chunk-FYNVVMWY.js";
  78. import "./chunk-Q52DVFYK.js";
  79. import "./chunk-HBMVUVZX.js";
  80. import {
  81. M as M2,
  82. f as f2,
  83. h as h2,
  84. i as i2,
  85. r as r4
  86. } from "./chunk-CRGVDJI6.js";
  87. import {
  88. un
  89. } from "./chunk-DH2OBAUC.js";
  90. import "./chunk-TNLRDNTC.js";
  91. import "./chunk-6P6NA7JB.js";
  92. import "./chunk-3D3QEPRE.js";
  93. import "./chunk-XLV7RUSE.js";
  94. import "./chunk-NTUXR253.js";
  95. import "./chunk-RMX2AZ4P.js";
  96. import "./chunk-NE3ESGA6.js";
  97. import {
  98. a,
  99. f,
  100. h,
  101. l
  102. } from "./chunk-YIS6BAC3.js";
  103. import "./chunk-7XXXCK2A.js";
  104. import "./chunk-WJW5DUN6.js";
  105. import "./chunk-PJ7ZQ4VD.js";
  106. import "./chunk-WDLTDV2L.js";
  107. import "./chunk-TERAW6FT.js";
  108. import {
  109. c as c2,
  110. u
  111. } from "./chunk-N2663GRX.js";
  112. import "./chunk-O4FY3ITT.js";
  113. import {
  114. c
  115. } from "./chunk-WEMIK25H.js";
  116. import "./chunk-7N4X6GF3.js";
  117. import "./chunk-JXW4QTJA.js";
  118. import "./chunk-UXF37FQ4.js";
  119. import "./chunk-ZOEK6QHJ.js";
  120. import {
  121. i2 as i
  122. } from "./chunk-XNLG7T2T.js";
  123. import "./chunk-IR4PV7VK.js";
  124. import "./chunk-2Z6LERTI.js";
  125. import {
  126. v2 as v
  127. } from "./chunk-OWVBLVP3.js";
  128. import "./chunk-AFZ7XSEW.js";
  129. import "./chunk-MXB2XLKV.js";
  130. import "./chunk-YBSUITLL.js";
  131. import {
  132. j
  133. } from "./chunk-ALDCDSPV.js";
  134. import "./chunk-DT6EAZQ5.js";
  135. import "./chunk-HNOZUNJ4.js";
  136. import "./chunk-VNFRAYHO.js";
  137. import "./chunk-R5IG2D6H.js";
  138. import "./chunk-VBRY5KJM.js";
  139. import "./chunk-PDKDCAAD.js";
  140. import {
  141. M2 as M,
  142. s2 as s3
  143. } from "./chunk-ECW2QABR.js";
  144. import "./chunk-GCDJLKH4.js";
  145. import {
  146. R
  147. } from "./chunk-MRJEICT6.js";
  148. import {
  149. d,
  150. e,
  151. n2 as n,
  152. y3 as y
  153. } from "./chunk-Y3WMVFTW.js";
  154. import "./chunk-SAS7RONY.js";
  155. import "./chunk-WSRBH7BF.js";
  156. import {
  157. r as r2
  158. } from "./chunk-IHXECKQQ.js";
  159. import {
  160. g,
  161. r2 as r3
  162. } from "./chunk-ULGDPLM2.js";
  163. import {
  164. s,
  165. s3 as s2
  166. } from "./chunk-EMJ4ZSM2.js";
  167. import "./chunk-IKP3YN53.js";
  168. import {
  169. e as e2,
  170. r,
  171. t
  172. } from "./chunk-GZT4BVFP.js";
  173. import "./chunk-A5ICIBVI.js";
  174. // node_modules/@arcgis/core/layers/support/mediaUtils.js
  175. var a4 = class extends y {
  176. constructor(o) {
  177. super(o);
  178. }
  179. get bounds() {
  180. const o = this.coords;
  181. return t(o) ? null : c2(o.extent);
  182. }
  183. get coords() {
  184. const o = e2(this.element.georeference)?.coords;
  185. return un(o, this.spatialReference).geometry;
  186. }
  187. get normalizedCoords() {
  188. return v.fromJSON(p2(this.coords));
  189. }
  190. get normalizedBounds() {
  191. return r(this.normalizedCoords) ? c2(this.normalizedCoords.extent) : null;
  192. }
  193. };
  194. e([d()], a4.prototype, "spatialReference", void 0), e([d()], a4.prototype, "element", void 0), e([d()], a4.prototype, "bounds", null), e([d()], a4.prototype, "coords", null), e([d()], a4.prototype, "normalizedCoords", null), e([d()], a4.prototype, "normalizedBounds", null), a4 = e([n("esri.layers.support.media.MediaElementView")], a4);
  195. // node_modules/@arcgis/core/views/2d/engine/webgl/Overlay.js
  196. var _ = class extends a2 {
  197. constructor(s4) {
  198. super(), this.elementView = s4, this.isWrapAround = false, this._vertices = new Float32Array(20), this._handles = [], this._handles.push(l(() => this.elementView.element.opacity, (e4) => this.opacity = e4, h), l(() => [this.elementView.coords], () => {
  199. this.requestRender();
  200. }, h), f(() => this.elementView.element.loaded, () => {
  201. const e4 = this.elementView.element;
  202. this.ready(), e4.type === "video" && r(e4.content) && this._handles.push(r3(e4.content, "play", () => this.requestRender()));
  203. }, h)), s4.element.load().catch((t3) => {
  204. s.getLogger("esri.views.2d.layers.MediaLayerView2D").error(new s2("element-load-error", "Element cannot be displayed", { element: s4, error: t3 }));
  205. });
  206. }
  207. destroy() {
  208. this._handles.forEach((e4) => e4.remove()), this.texture?.dispose(), this.texture = null;
  209. }
  210. get dvsMat3() {
  211. return this.parent.dvsMat3;
  212. }
  213. beforeRender(e4) {
  214. const { context: t3 } = e4, r7 = this.elementView.element.content;
  215. if (r(r7)) {
  216. const e5 = r7 instanceof HTMLImageElement, i3 = r7 instanceof HTMLVideoElement, o = e5 ? r7.naturalWidth : i3 ? r7.videoWidth : r7.width, n3 = e5 ? r7.naturalHeight : i3 ? r7.videoHeight : r7.height;
  217. this.texture ? i3 && !r7.paused && (this.texture.setData(r7), this.requestRender(), (n2(t3.gl) || i(o) && i(n3)) && this.texture.generateMipmap()) : (this.texture = new u2(t3, { pixelFormat: P.RGBA, dataType: G.UNSIGNED_BYTE, samplingMode: L.LINEAR, wrapMode: D.CLAMP_TO_EDGE, width: o, height: n3 }, r7), (n2(t3.gl) || i(o) && i(n3)) && this.texture.generateMipmap(), i3 && !r7.paused && this.requestRender());
  218. }
  219. super.beforeRender(e4);
  220. }
  221. _createTransforms() {
  222. return null;
  223. }
  224. updateDrawCoords(e4, t3) {
  225. const r7 = this.elementView.coords;
  226. if (t(r7))
  227. return;
  228. const [s4, i3, n3, a5] = r7.rings[0], h3 = this._vertices, { x: m, y: l2 } = e4, d2 = t3 !== 0;
  229. d2 ? h3.set([i3[0] - m, i3[1] - l2, s4[0] - m, s4[1] - l2, n3[0] - m, n3[1] - l2, a5[0] - m, a5[1] - l2, a5[0] - m, a5[1] - l2, i3[0] + t3 - m, i3[1] - l2, i3[0] + t3 - m, i3[1] - l2, s4[0] + t3 - m, s4[1] - l2, n3[0] + t3 - m, n3[1] - l2, a5[0] + t3 - m, a5[1] - l2]) : h3.set([i3[0] - m, i3[1] - l2, s4[0] - m, s4[1] - l2, n3[0] - m, n3[1] - l2, a5[0] - m, a5[1] - l2]), this.isWrapAround = d2;
  230. }
  231. getVAO(e4, t3, r7) {
  232. if (t(this.elementView.coords))
  233. return null;
  234. const s4 = this._vertices;
  235. if (this._vao)
  236. this._geometryVbo.setData(s4);
  237. else {
  238. this._geometryVbo = c3.createVertex(e4, F.DYNAMIC_DRAW, s4);
  239. const i3 = c3.createVertex(e4, F.STATIC_DRAW, new Uint16Array([0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1]));
  240. this._vao = new f3(e4, r7, t3, { geometry: this._geometryVbo, tex: i3 });
  241. }
  242. return this._vao;
  243. }
  244. };
  245. // node_modules/@arcgis/core/views/2d/engine/webgl/OverlayContainer.js
  246. var M3 = class extends a3 {
  247. constructor() {
  248. super(...arguments), this._localOrigin = c(0, 0), this._viewStateId = -1, this._dvsMat3 = e3(), this.requiresDedicatedFBO = false;
  249. }
  250. get dvsMat3() {
  251. return this._dvsMat3;
  252. }
  253. beforeRender(t3) {
  254. this._updateMatrices(t3), this._updateOverlays(t3, this.children);
  255. for (const e4 of this.children)
  256. e4.beforeRender(t3);
  257. }
  258. prepareRenderPasses(t3) {
  259. const e4 = t3.registerRenderPass({ name: "overlay", brushes: [W.overlay], target: () => this.children, drawPhase: I.MAP });
  260. return [...super.prepareRenderPasses(t3), e4];
  261. }
  262. _updateMatrices(t3) {
  263. const { state: e4 } = t3, { id: n3, size: l2, pixelRatio: m, resolution: h3, rotation: f5, viewpoint: u4, displayMat3: M4 } = e4;
  264. if (this._viewStateId === n3)
  265. return;
  266. const v2 = Math.PI / 180 * f5, _2 = m * l2[0], w2 = m * l2[1], { x: y2, y: j2 } = u4.targetGeometry, g2 = z(y2, e4.spatialReference);
  267. this._localOrigin.x = g2, this._localOrigin.y = j2;
  268. const b = h3 * _2, R3 = h3 * w2, O = r4(this._dvsMat3);
  269. i2(O, O, M4), M2(O, O, t2(_2 / 2, w2 / 2)), f2(O, O, r6(_2 / b, -w2 / R3, 1)), h2(O, O, -v2), this._viewStateId = n3;
  270. }
  271. _updateOverlays(e4, s4) {
  272. const { state: r7 } = e4, { rotation: o, spatialReference: a5, worldScreenWidth: i3, size: n3, viewpoint: c4 } = r7, p3 = this._localOrigin;
  273. let d2 = 0;
  274. if (a5.isWrappable) {
  275. const e5 = n3[0], h3 = n3[1], f5 = 180 / Math.PI * o, u4 = Math.abs(Math.cos(f5)), M4 = Math.abs(Math.sin(f5)), v2 = Math.round(e5 * u4 + h3 * M4), [_2, w2] = R(a5).valid, y2 = mt(a5), { x: j2, y: g2 } = c4.targetGeometry, b = [j2, g2], R3 = [0, 0];
  276. r7.toScreen(R3, b);
  277. const O = [0, 0];
  278. let P2;
  279. P2 = v2 > i3 ? 0.5 * i3 : 0.5 * v2;
  280. const x = Math.floor((j2 + 0.5 * y2) / y2), C = _2 + x * y2, D2 = w2 + x * y2, I2 = [R3[0] + P2, 0];
  281. r7.toMap(O, I2), O[0] > D2 && (d2 = y2), I2[0] = R3[0] - P2, r7.toMap(O, I2), O[0] < C && (d2 = -y2);
  282. for (const r8 of s4) {
  283. const e6 = r8.elementView.bounds;
  284. if (t(e6))
  285. continue;
  286. const [s5, , o2] = e6;
  287. s5 < _2 && o2 > _2 ? r8.updateDrawCoords(p3, y2) : o2 > w2 && s5 < w2 ? r8.updateDrawCoords(p3, -y2) : r8.updateDrawCoords(p3, d2);
  288. }
  289. } else
  290. for (const t3 of s4)
  291. t3.updateDrawCoords(p3, d2);
  292. }
  293. };
  294. // node_modules/@arcgis/core/views/2d/layers/MediaLayerView2D.js
  295. var w = class extends f4(u3) {
  296. constructor() {
  297. super(...arguments), this._overlayContainer = null, this._fetchQueue = null, this._tileStrategy = null, this._elementReferences = new Map(), this.layer = null, this.elements = new j();
  298. }
  299. attach() {
  300. this.handles.add(a(() => this.layer.source, "refresh", () => {
  301. for (const e4 of this._tileStrategy.tiles)
  302. this._updateTile(e4);
  303. this.requestUpdate();
  304. })), this._overlayContainer = new M3(), this.container.addChild(this._overlayContainer), this._fetchQueue = new p({ tileInfoView: this.view.featuresTilingScheme, concurrency: 10, process: (e4, t3) => this._queryElements(e4, t3) }), this._tileStrategy = new r5({ cachePolicy: "purge", resampling: true, acquireTile: (e4) => this._acquireTile(e4), releaseTile: (e4) => this._releaseTile(e4), tileInfoView: this.view.featuresTilingScheme }), this.requestUpdate();
  305. }
  306. detach() {
  307. this.handles.removeAll(), this.elements.removeAll(), this._tileStrategy.destroy(), this._fetchQueue.destroy(), this._overlayContainer.removeAllChildren(), this.container.removeAllChildren(), this._elementReferences.clear();
  308. }
  309. supportsSpatialReference(e4) {
  310. return true;
  311. }
  312. moveStart() {
  313. this.requestUpdate();
  314. }
  315. viewChange() {
  316. this.requestUpdate();
  317. }
  318. moveEnd() {
  319. this.requestUpdate();
  320. }
  321. update(e4) {
  322. this._tileStrategy.update(e4);
  323. }
  324. async hitTest(e4, t3) {
  325. const s4 = [], r7 = [e4.x, e4.y];
  326. for (const l2 of this.elements) {
  327. const t4 = e2(l2.georeference)?.coords;
  328. r(t4) && s3(t4.rings, r7) && s4.push({ type: "media", element: l2, layer: this.layer, mapPoint: e4 });
  329. }
  330. return s4.reverse();
  331. }
  332. canResume() {
  333. return this.layer.source != null && super.canResume();
  334. }
  335. async doRefresh() {
  336. }
  337. _acquireTile(e4) {
  338. const t3 = new R2(e4.clone());
  339. return this._updateTile(t3), t3;
  340. }
  341. _updateTile(e4) {
  342. this.updatingHandles.addPromise(this._fetchQueue.push(e4.key).then((t3) => {
  343. const [s4, r7] = e4.setElements(t3);
  344. this._acquireElements(e4, s4), this._releaseElements(e4, r7), this.requestUpdate();
  345. }, (e5) => {
  346. g(e5) || s.getLogger(this.declaredClass).error(e5);
  347. }));
  348. }
  349. _releaseTile(e4) {
  350. this._fetchQueue.abort(e4.key.id), e4.elements && this._releaseElements(e4, e4.elements), this.requestUpdate();
  351. }
  352. async _queryElements(e4, t3) {
  353. const s4 = this.layer.source;
  354. if (t(s4))
  355. return [];
  356. this.view.featuresTilingScheme.getTileBounds(T, e4, true);
  357. const r7 = new M({ xmin: T[0], ymin: T[1], xmax: T[2], ymax: T[3], spatialReference: this.view.spatialReference });
  358. return s4.queryElements(r7, t3);
  359. }
  360. _acquireElements(e4, t3) {
  361. const s4 = this.layer.source, i3 = this.view.spatialReference;
  362. if (!t(s4))
  363. for (const o of t3) {
  364. r2(this._elementReferences, o.uid, () => {
  365. const e5 = new a4({ element: o, spatialReference: i3 }), t4 = new _(e5);
  366. return this._overlayContainer.addChild(t4), this.elements.add(o), { tiles: new Set(), projectedElement: e5, overlay: t4 };
  367. }).tiles.add(e4);
  368. }
  369. }
  370. _releaseElements(e4, t3) {
  371. for (const s4 of t3) {
  372. const t4 = this._elementReferences.get(s4.uid);
  373. t4.tiles.delete(e4), t4.tiles.size || (this._overlayContainer.removeChild(t4.overlay), t4.overlay.destroy(), t4.projectedElement.destroy(), this._elementReferences.delete(s4.uid), this.elements.remove(s4));
  374. }
  375. }
  376. };
  377. e([d()], w.prototype, "_fetchQueue", void 0), e([d()], w.prototype, "layer", void 0), e([d({ readOnly: true })], w.prototype, "elements", void 0), w = e([n("esri.views.2d.layers.MediaLayerView2D")], w);
  378. var T = u();
  379. var R2 = class {
  380. constructor(e4) {
  381. this.key = e4, this.elements = null, this.isReady = false, this.visible = true;
  382. }
  383. setElements(e4) {
  384. const t3 = [], s4 = new Set(this.elements);
  385. this.elements = e4;
  386. for (const r7 of e4)
  387. s4.has(r7) ? s4.delete(r7) : t3.push(r7);
  388. return this.isReady = true, [t3, Array.from(s4)];
  389. }
  390. };
  391. var S = w;
  392. export {
  393. S as default
  394. };
  395. //# sourceMappingURL=MediaLayerView2D-NAXGI6LP.js.map