@arcgis/core 4.27.0-next.20230521 → 4.27.0-next.20230523
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/WebMap.js +1 -1
- package/arcade/featureset/actions/SpatialFilter.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
- package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/030b43764f945cb1f8b0.js +1 -0
- package/assets/esri/core/workers/chunks/0d02856e55d20b99fc8b.js +1 -0
- package/assets/esri/core/workers/chunks/{69242c66492717c7388c.js → 0fcb8d408696075338e2.js} +1 -1
- package/assets/esri/core/workers/chunks/{b91c155de9a89e4e6971.js → 187c3b971ed0fc4363ef.js} +1 -1
- package/assets/esri/core/workers/chunks/{85c6ce93aa41e6b65997.js → 18db07d739a713cc0465.js} +1 -1
- package/assets/esri/core/workers/chunks/1b6177e23327be645c8c.js +1 -0
- package/assets/esri/core/workers/chunks/28286014a575042619ee.js +1 -0
- package/assets/esri/core/workers/chunks/{692dfeb2e255fdc0ade2.js → 39288fa69561d21f04f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{2b9d3e60977934a6d471.js → 3bc6b5f0643364749ef8.js} +1 -1
- package/assets/esri/core/workers/chunks/45e5ad704d18dd0857ce.js +1 -0
- package/assets/esri/core/workers/chunks/4d24efa01d1accc5a5f0.js +1 -0
- package/assets/esri/core/workers/chunks/{6312783626bacf52df7a.js → 55486c644e8b01326a0d.js} +1 -1
- package/assets/esri/core/workers/chunks/5576858f56314afcb4d5.js +1 -0
- package/assets/esri/core/workers/chunks/{62d9d15f0d00a75da42c.js → 571dac507622948ac03e.js} +1 -1
- package/assets/esri/core/workers/chunks/59063d6abf70f6598425.js +1 -0
- package/assets/esri/core/workers/chunks/5a4c04bf4f57e74457c5.js +1 -0
- package/assets/esri/core/workers/chunks/5bf04c32e0ac89dcbf9f.js +1 -0
- package/assets/esri/core/workers/chunks/6a3d611e8842afbb50ab.js +2 -0
- package/assets/esri/core/workers/chunks/{55ca6ba8b40921025181.js.LICENSE.txt → 6a3d611e8842afbb50ab.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/70d6e5edf05ef7079fa8.js +1 -0
- package/assets/esri/core/workers/chunks/71bdf8f10aee0077f681.js +1 -0
- package/assets/esri/core/workers/chunks/72b2c3c8e76da699690c.js +1 -0
- package/assets/esri/core/workers/chunks/78ce0b1af62435d8ebf4.js +1 -0
- package/assets/esri/core/workers/chunks/791f529e90135398b3d5.js +1 -0
- package/assets/esri/core/workers/chunks/8d3abfe6fdc5ac8d6cb7.js +1 -0
- package/assets/esri/core/workers/chunks/{1edc5c06874cb12c5478.js → 924e4a18d8403d1caea3.js} +1 -1
- package/assets/esri/core/workers/chunks/96d339abcd917f1f0ae1.js +1 -0
- package/assets/esri/core/workers/chunks/97cdbec7532cfcdf9ad2.js +1 -0
- package/assets/esri/core/workers/chunks/{f3f6035a17f7dcd19675.js → 9ab400a89dd701778d2c.js} +1 -1
- package/assets/esri/core/workers/chunks/{1488b3d48232844b8bb4.js → 9fe349f43d5ff5a4ac2d.js} +1 -1
- package/assets/esri/core/workers/chunks/{22396dd3717d17a5d235.js → a1c31bb8c12831539328.js} +1 -1
- package/assets/esri/core/workers/chunks/b0571b9e602218cdc7aa.js +1 -0
- package/assets/esri/core/workers/chunks/b1d88f8e528bf7092f35.js +1 -0
- package/assets/esri/core/workers/chunks/b4e2dc6b3d06b426e596.js +1 -0
- package/assets/esri/core/workers/chunks/{48abcb2d88f22e6e9fde.js → c2cb9fa18c77f0c5104e.js} +1 -1
- package/assets/esri/core/workers/chunks/cad7a2092ea7f51dbd8b.js +1 -0
- package/assets/esri/core/workers/chunks/d08800a30b1227591986.js +1 -0
- package/assets/esri/core/workers/chunks/d725dbbdeb05322e6d88.js +1 -0
- package/assets/esri/core/workers/chunks/df3e497d12ed77bae168.js +1 -0
- package/assets/esri/core/workers/chunks/fb080339bfaf32731ca6.js +1 -0
- package/assets/esri/core/workers/chunks/{56fc7924b4fb30239c19.js → fdf58386a67e54c09bfb.js} +1 -1
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
- package/assets/esri/themes/base/_core.scss +2 -0
- package/assets/esri/themes/base/widgets/_BasemapGallery.scss +86 -96
- package/assets/esri/themes/base/widgets/_FloorFilter.scss +6 -0
- package/assets/esri/themes/base/widgets/_UtilityNetworkValidateTopology.scss +40 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_en.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ar.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_bg.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_bs.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ca.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_cs.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_da.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_de.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_el.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_es.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_et.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_fi.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_fr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_he.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_hr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_hu.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_id.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_it.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ja.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ko.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_lt.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_lv.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_nb.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_nl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pt-BR.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_pt-PT.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ro.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_ru.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sk.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sl.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_sv.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_th.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_tr.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_uk.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_vi.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-CN.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-HK.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_zh-TW.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ar.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bg.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ca.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_cs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_da.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_de.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_el.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_en.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_es.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_et.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_he.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hu.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_id.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_it.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ja.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ko.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lt.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_nb.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_nl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-BR.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-PT.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ro.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ru.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_th.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_tr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_uk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_vi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-CN.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-HK.json +1 -1
- package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-TW.json +1 -1
- package/chunks/arcgis-knowledge-client-core-simd.js +1 -1
- package/chunks/arcgis-knowledge-client-core.js +1 -1
- package/chunks/mat4.js +1 -1
- package/core/accessorSupport/write.js +1 -1
- package/core/fontUtils.js +1 -1
- package/core/libs/gl-matrix-2/math/mat4.js +1 -1
- package/geometry/Mesh.js +1 -1
- package/geometry/support/MeshGeoreferencedRelativeVertexSpace.d.ts +4 -0
- package/geometry/support/MeshGeoreferencedRelativeVertexSpace.js +5 -0
- package/geometry/support/MeshGeoreferencedVertexSpace.d.ts +4 -0
- package/geometry/support/MeshGeoreferencedVertexSpace.js +5 -0
- package/geometry/support/MeshLocalVertexSpace.d.ts +4 -0
- package/geometry/support/MeshLocalVertexSpace.js +5 -0
- package/geometry/support/MeshTransform.d.ts +4 -0
- package/geometry/support/MeshTransform.js +1 -1
- package/geometry/support/meshUtils/ElevationSamplerWorker.js +1 -1
- package/geometry/support/meshUtils/centerAt.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/geometry.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
- package/geometry/support/meshUtils/geographicUtils.js +1 -1
- package/geometry/support/meshUtils/georeference.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/offset.js +1 -1
- package/geometry/support/meshUtils/primitives.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/meshUtils/scale.js +1 -1
- package/interfaces.d.ts +227 -25
- package/layers/LinkChartLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/graphics/data/attributeSupport.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/SessionMemoryStorage.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/CompositeBandFunction.js +1 -1
- package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
- package/layers/support/rasterFunctions/ExtractBandFunctionArguments.js +1 -1
- package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
- package/networks/support/TopologyValidationJobInfo.js +1 -1
- package/package.json +2 -2
- package/popup/FieldInfo.js +1 -1
- package/portal/Portal.js +1 -1
- package/rest/support/FeatureSet.js +1 -1
- package/rest/support/meshFeatureSet.js +1 -1
- package/smartMapping/symbology/color.js +1 -1
- package/smartMapping/symbology/support/colors.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/views/2d/layers/StreamLayerView2D.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/meshFastUpdateUtils.js +1 -1
- package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/undoRecords.js +1 -1
- package/views/3d/layers/StreamLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/symbolComplexity.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/DisplayQualityProfile.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/webgl-engine/lib/Camera.js +1 -1
- package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
- package/views/3d/webgl-engine/lib/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/helpMessageUtils.js +1 -1
- package/views/interactive/dragEventPipeline.js +1 -1
- package/views/layers/StreamLayerView.js +1 -1
- package/widgets/BasemapGallery/css.js +1 -1
- package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/Edits.js +1 -1
- package/widgets/Editor/Upload.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +5 -0
- package/widgets/UtilityNetworkValidateTopology.js +5 -0
- package/widgets/support/widgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/163bf2e13abbdd298374.js +0 -1
- package/assets/esri/core/workers/chunks/23f73f81aea461c0c6e6.js +0 -1
- package/assets/esri/core/workers/chunks/2640204c4655aa535ccb.js +0 -1
- package/assets/esri/core/workers/chunks/2bf42d060f877566b989.js +0 -1
- package/assets/esri/core/workers/chunks/34ec9623a1bece86a82b.js +0 -1
- package/assets/esri/core/workers/chunks/3bf52139340827794c3b.js +0 -1
- package/assets/esri/core/workers/chunks/3cebdd77a8401495097f.js +0 -1
- package/assets/esri/core/workers/chunks/48cb634255e39711a720.js +0 -1
- package/assets/esri/core/workers/chunks/4d5f71d84c85f45c97ea.js +0 -1
- package/assets/esri/core/workers/chunks/52d02021e858820bc4fa.js +0 -1
- package/assets/esri/core/workers/chunks/55ca6ba8b40921025181.js +0 -2
- package/assets/esri/core/workers/chunks/64b8f65e2ef6cbf08380.js +0 -1
- package/assets/esri/core/workers/chunks/662e479c370c11bcb8a7.js +0 -1
- package/assets/esri/core/workers/chunks/78aede1e114deefacb54.js +0 -1
- package/assets/esri/core/workers/chunks/7ef100158ca28631fcaf.js +0 -1
- package/assets/esri/core/workers/chunks/93ad67930aa7d4a4b0ac.js +0 -1
- package/assets/esri/core/workers/chunks/964795dfb57f0d0635d0.js +0 -1
- package/assets/esri/core/workers/chunks/99ce0a202dcd3d7dc290.js +0 -1
- package/assets/esri/core/workers/chunks/abe6c99a1a719543dbe8.js +0 -1
- package/assets/esri/core/workers/chunks/c3bf44146fddfe8990f7.js +0 -1
- package/assets/esri/core/workers/chunks/cbe817e966b57599bafd.js +0 -1
- package/assets/esri/core/workers/chunks/e15b5d7e46a834eacc57.js +0 -1
- package/assets/esri/core/workers/chunks/e1e0b3580e2c3098c9f4.js +0 -1
- package/assets/esri/core/workers/chunks/e305d20e4424451cab5b.js +0 -1
- package/assets/esri/core/workers/chunks/e6836c84470fb6bd25bf.js +0 -1
- package/assets/esri/core/workers/chunks/f924732902703233655e.js +0 -1
- package/assets/esri/core/workers/chunks/ff1c005eede0cf964332.js +0 -1
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const c="20230523",d="4367223928740ee3c9cff6dd840243d6823c6489";export{c as buildDate,d as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Color.js";import{getFontFamily as t}from"../../core/fontUtils.js";import{clone as i}from"../../core/lang.js";import r from"../../core/Logger.js";import{pt2px as o,px2pt as n}from"../../core/screenUtils.js";import{numericHash as a}from"../../core/string.js";import{createRendererExpression as s,ArcadeExpression as l}from"../../support/arcadeOnDemand.js";import{DEFAULT_PICTURE_FILL_HEIGHT as c,DEFAULT_HATCH_FILL_SEPARATION as m,DEFAULT_STROKE_WIDTH as f,DEFAULT_MARKER_SIZE as p,DEFAULT_TEXT_HEIGHT as h}from"./CIMSymbolDrawHelper.js";import{CIMSymbolHelper as u,OverrideHelper as y}from"./CIMSymbolHelper.js";import{Alignment as d,CapType as v,JoinType as _}from"./enums.js";import{quantizeIfNeeded as S}from"./quantizeTime.js";import{getExtent as O,getSDFMetrics as g}from"./SDFHelper.js";import{fromCIMColor as M,getTintColor as b,getValue as N,getFillColor as k,getStrokeColor as P,getStrokeWidth as z,fromCIMFontDecoration as C,fromCIMFontStyle as L,adjustTextCase as F,createLabelOverrideFunction as I,evaluateValueOrFunction as w,fromCIMHorizontalAlignment as x,fromCIMVerticalAlignment as A,isFeatureValueFn as R}from"./utils.js";import{CIMEffectHelper as X}from"./effects/CIMEffectHelper.js";import H from"../../views/2d/arcade/callExpressionWithFeature.js";import{RANDOM_INSIDE_POLYGON_TEXTURE_SIZE as J}from"../../views/2d/engine/webgl/definitions.js";import{getMaterialGroup as Y}from"../../views/2d/engine/webgl/grouping.js";const E=r.getLogger("esri.symbols.cim.cimAnalyzer");function T(e){switch(e){case"Butt":return v.BUTT;case"Square":return v.SQUARE;default:return v.ROUND}}function $(e){switch(e){case"Bevel":return _.BEVEL;case"Miter":return _.MITER;default:return _.ROUND}}function j(e){const t=e.markerPlacement;return t&&t.angleToLine?d.MAP:d.SCREEN}class G{constructor(e,t){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._resourceManager=e,this._info=t}async analyzeSymbolReference(e,t,i){if(this._cimLayers=i??[],!e)return this._cimLayers;if(e.primitiveOverrides){this._primitiveOverrides=e.primitiveOverrides,this._poMap={};const t=[],i=this._info;for(const e of this._primitiveOverrides){const r=e.valueExpressionInfo;if(r&&i){const o=r.expression,n=s(o,i.spatialReference,i.fields).then((t=>{null!=t&&this._setPoMap(e.primitiveName,e.propertyName,t)}));t.push(n)}else null!=e.value&&this._setPoMap(e.primitiveName,e.propertyName,e.value);t.length>0&&await Promise.all(t)}}const r=e.symbol,o=[];return u.fetchResources(r,this._resourceManager,o),o.length>0&&await Promise.all(o),this._analyzeSymbol(r,t),this._cimLayers}_analyzeSymbol(e,t){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,t,1,0,0,0)}}_analyzeMultiLayerSymbol(e,t,i,r,o,n){const a=e?.symbolLayers;if(!a)return;const s=e.effects;let l=d.SCREEN;const c=u.getSize(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(l=d.MAP);const m="CIMPolygonSymbol"===e.type;let f=a.length;for(;f--;){const p=a[f];if(!p||!1===p.enable)continue;let h;s&&s.length&&(h=[...s]);const u=p.effects;u&&u.length&&(s?h.push(...u):h=[...u]);const d=[];let v;y.findEffectOverrides(h,this._primitiveOverrides,d),v=d.length>0?this._createEffectsOverrideFunction(h,d):h;const _=[];switch(y.findApplicableOverrides(p,this._primitiveOverrides,_),p.type){case"CIMSolidFill":this._analyzeSolidFill(p,v);break;case"CIMPictureFill":this._analyzePictureFill(p,v);break;case"CIMHatchFill":this._analyzeHatchFill(p,v);break;case"CIMGradientFill":this._analyzeGradientFill(p,v);break;case"CIMSolidStroke":this._analyzeSolidStroke(p,v,m,c);break;case"CIMPictureStroke":this._analyzePictureStroke(p,v,m,c);break;case"CIMGradientStroke":this._analyzeGradientStroke(p,v,m,c);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"===e.type&&(l=j(p));const a=[],s=p.primitiveName;s&&a.push(s),this._analyzeMarker(p,v,null,a,l,c,1,t,i,r,o,n);break}default:E.error("Cannot analyze CIM layer",p.type)}}}_analyzeSolidFill(e,t){const i=e.primitiveName,r=M(e.color),[o,n]=this._analyzePrimitiveOverrides(i,t,null,null),s=a(JSON.stringify(e)+n).toString();this._cimLayers.push({type:"fill",templateHash:s,materialHash:o?()=>s:s,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,color:this._createOverrideFunction(i,"Color",r,U),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:t,applyRandomOffset:!1,sampleAlphaOnly:!0})}_analyzePictureFill(e,t){const i=e.primitiveName,r=b(e),[o,n]=this._analyzePrimitiveOverrides(i,t,null,null),s=a(JSON.stringify(e)+n).toString(),l=a(`${e.url}${JSON.stringify(e.colorSubstitutions)}`).toString(),m=N(e.height,c);let f=N(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const t=e.width;let i=1;const r=this._resourceManager.getResource(e.url);null!=r&&(i=r.width/r.height),f/=i*(m/t)}this._cimLayers.push({type:"fill",templateHash:s,materialHash:o?()=>l:l,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,color:this._createOverrideFunction(i,"TintColor",r,U),height:this._createOverrideFunction(i,"Height",m),scaleX:this._createOverrideFunction(i,"ScaleX",f),angle:this._createOverrideFunction(i,"Rotation",N(e.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",N(e.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",N(e.offsetY)),url:e.url,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeHatchFill(e,t){const i=e.primitiveName,r=this._analyzeMaterialOverrides(i,["Rotation","OffsetX","OffsetY"]);let[o,n]=this._analyzePrimitiveOverrides(i,t,null,null);const s=a(JSON.stringify(e)+n).toString(),l=a(`${e.separation}${JSON.stringify(e.lineSymbol)}`).toString();let c={r:255,g:255,b:255,a:1},f=!1;const p=e.lineSymbol?.symbolLayers?.find((e=>"CIMSolidStroke"===e.type&&null!=this._poMap[e.primitiveName]?.Color));if(p){c=M(p.color),c=this._createOverrideFunction(p.primitiveName,"Color",c,U);const e="function"==typeof c;o=o||e,f=null!=p.color||e}this._cimLayers.push({type:"fill",templateHash:s,materialHash:o&&r?this._createMaterialHashFunction(l,r):l,cim:e,materialOverrides:r,colorLocked:!!e.colorLocked,effects:t,color:c,height:this._createOverrideFunction(i,"Separation",N(e.separation,m)),scaleX:1,angle:this._createOverrideFunction(i,"Rotation",N(e.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",N(e.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",N(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!f})}_analyzeGradientFill(e,t){const i=e.primitiveName,[r,o]=this._analyzePrimitiveOverrides(i,t,null,null),n=a(JSON.stringify(e)+o).toString();this._cimLayers.push({type:"fill",templateHash:n,materialHash:r?()=>n:n,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,color:{r:128,g:128,b:128,a:1},height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeSolidStroke(e,t,i,r){const o=e.primitiveName,n=M(e.color),s=N(e.width,f),l=T(e.capStyle),c=$(e.joinStyle),m=e.miterLimit,[p,h]=this._analyzePrimitiveOverrides(o,t,null,null),u=a(JSON.stringify(e)+h).toString();let y,d;if(t&&t instanceof Array&&t.length>0){const e=t[t.length-1];if("CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&null===e.offsetAlongLine){const e=(t=[...t]).pop();y=e.dashTemplate,d=e.scaleDash}}this._cimLayers.push({type:"line",templateHash:u,materialHash:p?()=>u:u,cim:e,materialOverrides:null,isOutline:i,colorLocked:!!e.colorLocked,effects:t,color:this._createOverrideFunction(o,"Color",n,U),width:this._createOverrideFunction(o,"Width",s),cap:this._createOverrideFunction(o,"CapStyle",l),join:this._createOverrideFunction(o,"JoinStyle",c),miterLimit:m&&this._createOverrideFunction(o,"MiterLimit",m),referenceWidth:r,zOrder:D(e.name),dashTemplate:y,scaleDash:d,sampleAlphaOnly:!0})}_analyzePictureStroke(e,t,i,r){const o=a(`${e.url}${JSON.stringify(e.colorSubstitutions)}`).toString(),n=e.primitiveName,s=b(e),l=N(e.width,f),c=T(e.capStyle),m=$(e.joinStyle),p=e.miterLimit,[h,u]=this._analyzePrimitiveOverrides(n,t,null,null),y=a(JSON.stringify(e)+u).toString();this._cimLayers.push({type:"line",templateHash:y,materialHash:h?()=>o:o,cim:e,materialOverrides:null,isOutline:i,colorLocked:!!e.colorLocked,effects:t,color:this._createOverrideFunction(n,"TintColor",s,U),width:this._createOverrideFunction(n,"Width",l),cap:this._createOverrideFunction(n,"CapStyle",c),join:this._createOverrideFunction(n,"JoinStyle",m),miterLimit:p&&this._createOverrideFunction(n,"MiterLimit",p),referenceWidth:r,zOrder:D(e.name),dashTemplate:null,scaleDash:!1,url:e.url,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,t,i,r){const o=e.primitiveName,n=N(e.width,f),s=T(e.capStyle),l=$(e.joinStyle),c=e.miterLimit,[m,p]=this._analyzePrimitiveOverrides(o,t,null,null),h=a(JSON.stringify(e)+p).toString();this._cimLayers.push({type:"line",templateHash:h,materialHash:m?()=>h:h,cim:e,materialOverrides:null,isOutline:i,colorLocked:!!e.colorLocked,effects:t,color:{r:128,g:128,b:128,a:1},width:this._createOverrideFunction(o,"Width",n),cap:this._createOverrideFunction(o,"CapStyle",s),join:this._createOverrideFunction(o,"JoinStyle",l),miterLimit:c&&this._createOverrideFunction(o,"MiterLimit",c),referenceWidth:r,zOrder:D(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeMarker(e,t,i,r,o,n,a,s,l,c,m,f){if(this._analyzeMarkerInsidePolygon(e,t))return;const h=N(e.size,p),u=N(e.rotation),y=N(e.offsetX),d=N(e.offsetY);let v=this._createOverrideFunction(e.primitiveName,"Size",h),_=this._createOverrideFunction(e.primitiveName,"Rotation",u),S=this._createOverrideFunction(e.primitiveName,"OffsetX",y),O=this._createOverrideFunction(e.primitiveName,"OffsetY",d);v=this._transformSize(v,a),_=this._transformRotation(_,!!e.rotateClockwise,c);const g=this._transformOffsetX(S,O,c,a,m),M=this._transformOffsetY(S,O,c,a,f);switch(S=g,O=M,e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,t,i,r,o,n,v,_,S,O);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,t,i,r,o,n,a,s,v,_,S,O)}}_analyzeMarkerInsidePolygon(e,t){const{markerPlacement:i,type:r}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===r||"CIMPictureMarker"===r){const o=e.primitiveName;if(o){const[e,i]=this._analyzePrimitiveOverrides([o],t,null,null);if(e)return!1}const n=i.primitiveName;if(n){const[e,i]=this._analyzePrimitiveOverrides([n],t,null,null);if(e)return!1}if("CIMVectorMarker"===r){const{markerGraphics:t}=e;if(t)for(const e of t){const{symbol:t}=e;if("CIMPolygonSymbol"===t?.type&&t.symbolLayers){const{symbolLayers:e}=t;for(const t of e)if("CIMSolidStroke"===t.type)return!1}}}else{const{animatedSymbolProperties:t}=e;if(t)return!1}}const o=i,s=Math.abs(o.stepX),l=Math.abs(o.stepY);if(0===s||0===l)return!0;const c=["Rotation","OffsetX","OffsetY"],m=this._primitiveOverrides.filter((t=>t.primitiveName!==e.primitiveName||!c.includes(t.propertyName))),f="url"in e&&"string"==typeof e.url?e.url:void 0,p=a(JSON.stringify(e)).toString();let h,u,y=null;if("Random"===i.gridType){const e=n(J),t=Math.max(Math.floor(e/s),1),i=Math.max(Math.floor(e/l),1);h=l*i,y=e=>e?e*i:0;u=t*s/h}else i.shiftOddRows?(h=2*l,y=e=>e?2*e:0,u=s/l*.5):(h=l,y=null,u=s/l);const d=b(e);return this._cimLayers.push({type:"fill",templateHash:p,materialHash:p,cim:e,materialOverrides:m,colorLocked:!!e.colorLocked,effects:t,color:d,height:this._createOverrideFunction(o.primitiveName,"StepY",h,y),scaleX:u,angle:o.gridAngle,offsetX:N(o.offsetX),offsetY:N(o.offsetY),url:f,applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:!f,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,t,i,r,o,n,s,l,c,m){let f=N(e.scaleX,1);const p=b(e),h=a(`${e.url}${JSON.stringify(e.colorSubstitutions)}${JSON.stringify(e.animatedSymbolProperties)}`).toString();i||(i=this._createMarkerPlacementOverrideFunction(e.markerPlacement));const u=this._createAnimatedSymbolPropertiesOverrideFunction(e.animatedSymbolProperties),[y,d]=this._analyzePrimitiveOverrides(r,t,i,u),v=a(JSON.stringify(e)+d).toString(),_=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const t=e.width;let i=1;const r=this._resourceManager.getResource(e.url);null!=r&&(i=r.width/r.height);f/=i*(N(e.size)/t)}function S(e,t){return null!=u?w(u,e,t):null}const O=e.animatedSymbolProperties&&!0===e.animatedSymbolProperties.randomizeStartTime?(e,t,i,r)=>{const o=Y(r??0),n=S(e,t);return h+`-MATERIALGROUP(${o})`+`-ASP(${JSON.stringify(n)})`}:y?(e,t)=>{const i=S(e,t);return h+`-ASP(${JSON.stringify(i)})`}:h;this._cimLayers.push({type:"marker",templateHash:v,materialHash:O,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,scaleSymbolsProportionally:!1,alignment:o,size:s,scaleX:this._createOverrideFunction(e.primitiveName,"ScaleX",f),rotation:l,offsetX:c,offsetY:m,color:this._createOverrideFunction(e.primitiveName,"TintColor",p,U),anchorPoint:{x:_.x,y:_.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,frameHeight:0,rotateClockwise:!1,referenceSize:n,sizeRatio:1,markerPlacement:i,url:e.url,animatedSymbolProperties:u})}_analyzeVectorMarker(e,t,i,r,o,n,a,s,l,c,m,f){const p=e.markerGraphics;if(!p)return;let h,u=0,y=1;e.scaleSymbolsProportionally&&(h=e.frame,h&&(u=h.ymax-h.ymin,y=this._transformSize(l,1/u))),y=this._transformSize(y,a),i||(i=this._createMarkerPlacementOverrideFunction(e.markerPlacement));for(const d of p)if(d){const a=d.symbol;if(!a)continue;const p=d.primitiveName;p&&r.push(p);let v=m,_=f;if(("CIMPointSymbol"===a.type||"CIMTextSymbol"===a.type)&&h){let t=0,i=0;const r=d.geometry;"x"in r&&"y"in r&&(t+=r.x-.5*(h.xmin+h.xmax),i+=r.y-.5*(h.ymin+h.ymax));const o=e.anchorPoint;o&&("Absolute"===e.anchorPointUnits?(t-=o.x,i-=o.y):h&&(t-=(h.xmax-h.xmin)*o.x,i-=(h.ymax-h.ymin)*o.y)),v=this._transformOffsetX(t,i,c,y,m),_=this._transformOffsetY(t,i,c,y,f)}switch(a.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":s?this._analyzeMultiLayerGraphicNonSDF(e,t,i,null,d,r,o,n,u):this._analyzeMultiLayerGraphic(e,t,i,null,d,r,o,n,u,y,l,c,v,_);break;case"CIMTextSymbol":this._analyzeTextGraphic(e,t,i,d,r,o,n,u,y,l,c,v,_)}p&&r.pop()}}_analyzeMultiLayerGraphic(e,t,i,r,o,n,s,l,c,m,f,p,h,u){const y=o.symbol,d=y.symbolLayers;if(!d)return;let v=d.length;if(B(d))return void this._analyzeCompositeMarkerGraphic(e,t,i,r,o,d,n,s,l,c,f,p,h,u);const _=this._resourceManager.geometryEngine,S=X.applyEffects(y.effects,o.geometry,_);if(S)for(;v--;){const y=d[v];if(!y||!1===y.enable)continue;const b=y.primitiveName;switch(b&&n.push(b),y.type){case"CIMSolidFill":case"CIMSolidStroke":{const m=X.applyEffects(y.effects,S,_),d=O(m);if(!d)continue;const v="Relative"!==e.anchorPointUnits,[N,C,L]=g(d,e.frame,e.size,e.anchorPoint,v),F="CIMSolidFill"===y.type,I={type:"sdf",geom:m,asFill:F},w=y.path,x=M(F?k(y):P(y)),A=F?{r:0,g:0,b:0,a:0}:M(P(y)),H=z(y)??0;if(!F&&!H)break;let J=!1,Y="";for(const e of this._primitiveOverrides)n.includes(e.primitiveName)&&(null!=e.value?Y+=`-${e.primitiveName}-${e.propertyName}-${JSON.stringify(e.value)}`:e.valueExpressionInfo&&(J=!0));(null!=t&&"function"==typeof t||null!=i&&"function"==typeof i)&&(J=!0),(R(f)||R(p)||R(h)||R(u))&&(J=!0);const E=JSON.stringify({...e,markerGraphics:null}),T=a(JSON.stringify(I)+w).toString(),$=a(JSON.stringify(o)+JSON.stringify(y)+E+Y).toString();this._cimLayers.push({type:"marker",templateHash:$,materialHash:J?()=>T:T,cim:I,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:C,y:L},isAbsoluteAnchorPoint:v,size:f,rotation:p,offsetX:h,offsetY:u,scaleX:1,frameHeight:c,rotateClockwise:!1,referenceSize:l,sizeRatio:N,color:this._createOverrideFunction(b,"Color",x,U),outlineColor:this._createOverrideFunction(b,"Color",A,U),outlineWidth:this._createOverrideFunction(b,"Width",H),markerPlacement:i,animatedSymbolProperties:r,path:w});break}case"CIMVectorMarker":y.markerPlacement?this._analyzeMultiLayerGraphicNonSDF(e,t,i,r,o,n,s,l,c):this._analyzeMarker(y,t,i,n,s,l,m,!1,f,p,h,u);break;default:this._analyzeMultiLayerGraphicNonSDF(e,t,i,r,o,n,s,l,c)}b&&n.pop()}}_analyzeTextGraphic(e,i,r,o,n,s,l,c,m,p,u,d,v){const _=[];y.findApplicableOverrides(o,this._primitiveOverrides,_);const S=o.geometry;if(!("x"in S)||!("y"in S))return;const O=o.symbol,g=C(O),b=L(O.fontStyleName),R=t(O.fontFamilyName);O.font={family:R,decoration:g,...b};let X=N(O.height,h),H=N(O.angle),J=N(O.offsetX),Y=N(O.offsetY);X=this._transformSize(X,m),H=this._transformRotation(H,!1,u);const E=this._transformOffsetX(J,Y,u,m,d),T=this._transformOffsetY(J,Y,u,m,v);J=E,Y=T;const $=M(k(O));let j=M(P(O)),G=z(O)??0;G||(j=M(k(O.haloSymbol)),G=N(O.haloSize)),G=this._transformSize(G,m);let D=null,U=null,W=0;if(O.callout&&"CIMBackgroundCallout"===O.callout.type){const e=O.callout;if(e.backgroundSymbol){const t=e.backgroundSymbol.symbolLayers;if(t)for(const e of t)"CIMSolidFill"===e.type?D=M(e.color):"CIMSolidStroke"===e.type&&(U=M(e.color),W=N(e.width,f))}}const[V,B]=this._analyzePrimitiveOverrides(n,i,r,null),q=JSON.stringify(e.effects)+Number(e.colorLocked).toString()+JSON.stringify(e.anchorPoint)+e.anchorPointUnits+JSON.stringify(e.markerPlacement)+e.size.toString(),K=a(JSON.stringify(o)+q+B).toString();let Q=this._createOverrideFunction(o.primitiveName,"TextString",o.textString??"",F,O.textCase);if(null==Q)return;const{fontStyleName:Z}=O,ee=R+(Z?"-"+Z.toLowerCase():"-regular"),te=ee;"string"==typeof Q&&Q.includes("[")&&O.fieldMap&&(Q=I(O.fieldMap,Q,O.textCase)),this._cimLayers.push({type:"text",templateHash:K,materialHash:V||"function"==typeof Q||/\[(.*?)\]/.test(Q)?(e,t,i)=>te+"-"+w(Q,e,t,i):te+"-"+a(Q),cim:O,materialOverrides:null,colorLocked:!!e.colorLocked,effects:i,alignment:s,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,fontName:ee,decoration:g,weight:b.weight,style:b.style,size:X,angle:H,offsetX:J,offsetY:Y,horizontalAlignment:x(O.horizontalAlignment),verticalAlignment:A(O.verticalAlignment),text:Q,color:$,outlineColor:j,outlineSize:G,backgroundColor:D,borderLineColor:U,borderLineWidth:W,referenceSize:l,sizeRatio:1,markerPlacement:r})}_analyzeMultiLayerGraphicNonSDF(e,t,i,r,n,s,l,c,m){const f=this._buildSimpleMarker(e,n),h=e.primitiveName,y=this._analyzeMaterialOverrides(h,["Rotation","OffsetX","OffsetY"]),[d,v]=this._analyzePrimitiveOverrides(s,null,null,null),[_,S,O]=u.getTextureAnchor(f,this._resourceManager),g=N(e.rotation),M=N(e.offsetX),b=N(e.offsetY),k=a(JSON.stringify(f)+v).toString(),P=y&&y.length>0||null!=t&&"function"==typeof t;this._cimLayers.push({type:"marker",templateHash:k,materialHash:P&&y?this._createMaterialHashFunction(k,y):k,cim:f,materialOverrides:y,colorLocked:!!e.colorLocked,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:l,anchorPoint:{x:_,y:S},isAbsoluteAnchorPoint:!1,size:N(e.size,p),rotation:this._createOverrideFunction(h,"Rotation",g),offsetX:this._createOverrideFunction(h,"OffsetX",M),offsetY:this._createOverrideFunction(h,"OffsetY",b),color:{r:255,g:255,b:255,a:1},outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,scaleX:1,frameHeight:m,rotateClockwise:!!e.rotateClockwise,referenceSize:c,sizeRatio:O/o(e.size),markerPlacement:i,animatedSymbolProperties:r,avoidSDFRasterization:!0})}_buildSimpleMarker(e,t){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[t],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}_analyzeCompositeMarkerGraphic(e,t,i,r,o,n,s,l,c,m,p,h,u,y){const d=o.geometry,v=n[0],_=n[1],S=O(d);if(!S)return;const b="Relative"!==e.anchorPointUnits,[k,P,z]=g(S,e.frame,e.size,e.anchorPoint,b),C={type:"sdf",geom:d,asFill:!0},L=_.path,F=_.primitiveName,I=v.primitiveName,w=M(_.color),x=M(v.color),A=N(v.width,f);let X=!1,H="";for(const a of this._primitiveOverrides)(a.primitiveName===F||a.primitiveName===I||s.includes(a.primitiveName))&&(null!=a.value?H+=`-${a.primitiveName}-${a.propertyName}-${JSON.stringify(a.value)}`:a.valueExpressionInfo&&(X=!0));null!=i&&"function"==typeof i&&(X=!0),(R(p)||R(h)||R(u)||R(y))&&(X=!0);const J=JSON.stringify({...e,markerGraphics:null}),Y=a(JSON.stringify(C)+L).toString(),E=a(JSON.stringify(o)+JSON.stringify(_)+JSON.stringify(v)+J+H).toString();this._cimLayers.push({type:"marker",templateHash:E,materialHash:X?()=>Y:Y,cim:C,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:l,anchorPoint:{x:P,y:z},isAbsoluteAnchorPoint:b,size:p,rotation:h,offsetX:u,offsetY:y,scaleX:1,frameHeight:m,rotateClockwise:!1,referenceSize:c,sizeRatio:k,color:this._createOverrideFunction(F,"Color",w,U),outlineColor:this._createOverrideFunction(I,"Color",x,U),outlineWidth:this._createOverrideFunction(I,"Width",A),markerPlacement:i,path:L,animatedSymbolProperties:r})}_createMaterialHashFunction(e,t){const i=this._info?.geometryType;if(i){const e=this._poMap;for(const r of t){if(r.valueExpressionInfo){const t=e[r.primitiveName]&&e[r.primitiveName][r.propertyName];t instanceof l&&(r.fn=(e,r,o)=>H(t,e,{$view:o},i,r))}}}return(i,r,o)=>{for(const e of t)e.fn&&(e.value=e.fn(i,r,o));return a(e+y.buildOverrideKey(t)).toString()}}_setPoMap(e,t,i){let r;this._poMap[e]?r=this._poMap[e]:(r={},this._poMap[e]=r),r[t]=i}_createOverrideFunction(e,t,i,r,o){if(null==e)return i;const n=this._poMap[e];if(null==n)return i;const a=n[t];if("string"==typeof a||"number"==typeof a||a instanceof Array)return r?r.call(null,a,o):a;const s=this._info?.geometryType;return null!=a&&a instanceof l&&null!=s?(e,t,n)=>{let l=H(a,e,{$view:n},s,t);return null!==l&&r&&(l=r.call(null,l,o)),null!==l?l:i}:i}_createEffectsOverrideFunction(e,t){const r=this._poMap,o=this._info?.geometryType;for(const i of t){if(i.valueExpressionInfo&&o){const e=r[i.primitiveName]&&r[i.primitiveName][i.propertyName];e instanceof l&&(i.fn=(t,i,r)=>H(e,t,{$view:r},o,i))}}return(r,o,n)=>{for(const e of t)e.fn&&(e.value=e.fn(r,o,n));const a=[];for(let s of e){const e=s?.primitiveName;if(e){let r=!1;for(const o of t)if(o.primitiveName===e){const e=W(o.propertyName);null!=o.value&&o.value!==s[e]&&(r||(s=i(s),r=!0),s[e]=o.value)}}a.push(s)}return a}}_createMarkerPlacementOverrideFunction(e){const t=[];if(y.findApplicableOverrides(e,this._primitiveOverrides,t),null==e||0===t.length)return e;const r=this._poMap,o=this._info?.geometryType;for(const i of t){if(i.valueExpressionInfo&&o){const e=r[i.primitiveName]&&r[i.primitiveName][i.propertyName];e instanceof l&&(i.fn=(t,i,r)=>H(e,t,{$view:r},o,i))}}return(r,o,n)=>{for(const e of t)e.fn&&(e.value=e.fn(r,o,n));const a=i(e),s=e.primitiveName;for(const e of t)if(e.primitiveName===s){const t=W(e.propertyName);null!=e.value&&e.value!==a[t]&&(a[t]=e.value)}return a}}_createAnimatedSymbolPropertiesOverrideFunction(e){const t=[];if(y.findApplicableOverrides(e,this._primitiveOverrides,t),null==e||0===t.length)return e;const r=this._info?.geometryType;if(r){const e=this._poMap;for(const i of t){if(i.valueExpressionInfo){const t=e[i.primitiveName]&&e[i.primitiveName][i.propertyName];t instanceof l&&(i.fn=(e,i,o)=>H(t,e,{$view:o},r,i))}}}return(r,o,n)=>{for(const e of t)e.fn&&(e.value=e.fn(r,o,n));const a=i(e),s=e.primitiveName;for(const e of t)if(e.primitiveName===s){const t=W(e.propertyName);if(null!=e.value){const i=S(e.value,e.propertyName);i!==a[t]&&(a[t]=i)}}return a}}_analyzePrimitiveOverrides(e,t,i,r){let o=!1,n="";"string"==typeof e&&(e=[e]);for(const a of this._primitiveOverrides)e?.includes(a.primitiveName)&&(null!=a.value?n+=`-${a.primitiveName}-${a.propertyName}-${JSON.stringify(a.value)}`:a.valueExpressionInfo&&(o=!0));return null!=t&&"function"==typeof t&&(o=!0),null!=i&&"function"==typeof i&&(o=!0),null!=r&&"function"==typeof r&&(o=!0),[o,n]}_analyzeMaterialOverrides(e,t){return this._primitiveOverrides.filter((i=>i.primitiveName!==e||!t.includes(i.propertyName)))}_transformSize(e,t){return R(e)||R(t)?(i,r,o)=>(R(e)?e(i,r,o):e)*(R(t)?t(i,r,o):t):e*t}_transformRotation(e,t,i){return R(e)||R(i)?(r,o,n)=>{const a=R(e)?e(r,o,n):e,s=R(i)?i(r,o,n):i;return t?s-a:s+a}:t?i-e:i+e}_transformOffsetX(e,t,i,r,o){if(!(R(e)||R(t)||R(i)||R(r)||R(o))){const n=i*Math.PI/180;if(n){const i=Math.cos(n),a=Math.sin(n);return(i*e-a*t)*r+o}return e*r+o}return(n,a,s)=>{let l=R(i)?i(n,a,s):i;const c=R(r)?r(n,a,s):r,m=R(e)?e(n,a,s):e,f=R(o)?o(n,a,s):o;if(l){l*=Math.PI/180;return(Math.cos(l)*m-Math.sin(l)*(R(t)?t(n,a,s):t))*c+f}return m*c+f}}_transformOffsetY(e,t,i,r,o){if(!(R(e)||R(t)||R(i)||R(r)||R(o))){const n=i*Math.PI/180;if(n){const i=Math.cos(n);return(Math.sin(n)*e+i*t)*r+o}return t*r+o}return(n,a,s)=>{let l=R(i)?i(n,a,s):i;const c=R(r)?r(n,a,s):r,m=R(t)?t(n,a,s):t,f=R(o)?o(n,a,s):o;if(l){l*=Math.PI/180;const t=Math.cos(l);return(Math.sin(l)*(R(e)?e(n,a,s):e)+t*m)*c+f}return m*c+f}}}function D(e){if(e&&0===e.indexOf("Level_")){const t=parseInt(e.substr(6),10);if(!isNaN(t))return t}return 0}function U(t){if(!t||0===t.length)return null;const i=new e(t).toRgba();return{r:i[0],g:i[1],b:i[2],a:i[3]}}function W(e){return e?e.charAt(0).toLowerCase()+e.substr(1):e}function V(e,t){if(!t||0===t.length)return e;const r=i(e);return y.applyOverrides(r,t),r}const B=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&!e[0].effects&&!e[1].effects;export{G as CIMAnalyzer,V as analyzeCIMResource};
|
|
5
|
+
import e from"../../Color.js";import{getFontFamily as t}from"../../core/fontUtils.js";import{clone as i}from"../../core/lang.js";import r from"../../core/Logger.js";import{pt2px as o,px2pt as n}from"../../core/screenUtils.js";import{numericHash as a}from"../../core/string.js";import{createRendererExpression as s,ArcadeExpression as l}from"../../support/arcadeOnDemand.js";import{DEFAULT_PICTURE_FILL_HEIGHT as c,DEFAULT_HATCH_FILL_SEPARATION as m,DEFAULT_STROKE_WIDTH as f,DEFAULT_MARKER_SIZE as h,DEFAULT_TEXT_HEIGHT as p}from"./CIMSymbolDrawHelper.js";import{CIMSymbolHelper as u,OverrideHelper as y}from"./CIMSymbolHelper.js";import{Alignment as d,CapType as v,JoinType as _}from"./enums.js";import{quantizeIfNeeded as O}from"./quantizeTime.js";import{getExtent as S,getSDFMetrics as g}from"./SDFHelper.js";import{fromCIMColor as M,getTintColor as k,getValue as b,getFillColor as N,getStrokeColor as P,getStrokeWidth as z,isFeatureValueFn as C,fromCIMFontDecoration as F,fromCIMFontStyle as L,adjustTextCase as I,createLabelOverrideFunction as w,evaluateValueOrFunction as x,fromCIMHorizontalAlignment as A,fromCIMVerticalAlignment as R}from"./utils.js";import{CIMEffectHelper as X}from"./effects/CIMEffectHelper.js";import H from"../../views/2d/arcade/callExpressionWithFeature.js";import{RANDOM_INSIDE_POLYGON_TEXTURE_SIZE as J}from"../../views/2d/engine/webgl/definitions.js";import{getMaterialGroup as Y}from"../../views/2d/engine/webgl/grouping.js";const E=r.getLogger("esri.symbols.cim.cimAnalyzer");function T(e){switch(e){case"Butt":return v.BUTT;case"Square":return v.SQUARE;default:return v.ROUND}}function $(e){switch(e){case"Bevel":return _.BEVEL;case"Miter":return _.MITER;default:return _.ROUND}}function j(e){const t=e.markerPlacement;return t&&t.angleToLine?d.MAP:d.SCREEN}class G{constructor(e,t){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],this._resourceManager=e,this._info=t}async analyzeSymbolReference(e,t,i){if(this._cimLayers=i??[],!e)return this._cimLayers;if(e.primitiveOverrides){this._primitiveOverrides=e.primitiveOverrides,this._poMap={};const t=[],i=this._info;for(const e of this._primitiveOverrides){const r=e.valueExpressionInfo;if(r&&i){const o=r.expression,n=s(o,i.spatialReference,i.fields).then((t=>{null!=t&&this._setPoMap(e.primitiveName,e.propertyName,t)}));t.push(n)}else null!=e.value&&this._setPoMap(e.primitiveName,e.propertyName,e.value);t.length>0&&await Promise.all(t)}}const r=e.symbol,o=[];return u.fetchResources(r,this._resourceManager,o),o.length>0&&await Promise.all(o),this._analyzeSymbol(r,t),this._cimLayers}_analyzeSymbol(e,t){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,t,1,0,0,0)}}_analyzeMultiLayerSymbol(e,t,i,r,o,n){const a=e?.symbolLayers;if(!a)return;const s=e.effects;let l=d.SCREEN;const c=u.getSize(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(l=d.MAP);const m="CIMPolygonSymbol"===e.type;let f=a.length;for(;f--;){const h=a[f];if(!h||!1===h.enable)continue;let p;s&&s.length&&(p=[...s]);const u=h.effects;u&&u.length&&(s?p.push(...u):p=[...u]);const d=[];let v;y.findEffectOverrides(p,this._primitiveOverrides,d),v=d.length>0?this._createEffectsOverrideFunction(p,d):p;const _=[];switch(y.findApplicableOverrides(h,this._primitiveOverrides,_),h.type){case"CIMSolidFill":this._analyzeSolidFill(h,v);break;case"CIMPictureFill":this._analyzePictureFill(h,v);break;case"CIMHatchFill":this._analyzeHatchFill(h,v);break;case"CIMGradientFill":this._analyzeGradientFill(h,v);break;case"CIMSolidStroke":this._analyzeSolidStroke(h,v,m,c);break;case"CIMPictureStroke":this._analyzePictureStroke(h,v,m,c);break;case"CIMGradientStroke":this._analyzeGradientStroke(h,v,m,c);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"===e.type&&(l=j(h));const a=[],s=h.primitiveName;s&&a.push(s),this._analyzeMarker(h,v,null,a,l,c,1,t,i,r,o,n);break}default:E.error("Cannot analyze CIM layer",h.type)}}}_analyzeSolidFill(e,t){const i=e.primitiveName,r=M(e.color),[o,n]=this._analyzePrimitiveOverrides(i,t,null,null),s=a(JSON.stringify(e)+n).toString();this._cimLayers.push({type:"fill",templateHash:s,materialHash:o?()=>s:s,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,color:this._createOverrideFunction(i,"Color",r,U),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:t,applyRandomOffset:!1,sampleAlphaOnly:!0})}_analyzePictureFill(e,t){const i=e.primitiveName,r=k(e),[o,n]=this._analyzePrimitiveOverrides(i,t,null,null),s=a(JSON.stringify(e)+n).toString(),l=a(`${e.url}${JSON.stringify(e.colorSubstitutions)}`).toString(),m=b(e.height,c);let f=b(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const t=e.width;let i=1;const r=this._resourceManager.getResource(e.url);null!=r&&(i=r.width/r.height),f/=i*(m/t)}this._cimLayers.push({type:"fill",templateHash:s,materialHash:o?()=>l:l,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,color:this._createOverrideFunction(i,"TintColor",r,U),height:this._createOverrideFunction(i,"Height",m),scaleX:this._createOverrideFunction(i,"ScaleX",f),angle:this._createOverrideFunction(i,"Rotation",b(e.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",b(e.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",b(e.offsetY)),url:e.url,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeHatchFill(e,t){const i=e.primitiveName,r=this._analyzeMaterialOverrides(i,["Rotation","OffsetX","OffsetY"]);let[o,n]=this._analyzePrimitiveOverrides(i,t,null,null);const s=a(JSON.stringify(e)+n).toString(),l=a(`${e.separation}${JSON.stringify(e.lineSymbol)}`).toString();let c={r:255,g:255,b:255,a:1},f=!1;const h=e.lineSymbol?.symbolLayers?.find((e=>"CIMSolidStroke"===e.type&&null!=this._poMap[e.primitiveName]?.Color));if(h){c=M(h.color),c=this._createOverrideFunction(h.primitiveName,"Color",c,U);const e="function"==typeof c;o=o||e,f=null!=h.color||e}this._cimLayers.push({type:"fill",templateHash:s,materialHash:o&&r?this._createMaterialHashFunction(l,r):l,cim:e,materialOverrides:r,colorLocked:!!e.colorLocked,effects:t,color:c,height:this._createOverrideFunction(i,"Separation",b(e.separation,m)),scaleX:1,angle:this._createOverrideFunction(i,"Rotation",b(e.rotation)),offsetX:this._createOverrideFunction(i,"OffsetX",b(e.offsetX)),offsetY:this._createOverrideFunction(i,"OffsetY",b(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!f})}_analyzeGradientFill(e,t){const i=e.primitiveName,[r,o]=this._analyzePrimitiveOverrides(i,t,null,null),n=a(JSON.stringify(e)+o).toString();this._cimLayers.push({type:"fill",templateHash:n,materialHash:r?()=>n:n,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,color:{r:128,g:128,b:128,a:1},height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,applyRandomOffset:!1,sampleAlphaOnly:!1})}_analyzeSolidStroke(e,t,i,r){const o=e.primitiveName,n=M(e.color),s=b(e.width,f),l=T(e.capStyle),c=$(e.joinStyle),m=e.miterLimit,[h,p]=this._analyzePrimitiveOverrides(o,t,null,null),u=a(JSON.stringify(e)+p).toString();let y,d;if(t&&t instanceof Array&&t.length>0){const e=t[t.length-1];if("CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&null===e.offsetAlongLine){const e=(t=[...t]).pop();y=e.dashTemplate,d=e.scaleDash}}this._cimLayers.push({type:"line",templateHash:u,materialHash:h?()=>u:u,cim:e,materialOverrides:null,isOutline:i,colorLocked:!!e.colorLocked,effects:t,color:this._createOverrideFunction(o,"Color",n,U),width:this._createOverrideFunction(o,"Width",s),cap:this._createOverrideFunction(o,"CapStyle",l),join:this._createOverrideFunction(o,"JoinStyle",c),miterLimit:m&&this._createOverrideFunction(o,"MiterLimit",m),referenceWidth:r,zOrder:D(e.name),dashTemplate:y,scaleDash:d,sampleAlphaOnly:!0})}_analyzePictureStroke(e,t,i,r){const o=a(`${e.url}${JSON.stringify(e.colorSubstitutions)}`).toString(),n=e.primitiveName,s=k(e),l=b(e.width,f),c=T(e.capStyle),m=$(e.joinStyle),h=e.miterLimit,[p,u]=this._analyzePrimitiveOverrides(n,t,null,null),y=a(JSON.stringify(e)+u).toString();this._cimLayers.push({type:"line",templateHash:y,materialHash:p?()=>o:o,cim:e,materialOverrides:null,isOutline:i,colorLocked:!!e.colorLocked,effects:t,color:this._createOverrideFunction(n,"TintColor",s,U),width:this._createOverrideFunction(n,"Width",l),cap:this._createOverrideFunction(n,"CapStyle",c),join:this._createOverrideFunction(n,"JoinStyle",m),miterLimit:h&&this._createOverrideFunction(n,"MiterLimit",h),referenceWidth:r,zOrder:D(e.name),dashTemplate:null,scaleDash:!1,url:e.url,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,t,i,r){const o=e.primitiveName,n=b(e.width,f),s=T(e.capStyle),l=$(e.joinStyle),c=e.miterLimit,[m,h]=this._analyzePrimitiveOverrides(o,t,null,null),p=a(JSON.stringify(e)+h).toString();this._cimLayers.push({type:"line",templateHash:p,materialHash:m?()=>p:p,cim:e,materialOverrides:null,isOutline:i,colorLocked:!!e.colorLocked,effects:t,color:{r:128,g:128,b:128,a:1},width:this._createOverrideFunction(o,"Width",n),cap:this._createOverrideFunction(o,"CapStyle",s),join:this._createOverrideFunction(o,"JoinStyle",l),miterLimit:c&&this._createOverrideFunction(o,"MiterLimit",c),referenceWidth:r,zOrder:D(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeMarker(e,t,i,r,o,n,a,s,l,c,m,f){if(this._analyzeMarkerInsidePolygon(e,t))return;const p=b(e.size,h),u=b(e.rotation),y=b(e.offsetX),d=b(e.offsetY);let v=this._createOverrideFunction(e.primitiveName,"Size",p),_=this._createOverrideFunction(e.primitiveName,"Rotation",u),O=this._createOverrideFunction(e.primitiveName,"OffsetX",y),S=this._createOverrideFunction(e.primitiveName,"OffsetY",d);v=this._transformSize(v,a),_=this._transformRotation(_,!!e.rotateClockwise,c);const g=this._transformOffsetX(O,S,c,a,m),M=this._transformOffsetY(O,S,c,a,f);switch(O=g,S=M,e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,t,i,r,o,n,v,_,O,S);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,t,i,r,o,n,a,s,v,_,O,S)}}_analyzeMarkerInsidePolygon(e,t){const{markerPlacement:i,type:r}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===r||"CIMPictureMarker"===r){const o=e.primitiveName;if(o){const[e,i]=this._analyzePrimitiveOverrides([o],t,null,null);if(e)return!1}const n=i.primitiveName;if(n){const[e,i]=this._analyzePrimitiveOverrides([n],t,null,null);if(e)return!1}if("CIMVectorMarker"===r){const{markerGraphics:t}=e;if(t)for(const e of t){const{symbol:t}=e;if("CIMPolygonSymbol"===t?.type&&t.symbolLayers){const{symbolLayers:e}=t;for(const t of e)if("CIMSolidStroke"===t.type)return!1}}}else{const{animatedSymbolProperties:t}=e;if(t)return!1}}const o=i,s=Math.abs(o.stepX),l=Math.abs(o.stepY);if(0===s||0===l)return!0;const c=["Rotation","OffsetX","OffsetY"],m=this._primitiveOverrides.filter((t=>t.primitiveName!==e.primitiveName||!c.includes(t.propertyName))),f="url"in e&&"string"==typeof e.url?e.url:void 0,h=a(JSON.stringify(e)).toString();let p,u,y=null;if("Random"===i.gridType){const e=n(J),t=Math.max(Math.floor(e/s),1),i=Math.max(Math.floor(e/l),1);p=l*i,y=e=>e?e*i:0;u=t*s/p}else i.shiftOddRows?(p=2*l,y=e=>e?2*e:0,u=s/l*.5):(p=l,y=null,u=s/l);const d=k(e);return this._cimLayers.push({type:"fill",templateHash:h,materialHash:h,cim:e,materialOverrides:m,colorLocked:!!e.colorLocked,effects:t,color:d,height:this._createOverrideFunction(o.primitiveName,"StepY",p,y),scaleX:u,angle:o.gridAngle,offsetX:b(o.offsetX),offsetY:b(o.offsetY),url:f,applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:!f,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,t,i,r,o,n,s,l,c,m){let f=b(e.scaleX,1);const h=k(e),p=a(`${e.url}${JSON.stringify(e.colorSubstitutions)}${JSON.stringify(e.animatedSymbolProperties)}`).toString();i||(i=this._createMarkerPlacementOverrideFunction(e.markerPlacement));const u=this._createAnimatedSymbolPropertiesOverrideFunction(e.animatedSymbolProperties),[y,d]=this._analyzePrimitiveOverrides(r,t,i,u),v=a(JSON.stringify(e)+d).toString(),_=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const t=e.width;let i=1;const r=this._resourceManager.getResource(e.url);null!=r&&(i=r.width/r.height);f/=i*(b(e.size)/t)}function O(e,t){return null!=u?x(u,e,t):null}const S=e.animatedSymbolProperties&&!0===e.animatedSymbolProperties.randomizeStartTime?(e,t,i,r)=>{const o=Y(r??0),n=O(e,t);return p+`-MATERIALGROUP(${o})`+`-ASP(${JSON.stringify(n)})`}:y?(e,t)=>{const i=O(e,t);return p+`-ASP(${JSON.stringify(i)})`}:p;this._cimLayers.push({type:"marker",templateHash:v,materialHash:S,cim:e,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,scaleSymbolsProportionally:!1,alignment:o,size:s,scaleX:this._createOverrideFunction(e.primitiveName,"ScaleX",f),rotation:l,offsetX:c,offsetY:m,color:this._createOverrideFunction(e.primitiveName,"TintColor",h,U),anchorPoint:{x:_.x,y:_.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,frameHeight:0,rotateClockwise:!1,referenceSize:n,sizeRatio:1,markerPlacement:i,url:e.url,animatedSymbolProperties:u})}_analyzeVectorMarker(e,t,i,r,o,n,a,s,l,c,m,f){const h=e.markerGraphics;if(!h)return;let p,u=0,y=1;e.scaleSymbolsProportionally&&(p=e.frame,p&&(u=p.ymax-p.ymin,y=this._transformSize(l,1/u))),y=this._transformSize(y,a),i||(i=this._createMarkerPlacementOverrideFunction(e.markerPlacement));for(const d of h)if(d){const a=d.symbol;if(!a)continue;const h=d.primitiveName;h&&r.push(h);let v=m,_=f;if(("CIMPointSymbol"===a.type||"CIMTextSymbol"===a.type)&&p){let t=0,i=0;const r=d.geometry;"x"in r&&"y"in r&&(t+=r.x-.5*(p.xmin+p.xmax),i+=r.y-.5*(p.ymin+p.ymax));const o=e.anchorPoint;o&&("Absolute"===e.anchorPointUnits?(t-=o.x,i-=o.y):p&&(t-=(p.xmax-p.xmin)*o.x,i-=(p.ymax-p.ymin)*o.y)),v=this._transformOffsetX(t,i,c,y,m),_=this._transformOffsetY(t,i,c,y,f)}switch(a.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":s?this._analyzeMultiLayerGraphicNonSDF(e,t,i,null,d,r,o,n,u):this._analyzeMultiLayerGraphic(e,t,i,null,d,r,o,n,u,y,l,c,v,_);break;case"CIMTextSymbol":this._analyzeTextGraphic(e,t,i,d,r,o,n,u,y,l,c,v,_)}h&&r.pop()}}_analyzeMultiLayerGraphic(e,t,i,r,o,n,s,l,c,m,f,h,p,u){const y=o.symbol,d=y.symbolLayers;if(!d)return;let v=d.length;if(B(d))return void this._analyzeCompositeMarkerGraphic(e,t,i,r,o,d,n,s,l,c,f,h,p,u);const _=this._resourceManager.geometryEngine,O=X.applyEffects(y.effects,o.geometry,_);if(O)for(;v--;){const y=d[v];if(!y||!1===y.enable)continue;const k=y.primitiveName;switch(k&&n.push(k),y.type){case"CIMSolidFill":case"CIMSolidStroke":{const m=X.applyEffects(y.effects,O,_),d=S(m);if(!d)continue;const v="Relative"!==e.anchorPointUnits,[b,F,L]=g(d,e.frame,e.size,e.anchorPoint,v),I="CIMSolidFill"===y.type,w={type:"sdf",geom:m,asFill:I},x=y.path,A=M(I?N(y):P(y)),R=I?{r:0,g:0,b:0,a:0}:M(P(y)),H=z(y)??0;if(!I&&!H)break;const J=o.primitiveName;let Y=null;I&&!y.colorLocked&&(Y=this._createOverrideFunction(J,"FillColor",A,U));let E=null;y.colorLocked||(E=this._createOverrideFunction(J,"StrokeColor",R,U));const T=this._createOverrideFunction(J,"StrokeWidth",H);let $=!1,j="";for(const e of this._primitiveOverrides)n.includes(e.primitiveName)&&(null!=e.value?j+=`-${e.primitiveName}-${e.propertyName}-${JSON.stringify(e.value)}`:e.valueExpressionInfo&&($=!0));(null!=t&&"function"==typeof t||null!=i&&"function"==typeof i)&&($=!0),(C(f)||C(h)||C(p)||C(u))&&($=!0);const G=JSON.stringify({...e,markerGraphics:null}),D=a(JSON.stringify(w)+x).toString(),W=a(JSON.stringify(o)+JSON.stringify(y)+G+j).toString();this._cimLayers.push({type:"marker",templateHash:W,materialHash:$?()=>D:D,cim:w,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:F,y:L},isAbsoluteAnchorPoint:v,size:f,rotation:h,offsetX:p,offsetY:u,scaleX:1,frameHeight:c,rotateClockwise:!1,referenceSize:l,sizeRatio:b,color:C(Y)?Y:this._createOverrideFunction(k,"Color",A,U),outlineColor:C(E)?E:this._createOverrideFunction(k,"Color",R,U),outlineWidth:C(T)?T:this._createOverrideFunction(k,"Width",H),markerPlacement:i,animatedSymbolProperties:r,path:x});break}case"CIMVectorMarker":y.markerPlacement?this._analyzeMultiLayerGraphicNonSDF(e,t,i,r,o,n,s,l,c):this._analyzeMarker(y,t,i,n,s,l,m,!1,f,h,p,u);break;default:this._analyzeMultiLayerGraphicNonSDF(e,t,i,r,o,n,s,l,c)}k&&n.pop()}}_analyzeTextGraphic(e,i,r,o,n,s,l,c,m,h,u,d,v){const _=[];y.findApplicableOverrides(o,this._primitiveOverrides,_);const O=o.geometry;if(!("x"in O)||!("y"in O))return;const S=o.symbol,g=F(S),k=L(S.fontStyleName),C=t(S.fontFamilyName);S.font={family:C,decoration:g,...k};let X=b(S.height,p),H=b(S.angle),J=b(S.offsetX),Y=b(S.offsetY);X=this._transformSize(X,m),H=this._transformRotation(H,!1,u);const E=this._transformOffsetX(J,Y,u,m,d),T=this._transformOffsetY(J,Y,u,m,v);J=E,Y=T;const $=M(N(S));let j=M(P(S)),G=z(S)??0;G||(j=M(N(S.haloSymbol)),G=b(S.haloSize)),G=this._transformSize(G,m);let D=null,U=null,W=0;if(S.callout&&"CIMBackgroundCallout"===S.callout.type){const e=S.callout;if(e.backgroundSymbol){const t=e.backgroundSymbol.symbolLayers;if(t)for(const e of t)"CIMSolidFill"===e.type?D=M(e.color):"CIMSolidStroke"===e.type&&(U=M(e.color),W=b(e.width,f))}}const[V,B]=this._analyzePrimitiveOverrides(n,i,r,null),q=JSON.stringify(e.effects)+Number(e.colorLocked).toString()+JSON.stringify(e.anchorPoint)+e.anchorPointUnits+JSON.stringify(e.markerPlacement)+e.size.toString(),K=a(JSON.stringify(o)+q+B).toString();let Q=this._createOverrideFunction(o.primitiveName,"TextString",o.textString??"",I,S.textCase);if(null==Q)return;const{fontStyleName:Z}=S,ee=C+(Z?"-"+Z.toLowerCase():"-regular"),te=ee;"string"==typeof Q&&Q.includes("[")&&S.fieldMap&&(Q=w(S.fieldMap,Q,S.textCase)),this._cimLayers.push({type:"text",templateHash:K,materialHash:V||"function"==typeof Q||/\[(.*?)\]/.test(Q)?(e,t,i)=>te+"-"+x(Q,e,t,i):te+"-"+a(Q),cim:S,materialOverrides:null,colorLocked:!!e.colorLocked,effects:i,alignment:s,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,fontName:ee,decoration:g,weight:k.weight,style:k.style,size:X,angle:H,offsetX:J,offsetY:Y,horizontalAlignment:A(S.horizontalAlignment),verticalAlignment:R(S.verticalAlignment),text:Q,color:$,outlineColor:j,outlineSize:G,backgroundColor:D,borderLineColor:U,borderLineWidth:W,referenceSize:l,sizeRatio:1,markerPlacement:r})}_analyzeMultiLayerGraphicNonSDF(e,t,i,r,n,s,l,c,m){const f=this._buildSimpleMarker(e,n),p=e.primitiveName,y=this._analyzeMaterialOverrides(p,["Rotation","OffsetX","OffsetY"]),[d,v]=this._analyzePrimitiveOverrides(s,null,null,null),[_,O,S]=u.getTextureAnchor(f,this._resourceManager),g=b(e.rotation),M=b(e.offsetX),k=b(e.offsetY),N=a(JSON.stringify(f)+v).toString(),P=y&&y.length>0||null!=t&&"function"==typeof t;this._cimLayers.push({type:"marker",templateHash:N,materialHash:P&&y?this._createMaterialHashFunction(N,y):N,cim:f,materialOverrides:y,colorLocked:!!e.colorLocked,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:l,anchorPoint:{x:_,y:O},isAbsoluteAnchorPoint:!1,size:b(e.size,h),rotation:this._createOverrideFunction(p,"Rotation",g),offsetX:this._createOverrideFunction(p,"OffsetX",M),offsetY:this._createOverrideFunction(p,"OffsetY",k),color:{r:255,g:255,b:255,a:1},outlineColor:{r:0,g:0,b:0,a:0},outlineWidth:0,scaleX:1,frameHeight:m,rotateClockwise:!!e.rotateClockwise,referenceSize:c,sizeRatio:S/o(e.size),markerPlacement:i,animatedSymbolProperties:r,avoidSDFRasterization:!0})}_buildSimpleMarker(e,t){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[t],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}_analyzeCompositeMarkerGraphic(e,t,i,r,o,n,s,l,c,m,h,p,u,y){const d=o.geometry,v=n[0],_=n[1],O=S(d);if(!O)return;const k="Relative"!==e.anchorPointUnits,[N,P,z]=g(O,e.frame,e.size,e.anchorPoint,k),F={type:"sdf",geom:d,asFill:!0},L=_.path,I=_.primitiveName,w=v.primitiveName,x=M(_.color),A=M(v.color),R=b(v.width,f),X=o.primitiveName;let H=null;_.colorLocked||(H=this._createOverrideFunction(X,"FillColor",x,U));let J=null;v.colorLocked||(J=this._createOverrideFunction(X,"StrokeColor",A,U));const Y=this._createOverrideFunction(X,"StrokeWidth",R);let E=!1,T="";for(const a of this._primitiveOverrides)(a.primitiveName===I||a.primitiveName===w||s.includes(a.primitiveName))&&(null!=a.value?T+=`-${a.primitiveName}-${a.propertyName}-${JSON.stringify(a.value)}`:a.valueExpressionInfo&&(E=!0));null!=i&&"function"==typeof i&&(E=!0),(C(h)||C(p)||C(u)||C(y))&&(E=!0);const $=JSON.stringify({...e,markerGraphics:null}),j=a(JSON.stringify(F)+L).toString(),G=a(JSON.stringify(o)+JSON.stringify(_)+JSON.stringify(v)+$+T).toString();this._cimLayers.push({type:"marker",templateHash:G,materialHash:E?()=>j:j,cim:F,materialOverrides:null,colorLocked:!!e.colorLocked,effects:t,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:l,anchorPoint:{x:P,y:z},isAbsoluteAnchorPoint:k,size:h,rotation:p,offsetX:u,offsetY:y,scaleX:1,frameHeight:m,rotateClockwise:!1,referenceSize:c,sizeRatio:N,color:C(H)?H:this._createOverrideFunction(I,"Color",x,U),outlineColor:C(J)?J:this._createOverrideFunction(w,"Color",A,U),outlineWidth:C(Y)?Y:this._createOverrideFunction(w,"Width",R),markerPlacement:i,path:L,animatedSymbolProperties:r})}_createMaterialHashFunction(e,t){const i=this._info?.geometryType;if(i){const e=this._poMap;for(const r of t){if(r.valueExpressionInfo){const t=e[r.primitiveName]&&e[r.primitiveName][r.propertyName];t instanceof l&&(r.fn=(e,r,o)=>H(t,e,{$view:o},i,r))}}}return(i,r,o)=>{for(const e of t)e.fn&&(e.value=e.fn(i,r,o));return a(e+y.buildOverrideKey(t)).toString()}}_setPoMap(e,t,i){let r;this._poMap[e]?r=this._poMap[e]:(r={},this._poMap[e]=r),r[t]=i}_createOverrideFunction(e,t,i,r,o){if(null==e)return i;const n=this._poMap[e];if(null==n)return i;const a=n[t];if("string"==typeof a||"number"==typeof a||a instanceof Array)return r?r.call(null,a,o):a;const s=this._info?.geometryType;return null!=a&&a instanceof l&&null!=s?(e,t,n)=>{let l=H(a,e,{$view:n},s,t);return null!==l&&r&&(l=r.call(null,l,o)),null!==l?l:i}:i}_createEffectsOverrideFunction(e,t){const r=this._poMap,o=this._info?.geometryType;for(const i of t){if(i.valueExpressionInfo&&o){const e=r[i.primitiveName]&&r[i.primitiveName][i.propertyName];e instanceof l&&(i.fn=(t,i,r)=>H(e,t,{$view:r},o,i))}}return(r,o,n)=>{for(const e of t)e.fn&&(e.value=e.fn(r,o,n));const a=[];for(let s of e){const e=s?.primitiveName;if(e){let r=!1;for(const o of t)if(o.primitiveName===e){const e=W(o.propertyName);null!=o.value&&o.value!==s[e]&&(r||(s=i(s),r=!0),s[e]=o.value)}}a.push(s)}return a}}_createMarkerPlacementOverrideFunction(e){const t=[];if(y.findApplicableOverrides(e,this._primitiveOverrides,t),null==e||0===t.length)return e;const r=this._poMap,o=this._info?.geometryType;for(const i of t){if(i.valueExpressionInfo&&o){const e=r[i.primitiveName]&&r[i.primitiveName][i.propertyName];e instanceof l&&(i.fn=(t,i,r)=>H(e,t,{$view:r},o,i))}}return(r,o,n)=>{for(const e of t)e.fn&&(e.value=e.fn(r,o,n));const a=i(e),s=e.primitiveName;for(const e of t)if(e.primitiveName===s){const t=W(e.propertyName);null!=e.value&&e.value!==a[t]&&(a[t]=e.value)}return a}}_createAnimatedSymbolPropertiesOverrideFunction(e){const t=[];if(y.findApplicableOverrides(e,this._primitiveOverrides,t),null==e||0===t.length)return e;const r=this._info?.geometryType;if(r){const e=this._poMap;for(const i of t){if(i.valueExpressionInfo){const t=e[i.primitiveName]&&e[i.primitiveName][i.propertyName];t instanceof l&&(i.fn=(e,i,o)=>H(t,e,{$view:o},r,i))}}}return(r,o,n)=>{for(const e of t)e.fn&&(e.value=e.fn(r,o,n));const a=i(e),s=e.primitiveName;for(const e of t)if(e.primitiveName===s){const t=W(e.propertyName);if(null!=e.value){const i=O(e.value,e.propertyName);i!==a[t]&&(a[t]=i)}}return a}}_analyzePrimitiveOverrides(e,t,i,r){let o=!1,n="";"string"==typeof e&&(e=[e]);for(const a of this._primitiveOverrides)e?.includes(a.primitiveName)&&(null!=a.value?n+=`-${a.primitiveName}-${a.propertyName}-${JSON.stringify(a.value)}`:a.valueExpressionInfo&&(o=!0));return null!=t&&"function"==typeof t&&(o=!0),null!=i&&"function"==typeof i&&(o=!0),null!=r&&"function"==typeof r&&(o=!0),[o,n]}_analyzeMaterialOverrides(e,t){return this._primitiveOverrides.filter((i=>i.primitiveName!==e||!t.includes(i.propertyName)))}_transformSize(e,t){return C(e)||C(t)?(i,r,o)=>(C(e)?e(i,r,o):e)*(C(t)?t(i,r,o):t):e*t}_transformRotation(e,t,i){return C(e)||C(i)?(r,o,n)=>{const a=C(e)?e(r,o,n):e,s=C(i)?i(r,o,n):i;return t?s-a:s+a}:t?i-e:i+e}_transformOffsetX(e,t,i,r,o){if(!(C(e)||C(t)||C(i)||C(r)||C(o))){const n=i*Math.PI/180;if(n){const i=Math.cos(n),a=Math.sin(n);return(i*e-a*t)*r+o}return e*r+o}return(n,a,s)=>{let l=C(i)?i(n,a,s):i;const c=C(r)?r(n,a,s):r,m=C(e)?e(n,a,s):e,f=C(o)?o(n,a,s):o;if(l){l*=Math.PI/180;return(Math.cos(l)*m-Math.sin(l)*(C(t)?t(n,a,s):t))*c+f}return m*c+f}}_transformOffsetY(e,t,i,r,o){if(!(C(e)||C(t)||C(i)||C(r)||C(o))){const n=i*Math.PI/180;if(n){const i=Math.cos(n);return(Math.sin(n)*e+i*t)*r+o}return t*r+o}return(n,a,s)=>{let l=C(i)?i(n,a,s):i;const c=C(r)?r(n,a,s):r,m=C(t)?t(n,a,s):t,f=C(o)?o(n,a,s):o;if(l){l*=Math.PI/180;const t=Math.cos(l);return(Math.sin(l)*(C(e)?e(n,a,s):e)+t*m)*c+f}return m*c+f}}}function D(e){if(e&&0===e.indexOf("Level_")){const t=parseInt(e.substr(6),10);if(!isNaN(t))return t}return 0}function U(t){if(!t||0===t.length)return null;const i=new e(t).toRgba();return{r:i[0],g:i[1],b:i[2],a:i[3]}}function W(e){return e?e.charAt(0).toLowerCase()+e.substr(1):e}function V(e,t){if(!t||0===t.length)return e;const r=i(e);return y.applyOverrides(r,t),r}const B=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&!e[0].effects&&!e[1].effects;export{G as CIMAnalyzer,V as analyzeCIMResource};
|
package/symbols/support/utils.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../Color.js";import{isSymbol3D as t,isSymbol2D as o}from"../../symbols.js";import{forEach as n}from"../../core/asyncUtils.js";import"../../core/has.js";import{unwrapOrThrow as r}from"../../core/maybe.js";import{px2pt as l}from"../../core/screenUtils.js";import{O as i}from"../../chunks/vec3f64.js";import{effectFunctionsFromJSON as c}from"../../layers/effects/jsonUtils.js";import{
|
|
5
|
+
import e from"../../Color.js";import{isSymbol3D as t,isSymbol2D as o}from"../../symbols.js";import{forEach as n}from"../../core/asyncUtils.js";import"../../core/has.js";import{unwrapOrThrow as r}from"../../core/maybe.js";import{px2pt as l}from"../../core/screenUtils.js";import{O as i}from"../../chunks/vec3f64.js";import{effectFunctionsFromJSON as c}from"../../layers/effects/jsonUtils.js";import{getCIMSymbolColor as s}from"./cimSymbolUtils.js";import{getStroke as u}from"./gfxUtils.js";import{Symbol3DMaterial as a}from"./Symbol3DMaterial.js";const f=new e("white");function m(e){const t=e.symbolLayers?.at(-1);if(t&&"outline"in t)return t?.outline?.size}function y(e){if(!e)return 0;if(t(e)){const t=m(e);return null!=t?t:0}return l(u(e)?.width)}function p(e){if(null==e||!("symbolLayers"in e)||null==e.symbolLayers)return!1;switch(e.type){case"point-3d":return e.symbolLayers.some((e=>"object"===e.type));case"line-3d":return e.symbolLayers.some((e=>"path"===e.type));case"polygon-3d":return e.symbolLayers.some((e=>"object"===e.type||"extrude"===e.type));default:return!1}}function h(e){return r(e.resource).href}function b(n,r){if(!n)return null;let l=null;return t(n)?l=w(n):o(n)&&(l="cim"===n.type?s(n):n.color?new e(n.color):null),l?d(l,r):null}function w(t){const o=t.symbolLayers;if(!o)return null;let n=null;return o.forEach((e=>{"object"===e.type&&e.resource?.href||(n="water"===e.type?e.color:e.material?e.material.color:null)})),n?new e(n):null}function d(t,o){if(null==o||null==t)return t;const n=t.toRgba();return n[3]=n[3]*o,new e(n)}function j(e,t,o){const n=e.symbolLayers;if(!n)return;const r=e=>d(t=t??e??(null!=o?f:null),o);n.forEach((e=>{if("object"!==e.type||!e.resource?.href||t)if("water"===e.type)e.color=r(e.color);else{const t=null!=e.material?e.material.color:null,n=r(t);null==e.material?e.material=new a({color:n}):e.material.color=n,null!=o&&"outline"in e&&null!=e.outline&&null!=e.outline.color&&(e.outline.color=d(e.outline.color,o))}}))}function k(e,t,o){(t=t??e.color)&&(e.color=d(t,o)),null!=o&&"outline"in e&&e.outline&&e.outline.color&&(e.outline.color=d(e.outline.color,o))}function g(n,r,l){n&&(r||null!=l)&&(r&&(r=new e(r)),t(n)?j(n,r,l):o(n)&&k(n,r,l))}async function L(e,t){const o=e.symbolLayers;o&&await n(o,(async e=>z(e,t)))}async function z(e,t){switch(e.type){case"extrude":U(e,t);break;case"icon":case"line":case"text":S(e,t);break;case"path":E(e,t);break;case"object":await v(e,t)}}function S(e,t){const o=x(t);null!=o&&(e.size=o)}function x(e){for(const t of e)if("number"==typeof t)return t;return null}function U(e,t){e.size="number"==typeof t[2]?t[2]:0}async function v(e,t){const{resourceSize:o,symbolSize:n}=await C(e),r=O(t,o,n);e.width=M(t[0],n[0],o[0],r),e.depth=M(t[1],n[1],o[1],r),e.height=M(t[2],n[2],o[2],r)}function E(e,t){const o=O(t,i,[e.width,void 0,e.height]);e.width=M(t[0],e.width,1,o),e.height=M(t[2],e.height,1,o)}function O(e,t,o){for(let n=0;n<3;n++){const r=e[n];switch(r){case"symbol-value":{const e=o[n];return null!=e?e/t[n]:1}case"proportional":break;default:if(r&&t[n])return r/t[n]}}return 1}async function C(e){const{computeObjectLayerResourceSize:t}=await import("./symbolLayerUtils.js"),o=await t(e,10),{width:n,height:r,depth:l}=e,i=[n,l,r];let c=1;for(let s=0;s<3;s++){const e=i[s];if(null!=e){c=e/o[s];break}}for(let s=0;s<3;s++)null==i[s]&&(i[s]=o[s]*c);return{resourceSize:o,symbolSize:i}}function M(e,t,o,n){switch(e){case"proportional":return o*n;case"symbol-value":return null!=t?t:o;default:return e}}function R(e,t){const o=x(t);if(null!=o)switch(e.type){case"simple-marker":e.size=o;break;case"picture-marker":{const t=e.width/e.height;t>1?(e.width=o,e.height=o*t):(e.width=o*t,e.height=o);break}case"simple-line":e.width=o;break;case"text":e.font.size=o}}async function D(e,n){if(e&&n)return t(e)?L(e,n):void(o(e)&&R(e,n))}function I(e,n,r){if(e&&null!=n)if(t(e)){const t=e.symbolLayers;t&&t.forEach((e=>{if(e&&"object"===e.type)switch(r){case"tilt":e.tilt=n;break;case"roll":e.roll=n;break;default:e.heading=n}}))}else o(e)&&("simple-marker"!==e.type&&"picture-marker"!==e.type&&"text"!==e.type||(e.angle=n))}function J(e){if(!e)return null;const t=e.effects.filter((e=>"bloom"!==e.type)).map((e=>e.toJSON()));return c(t)}function N(e){return null!=e&&"polygon-3d"===e.type&&e.symbolLayers.some((e=>"extrude"===e.type))}async function q(e,t){const o=await e.fetchSymbol(t);return o||e.fetchCIMSymbol(t)}export{g as applyColorToSymbol,d as applyOpacityToColor,I as applyRotationToSymbol,D as applySizesToSymbol,q as fetchWebStyleSymbol,J as getCSSFilterFromEffectList,b as getColorFromSymbol,h as getIconHref,y as getSymbolOutlineSize,p as isVolumetricSymbol,N as symbolHasExtrudeSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{handlesGroup as r}from"../../../core/handleUtils.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{handlesGroup as r}from"../../../core/handleUtils.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../../../rest/support/FeatureSet.js";import a from"./FeatureLayerView2D.js";import{toJSONGeometryType as l}from"./support/util.js";import p from"../../layers/StreamLayerView.js";function c(e,t){if(null==e&&null==t)return null;const r={};return null!=t&&(r.geometry=t.toJSON()),null!=e&&(r.where=e),r}let u=class extends(p(a)){constructor(){super(...arguments),this.pipelineConnectionStatus="disconnected",this.pipelineErrorString=null,this._enabledEventTypes=new Set}initialize(){this.addHandles([s((()=>this.layer.customParameters),(e=>this._proxy.updateCustomParameters(e))),this.layer.on("send-message-to-socket",(e=>this._proxy.sendMessageToSocket(e))),this.layer.on("send-message-to-client",(e=>this._proxy.sendMessageToClient(e))),s((()=>this.layer.purgeOptions),(()=>this._update())),s((()=>this.suspended),this._onSuspendedChange.bind(this))],"constructor")}get connectionError(){return this.pipelineErrorString?new t("stream-controller",this.pipelineErrorString):null}get connectionStatus(){return this.pipelineConnectionStatus}on(e,t){if(Array.isArray(e))return r(e.map((e=>this.on(e,t))));const s=["data-received","message-received"].includes(e);s&&(this._enabledEventTypes.add(e),this._proxy.enableEvent(e,!0));const i=super.on(e,t),o=this;return{remove(){i.remove(),s&&(o._proxy.closed||o.hasEventListener(e)||o._proxy.enableEvent(e,!1))}}}queryLatestObservations(e,r){if(!(this.layer.timeInfo?.endField||this.layer.timeInfo?.startField||this.layer.timeInfo?.trackIdField))throw new t("streamlayer-no-timeField","queryLatestObservation can only be used with services that define a TrackIdField");return this._proxy.queryLatestObservations(this._cleanUpQuery(e),r).then((e=>{const t=n.fromJSON(e);return t.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),t}))}detach(){super.detach(),this.pipelineConnectionStatus="disconnected"}_doPause(){this._proxy?.pauseStream()}_doResume(){this._proxy?.resumeStream()}_createClientOptions(){return{...super._createClientOptions(),setProperty:e=>{this.set(e.propertyName,e.value)}}}_createTileRendererHash(e){const t=`${JSON.stringify(this.layer.purgeOptions)}.${JSON.stringify(c(this.layer.definitionExpression,this.layer.geometryDefinition))})`;return super._createTileRendererHash(e)+t}async _createServiceOptions(){const e=this.layer,{objectIdField:t}=e,r=e.fields.map((e=>e.toJSON())),s=l(e.geometryType),i=e.timeInfo&&e.timeInfo.toJSON()||null,o=e.spatialReference?e.spatialReference.toJSON():null;return{type:"stream",fields:r,geometryType:s,objectIdField:t,timeInfo:i,source:this.layer.parsedUrl,serviceFilter:c(this.layer.definitionExpression,this.layer.geometryDefinition),purgeOptions:this.layer.purgeOptions.toJSON(),enabledEventTypes:Array.from(this._enabledEventTypes.values()),spatialReference:o,maxReconnectionAttempts:this.layer.maxReconnectionAttempts,maxReconnectionInterval:this.layer.maxReconnectionInterval,updateInterval:this.layer.updateInterval,customParameters:e.customParameters}}};e([i()],u.prototype,"pipelineConnectionStatus",void 0),e([i()],u.prototype,"pipelineErrorString",void 0),e([i({readOnly:!0})],u.prototype,"connectionError",null),e([i({readOnly:!0})],u.prototype,"connectionStatus",null),u=e([o("esri.views.2d.layers.StreamLayerView2D")],u);const y=u;export{y 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import{HandleOwner as r}from"../../../../../core/HandleOwner.js";import has from"../../../../../core/has.js";import{applySome as s}from"../../../../../core/maybe.js";import{ignoreAbortErrors as i,after as a,throwIfAborted as o,throwIfNotAbortError as n,isAbortError as u}from"../../../../../core/promiseUtils.js";import{when as g,watch as l,whenOnce as d}from"../../../../../core/reactiveUtils.js";import{property as h}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{convertToGeometry as p}from"../../../../../layers/graphics/featureConversionUtils.js";import{QueryEngine as y}from"../../../../../layers/graphics/data/QueryEngine.js";import f from"../../../../../layers/support/FieldsIndex.js";import{FeatureStore2D as m}from"../FeatureStore2D.js";import{createSource as S}from"../sources/createSource.js";import _ from"../support/AttributeStore.js";import{BinStore as b}from"../support/BinStore.js";import{ClusterStore as v}from"../support/ClusterStore.js";import{ComputedAttributeStorage as I}from"../support/ComputedAttributeStorage.js";import{FeatureSetReaderJSON as Q}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as C}from"../support/UpdateToken.js";import{QueueProcessor as F}from"../../../../support/QueueProcessor.js";const w=5e3,E="tileRenderer.featuresView.attributeView.initialize",T="tileRenderer.featuresView.attributeView.requestUpdate",k="tileRenderer.featuresView.requestRender";function j(e){return"worker:port-closed"===e.name}function x(e){if(!u(e)&&!j(e))throw e}function U(e){return"feature"===e.type&&"snapshot"===e.mode}let R=class extends r{constructor(){super(...arguments),this._storage=new I,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this._updateVersion=1,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initStores(),this._initSource(),this._updateQueue=new F({concurrency:"stream"===this._source.type?1:4,process:(e,t)=>this._onTileMessage(e,{signal:t})}),this.addHandles([this.tileStore.on("update",this.onTileUpdate.bind(this)),g((()=>!this.updating),(()=>this.onIdle()))])}_initSource(){const e=this.tileStore.tileScheme,t=()=>this._updateQueue&&this._updateQueue.length<50,r=(e,t)=>(this._invalidated=!0,this._patchTile(e,t));this._source=S(this.service,this.spatialReference,e,r,t,this.featureStore),this._proxyEvents()}_proxyEvents(){if("stream"===this._source.type){const e=this._source.events,t=this._source;this.addHandles([l((()=>t.connectionStatus),(e=>this.remoteClient.invoke("setProperty",{propertyName:"connectionStatus",value:e}).catch(x)),{initial:!0}),l((()=>t.errorString),(e=>this.remoteClient.invoke("setProperty",{propertyName:"errorString",value:e}).catch(x)),{initial:!0}),e.on("data-received",(e=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}}).catch(x))),e.on("message-received",(e=>this.remoteClient.invoke("emitEvent",{name:"message-received",event:e}).catch(x))),e.on("updateRate",(e=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...e}}).catch(x)))])}}_initAttributeStore(e){this.attributeStore||(this.attributeStore=new _({type:"remote",initialize:(e,t)=>i(this.remoteClient.invoke(E,e,{signal:t}).catch(x)),update:(e,t)=>i(this.remoteClient.invoke(T,e,{signal:t}).catch(x)),render:e=>i(this.remoteClient.invoke(k,void 0,{signal:e}).catch(x))},e))}_initStores(){const e="snapshot"===this.service.type?"snapshot":"on-demand",t={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.featureStore=new m(t,this._storage,e)}_initQueryEngine(e){const t=this;this.featureQueryEngine?.destroy(),this.featureQueryEngine=new y({definitionExpression:e.schema.source.definitionExpression??void 0,fields:this.service.fields,geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds(e){if(null==t.aggregateStore)return[];return t.aggregateStore.getFeatureDisplayIdsForAggregate(e).map((e=>t.getObjectId(e)))}},timeInfo:this.service.timeInfo})}_initAggregateQueryEngine(e,t){if(this.aggregateQueryEngine?.destroy(),null==e)return;const r=t.targets.aggregate.params.fields.slice();this.aggregateQueryEngine=new y({definitionExpression:void 0,fields:r,geometryType:e.geometryInfo.geometryType,objectIdField:e.objectIdField,hasM:e.geometryInfo.hasM,hasZ:e.geometryInfo.hasZ,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!1,featureStore:e,aggregateAdapter:{getFeatureObjectIds:e=>[]}})}destroy(){this._updateQueue.destroy(),this._source.destroy(),this.featureQueryEngine?.destroy(),this.aggregateQueryEngine?.destroy(),this.attributeStore?.destroy();for(const e of this.tileStore.tiles)this._source.unsubscribe(e);clearInterval(this._checkUpdating)}get fieldsIndex(){return new f(this.service.fields)}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get updating(){return this.isUpdating()}isUpdating(){const e=this._source.updatingHandles.updating,t=!this.attributeStore||this.attributeStore.updatingHandles.updating,r=e||t||this.updatingHandles.updating;if(has("esri-2d-log-updating")){let s=`Updating FeatureController2D: ${r}\n`;s+=` -> updatingSource ${e}\n`;for(const e of this._source.subscriptions)s+=` ${e.tile.id} ${e.isDone}\n`;s+=` -> updatingAttributeStore ${t}\n`,s+=` -> updatingHandles ${this.updatingHandles.updating} (queue: ${this._updateQueue.length})\n`,console.log(s)}return r}updateCustomParameters(e){"stream"===this._source.type&&this._source.updateCustomParameters(e)}enableEvent(e){this._source.enableEvent(e.name,e.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}resume(){this._updateQueue.resume()}pauseStream(){"stream"===this._source.type&&this._source.pauseStream()}resumeStream(){"stream"===this._source.type&&this._source.resumeStream()}sendMessageToSocket(e){"stream"===this._source.type&&this._source.sendMessageToSocket(e)}sendMessageToClient(e){"stream"===this._source.type&&this._source.sendMessageToClient(e)}_initAggregateStore(e){const t=e.schema.targets?.aggregate?.type,r=s(this.config,(e=>e.schema.targets?.aggregate?.type));if(r!==t&&(null!=this.aggregateStore&&(this.removeHandles("valueRangesChanged"),this.aggregateStore.destroy(),this.aggregateStore=null),t)){switch(t){case"cluster":{const e={geometryInfo:{geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new v(e,this.spatialReference,this._storage,this.service),this.addHandles(this.aggregateStore.events.on("valueRangesChanged",(e=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:e.valueRanges}}).catch(x)})),"valueRangesChanged");break}case"bin":{const e={geometryInfo:{geometryType:"esriGeometryPolygon",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new b(e,this.spatialReference,this._storage,this.service);break}}this.aggregateStore.onTileUpdate({added:this.tileStore.tiles,removed:[]})}}async update(e,t){this._updateVersion++,has("esri-2d-update-debug")&&console.debug(`FeatureController2D::update: Token version ${this._updateVersion}`),this._initQueryEngine(t),this._initAttributeStore(t),this.pause(),await Promise.all([this._source.update(e,t.schema.source),this.featureStore.updateSchema(e,t.schema.targets.feature),this.attributeStore.update(e,t),this.attributeStore.updateFilters(e,t,this)]),this._initAggregateStore(t),null!=this.aggregateStore&&await this.aggregateStore.updateSchema(e,t.schema.targets.aggregate),this._initAggregateQueryEngine(this.aggregateStore,t.schema),has("esri-2d-update-debug")&&e.describe(),this._set("config",t)}async applyUpdate(e){e.version=this._updateVersion,has("esri-2d-update-debug")&&console.debug(`FeatureController2D::applyUpdate: Token version ${e.version}`),e.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(e),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for source update to finish"),this.notifyChange("updating"),await d((()=>!this.updating)),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Source update finsihed"),null!=this.aggregateStore&&(await a(10),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for aggregate idle call"),await d((()=>!this.updating)),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Aggregate idle called")),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Update finished")}async onEdits({edits:e}){has("esri-2d-update-debug")&&console.debug("Applying Edit:",e),this._didEdit=!0;try{const t=e.removed.map((e=>e.objectId&&-1!==e.objectId?e.objectId:this._lookupObjectIdByGlobalId(e.globalId))),r=e.addOrModified.map((({objectId:e})=>e));this.featureStore.invalidate(),await this._source.edit(r,t),this.clearTiles(),this.notifyChange("updating"),null!=this.aggregateStore&&this.aggregateStore.clear(),await this._source.resend(),await d((()=>!this.updating))}catch(t){}}async refresh(e){if(!e.dataChanged){const e=C.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(this._updateVersion,e),this._cleanupNeeded=!0,this.notifyChange("updating"),await d((()=>!this.updating))}clearTiles(){for(const e of this.tileStore.tiles)this.processor.onTileClear(e)}onTileUpdate(e){null!=this.aggregateStore&&this.aggregateStore.onTileUpdate(e);for(const t of e.added)this._source.subscribe(t,this._updateVersion),this._level=t.level;for(const t of e.removed)this._source.unsubscribe(t),this._cleanupNeeded=!0,this._tileToResolver.has(t.id)&&(this._tileToResolver.get(t.id).resolve(),this._tileToResolver.delete(t.id));this.notifyChange("updating")}async onIdle(){this._invalidated&&(this._invalidated=!1,null==this.aggregateStore&&"heatmap"!==this.processor.type||await this._repushCurrentLevelTiles()),this._markAndSweep()}async querySummaryStatistics({query:e,params:t}){return this.featureQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryAggregateSummaryStatistics({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryUniqueValues({query:e,params:t}){return this.featureQueryEngine.executeQueryForUniqueValues(e,t)}async queryAggregateUniqueValues({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForUniqueValues(e,t)}async queryClassBreaks({query:e,params:t}){return this.featureQueryEngine.executeQueryForClassBreaks(e,t)}async queryAggregateClassBreaks({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForClassBreaks(e,t)}async queryHistogram({query:e,params:t}){return this.featureQueryEngine.executeQueryForHistogram(e,t)}async queryAggregateHistogram({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForHistogram(e,t)}queryExtent(e){return this.featureQueryEngine.executeQueryForExtent(e)}queryAggregates(e){return this.aggregateQueryEngine.executeQuery(e)}queryAggregateCount(e){return this.aggregateQueryEngine.executeQueryForCount(e)}queryAggregateIds(e){return this.aggregateQueryEngine.executeQueryForIds(e)}queryFeatures(e){return this.featureQueryEngine.executeQuery(e)}async queryVisibleFeatures(e){const t=await this.featureQueryEngine.executeQuery(e),r=t.objectIdFieldName;return t.features=t.features.filter((e=>{const t=e.attributes[r],i=this.getDisplayId(t);return s(i,(e=>this.attributeStore.isVisible(e)))})),t}queryFeatureCount(e){return this.featureQueryEngine.executeQueryForCount(e)}queryLatestObservations(e){return this.featureQueryEngine.executeQueryForLatestObservations(e)}queryObjectIds(e){return this.featureQueryEngine.executeQueryForIds(e)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(e){return this.featureStore.lookupObjectId(e,this._storage)}getDisplayId(e){if(null!=this.aggregateStore){const t=this.aggregateStore.getDisplayId(e);if(null==t){const t=this.featureStore.lookupDisplayId(e);return this.aggregateStore.getDisplayIdForReferenceId(t)}return t}return this.featureStore.lookupDisplayId(e)}getFeatures(e){const t=[],r=[];for(const s of e){const e=null!=this.aggregateStore?this.getAggregate(s):null;if(null!=e)if(null!=e.attributes.referenceId){const r=this.getFeature(e.attributes.referenceId);null!=r&&t.push(r)}else r.push(e);else{const e=this.getFeature(s);null!=e&&t.push(e)}}return{features:t,aggregates:r}}getFeature(e){const t=this.featureStore.lookupFeatureByDisplayId(e,this._storage);if(null==t)return null;const r=t.readHydratedGeometry(),s=p(r,t.geometryType,t.hasZ,t.hasM);return{attributes:t.readAttributes(),geometry:s}}getAggregate(e){return null==this.aggregateStore?null:this.aggregateStore.getAggregate(e)}getAggregates(){return null==this.aggregateStore?[]:this.aggregateStore.getAggregates()}async setHighlight(e){const r=e.map((e=>this.getDisplayId(e))).filter(t);return this.attributeStore.setHighlight(e,r)}_lookupObjectIdByGlobalId(e){const t=this.service.globalIdField;if(null==t)throw new Error("Expected globalIdField to be defined");let r=null;if(this.featureStore.forEach((s=>{e===s.readAttribute(t)&&(r=s.getObjectId())})),null==r)throw new Error(`Expected to find a feature with globalId ${e}`);return r}async _repushCurrentLevelTiles(){const e=this.tileStore.tiles.filter((e=>e.level===this._level));e.map((async e=>this._patchTile({type:"append",id:e.key.id,clear:!0,addOrUpdate:null,end:!1})));const t=e.map((async e=>this._patchTile({type:"append",id:e.key.id,addOrUpdate:Q.fromOptimizedFeatures([],this.service),remove:[],end:!0,isRepush:!0,status:C.empty()})));await Promise.all(t)}_maybeForceCleanup(){performance.now()-this._lastCleanup>w&&this._markAndSweep()}_patchTile(e,t){const r=this._updateQueue.push(e,t).catch((e=>{}));return this.updatingHandles.addPromise(r)}async _onTileMessage(e,t){if(o(t),has("esri-2d-update-debug")){const t=s(e.addOrUpdate,(e=>e.hasFeatures));console.debug(e.id,`FeatureController:onTileMessage: [clear:${e.clear}, end:${e.end}, features: ${t}]`)}const r=this.tileStore.get(e.id);if(!r)return;if(e.clear)return this.processor.onTileClear(r);const i=e.status;this._cleanupNeeded=!0;const a=[];for(const s of e.remove??[]){const e=this.featureStore.lookupDisplayId(s);e&&a.push(e)}e.remove=a;try{if(null==e.addOrUpdate)return void this.processor.onTileMessage(r,{...e,addOrUpdate:null},null!=this.aggregateStore,t).catch(n);if(e.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(e.addOrUpdate.instance)&&i.targets.feature||(i.targets.feature=!0,this.featureStore.onTileData(r,e)),!i.storage.data||!i.storage.filters){i.storage.data=!0,i.storage.filters=!0,this.attributeStore.onTileData(r,e);"stream"===this._source.type||this._didEdit?(await this.attributeStore.sendUpdates(),o(t)):this.attributeStore.sendUpdates()}if(null!=this.aggregateStore&&!i.targets.aggregate){i.targets.aggregate=!0;const t=U(this._source)&&this._source.loading,s=!U(this._source)||t||e.end;if(this.aggregateStore.onTileData(r,e,this._storage,this.attributeStore,s),!s)return;i.mesh||(this.attributeStore.onTileData(r,e),await this.attributeStore.sendUpdates())}if(!i.mesh){i.mesh=!0;const s=null!=this.aggregateStore&&"cluster"===this.aggregateStore.type;await this.processor.onTileMessage(r,e,s,t),o(t)}this._maybeForceCleanup()}catch(u){n(u)}}_mark(e,t,r){const s=(4294901760&this._storage.getInstanceId(e))>>>16;e&&(t.add(s),r.set(e))}_markAndSweep(){this._lastCleanup=performance.now();if(!(!("feature"===this._source.type&&"snapshot"===this._source.mode)&&("stream"===this._source.type||this._cleanupNeeded)))return;this._cleanupNeeded=!1;const e=this._storage.getBitset(this._markedIdsBufId),t=new Set;e.clear();for(const r of this.tileStore.tiles)for(const s of this._source.readers(r.id)){const r=s.getCursor();for(;r.next();){let s=r.getDisplayId();if(!s){const e=r.getObjectId();s=this.featureStore.lookupDisplayId(e)}this._mark(s,t,e)}}"symbol"===this.processor.type&&this.processor.forEachBufferId((r=>{this._mark(r,t,e)})),this._updateQueue.forEach((r=>{for(const s of r.remove??[]){const r=this.featureStore.lookupDisplayId(s);this._mark(r,t,e)}})),null!=this.aggregateStore&&(this.aggregateStore.sweepFeatures(e,this.featureStore),"sweepAggregates"in this.aggregateStore&&this.aggregateStore.sweepAggregates(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(e,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(t)}};e([h({constructOnly:!0})],R.prototype,"tileStore",void 0),e([h()],R.prototype,"config",void 0),e([h({readOnly:!0})],R.prototype,"fieldsIndex",null),e([h()],R.prototype,"processor",void 0),e([h({constructOnly:!0})],R.prototype,"remoteClient",void 0),e([h({constructOnly:!0})],R.prototype,"service",void 0),e([h()],R.prototype,"spatialReference",null),e([h()],R.prototype,"updating",null),R=e([c("esri.views.2d.layers.features.controllers.FeatureController2D")],R);const A=R;export{A as default};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import{HandleOwner as r}from"../../../../../core/HandleOwner.js";import has from"../../../../../core/has.js";import{applySome as s}from"../../../../../core/maybe.js";import{ignoreAbortErrors as i,after as a,throwIfAborted as o,throwIfNotAbortError as n,isAbortError as u}from"../../../../../core/promiseUtils.js";import{when as g,watch as l,whenOnce as d}from"../../../../../core/reactiveUtils.js";import{property as h}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{convertToGeometry as p}from"../../../../../layers/graphics/featureConversionUtils.js";import{QueryEngine as y}from"../../../../../layers/graphics/data/QueryEngine.js";import f from"../../../../../layers/support/FieldsIndex.js";import{FeatureStore2D as m}from"../FeatureStore2D.js";import{createSource as S}from"../sources/createSource.js";import _ from"../support/AttributeStore.js";import{BinStore as b}from"../support/BinStore.js";import{ClusterStore as v}from"../support/ClusterStore.js";import{ComputedAttributeStorage as I}from"../support/ComputedAttributeStorage.js";import{FeatureSetReaderJSON as Q}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as C}from"../support/UpdateToken.js";import{QueueProcessor as F}from"../../../../support/QueueProcessor.js";const E=5e3,w="tileRenderer.featuresView.attributeView.initialize",T="tileRenderer.featuresView.attributeView.requestUpdate",k="tileRenderer.featuresView.requestRender";function j(e){return"worker:port-closed"===e.name}function x(e){if(!u(e)&&!j(e))throw e}function U(e){return"feature"===e.type&&"snapshot"===e.mode}let R=class extends r{constructor(){super(...arguments),this._storage=new I,this._markedIdsBufId=this._storage.createBitset(),this._lastCleanup=performance.now(),this._cleanupNeeded=!1,this._invalidated=!1,this._tileToResolver=new Map,this._didEdit=!1,this._updateVersion=1,this.tileStore=null,this.config=null,this.processor=null,this.remoteClient=null,this.service=null}initialize(){this._initStores(),this._initSource(),this._updateQueue=new F({concurrency:"stream"===this._source.type?1:4,process:(e,t)=>this._onTileMessage(e,{signal:t})}),this.addHandles([this.tileStore.on("update",this.onTileUpdate.bind(this)),g((()=>!this.updating),(()=>this.onIdle()))])}_initSource(){const e=this.tileStore.tileScheme,t=()=>this._updateQueue&&this._updateQueue.length<50,r=(e,t)=>(this._invalidated=!0,this._patchTile(e,t));this._source=S(this.service,this.spatialReference,e,r,t,this.featureStore),this._proxyEvents()}_setStreamClientProperty(e,t){this.remoteClient.invoke("setProperty",{propertyName:e,value:t}).catch(x)}_proxyEvents(){if("stream"===this._source.type){const e=this._source.events,t=this._source;this.addHandles([l((()=>t.connectionStatus),(e=>this._setStreamClientProperty("pipelineConnectionStatus",e)),{initial:!0}),l((()=>t.errorString),(e=>this._setStreamClientProperty("pipelineErrorString",e)),{initial:!0}),e.on("data-received",(e=>this.remoteClient.invoke("emitEvent",{name:"data-received",event:{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry}}).catch(x))),e.on("message-received",(e=>this.remoteClient.invoke("emitEvent",{name:"message-received",event:e}).catch(x))),e.on("updateRate",(e=>this.remoteClient.invoke("emitEvent",{name:"update-rate",event:{...e}}).catch(x)))])}}_initAttributeStore(e){this.attributeStore||(this.attributeStore=new _({type:"remote",initialize:(e,t)=>i(this.remoteClient.invoke(w,e,{signal:t}).catch(x)),update:(e,t)=>i(this.remoteClient.invoke(T,e,{signal:t}).catch(x)),render:e=>i(this.remoteClient.invoke(k,void 0,{signal:e}).catch(x))},e))}_initStores(){const e="snapshot"===this.service.type?"snapshot":"on-demand",t={geometryInfo:{geometryType:this.service.geometryType,hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.featureStore=new m(t,this._storage,e)}_initQueryEngine(e){const t=this;this.featureQueryEngine?.destroy(),this.featureQueryEngine=new y({definitionExpression:e.schema.source.definitionExpression??void 0,fields:this.service.fields,geometryType:this.service.geometryType,objectIdField:this.service.objectIdField,hasM:!1,hasZ:!1,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!0,featureStore:this.featureStore,aggregateAdapter:{getFeatureObjectIds(e){if(null==t.aggregateStore)return[];return t.aggregateStore.getFeatureDisplayIdsForAggregate(e).map((e=>t.getObjectId(e)))}},timeInfo:this.service.timeInfo})}_initAggregateQueryEngine(e,t){if(this.aggregateQueryEngine?.destroy(),null==e)return;const r=t.targets.aggregate.params.fields.slice();this.aggregateQueryEngine=new y({definitionExpression:void 0,fields:r,geometryType:e.geometryInfo.geometryType,objectIdField:e.objectIdField,hasM:e.geometryInfo.hasM,hasZ:e.geometryInfo.hasZ,spatialReference:this.spatialReference.toJSON(),cacheSpatialQueries:!1,featureStore:e,aggregateAdapter:{getFeatureObjectIds:e=>[]}})}destroy(){this._updateQueue.destroy(),this._source.destroy(),this.featureQueryEngine?.destroy(),this.aggregateQueryEngine?.destroy(),this.attributeStore?.destroy();for(const e of this.tileStore.tiles)this._source.unsubscribe(e);clearInterval(this._checkUpdating)}get fieldsIndex(){return new f(this.service.fields)}get spatialReference(){return this.tileStore.tileScheme.spatialReference}get updating(){return this.isUpdating()}isUpdating(){const e=this._source.updatingHandles.updating,t=!this.attributeStore||this.attributeStore.updatingHandles.updating,r=e||t||this.updatingHandles.updating;if(has("esri-2d-log-updating")){let s=`Updating FeatureController2D: ${r}\n`;s+=` -> updatingSource ${e}\n`;for(const e of this._source.subscriptions)s+=` ${e.tile.id} ${e.isDone}\n`;s+=` -> updatingAttributeStore ${t}\n`,s+=` -> updatingHandles ${this.updatingHandles.updating} (queue: ${this._updateQueue.length})\n`,console.log(s)}return r}updateCustomParameters(e){"stream"===this._source.type&&this._source.updateCustomParameters(e)}enableEvent(e){this._source.enableEvent(e.name,e.value)}pause(){this._updateQueue.pause(),this._updateQueue.clear()}resume(){this._updateQueue.resume()}pauseStream(){"stream"===this._source.type&&this._source.pauseStream()}resumeStream(){"stream"===this._source.type&&this._source.resumeStream()}sendMessageToSocket(e){"stream"===this._source.type&&this._source.sendMessageToSocket(e)}sendMessageToClient(e){"stream"===this._source.type&&this._source.sendMessageToClient(e)}_initAggregateStore(e){const t=e.schema.targets?.aggregate?.type,r=s(this.config,(e=>e.schema.targets?.aggregate?.type));if(r!==t&&(null!=this.aggregateStore&&(this.removeHandles("valueRangesChanged"),this.aggregateStore.destroy(),this.aggregateStore=null),t)){switch(t){case"cluster":{const e={geometryInfo:{geometryType:"esriGeometryPoint",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new v(e,this.spatialReference,this._storage,this.service),this.addHandles(this.aggregateStore.events.on("valueRangesChanged",(e=>{this.remoteClient.invoke("emitEvent",{name:"valueRangesChanged",event:{valueRanges:e.valueRanges}}).catch(x)})),"valueRangesChanged");break}case"bin":{const e={geometryInfo:{geometryType:"esriGeometryPolygon",hasM:!1,hasZ:!1},spatialReference:this.spatialReference,fieldsIndex:this.fieldsIndex,fields:this.service.fields};this.aggregateStore=new b(e,this.spatialReference,this._storage,this.service);break}}this.aggregateStore.onTileUpdate({added:this.tileStore.tiles,removed:[]})}}async update(e,t){this._updateVersion++,has("esri-2d-update-debug")&&console.debug(`FeatureController2D::update: Token version ${this._updateVersion}`),this._initQueryEngine(t),this._initAttributeStore(t),this.pause(),await Promise.all([this._source.update(e,t.schema.source),this.featureStore.updateSchema(e,t.schema.targets.feature),this.attributeStore.update(e,t),this.attributeStore.updateFilters(e,t,this)]),this._initAggregateStore(t),null!=this.aggregateStore&&await this.aggregateStore.updateSchema(e,t.schema.targets.aggregate),this._initAggregateQueryEngine(this.aggregateStore,t.schema),has("esri-2d-update-debug")&&e.describe(),this._set("config",t)}async applyUpdate(e){e.version=this._updateVersion,has("esri-2d-update-debug")&&console.debug(`FeatureController2D::applyUpdate: Token version ${e.version}`),e.mesh&&this.clearTiles(),this._updateQueue.resume(),await this._source.applyUpdate(e),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for source update to finish"),this.notifyChange("updating"),await d((()=>!this.updating)),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Source update finsihed"),null!=this.aggregateStore&&(await a(10),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Waiting for aggregate idle call"),await d((()=>!this.updating)),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Aggregate idle called")),has("esri-2d-update-debug")&&console.debug("FeatureController2D::applyUpdate Update finished")}async onEdits({edits:e}){has("esri-2d-update-debug")&&console.debug("Applying Edit:",e),this._didEdit=!0;try{const t=e.removed.map((e=>e.objectId&&-1!==e.objectId?e.objectId:this._lookupObjectIdByGlobalId(e.globalId))),r=e.addOrModified.map((({objectId:e})=>e));this.featureStore.invalidate(),await this._source.edit(r,t),this.clearTiles(),this.notifyChange("updating"),null!=this.aggregateStore&&this.aggregateStore.clear(),await this._source.resend(),await d((()=>!this.updating))}catch(t){}}async refresh(e){if(!e.dataChanged){const e=C.empty();return e.storage.filters=!0,this.applyUpdate(e)}this.featureStore.invalidate(),this.clearTiles(),this._source.refresh(this._updateVersion,e),this._cleanupNeeded=!0,this.notifyChange("updating"),await d((()=>!this.updating))}clearTiles(){for(const e of this.tileStore.tiles)this.processor.onTileClear(e)}onTileUpdate(e){null!=this.aggregateStore&&this.aggregateStore.onTileUpdate(e);for(const t of e.added)this._source.subscribe(t,this._updateVersion),this._level=t.level;for(const t of e.removed)this._source.unsubscribe(t),this._cleanupNeeded=!0,this._tileToResolver.has(t.id)&&(this._tileToResolver.get(t.id).resolve(),this._tileToResolver.delete(t.id));this.notifyChange("updating")}async onIdle(){this._invalidated&&(this._invalidated=!1,null==this.aggregateStore&&"heatmap"!==this.processor.type||await this._repushCurrentLevelTiles()),this._markAndSweep()}async querySummaryStatistics({query:e,params:t}){return this.featureQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryAggregateSummaryStatistics({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForSummaryStatistics(e,t)}async queryUniqueValues({query:e,params:t}){return this.featureQueryEngine.executeQueryForUniqueValues(e,t)}async queryAggregateUniqueValues({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForUniqueValues(e,t)}async queryClassBreaks({query:e,params:t}){return this.featureQueryEngine.executeQueryForClassBreaks(e,t)}async queryAggregateClassBreaks({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForClassBreaks(e,t)}async queryHistogram({query:e,params:t}){return this.featureQueryEngine.executeQueryForHistogram(e,t)}async queryAggregateHistogram({query:e,params:t}){return this.aggregateQueryEngine.executeQueryForHistogram(e,t)}queryExtent(e){return this.featureQueryEngine.executeQueryForExtent(e)}queryAggregates(e){return this.aggregateQueryEngine.executeQuery(e)}queryAggregateCount(e){return this.aggregateQueryEngine.executeQueryForCount(e)}queryAggregateIds(e){return this.aggregateQueryEngine.executeQueryForIds(e)}queryFeatures(e){return this.featureQueryEngine.executeQuery(e)}async queryVisibleFeatures(e){const t=await this.featureQueryEngine.executeQuery(e),r=t.objectIdFieldName;return t.features=t.features.filter((e=>{const t=e.attributes[r],i=this.getDisplayId(t);return s(i,(e=>this.attributeStore.isVisible(e)))})),t}queryFeatureCount(e){return this.featureQueryEngine.executeQueryForCount(e)}queryLatestObservations(e){return this.featureQueryEngine.executeQueryForLatestObservations(e)}queryObjectIds(e){return this.featureQueryEngine.executeQueryForIds(e)}async queryStatistics(){return this.featureStore.storeStatistics}getObjectId(e){return this.featureStore.lookupObjectId(e,this._storage)}getDisplayId(e){if(null!=this.aggregateStore){const t=this.aggregateStore.getDisplayId(e);if(null==t){const t=this.featureStore.lookupDisplayId(e);return this.aggregateStore.getDisplayIdForReferenceId(t)}return t}return this.featureStore.lookupDisplayId(e)}getFeatures(e){const t=[],r=[];for(const s of e){const e=null!=this.aggregateStore?this.getAggregate(s):null;if(null!=e)if(null!=e.attributes.referenceId){const r=this.getFeature(e.attributes.referenceId);null!=r&&t.push(r)}else r.push(e);else{const e=this.getFeature(s);null!=e&&t.push(e)}}return{features:t,aggregates:r}}getFeature(e){const t=this.featureStore.lookupFeatureByDisplayId(e,this._storage);if(null==t)return null;const r=t.readHydratedGeometry(),s=p(r,t.geometryType,t.hasZ,t.hasM);return{attributes:t.readAttributes(),geometry:s}}getAggregate(e){return null==this.aggregateStore?null:this.aggregateStore.getAggregate(e)}getAggregates(){return null==this.aggregateStore?[]:this.aggregateStore.getAggregates()}async setHighlight(e){const r=e.map((e=>this.getDisplayId(e))).filter(t);return this.attributeStore.setHighlight(e,r)}_lookupObjectIdByGlobalId(e){const t=this.service.globalIdField;if(null==t)throw new Error("Expected globalIdField to be defined");let r=null;if(this.featureStore.forEach((s=>{e===s.readAttribute(t)&&(r=s.getObjectId())})),null==r)throw new Error(`Expected to find a feature with globalId ${e}`);return r}async _repushCurrentLevelTiles(){const e=this.tileStore.tiles.filter((e=>e.level===this._level));e.map((async e=>this._patchTile({type:"append",id:e.key.id,clear:!0,addOrUpdate:null,end:!1})));const t=e.map((async e=>this._patchTile({type:"append",id:e.key.id,addOrUpdate:Q.fromOptimizedFeatures([],this.service),remove:[],end:!0,isRepush:!0,status:C.empty()})));await Promise.all(t)}_maybeForceCleanup(){performance.now()-this._lastCleanup>E&&this._markAndSweep()}_patchTile(e,t){const r=this._updateQueue.push(e,t).catch((e=>{}));return this.updatingHandles.addPromise(r)}async _onTileMessage(e,t){if(o(t),has("esri-2d-update-debug")){const t=s(e.addOrUpdate,(e=>e.hasFeatures));console.debug(e.id,`FeatureController:onTileMessage: [clear:${e.clear}, end:${e.end}, features: ${t}]`)}const r=this.tileStore.get(e.id);if(!r)return;if(e.clear)return this.processor.onTileClear(r);const i=e.status;this._cleanupNeeded=!0;const a=[];for(const s of e.remove??[]){const e=this.featureStore.lookupDisplayId(s);e&&a.push(e)}e.remove=a;try{if(null==e.addOrUpdate)return void this.processor.onTileMessage(r,{...e,addOrUpdate:null},null!=this.aggregateStore,t).catch(n);if(e.addOrUpdate.setArcadeSpatialReference(this.spatialReference),this.featureStore.hasInstance(e.addOrUpdate.instance)&&i.targets.feature||(i.targets.feature=!0,this.featureStore.onTileData(r,e)),!i.storage.data||!i.storage.filters){i.storage.data=!0,i.storage.filters=!0,this.attributeStore.onTileData(r,e);"stream"===this._source.type||this._didEdit?(await this.attributeStore.sendUpdates(),o(t)):this.attributeStore.sendUpdates()}if(null!=this.aggregateStore&&!i.targets.aggregate){i.targets.aggregate=!0;const t=U(this._source)&&this._source.loading,s=!U(this._source)||t||e.end;if(this.aggregateStore.onTileData(r,e,this._storage,this.attributeStore,s),!s)return;i.mesh||(this.attributeStore.onTileData(r,e),await this.attributeStore.sendUpdates())}if(!i.mesh){i.mesh=!0;const s=null!=this.aggregateStore&&"cluster"===this.aggregateStore.type;await this.processor.onTileMessage(r,e,s,t),o(t)}this._maybeForceCleanup()}catch(u){n(u)}}_mark(e,t,r){const s=(4294901760&this._storage.getInstanceId(e))>>>16;e&&(t.add(s),r.set(e))}_markAndSweep(){this._lastCleanup=performance.now();if(!(!("feature"===this._source.type&&"snapshot"===this._source.mode)&&("stream"===this._source.type||this._cleanupNeeded)))return;this._cleanupNeeded=!1;const e=this._storage.getBitset(this._markedIdsBufId),t=new Set;e.clear();for(const r of this.tileStore.tiles)for(const s of this._source.readers(r.id)){const r=s.getCursor();for(;r.next();){let s=r.getDisplayId();if(!s){const e=r.getObjectId();s=this.featureStore.lookupDisplayId(e)}this._mark(s,t,e)}}"symbol"===this.processor.type&&this.processor.forEachBufferId((r=>{this._mark(r,t,e)})),this._updateQueue.forEach((r=>{for(const s of r.remove??[]){const r=this.featureStore.lookupDisplayId(s);this._mark(r,t,e)}})),null!=this.aggregateStore&&(this.aggregateStore.sweepFeatures(e,this.featureStore),"sweepAggregates"in this.aggregateStore&&this.aggregateStore.sweepAggregates(this._storage,this.attributeStore,this._level)),this.featureStore.sweepFeatures(e,this._storage,this.attributeStore),this.featureStore.sweepFeatureSets(t)}};e([h({constructOnly:!0})],R.prototype,"tileStore",void 0),e([h()],R.prototype,"config",void 0),e([h({readOnly:!0})],R.prototype,"fieldsIndex",null),e([h()],R.prototype,"processor",void 0),e([h({constructOnly:!0})],R.prototype,"remoteClient",void 0),e([h({constructOnly:!0})],R.prototype,"service",void 0),e([h()],R.prototype,"spatialReference",null),e([h()],R.prototype,"updating",null),R=e([c("esri.views.2d.layers.features.controllers.FeatureController2D")],R);const A=R;export{A 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{convertFromFeatures as t,convertFromFeatureSet as e,convertToFeature as r,convertToGeometry as s,getQuantizedArea as i,unquantizeOptimizedGeometry as n}from"../../../../../layers/graphics/featureConversionUtils.js";import{hasGeometry as o}from"../../../../../layers/graphics/OptimizedFeature.js";import u from"../../../../../layers/support/FieldsIndex.js";import{FeatureSetReader as a}from"./FeatureSetReader.js";function d({coords:t,lengths:e}){let r=0;for(const s of e){for(let e=1;e<s;e++)t[2*(r+e)]+=t[2*(r+e)-2],t[2*(r+e)+1]+=t[2*(r+e)-1];r+=s}}class h extends a{static fromFeatures(e,r){const{objectIdField:s,geometryType:i}=r,n=t([],e,i,!1,!1,s);for(let t=0;t<n.length;t++)n[t].displayId=e[t].displayId;return h.fromOptimizedFeatures(n,r)}static fromFeatureSet(t,r){const s=e(t,r.objectIdField);return h.fromOptimizedFeatureSet(s,r)}static fromOptimizedFeatureSet(t,e){const{features:r}=t,s=h.fromOptimizedFeatures(r,e);return s._exceededTransferLimit=t.exceededTransferLimit,s._transform=t.transform,s._fieldsIndex=new u(e.fields),s}static fromOptimizedFeatures(t,e,r){const s=a.createInstance(),i=new h(s,t,e);return i._fieldsIndex=new u(e.fields),i._transform=r,i}constructor(t,e,r){super(t,r),this._exceededTransferLimit=!1,this._featureIndex=-1,this._fieldsIndex=null,this._geometryType=r?.geometryType,this._features=e}get fields(){return this._fieldsIndex}get _current(){return this._features[this._featureIndex]}get geometryType(){return this._geometryType}get hasFeatures(){return!!this._features.length}get hasNext(){return this._featureIndex+1<this._features.length}get exceededTransferLimit(){return this._exceededTransferLimit}get hasZ(){return!1}get hasM(){return!1}removeIds(t){const e=new Set(t);this._features=this._features.filter((t=>!(t.objectId&&e.has(t.objectId))))}append(t){for(const e of t)this._features.push(e)}getSize(){return this._features.length}getCursor(){return this.copy()}getQuantizationTransform(){return this._transform}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getIndex(){return this._featureIndex}setIndex(t){this._featureIndex=t}getObjectId(){return this._current?.objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){this._current.displayId=t}getGroupId(){return this._current.groupId}setGroupId(t){this._current.groupId=t}copy(){const t=new h(this.instance,this._features,this.fullSchema());return this.copyInto(t),t}next(){for(;++this._featureIndex<this._features.length&&!this._getExists(););return this._featureIndex<this._features.length}readLegacyFeature(){return r(this._current,this.geometryType,this.hasZ,this.hasM)}readOptimizedFeature(){return this._current}readLegacyPointGeometry(){return this.readGeometry()?{x:this.getX(),y:this.getY()}:null}readLegacyGeometry(){const t=this.readUnquantizedGeometry();return s(t,this.geometryType,this.hasZ,this.hasM)}readLegacyCentroid(){const t=this.readCentroid();return null==t?null:{x:t.coords[0]*this._sx+this._tx,y:t.coords[1]*this._sy+this._ty}}readGeometryArea(){return o(this._current)?i(this._current.geometry,2):0}readUnquantizedGeometry(){const t=this.readGeometry();if("esriGeometryPoint"===this.geometryType||!t)return t;const e=t.clone();return d(e),e}readHydratedGeometry(){const t=this._current.geometry;if(null==t)return null;const e=t.clone();return null!=this._transform&&n(e,e,this.hasZ,this.hasM,this._transform),e}getXHydrated(){if(!o(this._current))return 0;const t=this._current.geometry.coords[0],e=this.getQuantizationTransform();return null==e?t:t*e.scale[0]+e.translate[0]}getYHydrated(){if(!o(this._current))return 0;const t=this._current.geometry.coords[1],e=this.getQuantizationTransform();return null==e?t:e.translate[1]-t*e.scale[1]}getX(){return o(this._current)?this._current.geometry.coords[0]*this._sx+this._tx:0}getY(){return o(this._current)?this._current.geometry.coords[1]*this._sy+this._ty:0}readGeometry(){if(!o(this._current)){if(null!=this._current.centroid){const[t,e]=this._current.centroid.coords;return this.createQuantizedExtrudedQuad(t,e)}return null}const t=this._current.geometry.clone();if(t.isPoint)return t.coords[0]=t.coords[0]*this._sx+this._tx,t.coords[1]=t.coords[1]*this._sy+this._ty,t;let e=0;for(const r of t.lengths)t.coords[2*e]=t.coords[2*e]*this._sx+this._tx,t.coords[2*e+1]=t.coords[2*e+1]*this._sy+this._ty,e+=r;return t}readCentroid(){return o(this._current)?this._computeCentroid():this._current.centroid}_readAttribute(t,e){const r=this._fieldsIndex.get(t);if(!r)return;let s=this._current.attributes[r.name];return null==s?s:("esriFieldTypeTimestampOffset"===this.fields.get(t)?.type&&(s=this.parseTimestampOffset(s)),e&&this.fields.isDateField(t)?new Date(s):s)}copyInto(t){super.copyInto(t),t._featureIndex=this._featureIndex,t._transform=this._transform,t._fieldsIndex=this._fieldsIndex}_readAttributes(){return this._current.attributes}}export{h as FeatureSetReaderJSON};
|
|
5
|
+
import{convertFromFeatures as t,convertFromFeatureSet as e,convertToFeature as r,convertToGeometry as s,getQuantizedArea as i,unquantizeOptimizedGeometry as n}from"../../../../../layers/graphics/featureConversionUtils.js";import{hasGeometry as o}from"../../../../../layers/graphics/OptimizedFeature.js";import u from"../../../../../layers/support/FieldsIndex.js";import{FeatureSetReader as a}from"./FeatureSetReader.js";function d({coords:t,lengths:e}){let r=0;for(const s of e){for(let e=1;e<s;e++)t[2*(r+e)]+=t[2*(r+e)-2],t[2*(r+e)+1]+=t[2*(r+e)-1];r+=s}}class h extends a{static fromFeatures(e,r){const{objectIdField:s,geometryType:i}=r,n=t([],e,i,!1,!1,s);for(let t=0;t<n.length;t++)n[t].displayId=e[t].displayId;return h.fromOptimizedFeatures(n,r)}static fromFeatureSet(t,r){const s=e(t,r.objectIdField);return h.fromOptimizedFeatureSet(s,r)}static fromOptimizedFeatureSet(t,e){const{features:r}=t,s=h.fromOptimizedFeatures(r,e);return s._exceededTransferLimit=t.exceededTransferLimit,s._transform=t.transform,s._fieldsIndex=new u(e.fields),s}static fromOptimizedFeatures(t,e,r){const s=a.createInstance(),i=new h(s,t,e);return i._fieldsIndex=new u(e.fields),i._transform=r,i}constructor(t,e,r){super(t,r),this._exceededTransferLimit=!1,this._featureIndex=-1,this._fieldsIndex=null,this._geometryType=r?.geometryType,this._features=e}get fields(){return this._fieldsIndex}get _current(){return this._features[this._featureIndex]}get geometryType(){return this._geometryType}get hasFeatures(){return!!this._features.length}get hasNext(){return this._featureIndex+1<this._features.length}get exceededTransferLimit(){return this._exceededTransferLimit}get hasZ(){return!1}get hasM(){return!1}removeIds(t){const e=new Set(t);this._features=this._features.filter((t=>!(null!=t.objectId&&e.has(t.objectId))))}append(t){for(const e of t)this._features.push(e)}getSize(){return this._features.length}getCursor(){return this.copy()}getQuantizationTransform(){return this._transform}getAttributeHash(){let t="";for(const e in this._current.attributes)t+=this._current.attributes[e];return t}getIndex(){return this._featureIndex}setIndex(t){this._featureIndex=t}getObjectId(){return this._current?.objectId}getDisplayId(){return this._current.displayId}setDisplayId(t){this._current.displayId=t}getGroupId(){return this._current.groupId}setGroupId(t){this._current.groupId=t}copy(){const t=new h(this.instance,this._features,this.fullSchema());return this.copyInto(t),t}next(){for(;++this._featureIndex<this._features.length&&!this._getExists(););return this._featureIndex<this._features.length}readLegacyFeature(){return r(this._current,this.geometryType,this.hasZ,this.hasM)}readOptimizedFeature(){return this._current}readLegacyPointGeometry(){return this.readGeometry()?{x:this.getX(),y:this.getY()}:null}readLegacyGeometry(){const t=this.readUnquantizedGeometry();return s(t,this.geometryType,this.hasZ,this.hasM)}readLegacyCentroid(){const t=this.readCentroid();return null==t?null:{x:t.coords[0]*this._sx+this._tx,y:t.coords[1]*this._sy+this._ty}}readGeometryArea(){return o(this._current)?i(this._current.geometry,2):0}readUnquantizedGeometry(){const t=this.readGeometry();if("esriGeometryPoint"===this.geometryType||!t)return t;const e=t.clone();return d(e),e}readHydratedGeometry(){const t=this._current.geometry;if(null==t)return null;const e=t.clone();return null!=this._transform&&n(e,e,this.hasZ,this.hasM,this._transform),e}getXHydrated(){if(!o(this._current))return 0;const t=this._current.geometry.coords[0],e=this.getQuantizationTransform();return null==e?t:t*e.scale[0]+e.translate[0]}getYHydrated(){if(!o(this._current))return 0;const t=this._current.geometry.coords[1],e=this.getQuantizationTransform();return null==e?t:e.translate[1]-t*e.scale[1]}getX(){return o(this._current)?this._current.geometry.coords[0]*this._sx+this._tx:0}getY(){return o(this._current)?this._current.geometry.coords[1]*this._sy+this._ty:0}readGeometry(){if(!o(this._current)){if(null!=this._current.centroid){const[t,e]=this._current.centroid.coords;return this.createQuantizedExtrudedQuad(t,e)}return null}const t=this._current.geometry.clone();if(t.isPoint)return t.coords[0]=t.coords[0]*this._sx+this._tx,t.coords[1]=t.coords[1]*this._sy+this._ty,t;let e=0;for(const r of t.lengths)t.coords[2*e]=t.coords[2*e]*this._sx+this._tx,t.coords[2*e+1]=t.coords[2*e+1]*this._sy+this._ty,e+=r;return t}readCentroid(){return o(this._current)?this._computeCentroid():this._current.centroid}_readAttribute(t,e){const r=this._fieldsIndex.get(t);if(!r)return;let s=this._current.attributes[r.name];return null==s?s:("esriFieldTypeTimestampOffset"===this.fields.get(t)?.type&&(s=this.parseTimestampOffset(s)),e&&this.fields.isDateField(t)?new Date(s):s)}copyInto(t){super.copyInto(t),t._featureIndex=this._featureIndex,t._transform=this._transform,t._fieldsIndex=this._fieldsIndex}_readAttributes(){return this._current.attributes}}export{h as FeatureSetReaderJSON};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{lerp as s}from"../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{watch as i,syncAndInitial as a,initial as o,sync as n}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{l as d,c as p,h as u}from"../../../chunks/vec3.js";import{f as m}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import{isMoon as _,isEarth as g,isMars as f}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as y}from"./AtmosphereType.js";import{ChapmanAtmosphere as v}from"./ChapmanAtmosphere.js";import{CloudsComposition as P}from"./CloudsComposition.js";import{FadeInStages as b,FadeInOutStages as R}from"./CloudsCompositionParameters.js";import{isReadyCloudsData as A,CloudsRenderingStages as x}from"./CloudsData.js";import{CloudsGenerator as N}from"./CloudsGenerator.js";import{cloudPresets as j}from"./CloudsPresets.js";import{Fog as C,FogParameters as W}from"./Fog.js";import{LocalAtmosphere as E}from"./LocalAtmosphere.js";import F from"./MarsAtmosphere.js";import{Precipitation as O}from"./Precipitation.js";import{Stars as S}from"./Stars.js";import{weatherHeightLimit as M}from"./weather.js";import{updateWeatherFading as T,weatherFadingNeedsRender as z}from"./weatherUtils.js";import{ShaderOutput as I}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderFeature as L}from"../webgl-engine/lib/RenderFeature.js";import{RenderSlot as U}from"../webgl-engine/lib/RenderSlot.js";import{Update as q}from"../webgl-engine/lib/Update.js";var H;const Q=[U.POSTPROCESSING_ENVIRONMENT_OPAQUE,U.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let V=H=class extends t{constructor(e){super(e),this._context=null,this._atmosphere=null,this._oldWeatherParameters=new k,this._newWeatherParameters=new k,this._fadedWeatherParameters=new k,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(Q,this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:y.None}get canRender(){return!(null===this._atmosphere&&null===this._stars)}get needsLinearDepth(){return this._atmosphereType===y.Realistic}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return d(this.view.state.camera.eye)-c(this.view.spatialReference).radius<=M}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return t&&null!=this._context?null!=s?s:new S({view:e,requestRender:()=>this._setNeedsRender()}):(r(s),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return r(e),null;const t=this.view,s=this._context;return null!=e&&e.context===s?e:(r(e),new O({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return r(e),null;if(null!=e)return e;const t=this.view,s=this._context;return r(e),new N({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return r(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,i=c(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(r(e),new P({rctx:s,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return r(e),null;if(null!=e)return e;const t=this.view,s=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new C({context:s,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([i((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled,highQuality:this.view.qualitySettings.highQualityAtmosphere})),(e=>this._updateAtmosphere(e)),a),i((()=>this._stars),t),i((()=>this._precipitation),t),i((()=>this._clouds),(()=>this._updateWeather()),o),i((()=>this._fog),(()=>this._updateFogHaze()),o),i((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),n),i((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),a)])}uninitializeRenderContext(){this._context=null,this._atmosphere=r(this._atmosphere),this._set("_stars",r(this._stars)),this._set("_precipitation",r(this._precipitation)),this._set("_clouds",r(this._clouds)),this._set("_cloudsComposition",r(this._cloudsComposition)),this._set("_fog",r(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=A(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(T(e.bindParameters.cloudsFade,e.bindParameters.camera,this.view.state.mode,e.time,this.view.qualitySettings.fadeDuration),this._updateWeatherFading(e.bindParameters),e.bindParameters.cloudsFade.renderingStage===x.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}render(e){if(e.output===I.Color)switch(e.bindParameters.slot){case U.POSTPROCESSING_ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?.qualitySettings.highQualityAtmosphere||this.view?._stage?.renderer?.isFeatureEnabled(L.HighQualityAtmosphere)),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),z(e.bindParameters.cloudsFade)&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case U.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?.qualitySettings.highQualityAtmosphere||this.view?._stage?.renderer?.isFeatureEnabled(L.HighQualityAtmosphere)),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),null!=this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===q.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e){if(!e.weatherFading)return;const t=e.cloudsFade;return t.fadeIn.stage===b.FADE_IN?(e.fadeLighting(t.fadeIn.factor),void this._fadeWeather(t.fadeIn.factor)):t.fadeInOut.stage===R.FADE_IN?(e.fadeLighting(t.fadeInOut.factor),void this._fadeWeather(t.fadeInOut.factor)):t.crossFade.enabled?(e.fadeLighting(t.crossFade.factor),void this._fadeWeather(t.crossFade.factor)):(e.fadeLighting(0),void this._fadeWeather(0))}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(j[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const t=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=s(3e-5,.005,e.weatherAdjustment**3),p(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),p(this._newWeatherParameters.fog.color,G),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),p(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}t.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==y.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=r(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=r(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case y.Realistic:return v;case y.Local:return E;case y.Mars:return F;default:case y.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||_(this.view.spatialReference)?y.None:s===w.Local?y.Local:null!=this._context&&v.isSupported(this._context)&&g(this.view.spatialReference)?y.Realistic:f(this.view.spatialReference)?y.Mars:y.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{B=H.prototype._getAtmosphereClass,H.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{H.prototype._getAtmosphereClass=B}}}};e([h({constructOnly:!0})],V.prototype,"view",void 0),e([h({readOnly:!0})],V.prototype,"atmosphere",null),e([h({readOnly:!0})],V.prototype,"_atmosphereType",null),e([h({type:Boolean,readOnly:!0})],V.prototype,"updating",null),e([h({readOnly:!0})],V.prototype,"weatherVisible",null),e([h()],V.prototype,"_context",void 0),e([h()],V.prototype,"_atmosphere",void 0),e([h({readOnly:!0})],V.prototype,"_stars",null),e([h({readOnly:!0})],V.prototype,"_precipitation",null),e([h({readOnly:!0})],V.prototype,"_clouds",null),e([h({readOnly:!0})],V.prototype,"_cloudsComposition",null),e([h({readOnly:!0})],V.prototype,"_fog",null),e([h({readOnly:!0})],V.prototype,"weatherEnabled",null),e([h({readOnly:!0})],V.prototype,"_precipitationEnabled",null),e([h({readOnly:!0})],V.prototype,"_weatherUpdateParameters",null),V=H=e([l("esri.views.3d.environment.EnvironmentRenderer")],V);class k{constructor(){this.fog=new W,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,p(this.fog.color,e.fog.color)}lerp(e,t,r){this.fog.amount=s(e.fog.amount,t.fog.amount,r),this.hazeAmount=s(e.hazeAmount,t.hazeAmount,r),this.fog.strength=s(e.fog.strength,t.fog.strength,r),u(this.fog.color,e.fog.color,t.fog.color,r)}}const G=m(.5,.5,.5),D=m(1.5,1.5,1.5);let B;export{V as EnvironmentRenderer,k as WeatherParameters};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{lerp as s}from"../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{watch as i,syncAndInitial as a,initial as o,sync as n}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{l as d,c as p,h as u}from"../../../chunks/vec3.js";import{f as m}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import{isMoon as _,isEarth as g,isMars as f}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as w}from"../../ViewingMode.js";import{AtmosphereType as y}from"./AtmosphereType.js";import{ChapmanAtmosphere as v}from"./ChapmanAtmosphere.js";import{CloudsComposition as P}from"./CloudsComposition.js";import{FadeInStages as b,FadeInOutStages as R}from"./CloudsCompositionParameters.js";import{isReadyCloudsData as A,CloudsRenderingStages as x}from"./CloudsData.js";import{CloudsGenerator as N}from"./CloudsGenerator.js";import{cloudPresets as j}from"./CloudsPresets.js";import{Fog as C,FogParameters as W}from"./Fog.js";import{LocalAtmosphere as E}from"./LocalAtmosphere.js";import F from"./MarsAtmosphere.js";import{Precipitation as O}from"./Precipitation.js";import{Stars as S}from"./Stars.js";import{weatherHeightLimit as M}from"./weather.js";import{updateWeatherFading as T,weatherFadingNeedsRender as z}from"./weatherUtils.js";import{ShaderOutput as I}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderFeature as L}from"../webgl-engine/lib/RenderFeature.js";import{RenderSlot as U}from"../webgl-engine/lib/RenderSlot.js";import{Update as q}from"../webgl-engine/lib/Update.js";var H;const V=[U.POSTPROCESSING_ENVIRONMENT_OPAQUE,U.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let k=H=class extends t{constructor(e){super(e),this._context=null,this._atmosphere=null,this._oldWeatherParameters=new G,this._newWeatherParameters=new G,this._fadedWeatherParameters=new G,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(V,this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:y.None}get canRender(){return!(null===this._atmosphere&&null===this._stars)}get needsLinearDepth(){return this._atmosphereType===y.Realistic}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return d(this.view.state.camera.eye)-c(this.view.spatialReference).radius<=M}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return t&&null!=this._context?null!=s?s:new S({view:e,requestRender:()=>this._setNeedsRender()}):(r(s),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return r(e),null;const t=this.view,s=this._context;return null!=e&&e.context===s?e:(r(e),new O({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return r(e),null;if(null!=e)return e;const t=this.view,s=this._context;return r(e),new N({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return r(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,i=c(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(r(e),new P({rctx:s,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return r(e),null;if(null!=e)return e;const t=this.view,s=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new C({context:s,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([i((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),a),i((()=>this._stars),t),i((()=>this._precipitation),t),i((()=>this._clouds),(()=>this._updateWeather()),o),i((()=>this._fog),(()=>this._updateFogHaze()),o),i((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),n),i((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),a)])}uninitializeRenderContext(){this._context=null,this._atmosphere=r(this._atmosphere),this._set("_stars",r(this._stars)),this._set("_precipitation",r(this._precipitation)),this._set("_clouds",r(this._clouds)),this._set("_cloudsComposition",r(this._cloudsComposition)),this._set("_fog",r(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=A(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(T(e.bindParameters.cloudsFade,e.bindParameters.camera,this.view.state.mode,e.time,this.view.qualitySettings.fadeDuration),this._updateWeatherFading(e.bindParameters),e.bindParameters.cloudsFade.renderingStage===x.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}render(e){if(e.output===I.Color)switch(e.bindParameters.slot){case U.POSTPROCESSING_ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?.qualitySettings.highResolutionAtmosphere||this.view?._stage?.renderer?.isFeatureEnabled(L.HighResolutionAtmosphere)),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),z(e.bindParameters.cloudsFade)&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case U.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?.qualitySettings.highResolutionAtmosphere||this.view?._stage?.renderer?.isFeatureEnabled(L.HighResolutionAtmosphere)),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),null!=this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===q.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e){if(!e.weatherFading)return;const t=e.cloudsFade;return t.fadeIn.stage===b.FADE_IN?(e.fadeLighting(t.fadeIn.factor),void this._fadeWeather(t.fadeIn.factor)):t.fadeInOut.stage===R.FADE_IN?(e.fadeLighting(t.fadeInOut.factor),void this._fadeWeather(t.fadeInOut.factor)):t.crossFade.enabled?(e.fadeLighting(t.crossFade.factor),void this._fadeWeather(t.crossFade.factor)):(e.fadeLighting(0),void this._fadeWeather(0))}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(j[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const t=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=s(3e-5,.005,e.weatherAdjustment**3),p(this._newWeatherParameters.fog.color,B),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),p(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),p(this._newWeatherParameters.fog.color,B),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}t.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==y.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=r(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=r(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case y.Realistic:return v;case y.Local:return E;case y.Mars:return F;default:case y.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||_(this.view.spatialReference)?y.None:s===w.Local?y.Local:null!=this._context&&v.isSupported(this._context)&&g(this.view.spatialReference)?y.Realistic:f(this.view.spatialReference)?y.Mars:y.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{Q=H.prototype._getAtmosphereClass,H.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{H.prototype._getAtmosphereClass=Q}}}};e([h({constructOnly:!0})],k.prototype,"view",void 0),e([h({readOnly:!0})],k.prototype,"atmosphere",null),e([h({readOnly:!0})],k.prototype,"_atmosphereType",null),e([h({type:Boolean,readOnly:!0})],k.prototype,"updating",null),e([h({readOnly:!0})],k.prototype,"weatherVisible",null),e([h()],k.prototype,"_context",void 0),e([h()],k.prototype,"_atmosphere",void 0),e([h({readOnly:!0})],k.prototype,"_stars",null),e([h({readOnly:!0})],k.prototype,"_precipitation",null),e([h({readOnly:!0})],k.prototype,"_clouds",null),e([h({readOnly:!0})],k.prototype,"_cloudsComposition",null),e([h({readOnly:!0})],k.prototype,"_fog",null),e([h({readOnly:!0})],k.prototype,"weatherEnabled",null),e([h({readOnly:!0})],k.prototype,"_precipitationEnabled",null),e([h({readOnly:!0})],k.prototype,"_weatherUpdateParameters",null),k=H=e([l("esri.views.3d.environment.EnvironmentRenderer")],k);class G{constructor(){this.fog=new W,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,p(this.fog.color,e.fog.color)}lerp(e,t,r){this.fog.amount=s(e.fog.amount,t.fog.amount,r),this.hazeAmount=s(e.hazeAmount,t.hazeAmount,r),this.fog.strength=s(e.fog.strength,t.fog.strength,r),u(this.fog.color,e.fog.color,t.fog.color,r)}}const D=m(.5,.5,.5),B=m(1.5,1.5,1.5);let Q;export{k as EnvironmentRenderer,G as WeatherParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{handlesGroup as t,makeHandle as i}from"../../../../../core/handleUtils.js";import{destroyMaybe as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{handlesGroup as t,makeHandle as i}from"../../../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{watch as s,when as n,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as c}from"../../../../../chunks/vec3.js";import{c as p}from"../../../../../chunks/vec3f64.js";import{getEffectiveElevationInfo as m,getEffectiveElevationMode as h}from"../../../../../support/elevationInfoUtils.js";import u from"../../../../../symbols/support/ElevationInfo.js";import{SegmentLabels3D as d}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as v}from"../../SnappingVisualizer3D.js";import{meshTransformFastUpdateHandles as f}from"../meshFastUpdateUtils.js";import{getSettings as V}from"../settings.js";import{ExtendedLineVisualElement as y}from"../../visualElements/ExtendedLineVisualElement.js";import{OutlineVisualElement as E}from"../../visualElements/OutlineVisualElement.js";import{VerticesVisualElement as w}from"../../visualElements/VerticesVisualElement.js";import{evaluateElevationAlignmentAtPoint as _}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as g}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as j}from"../../../layers/graphics/GraphicState.js";import{RenderOccludedFlag as G}from"../../../webgl-engine/lib/Material.js";import{DrawGraphicTool as S,geometryTypeToDrawOperationGeometryType as I}from"../../../../draw/DrawGraphicTool.js";import{DrawOperation as L}from"../../../../draw/DrawOperation.js";import{SceneDrawSurface as O,ElevationDrawSurface as x}from"../../../../draw/drawSurfaces.js";import{unitRGBAFromColor as D}from"../../../../support/colorUtils.js";let T=class extends S{constructor(e){super(e),this._activeVertexVisualElement=null,this._createGraphicState=null,this._outlineVisualElement=null,this._verticesVisualElement=null,this._verticalLineVisualElement=null,this.geometryType=null,this.type="draw-3d"}initialize(){const{mode:e,offset:t}=this.elevationInfo;this.internalGraphicsLayer.elevationInfo=new u({mode:e,offset:t})}normalizeCtorArgs(e){if(!e.elevationInfo){const t=e.hasZ??!0;return{...e,elevationInfo:m(t)}}return e}initializeGraphic(e){const{drawOperation:r,view:o}=this,l=this._createGraphicState=new j({graphic:e});r.loading=!0;const c=i((()=>r.loading=!1));let p;const m=()=>p&&cancelAnimationFrame(p),h=()=>{m(),p=requestAnimationFrame((()=>c.remove()))};return t([o.maskOccludee(e),o.trackGraphicState(l),s((()=>({element:this._outlineVisualElement,isDraped:l.isDraped})),(({element:e,isDraped:t})=>{e&&(e.isDraped=t)}),a),i(m),n((()=>l.displaying),h,{...a,once:!0}),c,...f(l)])}makeDrawOperation(){const{geometryType:e}=this,t="circle"!==e&&"rectangle"!==e;return new L({view:this.view,manipulators:this.manipulators,geometryType:I(e),drawingMode:this.mode,hasZ:this.hasZ,defaultZ:this.defaultZ,snapToSceneEnabled:this.snapToScene,drawSurface:new O(this.view,this.elevationInfo,[this.internalGraphicsLayer]),elevationDrawSurface:new x(this.elevationInfo,this.defaultZ,this.view,this.internalGraphicsLayer),hasM:!1,elevationInfo:this.elevationInfo,snappingManager:this.snappingManager,snappingVisualizer:new v,segmentLabels:t?new d:null,labelOptions:this.labelOptions,tooltipOptions:this.tooltipOptions,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===h(this.hasZ,this.elevationInfo),loading:!0})}onActiveVertexChanged(e){const{view:t}=this,s=V(t);if(this._activeVertexVisualElement)return this._activeVertexVisualElement.vertices=[e],this._updateVerticalLineVisualElement(e),null;const n=s.manipulators,a=n.vertex;this._activeVertexVisualElement=new w({view:t,spatialReference:t.spatialReference,vertices:[e],elevationInfo:this.internalGraphicsLayer.elevationInfo,color:D(a.color),size:a.size,outlineColor:D(a.outlineColor),outlineSize:a.outlineSize,renderOccluded:a.renderOccluded,attached:!1}),this._activeVertexVisualElement.color=D(n.selected.color),this._activeVertexVisualElement.attached=!0;const o=s.visualElements.zVerticalLine;return this._verticalLineVisualElement=new y({view:t,extensionType:o.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:G.OccludeAndTransparent}),o.apply(this._verticalLineVisualElement),i((()=>{this._activeVertexVisualElement=r(this._activeVertexVisualElement),this._verticalLineVisualElement=r(this._verticalLineVisualElement)}))}_updateVerticalLineVisualElement(e){const t=this._verticalLineVisualElement;if(!t)return;const{renderCoordsHelper:i,elevationProvider:r}=this.view;c(b,e[0],e[1],e[2]),z.setFromElevationInfo(this.elevationInfo),b[2]=_(b,r,z,i);i.toRenderCoords(b,this.view.spatialReference,b)?(t.setStartEndFromWorldDownAtLocation(b),t.attached=!0):t.attached=!1}onOutlineChanged(e){if(this._outlineVisualElement)return this._outlineVisualElement.geometry=e,null;const t=this.internalGraphicsLayer.elevationInfo,{view:s}=this,n=V(s);return this._outlineVisualElement=new E({view:s,geometry:e,elevationInfo:t,isDraped:this._createGraphicState?this._createGraphicState.isDraped:"on-the-ground"===h(this.hasZ,t),attached:!1}),n.visualElements.lineGraphics.outline.apply(this._outlineVisualElement),n.visualElements.lineGraphics.shadowStyle.apply(this._outlineVisualElement),this._outlineVisualElement.attached=!0,this._outlineVisualElement.laserlineEnabled=!0,i((()=>{this._outlineVisualElement=r(this._outlineVisualElement)}))}onRegularVerticesChanged(e){if(this._verticesVisualElement)return this._verticesVisualElement.vertices=e,null;const{view:t}=this,s=V(t).manipulators.vertex;return this._verticesVisualElement=new w({view:t,spatialReference:t.spatialReference,vertices:e,elevationInfo:this.internalGraphicsLayer.elevationInfo,color:D(s.color),size:s.size,outlineColor:D(s.outlineColor),outlineSize:s.outlineSize,renderOccluded:s.renderOccluded,attached:!1}),this._verticesVisualElement.attached=!0,i((()=>{this._verticesVisualElement=r(this._verticesVisualElement)}))}_updateGraphicGeometry(e,t){if("mesh"===this.geometryType&&"point"===t?.type){const i=this.geometryToPlace;return i&&i.centerAt(t),void(i&&e.geometry===i?i.vertexSpace.isGeoreferenced?e.notifyGeometryChanged():e.notifyMeshTransformChanged():e.geometry=i)}super._updateGraphicGeometry(e,t)}};e([o({constructOnly:!0})],T.prototype,"elevationInfo",void 0),e([o({constructOnly:!0})],T.prototype,"geometryType",void 0),e([o()],T.prototype,"type",void 0),e([o({constructOnly:!0})],T.prototype,"view",void 0),T=e([l("esri.views.3d.interactive.editingTools.draw.DrawGraphicTool3D")],T);const z=new g,b=p();export{T as DrawGraphicTool3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{makeHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{MeshTransformUpdateAction as n}from"../../../../layers/graphics/sources/interfaces.js";function o(n){const{graphic:o}=n;return[t((()=>n.displaying),(e=>{e?s(o):i(o)}),{...r}),e((()=>i(o)))]}function s(e){const{geometry:t}=e;a(t)&&e.notifyMeshTransformChanged({action:n.EnableFastUpdates})}function i(e){const{geometry:t}=e;a(t)&&e.notifyMeshTransformChanged({action:n.DisableFastUpdates})}function a(e){return"mesh"===e?.type&&!e.vertexSpace.isGeoreferenced}export{o as meshTransformFastUpdateHandles,i as tryDisableMeshTransformFastUpdates,s as tryEnableMeshTransformFastUpdates};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import i from"../../../../../core/Collection.js";import e from"../../../../../core/Evented.js";import{HandleOwnerMixin as o}from"../../../../../core/HandleOwner.js";import{makeHandle as a}from"../../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{scale as s,zeroMeters as r}from"../../../../../core/quantityUtils.js";import{watch as p,when as l,syncAndInitial as h}from"../../../../../core/reactiveUtils.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as u}from"../../../../../core/accessorSupport/decorators/subclass.js";import{makeDehydratedPoint as m}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as d,getConvertedElevation as g}from"../../../../../support/elevationInfoUtils.js";import{getGraphicAttachmentOrigin as v}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as f}from"../../SnappingVisualizer3D.js";import{SupportedGraphicResult as M}from"../isSupportedGraphicUtils.js";import{canMoveZ as _}from"../manipulatorUtils.js";import{tryDisableMeshTransformFastUpdates as y,tryEnableMeshTransformFastUpdates as w}from"../meshFastUpdateUtils.js";import{createVisualElements as j}from"../visualElementUtils.js";import{DISC_RADIUS as b}from"../manipulations/config.js";import{ManipulationType as x,MoveManipulation as S}from"../manipulations/MoveManipulation.js";import{shapeOrientation as E,axisConstrainedDragSign as T}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as O}from"../manipulations/MoveXYGraphicManipulation.js";import{isSupportedGraphic as H}from"./isSupportedGraphic.js";import{OutlineVisualElement as U}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as D}from"../../../layers/graphics/GraphicState.js";import{dragGraphicMany as X,resetGraphicMany as G}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as A}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as Y}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import z from"../../../../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as P}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as k}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as I}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicTooltipInfo as R,TranslateGraphicZTooltipInfo as F,TranslateGraphicXYTooltipInfo as Z}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as C}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as V}from"../../../../support/euclideanLengthMeasurementUtils.js";class L{constructor(t){this.allGraphics=t,this.type="graphic-move-start"}}class N{constructor(t,i,e){this.dx=t,this.dy=i,this.allGraphics=e,this.type="graphic-move"}}class q{constructor(t){this.allGraphics=t,this.type="graphic-move-stop"}}const B="manipulators";let J=class extends(o(e.EventedMixin(A))){constructor(t){super(t),this._infos=new Map,this.graphics=new i,this.enableZ=!0,this.tooltipOptions=new z,this.type="move-3d",this._moveManipulation=null,this._tooltip=null}initialize(){const{view:t}=this;this.addHandles([this.graphics.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateGraphicInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),p((()=>this.tooltipOptions.enabled),(i=>{this._tooltip=i?new I({view:t}):n(this._tooltip)}),h)]);const i=this.graphics.toArray();this._updateGraphicInfos({added:i,removed:[]}),this._setupFastTransformUpdates(i),this._refreshManipulators(),this.finishToolCreation()}destroy(){this._tooltip=n(this._tooltip),this._moveManipulation=n(this._moveManipulation),this.removeAllHandles(),this.graphics.drain(y),this._set("view",null)}get updating(){return this.updatingHandles.updating}reset(){}_updateGraphicInfos({added:t,removed:i}){for(const e of t){if(H(e)!==M.SUPPORTED)continue;const t=new K(e),i=this.view.trackGraphicState(t.state);this._infos.set(t.graphic,{info:t,handle:i})}for(const e of i)this._infos.get(e)?.handle.remove(),this._infos.delete(e)}_setupFastTransformUpdates(t){for(const i of t){const{info:t}=this._infos.get(i);this.addHandles(l((()=>t.state.displaying),(()=>w(i)),{...h,once:!0}),i),this.addHandles(a((()=>y(i))),i)}}_refreshManipulators(){if(this.removeHandles(B),this._moveManipulation=n(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values(),(({info:t})=>t));this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const i of t){const e=i.state;i.manipulationXY=new O({tool:this,view:this.view,graphicState:e}),i.manipulationXY.forEachManipulator((t=>this.addHandles([t.events.on("immediate-click",(t=>{this.emit("immediate-click",{...t,graphic:e.graphic}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{const{tooltipOptions:i,_tooltip:e}=this;null!=e&&("start"===t?e.info=new R({tooltipOptions:i}):e.clear())}))],B))),this.addHandles(i.manipulationXY.createDragPipeline(((i,e,o,a)=>this._buildDragEventPipeline(t,x.XY,i,e,o,a))),B)}this._createMoveManipulation(t)}_createMoveManipulation(t){const i=new S({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?S.radiusForSymbol(t[0].graphic.symbol):b});this._moveManipulation=i,i.elevationInfo={mode:"absolute-height",offset:0},i.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(e=>{i.zManipulation.hasManipulator(t)||1!==this.graphics.length||this.emit("immediate-click",{...e,graphic:this.graphics.at(0)}),e.stopPropagation()})),B)}));const e=i=>e=>{this.addHandles(e.events.on("focus-changed",(({action:e})=>{const o=this._tooltip;null!=o&&("focus"===e?this._updateMoveTooltip(t,i):o.clear())})),B)};this._moveManipulation.xyManipulation.forEachManipulator(e(x.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(x.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(x.Z));const o=()=>this._updateMoveManipulation(t);for(const n of t)this.addHandles([n.state.on("changed",o),p((()=>n.state.displaying),o)],B);const a=t[t.length-1];this.addHandles(a.state.on("changed",(()=>this._updateMoveManipulationAngle(a))),B),this.addHandles(i.createDragPipeline(((i,e,o,a,n)=>this._buildDragEventPipeline(t,i,e,o,a,n)),d(a.graphic),a.graphic.geometry.spatialReference,a.graphic),B),this._updateMoveManipulationAngle(a)}_createVisualElements(t){for(const i of t){const e=i.graphic,o=j({view:this.view,graphic:e,forEachManipulator:t=>{i.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>a()});null!=o&&(i.geometryRepresentation=o.visualElement,i.geometryRepresentation instanceof U&&this.addHandles([i.geometryRepresentation.events.on("attachment-origin-changed",(()=>{i.state.isDraped||this._updateMoveManipulation(t)})),p((()=>i.state.isDraped),(()=>this._updateMoveManipulation(t)))],B),this.addHandles(o,B))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=E(t.graphic.geometry))}_updateMoveManipulation(t){const i=m(0,0,0,this.view.spatialReference);let e=0,o=!1;const a=this._moveManipulation;if(a){for(const a of t){if(!a.state.displaying)continue;const t=a.state.graphic;this.enableZ&&_(t)&&(o=!0);const n=a.geometryRepresentation instanceof U&&!a.state.isDraped?a.geometryRepresentation.attachmentOrigin:v(this.view,t);if(null!=n){const{x:t,y:o,z:a}=n;i.x+=t,i.y+=o,a&&(i.z??=0,i.z+=a),e++}}e>0?(i.x/=e,i.y/=e,i.z??=0,i.z/=e,a.location=i,a.xyManipulation.available=!0,a.xyAxisManipulation.available=!0,a.zManipulation.available=o):a.available=!1}}_buildDragEventPipeline(t,i,e,o,a,n){const s=[],r=[];let p=null,l=null;const h=()=>{for(const t of s)t.dragging=!1;s.length=0,r.length=0,p=null,l=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&i===x.XY){const i=t[0].graphic;({steps:o,cancel:a}=this._buildSnappingPipelineSteps(i,d(i),o,a,n))}return a=a.next((t=>l?.(t))).next((()=>(this.emit("graphic-move-stop",new q(r)),this.destroyed||h(),null))),{steps:o=o.next((i=>{if("start"===i.action){s.length=0,r.length=0;for(const i of t)i.dragging||!i.manipulationXY?.hasManipulator(e)&&i.manipulationXY?.grabbing||(s.push(i),r.push(i.graphic),i.dragging=!0);if(0!==r.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),p=X(r,this.view.state.viewingMode),l=G(r),this.emit("graphic-move-start",new L(r)),this.destroyed))return null}return 0!==r.length?i:null})).next((t=>p?.(t))).next((e=>(this._updateMoveTooltip(t,i,e),e))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const i=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd),o=e.x-i.x,a=e.y-i.y;if(this.emit("graphic-move",new N(o,a,r)),this.destroyed)return null}break;case"end":if(this.emit("graphic-move-stop",new q(r)),this.destroyed)return null;h()}return null})),cancel:a}}_updateMoveTooltip(t,i,e){const{tooltipOptions:o,_tooltip:a}=this;if(null==a)return;a.clear();const n=0===t.length?"absolute-height":t[0].state.isDraped?"on-the-ground":"absolute-height";switch(i){case x.XY:a.info=new R({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>C(t,i,n)));break;case x.XY_AXIS:a.info=new Z({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>{const o=C(t,i,n);return s(o,T(e))}));break;case x.Z:a.info=new F({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,V)}}_updateMoveTooltipDistance(t,i,e){if(null!=i&&"end"!==i.action){const{mapStart:o,mapEnd:a}=i,n=e(o,a);t.distance=null!=n?n:r}}_buildSnappingPipelineSteps(t,i,e,o,a){const n=t.geometry;if(null==n||"point"!==n.type&&"mesh"!==n.type)return{steps:e,cancel:o};const s=("point"===n.type?n:n.anchor).clone(),r=new P({elevationInfo:i,pointer:a,editGeometryOperations:Y.fromGeometry(s,this.view.state.viewingMode),visualizer:new f,excludeFeature:t}),p=this.snappingManager,{snappingStep:l,cancelSnapping:h}=k({snappingContext:r,snappingManager:p,updatingHandles:this.updatingHandles});return o=o.next(h),{steps:e=e.next((i=>{s.z=g(this.view,s,d(t),{mode:"absolute-height",offset:0});return{...i,snapOrigin:r.coordinateHelper.pointToVector(s)}})).next(...l),cancel:o}}get test(){return{tooltip:this._tooltip}}};t([c({constructOnly:!0,nonNullable:!0})],J.prototype,"view",void 0),t([c()],J.prototype,"graphics",void 0),t([c({constructOnly:!0,nonNullable:!0})],J.prototype,"enableZ",void 0),t([c({constructOnly:!0,type:z})],J.prototype,"tooltipOptions",void 0),t([c({constructOnly:!0})],J.prototype,"snappingManager",void 0),t([c()],J.prototype,"type",void 0),t([c()],J.prototype,"updating",null),J=t([u("esri.views.3d.interactive.editingTools.graphicMove3D.GraphicMoveTool")],J);class K{constructor(t){this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1,this.state=new D({graphic:t})}get graphic(){return this.state.graphic}}export{N as GraphicMoveEvent,L as GraphicMoveStartEvent,q as GraphicMoveStopEvent,J as GraphicMoveTool};
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import i from"../../../../../core/Collection.js";import e from"../../../../../core/Evented.js";import{HandleOwnerMixin as o}from"../../../../../core/HandleOwner.js";import{makeHandle as a}from"../../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{scale as s,zeroMeters as r}from"../../../../../core/quantityUtils.js";import{watch as p,syncAndInitial as l}from"../../../../../core/reactiveUtils.js";import{property as c}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{makeDehydratedPoint as u}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as m,getConvertedElevation as d}from"../../../../../support/elevationInfoUtils.js";import{getGraphicAttachmentOrigin as g}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as v}from"../../SnappingVisualizer3D.js";import{SupportedGraphicResult as f}from"../isSupportedGraphicUtils.js";import{canMoveZ as M}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as _}from"../meshFastUpdateUtils.js";import{createVisualElements as y}from"../visualElementUtils.js";import{DISC_RADIUS as w}from"../manipulations/config.js";import{ManipulationType as j,MoveManipulation as b}from"../manipulations/MoveManipulation.js";import{shapeOrientation as x,axisConstrainedDragSign as S}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as E}from"../manipulations/MoveXYGraphicManipulation.js";import{isSupportedGraphic as T}from"./isSupportedGraphic.js";import{OutlineVisualElement as O}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as H}from"../../../layers/graphics/GraphicState.js";import{dragGraphicMany as U,resetGraphicMany as D}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as X}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as G}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import A from"../../../../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as Y}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as z}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as P}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicTooltipInfo as k,TranslateGraphicZTooltipInfo as I,TranslateGraphicXYTooltipInfo as R}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as F}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as Z}from"../../../../support/euclideanLengthMeasurementUtils.js";class C{constructor(t){this.allGraphics=t,this.type="graphic-move-start"}}class V{constructor(t,i,e){this.dx=t,this.dy=i,this.allGraphics=e,this.type="graphic-move"}}class L{constructor(t){this.allGraphics=t,this.type="graphic-move-stop"}}const N="manipulators";let q=class extends(o(e.EventedMixin(X))){constructor(t){super(t),this._infos=new Map,this.graphics=new i,this.enableZ=!0,this.tooltipOptions=new A,this.type="move-3d",this._moveManipulation=null,this._tooltip=null}initialize(){const{view:t}=this;this.addHandles([this.graphics.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateGraphicInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),p((()=>this.tooltipOptions.enabled),(i=>{this._tooltip=i?new P({view:t}):n(this._tooltip)}),l)]);const i=this.graphics.toArray();this._updateGraphicInfos({added:i,removed:[]}),this._setupFastTransformUpdates(i),this._refreshManipulators(),this.finishToolCreation()}destroy(){this._tooltip=n(this._tooltip),this._moveManipulation=n(this._moveManipulation),this.removeAllHandles(),this._set("view",null)}get updating(){return this.updatingHandles.updating}reset(){}_updateGraphicInfos({added:t,removed:i}){for(const e of t){if(T(e)!==f.SUPPORTED)continue;const t=new B(e),i=this.view.trackGraphicState(t.state);this._infos.set(t.graphic,{info:t,handle:i})}for(const e of i)this._infos.get(e)?.handle.remove(),this._infos.delete(e)}_setupFastTransformUpdates(t){for(const i of t){const{info:t}=this._infos.get(i);this.addHandles(_(t.state),i)}}_refreshManipulators(){if(this.removeHandles(N),this._moveManipulation=n(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values(),(({info:t})=>t));this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const i of t){const e=i.state;i.manipulationXY=new E({tool:this,view:this.view,graphicState:e}),i.manipulationXY.forEachManipulator((t=>this.addHandles([t.events.on("immediate-click",(t=>{this.emit("immediate-click",{...t,graphic:e.graphic}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{const{tooltipOptions:i,_tooltip:e}=this;null!=e&&("start"===t?e.info=new k({tooltipOptions:i}):e.clear())}))],N))),this.addHandles(i.manipulationXY.createDragPipeline(((i,e,o,a)=>this._buildDragEventPipeline(t,j.XY,i,e,o,a))),N)}this._createMoveManipulation(t)}_createMoveManipulation(t){const i=new b({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?b.radiusForSymbol(t[0].graphic.symbol):w});this._moveManipulation=i,i.elevationInfo={mode:"absolute-height",offset:0},i.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(e=>{i.zManipulation.hasManipulator(t)||1!==this.graphics.length||this.emit("immediate-click",{...e,graphic:this.graphics.at(0)}),e.stopPropagation()})),N)}));const e=i=>e=>{this.addHandles(e.events.on("focus-changed",(({action:e})=>{const o=this._tooltip;null!=o&&("focus"===e?this._updateMoveTooltip(t,i):o.clear())})),N)};this._moveManipulation.xyManipulation.forEachManipulator(e(j.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(j.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(e(j.Z));const o=()=>this._updateMoveManipulation(t);for(const n of t)this.addHandles([n.state.on("changed",o),p((()=>n.state.displaying),o)],N);const a=t[t.length-1];this.addHandles(a.state.on("changed",(()=>this._updateMoveManipulationAngle(a))),N),this.addHandles(i.createDragPipeline(((i,e,o,a,n)=>this._buildDragEventPipeline(t,i,e,o,a,n)),m(a.graphic),a.graphic.geometry.spatialReference,a.graphic),N),this._updateMoveManipulationAngle(a)}_createVisualElements(t){for(const i of t){const e=i.graphic,o=y({view:this.view,graphic:e,forEachManipulator:t=>{i.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>a()});null!=o&&(i.geometryRepresentation=o.visualElement,i.geometryRepresentation instanceof O&&this.addHandles([i.geometryRepresentation.events.on("attachment-origin-changed",(()=>{i.state.isDraped||this._updateMoveManipulation(t)})),p((()=>i.state.isDraped),(()=>this._updateMoveManipulation(t)))],N),this.addHandles(o,N))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=x(t.graphic.geometry))}_updateMoveManipulation(t){const i=u(0,0,0,this.view.spatialReference);let e=0,o=!1;const a=this._moveManipulation;if(a){for(const a of t){if(!a.state.displaying)continue;const t=a.state.graphic;this.enableZ&&M(t)&&(o=!0);const n=a.geometryRepresentation instanceof O&&!a.state.isDraped?a.geometryRepresentation.attachmentOrigin:g(this.view,t);if(null!=n){const{x:t,y:o,z:a}=n;i.x+=t,i.y+=o,a&&(i.z??=0,i.z+=a),e++}}e>0?(i.x/=e,i.y/=e,i.z??=0,i.z/=e,a.location=i,a.xyManipulation.available=!0,a.xyAxisManipulation.available=!0,a.zManipulation.available=o):a.available=!1}}_buildDragEventPipeline(t,i,e,o,a,n){const s=[],r=[];let p=null,l=null;const c=()=>{for(const t of s)t.dragging=!1;s.length=0,r.length=0,p=null,l=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&i===j.XY){const i=t[0].graphic;({steps:o,cancel:a}=this._buildSnappingPipelineSteps(i,m(i),o,a,n))}return a=a.next((t=>l?.(t))).next((()=>(this.emit("graphic-move-stop",new L(r)),this.destroyed||c(),null))),{steps:o=o.next((i=>{if("start"===i.action){s.length=0,r.length=0;for(const i of t)i.dragging||!i.manipulationXY?.hasManipulator(e)&&i.manipulationXY?.grabbing||(s.push(i),r.push(i.graphic),i.dragging=!0);if(0!==r.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),p=U(r,this.view.state.viewingMode),l=D(r),this.emit("graphic-move-start",new C(r)),this.destroyed))return null}return 0!==r.length?i:null})).next((t=>p?.(t))).next((e=>(this._updateMoveTooltip(t,i,e),e))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const i=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd),o=e.x-i.x,a=e.y-i.y;if(this.emit("graphic-move",new V(o,a,r)),this.destroyed)return null}break;case"end":if(this.emit("graphic-move-stop",new L(r)),this.destroyed)return null;c()}return null})),cancel:a}}_updateMoveTooltip(t,i,e){const{tooltipOptions:o,_tooltip:a}=this;if(null==a)return;a.clear();const n=0===t.length?"absolute-height":t[0].state.isDraped?"on-the-ground":"absolute-height";switch(i){case j.XY:a.info=new k({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>F(t,i,n)));break;case j.XY_AXIS:a.info=new R({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,((t,i)=>{const o=F(t,i,n);return s(o,S(e))}));break;case j.Z:a.info=new I({tooltipOptions:o}),this._updateMoveTooltipDistance(a.info,e,Z)}}_updateMoveTooltipDistance(t,i,e){if(null!=i&&"end"!==i.action){const{mapStart:o,mapEnd:a}=i,n=e(o,a);t.distance=null!=n?n:r}}_buildSnappingPipelineSteps(t,i,e,o,a){const n=t.geometry;if(null==n||"point"!==n.type&&"mesh"!==n.type)return{steps:e,cancel:o};const s=("point"===n.type?n:n.anchor).clone(),r=new Y({elevationInfo:i,pointer:a,editGeometryOperations:G.fromGeometry(s,this.view.state.viewingMode),visualizer:new v,excludeFeature:t}),p=this.snappingManager,{snappingStep:l,cancelSnapping:c}=z({snappingContext:r,snappingManager:p,updatingHandles:this.updatingHandles});return o=o.next(c),{steps:e=e.next((i=>{s.z=d(this.view,s,m(t),{mode:"absolute-height",offset:0});return{...i,snapOrigin:r.coordinateHelper.pointToVector(s)}})).next(...l),cancel:o}}get test(){return{tooltip:this._tooltip}}};t([c({constructOnly:!0,nonNullable:!0})],q.prototype,"view",void 0),t([c()],q.prototype,"graphics",void 0),t([c({constructOnly:!0,nonNullable:!0})],q.prototype,"enableZ",void 0),t([c({constructOnly:!0,type:A})],q.prototype,"tooltipOptions",void 0),t([c({constructOnly:!0})],q.prototype,"snappingManager",void 0),t([c()],q.prototype,"type",void 0),t([c()],q.prototype,"updating",null),q=t([h("esri.views.3d.interactive.editingTools.graphicMove3D.GraphicMoveTool")],q);class B{constructor(t){this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1,this.state=new H({graphic:t})}get graphic(){return this.state.graphic}}export{V as GraphicMoveEvent,C as GraphicMoveStartEvent,L as GraphicMoveStopEvent,q as GraphicMoveTool};
|