@arcgis/core 4.33.0-next.20250325 → 4.33.0-next.20250327
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/applications/Components/viewUtils.d.ts +3 -0
- package/applications/Components/viewUtils.js +5 -0
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/containerUtils.js +1 -1
- package/arcade/functions/feature.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/arcade/functions/fieldStats.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geometry.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/functions/maths.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/geometry/functions.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0f37b3a797d8a55439a4.js +1 -0
- package/assets/esri/core/workers/chunks/1dd6d68d23ba07587ae4.js +1 -0
- package/assets/esri/core/workers/chunks/{fef46b841e8369b30227.js → 2873cb727c59328074db.js} +1 -1
- package/assets/esri/core/workers/chunks/{6ff981ec0c725efe5525.js → 470cf066294b053c2732.js} +1 -1
- package/assets/esri/core/workers/chunks/705c1ebb327f680f8519.js +1 -0
- package/assets/esri/core/workers/chunks/75a04b073231da70c18d.js +1 -0
- package/assets/esri/core/workers/chunks/{f86736a60856ef7fdacb.js → 7f8c7e3e41e51ab4d612.js} +1 -1
- package/assets/esri/core/workers/chunks/80aaf31c8eec3cff2add.js +1 -0
- package/assets/esri/core/workers/chunks/82692bff98b4ec781544.js +319 -0
- package/assets/esri/core/workers/chunks/86ee278919038260696e.js +39 -0
- package/assets/esri/core/workers/chunks/{4496ef270c700078df0c.js → 8752f807c05d1ec215e8.js} +1 -1
- package/assets/esri/core/workers/chunks/9c59fc2df8081e65a128.js +1 -0
- package/assets/esri/core/workers/chunks/{e0ac90b4ad8c36fb7d70.js → b2666b89755323a84fcb.js} +1 -1
- package/assets/esri/core/workers/chunks/{e4290719c8afc2a4ee8c.js → cc441051a52bfbda9caf.js} +1 -1
- package/assets/esri/core/workers/chunks/d3912886ac2910290f43.js +1 -0
- package/assets/esri/core/workers/chunks/e08bff9f8247909776a4.js +1 -0
- package/assets/esri/core/workers/chunks/{8f4bcca8b0525e19374f.js → e9993d4f2bfdc434fbcc.js} +1 -1
- package/assets/esri/core/workers/chunks/ed831e51c2a03ee95879.js +1 -0
- package/assets/esri/core/workers/chunks/{3e9cd82325c473ddbf1f.js → edcc0fefd57323d2cb67.js} +1 -1
- package/assets/esri/core/workers/chunks/{bea2f317b73a86e2a997.js → f128d3431da86e484117.js} +100 -101
- package/assets/esri/core/workers/chunks/{065ae931b5891847a06f.js → f28eaf1d3a7f12788bcf.js} +1 -1
- package/assets/esri/core/workers/chunks/f9396af9cbfd165e72e2.js +1 -0
- package/chunks/BloomBlur.glsl.js +1 -1
- package/chunks/BloomComposition.glsl.js +2 -2
- package/chunks/ComponentShader.glsl.js +23 -24
- package/chunks/HUDMaterial.glsl.js +2 -2
- package/chunks/HighlightApply.glsl.js +1 -1
- package/chunks/HighlightDownsample.glsl.js +1 -1
- package/chunks/HighlightToSingle.glsl.js +1 -1
- package/chunks/LineMarker.glsl.js +26 -26
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/RibbonLine.glsl.js +35 -33
- package/chunks/ShadowHighlight.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +33 -33
- package/chunks/WaterSurface.glsl.js +1 -1
- package/chunks/array.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/geometry/operators/projectOperator.js +1 -1
- package/geometry/operators/shapePreservingProjectOperator.js +1 -1
- package/interfaces.d.ts +263 -24
- package/layers/LinkChartLayer.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/layers/TileLayer.js +1 -1
- package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
- package/package.json +1 -1
- package/rest/support/RasterData.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/LabelManager.js +1 -1
- package/views/2d/engine/vectorTiles/Placement.js +1 -1
- package/views/2d/engine/vectorTiles/SourceLayerData.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
- package/views/2d/engine/vectorTiles/TileManager.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileFeatureIndex.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/BaseBucket.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
- package/views/2d/engine/vectorTiles/constants.js +5 -0
- package/views/2d/engine/vectorTiles/decluttering/CollisionJob.js +5 -0
- package/views/2d/engine/vectorTiles/decluttering/SymbolDeclutterer.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/SymbolFader.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/SymbolRepository.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/core.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/jobsUtil.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/util.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleLayer.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
- package/views/2d/engine/webgl/AFeatureTile.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/FeatureTile.js +1 -1
- package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
- package/views/2d/engine/webgl/mesh/MeshData.js +1 -1
- package/views/2d/engine/webgl/mesh/MultiTileMeshData.js +1 -1
- package/views/2d/engine/webgl/mesh/meshDebugUtils.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/FeatureInstanceStore.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/GraphicInstanceStore.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/AlignedVertexSpec.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/RenderState.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/schema/processor/LabelMatcherSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/SubtypeProcessorSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
- package/views/2d/layers/support/util.js +1 -1
- package/views/2d/layers/support/vectorTileDebugUtils.js +1 -1
- package/views/2d/tiling/FeatureTileSubscriptionManager.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
- package/views/3d/layers/DrapedSubView3D.js +1 -1
- package/views/3d/layers/GraphicsView3D.js +1 -1
- package/views/3d/layers/ImageryLayerView3D.js +1 -1
- package/views/3d/layers/MapImageLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/TileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/ImageHighlightHelper3D.js +5 -0
- package/views/3d/layers/support/SublayerPopupHighlightHelper3D.js +5 -0
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/terrain/Overlay.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/RasterTile.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/HighlightCellGridScreenSpacePass.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoubleConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +9 -9
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +9 -10
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlightOverlay.js +11 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +3 -6
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/BlendLayersOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/{UintTexture2DBindUniform.js → Texture2DUintBindUniform.js} +1 -1
- package/views/3d/webgl-engine/core/shaderModules/{UintTexture2DPassUniform.js → Texture2DUintPassUniform.js} +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomBlurTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomCompositionTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/lib/WebGLLayer.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/PathTechniqueConfiguration.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/SlicePlaneMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightToSingle.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/NativeLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/PointRendererTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/VideoView.d.ts +4 -0
- package/views/VideoView.js +1 -1
- package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
- package/views/layers/support/highlightUtils.js +5 -0
- package/views/support/TextureCompressionHandle.js +5 -0
- package/views/webgl/ShaderBuilder.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/TextureDescriptor.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0e164b19e4ea3aa73843.js +0 -1
- package/assets/esri/core/workers/chunks/3fc18638f8799b85001d.js +0 -1
- package/assets/esri/core/workers/chunks/5f8028928ae8e5d27dda.js +0 -1
- package/assets/esri/core/workers/chunks/81bf362ec0d23ffdc90c.js +0 -39
- package/assets/esri/core/workers/chunks/a59ad50d932da1e28c8f.js +0 -1
- package/assets/esri/core/workers/chunks/ac6b582ca180210e596c.js +0 -1
- package/assets/esri/core/workers/chunks/accd0661a6dd297fab6b.js +0 -1
- package/assets/esri/core/workers/chunks/b5f44cf03c4e5cc07bc4.js +0 -1
- package/assets/esri/core/workers/chunks/b8416f2560710258c239.js +0 -1
- package/assets/esri/core/workers/chunks/bfbb118ae3b4a4ce1c74.js +0 -319
- package/assets/esri/core/workers/chunks/f454e773505c0eef2f9d.js +0 -1
- package/assets/esri/core/workers/chunks/fa7ddf3c89cdb8052b26.js +0 -1
- package/chunks/BloomDepthAdjust.glsl.js +0 -14
- package/views/2d/engine/vectorTiles/decluttering/jobs.js +0 -5
- package/views/2d/engine/webgl/collisions/CollisionEngine.js +0 -5
- package/views/2d/engine/webgl/collisions/CollisionGrid.js +0 -5
- package/views/3d/webgl-engine/core/shaderModules/TextureCubeBindUniform.js +0 -5
- package/views/3d/webgl-engine/core/shaderModules/UintTexture2DDrawUniform.js +0 -5
- package/views/3d/webgl-engine/effects/bloom/BloomDepthAdjust.glsl.js +0 -5
- package/views/3d/webgl-engine/effects/bloom/BloomDepthAdjustTechnique.js +0 -5
package/layers/MapImageLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Error.js";import{loadAll as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Error.js";import{loadAll as o}from"../core/loadAll.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as s,isAbortError as a}from"../core/promiseUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{Integer as n}from"../core/accessorSupport/ensureType.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as m}from"../core/accessorSupport/decorators/reader.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{writer as c}from"../core/accessorSupport/decorators/writer.js";import{nameToId as u,OriginId as y}from"../core/accessorSupport/PropertyOrigin.js";import h from"../geometry/Extent.js";import{getScale as d}from"../geometry/support/scaleUtils.js";import{srToRESTValue as f}from"../geometry/support/spatialReferenceUtils.js";import g from"./Layer.js";import{APIKeyMixin as b}from"./mixins/APIKeyMixin.js";import{ArcGISMapService as v}from"./mixins/ArcGISMapService.js";import{ArcGISService as x}from"./mixins/ArcGISService.js";import{BlendLayer as j}from"./mixins/BlendLayer.js";import{CustomParametersMixin as S}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as I}from"./mixins/OperationalLayer.js";import{PortalLayer as w}from"./mixins/PortalLayer.js";import{RefreshableLayer as O}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{SublayersOwner as P}from"./mixins/SublayersOwner.js";import{TemporalLayer as T}from"./mixins/TemporalLayer.js";import{url as E}from"./support/commonProperties.js";import{ExportImageParameters as M}from"./support/ExportImageParameters.js";import{createBitmap as R}from"./support/imageBitmapUtils.js";import U from"./support/Sublayer.js";import{shouldWriteSublayerStructure as F}from"./support/sublayerUtils.js";import{serviceSupportsSpatialReference as _}from"./support/versionUtils.js";import A from"../symbols/support/ElevationInfo.js";import N from"../time/TimeExtent.js";import{timeZoneProperty as J}from"../time/timeZoneUtils.js";let q=class extends(j(T(L(P(v(x(I(w(i(O(b(S(g))))))))))))){constructor(...e){super(...e),this._exportImageParameters=new M({layer:this}),this.dateFieldsTimeZone=null,this.datesInUnknownTimezone=!1,this.dpi=96,this.elevationInfo=new A({mode:"on-the-ground"}),this.gdbVersion=null,this.imageFormat="png24",this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.isReference=null,this.labelsVisible=!1,this.operationalLayerType="ArcGISMapServiceLayer",this.preferredTimeZone=null,this.sourceJSON=null,this.sublayers=null,this.type="map-image",this.url=null}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service"]},e).catch(s).then((()=>this._fetchService(r)))),Promise.resolve(this)}destroy(){this._exportImageParameters.destroy()}readImageFormat(e,r){const t=r.supportedImageFormatTypes;return t&&t.includes("PNG32")?"png32":"png24"}writeSublayers(e,r,t,o){if(!this.loaded||!e)return;const i=e.slice().reverse().flatten((({sublayers:e})=>e&&e.toArray().reverse())).toArray();let s=!1;const a=u(o.origin);if(this.capabilities?.operations.supportsExportMap&&this.capabilities?.exportMap?.supportsDynamicLayers)if(a===y.PORTAL_ITEM){const e=this.createSublayersForOrigin("service").sublayers;s=F(i,e,y.SERVICE)}else if(a>y.PORTAL_ITEM){const e=this.createSublayersForOrigin("portal-item");s=F(i,e.sublayers,u(e.origin))}const p=[],n={writeSublayerStructure:s,...o};let m=s||this.hasVisibleLayersForOrigin(a);i.forEach((e=>{const r=e.write({},n);p.push(r),m=m||"user"===e.originOf("visible")}));p.some((e=>Object.keys(e).length>1))&&(r.layers=p),m&&(r.visibleLayers=i.filter((e=>e.visible)).map((e=>e.id)))}createExportImageParameters(e,r,t,o){const i=o?.pixelRatio||1;e&&this.version>=10&&(e=e.clone().shiftCentralMeridian()),this._exportImageParameters.floors=o?.floors??null,this._exportImageParameters.scale=d({extent:e,width:r})*i;const s=this._exportImageParameters.toJSON(),a=!o?.rotation||this.version<10.3?{}:{rotation:-o.rotation},p=e?.spatialReference,n=f(p);s.dpi*=i;const m={};if(o?.timeExtent){const{start:e,end:r}=o.timeExtent.toJSON();m.time=e&&r&&e===r?""+e:`${e??"null"},${r??"null"}`}else this.timeInfo&&!this.timeInfo.hasLiveData&&(m.time="null,null");return{bbox:e?e.xmin+","+e.ymin+","+e.xmax+","+e.ymax:void 0,bboxSR:n,imageSR:n,size:r+","+t,...s,...a,...m}}async fetchImage(e,r,t,o){const{data:i}=await this._fetchImage("image",e,r,t,o);return i}async fetchImageBitmap(e,r,t,o){const{data:i,url:s}=await this._fetchImage("blob",e,r,t,o);return R(i,s,o?.signal)}async fetchRecomputedExtents(e={}){const t={...e,query:{returnUpdates:!0,f:"json",...this.customParameters,token:this.apiKey}},{data:o}=await r(this.url,t),{extent:i,fullExtent:s,timeExtent:a}=o,p=i||s;return{fullExtent:p&&h.fromJSON(p),timeExtent:a&&N.fromJSON({start:a[0],end:a[1]})}}loadAll(){return o(this,(e=>{e(this.allSublayers),e(this.subtables)}))}serviceSupportsSpatialReference(e){return _(this,e)}async _fetchImage(e,o,i,s,p){const n={responseType:e,signal:p?.signal??null,query:{...this.parsedUrl.query,...this.createExportImageParameters(o,i,s,p),f:"image",...this.refreshParameters,...this.customParameters,token:this.apiKey}},m=this.parsedUrl.path+"/export";if(null!=n.query?.dynamicLayers&&!this.capabilities?.exportMap?.supportsDynamicLayers)throw new t("mapimagelayer:dynamiclayer-not-supported",`service ${this.url} doesn't support dynamic layers, which is required to be able to change the sublayer's order, rendering, labeling or source.`,{query:n.query});try{const{data:e}=await r(m,n);return{data:e,url:m}}catch(l){if(a(l))throw l;throw new t("mapimagelayer:image-fetch-error",`Unable to load image: ${m}`,{error:l})}}async _fetchService(e){if(this.sourceJSON)return void this.read(this.sourceJSON,{origin:"service",url:this.parsedUrl});const{data:t,ssl:o}=await r(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},signal:e});o&&(this.url=this.url.replace(/^http:/i,"https:")),this.sourceJSON=t,this.read(t,{origin:"service",url:this.parsedUrl})}hasVisibleLayersForOrigin(e){return!(null==e||!this.sublayersSourceJSON[e]?.visibleLayers)}};e([p(J("dateFieldsTimeReference"))],q.prototype,"dateFieldsTimeZone",void 0),e([p({type:Boolean})],q.prototype,"datesInUnknownTimezone",void 0),e([p()],q.prototype,"dpi",void 0),e([p()],q.prototype,"elevationInfo",void 0),e([p()],q.prototype,"gdbVersion",void 0),e([p()],q.prototype,"imageFormat",void 0),e([m("imageFormat",["supportedImageFormatTypes"])],q.prototype,"readImageFormat",null),e([p({json:{origins:{service:{read:{source:"maxImageHeight"}}}}})],q.prototype,"imageMaxHeight",void 0),e([p({json:{origins:{service:{read:{source:"maxImageWidth"}}}}})],q.prototype,"imageMaxWidth",void 0),e([p()],q.prototype,"imageTransparency",void 0),e([p({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],q.prototype,"isReference",void 0),e([p({json:{read:!1,write:!1}})],q.prototype,"labelsVisible",void 0),e([p({type:["ArcGISMapServiceLayer"]})],q.prototype,"operationalLayerType",void 0),e([p({json:{read:!1,write:!1}})],q.prototype,"popupEnabled",void 0),e([p(J("preferredTimeReference"))],q.prototype,"preferredTimeZone",void 0),e([p()],q.prototype,"sourceJSON",void 0),e([p({json:{write:{ignoreOrigin:!0}}})],q.prototype,"sublayers",void 0),e([c("sublayers",{layers:{type:[U]},visibleLayers:{type:[n]}})],q.prototype,"writeSublayers",null),e([p({type:["show","hide","hide-children"]})],q.prototype,"listMode",void 0),e([p({json:{read:!1},readOnly:!0,value:"map-image"})],q.prototype,"type",void 0),e([p(E)],q.prototype,"url",void 0),q=e([l("esri.layers.MapImageLayer")],q);const k=q;export{k as default};
|
package/layers/TileLayer.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Error.js";import{loadAll as s}from"../core/loadAll.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{urlToObject as a,objectToQuery as l,makeAbsolute as n}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{cast as c}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as u}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import d from"../geometry/SpatialReference.js";import y from"./Layer.js";import{APIKeyMixin as f}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as v}from"./mixins/ArcGISCachedService.js";import{ArcGISMapService as g}from"./mixins/ArcGISMapService.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import r from"../request.js";import t from"../core/Error.js";import{loadAll as s}from"../core/loadAll.js";import{MultiOriginJSONMixin as i}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as o}from"../core/promiseUtils.js";import{urlToObject as a,objectToQuery as l,makeAbsolute as n}from"../core/urlUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{cast as c}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{reader as u}from"../core/accessorSupport/decorators/reader.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import{writer as h}from"../core/accessorSupport/decorators/writer.js";import d from"../geometry/SpatialReference.js";import y from"./Layer.js";import{APIKeyMixin as f}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as v}from"./mixins/ArcGISCachedService.js";import{ArcGISMapService as g}from"./mixins/ArcGISMapService.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as _}from"./mixins/BlendLayer.js";import{CustomParametersMixin as j}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as b}from"./mixins/OperationalLayer.js";import{PortalLayer as T}from"./mixins/PortalLayer.js";import{RefreshableLayer as w}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as O}from"./mixins/ScaleRangeLayer.js";import{SublayersOwner as L}from"./mixins/SublayersOwner.js";import{parse as R,isHostedAgolService as U,isArcGISUrl as P}from"./support/arcgisLayerUrl.js";import{url as x}from"./support/commonProperties.js";import{createTileBitmap as A}from"./support/imageBitmapUtils.js";import I from"./support/Sublayer.js";import M from"../symbols/support/ElevationInfo.js";var W;const B=["Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Elevation/World_Hillshade","Elevation/World_Hillshade_Dark","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Ocean_Basemap","Reference/World_Boundaries_and_Places","Reference/World_Boundaries_and_Places_Alternate","Reference/World_Transportation","World_Imagery","World_Street_Map","World_Topo_Map"];let C=W=class extends(_(O(L(v(g(b(T(S(i(w(f(j(y))))))))))))){constructor(...e){super(...e),this.listMode="show",this.elevationInfo=new M({mode:"on-the-ground"}),this.isReference=null,this.operationalLayerType="ArcGISTiledMapServiceLayer",this.resampling=!0,this.sourceJSON=null,this.spatialReference=null,this.path=null,this.sublayers=null,this.type="tile",this.url=null}normalizeCtorArgs(e,r){return"string"==typeof e?{url:e,...r}:e}load(e){const r=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["Map Service"]},e).catch(o).then((()=>this._fetchService(r)))),Promise.resolve(this)}get attributionDataUrl(){const e=this.parsedUrl?.path.toLowerCase();return e?this._getDefaultAttribution(this._getMapName(e)):null}readSpatialReference(e,r){return(e=e||r.tileInfo?.spatialReference)&&d.fromJSON(e)}writeSublayers(e,r,t,s){if(!this.loaded||!e)return;const i=e.slice().reverse().flatten((({sublayers:e})=>e&&e.toArray().reverse())).toArray(),o=[],a={writeSublayerStructure:!1,...s};i.forEach((e=>{const r=e.write({},a);o.push(r)}));o.some((e=>Object.keys(e).length>1))&&(r.layers=o)}get tileServers(){return this._getDefaultTileServers(this.parsedUrl?.path)}castTileServers(e){return Array.isArray(e)?e.map((e=>a(e).path)):null}fetchTile(e,t,s,i={}){const{signal:o}=i,a=this.getTileUrl(e,t,s),l={responseType:"image",signal:o,query:{...this.refreshParameters}};return r(a,l).then((e=>e.data))}async fetchImageBitmapTile(e,t,s,i={}){const{signal:o}=i;if(this.fetchTile!==W.prototype.fetchTile){const r=await this.fetchTile(e,t,s,i);return A(r,e,t,s,o)}const a=this.getTileUrl(e,t,s),l={responseType:"blob",signal:o,query:{...this.refreshParameters}},{data:n}=await r(a,l);return A(n,e,t,s,o)}getTileUrl(e,r,t){const s=!this.capabilities.operations.supportsTileMap&&this.supportsBlankTile,i=l({...this.parsedUrl?.query,blankTile:!s&&null,...this.customParameters,token:this.apiKey}),o=this.tileServers;return`${o&&o.length?o[r%o.length]:this.parsedUrl?.path}/tile/${e}/${r}/${t}${i?"?"+i:""}`}loadAll(){return s(this,(e=>{e(this.allSublayers)}))}_fetchService(e){return new Promise(((s,i)=>{if(this.sourceJSON){if(null!=this.sourceJSON.bandCount&&null!=this.sourceJSON.pixelSizeX)throw new t("tile-layer:unsupported-url","use ImageryTileLayer to open a tiled image service");return void s({data:this.sourceJSON})}if(!this.parsedUrl)throw new t("tile-layer:undefined-url","layer's url is not defined");const o=R(this.parsedUrl.path);if(null!=o&&"ImageServer"===o.serverType)throw new t("tile-layer:unsupported-url","use ImageryTileLayer to open a tiled image service");r(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then(s,i)})).then((r=>{let t=this.url;if(r.ssl&&(t=this.url=t.replace(/^http:/i,"https:")),this.sourceJSON=r.data,this.read(r.data,{origin:"service",url:this.parsedUrl}),10.1===this.version&&!U(t))return this._fetchServerVersion(t,e).then((e=>{this.read({currentVersion:e})})).catch((()=>{}))}))}_fetchServerVersion(e,s){if(!P(e))return Promise.reject();const i=e.replace(/(.*\/rest)\/.*/i,"$1")+"/info";return r(i,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:s}).then((e=>{if(e.data&&e.data.currentVersion)return e.data.currentVersion;throw new t("tile-layer:version-not-available")}))}_getMapName(e){const r=e.match(/^(?:https?:)?\/\/(server\.arcgisonline\.com|services\.arcgisonline\.com|ibasemaps-api\.arcgis\.com)\/arcgis\/rest\/services\/([^/]+(\/[^/]+)*)\/mapserver/i);return r?r[2]:void 0}_getDefaultAttribution(e){if(null==e)return null;let r;e=e.toLowerCase();for(let t=0,s=B.length;t<s;t++)if(r=B[t],r.toLowerCase().includes(e))return n("//static.arcgis.com/attribution/"+r);return null}_getDefaultTileServers(e){if(null==e)return[];const r=-1!==e.search(/^(?:https?:)?\/\/server\.arcgisonline\.com/i),t=-1!==e.search(/^(?:https?:)?\/\/services\.arcgisonline\.com/i);return r||t?[e,e.replace(r?/server\.arcgisonline/i:/services\.arcgisonline/i,r?"services.arcgisonline":"server.arcgisonline")]:[]}get hasOverriddenFetchTile(){return!this.fetchTile[N]}};e([p({readOnly:!0})],C.prototype,"attributionDataUrl",null),e([p({type:["show","hide","hide-children"]})],C.prototype,"listMode",void 0),e([p({json:{read:!0,write:!0}})],C.prototype,"blendMode",void 0),e([p()],C.prototype,"elevationInfo",void 0),e([p({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],C.prototype,"isReference",void 0),e([p({readOnly:!0,type:["ArcGISTiledMapServiceLayer"]})],C.prototype,"operationalLayerType",void 0),e([p({type:Boolean})],C.prototype,"resampling",void 0),e([p()],C.prototype,"sourceJSON",void 0),e([p({type:d})],C.prototype,"spatialReference",void 0),e([u("spatialReference",["spatialReference","tileInfo"])],C.prototype,"readSpatialReference",null),e([p({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],C.prototype,"path",void 0),e([p({readOnly:!0})],C.prototype,"sublayers",void 0),e([h("sublayers",{layers:{type:[I]}})],C.prototype,"writeSublayers",null),e([p({json:{read:!1,write:!1}})],C.prototype,"popupEnabled",void 0),e([p()],C.prototype,"tileServers",null),e([c("tileServers")],C.prototype,"castTileServers",null),e([p({readOnly:!0,json:{read:!1}})],C.prototype,"type",void 0),e([p(x)],C.prototype,"url",void 0),C=W=e([m("esri.layers.TileLayer")],C);const N=Symbol("default-fetch-tile");C.prototype.fetchTile[N]=!0;const k=C;export{k as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../PopupTemplate.js";import o from"../../request.js";import s from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import a from"../../core/Loadable.js";import n from"../../core/Logger.js";import p from"../../core/Promise.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../PopupTemplate.js";import o from"../../request.js";import s from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import a from"../../core/Loadable.js";import n from"../../core/Logger.js";import p from"../../core/Promise.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as u}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as y}from"../../core/accessorSupport/decorators/reader.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import c from"../../geometry/Extent.js";import m from"../../geometry/SpatialReference.js";import h from"../FeatureLayer.js";import f from"./BuildingSublayer.js";import{zeroCapabilities as g}from"../support/capabilities.js";import{popupEnabled as j}from"../support/commonProperties.js";import{getFieldDomain as v}from"../support/featureLayerUtils.js";import{defineFieldProperties as L}from"../support/fieldProperties.js";import b from"../support/FieldsIndex.js";import{unpackFieldNames as I}from"../support/fieldUtils.js";import{fetchIndexInfo as S}from"../support/I3SIndexInfo.js";import{I3SNodePageDefinition as F,I3SMaterialDefinition as w,I3STextureSetDefinition as O,I3SGeometryDefinition as x}from"../support/I3SLayerDefinitions.js";import{webSceneRendererTypes as P}from"../../renderers/support/typeUtils.js";import q from"../../rest/support/Query.js";import{isNumber as T}from"../../support/guards.js";import{createPopupTemplate as Q}from"../../support/popupUtils.js";import U from"../../symbols/support/ElevationInfo.js";import{queryAttributesFromCachedAttributesId as E}from"../../views/3d/layers/i3s/I3SUtil.js";import{getRequiredFields as D,getFetchPopupTemplate as R}from"../../views/layers/support/popupUtils.js";const A=L();let _=class extends(a.LoadableMixin(p.EsriPromiseMixin(f))){constructor(e){super(e),this.type="building-component",this.nodePages=null,this.materialDefinitions=[],this.textureSetDefinitions=[],this.geometryDefinitions=[],this.indexInfo=null,this.serviceUpdateTimeStamp=null,this.store=null,this.attributeStorageInfo=[],this.fields=[],this.associatedLayer=null,this.outFields=null,this.listMode="show",this.renderer=null,this.definitionExpression=null,this.popupEnabled=!0,this.popupTemplate=null,this.layerType="3d-object"}get parsedUrl(){return this.layer?{path:`${this.layer.parsedUrl?.path}/sublayers/${this.id}`,query:this.layer.parsedUrl?.query}:{path:""}}get fieldsIndex(){return new b(this.fields)}readAssociatedLayer(e,t){const r=this.layer.associatedFeatureServiceItem,o=t.associatedLayerID;return null!=r&&"number"==typeof o?new h({portalItem:r,customParameters:this.customParameters,layerId:o}):null}get objectIdField(){if(null!=this.fields)for(const e of this.fields)if("oid"===e.type)return e.name;return null}get displayField(){return null!=this.associatedLayer?this.associatedLayer.displayField:void 0}get apiKey(){return this.layer.apiKey}get customParameters(){return this.layer.customParameters}get fullExtent(){return this.layer.fullExtent}get spatialReference(){return this.layer.spatialReference}get version(){return this.layer.version}get elevationInfo(){return this.layer.elevationInfo}get minScale(){return this.layer.minScale}get maxScale(){return this.layer.maxScale}get effectiveScaleRange(){return this.layer.effectiveScaleRange}get defaultPopupTemplate(){return this.createPopupTemplate()}load(e){const t=null!=e?e.signal:null,r=this._fetchService(t).then((()=>{this.indexInfo=S(this.parsedUrl.path,this.rootNode,this.nodePages,this.customParameters,this.apiKey,n.getLogger(this),t)}));return this.addResolvingPromise(r),Promise.resolve(this)}createPopupTemplate(e){return Q(this,e)}async _fetchService(e){const t=(await o(this.parsedUrl.path,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e})).data;this.read(t,{origin:"service",url:this.parsedUrl})}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){const r=this.getField(e)?.domain??null;return this.associatedLayer?v(this.associatedLayer,e,t,r):r}getFeatureType(e){return e&&null!=this.associatedLayer?this.associatedLayer.getFeatureType(e):null}get types(){return null!=this.associatedLayer?this.associatedLayer.types??[]:[]}get typeIdField(){return null!=this.associatedLayer?this.associatedLayer.typeIdField:null}get geometryType(){return"3d-object"===this.layerType?"mesh":"point"}get profile(){return"3d-object"===this.layerType?"mesh-pyramids":"points"}get capabilities(){const e=null!=this.associatedLayer&&this.associatedLayer.capabilities?this.associatedLayer.capabilities:g,{query:t,operations:{supportsQuery:r},data:{supportsZ:o,supportsM:s,isVersioned:i}}=e;return{query:t,operations:{supportsQuery:r},data:{supportsZ:o,supportsM:s,isVersioned:i}}}createQuery(){const e=new q;return"mesh"!==this.geometryType&&(e.returnGeometry=!0,e.returnZ=!0),e.where=this.definitionExpression||"1=1",e.sqlFormat="standard",e}queryExtent(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryExtent(e||this.createQuery(),t)))}queryFeatureCount(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatureCount(e||this.createQuery(),t)))}queryFeatures(e,t){return this._getAssociatedLayerForQuery().then((r=>r.queryFeatures(e||this.createQuery(),t))).then((e=>{if(e?.features)for(const t of e.features)t.layer=this.layer,t.sourceLayer=this;return e}))}async queryObjectIds(e,t){const r=await this._getAssociatedLayerForQuery();return(await r.queryObjectIds(e||this.createQuery(),t)).filter(T)}async queryCachedAttributes(e,t){const r=I(this.fieldsIndex,await D(this,R(this)));return E(this.parsedUrl.path,this.attributeStorageInfo,e,t,r,this.apiKey,this.customParameters)}async queryCachedFeature(e,r){const o=await this.queryCachedAttributes(e,[r]);if(!o||0===o.length)throw new s("scenelayer:feature-not-in-cached-data","Feature not found in cached data");return new t({attributes:o[0],layer:this,sourceLayer:this})}getFieldUsageInfo(e){return this.fieldsIndex.has(e)?{supportsLabelingInfo:!1,supportsRenderer:!1,supportsPopupTemplate:!1,supportsLayerQuery:!1}:{supportsLabelingInfo:!1,supportsRenderer:!0,supportsPopupTemplate:!0,supportsLayerQuery:null!=this.associatedLayer}}_getAssociatedLayerForQuery(){const e=this.associatedLayer;return null!=e&&e.loaded?Promise.resolve(e):this._loadAssociatedLayerForQuery()}async _loadAssociatedLayerForQuery(){if(await this.load(),null==this.associatedLayer)throw new s("buildingscenelayer:query-not-available","BuildingSceneLayer component layer queries are not available without an associated feature layer",{layer:this});try{await this.associatedLayer.load()}catch(e){throw new s("buildingscenelayer:query-not-available","BuildingSceneLayer associated feature layer could not be loaded",{layer:this,error:e})}return this.associatedLayer}};e([l({readOnly:!0})],_.prototype,"parsedUrl",null),e([l({type:F,readOnly:!0})],_.prototype,"nodePages",void 0),e([l({type:[w],readOnly:!0})],_.prototype,"materialDefinitions",void 0),e([l({type:[O],readOnly:!0})],_.prototype,"textureSetDefinitions",void 0),e([l({type:[x],readOnly:!0})],_.prototype,"geometryDefinitions",void 0),e([l({readOnly:!0})],_.prototype,"serviceUpdateTimeStamp",void 0),e([l({readOnly:!0})],_.prototype,"store",void 0),e([l({type:String,readOnly:!0,json:{read:{source:"store.rootNode"}}})],_.prototype,"rootNode",void 0),e([l({readOnly:!0})],_.prototype,"attributeStorageInfo",void 0),e([l(A.fields)],_.prototype,"fields",void 0),e([l({readOnly:!0})],_.prototype,"fieldsIndex",null),e([l({readOnly:!0,type:h})],_.prototype,"associatedLayer",void 0),e([y("service","associatedLayer",["associatedLayerID"])],_.prototype,"readAssociatedLayer",null),e([l(A.outFields)],_.prototype,"outFields",void 0),e([l({type:String,readOnly:!0})],_.prototype,"objectIdField",null),e([l({readOnly:!0,type:String,json:{read:!1}})],_.prototype,"displayField",null),e([l({readOnly:!0,type:String})],_.prototype,"apiKey",null),e([l({readOnly:!0,type:String})],_.prototype,"customParameters",null),e([l({readOnly:!0,type:c})],_.prototype,"fullExtent",null),e([l({readOnly:!0,type:m})],_.prototype,"spatialReference",null),e([l({readOnly:!0})],_.prototype,"version",null),e([l({readOnly:!0,type:U})],_.prototype,"elevationInfo",null),e([l({readOnly:!0,type:Number})],_.prototype,"minScale",null),e([l({readOnly:!0,type:Number})],_.prototype,"maxScale",null),e([l({readOnly:!0,type:Number})],_.prototype,"effectiveScaleRange",null),e([l({type:["hide","show"],json:{write:!0}})],_.prototype,"listMode",void 0),e([l({types:P,json:{origins:{service:{read:{source:"drawingInfo.renderer"}}},name:"layerDefinition.drawingInfo.renderer",write:!0},value:null})],_.prototype,"renderer",void 0),e([l({type:String,json:{origins:{service:{read:!1,write:!1}},name:"layerDefinition.definitionExpression",write:{enabled:!0,allowNull:!0}}})],_.prototype,"definitionExpression",void 0),e([l(j)],_.prototype,"popupEnabled",void 0),e([l({type:r,json:{read:{source:"popupInfo"},write:{target:"popupInfo"}}})],_.prototype,"popupTemplate",void 0),e([l({readOnly:!0,type:String,json:{origins:{service:{read:{source:"store.normalReferenceFrame"}}},read:!1}})],_.prototype,"normalReferenceFrame",void 0),e([l({readOnly:!0,json:{read:!1}})],_.prototype,"defaultPopupTemplate",null),e([l()],_.prototype,"types",null),e([l()],_.prototype,"typeIdField",null),e([l({json:{write:!1}}),u(new i({"3DObject":"3d-object",Point:"point"}))],_.prototype,"layerType",void 0),e([l()],_.prototype,"geometryType",null),e([l()],_.prototype,"profile",null),e([l({readOnly:!0,json:{read:!1}})],_.prototype,"capabilities",null),e([l({readOnly:!0})],_.prototype,"statisticsInfo",void 0),_=e([d("esri.layers.buildingSublayers.BuildingComponentSublayer")],_);const C=_;export{C as default};
|
package/package.json
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as r}from"../../chunks/tslib.es6.js";import o from"../../core/JSONSupport.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";let
|
|
5
|
+
import{_ as r}from"../../chunks/tslib.es6.js";import o from"../../core/JSONSupport.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as e}from"../../core/accessorSupport/decorators/reader.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";let p=class extends o{constructor(r){super(r),this.format=null,this.itemId=null,this.type=null,this.url=null}readType(r){return"ImageService"===r?"image-service":null}};r([t()],p.prototype,"format",void 0),r([t({json:{name:"itemID",write:!0}})],p.prototype,"itemId",void 0),r([t()],p.prototype,"type",void 0),r([e("type")],p.prototype,"readType",null),r([t({json:{write:!0}})],p.prototype,"url",void 0),p=r([s("esri.rest.support.RasterData")],p);const i=p;export{i as default};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const e="20250327",a="ee1832af1c00a261a8cf1069f1a99e043239e6d4";export{e as buildDate,a as commitHash};
|
package/views/2d/LabelManager.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import"../../core/
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import has from"../../core/has.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{SymbolFader as o}from"./engine/vectorTiles/decluttering/SymbolFader.js";import{RotationAlignment as a,TranslateAnchor as i}from"./engine/vectorTiles/style/StyleDefinition.js";import{tileSize as l}from"./engine/webgl/definitions.js";const n=7e6;class c{constructor(){this.styles=new Map,this.layerContexts=new Map}get cachedStyles(){return this.styles}setLabelClassStyle(e,t,s){this.layerContexts.set(e,t),this.styles.set(e,s)}}let p=class extends t{constructor(e){super(e),this._faderWorkingSet=[],this._styleRepository=new c,this.lastUpdateId=-1,this.updateRequested=!1,this.view=null;const t=(e,t)=>{e.writeLabelVisibility(),e.requestRender(),e.isReady&&(e.decluttered=!0)};this.symbolFader=new o("feature-tile",this._styleRepository,t,this._faderWorkingSet,l,n)}get updating(){return has("esri-2d-log-updating")&&console.log(`Updating LabelManager ${this.updateRequested}:\n-> updateRequested: ${this.updateRequested}`),this.updateRequested}viewChange(){this.requestUpdate()}requestUpdate(){this.updateRequested||(this.updateRequested=!0,this.view?.requestUpdate())}processUpdate(e){this.doUpdate(e)?this.updateRequested=!1:(this.updateRequested=!0,this.view?.requestUpdate())}setLabelSchemaStyles(e,t){let s;switch(e.type){case"label":s=e.classes;break;case"subtype":s=Array.from(Object.values(e.renderers).flatMap((e=>e.classes)));break;case"cluster":s=[...e.cluster.classes,...e.feature.classes];break;case"track":s=[...e.latestObservation.classes,...e.previousObservation.classes,...e.trackLine.classes]}for(const r of s){const e=d(r);this._styleRepository.setLabelClassStyle(r.labelClassId,t,e)}}doUpdate(e){const t=this.view;if(!t)return!1;const s=t.allLayerViews.map((e=>e.labelingCollisionInfos)).filter((e=>!!e)).toArray().flat().filter((e=>!!e?.labelingInfo)).map((e=>e.container));if(s.length>0){this._faderWorkingSet.length=0;for(const t of s)for(const s of t.tiles||[])s.setTransform(e.state),this._faderWorkingSet.push(s);const r=e.state.scale,o=t.featuresTilingScheme.scaleToZoom(r);return this.symbolFader.update(o,e.state)}return!0}};function d(e){const t="esriGeometryPolyline"===e.geometryType?a.MAP:a.VIEWPORT,s="esriGeometryPolyline"===e.geometryType?i.MAP:i.VIEWPORT;return{geometryType:e.geometryType,iconAllowOverlap:!e.deconflictionEnabled,iconIgnorePlacement:!1,textAllowOverlap:!e.deconflictionEnabled,textIgnorePlacement:!1,iconRotationAlignment:t,textRotationAlignment:t,iconTranslateAnchor:s,iconTranslate:[0,0],textTranslateAnchor:s,textTranslate:[0,0]}}e([s()],p.prototype,"updateRequested",void 0),e([s()],p.prototype,"updating",null),e([s()],p.prototype,"view",void 0),p=e([r("esri.views.2d.LabelManager")],p);export{c as LabelClassStyleRepository,p as LabelManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{Point as e}from"../../../../geometry/support/TileClipper.js";import{cDegToRad as
|
|
5
|
+
import{Point as e}from"../../../../geometry/support/TileClipper.js";import{tilePixelRatio as t}from"./constants.js";import{cDegToRad as i,cPi as n,cInfinity as s,radToByte as o,positiveMod as a,c2pi as l}from"./GeometryUtils.js";import{sdfGlyphSize as h,TextShaping as r,sdfGlyphBaseline as c}from"./TextShaping.js";import{declutterTiles as g}from"./decluttering/config.js";import{RotationAlignment as m,SymbolAnchor as x}from"./style/StyleDefinition.js";const d=.5,p=2;class w{constructor(e,t,i=0,n=-1,s=d){this.x=e,this.y=t,this.angle=i,this.segment=n,this.minzoom=s}}class T{constructor(e,t,i,n,o,a=d,l=s){this.anchor=e,this.labelAngle=t,this.glyphAngle=i,this.page=n,this.alternateVerticalGlyph=o,this.minzoom=a,this.maxzoom=l}}class y{constructor(e,t,i,n,s,o,a,l,h,r,c,g){this.tl=e,this.tr=t,this.bl=i,this.br=n,this.mosaicRect=s,this.labelAngle=o,this.minAngle=a,this.maxAngle=l,this.anchor=h,this.minzoom=r,this.maxzoom=c,this.page=g}}class f{constructor(e){this.shapes=e}}class I{getIconPlacement(t,s,o){const a=new e(t.x,t.y),l=o.rotationAlignment===m.MAP,h=o.keepUpright;let r=o.rotate*i;l&&(r+=t.angle);const c=new f([]);return o.allowOverlap&&o.ignorePlacement||!g||(c.iconColliders=[]),this._addIconPlacement(c,a,s,o,r),l&&h&&this._addIconPlacement(c,a,s,o,r+n),c}_addIconPlacement(t,i,n,o,a){const l=n.rasterizationScale,h=n.width/l,r=n.height/l,c=o.offset;let m=c[0],p=c[1];switch(o.anchor){case x.CENTER:m-=h/2,p-=r/2;break;case x.LEFT:p-=r/2;break;case x.RIGHT:m-=h,p-=r/2;break;case x.TOP:m-=h/2;break;case x.BOTTOM:m-=h/2,p-=r;break;case x.TOP_LEFT:break;case x.BOTTOM_LEFT:p-=r;break;case x.TOP_RIGHT:m-=h;break;case x.BOTTOM_RIGHT:m-=h,p-=r}const w=n.rect,T=2/l,f=m-T,I=p-T,u=f+w.width/l,b=I+w.height/l,P=new e(f,I),O=new e(u,b),_=new e(f,b),k=new e(u,I);if(0!==a){const e=Math.cos(a),t=Math.sin(a);P.rotate(e,t),O.rotate(e,t),_.rotate(e,t),k.rotate(e,t)}const M=new y(P,k,_,O,w,a,0,256,i,d,s,0);if(t.shapes.push(M),(!o.allowOverlap||!o.ignorePlacement)&&g){const e=o.size,n=o.padding,l={xTile:i.x,yTile:i.y,dxPixels:m*e-n,dyPixels:p*e-n,hard:!o.optional,partIndex:0,width:h*e+2*n,height:r*e+2*n,angle:a,minLod:d,maxLod:s};t.iconColliders.push(l)}}getTextPlacement(o,a,l,g){const w=new e(o.x,o.y),I=g.rotate*i,u=g.rotationAlignment===m.MAP,b=g.keepUpright,P=g.padding;let O=d;const _=!u?0:o.angle,k=o.segment>=0&&u,M=g.allowOverlap&&g.ignorePlacement?null:[],E=[],G=4,N=!k;let A=Number.POSITIVE_INFINITY,L=Number.NEGATIVE_INFINITY,z=A,F=L;const v=(k||u)&&b,R=g.size/h;let B=!1;for(const e of a)if(e.vertical){B=!0;break}let H,V=0,j=0;if(!k&&B){const e=r.getTextBox(a,g.lineHeight*h);switch(g.anchor){case x.LEFT:V=e.height/2,j=-e.width/2;break;case x.RIGHT:V=-e.height/2,j=e.width/2;break;case x.TOP:V=e.height/2,j=e.width/2;break;case x.BOTTOM:V=-e.height/2,j=-e.width/2;break;case x.TOP_LEFT:V=e.height;break;case x.BOTTOM_LEFT:j=-e.width;break;case x.TOP_RIGHT:j=e.width;break;case x.BOTTOM_RIGHT:V=-e.height}}V+=g.offset[0]*h,j+=g.offset[1]*h;for(const i of a){const a=i.glyphMosaicItem;if(!a||a.rect.isEmpty)continue;const h=a.rect,r=a.metrics,m=a.page;if(M&&N){if(void 0!==H&&H!==i.y){let e,t,i,n;B?(e=-F+V,t=A+j,i=F-z,n=L-A):(e=A+V,t=z+j,i=L-A,n=F-z);const a={xTile:o.x,yTile:o.y,dxPixels:e*R-P,dyPixels:t*R-P,hard:!g.optional,partIndex:1,width:i*R+2*P,height:n*R+2*P,angle:I,minLod:d,maxLod:s};M.push(a),A=Number.POSITIVE_INFINITY,L=Number.NEGATIVE_INFINITY,z=A,F=L}H=i.y}const x=[];if(k){const e=.5*a.metrics.width,n=(i.x+r.left-G+e)*R*t;if(O=this._placeGlyph(o,O,n,l,o.segment,1,i.vertical,m,x),b&&(O=this._placeGlyph(o,O,n,l,o.segment,-1,i.vertical,m,x)),O>=p)break}else x.push(new T(w,_,_,m,!1)),u&&b&&x.push(new T(w,_+n,_+n,m,!1));const f=i.x+r.left,C=i.y-c-r.top,S=f+r.width,Y=C+r.height;let q,U,D,J,K,Q,W,X;if(!k&&B)if(i.vertical){const t=(f+S)/2-r.height/2,i=(C+Y)/2+r.width/2;q=new e(-i-G+V,t-G+j),U=new e(q.x+h.width,q.y+h.height),D=new e(q.x,U.y),J=new e(U.x,q.y)}else q=new e(-C+G+V,f-G+j),U=new e(q.x-h.height,q.y+h.width),D=new e(U.x,q.y),J=new e(q.x,U.y);else q=new e(f-G+V,C-G+j),U=new e(q.x+h.width,q.y+h.height),D=new e(q.x,U.y),J=new e(U.x,q.y);for(const t of x){let n,s,a,l;if(t.alternateVerticalGlyph){if(!K){const t=(C+Y)/2+j;K=new e((f+S)/2+V-r.height/2-G,t+r.width/2+G),Q=new e(K.x+h.height,K.y-h.width),W=new e(Q.x,K.y),X=new e(K.x,Q.y)}n=K,s=W,a=X,l=Q}else n=q,s=D,a=J,l=U;const c=C,m=Y,x=t.glyphAngle+I;if(0!==x){const e=Math.cos(x),t=Math.sin(x);n=n.clone(),s=s?.clone(),a=a?.clone(),l=l?.clone(),n.rotate(e,t),l?.rotate(e,t),s?.rotate(e,t),a?.rotate(e,t)}let d=0,w=256;if(k&&B?i.vertical?t.alternateVerticalGlyph?(d=32,w=96):(d=224,w=32):(d=224,w=96):(d=192,w=64),E.push(new y(n,a,s,l,h,t.labelAngle,d,w,t.anchor,t.minzoom,t.maxzoom,t.page)),M&&(!v||this._legible(t.labelAngle)))if(N)f<A&&(A=f),c<z&&(z=c),S>L&&(L=S),m>F&&(F=m);else if(t.minzoom<p){const e={xTile:o.x,yTile:o.y,dxPixels:(f+V)*R-P,dyPixels:(c+V)*R-P,hard:!g.optional,partIndex:1,width:(S-f)*R+2*P,height:(m-c)*R+2*P,angle:x,minLod:t.minzoom,maxLod:t.maxzoom};M.push(e)}}}if(O>=p)return null;if(M&&N){let e,t,i,n;B?(e=-F+V,t=A+j,i=F-z,n=L-A):(e=A+V,t=z+j,i=L-A,n=F-z);const a={xTile:o.x,yTile:o.y,dxPixels:e*R-P,dyPixels:t*R-P,hard:!g.optional,partIndex:1,width:i*R+2*P,height:n*R+2*P,angle:I,minLod:d,maxLod:s};M.push(a)}const C=new f(E);return M&&M.length>0&&(C.textColliders=M),C}_legible(e){const t=o(e);return t<65||t>=193}_placeGlyph(t,i,o,h,r,c,g,m,x){let d=c;const p=d<0?a(t.angle+n,l):t.angle;let w=0;o<0&&(d*=-1,o*=-1,w=n),d>0&&++r;let y=new e(t.x,t.y),f=h[r],I=s;if(h.length<=r)return I;for(;;){const e=f.x-y.x,t=f.y-y.y,n=Math.sqrt(e*e+t*t),s=Math.max(o/n,i),c=e/n,u=t/n,b=a(Math.atan2(u,c)+w,l);if(x.push(new T(y,p,b,m,!1,s,I)),g&&x.push(new T(y,p,b,m,!0,s,I)),s<=i)return s;y=f.clone();do{if(r+=d,h.length<=r||r<0)return s;f=h[r]}while(y.isEqual(f));let P=f.x-y.x,O=f.y-y.y;const _=Math.sqrt(P*P+O*O);P*=n/_,O*=n/_,y.x-=P,y.y-=O,I=s}}}export{w as Anchor,y as PlacedSymbol,f as Placement,I as PlacementEngine};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class
|
|
5
|
+
import{tileCoordSize as e}from"./constants.js";class t{constructor(s){this.extent=e,this.keys=[],this.values=[],this._pbfLayer=s.clone();const a=s.asUnsafe();for(;a.next();)switch(a.tag()){case 1:this.name=a.getString();break;case 3:this.keys.push(a.getString());break;case 4:this.values.push(a.processMessage(t._parseValue));break;case 5:this.extent=a.getUInt32();break;default:a.skip()}}getData(){return this._pbfLayer}static _parseValue(e){for(;e.next();)switch(e.tag()){case 1:return e.getString();case 2:return e.getFloat();case 3:return e.getDouble();case 4:return e.getInt64();case 5:return e.getUInt64();case 6:return e.getSInt64();case 7:return e.getBool();default:e.skip()}return null}}export{t as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{MinPriority as e}from"../../../../core/MemCache.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{fromValues as
|
|
5
|
+
import{MinPriority as e}from"../../../../core/MemCache.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{create as i}from"../../../../geometry/support/aaBoundingRect.js";import{tilePixelSize as s}from"./constants.js";import{TileHandler as r}from"./TileHandler.js";import{VectorTile as n}from"./VectorTile.js";import l from"../../tiling/TileInfoViewPOT.js";import a from"../../tiling/TileKey.js";class g extends r{constructor(e,t,o,i){super(e,t,o,e.tileInfo.lods.length-1),this._memCache=i,this._ongoingTileRequests=new Map,this._ongoingRequestToController=new Map,this._tileInfoView=new l(e.tileInfo,e.fullExtent)}destroy(){super.destroy(),this._ongoingRequestToController.forEach((e=>e.abort())),this._ongoingRequestToController.clear(),this._ongoingTileRequests.clear()}async getVectorTile(r,l){const g=new a(r[0],r[1],r[2],0);let h=this._memCache.get(g.id);if(h)return h.retain(),h;const m=await this._getVectorTileData(g);if(t(l),!this._layer)return null;if(h=this._memCache.get(g.id),h)return h.retain(),h;const c=this._layer.tileInfo.getTileBounds(i(),g),u=this._tileInfoView.getTileResolution(r[0]);return h=new n(g,u,c[0],c[3],s,s,this._styleRepository,this._memCache),h.setData(m),m&&(h.retain(),this._memCache.put(g.id,h,e)),h.neededForCoverage=!0,h.transforms.tileUnitsToPixels=o(1/8,0,0,0,1/8,0,0,0,1),h}_getVectorTileData(e){const t=e.id;if(this._ongoingTileRequests.has(t))return this._ongoingTileRequests.get(t);const o=new AbortController,i={signal:o.signal},s=this._getParsedVectorTileData(e,i).then((e=>(this._ongoingTileRequests.delete(t),this._ongoingRequestToController.delete(t),e))).catch((()=>(this._ongoingTileRequests.delete(t),this._ongoingRequestToController.delete(t),null)));return this._ongoingTileRequests.set(t,s),this._ongoingRequestToController.set(t,o),s}_getParsedVectorTileData(e,t){return this.fetchTileData(e,t).then((o=>this.parseTileData({key:e,data:o},t)))}}export{g as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{LRUCache as e}from"../../../../core/LRUCache.js";import{fromValues as i,create as t,intersects as
|
|
5
|
+
import{LRUCache as e}from"../../../../core/LRUCache.js";import{fromValues as i,create as t,intersects as s}from"../../../../geometry/support/aaBoundingRect.js";import{tilePixelSize as l}from"./constants.js";import o from"../../tiling/TileCoverage.js";import r from"../../tiling/TileKey.js";const n=1e-6,a=(e,i)=>e+1/(1<<2*i);class c{constructor(i,t){this._tiles=new Map,this._tileCache=new e(40,(e=>e.dispose())),this._viewSize=[0,0],this._visibleTiles=new Map,this.acquireTile=i.acquireTile,this.releaseTile=i.releaseTile,this.tileInfoView=i.tileInfoView,this._container=t}destroy(){for(const e of this._tiles.values())e.dispose();this._tiles=null,this._tileCache.clear(),this._tileCache=null}update(e){this._updateCacheSize(e);const i=this.tileInfoView,t=i.getTileCoverage(e.state,0,!0,"smallest");if(!t)return!0;const{spans:s,lodInfo:l}=t,{level:n}=l,a=this._tiles,c=new Set,h=new Set;for(const{row:o,colFrom:_,colTo:f}of s)for(let e=_;e<=f;e++){const i=r.getId(n,o,l.normalizeCol(e),l.getWorldForColumn(e)),t=this._getOrAcquireTile(i);c.add(i),t.processed()?this._addToContainer(t):h.add(new r(i))}for(const[o,r]of a)r.isCoverage=c.has(o);for(const o of h)this._findPlaceholdersForMissingTiles(o,c);let d=!1;for(const[o,r]of a)r.neededForCoverage=c.has(o),r.neededForCoverage||r.isHoldingForFade&&i.intersects(t,r.key)&&c.add(o),r.isFading&&(d=!0);for(const o of this._tiles.keys())c.has(o)||this._releaseTile(o);return o.pool.release(t),!d}clear(){this._tiles.clear(),this._tileCache.clear(),this._visibleTiles.clear()}clearCache(){this._tileCache.clear()}getIntersectingTiles(e,l,o,r,n){const a=[0,0],c=[0,0];r.toMap(a,e-o,l+o),r.toMap(c,e+o,l-o);const h=Math.min(a[0],c[0]),d=Math.min(a[1],c[1]),_=Math.max(a[0],c[0]),f=Math.max(a[1],c[1]),T=i(h,d,_,f),u=t(),p=[];for(const i of this._visibleTiles.values())this.tileInfoView.getTileBounds(u,i.key),s(T,u)&&p.push(i);if(null!=n&&n.length>0){const e=new Set(p.map((e=>e.id))),i=n.filter((i=>!e.has(i.tileKey.id))).map((e=>this._visibleTiles.get(e.tileKey.id))).filter((e=>void 0!==e));p.push(...i)}return p}_findPlaceholdersForMissingTiles(e,i){const t=[];for(const l of this._tiles.values())this._addPlaceholderChild(t,l,e,i);const s=t.reduce(a,0);Math.abs(1-s)<n||this._addPlaceholderParent(e.id,i)}_addPlaceholderChild(e,i,t,s){i.key.level<=t.level||!i.hasData()||d(t,i.key)&&(this._addToContainer(i),s.add(i.id),e.push(i.key.level-t.level))}_addPlaceholderParent(e,i){const t=this._tiles;let s=e;for(;;){if(s=h(s),!s||i.has(s))return;const e=t.get(s);if(e?.hasData())return this._addToContainer(e),void i.add(e.id)}}_getOrAcquireTile(e){let i=this._tiles.get(e);return i||(i=this._tileCache.pop(e),i||(i=this.acquireTile(new r(e))),this._tiles.set(e,i),i)}_releaseTile(e){const i=this._tiles.get(e);this.releaseTile(i),this._removeFromContainer(i),this._tiles.delete(e),i.hasData()?this._tileCache.put(e,i,1):i.dispose()}_addToContainer(e){let i;const t=[],s=this._container;if(s.contains(e))return;const l=this._visibleTiles;for(const o of l.values())this._canConnectDirectly(e,o)&&t.push(o),null==i&&this._canConnectDirectly(o,e)&&(i=o);if(null!=i){for(const s of t)i.childrenTiles.delete(s),e.childrenTiles.add(s),s.parentTile=e;i.childrenTiles.add(e),e.parentTile=i}else for(const o of t)e.childrenTiles.add(o),o.parentTile=e;l.set(e.id,e),s.addChild(e)}_removeFromContainer(e){if(this._visibleTiles.delete(e.id),this._container.removeChild(e),null!=e.parentTile){e.parentTile.childrenTiles.delete(e);for(const i of e.childrenTiles)null!=e.parentTile&&e.parentTile.childrenTiles.add(i)}for(const i of e.childrenTiles)i.parentTile=e.parentTile;e.parentTile=null,e.childrenTiles.clear()}_canConnectDirectly(e,i){const t=e.key;let{level:s,row:l,col:o,world:r}=i.key;const n=this._visibleTiles;for(;s>0;){if(s--,l>>=1,o>>=1,t.level===s&&t.row===l&&t.col===o&&t.world===r)return!0;if(n.has(`${s}/${l}/${o}/${r}`))return!1}return!1}_updateCacheSize(e){const i=e.state.size;if(i[0]===this._viewSize[0]&&i[1]===this._viewSize[1])return;const t=Math.ceil(i[0]/l)+1,s=Math.ceil(i[1]/l)+1;this._viewSize[0]=i[0],this._viewSize[1]=i[1],this._tileCache.maxSize=5*t*s}}function h(e){const[i,t,s,l]=e.split("/"),o=parseInt(i,10);return 0===o?null:`${o-1}/${parseInt(t,10)>>1}/${parseInt(s,10)>>1}/${parseInt(l,10)}`}function d(e,i){const t=i.level-e.level;return e.row===i.row>>t&&e.col===i.col>>t&&e.world===i.world}export{c as TileManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import{identity as e,translate as t,rotate as s,scale as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{
|
|
5
|
+
import"../../../../core/has.js";import{identity as e,translate as t,rotate as s,scale as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{tileCoordSize as i}from"./constants.js";import{BucketType as o}from"./enums.js";import{CircleRenderBucket as h,SymbolRenderBucket as n,LineRenderBucket as l,FillRenderBucket as c}from"./RenderBucket.js";import{fadeDuration as d}from"./decluttering/config.js";import{TiledDisplayObject as u}from"../webgl/TiledDisplayObject.js";const y=null;class m extends u{constructor(e,t,s,r,a,o,h,n=null){super(e,t,s,r,a,o,i,i),this.styleRepository=h,this._memCache=n,this.type="vector-tile",this._referenced=1,this._hasSymbolBuckets=!1,this._usedMemory=256,this.layerData=new Map,this.status="loading",this.allSymbolsFadingOut=!1,this.lastOpacityUpdate=0,this.symbols=new Map,this.isCoverage=!1,this.neededForCoverage=!1,this.decluttered=!1,this.parentTile=null,this.childrenTiles=new Set,this.featureIndex=null,this.triangleCount=0,this._processed=!1,this.id=e.id}get styleLayerUIDs(){return Array.from(this.layerData.keys())}get hasSymbolBuckets(){return this._hasSymbolBuckets}get isFading(){return this._hasSymbolBuckets&&performance.now()-this.lastOpacityUpdate<d}get isHoldingForFade(){return this._hasSymbolBuckets&&(!this.allSymbolsFadingOut||performance.now()-this.lastOpacityUpdate<d)}get wasRequested(){return"errored"===this.status||"loaded"===this.status||"reloading"===this.status}setData(e){this.changeDataImpl(e),this.requestRender(),this.ready(),this._processed=!0}deleteLayerData(e){let t=!1;for(const s of e){const e=this.layerData.get(s);e&&(this._usedMemory-=e.usedMemory,e.type===o.SYMBOL&&this.symbols.delete(s)&&(t=!0),e.destroy(),this.layerData.delete(s))}this._memCache?.updateSize(this.key.id,this),t&&(this.featureIndex?.clear(),this.emit("symbols-changed")),this.requestRender()}processed(){return this._processed}hasData(){return this.layerData.size>0}hasFeatures(){const e=this.layerData.values();for(const t of e)if(t.hasData())return!0;return!1}dispose(){"unloaded"!==this.status&&(m._destroyRenderBuckets(this.layerData),this.layerData.clear(),this.featureIndex=null,this._usedMemory=0,this.destroy(),this.status="unloaded")}release(){0==--this._referenced&&(this.dispose(),this.stage=null)}retain(){++this._referenced}get cachedMemory(){return this._usedMemory}get usedMemory(){return this._usedMemory}get usedMemoryPerReference(){return this._usedMemory/(this._referenced||1)}changeDataImpl(e){this.featureIndex?.clear();let t=!1;if(e){const{bucketsWithData:s,emptyBuckets:r}=e,a=this._createRenderBuckets(s);if(r&&r.byteLength>0){const e=new Uint32Array(r);for(const t of e)this._deleteLayerData(t)}for(const[e,i]of a)this._deleteLayerData(e),i.type===o.SYMBOL&&(this.symbols.set(e,i.symbols),t=!0),this._usedMemory+=i.usedMemory,this.layerData.set(e,i);this._memCache?.updateSize(this.key.id,this)}this._hasSymbolBuckets=!1;for(const s of this.layerData.values())s.type===o.SYMBOL&&(this._hasSymbolBuckets=!0);t&&this.emit("symbols-changed")}attachWithContext(e){this.stage={context:e,trashDisplayObject(e){e.processDetach()},untrashDisplayObject:()=>!1}}setTransform(a){super.setTransform(a);const i=this.resolution/(a.resolution*a.pixelRatio),o=this.width/this.rangeX*i,h=this.height/this.rangeY*i,n=[0,0];a.toScreen(n,[this.x,this.y]);const l=this.transforms.tileUnitsToPixels;e(l),t(l,l,n),s(l,l,Math.PI*a.rotation/180),r(l,l,[o,h,1])}_createTransforms(){return{displayViewScreenMat3:a(),tileMat3:a(),tileUnitsToPixels:a()}}static _destroyRenderBuckets(e){if(!e)return;const t=new Set;for(const s of e.values())t.has(s)||(s.destroy(),t.add(s));e.clear()}_createRenderBuckets(e){const t=new Map,s=new Map;for(const r of e){const e=this._deserializeBucket(r,s);for(const s of e.layerUIDs)t.set(s,e)}return t}_deserializeBucket(e,t){let s=t.get(e);if(s)return s;switch(new Uint32Array(e)[0]){case o.FILL:s=new c(e,this.styleRepository);break;case o.LINE:s=new l(e,this.styleRepository);break;case o.SYMBOL:s=new n(e,this.styleRepository,this);break;case o.CIRCLE:s=new h(e,this.styleRepository)}return t.set(e,s),s}_deleteLayerData(e){if(!this.layerData.has(e))return;const t=this.layerData.get(e);this._usedMemory-=t.usedMemory,t.destroy(),this.layerData.delete(e)}}export{m as VectorTile,y as tracer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as e}from"../../../../geometry/support/aaBoundingRect.js";import t from"../../../../layers/support/TileInfo.js";import{
|
|
5
|
+
import{create as e}from"../../../../geometry/support/aaBoundingRect.js";import t from"../../../../layers/support/TileInfo.js";import{tileCoordSize as s,tilePixelSize as r}from"./constants.js";import{SymbolFader as i}from"./decluttering/SymbolFader.js";import{writeOpacityToBuffers as l}from"./decluttering/util.js";import{Visibility as o,StyleLayerType as n}from"./style/StyleDefinition.js";import{WGLDrawPhase as a}from"../webgl/enums.js";import{RenderableTile as d}from"../webgl/RenderableTile.js";import c from"../webgl/TileContainer.js";import h from"../../tiling/TileCoverage.js";import u from"../../tiling/TileKey.js";import{StencilOperation as y,CompareFunction as p,FramebufferBit as m,BlendFactor as f}from"../../../webgl/enums.js";const g=1e-6;function b(e,t){if(e){const s=e.getLayoutProperty("visibility");if(!s||s.getValue()!==o.NONE&&(void 0===e.minzoom||e.minzoom<t+g)&&(void 0===e.maxzoom||e.maxzoom>=t-g))return!0}return!1}class _ extends c{constructor(e){super(e),this._backgroundTiles=[],this._computeDisplayInfoView(e)}destroy(){this.removeAllChildren(),this._spriteMosaic?.dispose(),this._spriteMosaic=null,this._glyphMosaic?.dispose(),this._glyphMosaic=null,null!=this._symbolFader&&(this._symbolFader.clear(),this._symbolFader=null),this._styleRepository=null,this._backgroundTiles=[]}get fading(){return this._symbolFader?.fading??!1}get symbolFader(){return this._symbolFader}get symbolRepository(){return this._symbolFader?.symbolRepository}setStyleResources(e,t,r,o){if(this._spriteMosaic=e,this._glyphMosaic=t,this._styleRepository=r,this.tileInfoView=o,this._computeDisplayInfoView(o),null==this._symbolFader){const e=(e,t)=>{e.allSymbolsFadingOut=!0,e.lastOpacityUpdate=t,l(e,t,!0),e.decluttered=!0,e.requestRender()};this._symbolFader=new i("vector-tile",this._styleRepository,e,this.children,s)}this._symbolFader.styleRepository=r}setSpriteMosaic(e){this._spriteMosaic?.dispose(),this._spriteMosaic=e}deleteStyleLayers(e){null!=this._symbolFader&&this._symbolFader.deleteStyleLayers(e)}createRenderParams(e){return{...super.createRenderParams(e),renderPass:null,styleLayer:null,styleLayerUID:-1,glyphMosaic:this._glyphMosaic,spriteMosaic:this._spriteMosaic,hasClipping:!!this._clippingInfos}}doRender(e){!this.visible||e.drawPhase!==a.MAP&&e.drawPhase!==a.DEBUG||void 0===this._spriteMosaic||super.doRender(e)}addChild(e){return super.addChild(e),null!=this._symbolFader?this._symbolFader.addTile(e):e.decluttered=!0,this.requestRender(),e}removeChild(e){return null!=this._symbolFader&&this._symbolFader.removeTile(e),this.requestRender(),super.removeChild(e)}renderChildren(e){const{drawPhase:t}=e;t!==a.DEBUG?this._doRender(e):super.renderChildren(e)}removeAllChildren(){for(let e=0;e<this.children.length;e++){const t=this.children[e];null!=this._symbolFader&&this._symbolFader.removeTile(t),t.dispose()}super.removeAllChildren()}getStencilTarget(){return this.children.filter((e=>e.neededForCoverage&&e.hasData()))}restartDeclutter(){null!=this._symbolFader&&this._symbolFader.restartDeclutter()}_doRender(e){const{context:t,state:s}=e,r=this._styleRepository;if(!r)return;const i=r.layers,l=this._displayInfo.scaleToZoom(s.scale);r.backgroundBucketIds.length>0&&(e.renderPass="background",this._renderBackgroundLayers(e,r.backgroundBucketIds,l)),super.renderChildren(e),e.drawPhase===a.MAP&&this._fade(l,s);const o=this.children.filter((e=>e.visible&&e.hasData()));if(!o||0===o.length)return t.bindVAO(),t.setStencilTestEnabled(!0),void t.setBlendingEnabled(!0);for(const n of o)n.triangleCount=0;t.setStencilWriteMask(0),t.setColorMask(!0,!0,!0,!0),t.setStencilOp(y.KEEP,y.KEEP,y.REPLACE),t.setStencilTestEnabled(!0),t.setBlendingEnabled(!1),t.setDepthTestEnabled(!0),t.setDepthWriteEnabled(!0),t.setDepthFunction(p.LEQUAL),t.setClearDepth(1),t.clear(m.DEPTH),e.renderPass="opaque";for(let n=i.length-1;n>=0;n--)this._renderStyleLayer(i[n],e,o);t.setDepthWriteEnabled(!1),t.setBlendingEnabled(!0),t.setBlendFunctionSeparate(f.ONE,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA),e.renderPass="translucent";for(let n=0;n<i.length;n++)this._renderStyleLayer(i[n],e,o);t.bindVAO(),t.setStencilTestEnabled(!0),t.setBlendingEnabled(!0);for(const n of o)n.debugInfo.display.triangleCount=n.triangleCount}_fade(e,t){null!=this._symbolFader&&(this._symbolFader.update(e,t)||this.requestRender())}_renderStyleLayer(e,t,s){const{displayLevel:r,painter:i,renderPass:l}=t;if(void 0===e)return;const a=e.getLayoutProperty("visibility");if(a&&a.getValue()===o.NONE)return;let d;switch(e.type){case n.BACKGROUND:return;case n.FILL:if("opaque"!==l&&"translucent"!==t.renderPass)return;d="vtlFill";break;case n.LINE:if("translucent"!==l)return;d="vtlLine";break;case n.CIRCLE:if("translucent"!==l)return;d="vtlCircle";break;case n.SYMBOL:if("translucent"!==l)return;d="vtlSymbol"}if(s=e.type===n.SYMBOL?s.filter((e=>e.decluttered)):s.filter((e=>e.neededForCoverage)),"vtlSymbol"!==d&&(0===s.length||void 0!==e.minzoom&&e.minzoom>=r+g||void 0!==e.maxzoom&&e.maxzoom<r-g))return;const c=e.uid;t.styleLayerUID=c,t.styleLayer=e;for(const o of s)if(o.layerData.has(c)){i.renderObjects(t,s,d);break}}_renderBackgroundLayers(t,i,l){const{context:o,painter:a,state:c}=t,m=this._styleRepository;let f=!1;for(const e of i){if(m.getLayerById(e).type===n.BACKGROUND&&b(m.getLayerById(e),l)){f=!0;break}}if(!f)return;const g=this.tileInfoView,_=g.getTileCoverage(t.state,0,!0,"smallest"),{spans:C,lodInfo:E}=_,{level:F}=E,L=e(),R=[];if(this._renderPasses){const e=this._renderPasses[0];null!=this._clippingInfos&&(e.brushes[0].prepareState(t),e.brushes[0].drawMany(t,this._clippingInfos))}const v=this._backgroundTiles;let S,I=0;for(const{row:n,colFrom:h,colTo:y}of C)for(let t=h;t<=y;t++){if(I<v.length)S=v[I],S.key.set(F,n,E.normalizeCol(t),E.getWorldForColumn(t)),g.getTileBounds(L,S.key,!1),S.x=L[0],S.y=L[3],S.resolution=g.getTileResolution(F);else{const i=new u(F,n,E.normalizeCol(t),E.getWorldForColumn(t)),l=g.getTileBounds(e(),i),o=g.getTileResolution(F);S=new d(i,o,l[0],l[3],r,r,s,s),v.push(S)}S.setTransform(c),R.push(S),I++}o.setStencilWriteMask(0),o.setColorMask(!0,!0,!0,!0),o.setStencilOp(y.KEEP,y.KEEP,y.REPLACE),o.setStencilFunction(p.EQUAL,0,255),o.setStencilTestEnabled(!0);for(const e of i){const s=m.getLayerById(e);s.type===n.BACKGROUND&&b(s,l)&&(t.styleLayerUID=s.uid,t.styleLayer=s,a.renderObjects(t,R,"vtlBackground"))}h.pool.release(_)}_computeDisplayInfoView(e){let s=e.tileInfo.lods[0].scale;const i=Math.max(25,e.tileInfo.lods.length),l=[];for(let t=0;t<=i;t++)l.push(s),s/=2;this._displayInfo=t.create({scales:l,size:r,spatialReference:e.spatialReference,numLODs:i})}}export{_ as VectorTileContainer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Graphic.js";import{getOrCreateMapValue as t}from"../../../../core/MapUtils.js";import s from"../../../../core/pbf.js";import{PooledRBush as r}from"../../../../core/libs/rbush/PooledRBush.js";import{
|
|
5
|
+
import e from"../../../../Graphic.js";import{getOrCreateMapValue as t}from"../../../../core/MapUtils.js";import s from"../../../../core/pbf.js";import{PooledRBush as r}from"../../../../core/libs/rbush/PooledRBush.js";import{tilePixelSize as i,tileCoordSize as o,tilePixelRatio as l}from"./constants.js";import{BucketType as n}from"./enums.js";import a from"./Feature.js";import{getTileMargins as y}from"./GeometryUtils.js";import c from"./SourceLayerData.js";import{IndexItem as u}from"./style/StyleLayer.js";const h=(e,t)=>{const s=e.vtlSymbol.sourceTile,r=t.vtlSymbol.sourceTile;return s.level!==r.level?s.level-r.level:s.row!==r.row?s.row-r.row:s.col!==r.col?s.col-r.col:e.styleLayerUID-t.styleLayerUID};class d{constructor(e,t,s,r,i){this.tileKey=e,this._tileLayerData=t,this._styleRepository=s,this._tileHandler=r,this._parentLayer=i,this._index=null,this._tileKeyToPBF=new Map}static create(e,t,s,r,i){return new d(e,t,s,r,i)}clear(){this._index?.clear(),this._tileKeyToPBF.clear()}async queryAttributes(e,t,s,i,o){if(0===this._tileLayerData.size||!this._styleRepository||!this._tileHandler)return[];null===this._index&&(this._index=new r(100,m),await this._indexLayers());const l=[];return this._queryIndex(l,e,t,s,this.tileKey.level,i),o&&o?.length>0&&await this._getSymbolsAttributes(l,o),l}async _indexLayers(){const e=this.tileKey,t=this._styleRepository.layers,s=await this._getTilePayload(e);for(const[r,i]of this._tileLayerData){const o=t[r],l=s.find((e=>e.sourceName===o.source));if(!l)continue;const{protobuff:a,key:y}=l;if(i.type!==n.SYMBOL){const t=1<<e.level-y.level,s=e.row-y.row*t,r=e.col-y.col*t;this._indexLayer(o,a,e.level,t,s,r)}}}_indexLayer(e,t,r,l,n,h){const d=e.sourceLayer,m=e.getFeatureFilter(),f=r,_=r+1,p=y(f),g=new s(new Uint8Array(t),new DataView(t));for(;g.next();)switch(g.tag()){case 3:{const t=g.getMessage(),s=new c(t);if(t.release(),s.name!==d)continue;const y=s.getData(),w=s.extent/l,x=w*h-p,b=w*n-p,I=x+w+2*p,L=b+w+2*p,v=w/i,D=o/w,T=w*h,S=w*n;for(;y.nextTag(2);){const t=y.getMessage(),i=new a(t,s);if(t.release(),m&&!m.filter(i,r))continue;const o=i.values||{},l=o._minzoom,n=o._maxzoom;if(l&&l>=10*_||n&&n<=10*f)continue;const c=e.getFeatureInflatedBounds(i,f,s.extent,v);null==c||c[0]>I||c[1]>L||c[2]<x||c[3]<b||(c[0]=(c[0]-T)*D,c[1]=(c[1]-S)*D,c[2]=(c[2]-T)*D,c[3]=(c[3]-S)*D,this._index.insert(new u(e,i,c,D,T,S)))}break}default:g.skip()}}async _getSymbolsAttributes(e,t){if(!t||0===t.length)return e;const s=[];t.sort(h);let r=t[0].styleLayerUID,i=0;for(let l=0;l<t.length;l++)r!==t[l].styleLayerUID&&(s.push({from:i,to:l,styleLayerUID:r,sourceTileKey:t[l].vtlSymbol.sourceTile}),i=l,r=t[l].styleLayerUID);s.push({from:i,to:t.length,styleLayerUID:r,sourceTileKey:t[t.length-1].vtlSymbol.sourceTile});const o=this._styleRepository.layers;for(const l of s){const s=await this._getTilePayload(l.sourceTileKey),i=o[l.styleLayerUID],n=!!i&&s.find((e=>e.sourceName===i.source));n&&this._addSymbolsAttributes(e,t.slice(l.from,l.to).map((e=>e.vtlSymbol)),r,n)}return e}_addSymbolsAttributes(t,s,r,i){const o=this._styleRepository.layers,l=i.key,n=this.tileKey,a=1<<n.level-l.level,y=n.row-l.row*a,c=n.col-l.col*a;this._getSymbolAttributes(i.protobuff,s,r,a,y,c).forEach((s=>{const{attributes:i,tilePoint:l}=s;t.push({layerId:o[r].id,layerIndex:r,graphic:new e({attributes:i,origin:{type:"vector-tile",layerId:o[r].id,layerIndex:r,layer:this._parentLayer}}),tilePoint:l})}))}_getSymbolAttributes(e,t,r,i,l,n){const y=[],u=this._styleRepository.layers;let h=0;t.sort(((e,t)=>e.featureIndex-t.featureIndex));const d=new s(new Uint8Array(e),new DataView(e));for(;d.next();)switch(d.tag()){case 3:{const e=d.getMessage(),s=new c(e);if(e.release(),s.name!==u[r].sourceLayer)continue;const m=s.getData(),f=s.extent/i,_=o/f,p=f*n,g=f*l;let w=0;for(;m.nextTag(2);){const e=m.getMessage();if(w++===t[h].featureIndex){const t=new a(e,s),r=t.values,i=t.getGeometry(),o=null!=i?[_*(i[0][0].x-p),_*(i[0][0].y-g)]:null;y.push({attributes:r,tilePoint:o}),h++}if(e.release(),h===t.length)return y}break}default:d.skip()}return y}_queryIndex(t,s,r,i,o,n){const a=l*i*(window.devicePixelRatio||1);return this._index?.search({minX:s-a,minY:r-a,maxX:s+a,maxY:r+a},(l=>{const{layer:a,feature:y}=l;a.isIntersectingFeature(s,r,i,y,o,n,l)&&t.push({layerId:a.id,layerIndex:a.uid,tilePoint:null,graphic:new e({attributes:y.values,origin:{type:"vector-tile",layerId:l.layer.id,layerIndex:l.layer.uid,layer:this._parentLayer}})})})),t}async _getTilePayload(e){return t(this._tileKeyToPBF,e.id,(()=>this._tileHandler.fetchTilePBFs(e))).then((e=>e))}}const m=e=>({minX:e.bounds[0],minY:e.bounds[1],maxX:e.bounds[2],maxY:e.bounds[3]});export{d as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{set as e,identity as t,translate as i,rotate as s,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{toRadian as r}from"../../../../core/libs/gl-matrix-2/math/common.js";import"../../tiling/TileInfoView.js";import a from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{
|
|
5
|
+
import{set as e,identity as t,translate as i,rotate as s,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{toRadian as r}from"../../../../core/libs/gl-matrix-2/math/common.js";import"../../tiling/TileInfoView.js";import a from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{tilePixelSize as o,tileCoordSize as d,tileCoordinateScale as c}from"./constants.js";import{declutterSingleTile as h}from"./decluttering/jobsUtil.js";import{StyleLayerType as u}from"./style/StyleDefinition.js";import{RenderableTile as m}from"../webgl/RenderableTile.js";import{TileReshuffleManager as p}from"../webgl/TileReshuffleManager.js";import{CompareFunction as g,StencilOperation as f}from"../../../webgl/enums.js";class y{constructor(){this._renderParams={reshuffleManager:new p,context:null,drawPhase:1,state:new _,stationary:!0,pixelRatio:1,displayLevel:-1,requiredLevel:-1,globalOpacity:1,renderPass:"background",styleLayer:null,styleLayerUID:-1,painter:null,glyphMosaic:null,spriteMosaic:null,profiler:null,renderingOptions:null,requestRender:null,allowDelayedRender:!1,deltaTime:-1,timeline:null,time:0,hasClipping:!1,blendMode:null,dataUploadCounter:0,effects:null,inFadeTransition:!1,requireFBO:!1,highlightGradient:null,stencilSymbols:!0,is3D:!0,backgroundColor:null},this._backgroundTile=new m(new a(0,0,0,0),0,0,0,o,o,d,d),this._heading=0,this._declutteredForHeading=new WeakMap}dispose(){this._renderParams=null}renderBackground(e,t,i,s,l,n,r,a,o,d){const c=this._backgroundTile;this._updateRenderParameters(e,t,c,i,l,n,r,a,o,d),this._renderParams.stencilSymbols=!1,i.drawBackground(this._renderParams,c,s)}renderContent(e,t,i,s,l,n,r,a,o,d,c,h){this._declutter(i),s.forAll((({sourceLayerInfo:{data:e}})=>this._declutter(e)));const u=s.length>0;u&&this._stencilSymbols(e,t,i,s,l,n,r,a,o,d,c,h);let m=1;i.stencilRef=u?m:0,e.setStencilFunction(g.EQUAL,i.stencilRef,255),this._render(e,t,i,l,n,r,a,o,d,c,h),s.forAll((({sourceLod:t,offset:i,sourceLayerInfo:{data:s}})=>{s.stencilRef=++m,this._renderSymbols(e,t,s,l,n,r,a,i,d,c,h)}))}_stencilSymbols(e,t,i,s,l,n,r,a,o,d,c,h){let u=1;i.stencilRef=u,e.setDepthTestEnabled(!1),e.setDepthWriteEnabled(!1),e.setStencilTestEnabled(!0),e.setBlendingEnabled(!1),e.setColorMask(!1,!1,!1,!1),e.setStencilOp(f.KEEP,f.KEEP,f.REPLACE),e.setStencilWriteMask(255),e.setStencilFunction(g.ALWAYS,i.stencilRef,255),this._stencilTileSymbols(e,t,i,l,n,r,a,o,d,c,h),s.forAll((({sourceLod:t,offset:i,sourceLayerInfo:{data:s}})=>{s.stencilRef=++u,e.setStencilFunction(g.ALWAYS,s.stencilRef,255),this._stencilTileSymbols(e,t,s,l,n,r,a,i,d,c,h)})),e.setStencilWriteMask(0),e.setBlendingEnabled(!0),e.setDepthTestEnabled(!0),e.setColorMask(!0,!0,!0,!0)}_renderSymbols(e,t,i,s,l,n,r,a,o,d,c){e.setStencilFunction(g.EQUAL,i.stencilRef,255),this._render(e,t,i,s,l,n,r,a,o,d,c,u.SYMBOL)}_render(e,t,i,s,l,n,r,a,o,d,c,h){this._updateRenderParameters(e,t,i,s,n,r,a,o,d,c),this._renderParams.stencilSymbols=!1,s.drawTile(this._renderParams,i,l,h)}_stencilTileSymbols(e,t,i,s,l,n,r,a,o,d,c){this._updateRenderParameters(e,t,i,s,n,r,a,o,d,c),this._renderParams.stencilSymbols=!0,i.triangleCount=0,s.drawSymbols(this._renderParams,i,l)}_updateRenderParameters(n,a,o,d,h,u,m,p,g,f){"type"in o&&"vector-tile"===o.type&&!o.stage&&o.attachWithContext(n);const y=a[0]-h.getLevelShift(a[0]),_=this._renderParams;_.context=n,_.painter=d,_.glyphMosaic=d.glyphMosaic,_.spriteMosaic=d.spriteMosaic,_.pixelRatio=g*f,_.displayLevel=y,_.requiredLevel=y;const b=h.getScale(a[0]),[S,M]=h.getOffset(a,u*b),w=c*u*b/p,R=o.transforms.displayViewScreenMat3;R[0]=w,R[4]=-w,R[6]=-1-S-m[0]*u*2,R[7]=1+M+(1-m[1])*u*2-2;const T=_.state,L=p/f;T.size[0]=L,T.size[1]=L,T.pixelRatio=f,T.rotation=(360-this._heading)%360;const P=2/L;e(T.displayViewMat3,P,0,0,0,-P,0,-1,1,1);const j=t(T.displayMat3),E=r(this._heading);i(j,j,[L/2,L/2]),s(j,j,E),i(j,j,[-L/2,-L/2]),l(j,T.displayViewMat3,j)}updateHeading(e){this._heading=e}_declutter(e){this._declutteredForHeading.get(e)!==this._heading&&(h(e,(360-this._heading)%360),this._declutteredForHeading.set(e,this._heading))}}class _{constructor(){this.size=[0,0],this.pixelRatio=1,this.rotation=0,this.displayMat3=n(),this.displayViewMat3=n(),this.transform=null,this.inverseTransform=null,this.viewMat2d=null,this.viewMat3=null,this.id=0,this.extent=null,this.center=null,this.scale=1,this.resolution=0,this.worldScreenWidth=0,this.spatialReference=null,this.viewpoint=null,this.getScreenTransform=null,this.toMap=null,this.toScreen=null,this.clone=null,this.copy=null,this.toJSON=null}}export{y as VectorTileRendererHelper3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
class
|
|
5
|
+
import{tileCoordSize as t}from"../constants.js";class e{constructor(e,s,r){this.layerExtent=t,this._features=[],this.layer=e,this.zoom=s,this._spriteInfo=r,this._filter=e.getFeatureFilter()}pushFeature(t){this._filter&&!this._filter.filter(t,this.zoom)||this._features.push(t)}hasFeatures(){return this._features.length>0}getResources(t,e,s){}}export{e as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../core/BidiEngine.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{numericHash as n}from"../../../../../core/string.js";import{GeometryType as i,Point as s}from"../../../../../geometry/support/TileClipper.js";import{BucketType as a}from"../enums.js";import{cDegToRad as o,log2 as r,interpolate as l}from"../GeometryUtils.js";import{tilePixelRatio as h,Anchor as x,tileCoordSize as c}from"../Placement.js";import{sdfGlyphSize as d,TextShaping as f}from"../TextShaping.js";import g from"./BaseBucket.js";import{TextTransform as y,SymbolPlacement as m,RotationAlignment as u,TextWritingMode as p,SymbolAnchor as _,TextJustification as M}from"../style/StyleDefinition.js";import{IconLayout as P,TextLayout as I}from"../style/StyleLayer.js";const b=10;function A(e,t){return e.iconMosaicItem&&t.iconMosaicItem?e.iconMosaicItem.page===t.iconMosaicItem.page?0:e.iconMosaicItem.page-t.iconMosaicItem.page:e.iconMosaicItem&&!t.iconMosaicItem?1:!e.iconMosaicItem&&t.iconMosaicItem?-1:0}class L extends g{constructor(e,t,n,i,s,o,r,l,h){super(t,n,h.getSpriteItems()),this.type=a.SYMBOL,this._markerMap=new Map,this._glyphMap=new Map,this._glyphBufferDataStorage=new Map,this._isIconSDF=!1,this._sourceTileKey=e,this._iconVertexBuffer=i,this._iconIndexBuffer=s,this._textVertexBuffer=o,this._textIndexBuffer=r,this._placementEngine=l,this._workerTileHandler=h}get markerPageMap(){return this._markerMap}get glyphsPageMap(){return this._glyphMap}get symbolInstances(){return this._symbolInstances}static{this._bidiEngine=new e}getResources(e,t,i){const s=this.layer,a=this.zoom;e&&e.setExtent(this.layerExtent);const o=s.getLayoutProperty("icon-image"),r=s.getLayoutProperty("text-field");let l=s.getLayoutProperty("text-transform"),h=s.getLayoutProperty("text-font");const x=[];let c,d,f,g;o&&!o.isDataDriven&&(c=o.getValue(a)),r&&!r.isDataDriven&&(d=r.getValue(a)),l&&l.isDataDriven||(f=s.getLayoutValue("text-transform",a),l=null),h&&h.isDataDriven||(g=s.getLayoutValue("text-font",a),h=null);for(const m of this._features){const u=m.getGeometry(e);if(!u||0===u.length)continue;let p,_;o&&(p=o.isDataDriven?o.getValue(a,m):this._replaceKeys(c,m.values),p&&t(p));let M=!1;if(r&&(_=r.isDataDriven?r.getValue(a,m):this._replaceKeys(d,m.values),_)){switch(_=_.replaceAll("\\n","\n"),l&&(f=l.getValue(a,m)),f){case y.LOWERCASE:_=_.toLowerCase();break;case y.UPPERCASE:_=_.toUpperCase()}if(L._bidiEngine.hasBidiChar(_)){let e;e="rtl"===L._bidiEngine.checkContextual(_)?"IDNNN":"ICNNN",_=L._bidiEngine.bidiTransform(_,e,"VLYSN"),M=!0}if(_.length>0){h&&(g=h.getValue(a,m));for(const e of g){let t=i[e];t||(t=i[e]=new Set);for(const e of _){const n=e.codePointAt(0);null!=n&&t.add(n)}}}}if(!p&&!_)continue;const P=s.getLayoutValue("symbol-sort-key",a,m),I={feature:m,sprite:p,label:_,rtl:M,geometry:u,hash:(_?n(_):0)^(p?n(p):0),priority:P,textFont:g};x.push(I)}this._symbolFeatures=x}processFeatures(e){e&&e.setExtent(this.layerExtent);const n=this.layer,s=this.zoom,a=n.getLayoutValue("symbol-placement",s),r=a!==m.POINT,l=n.getLayoutValue("symbol-spacing",s)*h,g=n.getLayoutProperty("icon-image"),y=n.getLayoutProperty("text-field"),b=g?new P(n,s,r):null,T=y?new I(n,s,r):null,V=this._workerTileHandler;let w;g&&(w=V.getSpriteItems()),this._iconIndexStart=3*this._iconIndexBuffer.index,this._textIndexStart=3*this._textIndexBuffer.index,this._iconIndexCount=0,this._textIndexCount=0,this._markerMap.clear(),this._glyphMap.clear();const B=[];let C=1;T?.size&&(C=T.size/d);const R=T?T.maxAngle*o:0,D=T?T.size*h:0;for(const o of this._symbolFeatures){let e;b&&w&&o.sprite&&(e=w[o.sprite],e&&e.sdf&&(this._isIconSDF=!0));let n;!!e&&b.update(s,o.feature);let g=0;const y=o.label;if(y){t(T),T.update(s,o.feature);const e=r&&T.rotationAlignment===u.MAP?T.keepUpright:T.writingMode&&T.writingMode.includes(p.VERTICAL);let i=.5;switch(T.anchor){case _.TOP_LEFT:case _.LEFT:case _.BOTTOM_LEFT:i=0;break;case _.TOP_RIGHT:case _.RIGHT:case _.BOTTOM_RIGHT:i=1}let a=.5;switch(T.anchor){case _.TOP_LEFT:case _.TOP:case _.TOP_RIGHT:a=0;break;case _.BOTTOM_LEFT:case _.BOTTOM:case _.BOTTOM_RIGHT:a=1}let l=.5;switch(T.justify){case M.AUTO:l=i;break;case M.LEFT:l=0;break;case M.RIGHT:l=1}const x=T.letterSpacing*d,c=r?0:T.maxWidth*d,m=T.lineHeight*d,P=o.textFont.map((e=>V.getGlyphItems(e)));if(n=new f(P,c,m,x,i,a,l).getShaping(y,o.rtl,e),n&&n.length>0){let e=1e30,t=-1e30;for(const i of n)e=Math.min(e,i.x),t=Math.max(t,i.x);g=(t-e+2*d)*C*h}}for(let t of o.geometry){const s=[];if(a===m.LINE){if(n?.length&&T?.size){const e=T.size*h*(2+Math.min(2,4*Math.abs(T.offset[1])));t=L._smoothVertices(t,e)}L._pushAnchors(s,t,l,g)}else a===m.LINE_CENTER?L._pushCenterAnchor(s,t):o.feature.type===i.Polygon?L._pushCentroid(s,t):s.push(new x(t[0].x,t[0].y));for(const i of s){if(i.x<0||i.x>c||i.y<0||i.y>c)continue;if(r&&g>0&&T?.rotationAlignment===u.MAP&&!L._honorsTextMaxAngle(t,i,g,R,D))continue;const s={shaping:n,line:t,iconMosaicItem:e,anchor:i,symbolFeature:o,textColliders:[],iconColliders:[],textVertexRanges:[],iconVertexRanges:[]};B.push(s),this._processFeature(s,b,T)}}}B.sort(A),this._addPlacedGlyphs(),this._symbolInstances=B}serialize(){let e=14;e+=this.layerUIDs.length,e+=3*this.markerPageMap.size,e+=3*this.glyphsPageMap.size,e+=L._symbolsSerializationLength(this._symbolInstances),e+=this._iconVertexBuffer.array.length,e+=this._iconIndexBuffer.array.length,e+=this._textVertexBuffer.array.length,e+=this._textIndexBuffer.array.length;const t=new Uint32Array(e),n=new Int32Array(t.buffer),i=new Float32Array(t.buffer),[s,a,o]=this._sourceTileKey.split("/");let r=0;t[r++]=this.type,t[r++]=this.layerUIDs.length;for(let l=0;l<this.layerUIDs.length;l++)t[r++]=this.layerUIDs[l];t[r++]=this._isIconSDF?1:0,t[r++]=parseFloat(s),t[r++]=parseFloat(a),t[r++]=parseFloat(o),t[r++]=this.markerPageMap.size;for(const[l,[h,x]]of this.markerPageMap)t[r++]=l,t[r++]=h,t[r++]=x;t[r++]=this.glyphsPageMap.size;for(const[l,[h,x]]of this.glyphsPageMap)t[r++]=l,t[r++]=h,t[r++]=x;t[r++]=this._iconVertexBuffer.index/4,t[r++]=this._textVertexBuffer.index/4,r=L.serializeSymbols(t,n,i,r,this._symbolInstances),t[r++]=this._iconVertexBuffer.array.length;for(let l=0;l<this._iconVertexBuffer.array.length;l++)n[r++]=this._iconVertexBuffer.array[l];t[r++]=this._iconIndexBuffer.array.length;for(let l=0;l<this._iconIndexBuffer.array.length;l++)t[r++]=this._iconIndexBuffer.array[l];t[r++]=this._textVertexBuffer.array.length;for(let l=0;l<this._textVertexBuffer.array.length;l++)n[r++]=this._textVertexBuffer.array[l];t[r++]=this._textIndexBuffer.array.length;for(let l=0;l<this._textIndexBuffer.array.length;l++)t[r++]=this._textIndexBuffer.array[l];return t.buffer}static _symbolsSerializationLength(e){let t=0;t+=1;for(const n of e||[]){t+=5,t+=1;for(const e of n.textColliders)t+=b;for(const e of n.iconColliders)t+=b;t+=1,t+=2*n.textVertexRanges.length,t+=1,t+=2*n.iconVertexRanges.length}return t}static serializeSymbols(e,t,n,i,s){s=s||[],t[i++]=s.length;for(const a of s){t[i++]=a.anchor.x,t[i++]=a.anchor.y,t[i++]=a.symbolFeature.hash,t[i++]=a.symbolFeature.priority,t[i++]=a.symbolFeature.feature.featureIndex,t[i++]=a.textColliders.length+a.iconColliders.length;for(const e of a.textColliders)t[i++]=e.xTile,t[i++]=e.yTile,t[i++]=e.dxPixels,t[i++]=e.dyPixels,t[i++]=e.hard?1:0,t[i++]=e.partIndex,n[i++]=e.minLod,n[i++]=e.maxLod,t[i++]=e.width,t[i++]=e.height;for(const e of a.iconColliders)t[i++]=e.xTile,t[i++]=e.yTile,t[i++]=e.dxPixels,t[i++]=e.dyPixels,t[i++]=e.hard?1:0,t[i++]=e.partIndex,n[i++]=e.minLod,n[i++]=e.maxLod,t[i++]=e.width,t[i++]=e.height;t[i++]=a.textVertexRanges.length;for(const[e,n]of a.textVertexRanges)t[i++]=e,t[i++]=n;t[i++]=a.iconVertexRanges.length;for(const[e,n]of a.iconVertexRanges)t[i++]=e,t[i++]=n}return i}_replaceKeys(e,t){return e.replaceAll(/{([^{}]+)}/g,((e,n)=>n in t?t[n]:""))}_processFeature(e,t,n){const{line:i,iconMosaicItem:s,shaping:a,anchor:o}=e,l=this.zoom,h=this.layer,x=!!s;let c=!0;x&&(c=t?.optional||!s);const d=a&&a.length>0,f=!d||n?.optional;let g,y;if(x&&(g=this._placementEngine.getIconPlacement(o,s,t)),(g||c)&&(d&&(y=this._placementEngine.getTextPlacement(o,a,i,n)),y||f)){if(g&&y||(f||c?f||y?c||g||(y=null):g=null:(g=null,y=null)),y){const t=h.hasDataDrivenText?h.textMaterial.encodeAttributes(e.symbolFeature.feature,l,h):null;if(this._storePlacedGlyphs(e,y.shapes,l,n.rotationAlignment,t),y.textColliders){e.textColliders=y.textColliders;for(const e of y.textColliders){e.minLod=Math.max(l+r(e.minLod),0),e.maxLod=Math.min(l+r(e.maxLod),25);const t=e.angle;if(t){const n=Math.cos(t),i=Math.sin(t),s=e.dxPixels*n-e.dyPixels*i,a=e.dxPixels*i+e.dyPixels*n,o=(e.dxPixels+e.width)*n-e.dyPixels*i,r=(e.dxPixels+e.width)*i+e.dyPixels*n,l=e.dxPixels*n-(e.dyPixels+e.height)*i,h=e.dxPixels*i+(e.dyPixels+e.height)*n,x=(e.dxPixels+e.width)*n-(e.dyPixels+e.height)*i,c=(e.dxPixels+e.width)*i+(e.dyPixels+e.height)*n,d=Math.min(s,o,l,x),f=Math.max(s,o,l,x),g=Math.min(a,r,h,c),y=Math.max(a,r,h,c);e.dxPixels=d,e.dyPixels=g,e.width=f-d,e.height=y-g}}}}if(g){const n=h.hasDataDrivenIcon?h.iconMaterial.encodeAttributes(e.symbolFeature.feature,l,h):null;if(this._addPlacedIcons(e,g.shapes,l,s.page,t.rotationAlignment===u.VIEWPORT,n),g.iconColliders){e.iconColliders=g.iconColliders;for(const e of g.iconColliders){e.minLod=Math.max(l+r(e.minLod),0),e.maxLod=Math.min(l+r(e.maxLod),25);const t=e.angle;if(t){const n=Math.cos(t),i=Math.sin(t),s=e.dxPixels*n-e.dyPixels*i,a=e.dxPixels*i+e.dyPixels*n,o=(e.dxPixels+e.width)*n-e.dyPixels*i,r=(e.dxPixels+e.width)*i+e.dyPixels*n,l=e.dxPixels*n-(e.dyPixels+e.height)*i,h=e.dxPixels*i+(e.dyPixels+e.height)*n,x=(e.dxPixels+e.width)*n-(e.dyPixels+e.height)*i,c=(e.dxPixels+e.width)*i+(e.dyPixels+e.height)*n,d=Math.min(s,o,l,x),f=Math.max(s,o,l,x),g=Math.min(a,r,h,c),y=Math.max(a,r,h,c);e.dxPixels=d,e.dyPixels=g,e.width=f-d,e.height=y-g}}}}}}_addPlacedIcons(e,t,n,i,s,a){const o=Math.max(n-1,0),l=this._iconVertexBuffer,h=this._iconIndexBuffer,x=this._markerMap;for(const c of t){const t=s?0:Math.max(n+r(c.minzoom),o),d=s?25:Math.min(n+r(c.maxzoom),25);if(d<=t)continue;const f=c.tl,g=c.tr,y=c.bl,m=c.br,u=c.mosaicRect,p=c.labelAngle,_=c.minAngle,M=c.maxAngle,P=c.anchor,I=l.index,b=u.x,A=u.y,L=b+u.width,T=A+u.height,V=l.index;l.add(P.x,P.y,f.x,f.y,b,A,p,_,M,t,d,a),l.add(P.x,P.y,g.x,g.y,L,A,p,_,M,t,d,a),l.add(P.x,P.y,y.x,y.y,b,T,p,_,M,t,d,a),l.add(P.x,P.y,m.x,m.y,L,T,p,_,M,t,d,a),e.iconVertexRanges.length>0&&e.iconVertexRanges[0][0]+e.iconVertexRanges[0][1]===V?e.iconVertexRanges[0][1]+=4:e.iconVertexRanges.push([V,4]),h.add(I,I+1,I+2),h.add(I+1,I+2,I+3),x.has(i)?x.get(i)[1]+=6:x.set(i,[this._iconIndexStart+this._iconIndexCount,6]),this._iconIndexCount+=6}}_addPlacedGlyphs(){const e=this._textVertexBuffer,t=this._textIndexBuffer,n=this._glyphMap;for(const[i,s]of this._glyphBufferDataStorage)for(const a of s){const s=e.index,o=a.symbolInstance,r=a.ddAttributes,l=e.index;e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.tl[0],a.tl[1],a.xmin,a.ymin,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.tr[0],a.tr[1],a.xmax,a.ymin,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.bl[0],a.bl[1],a.xmin,a.ymax,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.br[0],a.br[1],a.xmax,a.ymax,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),o.textVertexRanges.length>0&&o.textVertexRanges[0][0]+o.textVertexRanges[0][1]===l?o.textVertexRanges[0][1]+=4:o.textVertexRanges.push([l,4]),t.add(s,s+1,s+2),t.add(s+1,s+2,s+3),n.has(i)?n.get(i)[1]+=6:n.set(i,[this._textIndexStart+this._textIndexCount,6]),this._textIndexCount+=6}this._glyphBufferDataStorage.clear()}_storePlacedGlyphs(e,t,n,i,s){const a=Math.max(n-1,0),o=i===u.VIEWPORT;let l,h,x,c,d,f,g,y,m,p,_;for(const u of t){if(l=o?0:Math.max(n+r(u.minzoom),a),h=o?25:Math.min(n+r(u.maxzoom),25),h<=l)continue;x=u.tl,c=u.tr,d=u.bl,f=u.br,g=u.labelAngle,y=u.minAngle,m=u.maxAngle,p=u.anchor,_=u.mosaicRect,this._glyphBufferDataStorage.has(u.page)||this._glyphBufferDataStorage.set(u.page,[]);this._glyphBufferDataStorage.get(u.page).push({glyphAnchor:[p.x,p.y],tl:[x.x,x.y],tr:[c.x,c.y],bl:[d.x,d.y],br:[f.x,f.y],xmin:_.x,ymin:_.y,xmax:_.x+_.width,ymax:_.y+_.height,labelAngle:g,minAngle:y,maxAngle:m,minLod:l,maxLod:h,placementLod:a,symbolInstance:e,ddAttributes:s})}}static _pushAnchors(e,t,n,i){n+=i;let a=0;const o=t.length-1;for(let l=0;l<o;l++)a+=s.distance(t[l],t[l+1]);let r=i||n;if(r*=.5,a<=r)return;const h=r/a;let c=0,d=-(n=a/Math.max(Math.round(a/n),1))/2;const f=t.length-1;for(let s=0;s<f;s++){const i=t[s],a=t[s+1],o=a.x-i.x,r=a.y-i.y,f=Math.sqrt(o*o+r*r);let g;for(;d+n<c+f;){d+=n;const t=(d-c)/f,y=l(i.x,a.x,t),m=l(i.y,a.y,t);void 0===g&&(g=Math.atan2(r,o)),e.push(new x(y,m,g,s,h))}c+=f}}static _pushCenterAnchor(e,t){let n=0;const i=t.length-1;for(let l=0;l<i;l++)n+=s.distance(t[l],t[l+1]);const a=n/2;let o=0;const r=t.length-1;for(let s=0;s<r;s++){const n=t[s],i=t[s+1],r=i.x-n.x,h=i.y-n.y,c=Math.sqrt(r*r+h*h);if(a<o+c){const t=(a-o)/c,d=l(n.x,i.x,t),f=l(n.y,i.y,t),g=Math.atan2(h,r);return void e.push(new x(d,f,g,s,0))}o+=c}}static _deviation(e,t,n){const i=(t.x-e.x)*(n.x-t.x)+(t.y-e.y)*(n.y-t.y),s=(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x);return Math.atan2(s,i)}static _honorsTextMaxAngle(e,t,n,i,a){let o=0;const r=n/2;let l=new s(t.x,t.y),h=t.segment+1;for(;o>-r;){if(--h,h<0)return!1;o-=s.distance(e[h],l),l=e[h]}o+=s.distance(e[h],e[h+1]);const x=[];let c=0;const d=e.length;for(;o<r;){const t=e[h];let n,r=h;do{if(++r,r===d)return!1;n=e[r]}while(n.isEqual(t));let l,f=r;do{if(++f,f===d)return!1;l=e[f]}while(l.isEqual(n));const g=this._deviation(t,n,l);for(x.push({deviation:g,distToAnchor:o}),c+=g;o-x[0].distToAnchor>a;)c-=x.shift().deviation;if(Math.abs(c)>i)return!1;o+=s.distance(n,l),h=r}return!0}static _smoothVertices(e,t){if(t<=0)return e;let n=e.length;if(n<3)return e;const i=[];let a=0,o=0;i.push(0);for(let y=1;y<n;y++){const t=s.distance(e[y],e[y-1]);t>0&&(a+=t,i.push(a),o++,o!==y&&(e[o]=e[y]))}if(n=o+1,n<3)return e;t=Math.min(t,.2*a);const r=e[0].x,l=e[0].y,h=e[n-1].x,x=e[n-1].y,c=s.sub(e[0],e[1]);c.normalize(),e[0].x+=t*c.x,e[0].y+=t*c.y,c.assignSub(e[n-1],e[n-2]),c.normalize(),e[n-1].x+=t*c.x,e[n-1].y+=t*c.y,i[0]-=t,i[n-1]+=t;const d=[];d.push(new s(r,l));const f=1e-6,g=.5*t;for(let y=1;y<n-1;y++){let a=0,o=0,r=0;for(let n=y-1;n>=0;n--){const s=g+i[n+1]-i[y];if(s<0)break;const l=i[n+1]-i[n],h=i[y]-i[n]<g?1:s/l;if(h<f)break;const x=h*h,c=h*s-.5*x*l,d=h*l/t,m=e[n+1],u=e[n].x-m.x,p=e[n].y-m.y;a+=d/c*(m.x*h*s+.5*x*(s*u-l*m.x)-x*h*l*u/3),o+=d/c*(m.y*h*s+.5*x*(s*p-l*m.y)-x*h*l*p/3),r+=d}for(let s=y+1;s<n;s++){const n=g-i[s-1]+i[y];if(n<0)break;const l=i[s]-i[s-1],h=i[s]-i[y]<g?1:n/l;if(h<f)break;const x=h*h,c=h*n-.5*x*l,d=h*l/t,m=e[s-1],u=e[s].x-m.x,p=e[s].y-m.y;a+=d/c*(m.x*h*n+.5*x*(n*u-l*m.x)-x*h*l*u/3),o+=d/c*(m.y*h*n+.5*x*(n*p-l*m.y)-x*h*l*p/3),r+=d}d.push(new s(a/r,o/r))}return d.push(new s(h,x)),e[0].x=r,e[0].y=l,e[n-1].x=h,e[n-1].y=x,d}static _pushCentroid(e,t){const n=0,i=0,s=4096,a=4096,o=t.length-1;let r=0,l=0,h=0,c=t[0].x,d=t[0].y;c>s&&(c=s),c<n&&(c=n),d>a&&(d=a),d<i&&(d=i);for(let x=1;x<o;x++){let e=t[x].x,o=t[x].y,f=t[x+1].x,g=t[x+1].y;e>s&&(e=s),e<n&&(e=n),o>a&&(o=a),o<i&&(o=i),f>s&&(f=s),f<n&&(f=n),g>a&&(g=a),g<i&&(g=i);const y=(e-c)*(g-d)-(f-c)*(o-d);r+=y*(c+e+f),l+=y*(d+o+g),h+=y}r/=3*h,l/=3*h,isNaN(r)||isNaN(l)||e.push(new x(r,l))}}export{L as default};
|
|
5
|
+
import e from"../../../../../core/BidiEngine.js";import{assertIsSome as t}from"../../../../../core/maybe.js";import{numericHash as n}from"../../../../../core/string.js";import{GeometryType as i,Point as s}from"../../../../../geometry/support/TileClipper.js";import{tilePixelRatio as a,tileCoordSize as o}from"../constants.js";import{BucketType as r}from"../enums.js";import{cDegToRad as l,log2 as h,interpolate as x}from"../GeometryUtils.js";import{Anchor as c}from"../Placement.js";import{sdfGlyphSize as d,TextShaping as f}from"../TextShaping.js";import g from"./BaseBucket.js";import{TextTransform as y,SymbolPlacement as m,RotationAlignment as u,TextWritingMode as p,SymbolAnchor as _,TextJustification as M}from"../style/StyleDefinition.js";import{IconLayout as P,TextLayout as I}from"../style/StyleLayer.js";const b=10;function A(e,t){return e.iconMosaicItem&&t.iconMosaicItem?e.iconMosaicItem.page===t.iconMosaicItem.page?0:e.iconMosaicItem.page-t.iconMosaicItem.page:e.iconMosaicItem&&!t.iconMosaicItem?1:!e.iconMosaicItem&&t.iconMosaicItem?-1:0}class L extends g{constructor(e,t,n,i,s,a,o,l,h){super(t,n,h.getSpriteItems()),this.type=r.SYMBOL,this._markerMap=new Map,this._glyphMap=new Map,this._glyphBufferDataStorage=new Map,this._isIconSDF=!1,this._sourceTileKey=e,this._iconVertexBuffer=i,this._iconIndexBuffer=s,this._textVertexBuffer=a,this._textIndexBuffer=o,this._placementEngine=l,this._workerTileHandler=h}get markerPageMap(){return this._markerMap}get glyphsPageMap(){return this._glyphMap}get symbolInstances(){return this._symbolInstances}static{this._bidiEngine=new e}getResources(e,t,i){const s=this.layer,a=this.zoom;e&&e.setExtent(this.layerExtent);const o=s.getLayoutProperty("icon-image"),r=s.getLayoutProperty("text-field");let l=s.getLayoutProperty("text-transform"),h=s.getLayoutProperty("text-font");const x=[];let c,d,f,g;o&&!o.isDataDriven&&(c=o.getValue(a)),r&&!r.isDataDriven&&(d=r.getValue(a)),l&&l.isDataDriven||(f=s.getLayoutValue("text-transform",a),l=null),h&&h.isDataDriven||(g=s.getLayoutValue("text-font",a),h=null);for(const m of this._features){const u=m.getGeometry(e);if(!u||0===u.length)continue;let p,_;o&&(p=o.isDataDriven?o.getValue(a,m):this._replaceKeys(c,m.values),p&&t(p));let M=!1;if(r&&(_=r.isDataDriven?r.getValue(a,m):this._replaceKeys(d,m.values),_)){switch(_=_.replaceAll("\\n","\n"),l&&(f=l.getValue(a,m)),f){case y.LOWERCASE:_=_.toLowerCase();break;case y.UPPERCASE:_=_.toUpperCase()}if(L._bidiEngine.hasBidiChar(_)){let e;e="rtl"===L._bidiEngine.checkContextual(_)?"IDNNN":"ICNNN",_=L._bidiEngine.bidiTransform(_,e,"VLYSN"),M=!0}if(_.length>0){h&&(g=h.getValue(a,m));for(const e of g){let t=i[e];t||(t=i[e]=new Set);for(const e of _){const n=e.codePointAt(0);null!=n&&t.add(n)}}}}if(!p&&!_)continue;const P=s.getLayoutValue("symbol-sort-key",a,m),I={feature:m,sprite:p,label:_,rtl:M,geometry:u,hash:(_?n(_):0)^(p?n(p):0),priority:P,textFont:g};x.push(I)}this._symbolFeatures=x}processFeatures(e){e&&e.setExtent(this.layerExtent);const n=this.layer,s=this.zoom,r=n.getLayoutValue("symbol-placement",s),h=r!==m.POINT,x=n.getLayoutValue("symbol-spacing",s)*a,g=n.getLayoutProperty("icon-image"),y=n.getLayoutProperty("text-field"),b=g?new P(n,s,h):null,T=y?new I(n,s,h):null,V=this._workerTileHandler;let w;g&&(w=V.getSpriteItems()),this._iconIndexStart=3*this._iconIndexBuffer.index,this._textIndexStart=3*this._textIndexBuffer.index,this._iconIndexCount=0,this._textIndexCount=0,this._markerMap.clear(),this._glyphMap.clear();const B=[];let C=1;T?.size&&(C=T.size/d);const R=T?T.maxAngle*l:0,D=T?T.size*a:0;for(const l of this._symbolFeatures){let e;b&&w&&l.sprite&&(e=w[l.sprite],e&&e.sdf&&(this._isIconSDF=!0));let n;!!e&&b.update(s,l.feature);let g=0;const y=l.label;if(y){t(T),T.update(s,l.feature);const e=h&&T.rotationAlignment===u.MAP?T.keepUpright:T.writingMode&&T.writingMode.includes(p.VERTICAL);let i=.5;switch(T.anchor){case _.TOP_LEFT:case _.LEFT:case _.BOTTOM_LEFT:i=0;break;case _.TOP_RIGHT:case _.RIGHT:case _.BOTTOM_RIGHT:i=1}let o=.5;switch(T.anchor){case _.TOP_LEFT:case _.TOP:case _.TOP_RIGHT:o=0;break;case _.BOTTOM_LEFT:case _.BOTTOM:case _.BOTTOM_RIGHT:o=1}let r=.5;switch(T.justify){case M.AUTO:r=i;break;case M.LEFT:r=0;break;case M.RIGHT:r=1}const x=T.letterSpacing*d,c=h?0:T.maxWidth*d,m=T.lineHeight*d,P=l.textFont.map((e=>V.getGlyphItems(e)));if(n=new f(P,c,m,x,i,o,r).getShaping(y,l.rtl,e),n&&n.length>0){let e=1e30,t=-1e30;for(const i of n)e=Math.min(e,i.x),t=Math.max(t,i.x);g=(t-e+2*d)*C*a}}for(let t of l.geometry){const s=[];if(r===m.LINE){if(n?.length&&T?.size){const e=T.size*a*(2+Math.min(2,4*Math.abs(T.offset[1])));t=L._smoothVertices(t,e)}L._pushAnchors(s,t,x,g)}else r===m.LINE_CENTER?L._pushCenterAnchor(s,t):l.feature.type===i.Polygon?L._pushCentroid(s,t):s.push(new c(t[0].x,t[0].y));for(const i of s){if(i.x<0||i.x>o||i.y<0||i.y>o)continue;if(h&&g>0&&T?.rotationAlignment===u.MAP&&!L._honorsTextMaxAngle(t,i,g,R,D))continue;const s={shaping:n,line:t,iconMosaicItem:e,anchor:i,symbolFeature:l,textColliders:[],iconColliders:[],textVertexRanges:[],iconVertexRanges:[]};B.push(s),this._processFeature(s,b,T)}}}B.sort(A),this._addPlacedGlyphs(),this._symbolInstances=B}serialize(){let e=14;e+=this.layerUIDs.length,e+=3*this.markerPageMap.size,e+=3*this.glyphsPageMap.size,e+=L._symbolsSerializationLength(this._symbolInstances),e+=this._iconVertexBuffer.array.length,e+=this._iconIndexBuffer.array.length,e+=this._textVertexBuffer.array.length,e+=this._textIndexBuffer.array.length;const t=new Uint32Array(e),n=new Int32Array(t.buffer),i=new Float32Array(t.buffer),[s,a,o]=this._sourceTileKey.split("/");let r=0;t[r++]=this.type,t[r++]=this.layerUIDs.length;for(let l=0;l<this.layerUIDs.length;l++)t[r++]=this.layerUIDs[l];t[r++]=this._isIconSDF?1:0,t[r++]=parseFloat(s),t[r++]=parseFloat(a),t[r++]=parseFloat(o),t[r++]=this.markerPageMap.size;for(const[l,[h,x]]of this.markerPageMap)t[r++]=l,t[r++]=h,t[r++]=x;t[r++]=this.glyphsPageMap.size;for(const[l,[h,x]]of this.glyphsPageMap)t[r++]=l,t[r++]=h,t[r++]=x;t[r++]=this._iconVertexBuffer.index/4,t[r++]=this._textVertexBuffer.index/4,r=L.serializeSymbols(t,n,i,r,this._symbolInstances),t[r++]=this._iconVertexBuffer.array.length;for(let l=0;l<this._iconVertexBuffer.array.length;l++)n[r++]=this._iconVertexBuffer.array[l];t[r++]=this._iconIndexBuffer.array.length;for(let l=0;l<this._iconIndexBuffer.array.length;l++)t[r++]=this._iconIndexBuffer.array[l];t[r++]=this._textVertexBuffer.array.length;for(let l=0;l<this._textVertexBuffer.array.length;l++)n[r++]=this._textVertexBuffer.array[l];t[r++]=this._textIndexBuffer.array.length;for(let l=0;l<this._textIndexBuffer.array.length;l++)t[r++]=this._textIndexBuffer.array[l];return t.buffer}static _symbolsSerializationLength(e){let t=0;t+=1;for(const n of e||[]){t+=5,t+=1;for(const e of n.textColliders)t+=b;for(const e of n.iconColliders)t+=b;t+=1,t+=2*n.textVertexRanges.length,t+=1,t+=2*n.iconVertexRanges.length}return t}static serializeSymbols(e,t,n,i,s){s=s||[],t[i++]=s.length;for(const a of s){t[i++]=a.anchor.x,t[i++]=a.anchor.y,t[i++]=a.symbolFeature.hash,t[i++]=a.symbolFeature.priority,t[i++]=a.symbolFeature.feature.featureIndex,t[i++]=a.textColliders.length+a.iconColliders.length;for(const e of a.textColliders)t[i++]=e.xTile,t[i++]=e.yTile,t[i++]=e.dxPixels,t[i++]=e.dyPixels,t[i++]=e.hard?1:0,t[i++]=e.partIndex,n[i++]=e.minLod,n[i++]=e.maxLod,t[i++]=e.width,t[i++]=e.height;for(const e of a.iconColliders)t[i++]=e.xTile,t[i++]=e.yTile,t[i++]=e.dxPixels,t[i++]=e.dyPixels,t[i++]=e.hard?1:0,t[i++]=e.partIndex,n[i++]=e.minLod,n[i++]=e.maxLod,t[i++]=e.width,t[i++]=e.height;t[i++]=a.textVertexRanges.length;for(const[e,n]of a.textVertexRanges)t[i++]=e,t[i++]=n;t[i++]=a.iconVertexRanges.length;for(const[e,n]of a.iconVertexRanges)t[i++]=e,t[i++]=n}return i}_replaceKeys(e,t){return e.replaceAll(/{([^{}]+)}/g,((e,n)=>n in t?t[n]:""))}_processFeature(e,t,n){const{line:i,iconMosaicItem:s,shaping:a,anchor:o}=e,r=this.zoom,l=this.layer,x=!!s;let c=!0;x&&(c=t?.optional||!s);const d=a&&a.length>0,f=!d||n?.optional;let g,y;if(x&&(g=this._placementEngine.getIconPlacement(o,s,t)),(g||c)&&(d&&(y=this._placementEngine.getTextPlacement(o,a,i,n)),y||f)){if(g&&y||(f||c?f||y?c||g||(y=null):g=null:(g=null,y=null)),y){const t=l.hasDataDrivenText?l.textMaterial.encodeAttributes(e.symbolFeature.feature,r,l):null;if(this._storePlacedGlyphs(e,y.shapes,r,n.rotationAlignment,t),y.textColliders){e.textColliders=y.textColliders;for(const e of y.textColliders){e.minLod=Math.max(r+h(e.minLod),0),e.maxLod=Math.min(r+h(e.maxLod),25);const t=e.angle;if(t){const n=Math.cos(t),i=Math.sin(t),s=e.dxPixels*n-e.dyPixels*i,a=e.dxPixels*i+e.dyPixels*n,o=(e.dxPixels+e.width)*n-e.dyPixels*i,r=(e.dxPixels+e.width)*i+e.dyPixels*n,l=e.dxPixels*n-(e.dyPixels+e.height)*i,h=e.dxPixels*i+(e.dyPixels+e.height)*n,x=(e.dxPixels+e.width)*n-(e.dyPixels+e.height)*i,c=(e.dxPixels+e.width)*i+(e.dyPixels+e.height)*n,d=Math.min(s,o,l,x),f=Math.max(s,o,l,x),g=Math.min(a,r,h,c),y=Math.max(a,r,h,c);e.dxPixels=d,e.dyPixels=g,e.width=f-d,e.height=y-g}}}}if(g){const n=l.hasDataDrivenIcon?l.iconMaterial.encodeAttributes(e.symbolFeature.feature,r,l):null;if(this._addPlacedIcons(e,g.shapes,r,s.page,t.rotationAlignment===u.VIEWPORT,n),g.iconColliders){e.iconColliders=g.iconColliders;for(const e of g.iconColliders){e.minLod=Math.max(r+h(e.minLod),0),e.maxLod=Math.min(r+h(e.maxLod),25);const t=e.angle;if(t){const n=Math.cos(t),i=Math.sin(t),s=e.dxPixels*n-e.dyPixels*i,a=e.dxPixels*i+e.dyPixels*n,o=(e.dxPixels+e.width)*n-e.dyPixels*i,r=(e.dxPixels+e.width)*i+e.dyPixels*n,l=e.dxPixels*n-(e.dyPixels+e.height)*i,h=e.dxPixels*i+(e.dyPixels+e.height)*n,x=(e.dxPixels+e.width)*n-(e.dyPixels+e.height)*i,c=(e.dxPixels+e.width)*i+(e.dyPixels+e.height)*n,d=Math.min(s,o,l,x),f=Math.max(s,o,l,x),g=Math.min(a,r,h,c),y=Math.max(a,r,h,c);e.dxPixels=d,e.dyPixels=g,e.width=f-d,e.height=y-g}}}}}}_addPlacedIcons(e,t,n,i,s,a){const o=Math.max(n-1,0),r=this._iconVertexBuffer,l=this._iconIndexBuffer,x=this._markerMap;for(const c of t){const t=s?0:Math.max(n+h(c.minzoom),o),d=s?25:Math.min(n+h(c.maxzoom),25);if(d<=t)continue;const f=c.tl,g=c.tr,y=c.bl,m=c.br,u=c.mosaicRect,p=c.labelAngle,_=c.minAngle,M=c.maxAngle,P=c.anchor,I=r.index,b=u.x,A=u.y,L=b+u.width,T=A+u.height,V=r.index;r.add(P.x,P.y,f.x,f.y,b,A,p,_,M,t,d,a),r.add(P.x,P.y,g.x,g.y,L,A,p,_,M,t,d,a),r.add(P.x,P.y,y.x,y.y,b,T,p,_,M,t,d,a),r.add(P.x,P.y,m.x,m.y,L,T,p,_,M,t,d,a),e.iconVertexRanges.length>0&&e.iconVertexRanges[0][0]+e.iconVertexRanges[0][1]===V?e.iconVertexRanges[0][1]+=4:e.iconVertexRanges.push([V,4]),l.add(I,I+1,I+2),l.add(I+1,I+2,I+3),x.has(i)?x.get(i)[1]+=6:x.set(i,[this._iconIndexStart+this._iconIndexCount,6]),this._iconIndexCount+=6}}_addPlacedGlyphs(){const e=this._textVertexBuffer,t=this._textIndexBuffer,n=this._glyphMap;for(const[i,s]of this._glyphBufferDataStorage)for(const a of s){const s=e.index,o=a.symbolInstance,r=a.ddAttributes,l=e.index;e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.tl[0],a.tl[1],a.xmin,a.ymin,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.tr[0],a.tr[1],a.xmax,a.ymin,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.bl[0],a.bl[1],a.xmin,a.ymax,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),e.add(a.glyphAnchor[0],a.glyphAnchor[1],a.br[0],a.br[1],a.xmax,a.ymax,a.labelAngle,a.minAngle,a.maxAngle,a.minLod,a.maxLod,r),o.textVertexRanges.length>0&&o.textVertexRanges[0][0]+o.textVertexRanges[0][1]===l?o.textVertexRanges[0][1]+=4:o.textVertexRanges.push([l,4]),t.add(s,s+1,s+2),t.add(s+1,s+2,s+3),n.has(i)?n.get(i)[1]+=6:n.set(i,[this._textIndexStart+this._textIndexCount,6]),this._textIndexCount+=6}this._glyphBufferDataStorage.clear()}_storePlacedGlyphs(e,t,n,i,s){const a=Math.max(n-1,0),o=i===u.VIEWPORT;let r,l,x,c,d,f,g,y,m,p,_;for(const u of t){if(r=o?0:Math.max(n+h(u.minzoom),a),l=o?25:Math.min(n+h(u.maxzoom),25),l<=r)continue;x=u.tl,c=u.tr,d=u.bl,f=u.br,g=u.labelAngle,y=u.minAngle,m=u.maxAngle,p=u.anchor,_=u.mosaicRect,this._glyphBufferDataStorage.has(u.page)||this._glyphBufferDataStorage.set(u.page,[]);this._glyphBufferDataStorage.get(u.page).push({glyphAnchor:[p.x,p.y],tl:[x.x,x.y],tr:[c.x,c.y],bl:[d.x,d.y],br:[f.x,f.y],xmin:_.x,ymin:_.y,xmax:_.x+_.width,ymax:_.y+_.height,labelAngle:g,minAngle:y,maxAngle:m,minLod:r,maxLod:l,placementLod:a,symbolInstance:e,ddAttributes:s})}}static _pushAnchors(e,t,n,i){n+=i;let a=0;const o=t.length-1;for(let x=0;x<o;x++)a+=s.distance(t[x],t[x+1]);let r=i||n;if(r*=.5,a<=r)return;const l=r/a;let h=0,d=-(n=a/Math.max(Math.round(a/n),1))/2;const f=t.length-1;for(let s=0;s<f;s++){const i=t[s],a=t[s+1],o=a.x-i.x,r=a.y-i.y,f=Math.sqrt(o*o+r*r);let g;for(;d+n<h+f;){d+=n;const t=(d-h)/f,y=x(i.x,a.x,t),m=x(i.y,a.y,t);void 0===g&&(g=Math.atan2(r,o)),e.push(new c(y,m,g,s,l))}h+=f}}static _pushCenterAnchor(e,t){let n=0;const i=t.length-1;for(let l=0;l<i;l++)n+=s.distance(t[l],t[l+1]);const a=n/2;let o=0;const r=t.length-1;for(let s=0;s<r;s++){const n=t[s],i=t[s+1],r=i.x-n.x,l=i.y-n.y,h=Math.sqrt(r*r+l*l);if(a<o+h){const t=(a-o)/h,d=x(n.x,i.x,t),f=x(n.y,i.y,t),g=Math.atan2(l,r);return void e.push(new c(d,f,g,s,0))}o+=h}}static _deviation(e,t,n){const i=(t.x-e.x)*(n.x-t.x)+(t.y-e.y)*(n.y-t.y),s=(t.x-e.x)*(n.y-t.y)-(t.y-e.y)*(n.x-t.x);return Math.atan2(s,i)}static _honorsTextMaxAngle(e,t,n,i,a){let o=0;const r=n/2;let l=new s(t.x,t.y),h=t.segment+1;for(;o>-r;){if(--h,h<0)return!1;o-=s.distance(e[h],l),l=e[h]}o+=s.distance(e[h],e[h+1]);const x=[];let c=0;const d=e.length;for(;o<r;){const t=e[h];let n,r=h;do{if(++r,r===d)return!1;n=e[r]}while(n.isEqual(t));let l,f=r;do{if(++f,f===d)return!1;l=e[f]}while(l.isEqual(n));const g=this._deviation(t,n,l);for(x.push({deviation:g,distToAnchor:o}),c+=g;o-x[0].distToAnchor>a;)c-=x.shift().deviation;if(Math.abs(c)>i)return!1;o+=s.distance(n,l),h=r}return!0}static _smoothVertices(e,t){if(t<=0)return e;let n=e.length;if(n<3)return e;const i=[];let a=0,o=0;i.push(0);for(let y=1;y<n;y++){const t=s.distance(e[y],e[y-1]);t>0&&(a+=t,i.push(a),o++,o!==y&&(e[o]=e[y]))}if(n=o+1,n<3)return e;t=Math.min(t,.2*a);const r=e[0].x,l=e[0].y,h=e[n-1].x,x=e[n-1].y,c=s.sub(e[0],e[1]);c.normalize(),e[0].x+=t*c.x,e[0].y+=t*c.y,c.assignSub(e[n-1],e[n-2]),c.normalize(),e[n-1].x+=t*c.x,e[n-1].y+=t*c.y,i[0]-=t,i[n-1]+=t;const d=[];d.push(new s(r,l));const f=1e-6,g=.5*t;for(let y=1;y<n-1;y++){let a=0,o=0,r=0;for(let n=y-1;n>=0;n--){const s=g+i[n+1]-i[y];if(s<0)break;const l=i[n+1]-i[n],h=i[y]-i[n]<g?1:s/l;if(h<f)break;const x=h*h,c=h*s-.5*x*l,d=h*l/t,m=e[n+1],u=e[n].x-m.x,p=e[n].y-m.y;a+=d/c*(m.x*h*s+.5*x*(s*u-l*m.x)-x*h*l*u/3),o+=d/c*(m.y*h*s+.5*x*(s*p-l*m.y)-x*h*l*p/3),r+=d}for(let s=y+1;s<n;s++){const n=g-i[s-1]+i[y];if(n<0)break;const l=i[s]-i[s-1],h=i[s]-i[y]<g?1:n/l;if(h<f)break;const x=h*h,c=h*n-.5*x*l,d=h*l/t,m=e[s-1],u=e[s].x-m.x,p=e[s].y-m.y;a+=d/c*(m.x*h*n+.5*x*(n*u-l*m.x)-x*h*l*u/3),o+=d/c*(m.y*h*n+.5*x*(n*p-l*m.y)-x*h*l*p/3),r+=d}d.push(new s(a/r,o/r))}return d.push(new s(h,x)),e[0].x=r,e[0].y=l,e[n-1].x=h,e[n-1].y=x,d}static _pushCentroid(e,t){const n=0,i=0,s=o,a=o,r=t.length-1;let l=0,h=0,x=0,d=t[0].x,f=t[0].y;d>s&&(d=s),d<n&&(d=n),f>a&&(f=a),f<i&&(f=i);for(let o=1;o<r;o++){let e=t[o].x,r=t[o].y,c=t[o+1].x,g=t[o+1].y;e>s&&(e=s),e<n&&(e=n),r>a&&(r=a),r<i&&(r=i),c>s&&(c=s),c<n&&(c=n),g>a&&(g=a),g<i&&(g=i);const y=(e-d)*(g-f)-(c-d)*(r-f);l+=y*(d+e+c),h+=y*(f+r+g),x+=y}l/=3*x,h/=3*x,isNaN(l)||isNaN(h)||e.push(new c(l,h))}}export{L as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
const o=512,t=4096,c=8,e=.125;export{t as tileCoordSize,e as tileCoordinateScale,c as tilePixelRatio,o as tilePixelSize};
|