@arcgis/core 5.1.0-next.80 → 5.1.0-next.82
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/analysis/ShadowCast/DiscreteOptions.d.ts +12 -0
- package/analysis/ShadowCast/TotalDurationOptions.d.ts +12 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/040884cec4b84dd1bb17.js +1 -0
- package/assets/esri/core/workers/chunks/05c5f68e117fc58ae801.js +1 -0
- package/assets/esri/core/workers/chunks/074f5e6aaeafca13bf72.js +1 -0
- package/assets/esri/core/workers/chunks/{7bd1d624f4f4a11a31e8.js → 086d7cdfa92a649c9f7b.js} +1 -1
- package/assets/esri/core/workers/chunks/{0eed2b1b06355ab89013.js → 0c074c46d106ca4d3bad.js} +1 -1
- package/assets/esri/core/workers/chunks/{d7324a00ed576e7a37b1.js → 1768f1a7e3caa6074d91.js} +1 -1
- package/assets/esri/core/workers/chunks/{85d3475667c503ec4fc6.js → 186bfde8c552e3b42302.js} +1 -1
- package/assets/esri/core/workers/chunks/1a35121a0c2595a41fdb.js +1 -0
- package/assets/esri/core/workers/chunks/1ab66600579fa4232d7b.js +1 -0
- package/assets/esri/core/workers/chunks/{d5fd99ee40bba9b48a54.js → 1e2c0c6d724f7639d4c1.js} +27 -27
- package/assets/esri/core/workers/chunks/1e3fe89970c57a883fe5.js +1 -0
- package/assets/esri/core/workers/chunks/{824051af00e7a1f05ed0.js → 230e0e43f8e771950397.js} +1 -1
- package/assets/esri/core/workers/chunks/26f804c92077c11c626d.js +1 -0
- package/assets/esri/core/workers/chunks/28a45bd26eb5c9b3ec7c.js +1 -0
- package/assets/esri/core/workers/chunks/38f1a86b8dd9ee684ee5.js +596 -0
- package/assets/esri/core/workers/chunks/{c1d4110aa494a1dba3c4.js → 455d08294e0f5c5509ff.js} +1 -1
- package/assets/esri/core/workers/chunks/{71fe127734f33d020a44.js → 475394218caaa4cd3e86.js} +1 -1
- package/assets/esri/core/workers/chunks/475409026288f0981ce2.js +1 -0
- package/assets/esri/core/workers/chunks/4e206957b28253ddc1a3.js +1 -0
- package/assets/esri/core/workers/chunks/{87d2021e91d025a2a142.js → 5c7ba4b8a9ec2e2e02b5.js} +1 -1
- package/assets/esri/core/workers/chunks/5cc38ac051d3d0557920.js +1 -0
- package/assets/esri/core/workers/chunks/{992cd87ba0ab6346f692.js → 64e268ebac0b62076f81.js} +1 -1
- package/assets/esri/core/workers/chunks/{003fd7745966fe03510c.js → 65ac73de5bb133c6bf89.js} +1 -1
- package/assets/esri/core/workers/chunks/6675d56f49d07a97dc40.js +1 -0
- package/assets/esri/core/workers/chunks/{1f82a0f134ea912fc686.js → 66fe1634c6e8f72fc653.js} +1 -1
- package/assets/esri/core/workers/chunks/{96b13b6042cdf5833d39.js → 67abbe81c16de26f61d8.js} +1 -1
- package/assets/esri/core/workers/chunks/{484d6c1b0fe1633515b7.js → 72f8f4cfa0842d325fb0.js} +1 -1
- package/assets/esri/core/workers/chunks/{283d39dfb1625b5a74db.js → 747e258f57f0543c836e.js} +1 -1
- package/assets/esri/core/workers/chunks/{dd4f431511edd975a53b.js → 7acf82763aeba44049d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d8e944b192aad4cf986.js → 7b505112c7e6d9b7a239.js} +1 -1
- package/assets/esri/core/workers/chunks/7b8466f892a38a53c600.js +1 -0
- package/assets/esri/core/workers/chunks/{6a0352d20596ca3f4b64.js → 88eb1e4320c4ada01711.js} +1 -1
- package/assets/esri/core/workers/chunks/{77dd719516138afb1a2a.js → 8af9a78cf316581ea482.js} +1 -1
- package/assets/esri/core/workers/chunks/97719271a3e4c9f2b2c9.js +1 -0
- package/assets/esri/core/workers/chunks/988e91cc6cf88c34c2de.js +1 -0
- package/assets/esri/core/workers/chunks/9c402657f63a4d5668d0.js +1 -0
- package/assets/esri/core/workers/chunks/9cac70164d8528c283af.js +1 -0
- package/assets/esri/core/workers/chunks/9ea23cd4b2664c08b670.js +1 -0
- package/assets/esri/core/workers/chunks/9f51a69b8f1937a8794a.js +1 -0
- package/assets/esri/core/workers/chunks/a28124bba6b43efd74cc.js +1 -0
- package/assets/esri/core/workers/chunks/ac5999c88c27b49cd760.js +1 -0
- package/assets/esri/core/workers/chunks/af762422a65c551dcd54.js +1 -0
- package/assets/esri/core/workers/chunks/{056fd7847caaff2c9514.js → af8bc56cf1404afc3028.js} +1 -1
- package/assets/esri/core/workers/chunks/b811d62284be95f4beb6.js +1 -0
- package/assets/esri/core/workers/chunks/b9e163f4a898e50cc854.js +1 -0
- package/assets/esri/core/workers/chunks/{444f0f51b3ee0b9845a5.js → bb2f6b0fcdfb8b158e26.js} +1 -1
- package/assets/esri/core/workers/chunks/{3b9100c59a8050f4834e.js → bbc27d9285162696d089.js} +1 -1
- package/assets/esri/core/workers/chunks/{5da2051f548c2942e01a.js → bc8a74da48b08309875f.js} +1 -1
- package/assets/esri/core/workers/chunks/bd8cb64b6e08839398f3.js +1 -0
- package/assets/esri/core/workers/chunks/{026d3fa331caec1ea3d2.js → bf4dd8e50704e4040966.js} +1 -1
- package/assets/esri/core/workers/chunks/c19e3f6027b6526de359.js +1 -0
- package/assets/esri/core/workers/chunks/c8ef80a7c46d7d2c5172.js +1 -0
- package/assets/esri/core/workers/chunks/cbf1a03f54bd8d2a2b47.js +1 -0
- package/assets/esri/core/workers/chunks/ce4dfc3a470230ddc9e4.js +1 -0
- package/assets/esri/core/workers/chunks/{8ea4584e07ccc85caabd.js → d11de13537b623739e14.js} +1 -1
- package/assets/esri/core/workers/chunks/d897412b99b9fba44bb4.js +1 -0
- package/assets/esri/core/workers/chunks/d9c3f14eee4db7a7137b.js +1 -0
- package/assets/esri/core/workers/chunks/{035dbb0217f83108fa89.js → db86a1119e4e58ecfbda.js} +1 -1
- package/assets/esri/core/workers/chunks/dcb7a3ff59677b1cf0f1.js +1 -0
- package/assets/esri/core/workers/chunks/{5fe97253f80c797fad7f.js → df8a3d3cac454d42e14d.js} +1 -1
- package/assets/esri/core/workers/chunks/dfe1139124fda0d6c059.js +1 -0
- package/assets/esri/core/workers/chunks/{8b8f391f27774aec6db9.js → e0b27bceb397482bd0e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{fb9e3e7cd532ac4353f1.js → e89dc473f46a5584d2ef.js} +32 -32
- package/assets/esri/core/workers/chunks/{01ee18782a50279f907e.js → f4220b6eab0865318033.js} +1 -1
- package/assets/esri/core/workers/chunks/{42336e0d1ef88737b078.js → f468c6ea2818a1f97e19.js} +1 -1
- package/assets/esri/core/workers/chunks/{3f242f8d092f601c3abf.js → f77d23ee60c876b01e4b.js} +1 -1
- package/assets/esri/core/workers/chunks/fce2306a1b31c6680f90.js +1 -0
- package/assets/esri/core/workers/chunks/fcf51697c361e0075cc2.js +1 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +15 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_en.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_en.json +1 -1
- package/chunks/ShadowCastVisualize.glsl.js +33 -15
- package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
- package/chunks/arcgis-knowledge-client-core.js +1 -1
- package/config.js +1 -1
- package/core/workers/registry.js +1 -1
- package/form/elements/inputs/MultipleChoiceInput.d.ts +6 -6
- package/form/elements/inputs/MultipleChoiceInput.js +1 -1
- package/form/elements/inputs.js +1 -1
- package/geometry/SpatialReference.js +1 -1
- package/geometry/support/coordsUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/BaseDynamicLayer.js +1 -1
- package/layers/BaseTileLayer.js +1 -1
- package/layers/ElevationLayer.js +1 -1
- package/layers/FeatureLayer.d.ts +2 -2
- package/layers/FeatureLayer.js +1 -1
- package/layers/MapImageLayer.js +1 -1
- package/layers/TileLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/WMTSLayer.js +1 -1
- package/layers/WebTileLayer.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/MemorySource.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/mixins/TiledImagery.js +1 -1
- package/layers/support/imageBitmapUtils.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/package.json +1 -1
- package/request/process.js +1 -1
- package/rest/knowledgeGraph/CreateReplicaResponse.d.ts +37 -0
- package/rest/knowledgeGraph/CreateReplicaResponse.js +2 -0
- package/rest/knowledgeGraph/ReplicaDefinition.d.ts +91 -0
- package/rest/knowledgeGraph/ReplicaDefinition.js +2 -0
- package/rest/knowledgeGraph/ReplicasInformationResponse.d.ts +24 -0
- package/rest/knowledgeGraph/ReplicasInformationResponse.js +2 -0
- package/rest/knowledgeGraph/UnregisterReplicaResponse.d.ts +44 -0
- package/rest/knowledgeGraph/UnregisterReplicaResponse.js +2 -0
- package/rest/knowledgeGraph/wasmInterface/replicaToWasmEncodedFactories.js +2 -0
- package/rest/knowledgeGraph/wasmInterface/wasmToReplicaFactories.js +2 -0
- package/rest/knowledgeGraphService.d.ts +50 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/RenderBucket.js +1 -1
- package/views/2d/engine/vectorTiles/VTLPainter3D.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/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/FillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/layers/BaseDynamicLayerView2D.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/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/WMSLayerView2D.js +1 -1
- package/views/2d/layers/WMTSLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/layers/ElevationLayerView3D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerWorker.js +2 -0
- package/views/3d/layers/IntegratedMesh3DTilesLayerWorkerHandle.js +2 -0
- package/views/3d/layers/TileLayerView3D.js +1 -1
- package/views/3d/layers/WMTSLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/tessellationUtils.js +1 -1
- package/views/3d/layers/support/IntegratedMesh3DTilesVertexProcessing.js +2 -0
- package/views/3d/layers/support/makeScheduleFunction.js +1 -1
- package/views/3d/support/renderInfoUtils/polygon.js +1 -1
- package/views/3d/terrain/TerrainData.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialInitParameters.js +2 -0
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/NoiseTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlightBuffer.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillVisualizationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/StencilUtils.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/materials/VisualVariablePassParameters.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +2 -0
- package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/colorRampParameters.js +2 -0
- package/views/VideoView.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/input/BrowserEventSource.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/input/handlers/LatestPen.js +2 -0
- package/views/input/handlers/LatestPointer.js +1 -1
- package/views/input/types.d.ts +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/support/TextureCompressionWorker.js +1 -1
- package/views/support/TextureCompressionWorkerHandle.js +1 -1
- package/views/support/unnormalizationUtils.js +2 -0
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/renderState.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/ElevationProfile/support/profileUtils.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/css.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/05c3146d87d917606193.js +0 -1
- package/assets/esri/core/workers/chunks/0b77c124b743067e4155.js +0 -1
- package/assets/esri/core/workers/chunks/11241781baaed346af52.js +0 -1
- package/assets/esri/core/workers/chunks/1d9560eb8b21b9e76616.js +0 -1
- package/assets/esri/core/workers/chunks/2c87c3112a43db8624f6.js +0 -1
- package/assets/esri/core/workers/chunks/2da62687ff678b690839.js +0 -1
- package/assets/esri/core/workers/chunks/3a58708217a9c11836ab.js +0 -1
- package/assets/esri/core/workers/chunks/3bbf684ee2484eb44c9f.js +0 -1
- package/assets/esri/core/workers/chunks/49fb9c47070641bce9a9.js +0 -1
- package/assets/esri/core/workers/chunks/4eed175277eb0df3c821.js +0 -1
- package/assets/esri/core/workers/chunks/4f9d027055f3a616173c.js +0 -1
- package/assets/esri/core/workers/chunks/5417308eba30e668b1ee.js +0 -1
- package/assets/esri/core/workers/chunks/62b3e933f548ce354b99.js +0 -1
- package/assets/esri/core/workers/chunks/63381d81adce0a0d2089.js +0 -1
- package/assets/esri/core/workers/chunks/6dbddf5ab1867ac2ac80.js +0 -1
- package/assets/esri/core/workers/chunks/6e70e922331704b92a08.js +0 -1
- package/assets/esri/core/workers/chunks/7c7c11c0fde8b63e330b.js +0 -1
- package/assets/esri/core/workers/chunks/7f55eef696e9ed717bfc.js +0 -1
- package/assets/esri/core/workers/chunks/89dbea6f436d45a3b185.js +0 -1
- package/assets/esri/core/workers/chunks/8f6f5dad52747d252aac.js +0 -596
- package/assets/esri/core/workers/chunks/99c189e1de2b1f14799b.js +0 -1
- package/assets/esri/core/workers/chunks/9aa6b32cb65fbaa93218.js +0 -1
- package/assets/esri/core/workers/chunks/9d216e30d04ea21fc8a2.js +0 -1
- package/assets/esri/core/workers/chunks/9d434360dfce1e49b7b9.js +0 -1
- package/assets/esri/core/workers/chunks/a5d8d6f3c0c8de474efd.js +0 -1
- package/assets/esri/core/workers/chunks/a809b811121099a87a98.js +0 -1
- package/assets/esri/core/workers/chunks/c02ba921c0a32d2021e3.js +0 -1
- package/assets/esri/core/workers/chunks/c3c19b62d948d53118a8.js +0 -1
- package/assets/esri/core/workers/chunks/c46a4adea39636a96d03.js +0 -1
- package/assets/esri/core/workers/chunks/c5507480344176fad241.js +0 -1
- package/assets/esri/core/workers/chunks/c6030271bd6d39b6e1db.js +0 -1
- package/assets/esri/core/workers/chunks/d1a7d13e1d48abcd7bf1.js +0 -1
- package/assets/esri/core/workers/chunks/dcbc4072c18278c2b67d.js +0 -1
- package/assets/esri/core/workers/chunks/e610d24539a675fb054b.js +0 -1
- package/assets/esri/core/workers/chunks/ecb7ede6a8e6c05e4c6c.js +0 -1
- package/assets/esri/core/workers/chunks/f227b34cce6843df0fb6.js +0 -1
- package/assets/esri/core/workers/chunks/fb5a2205f05afc396119.js +0 -1
- package/request/ImageWithType.js +0 -2
- package/views/3d/layers/support/fetchTile.js +0 -2
- package/views/interactive/editGeometry/unnormalizationHelper.js +0 -2
package/layers/FeatureLayer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import r from"../request.js";import{ClonableMixin as i}from"../core/Clonable.js";import o from"../core/Collection.js";import s from"../core/Error.js";import{clone as a}from"../core/lang.js";import n from"../core/Logger.js";import{destroyMaybe as l}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as p}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as u}from"../core/object.js";import{debounce as d,throwIfAbortError as y,whenOrAbort as c}from"../core/promiseUtils.js";import{sqlAnd as m}from"../core/sql.js";import{property as f,subclass as h}from"../core/accessorSupport/decorators.js";import{excludeTables as b}from"../core/accessorSupport/layerContainerType.js";import g from"../form/FormTemplate.js";import w from"../geometry/SpatialReference.js";import v from"../graphic/FeatureGraphicOrigin.js";import F from"./Layer.js";import{MemorySource as T}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as j}from"./mixins/APIKeyMixin.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as I}from"./mixins/BlendLayer.js";import{CustomParametersMixin as E}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as L}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as D}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as _}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as C}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as P}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as O}from"./mixins/OperationalLayer.js";import{OrderedLayer as x}from"./mixins/OrderedLayer.js";import{PortalLayer as q}from"./mixins/PortalLayer.js";import{PublishableLayer as M}from"./mixins/PublishableLayer.js";import{RefreshableLayer as A}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as Q}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as R}from"./mixins/TemporalLayer.js";import{TrackableLayer as U}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as V,parse as N,cleanTitle as B}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as G,id as J,labelsVisible as W,opacityDrawingInfo as Z,legendEnabled as $,listMode as H,popupEnabled as z,screenSizePerspectiveEnabled as k}from"./support/commonProperties.js";import{ensureLayerCredential as K,computeEffectiveEditingEnabled as X,readGlobalIdField as Y,readObjectIdField as ee,createDefaultRenderer as te,addAttachment as re,updateAttachment as ie,applyEdits as oe,uploadAssets as se,createQuery as ae,deleteAttachments as ne,fetchRecomputedExtents as le,getFeatureType as pe,getFieldDomain as ue,queryAttachments as de,queryObjectIds as ye,queryFeatureCount as ce,queryExtent as me,queryRelatedFeatures as fe,queryRelatedFeaturesCount as he,validateBinsQuery as be,hasDataChanged as ge,geometryTypeKebabDict as we}from"./support/featureLayerUtils.js";import ve from"./support/FeatureTemplate.js";import Fe from"./support/FeatureType.js";import Te from"./support/FieldConfiguration.js";import{popupTemplateWithFieldConfigurations as je,fieldConfigurationsFromPopupTemplate as Se,fieldConfigurationsFromFields as Ie}from"./support/fieldConfigUtils.js";import{defineFieldProperties as Ee}from"./support/fieldProperties.js";import{fixRendererFields as Le,fixTimeInfoFields as De}from"./support/fieldUtils.js";import _e from"./support/LabelClass.js";import{reader as Ce}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Pe}from"./support/serviceCapabilitiesUtils.js";import Oe from"./support/SymbolLayerDrawing.js";import xe from"./support/TimeInfo.js";import qe from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as Me}from"./support/versionUtils.js";import{read as Ae}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Qe}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Re,rendererTypes as Ue}from"../renderers/support/typeUtils.js";import Ve from"../rest/layerSources/DynamicDataLayer.js";import Ne from"../rest/support/FeatureSet.js";import Be from"../rest/support/Query.js";import{isNumber as Ge}from"../support/guards.js";import{createPopupTemplate as Je}from"../support/popupUtils.js";import{symbolTypes as We}from"../symbols/support/typeUtils.js";import{opacityToTransparency as Ze}from"../webdoc/support/opacityUtils.js";import{addLayerUnsupportedError as $e}from"../webdoc/support/unsupportedErrors.js";import{reader as He}from"../core/accessorSupport/decorators/reader.js";import{writer as ze}from"../core/accessorSupport/decorators/writer.js";const ke="FeatureLayer";function Ke(e){return e&&e instanceof o}const Xe=Ee();function Ye(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let et=class extends(C(P(_(M(D(L(I(x(R(U(Q(A(S(O(q(p(E(j(i(F)))))))))))))))))))){constructor(...e){super(...e),this.attributeTableTemplate=null,this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.graphicOrigin=new v(this),this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.symbolLayerDrawing=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="ArcGISFeatureLayer",this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.resourceInfo=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=w.WGS84,this.subtypeCode=null,this.subtypeField=null,this.subtypes=null,this.supportedSourceTypes=new Set(["Feature Layer","Oriented Imagery Layer","Table","Catalog Layer"]),this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.type="feature",this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=d(async(e,t,r)=>{const{save:i,saveAs:o}=await import("./save/featureLayerUtils.js");switch(e){case 0:return i(this,t);case 1:return o(this,r,t)}})}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;if(this.portalItem?.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(t).then(e=>this.initLayerProperties(e))),Promise.resolve(this);const r=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},e).catch(y).then(async()=>{if(this.url&&null==this.layerId&&/FeatureServer|MapServer\/*$/i.test(this.url)){const e=await this._fetchFirstValidLayerId(t);null!=e&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new s("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this.initLayerProperties(await this.createGraphicsSource(t))}).then(()=>K(this,"load",e));return this.addResolvingPromise(r),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return l(e),new qe({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,fields:this.fields,displayField:this.displayField,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}readCapabilities(e,t){return t=t.layerDefinition||t,Pe(t,this.url)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return!(this.loaded&&!this.capabilities?.operations.supportsEditing)&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,r){return this._readEditingEnabled(t,!0,r)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,r,i){this._writeEditingEnabled(e,t,!0,i)}get effectiveEditingEnabled(){return X(this)}get featureTitleFields(){return[...this._titleCreator.requiredFields]}set fieldConfigurations(e){if(this._hasMemorySource())return;if(this._override("fieldConfigurations",e),!this.loaded)return;const t=je(this,e);t&&this._set("popupTemplate",t)}get fieldConfigurations(){if(!this._hasMemorySource())return this._isOverridden("fieldConfigurations")?this._get("fieldConfigurations"):Se(this)||null}readIsTable(e,t){return"Table"===(t=t?.layerDefinition??t).type||!t.geometryType}writeIsTable(e,t,r,i){i?.writeLayerSchema&&u(r,e?"Table":"Feature Layer",t)}readGlobalIdField(e,t){return Y(t.layerDefinition||t)}readObjectIdField(e,t){return ee(t.layerDefinition||t)}writePopupTemplate(e,t,r,i){e&&(t[r]=e.toJSON({...i,writeFieldFormat:!i?.writeLayerSchema}))}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Le(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,r){t=t.layerDefinition||t;const i=t.drawingInfo?.renderer;if(i){const e=Ae(i,t,r)??void 0;return e||n.getLogger(this).error("Failed to create renderer",{rendererDefinition:t.drawingInfo.renderer,layer:this,context:r}),e}return te(t,r)}get source(){return this._get("source")}set source(e){e||(e=null);const t=this._get("source");t!==e&&((Array.isArray(e)||e instanceof o)&&(e=new T({layer:this,items:e})),Ke(t)&&this._resetMemorySource(t),Ke(e)&&this._initMemorySource(e),this._set("source",e))}readSource(e,t){const r=Ne.fromJSON(t.featureSet);return new T({layer:this,items:r?.features??[]})}readTemplates(e,t){const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e=e?.map(e=>ve.fromJSON(e)),this._fixTemplates(e,i),this._fixTemplates(e,o),e}readTitle(e,t){const r=t.layerDefinition?.name??t.name,i=t.title||t.layerDefinition?.title;if(r){if("item-title"===this.sublayerTitleMode)return this.url?V(this.url,r):r;let e=r;if(!e&&this.url){const t=N(this.url);null!=t&&(e=t.title)}if(!e)return;const t=this.portalItem?.title;return"item-title-and-service-name"===this.sublayerTitleMode&&t&&t!==e&&(e=t+" - "+e),B(e)}if("item-title"===this.sublayerTitleMode&&i)return i}readTitleFromWebMap(e,t){return t.title||t.layerDefinition?.name}readTypeIdField(e,t){let r=(t=t.layerDefinition||t).typeIdField;if(r&&t.fields){r=r.toLowerCase();const e=t.fields.find(e=>e.name.toLowerCase()===r);e&&(r=e.name)}return r}readTypes(e,t){e=(t=t.layerDefinition||t).types;const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e?.map(e=>(e=Fe.fromJSON(e),this._fixTemplates(e.templates,i),this._fixTemplates(e.templates,o),e))}readVisible(e,t){return null!=t.layerDefinition?.defaultVisibility?!!t.layerDefinition.defaultVisibility:null!=t.visibility?!!t.visibility:void 0}async addAttachment(e,t){const r=await re(this,e,t,ke);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const i=await ie(this,e,t,r,ke);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return oe(this,e,t)}async uploadAssets(e,t){return se(this,e,t)}createFieldConfigurations(){return Ie(this)}createPopupTemplate(e){return Je(this,e)}async createGraphicsSource(e){if(this._hasMemorySource()&&this.source)return this.source.load({signal:e});const{default:t}=await c(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=ae(this);e.dynamicDataSource=this.dynamicDataSource;const t=null!=this.subtypeCode?`${this.subtypeField} = ${this.subtypeCode}`:null,r=m(this.definitionExpression,t);return e.where=r||"1=1",e}async deleteAttachments(e,t){const r=await ne(this,e,t,ke);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return le(this,e,ke)}async getFeatureTitle(e,t){return this._titleCreator.getTitle(this,e,t)}async getFeatureTitles(e,t){return this._titleCreator.getTitles(this,e,t)}getFeatureType(e){return pe(this.types,this.typeIdField,e)}getFieldAlias(e){const t=this.getField(e);if(t)return this.getFieldConfiguration(t.name)?.alias||t.alias}getFieldConfiguration(e){return e=e.toLowerCase(),this.fieldConfigurations?.find(t=>t.name.toLowerCase()===e)}getFieldDomain(e,t){return ue(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return de(this,e,t,ke)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(Be.from(e)??r.createQuery(),t),o=this.graphicOrigin;if(i?.features)for(const s of i.features)s.layer=s.sourceLayer=r,s.origin=o;return i}async queryObjectIds(e,t){return await ye(this,e,t,ke)}async queryFeatureCount(e,t){return ce(this,e,t,ke)}async queryExtent(e,t){return me(this,e,t,ke)}async queryRelatedFeatures(e,t){return fe(this,e,t,ke)}async queryRelatedFeaturesCount(e,t){return he(this,e,t,ke)}async queryPivot(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryPivot||!i?.operations?.supportsQueryPivot)throw new s(ke,"Layer source does not support queryPivot capability");const o=await import("../rest/support/PivotQuery.js"),a=await r.queryPivot(o.default.from(e),t),n=this.graphicOrigin;if(a?.features)for(const s of a.features)s.layer=s.sourceLayer=this,s.origin=n;return a}async queryTopFeatures(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopFeatures||!i?.query?.supportsTopFeaturesQuery)throw new s(ke,"Layer source does not support queryTopFeatures capability");const o=await import("../rest/support/TopFeaturesQuery.js"),a=await r.queryTopFeatures(o.default.from(e),t),n=this.graphicOrigin;if(a?.features)for(const s of a.features)s.layer=s.sourceLayer=this,s.origin=n;return a}async queryAttributeBins(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryAttributeBins)throw new s(ke,"Layer source does not support queryAttributeBins capability");be(e,i,ke);const o=await import("../rest/support/AttributeBinsQuery.js"),a=await r.queryAttributeBins(o.default.from(e),t),n=this.graphicOrigin;if(a.features)for(const s of a.features)s.layer=s.sourceLayer=this,s.origin=n;return a}async queryTopObjectIds(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopObjectIds||!i?.query.supportsTopFeaturesQuery)throw new s(ke,"Layer source does not support queryTopObjectIds capability");const o=await import("../rest/support/TopFeaturesQuery.js");return(await r.queryTopObjectIds(o.default.from(e),t)).filter(Ge)}async queryTopFeaturesExtent(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopExtents||!i?.query?.supportsTopFeaturesQuery)throw new s(ke,"Layer source does not support queryTopExtents capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopExtents(o.default.from(e),t)}async queryTopFeatureCount(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopCount||!i?.query?.supportsTopFeaturesQuery)throw new s(ke,"Layer source does not support queryFeatureCount capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopCount(o.default.from(e),t)}read(e,t){const r=e.featureCollection;if((r||"Feature Collection"===e.type)&&(this.resourceInfo=e),r){const{layers:e,showLegend:i}=r;1===e?.length&&(super.read(e[0],t),null!=i&&super.read({showLegend:i},t))}super.read(e,t),"service"===t?.origin&&(["objectIdField","fields","timeInfo","dateFieldsTimeZone"].forEach(e=>this.revertToOrigin(e,"service")),this.spatialReference||this.revertToOrigin("spatialReference","service"))}write(e,t){t={...t,origin:t?.origin??void 0,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};const{origin:r,layerContainerType:i}=t;if(this.dynamicDataSource)return $e(t,this,"a dynamic data source cannot be written to web scenes, web maps and feature service items"),null;if(this.isTable){if(("web-map"===r||"web-scene"===r)&&"tables"!==i)return $e(t,this,"a table source can only be written to tables"),null;if(this._hasMemorySource())return $e(t,this,"an in-memory table source cannot be written to web scenes and web maps"),null}else if(this.loaded&&("web-map"===r||"web-scene"===r)&&"tables"===i)return $e(t,this,"a non-table source cannot be written to tables in web maps or web scenes"),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new s(ke,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return!!this.loaded&&("memory"===this.source?.type||Me(this,e))}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}_readEditingEnabled(e,t,r){let i=e.layerDefinition?.capabilities;return i?this._hasEditingCapability(i):(i=e.capabilities,t&&"web-map"===r?.origin&&!this._hasMemorySource()&&i?this._hasEditingCapability(i):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map(e=>e.trim()).includes("editing")}_writeEditingEnabled(e,t,r,i){if(!e){const e=this.capabilities?.operations?.supportsSync?"Query,Sync":"Query";u("layerDefinition.capabilities",e,t),r&&!i?.writeLayerSchema&&(t.capabilities=e)}}_fetchFirstValidLayerId(e){return r(this.url??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then(e=>{const t=e.data;if(t)return this.applyPreferredHost(t),this.findFirstValidLayerId(t)})}async initLayerProperties(e){return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),Le(this.renderer,this.fieldsIndex),De(this.timeInfo,this.fieldsIndex),this._hasMemorySource()&&"mesh"===this.geometryType&&(this.capabilities.query.supportsReturnMesh=!0),Qe(this,{origin:"service"})}async hasDataChanged(){return ge(this)}async fetchPublishingStatus(){const e=this.source;return e?.fetchPublishingStatus?e.fetchPublishingStatus():"unavailable"}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some(e=>"geometry"===e.type)||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,t){e&&e.forEach(e=>{const r=e.prototype?.attributes;r&&t&&delete r[t]})}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new s("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new s("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach(e=>{e.layer=this,e.sourceLayer=this}),this.addHandles([e.on("after-add",e=>{e.item.layer=this,e.item.sourceLayer=this}),e.on("after-remove",e=>{e.item.layer=null,e.item.sourceLayer=null})],"fl-source")}_resetMemorySource(e){e.forEach(e=>{e.layer=null,e.sourceLayer=null}),this.removeHandles("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}findFirstValidLayerId(e){const t=[...e.layers||[],...e.tables||[]];return t.find(({type:e})=>!e||this.supportedSourceTypes.has(e))?.id}};e([f({clonable:!1,readOnly:!0})],et.prototype,"_titleCreator",null),e([f(G)],et.prototype,"attributeTableTemplate",void 0),e([He("service","capabilities")],et.prototype,"readCapabilities",null),e([f({json:{origins:{"web-scene":{write:!1}},write:!0}})],et.prototype,"charts",void 0),e([f({readOnly:!0})],et.prototype,"createQueryVersion",null),e([f({json:{read:{source:"layerDefinition.copyrightText"}}})],et.prototype,"copyright",void 0),e([f({json:{read:{source:"layerDefinition.displayField"}}})],et.prototype,"displayField",void 0),e([f({types:We,readOnly:!0})],et.prototype,"defaultSymbol",void 0),e([f({type:Ve})],et.prototype,"dynamicDataSource",void 0),e([f({type:Boolean})],et.prototype,"editingEnabled",null),e([He(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],et.prototype,"readEditingEnabled",null),e([He("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],et.prototype,"readEditingEnabledFromWebMap",null),e([ze(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],et.prototype,"writeEditingEnabled",null),e([ze("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],et.prototype,"writeEditingEnabledToWebMap",null),e([f({readOnly:!0})],et.prototype,"effectiveEditingEnabled",null),e([f({clonable:!1,readOnly:!0})],et.prototype,"featureTitleFields",null),e([f({type:[Te],json:{name:"layerDefinition.fieldConfigurations",write:{overridePolicy(e,t,r){return{enabled:!r?.writeLayerSchema,ignoreOrigin:1===this.originIdOf(t)}}}}})],et.prototype,"fieldConfigurations",null),e([f({...Xe.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:Ye}}}}})],et.prototype,"fields",void 0),e([f(Xe.fieldsIndex)],et.prototype,"fieldsIndex",void 0),e([f({type:g,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],et.prototype,"formTemplate",void 0),e([f({json:{read:{source:"layerDefinition.extent"}}})],et.prototype,"fullExtent",void 0),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:Ye,writer(e,t,r){const i=e?we.toJSON(e):null;i&&u(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:we.read}}})],et.prototype,"geometryType",void 0),e([f({readOnly:!0,clonable:!1})],et.prototype,"graphicOrigin",void 0),e([f({json:{read:{source:"layerDefinition.hasM"}}})],et.prototype,"hasM",void 0),e([f({json:{read:{source:"layerDefinition.hasZ"}}})],et.prototype,"hasZ",void 0),e([f(J)],et.prototype,"id",void 0),e([f({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],et.prototype,"infoFor3D",void 0),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],et.prototype,"isTable",void 0),e([He("service","isTable",["type","geometryType"]),He("isTable",["layerDefinition.type","layerDefinition.geometryType"])],et.prototype,"readIsTable",null),e([ze("web-map","isTable")],et.prototype,"writeIsTable",null),e([f(W)],et.prototype,"labelsVisible",void 0),e([f({type:[_e],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:Ce,write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:Ce,write:{layerContainerTypes:b}}})],et.prototype,"labelingInfo",void 0),e([f({type:Oe,json:{name:"layerDefinition.drawingInfo.symbolLayerDrawing",write:!0,origins:{"web-scene":{write:!1}}}})],et.prototype,"symbolLayerDrawing",void 0),e([f((()=>{const e=a(Z);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,t,r){u(r,Ze(e),t)}}},e})())],et.prototype,"opacity",void 0),e([f($)],et.prototype,"legendEnabled",void 0),e([f({type:["show","hide"],json:(()=>{const e=a(H.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],et.prototype,"listMode",void 0),e([He("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],et.prototype,"readGlobalIdField",null),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:Ye}}}}})],et.prototype,"objectIdField",void 0),e([He("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],et.prototype,"readObjectIdField",null),e([f({type:["ArcGISFeatureLayer"],json:{write:{target:"layerType",ignoreOrigin:!0,layerContainerTypes:b}}})],et.prototype,"operationalLayerType",void 0),e([f(Xe.outFields)],et.prototype,"outFields",void 0),e([f({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],et.prototype,"path",void 0),e([f(z)],et.prototype,"popupEnabled",void 0),e([f({type:t,json:{name:"popupInfo",write:!0}})],et.prototype,"popupTemplate",void 0),e([ze("popupTemplate")],et.prototype,"writePopupTemplate",null),e([f({readOnly:!0})],et.prototype,"defaultPopupTemplate",null),e([f({types:Ue,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:Re,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:b,overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:b})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:b})}}})],et.prototype,"renderer",null),e([He("service","renderer",["drawingInfo.renderer","defaultSymbol"]),He("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],et.prototype,"readRenderer",null),e([f()],et.prototype,"resourceInfo",void 0),e([f((()=>{const e=a(k);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],et.prototype,"screenSizePerspectiveEnabled",void 0),e([f({clonable:!1})],et.prototype,"source",null),e([He("portal-item","source",["featureSet"]),He("web-map","source",["featureSet"])],et.prototype,"readSource",null),e([f({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],et.prototype,"spatialReference",void 0),e([f({type:Number})],et.prototype,"subtypeCode",void 0),e([f({readOnly:!1})],et.prototype,"subtypeField",void 0),e([f({readOnly:!1})],et.prototype,"subtypes",void 0),e([f({type:[ve]})],et.prototype,"templates",void 0),e([He("templates",["editFieldsInfo","creatorField","editorField","templates"])],et.prototype,"readTemplates",null),e([f({type:xe})],et.prototype,"timeInfo",void 0),e([f()],et.prototype,"title",void 0),e([He("service","title",["name"]),He("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],et.prototype,"readTitle",null),e([He("web-map","title",["layerDefinition.name","title"])],et.prototype,"readTitleFromWebMap",null),e([f({type:String})],et.prototype,"sublayerTitleMode",void 0),e([f({json:{read:!1}})],et.prototype,"type",void 0),e([f({type:String})],et.prototype,"typeIdField",void 0),e([He("service","typeIdField"),He("typeIdField",["layerDefinition.typeIdField"])],et.prototype,"readTypeIdField",null),e([f({type:[Fe]})],et.prototype,"types",void 0),e([He("service","types",["types"]),He("types",["layerDefinition.types"])],et.prototype,"readTypes",null),e([f({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility",layerContainerTypes:b}}}}})],et.prototype,"visible",void 0),e([He("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],et.prototype,"readVisible",null),et=e([h("esri.layers.FeatureLayer")],et);export{et as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../PopupTemplate.js";import r from"../request.js";import{ClonableMixin as i}from"../core/Clonable.js";import o from"../core/Collection.js";import s from"../core/Error.js";import{clone as a}from"../core/lang.js";import n from"../core/Logger.js";import{destroyMaybe as l}from"../core/maybe.js";import{MultiOriginJSONSupportMixin as p}from"../core/MultiOriginJSONSupport.js";import{setDeepValue as u}from"../core/object.js";import{debounce as d,throwIfAbortError as y,whenOrAbort as c}from"../core/promiseUtils.js";import{sqlAnd as m}from"../core/sql.js";import{property as f,subclass as h}from"../core/accessorSupport/decorators.js";import{excludeTables as b}from"../core/accessorSupport/layerContainerType.js";import g from"../form/FormTemplate.js";import w from"../geometry/SpatialReference.js";import v from"../graphic/FeatureGraphicOrigin.js";import F from"./Layer.js";import{MemorySource as T}from"./graphics/sources/MemorySource.js";import{APIKeyMixin as j}from"./mixins/APIKeyMixin.js";import{ArcGISService as S}from"./mixins/ArcGISService.js";import{BlendLayer as I}from"./mixins/BlendLayer.js";import{CustomParametersMixin as E}from"./mixins/CustomParametersMixin.js";import{DisplayFilteredLayer as L}from"./mixins/DisplayFilteredLayer.js";import{EditBusLayer as D}from"./mixins/EditBusLayer.js";import{FeatureEffectLayer as _}from"./mixins/FeatureEffectLayer.js";import{FeatureLayerBase as C}from"./mixins/FeatureLayerBase.js";import{FeatureReductionLayer as P}from"./mixins/FeatureReductionLayer.js";import{OperationalLayer as O}from"./mixins/OperationalLayer.js";import{OrderedLayer as x}from"./mixins/OrderedLayer.js";import{PortalLayer as q}from"./mixins/PortalLayer.js";import{PublishableLayer as M}from"./mixins/PublishableLayer.js";import{RefreshableLayer as A}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as Q}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as R}from"./mixins/TemporalLayer.js";import{TrackableLayer as U}from"./mixins/TrackableLayer.js";import{titleFromUrlAndName as V,parse as N,cleanTitle as B}from"./support/arcgisLayerUrl.js";import{attributeTableTemplate as G,id as J,labelsVisible as W,opacityDrawingInfo as Z,legendEnabled as $,listMode as H,popupEnabled as z,screenSizePerspectiveEnabled as k}from"./support/commonProperties.js";import{ensureLayerCredential as K,computeEffectiveEditingEnabled as X,readGlobalIdField as Y,readObjectIdField as ee,createDefaultRenderer as te,addAttachment as re,updateAttachment as ie,applyEdits as oe,uploadAssets as se,createQuery as ae,deleteAttachments as ne,fetchRecomputedExtents as le,getFeatureType as pe,getFieldDomain as ue,queryAttachments as de,queryObjectIds as ye,queryFeatureCount as ce,queryExtent as me,queryRelatedFeatures as fe,queryRelatedFeaturesCount as he,validateBinsQuery as be,hasDataChanged as ge,geometryTypeKebabDict as we}from"./support/featureLayerUtils.js";import ve from"./support/FeatureTemplate.js";import Fe from"./support/FeatureType.js";import Te from"./support/FieldConfiguration.js";import{popupTemplateWithFieldConfigurations as je,fieldConfigurationsFromPopupTemplate as Se,fieldConfigurationsFromFields as Ie}from"./support/fieldConfigUtils.js";import{defineFieldProperties as Ee}from"./support/fieldProperties.js";import{fixRendererFields as Le,fixTimeInfoFields as De}from"./support/fieldUtils.js";import _e from"./support/LabelClass.js";import{reader as Ce}from"./support/labelingInfo.js";import{getFeatureLayerCapabilities as Pe}from"./support/serviceCapabilitiesUtils.js";import Oe from"./support/SymbolLayerDrawing.js";import xe from"./support/TimeInfo.js";import qe from"./support/TitleCreator.js";import{serviceSupportsSpatialReference as Me}from"./support/versionUtils.js";import{read as Ae}from"../renderers/support/jsonUtils.js";import{loadStyleRenderer as Qe}from"../renderers/support/styleUtils.js";import{webSceneRendererTypes as Re,rendererTypes as Ue}from"../renderers/support/typeUtils.js";import Ve from"../rest/layerSources/DynamicDataLayer.js";import Ne from"../rest/support/FeatureSet.js";import Be from"../rest/support/Query.js";import{isNumber as Ge}from"../support/guards.js";import{createPopupTemplate as Je}from"../support/popupUtils.js";import{symbolTypes as We}from"../symbols/support/typeUtils.js";import{opacityToTransparency as Ze}from"../webdoc/support/opacityUtils.js";import{addLayerUnsupportedError as $e}from"../webdoc/support/unsupportedErrors.js";import{reader as He}from"../core/accessorSupport/decorators/reader.js";import{writer as ze}from"../core/accessorSupport/decorators/writer.js";const ke="FeatureLayer";function Ke(e){return e&&e instanceof o}const Xe=Ee();function Ye(e,t,r){const i=!!r?.writeLayerSchema;return{enabled:i,ignoreOrigin:i}}let et=class extends(C(P(_(M(D(L(I(x(R(U(Q(A(S(O(q(p(E(j(i(F)))))))))))))))))))){constructor(...e){super(...e),this.attributeTableTemplate=null,this.charts=null,this.copyright=null,this.displayField=null,this.dynamicDataSource=null,this.fields=null,this.fieldsIndex=null,this.formTemplate=null,this.fullExtent=null,this.geometryType=null,this.graphicOrigin=new v(this),this.hasM=void 0,this.hasZ=void 0,this.infoFor3D=null,this.isTable=!1,this.labelsVisible=!0,this.labelingInfo=null,this.symbolLayerDrawing=null,this.legendEnabled=!0,this.objectIdField=null,this.operationalLayerType="ArcGISFeatureLayer",this.outFields=null,this.path=null,this.popupEnabled=!0,this.popupTemplate=null,this.resourceInfo=null,this.screenSizePerspectiveEnabled=!0,this.spatialReference=w.WGS84,this.subtypeCode=null,this.subtypeField=null,this.subtypes=null,this.supportedSourceTypes=new Set(["Feature Layer","Oriented Imagery Layer","Table","Catalog Layer"]),this.templates=null,this.timeInfo=null,this.title=null,this.sublayerTitleMode="item-title",this.type="feature",this.typeIdField=null,this.types=null,this.visible=!0,this._debouncedSaveOperations=d(async(e,t,r)=>{const{save:i,saveAs:o}=await import("./save/featureLayerUtils.js");switch(e){case 0:return i(this,t);case 1:return o(this,r,t)}})}destroy(){this.source?.destroy()}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){const t=null!=e?e.signal:null;if(this.portalItem?.loaded&&this.source)return this.addResolvingPromise(this.createGraphicsSource(t).then(e=>this.initLayerProperties(e))),Promise.resolve(this);const r=this.loadFromPortal({supportedTypes:["Feature Service","Feature Collection","Scene Service"]},e).catch(y).then(async()=>{if(this.url&&null==this.layerId&&/FeatureServer|MapServer\/*$/i.test(this.url)){const e=await this._fetchFirstValidLayerId(t);null!=e&&(this.layerId=e)}if(!this.url&&!this._hasMemorySource())throw new s("feature-layer:missing-url-or-source","Feature layer must be created with either a url or a source");return this.initLayerProperties(await this.createGraphicsSource(t))}).then(()=>K(this,"load",e));return this.addResolvingPromise(r),Promise.resolve(this)}get _titleCreator(){const e=this._get("_titleCreator");return l(e),new qe({fieldsIndex:this.fieldsIndex,objectIdField:this.objectIdField,fields:this.fields,displayField:this.displayField,effectivePopupTemplate:this.popupTemplate??this.defaultPopupTemplate})}readCapabilities(e,t){return t=t.layerDefinition||t,Pe(t,this.url)}get createQueryVersion(){return this.commitProperty("definitionExpression"),this.commitProperty("dynamicDataSource"),this.commitProperty("timeExtent"),this.commitProperty("timeOffset"),this.commitProperty("geometryType"),this.commitProperty("gdbVersion"),this.commitProperty("historicMoment"),this.commitProperty("returnZ"),this.commitProperty("capabilities"),this.commitProperty("returnM"),(this._get("createQueryVersion")??0)+1}get editingEnabled(){return!(this.loaded&&!this.capabilities?.operations.supportsEditing)&&(this._isOverridden("editingEnabled")?this._get("editingEnabled"):this._hasMemorySource()||this.userHasEditingPrivileges)}set editingEnabled(e){this._overrideIfSome("editingEnabled",e)}readEditingEnabled(e,t){return this._readEditingEnabled(t,!1)}readEditingEnabledFromWebMap(e,t,r){return this._readEditingEnabled(t,!0,r)}writeEditingEnabled(e,t){this._writeEditingEnabled(e,t,!1)}writeEditingEnabledToWebMap(e,t,r,i){this._writeEditingEnabled(e,t,!0,i)}get effectiveEditingEnabled(){return X(this)}get featureTitleFields(){return[...this._titleCreator.requiredFields]}set fieldConfigurations(e){if(this._hasMemorySource())return;if(this._override("fieldConfigurations",e),!this.loaded)return;const t=je(this,e);t&&this._set("popupTemplate",t)}get fieldConfigurations(){if(!this._hasMemorySource())return this._isOverridden("fieldConfigurations")?this._get("fieldConfigurations"):Se(this)||null}readIsTable(e,t){return"Table"===(t=t?.layerDefinition??t).type||!t.geometryType}writeIsTable(e,t,r,i){i?.writeLayerSchema&&u(r,e?"Table":"Feature Layer",t)}readGlobalIdField(e,t){return Y(t.layerDefinition||t)}readObjectIdField(e,t){return ee(t.layerDefinition||t)}writePopupTemplate(e,t,r,i){e&&(t[r]=e.toJSON({...i,writeFieldFormat:!i?.writeLayerSchema}))}get defaultPopupTemplate(){return this.createPopupTemplate()}set renderer(e){Le(e,this.fieldsIndex),this._set("renderer",e)}readRenderer(e,t,r){t=t.layerDefinition||t;const i=t.drawingInfo?.renderer;if(i){const e=Ae(i,t,r)??void 0;return e||n.getLogger(this).error("Failed to create renderer",{rendererDefinition:t.drawingInfo.renderer,layer:this,context:r}),e}return te(t,r)}get source(){return this._get("source")}set source(e){e||(e=null);const t=this._get("source");t!==e&&((Array.isArray(e)||e instanceof o)&&(e=new T({layer:this,items:e})),Ke(t)&&this._resetMemorySource(t),Ke(e)&&this._initMemorySource(e),this._set("source",e))}readSource(e,t){const r=Ne.fromJSON(t.featureSet);return new T({layer:this,items:r?.features??[]})}readTemplates(e,t){const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e=e?.map(e=>ve.fromJSON(e)),this._fixTemplates(e,i),this._fixTemplates(e,o),e}readTitle(e,t){const r=t.layerDefinition?.name??t.name,i=t.title||t.layerDefinition?.title;if(r){if("item-title"===this.sublayerTitleMode)return this.url?V(this.url,r):r;let e=r;if(!e&&this.url){const t=N(this.url);null!=t&&(e=t.title)}if(!e)return;const t=this.portalItem?.title;return"item-title-and-service-name"===this.sublayerTitleMode&&t&&t!==e&&(e=t+" - "+e),B(e)}if("item-title"===this.sublayerTitleMode&&i)return i}readTitleFromWebMap(e,t){return t.title||t.layerDefinition?.name}readTypeIdField(e,t){let r=(t=t.layerDefinition||t).typeIdField;if(r&&t.fields){r=r.toLowerCase();const e=t.fields.find(e=>e.name.toLowerCase()===r);e&&(r=e.name)}return r}readTypes(e,t){e=(t=t.layerDefinition||t).types;const r=t.editFieldsInfo,i=r?.creatorField,o=r?.editorField;return e?.map(e=>(e=Fe.fromJSON(e),this._fixTemplates(e.templates,i),this._fixTemplates(e.templates,o),e))}readVisible(e,t){return null!=t.layerDefinition?.defaultVisibility?!!t.layerDefinition.defaultVisibility:null!=t.visibility?!!t.visibility:void 0}async addAttachment(e,t){const r=await re(this,e,t,ke);return this.lastEditsEventDate=new Date,r}async updateAttachment(e,t,r){const i=await ie(this,e,t,r,ke);return this.lastEditsEventDate=new Date,i}async applyEdits(e,t){return oe(this,e,t)}async uploadAssets(e,t){return se(this,e,t)}createFieldConfigurations(){return Ie(this)}createPopupTemplate(e){return Je(this,e)}async createGraphicsSource(e){if(this._hasMemorySource()&&this.source)return this.source.load({signal:e});const{default:t}=await c(import("./graphics/sources/FeatureLayerSource.js"),e);return new t({layer:this,supportedSourceTypes:this.supportedSourceTypes}).load({signal:e})}createQuery(){const e=ae(this);e.dynamicDataSource=this.dynamicDataSource;const t=null!=this.subtypeCode?`${this.subtypeField} = ${this.subtypeCode}`:null,r=m(this.definitionExpression,t);return e.where=r||"1=1",e}async deleteAttachments(e,t){const r=await ne(this,e,t,ke);return this.lastEditsEventDate=new Date,r}async fetchRecomputedExtents(e){return le(this,e,ke)}async getFeatureTitle(e,t){return this._titleCreator.getTitle(this,e,t)}async getFeatureTitles(e,t){return this._titleCreator.getTitles(this,e,t)}getFeatureType(e){return pe(this.types,this.typeIdField,e)}getFieldAlias(e){const t=this.getField(e);if(t)return this.getFieldConfiguration(t.name)?.alias||t.alias}getFieldConfiguration(e){return e=e.toLowerCase(),this.fieldConfigurations?.find(t=>t.name.toLowerCase()===e)}getFieldDomain(e,t){return ue(this,e,t,this.getField(e)?.domain??null)}async queryAttachments(e,t){return de(this,e,t,ke)}async queryFeatures(e,t){const r=await this.load(),i=await r.source.queryFeatures(Be.from(e)??r.createQuery(),t),o=this.graphicOrigin;if(i?.features)for(const s of i.features)s.layer=s.sourceLayer=r,s.origin=o;return i}async queryObjectIds(e,t){return await ye(this,e,t,ke)}async queryFeatureCount(e,t){return ce(this,e,t,ke)}async queryExtent(e,t){return me(this,e,t,ke)}async queryRelatedFeatures(e,t){return fe(this,e,t,ke)}async queryRelatedFeaturesCount(e,t){return he(this,e,t,ke)}async queryPivot(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryPivot||!i?.operations?.supportsQueryPivot)throw new s(ke,"Layer source does not support queryPivot capability");const o=await import("../rest/support/PivotQuery.js"),a=await r.queryPivot(o.default.from(e),t),n=this.graphicOrigin;if(a?.features)for(const s of a.features)s.layer=s.sourceLayer=this,s.origin=n;return a}async queryTopFeatures(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopFeatures||!i?.query?.supportsTopFeaturesQuery)throw new s(ke,"Layer source does not support queryTopFeatures capability");const o=await import("../rest/support/TopFeaturesQuery.js"),a=await r.queryTopFeatures(o.default.from(e),t),n=this.graphicOrigin;if(a?.features)for(const s of a.features)s.layer=s.sourceLayer=this,s.origin=n;return a}async queryAttributeBins(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryAttributeBins)throw new s(ke,"Layer source does not support queryAttributeBins capability");be(e,i,ke);const o=await import("../rest/support/AttributeBinsQuery.js"),a=await r.queryAttributeBins(o.default.from(e),t),n=this.graphicOrigin;if(a.features)for(const s of a.features)s.layer=s.sourceLayer=this,s.origin=n;return a}async queryTopObjectIds(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopObjectIds||!i?.query.supportsTopFeaturesQuery)throw new s(ke,"Layer source does not support queryTopObjectIds capability");const o=await import("../rest/support/TopFeaturesQuery.js");return(await r.queryTopObjectIds(o.default.from(e),t)).filter(Ge)}async queryTopFeaturesExtent(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopExtents||!i?.query?.supportsTopFeaturesQuery)throw new s(ke,"Layer source does not support queryTopExtents capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopExtents(o.default.from(e),t)}async queryTopFeatureCount(e,t){const{source:r,capabilities:i}=await this.load();if(!r.queryTopCount||!i?.query?.supportsTopFeaturesQuery)throw new s(ke,"Layer source does not support queryFeatureCount capability");const o=await import("../rest/support/TopFeaturesQuery.js");return r.queryTopCount(o.default.from(e),t)}read(e,t){const r=e.featureCollection;if((r||"Feature Collection"===e.type)&&(this.resourceInfo=e),r){const{layers:e,showLegend:i}=r;1===e?.length&&(super.read(e[0],t),null!=i&&super.read({showLegend:i},t))}super.read(e,t),"service"===t?.origin&&(["objectIdField","fields","timeInfo","dateFieldsTimeZone","uniqueIdFields"].forEach(e=>this.revertToOrigin(e,"service")),this.spatialReference||this.revertToOrigin("spatialReference","service"))}write(e,t){t={...t,origin:t?.origin??void 0,writeLayerSchema:t?.writeLayerSchema??this._hasMemorySource()};const{origin:r,layerContainerType:i}=t;if(this.dynamicDataSource)return $e(t,this,"a dynamic data source cannot be written to web scenes, web maps and feature service items"),null;if(this.isTable){if(("web-map"===r||"web-scene"===r)&&"tables"!==i)return $e(t,this,"a table source can only be written to tables"),null;if(this._hasMemorySource())return $e(t,this,"an in-memory table source cannot be written to web scenes and web maps"),null}else if(this.loaded&&("web-map"===r||"web-scene"===r)&&"tables"===i)return $e(t,this,"a non-table source cannot be written to tables in web maps or web scenes"),null;return super.write(e,t)}clone(){if(this._hasMemorySource())throw new s(ke,`FeatureLayer (title: ${this.title}, id: ${this.id}) created using in-memory source cannot be cloned`);return super.clone()}serviceSupportsSpatialReference(e){return!!this.loaded&&("memory"===this.source?.type||Me(this,e))}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,t){return this._debouncedSaveOperations(1,t,e)}_readEditingEnabled(e,t,r){let i=e.layerDefinition?.capabilities;return i?this._hasEditingCapability(i):(i=e.capabilities,t&&"web-map"===r?.origin&&!this._hasMemorySource()&&i?this._hasEditingCapability(i):void 0)}_hasEditingCapability(e){return e.toLowerCase().split(",").map(e=>e.trim()).includes("editing")}_writeEditingEnabled(e,t,r,i){if(!e){const e=this.capabilities?.operations?.supportsSync?"Query,Sync":"Query";u("layerDefinition.capabilities",e,t),r&&!i?.writeLayerSchema&&(t.capabilities=e)}}_fetchFirstValidLayerId(e){return r(this.url??"",{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:e}).then(e=>{const t=e.data;if(t)return this.applyPreferredHost(t),this.findFirstValidLayerId(t)})}async initLayerProperties(e){return this._set("source",e),e.sourceJSON&&(this.sourceJSON=e.sourceJSON,this.read(e.sourceJSON,{origin:"service",portalItem:this.portalItem,portal:this.portalItem?.portal,url:this.parsedUrl})),this._verifySource(),this._verifyFields(),Le(this.renderer,this.fieldsIndex),De(this.timeInfo,this.fieldsIndex),this._hasMemorySource()&&"mesh"===this.geometryType&&(this.capabilities.query.supportsReturnMesh=!0),Qe(this,{origin:"service"})}async hasDataChanged(){return ge(this)}async fetchPublishingStatus(){const e=this.source;return e?.fetchPublishingStatus?e.fetchPublishingStatus():"unavailable"}_verifyFields(){const e=this.parsedUrl?.path??"undefined";this.objectIdField||console.log("FeatureLayer: 'objectIdField' property is not defined (url: "+e+")"),this.isTable||this._hasMemorySource()||-1!==e.search(/\/FeatureServer\//i)||this.fields?.some(e=>"geometry"===e.type)||console.log("FeatureLayer: unable to find field of type 'geometry' in the layer 'fields' list. If you are using a map service layer, features will not have geometry (url: "+e+")")}_fixTemplates(e,t){e&&e.forEach(e=>{const r=e.prototype?.attributes;r&&t&&delete r[t]})}_verifySource(){if(this._hasMemorySource()){if(this.url)throw new s("feature-layer:mixed-source-and-url","FeatureLayer cannot be created with both an in-memory source and a url")}else if(!this.url)throw new s("feature-layer:source-or-url-required","FeatureLayer requires either a url, a valid portal item or a source")}_initMemorySource(e){e.forEach(e=>{e.layer=this,e.sourceLayer=this}),this.addHandles([e.on("after-add",e=>{e.item.layer=this,e.item.sourceLayer=this}),e.on("after-remove",e=>{e.item.layer=null,e.item.sourceLayer=null})],"fl-source")}_resetMemorySource(e){e.forEach(e=>{e.layer=null,e.sourceLayer=null}),this.removeHandles("fl-source")}_hasMemorySource(){return!(this.url||!this.source)}findFirstValidLayerId(e){const t=[...e.layers||[],...e.tables||[]];return t.find(({type:e})=>!e||this.supportedSourceTypes.has(e))?.id}};e([f({clonable:!1,readOnly:!0})],et.prototype,"_titleCreator",null),e([f(G)],et.prototype,"attributeTableTemplate",void 0),e([He("service","capabilities")],et.prototype,"readCapabilities",null),e([f({json:{origins:{"web-scene":{write:!1}},write:!0}})],et.prototype,"charts",void 0),e([f({readOnly:!0})],et.prototype,"createQueryVersion",null),e([f({json:{read:{source:"layerDefinition.copyrightText"}}})],et.prototype,"copyright",void 0),e([f({json:{read:{source:"layerDefinition.displayField"}}})],et.prototype,"displayField",void 0),e([f({types:We,readOnly:!0})],et.prototype,"defaultSymbol",void 0),e([f({type:Ve})],et.prototype,"dynamicDataSource",void 0),e([f({type:Boolean})],et.prototype,"editingEnabled",null),e([He(["portal-item","web-scene"],"editingEnabled",["layerDefinition.capabilities"])],et.prototype,"readEditingEnabled",null),e([He("web-map","editingEnabled",["capabilities","layerDefinition.capabilities"])],et.prototype,"readEditingEnabledFromWebMap",null),e([ze(["portal-item","web-scene"],"editingEnabled",{"layerDefinition.capabilities":{type:String}})],et.prototype,"writeEditingEnabled",null),e([ze("web-map","editingEnabled",{capabilities:{type:String},"layerDefinition.capabilities":{type:String}})],et.prototype,"writeEditingEnabledToWebMap",null),e([f({readOnly:!0})],et.prototype,"effectiveEditingEnabled",null),e([f({clonable:!1,readOnly:!0})],et.prototype,"featureTitleFields",null),e([f({type:[Te],json:{name:"layerDefinition.fieldConfigurations",write:{overridePolicy(e,t,r){return{enabled:!r?.writeLayerSchema,ignoreOrigin:1===this.originIdOf(t)}}}}})],et.prototype,"fieldConfigurations",null),e([f({...Xe.fields,json:{read:{source:"layerDefinition.fields"},origins:{service:{name:"fields"},"web-map":{write:{target:"layerDefinition.fields",overridePolicy:Ye}}}}})],et.prototype,"fields",void 0),e([f(Xe.fieldsIndex)],et.prototype,"fieldsIndex",void 0),e([f({type:g,json:{name:"formInfo",write:!0,origins:{"web-scene":{read:!1,write:!1}}}})],et.prototype,"formTemplate",void 0),e([f({json:{read:{source:"layerDefinition.extent"}}})],et.prototype,"fullExtent",void 0),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.geometryType",overridePolicy:Ye,writer(e,t,r){const i=e?we.toJSON(e):null;i&&u(r,i,t)}}}},read:{source:"layerDefinition.geometryType",reader:we.read}}})],et.prototype,"geometryType",void 0),e([f({readOnly:!0,clonable:!1})],et.prototype,"graphicOrigin",void 0),e([f({json:{read:{source:"layerDefinition.hasM"}}})],et.prototype,"hasM",void 0),e([f({json:{read:{source:"layerDefinition.hasZ"}}})],et.prototype,"hasZ",void 0),e([f(J)],et.prototype,"id",void 0),e([f({readOnly:!0,json:{origins:{service:{read:!0}},read:!1}})],et.prototype,"infoFor3D",void 0),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.type"}}}}})],et.prototype,"isTable",void 0),e([He("service","isTable",["type","geometryType"]),He("isTable",["layerDefinition.type","layerDefinition.geometryType"])],et.prototype,"readIsTable",null),e([ze("web-map","isTable")],et.prototype,"writeIsTable",null),e([f(W)],et.prototype,"labelsVisible",void 0),e([f({type:[_e],json:{origins:{service:{name:"drawingInfo.labelingInfo",read:Ce,write:!1}},name:"layerDefinition.drawingInfo.labelingInfo",read:Ce,write:{layerContainerTypes:b}}})],et.prototype,"labelingInfo",void 0),e([f({type:Oe,json:{name:"layerDefinition.drawingInfo.symbolLayerDrawing",write:!0,origins:{"web-scene":{write:!1}}}})],et.prototype,"symbolLayerDrawing",void 0),e([f((()=>{const e=a(Z);return e.json.origins["portal-item"]={write:{target:"layerDefinition.drawingInfo.transparency",writer(e,t,r){u(r,Ze(e),t)}}},e})())],et.prototype,"opacity",void 0),e([f($)],et.prototype,"legendEnabled",void 0),e([f({type:["show","hide"],json:(()=>{const e=a(H.json);return e.origins["portal-item"]={read:!1,write:!1},e})()})],et.prototype,"listMode",void 0),e([He("globalIdField",["layerDefinition.globalIdField","layerDefinition.fields"])],et.prototype,"readGlobalIdField",null),e([f({json:{origins:{"web-map":{write:{target:"layerDefinition.objectIdField",overridePolicy:Ye}}}}})],et.prototype,"objectIdField",void 0),e([He("objectIdField",["layerDefinition.objectIdField","layerDefinition.fields"])],et.prototype,"readObjectIdField",null),e([f({type:["ArcGISFeatureLayer"],json:{write:{target:"layerType",ignoreOrigin:!0,layerContainerTypes:b}}})],et.prototype,"operationalLayerType",void 0),e([f(Xe.outFields)],et.prototype,"outFields",void 0),e([f({type:String,json:{origins:{"web-scene":{read:!0,write:!0}},read:!1}})],et.prototype,"path",void 0),e([f(z)],et.prototype,"popupEnabled",void 0),e([f({type:t,json:{name:"popupInfo",write:!0}})],et.prototype,"popupTemplate",void 0),e([ze("popupTemplate")],et.prototype,"writePopupTemplate",null),e([f({readOnly:!0})],et.prototype,"defaultPopupTemplate",null),e([f({types:Ue,json:{origins:{service:{write:{target:"drawingInfo.renderer",enabled:!1}},"web-scene":{types:Re,name:"layerDefinition.drawingInfo.renderer",write:{layerContainerTypes:b,overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:b})}}},write:{target:"layerDefinition.drawingInfo.renderer",overridePolicy:(e,t,r)=>({ignoreOrigin:r?.writeLayerSchema,layerContainerTypes:b})}}})],et.prototype,"renderer",null),e([He("service","renderer",["drawingInfo.renderer","defaultSymbol"]),He("renderer",["layerDefinition.drawingInfo.renderer","layerDefinition.defaultSymbol"])],et.prototype,"readRenderer",null),e([f()],et.prototype,"resourceInfo",void 0),e([f((()=>{const e=a(k);return e.json.origins["portal-item"]={read:!1,write:!1},e})())],et.prototype,"screenSizePerspectiveEnabled",void 0),e([f({clonable:!1})],et.prototype,"source",null),e([He("portal-item","source",["featureSet"]),He("web-map","source",["featureSet"])],et.prototype,"readSource",null),e([f({json:{read:{source:"layerDefinition.extent.spatialReference"}}})],et.prototype,"spatialReference",void 0),e([f({type:Number})],et.prototype,"subtypeCode",void 0),e([f({readOnly:!1})],et.prototype,"subtypeField",void 0),e([f({readOnly:!1})],et.prototype,"subtypes",void 0),e([f({type:[ve]})],et.prototype,"templates",void 0),e([He("templates",["editFieldsInfo","creatorField","editorField","templates"])],et.prototype,"readTemplates",null),e([f({type:xe})],et.prototype,"timeInfo",void 0),e([f()],et.prototype,"title",void 0),e([He("service","title",["name"]),He("portal-item","title",["layerDefinition.title","layerDefinition.name","title"])],et.prototype,"readTitle",null),e([He("web-map","title",["layerDefinition.name","title"])],et.prototype,"readTitleFromWebMap",null),e([f({type:String})],et.prototype,"sublayerTitleMode",void 0),e([f({json:{read:!1}})],et.prototype,"type",void 0),e([f({type:String})],et.prototype,"typeIdField",void 0),e([He("service","typeIdField"),He("typeIdField",["layerDefinition.typeIdField"])],et.prototype,"readTypeIdField",null),e([f({type:[Fe]})],et.prototype,"types",void 0),e([He("service","types",["types"]),He("types",["layerDefinition.types"])],et.prototype,"readTypes",null),e([f({type:Boolean,json:{origins:{"portal-item":{write:{target:"layerDefinition.defaultVisibility",layerContainerTypes:b}}}}})],et.prototype,"visible",void 0),e([He("portal-item","visible",["visibility","layerDefinition.defaultVisibility"])],et.prototype,"readVisible",null),et=e([h("esri.layers.FeatureLayer")],et);export{et as default};
|
package/layers/MapImageLayer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import r from"../request.js";import t from"../core/Collection.js";import i from"../core/Error.js";import{loadAll as s}from"../core/loadAll.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as p,isAbortError as n}from"../core/promiseUtils.js";import{getMetersPerUnitForSR as m,inchesPerMeter as l}from"../core/units.js";import{property as c,subclass as u}from"../core/accessorSupport/decorators.js";import{Integer as y}from"../core/accessorSupport/ensureType.js";import{nameToId as d}from"../core/accessorSupport/PropertyOrigin.js";import h from"../geometry/Extent.js";import{getScale as f}from"../geometry/support/scaleUtils.js";import{srToRESTValue as g}from"../geometry/support/spatialReferenceUtils.js";import v from"./Layer.js";import{APIKeyMixin as b}from"./mixins/APIKeyMixin.js";import{ArcGISMapService as x}from"./mixins/ArcGISMapService.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as S}from"./mixins/BlendLayer.js";import{CustomParametersMixin as I}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as O}from"./mixins/PortalLayer.js";import{RefreshableLayer as P}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{SublayersOwner as T}from"./mixins/SublayersOwner.js";import{TemporalLayer as U}from"./mixins/TemporalLayer.js";import{url as E}from"./support/commonProperties.js";import{ExportImageParameters as M}from"./support/ExportImageParameters.js";import{createBitmap as F}from"./support/imageBitmapUtils.js";import R from"./support/Sublayer.js";import{shouldWriteSublayerStructure as _}from"./support/sublayerUtils.js";import{serviceSupportsSpatialReference as A}from"./support/versionUtils.js";import N from"../symbols/support/ElevationInfo.js";import J from"../time/TimeExtent.js";import{timeZoneProperty as q}from"../time/timeZoneUtils.js";import{reader as k}from"../core/accessorSupport/decorators/reader.js";import{writer as V}from"../core/accessorSupport/decorators/writer.js";let B=class extends(S(U(L(T(x(j(w(O(o(P(b(I(v))))))))))))){constructor(...e){super(...e),this._exportImageParameters=new M({layer:this}),this.dateFieldsTimeZone=null,this.datesInUnknownTimezone=!1,this.dpi=96,this.elevationInfo=new N({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,this._debouncedSaveOperations=a(async(e,r,t)=>{const{save:i,saveAs:s}=await import("./save/mapImageLayerUtils.js");switch(e){case 0:return i(this,r);case 1:return s(this,t,r)}})}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(p).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"}get loaded(){return super.loaded}get portalItem(){return super.portalItem}set portalItem(e){super.portalItem=e}writeSublayers(e,r,t,i){if(!this.loaded||!e)return;const s=e.slice().reverse().flatten(({sublayers:e})=>e&&e.toArray().reverse()).toArray();let o=!1;const a=d(i.origin);let p;if(this.capabilities?.operations.supportsExportMap&&this.capabilities?.exportMap?.supportsDynamicLayers)if(3===a){const e=this.createSublayersForOrigin("service").sublayers;o=_(s,e,2)}else if(a>3){const e=this.createSublayersForOrigin("portal-item");o=_(s,e.sublayers,d(e.origin)),p=e.originWithPartialOverrides}const n=[],m={writeSublayerStructure:o,...i,minimumWritableOrigin:p};let l=o||this.hasVisibleLayersForOrigin(a);s.forEach(e=>{const r=e.write({},m);n.push(r),l=l||"user"===e.originOf("visible")});n.some(e=>Object.keys(e).length>1)&&(r.layers=n),l&&(r.visibleLayers=s.filter(e=>e.visible).map(e=>e.id))}createExportImageParameters(e,r,t,i){const s=i?.pixelRatio||1;e&&this.version>=10&&(e=e.clone().shiftCentralMeridian()),this._exportImageParameters.floors=i?.floors??null,this._exportImageParameters.scale=i?.scale||f({extent:e,width:r})*s;const o=this._exportImageParameters.toJSON(),a=!i?.rotation||this.version<10.3?{}:{rotation:-i.rotation},p=e?.spatialReference,n=g(p);if(i?.scale&&e){const t=e.width/r*(m(e?.spatialReference)*l);o.dpi=i.scale/t}o.dpi*=s;const c={};if(i?.timeExtent){const{start:e,end:r}=i.timeExtent.toJSON();c.time=e&&r&&e===r?""+e:`${e??"null"},${r??"null"}`}else this.timeInfo&&!this.timeInfo.hasLiveData&&(c.time="null,null");return{bbox:e?e.xmin+","+e.ymin+","+e.xmax+","+e.ymax:void 0,bboxSR:n,imageSR:n,size:r+","+t,...o,...a,...c}}async fetchImage(e,r,t,i){const{data:s}=await this._fetchImage("image",e,r,t,i);return s}async fetchImageBitmap(e,r,t,i){const{data:s,url:o}=await this._fetchImage("blob",e,r,t,i);return F(s,o,i
|
|
2
|
+
import{__decorate as e}from"tslib";import r from"../request.js";import t from"../core/Collection.js";import i from"../core/Error.js";import{loadAll as s}from"../core/loadAll.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{debounce as a,throwIfAbortError as p,isAbortError as n}from"../core/promiseUtils.js";import{getMetersPerUnitForSR as m,inchesPerMeter as l}from"../core/units.js";import{property as c,subclass as u}from"../core/accessorSupport/decorators.js";import{Integer as y}from"../core/accessorSupport/ensureType.js";import{nameToId as d}from"../core/accessorSupport/PropertyOrigin.js";import h from"../geometry/Extent.js";import{getScale as f}from"../geometry/support/scaleUtils.js";import{srToRESTValue as g}from"../geometry/support/spatialReferenceUtils.js";import v from"./Layer.js";import{APIKeyMixin as b}from"./mixins/APIKeyMixin.js";import{ArcGISMapService as x}from"./mixins/ArcGISMapService.js";import{ArcGISService as j}from"./mixins/ArcGISService.js";import{BlendLayer as S}from"./mixins/BlendLayer.js";import{CustomParametersMixin as I}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as O}from"./mixins/PortalLayer.js";import{RefreshableLayer as P}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as L}from"./mixins/ScaleRangeLayer.js";import{SublayersOwner as T}from"./mixins/SublayersOwner.js";import{TemporalLayer as U}from"./mixins/TemporalLayer.js";import{url as E}from"./support/commonProperties.js";import{ExportImageParameters as M}from"./support/ExportImageParameters.js";import{createBitmap as F}from"./support/imageBitmapUtils.js";import R from"./support/Sublayer.js";import{shouldWriteSublayerStructure as _}from"./support/sublayerUtils.js";import{serviceSupportsSpatialReference as A}from"./support/versionUtils.js";import N from"../symbols/support/ElevationInfo.js";import J from"../time/TimeExtent.js";import{timeZoneProperty as q}from"../time/timeZoneUtils.js";import{reader as k}from"../core/accessorSupport/decorators/reader.js";import{writer as V}from"../core/accessorSupport/decorators/writer.js";let B=class extends(S(U(L(T(x(j(w(O(o(P(b(I(v))))))))))))){constructor(...e){super(...e),this._exportImageParameters=new M({layer:this}),this.dateFieldsTimeZone=null,this.datesInUnknownTimezone=!1,this.dpi=96,this.elevationInfo=new N({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,this._debouncedSaveOperations=a(async(e,r,t)=>{const{save:i,saveAs:s}=await import("./save/mapImageLayerUtils.js");switch(e){case 0:return i(this,r);case 1:return s(this,t,r)}})}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(p).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"}get loaded(){return super.loaded}get portalItem(){return super.portalItem}set portalItem(e){super.portalItem=e}writeSublayers(e,r,t,i){if(!this.loaded||!e)return;const s=e.slice().reverse().flatten(({sublayers:e})=>e&&e.toArray().reverse()).toArray();let o=!1;const a=d(i.origin);let p;if(this.capabilities?.operations.supportsExportMap&&this.capabilities?.exportMap?.supportsDynamicLayers)if(3===a){const e=this.createSublayersForOrigin("service").sublayers;o=_(s,e,2)}else if(a>3){const e=this.createSublayersForOrigin("portal-item");o=_(s,e.sublayers,d(e.origin)),p=e.originWithPartialOverrides}const n=[],m={writeSublayerStructure:o,...i,minimumWritableOrigin:p};let l=o||this.hasVisibleLayersForOrigin(a);s.forEach(e=>{const r=e.write({},m);n.push(r),l=l||"user"===e.originOf("visible")});n.some(e=>Object.keys(e).length>1)&&(r.layers=n),l&&(r.visibleLayers=s.filter(e=>e.visible).map(e=>e.id))}createExportImageParameters(e,r,t,i){const s=i?.pixelRatio||1;e&&this.version>=10&&(e=e.clone().shiftCentralMeridian()),this._exportImageParameters.floors=i?.floors??null,this._exportImageParameters.scale=i?.scale||f({extent:e,width:r})*s;const o=this._exportImageParameters.toJSON(),a=!i?.rotation||this.version<10.3?{}:{rotation:-i.rotation},p=e?.spatialReference,n=g(p);if(i?.scale&&e){const t=e.width/r*(m(e?.spatialReference)*l);o.dpi=i.scale/t}o.dpi*=s;const c={};if(i?.timeExtent){const{start:e,end:r}=i.timeExtent.toJSON();c.time=e&&r&&e===r?""+e:`${e??"null"},${r??"null"}`}else this.timeInfo&&!this.timeInfo.hasLiveData&&(c.time="null,null");return{bbox:e?e.xmin+","+e.ymin+","+e.xmax+","+e.ymax:void 0,bboxSR:n,imageSR:n,size:r+","+t,...o,...a,...c}}async fetchImage(e,r,t,i){const{data:s}=await this._fetchImage("image",e,r,t,i);return s}async fetchImageBitmap(e,r,t,i){const{data:s,url:o}=await this._fetchImage("blob",e,r,t,i);return F(s,o,i)}async fetchRecomputedExtents(e={}){const t={...e,query:{returnUpdates:!0,f:"json",...this.customParameters,token:this.apiKey}},{data:i}=await r(this.url,t),{extent:s,fullExtent:o,timeExtent:a}=i,p=s||o;return{fullExtent:p&&h.fromJSON(p),timeExtent:a&&J.fromJSON({start:a[0],end:a[1]})}}loadAll(){return s(this,e=>{e(this.allSublayers),e(this.subtables)})}async save(e){return this._debouncedSaveOperations(0,e)}async saveAs(e,r){return this._debouncedSaveOperations(1,r,e)}serviceSupportsSpatialReference(e){return A(this,e)}async _fetchImage(e,t,s,o,a){const p={responseType:e,signal:a?.signal??null,query:{...this.parsedUrl.query,...this.createExportImageParameters(t,s,o,a),f:"image",...this.refreshParameters,...this.customParameters,token:this.apiKey}},m=this.parsedUrl.path+"/export";if(null!=p.query?.dynamicLayers&&!this.capabilities?.exportMap?.supportsDynamicLayers)throw new i("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:p.query});try{const{data:e}=await r(m,p);return{data:e,url:m}}catch(l){if(n(l))throw l;throw new i("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:i}=await r(this.parsedUrl.path,{query:{f:"json",...this.parsedUrl.query,...this.customParameters,token:this.apiKey},signal:e});i&&(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([c(q("dateFieldsTimeReference"))],B.prototype,"dateFieldsTimeZone",void 0),e([c({type:Boolean})],B.prototype,"datesInUnknownTimezone",void 0),e([c()],B.prototype,"dpi",void 0),e([c()],B.prototype,"elevationInfo",void 0),e([c()],B.prototype,"gdbVersion",void 0),e([c()],B.prototype,"imageFormat",void 0),e([k("imageFormat",["supportedImageFormatTypes"])],B.prototype,"readImageFormat",null),e([c({json:{origins:{service:{read:{source:"maxImageHeight"}}}}})],B.prototype,"imageMaxHeight",void 0),e([c({json:{origins:{service:{read:{source:"maxImageWidth"}}}}})],B.prototype,"imageMaxWidth",void 0),e([c()],B.prototype,"imageTransparency",void 0),e([c({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],B.prototype,"isReference",void 0),e([c({json:{read:!1,write:!1}})],B.prototype,"labelsVisible",void 0),e([c({type:["ArcGISMapServiceLayer"]})],B.prototype,"operationalLayerType",void 0),e([c({json:{read:!1,write:!1}})],B.prototype,"popupEnabled",void 0),e([c(q("preferredTimeReference"))],B.prototype,"preferredTimeZone",void 0),e([c()],B.prototype,"sourceJSON",void 0),e([c({type:t.ofType(R),json:{write:{ignoreOrigin:!0}}})],B.prototype,"sublayers",void 0),e([V("sublayers",{layers:{type:[R]},visibleLayers:{type:[y]}})],B.prototype,"writeSublayers",null),e([c({type:["show","hide","hide-children"],json:{origins:{"portal-item":{read:!1,write:!1}}}})],B.prototype,"listMode",void 0),e([c({json:{read:!1},readOnly:!0,value:"map-image"})],B.prototype,"type",void 0),e([c(E)],B.prototype,"url",void 0),B=e([u("esri.layers.MapImageLayer")],B);const G=B;export{G as default};
|
package/layers/TileLayer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import r from"../request.js";import t from"../core/Error.js";import{loadAll as i}from"../core/loadAll.js";import{MultiOriginJSONSupportMixin as s}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,cast as c,subclass as u}from"../core/accessorSupport/decorators.js";import h from"../geometry/SpatialReference.js";import m from"./Layer.js";import{APIKeyMixin as d}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as y}from"./mixins/ArcGISCachedService.js";import{ArcGISMapService as f}from"./mixins/ArcGISMapService.js";import{ArcGISService as v}from"./mixins/ArcGISService.js";import{BlendLayer as g}from"./mixins/BlendLayer.js";import{CustomParametersMixin as S}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as _}from"./mixins/OperationalLayer.js";import{PortalLayer as j}from"./mixins/PortalLayer.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as T}from"./mixins/ScaleRangeLayer.js";import{SublayersOwner as w}from"./mixins/SublayersOwner.js";import{parse as O,isHostedAgolService as L,isArcGISUrl as R}from"./support/arcgisLayerUrl.js";import{url as A}from"./support/commonProperties.js";import{createTileBitmap as U}from"./support/imageBitmapUtils.js";import P from"./support/Sublayer.js";import x from"../symbols/support/ElevationInfo.js";import{reader as I}from"../core/accessorSupport/decorators/reader.js";import{writer as M}from"../core/accessorSupport/decorators/writer.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(g(T(w(y(f(_(j(v(s(b(d(S(m))))))))))))){constructor(...e){super(...e),this.listMode="show",this.elevationInfo=new x({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}get hasAttributionData(){return super.hasAttributionData}readSpatialReference(e,r){return(e=e||r.tileInfo?.spatialReference)&&h.fromJSON(e)}writeSublayers(e,r,t,i){if(!this.loaded||!e)return;const s=e.slice().reverse().flatten(({sublayers:e})=>e&&e.toArray().reverse()).toArray(),o=[],a={writeSublayerStructure:!1,...i};s.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,i,s={}){const{signal:o}=s,a=this.getTileUrl(e,t,i),l={responseType:"image",signal:o,query:{...this.refreshParameters}};return r(a,l).then(e=>e.data)}async fetchImageBitmapTile(e,t,i,s={}){const{signal:o}=s;if(this.fetchTile!==W.prototype.fetchTile){const r=await this.fetchTile(e,t,i,s);return U(r,e,t,i,
|
|
2
|
+
import{__decorate as e}from"tslib";import r from"../request.js";import t from"../core/Error.js";import{loadAll as i}from"../core/loadAll.js";import{MultiOriginJSONSupportMixin as s}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,cast as c,subclass as u}from"../core/accessorSupport/decorators.js";import h from"../geometry/SpatialReference.js";import m from"./Layer.js";import{APIKeyMixin as d}from"./mixins/APIKeyMixin.js";import{ArcGISCachedService as y}from"./mixins/ArcGISCachedService.js";import{ArcGISMapService as f}from"./mixins/ArcGISMapService.js";import{ArcGISService as v}from"./mixins/ArcGISService.js";import{BlendLayer as g}from"./mixins/BlendLayer.js";import{CustomParametersMixin as S}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as _}from"./mixins/OperationalLayer.js";import{PortalLayer as j}from"./mixins/PortalLayer.js";import{RefreshableLayer as b}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as T}from"./mixins/ScaleRangeLayer.js";import{SublayersOwner as w}from"./mixins/SublayersOwner.js";import{parse as O,isHostedAgolService as L,isArcGISUrl as R}from"./support/arcgisLayerUrl.js";import{url as A}from"./support/commonProperties.js";import{createTileBitmap as U}from"./support/imageBitmapUtils.js";import P from"./support/Sublayer.js";import x from"../symbols/support/ElevationInfo.js";import{reader as I}from"../core/accessorSupport/decorators/reader.js";import{writer as M}from"../core/accessorSupport/decorators/writer.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(g(T(w(y(f(_(j(v(s(b(d(S(m))))))))))))){constructor(...e){super(...e),this.listMode="show",this.elevationInfo=new x({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}get hasAttributionData(){return super.hasAttributionData}readSpatialReference(e,r){return(e=e||r.tileInfo?.spatialReference)&&h.fromJSON(e)}writeSublayers(e,r,t,i){if(!this.loaded||!e)return;const s=e.slice().reverse().flatten(({sublayers:e})=>e&&e.toArray().reverse()).toArray(),o=[],a={writeSublayerStructure:!1,...i};s.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,i,s={}){const{signal:o}=s,a=this.getTileUrl(e,t,i),l={responseType:"image",signal:o,query:{...this.refreshParameters}};return r(a,l).then(e=>e.data)}async fetchImageBitmapTile(e,t,i,s={}){const{signal:o}=s;if(this.fetchTile!==W.prototype.fetchTile){const r=await this.fetchTile(e,t,i,s);return U(r,e,t,i,s)}const a=this.getTileUrl(e,t,i),l={responseType:"blob",signal:o,query:{...this.refreshParameters}},{data:n}=await r(a,l);return U(n,e,t,i,s)}getTileUrl(e,r,t){const i=!this.capabilities.operations.supportsTileMap&&this.supportsBlankTile,s=l({...this.parsedUrl?.query,blankTile:!i&&null,...this.customParameters,token:this.apiKey}),o=this.tileServers;return`${o&&o.length?o[r%o.length]:this.parsedUrl?.path}/tile/${e}/${r}/${t}${s?"?"+s:""}`}loadAll(){return i(this,e=>{e(this.allSublayers)})}_fetchService(e){return new Promise((i,s)=>{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 i({data:this.sourceJSON})}if(!this.parsedUrl)throw new t("tile-layer:undefined-url","layer's url is not defined");const o=O(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(i,s)}).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&&!L(t))return this._fetchServerVersion(t,e).then(e=>{this.read({currentVersion:e})}).catch(()=>{})})}_fetchServerVersion(e,i){if(!R(e))return Promise.reject();const s=e.replace(/(.*\/rest)\/.*/i,"$1")+"/info";return r(s,{query:{f:"json",...this.customParameters,token:this.apiKey},responseType:"json",signal:i}).then(e=>{if(e.data?.currentVersion)return e.data.currentVersion;throw new t("tile-layer:version-not-available","Server did not provide a version")})}_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,i=B.length;t<i;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[D]}};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:h})],C.prototype,"spatialReference",void 0),e([I("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([M("sublayers",{layers:{type:[P]}})],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(A)],C.prototype,"url",void 0),C=W=e([u("esri.layers.TileLayer")],C);const D=Symbol("default-fetch-tile");C.prototype.fetchTile[D]=!0;const N=C;export{N as default};
|
package/layers/WMSLayer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import i from"../request.js";import s from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import n from"../core/Error.js";import{JSONMap as l}from"../core/jsonMap.js";import{clone as p}from"../core/lang.js";import{MultiOriginJSONSupportMixin as m}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as u}from"../core/promiseUtils.js";import{on as c,sync as f,watch as y}from"../core/reactiveUtils.js";import{renderingSanitizer as d}from"../core/sanitizerUtils.js";import{urlToObject as h,addQueryParameters as g,addProxy as b,makeAbsolute as w,Url as v}from"../core/urlUtils.js";import{property as x,subclass as j}from"../core/accessorSupport/decorators.js";import{Integer as I}from"../core/accessorSupport/ensureType.js";import{willPropertyWrite as S}from"../core/accessorSupport/write.js";import F from"../geometry/Extent.js";import E from"../geometry/SpatialReference.js";import{getScale as P}from"../geometry/support/scaleUtils.js";import{equals as R}from"../geometry/support/spatialReferenceUtils.js";import O from"./Layer.js";import{BlendLayer as L}from"./mixins/BlendLayer.js";import{OperationalLayer as U}from"./mixins/OperationalLayer.js";import{PortalLayer as M}from"./mixins/PortalLayer.js";import{RefreshableLayer as T}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as _}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as C}from"./mixins/TemporalLayer.js";import{isAxesOrderReversedForWkid as W}from"./ogc/crsUtils.js";import{isWmsServer as q}from"./support/arcgisLayerUrl.js";import{legendEnabled as N,url as $}from"./support/commonProperties.js";import{ExportWMSImageParameters as B}from"./support/ExportWMSImageParameters.js";import{createBitmap as k}from"./support/imageBitmapUtils.js";import H from"./support/WMSSublayer.js";import{normalizeWKID as G,toTimeQueryParameter as V,getPopupLayers as z,parseCapabilities as A}from"./support/wmsUtils.js";import D from"../time/TimeExtent.js";import J from"../time/TimeInterval.js";import{reader as Q}from"../core/accessorSupport/decorators/reader.js";import{writer as K}from"../core/accessorSupport/decorators/writer.js";const X=new l({bmp:"image/bmp",gif:"image/gif",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml"},{ignoreUnknown:!1});function Y(e){return"text/html"===e}function Z(e){return"text/plain"===e}let ee=class extends(L(C(T(_(U(M(m(O)))))))){constructor(...e){super(...e),this.allSublayers=new a({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.customParameters=null,this.customLayerParameters=null,this.copyright=null,this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.featureInfoFormats=null,this.featureInfoUrl=null,this.fetchFeatureInfoFunction=null,this.imageFormat=null,this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.legendEnabled=!0,this.mapUrl=null,this.isReference=null,this.operationalLayerType="WMS",this.spatialReference=null,this.spatialReferences=null,this.sublayers=null,this.type="wms",this.version=null,this.addHandles([c(()=>this.sublayers,"after-add",({item:e})=>{e.parent=e.layer=this},f),c(()=>this.sublayers,"after-remove",({item:e})=>{e.layer=e.parent=null},f),y(()=>this.sublayers,(e,t)=>{if(t)for(const r of t)r.layer=r.parent=null;if(e)for(const r of e)r.parent=r.layer=this},f)])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this.allSublayers.destroy()}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMS"]},e).catch(u).then(()=>this._fetchService(t)).then(()=>this._checkLayerValidity())),Promise.resolve(this)}get timeInfo(){return super.timeInfo}set timeInfo(e){super.timeInfo=e}readFullExtentFromItemOrMap(e,t){const r=t.extent;return r?new F({xmin:r[0][0],ymin:r[0][1],xmax:r[1][0],ymax:r[1][1]}):null}writeFullExtent(e,t){t.extent=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}get featureInfoFormat(){return null==this.featureInfoFormats?null:this.featureInfoFormats.find(Y)??this.featureInfoFormats.find(Z)??null}set featureInfoFormat(e){null==e?(this.revertToOrigin("featureInfoFormat","service"),this._clearOverride("featureInfoFormat")):(Y(e)||Z(e))&&this._override("featureInfoFormat",e)}readImageFormat(e,t){const r=t.supportedImageFormatTypes;return r&&r.includes("image/png")?"image/png":r&&r[0]}readSpatialReferenceFromItemOrDocument(e,t){return new E(t.spatialReferences[0])}writeSpatialReferences(e,t){const r=this.spatialReference?.wkid;e&&r?(t.spatialReferences=e.filter(e=>e!==r),t.spatialReferences.unshift(r)):t.spatialReferences=e}readSublayersFromItemOrMap(e,t,r){return re(t.layers,r,t.visibleLayers)}readSublayers(e,t,r){return re(t.layers,r)}writeSublayers(e,t,r,o){t.layers=[];const i=new Map,s=e.flatten(({sublayers:e})=>e??[]);for(const a of s)if("number"==typeof a.parent?.id){const e=i.get(a.parent.id);null!=e?e.push(a.id):i.set(a.parent.id,[a.id])}for(const a of s){const e={sublayer:a,...o},r=a.write({parentLayerId:"number"==typeof a.parent?.id?a.parent.id:-1},e);if(i.has(a.id)&&(r.sublayerIds=i.get(a.id)),!a.sublayers&&a.name){const r=a.write({},e);delete r.id,t.layers.push(r)}}t.visibleLayers=s.filter(({visible:e,sublayers:t})=>e&&!t).map(({name:e})=>e).toArray()}set url(e){if(!e)return void this._set("url",e);const{path:t,query:r}=h(e);for(const i in r)/^(request|service)$/i.test(i)&&delete r[i];const o=g(t,r??{});this._set("url",o)}createExportImageParameters(e,t,r,o){const i=o?.pixelRatio??1,s=P({extent:e,width:t})*i,a=new B({layer:this,scale:s}),{xmin:n,ymin:l,xmax:p,ymax:m,spatialReference:u}=e,c=G(u,this.spatialReferences),f="1.3.0"===this.version&&W(c)?`${l},${n},${m},${p}`:`${n},${l},${p},${m}`,y=a.toJSON(),d="1.3.0"===this.version?"crs":"srs";return{bbox:f,[d]:null==c||isNaN(c)?void 0:"EPSG:"+c,...y}}async fetchImage(e,t,r,o){const s=this.mapUrl,a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=V(o?.timeExtent),l={responseType:"image",query:this._mixCustomParameters({width:t,height:r,...a,time:n,...this.refreshParameters}),signal:o?.signal};return i(s??"",l).then(e=>e.data)}async fetchImageBitmap(e,t,r,o){const s=this.mapUrl??"",a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=V(o?.timeExtent),l={responseType:"blob",query:this._mixCustomParameters({width:t,height:r,...a,time:n,...this.refreshParameters}),signal:o?.signal},{data:p}=await i(s,l);return k(p,s,o?.signal)}fetchFeatureInfo(e,t,r,o,i){const s=P({extent:e,width:t}),a=new B({layer:this,scale:s}),n=z(a.visibleSublayers);if(null==this.featureInfoUrl||null==n)return Promise.resolve([]);if(null==this.fetchFeatureInfoFunction&&null==this.featureInfoFormat)return Promise.resolve([]);const l="1.3.0"===this.version?{I:o,J:i}:{x:o,y:i},p={query_layers:n,request:"GetFeatureInfo",info_format:this.featureInfoFormat,feature_count:25,width:t,height:r,...l},m={...this.createExportImageParameters(e,t,r),...p},u=this._mixCustomParameters(m);return null!=this.fetchFeatureInfoFunction?this.fetchFeatureInfoFunction(u):this._defaultFetchFeatureInfoFunction(g(this.featureInfoUrl,u))}findSublayerById(e){return this.allSublayers.find(t=>t.id===e)}findSublayerByName(e){return this.allSublayers.find(t=>t.name===e)}serviceSupportsSpatialReference(e){return q(this.url)||null!=this.spatialReferences&&this.spatialReferences.some(t=>{const r=900913===t?E.WebMercator:new E({wkid:t});return R(r,e)})}_defaultFetchFeatureInfoFunction(e){const t=document.createElement("iframe");t.src=b(d.sanitizeUrl(w(e))),t.style.border="none",t.style.margin="0",t.style.width="100%",t.setAttribute("sandbox","");const i=new o({title:this.title,content:t}),s=new r({sourceLayer:this,popupTemplate:i});return Promise.resolve([s])}async _fetchService(e){if(!this.resourceInfo&&this.parsedUrl?.path){const{path:t,query:r}=this.parsedUrl,{data:o}=await i(t,{query:{SERVICE:"WMS",REQUEST:"GetCapabilities",...r,...this.customParameters},responseType:"xml",signal:e});this.resourceInfo=A(o)}if(this.parsedUrl){const e=new v(this.parsedUrl.path),{httpsDomains:r}=t.request;"https"!==e.scheme||e.port&&"443"!==e.port||!e.host||r.includes(e.host)||r.push(e.host)}this.read(this.resourceInfo,{origin:"service"})}_checkLayerValidity(){if(!this.allSublayers.length)throw new n("wmslayer:empty-layer","The layer doesn't have any sublayer")}_mixCustomParameters(e){if(!this.customLayerParameters&&!this.customParameters)return e;const t={...this.customParameters,...this.customLayerParameters};for(const r in t)e[r.toLowerCase()]=t[r];return e}};function te(e,t){return e.some(e=>{for(const r in e)if(S(e,r,null,t))return!0;return!1})}function re(e,t,r){e=e??[];const o=new Map;e.every(e=>null==e.id)&&(e=p(e)).forEach((e,t)=>e.id=t);for(const s of e){const e=new H;e.read(s,t),r&&!r.includes(e.name)&&(e.visible=!1),o.set(e.id,e)}const i=[];for(const a of e){const e=null!=a.id?o.get(a.id):null;if(e)if(null!=a.parentLayerId&&a.parentLayerId>=0){const t=o.get(a.parentLayerId);if(!t)continue;t.sublayers||(t.sublayers=new s),t.sublayers.push(e)}else i.push(e)}return i}e([x({type:D})],ee.prototype,"timeExtent",void 0),e([x({type:J})],ee.prototype,"timeOffset",void 0),e([x({readOnly:!0})],ee.prototype,"allSublayers",void 0),e([x({json:{type:Object,write:!0}})],ee.prototype,"customParameters",void 0),e([x({json:{type:Object,write:!0}})],ee.prototype,"customLayerParameters",void 0),e([x({type:String,json:{write:!0}})],ee.prototype,"copyright",void 0),e([x()],ee.prototype,"description",void 0),e([x({readOnly:!0})],ee.prototype,"dimensions",void 0),e([x({json:{type:[[Number]],read:{source:"extent"},write:{target:"extent"},origins:{"web-document":{write:{ignoreOrigin:!0}},"portal-item":{write:{ignoreOrigin:!0}}}}})],ee.prototype,"fullExtent",void 0),e([Q(["web-document","portal-item"],"fullExtent",["extent"])],ee.prototype,"readFullExtentFromItemOrMap",null),e([K(["web-document","portal-item"],"fullExtent",{extent:{type:[[Number]]}})],ee.prototype,"writeFullExtent",null),e([x({type:[F]})],ee.prototype,"fullExtents",void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],ee.prototype,"featureInfoFormat",null),e([x({type:[String],readOnly:!0})],ee.prototype,"featureInfoFormats",void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],ee.prototype,"featureInfoUrl",void 0),e([x()],ee.prototype,"fetchFeatureInfoFunction",void 0),e([x({type:String,json:{origins:{"web-document":{default:"image/png",type:X.jsonValues,read:{reader:X.read,source:"format"},write:{writer:X.write,target:"format"}}}}})],ee.prototype,"imageFormat",void 0),e([Q("imageFormat",["supportedImageFormatTypes"])],ee.prototype,"readImageFormat",null),e([x({type:Number,json:{read:{source:"maxHeight"},write:{target:"maxHeight"}}})],ee.prototype,"imageMaxHeight",void 0),e([x({type:Number,json:{read:{source:"maxWidth"},write:{target:"maxWidth"}}})],ee.prototype,"imageMaxWidth",void 0),e([x()],ee.prototype,"imageTransparency",void 0),e([x(N)],ee.prototype,"legendEnabled",void 0),e([x({type:["show","hide","hide-children"]})],ee.prototype,"listMode",void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],ee.prototype,"mapUrl",void 0),e([x({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],ee.prototype,"isReference",void 0),e([x({type:["WMS"]})],ee.prototype,"operationalLayerType",void 0),e([x()],ee.prototype,"resourceInfo",void 0),e([x({type:E,json:{origins:{service:{read:{source:"extent.spatialReference"}}},write:!1}})],ee.prototype,"spatialReference",void 0),e([Q(["web-document","portal-item"],"spatialReference",["spatialReferences"])],ee.prototype,"readSpatialReferenceFromItemOrDocument",null),e([x({type:[I],json:{read:!1,origins:{service:{read:!0},"web-document":{read:!1,write:{ignoreOrigin:!0}},"portal-item":{read:!1,write:{ignoreOrigin:!0}}}}})],ee.prototype,"spatialReferences",void 0),e([K(["web-document","portal-item"],"spatialReferences")],ee.prototype,"writeSpatialReferences",null),e([x({type:s.ofType(H),json:{write:{target:"layers",overridePolicy(e,t,r){if(te(this.allSublayers,r))return{ignoreOrigin:!0}}}}})],ee.prototype,"sublayers",void 0),e([Q(["web-document","portal-item"],"sublayers",["layers","visibleLayers"])],ee.prototype,"readSublayersFromItemOrMap",null),e([Q("service","sublayers",["layers"])],ee.prototype,"readSublayers",null),e([K("sublayers",{layers:{type:[H]},visibleLayers:{type:[String]}})],ee.prototype,"writeSublayers",null),e([x({json:{read:!1},readOnly:!0,value:"wms"})],ee.prototype,"type",void 0),e([x($)],ee.prototype,"url",null),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],ee.prototype,"version",void 0),ee=e([j("esri.layers.WMSLayer")],ee);const oe=ee;export{oe as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../config.js";import r from"../Graphic.js";import o from"../PopupTemplate.js";import i from"../request.js";import s from"../core/Collection.js";import a from"../core/CollectionFlattener.js";import n from"../core/Error.js";import{JSONMap as l}from"../core/jsonMap.js";import{clone as p}from"../core/lang.js";import{MultiOriginJSONSupportMixin as m}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as u}from"../core/promiseUtils.js";import{on as c,sync as f,watch as y}from"../core/reactiveUtils.js";import{renderingSanitizer as d}from"../core/sanitizerUtils.js";import{urlToObject as h,addQueryParameters as g,addProxy as b,makeAbsolute as w,Url as v}from"../core/urlUtils.js";import{property as x,subclass as j}from"../core/accessorSupport/decorators.js";import{Integer as I}from"../core/accessorSupport/ensureType.js";import{willPropertyWrite as S}from"../core/accessorSupport/write.js";import F from"../geometry/Extent.js";import E from"../geometry/SpatialReference.js";import{getScale as P}from"../geometry/support/scaleUtils.js";import{equals as R}from"../geometry/support/spatialReferenceUtils.js";import O from"./Layer.js";import{BlendLayer as L}from"./mixins/BlendLayer.js";import{OperationalLayer as U}from"./mixins/OperationalLayer.js";import{PortalLayer as M}from"./mixins/PortalLayer.js";import{RefreshableLayer as T}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as _}from"./mixins/ScaleRangeLayer.js";import{TemporalLayer as C}from"./mixins/TemporalLayer.js";import{isAxesOrderReversedForWkid as W}from"./ogc/crsUtils.js";import{isWmsServer as q}from"./support/arcgisLayerUrl.js";import{legendEnabled as N,url as $}from"./support/commonProperties.js";import{ExportWMSImageParameters as B}from"./support/ExportWMSImageParameters.js";import{createBitmap as k}from"./support/imageBitmapUtils.js";import H from"./support/WMSSublayer.js";import{normalizeWKID as G,toTimeQueryParameter as V,getPopupLayers as z,parseCapabilities as A}from"./support/wmsUtils.js";import D from"../time/TimeExtent.js";import J from"../time/TimeInterval.js";import{reader as Q}from"../core/accessorSupport/decorators/reader.js";import{writer as K}from"../core/accessorSupport/decorators/writer.js";const X=new l({bmp:"image/bmp",gif:"image/gif",jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml"},{ignoreUnknown:!1});function Y(e){return"text/html"===e}function Z(e){return"text/plain"===e}let ee=class extends(L(C(T(_(U(M(m(O)))))))){constructor(...e){super(...e),this.allSublayers=new a({getCollections:()=>[this.sublayers],getChildrenFunction:e=>e.sublayers}),this.customParameters=null,this.customLayerParameters=null,this.copyright=null,this.description=null,this.dimensions=null,this.fullExtent=null,this.fullExtents=null,this.featureInfoFormats=null,this.featureInfoUrl=null,this.fetchFeatureInfoFunction=null,this.imageFormat=null,this.imageMaxHeight=2048,this.imageMaxWidth=2048,this.imageTransparency=!0,this.legendEnabled=!0,this.mapUrl=null,this.isReference=null,this.operationalLayerType="WMS",this.spatialReference=null,this.spatialReferences=null,this.sublayers=null,this.type="wms",this.version=null,this.addHandles([c(()=>this.sublayers,"after-add",({item:e})=>{e.parent=e.layer=this},f),c(()=>this.sublayers,"after-remove",({item:e})=>{e.layer=e.parent=null},f),y(()=>this.sublayers,(e,t)=>{if(t)for(const r of t)r.layer=r.parent=null;if(e)for(const r of e)r.parent=r.layer=this},f)])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}destroy(){this.allSublayers.destroy()}load(e){const t=null!=e?e.signal:null;return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMS"]},e).catch(u).then(()=>this._fetchService(t)).then(()=>this._checkLayerValidity())),Promise.resolve(this)}get timeInfo(){return super.timeInfo}set timeInfo(e){super.timeInfo=e}readFullExtentFromItemOrMap(e,t){const r=t.extent;return r?new F({xmin:r[0][0],ymin:r[0][1],xmax:r[1][0],ymax:r[1][1]}):null}writeFullExtent(e,t){t.extent=[[e.xmin,e.ymin],[e.xmax,e.ymax]]}get featureInfoFormat(){return null==this.featureInfoFormats?null:this.featureInfoFormats.find(Y)??this.featureInfoFormats.find(Z)??null}set featureInfoFormat(e){null==e?(this.revertToOrigin("featureInfoFormat","service"),this._clearOverride("featureInfoFormat")):(Y(e)||Z(e))&&this._override("featureInfoFormat",e)}readImageFormat(e,t){const r=t.supportedImageFormatTypes;return r&&r.includes("image/png")?"image/png":r&&r[0]}readSpatialReferenceFromItemOrDocument(e,t){return new E(t.spatialReferences[0])}writeSpatialReferences(e,t){const r=this.spatialReference?.wkid;e&&r?(t.spatialReferences=e.filter(e=>e!==r),t.spatialReferences.unshift(r)):t.spatialReferences=e}readSublayersFromItemOrMap(e,t,r){return re(t.layers,r,t.visibleLayers)}readSublayers(e,t,r){return re(t.layers,r)}writeSublayers(e,t,r,o){t.layers=[];const i=new Map,s=e.flatten(({sublayers:e})=>e??[]);for(const a of s)if("number"==typeof a.parent?.id){const e=i.get(a.parent.id);null!=e?e.push(a.id):i.set(a.parent.id,[a.id])}for(const a of s){const e={sublayer:a,...o},r=a.write({parentLayerId:"number"==typeof a.parent?.id?a.parent.id:-1},e);if(i.has(a.id)&&(r.sublayerIds=i.get(a.id)),!a.sublayers&&a.name){const r=a.write({},e);delete r.id,t.layers.push(r)}}t.visibleLayers=s.filter(({visible:e,sublayers:t})=>e&&!t).map(({name:e})=>e).toArray()}set url(e){if(!e)return void this._set("url",e);const{path:t,query:r}=h(e);for(const i in r)/^(request|service)$/i.test(i)&&delete r[i];const o=g(t,r??{});this._set("url",o)}createExportImageParameters(e,t,r,o){const i=o?.pixelRatio??1,s=P({extent:e,width:t})*i,a=new B({layer:this,scale:s}),{xmin:n,ymin:l,xmax:p,ymax:m,spatialReference:u}=e,c=G(u,this.spatialReferences),f="1.3.0"===this.version&&W(c)?`${l},${n},${m},${p}`:`${n},${l},${p},${m}`,y=a.toJSON(),d="1.3.0"===this.version?"crs":"srs";return{bbox:f,[d]:null==c||isNaN(c)?void 0:"EPSG:"+c,...y}}async fetchImage(e,t,r,o){const s=this.mapUrl,a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=V(o?.timeExtent),l={responseType:"image",query:this._mixCustomParameters({width:t,height:r,...a,time:n,...this.refreshParameters}),signal:o?.signal};return i(s??"",l).then(e=>e.data)}async fetchImageBitmap(e,t,r,o){const s=this.mapUrl??"",a=this.createExportImageParameters(e,t,r,o);if(!a.layers){const e=document.createElement("canvas");return e.width=t,e.height=r,e}const n=V(o?.timeExtent),l={responseType:"blob",query:this._mixCustomParameters({width:t,height:r,...a,time:n,...this.refreshParameters}),signal:o?.signal},{data:p}=await i(s,l);return k(p,s,o)}fetchFeatureInfo(e,t,r,o,i){const s=P({extent:e,width:t}),a=new B({layer:this,scale:s}),n=z(a.visibleSublayers);if(null==this.featureInfoUrl||null==n)return Promise.resolve([]);if(null==this.fetchFeatureInfoFunction&&null==this.featureInfoFormat)return Promise.resolve([]);const l="1.3.0"===this.version?{I:o,J:i}:{x:o,y:i},p={query_layers:n,request:"GetFeatureInfo",info_format:this.featureInfoFormat,feature_count:25,width:t,height:r,...l},m={...this.createExportImageParameters(e,t,r),...p},u=this._mixCustomParameters(m);return null!=this.fetchFeatureInfoFunction?this.fetchFeatureInfoFunction(u):this._defaultFetchFeatureInfoFunction(g(this.featureInfoUrl,u))}findSublayerById(e){return this.allSublayers.find(t=>t.id===e)}findSublayerByName(e){return this.allSublayers.find(t=>t.name===e)}serviceSupportsSpatialReference(e){return q(this.url)||null!=this.spatialReferences&&this.spatialReferences.some(t=>{const r=900913===t?E.WebMercator:new E({wkid:t});return R(r,e)})}_defaultFetchFeatureInfoFunction(e){const t=document.createElement("iframe");t.src=b(d.sanitizeUrl(w(e))),t.style.border="none",t.style.margin="0",t.style.width="100%",t.setAttribute("sandbox","");const i=new o({title:this.title,content:t}),s=new r({sourceLayer:this,popupTemplate:i});return Promise.resolve([s])}async _fetchService(e){if(!this.resourceInfo&&this.parsedUrl?.path){const{path:t,query:r}=this.parsedUrl,{data:o}=await i(t,{query:{SERVICE:"WMS",REQUEST:"GetCapabilities",...r,...this.customParameters},responseType:"xml",signal:e});this.resourceInfo=A(o)}if(this.parsedUrl){const e=new v(this.parsedUrl.path),{httpsDomains:r}=t.request;"https"!==e.scheme||e.port&&"443"!==e.port||!e.host||r.includes(e.host)||r.push(e.host)}this.read(this.resourceInfo,{origin:"service"})}_checkLayerValidity(){if(!this.allSublayers.length)throw new n("wmslayer:empty-layer","The layer doesn't have any sublayer")}_mixCustomParameters(e){if(!this.customLayerParameters&&!this.customParameters)return e;const t={...this.customParameters,...this.customLayerParameters};for(const r in t)e[r.toLowerCase()]=t[r];return e}};function te(e,t){return e.some(e=>{for(const r in e)if(S(e,r,null,t))return!0;return!1})}function re(e,t,r){e=e??[];const o=new Map;e.every(e=>null==e.id)&&(e=p(e)).forEach((e,t)=>e.id=t);for(const s of e){const e=new H;e.read(s,t),r&&!r.includes(e.name)&&(e.visible=!1),o.set(e.id,e)}const i=[];for(const a of e){const e=null!=a.id?o.get(a.id):null;if(e)if(null!=a.parentLayerId&&a.parentLayerId>=0){const t=o.get(a.parentLayerId);if(!t)continue;t.sublayers||(t.sublayers=new s),t.sublayers.push(e)}else i.push(e)}return i}e([x({type:D})],ee.prototype,"timeExtent",void 0),e([x({type:J})],ee.prototype,"timeOffset",void 0),e([x({readOnly:!0})],ee.prototype,"allSublayers",void 0),e([x({json:{type:Object,write:!0}})],ee.prototype,"customParameters",void 0),e([x({json:{type:Object,write:!0}})],ee.prototype,"customLayerParameters",void 0),e([x({type:String,json:{write:!0}})],ee.prototype,"copyright",void 0),e([x()],ee.prototype,"description",void 0),e([x({readOnly:!0})],ee.prototype,"dimensions",void 0),e([x({json:{type:[[Number]],read:{source:"extent"},write:{target:"extent"},origins:{"web-document":{write:{ignoreOrigin:!0}},"portal-item":{write:{ignoreOrigin:!0}}}}})],ee.prototype,"fullExtent",void 0),e([Q(["web-document","portal-item"],"fullExtent",["extent"])],ee.prototype,"readFullExtentFromItemOrMap",null),e([K(["web-document","portal-item"],"fullExtent",{extent:{type:[[Number]]}})],ee.prototype,"writeFullExtent",null),e([x({type:[F]})],ee.prototype,"fullExtents",void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],ee.prototype,"featureInfoFormat",null),e([x({type:[String],readOnly:!0})],ee.prototype,"featureInfoFormats",void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],ee.prototype,"featureInfoUrl",void 0),e([x()],ee.prototype,"fetchFeatureInfoFunction",void 0),e([x({type:String,json:{origins:{"web-document":{default:"image/png",type:X.jsonValues,read:{reader:X.read,source:"format"},write:{writer:X.write,target:"format"}}}}})],ee.prototype,"imageFormat",void 0),e([Q("imageFormat",["supportedImageFormatTypes"])],ee.prototype,"readImageFormat",null),e([x({type:Number,json:{read:{source:"maxHeight"},write:{target:"maxHeight"}}})],ee.prototype,"imageMaxHeight",void 0),e([x({type:Number,json:{read:{source:"maxWidth"},write:{target:"maxWidth"}}})],ee.prototype,"imageMaxWidth",void 0),e([x()],ee.prototype,"imageTransparency",void 0),e([x(N)],ee.prototype,"legendEnabled",void 0),e([x({type:["show","hide","hide-children"]})],ee.prototype,"listMode",void 0),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],ee.prototype,"mapUrl",void 0),e([x({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],ee.prototype,"isReference",void 0),e([x({type:["WMS"]})],ee.prototype,"operationalLayerType",void 0),e([x()],ee.prototype,"resourceInfo",void 0),e([x({type:E,json:{origins:{service:{read:{source:"extent.spatialReference"}}},write:!1}})],ee.prototype,"spatialReference",void 0),e([Q(["web-document","portal-item"],"spatialReference",["spatialReferences"])],ee.prototype,"readSpatialReferenceFromItemOrDocument",null),e([x({type:[I],json:{read:!1,origins:{service:{read:!0},"web-document":{read:!1,write:{ignoreOrigin:!0}},"portal-item":{read:!1,write:{ignoreOrigin:!0}}}}})],ee.prototype,"spatialReferences",void 0),e([K(["web-document","portal-item"],"spatialReferences")],ee.prototype,"writeSpatialReferences",null),e([x({type:s.ofType(H),json:{write:{target:"layers",overridePolicy(e,t,r){if(te(this.allSublayers,r))return{ignoreOrigin:!0}}}}})],ee.prototype,"sublayers",void 0),e([Q(["web-document","portal-item"],"sublayers",["layers","visibleLayers"])],ee.prototype,"readSublayersFromItemOrMap",null),e([Q("service","sublayers",["layers"])],ee.prototype,"readSublayers",null),e([K("sublayers",{layers:{type:[H]},visibleLayers:{type:[String]}})],ee.prototype,"writeSublayers",null),e([x({json:{read:!1},readOnly:!0,value:"wms"})],ee.prototype,"type",void 0),e([x($)],ee.prototype,"url",null),e([x({type:String,json:{write:{ignoreOrigin:!0}}})],ee.prototype,"version",void 0),ee=e([j("esri.layers.WMSLayer")],ee);const oe=ee;export{oe as default};
|
package/layers/WMTSLayer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../request.js";import{isSome as r}from"../core/arrayUtils.js";import i from"../core/Collection.js";import s from"../core/Error.js";import{clone as a}from"../core/lang.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as l}from"../core/promiseUtils.js";import{watch as n,sync as m,on as p}from"../core/reactiveUtils.js";import{urlToObject as c,objectToQuery as u}from"../core/urlUtils.js";import{property as y,subclass as d}from"../core/accessorSupport/decorators.js";import h from"../geometry/Extent.js";import f from"./Layer.js";import v from"./WebTileLayer.js";import{BlendLayer as g}from"./mixins/BlendLayer.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as I}from"./mixins/PortalLayer.js";import{RefreshableLayer as L}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as S}from"./mixins/ScaleRangeLayer.js";import{createTileBitmap as M}from"./support/imageBitmapUtils.js";import T from"./support/TileInfo.js";import P from"./support/TileInfoTilemapCache.js";import{WMTSLayerInfo as b}from"./support/WMTSLayerInfo.js";import j from"./support/WMTSSublayer.js";import{getTileUrlFromResourceUrls as x,getTileUrlTemplateFromResourceUrls as E,parseResourceInfo as _,parseText as C,validateCapabilities as U,parseCapabilities as R}from"./support/wmtsUtils.js";import{reader as O}from"../core/accessorSupport/decorators/reader.js";import{writer as A}from"../core/accessorSupport/decorators/writer.js";var W;const F={"image/png":".png","image/png8":".png","image/png24":".png","image/png32":".png","image/jpg":".jpg","image/jpeg":".jpeg","image/gif":".gif","image/bmp":".bmp","image/tiff":".tif","image/jpgpng":"","image/jpegpng":"","image/unknown":""},V=new Set(["version","service","request","layer","style","format","tilematrixset","tilematrix","tilerow","tilecol"]);let B=W=class extends(g(L(S(w(I(o(f))))))){constructor(...e){super(...e),this.activeLayer=null,this.copyright="",this.customParameters=null,this.customLayerParameters=null,this.fullExtent=null,this.operationalLayerType="WebTiledLayer",this.resourceInfo=null,this.serviceMode="RESTful",this.sublayers=null,this.type="wmts",this.version="1.0.0",this.addHandles([n(()=>this.activeLayer,(e,t)=>{t&&!this.sublayers?.includes(t)&&(t.layer=null,t.parent=null),e&&(e.layer=this,e.parent=this)},m),p(()=>this.sublayers,"after-add",({item:e})=>{e.layer=this,e.parent=this},m),p(()=>this.sublayers,"after-remove",({item:e})=>{e.layer=null,e.parent=null},m),n(()=>this.sublayers,(e,t)=>{if(t)for(const r of t)r.layer=null,r.parent=null;if(e)for(const r of e)r.layer=this,r.parent=this},m)])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMTS"]},e).catch(l).then(()=>this._fetchService(e)).catch(e=>{throw l(e),new s("wmtslayer:unsupported-service-data","Invalid response from the WMTS service.",{error:e})})),Promise.resolve(this)}readActiveLayerFromService(e,t,r){this.activeLayer||(this.activeLayer=new j);let i=t.layers.find(e=>e.id===this.activeLayer.id);return i||(i=t.layers[0]),this.activeLayer.read(i,r),this.activeLayer}readActiveLayerFromItemOrWebDoc(e,t){const{templateUrl:r,wmtsInfo:i}=t,s=r?this._getLowerCasedUrlParams(r):null,a=i?.layerIdentifier;let o=null;const l=i?.tileMatrixSet;l&&(Array.isArray(l)?l.length&&(o=l[0]):o=l);const n=s?.format,m=s?.style;return new j({id:a,imageFormat:n,styleId:m,tileMatrixSetId:o})}writeActiveLayer(e,t,r,i){const{activeLayer:s,loaded:a}=this,{id:o,tileMatrixSet:l,tileMatrixSetId:n,imageFormat:m,styleId:p}=s;t.templateUrl=a?this.getUrlTemplate(o,n,m,p):void 0,t.tileInfo=a?l?.tileInfo?.toJSON(i)??null:void 0,t.wmtsInfo={...t.wmtsInfo,layerIdentifier:o,tileMatrixSet:n}}readCustomParameters(e,t){const r=t.wmtsInfo;return r?this._mergeParams(r.customParameters,r.url):null}get fullExtents(){return this.activeLayer.fullExtents}readServiceMode(e,t){return t.templateUrl.includes("?")?"KVP":"RESTful"}readSublayersFromService(e,t,r){return $(t.layers,r)}get supportedSpatialReferences(){return this.activeLayer.tileMatrixSets?.map(e=>e.tileInfo?.spatialReference).toArray().filter(r)??[]}get tilemapCache(){const e=this.activeLayer?.tileMatrixSet?.tileInfo;return e?new P(e):void 0}get title(){return this.activeLayer?.title??"Layer"}set title(e){this._overrideIfSome("title",e)}get url(){return this._get("url")}set url(e){e&&e.endsWith("/")?this._set("url",e.slice(0,-1)):this._set("url",e)}createWebTileLayer(e){const t=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId),r=this._getTileMatrixSetById(e.tileMatrixSetId),i=r?.tileInfo,s=e.fullExtent,a=new b({layerIdentifier:e.id,tileMatrixSet:e.tileMatrixSetId,url:this.url});return this.customLayerParameters&&(a.customLayerParameters=this.customLayerParameters),this.customParameters&&(a.customParameters=this.customParameters),new v({fullExtent:s,urlTemplate:t,tileInfo:i,wmtsInfo:a})}async fetchTile(e,r,i,s={}){const{signal:a}=s,o=this.getTileUrl(e,r,i),{data:l}=await t(o,{responseType:"image",signal:a});return l}async fetchImageBitmapTile(e,r,i,s={}){const{signal:a}=s;if(this.fetchTile!==W.prototype.fetchTile){const t=await this.fetchTile(e,r,i,s);return M(t,e,r,i,a)}const o=this.getTileUrl(e,r,i),{data:l}=await t(o,{responseType:"blob",signal:a});return M(l,e,r,i,a)}findSublayerById(e){return this.sublayers?.find(t=>t.id===e)}getTileUrl(e,t,r){const i=this._getTileMatrixSetById(this.activeLayer.tileMatrixSetId),s=i?.tileInfo?.lods[e],a=s?s.levelValue||`${s.level}`:`${e}`;let o=this.resourceInfo?"":x({dimensionMap:this.dimensionMap,layerMap:this.layerMap},this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId,a,t,r);if(!o){o=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId).replaceAll(/\{level\}/gi,a).replaceAll(/\{row\}/gi,`${t}`).replaceAll(/\{col\}/gi,`${r}`)}return o=this._appendCustomLayerParameters(o),o}getUrlTemplate(e,t,r,i){if(!this.resourceInfo){const r=E({dimensionMap:this.dimensionMap,layerMap:this.layerMap},e,t,i);if(r)return r}if("KVP"===this.serviceMode)return this.url+"?SERVICE=WMTS&VERSION="+this.version+"&REQUEST=GetTile&LAYER="+e+"&STYLE="+i+"&FORMAT="+r+"&TILEMATRIXSET="+t+"&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}";if("RESTful"===this.serviceMode){let s="";const a=r.toLowerCase();return F[a]&&(s=F[a]),this.url+e+"/"+i+"/"+t+"/{level}/{row}/{col}"+s}return""}async _fetchService(e){if(this.resourceInfo)return"KVP"!==this.resourceInfo.serviceMode||this.url.includes("?")||(this.url+="?"),_(this.resourceInfo),void this.read(this.resourceInfo,{origin:"service"});let t=null;try{const{data:r}=await this._getCapabilities(this.serviceMode,e);t=C(r),U(t)}catch{const r="KVP"===this.serviceMode?"RESTful":"KVP";try{const{data:i}=await this._getCapabilities(r,e);t=C(i),U(t),this.serviceMode=r}catch(o){throw new s("wmtslayer:unsupported-service-data","Services does not support RESTful or KVP service modes.",{error:o})}}const{serviceMode:r,url:i}=this,a=R(t,{serviceMode:r,url:i});this.read(a,{origin:"service"})}async _getCapabilities(e,r){const i=this._getCapabilitiesUrl(e);return await t(i,{...r,responseType:"text"})}_getTileMatrixSetById(e){const t=this.findSublayerById(this.activeLayer.id);return t?.tileMatrixSets?.find(({id:t})=>t===e)}_appendCustomParameters(e){return this._appendParameters(e,this.customParameters)}_appendCustomLayerParameters(e){return this._appendParameters(e,{...a(this.customParameters),...this.customLayerParameters})}_appendParameters(e,t){const r=c(e),i={...r.query,...t},s=u(i);return""===s?r.path:`${r.path}?${s}`}_getCapabilitiesUrl(e){this.url=c(this.url).path;let t=this.url;switch(e){case"KVP":t+=`?request=GetCapabilities&service=WMTS&version=${this.version}`;break;case"RESTful":{const e=`/${this.version}/WMTSCapabilities.xml`,r=new RegExp(e,"i");t=t.replace(r,""),t+=e;break}}return this._appendCustomParameters(t)}_getLowerCasedUrlParams(e){if(!e)return null;const t=c(e).query;if(!t)return null;const r={};return Object.keys(t).forEach(e=>{r[e.toLowerCase()]=t[e]}),r}_mergeParams(e,t){const r=this._getLowerCasedUrlParams(t);if(r){const t=Object.keys(r);t.length&&(e=e?a(e):{},t.forEach(t=>{e.hasOwnProperty(t)||V.has(t)||(e[t]=r[t])}))}return e}};function $(e,t){return e.map(e=>{const r=new j;return r.read(e,t),r})}e([y()],B.prototype,"dimensionMap",void 0),e([y()],B.prototype,"layerMap",void 0),e([y({type:j,json:{origins:{"web-document":{write:{ignoreOrigin:!0}}}}})],B.prototype,"activeLayer",void 0),e([O("service","activeLayer",["layers"])],B.prototype,"readActiveLayerFromService",null),e([O(["web-document","portal-item"],"activeLayer",["wmtsInfo"])],B.prototype,"readActiveLayerFromItemOrWebDoc",null),e([A(["web-document","portal-item"],"activeLayer",{templateUrl:{type:String},tileInfo:{type:T},"wmtsInfo.layerIdentifier":{type:String},"wmtsInfo.tileMatrixSet":{type:String}})],B.prototype,"writeActiveLayer",null),e([y({type:String,value:"",json:{write:!0}})],B.prototype,"copyright",void 0),e([y({type:["show","hide"]})],B.prototype,"listMode",void 0),e([y({json:{read:!0,write:!0}})],B.prototype,"blendMode",void 0),e([y({json:{origins:{"web-document":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}},"portal-item":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}}}}})],B.prototype,"customParameters",void 0),e([O(["portal-item","web-document"],"customParameters")],B.prototype,"readCustomParameters",null),e([y({json:{origins:{"web-document":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}},"portal-item":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}}}}})],B.prototype,"customLayerParameters",void 0),e([y({type:h,json:{write:{ignoreOrigin:!0},origins:{"web-document":{read:{source:"fullExtent"}},"portal-item":{read:{source:"fullExtent"}}}}})],B.prototype,"fullExtent",void 0),e([y({readOnly:!0})],B.prototype,"fullExtents",null),e([y({type:["WebTiledLayer"]})],B.prototype,"operationalLayerType",void 0),e([y()],B.prototype,"resourceInfo",void 0),e([y()],B.prototype,"serviceMode",void 0),e([O(["portal-item","web-document"],"serviceMode",["templateUrl"])],B.prototype,"readServiceMode",null),e([y({type:i.ofType(j)})],B.prototype,"sublayers",void 0),e([O("service","sublayers",["layers"])],B.prototype,"readSublayersFromService",null),e([y({readOnly:!0})],B.prototype,"supportedSpatialReferences",null),e([y({readOnly:!0})],B.prototype,"tilemapCache",null),e([y({json:{read:{source:"title"}}})],B.prototype,"title",null),e([y({json:{read:!1},readOnly:!0,value:"wmts"})],B.prototype,"type",void 0),e([y({json:{origins:{service:{read:{source:"tileUrl"}},"web-document":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}},"portal-item":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}}}}})],B.prototype,"url",null),e([y()],B.prototype,"version",void 0),B=W=e([d("esri.layers.WMTSLayer")],B);const K=B;export{K as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../request.js";import{isSome as r}from"../core/arrayUtils.js";import i from"../core/Collection.js";import s from"../core/Error.js";import{clone as a}from"../core/lang.js";import{MultiOriginJSONSupportMixin as o}from"../core/MultiOriginJSONSupport.js";import{throwIfAbortError as l}from"../core/promiseUtils.js";import{watch as n,sync as m,on as p}from"../core/reactiveUtils.js";import{urlToObject as c,objectToQuery as u}from"../core/urlUtils.js";import{property as y,subclass as d}from"../core/accessorSupport/decorators.js";import h from"../geometry/Extent.js";import f from"./Layer.js";import v from"./WebTileLayer.js";import{BlendLayer as g}from"./mixins/BlendLayer.js";import{OperationalLayer as w}from"./mixins/OperationalLayer.js";import{PortalLayer as I}from"./mixins/PortalLayer.js";import{RefreshableLayer as L}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as S}from"./mixins/ScaleRangeLayer.js";import{createTileBitmap as M}from"./support/imageBitmapUtils.js";import T from"./support/TileInfo.js";import P from"./support/TileInfoTilemapCache.js";import{WMTSLayerInfo as b}from"./support/WMTSLayerInfo.js";import j from"./support/WMTSSublayer.js";import{getTileUrlFromResourceUrls as x,getTileUrlTemplateFromResourceUrls as E,parseResourceInfo as _,parseText as C,validateCapabilities as U,parseCapabilities as R}from"./support/wmtsUtils.js";import{reader as O}from"../core/accessorSupport/decorators/reader.js";import{writer as A}from"../core/accessorSupport/decorators/writer.js";var W;const F={"image/png":".png","image/png8":".png","image/png24":".png","image/png32":".png","image/jpg":".jpg","image/jpeg":".jpeg","image/gif":".gif","image/bmp":".bmp","image/tiff":".tif","image/jpgpng":"","image/jpegpng":"","image/unknown":""},V=new Set(["version","service","request","layer","style","format","tilematrixset","tilematrix","tilerow","tilecol"]);let B=W=class extends(g(L(S(w(I(o(f))))))){constructor(...e){super(...e),this.activeLayer=null,this.copyright="",this.customParameters=null,this.customLayerParameters=null,this.fullExtent=null,this.operationalLayerType="WebTiledLayer",this.resourceInfo=null,this.serviceMode="RESTful",this.sublayers=null,this.type="wmts",this.version="1.0.0",this.addHandles([n(()=>this.activeLayer,(e,t)=>{t&&!this.sublayers?.includes(t)&&(t.layer=null,t.parent=null),e&&(e.layer=this,e.parent=this)},m),p(()=>this.sublayers,"after-add",({item:e})=>{e.layer=this,e.parent=this},m),p(()=>this.sublayers,"after-remove",({item:e})=>{e.layer=null,e.parent=null},m),n(()=>this.sublayers,(e,t)=>{if(t)for(const r of t)r.layer=null,r.parent=null;if(e)for(const r of e)r.layer=this,r.parent=this},m)])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}load(e){return this.addResolvingPromise(this.loadFromPortal({supportedTypes:["WMTS"]},e).catch(l).then(()=>this._fetchService(e)).catch(e=>{throw l(e),new s("wmtslayer:unsupported-service-data","Invalid response from the WMTS service.",{error:e})})),Promise.resolve(this)}readActiveLayerFromService(e,t,r){this.activeLayer||(this.activeLayer=new j);let i=t.layers.find(e=>e.id===this.activeLayer.id);return i||(i=t.layers[0]),this.activeLayer.read(i,r),this.activeLayer}readActiveLayerFromItemOrWebDoc(e,t){const{templateUrl:r,wmtsInfo:i}=t,s=r?this._getLowerCasedUrlParams(r):null,a=i?.layerIdentifier;let o=null;const l=i?.tileMatrixSet;l&&(Array.isArray(l)?l.length&&(o=l[0]):o=l);const n=s?.format,m=s?.style;return new j({id:a,imageFormat:n,styleId:m,tileMatrixSetId:o})}writeActiveLayer(e,t,r,i){const{activeLayer:s,loaded:a}=this,{id:o,tileMatrixSet:l,tileMatrixSetId:n,imageFormat:m,styleId:p}=s;t.templateUrl=a?this.getUrlTemplate(o,n,m,p):void 0,t.tileInfo=a?l?.tileInfo?.toJSON(i)??null:void 0,t.wmtsInfo={...t.wmtsInfo,layerIdentifier:o,tileMatrixSet:n}}readCustomParameters(e,t){const r=t.wmtsInfo;return r?this._mergeParams(r.customParameters,r.url):null}get fullExtents(){return this.activeLayer.fullExtents}readServiceMode(e,t){return t.templateUrl.includes("?")?"KVP":"RESTful"}readSublayersFromService(e,t,r){return $(t.layers,r)}get supportedSpatialReferences(){return this.activeLayer.tileMatrixSets?.map(e=>e.tileInfo?.spatialReference).toArray().filter(r)??[]}get tilemapCache(){const e=this.activeLayer?.tileMatrixSet?.tileInfo;return e?new P(e):void 0}get title(){return this.activeLayer?.title??"Layer"}set title(e){this._overrideIfSome("title",e)}get url(){return this._get("url")}set url(e){e&&e.endsWith("/")?this._set("url",e.slice(0,-1)):this._set("url",e)}createWebTileLayer(e){const t=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId),r=this._getTileMatrixSetById(e.tileMatrixSetId),i=r?.tileInfo,s=e.fullExtent,a=new b({layerIdentifier:e.id,tileMatrixSet:e.tileMatrixSetId,url:this.url});return this.customLayerParameters&&(a.customLayerParameters=this.customLayerParameters),this.customParameters&&(a.customParameters=this.customParameters),new v({fullExtent:s,urlTemplate:t,tileInfo:i,wmtsInfo:a})}async fetchTile(e,r,i,s={}){const{signal:a}=s,o=this.getTileUrl(e,r,i),{data:l}=await t(o,{responseType:"image",signal:a});return l}async fetchImageBitmapTile(e,r,i,s={}){const{signal:a}=s;if(this.fetchTile!==W.prototype.fetchTile){const t=await this.fetchTile(e,r,i,s);return M(t,e,r,i,s)}const o=this.getTileUrl(e,r,i),{data:l}=await t(o,{responseType:"blob",signal:a});return M(l,e,r,i,s)}findSublayerById(e){return this.sublayers?.find(t=>t.id===e)}getTileUrl(e,t,r){const i=this._getTileMatrixSetById(this.activeLayer.tileMatrixSetId),s=i?.tileInfo?.lods[e],a=s?s.levelValue||`${s.level}`:`${e}`;let o=this.resourceInfo?"":x({dimensionMap:this.dimensionMap,layerMap:this.layerMap},this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId,a,t,r);if(!o){o=this.getUrlTemplate(this.activeLayer.id,this.activeLayer.tileMatrixSetId,this.activeLayer.imageFormat,this.activeLayer.styleId).replaceAll(/\{level\}/gi,a).replaceAll(/\{row\}/gi,`${t}`).replaceAll(/\{col\}/gi,`${r}`)}return o=this._appendCustomLayerParameters(o),o}getUrlTemplate(e,t,r,i){if(!this.resourceInfo){const r=E({dimensionMap:this.dimensionMap,layerMap:this.layerMap},e,t,i);if(r)return r}if("KVP"===this.serviceMode)return this.url+"?SERVICE=WMTS&VERSION="+this.version+"&REQUEST=GetTile&LAYER="+e+"&STYLE="+i+"&FORMAT="+r+"&TILEMATRIXSET="+t+"&TILEMATRIX={level}&TILEROW={row}&TILECOL={col}";if("RESTful"===this.serviceMode){let s="";const a=r.toLowerCase();return F[a]&&(s=F[a]),this.url+e+"/"+i+"/"+t+"/{level}/{row}/{col}"+s}return""}async _fetchService(e){if(this.resourceInfo)return"KVP"!==this.resourceInfo.serviceMode||this.url.includes("?")||(this.url+="?"),_(this.resourceInfo),void this.read(this.resourceInfo,{origin:"service"});let t=null;try{const{data:r}=await this._getCapabilities(this.serviceMode,e);t=C(r),U(t)}catch{const r="KVP"===this.serviceMode?"RESTful":"KVP";try{const{data:i}=await this._getCapabilities(r,e);t=C(i),U(t),this.serviceMode=r}catch(o){throw new s("wmtslayer:unsupported-service-data","Services does not support RESTful or KVP service modes.",{error:o})}}const{serviceMode:r,url:i}=this,a=R(t,{serviceMode:r,url:i});this.read(a,{origin:"service"})}async _getCapabilities(e,r){const i=this._getCapabilitiesUrl(e);return await t(i,{...r,responseType:"text"})}_getTileMatrixSetById(e){const t=this.findSublayerById(this.activeLayer.id);return t?.tileMatrixSets?.find(({id:t})=>t===e)}_appendCustomParameters(e){return this._appendParameters(e,this.customParameters)}_appendCustomLayerParameters(e){return this._appendParameters(e,{...a(this.customParameters),...this.customLayerParameters})}_appendParameters(e,t){const r=c(e),i={...r.query,...t},s=u(i);return""===s?r.path:`${r.path}?${s}`}_getCapabilitiesUrl(e){this.url=c(this.url).path;let t=this.url;switch(e){case"KVP":t+=`?request=GetCapabilities&service=WMTS&version=${this.version}`;break;case"RESTful":{const e=`/${this.version}/WMTSCapabilities.xml`,r=new RegExp(e,"i");t=t.replace(r,""),t+=e;break}}return this._appendCustomParameters(t)}_getLowerCasedUrlParams(e){if(!e)return null;const t=c(e).query;if(!t)return null;const r={};return Object.keys(t).forEach(e=>{r[e.toLowerCase()]=t[e]}),r}_mergeParams(e,t){const r=this._getLowerCasedUrlParams(t);if(r){const t=Object.keys(r);t.length&&(e=e?a(e):{},t.forEach(t=>{e.hasOwnProperty(t)||V.has(t)||(e[t]=r[t])}))}return e}};function $(e,t){return e.map(e=>{const r=new j;return r.read(e,t),r})}e([y()],B.prototype,"dimensionMap",void 0),e([y()],B.prototype,"layerMap",void 0),e([y({type:j,json:{origins:{"web-document":{write:{ignoreOrigin:!0}}}}})],B.prototype,"activeLayer",void 0),e([O("service","activeLayer",["layers"])],B.prototype,"readActiveLayerFromService",null),e([O(["web-document","portal-item"],"activeLayer",["wmtsInfo"])],B.prototype,"readActiveLayerFromItemOrWebDoc",null),e([A(["web-document","portal-item"],"activeLayer",{templateUrl:{type:String},tileInfo:{type:T},"wmtsInfo.layerIdentifier":{type:String},"wmtsInfo.tileMatrixSet":{type:String}})],B.prototype,"writeActiveLayer",null),e([y({type:String,value:"",json:{write:!0}})],B.prototype,"copyright",void 0),e([y({type:["show","hide"]})],B.prototype,"listMode",void 0),e([y({json:{read:!0,write:!0}})],B.prototype,"blendMode",void 0),e([y({json:{origins:{"web-document":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}},"portal-item":{read:{source:["wmtsInfo.customParameters","wmtsInfo.url"]},write:{target:"wmtsInfo.customParameters"}}}}})],B.prototype,"customParameters",void 0),e([O(["portal-item","web-document"],"customParameters")],B.prototype,"readCustomParameters",null),e([y({json:{origins:{"web-document":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}},"portal-item":{read:{source:"wmtsInfo.customLayerParameters"},write:{target:"wmtsInfo.customLayerParameters"}}}}})],B.prototype,"customLayerParameters",void 0),e([y({type:h,json:{write:{ignoreOrigin:!0},origins:{"web-document":{read:{source:"fullExtent"}},"portal-item":{read:{source:"fullExtent"}}}}})],B.prototype,"fullExtent",void 0),e([y({readOnly:!0})],B.prototype,"fullExtents",null),e([y({type:["WebTiledLayer"]})],B.prototype,"operationalLayerType",void 0),e([y()],B.prototype,"resourceInfo",void 0),e([y()],B.prototype,"serviceMode",void 0),e([O(["portal-item","web-document"],"serviceMode",["templateUrl"])],B.prototype,"readServiceMode",null),e([y({type:i.ofType(j)})],B.prototype,"sublayers",void 0),e([O("service","sublayers",["layers"])],B.prototype,"readSublayersFromService",null),e([y({readOnly:!0})],B.prototype,"supportedSpatialReferences",null),e([y({readOnly:!0})],B.prototype,"tilemapCache",null),e([y({json:{read:{source:"title"}}})],B.prototype,"title",null),e([y({json:{read:!1},readOnly:!0,value:"wmts"})],B.prototype,"type",void 0),e([y({json:{origins:{service:{read:{source:"tileUrl"}},"web-document":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}},"portal-item":{read:{source:"wmtsInfo.url"},write:{target:"wmtsInfo.url"}}}}})],B.prototype,"url",null),e([y()],B.prototype,"version",void 0),B=W=e([d("esri.layers.WMTSLayer")],B);const K=B;export{K as default};
|
package/layers/WebTileLayer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../request.js";import l from"../core/Error.js";import{MultiOriginJSONSupportMixin as r}from"../core/MultiOriginJSONSupport.js";import{replace as o}from"../core/string.js";import{Url as s,ensureTrailingSlash as i,isProtocolRelative as n,normalize as a}from"../core/urlUtils.js";import{property as p,subclass as u}from"../core/accessorSupport/decorators.js";import m from"../geometry/Extent.js";import c from"../geometry/Point.js";import f from"../geometry/SpatialReference.js";import y from"./Layer.js";import{BlendLayer as h}from"./mixins/BlendLayer.js";import{OperationalLayer as d}from"./mixins/OperationalLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RefreshableLayer as w}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as g}from"./mixins/ScaleRangeLayer.js";import{createTileBitmap as T}from"./support/imageBitmapUtils.js";import j from"./support/LOD.js";import b from"./support/TileInfo.js";import{WMTSLayerInfo as R}from"./support/WMTSLayerInfo.js";import{reader as S}from"../core/accessorSupport/decorators/reader.js";import{writer as x}from"../core/accessorSupport/decorators/writer.js";var L;let U=L=class extends(h(w(g(d(v(r(y))))))){constructor(...e){super(...e),this.copyright="",this.fullExtent=new m(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,f.WebMercator),this.legendEnabled=!1,this.isReference=null,this.popupEnabled=!1,this.spatialReference=f.WebMercator,this.subDomains=null,this.tileInfo=new b({size:[256,256],dpi:96,format:"png8",compressionQuality:0,origin:new c({x:-20037508.342787,y:20037508.342787,spatialReference:f.WebMercator}),spatialReference:f.WebMercator,lods:[new j({level:0,scale:591657527.591555,resolution:156543.033928}),new j({level:1,scale:295828763.795777,resolution:78271.5169639999}),new j({level:2,scale:147914381.897889,resolution:39135.7584820001}),new j({level:3,scale:73957190.948944,resolution:19567.8792409999}),new j({level:4,scale:36978595.474472,resolution:9783.93962049996}),new j({level:5,scale:18489297.737236,resolution:4891.96981024998}),new j({level:6,scale:9244648.868618,resolution:2445.98490512499}),new j({level:7,scale:4622324.434309,resolution:1222.99245256249}),new j({level:8,scale:2311162.217155,resolution:611.49622628138}),new j({level:9,scale:1155581.108577,resolution:305.748113140558}),new j({level:10,scale:577790.554289,resolution:152.874056570411}),new j({level:11,scale:288895.277144,resolution:76.4370282850732}),new j({level:12,scale:144447.638572,resolution:38.2185141425366}),new j({level:13,scale:72223.819286,resolution:19.1092570712683}),new j({level:14,scale:36111.909643,resolution:9.55462853563415}),new j({level:15,scale:18055.954822,resolution:4.77731426794937}),new j({level:16,scale:9027.977411,resolution:2.38865713397468}),new j({level:17,scale:4513.988705,resolution:1.19432856685505}),new j({level:18,scale:2256.994353,resolution:.597164283559817}),new j({level:19,scale:1128.497176,resolution:.298582141647617}),new j({level:20,scale:564.248588,resolution:.14929107082380833}),new j({level:21,scale:282.124294,resolution:.07464553541190416}),new j({level:22,scale:141.062147,resolution:.03732276770595208}),new j({level:23,scale:70.5310735,resolution:.01866138385297604})]}),this.type="web-tile",this.urlTemplate=null,this.wmtsInfo=null}normalizeCtorArgs(e,t){return"string"==typeof e?{urlTemplate:e,...t}:e}load(e){const t=this.loadFromPortal({supportedTypes:["WMTS"]},e).then(()=>{let e="";if(this.urlTemplate)if(this.spatialReference.equals(this.tileInfo.spatialReference)){const t=new s(this.urlTemplate);!(!!this.subDomains&&this.subDomains.length>0)&&t.authority?.includes("{subDomain}")&&(e="is missing 'subDomains' property")}else e="spatialReference must match tileInfo.spatialReference";else e="is missing the required 'urlTemplate' property value";if(e)throw new l("web-tile-layer:load",`WebTileLayer (title: '${this.title}', id: '${this.id}') ${e}`)});return this.addResolvingPromise(t),Promise.resolve(this)}get levelValues(){const e=[];if(!this.tileInfo)return null;for(const t of this.tileInfo.lods)e[t.level]=t.levelValue||t.level;return e}get loaded(){return super.loaded}readSpatialReference(e,t){return e||f.fromJSON(t.fullExtent?.spatialReference)}get tileServers(){if(!this.urlTemplate)return null;const e=[],{urlTemplate:t,subDomains:l}=this,r=new s(t),o=r.scheme?r.scheme+"://":"//",n=o+r.authority+"/",a=r.authority;if(a?.includes("{subDomain}")){if(l&&l.length>0&&a.split(".").length>1)for(const s of l)e.push(o+a.replaceAll(/\{subDomain\}/gi,s)+"/")}else e.push(n);return e.map(i)}get urlPath(){if(!this.urlTemplate)return null;const e=this.urlTemplate,t=new s(e),l=(t.scheme?t.scheme+"://":"//")+t.authority+"/";return e.slice(l.length)}readUrlTemplate(e,t){return e||t.templateUrl}writeUrlTemplate(e,t){n(e)&&(e="https:"+e),e&&(e=e.replaceAll(/\{z\}/gi,"{level}").replaceAll(/\{x\}/gi,"{col}").replaceAll(/\{y\}/gi,"{row}"),e=a(e)),t.templateUrl=e}fetchTile(e,l,r,o={}){const{signal:s}=o,i=this.getTileUrl(e,l,r),n={responseType:"image",signal:s,query:{...this.refreshParameters}};return t(i,n).then(e=>e.data)}async fetchImageBitmapTile(e,l,r,o={}){const{signal:s}=o;if(this.fetchTile!==L.prototype.fetchTile){const t=await this.fetchTile(e,l,r,o);return T(t,e,l,r,
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../request.js";import l from"../core/Error.js";import{MultiOriginJSONSupportMixin as r}from"../core/MultiOriginJSONSupport.js";import{replace as o}from"../core/string.js";import{Url as s,ensureTrailingSlash as i,isProtocolRelative as n,normalize as a}from"../core/urlUtils.js";import{property as p,subclass as u}from"../core/accessorSupport/decorators.js";import m from"../geometry/Extent.js";import c from"../geometry/Point.js";import f from"../geometry/SpatialReference.js";import y from"./Layer.js";import{BlendLayer as h}from"./mixins/BlendLayer.js";import{OperationalLayer as d}from"./mixins/OperationalLayer.js";import{PortalLayer as v}from"./mixins/PortalLayer.js";import{RefreshableLayer as w}from"./mixins/RefreshableLayer.js";import{ScaleRangeLayer as g}from"./mixins/ScaleRangeLayer.js";import{createTileBitmap as T}from"./support/imageBitmapUtils.js";import j from"./support/LOD.js";import b from"./support/TileInfo.js";import{WMTSLayerInfo as R}from"./support/WMTSLayerInfo.js";import{reader as S}from"../core/accessorSupport/decorators/reader.js";import{writer as x}from"../core/accessorSupport/decorators/writer.js";var L;let U=L=class extends(h(w(g(d(v(r(y))))))){constructor(...e){super(...e),this.copyright="",this.fullExtent=new m(-20037508.342787,-20037508.34278,20037508.34278,20037508.342787,f.WebMercator),this.legendEnabled=!1,this.isReference=null,this.popupEnabled=!1,this.spatialReference=f.WebMercator,this.subDomains=null,this.tileInfo=new b({size:[256,256],dpi:96,format:"png8",compressionQuality:0,origin:new c({x:-20037508.342787,y:20037508.342787,spatialReference:f.WebMercator}),spatialReference:f.WebMercator,lods:[new j({level:0,scale:591657527.591555,resolution:156543.033928}),new j({level:1,scale:295828763.795777,resolution:78271.5169639999}),new j({level:2,scale:147914381.897889,resolution:39135.7584820001}),new j({level:3,scale:73957190.948944,resolution:19567.8792409999}),new j({level:4,scale:36978595.474472,resolution:9783.93962049996}),new j({level:5,scale:18489297.737236,resolution:4891.96981024998}),new j({level:6,scale:9244648.868618,resolution:2445.98490512499}),new j({level:7,scale:4622324.434309,resolution:1222.99245256249}),new j({level:8,scale:2311162.217155,resolution:611.49622628138}),new j({level:9,scale:1155581.108577,resolution:305.748113140558}),new j({level:10,scale:577790.554289,resolution:152.874056570411}),new j({level:11,scale:288895.277144,resolution:76.4370282850732}),new j({level:12,scale:144447.638572,resolution:38.2185141425366}),new j({level:13,scale:72223.819286,resolution:19.1092570712683}),new j({level:14,scale:36111.909643,resolution:9.55462853563415}),new j({level:15,scale:18055.954822,resolution:4.77731426794937}),new j({level:16,scale:9027.977411,resolution:2.38865713397468}),new j({level:17,scale:4513.988705,resolution:1.19432856685505}),new j({level:18,scale:2256.994353,resolution:.597164283559817}),new j({level:19,scale:1128.497176,resolution:.298582141647617}),new j({level:20,scale:564.248588,resolution:.14929107082380833}),new j({level:21,scale:282.124294,resolution:.07464553541190416}),new j({level:22,scale:141.062147,resolution:.03732276770595208}),new j({level:23,scale:70.5310735,resolution:.01866138385297604})]}),this.type="web-tile",this.urlTemplate=null,this.wmtsInfo=null}normalizeCtorArgs(e,t){return"string"==typeof e?{urlTemplate:e,...t}:e}load(e){const t=this.loadFromPortal({supportedTypes:["WMTS"]},e).then(()=>{let e="";if(this.urlTemplate)if(this.spatialReference.equals(this.tileInfo.spatialReference)){const t=new s(this.urlTemplate);!(!!this.subDomains&&this.subDomains.length>0)&&t.authority?.includes("{subDomain}")&&(e="is missing 'subDomains' property")}else e="spatialReference must match tileInfo.spatialReference";else e="is missing the required 'urlTemplate' property value";if(e)throw new l("web-tile-layer:load",`WebTileLayer (title: '${this.title}', id: '${this.id}') ${e}`)});return this.addResolvingPromise(t),Promise.resolve(this)}get levelValues(){const e=[];if(!this.tileInfo)return null;for(const t of this.tileInfo.lods)e[t.level]=t.levelValue||t.level;return e}get loaded(){return super.loaded}readSpatialReference(e,t){return e||f.fromJSON(t.fullExtent?.spatialReference)}get tileServers(){if(!this.urlTemplate)return null;const e=[],{urlTemplate:t,subDomains:l}=this,r=new s(t),o=r.scheme?r.scheme+"://":"//",n=o+r.authority+"/",a=r.authority;if(a?.includes("{subDomain}")){if(l&&l.length>0&&a.split(".").length>1)for(const s of l)e.push(o+a.replaceAll(/\{subDomain\}/gi,s)+"/")}else e.push(n);return e.map(i)}get urlPath(){if(!this.urlTemplate)return null;const e=this.urlTemplate,t=new s(e),l=(t.scheme?t.scheme+"://":"//")+t.authority+"/";return e.slice(l.length)}readUrlTemplate(e,t){return e||t.templateUrl}writeUrlTemplate(e,t){n(e)&&(e="https:"+e),e&&(e=e.replaceAll(/\{z\}/gi,"{level}").replaceAll(/\{x\}/gi,"{col}").replaceAll(/\{y\}/gi,"{row}"),e=a(e)),t.templateUrl=e}fetchTile(e,l,r,o={}){const{signal:s}=o,i=this.getTileUrl(e,l,r),n={responseType:"image",signal:s,query:{...this.refreshParameters}};return t(i,n).then(e=>e.data)}async fetchImageBitmapTile(e,l,r,o={}){const{signal:s}=o;if(this.fetchTile!==L.prototype.fetchTile){const t=await this.fetchTile(e,l,r,o);return T(t,e,l,r,o)}const i=this.getTileUrl(e,l,r),n={responseType:"blob",signal:s,query:{...this.refreshParameters}},{data:a}=await t(i,n);return T(a,e,l,r,o)}getTileUrl(e,t,l){const{levelValues:r,tileServers:s,urlPath:i}=this;if(!r||!s||!i)return"";const n=r[e];return s[t%s.length]+o(i,{level:n,z:n,col:l,x:l,row:t,y:t})}};e([p({type:String,value:"",json:{write:!0}})],U.prototype,"copyright",void 0),e([p({type:m,json:{write:!0},nonNullable:!0})],U.prototype,"fullExtent",void 0),e([p({readOnly:!0,json:{read:!1,write:!1}})],U.prototype,"legendEnabled",void 0),e([p({type:["show","hide"]})],U.prototype,"listMode",void 0),e([p({json:{read:!0,write:!0}})],U.prototype,"blendMode",void 0),e([p()],U.prototype,"levelValues",null),e([p({type:Boolean,json:{read:!1,write:{enabled:!0,overridePolicy:()=>({enabled:!1})}}})],U.prototype,"isReference",void 0),e([p({type:["WebTiledLayer"],value:"WebTiledLayer"})],U.prototype,"operationalLayerType",void 0),e([p({readOnly:!0,json:{read:!1,write:!1}})],U.prototype,"popupEnabled",void 0),e([p({type:f})],U.prototype,"spatialReference",void 0),e([S("spatialReference",["spatialReference","fullExtent.spatialReference"])],U.prototype,"readSpatialReference",null),e([p({type:[String],json:{write:!0}})],U.prototype,"subDomains",void 0),e([p({type:b,json:{write:!0}})],U.prototype,"tileInfo",void 0),e([p({readOnly:!0})],U.prototype,"tileServers",null),e([p({json:{read:!1}})],U.prototype,"type",void 0),e([p()],U.prototype,"urlPath",null),e([p({type:String,json:{origins:{"portal-item":{read:{source:"url"}}}}})],U.prototype,"urlTemplate",void 0),e([S("urlTemplate",["urlTemplate","templateUrl"])],U.prototype,"readUrlTemplate",null),e([x("urlTemplate",{templateUrl:{type:String}})],U.prototype,"writeUrlTemplate",null),e([p({type:R,json:{write:!0}})],U.prototype,"wmtsInfo",void 0),U=L=e([u("esri.layers.WebTileLayer")],U);export{U as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import{toConst as i}from"../../../core/compilerUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import{clone as s}from"../../../core/lang.js";import{removeMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{signalFromSignalOrOptions as l,throwIfAborted as o}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as u}from"../../../core/units.js";import{isSerializable as c}from"../../../core/support/jsonUtils.js";import{isLoaded as y}from"../../../geometry/projectionUtils.js";import{set as h,create as d,expandWithAABB as m,negativeInfinity as f}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as p,create as x}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as g}from"../../../geometry/support/boundsUtils.js";import{isExtent as _,isPolygon as F}from"../../../geometry/support/jsonTypeUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as Q}from"../../../geometry/support/normalizeUtils.js";import{equals as S,isValid as R}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as I}from"../featureConversionUtils.js";import{getWhereClause as j}from"./attributeSupport.js";import{getGeometry as b,cleanFromGeometryEngine as E}from"./geometryUtils.js";import{checkProjectionSupport as T,project as A,projectMany as v}from"./projectionSupport.js";import{QueryEngineCache as G}from"./QueryEngineCache.js";import{queryCapabilities as k}from"./QueryEngineCapabilities.js";import{QueryEngineResult as C}from"./QueryEngineResult.js";import{queryEngineEmptyResult as O,normalizeAttributeBinsQuery as P,normalizeQueryLike as q,normalizeQuery as z}from"./queryUtils.js";import{validateAttributeBinsQuery as U,validateQuery as B,validateStatisticsQuery as M}from"./queryValidationUtils.js";import{getSpatialQueryOperator as H,canQueryWithRBush as N}from"./spatialQuerySupport.js";import{getTimeExtent as Z,getTimeOperator as J}from"./timeSupport.js";import L from"../../support/FieldsIndex.js";import{ImmediateTask as V}from"../../../views/support/Scheduler.js";const D="unsupported-query";class K{constructor(e,t=null,i,r,s){this.attributes=e,this.geometry=i,this.centroid=r,this.filterFlags=s,this.groupId=-1,this.displayId=t}}class W{constructor(e){this._changeHandle=null,this.capabilities={query:k},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._cache=e.cache??new G,this.timeInfo=e.timeInfo,this.featureIdInfo=e.featureIdInfo,"object-id"===e.featureIdInfo.type&&(this.objectIdField=e.featureIdInfo.fieldName),this._changeHandle=this.featureStore.events.on("changed",()=>this._clearCache()),this.fieldsIndex=c(e.fieldsIndex)?e.fieldsIndex:L.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map(e=>e.name)):this.availableFields=new Set(e.availableFields.map(e=>this.fieldsIndex.get(e)?.name).filter(e=>null!=e)),e.scheduler&&e.priority?this._frameTask=e.scheduler.registerTask(e.priority):this._frameTask=V}destroy(){this._changeHandle=a(this._changeHandle),this._frameTask=a(this._frameTask),this._clearCache(),n(this._cache)}get featureAdapter(){return this.featureStore.featureAdapter}async executeQuery(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryFeatureSet(e),i)}async executeQueryForCount(e={},t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForCount(e),i)}async executeQueryForExtent(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForExtent(e),i)}async executeQueryForIds(e,t){return Array.from(await this.executeQueryForIdSet(e,t))}async executeQueryForIdSet(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForIdSet(e),i)}async executeQueryForLatestObservations(e,t){const i=l(t);if(!this.timeInfo?.trackIdField)throw new r(D,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});return await this._frameTask.scheduleGenerator(()=>this._executeQueryForLatestObservations(e),i)}async executeQueryForOpaqueFeatures(e,t){const i=l(t);return(await this._frameTask.scheduleGenerator(()=>this._executeQuery(e,{}),i)).items}async executeAttributeBinsQuery(e,t){const i=l(t);return e=s(e),await this._frameTask.scheduleGenerator(()=>this._executeAttributeBinsQuery(e),i)}async executeQueryForSummaryStatistics(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSummaryStatistics(e,t),r)}async executeQueryForUniqueValues(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForUniqueValues(e,t),r)}async executeQueryForClassBreaks(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForClassBreaks(e,t),r)}async executeQueryForHistogram(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForHistogram(e,t),r)}async executeQueryForSnapping(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSnapping(e,i),i)}async fetchRecomputedExtents(e){const t=l(e);this._timeExtentPromise||=Z(this.timeInfo,this.featureStore);const[i,r]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return o(t),{fullExtent:i,timeExtent:r}}_clearCache(){this._cache.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async*_executeQueryFeatureSet(e){try{const t=yield*this._executeQuery(e,{});return yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeQueryForCount(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null});return yield,t.createQueryResponseForCount()}catch(t){if(t!==O)throw t;return 0}}async*_executeQueryForExtent(e){const t=e.outSR;try{const i=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const r=i.size;if(!r)return{count:0,extent:null};const s=await this._getBounds(i.items,i.spatialReference,t??this.spatialReference);return yield,{count:r,extent:s}}catch(i){if(i===O)return{count:0,extent:null};throw i}}async*_executeQueryForIdSet(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const i=t.items,r=new Set;for(const e of i)r.add(t.featureAdapter.getObjectId(e));return r}catch(t){if(t===O)return new Set;throw t}}async*_executeQueryForLatestObservations(e){try{const t=yield*this._executeQuery(e,{});return yield,this._filterLatest(t),yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeAttributeBinsQuery(e){let t;try{e=await P(e,this.definitionExpression,this.spatialReference),yield,e=await U(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield,t=yield*this._executeGeometryQuery(e,i),yield,this._executeAggregateIdsQuery(t),yield,this._executeObjectIdsQuery(t),yield,this._executeTimeQuery(t),yield,this._executeAttributesQuery(t),yield}catch(i){if(i!==O)throw i;t=new C([],e,this)}return await t.createQueryBinsResponse(e)}async*_executeQueryForSummaryStatistics(e={},t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createSummaryStatisticsResponse(t)}async*_executeQueryForUniqueValues(e={},t){const{field:i,field2:r,field3:s,valueExpression:a}=t,n=yield*this._executeQueryForStatistics(e,{field:i,field2:r,field3:s,valueExpression:a});return yield,await n.createUniqueValuesResponse(t)}async*_executeQueryForClassBreaks(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createClassBreaksResponse(t)}async*_executeQueryForHistogram(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createHistogramResponse(t)}async*_executeQueryForSnapping(e,t){const{point:i,distance:r,returnEdge:a,vertexMode:n}=e;if(!a&&"none"===n)return{candidates:[]};let l=s(e.query);l=await q(l,this.definitionExpression,this.spatialReference),yield,l=await B(l,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const o=!S(i.spatialReference,this.spatialReference);o&&(await T(i.spatialReference,this.spatialReference),yield);const u="number"==typeof r?r:r.x,c="number"==typeof r?r:r.y,y={xmin:i.x-u,xmax:i.x+u,ymin:i.y-c,ymax:i.y+c,spatialReference:i.spatialReference},h=o?A(y,this.spatialReference):y;if(!h)return{candidates:[]};const d=(await Q(w(i),null,{signal:t}))[0];yield;const m=(await Q(w(h),null,{signal:t}))[0];if(yield,null==d||null==m)return{candidates:[]};const f=await this._searchFeatures(X(m.toJSON()));yield;const p=new C(f,l,this);this._executeObjectIdsQuery(p),yield,this._executeTimeQuery(p),yield,this._executeAttributesQuery(p),yield,yield*this._executeGeometryQueryForSnapping(p),yield;const x=d.toJSON(),g=o?A(x,this.spatialReference):x,_=o?Math.max(h.xmax-h.xmin,h.ymax-h.ymin)/2:r;return p.createSnappingResponse({...e,point:g,distance:_},l.returnZ,i.spatialReference)}async _getBounds(e,t,i){const r=h(d(),f);return await this.featureStore.forEachBounds(e,e=>m(r,e)),Y(r,t,i,this.spatialReference,this.hasZ)}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then(e=>this._getBounds(e,this.spatialReference,this.spatialReference)),this._fullExtentPromise}async _getAllFeaturesQueryEngineResult(e){return new C(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>await this.featureStore.forEach(t=>e.push(t)))().then(()=>i(e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async*_executeQuery(e,t){e=s(e),e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await B(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield,e={...e,...t};const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),r}async*_executeSceneFilterQuery(e){if(null==e.sceneFilter)return null;const{outSR:t,returnGeometry:i,returnCentroid:r}=e,s=this.featureStore.featureSpatialReference,a=e.sceneFilter.geometry,n=null==s||S(s,a.spatialReference)?a:A(a,s);if(!n)return null;const l=i||r,o=R(t)&&!S(this.spatialReference,t)&&l?async e=>this._project(e,t):e=>e;yield;const u=this.featureAdapter,c=await this._searchFeatures(X(n));yield;if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const t=new Set;for(const e of c)t.add(u.getObjectId(e));const i=await this._getAllFeatures();yield;const r=await H("esriSpatialRelDisjoint",n,this.geometryType);yield;const s=e=>!t.has(u.getObjectId(e))||r(u.getGeometry(e)),a=yield*this._runSpatialFilter(i,s);yield;const l=new C(a,e,this);return await o(l)}if(!c.length)return new C([],e,this);if(this._canExecuteSinglePass(n,e))return await o(new C(c,e,this));const y=await H("esriSpatialRelContains",n,this.geometryType);yield;const h=yield*this._runSpatialFilter(c,e=>y(u.getGeometry(e)));return yield,await o(new C(h,e,this))}async*_executeGeometryQuery(i,r){if(null!=r&&0===r.items.length)return r;const{geometry:s,outSR:a,returnGeometry:n,returnCentroid:l}=i,o=r?null:this._getCacheKey(i),u=o?this._cache.get(o):null;if(u)return new C(u,i,this);const c=R(a)&&!S(this.spatialReference,a),y=n||l,h=async e=>(c&&y&&await this._project(e,a),o&&this._cache.put(o,e.items),e),d=this.featureStore.featureSpatialReference,m=!s||null==d||S(d,s.spatialReference)?s:A(s,d);if(!m)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));yield;const f=this.featureAdapter;let p=await this._searchFeatures(X(s));yield;const x=i.spatialRel??"esriSpatialRelIntersects";if("esriSpatialRelDisjoint"===x){if(!p.length)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of p)e.add(f.getObjectId(i));let t;null!=r?t=r.items:(yield,t=await this._getAllFeatures(),yield);const s=await H(x,m,this.geometryType);yield;const a=t=>!e.has(f.getObjectId(t))||s(f.getGeometry(t)),n=yield*this._runSpatialFilter(t,a);yield;const l=new C(n,i,this);return await h(l)}if(null!=r){const i=new t;p=p.filter(t=>e(r.items,t,r.items.length,i)>=0)}if(!p.length){const e=new C([],i,this);return o&&this._cache.put(o,e.items),e}if(this._canExecuteSinglePass(m,i))return await h(new C(p,i,this));const g=await H(x,m,this.geometryType);yield;const _=yield*this._runSpatialFilter(p,e=>g(f.getGeometry(e)));return yield,await h(new C(_,i,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const r of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(r).forEach(e=>t.add(e))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeTimeQuery(e){if(0===e.items.length)return;const t=J(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=j(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter(e=>t.testFeature(e,this.featureAdapter))}}async*_executeGeometryQueryForSnapping(e){const{query:t}=e,{spatialRel:i}=t;if(!e?.items?.length||!t.geometry||!i)return;const r=await H(i,t.geometry,this.geometryType);yield;const s=this.featureAdapter,a=e=>r(s.getGeometry(e)),n=yield*this._runSpatialFilter(e.items,a);e.items=n}*_runSpatialFilter(e,t){if(!t)return e;if(null==this._frameTask)return e.filter(e=>t(e));let i=yield;const r=new Array;for(const s of e)t(s)&&r.push(s),i.madeProgress(),i.done&&(i=yield);return r}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:r}=this.timeInfo,s=r||i,a=new Map,n=this.featureAdapter.getAttribute;for(const l of e.items){const e=n(l,t),i=n(l,s),r=a.get(e);(!r||i>n(r,s))&&a.set(e,l)}e.items=Array.from(a.values())}_getCacheKey(e){const{geometry:t,spatialRel:i,returnGeometry:r,returnCentroid:s,outSR:a,resultType:n,cacheHint:l}=e;if("tile"!==n&&!l)return null;const o=r||s;return R(a)&&!S(this.spatialReference,a)&&o?JSON.stringify([t,i,a]):JSON.stringify([t,i])}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return N(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i))}async _project(e,t){if(!t||S(this.spatialReference,t))return e;const r=this.featureAdapter,s=y()?await this._getFullExtent():void 0,a=await v(e.items.map(e=>b(this.geometryType,r.getGeometry(e))),this.spatialReference,t,{areaOfInterestExtent:s});return e.items=i(a.map((t,i)=>r.cloneWithGeometry(e.items[i],I(t,this.hasZ,this.hasM),this.geometryType))),e}async _searchFeatures(e){const t=new Set;await Promise.all(e.map(e=>this.featureStore.forEachInBounds(e,e=>t.add(e))));const i=Array.from(t.values());return t.clear(),i}async*_executeQueryForStatistics(e,t){e=s(e);try{e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await M(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),yield,r}catch(i){if(i!==O)throw i;return new C([],e,this)}}get test(){}}function X(e){if(N(e)){if(_(e))return[p(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(F(e))return e.rings.map(e=>p(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1])))}return[g(x(),e)]}function Y(e,t,i,r,s){const a={xmin:e[0],ymin:e[1],xmax:e[3],ymax:e[4],spatialReference:E(r)};s&&isFinite(e[2])&&isFinite(e[5])&&(a.zmin=e[2],a.zmax=e[5],a.hasZ=!0);const n=A(a,t,i);if(n.spatialReference=E(i),n.xmax-n.xmin===0){const e=u(n.spatialReference);n.xmin-=e,n.xmax+=e}if(n.ymax-n.ymin===0){const e=u(n.spatialReference);n.ymin-=e,n.ymax+=e}if(s&&null!=n.zmin&&null!=n.zmax&&n.zmax-n.zmin===0){const e=u(n.spatialReference);n.zmin-=e,n.zmax+=e}return n}export{K as Feature,W as QueryEngine,Y as getQueryResultExtent};
|
|
2
|
+
import{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import{toConst as i}from"../../../core/compilerUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import{clone as s}from"../../../core/lang.js";import{removeMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{signalFromSignalOrOptions as l,throwIfAborted as o}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as u}from"../../../core/units.js";import{isSerializable as c}from"../../../core/support/jsonUtils.js";import{isLoaded as y}from"../../../geometry/projectionUtils.js";import{set as h,create as d,expandWithAABB as m,negativeInfinity as f}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as p,create as x}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as g}from"../../../geometry/support/boundsUtils.js";import{isExtent as _,isPolygon as F}from"../../../geometry/support/jsonTypeUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as Q}from"../../../geometry/support/normalizeUtils.js";import{equals as S,isValid as R}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as I}from"../featureConversionUtils.js";import{getWhereClause as j}from"./attributeSupport.js";import{getGeometry as E,cleanFromGeometryEngine as b}from"./geometryUtils.js";import{checkProjectionSupport as T,project as A,projectMany as v}from"./projectionSupport.js";import{QueryEngineCache as G}from"./QueryEngineCache.js";import{queryCapabilities as k}from"./QueryEngineCapabilities.js";import{QueryEngineResult as C}from"./QueryEngineResult.js";import{queryEngineEmptyResult as O,normalizeAttributeBinsQuery as P,normalizeQueryLike as q,normalizeQuery as z}from"./queryUtils.js";import{validateAttributeBinsQuery as U,validateQuery as B,validateStatisticsQuery as M}from"./queryValidationUtils.js";import{getSpatialQueryOperator as H,canQueryWithRBush as Z}from"./spatialQuerySupport.js";import{getTimeExtent as J,getTimeOperator as L}from"./timeSupport.js";import N from"../../support/FieldsIndex.js";import{ImmediateTask as V}from"../../../views/support/Scheduler.js";const D="unsupported-query";class K{constructor(e,t=null,i,r,s){this.attributes=e,this.geometry=i,this.centroid=r,this.filterFlags=s,this.groupId=-1,this.displayId=t}}class W{constructor(e){this._changeHandle=null,this.capabilities={query:k},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._cache=e.cache??new G,this.timeInfo=e.timeInfo,this.featureIdInfo=e.featureIdInfo,this._changeHandle=this.featureStore.events.on("changed",()=>this._clearCache()),this.fieldsIndex=c(e.fieldsIndex)?e.fieldsIndex:N.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map(e=>e.name)):this.availableFields=new Set(e.availableFields.map(e=>this.fieldsIndex.get(e)?.name).filter(e=>null!=e)),e.scheduler&&e.priority?this._frameTask=e.scheduler.registerTask(e.priority):this._frameTask=V}destroy(){this._changeHandle=a(this._changeHandle),this._frameTask=a(this._frameTask),this._clearCache(),n(this._cache)}get featureAdapter(){return this.featureStore.featureAdapter}async executeQuery(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryFeatureSet(e),i)}async executeQueryForCount(e={},t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForCount(e),i)}async executeQueryForExtent(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForExtent(e),i)}async executeQueryForIds(e,t){return Array.from(await this.executeQueryForIdSet(e,t))}async executeQueryForIdSet(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForIdSet(e),i)}async executeQueryForLatestObservations(e,t){const i=l(t);if(!this.timeInfo?.trackIdField)throw new r(D,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});return await this._frameTask.scheduleGenerator(()=>this._executeQueryForLatestObservations(e),i)}async executeQueryForOpaqueFeatures(e,t){const i=l(t);return(await this._frameTask.scheduleGenerator(()=>this._executeQuery(e,{}),i)).items}async executeAttributeBinsQuery(e,t){const i=l(t);return e=s(e),await this._frameTask.scheduleGenerator(()=>this._executeAttributeBinsQuery(e),i)}async executeQueryForSummaryStatistics(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSummaryStatistics(e,t),r)}async executeQueryForUniqueValues(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForUniqueValues(e,t),r)}async executeQueryForClassBreaks(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForClassBreaks(e,t),r)}async executeQueryForHistogram(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForHistogram(e,t),r)}async executeQueryForSnapping(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSnapping(e,i),i)}async fetchRecomputedExtents(e){const t=l(e);this._timeExtentPromise||=J(this.timeInfo,this.featureStore);const[i,r]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return o(t),{fullExtent:i,timeExtent:r}}_clearCache(){this._cache.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async*_executeQueryFeatureSet(e){try{const t=yield*this._executeQuery(e,{});return yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeQueryForCount(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null});return yield,t.createQueryResponseForCount()}catch(t){if(t!==O)throw t;return 0}}async*_executeQueryForExtent(e){const t=e.outSR;try{const i=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const r=i.size;if(!r)return{count:0,extent:null};const s=await this._getBounds(i.items,i.spatialReference,t??this.spatialReference);return yield,{count:r,extent:s}}catch(i){if(i===O)return{count:0,extent:null};throw i}}async*_executeQueryForIdSet(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const i=t.items,r=new Set;for(const e of i)r.add(t.featureAdapter.getObjectId(e));return r}catch(t){if(t===O)return new Set;throw t}}async*_executeQueryForLatestObservations(e){try{const t=yield*this._executeQuery(e,{});return yield,this._filterLatest(t),yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeAttributeBinsQuery(e){let t;try{e=await P(e,this.definitionExpression,this.spatialReference),yield,e=await U(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield,t=yield*this._executeGeometryQuery(e,i),yield,this._executeAggregateIdsQuery(t),yield,this._executeObjectIdsQuery(t),yield,this._executeTimeQuery(t),yield,this._executeAttributesQuery(t),yield}catch(i){if(i!==O)throw i;t=new C([],e,this)}return await t.createQueryBinsResponse(e)}async*_executeQueryForSummaryStatistics(e={},t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createSummaryStatisticsResponse(t)}async*_executeQueryForUniqueValues(e={},t){const{field:i,field2:r,field3:s,valueExpression:a}=t,n=yield*this._executeQueryForStatistics(e,{field:i,field2:r,field3:s,valueExpression:a});return yield,await n.createUniqueValuesResponse(t)}async*_executeQueryForClassBreaks(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createClassBreaksResponse(t)}async*_executeQueryForHistogram(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createHistogramResponse(t)}async*_executeQueryForSnapping(e,t){const{point:i,distance:r,returnEdge:a,vertexMode:n}=e;if(!a&&"none"===n)return{candidates:[]};let l=s(e.query);l=await q(l,this.definitionExpression,this.spatialReference),yield,l=await B(l,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const o=!S(i.spatialReference,this.spatialReference);o&&(await T(i.spatialReference,this.spatialReference),yield);const u="number"==typeof r?r:r.x,c="number"==typeof r?r:r.y,y={xmin:i.x-u,xmax:i.x+u,ymin:i.y-c,ymax:i.y+c,spatialReference:i.spatialReference},h=o?A(y,this.spatialReference):y;if(!h)return{candidates:[]};const d=(await Q(w(i),null,{signal:t}))[0];yield;const m=(await Q(w(h),null,{signal:t}))[0];if(yield,null==d||null==m)return{candidates:[]};const f=await this._searchFeatures(X(m.toJSON()));yield;const p=new C(f,l,this);this._executeObjectIdsQuery(p),yield,this._executeTimeQuery(p),yield,this._executeAttributesQuery(p),yield,yield*this._executeGeometryQueryForSnapping(p),yield;const x=d.toJSON(),g=o?A(x,this.spatialReference):x,_=o?Math.max(h.xmax-h.xmin,h.ymax-h.ymin)/2:r;return p.createSnappingResponse({...e,point:g,distance:_},l.returnZ,i.spatialReference)}async _getBounds(e,t,i){const r=h(d(),f);return await this.featureStore.forEachBounds(e,e=>m(r,e)),Y(r,t,i,this.spatialReference,this.hasZ)}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then(e=>this._getBounds(e,this.spatialReference,this.spatialReference)),this._fullExtentPromise}async _getAllFeaturesQueryEngineResult(e){return new C(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>await this.featureStore.forEach(t=>e.push(t)))().then(()=>i(e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async*_executeQuery(e,t){e=s(e),e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await B(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield,e={...e,...t};const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),r}async*_executeSceneFilterQuery(e){if(null==e.sceneFilter)return null;const{outSR:t,returnGeometry:i,returnCentroid:r}=e,s=this.featureStore.featureSpatialReference,a=e.sceneFilter.geometry,n=null==s||S(s,a.spatialReference)?a:A(a,s);if(!n)return null;const l=i||r,o=R(t)&&!S(this.spatialReference,t)&&l?async e=>this._project(e,t):e=>e;yield;const u=this.featureAdapter,c=await this._searchFeatures(X(n));yield;if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const t=new Set;for(const e of c)t.add(u.getObjectId(e));const i=await this._getAllFeatures();yield;const r=await H("esriSpatialRelDisjoint",n,this.geometryType);yield;const s=e=>!t.has(u.getObjectId(e))||r(u.getGeometry(e)),a=yield*this._runSpatialFilter(i,s);yield;const l=new C(a,e,this);return await o(l)}if(!c.length)return new C([],e,this);if(this._canExecuteSinglePass(n,e))return await o(new C(c,e,this));const y=await H("esriSpatialRelContains",n,this.geometryType);yield;const h=yield*this._runSpatialFilter(c,e=>y(u.getGeometry(e)));return yield,await o(new C(h,e,this))}async*_executeGeometryQuery(i,r){if(null!=r&&0===r.items.length)return r;const{geometry:s,outSR:a,returnGeometry:n,returnCentroid:l}=i,o=r?null:this._getCacheKey(i),u=o?this._cache.get(o):null;if(u)return new C(u,i,this);const c=R(a)&&!S(this.spatialReference,a),y=n||l,h=async e=>(c&&y&&await this._project(e,a),o&&this._cache.put(o,e.items),e),d=this.featureStore.featureSpatialReference,m=!s||null==d||S(d,s.spatialReference)?s:A(s,d);if(!m)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));yield;const f=this.featureAdapter;let p=await this._searchFeatures(X(s));yield;const x=i.spatialRel??"esriSpatialRelIntersects";if("esriSpatialRelDisjoint"===x){if(!p.length)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of p)e.add(f.getObjectId(i));let t;null!=r?t=r.items:(yield,t=await this._getAllFeatures(),yield);const s=await H(x,m,this.geometryType);yield;const a=t=>!e.has(f.getObjectId(t))||s(f.getGeometry(t)),n=yield*this._runSpatialFilter(t,a);yield;const l=new C(n,i,this);return await h(l)}if(null!=r){const i=new t;p=p.filter(t=>e(r.items,t,r.items.length,i)>=0)}if(!p.length){const e=new C([],i,this);return o&&this._cache.put(o,e.items),e}if(this._canExecuteSinglePass(m,i))return await h(new C(p,i,this));const g=await H(x,m,this.geometryType);yield;const _=yield*this._runSpatialFilter(p,e=>g(f.getGeometry(e)));return yield,await h(new C(_,i,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const r of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(r).forEach(e=>t.add(e))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeTimeQuery(e){if(0===e.items.length)return;const t=L(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=j(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter(e=>t.testFeature(e,this.featureAdapter))}}async*_executeGeometryQueryForSnapping(e){const{query:t}=e,{spatialRel:i}=t;if(!e?.items?.length||!t.geometry||!i)return;const r=await H(i,t.geometry,this.geometryType);yield;const s=this.featureAdapter,a=e=>r(s.getGeometry(e)),n=yield*this._runSpatialFilter(e.items,a);e.items=n}*_runSpatialFilter(e,t){if(!t)return e;if(null==this._frameTask)return e.filter(e=>t(e));let i=yield;const r=new Array;for(const s of e)t(s)&&r.push(s),i.madeProgress(),i.done&&(i=yield);return r}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:r}=this.timeInfo,s=r||i,a=new Map,n=this.featureAdapter.getAttribute;for(const l of e.items){const e=n(l,t),i=n(l,s),r=a.get(e);(!r||i>n(r,s))&&a.set(e,l)}e.items=Array.from(a.values())}_getCacheKey(e){const{geometry:t,spatialRel:i,returnGeometry:r,returnCentroid:s,outSR:a,resultType:n,cacheHint:l}=e;if("tile"!==n&&!l)return null;const o=r||s;return R(a)&&!S(this.spatialReference,a)&&o?JSON.stringify([t,i,a]):JSON.stringify([t,i])}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return Z(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i))}async _project(e,t){if(!t||S(this.spatialReference,t))return e;const r=this.featureAdapter,s=y()?await this._getFullExtent():void 0,a=await v(e.items.map(e=>E(this.geometryType,r.getGeometry(e))),this.spatialReference,t,{areaOfInterestExtent:s});return e.items=i(a.map((t,i)=>r.cloneWithGeometry(e.items[i],I(t,this.hasZ,this.hasM),this.geometryType))),e}async _searchFeatures(e){const t=new Set;await Promise.all(e.map(e=>this.featureStore.forEachInBounds(e,e=>t.add(e))));const i=Array.from(t.values());return t.clear(),i}async*_executeQueryForStatistics(e,t){e=s(e);try{e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await M(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),yield,r}catch(i){if(i!==O)throw i;return new C([],e,this)}}get test(){}}function X(e){if(Z(e)){if(_(e))return[p(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(F(e))return e.rings.map(e=>p(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1])))}return[g(x(),e)]}function Y(e,t,i,r,s){const a={xmin:e[0],ymin:e[1],xmax:e[3],ymax:e[4],spatialReference:b(r)};s&&isFinite(e[2])&&isFinite(e[5])&&(a.zmin=e[2],a.zmax=e[5],a.hasZ=!0);const n=A(a,t,i);if(n.spatialReference=b(i),n.xmax-n.xmin===0){const e=u(n.spatialReference);n.xmin-=e,n.xmax+=e}if(n.ymax-n.ymin===0){const e=u(n.spatialReference);n.ymin-=e,n.ymax+=e}if(s&&null!=n.zmin&&null!=n.zmax&&n.zmax-n.zmin===0){const e=u(n.spatialReference);n.zmin-=e,n.zmax+=e}return n}export{K as Feature,W as QueryEngine,Y as getQueryResultExtent};
|