chunk-O6KMIRUU.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. import {
  2. r as r4
  3. } from "./chunk-ZLQP3WDC.js";
  4. import {
  5. E
  6. } from "./chunk-H2VOWDMO.js";
  7. import {
  8. D as D2,
  9. G,
  10. M,
  11. P,
  12. U
  13. } from "./chunk-3OFVLRSL.js";
  14. import {
  15. e
  16. } from "./chunk-IQBIGNPU.js";
  17. import {
  18. t as t2
  19. } from "./chunk-UDYHZLTE.js";
  20. import {
  21. r as r3
  22. } from "./chunk-RWQH5X3O.js";
  23. import {
  24. M as M2,
  25. b as b2,
  26. h,
  27. i,
  28. r as r2
  29. } from "./chunk-O3JQY77G.js";
  30. import {
  31. D,
  32. b,
  33. d
  34. } from "./chunk-V6P2MAQQ.js";
  35. import {
  36. o,
  37. r,
  38. t
  39. } from "./chunk-YXWMMD76.js";
  40. // node_modules/@arcgis/core/views/2d/engine/ImageryBitmapSource.js
  41. var i2 = class {
  42. constructor(e2, t3, i3) {
  43. this.pixelBlock = e2, this.extent = t3, this.originalPixelBlock = i3;
  44. }
  45. get width() {
  46. return r(this.pixelBlock) ? this.pixelBlock.width : 0;
  47. }
  48. get height() {
  49. return r(this.pixelBlock) ? this.pixelBlock.height : 0;
  50. }
  51. render(e2) {
  52. const i3 = this.pixelBlock;
  53. if (t(i3))
  54. return;
  55. const l = this.filter({ pixelBlock: i3 });
  56. if (t(l.pixelBlock))
  57. return;
  58. const r5 = l.pixelBlock.getAsRGBA(), o2 = e2.createImageData(l.pixelBlock.width, l.pixelBlock.height);
  59. o2.data.set(r5), e2.putImageData(o2, 0, 0);
  60. }
  61. getRenderedRasterPixels() {
  62. const e2 = this.filter({ pixelBlock: this.pixelBlock });
  63. return t(e2.pixelBlock) ? null : { width: e2.pixelBlock.width, height: e2.pixelBlock.height, renderedRasterPixels: new Uint8Array(e2.pixelBlock.getAsRGBA().buffer) };
  64. }
  65. };
  66. // node_modules/@arcgis/core/views/2d/engine/Bitmap.js
  67. function S(t3) {
  68. return t3 && "render" in t3;
  69. }
  70. function T(t3) {
  71. const e2 = document.createElement("canvas");
  72. return e2.width = t3.width, e2.height = t3.height, t3.render(e2.getContext("2d")), e2;
  73. }
  74. function v(t3) {
  75. return S(t3) ? t3 instanceof i2 ? o(t3.getRenderedRasterPixels(), (t4) => t4.renderedRasterPixels) : T(t3) : t3;
  76. }
  77. var R = class extends r4 {
  78. constructor(t3 = null, e2) {
  79. var _a, _b;
  80. super(), this.blendFunction = "standard", this._sourceWidth = 0, this._sourceHeight = 0, this._textureInvalidated = false, this.stencilRef = 0, this.coordScale = [1, 1], this._height = void 0, this.pixelRatio = 1, this.resolution = 0, this.rotation = 0, this._source = null, this._width = void 0, this.x = 0, this.y = 0, this.immutable = (_a = e2.immutable) != null ? _a : false, this.requestRenderOnSourceChangedEnabled = (_b = e2.requestRenderOnSourceChangedEnabled) != null ? _b : true, this.source = t3, this.requestRender = this.requestRender.bind(this);
  81. }
  82. destroy() {
  83. this._texture && (this._texture.dispose(), this._texture = null), r(this._uploadStatus) && (this._uploadStatus.controller.abort(), this._uploadStatus = null);
  84. }
  85. get isSourceScaled() {
  86. return this.width !== this._sourceWidth || this.height !== this._sourceHeight;
  87. }
  88. get height() {
  89. return void 0 !== this._height ? this._height : this._sourceHeight;
  90. }
  91. set height(t3) {
  92. this._height = t3;
  93. }
  94. get source() {
  95. return this._source;
  96. }
  97. set source(t3) {
  98. null == t3 && null == this._source || (this._source = t3, this._source instanceof HTMLImageElement ? (this._sourceHeight = this._source.naturalHeight, this._sourceWidth = this._source.naturalWidth) : (this._sourceHeight = this._source.height, this._sourceWidth = this._source.width), this.invalidateTexture());
  99. }
  100. get width() {
  101. return void 0 !== this._width ? this._width : this._sourceWidth;
  102. }
  103. set width(t3) {
  104. this._width = t3;
  105. }
  106. beforeRender(t3) {
  107. super.beforeRender(t3), this.updateTexture(t3);
  108. }
  109. async setSourceAsync(e2, r5) {
  110. r(this._uploadStatus) && this._uploadStatus.controller.abort();
  111. const h2 = new AbortController(), o2 = D();
  112. return d(r5, () => h2.abort()), d(h2, (t3) => o2.reject(t3)), this._uploadStatus = { controller: h2, resolver: o2 }, this.source = e2, o2.promise;
  113. }
  114. invalidateTexture() {
  115. this._textureInvalidated || (this._textureInvalidated = true, this.requestRenderOnSourceChangedEnabled && this.requestRender());
  116. }
  117. updateTransitionProperties(t3, e2) {
  118. t3 >= 64 && (this.fadeTransitionEnabled = false, this.inFadeTransition = false), super.updateTransitionProperties(t3, e2);
  119. }
  120. setTransform(t3) {
  121. const e2 = r2(this.transforms.dvs), [s, i3] = t3.toScreenNoRotation([0, 0], [this.x, this.y]), r5 = this.resolution / this.pixelRatio / t3.resolution, d2 = r5 * this.width, c = r5 * this.height, _ = Math.PI * this.rotation / 180;
  122. M2(e2, e2, t2(s, i3)), M2(e2, e2, t2(d2 / 2, c / 2)), h(e2, e2, -_), M2(e2, e2, t2(-d2 / 2, -c / 2)), b2(e2, e2, t2(d2, c)), i(this.transforms.dvs, t3.displayViewMat3, e2);
  123. }
  124. setSamplingProfile(t3) {
  125. this._texture && (t3.mips && !this._texture.descriptor.hasMipmap && this._texture.generateMipmap(), this._texture.setSamplingMode(t3.samplingMode));
  126. }
  127. bind(t3, e2) {
  128. this._texture && t3.bindTexture(this._texture, e2);
  129. }
  130. async updateTexture({ context: e2, painter: s }) {
  131. if (!this._textureInvalidated)
  132. return;
  133. if (this._textureInvalidated = false, this._texture || (this._texture = this._createTexture(e2)), !this.source)
  134. return void this._texture.setData(null);
  135. this._texture.resize(this._sourceWidth, this._sourceHeight);
  136. const i3 = v(this.source);
  137. try {
  138. if (r(this._uploadStatus)) {
  139. const { controller: t3, resolver: e3 } = this._uploadStatus, r5 = { signal: t3.signal }, { width: h2, height: o2 } = this, u = this._texture, a = s.textureUploadManager;
  140. await a.enqueueTextureUpdate({ data: i3, texture: u, width: h2, height: o2 }, r5), e3.resolve(), this._uploadStatus = null;
  141. } else
  142. this._texture.setData(i3);
  143. this.ready();
  144. } catch (h2) {
  145. b(h2);
  146. }
  147. }
  148. onDetach() {
  149. this.destroy();
  150. }
  151. _createTransforms() {
  152. return { dvs: e() };
  153. }
  154. _createTexture(t3) {
  155. const e2 = this.immutable && t3.type === r3.WEBGL2;
  156. return new E(t3, { target: M.TEXTURE_2D, pixelFormat: P.RGBA, internalFormat: e2 ? U.RGBA8 : P.RGBA, dataType: G.UNSIGNED_BYTE, wrapMode: D2.CLAMP_TO_EDGE, isImmutable: e2, width: this._sourceWidth, height: this._sourceHeight });
  157. }
  158. };
  159. export {
  160. i2 as i,
  161. S,
  162. T,
  163. R
  164. };
  165. //# sourceMappingURL=chunk-O6KMIRUU.js.map