@arcgis/core 5.1.0-next.43 → 5.1.0-next.44
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/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/actions/AttributeFilter.js +1 -1
- package/arcade/featureset/actions/OrderBy.js +1 -1
- package/arcade/featureset/actions/SpatialFilter.js +1 -1
- package/arcade/featureset/actions/Top.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
- package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/OrderbyClause.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{0836964a65f76da35b5c.js → 1a3f874700f86b750390.js} +23 -23
- package/assets/esri/core/workers/chunks/25e4568a3ff76f48ac5e.js +1 -0
- package/assets/esri/core/workers/chunks/{b6e63d8ce3c9ac9762f4.js → 2cd0934163cb627ce251.js} +1 -1
- package/assets/esri/core/workers/chunks/{8f12a559dbf284c21e2f.js → 3c7ee71f0d8582e6d78f.js} +1 -1
- package/assets/esri/core/workers/chunks/{9a9b1250be3e20499d75.js → 4140d4c8b6b122fc2cd4.js} +1 -1
- package/assets/esri/core/workers/chunks/{eff198e0c21c9767ffaa.js → 45cf181c1945e6c77a4b.js} +1 -1
- package/assets/esri/core/workers/chunks/5f2e246ffcbdedea4de5.js +1 -0
- package/assets/esri/core/workers/chunks/5f81f9e586b3ba0c34d4.js +1 -0
- package/assets/esri/core/workers/chunks/64da1ad9df9094ef5c12.js +1 -0
- package/assets/esri/core/workers/chunks/{093aa05fbde548bf9040.js → 6cc5c37d6bdaf5483bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/{73a008b48e29eb6f2064.js → 848c6989a6a222c7a1d8.js} +2 -2
- package/assets/esri/core/workers/chunks/{dbedd246f4b584583f95.js → 9aa1ad8b436b5b0dd5f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{c1cae45a159a5373ac00.js → a4a2e7bc3369434c5cfa.js} +1 -1
- package/assets/esri/core/workers/chunks/b5ced451d331ca1ffb68.js +1 -0
- package/assets/esri/core/workers/chunks/{80bfb5e5d613d2c412bf.js → c0cc4ca138db47052845.js} +1 -1
- package/assets/esri/core/workers/chunks/{7132420980f77b6a871b.js → c9f5d72b86ecb2a30587.js} +1 -1
- package/assets/esri/core/workers/chunks/{93846f8b77fc802069a7.js → df5788d42787ee8bf523.js} +1 -1
- package/assets/esri/core/workers/chunks/{b15a02bdcd78a1a51bd6.js → e72ca52d930afb5650af.js} +1 -1
- package/assets/esri/core/workers/chunks/{f835eea9f617556c7276.js → fb69a0bb025b7a5ec588.js} +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_en.json +1 -1
- package/chunks/ComponentShader.glsl.js +11 -11
- package/chunks/DefaultMaterial.glsl.js +1 -1
- package/chunks/HUDMaterial.glsl.js +28 -36
- package/chunks/ImageMaterial.glsl.js +1 -1
- package/chunks/Path.glsl.js +7 -7
- package/chunks/Pattern.glsl.js +1 -1
- package/chunks/RibbonLine.glsl.js +2 -2
- package/chunks/ShadowHighlight.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +5 -5
- package/chunks/Water.glsl.js +5 -5
- package/config.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/SceneLayer.d.ts +16 -10
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/support/Sublayer.d.ts +6 -0
- package/layers/support/Sublayer.js +1 -1
- package/package.json +3 -3
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/GlyphSource.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedConfiguration.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/terrain/OverlayRenderTargets.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +2 -2
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechnique.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutputConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlightOverlay.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/ObjectAndLayerIDRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GLMaterial.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineCalloutTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +10 -10
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDynamic.js +1 -1
- package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/assets/esri/core/workers/chunks/04981ae9d7728208ffce.js +0 -1
- package/assets/esri/core/workers/chunks/23af269e88f9ac101ffb.js +0 -1
- package/assets/esri/core/workers/chunks/42b556d56013350c9d80.js +0 -1
- package/assets/esri/core/workers/chunks/80a1ccabd4257cc61e0d.js +0 -1
- package/assets/esri/core/workers/chunks/ea356a5b90ea44b5cbe1.js +0 -1
- package/views/2d/engine/vectorTiles/GlyphMosaic.js +0 -2
- package/views/2d/engine/vectorTiles/GlyphSource.js +0 -2
- package/views/2d/engine/vectorTiles/RectangleBinPack.js +0 -2
- /package/assets/esri/core/workers/chunks/{73a008b48e29eb6f2064.js.LICENSE.txt → 848c6989a6a222c7a1d8.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "5.1.0-next.
|
|
3
|
+
"version": "5.1.0-next.44",
|
|
4
4
|
"homepage": "https://js.arcgis.com",
|
|
5
5
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
6
6
|
"keywords": [
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@amcharts/amcharts5": "~5.16.1",
|
|
22
|
-
"@arcgis/toolkit": "^5.1.0-next.
|
|
22
|
+
"@arcgis/toolkit": "^5.1.0-next.44",
|
|
23
23
|
"@esri/arcgis-html-sanitizer": "~4.1.0",
|
|
24
24
|
"@esri/calcite-components": "^5.0.2",
|
|
25
|
-
"@vaadin/grid": "~25.0.
|
|
25
|
+
"@vaadin/grid": "~25.0.8",
|
|
26
26
|
"@zip.js/zip.js": "~2.8.23",
|
|
27
27
|
"luxon": "~3.7.2",
|
|
28
28
|
"marked": "~17.0.4",
|
package/support/revision.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
const a="20260317",e="0ef336ad8d94307d964a50ef0b09a6a67e60a207";export{a as buildDate,e as commitHash};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import"../../../../core/has.js";import{rasterizeDash as t}from"../../../../symbols/cim/rasterizingUtils.js";import{log2 as e}from"./GeometryUtils.js";import i from"
|
|
2
|
+
import"../../../../core/has.js";import{rasterizeDash as t}from"../../../../symbols/cim/rasterizingUtils.js";import{log2 as e}from"./GeometryUtils.js";import i from"../webgl/Rect.js";import s from"../webgl/RectangleBinPack.js";import a from"../../../webgl/Texture.js";import{TextureDescriptor as h}from"../../../webgl/TextureDescriptor.js";const r="dasharray-";class o{constructor(t,e,i=0){this._mosaicPages=[],this._currentPage=0,this._maxItemSize=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects={},this.pixelRatio=1,e<=0&&console.error("Sprites mosaic defaultWidth and defaultHeight must be greater than zero!"),this._pageWidth=t,this._pageHeight=e,i>0&&(this._maxItemSize=i),this._binPack=new s(t-4,e-4),this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}destroy(){this.dispose()}dispose(){if(this._binPack=null,null!==this._mosaicPages){for(const t of this._mosaicPages){const e=t.texture;e&&e.dispose()}this._mosaicPages=null}}getWidth(t){return t<0||t>=this._mosaicPages.length?-1:this._mosaicPages[t].size[0]}getHeight(t){return t<0||t>=this._mosaicPages.length?-1:this._mosaicPages[t].size[1]}getPageSize(t){return t<0||t>=this._mosaicPages.length?null:this._mosaicPages[t].size}getTexture(t){return t<0||t>=this._mosaicPages.length?null:this._mosaicPages[t].texture||null}setSpriteSource(t){for(const e of this._mosaicPages)e.texture&&(e.texture.dispose(),e.texture=null),e.dirty=!0;if(0===this._mosaicPages.length){this._binPack=new s(this._pageWidth-4,this._pageHeight-4);const t=Math.floor(this._pageWidth)*Math.floor(this._pageHeight),e=new Uint32Array(t);for(let i=0;i<t;i++)e[i]=0;this._mosaicPages.push({mosaicsData:{type:"static",data:e},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:null})}this._sprites=t}getSpriteItem(t,e=!1){let i,s,a=this._mosaicRects[t];if(a)return a;if(!this._sprites||"loaded"!==this._sprites.loadStatus)return null;if(t&&t.startsWith(r)?([i,s]=this._rasterizeDash(t),e=!0):i=this._sprites.getSpriteInfo(t),!i?.width||!i.height||i.width<0||i.height<0)return null;const h=i.width,o=i.height,[n,g,c]=this._allocateImage(h,o);return n.width<=0?null:(this._copy(n,i,g,c,e,s),a={type:"sprite",rect:n,width:h,height:o,sdf:i.sdf,simplePattern:!1,rasterizationScale:i.pixelRatio??1,samplingMode:"Linear",page:g},this._mosaicRects[t]=a,a)}getSpriteItems(t){const e={};for(const i of t)e[i.name]=this.getSpriteItem(i.name,i.repeat);return e}getMosaicItemPosition(t,e){const i=this.getSpriteItem(t,e),s=i?.rect;if(!s)return null;s.width=i.width,s.height=i.height;const a=i.width,h=i.height,r=2;return{tl:[s.x+r,s.y+r],br:[s.x+r+a,s.y+r+h],page:i.page}}bind(t,e,i=0,s=0){if(i>=this._mosaicPages.length||i>=this._mosaicPages.length)return;const r=this._mosaicPages[i];let o=r.texture;if(!o){const e=new h(r.size[0],r.size[1]);e.wrapMode=33071,o=new a(t,e),r.texture=o}if(o.setSamplingMode(e),t.bindTexture(o,s),r.dirty){const t=r.mosaicsData.data;o.setData(new Uint8Array(t.buffer))}r.dirty=!1}static _copyBits(t,e,i,s,a,h,r,o,n,g,c){let l=s*e+i,_=o*h+r;if(c){_-=h;for(let r=-1;r<=g;r++,l=((r+g)%g+s)*e+i,_+=h)for(let e=-1;e<=n;e++)a[_+e]=t[l+(e+n)%n]}else for(let m=0;m<g;m++){for(let e=0;e<n;e++)a[_+e]=t[l+e];l+=e,_+=h}}_copy(t,e,i,s,a,h){if(!this._sprites||"loaded"!==this._sprites.loadStatus||i>=this._mosaicPages.length)return;const r=this._mosaicPages[i],n=r.mosaicsData.data,g=new Uint32Array(h?h.buffer:this._sprites.image.buffer),c=2,l=h?e.width:this._sprites.width;o._copyBits(g,l,e.x,e.y,n,s[0],t.x+c,t.y+c,e.width,e.height,a),r.dirty=!0}_allocateImage(t,a){t+=2,a+=2;const h=Math.max(t,a);if(this._maxItemSize&&this._maxItemSize<h){const s=2**Math.ceil(e(t)),h=2**Math.ceil(e(a)),r=new i(0,0,t,a);return this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(s*h)},size:[s,h],dirty:!0,texture:null}),[r,this._mosaicPages.length-1,[s,h]]}let r=t%4?4-t%4:4,o=a%4?4-a%4:4;1===r&&(r=5),1===o&&(o=5);const n=this._binPack.allocate(t+r,a+o);if(n.width<=0){const e=this._mosaicPages[this._currentPage];return e.dirty||(e.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:"static",data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:null}),this._binPack=new s(this._pageWidth-4,this._pageHeight-4),this._allocateImage(t,a)}return[n,this._currentPage,[this._pageWidth,this._pageHeight]]}_rasterizeDash(e){const i=/\[(.*?)\]/,s=e.match(i);if(!s)return null;const a=s[1].split(",").map(Number),h=e.slice(e.lastIndexOf("-")+1),[r,o,n]=t(a,h);return[{x:0,y:0,width:o,height:n,sdf:!0,pixelRatio:1},new Uint8Array(r.buffer)]}}export{o as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{abortMaybe as t}from"../../../../core/maybe.js";import{throwIfNotAbortError as e,throwIfAbortError as s,isAbortError as r,eachAlways as i}from"../../../../core/promiseUtils.js";import{addQueryParameters as o}from"../../../../core/urlUtils.js";import{open as n}from"../../../../core/workers.js";import a from"./
|
|
2
|
+
import has from"../../../../core/has.js";import{abortMaybe as t}from"../../../../core/maybe.js";import{throwIfNotAbortError as e,throwIfAbortError as s,isAbortError as r,eachAlways as i}from"../../../../core/promiseUtils.js";import{addQueryParameters as o}from"../../../../core/urlUtils.js";import{open as n}from"../../../../core/workers.js";import a from"./SpriteMosaic.js";import l from"../webgl/GlyphMosaic.js";import c from"../webgl/GlyphSource.js";import h from"../../tiling/TileKey.js";class u{constructor(t,e,s,r){this._layer=t,this._styleRepository=e,this.devicePixelRatio=s,this._sourceDataMaxLOD=r,this._spriteMosaic=null,this._glyphMosaic=null,this._connection=null,this._spriteSourceAbortController=null,this._startOptionsInputSignal=null,this._inputSignalEventListener=null}destroy(){this._connection?.close(),this._connection=null,this._styleRepository=null,this._layer=null,this._spriteMosaic?.destroy(),this._spriteMosaic=null,this._glyphMosaic=null,this._spriteSourceAbortController=t(this._spriteSourceAbortController),this._spriteSourcePromise=null,this._inputSignalEventListener&&this._startOptionsInputSignal?.removeEventListener("abort",this._inputSignalEventListener),this._startOptionsInputSignal=null,this._inputSignalEventListener=null}get spriteMosaic(){return this._spriteSourcePromise.then(()=>this._spriteMosaic)}get glyphMosaic(){return this._glyphMosaic}async start(t){this._requestSprite(t);const s=this._layer.currentStyleInfo.glyphsUrl,r=new c(s?o(s,{...this._layer.customParameters,token:this._layer.apiKey}):"");this._glyphMosaic=new l(1024,1024,r,!0),this._broadcastPromise=n("WorkerTileHandler",{client:this,schedule:t.schedule,signal:t.signal}).then(s=>{if(this._layer&&(this._connection?.close(),this._connection=s,this._layer&&!this._connection.closed)){const r=s.broadcast("setStyle",{style:this._layer.currentStyleInfo.style,sourceDataMaxLOD:this._sourceDataMaxLOD},t);Promise.all(r).catch(t=>e(t))}})}_requestSprite(t){this._spriteSourceAbortController?.abort();const e=new AbortController;this._spriteSourceAbortController=e;const r=t?.signal;this._inputSignalEventListener&&this._startOptionsInputSignal?.removeEventListener("abort",this._inputSignalEventListener),this._startOptionsInputSignal=null,r&&(this._inputSignalEventListener=p(e),r.addEventListener("abort",this._inputSignalEventListener,{once:!0}));const{signal:i}=e,o={...t,signal:i};this._spriteSourcePromise=this._layer.loadSpriteSource(this.devicePixelRatio,o),this._spriteSourcePromise.then(t=>{s(i),this._spriteMosaic=new a(1024,1024,250),this._spriteMosaic.setSpriteSource(t)})}async updateStyle(t){const e=[];for(const s of t)4===s.type?e.push({type:4,data:{spriteSource:null}}):e.push(s);return await this._broadcastPromise,this._broadcastPromise=Promise.all(this._connection.broadcast("updateStyle",e)),this._broadcastPromise}setSpriteSource(t){const e=new a(1024,1024,250);return e.setSpriteSource(t),this._spriteMosaic=e,this._spriteSourcePromise=Promise.resolve(t),this._spriteSourceAbortController=null,e}async setStyle(t,e,s){await this._broadcastPromise,this._styleRepository=t,this._sourceDataMaxLOD=s,this._requestSprite();const r=this._layer.currentStyleInfo.glyphsUrl,i=new c(r?o(r,{...this._layer.customParameters,token:this._layer.apiKey}):"");return this._glyphMosaic=new l(1024,1024,i,!0),this._broadcastPromise=Promise.all(this._connection.broadcast("setStyle",{style:e,sourceDataMaxLOD:this._sourceDataMaxLOD})),this._broadcastPromise}async fetchTileData(t,e){const s=await this._getRefKeys(t,e);return this._getSourcesData(Object.keys(this._layer.sourceNameToSource),s,e)}async fetchTilePBFs(t){const e=Object.keys(this._layer.sourceNameToSource),s={},r=await this._getRefKeys(t,s),i=[],o=[];for(let n=0;n<r.length;n++)if(null==r[n].value||null==e[n])o.push(null);else{const t=r[n].value,a=this._getTilePayload(t,e[n],s);a.then(e=>{i.push({...e,key:t})}),o.push(a)}return Promise.all(o).then(()=>i)}async parseTileData(t,e){const s=t&&t.data;if(!s)return null;const{sourceName2DataAndRefKey:r,transferList:i}=s;return 0===Object.keys(r).length?null:this._broadcastPromise.then(()=>this._connection.invoke("createTileAndParse",{key:t.key.id,sourceName2DataAndRefKey:r,styleLayerUIDs:t.styleLayerUIDs},{...e,transferList:i}))}async getSprites(t){return await this._spriteSourcePromise,this._spriteMosaic.getSpriteItems(t)}async getGlyphs(t){return has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(t.font),this._glyphMosaic.getGlyphItemsVTL(t.font,t.codePoints)}async _getTilePayload(t,e,s){const i=h.pool.acquire(t.id),o=this._layer.sourceNameToSource[e],{level:n,row:a,col:l}=i;h.pool.release(i);try{return{protobuff:await o.requestTile(n,a,l,s),sourceName:e}}catch(c){if(r(c))throw c;return{protobuff:null,sourceName:e}}}async _getRefKeys(t,e){const s=this._layer.sourceNameToSource,r=new Array;for(const i in s){const o=s[i].getRefKey(t,e);r.push(o)}return i(r)}_getSourcesData(t,e,s){const r=[];for(let i=0;i<e.length;i++)if(null==e[i].value||null==t[i])r.push(null);else{const o=e[i].value,n=this._getTilePayload(o,t[i],s);r.push(n)}return i(r).then(t=>{const s={},r=[];for(let i=0;i<t.length;i++){const o=t[i].value;if(o&&(o.protobuff&&o.protobuff.byteLength>0)){const t=e[i].value.id;s[o.sourceName]={refKey:t,protobuff:o.protobuff},r.push(o.protobuff)}}return{sourceName2DataAndRefKey:s,transferList:r}})}}function p(t){return()=>t.abort()}export{u as TileHandler};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import t from"../../../../request.js";import{bidiText as e}from"../../../../core/BidiText.js";import has from"../../../../core/has.js";import{throwIfNotAbortError as
|
|
2
|
+
import t from"../../../../request.js";import{bidiText as e}from"../../../../core/BidiText.js";import has from"../../../../core/has.js";import{throwIfNotAbortError as s}from"../../../../core/promiseUtils.js";import{loadTextModule as i}from"../../../../libs/text/loadTextModule.js";import{sdfRadiusComplex as h,sdfBufferGlyphSDFCreator as a,sdfSizeComplex as r,sdfBufferServer as n,sdfRadiusSimple as o,sdfSizeSimple as c}from"./definitions.js";import{GlyphSDFCreator as l}from"./GlyphSDFCreator.js";import p from"./Rect.js";import g from"./RectangleBinPack.js";import{charCodes as d}from"./Utils.js";import _ from"../../../webgl/Texture.js";import{TextureDescriptor as f}from"../../../webgl/TextureDescriptor.js";const u=256,y=.25,m=t=>Math.floor(t/256);function w(t){const e=new Set;for(const s of t)e.add(m(s));return e}function C(t,e,i){return t.has(e)||t.set(e,i().then(()=>{t.delete(e)}).catch(i=>{t.delete(e),s(i)})),t.get(e)}const x=t=>({rect:new p(0,0,0,0),page:0,metrics:{left:0,width:0,height:0,advance:0,top:0},code:t,sdf:!0});class P{constructor(t,e,s,i=!1){this._snapCoords=i,this.width=0,this.height=0,this._dirties=[],this._pageData=[],this._currentPage=0,this._glyphCache={},this._glyphCacheById={},this._textures=[],this._rangePromises=new Map,this._facePromises=new Map,this._preloadCache={},this._glyphSDFCreator=new l({sdfSizePx:r,sdfBufferPx:a,radius:h,cutoff:y}),this._faces=new Map,this.width=t,this.height=e,this._glyphSource=s,this._binPack=new g(t,e),this._pageData.push(new Uint8Array(t*e)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){this._binPack=null;for(const t of this._textures)t&&t.dispose();this._textures.length=0,this._pageData.length=0}_initDecorationGlyphs(){const t=[117,149,181,207,207,181,149,117],e=[],s=[];for(let a=0;a<t.length;a++){const i=t[a];for(let t=0;t<11;t++){const h=a>=3&&a<5&&t>=3&&t<8?255:0;e.push(i),s.push(h)}}const i={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(e)},h={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(s)};this._recordGlyph(i,n),this._recordGlyph(h,n)}getTexture(t,e){if(!this._textures[e]){const s=new f(this.width,this.height);s.pixelFormat=6406,s.wrapMode=33071,this._textures[e]=new _(t,s,new Uint8Array(this.width*this.height))}return this._dirties[e]&&(this._textures[e].setData(this._pageData[e]),this._dirties[e]=!1),this._textures[e]}async getGlyphItems(t,s,i,l){const p=s?r:c,g=s?h:o,_=s?a:n;let f,u,y=!1;if(s){const s=this._getGlyphCacheById(i),h=await this.getFace(i);if(!h)return null;const a=this._glyphSDFCreator.sdfSizePx,[r,n,o]=e(t,!1);y=n;const c=new Uint32Array(Array.from(r).map((t,e)=>o.levels[o.targetToSource[e]]));f={baseline:h.baseline()/a,midline:h.midline()/a},u=h.shape(r,c,a).map(t=>this._getMosaicItemComplex(s,t,h))}else{const[s,h,a]=e(t);y=h;const r=this._getGlyphCache(i),n=d(s);try{await this._fetchRanges(i,n,l)}catch{return null}u=n.map(t=>this._getMosaicItem(r,i,t))}return{type:"glyphs",isRightToLeft:y,glyphs:u,faceInfo:f,sdfSize:p,sdfRadius:g,sdfPadding:_}}async getGlyphItemsVTL(t,e){const s=this._getGlyphCache(t);await this._fetchRanges(t,e,null);const i=[];for(const h of e)i[h]=this._getMosaicItem(s,t,h);return i}async getFace(e){if(this._faces.has(e))return this._faces.get(e);const s=this._glyphSource.woffURL(e);return await C(this._facePromises,e,async()=>{const h=await t(s,{responseType:"array-buffer"}),a=(await i()).Face.parseWoff2(new Uint8Array(h.data));this._faces.set(e,a)}),this._faces.get(e)}_getMosaicItem(t,e,s){if(!t[s]){const i=this._glyphSource.getGlyph(e,s);if(!i?.metrics)return x(s);const h=this._recordGlyph(i,n),a=this._currentPage,r=i.metrics;t[s]={rect:h,page:a,metrics:r,code:s,sdf:!0},this._invalidate()}return t[s]}_getMosaicItemComplex(t,e,s){if(!t[e.glyphId]){const i=this._glyphSDFCreator.draw(s,e.glyphId),h={width:i?.width??0,height:i?.height??0,left:i?.left??0,top:i?.top??0,advance:e.xAdvance};let r=new p(0,0,0,0);if(i){const t={bitmap:i.buffer,metrics:h};r=this._recordGlyph(t,a)}const n=e.isNewline?10:e.isWhitespace?32:NaN;t[e.glyphId]={rect:r,page:this._currentPage,metrics:h,sdf:!0,code:n}}return t[e.glyphId]}bind(t,e,s,i){const h=this.getTexture(t,s);h.setSamplingMode(e),t.bindTexture(h,i)}preloadASCIIGlyphCache(t){const e=this._preloadCache[t];if(null!=e)return e;const s=this._glyphSource.preloadASCIIRange(t).then(()=>{const e=this._getGlyphCache(t);for(let s=0;s<256;s++)this._getMosaicItem(e,t,s)});return this._preloadCache[t]=s,s}_getGlyphCache(t){return this._glyphCache[t]||(this._glyphCache[t]={}),this._glyphCache[t]}_getGlyphCacheById(t){return this._glyphCacheById[t]||(this._glyphCacheById[t]={}),this._glyphCacheById[t]}_invalidate(){this._dirties[this._currentPage]=!0}async _fetchRanges(t,e,s){const i=w(e),h=[];i.forEach(e=>{h.push(this._fetchRange(t,e,s))}),await Promise.all(h)}async _fetchRange(t,e,s){if(e>u)return;const i=t+e;return C(this._rangePromises,i,()=>this._glyphSource.getRange(t,e,s))}_allocNewPage(){this._dirties[this._currentPage]||(this._pageData[this._currentPage]=null),this._currentPage=this._pageData.length,this._pageData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs(),this._binPack=new g(this.width,this.height)}_recordGlyph(t,e){const s=t.metrics;let i;if(0===s.width)i=new p(0,0,0,0);else{const h=s.width+2*e,a=s.height+2*e;let r=h,n=a;if(this._snapCoords){r+=h%4?4-h%4:4,n+=a%4?4-a%4:4}i=this._binPack.allocate(r,n),i.isEmpty&&(this._allocNewPage(),i=this._binPack.allocate(r,n));const o=this._pageData[this._currentPage],c=t.bitmap;for(let t=0;t<a;t++){const e=h*t,s=this.width*(i.y+t)+i.x;for(let t=0;t<h;t++)o[s+t]=c[e+t]}has("esri-glyph-debug")&&this._showDebugPage(o)}return i}_showDebugPage(t){const e=document.createElement("canvas"),s=e.getContext("2d"),i=new ImageData(this.width,this.height),h=i.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let a=0;a<t.length;++a)h[4*a]=t[a],h[4*a+1]=0,h[4*a+2]=0,h[4*a+3]=255;s.putImageData(i,0,0),document.body.appendChild(e)}}export{P as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import t from"../../../../config.js";import e from"../../../../request.js";import a from"../../../../core/pbf.js";class s{constructor(t){
|
|
2
|
+
import t from"../../../../config.js";import e from"../../../../request.js";import a from"../../../../core/pbf.js";class s{constructor(t){this._metrics=[],this._bitmaps=[];const e=new Map;let a=0;for(;t.next();)switch(t.tag()){case 1:{const s=t.getMessage();for(;s.next();)switch(s.tag()){case 3:{const t=s.getMessage();let r,n,i,o,c,g,f;for(;t.next();)switch(t.tag()){case 1:r=t.getUInt32();break;case 2:n=t.getBytes();break;case 3:i=t.getUInt32();break;case 4:o=t.getUInt32();break;case 5:c=t.getSInt32();break;case 6:g=t.getSInt32();break;case 7:f=t.getUInt32();break;default:t.skip()}if(t.release(),r&&(this._metrics[r]={width:i,height:o,left:c,top:g,advance:f},n)){const t=n.length;e.set(r,n),this._bitmaps[r]={start:a,length:t},a+=t}break}default:s.skip()}s.release();break}default:t.skip()}this._buffer=new Uint8Array(a);for(const[s,r]of e)this._buffer.set(r,this._bitmaps[s].start)}getMetrics(t){return this._metrics[t]}getBitmap(t){const e=this._bitmaps.at(t);if(void 0!==e&&0!==e.length)return this._buffer.subarray(e.start,e.start+e.length)}}class r{constructor(){this._ranges=[]}getRange(t){return this._ranges[t]}addRange(t,e){this._ranges[t]=e}}class n{constructor(e){this._glyphInfo={},this._baseURL=e,this._woff2URL=`${t.fontsUrl}/woff2/{fontstack}.woff2`}async getRange(t,r,n){const i=this._getFontStack(t);if(i.getRange(r))return;const o=256*r,c=o+255,g=this._baseURL.replace("{fontstack}",t).replace("{range}",o+"-"+c);return e(g,{responseType:"array-buffer",...n}).then(t=>{i.addRange(r,new s(new a(new Uint8Array(t.data),new DataView(t.data))))})}async preloadASCIIRange(t){const r=this._getFontStack(t),n=0,i=255,o=this._baseURL.replace("{fontstack}",t).replace("{range}",n+"-"+i),c=await e(o,{responseType:"array-buffer"}),g=new s(new a(new Uint8Array(c.data),new DataView(c.data)));for(let e=n;e<=i;e++)r.getRange(e)||r.addRange(e,g)}getGlyph(t,e){const a=this._getFontStack(t);if(!a)return;const s=Math.floor(e/256),r=a.getRange(s);return r?{metrics:r.getMetrics(e),bitmap:r.getBitmap(e)}:void 0}woffURL(t){return this._woff2URL.replace("{fontstack}",t)}_getFontStack(t){let e=this._glyphInfo[t];return e||(e=this._glyphInfo[t]=new r),e}}export{n as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../config.js";import t from"../../../../request.js";import i from"../../../../core/Error.js";import{getFullyQualifiedFontName as s}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import r from"../../../../core/Logger.js";import{throwIfAborted as a,isAbortError as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{pt2px as c}from"../../../../core/screenUtils.js";import{numericHash as h}from"../../../../core/string.js";import l from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as u}from"../../../../symbols/cim/CIMSymbolHelper.js";import p from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as m,textureBindingSpriteAtlas as g,textureBindingGlyphAtlas as f,sdfBufferGlyphSDFCreator as y,sdfBufferServer as _,sdfRadiusComplex as M,sdfRadiusSimple as I,sdfSizeComplex as w,sdfSizeSimple as S}from"./definitions.js";import z from"./GlyphMosaic.js";import T from"./GlyphSource.js";import R from"./Rect.js";import C from"./SDFConverter.js";import x from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as P}from"./urlUtils.js";import{getCIMMarkerPlacementHash as b,isSVGImage as $}from"./Utils.js";import{AnimatableTextureResource as v}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as j}from"./animations/store/AnimationStore.js";const k="arial-unicode-ms-regular",A=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,F=()=>r.getLogger("esri.views.MapView"),G=(e,t,s)=>F().error(new i(e,t,s)),O=(e,t="")=>F().warnOnce(e,t);class B{static fromMosaic(e,t){return new B(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,s){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=s}}class N{constructor(s){this._requestRender=s,this._resourceManager=new l,this._invalidFonts=new Set,this._sdfConverter=new C(m),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new o({concurrency:10,process:async(e,s)=>{a(s);try{return await t(e,{responseType:"image",signal:s})}catch(r){if(!n(r))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,r);throw r}}}),this.animationStore=new j,this._spriteMosaic=new x(2048,2048,500),this._glyphSource=new T(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new z(1024,1024,this._glyphSource),this._rasterizer=new p(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=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}async rasterizeItem(e,t){if(null==e)return G("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:s}=i;return{rect:new R(s.column,s.row,t.length,1),page:s.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return G("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(1,t);return e}const s=await this._rasterizeSprite(i,t);return s&&this._setTextureBinding(0,s),s}getMosaicInfo(e,t,i=!1){const s=this._getTextureBindingInfo(e,t,i);return s?{size:s.size,texture:{texture:s.texture,unit:"sprite"===s.type?g:f}}:(G("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0],texture:{texture:null,unit:0}})}_getTextureBindingInfo(e,t,i){const{context:s}=e,r=this._bindingInfos[t-1],a=r.page,n="Nearest"===r.samplingMode?9728:i?9987:9729;switch(r.mosaicType){case 0:{const t=[this.sprites.getWidth(a),this.sprites.getHeight(a)],i=this._spriteMosaic.getTexture(e,a);return i.setSamplingMode(n),{type:"sprite",texture:i,size:t}}case 1:{const e=[this.glyphs.width,this.glyphs.height],t=this._glyphMosaic.getTexture(s,a);return this._glyphMosaic.bind(s,n,a,f),t.setSamplingMode(n),{type:"glyph",texture:t,size:e}}default:return G("mapview-texture-manager",`Cannot handle unknown type ${r.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const s=B.fromMosaic(e,t),r=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,r),this._bindingInfos.push(s)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:i,textString:r}=e,a=s(i),n=this._invalidFonts.has(a),o=!!has("esri-2d-force-complex-shaping")||!!has("esri-2d-complex-shaping")&&A.test(r),c=o?w:S,h=o?M:I,l=o?y:_;try{const e=n?k:a;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(e);const{isRightToLeft:i,glyphs:s,faceInfo:u}=await this._glyphMosaic.getGlyphItems(r,o,e,t);return{type:"glyphs",glyphs:s,faceInfo:u,isRightToLeft:i,sdfSize:c,sdfRadius:h,sdfPadding:l}}catch(u){O(`Font ${a} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(a);const{isRightToLeft:e,glyphs:i,faceInfo:s}=await this._glyphMosaic.getGlyphItems(r,o,k,t);return{type:"glyphs",glyphs:i,faceInfo:s,isRightToLeft:e,sdfSize:c,sdfRadius:h,sdfPadding:l}}}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${b(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?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(P(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=h(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t=[];u.fetchResources({type:"CIMPointSymbol",symbolLayers:[e]},this._resourceManager,t),t.length>0&&await Promise.all(t)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:s,image:r,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,s,{type:"static",data:r},L(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let s;return s="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,s),s.finally(()=>this._ongoingRasterizations.delete(e)),s}async _handleSVG(e,t,i){const s=[m,m],{asFill:r}=e,a=await this._sdfConverter.draw(e.path,r,i);return this._addItemToMosaic(t,s,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,i){const s=e.url,r=this.resourceManager.getResource(s);if(null==r)return null;const{width:a,height:n}=r;if(r instanceof HTMLImageElement){if("animated"===e.type)return G("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:s,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,r,i);return this._addItemToMosaic(t,s,{type:"static",data:c},L(e),o,!1)}let o,c,h;"animated"===e.type?(o=!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},h=e.startGroup||0):(o=L(e),c={type:"CIMAnimatedSymbolProperties",playAnimation:!0},h=0);const l=new v(r,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,s){const r=e.url;if(q(r)||V(r))return this._handleGIFOrPNG(e,t,s);if("animated"===e.type)return G("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let i;const a=this.resourceManager.getResource(r);if(null!=a&&a instanceof HTMLImageElement)i=a;else{const{data:e}=await this._imageRequestQueue.push(r,{...s});i=e}if($(r))if("width"in e&&"height"in e)i.width=c(e.width),i.height=c(e.height);else if("cim"in e){const t=e;i.width=c(t.width??t.scaleX*t.size),i.height=c(t.size)}if(!i.width||!i.height)return null;const n=i.width,o=i.height,h="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,i,h);return this._addItemToMosaic(t,l,{type:"static",data:p},L(e),u,!1)}catch(G){if(!n(G))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${r}. ${G.message}`);throw G}}_addItemToMosaic(e,t,i,s,r,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,s,r,a,n,o,c,h)}}function L(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return H(e);default:return!0}}const U=e=>null!=e&&e.startsWith("data:image/gif"),q=e=>e&&(e.includes(".gif")||U(e)),J=e=>null!=e&&e.startsWith("data:image/png"),V=e=>e&&(e.includes(".png")||J(e)),H=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{N as default};
|
|
2
|
+
import e from"../../../../config.js";import t from"../../../../request.js";import i from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import s from"../../../../core/Logger.js";import{throwIfAborted as a,isAbortError as n}from"../../../../core/promiseUtils.js";import{QueueProcessor as o}from"../../../../core/QueueProcessor.js";import{pt2px as c}from"../../../../core/screenUtils.js";import{numericHash as h}from"../../../../core/string.js";import l from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as u}from"../../../../symbols/cim/CIMSymbolHelper.js";import p from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as m}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as d,textureBindingSpriteAtlas as g,textureBindingGlyphAtlas as f}from"./definitions.js";import y from"./GlyphMosaic.js";import _ from"./GlyphSource.js";import M from"./Rect.js";import I from"./SDFConverter.js";import w from"./SpriteMosaic.js";import{discardUrlIfHasUrlHash as S}from"./urlUtils.js";import{getCIMMarkerPlacementHash as z,isSVGImage as C}from"./Utils.js";import{AnimatableTextureResource as T}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as x}from"./animations/store/AnimationStore.js";const R="arial-unicode-ms-regular",b=/[\u0695\u0698\u06a9\u06af\u06b5\u06be\u06c6\u06cc\u06ce\u06d5\u06ca]|\p{Script=Thai}|\p{Script=Lao}|\p{Script=Tamil}|\p{Script=Khmer}/u,P=()=>s.getLogger("esri.views.MapView"),$=(e,t,r)=>P().error(new i(e,t,r)),v=(e,t="")=>P().warnOnce(e,t);class j{static fromMosaic(e,t){return new j(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,r){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=r}}class k{constructor(r){this._requestRender=r,this._resourceManager=new l,this._invalidFonts=new Set,this._sdfConverter=new I(d),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new o({concurrency:10,process:async(e,r)=>{a(r);try{return await t(e,{responseType:"image",signal:r})}catch(s){if(!n(s))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,s);throw s}}}),this.animationStore=new x,this._spriteMosaic=new w(2048,2048,500),this._glyphSource=new _(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new y(1024,1024,this._glyphSource),this._rasterizer=new p(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=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}async rasterizeItem(e,t){if(null==e)return $("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:r}=i;return{rect:new M(r.column,r.row,t.length,1),page:r.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return $("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(1,t);return e}const r=await this._rasterizeSprite(i,t);return r&&this._setTextureBinding(0,r),r}getMosaicInfo(e,t,i=!1){const r=this._getTextureBindingInfo(e,t,i);return r?{size:r.size,texture:{texture:r.texture,unit:"sprite"===r.type?g:f}}:($("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0],texture:{texture:null,unit:0}})}_getTextureBindingInfo(e,t,i){const{context:r}=e,s=this._bindingInfos[t-1],a=s.page,n="Nearest"===s.samplingMode?9728:i?9987:9729;switch(s.mosaicType){case 0:{const t=[this.sprites.getWidth(a),this.sprites.getHeight(a)],i=this._spriteMosaic.getTexture(e,a);return i.setSamplingMode(n),{type:"sprite",texture:i,size:t}}case 1:{const e=[this.glyphs.width,this.glyphs.height],t=this._glyphMosaic.getTexture(r,a);return this._glyphMosaic.bind(r,n,a,f),t.setSamplingMode(n),{type:"glyph",texture:t,size:e}}default:return $("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const r=j.fromMosaic(e,t),s=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,s),this._bindingInfos.push(r)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:i,textString:s}=e,a=r(i),n=this._invalidFonts.has(a),o=!!has("esri-2d-force-complex-shaping")||!!has("esri-2d-complex-shaping")&&b.test(s),c=n?R:a;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(c);let h=await this._glyphMosaic.getGlyphItems(s,o,c,t);return h||(v(`Font ${a} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFonts.add(a),h=await this._glyphMosaic.getGlyphItems(s,o,R,t)),h}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${z(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}.${m(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geometry)}.${e.sdfTextureSize}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(S(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=h(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t=[];u.fetchResources({type:"CIMPointSymbol",symbolLayers:[e]},this._resourceManager,t),t.length>0&&await Promise.all(t)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:r,image:s,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,r,{type:"static",data:s},A(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let r;return r="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,r),r.finally(()=>this._ongoingRasterizations.delete(e)),r}async _handleSVG(e,t,i){const r=[d,d],{asFill:s}=e,a=await this._sdfConverter.draw(e.path,s,i);return this._addItemToMosaic(t,r,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}_handleGIFOrPNG(e,t,i){const r=e.url,s=this.resourceManager.getResource(r);if(null==s)return null;const{width:a,height:n}=s;if(s instanceof HTMLImageElement){if("animated"===e.type)return $("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:r,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,s,i);return this._addItemToMosaic(t,r,{type:"static",data:c},A(e),o,!1)}let o,c,h;"animated"===e.type?(o=!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},h=e.startGroup||0):(o=A(e),c={type:"CIMAnimatedSymbolProperties",playAnimation:!0},h=0);const l=new T(s,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,r){const s=e.url;if(G(s)||B(s))return this._handleGIFOrPNG(e,t,r);if("animated"===e.type)return $("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let i;const a=this.resourceManager.getResource(s);if(null!=a&&a instanceof HTMLImageElement)i=a;else{const{data:e}=await this._imageRequestQueue.push(s,{...r});i=e}if(C(s))if("width"in e&&"height"in e)i.width=c(e.width),i.height=c(e.height);else if("cim"in e){const t=e;i.width=c(t.width??t.scaleX*t.size),i.height=c(t.size)}if(!i.width||!i.height)return null;const n=i.width,o=i.height,h="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,i,h);return this._addItemToMosaic(t,l,{type:"static",data:p},A(e),u,!1)}catch($){if(!n($))throw new i("mapview-invalid-resource",`Could not fetch requested resource at ${s}. ${$.message}`);throw $}}_addItemToMosaic(e,t,i,r,s,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,r,s,a,n,o,c,h)}}function A(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return N(e);default:return!0}}const F=e=>null!=e&&e.startsWith("data:image/gif"),G=e=>e&&(e.includes(".gif")||F(e)),O=e=>null!=e&&e.startsWith("data:image/png"),B=e=>e&&(e.includes(".png")||O(e)),N=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{k as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{CIMMarkerPlacementHelper as i}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as s,getYDirection as r}from"../../../alignmentUtils.js";import{minMaxZoomPrecisionFactor as n,maxTextLineWidth as a,minTextLineWidth as l,magicLabelLineHeight as c}from"../../../definitions.js";import{shapeGlyphs as d}from"../../../mesh/templates/shapingUtils.js";import{getMinMaxZoom as h,processColorInput as f,packBitset as p}from"../fill/meshWriterUtils.js";import{MeshWriter as m}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as u,bitsetTextIsMapAligned as g}from"../shaders/constants.js";import{TextMeshTransformProps as x}from"./TextParams.js";import{DataType as y}from"../../../../../../webgl/enums.js";const S=28,_=[4,4],z=[16,4],P={topLeft:z,topRight:z,bottomLeft:z,bottomRight:z},b=[4,2],R=[4,6],T={topLeft:b,topRight:b,bottomLeft:R,bottomRight:R},
|
|
2
|
+
import{clamp as t}from"../../../../../../../core/mathUtils.js";import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{GeometryCursor as o}from"../../../../../../../geometry/GeometryCursor.js";import{CIMMarkerPlacementHelper as i}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{getXDirection as s,getYDirection as r}from"../../../alignmentUtils.js";import{minMaxZoomPrecisionFactor as n,maxTextLineWidth as a,minTextLineWidth as l,magicLabelLineHeight as c}from"../../../definitions.js";import{shapeGlyphs as d}from"../../../mesh/templates/shapingUtils.js";import{getMinMaxZoom as h,processColorInput as f,packBitset as p}from"../fill/meshWriterUtils.js";import{MeshWriter as m}from"../mesh/MeshWriter.js";import{bitsetTextIsBackground as u,bitsetTextIsMapAligned as g}from"../shaders/constants.js";import{TextMeshTransformProps as x}from"./TextParams.js";import{DataType as y}from"../../../../../../webgl/enums.js";const S=28,_=[4,4],z=[16,4],P={topLeft:z,topRight:z,bottomLeft:z,bottomRight:z},b=[4,2],R=[4,6],T={topLeft:b,topRight:b,bottomLeft:R,bottomRight:R},B={topLeft:b,topRight:R,bottomLeft:b,bottomRight:R},k={topLeft:R,topRight:R,bottomLeft:_,bottomRight:_},M={topLeft:_,topRight:_,bottomLeft:R,bottomRight:R},L={topLeft:R,topRight:_,bottomLeft:R,bottomRight:_},w={topLeft:_,topRight:R,bottomLeft:_,bottomRight:R},A={createComputedParams:t=>t,optionalAttributes:{zoomRange:{type:y.UNSIGNED_SHORT,count:2,packPrecisionFactor:n,packTessellation:({minZoom:t,maxZoom:e})=>[t||0,e||S]},clipAngle:{type:y.UNSIGNED_BYTE,count:1,packTessellation:({clipAngle:t})=>I(t||0)},referenceSymbol:{type:y.BYTE,count:4,packTessellation:(t,o)=>{const i=t.isLineLabel||!t.referenceBounds,n=s(i?"center":o.horizontalAlignment),a=r(i?"middle":o.verticalAlignment),{offsetX:l,offsetY:c,size:d}=i?{offsetX:0,offsetY:0,size:0}:t.referenceBounds;return[e(l),-e(c),Math.round(e(d)),n+1<<2|a+1]}},visibility:{type:y.FLOAT,count:1,otherSource:!0}},attributes:{pos:{type:y.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:y.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:y.UNSIGNED_BYTE,count:1,packTessellation:({isBackground:t,mapAligned:e})=>p([[u,t],[g,!!e]])},offset:{type:y.SHORT,count:2,packPrecisionFactor:8,packAlternating:{count:4,packTessellation:({offsets:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:s}=t;return[i,s,e,o]}}},textureUV:{type:y.UNSIGNED_SHORT,count:2,packAlternating:{count:4,packTessellation:({texcoords:t})=>{const{bottomLeft:e,bottomRight:o,topLeft:i,topRight:s}=t;return[i,s,e,o]}}},color:{type:y.UNSIGNED_BYTE,count:4,normalized:!0,packTessellation:({color:t})=>t},fontAndReferenceSize:{type:y.UNSIGNED_SHORT,count:4,packPrecisionFactor:4,packTessellation:({fontSize:t,sdfSize:o,sdfRadius:i},{referenceSize:s})=>[Math.round(e(t)),Math.round(e(s??t)),o,i]},outlineColor:{type:y.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:t})=>f(t)},haloColor:{type:y.UNSIGNED_BYTE,count:4,normalized:!0,pack:({haloColor:t})=>f(t)},outlineAndHaloSize:{type:y.UNSIGNED_SHORT,count:2,packPrecisionFactor:4,packTessellation:({outlineSize:t,haloSize:o})=>[Math.round(e(t)),Math.round(e(o))]}}};class v extends m{constructor(){super(...arguments),this.vertexSpec=A,this._textMeshParamsPropsInitialized=!1}ensurePacked(t,e,o){super.ensurePacked(t,e,o),this._textMeshParamsPropsInitialized&&!this._evaluator.hasDynamicProperties||(this._textMeshTransformProps=new x(this.evaluatedMeshParams),this._textMeshParamsPropsInitialized=!0)}_write(t,e,o){const i=this._getShaping();if(!i)return;const s=1===this.evaluatedMeshParams.alignment,r=e.getDisplayId();if(null!=this.evaluatedMeshParams.placement)return this._writePlacedTextMarkers(t,e,i,o);if(o?.nextPath())return o.nextPoint(),this._writeGlyphs(t,r,o.x,o.y,i,0,void 0,{mapAligned:s});if("esriGeometryPolygon"===e.geometryType){const o=e.readCentroidForDisplay();if(!o)return;const[n,a]=o.coords;return this._writeGlyphs(t,r,n,a,i,0,void 0,{mapAligned:s})}if("esriGeometryMultipoint"===e.geometryType){const o=e.readGeometryForDisplay();return void o?.forEachVertex((e,o)=>this._writeGlyphs(t,r,e,o,i,0,void 0,{mapAligned:s}))}const n=e.readXForDisplay(),a=e.readYForDisplay();return this._writeGlyphs(t,r,n,a,i,0,void 0,{mapAligned:s})}_writePlacedTextMarkers(t,s,r,n){const a=n??o.fromFeatureSetReaderCIM(s);if(!a)return;const l=-1,c=i.getPlacement(a,l,this.evaluatedMeshParams.placement,e(1),t.id);if(!c)return;const d=s.getDisplayId();let h=c.next();for(;null!=h;){const e=h.tx,o=-h.ty,i=-h.getAngle();this._writeGlyphs(t,d,e,o,r,i,void 0,{mapAligned:1===this.evaluatedMeshParams.alignment}),h=c.next()}}_getShaping(o){const i=this._textMeshTransformProps,s=this.evaluatedMeshParams;if(!s.glyphs?.glyphs.length)return null;const r=e(i.fontSize),n=e(i.offsetX),h=e(i.offsetY),f=s.glyphs.sdfSize,p=t(e(s.lineWidth),l,a),m=f/24*c*t(s.lineHeightRatio,.25,4);return d(s.glyphs,{scale:r/f,angle:i.postAngle,xOffset:n,yOffset:h,horizontalAlignment:s.horizontalAlignment,verticalAlignment:o||s.verticalAlignment,maxLineWidth:p,lineHeight:m,decoration:s.decoration,borderLineSizePx:e(s.boxBorderLineSize),hasBackground:!!s.boxBackgroundColor,useCIMAngleBehavior:s.useCIMAngleBehavior})}_writeGlyphs(t,o,i,s,r,n,a,l,c=!0){const d=this.evaluatedMeshParams,p=this._textMeshTransformProps,m=e(p.fontSize),u=p.haloSize,g=p.outlineSize,x=e(p.offsetX),y=e(p.offsetY),{sdfSize:S,sdfRadius:_}=d.glyphs,[z,P]=h(d.scaleInfo,this.getTileInfo());0!==n&&r.setRotation(n);const b=r.bounds,R=i+b.x+x,T=s+b.y-y,B=2*(d.minPixelBuffer?d.minPixelBuffer/m:1),k=Math.max(b.width,b.height)*B;r.textBox&&(t.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),c&&t.recordBounds(R,T,k,k),this._writeTextBox(t,o,i,s,r.textBox,a,l),t.recordEnd());for(const e of r.glyphs){t.recordStart(this.instanceId,this.attributeLayout,e.textureBinding),c&&t.recordBounds(R,T,k,k);const{texcoords:r,offsets:n}=e;this._writeQuad(t,o,i,s,{texcoords:r,offsets:n,fontSize:m,haloSize:u,outlineSize:g,sdfSize:S,sdfRadius:_,color:f(d.color),isBackground:!1,referenceBounds:a,minZoom:z,maxZoom:P,...l}),t.recordEnd()}0!==n&&r.setRotation(-n)}_writeTextBox(t,e,o,i,s,r,n){const a=this.evaluatedMeshParams,{fontSize:l,haloSize:c,outlineSize:d}=this._textMeshTransformProps,{boxBackgroundColor:h,boxBorderLineColor:p,boxBorderLineSize:m}=a,{sdfSize:u,sdfRadius:g}=a.glyphs,x=!!p&&m>0,y={isBackground:!0,fontSize:l,haloSize:c,outlineSize:d,referenceBounds:r,sdfSize:u,sdfRadius:g,...n};h&&(this._writeQuad(t,e,o,i,{texcoords:P,offsets:s.main,color:f(h),...y}),x||(this._writeQuad(t,e,o,i,{texcoords:k,offsets:s.top,color:f(h),...y}),this._writeQuad(t,e,o,i,{texcoords:M,offsets:s.bot,color:f(h),...y}),this._writeQuad(t,e,o,i,{texcoords:L,offsets:s.left,color:f(h),...y}),this._writeQuad(t,e,o,i,{texcoords:w,offsets:s.right,color:f(h),...y}))),x&&(this._writeQuad(t,e,o,i,{texcoords:T,offsets:s.top,color:f(p),...y}),this._writeQuad(t,e,o,i,{texcoords:T,offsets:s.bot,color:f(p),...y}),this._writeQuad(t,e,o,i,{texcoords:B,offsets:s.left,color:f(p),...y}),this._writeQuad(t,e,o,i,{texcoords:B,offsets:s.right,color:f(p),...y}))}_writeQuad(t,e,o,i,s){const r=t.vertexCount();this._writeVertex(t,e,o,i,s),t.indexWrite(r+0),t.indexWrite(r+1),t.indexWrite(r+2),t.indexWrite(r+1),t.indexWrite(r+3),t.indexWrite(r+2)}}const I=t=>Math.round(t*(254/360));export{v as TextMeshWriter,A as TextVertexSpec,S as maxLabelZoom};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{fadeDuration as e}from"../../../../vectorTiles/decluttering/config.js";import{getDefinesKey as t}from"../../../../vectorTiles/shaders/vtlMaterialUtils.js";import{vtlTextureBindingUnitSprites as i,vtlTextureBindingUnitGlyphs as a}from"../../../definitions.js";import{degToByte as l}from"../../../GeometryUtils.js";import{Technique as n}from"../Technique.js";import{VTLShaderIcon as s}from"../shaders/vector-tiles/VTLShaderIcon.js";import{VTLShaderText as o}from"../shaders/vector-tiles/VTLShaderText.js";const r=1/65536;class c extends n{constructor(){super(...arguments),this.type=39,this._iconMesh=null,this._textMesh=null,this.shaders={icon:new s,text:new o}}shutdown(){this._iconMesh&&(this._iconMesh.destroy(),this._iconMesh=null),this._textMesh&&(this._textMesh.destroy(),this._textMesh=null)}render(e,t){const{painter:i}=e,a=e.styleLayer,{tiles:l}=t,n=i.getPipelineState();this._setRenderState(e),this._drawIcons(e,a,l),this._drawText(e,a,l),i.setPipelineState(n)}_drawIcons(t,a,n){const{context:s,displayLevel:o,spriteMosaic:r,state:c,styleLayerUID:u}=t,h=a.iconMaterial;let p,g=!1;for(const e of n)if(e.layerData.has(u)&&(p=e.layerData.get(u),p.iconPerPageElementsMap.size>0)){g=!0;break}if(!g)return;const y=a.getPaintValue("icon-translate",o),d=a.getPaintValue("icon-translate-anchor",o);let f=a.getLayoutValue("icon-rotation-alignment",o);2===f&&(f=0===a.getLayoutValue("symbol-placement",o)?1:0);const m=0===f,M=a.getLayoutValue("icon-keep-upright",o)&&m,x=p.isIconSDF,P={transform:{dvsMat3:null,displayViewMat3:0===f?c.displayViewMat3:c.displayMat3,displayMat3:1===d?c.displayMat3:c.displayViewMat3,mapRotation:l(c.rotation)},config:{depth:a.z,iconTranslation:y,level:10*o,keepUpright:M?1:0,fadeDuration:e/1e3,isStencilPass:t.stencilSymbols?1:0,time:null},page:{mosaicSize:null,texture:{texture:null,unit:i}},color:null,opacity:null,haloBlur:null,haloColor:null,haloWidth:null,size:null,colorMix:null,opacityMix:null,haloBlurMix:null,haloColorMix:null,haloWidthMix:null,sizeMix:null};let D=-1;for(const e of n){if(!e.layerData.has(u))continue;if(e.key.level!==D){D=e.key.level;const t=h.getUniforms();for(const e of t){const t=e.getValue(a,o,D,r);P[e.name]={value:t}}}if(p=e.layerData.get(u),0===p.iconPerPageElementsMap.size)continue;if(this._iconMesh=p.getMesh(s,{value:0}),!this._iconMesh)continue;p.updateOpacityInfo(),P.transform.dvsMat3=e.transforms.displayViewScreenMat3,P.config.time=(performance.now()-p.lastOpacityUpdate)/1e3;let i=0;for(const[a,l]of p.iconPerPageElementsMap)this._renderIconRange(t,h,l,a,e,P,this._iconMesh,x,i++)}}_drawText(t,i,n){const{context:s,displayLevel:o,glyphMosaic:c,spriteMosaic:u,pixelRatio:h,state:p,styleLayerUID:g,requestRender:y,allowDelayedRender:d}=t,f=i.textMaterial;let m,M=!1;for(const e of n)if(e.layerData.has(g)&&(m=e.layerData.get(g),m.glyphPerPageElementsMap.size>0)){M=!0;break}if(!M)return;const x=i.getPaintProperty("text-opacity");if(x&&!x.isDataDriven&&0===x.getValue(o))return;const P=i.getPaintProperty("text-color"),D=P&&P.getValue(o),_=!P||P.isDataDriven||D&&4===D.length&&D[3]>0,v=i.getPaintProperty("text-halo-width"),w=i.getPaintProperty("text-halo-color"),V=w&&w.getValue(o),S=(!v||v.isDataDriven||v.getValue(o)>0)&&(!w||w.isDataDriven||V&&4===V.length&&V[3]>0);if(!_&&!S)return;const z=24/8;let b=i.getLayoutValue("text-rotation-alignment",o);2===b&&(b=0===i.getLayoutValue("symbol-placement",o)?1:0);const R=0===b,T=i.getLayoutValue("text-keep-upright",o)&&R,U=.8*z/h;this._glyphTextureSize||(this._glyphTextureSize=[c.width/4,c.height/4]);const k=i.getPaintValue("text-translate",o),L=i.getPaintValue("text-translate-anchor",o);if(d&&null!=y)return void y();const I={transform:{dvsMat3:null,displayViewMat3:0===b?p.displayViewMat3:p.displayMat3,displayMat3:1===L?p.displayMat3:p.displayViewMat3,mapRotation:l(p.rotation)},config:{depth:i.z+r,textTranslation:k,keepUpright:T?1:0,level:10*o,fadeDuration:e/1e3,antialiasingWidth:U,time:null,halo:null,isStencilPass:t.stencilSymbols?1:0},page:{mosaicSize:null,texture:{texture:null,unit:a}},size:null,color:null,haloColor:null,opacity:null,haloWidth:null,haloBlur:null,sizeMix:null,colorMix:null,haloColorMix:null,opacityMix:null,haloWidthMix:null,haloBlurMix:null};let C=-1;for(const e of n){if(!e.layerData.has(g))continue;if(e.key.level!==C){C=e.key.level;const t=f.getUniforms();for(const e of t){const t=e.getValue(i,o,C,u);e.name in I&&(I[e.name]={value:t})}}if(m=e.layerData.get(g),0===m.glyphPerPageElementsMap.size)continue;if(I.transform.dvsMat3=e.transforms.displayViewScreenMat3,I.config.time=(performance.now()-m.lastOpacityUpdate)/1e3,this._textMesh=m.getMesh(s,{value:1}),!this._textMesh)continue;m.updateOpacityInfo();let a=0;m.glyphPerPageElementsMap.forEach((i,l)=>{this._renderGlyphRange(t,i,l,S,_,e,I,f,this._textMesh,a++)})}}_renderIconRange(e,a,l,n,s,o,r,c,u){const{context:h,is3D:p,painter:g,spriteMosaic:y}=e,d={iconType:c?1:0},f=a.key+t(d);y.bind(h,9729,n,i),o.page={mosaicSize:[y.getWidth(n)/4,y.getHeight(n)/4],texture:{texture:y.getTexture(n),unit:i}};const m={shader:this.shaders.icon,uniforms:o,defines:d,optionalAttributes:a.getUsedAttributes(),useComputeBuffer:!1,precisionFactors:a.getPrecisionFactors(),materialKey:f};g.submitDrawMeshUntyped(h,m,r,{stencilRef:p?s.stencilRef:255,parts:[u]}),s.triangleCount+=l[1]/3}_renderGlyphRange(e,t,i,l,n,s,o,r,c,u){const{context:h,is3D:p,painter:g,glyphMosaic:y}=e;y.bind(h,9729,i,a),o.page={mosaicSize:this._glyphTextureSize,texture:{texture:y.getTexture(i),unit:a}};const d={shader:this.shaders.text,uniforms:o,defines:null,optionalAttributes:r.getUsedAttributes(),useComputeBuffer:!1,precisionFactors:r.getPrecisionFactors(),materialKey:r.key};l&&(o.config.halo=1,g.submitDrawMeshUntyped(h,d,c,{stencilRef:p?s.stencilRef:255,parts:[u]}),s.triangleCount+=t[1]/3),n&&(o.config.halo=0,g.submitDrawMeshUntyped(h,d,c,{stencilRef:p?s.stencilRef:255,parts:[u]}),s.triangleCount+=t[1]/3)}_setRenderState(e){const{is3D:t,painter:i,stencilSymbols:a}=e;i.setPipelineState({color:{write:[!a,!a,!a,!a],blendMode:a?"none":"composite"},stencil:{write:!!a&&{mask:255},test:{compare:a?519:t?514:516,op:{fail:7680,zFail:7680,zPass:7681},mask:255}},depth:{write:!1,test:515}})}}export{c as VTLTechniqueSymbol};
|
|
2
|
+
import{fadeDuration as e}from"../../../../vectorTiles/decluttering/config.js";import{getDefinesKey as t}from"../../../../vectorTiles/shaders/vtlMaterialUtils.js";import{vtlTextureBindingUnitSprites as i,vtlTextureBindingUnitGlyphs as a}from"../../../definitions.js";import{degToByte as l}from"../../../GeometryUtils.js";import{Technique as n}from"../Technique.js";import{VTLShaderIcon as s}from"../shaders/vector-tiles/VTLShaderIcon.js";import{VTLShaderText as o}from"../shaders/vector-tiles/VTLShaderText.js";const r=1/65536;class c extends n{constructor(){super(...arguments),this.type=39,this._iconMesh=null,this._textMesh=null,this.shaders={icon:new s,text:new o}}shutdown(){this._iconMesh&&(this._iconMesh.destroy(),this._iconMesh=null),this._textMesh&&(this._textMesh.destroy(),this._textMesh=null)}render(e,t){const{painter:i}=e,a=e.styleLayer,{tiles:l}=t,n=i.getPipelineState();this._setRenderState(e),this._drawIcons(e,a,l),this._drawText(e,a,l),i.setPipelineState(n)}_drawIcons(t,a,n){const{context:s,displayLevel:o,spriteMosaic:r,state:c,styleLayerUID:u}=t,h=a.iconMaterial;let p,g=!1;for(const e of n)if(e.layerData.has(u)&&(p=e.layerData.get(u),p.iconPerPageElementsMap.size>0)){g=!0;break}if(!g)return;const y=a.getPaintValue("icon-translate",o),d=a.getPaintValue("icon-translate-anchor",o);let f=a.getLayoutValue("icon-rotation-alignment",o);2===f&&(f=0===a.getLayoutValue("symbol-placement",o)?1:0);const m=0===f,M=a.getLayoutValue("icon-keep-upright",o)&&m,x=p.isIconSDF,P={transform:{dvsMat3:null,displayViewMat3:0===f?c.displayViewMat3:c.displayMat3,displayMat3:1===d?c.displayMat3:c.displayViewMat3,mapRotation:l(c.rotation)},config:{depth:a.z,iconTranslation:y,level:10*o,keepUpright:M?1:0,fadeDuration:e/1e3,isStencilPass:t.stencilSymbols?1:0,time:null},page:{mosaicSize:null,texture:{texture:null,unit:i}},color:null,opacity:null,haloBlur:null,haloColor:null,haloWidth:null,size:null,colorMix:null,opacityMix:null,haloBlurMix:null,haloColorMix:null,haloWidthMix:null,sizeMix:null};let D=-1;for(const e of n){if(!e.layerData.has(u))continue;if(e.key.level!==D){D=e.key.level;const t=h.getUniforms();for(const e of t){const t=e.getValue(a,o,D,r);P[e.name]={value:t}}}if(p=e.layerData.get(u),0===p.iconPerPageElementsMap.size)continue;if(this._iconMesh=p.getMesh(s,{value:0}),!this._iconMesh)continue;p.updateOpacityInfo(),P.transform.dvsMat3=e.transforms.displayViewScreenMat3,P.config.time=(performance.now()-p.lastOpacityUpdate)/1e3;let i=0;for(const[a,l]of p.iconPerPageElementsMap)this._renderIconRange(t,h,l,a,e,P,this._iconMesh,x,i++)}}_drawText(t,i,n){const{context:s,displayLevel:o,glyphMosaic:c,spriteMosaic:u,pixelRatio:h,state:p,styleLayerUID:g,requestRender:y,allowDelayedRender:d}=t,f=i.textMaterial;let m,M=!1;for(const e of n)if(e.layerData.has(g)&&(m=e.layerData.get(g),m.glyphPerPageElementsMap.size>0)){M=!0;break}if(!M)return;const x=i.getPaintProperty("text-opacity");if(x&&!x.isDataDriven&&0===x.getValue(o))return;const P=i.getPaintProperty("text-color"),D=P&&P.getValue(o),_=!P||P.isDataDriven||D&&4===D.length&&D[3]>0,v=i.getPaintProperty("text-halo-width"),w=i.getPaintProperty("text-halo-color"),V=w&&w.getValue(o),S=(!v||v.isDataDriven||v.getValue(o)>0)&&(!w||w.isDataDriven||V&&4===V.length&&V[3]>0);if(!_&&!S)return;const z=24/8;let b=i.getLayoutValue("text-rotation-alignment",o);2===b&&(b=0===i.getLayoutValue("symbol-placement",o)?1:0);const R=0===b,T=i.getLayoutValue("text-keep-upright",o)&&R,U=.8*z/h;this._glyphTextureSize||(this._glyphTextureSize=[c.width/4,c.height/4]);const k=i.getPaintValue("text-translate",o),L=i.getPaintValue("text-translate-anchor",o);if(d&&null!=y)return void y();const I={transform:{dvsMat3:null,displayViewMat3:0===b?p.displayViewMat3:p.displayMat3,displayMat3:1===L?p.displayMat3:p.displayViewMat3,mapRotation:l(p.rotation)},config:{depth:i.z+r,textTranslation:k,keepUpright:T?1:0,level:10*o,fadeDuration:e/1e3,antialiasingWidth:U,time:null,halo:null,isStencilPass:t.stencilSymbols?1:0},page:{mosaicSize:null,texture:{texture:null,unit:a}},size:null,color:null,haloColor:null,opacity:null,haloWidth:null,haloBlur:null,sizeMix:null,colorMix:null,haloColorMix:null,opacityMix:null,haloWidthMix:null,haloBlurMix:null};let C=-1;for(const e of n){if(!e.layerData.has(g))continue;if(e.key.level!==C){C=e.key.level;const t=f.getUniforms();for(const e of t){const t=e.getValue(i,o,C,u);e.name in I&&(I[e.name]={value:t})}}if(m=e.layerData.get(g),0===m.glyphPerPageElementsMap.size)continue;if(I.transform.dvsMat3=e.transforms.displayViewScreenMat3,I.config.time=(performance.now()-m.lastOpacityUpdate)/1e3,this._textMesh=m.getMesh(s,{value:1}),!this._textMesh)continue;m.updateOpacityInfo();let a=0;m.glyphPerPageElementsMap.forEach((i,l)=>{this._renderGlyphRange(t,i,l,S,_,e,I,f,this._textMesh,a++)})}}_renderIconRange(e,a,l,n,s,o,r,c,u){const{context:h,is3D:p,painter:g,spriteMosaic:y}=e,d={iconType:c?1:0},f=a.key+t(d);y.bind(h,9729,n,i),o.page={mosaicSize:[y.getWidth(n)/4,y.getHeight(n)/4],texture:{texture:y.getTexture(n),unit:i}};const m={shader:this.shaders.icon,uniforms:o,defines:d,optionalAttributes:a.getUsedAttributes(),useComputeBuffer:!1,precisionFactors:a.getPrecisionFactors(),materialKey:f};g.submitDrawMeshUntyped(h,m,r,{stencilRef:p?s.stencilRef:255,parts:[u]}),s.triangleCount+=l[1]/3}_renderGlyphRange(e,t,i,l,n,s,o,r,c,u){const{context:h,is3D:p,painter:g,glyphMosaic:y}=e;y.bind(h,9729,i,a),o.page={mosaicSize:this._glyphTextureSize,texture:{texture:y.getTexture(h,i),unit:a}};const d={shader:this.shaders.text,uniforms:o,defines:null,optionalAttributes:r.getUsedAttributes(),useComputeBuffer:!1,precisionFactors:r.getPrecisionFactors(),materialKey:r.key};l&&(o.config.halo=1,g.submitDrawMeshUntyped(h,d,c,{stencilRef:p?s.stencilRef:255,parts:[u]}),s.triangleCount+=t[1]/3),n&&(o.config.halo=0,g.submitDrawMeshUntyped(h,d,c,{stencilRef:p?s.stencilRef:255,parts:[u]}),s.triangleCount+=t[1]/3)}_setRenderState(e){const{is3D:t,painter:i,stencilSymbols:a}=e;i.setPipelineState({color:{write:[!a,!a,!a,!a],blendMode:a?"none":"composite"},stencil:{write:!!a&&{mask:255},test:{compare:a?519:t?514:516,op:{fail:7680,zFail:7680,zPass:7681},mask:255}},depth:{write:!1,test:515}})}}export{c as VTLTechniqueSymbol};
|