@arcgis/core 4.33.0-next.20250514 → 4.33.0-next.20250515
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/Graphic.js +1 -1
- package/Map.js +1 -1
- package/WebScene.js +1 -1
- package/applications/Components/SelectionOperation.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/009730713ed9bc7c7388.js +1 -0
- package/assets/esri/core/workers/chunks/02853ab923245459b32e.js +1 -0
- package/assets/esri/core/workers/chunks/0624ae07d3af8d5f1ac8.js +1 -0
- package/assets/esri/core/workers/chunks/{6e8c6c9112ecb867b7be.js → 0817ddd885ce8b2459cb.js} +1 -1
- package/assets/esri/core/workers/chunks/{69e8aabe5a1eb2d1e414.js → 0832bd5195b5791dd803.js} +1 -1
- package/assets/esri/core/workers/chunks/0d23610475c85385fbff.js +1 -0
- package/assets/esri/core/workers/chunks/{b4f38fe9cc948a39ad87.js → 0fd6d80393722132e044.js} +2 -2
- package/assets/esri/core/workers/chunks/{b4f38fe9cc948a39ad87.js.LICENSE.txt → 0fd6d80393722132e044.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/1051a5a57b2fb843a555.js +1 -0
- package/assets/esri/core/workers/chunks/133e4bde346828d4510b.js +1 -0
- package/assets/esri/core/workers/chunks/19a58adc75a34f84b0ef.js +1 -0
- package/assets/esri/core/workers/chunks/1d7f2abfccc54659d6f2.js +1 -0
- package/assets/esri/core/workers/chunks/{339e7a900e2bba9d3647.js → 1f19bd3ef795c6765384.js} +1 -1
- package/assets/esri/core/workers/chunks/{837f886f759fc6f0489d.js → 1f4fd9e3849f4e593375.js} +1 -1
- package/assets/esri/core/workers/chunks/1f9c6fbcd4d0eae1e574.js +1 -0
- package/assets/esri/core/workers/chunks/234117cc5cb7c6863313.js +1 -0
- package/assets/esri/core/workers/chunks/{1c025beaaac5ec7c04fb.js → 2adf558cd8d8155d07d7.js} +1 -1
- package/assets/esri/core/workers/chunks/{47f64a340b5d56bf9e59.js → 2cf82d3645c75d311e99.js} +1 -1
- package/assets/esri/core/workers/chunks/{f7ab3511f6627f467796.js → 377a7f0f7d304ff9fe5b.js} +1 -1
- package/assets/esri/core/workers/chunks/3b4b4f84d594db8945f9.js +1 -0
- package/assets/esri/core/workers/chunks/3bf1cf6c3cba172e2f6d.js +1 -0
- package/assets/esri/core/workers/chunks/{b3ca65d6112079fb1d00.js → 3ce5d7ad16e41eea05be.js} +1 -1
- package/assets/esri/core/workers/chunks/465f2db4ab8aa9c9f907.js +1 -0
- package/assets/esri/core/workers/chunks/{1e13e03aad422f9e871e.js → 47fe2379f2214bf50036.js} +1 -1
- package/assets/esri/core/workers/chunks/{b8b5dfd2d73a8410fba2.js → 4954e0cf4a40e45d237f.js} +1 -1
- package/assets/esri/core/workers/chunks/4a362a35bcdb8405a53a.js +1 -0
- package/assets/esri/core/workers/chunks/4f8ebd9f0758b801835c.js +1 -0
- package/assets/esri/core/workers/chunks/5228d39c05d660a135b6.js +1 -0
- package/assets/esri/core/workers/chunks/{736cb9f74bf050b70f4c.js → 52a3d0e041717da7697e.js} +1 -1
- package/assets/esri/core/workers/chunks/54ea93f416ab52b413c1.js +1 -0
- package/assets/esri/core/workers/chunks/554a8bf4626336e68798.js +1 -0
- package/assets/esri/core/workers/chunks/55f087bca75c3f2a4515.js +1 -0
- package/assets/esri/core/workers/chunks/{bbaadce582df7e20397b.js → 56d2a20c1b143697aa19.js} +1 -1
- package/assets/esri/core/workers/chunks/57211c35a9646f088d86.js +1 -0
- package/assets/esri/core/workers/chunks/58526def64536b6581ab.js +1 -0
- package/assets/esri/core/workers/chunks/5890740d5a761b038560.js +1 -0
- package/assets/esri/core/workers/chunks/{9a641fb94819574e48f6.js → 5a73d8b7b01758ed4fdd.js} +1 -1
- package/assets/esri/core/workers/chunks/5dbd8d81d94cfda5bb32.js +1 -0
- package/assets/esri/core/workers/chunks/5e52c1c076a1502f9fe4.js +1 -0
- package/assets/esri/core/workers/chunks/609c7c9b7046b3a7acde.js +1 -0
- package/assets/esri/core/workers/chunks/{30f3014c0ac6e2bc14bf.js → 622c0552ca3cd674d46c.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e64ce0958c3432004b6.js → 62798f66872dc32e77d6.js} +1 -1
- package/assets/esri/core/workers/chunks/6409160d226a0bea5ac6.js +1 -0
- package/assets/esri/core/workers/chunks/65fd971d0574d69cbc26.js +1 -0
- package/assets/esri/core/workers/chunks/6993a59cbb78bc26f029.js +1 -0
- package/assets/esri/core/workers/chunks/6b23ca6570357f9fb724.js +1 -0
- package/assets/esri/core/workers/chunks/6c37a5bd00d255d1337a.js +1 -0
- package/assets/esri/core/workers/chunks/6ce4327f63e6eb92bba8.js +1 -0
- package/assets/esri/core/workers/chunks/6f9b8df290b0ce09beae.js +1 -0
- package/assets/esri/core/workers/chunks/{e0247252c6a0f3340e33.js → 6fa1a5b7276a037dbd6a.js} +84 -106
- package/assets/esri/core/workers/chunks/7c819b3e6d69c526f4b2.js +1 -0
- package/assets/esri/core/workers/chunks/7df147da40474b028705.js +1 -0
- package/assets/esri/core/workers/chunks/{0766ecb677d667e5fb83.js → 7e1dc8e5e18f18dd21e2.js} +2 -2
- package/assets/esri/core/workers/chunks/{0766ecb677d667e5fb83.js.LICENSE.txt → 7e1dc8e5e18f18dd21e2.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{e662c86b8bafc5512d3d.js → 847e88e1d6da1e74cdc8.js} +1 -1
- package/assets/esri/core/workers/chunks/{6f5ec9bf7cf8a36d8e8b.js → 87eca6de502d18d8b7eb.js} +1 -1
- package/assets/esri/core/workers/chunks/{10e6dffa57aa1a626708.js → 8a6aac37b3133de74cce.js} +1 -1
- package/assets/esri/core/workers/chunks/8a87c181b85d0b86b9bb.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/8f1fbfdac04e694f621d.js +1 -0
- package/assets/esri/core/workers/chunks/91cd29f53f07bc38fe75.js +1 -0
- package/assets/esri/core/workers/chunks/{5583d18032ed8bc17c74.js → 938f1eebc48871be64e9.js} +1 -1
- package/assets/esri/core/workers/chunks/97c148adf0347c69a79c.js +1 -0
- package/assets/esri/core/workers/chunks/{029a118e6dfb3f544a5c.js → 98ef17d15517368d2383.js} +1 -1
- package/assets/esri/core/workers/chunks/9c8224ca29475556e5ea.js +1 -0
- package/assets/esri/core/workers/chunks/{fd24dd602a3fed88d90e.js → 9d5eac3bd1526e2b33e3.js} +1 -1
- package/assets/esri/core/workers/chunks/{38f5e6a202ce292edd9f.js → 9eb9c8db2510154c09cc.js} +1 -1
- package/assets/esri/core/workers/chunks/a036503087baa1f9fd00.js +1 -0
- package/assets/esri/core/workers/chunks/a673128da9e6656ead2e.js +1 -0
- package/assets/esri/core/workers/chunks/{90ae15ce22a49bd84876.js → ab9614555a15f04396f6.js} +2 -2
- package/assets/esri/core/workers/chunks/{90ae15ce22a49bd84876.js.LICENSE.txt → ab9614555a15f04396f6.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/ae733c963d61065faa54.js +1 -0
- package/assets/esri/core/workers/chunks/b0522dffa5600345c07e.js +1 -0
- package/assets/esri/core/workers/chunks/{d1f7bfb8daf11ecada9f.js → b4273381dc069f4e1fa2.js} +1 -1
- package/assets/esri/core/workers/chunks/{fb2e28e6a87956267d1c.js → b92a34f88569c481ed10.js} +1 -1
- package/assets/esri/core/workers/chunks/{352b7dcd1633e0c98194.js → ba940ebdae84b174a7be.js} +1 -1
- package/assets/esri/core/workers/chunks/bf9b6b74654d303a6dae.js +1 -0
- package/assets/esri/core/workers/chunks/c07c1bb7ae09136dc1f6.js +1 -0
- package/assets/esri/core/workers/chunks/c938f5d269ba202d10ef.js +1 -0
- package/assets/esri/core/workers/chunks/cbbca011f8b176d4b5db.js +1 -0
- package/assets/esri/core/workers/chunks/{c604fefedccfd4db9953.js → ce321fd8fc5551e190ec.js} +1 -1
- package/assets/esri/core/workers/chunks/ce53ddda04e09ba2f860.js +1 -0
- package/assets/esri/core/workers/chunks/d166f805990353578494.js +1 -0
- package/assets/esri/core/workers/chunks/d9a23fb0c6c936d5e8ec.js +1 -0
- package/assets/esri/core/workers/chunks/db3f710d770adf631b28.js +2 -0
- package/assets/esri/core/workers/chunks/{6394ab6f629aa90292e6.js.LICENSE.txt → db3f710d770adf631b28.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{6805e7b43d6ecf3ea93c.js → dcf5719f38ad40b92941.js} +1 -1
- package/assets/esri/core/workers/chunks/e2cada6644c49b1b6e79.js +1 -0
- package/assets/esri/core/workers/chunks/e2fb4bebce3aee406efa.js +1 -0
- package/assets/esri/core/workers/chunks/e3638f9d4c0fda238f4b.js +1 -0
- package/assets/esri/core/workers/chunks/e85f892ea44d67d53ff0.js +2 -0
- package/assets/esri/core/workers/chunks/{3596540ef49e5330ceb2.js.LICENSE.txt → e85f892ea44d67d53ff0.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/e89345c7af9d3d4d8452.js +1 -0
- package/assets/esri/core/workers/chunks/{a31658f544ac6e1801d6.js → ead5d4e271effc04def3.js} +1 -1
- package/assets/esri/core/workers/chunks/ece68a25651ef03fc95d.js +1 -0
- package/assets/esri/core/workers/chunks/f218a190015de1444018.js +1 -0
- package/assets/esri/core/workers/chunks/f229044615af3142bcb0.js +1 -0
- package/assets/esri/core/workers/chunks/f2692f25ef693cf12ce0.js +1 -0
- package/assets/esri/core/workers/chunks/f4c6ea630cecf0f260d7.js +2 -0
- package/assets/esri/core/workers/chunks/{e0dc8794343c2a949ffb.js.LICENSE.txt → f4c6ea630cecf0f260d7.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/f718cb847c4eb1e43ad9.js +1 -0
- package/assets/esri/core/workers/chunks/faa40ef04604c7cce706.js +1 -0
- package/assets/esri/core/workers/chunks/{218a66d53f7cf4f285aa.js → fbd2f45d5adce4ca323f.js} +2 -2
- package/assets/esri/core/workers/chunks/{218a66d53f7cf4f285aa.js.LICENSE.txt → fbd2f45d5adce4ca323f.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{498886c321a2501658bc.js → ffaa977cd97a2b7190c5.js} +1 -1
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +5 -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/chunks/Envelope.js +1 -1
- package/chunks/Jpg.js +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/ShadowCastAccumulate.glsl.js +7 -5
- package/chunks/ShadowCastVisualize.glsl.js +1 -1
- package/chunks/ShadowHighlight.glsl.js +8 -7
- package/chunks/Transformation2D.js +1 -1
- package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
- package/chunks/arcgis-knowledge-client-core.js +1 -1
- package/chunks/basis_encoder.js +1 -1
- package/chunks/basis_transcoder.js +1 -1
- package/chunks/bundle.js +1 -1
- package/chunks/chartUtilsAm5.js +1 -1
- package/chunks/dxt_encoder.js +1 -1
- package/chunks/geometryEngineBase.js +1 -1
- package/chunks/i3s.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/chunks/libtess-asm.js +1 -1
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/chunks/vec4.js +1 -1
- package/chunks/vxlLayer.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/core/image/apng.js +1 -1
- package/core/image/gif.js +1 -1
- package/core/mathUtils.js +1 -1
- package/core/workers/Connection.js +1 -1
- package/geometry/operators/densifyOperator.d.ts +0 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/support/meshProperties.js +1 -1
- package/geometry/support/normalizeUtilsSync.js +1 -1
- package/interfaces.d.ts +200 -147
- package/intl/date.js +1 -1
- package/intl/number.js +1 -1
- package/layers/BingMapsLayer.js +1 -1
- package/layers/graphics/OptimizedFeatureSet.js +1 -1
- package/layers/graphics/controllers/StreamController.js +1 -1
- package/layers/graphics/data/FeatureIdInfo.js +5 -0
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/StreamFeatureManager.js +1 -1
- package/layers/graphics/data/createFeatureId.js +5 -0
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/layers/graphics/sources/WFSSourceWorker.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/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/ogc/ogcFeatureUtils.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/core/utils.js +1 -1
- package/layers/orientedImagery/queries.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/support/LercWorker.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterFunctions/rasterProjectionHelper.js +1 -1
- package/layers/support/rasterFunctions/stretchUtils.js +1 -1
- package/layers/support/wmsUtils.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/package.json +1 -1
- package/rest/networks/support/Association.js +1 -1
- package/rest/networks/support/NetworkElement.js +1 -1
- package/rest/networks/support/QueryAssociationsParameters.js +1 -1
- package/rest/networks/support/TelecomNetworkElement.js +1 -1
- package/rest/networks/support/TraceResult.js +1 -1
- package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
- package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
- package/rest/query/operations/queryRelatedRecords.js +1 -1
- package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/effects/EffectControlMeasureLine.js +1 -1
- package/views/2d/engine/ManagedCanvas.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
- package/views/2d/engine/webgl/TileContainer.js +1 -1
- package/views/2d/engine/webgl/grouping.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/featureServiceUtils.js +1 -1
- package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/analysis/AnalysisViewManager3D.js +1 -1
- package/views/3d/analysis/DimensionAnalysisView3D.d.ts +4 -0
- package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
- package/views/3d/camera/constraintUtils/common.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/layers/DimensionLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/ViewshedLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/QueryEngine.js +1 -1
- package/views/3d/layers/graphics/focusAreaStyle.js +5 -0
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/i3s/I3SBinaryReader.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
- package/views/3d/layers/i3s/PagedNodeIndex.js +1 -1
- package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/LayerViewAnalysisViewManager.js +5 -0
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileAgent.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRange.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ShadowmapFiltering.glsl.js +3 -25
- package/views/3d/webgl-engine/core/shaderLibrary/shading/calculateUVZShadow.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Texture2DShadowBindUniform.js +5 -0
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +3 -3
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
- package/views/3d/webgl-engine/lib/DepthRange.js +1 -1
- package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/Material.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/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/verticalOffsetUtils.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
- package/views/3d/webgl.js +1 -1
- package/views/FocusArea.js +1 -1
- package/views/FocusAreas.js +1 -1
- package/views/GroundView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/support/LayerViewManager.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/TextureDescriptor.js +1 -1
- package/views/webgl/textureUtils.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
- package/widgets/ElevationProfile/support/profileUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/LayerList/LayerListItem.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUI.js +1 -1
- package/widgets/OrientedImageryViewer/components/NavigationUIPanoramicViewModel.js +5 -0
- package/widgets/OrientedImageryViewer/components/NavigationUIViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/imageNavigationUtils.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +5 -0
- package/widgets/OrientedImageryViewer/navigation/NavigationManagerPanoramic.js +5 -0
- package/widgets/OrientedImageryViewer/navigation/errors.js +5 -0
- package/widgets/OrientedImageryViewer/navigation/queries.js +5 -0
- package/widgets/OrientedImageryViewer/navigation/utils.js +5 -0
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/Selector2D/SelectionOperation.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/FeatureUtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/utils/createAssociation.js +1 -1
- package/assets/esri/core/workers/chunks/0516bd18334d3af6c555.js +0 -1
- package/assets/esri/core/workers/chunks/0d8a635c1f9aeaf7564c.js +0 -1
- package/assets/esri/core/workers/chunks/191a45a594ecaf7f1abb.js +0 -1
- package/assets/esri/core/workers/chunks/1abd026ed12c863e1d94.js +0 -1
- package/assets/esri/core/workers/chunks/1c6542315390037053a6.js +0 -1
- package/assets/esri/core/workers/chunks/201db423e3c6f947b77c.js +0 -1
- package/assets/esri/core/workers/chunks/23de8aeed5b82c682cbe.js +0 -1
- package/assets/esri/core/workers/chunks/2e0af748eba93f3ea6cb.js +0 -1
- package/assets/esri/core/workers/chunks/3596540ef49e5330ceb2.js +0 -2
- package/assets/esri/core/workers/chunks/3604a77c93cf2927787b.js +0 -1
- package/assets/esri/core/workers/chunks/391b1c3e736a62befbaf.js +0 -1
- package/assets/esri/core/workers/chunks/40e556a0645af8658658.js +0 -1
- package/assets/esri/core/workers/chunks/4402336db7210cd583e0.js +0 -1
- package/assets/esri/core/workers/chunks/4899cdc8bb5085c356f9.js +0 -1
- package/assets/esri/core/workers/chunks/4bd5cbf6e0be2fc7e84d.js +0 -1
- package/assets/esri/core/workers/chunks/4c8052e81916579841f4.js +0 -1
- package/assets/esri/core/workers/chunks/4c9aa1dafdc0d9537231.js +0 -1
- package/assets/esri/core/workers/chunks/4feb774f123da26e9f2a.js +0 -1
- package/assets/esri/core/workers/chunks/51b5dfc7085272d26b89.js +0 -1
- package/assets/esri/core/workers/chunks/566c2ce50af225e556ac.js +0 -1
- package/assets/esri/core/workers/chunks/5ddf463c85c33428e807.js +0 -1
- package/assets/esri/core/workers/chunks/61032b5050464cb48056.js +0 -1
- package/assets/esri/core/workers/chunks/6394ab6f629aa90292e6.js +0 -2
- package/assets/esri/core/workers/chunks/63dade3e1cc7f5b76846.js +0 -1
- package/assets/esri/core/workers/chunks/64af433e88d4dd21a2ff.js +0 -1
- package/assets/esri/core/workers/chunks/6e12900a9f4c3c9941ec.js +0 -1
- package/assets/esri/core/workers/chunks/6e5d8a6b29c06a27998c.js +0 -1
- package/assets/esri/core/workers/chunks/6f506303017903b9a06f.js +0 -1
- package/assets/esri/core/workers/chunks/71e46e866c23372b0b58.js +0 -1
- package/assets/esri/core/workers/chunks/75fa861b5757551f8fdc.js +0 -1
- package/assets/esri/core/workers/chunks/7c49a8877bd744daa3d5.js +0 -1
- package/assets/esri/core/workers/chunks/7ea5bbb52e84be9a608e.js +0 -1
- package/assets/esri/core/workers/chunks/82c395d8649096609a8a.js +0 -1
- package/assets/esri/core/workers/chunks/86138c297095af1ac604.js +0 -1
- package/assets/esri/core/workers/chunks/8c21cc9af4ce9652cc5c.js +0 -1
- package/assets/esri/core/workers/chunks/8e6301006abdf47cc88d.js +0 -1
- package/assets/esri/core/workers/chunks/90f93091fe088875f80f.js +0 -1
- package/assets/esri/core/workers/chunks/91a02ee91f61cf841111.js +0 -1
- package/assets/esri/core/workers/chunks/9baeb3b5733acdda4e7c.js +0 -1
- package/assets/esri/core/workers/chunks/a1d697e2be1e892a666a.js +0 -1
- package/assets/esri/core/workers/chunks/a1f27c4f4b5ef3e359f7.js +0 -1
- package/assets/esri/core/workers/chunks/a348ff2dd936c6bf9399.js +0 -1
- package/assets/esri/core/workers/chunks/b64f708f821dd2bb51cd.js +0 -1
- package/assets/esri/core/workers/chunks/bf453744067267e84d1b.js +0 -1
- package/assets/esri/core/workers/chunks/c1175477dfcdee90a453.js +0 -1
- package/assets/esri/core/workers/chunks/c4e2b75b9135920babc3.js +0 -1
- package/assets/esri/core/workers/chunks/cb80b7ddc9acf625d754.js +0 -1
- package/assets/esri/core/workers/chunks/d22f91bc16a7641bcbef.js +0 -1
- package/assets/esri/core/workers/chunks/d52cf7b795ee52034f9e.js +0 -1
- package/assets/esri/core/workers/chunks/d971571a957de70d5a8d.js +0 -1
- package/assets/esri/core/workers/chunks/d9d9d4f99140e579eabb.js +0 -1
- package/assets/esri/core/workers/chunks/dc3a6beb3028009b3c23.js +0 -1
- package/assets/esri/core/workers/chunks/e0dc8794343c2a949ffb.js +0 -2
- package/assets/esri/core/workers/chunks/e483d2f169e51a361742.js +0 -1
- package/assets/esri/core/workers/chunks/e5608e5232e983531f72.js +0 -1
- package/assets/esri/core/workers/chunks/e613df03ceb39e29befa.js +0 -1
- package/assets/esri/core/workers/chunks/e697dd4508f02dcfe329.js +0 -1
- package/assets/esri/core/workers/chunks/eabfab23246d4a052ea3.js +0 -1
- package/assets/esri/core/workers/chunks/ec8e8048b3df2c92008d.js +0 -1
- package/assets/esri/core/workers/chunks/ed6d0fea159dea638c2f.js +0 -1
- package/assets/esri/core/workers/chunks/f5fcba6ca6f43bf1d65d.js +0 -1
- package/assets/esri/core/workers/chunks/f92d76b694ff0cdb212c.js +0 -1
- package/chunks/NetworkElement.js +0 -5
- package/views/FocusAreasUtils.js +0 -5
- package/views/analysis/DimensionAnalysisView.d.ts +0 -4
- package/views/analysis/DimensionAnalysisView.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as o,ZEROS as
|
|
5
|
+
import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{fromValues as o,ZEROS as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{freeze as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasCalloutSupport as c,textSymbolLayerSupportsVerticalOffset as m}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as f}from"./ElevationAligners.js";import{SymbolUpdateType as h,needsElevationUpdates2D as u}from"./elevationAlignmentUtils.js";import{ElevationContext as p}from"./ElevationContext.js";import{focusAreaHUDColor as d}from"./focusAreaStyle.js";import{Graphics3DObject3DGraphicLayer as g}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as y}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as v}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as x}from"./graphicUtils.js";import{LabelPlacement as b,LabelParameters as O}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as w,verticalPlacementFromAlignment as P,textRenderAlignmentFromHorizontalPlacement as j,horizontalPlacementToAnchorX as E,anchorFromPlacements as _,namedAnchorToHUDMaterialAnchorPos as S}from"./placementUtils.js";import{placePointOnGeometry as L,updateStageObjectGeometry as G,getLocalOriginForPoint as A,extendPointGraphicElevationContext as C,createStageObject as z}from"./pointUtils.js";import{getFontMetrics as U}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as F}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as D}from"../../webgl-engine/lib/TextRenderParameters.js";import R from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as T}from"../../webgl-engine/materials/HUDMaterial.js";const V=a(0,0,1);class H extends v{constructor(e,t,s,r){super(e,t,s,r),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=x(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await D.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,s=L(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const r=this.view.focusAreasView?.containsGeometry(s)??!0,o=this.symbolLayer.text;if(null==o||""===o)return null;const i=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=i&&!m(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:n}=this.symbolLayer,a=new b(i);w(n,a.screenOffset);const l=new O(a,this.symbolLayer.horizontalAlignment,P(n));return l.isFocused=r??l.isFocused,this._createAs3DShape(t,s,o,l)}updateFocus(e,t){t.forEach((t=>{const s=L(t.graphic.geometry);if(null==s)return void this.logger.warn(`unsupported geometry type for text symbol: ${t.graphic.geometry.type}`);const r=this.view.focusAreasView?.containsGeometry(s)??!0;t.layers.forEach((s=>{if(s?.graphics3DSymbolLayer===this){s.stageObject.geometries.some((e=>e.material.parameters.isFocused!==r))&&e(t)}}))}))}createLabel(e,t,s,r,o){const i=e.graphic,n=L(i.geometry);if(null==n)return this.logger.warn(`unsupported geometry type for label: ${i.geometry.type}`),null;const a=this.view.focusAreasView?.containsGeometry(n)??!0,l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(i,n,l,t,s,r,o))}setGraphicElevationContext(e,t=new p,s=0){return super.setGraphicElevationContext(e,t),t.addOffsetRenderUnits(s),t}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerElevationInfoChanged(e,t){return W(e,t,((e,t)=>{this.updateGraphicElevationContext(t,e)})),h.UPDATE}slicePlaneEnabledChanged(e,t){return W(e,t,(e=>{for(const t of e.stageObject.geometries)t.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}updateGraphicElevationContext(e,t){const{elevationContext:s,metadata:r}=t;this.setGraphicElevationContext(e,s,r?.elevationOffset??0),t.needsElevationUpdates=u(s.mode)||"absolute-height"===s.mode}updateGeometry(e,t){if(this.draped||!this._validateGeometry(t))return!1;const{elevationContext:s,stageObject:r}=e;if(s.mode!==this.getGeometryElevationMode(t))return!1;const o=L(t);if(!o)return!1;const i=G(r,this._context,o,s);if(null==i)return!1;const n=A(this._context,o);return r.geometries[0].localOrigin===n&&(e.alignedSampledElevation=i,C(e,o,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return I}_createAs3DShape(e,a,c,m,h,v=null,x=()=>m.placement.elevationOffset){const b=this.setGraphicElevationContext(e,new p,m.placement.elevationOffset),O="polyline"===e.geometry?.type,w=e.uid;let P=null,E=null;if(null==v){const e=j(m.horizontalPlacement);P=new R(c,e,this._textRenderParameters);let r=null;if(null!=this._context.sharedResources.textures){E=this._context.sharedResources.textures.fromData(P.key,(()=>P.create())),E.texture.events.on("unloaded",(()=>r=t(r)));const e=this._context.stage.renderView.textures.acquire(E.texture.id);if(null==e||s(e))return E.release(),null;r=e}}const _=!has("disable-feature:non-occluded-hud"),S=$(P,m),L={occlusionTest:!_,occludedFragmentFade:_,horizonCullingEnabled:_&&this._context.spherical,screenOffset:m.placement.screenOffset,anchorPosition:S,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:m.placement.centerOffsetUnits,depthEnabled:!1,drawAsLabel:!0,isLabel:!0,isFocused:m.isFocused};if(O&&(L.shaderPolygonOffset=1e-4),v?L.textureId=v.id:E&&(L.textureId=E.texture.id),null!=m.placement.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=m.placement.verticalOffset;L.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0}}const G=this._context.graphicsCoreOwner.view.focusAreasView?.polygons.length,A={screenOffset:L.screenOffset,anchorPosition:S,centerOffsetUnits:L.centerOffsetUnits,verticalOffset:L.verticalOffset,shaderPolygonOffset:L.shaderPolygonOffset,occlusionTest:L.occlusionTest,isFocused:m.isFocused,focusStyle:this.view.map?.focusAreas.style??"none"};if(this._context.screenSizePerspectiveEnabled){const{screenSizePerspectiveSettings:e,screenSizePerspectiveSettingsLabels:t}=this._context.sharedResources,s=U(this._textRenderParameters);L.screenSizePerspective=t.overrideFontHeight(s.maxHeight),L.screenSizePerspectiveAlignment=e,A.fontHeight=s.maxHeight}L.hasSlicePlane=this._context.slicePlaneEnabled;const D=this._context.spherical,H=h?JSON.stringify(A):"";let W=h?.get(H);if(null==W){if(!m.isFocused&&G){const e=this.view.map?.focusAreas.style;L.color=d(L.color,e),L.outlineColor=d(L.outlineColor,e)}W=new T(L,D),h?.set(H,W)}const I=m.placement.translation,M=P?o(P.displayWidth,P.displayHeight):i,k=m.placement.centerOffset,N=V,q=v?l(0,0,0,0):null,B=F(W,{normal:N,position:I,size:M,centerOffsetAndDistance:k,uvi:q}),J=z(this._context,a,B,b,w);if(null==J)return null;const Y=(t,s,r,o,i,n)=>{const a=x()||m.placement.elevationOffset,l=this.setGraphicElevationContext(e,s,a);return f(t,l,r,o,i,n)},Z=new g(this,J.object,E,Y,b);Z.alignedSampledElevation=J.sampledElevation,Z.needsElevationUpdates=u(b.mode)||"absolute-height"===b.mode,Z.getScreenSize=(e=n())=>(e[0]=P?P.displayWidth:m.displaySize[0],e[1]=P?P.displayHeight:m.displaySize[1],e);const K=new y(m.placement.elevationOffset,c);return Z.metadata=K,C(Z,a,this._context.elevationProvider),Z}}function W(e,t,s){e?.forEach((e=>{const r=t(e);null!=r&&s(r,e.graphic)}))}function $(e,t){if("baseline"===t.verticalPlacement){const s=E[t.horizontalPlacement],r=null!=e?e.baselineAnchorY:0;return o(s,r)}const s=_(t.horizontalPlacement,t.verticalPlacement);return S[s]}const I={mode:"relative-to-ground",offset:0};export{H as Graphics3DTextSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{emptySymbolComplexity as t}from"./defaultSymbolComplexity.js";import{ApplyRendererDiffResult as r,FastUpdateStatus as s}from"./interfaces.js";import{Loadable as e}from"./Loadable.js";import{getSymbolMemorySize as i}from"./symbolMemory.js";class o extends e{constructor(t,r,s){super(r),this.symbol=t,this._convert=s,this.symbologySnappingSupported=!1,this.graphics3DSymbol=null,this.referenced=0}getSymbolLayerSize(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.getSymbolLayerSize(t):null}get symbolLayers(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.symbolLayers:[]}get extentPadding(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.extentPadding:0}async doLoad(t){const r=await this.symbol.fetchSymbol({signal:t});r.id=this.symbol.id,this.graphics3DSymbol=this._convert(r),null!=this.graphics3DSymbol&&await this.graphics3DSymbol.load()}createGraphics3DGraphic(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.createGraphics3DGraphic(t,this):null}get complexity(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.complexity:t}globalPropertyChanged(t,r){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.globalPropertyChanged(t,r)}applyRendererDiff(t,s){return null!=this.graphics3DSymbol?this.graphics3DSymbol.applyRendererDiff(t,s):r.RecreateSymbol}prepareSymbolPatch(t){null!=this.graphics3DSymbol&&this.graphics3DSymbol.prepareSymbolPatch(t)}updateGeometry(t,r){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.updateGeometry(t,r)}updateTransform(t,r,s,e){return this.graphics3DSymbol?.updateTransform(t,r,s,e)??!1}onRemoveGraphic(){}updateFocus(
|
|
5
|
+
import{emptySymbolComplexity as t}from"./defaultSymbolComplexity.js";import{ApplyRendererDiffResult as r,FastUpdateStatus as s}from"./interfaces.js";import{Loadable as e}from"./Loadable.js";import{getSymbolMemorySize as i}from"./symbolMemory.js";class o extends e{constructor(t,r,s){super(r),this.symbol=t,this._convert=s,this.symbologySnappingSupported=!1,this.graphics3DSymbol=null,this.referenced=0}getSymbolLayerSize(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.getSymbolLayerSize(t):null}get symbolLayers(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.symbolLayers:[]}get extentPadding(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.extentPadding:0}async doLoad(t){const r=await this.symbol.fetchSymbol({signal:t});r.id=this.symbol.id,this.graphics3DSymbol=this._convert(r),null!=this.graphics3DSymbol&&await this.graphics3DSymbol.load()}createGraphics3DGraphic(t){return null!=this.graphics3DSymbol?this.graphics3DSymbol.createGraphics3DGraphic(t,this):null}get complexity(){return null!=this.graphics3DSymbol?this.graphics3DSymbol.complexity:t}globalPropertyChanged(t,r){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.globalPropertyChanged(t,r)}applyRendererDiff(t,s){return null!=this.graphics3DSymbol?this.graphics3DSymbol.applyRendererDiff(t,s):r.RecreateSymbol}prepareSymbolPatch(t){null!=this.graphics3DSymbol&&this.graphics3DSymbol.prepareSymbolPatch(t)}updateGeometry(t,r){return null!=this.graphics3DSymbol&&this.graphics3DSymbol.updateGeometry(t,r)}updateTransform(t,r,s,e){return this.graphics3DSymbol?.updateTransform(t,r,s,e)??!1}onRemoveGraphic(){}updateFocus(){}getFastUpdateStatus(){return this.graphics3DSymbol?.getFastUpdateStatus()??s.Loading}destroy(){null!=this.graphics3DSymbol&&this.graphics3DSymbol.destroy(),this.graphics3DSymbol=void 0,super.destroy()}get destroyed(){return void 0===this.graphics3DSymbol}get cachedMemory(){return i(this)}}export{o as Graphics3DWebStyleSymbol};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as l}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import{watch as c}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as u}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as d}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{isGeometryFocused as g}from"../../../FocusAreasUtils.js";import{VisibilityGroup as m,VisibilityFlag as f}from"./enums.js";import{make as x}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as C,LineCalloutSymbolLayerRenderingInfo as _}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as L}from"./graphicSymbolUtils.js";import{LabelInfo as v}from"./LabelInfo.js";import{LabelParameters as G}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as D,verticalPlacementFromAnchor as w,textRenderAlignmentFromHorizontalPlacement as A}from"./placementUtils.js";import{placePointOnGeometry as I}from"./pointUtils.js";import{TextRenderer as T}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as S}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as R}from"../../webgl-engine/lib/TextTextureAtlas.js";import{VertexAttribute as P}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as j}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as E}from"../../../support/Scheduler.js";import{Yield as O}from"../../../support/Yield.js";class V{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class F{constructor(e,t,s,i,r){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=r,this.calloutSymbolLayerIndex=0}}class U{constructor(e,t,s,i,r,a,l,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=r,this.elevationInfoOverride=a,this.disablePlacement=l,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new j(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}}let z=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([c((()=>this.view.state?.camera),(()=>this.setDirty())),c((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),c((()=>this.view.focusAreas.activePolygons),(()=>this._updateFocus())),this.view.resourceController.scheduler.registerTask(E.LABELER,this)]),this._textTextureAtlas=new R({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),Z.graphic=null,Z.renderingInfo=null,Z.layer=null}_updateFocus(){this._labelingContexts.forEach((e=>{e.graphics.forEach((t=>{if(0===t.labelLayers.length)return;const s=I(t.graphic.geometry);if(null==s)return;const i=g(this.view,s);t.labelLayers.forEach((s=>{const r=s.stageObject.geometries.some((e=>e.material.parameters.isFocused!==i));r&&(this._removeGraphic(e,t),this._addGraphic(e,t),this.setDirty())}))}))}))}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const i=new V(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(m.LABEL,f.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(m.LABEL,f.USER,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,(e=>M(t.stageObject,e)))),H(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach((e=>e.remove())),e.textureAtlasHandles.length=0}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),O}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(k(t))this._dirty=!0;else if(B(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const a=e.graphics3DCore,l=a.layer,n=l.labelingInfo?.filter((e=>!!e.symbol));if(!n||0===n.length)return;let c=!1;await s(n,(async(s,l)=>{const n=s.symbol,h=L(a.getOrCreateGraphics3DSymbol(n));if(null==h)return void r.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;y(n)&&n.hasVisibleCallout()&&(b=x(n,a.symbolCreationContext),await b.load(),o(t));const p=await i(d(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===p.ok){const i=await this._createTextRenderParameters(h.symbol);o(t),e.labelClassContexts[l]=new F(s,h,b,i,p.value)}else r.getLogger(this).error(`Label expression failed to evaluate: ${p.error}`),c=!0})),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(n(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:S.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,l(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,r,a){const l=new G(s,D(s.anchor),w(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return Z.graphic=t,Z.layer=i,Z.renderingInfo=null,r.createLabel(Z,l,this._hudMaterials,this._textTextureAtlas,(()=>a.placement?.elevationOffset??null))}_createLineCalloutGraphic(e,t,s,i,r){Z.graphic=e,Z.layer=r;const a=i.screenOffset[0];return Z.renderingInfo=new _(null,t,i.translation,i.centerOffset,a,i.centerOffsetUnits,i.elevationOffset),s.createGraphics3DGraphic(Z,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(B(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let r=!1;const a=t.graphic,l=s.layer,o=W(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=i[n],p=b.graphics3DSymbol,u=N(p),d=p.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new v(t,u,b.labelClass),g=this._createTextSymbolGraphic(c,a,h,l,d,y);if(null==g)return!1;g._labelClass=b.labelClass,g._labelIndex=n,t.addLabelGraphic(g,s.stageLayer),this.deconflictor.setPriority(t,b.textRenderParameters?.definition.size??0),t.setVisibilityFlag(m.LABEL,f.USER,o),t.setVisibilityFlag(m.LABEL,f.SCALE_RANGE,!0),t.setVisibilityFlag(m.LABEL,f.DECONFLICTION,!1),r=!0;const x=b.graphics3DCalloutSymbolLayer;if(x&&h.hasLabelVerticalOffset){x.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,u,x,h,l);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return r&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(B(s))return;const i=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const l=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==l?.textRenderParameters)continue;const o=l.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?u(i,t.layer):i;n=o.evaluate(e)}catch(r){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=l.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,p=l.labelClass,d=t.disablePlacement,y=new v(h,b,p,d).placement;if(null==y)continue;const g=D(y.anchor),m=A(g);e.textRenderers[a]=new T(n,m,l.textRenderParameters,R.maxSize),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new V(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const r of i.graphics3DGraphic.labelLayers){if(null==r._labelClass)continue;if(!e.labelClassContexts[r._labelIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(r,t.graphic.geometry))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const i=new Map;t.graphics.forEach((e=>i.set(e.graphic.uid,e)));const r=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,r),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=W(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,r=s?.elevationInfoOverride||null,a=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const l=e.layer,o=new U(this.view.stage,l,e,t,i,r,a,W(l));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>W(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>k(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(k(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){}};function H(e,t){e.geometries[0].setAttributeData(P.SIZE,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],P.SIZE)}function M(e,t){e.geometries[0].setAttributeData(P.UVI,t),e.geometryVertexAttributeUpdated(e.geometries[0],P.UVI,!0)}function k(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function B(e){return!e||0===e.length}function N(e){return"label-3d"===e.symbol?.type?e.symbol:null}function W(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([h({constructOnly:!0})],z.prototype,"view",void 0),e([h({constructOnly:!0})],z.prototype,"deconflictor",void 0),e([h()],z.prototype,"_textTextureAtlas",void 0),e([h({type:Boolean,readOnly:!0})],z.prototype,"updating",null),z=e([b("esri.views.3d.layers.graphics.Labeler")],z);const Z=new C(null,null,null);export{z as Labeler,W as areLabelsVisible};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as i}from"../../../../core/asyncUtils.js";import"../../../../core/has.js";import r from"../../../../core/Logger.js";import{disposeMaybe as a,abortMaybe as l}from"../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../core/promiseUtils.js";import{watch as c}from"../../../../core/reactiveUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as b}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{hydrateGraphic as u}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as d}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as y}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as g,VisibilityFlag as m}from"./enums.js";import{make as f}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutCreationContext as x,LineCalloutSymbolLayerRenderingInfo as C}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as _}from"./graphicSymbolUtils.js";import{LabelInfo as L}from"./LabelInfo.js";import{LabelParameters as v}from"./LabelParameters.js";import{horizontalPlacementFromAnchor as G,verticalPlacementFromAnchor as w,textRenderAlignmentFromHorizontalPlacement as D}from"./placementUtils.js";import{placePointOnGeometry as A}from"./pointUtils.js";import{TextRenderer as I}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as T}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as S}from"../../webgl-engine/lib/TextTextureAtlas.js";import{VertexAttribute as R}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as P}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as j}from"../../../support/Scheduler.js";import{Yield as E}from"../../../support/Yield.js";class O{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.textureAtlasHandles=[],this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class V{constructor(e,t,s,i,r){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=i,this.labelFunction=r,this.calloutSymbolLayerIndex=0}}class F{constructor(e,t,s,i,r,a,l,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=i,this.emptySymbolLabelSupported=r,this.elevationInfoOverride=a,this.disablePlacement=l,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new P(e,{pickable:!0},s.owner.layerViewUid)}destroy(){this.stageLayer.destroy()}}let U=class extends t{constructor(e){super(e),this._hudMaterials=new Map,this._calloutMaterials=new Map,this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([c((()=>this.view.state?.camera),(()=>this.setDirty())),c((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),c((()=>this.view.focusAreasView?.polygons),(()=>this._updateFocus())),this.view.resourceController.scheduler.registerTask(j.LABELER,this)]),this._textTextureAtlas=new S({view:this.view})}dispose(){this.removeAllHandles(),this._textTextureAtlas=a(this._textTextureAtlas),this._hudMaterials.clear(),this._calloutMaterials.clear(),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),W.graphic=null,W.renderingInfo=null,W.layer=null}_updateFocus(){this._labelingContexts.forEach((e=>{e.graphics.forEach((t=>{if(0===t.labelLayers.length)return;const s=A(t.graphic.geometry);if(null==s)return;const i=this.view.focusAreasView?.containsGeometry(s)??!0;t.labelLayers.forEach((s=>{s.stageObject.geometries.some((e=>e.material.parameters.isFocused!==i))&&(this._removeGraphic(e,t),this._addGraphic(e,t),this.setDirty())}))}))}))}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i),t.setVisibilityFlag(g.LABEL,m.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(g.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),e.clearLabelGraphics(),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&(e.textureAtlasHandles.push(this._textTextureAtlas.addText(s,(e=>H(t.stageObject,e)))),z(t.stageObject,s))}}_removeLabelTextureFromAtlas(e){e.textureAtlasHandles.forEach((e=>e.remove())),e.textureAtlasHandles.length=0}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),E}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(M(t))this._dirty=!0;else if(k(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else for(const[s,i]of t.labelsToInitialize)if(this._ensureGraphics3DResources(i)&&(this._labels.set(s,i),this.deconflictor.setDirty(),e.madeProgress()),(i.visible&&i.textInitialized||!i.visible&&i.hasGraphics3DResources)&&(t.labelsToInitialize.delete(s),e.madeProgress()),e.done){this._dirty=!0;break}this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),o(t),e.scaleVisibility?.updateScaleRangeActive();const a=e.graphics3DCore,l=a.layer,n=l.labelingInfo?.filter((e=>!!e.symbol));if(!n||0===n.length)return;let c=!1;await s(n,(async(s,l)=>{const n=s.symbol,h=_(a.getOrCreateGraphics3DSymbol(n));if(null==h)return void r.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),o(t);let b=null;y(n)&&n.hasVisibleCallout()&&(b=f(n,a.symbolCreationContext),await b.load(),o(t));const p=await i(d(s,e.layer.fieldsIndex,this.view.spatialReference));if(o(t),!0===p.ok){const i=await this._createTextRenderParameters(h.symbol);o(t),e.labelClassContexts[l]=new V(s,h,b,i,p.value)}else r.getLogger(this).error(`Label expression failed to evaluate: ${p.error}`),c=!0})),o(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(n(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:T.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,l(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,i,r,a){const l=new v(s,G(s.anchor),w(s.anchor),e.text,p(e.displayWidth,e.displayHeight));return W.graphic=t,W.layer=i,W.renderingInfo=null,r.createLabel(W,l,this._hudMaterials,this._textTextureAtlas,(()=>a.placement?.elevationOffset??null))}_createLineCalloutGraphic(e,t,s,i,r){W.graphic=e,W.layer=r;const a=i.screenOffset[0];return W.renderingInfo=new C(null,t,i.translation,i.centerOffset,a,i.centerOffsetUnits,i.elevationOffset),s.createGraphics3DGraphic(W,this._calloutMaterials)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,i=s.labelClassContexts;if(k(i)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let r=!1;const a=t.graphic,l=s.layer,o=N(s.layer);for(let n=0;n<i.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=i[n],p=b.graphics3DSymbol,u=B(p),d=p.symbolLayers[0];if(!d)continue;d.setElevationInfoOverride(s.elevationInfoOverride);const y=new L(t,u,b.labelClass),f=this._createTextSymbolGraphic(c,a,h,l,d,y);if(null==f)return!1;f._labelClass=b.labelClass,f._labelIndex=n,t.addLabelGraphic(f,s.stageLayer),this.deconflictor.setPriority(t,b.textRenderParameters?.definition.size??0),t.setVisibilityFlag(g.LABEL,m.USER,o),t.setVisibilityFlag(g.LABEL,m.SCALE_RANGE,!0),t.setVisibilityFlag(g.LABEL,m.DECONFLICTION,!1),r=!0;const x=b.graphics3DCalloutSymbolLayer;if(x&&h.hasLabelVerticalOffset){x.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,u,x,h,l);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return r&&s.scaleVisibility?.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(k(s))return;const i=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const l=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==l?.textRenderParameters)continue;const o=l.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?u(i,t.layer):i;n=o.evaluate(e)}catch(r){n=null}else n=o.evaluate(i);if(null==n||""===n||/^\s+$/.test(n))continue;const c=l.graphics3DSymbol;if(!c.symbolLayers[0])continue;const h=e.graphics3DGraphic,b="label-3d"===c.symbol?.type?c.symbol:null,p=l.labelClass,d=t.disablePlacement,y=new L(h,b,p,d).placement;if(null==y)continue;const g=G(y.anchor),m=D(g);e.textRenderers[a]=new I(n,m,l.textRenderParameters,S.maxSize),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const i=new O(e,t);this._labels.set(s,i),e.labelsToInitialize.set(s,i)}this.setDirty(),this.deconflictor.setDirty()}_updateGraphicGeometry(e,t){const s=t.graphic.uid,i=this._labels.get(s);if(!i)return!0;for(const r of i.graphics3DGraphic.labelLayers){if(null==r._labelClass)continue;if(!e.labelClassContexts[r._labelIndex].graphics3DSymbol.symbolLayers[0].updateGeometry(r,t.graphic.geometry))return!1}return this.setDirty(),this.deconflictor.setDirty(),!0}_removeGraphic(e,t){const s=t.graphic.uid,i=this._labels.get(s);e.graphics.delete(s),i&&(this._destroyGraphic(i,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const i=new Map;t.graphics.forEach((e=>i.set(e.graphic.uid,e)));const r=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,i,r),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,i,t)}}}_visibilityInfoChange(e){const t=N(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const i=this._labels.get(s);i&&(this._destroyGraphic(i,s),i.visible=!1,e.labelsToInitialize.set(s,i))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const i=s?.emptySymbolLabelSupported||!1,r=s?.elevationInfoOverride||null,a=s?.disablePlacement||null;if(this._findLabelingContext(e))return;const l=e.layer,o=new F(this.view.stage,l,e,t,i,r,a,N(l));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),updateGraphicGeometry:e=>this._updateGraphicGeometry(o,e),layerLabelsEnabled:()=>N(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),remove:()=>this._removeGraphicsOwner(e),setDirty:()=>this.setDirty()}}_removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,i=this._labels.get(s);i&&i.visible!==t&&(t&&!i.textureAtlasHandles.length?(this._addLabelTextureToAtlas(i),i.textInitialized||i.labelingContext.labelsToInitialize.set(s,i)):!t&&i.textureAtlasHandles.length&&this._removeLabelTextureFromAtlas(i),i.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>M(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(M(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){}};function z(e,t){e.geometries[0].setAttributeData(R.SIZE,[t.displayWidth,t.displayHeight]),e.geometryVertexAttributeUpdated(e.geometries[0],R.SIZE)}function H(e,t){e.geometries[0].setAttributeData(R.UVI,t),e.geometryVertexAttributeUpdated(e.geometries[0],R.UVI,!0)}function M(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function k(e){return!e||0===e.length}function B(e){return"label-3d"===e.symbol?.type?e.symbol:null}function N(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([h({constructOnly:!0})],U.prototype,"view",void 0),e([h({constructOnly:!0})],U.prototype,"deconflictor",void 0),e([h()],U.prototype,"_textTextureAtlas",void 0),e([h({type:Boolean,readOnly:!0})],U.prototype,"updating",null),U=e([b("esri.views.3d.layers.graphics.Labeler")],U);const W=new x(null,null,null);export{U as Labeler,N as areLabelsVisible};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"../../../../geometry/Extent.js";import{featureGeometryTypeKebabDictionary as o}from"../../../../geometry/support/typeUtils.js";import{QueryEngine as a}from"../../../../layers/graphics/data/QueryEngine.js";import u from"../../../../layers/support/FieldsIndex.js";import i from"../../../../rest/support/FeatureSet.js";import y from"../../../../rest/support/Query.js";import{createFeatureIdInfo as c}from"../../../2d/layers/features/layerAdapters/featureServiceUtils.js";import{QueryEngineCache as l}from"./QueryEngineCache.js";const p=a;let h=class extends t{constructor(e){super(e),this._dataQueryEngineInstance=null}destroy(){this.clear()}get layer(){return this.context.layer}get spatialReference(){return this.context.spatialReference}get _queryGeometryType(){switch(this.layer.geometryType){case"multipoint":case"point":case"polygon":case"polyline":return this.layer.geometryType;case"mesh":return"polygon";default:return}}get defaultQueryJSON(){return new y({outSpatialReference:this.spatialReference}).toJSON()}clear(){return!!this._dataQueryEngineInstance&&(this._dataQueryEngineInstance.destroy(),this._dataQueryEngineInstance=null,!0)}async executeQueryForIdSet(e,t,r){return this._dataQueryEngine.executeQueryForIdSet(this._ensureQueryJSON(e,t),r)}async executeQueryForCount(e,t){return this._dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),t)}async executeQueryForExtent(e,t){const{count:r,extent:s}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),t);return{count:r,extent:n.fromJSON(s)}}async executeQueryForIds(e,t){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),t)}async executeQueryForLatestObservations(e,t){const r=await this._dataQueryEngine.executeQueryForLatestObservations(this._ensureQueryJSON(e),t),s=i.fromJSON(r);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}async executeQuery(e,t){const r=await this._dataQueryEngine.executeQuery(this._ensureQueryJSON(e),t),s=i.fromJSON(r);return s.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),s}_ensureQueryJSON(e,t){let r=this.defaultQueryJSON;if(null!=e&&("outSpatialReference"in e&&!e.outSpatialReference&&(e.outSpatialReference=this.spatialReference),r=e.toJSON(),r.cacheHint=!0),null!=t){const e=t.geometries.map((e=>e.toJSON())).reduce(((e,t)=>(e.rings=e.rings.concat(t.rings),e)));r={...r,cacheHint:!0,sceneFilter:{...t,geometry:e}}}return r}get _dataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const{priority:e,layer:t}=this,r="timeInfo"in t&&t.timeInfo?.toJSON()||null,s=c(t),n=o.toJSON(this._queryGeometryType),a=t.fieldsIndex?.toJSON()||new u([]),i=this.spatialReference.toJSON(),{hasZ:y,hasM:h,featureStore:m,scheduler:f,memoryController:d}=this.context,Q=new l(d);return this._dataQueryEngineInstance=new p({hasZ:y,hasM:h,geometryType:n,fieldsIndex:a,timeInfo:r,spatialReference:i,featureIdInfo:s,featureStore:m,scheduler:f,cache:Q,priority:e}),this._dataQueryEngineInstance}};e([r({constructOnly:!0})],h.prototype,"context",void 0),e([r({constructOnly:!0})],h.prototype,"priority",void 0),e([r()],h.prototype,"layer",null),e([r()],h.prototype,"spatialReference",null),e([r()],h.prototype,"_queryGeometryType",null),e([r()],h.prototype,"defaultQueryJSON",null),h=e([s("esri.views.3d.layers.graphics.QueryEngine")],h);export{h as QueryEngine};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
const e=.42,n=.32;function r(r,t){if(r)switch(t){case"bright":{const e=(r[0]+r[1]+r[2])/3;return[e*n+(1-n),e*n+(1-n),e*n+(1-n),r[3]*n]}case"dark":return[r[0]*e,r[1]*e,r[2]*e,r[3]*e];case void 0:case"none":return r}}export{r as focusAreaHUDColor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{b as e,c as t,_ as r}from"../../../../../chunks/tslib.es6.js";import a from"../../../../../core/Evented.js";import{throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{watch as i,initial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../../geometry/Extent.js";import{initializeProjection as d,project as m}from"../../../../../geometry/projection.js";import u from"../../../../../geometry/SpatialReference.js";import{QueryEngine as h}from"../../../../../layers/graphics/data/QueryEngine.js";import y from"../../../../../rest/support/Query.js";import{FeatureProcessingContext as p}from"./FeatureProcessingContext.js";import{PipelineCommand as f}from"./PipelineCommand.js";import{Tile3DManager as _}from"./Tile3DManager.js";import{TileLocks as C}from"./TileLocks.js";import{TiledFeatureStore as w}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as g}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as x}from"./rendering/RenderCommandContext.js";import{RenderCoordsHelper as v}from"../../../support/RenderCoordsHelper.js";let R=class extends a.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new w,this._tileLocks=new C,this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null,this._mainThreadDelegate=null,this._viewSpatialReference=null,this._renderCommandContext=null,this._context=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,layerInfo:a,layerViewInfo:n}){const s=u.fromJSON(e);this._viewSpatialReference=s;const l=u.fromJSON(t);this._fetcher=new g(this._viewSpatialReference,y.fromJSON(a.baseQuery),a.url,a.objectIdField,a.capabilities),this._queryEngine=new h({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",
|
|
5
|
+
import{b as e,c as t,_ as r}from"../../../../../chunks/tslib.es6.js";import a from"../../../../../core/Evented.js";import{throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{watch as i,initial as o}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import c from"../../../../../geometry/Extent.js";import{initializeProjection as d,project as m}from"../../../../../geometry/projection.js";import u from"../../../../../geometry/SpatialReference.js";import{QueryEngine as h}from"../../../../../layers/graphics/data/QueryEngine.js";import y from"../../../../../rest/support/Query.js";import{FeatureProcessingContext as p}from"./FeatureProcessingContext.js";import{PipelineCommand as f}from"./PipelineCommand.js";import{Tile3DManager as _}from"./Tile3DManager.js";import{TileLocks as C}from"./TileLocks.js";import{TiledFeatureStore as w}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as g}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as x}from"./rendering/RenderCommandContext.js";import{RenderCoordsHelper as v}from"../../../support/RenderCoordsHelper.js";let R=class extends a.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new w,this._tileLocks=new C,this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null,this._mainThreadDelegate=null,this._viewSpatialReference=null,this._renderCommandContext=null,this._context=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,layerInfo:a,layerViewInfo:n}){const s=u.fromJSON(e);this._viewSpatialReference=s;const l=u.fromJSON(t);this._fetcher=new g(this._viewSpatialReference,y.fromJSON(a.baseQuery),a.url,a.objectIdField,a.capabilities),this._queryEngine=new h({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",featureIdInfo:{type:"object-id",fieldName:a.objectIdField},fieldsIndex:a.fieldIndex,availableFields:[a.objectIdField],spatialReference:e,featureStore:this._featureStore,timeInfo:a.timeInfo}),this._mainThreadDelegate={createTexture:async(e,t)=>{const r={data:e,parameters:t};return await this.remoteClient.invoke("createTexture",r,{transferList:[e.buffer]})},releaseTexture:async e=>{const t={uid:e};await this.remoteClient.invoke("releaseTexture",t)},createMaterial:async e=>{const t={materialJSON:e};await this.remoteClient.invoke("createMaterial",t)},destroyMaterial:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyMaterial",t)},createDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)},destroyDirectRenderer:async e=>{const t={materialId:e};await this.remoteClient.invoke("destroyDirectRenderer",t)},createLodRenderer:async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})},destroyLodRenderer:async e=>{const t={rendererId:e};await this.remoteClient.invoke("destroyLoDRenderer",t)},executeRenderCommands:async e=>{const t={commands:e.commands};await this.remoteClient.invoke("dispatchRenderCommands",t,{transferList:e.transferList})},applyElevationAlignmentTo:async e=>{const t={mapPoints:e};return await this.remoteClient.invoke("applyElevationAlignment",t,{transferList:[e.buffer]})}};const f=v.create(r,l),C=new x(r,this._mainThreadDelegate);this._renderCommandContext=C;const w=new p(s,l,this._mainThreadDelegate,f,C,a,n);this._context=w,this._renderer=w.symbolRendererFactory.createSymbolRendererFromJSON(a.renderer),this._defaultQueryJSON=new y({outSpatialReference:s}).toJSON();let R=null;if(null!=a.fullExtent){const e=c.fromJSON(a.fullExtent);await d(e.spatialReference,s),R=m(e,s)}return this._tileManager=new _({loadTile:(e,t)=>this._fetcher.fetch(e,t),createAddCommand:(e,t)=>this._createAddFeatureDataCommand(e,t),createRemoveCommand:e=>this._createRemoveFeatureDataCommand(e),createUpdateCommand:(e,t)=>this._createUpdateFeatureDataVisibilityCommand(e,t),tileLocks:this._tileLocks,extent:R}),this.addHandles(i((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),o),null!=this._renderer&&await this._renderer.load(),j}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}onTileTreeChange(e){return this._tileManager.onTileTreeChange(e),Promise.resolve(j)}async onElevationChange(e){return j}async onLayerViewOpacityChange(e){const{_context:t,_renderer:r}=this;if(t.layerViewInfo.fullOpacity=e,null==r)return j;const a=await r.createUpdateLayerViewOpacityCommand(e);return await a.execute(),j}async onRendererChange(r){const{_context:a}=this,n=a.symbolRendererFactory.createSymbolRendererFromJSON(r);await n.load();const i=this._renderer;this._renderer=n;const o=[...this._tileManager.loadedTiles()],s=o.map((e=>e.tileId));{const r={stack:[],error:void 0,hasError:!1};try{e(r,await this._tileLocks.lock(s),!1);const t=o.flatMap((e=>[i.createRemoveCommand(e.id),n.createAddCommand(e)])),l=await Promise.all(t),c=a.joinPipelineCommands(l);await c.execute()}catch(c){r.error=c,r.hasError=!0}finally{t(r)}}const l=await i.createDestroyCommand();return await l.execute(),j}async _createAddFeatureDataCommand(e,t){const r=this._featureStore,a=this._renderer;let i;return i=null!=a?await a.createAddCommand(e):f.create(this._renderCommandContext),n(t),i.appendPipelineStateCommand((()=>{r.addTile(e)})),i}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer;let a;return a=null!=r?await r.createRemoveCommand(e):f.create(this._renderCommandContext),a.appendPipelineStateCommand((()=>{t.removeTile(e)})),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const r=this._renderer;let a;return a=null!=r?await r.createUpdateVisibilityCommand(e):f.create(this._renderCommandContext),n(t),a}_ensureQuery(e){return e??this._defaultQueryJSON}};r([s()],R.prototype,"updating",null),R=r([l("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],R);const S=R,j={result:void 0};export{S as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{clone as t}from"../../../../core/lang.js";import n from"../../../../core/Logger.js";import{isInt16Array as r,minInt16 as o,isInt32Array as i,minInt32 as u,nativeArrayMaxSize as a}from"../../../../core/typedArrayUtil.js";import{compactUCharArray as s}from"../../../../geometry/support/UCharArray.js";import{compactUShortArray as c}from"../../../../geometry/support/UShortArray.js";import{decodeRGB as f,decodeIntensity as l}from"./LEPCC.js";import{VertexAttribute as d}from"../../webgl-engine/lib/VertexAttribute.js";const b=()=>n.getLogger("esri.views.3d.layers.i3s.I3SBinaryReader");function y(t,n,r){let o="",i=0;for(;i<r;){const u=t[n+i];if(u<128)o+=String.fromCharCode(u),i++;else if(u>=192&&u<224){if(i+1>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Two byte character was truncated.");const a=(31&u)<<6|63&t[n+i+1];o+=String.fromCharCode(a),i+=2}else if(u>=224&&u<240){if(i+2>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const a=(15&u)<<12|(63&t[n+i+1])<<6|63&t[n+i+2];o+=String.fromCharCode(a),i+=3}else{if(!(u>=240&&u<248))throw new e("utf8-decode-error","UTF-8 Decode failed. Invalid multi byte sequence.");{if(i+3>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const a=(7&u)<<18|(63&t[n+i+1])<<12|(63&t[n+i+2])<<6|63&t[n+i+3];if(a>=65536){const e=55296+(a-65536>>10),t=56320+(1023&a);o+=String.fromCharCode(e,t)}else o+=String.fromCharCode(a);i+=4}}}return o}function g(e,t){const n={byteOffset:0,byteCount:0,fields:Object.create(null)};let r=0;for(let o=0;o<t.length;o++){const i=t[o],u=i.valueType||i.type,a=F[u];n.fields[i.property]=a(e,r),r+=j[u].BYTES_PER_ELEMENT}return n.byteCount=r,n}function p(e,t,n){return m(e,t,n).map((e=>{const t=e?Date.parse(e):null;return null==t||Number.isNaN(t)?null:t}))}function m(t,n,r){const o=[];let i,u,a=0;for(u=0;u<t;u+=1){if(i=n[u],i>0){if(o.push(y(r,a,i-1)),0!==r[a+i-1])throw new e("string-array-error","Invalid string array: missing null termination.")}else o.push(null);a+=i}return o}function w(e,t){return new(0,j[t.valueType])(e,t.byteOffset,t.count*t.valuesPerElement)}function v(e,t){const n=w(e,t);if(n.length>=a)return n;const r=new Array;return n.forEach(((e,t)=>r.push(C(n,t)))),r}function C(e,t){if(!e)return null;const n=e[t];if(r(e))return n===o?null:n;if(i(e))return n===u?null:n;return n!=n?null:n}function I(e,t){return new Uint8Array(e,t.byteOffset,t.byteCount)}function h(n,r,o){const i=null!=r.header?g(n,r.header):{byteOffset:0,byteCount:0,fields:{count:o}},u={header:i,byteOffset:i.byteCount,byteCount:0,entries:Object.create(null)};let a=i.byteCount;for(let s=0;s<r.ordering.length;s++){const n=r.ordering[s],o=t(r[n]);if(o.count=i.fields.count??0,"String"===o.valueType){if(o.byteOffset=a,o.byteCount=i.fields[n+"ByteCount"],"UTF-8"!==o.encoding)throw new e("unsupported-encoding","Unsupported String encoding.",{encoding:o.encoding});if(o.timeEncoding&&"ECMA_ISO8601"!==o.timeEncoding)throw new e("unsupported-time-encoding","Unsupported time encoding.",{timeEncoding:o.timeEncoding})}else{if(!R(o.valueType))throw new e("unsupported-value-type","Unsupported binary valueType",{valueType:o.valueType});{const e=B(o.valueType);a+=a%e
|
|
5
|
+
import e from"../../../../core/Error.js";import{clone as t}from"../../../../core/lang.js";import n from"../../../../core/Logger.js";import{isInt16Array as r,minInt16 as o,isInt32Array as i,minInt32 as u,nativeArrayMaxSize as a}from"../../../../core/typedArrayUtil.js";import{compactUCharArray as s}from"../../../../geometry/support/UCharArray.js";import{compactUShortArray as c}from"../../../../geometry/support/UShortArray.js";import{decodeRGB as f,decodeIntensity as l}from"./LEPCC.js";import{VertexAttribute as d}from"../../webgl-engine/lib/VertexAttribute.js";const b=()=>n.getLogger("esri.views.3d.layers.i3s.I3SBinaryReader");function y(t,n,r){let o="",i=0;for(;i<r;){const u=t[n+i];if(u<128)o+=String.fromCharCode(u),i++;else if(u>=192&&u<224){if(i+1>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Two byte character was truncated.");const a=(31&u)<<6|63&t[n+i+1];o+=String.fromCharCode(a),i+=2}else if(u>=224&&u<240){if(i+2>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const a=(15&u)<<12|(63&t[n+i+1])<<6|63&t[n+i+2];o+=String.fromCharCode(a),i+=3}else{if(!(u>=240&&u<248))throw new e("utf8-decode-error","UTF-8 Decode failed. Invalid multi byte sequence.");{if(i+3>=r)throw new e("utf8-decode-error","UTF-8 Decode failed. Multi byte character was truncated.");const a=(7&u)<<18|(63&t[n+i+1])<<12|(63&t[n+i+2])<<6|63&t[n+i+3];if(a>=65536){const e=55296+(a-65536>>10),t=56320+(1023&a);o+=String.fromCharCode(e,t)}else o+=String.fromCharCode(a);i+=4}}}return o}function g(e,t){const n={byteOffset:0,byteCount:0,fields:Object.create(null)};let r=0;for(let o=0;o<t.length;o++){const i=t[o],u=i.valueType||i.type,a=F[u];n.fields[i.property]=a(e,r),r+=j[u].BYTES_PER_ELEMENT}return n.byteCount=r,n}function p(e,t,n){return m(e,t,n).map((e=>{const t=e?Date.parse(e):null;return null==t||Number.isNaN(t)?null:t}))}function m(t,n,r){const o=[];let i,u,a=0;for(u=0;u<t;u+=1){if(i=n[u],i>0){if(o.push(y(r,a,i-1)),0!==r[a+i-1])throw new e("string-array-error","Invalid string array: missing null termination.")}else o.push(null);a+=i}return o}function w(e,t){return new(0,j[t.valueType])(e,t.byteOffset,t.count*t.valuesPerElement)}function v(e,t){const n=w(e,t);if(n.length>=a)return n;const r=new Array;return n.forEach(((e,t)=>r.push(C(n,t)))),r}function C(e,t){if(!e)return null;const n=e[t];if(r(e))return n===o?null:n;if(i(e))return n===u?null:n;return n!=n?null:n}function I(e,t){return new Uint8Array(e,t.byteOffset,t.byteCount)}function h(n,r,o){const i=null!=r.header?g(n,r.header):{byteOffset:0,byteCount:0,fields:{count:o}},u={header:i,byteOffset:i.byteCount,byteCount:0,entries:Object.create(null)};let a=i.byteCount;for(let s=0;s<r.ordering.length;s++){const n=r.ordering[s],o=t(r[n]);if(o.count=i.fields.count??0,"String"===o.valueType){if(o.byteOffset=a,o.byteCount=i.fields[n+"ByteCount"],"UTF-8"!==o.encoding)throw new e("unsupported-encoding","Unsupported String encoding.",{encoding:o.encoding});if(o.timeEncoding&&"ECMA_ISO8601"!==o.timeEncoding)throw new e("unsupported-time-encoding","Unsupported time encoding.",{timeEncoding:o.timeEncoding})}else{if(!R(o.valueType))throw new e("unsupported-value-type","Unsupported binary valueType",{valueType:o.valueType});{const e=B(o.valueType);a+=a%e!==0?e-a%e:0,o.byteOffset=a,o.byteCount=e*o.valuesPerElement*o.count}}a+=o.byteCount??0,u.entries[n]=o}return u.byteCount=a-u.byteOffset,u}function A(t,n,r){if(n!==t&&b().error(`Invalid ${r} buffer size\n expected: ${t}, actual: ${n})`),n<t)throw new e("buffer-too-small","Binary buffer is too small",{expectedSize:t,actualSize:n})}function O(e){return{isDraco:!1,isLegacy:!1,color:null!=e.color,normal:null!=e.normal,uv0:null!=e.uv0,uvRegion:null!=e.uvRegion,featureIndex:null!=e.faceRange&&null!=e.featureId}}function U(e,t){const n=g(e,t&&t.header);let r=n.byteCount;const o={isDraco:!1,header:n,byteOffset:n.byteCount,byteCount:0,vertexAttributes:{}},i=n.fields,u=null!=i.vertexCount?i.vertexCount:i.count;for(const c of t.ordering){if(!t.vertexAttributes[c])continue;const e={...t.vertexAttributes[c],byteOffset:r,count:u},n=x[c]||"_"+c;o.vertexAttributes[n]=e,r+=B(e.valueType)*e.valuesPerElement*u}const a=i.faceCount;if(t.faces&&a){o.faces={};for(const e of t.ordering){if(!t.faces[e])continue;const n={...t.faces[e],byteOffset:r,count:a};o.faces[e]=n,r+=B(n.valueType)*n.valuesPerElement*a}}const s=i.featureCount;if(t.featureAttributes&&t.featureAttributeOrder&&s){o.featureAttributes={};for(const e of t.featureAttributeOrder){if(!t.featureAttributes[e])continue;const n={...t.featureAttributes[e],byteOffset:r,count:s};o.featureAttributes[e]=n;r+=("UInt64"===n.valueType?8:B(n.valueType))*n.valuesPerElement*s}}return A(r,e.byteLength,"geometry"),o.byteCount=r-o.byteOffset,o}function E(e,t){return!(!e||!e.compressedAttributes||"draco"!==e.compressedAttributes.encoding)?S(e.compressedAttributes.attributes):e?O(e):T(t)}function T(e){const t={isDraco:!1,isLegacy:!0,color:!1,normal:!1,uv0:!1,uvRegion:!1,featureIndex:!1};for(const n of e.ordering)if(e.vertexAttributes[n])switch(n){case"position":break;case"normal":t.normal=!0;break;case"color":t.color=!0;break;case"uv0":t.uv0=!0;break;case"region":t.uvRegion=!0}return e.featureAttributes&&e.featureAttributeOrder&&(t.featureIndex=!0),t}function S(e){const t={isDraco:!0,isLegacy:!1,color:!1,normal:!1,uv0:!1,uvRegion:!1,featureIndex:!1};for(const n of e)switch(n){case"position":break;case"normal":t.normal=!0;break;case"uv0":t.uv0=!0;break;case"color":t.color=!0;break;case"uv-region":t.uvRegion=!0;break;case"feature-index":t.featureIndex=!0}return t}const x={position:d.POSITION,normal:d.NORMAL,color:d.COLOR,uv0:d.UV0,region:d.UVREGION};function D(t,n,r,o=!1){if("lepcc-rgb"===t.encoding)return o?f(n):s(f(n));if("lepcc-intensity"===t.encoding)return o?l(n):c(l(n));if(null!=t.encoding&&""!==t.encoding)throw new e("unknown-attribute-storage-info-encoding","Unknown Attribute Storage Info Encoding");t["attributeByteCounts "]&&!t.attributeByteCounts&&(b().warn("Warning: Trailing space in 'attributeByteCounts '."),t.attributeByteCounts=t["attributeByteCounts "]),"ObjectIds"===t.ordering[0]&&t.hasOwnProperty("objectIds")&&(b().warn("Warning: Case error in objectIds"),t.ordering[0]="objectIds");const i=h(n,t,r);A(i.byteOffset+i.byteCount,n.byteLength,"attribute");const u=i.entries.attributeValues||i.entries.objectIds;if(u){if("String"===u.valueType){const e=i.entries.attributeByteCounts,t=w(n,e),r=I(n,u);return u.timeEncoding?p(e.count,t,r):m(e.count,t,r)}return o?w(n,u):v(n,u)}throw new e("bad-attribute-storage-info","Bad attributeStorageInfo specification.")}const j={Float32:Float32Array,Float64:Float64Array,UInt8:Uint8Array,Int8:Int8Array,UInt16:Uint16Array,Int16:Int16Array,UInt32:Uint32Array,Int32:Int32Array},F={Float32:(e,t)=>new DataView(e,0).getFloat32(t,!0),Float64:(e,t)=>new DataView(e,0).getFloat64(t,!0),UInt8:(e,t)=>new DataView(e,0).getUint8(t),Int8:(e,t)=>new DataView(e,0).getInt8(t),UInt16:(e,t)=>new DataView(e,0).getUint16(t,!0),Int16:(e,t)=>new DataView(e,0).getInt16(t,!0),UInt32:(e,t)=>new DataView(e,0).getUint32(t,!0),Int32:(e,t)=>new DataView(e,0).getInt32(t,!0)};function R(e){return j.hasOwnProperty(e)}function B(e){return R(e)?j[e].BYTES_PER_ELEMENT:0}export{h as createAttributeDataIndex,E as createGeometryDescriptor,S as createGeometryDescriptorForDraco,O as createGeometryDescriptorFromDefinition,T as createGeometryDescriptorFromSchema,U as createGeometryIndexFromSchema,I as createRawView,w as createTypedView,B as getBytesPerValue,C as getCachedAttributeValue,R as isValueType,D as readBinaryAttribute,p as readDateStringArray,g as readHeader,m as readStringArray,F as valueType2ArrayBufferReader,j as valueType2TypedArrayClassMap};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{validateColorAndOpacity as e,validateColor as o}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as r}from"../../../../core/mathUtils.js";import{EmissiveSourceMode as s}from"../../../../symbols/support/materialUtils.js";import{TextureUsage as a,TextureEncoding as t}from"./enums.js";import{RenderTexture as l}from"../../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as n}from"../../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{CullFaceOptions as i,AlphaDiscardMode as u,TextureEncodingMimeType as c}from"../../webgl-engine/lib/basicInterfaces.js";import{Texture as m}from"../../webgl-engine/lib/Texture.js";import{useSchematicPBRI3S as d,useSchematicPBR as p,schematicMRRFactors as g,advancedMRRFactors as h}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as f}from"../../../webgl/enums.js";import{alphaCutoff as T}from"../../../../webscene/support/AlphaCutoff.js";function x(o,r,s){const t=new Map,l=(e,o)=>{if(null==e)return-1;const r=t.get(e.id);if(r)return r.usage|=o,r.id;const s=t.size;return t.set(e.id,{id:s,usage:o}),s},n=r.pbrMetallicRoughness,u=n?.baseColorFactor?e(n.baseColorFactor):null,c=r.emissiveFactor,m=has("disable-feature:diffuse-rendering-i3s")||s?d({normalTexture:r.normalTexture,emissiveTexture:r.emissiveTexture,emissiveFactor:r.emissiveFactor,occlusionTexture:r.occlusionTexture,metallicRoughnessTexture:n?.metallicRoughnessTexture,metallicFactor:n?.metallicFactor,roughnessFactor:n?.roughnessFactor}):p({normalTexture:r.normalTexture,emissiveTexture:r.emissiveTexture,emissiveFactor:r.emissiveFactor,occlusionTexture:r.occlusionTexture,metallicRoughnessTexture:n?.metallicRoughnessTexture,metallicFactor:n?.metallicFactor,roughnessFactor:n?.roughnessFactor}),f=m?g[0]:n?.metallicFactor??h[0],T=m?g[1]:n?.roughnessFactor??h[1],x="mask"===r.alphaMode?a.Color|a.AlphaMask:a.Color,C={baseColorFactor:u?[u[0],u[1],u[2],u[3]]:[1,1,1,1],baseColorTextureId:l(n?.baseColorTexture,x),metallicRoughnessTextureId:l(n?.metallicRoughnessTexture,a.MetallicRoughness),metallicFactor:f,roughnessFactor:T},S={alphaMode:r.alphaMode,alphaCutoff:r.alphaCutoff,doubleSided:r.doubleSided,cullFace:"none"===r.cullFace?i.None:"back"===r.cullFace?i.Back:"front"===r.cullFace?i.Front:i.None,normalTextureId:l(r.normalTexture,a.Normal),emissiveTextureId:l(r.emissiveTexture,a.Emissive),occlusionTextureId:l(r.occlusionTexture,a.Occlusion),emissiveFactor:c?[c[0],c[1],c[2]]:[0,0,0],metallicRoughness:C,wrapTextures:!1,hasParametersFromSource:m},P=[];return t.forEach((({usage:e},r)=>{const s=null!=o&&o[r]&&o[r].formats,a=s?F(s.map((({name:e,format:o})=>({name:e,encoding:b[o]})))):[];P.push({id:r,usage:e,encodings:a})})),{material:S,textures:P}}function F(e){return e.sort(((e,o)=>e.encoding-o.encoding))}const b={ktx2:t.KTX2,basis:t.Basis,dds:t.DDS_S3TC,png:t.PNG,jpg:t.JPG,"ktx-etc2":t.KTX_ETC2},C={[c.KTX2_ENCODING]:t.Basis,[c.BASIS_ENCODING]:t.Basis,[c.DDS_ENCODING]:t.DDS_S3TC,"image/png":t.PNG,"image/jpg":t.JPG,"image/jpeg":t.JPG,"image/ktx":t.KTX_ETC2};function S(e){const s=e?.materialDefinitions?Object.keys(e.materialDefinitions)[0]:null,t=e?.textureDefinitions?Object.keys(e.textureDefinitions)[0]:null,l=s?e.materialDefinitions?.[s]:null,n=t?e.textureDefinitions?.[t]:null,u=P();if(null!=l){const e=l.params;e.diffuse&&(o(e.diffuse),u.metallicRoughness.baseColorFactor=[e.diffuse[0],e.diffuse[1],e.diffuse[2],1]),null!=e.doubleSided&&(u.doubleSided=e.doubleSided,u.cullFace=e.doubleSided?i.None:i.Back),"none"!==e.cullFace&&"front"!==e.cullFace&&"back"!==e.cullFace||(u.cullFace="none"===e.cullFace?i.None:"back"===e.cullFace?i.Back:i.Front),e.transparency&&(u.metallicRoughness.baseColorFactor[3]=r(1-e.transparency,0,1)),(e.useVertexColorAlpha||u.metallicRoughness.baseColorFactor[3]<1)&&(u.alphaMode="blend")}const c=[];if(null!=n){const e=0;!n.wrap||"repeat"!==n.wrap[0]&&"repeat"!==n.wrap[1]||(u.wrapTextures=!0);let o=a.Color;"rgba"===n.channels&&(u.alphaMode="blend",o|=a.AlphaMask);const r=n.images.length-1,s=n.images[r],t=e=>e?.split("/").pop(),l=Array.isArray(n.encoding)?F(n.encoding.map(((e,o)=>({name:t(s.href[o]),encoding:C[e]||0})))):[{name:t(s.href),encoding:C[n.encoding]||0}];c.push({id:e,usage:o,encodings:l}),u.metallicRoughness.baseColorTextureId=e}return{material:u,textures:c}}const P=()=>({alphaMode:"opaque",alphaCutoff:T,doubleSided:!0,cullFace:i.None,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[.8,.8,.8,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6},wrapTextures:!1,hasParametersFromSource:!0});function M(e,o,r,s){if(null==e?.data)return null;const t=e.data,l=s.renderingContext.parameters.maxMaxAnisotropy,n=l>1,i=r||!o.wrapTextures?D:R,u=k(e.encoding),c=e.usage&a.Color?"opaque"===o.alphaMode?3:4:3;return new m(t,{mipmap:n,maxAnisotropy:l,encoding:u,wrap:i,components:c,noUnpackFlip:!0})}const D={s:f.CLAMP_TO_EDGE,t:f.CLAMP_TO_EDGE},R={s:f.REPEAT,t:f.REPEAT};function w(o,r,t,i,c,m){const d=m.rendererTextureUsage,p=e=>I(i,t,e&d),f=e(r.metallicRoughness.baseColorFactor);o.baseColor=[f[0],f[1],f[2],f[3]],o.hasParametersFromSource=!!r.hasParametersFromSource,o.usePBR=m.usePBR,o.mrrFactors=[r.metallicRoughness.metallicFactor,r.metallicRoughness.roughnessFactor,r.hasParametersFromSource?g[2]:h[2]],o.emissiveBaseColor=r.emissiveFactor,o.emissiveSource=s.Emissive,o.isIntegratedMesh=m.isIntegratedMesh,o.textureAlphaCutoff="mask"===r.alphaMode?r.alphaCutoff:T,o.alphaDiscardMode="opaque"===r.alphaMode?u.Opaque:"mask"===r.alphaMode?u.Mask:u.MaskBlend;const x=[],F=p(a.Color|a.AlphaMask);null!=F&&(o.baseColorTexture=new l(c,F),x.push(o.baseColorTexture.loadPromise));const b=p(a.MetallicRoughness);null!=b&&(o.metallicRoughnessTexture=new l(c,b),x.push(o.metallicRoughnessTexture.loadPromise));const C=p(a.Emissive);null!=C&&(o.emissionTexture=new l(c,C),x.push(o.emissionTexture.loadPromise));const S=p(a.Occlusion);null!=S&&(o.occlusionTexture=new l(c,S),x.push(o.occlusionTexture.loadPromise));const P=p(a.Normal);return null!=P&&(o.normalTexture=new l(c,P),x.push(o.normalTexture.loadPromise)),o.commonMaterialParameters.hasSlicePlane=m.slicePlaneEnabled,o.commonMaterialParameters.doubleSided=r.doubleSided,o.commonMaterialParameters.cullFace=r.cullFace,o.ellipsoidMode=n(m.viewSpatialReference),Promise.all(x)}function E(e){const o=!!e.compressedTextureS3TC,r=!!e.compressedTextureETC,s=has("disable-feature:i3s-basis")?0:t.Basis|t.KTX2,a=t.JPG|t.PNG,l=s|t.DDS_S3TC;return a|(o?l:0)|(r?s:0)}function N(e,o){if(null!=o)return e.find((e
|
|
5
|
+
import{validateColorAndOpacity as e,validateColor as o}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{clamp as r}from"../../../../core/mathUtils.js";import{EmissiveSourceMode as s}from"../../../../symbols/support/materialUtils.js";import{TextureUsage as a,TextureEncoding as t}from"./enums.js";import{RenderTexture as l}from"../../webgl-engine/core/material/RenderTexture.js";import{getEllipsoidMode as n}from"../../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{CullFaceOptions as i,AlphaDiscardMode as u,TextureEncodingMimeType as c}from"../../webgl-engine/lib/basicInterfaces.js";import{Texture as m}from"../../webgl-engine/lib/Texture.js";import{useSchematicPBRI3S as d,useSchematicPBR as p,schematicMRRFactors as g,advancedMRRFactors as h}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as f}from"../../../webgl/enums.js";import{alphaCutoff as T}from"../../../../webscene/support/AlphaCutoff.js";function x(o,r,s){const t=new Map,l=(e,o)=>{if(null==e)return-1;const r=t.get(e.id);if(r)return r.usage|=o,r.id;const s=t.size;return t.set(e.id,{id:s,usage:o}),s},n=r.pbrMetallicRoughness,u=n?.baseColorFactor?e(n.baseColorFactor):null,c=r.emissiveFactor,m=has("disable-feature:diffuse-rendering-i3s")||s?d({normalTexture:r.normalTexture,emissiveTexture:r.emissiveTexture,emissiveFactor:r.emissiveFactor,occlusionTexture:r.occlusionTexture,metallicRoughnessTexture:n?.metallicRoughnessTexture,metallicFactor:n?.metallicFactor,roughnessFactor:n?.roughnessFactor}):p({normalTexture:r.normalTexture,emissiveTexture:r.emissiveTexture,emissiveFactor:r.emissiveFactor,occlusionTexture:r.occlusionTexture,metallicRoughnessTexture:n?.metallicRoughnessTexture,metallicFactor:n?.metallicFactor,roughnessFactor:n?.roughnessFactor}),f=m?g[0]:n?.metallicFactor??h[0],T=m?g[1]:n?.roughnessFactor??h[1],x="mask"===r.alphaMode?a.Color|a.AlphaMask:a.Color,C={baseColorFactor:u?[u[0],u[1],u[2],u[3]]:[1,1,1,1],baseColorTextureId:l(n?.baseColorTexture,x),metallicRoughnessTextureId:l(n?.metallicRoughnessTexture,a.MetallicRoughness),metallicFactor:f,roughnessFactor:T},S={alphaMode:r.alphaMode,alphaCutoff:r.alphaCutoff,doubleSided:r.doubleSided,cullFace:"none"===r.cullFace?i.None:"back"===r.cullFace?i.Back:"front"===r.cullFace?i.Front:i.None,normalTextureId:l(r.normalTexture,a.Normal),emissiveTextureId:l(r.emissiveTexture,a.Emissive),occlusionTextureId:l(r.occlusionTexture,a.Occlusion),emissiveFactor:c?[c[0],c[1],c[2]]:[0,0,0],metallicRoughness:C,wrapTextures:!1,hasParametersFromSource:m},P=[];return t.forEach((({usage:e},r)=>{const s=null!=o&&o[r]&&o[r].formats,a=s?F(s.map((({name:e,format:o})=>({name:e,encoding:b[o]})))):[];P.push({id:r,usage:e,encodings:a})})),{material:S,textures:P}}function F(e){return e.sort(((e,o)=>e.encoding-o.encoding))}const b={ktx2:t.KTX2,basis:t.Basis,dds:t.DDS_S3TC,png:t.PNG,jpg:t.JPG,"ktx-etc2":t.KTX_ETC2},C={[c.KTX2_ENCODING]:t.Basis,[c.BASIS_ENCODING]:t.Basis,[c.DDS_ENCODING]:t.DDS_S3TC,"image/png":t.PNG,"image/jpg":t.JPG,"image/jpeg":t.JPG,"image/ktx":t.KTX_ETC2};function S(e){const s=e?.materialDefinitions?Object.keys(e.materialDefinitions)[0]:null,t=e?.textureDefinitions?Object.keys(e.textureDefinitions)[0]:null,l=s?e.materialDefinitions?.[s]:null,n=t?e.textureDefinitions?.[t]:null,u=P();if(null!=l){const e=l.params;e.diffuse&&(o(e.diffuse),u.metallicRoughness.baseColorFactor=[e.diffuse[0],e.diffuse[1],e.diffuse[2],1]),null!=e.doubleSided&&(u.doubleSided=e.doubleSided,u.cullFace=e.doubleSided?i.None:i.Back),"none"!==e.cullFace&&"front"!==e.cullFace&&"back"!==e.cullFace||(u.cullFace="none"===e.cullFace?i.None:"back"===e.cullFace?i.Back:i.Front),e.transparency&&(u.metallicRoughness.baseColorFactor[3]=r(1-e.transparency,0,1)),(e.useVertexColorAlpha||u.metallicRoughness.baseColorFactor[3]<1)&&(u.alphaMode="blend")}const c=[];if(null!=n){const e=0;!n.wrap||"repeat"!==n.wrap[0]&&"repeat"!==n.wrap[1]||(u.wrapTextures=!0);let o=a.Color;"rgba"===n.channels&&(u.alphaMode="blend",o|=a.AlphaMask);const r=n.images.length-1,s=n.images[r],t=e=>e?.split("/").pop(),l=Array.isArray(n.encoding)?F(n.encoding.map(((e,o)=>({name:t(s.href[o]),encoding:C[e]||0})))):[{name:t(s.href),encoding:C[n.encoding]||0}];c.push({id:e,usage:o,encodings:l}),u.metallicRoughness.baseColorTextureId=e}return{material:u,textures:c}}const P=()=>({alphaMode:"opaque",alphaCutoff:T,doubleSided:!0,cullFace:i.None,normalTextureId:-1,emissiveTextureId:-1,occlusionTextureId:-1,emissiveFactor:[0,0,0],metallicRoughness:{baseColorFactor:[.8,.8,.8,1],baseColorTextureId:-1,metallicRoughnessTextureId:-1,metallicFactor:0,roughnessFactor:.6},wrapTextures:!1,hasParametersFromSource:!0});function M(e,o,r,s){if(null==e?.data)return null;const t=e.data,l=s.renderingContext.parameters.maxMaxAnisotropy,n=l>1,i=r||!o.wrapTextures?D:R,u=k(e.encoding),c=e.usage&a.Color?"opaque"===o.alphaMode?3:4:3;return new m(t,{mipmap:n,maxAnisotropy:l,encoding:u,wrap:i,components:c,noUnpackFlip:!0})}const D={s:f.CLAMP_TO_EDGE,t:f.CLAMP_TO_EDGE},R={s:f.REPEAT,t:f.REPEAT};function w(o,r,t,i,c,m){const d=m.rendererTextureUsage,p=e=>I(i,t,e&d),f=e(r.metallicRoughness.baseColorFactor);o.baseColor=[f[0],f[1],f[2],f[3]],o.hasParametersFromSource=!!r.hasParametersFromSource,o.usePBR=m.usePBR,o.mrrFactors=[r.metallicRoughness.metallicFactor,r.metallicRoughness.roughnessFactor,r.hasParametersFromSource?g[2]:h[2]],o.emissiveBaseColor=r.emissiveFactor,o.emissiveSource=s.Emissive,o.isIntegratedMesh=m.isIntegratedMesh,o.textureAlphaCutoff="mask"===r.alphaMode?r.alphaCutoff:T,o.alphaDiscardMode="opaque"===r.alphaMode?u.Opaque:"mask"===r.alphaMode?u.Mask:u.MaskBlend;const x=[],F=p(a.Color|a.AlphaMask);null!=F&&(o.baseColorTexture=new l(c,F),x.push(o.baseColorTexture.loadPromise));const b=p(a.MetallicRoughness);null!=b&&(o.metallicRoughnessTexture=new l(c,b),x.push(o.metallicRoughnessTexture.loadPromise));const C=p(a.Emissive);null!=C&&(o.emissionTexture=new l(c,C),x.push(o.emissionTexture.loadPromise));const S=p(a.Occlusion);null!=S&&(o.occlusionTexture=new l(c,S),x.push(o.occlusionTexture.loadPromise));const P=p(a.Normal);return null!=P&&(o.normalTexture=new l(c,P),x.push(o.normalTexture.loadPromise)),o.commonMaterialParameters.hasSlicePlane=m.slicePlaneEnabled,o.commonMaterialParameters.doubleSided=r.doubleSided,o.commonMaterialParameters.cullFace=r.cullFace,o.ellipsoidMode=n(m.viewSpatialReference),Promise.all(x)}function E(e){const o=!!e.compressedTextureS3TC,r=!!e.compressedTextureETC,s=has("disable-feature:i3s-basis")?0:t.Basis|t.KTX2,a=t.JPG|t.PNG,l=s|t.DDS_S3TC;return a|(o?l:0)|(r?s:0)}function N(e,o){if(null!=o)return e.find((e=>0!==(e.encoding&o)))}function I(e,o,r){if(null==e||r===a.None)return null;for(let s=0;s<e.length;s++){const a=e[s];if(null!=a&&0!==(a.usage&r)){const e=o[s];return null!=e?e.id:null}}return null}function k(e){switch(e){case t.KTX2:return c.KTX2_ENCODING;case t.Basis:return c.BASIS_ENCODING;case t.DDS_S3TC:return c.DDS_ENCODING;case t.PNG:return"image/png";case t.JPG:return"image/jpeg";case t.KTX_ETC2:return"image/ktx";default:return""}}export{w as configureMaterial,M as createTexture,P as defaultMaterial,x as getMaterialAndTextures,S as getMaterialAndTexturesFromShared,E as getSupportedEncodings,N as selectEncoding};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{result as e,assertResult as t}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{clone as r}from"../../../../core/lang.js";import{throwIfAbortError as i}from"../../../../core/promiseUtils.js";import{makeAbsolute as o}from"../../../../core/urlUtils.js";import{TextureEncoding as n}from"./enums.js";import{readBinaryAttribute as s,createGeometryDescriptor as a}from"./I3SBinaryReader.js";import{getMaterialAndTextures as u,getMaterialAndTexturesFromShared as l,selectEncoding as f}from"./I3SMaterialUtil.js";class d{constructor(e,t,r,i,o,n){if(this._streamDataController=t,this._logger=r,this._defaultGeometrySchema=i,this._requiredAttributes=o,this._options=n,this._logLayer=e,this._layerUrl=e.parsedUrl.path,this._geometryDefinitions=e.geometryDefinitions,e.materialDefinitions){const t=e.textureSetDefinitions;this._materialAndTextures=e.materialDefinitions.map((r=>u(t,r,"integrated-mesh"===e.type)))}}_load(e,t,r){return this._streamDataController.request(e,t,r)}_loadAttribute(e,t,r){const i=`${this._layerUrl}/nodes/${e.resources.attributes}/attributes/${t.key}/0`;return this._load(i,"binary",r).then((e=>s(t,e)))}async loadAttributes(e,t,r){const o=await Promise.allSettled(t.map((t=>this._loadAttribute(e,t.attributeStorageInfo,r)))),n={};for(let s=0;s<t.length;++s){const r=o[s],a=t[s];if("fulfilled"===r.status){const e=r.value;n[a.name]=e}else{const t=r.reason;i(t),this._logger.error("#loadAttributes",this._logLayer,`Failed to load attributeData for '${a.name}' on node '${e.id}'`,t)}}return n}async loadNodeData(r,i){const o=null!=this._requiredAttributes&&r.resources.attributes?e(this.loadAttributes(r,this._requiredAttributes,i)):null,{bufferDefinition:n,bufferIndex:s}=_(this._geometryDefinitions,r),u=!!r.resources.geometry,f=u?e(this._loadGeometry(r.resources.geometry,s,i)):null,d=r.resources.hasSharedResource?await this._loadShared(r,i):null,y=r.resources.materialDefinition,D=this._materialAndTextures&&null!=y&&y>=0?this._materialAndTextures[y]:null!=d?l(d):null,b=D?.material,x=D?.textures??[],p=`${r.id}`,A=!u&&this._options.loadFeatureData,$=A?await this._loadFeatureData(p,i):null,T=A?m($):c(b),j=null==T?h($):null,w=x.length>0?e(this.loadTextures(r,x,i)):null;let I=null,S=null;if(f){I=t(await f);const e=g(this._defaultGeometrySchema,d);S=a(n,e)}const U=w?t(await w):null,q=o?t(await o):{},B=q?{attributeData:q,loadedAttributes:this._requiredAttributes}:null;if(null!=T)return{geometryData:T,attributeDataInfo:B,geometryBuffer:I,geometryDescriptor:S,requiredTextures:x,textureData:U};if(null!=j)return{pointData:j,attributeDataInfo:B,geometryBuffer:I,geometryDescriptor:S,requiredTextures:x,textureData:U};throw new Error}static _addAbsoluteHrefTexture(e,t){const r=e.textureDefinitions;if(null!=r)for(const i of Object.keys(r))for(const e of r[i].images)Array.isArray(e.href)?e.hrefConcat=e.href.map((e=>o(e,t))):e.hrefConcat=o(e.href,t)}static _fixTextureEncodings(e){const t=e.textureDefinitions;if(null!=t)for(const r in t){const e=t[r];if(Array.isArray(e.encoding))for(let t=0;t<e.encoding.length;t++){const r=e.encoding[t];"data:"===r.slice(0,5)&&(e.encoding[t]=r.slice(5))}else{const t=e.encoding;"data:"===t.slice(0,5)&&(e.encoding=t.slice(5))}}}async _loadShared(e,t){if(null==e.resources.geometry)return{};const r=`${this._layerUrl}/nodes/${e.resources.geometry}/shared`,i=await this._load(r,"json",t);return d._fixTextureEncodings(i),d._addAbsoluteHrefTexture(i,r),i}_loadTexture(e,t,r,i,o){return i===n.DDS_S3TC||i===n.KTX2||i===n.Basis?this._load(e,"binary",o).then((e=>({id:t,usage:r,data:e,encoding:i}))):this._load(e,"image",o).then((e=>({id:t,usage:r,data:e,encoding:i})))}loadTextures(e,t,r){const i=this._options.textureUsageMask;return Promise.all(t.map((t=>{if(
|
|
5
|
+
import{result as e,assertResult as t}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{clone as r}from"../../../../core/lang.js";import{throwIfAbortError as i}from"../../../../core/promiseUtils.js";import{makeAbsolute as o}from"../../../../core/urlUtils.js";import{TextureEncoding as n}from"./enums.js";import{readBinaryAttribute as s,createGeometryDescriptor as a}from"./I3SBinaryReader.js";import{getMaterialAndTextures as u,getMaterialAndTexturesFromShared as l,selectEncoding as f}from"./I3SMaterialUtil.js";class d{constructor(e,t,r,i,o,n){if(this._streamDataController=t,this._logger=r,this._defaultGeometrySchema=i,this._requiredAttributes=o,this._options=n,this._logLayer=e,this._layerUrl=e.parsedUrl.path,this._geometryDefinitions=e.geometryDefinitions,e.materialDefinitions){const t=e.textureSetDefinitions;this._materialAndTextures=e.materialDefinitions.map((r=>u(t,r,"integrated-mesh"===e.type)))}}_load(e,t,r){return this._streamDataController.request(e,t,r)}_loadAttribute(e,t,r){const i=`${this._layerUrl}/nodes/${e.resources.attributes}/attributes/${t.key}/0`;return this._load(i,"binary",r).then((e=>s(t,e)))}async loadAttributes(e,t,r){const o=await Promise.allSettled(t.map((t=>this._loadAttribute(e,t.attributeStorageInfo,r)))),n={};for(let s=0;s<t.length;++s){const r=o[s],a=t[s];if("fulfilled"===r.status){const e=r.value;n[a.name]=e}else{const t=r.reason;i(t),this._logger.error("#loadAttributes",this._logLayer,`Failed to load attributeData for '${a.name}' on node '${e.id}'`,t)}}return n}async loadNodeData(r,i){const o=null!=this._requiredAttributes&&r.resources.attributes?e(this.loadAttributes(r,this._requiredAttributes,i)):null,{bufferDefinition:n,bufferIndex:s}=_(this._geometryDefinitions,r),u=!!r.resources.geometry,f=u?e(this._loadGeometry(r.resources.geometry,s,i)):null,d=r.resources.hasSharedResource?await this._loadShared(r,i):null,y=r.resources.materialDefinition,D=this._materialAndTextures&&null!=y&&y>=0?this._materialAndTextures[y]:null!=d?l(d):null,b=D?.material,x=D?.textures??[],p=`${r.id}`,A=!u&&this._options.loadFeatureData,$=A?await this._loadFeatureData(p,i):null,T=A?m($):c(b),j=null==T?h($):null,w=x.length>0?e(this.loadTextures(r,x,i)):null;let I=null,S=null;if(f){I=t(await f);const e=g(this._defaultGeometrySchema,d);S=a(n,e)}const U=w?t(await w):null,q=o?t(await o):{},B=q?{attributeData:q,loadedAttributes:this._requiredAttributes}:null;if(null!=T)return{geometryData:T,attributeDataInfo:B,geometryBuffer:I,geometryDescriptor:S,requiredTextures:x,textureData:U};if(null!=j)return{pointData:j,attributeDataInfo:B,geometryBuffer:I,geometryDescriptor:S,requiredTextures:x,textureData:U};throw new Error}static _addAbsoluteHrefTexture(e,t){const r=e.textureDefinitions;if(null!=r)for(const i of Object.keys(r))for(const e of r[i].images)Array.isArray(e.href)?e.hrefConcat=e.href.map((e=>o(e,t))):e.hrefConcat=o(e.href,t)}static _fixTextureEncodings(e){const t=e.textureDefinitions;if(null!=t)for(const r in t){const e=t[r];if(Array.isArray(e.encoding))for(let t=0;t<e.encoding.length;t++){const r=e.encoding[t];"data:"===r.slice(0,5)&&(e.encoding[t]=r.slice(5))}else{const t=e.encoding;"data:"===t.slice(0,5)&&(e.encoding=t.slice(5))}}}async _loadShared(e,t){if(null==e.resources.geometry)return{};const r=`${this._layerUrl}/nodes/${e.resources.geometry}/shared`,i=await this._load(r,"json",t);return d._fixTextureEncodings(i),d._addAbsoluteHrefTexture(i,r),i}_loadTexture(e,t,r,i,o){return i===n.DDS_S3TC||i===n.KTX2||i===n.Basis?this._load(e,"binary",o).then((e=>({id:t,usage:r,data:e,encoding:i}))):this._load(e,"image",o).then((e=>({id:t,usage:r,data:e,encoding:i})))}loadTextures(e,t,r){const i=this._options.textureUsageMask;return Promise.all(t.map((t=>{if(0===(t.usage&i))return null;const o=f(t.encodings,this._options.textureEncodings);if(null==o)return this._logger.error("#loadTextures",this._logLayer,`No known encoding for texture found on node ${e.id}`),Promise.reject();const n=e.resources.texture||e.id,s=`${this._layerUrl}/nodes/${n}/textures/${o.name}`;return this._loadTexture(s,t.id,t.usage,o.encoding,r)})))}_loadFeatureData(e,t){const r=`${this._layerUrl}/nodes/${e}/features/0`;return this._load(r,"json",t)}_loadGeometry(e,t,r){const i=`${this._layerUrl}/nodes/${e}/geometries/${t}`;return this._load(i,"binary",r)}}function c(e){return{featureIds:[],geometries:[{type:"ArrayBufferView",params:{material:e}}],featureDataPosition:[0,0,0]}}function m(e){if(!e)return null;for(const t of e.featureData){const e=t.geometries;if(null!=e)for(const r of e)return{featureIds:[t.id],featureDataPosition:t.position,geometries:[r]}}return null}function h(e){if(!e)return null;const t=new Array;for(const r of e.featureData)null!=r.position&&t.push({featureIds:[r.id],featureDataPosition:r.position,geometries:[]});return t}function g(e,t){if(!e||!t?.materialDefinitions)return e;const i=Object.keys(t.materialDefinitions)[0];return!t.materialDefinitions[i].params.vertexRegions&&e.vertexAttributes.region&&delete(e=r(e)).vertexAttributes.region,e}function _(e,t){const r={bufferDefinition:null,bufferIndex:0},i=t.resources.geometryDefinition;if(null==e||null==i||i<0)return r;const o=i>=0?e[i].geometryBuffers:null;if(null==o)return r;for(let n=0;n<o.length;n++){const e=o[n];if(null==e.compressedAttributes)r.bufferIndex=n,r.bufferDefinition=o[n];else if("draco"===e.compressedAttributes.encoding&&!has("disable-feature:i3s-draco"))return r.bufferIndex=n,r.bufferDefinition=e,r}return r}export{d as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import i from"../../../../geometry/Extent.js";import{fallbackObjectIDAttribute as o}from"../../../../layers/LayerConstants.js";import{QueryEngine as a}from"../../../../layers/graphics/data/QueryEngine.js";import u from"../../../../layers/support/FieldsIndex.js";import y from"../../../../rest/support/FeatureSet.js";import c from"../../../../rest/support/Query.js";const l=a;let p=class extends t{constructor(e){super(e)}initialize(){this.addHandles(this.layerView.on("visible-geometry-changed",(()=>this.spatialIndex.events.emit("changed"))))}destroy(){this._dataQueryEngineInstance=r(this._dataQueryEngineInstance),this._set("layerView",null)}get spatialReference(){return this.layerView.view.spatialReference}get layer(){return this.layerView.i3slayer}get defaultQueryJSON(){return new c({outSpatialReference:this.spatialReference}).toJSON()}get _dataQueryEngine(){return this._ensureDataQueryEngine()}async executeQueryForCount(e,t){return this._dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),t)}async executeQueryForExtent(e,t){const{count:r,extent:s}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),t);return{count:r,extent:i.fromJSON(s)}}async executeQueryForIds(e,t){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),t)}async executeQuery(e,t){const r=this._ensureQueryJSON(e),s=await this._dataQueryEngine.executeQuery(r,t);if(e?.returnGeometry){const{processQueryGeometries:e}=await import("./I3SQueryResultGeometry.js");return e(this.layerView,s)}return y.fromJSON(s)}_ensureQueryJSON(e){return null==e?this.defaultQueryJSON:e.toJSON()}_ensureDataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e=this.layer.objectIdField||o,t="esriGeometryPolygon",r=this.layer.fieldsIndex?.toJSON()||new u([]),s=this.layerView.view.resourceController.scheduler,n=this.spatialReference.toJSON(),i=this.priority,a=this.spatialIndex;return this._dataQueryEngineInstance=new l({hasZ:!0,hasM:!1,geometryType:t,fieldsIndex:r,timeInfo:null,spatialReference:n,
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import i from"../../../../geometry/Extent.js";import{fallbackObjectIDAttribute as o}from"../../../../layers/LayerConstants.js";import{QueryEngine as a}from"../../../../layers/graphics/data/QueryEngine.js";import u from"../../../../layers/support/FieldsIndex.js";import y from"../../../../rest/support/FeatureSet.js";import c from"../../../../rest/support/Query.js";const l=a;let p=class extends t{constructor(e){super(e)}initialize(){this.addHandles(this.layerView.on("visible-geometry-changed",(()=>this.spatialIndex.events.emit("changed"))))}destroy(){this._dataQueryEngineInstance=r(this._dataQueryEngineInstance),this._set("layerView",null)}get spatialReference(){return this.layerView.view.spatialReference}get layer(){return this.layerView.i3slayer}get defaultQueryJSON(){return new c({outSpatialReference:this.spatialReference}).toJSON()}get _dataQueryEngine(){return this._ensureDataQueryEngine()}async executeQueryForCount(e,t){return this._dataQueryEngine.executeQueryForCount(this._ensureQueryJSON(e),t)}async executeQueryForExtent(e,t){const{count:r,extent:s}=await this._dataQueryEngine.executeQueryForExtent(this._ensureQueryJSON(e),t);return{count:r,extent:i.fromJSON(s)}}async executeQueryForIds(e,t){return this._dataQueryEngine.executeQueryForIds(this._ensureQueryJSON(e),t)}async executeQuery(e,t){const r=this._ensureQueryJSON(e),s=await this._dataQueryEngine.executeQuery(r,t);if(e?.returnGeometry){const{processQueryGeometries:e}=await import("./I3SQueryResultGeometry.js");return e(this.layerView,s)}return y.fromJSON(s)}_ensureQueryJSON(e){return null==e?this.defaultQueryJSON:e.toJSON()}_ensureDataQueryEngine(){if(this._dataQueryEngineInstance)return this._dataQueryEngineInstance;const e=this.layer.objectIdField||o,t="esriGeometryPolygon",r=this.layer.fieldsIndex?.toJSON()||new u([]),s=this.layerView.view.resourceController.scheduler,n=this.spatialReference.toJSON(),i=this.priority,a=this.spatialIndex;return this._dataQueryEngineInstance=new l({hasZ:!0,hasM:!1,geometryType:t,fieldsIndex:r,timeInfo:null,spatialReference:n,featureIdInfo:{type:"object-id",fieldName:e},featureStore:a,scheduler:s,priority:i}),this._dataQueryEngineInstance}};e([s({constructOnly:!0})],p.prototype,"layerView",void 0),e([s({constructOnly:!0})],p.prototype,"priority",void 0),e([s({constructOnly:!0})],p.prototype,"spatialIndex",void 0),e([s()],p.prototype,"spatialReference",null),e([s()],p.prototype,"layer",null),e([s()],p.prototype,"defaultQueryJSON",null),p=e([n("esri.views.3d.layers.i3s.I3SQueryEngine")],p);export{p as I3SQueryEngine};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getSphericalPCPF as e}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{create as t,contains as s,intersects as n}from"../../../../geometry/support/aaBoundingBox.js";class i{constructor(t,s,n){this._pages=[],this.pageSize=0,this._nodeSR=t,this._renderSR=s,this._renderSRSphericalPCPF=e(s),this.pageSize=n}addPage(e,t,s=0){for(;this._pages.length<e;)this._pages.push(null);r(t,this._nodeSR,this._renderSR,s,this._renderSRSphericalPCPF),this._pages[e]={nodes:t,parents:new Uint32Array(this.pageSize)},p(this._pages,this.pageSize)}hasPage(e){return!!this._pages[e]}getNode(e){const t=this.pageSize;return this._pages[a(e,t)].nodes[h(e,t)]}getRenderObb(e){const t=this.pageSize;return this._pages[a(e,t)].nodes[h(e,t)].obbInRenderSR}setRenderObb(e,t){const s=this.pageSize;this._pages[a(e,s)].nodes[h(e,s)].obbInRenderSR.copy(t)}getParentId(e){const t=this.pageSize;return this._pages[a(e,t)].parents[h(e,t)]}hasNodes(e,t){const s=a(e,this.pageSize),n=a(e+t-1,this.pageSize);for(let i=s;i<=n;i++)if(null==this._pages[i])return!1;return!0}forEachNodeId(e){for(let t=0;t<this._pages.length;t++){const s=this._pages[t];if(s)for(let n=0;n<s.nodes.length;n++)e(t*this.pageSize+n)}}createVisibilityTraverse(){const e={index:this,queue:[],masks:[],tempAabb:t()};return(t,s)=>o(e,t,s)}}function o(e,t,i){const o=e.index;if(!o.hasNodes(0,1))return;const r=e.queue;r.length=0,r.push(0);const p=e.masks;for(p.length=0,p.push(0);r.length>0;){const h=r.pop();let g=p.pop();const l=o.getNode(h),c=o.getRenderObb(h);let u=!0;if(null!=t.clippingBox){const i=1<<t.frustum.length;g&i
|
|
5
|
+
import{getSphericalPCPF as e}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{create as t,contains as s,intersects as n}from"../../../../geometry/support/aaBoundingBox.js";class i{constructor(t,s,n){this._pages=[],this.pageSize=0,this._nodeSR=t,this._renderSR=s,this._renderSRSphericalPCPF=e(s),this.pageSize=n}addPage(e,t,s=0){for(;this._pages.length<e;)this._pages.push(null);r(t,this._nodeSR,this._renderSR,s,this._renderSRSphericalPCPF),this._pages[e]={nodes:t,parents:new Uint32Array(this.pageSize)},p(this._pages,this.pageSize)}hasPage(e){return!!this._pages[e]}getNode(e){const t=this.pageSize;return this._pages[a(e,t)].nodes[h(e,t)]}getRenderObb(e){const t=this.pageSize;return this._pages[a(e,t)].nodes[h(e,t)].obbInRenderSR}setRenderObb(e,t){const s=this.pageSize;this._pages[a(e,s)].nodes[h(e,s)].obbInRenderSR.copy(t)}getParentId(e){const t=this.pageSize;return this._pages[a(e,t)].parents[h(e,t)]}hasNodes(e,t){const s=a(e,this.pageSize),n=a(e+t-1,this.pageSize);for(let i=s;i<=n;i++)if(null==this._pages[i])return!1;return!0}forEachNodeId(e){for(let t=0;t<this._pages.length;t++){const s=this._pages[t];if(s)for(let n=0;n<s.nodes.length;n++)e(t*this.pageSize+n)}}createVisibilityTraverse(){const e={index:this,queue:[],masks:[],tempAabb:t()};return(t,s)=>o(e,t,s)}}function o(e,t,i){const o=e.index;if(!o.hasNodes(0,1))return;const r=e.queue;r.length=0,r.push(0);const p=e.masks;for(p.length=0,p.push(0);r.length>0;){const h=r.pop();let g=p.pop();const l=o.getNode(h),c=o.getRenderObb(h);let u=!0;if(null!=t.clippingBox){const i=1<<t.frustum.length;0===(g&i)&&(c.toAaBoundingBox(e.tempAabb),s(t.clippingBox,e.tempAabb)?g|=i:n(t.clippingBox,e.tempAabb)||(u=!1))}for(let e=0;e<t.frustum.length&&u;e++){const s=1<<e;if(0===(g&s)){const n=c.intersectPlane(t.frustum[e]);n>0?u=!1:n<0&&(g|=s)}}if(i.predicate(h,l,u)){const e=l.firstChild,t=l.childCount;let s=!1;const n=a(e,o.pageSize),c=a(e+t-1,o.pageSize);for(let r=n;r<=c;r++)if(!o.hasPage(r)){i.pageMiss(h,r),s=!0;break}if(!s)for(let i=0;i<t;i++)r.push(e+i),p.push(g)}}}function r(e,t,s,n,i){for(let o=0;o<e.length;o++){const r=e[o];r.obb.transform(r.obbInRenderSR,t,s,n,i)}}function p(e,t){const s=[0];for(;s.length;){const n=s.pop(),i=e[a(n,t)].nodes[h(n,t)];for(let o=0;o<i.childCount;o++){const r=i.firstChild+o;null!=e[a(r,t)]&&(e[a(r,t)].parents[h(r,t)]=n,s.push(r))}}}function a(e,t){return e/t|0}function h(e,t){return e%t}export{i as PagedNodeIndex};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import e from"../../../../renderers/PointCloudClassBreaksRenderer.js";import r from"../../../../renderers/PointCloudStretchRenderer.js";import o from"../../../../renderers/PointCloudUniqueValueRenderer.js";import{createGeometryIndexFromSchema as t,createTypedView as n,readBinaryAttribute as l}from"./I3SBinaryReader.js";import{decodeXYZ as s}from"./LEPCC.js";function i(t,n,l,s){const{rendererJSON:i,isRGBRenderer:u}=t;let c=null,a=null;if(n&&u)c=n;else if(n&&"pointCloudUniqueValueRenderer"===i?.type){a=o.fromJSON(i);const e=a.colorUniqueValueInfos;c=new Uint8Array(3*s);const r=d(a.fieldTransformType);for(let o=0;o<s;o++){const t=(r?r(n[o]):n[o])+"";for(let r=0;r<e.length;r++)if(e[r].values.includes(t)){c[3*o]=e[r].color.r,c[3*o+1]=e[r].color.g,c[3*o+2]=e[r].color.b;break}}}else if(n&&"pointCloudStretchRenderer"===i?.type){a=r.fromJSON(i);const e=a.stops;c=new Uint8Array(3*s);const o=d(a.fieldTransformType);for(let r=0;r<s;r++){const t=o?o(n[r]):n[r],l=e.length-1;if(t<e[0].value)c[3*r]=e[0].color.r,c[3*r+1]=e[0].color.g,c[3*r+2]=e[0].color.b;else if(t>=e[l].value)c[3*r]=e[l].color.r,c[3*r+1]=e[l].color.g,c[3*r+2]=e[l].color.b;else for(let o=1;o<e.length;o++)if(t<e[o].value){const n=(t-e[o-1].value)/(e[o].value-e[o-1].value);c[3*r]=e[o].color.r*n+e[o-1].color.r*(1-n),c[3*r+1]=e[o].color.g*n+e[o-1].color.g*(1-n),c[3*r+2]=e[o].color.b*n+e[o-1].color.b*(1-n);break}}}else if(n&&"pointCloudClassBreaksRenderer"===i?.type){a=e.fromJSON(i);const r=a.colorClassBreakInfos;c=new Uint8Array(3*s);const o=d(a.fieldTransformType);for(let e=0;e<s;e++){const t=o?o(n[e]):n[e];for(let o=0;o<r.length;o++)if(t>=r[o].minValue&&t<=r[o].maxValue){c[3*e]=r[o].color.r,c[3*e+1]=r[o].color.g,c[3*e+2]=r[o].color.b;break}}}else c=new Uint8Array(3*s).fill(255);if(l&&a?.colorModulation){const e=a.colorModulation.minValue,r=a.colorModulation.maxValue,o=.3;for(let t=0;t<s;t++){const n=l[t],s=n>=r?1:n<=e?o:o+(1-o)*(n-e)/(r-e);c[3*t]=s*c[3*t],c[3*t+1]=s*c[3*t+1],c[3*t+2]=s*c[3*t+2]}}return c}function u(e,r){if(null==e.encoding||""===e.encoding){const o=t(r,e);if(null==o.vertexAttributes.position)return;const l=n(r,o.vertexAttributes.position),s=o.header.fields,i=[s.offsetX,s.offsetY,s.offsetZ],u=[s.scaleX,s.scaleY,s.scaleZ],c=l.length/3,a=new Float64Array(3*c);for(let e=0;e<c;e++)a[3*e]=l[3*e]*u[0]+i[0],a[3*e+1]=l[3*e+1]*u[1]+i[1],a[3*e+2]=l[3*e+2]*u[2]+i[2];return a}if("lepcc-xyz"===e.encoding)return s(r).result}function c(e,r,o){return e?.attributeInfo.useElevation?r?a(r,o):null:e?.attributeInfo.storageInfo?l(e.attributeInfo.storageInfo,e.buffer,o,!0):null}function a(e,r){const o=new Float64Array(r);for(let t=0;t<r;t++)o[t]=e[3*t+2];return o}function f(e,r,o,t,n){const l=e.length/3;let s=0;for(let i=0;i<l;i++){let l=!0;for(let e=0;e<t.length&&l;e++){const{filterJSON:r}=t[e],o=n[e].values[i];switch(r.type){case"pointCloudValueFilter":{const e="exclude"===r.mode;r.values.includes(o)===e&&(l=!1);break}case"pointCloudBitfieldFilter":{const e=p(r.requiredSetBits),t=p(r.requiredClearBits);(
|
|
5
|
+
import"../../../../core/has.js";import e from"../../../../renderers/PointCloudClassBreaksRenderer.js";import r from"../../../../renderers/PointCloudStretchRenderer.js";import o from"../../../../renderers/PointCloudUniqueValueRenderer.js";import{createGeometryIndexFromSchema as t,createTypedView as n,readBinaryAttribute as l}from"./I3SBinaryReader.js";import{decodeXYZ as s}from"./LEPCC.js";function i(t,n,l,s){const{rendererJSON:i,isRGBRenderer:u}=t;let c=null,a=null;if(n&&u)c=n;else if(n&&"pointCloudUniqueValueRenderer"===i?.type){a=o.fromJSON(i);const e=a.colorUniqueValueInfos;c=new Uint8Array(3*s);const r=d(a.fieldTransformType);for(let o=0;o<s;o++){const t=(r?r(n[o]):n[o])+"";for(let r=0;r<e.length;r++)if(e[r].values.includes(t)){c[3*o]=e[r].color.r,c[3*o+1]=e[r].color.g,c[3*o+2]=e[r].color.b;break}}}else if(n&&"pointCloudStretchRenderer"===i?.type){a=r.fromJSON(i);const e=a.stops;c=new Uint8Array(3*s);const o=d(a.fieldTransformType);for(let r=0;r<s;r++){const t=o?o(n[r]):n[r],l=e.length-1;if(t<e[0].value)c[3*r]=e[0].color.r,c[3*r+1]=e[0].color.g,c[3*r+2]=e[0].color.b;else if(t>=e[l].value)c[3*r]=e[l].color.r,c[3*r+1]=e[l].color.g,c[3*r+2]=e[l].color.b;else for(let o=1;o<e.length;o++)if(t<e[o].value){const n=(t-e[o-1].value)/(e[o].value-e[o-1].value);c[3*r]=e[o].color.r*n+e[o-1].color.r*(1-n),c[3*r+1]=e[o].color.g*n+e[o-1].color.g*(1-n),c[3*r+2]=e[o].color.b*n+e[o-1].color.b*(1-n);break}}}else if(n&&"pointCloudClassBreaksRenderer"===i?.type){a=e.fromJSON(i);const r=a.colorClassBreakInfos;c=new Uint8Array(3*s);const o=d(a.fieldTransformType);for(let e=0;e<s;e++){const t=o?o(n[e]):n[e];for(let o=0;o<r.length;o++)if(t>=r[o].minValue&&t<=r[o].maxValue){c[3*e]=r[o].color.r,c[3*e+1]=r[o].color.g,c[3*e+2]=r[o].color.b;break}}}else c=new Uint8Array(3*s).fill(255);if(l&&a?.colorModulation){const e=a.colorModulation.minValue,r=a.colorModulation.maxValue,o=.3;for(let t=0;t<s;t++){const n=l[t],s=n>=r?1:n<=e?o:o+(1-o)*(n-e)/(r-e);c[3*t]=s*c[3*t],c[3*t+1]=s*c[3*t+1],c[3*t+2]=s*c[3*t+2]}}return c}function u(e,r){if(null==e.encoding||""===e.encoding){const o=t(r,e);if(null==o.vertexAttributes.position)return;const l=n(r,o.vertexAttributes.position),s=o.header.fields,i=[s.offsetX,s.offsetY,s.offsetZ],u=[s.scaleX,s.scaleY,s.scaleZ],c=l.length/3,a=new Float64Array(3*c);for(let e=0;e<c;e++)a[3*e]=l[3*e]*u[0]+i[0],a[3*e+1]=l[3*e+1]*u[1]+i[1],a[3*e+2]=l[3*e+2]*u[2]+i[2];return a}if("lepcc-xyz"===e.encoding)return s(r).result}function c(e,r,o){return e?.attributeInfo.useElevation?r?a(r,o):null:e?.attributeInfo.storageInfo?l(e.attributeInfo.storageInfo,e.buffer,o,!0):null}function a(e,r){const o=new Float64Array(r);for(let t=0;t<r;t++)o[t]=e[3*t+2];return o}function f(e,r,o,t,n){const l=e.length/3;let s=0;for(let i=0;i<l;i++){let l=!0;for(let e=0;e<t.length&&l;e++){const{filterJSON:r}=t[e],o=n[e].values[i];switch(r.type){case"pointCloudValueFilter":{const e="exclude"===r.mode;r.values.includes(o)===e&&(l=!1);break}case"pointCloudBitfieldFilter":{const e=p(r.requiredSetBits),t=p(r.requiredClearBits);(o&e)===e&&0===(o&t)||(l=!1);break}case"pointCloudReturnFilter":{const e=15&o,t=o>>>4&15,n=t>1,s=1===e,i=e===t;let u=!1;for(const o of r.includedReturns)if("last"===o&&i||"firstOfMany"===o&&s&&n||"lastOfMany"===o&&i&&n||"single"===o&&!n){u=!0;break}u||(l=!1);break}}}l&&(o[s]=i,e[3*s]=e[3*i],e[3*s+1]=e[3*i+1],e[3*s+2]=e[3*i+2],r[3*s]=r[3*i],r[3*s+1]=r[3*i+1],r[3*s+2]=r[3*i+2],s++)}return s}function d(e){switch(e){default:case null:case"none":return e=>e;case"low-four-bit":return e=>15&e;case"high-four-bit":return e=>(240&e)>>4;case"absolute-value":return e=>Math.abs(e);case"modulo-ten":return e=>e%10}}function p(e){let r=0;for(const o of e||[])r|=1<<o;return r}export{a as elevationFromPositions,i as evaluateRenderer,f as filterInPlace,c as getAttributeValues,u as readGeometry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{filterInPlace as s}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import o from"../../../../core/ReactiveMap.js";import{on as u,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as h}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as c}from"../../../../core/sql.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{getEpsilon as _}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as m,equals as g,clone as F,expand as y,toExtent as T,width as x,height as R}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as v,hasVertices as b,computeAABR as C}from"../../../../layers/graphics/dehydratedFeatures.js";import E from"../../../../rest/support/QuantizationParameters.js";import M from"../../../../rest/support/Query.js";import{ViewingMode as D}from"../../../ViewingMode.js";import{MultiFeatureReference as w,SingleFeatureReference as U}from"./featureReference.js";import{failedFeatureCount as j,FeatureTile as O,ReduceMode as A}from"./FeatureTile.js";import{tilesAreRelated as P}from"../../terrain/tileUtils.js";import{ImmediateTask as I,TaskPriority as z}from"../../../support/Scheduler.js";let q=class extends t{set maximumNumberOfFeatures(e){e=e||1/0;const t=this._get("maximumNumberOfFeatures");e===t||e<1||(this._set("maximumNumberOfFeatures",e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set("memoryFactor",e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set("lodFactor",e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&null!=this.context.query.queryFeatureCount}set useTileCount(e){this._useTileCount=e,this.notifyChange("useTileCount")}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get running(){return this._dirty}get memoryForUnusedFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.estimatedUnusedSize)),e}get totalVertices(){let e=0;return this._featureTiles.forEach((t=>e+=t.numVertices)),e}get totalFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.numFeatures)),e}get hasAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(const e of this._featureTiles.values())if(!this.hasFullGeometries&&0!==e.emptyFeatureRatio||!e.hasAllFeatures)return!1;return!0}get hasFullGeometries(){if(!this._supportsResolution)return!0;return this.tileDescriptors.some(Q)||!this.context.capabilities.supportsQuantization&&"polyline"!==this.context.geometryType}set filterExtent(e){if(null!=e&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void i.getLogger(this).error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||null!=t&&e&&t.equals(e))return;const s=null!=e?e.clone():null;this._set("filterExtent",s),this._reclip(s,t)}_updateTileZQuantization(e){if(this.context.viewingMode===D.Global){const t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:new Array,removes:new Array},adds:new Array,removes:new Array},this._featureTiles=new o,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this._isFetching=!1;const t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??I,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?w:U,this._objectIdField=t.objectIdField}initialize(){this.addHandles([u((()=>this.tileDescriptors),"change",(()=>this._setDirty())),l((()=>this._tileZQuantization),(()=>this.refetch()))]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._removeTile(e)})),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)})),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._resetFetchTile(e)})),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(const t of this._featureTiles.values()){const s=t.missingAttributes?.get(e);if(null!=s)return s}}_pause(){this._paused&&(this._featureTiles.forEach((e=>this._cancelFetchTile(e))),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach((t=>{null!=t.displayingFeatures&&0!==t.displayingFeatures.length&&(null==e?e=new Set(t.availableFields):e.forEach((s=>{t.availableFields?.has(s)||e.delete(s)})))})),null!=e?e:new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());const t=this._pendingEdits;t.count++;const s=t.edits.then((()=>e.result.catch((e=>{if(a(e))throw e;return null})).then((e=>e?(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then((()=>e))):e)).then((e=>(0==--t.count&&(this._pendingEdits===t&&(this._pendingEdits=null),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)))));return t.edits=s,this._updated(),s}_applyEditsDeleteFeatures(e){if(0===e.length)return;const t=this.context.globalIdField,s=t&&this.availableFields.has(t),r=new Set,a=this._objectIdField;e.forEach((({objectId:e,globalId:n})=>{(!e||e<0)&&t&&n&&(s||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(n,a,t)),null!=e&&e>=0&&r.add(e)})),this._featureTiles.forEach((e=>{if(!e.features)return;const t=e.features.filter((e=>!r.has(v(e,this._objectIdField))));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())}))}_objectIdFromGlobalId(e,t,s){if(null==e)return null;const i=this.features.find((t=>t.attributes?.[s]===e));return i?v(i,t):null}async _applyEditsAddUpdateFeatures(e,t,s){const{objectIdField:r,globalIdField:a}=this.context,n=a&&this.availableFields.has(a),o=new Set,u=new Set;for(const i of e){const e=i.objectId;null!=e&&o.add(e)}for(const{objectId:h,globalId:d}of t){let e=h;(null==e||e<0)&&a&&(n||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(d,r,a)),null!=e&&e>=0&&(o.add(e),u.add(e))}if(0===o.size)return;const l=[];this._featureTiles.forEach((e=>{const t=this._applyEditsAddUpdateTile(e,o,u,s);t&&l.push(t)})),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,s,i){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;const r=this._createQuery(e);r.resultType=void 0,r.cacheHint=!1,r.objectIds=Array.from(t);const a=await this._queryFeatures(r,i);let n=null;if(s.size>0){const t=e.features.filter((e=>!s.has(v(e,this._objectIdField))));t.length!==e.features.length&&(n=t)}if(a.features.length>0){n||(n=e.features.slice());for(const e of a.features)n.push(e)}n&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,n.length)),this._applyEditsTileUpdated(),e.setFeatures(n,0,k(e.availableFields,a.fields),H(e.missingAttributes,a.missingAttributes)),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:X})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){const t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;const s=this._getListOfTiles();if(this._markTilesNotAlive(s),!e.run((()=>this._addTiles(s,e)))||!e.run((()=>this._filterExtentTiles(s,e)))||!e.run((()=>this._removeTiles(s,e)))||e.done)return void this._setDirty();const i=this._sortTiles(s);e.run((()=>this._showTiles(i,e)))&&e.run((()=>this._fetchTiles(i,e)))&&e.run((()=>this._updateMemoryEstimates(i,e)))||this._setDirty(),this._updated(),this.updating||this._updateMaximumNumberOfFeaturesExceeded()}_markTilesNotAlive(e){for(const t of e)t.alive=!1}_addTiles(e,t){return!(this._suspended||!this.tileDescriptors)&&(this.tileDescriptors.forEach((s=>{const i=this._featureTiles.get(s.id);i?i.alive=!0:t.done||(e.push(this._addTile(s)),t.madeProgress())})),t.hasProgressed)}_filterExtentTiles(e,t){for(const s of e){if(t.done)break;s.alive&&(s.filtered=!s.intersects(this.filterExtent),s.filtered&&(this._clearTile(s),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let s=e.length-1;s>=0&&!t.done;s--){const i=e[s];i.alive||(this._removeTile(i),s!==e.length-1&&(e[s]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort(((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority)),e}_showTiles(e,t){const s=this._updateRatio(e),i=e=>{const t=this._fullRatio<1?s(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();const{numFeatures:i,fetchingResolution:r,descriptor:a,isFetched:n}=e;return this._supportsResolution&&i>0&&r!==a.resolution&&n&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(const r of e)if(!t.run((()=>i(r)))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let s=!1;for(const i of e){if(!i.needsFetch)continue;const e=null!=this.context.memoryCache?this.context.memoryCache.pop(i.id):null;if(e?.resolution!==i.displayingResolution){if(this._needsNumFeatures(i)){const e=new AbortController,r=this._fetchTileCount(i,e.signal);this._handleRequest(i,r,e,(()=>i.resetFetching()),(()=>i.numFeatures=j)),s=!0,t.madeProgress()}if(t.done)return!0}else i.cache=e,i.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress()}if(s)return t.hasProgressed;for(const r of e){if(!r.needsFetch)continue;const e=new AbortController,s=this._fetchTile(r,e.signal);if(this._handleRequest(r,s,e,(e=>r.fetchDone(e)),(e=>{r.featuresMissing=!0,r.fetchFailed=!0,this.context.logFetchError(i.getLogger(this),e)})),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some((e=>!t.run((()=>e.updateMemoryEstimates()))&&(this._setDirty(),!0))),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;const s=new Array;this._featureTiles.forEach((i=>{null!=i.displayingFeatures&&0!==i.displayingFeatures.length&&(i.intersectionIncludingBorrowed(t,V),i.intersectionIncludingBorrowed(e,G),g(V,G)||s.push(i))})),this._refreshDisplayingFeatures(s),this._updated()}_refreshDisplayingFeatures(e){const t=new Set,s=this._changes.updates;for(const i of e)if(null!=i.displayingFeatures)for(const e of i.displayingFeatures){const i=v(e,this._objectIdField);if(t.has(i))continue;t.add(i);const r=this._displayingFeatureReferences.get(i).feature;s.removes.push(r),s.adds.push(r)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach((t=>t.isFetching?++e:0)),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set("dataUpdating",!1),this.updating){let t=0,s=0,i=0,r=0,a=0;const n=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach((e=>{if(++s,e.isFetching&&e.hasPreciseFeatureCount){const t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),s=null!=e.displayingFeatures?e.displayingFeatures.length*n:0;a+=t-s}e.needsFetch?++r:e.numFeatures>0&&(++i,t+=e.numFeatures)})),r+=e;let o=0,u=0;t?(u=t,o=Math.min(r*t/i,t)):(u=s,o=r),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set("updatingTotal",u),this._set("updatingRemaining",o),this._set("expectedFeatureDiff",a)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(const{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e)return void this._set("maximumNumberOfFeaturesExceeded",!0);this._set("maximumNumberOfFeaturesExceeded",!1)}_updateRatio(e){const t=N(e),s=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0]));let i=0,r=0;for(const a of e){const e=a.numFeatures;i+=e,r+=e*s(a)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/i),this._farRatio=this.maximumNumberOfFeatures/r,this._scheduleUpdated(),s}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach((e=>{if(!e.featuresMissing)return;const t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))})),this._setDirty())}_addTile(e){const t=new O(e);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.displayingResolution;this._featureTiles.forEach((s=>{if(null!=s.displayingFeatures&&e!==s&&P(e.descriptor.lij,s.descriptor.lij)){null==e.displayingFeatures&&(e.displayingFeatures=[]),e.descriptor.extent&&s.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=F(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,s.descriptor.extent,e.extentIncludingBorrowedFeatures));for(const i of s.displayingFeatures){e.displayingFeatures.push(i);const s=this._displayingFeatureReferences.get(v(i,this._objectIdField));s.ref(s.feature,t),this._numDisplayingFeatureReferences++}}})),e.featureLimit=null!=e.displayingFeatures?e.displayingFeatures.length:0}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(!1):e.requestFetch()}_cancelFetchTile(e){const t=e.requestController;null!=t&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._getListOfTiles())}async _fetchTile(e,t){e.fetchFailed=!1;const s=this._maximumFeaturesForTile(e);if(s<=0)return e.hasPreciseFeatureCount&&0===e.numFeatures||(e.fetchFailed=!0),S(e),!1;const i=this._getMaxRecordCount(e),r=Math.ceil(s/i);if(e.fetchingResolution=e.descriptor.resolution,Q(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=s&&r>M.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const a=this._createQuery(e);if(a.maxRecordCountFactor=r,e.isRefetching&&e.features&&e.features.length>0){const t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/i);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}const{features:o,exceededTransferLimit:u,fields:l,missingAttributes:h}=await this._queryFeatures(a,t),d=!u||a.maxRecordCountFactor>=M.MAX_MAX_RECORD_COUNT_FACTOR;return await this._frameTask.schedule((()=>{e.featuresMissing=e.hasPreciseFeatureCount&&o.length<e.numFeatures||!!u;const t=this._removeEmptyFeatures(o,this._getEffectiveTileResolution(e));e.setFeatures(o,t,L(l),H(void 0,h)),this._updateTileZQuantization(e)}),t),n(t),this._invalidateCounts(),d}async _fetchCount(e,t){return this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t})}async _fetchPagedTile(e,t){let s,i=0,r=0,a=0,o=this._maximumFeaturesForTile(e)-a;const u=this._getMaxRecordCount(e);let l,h=null;for(;;){const d=this._createQuery(e),c=this._setPagingParameters(d,i,o,u),{features:p,exceededTransferLimit:f,fields:_,missingAttributes:m}=await this._queryFeatures(d,t);if(await this._frameTask.schedule((()=>{c&&(i+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.featuresMissing=c&&e.hasPreciseFeatureCount&&i<e.numFeatures||!!f,s=s?.concat(p)??p,h=k(h,_),l=H(l,m),e.setFeatures(s,r,h,l),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()}),t),n(t),o=this._maximumFeaturesForTile(e)-a,!c||!f||o<=0)return!f}}_createFeatureCountQuery(e){const t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){const t=this.context.createQuery();t.resultType=this._resultType(e);const s=Q(e);return s||(t.geometry=T(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),"tile"!==t.resultType&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),!s&&this.context.effectiveDisplayFilter&&(t.where=c(t.where,this.context.effectiveDisplayFilter.where)),t}_setPagingParameters(e,t,s,i){return!!this.context.capabilities.supportsPagination&&(e.start=t,s>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(s/i),e.num=Math.min(e.maxRecordCountFactor*i,s)):e.num=Math.min(i),!0)}_getEffectiveTileResolution(e){if(Q(e)||!this._supportsResolution)return null;const t=this.context.viewingMode===D.Global?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&"point"!==this.context.geometryType}_setResolutionParams(e,t){const s=this._getEffectiveTileResolution(t);null!=s&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new E({mode:"view",originPosition:"upper-left",tolerance:s,extent:this.context.fullExtent}):"polyline"===this.context.geometryType&&(e.maxAllowableOffset=s))}_removeEmptyFeatures(e,t){const i=e.length;if(t&&this._supportsResolution){const i=t*(1+_());s(e,(({geometry:e})=>!(!e||!b(e))&&(C(e,B),x(B)>i||R(B)>i)))}else s(e,(({geometry:e})=>b(e)));return i-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!Q(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case"tile":if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case"standard":if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Z}_resultType(e){if(this.context.capabilities.supportsResultType)return Q(e)?"standard":"tile"}get _reduceMode(){const e=this.context.geometryType;return"polygon"===e||"polyline"===e?A.SIZE:A.RANDOM}_handleRequest(e,t,s,i,r){e.startFetch(),e.requestController=s;let n=!1;t.then((t=>{e.requestController=null,i(t)})).catch((t=>{e.requestController===s&&(e.requestController=null,e.fetchDone(!1)),a(t)?n=!0:r(t)})).then((()=>{n||this._setDirty(),this._scheduleUpdated()}))}_scheduleUpdated(){this.hasHandles("scheduleUpdated")||this.addHandles(h((()=>{this.removeHandles("scheduleUpdated"),this._updated()})),"scheduleUpdated")}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;const{features:t}=e;if(0===e.featureLimit||!t){const t=null!=e.displayingFeatures&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}const s=e.fetchingResolution,{adds:i,updates:r}=this._changes,a=Math.min(e.featureLimit,t.length);e.featureLimit=a;for(let n=0;n<a;++n){const e=t[n],a=v(e,this._objectIdField),o=this._displayingFeatureReferences.get(a);if(o){const{oldVersion:t,newVersion:i}=o.ref(e,s);t!==i&&(t&&r.removes.push(t),i&&r.adds.push(i))}else this._displayingFeatureReferences.set(a,new this.FeatureReferenceClass(e,s)),i.push(e);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(null==e.displayingFeatures)return;const{updates:t,removes:s}=this._changes;for(const i of e.displayingFeatures){const r=v(i,this._objectIdField),a=this._displayingFeatureReferences.get(r);if(!a)continue;const{oldVersion:n,newVersion:o}=a.unref(e.displayingResolution);this._numDisplayingFeatureReferences--,n!==o&&(null==o?(this._displayingFeatureReferences.delete(r),n&&s.push(n)):(t.adds.push(o),n&&t.removes.push(n)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get("dataUpdating")||this._set("dataUpdating",!0)}_applyChanges(){const e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);const t=this._changes.adds,s=this._changes.removes,i=Math.min(t.length,s.length);let r=0;for(;r<i;){const e=Math.min(r+$,i);this._notifyDataUpdating(),this.features.addMany(t.slice(r,e)),this.features.removeMany(s.slice(r,e)),r=e}t.length>i&&(this._notifyDataUpdating(),this.features.addMany(0===r?t:t.slice(r))),s.length>i&&(this._notifyDataUpdating(),this.features.removeMany(0===r?s:s.slice(r))),t.length=0,s.length=0}_clearTile(e){this._hideTile(e),e.features&&null!=this.context.memoryCache&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}_getListOfTiles(){return Array.from(this._featureTiles.values())}get storedFeatures(){return this._getListOfTiles().reduce(((e,t)=>e+(t.features?t.features.length:0)),0)}get missingTiles(){return Array.from(this._featureTiles.values()).reduce(((e,t)=>e+(t.needsFetch||t.isFetching?1:0)),0)}_maximumFeaturesForTile(e){const t=e.hasPreciseFeatureCount?e.numFeatures:1/0,s=e.hasPreciseFeatureCount?t:this.maximumNumberOfFeatures,i=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(s*i/(1-e.emptyFeatureRatio)),t)}get test(){}};function Q(e){return"dummy-tile-full-extent"===e.id}function N(e){let t=0;for(const s of e)s.features&&s.features.length>0&&s.alive&&(t=Math.max(t,s.descriptor.lij[0]));return t}function S(e){e.setFeatures([],0,null,void 0),e.featuresMissing=!1}function L(e){return null==e?new Set:new Set(e.map((e=>e.name)))}function k(e,t){if(null==e||null==t)return L(t);const s=new Set;for(const{name:i}of t)e.has(i)&&s.add(i);return s}function H(e,t){if(!t?.length)return e;e??=new Map;const s=()=>new Set;for(const{objectId:i,attribute:a}of t)r(e,i,s).add(a);return e}e([p({constructOnly:!0})],q.prototype,"features",void 0),e([p()],q.prototype,"tileDescriptors",void 0),e([p({value:1/0})],q.prototype,"maximumNumberOfFeatures",null),e([p({value:1})],q.prototype,"memoryFactor",null),e([p({value:1})],q.prototype,"lodFactor",null),e([p()],q.prototype,"useTileCount",null),e([p({readOnly:!0})],q.prototype,"updating",null),e([p({readOnly:!0})],q.prototype,"dataUpdating",void 0),e([p({readOnly:!0})],q.prototype,"updatingTotal",void 0),e([p({readOnly:!0})],q.prototype,"updatingRemaining",void 0),e([p({readOnly:!0})],q.prototype,"expectedFeatureDiff",void 0),e([p({readOnly:!0})],q.prototype,"memoryForUnusedFeatures",null),e([p({readOnly:!0})],q.prototype,"maximumNumberOfFeaturesExceeded",void 0),e([p({readOnly:!0})],q.prototype,"totalVertices",null),e([p({readOnly:!0})],q.prototype,"totalFeatures",null),e([p({readOnly:!0})],q.prototype,"hasAllFeatures",null),e([p({readOnly:!0})],q.prototype,"hasFullGeometries",null),e([p()],q.prototype,"filterExtent",null),e([p({constructOnly:!0})],q.prototype,"context",void 0),e([p()],q.prototype,"_dirty",void 0),e([p()],q.prototype,"_suspended",void 0),e([p()],q.prototype,"_pendingEdits",void 0),e([p()],q.prototype,"_applyEditsTilesUpdated",void 0),e([p()],q.prototype,"_paused",null),e([p()],q.prototype,"_isFetching",void 0),q=e([f("esri.views.3d.layers.support.FeatureTileFetcher3D")],q);const Z=2e3,V=m(),G=m(),B=m(),X=6e5,$=200;export{q as FeatureTileFetcher3D};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{filterInPlace as s}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import o from"../../../../core/ReactiveMap.js";import{on as u,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as h}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as c}from"../../../../core/sql.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{getEpsilon as _}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as m,equals as g,clone as F,expand as y,toExtent as T,width as x,height as R}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as v,hasVertices as b,computeAABR as C}from"../../../../layers/graphics/dehydratedFeatures.js";import E from"../../../../rest/support/QuantizationParameters.js";import M from"../../../../rest/support/Query.js";import{ViewingMode as D}from"../../../ViewingMode.js";import{MultiFeatureReference as w,SingleFeatureReference as U}from"./featureReference.js";import{failedFeatureCount as j,FeatureTile as O,ReduceMode as A}from"./FeatureTile.js";import{tilesAreRelated as P}from"../../terrain/tileUtils.js";import{ImmediateTask as I,TaskPriority as z}from"../../../support/Scheduler.js";let q=class extends t{set maximumNumberOfFeatures(e){e=e||1/0;const t=this._get("maximumNumberOfFeatures");e===t||e<1||(this._set("maximumNumberOfFeatures",e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set("memoryFactor",e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set("lodFactor",e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&null!=this.context.query.queryFeatureCount}set useTileCount(e){this._useTileCount=e,this.notifyChange("useTileCount")}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get running(){return this._dirty}get memoryForUnusedFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.estimatedUnusedSize)),e}get totalVertices(){let e=0;return this._featureTiles.forEach((t=>e+=t.numVertices)),e}get totalFeatures(){let e=0;return this._featureTiles.forEach((t=>e+=t.numFeatures)),e}get hasAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(const e of this._featureTiles.values())if(!this.hasFullGeometries&&0!==e.emptyFeatureRatio||!e.hasAllFeatures)return!1;return!0}get hasFullGeometries(){if(!this._supportsResolution)return!0;return this.tileDescriptors.some(Q)||!this.context.capabilities.supportsQuantization&&"polyline"!==this.context.geometryType}set filterExtent(e){if(null!=e&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void i.getLogger(this).error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||null!=t&&e&&t.equals(e))return;const s=null!=e?e.clone():null;this._set("filterExtent",s),this._reclip(s,t)}_updateTileZQuantization(e){if(this.context.viewingMode===D.Global){const t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:new Array,removes:new Array},adds:new Array,removes:new Array},this._featureTiles=new o,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this._isFetching=!1;const t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??I,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?w:U,this._objectIdField=t.objectIdField}initialize(){this.addHandles([u((()=>this.tileDescriptors),"change",(()=>this._setDirty())),l((()=>this._tileZQuantization),(()=>this.refetch()))]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._removeTile(e)})),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)})),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach((e=>{this._cancelFetchTile(e),this._resetFetchTile(e)})),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(const t of this._featureTiles.values()){const s=t.missingAttributes?.get(e);if(null!=s)return s}}_pause(){this._paused&&(this._featureTiles.forEach((e=>this._cancelFetchTile(e))),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach((t=>{null!=t.displayingFeatures&&0!==t.displayingFeatures.length&&(null==e?e=new Set(t.availableFields):e.forEach((s=>{t.availableFields?.has(s)||e.delete(s)})))})),null!=e?e:new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());const t=this._pendingEdits;t.count++;const s=t.edits.then((()=>e.result.catch((e=>{if(a(e))throw e;return null})).then((e=>e?(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then((()=>e))):e)).then((e=>(0===--t.count&&(this._pendingEdits===t&&(this._pendingEdits=null),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)))));return t.edits=s,this._updated(),s}_applyEditsDeleteFeatures(e){if(0===e.length)return;const t=this.context.globalIdField,s=t&&this.availableFields.has(t),r=new Set,a=this._objectIdField;e.forEach((({objectId:e,globalId:n})=>{(!e||e<0)&&t&&n&&(s||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(n,a,t)),null!=e&&e>=0&&r.add(e)})),this._featureTiles.forEach((e=>{if(!e.features)return;const t=e.features.filter((e=>!r.has(v(e,this._objectIdField))));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())}))}_objectIdFromGlobalId(e,t,s){if(null==e)return null;const i=this.features.find((t=>t.attributes?.[s]===e));return i?v(i,t):null}async _applyEditsAddUpdateFeatures(e,t,s){const{objectIdField:r,globalIdField:a}=this.context,n=a&&this.availableFields.has(a),o=new Set,u=new Set;for(const i of e){const e=i.objectId;null!=e&&o.add(e)}for(const{objectId:h,globalId:d}of t){let e=h;(null==e||e<0)&&a&&(n||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(d,r,a)),null!=e&&e>=0&&(o.add(e),u.add(e))}if(0===o.size)return;const l=[];this._featureTiles.forEach((e=>{const t=this._applyEditsAddUpdateTile(e,o,u,s);t&&l.push(t)})),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,s,i){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;const r=this._createQuery(e);r.resultType=void 0,r.cacheHint=!1,r.objectIds=Array.from(t);const a=await this._queryFeatures(r,i);let n=null;if(s.size>0){const t=e.features.filter((e=>!s.has(v(e,this._objectIdField))));t.length!==e.features.length&&(n=t)}if(a.features.length>0){n||(n=e.features.slice());for(const e of a.features)n.push(e)}n&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,n.length)),this._applyEditsTileUpdated(),e.setFeatures(n,0,k(e.availableFields,a.fields),H(e.missingAttributes,a.missingAttributes)),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:X})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){const t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;const s=this._getListOfTiles();if(this._markTilesNotAlive(s),!e.run((()=>this._addTiles(s,e)))||!e.run((()=>this._filterExtentTiles(s,e)))||!e.run((()=>this._removeTiles(s,e)))||e.done)return void this._setDirty();const i=this._sortTiles(s);e.run((()=>this._showTiles(i,e)))&&e.run((()=>this._fetchTiles(i,e)))&&e.run((()=>this._updateMemoryEstimates(i,e)))||this._setDirty(),this._updated(),this.updating||this._updateMaximumNumberOfFeaturesExceeded()}_markTilesNotAlive(e){for(const t of e)t.alive=!1}_addTiles(e,t){return!(this._suspended||!this.tileDescriptors)&&(this.tileDescriptors.forEach((s=>{const i=this._featureTiles.get(s.id);i?i.alive=!0:t.done||(e.push(this._addTile(s)),t.madeProgress())})),t.hasProgressed)}_filterExtentTiles(e,t){for(const s of e){if(t.done)break;s.alive&&(s.filtered=!s.intersects(this.filterExtent),s.filtered&&(this._clearTile(s),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let s=e.length-1;s>=0&&!t.done;s--){const i=e[s];i.alive||(this._removeTile(i),s!==e.length-1&&(e[s]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort(((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority)),e}_showTiles(e,t){const s=this._updateRatio(e),i=e=>{const t=this._fullRatio<1?s(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();const{numFeatures:i,fetchingResolution:r,descriptor:a,isFetched:n}=e;return this._supportsResolution&&i>0&&r!==a.resolution&&n&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(const r of e)if(!t.run((()=>i(r)))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let s=!1;for(const i of e){if(!i.needsFetch)continue;const e=null!=this.context.memoryCache?this.context.memoryCache.pop(i.id):null;if(e?.resolution!==i.displayingResolution){if(this._needsNumFeatures(i)){const e=new AbortController,r=this._fetchTileCount(i,e.signal);this._handleRequest(i,r,e,(()=>i.resetFetching()),(()=>i.numFeatures=j)),s=!0,t.madeProgress()}if(t.done)return!0}else i.cache=e,i.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress()}if(s)return t.hasProgressed;for(const r of e){if(!r.needsFetch)continue;const e=new AbortController,s=this._fetchTile(r,e.signal);if(this._handleRequest(r,s,e,(e=>r.fetchDone(e)),(e=>{r.featuresMissing=!0,r.fetchFailed=!0,this.context.logFetchError(i.getLogger(this),e)})),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some((e=>!t.run((()=>e.updateMemoryEstimates()))&&(this._setDirty(),!0))),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;const s=new Array;this._featureTiles.forEach((i=>{null!=i.displayingFeatures&&0!==i.displayingFeatures.length&&(i.intersectionIncludingBorrowed(t,V),i.intersectionIncludingBorrowed(e,G),g(V,G)||s.push(i))})),this._refreshDisplayingFeatures(s),this._updated()}_refreshDisplayingFeatures(e){const t=new Set,s=this._changes.updates;for(const i of e)if(null!=i.displayingFeatures)for(const e of i.displayingFeatures){const i=v(e,this._objectIdField);if(t.has(i))continue;t.add(i);const r=this._displayingFeatureReferences.get(i).feature;s.removes.push(r),s.adds.push(r)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach((t=>t.isFetching?++e:0)),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set("dataUpdating",!1),this.updating){let t=0,s=0,i=0,r=0,a=0;const n=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach((e=>{if(++s,e.isFetching&&e.hasPreciseFeatureCount){const t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),s=null!=e.displayingFeatures?e.displayingFeatures.length*n:0;a+=t-s}e.needsFetch?++r:e.numFeatures>0&&(++i,t+=e.numFeatures)})),r+=e;let o=0,u=0;t?(u=t,o=Math.min(r*t/i,t)):(u=s,o=r),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set("updatingTotal",u),this._set("updatingRemaining",o),this._set("expectedFeatureDiff",a)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(const{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e)return void this._set("maximumNumberOfFeaturesExceeded",!0);this._set("maximumNumberOfFeaturesExceeded",!1)}_updateRatio(e){const t=N(e),s=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0]));let i=0,r=0;for(const a of e){const e=a.numFeatures;i+=e,r+=e*s(a)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/i),this._farRatio=this.maximumNumberOfFeatures/r,this._scheduleUpdated(),s}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach((e=>{if(!e.featuresMissing)return;const t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))})),this._setDirty())}_addTile(e){const t=new O(e);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.displayingResolution;this._featureTiles.forEach((s=>{if(null!=s.displayingFeatures&&e!==s&&P(e.descriptor.lij,s.descriptor.lij)){null==e.displayingFeatures&&(e.displayingFeatures=[]),e.descriptor.extent&&s.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=F(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,s.descriptor.extent,e.extentIncludingBorrowedFeatures));for(const i of s.displayingFeatures){e.displayingFeatures.push(i);const s=this._displayingFeatureReferences.get(v(i,this._objectIdField));s.ref(s.feature,t),this._numDisplayingFeatureReferences++}}})),e.featureLimit=null!=e.displayingFeatures?e.displayingFeatures.length:0}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(!1):e.requestFetch()}_cancelFetchTile(e){const t=e.requestController;null!=t&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._getListOfTiles())}async _fetchTile(e,t){e.fetchFailed=!1;const s=this._maximumFeaturesForTile(e);if(s<=0)return e.hasPreciseFeatureCount&&0===e.numFeatures||(e.fetchFailed=!0),S(e),!1;const i=this._getMaxRecordCount(e),r=Math.ceil(s/i);if(e.fetchingResolution=e.descriptor.resolution,Q(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=s&&r>M.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const a=this._createQuery(e);if(a.maxRecordCountFactor=r,e.isRefetching&&e.features&&e.features.length>0){const t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/i);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}const{features:o,exceededTransferLimit:u,fields:l,missingAttributes:h}=await this._queryFeatures(a,t),d=!u||a.maxRecordCountFactor>=M.MAX_MAX_RECORD_COUNT_FACTOR;return await this._frameTask.schedule((()=>{e.featuresMissing=e.hasPreciseFeatureCount&&o.length<e.numFeatures||!!u;const t=this._removeEmptyFeatures(o,this._getEffectiveTileResolution(e));e.setFeatures(o,t,L(l),H(void 0,h)),this._updateTileZQuantization(e)}),t),n(t),this._invalidateCounts(),d}async _fetchCount(e,t){return this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t})}async _fetchPagedTile(e,t){let s,i=0,r=0,a=0,o=this._maximumFeaturesForTile(e)-a;const u=this._getMaxRecordCount(e);let l,h=null;for(;;){const d=this._createQuery(e),c=this._setPagingParameters(d,i,o,u),{features:p,exceededTransferLimit:f,fields:_,missingAttributes:m}=await this._queryFeatures(d,t);if(await this._frameTask.schedule((()=>{c&&(i+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.featuresMissing=c&&e.hasPreciseFeatureCount&&i<e.numFeatures||!!f,s=s?.concat(p)??p,h=k(h,_),l=H(l,m),e.setFeatures(s,r,h,l),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()}),t),n(t),o=this._maximumFeaturesForTile(e)-a,!c||!f||o<=0)return!f}}_createFeatureCountQuery(e){const t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){const t=this.context.createQuery();t.resultType=this._resultType(e);const s=Q(e);return s||(t.geometry=T(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),"tile"!==t.resultType&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),!s&&this.context.effectiveDisplayFilter&&(t.where=c(t.where,this.context.effectiveDisplayFilter.where)),t}_setPagingParameters(e,t,s,i){return!!this.context.capabilities.supportsPagination&&(e.start=t,s>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(s/i),e.num=Math.min(e.maxRecordCountFactor*i,s)):e.num=Math.min(i),!0)}_getEffectiveTileResolution(e){if(Q(e)||!this._supportsResolution)return null;const t=this.context.viewingMode===D.Global?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&"point"!==this.context.geometryType}_setResolutionParams(e,t){const s=this._getEffectiveTileResolution(t);null!=s&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new E({mode:"view",originPosition:"upper-left",tolerance:s,extent:this.context.fullExtent}):"polyline"===this.context.geometryType&&(e.maxAllowableOffset=s))}_removeEmptyFeatures(e,t){const i=e.length;if(t&&this._supportsResolution){const i=t*(1+_());s(e,(({geometry:e})=>!(!e||!b(e))&&(C(e,B),x(B)>i||R(B)>i)))}else s(e,(({geometry:e})=>b(e)));return i-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!Q(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case"tile":if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case"standard":if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||Z}_resultType(e){if(this.context.capabilities.supportsResultType)return Q(e)?"standard":"tile"}get _reduceMode(){const e=this.context.geometryType;return"polygon"===e||"polyline"===e?A.SIZE:A.RANDOM}_handleRequest(e,t,s,i,r){e.startFetch(),e.requestController=s;let n=!1;t.then((t=>{e.requestController=null,i(t)})).catch((t=>{e.requestController===s&&(e.requestController=null,e.fetchDone(!1)),a(t)?n=!0:r(t)})).then((()=>{n||this._setDirty(),this._scheduleUpdated()}))}_scheduleUpdated(){this.hasHandles("scheduleUpdated")||this.addHandles(h((()=>{this.removeHandles("scheduleUpdated"),this._updated()})),"scheduleUpdated")}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;const{features:t}=e;if(0===e.featureLimit||!t){const t=null!=e.displayingFeatures&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}const s=e.fetchingResolution,{adds:i,updates:r}=this._changes,a=Math.min(e.featureLimit,t.length);e.featureLimit=a;for(let n=0;n<a;++n){const e=t[n],a=v(e,this._objectIdField),o=this._displayingFeatureReferences.get(a);if(o){const{oldVersion:t,newVersion:i}=o.ref(e,s);t!==i&&(t&&r.removes.push(t),i&&r.adds.push(i))}else this._displayingFeatureReferences.set(a,new this.FeatureReferenceClass(e,s)),i.push(e);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(null==e.displayingFeatures)return;const{updates:t,removes:s}=this._changes;for(const i of e.displayingFeatures){const r=v(i,this._objectIdField),a=this._displayingFeatureReferences.get(r);if(!a)continue;const{oldVersion:n,newVersion:o}=a.unref(e.displayingResolution);this._numDisplayingFeatureReferences--,n!==o&&(null==o?(this._displayingFeatureReferences.delete(r),n&&s.push(n)):(t.adds.push(o),n&&t.removes.push(n)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get("dataUpdating")||this._set("dataUpdating",!0)}_applyChanges(){const e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);const t=this._changes.adds,s=this._changes.removes,i=Math.min(t.length,s.length);let r=0;for(;r<i;){const e=Math.min(r+$,i);this._notifyDataUpdating(),this.features.addMany(t.slice(r,e)),this.features.removeMany(s.slice(r,e)),r=e}t.length>i&&(this._notifyDataUpdating(),this.features.addMany(0===r?t:t.slice(r))),s.length>i&&(this._notifyDataUpdating(),this.features.removeMany(0===r?s:s.slice(r))),t.length=0,s.length=0}_clearTile(e){this._hideTile(e),e.features&&null!=this.context.memoryCache&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}_getListOfTiles(){return Array.from(this._featureTiles.values())}get storedFeatures(){return this._getListOfTiles().reduce(((e,t)=>e+(t.features?t.features.length:0)),0)}get missingTiles(){return Array.from(this._featureTiles.values()).reduce(((e,t)=>e+(t.needsFetch||t.isFetching?1:0)),0)}_maximumFeaturesForTile(e){const t=e.hasPreciseFeatureCount?e.numFeatures:1/0,s=e.hasPreciseFeatureCount?t:this.maximumNumberOfFeatures,i=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(s*i/(1-e.emptyFeatureRatio)),t)}get test(){}};function Q(e){return"dummy-tile-full-extent"===e.id}function N(e){let t=0;for(const s of e)s.features&&s.features.length>0&&s.alive&&(t=Math.max(t,s.descriptor.lij[0]));return t}function S(e){e.setFeatures([],0,null,void 0),e.featuresMissing=!1}function L(e){return null==e?new Set:new Set(e.map((e=>e.name)))}function k(e,t){if(null==e||null==t)return L(t);const s=new Set;for(const{name:i}of t)e.has(i)&&s.add(i);return s}function H(e,t){if(!t?.length)return e;e??=new Map;const s=()=>new Set;for(const{objectId:i,attribute:a}of t)r(e,i,s).add(a);return e}e([p({constructOnly:!0})],q.prototype,"features",void 0),e([p()],q.prototype,"tileDescriptors",void 0),e([p({value:1/0})],q.prototype,"maximumNumberOfFeatures",null),e([p({value:1})],q.prototype,"memoryFactor",null),e([p({value:1})],q.prototype,"lodFactor",null),e([p()],q.prototype,"useTileCount",null),e([p({readOnly:!0})],q.prototype,"updating",null),e([p({readOnly:!0})],q.prototype,"dataUpdating",void 0),e([p({readOnly:!0})],q.prototype,"updatingTotal",void 0),e([p({readOnly:!0})],q.prototype,"updatingRemaining",void 0),e([p({readOnly:!0})],q.prototype,"expectedFeatureDiff",void 0),e([p({readOnly:!0})],q.prototype,"memoryForUnusedFeatures",null),e([p({readOnly:!0})],q.prototype,"maximumNumberOfFeaturesExceeded",void 0),e([p({readOnly:!0})],q.prototype,"totalVertices",null),e([p({readOnly:!0})],q.prototype,"totalFeatures",null),e([p({readOnly:!0})],q.prototype,"hasAllFeatures",null),e([p({readOnly:!0})],q.prototype,"hasFullGeometries",null),e([p()],q.prototype,"filterExtent",null),e([p({constructOnly:!0})],q.prototype,"context",void 0),e([p()],q.prototype,"_dirty",void 0),e([p()],q.prototype,"_suspended",void 0),e([p()],q.prototype,"_pendingEdits",void 0),e([p()],q.prototype,"_applyEditsTilesUpdated",void 0),e([p()],q.prototype,"_paused",null),e([p()],q.prototype,"_isFetching",void 0),q=e([f("esri.views.3d.layers.support.FeatureTileFetcher3D")],q);const Z=2e3,V=m(),G=m(),B=m(),X=6e5,$=200;export{q as FeatureTileFetcher3D};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as s}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import{createTask as i}from"../../../../core/asyncUtils.js";import a from"../../../../core/Error.js";import{abortMaybe as t,destroyMaybe as r}from"../../../../core/maybe.js";import{throwIfAborted as n,isAborted as o}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as y}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as w}from"../../../../core/accessorSupport/decorators/subclass.js";let h=class extends e{get updating(){return null!=this._createAnalysisViewTask||null!=this.analysisView&&this.analysisView.updating}constructor(s){super(s),this._analysisModule=null,this._emitOnView=(s,e)=>this.parent.view.emit(s,e)}initialize(){this.addHandles(l((()=>this.getAnalysis()),(s=>this._createAnalysisView(s)),y))}destroy(){this._destroyAnalysisView()}async whenAnalysisView(){if(null!=this.analysisView)return this.analysisView;if(null!=this._createAnalysisViewTask)return this._createAnalysisViewTask.promise;throw new a("layerview:no-analysisview-for-analysis","The analysis has not been set on the layer of this layer view")}_createAnalysisView(s){const e=this._createAnalysisViewTask?.promise;this._destroyAnalysisView();const a=i((async i=>{try{await Promise.allSettled([e]);const a=await this._createAnalysisViewPromise(s,i);return n(i),this.analysisView=a,this._emitOnView("analysis-view-create",{analysis:s,analysisView:a}),a}catch(t){throw this._emitOnView("analysis-view-create-error",{analysis:s,error:t}),t}finally{this._createAnalysisViewTask===a&&(this._createAnalysisViewTask=null)}}));this._createAnalysisViewTask=a}_destroyAnalysisView(){const s=this.getAnalysis();this._createAnalysisViewTask=t(this._createAnalysisViewTask);const{analysisView:e}=this;e&&(this.analysisView=r(e),this._emitOnView("analysis-view-destroy",{analysis:s,analysisView:e}))}async _createAnalysisViewPromise(s,e){let i,t=this._analysisModule;const r=e=>{if(!o(e))return;i?.destroy();const t=this.getAnalysis();throw new a("layerview:no-analysisview-for-analysis",null!=t&&s!==t?"The analysis changed before the analysis view could be created":"The analysis has not been added to the layer of this layer view",{analysis:s})};return t||(t=await this.loadAnalysisViewModule(),r(e),this._analysisModule=t),i=new t.default({analysis:s,parent:this.parent,view:this.parent.view}),await i.when(),r(e),i}};s([c({constructOnly:!0})],h.prototype,"parent",void 0),s([c({constructOnly:!0})],h.prototype,"getAnalysis",void 0),s([c({constructOnly:!0})],h.prototype,"loadAnalysisViewModule",void 0),s([c()],h.prototype,"analysisView",void 0),s([c()],h.prototype,"_createAnalysisViewTask",void 0),s([c()],h.prototype,"updating",null),s([c()],h.prototype,"_analysisModule",void 0),h=s([w("esri.views.3d.layers.support.LayerViewAnalysisViewManager")],h);export{h as LayerViewAnalysisViewManager};
|