@arcgis/core 6.0.0-next.34 → 6.0.0-next.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Basemap.d.ts +2 -2
- package/analysis/ShadowCastAnalysis.d.ts +11 -5
- package/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/libs/libtess/libtess-f32.wasm +0 -0
- package/assets/esri/core/libs/libtess/libtess-f64.wasm +0 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/01f55004d64309f8538b.js +1 -0
- package/assets/esri/core/workers/chunks/0202eb8c2b2865f99981.js +1 -0
- package/assets/esri/core/workers/chunks/{67e533748435253aaba6.js → 0284f608d25c654fcc11.js} +1 -1
- package/assets/esri/core/workers/chunks/{7810586c35dfe1437516.js → 06102715e9a8f218e07c.js} +1 -1
- package/assets/esri/core/workers/chunks/{6029773458ab98600f67.js → 07e5482e1fc69be5de09.js} +1 -1
- package/assets/esri/core/workers/chunks/08140725277de5d2e41a.js +1 -0
- package/assets/esri/core/workers/chunks/{2d9a1f23ec6ce90723ac.js → 0d99bfb75dcb9fa29080.js} +1 -1
- package/assets/esri/core/workers/chunks/10ad7b35b6800d40444e.js +1 -0
- package/assets/esri/core/workers/chunks/1132e28aaa5825b10b6e.js +1 -0
- package/assets/esri/core/workers/chunks/{dd30b02c5978c1c5f511.js → 155861fbd0e5fc2db80c.js} +1 -1
- package/assets/esri/core/workers/chunks/165ca7a97b611c8f26c4.js +1 -0
- package/assets/esri/core/workers/chunks/1ae0c9345626e70affd3.js +2 -0
- package/assets/esri/core/workers/chunks/{cd355baab983033c3ef0.js → 1ec772eaa63eb6937231.js} +1 -1
- package/assets/esri/core/workers/chunks/{5c04835b0b52461183cd.js → 1fd82fcba2758741996a.js} +1 -1
- package/assets/esri/core/workers/chunks/21e1d423ee33f916547e.js +1 -0
- package/assets/esri/core/workers/chunks/{e8e54faf947a582b4cf7.js → 247617c0dbae2386ab3b.js} +1 -1
- package/assets/esri/core/workers/chunks/{97ec46605f16333144b7.js → 26ea39dfdf887f357fce.js} +1 -1
- package/assets/esri/core/workers/chunks/{85de980c5b296ec69323.js → 279089a6a3f08022c678.js} +1 -1
- package/assets/esri/core/workers/chunks/{b657363113f4a37e634b.js → 3223f9fbc76ba9ef8d13.js} +1 -1
- package/assets/esri/core/workers/chunks/322b22a5d54e404bebd5.js +1 -0
- package/assets/esri/core/workers/chunks/{122e75b21699a4e83b15.js → 338d800d4efcc91cead1.js} +1 -1
- package/assets/esri/core/workers/chunks/3537fe95b83a13b156cc.js +1 -0
- package/assets/esri/core/workers/chunks/{f09bc86cd52224febfcb.js → 3b380e64566a6cce59e2.js} +1 -1
- package/assets/esri/core/workers/chunks/{a1e8209d00809c9520a0.js → 3fe4c89acd325d36618d.js} +1 -1
- package/assets/esri/core/workers/chunks/449a2dee17b54946f245.js +1 -0
- package/assets/esri/core/workers/chunks/{311e4969f19df63451dd.js → 4e5405134d079bdf9b7a.js} +1 -1
- package/assets/esri/core/workers/chunks/{d070fcb73ce274ab80e4.js → 5504ec9bd9ee4d10af07.js} +1 -1
- package/assets/esri/core/workers/chunks/552c36b40e5a5ec117fb.js +1 -0
- package/assets/esri/core/workers/chunks/5622f3faa59434772857.js +1 -0
- package/assets/esri/core/workers/chunks/59a1b637d2c107504a04.js +1 -0
- package/assets/esri/core/workers/chunks/59a88dd53f8806bbec06.js +1 -0
- package/assets/esri/core/workers/chunks/5c2fe67527c9d7b4dba3.js +1 -0
- package/assets/esri/core/workers/chunks/5d781c2c6204cffffd0d.js +1 -0
- package/assets/esri/core/workers/chunks/61d36730564c5ac5edab.js +1 -0
- package/assets/esri/core/workers/chunks/6604272ef6fe85279032.js +1 -0
- package/assets/esri/core/workers/chunks/{90c1d10eae7ae71889b0.js → 7400b8c454b47ee4fb3c.js} +1 -1
- package/assets/esri/core/workers/chunks/796c6195b6bf59dcc9bd.js +1 -0
- package/assets/esri/core/workers/chunks/7b45ac83e279fe9516a5.js +1 -0
- package/assets/esri/core/workers/chunks/{2de077c7b971f2c215a6.js → 7ddbde8fdd1cf3c53f50.js} +1 -1
- package/assets/esri/core/workers/chunks/804606b194dc9e71d088.js +1 -0
- package/assets/esri/core/workers/chunks/8102f0bf5707c3be3310.js +1 -0
- package/assets/esri/core/workers/chunks/{676c8c0329d68f9f3ac4.js → 81bcc495e6eaf2cf7474.js} +1 -1
- package/assets/esri/core/workers/chunks/{d1d6154b4af1c9cc497b.js → 934e1f2153e6fad6ed23.js} +1 -1
- package/assets/esri/core/workers/chunks/{e096c1d9d53af74d3207.js → 990e96139b5a1dccb061.js} +1 -1
- package/assets/esri/core/workers/chunks/{f28b63c1179366dac8a2.js → 9e2c30b67bab5795306e.js} +1 -1
- package/assets/esri/core/workers/chunks/{9184c947cdefe06bf551.js → a18c3cbe505a19d29569.js} +1 -1
- package/assets/esri/core/workers/chunks/aa6ee2aa4ff6e6d41efb.js +1 -0
- package/assets/esri/core/workers/chunks/{3fd5c3cd8457ddc68798.js → aa779896fd9e5c341349.js} +1 -1
- package/assets/esri/core/workers/chunks/ac10c7d2c4829a150037.js +1 -0
- package/assets/esri/core/workers/chunks/{e0a7a75709121a26f255.js → afc8a9847f31bb66b13b.js} +1 -1
- package/assets/esri/core/workers/chunks/c7adb7b77721c75891f4.js +1 -0
- package/assets/esri/core/workers/chunks/{bead830a677690eeb6fb.js → ce8ef2eec290e1df6b2a.js} +1 -1
- package/assets/esri/core/workers/chunks/d3369ffed19f4c264dcd.js +1 -0
- package/assets/esri/core/workers/chunks/d3412518a7b518860fbb.js +1 -0
- package/assets/esri/core/workers/chunks/{3048e74e6246324ce6fc.js → d5916500514a41a4758f.js} +1 -1
- package/assets/esri/core/workers/chunks/{c034c30e577d620b8e28.js → dac69c0047488fdf986d.js} +1 -1
- package/assets/esri/core/workers/chunks/dcc782e4bf9e8a8202f9.js +1 -0
- package/assets/esri/core/workers/chunks/dcdf837a452dc0cac582.js +1 -0
- package/assets/esri/core/workers/chunks/{19a4fa965b70fc6f78f6.js → e209cb1f3f14bf576ebe.js} +1 -1
- package/assets/esri/core/workers/chunks/e67ea2f1714e5abeae44.js +1 -0
- package/assets/esri/core/workers/chunks/e8fb2ba7b7a4f0916325.js +1 -0
- package/assets/esri/core/workers/chunks/efcd38aad9aa667001b2.js +1 -0
- package/assets/esri/core/workers/chunks/{3aafdb905c697bc9b1ad.js → f372f4eb5527238c46f5.js} +1 -1
- package/assets/esri/core/workers/chunks/f497968055af459c5da4.js +1 -0
- package/assets/esri/core/workers/chunks/f7123ba1286f64e13e91.js +1 -0
- package/assets/esri/core/workers/chunks/fcb4707c2e95099b9f30.js +1 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/chunks/BlurEmission.glsl.js +9 -4
- package/chunks/Terrain.glsl.js +9 -9
- package/chunks/libtess-f32.js +1 -1
- package/chunks/libtess-f64.js +1 -1
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +2 -2
- package/config.d.ts +3 -3
- package/config.js +1 -1
- package/core/mathUtils.js +1 -1
- package/form/FormTemplate.d.ts +1 -1
- package/geometry/libtess.js +1 -1
- package/geometry/projection/projectors.js +1 -1
- package/identity/Credential.d.ts +1 -1
- package/identity/IdentityManager.d.ts +1 -1
- package/identity/OAuthInfo.d.ts +1 -1
- package/identity/ServerInfo.d.ts +1 -1
- package/kernel.js +1 -1
- package/layers/CSVLayer.js +1 -1
- package/layers/GaussianSplatLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/VectorTileLayer.d.ts +2 -2
- package/layers/VideoLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/sources/CSVSource.js +1 -1
- package/layers/graphics/sources/GeoJSONSource.js +1 -1
- package/layers/graphics/sources/MemorySource.js +2 -2
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/graphics/sources/support/QueryTask.js +1 -1
- package/layers/graphics/sources/support/timeQueryUtils.js +2 -0
- package/layers/mixins/APIKeyMixin.d.ts +1 -1
- package/layers/ogc/types.d.ts +1 -1
- package/layers/support/TelemetryData.d.ts +28 -4
- package/layers/support/TimeInformation.js +1 -1
- package/layers/support/tiles3DUtils.js +1 -1
- package/layers/support/timeInfoUtils.js +2 -0
- package/layers/video/videoUtils.js +1 -1
- package/package.json +2 -2
- package/rest/query/executeAttributeBinsQuery.js +1 -1
- package/rest/query/executeForExtent.js +1 -1
- package/rest/query/executeForTopCount.js +1 -1
- package/rest/query/executeForTopExtents.js +1 -1
- package/rest/query/executeForTopIds.js +1 -1
- package/rest/query/executeTopFeaturesQuery.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryAttributeBins.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/rest/support/timeUtils.js +1 -1
- package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/GlyphWorker.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/materialKeyUtils.js +2 -0
- package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedPolyMeshWriters.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/2d/layers/VideoLayerView2D.js +1 -1
- package/views/3d/analysis/ShadowCast/ShadowCastError.d.ts +40 -0
- package/views/3d/analysis/ShadowCast/ShadowCastError.js +2 -0
- package/views/3d/analysis/ShadowCast/sunlightUtils.js +2 -0
- package/views/3d/analysis/ShadowCastAnalysisView3D.d.ts +16 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/Lyr3DWorker.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/support/FeatureMemory.js +1 -1
- package/views/3d/layers/support/FeatureTile.js +1 -1
- package/views/3d/navigation/modes/GroundNavigationMode3D.js +1 -1
- package/views/3d/state/Constraints.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/state/utils/groundNavigationUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/sphereExtentUtils.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/tileUtils.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl.d.ts +1 -1
- package/views/support/Scheduler.js +1 -1
- package/widgets/Directions.d.ts +1 -1
- package/assets/esri/core/workers/chunks/0f6c0d42100c21367e5c.js +0 -1
- package/assets/esri/core/workers/chunks/176d0a06ebff5a29dedf.js +0 -1
- package/assets/esri/core/workers/chunks/18776a130d96879a68b1.js +0 -1
- package/assets/esri/core/workers/chunks/20a698709c3c11ff2c16.js +0 -1
- package/assets/esri/core/workers/chunks/24ada9511b074dc5ae27.js +0 -1
- package/assets/esri/core/workers/chunks/277263466837e1673f56.js +0 -1
- package/assets/esri/core/workers/chunks/2c8ca43563c4f3e94535.js +0 -1
- package/assets/esri/core/workers/chunks/379ef56f6b32494832a6.js +0 -1
- package/assets/esri/core/workers/chunks/38d852676677e5697864.js +0 -1
- package/assets/esri/core/workers/chunks/38df7b1d58c4bcf693d0.js +0 -1
- package/assets/esri/core/workers/chunks/507ecc3692e6d0700958.js +0 -1
- package/assets/esri/core/workers/chunks/5a9b7eb26f936f03d02e.js +0 -1
- package/assets/esri/core/workers/chunks/5f07f52bb8b7721f08d3.js +0 -1
- package/assets/esri/core/workers/chunks/661847f1b7044f21600f.js +0 -1
- package/assets/esri/core/workers/chunks/6b5c073dddd89d06ed80.js +0 -1
- package/assets/esri/core/workers/chunks/6ddc29a144640acb1192.js +0 -1
- package/assets/esri/core/workers/chunks/6ebe73f69ae822053b70.js +0 -1
- package/assets/esri/core/workers/chunks/6f6d1873753a9c6994aa.js +0 -1
- package/assets/esri/core/workers/chunks/7582654a0fc70910731c.js +0 -1
- package/assets/esri/core/workers/chunks/7e211d8a8ad6c6a7cf3e.js +0 -1
- package/assets/esri/core/workers/chunks/849f446c718e892f39ce.js +0 -1
- package/assets/esri/core/workers/chunks/8517d96fc8ba7b21d845.js +0 -2
- package/assets/esri/core/workers/chunks/a107f16cd004626b5018.js +0 -1
- package/assets/esri/core/workers/chunks/a65951f1d5702cfd996e.js +0 -1
- package/assets/esri/core/workers/chunks/bf62be00f3040f91aaee.js +0 -1
- package/assets/esri/core/workers/chunks/c570b90995c65bbb2e14.js +0 -1
- package/assets/esri/core/workers/chunks/c576bef77e34920af188.js +0 -1
- package/assets/esri/core/workers/chunks/caad4f475d6eb01c2850.js +0 -1
- package/assets/esri/core/workers/chunks/cf1ec61eb2ad147bb931.js +0 -1
- package/assets/esri/core/workers/chunks/daae21cf77864f3293ef.js +0 -1
- package/assets/esri/core/workers/chunks/dc2f93453dfa40f623ab.js +0 -1
- package/assets/esri/core/workers/chunks/e81173724e8de8c1e65b.js +0 -1
- package/assets/esri/core/workers/chunks/e83f9abee611c5b80009.js +0 -1
- package/assets/esri/core/workers/chunks/ec8b7476eac4718eb0ac.js +0 -1
- package/assets/esri/core/workers/chunks/f45064066e1ab041a0b2.js +0 -1
- package/assets/esri/core/workers/chunks/ffe49d9e7df081bef4a5.js +0 -1
- package/views/2d/engine/webgl/hashMosaic.js +0 -2
- /package/assets/esri/core/workers/chunks/{8517d96fc8ba7b21d845.js.LICENSE.txt → 1ae0c9345626e70affd3.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import{open as e}from"../../../../core/workers.js";import{decorGlyphRect as t}from"./decorGlyphRect.js";import{sdfBufferServer as n}from"./definitions.js";import r from"./Rect.js";import i from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";const o=new r(0,0,11,8),s=new r(11,0,11,8);class c{constructor(e,t,n,r){this._snapCoords=n,this.
|
|
2
|
+
import has from"../../../../core/has.js";import{open as e}from"../../../../core/workers.js";import{decorGlyphRect as t}from"./decorGlyphRect.js";import{sdfBufferServer as n}from"./definitions.js";import r from"./Rect.js";import i from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";const o=new r(0,0,11,8),s=new r(11,0,11,8);class c{constructor(e,t,n,r){this._snapCoords=n,this._setTextureKey=r,this.width=0,this.height=0,this._dirties=[],this._pageData=[],this._currentPage=0,this._textures=[],this._worker=this._load(),this.width=e,this.height=t,this._pageData.push(new Uint8Array(e*t)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){for(let e of this._textures)e&&e.dispose();this._textures.length=0,this._pageData.length=0,this._worker.then(e=>e.connection.close())}async openMessagePorts(){return(await this._worker).connection.openPorts()}async rasterizeText(e,t,n){return(await this._worker).worker.rasterizeText(e,t,n)}getTexture(e,t){if(!this._textures[t]){let n=new a(this.width,this.height);n.pixelFormat=6406,n.wrapMode=33071,this._textures[t]=new i(e,n,new Uint8Array(this.width*this.height))}return this._dirties[t]&&(this._textures[t].setData(this._pageData[t]),this._dirties[t]=!1),this._textures[t]}bind(e,t,n,r){let i=this.getTexture(e,n);i.setSamplingMode(t),e.bindTexture(i,r)}async _load(){let t=await e(`GlyphWorker`,{client:{getOptions:()=>({width:this.width,height:this.height,snapCoords:!!this._snapCoords}),recordGlyphs:e=>{let t=n;for(let n of e)n.sdf&&this.recordGlyph(n.mosaicItem,n.rect,n.sdf.buffer,t),this._setTextureKey&&n.mosaicItem.textureKey!==0&&this._setTextureKey(n.mosaicItem)}},strategy:`dedicated`});return{worker:t.createInvokeProxy(),connection:t}}_invalidate(){this._dirties[this._currentPage]=!0}recordGlyph(e,t,n,r){let{page:i,rect:a}=e;if(t.width===0)return;let o=t.width+r*2,s=t.height+r*2;this._pageData[i]||this._allocNewPage(i);let c=this._pageData[i];for(let e=0;e<s;e++){let t=o*e,r=this.width*(a.y+e)+a.x;for(let e=0;e<o;e++)c[r+e]=n[t+e]}has(`esri-glyph-debug`)&&this._showDebugPage(c),this._invalidate()}_allocNewPage(e){this._dirties[this._currentPage]||(this._pageData[this._currentPage]=null),this._currentPage=e,this._pageData[e]=new Uint8Array(this.width*this.height),this._dirties[e]=!0,this._textures[e]=null,this._initDecorationGlyphs()}_initDecorationGlyphs(){let e=[117,149,181,207,207,181,149,117],r=[],i=[];for(let t=0;t<e.length;t++){let n=e[t];for(let e=0;e<11;e++){let a=t>=3&&t<5&&e>=3&&e<8?255:0;r.push(n),i.push(a)}}let a=new Uint8Array(r),c={rect:o,page:this._currentPage,sdf:!0},l=new Uint8Array(i),u={rect:s,page:this._currentPage,sdf:!0};this.recordGlyph(c,t,a,n),this.recordGlyph(u,t,l,n)}_showDebugPage(e){let t=document.createElement(`canvas`),n=t.getContext(`2d`),r=new ImageData(this.width,this.height),i=r.data;t.width=this.width,t.height=this.height,t.style.border=`1px solid black`;for(let t=0;t<e.length;++t)i[t*4]=e[t],i[t*4+1]=0,i[t*4+2]=0,i[t*4+3]=255;n.putImageData(r,0,0),document.body.appendChild(t)}}export{c as GlyphMosaic};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../request.js";import{bidiText as t}from"../../../../core/BidiText.js";import{getFullyQualifiedFontName as n}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import r from"../../../../core/Logger.js";import{ignoreAbortErrors as i,throwIfNotAbortError as a}from"../../../../core/promiseUtils.js";import{loadTextModule as o}from"../../../../libs/librust-text/loadTextModule.js";import{parseRichTextRuns as s}from"../../../../symbols/cim/richTextUtils.js";import{decorGlyphRect as c}from"./decorGlyphRect.js";import{sdfRadiusComplex as l,sdfBufferGlyphSDFCreator as u,sdfSizeComplex as d,sdfBufferServer as f,sdfRadiusSimple as p,sdfSizeSimple as m}from"./definitions.js";import{GlyphSDFCreator as h}from"./GlyphSDFCreator.js";import g from"./GlyphSource.js";import{
|
|
2
|
+
import e from"../../../../request.js";import{bidiText as t}from"../../../../core/BidiText.js";import{getFullyQualifiedFontName as n}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import r from"../../../../core/Logger.js";import{ignoreAbortErrors as i,throwIfNotAbortError as a}from"../../../../core/promiseUtils.js";import{loadTextModule as o}from"../../../../libs/librust-text/loadTextModule.js";import{parseRichTextRuns as s}from"../../../../symbols/cim/richTextUtils.js";import{decorGlyphRect as c}from"./decorGlyphRect.js";import{sdfRadiusComplex as l,sdfBufferGlyphSDFCreator as u,sdfSizeComplex as d,sdfBufferServer as f,sdfRadiusSimple as p,sdfSizeSimple as m}from"./definitions.js";import{GlyphSDFCreator as h}from"./GlyphSDFCreator.js";import g from"./GlyphSource.js";import{createTextureKey as _}from"./materialKeyUtils.js";import v from"./Rect.js";import y from"./RectangleBinPack.js";const b=`arial-unicode-ms-regular`,x=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,S=new Set([`Noto Sans Khmer`,`Noto Sans Lao`,`Noto Sans Myanmar`,`Noto Sans Thai`]),C=()=>r.getLogger(`esri.views.MapView`),w=(e,t=``)=>C().warnOnce(e,t);class T{constructor(){this._glyphSources=new Map,this._snapCoords=!0,this._currentPage=0,this._faces=new Map,this._facePromises=new Map,this._pbfRangePromises=new Map,this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._invalidFonts=new Set,this._preloadCache={},this._glyphSDFCreator=new h({sdfSizePx:d,sdfBufferPx:u,radius:l,cutoff:.25})}set remoteClient(e){this._client=e.createInvokeProxy();let t=i(this._client.getOptions());this._inited=this._init(t)}async rasterizeText(e,t,n){await this._inited;let r=t.symbol?s(t):null;return r?{type:`rich-glyphs`,runs:(await Promise.all(r.map(async t=>({fontSize:t.fontSize,characterSpacing:t.characterSpacing,decoration:t.font.decoration,color:t.color,glyphs:await this._rasterizeTextRun(e,t.font,t.text,n)})))).filter(e=>e.glyphs!=null)}:this._rasterizeTextRun(e,t.font,t.textString,n)}async _rasterizeTextRun(e,t,r,i){let a=n(t),o=this._invalidFonts.has(a),s=!!has(`esri-2d-force-complex-shaping`),c=!!has(`esri-2d-complex-shaping`)&&x.test(r),l=S.has(t.family),u=s||c||l,d=o?b:a,f=await this.getGlyphItems(r,u,e,d,!1,i);return f||=(w(`Font ${a} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(a),await this.getGlyphItems(r,u,e,b,!1,i)),f}async getGlyphItems(e,n,r,i,a,o){await this._inited;let s=this._getSource(r),c=n?d:m,h=n?l:p,g=n?u:f,_,v,y;if(has(`esri-2d-stabilize-glyphs`)&&await this.preloadASCIIGlyphCache(s,i).catch(()=>{}),n){let t=await this._getFace(s,i);if(!t)return null;let n=this._glyphCache.get(i);n||(n=new Map,this._glyphCache.set(i,n));let{shaping:r,isRTL:a}=this._shape(t,e);y=a,_=r.map(e=>this._getShapedGlyph(t,n,e)),v={baseline:t.baseline()/c,midline:t.midline()/c}}else{let n=this._pbfGlyphCache.get(i);n||(n=new Map,this._pbfGlyphCache.set(i,n));let[r,c,l]=t(e),u=k(r);try{await this._fetchRanges(s,i,u,o)}catch{return null}y=c,_=u.map(e=>this._getPBFGlyph(n,s,i,e,a)).filter(e=>!!e)}let b=_.filter(e=>e.needsRecord);return b.length>0&&await this._client.recordGlyphs(b),{type:`glyphs`,glyphs:_,faceInfo:v,isRightToLeft:y,sdfSize:c,sdfRadius:h,sdfPadding:g}}async _init(e){let t=await e;if(!t)return;let{width:n,height:r,snapCoords:i}=t;this._glyphCache=new Map,this._pbfGlyphCache=new Map,this._binPack=new y(n,r),this._snapCoords=i,this._currentPage=0,this._initDecorationGlyphs()}_getShapedGlyph(e,t,n){let r,i,a=t.get(n.glyphId);if(!a){r=this._glyphSDFCreator.draw(e,n.glyphId);let o=this._glyphSDFCreator.sdfBufferPx;a={mosaicItem:{rect:this._recordGlyph(r?.rect,o),page:this._currentPage,sdf:!0,textureKey:_(1,this._currentPage,!0)},glyphRect:r?.rect??{width:0,height:0,top:0,left:0}},t.set(n.glyphId,a),i=!0}return{mosaicItem:a.mosaicItem,rect:a.glyphRect,shaping:{xAdvance:n.xAdvance,yAdvance:n.yAdvance,xOffset:n.xOffset,yOffset:n.yOffset},code:n.isNewline?10:n.isWhitespace?32:NaN,sdf:r,needsRecord:i}}_getPBFGlyph(e,t,n,r,i=!1){let a,o,s=e.get(r);if(!s){let c=t.getRange(n,r),l=c?.getRect(r),d=c?.getShaping(r),f=c?.getBitmap(r);if(i&&(!l||!d))return;if(!l||!d)return O(r);let p={rect:f?this._recordGlyph(l,u):new v(0,0,0,0),sdf:!0,page:this._currentPage,textureKey:_(1,this._currentPage,!0)};a=f&&{buffer:f,rect:l},s={mosaicItem:p,rect:l,shaping:d,code:r},o=!0,e.set(r,s)}let{mosaicItem:c,rect:l,shaping:d}=s;return{mosaicItem:c,rect:l,shaping:d,code:r,sdf:a,needsRecord:o}}_shape(e,n){let r=this._glyphSDFCreator.sdfSizePx,[i,a,o]=t(n,!1),s=new Uint32Array(Array.from(i).map((e,t)=>o.levels[o.targetToSource[t]]));return{shaping:e.shape(i,s,r),isRTL:a}}async _getFace(t,n,r){if(this._faces.has(n))return this._faces.get(n);let i=t.woffURL(n);return await D(this._facePromises,n,async()=>{let t=await e(i,{responseType:`array-buffer`,...r}),a=(await o()).Face.parseWoff2(new Uint8Array(t.data));this._faces.set(n,a)}),this._faces.get(n)}_getSource(e){return this._glyphSources.has(e)||this._glyphSources.set(e,new g(e)),this._glyphSources.get(e)}async _fetchRanges(e,t,n,r){let i=E(n),a=[];i.forEach(n=>{a.push(this._fetchRange(e,t,n,r))}),await Promise.all(a)}async _fetchRange(e,t,n,r){if(n>256)return;let i=t+n;return D(this._pbfRangePromises,i,()=>e.fetchRange(t,n,r))}_allocNewPage(){this._currentPage++,this._binPack=new y(this._binPack.width,this._binPack.height),this._initDecorationGlyphs()}_recordGlyph(e,t){let n=this._binPack;if(!e||e.width===0)return new v;let r=e.width+t*2,i=e.height+t*2,a=r,o=i;if(this._snapCoords){let e=r%4?4-r%4:4,t=i%4?4-i%4:4;a+=e,o+=t}let s=n.allocate(a,o);return s.isEmpty?(this._allocNewPage(),n.allocate(a,o)):s}_initDecorationGlyphs(){this._recordGlyph(c,f),this._recordGlyph(c,f)}preloadASCIIGlyphCache(e,t){let n=this._preloadCache[t];if(n!=null)return n;let r=e.preloadASCIIRange(t).then(async()=>{let n=this._pbfGlyphCache.get(t);n||(n=new Map,this._pbfGlyphCache.set(t,n));let r=[];for(let i=0;i<256;i++){let a=this._getPBFGlyph(n,e,t,i);a?.needsRecord&&r.push(a)}await this._client.recordGlyphs(r)},e=>{throw delete this._preloadCache[t],e});return this._preloadCache[t]=r,r}}function E(e){let t=new Set;for(let n of e)t.add(Math.floor(n/256));return t}function D(e,t,n){return e.has(t)||e.set(t,n().finally(()=>{e.delete(t)}).catch(e=>{a(e)})),e.get(t)}const O=e=>({mosaicItem:{rect:new v(0,0,0,0),sdf:!0,page:0,textureKey:_(1,0,!0)},rect:{left:0,width:0,height:0,top:0},shaping:{xAdvance:0,yAdvance:0,xOffset:0,yOffset:0},code:e,needsRecord:!0});function k(e){let t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t}export{T as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../config.js";import t from"../../../../request.js";import n from"../../../../core/Error.js";import r from"../../../../core/Logger.js";import{throwIfAborted as i,isAbortError as a}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{numericHash as c}from"../../../../core/string.js";import l from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as u}from"../../../../symbols/cim/CIMSymbolHelper.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/dashUtils.js";import f from"../../../../symbols/cim/Rasterizer.js";import{svgSdfTextureInnerSize as p,textureBindingGlyphAtlas as m,textureBindingSpriteAtlas as h}from"./definitions.js";import{GlyphMosaic as g}from"./GlyphMosaic.js";import{hashMosaic as _}from"./hashMosaic.js";import v from"./Rect.js";import y from"./SDFConverter.js";import b from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as x}from"./urlUtils.js";import{AnimatableTextureResource as S}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as C}from"./animations/store/AnimationStore.js";const w=()=>r.getLogger(`esri.views.MapView`),T=(e,t,r)=>w().error(new n(e,t,r));class E{static fromMosaic(e,t){return new E(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,n,r){this.mosaicType=e,this.page=t,this.sdf=n,this.samplingMode=r}}class D{constructor(r){this._requestRender=r,this._resourceManager=new l,this._sdfConverter=new y(p),this._hashToBindingInfo=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new o({concurrency:10,process:async(e,r)=>{i(r);try{return await t(e,{responseType:`image`,signal:r})}catch(t){throw a(t)?t:new n(`mapview-invalid-resource`,`Could not fetch requested resource at ${e}`,t)}}}),this.animationStore=new C,this._spriteMosaic=new b(2048,2048,500),this._glyphMosaic=new g(1024,1024,!1,e=>this._setTextureBinding(1,e)),this._rasterizer=new f(this.resourceManager),this._baseUrl=`${e.fontsUrl}/{fontstack}/{range}.pbf`}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingInfo.clear(),this._hashToBindingInfo=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}openMessagePorts(){return this._glyphMosaic.openMessagePorts()}async rasterizeItem(e,t){if(e==null)return T(`mapview-null-resource`,`Unable to rasterize null resource`),null;if(e.type===`animation-info`){let{resource:t}=e,{location:n}=this.animationStore.add(t);return{rect:new v(n.column,n.row,t.length,1),page:n.page,textureBinding:1,type:`sprite`,width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:`Linear`,sdfDecodeCoeff:1,simplePattern:!1}}if(e.type!==`cim-rasterization-info`)return T(`mapview-unexpected-resource`,`Unable to rasterize resource`),null;let{resource:n}=e;if(n.type===`text`){let e=await this._rasterizeText(n,t);return this._forEachGlyphItem(e,e=>this._setTextureBinding(1,e.mosaicItem)),e}let r=await this._rasterizeSprite(n,t);return r&&this._setTextureBinding(0,r),r}getBindingInfo(e,t,n){let{context:r}=e,i=this._hashToBindingInfo.get(t);if(!i)return T(`mapview-texture-manager`,`Could not find binding info for textureKey ${t}!`),{mosaicInfo:{size:[0,0]},mosaicTexture:null};let a=i.page,o=i.samplingMode===`Nearest`?9728:n?9987:9729,s,c,l;if(i.mosaicType===0)c=this._spriteMosaic.getTexture(e,a),l=h,s=this._spriteMosaic.getSize(a);else if(i.mosaicType===1)c=this._glyphMosaic.getTexture(r,a),l=m,s=[this.glyphs.width,this.glyphs.height],this._glyphMosaic.bind(r,o,a,m);else return T(`mapview-texture-manager`,`Cannot handle unknown type ${i.mosaicType}`),{mosaicInfo:{size:[0,0]},mosaicTexture:null};return c.setSamplingMode(o),{mosaicInfo:{size:s},mosaicTexture:{texture:c,unit:l}}}_setTextureBinding(e,t){let{sdf:n,samplingMode:r,page:i}=t,a=_(e,i,!!n,r);if(!this._hashToBindingInfo.has(a)){let n=E.fromMosaic(e,t);this._hashToBindingInfo.set(a,n)}return t.textureBinding=a,a}async _rasterizeText(e,t){return this._glyphMosaic.rasterizeText(this._baseUrl,e,t)}_forEachGlyphItem(e,t){if(e){if(e.type===`glyphs`)e.glyphs.forEach(t);else for(let n of e.runs)n.glyphs.glyphs.forEach(t)}}_hashSpriteResource(e){switch(e.type){case`path`:return`path:${e.path}.${+!!e.asFill}`;case`CIMPictureMarker`:return`${e.type}:${e.url}:${e.size}:${k(e.markerPlacement)}`;case`CIMPictureFill`:return`${e.type}:${e.url}:${e.height}`;case`CIMPictureStroke`:return`${e.type}:${e.url}:${e.width}`;case`dash`:return`dash:${e.capStyle}.${d(e.dashTemplate).join(``)}`;case`sdf`:return`sdf:${JSON.stringify(e.geometry)}.${e.sdfTextureSize}.${+!!e.asFill}`;case`fill-style`:return`fill_style:${e.style}`;case`animated`:return JSON.stringify(x(e));case`CIMGradientFill`:case`CIMGradientStroke`:return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case`CIMHatchFill`:case`CIMVectorMarker`:case`cim-point-symbol-halo`:return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;let n=c(this._hashSpriteResource(e));if(this._spriteMosaic.has(n))return this._spriteMosaic.getSpriteItem(n);if(`url`in e&&e.url&&e.type!==`animated`||e.type===`CIMPictureFill`||e.type===`CIMPictureStroke`||e.type===`CIMPictureMarker`||e.type===`CIMVectorMarker`||e.type===`cim-point-symbol-halo`){let t=e.type===`cim-point-symbol-halo`?e.symbol:{type:`CIMPointSymbol`,symbolLayers:[e]};await u.normalizeSymbolAndFetchResources(t,this._resourceManager)}switch(e.type){case`CIMPictureMarker`:return e.markerPlacement?.type===`CIMMarkerPlacementInsidePolygon`?this._rasterizeJSONResource(n,e):this._handleAsyncResource(n,e,t);case`animated`:return this._handleAsyncResource(n,e,t);case`CIMPictureFill`:case`CIMPictureStroke`:case`path`:return this._handleAsyncResource(n,e,t);case`CIMGradientFill`:case`CIMGradientStroke`:case`CIMHatchFill`:case`CIMVectorMarker`:case`cim-point-symbol-halo`:case`dash`:case`fill-style`:case`sdf`:return this._rasterizeJSONResource(n,e)}}_rasterizeJSONResource(e,t){let n=this._rasterizer.rasterizeJSONResource(t);if(n){let{size:r,image:i,sdf:a,simplePattern:o,rasterizationScale:s,samplingMode:c,sdfPaddingRatio:l,sdfDecodeCoeff:u}=n;return this._addItemToMosaic(e,r,{type:`static`,data:i},A(t),a,o,s,c,l,u)}return null}async _handleAsyncResource(e,t,n){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let r;return r=t.type===`path`?this._handleSVG(t,e,n):this._handleImage(t,e,n),this._ongoingRasterizations.set(e,r),r.finally(()=>this._ongoingRasterizations.delete(e)),r}async _handleSVG(e,t,n){let r=[p,p],{asFill:i}=e,a=await this._sdfConverter.draw(e.path,i,n);return this._addItemToMosaic(t,r,{type:`static`,data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,n){let r=e.url,i=this.resourceManager.getResource(r);if(i==null)return null;let{width:a,height:o}=i;if(i instanceof HTMLImageElement){if(e.type===`animated`)return T(`mapview-unexpected-resource`,`Attempt to configure animations for a non-animated image.`),null;let n=`colorSubstitutions`in e?e.colorSubstitutions:void 0,{size:r,sdf:s,image:c}=this._rasterizer.rasterizeImageResource(a,o,i,n);return this._addItemToMosaic(t,r,{type:`static`,data:c},A(e),s,!1)}let s,c,l;e.type===`animated`?(s=!1,c={type:`CIMAnimatedSymbolProperties`,playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},l=e.startGroup||0):(s=A(e),c={type:`CIMAnimatedSymbolProperties`,playAnimation:!0},l=0);let u=new S(i,this._requestRender,c,l);return this._addItemToMosaic(t,[u.width,u.height],{type:`animated`,data:u},s,!1,!1)}async _handleImage(e,t,r){let i=e.url;if(M(i)||P(i))return this._handleGIFOrPNG(e,t,r);if(e.type===`animated`)return T(`mapview-unexpected-resource`,`Attempt to configure animations for a non-animated image.`),null;try{let n,a=this.resourceManager.getResource(i);if(a!=null&&a instanceof HTMLImageElement)n=a;else{let{data:e}=await this._imageRequestQueue.push(i,{...r});n=e}if(O(i)){if(`width`in e&&`height`in e)n.width=s(e.width),n.height=s(e.height);else if(`cim`in e){let t=e;n.width=s(t.width??t.scaleX*t.size),n.height=s(t.size)}}if(!n.width||!n.height)return null;let o=n.width,c=n.height,l=`colorSubstitutions`in e?e.colorSubstitutions:void 0,{size:u,sdf:d,image:f}=this._rasterizer.rasterizeImageResource(o,c,n,l);return this._addItemToMosaic(t,u,{type:`static`,data:f},A(e),d,!1)}catch(e){throw a(e)?e:new n(`mapview-invalid-resource`,`Could not fetch requested resource at ${i}. ${e.message}`)}}_addItemToMosaic(e,t,n,r,i,a,o,s,c,l){return this._spriteMosaic.addSpriteItem(e,t,n,r,i,a,o,s,c,l)}}function O(e){return e.includes(`data:image/svg+xml`)}function k(e){if(e==null)return``;let{type:t}=e;switch(t){case`CIMMarkerPlacementAlongLineRandomSize`:return`${t}-${e.seed}-${e.randomization}`;case`CIMMarkerPlacementAlongLineVariableSize`:return`${t}-${e.maxRandomOffset}-${e.numberOfSizes}-${e.seed}-${e.variationMethod}`;case`CIMMarkerPlacementAtExtremities`:return`${t}-${e.extremityPlacement}-${e.offsetAlongLine}`;case`CIMMarkerPlacementAtRatioPositions`:return`${t}-${e.beginPosition}-${e.endPosition}-${e.flipFirst}-${JSON.stringify(e.positionArray)}`;case`CIMMarkerPlacementAtMeasuredUnits`:return`${t}-${e.interval}-${e.skipMarkerRate}-${e.placeAtExtremities}`;case`CIMMarkerPlacementInsidePolygon`:return`${t}-${e.stepX}-${e.stepY}-${e.randomness}-${e.gridType}-${e.seed}-${e.shiftOddRows}`;case`CIMMarkerPlacementOnLine`:return`${t}-${e.relativeTo}-${e.startPointOffset}`;case`CIMMarkerPlacementOnVertices`:return`${t}-${e.placeOnControlPoints}-${e.placeOnEndPoints}-${e.placeOnRegularVertices}`;case`CIMMarkerPlacementPolygonCenter`:return`${t}-${e.method}`;default:return`${t}`}}function A(e){switch(e.type){case`CIMVectorMarker`:case`CIMPictureMarker`:return F(e);case`cim-point-symbol-halo`:return!1;default:return!0}}const j=e=>e!=null&&e.startsWith(`data:image/gif`),M=e=>e&&(e.includes(`.gif`)||j(e)),N=e=>e!=null&&e.startsWith(`data:image/png`),P=e=>e&&(e.includes(`.png`)||N(e)),F=e=>e&&`markerPlacement`in e&&e.markerPlacement&&e.markerPlacement.type===`CIMMarkerPlacementInsidePolygon`;export{D as TextureManager};
|
|
2
|
+
import e from"../../../../config.js";import t from"../../../../request.js";import n from"../../../../core/Error.js";import r from"../../../../core/Logger.js";import{throwIfAborted as i,isAbortError as a}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{numericHash as c}from"../../../../core/string.js";import l from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as u}from"../../../../symbols/cim/CIMSymbolHelper.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/dashUtils.js";import f from"../../../../symbols/cim/Rasterizer.js";import{svgSdfTextureInnerSize as p,textureBindingGlyphAtlas as m,textureBindingSpriteAtlas as h}from"./definitions.js";import{GlyphMosaic as g}from"./GlyphMosaic.js";import{createTextureKey as _}from"./materialKeyUtils.js";import v from"./Rect.js";import y from"./SDFConverter.js";import b from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as x}from"./urlUtils.js";import{AnimatableTextureResource as S}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as C}from"./animations/store/AnimationStore.js";const w=()=>r.getLogger(`esri.views.MapView`),T=(e,t,r)=>w().error(new n(e,t,r));class E{static fromMosaic(e,t){return new E(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,n,r){this.mosaicType=e,this.page=t,this.sdf=n,this.samplingMode=r}}class D{constructor(r){this._requestRender=r,this._resourceManager=new l,this._sdfConverter=new y(p),this._textureKeyToBindingInfo=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new o({concurrency:10,process:async(e,r)=>{i(r);try{return await t(e,{responseType:`image`,signal:r})}catch(t){throw a(t)?t:new n(`mapview-invalid-resource`,`Could not fetch requested resource at ${e}`,t)}}}),this.animationStore=new C,this._spriteMosaic=new b(2048,2048,500),this._glyphMosaic=new g(1024,1024,!1,e=>this._setTextureKey(1,e)),this._rasterizer=new f(this.resourceManager),this._baseUrl=`${e.fontsUrl}/{fontstack}/{range}.pbf`}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._textureKeyToBindingInfo.clear(),this._textureKeyToBindingInfo=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}openMessagePorts(){return this._glyphMosaic.openMessagePorts()}async rasterizeItem(e,t){if(e==null)return T(`mapview-null-resource`,`Unable to rasterize null resource`),null;if(e.type===`animation-info`){let{resource:t}=e,{location:n}=this.animationStore.add(t);return{rect:new v(n.column,n.row,t.length,1),page:n.page,textureKey:_(0,0,!1),type:`sprite`,width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:`Linear`,sdfDecodeCoeff:1,simplePattern:!1}}if(e.type!==`cim-rasterization-info`)return T(`mapview-unexpected-resource`,`Unable to rasterize resource`),null;let{resource:n}=e;if(n.type===`text`){let e=await this._rasterizeText(n,t);return this._forEachGlyphItem(e,e=>this._setTextureKey(1,e.mosaicItem)),e}let r=await this._rasterizeSprite(n,t);return r&&this._setTextureKey(0,r),r}getBindingInfo(e,t,n){let{context:r}=e,i=this._textureKeyToBindingInfo.get(t);if(!i)return T(`mapview-texture-manager`,`Could not find binding info for textureKey ${t}!`),{mosaicInfo:{size:[0,0]},mosaicTexture:null};let a=i.page,o=i.samplingMode===`Nearest`?9728:n?9987:9729,s,c,l;if(i.mosaicType===0)c=this._spriteMosaic.getTexture(e,a),l=h,s=this._spriteMosaic.getSize(a);else if(i.mosaicType===1)c=this._glyphMosaic.getTexture(r,a),l=m,s=[this.glyphs.width,this.glyphs.height],this._glyphMosaic.bind(r,o,a,m);else return T(`mapview-texture-manager`,`Cannot handle unknown type ${i.mosaicType}`),{mosaicInfo:{size:[0,0]},mosaicTexture:null};return c.setSamplingMode(o),{mosaicInfo:{size:s},mosaicTexture:{texture:c,unit:l}}}_setTextureKey(e,t){let{sdf:n,samplingMode:r,page:i}=t,a=_(e,i,!!n,r);if(!this._textureKeyToBindingInfo.has(a)){let n=E.fromMosaic(e,t);this._textureKeyToBindingInfo.set(a,n)}return t.textureKey=a,a}async _rasterizeText(e,t){return this._glyphMosaic.rasterizeText(this._baseUrl,e,t)}_forEachGlyphItem(e,t){if(e){if(e.type===`glyphs`)e.glyphs.forEach(t);else for(let n of e.runs)n.glyphs.glyphs.forEach(t)}}_hashSpriteResource(e){switch(e.type){case`path`:return`path:${e.path}.${+!!e.asFill}`;case`CIMPictureMarker`:return`${e.type}:${e.url}:${e.size}:${k(e.markerPlacement)}`;case`CIMPictureFill`:return`${e.type}:${e.url}:${e.height}`;case`CIMPictureStroke`:return`${e.type}:${e.url}:${e.width}`;case`dash`:return`dash:${e.capStyle}.${d(e.dashTemplate).join(``)}`;case`sdf`:return`sdf:${JSON.stringify(e.geometry)}.${e.sdfTextureSize}.${+!!e.asFill}`;case`fill-style`:return`fill_style:${e.style}`;case`animated`:return JSON.stringify(x(e));case`CIMGradientFill`:case`CIMGradientStroke`:return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case`CIMHatchFill`:case`CIMVectorMarker`:case`cim-point-symbol-halo`:return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;let n=c(this._hashSpriteResource(e));if(this._spriteMosaic.has(n))return this._spriteMosaic.getSpriteItem(n);if(`url`in e&&e.url&&e.type!==`animated`||e.type===`CIMPictureFill`||e.type===`CIMPictureStroke`||e.type===`CIMPictureMarker`||e.type===`CIMVectorMarker`||e.type===`cim-point-symbol-halo`){let t=e.type===`cim-point-symbol-halo`?e.symbol:{type:`CIMPointSymbol`,symbolLayers:[e]};await u.normalizeSymbolAndFetchResources(t,this._resourceManager)}switch(e.type){case`CIMPictureMarker`:return e.markerPlacement?.type===`CIMMarkerPlacementInsidePolygon`?this._rasterizeJSONResource(n,e):this._handleAsyncResource(n,e,t);case`animated`:return this._handleAsyncResource(n,e,t);case`CIMPictureFill`:case`CIMPictureStroke`:case`path`:return this._handleAsyncResource(n,e,t);case`CIMGradientFill`:case`CIMGradientStroke`:case`CIMHatchFill`:case`CIMVectorMarker`:case`cim-point-symbol-halo`:case`dash`:case`fill-style`:case`sdf`:return this._rasterizeJSONResource(n,e)}}_rasterizeJSONResource(e,t){let n=this._rasterizer.rasterizeJSONResource(t);if(n){let{size:r,image:i,sdf:a,simplePattern:o,rasterizationScale:s,samplingMode:c,sdfPaddingRatio:l,sdfDecodeCoeff:u}=n;return this._addItemToMosaic(e,r,{type:`static`,data:i},A(t),a,o,s,c,l,u)}return null}async _handleAsyncResource(e,t,n){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let r;return r=t.type===`path`?this._handleSVG(t,e,n):this._handleImage(t,e,n),this._ongoingRasterizations.set(e,r),r.finally(()=>this._ongoingRasterizations.delete(e)),r}async _handleSVG(e,t,n){let r=[p,p],{asFill:i}=e,a=await this._sdfConverter.draw(e.path,i,n);return this._addItemToMosaic(t,r,{type:`static`,data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,n){let r=e.url,i=this.resourceManager.getResource(r);if(i==null)return null;let{width:a,height:o}=i;if(i instanceof HTMLImageElement){if(e.type===`animated`)return T(`mapview-unexpected-resource`,`Attempt to configure animations for a non-animated image.`),null;let n=`colorSubstitutions`in e?e.colorSubstitutions:void 0,{size:r,sdf:s,image:c}=this._rasterizer.rasterizeImageResource(a,o,i,n);return this._addItemToMosaic(t,r,{type:`static`,data:c},A(e),s,!1)}let s,c,l;e.type===`animated`?(s=!1,c={type:`CIMAnimatedSymbolProperties`,playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},l=e.startGroup||0):(s=A(e),c={type:`CIMAnimatedSymbolProperties`,playAnimation:!0},l=0);let u=new S(i,this._requestRender,c,l);return this._addItemToMosaic(t,[u.width,u.height],{type:`animated`,data:u},s,!1,!1)}async _handleImage(e,t,r){let i=e.url;if(M(i)||P(i))return this._handleGIFOrPNG(e,t,r);if(e.type===`animated`)return T(`mapview-unexpected-resource`,`Attempt to configure animations for a non-animated image.`),null;try{let n,a=this.resourceManager.getResource(i);if(a!=null&&a instanceof HTMLImageElement)n=a;else{let{data:e}=await this._imageRequestQueue.push(i,{...r});n=e}if(O(i)){if(`width`in e&&`height`in e)n.width=s(e.width),n.height=s(e.height);else if(`cim`in e){let t=e;n.width=s(t.width??t.scaleX*t.size),n.height=s(t.size)}}if(!n.width||!n.height)return null;let o=n.width,c=n.height,l=`colorSubstitutions`in e?e.colorSubstitutions:void 0,{size:u,sdf:d,image:f}=this._rasterizer.rasterizeImageResource(o,c,n,l);return this._addItemToMosaic(t,u,{type:`static`,data:f},A(e),d,!1)}catch(e){throw a(e)?e:new n(`mapview-invalid-resource`,`Could not fetch requested resource at ${i}. ${e.message}`)}}_addItemToMosaic(e,t,n,r,i,a,o,s,c,l){return this._spriteMosaic.addSpriteItem(e,t,n,r,i,a,o,s,c,l)}}function O(e){return e.includes(`data:image/svg+xml`)}function k(e){if(e==null)return``;let{type:t}=e;switch(t){case`CIMMarkerPlacementAlongLineRandomSize`:return`${t}-${e.seed}-${e.randomization}`;case`CIMMarkerPlacementAlongLineVariableSize`:return`${t}-${e.maxRandomOffset}-${e.numberOfSizes}-${e.seed}-${e.variationMethod}`;case`CIMMarkerPlacementAtExtremities`:return`${t}-${e.extremityPlacement}-${e.offsetAlongLine}`;case`CIMMarkerPlacementAtRatioPositions`:return`${t}-${e.beginPosition}-${e.endPosition}-${e.flipFirst}-${JSON.stringify(e.positionArray)}`;case`CIMMarkerPlacementAtMeasuredUnits`:return`${t}-${e.interval}-${e.skipMarkerRate}-${e.placeAtExtremities}`;case`CIMMarkerPlacementInsidePolygon`:return`${t}-${e.stepX}-${e.stepY}-${e.randomness}-${e.gridType}-${e.seed}-${e.shiftOddRows}`;case`CIMMarkerPlacementOnLine`:return`${t}-${e.relativeTo}-${e.startPointOffset}`;case`CIMMarkerPlacementOnVertices`:return`${t}-${e.placeOnControlPoints}-${e.placeOnEndPoints}-${e.placeOnRegularVertices}`;case`CIMMarkerPlacementPolygonCenter`:return`${t}-${e.method}`;default:return`${t}`}}function A(e){switch(e.type){case`CIMVectorMarker`:case`CIMPictureMarker`:return F(e);case`cim-point-symbol-halo`:return!1;default:return!0}}const j=e=>e!=null&&e.startsWith(`data:image/gif`),M=e=>e&&(e.includes(`.gif`)||j(e)),N=e=>e!=null&&e.startsWith(`data:image/png`),P=e=>e&&(e.includes(`.png`)||N(e)),F=e=>e&&`markerPlacement`in e&&e.markerPlacement&&e.markerPlacement.type===`CIMMarkerPlacementInsidePolygon`;export{D as TextureManager};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
+
const e=0,t=65535;function n(e,n){return e<<16|n&t}function r(e,t,n,r){return 1|e<<1|!!n<<2|(r===`Nearest`)<<3|t<<4}function i(e){return e&t}export{n as createMaterialKey,r as createTextureKey,i as getTextureKey,e as noTextureKey};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../DisplayEntity.js";import t from"../DisplayRecord.js";import{
|
|
2
|
+
import e from"../DisplayEntity.js";import t from"../DisplayRecord.js";import{noTextureKey as n}from"../materialKeyUtils.js";import{VertexDataWriter as r}from"./VertexDataWriter.js";import i from"../util/Writer.js";class a{constructor(t,r=0){this._id=t,this._sizeHint=r,this._entityRecordCountOffset=0,this._entityCountOffset=0,this._entityIdIndex=0,this._entitySortKeyIndex=0,this._didEntityStart=!1,this._instanceIdToVertexData=new Map,this._recordIndexStart=0,this._recordIndexCount=0,this._recordVertexStart=0,this._recordVertexCount=0,this._pendingMetrics=[],this._current={metric:null,writer:null,start:0,sortKey:0,instanceId:0,layoutHash:0,indexStart:0,vertexStart:0,textureKey:n,metricBoxLenPointer:0},this._requiresRefresh=!1,this._entities=new i(Uint32Array,this._sizeHint*e.byteSizeHint),this._entityCountOffset=this._entities.push(0)}get id(){return this._id}serialize(){let e=[],t=[],n=this._entities.buffer();for(let n of this._instanceIdToVertexData.values())t.push(n.serialize(e));return{message:{data:t,entities:n},transferList:e}}get requiresRefresh(){return this._requiresRefresh}set requiresRefresh(e){this._requiresRefresh=e}vertexStart(){return this._current.vertexStart??0}vertexCount(){return this._current.writer?.vertexCount??0}indexCount(){return this._current.writer?.indexCount??0}vertexEnsureSize(e){this._current.writer.vertexEnsureSize(e)}indexEnsureSize(e){this._current.writer.indexEnsureSize(e)}vertexWrite(e){this._current.writer.writeVertex(e)}vertexWriteRegion(e){this._current.writer.writeVertexRegion(e)}vertexWriteF32(e){this._current.writer.writeVertexF32(e)}recordBounds(e,t,n,r){}indexWrite(e){this._current.writer.writeIndex(e)}metricStart(e){this._current.metric=e,this._current.metric.recordStart=this.recordCount()}metricEnd(){let e=this._current.writer;this._current.metric&&(this._current.metric.recordCount=this.recordCount()-this._current.metric.recordStart),!this._current.metric?.bounds.length||!this._current.metric?.recordCount||this._pendingMetrics.push({metric:this._current.metric,writer:e}),this._current.metric=null}metricBoxWrite(e){this._current.metric.bounds.push(e)}entityStart(e,t=e){this._entityIdIndex=this._entities.push(e),this._entitySortKeyIndex=this._entities.writeF32(t),this._entityRecordCountOffset=this._entities.push(0),this._didEntityStart=!0}entityRecordCount(){return this._entities.getValue(this._entityRecordCountOffset)}entityEnd(){if(this._didEntityStart){for(let{metric:e,writer:t}of this._pendingMetrics)t.writeMetric(e);this._pendingMetrics.length=0,this.entityRecordCount()===0?this._entities.seek(this._entityIdIndex):this._entities.incr(this._entityCountOffset),this._didEntityStart=!1}}recordCount(){return this._entities.getValue(this._entityRecordCountOffset)}recordStart(e,t,r=n){this._current.writer=this._getVertexWriter(e,t),this._current.indexStart=this._current.writer.indexCount,this._current.vertexStart=this._current.writer.vertexCount,this._current.instanceId=e,this._current.layoutHash=t.hash,this._current.textureKey=r}withRecord(e,t,n,r){return this.recordStart(e,t,n??void 0),r(),this.recordEnd()}writeWithoutBuffering(e){e()}recordEnd(e=0){let n=this._current.vertexStart,r=this._current.writer.vertexCount-n;if(!r)return!1;let i=this._current.indexStart,a=this._current.writer.indexCount-i;return this._recordIndexStart=i,this._recordIndexCount=a,this._recordVertexStart=n,this._recordVertexCount=r,this._entities.incr(this._entityRecordCountOffset),t.write(this._entities,this._current.instanceId,this._current.textureKey,i,a,n,r,e),!0}copyLast(e,n){let r=this._recordVertexStart+this._recordVertexCount;this._entities.incr(this._entityRecordCountOffset),t.write(this._entities,this._current.instanceId,this._current.textureKey,this._recordIndexStart+this._recordIndexCount,this._recordIndexCount,r,this._recordVertexCount,0);let i=this._current.writer.indexWriter,a=this._current.writer.vertexWriter,o=this._recordIndexStart+this._recordIndexCount,s=this._recordVertexCount;for(let e=this._recordIndexStart;e!==o;e++){let t=i.getValue(e);i.push(t+s)}let c=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,l=this._recordVertexStart*c,u=(this._recordVertexStart+this._recordVertexCount)*c;for(let e=l;e!==u;e++){let t=a.getValue(e);a.push(t)}let d=this._current.writer.layout.position,f=d.packPrecisionFactor??1,p=d.offset/Uint32Array.BYTES_PER_ELEMENT,m=e*f,h=n*f;for(let e=r*c;e<=a.length;e+=c)a.i1616Add(e+p,m,h)}copyLastFrom(e,t,n){let r=e._entities.getValue(e._entityIdIndex),i=this._entities.getValue(this._entityIdIndex);if(!this._didEntityStart||r!==i){let t=e._entities.getValueF32(e._entitySortKeyIndex);this.entityStart(r,t)}this.recordStart(e._current.instanceId,e._current.writer.layout,e._current.textureKey);let a=this._current.writer.layout.stride/Uint32Array.BYTES_PER_ELEMENT,o=this._current.vertexStart,s=e._current.vertexStart-o,c=this._current.writer.indexWriter,l=this._current.writer.vertexWriter,u=e._current.writer.indexWriter,d=e._current.writer.vertexWriter;for(let t=e._current.indexStart;t!==u.length;t++){let e=u.getValue(t);c.push(e-s)}for(let t=e._current.vertexStart*a;t!==d.length;t++){let e=d.getValue(t);l.push(e)}let f=this._current.writer.layout.position,p=f.packPrecisionFactor??1,m=f.offset/Uint32Array.BYTES_PER_ELEMENT,h=t*p,g=n*p;for(let e=o*a;e<=l.length;e+=a)l.i1616Add(e+m,h,g);this.recordEnd()}_getVertexWriter(e,t){let n=this._instanceIdToVertexData;return n.has(e)||n.set(e,new r(e,t,this._sizeHint)),n.get(e)}}export{a as MeshData};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{pt2px as e}from"../../../../../../core/screenUtils.js";import{fromRotation as t,multiply as n,translate as r,rotate as i}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as o,set as s}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{getXAnchorDirection as l,getYAnchorDirection as u}from"../../alignmentUtils.js";import{magicLabelLineHeight as d}from"../../definitions.js";import f from"../../Rect.js";import p from"../../collisions/BoundingBox.js";const m=Math.PI/180;class h{static fromGlyph(e,t,n,r,i){let{mosaicItem:a,rect:o,shaping:s,code:c}=n,l=a.rect;return new h({width:c===0?o.width:l.width*r,height:c===0?o.height:l.height*r,x:r*(e+s.xOffset+o.left),y:r*(t+s.yOffset-o.top),textureBinding:a.textureBinding,texcoords:{topLeft:[l.x,l.y],topRight:[l.x+l.width,l.y],bottomLeft:[l.x,l.y+l.height],bottomRight:[l.x+l.width,l.y+l.height]},fontSize:i?.fontSize,color:i?.color})}constructor(e){this._rotationT=a(),this._transform=a(),this._angle=0,this._bounds=null,this.width=e.width,this.height=e.height,this.x=e.x,this.y=e.y,this.textureBinding=e.textureBinding,this.texcoords=e.texcoords,this.fontSize=e.fontSize,this.color=e.color}set angle(e){this._angle=e,t(this._rotationT,-e),this._offsets=this._bounds=null}get angle(){return this._angle}get offsets(){if(!this._offsets){let{x:e,y:r,width:i,height:s}=this,c=t(a(),-this.angle),l=n(a(),c,this._transform);this._offsets={topLeft:o([0,0],[e,r],l),topRight:o([0,0],[e+i,r],l),bottomLeft:o([0,0],[e,r+s],l),bottomRight:o([0,0],[e+i,r+s],l)}}return this._offsets}get bounds(){if(this.width<=0)return null;if(!this._bounds){let e=this.offsets,t=1/0,n=1/0,r=-1/0,i=-1/0;for(let[a,o]of[e.topLeft,e.topRight,e.bottomLeft,e.bottomRight])t=Math.min(t,a),n=Math.min(n,o),r=Math.max(r,a),i=Math.max(i,o);let a=r-t,o=i-n,s=t+a/2,c=n+o/2;this._bounds=new p(s,c,a,o)}return this._bounds}setTransform(e){this._transform=e,this._offsets=null}}const g=(e,t)=>({code:0,mosaicItem:{rect:new f(0,0,11,8),sdf:!0,page:0,textureBinding:t},rect:{height:4,width:e,left:0,top:0},shaping:{xOffset:0,yOffset:0,xAdvance:0,yAdvance:0}});function _(t){return t===`underline`?e(2):0}function v(e,t,n,r,i){switch(e){case`underline`:return(n??i?.baseline??22)+4+_(e)/t;case`line-through`:return r??i?.midline??16;default:return 0}}function y(e,t){return e.forEach(e=>o(e,e,t)),{topLeft:e[0],topRight:e[1],bottomLeft:e[2],bottomRight:e[3]}}class b{constructor(e,t,n,r){this._rotation=0,this._decorate(e,t,n,r),this.glyphs=e,this.bounds=this._createBounds(e),this.isMultiline=t.length>1,this._hasRotation=n.angle!==0,this._transform=this._createGlyphTransform(this.bounds,n),this._borderLineSizePx=n.borderLineSizePx,(n.borderLineSizePx||n.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(let t of e)t.setTransform(this._transform)}setRotation(e){if(e===0&&this._rotation===0)return;this._rotation=e;let r=this._transform,i=t(a(),e);n(r,i,r);for(let e of this.glyphs)e.setTransform(this._transform)}_decorate(e,t,n,r){if(!n.decoration||n.decoration===`none`||!e.length)return;let i=n.scale,a=e[0].textureBinding;for(let o of t){let t=o.scale??i,s=v(n.decoration,t,o.baseline,o.midline,r),c=o.startX*t,l=o.startY*t,u=(o.width+o.glyphWidthEnd)*t;e.push(h.fromGlyph(c,l+s*t,g(u,a),1))}}shapeBackground(e){let t=(1.5+(this._borderLineSizePx||0))/2,n=this._borderLineSizePx?t:0,{xmin:r,ymin:i,xmax:a,ymax:o,x:s,y:c,width:l,height:u}=this.bounds,d=[r-8,i-8],f=[a+8,i-8],m=[r-8,o+8],h=[a+8,o+8],g=y([[d[0]-t,d[1]-t],[f[0]+t,f[1]-t],[d[0]+n,d[1]+n],[f[0]-n,f[1]+n]],e),_=y([[m[0]+n,m[1]-n],[h[0]-n,h[1]-n],[m[0]-t,m[1]+t],[h[0]+t,h[1]+t]],e),v=y([[d[0]-t,d[1]-t],[d[0]+n,d[1]+n],[m[0]-t,m[1]+t],[m[0]+n,m[1]-n]],e),b=y([[f[0]-n,f[1]+n],[f[0]+t,f[1]-t],[h[0]-n,h[1]-n],[h[0]+t,h[1]+t]],e),x={main:y([d,f,m,h],e),top:g,bot:_,left:v,right:b};return[new p(s,c,l+t*2,u+t*2),x]}get boundsT(){let e=this.bounds,t=s(c(),e.x,e.y);if(o(t,t,this._transform),this._hasRotation){let n=Math.max(e.width,e.height);return new p(t[0],t[1],n,n)}return new p(t[0],t[1],e.width,e.height)}_createBounds(e){let t=1/0,n=1/0,r=0,i=0;for(let a of e)t=Math.min(t,a.offsets.topLeft[0]),n=Math.min(n,a.offsets.topLeft[1]),r=Math.max(r,a.offsets.bottomRight[0]),i=Math.max(i,a.offsets.bottomRight[1]);let a=r-t,o=i-n,s=t+a/2,c=n+o/2;return new p(s,c,a,o)}_createGlyphTransform(e,t){let n=m*t.angle,o=a(),l=c();return r(o,o,s(l,t.xOffset,-t.yOffset)),t.useCIMAngleBehavior?i(o,o,n):(r(o,o,s(l,e.x,e.y)),i(o,o,n),r(o,o,s(l,-e.x,-e.y))),o}}class x{constructor(e,t,n,r,i,a){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(t,n)),this.end=Math.max(0,Math.max(t,n)),this.end<e.length&&(this.glyphWidthEnd=e[this.end].rect.width),this.width=r,this.yMin=i,this.yMax=a}}const S=e=>e===10,C=e=>e===32;function w(e,t,n){let r=[],i=1/n.scale,a=n.maxLineWidth*i,o=e.length,s=0,c=0,l=0,u=s,d=u,f=0,p=1/0,m=0;for(;s!==o;){let{code:t,rect:n,shaping:i}=e[s],o=Math.abs(n.top);if(!S(t)&&!C(t)&&(p=Math.min(p,o),m=Math.max(m,o+n.height)),S(t))s!==0&&(r.push(new x(e,u,s-1,c,p===1/0?0:p,m)),p=1/0,m=0),c=0,u=s+1,d=s+1,l=0;else if(C(t))d=s+1,l=0,f=i.xAdvance,c+=i.xAdvance;else if(c>a){if(d!==u){let t=d-2;c-=f,r.push(new x(e,u,t,c-l,p,m)),p=1/0,m=0,u=d,c=l}else r.push(new x(e,u,s-1,c,p,m)),p=1/0,m=0,u=s,d=s,c=0;c+=i.xAdvance,l+=i.xAdvance}else c+=i.xAdvance,l+=i.xAdvance;s+=1}let h=new x(e,u,s-1,c,p,m);return h.start>=0&&h.end<e.length&&r.push(h),r}function T(e,t){let n=0;for(let t=0;t<e.length;t++){let{width:r}=e[t];n=Math.max(r,n)}let r=t.decoration===`underline`?4:0,i=e[0].yMin;return{x:0,y:i,height:e[e.length-1].yMax+t.lineHeight*(e.length-1)+r-i,width:n}}function E(e,t,n){let r=0;for(let i=t;i<n;i++)C(e[i].code)&&!S(e[i+1].code)&&r++;return r}function D(e,t){let n=t.scale,r=[],i=e.sdfPadding,{faceInfo:a,glyphs:o,isRightToLeft:s}=e,c=t.horizontalAlignment===`justify`||t.horizontalAlignment===`Justify`,d=w(o,!1,t),f=d.length?T(d,t):{y:0,height:0,width:0},p=c?s?1:-1:l(t.horizontalAlignment),m=u(t.verticalAlignment),g=+(m===2),_=g?0:m-1,v=a?.baseline??22,y=d.length>1,x=g?y?-f.y-f.height:-v:-f.y+_*(f.height/2);for(let a=0;a<d.length;a++){let{start:s,end:l,width:u}=d[a],m=c&&a<d.length-1?E(o,s,l):0,g=m>0?(f.width-u)/m:0,_=g>0?f.width:u,v=(p+1)*-1*(_/2)-i,y=(e.isRightToLeft?d.length-1-a:a)*t.lineHeight+x-i;d[a].startX=v,d[a].startY=y;for(let e=s;e<=l;e++){let t=o[e];if(S(t.code))continue;let i=h.fromGlyph(v,y,t,n);v+=t.shaping.xAdvance,g>0&&C(t.code)&&(v+=g),r.push(i)}}return new b(r,d,t,a)}function O(e,t){let n=t.scale,{faceInfo:r,glyphs:i}=e,a=i.reduce((e,t)=>Math.max(e,t.rect.height),0),o=i.filter(e=>!S(e.code)&&e.mosaicItem.textureBinding).map(e=>h.fromGlyph(-e.rect.width/2,-a,e,n));return new b(o,[],t,r)}function k(e,t){return e.type===`glyphs`?D(e,t):j(e,t)}function A(e,t){return e.type===`glyphs`?O(e,t):M(e,t)}function j(e,t){let n=N(e,t),r=P(n,t),i=r.length?I(r):{width:0},a=[],o=t.decoration===`underline`?`none`:t.decoration,s=t.horizontalAlignment===`justify`||t.horizontalAlignment===`Justify`,c=s?-1:l(t.horizontalAlignment),d=u(t.verticalAlignment),f=d===2,p=r.length?r[0].yMin:0,m=r.length?L(r[r.length-1]):0,g=m-p,_=f?r.length>1?-m:-(r[0]?.baseline??0):d===1?-p:d===-1?-m:-(p+g/2);for(let e=0;e<r.length;e++){let t=r[e],o=s&&e<r.length-1?R(n,t.start,t.end):0,l=o>0?(i.width-t.width)/o:0,u=l>0?i.width:t.width,d=(c+1)*-1*(u/2),f=t.startY+_,p=null;t.startX=d,t.startY=f;for(let e=t.start;e<=t.end;e++){let r=n[e],{glyph:i,scale:o,fontSize:s}=r,c=d;if(S(i.code)){p=z(a,p,f,t.baseline);continue}r.decoration===`underline`?(p&&p.underlineOffset!==r.underlineOffset||p&&!B(p.color,r.color))&&(p=z(a,p,f,t.baseline)):p=z(a,p,f,t.baseline);let u=f+t.baseline-r.baseline;a.push(h.fromGlyph(d/o,u/o,i,o,{fontSize:s,color:r.color})),d+=r.xAdvance,r.decoration===`underline`&&(p??={startX:c,endX:d,glyphWidthEnd:i.rect.width*o,textureBinding:i.mosaicItem.textureBinding,underlineOffset:r.underlineOffset,color:r.color},p.endX=d,p.glyphWidthEnd=i.rect.width*o,p.textureBinding=p.textureBinding??i.mosaicItem.textureBinding),l>0&&C(i.code)&&(d+=l,p&&(p.endX=d))}z(a,p,f,t.baseline)}return new b(a,r,{...t,decoration:o})}function M(e,t){let n=N(e,t),r=n.reduce((e,t)=>Math.max(e,t.glyph.rect.height*t.scale),0),i=n.filter(e=>!S(e.glyph.code)&&e.glyph.mosaicItem.textureBinding).map(e=>h.fromGlyph(-e.glyph.rect.width/2,-r/e.scale,e.glyph,e.scale,{fontSize:e.fontSize,color:e.color}));return new b(i,[],t)}function N(t,n){let r=n.lineHeightRatio??1,i=[];for(let n of t.runs){let t=e(n.fontSize),a=t/n.glyphs.sdfSize,o=d/24*t*r,s=(n.glyphs.faceInfo?.baseline??22)*a,c=(n.glyphs.faceInfo?.midline??16)*a,l=4*a+_(n.decoration),u=1+(n.characterSpacing??0);for(let e of n.glyphs.glyphs){let r=e.shaping.xAdvance*a,d=Math.abs(e.rect.top)*a,f=d+e.rect.height*a;i.push({glyph:e,scale:a,fontSize:t,decoration:n.decoration,underlineOffset:l,color:n.color,xAdvance:!S(e.code)&&!C(e.code)?r*u:r,top:d,bottom:f,lineHeight:o,baseline:s,midline:c})}}return i}function P(e,t){let n=[],r=t.maxLineWidth,i=0,a=0,o=0,s=0,c=0,l=0;for(;i<e.length;){let t=e[i],{glyph:u}=t;if(S(u.code))i!==0&&n.push({width:a,start:s,end:i-1,glyphWidthEnd:e[i-1]?.glyph.rect.width*e[i-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),a=0,s=i+1,c=s,o=0,l=0;else if(C(u.code))c=i+1,o=0,l=t.xAdvance,a+=t.xAdvance;else if(a>r){if(c!==s){let t=c-2;a-=l,n.push({width:a-o,start:s,end:t,glyphWidthEnd:e[t]?.glyph.rect.width*e[t]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),s=c,a=o}else n.push({width:a,start:s,end:i-1,glyphWidthEnd:e[i-1]?.glyph.rect.width*e[i-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),s=i,c=i,a=0;a+=t.xAdvance,o+=t.xAdvance}else a+=t.xAdvance,o+=t.xAdvance;i++}if(s<e.length){let t=e.length-1;n.push({width:a,start:s,end:t,glyphWidthEnd:e[t]?.glyph.rect.width*e[t]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1})}return F(e,n)}function F(e,t){for(let n=0;n<t.length;n++){let r=t[n],i=0,a=1/0,o=0,s=0;for(let t=r.start;t<=r.end;t++){let n=e[t];n.decoration===`underline`&&(s=Math.max(s,n.underlineOffset)),S(n.glyph.code)||C(n.glyph.code)||(i=Math.max(i,n.baseline),o=Math.max(o,n.lineHeight))}let c=1/0,l=-1/0;for(let t=r.start;t<=r.end;t++){let n=e[t];S(n.glyph.code)||C(n.glyph.code)||(c=Math.min(c,i-n.baseline+n.top),l=Math.max(l,i-n.baseline+n.bottom),a=Math.min(a,i-n.baseline+n.midline))}s>0&&(l=Math.max(l,i+s)),r.baseline=i,r.midline=a===1/0?i:a,r.lineHeight=Math.max(o,l),r.yMin=c===1/0?0:c,r.yMax=l===-1/0?0:l,r.startY=n>0?t[n-1].startY+t[n-1].lineHeight:0}return t}function I(e){let t=0;for(let n of e)t=Math.max(n.width+n.glyphWidthEnd,t);let n=e[0].yMin,r=e[e.length-1];return{x:0,y:n,height:L(r)-n,width:t}}function L(e){return e.startY+e.lineHeight}function R(e,t,n){let r=0;for(let i=t;i<n;i++)C(e[i].glyph.code)&&!S(e[i+1].glyph.code)&&r++;return r}function z(e,t,n,r){return t&&e.push(h.fromGlyph(t.startX,n+r+t.underlineOffset,g(t.endX-t.startX+t.glyphWidthEnd,t.textureBinding),1,{color:t.color})),null}function B(e,t){return e===t||!!e&&!!t&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}export{h as ShapedGlyph,b as ShapingInfo,D as shapeGlyphs,O as shapeGlyphsForMultipoint,j as shapeRichText,M as shapeRichTextForMultipoint,k as shapeTextResource,A as shapeTextResourceForMultipoint};
|
|
2
|
+
import{pt2px as e}from"../../../../../../core/screenUtils.js";import{fromRotation as t,multiply as n,translate as r,rotate as i}from"../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as a}from"../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as o,set as s}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{getXAnchorDirection as l,getYAnchorDirection as u}from"../../alignmentUtils.js";import{magicLabelLineHeight as d}from"../../definitions.js";import f from"../../Rect.js";import p from"../../collisions/BoundingBox.js";const m=Math.PI/180;class h{static fromGlyph(e,t,n,r,i){let{mosaicItem:a,rect:o,shaping:s,code:c}=n,l=a.rect;return new h({width:c===0?o.width:l.width*r,height:c===0?o.height:l.height*r,x:r*(e+s.xOffset+o.left),y:r*(t+s.yOffset-o.top),textureKey:a.textureKey,texcoords:{topLeft:[l.x,l.y],topRight:[l.x+l.width,l.y],bottomLeft:[l.x,l.y+l.height],bottomRight:[l.x+l.width,l.y+l.height]},fontSize:i?.fontSize,color:i?.color})}constructor(e){this._rotationT=a(),this._transform=a(),this._angle=0,this._bounds=null,this.width=e.width,this.height=e.height,this.x=e.x,this.y=e.y,this.textureKey=e.textureKey,this.texcoords=e.texcoords,this.fontSize=e.fontSize,this.color=e.color}set angle(e){this._angle=e,t(this._rotationT,-e),this._offsets=this._bounds=null}get angle(){return this._angle}get offsets(){if(!this._offsets){let{x:e,y:r,width:i,height:s}=this,c=t(a(),-this.angle),l=n(a(),c,this._transform);this._offsets={topLeft:o([0,0],[e,r],l),topRight:o([0,0],[e+i,r],l),bottomLeft:o([0,0],[e,r+s],l),bottomRight:o([0,0],[e+i,r+s],l)}}return this._offsets}get bounds(){if(this.width<=0)return null;if(!this._bounds){let e=this.offsets,t=1/0,n=1/0,r=-1/0,i=-1/0;for(let[a,o]of[e.topLeft,e.topRight,e.bottomLeft,e.bottomRight])t=Math.min(t,a),n=Math.min(n,o),r=Math.max(r,a),i=Math.max(i,o);let a=r-t,o=i-n,s=t+a/2,c=n+o/2;this._bounds=new p(s,c,a,o)}return this._bounds}setTransform(e){this._transform=e,this._offsets=null}}const g=(e,t)=>({code:0,mosaicItem:{rect:new f(0,0,11,8),sdf:!0,page:0,textureKey:t},rect:{height:4,width:e,left:0,top:0},shaping:{xOffset:0,yOffset:0,xAdvance:0,yAdvance:0}});function _(t){return t===`underline`?e(2):0}function v(e,t,n,r,i){switch(e){case`underline`:return(n??i?.baseline??22)+4+_(e)/t;case`line-through`:return r??i?.midline??16;default:return 0}}function y(e,t){return e.forEach(e=>o(e,e,t)),{topLeft:e[0],topRight:e[1],bottomLeft:e[2],bottomRight:e[3]}}class b{constructor(e,t,n,r){this._rotation=0,this._decorate(e,t,n,r),this.glyphs=e,this.bounds=this._createBounds(e),this.isMultiline=t.length>1,this._hasRotation=n.angle!==0,this._transform=this._createGlyphTransform(this.bounds,n),this._borderLineSizePx=n.borderLineSizePx,(n.borderLineSizePx||n.hasBackground)&&([this.bounds,this.textBox]=this.shapeBackground(this._transform));for(let t of e)t.setTransform(this._transform)}setRotation(e){if(e===0&&this._rotation===0)return;this._rotation=e;let r=this._transform,i=t(a(),e);n(r,i,r);for(let e of this.glyphs)e.setTransform(this._transform)}_decorate(e,t,n,r){if(!n.decoration||n.decoration===`none`||!e.length)return;let i=n.scale,a=e[0].textureKey;for(let o of t){let t=o.scale??i,s=v(n.decoration,t,o.baseline,o.midline,r),c=o.startX*t,l=o.startY*t,u=(o.width+o.glyphWidthEnd)*t;e.push(h.fromGlyph(c,l+s*t,g(u,a),1))}}shapeBackground(e){let t=(1.5+(this._borderLineSizePx||0))/2,n=this._borderLineSizePx?t:0,{xmin:r,ymin:i,xmax:a,ymax:o,x:s,y:c,width:l,height:u}=this.bounds,d=[r-8,i-8],f=[a+8,i-8],m=[r-8,o+8],h=[a+8,o+8],g=y([[d[0]-t,d[1]-t],[f[0]+t,f[1]-t],[d[0]+n,d[1]+n],[f[0]-n,f[1]+n]],e),_=y([[m[0]+n,m[1]-n],[h[0]-n,h[1]-n],[m[0]-t,m[1]+t],[h[0]+t,h[1]+t]],e),v=y([[d[0]-t,d[1]-t],[d[0]+n,d[1]+n],[m[0]-t,m[1]+t],[m[0]+n,m[1]-n]],e),b=y([[f[0]-n,f[1]+n],[f[0]+t,f[1]-t],[h[0]-n,h[1]-n],[h[0]+t,h[1]+t]],e),x={main:y([d,f,m,h],e),top:g,bot:_,left:v,right:b};return[new p(s,c,l+t*2,u+t*2),x]}get boundsT(){let e=this.bounds,t=s(c(),e.x,e.y);if(o(t,t,this._transform),this._hasRotation){let n=Math.max(e.width,e.height);return new p(t[0],t[1],n,n)}return new p(t[0],t[1],e.width,e.height)}_createBounds(e){let t=1/0,n=1/0,r=0,i=0;for(let a of e)t=Math.min(t,a.offsets.topLeft[0]),n=Math.min(n,a.offsets.topLeft[1]),r=Math.max(r,a.offsets.bottomRight[0]),i=Math.max(i,a.offsets.bottomRight[1]);let a=r-t,o=i-n,s=t+a/2,c=n+o/2;return new p(s,c,a,o)}_createGlyphTransform(e,t){let n=m*t.angle,o=a(),l=c();return r(o,o,s(l,t.xOffset,-t.yOffset)),t.useCIMAngleBehavior?i(o,o,n):(r(o,o,s(l,e.x,e.y)),i(o,o,n),r(o,o,s(l,-e.x,-e.y))),o}}class x{constructor(e,t,n,r,i,a){this.glyphWidthEnd=0,this.startX=0,this.startY=0,this.start=Math.max(0,Math.min(t,n)),this.end=Math.max(0,Math.max(t,n)),this.end<e.length&&(this.glyphWidthEnd=e[this.end].rect.width),this.width=r,this.yMin=i,this.yMax=a}}const S=e=>e===10,C=e=>e===32;function w(e,t,n){let r=[],i=1/n.scale,a=n.maxLineWidth*i,o=e.length,s=0,c=0,l=0,u=s,d=u,f=0,p=1/0,m=0;for(;s!==o;){let{code:t,rect:n,shaping:i}=e[s],o=Math.abs(n.top);if(!S(t)&&!C(t)&&(p=Math.min(p,o),m=Math.max(m,o+n.height)),S(t))s!==0&&(r.push(new x(e,u,s-1,c,p===1/0?0:p,m)),p=1/0,m=0),c=0,u=s+1,d=s+1,l=0;else if(C(t))d=s+1,l=0,f=i.xAdvance,c+=i.xAdvance;else if(c>a){if(d!==u){let t=d-2;c-=f,r.push(new x(e,u,t,c-l,p,m)),p=1/0,m=0,u=d,c=l}else r.push(new x(e,u,s-1,c,p,m)),p=1/0,m=0,u=s,d=s,c=0;c+=i.xAdvance,l+=i.xAdvance}else c+=i.xAdvance,l+=i.xAdvance;s+=1}let h=new x(e,u,s-1,c,p,m);return h.start>=0&&h.end<e.length&&r.push(h),r}function T(e,t){let n=0;for(let t=0;t<e.length;t++){let{width:r}=e[t];n=Math.max(r,n)}let r=t.decoration===`underline`?4:0,i=e[0].yMin;return{x:0,y:i,height:e[e.length-1].yMax+t.lineHeight*(e.length-1)+r-i,width:n}}function E(e,t,n){let r=0;for(let i=t;i<n;i++)C(e[i].code)&&!S(e[i+1].code)&&r++;return r}function D(e,t){let n=t.scale,r=[],i=e.sdfPadding,{faceInfo:a,glyphs:o,isRightToLeft:s}=e,c=t.horizontalAlignment===`justify`||t.horizontalAlignment===`Justify`,d=w(o,!1,t),f=d.length?T(d,t):{y:0,height:0,width:0},p=c?s?1:-1:l(t.horizontalAlignment),m=u(t.verticalAlignment),g=+(m===2),_=g?0:m-1,v=a?.baseline??22,y=d.length>1,x=g?y?-f.y-f.height:-v:-f.y+_*(f.height/2);for(let a=0;a<d.length;a++){let{start:s,end:l,width:u}=d[a],m=c&&a<d.length-1?E(o,s,l):0,g=m>0?(f.width-u)/m:0,_=g>0?f.width:u,v=(p+1)*-1*(_/2)-i,y=(e.isRightToLeft?d.length-1-a:a)*t.lineHeight+x-i;d[a].startX=v,d[a].startY=y;for(let e=s;e<=l;e++){let t=o[e];if(S(t.code))continue;let i=h.fromGlyph(v,y,t,n);v+=t.shaping.xAdvance,g>0&&C(t.code)&&(v+=g),r.push(i)}}return new b(r,d,t,a)}function O(e,t){let n=t.scale,{faceInfo:r,glyphs:i}=e,a=i.reduce((e,t)=>Math.max(e,t.rect.height),0),o=i.filter(e=>!S(e.code)&&e.mosaicItem.textureKey).map(e=>h.fromGlyph(-e.rect.width/2,-a,e,n));return new b(o,[],t,r)}function k(e,t){return e.type===`glyphs`?D(e,t):j(e,t)}function A(e,t){return e.type===`glyphs`?O(e,t):M(e,t)}function j(e,t){let n=N(e,t),r=P(n,t),i=r.length?I(r):{width:0},a=[],o=t.decoration===`underline`?`none`:t.decoration,s=t.horizontalAlignment===`justify`||t.horizontalAlignment===`Justify`,c=s?-1:l(t.horizontalAlignment),d=u(t.verticalAlignment),f=d===2,p=r.length?r[0].yMin:0,m=r.length?L(r[r.length-1]):0,g=m-p,_=f?r.length>1?-m:-(r[0]?.baseline??0):d===1?-p:d===-1?-m:-(p+g/2);for(let e=0;e<r.length;e++){let t=r[e],o=s&&e<r.length-1?R(n,t.start,t.end):0,l=o>0?(i.width-t.width)/o:0,u=l>0?i.width:t.width,d=(c+1)*-1*(u/2),f=t.startY+_,p=null;t.startX=d,t.startY=f;for(let e=t.start;e<=t.end;e++){let r=n[e],{glyph:i,scale:o,fontSize:s}=r,c=d;if(S(i.code)){p=z(a,p,f,t.baseline);continue}r.decoration===`underline`?(p&&p.underlineOffset!==r.underlineOffset||p&&!B(p.color,r.color))&&(p=z(a,p,f,t.baseline)):p=z(a,p,f,t.baseline);let u=f+t.baseline-r.baseline;a.push(h.fromGlyph(d/o,u/o,i,o,{fontSize:s,color:r.color})),d+=r.xAdvance,r.decoration===`underline`&&(p??={startX:c,endX:d,glyphWidthEnd:i.rect.width*o,textureKey:i.mosaicItem.textureKey,underlineOffset:r.underlineOffset,color:r.color},p.endX=d,p.glyphWidthEnd=i.rect.width*o,p.textureKey=p.textureKey??i.mosaicItem.textureKey),l>0&&C(i.code)&&(d+=l,p&&(p.endX=d))}z(a,p,f,t.baseline)}return new b(a,r,{...t,decoration:o})}function M(e,t){let n=N(e,t),r=n.reduce((e,t)=>Math.max(e,t.glyph.rect.height*t.scale),0),i=n.filter(e=>!S(e.glyph.code)&&e.glyph.mosaicItem.textureKey).map(e=>h.fromGlyph(-e.glyph.rect.width/2,-r/e.scale,e.glyph,e.scale,{fontSize:e.fontSize,color:e.color}));return new b(i,[],t)}function N(t,n){let r=n.lineHeightRatio??1,i=[];for(let n of t.runs){let t=e(n.fontSize),a=t/n.glyphs.sdfSize,o=d/24*t*r,s=(n.glyphs.faceInfo?.baseline??22)*a,c=(n.glyphs.faceInfo?.midline??16)*a,l=4*a+_(n.decoration),u=1+(n.characterSpacing??0);for(let e of n.glyphs.glyphs){let r=e.shaping.xAdvance*a,d=Math.abs(e.rect.top)*a,f=d+e.rect.height*a;i.push({glyph:e,scale:a,fontSize:t,decoration:n.decoration,underlineOffset:l,color:n.color,xAdvance:!S(e.code)&&!C(e.code)?r*u:r,top:d,bottom:f,lineHeight:o,baseline:s,midline:c})}}return i}function P(e,t){let n=[],r=t.maxLineWidth,i=0,a=0,o=0,s=0,c=0,l=0;for(;i<e.length;){let t=e[i],{glyph:u}=t;if(S(u.code))i!==0&&n.push({width:a,start:s,end:i-1,glyphWidthEnd:e[i-1]?.glyph.rect.width*e[i-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),a=0,s=i+1,c=s,o=0,l=0;else if(C(u.code))c=i+1,o=0,l=t.xAdvance,a+=t.xAdvance;else if(a>r){if(c!==s){let t=c-2;a-=l,n.push({width:a-o,start:s,end:t,glyphWidthEnd:e[t]?.glyph.rect.width*e[t]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),s=c,a=o}else n.push({width:a,start:s,end:i-1,glyphWidthEnd:e[i-1]?.glyph.rect.width*e[i-1]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1}),s=i,c=i,a=0;a+=t.xAdvance,o+=t.xAdvance}else a+=t.xAdvance,o+=t.xAdvance;i++}if(s<e.length){let t=e.length-1;n.push({width:a,start:s,end:t,glyphWidthEnd:e[t]?.glyph.rect.width*e[t]?.scale||0,yMin:0,yMax:0,lineHeight:0,baseline:0,midline:0,startX:0,startY:0,scale:1})}return F(e,n)}function F(e,t){for(let n=0;n<t.length;n++){let r=t[n],i=0,a=1/0,o=0,s=0;for(let t=r.start;t<=r.end;t++){let n=e[t];n.decoration===`underline`&&(s=Math.max(s,n.underlineOffset)),S(n.glyph.code)||C(n.glyph.code)||(i=Math.max(i,n.baseline),o=Math.max(o,n.lineHeight))}let c=1/0,l=-1/0;for(let t=r.start;t<=r.end;t++){let n=e[t];S(n.glyph.code)||C(n.glyph.code)||(c=Math.min(c,i-n.baseline+n.top),l=Math.max(l,i-n.baseline+n.bottom),a=Math.min(a,i-n.baseline+n.midline))}s>0&&(l=Math.max(l,i+s)),r.baseline=i,r.midline=a===1/0?i:a,r.lineHeight=Math.max(o,l),r.yMin=c===1/0?0:c,r.yMax=l===-1/0?0:l,r.startY=n>0?t[n-1].startY+t[n-1].lineHeight:0}return t}function I(e){let t=0;for(let n of e)t=Math.max(n.width+n.glyphWidthEnd,t);let n=e[0].yMin,r=e[e.length-1];return{x:0,y:n,height:L(r)-n,width:t}}function L(e){return e.startY+e.lineHeight}function R(e,t,n){let r=0;for(let i=t;i<n;i++)C(e[i].glyph.code)&&!S(e[i+1].glyph.code)&&r++;return r}function z(e,t,n,r){return t&&e.push(h.fromGlyph(t.startX,n+r+t.underlineOffset,g(t.endX-t.startX+t.glyphWidthEnd,t.textureKey),1,{color:t.color})),null}function B(e,t){return e===t||!!e&&!!t&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}export{h as ShapedGlyph,b as ShapingInfo,D as shapeGlyphs,O as shapeGlyphsForMultipoint,j as shapeRichText,M as shapeRichTextForMultipoint,k as shapeTextResource,A as shapeTextResourceForMultipoint};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{onePointInPixels as e,pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as n}from"../../../../../../../geometry/GeometryCursor.js";import{getUprightAngle as r}from"../../../../../../../symbols/cim/CIMCursor.js";import{maxTileCoordValue as i}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as a}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{spritePadding as o,tileSize as s}from"../../../definitions.js";import{AAnimatedMeshWriter as c}from"./AnimatedMeshWriter.js";import{angle as l,sizing as u,animationPointerAndBaseSizeAndReferenceSize as d,uv as f,offset as p,pos as m,bitset as h,id as g,lineLength as _,value1Position2Value2 as v,zoomRange as y}from"./attributes.js";import{clipWithVertexInterpolation as b}from"./clipping.js";import{createComputedAnimatedMeshParams as x}from"./ComputedAnimatedParams.js";function S(e,t){let n=[],r=0,i=0;for(;e.nextPath();){i=t?0:r,e.nextPoint();let{x:a,y:o}=e,s=[{x:a,y:o,attributes:[i]}];for(;e.nextPoint();){let{x:t,y:n}=e,r=t-a,c=n-o,l=Math.sqrt(r*r+c*c);i+=l,s.push({x:t,y:n,attributes:[i]}),a=t,o=n}s.length>1&&n.push(s),r=i}return{lineData:n,totalDistance:r}}class C extends c{get vertexSpec(){return{createComputedParams:x,optionalAttributes:{zoomRange:y,value1Position2Value2:v,lineLength:_},attributes:{id:g,bitset:h,pos:m,offset:p.marker,uv:f.marker,animationPointerAndBaseSizeAndReferenceSize:d,sizing:u,angle:l}}}_write(e,{target:t,effect:r}){let i=r?.geometry,{
|
|
2
|
+
import{onePointInPixels as e,pt2px as t}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as n}from"../../../../../../../geometry/GeometryCursor.js";import{getUprightAngle as r}from"../../../../../../../symbols/cim/CIMCursor.js";import{maxTileCoordValue as i}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as a}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{spritePadding as o,tileSize as s}from"../../../definitions.js";import{AAnimatedMeshWriter as c}from"./AnimatedMeshWriter.js";import{angle as l,sizing as u,animationPointerAndBaseSizeAndReferenceSize as d,uv as f,offset as p,pos as m,bitset as h,id as g,lineLength as _,value1Position2Value2 as v,zoomRange as y}from"./attributes.js";import{clipWithVertexInterpolation as b}from"./clipping.js";import{createComputedAnimatedMeshParams as x}from"./ComputedAnimatedParams.js";function S(e,t){let n=[],r=0,i=0;for(;e.nextPath();){i=t?0:r,e.nextPoint();let{x:a,y:o}=e,s=[{x:a,y:o,attributes:[i]}];for(;e.nextPoint();){let{x:t,y:n}=e,r=t-a,c=n-o,l=Math.sqrt(r*r+c*c);i+=l,s.push({x:t,y:n,attributes:[i]}),a=t,o=n}s.length>1&&n.push(s),r=i}return{lineData:n,totalDistance:r}}class C extends c{get vertexSpec(){return{createComputedParams:x,optionalAttributes:{zoomRange:y,value1Position2Value2:v,lineLength:_},attributes:{id:g,bitset:h,pos:m,offset:p.marker,uv:f.marker,animationPointerAndBaseSizeAndReferenceSize:d,sizing:u,angle:l}}}_write(e,{target:t,effect:r}){let i=r?.geometry,{textureKey:a}=this.evaluatedMeshParams.sprite;e.recordStart(this.instanceId,this.attributeLayout,a);let o=t.getDisplayId();if(this.shift&&t.geometryType===`esriGeometryPolyline`){if(!i){let r=n.fromFeatureSetReaderCIM(t);r&&this._writeParticles(e,t,r)}}else if(this.evaluatedMeshParams.placement!=null)this._writePlacedMarkers(e,t);else if(t.geometryType===`esriGeometryPolygon`){let n=t.readCentroidForDisplay();if(!n)return;let[r,i]=n.coords;this._writeQuad(e,o,r,i)}else if(t.geometryType===`esriGeometryPoint`){let n=t.readXForDisplay(),r=t.readYForDisplay();this._writeQuad(e,o,n,r)}else{let n=t.readGeometryForDisplay();n&&n.forEachVertex((t,n)=>{this._writeQuad(e,o,t,n)})}e.recordEnd()}_writePlacedMarkers(t,r){let o=n.fromFeatureSetReaderCIM(r)?.clone();if(!o)return;let s=a.getPlacement(o,-1,this.evaluatedMeshParams.placement,e,t.id);if(!s)return;let c=r.getDisplayId(),l=s.next(),u=null;for(;l!=null;){let e=l.tx,n=-l.ty;if(Math.abs(e)>i||Math.abs(n)>i){l=s.next();continue}let r=-l.getAngle();t.recordBounds(e,n,64,64),this.shift?u&&this._writeQuad(t,c,u[0],u[1],void 0,r):this._writeQuad(t,c,e,n,void 0,r),u=[e,n],l=s.next()}}_writeParticles(e,t,n){let i=t.getDisplayId(),{placement:a}=this.evaluatedMeshParams,o=a?.placePerPart??!1,c=this.evaluatedMeshParams.angleToLine&&a!=null&&`keepUpright`in a&&a.keepUpright,{lineData:l,totalDistance:u}=S(n,o);if(l.length===0)return;let d=this.evaluatedMeshParams.baseSize,f={x:-d,y:-d,width:s+2*d,height:s+2*d},p=a==null?0:`offset`in a?a.offset??0:0,m=l.flatMap(e=>{let t=o?e[e.length-1].attributes[0]:u;return w(b(e,f),t,p)});for(let{particles:t,lineLength:n}of m){let o=a=>{for(let o of t){let{a:t,b:s}=o,l=this.evaluatedMeshParams.angleToLine?Math.atan2(t.direction[1],t.direction[0]):0,u=c?r(l):null;this._writeQuad(e,i,t.position[0],t.position[1],[t.distance-a,s.position[0],s.position[1],s.distance-a],u??l,n,!0)}};if(!a||`placementTemplate`in a||a.type===`CIMMarkerPlacementOnVertices`){let e;if(a&&a.type!==`CIMMarkerPlacementOnVertices`)e=a.placementTemplate;else{e=[0];for(let n of t){let{a:t,b:r}=n,i=t.position[0]-r.position[0],a=t.position[1]-r.position[1],o=Math.sqrt(i*i+a*a);e.push(o)}}let r=-1*n;for(;r<2*n;)for(let t of e)r+=t,o(r)}else a.type===`CIMMarkerPlacementAtExtremities`?a.extremityPlacement===`JustBegin`?o(1):a.extremityPlacement===`JustEnd`?(o(n-1),o(-1)):a.extremityPlacement===`Both`&&(o(1),o(n-1)):a.type===`CIMMarkerPlacementOnLine`&&(a.relativeTo===`LineBeginning`?o(1):a.relativeTo===`LineEnd`?(o(n-1),o(-1)):a.relativeTo===`LineMiddle`&&o(n/2))}}_writeQuad(e,t,n,r,i,a=0,s=0,c=!1){let{rect:l}=this.evaluatedMeshParams.sprite,u=l.x+o,d=l.y+o,f=l.x+l.width-o,p=l.y+l.height-o,m=e.vertexCount();c||e.recordBounds(n,r,64,64);let h={texXmin:u,texYmin:d,texXmax:f,texYmax:p,value1Position2Value2:i,angle:a,lineLength:s};for(let i=0;i<4;i++)this._writeVertex(e,t,n,r,h);e.indexEnsureSize(6),e.indexWrite(m),e.indexWrite(m+1),e.indexWrite(m+2),e.indexWrite(m+1),e.indexWrite(m+3),e.indexWrite(m+2)}}function w(e,n,r){let i=[];for(let a of e){let e=[],{x:o,y:s}=a[0],c=a[0].attributes[0];for(let n=1;n<a.length;n++){let{x:i,y:l}=a[n],u=a[n].attributes[0],d=i-o,f=l-s,p=Math.sqrt(d*d+f*f);if(p>0)d/=p,f/=p;else continue;let m=0,h=0;if(r!==0){let e=t(r),n=f,i=-d;m=n*e,h=i*e}e.push({a:{position:[o+m,s+h],distance:c,direction:[d,f]},b:{position:[i+m,l+h],distance:u,direction:[d,f]}}),o=i,s=l,c=u}i.push({particles:e,lineLength:n})}return i}class T extends C{constructor(){super(...arguments),this.shift=!1}}class E extends C{constructor(){super(...arguments),this.shift=!0}}export{T as AnimatedMarkerMeshWriter,E as AnimatedMarkerShiftMeshWriter,S as convertToLineData};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{triangulateF32 as n}from"../../../../../../../geometry/libtess.js";import{LineTessellation as r}from"../../../TurboLine.js";import{clipLinesMarshall as i,triangulateEarcut as a,clipMarshall as o}from"../../../mesh/templates/templateUtils.js";import{AAnimatedMeshWriter as s}from"./AnimatedMeshWriter.js";import{noPatternAngle as c,lineLength as l,noTiming as u,zoomRange as d,segmentDirection as f,normal as p,accumulatedDistance as m,sizing as h,animationPointerAndBaseSizeAndReferenceSize as g,tlbr as _,offset as v,pos as y,bitset as b,id as x,patternAngle as S,noLineLength as C}from"./attributes.js";import{createComputedAnimatedLineMeshParams as w,createComputedAnimatedMeshParams as T}from"./ComputedAnimatedParams.js";import{processLineCapInput as E,processLineJoinInput as D}from"../fill/meshWriterUtils.js";import{LineTessellationParams as O}from"../line/LineMeshWriter.js";class k extends s{_write(e,{target:n,effect:r}){let i=r?.geometry??t.fromFeatureSetReaderCIM(n);if(!i)return;let{
|
|
2
|
+
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{triangulateF32 as n}from"../../../../../../../geometry/libtess.js";import{LineTessellation as r}from"../../../TurboLine.js";import{clipLinesMarshall as i,triangulateEarcut as a,clipMarshall as o}from"../../../mesh/templates/templateUtils.js";import{AAnimatedMeshWriter as s}from"./AnimatedMeshWriter.js";import{noPatternAngle as c,lineLength as l,noTiming as u,zoomRange as d,segmentDirection as f,normal as p,accumulatedDistance as m,sizing as h,animationPointerAndBaseSizeAndReferenceSize as g,tlbr as _,offset as v,pos as y,bitset as b,id as x,patternAngle as S,noLineLength as C}from"./attributes.js";import{createComputedAnimatedLineMeshParams as w,createComputedAnimatedMeshParams as T}from"./ComputedAnimatedParams.js";import{processLineCapInput as E,processLineJoinInput as D}from"../fill/meshWriterUtils.js";import{LineTessellationParams as O}from"../line/LineMeshWriter.js";class k extends s{_write(e,{target:n,effect:r}){let i=r?.geometry??t.fromFeatureSetReaderCIM(n);if(!i)return;let{textureKey:a}=this.evaluatedMeshParams.sprite;e.recordStart(this.instanceId,this.attributeLayout,a);let o=n.getDisplayId();this._writePoly(e,o,i.asOptimized()),e.recordEnd()}}class A extends k{constructor(){super(...arguments),this.vertexSpec={createComputedParams:T,attributes:{id:x,bitset:b,pos:y,offset:v.fill,tlbr:_,animationPointerAndBaseSizeAndReferenceSize:g,sizing:h},optionalAttributes:{zoomRange:d,value1Position2Value2:u,lineLength:C,angle:S}}}_writePoly(e,t,r){r=r.justXY();let i=this._clip(r);if(!i)return;r=i;let o=[],s=e.vertexCount(),c;if(a(o,r)){if(o.length===0)return;c=0;for(let n of o){let i=r.coords[n*2],a=r.coords[n*2+1];this._writeVertex(e,t,i,a),c++}}else{let{coords:i,lengths:a}=r,o=n(i,a);c=o.vertexCount;for(let n=0;n<o.buffer.length/2;n++){let r=o.buffer[n*2],i=o.buffer[n*2+1];this._writeVertex(e,t,r,i)}}if(c>0){e.indexEnsureSize(c);for(let t=0;t<c;t++)e.indexWrite(t+s)}}_clip(e){let t=this.hasEffects?256:8;return o(e,t)}}class j{constructor(){this.id=0,this.bitset=0,this.indexCount=0,this.vertexCount=0,this.vertexFrom=0,this.vertexBounds=0,this.pathLength=0}}const M=65535;class N extends k{constructor(){super(...arguments),this.vertexSpec={createComputedParams:w,attributes:{id:x,bitset:b,pos:y,offset:v.line,tlbr:_,animationPointerAndBaseSizeAndReferenceSize:g,sizing:h,accumulatedDistance:m,normal:p,segmentDirection:f},optionalAttributes:{zoomRange:d,value1Position2Value2:u,lineLength:l,angle:c}},this._tessParams=new O,this._currentWrite=new j,this._tessellationOptions={halfWidth:0,pixelCoordRatio:1,offset:0,wrapDistance:M,textured:!1},this._lineLength=0,this._lineTessellator=new r((e,t,n,r,i,a,o,s,c,l,u)=>this._writeTesselatedVertex(e,t,n,r,i,a,o,s,c,l,u,this._lineLength),this._writeTriangle.bind(this),!1)}_writePoly(n,r,a){a=a.justXY();let o=i(t.fromOptimized(a,`esriGeometryPolyline`),64);if(o==null)return;let{_currentWrite:s,_tessellationOptions:c}=this,{baseSize:l,capType:u,joinType:d,miterLimit:f}=this.evaluatedMeshParams;c.halfWidth=e(.5*l),c.capType=E(u||`Round`),c.joinType=D(d||`Round`),c.miterLimit=f||2,s.out=n,s.id=r,s.vertexCount=0,s.indexCount=0,s.vertexFrom=n.vertexCount(),s.vertexBounds=1;for(let{line:e,start:t,pathLength:n}of o){c.initialDistance=t%M,s.pathLength=n,this._lineLength=0;for(let t=1;t<e.length;t++){let n=e[t].x-e[t-1].x,r=e[t].y-e[t-1].y;this._lineLength+=Math.sqrt(n*n+r*r)}this._lineTessellator.tessellate(e,c,!1)}}_writeTesselatedVertex(e,t,n,r,i,a,o,s,c,l,u,d){let{out:f,id:p,vertexBounds:m,pathLength:h}=this._currentWrite;return this.hasEffects&&f.recordBounds(e,t,m,m),this._tessParams.extrusionOffsetX=o,this._tessParams.extrusionOffsetY=s,this._tessParams.normalX=c,this._tessParams.normalY=l,this._tessParams.directionX=i,this._tessParams.directionY=a,this._tessParams.distance=u,this._tessParams.pathLength=h,this._tessParams.lineLength=d,this._writeVertex(f,p,e,t,this._tessParams),this._currentWrite.vertexFrom+this._currentWrite.vertexCount++}_writeTriangle(e,t,n){let{out:r}=this._currentWrite;r.indexEnsureSize(3),r.indexWrite(e),r.indexWrite(t),r.indexWrite(n),this._currentWrite.indexCount+=3}}export{k as AAnimatedPolyMeshWriter,A as AnimatedFillMeshWriter,N as AnimatedLineMeshWriter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{complexFillVertexSpec as t,getPatternSize as n,packComplexFillBitset as r}from"./ComplexFillMeshWriter.js";import{packBitset as i}from"./meshWriterUtils.js";import{OutlineFillMeshWriter as a,OutlineFillOutlineMeshWriter as o,outlineFillVertexSpec_Outline as s}from"./OutlineFillMeshWriter.js";import{packPrecision as c,signedToUnsignedByte as l,bitsetTypeFillOutline as u}from"../shaders/constants.js";import{DataType as d}from"../../../../../../webgl/enums.js";const f=t,p=s,m={createComputedParams:e=>e,optionalAttributes:f.optionalAttributes,attributes:{...f.attributes,bitset:{type:d.UNSIGNED_BYTE,count:1,pack:e=>r(e)},aux1:{count:1,type:d.HALF_FLOAT,pack:e=>n(e).width},aux2:{count:1,type:d.HALF_FLOAT,pack:e=>n(e).height},aux3:{count:2,type:d.HALF_FLOAT,pack:({offsetX:t,offsetY:n})=>[e(t),e(n)]},aux4:{count:2,type:d.UNSIGNED_BYTE,pack:({scaleX:e,scaleY:t})=>[e*c,t*c]}}},h={createComputedParams:e=>e,optionalAttributes:f.optionalAttributes,attributes:{...f.attributes,color:p.attributes.color,bitset:{type:d.UNSIGNED_BYTE,count:1,pack:e=>i([[u,!0]])},aux1:{count:1,type:d.HALF_FLOAT,pack:t=>e(.5*t.width)},aux2:{count:1,type:d.HALF_FLOAT,pack:t=>e(.5*t.referenceWidth)},aux3:{count:2,type:d.HALF_FLOAT,packTessellation:({extrusionOffsetX:e,extrusionOffsetY:t})=>[e,t]},aux4:{count:2,type:d.UNSIGNED_BYTE,packTessellation:({normalX:e,normalY:t})=>[e*c+l,t*c+l]}}};class g extends o{constructor(){super(...arguments),this.vertexSpec=h}}class _ extends a{constructor(){super(...arguments),this.vertexSpec=m}_createOutlineWriter(e,t,n,r){return new g(e,t,n,r)}write(e,t,n,r,i,a,o,s,c={}){let l={target:n,options:r,level:i,viewExtent:a,scaleFactor:o,matcher:s,...c};this.ensurePacked(t,n,r,l);let u=this.evaluatedMeshParams.sprite?.
|
|
2
|
+
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{complexFillVertexSpec as t,getPatternSize as n,packComplexFillBitset as r}from"./ComplexFillMeshWriter.js";import{packBitset as i}from"./meshWriterUtils.js";import{OutlineFillMeshWriter as a,OutlineFillOutlineMeshWriter as o,outlineFillVertexSpec_Outline as s}from"./OutlineFillMeshWriter.js";import{packPrecision as c,signedToUnsignedByte as l,bitsetTypeFillOutline as u}from"../shaders/constants.js";import{DataType as d}from"../../../../../../webgl/enums.js";const f=t,p=s,m={createComputedParams:e=>e,optionalAttributes:f.optionalAttributes,attributes:{...f.attributes,bitset:{type:d.UNSIGNED_BYTE,count:1,pack:e=>r(e)},aux1:{count:1,type:d.HALF_FLOAT,pack:e=>n(e).width},aux2:{count:1,type:d.HALF_FLOAT,pack:e=>n(e).height},aux3:{count:2,type:d.HALF_FLOAT,pack:({offsetX:t,offsetY:n})=>[e(t),e(n)]},aux4:{count:2,type:d.UNSIGNED_BYTE,pack:({scaleX:e,scaleY:t})=>[e*c,t*c]}}},h={createComputedParams:e=>e,optionalAttributes:f.optionalAttributes,attributes:{...f.attributes,color:p.attributes.color,bitset:{type:d.UNSIGNED_BYTE,count:1,pack:e=>i([[u,!0]])},aux1:{count:1,type:d.HALF_FLOAT,pack:t=>e(.5*t.width)},aux2:{count:1,type:d.HALF_FLOAT,pack:t=>e(.5*t.referenceWidth)},aux3:{count:2,type:d.HALF_FLOAT,packTessellation:({extrusionOffsetX:e,extrusionOffsetY:t})=>[e,t]},aux4:{count:2,type:d.UNSIGNED_BYTE,packTessellation:({normalX:e,normalY:t})=>[e*c+l,t*c+l]}}};class g extends o{constructor(){super(...arguments),this.vertexSpec=h}}class _ extends a{constructor(){super(...arguments),this.vertexSpec=m}_createOutlineWriter(e,t,n,r){return new g(e,t,n,r)}write(e,t,n,r,i,a,o,s,c={}){let l={target:n,options:r,level:i,viewExtent:a,scaleFactor:o,matcher:s,...c};this.ensurePacked(t,n,r,l);let u=this.evaluatedMeshParams.sprite?.textureKey;e.withRecord(this.instanceId,this.attributeLayout,u,()=>{this._write(e,l)})}ensurePacked(e,t,n,r){super.ensurePacked(e,t,n,r),this._lineMeshWriter.ensurePacked(e,t,n,r)}enqueueRequest(e,t,n){super.enqueueRequest(e,t,n),this._lineMeshWriter.enqueueRequest(e,t,n)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}}export{_ as ComplexOutlineFillMeshWriter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{CIMSymbolUnits as e}from"../../../../../../../symbols/cim/types.js";import{spritePadding as t,gradientTextureExternalPadding as n}from"../../../definitions.js";import{AFillMeshWriter as r}from"./AFillMeshWriter.js";import{fillVertexSpec as i}from"./FillMeshWriter.js";import{gradientFillMethods as a,bitset as o}from"./gradientFillConstants.js";import{getGradientSizeHelper as s}from"./GradientSizeHelper.js";import{getBitMask as c}from"./meshWriterUtils.js";import{DataType as l}from"../../../../../../webgl/enums.js";const u={createComputedParams:e=>e,optionalAttributes:i.optionalAttributes,attributes:{...i.attributes,bitset:{type:l.UNSIGNED_BYTE,count:1,pack:({gradientSizeUnits:t,gradientType:n})=>{let r=0;return t===e.Absolute&&(r|=c(o.isAbsolute)),n.toLowerCase()===`discrete`&&(r|=c(o.isDiscrete)),r}},tlbr:{count:4,type:l.UNSIGNED_SHORT,pack:({sprite:e})=>{let{rect:r,width:i,height:a}=e,o=r.x+t+n,s=r.y+t;return[o,s,o+i-2*n,s+a]}},relativePosition:{count:2,type:l.HALF_FLOAT,packTessellation:({gradientStats:e},t,n,r)=>e?.getRelativePosition(n,r)??[0,0]},relativeGradientSize:{count:2,type:l.HALF_FLOAT,packTessellation:({gradientStats:e})=>e?.relativeSize??[1,1]},gradientMethod:{count:1,type:l.UNSIGNED_BYTE,pack:({gradientMethod:e})=>{switch(e.toLowerCase()){case`rectangular`:return a.rectangular;case`circular`:return a.circular;default:return a.linear}}}}};class d extends r{constructor(){super(...arguments),this.vertexSpec=u}get _effectRotation(){let{effectRotation:e,effectRotationType:t,useEffectOrigin:n,viewRotation:r}=this.evaluatedMeshParams;return e==null&&r==null?null:{value:e,type:t,useEffectOrigin:!!n,viewRotation:r}}get _preventEffectClipping(){return!0}createTesselationParams(e){return{gradientStats:s(this._unclippedGeometry,this.evaluatedMeshParams)}}_write(e,{target:t,effect:n}){let r=n?.geometry?.asOptimized()??t.readGeometryForDisplay();this._unclippedGeometry=r;let i=this._clip(r);if(!i){this._unclippedGeometry=null;return}let a=this.evaluatedMeshParams.sprite?.
|
|
2
|
+
import{CIMSymbolUnits as e}from"../../../../../../../symbols/cim/types.js";import{spritePadding as t,gradientTextureExternalPadding as n}from"../../../definitions.js";import{AFillMeshWriter as r}from"./AFillMeshWriter.js";import{fillVertexSpec as i}from"./FillMeshWriter.js";import{gradientFillMethods as a,bitset as o}from"./gradientFillConstants.js";import{getGradientSizeHelper as s}from"./GradientSizeHelper.js";import{getBitMask as c}from"./meshWriterUtils.js";import{DataType as l}from"../../../../../../webgl/enums.js";const u={createComputedParams:e=>e,optionalAttributes:i.optionalAttributes,attributes:{...i.attributes,bitset:{type:l.UNSIGNED_BYTE,count:1,pack:({gradientSizeUnits:t,gradientType:n})=>{let r=0;return t===e.Absolute&&(r|=c(o.isAbsolute)),n.toLowerCase()===`discrete`&&(r|=c(o.isDiscrete)),r}},tlbr:{count:4,type:l.UNSIGNED_SHORT,pack:({sprite:e})=>{let{rect:r,width:i,height:a}=e,o=r.x+t+n,s=r.y+t;return[o,s,o+i-2*n,s+a]}},relativePosition:{count:2,type:l.HALF_FLOAT,packTessellation:({gradientStats:e},t,n,r)=>e?.getRelativePosition(n,r)??[0,0]},relativeGradientSize:{count:2,type:l.HALF_FLOAT,packTessellation:({gradientStats:e})=>e?.relativeSize??[1,1]},gradientMethod:{count:1,type:l.UNSIGNED_BYTE,pack:({gradientMethod:e})=>{switch(e.toLowerCase()){case`rectangular`:return a.rectangular;case`circular`:return a.circular;default:return a.linear}}}}};class d extends r{constructor(){super(...arguments),this.vertexSpec=u}get _effectRotation(){let{effectRotation:e,effectRotationType:t,useEffectOrigin:n,viewRotation:r}=this.evaluatedMeshParams;return e==null&&r==null?null:{value:e,type:t,useEffectOrigin:!!n,viewRotation:r}}get _preventEffectClipping(){return!0}createTesselationParams(e){return{gradientStats:s(this._unclippedGeometry,this.evaluatedMeshParams)}}_write(e,{target:t,effect:n}){let r=n?.geometry?.asOptimized()??t.readGeometryForDisplay();this._unclippedGeometry=r;let i=this._clip(r);if(!i){this._unclippedGeometry=null;return}let a=this.evaluatedMeshParams.sprite?.textureKey;e.recordStart(this.instanceId,this.attributeLayout,a),this._writeGeometry(e,t,i),this._unclippedGeometry=null,e.recordEnd()}}export{d as GradientFillMeshWriter,u as gradientFillVertexSpec};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{spritePadding as e}from"../../../definitions.js";import{fillVertexSpec as t,FillMeshWriter as n}from"./FillMeshWriter.js";import{DataType as r}from"../../../../../../webgl/enums.js";const i={createComputedParams:e=>e,optionalAttributes:t.optionalAttributes,attributes:{...t.attributes,tlbr:{count:4,type:r.UNSIGNED_SHORT,pack:({sprite:t})=>{let{rect:n,width:r,height:i}=t,a=n.x+e,o=n.y+e;return[a,o,a+r,o+i]}},inverseRasterizationScale:{count:1,type:r.BYTE,packPrecisionFactor:16,pack:({sprite:e})=>1/e.rasterizationScale}}};class a extends n{constructor(){super(...arguments),this.vertexSpec=i}_write(e,{target:t,effect:n}){let r=n?.geometry?.asOptimized()??t.readGeometryForDisplay(),i=this._clip(r);if(!i)return;let a=this.evaluatedMeshParams.sprite?.
|
|
2
|
+
import{spritePadding as e}from"../../../definitions.js";import{fillVertexSpec as t,FillMeshWriter as n}from"./FillMeshWriter.js";import{DataType as r}from"../../../../../../webgl/enums.js";const i={createComputedParams:e=>e,optionalAttributes:t.optionalAttributes,attributes:{...t.attributes,tlbr:{count:4,type:r.UNSIGNED_SHORT,pack:({sprite:t})=>{let{rect:n,width:r,height:i}=t,a=n.x+e,o=n.y+e;return[a,o,a+r,o+i]}},inverseRasterizationScale:{count:1,type:r.BYTE,packPrecisionFactor:16,pack:({sprite:e})=>1/e.rasterizationScale}}};class a extends n{constructor(){super(...arguments),this.vertexSpec=i}_write(e,{target:t,effect:n}){let r=n?.geometry?.asOptimized()??t.readGeometryForDisplay(),i=this._clip(r);if(!i)return;let a=this.evaluatedMeshParams.sprite?.textureKey;e.recordStart(this.instanceId,this.attributeLayout,a),this._writeGeometry(e,t,i),e.recordEnd()}}export{a as PatternFillMeshWriter,i as patternFillVertexSpec};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{OutlineFillMeshWriter as e,outlineFillVertexSpec_Fill as t,OutlineFillOutlineMeshWriter as n,outlineFillVertexSpec_Outline as r}from"./OutlineFillMeshWriter.js";import{patternFillVertexSpec as i}from"./PatternFillMeshWriter.js";const a={optionalAttributes:i.optionalAttributes,createComputedParams:e=>e,attributes:{...i.attributes,...t.attributes}},o={optionalAttributes:i.optionalAttributes,createComputedParams:e=>e,attributes:{...i.attributes,...r.attributes}};class s extends n{constructor(){super(...arguments),this.vertexSpec=o}}class c extends e{constructor(){super(...arguments),this.vertexSpec=a}_createOutlineWriter(e,t,n,r){return new s(e,t,n,r)}write(e,t,n,r,i,a,o,s,c={}){let l={target:n,options:r,level:i,viewExtent:a,scaleFactor:o,matcher:s,...c};this.ensurePacked(t,n,r,l);let u=this.evaluatedMeshParams.sprite?.
|
|
2
|
+
import{OutlineFillMeshWriter as e,outlineFillVertexSpec_Fill as t,OutlineFillOutlineMeshWriter as n,outlineFillVertexSpec_Outline as r}from"./OutlineFillMeshWriter.js";import{patternFillVertexSpec as i}from"./PatternFillMeshWriter.js";const a={optionalAttributes:i.optionalAttributes,createComputedParams:e=>e,attributes:{...i.attributes,...t.attributes}},o={optionalAttributes:i.optionalAttributes,createComputedParams:e=>e,attributes:{...i.attributes,...r.attributes}};class s extends n{constructor(){super(...arguments),this.vertexSpec=o}}class c extends e{constructor(){super(...arguments),this.vertexSpec=a}_createOutlineWriter(e,t,n,r){return new s(e,t,n,r)}write(e,t,n,r,i,a,o,s,c={}){let l={target:n,options:r,level:i,viewExtent:a,scaleFactor:o,matcher:s,...c};this.ensurePacked(t,n,r,l);let u=this.evaluatedMeshParams.sprite?.textureKey;e.withRecord(this.instanceId,this.attributeLayout,u,()=>{this._write(e,l)})}ensurePacked(e,t,n,r){super.ensurePacked(e,t,n,r),this._lineMeshWriter.ensurePacked(e,t,n,r)}enqueueRequest(e,t,n){super.enqueueRequest(e,t,n),this._lineMeshWriter.enqueueRequest(e,t,n)}async loadDependencies(){await Promise.all([super.loadDependencies(),this._lineMeshWriter.loadDependencies()])}}export{c as PatternOutlineFillMeshWriter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{importLazily as e}from"../../../../../../../core/importUtils.js";import{memoize as t}from"../../../../../../../core/MapUtils.js";import{pt2px as n}from"../../../../../../../core/screenUtils.js";import{numericHash as r}from"../../../../../../../core/string.js";import{fromRotation as i,translate as a}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as s,set as c,sub as l,normalize as u,add as d,scale as f}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as p}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as m}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertGeometryToFlat as h,convertOptimizedGeometryToFlat as g,convertFlatToOptimizedGeometry as _,FlatGeometry as v}from"../../../../../../../geometry/FlatGeometry.js";import{GeometryCursor as y}from"../../../../../../../geometry/GeometryCursor.js";import{getLabelPoint as b}from"../../../../../../../geometry/support/labelPoint.js";import{generalizeOptimizedGeometry as x,convertToGeometry as S}from"../../../../../../../layers/graphics/featureConversionUtils.js";import C from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as w}from"../../../definitions.js";import T from"../../../collisions/BoundingBox.js";import{LabelMetric as E}from"../../../collisions/LabelMetric.js";import{smoothPaths as D,pathDivide as O,closestPointOnPaths as k}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as A,processColorInput as j}from"../fill/meshWriterUtils.js";import{TextMeshWriter as M,maxLabelZoom as N}from"../text/TextMeshWriter.js";const P=w*w/16;function F(e,t,n,r){if(n===0&&r===0)return null;let i=Math.max(e.xmax-e.xmin,e.ymax-e.ymin)+1;return{x:t.x-n*i,y:t.y+r*i}}const I=e(()=>import(`../../../../../../../geometry/operators/gx/operatorIntersection.js`)),L=e(()=>import(`../../../../../../../chunks/FlatGeometry.js`));function R(e,t,n){return r(`${e}${t}${n}`)}function z(e,t,n,i,a){let o=i*2**(N-a);return r(`${e}${t}${n}${o}`)}function B(e,t,n){return r(`${e}${t}${n}`)}function V(e,t,n,i,a){let o=n*2**(N-i);return r(`${e}${a}${t}${o}`)}const H=t(e=>{let t=0;if(e===0)return 1/0;for(;!(e%2);)t++,e/=2;return t});class U extends M{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!0,this._zoomLevel=0,this._calloutVisuals=[],this._calloutVisualIndex=0}async loadDependencies(){await Promise.all([super.loadDependencies(),I.getImportPromise(),L.getImportPromise()])}getCalloutEffectGeometry(e){let t=this._calloutVisuals[this._calloutVisualIndex]?.metric;return t?y.fromJSON({x:t.anchorX,y:t.anchorY}):null}getLocalCalloutReferenceInfo(){let e=this._calloutVisuals[this._calloutVisualIndex],t=e?.referenceInfo;if(!t||!e)return t;let{metric:n,featureAnchor:r}=e,i=t.anchor??{x:0,y:0},a={x:r[0]-n.anchorX,y:n.anchorY-r[1]},o={x:a.x+i.x,y:a.y+i.y},s=F(t.bodyBounds,o,n.directionX,n.directionY);return{...t,anchor:o,...s?{layoutAnchor:s}:null}}getCalloutVisualCount(){return this._calloutVisuals.length}setCalloutVisualIndex(e){if(e<0||e>=this._calloutVisuals.length)throw Error(`InternalError: callout visual index is out of bounds`);this._calloutVisualIndex=e}includeCalloutRecordRange(e,t){this._calloutVisuals[this._calloutVisualIndex]?.metric.includeRecordRange(e,t)}includeCalloutCollisionBounds(e){this._calloutVisuals[this._calloutVisualIndex]?.metric.includeCalloutCollisionBounds(e)}includeCalloutPartCollisionBounds(e){this._calloutVisuals[this._calloutVisualIndex]?.metric.includeCalloutPartCollisionBounds(e)}_write(e,{target:t,effect:n,level:r,viewExtent:i}){if(this._zoomLevel=r,this._calloutVisuals=[],this._calloutVisualIndex=0,n?.geometry!=null)throw Error(`InternalError: EffectGeometry not support for LabelMeshWriter`);switch(t.geometryType){case`esriGeometryPoint`:{let n=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,n,r,0,t);break}case`esriGeometryEnvelope`:case`esriGeometryPolygon`:this._writePolygon(e,t,i);break;case`esriGeometryMultipoint`:{let n=0,r=y.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,n++,t);break}case`esriGeometryPolyline`:this._writeLines(e,t)}}_getMetricDir(){let{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return[e===`center`?0:e===`right`?-1:1,t===`middle`?0:t===`bottom`?-1:1]}_createLineLabelMetric(e,t,n,r,i,a){let[o,s]=this._getMetricDir(),c=this.evaluatedMeshParams.scaleInfo?.maxScale??0,l=this.evaluatedMeshParams.scaleInfo?.minScale??0,u=this.evaluatedMeshParams.labelClassId;return new E(e,u,t,n,r,i,o,s,c,l,a)}_writePolygon(e,t,n){let r=t.readGeometryForDisplay()?.justXY();e.requiresRefresh||=(r?.area()||0)>=P;let i=this._getPolygonLabelPoint(t,n);i&&this._writePoint(e,i[0],i[1],0,t)}_getPolygonLabelPoint(e,t){if(!t){let t=e.readCentroidForDisplay()?.coords;return t?[t[0],t[1]]:null}let n=I.module,r=L.module.constructFromFlatGeometry,i=e.readGeometryForDisplay()?.justXY(),a=e.readCentroidForDisplay()?.coords,o=i?.area()||0;if(!a)return;let s=o>=P,c=r(h(t)),l=r(h({x:a[0],y:a[1]})),u=!!n.execute(l,c,null);if(!i||!s||!u)return[a[0],a[1]];let d=r(g(`polygon`,i,null)),f=n.execute(d,c,null);if(!f)return[a[0],a[1]];let p=_(new v(f.toFlatGeometry())),m=y.fromOptimized(p,`esriGeometryPolygon`,1),x=b(m)??a;return[x[0],x[1]]}_writePoint(e,t,n,r,i){if(t<0||t>w||n<0||n>w)return;let a=this._getShaping();if(!a)return;let o=i.getDisplayId(),s=this.evaluatedMeshParams.labelClassId,c=this.evaluatedMeshParams.layerId,l=R(c,i.getObjectId(),r),u=B(i.getObjectId(),s,r),[d,f]=this._getMetricDir(),p=this.evaluatedMeshParams.scaleInfo?.maxScale??0,m=this.evaluatedMeshParams.scaleInfo?.minScale??0,h=this._getPointLabelReferenceBounds(),g=new E(o,s,l,u,t,n,d,f,p,m,h);this._calloutVisuals.push({metric:g,featureAnchor:[t,n],referenceInfo:this._createLocalCalloutReferenceInfo(a,h)}),e.metricStart(g),this._writeGlyphs(e,o,t,n,a,0,h,void 0,!1),e.metricBoxWrite(a.boundsT),e.metricEnd()}_getPointReferenceBounds(){return this._references?.get(`label-reference-symbol`)?.getBoundsInfo()??null}_getPointLabelReferenceBounds(){let e=this._getPointReferenceBounds()??{offsetX:0,offsetY:0,size:0},t=this.evaluatedMeshParams.labelOffsetDistance??0,[n,r]=this._getMetricDir();return{...e,offsetX:e.offsetX+n*t,offsetY:e.offsetY-r*t}}_writeLines(e,t){let{scaleInfo:n,verticalAlignment:r}=this.evaluatedMeshParams,i=this.evaluatedMeshParams.repeatLabelDistance||128,a=this._getShaping(`middle`);if(!a)return;let o=(e,t,n,r)=>this._placeSubdivGlyphs(e,t,n,r),s=(a.bounds.width+i)/2;this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:a,zoomRange:A(n,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},calloutPaths:t.readLegacyGeometryForDisplay().paths.map(e=>e.map(([e,t])=>[e,t])),offsetDirection:null,pathIndex:0},this._verticalPlacement=r===`bottom`?`above`:r===`top`?`below`:null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,o,s):this._writeCenterAlong(t,o,s)}_writeAboveAndBelowAlong(e,t,n){let{repeatLabel:r}=this.evaluatedMeshParams,{shaping:i}=this._current,a=i.bounds.halfHeight,o=e.readGeometryForDisplay()?.justXY();if(!o)return;let s=x(o,`esriGeometryPolyline`,1)??new C,c=W(s,a),l=W(s,-a),u=S(l,`esriGeometryPolyline`,!1,!1),d=S(c,`esriGeometryPolyline`,!1,!1),f=D(d.paths,i.bounds.width),p=D(u.paths,i.bounds.width);this._current.offsetDirection=`above`;for(let e=0;e<f.length;e++)this._current.pathIndex=e,O(f[e],n,t,!!r);this._current.offsetDirection=`below`;for(let e=0;e<p.length;e++)this._current.pathIndex=e,O(p[e],n,t,!!r)}_writeCenterAlong(e,t,n){let{repeatLabel:r}=this.evaluatedMeshParams,{shaping:i}=this._current,a=D(e.readLegacyGeometryForDisplay().paths,i.bounds.width);for(let e=0;e<a.length;e++)this._current.pathIndex=e,O(a[e],n,t,!!r)}_placeSubdivGlyphs(e,t,n,r){if(e.x<0||e.x>w||e.y<0||e.y>w)return;let{allowOverrun:i,labelPosition:a,repeatLabelDistance:o,layerId:s,labelClassId:c}=this.evaluatedMeshParams,{objId:l,shaping:u,pathIndex:d}=this._current,f=this._current.zoomRange[0],p=H(t),m=this._current.shaping.bounds.width/2,h=Math.sqrt(o||128)/2,g=Math.min(n,r-n),_=u.isMultiline?N:Math.log2(g/(h+m/2)),v=t===0?_:Math.min(p,_),y=Math.max(f,this._zoomLevel+1-v),b=this._zoomLevel-y,x=u.bounds.width/2*2**b,S=z(s,l,d,t,this._zoomLevel),C=V(l,d,t,this._zoomLevel,c);i&&b<0?this._placeStraightAlong(e,f,S,C):a===`parallel`||u.isMultiline?this._placeStraightAlong(e,y,S,C):a===`curved`&&this._placeCurved(e,y,x,S,C)}_placeCurved(e,t,n,r,i){let{out:a,id:o}=this._current,s=this._createLineLabelMetric(o,r,i,e.x,e.y);this._registerLineCalloutMetric(s),a.metricStart(s);let c=e.clone(),l=e.angle*(180/Math.PI)%360,u=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(c,t,1,l),this._placeBack(e,c,t,n,1,l),this._placeForward(e,c,t,n,1,l)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(c,t,0,u),this._placeBack(e,c,t,n,0,u),this._placeForward(e,c,t,n,0,u)),a.metricEnd()}_placeStraightAlong(e,t,r,s){let{out:c,id:l,shaping:u,zoomRange:d,referenceBounds:f}=this._current,{boxBorderLineColor:m,boxBackgroundColor:h}=this.evaluatedMeshParams,g=e.clone(),_=e.angle*(180/Math.PI)%360,v=(e.angle*(180/Math.PI)+180)%360,y=u.glyphs.length>0&&!!(m||h),b=this._createLineLabelMetric(l,r,s,e.x,e.y);if(this._registerLineCalloutMetric(b),c.metricStart(b),y){let r=Math.max(t,d[0],0),s=Math.min(N,d[1]),m=i(o(),-e.angle),h={minZoom:r,maxZoom:s,clipAngle:_,mapAligned:!0,isLineLabel:!0},g=n(this.evaluatedMeshParams.offsetX),y=n(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){let t=p(g,-1*y),[n,r]=u.shapeBackground(a(o(),m,t));c.recordStart(this.instanceId,this.attributeLayout,u.glyphs[0].textureBinding),this._writeTextBox(c,l,e.x,e.y,r,f,h),c.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){let t=p(g,y),[n,r]=u.shapeBackground(a(o(),m,t));h.clipAngle=v,c.recordStart(this.instanceId,this.attributeLayout,u.glyphs[0].textureBinding),this._writeTextBox(c,l,e.x,e.y,r,f,h),c.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(g,t,1,_,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(g,t,0,v,!0),c.metricEnd()}_registerLineCalloutMetric(e){this._calloutVisuals.push({metric:e,featureAnchor:k(this._current.calloutPaths,e.anchorX,e.anchorY),referenceInfo:this._createLocalCalloutReferenceInfo(this._current.shaping)})}_placeBack(e,t,n,r,i,a){let o=e.clone(),s=e.backwardLength+0;for(;o.prev()&&!(s>=r);)this._placeOnSegment(o,t,s,n,-1,i,a),s+=o.length+0}_placeForward(e,t,n,r,i,a){let o=e.clone(),s=e.remainingLength+0;for(;o.next()&&!(s>=r);)this._placeOnSegment(o,t,s,n,1,i,a),s+=o.length+0}_placeFirst(e,t,n,r,i=!1){let{out:a,id:o,shaping:s,zoomRange:c,referenceBounds:l}=this._current,u=s.glyphs,d=this._getBoundsOffset(e.angle);for(let f of u){let u=f.x>s.bounds.x?n:1-n,p=u*e.remainingLength+(1-u)*e.backwardLength,m=Math.abs(f.x+f.width/2-s.bounds.x),h=Math.max(0,this._zoomLevel+Math.log2(m/(p+0))),g=Math.max(t,i?0:h);f.angle=e.angle+(1-n)*Math.PI;let _=[Math.max(c[0],g),Math.min(c[1],N)];this._writeLineGlyph(a,o,e.x,e.y,f,_,r,l),this._writeLineGlyphBox(a,f,n,_,d)}}_placeOnSegment(e,t,n,r,i,a,o){let{out:s,id:c,shaping:l,referenceBounds:u}=this._current,d=l.glyphs,f=e.dx/e.length,p=e.dy/e.length,m={x:e.x+n*-i*f,y:e.y+n*-i*p},h=this._getBoundsOffset(e.angle);for(let t of d){let d=t.x>l.bounds.x?a:1-a;if(!(d&&i===1||!d&&i===-1))continue;let f=Math.abs(t.x+t.width/2-l.bounds.x),p=Math.max(0,this._zoomLevel+Math.log2(f/n)-.1),g=Math.max(r,this._zoomLevel+Math.log2(f/(n+e.length+0)));if(p===0)continue;t.angle=e.angle+(1-a)*Math.PI;let _=[g,p];this._writeLineGlyph(s,c,m.x,m.y,t,_,o,u),this._writeLineGlyphBox(s,t,a,_,h)}}_getBoundsOffset(e){let t=n(this.evaluatedMeshParams.offsetX),r=n(this.evaluatedMeshParams.offsetY),a=p(t,r),c=i(o(),-e);return s(a,a,c)}_writeLineGlyph(e,t,n,r,i,a,o,s){e.recordStart(this.instanceId,this.attributeLayout,i.textureBinding);let{texcoords:c,offsets:l}=i,{fontSize:u,haloSize:d,outlineSize:f}=this._textMeshTransformProps,p=this._getDefaultGlyphMetrics(this.evaluatedMeshParams.glyphs),m=i.fontSize??u;this._writeQuad(e,t,n,r,{sdfSize:p.sdfSize,sdfRadius:p.sdfRadius,texcoords:c,offsets:l,fontSize:m,haloSize:d,outlineSize:f,color:i.color?j(i.color):j(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:s,minZoom:Math.max(this._current.zoomRange[0],a[0]),maxZoom:Math.min(this._current.zoomRange[1],a[1]),clipAngle:o,mapAligned:!0,isLineLabel:!0}),e.recordEnd()}_writeLineGlyphBox(e,t,n,r,i){if((n||this._current.offsetDirection)&&this._isVisible(r)&&t.bounds){let n=t.bounds,r=new T(n.x+i[0],n.y+i[1],n.width,n.height);e.metricBoxWrite(r)}}_isVisible(e){let t=Math.max(this._current.zoomRange[0],e[0]),n=Math.min(this._current.zoomRange[1],e[1]),r=this._zoomLevel;return t<=r&&r<=n}}function W(e,t){let n=new C,{coords:r,lengths:i}=e,a=m(),o=m(),s=m(),p=m(),h=m(),g=m(),_=0;for(let e=0;e<i.length;e++){let m=i[e];for(let e=0;e<m;e++){let i=2*(e+_-1),v=2*(e+_),y=2*(e+_+1);e>0?c(a,r[i],r[i+1]):c(a,0,0),c(o,r[v],r[v+1]),e<m-1?c(s,r[y],r[y+1]):c(s,0,0),e===0?c(p,0,0):(l(p,o,a),u(p,p),c(p,p[1],-p[0])),e===m-1?c(h,0,0):(l(h,s,o),u(h,h),c(h,h[1],-h[0])),d(g,p,h),u(g,g);let b=g[0]*h[0]+g[1]*h[1];b!==0&&f(g,g,b),f(g,g,t),n.coords.push(o[0]+g[0],o[1]+g[1])}n.lengths.push(m),_+=m}return n}export{U as LabelMeshWriter,R as labelIdHash,B as labelMetricHash,z as lineLabelIdHash,V as lineLabelMetricHash};
|
|
2
|
+
import{importLazily as e}from"../../../../../../../core/importUtils.js";import{memoize as t}from"../../../../../../../core/MapUtils.js";import{pt2px as n}from"../../../../../../../core/screenUtils.js";import{numericHash as r}from"../../../../../../../core/string.js";import{fromRotation as i,translate as a}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as o}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as s,set as c,sub as l,normalize as u,add as d,scale as f}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as p}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{create as m}from"../../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{convertGeometryToFlat as h,convertOptimizedGeometryToFlat as g,convertFlatToOptimizedGeometry as _,FlatGeometry as v}from"../../../../../../../geometry/FlatGeometry.js";import{GeometryCursor as y}from"../../../../../../../geometry/GeometryCursor.js";import{getLabelPoint as b}from"../../../../../../../geometry/support/labelPoint.js";import{generalizeOptimizedGeometry as x,convertToGeometry as S}from"../../../../../../../layers/graphics/featureConversionUtils.js";import C from"../../../../../../../layers/graphics/OptimizedGeometry.js";import{tileSize as w}from"../../../definitions.js";import T from"../../../collisions/BoundingBox.js";import{LabelMetric as E}from"../../../collisions/LabelMetric.js";import{smoothPaths as D,pathDivide as O,closestPointOnPaths as k}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as A,processColorInput as j}from"../fill/meshWriterUtils.js";import{TextMeshWriter as M,maxLabelZoom as N}from"../text/TextMeshWriter.js";const P=w*w/16;function F(e,t,n,r){if(n===0&&r===0)return null;let i=Math.max(e.xmax-e.xmin,e.ymax-e.ymin)+1;return{x:t.x-n*i,y:t.y+r*i}}const I=e(()=>import(`../../../../../../../geometry/operators/gx/operatorIntersection.js`)),L=e(()=>import(`../../../../../../../chunks/FlatGeometry.js`));function R(e,t,n){return r(`${e}${t}${n}`)}function z(e,t,n,i,a){let o=i*2**(N-a);return r(`${e}${t}${n}${o}`)}function B(e,t,n){return r(`${e}${t}${n}`)}function V(e,t,n,i,a){let o=n*2**(N-i);return r(`${e}${a}${t}${o}`)}const H=t(e=>{let t=0;if(e===0)return 1/0;for(;!(e%2);)t++,e/=2;return t});class U extends M{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!0,this._zoomLevel=0,this._calloutVisuals=[],this._calloutVisualIndex=0}async loadDependencies(){await Promise.all([super.loadDependencies(),I.getImportPromise(),L.getImportPromise()])}getCalloutEffectGeometry(e){let t=this._calloutVisuals[this._calloutVisualIndex]?.metric;return t?y.fromJSON({x:t.anchorX,y:t.anchorY}):null}getLocalCalloutReferenceInfo(){let e=this._calloutVisuals[this._calloutVisualIndex],t=e?.referenceInfo;if(!t||!e)return t;let{metric:n,featureAnchor:r}=e,i=t.anchor??{x:0,y:0},a={x:r[0]-n.anchorX,y:n.anchorY-r[1]},o={x:a.x+i.x,y:a.y+i.y},s=F(t.bodyBounds,o,n.directionX,n.directionY);return{...t,anchor:o,...s?{layoutAnchor:s}:null}}getCalloutVisualCount(){return this._calloutVisuals.length}setCalloutVisualIndex(e){if(e<0||e>=this._calloutVisuals.length)throw Error(`InternalError: callout visual index is out of bounds`);this._calloutVisualIndex=e}includeCalloutRecordRange(e,t){this._calloutVisuals[this._calloutVisualIndex]?.metric.includeRecordRange(e,t)}includeCalloutCollisionBounds(e){this._calloutVisuals[this._calloutVisualIndex]?.metric.includeCalloutCollisionBounds(e)}includeCalloutPartCollisionBounds(e){this._calloutVisuals[this._calloutVisualIndex]?.metric.includeCalloutPartCollisionBounds(e)}_write(e,{target:t,effect:n,level:r,viewExtent:i}){if(this._zoomLevel=r,this._calloutVisuals=[],this._calloutVisualIndex=0,n?.geometry!=null)throw Error(`InternalError: EffectGeometry not support for LabelMeshWriter`);switch(t.geometryType){case`esriGeometryPoint`:{let n=t.readXForDisplay(),r=t.readYForDisplay();this._writePoint(e,n,r,0,t);break}case`esriGeometryEnvelope`:case`esriGeometryPolygon`:this._writePolygon(e,t,i);break;case`esriGeometryMultipoint`:{let n=0,r=y.fromFeatureSetReader(t);if(r?.nextPath())for(;r.nextPoint();)this._writePoint(e,r.x,r.y,n++,t);break}case`esriGeometryPolyline`:this._writeLines(e,t)}}_getMetricDir(){let{horizontalAlignment:e,verticalAlignment:t}=this.evaluatedMeshParams;return[e===`center`?0:e===`right`?-1:1,t===`middle`?0:t===`bottom`?-1:1]}_createLineLabelMetric(e,t,n,r,i,a){let[o,s]=this._getMetricDir(),c=this.evaluatedMeshParams.scaleInfo?.maxScale??0,l=this.evaluatedMeshParams.scaleInfo?.minScale??0,u=this.evaluatedMeshParams.labelClassId;return new E(e,u,t,n,r,i,o,s,c,l,a)}_writePolygon(e,t,n){let r=t.readGeometryForDisplay()?.justXY();e.requiresRefresh||=(r?.area()||0)>=P;let i=this._getPolygonLabelPoint(t,n);i&&this._writePoint(e,i[0],i[1],0,t)}_getPolygonLabelPoint(e,t){if(!t){let t=e.readCentroidForDisplay()?.coords;return t?[t[0],t[1]]:null}let n=I.module,r=L.module.constructFromFlatGeometry,i=e.readGeometryForDisplay()?.justXY(),a=e.readCentroidForDisplay()?.coords,o=i?.area()||0;if(!a)return;let s=o>=P,c=r(h(t)),l=r(h({x:a[0],y:a[1]})),u=!!n.execute(l,c,null);if(!i||!s||!u)return[a[0],a[1]];let d=r(g(`polygon`,i,null)),f=n.execute(d,c,null);if(!f)return[a[0],a[1]];let p=_(new v(f.toFlatGeometry())),m=y.fromOptimized(p,`esriGeometryPolygon`,1),x=b(m)??a;return[x[0],x[1]]}_writePoint(e,t,n,r,i){if(t<0||t>w||n<0||n>w)return;let a=this._getShaping();if(!a)return;let o=i.getDisplayId(),s=this.evaluatedMeshParams.labelClassId,c=this.evaluatedMeshParams.layerId,l=R(c,i.getObjectId(),r),u=B(i.getObjectId(),s,r),[d,f]=this._getMetricDir(),p=this.evaluatedMeshParams.scaleInfo?.maxScale??0,m=this.evaluatedMeshParams.scaleInfo?.minScale??0,h=this._getPointLabelReferenceBounds(),g=new E(o,s,l,u,t,n,d,f,p,m,h);this._calloutVisuals.push({metric:g,featureAnchor:[t,n],referenceInfo:this._createLocalCalloutReferenceInfo(a,h)}),e.metricStart(g),this._writeGlyphs(e,o,t,n,a,0,h,void 0,!1),e.metricBoxWrite(a.boundsT),e.metricEnd()}_getPointReferenceBounds(){return this._references?.get(`label-reference-symbol`)?.getBoundsInfo()??null}_getPointLabelReferenceBounds(){let e=this._getPointReferenceBounds()??{offsetX:0,offsetY:0,size:0},t=this.evaluatedMeshParams.labelOffsetDistance??0,[n,r]=this._getMetricDir();return{...e,offsetX:e.offsetX+n*t,offsetY:e.offsetY-r*t}}_writeLines(e,t){let{scaleInfo:n,verticalAlignment:r}=this.evaluatedMeshParams,i=this.evaluatedMeshParams.repeatLabelDistance||128,a=this._getShaping(`middle`);if(!a)return;let o=(e,t,n,r)=>this._placeSubdivGlyphs(e,t,n,r),s=(a.bounds.width+i)/2;this._current={out:e,id:t.getDisplayId(),objId:t.getObjectId(),shaping:a,zoomRange:A(n,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0},calloutPaths:t.readLegacyGeometryForDisplay().paths.map(e=>e.map(([e,t])=>[e,t])),offsetDirection:null,pathIndex:0},this._verticalPlacement=r===`bottom`?`above`:r===`top`?`below`:null,this._verticalPlacement?this._writeAboveAndBelowAlong(t,o,s):this._writeCenterAlong(t,o,s)}_writeAboveAndBelowAlong(e,t,n){let{repeatLabel:r}=this.evaluatedMeshParams,{shaping:i}=this._current,a=i.bounds.halfHeight,o=e.readGeometryForDisplay()?.justXY();if(!o)return;let s=x(o,`esriGeometryPolyline`,1)??new C,c=W(s,a),l=W(s,-a),u=S(l,`esriGeometryPolyline`,!1,!1),d=S(c,`esriGeometryPolyline`,!1,!1),f=D(d.paths,i.bounds.width),p=D(u.paths,i.bounds.width);this._current.offsetDirection=`above`;for(let e=0;e<f.length;e++)this._current.pathIndex=e,O(f[e],n,t,!!r);this._current.offsetDirection=`below`;for(let e=0;e<p.length;e++)this._current.pathIndex=e,O(p[e],n,t,!!r)}_writeCenterAlong(e,t,n){let{repeatLabel:r}=this.evaluatedMeshParams,{shaping:i}=this._current,a=D(e.readLegacyGeometryForDisplay().paths,i.bounds.width);for(let e=0;e<a.length;e++)this._current.pathIndex=e,O(a[e],n,t,!!r)}_placeSubdivGlyphs(e,t,n,r){if(e.x<0||e.x>w||e.y<0||e.y>w)return;let{allowOverrun:i,labelPosition:a,repeatLabelDistance:o,layerId:s,labelClassId:c}=this.evaluatedMeshParams,{objId:l,shaping:u,pathIndex:d}=this._current,f=this._current.zoomRange[0],p=H(t),m=this._current.shaping.bounds.width/2,h=Math.sqrt(o||128)/2,g=Math.min(n,r-n),_=u.isMultiline?N:Math.log2(g/(h+m/2)),v=t===0?_:Math.min(p,_),y=Math.max(f,this._zoomLevel+1-v),b=this._zoomLevel-y,x=u.bounds.width/2*2**b,S=z(s,l,d,t,this._zoomLevel),C=V(l,d,t,this._zoomLevel,c);i&&b<0?this._placeStraightAlong(e,f,S,C):a===`parallel`||u.isMultiline?this._placeStraightAlong(e,y,S,C):a===`curved`&&this._placeCurved(e,y,x,S,C)}_placeCurved(e,t,n,r,i){let{out:a,id:o}=this._current,s=this._createLineLabelMetric(o,r,i,e.x,e.y);this._registerLineCalloutMetric(s),a.metricStart(s);let c=e.clone(),l=e.angle*(180/Math.PI)%360,u=(e.angle*(180/Math.PI)+180)%360;this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||(this._placeFirst(c,t,1,l),this._placeBack(e,c,t,n,1,l),this._placeForward(e,c,t,n,1,l)),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||(this._placeFirst(c,t,0,u),this._placeBack(e,c,t,n,0,u),this._placeForward(e,c,t,n,0,u)),a.metricEnd()}_placeStraightAlong(e,t,r,s){let{out:c,id:l,shaping:u,zoomRange:d,referenceBounds:f}=this._current,{boxBorderLineColor:m,boxBackgroundColor:h}=this.evaluatedMeshParams,g=e.clone(),_=e.angle*(180/Math.PI)%360,v=(e.angle*(180/Math.PI)+180)%360,y=u.glyphs.length>0&&!!(m||h),b=this._createLineLabelMetric(l,r,s,e.x,e.y);if(this._registerLineCalloutMetric(b),c.metricStart(b),y){let r=Math.max(t,d[0],0),s=Math.min(N,d[1]),m=i(o(),-e.angle),h={minZoom:r,maxZoom:s,clipAngle:_,mapAligned:!0,isLineLabel:!0},g=n(this.evaluatedMeshParams.offsetX),y=n(this.evaluatedMeshParams.offsetY);if(!this._verticalPlacement||this._verticalPlacement===this._current.offsetDirection){let t=p(g,-1*y),[n,r]=u.shapeBackground(a(o(),m,t));c.recordStart(this.instanceId,this.attributeLayout,u.glyphs[0].textureKey),this._writeTextBox(c,l,e.x,e.y,r,f,h),c.recordEnd()}if(!this._verticalPlacement||this._verticalPlacement!==this._current.offsetDirection){let t=p(g,y),[n,r]=u.shapeBackground(a(o(),m,t));h.clipAngle=v,c.recordStart(this.instanceId,this.attributeLayout,u.glyphs[0].textureKey),this._writeTextBox(c,l,e.x,e.y,r,f,h),c.recordEnd()}}this._verticalPlacement&&this._verticalPlacement!==this._current.offsetDirection||this._placeFirst(g,t,1,_,!0),this._verticalPlacement&&this._verticalPlacement===this._current.offsetDirection||this._placeFirst(g,t,0,v,!0),c.metricEnd()}_registerLineCalloutMetric(e){this._calloutVisuals.push({metric:e,featureAnchor:k(this._current.calloutPaths,e.anchorX,e.anchorY),referenceInfo:this._createLocalCalloutReferenceInfo(this._current.shaping)})}_placeBack(e,t,n,r,i,a){let o=e.clone(),s=e.backwardLength+0;for(;o.prev()&&!(s>=r);)this._placeOnSegment(o,t,s,n,-1,i,a),s+=o.length+0}_placeForward(e,t,n,r,i,a){let o=e.clone(),s=e.remainingLength+0;for(;o.next()&&!(s>=r);)this._placeOnSegment(o,t,s,n,1,i,a),s+=o.length+0}_placeFirst(e,t,n,r,i=!1){let{out:a,id:o,shaping:s,zoomRange:c,referenceBounds:l}=this._current,u=s.glyphs,d=this._getBoundsOffset(e.angle);for(let f of u){let u=f.x>s.bounds.x?n:1-n,p=u*e.remainingLength+(1-u)*e.backwardLength,m=Math.abs(f.x+f.width/2-s.bounds.x),h=Math.max(0,this._zoomLevel+Math.log2(m/(p+0))),g=Math.max(t,i?0:h);f.angle=e.angle+(1-n)*Math.PI;let _=[Math.max(c[0],g),Math.min(c[1],N)];this._writeLineGlyph(a,o,e.x,e.y,f,_,r,l),this._writeLineGlyphBox(a,f,n,_,d)}}_placeOnSegment(e,t,n,r,i,a,o){let{out:s,id:c,shaping:l,referenceBounds:u}=this._current,d=l.glyphs,f=e.dx/e.length,p=e.dy/e.length,m={x:e.x+n*-i*f,y:e.y+n*-i*p},h=this._getBoundsOffset(e.angle);for(let t of d){let d=t.x>l.bounds.x?a:1-a;if(!(d&&i===1||!d&&i===-1))continue;let f=Math.abs(t.x+t.width/2-l.bounds.x),p=Math.max(0,this._zoomLevel+Math.log2(f/n)-.1),g=Math.max(r,this._zoomLevel+Math.log2(f/(n+e.length+0)));if(p===0)continue;t.angle=e.angle+(1-a)*Math.PI;let _=[g,p];this._writeLineGlyph(s,c,m.x,m.y,t,_,o,u),this._writeLineGlyphBox(s,t,a,_,h)}}_getBoundsOffset(e){let t=n(this.evaluatedMeshParams.offsetX),r=n(this.evaluatedMeshParams.offsetY),a=p(t,r),c=i(o(),-e);return s(a,a,c)}_writeLineGlyph(e,t,n,r,i,a,o,s){e.recordStart(this.instanceId,this.attributeLayout,i.textureKey);let{texcoords:c,offsets:l}=i,{fontSize:u,haloSize:d,outlineSize:f}=this._textMeshTransformProps,p=this._getDefaultGlyphMetrics(this.evaluatedMeshParams.glyphs),m=i.fontSize??u;this._writeQuad(e,t,n,r,{sdfSize:p.sdfSize,sdfRadius:p.sdfRadius,texcoords:c,offsets:l,fontSize:m,haloSize:d,outlineSize:f,color:i.color?j(i.color):j(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:s,minZoom:Math.max(this._current.zoomRange[0],a[0]),maxZoom:Math.min(this._current.zoomRange[1],a[1]),clipAngle:o,mapAligned:!0,isLineLabel:!0}),e.recordEnd()}_writeLineGlyphBox(e,t,n,r,i){if((n||this._current.offsetDirection)&&this._isVisible(r)&&t.bounds){let n=t.bounds,r=new T(n.x+i[0],n.y+i[1],n.width,n.height);e.metricBoxWrite(r)}}_isVisible(e){let t=Math.max(this._current.zoomRange[0],e[0]),n=Math.min(this._current.zoomRange[1],e[1]),r=this._zoomLevel;return t<=r&&r<=n}}function W(e,t){let n=new C,{coords:r,lengths:i}=e,a=m(),o=m(),s=m(),p=m(),h=m(),g=m(),_=0;for(let e=0;e<i.length;e++){let m=i[e];for(let e=0;e<m;e++){let i=2*(e+_-1),v=2*(e+_),y=2*(e+_+1);e>0?c(a,r[i],r[i+1]):c(a,0,0),c(o,r[v],r[v+1]),e<m-1?c(s,r[y],r[y+1]):c(s,0,0),e===0?c(p,0,0):(l(p,o,a),u(p,p),c(p,p[1],-p[0])),e===m-1?c(h,0,0):(l(h,s,o),u(h,h),c(h,h[1],-h[0])),d(g,p,h),u(g,g);let b=g[0]*h[0]+g[1]*h[1];b!==0&&f(g,g,b),f(g,g,t),n.coords.push(o[0]+g[0],o[1]+g[1])}n.lengths.push(m),_+=m}return n}export{U as LabelMeshWriter,R as labelIdHash,B as labelMetricHash,z as lineLabelIdHash,V as lineLabelMetricHash};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{CIMSymbolUnits as n}from"../../../../../../../symbols/cim/types.js";import{spritePadding as r,gradientTextureExternalPadding as i}from"../../../definitions.js";import{packBitset as a}from"../fill/meshWriterUtils.js";import{bitset as o}from"./gradientStrokeConstants.js";import{LineMeshWriter as s,LineVertexSpec as c}from"./LineMeshWriter.js";import{DataType as l}from"../../../../../../webgl/enums.js";const u={createComputedParams:e=>e,optionalAttributes:c.optionalAttributes,attributes:{...c.attributes,bitset:{type:l.UNSIGNED_BYTE,count:1,pack:({gradientMethod:e,gradientSizeUnits:t,gradientType:r})=>a([[o.isAlongLine,e.toLowerCase()===`alongline`],[o.isAbsoluteSize,t===n.Absolute],[o.isDiscrete,r.toLowerCase()===`discrete`]])},tlbr:{type:l.UNSIGNED_SHORT,count:4,pack:({sprite:e})=>{let{rect:t,width:n,height:a}=e,o=t.x+r+i,s=t.y+r;return[o,s,o+n-2*i,s+a]}},accumulatedDistance:{type:l.HALF_FLOAT,count:1,packTessellation:({distance:e,pathLength:t,distanceOffset:n})=>(n+e)/t},gradientSize:{type:l.HALF_FLOAT,count:1,pack:({gradientSize:t,gradientSizeUnits:r})=>r===n.Relative?t/100:e(t)},totalLength:{type:l.HALF_FLOAT,count:1,packTessellation:({pathLength:e})=>e},segmentDirection:{type:l.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:e,directionY:t})=>[e,t]}}};class d extends s{get _preventEffectClipping(){return!0}constructor(e,t,n,r){super(e,t,n,r),this.vertexSpec=u,this._tessellationOptions.textured=!0}_write(e,{target:n,effect:r}){let i=r?.geometry??t.fromFeatureSetReaderCIM(n);if(!i)return;let{sprite:a}=this.evaluatedMeshParams;this._writeGeometry(e,n,i,a?.
|
|
2
|
+
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{CIMSymbolUnits as n}from"../../../../../../../symbols/cim/types.js";import{spritePadding as r,gradientTextureExternalPadding as i}from"../../../definitions.js";import{packBitset as a}from"../fill/meshWriterUtils.js";import{bitset as o}from"./gradientStrokeConstants.js";import{LineMeshWriter as s,LineVertexSpec as c}from"./LineMeshWriter.js";import{DataType as l}from"../../../../../../webgl/enums.js";const u={createComputedParams:e=>e,optionalAttributes:c.optionalAttributes,attributes:{...c.attributes,bitset:{type:l.UNSIGNED_BYTE,count:1,pack:({gradientMethod:e,gradientSizeUnits:t,gradientType:r})=>a([[o.isAlongLine,e.toLowerCase()===`alongline`],[o.isAbsoluteSize,t===n.Absolute],[o.isDiscrete,r.toLowerCase()===`discrete`]])},tlbr:{type:l.UNSIGNED_SHORT,count:4,pack:({sprite:e})=>{let{rect:t,width:n,height:a}=e,o=t.x+r+i,s=t.y+r;return[o,s,o+n-2*i,s+a]}},accumulatedDistance:{type:l.HALF_FLOAT,count:1,packTessellation:({distance:e,pathLength:t,distanceOffset:n})=>(n+e)/t},gradientSize:{type:l.HALF_FLOAT,count:1,pack:({gradientSize:t,gradientSizeUnits:r})=>r===n.Relative?t/100:e(t)},totalLength:{type:l.HALF_FLOAT,count:1,packTessellation:({pathLength:e})=>e},segmentDirection:{type:l.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:e,directionY:t})=>[e,t]}}};class d extends s{get _preventEffectClipping(){return!0}constructor(e,t,n,r){super(e,t,n,r),this.vertexSpec=u,this._tessellationOptions.textured=!0}_write(e,{target:n,effect:r}){let i=r?.geometry??t.fromFeatureSetReaderCIM(n);if(!i)return;let{sprite:a}=this.evaluatedMeshParams;this._writeGeometry(e,n,i,a?.textureKey)}}export{d as GradientStrokeMeshWriter,u as GradientStrokeVertexSpec};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{spritePadding as n}from"../../../definitions.js";import{packBitset as r}from"../fill/meshWriterUtils.js";import{LineMeshWriter as i,LineVertexSpec as a}from"./LineMeshWriter.js";import{bitsetGenericConsiderAlphaOnly as o,bitsetLineScaleDash as s,bitsetLineIsSdf as c}from"../shaders/constants.js";import{DataType as l}from"../../../../../../webgl/enums.js";const u={createComputedParams:e=>e,optionalAttributes:a.optionalAttributes,attributes:{...a.attributes,bitset:{type:l.UNSIGNED_BYTE,count:1,pack:({shouldSampleAlphaOnly:e,shouldScaleDash:t,isSDF:n})=>r([[o,e],[s,t],[c,n]])},tlbr:{type:l.UNSIGNED_SHORT,count:4,pack:({sprite:e})=>{let{rect:t,width:r,height:i}=e,a=t.x+n,o=t.y+n;return[a,o,a+r,o+i]}},accumulatedDistance:{type:l.UNSIGNED_SHORT,count:1,packTessellation:({distance:e})=>e},segmentDirection:{type:l.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:e,directionY:t})=>[e,t]},offsetAlongLine:{type:l.HALF_FLOAT,count:1,pack:({offsetAlongLine:t})=>e(t)},capType:{type:l.UNSIGNED_BYTE,count:1,pack:({capType:e})=>{switch(e){case`Butt`:case`butt`:return 0;case`Square`:case`square`:return 1;case`Round`:case`round`:return 2;default:return 0}}}}};class d extends i{constructor(e,t,n,r){super(e,t,n,r),this.vertexSpec=u,this._tessellationOptions.textured=!0}_write(e,{target:n,effect:r}){let i=r?.geometry??t.fromFeatureSetReaderCIM(n);if(!i)return;let{sprite:a}=this.evaluatedMeshParams;this._writeGeometry(e,n,i,a?.
|
|
2
|
+
import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as t}from"../../../../../../../geometry/GeometryCursor.js";import{spritePadding as n}from"../../../definitions.js";import{packBitset as r}from"../fill/meshWriterUtils.js";import{LineMeshWriter as i,LineVertexSpec as a}from"./LineMeshWriter.js";import{bitsetGenericConsiderAlphaOnly as o,bitsetLineScaleDash as s,bitsetLineIsSdf as c}from"../shaders/constants.js";import{DataType as l}from"../../../../../../webgl/enums.js";const u={createComputedParams:e=>e,optionalAttributes:a.optionalAttributes,attributes:{...a.attributes,bitset:{type:l.UNSIGNED_BYTE,count:1,pack:({shouldSampleAlphaOnly:e,shouldScaleDash:t,isSDF:n})=>r([[o,e],[s,t],[c,n]])},tlbr:{type:l.UNSIGNED_SHORT,count:4,pack:({sprite:e})=>{let{rect:t,width:r,height:i}=e,a=t.x+n,o=t.y+n;return[a,o,a+r,o+i]}},accumulatedDistance:{type:l.UNSIGNED_SHORT,count:1,packTessellation:({distance:e})=>e},segmentDirection:{type:l.BYTE,count:2,packPrecisionFactor:16,packTessellation:({directionX:e,directionY:t})=>[e,t]},offsetAlongLine:{type:l.HALF_FLOAT,count:1,pack:({offsetAlongLine:t})=>e(t)},capType:{type:l.UNSIGNED_BYTE,count:1,pack:({capType:e})=>{switch(e){case`Butt`:case`butt`:return 0;case`Square`:case`square`:return 1;case`Round`:case`round`:return 2;default:return 0}}}}};class d extends i{constructor(e,t,n,r){super(e,t,n,r),this.vertexSpec=u,this._tessellationOptions.textured=!0}_write(e,{target:n,effect:r}){let i=r?.geometry??t.fromFeatureSetReaderCIM(n);if(!i)return;let{sprite:a}=this.evaluatedMeshParams;this._writeGeometry(e,n,i,a?.textureKey)}}export{d as TexturedLineMeshWriter,u as texturedLineVertexSpec};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{pt2px as e,onePointInPixels as t}from"../../../../../../../core/screenUtils.js";import{identity as n,translate as r,rotate as i}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as a}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as o}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as s}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as c}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as l}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as u}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{packByteSqrt as d,processColorInput as f,getMinMaxZoom as p,getBitMask as m}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as h}from"./ComputedMarkerParams.js";import{MarkerConstants as g}from"./markerConstants.js";import{MeshWriter as _}from"../mesh/MeshWriter.js";import{DataType as v}from"../../../../../../webgl/enums.js";const y=128/Math.PI;function b(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function x(e){return b(e*y,256)}function S(e,t,o,s,c=!1){let l=a(),u=c?1:-1;return n(l),(t||o)&&r(l,l,[t,-o]),s&&i(l,l,u*.017453292519944444*-s),l}const C={createComputedParams:e=>h.from(e),optionalAttributes:{zoomRange:{type:v.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>p(e,t)}},attributes:{pos:{type:v.SHORT,count:2,pack:`position`,packPrecisionFactor:10},id:{type:v.UNSIGNED_BYTE,count:3,pack:`id`},bitset:{type:v.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:n,overrideOutlineColor:r,colorLocked:i})=>{let a=0;return e.sdf&&(a|=m(g.bitset.isSDF)),t===1&&(a|=m(g.bitset.isMapAligned)),n&&(a|=m(g.bitset.scaleSymbolsProportionally)),r&&(a|=m(g.bitset.overrideOutlineColor)),i&&(a|=m(g.bitset.colorLocked)),a}},offset:{type:v.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:n,anchorX:r,anchorY:i,offsetX:a,offsetY:s,rotateClockwise:c})=>{let l=S(0,a,s,-e,c),u=-(.5+r)*t,d=-(.5-i)*n,f=[u,d],p=[u+t,d],m=[u,d+n],h=[u+t,d+n];return o(f,f,l),o(p,p,l),o(m,m,l),o(h,h,l),[f,p,m,h]}}},textureUV:{type:v.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:n,texYmin:r})=>[[t,r],[e,r],[t,n],[e,n]]}},color:{type:v.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>f(e)},outlineColor:{type:v.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>f(e)},sizing:{type:v.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:n,referenceSize:r})=>[d(Math.max(e,t),128),d(n,128),d(r,128),0]},placementAngle:{type:v.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>x(e)},sdfDecodeCoeff:{type:v.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class w extends _{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!1,this.vertexSpec=C}get _requiresPerFeaturePacking(){return this._getPointSymbolCalloutMarkerEffect()!=null}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}getLocalCalloutReferenceInfo(){let e=this.evaluatedMeshParams.boundsInfo;if(!e)return;let t=e.size/2;return{anchor:{x:0,y:0},bodyBounds:{xmin:e.offsetX-t,ymin:e.offsetY-t,xmax:e.offsetX+t,ymax:e.offsetY+t},bodyBoundsUseReferenceScale:!0}}getCalloutCollisionBounds(e){if(this._getPointSymbolCalloutMarkerEffect())return this.evaluatedMeshParams.getPointSymbolCalloutBounds(e.bodyBounds)}_prepareEvaluatedMeshParams(t,n,r,i){let a=this._getPointSymbolCalloutMarkerEffect();if(!a)return;let o=i?.effect?.referenceBounds;if(!o){t.resetSizeOverride();return}let s=o.xmax-o.xmin,c=o.ymax-o.ymin;t.applyPointSymbolCalloutBackgroundScale(a.backgroundScale,s,c,e(a.gap??0),a.contentWidthRatio,a.contentHeightRatio,a.contentRequiresRadialFit)}_write(e,{target:t,effect:n,scaleFactor:r}){let i=n?.geometry,a=this.evaluatedMeshParams.sprite?.
|
|
2
|
+
import{pt2px as e,onePointInPixels as t}from"../../../../../../../core/screenUtils.js";import{identity as n,translate as r,rotate as i}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as a}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as o}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as s}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as c}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as l}from"../../../../../../../symbols/cim/constants.js";import{CIMMarkerPlacementHelper as u}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{packByteSqrt as d,processColorInput as f,getMinMaxZoom as p,getBitMask as m}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as h}from"./ComputedMarkerParams.js";import{MarkerConstants as g}from"./markerConstants.js";import{MeshWriter as _}from"../mesh/MeshWriter.js";import{DataType as v}from"../../../../../../webgl/enums.js";const y=128/Math.PI;function b(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function x(e){return b(e*y,256)}function S(e,t,o,s,c=!1){let l=a(),u=c?1:-1;return n(l),(t||o)&&r(l,l,[t,-o]),s&&i(l,l,u*.017453292519944444*-s),l}const C={createComputedParams:e=>h.from(e),optionalAttributes:{zoomRange:{type:v.HALF_FLOAT,count:2,pack:({scaleInfo:e},{tileInfo:t})=>p(e,t)}},attributes:{pos:{type:v.SHORT,count:2,pack:`position`,packPrecisionFactor:10},id:{type:v.UNSIGNED_BYTE,count:3,pack:`id`},bitset:{type:v.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:n,overrideOutlineColor:r,colorLocked:i})=>{let a=0;return e.sdf&&(a|=m(g.bitset.isSDF)),t===1&&(a|=m(g.bitset.isMapAligned)),n&&(a|=m(g.bitset.scaleSymbolsProportionally)),r&&(a|=m(g.bitset.overrideOutlineColor)),i&&(a|=m(g.bitset.colorLocked)),a}},offset:{type:v.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:n,anchorX:r,anchorY:i,offsetX:a,offsetY:s,rotateClockwise:c})=>{let l=S(0,a,s,-e,c),u=-(.5+r)*t,d=-(.5-i)*n,f=[u,d],p=[u+t,d],m=[u,d+n],h=[u+t,d+n];return o(f,f,l),o(p,p,l),o(m,m,l),o(h,h,l),[f,p,m,h]}}},textureUV:{type:v.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:n,texYmin:r})=>[[t,r],[e,r],[t,n],[e,n]]}},color:{type:v.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>f(e)},outlineColor:{type:v.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>f(e)},sizing:{type:v.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:n,referenceSize:r})=>[d(Math.max(e,t),128),d(n,128),d(r,128),0]},placementAngle:{type:v.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>x(e)},sdfDecodeCoeff:{type:v.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class w extends _{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!1,this.vertexSpec=C}get _requiresPerFeaturePacking(){return this._getPointSymbolCalloutMarkerEffect()!=null}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}getLocalCalloutReferenceInfo(){let e=this.evaluatedMeshParams.boundsInfo;if(!e)return;let t=e.size/2;return{anchor:{x:0,y:0},bodyBounds:{xmin:e.offsetX-t,ymin:e.offsetY-t,xmax:e.offsetX+t,ymax:e.offsetY+t},bodyBoundsUseReferenceScale:!0}}getCalloutCollisionBounds(e){if(this._getPointSymbolCalloutMarkerEffect())return this.evaluatedMeshParams.getPointSymbolCalloutBounds(e.bodyBounds)}_prepareEvaluatedMeshParams(t,n,r,i){let a=this._getPointSymbolCalloutMarkerEffect();if(!a)return;let o=i?.effect?.referenceBounds;if(!o){t.resetSizeOverride();return}let s=o.xmax-o.xmin,c=o.ymax-o.ymin;t.applyPointSymbolCalloutBackgroundScale(a.backgroundScale,s,c,e(a.gap??0),a.contentWidthRatio,a.contentHeightRatio,a.contentRequiresRadialFit)}_write(e,{target:t,effect:n,scaleFactor:r}){let i=n?.geometry,a=this.evaluatedMeshParams.sprite?.textureKey,o=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,a);let s=this.evaluatedMeshParams.minPixelBuffer,u=Math.max(this.evaluatedMeshParams.computedWidth,s),d=Math.max(this.evaluatedMeshParams.computedHeight,s),f=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,p=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,m=this.evaluatedMeshParams.offsetX+f,h=-this.evaluatedMeshParams.offsetY+p;if(this.evaluatedMeshParams.placement!=null){let n=null;if(i!=null){let e=Math.max(this.evaluatedMeshParams.computedWidth,this.evaluatedMeshParams.computedHeight)*(r??1);if(n=c(i,2*e,!1),n===null)return}this._writePlacedMarkers(e,t,n,u,d)}else if(i?.nextPath()){i.nextPoint();let t=i.x,n=i.y;e.recordBounds(t+m,n+h,u,d),this._writeQuad(e,o,t,n)}else if(t.geometryType===`esriGeometryPolygon`){let n=t.readCentroidForDisplay();if(!n)return;let[r,i]=n.coords;e.recordBounds(r+m,i+h,u,d),this._writeQuad(e,o,r,i)}else if(t.geometryType===`esriGeometryPoint`){let n=t.readXForDisplay(),r=t.readYForDisplay();e.recordBounds(n+m,r+h,u,d),this._writeQuad(e,o,n,r)}else t.readGeometryForDisplay()?.forEachVertex((t,n)=>{e.recordBounds(t+m,n+h,u,d),Math.abs(t)>l||Math.abs(n)>l||this._writeQuad(e,o,t,n)});e.recordEnd()}_writePlacedMarkers(e,n,r,i,a){let o=r??s.fromFeatureSetReaderCIM(n);if(!o)return;let c=u.getPlacement(o,-1,this.evaluatedMeshParams.placement,t,e.id);if(!c)return;let d=n.getDisplayId(),f=c.next(),p=this.evaluatedMeshParams.offsetX,m=-this.evaluatedMeshParams.offsetY;for(;f!=null;){let t=f.tx,n=-f.ty;if(Math.abs(t)>l||Math.abs(n)>l){f=c.next();continue}let r=-f.getAngle();e.recordBounds(t+p,n+m,i,a),this._writeQuad(e,d,t,n,r),f=c.next()}}_writeQuad(e,t,n,r,i){let a=e.vertexCount(),o=i==null?null:{placementAngle:i};this._writeVertex(e,t,n,r,o),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}_getPointSymbolCalloutMarkerEffect(){for(let{effect:e}of this.effectInfos??[])if(e.type===`CIMPointSymbolCallout`&&e.part===`marker`)return e}}export{w as MarkerMeshWriter,C as MarkerVertexSpec};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{clamp as e}from"../../../../../../../core/mathUtils.js";import{pt2px as t,onePointInPixels as n}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as r}from"../../../../../../../geometry/GeometryCursor.js";import{asCIMGeometryCursor as i}from"../../../../../../../symbols/cim/utils.js";import{CIMMarkerPlacementHelper as a}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as o,getYDirection as s}from"../../../alignmentUtils.js";import{labelU16ZoomPrecisionFactor as c,maxLineHeightRatio as l,minLineHeightRatio as u,labelPlacementOffsetPadding as d,maxTextLineWidth as f,minTextLineWidth as p,magicLabelLineHeight as m,packDegreesU8 as h}from"../../../definitions.js";import{shapeTextResource as g,shapeTextResourceForMultipoint as _}from"../../../mesh/templates/shapingUtils.js";import{processColorInput as v,getMinMaxZoom as y,packBitset as b}from"../fill/meshWriterUtils.js";import{MeshWriter as x}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as S,bitsetTextIsMapAligned as C}from"../shaders/constants.js";import{TextMeshTransformProps as w}from"./TextParams.js";import{DataType as T}from"../../../../../../webgl/enums.js";const E=28,D=[4,4],O=[16,4],k={topLeft:O,topRight:O,bottomLeft:O,bottomRight:O};function A(n){return n==null?f:e(t(n),p,f)}function j(t,n){return t/24*m*e(n,u,l)}const M=[4,2],N=[4,6],P={topLeft:M,topRight:M,bottomLeft:N,bottomRight:N},F={topLeft:M,topRight:N,bottomLeft:M,bottomRight:N},I={topLeft:N,topRight:N,bottomLeft:D,bottomRight:D},L={topLeft:D,topRight:D,bottomLeft:N,bottomRight:N},R={topLeft:N,topRight:D,bottomLeft:N,bottomRight:D},z={topLeft:D,topRight:N,bottomLeft:D,bottomRight:N};function B(e){return e.useBackgroundCallout?{backgroundColor:null,borderLineColor:null,borderLineSize:0}:{backgroundColor:e.boxBackgroundColor??e.backgroundColor??null,borderLineColor:e.boxBorderLineColor??e.borderLineColor??null,borderLineSize:e.boxBorderLineSize>0?e.boxBorderLineSize:e.borderLineWidth??0}}const V={createComputedParams:e=>e,optionalAttributes:{zoomRange:{type:T.UNSIGNED_SHORT,count:2,packPrecisionFactor:c,packTessellation:({minZoom:e,maxZoom:t})=>[e||0,t||28]},clipAngle:{type:T.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:e})=>U(e||0)},referenceSymbol:{type:T.BYTE,count:4,packTessellation:(e,n)=>{let r=e.isLineLabel||!e.referenceBounds,i=o(r?`center`:n.horizontalAlignment),a=s(r?`middle`:n.verticalAlignment),{offsetX:c,offsetY:l,size:u}=r?{offsetX:0,offsetY:0,size:0}:e.referenceBounds;return[t(c),-t(l),Math.round(t(u)),i+1<<2|a+1]}}},attributes:{pos:{type:T.SHORT,count:2,pack:`position`,packPrecisionFactor:10},id:{type:T.UNSIGNED_BYTE,count:3,pack:`id`},bitset:{type:T.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:e,mapAligned:t})=>b([[S,e],[C,!!t]])},offset:{type:T.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:e})=>{let{bottomLeft:t,bottomRight:n,topLeft:r,topRight:i}=e;return[r,i,t,n]}}},textureUV:{type:T.UNSIGNED_SHORT,count:2,packAlternating:{count:4,packTessellation:({texcoords:e})=>{let{bottomLeft:t,bottomRight:n,topLeft:r,topRight:i}=e;return[r,i,t,n]}}},color:{type:T.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:e})=>e},fontAndReferenceSize:{type:T.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,packTessellation:({fontSize:e,sdfSize:n,sdfRadius:r},{referenceSize:i})=>[Math.round(t(e)),Math.round(t(i||e)),n,r]},outlineColor:{type:T.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>v(e)},haloColor:{type:T.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:e})=>v(e)},outlineAndHaloSize:{type:T.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:e,haloSize:n})=>[Math.round(t(e)),Math.round(t(n))]}}};class H extends x{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!1,this.vertexSpec=V,this._textMeshParamsPropsInitialized=!1,this._calloutEffectGeometry=null}getCalloutEffectGeometry({target:e}){if(e.geometryType!==`esriGeometryPoint`&&e.geometryType!==`esriGeometryMultipoint`)return this._calloutEffectGeometry;let t=e.readGeometryForDisplay();return t&&e.geometryType?r.fromOptimizedCIM(t.clone(),e.geometryType):null}getCalloutRotation(){return this._textMeshParamsPropsInitialized?this._textMeshTransformProps.postAngle:null}ensurePacked(e,t,n){this._calloutEffectGeometry=null,super.ensurePacked(e,t,n),(!this._textMeshParamsPropsInitialized||this._evaluator.hasDynamicProperties)&&(this._textMeshTransformProps=new w(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}getLocalCalloutReferenceInfo(){return this._createLocalCalloutReferenceInfo(this._getShaping(),void 0,!0,!0)}_createLocalCalloutReferenceInfo(e,n,r=!1,i=!1){if(!e)return;let a=e.boundsT,o=i?e.bounds:a,[s,c]=n?this._getReferenceSymbolOffset(n):[0,0],l=i?t(this._textMeshTransformProps.offsetX):0,u=i?t(this._textMeshTransformProps.offsetY):0,d={xmin:a.xmin,ymin:-a.ymax,xmax:a.xmax,ymax:-a.ymin};return{anchor:{x:0,y:0},bodyBounds:{xmin:o.xmin+s+l,ymin:-o.ymax-c+u,xmax:o.xmax+s+l,ymax:-o.ymin-c+u},collisionBodyBounds:d,...r?{bodyBoundsUseReferenceScale:!0}:null}}_getReferenceSymbolOffset(e){let n=t(e.size)/2+d;return[t(e.offsetX)+o(this.evaluatedMeshParams.horizontalAlignment)*n,-t(e.offsetY)+s(this.evaluatedMeshParams.verticalAlignment)*n]}_write(e,{target:t,effect:n}){this._calloutEffectGeometry=null;let r=n?.geometry,a=this._getShaping();if(!a)return;let o=this.evaluatedMeshParams.alignment===1,s=t.getDisplayId(),{placement:c}=this.evaluatedMeshParams;if(c!=null){if(c.type!==`PrivatePlacementMultipoint`)this._writePlacedTextMarkers(e,t,a,i(r));else{let n=this._getMultipointShaping();n&&this._writeMultipointText(e,t,n,i(r))}return}if(r?.nextPath())return r.nextPoint(),this._setCalloutEffectGeometry(r.x,r.y),this._writeGlyphs(e,s,r.x,r.y,a,0,void 0,{mapAligned:o});if(t.geometryType===`esriGeometryPolygon`){let n=t.readCentroidForDisplay();if(!n)return;let[r,i]=n.coords;return this._setCalloutEffectGeometry(r,i),this._writeGlyphs(e,s,r,i,a,0,void 0,{mapAligned:o})}if(t.geometryType===`esriGeometryMultipoint`){t.readGeometryForDisplay()?.forEachVertex((t,n)=>{this._setCalloutEffectGeometry(t,n),this._writeGlyphs(e,s,t,n,a,0,void 0,{mapAligned:o})});return}let l=t.readXForDisplay(),u=t.readYForDisplay();return this._setCalloutEffectGeometry(l,u),this._writeGlyphs(e,s,l,u,a,0,void 0,{mapAligned:o})}_writePlacedTextMarkers(e,t,i,o){let s=o??r.fromFeatureSetReaderCIM(t);if(!s)return;let c=a.getPlacement(s,-1,this.evaluatedMeshParams.placement,n,e.id);if(!c)return;let l=t.getDisplayId(),u=c.next();for(;u!=null;){let t=-u.getAngle(),n=u.tx,r=-u.ty;this._setCalloutEffectGeometry(n,r),this._writeGlyphs(e,l,n,r,i,t,void 0,{mapAligned:this.evaluatedMeshParams.alignment===1}),u=c.next()}}_writeMultipointText(e,t,i,o){let s=o??r.fromFeatureSetReaderCIM(t);if(!s)return;let c=a.getPlacement(s,-1,this.evaluatedMeshParams.placement,n,e.id);if(!c)return;let l=t.getDisplayId(),u=c.next(),d=0;for(;u!=null;){let t=u.tx,n=-u.ty,r=-u.getAngle();if(this._setCalloutEffectGeometry(t,n),d>=i.glyphs.length)break;this._writeGlyph(e,l,t,n,i,d,r,void 0,{mapAligned:this.evaluatedMeshParams.alignment===1}),u=c.next(),d++}}_setCalloutEffectGeometry(e,t){this._calloutEffectGeometry??=r.fromJSON({x:e,y:t})}_getShaping(n){let r=this._textMeshTransformProps,i=this.evaluatedMeshParams;if(!this._hasGlyphs(i.glyphs))return null;let a=t(r.fontSize),o=t(r.offsetX),s=t(r.offsetY),{sdfSize:c}=this._getDefaultGlyphMetrics(i.glyphs),d=A(i.lineWidth),f=j(c,i.lineHeightRatio),{backgroundColor:p,borderLineSize:m}=B(i);return g(i.glyphs,{scale:a/c,angle:r.postAngle,xOffset:o,yOffset:s,horizontalAlignment:i.horizontalAlignment,verticalAlignment:n||i.verticalAlignment,maxLineWidth:d,lineHeight:f,lineHeightRatio:e(i.lineHeightRatio,u,l),decoration:i.decoration,borderLineSizePx:t(m),hasBackground:!!p,useCIMAngleBehavior:i.useCIMAngleBehavior})}_getMultipointShaping(){let n=this._textMeshTransformProps,r=this.evaluatedMeshParams;if(!this._hasGlyphs(r.glyphs))return null;let i=t(n.fontSize),a=t(n.offsetX),o=t(n.offsetY),{sdfSize:s}=this._getDefaultGlyphMetrics(r.glyphs),c=A(r.lineWidth),d=j(s,r.lineHeightRatio),{backgroundColor:f,borderLineSize:p}=B(r);return _(r.glyphs,{scale:i/s,angle:n.postAngle,xOffset:a,yOffset:o,horizontalAlignment:r.horizontalAlignment,verticalAlignment:r.verticalAlignment,maxLineWidth:c,lineHeight:d,lineHeightRatio:e(r.lineHeightRatio,u,l),decoration:r.decoration,borderLineSizePx:t(p),hasBackground:!!f,useCIMAngleBehavior:r.useCIMAngleBehavior})}_hasGlyphs(e){return e?e.type===`glyphs`?e.glyphs.length>0:e.runs.some(e=>e.glyphs.glyphs.length>0):!1}_getDefaultGlyphMetrics(e){if(e.type===`glyphs`)return{sdfSize:e.sdfSize,sdfRadius:e.sdfRadius,sdfPadding:e.sdfPadding};let[t]=e.runs;return{sdfSize:t?.glyphs.sdfSize??24,sdfRadius:t?.glyphs.sdfRadius??8,sdfPadding:t?.glyphs.sdfPadding??3}}_writeGlyphs(e,n,r,i,a,o,s,c,l=!0){let u=this.evaluatedMeshParams,d=this._textMeshTransformProps,f=t(d.fontSize),p=d.haloSize,m=d.outlineSize,h=t(d.offsetX),g=t(d.offsetY),_=this._getDefaultGlyphMetrics(u.glyphs),b=v(u.color),[x,S]=y(u.scaleInfo,this.getTileInfo());o!==0&&a.setRotation(o);let C=a.bounds,w=r+C.x+h,T=i+C.y-g,E=(u.minPixelBuffer?u.minPixelBuffer/f:1)*2,D=Math.max(C.width,C.height)*E;a.textBox&&(e.recordStart(this.instanceId,this.attributeLayout,a.glyphs[0].textureBinding),l&&e.recordBounds(w,T,D,D),this._writeTextBox(e,n,r,i,a.textBox,s,c),e.recordEnd());for(let t of a.glyphs){e.recordStart(this.instanceId,this.attributeLayout,t.textureBinding),l&&e.recordBounds(w,T,D,D);let{texcoords:a,offsets:o}=t,u=t.fontSize??f;this._writeQuad(e,n,r,i,{texcoords:a,offsets:o,fontSize:u,haloSize:p,outlineSize:m,sdfSize:_.sdfSize,sdfRadius:_.sdfRadius,color:t.color?v(t.color):b,isBackground:!1,referenceBounds:s,minZoom:x,maxZoom:S,...c}),e.recordEnd()}o!==0&&a.setRotation(-o)}_writeGlyph(e,n,r,i,a,o,s,c,l,u=!0){let d=this.evaluatedMeshParams,f=this._textMeshTransformProps,p=t(f.fontSize),m=f.haloSize,h=f.outlineSize,g=t(f.offsetX),_=t(f.offsetY),y=this._getDefaultGlyphMetrics(d.glyphs),b=v(d.color);s!==0&&a.setRotation(s);let x=a.bounds,S=r+x.x+g,C=i+x.y-_,w=(d.minPixelBuffer?d.minPixelBuffer/p:1)*2,T=Math.max(x.width,x.height)*w,E=a.glyphs[o];e.recordStart(this.instanceId,this.attributeLayout,E.textureBinding),u&&e.recordBounds(S,C,T,T);let{texcoords:D,offsets:O}=E,k=E.fontSize??p;this._writeQuad(e,n,r,i,{texcoords:D,offsets:O,fontSize:k,haloSize:m,outlineSize:h,sdfSize:y.sdfSize,sdfRadius:y.sdfRadius,color:E.color?v(E.color):b,isBackground:!1,referenceBounds:c,minZoom:0,maxZoom:30,...l}),e.recordEnd(),s!==0&&a.setRotation(-s)}_writeTextBox(e,t,n,r,i,a,o){let s=this.evaluatedMeshParams,{fontSize:c,haloSize:l,outlineSize:u}=this._textMeshTransformProps,{backgroundColor:d,borderLineColor:f,borderLineSize:p}=B(s),{sdfSize:m,sdfRadius:h}=this._getDefaultGlyphMetrics(s.glyphs),g=!!f&&p>0,_={isBackground:!0,fontSize:c,haloSize:l,outlineSize:u,referenceBounds:a,sdfSize:m,sdfRadius:h,...o};d&&(this._writeQuad(e,t,n,r,{texcoords:k,offsets:i.main,color:v(d),..._}),g||(this._writeQuad(e,t,n,r,{texcoords:I,offsets:i.top,color:v(d),..._}),this._writeQuad(e,t,n,r,{texcoords:L,offsets:i.bot,color:v(d),..._}),this._writeQuad(e,t,n,r,{texcoords:R,offsets:i.left,color:v(d),..._}),this._writeQuad(e,t,n,r,{texcoords:z,offsets:i.right,color:v(d),..._}))),g&&(this._writeQuad(e,t,n,r,{texcoords:P,offsets:i.top,color:v(f),..._}),this._writeQuad(e,t,n,r,{texcoords:P,offsets:i.bot,color:v(f),..._}),this._writeQuad(e,t,n,r,{texcoords:F,offsets:i.left,color:v(f),..._}),this._writeQuad(e,t,n,r,{texcoords:F,offsets:i.right,color:v(f),..._}))}_writeQuad(e,t,n,r,i){let a=e.vertexCount();this._writeVertex(e,t,n,r,i),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}}const U=e=>Math.round(e*h);export{H as TextMeshWriter,V as TextVertexSpec,B as getTextBoxStyle,E as maxLabelZoom};
|
|
2
|
+
import{clamp as e}from"../../../../../../../core/mathUtils.js";import{pt2px as t,onePointInPixels as n}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as r}from"../../../../../../../geometry/GeometryCursor.js";import{asCIMGeometryCursor as i}from"../../../../../../../symbols/cim/utils.js";import{CIMMarkerPlacementHelper as a}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as o,getYDirection as s}from"../../../alignmentUtils.js";import{labelU16ZoomPrecisionFactor as c,maxLineHeightRatio as l,minLineHeightRatio as u,labelPlacementOffsetPadding as d,maxTextLineWidth as f,minTextLineWidth as p,magicLabelLineHeight as m,packDegreesU8 as h}from"../../../definitions.js";import{shapeTextResource as g,shapeTextResourceForMultipoint as _}from"../../../mesh/templates/shapingUtils.js";import{processColorInput as v,getMinMaxZoom as y,packBitset as b}from"../fill/meshWriterUtils.js";import{MeshWriter as x}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as S,bitsetTextIsMapAligned as C}from"../shaders/constants.js";import{TextMeshTransformProps as w}from"./TextParams.js";import{DataType as T}from"../../../../../../webgl/enums.js";const E=28,D=[4,4],O=[16,4],k={topLeft:O,topRight:O,bottomLeft:O,bottomRight:O};function A(n){return n==null?f:e(t(n),p,f)}function j(t,n){return t/24*m*e(n,u,l)}const M=[4,2],N=[4,6],P={topLeft:M,topRight:M,bottomLeft:N,bottomRight:N},F={topLeft:M,topRight:N,bottomLeft:M,bottomRight:N},I={topLeft:N,topRight:N,bottomLeft:D,bottomRight:D},L={topLeft:D,topRight:D,bottomLeft:N,bottomRight:N},R={topLeft:N,topRight:D,bottomLeft:N,bottomRight:D},z={topLeft:D,topRight:N,bottomLeft:D,bottomRight:N};function B(e){return e.useBackgroundCallout?{backgroundColor:null,borderLineColor:null,borderLineSize:0}:{backgroundColor:e.boxBackgroundColor??e.backgroundColor??null,borderLineColor:e.boxBorderLineColor??e.borderLineColor??null,borderLineSize:e.boxBorderLineSize>0?e.boxBorderLineSize:e.borderLineWidth??0}}const V={createComputedParams:e=>e,optionalAttributes:{zoomRange:{type:T.UNSIGNED_SHORT,count:2,packPrecisionFactor:c,packTessellation:({minZoom:e,maxZoom:t})=>[e||0,t||28]},clipAngle:{type:T.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:e})=>U(e||0)},referenceSymbol:{type:T.BYTE,count:4,packTessellation:(e,n)=>{let r=e.isLineLabel||!e.referenceBounds,i=o(r?`center`:n.horizontalAlignment),a=s(r?`middle`:n.verticalAlignment),{offsetX:c,offsetY:l,size:u}=r?{offsetX:0,offsetY:0,size:0}:e.referenceBounds;return[t(c),-t(l),Math.round(t(u)),i+1<<2|a+1]}}},attributes:{pos:{type:T.SHORT,count:2,pack:`position`,packPrecisionFactor:10},id:{type:T.UNSIGNED_BYTE,count:3,pack:`id`},bitset:{type:T.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:e,mapAligned:t})=>b([[S,e],[C,!!t]])},offset:{type:T.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:e})=>{let{bottomLeft:t,bottomRight:n,topLeft:r,topRight:i}=e;return[r,i,t,n]}}},textureUV:{type:T.UNSIGNED_SHORT,count:2,packAlternating:{count:4,packTessellation:({texcoords:e})=>{let{bottomLeft:t,bottomRight:n,topLeft:r,topRight:i}=e;return[r,i,t,n]}}},color:{type:T.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:e})=>e},fontAndReferenceSize:{type:T.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,packTessellation:({fontSize:e,sdfSize:n,sdfRadius:r},{referenceSize:i})=>[Math.round(t(e)),Math.round(t(i||e)),n,r]},outlineColor:{type:T.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>v(e)},haloColor:{type:T.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:e})=>v(e)},outlineAndHaloSize:{type:T.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:e,haloSize:n})=>[Math.round(t(e)),Math.round(t(n))]}}};class H extends x{constructor(){super(...arguments),this.calloutRecordsUseLabelPhase=!1,this.vertexSpec=V,this._textMeshParamsPropsInitialized=!1,this._calloutEffectGeometry=null}getCalloutEffectGeometry({target:e}){if(e.geometryType!==`esriGeometryPoint`&&e.geometryType!==`esriGeometryMultipoint`)return this._calloutEffectGeometry;let t=e.readGeometryForDisplay();return t&&e.geometryType?r.fromOptimizedCIM(t.clone(),e.geometryType):null}getCalloutRotation(){return this._textMeshParamsPropsInitialized?this._textMeshTransformProps.postAngle:null}ensurePacked(e,t,n){this._calloutEffectGeometry=null,super.ensurePacked(e,t,n),(!this._textMeshParamsPropsInitialized||this._evaluator.hasDynamicProperties)&&(this._textMeshTransformProps=new w(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}getLocalCalloutReferenceInfo(){return this._createLocalCalloutReferenceInfo(this._getShaping(),void 0,!0,!0)}_createLocalCalloutReferenceInfo(e,n,r=!1,i=!1){if(!e)return;let a=e.boundsT,o=i?e.bounds:a,[s,c]=n?this._getReferenceSymbolOffset(n):[0,0],l=i?t(this._textMeshTransformProps.offsetX):0,u=i?t(this._textMeshTransformProps.offsetY):0,d={xmin:a.xmin,ymin:-a.ymax,xmax:a.xmax,ymax:-a.ymin};return{anchor:{x:0,y:0},bodyBounds:{xmin:o.xmin+s+l,ymin:-o.ymax-c+u,xmax:o.xmax+s+l,ymax:-o.ymin-c+u},collisionBodyBounds:d,...r?{bodyBoundsUseReferenceScale:!0}:null}}_getReferenceSymbolOffset(e){let n=t(e.size)/2+d;return[t(e.offsetX)+o(this.evaluatedMeshParams.horizontalAlignment)*n,-t(e.offsetY)+s(this.evaluatedMeshParams.verticalAlignment)*n]}_write(e,{target:t,effect:n}){this._calloutEffectGeometry=null;let r=n?.geometry,a=this._getShaping();if(!a)return;let o=this.evaluatedMeshParams.alignment===1,s=t.getDisplayId(),{placement:c}=this.evaluatedMeshParams;if(c!=null){if(c.type!==`PrivatePlacementMultipoint`)this._writePlacedTextMarkers(e,t,a,i(r));else{let n=this._getMultipointShaping();n&&this._writeMultipointText(e,t,n,i(r))}return}if(r?.nextPath())return r.nextPoint(),this._setCalloutEffectGeometry(r.x,r.y),this._writeGlyphs(e,s,r.x,r.y,a,0,void 0,{mapAligned:o});if(t.geometryType===`esriGeometryPolygon`){let n=t.readCentroidForDisplay();if(!n)return;let[r,i]=n.coords;return this._setCalloutEffectGeometry(r,i),this._writeGlyphs(e,s,r,i,a,0,void 0,{mapAligned:o})}if(t.geometryType===`esriGeometryMultipoint`){t.readGeometryForDisplay()?.forEachVertex((t,n)=>{this._setCalloutEffectGeometry(t,n),this._writeGlyphs(e,s,t,n,a,0,void 0,{mapAligned:o})});return}let l=t.readXForDisplay(),u=t.readYForDisplay();return this._setCalloutEffectGeometry(l,u),this._writeGlyphs(e,s,l,u,a,0,void 0,{mapAligned:o})}_writePlacedTextMarkers(e,t,i,o){let s=o??r.fromFeatureSetReaderCIM(t);if(!s)return;let c=a.getPlacement(s,-1,this.evaluatedMeshParams.placement,n,e.id);if(!c)return;let l=t.getDisplayId(),u=c.next();for(;u!=null;){let t=-u.getAngle(),n=u.tx,r=-u.ty;this._setCalloutEffectGeometry(n,r),this._writeGlyphs(e,l,n,r,i,t,void 0,{mapAligned:this.evaluatedMeshParams.alignment===1}),u=c.next()}}_writeMultipointText(e,t,i,o){let s=o??r.fromFeatureSetReaderCIM(t);if(!s)return;let c=a.getPlacement(s,-1,this.evaluatedMeshParams.placement,n,e.id);if(!c)return;let l=t.getDisplayId(),u=c.next(),d=0;for(;u!=null;){let t=u.tx,n=-u.ty,r=-u.getAngle();if(this._setCalloutEffectGeometry(t,n),d>=i.glyphs.length)break;this._writeGlyph(e,l,t,n,i,d,r,void 0,{mapAligned:this.evaluatedMeshParams.alignment===1}),u=c.next(),d++}}_setCalloutEffectGeometry(e,t){this._calloutEffectGeometry??=r.fromJSON({x:e,y:t})}_getShaping(n){let r=this._textMeshTransformProps,i=this.evaluatedMeshParams;if(!this._hasGlyphs(i.glyphs))return null;let a=t(r.fontSize),o=t(r.offsetX),s=t(r.offsetY),{sdfSize:c}=this._getDefaultGlyphMetrics(i.glyphs),d=A(i.lineWidth),f=j(c,i.lineHeightRatio),{backgroundColor:p,borderLineSize:m}=B(i);return g(i.glyphs,{scale:a/c,angle:r.postAngle,xOffset:o,yOffset:s,horizontalAlignment:i.horizontalAlignment,verticalAlignment:n||i.verticalAlignment,maxLineWidth:d,lineHeight:f,lineHeightRatio:e(i.lineHeightRatio,u,l),decoration:i.decoration,borderLineSizePx:t(m),hasBackground:!!p,useCIMAngleBehavior:i.useCIMAngleBehavior})}_getMultipointShaping(){let n=this._textMeshTransformProps,r=this.evaluatedMeshParams;if(!this._hasGlyphs(r.glyphs))return null;let i=t(n.fontSize),a=t(n.offsetX),o=t(n.offsetY),{sdfSize:s}=this._getDefaultGlyphMetrics(r.glyphs),c=A(r.lineWidth),d=j(s,r.lineHeightRatio),{backgroundColor:f,borderLineSize:p}=B(r);return _(r.glyphs,{scale:i/s,angle:n.postAngle,xOffset:a,yOffset:o,horizontalAlignment:r.horizontalAlignment,verticalAlignment:r.verticalAlignment,maxLineWidth:c,lineHeight:d,lineHeightRatio:e(r.lineHeightRatio,u,l),decoration:r.decoration,borderLineSizePx:t(p),hasBackground:!!f,useCIMAngleBehavior:r.useCIMAngleBehavior})}_hasGlyphs(e){return e?e.type===`glyphs`?e.glyphs.length>0:e.runs.some(e=>e.glyphs.glyphs.length>0):!1}_getDefaultGlyphMetrics(e){if(e.type===`glyphs`)return{sdfSize:e.sdfSize,sdfRadius:e.sdfRadius,sdfPadding:e.sdfPadding};let[t]=e.runs;return{sdfSize:t?.glyphs.sdfSize??24,sdfRadius:t?.glyphs.sdfRadius??8,sdfPadding:t?.glyphs.sdfPadding??3}}_writeGlyphs(e,n,r,i,a,o,s,c,l=!0){let u=this.evaluatedMeshParams,d=this._textMeshTransformProps,f=t(d.fontSize),p=d.haloSize,m=d.outlineSize,h=t(d.offsetX),g=t(d.offsetY),_=this._getDefaultGlyphMetrics(u.glyphs),b=v(u.color),[x,S]=y(u.scaleInfo,this.getTileInfo());o!==0&&a.setRotation(o);let C=a.bounds,w=r+C.x+h,T=i+C.y-g,E=(u.minPixelBuffer?u.minPixelBuffer/f:1)*2,D=Math.max(C.width,C.height)*E;a.textBox&&(e.recordStart(this.instanceId,this.attributeLayout,a.glyphs[0].textureKey),l&&e.recordBounds(w,T,D,D),this._writeTextBox(e,n,r,i,a.textBox,s,c),e.recordEnd());for(let t of a.glyphs){e.recordStart(this.instanceId,this.attributeLayout,t.textureKey),l&&e.recordBounds(w,T,D,D);let{texcoords:a,offsets:o}=t,u=t.fontSize??f;this._writeQuad(e,n,r,i,{texcoords:a,offsets:o,fontSize:u,haloSize:p,outlineSize:m,sdfSize:_.sdfSize,sdfRadius:_.sdfRadius,color:t.color?v(t.color):b,isBackground:!1,referenceBounds:s,minZoom:x,maxZoom:S,...c}),e.recordEnd()}o!==0&&a.setRotation(-o)}_writeGlyph(e,n,r,i,a,o,s,c,l,u=!0){let d=this.evaluatedMeshParams,f=this._textMeshTransformProps,p=t(f.fontSize),m=f.haloSize,h=f.outlineSize,g=t(f.offsetX),_=t(f.offsetY),y=this._getDefaultGlyphMetrics(d.glyphs),b=v(d.color);s!==0&&a.setRotation(s);let x=a.bounds,S=r+x.x+g,C=i+x.y-_,w=(d.minPixelBuffer?d.minPixelBuffer/p:1)*2,T=Math.max(x.width,x.height)*w,E=a.glyphs[o];e.recordStart(this.instanceId,this.attributeLayout,E.textureKey),u&&e.recordBounds(S,C,T,T);let{texcoords:D,offsets:O}=E,k=E.fontSize??p;this._writeQuad(e,n,r,i,{texcoords:D,offsets:O,fontSize:k,haloSize:m,outlineSize:h,sdfSize:y.sdfSize,sdfRadius:y.sdfRadius,color:E.color?v(E.color):b,isBackground:!1,referenceBounds:c,minZoom:0,maxZoom:30,...l}),e.recordEnd(),s!==0&&a.setRotation(-s)}_writeTextBox(e,t,n,r,i,a,o){let s=this.evaluatedMeshParams,{fontSize:c,haloSize:l,outlineSize:u}=this._textMeshTransformProps,{backgroundColor:d,borderLineColor:f,borderLineSize:p}=B(s),{sdfSize:m,sdfRadius:h}=this._getDefaultGlyphMetrics(s.glyphs),g=!!f&&p>0,_={isBackground:!0,fontSize:c,haloSize:l,outlineSize:u,referenceBounds:a,sdfSize:m,sdfRadius:h,...o};d&&(this._writeQuad(e,t,n,r,{texcoords:k,offsets:i.main,color:v(d),..._}),g||(this._writeQuad(e,t,n,r,{texcoords:I,offsets:i.top,color:v(d),..._}),this._writeQuad(e,t,n,r,{texcoords:L,offsets:i.bot,color:v(d),..._}),this._writeQuad(e,t,n,r,{texcoords:R,offsets:i.left,color:v(d),..._}),this._writeQuad(e,t,n,r,{texcoords:z,offsets:i.right,color:v(d),..._}))),g&&(this._writeQuad(e,t,n,r,{texcoords:P,offsets:i.top,color:v(f),..._}),this._writeQuad(e,t,n,r,{texcoords:P,offsets:i.bot,color:v(f),..._}),this._writeQuad(e,t,n,r,{texcoords:F,offsets:i.left,color:v(f),..._}),this._writeQuad(e,t,n,r,{texcoords:F,offsets:i.right,color:v(f),..._}))}_writeQuad(e,t,n,r,i){let a=e.vertexCount();this._writeVertex(e,t,n,r,i),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}}const U=e=>Math.round(e*h);export{H as TextMeshWriter,V as TextVertexSpec,B as getTextBoxStyle,E as maxLabelZoom};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../Color.js";import n from"../../../Graphic.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{watch as i,initial as a}from"../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import c from"../../../layers/GraphicsLayer.js";import l from"../../../layers/support/TelemetryDisplay.js";import{getSymbolDisplayAngle as u}from"../../../layers/video/videoUtils.js";import d from"../../../symbols/SimpleFillSymbol.js";import f from"../../../symbols/SimpleLineSymbol.js";import p from"../../../symbols/SimpleMarkerSymbol.js";import{applyCIMSymbolRotation as m}from"../../../symbols/support/cimSymbolUtils.js";import{symbolTypes as h}from"../../../symbols/support/typeUtils.js";import g from"../engine/webgl/OverlayContainer.js";import _ from"../engine/webgl/OverlayMultipoint.js";import{LayerView2D as v}from"./LayerView2D.js";import y from"./graphics/GraphicContainer.js";import b from"./graphics/GraphicsView2D.js";import x from"../../layers/LayerView.js";const S=new t([255,127,0]);let C=class extends v(x){constructor(){super(...arguments),this._graphicsLayer=new c,this._frameOutlineGraphic=new n({symbol:new d({outline:{type:`simple-line`,color:S}})}),this._frameCenterGraphic=new n({symbol:new p({color:S,style:`cross`})}),this._sensorPathGraphic=new n({symbol:new f({color:S})}),this._sensorTrailGraphic=new n({symbol:new f({color:S})}),this._sensorSightlineGraphic=new n({symbol:new f({color:S})}),this._sensorLocationGraphic=new n({symbol:new p({color:S})}),this._overlayContainer=null,this._sensorLocationSymbolType=null,this.layer=null,this.sensorLocationSymbol=null,this.symbolAngle=0,this.visibleTelemetryElements=null}destroy(){this._graphicsLayer=r(this._graphicsLayer)}initialize(){this._sensorLocationSymbolType=this.layer?.sensorSymbol.type,this._graphicsLayer.graphics.addMany([this._frameCenterGraphic,this._sensorSightlineGraphic,this._sensorPathGraphic,this._sensorTrailGraphic,this._frameOutlineGraphic,this._sensorLocationGraphic]),this.visibleTelemetryElements=new l({frame:this.layer.telemetryDisplay?.frame??!1,frameCenter:this.layer.telemetryDisplay?.frameCenter??!0,frameOutline:this.layer.telemetryDisplay?.frameOutline??!0,lineOfSight:this.layer.telemetryDisplay?.lineOfSight??!0,sensorLocation:this.layer.telemetryDisplay?.sensorLocation??!0,sensorPath:this.layer.telemetryDisplay?.sensorPath??!0,sensorTrail:this.layer.telemetryDisplay?.sensorTrail??!0})}attach(){this._overlayContainer=new g,this.container.addChild(this._overlayContainer),this._addOverlayMultipoint(),this.graphicsView=new b({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:this._graphicsLayer.graphics,container:new y(this.view.featuresTilingScheme)}),this.container.addChild(this.graphicsView.container),this.addAttachHandles(this._graphicsLayer.on(`graphic-update`,this.graphicsView.graphicUpdateHandler)),this.addAttachHandles([i(()=>[this.layer.telemetryDisplay?.frame,this.layer.telemetryDisplay?.frameCenter,this.layer.telemetryDisplay?.frameOutline,this.layer.telemetryDisplay?.sensorLocation,this.layer.telemetryDisplay?.sensorPath,this.layer.telemetryDisplay?.sensorTrail,this.layer.telemetryDisplay?.lineOfSight],()=>this._updateVisibleTelemetryElements(),a),i(()=>[this.layer.telemetry,this.visibleTelemetryElements?.frameCenter,this.visibleTelemetryElements?.frameOutline,this.visibleTelemetryElements?.sensorLocation,this.visibleTelemetryElements?.sensorPath,this.visibleTelemetryElements?.sensorTrail,this.visibleTelemetryElements?.lineOfSight],()=>this._updateGraphicGeometries(),a),i(()=>this.layer.metadata,()=>this._updateSensorLocationSymbolAngle(),a),i(()=>this.layer?.frameCenterSymbol,()=>this._updateFrameCenterSymbol(),a),i(()=>this.layer?.frameOutlineSymbol,()=>this._updateFrameOutlineSymbol(),a),i(()=>this.layer?.sensorPathSymbol,()=>this._updateSensorPathSymbol(),a),i(()=>this.layer?.sensorSightLineSymbol,()=>this._updateSensorSightlineSymbol(),a),i(()=>this.layer?.sensorSymbol,()=>this._updateSensorLocationSymbol(),a),i(()=>this.layer?.sensorTrailSymbol,()=>this._updateSensorTrailSymbol(),a),i(()=>this.symbolAngle,()=>this._updateSensorLocationSymbol(),a)])}detach(){this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this.graphicsView=r(this.graphicsView)}supportsSpatialReference(e){return!0}moveEnd(){}viewChange(){this.graphicsView.viewChange()}update(e){this.graphicsView.processUpdate(e)}isUpdating(){return!this.graphicsView||this.graphicsView.updating}_updateVisibleTelemetryElements(){this.view.animationsEnabled&&this.visibleTelemetryElements&&this.layer.telemetryDisplay&&(this.visibleTelemetryElements.frame=this.layer.telemetryDisplay.frame,this.visibleTelemetryElements.frameCenter=this.layer.telemetryDisplay.frameCenter,this.visibleTelemetryElements.frameOutline=this.layer.telemetryDisplay.frameOutline,this.visibleTelemetryElements.lineOfSight=this.layer.telemetryDisplay.lineOfSight,this.visibleTelemetryElements.sensorLocation=this.layer.telemetryDisplay.sensorLocation,this.visibleTelemetryElements.sensorTrail=this.layer.telemetryDisplay.sensorTrail,this.visibleTelemetryElements.sensorPath=this.layer.telemetryDisplay.sensorPath)}_updateGraphicGeometries(){if(!this.view.animationsEnabled)return;let{telemetry:e}=this.layer,{visibleTelemetryElements:t}=this;e&&t&&(t.frameOutline&&e.frameOutline?this._frameOutlineGraphic.geometry=this.layer.telemetry.frameOutline:this._frameOutlineGraphic.geometry=null,t.sensorTrail&&e.sensorTrail?this._sensorTrailGraphic.geometry=this.layer.telemetry.sensorTrail:this._sensorTrailGraphic.geometry=null,t.sensorPath&&e.sensorPath?this._sensorPathGraphic.geometry=this.layer.telemetry.sensorPath:this._sensorPathGraphic.geometry=null,t.lineOfSight&&e.lineOfSight?this._sensorSightlineGraphic.geometry=this.layer.telemetry.lineOfSight:this._sensorSightlineGraphic.geometry=null,t.sensorLocation&&e.sensorLocation?this._sensorLocationGraphic.geometry=this.layer.telemetry.sensorLocation:this._sensorLocationGraphic.geometry=null,t.frameCenter&&e.frameCenter?this._frameCenterGraphic.geometry=this.layer.telemetry.frameCenter:this._frameCenterGraphic.geometry=null)}_updateSensorLocationSymbolAngle(){if(!this.view.animationsEnabled||!this.layer?.metadata?.size)return;let{source:e,symbolOffset:t=0}=this.layer.sensorSymbolOrientation||{};if(!e&&!t)return;let n=this.layer?.metadata?.get(10005)?.value??0,r=this.layer?.metadata?.get(10018)?.value??0,i=u({cameraAzimuth:r,platformHeading:n,source:this.layer.sensorSymbolOrientation?.source,symbolOffset:this.layer.sensorSymbolOrientation?.symbolOffset??0});this.symbolAngle=Math.round(Math.abs(i))}_updateSensorLocationSymbol(){switch(this._sensorLocationSymbolType){case`simple-marker`:this.sensorLocationSymbol=this.layer.sensorSymbol.clone(),this.sensorLocationSymbol.angle=this.symbolAngle,this._sensorLocationGraphic.symbol=this.sensorLocationSymbol.clone();break;case`picture-marker`:this.sensorLocationSymbol=this.layer.sensorSymbol,this.sensorLocationSymbol.angle=this.symbolAngle,this._sensorLocationGraphic.symbol=this.sensorLocationSymbol;break;case`cim`:this.sensorLocationSymbol=this.layer.sensorSymbol,m(this.sensorLocationSymbol,this.symbolAngle,!0),this._sensorLocationGraphic.symbol=this.sensorLocationSymbol}}_updateFrameCenterSymbol(){this.layer?.frameCenterSymbol&&(this._frameCenterGraphic.symbol=this.layer.frameCenterSymbol.clone())}_updateFrameOutlineSymbol(){this.layer?.frameOutlineSymbol&&(this._frameOutlineGraphic.symbol=this.layer.frameOutlineSymbol.clone())}_updateSensorPathSymbol(){this.layer?.sensorPathSymbol&&(this._sensorPathGraphic.symbol=this.layer.sensorPathSymbol.clone())}_updateSensorSightlineSymbol(){this.layer?.sensorSightLineSymbol&&(this._sensorSightlineGraphic.symbol=this.layer.sensorSightLineSymbol.clone())}_updateSensorTrailSymbol(){this.layer?.sensorTrailSymbol&&(this._sensorTrailGraphic.symbol=this.layer.sensorTrailSymbol.clone())}async _addOverlayMultipoint(){if(!this.layer.videoElement)return;let e=new _(this.layer.videoElement);this.addAttachHandles([i(()=>[this.layer.frameHorizonPoints,this.layer.groundControlPoints,this.layer.frameOpacity,this.layer.telemetryDisplay?.frame],()=>{if(!this.view.animationsEnabled)return;let{visibleTelemetryElements:t}=this;e.frameHorizonPoints=this.layer.frameHorizonPoints,e.groundControlPoints=this.layer.groundControlPoints,e.opacity=this.layer.frameOpacity,e.visible=t?.frame??!1},a)]),this._overlayContainer.addChild(e),this.view.stage.requestRender()}};e([o()],C.prototype,`graphicsView`,void 0),e([o()],C.prototype,`layer`,void 0),e([o({types:h})],C.prototype,`sensorLocationSymbol`,void 0),e([o()],C.prototype,`symbolAngle`,void 0),e([o({type:l})],C.prototype,`visibleTelemetryElements`,void 0),C=e([s(`esri.views.2d.layers.VideoLayerView2D`)],C);const w=C;export{w as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../Color.js";import n from"../../../Graphic.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{watch as i,initial as a}from"../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../core/accessorSupport/decorators.js";import c from"../../../layers/GraphicsLayer.js";import l from"../../../layers/support/TelemetryDisplay.js";import{getSymbolDisplayAngle as u}from"../../../layers/video/videoUtils.js";import d from"../../../symbols/SimpleFillSymbol.js";import f from"../../../symbols/SimpleLineSymbol.js";import p from"../../../symbols/SimpleMarkerSymbol.js";import{applyCIMSymbolRotation as m}from"../../../symbols/support/cimSymbolUtils.js";import{symbolTypes as h}from"../../../symbols/support/typeUtils.js";import g from"../engine/webgl/OverlayContainer.js";import _ from"../engine/webgl/OverlayMultipoint.js";import{LayerView2D as v}from"./LayerView2D.js";import y from"./graphics/GraphicContainer.js";import b from"./graphics/GraphicsView2D.js";import x from"../../layers/LayerView.js";const S=new t([255,127,0]);let C=class extends v(x){constructor(){super(...arguments),this._graphicsLayer=new c,this._frameOutlineGraphic=new n({symbol:new d({outline:{type:`simple-line`,color:S}})}),this._frameCenterGraphic=new n({symbol:new p({color:S,style:`cross`})}),this._sensorPathGraphic=new n({symbol:new f({color:S})}),this._sensorTrailGraphic=new n({symbol:new f({color:S})}),this._sensorSightlineGraphic=new n({symbol:new f({color:S})}),this._sensorLocationGraphic=new n({symbol:new p({color:S})}),this._overlayContainer=null,this._sensorLocationSymbolType=null,this.layer=null,this.sensorLocationSymbol=null,this.symbolAngle=0,this.visibleTelemetryElements=null}destroy(){this._graphicsLayer=r(this._graphicsLayer)}initialize(){this._sensorLocationSymbolType=this.layer?.sensorSymbol.type,this._graphicsLayer.graphics.addMany([this._frameCenterGraphic,this._sensorSightlineGraphic,this._sensorPathGraphic,this._sensorTrailGraphic,this._frameOutlineGraphic,this._sensorLocationGraphic]),this.visibleTelemetryElements=new l({frame:this.layer.telemetryDisplay?.frame??!1,frameCenter:this.layer.telemetryDisplay?.frameCenter??!0,frameOutline:this.layer.telemetryDisplay?.frameOutline??!0,lineOfSight:this.layer.telemetryDisplay?.lineOfSight??!0,sensorLocation:this.layer.telemetryDisplay?.sensorLocation??!0,sensorPath:this.layer.telemetryDisplay?.sensorPath??!0,sensorTrail:this.layer.telemetryDisplay?.sensorTrail??!0})}attach(){this._overlayContainer=new g,this.container.addChild(this._overlayContainer),this._addOverlayMultipoint(),this.graphicsView=new b({requestUpdateCallback:()=>this.requestUpdate(),view:this.view,graphics:this._graphicsLayer.graphics,container:new y(this.view.featuresTilingScheme)}),this.container.addChild(this.graphicsView.container),this.addAttachHandles(this._graphicsLayer.on(`graphic-update`,this.graphicsView.graphicUpdateHandler)),this.addAttachHandles([i(()=>[this.layer.telemetryDisplay?.frame,this.layer.telemetryDisplay?.frameCenter,this.layer.telemetryDisplay?.frameOutline,this.layer.telemetryDisplay?.sensorLocation,this.layer.telemetryDisplay?.sensorPath,this.layer.telemetryDisplay?.sensorTrail,this.layer.telemetryDisplay?.lineOfSight],()=>this._updateVisibleTelemetryElements(),a),i(()=>[this.layer.telemetry,this.layer.telemetry.sensorPath,this.layer.telemetry.sensorTrail,this.visibleTelemetryElements?.frameCenter,this.visibleTelemetryElements?.frameOutline,this.visibleTelemetryElements?.sensorLocation,this.visibleTelemetryElements?.sensorPath,this.visibleTelemetryElements?.sensorTrail,this.visibleTelemetryElements?.lineOfSight],()=>this._updateGraphicGeometries(),a),i(()=>this.layer.metadata,()=>this._updateSensorLocationSymbolAngle(),a),i(()=>this.layer?.frameCenterSymbol,()=>this._updateFrameCenterSymbol(),a),i(()=>this.layer?.frameOutlineSymbol,()=>this._updateFrameOutlineSymbol(),a),i(()=>this.layer?.sensorPathSymbol,()=>this._updateSensorPathSymbol(),a),i(()=>this.layer?.sensorSightLineSymbol,()=>this._updateSensorSightlineSymbol(),a),i(()=>this.layer?.sensorSymbol,()=>this._updateSensorLocationSymbol(),a),i(()=>this.layer?.sensorTrailSymbol,()=>this._updateSensorTrailSymbol(),a),i(()=>this.symbolAngle,()=>this._updateSensorLocationSymbol(),a)])}detach(){this._overlayContainer.removeAllChildren(),this.container.removeAllChildren(),this.graphicsView=r(this.graphicsView)}supportsSpatialReference(e){return!0}moveEnd(){}viewChange(){this.graphicsView.viewChange()}update(e){this.graphicsView.processUpdate(e)}isUpdating(){return!this.graphicsView||this.graphicsView.updating}_updateVisibleTelemetryElements(){this.view.animationsEnabled&&this.visibleTelemetryElements&&this.layer.telemetryDisplay&&(this.visibleTelemetryElements.frame=this.layer.telemetryDisplay.frame,this.visibleTelemetryElements.frameCenter=this.layer.telemetryDisplay.frameCenter,this.visibleTelemetryElements.frameOutline=this.layer.telemetryDisplay.frameOutline,this.visibleTelemetryElements.lineOfSight=this.layer.telemetryDisplay.lineOfSight,this.visibleTelemetryElements.sensorLocation=this.layer.telemetryDisplay.sensorLocation,this.visibleTelemetryElements.sensorTrail=this.layer.telemetryDisplay.sensorTrail,this.visibleTelemetryElements.sensorPath=this.layer.telemetryDisplay.sensorPath)}_updateGraphicGeometries(){if(!this.view.animationsEnabled)return;let{telemetry:e}=this.layer,{visibleTelemetryElements:t}=this;e&&t&&(t.frameOutline&&e.frameOutline?this._frameOutlineGraphic.geometry=this.layer.telemetry.frameOutline:this._frameOutlineGraphic.geometry=null,t.sensorTrail&&e.sensorTrail?this._sensorTrailGraphic.geometry=this.layer.telemetry.sensorTrail:this._sensorTrailGraphic.geometry=null,t.sensorPath&&e.sensorPath?this._sensorPathGraphic.geometry=this.layer.telemetry.sensorPath:this._sensorPathGraphic.geometry=null,t.lineOfSight&&e.lineOfSight?this._sensorSightlineGraphic.geometry=this.layer.telemetry.lineOfSight:this._sensorSightlineGraphic.geometry=null,t.sensorLocation&&e.sensorLocation?this._sensorLocationGraphic.geometry=this.layer.telemetry.sensorLocation:this._sensorLocationGraphic.geometry=null,t.frameCenter&&e.frameCenter?this._frameCenterGraphic.geometry=this.layer.telemetry.frameCenter:this._frameCenterGraphic.geometry=null)}_updateSensorLocationSymbolAngle(){if(!this.view.animationsEnabled||!this.layer?.metadata?.size)return;let{source:e,symbolOffset:t=0}=this.layer.sensorSymbolOrientation||{};if(!e&&!t)return;let n=this.layer?.metadata?.get(10005)?.value??0,r=this.layer?.metadata?.get(10018)?.value??0,i=u({cameraAzimuth:r,platformHeading:n,source:this.layer.sensorSymbolOrientation?.source,symbolOffset:this.layer.sensorSymbolOrientation?.symbolOffset??0});this.symbolAngle=Math.round(Math.abs(i))}_updateSensorLocationSymbol(){switch(this._sensorLocationSymbolType){case`simple-marker`:this.sensorLocationSymbol=this.layer.sensorSymbol.clone(),this.sensorLocationSymbol.angle=this.symbolAngle,this._sensorLocationGraphic.symbol=this.sensorLocationSymbol.clone();break;case`picture-marker`:this.sensorLocationSymbol=this.layer.sensorSymbol,this.sensorLocationSymbol.angle=this.symbolAngle,this._sensorLocationGraphic.symbol=this.sensorLocationSymbol;break;case`cim`:this.sensorLocationSymbol=this.layer.sensorSymbol,m(this.sensorLocationSymbol,this.symbolAngle,!0),this._sensorLocationGraphic.symbol=this.sensorLocationSymbol}}_updateFrameCenterSymbol(){this.layer?.frameCenterSymbol&&(this._frameCenterGraphic.symbol=this.layer.frameCenterSymbol.clone())}_updateFrameOutlineSymbol(){this.layer?.frameOutlineSymbol&&(this._frameOutlineGraphic.symbol=this.layer.frameOutlineSymbol.clone())}_updateSensorPathSymbol(){this.layer?.sensorPathSymbol&&(this._sensorPathGraphic.symbol=this.layer.sensorPathSymbol.clone())}_updateSensorSightlineSymbol(){this.layer?.sensorSightLineSymbol&&(this._sensorSightlineGraphic.symbol=this.layer.sensorSightLineSymbol.clone())}_updateSensorTrailSymbol(){this.layer?.sensorTrailSymbol&&(this._sensorTrailGraphic.symbol=this.layer.sensorTrailSymbol.clone())}async _addOverlayMultipoint(){if(!this.layer.videoElement)return;let e=new _(this.layer.videoElement);this.addAttachHandles([i(()=>[this.layer.frameHorizonPoints,this.layer.groundControlPoints,this.layer.frameOpacity,this.layer.telemetryDisplay?.frame],()=>{if(!this.view.animationsEnabled)return;let{visibleTelemetryElements:t}=this;e.frameHorizonPoints=this.layer.frameHorizonPoints,e.groundControlPoints=this.layer.groundControlPoints,e.opacity=this.layer.frameOpacity,e.visible=t?.frame??!1},a)]),this._overlayContainer.addChild(e),this.view.stage.requestRender()}};e([o()],C.prototype,`graphicsView`,void 0),e([o()],C.prototype,`layer`,void 0),e([o({types:h})],C.prototype,`sensorLocationSymbol`,void 0),e([o()],C.prototype,`symbolAngle`,void 0),e([o({type:l})],C.prototype,`visibleTelemetryElements`,void 0),C=e([s(`esri.views.2d.layers.VideoLayerView2D`)],C);const w=C;export{w as default};
|