@arcgis/core 4.27.0-next.20230317 → 4.27.0-next.20230321
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/TimeExtent.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/05e47e78e258dd5ab6ea.js +1 -0
- package/assets/esri/core/workers/chunks/{b661d2c785333429aad3.js → 0b005e3502dd97562701.js} +1 -1
- package/assets/esri/core/workers/chunks/{8812629e07e5bf46caa7.js → 1d2271a36641f6834401.js} +1 -1
- package/assets/esri/core/workers/chunks/1d65a2bc91774fdbd690.js +1 -0
- package/assets/esri/core/workers/chunks/273a894ab44b76ee4488.js +1 -0
- package/assets/esri/core/workers/chunks/29ee4f14602caf6967e4.js +1 -0
- package/assets/esri/core/workers/chunks/{56ddde83f40cda0a8a5c.js → 2c0775541cfec9d43acb.js} +1 -1
- package/assets/esri/core/workers/chunks/{48a1b8be3c2a59c4c925.js → 32f9b488915a4a8864e5.js} +1 -1
- package/assets/esri/core/workers/chunks/{790d62ea3c90ca076095.js → 403c18eaa30673b096fe.js} +1 -1
- package/assets/esri/core/workers/chunks/41bbf58417f4085657f4.js +1 -0
- package/assets/esri/core/workers/chunks/{c36efbdd0a84fe851bbb.js → 433686dfda9e2ff1f98b.js} +1 -1
- package/assets/esri/core/workers/chunks/4be7647605300e07e843.js +1 -0
- package/assets/esri/core/workers/chunks/5cc99e9e974fec32b597.js +1 -0
- package/assets/esri/core/workers/chunks/6062bc79ebd5047a473a.js +1 -0
- package/assets/esri/core/workers/chunks/{57aa75a10fb8bb3fa517.js → 622139ef8f7181e48cd0.js} +1 -1
- package/assets/esri/core/workers/chunks/6b14673a4afd6ef81487.js +1 -0
- package/assets/esri/core/workers/chunks/70ea44365021b665c213.js +1 -0
- package/assets/esri/core/workers/chunks/{7727e6a4338c831f272f.js → 7570ec6a64a88ddc0fdd.js} +1 -1
- package/assets/esri/core/workers/chunks/81a6f4b43e047c3395c0.js +1 -0
- package/assets/esri/core/workers/chunks/87edeb09a948122fa030.js +1 -0
- package/assets/esri/core/workers/chunks/8daa0523d49653cc5861.js +1 -0
- package/assets/esri/core/workers/chunks/{3ff3d67f1bc6e2b2f48e.js → 90e12cff7672f3d92ced.js} +1 -1
- package/assets/esri/core/workers/chunks/{f150bd21c3b9e098da57.js → 92951b85676df776961f.js} +56 -56
- package/assets/esri/core/workers/chunks/983b26414cc46d9c3105.js +1 -0
- package/assets/esri/core/workers/chunks/{19355af765993931a7c0.js → 9b196a726c6d175ca60f.js} +1 -1
- package/assets/esri/core/workers/chunks/a27951dbe83c63f9d01a.js +1 -0
- package/assets/esri/core/workers/chunks/bc002e4dff8859571a7a.js +1 -0
- package/assets/esri/core/workers/chunks/bfc2b40f1892970281c6.js +1 -0
- package/assets/esri/core/workers/chunks/c162d1e27e779732d494.js +1 -0
- package/assets/esri/core/workers/chunks/c5d872adce711ec61ede.js +1 -0
- package/assets/esri/core/workers/chunks/c5dd23d11fa91b0f318e.js +1 -0
- package/assets/esri/core/workers/chunks/{e97c4beb3a6cf1d91310.js → c6c2f771bca0e303b5c0.js} +1 -1
- package/assets/esri/core/workers/chunks/c8f019d13f6b22481f2e.js +1 -0
- package/assets/esri/core/workers/chunks/d34dbb49508a95588423.js +1 -0
- package/assets/esri/core/workers/chunks/e637e47000f4dc48054d.js +1 -0
- package/assets/esri/core/workers/chunks/e7093d27a31345953dca.js +1 -0
- package/assets/esri/core/workers/chunks/f1ab86dbbd5b04e2a96c.js +1 -0
- package/assets/esri/core/workers/chunks/f85a01429959e60a8713.js +1 -0
- package/assets/esri/core/workers/chunks/ff9efa829497557ec26a.js +1 -0
- package/assets/esri/themes/base/widgets/_Bookmarks.scss +3 -0
- package/assets/esri/themes/base/widgets/_Editor.scss +18 -0
- package/assets/esri/themes/base/widgets/_ItemList.scss +13 -33
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ar.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_bg.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_bs.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ca.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_cs.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_da.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_de.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_el.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_es.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_et.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_fi.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_fr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_he.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_hr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_hu.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_id.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_it.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ja.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ko.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_lt.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_lv.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_nb.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_nl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pt-BR.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pt-PT.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ro.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ru.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sk.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sv.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_th.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_tr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_uk.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_vi.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-CN.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-HK.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-TW.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ar.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bg.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ca.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_cs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_da.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_de.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_el.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_es.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_et.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_he.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hu.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_id.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_it.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ja.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ko.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lt.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nb.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-BR.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-PT.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ro.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ru.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_th.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_tr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_uk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_vi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-CN.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-HK.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-TW.json +1 -1
- package/chunks/ColorMaterial.glsl.js +16 -14
- package/core/domUtils.js +1 -1
- package/core/maybe.js +1 -1
- package/core/urlUtils.js +1 -1
- package/geohash/GeohashTree.js +1 -1
- package/interfaces.d.ts +12 -214
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/support/FieldsIndex.js +1 -1
- package/layers/support/fieldType.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/rasterFunctionConstants.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/CurvatureFunction.js +5 -0
- package/layers/support/rasterFunctions/CurvatureFunctionArguments.js +5 -0
- package/layers/support/rasterFunctions/SlopeFunction.js +1 -1
- package/layers/support/rasterFunctions/rasterFunctionHelper.js +1 -1
- package/layers/support/rasterFunctions/surfaceUtils.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/imagery/processor/curvatureProcessor.js +5 -0
- package/views/2d/engine/imagery/processor/rasterProcessor.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/features/support/BinStore.js +1 -1
- package/views/2d/layers/features/support/ClusterStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBFIndirect.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/environment/CloudsData.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.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/ScaleRotateObjectSymbol3DAdapter.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/interfaces.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/buffer/workerHelper.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderParameters.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
- package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
- package/views/interactive/tooltip/TransformTooltipInfos.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
- package/widgets/Bookmarks/css.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/Upload.js +5 -0
- package/widgets/Editor/UploadState.js +4 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/{InputField.js → FieldInput.js} +1 -1
- package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
- package/widgets/FeatureForm/GroupInput.js +5 -0
- package/widgets/FeatureForm/css.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/FeatureTemplates/TemplateItem.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/Fullscreen/FullscreenViewModel.js +1 -1
- package/widgets/LayerList/LayerListViewModel.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/009348f65fab440f7752.js +0 -1
- package/assets/esri/core/workers/chunks/075ecd53fb229dfee53c.js +0 -1
- package/assets/esri/core/workers/chunks/1c77b92063ee36421914.js +0 -1
- package/assets/esri/core/workers/chunks/1ee774c3f29d8074da12.js +0 -1
- package/assets/esri/core/workers/chunks/262b6de5a29c713b4010.js +0 -1
- package/assets/esri/core/workers/chunks/281c0f936b5645a673ab.js +0 -1
- package/assets/esri/core/workers/chunks/2883a59fc1fc9e4d71af.js +0 -1
- package/assets/esri/core/workers/chunks/2e032a58ac6717313227.js +0 -1
- package/assets/esri/core/workers/chunks/4d4cbfe72835c0460b09.js +0 -1
- package/assets/esri/core/workers/chunks/5504dff4113dd74d2fa7.js +0 -1
- package/assets/esri/core/workers/chunks/5bded2588008117d0c35.js +0 -1
- package/assets/esri/core/workers/chunks/6caf8a0b49bd01906f32.js +0 -1
- package/assets/esri/core/workers/chunks/9cab04c71d8bccf0156d.js +0 -1
- package/assets/esri/core/workers/chunks/9f02a0670ad73718d8f9.js +0 -1
- package/assets/esri/core/workers/chunks/a265e454461edb306e2d.js +0 -1
- package/assets/esri/core/workers/chunks/a50ca44a62434bf18664.js +0 -1
- package/assets/esri/core/workers/chunks/bd090f9ec6cfe08e19a3.js +0 -1
- package/assets/esri/core/workers/chunks/c3338bdce8368731c4e9.js +0 -1
- package/assets/esri/core/workers/chunks/c54df59b2b3f73828a44.js +0 -1
- package/assets/esri/core/workers/chunks/ddebf3b5a131a6da5419.js +0 -1
- package/assets/esri/core/workers/chunks/de461c30aa24ec8bb212.js +0 -1
- package/assets/esri/core/workers/chunks/e23f56bee694a38da5b9.js +0 -1
- package/assets/esri/core/workers/chunks/ec73d16ef169adfc34fb.js +0 -1
- package/assets/esri/core/workers/chunks/ef884e2833868234c13c.js +0 -1
- package/assets/esri/core/workers/chunks/f3c99525fb1b0f719fe0.js +0 -1
- package/assets/esri/core/workers/chunks/fe314feede84dd688010.js +0 -1
- package/assets/esri/core/workers/chunks/ff15557dc7b74162ed75.js +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ar.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_bg.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_bs.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ca.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_cs.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_da.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_de.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_el.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_en.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_es.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_et.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_fi.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_fr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_he.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_hr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_hu.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_id.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_it.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ja.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ko.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_lt.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_lv.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_nb.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_nl.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_pl.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_pt-BR.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_pt-PT.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ro.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ru.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sk.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sl.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sv.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_th.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_tr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_uk.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_vi.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_zh-CN.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_zh-HK.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_zh-TW.json +0 -1
- package/widgets/FeatureForm/InputField.d.ts +0 -4
- package/widgets/FeatureForm/InputFieldGroup.d.ts +0 -4
- package/widgets/FeatureForm/InputFieldGroup.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../../geometry.js";import e from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{applySome as s
|
|
5
|
+
import"../../../../../geometry.js";import e from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import t from"../../../../../core/Logger.js";import{applySome as s}from"../../../../../core/maybe.js";import{diff as r,hasDiff as i}from"../../../../../core/accessorSupport/diffUtils.js";import{GeohashTree as o}from"../../../../../geohash/GeohashTree.js";import{setGeohashBuf as a,setGeohashXY as h}from"../../../../../geohash/geohashUtils.js";import{create as n}from"../../../../../geometry/support/aaBoundingBox.js";import{earth as d}from"../../../../../geometry/support/Ellipsoid.js";import{getInfo as l}from"../../../../../geometry/support/spatialReferenceUtils.js";import{getBoundsOptimizedGeometry as g,convertToGeometry as p,convertFromPolygon as u}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as c}from"../../../../../layers/graphics/OptimizedFeature.js";import f from"../../../../../layers/graphics/OptimizedGeometry.js";import{checkProjectionSupport as m,project as _}from"../../../../../layers/graphics/data/projectionSupport.js";import{createDisplayId as y}from"../../../engine/webgl/DisplayId.js";import{featureAdapter as I}from"../FeatureStore2D.js";import{Store2D as b}from"../Store2D.js";import{FeatureSetReaderJSON as j}from"./FeatureSetReaderJSON.js";import v from"../../../../../geometry/SpatialReference.js";import B from"../../../../../geometry/Polygon.js";import x from"../../../../../geometry/Extent.js";const S=t.getLogger("esri.view.2d.layers.features.support.BinStore"),F=12,G=64,R=n(),L=5;function T(e){return 57.29577951308232*e}class A extends b{constructor(t,s,r,i){super(t,r),this.type="bin",this.events=new e,this.objectIdField="aggregateId",this.featureAdapter=I,this._geohashLevel=L,this._geohashBuf=[],this._serviceInfo=i,this.geometryInfo=t.geometryInfo,this._spatialReference=s,this._projectionSupportCheck=m(s,v.WGS84),this._bitsets.geohash=r.getBitset(r.createBitset()),this._bitsets.inserted=r.getBitset(r.createBitset())}destroy(){this._tree&&this._tree.destroy()}get featureSpatialReference(){return this._spatialReference}get fields(){return this._fields}async updateSchema(e,t){const s=this._schema;try{await super.updateSchema(e,t),await this._projectionSupportCheck}catch(h){}this._fields=this._schema.params.fields;const a=r(s,t);t&&(null!=a||e.source||e.storage.filters)?((i(a,"params.fields")||i(a,"params")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new o(this._statisticFields,this._serviceInfo),this._tree.onRelease=e=>e.displayId&&this._storage.releaseDisplayId(e.displayId),this._geohashLevel=this._schema.params.fixedBinLevel,this._rebuildTree(),has("esri-2d-update-debug")&&S.info("Aggregate mesh needs update due to tree changing")),has("esri-2d-update-debug")&&S.info("Aggregate mesh needs update due to tree changing"),e.targets[t.name]=!0,e.mesh=!1):s&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet((s=>{if(!e.has(s)){const e=t.lookupByDisplayIdUnsafe(s);this._remove(e)}}))}sweepAggregates(e,t,s){}onTileData(e,t,s,r,i=!0){if(!this._schema||null==t.addOrUpdate)return t;this.events.emit("changed");const o=this._getTransforms(e,this._spatialReference);{const e=t.addOrUpdate.getCursor();for(;e.next();)this._update(e,r)}if(t.status.mesh||!i)return t;const a=new Array;this._getBinsForTile(a,e,o,s),t.addOrUpdate=j.fromOptimizedFeatures(a,{fields:this.fields,geometryType:"esriGeometryPolygon",objectIdField:this.objectIdField}),t.addOrUpdate.attachStorage(s),t.end=!0,t.isRepush||(t.clear=!0);{const r=t.addOrUpdate.getCursor();for(;r.next();){const t=r.getDisplayId();this._bitsets.computed.unset(t),this.setComputedAttributes(s,r,t,e.scale)}}return t}forEachBin(e){this._tree.forEach(e)}forEach(e){this._tree.forEach((t=>{if(t.depth!==this._geohashLevel)return;const s=this._toFeatureJSON(t),r=j.fromFeatures([s],{objectIdField:this.objectIdField,globalIdField:null,geometryType:this.geometryInfo.geometryType,fields:this.fields}).getCursor();r.next(),e(r)}))}forEachInBounds(e,t){}forEachBounds(e,t){const{hasM:s,hasZ:r}=this.geometryInfo;for(const i of e){const e=g(R,i.readGeometry(),r,s);null!=e&&t(e)}}onTileUpdate(e){}getAggregate(e){const t=y(e,!0),r=this._tree.findIf((e=>e.displayId===t));return s(r,(e=>this._toFeatureJSON(e)))}getAggregates(){return this._tree.findAllIf((e=>e.depth===this._geohashLevel)).map(this._toFeatureJSON.bind(this))}getDisplayId(e){const t=this._tree.findIf((t=>t.id===e));return s(t,(e=>e.displayId))}getFeatureDisplayIdsForAggregate(e){const t=this._tree.findIf((t=>t.id===e));return null!=t?Array.from(t.displayIds):[]}getDisplayIdForReferenceId(e){const t=this._tree.findIf((t=>1===t.displayIds.size&&t.displayIds.has(e)));return s(t,(e=>e.displayId))}_toFeatureJSON(e){const t=this._spatialReference;return{displayId:e.displayId,attributes:e.getAttributes(),geometry:p(e.getGeometry(t),"esriGeometryPolygon",!1,!1),centroid:null}}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),i=this._geohashBuf[2*t],o=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,i,o,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,i=t.isVisible(s);if(i===r.has(s))return;if(!i)return void this._remove(e);const o=e.getXHydrated(),a=e.getYHydrated();if(!this._setGeohash(s,o,a))return;const h=this._geohashBuf[2*s],n=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,o,a,h,n,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const i=T(t/d.radius),o=i-360*Math.floor((i+180)/360),h=T(Math.PI/2-2*Math.atan(Math.exp(-s/d.radius)));a(r,e,h,o,F)}else{const i=_({x:t,y:s},this._spatialReference,v.WGS84);if(!i)return!1;a(r,e,i.y,i.x,F)}return this._bitsets.geohash.set(e),!0}_getBinsForTile(e,t,s,r){try{const i=this._getGeohashBounds(t),o=this._tree.getBins(i);for(const t of o){t.displayId||(t.displayId=r.createDisplayId(!0));let i=null;const o=t.getGeometry(this._spatialReference,s.tile);o||(i=t.getGeometryCentroid(this._spatialReference,s.tile));const a=new c(o,t.getAttributes(),i);a.objectId=t.id,a.displayId=t.displayId,e.push(a)}}catch(i){return void S.error("Unable to get bins for tile",t.key.id)}}_getGeohash(e,t,s){const r={geohashX:0,geohashY:0};return h(r,t,e,s),r}_getGeohashBounds(e){const t=this._getGeohashLevel(e.key.level),s=[e.extent.xmin,e.extent.ymin,e.extent.xmax,e.extent.ymax],r=B.fromExtent(x.fromBounds(s,this._spatialReference)),i=_(r,this._spatialReference,v.WGS84,{densificationStep:e.resolution*G}),o=u(new f,i,!1,!1),a=o.coords.filter(((e,t)=>!(t%2))),h=o.coords.filter(((e,t)=>t%2)),n=Math.min(...a),d=Math.min(...h),l=Math.max(...a),g=Math.max(...h),p=this._getGeohash(n,d,t),c=this._getGeohash(l,g,t);return{bounds:s,geohashBounds:{xLL:p.geohashX,yLL:p.geohashY,xTR:c.geohashX,yTR:c.geohashY},level:t}}_getGeohashLevel(e){return this._schema.params.fixedBinLevel}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=l(t);if(!r)return{tile:s,left:null,right:null};const[i,o]=r.valid;return{tile:s,left:{...s,translate:[o,e.bounds[3]]},right:{...s,translate:[i-o+e.bounds[0],e.bounds[3]]}}}}export{A as BinStore};
|
|
@@ -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"../../../../../geometry.js";import e from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import{applySome as t}from"../../../../../core/maybe.js";import{diff as s,hasDiff as r}from"../../../../../core/accessorSupport/diffUtils.js";import{GeohashTree as o}from"../../../../../geohash/GeohashTree.js";import{setGeohashBuf as a,setGeohashXY as i}from"../../../../../geohash/geohashUtils.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{earth as n}from"../../../../../geometry/support/Ellipsoid.js";import{getInfo as l}from"../../../../../geometry/support/spatialReferenceUtils.js";import{getBoundsOptimizedGeometry as u,quantizeX as g,quantizeY as c,convertFromPolygon as d}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeatureWithGeometry as f,OptimizedFeature as p}from"../../../../../layers/graphics/OptimizedFeature.js";import m from"../../../../../layers/graphics/OptimizedGeometry.js";import{checkProjectionSupport as _,project as y}from"../../../../../layers/graphics/data/projectionSupport.js";import{TILE_SIZE as I}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TEXEL_MASK as b}from"../../../engine/webgl/DisplayId.js";import{featureAdapter as v}from"../FeatureStore2D.js";import{Store2D as R}from"../Store2D.js";import{FeatureSetReaderJSON as M}from"./FeatureSetReaderJSON.js";import x from"../../../../../geometry/SpatialReference.js";import C from"../../../../../geometry/Polygon.js";import j from"../../../../../geometry/Extent.js";const L=12,B=64,F=1,w=h();class S extends f{constructor(e,t,s,r,o){super(new m([],[t,s]),r,null,e),this.geohashBoundsInfo=o}get count(){return this.attributes.cluster_count}static create(e,t,s,r,o,a,i,h){const n=new S(t,s,r,a,i);return n.displayId=e.createDisplayId(!0),n.referenceId=h,n.tileLevel=o,n}update(e,t,s,r,o,a){return this.geometry.coords[0]=e,this.geometry.coords[1]=t,this.tileLevel=s,this.attributes=r,this.geohashBoundsInfo=o,this.referenceId=null,this.referenceId=a,this}toJSON(){return{attributes:{...this.attributes,aggregateId:this.objectId,referenceId:1===this.attributes.cluster_count?this.referenceId:null},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function V(e){return 57.29577951308232*e}class T extends R{constructor(t,s,r,o){super(t,r),this.type="cluster",this.events=new e,this.objectIdField="aggregateId",this.featureAdapter=v,this._geohashLevel=0,this._tileLevel=0,this._aggregateValueRanges={},this._aggregateValueRangesChanged=!1,this._geohashBuf=[],this._clusters=new Map,this._tiles=new Map,this._serviceInfo=o,this.geometryInfo=t.geometryInfo,this._spatialReference=s,this._projectionSupportCheck=_(s,x.WGS84),this._bitsets.geohash=r.getBitset(r.createBitset()),this._bitsets.inserted=r.getBitset(r.createBitset())}destroy(){this._tree.destroy()}get featureSpatialReference(){return this._spatialReference}get fields(){return this._fields}async updateSchema(e,t){const a=this._schema;try{await super.updateSchema(e,t),await this._projectionSupportCheck}catch(h){}this._fields=this._schema.params.fields;const i=s(a,t);t&&(null!=i||e.source||e.storage.filters)?((r(i,"params.fields")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new o(this._statisticFields,this._serviceInfo),this._rebuildTree(),has("esri-2d-update-debug")&&console.debug("Aggregate mesh needs update due to tree changing")),has("esri-2d-update-debug")&&console.debug("Applying Update - ClusterStore:",i),e.targets[t.name]=!0,e.mesh=!1,this._aggregateValueRanges={}):a&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet((s=>{if(!e.has(s)){const e=t.lookupByDisplayIdUnsafe(s);this._remove(e)}}))}sweepAggregates(e,t,s){this._clusters.forEach(((r,o)=>{r&&r.tileLevel!==s&&(e.releaseDisplayId(r.displayId),t.unsetAttributeData(r.displayId),this._clusters.delete(o))}))}onTileData(e,t,s,r,o=!0){if(!this._schema||null==t.addOrUpdate)return t;this.events.emit("changed");const a=this._getTransforms(e,this._spatialReference);{const e=t.addOrUpdate.getCursor();for(;e.next();)this._update(e,r)}if(t.status.mesh||!o)return t;const i=new Array,h=this._schema.params.clusterRadius;this._getClustersForTile(i,e,h,s,a),t.addOrUpdate=M.fromOptimizedFeatures(i,this._serviceInfo),t.addOrUpdate.attachStorage(s),t.clear=!0,t.end=!0;{const r=t.addOrUpdate.getCursor();for(;r.next();){const t=r.getDisplayId();this._bitsets.computed.unset(t),this.setComputedAttributes(s,r,t,e.scale)}}return this._aggregateValueRangesChanged&&t.end&&(this.events.emit("valueRangesChanged",{valueRanges:this._aggregateValueRanges}),this._aggregateValueRangesChanged=!1),t}onTileUpdate({added:e,removed:t}){if(e.length){const t=e[0].level;this._tileLevel=t,this._setGeohashLevel(t)}if(!this._schema)return;const s=this._schema.params.clusterRadius;t.forEach((e=>{this._tiles.delete(e.key.id),this._markTileClustersForDeletion(e,s)}))}getAggregate(e){for(const t of this._clusters.values())if((t?.displayId&b)==(e&b))return t.toJSON();return null}getAggregates(){const e=[];for(const t of this._clusters.values())t?.tileLevel===this._tileLevel&&e.push(t.toJSON());return e}getDisplayId(e){const t=this._clusters.get(e);return t?t.displayId:null}getFeatureDisplayIdsForAggregate(e){const t=this._clusters.get(e);return t?this._tree.getRegionDisplayIds(t.geohashBoundsInfo):[]}getDisplayIdForReferenceId(e){for(const t of this._clusters.values())if(t?.referenceId===e)return t.displayId;return null}getAggregateValueRanges(){return this._aggregateValueRanges}forEach(e){this._clusters.forEach((t=>{if(!t)return;const s=t.toJSON(),r=M.fromFeatures([s],{objectIdField:this.objectIdField,globalIdField:null,geometryType:this.geometryInfo.geometryType,fields:this.fields}).getCursor();r.next(),e(r)}))}forEachInBounds(e,t){}forEachBounds(e,t){const{hasM:s,hasZ:r}=this.geometryInfo;for(const o of e){const e=u(w,o.readGeometry(),r,s);null!=e&&t(e)}}size(){let e=0;return this.forEach((t=>e++)),e}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),o=this._geohashBuf[2*t],a=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,o,a,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,o=t.isVisible(s);if(o===r.has(s))return;if(!o)return void this._remove(e);const a=e.getXHydrated(),i=e.getYHydrated();if(!this._setGeohash(s,a,i))return;const h=this._geohashBuf[2*s],n=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,a,i,h,n,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const o=V(t/n.radius),i=o-360*Math.floor((o+180)/360),h=V(Math.PI/2-2*Math.atan(Math.exp(-s/n.radius)));a(r,e,h,i,L)}else{const o=y({x:t,y:s},this._spatialReference,x.WGS84);if(!o)return!1;a(r,e,o.y,o.x,L)}return this._bitsets.geohash.set(e),!0}_getClustersForTile(e,s,r,o,a,i=!0){const h=this._schema.params.clusterPixelBuffer,n=2*r,l=Math.ceil(2**s.key.level*I/n)+1,u=Math.ceil(h/n)+0,d=Math.ceil(I/n),{row:f,col:m}=s.key,_=m*I,y=f*I,b=Math.floor(_/n)-u,v=Math.floor(y/n)-u,R=b+d+2*u,M=v+d+2*u,x=s.tileInfoView.getLODInfoAt(s.key.level);for(let I=b;I<=R;I++)for(let r=v;r<=M;r++){let h=I;x.wrap&&(h=I<0?I+l:I%l);const n=x.wrap&&I<0,u=x.wrap&&I%l!==I,d=this._lookupCluster(o,x,s.key.level,h,r,s);if(null!=d){const s=t(a,(e=>n?e.left:u?e.right:e.tile));if(i&&null==s)continue;if(!d.count)continue;if(null!=s&&i){const t=d.geometry.clone();let r=d.attributes;t.coords[0]=g(s,t.coords[0]),t.coords[1]=c(s,t.coords[1]),1===d.count&&null!=d.referenceId&&(r={...d.attributes,referenceId:d.referenceId});const o=new p(t,r);o.displayId=d.displayId,e.push(o)}}}}_getGeohashLevel(e){return Math.min(Math.ceil(e/2+2),L)}_setGeohashLevel(e){const t=this._getGeohashLevel(e),s=(Math.floor(t/F)+1)*F-1;if(this._geohashLevel!==s)return this._geohashLevel=s,this._rebuildTree(),void this._bitsets.geohash.clear()}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=l(t);if(!r)return{tile:s,left:null,right:null};const[o,a]=r.valid;return{tile:s,left:{...s,translate:[a,e.bounds[3]]},right:{...s,translate:[o-a+e.bounds[0],e.bounds[3]]}}}_getClusterId(e,t,s){return(15&e)<<28|(16383&t)<<14|16383&s}_markForDeletion(e,t,s){const r=this._getClusterId(e,t,s);this._clusters.delete(r)}_getClusterBounds(e,t,s){const r=this._schema.params.clusterRadius,o=2*r;let a=s%2?t*o:t*o-r;const i=s*o;let h=a+o;const n=i-o,l=2**e.level*I;e.wrap&&a<0&&(a=0),e.wrap&&h>l&&(h=l);const u=a/I,g=i/I,c=h/I,d=n/I;return[e.getXForColumn(u),e.getYForRow(g),e.getXForColumn(c),e.getYForRow(d)]}_getGeohash(e,t,s){const r={geohashX:0,geohashY:0};return i(r,t,e,s),r}_getGeohashBounds(e,t){const s=this._getGeohashLevel(e.key.level);if(this._spatialReference.isWebMercator){const[e,r,o,a]=t,h={x:e,y:r},l={x:o,y:a};let u=0,g=0,c=0,d=0;{const e=V(h.x/n.radius);u=e-360*Math.floor((e+180)/360),g=V(Math.PI/2-2*Math.atan(Math.exp(-h.y/n.radius)))}{const e=V(l.x/n.radius);c=e-360*Math.floor((e+180)/360),d=V(Math.PI/2-2*Math.atan(Math.exp(-l.y/n.radius)))}const f={geohashX:0,geohashY:0},p={geohashX:0,geohashY:0};i(f,g,u,s),i(p,d,c,s);return{bounds:[e,r,o,a],geohashBounds:{xLL:f.geohashX,yLL:f.geohashY,xTR:p.geohashX,yTR:p.geohashY},level:s}}const r=C.fromExtent(j.fromBounds(t,this._spatialReference)),o=y(r,this._spatialReference,x.WGS84,{densificationStep:e.resolution*B});if(!o)return null;const a=d(new m,o,!1,!1),h=a.coords.filter(((e,t)=>!(t%2))),l=a.coords.filter(((e,t)=>t%2)),u=Math.min(...h),g=Math.min(...l),c=Math.max(...h),f=Math.max(...l),p=this._getGeohash(u,g,s),_=this._getGeohash(c,f,s);return{bounds:t,geohashBounds:{xLL:p.geohashX,yLL:p.geohashY,xTR:_.geohashX,yTR:_.geohashY},level:s}}_lookupCluster(e,t,s,r,o,a){const i=this._getClusterId(s,r,o),h=this._clusters.get(i),n=this._getClusterBounds(t,r,o),l=this._getGeohashBounds(a,n);if(null==l)return null;const u=this._tree.getRegionStatistics(l),{count:g,xTotal:c,yTotal:d,referenceId:f}=u,p=g?c/g:0,m=g?d/g:0;if(0===g)return this._clusters.set(i,null),null;const _={cluster_count:g,...u.attributes},y=null!=h?h.update(p,m,s,_,l,f):S.create(e,i,p,m,s,_,l,f);if(0===g){const[e,t,s,r]=n;y.geometry.coords[0]=(e+s)/2,y.geometry.coords[1]=(t+r)/2}return this._clusters.set(i,y),this._updateAggregateValueRangeForCluster(y,y.tileLevel),y}_updateAggregateValueRangeForCluster(e,t){const s=this._aggregateValueRanges[t]||{minValue:1/0,maxValue:0},r=s.minValue,o=s.maxValue;s.minValue=Math.min(r,e.count),s.maxValue=Math.max(o,e.count),this._aggregateValueRanges[t]=s,r===s.minValue&&o===s.maxValue||(this._aggregateValueRangesChanged=!0)}_markTileClustersForDeletion(e,t){const s=2*t,r=Math.ceil(I/s),{row:o,col:a}=e.key,i=a*I,h=o*I,n=Math.floor(i/s),l=Math.floor(h/s);for(let u=n;u<n+r;u++)for(let t=l;t<l+r;t++)this._markForDeletion(e.key.level,u,t)}}export{S as ClusterInfo,T as ClusterStore};
|
|
5
|
+
import"../../../../../geometry.js";import e from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import{applySome as t}from"../../../../../core/maybe.js";import{diff as s,hasDiff as r}from"../../../../../core/accessorSupport/diffUtils.js";import{GeohashTree as o}from"../../../../../geohash/GeohashTree.js";import{setGeohashBuf as i,setGeohashXY as a}from"../../../../../geohash/geohashUtils.js";import{create as h}from"../../../../../geometry/support/aaBoundingBox.js";import{earth as n}from"../../../../../geometry/support/Ellipsoid.js";import{getInfo as l}from"../../../../../geometry/support/spatialReferenceUtils.js";import{getBoundsOptimizedGeometry as u,quantizeX as g,quantizeY as c,convertFromPolygon as d}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeatureWithGeometry as f,OptimizedFeature as p}from"../../../../../layers/graphics/OptimizedFeature.js";import m from"../../../../../layers/graphics/OptimizedGeometry.js";import{checkProjectionSupport as _,project as y}from"../../../../../layers/graphics/data/projectionSupport.js";import{TILE_SIZE as I}from"../../../engine/webgl/definitions.js";import{DISPLAY_ID_TEXEL_MASK as b}from"../../../engine/webgl/DisplayId.js";import{featureAdapter as v}from"../FeatureStore2D.js";import{Store2D as R}from"../Store2D.js";import{FeatureSetReaderJSON as M}from"./FeatureSetReaderJSON.js";import x from"../../../../../geometry/SpatialReference.js";import j from"../../../../../geometry/Polygon.js";import C from"../../../../../geometry/Extent.js";const F=12,L=64,B=1,w=h();class S extends f{constructor(e,t,s,r,o){super(new m([],[t,s]),r,null,e),this.geohashBoundsInfo=o}get count(){return this.attributes.cluster_count}static create(e,t,s,r,o,i,a,h){const n=new S(t,s,r,i,a);return n.displayId=e.createDisplayId(!0),n.referenceId=h,n.tileLevel=o,n}update(e,t,s,r,o,i){return this.geometry.coords[0]=e,this.geometry.coords[1]=t,this.tileLevel=s,this.attributes=r,this.geohashBoundsInfo=o,this.referenceId=null,this.referenceId=i,this}toJSON(){return{attributes:{...this.attributes,aggregateId:this.objectId,referenceId:1===this.attributes.cluster_count?this.referenceId:null},geometry:{x:this.geometry.coords[0],y:this.geometry.coords[1]}}}}function T(e){return 57.29577951308232*e}class V extends R{constructor(t,s,r,o){super(t,r),this.type="cluster",this.events=new e,this.objectIdField="aggregateId",this.featureAdapter=v,this._geohashLevel=0,this._tileLevel=0,this._aggregateValueRanges={},this._aggregateValueRangesChanged=!1,this._geohashBuf=[],this._clusters=new Map,this._tiles=new Map,this._serviceInfo=o,this.geometryInfo=t.geometryInfo,this._spatialReference=s,this._projectionSupportCheck=_(s,x.WGS84),this._bitsets.geohash=r.getBitset(r.createBitset()),this._bitsets.inserted=r.getBitset(r.createBitset())}destroy(){this._tree.destroy()}get featureSpatialReference(){return this._spatialReference}get fields(){return this._fields}async updateSchema(e,t){const i=this._schema;try{await super.updateSchema(e,t),await this._projectionSupportCheck}catch(h){}this._fields=[...this._schema.params.fields,{name:"referenceId",alias:"referenceId",type:"esriFieldTypeInteger"}];const a=s(i,t);t&&(null!=a||e.source||e.storage.filters)?((r(a,"params.fields")||!this._tree||e.source)&&(this._tree&&this._tree.destroy(),this._tree=new o(this._statisticFields,this._serviceInfo),this._rebuildTree(),has("esri-2d-update-debug")&&console.debug("Aggregate mesh needs update due to tree changing")),has("esri-2d-update-debug")&&console.debug("Applying Update - ClusterStore:",a),e.targets[t.name]=!0,e.mesh=!1,this._aggregateValueRanges={}):i&&(e.mesh=!0)}clear(){this._rebuildTree()}sweepFeatures(e,t){this._bitsets.inserted.forEachSet((s=>{if(!e.has(s)){const e=t.lookupByDisplayIdUnsafe(s);this._remove(e)}}))}sweepAggregates(e,t,s){this._clusters.forEach(((r,o)=>{r&&r.tileLevel!==s&&(e.releaseDisplayId(r.displayId),t.unsetAttributeData(r.displayId),this._clusters.delete(o))}))}onTileData(e,t,s,r,o=!0){if(!this._schema||null==t.addOrUpdate)return t;this.events.emit("changed");const i=this._getTransforms(e,this._spatialReference);{const e=t.addOrUpdate.getCursor();for(;e.next();)this._update(e,r)}if(t.status.mesh||!o)return t;const a=new Array,h=this._schema.params.clusterRadius;this._getClustersForTile(a,e,h,s,i),t.addOrUpdate=M.fromOptimizedFeatures(a,{fields:this.fields,geometryType:"esriGeometryPoint",objectIdField:this.objectIdField}),t.addOrUpdate.attachStorage(s),t.clear=!0,t.end=!0;{const r=t.addOrUpdate.getCursor();for(;r.next();){const t=r.getDisplayId();this._bitsets.computed.unset(t),this.setComputedAttributes(s,r,t,e.scale)}}return this._aggregateValueRangesChanged&&t.end&&(this.events.emit("valueRangesChanged",{valueRanges:this._aggregateValueRanges}),this._aggregateValueRangesChanged=!1),t}onTileUpdate({added:e,removed:t}){if(e.length){const t=e[0].level;this._tileLevel=t,this._setGeohashLevel(t)}if(!this._schema)return;const s=this._schema.params.clusterRadius;t.forEach((e=>{this._tiles.delete(e.key.id),this._markTileClustersForDeletion(e,s)}))}getAggregate(e){for(const t of this._clusters.values())if((t?.displayId&b)==(e&b))return t.toJSON();return null}getAggregates(){const e=[];for(const t of this._clusters.values())t?.tileLevel===this._tileLevel&&e.push(t.toJSON());return e}getDisplayId(e){const t=this._clusters.get(e);return t?t.displayId:null}getFeatureDisplayIdsForAggregate(e){const t=this._clusters.get(e);return t?this._tree.getRegionDisplayIds(t.geohashBoundsInfo):[]}getDisplayIdForReferenceId(e){for(const t of this._clusters.values())if(t?.referenceId===e)return t.displayId;return null}getAggregateValueRanges(){return this._aggregateValueRanges}forEach(e){this._clusters.forEach((t=>{if(!t)return;const s=t.toJSON(),r=M.fromFeatures([s],{objectIdField:this.objectIdField,globalIdField:null,geometryType:this.geometryInfo.geometryType,fields:this.fields}).getCursor();r.next(),e(r)}))}forEachInBounds(e,t){}forEachBounds(e,t){const{hasM:s,hasZ:r}=this.geometryInfo;for(const o of e){const e=u(w,o.readGeometry(),r,s);null!=e&&t(e)}}size(){let e=0;return this.forEach((t=>e++)),e}_rebuildTree(){this._bitsets.computed.clear(),this._bitsets.inserted.clear(),this._tree&&this._tree.clear()}_remove(e){const t=e.getDisplayId(),s=e.getXHydrated(),r=e.getYHydrated(),o=this._geohashBuf[2*t],i=this._geohashBuf[2*t+1];this._bitsets.inserted.has(t)&&(this._bitsets.inserted.unset(t),this._tree.removeCursor(e,s,r,o,i,this._geohashLevel))}_update(e,t){const s=e.getDisplayId(),r=this._bitsets.inserted,o=t.isVisible(s);if(o===r.has(s))return;if(!o)return void this._remove(e);const i=e.getXHydrated(),a=e.getYHydrated();if(!this._setGeohash(s,i,a))return;const h=this._geohashBuf[2*s],n=this._geohashBuf[2*s+1];this._tree.insertCursor(e,s,i,a,h,n,this._geohashLevel),r.set(s)}_setGeohash(e,t,s){if(this._bitsets.geohash.has(e))return!0;const r=this._geohashBuf;if(this._spatialReference.isWebMercator){const o=T(t/n.radius),a=o-360*Math.floor((o+180)/360),h=T(Math.PI/2-2*Math.atan(Math.exp(-s/n.radius)));i(r,e,h,a,F)}else{const o=y({x:t,y:s},this._spatialReference,x.WGS84);if(!o)return!1;i(r,e,o.y,o.x,F)}return this._bitsets.geohash.set(e),!0}_getClustersForTile(e,s,r,o,i,a=!0){const h=this._schema.params.clusterPixelBuffer,n=2*r,l=Math.ceil(2**s.key.level*I/n)+1,u=Math.ceil(h/n)+0,d=Math.ceil(I/n),{row:f,col:m}=s.key,_=m*I,y=f*I,b=Math.floor(_/n)-u,v=Math.floor(y/n)-u,R=b+d+2*u,M=v+d+2*u,x=s.tileInfoView.getLODInfoAt(s.key.level);for(let I=b;I<=R;I++)for(let r=v;r<=M;r++){let h=I;x.wrap&&(h=I<0?I+l:I%l);const n=x.wrap&&I<0,u=x.wrap&&I%l!==I,d=this._lookupCluster(o,x,s.key.level,h,r,s);if(null!=d){const s=t(i,(e=>n?e.left:u?e.right:e.tile));if(a&&null==s)continue;if(!d.count)continue;if(null!=s&&a){const t=d.geometry.clone();let r=d.attributes;t.coords[0]=g(s,t.coords[0]),t.coords[1]=c(s,t.coords[1]),1===d.count&&null!=d.referenceId&&(r={...d.attributes,referenceId:d.referenceId});const o=new p(t,r);o.displayId=d.displayId,e.push(o)}}}}_getGeohashLevel(e){return Math.min(Math.ceil(e/2+2),F)}_setGeohashLevel(e){const t=this._getGeohashLevel(e),s=(Math.floor(t/B)+1)*B-1;if(this._geohashLevel!==s)return this._geohashLevel=s,this._rebuildTree(),void this._bitsets.geohash.clear()}_getTransforms(e,t){const s={originPosition:"upperLeft",scale:[e.resolution,e.resolution],translate:[e.bounds[0],e.bounds[3]]},r=l(t);if(!r)return{tile:s,left:null,right:null};const[o,i]=r.valid;return{tile:s,left:{...s,translate:[i,e.bounds[3]]},right:{...s,translate:[o-i+e.bounds[0],e.bounds[3]]}}}_getClusterId(e,t,s){return(15&e)<<28|(16383&t)<<14|16383&s}_markForDeletion(e,t,s){const r=this._getClusterId(e,t,s);this._clusters.delete(r)}_getClusterBounds(e,t,s){const r=this._schema.params.clusterRadius,o=2*r;let i=s%2?t*o:t*o-r;const a=s*o;let h=i+o;const n=a-o,l=2**e.level*I;e.wrap&&i<0&&(i=0),e.wrap&&h>l&&(h=l);const u=i/I,g=a/I,c=h/I,d=n/I;return[e.getXForColumn(u),e.getYForRow(g),e.getXForColumn(c),e.getYForRow(d)]}_getGeohash(e,t,s){const r={geohashX:0,geohashY:0};return a(r,t,e,s),r}_getGeohashBounds(e,t){const s=this._getGeohashLevel(e.key.level);if(this._spatialReference.isWebMercator){const[e,r,o,i]=t,h={x:e,y:r},l={x:o,y:i};let u=0,g=0,c=0,d=0;{const e=T(h.x/n.radius);u=e-360*Math.floor((e+180)/360),g=T(Math.PI/2-2*Math.atan(Math.exp(-h.y/n.radius)))}{const e=T(l.x/n.radius);c=e-360*Math.floor((e+180)/360),d=T(Math.PI/2-2*Math.atan(Math.exp(-l.y/n.radius)))}const f={geohashX:0,geohashY:0},p={geohashX:0,geohashY:0};a(f,g,u,s),a(p,d,c,s);return{bounds:[e,r,o,i],geohashBounds:{xLL:f.geohashX,yLL:f.geohashY,xTR:p.geohashX,yTR:p.geohashY},level:s}}const r=j.fromExtent(C.fromBounds(t,this._spatialReference)),o=y(r,this._spatialReference,x.WGS84,{densificationStep:e.resolution*L});if(!o)return null;const i=d(new m,o,!1,!1),h=i.coords.filter(((e,t)=>!(t%2))),l=i.coords.filter(((e,t)=>t%2)),u=Math.min(...h),g=Math.min(...l),c=Math.max(...h),f=Math.max(...l),p=this._getGeohash(u,g,s),_=this._getGeohash(c,f,s);return{bounds:t,geohashBounds:{xLL:p.geohashX,yLL:p.geohashY,xTR:_.geohashX,yTR:_.geohashY},level:s}}_lookupCluster(e,t,s,r,o,i){const a=this._getClusterId(s,r,o),h=this._clusters.get(a),n=this._getClusterBounds(t,r,o),l=this._getGeohashBounds(i,n);if(null==l)return null;const u=this._tree.getRegionStatistics(l),{count:g,xTotal:c,yTotal:d,referenceId:f}=u,p=g?c/g:0,m=g?d/g:0;if(0===g)return this._clusters.set(a,null),null;const _={cluster_count:g,...u.attributes},y=null!=h?h.update(p,m,s,_,l,f):S.create(e,a,p,m,s,_,l,f);if(0===g){const[e,t,s,r]=n;y.geometry.coords[0]=(e+s)/2,y.geometry.coords[1]=(t+r)/2}return this._clusters.set(a,y),this._updateAggregateValueRangeForCluster(y,y.tileLevel),y}_updateAggregateValueRangeForCluster(e,t){const s=this._aggregateValueRanges[t]||{minValue:1/0,maxValue:0},r=s.minValue,o=s.maxValue;s.minValue=Math.min(r,e.count),s.maxValue=Math.max(o,e.count),this._aggregateValueRanges[t]=s,r===s.minValue&&o===s.maxValue||(this._aggregateValueRangesChanged=!0)}_markTileClustersForDeletion(e,t){const s=2*t,r=Math.ceil(I/s),{row:o,col:i}=e.key,a=i*I,h=o*I,n=Math.floor(a/s),l=Math.floor(h/s);for(let u=n;u<n+r;u++)for(let t=l;t<l+r;t++)this._markForDeletion(e.key.level,u,t)}}export{S as ClusterInfo,V as ClusterStore};
|
|
@@ -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"../../../../../geometry.js";import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import{DateTimeReferenceFieldIndex as t}from"../../../../../arcade/arcadeTimeUtils.js";import has from"../../../../../core/has.js";import{unwrapOrThrow as r}from"../../../../../core/maybe.js";import{getCentroidOptimizedGeometry as s}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as i}from"../../../../../layers/graphics/featureConversionUtils.js";import n from"../../../../../layers/graphics/OptimizedGeometry.js";import{StaticBitSet as a}from"./StaticBitSet.js";import{fromJSON as o}from"../../../../../geometry/support/jsonUtils.js";let d=0;const
|
|
5
|
+
import"../../../../../geometry.js";import{ArcadeDate as e}from"../../../../../arcade/ArcadeDate.js";import{DateTimeReferenceFieldIndex as t}from"../../../../../arcade/arcadeTimeUtils.js";import has from"../../../../../core/has.js";import{unwrapOrThrow as r}from"../../../../../core/maybe.js";import{getCentroidOptimizedGeometry as s}from"../../../../../layers/graphics/centroid.js";import{convertToGeometry as i}from"../../../../../layers/graphics/featureConversionUtils.js";import n from"../../../../../layers/graphics/OptimizedGeometry.js";import{StaticBitSet as a}from"./StaticBitSet.js";import{fromJSON as o}from"../../../../../geometry/support/jsonUtils.js";let d=0;const h=has("featurelayer-simplify-thresholds")??[.5,.5,.5,.5],u=h[0],l=h[1],c=h[2],m=h[3],f=has("featurelayer-simplify-payload-size-factors")??[1,2,4],g=f[0],y=f[1],_=f[2],p=has("featurelayer-simplify-mobile-factor")??2,x=has("esri-mobile");class I{constructor(e,t){this.type="FeatureSetReader",this.arcadeDeclaredClass="esri.arcade.Feature",this.seen=!1,this.instance=0,this._tx=0,this._ty=0,this._sx=1,this._sy=1,this._deleted=null,this._joined=[],this._objectIdToIndex=null,this._level=0,this._datetimeMetadata=null,this.contextTimeReference=null,this.instance=e,this._layerSchema=t}static createInstance(){return d++,d=d>65535?0:d,d}get isEmpty(){return null!=this._deleted&&this._deleted.countSet()===this.getSize()}set level(e){this._level=e}getAreaSimplificationThreshold(e,t){let r=1;const s=x?p:1;t>4e6?r=_*s:t>1e6?r=y*s:t>5e5?r=g*s:t>1e5&&(r=s);let i=0;e>4e3?i=m*r:e>2e3?i=c*r:e>100?i=l:e>15&&(i=u);let n=8;return this._level<4?n=1:this._level<5?n=2:this._level<6&&(n=4),i*n}createQuantizedExtrudedQuad(e,t){return new n([5],[e-1,t,1,-1,1,1,-1,1,-1,-1])}parseTimestampOffset(e){return e}setArcadeSpatialReference(e){this._arcadeSpatialReference=e}attachStorage(e){this._storage=e}getQuantizationTransform(){throw new Error("Unable to find transform for featureSet")}getStorage(){return this._storage}getComputedNumeric(e){return this.getComputedNumericAtIndex(0)}setComputedNumeric(e,t){return this.setComputedNumericAtIndex(t,0)}getComputedString(e){return this.getComputedStringAtIndex(0)}setComputedString(e,t){return this.setComputedStringAtIndex(0,t)}getComputedNumericAtIndex(e){return this._storage.getComputedNumericAtIndex(this.getDisplayId(),e)}setComputedNumericAtIndex(e,t){this._storage.setComputedNumericAtIndex(this.getDisplayId(),e,t)}getComputedStringAtIndex(e){return this._storage.getComputedStringAtIndex(this.getDisplayId(),e)}setComputedStringAtIndex(e,t){return this._storage.setComputedStringAtIndex(this.getDisplayId(),e,t)}transform(e,t,r,s){const i=this.copy();return i._tx+=e,i._ty+=t,i._sx*=r,i._sy*=s,i}readAttribute(e,t=!1){const r=this._readAttribute(e,t);if(void 0!==r)return r;for(const s of this._joined){s.setIndex(this.getIndex());const r=s._readAttribute(e,t);if(void 0!==r)return r}}readAttributes(){const e=this._readAttributes();for(const t of this._joined){t.setIndex(this.getIndex());const r=t._readAttributes();for(const t of Object.keys(r))e[t]=r[t]}return e}joinAttributes(e){this._joined.push(e)}readArcadeFeature(){return this}hasField(e){return this.fields.has(e)}geometry(){const e=this.readHydratedGeometry(),t=i(e,this.geometryType,this.hasZ,this.hasM),r=o(t);return r&&(r.spatialReference=this._arcadeSpatialReference),r}get dateTimeReferenceFieldIndex(){return this._datetimeMetadata||(this._datetimeMetadata=t.create(this._layerSchema.fields,this._layerSchema)),this._datetimeMetadata}autocastArcadeDate(t,r){return r&&r instanceof Date?this.isUnknownDateTimeField(t)?e.unknownDateJSToArcadeDate(r):e.dateJSAndZoneToArcadeDate(r,this.contextTimeReference?.timeZone??"system"):r}isUnknownDateTimeField(e){return"unknown"===this.dateTimeReferenceFieldIndex?.fieldTimeZone(e)}fieldSourceTimeZone(e){return this.dateTimeReferenceFieldIndex?.fieldTimeZone(e)??""}get layerPreferredTimeZone(){return this.dateTimeReferenceFieldIndex?.layerPreferredTimeZone??""}field(e){if(this.hasField(e))return this.autocastArcadeDate(e,this.readAttribute(e,!0));for(const t of this._joined)if(t.setIndex(this.getIndex()),t.hasField(e)){const r=t._readAttribute(e,!0);return this.autocastArcadeDate(e,r)}throw new Error(`Field ${e} does not exist`)}setField(e,t){throw new Error("Unable to update feature attribute values, feature is readonly")}keys(){return this.fields.fields.map((e=>e.name))}castToText(e=!1){if(!e)return JSON.stringify(this.readLegacyFeature());const t=this.readLegacyFeature();if(!t)return JSON.stringify(null);const r={geometry:t.geometry,attributes:{...t.attributes??{}}};for(const s in r.attributes){const e=r.attributes[s];e instanceof Date&&(r.attributes[s]=e.getTime())}return JSON.stringify(r)}gdbVersion(){return null}fullSchema(){return this._layerSchema}castAsJson(e=null){return{attributes:this._readAttributes(),geometry:!0===e?.keepGeometryType?this.geometry():this.geometry()?.toJSON()??null}}castAsJsonAsync(e=null,t=null){return Promise.resolve(this.castAsJson(t))}removeIds(e){if(null==this._objectIdToIndex){const e=new Map,t=this.getCursor();for(;t.next();){const s=r(t.getObjectId());e.set(s,t.getIndex())}this._objectIdToIndex=e}const t=this._objectIdToIndex;for(const r of e)t.has(r)&&this.removeAtIndex(t.get(r))}removeAtIndex(e){null==this._deleted&&(this._deleted=a.create(this.getSize())),this._deleted.set(e)}readGeometryForDisplay(){return this.readUnquantizedGeometry(!0)}readLegacyGeometryForDisplay(){return this.readLegacyGeometry(!0)}*features(){const e=this.getCursor();for(;e.next();)yield e.readOptimizedFeature()}_getExists(){return null==this._deleted||!this._deleted.has(this.getIndex())}_computeCentroid(){if("esriGeometryPolygon"!==this.geometryType)return null;const e=this.readUnquantizedGeometry();if(!e||e.hasIndeterminateRingOrder)return null;const t=this.getQuantizationTransform()??null;return s(new n,e,this.hasM,this.hasZ,t)}copyInto(e){e.seen=this.seen,e._storage=this._storage,e._arcadeSpatialReference=this._arcadeSpatialReference,e._joined=this._joined,e._tx=this._tx,e._ty=this._ty,e._sx=this._sx,e._sy=this._sy,e._deleted=this._deleted,e._objectIdToIndex=this._objectIdToIndex}}export{I as FeatureSetReader};
|
|
@@ -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{FeatureSetReader as
|
|
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.readGeometry();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 e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import{assertIsSome as r}from"../../../../../core/maybe.js";import s from"../../../../../core/pbf.js";import{convertToGeometry as i,unquantizeOptimizedGeometry as n}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as a}from"../../../../../layers/graphics/OptimizedFeature.js";import h from"../../../../../layers/graphics/OptimizedGeometry.js";import{FeatureSetReader as o}from"./FeatureSetReader.js";import{parseHeader as d}from"./FeatureSetReaderPBFHeader.js";const u=!0,c=268435455,g=128,l=128e3,_={small:{delta:new Int32Array(g),decoded:new Int32Array(g)},large:{delta:new Int32Array(l),decoded:new Int32Array(l)}};function f(e){return e<=_.small.delta.length?_.small:(e<=_.large.delta.length||(_.large.delta=new Int32Array(Math.round(1.25*e)),_.large.decoded=new Int32Array(Math.round(1.25*e))),_.large)}function y(e){return e.toLowerCase().trim()}function I(r){try{const e=2,t=new s(new Uint8Array(r),new DataView(r));for(;t.next();){if(t.tag()===e)return p(t.getMessage());t.skip()}}catch(i){const r=new e("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:i});t.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(r)}return null}function p(e){const t=1;for(;e.next();){if(e.tag()===t)return e.getMessage();e.skip()}return null}function m(e){const t=1,r=2,s=3,i=4,n=5,a=6,h=7,o=8,d=9,u=e.getLength(),c=e.pos()+u;for(;e.pos()<c&&e.next();)switch(e.tag()){case t:return e.getString();case r:return e.getFloat();case s:return e.getDouble();case i:return e.getSInt32();case n:return e.getUInt32();case a:return e.getInt64();case h:return e.getUInt64();case o:return e.getSInt64();case d:return e.getBool();default:return e.skip(),null}return null}function x(e,t,r,s,i,n){return.5*Math.abs(e*s+r*n+i*t-e*n-r*t-i*s)}function S(e,t,r,s){return 0===e*s-r*t&&e*r+t*s>0}class F extends o{static fromBuffer(e,t,r=!1){const s=t.geometryType,i=I(e),n=d(i,"esriGeometryPoint"===s,r),a=o.createInstance();return new F(a,i,n,t)}constructor(e,t,r,s){super(e,s),this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0,centroid:void 0,legacyFeature:void 0,optFeature:void 0},this._geometryType=s.geometryType,this._reader=t,this._header=r,this._hasNext=r.hasFeatures,this._isPoints="esriGeometryPoint"===s.geometryType}get geometryType(){return this._geometryType}get _size(){return this._header.featureCount}get hasZ(){return!1}get hasM(){return!1}get stride(){return 2+(this.hasZ?1:0)+(this.hasM?1:0)}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}hasField(e){return this._header.hasField(e)||this._header.hasField(y(e))}getFieldNames(){return this._header.fields.map((e=>e.fieldName))}getSize(){return this._size}getQuantizationTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0,this._featureIndex=e}getAttributeHash(){let e="";return this._header.fields.forEach((({index:t})=>{e+=this._readAttributeAtIndex(t)+"."})),e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}getGroupId(){return this._header.groupIds[this._featureIndex]}setGroupId(e){this._header.groupIds[this._featureIndex]=e}readLegacyFeature(){if(void 0===this._cache.legacyFeature){const e=this.readCentroid(),t={attributes:this.readAttributes(),geometry:this._isPoints?this.readLegacyPointGeometry():this.readLegacyGeometry(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null};return this._cache.legacyFeature=t,t}return this._cache.legacyFeature}readOptimizedFeature(){if(void 0===this._cache.optFeature){const e=new a(this.readGeometry(),this.readAttributes(),this.readCentroid());return e.objectId=this.getObjectId(),e.displayId=this.getDisplayId(),this._cache.optFeature=e,e}return this._cache.optFeature}getXHydrated(){const e=this._header.centroid[2*this._featureIndex],t=this.getQuantizationTransform();return null==t?e:e*t.scale[0]+t.translate[0]}getYHydrated(){const e=this._header.centroid[2*this._featureIndex+1],t=this.getQuantizationTransform();return null==t?e:t.translate[1]-e*t.scale[1]}getX(){return this._header.centroid[2*this._featureIndex]*this._sx+this._tx}getY(){return this._header.centroid[2*this._featureIndex+1]*this._sy+this._ty}readLegacyPointGeometry(){return{x:this.getX(),y:this.getY()}}readLegacyGeometry(e){const t=this.readGeometry(e);return i(t,this.geometryType,!1,!1)}readLegacyCentroid(){const e=this.readCentroid();if(!e)return null;const[t,r]=e.coords;return{x:t,y:r}}readGeometryArea(){return this._cache.area||this.readGeometry(!0),this._cache.area}readUnquantizedGeometry(e=!1){if(void 0===this._cache.unquantGeometry){const t=this.readGeometry(e);if(!t)return this._cache.unquantGeometry=void 0,null;const r=f(t.coords.length).decoded,s=t.clone(r),i=s.coords;let n=0;for(const e of s.lengths){for(let t=1;t<e;t++){const e=2*(n+t),r=2*(n+t-1);i[e]+=i[r],i[e+1]+=i[r+1]}n+=e}return this._cache.unquantGeometry=s,s}return this._cache.unquantGeometry}readHydratedGeometry(){if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===c)return null;const e=this.getXHydrated(),t=this.getYHydrated();return new h([],[e,t])}const e=this.readGeometry();if(!e)return null;const t=e.clone(),r=this.getQuantizationTransform();return null!=r&&n(t,t,this.hasZ,this.hasM,r),t}readGeometry(e=!1){if(void 0===this._cache.geometry){let r=null;if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===c)return null;const e=this.getX(),t=this.getY();r=new h([],[e,t])}else{const s=this._header.offsets.geometry[this._featureIndex],i=this._reader;if(0===s){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this.createQuantizedExtrudedQuad(t,r)}i.move(s);try{if(r=e?this._parseGeometryForDisplay(i):this._parseGeometry(i),null===r){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this.createQuantizedExtrudedQuad(t,r)}}catch(t){return console.error("Failed to parse geometry!",t),null}}return this._cache.geometry=r,r}return this._cache.geometry}readCentroid(){if(void 0===this._cache.centroid){let e;return e=this._computeCentroid(),e||(e=this._readServerCentroid()),this._cache.centroid=e??void 0,e??null}return this._cache.centroid}copy(){const e=this._reader.clone(),t=new F(this.instance,e,this._header,this.fullSchema());return this.copyInto(t),t}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0;++this._featureIndex<this._size&&!this._getExists(););return this._featureIndex<this._size}_readAttribute(e,t){const r=this._header.hasField(e)?e:y(e),s=this._header.getFieldIndex(r);if(null==s)return;const i=this._readAttributeAtIndex(s);if(!t)return i;if(null==i)return i;return this._header.isDateField(r)?new Date(i):i}_readAttributes(){const e={};return this._header.fields.forEach((({fieldName:t,index:r})=>{e[t]=this._readAttributeAtIndex(r)})),e}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._featureOffset=this._featureOffset,e._hasNext=this._hasNext}_readAttributeAtIndex(e){const t=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+e],r=this._reader;return r.move(t),m(r)}_readServerCentroid(){const e=this._header.centroid[2*this._featureIndex]+this._tx,t=this._header.centroid[2*this._featureIndex+1]+this._ty;return e===c?null:new h([],[e,t])}_parseGeometry(e){const t=2,r=3,s=e.asUnsafe(),i=s.getLength(),n=s.pos()+i,a=[],o=[];for(;s.pos()<n&&s.next();)switch(s.tag()){case t:{const e=s.getUInt32(),t=s.pos()+e;for(;s.pos()<t;)o.push(s.getUInt32());break}case r:{const e=s.getUInt32(),t=s.pos()+e;for(a.push(s.getSInt32()+this._tx),a.push(s.getSInt32()+this._ty),this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();s.pos()<t;)a.push(s.getSInt32()),a.push(s.getSInt32()),this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();break}default:s.skip()}return new h(o,a)}_parseGeometryForDisplay(e){const t=2,s=3,i=e.asUnsafe(),n=i.getLength(),a=i.pos()+n,o=[],d=[];let c=0,g=0,l=null,_=0;const y="esriGeometryPolygon"===this.geometryType;for(;i.pos()<a&&i.next();)switch(i.tag()){case t:{const e=i.getUInt32(),t=i.pos()+e;for(;i.pos()<t;){const e=i.getUInt32();o.push(e),c+=e}l=f(2*c).delta;break}case s:{i.getUInt32();const e=2+(this.hasZ?1:0)+(this.hasM?1:0);r(l);for(const t of o)if(g+e*t>l.length)for(let e=0;e<t;e++)i.getSInt32(),i.getSInt32(),this.hasZ&&i.getSInt32(),this.hasM&&i.getSInt32();else if(y&&u){const e=this.getAreaSimplificationThreshold(t,this._header.vertexCount);let r=2,s=1;const n=!1;let a=i.getSInt32(),h=i.getSInt32();l[g++]=a,l[g++]=h,this.hasZ&&i.getSInt32(),this.hasM&&i.getSInt32();let o=i.getSInt32(),u=i.getSInt32();for(this.hasZ&&i.getSInt32(),this.hasM&&i.getSInt32();r<t;){let t=i.getSInt32(),n=i.getSInt32();this.hasZ&&i.getSInt32(),this.hasM&&i.getSInt32();const d=a+o,c=h+u;x(a,h,d,c,d+t,c+n)>=e?(_+=-.5*(d-a)*(c+h),s>1&&S(l[g-2],l[g-1],o,u)?(l[g-2]+=o,l[g-1]+=u):(l[g++]=o,l[g++]=u,s++),a=d,h=c):(t+=o,n+=u),o=t,u=n,r++}s<3||n?g-=2*s:(_+=-.5*(a+o-a)*(h+u+h),S(l[g-2],l[g-1],o,u)?(l[g-2]+=o,l[g-1]+=u,d.push(s)):(l[g++]=o,l[g++]=u,d.push(++s)))}else{let e=0,r=i.getSInt32(),s=i.getSInt32();this.hasZ&&i.getSInt32(),this.hasM&&i.getSInt32(),l[g++]=r,l[g++]=s,e+=1;for(let n=1;n<t;n++){const t=i.getSInt32(),a=i.getSInt32(),h=r+t,o=s+a;_+=-.5*(h-r)*(o+s),this.hasZ&&i.getSInt32(),this.hasM&&i.getSInt32(),n>2&&S(l[g-2],l[g-1],t,a)?(l[g-2]+=t,l[g-1]+=a):(l[g++]=t,l[g++]=a,e+=1),r=h,s=o}d.push(e)}break}default:i.skip()}if(this._cache.area=_,!d.length)return null;if(this._tx||this._ty){let e=0;r(l);for(const t of d)l[2*e]+=this._tx,l[2*e+1]+=this._ty,e+=t}return new h(d,l)}}export{F as FeatureSetReaderPBF};
|
|
5
|
+
import e from"../../../../../core/Error.js";import t from"../../../../../core/Logger.js";import{assertIsSome as r}from"../../../../../core/maybe.js";import s from"../../../../../core/pbf.js";import{convertToGeometry as i,unquantizeOptimizedGeometry as n}from"../../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as a}from"../../../../../layers/graphics/OptimizedFeature.js";import h from"../../../../../layers/graphics/OptimizedGeometry.js";import{FeatureSetReader as o}from"./FeatureSetReader.js";import{parseHeader as d}from"./FeatureSetReaderPBFHeader.js";const u=!0,c=268435455,g=128,l=128e3,_={small:{delta:new Int32Array(g),decoded:new Int32Array(g)},large:{delta:new Int32Array(l),decoded:new Int32Array(l)}};function f(e){return e<=_.small.delta.length?_.small:(e<=_.large.delta.length||(_.large.delta=new Int32Array(Math.round(1.25*e)),_.large.decoded=new Int32Array(Math.round(1.25*e))),_.large)}function y(r){try{const e=2,t=new s(new Uint8Array(r),new DataView(r));for(;t.next();){if(t.tag()===e)return I(t.getMessage());t.skip()}}catch(i){const r=new e("query:parsing-pbf","Error while parsing FeatureSet PBF payload",{error:i});t.getLogger("esri.view.2d.layers.features.support.FeatureSetReaderPBF").error(r)}return null}function I(e){const t=1;for(;e.next();){if(e.tag()===t)return e.getMessage();e.skip()}return null}function p(e){const t=1,r=2,s=3,i=4,n=5,a=6,h=7,o=8,d=9,u=e.getLength(),c=e.pos()+u;for(;e.pos()<c&&e.next();)switch(e.tag()){case t:return e.getString();case r:return e.getFloat();case s:return e.getDouble();case i:return e.getSInt32();case n:return e.getUInt32();case a:return e.getInt64();case h:return e.getUInt64();case o:return e.getSInt64();case d:return e.getBool();default:return e.skip(),null}return null}function m(e,t,r,s,i,n){return.5*Math.abs(e*s+r*n+i*t-e*n-r*t-i*s)}function x(e,t,r,s){return 0===e*s-r*t&&e*r+t*s>0}class S extends o{static fromBuffer(e,t,r=!1){const s=t.geometryType,i=y(e),n=d(i,"esriGeometryPoint"===s,r),a=o.createInstance();return new S(a,i,n,t)}constructor(e,t,r,s){super(e,s),this._hasNext=!1,this._isPoints=!1,this._featureIndex=-1,this._featureOffset=0,this._cache={area:0,unquantGeometry:void 0,geometry:void 0,centroid:void 0,legacyFeature:void 0,optFeature:void 0},this._geometryType=s.geometryType,this._reader=t,this._header=r,this._hasNext=r.hasFeatures,this._isPoints="esriGeometryPoint"===s.geometryType}get fields(){return this._header.fields}get geometryType(){return this._geometryType}get _size(){return this._header.featureCount}get hasZ(){return!1}get hasM(){return!1}get stride(){return 2+(this.hasZ?1:0)+(this.hasM?1:0)}get hasFeatures(){return this._header.hasFeatures}get hasNext(){return this._hasNext}get exceededTransferLimit(){return this._header.exceededTransferLimit}getSize(){return this._size}getQuantizationTransform(){return this._header.transform}getCursor(){return this.copy()}getIndex(){return this._featureIndex}setIndex(e){this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0,this._featureIndex=e}getAttributeHash(){let e="";for(const t of this._header.fields.fields)e+=this._readAttributeAtIndex(t.index)+".";return e}getObjectId(){return this._readAttributeAtIndex(this._header.objectIdFieldIndex)}getDisplayId(){return this._header.displayIds[this._featureIndex]}setDisplayId(e){this._header.displayIds[this._featureIndex]=e}getGroupId(){return this._header.groupIds[this._featureIndex]}setGroupId(e){this._header.groupIds[this._featureIndex]=e}readLegacyFeature(){if(void 0===this._cache.legacyFeature){const e=this.readCentroid(),t={attributes:this.readAttributes(),geometry:this._isPoints?this.readLegacyPointGeometry():this.readLegacyGeometry(),centroid:(e&&{x:e.coords[0],y:e.coords[1]})??null};return this._cache.legacyFeature=t,t}return this._cache.legacyFeature}readOptimizedFeature(){if(void 0===this._cache.optFeature){const e=new a(this.readGeometry(),this.readAttributes(),this.readCentroid());return e.objectId=this.getObjectId(),e.displayId=this.getDisplayId(),this._cache.optFeature=e,e}return this._cache.optFeature}getXHydrated(){const e=this._header.centroid[2*this._featureIndex],t=this.getQuantizationTransform();return null==t?e:e*t.scale[0]+t.translate[0]}getYHydrated(){const e=this._header.centroid[2*this._featureIndex+1],t=this.getQuantizationTransform();return null==t?e:t.translate[1]-e*t.scale[1]}getX(){return this._header.centroid[2*this._featureIndex]*this._sx+this._tx}getY(){return this._header.centroid[2*this._featureIndex+1]*this._sy+this._ty}readLegacyPointGeometry(){return{x:this.getX(),y:this.getY()}}readLegacyGeometry(e){const t=this.readGeometry(e);return i(t,this.geometryType,!1,!1)}readLegacyCentroid(){const e=this.readCentroid();if(!e)return null;const[t,r]=e.coords;return{x:t,y:r}}readGeometryArea(){return this._cache.area||this.readGeometry(!0),this._cache.area}readUnquantizedGeometry(e=!1){if(void 0===this._cache.unquantGeometry){const t=this.readGeometry(e);if(!t)return this._cache.unquantGeometry=void 0,null;const r=f(t.coords.length).decoded,s=t.clone(r),i=s.coords;let n=0;for(const e of s.lengths){for(let t=1;t<e;t++){const e=2*(n+t),r=2*(n+t-1);i[e]+=i[r],i[e+1]+=i[r+1]}n+=e}return this._cache.unquantGeometry=s,s}return this._cache.unquantGeometry}readHydratedGeometry(){if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===c)return null;const e=this.getXHydrated(),t=this.getYHydrated();return new h([],[e,t])}const e=this.readGeometry();if(!e)return null;const t=e.clone(),r=this.getQuantizationTransform();return null!=r&&n(t,t,this.hasZ,this.hasM,r),t}readGeometry(e=!1){if(void 0===this._cache.geometry){let r=null;if(this._isPoints){if(this._header.centroid[2*this._featureIndex]===c)return null;const e=this.getX(),t=this.getY();r=new h([],[e,t])}else{const s=this._header.offsets.geometry[this._featureIndex],i=this._reader;if(0===s){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this.createQuantizedExtrudedQuad(t,r)}i.move(s);try{if(r=e?this._parseGeometryForDisplay(i):this._parseGeometry(i),null===r){const e=this._readServerCentroid();if(!e)return null;const[t,r]=e.coords;return this.createQuantizedExtrudedQuad(t,r)}}catch(t){return console.error("Failed to parse geometry!",t),null}}return this._cache.geometry=r,r}return this._cache.geometry}readCentroid(){if(void 0===this._cache.centroid){let e;return e=this._computeCentroid(),e||(e=this._readServerCentroid()),this._cache.centroid=e??void 0,e??null}return this._cache.centroid}copy(){const e=this._reader.clone(),t=new S(this.instance,e,this._header,this.fullSchema());return this.copyInto(t),t}next(){for(this._cache.area=0,this._cache.unquantGeometry=void 0,this._cache.geometry=void 0,this._cache.centroid=void 0,this._cache.legacyFeature=void 0,this._cache.optFeature=void 0;++this._featureIndex<this._size&&!this._getExists(););return this._featureIndex<this._size}_readAttribute(e,t){const r=this._header.fields.get(e);if(null==r)return;let s=this._readAttributeAtIndex(r.index);"esriFieldTypeTimestampOffset"===this.fields.get(e)?.type&&(s=this.parseTimestampOffset(s));const i=this._header.fields.isDateField(r.name);return t?null==s?s:i?new Date(s):s:s}_readAttributes(){const e={};for(const t of this._header.fields.fields)e[t.name]=this._readAttributeAtIndex(t.index);return e}copyInto(e){super.copyInto(e),e._featureIndex=this._featureIndex,e._featureOffset=this._featureOffset,e._hasNext=this._hasNext}_readAttributeAtIndex(e){const t=this._header.offsets.attributes[this._featureIndex*this._header.fieldCount+e],r=this._reader;return r.move(t),p(r)}_readServerCentroid(){const e=this._header.centroid[2*this._featureIndex]+this._tx,t=this._header.centroid[2*this._featureIndex+1]+this._ty;return e===c?null:new h([],[e,t])}_parseGeometry(e){const t=2,r=3,s=e.asUnsafe(),i=s.getLength(),n=s.pos()+i,a=[],o=[];for(;s.pos()<n&&s.next();)switch(s.tag()){case t:{const e=s.getUInt32(),t=s.pos()+e;for(;s.pos()<t;)o.push(s.getUInt32());break}case r:{const e=s.getUInt32(),t=s.pos()+e;for(a.push(s.getSInt32()+this._tx),a.push(s.getSInt32()+this._ty),this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();s.pos()<t;)a.push(s.getSInt32()),a.push(s.getSInt32()),this.hasZ&&s.getSInt32(),this.hasM&&s.getSInt32();break}default:s.skip()}return new h(o,a)}_parseGeometryForDisplay(e){const t=2,s=3,i=e.asUnsafe(),n=i.getLength(),a=i.pos()+n,o=[],d=[];let c=0,g=0,l=null,_=0;const y="esriGeometryPolygon"===this.geometryType;for(;i.pos()<a&&i.next();)switch(i.tag()){case t:{const e=i.getUInt32(),t=i.pos()+e;for(;i.pos()<t;){const e=i.getUInt32();o.push(e),c+=e}l=f(2*c).delta;break}case s:{i.getUInt32();const e=2+(this.hasZ?1:0)+(this.hasM?1:0);r(l);for(const t of o)if(g+e*t>l.length)for(let e=0;e<t;e++)i.getSInt32(),i.getSInt32(),this.hasZ&&i.getSInt32(),this.hasM&&i.getSInt32();else if(y&&u){const e=this.getAreaSimplificationThreshold(t,this._header.vertexCount);let r=2,s=1;const n=!1;let a=i.getSInt32(),h=i.getSInt32();l[g++]=a,l[g++]=h,this.hasZ&&i.getSInt32(),this.hasM&&i.getSInt32();let o=i.getSInt32(),u=i.getSInt32();for(this.hasZ&&i.getSInt32(),this.hasM&&i.getSInt32();r<t;){let t=i.getSInt32(),n=i.getSInt32();this.hasZ&&i.getSInt32(),this.hasM&&i.getSInt32();const d=a+o,c=h+u;m(a,h,d,c,d+t,c+n)>=e?(_+=-.5*(d-a)*(c+h),s>1&&x(l[g-2],l[g-1],o,u)?(l[g-2]+=o,l[g-1]+=u):(l[g++]=o,l[g++]=u,s++),a=d,h=c):(t+=o,n+=u),o=t,u=n,r++}s<3||n?g-=2*s:(_+=-.5*(a+o-a)*(h+u+h),x(l[g-2],l[g-1],o,u)?(l[g-2]+=o,l[g-1]+=u,d.push(s)):(l[g++]=o,l[g++]=u,d.push(++s)))}else{let e=0,r=i.getSInt32(),s=i.getSInt32();this.hasZ&&i.getSInt32(),this.hasM&&i.getSInt32(),l[g++]=r,l[g++]=s,e+=1;for(let n=1;n<t;n++){const t=i.getSInt32(),a=i.getSInt32(),h=r+t,o=s+a;_+=-.5*(h-r)*(o+s),this.hasZ&&i.getSInt32(),this.hasM&&i.getSInt32(),n>2&&x(l[g-2],l[g-1],t,a)?(l[g-2]+=t,l[g-1]+=a):(l[g++]=t,l[g++]=a,e+=1),r=h,s=o}d.push(e)}break}default:i.skip()}if(this._cache.area=_,!d.length)return null;if(this._tx||this._ty){let e=0;r(l);for(const t of d)l[2*e]+=this._tx,l[2*e+1]+=this._ty,e+=t}return new h(d,l)}}export{S as FeatureSetReaderPBF};
|
|
@@ -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"../../../../../core/Error.js";import{
|
|
5
|
+
import e from"../../../../../core/Error.js";import t from"../../../../../layers/support/FieldsIndex.js";import{parseField as s,parseTransform as r}from"../../../../../rest/query/operations/pbfFeatureServiceParser.js";const n=268435455;class o{constructor(){this.hasFeatures=!1,this.exceededTransferLimit=!1,this.fieldCount=0,this.featureCount=0,this.objectIdFieldIndex=0,this.vertexCount=0,this.offsets={attributes:new Array,geometry:new Array},this.centroid=new Array}}function a(a,i,c=!1){const f=1,d=3,u=9,g=12,l=13,p=15,h=a.asUnsafe(),b=h.pos(),w=new o;let m=0,y=0;const k=1,x=2,I=4,L=3;let A=null,F=null,C=null,S=!1;const j=[];for(;h.next();)switch(h.tag()){case f:A=h.getString();break;case d:F=h.getString();break;case g:C=h.processMessage(r);break;case u:if(w.exceededTransferLimit=h.getBool(),w.exceededTransferLimit){w.offsets.geometry=c?new Float64Array(8e3):new Int32Array(8e3),w.centroid=c?new Float64Array(16e3):new Int32Array(16e3);for(let e=0;e<w.centroid.length;e++)w.centroid[e]=n}break;case l:{const e=h.processMessage(s);e.index=m++,j.push(e);break}case p:{const e=h.getLength(),t=h.pos()+e;if(!w.exceededTransferLimit){const e=w.offsets.geometry,t=w.centroid;e.push(0),t.push(n),t.push(n)}!S&&w.exceededTransferLimit&&(S=!0,w.offsets.attributes=c?new Float64Array(8e3*m):new Uint32Array(8e3*m));let s=y*m;for(;h.pos()<t&&h.next();)switch(h.tag()){case k:{if(S)w.offsets.attributes[s++]=h.pos();else{w.offsets.attributes.push(h.pos())}const e=h.getLength();h.skipLen(e);break}case x:if(i){const e=h.getLength(),t=h.pos()+e;for(;h.pos()<t&&h.next();)switch(h.tag()){case L:{h.getUInt32();const e=h.getSInt64(),t=h.getSInt64();w.centroid[2*y]=e,w.centroid[2*y+1]=t;break}default:h.skip()}}else{w.offsets.geometry[y]=h.pos();const e=h.getLength();w.vertexCount+=e,h.skipLen(e)}break;case I:{const e=h.getLength(),t=h.pos()+e;for(;h.pos()<t&&h.next();)switch(h.tag()){case L:{h.getUInt32();const e=h.getSInt64(),t=h.getSInt64();w.centroid[2*y]=e,w.centroid[2*y+1]=t;break}default:h.skip()}break}default:h.skip()}y++,w.hasFeatures=!0;break}default:h.skip()}const U=A||F;if(!U)throw new e("FeatureSet has no objectId or globalId field name");return w.fields=new t(j),w.featureCount=y,w.fieldCount=m,w.objectIdFieldIndex=w.fields.get(U).index,w.transform=C,w.displayIds=new Uint32Array(w.featureCount),w.groupIds=new Uint16Array(w.featureCount),h.move(b),w}export{o as FeatureSetHeader,a as parseHeader};
|
|
@@ -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{FeatureSetReader as e}from"./FeatureSetReader.js";class r extends e{static from(e,t){return new r(e.copy(),t)}constructor(r,t){super(e.createInstance(),r.fullSchema()),this._currentIndex=-1,this._reader=r,this._indices=t}get hasNext(){return this._currentIndex+1<this._indices.length}getSize(){return this._indices.length}getCursor(){return this.copy()}copy(){const e=new r(this._reader.copy(),this._indices);return e._currentIndex=this._currentIndex,e}next(){for(;this._nextIndex()&&!this._reader._getExists(););return this._currentIndex<this._indices.length}_nextIndex(){return++this._currentIndex<this._indices.length&&(this._reader.setIndex(this._indices[this._currentIndex]),!0)}setArcadeSpatialReference(e){this._reader.setArcadeSpatialReference(e)}attachStorage(e){this._reader.attachStorage(e)}get geometryType(){return this._reader.geometryType}get hasFeatures(){return this._reader.hasFeatures}get exceededTransferLimit(){return this._reader.exceededTransferLimit}get hasZ(){return this._reader.hasZ}get hasM(){return this._reader.hasM}getStorage(){return this._reader.getStorage()}getComputedNumeric(e){return this._reader.getComputedNumericAtIndex(0)}setComputedNumeric(e,r){return this._reader.setComputedNumericAtIndex(r,0)}getComputedString(e){return this._reader.getComputedStringAtIndex(0)}setComputedString(e,r){return this._reader.setComputedStringAtIndex(0,r)}getComputedNumericAtIndex(e){return this._reader.getComputedNumericAtIndex(e)}setComputedNumericAtIndex(e,r){this._reader.setComputedNumericAtIndex(e,r)}getComputedStringAtIndex(e){return this._reader.getComputedStringAtIndex(e)}setComputedStringAtIndex(e,r){return this._reader.setComputedStringAtIndex(e,r)}transform(e,r,t,d){const a=this.copy();return a._reader=this._reader.transform(e,r,t,d),a}readAttribute(e,r=!1){return this._reader.readAttribute(e,r)}readAttributes(){return this._reader.readAttributes()}joinAttributes(e){return this._reader.joinAttributes(e)}readArcadeFeature(){return this._reader.readArcadeFeature()}geometry(){return this._reader.geometry()}field(e){return this.readAttribute(e,!0)}hasField(e){return this._reader.hasField(e)}setField(e,r){return this._reader.setField(e,r)}keys(){return this._reader.keys()}castToText(e=!1){return this._reader.castToText(e)}getQuantizationTransform(){return this._reader.getQuantizationTransform()}
|
|
5
|
+
import{FeatureSetReader as e}from"./FeatureSetReader.js";class r extends e{static from(e,t){return new r(e.copy(),t)}constructor(r,t){super(e.createInstance(),r.fullSchema()),this._currentIndex=-1,this._reader=r,this._indices=t}get fields(){return this._reader.fields}get hasNext(){return this._currentIndex+1<this._indices.length}getSize(){return this._indices.length}getCursor(){return this.copy()}copy(){const e=new r(this._reader.copy(),this._indices);return e._currentIndex=this._currentIndex,e}next(){for(;this._nextIndex()&&!this._reader._getExists(););return this._currentIndex<this._indices.length}_nextIndex(){return++this._currentIndex<this._indices.length&&(this._reader.setIndex(this._indices[this._currentIndex]),!0)}setArcadeSpatialReference(e){this._reader.setArcadeSpatialReference(e)}attachStorage(e){this._reader.attachStorage(e)}get geometryType(){return this._reader.geometryType}get hasFeatures(){return this._reader.hasFeatures}get exceededTransferLimit(){return this._reader.exceededTransferLimit}get hasZ(){return this._reader.hasZ}get hasM(){return this._reader.hasM}getStorage(){return this._reader.getStorage()}getComputedNumeric(e){return this._reader.getComputedNumericAtIndex(0)}setComputedNumeric(e,r){return this._reader.setComputedNumericAtIndex(r,0)}getComputedString(e){return this._reader.getComputedStringAtIndex(0)}setComputedString(e,r){return this._reader.setComputedStringAtIndex(0,r)}getComputedNumericAtIndex(e){return this._reader.getComputedNumericAtIndex(e)}setComputedNumericAtIndex(e,r){this._reader.setComputedNumericAtIndex(e,r)}getComputedStringAtIndex(e){return this._reader.getComputedStringAtIndex(e)}setComputedStringAtIndex(e,r){return this._reader.setComputedStringAtIndex(e,r)}transform(e,r,t,d){const a=this.copy();return a._reader=this._reader.transform(e,r,t,d),a}readAttribute(e,r=!1){return this._reader.readAttribute(e,r)}readAttributes(){return this._reader.readAttributes()}joinAttributes(e){return this._reader.joinAttributes(e)}readArcadeFeature(){return this._reader.readArcadeFeature()}geometry(){return this._reader.geometry()}field(e){return this.readAttribute(e,!0)}hasField(e){return this._reader.hasField(e)}setField(e,r){return this._reader.setField(e,r)}keys(){return this._reader.keys()}castToText(e=!1){return this._reader.castToText(e)}getQuantizationTransform(){return this._reader.getQuantizationTransform()}getAttributeHash(){return this._reader.getAttributeHash()}getObjectId(){return this._reader.getObjectId()}getDisplayId(){return this._reader.getDisplayId()}setDisplayId(e){return this._reader.setDisplayId(e)}getGroupId(){return this._reader.getGroupId()}setGroupId(e){return this._reader.setGroupId(e)}getXHydrated(){return this._reader.getXHydrated()}getYHydrated(){return this._reader.getYHydrated()}getX(){return this._reader.getX()}getY(){return this._reader.getY()}setIndex(e){return this._reader.setIndex(e)}getIndex(){return this._reader.getIndex()}readLegacyFeature(){return this._reader.readLegacyFeature()}readOptimizedFeature(){return this._reader.readOptimizedFeature()}readLegacyPointGeometry(){return this._reader.readLegacyPointGeometry()}readLegacyGeometry(){return this._reader.readLegacyGeometry()}readLegacyCentroid(){return this._reader.readLegacyCentroid()}readGeometryArea(){return this._reader.readGeometryArea()}readUnquantizedGeometry(){return this._reader.readUnquantizedGeometry()}readHydratedGeometry(){return this._reader.readHydratedGeometry()}readGeometry(){return this._reader.readGeometry()}readCentroid(){return this._reader.readCentroid()}_readAttribute(e,r){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}_readAttributes(){throw new Error("Error: Should not be called. Underlying _reader should be used instead")}}export{r as FeatureSetReaderIndirect};
|
|
@@ -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 e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import a from"../../../../core/Handles.js";import{releaseMaybe as s,destroyMaybe as n,removeMaybe as r}from"../../../../core/maybe.js";import{watch as l,sync as o,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{createScreenPoint as u,screenPointObjectToArray as c,createScreenPointArray as d}from"../../../../core/screenUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as P,E as y,m}from"../../../../chunks/mat4.js";import{e as g,l as w,c as f,g as M,a as D,m as T,n as V,s as b}from"../../../../chunks/vec3.js";import{a as k,c as E}from"../../../../chunks/vec3f64.js";import{a as S,c as H,n as x,f as I}from"../../../../chunks/boundedPlane.js";import{signedDistance as R,create as j,intersectRay as O,normal as C}from"../../../../geometry/support/plane.js";import{create as z}from"../../../../geometry/support/ray.js";import{sv3d as G,sm4d as U,sv2d as L}from"../../../../geometry/support/vectorStacks.js";import{POINTER_MOVE_TIMER_MS as A,PLANE_PREVIEW_OUTLINE_WIDTH as K,forceVerticalModifier as B,forceHorizontalModifier as F,PLANE_OUTLINE_COLOR as N,PLANE_BACKGROUND_COLOR as q,PREVIEW_FADE_DOT_THRESHOLD as Z,PREVIEW_FADE_DURATION_SECONDS as J,INITIAL_DEPTH_OFFSET_FRAC as Q}from"./sliceToolConfig.js";import{createShiftManipulator as W,createRotateManipulator as X,createResizeManipulator as Y,createGridVisualElement as $,createOutlineVisualElement as tt,planeToShape as et,createRotatePlane as it,RotationAxis as at,resizePlane as st,calculatePlaneHalfSize as nt,SliceOrientation as rt,createPlane as lt,DidPointerMoveRecentlyFlag as ot,calculateBoundedPlaneTranslateRotate as ht,updateShiftRestartHandle as pt,updateRotateHeadingHandle as ut,updateRotateTiltHandle as ct,updateResizeHandle as dt,createShiftPlane as _t}from"./sliceToolUtils.js";import{getRotateHeadingTexture as vt,getTiltRotateTexture as Pt}from"./images/Factory.js";import{calculateInputRotationTransform as yt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as mt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreen as gt}from"../../support/geometryUtils/ray.js";import{newIntersector as wt}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as ft}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{AnalysisToolBase as Mt}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as Dt}from"../../../interactive/dragEventPipeline.js";import{createScreenPointFromEvent as Tt}from"../../../support/screenUtils.js";var Vt;let bt=Vt=class extends Mt{constructor(t){super(t),this._clock=i,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this.layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._handles=new a,this._viewHandles=new a,this._frameTask=null,this._pointerMoveTimerMs=A,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=S(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=u(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=wt(t.view.state.viewingMode),this._intersector.options.store=ft.MIN}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");const t=!this.view._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._rotateHeadingImage=vt(this.view.toolViewManager.textures,{premultiplyAlpha:t}),this._rotateTiltImage=Pt(this.view.toolViewManager.textures);const e=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(null!=this.analysisViewData.plane&&H(this.analysisViewData.plane,this._startPlane),this.inputState=null)};this.shiftManipulator=W(this.view),this.manipulators.add(this.shiftManipulator),this.shiftManipulator.events.on("grab-changed",(t=>{this._onShiftGrab(t),e(this.shiftManipulator)})),this._handles.add(this._createShiftDragPipeline(this.shiftManipulator)),this.rotateHeadingManipulator=X(this.view,this._rotateHeadingImage.texture),this.manipulators.add(this.rotateHeadingManipulator),this.rotateHeadingManipulator.events.on("grab-changed",(t=>{this._onRotateHeadingGrab(t),e(this.rotateHeadingManipulator)})),this._handles.add(this._createRotateHeadingDragPipeline(this.rotateHeadingManipulator)),this.rotateTiltManipulator=X(this.view,this._rotateTiltImage.texture),this.manipulators.add(this.rotateTiltManipulator),this.rotateTiltManipulator.events.on("grab-changed",(t=>{this._onRotateTiltGrab(t),e(this.rotateTiltManipulator)})),this._handles.add(this._createRotateTiltDragPipeline(this.rotateTiltManipulator)),this.resizeManipulators=this._resizeHandles.map(((t,i)=>{const a=Y(this.view,t);return a.events.on("grab-changed",(t=>{this._onResizeGrab(t,i),e(a)})),this._handles.add(this._createResizeDragPipeline(a)),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=$(this.view),this._previewPlaneOutlineVisualElement=tt(this.view),this._previewPlaneOutlineVisualElement.width=K,this._handles.add(l((()=>this.analysisViewData.plane),(()=>this._updateManipulators()),o));const i=l((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),h);this._handles.add([i,l((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this._rotateHeadingImage=s(this._rotateHeadingImage),this._rotateTiltImage=s(this._rotateTiltImage),this._handles=n(this._handles),this._viewHandles=n(this._viewHandles),this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=n(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=n(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":null!=this._creatingPointerId?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this._handles.remove("analysis"),this._set("analysis",t)}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=null!=t&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return null!=this.inputState&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._set("layersMode","none"),this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!Et(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!Et(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!Et(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&null!=e&&"shift"===e.type){const i=Tt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Tt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&null!=this.analysisViewData.plane){const e=Tt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),H(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=Tt(t),a=S();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if(H(a,this._startPlane),this.analysis.shape=et(a,this.view,this.view.spatialReference,new e),"pointer-drag"===t.type){const e=this._calculatePickRay(i);this.inputState=kt(e,t.pointerId,a.origin,a)}return!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Tt(t)).then((t=>{if(t.results.length){const e=t.results[0],i="graphic"===e?.type&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(t){return(t.key===B||t.key===F)&&(this._activeKeyModifiers[t.key]=!0,null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==B&&t.key!==F||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=this._calculatePickRay(t.screenPoint);H(this.analysisViewData.plane,this._startPlane),this.inputState=kt(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"shift"!==a.type)return;const s=null!=this.analysisViewData.plane?H(this.analysisViewData.plane,S()):null;e.next(mt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=.001,a=Math.min((1-Math.abs(g(x(this.analysisViewData.plane),e.ray.direction)/w(e.ray.direction)))/i,1),s=-R(this._startPlane.plane,e.renderEnd),n=-R(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(null==this.analysisViewData.plane)return;const e=f(G.get(),this._startPlane.origin),i=f(G.get(),x(this._startPlane));M(i,i,-t.depth),D(i,i,e);const a=I(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,S());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=it(this.analysisViewData.plane,this.view.renderCoordsHelper,at.HEADING,j()),i=this._calculatePickRay(t.screenPoint),a=E();O(e,i,a)&&(H(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?H(this.analysisViewData.plane,S()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=it(this.analysisViewData.plane,this.view.renderCoordsHelper,at.TILT,j()),i=this._calculatePickRay(t.screenPoint),a=E();O(e,i,a)&&(H(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?H(this.analysisViewData.plane,S()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=C(t.rotatePlane),a=yt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(null==this.analysisViewData.plane)return;const e=P(U.get(),t.rotateAngle,t.rotateAxis);if(null==e)return;const i=T(G.get(),this._startPlane.basis1,e),a=T(G.get(),this._startPlane.basis2,e),s=I(this.analysisViewData.plane.origin,i,a,S());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const i=this._calculatePickRay(t.screenPoint),a=G.get();O(this.analysisViewData.plane.plane,i,a)&&(H(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:k(a)})}_createResizeDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"resize"!==a.type||null==this.analysisViewData.plane)return;const s=H(this.analysisViewData.plane,S());e.next(mt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(null==this.analysisViewData.plane)return;const i=this._resizeHandles[t.activeHandleIdx],a=st(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,H(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(null==e)throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,null==t)return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=null!=i?i:S();if(i=null!=i?H(i,St):null,this._pickPlane(t,!0,e,a)){const t=Z;let e=!1;null!=i&&(e=g(i.plane,a.plane)<t||g(V(G.get(),i.basis1),V(G.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}null!=this._previewPlane&&null==this._frameTask&&0===this._previewPlaneOpacity?this._frameTask=p({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*J),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):null==this._previewPlane&&null!=this._frameTask?this._removeFrameTask():null!=this._previewPlane&&this._updateManipulators()}_removeFrameTask(){this._frameTask=r(this._frameTask)}_calculatePickRay(t){const e=z(),i=c(t,Ht);return gt(this.view.state.camera,i,e),V(e.direction,e.direction),e}_pickMinResult(t){const e=c(t,L.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=G.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(G.get()),l=this.view.state.camera;g(r,l.viewForward)>0&&M(r,r,-1);const o=nt(n,l),h=(e?1:-1)*o*Q,p=M(G.get(),r,h);D(p,p,n);const u=this.analysis.tiltEnabled?rt.TILTED:rt.HORIZONTAL_OR_VERTICAL,c=i[B]?rt.VERTICAL:i[F]?rt.HORIZONTAL:u;return lt(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=r(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=ot,this.rotateHeadingManipulator.state|=ot,this.rotateTiltManipulator.state|=ot,this._prevPointerMoveTimeout=this._clock.setTimeout((()=>{this.shiftManipulator.state&=~ot,this.rotateHeadingManipulator.state&=~ot,this.rotateTiltManipulator.state&=~ot}),this._pointerMoveTimerMs)}_updateManipulators(){if(Vt.disableEngineLayers)return;let t,e=!1;if(null!=this.analysisViewData.plane)t=this.analysisViewData.plane,e=!1;else{if(null==this._previewPlane)return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ht(t,U.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.attached=!0,this._previewPlaneGridVisualElement.attached=!0,this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),pt(this.shiftManipulator,i,t,this.view.state.camera),ut(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),ct(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>dt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=b(G.get(),w(t.basis1),w(t.basis2),1),s=y(U.get(),a),n=m(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=[N[0],N[1],N[2],N[3]*this._previewPlaneOpacity];this._previewPlaneOutlineVisualElement.color=t;const e=[q[0],q[1],q[2],q[3]*this._previewPlaneOpacity],i=[0,0,0,0];this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=i}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function kt(t,e,i,a){const s=_t(i,x(a),t.direction,j()),n=E();return O(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function Et(t){return"mouse"!==t.pointerType||0===t.button}bt.disableEngineLayers=!1,t([_()],bt.prototype,"_clock",void 0),t([_({constructOnly:!0})],bt.prototype,"view",void 0),t([_()],bt.prototype,"analysisViewData",void 0),t([_({readOnly:!0})],bt.prototype,"state",null),t([_({readOnly:!0})],bt.prototype,"cursor",null),t([_()],bt.prototype,"analysis",null),t([_()],bt.prototype,"removeIncompleteOnCancel",void 0),t([_({readOnly:!0})],bt.prototype,"layersMode",void 0),t([_({value:null})],bt.prototype,"inputState",null),t([_()],bt.prototype,"_isPlacingSlicePlane",null),t([_()],bt.prototype,"_creatingPointerId",null),bt=Vt=t([v("esri.views.3d.analysis.Slice.SliceTool")],bt);const St=S(),Ht=d(),xt=bt;export{xt as default};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../analysis/SlicePlane.js";import{clock as i}from"../../../../core/clock.js";import a from"../../../../core/Handles.js";import{releaseMaybe as s,destroyMaybe as n,removeMaybe as r}from"../../../../core/maybe.js";import{watch as l,sync as o,syncAndInitial as h}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{createScreenPoint as u,screenPointObjectToArray as c,createScreenPointArray as d}from"../../../../core/screenUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{d as P,E as y,m}from"../../../../chunks/mat4.js";import{e as g,l as w,c as f,g as M,a as D,m as T,n as V,s as b}from"../../../../chunks/vec3.js";import{a as k,c as E}from"../../../../chunks/vec3f64.js";import{a as S,c as H,n as x,f as I}from"../../../../chunks/boundedPlane.js";import{signedDistance as R,create as j,intersectRay as O,normal as C}from"../../../../geometry/support/plane.js";import{create as z}from"../../../../geometry/support/ray.js";import{sv3d as G,sm4d as U,sv2d as L}from"../../../../geometry/support/vectorStacks.js";import{POINTER_MOVE_TIMER_MS as A,PLANE_PREVIEW_OUTLINE_WIDTH as K,forceVerticalModifier as B,forceHorizontalModifier as F,PLANE_OUTLINE_COLOR as N,PLANE_BACKGROUND_COLOR as q,PREVIEW_FADE_DOT_THRESHOLD as Z,PREVIEW_FADE_DURATION_SECONDS as J,INITIAL_DEPTH_OFFSET_FRAC as Q}from"./sliceToolConfig.js";import{createShiftManipulator as W,createRotateManipulator as X,createResizeManipulator as Y,createGridVisualElement as $,createOutlineVisualElement as tt,planeToShape as et,createRotatePlane as it,RotationAxis as at,resizePlane as st,calculatePlaneHalfSize as nt,SliceOrientation as rt,createPlane as lt,DidPointerMoveRecentlyFlag as ot,calculateBoundedPlaneTranslateRotate as ht,updateShiftRestartHandle as pt,updateRotateHeadingHandle as ut,updateRotateTiltHandle as ct,updateResizeHandle as dt,createShiftPlane as _t}from"./sliceToolUtils.js";import{getRotateHeadingTexture as vt,getTiltRotateTexture as Pt}from"./images/Factory.js";import{calculateInputRotationTransform as yt}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as mt}from"../../interactive/editingTools/dragEventPipeline3D.js";import{fromScreen as gt}from"../../support/geometryUtils/ray.js";import{newIntersector as wt}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as ft}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{AnalysisToolBase as Mt}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as Dt}from"../../../interactive/dragEventPipeline.js";import{createScreenPointFromEvent as Tt}from"../../../support/screenUtils.js";var Vt;let bt=Vt=class extends Mt{constructor(t){super(t),this._clock=i,this._previewPlaneOpacity=1,this.removeIncompleteOnCancel=!1,this.layersMode="none",this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._handles=new a,this._viewHandles=new a,this._frameTask=null,this._pointerMoveTimerMs=A,this._prevPointerMoveTimeout=null,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=S(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=u(),this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._intersector=wt(t.view.state.viewingMode),this._intersector.options.store=ft.MIN}initialize(){if(null==this.analysis)throw new Error("SliceTool requires valid analysis, but null was provided.");const t=!this.view._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._rotateHeadingImage=vt(this.view.toolViewManager.textures,{premultiplyAlpha:t}),this._rotateTiltImage=Pt(this.view.toolViewManager.textures);const e=t=>{this._updateManipulatorsInteractive(t),t.grabbing||(null!=this.analysisViewData.plane&&H(this.analysisViewData.plane,this._startPlane),this.inputState=null)};this.shiftManipulator=W(this.view),this.manipulators.add(this.shiftManipulator),this.shiftManipulator.events.on("grab-changed",(t=>{this._onShiftGrab(t),e(this.shiftManipulator)})),this._handles.add(this._createShiftDragPipeline(this.shiftManipulator)),this.rotateHeadingManipulator=X(this.view,this._rotateHeadingImage.texture),this.manipulators.add(this.rotateHeadingManipulator),this.rotateHeadingManipulator.events.on("grab-changed",(t=>{this._onRotateHeadingGrab(t),e(this.rotateHeadingManipulator)})),this._handles.add(this._createRotateHeadingDragPipeline(this.rotateHeadingManipulator)),this.rotateTiltManipulator=X(this.view,this._rotateTiltImage.texture),this.manipulators.add(this.rotateTiltManipulator),this.rotateTiltManipulator.events.on("grab-changed",(t=>{this._onRotateTiltGrab(t),e(this.rotateTiltManipulator)})),this._handles.add(this._createRotateTiltDragPipeline(this.rotateTiltManipulator)),this.resizeManipulators=this._resizeHandles.map(((t,i)=>{const a=Y(this.view,t);return a.events.on("grab-changed",(t=>{this._onResizeGrab(t,i),e(a)})),this._handles.add(this._createResizeDragPipeline(a)),a})),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=$(this.view),this._previewPlaneOutlineVisualElement=tt(this.view),this._previewPlaneOutlineVisualElement.width=K,this._handles.add(l((()=>[this.analysisViewData.plane,this.analysis.tiltEnabled]),(()=>this._updateManipulators()),o));const i=l((()=>this.state),(t=>{"sliced"===t&&this.finishToolCreation()}),h);this._handles.add([i,l((()=>this.view.state.camera),(()=>this._onCameraChange()))])}destroy(){this._rotateHeadingImage=s(this._rotateHeadingImage),this._rotateTiltImage=s(this._rotateTiltImage),this._handles=n(this._handles),this._viewHandles=n(this._viewHandles),this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=n(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=n(this._previewPlaneGridVisualElement)}get state(){const t=!!this.analysisViewData.plane,e=!!this.inputState;return t?t&&e?"slicing":t&&!e?"sliced":"ready":"ready"}get cursor(){return this._isPlacingSlicePlane||"exclude"===this.layersMode?"crosshair":null!=this._creatingPointerId?"grabbing":null}set analysis(t){if(null==t)throw new Error("SliceTool requires valid analysis, but null was provided.");this._handles.remove("analysis"),this._set("analysis",t)}get inputState(){return this._get("inputState")}set inputState(t){this._set("inputState",t),this.analysisViewData.showGrid=null!=t&&"resize"===t.type,this._updateMaterials()}get _isPlacingSlicePlane(){return!this.inputState&&!this.analysisViewData.plane&&this.active}get _creatingPointerId(){return null!=this.inputState&&"shift"===this.inputState.type?this.inputState.creatingPointerId:null}enterExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._set("layersMode","exclude"),this.active||(this.view.activeTool=this))}exitExcludeLayerMode(){null!=this.analysisViewData.plane&&(this._set("layersMode","none"),this.active&&(this.view.activeTool=null))}onDeactivate(){this._set("layersMode","none"),this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(t){this._updateManipulators(),t||this._clearPointerMoveTimeout()}onInputEvent(t){switch(t.type){case"pointer-drag":if(!Et(t))return;this._isPlacingSlicePlane?this._onClickPlacePlane(t)&&t.stopPropagation():this._onPointerDrag(t)&&t.stopPropagation();break;case"pointer-move":this._onPointerMove(t);break;case"pointer-up":this._onPointerUp(t)&&t.stopPropagation();break;case"immediate-click":if(!Et(t))return;this._onClickPlacePlane(t)&&t.stopPropagation();break;case"click":if(!Et(t))return;this._onClickExcludeLayer(t)&&t.stopPropagation();break;case"drag":this.inputState&&t.stopPropagation();break;case"key-down":this._onKeyDown(t)&&t.stopPropagation();break;case"key-up":this._onKeyUp(t)&&t.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerDrag(t){const e=this.inputState;if(t.pointerId===this._creatingPointerId&&null!=e&&"shift"===e.type){const i=Tt(t);return this.shiftManipulator.events.emit("drag",{action:e.hasBeenDragged?"update":"start",pointerType:t.pointerType,start:i,screenPoint:i}),e.hasBeenDragged=!0,!0}return!1}_onPointerMove(t){this._lastCursorPosition.x=t.x,this._lastCursorPosition.y=t.y,this._resetPointerMoveTimeout(),"touch"!==t.pointerType&&this._updatePreviewPlane(Tt(t),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onPointerUp(t){if(t.pointerId===this._creatingPointerId&&null!=this.analysisViewData.plane){const e=Tt(t);return this.shiftManipulator.events.emit("drag",{action:"end",start:e,screenPoint:e}),H(this.analysisViewData.plane,this._startPlane),this.inputState=null,!0}return!1}_onClickPlacePlane(t){if("exclude"===this.layersMode)return!1;if(this._isPlacingSlicePlane){const i=Tt(t),a=S();if(this._pickPlane(i,!1,this._activeKeyModifiers,a)){if(H(a,this._startPlane),this.analysis.shape=et(a,this.view,this.view.spatialReference,new e),"pointer-drag"===t.type){const e=this._calculatePickRay(i);this.inputState=kt(e,t.pointerId,a.origin,a)}return!0}}return!1}_onClickExcludeLayer(t){return!("exclude"!==this.layersMode||!this.created)&&(this.view.hitTest(Tt(t)).then((t=>{if(t.results.length){const e=t.results[0],i="graphic"===e?.type&&e.graphic;if(i){const t=i.sourceLayer||i.layer;t&&this.analysis.excludedLayers.push(t)}}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0})),this._set("layersMode","none"),this.active&&(this.view.activeTool=null),!0)}_onKeyDown(t){return(t.key===B||t.key===F)&&(this._activeKeyModifiers[t.key]=!0,null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onKeyUp(t){return!(t.key!==B&&t.key!==F||!this._activeKeyModifiers[t.key])&&(delete this._activeKeyModifiers[t.key],null!=this._previewPlane&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0)}_onShiftGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=this._calculatePickRay(t.screenPoint);H(this.analysisViewData.plane,this._startPlane),this.inputState=kt(e,null,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"shift"!==a.type)return;const s=null!=this.analysisViewData.plane?H(this.analysisViewData.plane,S()):null;e.next(mt(this.view,a.shiftPlane)).next(this._shiftDragAdjustSensitivity(a)).next(this._shiftDragUpdatePlane(a)),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_shiftDragAdjustSensitivity(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=.001,a=Math.min((1-Math.abs(g(x(this.analysisViewData.plane),e.ray.direction)/w(e.ray.direction)))/i,1),s=-R(this._startPlane.plane,e.renderEnd),n=-R(this._startPlane.plane,t.startPoint);return t.depth=t.depth*(1-a)+s*a-n,e}}_shiftDragUpdatePlane(t){return()=>{if(null==this.analysisViewData.plane)return;const e=f(G.get(),this._startPlane.origin),i=f(G.get(),x(this._startPlane));M(i,i,-t.depth),D(i,i,e);const a=I(i,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,S());this._updateBoundedPlane(a)}}_onRotateHeadingGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=it(this.analysisViewData.plane,this.view.renderCoordsHelper,at.HEADING,j()),i=this._calculatePickRay(t.screenPoint),a=E();O(e,i,a)&&(H(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateHeadingDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?H(this.analysisViewData.plane,S()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_onRotateTiltGrab(t){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const e=it(this.analysisViewData.plane,this.view.renderCoordsHelper,at.TILT,j()),i=this._calculatePickRay(t.screenPoint),a=E();O(e,i,a)&&(H(this.analysisViewData.plane,this._startPlane),this.inputState={type:"rotate",rotatePlane:e,startPoint:a})}_createRotateTiltDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"rotate"!==a.type)return;const s=null!=this.analysisViewData.plane?H(this.analysisViewData.plane,S()):null;e.next(mt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdatePlaneFromRotate()),i.next((()=>{null!=s&&this._updateBoundedPlane(s)}))}))}_rotateDragRenderPlaneToRotate(t){return e=>{if(null==this.analysisViewData.plane)return null;const i=C(t.rotatePlane),a=yt(t.startPoint,e.renderEnd,this.analysisViewData.plane.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdatePlaneFromRotate(){return t=>{if(null==this.analysisViewData.plane)return;const e=P(U.get(),t.rotateAngle,t.rotateAxis);if(null==e)return;const i=T(G.get(),this._startPlane.basis1,e),a=T(G.get(),this._startPlane.basis2,e),s=I(this.analysisViewData.plane.origin,i,a,S());this._updateBoundedPlane(s)}}_onResizeGrab(t,e){if("start"!==t.action||null==this.analysisViewData.plane||!t.screenPoint)return;const i=this._calculatePickRay(t.screenPoint),a=G.get();O(this.analysisViewData.plane.plane,i,a)&&(H(this.analysisViewData.plane,this._startPlane),this.inputState={type:"resize",activeHandleIdx:e,startPoint:k(a)})}_createResizeDragPipeline(t){return Dt(t,((t,e,i)=>{const a=this.inputState;if(null==a||"resize"!==a.type||null==this.analysisViewData.plane)return;const s=H(this.analysisViewData.plane,S());e.next(mt(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(a)),i.next((()=>{this._updateBoundedPlane(s)}))}))}_resizeDragUpdatePlane(t){return e=>{if(null==this.analysisViewData.plane)return;const i=this._resizeHandles[t.activeHandleIdx],a=st(i,t.startPoint,e.renderEnd,this.view.state.camera,this._startPlane,H(this.analysisViewData.plane));this._updateBoundedPlane(a)}}_updateBoundedPlane(t){const e=this.analysisViewData;if(null==e)throw new Error("valid internal object expected");e.plane=t}_updatePreviewPlane(t,e={}){let i=this._previewPlane;if(this._previewPlane=null,null==t)return this._removeFrameTask(),void this._updateManipulators();if(!this.analysisViewData.plane&&this.active){const a=null!=i?i:S();if(i=null!=i?H(i,St):null,this._pickPlane(t,!0,e,a)){const t=Z;let e=!1;null!=i&&(e=g(i.plane,a.plane)<t||g(V(G.get(),i.basis1),V(G.get(),a.basis1))<t),e&&(this._previewPlaneOpacity=0),this._previewPlane=a}}null!=this._previewPlane&&null==this._frameTask&&0===this._previewPlaneOpacity?this._frameTask=p({update:({deltaTime:t})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+t/(1e3*J),1),this._updateManipulators(),1===this._previewPlaneOpacity&&this._removeFrameTask()}}):null==this._previewPlane&&null!=this._frameTask?this._removeFrameTask():null!=this._previewPlane&&this._updateManipulators()}_removeFrameTask(){this._frameTask=r(this._frameTask)}_calculatePickRay(t){const e=z(),i=c(t,Ht);return gt(this.view.state.camera,i,e),V(e.direction,e.direction),e}_pickMinResult(t){const e=c(t,L.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(e,this._intersector),this._intersector.results.min}_pickPlane(t,e,i,a){const s=this._pickMinResult(t),n=G.get();if(!s.getIntersectionPoint(n))return!1;const r=s.getTransformedNormal(G.get()),l=this.view.state.camera;g(r,l.viewForward)>0&&M(r,r,-1);const o=nt(n,l),h=(e?1:-1)*o*Q,p=M(G.get(),r,h);D(p,p,n);const u=this.analysis.tiltEnabled?rt.TILTED:rt.HORIZONTAL_OR_VERTICAL,c=i[B]?rt.VERTICAL:i[F]?rt.HORIZONTAL:u;return lt(p,r,o,o,l,c,this.view.renderCoordsHelper,a),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=r(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=ot,this.rotateHeadingManipulator.state|=ot,this.rotateTiltManipulator.state|=ot,this._prevPointerMoveTimeout=this._clock.setTimeout((()=>{this.shiftManipulator.state&=~ot,this.rotateHeadingManipulator.state&=~ot,this.rotateTiltManipulator.state&=~ot}),this._pointerMoveTimerMs)}_updateManipulators(){if(Vt.disableEngineLayers)return;let t,e=!1;if(null!=this.analysisViewData.plane)t=this.analysisViewData.plane,e=!1;else{if(null==this._previewPlane)return this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.visible=!1,void(this._previewPlaneGridVisualElement.visible=!1);t=this._previewPlane,e=!0}const i=ht(t,U.get());e?(this.shiftManipulator.available=!1,this.rotateHeadingManipulator.available=!1,this.rotateTiltManipulator.available=!1,this.resizeManipulators.forEach((t=>t.available=!1)),this._previewPlaneOutlineVisualElement.attached=!0,this._previewPlaneGridVisualElement.attached=!0,this._previewPlaneOutlineVisualElement.visible=!0,this._previewPlaneGridVisualElement.visible=!0):(this.shiftManipulator.available=!0,this.rotateHeadingManipulator.available=!0,this.rotateTiltManipulator.available=this.analysis.tiltEnabled,this.resizeManipulators.forEach((t=>t.available=!0)),pt(this.shiftManipulator,i,t,this.view.state.camera),ut(this.rotateHeadingManipulator,i,t,this.view.renderCoordsHelper),ct(this.rotateTiltManipulator,i,t),this.resizeManipulators.forEach(((e,a)=>dt(e,this._resizeHandles[a],i,t))),this._previewPlaneOutlineVisualElement.visible=!1,this._previewPlaneGridVisualElement.visible=!1);const a=b(G.get(),w(t.basis1),w(t.basis2),1),s=y(U.get(),a),n=m(s,i,s);this._previewPlaneOutlineVisualElement.transform=n,this._previewPlaneGridVisualElement.transform=n,this._updateMaterials()}_updateMaterials(){const t=[N[0],N[1],N[2],N[3]*this._previewPlaneOpacity];this._previewPlaneOutlineVisualElement.color=t;const e=[q[0],q[1],q[2],q[3]*this._previewPlaneOpacity],i=[0,0,0,0];this._previewPlaneGridVisualElement.backgroundColor=e,this._previewPlaneGridVisualElement.gridColor=i}_updateManipulatorsInteractive(t){if(!t.grabbing)return this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,void this.resizeManipulators.forEach((t=>{t.interactive=!0}));this.shiftManipulator.interactive=this.shiftManipulator===t,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===t,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===t,this.resizeManipulators.forEach((e=>{e.interactive=e===t}))}testData(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:t=>{this._pointerMoveTimerMs=t}}}};function kt(t,e,i,a){const s=_t(i,x(a),t.direction,j()),n=E();return O(s,t,n)?{type:"shift",creatingPointerId:e,hasBeenDragged:!1,shiftPlane:s,depth:0,startPoint:n}:null}function Et(t){return"mouse"!==t.pointerType||0===t.button}bt.disableEngineLayers=!1,t([_()],bt.prototype,"_clock",void 0),t([_({constructOnly:!0})],bt.prototype,"view",void 0),t([_()],bt.prototype,"analysisViewData",void 0),t([_({readOnly:!0})],bt.prototype,"state",null),t([_({readOnly:!0})],bt.prototype,"cursor",null),t([_()],bt.prototype,"analysis",null),t([_()],bt.prototype,"removeIncompleteOnCancel",void 0),t([_({readOnly:!0})],bt.prototype,"layersMode",void 0),t([_({value:null})],bt.prototype,"inputState",null),t([_()],bt.prototype,"_isPlacingSlicePlane",null),t([_()],bt.prototype,"_creatingPointerId",null),bt=Vt=t([v("esri.views.3d.analysis.Slice.SliceTool")],bt);const St=S(),Ht=d(),xt=bt;export{xt 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"../../../../geometry.js";import e from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{rad2deg as n,deg2rad as i}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{q as r,b as s,k as a,m as c,r as l,i as u,w as d,F as m}from"../../../../chunks/mat4.js";import{c as g}from"../../../../chunks/mat4f64.js";import{r as p}from"../../../../chunks/quat.js";import{g as f,c as b,e as h,f as T,n as w,a as O,l as E,b as I,s as R,p as j,w as A}from"../../../../chunks/vec3.js";import{a as L,c as _,f as C}from"../../../../chunks/vec3f64.js";import{tryProjectWithZConversion as N}from"../../../../geometry/projection.js";import{Axis as P}from"../../../../geometry/support/Axis.js";import{r as M,f as v,i as U,a as V,n as y,u as S}from"../../../../chunks/boundedPlane.js";import{fromVectorsAndPoint as k,fromPositionAndNormal as H}from"../../../../geometry/support/plane.js";import{create as x}from"../../../../geometry/support/ray.js";import{angleAroundAxis as F}from"../../../../geometry/support/vector.js";import{sv3d as G,sm4d as D,sq4d as X}from"../../../../geometry/support/vectorStacks.js";import{VERTICAL_DOT_THRESHOLD as Y,SMALL_ANGLE_DOT_THRESHOLD as Z,PLANE_MIN_BASIS_SCREEN_LEN2 as W,INITIAL_PLANE_HALF_SIZE_VIEW_PROPORTION as q,SHIFT_RESTART_OFFSET_DISTANCE as B,RESIZE_HANDLE_EDGE_PADDING_FRAC as z,SHIFT_RESTART_CALLOUT_COLOR as $,SHIFT_RESTART_TIP_RADIUS as J,PLANE_OUTLINE_COLOR as K,PLANE_OUTLINE_WIDTH as Q,PLANE_BACKGROUND_COLOR as ee,GRID_COLOR as te,RESIZE_HANDLE_CORNER_INPUT_RADIUS as ne,RESIZE_HANDLE_EDGE_INPUT_RADIUS as ie,SHIFT_RESTART_ARROW_TIP_COLOR as oe,SHIFT_RESTART_ARROW_CAP_COLOR as re,SHIFT_RESTART_TUBE_COLOR as se,SHIFT_RESTART_OUTLINE_COLOR as ae,SHIFT_RESTART_TIP_LENGTH as ce,SHIFT_RESTART_ARROW_LENGTH as le,SHIFT_RESTART_ARROW_OUTLINE_WIDTH as ue,RESIZE_HANDLE_CORNER_WIDTH as de,RESIZE_HANDLE_EDGE_WIDTH as me,DISPLAY_FOCUS_MULTIPLIER as ge,SHIFT_RESTART_TUBE_RADIUS as pe,SHIFT_RESTART_TUBE_FOCUS_MULTIPLIER as fe,RESIZE_HANDLE_COLOR as be,SHIFT_RESTART_TIP_FOCUS_MULTIPLIER as he}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as Te}from"../support/projectionUtils.js";import{Manipulator3D as we}from"../../interactive/Manipulator3D.js";import{calculateTranslateRotateFromBases as Oe,createRotateManipulator as Ee,worldScaledManipulatorSettings as Ie}from"../../interactive/manipulatorUtils.js";import{RenderObject as Re}from"../../interactive/RenderObject.js";import{LineVisualElement as je}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as Ae}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as Le}from"../../support/RenderCoordsHelper.js";import{fromRender as _e}from"../../support/geometryUtils/ray.js";import{CullFaceOptions as Ce}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as Ne,createConeGeometry as Pe,createPathExtrusionGeometry as Me}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as ve}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as Ue}from"../../webgl-engine/materials/ColorMaterial.js";import{NativeLineMaterial as Ve}from"../../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as ye}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateCustomFlags as Se,ManipulatorStateFlags as ke}from"../../../interactive/interfaces.js";import He from"../../../../geometry/Extent.js";function xe(e,t,n,i,o,r,s,a){return Fe(t,s.worldUpAtPosition(e,G.get()),o,r,a.basis1,a.basis2),f(a.basis1,a.basis1,n),f(a.basis2,a.basis2,i),b(a.origin,e),k(a.basis2,a.basis1,a.origin,a.plane),a}function Fe(e,t,n,i,o,r){const s=h(e,t),a=G.get(),c=G.get();switch(i===Et.HORIZONTAL_OR_VERTICAL?Math.abs(s)>Y?Et.HORIZONTAL:Et.VERTICAL:i){case Et.VERTICAL:{const i=Math.abs(s)<=Z?e:n.viewUp;T(a,i,t),b(c,t);break}case Et.HORIZONTAL:T(a,n.viewUp,t),T(c,t,a);break;case Et.TILTED:{const i=Math.abs(s)<=Z?t:n.viewUp;T(a,i,e),T(c,e,a);break}}const l=T(G.get(),a,c);h(l,n.viewForward)>0&&f(c,c,-1),w(o,a),w(r,c)}function Ge(e,t,n){const i=t.worldUpAtPosition(e.origin,G.get()),o=e.basis1,r=pt(e,i),s=Math.round(r/jt)*jt;return M(e,s-r,o,n)}function De(e,t,n,i,o,r){const s=b(G.get(),o.origin);O(s,s,f(G.get(),o.basis1,e.direction[0]<0?1:-1)),O(s,s,f(G.get(),o.basis2,e.direction[1]<0?1:-1));const a=E(o.basis1),c=E(o.basis2),l=I(G.get(),n,s),u=I(G.get(),t,s);let d=0,m=0;if(it(e)){const t=nt(o),n=nt(r);d=a-.5*e.direction[0]*h(o.basis1,u)/a,m=c-.5*e.direction[1]*h(o.basis2,u)/c;const i=n/t;d*=i,m*=i}const g=d+.5*e.direction[0]*h(o.basis1,l)/a,p=m+.5*e.direction[1]*h(o.basis2,l)/c,T=f(G.get(),o.basis1,g/a),w=f(G.get(),o.basis2,p/c);(g<=0||et(r.origin,T,i)<=W)&&b(T,r.basis1),(p<=0||et(r.origin,w,i)<=W)&&b(w,r.basis2);const R=b(G.get(),s);return O(R,R,f(G.get(),T,e.direction[0]<0?-1:1)),O(R,R,f(G.get(),w,e.direction[1]<0?-1:1)),v(R,T,w,r)}function Xe(e,t){return q*Math.min(t.width,t.height)*t.computeRenderPixelSizeAt(e)}function Ye(e,t,n,i){const o=T(G.get(),t,n);return T(o,o,t),H(e,o,i)}function Ze(e,t){return Oe(e.basis1,e.basis2,e.origin,t)}function We(e,t,n,i){const o=t.worldUpAtPosition(e.origin,G.get()),r=G.get();switch(n){case Ot.HEADING:b(r,o);break;case Ot.TILT:b(r,e.basis1)}return H(e.origin,r,i)}function qe(e,t,n,i){const s=Qe(n,Ke.NEGATIVE_X),a=D.get();r(a,t,s.edge*Math.PI/2);const c=w(G.get(),s.basis);let l=f(G.get(),c,s.direction*i.computeScreenPixelSizeAt(s.position)*B);O(l,l,s.position);const u=i.projectToRenderScreen(l,o(G.get())),d=Be(i,u);_e(i,u,Rt),w(Rt.direction,Rt.direction);const m=G.get();!d&&U(n,Rt,m)&&(l=m),a[12]=0,a[13]=0,a[14]=0,e.modelTransform=a,e.renderLocation=L(l),d?e.state|=It:e.state&=~It}function Be(e,t){const[n,i,o,r]=e.viewport,s=Math.min(o,r)/16;let a=!0;return t[0]<n+s?(t[0]=n+s,a=!1):t[0]>n+o-s&&(t[0]=n+o-s,a=!1),t[1]<i+s?(t[1]=i+s,a=!1):t[1]>i+r-s&&(t[1]=i+r-s,a=!1),a}function ze(e,t,n,i){const o=E(i.basis1),r=E(i.basis2),l=tt(i),u=nt(i),d=R(G.get(),0,0,0);O(d,f(G.get(),i.basis1,t.direction[0]),f(G.get(),i.basis2,t.direction[1])),O(d,i.origin,d);let m=0,g=1;if(it(t))1===t.direction[0]&&-1===t.direction[1]?m=jt:1===t.direction[0]&&1===t.direction[1]?m=Math.PI:-1===t.direction[0]&&1===t.direction[1]&&(m=3*Math.PI/2),g=u;else{const e=0!==t.direction[0]?1:2;m=1===e?jt:0,g=(1===e?r:o)-l}const p=s(D.get(),m);a(p,p,R(G.get(),g,g,g)),c(p,n,p),p[12]=0,p[13]=0,p[14]=0,e.modelTransform=p,e.renderLocation=d}function $e(e,t,n,i){const o=i.worldUpAtPosition(n.origin,G.get()),r=Qe(n,Ke.POSITIVE_X),a=s(D.get(),r.edge*Math.PI/2);l(a,a,-pt(n,o)),c(a,t,a),a[12]=0,a[13]=0,a[14]=0,e.modelTransform=a,e.renderLocation=r.position}function Je(e,t,n){const i=Qe(n,Ke.POSITIVE_Y),o=s(D.get(),i.edge*Math.PI/2);l(o,o,jt),c(o,t,o),o[12]=0,o[13]=0,o[14]=0,e.modelTransform=o,e.renderLocation=i.position}var Ke;function Qe(e,t){switch(t){case Ke.POSITIVE_X:return{basis:e.basis1,direction:1,position:O(G.get(),e.origin,e.basis1),edge:t};case Ke.POSITIVE_Y:return{basis:e.basis2,direction:1,position:O(G.get(),e.origin,e.basis2),edge:t};case Ke.NEGATIVE_X:return{basis:e.basis1,direction:-1,position:I(G.get(),e.origin,e.basis1),edge:t};case Ke.NEGATIVE_Y:return{basis:e.basis2,direction:-1,position:I(G.get(),e.origin,e.basis2),edge:t}}}function et(e,t,n){const i=n.projectToRenderScreen(O(G.get(),e,t),o(G.get())),r=n.projectToRenderScreen(I(G.get(),e,t),o(G.get()));return j(I(i,i,r))}function tt(e){const t=E(e.basis1),n=E(e.basis2);return z*Math.min(t,n)}function nt(e){return tt(e)}function it(e){return 0!==e.direction[0]&&0!==e.direction[1]}function ot(e,t=_t.CENTER_ON_ARROW){const n=t===_t.CENTER_ON_CALLOUT?B:0,i=[C(n,0,-le/2),C(n,0,le/2)],o=dt(i,!0),r=(e,t)=>lt(i,e,t),s=r(0,!1),a=r(ue,!0),c=new Ve({color:$,renderOccluded:ve.OccludeAndTransparent}),l=Ne(c,[[n,0,0],[n-B,0,0]]),u=Ne(c,[[n,0,0],[n-B,0,0]]);return new we({view:e,renderObjects:[...s.normal.map((e=>new Re(e,ke.Unfocused|wt))),...a.normal.map((e=>new Re(e,ke.Unfocused|wt))),new Re(l,ke.Unfocused|wt|It),...s.focused.map((e=>new Re(e,ke.Focused|wt))),...a.focused.map((e=>new Re(e,ke.Focused|wt))),new Re(u,ke.Focused|wt|It)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[o]},collisionPriority:1,radius:J,state:wt})}function rt(e,t){const n=Ee(e,{customStateMask:wt,texture:t});return n.state=wt,n}function st(e){const t=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new je({view:e,attached:!1,color:K,width:Q,writeDepthEnabled:!1,renderOccluded:ve.OccludeAndTransparent,geometry:[t]})}function at(e){return new Ae({view:e,attached:!1,backgroundColor:[...ee],gridColor:te,gridWidth:4,renderOccluded:ve.OccludeAndTransparent})}function ct(e,t){const n=it(t),i=n?[C(1,0,0),C(0,0,0),C(0,1,0)]:[C(1,0,0),C(-1,0,0)],o=be,r=e=>new ye({color:o,width:e,renderOccluded:ve.OccludeAndTransparent}),s=()=>new Ve({color:o,renderOccluded:ve.OccludeAndTransparent}),a=n?de:me,c=a*ge,l=me,u=e=>e>1?r(e):s(),d=[new Re(Ne(u(a),i),ke.Unfocused|At),new Re(Ne(u(c),i),ke.Focused|At),new Re(Ne(u(l),i),Lt)],m=new we({view:e,renderObjects:d,collisionType:{type:"line",paths:[i]},radius:n?ne:ie,...Ie});return m.state=At,m}function lt(e,t,n){const i=new Ue({color:oe,cullFace:Ce.Back,renderOccluded:ve.Opaque}),o=new Ue({color:re,cullFace:Ce.Back,renderOccluded:ve.Opaque}),r=new Ue({color:se,cullFace:Ce.Back,renderOccluded:ve.Opaque}),s=new Ue({color:ae,transparent:!0,writeDepth:!1,cullFace:Ce.Front,renderOccluded:ve.Transparent}),l=l=>{e=e.slice(0);const b=I(G.get(),e[0],e[1]);w(b,b);const h=I(G.get(),e[e.length-1],e[e.length-2]);if(w(h,h),t>0){const n=f(_(),h,-t);e[e.length-1]=O(n,n,e[e.length-1]);const i=f(_(),b,-t);e[0]=O(i,i,e[0])}const T=l?he:1,E=ce*T,j=J*T,A=u(D.get());if(t>0){const e=E/4,n=R(G.get(),0,e,0),i=1+t/e;d(A,A,n),a(A,A,R(G.get(),i,i,i)),d(A,A,f(n,n,-1/i))}const L=u(g()),N=C(0,1,0),P=m(g(),p(X.get(),N,h));P[12]=e[e.length-1][0],P[13]=e[e.length-1][1],P[14]=e[e.length-1][2],c(P,P,A);const M=ut(pe*(l?fe:1)+t,e,n?s:r);M.transformation=L;const v=[M],U=Pe(n?s:i,E,j,24,!1,!1,!0);U.transformation=P,v.push(U);const V=Pe(n?s:o,E,j,24,!1,!0,!1);V.transformation=P,v.push(V);const y=m(g(),p(X.get(),N,b));return y[12]=e[0][0],y[13]=e[0][1],y[14]=e[0][2],c(y,y,A),v.push(U.instantiate({transformation:y})),v.push(V.instantiate({transformation:y})),v};return{normal:l(!1),focused:l(!0)}}function ut(e,t,n){const i=[],o=12;for(let r=0;r<o;r++){const t=r/o*2*Math.PI;i.push([Math.cos(t)*e,Math.sin(t)*e])}return Me(n,i,t,[],[],!1)}function dt(e,t){const n=I(_(),e[e.length-1],e[e.length-2]);if(w(n,n),f(n,n,ce),O(n,n,e[e.length-1]),t){const t=I(_(),e[0],e[1]);return w(t,t),f(t,t,ce),O(t,t,e[0]),[t,...e,n]}return[...e,n]}function mt(t,i,o,r=new e){if(null==t)return null;const{renderCoordsHelper:s}=i,a=s.fromRenderCoords(t.origin,i.spatialReference);if(null==a)return null;const c=N(a,o);if(null==c)return null;r.position=c;const l=2*E(t.basis1),u=2*E(t.basis2),d=Le.renderUnitScaleFactor(i.spatialReference,o);r.width=l*d,r.height=u*d;const m=s.worldUpAtPosition(t.origin,G.get());return r.tilt=n(pt(t,m)),r.heading=s.headingAtPosition(t.origin,t.basis1)-90,r}function gt(e,t,n){if(null==e)return null;const i=e.origin,o=G.get(),r=G.get(),s=G.get(),a=G.get();let c,l,u,d,m,g;O(o,i,e.basis1),O(o,o,e.basis2),O(r,i,e.basis1),A(r,r,e.basis2),A(s,i,e.basis1),A(s,s,e.basis2),A(a,i,e.basis1),O(a,a,e.basis2);for(const p of[o,r,s,a]){const e=t.fromRenderCoords(p,p,n);if(null==e)return null;c=null==c?e[0]:Math.min(c,e[0]),l=null==l?e[0]:Math.max(l,e[0]),u=null==u?e[1]:Math.min(u,e[1]),d=null==d?e[1]:Math.max(d,e[1]),m=null==m?e[2]:Math.min(m,e[2]),g=null==g?e[2]:Math.max(g,e[2])}return new He({xmin:c,xmax:l,ymin:u,ymax:d,zmin:m,zmax:g,spatialReference:n})}function pt(e,t){return F(t,e.basis2,e.basis1)+jt}function ft(e,n,o,r,s,a,c=V()){return a.toRenderCoords(e,c.origin)?(a.worldBasisAtPosition(c.origin,P.X,c.basis1),a.worldBasisAtPosition(c.origin,P.Y,c.basis2),k(c.basis2,c.basis1,c.origin,c.plane),M(c,-i(n),y(c),c),M(c,i(o),c.basis1,c),f(c.basis1,c.basis1,r/2),f(c.basis2,c.basis2,s/2),S(c),c):(t.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${e.spatialReference.wkid} is not supported`),null)}function bt(e,t){if(null==e||null==e.position)return null;const n=Te(e.position,t.spatialReference,t.elevationProvider);if(null==n)return null;const i=Le.renderUnitScaleFactor(e.position.spatialReference,t.spatialReference),o=e.width*i,r=e.height*i;return{position:n,heading:e.heading,tilt:e.tilt,renderWidth:o,renderHeight:r}}function ht(e,t,n,i=V()){const o=bt(e,t);return null==o?null:Tt(o,t,n,i)}function Tt(e,t,n,i=V()){if(null==e)return null;const o=ft(e.position,e.heading,e.tilt,e.renderWidth,e.renderHeight,t.renderCoordsHelper,i);return n.tiltEnabled||null==o||Ge(o,t.renderCoordsHelper,o),o}!function(e){e[e.POSITIVE_X=0]="POSITIVE_X",e[e.POSITIVE_Y=1]="POSITIVE_Y",e[e.NEGATIVE_X=2]="NEGATIVE_X",e[e.NEGATIVE_Y=3]="NEGATIVE_Y"}(Ke||(Ke={}));const wt=Se.Custom1;var Ot,Et;!function(e){e[e.HEADING=1]="HEADING",e[e.TILT=2]="TILT"}(Ot||(Ot={})),function(e){e[e.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",e[e.HORIZONTAL=1]="HORIZONTAL",e[e.VERTICAL=2]="VERTICAL",e[e.TILTED=3]="TILTED"}(Et||(Et={}));const It=Se.Custom2,Rt=x(),jt=Math.PI/2,At=Se.Custom1,Lt=Se.Custom2;var _t;function Ct(e){return null!=("building-scene-3d"===e.type?e:null)}!function(e){e[e.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",e[e.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(_t||(_t={}));export{wt as DidPointerMoveRecentlyFlag,It as IsShiftEdgeOnScreenFlag,_t as OffsetMode,Ot as RotationAxis,Et as SliceOrientation,dt as addArrowTips,Ze as calculateBoundedPlaneTranslateRotate,nt as calculateDiagonalResizeHandleScale,Xe as calculatePlaneHalfSize,tt as calculateResizeHandlePadding,et as calculateScreenSpaceBasisLength2,lt as createArrowGeometry,at as createGridVisualElement,st as createOutlineVisualElement,xe as createPlane,ct as createResizeManipulator,rt as createRotateManipulator,We as createRotatePlane,ot as createShiftManipulator,Ye as createShiftPlane,Ge as forceHorizontalOrVertical,it as isDiagonalResizeHandle,Ct as isIBuildingSceneLayerView3D,Fe as normalToBases,gt as planeToExtent,mt as planeToShape,bt as projectAndElevationAlignShape,Tt as projectedShapeToPlane,At as resizeNormal,Lt as resizeOutlineOnly,De as resizePlane,ht as shapeToPlane,ze as updateResizeHandle,$e as updateRotateHeadingHandle,Je as updateRotateTiltHandle,qe as updateShiftRestartHandle};
|
|
5
|
+
import"../../../../geometry.js";import e from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{rad2deg as n,deg2rad as i}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{q as r,b as s,k as a,m as c,r as l,i as u,w as d,F as m}from"../../../../chunks/mat4.js";import{c as g}from"../../../../chunks/mat4f64.js";import{r as p}from"../../../../chunks/quat.js";import{g as f,c as b,e as h,f as T,n as w,a as O,l as E,b as I,s as R,p as j,w as A}from"../../../../chunks/vec3.js";import{a as L,c as _,f as C}from"../../../../chunks/vec3f64.js";import{tryProjectWithZConversion as N}from"../../../../geometry/projection.js";import{Axis as P}from"../../../../geometry/support/Axis.js";import{r as M,f as v,i as U,a as V,n as y,u as S}from"../../../../chunks/boundedPlane.js";import{fromVectorsAndPoint as k,fromPositionAndNormal as H}from"../../../../geometry/support/plane.js";import{create as x}from"../../../../geometry/support/ray.js";import{angleAroundAxis as F}from"../../../../geometry/support/vector.js";import{sv3d as G,sm4d as D,sq4d as X}from"../../../../geometry/support/vectorStacks.js";import{VERTICAL_DOT_THRESHOLD as Y,SMALL_ANGLE_DOT_THRESHOLD as Z,PLANE_MIN_BASIS_SCREEN_LEN2 as W,INITIAL_PLANE_HALF_SIZE_VIEW_PROPORTION as q,SHIFT_RESTART_OFFSET_DISTANCE as B,RESIZE_HANDLE_EDGE_PADDING_FRAC as z,SHIFT_RESTART_CALLOUT_COLOR as $,SHIFT_RESTART_TIP_RADIUS as J,PLANE_OUTLINE_COLOR as K,PLANE_OUTLINE_WIDTH as Q,PLANE_BACKGROUND_COLOR as ee,GRID_COLOR as te,RESIZE_HANDLE_CORNER_INPUT_RADIUS as ne,RESIZE_HANDLE_EDGE_INPUT_RADIUS as ie,SHIFT_RESTART_ARROW_TIP_COLOR as oe,SHIFT_RESTART_ARROW_CAP_COLOR as re,SHIFT_RESTART_TUBE_COLOR as se,SHIFT_RESTART_OUTLINE_COLOR as ae,SHIFT_RESTART_TIP_LENGTH as ce,SHIFT_RESTART_ARROW_LENGTH as le,SHIFT_RESTART_ARROW_OUTLINE_WIDTH as ue,RESIZE_HANDLE_CORNER_WIDTH as de,RESIZE_HANDLE_EDGE_WIDTH as me,DISPLAY_FOCUS_MULTIPLIER as ge,SHIFT_RESTART_TUBE_RADIUS as pe,SHIFT_RESTART_TUBE_FOCUS_MULTIPLIER as fe,RESIZE_HANDLE_COLOR as be,SHIFT_RESTART_TIP_FOCUS_MULTIPLIER as he}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as Te}from"../support/projectionUtils.js";import{Manipulator3D as we}from"../../interactive/Manipulator3D.js";import{calculateTranslateRotateFromBases as Oe,createRotateManipulator as Ee,worldScaledManipulatorSettings as Ie}from"../../interactive/manipulatorUtils.js";import{RenderObject as Re}from"../../interactive/RenderObject.js";import{LineVisualElement as je}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as Ae}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as Le}from"../../support/RenderCoordsHelper.js";import{fromRender as _e}from"../../support/geometryUtils/ray.js";import{CullFaceOptions as Ce}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as Ne,createConeGeometry as Pe,createPathExtrusionGeometry as Me}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as ve}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as Ue}from"../../webgl-engine/materials/ColorMaterial.js";import{NativeLineMaterial as Ve}from"../../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as ye}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateCustomFlags as Se,ManipulatorStateFlags as ke}from"../../../interactive/interfaces.js";import He from"../../../../geometry/Extent.js";function xe(e,t,n,i,o,r,s,a){return Fe(t,s.worldUpAtPosition(e,G.get()),o,r,a.basis1,a.basis2),f(a.basis1,a.basis1,n),f(a.basis2,a.basis2,i),b(a.origin,e),k(a.basis2,a.basis1,a.origin,a.plane),a}function Fe(e,t,n,i,o,r){const s=h(e,t),a=G.get(),c=G.get();switch(i===Et.HORIZONTAL_OR_VERTICAL?Math.abs(s)>Y?Et.HORIZONTAL:Et.VERTICAL:i){case Et.VERTICAL:{const i=Math.abs(s)<=Z?e:n.viewUp;T(a,i,t),b(c,t);break}case Et.HORIZONTAL:T(a,n.viewUp,t),T(c,t,a);break;case Et.TILTED:{const i=Math.abs(s)<=Z?t:n.viewUp;T(a,i,e),T(c,e,a);break}}const l=T(G.get(),a,c);h(l,n.viewForward)>0&&f(c,c,-1),w(o,a),w(r,c)}function Ge(e,t,n){const i=t.worldUpAtPosition(e.origin,G.get()),o=e.basis1,r=pt(e,i),s=Math.round(r/jt)*jt;return M(e,s-r,o,n)}function De(e,t,n,i,o,r){const s=b(G.get(),o.origin);O(s,s,f(G.get(),o.basis1,e.direction[0]<0?1:-1)),O(s,s,f(G.get(),o.basis2,e.direction[1]<0?1:-1));const a=E(o.basis1),c=E(o.basis2),l=I(G.get(),n,s),u=I(G.get(),t,s);let d=0,m=0;if(it(e)){const t=nt(o),n=nt(r);d=a-.5*e.direction[0]*h(o.basis1,u)/a,m=c-.5*e.direction[1]*h(o.basis2,u)/c;const i=n/t;d*=i,m*=i}const g=d+.5*e.direction[0]*h(o.basis1,l)/a,p=m+.5*e.direction[1]*h(o.basis2,l)/c,T=f(G.get(),o.basis1,g/a),w=f(G.get(),o.basis2,p/c);(g<=0||et(r.origin,T,i)<=W)&&b(T,r.basis1),(p<=0||et(r.origin,w,i)<=W)&&b(w,r.basis2);const R=b(G.get(),s);return O(R,R,f(G.get(),T,e.direction[0]<0?-1:1)),O(R,R,f(G.get(),w,e.direction[1]<0?-1:1)),v(R,T,w,r)}function Xe(e,t){return q*Math.min(t.width,t.height)*t.computeRenderPixelSizeAt(e)}function Ye(e,t,n,i){const o=T(G.get(),t,n);return T(o,o,t),H(e,o,i)}function Ze(e,t){return Oe(e.basis1,e.basis2,e.origin,t)}function We(e,t,n,i){const o=t.worldUpAtPosition(e.origin,G.get()),r=G.get();switch(n){case Ot.HEADING:b(r,o);break;case Ot.TILT:b(r,e.basis1)}return H(e.origin,r,i)}function qe(e,t,n,i){const s=Qe(n,Ke.NEGATIVE_X),a=D.get();r(a,t,s.edge*Math.PI/2);const c=w(G.get(),s.basis);let l=f(G.get(),c,s.direction*i.computeScreenPixelSizeAt(s.position)*B);O(l,l,s.position);const u=i.projectToRenderScreen(l,o(G.get())),d=Be(i,u);_e(i,u,Rt),w(Rt.direction,Rt.direction);const m=G.get();!d&&U(n,Rt,m)&&(l=m),a[12]=0,a[13]=0,a[14]=0,e.modelTransform=a,e.renderLocation=L(l),d?e.state|=It:e.state&=~It}function Be(e,t){const[n,i,o,r]=e.viewport,s=Math.min(o,r)/16;let a=!0;return t[0]<n+s?(t[0]=n+s,a=!1):t[0]>n+o-s&&(t[0]=n+o-s,a=!1),t[1]<i+s?(t[1]=i+s,a=!1):t[1]>i+r-s&&(t[1]=i+r-s,a=!1),a}function ze(e,t,n,i){const o=E(i.basis1),r=E(i.basis2),l=tt(i),u=nt(i),d=R(G.get(),0,0,0);O(d,f(G.get(),i.basis1,t.direction[0]),f(G.get(),i.basis2,t.direction[1])),O(d,i.origin,d);let m=0,g=1;if(it(t))1===t.direction[0]&&-1===t.direction[1]?m=jt:1===t.direction[0]&&1===t.direction[1]?m=Math.PI:-1===t.direction[0]&&1===t.direction[1]&&(m=3*Math.PI/2),g=u;else{const e=0!==t.direction[0]?1:2;m=1===e?jt:0,g=(1===e?r:o)-l}const p=s(D.get(),m);a(p,p,R(G.get(),g,g,g)),c(p,n,p),p[12]=0,p[13]=0,p[14]=0,e.modelTransform=p,e.renderLocation=d}function $e(e,t,n,i){const o=i.worldUpAtPosition(n.origin,G.get()),r=Qe(n,Ke.POSITIVE_X),a=s(D.get(),r.edge*Math.PI/2);l(a,a,-pt(n,o)),c(a,t,a),a[12]=0,a[13]=0,a[14]=0,e.modelTransform=a,e.renderLocation=r.position}function Je(e,t,n){const i=Qe(n,Ke.POSITIVE_Y),o=s(D.get(),i.edge*Math.PI/2);l(o,o,jt),c(o,t,o),o[12]=0,o[13]=0,o[14]=0,e.modelTransform=o,e.renderLocation=i.position}var Ke;function Qe(e,t){switch(t){case Ke.POSITIVE_X:return{basis:e.basis1,direction:1,position:O(G.get(),e.origin,e.basis1),edge:t};case Ke.POSITIVE_Y:return{basis:e.basis2,direction:1,position:O(G.get(),e.origin,e.basis2),edge:t};case Ke.NEGATIVE_X:return{basis:e.basis1,direction:-1,position:I(G.get(),e.origin,e.basis1),edge:t};case Ke.NEGATIVE_Y:return{basis:e.basis2,direction:-1,position:I(G.get(),e.origin,e.basis2),edge:t}}}function et(e,t,n){const i=n.projectToRenderScreen(O(G.get(),e,t),o(G.get())),r=n.projectToRenderScreen(I(G.get(),e,t),o(G.get()));return j(I(i,i,r))}function tt(e){const t=E(e.basis1),n=E(e.basis2);return z*Math.min(t,n)}function nt(e){return tt(e)}function it(e){return 0!==e.direction[0]&&0!==e.direction[1]}function ot(e,t=_t.CENTER_ON_ARROW){const n=t===_t.CENTER_ON_CALLOUT?B:0,i=[C(n,0,-le/2),C(n,0,le/2)],o=dt(i,!0),r=(e,t)=>lt(i,e,t),s=r(0,!1),a=r(ue,!0),c=new Ve({color:$,renderOccluded:ve.OccludeAndTransparent}),l=Ne(c,[[n,0,0],[n-B,0,0]]),u=Ne(c,[[n,0,0],[n-B,0,0]]);return new we({view:e,renderObjects:[...s.normal.map((e=>new Re(e,ke.Unfocused|wt))),...a.normal.map((e=>new Re(e,ke.Unfocused|wt))),new Re(l,ke.Unfocused|wt|It),...s.focused.map((e=>new Re(e,ke.Focused|wt))),...a.focused.map((e=>new Re(e,ke.Focused|wt))),new Re(u,ke.Focused|wt|It)],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[o]},collisionPriority:1,radius:J,state:wt})}function rt(e,t){const n=Ee(e,{customStateMask:wt,texture:t});return n.state=wt,n}function st(e){const t=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new je({view:e,attached:!1,color:K,width:Q,writeDepthEnabled:!1,renderOccluded:ve.OccludeAndTransparent,geometry:[t]})}function at(e){return new Ae({view:e,attached:!1,backgroundColor:[...ee],gridColor:te,gridWidth:4,renderOccluded:ve.OccludeAndTransparent})}function ct(e,t){const n=it(t),i=n?[C(1,0,0),C(0,0,0),C(0,1,0)]:[C(1,0,0),C(-1,0,0)],o=be,r=e=>new ye({color:o,width:e,renderOccluded:ve.OccludeAndTransparent}),s=()=>new Ve({color:o,renderOccluded:ve.OccludeAndTransparent}),a=n?de:me,c=a*ge,l=me,u=e=>e>1?r(e):s(),d=[new Re(Ne(u(a),i),ke.Unfocused|At),new Re(Ne(u(c),i),ke.Focused|At),new Re(Ne(u(l),i),Lt)],m=new we({view:e,renderObjects:d,collisionType:{type:"line",paths:[i]},radius:n?ne:ie,...Ie});return m.state=At,m}function lt(e,t,n){const i=new Ue({color:oe,cullFace:Ce.Back,renderOccluded:ve.Opaque}),o=new Ue({color:re,cullFace:Ce.Back,renderOccluded:ve.Opaque}),r=new Ue({color:se,cullFace:Ce.Back,renderOccluded:ve.Opaque}),s=new Ue({color:ae,transparent:!0,writeDepth:!1,cullFace:Ce.Front,renderOccluded:ve.Transparent}),l=l=>{const b=e.slice(0),h=I(G.get(),b[0],b[1]);w(h,h);const T=I(G.get(),b[b.length-1],b[b.length-2]);if(w(T,T),t>0){const e=f(_(),T,-t);b[b.length-1]=O(e,e,b[b.length-1]);const n=f(_(),h,-t);b[0]=O(n,n,b[0])}const E=l?he:1,j=ce*E,A=J*E,L=u(D.get());if(t>0){const e=j/4,n=R(G.get(),0,e,0),i=1+t/e;d(L,L,n),a(L,L,R(G.get(),i,i,i)),d(L,L,f(n,n,-1/i))}const N=u(g()),P=C(0,1,0),M=m(g(),p(X.get(),P,T));M[12]=b[b.length-1][0],M[13]=b[b.length-1][1],M[14]=b[b.length-1][2],c(M,M,L);const v=ut(pe*(l?fe:1)+t,b,n?s:r);v.transformation=N;const U=[v],V=Pe(n?s:i,j,A,24,!1,!1,!0);V.transformation=M,U.push(V);const y=Pe(n?s:o,j,A,24,!1,!0,!1);y.transformation=M,U.push(y);const S=m(g(),p(X.get(),P,h));return S[12]=b[0][0],S[13]=b[0][1],S[14]=b[0][2],c(S,S,L),U.push(V.instantiate({transformation:S})),U.push(y.instantiate({transformation:S})),U};return{normal:l(!1),focused:l(!0)}}function ut(e,t,n){const i=[],o=12;for(let r=0;r<o;r++){const t=r/o*2*Math.PI;i.push([Math.cos(t)*e,Math.sin(t)*e])}return Me(n,i,t,[],[],!1)}function dt(e,t){const n=I(_(),e[e.length-1],e[e.length-2]);if(w(n,n),f(n,n,ce),O(n,n,e[e.length-1]),t){const t=I(_(),e[0],e[1]);return w(t,t),f(t,t,ce),O(t,t,e[0]),[t,...e,n]}return[...e,n]}function mt(t,i,o,r=new e){if(null==t)return null;const{renderCoordsHelper:s}=i,a=s.fromRenderCoords(t.origin,i.spatialReference);if(null==a)return null;const c=N(a,o);if(null==c)return null;r.position=c;const l=2*E(t.basis1),u=2*E(t.basis2),d=Le.renderUnitScaleFactor(i.spatialReference,o);r.width=l*d,r.height=u*d;const m=s.worldUpAtPosition(t.origin,G.get());return r.tilt=n(pt(t,m)),r.heading=s.headingAtPosition(t.origin,t.basis1)-90,r}function gt(e,t,n){if(null==e)return null;const i=e.origin,o=G.get(),r=G.get(),s=G.get(),a=G.get();let c,l,u,d,m,g;O(o,i,e.basis1),O(o,o,e.basis2),O(r,i,e.basis1),A(r,r,e.basis2),A(s,i,e.basis1),A(s,s,e.basis2),A(a,i,e.basis1),O(a,a,e.basis2);for(const p of[o,r,s,a]){const e=t.fromRenderCoords(p,p,n);if(null==e)return null;c=null==c?e[0]:Math.min(c,e[0]),l=null==l?e[0]:Math.max(l,e[0]),u=null==u?e[1]:Math.min(u,e[1]),d=null==d?e[1]:Math.max(d,e[1]),m=null==m?e[2]:Math.min(m,e[2]),g=null==g?e[2]:Math.max(g,e[2])}return new He({xmin:c,xmax:l,ymin:u,ymax:d,zmin:m,zmax:g,spatialReference:n})}function pt(e,t){return F(t,e.basis2,e.basis1)+jt}function ft(e,n,o,r,s,a,c=V()){return a.toRenderCoords(e,c.origin)?(a.worldBasisAtPosition(c.origin,P.X,c.basis1),a.worldBasisAtPosition(c.origin,P.Y,c.basis2),k(c.basis2,c.basis1,c.origin,c.plane),M(c,-i(n),y(c),c),M(c,i(o),c.basis1,c),f(c.basis1,c.basis1,r/2),f(c.basis2,c.basis2,s/2),S(c),c):(t.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${e.spatialReference.wkid} is not supported`),null)}function bt(e,t){if(null==e||null==e.position)return null;const n=Te(e.position,t.spatialReference,t.elevationProvider);if(null==n)return null;const i=Le.renderUnitScaleFactor(e.position.spatialReference,t.spatialReference),o=e.width*i,r=e.height*i;return{position:n,heading:e.heading,tilt:e.tilt,renderWidth:o,renderHeight:r}}function ht(e,t,n,i=V()){const o=bt(e,t);return null==o?null:Tt(o,t,n,i)}function Tt(e,t,n,i=V()){if(null==e)return null;const o=ft(e.position,e.heading,e.tilt,e.renderWidth,e.renderHeight,t.renderCoordsHelper,i);return n.tiltEnabled||null==o||Ge(o,t.renderCoordsHelper,o),o}!function(e){e[e.POSITIVE_X=0]="POSITIVE_X",e[e.POSITIVE_Y=1]="POSITIVE_Y",e[e.NEGATIVE_X=2]="NEGATIVE_X",e[e.NEGATIVE_Y=3]="NEGATIVE_Y"}(Ke||(Ke={}));const wt=Se.Custom1;var Ot,Et;!function(e){e[e.HEADING=1]="HEADING",e[e.TILT=2]="TILT"}(Ot||(Ot={})),function(e){e[e.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",e[e.HORIZONTAL=1]="HORIZONTAL",e[e.VERTICAL=2]="VERTICAL",e[e.TILTED=3]="TILTED"}(Et||(Et={}));const It=Se.Custom2,Rt=x(),jt=Math.PI/2,At=Se.Custom1,Lt=Se.Custom2;var _t;function Ct(e){return null!=("building-scene-3d"===e.type?e:null)}!function(e){e[e.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",e[e.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(_t||(_t={}));export{wt as DidPointerMoveRecentlyFlag,It as IsShiftEdgeOnScreenFlag,_t as OffsetMode,Ot as RotationAxis,Et as SliceOrientation,dt as addArrowTips,Ze as calculateBoundedPlaneTranslateRotate,nt as calculateDiagonalResizeHandleScale,Xe as calculatePlaneHalfSize,tt as calculateResizeHandlePadding,et as calculateScreenSpaceBasisLength2,lt as createArrowGeometry,at as createGridVisualElement,st as createOutlineVisualElement,xe as createPlane,ct as createResizeManipulator,rt as createRotateManipulator,We as createRotatePlane,ot as createShiftManipulator,Ye as createShiftPlane,Ge as forceHorizontalOrVertical,it as isDiagonalResizeHandle,Ct as isIBuildingSceneLayerView3D,Fe as normalToBases,gt as planeToExtent,mt as planeToShape,bt as projectAndElevationAlignShape,Tt as projectedShapeToPlane,At as resizeNormal,Lt as resizeOutlineOnly,De as resizePlane,ht as shapeToPlane,ze as updateResizeHandle,$e as updateRotateHeadingHandle,Je as updateRotateTiltHandle,qe as updateShiftRestartHandle};
|
|
@@ -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
|
-
var N,E;function
|
|
5
|
+
var N,E;function I(N){return null!=N?.cubeMap}function n(N){return null!=N&&!N.running}!function(N){N[N.RENDERING=0]="RENDERING",N[N.FINISHED_RENDERING=1]="FINISHED_RENDERING",N[N.FADING_TEXTURE_CHANNELS=2]="FADING_TEXTURE_CHANNELS",N[N.SWITCH_CHANNELS=3]="SWITCH_CHANNELS",N[N.FINISHED=4]="FINISHED"}(N||(N={})),function(N){N[N.RG=0]="RG",N[N.BA=1]="BA"}(E||(E={}));export{N as CloudsRenderingStages,E as CloudsTextureChannels,n as ensureClouds,I as isReadyCloudsData};
|
|
@@ -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 s from"../../../core/Handles.js";import{lerp as i}from"../../../core/mathUtils.js";import{releaseMaybe as r,disposeMaybe as a,destroyMaybe as o}from"../../../core/maybe.js";import{watch as n,initial as h}from"../../../core/reactiveUtils.js";import{property as u}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import s from"../../../core/Handles.js";import{lerp as i}from"../../../core/mathUtils.js";import{releaseMaybe as r,disposeMaybe as a,destroyMaybe as o}from"../../../core/maybe.js";import{watch as n,initial as h}from"../../../core/reactiveUtils.js";import{property as u}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{f as d}from"../../../chunks/mat3.js";import{v as c}from"../../../chunks/mat4.js";import{c as m}from"../../../chunks/mat4f64.js";import{s as p,o as _,c as f}from"../../../chunks/vec2.js";import{a as g}from"../../../chunks/vec2f64.js";import{f as w,z as T}from"../../../chunks/vec3f32.js";import{getReferenceEllipsoid as x}from"../../../geometry/ellipsoidUtils.js";import{C as v,a as C}from"../../../chunks/Clouds.glsl.js";import{CloudsTextureChannels as y,CloudsRenderingStages as P}from"./CloudsData.js";import{cloudPresets as b}from"./CloudsPresets.js";import{CloudsTechnique as S}from"./CloudsTechnique.js";import{CloudsTechniqueConfiguration as I,RayMarchingSteps as j}from"./CloudsTechniqueConfiguration.js";import{NoiseTextureAtlas as E}from"./NoiseTextureAtlas.js";import{BindParameters as D}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as M}from"../webgl-engine/lib/glUtil3D.js";import{TaskPriority as z,Task as U}from"../../support/Scheduler.js";import{TextureType as F,PixelFormat as R,PixelType as q,TextureWrapMode as B,TextureSamplingMode as N,TargetType as A}from"../../webgl/enums.js";import{FramebufferObject as H}from"../../webgl/FramebufferObject.js";let O=class extends t{constructor(e){super(e),this._handles=new s,this._techniques=new Array,this._techniqueConfiguration=new I,this._bindParameters=new D(null,null,null),this._passParameters=new v,this._drawParameters=new C,this._weatherTile=g(),this._weatherTileCount=128,this._faceIndex=0,this._tileIndex=0,this.coverage=i(b.default.coverage[0],b.default.coverage[1],.5),this.density=i(b.default.density[0],b.default.density[1],.5),this.absorption=i(b.default.absorption[0],b.default.absorption[1],.5),this.cloudSize=i(b.default.cloudSize[0],b.default.cloudSize[1],.5),this.detailSize=i(b.default.detailSize[0],b.default.detailSize[1],.5),this.smoothness=i(b.default.smoothness[0],b.default.smoothness[1],.5),this.cloudHeight=i(b.default.cloudHeight[0],b.default.cloudHeight[1],.5),this.raymarchingSteps=b.default.raymarchingSteps,this._viewMatrix=m(),this._dirty=!1,this.running=!1,this._vao=M(e.context.renderContext.rctx)}_getTechnique(e){const t=1-this.context.renderContext.bindParameters.cloudsFade.readChannels,s=t===y.RG?2*e:2*e+1,i=this._techniques[s];return i||(this._techniqueConfiguration.writeTextureChannels=t,this._techniqueConfiguration.steps=e,this._techniques[s]=new S({rctx:this.context.renderContext.rctx,viewingMode:this.view.state.viewingMode},this._techniqueConfiguration),this._techniques[s])}updateWeatherTile(){const e=this.view.camera.position.latitude,t=this.view.camera.position.longitude;if(null==e||null==t)return;p(this._weatherTile,(e+90)/180,(t+180)/360);const s=Math.floor(this._weatherTileCount*Math.abs(2*this._weatherTile[0]-1));this._weatherTile[0]=Math.floor(2*this._weatherTileCount*this._weatherTile[0]),this._weatherTile[1]=Math.floor(4*(this._weatherTileCount-s)*this._weatherTile[1]);let i=0,r=0;if(null!=this.view.environment&&"virtual"!==this.view.environment.lighting.type&&null!=this.view.environment.lighting.date){const e=new Date(this.view.environment.lighting.date);e.setUTCHours(this.view.environment.lighting.date.getUTCHours()+(this.view.environment.lighting.displayUTCOffset??0)),i=31*e.getUTCMonth()+e.getUTCDate(),r=e.getUTCFullYear()}this._weatherTile[0]=(this._weatherTile[0]+i)%(2*this._weatherTileCount),this._weatherTile[1]=(this._weatherTile[1]+r%100)%(4*this._weatherTileCount),_(this._passParameters.weatherTile,this._weatherTile)||this.setDirty()}initialize(){const e=x(this.view.spatialReference);this._passParameters.cloudRadius=.5*e.radius,this.setDirty(),this.updateWeatherTile(),this._handles.add([this.view.resourceController.scheduler.registerTask(z.CLOUDS_GENERATOR,this),n((()=>[this.coverage,this.density,this.absorption,this.cloudSize,this.detailSize,this.smoothness,this.cloudHeight,this.raymarchingSteps]),(()=>this.setDirty()),h)])}destroy(){this._handles.destroy(),this._techniques.forEach((e=>r(e))),this._frameBufferCube=a(this._frameBufferCube),this._techniques.length=0,this._vao.dispose(),this._passParameters.noiseTexture=o(this._passParameters.noiseTexture)}get _tilesPerFace(){switch(this._techniqueConfiguration.steps){case j.SIXTEEN:return 1;case j.HUNDRED:return 4;case j.COUNT:case j.TWOHUNDRED:return 8}}_ensureNoiseTexture(){if(null!=this._passParameters.noiseTexture)this._passParameters.noiseTexture.updateWeatherMap(this._passParameters.weatherTile);else{const e=this.context;this._passParameters.noiseTexture=new E({context:e}),this._passParameters.noiseTexture.updateWeatherMap(this._passParameters.weatherTile)}return null!=this._passParameters.noiseTexture.textureAtlas}_ensureFrameBufferCube(e){if(null==this._frameBufferCube){const t={target:F.TEXTURE_CUBE_MAP,pixelFormat:R.RGBA,dataType:q.UNSIGNED_BYTE,wrapMode:B.CLAMP_TO_EDGE,samplingMode:N.LINEAR,hasMipmap:!1,width:e,height:e};this._frameBufferCube=new H(this.context.renderContext.rctx,{colorTarget:A.CUBEMAP,width:e,height:e},t)}return this._frameBufferCube}get cubeMap(){return this._frameBufferCube}destroyFrameBufferCube(){this._frameBufferCube=a(this._frameBufferCube)}applyPreset(e,t){const s=e.median,r=e=>{const r=i(e[0],e[1],s);return t<.5?i(e[0],r,2*t):i(r,e[1],2*(t-.5))};this.coverage=r(e.coverage),this.density=r(e.density),this.absorption=r(e.absorption),this.cloudSize=r(e.cloudSize),this.detailSize=r(e.detailSize),this.smoothness=r(e.smoothness),this.cloudHeight=r(e.cloudHeight),this.raymarchingSteps=e.raymarchingSteps}setDirty(){this._dirty=this.running=!0}runTask(e){0===this._faceIndex&&0===this._tileIndex&&(this._passParameters.raymarchingSteps=this.raymarchingSteps,this.updateWeatherTile(),f(this._passParameters.weatherTile,this._weatherTile));const t=this._getTechnique(this._passParameters.raymarchingSteps);if(!t.compiled)return U.YIELD;if(!this.context.renderContext.bindParameters.cloudsFade.isCameraPositionFinal||this.context.renderContext.bindParameters.cloudsFade.isFading||!this._ensureNoiseTexture())return U.YIELD;0===this._faceIndex&&0===this._tileIndex&&(this.context.renderContext.bindParameters.cloudsFade.renderingStage=P.RENDERING,this._passParameters.absorption=this.absorption,this._passParameters.density=this.density,this._passParameters.cloudSize=this.cloudSize,this._passParameters.detailSize=this.detailSize,this._passParameters.smoothness=this.smoothness,this._passParameters.cloudHeight=this.cloudHeight,this._passParameters.coverage=this.coverage,this._dirty=!1);const s=this.context.renderContext.rctx,i=s.bindTechnique(t,this._passParameters,this._bindParameters);s.bindVAO(this._vao),i.assertCompatibleVertexAttributeLocations(this._vao);const r=s.getViewport(),a=t.configuration.cubeMapSize,o=a/this._tilesPerFace,n=this._tileIndex*o;s.setViewport(0,n,a,o);const h=this._ensureFrameBufferCube(a);s.bindFramebuffer(h);const u=k[this._faceIndex],l=G[this._faceIndex];c(this._viewMatrix,L,u,l),d(this._drawParameters.viewMatrix,this._viewMatrix);const m=F.TEXTURE_CUBE_MAP_POSITIVE_X+this._faceIndex;return h.setColorTextureTarget(m),i.bindDraw(this._drawParameters,this._bindParameters,this._passParameters),s.gl.drawArrays(s.gl.TRIANGLE_STRIP,0,4),s.gl.flush(),s.setViewport(r.x,r.y,r.width,r.height),this.requestRender(),++this._tileIndex,4===this._faceIndex&&this._tileIndex===this._tilesPerFace?(this.running=this._dirty,this._faceIndex=0,this._tileIndex=0,this.context.renderContext.bindParameters.cloudsFade.renderingStage=P.FINISHED_RENDERING):this._tileIndex===this._tilesPerFace&&(++this._faceIndex,this._tileIndex=0),e.madeProgress(),U.YIELD}};e([u({constructOnly:!0})],O.prototype,"context",void 0),e([u({constructOnly:!0})],O.prototype,"view",void 0),e([u({constructOnly:!0})],O.prototype,"requestRender",void 0),e([u()],O.prototype,"coverage",void 0),e([u()],O.prototype,"density",void 0),e([u()],O.prototype,"absorption",void 0),e([u()],O.prototype,"cloudSize",void 0),e([u()],O.prototype,"detailSize",void 0),e([u()],O.prototype,"smoothness",void 0),e([u()],O.prototype,"cloudHeight",void 0),e([u()],O.prototype,"raymarchingSteps",void 0),e([u()],O.prototype,"running",void 0),O=e([l("esri.views.3d.environment.CloudsGenerator")],O);const k=[w(1,0,0),w(-1,0,0),w(0,1,0),w(0,-1,0),w(0,0,1)],G=[w(0,1,0),w(0,1,0),w(0,0,-1),w(0,0,1),w(0,1,0)],L=T();export{O as CloudsGenerator};
|