|
| 1 | +import { |
| 2 | + l4 as g, |
| 3 | + ir as z, |
| 4 | + ez as v, |
| 5 | + eG as O, |
| 6 | + eE as M, |
| 7 | + l5 as V, |
| 8 | + l6 as D, |
| 9 | + kh as E, |
| 10 | + l7 as I, |
| 11 | + l8 as $, |
| 12 | + jT as k, |
| 13 | + l9 as w, |
| 14 | + eF as b, |
| 15 | + f8 as C, |
| 16 | + la as F, |
| 17 | +} from './index.lazy-BFilFZ3v.js'; |
| 18 | +import { i as L, r as N, n as T } from './TechniqueInstance-ORh6ZjaS.js'; |
| 19 | +import { j as u } from './FeatureCommandQueue-BbqTKNbG.js'; |
| 20 | +import { r as P } from './vec3f32-nZdmKIgz.js'; |
| 21 | +import { e as U } from './Container-JJ8D-RVy.js'; |
| 22 | +import { $ as j } from './dataViewUtils-Dzpw_nGB.js'; |
| 23 | +import { E as x, o as H } from './VertexArrayObject-B9LXzLl2.js'; |
| 24 | +let W = 0; |
| 25 | +function c(f, e) { |
| 26 | + return new L(N(W++), f, e); |
| 27 | +} |
| 28 | +const h = { |
| 29 | + visualVariableColor: null, |
| 30 | + visualVariableOpacity: null, |
| 31 | + visualVariableSizeMinMaxValue: null, |
| 32 | + visualVariableSizeScaleStops: null, |
| 33 | + visualVariableSizeStops: null, |
| 34 | + visualVariableSizeUnitValue: null, |
| 35 | + visualVariableRotation: null, |
| 36 | + visualVariableSizeOutlineScaleStops: null, |
| 37 | +}; |
| 38 | +class q { |
| 39 | + constructor() { |
| 40 | + (this.instances = { |
| 41 | + fill: c(u.fill, { uniforms: h, optionalAttributes: { zoomRange: !0 } }), |
| 42 | + marker: c(u.marker, { uniforms: h, optionalAttributes: { zoomRange: !0 } }), |
| 43 | + line: c(u.line, { uniforms: h, optionalAttributes: { zoomRange: !0 } }), |
| 44 | + text: c(u.text, { |
| 45 | + uniforms: h, |
| 46 | + optionalAttributes: { zoomRange: !0, referenceSymbol: !1, clipAngle: !1 }, |
| 47 | + }), |
| 48 | + complexFill: c(u.complexFill, { uniforms: h, optionalAttributes: { zoomRange: !0 } }), |
| 49 | + gradientFill: c(u.gradientFill, { uniforms: h, optionalAttributes: { zoomRange: !0 } }), |
| 50 | + texturedLine: c(u.texturedLine, { uniforms: h, optionalAttributes: { zoomRange: !0 } }), |
| 51 | + gradientStroke: c(u.gradientStroke, { uniforms: h, optionalAttributes: { zoomRange: !0 } }), |
| 52 | + animatedMarker: c(u.animatedMarker, { uniforms: h, optionalAttributes: { zoomRange: !0 } }), |
| 53 | + }), |
| 54 | + (this._instancesById = Object.values(this.instances).reduce( |
| 55 | + (e, t) => (e.set(t.instanceId, t), e), |
| 56 | + new Map(), |
| 57 | + )); |
| 58 | + } |
| 59 | + getInstance(e) { |
| 60 | + return this._instancesById.get(e); |
| 61 | + } |
| 62 | +} |
| 63 | +const G = Math.PI / 180, |
| 64 | + Y = 4; |
| 65 | +class J extends U { |
| 66 | + constructor(e) { |
| 67 | + super(), |
| 68 | + (this._program = null), |
| 69 | + (this._vao = null), |
| 70 | + (this._vertexBuffer = null), |
| 71 | + (this._indexBuffer = null), |
| 72 | + (this._dvsMat3 = g()), |
| 73 | + (this._localOrigin = { x: 0, y: 0 }), |
| 74 | + (this._getBounds = e); |
| 75 | + } |
| 76 | + destroy() { |
| 77 | + this._vao && |
| 78 | + (this._vao.dispose(), |
| 79 | + (this._vao = null), |
| 80 | + (this._vertexBuffer = null), |
| 81 | + (this._indexBuffer = null)), |
| 82 | + (this._program = z(this._program)); |
| 83 | + } |
| 84 | + doRender(e) { |
| 85 | + const { context: t } = e, |
| 86 | + r = this._getBounds(); |
| 87 | + if (r.length < 1) return; |
| 88 | + this._createShaderProgram(t), |
| 89 | + this._updateMatricesAndLocalOrigin(e), |
| 90 | + this._updateBufferData(t, r), |
| 91 | + t.setBlendingEnabled(!0), |
| 92 | + t.setDepthTestEnabled(!1), |
| 93 | + t.setStencilWriteMask(0), |
| 94 | + t.setStencilTestEnabled(!1), |
| 95 | + t.setBlendFunction(v.ONE, v.ONE_MINUS_SRC_ALPHA), |
| 96 | + t.setColorMask(!0, !0, !0, !0); |
| 97 | + const s = this._program; |
| 98 | + t.bindVAO(this._vao), |
| 99 | + t.useProgram(s), |
| 100 | + s.setUniformMatrix3fv('u_dvsMat3', this._dvsMat3), |
| 101 | + t.gl.lineWidth(1), |
| 102 | + t.drawElements(O.LINES, 8 * r.length, M.UNSIGNED_INT, 0), |
| 103 | + t.bindVAO(); |
| 104 | + } |
| 105 | + _createTransforms() { |
| 106 | + return { displayViewScreenMat3: g() }; |
| 107 | + } |
| 108 | + _createShaderProgram(e) { |
| 109 | + if (this._program) return; |
| 110 | + const t = `precision highp float; |
| 111 | + uniform mat3 u_dvsMat3; |
| 112 | +
|
| 113 | + attribute vec2 a_position; |
| 114 | +
|
| 115 | + void main() { |
| 116 | + mediump vec3 pos = u_dvsMat3 * vec3(a_position, 1.0); |
| 117 | + gl_Position = vec4(pos.xy, 0.0, 1.0); |
| 118 | + }`, |
| 119 | + r = `precision mediump float; |
| 120 | + void main() { |
| 121 | + gl_FragColor = vec4(0.75, 0.0, 0.0, 0.75); |
| 122 | + }`; |
| 123 | + this._program = e.programCache.acquire(t, r, S().attributes); |
| 124 | + } |
| 125 | + _updateMatricesAndLocalOrigin(e) { |
| 126 | + const { state: t } = e, |
| 127 | + { displayMat3: r, size: s, resolution: _, pixelRatio: a, rotation: o, viewpoint: i } = t, |
| 128 | + l = G * o, |
| 129 | + { x: n, y: R } = i.targetGeometry, |
| 130 | + y = V(n, t.spatialReference); |
| 131 | + (this._localOrigin.x = y), (this._localOrigin.y = R); |
| 132 | + const p = a * s[0], |
| 133 | + m = a * s[1], |
| 134 | + A = _ * p, |
| 135 | + B = _ * m, |
| 136 | + d = D(this._dvsMat3); |
| 137 | + E(d, d, r), I(d, d, $(p / 2, m / 2)), k(d, d, P(s[0] / A, -m / B, 1)), w(d, d, -l); |
| 138 | + } |
| 139 | + _updateBufferData(e, t) { |
| 140 | + const { x: r, y: s } = this._localOrigin, |
| 141 | + _ = 2 * Y * t.length, |
| 142 | + a = new Float32Array(_), |
| 143 | + o = new Uint32Array(8 * t.length); |
| 144 | + let i = 0, |
| 145 | + l = 0; |
| 146 | + for (const n of t) |
| 147 | + n && |
| 148 | + ((a[2 * i] = n[0] - r), |
| 149 | + (a[2 * i + 1] = n[1] - s), |
| 150 | + (a[2 * i + 2] = n[0] - r), |
| 151 | + (a[2 * i + 3] = n[3] - s), |
| 152 | + (a[2 * i + 4] = n[2] - r), |
| 153 | + (a[2 * i + 5] = n[3] - s), |
| 154 | + (a[2 * i + 6] = n[2] - r), |
| 155 | + (a[2 * i + 7] = n[1] - s), |
| 156 | + (o[l] = i + 0), |
| 157 | + (o[l + 1] = i + 3), |
| 158 | + (o[l + 2] = i + 3), |
| 159 | + (o[l + 3] = i + 2), |
| 160 | + (o[l + 4] = i + 2), |
| 161 | + (o[l + 5] = i + 1), |
| 162 | + (o[l + 6] = i + 1), |
| 163 | + (o[l + 7] = i + 0), |
| 164 | + (i += 4), |
| 165 | + (l += 8)); |
| 166 | + if ( |
| 167 | + (this._vertexBuffer |
| 168 | + ? this._vertexBuffer.setData(a.buffer) |
| 169 | + : (this._vertexBuffer = x.createVertex(e, b.DYNAMIC_DRAW, a.buffer)), |
| 170 | + this._indexBuffer |
| 171 | + ? this._indexBuffer.setData(o) |
| 172 | + : (this._indexBuffer = x.createIndex(e, b.DYNAMIC_DRAW, o)), |
| 173 | + !this._vao) |
| 174 | + ) { |
| 175 | + const n = S(); |
| 176 | + this._vao = new H( |
| 177 | + e, |
| 178 | + n.attributes, |
| 179 | + n.bufferLayouts, |
| 180 | + new Map([['geometry', this._vertexBuffer]]), |
| 181 | + this._indexBuffer, |
| 182 | + ); |
| 183 | + } |
| 184 | + } |
| 185 | +} |
| 186 | +const S = () => |
| 187 | + j('bounds', { geometry: [{ location: 0, name: 'a_position', count: 2, type: M.FLOAT }] }); |
| 188 | +class re extends T { |
| 189 | + constructor(e) { |
| 190 | + super(e), (this._instanceStore = new q()), (this.checkHighlight = () => !0); |
| 191 | + } |
| 192 | + destroy() { |
| 193 | + super.destroy(), (this._boundsRenderer = C(this._boundsRenderer)); |
| 194 | + } |
| 195 | + get instanceStore() { |
| 196 | + return this._instanceStore; |
| 197 | + } |
| 198 | + enableRenderingBounds(e) { |
| 199 | + (this._boundsRenderer = new J(e)), this.requestRender(); |
| 200 | + } |
| 201 | + get hasHighlight() { |
| 202 | + return this.checkHighlight(); |
| 203 | + } |
| 204 | + onTileData(e, t) { |
| 205 | + e.onMessage(t), this.contains(e) || this.addChild(e), this.requestRender(); |
| 206 | + } |
| 207 | + _renderChildren(e, t) { |
| 208 | + e.selection = t; |
| 209 | + for (const r of this.children) { |
| 210 | + if (!r.visible) continue; |
| 211 | + const s = r.getDisplayList(this._instanceStore, F.STRICT_ORDER); |
| 212 | + s == null || s.render(e); |
| 213 | + } |
| 214 | + } |
| 215 | +} |
| 216 | +export { re as i }; |
0 commit comments