@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"../../../../core/has.js";import t from"../../../../core/Error.js";import{clone as e}from"../../../../core/lang.js";import{get as s}from"../../../../core/maybe.js";import{getMetersPerVerticalUnitForSR as r}from"../../../../core/unitUtils.js";import{e as n}from"../../../../chunks/earcut.js";import{b as o}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a,u as l}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{c as h,n as m,s as p,b as d,f as g,m as u}from"../../../../chunks/vec3.js";import{d as f,c as y}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection.js";import{create as _,empty as x,expandWithBuffer as j,intersectsClippingArea as P}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as S}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as v,getZeroIndexArray as E}from"../../../../geometry/support/Indices.js";import{t as w,a as L}from"../../../../chunks/vec32.js";import{makeVertexCandidate as C,makeEdgeCandidate as I}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as O}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as M}from"../../../ViewingMode.js";import{needsElevationUpdates3D as A,SampleElevationInfo as z}from"./elevationAlignmentUtils.js";import{ElevationContext as D}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as R}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as G}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as B,computeCentroid as U}from"./graphicUtils.js";import{ApplyRendererDiffResult as k}from"./interfaces.js";import{geometryAsPolygon as T}from"./polygonUtils.js";import{createMaterial as V}from"../support/edgeUtils.js";import N from"../../support/debugFlags.js";import{SamplePosition as H}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as F}from"../../support/renderInfoUtils/polygon.js";import{Attribute as W}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as q}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as Z}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as J}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as K}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{Object3D as Q}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as X}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Y}from"../../webgl-engine/materials/DefaultMaterial.js";const $=["polygon","extent"];class tt extends G{constructor(t,e,s,r){super(t,e,s,r),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const e=B(this._getSymbolSize());if(e)throw new t("graphics3dextrudesymbollayer:invalid-size",e)}const e=s(this.symbolLayer,"material","color"),r=this._getCombinedOpacityAndColor(e),n=f(r),o=r[3],i=o<1||this.needsDrivenTransparentPass,a={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:n,ambient:n,opacity:o,transparent:i,cullFace:i?q.None:q.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};this._material=new Y(a),this._bottomMaterial=new Y({...a,cullFace:q.Back}),this._context.stage.add(this._material),this._context.stage.add(this._bottomMaterial)}destroy(){super.destroy(),this._material&&(this._context.stage.remove(this._material),this._context.stage.remove(this._bottomMaterial))}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,$,this.symbolLayer.type))return null;const s=this._getVertexOpacityAndColor(t.renderingInfo,255),r=this.setGraphicElevationContext(e,new D);return this._createAs3DShape(e,t.renderingInfo,s,r,e.uid)}layerOpacityChanged(t,e){const r=s(this.symbolLayer,"material","color"),n=this._getCombinedOpacity(r),o=n<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:n,transparent:o}),this._bottomMaterial.setParameters({opacity:n,transparent:o});const i=this._getLayerOpacity();t.forEach((t=>{const s=e(t);null!=s&&s.layerOpacityChanged(i,this._context.isAsync)}))}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,A)}slicePlaneEnabledChanged(t,e){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._bottomMaterial.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t.forEach((t=>{const s=e(t);null!=s&&s.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._bottomMaterial.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?O(t.size,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?k.Recreate_Symbol:k.Recreate_Graphics}async queryForSnapping(t,s,n,o){const i=this._getExtrusionSize(n)*this._context.renderCoordsHelper.unitInMeters/r(s),{objectId:a,target:l}=t,c=e(l);switch(c.z=(c.z??0)+i,t.type){case"edge":{const{start:s,end:r}=t,n=e(s),o=e(r);return n.z=(n.z??0)+i,o.z=(o.z??0)+i,[I(a,c,1/0,n,o)]}case"vertex":return[C(a,c,1/0),I(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,s,r,l){const h=T(t.geometry);if(null==h)return null;if(0===h.rings.length||!h.rings.some((t=>t.length>0)))return this._logGeometryValidationWarnings(h.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=F(h,this._context.elevationProvider,this._context.renderCoordsHelper,r);this._logGeometryCreationWarnings(m,h.rings,"rings","ExtrudeSymbol3DLayer");const p=U(h);if(null==p)return null;const d=new Array,g=new Array,u=_(),f=c(),E=y(),C=this._context.renderCoordsHelper.viewingMode===M.Global;C||this._context.renderCoordsHelper.worldUpAtPosition(null,E),b(h.spatialReference,[p.x,p.y,0],f,this._context.renderCoordsHelper.spatialReference);const I=c();a(I,f);const O=i();o(O,I);const{polygons:z,mapPositions:D,position:G}=m;for(const o of z){const t=o.count;if(this._context.clippingExtent&&(x(u),j(u,o.mapPositions),!P(u,this._context.clippingExtent)))continue;const r=n(o.mapPositions,o.holeIndices,3);if(0===r.length)continue;const i=r.length,a=6*t,c=v(a+i),h=v(i),m=S(3*a),p=S(3*a),f=S(3*a),y=S(a);st(G,D,r,o,m,f,p,y,c,h,this._getExtrusionSize(e),E,C),w(m,m,I),L(p,p,O);const b=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerUid:this._context.layer.uid}),_=new jt(m,f,p,y);d.push(et(this._material,c,c.length-h.length,_,s,b),et(this._bottomMaterial,h,0,_,s,b)),g.push(_.heights)}if(0===d.length)return null;const B=new Q({geometries:d,layerUid:this._context.layer.uid,graphicUid:l,isElevationSource:!0});B.transformation=f;const k=V(this.symbolLayer,{opacity:this._getLayerOpacity()}),N=null!=k?{baseMaterial:this._material,edgeMaterials:[k],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,H=new R(this,B,d,null,null,((t,e,s,r,n)=>gt(t,e,s,r,n,g)),r,N);return H.alignedSampledElevation=m.sampledElevation,H.needsElevationUpdates=A(r.mode),H}}function et(t,e,s,r,n,o){const i=E(e.length),a=[[X.POSITION,new W(r.positions,3,!0)],[X.NORMAL,new W(r.normals,3,!0)],[X.COLOR,new W(n,4,!0)]],l=[[X.POSITION,e],[X.NORMAL,e],[X.COLOR,i]];return new J(t,a,l,r.elevation,Z.Mesh,o,s)}function st(t,e,s,r,n,o,i,a,l,c,h,m,p){const d=s.length/3;let g=0,u=2*r.count;rt(t,e,r.index,r.count,s,0,d,n,o,i,a,l,c,u,h,m,p);let f=2*r.count;u=0,it(n,o,a,i,g,r.pathLengths[0],r.count,f,l,u,h),f+=4*r.pathLengths[0],u+=2*r.pathLengths[0],g+=r.pathLengths[0];for(let y=1;y<r.pathLengths.length;++y)it(n,o,a,i,g,r.pathLengths[y],r.count,f,l,u,h),f+=4*r.pathLengths[y],u+=2*r.pathLengths[y],g+=r.pathLengths[y]}function rt(t,e,s,r,n,o,i,a,l,c,p,d,g,u,f,y,b){h(ft,y);const _=f>0?1:-1;let x=3*s,j=0,P=3*j,S=r,v=3*S;for(let h=0;h<r;++h)b&&(ft[0]=t[x],ft[1]=t[x+1],ft[2]=t[x+2],m(ft,ft)),a[P]=t[x],a[P+1]=t[x+1],a[P+2]=t[x+2],l[P]=e[x],l[P+1]=e[x+1],l[P+2]=e[x+2],c[P]=-_*ft[0],c[P+1]=-_*ft[1],c[P+2]=-_*ft[2],p[j]=0,a[v]=t[x]+f*ft[0],a[v+1]=t[x+1]+f*ft[1],a[v+2]=t[x+2]+f*ft[2],l[v]=e[x],l[v+1]=e[x+1],l[v+2]=e[x+2],c[v]=_*ft[0],c[v+1]=_*ft[1],c[v+2]=_*ft[2],p[S]=f,P+=3,v+=3,x+=3,j+=1,S+=1;x=3*o,P=0,v=3*u;const E=f<0?_t:bt,w=f<0?bt:_t;for(let h=0;h<i;++h)g[P]=n[x+E[0]],g[P+1]=n[x+E[1]],g[P+2]=n[x+E[2]],d[v]=n[x+w[0]]+r,d[v+1]=n[x+w[1]]+r,d[v+2]=n[x+w[2]]+r,P+=3,v+=3,x+=3}function nt(t,e,s,r,n,o,i){r[o]=r[i],i*=3,t[o*=3]=t[i],t[o+1]=t[i+1],t[o+2]=t[i+2],e[o]=e[i],e[o+1]=e[i+1],e[o+2]=e[i+2],s[o]=n[0],s[o+1]=n[1],s[o+2]=n[2]}const ot=y();function it(t,e,s,r,n,o,i,a,l,c,h){let m=n,p=n+1,d=n+i,g=n+i+1,u=a,f=a+1,y=a+2*o,b=a+2*o+1;h<0&&(m=n+i+1,g=n),c*=3;for(let _=0;_<o;++_)_===o-1&&(h>0?(p=n,g=n+i):(p=n,m=n+i)),pt(t,m,p,d,ot),nt(t,e,r,s,ot,u,m),nt(t,e,r,s,ot,f,p),nt(t,e,r,s,ot,y,d),nt(t,e,r,s,ot,b,g),l[c++]=u,l[c++]=y,l[c++]=b,l[c++]=u,l[c++]=b,l[c++]=f,m++,p++,d++,g++,u+=2,f+=2,y+=2,b+=2}const at=y(),lt=y(),ct=y(),ht=y(),mt=y();function pt(t,e,s,r,n){e*=3,s*=3,r*=3,p(at,t[e++],t[e++],t[e++]),p(lt,t[s++],t[s++],t[s++]),p(ct,t[r++],t[r++],t[r++]),d(ht,lt,at),d(mt,ct,at),g(n,mt,ht),m(n,n)}const dt=y();function gt(t,e,s,r,n,o){const i=t.stageObject,a=i.geometries,h=a.length,m="absolute-height"!==e.mode;let d=0;const g=i.transformation,f=l(c(),g);for(let l=0;l<h;l+=2){const t=a[l];if(!K(t))continue;const e=t.getMutableAttribute(X.POSITION).data,c=o[l/2],h=new H(t.mapPositions),y=e.length/3;let b=0,_=!1,x=0;for(let o=0;o<y;o++){dt[0]=e[b],dt[1]=e[b+1],dt[2]=e[b+2],r(h,yt),m&&(x+=yt.sampledElevation),N.TESTS_DISABLE_OPTIMIZATIONS?(p(ut,h.array[h.offset],h.array[h.offset+1],yt.z+c[b/3]),null!=s&&n.toRenderCoords(ut,s,ut),u(ut,ut,f)):(p(ut,e[b],e[b+1],e[b+2]),u(ut,ut,g),n.setAltitude(ut,yt.z+c[b/3]),u(ut,ut,f)),e[b]=ut[0],e[b+1]=ut[1],e[b+2]=ut[2];const t=xt/n.unitInMeters;(Math.abs(dt[0]-e[b])>=t||Math.abs(dt[1]-e[b+1])>=t||Math.abs(dt[2]-e[b+2])>=t)&&(_=!0),h.offset+=3,b+=3}_&&(t.invalidateBoundingInfo(),i.geometryVertexAttrsUpdated(a[l]),a[l+1].invalidateBoundingInfo(),i.geometryVertexAttrsUpdated(a[l+1])),d+=x/y}return d/h}const ut=y(),ft=y(),yt=new z,bt=[0,2,1],_t=[0,1,2],xt=.01;class jt{constructor(t,e,s,r){this.positions=t,this.elevation=e,this.normals=s,this.heights=r}}export{tt as Graphics3DExtrudeSymbolLayer};
|
|
5
|
+
import"../../../../core/has.js";import t from"../../../../core/Error.js";import{clone as e}from"../../../../core/lang.js";import{get as s}from"../../../../core/maybe.js";import{getMetersPerVerticalUnitForSR as r}from"../../../../core/unitUtils.js";import{e as n}from"../../../../chunks/earcut.js";import{b as o}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a,u as l}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{c as h,n as m,s as p,b as d,f as g,m as u}from"../../../../chunks/vec3.js";import{d as f,c as y}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection.js";import{create as _,empty as x,expandWithBuffer as j,intersectsClippingArea as P}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as S}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as v,getZeroIndexArray as E}from"../../../../geometry/support/Indices.js";import{t as w,a as L}from"../../../../chunks/vec32.js";import{makeVertexCandidate as C,makeEdgeCandidate as I}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as O}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as M}from"../../../ViewingMode.js";import{needsElevationUpdates3D as A,SampleElevationInfo as z}from"./elevationAlignmentUtils.js";import{ElevationContext as D}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as R}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as G}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as B,computeCentroid as U}from"./graphicUtils.js";import{ApplyRendererDiffResult as k}from"./interfaces.js";import{geometryAsPolygon as T}from"./polygonUtils.js";import{createMaterial as V}from"../support/edgeUtils.js";import N from"../../support/debugFlags.js";import{SamplePosition as H}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as F}from"../../support/renderInfoUtils/polygon.js";import{Attribute as W}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as q}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as Z}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as J}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as K}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{Object3D as Q}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as X}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Y}from"../../webgl-engine/materials/DefaultMaterial.js";const $=["polygon","extent"];class tt extends G{constructor(t,e,s,r){super(t,e,s,r),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const e=B(this._getSymbolSize());if(e)throw new t("graphics3dextrudesymbollayer:invalid-size",e)}const e=s(this.symbolLayer,"material","color"),r=this._getCombinedOpacityAndColor(e),n=f(r),o=r[3],i=o<1||this.needsDrivenTransparentPass,a={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:n,ambient:n,opacity:o,transparent:i,cullFace:i?q.None:q.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};this._material=new Y(a),this._bottomMaterial=new Y({...a,cullFace:q.Back}),this._context.stage.add(this._material),this._context.stage.add(this._bottomMaterial)}destroy(){super.destroy(),this._material&&(this._context.stage.remove(this._material),this._context.stage.remove(this._bottomMaterial))}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,$,this.symbolLayer.type))return null;const s=this._getVertexOpacityAndColor(t.renderingInfo,255),r=this.setGraphicElevationContext(e,new D);return this._createAs3DShape(e,t.renderingInfo,s,r,e.uid)}layerOpacityChanged(t,e){const r=s(this.symbolLayer,"material","color"),n=this._getCombinedOpacity(r),o=n<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:n,transparent:o}),this._bottomMaterial.setParameters({opacity:n,transparent:o});const i=this._getLayerOpacity();t.forEach((t=>{const s=e(t);null!=s&&s.layerOpacityChanged(i,this._context.isAsync)}))}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,A)}slicePlaneEnabledChanged(t,e){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._bottomMaterial.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t.forEach((t=>{const s=e(t);null!=s&&s.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._bottomMaterial.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?O(t.size,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?k.RecreateSymbol:k.RecreateGraphics}async queryForSnapping(t,s,n,o){const i=this._getExtrusionSize(n)*this._context.renderCoordsHelper.unitInMeters/r(s),{objectId:a,target:l}=t,c=e(l);switch(c.z=(c.z??0)+i,t.type){case"edge":{const{start:s,end:r}=t,n=e(s),o=e(r);return n.z=(n.z??0)+i,o.z=(o.z??0)+i,[I(a,c,1/0,n,o)]}case"vertex":return[C(a,c,1/0),I(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,s,r,l){const h=T(t.geometry);if(null==h)return null;if(0===h.rings.length||!h.rings.some((t=>t.length>0)))return this._logGeometryValidationWarnings(h.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=F(h,this._context.elevationProvider,this._context.renderCoordsHelper,r);this._logGeometryCreationWarnings(m,h.rings,"rings","ExtrudeSymbol3DLayer");const p=U(h);if(null==p)return null;const d=new Array,g=new Array,u=_(),f=c(),E=y(),C=this._context.renderCoordsHelper.viewingMode===M.Global;C||this._context.renderCoordsHelper.worldUpAtPosition(null,E),b(h.spatialReference,[p.x,p.y,0],f,this._context.renderCoordsHelper.spatialReference);const I=c();a(I,f);const O=i();o(O,I);const{polygons:z,mapPositions:D,position:G}=m;for(const o of z){const t=o.count;if(this._context.clippingExtent&&(x(u),j(u,o.mapPositions),!P(u,this._context.clippingExtent)))continue;const r=n(o.mapPositions,o.holeIndices,3);if(0===r.length)continue;const i=r.length,a=6*t,c=v(a+i),h=v(i),m=S(3*a),p=S(3*a),f=S(3*a),y=S(a);st(G,D,r,o,m,f,p,y,c,h,this._getExtrusionSize(e),E,C),w(m,m,I),L(p,p,O);const b=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerUid:this._context.layer.uid}),_=new jt(m,f,p,y);d.push(et(this._material,c,c.length-h.length,_,s,b),et(this._bottomMaterial,h,0,_,s,b)),g.push(_.heights)}if(0===d.length)return null;const B=new Q({geometries:d,layerUid:this._context.layer.uid,graphicUid:l,isElevationSource:!0});B.transformation=f;const k=V(this.symbolLayer,{opacity:this._getLayerOpacity()}),N=null!=k?{baseMaterial:this._material,edgeMaterials:[k],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,H=new R(this,B,d,null,null,((t,e,s,r,n)=>gt(t,e,s,r,n,g)),r,N);return H.alignedSampledElevation=m.sampledElevation,H.needsElevationUpdates=A(r.mode),H}}function et(t,e,s,r,n,o){const i=E(e.length),a=[[X.POSITION,new W(r.positions,3,!0)],[X.NORMAL,new W(r.normals,3,!0)],[X.COLOR,new W(n,4,!0)]],l=[[X.POSITION,e],[X.NORMAL,e],[X.COLOR,i]];return new J(t,a,l,r.elevation,Z.Mesh,o,s)}function st(t,e,s,r,n,o,i,a,l,c,h,m,p){const d=s.length/3;let g=0,u=2*r.count;rt(t,e,r.index,r.count,s,0,d,n,o,i,a,l,c,u,h,m,p);let f=2*r.count;u=0,it(n,o,a,i,g,r.pathLengths[0],r.count,f,l,u,h),f+=4*r.pathLengths[0],u+=2*r.pathLengths[0],g+=r.pathLengths[0];for(let y=1;y<r.pathLengths.length;++y)it(n,o,a,i,g,r.pathLengths[y],r.count,f,l,u,h),f+=4*r.pathLengths[y],u+=2*r.pathLengths[y],g+=r.pathLengths[y]}function rt(t,e,s,r,n,o,i,a,l,c,p,d,g,u,f,y,b){h(ft,y);const _=f>0?1:-1;let x=3*s,j=0,P=3*j,S=r,v=3*S;for(let h=0;h<r;++h)b&&(ft[0]=t[x],ft[1]=t[x+1],ft[2]=t[x+2],m(ft,ft)),a[P]=t[x],a[P+1]=t[x+1],a[P+2]=t[x+2],l[P]=e[x],l[P+1]=e[x+1],l[P+2]=e[x+2],c[P]=-_*ft[0],c[P+1]=-_*ft[1],c[P+2]=-_*ft[2],p[j]=0,a[v]=t[x]+f*ft[0],a[v+1]=t[x+1]+f*ft[1],a[v+2]=t[x+2]+f*ft[2],l[v]=e[x],l[v+1]=e[x+1],l[v+2]=e[x+2],c[v]=_*ft[0],c[v+1]=_*ft[1],c[v+2]=_*ft[2],p[S]=f,P+=3,v+=3,x+=3,j+=1,S+=1;x=3*o,P=0,v=3*u;const E=f<0?_t:bt,w=f<0?bt:_t;for(let h=0;h<i;++h)g[P]=n[x+E[0]],g[P+1]=n[x+E[1]],g[P+2]=n[x+E[2]],d[v]=n[x+w[0]]+r,d[v+1]=n[x+w[1]]+r,d[v+2]=n[x+w[2]]+r,P+=3,v+=3,x+=3}function nt(t,e,s,r,n,o,i){r[o]=r[i],i*=3,t[o*=3]=t[i],t[o+1]=t[i+1],t[o+2]=t[i+2],e[o]=e[i],e[o+1]=e[i+1],e[o+2]=e[i+2],s[o]=n[0],s[o+1]=n[1],s[o+2]=n[2]}const ot=y();function it(t,e,s,r,n,o,i,a,l,c,h){let m=n,p=n+1,d=n+i,g=n+i+1,u=a,f=a+1,y=a+2*o,b=a+2*o+1;h<0&&(m=n+i+1,g=n),c*=3;for(let _=0;_<o;++_)_===o-1&&(h>0?(p=n,g=n+i):(p=n,m=n+i)),pt(t,m,p,d,ot),nt(t,e,r,s,ot,u,m),nt(t,e,r,s,ot,f,p),nt(t,e,r,s,ot,y,d),nt(t,e,r,s,ot,b,g),l[c++]=u,l[c++]=y,l[c++]=b,l[c++]=u,l[c++]=b,l[c++]=f,m++,p++,d++,g++,u+=2,f+=2,y+=2,b+=2}const at=y(),lt=y(),ct=y(),ht=y(),mt=y();function pt(t,e,s,r,n){e*=3,s*=3,r*=3,p(at,t[e++],t[e++],t[e++]),p(lt,t[s++],t[s++],t[s++]),p(ct,t[r++],t[r++],t[r++]),d(ht,lt,at),d(mt,ct,at),g(n,mt,ht),m(n,n)}const dt=y();function gt(t,e,s,r,n,o){const i=t.stageObject,a=i.geometries,h=a.length,m="absolute-height"!==e.mode;let d=0;const g=i.transformation,f=l(c(),g);for(let l=0;l<h;l+=2){const t=a[l];if(!K(t))continue;const e=t.getMutableAttribute(X.POSITION).data,c=o[l/2],h=new H(t.mapPositions),y=e.length/3;let b=0,_=!1,x=0;for(let o=0;o<y;o++){dt[0]=e[b],dt[1]=e[b+1],dt[2]=e[b+2],r(h,yt),m&&(x+=yt.sampledElevation),N.TESTS_DISABLE_OPTIMIZATIONS?(p(ut,h.array[h.offset],h.array[h.offset+1],yt.z+c[b/3]),null!=s&&n.toRenderCoords(ut,s,ut),u(ut,ut,f)):(p(ut,e[b],e[b+1],e[b+2]),u(ut,ut,g),n.setAltitude(ut,yt.z+c[b/3]),u(ut,ut,f)),e[b]=ut[0],e[b+1]=ut[1],e[b+2]=ut[2];const t=xt/n.unitInMeters;(Math.abs(dt[0]-e[b])>=t||Math.abs(dt[1]-e[b+1])>=t||Math.abs(dt[2]-e[b+2])>=t)&&(_=!0),h.offset+=3,b+=3}_&&(t.invalidateBoundingInfo(),i.geometryVertexAttrsUpdated(a[l]),a[l+1].invalidateBoundingInfo(),i.geometryVertexAttrsUpdated(a[l+1])),d+=x/y}return d/h}const ut=y(),ft=y(),yt=new z,bt=[0,2,1],_t=[0,1,2],xt=.01;class jt{constructor(t,e,s,r){this.positions=t,this.elevation=e,this.normals=s,this.heights=r}}export{tt as Graphics3DExtrudeSymbolLayer};
|
|
@@ -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"../../../../Graphic.js";import{XXH as i}from"../../../../arcade/functions/hash.js";import{neverReached as s}from"../../../../core/compilerUtils.js";import{HandleOwner as r}from"../../../../core/HandleOwner.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{logOnError as a}from"../../../../core/promiseUtils.js";import{watch as o,initial as l,when as p}from"../../../../core/reactiveUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as h}from"../../../../core/accessorSupport/diffUtils.js";import{canProject as c,project as m}from"../../../../geometry/support/webMercatorUtils.js";import{matchRandomRotationExpression as y}from"../../../../renderers/support/randomRotationExpression.js";import{getRenderingInfo as g,getRenderingInfoAsync as b}from"../../../../renderers/support/renderingInfoUtils.js";import f from"../../../../rest/support/Query.js";import{DrapeSourceType as E}from"../interfaces.js";import{SUSPEND_RESUME_EXTENT_OPTIMISM as C}from"./constants.js";import{Graphics3DCore as x}from"./Graphics3DCore.js";import v from"./Graphics3DElevationAlignment.js";import w from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as V}from"./Graphics3DObjectStates.js";import j from"./Graphics3DScaleVisibility.js";import{enlargeExtent as S}from"./graphicUtils.js";import{attributeLookup as R}from"../support/attributeUtils.js";import{FeatureVisibilityFilter as O}from"../support/FeatureVisibilityFilter.js";import{Object3DState as I}from"../../webgl-engine/lib/basicInterfaces.js";import{UpdatePolicy as G}from"../../webgl-engine/lib/UpdatePolicy.js";let _=class extends r{constructor(e){super(e),this.type="graphics-3d",this._randomRotationRenderers=null,this.elevationFeatureExpressionEnabled=!1,this.scaleVisibilityEnabled=!1,this.filterVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this.elevationAlignmentEnabled=!1,this.timeExtentEnabled=!1,this.setUidToIdOnAdd=!0,this.dataExtent=null,this.drapeSourceType=E.Features,this.preferredUpdatePolicy=G.ASYNC,this._suspendResumeExtent=null}initialize(){const e=this.owner,t=(this.filterVisibilityEnabled||this.timeExtentEnabled)&&"multipatch"!==e.layer.geometryType,i=new x({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:e.hasZ,hasM:e.hasM,setUidToIdOnAdd:this.setUidToIdOnAdd,componentFactories:{deconflictor:t=>e.view.deconflictor.addGraphicsOwner(t),labeler:(t,i)=>e.view.labeler.addGraphicsOwner(t,i),elevationAlignment:this.elevationAlignmentEnabled?(t,i)=>new v({graphicsCoreOwner:this,graphicsCore:t,queryGraphicUIDsInExtent:i,elevationProvider:e.view.elevationProvider}):null,scaleVisibility:this.scaleVisibilityEnabled?(t,i)=>new j({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:i,graphicsCore:t,basemapTerrain:e.view.basemapTerrain}):null,filterVisibility:t?t=>new O({context:{layerView:e,...t}}):null,objectStates:e=>new V(e)}});this._set("graphicsCore",i),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new w({graphicsCoreOwner:this})),this.elevationAlignment&&this.updatingHandles.add((()=>this.layer.elevationInfo),((e,t)=>{h(e,t)&&this.updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())})),this.updatingHandles.add((()=>this.layer.labelsVisible),(()=>this.graphicsCore.updateVisibilityInfo())),this.updatingHandles.add((()=>this.layer.labelingInfo),((e,t)=>{h(e,t)&&this.graphicsCore.updateLabelingInfo()})),this.updatingHandles.add((()=>this.preferredUpdatePolicy),(e=>this.graphicsCore.preferredUpdatePolicy=e)),this._set("initializePromise",this._initializeAsync()),this.updatingHandles.addPromise(this.initializePromise)}async _initializeAsync(){await a(this.graphicsCore.initializePromise);const e=this.owner;this.updatingHandles.add((()=>this.renderer),(e=>this.updatingHandles.addPromise(this.graphicsCore.rendererChange(e)))),this.updatingHandles.add((()=>e.fullOpacity),(()=>this.graphicsCore.opacityChange())),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this.updatingHandles.add((()=>e.view.clippingArea),(()=>this._updateClippingExtent())),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&await a(this.graphicsCore.updateLabelingInfo())}destroy(){this.handles.removeAll(),this.updatingHandles.removeAll(),this._set("frustumVisibility",n(this.frustumVisibility)),this._set("graphicsCore",n(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get renderer(){const{renderer:e,objectIdField:t}=this.layer;if(!e||!t||"heatmap"===e.type||!e.visualVariables)return e;const i=e.visualVariables.findIndex((e=>"rotation"===e.type&&null!=e.valueExpression&&y(e.valueExpression)===t&&(null==e.axis||"heading"===e.axis)&&"geographic"===e.rotationType));if(i<0)return e;const s=e.clone();return s.visualVariables.splice(i,1),this._randomRotationRenderers||(this._randomRotationRenderers=new WeakMap),this._randomRotationRenderers.set(s,t),s}get scaleVisibility(){return this.graphicsCore?.scaleVisibility}get filterVisibility(){return this.graphicsCore?.filterVisibility}get elevationAlignment(){return this.graphicsCore?.elevationAlignment}get objectStates(){return this.graphicsCore?.objectStates}get suspendResumeExtentMode(){return"suspendResumeExtentMode"in this.owner?this.owner.suspendResumeExtentMode:"computed"}get scaleVisibilitySuspended(){return null!=this.scaleVisibility&&this.scaleVisibility.suspended}get suspended(){return this.owner.suspended}get legendEnabled(){return null==this.frustumVisibility||!this.frustumVisibility.suspended}get suspendInfo(){const e={};return this.scaleVisibilitySuspended&&(e.outsideScaleRange=!0),null!=this.frustumVisibility&&this.frustumVisibility.suspended&&(e.outsideOfView=!0),e}get updating(){return!!(this.graphicsCore?.updating||null!=this.frustumVisibility&&this.frustumVisibility.updating||this.updatingHandles?.updating)}get updatingRemaining(){return this.graphicsCore?.updatingRemaining??0}get featureStore(){return this.graphicsCore?.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner?.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}get featureSpatialReference(){return"featureSpatialReference"in this.owner?this.owner.featureSpatialReference:this.owner.view.spatialReference}get graphics3DGraphics(){return this.graphicsCore?.graphics3DGraphics}get graphics3DGraphicsByObjectID(){return this.graphicsCore?.graphics3DGraphicsByObjectID}get symbolUpdateType(){return this.graphicsCore?.symbolUpdateType}get displayFeatureLimit(){const e=this.view.resourceController.memoryController.memoryFactor,t=this.graphicsCore?.displayFeatureLimit;if(1===e)return t;const i=Math.ceil(t.maximumNumberOfFeatures*e),s=Math.ceil(t.maximumTotalNumberOfFeatures*e),r=Math.ceil(t.minimumTotalNumberOfFeatures*e);return{...t,maximumNumberOfFeatures:i,maximumTotalNumberOfFeatures:s,minimumTotalNumberOfFeatures:r}}get usedMemory(){return this.graphicsCore?.usedMemory??0}get loadedFeatures(){return this.graphicsCore?.numberOfGraphics??0}get usedMemoryPerFeature(){return this.graphicsCore?.usedMemoryPerGraphic??0}get unprocessedMemoryEstimate(){return this.graphicsCore?.unprocessedMemoryEstimate??0}get performanceInfo(){return{core:this.graphicsCore.performanceInfo,elevationUpdating:this.elevationAlignment.updating,visibilityFrustum:null==this.frustumVisibility||!this.frustumVisibility.suspended,visibilityScale:!this.scaleVisibilitySuspended}}maskOccludee(e){const{set:t,handle:i}=this.objectStates.acquireSet(I.MaskOccludee,null);return this.objectStates.setUid(t,e.uid),i}highlight(e,i){if(e instanceof f){const{set:t,handle:s}=this.objectStates.acquireSet(I.Highlight,i);return this.owner.queryObjectIds(e).then((e=>this.objectStates.setObjectIds(t,e))),s}if("number"==typeof e||"string"==typeof e)return this.highlight([e],i);if(e instanceof t)return this.highlight([e],i);if("toArray"in e&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof t){const t=e;if(null==R(this.layer.fieldsIndex,t[0].attributes,i)){const e=t.map((e=>e.uid)),{set:i,handle:s}=this.objectStates.acquireSet(I.Highlight,null);return this.objectStates.setUids(i,e),s}e=t.map((e=>R(this.layer.fieldsIndex,e.attributes,i)))}if("number"==typeof e[0]||"string"==typeof e[0]){const t=e,{set:s,handle:r}=this.objectStates.acquireSet(I.Highlight,i);return this.objectStates.setObjectIds(s,t),r}}return U}resetObjectStates(){this.objectStates.reset()}whenGraphicBounds(e,t){return this.graphicsCore?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsCore?.computeAttachmentOrigin(e,t)}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}getRenderingInfo(e,t,s){const r=g(e,{renderer:t,arcade:s});if(null!=r&&r.color){const e=r.color;e[0]=e[0]/255,e[1]=e[1]/255,e[2]=e[2]/255}if(null!=r&&null!=t&&this._randomRotationRenderers?.has(t)){const s=this._randomRotationRenderers.get(t),n=e.attributes[s],a=new i(0);a.updateFloatArray([n]),a.updateUint8Array([173]),r.heading=8.381e-8*a.digest()}return r}getRenderingInfoAsync(e,t,i,s){return b(e,{renderer:t,arcade:i,...s})}getSymbolLayerSize(e,t){return this.graphicsCore?.getSymbolLayerSize(e,t)}setObjectIdVisibility(e,t){this.graphicsCore?.setObjectIdVisibility(e,t)}refreshFilter(){null!=this.filterVisibility&&this.filterVisibility.reapply()}getGraphics3DGraphicByObjectId(e){return this.graphicsCore?.getGraphics3DGraphicByObjectId(e)}_updateClippingExtent(){const e=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.owner.view.spatialReference)&&(this.updateClippingExtent(e)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.handles.add(o((()=>this.suspendResumeExtentMode),(()=>{switch(this.handles.remove(P),this.suspendResumeExtentMode){case"computed":this.handles.add([o((()=>this.graphicsCore.computedExtent),(e=>this._updateSuspendResumeExtent(e)),l),o((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent)))],P);break;case"data":this.handles.add([p((()=>this.dataExtent),(e=>this._updateSuspendResumeExtent(e)),l),o((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.dataExtent)))],P);break;default:s(this.suspendResumeExtentMode)}}),l))}_updateSuspendResumeExtent(e){e?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(e,this._suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(e,t){const i=this.owner.view.spatialReference;if(!e.spatialReference.equals(i)){if(!c(e,i))return;e=m(e,i)}return S(e,t,C,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(e){null!=this.frustumVisibility&&this.frustumVisibility.setExtent(e),null!=this.scaleVisibility&&this.scaleVisibility.setExtent(e)}};e([u()],_.prototype,"type",void 0),e([u({constructOnly:!0})],_.prototype,"owner",void 0),e([u()],_.prototype,"layer",null),e([u()],_.prototype,"renderer",null),e([u({constructOnly:!0})],_.prototype,"updateClippingExtent",void 0),e([u({constructOnly:!0})],_.prototype,"elevationFeatureExpressionEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"graphicsCore",void 0),e([u({constructOnly:!0})],_.prototype,"scaleVisibilityEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"filterVisibilityEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"frustumVisibilityEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"elevationAlignmentEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"timeExtentEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"setUidToIdOnAdd",void 0),e([u()],_.prototype,"scaleVisibility",null),e([u()],_.prototype,"filterVisibility",null),e([u()],_.prototype,"elevationAlignment",null),e([u({constructOnly:!0})],_.prototype,"frustumVisibility",void 0),e([u()],_.prototype,"objectStates",null),e([u()],_.prototype,"initializePromise",void 0),e([u()],_.prototype,"suspendResumeExtentMode",null),e([u()],_.prototype,"dataExtent",void 0),e([u()],_.prototype,"scaleVisibilitySuspended",null),e([u()],_.prototype,"suspended",null),e([u()],_.prototype,"legendEnabled",null),e([u()],_.prototype,"suspendInfo",null),e([u()],_.prototype,"updating",null),e([u()],_.prototype,"updatingRemaining",null),e([u()],_.prototype,"featureStore",null),e([u()],_.prototype,"view",null),e([u()],_.prototype,"loadedGraphics",null),e([u()],_.prototype,"fullOpacity",null),e([u()],_.prototype,"filter",null),e([u()],_.prototype,"slicePlaneEnabled",null),e([u()],_.prototype,"drapeSourceType",void 0),e([u()],_.prototype,"updatePolicy",null),e([u()],_.prototype,"preferredUpdatePolicy",void 0),e([u()],_.prototype,"displayFeatureLimit",null),_=e([d("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],_);const A=_,P="suspendResumeExtentMode",U={remove(){},pause(){},resume(){}};export{A as default};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import{XXH as i}from"../../../../arcade/functions/hash.js";import{neverReached as s}from"../../../../core/compilerUtils.js";import{HandleOwner as r}from"../../../../core/HandleOwner.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{logOnError as a}from"../../../../core/promiseUtils.js";import{watch as o,initial as l,when as p}from"../../../../core/reactiveUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as h}from"../../../../core/accessorSupport/diffUtils.js";import{canProject as c,project as m}from"../../../../geometry/support/webMercatorUtils.js";import{matchRandomRotationExpression as y}from"../../../../renderers/support/randomRotationExpression.js";import{getRenderingInfo as g,getRenderingInfoAsync as b}from"../../../../renderers/support/renderingInfoUtils.js";import f from"../../../../rest/support/Query.js";import{DrapeSourceType as E}from"../interfaces.js";import{SUSPEND_RESUME_EXTENT_OPTIMISM as C}from"./constants.js";import{Graphics3DCore as x}from"./Graphics3DCore.js";import v from"./Graphics3DElevationAlignment.js";import w from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as V}from"./Graphics3DObjectStates.js";import j from"./Graphics3DScaleVisibility.js";import{enlargeExtent as S}from"./graphicUtils.js";import{attributeLookup as R}from"../support/attributeUtils.js";import{FeatureVisibilityFilter as O}from"../support/FeatureVisibilityFilter.js";import{Object3DState as I}from"../../webgl-engine/lib/basicInterfaces.js";import{UpdatePolicy as G}from"../../webgl-engine/lib/UpdatePolicy.js";let _=class extends r{constructor(e){super(e),this.type="graphics-3d",this._randomRotationRenderers=null,this.elevationFeatureExpressionEnabled=!1,this.scaleVisibilityEnabled=!1,this.filterVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this.elevationAlignmentEnabled=!1,this.timeExtentEnabled=!1,this.setUidToIdOnAdd=!0,this.dataExtent=null,this.drapeSourceType=E.Features,this.preferredUpdatePolicy=G.ASYNC,this._suspendResumeExtent=null}initialize(){const e=this.owner,t=(this.filterVisibilityEnabled||this.timeExtentEnabled)&&"multipatch"!==e.layer.geometryType,i=new x({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:e.hasZ,hasM:e.hasM,setUidToIdOnAdd:this.setUidToIdOnAdd,componentFactories:{deconflictor:t=>e.view.deconflictor.addGraphicsOwner(t),labeler:(t,i)=>e.view.labeler.addGraphicsOwner(t,i),elevationAlignment:this.elevationAlignmentEnabled?(t,i)=>new v({graphicsCoreOwner:this,graphicsCore:t,queryGraphicUIDsInExtent:i,elevationProvider:e.view.elevationProvider}):null,scaleVisibility:this.scaleVisibilityEnabled?(t,i)=>new j({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:i,graphicsCore:t,basemapTerrain:e.view.basemapTerrain}):null,filterVisibility:t?t=>new O({context:{layerView:e,...t}}):null,objectStates:e=>new V(e)}});this._set("graphicsCore",i),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new w({graphicsCoreOwner:this})),this.elevationAlignment&&this.updatingHandles.add((()=>this.layer.elevationInfo),((e,t)=>{h(e,t)&&this.updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())})),this.updatingHandles.add((()=>this.layer.labelsVisible),(()=>this.graphicsCore.updateVisibilityInfo())),this.updatingHandles.add((()=>this.layer.labelingInfo),((e,t)=>{h(e,t)&&this.graphicsCore.updateLabelingInfo()})),this.updatingHandles.add((()=>this.preferredUpdatePolicy),(e=>this.graphicsCore.preferredUpdatePolicy=e)),this._set("initializePromise",this._initializeAsync()),this.updatingHandles.addPromise(this.initializePromise)}async _initializeAsync(){await a(this.graphicsCore.initializePromise);const e=this.owner;this.updatingHandles.add((()=>this.renderer),(e=>this.updatingHandles.addPromise(this.graphicsCore.rendererChange(e)))),this.updatingHandles.add((()=>e.fullOpacity),(()=>this.graphicsCore.opacityChange())),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this.updatingHandles.add((()=>e.view.clippingArea),(()=>this._updateClippingExtent())),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&await a(this.graphicsCore.updateLabelingInfo())}destroy(){this.handles.removeAll(),this.updatingHandles.removeAll(),this._set("frustumVisibility",n(this.frustumVisibility)),this._set("graphicsCore",n(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get renderer(){const{renderer:e,objectIdField:t}=this.layer;if(!e||!t||"heatmap"===e.type||!e.visualVariables)return e;const i=e.visualVariables.findIndex((e=>"rotation"===e.type&&null!=e.valueExpression&&y(e.valueExpression)===t&&(null==e.axis||"heading"===e.axis)&&"geographic"===e.rotationType));if(i<0)return e;const s=e.clone();return s.visualVariables.splice(i,1),this._randomRotationRenderers||(this._randomRotationRenderers=new WeakMap),this._randomRotationRenderers.set(s,t),s}get scaleVisibility(){return this.graphicsCore?.scaleVisibility}get filterVisibility(){return this.graphicsCore?.filterVisibility}get elevationAlignment(){return this.graphicsCore?.elevationAlignment}get objectStates(){return this.graphicsCore?.objectStates}get suspendResumeExtentMode(){return"suspendResumeExtentMode"in this.owner?this.owner.suspendResumeExtentMode:"computed"}get scaleVisibilitySuspended(){return null!=this.scaleVisibility&&this.scaleVisibility.suspended}get suspended(){return this.owner.suspended}get legendEnabled(){return null==this.frustumVisibility||!this.frustumVisibility.suspended}get suspendInfo(){const e={};return this.scaleVisibilitySuspended&&(e.outsideScaleRange=!0),null!=this.frustumVisibility&&this.frustumVisibility.suspended&&(e.outsideOfView=!0),e}get updating(){return!!(this.graphicsCore?.updating||null!=this.frustumVisibility&&this.frustumVisibility.updating||this.updatingHandles?.updating)}get updatingRemaining(){return this.graphicsCore?.updatingRemaining??0}get featureStore(){return this.graphicsCore?.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner?.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}get featureSpatialReference(){return"featureSpatialReference"in this.owner?this.owner.featureSpatialReference:this.owner.view.spatialReference}get graphics3DGraphics(){return this.graphicsCore?.graphics3DGraphics}get graphics3DGraphicsByObjectID(){return this.graphicsCore?.graphics3DGraphicsByObjectID}get symbolUpdateType(){return this.graphicsCore?.symbolUpdateType}get displayFeatureLimit(){const e=this.view.resourceController?.memoryController?.memoryFactor,t=this.graphicsCore?.displayFeatureLimit;if(null==e||1===e)return t;const i=Math.ceil(t.maximumNumberOfFeatures*e),s=Math.ceil(t.maximumTotalNumberOfFeatures*e),r=Math.ceil(t.minimumTotalNumberOfFeatures*e);return{...t,maximumNumberOfFeatures:i,maximumTotalNumberOfFeatures:s,minimumTotalNumberOfFeatures:r}}get usedMemory(){return this.graphicsCore?.usedMemory??0}get loadedFeatures(){return this.graphicsCore?.numberOfGraphics??0}get usedMemoryPerFeature(){return this.graphicsCore?.usedMemoryPerGraphic??0}get unprocessedMemoryEstimate(){return this.graphicsCore?.unprocessedMemoryEstimate??0}get performanceInfo(){return{core:this.graphicsCore.performanceInfo,elevationUpdating:this.elevationAlignment.updating,visibilityFrustum:null==this.frustumVisibility||!this.frustumVisibility.suspended,visibilityScale:!this.scaleVisibilitySuspended}}maskOccludee(e){const{set:t,handle:i}=this.objectStates.acquireSet(I.MaskOccludee,null);return this.objectStates.setUid(t,e.uid),i}highlight(e,i){if(e instanceof f){const{set:t,handle:s}=this.objectStates.acquireSet(I.Highlight,i);return this.owner.queryObjectIds(e).then((e=>this.objectStates.setObjectIds(t,e))),s}if("number"==typeof e||"string"==typeof e)return this.highlight([e],i);if(e instanceof t)return this.highlight([e],i);if("toArray"in e&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof t){const t=e;if(null==R(this.layer.fieldsIndex,t[0].attributes,i)){const e=t.map((e=>e.uid)),{set:i,handle:s}=this.objectStates.acquireSet(I.Highlight,null);return this.objectStates.setUids(i,e),s}e=t.map((e=>R(this.layer.fieldsIndex,e.attributes,i)))}if("number"==typeof e[0]||"string"==typeof e[0]){const t=e,{set:s,handle:r}=this.objectStates.acquireSet(I.Highlight,i);return this.objectStates.setObjectIds(s,t),r}}return U}resetObjectStates(){this.objectStates.reset()}whenGraphicBounds(e,t){return this.graphicsCore?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsCore?.computeAttachmentOrigin(e,t)}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}getRenderingInfo(e,t,s){const r=g(e,{renderer:t,arcade:s});if(null!=r&&r.color){const e=r.color;e[0]=e[0]/255,e[1]=e[1]/255,e[2]=e[2]/255}if(null!=r&&null!=t&&this._randomRotationRenderers?.has(t)){const s=this._randomRotationRenderers.get(t),n=e.attributes[s],a=new i(0);a.updateFloatArray([n]),a.updateUint8Array([173]),r.heading=8.381e-8*a.digest()}return r}getRenderingInfoAsync(e,t,i,s){return b(e,{renderer:t,arcade:i,...s})}getSymbolLayerSize(e,t){return this.graphicsCore?.getSymbolLayerSize(e,t)}setObjectIdVisibility(e,t){this.graphicsCore?.setObjectIdVisibility(e,t)}refreshFilter(){null!=this.filterVisibility&&this.filterVisibility.reapply()}getGraphics3DGraphicByObjectId(e){return this.graphicsCore?.getGraphics3DGraphicByObjectId(e)}_updateClippingExtent(){const e=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.owner.view.spatialReference)&&(this.updateClippingExtent(e)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.handles.add(o((()=>this.suspendResumeExtentMode),(()=>{switch(this.handles.remove(P),this.suspendResumeExtentMode){case"computed":this.handles.add([o((()=>this.graphicsCore.computedExtent),(e=>this._updateSuspendResumeExtent(e)),l),o((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent)))],P);break;case"data":this.handles.add([p((()=>this.dataExtent),(e=>this._updateSuspendResumeExtent(e)),l),o((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.dataExtent)))],P);break;default:s(this.suspendResumeExtentMode)}}),l))}_updateSuspendResumeExtent(e){e?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(e,this._suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(e,t){const i=this.owner.view.spatialReference;if(!e.spatialReference.equals(i)){if(!c(e,i))return;e=m(e,i)}return S(e,t,C,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(e){null!=this.frustumVisibility&&this.frustumVisibility.setExtent(e),null!=this.scaleVisibility&&this.scaleVisibility.setExtent(e)}};e([u()],_.prototype,"type",void 0),e([u({constructOnly:!0})],_.prototype,"owner",void 0),e([u()],_.prototype,"layer",null),e([u()],_.prototype,"renderer",null),e([u({constructOnly:!0})],_.prototype,"updateClippingExtent",void 0),e([u({constructOnly:!0})],_.prototype,"elevationFeatureExpressionEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"graphicsCore",void 0),e([u({constructOnly:!0})],_.prototype,"scaleVisibilityEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"filterVisibilityEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"frustumVisibilityEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"elevationAlignmentEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"timeExtentEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"setUidToIdOnAdd",void 0),e([u()],_.prototype,"scaleVisibility",null),e([u()],_.prototype,"filterVisibility",null),e([u()],_.prototype,"elevationAlignment",null),e([u({constructOnly:!0})],_.prototype,"frustumVisibility",void 0),e([u()],_.prototype,"objectStates",null),e([u()],_.prototype,"initializePromise",void 0),e([u()],_.prototype,"suspendResumeExtentMode",null),e([u()],_.prototype,"dataExtent",void 0),e([u()],_.prototype,"scaleVisibilitySuspended",null),e([u()],_.prototype,"suspended",null),e([u()],_.prototype,"legendEnabled",null),e([u()],_.prototype,"suspendInfo",null),e([u()],_.prototype,"updating",null),e([u()],_.prototype,"updatingRemaining",null),e([u()],_.prototype,"featureStore",null),e([u()],_.prototype,"view",null),e([u()],_.prototype,"loadedGraphics",null),e([u()],_.prototype,"fullOpacity",null),e([u()],_.prototype,"filter",null),e([u()],_.prototype,"slicePlaneEnabled",null),e([u()],_.prototype,"drapeSourceType",void 0),e([u()],_.prototype,"updatePolicy",null),e([u()],_.prototype,"preferredUpdatePolicy",void 0),e([u()],_.prototype,"displayFeatureLimit",null),_=e([d("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],_);const A=_,P="suspendResumeExtentMode",U={remove(){},pause(){},resume(){}};export{A as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import"../../../../symbols.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import{get as i,releaseMaybe as s}from"../../../../core/maybe.js";import{throwIfAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import{pt2px as n,px2pt as l}from"../../../../core/screenUtils.js";import{dataComponents as c}from"../../../../core/urlUtils.js";import{c as h}from"../../../../chunks/mat4f64.js";import{f as m,a as u}from"../../../../chunks/vec2f64.js";import{f as d}from"../../../../chunks/vec3f64.js";import{f as _,c as p}from"../../../../chunks/vec4f64.js";import{projectPointToVector as f}from"../../../../geometry/projection.js";import{containsPoint as y}from"../../../../geometry/support/aaBoundingBox.js";import{createRendererExpression as g}from"../../../../support/arcadeOnDemand.js";import{defaultPrimitive as x}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{getIconHref as S}from"../../../../symbols/support/utils.js";import b from"../../../2d/arcade/callExpressionWithFeature.js";import{TRANSPARENT_UNIT as v}from"./constants.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{SymbolUpdateType as P,elevationModeChangeUpdateType as R,needsElevationUpdates2D as C}from"./elevationAlignmentUtils.js";import{ElevationContext as M}from"./ElevationContext.js";import j from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as I}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as w}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as O}from"./graphicUtils.js";import{ApplyRendererDiffResult as T}from"./interfaces.js";import{namedAnchorToHUDMaterialAnchorPos as U}from"./placementUtils.js";import{placePointOnGeometry as E,createStageObject as L,extendPointGraphicElevationContext as D}from"./pointUtils.js";import{initFastSymbolUpdatesState as F,updateFastSymbolUpdatesState as A,evaluateModelTransform as G,ConvertOptions as V}from"../support/FastSymbolUpdates.js";import{createTexture as B,DEFAULT_SYMBOL_SIZE_RATIO as N,DEFAULT_TEX_SIZE as q}from"../../support/engineContent/sdfPrimitives.js";import{DRAPED_Z as H}from"../../terrain/OverlayRenderer.js";import{PowerOfTwoResizeMode as k}from"../../webgl-engine/lib/basicInterfaces.js";import{createPointGeometry as W}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as $}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as J}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as Z}from"../../webgl-engine/materials/HUDMaterial.js";import K from"../../../../symbols/CIMSymbol.js";const Q=h(),X=d(0,0,1),Y=16,ee=1.5,te=N,re=[te/2,te/2,1-te/2,1-te/2],ie=[q*te,q*te];class se extends w{getCachedSize(){return{size:this._getIconSize()}}constructor(e,t,r,i){super(e,t,r,i),this._cimLayers=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimRequiredFields=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=S(this.symbolLayer),i=c(r);i&&"application/json"===i.mediaType?await this._prepareResourcesCIM(t,JSON.parse(i.data),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=O(this._getIconSize());if(e)throw new r("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?n(e.size):Y);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e){const t=this._getGraphicHash(e);let r=""===t?null:this._cimSymbolTextures.get(t);if(!r){const i={scaleFactor:this._cimScaleFactorOrFunction},s=this._context.sharedResources.cimSymbolRasterizer.rasterizeCIMSymbol3D(this._cimLayers,e,"esriGeometryPoint",i,void 0,void 0);this._cimMaterialParametersInfo.anchorPosition=this._getAnchorPos("relative",s.anchorPosition);const a={width:s.imageData.width,height:s.imageData.height,powerOfTwoResizeMode:k.PAD};r=new J(s.imageData,a),this._cimSymbolTextures.set(t,r),this._context.stage.add(r)}return r}_computeSize(e,t){const r=e.width/e.height;return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}_prepareMaterialParameters(){const e={anchorPosition:this._getAnchorPos(this.symbolLayer.anchor,this.symbolLayer.anchorPosition)},t=this.symbol;if(ae(t)){const{screenLength:r,minWorldLength:i,maxWorldLength:s}=t.verticalOffset;e.verticalOffset={screenLength:n(r),minWorldLength:i||0,maxWorldLength:null!=s?s:1/0}}return this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),e.occlusionTest=!0,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(oe(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,(()=>B(t)));this._texture=r.texture,this._releaseTexture=r,e.textureId=this._texture.id}e.textureIsSignedDistanceField=!0,e.distanceFieldBoundingBox=re;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/te,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesHref(e,i,s){this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const o=this._getIconSize(),n=o*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await t(this._context.sharedResources.textures.fromUrl(i,n,{signal:s}));if(!1===l.ok){a(l.error);throw new r("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${i})`)}this._releaseTexture=l.value;const c=l.value.texture,h=c.params;this._size=this._computeSize(h,o),e.textureId=c.id}this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesCIM(e,t,r){const i=new K({data:t});if(!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;o(r),this._context.sharedResources.cimSymbolRasterizer||(this._context.sharedResources.cimSymbolRasterizer=new e(this._context.renderCoordsHelper.spatialReference,!0))}const s=this._context.layer.fields?this._context.layer.fields.map((e=>e.toJSON())):null;let a,n;if(this._cimLayers=await this._context.sharedResources.cimSymbolRasterizer.analyzeCIMSymbol(i,s,this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null,"esriGeometryPoint",{signal:r}),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(isNaN(e.scaleExpression)){const t=e.scaleExpression,r=await g(t,this._context.layer.spatialReference,s);n=(e,t,i)=>{const s=b(r,e,{$view:i},"esriGeometryPoint",t);return null!==s?s:1}}else a=Number(e.scaleExpression)}this._cimScaleFactorOrFunction=a||n||1;const l=this._context.renderer?await this._context.renderer.getRequiredFields(this._context.layer.fieldsIndex):[];o(r);const c=this._context.layer.fieldsIndex;this._cimRequiredFields=l.map((e=>c.get(e).name)),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return this.symbolLayer.resource&&this.symbolLayer.resource.href?null:this.symbolLayer.resource&&this.symbolLayer.resource.primitive||x}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline&&null!=t.outline.size)return Math.max(n(t.outline.size),0);return e=oe(this._getPrimitive())?ee:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,s=i(r,"outline","color");if(null!=s){const r=e.toUnitRGB(s),i=s.a*t;return[r[0],r[1],r[2],i]}return[0,0,0,0]}_getFillColor(){if(oe(this._getPrimitive()))return v;const e=null==this._getPrimitive(),t=i(this.symbolLayer,"material","color");return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getAnchorPos(e,t){return"relative"===e?m((t.x||0)+.5,.5-(t.y||0)):e in U?U[e]:U.center}_createMaterialAndAddToStage(e,t){if(this._cimLayers?this._fastUpdates=null:this._fastUpdates=F(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&Object.assign(e,this._fastUpdates.materialParameters),this._cimLayers){let r=null!=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new Z(e),this._cimSymbolMaterials.set(e.textureId??0,r),t.add(r)),r}return this._material=new Z(e),t.add(this._material),this._material}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial((e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,isDraped:this.draped})})),this.layerOpacityChanged())}destroy(){super.destroy(),this._forEachMaterial((e=>this._context.stage.remove(e))),this._material=null,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach((e=>this._context.stage.remove(e))),this._cimSymbolTextures.clear(),this._releaseTexture=s(this._releaseTexture)}_getScaleFactor(e,t){if(this._drivenProperties.size&&e.size){for(let t=0;t<3;t++){const r=e.size[t];r&&"symbol-value"!==r&&"proportional"!==r&&(e.size[t]=n(r))}if("symbol-value"===e.size[0])return 1;if(isFinite(+e.size[0]))return+e.size[0]/t;if(isFinite(+e.size[2]))return+e.size[2]/t}return 1}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let r,i=[0,0];if(this._cimLayers){if(!this._cimLayers.length)return null;const e=this._generateTextureCIM(t),s={textureId:e.id,...this._cimMaterialParametersInfo};r=this._createMaterialAndAddToStage(s,this._context.stage),i=[e.params.width,e.params.height]}else i=this._size,r=this._material;const s=E(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=e.renderingInfo,o=this._getVertexOpacityAndColor(a);let n=1;if(!this._fastUpdates?.visualVariables.size){const e=i[0]>i[1]?i[0]:i[1];n=this._getScaleFactor(a,e)}n*=this._symbolTextureRatio;const l=m(i[0]*n,i[1]*n),c=this.setGraphicElevationContext(t,new M);return this.ensureDrapedStatus("on-the-ground"===c.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,s,r,o,l,e.layer.uid):this._createAs3DShape(t,s,r,o,l,c,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial((r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})}))}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=R(se.elevationModeChangeTypes,r,i);if(s!==P.UPDATE)return s;const a=C(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>a))}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial((e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return T.Recreate_Symbol;if(!A(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return T.Recreate_Symbol;null!=this._material&&this._material.setParameters(this._fastUpdates.materialParameters)}return T.Fast_Update}_defaultElevationInfoNoZ(){return ne}_createAs3DShape(e,t,r,i,s,a,o){const n=this.getFastUpdateAttrValues(e),l=n&&this._fastUpdates?e=>G(this._fastUpdates.materialParameters,n,e):void 0,c=this._context.layer.uid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerUid:c}),m=W(r,X,null,i,s,le,null,n,h),u=L(this._context,t,m,a,o,l);if(null==u)return null;const d=new I(this,u.object,[m],null,null,z,a);return d.alignedSampledElevation=u.sampledElevation,d.needsElevationUpdates=C(a.mode)||"absolute-height"===a.mode,d.getScreenSize=this._createScreenSizeGetter(s,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),D(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,a){r.renderPriority=this._renderPriority;const o=p();f(t,o,this._context.overlaySR),o[2]=H;const n=this._context.clippingExtent;if(null!=n&&!y(n,o))return null;const l=this.getFastUpdateAttrValues(e),c=l&&this._fastUpdates?e=>G(this._fastUpdates.materialParameters,l,e):void 0,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:e.uid,layerUid:this._context.layer.uid}),m=W(r,X,o,i,s,null,null,l,h),u=new $(m,{layerUid:a,graphicUid:e.uid,shaderTransformer:c}),d=new j(this,[u],null,this._context.drapeSourceRenderer);return d.getScreenSize=this._createScreenSizeGetter(s,c),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),d}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=u())=>{const a=t(Q);return e[0]=a[0]*i+r,e[1]=a[5]*s+r,e}}{const t=e[0]/this._symbolTextureRatio+r,i=e[1]/this._symbolTextureRatio+r;return(e=u())=>(e[0]=t,e[1]=i,e)}}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=d(e,e,e),r=l(1),i=e*r,s=d(i,i,i);return new V(t,s,r)}_getGraphicHash(e){let t="";for(const r of this._cimRequiredFields)t+=r+e.attributes[r];return t}_forEachMaterial(e){null!=this._material&&e(this._material),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._material}}}function ae(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function oe(e){return null!=e&&("cross"===e||"x"===e)}se.PRIMITIVE_SIZE=ie,se.elevationModeChangeTypes={definedChanged:P.UPDATE,staysOnTheGround:P.NONE,onTheGroundChanged:P.RECREATE};const ne={mode:"relative-to-ground",offset:0},le=_(0,0,0,1);export{se as Graphics3DIconSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../symbols.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import{get as i,releaseMaybe as s}from"../../../../core/maybe.js";import{throwIfAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import{pt2px as n,px2pt as l}from"../../../../core/screenUtils.js";import{dataComponents as c}from"../../../../core/urlUtils.js";import{c as h}from"../../../../chunks/mat4f64.js";import{f as m,a as u}from"../../../../chunks/vec2f64.js";import{f as d}from"../../../../chunks/vec3f64.js";import{f as _,c as p}from"../../../../chunks/vec4f64.js";import{projectPointToVector as f}from"../../../../geometry/projection.js";import{containsPoint as y}from"../../../../geometry/support/aaBoundingBox.js";import{createRendererExpression as g}from"../../../../support/arcadeOnDemand.js";import{defaultPrimitive as x}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{getIconHref as S}from"../../../../symbols/support/utils.js";import b from"../../../2d/arcade/callExpressionWithFeature.js";import{TRANSPARENT_UNIT as v}from"./constants.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{SymbolUpdateType as P,elevationModeChangeUpdateType as R,needsElevationUpdates2D as C}from"./elevationAlignmentUtils.js";import{ElevationContext as M}from"./ElevationContext.js";import j from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as I}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as w}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as O}from"./graphicUtils.js";import{ApplyRendererDiffResult as T}from"./interfaces.js";import{namedAnchorToHUDMaterialAnchorPos as U}from"./placementUtils.js";import{placePointOnGeometry as E,createStageObject as L,extendPointGraphicElevationContext as D}from"./pointUtils.js";import{initFastSymbolUpdatesState as F,updateFastSymbolUpdatesState as A,evaluateModelTransform as G,ConvertOptions as V}from"../support/FastSymbolUpdates.js";import{createTexture as B,DEFAULT_SYMBOL_SIZE_RATIO as N,DEFAULT_TEX_SIZE as q}from"../../support/engineContent/sdfPrimitives.js";import{DRAPED_Z as H}from"../../terrain/OverlayRenderer.js";import{PowerOfTwoResizeMode as k}from"../../webgl-engine/lib/basicInterfaces.js";import{createPointGeometry as W}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as $}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as J}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as Z}from"../../webgl-engine/materials/HUDMaterial.js";import K from"../../../../symbols/CIMSymbol.js";const Q=h(),X=d(0,0,1),Y=16,ee=1.5,te=N,re=[te/2,te/2,1-te/2,1-te/2],ie=[q*te,q*te];class se extends w{getCachedSize(){return{size:this._getIconSize()}}constructor(e,t,r,i){super(e,t,r,i),this._cimLayers=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimRequiredFields=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=S(this.symbolLayer),i=c(r);i&&"application/json"===i.mediaType?await this._prepareResourcesCIM(t,JSON.parse(i.data),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=O(this._getIconSize());if(e)throw new r("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?n(e.size):Y);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e){const t=this._getGraphicHash(e);let r=""===t?null:this._cimSymbolTextures.get(t);if(!r){const i={scaleFactor:this._cimScaleFactorOrFunction},s=this._context.sharedResources.cimSymbolRasterizer.rasterizeCIMSymbol3D(this._cimLayers,e,"esriGeometryPoint",i,void 0,void 0);this._cimMaterialParametersInfo.anchorPosition=this._getAnchorPos("relative",s.anchorPosition);const a={width:s.imageData.width,height:s.imageData.height,powerOfTwoResizeMode:k.PAD};r=new J(s.imageData,a),this._cimSymbolTextures.set(t,r),this._context.stage.add(r)}return r}_computeSize(e,t){const r=e.width/e.height;return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}_prepareMaterialParameters(){const e={anchorPosition:this._getAnchorPos(this.symbolLayer.anchor,this.symbolLayer.anchorPosition)},t=this.symbol;if(ae(t)){const{screenLength:r,minWorldLength:i,maxWorldLength:s}=t.verticalOffset;e.verticalOffset={screenLength:n(r),minWorldLength:i||0,maxWorldLength:null!=s?s:1/0}}return this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),e.occlusionTest=!0,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(oe(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,(()=>B(t)));this._texture=r.texture,this._releaseTexture=r,e.textureId=this._texture.id}e.textureIsSignedDistanceField=!0,e.distanceFieldBoundingBox=re;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/te,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesHref(e,i,s){this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const o=this._getIconSize(),n=o*this._context.graphicsCoreOwner.view.state.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await t(this._context.sharedResources.textures.fromUrl(i,n,{signal:s}));if(!1===l.ok){a(l.error);throw new r("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${i})`)}this._releaseTexture=l.value;const c=l.value.texture,h=c.params;this._size=this._computeSize(h,o),e.textureId=c.id}this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesCIM(e,t,r){const i=new K({data:t});if(!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;o(r),this._context.sharedResources.cimSymbolRasterizer||(this._context.sharedResources.cimSymbolRasterizer=new e(this._context.renderCoordsHelper.spatialReference,!0))}const s=this._context.layer.fields?this._context.layer.fields.map((e=>e.toJSON())):null;let a,n;if(this._cimLayers=await this._context.sharedResources.cimSymbolRasterizer.analyzeCIMSymbol(i,s,this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null,"esriGeometryPoint",{signal:r}),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(isNaN(e.scaleExpression)){const t=e.scaleExpression,r=await g(t,this._context.layer.spatialReference,s);n=(e,t,i)=>{const s=b(r,e,{$view:i},"esriGeometryPoint",t);return null!==s?s:1}}else a=Number(e.scaleExpression)}this._cimScaleFactorOrFunction=a||n||1;const l=this._context.renderer?await this._context.renderer.getRequiredFields(this._context.layer.fieldsIndex):[];o(r);const c=this._context.layer.fieldsIndex;this._cimRequiredFields=l.map((e=>c.get(e).name)),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return this.symbolLayer.resource&&this.symbolLayer.resource.href?null:this.symbolLayer.resource&&this.symbolLayer.resource.primitive||x}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline&&null!=t.outline.size)return Math.max(n(t.outline.size),0);return e=oe(this._getPrimitive())?ee:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,s=i(r,"outline","color");if(null!=s){const r=e.toUnitRGB(s),i=s.a*t;return[r[0],r[1],r[2],i]}return[0,0,0,0]}_getFillColor(){if(oe(this._getPrimitive()))return v;const e=null==this._getPrimitive(),t=i(this.symbolLayer,"material","color");return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getAnchorPos(e,t){return"relative"===e?m((t.x||0)+.5,.5-(t.y||0)):e in U?U[e]:U.center}_createMaterialAndAddToStage(e,t){if(this._cimLayers){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new Z(e),this._cimSymbolMaterials.set(e.textureId??0,r),t.add(r)),r}return this._fastUpdates=F(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._material=new Z(e),t.add(this._material),this._material}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial((e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,isDraped:this.draped})})),this.layerOpacityChanged())}destroy(){super.destroy(),this._forEachMaterial((e=>this._context.stage.remove(e))),this._material=null,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach((e=>this._context.stage.remove(e))),this._cimSymbolTextures.clear(),this._releaseTexture=s(this._releaseTexture)}_getScaleFactor(e,t){if(this._drivenProperties.size&&e.size){for(let t=0;t<3;t++){const r=e.size[t];r&&"symbol-value"!==r&&"proportional"!==r&&(e.size[t]=n(r))}if("symbol-value"===e.size[0])return 1;if(isFinite(+e.size[0]))return+e.size[0]/t;if(isFinite(+e.size[2]))return+e.size[2]/t}return 1}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let r,i=[0,0];if(this._cimLayers){if(!this._cimLayers.length)return null;const e=this._generateTextureCIM(t),s={textureId:e.id,...this._cimMaterialParametersInfo};r=this._createMaterialAndAddToStage(s,this._context.stage),i=[e.params.width,e.params.height]}else i=this._size,r=this._material;const s=E(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=e.renderingInfo,o=this._getVertexOpacityAndColor(a);let n=1;if(!this._fastUpdates?.visualVariables.size){const e=i[0]>i[1]?i[0]:i[1];n=this._getScaleFactor(a,e)}n*=this._symbolTextureRatio;const l=m(i[0]*n,i[1]*n),c=this.setGraphicElevationContext(t,new M);return this.ensureDrapedStatus("on-the-ground"===c.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,s,r,o,l,e.layer.uid):this._createAs3DShape(t,s,r,o,l,c,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial((r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})}))}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=R(se.elevationModeChangeTypes,r,i);if(s!==P.UPDATE)return s;const a=C(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>a))}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial((e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return T.RecreateSymbol;if(!A(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return T.RecreateSymbol;null!=this._material&&this._material.setParameters(this._fastUpdates.materialParameters)}return T.FastUpdate}_defaultElevationInfoNoZ(){return ne}_createAs3DShape(e,t,r,i,s,a,o){const n=this.getFastUpdateAttrValues(e),l=n&&this._fastUpdates?e=>G(this._fastUpdates.materialParameters,n,e):void 0,c=this._context.layer.uid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerUid:c}),m=W(r,X,null,i,s,le,null,n,h),u=L(this._context,t,m,a,o,l);if(null==u)return null;const d=new I(this,u.object,[m],null,null,z,a);return d.alignedSampledElevation=u.sampledElevation,d.needsElevationUpdates=C(a.mode)||"absolute-height"===a.mode,d.getScreenSize=this._createScreenSizeGetter(s,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),D(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,a){r.renderPriority=this._renderPriority;const o=p();f(t,o,this._context.overlaySR),o[2]=H;const n=this._context.clippingExtent;if(null!=n&&!y(n,o))return null;const l=this.getFastUpdateAttrValues(e),c=l&&this._fastUpdates?e=>G(this._fastUpdates.materialParameters,l,e):void 0,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:e.uid,layerUid:this._context.layer.uid}),m=W(r,X,o,i,s,null,null,l,h),u=new $(m,{layerUid:a,graphicUid:e.uid,shaderTransformer:c}),d=new j(this,[u],null,this._context.drapeSourceRenderer);return d.getScreenSize=this._createScreenSizeGetter(s,c),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),d}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=u())=>{const a=t(Q);return e[0]=a[0]*i+r,e[1]=a[5]*s+r,e}}{const t=e[0]/this._symbolTextureRatio+r,i=e[1]/this._symbolTextureRatio+r;return(e=u())=>(e[0]=t,e[1]=i,e)}}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=d(e,e,e),r=l(1),i=e*r,s=d(i,i,i);return new V({size:!0,color:!0,rotation:!0,opacity:!1},t,s,r)}_getGraphicHash(e){let t="";for(const r of this._cimRequiredFields)t+=r+e.attributes[r];return t}_forEachMaterial(e){null!=this._material&&e(this._material),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._material}}}function ae(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function oe(e){return null!=e&&("cross"===e||"x"===e)}se.PRIMITIVE_SIZE=ie,se.elevationModeChangeTypes={definedChanged:P.UPDATE,staysOnTheGround:P.NONE,onTheGroundChanged:P.RECREATE};const ne={mode:"relative-to-ground",offset:0},le=_(0,0,0,1);export{se as Graphics3DIconSymbolLayer};
|
|
@@ -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/Error.js";import{applySome as t,releaseMaybe as r,get as i}from"../../../../core/maybe.js";import{px2pt as a,pt2px as s}from"../../../../core/screenUtils.js";import{f as l,d as o}from"../../../../chunks/vec4f64.js";import{create as n,empty as h,expandWithBuffer as c,intersectsClippingArea as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as d}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as _}from"./ElevationAligners.js";import{SymbolUpdateType as u,elevationModeChangeUpdateType as y,needsElevationUpdates2D as g}from"./elevationAlignmentUtils.js";import{ElevationContext as f}from"./ElevationContext.js";import C from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as M}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as b,getAttributeValue as v}from"./Graphics3DSymbolLayer.js";import{ApplyRendererDiffResult as E}from"./interfaces.js";import{parseLineMarkerStyle as L,parseCapType as P}from"./lineUtils.js";import{ConvertOptions as w,initFastSymbolUpdatesState as x,updateFastSymbolUpdatesState as k}from"../support/FastSymbolUpdates.js";import D from"../../support/debugFlags.js";import{createGeometry as R}from"../../support/engineContent/line.js";import{prepareMarkerResources as A}from"../../support/engineContent/marker.js";import{geometryToRenderInfo as j,geometryToRenderInfoDraped as S}from"../../support/renderInfoUtils/line.js";import{Object3D as U}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as z}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as G}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as V}from"../../webgl-engine/materials/RibbonLineMaterial.js";import F from"../../../../geometry/Extent.js";import I from"../../../../geometry/Polygon.js";const T=["polyline","polygon","extent"];class W extends b{constructor(e,t,r,i){super(e,t,r,i),this._vvConvertOptions=new w}async doLoad(){if(this._vvConvertOptions.supportsOpacity=!0,this._vvConvertOptions.supportsRotation=!1,this._fastUpdates=x(this._context.renderer,this._vvConvertOptions),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:a(1))<0)throw new e("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}this._markerTexture=null!=this.symbolLayer.marker&&null!=this._context.sharedResources.textures?A(this._context.sharedResources.textures,L(this.symbolLayer.marker.style)):null}_getMaterialParameters(e,t=!1){const r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);this._patternHidesLine&&!t&&(r[3]=0);const i={width:this._computeMaterialWidth(this.symbolLayer?.size),color:r,hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:P(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:G(this.symbolLayer.pattern),stippleScaleWithLineWidth:!0};return this._fastUpdates?.visualVariables?{...i,...this._fastUpdates.materialParameters}:i}get _materialColor(){return t(this.symbolLayer.material,(e=>e.color))}get _markerColor(){return t(this.symbolLayer.marker,(e=>e.color))}get _lineMaterial(){return null==this._lineMaterialCached&&(this._lineMaterialCached=new V(this._getMaterialParameters(!1)),this._context.stage.add(this._lineMaterialCached)),this._lineMaterialCached}get _ringMaterial(){return null==this._ringMaterialCached&&(this._ringMaterialCached=new V(this._getMaterialParameters(!0)),this._context.stage.add(this._ringMaterialCached)),this._ringMaterialCached}get _wireframeLineMaterial(){return null==this._wireframeLineMaterialCached&&(this._wireframeLineMaterialCached=new V({...this._getMaterialParameters(!1),wireframe:!0}),this._context.stage.add(this._wireframeLineMaterialCached)),this._wireframeLineMaterialCached}get _wireframeRingMaterial(){return null==this._wireframeRingMaterialCached&&(this._wireframeRingMaterialCached=new V({...this._getMaterialParameters(!0),wireframe:!0}),this._context.stage.add(this._wireframeRingMaterialCached)),this._wireframeRingMaterialCached}get _markerMaterial(){return null==this._markerMaterialCached&&null!=this.symbolLayer.marker&&null!=this._markerTexture&&(this._markerMaterialCached=new z({...this._getMaterialParameters(!1,!0),placement:this.symbolLayer.marker.placement,textureId:this._markerTexture.texture.id}),this._context.stage.add(this._markerMaterialCached)),this._markerMaterialCached}destroy(){super.destroy(),this._forEachMaterial((e=>this._context.stage.remove(e))),this._lineMaterialCached=null,this._ringMaterialCached=null,this._wireframeLineMaterialCached=null,this._wireframeRingMaterialCached=null,this._markerMaterialCached=null,this._markerTexture=r(this._markerTexture)}_getDrivenSize(e){return this._drivenProperties.size&&e.size?s(d(e.size)):1}_getSizeFeatureAttributeData(e){return this._fastUpdates&&this._fastUpdates.visualVariables.size?v(this._fastUpdates.visualVariables.size.field,e):null}_getDrivenColor(e){const t=l(1,1,1,1);return this._drivenProperties.color&&e.color&&(t[0]=e.color[0],t[1]=e.color[1],t[2]=e.color[2],e.color.length>0&&(t[3]=e.color[3])),this._drivenProperties.opacity&&e.opacity&&(t[3]=e.opacity),t}_getColorFeatureAttributeData(e){return this._fastUpdates?.visualVariables.color?v(this._fastUpdates.visualVariables.color.field,e):null}_getOpacityFeatureAttributeData(e){return this._fastUpdates?.visualVariables.opacity?v(this._fastUpdates.visualVariables.opacity.field,e):null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,T,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t,new f);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e,this._context.layer.uid):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return E.Recreate_Symbol;{const e=this._fastUpdates;if(!k(e,t,this._vvConvertOptions))return E.Recreate_Symbol;this._forEachMaterial((t=>t.setParameters(e.materialParameters)))}}return E.Fast_Update}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=P(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push((()=>this._forEachMaterial((e=>e.setParameters(r)))))}layerOpacityChanged(){this._forEachMaterial(((e,t)=>this._updateMaterialLayerOpacity(e,t)))}_forEachMaterial(e){null!=this._lineMaterialCached&&e(this._lineMaterialCached),null!=this._ringMaterialCached&&e(this._ringMaterialCached),null!=this._wireframeLineMaterialCached&&e(this._wireframeLineMaterialCached),null!=this._wireframeRingMaterialCached&&e(this._wireframeRingMaterialCached),null!=this._markerMaterialCached&&e(this._markerMaterialCached,!0)}_updateMaterialLayerOpacity(e,t=!1){const r=e.parameters.color,a=i(this.symbolLayer,"material","color"),s=this._patternHidesLine&&!t?0:this._getCombinedOpacity(a),o=l(r[0],r[1],r[2],s);e.setParameters({color:o})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=y(W.elevationModeChangeTypes,r,i);if(a!==u.UPDATE)return a;const s=g(i);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>s))}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};return this._forEachMaterial((t=>t.setParameters(e))),!0}physicalBasedRenderingChanged(){return!0}_getGeometryAsPolygonOrPolyline(e){switch(e.type){case"extent":if(e instanceof F)return I.fromExtent(e);break;case"polygon":case"polyline":return e}return null}_createAs3DShape(e,t,r){const i=e.graphic,a=this._getGeometryAsPolygonOrPolyline(i.geometry),s="polygon"===a.type?a.rings:a.paths,l=new Array,o=n(),m=j(a,this._context.elevationProvider,this._context.renderCoordsHelper,t),d="polygon"===a.type?"rings":"paths";this._logGeometryCreationWarnings(m,s,d,"LineSymbol3DLayer");for(let n=0;n<m.lines.length;n++){const t=m.lines[n],i=t.position,s=t.mapPositions;if(null!=this._context.clippingExtent&&(h(o),c(o,s),!p(o,this._context.clippingExtent)))continue;const d=this._createGeometry("polygon"===a.type?this._ringMaterial:this._lineMaterial,e,i,s,a.type,H.ELEVATED,r);l.push(d),D.LINE_WIREFRAMES&&l.push(d.instantiate({material:"polygon"===a.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial&&l.push(d.instantiate({material:this._markerMaterial}))}if(0===l.length)return null;const u=new U({geometries:l,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:r}),y=new M(this,u,l,null,null,_,t);return y.alignedSampledElevation=m.sampledElevation,y.needsElevationUpdates=g(t.mode),y}_createGeometry(e,t,r,i,a,s,l){const o="polygon"===a,n=this._fastUpdates?.visualVariables.color,h=this._fastUpdates?.visualVariables.size,c=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerUid:this._context.layer.uid});return R(e,{overlayInfo:s===H.DRAPED?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,removeDuplicateStartEnd:o,mapPositions:i,attributeData:{position:r,size:h?null:this._getDrivenSize(t.renderingInfo),color:n?null:this._getDrivenColor(t.renderingInfo),sizeFeature:this._getSizeFeatureAttributeData(t.graphic),colorFeature:this._getColorFeatureAttributeData(t.graphic),opacityFeature:this._getOpacityFeatureAttributeData(t.graphic)}},c)}_createAsOverlay(e,t){const r=e.graphic,i=this._getGeometryAsPolygonOrPolyline(r.geometry),a="polygon"===i.type?i.rings:i.paths,s="polygon"===i.type?this._ringMaterial:this._lineMaterial;s.renderPriority=this._renderPriority;const l=D.LINE_WIREFRAMES?"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,o=this._markerMaterial;null!=l&&(l.renderPriority=this._renderPriority-.001),null!=o&&(o.renderPriority=this._renderPriority-.002);const d=new Array,_=n(),u=h(),y=S(i,this._context.overlaySR),g="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(y,a,g,"LineSymbol3DLayer");for(const n of y.lines){if(h(_),c(_,n.position),!p(_,this._context.clippingExtent))continue;m(u,_);const a=a=>{const s=this._createGeometry(a,e,n.position,void 0,i.type,H.DRAPED,r.uid),l=new O(s,{layerUid:t,graphicUid:r.uid});d.push(l)};if(null!=o){a(o);const e=this.symbolLayer.marker.placement;"begin"!==e&&"begin-end"!==e||c(_,n.position,0,1),"end"!==e&&"begin-end"!==e||c(_,n.position,n.position.length-3,1)}a(s),D.LINE_WIREFRAMES&&a(l)}return new C(this,d,u,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??a(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?s(1):1:s(e)}_prepareMaterialPatch(e,r,i){const a=r.material;if(null==a)return void(i.changed&&i.useMaterialColor&&this._patchMaterialColor(this._getCombinedOpacityAndColor(this._materialColor),this._markerMaterialCached,e));if("collection"===a.type)return;const s="complete"===a.type?t(a.newValue,(e=>e.color)):"complete"===a.diff.color?.type?a.diff.color.newValue:null,l=this._getCombinedOpacityAndColor(s);i.useMaterialColor&&this._patchMaterialColor(o(l),this._markerMaterialCached,e),this._patternHidesLine&&(l[3]=0),this._patchMaterialColor(l,this._lineMaterialCached,e),delete r.material}_prepareMarkerPatch(e,t){const r=t.marker;if(null==r||"partial"!==r.type||null!=r.diff.style||null!=r.diff.placement||null!=r.diff.color&&"complete"!==r.diff.color.type)return{changed:!1,useMaterialColor:null==this._markerColor};const i=r.diff.color;if(null==i)return delete t.marker,{changed:!1,useMaterialColor:null==this._markerColor};const a=i.newValue;return null==a?(delete t.marker,{changed:!0,useMaterialColor:!0}):(this._patchMaterialColor(this._getCombinedOpacityAndColor(a),this._markerMaterialCached,e),delete t.marker,{changed:!0,useMaterialColor:!1})}_patchMaterialColor(e,t,r){null!=t&&r.symbolLayerStatePatches.push((()=>t.setParameters({color:e})))}}var H;W.elevationModeChangeTypes={definedChanged:u.RECREATE,staysOnTheGround:u.NONE,onTheGroundChanged:u.RECREATE},function(e){e[e.DRAPED=0]="DRAPED",e[e.ELEVATED=1]="ELEVATED"}(H||(H={}));export{W as Graphics3DLineSymbolLayer};
|
|
5
|
+
import"../../../../geometry.js";import e from"../../../../core/Error.js";import{applySome as t,releaseMaybe as r,get as i}from"../../../../core/maybe.js";import{px2pt as a,pt2px as s}from"../../../../core/screenUtils.js";import{f as l,d as o}from"../../../../chunks/vec4f64.js";import{create as n,empty as h,expandWithBuffer as c,intersectsClippingArea as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as d}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as y}from"./ElevationAligners.js";import{SymbolUpdateType as _,elevationModeChangeUpdateType as u,needsElevationUpdates2D as g}from"./elevationAlignmentUtils.js";import{ElevationContext as f}from"./ElevationContext.js";import M from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as b}from"./Graphics3DSymbolLayer.js";import{ApplyRendererDiffResult as E}from"./interfaces.js";import{parseLineMarkerStyle as L,parseCapType as P}from"./lineUtils.js";import{ConvertOptions as w,initFastSymbolUpdatesState as x,updateFastSymbolUpdatesState as v,getAttributeValue as k}from"../support/FastSymbolUpdates.js";import R from"../../support/debugFlags.js";import{createGeometry as j}from"../../support/engineContent/line.js";import{prepareMarkerResources as D}from"../../support/engineContent/marker.js";import{geometryToRenderInfo as A,geometryToRenderInfoDraped as S}from"../../support/renderInfoUtils/line.js";import{Object3D as U}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as G}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as z}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as O}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as I}from"../../webgl-engine/materials/RibbonLineMaterial.js";import T from"../../../../geometry/Extent.js";import V from"../../../../geometry/Polygon.js";const W=["polyline","polygon","extent"],F=new w({size:!0,color:!0,rotation:!1,opacity:!0});class H extends b{constructor(e,t,r,i){super(e,t,r,i)}async doLoad(){if(this._fastUpdates=x(this._context.renderer,F),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:a(1))<0)throw new e("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}this._markerTexture=null!=this.symbolLayer.marker&&null!=this._context.sharedResources.textures?D(this._context.sharedResources.textures,L(this.symbolLayer.marker.style)):null}_getMaterialParameters(e,t=!1){const r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);this._patternHidesLine&&!t&&(r[3]=0);const i={width:this._computeMaterialWidth(this.symbolLayer?.size),color:r,hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:P(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:O(this.symbolLayer.pattern),stippleScaleWithLineWidth:!0};return this._fastUpdates?.visualVariables?{...i,...this._fastUpdates.materialParameters}:i}get _materialColor(){return t(this.symbolLayer.material,(e=>e.color))}get _markerColor(){return t(this.symbolLayer.marker,(e=>e.color))}get _lineMaterial(){return null==this._lineMaterialCached&&(this._lineMaterialCached=new I(this._getMaterialParameters(!1)),this._context.stage.add(this._lineMaterialCached)),this._lineMaterialCached}get _ringMaterial(){return null==this._ringMaterialCached&&(this._ringMaterialCached=new I(this._getMaterialParameters(!0)),this._context.stage.add(this._ringMaterialCached)),this._ringMaterialCached}get _wireframeLineMaterial(){return null==this._wireframeLineMaterialCached&&(this._wireframeLineMaterialCached=new I({...this._getMaterialParameters(!1),wireframe:!0}),this._context.stage.add(this._wireframeLineMaterialCached)),this._wireframeLineMaterialCached}get _wireframeRingMaterial(){return null==this._wireframeRingMaterialCached&&(this._wireframeRingMaterialCached=new I({...this._getMaterialParameters(!0),wireframe:!0}),this._context.stage.add(this._wireframeRingMaterialCached)),this._wireframeRingMaterialCached}get _markerMaterial(){return null==this._markerMaterialCached&&null!=this.symbolLayer.marker&&null!=this._markerTexture&&(this._markerMaterialCached=new z({...this._getMaterialParameters(!1,!0),placement:this.symbolLayer.marker.placement,textureId:this._markerTexture.texture.id}),this._context.stage.add(this._markerMaterialCached)),this._markerMaterialCached}destroy(){super.destroy(),this._forEachMaterial((e=>this._context.stage.remove(e))),this._lineMaterialCached=null,this._ringMaterialCached=null,this._wireframeLineMaterialCached=null,this._wireframeRingMaterialCached=null,this._markerMaterialCached=null,this._markerTexture=r(this._markerTexture)}_getDrivenSize(e){return this._drivenProperties.size&&e.size?s(d(e.size)):1}_getDrivenColor(e){const t=l(1,1,1,1);return this._drivenProperties.color&&e.color&&(t[0]=e.color[0],t[1]=e.color[1],t[2]=e.color[2],e.color.length>0&&(t[3]=e.color[3])),this._drivenProperties.opacity&&e.opacity&&(t[3]=e.opacity),t}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,W,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t,new f);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e,this._context.layer.uid):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return E.RecreateSymbol;{const e=this._fastUpdates;if(!v(e,t,F))return E.RecreateSymbol;this._forEachMaterial((t=>t.setParameters(e.materialParameters)))}}return E.FastUpdate}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=P(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push((()=>this._forEachMaterial((e=>e.setParameters(r)))))}layerOpacityChanged(){this._forEachMaterial(((e,t)=>this._updateMaterialLayerOpacity(e,t)))}_forEachMaterial(e){null!=this._lineMaterialCached&&e(this._lineMaterialCached),null!=this._ringMaterialCached&&e(this._ringMaterialCached),null!=this._wireframeLineMaterialCached&&e(this._wireframeLineMaterialCached),null!=this._wireframeRingMaterialCached&&e(this._wireframeRingMaterialCached),null!=this._markerMaterialCached&&e(this._markerMaterialCached,!0)}_updateMaterialLayerOpacity(e,t=!1){const r=e.parameters.color,a=i(this.symbolLayer,"material","color"),s=this._patternHidesLine&&!t?0:this._getCombinedOpacity(a),o=l(r[0],r[1],r[2],s);e.setParameters({color:o})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=u(H.elevationModeChangeTypes,r,i);if(a!==_.UPDATE)return a;const s=g(i);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>s))}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};return this._forEachMaterial((t=>t.setParameters(e))),!0}physicalBasedRenderingChanged(){return!0}_getGeometryAsPolygonOrPolyline(e){switch(e.type){case"extent":if(e instanceof T)return V.fromExtent(e);break;case"polygon":case"polyline":return e}return null}_createAs3DShape(e,t,r){const i=e.graphic,a=this._getGeometryAsPolygonOrPolyline(i.geometry),s="polygon"===a.type?a.rings:a.paths,l=new Array,o=n(),m=A(a,this._context.elevationProvider,this._context.renderCoordsHelper,t),d="polygon"===a.type?"rings":"paths";this._logGeometryCreationWarnings(m,s,d,"LineSymbol3DLayer");for(let n=0;n<m.lines.length;n++){const t=m.lines[n],i=t.position,s=t.mapPositions;if(null!=this._context.clippingExtent&&(h(o),c(o,s),!p(o,this._context.clippingExtent)))continue;const d=this._createGeometry("polygon"===a.type?this._ringMaterial:this._lineMaterial,e,i,s,a.type,N.ELEVATED,r);l.push(d),R.LINE_WIREFRAMES&&l.push(d.instantiate({material:"polygon"===a.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial&&l.push(d.instantiate({material:this._markerMaterial}))}if(0===l.length)return null;const _=new U({geometries:l,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:r}),u=new C(this,_,l,null,null,y,t);return u.alignedSampledElevation=m.sampledElevation,u.needsElevationUpdates=g(t.mode),u}_createGeometry(e,t,r,i,a,s,l){const o=s===N.DRAPED?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,n="polygon"===a,h=this._fastUpdates?.visualVariables.color,c=this._fastUpdates?.visualVariables.size,p=this._fastUpdates?.visualVariables.opacity,m=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerUid:this._context.layer.uid}),d={position:r,size:c?null:this._getDrivenSize(t.renderingInfo),color:h?null:this._getDrivenColor(t.renderingInfo),sizeFeature:c?k(c.field,t.graphic):null,colorFeature:h?k(h.field,t.graphic):null,opacityFeature:p?k(p.field,t.graphic):null};return j(e,{overlayInfo:o,removeDuplicateStartEnd:n,mapPositions:i,attributeData:d},m)}_createAsOverlay(e,t){const r=e.graphic,i=this._getGeometryAsPolygonOrPolyline(r.geometry),a="polygon"===i.type?i.rings:i.paths,s="polygon"===i.type?this._ringMaterial:this._lineMaterial;s.renderPriority=this._renderPriority;const l=R.LINE_WIREFRAMES?"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,o=this._markerMaterial;null!=l&&(l.renderPriority=this._renderPriority-.001),null!=o&&(o.renderPriority=this._renderPriority-.002);const d=new Array,y=n(),_=h(),u=S(i,this._context.overlaySR),g="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(u,a,g,"LineSymbol3DLayer");for(const n of u.lines){if(h(y),c(y,n.position),!p(y,this._context.clippingExtent))continue;m(_,y);const a=a=>{const s=this._createGeometry(a,e,n.position,void 0,i.type,N.DRAPED,r.uid),l=new G(s,{layerUid:t,graphicUid:r.uid});d.push(l)};if(null!=o){a(o);const e=this.symbolLayer.marker.placement;"begin"!==e&&"begin-end"!==e||c(y,n.position,0,1),"end"!==e&&"begin-end"!==e||c(y,n.position,n.position.length-3,1)}a(s),R.LINE_WIREFRAMES&&a(l)}return new M(this,d,_,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??a(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?s(1):1:s(e)}_prepareMaterialPatch(e,r,i){const a=r.material;if(null==a)return void(i.changed&&i.useMaterialColor&&this._patchMaterialColor(this._getCombinedOpacityAndColor(this._materialColor),this._markerMaterialCached,e));if("collection"===a.type)return;const s="complete"===a.type?t(a.newValue,(e=>e.color)):"complete"===a.diff.color?.type?a.diff.color.newValue:null,l=this._getCombinedOpacityAndColor(s);i.useMaterialColor&&this._patchMaterialColor(o(l),this._markerMaterialCached,e),this._patternHidesLine&&(l[3]=0),this._patchMaterialColor(l,this._lineMaterialCached,e),delete r.material}_prepareMarkerPatch(e,t){const r=t.marker;if(null==r||"partial"!==r.type||null!=r.diff.style||null!=r.diff.placement||null!=r.diff.color&&"complete"!==r.diff.color.type)return{changed:!1,useMaterialColor:null==this._markerColor};const i=r.diff.color;if(null==i)return delete t.marker,{changed:!1,useMaterialColor:null==this._markerColor};const a=i.newValue;return null==a?(delete t.marker,{changed:!0,useMaterialColor:!0}):(this._patchMaterialColor(this._getCombinedOpacityAndColor(a),this._markerMaterialCached,e),delete t.marker,{changed:!0,useMaterialColor:!1})}_patchMaterialColor(e,t,r){null!=t&&r.symbolLayerStatePatches.push((()=>t.setParameters({color:e})))}}var N;H.elevationModeChangeTypes={definedChanged:_.RECREATE,staysOnTheGround:_.NONE,onTheGroundChanged:_.RECREATE},function(e){e[e.DRAPED=0]="DRAPED",e[e.ELEVATED=1]="ELEVATED"}(N||(N={}));export{H as Graphics3DLineSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import has from"../../../../core/has.js";import{get as t}from"../../../../core/maybe.js";import{throwIfAborted as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{estimateSize as i}from"../../../../core/typedArrayUtil.js";import{i as a,k as o,w as n,c as l}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{l as h,o as d,c as m,C as p,a as u,s as y}from"../../../../chunks/vec3.js";import{d as _,O as f,Z as g,f as b,c as P}from"../../../../chunks/vec3f64.js";import{O as x,c as R}from"../../../../chunks/vec4f64.js";import{projectPointToVector as v,computeTranslationToOriginAndRotation as L}from"../../../../geometry/projection.js";import{create as C,size as S,containsPoint as j,center as w}from"../../../../geometry/support/aaBoundingBox.js";import{defaultPrimitive as E}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as U,objectSymbolLayerSizeWithResourceSize as T}from"../../../../symbols/support/symbolLayerUtils3D.js";import{perLodInstanceElevationAligner as I}from"./ElevationAligners.js";import{needsElevationUpdates3D as B,evaluateElevationInfoAtPoint as O,SampleElevationInfo as G}from"./elevationAlignmentUtils.js";import{ElevationContext as A}from"./ElevationContext.js";import D from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as M}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as F,mixinColorAndOpacity as z,computeObjectScale as V,computeObjectRotation as k}from"./graphicUtils.js";import{ApplyRendererDiffResult as H}from"./interfaces.js";import{LoadStatus as W}from"./Loadable.js";import{makeLodResources as q}from"./lodResourceUtils.js";import{fetch as N}from"./objectResourceUtils.js";import{placePointOnGeometry as $,extendPointGraphicElevationContext as Z}from"./pointUtils.js";import{isValidPrimitive as J,primitiveLodResources as K}from"./primitiveObjectSymbolUtils.js";import{defaultSymbolLayerMemoryComplexity as Q}from"./symbolComplexity.js";import{initFastSymbolUpdatesState as X,updateFastSymbolUpdatesState as Y,ConvertOptions as ee,evaluateModelTransform as te,evaluateModelTransformScale as se}from"../support/FastSymbolUpdates.js";import{CullFaceOptions as re}from"../../webgl-engine/lib/basicInterfaces.js";import{VertexAttribute as ie}from"../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as ae}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{materialsFromLodResources as oe,texturesFromLodResources as ne,geometriesFromLodResources as le,geometriesFromLodLevelResources as ce}from"../../webgl-engine/lib/lodRendering/LodResources.js";import{DefaultMaterial as he}from"../../webgl-engine/materials/DefaultMaterial.js";class de{constructor(e,t,s,r,i,a,o,n,l,c,h,d){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.originalMaterialParameters=r,this.resourceSize=i,this.isEsriSymbolResource=a,this.isWosr=o,this.resourceBoundingBox=n,this.symbolSize=l,this.extentPadding=c,this.physicalBasedRenderingEnabled=h,this.pivotOffset=d}}class me extends M{getCachedSize(){const[e,t,s]=null!=this._resources?this._resources.symbolSize:[1,1,1];return{width:e,depth:t,height:s}}constructor(e,t,s,r){super(e,t,s,r),this._resources=null,this._optionalFields=new Array,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){if(F(this.symbolLayer))throw new Error}const t=this.symbolLayer.resource;if(this._isPrimitive){const s=t&&J(t.primitive)?t.primitive:E;this._resources=await this._createResourcesForPrimitive(s,e)}else this._resources=await this._createResourcesForUrl(t.href,e);this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.complexity=this.computeComplexity()}get extentPadding(){return null!=this._resources?this._resources.extentPadding:0}get _isPrimitive(){return!(this.symbolLayer.resource&&this.symbolLayer.resource.href)}get lodRenderer(){return null!=this._resources?this._resources.lodRenderer:null}_setMaterialTransparencyParams(e,s=t(this.symbolLayer,"material","color")){const r=this._getCombinedOpacity(s),i=r<1||this.needsDrivenTransparentPass;return e.transparent=i,e.opacity=r,e.cullFace=i?re.None:re.Back,e}async _createResourcesForPrimitive(t,s){const i=this.symbolLayer,a=C(U(t)),o=_(S(a)),n=_(T(o,i)),l=h(n),c=!1,d=!1,m={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,ambient:f,diffuse:f,hasSlicePlane:this._context.slicePlaneEnabled,hasSliceHighlight:!1,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!this.symbolLayer.isPrimitive},p=!!m.usePBR;this._setMaterialTransparencyParams(m);const u=this.symbol;if("point-3d"===u.type&&u.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=u.verticalOffset;m.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0},m.castShadows=!1}if(this._context.screenSizePerspectiveEnabled&&(m.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)m.externalColor=x;else{const t=null!=i.material?i.material.color:null,s=null!=t?e.toUnitRGBA(t):x;m.externalColor=s}this._fastUpdates=X(this._context.renderer,this._fastVisualVariableConvertOptions(a,n,o,null)),m.isInstanced=!0,this._fastUpdates?(Object.assign(m,this._fastUpdates.materialParameters),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(m.hasInstancedColor=!0,this._optionalFields.push("color")),has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push("objectAndLayerIdColor");const y=new he(m),g=K(t,y);if(!g)throw new Error(`Unknown object symbol primitive: ${t}`);const b=oe(g).map((e=>({opacity:1,transparent:e.parameters.transparent}))),P=await this._createStageResources(g,p,s),R=await this._createLodRenderer(g,s);return new de(g,R,P,b,o,c,d,a,n,l,p,null)}async _createResourcesForUrl(e,s){const i={materialParamsMixin:{isInstanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache};this._fastUpdates=X(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(i.materialParamsMixin,this._fastUpdates.materialParameters),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(i.materialParamsMixin.hasInstancedColor=!0,this._optionalFields.push("color")),has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push("objectAndLayerIdColor");const a=this.symbol;if("point-3d"===a.type&&a.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=a.verticalOffset;i.materialParamsMixin.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0},i.materialParamsMixin.castShadows=!1}i.signal=s,i.usePBR=this._context.physicalBasedRenderingEnabled,i.skipHighLods=this._context.skipHighSymbolLods;const o=i.usePBR,n=await N(e,i),l=n.isEsriSymbolResource,c=n.isWosr,d=q(n.lods);d.levels.sort(((e,t)=>e.minScreenSpaceRadius-t.minScreenSpaceRadius));const m=this._context,p=this.symbolLayer.material,u=this._getExternalColorParameters(p),y=t(this.symbolLayer,"material","color"),f=this._getCombinedOpacity(y,{hasIntrinsicColor:!0}),g=this.needsDrivenTransparentPass,b=oe(d),P=oe(d).map((e=>({opacity:e.parameters.opacity||1,transparent:e.parameters.transparent})));b.forEach((e=>{const t=e.parameters;e.setParameters(u);const s=t.opacity*f,r=s<1||g||t.transparent;e.setParameters({opacity:s,transparent:r}),m.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:m.sharedResources.screenSizePerspectiveSettings})}));const x=n.referenceBoundingBox,R=_(S(x)),v=_(d.levels[0].pivotOffset),L=_(T(R,this.symbolLayer)),C=h(L),j=this._fastUpdates;Y(j,this._context.renderer,this._fastVisualVariableConvertOptions(x,L,R,v))&&b.forEach((e=>e.setParameters(j.materialParameters)));const w=await this._createStageResources(d,o,s),E=await this._createLodRenderer(d,s);return new de(d,E,w,P,R,l,c,x,L,C,o,v)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,t,r){const i=this._context.stage,a=oe(e);t!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged(),i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const o=ne(e);i.addMany(o),this._addDisposeResource((()=>i.removeMany(o))),await i.load(o,r),s(r);const n=le(e);return i.addMany(n),this._addDisposeResource((()=>i.removeMany(n))),{materials:a,textures:o,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerUid:this._context.layer.uid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,a=i?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,_e),l(s,te(i.materialParameters,_e,s))},scaleFactor:(e,t,s)=>{t.getFeatureAttribute(s,_e),se(e,i.materialParameters,_e)}}:null,o=new ae({symbol:e,optionalFields:this._optionalFields,metadata:r,shaderTransformation:a},this._context.scheduler);return o.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o.slots,o,t),o}_getExternalColorParameters(t){const s={};return this._drivenProperties.color?s.externalColor=x:null!=t&&null!=t.color?s.externalColor=e.toUnitRGBA(t.color):(s.externalColor=x,s.colorMixMode="ignore"),s}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach((e=>e())),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=$(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const r=this.setGraphicElevationContext(t,new A),i=e.renderingInfo;return this._createAs3DShape(t,s,i,r,t.uid,e.layer.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(null==this._resources)return;const e=this._drivenProperties.opacity,s=!this._isPrimitive,r=this._resources.stageResources.materials,i=this._resources.originalMaterialParameters;for(let a=0;a<r.length;a++){const o=r[a],n=t(this.symbolLayer,"material","color"),l=i[a],c=this._getCombinedOpacity(n,{hasIntrinsicColor:s})*l.opacity,h=c<1||e||l.transparent;o.setParameters({opacity:c,transparent:h}),this._isPrimitive&&o.setParameters({cullFace:h?re.None:re.Back})}}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,B)}slicePlaneEnabledChanged(){if(null==this._resources)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(null==this._resources)return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}applyRendererDiff(e,t){if(null==this._resources)return H.Recreate_Symbol;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:n}=this._resources;for(const l in e.diff){if("visualVariables"!==l)return H.Recreate_Symbol;if(!Y(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,n)))return H.Recreate_Symbol;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return H.Fast_Update}computeComplexity(){if(null==this._resources)return super.computeComplexity();const e=this._resources.lodResources,t=ce(e.levels[0]).reduce(((e,t)=>e+t.indices.get(ie.POSITION).length),0)/3,s=e=>Array.from(e.vertexAttributes.values()).reduce(((e,t)=>e+i(t.data)),0)+Array.from(e.indices.values()).reduce(((e,t)=>e+i(t)),0),r=ne(e).reduce(((e,t)=>e+(t.params.encoding&&"image/ktx2"===t.params.encoding?t.estimatedTexMemRequired:t.estimatedTexMemRequired/4)),0)+le(e).reduce(((e,t)=>e+s(t)),0);return{primitivesPerFeature:t,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1,memory:{...Q(this.symbol,this.symbolLayer),resourceBytes:r}}}_hasLodRenderer(){return null!=this._resources}_createAs3DShape(e,t,s,r,i,a){if(!this._hasLodRenderer()||null==this._resources)return null;const o=this.getFastUpdateAttrValues(e),n=null==this._fastUpdates&&this._hasPerInstanceColor()?z(s.color,s.opacity):null,l=this._context.clippingExtent;if(v(t,pe,this._context.elevationProvider.spatialReference),null!=l&&!j(l,pe))return null;const c=this._requiresTerrainElevation(r),h=this._computeGlobalTransform(t,r,ye,fe),d=this._computeLocalTransform(this._resources,this.symbolLayer,s,ue),m=this._resources.lodRenderer.instanceData,p=m.addInstance();this._instanceIndexToGraphicUid.set(p,i),m.setLocalTransform(p,d,!1),m.setGlobalTransform(p,h),o&&m.setFeatureAttribute(p,o),n&&m.setColor(p,n),null!=this._context.stage.renderView.objectAndLayerIdRenderHelper&&m.setObjectAndLayerIdColor(p,this._context.stage.renderView.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor({graphicUid:i,layerUid:a}));const u=new D(this,p,I,r);return c&&(u.alignedSampledElevation=fe.sampledElevation),u.needsElevationUpdates=B(r.mode),Z(u,t,this._context.elevationProvider),u}_computeGlobalTransform(e,t,s,r){return O(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),pe[0]=e.x,pe[1]=e.y,pe[2]=r.z,L(e.spatialReference,pe,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,r){return a(r),this._applyObjectRotation(s,!1,r),this._applyObjectRotation(t,!0,r),this._applyObjectScale(e,s,r),this._applyAnchor(e,t,r),r}_applyObjectScale(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,i=V(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||o(s,s,i)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(null==this._resources)return!0;const s=t&&$(t);if(null==s)return!1;const r=this.getGeometryElevationMode(t);return e.elevationContext.mode===r&&(this._computeGlobalTransform(s,e.elevationContext,ye,fe),this._requiresTerrainElevation(e.elevationContext)&&(e.alignedSampledElevation=fe.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,ye,!0),Z(e,s,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(null==this._resources)return;const s=(e,t,s)=>(null!=e&&"complete"===e.type?e.newValue:t)??s,r=s(t.heading,this.symbolLayer.heading,0),i=s(t.tilt,this.symbolLayer.tilt,0),a=s(t.roll,this.symbolLayer.roll,0),o=s(t.width,this.symbolLayer.width,void 0),n=s(t.height,this.symbolLayer.height,void 0),l=s(t.depth,this.symbolLayer.depth,void 0),c=s(t.anchor,this.symbolLayer.anchor,void 0),h=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const d={heading:r,tilt:i,roll:a,anchor:c,anchorPosition:h},m=this._resources;this.loadStatus===W.LOADED&&e.symbolLayerStatePatches.push((()=>{m.symbolSize=_(T(m.resourceSize,{width:o,height:n,depth:l,isPrimitive:this.symbolLayer.isPrimitive}))})),e.graphics3DGraphicPatches.push(((e,t)=>{const s=this._computeLocalTransform(m,d,t,ue),r=e.instanceIndex;m.lodRenderer.instanceData.setLocalTransform(r,s,!0)}))}_preparePatchColor(t,s){if(!s.material||"partial"!==s.material.type)return;const r=s.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const i=r.color.newValue,a=null!=i?e.toUnitRGBA(i):x;delete r.color;const o=this._resources;null!=o&&t.graphics3DGraphicPatches.push((e=>{let t;this._hasPerInstanceColor()?(o.lodRenderer.instanceData.setColor(e.instanceIndex,a),t=this._setMaterialTransparencyParams({},i)):t=this._setMaterialTransparencyParams({externalColor:a},i);for(const s of o.stageResources.materials)s.setParameters(t)}))}_requiresTerrainElevation(e){return"absolute-height"!==e.mode}_applyObjectRotation(e,t,s){if(!this._fastUpdates?.requiresShaderTransformation||!t)return k(e.heading,e.tilt,e.roll,s)}_computeAnchor(e,t,s){const r=P();switch(s.anchor){case"center":m(r,w(e)),d(r,r);break;case"top":{const t=w(e);y(r,-t[0],-t[1],-e[5]);break}case"bottom":{const t=w(e);y(r,-t[0],-t[1],-e[2]);break}case"relative":{const t=w(e),i=S(e),a=s.anchorPosition,o=a?b(a.x,a.y,a.z):g;p(r,i,o),u(r,r,t),d(r,r);break}default:null!=t?d(r,t):m(r,g)}return r}_applyAnchor(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._computeAnchor(e.resourceBoundingBox,e.pivotOffset,t);r&&n(s,s,r)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,t,s,r){const i=null!=e?_(S(e)):f,a=null!=e?this._computeAnchor(e,r,this.symbolLayer):g,o=this._context.renderCoordsHelper.unitInMeters,n=V(null!=t?t:void 0,t,s,o),l=b(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new ee(i,t??f,o,a,n,l)}}const pe=P(),ue=c(),ye=c(),_e=R(),fe=new G;export{me as Graphics3DObjectSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import has from"../../../../core/has.js";import{get as t}from"../../../../core/maybe.js";import{throwIfAborted as s}from"../../../../core/promiseUtils.js";import{pt2px as r}from"../../../../core/screenUtils.js";import{estimateSize as i}from"../../../../core/typedArrayUtil.js";import{i as a,k as o,w as n,c as l}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{l as h,o as d,c as m,C as p,a as u,s as y}from"../../../../chunks/vec3.js";import{d as _,O as f,Z as g,f as b,c as P}from"../../../../chunks/vec3f64.js";import{O as x,c as R}from"../../../../chunks/vec4f64.js";import{projectPointToVector as v,computeTranslationToOriginAndRotation as L}from"../../../../geometry/projection.js";import{create as C,size as S,containsPoint as j,center as w}from"../../../../geometry/support/aaBoundingBox.js";import{defaultPrimitive as E}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{objectSymbolLayerPrimitiveBoundingBox as U,objectSymbolLayerSizeWithResourceSize as T}from"../../../../symbols/support/symbolLayerUtils3D.js";import{perLodInstanceElevationAligner as I}from"./ElevationAligners.js";import{needsElevationUpdates3D as B,evaluateElevationInfoAtPoint as O,SampleElevationInfo as G}from"./elevationAlignmentUtils.js";import{ElevationContext as A}from"./ElevationContext.js";import D from"./Graphics3DLodInstanceGraphicLayer.js";import{Graphics3DSymbolLayer as M}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as z,mixinColorAndOpacity as F,computeObjectScale as V,computeObjectRotation as k}from"./graphicUtils.js";import{ApplyRendererDiffResult as H}from"./interfaces.js";import{LoadStatus as W}from"./Loadable.js";import{makeLodResources as q}from"./lodResourceUtils.js";import{fetch as N}from"./objectResourceUtils.js";import{placePointOnGeometry as $,extendPointGraphicElevationContext as Z}from"./pointUtils.js";import{isValidPrimitive as J,primitiveLodResources as K}from"./primitiveObjectSymbolUtils.js";import{defaultSymbolLayerMemoryComplexity as Q}from"./symbolComplexity.js";import{initFastSymbolUpdatesState as X,updateFastSymbolUpdatesState as Y,ConvertOptions as ee,evaluateModelTransform as te,evaluateModelTransformScale as se}from"../support/FastSymbolUpdates.js";import{CullFaceOptions as re}from"../../webgl-engine/lib/basicInterfaces.js";import{VertexAttribute as ie}from"../../webgl-engine/lib/VertexAttribute.js";import{LodRenderer as ae}from"../../webgl-engine/lib/lodRendering/LodRenderer.js";import{materialsFromLodResources as oe,texturesFromLodResources as ne,geometriesFromLodResources as le,geometriesFromLodLevelResources as ce}from"../../webgl-engine/lib/lodRendering/LodResources.js";import{DefaultMaterial as he}from"../../webgl-engine/materials/DefaultMaterial.js";class de{constructor(e,t,s,r,i,a,o,n,l,c,h,d){this.lodResources=e,this.lodRenderer=t,this.stageResources=s,this.originalMaterialParameters=r,this.resourceSize=i,this.isEsriSymbolResource=a,this.isWosr=o,this.resourceBoundingBox=n,this.symbolSize=l,this.extentPadding=c,this.physicalBasedRenderingEnabled=h,this.pivotOffset=d}}class me extends M{getCachedSize(){const[e,t,s]=null!=this._resources?this._resources.symbolSize:[1,1,1];return{width:e,depth:t,height:s}}constructor(e,t,s,r){super(e,t,s,r),this._resources=null,this._optionalFields=new Array,this._instanceIndexToGraphicUid=new Map,this._hasLoadedPBRTextures=!1,this._disposeResourceHandles=new Array,this.skipHighSymbolLodsChanged=!1,this.ensureDrapedStatus(!1),this._hasLoadedPBRTextures=s.physicalBasedRenderingEnabled}async doLoad(e){if(!this._drivenProperties.size){if(z(this.symbolLayer))throw new Error}const t=this.symbolLayer.resource;if(this._isPrimitive){const s=t&&J(t.primitive)?t.primitive:E;this._resources=await this._createResourcesForPrimitive(s,e)}else this._resources=await this._createResourcesForUrl(t.href,e);this.layerOpacityChanged(),this.slicePlaneEnabledChanged(),this.physicalBasedRenderingChanged(),this.complexity=this.computeComplexity()}get extentPadding(){return null!=this._resources?this._resources.extentPadding:0}get _isPrimitive(){return!(this.symbolLayer.resource&&this.symbolLayer.resource.href)}get lodRenderer(){return null!=this._resources?this._resources.lodRenderer:null}_setMaterialTransparencyParams(e,s=t(this.symbolLayer,"material","color")){const r=this._getCombinedOpacity(s),i=r<1||this.needsDrivenTransparentPass;return e.transparent=i,e.opacity=r,e.cullFace=i?re.None:re.Back,e}async _createResourcesForPrimitive(t,s){const i=this.symbolLayer,a=C(U(t)),o=_(S(a)),n=_(T(o,i)),l=h(n),c=!1,d=!1,m={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,ambient:f,diffuse:f,hasSlicePlane:this._context.slicePlaneEnabled,hasSliceHighlight:!1,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!this.symbolLayer.isPrimitive},p=!!m.usePBR;this._setMaterialTransparencyParams(m);const u=this.symbol;if("point-3d"===u.type&&u.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=u.verticalOffset;m.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0},m.castShadows=!1}if(this._context.screenSizePerspectiveEnabled&&(m.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),this._drivenProperties.color)m.externalColor=x;else{const t=null!=i.material?i.material.color:null,s=null!=t?e.toUnitRGBA(t):x;m.externalColor=s}this._fastUpdates=X(this._context.renderer,this._fastVisualVariableConvertOptions(a,n,o,null)),m.isInstanced=!0,this._fastUpdates?(Object.assign(m,this._fastUpdates.materialParameters),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(m.hasInstancedColor=!0,this._optionalFields.push("color")),has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push("objectAndLayerIdColor");const y=new he(m),g=K(t,y);if(!g)throw new Error(`Unknown object symbol primitive: ${t}`);const b=oe(g).map((e=>({opacity:1,transparent:e.parameters.transparent}))),P=await this._createStageResources(g,p,s),R=await this._createLodRenderer(g,s);return new de(g,R,P,b,o,c,d,a,n,l,p,null)}async _createResourcesForUrl(e,s){const i={materialParamsMixin:{isInstanced:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows},streamDataRequester:this._context.streamDataRequester,cache:this._context.sharedResources.objectResourceCache};this._fastUpdates=X(this._context.renderer,this._fastVisualVariableConvertOptions(null,null,null,null)),this._fastUpdates?(Object.assign(i.materialParamsMixin,this._fastUpdates.materialParameters),this._optionalFields.push("featureAttribute")):this._hasPerInstanceColor()&&(i.materialParamsMixin.hasInstancedColor=!0,this._optionalFields.push("color")),has("enable-feature:objectAndLayerId-rendering")&&this._optionalFields.push("objectAndLayerIdColor");const a=this.symbol;if("point-3d"===a.type&&a.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:s}=a.verticalOffset;i.materialParamsMixin.verticalOffset={screenLength:r(e),minWorldLength:t||0,maxWorldLength:null!=s?s:1/0},i.materialParamsMixin.castShadows=!1}i.signal=s,i.usePBR=this._context.physicalBasedRenderingEnabled,i.skipHighLods=this._context.skipHighSymbolLods;const o=i.usePBR,n=await N(e,i),l=n.isEsriSymbolResource,c=n.isWosr,d=q(n.lods);d.levels.sort(((e,t)=>e.minScreenSpaceRadius-t.minScreenSpaceRadius));const m=this._context,p=this.symbolLayer.material,u=this._getExternalColorParameters(p),y=t(this.symbolLayer,"material","color"),f=this._getCombinedOpacity(y,{hasIntrinsicColor:!0}),g=this.needsDrivenTransparentPass,b=oe(d),P=oe(d).map((e=>({opacity:e.parameters.opacity||1,transparent:e.parameters.transparent})));b.forEach((e=>{const t=e.parameters;e.setParameters(u);const s=t.opacity*f,r=s<1||g||t.transparent;e.setParameters({opacity:s,transparent:r}),m.screenSizePerspectiveEnabled&&e.setParameters({screenSizePerspective:m.sharedResources.screenSizePerspectiveSettings})}));const x=n.referenceBoundingBox,R=_(S(x)),v=_(d.levels[0].pivotOffset),L=_(T(R,this.symbolLayer)),C=h(L),j=this._fastUpdates;Y(j,this._context.renderer,this._fastVisualVariableConvertOptions(x,L,R,v))&&b.forEach((e=>e.setParameters(j.materialParameters)));const w=await this._createStageResources(d,o,s),E=await this._createLodRenderer(d,s);return new de(d,E,w,P,R,l,c,x,L,C,o,v)}_addDisposeResource(e){this._disposeResourceHandles.push(e)}async _createStageResources(e,t,r){const i=this._context.stage,a=oe(e);t!==this._context.physicalBasedRenderingEnabled&&this.physicalBasedRenderingChanged(),i.addMany(a),this._addDisposeResource((()=>i.removeMany(a)));const o=ne(e);i.addMany(o),this._addDisposeResource((()=>i.removeMany(o))),await i.load(o,r),s(r);const n=le(e);return i.addMany(n),this._addDisposeResource((()=>i.removeMany(n))),{materials:a,textures:o,geometries:n}}async _createLodRenderer(e,t){const s=this._context.stage,r={layerUid:this._context.layer.uid,graphicUid:e=>this._instanceIndexToGraphicUid.get(e),notifyGraphicGeometryChanged:e=>this._context.notifyGraphicGeometryChanged(this._instanceIndexToGraphicUid.get(e)),notifyGraphicVisibilityChanged:e=>this._context.notifyGraphicVisibilityChanged(this._instanceIndexToGraphicUid.get(e))},i=this._fastUpdates,a=i?{applyTransform:(e,t,s)=>{e.getFeatureAttribute(t,_e),l(s,te(i.materialParameters,_e,s))},scaleFactor:(e,t,s)=>{t.getFeatureAttribute(s,_e),se(e,i.materialParameters,_e)}}:null,o=new ae({symbol:e,optionalFields:this._optionalFields,metadata:r,shaderTransformation:a},this._context.scheduler);return o.slicePlaneEnabled=this._context.slicePlaneEnabled,this._addDisposeResource((()=>{s.removeRenderPlugin(o),o.destroy()})),await s.addRenderPlugin(o.slots,o,t),o}_getExternalColorParameters(t){const s={};return this._drivenProperties.color?s.externalColor=x:null!=t&&null!=t.color?s.externalColor=e.toUnitRGBA(t.color):(s.externalColor=x,s.colorMixMode="ignore"),s}destroy(){super.destroy(),this._cleanupResources()}_cleanupResources(){this._disposeResourceHandles.forEach((e=>e())),this._disposeResourceHandles.length=0,this._resources=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;const s=$(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const r=this.setGraphicElevationContext(t,new A),i=e.renderingInfo;return this._createAs3DShape(t,s,i,r,t.uid,e.layer.uid)}notifyDestroyGraphicLayer(e){this._instanceIndexToGraphicUid.delete(e.instanceIndex)}graphicLayerToGraphicId(){return 0}layerOpacityChanged(){if(null==this._resources)return;const e=this._drivenProperties.opacity,s=!this._isPrimitive,r=this._resources.stageResources.materials,i=this._resources.originalMaterialParameters;for(let a=0;a<r.length;a++){const o=r[a],n=t(this.symbolLayer,"material","color"),l=i[a],c=this._getCombinedOpacity(n,{hasIntrinsicColor:s})*l.opacity,h=c<1||e||l.transparent;o.setParameters({opacity:c,transparent:h}),this._isPrimitive&&o.setParameters({cullFace:h?re.None:re.Back})}}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,B)}slicePlaneEnabledChanged(){if(null==this._resources)return!0;this._resources.lodRenderer.slicePlaneEnabled=this._context.slicePlaneEnabled;for(const e of this._resources.stageResources.materials)e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled});return!0}physicalBasedRenderingChanged(){if(null==this._resources)return!0;const{stageResources:e,isWosr:t}=this._resources;for(const s of e.materials)this._isPrimitive?s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}):t||s.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!1});return!1!==this._hasLoadedPBRTextures||!0!==this._context.physicalBasedRenderingEnabled||(this._hasLoadedPBRTextures=!0,!1)}applyRendererDiff(e,t){if(null==this._resources)return H.RecreateSymbol;const{stageResources:{materials:s},lodRenderer:r,resourceBoundingBox:i,symbolSize:a,resourceSize:o,pivotOffset:n}=this._resources;for(const l in e.diff){if("visualVariables"!==l)return H.RecreateSymbol;if(!Y(this._fastUpdates,t,this._fastVisualVariableConvertOptions(i,a,o,n)))return H.RecreateSymbol;for(const e of s)e.setParameters(this._fastUpdates.materialParameters);r.notifyShaderTransformationChanged()}return H.FastUpdate}computeComplexity(){if(null==this._resources)return super.computeComplexity();const e=this._resources.lodResources,t=ce(e.levels[0]).reduce(((e,t)=>e+t.indices.get(ie.POSITION).length),0)/3,s=e=>Array.from(e.vertexAttributes.values()).reduce(((e,t)=>e+i(t.data)),0)+Array.from(e.indices.values()).reduce(((e,t)=>e+i(t)),0),r=ne(e).reduce(((e,t)=>e+(t.params.encoding&&"image/ktx2"===t.params.encoding?t.estimatedTexMemRequired:t.estimatedTexMemRequired/4)),0)+le(e).reduce(((e,t)=>e+s(t)),0);return{primitivesPerFeature:t,primitivesPerCoordinate:0,drawCallsPerFeature:0,estimated:!1,memory:{...Q(this.symbol,this.symbolLayer),resourceBytes:r}}}_hasLodRenderer(){return null!=this._resources}_createAs3DShape(e,t,s,r,i,a){if(!this._hasLodRenderer()||null==this._resources)return null;const o=this.getFastUpdateAttrValues(e),n=null==this._fastUpdates&&this._hasPerInstanceColor()?F(s.color,s.opacity):null,l=this._context.clippingExtent;if(v(t,pe,this._context.elevationProvider.spatialReference),null!=l&&!j(l,pe))return null;const c=this._requiresTerrainElevation(r),h=this._computeGlobalTransform(t,r,ye,fe),d=this._computeLocalTransform(this._resources,this.symbolLayer,s,ue),m=this._resources.lodRenderer.instanceData,p=m.addInstance();this._instanceIndexToGraphicUid.set(p,i),m.setLocalTransform(p,d,!1),m.setGlobalTransform(p,h),o&&m.setFeatureAttribute(p,o),n&&m.setColor(p,n),null!=this._context.stage.renderView.objectAndLayerIdRenderHelper&&m.setObjectAndLayerIdColor(p,this._context.stage.renderView.objectAndLayerIdRenderHelper.getObjectAndLayerIdColor({graphicUid:i,layerUid:a}));const u=new D(this,p,I,r);return c&&(u.alignedSampledElevation=fe.sampledElevation),u.needsElevationUpdates=B(r.mode),Z(u,t,this._context.elevationProvider),u}_computeGlobalTransform(e,t,s,r){return O(e,this._context.elevationProvider,t,this._context.renderCoordsHelper,r),pe[0]=e.x,pe[1]=e.y,pe[2]=r.z,L(e.spatialReference,pe,s,this._context.renderCoordsHelper.spatialReference),s}_computeLocalTransform(e,t,s,r){return a(r),this._applyObjectRotation(s,!1,r),this._applyObjectRotation(t,!0,r),this._applyObjectScale(e,s,r),this._applyAnchor(e,t,r),r}_applyObjectScale(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._drivenProperties.size&&t.size?t.size:e.symbolSize,i=V(r,e.symbolSize,e.resourceSize,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||o(s,s,i)}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff;this._preparePatchTransform(e,t),this._preparePatchColor(e,t)}updateGeometry(e,t){if(null==this._resources)return!0;const s=t&&$(t);if(null==s)return!1;const r=this.getGeometryElevationMode(t);return e.elevationContext.mode===r&&(this._computeGlobalTransform(s,e.elevationContext,ye,fe),this._requiresTerrainElevation(e.elevationContext)&&(e.alignedSampledElevation=fe.sampledElevation),this._resources.lodRenderer.instanceData.setGlobalTransform(e.instanceIndex,ye,!0),Z(e,s,this._context.elevationProvider),!0)}_preparePatchTransform(e,t){if(!(t.heading||t.tilt||t.roll||t.width||t.height||t.depth||t.anchor||t.anchorPosition))return;if(null==this._resources)return;const s=(e,t,s)=>(null!=e&&"complete"===e.type?e.newValue:t)??s,r=s(t.heading,this.symbolLayer.heading,0),i=s(t.tilt,this.symbolLayer.tilt,0),a=s(t.roll,this.symbolLayer.roll,0),o=s(t.width,this.symbolLayer.width,void 0),n=s(t.height,this.symbolLayer.height,void 0),l=s(t.depth,this.symbolLayer.depth,void 0),c=s(t.anchor,this.symbolLayer.anchor,void 0),h=s(t.anchorPosition,this.symbolLayer.anchorPosition,void 0);delete t.heading,delete t.tilt,delete t.roll,delete t.width,delete t.height,delete t.depth,delete t.anchor,delete t.anchorPosition;const d={heading:r,tilt:i,roll:a,anchor:c,anchorPosition:h},m=this._resources;this.loadStatus===W.LOADED&&e.symbolLayerStatePatches.push((()=>{m.symbolSize=_(T(m.resourceSize,{width:o,height:n,depth:l,isPrimitive:this.symbolLayer.isPrimitive}))})),e.graphics3DGraphicPatches.push(((e,t)=>{const s=this._computeLocalTransform(m,d,t,ue),r=e.instanceIndex;m.lodRenderer.instanceData.setLocalTransform(r,s,!0)}))}_preparePatchColor(t,s){if(!s.material||"partial"!==s.material.type)return;const r=s.material.diff;if(!r.color||"complete"!==r.color.type||null==r.color.newValue||null==r.color.oldValue)return;const i=r.color.newValue,a=null!=i?e.toUnitRGBA(i):x;delete r.color;const o=this._resources;null!=o&&t.graphics3DGraphicPatches.push((e=>{let t;this._hasPerInstanceColor()?(o.lodRenderer.instanceData.setColor(e.instanceIndex,a),t=this._setMaterialTransparencyParams({},i)):t=this._setMaterialTransparencyParams({externalColor:a},i);for(const s of o.stageResources.materials)s.setParameters(t)}))}_requiresTerrainElevation(e){return"absolute-height"!==e.mode}_applyObjectRotation(e,t,s){if(!this._fastUpdates?.requiresShaderTransformation||!t)return k(e.heading,e.tilt,e.roll,s)}_computeAnchor(e,t,s){const r=P();switch(s.anchor){case"center":m(r,w(e)),d(r,r);break;case"top":{const t=w(e);y(r,-t[0],-t[1],-e[5]);break}case"bottom":{const t=w(e);y(r,-t[0],-t[1],-e[2]);break}case"relative":{const t=w(e),i=S(e),a=s.anchorPosition,o=a?b(a.x,a.y,a.z):g;p(r,i,o),u(r,r,t),d(r,r);break}default:null!=t?d(r,t):m(r,g)}return r}_applyAnchor(e,t,s){if(this._fastUpdates?.requiresShaderTransformation)return;const r=this._computeAnchor(e.resourceBoundingBox,e.pivotOffset,t);r&&n(s,s,r)}_hasPerInstanceColor(){return this._drivenProperties.color||this._drivenProperties.opacity}_fastVisualVariableConvertOptions(e,t,s,r){const i=null!=e?_(S(e)):f,a=null!=e?this._computeAnchor(e,r,this.symbolLayer):g,o=this._context.renderCoordsHelper.unitInMeters,n=V(null!=t?t:void 0,t,s,o),l=b(this.symbolLayer.tilt||0,this.symbolLayer.roll||0,this.symbolLayer.heading||0);return new ee({size:!0,color:!0,rotation:!0,opacity:!1},i,t??f,o,a,n,l)}}const pe=P(),ue=c(),ye=c(),_e=R(),fe=new G;export{me as Graphics3DObjectSymbolLayer};
|
|
@@ -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"../../../../core/has.js";import e from"../../../../core/Error.js";import{get as t}from"../../../../core/maybe.js";import{w as i}from"../../../../chunks/mat4.js";import{I as s,c as r}from"../../../../chunks/mat4f64.js";import{s as a,b as o}from"../../../../chunks/vec2.js";import{f as n,b as l}from"../../../../chunks/vec2f64.js";import{s as h}from"../../../../chunks/vec3.js";import{d as c,c as p}from"../../../../chunks/vec3f64.js";import{projectBuffer as m}from"../../../../geometry/projection.js";import{create as f,empty as d,expandWithBuffer as u,intersectsClippingArea as y}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as _,doubleArrayFrom as b}from"../../../../geometry/support/DoubleArray.js";import{needsElevationUpdates3D as g,evaluateElevationAlignmentAtPoint as v,SampleElevationInfo as w}from"./elevationAlignmentUtils.js";import{ElevationContext as x}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as P}from"./Graphics3DObject3DGraphicLayer.js";import{PATH_NUM_CIRCLE_PROFILE_SUBDIVISIONS as j,PATH_NUM_ROUND_JOIN_SUBDIVISIONS as S,PATH_NUM_ROUND_CAP_EXTRUSION_SUBDIVISIONS as C}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as D,getAttributeValue as L}from"./Graphics3DSymbolLayer.js";import{isValidSize as V}from"./graphicUtils.js";import{ApplyRendererDiffResult as U}from"./interfaces.js";import{ConvertOptions as E,initFastSymbolUpdatesState as R,updateFastSymbolUpdatesState as k}from"../support/FastSymbolUpdates.js";import{SamplePosition as z}from"../../support/ElevationProvider.js";import{CullFaceOptions as A}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as G}from"../../webgl-engine/lib/Object3D.js";import{Path as I}from"../../webgl-engine/lib/Path.js";import{PathBuilder as O}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as B,TriangulationCapBuilder as q,NoCapBuilder as F}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as H,MiterExtruder as M}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as W,PathGeometry as N,isPathGeometry as T}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as Z,StaticPathGeometry as J}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as K}from"../../webgl-engine/lib/pathGeometryUtils.js";import{creatQuadProfile as Q,createCircleProfile as X}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as Y}from"../../webgl-engine/lib/PathVertex.js";import{DefaultMaterial as $}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as ee}from"../../webgl-engine/materials/PathMaterial.js";const te=["polyline"];class ie extends D{constructor(e,t,i,s){super(e,t,i,s),this._intrinsicSize=n(1,1),this._upVectorAlignment=W.Path,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const i=null!=this.symbolLayer.width?this.symbolLayer.width:this.symbolLayer.height,s=null!=this.symbolLayer.height?this.symbolLayer.height:i;this._vvConvertOptions=new E([1,1,1],[i,1,s],this._context.renderCoordsHelper.unitInMeters),this._vvConvertOptions.supportsOpacity=!0,this._vvConvertOptions.supportsRotation=!1,this._fastUpdates=this._context.renderer?.visualVariables?.length>0?R(this._context.renderer,this._vvConvertOptions):null;const r=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?W.World:W.Path;const n=this.symbolLayer.profile||"circle";switch(n){default:case"circle":this._profile=X(j);break;case"quad":this._profile=Q()}let h=[0,0];switch("center"!==r&&(h={left:[.5,0],right:[-.5,0],top:[0,-.5],bottom:[0,.5]}[r],this._profile.translate(h[0],h[1])),this.symbolLayer.join){case"round":this._extruder=new M(0,S);break;case"bevel":this._extruder=new M(0,1);break;case"miter":this._extruder=new M(.8*Math.PI,1);break;default:this._extruder=new H}const p=this.symbolLayer.cap||"butt";switch(p){case"none":this._startCap=new F,this._endCap=new F;break;case"butt":default:this._startCap=new q(this._profile,0),this._endCap=new q(this._profile,0,!0);break;case"square":this._startCap=new q(this._profile,-.5),this._endCap=new q(this._profile,.5,!0);break;case"round":{const e="quad"===n;this._startCap=new B({profile:this._profile,flip:!1,breakNormals:e,subdivisions:C}),this._endCap=new B({profile:this._profile,flip:!0,breakNormals:e,subdivisions:C});break}}const m=t(this.symbolLayer,"material","color"),f=this._getCombinedOpacityAndColor(m),d=c(f),u=f[3],y=u<1||this.needsDrivenTransparentPass,_={diffuse:d,ambient:d,opacity:u,transparent:y,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,cullFace:y||"none"===p?A.None:A.Back,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,i,s),!V(this._intrinsicSize[0])||!V(this._intrinsicSize[1])))throw new e("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");if(this._fastUpdates&&this._fastUpdates.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates){const e={..._,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)};this._material=new ee(e)}else _.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,this._material=new $(_);this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._context.stage.add(this._material)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,te,this.symbolLayer.type))return null;const i=this.setGraphicElevationContext(t,new x),s=e.renderingInfo;return this._createAs3DShape(t,s,i,t.uid)}layerOpacityChanged(){const e=t(this.symbolLayer,"material","color"),i=this._getCombinedOpacity(e),s=i<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:i,transparent:s})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,g)}slicePlaneEnabledChanged(){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return U.Recreate_Symbol;if(!k(this._fastUpdates,t,this._vvConvertOptions))return U.Recreate_Symbol;this._material.setParameters(this._fastUpdates.materialParameters)}return U.Fast_Update}_getVertexData(e){let t=0;const i=e.paths,s=[],r=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const c of i)t+=c.length;const n=_(3*t);let l,h=0;for(const c of i){s.push({offset:h,numVertices:c.length});for(const t of c)n[h++]=t[0],n[h++]=t[1],n[h++]=e.hasZ?t[2]:0}return null==a||r.equals(a)||m(n,r,0,n,a,0,t)?(null==a||a.equals(o)?l=b(n):(l=_(3*t),m(n,a,0,l,o,0,t)),{pathVertexDataInfos:s,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,t,a,o){const n=e.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const c=new Array,p=n.spatialReference,m=f(),_=this._context.renderCoordsHelper,b=new z(l.vertexDataES);for(const f of l.pathVertexDataInfos){const n=f.numVertices;if(n<2)continue;const g=f.offset;if(null!=this._context.clippingExtent&&(d(m),u(m,l.vertexDataES,g,n),!y(m,this._context.clippingExtent)))continue;const w=new Array,x=g+3*n;for(let e=g;e<x;e+=3){b.offset=e;const t=v(b,this._context.elevationProvider,a,_);h(ne,l.vertexDataRS[e],l.vertexDataRS[e+1],l.vertexDataRS[e+2]),_.setAltitude(ne,t),l.vertexDataRS[e]=ne[0],l.vertexDataRS[e+1]=ne[1],l.vertexDataRS[e+2]=ne[2],w.push(Y(this._upVectorAlignment))}const P=new I(w,l.vertexDataES,l.vertexDataRS,g);se(P,this._upVectorAlignment,this._context.renderCoordsHelper);const j=new O(P,this._profile,this._extruder,this._startCap,this._endCap);let S=null;if(this._fastUpdates){const t=this._fastUpdates.visualVariables,i=t.size?L(t.size.field,e):0,s=t.color?L(t.color.field,e):0,r=t.opacity?L(t.opacity.field,e):0;S=new Z(j,i,s,r)}else{const e=[this._intrinsicSize[0],this._intrinsicSize[1]];if(this._drivenProperties.size){const i=t.size;e[0]*=re(i[0],"symbol-value"===i[2]?this.symbolLayer.height||0:i[2],this.symbolLayer.width||0),e[1]*=re(i[2],"symbol-value"===i[0]?this.symbolLayer.width||0:i[0],this.symbolLayer.height||0)}let i;this._drivenProperties.color&&(i=t.color),this._drivenProperties.opacity&&null!=t.opacity&&(i=i?[i[0],i[1],i[2],t.opacity]:[1,1,1,t.opacity]);const s=new J(j);s.bake(e),i&&s.bakeVertexColors(i),S=s}const{vertexAttributes:C,indices:D}=S.createGeometryData(),V=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerUid:this._context.layer.uid}),U=new N(this._material,C,D,S,p,this._stencilWidth,V);U.transformation=i(r(),s,j.path.origin),c.push(U)}if(0===c.length)return null;const w=new G({geometries:c,layerUid:this._context.layer.uid,graphicUid:o}),x=new P(this,w,c,null,null,((e,t,i,s,r)=>oe(e,t,s,r,this._upVectorAlignment)),a);return x.alignedSampledElevation=0,x.needsElevationUpdates=g(a.mode),x}}function se(e,t,i){const{origin:s,positions:r}=e;let a=e.offset;switch(t){default:case W.World:for(const t of e.vertices)ne[0]=r[a++]+s[0],ne[1]=r[a++]+s[1],ne[2]=r[a++]+s[2],i.worldUpAtPosition(ne,ne),t.setFrameFromUpVector(ne);break;case W.Path:ne[0]=r[a]+s[0],ne[1]=r[a+1]+s[1],ne[2]=r[a+2]+s[2],i.worldUpAtPosition(ne,ne),K(e,ne)}}function re(e,t,i){switch(e){case"symbol-value":return i;case"proportional":return t;default:return e}}function ae(e,t,i,s){let r=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let p=e.offset;p<c;p+=3)h(ne,l[p],l[p+1],l[p+2]),i(ne,le),r+=le.sampledElevation,ne[0]=n[p]+a[0],ne[1]=n[p+1]+a[1],ne[2]=n[p+2]+a[2],s.setAltitude(ne,le.z),n[p]=ne[0]-a[0],n[p+1]=ne[1]-a[1],n[p+2]=ne[2]-a[2];return e.updatePathVertexInformation(),r/o.length}function oe(e,t,i,s,r){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!T(l))continue;const e=l.path,o=e.builder.path;n+=ae(o,t,i,s),r!==W.World&&se(o,r,s),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttrsUpdated(l)}return n/o.length}const ne=p(),le=new w;export{ie as Graphics3DPathSymbolLayer};
|
|
5
|
+
import"../../../../core/has.js";import e from"../../../../core/Error.js";import{get as t}from"../../../../core/maybe.js";import{w as i}from"../../../../chunks/mat4.js";import{I as s,c as r}from"../../../../chunks/mat4f64.js";import{s as a,b as o}from"../../../../chunks/vec2.js";import{f as n,b as l}from"../../../../chunks/vec2f64.js";import{s as h}from"../../../../chunks/vec3.js";import{d as c,c as p}from"../../../../chunks/vec3f64.js";import{projectBuffer as m}from"../../../../geometry/projection.js";import{create as f,empty as d,expandWithBuffer as u,intersectsClippingArea as y}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as b,doubleArrayFrom as _}from"../../../../geometry/support/DoubleArray.js";import{needsElevationUpdates3D as g,evaluateElevationAlignmentAtPoint as v,SampleElevationInfo as w}from"./elevationAlignmentUtils.js";import{ElevationContext as x}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as P}from"./Graphics3DObject3DGraphicLayer.js";import{PATH_NUM_CIRCLE_PROFILE_SUBDIVISIONS as j,PATH_NUM_ROUND_JOIN_SUBDIVISIONS as S,PATH_NUM_ROUND_CAP_EXTRUSION_SUBDIVISIONS as D}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as C}from"./Graphics3DSymbolLayer.js";import{isValidSize as L}from"./graphicUtils.js";import{ApplyRendererDiffResult as V}from"./interfaces.js";import{ConvertOptions as U,initFastSymbolUpdatesState as E,updateFastSymbolUpdatesState as k,getAttributeValue as R}from"../support/FastSymbolUpdates.js";import{SamplePosition as z}from"../../support/ElevationProvider.js";import{CullFaceOptions as A}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as G}from"../../webgl-engine/lib/Object3D.js";import{Path as I}from"../../webgl-engine/lib/Path.js";import{PathBuilder as B}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as O,TriangulationCapBuilder as q,NoCapBuilder as F}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as H,MiterExtruder as M}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as W,PathGeometry as N,isPathGeometry as T}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as Z,StaticPathGeometry as J}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as K}from"../../webgl-engine/lib/pathGeometryUtils.js";import{creatQuadProfile as Q,createCircleProfile as X}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as Y}from"../../webgl-engine/lib/PathVertex.js";import{DefaultMaterial as $}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as ee}from"../../webgl-engine/materials/PathMaterial.js";const te=["polyline"];class ie extends C{constructor(e,t,i,s){super(e,t,i,s),this._intrinsicSize=n(1,1),this._upVectorAlignment=W.Path,this._stencilWidth=.1,this.ensureDrapedStatus(!1)}async doLoad(){const i=null!=this.symbolLayer.width?this.symbolLayer.width:this.symbolLayer.height,s=null!=this.symbolLayer.height?this.symbolLayer.height:i;this._vvConvertOptions=new U({size:!0,color:!0,rotation:!1,opacity:!0},[1,1,1],[i,1,s],this._context.renderCoordsHelper.unitInMeters),this._fastUpdates=this._context.renderer?.visualVariables?.length>0?E(this._context.renderer,this._vvConvertOptions):null;const r=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?W.World:W.Path;const n=this.symbolLayer.profile||"circle";switch(n){default:case"circle":this._profile=X(j);break;case"quad":this._profile=Q()}let h=[0,0];switch("center"!==r&&(h={left:[.5,0],right:[-.5,0],top:[0,-.5],bottom:[0,.5]}[r],this._profile.translate(h[0],h[1])),this.symbolLayer.join){case"round":this._extruder=new M(0,S);break;case"bevel":this._extruder=new M(0,1);break;case"miter":this._extruder=new M(.8*Math.PI,1);break;default:this._extruder=new H}const p=this.symbolLayer.cap||"butt";switch(p){case"none":this._startCap=new F,this._endCap=new F;break;case"butt":default:this._startCap=new q(this._profile,0),this._endCap=new q(this._profile,0,!0);break;case"square":this._startCap=new q(this._profile,-.5),this._endCap=new q(this._profile,.5,!0);break;case"round":{const e="quad"===n;this._startCap=new O({profile:this._profile,flip:!1,breakNormals:e,subdivisions:D}),this._endCap=new O({profile:this._profile,flip:!0,breakNormals:e,subdivisions:D});break}}const m=t(this.symbolLayer,"material","color"),f=this._getCombinedOpacityAndColor(m),d=c(f),u=f[3],y=u<1||this.needsDrivenTransparentPass,b={diffuse:d,ambient:d,opacity:u,transparent:y,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,cullFace:y||"none"===p?A.None:A.Back,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,i,s),!L(this._intrinsicSize[0])||!L(this._intrinsicSize[1])))throw new e("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");if(this._fastUpdates&&this._fastUpdates.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates){const e={...b,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)};this._material=new ee(e)}else b.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,this._material=new $(b);this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._context.stage.add(this._material)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,te,this.symbolLayer.type))return null;const i=this.setGraphicElevationContext(t,new x),s=e.renderingInfo;return this._createAs3DShape(t,s,i,t.uid)}layerOpacityChanged(){const e=t(this.symbolLayer,"material","color"),i=this._getCombinedOpacity(e),s=i<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:i,transparent:s})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,g)}slicePlaneEnabledChanged(){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return V.RecreateSymbol;if(!k(this._fastUpdates,t,this._vvConvertOptions))return V.RecreateSymbol;this._material.setParameters(this._fastUpdates.materialParameters)}return V.FastUpdate}_getVertexData(e){let t=0;const i=e.paths,s=[],r=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const c of i)t+=c.length;const n=b(3*t);let l,h=0;for(const c of i){s.push({offset:h,numVertices:c.length});for(const t of c)n[h++]=t[0],n[h++]=t[1],n[h++]=e.hasZ?t[2]:0}return null==a||r.equals(a)||m(n,r,0,n,a,0,t)?(null==a||a.equals(o)?l=_(n):(l=b(3*t),m(n,a,0,l,o,0,t)),{pathVertexDataInfos:s,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,t,a,o){const n=e.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const c=new Array,p=n.spatialReference,m=f(),b=this._context.renderCoordsHelper,_=new z(l.vertexDataES);for(const f of l.pathVertexDataInfos){const n=f.numVertices;if(n<2)continue;const g=f.offset;if(null!=this._context.clippingExtent&&(d(m),u(m,l.vertexDataES,g,n),!y(m,this._context.clippingExtent)))continue;const w=new Array,x=g+3*n;for(let e=g;e<x;e+=3){_.offset=e;const t=v(_,this._context.elevationProvider,a,b);h(ne,l.vertexDataRS[e],l.vertexDataRS[e+1],l.vertexDataRS[e+2]),b.setAltitude(ne,t),l.vertexDataRS[e]=ne[0],l.vertexDataRS[e+1]=ne[1],l.vertexDataRS[e+2]=ne[2],w.push(Y(this._upVectorAlignment))}const P=new I(w,l.vertexDataES,l.vertexDataRS,g);se(P,this._upVectorAlignment,this._context.renderCoordsHelper);const j=new B(P,this._profile,this._extruder,this._startCap,this._endCap);let S=null;if(this._fastUpdates){const t=this._fastUpdates.visualVariables,i=R(t.size?.field,e)??0,s=R(t.color?.field,e)??0,r=R(t.opacity?.field,e)??0;S=new Z(j,i,s,r)}else{const e=[this._intrinsicSize[0],this._intrinsicSize[1]];if(this._drivenProperties.size){const i=t.size;e[0]*=re(i[0],"symbol-value"===i[2]?this.symbolLayer.height||0:i[2],this.symbolLayer.width||0),e[1]*=re(i[2],"symbol-value"===i[0]?this.symbolLayer.width||0:i[0],this.symbolLayer.height||0)}let i;this._drivenProperties.color&&(i=t.color),this._drivenProperties.opacity&&null!=t.opacity&&(i=i?[i[0],i[1],i[2],t.opacity]:[1,1,1,t.opacity]);const s=new J(j);s.bake(e),i&&s.bakeVertexColors(i),S=s}const{vertexAttributes:D,indices:C}=S.createGeometryData(),L=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerUid:this._context.layer.uid}),V=new N(this._material,D,C,S,p,this._stencilWidth,L);V.transformation=i(r(),s,j.path.origin),c.push(V)}if(0===c.length)return null;const w=new G({geometries:c,layerUid:this._context.layer.uid,graphicUid:o}),x=new P(this,w,c,null,null,((e,t,i,s,r)=>oe(e,t,s,r,this._upVectorAlignment)),a);return x.alignedSampledElevation=0,x.needsElevationUpdates=g(a.mode),x}}function se(e,t,i){const{origin:s,positions:r}=e;let a=e.offset;switch(t){default:case W.World:for(const t of e.vertices)ne[0]=r[a++]+s[0],ne[1]=r[a++]+s[1],ne[2]=r[a++]+s[2],i.worldUpAtPosition(ne,ne),t.setFrameFromUpVector(ne);break;case W.Path:ne[0]=r[a]+s[0],ne[1]=r[a+1]+s[1],ne[2]=r[a+2]+s[2],i.worldUpAtPosition(ne,ne),K(e,ne)}}function re(e,t,i){switch(e){case"symbol-value":return i;case"proportional":return t;default:return e}}function ae(e,t,i,s){let r=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let p=e.offset;p<c;p+=3)h(ne,l[p],l[p+1],l[p+2]),i(ne,le),r+=le.sampledElevation,ne[0]=n[p]+a[0],ne[1]=n[p+1]+a[1],ne[2]=n[p+2]+a[2],s.setAltitude(ne,le.z),n[p]=ne[0]-a[0],n[p+1]=ne[1]-a[1],n[p+2]=ne[2]-a[2];return e.updatePathVertexInformation(),r/o.length}function oe(e,t,i,s,r){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!T(l))continue;const e=l.path,o=e.builder.path;n+=ae(o,t,i,s),r!==W.World&&se(o,r,s),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttrsUpdated(l)}return n/o.length}const ne=p(),le=new w;export{ie as Graphics3DPathSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import{get as t}from"../../../../core/maybe.js";import{pt2px as i}from"../../../../core/screenUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{create as
|
|
5
|
+
import e from"../../../../Color.js";import{get as t}from"../../../../core/maybe.js";import{pt2px as i}from"../../../../core/screenUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{create as o,empty as n,expandWithBuffer as s,intersectsClippingArea as a,expandWithAABB as l}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as c,doubleSubArray as h}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as p,floatSubArray as u}from"../../../../geometry/support/FloatArray.js";import{SymbolUpdateType as d,elevationModeChangeUpdateType as m,needsElevationUpdates2D as _}from"./elevationAlignmentUtils.js";import{ElevationContext as y}from"./ElevationContext.js";import g from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as f}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as b}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as x}from"./graphicUtils.js";import{ApplyRendererDiffResult as v}from"./interfaces.js";import{parseCapType as O}from"./lineUtils.js";import{geometryAsPolygon as D,createColorGeometry as C,PolygonCreationDataBase as j}from"./polygonUtils.js";import{ConvertOptions as S,initFastSymbolUpdatesState as A,updateFastSymbolUpdatesState as M,getAttributeValue as P}from"../support/FastSymbolUpdates.js";import{createMaterial as U,uvElevationAligner as E}from"../support/patternUtils.js";import{createMapSpaceUVCoords as L,createMapSpaceUVCoordsDraped as G}from"../support/uvUtils.js";import{createGeometry as w}from"../../support/engineContent/line.js";import{geometryToRenderInfo as R,geometryToRenderInfoDraped as I}from"../../support/renderInfoUtils/polygon.js";import{Object3D as V}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as F}from"../../webgl-engine/lib/RenderGeometry.js";import{getStipplePatternForLinePattern as B}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as T}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as z}from"../../webgl-engine/materials/RibbonLineMaterial.js";const H=["polyline","polygon","extent"],W=new S({size:!1,color:!0,rotation:!1,opacity:!1});class N extends b{constructor(e,t,i,r){super(e,t,i,r),this._needsUV=!1,this._hasOutline=!1}async doLoad(){this._fastUpdates=A(this._context.renderer,W)}_ensureMaterials(){this._ensureFillMaterial(),this._ensureOutlineMaterial()}_ensureFillMaterial(){if(null!=this._material)return;const e=t(this.symbolLayer,"material","color"),i=this._getCombinedOpacityAndColor(e);this._material=U(this.symbolLayer,{color:i,transparent:i[3]<1||this.needsDrivenTransparentPass,polygonOffset:!1,hasVertexColors:!0,writeLinearDepth:!0,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,...this._fastUpdates?.materialParameters}),this._needsUV=this._material instanceof T,this._context.stage.add(this._material)}_ensureOutlineMaterial(){const e=this.symbolLayer.outline;if(this._outlineMaterial||!this._isValidOutline(e))return;this._hasOutline=!0;const t=t=>{const i=B(e.pattern);return new z({width:t,color:this._getOutlineColor(),hasPolygonOffset:!0,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:i,stippleScaleWithLineWidth:!0,cap:O(e.patternCap||"butt")})};this._outlineMaterial=t(i(e.size)),this._context.stage.add(this._outlineMaterial)}_isValidOutline(e){return null!=e&&null!=e.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}destroy(){super.destroy(),this._context.stage.remove(this._material),this._material=null,this._context.stage.remove(this._outlineMaterial),this._outlineMaterial=null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,H,this.symbolLayer.type))return null;const i=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t,new y);return this.ensureDrapedStatus("on-the-ground"===r.mode),this._ensureMaterials(),this.draped?this._createAsOverlay(t,i):this._createAs3DShape(t,i,r)}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return v.RecreateSymbol;if(!M(this._fastUpdates,t,W))return v.RecreateSymbol;this._material&&this._material.setParameters(this._fastUpdates.materialParameters)}return v.FastUpdate}layerOpacityChanged(){if(null!=this._material){const e=this._material.parameters.color,i=t(this.symbolLayer,"material","color"),r=this._getCombinedOpacity(i);this._material.setParameters({color:[e[0],e[1],e[2],r],transparent:r<1||this.needsDrivenTransparentPass})}if(null!=this._outlineMaterial){const e=this._outlineMaterial.parameters.color;this._outlineMaterial.setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,o=m(N.elevationModeChangeTypes,i,r);if(o!==d.UPDATE)return o;const n=_(r);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>n))}slicePlaneEnabledChanged(){if(this._material&&this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._outlineMaterial){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._outlineMaterial.setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,i){const r=D(e.geometry);if(!r)return null;const o=R(r,this._context.elevationProvider,this._context.renderCoordsHelper,i),n=new q(o,t,this._context.layer.uid,e.uid),s=n.renderData.position.length/3;if(this._needsUV&&(n.uvMapSpace=p(4*s,!0),n.boundingRect=c(9*s,!0),L(n.uvMapSpace,n.boundingRect,n.renderData.position,this._context.renderCoordsHelper)),n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAs3DShapeFill(e,n),this._hasOutline&&this._createAs3DShapeOutline(n),this._logGeometryCreationWarnings(n.renderData,r.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length)return null;const a=new V({geometries:n.outGeometries,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:e.uid}),l=new f(this,a,n.outGeometries,null,null,E,i);return l.alignedSampledElevation=n.renderData.sampledElevation,l.needsElevationUpdates=_(i.mode),l}_createAs3DShapeFill(e,t){const i=t.renderData.polygons;for(const{position:o,mapPositions:l,holeIndices:c,index:p,count:d}of i){if(null!=this._context.clippingExtent&&(n(k),s(k,l),!a(k,this._context.clippingExtent)))continue;const i=r(l,c,3);if(0===i.length)continue;const m=this._fastUpdates?.visualVariables.color,_=C({material:this._material,indices:i,mapPositions:l,attributeData:{position:o,color:m?null:t.color,colorFeature:m?P(m.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*p,4*d):null,boundingRect:this._needsUV?h(t.boundingRect,9*p,9*d):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(_)}}_createAs3DShapeOutline(e){if(!this._hasOutline)return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{mapPositions:r,position:o}=t[i];if(null!=this._context.clippingExtent&&(n(k),s(k,r),!a(k,this._context.clippingExtent)))continue;const l=w(this._outlineMaterial,{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:r,attributeData:{position:o}},e.objectAndLayerIdColor);e.outGeometries.push(l)}}_createAsOverlay(e,t){const i=D(e.geometry);if(null==i)return null;this._material.renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._outlineMaterial&&(this._outlineMaterial.renderPriority=this._renderPriority);const r=I(i,this._context.overlaySR),o=new J(r,t,this._context.layer.uid,e.uid),s=o.renderData.position.length/3;return this._needsUV&&(o.uvMapSpace=p(4*s,!0),G(o.uvMapSpace,o.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),o.outBoundingBox=n(),o.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._hasOutline&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderData,i.rings,"rings","FillSymbol3DLayer"),0===o.outGeometries.length?null:new g(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){const i=t.renderData.polygons;for(const{position:o,holeIndices:c,index:h,count:p}of i){const i=n(k);if(s(i,o),!a(i,this._context.clippingExtent))continue;const d=r(o,c,3);if(0===d.length)continue;l(t.outBoundingBox,i);const m=this._fastUpdates?.visualVariables.color,_=C({material:this._material,indices:d,attributeData:{position:o,color:m?null:t.color,colorFeature:m?P(m.field,e):null,uvMapSpace:this._needsUV?u(t.uvMapSpace,4*h,4*p):null,objectAndLayerIdColor:t.objectAndLayerIdColor}});t.outGeometries.push(new F(_,t))}}_createAsOverlayOutline(e){if(!this._hasOutline)return;const t=e.renderData.outlines;for(let i=0;i<t.length;++i){const{position:r}=t[i];if(n(k),s(k,r),!a(k,this._context.clippingExtent))continue;l(e.outBoundingBox,k);const o=w(this._outlineMaterial,{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:r}},e.objectAndLayerIdColor);e.outGeometries.push(new F(o,e))}}_getOutlineOpacity(){const e=t(this.symbolLayer,"outline","color");return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const i=t(this.symbolLayer,"outline","color"),r=this._getOutlineOpacity();return x(null!=i?e.toUnitRGB(i):null,r)}test(){return{...super.test(),createAsOverlay:(e,t)=>this._createAsOverlay(e,t),createAs3DShape:(e,t,i)=>this._createAs3DShape(e,t,i)}}}N.elevationModeChangeTypes={definedChanged:d.RECREATE,staysOnTheGround:d.NONE,onTheGroundChanged:d.RECREATE};const k=o();class q extends j{constructor(e,t,i,r){super(e,i,r),this.color=t}}class J extends j{constructor(e,t,i,r){super(e,i,r),this.color=t}}export{N as Graphics3DPolygonFillSymbolLayer};
|
|
@@ -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{forEach as e}from"../../../../core/asyncUtils.js";import{isSome as t}from"../../../../core/maybe.js";import{onAbortOrThrow as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import o from"./Graphics3DGraphic.js";import{Graphics3DObject3DGraphicLayer as a}from"./Graphics3DObject3DGraphicLayer.js";import{make as l}from"./Graphics3DSymbolLayerFactory.js";import{ApplyRendererDiffResult as n}from"./interfaces.js";import{Loadable as i,LoadStatus as y}from"./Loadable.js";import{totalSymbolComplexities as h}from"./symbolComplexity.js";class c extends i{set symbol(e){this._symbol=e,e.symbolLayers.forEach(((t,s)=>{const r=this.symbolLayers[s];null!=r&&(r.symbol=e,r.symbolLayer=t)}))}get symbol(){return this._symbol}constructor(e,t,s){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=s,this._destroyed=!1,this.symbolLayers=new Array,this.referenced=0,this._extentPadding=0}async doLoad(t){let o=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(o=this._backgroundLayers.concat(o));const a=o.length;for(;this.symbolLayers.length<o.length;)this.symbolLayers.push(null);this.symbolLayers.length=o.length;const n=[];for(let e=0;e<a;e++){const r=o.getItemAt(e);if(!1===r.enabled)continue;m.renderPriority=1-(1+e)/a,m.renderPriorityStep=1/a,m.ignoreDrivers=r._ignoreDrivers;const i=l(this.symbol,r,this._context,m),y=s(t,(()=>{this.symbolLayers[e]=null,i.destroy()}));y&&n.push(y),this.symbolLayers[e]=i}if(await e(this.symbolLayers,(async(e,t)=>{if(null!=e)try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch{this.symbolLayers[t]=null}})),n.forEach((e=>e.remove())),r(t),this.symbolLayers.length&&!this.symbolLayers.some((e=>!!e)))throw new Error}getSymbolLayerSize(e){const t=this.symbolLayers[e];return null!=t?t.getCachedSize():null}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some((e=>null!=e&&e.queryForSnapping))}createGraphics3DGraphic(e,t){const s=e.graphic,r=new Array(this.symbolLayers.length);for(let o=0;o<this.symbolLayers.length;o++){const t=this.symbolLayers[o];r[o]=null!=t?t.createGraphics3DGraphic(e):null}const a=this._context.arcade||this._context.featureExpressionInfoContext&&this._context.featureExpressionInfoContext.arcade&&this._context.featureExpressionInfoContext.arcade.modules||null;return new o(s,t||this,r,e.layer,a)}get complexity(){return h(this.symbolLayers.map((e=>null!=e?e.complexity:null)))}globalPropertyChanged(e,t){const s=this.symbolLayers.length;for(let r=0;r<s;r++){const s=this.symbolLayers[r],o=e=>{const t=e.layers[r];return t instanceof a?t:null};if(null!=s&&!s.globalPropertyChanged(e,t,o))return!1}return!0}applyRendererDiff(e,t){return this.loadStatus!==y.LOADED?n.
|
|
5
|
+
import{forEach as e}from"../../../../core/asyncUtils.js";import{isSome as t}from"../../../../core/maybe.js";import{onAbortOrThrow as s,throwIfAborted as r}from"../../../../core/promiseUtils.js";import o from"./Graphics3DGraphic.js";import{Graphics3DObject3DGraphicLayer as a}from"./Graphics3DObject3DGraphicLayer.js";import{make as l}from"./Graphics3DSymbolLayerFactory.js";import{ApplyRendererDiffResult as n}from"./interfaces.js";import{Loadable as i,LoadStatus as y}from"./Loadable.js";import{totalSymbolComplexities as h}from"./symbolComplexity.js";class c extends i{set symbol(e){this._symbol=e,e.symbolLayers.forEach(((t,s)=>{const r=this.symbolLayers[s];null!=r&&(r.symbol=e,r.symbolLayer=t)}))}get symbol(){return this._symbol}constructor(e,t,s){super(t.schedule),this._symbol=e,this._context=t,this._backgroundLayers=s,this._destroyed=!1,this.symbolLayers=new Array,this.referenced=0,this._extentPadding=0}async doLoad(t){let o=this._symbol.symbolLayers;this._extentPadding=0,this._backgroundLayers&&(o=this._backgroundLayers.concat(o));const a=o.length;for(;this.symbolLayers.length<o.length;)this.symbolLayers.push(null);this.symbolLayers.length=o.length;const n=[];for(let e=0;e<a;e++){const r=o.getItemAt(e);if(!1===r.enabled)continue;m.renderPriority=1-(1+e)/a,m.renderPriorityStep=1/a,m.ignoreDrivers=r._ignoreDrivers;const i=l(this.symbol,r,this._context,m),y=s(t,(()=>{this.symbolLayers[e]=null,i.destroy()}));y&&n.push(y),this.symbolLayers[e]=i}if(await e(this.symbolLayers,(async(e,t)=>{if(null!=e)try{await e.load(),this._extentPadding+=Math.max(this._extentPadding,e.extentPadding)}catch{this.symbolLayers[t]=null}})),n.forEach((e=>e.remove())),r(t),this.symbolLayers.length&&!this.symbolLayers.some((e=>!!e)))throw new Error}getSymbolLayerSize(e){const t=this.symbolLayers[e];return null!=t?t.getCachedSize():null}get extentPadding(){return this._extentPadding}get symbologySnappingSupported(){return this.symbolLayers.some((e=>null!=e&&e.queryForSnapping))}createGraphics3DGraphic(e,t){const s=e.graphic,r=new Array(this.symbolLayers.length);for(let o=0;o<this.symbolLayers.length;o++){const t=this.symbolLayers[o];r[o]=null!=t?t.createGraphics3DGraphic(e):null}const a=this._context.arcade||this._context.featureExpressionInfoContext&&this._context.featureExpressionInfoContext.arcade&&this._context.featureExpressionInfoContext.arcade.modules||null;return new o(s,t||this,r,e.layer,a)}get complexity(){return h(this.symbolLayers.map((e=>null!=e?e.complexity:null)))}globalPropertyChanged(e,t){const s=this.symbolLayers.length;for(let r=0;r<s;r++){const s=this.symbolLayers[r],o=e=>{const t=e.layers[r];return t instanceof a?t:null};if(null!=s&&!s.globalPropertyChanged(e,t,o))return!1}return!0}applyRendererDiff(e,t){return this.loadStatus!==y.LOADED?n.RecreateSymbol:this.symbolLayers.reduce(((s,r)=>s!==n.RecreateSymbol&&null!=r?Math.min(s,r.applyRendererDiff(e,t)):s),n.FastUpdate)}prepareSymbolPatch(e){if(this.loadStatus===y.FAILED)return;if("partial"!==e.diff.type)return;const t=e.diff.diff;if(!t.symbolLayers||"partial"!==t.symbolLayers.type)return;const s=t.symbolLayers.diff;this.symbolLayers.forEach(((t,r)=>{if(null==t)return;const o=s[r];if(o){const s={diff:o,graphics3DGraphicPatches:[],symbolLayerStatePatches:[]};t.prepareSymbolLayerPatch(s),e.symbolStatePatches.push(...s.symbolLayerStatePatches),s.graphics3DGraphicPatches.length&&e.graphics3DGraphicPatches.push(((e,t)=>{const o=e.layers[r];null!=o&&s.graphics3DGraphicPatches.forEach((e=>e(o,t)))}))}}))}updateGeometry(e,t){for(let s=0;s<this.symbolLayers.length;s++){const r=this.symbolLayers[s];if(null==r)continue;const o=e.layers[s];if(!o||!r.updateGeometry(o,t))return!1}return!0}onRemoveGraphic(e){for(let t=0;t<this.symbolLayers.length;t++){const s=this.symbolLayers[t];if(null==s)continue;const r=e.layers[t];null!=r&&s.onRemoveGraphic(r)}}getFastUpdateStatus(){let e=0,t=0,s=0;return this.symbolLayers.forEach((r=>{null!=r&&(r.loadStatus===y.LOADING?e++:r.isFastUpdatesEnabled()?s++:t++)})),{loading:e,slow:t,fast:s}}async queryForSnapping(e,s,o,a){const l=this.symbolLayers.filter(t).filter((e=>null!=e.queryForSnapping)).map((t=>t.queryForSnapping(e,s,o,a))),n=await Promise.all(l);return r(a),n.flat()}destroy(){if(this.destroyed)console.error("Graphics3DSymbol.destroy called when already destroyed!");else{super.destroy();for(const e of this.symbolLayers)null!=e&&e.destroy();this.symbolLayers.length=0,this._destroyed=!0}}get destroyed(){return this._destroyed}}const m={renderPriority:0,renderPriorityStep:1,ignoreDrivers:!1};export{c 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 e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{O as i}from"../../../../chunks/vec3f64.js";import{f as o}from"../../../../chunks/vec4f64.js";import{SymbolUpdateType as r}from"./elevationAlignmentUtils.js";import{ElevationContext as n}from"./ElevationContext.js";import{zeroContext as s}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as a}from"./graphicUtils.js";import{ApplyRendererDiffResult as l}from"./interfaces.js";import{Loadable as p}from"./Loadable.js";import{defaultSymbolLayerComplexity as
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{O as i}from"../../../../chunks/vec3f64.js";import{f as o}from"../../../../chunks/vec4f64.js";import{SymbolUpdateType as r}from"./elevationAlignmentUtils.js";import{ElevationContext as n}from"./ElevationContext.js";import{zeroContext as s}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as a}from"./graphicUtils.js";import{ApplyRendererDiffResult as l}from"./interfaces.js";import{Loadable as p}from"./Loadable.js";import{defaultSymbolLayerComplexity as d}from"./symbolComplexity.js";import{getAttributeValue as c}from"../support/FastSymbolUpdates.js";const h=t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class u extends p{constructor(e,t,i,o){super(i.schedule),this.symbol=e,this.symbolLayer=t,this._context=i,this._elevationInfoOverride=null,this._ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1},this.complexity=null,this.logger=h,this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=o.renderPriority,this._renderPriorityStep=o.renderPriorityStep,this._elevationContext=new n,this.complexity=this.computeComplexity(),this._ignoreDrivers=o.ignoreDrivers,this._ignoreDrivers||(this._drivenProperties=y(this._context.renderer)),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}_drivenPropertiesChanged(e){if(this._ignoreDrivers)return!1;const t=this._drivenProperties,i=y(e);return i.color!==t.color||i.opacity!==t.opacity||i.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||i.size!==t.size}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,i,o){const r=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${o} geometry failed to be created`;let a=null;r?!this._logGeometryValidationWarnings(t,i,o)&&n&&0===n.length&&"rings"===i&&t.length>0&&t[0].length>2&&(a=`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):a=`${s} (failed to project geometry to view spatial reference)`,a&&h.warnOncePerTick(a)}_logGeometryValidationWarnings(e,t,i){const o=`${i} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(h.warnOncePerTick(`${o} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(h.warnOncePerTick(`${o} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,i=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+i+` symbol: ${e.type}`),!1;if("point"===e.type){const t=e;if(!isFinite(t.x)||!isFinite(t.y))return h.warn("point coordinate is not a valid number, graphic skipped"),!1}return!0}_defaultElevationInfoNoZ(){return f}_defaultElevationInfoZ(){return v}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t){const i=e.geometry,o=this.getDefaultElevationInfo(i);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:o.unit,t.mode=this.getGeometryElevationMode(i,o),t.offsetMeters=this._elevationContext.meterUnitOffset??o.offset??0;const r=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;r&&(t.mode="relative-to-ground",t.offsetMeters=0);const n=r?s:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(n,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=g){let i=1;return this.draped||(i*=this._getLayerOpacity()),this._drivenProperties.opacity||(null!=e?i*=e.a:t.hasIntrinsicColor||(i=0)),i}_getCombinedOpacityAndColor(t,o=g){const r=this._getCombinedOpacity(t,o);if(this._drivenProperties.color)return a(null,r);const n=null!=t?e.toUnitRGB(t):i;return a(n,r)}_getVertexOpacityAndColor(e,t=null){const i=this._drivenProperties.color?e.color:null,o=this._drivenProperties.opacity?e.opacity:null,r=a(i,o);return null!=t&&(r[0]*=t,r[1]*=t,r[2]*=t,r[3]*=t),r}isFastUpdatesEnabled(){return null!=this._fastUpdates}computeComplexity(){return d(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,i){switch(e){case"opacity":return this.layerOpacityChanged(t,i),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,i,e)!==r.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,i);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;default:return!1}}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,t,i){let o=r.UPDATE;return e.forEach((e=>{const n=t(e);if(null!=n){const t=e.graphic;this.setGraphicElevationContext(t,n.elevationContext),n.needsElevationUpdates=i(n.elevationContext.mode)}else o=r.RECREATE})),o}applyRendererDiff(e,t){return l.RecreateSymbol}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,i=t.size?c(t.size.field,e):0,r=t.color?c(t.color.field,e):0,n=t.opacity?c(t.opacity.field,e):0;return o(i,r,n,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&h.warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>({size:this._fastUpdates?.visualVariables.size?.field??null,color:this._fastUpdates?.visualVariables.color?.field??null,opacity:this._fastUpdates?.visualVariables.opacity?.field??null,rotation:this._fastUpdates?.visualVariables.rotation?.field??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function y(e){const t={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach((e=>{switch(e.type){case"color":if(t.color=!0,e.stops)for(let i=0;i<e.stops.length;i++){const o=e.stops[i].color;o&&(t.opacity=!0,o.a<1&&(t.opacityAlwaysOpaque=!1))}break;case"opacity":t.opacity=!0,t.opacityAlwaysOpaque=!1;break;case"size":t.size=!0}})),t}const f={mode:"on-the-ground",offset:0,unit:"meters"},v={mode:"absolute-height",offset:0,unit:"meters"},g={hasIntrinsicColor:!1};export{u as Graphics3DSymbolLayer};
|