@arcgis/core 6.0.0-next.55 → 6.0.0-next.57
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/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00c227bcecc28fe278bb.js +1 -0
- package/assets/esri/core/workers/chunks/033b9fcd9833db3b6e7d.js +1 -0
- package/assets/esri/core/workers/chunks/0978e12dd6a1cbc50b80.js +1 -0
- package/assets/esri/core/workers/chunks/{88df1b8b295d3aed649f.js → 10499abb7678e95d9f05.js} +1 -1
- package/assets/esri/core/workers/chunks/{e956845255bce0910944.js → 1507297550c3cd1268e2.js} +1 -1
- package/assets/esri/core/workers/chunks/1afc8820c283ef785729.js +1 -0
- package/assets/esri/core/workers/chunks/1c0f5c42331fb6fc26cb.js +1 -0
- package/assets/esri/core/workers/chunks/1c874f86bfd0963aa3d2.js +1 -0
- package/assets/esri/core/workers/chunks/2a84c9a81ec2bed3d4e5.js +1 -0
- package/assets/esri/core/workers/chunks/2cd2fcf4a37d180d5d5c.js +1 -0
- package/assets/esri/core/workers/chunks/2f31766bc0f9d1d70c5a.js +1 -0
- package/assets/esri/core/workers/chunks/2f9adf0b809ce8797ebf.js +1 -0
- package/assets/esri/core/workers/chunks/35109db6a6be66f895f7.js +1 -0
- package/assets/esri/core/workers/chunks/373b140f92eda3857f82.js +1 -0
- package/assets/esri/core/workers/chunks/38bba952c38af5a150e7.js +1 -0
- package/assets/esri/core/workers/chunks/3982409149571a827390.js +1 -0
- package/assets/esri/core/workers/chunks/3aea09191b737dc1de70.js +1 -0
- package/assets/esri/core/workers/chunks/3d851710f7fcc27c5b60.js +2 -0
- package/assets/esri/core/workers/chunks/3e8d70039800f2395d66.js +1 -0
- package/assets/esri/core/workers/chunks/3fc4b7d0ee460fc96176.js +1 -0
- package/assets/esri/core/workers/chunks/457bd1bd37c67b61efe8.js +1 -0
- package/assets/esri/core/workers/chunks/4d8539674fc2e4fea03c.js +1 -0
- package/assets/esri/core/workers/chunks/{e61082f56c08abe54b3a.js → 5954f02c3901b28d8e73.js} +1 -1
- package/assets/esri/core/workers/chunks/5ba6007c3c49a8153256.js +1 -0
- package/assets/esri/core/workers/chunks/5bdd95eeb8f34dbf26f2.js +2 -0
- package/assets/esri/core/workers/chunks/{ced5dfb2bf46fc5eac8c.js → 5e47026c681238038955.js} +2 -2
- package/assets/esri/core/workers/chunks/{2baf35b1b19482d603b5.js → 5f7505ada0991cfbdd84.js} +1 -1
- package/assets/esri/core/workers/chunks/601d668e70c5d72fe58c.js +1 -0
- package/assets/esri/core/workers/chunks/651e33be8bb3995d749f.js +1 -0
- package/assets/esri/core/workers/chunks/{542a9c414c99d84d52ab.js → 6a202ef9ba9b89e09153.js} +1 -1
- package/assets/esri/core/workers/chunks/{0826feebdca8a31eb630.js → 6ba6fece5c11fe2a6ace.js} +1 -1
- package/assets/esri/core/workers/chunks/{5eb69e2895e5aec81051.js → 6fd10891506925560443.js} +1 -1
- package/assets/esri/core/workers/chunks/721f43554b9654481de7.js +1 -0
- package/assets/esri/core/workers/chunks/75274ac3ddf7c45f47d7.js +1 -0
- package/assets/esri/core/workers/chunks/7b6fd287e7043ad50f4e.js +1 -0
- package/assets/esri/core/workers/chunks/7baa49055bc31618b56e.js +1 -0
- package/assets/esri/core/workers/chunks/80d1267606383ae537f2.js +1 -0
- package/assets/esri/core/workers/chunks/8570e3df90fb76a8741a.js +1 -0
- package/assets/esri/core/workers/chunks/{c3c0f24a9e0047232ae1.js → 8679dfc0c53355b6feb0.js} +1 -1
- package/assets/esri/core/workers/chunks/8920d0b11951b57d6a66.js +1 -0
- package/assets/esri/core/workers/chunks/8a636dc51372e14c98f5.js +1 -0
- package/assets/esri/core/workers/chunks/{14259910f44c08fd5bbd.js → 9117c9b720c9ba6e7a6e.js} +1 -1
- package/assets/esri/core/workers/chunks/92d97e0fcc20dd5f5ac4.js +1 -0
- package/assets/esri/core/workers/chunks/9ca84fa9423654061d05.js +1 -0
- package/assets/esri/core/workers/chunks/9e372af03d62fa5ad10e.js +1 -0
- package/assets/esri/core/workers/chunks/a22458e5272332d86cb9.js +1 -0
- package/assets/esri/core/workers/chunks/{3ea480cebf8ee56228a5.js → a7dfca326883384d2751.js} +1 -1
- package/assets/esri/core/workers/chunks/{723d8316f5d4b6ce2942.js → a9539393e2f1812a973a.js} +1 -1
- package/assets/esri/core/workers/chunks/{be0b8bb4f09aae6ff5de.js → ab784764ddf9d7f693a1.js} +1 -1
- package/assets/esri/core/workers/chunks/b10c534cbe311d17b7d5.js +1 -0
- package/assets/esri/core/workers/chunks/b38b6fe08a367e9de4f5.js +1 -0
- package/assets/esri/core/workers/chunks/{4e651869e9a196494694.js → b6e628b5d2643af4c19b.js} +1 -1
- package/assets/esri/core/workers/chunks/{b37ab6b1cb4cfc85cd9d.js → b7828d7e2c5b75644057.js} +1 -1
- package/assets/esri/core/workers/chunks/{ec465abb0344ad719e9d.js → bd8e329ec74d921d311a.js} +1 -1
- package/assets/esri/core/workers/chunks/{9e508f930086d2ef5f22.js → be0133fa63c5d6545a7f.js} +40 -41
- package/assets/esri/core/workers/chunks/{56e6e70aa40e51827290.js → c3f94024c6c9eed9f273.js} +1 -1
- package/assets/esri/core/workers/chunks/{6d17b45022dfd2548098.js → c5ddf8b347c31fe772a3.js} +1 -1
- package/assets/esri/core/workers/chunks/{ee9af58ae202b803bba7.js → c7a0c4ca37ebd1d98cf1.js} +1 -1
- package/assets/esri/core/workers/chunks/cb0e3614b78c78040662.js +1 -0
- package/assets/esri/core/workers/chunks/d22e3b5d836dffdf91cc.js +1 -0
- package/assets/esri/core/workers/chunks/d7763c42754152510e13.js +2 -0
- package/assets/esri/core/workers/chunks/e0341def2d81e679a200.js +1 -0
- package/assets/esri/core/workers/chunks/e42e9dd3c933f5f864ab.js +1 -0
- package/assets/esri/core/workers/chunks/e566102c7ed7a8ebf89e.js +1 -0
- package/assets/esri/core/workers/chunks/e74586b074d0fa6abb4b.js +1 -0
- package/assets/esri/core/workers/chunks/e7dff025780726d5feae.js +1 -0
- package/assets/esri/core/workers/chunks/e96fa029acba59c04e4e.js +2 -0
- package/assets/esri/core/workers/chunks/f4fcf87da4495584223d.js +1 -0
- package/assets/esri/core/workers/chunks/f989588dfdbb69056491.js +1 -0
- package/assets/esri/core/workers/chunks/fc5b920f9756e11c2f88.js +1 -0
- package/assets/esri/core/workers/chunks/fdfbd201be372d3796bf.js +2 -0
- package/assets/esri/core/workers/chunks/ff0a0819bba5e8264c47.js +1 -0
- package/chunks/BlendLayers.glsl.js +1 -1
- package/chunks/ColorMaterial.glsl.js +14 -14
- package/chunks/Component.glsl.js +38 -37
- package/chunks/DefaultMaterial.glsl.js +15 -15
- package/chunks/GlobalIllumination.glsl.js +12 -11
- package/chunks/GlobalIlluminationBlur.glsl.js +6 -4
- package/chunks/HUDMaterial.glsl.js +3 -3
- package/chunks/Path.glsl.js +15 -15
- package/chunks/Pattern.glsl.js +20 -20
- package/chunks/RasterColorizer.glsl.js +1 -1
- package/chunks/ShadowHighlight.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +28 -27
- package/chunks/Water.glsl.js +30 -20
- package/chunks/pdf.js +57 -0
- package/config.js +1 -1
- package/core/accessorSupport/write.js +1 -1
- package/core/memoryEstimations.js +1 -1
- package/core/scheduling.js +1 -1
- package/interfaces.d.ts +0 -1
- package/kernel.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -56
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/geospatialPDF/parserUtils.js +2 -0
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/dehydratedFeatures.js +1 -1
- package/layers/graphics/transferFeatures.js +1 -1
- package/layers/support/ControlPoint.js +1 -1
- package/layers/support/ControlPointsGeoreference.js +1 -1
- package/layers/support/commonProperties.js +1 -1
- package/layers/support/fieldUtils.d.ts +129 -57
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/geospatialPDFUtils.d.ts +63 -0
- package/layers/support/geospatialPDFUtils.js +2 -0
- package/networks/Network.js +1 -1
- package/networks/support/TopologyValidationJobInfo.js +1 -1
- package/package.json +5 -5
- package/symbols/CIMSymbol.d.ts +9 -9
- package/symbols/PathSymbol3DLayer.d.ts +1 -1
- package/symbols/WaterSymbol3DLayer.d.ts +13 -1
- package/symbols/WaterSymbol3DLayer.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedObserverManipulatedObject3D.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/camera/intersectionUtils.js +1 -1
- package/views/3d/environment/EnvironmentView.js +1 -1
- package/views/3d/input/handlers/ground/GroundNavigation.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/Manipulator3DBase.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
- package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
- package/views/3d/layers/DrapedSubView3D.js +1 -1
- package/views/3d/layers/DynamicLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/support/Tiles3DBVH.js +1 -1
- package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
- package/views/3d/layers/support/createTileBVHForLayer.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/state/utils/groundNavigationUtils.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/GroundAndIMSurface.js +1 -1
- package/views/3d/support/QualityProfile.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/terrain/BlendLayersTechniqueConfiguration.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/RasterColorizerTechniqueConfiguration.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectFixedBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/clampShadowPosition.glsl.js +2 -0
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +14 -14
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/lastFrameUniforms.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +15 -12
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +2 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/globalIlluminationUniforms.js +1 -1
- package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/BufferObject3D.js +1 -1
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
- package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
- package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/getWaterColor.glsl.js +89 -0
- package/views/3d/webgl-engine/parts/Model.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/Attribution.js +5 -5
- package/views/DOMContainer.d.ts +2 -1
- package/views/SceneView.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/support/surfaceCoordinateSystems.js +1 -1
- package/views/webgl/Program.js +3 -3
- package/views/webgl/ShaderBuilder.js +23 -23
- package/webscene/Slide.js +1 -1
- package/webscene/VirtualLighting.d.ts +2 -4
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +17 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.d.ts +7 -0
- package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Weather/WeatherViewModel.js +1 -1
- package/widgets/support/ContingentValuesManager.js +1 -1
- package/widgets/support/forms/types.d.ts +23 -1
- package/assets/esri/core/workers/chunks/144f18a3dd2c8cf07cf7.js +0 -1
- package/assets/esri/core/workers/chunks/193a73a2c7f4f8482c21.js +0 -1
- package/assets/esri/core/workers/chunks/20acb6f3ed5140b6c6c6.js +0 -1
- package/assets/esri/core/workers/chunks/23fc1c1ed483ed3b2298.js +0 -1
- package/assets/esri/core/workers/chunks/249a687ce1b6d0815242.js +0 -1
- package/assets/esri/core/workers/chunks/2634927d26cb1139c6d0.js +0 -1
- package/assets/esri/core/workers/chunks/2d1b8154ee40afc9d40b.js +0 -1
- package/assets/esri/core/workers/chunks/2d4788be418a4e5f6606.js +0 -1
- package/assets/esri/core/workers/chunks/333140b18aeb5a50b654.js +0 -1
- package/assets/esri/core/workers/chunks/4401b3f8ebb658abe789.js +0 -1
- package/assets/esri/core/workers/chunks/4761cd436abceee858bf.js +0 -1
- package/assets/esri/core/workers/chunks/4a41bf3d1e2e9bb79771.js +0 -2
- package/assets/esri/core/workers/chunks/4de08ead94660025075b.js +0 -1
- package/assets/esri/core/workers/chunks/56f227e1a9e51d1fd742.js +0 -1
- package/assets/esri/core/workers/chunks/5bd451c7db17ee8f0315.js +0 -1
- package/assets/esri/core/workers/chunks/5c34d49a6c9cc34b7626.js +0 -1
- package/assets/esri/core/workers/chunks/5f324d88785ffcb73ae0.js +0 -1
- package/assets/esri/core/workers/chunks/703373f529c1c334cfad.js +0 -1
- package/assets/esri/core/workers/chunks/70695e0fb53018d48e7b.js +0 -2
- package/assets/esri/core/workers/chunks/723c9ad4c25be2b82476.js +0 -1
- package/assets/esri/core/workers/chunks/733c32d8091427d84de7.js +0 -1
- package/assets/esri/core/workers/chunks/766a1357be2ed7f4e125.js +0 -1
- package/assets/esri/core/workers/chunks/844c593754b2692257f4.js +0 -1
- package/assets/esri/core/workers/chunks/846248697c398468d8e6.js +0 -1
- package/assets/esri/core/workers/chunks/860552f49f17de2f3353.js +0 -1
- package/assets/esri/core/workers/chunks/89e55895683369b5277a.js +0 -1
- package/assets/esri/core/workers/chunks/8c94e987754b3919181e.js +0 -1
- package/assets/esri/core/workers/chunks/919115788da38049aea7.js +0 -2
- package/assets/esri/core/workers/chunks/976303f47c342b9d1cc0.js +0 -1
- package/assets/esri/core/workers/chunks/9b727f45dfea84357b57.js +0 -1
- package/assets/esri/core/workers/chunks/a05a2c2aaf0c288f9681.js +0 -1
- package/assets/esri/core/workers/chunks/a116dd204921e7464944.js +0 -1
- package/assets/esri/core/workers/chunks/ab76170c374fd67ce8cd.js +0 -1
- package/assets/esri/core/workers/chunks/aebd12488b4004e207a3.js +0 -1
- package/assets/esri/core/workers/chunks/b33e7e74cf8fa3926617.js +0 -1
- package/assets/esri/core/workers/chunks/bb2af16e55cb39163827.js +0 -1
- package/assets/esri/core/workers/chunks/c7b1c6d57603fa385c54.js +0 -1
- package/assets/esri/core/workers/chunks/cd8181600623e18f511c.js +0 -1
- package/assets/esri/core/workers/chunks/cef537fa9705dd1cf685.js +0 -1
- package/assets/esri/core/workers/chunks/d33403d578fbeecaf844.js +0 -1
- package/assets/esri/core/workers/chunks/d5bb9f9b7b341c671525.js +0 -1
- package/assets/esri/core/workers/chunks/d96e63d66f7b1f4ea54a.js +0 -2
- package/assets/esri/core/workers/chunks/ddbfa664e69612295785.js +0 -1
- package/assets/esri/core/workers/chunks/ded81c504bf44806ca7d.js +0 -1
- package/assets/esri/core/workers/chunks/e0466387b2ab54d706ca.js +0 -1
- package/assets/esri/core/workers/chunks/e3bcd2e356f75afc316a.js +0 -1
- package/assets/esri/core/workers/chunks/e80526571f1a34de3278.js +0 -1
- package/assets/esri/core/workers/chunks/ea71850ba87ae6038000.js +0 -1
- package/assets/esri/core/workers/chunks/ee70be138831cc2a0f56.js +0 -1
- package/assets/esri/core/workers/chunks/f23c4fd014126ea7abc6.js +0 -1
- package/assets/esri/core/workers/chunks/f537a5e808dc546813c7.js +0 -1
- package/assets/esri/core/workers/chunks/f6e40f3faf0c80cf1b3a.js +0 -1
- package/assets/esri/core/workers/chunks/fe811d651d201f698b8f.js +0 -2
- package/chunks/NativeLine.glsl.js +0 -8
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +0 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +0 -70
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +0 -2
- package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/NativeLineTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/NativeLineTechniqueConfiguration.js +0 -2
- /package/assets/esri/core/workers/chunks/{919115788da38049aea7.js.LICENSE.txt → 3d851710f7fcc27c5b60.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{fe811d651d201f698b8f.js.LICENSE.txt → 5bdd95eeb8f34dbf26f2.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ced5dfb2bf46fc5eac8c.js.LICENSE.txt → 5e47026c681238038955.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{4a41bf3d1e2e9bb79771.js.LICENSE.txt → d7763c42754152510e13.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{d96e63d66f7b1f4ea54a.js.LICENSE.txt → e96fa029acba59c04e4e.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{70695e0fb53018d48e7b.js.LICENSE.txt → fdfbd201be372d3796bf.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import"../../../core/has.js";import{set as r}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as i,create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{estimateNumberArrayMemory as c}from"../../../core/memoryEstimations.js";import{throwIfAborted as l}from"../../../core/promiseUtils.js";import{initial as u,watch as d,sync as f,on as p}from"../../../core/reactiveUtils.js";import{generateUID as m}from"../../../core/uid.js";import{projectBuffer as h}from"../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as g}from"../../../geometry/projection/projectVectorToVector.js";import{extentContainsCoords3D as ee,extentContainsCoords2D as te}from"../../../geometry/support/contains.js";import{newDoubleArray as _,doubleArrayFrom as ne}from"../../../geometry/support/DoubleArray.js";import{isInEffectiveScaleRange as re}from"../../../geometry/support/scaleUtils.js";import{getGeometryZScaler as ie}from"../../../geometry/support/zscale.js";import ae from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{estimateSize as v}from"../../../layers/graphics/dehydratedFeatures.js";import{ImmutableDehydratedPoint as oe}from"../../../layers/graphics/dehydratedPoint.js";import{hydrateGraphic as se}from"../../../layers/graphics/hydratedFeatures.js";import{fallbackObjectIDAttribute as y}from"../../../layers/LayerConstants.js";import b from"../../../layers/support/FeatureFilter.js";import{RequiredFieldsCollector as x}from"../../../layers/support/FieldCollector.js";import{I3SExtractChanges as ce}from"../../../layers/support/I3SExtractChanges.js";import S from"../../../rest/support/Query.js";import{isBasemapLayerView as le}from"../../../support/basemapUtils.js";import{isGraphic as ue}from"../../../support/graphicInstanceUtils.js";import C from"../../layers/SceneLayerView.js";import{hasPopupTemplate as w}from"../../layers/support/popupUtils.js";import{getHighlightName as T}from"../../support/highlightOptionsUtils.js";import{hasLayerBasedScaleVisibility as E}from"../../support/layerViewUtils.js";import{TaskPriority as D}from"../../support/Scheduler.js";import{debugFlags as O}from"../support/debugFlags.js";import{compute as k}from"../support/orientedBoundingBox.js";import{updatingProgress as A}from"../support/updatingProperties.js";import{Vertices as j}from"../webgl-engine/lib/Attribute.js";import{Graphics3DFeatureProcessor as M}from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as N}from"./graphics/QueryEngine.js";import{QueryEngineContext as P}from"./graphics/QueryEngineContext.js";import{createInteractiveEditSession as F,normalizeEditResultsEvent as I,processAttributeEdits as L}from"./i3s/featureEditing.js";import{getCachedAttributeValue as R}from"./i3s/I3SBinaryReader.js";import{I3SGraphicsMap as z}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as B}from"./i3s/I3SOverrides.js";import{checkRecyclable as V,checkSpatialReferences as H,containsDraco as U,whenGraphicAttributes as de}from"./i3s/I3SUtil.js";import{I3SPointsWorkerHandle as W}from"./I3SPointsWorkerHandle.js";import{LayerView3D as fe}from"./LayerView3D.js";import{attributeLookup as G}from"./support/attributeUtils.js";import{createFeatureFilterHighlight as pe}from"./support/createFeatureFilterHighlight.js";import{DefinitionExpressionSceneLayerView as me}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as he}from"./support/fieldProperties.js";import{isFeatureFilter as ge,emptyHighlightHandle as K,normalizeHighlightTarget as _e,isObjectId as ve}from"./support/highlightUtils.js";import{LayerViewPerformanceInfo as ye}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as be}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as xe}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as Se}from"./support/TemporalSceneLayerView.js";const q=he();class Ce{constructor(e,t,n,r){this.graphics=e,this.featureIds=t,this.attributeInfo=n,this.node=r}get usedMemory(){return this.graphics.reduce((e,t)=>v(t)+e,c(this.featureIds)+1024)}}let J=class extends Se(me(be(fe(C)))){constructor(){super(...arguments),this.type=`scene-layer-graphics-3d`,this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this._pendingEditsQueue=Promise.resolve(),this.loadedGraphics=new z((e,t,n)=>Ee(e,t,n),e=>this.processor.graphicsCore.recreateGraphics(e),this.logError),this.holeFilling=`always`,this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}tryRecycleWith(e,t){return e.url!==this.layer.url||!this._i3sOverrides.isEmpty?null:e.load(t).then(()=>{l(t),V(this.layer,e,this._i3sOverrides),this.layer=e,this._reinitializeOverrides(),s(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()})}initialize(){this.addResolvingPromise(this.layer.indexInfo),this._reinitializeOverrides(),H(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new xe({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,e=>this._rangeInfosChanged(e),u),this._updatingHandles.add(()=>this.layer.renderer,(e,t)=>this._rendererChange(e,t)),this._updatingHandles.add(()=>[this.parsedDefinitionExpression,this.layer.excludeObjectIds],()=>this._filterChange()),this._set(`processor`,new M({owner:this,preferredUpdatePolicy:0,scaleVisibilityEnabled:!E(),filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:this.layer.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on(`invalidate-elevation`,({extent:e,spatialReference:t})=>this._controller.updateElevationChanged(e,t)),this.supportsHeightUnitConversion&&(this._verticalScale=ie(`point`,this.layer.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.when()),this._memCache=this.view.resourceController.memoryController.newCache(`psl-${this.uid}`),this._controller=new ae({layerView:this}),U(this.layer.geometryDefinitions)&&(this._workerHandle=new W(e=>this.view.resourceController.immediate.schedule(e))),this.addHandles(this.layer.on(`apply-edits`,e=>this._updatingHandles.addPromise(e.result))),this.addHandles([this.layer.on(`edits`,e=>{let t=this._pendingEditsQueue.then(()=>this._handleEdits(e)).then();this._pendingEditsQueue=t,this._updatingHandles.consumePromise(t)}),d(()=>O.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){let e=this._controller.crsIndex;import(`./support/I3STreeDebugger.js`).then(({I3STreeDebugger:t})=>{!this._treeDebugger&&O.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else!e&&this._treeDebugger&&!O.I3S_TREE_SHOW_TILES&&(this._treeDebugger.destroy(),this._treeDebugger=null)},u)]),this.when(()=>{this._setupQueryEngine(),this._updatingHandles.add(()=>this.availableFields,()=>this._queryEngine?.clear(),f),this._updatingHandles.add(()=>this.maximumNumberOfFeatures,e=>this._controller.featureTarget=e,u),this._updatingHandles.add(()=>this.suspended,e=>{e&&this._removeAllNodeData()})}).catch(()=>{})}_reinitializeOverrides(){this._i3sOverrides?.destroy(),this._extractChanges?.destroy();let{layer:e}=this,t=this.view.resourceController?.memoryController;this._extractChanges=new ce({layer:e}),this._i3sOverrides=new B({view:this.view,layer:e,memoryController:t,extractChanges:this._extractChanges})}destroy(){this._treeDebugger=s(this._treeDebugger),this._i3sOverrides=s(this._i3sOverrides),this._extractChanges=s(this._extractChanges),this._set(`processor`,s(this.processor)),this._controller=s(this._controller),this._queryEngine=s(this._queryEngine),this._workerHandle=s(this._workerHandle),this._memCache=s(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=s(this._fieldsHelper)}get layerViewUid(){return this.uid}get updatingProgressValue(){return this._controller?.updatingProgress??1}get visibleAtCurrentScale(){return E()?re(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){return this.processor?.graphicsCore?.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e==null?(this._clearOverride(`maximumNumberOfFeatures`),this._controller.fixedFeatureTarget=!1):(this._override(`maximumNumberOfFeatures`,e),this._controller.fixedFeatureTarget=!0)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached}get _excludeObjectIds(){return new Set(this.layer.excludeObjectIds)}get lodFactor(){return this.layer.semantic===`Labels`?1:this.view.qualitySettings.sceneService.pointLoDFactor}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){return!this.suspended&&!!this._controller?.rootNodeVisible}get legendEnabled(){return this.contentVisible&&this.layer?.legendEnabled===!0}get _graphicOrigin(){return this.layer.graphicOrigin}async whenGraphicAttributes(e,t){return de(this.layer,e,this._getObjectIdField(),t,()=>[...this.loadedGraphics.nodes()])}getHit(e){if(!this.loadedGraphics)return null;let t=se(this.loadedGraphics.find(t=>t.uid===e),this.layer,this._graphicOrigin),n=this._getObjectIdField();return t?.attributes?.[n]==null?null:{type:`graphic`,graphic:t,layer:t.layer}}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e,t){let n=T(t),r=this.layer.objectIdField;if(ge(e)){let t=this.processor.graphicsCore.objectStates;if(!t)return K;let i=this._registerHighlightFilter(e),{set:a,handle:o}=t.acquireHighlightSet(n,r);return pe({owner:this,handles:[i,o],filter:e,layer:this.layer,scheduler:this.view.resourceController.scheduler,updatingHandles:this._updatingHandles,getAvailableFields:()=>this.availableFields,query:t=>this._queryEngine.executeQueryForIdSet(e,null,t),apply:e=>t.updateObjectIds(a,e),onChange:e=>p(()=>this.processor.featureStore.events,`changed`,e)})}let i=_e(e);if(i.length===0)return K;if(ue(i[0])){let e=i;if(G(this.layer.fieldsIndex,e[0].attributes,r)!=null){let t=e.map(e=>G(this.layer.fieldsIndex,e.attributes,r));return this.processor.highlightByObjectIds(t,r,n)}return this.processor.highlightByGraphics(e,n)}return ve(i[0])?this.processor.highlightByObjectIds(i,r,n):K}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return F(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){let n={geometryBuffer:e.geometryBuffer};this._workerHandle??=new W(e=>this.view.resourceController.immediate.schedule(e));let r=await this._workerHandle.invoke(n,t);if(r==null)throw Error(`Failed to decompress Draco point data`);return{positionData:r.positions,featureIds:r.featureIds}}async addNode(e,t,n){if(!Y(t)&&!Te(t))throw Error();if(this.loadedGraphics.hasNode(e.index)){o.getLogger(this).error(`I3S node `+e.id+` already added`);return}let r=this.layer.fullExtent==null?null:De(this.layer.fullExtent.clone(),.5),{featureIds:i,pointPositions:a}=Y(t)?await this._extractBinaryPointPositions(e,t,n):this._extractLegacyPointPositions(t),s=[];this._validatePositions(e,i,a,r,s);let c=this._controller.crsVertex,l=this.view.spatialReference;h(a,c,0,a,l,0,i.length);let u=Y(t)?e.level:0,d=this._createGraphics(i,a,e.index,u),f=new Ce(d,i,t.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(f.featureIds,t.attributeDataInfo,n),e.numFeatures=f.graphics.length,this._updateNodeMemory(e),X(f),s.length>0&&(this._computeObb(e,s,c),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e)){this._cacheNodeData(f);return}if(this._verticalScale!=null)for(let e of f.graphics)this._verticalScale(e.geometry);let p=this.view.stage.renderView.olidRenderHelper;if(p){let e=le(this.view,this.uid);for(let t=0;t<f.featureIds.length;t++){let n=f.featureIds[t];p.setUidToObjectAndLayerId(n,f.graphics[t].uid,this.layer.id,this.uid,this.layer.popupEnabled&&!e&&w(this.layer,this.view.popup?.defaultPopupTemplateEnabled),f.node.resources.attributes,t)}}this.loadedGraphics.addNode(e.index,f),this._controller.updateLoadStatus(e.index,!0),this._filterNode(f),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,n){let r=this._controller.crsIndex,i=r.isGeographic?this.view.renderSpatialReference:r;h(t,n,0,t,i,0),e.serviceObbInIndexSR=k(new j(t,3)),r.isGeographic&&(g(e.serviceObbInIndexSR.getCenter(Z),i,Z,r),e.serviceObbInIndexSR.setCenter(Z))}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}getNodeComponentHandle(){}async _extractBinaryPointPositions(e,t,n){let r=await this._decompressBinaryPointData(t,n),a=r.positionData,o=a.length/3,s=_(o*3),c=e.serviceObbInIndexSR==null?i:e.serviceObbInIndexSR.getCenter(ke),l=Math.abs(c[2])*2**-20;for(let e=0;e<o;e++){let t=e*3;s[t]=a[t]+c[0],s[t+1]=a[t+1]+c[1],s[t+2]=a[t+2]+c[2],Math.abs(s[t+2])<l&&(s[t+2]=0)}return{featureIds:r.featureIds?ne(r.featureIds):[],pointPositions:s}}_extractLegacyPointPositions(e){let t=e.pointData.length,n=_(3*t),r=[];for(let i=0;i<t;i++){let t=e.pointData[i],a=t.featureDataPosition,o=a.length,s=t.geometries?.[0]??Oe[o],c=t.featureIds[0];if(s.type!==`Embedded`||s.params.type!==`points`||o<2||o>3)continue;let l=s.params.vertexAttributes?.position??[0,0,0],u=r.length*3;n[u]=a[0]+l[0],n[u+1]=a[1]+l[1],n[u+2]=o===3?a[2]+l[2]:NaN,r.push(c)}return{featureIds:r,pointPositions:n}}_validatePositions(e,t,n,i,a){if(i==null&&e.serviceObbInIndexSR)return;let s=t.length;for(let t=0;t<s;t++){let s=t*3;r(Z,n[s],n[s+1],n[s+2]);let c=!Number.isNaN(n[2]);i!=null&&(c?!ee(i,Z):!te(i,Z))&&(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&o.getLogger(this).error(`Service Error: Coordinates outside of layer extent`),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&o.getLogger(this).error(`Maximum number of errors reached. Further errors are ignored.`),this._coordinatesOutsideExtentErrors++),e.serviceObbInIndexSR||a.push(Z[0],Z[1],Z[2])}}_createGraphics(e,t,n,r){let i=e.length,a=this._getObjectIdField(),o=this.processor.graphicsCore,s=[],c=this.view.spatialReference;for(let l=0;l<i;l++){let i=e[l],u={};i!=null&&(u[a]=i);let d=i??m(),f=l*3,p=isNaN(t[f+2])?void 0:t[f+2],h=new oe(c,t[f],t[f+1],p),g=this.loadedGraphics.get(d);if(g!=null)(g.level==null||g.level<r)&&(Q.property=`geometry`,Q.graphic=g,Q.oldValue=g.geometry,Q.newValue=h,g.geometry=h,g.level=r,o.graphicUpdateHandler(Q),$()),s.push(g);else{let e=m();s.push({objectId:d,uid:e,geometry:h,attributes:u,visible:!0,nodeIndex:n,level:r})}}return s}_updateNodeMemory(e){e.memory=4096+(e.numFeatures??0)*this.processor.graphicsCore.usedMemoryPerGraphic}_cacheNodeData(e){this._memCache.put(this._getMemCacheKey(e.node),e)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode((e,t)=>{if(e){let t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)}),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){let t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){let t=this.loadedGraphics.getNode(e);return t==null?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){return this._memCache?.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,n,r){this.loadedGraphics.hasNode(e.index)?o.getLogger(this).error(`I3S node `+e.id+` already added`):(await this._i3sOverrides.applyAttributeOverrides(t.featureIds,n,r),t.attributeInfo=n,this.loadedGraphics.addNode(e.index,t),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),X(t),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){let e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node.id)),e.sort()}getVisibleNodes(){let e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node)),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode((t,n)=>e.push(n))}getLoadedAttributes(e){let t=this.loadedGraphics.getNode(e);if(t?.attributeInfo!=null)return t.attributeInfo.loadedAttributes}getAttributeData(e){let t=this.loadedGraphics.getNode(e);if(t?.attributeInfo!=null)return t.attributeInfo.attributeData}_setAttributeData(e,t){let n=this.loadedGraphics.getNode(e);n?.attributeInfo!=null&&(n.attributeInfo.attributeData=t,this._attributeValuesChanged(n))}async updateAttributes(e,t,n){let r=this.loadedGraphics.getNode(e);r!=null&&(await this._i3sOverrides.applyAttributeOverrides(r.featureIds,t,n),l(n),r.attributeInfo=t,this._attributeValuesChanged(r))}_attributeValuesChanged(e){X(e),this._filterNode(e);let{processor:t}=this,{graphicsCore:n}=t;if(n.labelsEnabled){let t=e.node.index,r=[];e.graphics.forEach(e=>e.nodeIndex===t&&r.push(e.uid)),n.updateLabelingInfo(r)}t.refreshFilter(),n.featureStore.events.emit(`changed`)}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||y}_getGlobalIdField(){return this.layer.globalIdField}async _rendererChange(e,t){let{layer:{fieldsIndex:n}}=this,r=new Set,i=new x(r,n),a;e?(await e.collectRequiredFields(i),a=Array.from(r).sort()):a=[],r.clear();let o;t?(await t.collectRequiredFields(i),o=Array.from(r).sort()):o=[],a.length===o.length&&a.every((e,t)=>a[t]===o[t])||this._reloadAllNodes()}_rangeInfosChanged(e){e!=null&&e.length>0&&o.getLogger(this).warn(`Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.`)}_filterChange(){this.loadedGraphics.forEachNode(e=>this._filterNode(e))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){let t=this.parsedDefinitionExpression,n=this._excludeObjectIds,r=this._getObjectIdField();for(let i of e.graphics){let e=i.visible,a=this._evaluateClause(t,i),o=!n.has(i.attributes[r]);i.visible=a&&o,e!==i.visible&&(Q.graphic=i,Q.property=`visible`,Q.oldValue=e,Q.newValue=i.visible,this.processor.graphicsCore.graphicUpdateHandler(Q),$())}}createQuery(){let e={outFields:[`*`],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return this.filter?.createQuery(e)??new S(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(e==null?this.createQuery():S.from(e))}_setupQueryEngine(){let{layer:e,view:t,hasM:n,hasZ:r}=this,{spatialReference:i,resourceController:a}=t,o=new P(i,e,a,()=>this.processor.featureStore,r,n,()=>this.availableFields);this._queryEngine=new N({context:o,priority:D.FEATURE_QUERY_ENGINE})}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))*.8}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}async _handleEdits(e){let t=this._attributeEditingContext,n=await I(t,e);L(t,n)}get _attributeEditingContext(){let e=this._getObjectIdField(),t=this._getGlobalIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,globalIdField:t,forEachNode:e=>this.loadedGraphics.forEachNode(t=>e(t.node,t.featureIds)),attributeStorageInfo:this.layer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,n,r)=>{this._setAttributeData(t,n);let i=this.loadedGraphics.getNode(t);if(r!=null){let t=this.loadedGraphics.get(r.attributes[e]);t!=null&&this.processor.graphicsCore.recreateGraphics([t])}else i!=null&&this.processor.graphicsCore.recreateGraphics(i.graphics)},clearMemCache:()=>{}}}get performanceInfo(){return new ye(this.usedMemory,this.loadedGraphics.length,-1,this.maximumNumberOfFeatures,this.loadedGraphics.nodeCount,this.processor.graphicsCore.performanceInfo)}get test(){}};e([t()],J.prototype,`processor`,void 0),e([t({type:b})],J.prototype,`filter`,void 0),e([t()],J.prototype,`loadedGraphics`,void 0),e([t()],J.prototype,`layerViewUid`,null),e([t()],J.prototype,`_controller`,void 0),e([t()],J.prototype,`updating`,void 0),e([t()],J.prototype,`suspended`,void 0),e([t(A)],J.prototype,`updatingProgress`,void 0),e([t()],J.prototype,`updatingProgressValue`,null),e([t({readOnly:!0})],J.prototype,`visibleAtCurrentScale`,null),e([t(q.requiredFields)],J.prototype,`requiredFields`,null),e([t(q.availableFields)],J.prototype,`availableFields`,void 0),e([t()],J.prototype,`_fieldsHelper`,void 0),e([t({type:Number})],J.prototype,`maximumNumberOfFeatures`,null),e([t({readOnly:!0})],J.prototype,`maximumNumberOfFeaturesExceeded`,null),e([t()],J.prototype,`_excludeObjectIds`,null),e([t({readOnly:!0})],J.prototype,`lodFactor`,null),e([t({readOnly:!0})],J.prototype,`hasM`,null),e([t({readOnly:!0})],J.prototype,`hasZ`,null),e([t()],J.prototype,`contentVisible`,null),e([t({readOnly:!0})],J.prototype,`legendEnabled`,null),e([t()],J.prototype,`_graphicOrigin`,null),J=e([n(`esri.views.3d.layers.SceneLayerGraphicsView3D`)],J);const we=J;function Te(e){return`pointData`in e}function Y(e){return`geometryBuffer`in e&&e.geometryBuffer!==null}function Ee(e,t,n){let r=t.attributeInfo;if(r?.loadedAttributes==null||r.attributeData==null)return!1;let i=!1;for(let{name:t}of r.loadedAttributes)if(r.attributeData[t]){let a=R(r.attributeData[t],n);a!==e.attributes[t]&&(e.attributes[t]=a,i=!0)}return i}function X(e){let t=e.attributeInfo;if(t?.loadedAttributes==null||t.attributeData==null)return;let n=e.node.index;for(let r=0;r<e.graphics.length;r++){let i=e.graphics[r];if(i.nodeIndex===n){i.attributes||={};for(let{name:e}of t.loadedAttributes)t.attributeData[e]&&(i.attributes[e]=R(t.attributeData[e],r))}}}function De(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,e.zmin!=null&&e.zmax!=null&&(e.zmin-=t,e.zmax+=t),e.mmin!=null&&e.mmax!=null&&(e.mmin-=t,e.mmax+=t),e}const Oe={2:{type:`Embedded`,params:{type:`points`,vertexAttributes:{position:[0,0]}}},3:{type:`Embedded`,params:{type:`points`,vertexAttributes:{position:[0,0,0]}}}},Z=a(),Q={graphic:null,property:null,oldValue:null,newValue:null},ke=a();function $(){Q.graphic=null,Q.property=null,Q.oldValue=null,Q.newValue=null}export{we as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import"../../../core/has.js";import{set as r}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as i,create as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import o from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{estimateNumberArrayMemory as c}from"../../../core/memoryEstimations.js";import{throwIfAborted as l}from"../../../core/promiseUtils.js";import{initial as u,watch as d,sync as f,on as p}from"../../../core/reactiveUtils.js";import{generateUID as m}from"../../../core/uid.js";import{projectBuffer as h}from"../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as g}from"../../../geometry/projection/projectVectorToVector.js";import{extentContainsCoords3D as ee,extentContainsCoords2D as te}from"../../../geometry/support/contains.js";import{newDoubleArray as _,doubleArrayFrom as ne}from"../../../geometry/support/DoubleArray.js";import{isInEffectiveScaleRange as re}from"../../../geometry/support/scaleUtils.js";import{getGeometryZScaler as ie}from"../../../geometry/support/zscale.js";import ae from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{estimateSize as v}from"../../../layers/graphics/dehydratedFeatures.js";import{ImmutableDehydratedPoint as oe}from"../../../layers/graphics/dehydratedPoint.js";import{hydrateGraphic as se}from"../../../layers/graphics/hydratedFeatures.js";import{fallbackObjectIDAttribute as y}from"../../../layers/LayerConstants.js";import b from"../../../layers/support/FeatureFilter.js";import{RequiredFieldsCollector as x}from"../../../layers/support/FieldCollector.js";import{I3SExtractChanges as ce}from"../../../layers/support/I3SExtractChanges.js";import S from"../../../rest/support/Query.js";import{isBasemapLayerView as le}from"../../../support/basemapUtils.js";import{isGraphic as ue}from"../../../support/graphicInstanceUtils.js";import C from"../../layers/SceneLayerView.js";import{hasPopupTemplate as w}from"../../layers/support/popupUtils.js";import{getHighlightName as T}from"../../support/highlightOptionsUtils.js";import{hasLayerBasedScaleVisibility as E}from"../../support/layerViewUtils.js";import{TaskPriority as D}from"../../support/Scheduler.js";import{debugFlags as O}from"../support/debugFlags.js";import{compute as k}from"../support/orientedBoundingBox.js";import{updatingProgress as A}from"../support/updatingProperties.js";import{Vertices as j}from"../webgl-engine/lib/Attribute.js";import{Graphics3DFeatureProcessor as M}from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as N}from"./graphics/QueryEngine.js";import{QueryEngineContext as P}from"./graphics/QueryEngineContext.js";import{createInteractiveEditSession as F,normalizeEditResultsEvent as I,processAttributeEdits as L}from"./i3s/featureEditing.js";import{getCachedAttributeValue as R}from"./i3s/I3SBinaryReader.js";import{I3SGraphicsMap as z}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as B}from"./i3s/I3SOverrides.js";import{checkRecyclable as V,checkSpatialReferences as H,containsDraco as U,whenGraphicAttributes as de}from"./i3s/I3SUtil.js";import{I3SPointsWorkerHandle as W}from"./I3SPointsWorkerHandle.js";import{LayerView3D as fe}from"./LayerView3D.js";import{attributeLookup as G}from"./support/attributeUtils.js";import{createFeatureFilterHighlight as pe}from"./support/createFeatureFilterHighlight.js";import{DefinitionExpressionSceneLayerView as me}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as he}from"./support/fieldProperties.js";import{isFeatureFilter as ge,emptyHighlightHandle as K,normalizeHighlightTarget as _e,isObjectId as ve}from"./support/highlightUtils.js";import{LayerViewPerformanceInfo as ye}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as be}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as xe}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as Se}from"./support/TemporalSceneLayerView.js";const q=he();class Ce{constructor(e,t,n,r){this.graphics=e,this.featureIds=t,this.attributeInfo=n,this.node=r}get usedMemory(){return this.graphics.reduce((e,t)=>v(t)+e,c(this.featureIds)+1024)}}let J=class extends Se(me(be(fe(C)))){constructor(){super(...arguments),this.type=`scene-layer-graphics-3d`,this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this._pendingEditsQueue=Promise.resolve(),this.loadedGraphics=new z((e,t,n)=>Ee(e,t,n),e=>this.processor.graphicsCore.recreateGraphics(e),this.logError),this.holeFilling=`always`,this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}tryRecycleWith(e,t){return e.url!==this.layer.url||!this._i3sOverrides.isEmpty?null:e.load(t).then(()=>{l(t),V(this.layer,e,this._i3sOverrides),this.layer=e,this._reinitializeOverrides(),s(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()})}initialize(){this.addResolvingPromise(this.layer.indexInfo),this._reinitializeOverrides(),H(this.layer,this.view.spatialReference,this.view.state.isGlobal),this._fieldsHelper=new xe({layerView:this}),this._updatingHandles.add(()=>this.layer.rangeInfos,e=>this._rangeInfosChanged(e),u),this._updatingHandles.add(()=>this.layer.renderer,(e,t)=>this._rendererChange(e,t)),this._updatingHandles.add(()=>[this.parsedDefinitionExpression,this.layer.excludeObjectIds],()=>this._filterChange()),this._set(`processor`,new M({owner:this,preferredUpdatePolicy:0,scaleVisibilityEnabled:!E(),filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:this.layer.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on(`invalidate-elevation`,({extent:e,spatialReference:t})=>this._controller.updateElevationChanged(e,t)),this.supportsHeightUnitConversion&&(this._verticalScale=ie(`point`,this.layer.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.when()),this._memCache=this.view.resourceController.memoryController.newCache(`psl-${this.uid}`),this._controller=new ae({layerView:this}),U(this.layer.geometryDefinitions)&&(this._workerHandle=new W(e=>this.view.resourceController.immediate.schedule(e))),this.addHandles(this.layer.on(`apply-edits`,e=>this._updatingHandles.addPromise(e.result))),this.addHandles([this.layer.on(`edits`,e=>{let t=this._pendingEditsQueue.then(()=>this._handleEdits(e)).then();this._pendingEditsQueue=t,this._updatingHandles.consumePromise(t)}),d(()=>O.I3S_TREE_SHOW_TILES,e=>{if(e&&!this._treeDebugger){let e=this._controller.crsIndex;import(`./support/I3STreeDebugger.js`).then(({I3STreeDebugger:t})=>{!this._treeDebugger&&O.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))})}else!e&&this._treeDebugger&&!O.I3S_TREE_SHOW_TILES&&(this._treeDebugger.destroy(),this._treeDebugger=null)},u)]),this.when(()=>{this._setupQueryEngine(),this._updatingHandles.add(()=>this.availableFields,()=>this._queryEngine?.clear(),f),this._updatingHandles.add(()=>this.maximumNumberOfFeatures,e=>this._controller.featureTarget=e,u),this._updatingHandles.add(()=>this.suspended,e=>{e&&this._removeAllNodeData()})}).catch(()=>{})}_reinitializeOverrides(){this._i3sOverrides?.destroy(),this._extractChanges?.destroy();let{layer:e}=this,t=this.view.resourceController?.memoryController;this._extractChanges=new ce({layer:e}),this._i3sOverrides=new B({view:this.view,layer:e,memoryController:t,extractChanges:this._extractChanges})}destroy(){this._treeDebugger=s(this._treeDebugger),this._i3sOverrides=s(this._i3sOverrides),this._extractChanges=s(this._extractChanges),this._set(`processor`,s(this.processor)),this._controller=s(this._controller),this._queryEngine=s(this._queryEngine),this._workerHandle=s(this._workerHandle),this._memCache=s(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=s(this._fieldsHelper)}get layerViewUid(){return this.uid}get updatingProgressValue(){return this._controller?.updatingProgress??1}get visibleAtCurrentScale(){return E()?re(this.layer.effectiveScaleRange,this.view.scale):!this.processor?.scaleVisibilitySuspended}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){return this.processor?.graphicsCore?.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e==null?(this._clearOverride(`maximumNumberOfFeatures`),this._controller.fixedFeatureTarget=!1):(this._override(`maximumNumberOfFeatures`,e),this._controller.fixedFeatureTarget=!0)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached}get _excludeObjectIds(){return new Set(this.layer.excludeObjectIds)}get lodFactor(){return 1}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){return!this.suspended&&!!this._controller?.rootNodeVisible}get legendEnabled(){return this.contentVisible&&this.layer?.legendEnabled===!0}get _graphicOrigin(){return this.layer.graphicOrigin}async whenGraphicAttributes(e,t){return de(this.layer,e,this._getObjectIdField(),t,()=>[...this.loadedGraphics.nodes()])}getHit(e){if(!this.loadedGraphics)return null;let t=se(this.loadedGraphics.find(t=>t.uid===e),this.layer,this._graphicOrigin),n=this._getObjectIdField();return t?.attributes?.[n]==null?null:{type:`graphic`,graphic:t,layer:t.layer}}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e,t){let n=T(t),r=this.layer.objectIdField;if(ge(e)){let t=this.processor.graphicsCore.objectStates;if(!t)return K;let i=this._registerHighlightFilter(e),{set:a,handle:o}=t.acquireHighlightSet(n,r);return pe({owner:this,handles:[i,o],filter:e,layer:this.layer,scheduler:this.view.resourceController.scheduler,updatingHandles:this._updatingHandles,getAvailableFields:()=>this.availableFields,query:t=>this._queryEngine.executeQueryForIdSet(e,null,t),apply:e=>t.updateObjectIds(a,e),onChange:e=>p(()=>this.processor.featureStore.events,`changed`,e)})}let i=_e(e);if(i.length===0)return K;if(ue(i[0])){let e=i;if(G(this.layer.fieldsIndex,e[0].attributes,r)!=null){let t=e.map(e=>G(this.layer.fieldsIndex,e.attributes,r));return this.processor.highlightByObjectIds(t,r,n)}return this.processor.highlightByGraphics(e,n)}return ve(i[0])?this.processor.highlightByObjectIds(i,r,n):K}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return F(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){let n={geometryBuffer:e.geometryBuffer};this._workerHandle??=new W(e=>this.view.resourceController.immediate.schedule(e));let r=await this._workerHandle.invoke(n,t);if(r==null)throw Error(`Failed to decompress Draco point data`);return{positionData:r.positions,featureIds:r.featureIds}}async addNode(e,t,n){if(!Y(t)&&!Te(t))throw Error();if(this.loadedGraphics.hasNode(e.index)){o.getLogger(this).error(`I3S node `+e.id+` already added`);return}let r=this.layer.fullExtent==null?null:De(this.layer.fullExtent.clone(),.5),{featureIds:i,pointPositions:a}=Y(t)?await this._extractBinaryPointPositions(e,t,n):this._extractLegacyPointPositions(t),s=[];this._validatePositions(e,i,a,r,s);let c=this._controller.crsVertex,l=this.view.spatialReference;h(a,c,0,a,l,0,i.length);let u=Y(t)?e.level:0,d=this._createGraphics(i,a,e.index,u),f=new Ce(d,i,t.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(f.featureIds,t.attributeDataInfo,n),e.numFeatures=f.graphics.length,this._updateNodeMemory(e),X(f),s.length>0&&(this._computeObb(e,s,c),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e)){this._cacheNodeData(f);return}if(this._verticalScale!=null)for(let e of f.graphics)this._verticalScale(e.geometry);let p=this.view.stage.renderView.olidRenderHelper;if(p){let e=le(this.view,this.uid);for(let t=0;t<f.featureIds.length;t++){let n=f.featureIds[t];p.setUidToObjectAndLayerId(n,f.graphics[t].uid,this.layer.id,this.uid,this.layer.popupEnabled&&!e&&w(this.layer,this.view.popup?.defaultPopupTemplateEnabled),f.node.resources.attributes,t)}}this.loadedGraphics.addNode(e.index,f),this._controller.updateLoadStatus(e.index,!0),this._filterNode(f),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,n){let r=this._controller.crsIndex,i=r.isGeographic?this.view.renderSpatialReference:r;h(t,n,0,t,i,0),e.serviceObbInIndexSR=k(new j(t,3)),r.isGeographic&&(g(e.serviceObbInIndexSR.getCenter(Z),i,Z,r),e.serviceObbInIndexSR.setCenter(Z))}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}getNodeComponentHandle(){}async _extractBinaryPointPositions(e,t,n){let r=await this._decompressBinaryPointData(t,n),a=r.positionData,o=a.length/3,s=_(o*3),c=e.serviceObbInIndexSR==null?i:e.serviceObbInIndexSR.getCenter(ke),l=Math.abs(c[2])*2**-20;for(let e=0;e<o;e++){let t=e*3;s[t]=a[t]+c[0],s[t+1]=a[t+1]+c[1],s[t+2]=a[t+2]+c[2],Math.abs(s[t+2])<l&&(s[t+2]=0)}return{featureIds:r.featureIds?ne(r.featureIds):[],pointPositions:s}}_extractLegacyPointPositions(e){let t=e.pointData.length,n=_(3*t),r=[];for(let i=0;i<t;i++){let t=e.pointData[i],a=t.featureDataPosition,o=a.length,s=t.geometries?.[0]??Oe[o],c=t.featureIds[0];if(s.type!==`Embedded`||s.params.type!==`points`||o<2||o>3)continue;let l=s.params.vertexAttributes?.position??[0,0,0],u=r.length*3;n[u]=a[0]+l[0],n[u+1]=a[1]+l[1],n[u+2]=o===3?a[2]+l[2]:NaN,r.push(c)}return{featureIds:r,pointPositions:n}}_validatePositions(e,t,n,i,a){if(i==null&&e.serviceObbInIndexSR)return;let s=t.length;for(let t=0;t<s;t++){let s=t*3;r(Z,n[s],n[s+1],n[s+2]);let c=!Number.isNaN(n[2]);i!=null&&(c?!ee(i,Z):!te(i,Z))&&(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&o.getLogger(this).error(`Service Error: Coordinates outside of layer extent`),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&o.getLogger(this).error(`Maximum number of errors reached. Further errors are ignored.`),this._coordinatesOutsideExtentErrors++),e.serviceObbInIndexSR||a.push(Z[0],Z[1],Z[2])}}_createGraphics(e,t,n,r){let i=e.length,a=this._getObjectIdField(),o=this.processor.graphicsCore,s=[],c=this.view.spatialReference;for(let l=0;l<i;l++){let i=e[l],u={};i!=null&&(u[a]=i);let d=i??m(),f=l*3,p=isNaN(t[f+2])?void 0:t[f+2],h=new oe(c,t[f],t[f+1],p),g=this.loadedGraphics.get(d);if(g!=null)(g.level==null||g.level<r)&&(Q.property=`geometry`,Q.graphic=g,Q.oldValue=g.geometry,Q.newValue=h,g.geometry=h,g.level=r,o.graphicUpdateHandler(Q),$()),s.push(g);else{let e=m();s.push({objectId:d,uid:e,geometry:h,attributes:u,visible:!0,nodeIndex:n,level:r})}}return s}_updateNodeMemory(e){e.memory=4096+(e.numFeatures??0)*this.processor.graphicsCore.usedMemoryPerGraphic}_cacheNodeData(e){this._memCache.put(this._getMemCacheKey(e.node),e)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode((e,t)=>{if(e){let t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)}),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){let t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){let t=this.loadedGraphics.getNode(e);return t==null?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){return this._memCache?.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,n,r){this.loadedGraphics.hasNode(e.index)?o.getLogger(this).error(`I3S node `+e.id+` already added`):(await this._i3sOverrides.applyAttributeOverrides(t.featureIds,n,r),t.attributeInfo=n,this.loadedGraphics.addNode(e.index,t),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),X(t),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){let e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node.id)),e.sort()}getVisibleNodes(){let e=[];return this.loadedGraphics.forEachNode(t=>e.push(t.node)),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode((t,n)=>e.push(n))}getLoadedAttributes(e){let t=this.loadedGraphics.getNode(e);if(t?.attributeInfo!=null)return t.attributeInfo.loadedAttributes}getAttributeData(e){let t=this.loadedGraphics.getNode(e);if(t?.attributeInfo!=null)return t.attributeInfo.attributeData}_setAttributeData(e,t){let n=this.loadedGraphics.getNode(e);n?.attributeInfo!=null&&(n.attributeInfo.attributeData=t,this._attributeValuesChanged(n))}async updateAttributes(e,t,n){let r=this.loadedGraphics.getNode(e);r!=null&&(await this._i3sOverrides.applyAttributeOverrides(r.featureIds,t,n),l(n),r.attributeInfo=t,this._attributeValuesChanged(r))}_attributeValuesChanged(e){X(e),this._filterNode(e);let{processor:t}=this,{graphicsCore:n}=t;if(n.labelsEnabled){let t=e.node.index,r=[];e.graphics.forEach(e=>e.nodeIndex===t&&r.push(e.uid)),n.updateLabelingInfo(r)}t.refreshFilter(),n.featureStore.events.emit(`changed`)}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||y}_getGlobalIdField(){return this.layer.globalIdField}async _rendererChange(e,t){let{layer:{fieldsIndex:n}}=this,r=new Set,i=new x(r,n),a;e?(await e.collectRequiredFields(i),a=Array.from(r).sort()):a=[],r.clear();let o;t?(await t.collectRequiredFields(i),o=Array.from(r).sort()):o=[],a.length===o.length&&a.every((e,t)=>a[t]===o[t])||this._reloadAllNodes()}_rangeInfosChanged(e){e!=null&&e.length>0&&o.getLogger(this).warn(`Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.`)}_filterChange(){this.loadedGraphics.forEachNode(e=>this._filterNode(e))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){let t=this.parsedDefinitionExpression,n=this._excludeObjectIds,r=this._getObjectIdField();for(let i of e.graphics){let e=i.visible,a=this._evaluateClause(t,i),o=!n.has(i.attributes[r]);i.visible=a&&o,e!==i.visible&&(Q.graphic=i,Q.property=`visible`,Q.oldValue=e,Q.newValue=i.visible,this.processor.graphicsCore.graphicUpdateHandler(Q),$())}}createQuery(){let e={outFields:[`*`],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return this.filter?.createQuery(e)??new S(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(e==null?this.createQuery():S.from(e))}_setupQueryEngine(){let{layer:e,view:t,hasM:n,hasZ:r}=this,{spatialReference:i,resourceController:a}=t,o=new P(i,e,a,()=>this.processor.featureStore,r,n,()=>this.availableFields);this._queryEngine=new N({context:o,priority:D.FEATURE_QUERY_ENGINE})}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))*.8}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}async _handleEdits(e){let t=this._attributeEditingContext,n=await I(t,e);L(t,n)}get _attributeEditingContext(){let e=this._getObjectIdField(),t=this._getGlobalIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,globalIdField:t,forEachNode:e=>this.loadedGraphics.forEachNode(t=>e(t.node,t.featureIds)),attributeStorageInfo:this.layer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,n,r)=>{this._setAttributeData(t,n);let i=this.loadedGraphics.getNode(t);if(r!=null){let t=this.loadedGraphics.get(r.attributes[e]);t!=null&&this.processor.graphicsCore.recreateGraphics([t])}else i!=null&&this.processor.graphicsCore.recreateGraphics(i.graphics)},clearMemCache:()=>{}}}get performanceInfo(){return new ye(this.usedMemory,this.loadedGraphics.length,-1,this.maximumNumberOfFeatures,this.loadedGraphics.nodeCount,this.processor.graphicsCore.performanceInfo)}get test(){}};e([t()],J.prototype,`processor`,void 0),e([t({type:b})],J.prototype,`filter`,void 0),e([t()],J.prototype,`loadedGraphics`,void 0),e([t()],J.prototype,`layerViewUid`,null),e([t()],J.prototype,`_controller`,void 0),e([t()],J.prototype,`updating`,void 0),e([t()],J.prototype,`suspended`,void 0),e([t(A)],J.prototype,`updatingProgress`,void 0),e([t()],J.prototype,`updatingProgressValue`,null),e([t({readOnly:!0})],J.prototype,`visibleAtCurrentScale`,null),e([t(q.requiredFields)],J.prototype,`requiredFields`,null),e([t(q.availableFields)],J.prototype,`availableFields`,void 0),e([t()],J.prototype,`_fieldsHelper`,void 0),e([t({type:Number})],J.prototype,`maximumNumberOfFeatures`,null),e([t({readOnly:!0})],J.prototype,`maximumNumberOfFeaturesExceeded`,null),e([t()],J.prototype,`_excludeObjectIds`,null),e([t({readOnly:!0})],J.prototype,`lodFactor`,null),e([t({readOnly:!0})],J.prototype,`hasM`,null),e([t({readOnly:!0})],J.prototype,`hasZ`,null),e([t()],J.prototype,`contentVisible`,null),e([t({readOnly:!0})],J.prototype,`legendEnabled`,null),e([t()],J.prototype,`_graphicOrigin`,null),J=e([n(`esri.views.3d.layers.SceneLayerGraphicsView3D`)],J);const we=J;function Te(e){return`pointData`in e}function Y(e){return`geometryBuffer`in e&&e.geometryBuffer!==null}function Ee(e,t,n){let r=t.attributeInfo;if(r?.loadedAttributes==null||r.attributeData==null)return!1;let i=!1;for(let{name:t}of r.loadedAttributes)if(r.attributeData[t]){let a=R(r.attributeData[t],n);a!==e.attributes[t]&&(e.attributes[t]=a,i=!0)}return i}function X(e){let t=e.attributeInfo;if(t?.loadedAttributes==null||t.attributeData==null)return;let n=e.node.index;for(let r=0;r<e.graphics.length;r++){let i=e.graphics[r];if(i.nodeIndex===n){i.attributes||={};for(let{name:e}of t.loadedAttributes)t.attributeData[e]&&(i.attributes[e]=R(t.attributeData[e],r))}}}function De(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,e.zmin!=null&&e.zmax!=null&&(e.zmin-=t,e.zmax+=t),e.mmin!=null&&e.mmax!=null&&(e.mmin-=t,e.mmax+=t),e}const Oe={2:{type:`Embedded`,params:{type:`points`,vertexAttributes:{position:[0,0]}}},3:{type:`Embedded`,params:{type:`points`,vertexAttributes:{position:[0,0,0]}}}},Z=a(),Q={graphic:null,property:null,oldValue:null,newValue:null},ke=a();function $(){Q.graphic=null,Q.property=null,Q.oldValue=null,Q.newValue=null}export{we as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import r from"../../../core/Error.js";import has from"../../../core/has.js";import{disposeMaybe as i,abortMaybe as a,destroyMaybe as o}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{whenOnce as c,watch as l,initial as u}from"../../../core/reactiveUtils.js";import{SchemaHelper as d}from"../../2d/engine/vectorTiles/SchemaHelper.js";import f from"../../2d/engine/vectorTiles/style/StyleRepository.js";import p from"../../2d/engine/vectorTiles/TileHandler3D.js";import m from"../../2d/engine/vectorTiles/VTLPainter3D.js";import h from"../../layers/VectorTileLayerView.js";import{vtlAssumes256PixelSizeAsDefault as g,test as _}from"../terrain/terrainUtils.js";import{LayerView3D as v}from"./LayerView3D.js";import{TiledLayerView3D as y}from"./TiledLayerView3D.js";let b=class extends y(v(h)){constructor(){super(...arguments),this._tileHandlerController=null,this.type=`vector-tile-3d`,this.levelShift=+!has(`disable-feature:vtl-level-shift`)}initialize(){if(this.layer.fullExtent==null){this.addResolvingPromise(Promise.reject(new r(`vectortilelayerview:full-extent-undefined`,`This layer view's layer does not define a fullExtent.`)));return}let{basemapTerrain:e,groundView:t,spatialReference:n,state:i
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import r from"../../../core/Error.js";import has from"../../../core/has.js";import{disposeMaybe as i,abortMaybe as a,destroyMaybe as o}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{whenOnce as c,watch as l,initial as u}from"../../../core/reactiveUtils.js";import{SchemaHelper as d}from"../../2d/engine/vectorTiles/SchemaHelper.js";import f from"../../2d/engine/vectorTiles/style/StyleRepository.js";import p from"../../2d/engine/vectorTiles/TileHandler3D.js";import m from"../../2d/engine/vectorTiles/VTLPainter3D.js";import h from"../../layers/VectorTileLayerView.js";import{vtlAssumes256PixelSizeAsDefault as g,test as _}from"../terrain/terrainUtils.js";import{LayerView3D as v}from"./LayerView3D.js";import{TiledLayerView3D as y}from"./TiledLayerView3D.js";let b=class extends y(v(h)){constructor(){super(...arguments),this._tileHandlerController=null,this.type=`vector-tile-3d`,this.levelShift=+!has(`disable-feature:vtl-level-shift`)}initialize(){if(this.layer.fullExtent==null){this.addResolvingPromise(Promise.reject(new r(`vectortilelayerview:full-extent-undefined`,`This layer view's layer does not define a fullExtent.`)));return}let{basemapTerrain:e,groundView:t,spatialReference:n,state:i}=this.view,a=i.isLocal&&!g(n)||_.force512VTL?this.layer.tileInfo:this.layer.tileInfo.getCompatibleForVTL(256),o=this._getTileInfoSupportError(a,this.layer.fullExtent);if(o!=null)return this.addResolvingPromise(Promise.reject(o));let h=c(()=>this.view?.basemapTerrain?.tilingSchemeLocked).then(()=>{let n=e.tilingScheme,r=n.pixelSize,i=r===256?1:2,a=t.spatialReference?.isGeographic&&r===256?1:0,o=+(!t.spatialReference?.isGeographic&&r===256);this.schemaHelper=new d(i,a,this.levelShift+o);let s;s=r===256||r===512?this.layer.tileInfo.getCompatibleForVTL(r):this.layer.tileInfo;let c=this._getTileInfoCompatibilityError(s,n);if(c)throw c;this.tileInfo=s});this._tileHandlerController=new AbortController;let v=this.view.resourceController;this._memCache=v.memoryController.newCache(`vtl-${this.layer.uid}`,e=>e.release()),this.addHandles(l(()=>this.view.qualitySettings.memoryLimit,e=>this._memCache.maxSize=Math.ceil(e/10),u));let y=new f(this.layer.currentStyleInfo.style),b=this.view.glyphMosaic();this._tileHandler=new p(this.layer,y,i.contentPixelRatio,b,this._memCache);let x=this._tileHandlerController.signal,C=S(v),w=this._tileHandler.start({signal:x,schedule:C}),T=this._tileHandler.spriteMosaic;T.then(e=>{!s(x)&&this._tileHandler&&(this.painter=new m(e,this._tileHandler.glyphMosaic))}),w.then(()=>this._tileHandlerController=null);let E=()=>{this._tileHandlerController&&this._tileHandlerController.abort(),this._tileHandlerController=new AbortController,this._memCache.clear();let e=this.layer.currentStyleInfo.style,t=this.view.state?.contentPixelRatio??1,n=new f(e),r=new p(this.layer,n,t,b,this._memCache),i=r.start({signal:this._tileHandlerController.signal,schedule:C}),a=r.spriteMosaic;i.then(()=>this._tileHandlerController=null),this._updatingHandles.consumePromise(Promise.all([i,a]).then(([,e])=>{let t=this._tileHandler,n=this.painter;this.painter=new m(e,r.glyphMosaic),this._tileHandler=r,this.emit(`data-changed`),t.destroy(),n&&n.dispose()}))};this._updatingHandles.add(()=>({style:this.layer.currentStyleInfo.style,pixelRatio:this.view.state?.contentPixelRatio}),E),this.addHandles([this.layer.on(`paint-change`,()=>this.emit(`data-changed`)),this.layer.on(`style-layer-change`,E),this.layer.on(`sprite-add`,E),this.layer.on(`delete-style-layer`,E),this.layer.on(`spriteSource-change`,()=>this.emit(`data-changed`)),this.layer.on(`layout-change`,()=>this.emit(`data-changed`)),this.layer.on(`style-layer-visibility-change`,()=>this.emit(`data-changed`))]);let D=Promise.all([h,w,T]);this.addResolvingPromise(D)}destroy(){this.painter=i(this.painter),this._tileHandlerController=a(this._tileHandlerController),this._tileHandler=o(this._tileHandler),this._memCache=o(this._memCache)}get tilingScheme(){return this._tileHandler.tilingScheme}get contentZoom(){return has(`disable-feature:vtl-level-shift`)?1:1.5*2**this.view.qualitySettings.tiledSurface.lodBias}get displayLevelRange(){let e=this.tileInfo.lods,t=this.layer.minScale||e[0].scale,n=this.layer.maxScale||e[e.length-1].scale,r=this.levelRangeFromScaleRange(t,n);return this.layer.maxScale?r.maxLevel++:r.maxLevel+=this.levelShift,r}get dataScaleRange(){let e=this.tileInfo.lods;return{minScale:e[0].scale,maxScale:e[e.length-1].scale}}get dataLevelRange(){let{minScale:e,maxScale:t}=this.dataScaleRange,n=this.levelRangeFromScaleRange(e,t);return n.minLevel===1&&this.tileInfo.size[0]===256&&(n.minLevel=0),n.maxLevel+=this.levelShift,n}async fetchTile(e,t){let n=this.schemaHelper.getLevelRowColumn(e);return this._tileHandler.getVectorTile(n,t)}get hasVisibleFeatures(){return!0}async doRefresh(){this.suspended||this.emit(`data-changed`)}};e([t()],b.prototype,`levelShift`,void 0),e([t()],b.prototype,`contentZoom`,null),e([t()],b.prototype,`displayLevelRange`,null),e([t()],b.prototype,`tileInfo`,void 0),e([t()],b.prototype,`dataScaleRange`,null),e([t()],b.prototype,`dataLevelRange`,null),e([t()],b.prototype,`updatingProgressValue`,void 0),b=e([n(`esri.views.3d.layers.VectorTileLayerView3D`)],b);const x=b;function S(e){return t=>e.immediate.schedule(t)}export{x as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import r from"../../../core/Error.js";import{cross as i,normalize as a,set as o}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../core/Logger.js";import{watch as l,initial as u}from"../../../core/reactiveUtils.js";import{projectVectorToVector as d}from"../../../geometry/projection/projectVectorToVector.js";import f from"../../../geometry/SpatialReference.js";import{empty as p,expandWithVec3 as m}from"../../../geometry/support/aaBoundingBox.js";import{isInEffectiveScaleRange as h}from"../../../geometry/support/scaleUtils.js";import{equals as g}from"../../../geometry/support/spatialReferenceUtils.js";import _ from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as v}from"../../support/layerViewUtils.js";import{LayerView3D as y}from"./LayerView3D.js";import{LayerViewPerformanceInfo as b}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as x}from"./support/PopupSceneLayerView.js";import{VoxelGraphic as S}from"./VoxelGraphic.js";import{addLayerViewToWasm as C,getVoxelWasm as w,removeLayerViewFromWasm as T}from"./VoxelWasm.js";const E=s(),D=s();let O=class extends x(y(_)){constructor(){super(...arguments),this.type=`voxel-3d`,this.ignoresMemoryFactor=!0,this._suspendedHandle=null,this._usedMemory=0,this._futureMemory=0,this.slicePlaneEnabled=!1,this._wasmLayerId=-1,this._dbgFlags=new Set}initialize(){if(this._dbgFlags.add(3),this.view.
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../core/accessorSupport/decorators.js";import r from"../../../core/Error.js";import{cross as i,normalize as a,set as o}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import c from"../../../core/Logger.js";import{watch as l,initial as u}from"../../../core/reactiveUtils.js";import{projectVectorToVector as d}from"../../../geometry/projection/projectVectorToVector.js";import f from"../../../geometry/SpatialReference.js";import{empty as p,expandWithVec3 as m}from"../../../geometry/support/aaBoundingBox.js";import{isInEffectiveScaleRange as h}from"../../../geometry/support/scaleUtils.js";import{equals as g}from"../../../geometry/support/spatialReferenceUtils.js";import _ from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as v}from"../../support/layerViewUtils.js";import{LayerView3D as y}from"./LayerView3D.js";import{LayerViewPerformanceInfo as b}from"./support/LayerViewPerformanceInfo.js";import{PopupSceneLayerView as x}from"./support/PopupSceneLayerView.js";import{VoxelGraphic as S}from"./VoxelGraphic.js";import{addLayerViewToWasm as C,getVoxelWasm as w,removeLayerViewFromWasm as T}from"./VoxelWasm.js";const E=s(),D=s();let O=class extends x(y(_)){constructor(){super(...arguments),this.type=`voxel-3d`,this.ignoresMemoryFactor=!0,this._suspendedHandle=null,this._usedMemory=0,this._futureMemory=0,this.slicePlaneEnabled=!1,this._wasmLayerId=-1,this._dbgFlags=new Set}initialize(){if(this._dbgFlags.add(3),this.view.state.isGlobal)throw new r(`voxel:unsupported-viewingMode`,`Voxel layers support local viewingMode only.`,{});if(!this.view.stage.renderView.renderingContext.capabilities.colorBufferFloat?.textureFloat)throw new r(`voxel:missing-color-buffer-float`,`Voxel layers require the WebGL2 extension EXT_color_buffer_float`,{});let e=this.layer.spatialReference;if(!g(e,this.view.spatialReference))throw v(`voxel layer`,e.wkid,this.view.spatialReference.wkid);let t=this.layer.currentVariableId,n=this.layer.getVolume(t),i=this.layer.getVariable(t);if(n!=null&&i!=null){let e=n.dimensions[0],t=n.dimensions[1],r=n.zDimension;if(r>1){let a=n.dimensions[r],o=e.size*t.size*a.size,s=1;switch(i.renderingFormat.type){case`Int16`:case`UInt16`:s=2;break;case`Int32`:case`UInt32`:case`Float32`:s=4}this._futureMemory=s*o}}let a=C(this).then(e=>{this._wasmLayerId=e,this._suspendedHandle=l(()=>this.suspended,e=>{let t=w(this.view);t&&t.setEnabled(this,!e)},u),this.addHandles([l(()=>this.layer.renderMode,e=>this._pushRenderModeToWasm(e)),l(()=>this.layer.currentVariableId,e=>this._pushCurrentVariableIdToWasm(e)),l(()=>this.layer.getSections(),e=>this._pushSectionsToWasm(e)),l(()=>this.layer.getVariableStyles(),e=>this._pushVariableStylesToWasm(e)),l(()=>this.layer.getVolumeStyles(),e=>this._pushVolumeStylesToWasm(e)),l(()=>this.layer.enableDynamicSections,e=>this._pushEnableDynamicSectionsToWasm(e)),l(()=>this.layer.enableIsosurfaces,e=>this._pushEnableIsosurfacesToWasm(e)),l(()=>this.layer.enableSections,e=>this._pushEnableSectionsToWasm(e)),l(()=>this.layer.enableSlices,e=>this._pushEnableSlicesToWasm(e)),l(()=>[this.layer.timeOffset,this.layer.timeExtent,this.layer.useViewTime],()=>this._updateLayerTimeProperties()),l(()=>this.slicePlaneEnabled,e=>this._pushAnalysisSliceToWasm(e,this.view.slice.plane)),l(()=>this.view.slice.plane,e=>this._pushAnalysisSliceToWasm(this.slicePlaneEnabled,e))])}).catch(e=>{if(T(this),this._wasmLayerId=-1,e===-1)throw new r(`voxel:addLayer-failure`,`The voxel layer description was invalid.`,{});if(e===-2)throw new r(`voxel:addLayer-failure`,`The voxel layer web assembly module failed to download.`,{})});this.addResolvingPromise(a)}destroy(){T(this),this._suspendedHandle&&=(this._suspendedHandle.remove(),null)}isUpdating(){let e=w(this.view);return this._wasmLayerId<0||e==null?!1:e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange(`updating`)}get usedMemory(){return this._usedMemory}get unloadedMemory(){return this._futureMemory}get performanceInfo(){return new b(this.usedMemory)}get visibleAtCurrentScale(){return h(this.layer.effectiveScaleRange,this.view.scale)}whenGraphicBounds(e,t){let n=e.attributes[`Voxel.WorldPosition`];if(n){let e=p(),t=JSON.parse(n);if(d(t,this.view.renderSpatialReference,D,this.view.spatialReference||f.WGS84))return m(e,D),Promise.resolve({boundingBox:e,screenSpaceObjects:[]})}return Promise.reject()}async whenGraphicAttributes(e,t){let n=w(this.view);if(!n)return e;let r=[];for(let t of e)this._isValidVoxelGraphic(t)&&r.push(t);return r.length&&await n.getOtherFieldPopupValues(r,t),e}_isValidVoxelGraphic(e){return e instanceof S}setUsedMemory(e){this._usedMemory=e,this._futureMemory=0}captureFrustum(){w(this.view)?.captureFrustum()}toggleFullVolumeExtentDraw(){w(this.view)?.toggleFullVolumeExtentDraw(this)}getLayerTimes(){return w(this.view)?.getLayerTimes(this)??[]}getCurrentLayerTimeIndex(){return w(this.view)?.getCurrentLayerTimeIndex(this)??0}dropQueryRenderTarget(){w(this.view)?.dropQueryRenderTarget()}_pushRenderModeToWasm(e){let t=w(this.view);this._dbg(2,`VoxelLayerView3D._pushRenderModeToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setRenderMode(this,e)||this._dbg(3,`VoxelLayerView3D._pushRenderModeToWasm() failed!`)}_pushSectionsToWasm(e){let t=w(this.view);this._dbg(2,`VoxelLayerView3D._pushSectionsToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setStaticSections(this,e)||this._dbg(3,`VoxelLayerView3D._pushSectionsToWasm() failed!`)}_pushCurrentVariableIdToWasm(e){let t=w(this.view);this._dbg(2,`VoxelLayerView3D._pushCurrentVariableIdToWasm() called!, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setCurrentVariable(this,e)||this._dbg(3,`VoxelLayerView3D._pushCurrentVariableIdToWasm() failed!`)}_pushVariableStylesToWasm(e){let t=w(this.view);this._dbg(2,`VoxelLayerView3D._pushVariableStylesToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setVariableStyles(this,e)||this._dbg(3,`VoxelLayerView3D._pushVariableStylesToWasm() failed!`)}_accountForEnableSlices(e,t){let n=t??this.layer.enableSlices;for(let t=0;t<e.length;++t){let r=e[t];for(let e of r.slices)e.enabled=e.enabled&&n}}_pushVolumeStylesToWasm(e){let t=w(this.view);this._dbg(2,`VoxelLayerView3D._pushVolumeStylesToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t&&(this._accountForEnableSlices(e,null),t.setVolumeStyles(this,e)||this._dbg(3,`VoxelLayerView3D._pushVolumeStylesToWasm() failed!`))}_pushAnalysisSliceToWasm(e,t){let n=w(this.view);this._dbg(2,`VoxelLayerView3D._pushAnalysisSliceToWasm() called, ${n?`have WASM`:`don't have WASM!!!`}`);let r=!1;if(n){if(t){let o=t.origin;i(E,t.basis1,t.basis2),a(E,E),r=n.setAnalysisSlice(this,e,o,E)}else o(E,0,0,1),r=n.setAnalysisSlice(this,!1,E,E);r||this._dbg(3,`VoxelLayerView3D._pushAnalysisSliceToWasm() failed!`)}}_updateLayerTimeProperties(){let e=w(this.view);this._dbg(2,`VoxelLayerView3D._updateLayerTimeProperties() called, ${e?`have WASM`:`don't have WASM!!!`}`),e&&e.updateLayerTimeProperties(this)}_pushEnableDynamicSectionsToWasm(e){let t=w(this.view);this._dbg(2,`VoxelLayerView3D._pushEnableDynamicSectionsToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setEnableDynamicSections(this,e)||this._dbg(3,`VoxelLayerView3D._pushEnableDynamicSectionsToWasm() failed!`)}_pushEnableSlicesToWasm(e){let t=w(this.view);if(this._dbg(2,`VoxelLayerView3D._pushEnableSlicesToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t){let n=this.layer.getVolumeStyles();this._accountForEnableSlices(n,e),t.setVolumeStyles(this,n)||this._dbg(3,`VoxelLayerView3D._pushEnableSlicesToWasm() failed!`)}}_pushEnableIsosurfacesToWasm(e){let t=w(this.view);this._dbg(2,`VoxelLayerView3D._pushEnableIsosurfacesToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setEnableIsosurfaces(this,e)||this._dbg(3,`VoxelLayerView3D._pushEnableIsosurfacesToWasm() failed!`)}_pushEnableSectionsToWasm(e){let t=w(this.view);this._dbg(2,`VoxelLayerView3D._pushEnableSectionsToWasm() called, ${t?`have WASM`:`don't have WASM!!!`}`),t?.setEnableSections(this,e)||this._dbg(3,`VoxelLayerView3D._pushEnableSectionsToWasm() failed!`)}get baseUrl(){return this.layer.parsedUrl?.path??``}get wasmLayerId(){return this._wasmLayerId}_dbg(e,t){this._dbgFlags.has(e)&&(e===3?c.getLogger(this).error(t):c.getLogger(this).warn(t))}};e([t({readOnly:!0})],O.prototype,`visibleAtCurrentScale`,null),e([t()],O.prototype,`layer`,void 0),e([t()],O.prototype,`baseUrl`,null),e([t({type:Boolean})],O.prototype,`slicePlaneEnabled`,void 0),O=e([n(`esri.views.3d.layers.VoxelLayerView3D`)],O);const k=O;export{k as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ZEROS as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as l,scale as u,round as d,copy as f,set as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{set as m,transformMat4 as h,scale as g}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{lerp as v}from"../../../../core/mathUtils.js";import{destroyMaybe as y}from"../../../../core/maybe.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{create as S,empty as C,copy as w,offset as T,width as E,height as D,expand as ee}from"../../../../geometry/support/aaBoundingRect.js";import{extrusionContainsPoint as te,create as ne,copy as re}from"../../../../geometry/support/boundedPlane.js";import{create as O}from"../../../../geometry/support/ray.js";import{Sphere as k}from"../../../../geometry/support/sphere.js";import{Yield as A}from"../../../support/Yield.js";import{InternalRenderCategory as j}from"../../webgl.js";import{getVec3AttributeView as M,getScalarAttributeView as N}from"../../webgl-engine/lib/attributeViewUtils.js";import{GPUPointOcclusionQuery as P}from"../../webgl-engine/lib/GPUPointOcclusionQuery.js";import{SeparateScreenSizePerspectiveEvaluators as F}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{HUDMaterial as I}from"../../webgl-engine/materials/HUDMaterial.js";import L from"../../webgl/RenderCamera.js";import{DeconflictAABR as R}from"./DeconflictAABR.js";import{prepare as z,drawPoly as B}from"./deconflictorDebug.js";import{isSymbolLayerWithTransparencyMode as V}from"./transparencyUtils.js";const H=a(),U=a(),ie=a(),W=a(),G=_(),K=_(),q=a(),J=s(),Y=new k,X=O(),ae=a(),oe=S();class se{constructor(e){this.id=e,this.aabr=S(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1,this.priority=0}}function ce(e,t){let n=e.distanceToOccluder!==0&&e.distance>e.distanceToOccluder,r=t.distanceToOccluder!==0&&t.distance>t.distanceToOccluder;return n===r?e.priority===t.priority?e.distance===t.distance?e.visible===t.visible?e.id-t.id:+t.visible-e.visible:e.distance-t.distance:t.priority-e.priority:+n-r}class Z{constructor(e,t){this.graphics3DGraphic=e,this.slicePlaneEnabled=t,this._info=null,this._labelInfo=null}ensureInfo(e){let t=this.getInfo(e);return t||(t=new se(this.graphics3DGraphic.graphic.uid),this._setInfo(e,t)),t}getInfo(e){return e===16?this._labelInfo:this._info}removeInfo(e){this._setInfo(e,null)}_setInfo(e,t){e===16?this._labelInfo=t:this._info=t}}class Q{constructor(){this.camera=new L,this.slicePlane=ne(),this.slicePlaneEnabled=!1}copyFrom(e){this.camera.equals(e.camera)||this.camera.copyFrom(e.camera),re(e.slicePlane,this.slicePlane),this.slicePlaneEnabled=e.slicePlaneEnabled}}let $=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(e){super(e),this._dirty=!1,this._viewState=new Q,this._state=0,this._checkOcclusion=new Map,this._active=new Map,this._checkOcclusionIterator=null,this._activeIterator=null,this._occlusionQueryUids=[],this._updatingHandles=new b,this._deconflictor=new R((e,t)=>{e.visible=t,this._setGraphicVisibility(this._active.get(e.id),t)},(e,t)=>e.id!==t.id,ce),this._baseOccludedVisibility=10,this._altitudeFactor=2,this._minAltitudeDifference=100}initialize(){this._updatingHandles.add(()=>(this.view?.map?.ground?.opacity??0)>0,()=>this.setDirty()),this._updatingHandles.add(()=>this.view.ready,()=>{this._occlusionQuery=null,this._opaqueOcclusionQuery=null,this.setDirty()})}destroy(){this._occlusionQuery=null,this._opaqueOcclusionQuery=null,this._updatingHandles.destroy(),this._deconflictor.destroy(),this._checkOcclusion.clear(),this._active.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._checkOcclusion.size>0)&&(this._dirty=!0,this.notifyChange(`_readyToRun`))}setPriority(e,t){let n=this._active.get(e.graphic.uid)?.getInfo(this.visibilityGroup);n&&(n.priority=t)}get _readyToRun(){return this._state!==0||this._dirty}get updating(){return this._readyToRun||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;let e=this._state/5;return this._dirty?e*.5:e}get readyToRun(){return this.view.ready&&this.view.state!=null&&this._readyToRun}get usedMemory(){return this._occlusionQuery?.usedMemory??0+(this._occlusionQueryUids?.length??0)*4}runTask(e){switch(this._state){case 0:this._startUpdate(),e.madeProgress();case 1:if(this._state=1,!this._processCheckOcclusion(e))return;case 2:if(this._state=2,!(this._occlusionQuery?.done??!0)||!(this._opaqueOcclusionQuery?.done??!0))return A;this._readOcclusionQueryResult(),e.madeProgress();case 3:if(this._state=3,!this._collectActiveGraphics(e))return;case 4:if(this._state=4,this._deconflictor.run(e),!this._deconflictor.done)return;default:this._state=0,this.notifyChange(`_readyToRun`)}}setGraphicsActive(e,t){t?e.forEach(e=>this.addToActiveGraphics(e)):e.forEach(e=>this.removeFromActiveGraphics(e))}isSupportedLayer(e){if(e==null||e.type!==`buffer`||!e.hiddenIfDeconflicted)return!1;let t=e.stageObject;return(t?.geometries.length??0)===1&&t?.geometries[0]?.material instanceof I}_startUpdate(){z(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);let{fullWidth:e,fullHeight:t}=this._viewState.camera;this._deconflictor.reset(e,t),this._resetIterators(),this._occlusionQueryUids.length=0,this._checkOcclusion.size||(this._occlusionQuery=y(this._occlusionQuery),this._opaqueOcclusionQuery=y(this._opaqueOcclusionQuery))}addToActiveGraphics(e){e.ensureInfo(this.visibilityGroup),this._active.set(e.graphics3DGraphic.graphic.uid,e),this.setDirty()}removeFromActiveGraphics(e){this._active.get(e.graphics3DGraphic.graphic.uid)===e&&(le(e,this.visibilityGroup),e.removeInfo(this.visibilityGroup),this._active.delete(e.graphics3DGraphic.graphic.uid),this.setDirty())}addToCheckOcclusion(e){this._checkOcclusion.set(e.graphics3DGraphic.graphic.uid,e),this.setDirty()}removeFromCheckOcclusion(e){this._checkOcclusion.get(e.graphics3DGraphic.graphic.uid)===e&&this._checkOcclusion.delete(e.graphics3DGraphic.graphic.uid)}_processCheckOcclusion(e){if(this._checkOcclusion.size===0)return!0;let t=this._ensureCheckOcclusionIterator(),n=this._viewState.camera,r=o(J,n.viewInverseTransposeMatrix),a=this.view.map.ground.opacity>0,s=this.view.viewingMode===`global`&&a&&n.relativeElevation>0?Y:null,c=0;s!=null&&(l(s.center,i,n.viewMatrix),s.radius=x(this.view.spatialReference).radius,c=s.distanceToSilhouette(i));let u=S();for(;;){if(e.done)return!1;e.madeProgress();let i=t.next();if(i.done===!0)break;let a=i.value,o=a.graphics3DGraphic;if(o.destroyed||!o.isVisible(1,8))continue;let d=pe(o,this.visibilityGroup),f=null,p=!0,m=!1;for(let e of d){if(!this.isSupportedLayer(e))continue;if(f=me,!this._projectHudLayer(e,n,f)||this._isCulledBySlice(a,f.positionWorld)||s!=null&&fe(f,s,c)){p=!1;break}C(u);let t=e.stageObject.geometries[0].material;this._expandBoundingRect(u,n,e,t,f),f.altitude=this.view.renderCoordsHelper.getAltitude(f.positionWorld);let i=a.ensureInfo(this.visibilityGroup);if(i.altitude=f.altitude,i.distance=f.distance,i.distanceToOccluder=f.distanceToOccluder,i.culled=!1,w(i.aabr,u),!e.occlusionCheck)break;l(U,f.positionView,r);let d=this._ensureOcclusionQuery(),h=this._ensureOpaqueOcclusionQuery();this._occlusionQueryUids.length===0&&(this._initOcclusionQuery(d),this._initOcclusionQuery(h));let g=d.addPosition(U),_=h.addPosition(U);if(g===this._occlusionQueryUids.length&&_===g){let t=e.adaptiveOcclusion;this._occlusionQueryUids.push(t?-o.graphic.uid:o.graphic.uid),m=!0}break}let h=this._active.has(o.graphic.uid);if(!h&&!m)this._setGraphicVisibility(a,p);else if(h&&(!p||!f)){let e=a.ensureInfo(this.visibilityGroup);e.visible=!f,e.culled=!0}}return this._checkOcclusionIterator=null,this._occlusionQueryUids.length||(this._occlusionQuery=y(this._occlusionQuery),this._opaqueOcclusionQuery=y(this._opaqueOcclusionQuery)),this._occlusionQuery?.start(),this._opaqueOcclusionQuery?.start(),!0}_readOcclusionQueryResult(){if(!this._occlusionQuery||!this._occlusionQueryUids.length)return;let e=this._viewState.camera,t=this.view.renderCoordsHelper.getAltitude(e.eye);for(let e=0;e<this._occlusionQueryUids.length;e++){let n=this._occlusionQueryUids[e],r=Math.abs(n),i=n<0,a=this._checkOcclusion.get(r);if(!a)continue;let o=this._occlusionQuery.getOcclusion(e)??-1,s=this._opaqueOcclusionQuery?.getOcclusion(e)??-1,c=a.getInfo(this.visibilityGroup);c&&(c.distanceToOccluder=o>0?c.distance-o:0);let l=s===0||s>0&&this._occludedVisibility(c?c.distance-s:0,c?.distance??s,c?.altitude??0,t,i),u=o===0||o>0&&this._occludedVisibility(c?.distanceToOccluder??0,c?.distance??o,c?.altitude??0,t,i),d=l||u;d&&this._setTransparentMode(a,l&&!u),this._active.has(r)?c&&(c.culled=!d,c.visible=d):this._setGraphicVisibility(a,d)}this._occlusionQueryUids.length=0}_collectActiveGraphics(e){let t=this._ensureActiveGraphicsIterator(),n=this.visibilityGroup===16;for(;!e.done;){e.madeProgress();let r=t.next();if(r.done===!0)return this._activeIterator=null,!0;let i=r.value,a=i.getInfo(this.visibilityGroup);if(!a)continue;let o=!n||i.graphics3DGraphic.isVisible();!o||a.culled?(B(a.aabr,!1,!0),this._setGraphicVisibility(i,o&&a.visible)):this._deconflictor.add(a)}return!1}_occludedVisibility(e,t,n,r,i=!0){let a=Math.max(this._minAltitudeDifference,Math.abs(n-r))-this._minAltitudeDifference,o=i?this._baseOccludedVisibility+this._altitudeFactor*a:0;return e===0||t-e<=o}_resetIterators(){this._checkOcclusionIterator=null,this._activeIterator=null}_ensureCheckOcclusionIterator(){return this._checkOcclusionIterator??=this._checkOcclusion.values(),this._checkOcclusionIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=this._active.values(),this._activeIterator}_initOcclusionQuery(e){if(!e)return;let{camera:t}=this._viewState,n=Math.max(2,2+Math.round(Math.log2(Math.abs(t.relativeElevation))));u(H,this._viewState.camera.eye,2**-n),u(H,d(H,H),2**n),e.init(this._checkOcclusion.size,H)}_ensureOcclusionQuery(){return this._occlusionQuery??=new P({view:this.view}),this._occlusionQuery}_ensureOpaqueOcclusionQuery(){return this._opaqueOcclusionQuery??=new P({view:this.view,category:j.OPAQUE_OCCLUSION_QUERY}),this._opaqueOcclusionQuery}_getNumVisible(e){return this._checkOcclusion.values().reduce((t,n)=>t+ +!!n.getInfo(e)?.visible,0)}_projectHudLayer(e,t,n){let r=e.stageObject,a=r.geometries[0],o=a.material;f(U,r.boundingVolumeWorldSpace.sphere.center),l(H,U,t.viewMatrix);let s=M(a,`normal`).getVec(0,ie),c=M(a,`centerOffset`)?.getVec(0,W)??i,d=N(a,`groundDistance`).get(0);return o.applyShaderOffsets(U,H,s,r.transformation,c,d,t,n.screenSizePerspectiveEvaluators),m(G,H[0],H[1],H[2],1),h(K,G,t.projectionMatrix),u(n.positionNDC,K,1/K[3]),o.applyShaderOffsetsNDC(n.positionNDC,c,d,t,n.positionNDC,q),!n.isOutsideScreen&&(n.distanceWithoutPolygonOffset=t.depthNDCToWorld(q[2]),n.distance=q[2]===n.positionNDC[2]?n.distanceWithoutPolygonOffset:t.depthNDCToWorld(n.positionNDC[2]),m(K,n.positionNDC[0],n.positionNDC[1],n.positionNDC[2],1),h(G,K,t.inverseProjectionMatrix),g(G,G,1/G[3]),p(n.positionView,G[0],G[1],G[2]),f(n.positionWorld,U),!0)}_isCulledBySlice(e,t){return e.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&te(this._viewState.slicePlane,t)}_expandBoundingRect(e,t,n,r,{positionNDC:i,screenSizePerspectiveEvaluators:a}){let o=n.getScreenSize(ue);a.evaluator.applyVec2(o,o),o[0]*=t.pixelRatio,o[1]*=t.pixelRatio;let s=T(r.calculateRelativeScreenBounds(o,a.alignmentEvaluator.apply(t.pixelRatio),oe),v(0,t.fullWidth,.5+.5*i[0]),v(0,t.fullHeight,.5+.5*i[1])),c=this.marginFactor;if(c!==0){let e=c*Math.min(E(s),D(s));s[0]-=e,s[1]-=e,s[2]+=e,s[3]+=e}ee(e,s,e)}_setGraphicVisibility(e,t){let n=e?.graphics3DGraphic;n&&!n.destroyed&&(n.setVisibilityFlag(this.visibilityGroup,8,t),this.visibilityGroup===16&&this.view.labeler.setLabelGraphicVisibility(n,t))}_setTransparentMode(e,t){let n=e?.graphics3DGraphic;if(n&&!n.destroyed)for(let e of n.layers){if(e?.type!==`object3d`&&e?.type!==`buffer`)continue;let{graphics3DSymbolLayer:n}=e;V(n)&&n.updateTransparentMode(e,t)}}};e([n({constructOnly:!0})],$.prototype,`view`,void 0),e([n({type:Boolean,readOnly:!0})],$.prototype,`_readyToRun`,null),e([n({type:Boolean,readOnly:!0})],$.prototype,`updating`,null),e([n({readOnly:!0})],$.prototype,`_updatingHandles`,void 0),$=e([r(`esri.views.3d.layers.graphics.Deconflictor`)],$);function le(e,t){let n=e.graphics3DGraphic;n.destroyed||n.setVisibilityFlag(t,8,!0)}const ue=c();class de{constructor(){this.positionWorld=a(),this.positionView=a(),this.positionNDC=a(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.screenSizePerspectiveEvaluators=new F}get isOutsideScreen(){let e=this.positionNDC;return e[0]<-1||e[1]<-1||e[2]<-1||e[0]>=1||e[1]>=1||e[2]>=1}}function fe(e,t,n){return f(X.direction,e.positionView),p(X.origin,0,0,0),t.intersectRay(X,ae)?e.distanceWithoutPolygonOffset>n:!1}function pe(e,t){return t===16?e.labelLayers:e.layers}const me=new de;export{$ as Deconflictor,Z as DeconflictorGraphic,Q as DeconflictorViewState};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{ZEROS as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as l,scale as u,round as d,copy as f,set as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{set as m,transformMat4 as h,scale as g}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{lerp as v}from"../../../../core/mathUtils.js";import{destroyMaybe as y}from"../../../../core/maybe.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as x}from"../../../../geometry/ellipsoidUtils.js";import{create as S,empty as C,copy as w,offset as T,width as E,height as D,expand as ee}from"../../../../geometry/support/aaBoundingRect.js";import{extrusionContainsPoint as te,create as ne,copy as re}from"../../../../geometry/support/boundedPlane.js";import{create as O}from"../../../../geometry/support/ray.js";import{Sphere as k}from"../../../../geometry/support/sphere.js";import{Yield as A}from"../../../support/Yield.js";import{InternalRenderCategory as j}from"../../webgl.js";import{getVec3AttributeView as M,getScalarAttributeView as N}from"../../webgl-engine/lib/attributeViewUtils.js";import{GPUPointOcclusionQuery as P}from"../../webgl-engine/lib/GPUPointOcclusionQuery.js";import{SeparateScreenSizePerspectiveEvaluators as F}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{HUDMaterial as I}from"../../webgl-engine/materials/HUDMaterial.js";import L from"../../webgl/RenderCamera.js";import{DeconflictAABR as R}from"./DeconflictAABR.js";import{prepare as z,drawPoly as B}from"./deconflictorDebug.js";import{isSymbolLayerWithTransparencyMode as V}from"./transparencyUtils.js";const H=a(),U=a(),ie=a(),W=a(),G=_(),K=_(),q=a(),J=s(),Y=new k,X=O(),ae=a(),oe=S();class se{constructor(e){this.id=e,this.aabr=S(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.culled=!1,this.visible=!1,this.priority=0}}function ce(e,t){let n=e.distanceToOccluder!==0&&e.distance>e.distanceToOccluder,r=t.distanceToOccluder!==0&&t.distance>t.distanceToOccluder;return n===r?e.priority===t.priority?e.distance===t.distance?e.visible===t.visible?e.id-t.id:+t.visible-e.visible:e.distance-t.distance:t.priority-e.priority:+n-r}class Z{constructor(e,t){this.graphics3DGraphic=e,this.slicePlaneEnabled=t,this._info=null,this._labelInfo=null}ensureInfo(e){let t=this.getInfo(e);return t||(t=new se(this.graphics3DGraphic.graphic.uid),this._setInfo(e,t)),t}getInfo(e){return e===16?this._labelInfo:this._info}removeInfo(e){this._setInfo(e,null)}_setInfo(e,t){e===16?this._labelInfo=t:this._info=t}}class Q{constructor(){this.camera=new L,this.slicePlane=ne(),this.slicePlaneEnabled=!1}copyFrom(e){this.camera.equals(e.camera)||this.camera.copyFrom(e.camera),re(e.slicePlane,this.slicePlane),this.slicePlaneEnabled=e.slicePlaneEnabled}}let $=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(e){super(e),this._dirty=!1,this._viewState=new Q,this._state=0,this._checkOcclusion=new Map,this._active=new Map,this._checkOcclusionIterator=null,this._activeIterator=null,this._occlusionQueryUids=[],this._updatingHandles=new b,this._deconflictor=new R((e,t)=>{e.visible=t,this._setGraphicVisibility(this._active.get(e.id),t)},(e,t)=>e.id!==t.id,ce),this._baseOccludedVisibility=10,this._altitudeFactor=2,this._minAltitudeDifference=100}initialize(){this._updatingHandles.add(()=>(this.view?.map?.ground?.opacity??0)>0,()=>this.setDirty()),this._updatingHandles.add(()=>this.view.ready,()=>{this._occlusionQuery=null,this._opaqueOcclusionQuery=null,this.setDirty()})}destroy(){this._occlusionQuery=null,this._opaqueOcclusionQuery=null,this._updatingHandles.destroy(),this._deconflictor.destroy(),this._checkOcclusion.clear(),this._active.clear()}setDirty(){!this._dirty&&(this._active.size>0||this._checkOcclusion.size>0)&&(this._dirty=!0,this.notifyChange(`_readyToRun`))}setPriority(e,t){let n=this._active.get(e.graphic.uid)?.getInfo(this.visibilityGroup);n&&(n.priority=t)}get _readyToRun(){return this._state!==0||this._dirty}get updating(){return this._readyToRun||this._updatingHandles.updating}get updatingProgress(){if(!this.updating)return 1;let e=this._state/5;return this._dirty?e*.5:e}get readyToRun(){return this.view.ready&&this.view.state!=null&&this._readyToRun}get usedMemory(){return this._occlusionQuery?.usedMemory??0+(this._occlusionQueryUids?.length??0)*4}runTask(e){switch(this._state){case 0:this._startUpdate(),e.madeProgress();case 1:if(this._state=1,!this._processCheckOcclusion(e))return;case 2:if(this._state=2,!(this._occlusionQuery?.done??!0)||!(this._opaqueOcclusionQuery?.done??!0))return A;this._readOcclusionQueryResult(),e.madeProgress();case 3:if(this._state=3,!this._collectActiveGraphics(e))return;case 4:if(this._state=4,this._deconflictor.run(e),!this._deconflictor.done)return;default:this._state=0,this.notifyChange(`_readyToRun`)}}setGraphicsActive(e,t){t?e.forEach(e=>this.addToActiveGraphics(e)):e.forEach(e=>this.removeFromActiveGraphics(e))}isSupportedLayer(e){if(e==null||e.type!==`buffer`||!e.hiddenIfDeconflicted)return!1;let t=e.stageObject;return(t?.geometries.length??0)===1&&t?.geometries[0]?.material instanceof I}_startUpdate(){z(this.view),this._dirty=!1,this._viewState.copyFrom(this.viewState);let{fullWidth:e,fullHeight:t}=this._viewState.camera;this._deconflictor.reset(e,t),this._resetIterators(),this._occlusionQueryUids.length=0,this._checkOcclusion.size||(this._occlusionQuery=y(this._occlusionQuery),this._opaqueOcclusionQuery=y(this._opaqueOcclusionQuery))}addToActiveGraphics(e){e.ensureInfo(this.visibilityGroup),this._active.set(e.graphics3DGraphic.graphic.uid,e),this.setDirty()}removeFromActiveGraphics(e){this._active.get(e.graphics3DGraphic.graphic.uid)===e&&(le(e,this.visibilityGroup),e.removeInfo(this.visibilityGroup),this._active.delete(e.graphics3DGraphic.graphic.uid),this.setDirty())}addToCheckOcclusion(e){this._checkOcclusion.set(e.graphics3DGraphic.graphic.uid,e),this.setDirty()}removeFromCheckOcclusion(e){this._checkOcclusion.get(e.graphics3DGraphic.graphic.uid)===e&&this._checkOcclusion.delete(e.graphics3DGraphic.graphic.uid)}_processCheckOcclusion(e){if(this._checkOcclusion.size===0)return!0;let t=this._ensureCheckOcclusionIterator(),n=this._viewState.camera,r=o(J,n.viewInverseTransposeMatrix),a=this.view.map.ground.opacity>0,s=this.view.state.isGlobal&&a&&n.relativeElevation>0?Y:null,c=0;s!=null&&(l(s.center,i,n.viewMatrix),s.radius=x(this.view.spatialReference).radius,c=s.distanceToSilhouette(i));let u=S();for(;;){if(e.done)return!1;e.madeProgress();let i=t.next();if(i.done===!0)break;let a=i.value,o=a.graphics3DGraphic;if(o.destroyed||!o.isVisible(1,8))continue;let d=pe(o,this.visibilityGroup),f=null,p=!0,m=!1;for(let e of d){if(!this.isSupportedLayer(e))continue;if(f=me,!this._projectHudLayer(e,n,f)||this._isCulledBySlice(a,f.positionWorld)||s!=null&&fe(f,s,c)){p=!1;break}C(u);let t=e.stageObject.geometries[0].material;this._expandBoundingRect(u,n,e,t,f),f.altitude=this.view.renderCoordsHelper.getAltitude(f.positionWorld);let i=a.ensureInfo(this.visibilityGroup);if(i.altitude=f.altitude,i.distance=f.distance,i.distanceToOccluder=f.distanceToOccluder,i.culled=!1,w(i.aabr,u),!e.occlusionCheck)break;l(U,f.positionView,r);let d=this._ensureOcclusionQuery(),h=this._ensureOpaqueOcclusionQuery();this._occlusionQueryUids.length===0&&(this._initOcclusionQuery(d),this._initOcclusionQuery(h));let g=d.addPosition(U),_=h.addPosition(U);if(g===this._occlusionQueryUids.length&&_===g){let t=e.adaptiveOcclusion;this._occlusionQueryUids.push(t?-o.graphic.uid:o.graphic.uid),m=!0}break}let h=this._active.has(o.graphic.uid);if(!h&&!m)this._setGraphicVisibility(a,p);else if(h&&(!p||!f)){let e=a.ensureInfo(this.visibilityGroup);e.visible=!f,e.culled=!0}}return this._checkOcclusionIterator=null,this._occlusionQueryUids.length||(this._occlusionQuery=y(this._occlusionQuery),this._opaqueOcclusionQuery=y(this._opaqueOcclusionQuery)),this._occlusionQuery?.start(),this._opaqueOcclusionQuery?.start(),!0}_readOcclusionQueryResult(){if(!this._occlusionQuery||!this._occlusionQueryUids.length)return;let e=this._viewState.camera,t=this.view.renderCoordsHelper.getAltitude(e.eye);for(let e=0;e<this._occlusionQueryUids.length;e++){let n=this._occlusionQueryUids[e],r=Math.abs(n),i=n<0,a=this._checkOcclusion.get(r);if(!a)continue;let o=this._occlusionQuery.getOcclusion(e)??-1,s=this._opaqueOcclusionQuery?.getOcclusion(e)??-1,c=a.getInfo(this.visibilityGroup);c&&(c.distanceToOccluder=o>0?c.distance-o:0);let l=s===0||s>0&&this._occludedVisibility(c?c.distance-s:0,c?.distance??s,c?.altitude??0,t,i),u=o===0||o>0&&this._occludedVisibility(c?.distanceToOccluder??0,c?.distance??o,c?.altitude??0,t,i),d=l||u;d&&this._setTransparentMode(a,l&&!u),this._active.has(r)?c&&(c.culled=!d,c.visible=d):this._setGraphicVisibility(a,d)}this._occlusionQueryUids.length=0}_collectActiveGraphics(e){let t=this._ensureActiveGraphicsIterator(),n=this.visibilityGroup===16;for(;!e.done;){e.madeProgress();let r=t.next();if(r.done===!0)return this._activeIterator=null,!0;let i=r.value,a=i.getInfo(this.visibilityGroup);if(!a)continue;let o=!n||i.graphics3DGraphic.isVisible();!o||a.culled?(B(a.aabr,!1,!0),this._setGraphicVisibility(i,o&&a.visible)):this._deconflictor.add(a)}return!1}_occludedVisibility(e,t,n,r,i=!0){let a=Math.max(this._minAltitudeDifference,Math.abs(n-r))-this._minAltitudeDifference,o=i?this._baseOccludedVisibility+this._altitudeFactor*a:0;return e===0||t-e<=o}_resetIterators(){this._checkOcclusionIterator=null,this._activeIterator=null}_ensureCheckOcclusionIterator(){return this._checkOcclusionIterator??=this._checkOcclusion.values(),this._checkOcclusionIterator}_ensureActiveGraphicsIterator(){return this._activeIterator??=this._active.values(),this._activeIterator}_initOcclusionQuery(e){if(!e)return;let{camera:t}=this._viewState,n=Math.max(2,2+Math.round(Math.log2(Math.abs(t.relativeElevation))));u(H,this._viewState.camera.eye,2**-n),u(H,d(H,H),2**n),e.init(this._checkOcclusion.size,H)}_ensureOcclusionQuery(){return this._occlusionQuery??=new P({view:this.view}),this._occlusionQuery}_ensureOpaqueOcclusionQuery(){return this._opaqueOcclusionQuery??=new P({view:this.view,category:j.OPAQUE_OCCLUSION_QUERY}),this._opaqueOcclusionQuery}_getNumVisible(e){return this._checkOcclusion.values().reduce((t,n)=>t+ +!!n.getInfo(e)?.visible,0)}_projectHudLayer(e,t,n){let r=e.stageObject,a=r.geometries[0],o=a.material;f(U,r.boundingVolumeWorldSpace.sphere.center),l(H,U,t.viewMatrix);let s=M(a,`normal`).getVec(0,ie),c=M(a,`centerOffset`)?.getVec(0,W)??i,d=N(a,`groundDistance`).get(0);return o.applyShaderOffsets(U,H,s,r.transformation,c,d,t,n.screenSizePerspectiveEvaluators),m(G,H[0],H[1],H[2],1),h(K,G,t.projectionMatrix),u(n.positionNDC,K,1/K[3]),o.applyShaderOffsetsNDC(n.positionNDC,c,d,t,n.positionNDC,q),!n.isOutsideScreen&&(n.distanceWithoutPolygonOffset=t.depthNDCToWorld(q[2]),n.distance=q[2]===n.positionNDC[2]?n.distanceWithoutPolygonOffset:t.depthNDCToWorld(n.positionNDC[2]),m(K,n.positionNDC[0],n.positionNDC[1],n.positionNDC[2],1),h(G,K,t.inverseProjectionMatrix),g(G,G,1/G[3]),p(n.positionView,G[0],G[1],G[2]),f(n.positionWorld,U),!0)}_isCulledBySlice(e,t){return e.slicePlaneEnabled&&this._viewState.slicePlaneEnabled&&te(this._viewState.slicePlane,t)}_expandBoundingRect(e,t,n,r,{positionNDC:i,screenSizePerspectiveEvaluators:a}){let o=n.getScreenSize(ue);a.evaluator.applyVec2(o,o),o[0]*=t.pixelRatio,o[1]*=t.pixelRatio;let s=T(r.calculateRelativeScreenBounds(o,a.alignmentEvaluator.apply(t.pixelRatio),oe),v(0,t.fullWidth,.5+.5*i[0]),v(0,t.fullHeight,.5+.5*i[1])),c=this.marginFactor;if(c!==0){let e=c*Math.min(E(s),D(s));s[0]-=e,s[1]-=e,s[2]+=e,s[3]+=e}ee(e,s,e)}_setGraphicVisibility(e,t){let n=e?.graphics3DGraphic;n&&!n.destroyed&&(n.setVisibilityFlag(this.visibilityGroup,8,t),this.visibilityGroup===16&&this.view.labeler.setLabelGraphicVisibility(n,t))}_setTransparentMode(e,t){let n=e?.graphics3DGraphic;if(n&&!n.destroyed)for(let e of n.layers){if(e?.type!==`object3d`&&e?.type!==`buffer`)continue;let{graphics3DSymbolLayer:n}=e;V(n)&&n.updateTransparentMode(e,t)}}};e([n({constructOnly:!0})],$.prototype,`view`,void 0),e([n({type:Boolean,readOnly:!0})],$.prototype,`_readyToRun`,null),e([n({type:Boolean,readOnly:!0})],$.prototype,`updating`,null),e([n({readOnly:!0})],$.prototype,`_updatingHandles`,void 0),$=e([r(`esri.views.3d.layers.graphics.Deconflictor`)],$);function le(e,t){let n=e.graphics3DGraphic;n.destroyed||n.setVisibilityFlag(t,8,!0)}const ue=c();class de{constructor(){this.positionWorld=a(),this.positionView=a(),this.positionNDC=a(),this.altitude=0,this.distance=0,this.distanceToOccluder=0,this.distanceWithoutPolygonOffset=0,this.screenSizePerspectiveEvaluators=new F}get isOutsideScreen(){let e=this.positionNDC;return e[0]<-1||e[1]<-1||e[2]<-1||e[0]>=1||e[1]>=1||e[2]>=1}}function fe(e,t,n){return f(X.direction,e.positionView),p(X.origin,0,0,0),t.intersectRay(X,ae)?e.distanceWithoutPolygonOffset>n:!1}function pe(e,t){return t===16?e.labelLayers:e.layers}const me=new de;export{$ as Deconflictor,Z as DeconflictorGraphic,Q as DeconflictorViewState};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{watch as i,sync as a,initial as o}from"../../../../core/reactiveUtils.js";import{getReferenceEllipsoid as s}from"../../../../geometry/ellipsoidUtils.js";import{TaskPriority as c}from"../../../support/Scheduler.js";import{Yield as l}from"../../../support/Yield.js";import{FrustumExtentIntersection as u}from"../../support/FrustumExtentIntersection.js";let d=class extends t{constructor(e){super(e),this.suspended=!1,this._extent=null,this._extentIntersectionDirty=!0,this._isVisibleBelowSurfaceInternal=!1,this.graphicsCoreOwner=null,this.updating=!0}initialize(){let{graphicsCoreOwner:e}=this;this._extentIntersection=new u({renderCoordsHelper:e.view.renderCoordsHelper});let{view:t}=e,{groundView:n}=t,{scheduler:r}=t.resourceController;this.addHandles([t.on(`resize`,()=>this._viewChange()),i(()=>t.state.camera,()=>this._viewChange(),a),r.registerTask(c.FRUSTUM_VISIBILITY,this),i(()=>n.visibleElevationRange,()=>this._elevationRangeChange())]),t.
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{watch as i,sync as a,initial as o}from"../../../../core/reactiveUtils.js";import{getReferenceEllipsoid as s}from"../../../../geometry/ellipsoidUtils.js";import{TaskPriority as c}from"../../../support/Scheduler.js";import{Yield as l}from"../../../support/Yield.js";import{FrustumExtentIntersection as u}from"../../support/FrustumExtentIntersection.js";let d=class extends t{constructor(e){super(e),this.suspended=!1,this._extent=null,this._extentIntersectionDirty=!0,this._isVisibleBelowSurfaceInternal=!1,this.graphicsCoreOwner=null,this.updating=!0}initialize(){let{graphicsCoreOwner:e}=this;this._extentIntersection=new u({renderCoordsHelper:e.view.renderCoordsHelper});let{view:t}=e,{groundView:n}=t,{scheduler:r}=t.resourceController;this.addHandles([t.on(`resize`,()=>this._viewChange()),i(()=>t.state.camera,()=>this._viewChange(),a),r.registerTask(c.FRUSTUM_VISIBILITY,this),i(()=>n.visibleElevationRange,()=>this._elevationRangeChange())]),t.state.isGlobal?this.addHandles([i(()=>[n.baseOpacity,n.wireframe,t.map?.ground?.navigationConstraint?.type],()=>this._updateIsVisibleBelowSurface(),o)]):this._isVisibleBelowSurface=!0}destroy(){this._set(`graphicsCoreOwner`,null),this._extent=null,this._extentIntersection=null}_setDirty(){this.updating||this._set(`updating`,!0)}setExtent(e){this._extent=e,this._extentIntersectionDirty=!0,this._setDirty()}_viewChange(){this._setDirty()}_elevationRangeChange(){this._setDirty(),this._extentIntersectionDirty=!0}set _isVisibleBelowSurface(e){this._isVisibleBelowSurfaceInternal=e,this._setDirty(),this._extentIntersectionDirty=!0}_updateIsVisibleBelowSurface(){let e=this.graphicsCoreOwner.view,t=e.state.isLocal,n=e.map.ground?.navigationConstraint?.type===`none`;this._isVisibleBelowSurface=t||!e.groundView.opaque||n}_updateExtentIntersection(){if(!this._extentIntersectionDirty)return;this._extentIntersectionDirty=!1;let e=this.graphicsCoreOwner.view,t;if(this._isVisibleBelowSurfaceInternal)t=-.3*s(e.spatialReference).radius;else{let{minElevation:n,maxElevation:r}=e.groundView.visibleElevationRange;t=n-Math.max(1,(r-n)*(1.2-1))}this._extentIntersection.update(this._extent,e.spatialReference,t)}get readyToRun(){return this.updating}runTask(e){if(this._set(`updating`,!1),!this._extent)return this._set(`suspended`,!1),l;this._updateExtentIntersection();let{frustum:t}=this.graphicsCoreOwner.view,n=s(this.graphicsCoreOwner.view.spatialReference).radius;this._set(`suspended`,!this._extentIntersection.isVisibleInFrustum(t,n)),e.madeProgress()}};e([n({readOnly:!0})],d.prototype,`suspended`,void 0),e([n({constructOnly:!0})],d.prototype,`graphicsCoreOwner`,void 0),e([n({readOnly:!0})],d.prototype,`updating`,void 0),d=e([r(`esri.views.3d.layers.graphics.Graphics3DFrustumVisibility`)],d);export{d as Graphics3DFrustumVisibility};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as n}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ZEROS as r,clone as i,ones as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{onePixelInPoints as o,pt2px as s,onePointInPixels as c}from"../../../../core/screenUtils.js";import{create as l,fromBuffer as u,intersectsClippingArea as d,empty as f,expandWithAABB as p}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as m}from"../../../../renderers/support/renderingInfoUtils.js";import{getTransformationType as h}from"../../../../renderers/visualVariables/support/sizeVariableUtils.js";import{debugFlags as g}from"../../support/debugFlags.js";import{selectLocalOrigin as _,createBufferGeometry as v}from"../../support/engineContent/line.js";import{geometryToRenderInfo as y,geometryToRenderInfoDraped as b}from"../../support/renderInfoUtils/line.js";import{BufferObject3D as x}from"../../webgl-engine/lib/BufferObject3D.js";import{createLineMarkerBufferGeometry as S}from"../../webgl-engine/materials/internal/lineMarkerBufferUtils.js";import{LineMarkerMaterial as C}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as w,patternHidesLine as T}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as E}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{initFastSymbolUpdatesState as D,updateFastSymbolUpdatesState as O,getAttributeValue as k,getSizeAttributeValue as A,ConvertOptions as j}from"../support/FastSymbolUpdates.js";import{perBufferLineElevationAligner as M}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as N,needsElevationUpdates2D as P}from"./elevationAlignmentUtils.js";import{Graphics3DBufferGraphicLayer as F}from"./Graphics3DBufferGraphicLayer.js";import{Graphics3DDrapedBufferGraphicLayer as I}from"./Graphics3DDrapedBufferGraphicLayer.js";import{Graphics3DSymbolLayer as L,nanFallbackColor as R}from"./Graphics3DSymbolLayer.js";import{parseCapType as z,computeSymbolLayerIndex as B,parseLineMarkerStyle as V}from"./lineUtils.js";const H=[`polyline`];class U extends L{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,K(t))}async doLoad(){if(this._fastUpdates=D(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastMarkerUpdates=D(this._context.renderer,this._fastVisualVariableConvertOptions(!0)),!this._drivenProperties.size&&(this.symbolLayer.size==null?o:this.symbolLayer.size)<0)throw new e(`graphics3dlinesymbollayer:invalid-size`,`Symbol sizes may not be negative values`)}_getMaterialParameters(e,t){let n=this._screenSizePerspective,r=!!has(`enable-feature:emissive-on-non-volumetric`)&&!this.draped,{symbolLayer:i}=this,{worldSized:a}=this.symbol,o={...this._getMaterialColorParameters(t),shadingEnabled:r,width:this._computeMaterialWidth(i.size,a),worldSized:a,polygonOffset:3,polygonOffsetIndex:B(this._renderPriority,this._renderPriorityStep),join:i.join||`miter`,cap:z(i.cap||`butt`),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:w(i.pattern??i.imagePattern),emissiveStrength:this._emissiveStrength,screenSizePerspective:n};if(t===2){if(this._fastMarkerUpdates?.visualVariables)return{...o,...this._fastMarkerUpdates.materialParameters}}else if(o.hasVertexColor=this._hasDrivenColorOrOpacity,o.hasVertexSize=this._drivenProperties.size,o.hasLineDistance=o.stipplePattern!=null,this._fastUpdates?.visualVariables)return{...o,...this._fastUpdates.materialParameters};return o}_getMaterialColorParameters(e){let t=e===2,n=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(n[3]=0),{color:n}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return this._materials[0]??=new E(this._getMaterialParameters(!1,0),this.view),this._materials[0]}get _wireframeLineMaterial(){return this._materials[1]??=new E({...this._getMaterialParameters(!1,1),wireframe:!0},this.view),this._materials[1]}get _markerMaterial(){return this._materials[2]==null&&this.symbolLayer.marker!=null&&(this._materials[2]=new C({...this._getMaterialParameters(!1,2),placement:this.symbolLayer.marker.placement,markerPrimitive:V(this.symbolLayer.marker.style)},this.view.state.isGlobal)),this._materials[2]}_getDrivenSize(e){if(this._drivenProperties.size){let t=e.size;if(t==null)return this._getFallbackSize();let n=m(t.output);return this._getWorldOrScreenSize(n)}return 1}_getDrivenColor({color:e,opacity:t}){let i=a();return this._drivenProperties.color&&(n(i,e?.output??this._getFallbackOpacityAndColor(r)),t==null)||this._drivenProperties.opacity&&(e||this._materialColor)&&(i[3]=t?.output??this._getFallbackOpacity()),i}_getDrivenMarkerColor({color:e,opacity:t}){let i=a();return this._drivenProperties.color&&(n(i,e?.output??this._getFallbackMarkerOpacityAndColor(r)),t==null)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(i[3]=t?.output??this._getFallbackMarkerOpacity()),i}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validatePolylineContext(e))return null;this._warnIfVVRequiresWorldSized(e.renderingInfo);let n=this.createElevationContextForGraphic(t),r=n.mode===`on-the-ground`;return this.ensureDrapedStatus(r),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,n,t.uid)}_validatePolylineContext(e){let t=e.graphic.geometry;return this._validateGeometry(t,H,this.symbolLayer.type)&&t.type===`polyline`}applyRendererDiff(e,t){for(let n in e.diff)if(n===`visualVariables`){let e=this._fastUpdates;if(O(e,t,this._fastVisualVariableConvertOptions()))for(let t of this._materials)t instanceof E&&t.setParameters(e.materialParameters);else return 0;let n=this._fastMarkerUpdates;if(O(n,t,this._fastVisualVariableConvertOptions(!0)))for(let e of this._materials)e instanceof C&&e.setParameters(n.materialParameters);else return 0}else return 0;return`visualVariables`in e.diff&&this._warnIfVVRequiresWorldSized(),2}_warnIfVVRequiresWorldSized(e){if(this.symbol.worldSized||this.ignoreDrivers)return;let t=this._getSizeVariable(e);t==null||t.useSymbolValue||t.target===`outline`||h(t)===`real-world-size`&&this.logger.warnOnce(`SizeVariable uses real-world units, but LineSymbol3D.worldSized is false. Set LineSymbol3D.worldSized to true to render real-world line widths.`)}_getSizeVariable(e){let t=this._fastUpdates?.visualVariables.size;if(t)return t.variables[0];let n=e?.size,r=n?.output.findIndex(e=>typeof e==`number`);return r==null?null:n?.variables[r]}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff,n={};t.size?.type===`complete`&&(n.width=this._computeMaterialWidth(t.size.newValue,this.symbol.worldSized),delete t.size),t.cap?.type===`complete`&&(n.cap=z(t.cap.newValue??`butt`),delete t.cap);let r=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,r),e.symbolLayerStatePatches.push(()=>{for(let e of this._materials)e?.setParameters(n)})}layerOpacityChanged(){for(let e=0;e<3;e++)this._materials[e]?.setParameters(this._getMaterialColorParameters(e))}get _screenSizePerspective(){return!this.draped&&this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null}layerScreenSizePerspectiveChanged(){let e=this._screenSizePerspective;for(let t of this._materials)t?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=N(U.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=P(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){let e={hasSlicePlane:this._context.slicePlaneEnabled};for(let t of this._materials)t?.setParameters(e);return!0}physicallyBasedRenderingChanged(){return!0}_createAs3DShape(e,t,n){let r=W(e.graphic.geometry);if(r==null)return null;let i=[],a=[],o=l(),s=y(r,this._context.elevationProvider,this._context.renderCoordsHelper,t);this._logGeometryCreationWarnings(s,r.paths,`paths`,`LineSymbol3DLayer`);for(let t=0;t<s.lines.length;t++){let r=s.lines[t],c=r.position,l=r.mapPositions;if(this._context.clippingExtent!=null&&(u(l,o),!d(o,this._context.clippingExtent)))continue;let f=this._createGeometryParts(e,c,l,1,n);a.push(f),i.push(f.line),f.wireframe!=null&&i.push(f.wireframe),f.marker!=null&&i.push(f.marker)}if(i.length===0)return null;let c=this._context.layerViewUid,f=new x({geometries:i,castShadow:!1,layerViewUid:c,graphicUid:n}),p=new F(this,f,null,(e,t,n,r,i)=>M(e,t,n,r,i,a),t);return p.alignedSampledElevation=s.sampledElevation,p.needsElevationUpdates=P(t.mode),p}_createGeometryParts(e,t,n,r,i){let a=r===0?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,o=this._fastUpdates?.visualVariables.color,s=this._fastUpdates?.visualVariables.size,c=this._fastUpdates?.visualVariables.opacity,l=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:i,layerViewUid:l}),{renderingInfo:d}=e,f={position:t,size:s?null:this._getDrivenSize(d),color:o?null:this._getDrivenColor(d),sizeFeature:s?A(s,d.size):null,colorFeature:o?k(o,d.color):null,opacityFeature:c?k(c,d.opacity):null},p=r===0?this._context.drapeSourceRenderer.rendererContext.localOriginFactory:this._context.localOriginFactory,m=_(t,p),h={overlayInfo:a,removeDuplicateStartEnd:!1,mapPositions:n,attributeData:f},y=v(this._lineMaterial,h,m,u),b=g.LINE_WIREFRAMES?v(this._wireframeLineMaterial,h,m,u):null,x=this._markerMaterial,C=null;x!=null&&(h.attributeData={...f,color:o?null:this._getDrivenMarkerColor(d)},C=S(x,h,m));for(let e of[y,C,b])e!=null&&(e.layerViewUid=l,e.graphicUid=i);return{line:y,marker:C,wireframe:b}}_createAsOverlay(e){let t=e.graphic,{geometry:n}=t;this._lineMaterial.renderPriority=this._renderPriority;let r=g.LINE_WIREFRAMES?this._wireframeLineMaterial:null,i=this._markerMaterial;r!=null&&(r.renderPriority=this._renderPriority-.001),i!=null&&(i.renderPriority=this._renderPriority-.002);let a=[],o=l(),s=f(),c=b(n,this._context.overlaySR);this._logGeometryCreationWarnings(c,n.paths,`paths`,`LineSymbol3DLayer`);for(let n of c.lines){if(u(n.position,o),!d(o,this._context.clippingExtent))continue;p(s,o);let r=this._createGeometryParts(e,n.position,void 0,0,t.uid);r.marker!=null&&a.push(r.marker),a.push(r.line),r.wireframe!=null&&a.push(r.wireframe)}return new I(this,a,s,this._context.drapeSourceRenderer)}get _patternHidesLine(){return T(this.symbolLayer.pattern)}_computeMaterialWidth(e,t){return t?this._drivenProperties.size?1:e??1:(e??=o,this._drivenProperties.size?this._fastUpdates?.visualVariables.size?c:1:s(e))}_prepareMaterialPatch(e,t,n){let r=t.material;if(r==null){n.changed&&n.useMaterialColor&&G(this._getCombinedOpacityAndColor(this._materialColor),this._materials[2],e);return}if(r.type===`collection`)return;let a=r.type===`complete`?r.newValue?.color:r.diff.color?.type===`complete`?r.diff.color.newValue:null,o=this._getCombinedOpacityAndColor(a);n.useMaterialColor&&G(i(o),this._materials[2],e),this._patternHidesLine&&(o[3]=0),G(o,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){let n=t.marker,r=this._markerMaterial;if(n==null||n.type!==`partial`||n.diff==null||n.diff.placement!=null||n.diff.style!=null&&n.diff.style.type!==`complete`||n.diff.color!=null&&n.diff.color.type!==`complete`||r==null)return{changed:!1,useMaterialColor:this._markerColor==null};let i=n.diff.color,a=i!=null,o=a?i.newValue:null,s=o==null&&this._markerColor==null;o&&G(this._getCombinedOpacityAndColor(o),r,e);let c=n.diff.style?.newValue;return c&&e.symbolLayerStatePatches.push(()=>r.setParameters({markerPrimitive:V(c)})),delete t.marker,{changed:a,useMaterialColor:s}}_fastVisualVariableConvertOptions(e=!1){let n=this._getFallbackSize(),{size:r}=this.symbolLayer;return new j({supports:{size:!0,color:!0,rotation:!1,opacity:!0},symbolSize:t(r,r,r),fallbackColor:e?this._getFallbackMarkerOpacityAndColor(R):this._getFallbackOpacityAndColor(R),fallbackSize:t(n,n,n)})}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(e){return this.symbolLayer.marker?.color?.toUnitRGBA()??this._getFallbackOpacityAndColor(e)}_getFallbackMarkerOpacity(){return this.symbolLayer.marker?.color?.a??this._getFallbackOpacity()}_getWorldOrScreenSize(e){return this.symbol.worldSized?e:s(e)}_getFallbackSize(){return this._getWorldOrScreenSize(this.symbolLayer.size)}}function W(e){return e.type===`polyline`?e:null}function G(e,t,n){t!=null&&n.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function K(e){return(e.material?.color?.a??1)===1&&(e.marker?.color?.a??1)===1}export{U as Graphics3DLineSymbolLayer};
|
|
2
|
+
import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as n}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ZEROS as r,clone as i,ones as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{onePixelInPoints as o,pt2px as s,onePointInPixels as c}from"../../../../core/screenUtils.js";import{create as l,fromBuffer as u,intersectsClippingArea as d,empty as f,expandWithAABB as p}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as m}from"../../../../renderers/support/renderingInfoUtils.js";import{getTransformationType as h}from"../../../../renderers/visualVariables/support/sizeVariableUtils.js";import{debugFlags as g}from"../../support/debugFlags.js";import{selectLocalOrigin as _,createBufferGeometry as v}from"../../support/engineContent/line.js";import{geometryToRenderInfo as y,geometryToRenderInfoDraped as b}from"../../support/renderInfoUtils/line.js";import{BufferObject3D as x}from"../../webgl-engine/lib/BufferObject3D.js";import{createLineMarkerBufferGeometry as S}from"../../webgl-engine/materials/internal/lineMarkerBufferUtils.js";import{LineMarkerMaterial as C}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as w,patternHidesLine as T}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as E}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{initFastSymbolUpdatesState as D,updateFastSymbolUpdatesState as O,getAttributeValue as k,getSizeAttributeValue as A,ConvertOptions as j}from"../support/FastSymbolUpdates.js";import{perBufferLineElevationAligner as M}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as N,needsElevationUpdates2D as P}from"./elevationAlignmentUtils.js";import{Graphics3DBufferGraphicLayer as F}from"./Graphics3DBufferGraphicLayer.js";import{Graphics3DDrapedBufferGraphicLayer as I}from"./Graphics3DDrapedBufferGraphicLayer.js";import{Graphics3DSymbolLayer as L,nanFallbackColor as R}from"./Graphics3DSymbolLayer.js";import{parseCapType as z,computeSymbolLayerIndex as B,parseLineMarkerStyle as V}from"./lineUtils.js";const H=[`polyline`];class U extends L{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,K(t))}async doLoad(){if(this._fastUpdates=D(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastMarkerUpdates=D(this._context.renderer,this._fastVisualVariableConvertOptions(!0)),!this._drivenProperties.size&&(this.symbolLayer.size==null?o:this.symbolLayer.size)<0)throw new e(`graphics3dlinesymbollayer:invalid-size`,`Symbol sizes may not be negative values`)}_getMaterialParameters(e,t){let n=this._screenSizePerspective,r=!!has(`enable-feature:emissive-on-non-volumetric`)&&!this.draped,{symbolLayer:i}=this,{worldSized:a}=this.symbol,o={...this._getMaterialColorParameters(t),shadingEnabled:r,width:this._computeMaterialWidth(i.size,a),worldSized:a,polygonOffset:3,polygonOffsetIndex:B(this._renderPriority,this._renderPriorityStep),join:i.join||`miter`,cap:z(i.cap||`butt`),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:w(i.pattern??i.imagePattern),emissiveStrength:this._emissiveStrength,screenSizePerspective:n};if(t===2){if(this._fastMarkerUpdates?.visualVariables)return{...o,...this._fastMarkerUpdates.materialParameters}}else if(o.hasVertexColor=this._hasDrivenColorOrOpacity,o.hasVertexSize=this._drivenProperties.size,o.hasLineDistance=o.stipplePattern!=null,this._fastUpdates?.visualVariables)return{...o,...this._fastUpdates.materialParameters};return o}_getMaterialColorParameters(e){let t=e===2,n=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);return this._patternHidesLine&&!t&&(n[3]=0),{color:n}}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}get _markerColor(){return this.symbolLayer.marker?.color}get _lineMaterial(){return this._materials[0]??=new E(this._getMaterialParameters(!1,0),this.view),this._materials[0]}get _wireframeLineMaterial(){return this._materials[1]??=new E({...this._getMaterialParameters(!1,1),wireframe:!0},this.view),this._materials[1]}get _markerMaterial(){return this._materials[2]==null&&this.symbolLayer.marker!=null&&(this._materials[2]=new C({...this._getMaterialParameters(!1,2),placement:this.symbolLayer.marker.placement,markerPrimitive:V(this.symbolLayer.marker.style)},this.view.state.isGlobal)),this._materials[2]}_getDrivenSize(e){if(this._drivenProperties.size){let t=e.size;if(t==null)return this._getFallbackSize();let n=m(t.output);return this._getWorldOrScreenSize(n)}return 1}_getDrivenColor({color:e,opacity:t}){let i=a();return this._drivenProperties.color&&(n(i,e?.output??this._getFallbackOpacityAndColor(r)),t==null)||this._drivenProperties.opacity&&(e||this._materialColor)&&(i[3]=t?.output??this._getFallbackOpacity()),i}_getDrivenMarkerColor({color:e,opacity:t}){let i=a();return this._drivenProperties.color&&(n(i,e?.output??this._getFallbackMarkerOpacityAndColor(r)),t==null)||this._drivenProperties.opacity&&(e||this._markerColor||this._materialColor)&&(i[3]=t?.output??this._getFallbackMarkerOpacity()),i}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validatePolylineContext(e))return null;this._warnIfVVRequiresWorldSized(e.renderingInfo);let n=this.createElevationContextForGraphic(t),r=n.mode===`on-the-ground`;return this.ensureDrapedStatus(r),this.draped?this._createAsOverlay(e):this._createAs3DShape(e,n,t.uid)}_validatePolylineContext(e){let t=e.graphic.geometry;return this._validateGeometry(t,H,this.symbolLayer.type)&&t.type===`polyline`}applyRendererDiff(e,t){for(let n in e.diff)if(n===`visualVariables`){let e=this._fastUpdates;if(O(e,t,this._fastVisualVariableConvertOptions()))for(let t of this._materials)t instanceof E&&t.setParameters(e.materialParameters);else return 0;let n=this._fastMarkerUpdates;if(O(n,t,this._fastVisualVariableConvertOptions(!0)))for(let e of this._materials)e instanceof C&&e.setParameters(n.materialParameters);else return 0}else return 0;return`visualVariables`in e.diff&&this._warnIfVVRequiresWorldSized(),2}_warnIfVVRequiresWorldSized(e){if(this.symbol.worldSized||this.ignoreDrivers)return;let t=this._getSizeVariable(e);t==null||t.useSymbolValue||t.target===`outline`||h(t)===`real-world-size`&&this.logger.warnOnce(`SizeVariable uses real-world units, but LineSymbol3D.worldSized is false. Set LineSymbol3D.worldSized to true to render real-world line widths.`)}_getSizeVariable(e){let t=this._fastUpdates?.visualVariables.size;if(t)return t.variables[0];let n=e?.size,r=n?.output.findIndex(e=>typeof e==`number`);return r==null?null:n?.variables[r]}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff,n={};t.size?.type===`complete`&&(n.width=this._computeMaterialWidth(t.size.newValue,this.symbol.worldSized),delete t.size),t.cap?.type===`complete`&&(n.cap=z(t.cap.newValue??`butt`),delete t.cap);let r=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,r),e.symbolLayerStatePatches.push(()=>{for(let e of this._materials)e?.setParameters(n)})}layerOpacityChanged(){for(let e=0;e<3;e++)this._materials[e]?.setParameters(this._getMaterialColorParameters(e))}get _screenSizePerspective(){return!this.draped&&this._context.screenSizePerspectiveEnabled?this.view.screenSizePerspective.parameters:null}layerScreenSizePerspectiveChanged(){let e=this._screenSizePerspective;for(let t of this._materials)t?.setParameters({screenSizePerspective:e})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=N(U.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=P(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){let e={hasSlicePlane:this._context.slicePlaneEnabled};for(let t of this._materials)t?.setParameters(e);return!0}physicallyBasedRenderingChanged(){return!0}_createAs3DShape(e,t,n){let r=W(e.graphic.geometry);if(r==null)return null;let i=[],a=[],o=l(),s=y(r,this._context.elevationProvider,this._context.renderCoordsHelper,t);this._logGeometryCreationWarnings(s,r.paths,`paths`,`LineSymbol3DLayer`);for(let t=0;t<s.lines.length;t++){let r=s.lines[t],c=r.position,l=r.mapPositions;if(this._context.clippingExtent!=null&&(u(l,o),!d(o,this._context.clippingExtent)))continue;let f=this._createGeometryParts(e,c,l,1,n);a.push(f),i.push(f.line),f.wireframe!=null&&i.push(f.wireframe),f.marker!=null&&i.push(f.marker)}if(i.length===0)return null;let c=this._context.layerViewUid,f=new x({geometries:i,castShadows:!1,layerViewUid:c,graphicUid:n}),p=new F(this,f,null,(e,t,n,r,i)=>M(e,t,n,r,i,a),t);return p.alignedSampledElevation=s.sampledElevation,p.needsElevationUpdates=P(t.mode),p}_createGeometryParts(e,t,n,r,i){let a=r===0?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,o=this._fastUpdates?.visualVariables.color,s=this._fastUpdates?.visualVariables.size,c=this._fastUpdates?.visualVariables.opacity,l=this._context.layerViewUid,u=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:i,layerViewUid:l}),{renderingInfo:d}=e,f={position:t,size:s?null:this._getDrivenSize(d),color:o?null:this._getDrivenColor(d),sizeFeature:s?A(s,d.size):null,colorFeature:o?k(o,d.color):null,opacityFeature:c?k(c,d.opacity):null},p=r===0?this._context.drapeSourceRenderer.rendererContext.localOriginFactory:this._context.localOriginFactory,m=_(t,p),h={overlayInfo:a,removeDuplicateStartEnd:!1,mapPositions:n,attributeData:f},y=v(this._lineMaterial,h,m,u),b=g.LINE_WIREFRAMES?v(this._wireframeLineMaterial,h,m,u):null,x=this._markerMaterial,C=null;x!=null&&(h.attributeData={...f,color:o?null:this._getDrivenMarkerColor(d)},C=S(x,h,m));for(let e of[y,C,b])e!=null&&(e.layerViewUid=l,e.graphicUid=i);return{line:y,marker:C,wireframe:b}}_createAsOverlay(e){let t=e.graphic,{geometry:n}=t;this._lineMaterial.renderPriority=this._renderPriority;let r=g.LINE_WIREFRAMES?this._wireframeLineMaterial:null,i=this._markerMaterial;r!=null&&(r.renderPriority=this._renderPriority-.001),i!=null&&(i.renderPriority=this._renderPriority-.002);let a=[],o=l(),s=f(),c=b(n,this._context.overlaySR);this._logGeometryCreationWarnings(c,n.paths,`paths`,`LineSymbol3DLayer`);for(let n of c.lines){if(u(n.position,o),!d(o,this._context.clippingExtent))continue;p(s,o);let r=this._createGeometryParts(e,n.position,void 0,0,t.uid);r.marker!=null&&a.push(r.marker),a.push(r.line),r.wireframe!=null&&a.push(r.wireframe)}return new I(this,a,s,this._context.drapeSourceRenderer)}get _patternHidesLine(){return T(this.symbolLayer.pattern)}_computeMaterialWidth(e,t){return t?this._drivenProperties.size?1:e??1:(e??=o,this._drivenProperties.size?this._fastUpdates?.visualVariables.size?c:1:s(e))}_prepareMaterialPatch(e,t,n){let r=t.material;if(r==null){n.changed&&n.useMaterialColor&&G(this._getCombinedOpacityAndColor(this._materialColor),this._materials[2],e);return}if(r.type===`collection`)return;let a=r.type===`complete`?r.newValue?.color:r.diff.color?.type===`complete`?r.diff.color.newValue:null,o=this._getCombinedOpacityAndColor(a);n.useMaterialColor&&G(i(o),this._materials[2],e),this._patternHidesLine&&(o[3]=0),G(o,this._materials[0],e),delete t.material}_prepareMarkerPatch(e,t){let n=t.marker,r=this._markerMaterial;if(n==null||n.type!==`partial`||n.diff==null||n.diff.placement!=null||n.diff.style!=null&&n.diff.style.type!==`complete`||n.diff.color!=null&&n.diff.color.type!==`complete`||r==null)return{changed:!1,useMaterialColor:this._markerColor==null};let i=n.diff.color,a=i!=null,o=a?i.newValue:null,s=o==null&&this._markerColor==null;o&&G(this._getCombinedOpacityAndColor(o),r,e);let c=n.diff.style?.newValue;return c&&e.symbolLayerStatePatches.push(()=>r.setParameters({markerPrimitive:V(c)})),delete t.marker,{changed:a,useMaterialColor:s}}_fastVisualVariableConvertOptions(e=!1){let n=this._getFallbackSize(),{size:r}=this.symbolLayer;return new j({supports:{size:!0,color:!0,rotation:!1,opacity:!0},symbolSize:t(r,r,r),fallbackColor:e?this._getFallbackMarkerOpacityAndColor(R):this._getFallbackOpacityAndColor(R),fallbackSize:t(n,n,n)})}_getFallbackOpacityAndColor(e){return this._materialColor?.toUnitRGBA()??e}_getFallbackOpacity(){return this._materialColor?.a??0}_getFallbackMarkerOpacityAndColor(e){return this.symbolLayer.marker?.color?.toUnitRGBA()??this._getFallbackOpacityAndColor(e)}_getFallbackMarkerOpacity(){return this.symbolLayer.marker?.color?.a??this._getFallbackOpacity()}_getWorldOrScreenSize(e){return this.symbol.worldSized?e:s(e)}_getFallbackSize(){return this._getWorldOrScreenSize(this.symbolLayer.size)}}function W(e){return e.type===`polyline`?e:null}function G(e,t,n){t!=null&&n.symbolLayerStatePatches.push(()=>t.setParameters({color:e}))}function K(e){return(e.material?.color?.a??1)===1&&(e.marker?.color?.a??1)===1}export{U as Graphics3DLineSymbolLayer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import{normalFromMat4 as n,fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as a,multiply as o,invert as s,getTranslation as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l,IDENTITY as u,clone as d}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as p,add as m,scale as h,transformMat4 as g,transformMat3 as _,normalize as v,scaleAndAdd as y,subtract as b,cross as x,dot as ee}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as te,ZEROS as ne,ONES as re,create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as ie}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{releaseMaybe as ae}from"../../../../core/maybe.js";import{isPromiseLike as oe}from"../../../../core/promiseUtils.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as se}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as ce}from"../../../../geometry/projection/projectVectorToVector.js";import{canProjectWithoutEngine as le}from"../../../../geometry/projectionUtils.js";import{fromBuffer as ue,intersectsClippingArea as de,create as fe}from"../../../../geometry/support/aaBoundingBox.js";import{t as w}from"../../../../chunks/vec3.js";import{newFloatArray as T}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as E,getContinuousIndexArray as pe}from"../../../../geometry/support/Indices.js";import me from"../../../../geometry/support/MeshComponent.js";import he from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import ge from"../../../../geometry/support/MeshTextureTransform.js";import{transformNormal as D,transformVectorENUPlateCarree as O,transformVectorWMPlateCarree as k,projectNormalToPCPF as _e,transformTangent as A,projectTangentToPCPF as ve}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as ye}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{projectLocalVertexSpaceToPCPF as be}from"../../../../geometry/support/meshUtils/vertexSpaceConversion.js";import{isRelativeVertexSpace as xe,isAbsoluteVertexSpace as Se}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as j,isPlateCarree as M}from"../../../../geometry/support/spatialReferenceUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as Ce}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{getEmissiveMode as we}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as Te}from"../../glTF/internal/resourceUtils.js";import{convertMeshTextureTransformToGLTF as N,getTransformMatrix as P}from"../../glTF/internal/TextureTransformUtils.js";import{debugFlags as F}from"../../support/debugFlags.js";import{Attribute as I}from"../../webgl-engine/lib/Attribute.js";import{Geometry as L}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as Ee}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as De}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Oe}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as R}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as ke,advancedMRRFactors as Ae,schematicMRRFactors as je}from"../../webgl-engine/materials/pbrUtils.js";import{hasEdges as Me,createMaterial as Ne}from"../support/edgeUtils.js";import{defaultSymbolLayerMemoryComplexity as Pe}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{needsElevationUpdates3D as B,evaluateElevationInfoAtPoint as V}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as Fe}from"./emissiveUtils.js";import{Graphics3DMeshObject3DGraphicLayer as Ie}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as Le}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as Re,nanFallbackColor as ze}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as Be,MeshFastUpdateProcessor as Ve}from"./MeshFastUpdateProcessor.js";import{addOlidAttribute as He}from"./olidUtils.js";import{SymbolComplexity as Ue}from"./SymbolComplexity.js";const We=[`mesh`];class Ge extends Re{constructor(e,t,n,r){super(e,t,n,r,Ce(t)),this._materialInfoCache=new Be,this._fastUpdateProcessor=new Ve,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){F.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new R({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new R({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new R({color:[0,1,1,1]})),this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,We,`fill on mesh-3d`))return null;let n=this.createElevationContextForGraphic(t),r=e.renderingInfo;return this._createAs3DShape(t,r,n,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){let n=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:n});let t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(n,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,B)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicallyBasedRenderingChanged(){let e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateMeshTransform(e,t,n,r,i){if(!e.fastTransformUpdatesAllowed)return!1;let a=e.fastTransformUpdatesEnabled;switch(i){case 0:if(a)return!0;break;case 1:if(!a)return!0}let o=this._context.renderCoordsHelper.spatialReference,s=it,{origin:c,transform:l}=n;if(!C(t.spatialReference,p(J,c.x,c.y,c.z??0),s,o))return!1;switch(i){case void 0:a||this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context,!0);break;case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:if(this._fastUpdateProcessor.disable(e,this._materialInfoCache),t.vertexSpace.type===`local`)return!1}e.updateFastLocalOrigin(s,l,this._context.localOriginFactory,!1);let{elevationContext:u}=e;u.centerInElevationSR=this._getCenterInElevationSR(s);let{elevationProvider:d,renderCoordsHelper:f}=this._context;return e.alignedSampledElevation=z(e,u,d.spatialReference,(e,t)=>V(e,d,u,f,t),f,s),e.updateTransform(s,l,this._context.isAsync,r),!0}computeComplexity(){if(!this._textures||this._textures.size===0)return super.computeComplexity();let e=0;for(let t of this._textures.values())e+=t.usedMemory;let t={...Pe(this.symbol,this.symbolLayer),resourceBytes:e},n=Me(this.symbolLayer)?2:0;return new Ue({drawCallsPerFeature:n,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){let n=this._requiresSymbolVertexColors(),r=!!e.vertexAttributes.color,i=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:n,hasVertexColors:r,hasVertexTangents:i,unlit:!1,uid:`vc:${r},vt:${i},vct${t},svc:${n}`}}_materialProperties(e,t,n){let r=this._materialPropertiesDefault(e,n);if(!t.material)return r;let{color:i,colorTexture:a,colorTextureTransform:o,normalTexture:s,normalTextureTransform:c,doubleSided:l,alphaCutoff:u,alphaMode:d}=t.material,f=G(i),p=G(a),m=K(o),h=G(s),g=K(c);if(r.color=i,r.colorTexture=a,r.normalTexture=s,r.uid=`${r.uid},cmuid:${f},ctmuid:${p},cttuid:${m},ntmuid:${h},nttuid:${g},ds:${l},ac:${u},am:${d}`,t.material instanceof he){let{metallic:e,roughness:n,metallicRoughnessTexture:i,metallicRoughnessTextureTransform:a,emissiveColor:s,emissiveStrength:l,emissiveTexture:u,emissiveTextureTransform:d,occlusionTexture:f,occlusionTextureTransform:p,unlit:m}=t.material,h=G(i),g=K(a),_=G(s),v=G(u),y=K(d),b=G(f),x=K(p);r.uid=[r.uid,`mrm:${e}`,`mrr:${n}`,`mrt:${h}`,`mrtt:${g}`,`emuid:${_}`,`ems:${l}`,`etmuid:${v}`,`ett:${y}`,`otmuid:${b}`,`ott:${x}`,`unlit:${m}`].join(`,`),r.metallic=e,r.roughness=n,r.metallicRoughnessTexture=i,r.emissiveColor=m?void 0:s,r.emissiveStrength=l,r.emissiveTexture=m?void 0:u,r.occlusionTexture=f,r.unlit=m,r.colorTextureTransform=N(o),r.normalTextureTransform=N(c),r.emissiveTextureTransform=N(d),r.occlusionTextureTransform=N(p),r.metallicRoughnessTextureTransform=N(a)}return r}_getInternalTexture(e,t=!1,n=1){let r=tt(e);if(!r)return null;let i=`${e.contentHash}/${n}`,a=this._textures.get(i);if(a){let e=this._context.stage.renderView.textures,t=null,n=e.acquire(a.id);return n!=null&&!oe(n)&&(a.events.on(`unloaded`,()=>t=ae(t)),t=n),a}let o=null,s=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,c={wrap:Qe(e.wrap),noUnpackFlip:!0,maxAnisotropy:s,mipmap:s>1};return Te(r)?(o=r.data,c.preMultiplyAlpha=!1,c.encoding=r.encoding):(o=r,c.preMultiplyAlpha=n!==1,c.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),a=new Ee(o,c),this._textures.set(i,a),a.events.on(`loaded`,()=>this.updateComplexity()),a.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(a),a.events.on(`unloaded`,()=>{this._textures.delete(i)}),a}_setInternalMaterialTextureParameters(e,n){if(e.colorTexture!=null){let t=n.textureAlphaMode!==1,r=this._getInternalTexture(e.colorTexture,t,n.textureAlphaMode);r?(n.textureId=r.id,n.textureAlphaPremultiplied=!!r.parameters.preMultiplyAlpha):n.textureId=void 0}if(e.normalTexture&&(n.normalTextureId=this._getInternalTexture(e.normalTexture)?.id),e.emissiveColor){let r=e.emissiveColor?.toUnitRGB();n.emissiveBaseColor=te(t(r[0]),t(r[1]),t(r[2]))}e.emissiveStrength&&(n.emissiveStrengthKHR=e.emissiveStrength),e.emissiveTexture&&(n.emissiveTextureId=this._getInternalTexture(e.emissiveTexture)?.id),e.occlusionTexture&&(n.occlusionTextureId=this._getInternalTexture(e.occlusionTexture,!0)?.id),e.metallicRoughnessTexture&&(n.metallicRoughnessTextureId=this._getInternalTexture(e.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,n){e.color!=null&&et(e.color,t,n),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=P(e.colorTextureTransform),t.normalTextureTransformMatrix=P(e.normalTextureTransform);let r=e.normalTextureTransform?.scale==null?f:e.normalTextureTransform?.scale;t.normalScale=[r[0],r[1]],t.occlusionTextureTransformMatrix=P(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=P(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=P(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e,t=this._materialColor){let n=this._drivenProperties.color,r=this._drivenProperties.opacity;if(n)e.externalColor=ie;else{let n=t??null;if(n){let t=n.toUnitRGBA();r&&(t[3]=1),e.externalColor=t}else e.externalColor=ze}e.colorMixMode=this.symbolLayer.material?.colorMixMode??`multiply`,e.castShadows=!!this.symbolLayer.castShadows,e.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,e.emissiveSource=we(this.symbolLayer?.material?.emissive?.source??`emissive`)}_getOrCreateMaterial(e,t){let n=t.material?.color,r=t.material?.colorTexture,i=t.material?.alphaMode,a=i===`blend`,o=i!==`opaque`&&($e(e)||n!=null&&n.a<1||r?.transparent||a),s=this._materialProperties(e,t,o),c=this._materialInfoCache.byUid(s.uid);if(c)return this._setInternalMaterialTextureParameters(s,c.material.parameters),c.material;let l={uid:s.uid,material:null,isComponentTransparent:o,alphaMode:t.material?t.material.alphaMode:`opaque`},u=ke({normalTexture:s.normalTexture,metallicRoughnessTexture:s.metallicRoughnessTexture,metallicFactor:s.metallic,roughnessFactor:s.roughness,emissiveTexture:s.unlit?void 0:s.emissiveTexture,emissiveFactor:s.unlit?ne:s.emissiveColor?.toUnitRGB(),occlusionTexture:s.occlusionTexture}),d={usePBR:this._usePBR(),isSchematic:u,hasVertexColors:s.hasVertexColors,hasSymbolColors:s.hasSymbolVertexColors,hasVertexTangents:s.hasVertexTangents,ambient:ne,diffuse:re,opacity:1,doubleSided:!0,doubleSidedType:`winding-order`,cullFace:0,unlit:s.unlit,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||l.isComponentTransparent};d.mrrFactors=u?je:[s.metallic,s.roughness,Ae[2]],t.material&&(d.doubleSided=t.material.doubleSided,d.cullFace=t.material.doubleSided?0:2,d.textureAlphaCutoff=t.material.alphaCutoff),this._setExternalMaterialParameters(d),this._setMaterialTextureAlphaMode(d,l),this._setInternalMaterialParameters(s,d,l);let f=new Oe(d,this._context.spherical);return l.material=f,this._materialInfoCache.set(s.uid,l),f}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}_preparePatchColor(e,t){if(!t.material||t.material.type!==`partial`)return;let n=t.material.diff;if(!n.color||n.color.type!==`complete`||n.color.newValue==null||n.color.oldValue==null)return;let r=n.color.newValue;delete n.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{let t=e.material.parameters;this._setExternalMaterialParameters(t,r),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_preparePatchEmissive(e,t){return Fe(e,t,e=>{this._updateMaterialParameters(t=>{t.material.setParameters({emissiveStrengthFromSymbol:e??1})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_usePBR(){return this._context.physicallyBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){e.textureAlphaMode=t.alphaMode===`auto`?this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1?3:1:t.alphaMode===`opaque`?1:t.alphaMode===`mask`?2:0}_createFaceDebugNormals(e,t){let r=t.length,a=e.spatialReference.isGeographic?20015077/180:1,o=.1*Math.max(e.extent.width*a,e.extent.height*a,e.extent.zmax-e.extent.zmin),s=[],c=[],l=t[0].transformation,u=n(i(),l);for(let e=0;e<r;e++){let n=t[e].attributes.get(`position`);if(!n)continue;let r=n.data,i=n.indices;for(let e=0;e<i.length;e+=3)U(r,i,e,Z),Ze(r,i,e,J,Y,X),m(J,J,Y),m(J,J,X),h(J,J,1/3),g(J,J,l),s.push(...J),_(Z,Z,u),v(Z,Z),y(J,J,Z,o),s.push(...J),c.push(c.length),c.push(c.length)}return s.length?new L(this._debugFaceNormalMaterial,[[`position`,new I(s,c,3,!0)]],null):null}_createPerVertexDebugVectors(e,t,a,o,s){let c=t.length,l=e.spatialReference.isGeographic?20015077/180:1,u=s*.1*Math.max(e.extent.width*l,e.extent.height*l,e.extent.zmax-e.extent.zmin),d=[],f=[],m=t[0].transformation,h=n(i(),m);a===`tangent`&&r(h,m);for(let e=0;e<c;e++){let n=t[e],r=n.attributes.get(`position`),i=n.attributes.get(a);if(!r||!i)continue;let o=r.data,s=r.indices,c=i.data,l=i.indices;for(let e=0;e<s.length;e++){let t=s[e]*3,n=l[e]*i.stride;p(J,o[t+0],o[t+1],o[t+2]),g(J,J,m),d.push(...J),p(Y,c[n+0],c[n+1],c[n+2]),_(Y,Y,h),v(Y,Y),y(J,J,Y,u),d.push(...J),f.push(f.length),f.push(f.length)}}return d.length?new L(o,[[`position`,new I(d,f,3,!0)]],null):null}_createAs3DShape(e,t,n,r){let i=e.geometry;if(i.type!==`mesh`)return null;let a=this._createGeometryInfo(i,t,r);if(a==null)return null;let{geometries:o,objectTransformation:s}=a;if(F.DRAW_MESH_GEOMETRY_NORMALS){let e=this._createPerVertexDebugVectors(i,o,`normal`,this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(i,o,`tangent`,this._debugTangentNormalMaterial,.5),n=this._createFaceDebugNormals(i,o);e&&o.push(e),t&&o.push(t),n&&o.push(n)}let c=this._context.layerViewUid,l=new De({geometries:o,layerViewUid:c,graphicUid:r,isElevationSource:!0});l.transformation=s;let u=Ne(this.symbolLayer,{opacity:this._getLayerOpacity()}),d=u?new Le(o[0].material,u,this._context.slicePlaneEnabled):null,f=new Ie(this,l,null,z,n,d);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=B(n.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(i),n.centerInElevationSR=this._getCenterInElevationSR(l.transformation);let{elevationProvider:p,renderCoordsHelper:m}=this._context;return f.alignedSampledElevation=z(f,n,p.spatialReference,(e,t)=>V(e,p,n,m,t),m),f}_fastTransformUpdatesAllowed(e){let{vertexSpace:t,spatialReference:n}=e;if(!xe(t))return!1;let{type:r}=t,{view:i}=this._context.graphicsCoreOwner,{isGlobal:a,isLocal:o}=i.state,s=i.spatialReference;return a&&r===`local`||o&&j(s,n)&&r===`georeferenced`&&!n.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){let t=S(),n=p(ot,e[12],e[13],e[14]);return ce(n,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return e.reprojection===0&&!!e.objectTransformation}_createPositionBuffer(e,t,n){let r=n.position,i=r,a;if(t.reprojection===0)return{position:i,georeferencedPositionBuffer:a};let o=t.reprojection===1?t.transformBeforeProject:null;o&&(i=w(new Float64Array(i.length),i,o));let{normal:s,tangent:c}=n;!this._passthroughReprojectionInfo(t)&&(s||c)&&(a=i);let l=i===r||i===a?new Float64Array(i.length):i;return se(i,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:a}}_createNormalBuffer(e,t,n,r,i){let a=i.normal;if(a==null)return null;let o=a,s=r.reprojection===1?r.transformBeforeProject:null;s&&(o=D(o,new Float32Array(o.length),s));let c=this._context.graphicsCoreOwner.view.viewingMode;if(r.reprojection===0)return o;if(c===`local`){if(!M(this._context.renderCoordsHelper.spatialReference))return o;if(n==null)return null;if(e.spatialReference.isGeographic){let e=o===a?new Float32Array(o.length):o;return O(o,0,n,e)}if(e.spatialReference.isWebMercator){let e=o===a?new Float32Array(o.length):o;return k(o,0,n,e)}return o}if(n==null)return null;let l=o===a?new Float32Array(o.length):o,u=this._context.renderCoordsHelper.spatialReference;return _e(o,n,e.spatialReference,t,u,l)}_createTangentBuffer(e,t,n,r,i){let a=i.tangent;if(a==null)return null;let o=a,s=r.reprojection===1?r.transformBeforeProject:null;s&&(o=A(o,new Float32Array(o.length),s));let c=this._context.graphicsCoreOwner.view.viewingMode;if(r.reprojection===0)return o;if(c===`local`){if(!M(this._context.renderCoordsHelper.spatialReference))return o;if(n==null)return null;if(e.spatialReference.isGeographic){let e=o===a?new Float32Array(o.length):o;return O(o,1,n,e)}if(e.spatialReference.isWebMercator){let e=o===a?new Float32Array(o.length):o;return k(o,1,n,e)}return o}if(n==null)return null;let l=o===a?new Float32Array(o.length):o,u=this._context.renderCoordsHelper.spatialReference;return ve(o,n,e.spatialReference,t,u,l)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){let n=e.vertexAttributes&&e.vertexAttributes.position;if(!n)return this.logger.warn(`Mesh geometry must contain position vertex attributes`),null;let r=e.vertexAttributes.normal,i=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(r&&r.length!==n.length)return this.logger.warn(`Mesh normal vertex buffer must contain the same number of elements as the position buffer`),null;if(a&&a.length/4!=n.length/3)return this.logger.warn(`Mesh tangent vertex buffer must contain the same number of elements as the position buffer`),null;if(i&&i.length/2!=n.length/3)return this.logger.warn(`Mesh uv vertex buffer must contain the same number of elements as the position buffer`),null;let o=this._computeReprojectionInfo(e),s=o.reprojection===1&&o.convertLocalVertexSpace,c=s&&e.vertexSpace.type===`local`?be(e,e.vertexSpace,this._context.renderCoordsHelper.spatialReference):null;if(s&&!c)return this.logger.warn(`Local mesh vertex space could not be converted for rendering`),null;let{position:l,georeferencedPositionBuffer:u}=c?{position:c.position,georeferencedPositionBuffer:null}:this._createPositionBuffer(e,o,e.vertexAttributes),d=nt(e),f=this._createSymbolColorBuffer(t),p=c?c.normal:this._createNormalBuffer(e,l,u,o,e.vertexAttributes),m=c?c.tangent:this._createTangentBuffer(e,l,u,o,e.vertexAttributes),h=i,{geometryTransformation:g}=o,{transformation:_,position:v,normal:y,tangent:b}=this._passthroughReprojectionInfo(o)?{transformation:o.objectTransformation,position:l,normal:p,tangent:m}:this._expressInOriginLocalSpace(e,l,p,m,g);return{positionBuffer:v,normalBuffer:y,tangentBuffer:b,uvBuffer:h,colorBuffer:d,symbolColorBuffer:f,objectTransformation:_,geometryTransformation:g}}_computeReprojectionInfo(e){let{vertexSpace:t}=e,n=t.type===`georeferenced`,r=t.type===`local`&&this._context.graphicsCoreOwner.view.state.isGlobal,i=n?+!j(this._context.renderCoordsHelper.spatialReference,e.spatialReference):+!!r;if(Se(t))return{reprojection:i,geometryTransformation:l()};let s=t.origin,c=e.transform?.localMatrix??u;if(i===0){let t=l();return C(e.spatialReference,s,t,this._context.renderCoordsHelper.spatialReference),{reprojection:i,objectTransformation:t,geometryTransformation:d(c)}}if(r)return{reprojection:i,convertLocalVertexSpace:!0,geometryTransformation:d(c)};let f=a(l(),s);return o(f,f,c),{reprojection:i,transformBeforeProject:f,geometryTransformation:l()}}_expressInOriginLocalSpace(e,t,n,r,i){let a=this._context.renderCoordsHelper.spatialReference,c=e.origin;q[0]=c.x,q[1]=c.y,q[2]=c.z??0;let u=l();C(e.spatialReference,q,u,a),o(Q,u,i),s(Q,Q);let{position:d,normal:f,tangent:p}=e.vertexAttributes,m=t===d?new Float64Array(t.length):t;w(m,t,Q);let h=n?n===f?new Float32Array(n.length):n:null,g=r?r===p?new Float32Array(r.length):r:null;return n&&h&&D(n,h,Q),r&&g&&A(r,g,Q),{transformation:u,position:m,normal:h,tangent:g}}_validateFaces(e,t){let n=e.vertexAttributes.position.length/3,r=t.faces;if(r&&r.length>0){let e=-1;for(let t=0;t<r.length;t++){let n=r[t];n>e&&(e=n)}if(n<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(n%3!=0)return this.logger.warn(`Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)`),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent||!e.vertexAttributes?.position)return!1;let t=this._context.elevationProvider.spatialReference,n=ye(e,t??e.spatialReference);return n?(ue(n,$),!de($,this._context.clippingExtent)):!1}_createGeometryInfo(e,t,n){if(!le(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn(`Geometry spatial reference is not compatible with the view`),null;if(!this._validateVertexSpace(e)||this._isOutsideClippingArea(e))return null;let r=this._createBuffers(e,t);if(r==null)return null;let{positionBuffer:i,uvBuffer:a,colorBuffer:o,symbolColorBuffer:s,normalBuffer:l,tangentBuffer:u,objectTransformation:d,geometryTransformation:f}=r,p=e.components??at,m=[],h=!1,g=c(J,d),_=this._context.localOriginFactory.getOrigin(g);for(let t of p){if(!this._validateFaces(e,t))return null;let r=Ke(e,t);if(r.length===0)continue;let c=qe(i,l,t,r);c.didFlipNormals&&(h=!0);let d=[[`position`,new I(i,r,3,!0)],[`normal`,new I(c.normals,c.indices,3,!0)]];o&&d.push([`color`,new I(o,r,4,!0)]);let p=null;s&&(p=E(r.length),d.push([`symbolColor`,new I(s,p,4,!0)])),a&&d.push([`uv0`,new I(a,r,2,!0)]),u&&d.push([`tangent`,new I(u,r,4,!0)]);let g=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:this._context.layerViewUid});g&&(p??=E(r.length),He(d,g,p));let v=this._getOrCreateMaterial(e,t),y=new L(v,d,null);y.transformation=f,y.localOrigin=_,m.push(y)}return h&&this.logger.warn(`Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals.`),m.length===0?null:{geometries:m,objectTransformation:d}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){return this._context.graphicsCoreOwner.view.state.isLocal&&e.vertexSpace.type===`local`?(this.logger.warn(`Displaying a mesh with a local vertex space in a view in local viewing mode is not supported.`),!1):!0}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class H{constructor(e,t,n){this.normals=e,this.indices=t,this.didFlipNormals=n}}function Ke(e,t){return t.faces??pe(e.vertexAttributes.position.length/3)}function qe(e,t,n,r){switch(n.shading||`flat`){default:case`source`:return Ye(e,t,n,r);case`flat`:return Je(e,r);case`smooth`:return Xe(e,r)}}function Je(e,t){let n=T(t.length),r=Array(t.length*3);for(let i=0;i<t.length;i+=3){let a=U(e,t,i,Z);for(let e=0;e<3;e++)n[i+e]=a[e],r[i+e]=i/3}return new H(n,r,!1)}function Ye(e,t,n,r){if(t==null)return Je(e,r);let i=!1;if(!n.trustSourceNormals)for(let n=0;n<r.length;n+=3){U(e,r,n,Z);for(let e=0;e<3;e++){let a=r[n+e]*3;J[0]=t[a],J[1]=t[a+1],J[2]=t[a+2],ee(Z,J)<0&&(t[a]=-t[a],t[a+1]=-t[a+1],t[a+2]=-t[a+2],i=!0)}}return new H(t,r,i)}function Xe(e,t){let n={};for(let r=0;r<t.length;r+=3){let i=U(e,t,r,Z);for(let e=0;e<3;e++){let a=t[r+e],o=n[a];o||(o={normal:S(),count:0},n[a]=o),m(o.normal,o.normal,i),o.count++}}let r=T(t.length*3),i=Array(t.length*3);for(let e=0;e<t.length;e++){let a=n[t[e]];a.count!==1&&(v(a.normal,a.normal),a.count=1);for(let t=0;t<3;t++)r[e*3+t]=a.normal[t];i[e]=e}return new H(r,i,!1)}function Ze(e,t,n,r,i,a){let o=t[n]*3,s=t[n+1]*3,c=t[n+2]*3;r[0]=e[o],r[1]=e[o+1],r[2]=e[o+2],i[0]=e[s],i[1]=e[s+1],i[2]=e[s+2],a[0]=e[c],a[1]=e[c+1],a[2]=e[c+2]}function U(e,t,n,r){return Ze(e,t,n,J,Y,X),b(Y,Y,J),b(X,X,J),x(J,Y,X),v(r,J),r}function Qe(e=`repeat`){if(typeof e==`string`){let t=W(e);return{s:t,t}}return{s:W(e.horizontal),t:W(e.vertical)}}function W(e){switch(e){case`clamp`:return 33071;case`mirror`:return 33648;default:return 10497}}function $e(e){let t=e.vertexAttributes.color;if(t==null)return!1;for(let e=3;e<t.length;e+=4)if(t[e]!==255)return!0;return!1}function et(e,t,n){t.diffuse=e.toUnitRGB(),t.opacity=n.alphaMode===`opaque`?1:e.a}function tt(e){return e.data??e.url}function G(t){return t==null?`-`:t instanceof e?t.toHex():t.contentHash}function K(e){let{offset:t,scale:n,rotation:r}=e??rt;return`${t[0]},${t[1]},${r},${n[0]},${n[1]}`}function nt(e){return e.vertexAttributes.color}const rt=new ge,q=S(),J=S(),Y=S(),X=S(),Z=S(),Q=l(),it=l(),$=fe(),at=[new me],ot=S();export{Ge as Graphics3DMeshFillSymbolLayer};
|
|
2
|
+
import e from"../../../../Color.js";import{linearize as t}from"../../../../colorUtils.js";import{normalFromMat4 as n,fromMat4 as r}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as a,multiply as o,invert as s,getTranslation as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l,IDENTITY as u,clone as d}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as p,add as m,scale as h,transformMat4 as g,transformMat3 as _,normalize as v,scaleAndAdd as y,subtract as b,cross as ee,dot as te}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as ne,ZEROS as x,ONES as re,create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as ie}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{releaseMaybe as ae}from"../../../../core/maybe.js";import{isPromiseLike as oe}from"../../../../core/promiseUtils.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as se}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as ce}from"../../../../geometry/projection/projectVectorToVector.js";import{canProjectWithoutEngine as le}from"../../../../geometry/projectionUtils.js";import{fromBuffer as ue,intersectsClippingArea as de,create as fe}from"../../../../geometry/support/aaBoundingBox.js";import{t as w}from"../../../../chunks/vec3.js";import{newFloatArray as T}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as E,getContinuousIndexArray as pe}from"../../../../geometry/support/Indices.js";import me from"../../../../geometry/support/MeshComponent.js";import he from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import ge from"../../../../geometry/support/MeshTextureTransform.js";import{transformNormal as D,transformVectorENUPlateCarree as O,transformVectorWMPlateCarree as k,projectNormalToPCPF as _e,transformTangent as A,projectTangentToPCPF as ve}from"../../../../geometry/support/meshUtils/projection.js";import{projectMeshVertexPositions as ye}from"../../../../geometry/support/meshUtils/projectMeshVertexPositions.js";import{projectLocalVertexSpaceToPCPF as be}from"../../../../geometry/support/meshUtils/vertexSpaceConversion.js";import{isRelativeVertexSpace as xe,isAbsoluteVertexSpace as Se}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as j,isPlateCarree as M}from"../../../../geometry/support/spatialReferenceUtils.js";import{isDrivenOpacityFallbackAlwaysOpaque as Ce}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{getEmissiveMode as we}from"../../../../symbols/support/materialUtils.js";import{isEncodedMeshTexture as Te}from"../../glTF/internal/resourceUtils.js";import{convertMeshTextureTransformToGLTF as N,getTransformMatrix as P}from"../../glTF/internal/TextureTransformUtils.js";import{debugFlags as F}from"../../support/debugFlags.js";import{Attribute as I}from"../../webgl-engine/lib/Attribute.js";import{Geometry as Ee}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as L}from"../../webgl-engine/lib/GeometryUtil.js";import{ManagedTexture as De}from"../../webgl-engine/lib/ManagedTexture.js";import{Object3D as Oe}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as ke}from"../../webgl-engine/materials/DefaultMaterial.js";import{useSchematicPBR as Ae,advancedMRRFactors as je,schematicMRRFactors as Me}from"../../webgl-engine/materials/pbrUtils.js";import{RibbonLineMaterial as R}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{hasEdges as Ne,createMaterial as Pe}from"../support/edgeUtils.js";import{defaultSymbolLayerMemoryComplexity as Fe}from"./defaultSymbolComplexity.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{needsElevationUpdates3D as B,evaluateElevationInfoAtPoint as V}from"./elevationAlignmentUtils.js";import{preparePatchEmissiveStrength as Ie}from"./emissiveUtils.js";import{Graphics3DMeshObject3DGraphicLayer as Le}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as Re}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as ze,nanFallbackColor as Be}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as Ve,MeshFastUpdateProcessor as He}from"./MeshFastUpdateProcessor.js";import{addOlidAttribute as Ue}from"./olidUtils.js";import{SymbolComplexity as We}from"./SymbolComplexity.js";const Ge=[`mesh`];class Ke extends ze{constructor(e,t,n,r){super(e,t,n,r,Ce(t)),this._materialInfoCache=new Ve,this._fastUpdateProcessor=new He,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){if(F.DRAW_MESH_GEOMETRY_NORMALS){let e=this._context.stage.view;this._debugVertexNormalMaterial=new R({color:[1,0,1,1],width:1},e),this._debugTangentNormalMaterial=new R({color:[1,.5,0,1],width:1},e),this._debugFaceNormalMaterial=new R({color:[0,1,1,1],width:1},e)}this.updateComplexity()}destroy(){super.destroy(),this._textures.forEach(e=>e.unload()),this._context.stage.removeTextures(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy()}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,Ge,`fill on mesh-3d`))return null;let n=this.createElevationContextForGraphic(t),r=e.renderingInfo;return this._createAs3DShape(t,r,n,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache)}layerOpacityChanged(e,t){let n=this._getLayerOpacity();this._updateMaterialParameters(e=>{e.material.setParameters({layerOpacity:n});let t=e.material.parameters;this._setMaterialTextureAlphaMode(t,e)}),e?.forEach(e=>t(e)?.layerOpacityChanged(n,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,B)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters(({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),e?.forEach(e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)),!0}physicallyBasedRenderingChanged(){let e=this._usePBR();return this._updateMaterialParameters(({material:t})=>t.setParameters({usePBR:e})),!0}updateMeshTransform(e,t,n,r,i){if(!e.fastTransformUpdatesAllowed)return!1;let a=e.fastTransformUpdatesEnabled;switch(i){case 0:if(a)return!0;break;case 1:if(!a)return!0}let o=this._context.renderCoordsHelper.spatialReference,s=at,{origin:c,transform:l}=n;if(!C(t.spatialReference,p(J,c.x,c.y,c.z??0),s,o))return!1;switch(i){case void 0:a||this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context,!0);break;case 0:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case 1:if(this._fastUpdateProcessor.disable(e,this._materialInfoCache),t.vertexSpace.type===`local`)return!1}e.updateFastLocalOrigin(s,l,this._context.localOriginFactory,!1);let{elevationContext:u}=e;u.centerInElevationSR=this._getCenterInElevationSR(s);let{elevationProvider:d,renderCoordsHelper:f}=this._context;return e.alignedSampledElevation=z(e,u,d.spatialReference,(e,t)=>V(e,d,u,f,t),f,s),e.updateTransform(s,l,this._context.isAsync,r),!0}computeComplexity(){if(!this._textures||this._textures.size===0)return super.computeComplexity();let e=0;for(let t of this._textures.values())e+=t.usedMemory;let t={...Fe(this.symbol,this.symbolLayer),resourceBytes:e},n=Ne(this.symbolLayer)?2:0;return new We({drawCallsPerFeature:n,memory:t})}_requiresSymbolVertexColors(){return this._hasDrivenColorOrOpacity}_materialPropertiesDefault(e,t){let n=this._requiresSymbolVertexColors(),r=!!e.vertexAttributes.color,i=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:n,hasVertexColors:r,hasVertexTangents:i,unlit:!1,uid:`vc:${r},vt:${i},vct${t},svc:${n}`}}_materialProperties(e,t,n){let r=this._materialPropertiesDefault(e,n);if(!t.material)return r;let{color:i,colorTexture:a,colorTextureTransform:o,normalTexture:s,normalTextureTransform:c,doubleSided:l,alphaCutoff:u,alphaMode:d}=t.material,f=G(i),p=G(a),m=K(o),h=G(s),g=K(c);if(r.color=i,r.colorTexture=a,r.normalTexture=s,r.uid=`${r.uid},cmuid:${f},ctmuid:${p},cttuid:${m},ntmuid:${h},nttuid:${g},ds:${l},ac:${u},am:${d}`,t.material instanceof he){let{metallic:e,roughness:n,metallicRoughnessTexture:i,metallicRoughnessTextureTransform:a,emissiveColor:s,emissiveStrength:l,emissiveTexture:u,emissiveTextureTransform:d,occlusionTexture:f,occlusionTextureTransform:p,unlit:m}=t.material,h=G(i),g=K(a),_=G(s),v=G(u),y=K(d),b=G(f),ee=K(p);r.uid=[r.uid,`mrm:${e}`,`mrr:${n}`,`mrt:${h}`,`mrtt:${g}`,`emuid:${_}`,`ems:${l}`,`etmuid:${v}`,`ett:${y}`,`otmuid:${b}`,`ott:${ee}`,`unlit:${m}`].join(`,`),r.metallic=e,r.roughness=n,r.metallicRoughnessTexture=i,r.emissiveColor=m?void 0:s,r.emissiveStrength=l,r.emissiveTexture=m?void 0:u,r.occlusionTexture=f,r.unlit=m,r.colorTextureTransform=N(o),r.normalTextureTransform=N(c),r.emissiveTextureTransform=N(d),r.occlusionTextureTransform=N(p),r.metallicRoughnessTextureTransform=N(a)}return r}_getInternalTexture(e,t=!1,n=1){let r=nt(e);if(!r)return null;let i=`${e.contentHash}/${n}`,a=this._textures.get(i);if(a){let e=this._context.stage.renderView.textures,t=null,n=e.acquire(a.id);return n!=null&&!oe(n)&&(a.events.on(`unloaded`,()=>t=ae(t)),t=n),a}let o=null,s=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,c={wrap:$e(e.wrap),noUnpackFlip:!0,maxAnisotropy:s,mipmap:s>1};return Te(r)?(o=r.data,c.preMultiplyAlpha=!1,c.encoding=r.encoding):(o=r,c.preMultiplyAlpha=n!==1,c.compressionOptions=t?{compressionTracker:this._context.compressionTracker,compressionCallback:()=>this.updateComplexity()}:void 0),a=new De(o,c),this._textures.set(i,a),a.events.on(`loaded`,()=>this.updateComplexity()),a.load(this._context.stage.renderView.renderingContext),this._context.stage.addTexture(a),a.events.on(`unloaded`,()=>{this._textures.delete(i)}),a}_setInternalMaterialTextureParameters(e,n){if(e.colorTexture!=null){let t=n.textureAlphaMode!==1,r=this._getInternalTexture(e.colorTexture,t,n.textureAlphaMode);r?(n.textureId=r.id,n.textureAlphaPremultiplied=!!r.parameters.preMultiplyAlpha):n.textureId=void 0}if(e.normalTexture&&(n.normalTextureId=this._getInternalTexture(e.normalTexture)?.id),e.emissiveColor){let r=e.emissiveColor?.toUnitRGB();n.emissiveBaseColor=ne(t(r[0]),t(r[1]),t(r[2]))}e.emissiveStrength&&(n.emissiveStrengthKHR=e.emissiveStrength),e.emissiveTexture&&(n.emissiveTextureId=this._getInternalTexture(e.emissiveTexture)?.id),e.occlusionTexture&&(n.occlusionTextureId=this._getInternalTexture(e.occlusionTexture,!0)?.id),e.metallicRoughnessTexture&&(n.metallicRoughnessTextureId=this._getInternalTexture(e.metallicRoughnessTexture,!0)?.id)}_setInternalMaterialParameters(e,t,n){e.color!=null&&tt(e.color,t,n),this._setInternalMaterialTextureParameters(e,t),t.colorTextureTransformMatrix=P(e.colorTextureTransform),t.normalTextureTransformMatrix=P(e.normalTextureTransform);let r=e.normalTextureTransform?.scale==null?f:e.normalTextureTransform?.scale;t.normalScale=[r[0],r[1]],t.occlusionTextureTransformMatrix=P(e.occlusionTextureTransform),t.emissiveTextureTransformMatrix=P(e.emissiveTextureTransform),t.metallicRoughnessTextureTransformMatrix=P(e.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(e,t=this._materialColor){let n=this._drivenProperties.color,r=this._drivenProperties.opacity;if(n)e.externalColor=ie;else{let n=t??null;if(n){let t=n.toUnitRGBA();r&&(t[3]=1),e.externalColor=t}else e.externalColor=Be}e.colorMixMode=this.symbolLayer.material?.colorMixMode??`multiply`,e.castShadows=!!this.symbolLayer.castShadows,e.emissiveStrengthFromSymbol=this.symbolLayer?.material?.emissive?.strength??1,e.emissiveSource=we(this.symbolLayer?.material?.emissive?.source??`emissive`)}_getOrCreateMaterial(e,t){let n=t.material?.color,r=t.material?.colorTexture,i=t.material?.alphaMode,a=i===`blend`,o=i!==`opaque`&&(et(e)||n!=null&&n.a<1||r?.transparent||a),s=this._materialProperties(e,t,o),c=this._materialInfoCache.byUid(s.uid);if(c)return this._setInternalMaterialTextureParameters(s,c.material.parameters),c.material;let l={uid:s.uid,material:null,isComponentTransparent:o,alphaMode:t.material?t.material.alphaMode:`opaque`},u=Ae({normalTexture:s.normalTexture,metallicRoughnessTexture:s.metallicRoughnessTexture,metallicFactor:s.metallic,roughnessFactor:s.roughness,emissiveTexture:s.unlit?void 0:s.emissiveTexture,emissiveFactor:s.unlit?x:s.emissiveColor?.toUnitRGB(),occlusionTexture:s.occlusionTexture}),d={usePBR:this._usePBR(),isSchematic:u,hasVertexColors:s.hasVertexColors,hasSymbolColors:s.hasSymbolVertexColors,hasVertexTangents:s.hasVertexTangents,ambient:x,diffuse:re,opacity:1,doubleSided:!0,doubleSidedType:`winding-order`,cullFace:0,unlit:s.unlit,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,drivenOpacity:this.needsDrivenTransparentPass||l.isComponentTransparent};d.mrrFactors=u?Me:[s.metallic,s.roughness,je[2]],t.material&&(d.doubleSided=t.material.doubleSided,d.cullFace=t.material.doubleSided?0:2,d.textureAlphaCutoff=t.material.alphaCutoff),this._setExternalMaterialParameters(d),this._setMaterialTextureAlphaMode(d,l),this._setInternalMaterialParameters(s,d,l);let f=new ke(d,this._context.spherical);return l.material=f,this._materialInfoCache.set(s.uid,l),f}prepareSymbolLayerPatch(e){if(e.diff.type!==`partial`)return;let t=e.diff.diff;this._preparePatchColor(e,t),this._preparePatchEmissive(e,t)}_preparePatchColor(e,t){if(!t.material||t.material.type!==`partial`)return;let n=t.material.diff;if(!n.color||n.color.type!==`complete`||n.color.newValue==null||n.color.oldValue==null)return;let r=n.color.newValue;delete n.color,e.symbolLayerStatePatches.push(()=>{this._updateMaterialParameters(e=>{let t=e.material.parameters;this._setExternalMaterialParameters(t,r),this._setMaterialTextureAlphaMode(t,e),e.material.setParameters({externalColor:t.externalColor})})})}_preparePatchEmissive(e,t){return Ie(e,t,e=>{this._updateMaterialParameters(t=>{t.material.setParameters({emissiveStrengthFromSymbol:e??1})})},this.view.stage.renderView.renderingContext.driverTest.floatBufferBlend.result)}_usePBR(){return this._context.physicallyBasedRenderingEnabled}_setMaterialTextureAlphaMode(e,t){e.textureAlphaMode=t.alphaMode===`auto`?this.needsDrivenTransparentPass||t.isComponentTransparent||(e.layerOpacity??1)<1||(e.opacity??1)<1||(e.externalColor?.[3]??1)<1?3:1:t.alphaMode===`opaque`?1:t.alphaMode===`mask`?2:0}_createFaceDebugNormals(e,t){let r=t.length,a=e.spatialReference.isGeographic?20015077/180:1,o=.1*Math.max(e.extent.width*a,e.extent.height*a,e.extent.zmax-e.extent.zmin),s=[],c=t[0].transformation,l=n(i(),c);for(let e=0;e<r;e++){let n=t[e].attributes.get(`position`);if(!n)continue;let r=n.data,i=n.indices;for(let e=0;e<i.length;e+=3)U(r,i,e,Z),Qe(r,i,e,J,Y,X),m(J,J,Y),m(J,J,X),h(J,J,1/3),g(J,J,c),_(Z,Z,l),v(Z,Z),y(Y,J,Z,o),s.push(L(this._debugFaceNormalMaterial,[J,Y]))}return s}_createPerVertexDebugVectors(e,t,a,o,s){let c=t.length,l=e.spatialReference.isGeographic?20015077/180:1,u=s*.1*Math.max(e.extent.width*l,e.extent.height*l,e.extent.zmax-e.extent.zmin),d=[],f=t[0].transformation,m=n(i(),f);a===`tangent`&&r(m,f);for(let e=0;e<c;e++){let n=t[e],r=n.attributes.get(`position`),i=n.attributes.get(a);if(!r||!i)continue;let s=r.data,c=r.indices,l=i.data,h=i.indices;for(let e=0;e<c.length;e++){let t=c[e]*3,n=h[e]*i.stride;p(J,s[t+0],s[t+1],s[t+2]),g(J,J,f),p(Y,l[n+0],l[n+1],l[n+2]),_(Y,Y,m),v(Y,Y),y(Y,J,Y,u),d.push(L(o,[J,Y]))}}return d}_createAs3DShape(e,t,n,r){let i=e.geometry;if(i.type!==`mesh`)return null;let a=this._createGeometryInfo(i,t,r);if(a==null)return null;let{geometries:o,objectTransformation:s}=a;F.DRAW_MESH_GEOMETRY_NORMALS&&o.push(...this._createPerVertexDebugVectors(i,o,`normal`,this._debugVertexNormalMaterial,1),...this._createPerVertexDebugVectors(i,o,`tangent`,this._debugTangentNormalMaterial,.5),...this._createFaceDebugNormals(i,o));let c=this._context.layerViewUid,l=new Oe({geometries:o,layerViewUid:c,graphicUid:r,isElevationSource:!0});l.transformation=s;let u=Pe(this.symbolLayer,{opacity:this._getLayerOpacity()}),d=u?new Re(o[0].material,u,this._context.slicePlaneEnabled):null,f=new Le(this,l,null,z,n,d);this._fastUpdateProcessor.onAddGraphic(),f.needsElevationUpdates=B(n.mode),f.useObjectOriginAsAttachmentOrigin=!0,f.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(i),n.centerInElevationSR=this._getCenterInElevationSR(l.transformation);let{elevationProvider:p,renderCoordsHelper:m}=this._context;return f.alignedSampledElevation=z(f,n,p.spatialReference,(e,t)=>V(e,p,n,m,t),m),f}_fastTransformUpdatesAllowed(e){let{vertexSpace:t,spatialReference:n}=e;if(!xe(t))return!1;let{type:r}=t,{view:i}=this._context.graphicsCoreOwner,{isGlobal:a,isLocal:o}=i.state,s=i.spatialReference;return a&&r===`local`||o&&j(s,n)&&r===`georeferenced`&&!n.isGeographic}_getElevationSR(){return this._context.elevationProvider.spatialReference??null}_getCenterInElevationSR(e){let t=S(),n=p(st,e[12],e[13],e[14]);return ce(n,this._context.renderCoordsHelper.spatialReference,t,this._getElevationSR()),t}_passthroughReprojectionInfo(e){return e.reprojection===0&&!!e.objectTransformation}_createPositionBuffer(e,t,n){let r=n.position,i=r,a;if(t.reprojection===0)return{position:i,georeferencedPositionBuffer:a};let o=t.reprojection===1?t.transformBeforeProject:null;o&&(i=w(new Float64Array(i.length),i,o));let{normal:s,tangent:c}=n;!this._passthroughReprojectionInfo(t)&&(s||c)&&(a=i);let l=i===r||i===a?new Float64Array(i.length):i;return se(i,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0),{position:l,georeferencedPositionBuffer:a}}_createNormalBuffer(e,t,n,r,i){let a=i.normal;if(a==null)return null;let o=a,s=r.reprojection===1?r.transformBeforeProject:null;if(s&&(o=D(o,new Float32Array(o.length),s)),r.reprojection===0)return o;if(this._context.graphicsCoreOwner.view.state.isLocal){if(!M(this._context.renderCoordsHelper.spatialReference))return o;if(n==null)return null;if(e.spatialReference.isGeographic){let e=o===a?new Float32Array(o.length):o;return O(o,0,n,e)}if(e.spatialReference.isWebMercator){let e=o===a?new Float32Array(o.length):o;return k(o,0,n,e)}return o}if(n==null)return null;let c=o===a?new Float32Array(o.length):o,l=this._context.renderCoordsHelper.spatialReference;return _e(o,n,e.spatialReference,t,l,c)}_createTangentBuffer(e,t,n,r,i){let a=i.tangent;if(a==null)return null;let o=a,s=r.reprojection===1?r.transformBeforeProject:null;if(s&&(o=A(o,new Float32Array(o.length),s)),r.reprojection===0)return o;if(this._context.graphicsCoreOwner.view.state.isLocal){if(!M(this._context.renderCoordsHelper.spatialReference))return o;if(n==null)return null;if(e.spatialReference.isGeographic){let e=o===a?new Float32Array(o.length):o;return O(o,1,n,e)}if(e.spatialReference.isWebMercator){let e=o===a?new Float32Array(o.length):o;return k(o,1,n,e)}return o}if(n==null)return null;let c=o===a?new Float32Array(o.length):o,l=this._context.renderCoordsHelper.spatialReference;return ve(o,n,e.spatialReference,t,l,c)}_createSymbolColorBuffer(e){return this._requiresSymbolVertexColors()?new Uint8Array(this._getDrivenUInt8ColorWithNaNSupport(e,this._materialColor,!0)):null}_createBuffers(e,t){let n=e.vertexAttributes&&e.vertexAttributes.position;if(!n)return this.logger.warn(`Mesh geometry must contain position vertex attributes`),null;let r=e.vertexAttributes.normal,i=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(r&&r.length!==n.length)return this.logger.warn(`Mesh normal vertex buffer must contain the same number of elements as the position buffer`),null;if(a&&a.length/4!=n.length/3)return this.logger.warn(`Mesh tangent vertex buffer must contain the same number of elements as the position buffer`),null;if(i&&i.length/2!=n.length/3)return this.logger.warn(`Mesh uv vertex buffer must contain the same number of elements as the position buffer`),null;let o=this._computeReprojectionInfo(e),s=o.reprojection===1&&o.convertLocalVertexSpace,c=s&&e.vertexSpace.type===`local`?be(e,e.vertexSpace,this._context.renderCoordsHelper.spatialReference):null;if(s&&!c)return this.logger.warn(`Local mesh vertex space could not be converted for rendering`),null;let{position:l,georeferencedPositionBuffer:u}=c?{position:c.position,georeferencedPositionBuffer:null}:this._createPositionBuffer(e,o,e.vertexAttributes),d=rt(e),f=this._createSymbolColorBuffer(t),p=c?c.normal:this._createNormalBuffer(e,l,u,o,e.vertexAttributes),m=c?c.tangent:this._createTangentBuffer(e,l,u,o,e.vertexAttributes),h=i,{geometryTransformation:g}=o,{transformation:_,position:v,normal:y,tangent:b}=this._passthroughReprojectionInfo(o)?{transformation:o.objectTransformation,position:l,normal:p,tangent:m}:this._expressInOriginLocalSpace(e,l,p,m,g);return{positionBuffer:v,normalBuffer:y,tangentBuffer:b,uvBuffer:h,colorBuffer:d,symbolColorBuffer:f,objectTransformation:_,geometryTransformation:g}}_computeReprojectionInfo(e){let{vertexSpace:t}=e,n=t.type===`georeferenced`,r=t.type===`local`&&this._context.graphicsCoreOwner.view.state.isGlobal,i=n?+!j(this._context.renderCoordsHelper.spatialReference,e.spatialReference):+!!r;if(Se(t))return{reprojection:i,geometryTransformation:l()};let s=t.origin,c=e.transform?.localMatrix??u;if(i===0){let t=l();return C(e.spatialReference,s,t,this._context.renderCoordsHelper.spatialReference),{reprojection:i,objectTransformation:t,geometryTransformation:d(c)}}if(r)return{reprojection:i,convertLocalVertexSpace:!0,geometryTransformation:d(c)};let f=a(l(),s);return o(f,f,c),{reprojection:i,transformBeforeProject:f,geometryTransformation:l()}}_expressInOriginLocalSpace(e,t,n,r,i){let a=this._context.renderCoordsHelper.spatialReference,c=e.origin;q[0]=c.x,q[1]=c.y,q[2]=c.z??0;let u=l();C(e.spatialReference,q,u,a),o(Q,u,i),s(Q,Q);let{position:d,normal:f,tangent:p}=e.vertexAttributes,m=t===d?new Float64Array(t.length):t;w(m,t,Q);let h=n?n===f?new Float32Array(n.length):n:null,g=r?r===p?new Float32Array(r.length):r:null;return n&&h&&D(n,h,Q),r&&g&&A(r,g,Q),{transformation:u,position:m,normal:h,tangent:g}}_validateFaces(e,t){let n=e.vertexAttributes.position.length/3,r=t.faces;if(r&&r.length>0){let e=-1;for(let t=0;t<r.length;t++){let n=r[t];n>e&&(e=n)}if(n<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(n%3!=0)return this.logger.warn(`Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)`),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent||!e.vertexAttributes?.position)return!1;let t=this._context.elevationProvider.spatialReference,n=ye(e,t??e.spatialReference);return n?(ue(n,$),!de($,this._context.clippingExtent)):!1}_createGeometryInfo(e,t,n){if(!le(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn(`Geometry spatial reference is not compatible with the view`),null;if(!this._validateVertexSpace(e)||this._isOutsideClippingArea(e))return null;let r=this._createBuffers(e,t);if(r==null)return null;let{positionBuffer:i,uvBuffer:a,colorBuffer:o,symbolColorBuffer:s,normalBuffer:l,tangentBuffer:u,objectTransformation:d,geometryTransformation:f}=r,p=e.components??ot,m=[],h=!1,g=c(J,d),_=this._context.localOriginFactory.getOrigin(g);for(let t of p){if(!this._validateFaces(e,t))return null;let r=qe(e,t);if(r.length===0)continue;let c=Je(i,l,t,r);c.didFlipNormals&&(h=!0);let d=[[`position`,new I(i,r,3,!0)],[`normal`,new I(c.normals,c.indices,3,!0)]];o&&d.push([`color`,new I(o,r,4,!0)]);let p=null;s&&(p=E(r.length),d.push([`symbolColor`,new I(s,p,4,!0)])),a&&d.push([`uv0`,new I(a,r,2,!0)]),u&&d.push([`tangent`,new I(u,r,4,!0)]);let g=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerViewUid:this._context.layerViewUid});g&&(p??=E(r.length),Ue(d,g,p));let v=this._getOrCreateMaterial(e,t),y=new Ee(v,d,null);y.transformation=f,y.localOrigin=_,m.push(y)}return h&&this.logger.warn(`Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals.`),m.length===0?null:{geometries:m,objectTransformation:d}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial((e,t)=>{t.setParameters(e.parameters)})}_validateVertexSpace(e){return this._context.graphicsCoreOwner.view.state.isLocal&&e.vertexSpace.type===`local`?(this.logger.warn(`Displaying a mesh with a local vertex space in a view in local viewing mode is not supported.`),!1):!0}test(){return{...super.test(),materials:this._materialInfoCache.materials}}get _materialColor(){return this.symbolLayer.material?.color}}class H{constructor(e,t,n){this.normals=e,this.indices=t,this.didFlipNormals=n}}function qe(e,t){return t.faces??pe(e.vertexAttributes.position.length/3)}function Je(e,t,n,r){switch(n.shading||`flat`){default:case`source`:return Xe(e,t,n,r);case`flat`:return Ye(e,r);case`smooth`:return Ze(e,r)}}function Ye(e,t){let n=T(t.length),r=Array(t.length*3);for(let i=0;i<t.length;i+=3){let a=U(e,t,i,Z);for(let e=0;e<3;e++)n[i+e]=a[e],r[i+e]=i/3}return new H(n,r,!1)}function Xe(e,t,n,r){if(t==null)return Ye(e,r);let i=!1;if(!n.trustSourceNormals)for(let n=0;n<r.length;n+=3){U(e,r,n,Z);for(let e=0;e<3;e++){let a=r[n+e]*3;J[0]=t[a],J[1]=t[a+1],J[2]=t[a+2],te(Z,J)<0&&(t[a]=-t[a],t[a+1]=-t[a+1],t[a+2]=-t[a+2],i=!0)}}return new H(t,r,i)}function Ze(e,t){let n={};for(let r=0;r<t.length;r+=3){let i=U(e,t,r,Z);for(let e=0;e<3;e++){let a=t[r+e],o=n[a];o||(o={normal:S(),count:0},n[a]=o),m(o.normal,o.normal,i),o.count++}}let r=T(t.length*3),i=Array(t.length*3);for(let e=0;e<t.length;e++){let a=n[t[e]];a.count!==1&&(v(a.normal,a.normal),a.count=1);for(let t=0;t<3;t++)r[e*3+t]=a.normal[t];i[e]=e}return new H(r,i,!1)}function Qe(e,t,n,r,i,a){let o=t[n]*3,s=t[n+1]*3,c=t[n+2]*3;r[0]=e[o],r[1]=e[o+1],r[2]=e[o+2],i[0]=e[s],i[1]=e[s+1],i[2]=e[s+2],a[0]=e[c],a[1]=e[c+1],a[2]=e[c+2]}function U(e,t,n,r){return Qe(e,t,n,J,Y,X),b(Y,Y,J),b(X,X,J),ee(J,Y,X),v(r,J),r}function $e(e=`repeat`){if(typeof e==`string`){let t=W(e);return{s:t,t}}return{s:W(e.horizontal),t:W(e.vertical)}}function W(e){switch(e){case`clamp`:return 33071;case`mirror`:return 33648;default:return 10497}}function et(e){let t=e.vertexAttributes.color;if(t==null)return!1;for(let e=3;e<t.length;e+=4)if(t[e]!==255)return!0;return!1}function tt(e,t,n){t.diffuse=e.toUnitRGB(),t.opacity=n.alphaMode===`opaque`?1:e.a}function nt(e){return e.data??e.url}function G(t){return t==null?`-`:t instanceof e?t.toHex():t.contentHash}function K(e){let{offset:t,scale:n,rotation:r}=e??it;return`${t[0]},${t[1]},${r},${n[0]},${n[1]}`}function rt(e){return e.vertexAttributes.color}const it=new ge,q=S(),J=S(),Y=S(),X=S(),Z=S(),Q=l(),at=l(),$=fe(),ot=[new me],st=S();export{Ke as Graphics3DMeshFillSymbolLayer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{has}from"../../../../applications/Components/baUtils.js";import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{fromBuffer as n,intersectsClippingArea as r,empty as i,expandWithAABB as a,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as s,doubleSubArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as u}from"../../../../geometry/support/Indices.js";import{isDrivenOpacityFallbackAlwaysOpaque as d}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{createGeometry as f}from"../../support/engineContent/line.js";import{loadTessellationUtils as p,preloadedPolygonToRenderInfoElevationAligned as m,preloadedPolygonToRenderInfoDraped as h}from"../../support/renderInfoUtils/polygon.js";import{Object3D as g}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as _}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as v}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as y}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as b}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as x}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as C,getAttributeValue as w,ConvertOptions as T}from"../support/FastSymbolUpdates.js";import{createMaterial as E,uvElevationAligner as D}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as O,writeMapSpaceUVCoordsDraped as k}from"../support/uvUtils.js";import{elevationModeChangeUpdateType as A,needsElevationUpdates2D as j}from"./elevationAlignmentUtils.js";import{PlateLayoutInformation as M,updatePlateNormals as N}from"./extrudePolygon.js";import{Graphics3DDrapedGraphicLayer as P}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as F}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as I}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as L}from"./graphicUtils.js";import{parseCapType as R,computeSymbolLayerIndex as z}from"./lineUtils.js";import{geometryAsPolygon as B,createColorGeometry as V,PolygonCreationDataBase as H}from"./polygonUtils.js";const U=[`polyline`,`polygon`,`extent`];class W extends I{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,d(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=S(this._context.renderer,this._vvConvertOptions),await p()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}get _shadingEnabled(){return!this.draped&&!!has(`enable-feature:emissive-on-non-volumetric`)}_createMaterials(){if(this._materials.length>0)return;let{_materialColor:e,draped:n,_shadingEnabled:r}=this,i=this._getCombinedOpacityAndColor(e);this._materials[0]=E(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:n,shading:+!!r,castShadows:r&&this.symbolLayer.castShadows,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters},this._context),this._needsUV=this._materials[0]instanceof b;let a=this.symbolLayer.outline;if(J(a)){let e=y(a.pattern),n=R(a.pattern?a.patternCap||`butt`:`square`);this._materials[1]=new x({color:this._getOutlineColor(),width:t(a.size),polygonOffset:3,polygonOffsetIndex:z(this._renderPriority,this._renderPriorityStep),shadingEnabled:r,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:e,cap:n,screenSizePerspective:this._outlineScreenSizePerspective},this.view)}}get _outlineScreenSizePerspective(){return!this.draped&&v(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;let n=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(r.mode===`on-the-ground`),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,n):this._createAs3DShape(e.renderingInfo,t,n,r)}applyRendererDiff(e,t){for(let n in e.diff)if(n===`visualVariables`){if(C(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0}else return 0;return 2}layerOpacityChanged(){if(this._materials[0]!=null){let e=this._materials[0].parameters.color,t=this._materialColor,n=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],n],forceTransparentMode:this.needsDrivenTransparentPass})}if(this._materials[1]!=null){let e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=A(W.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=j(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){let e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicallyBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0?!0:this._materials[1]==null?!1:e.outline.output===`vertex-data`?e.outline.outlines.length>0:e.outlineIndexCount>0}_createAs3DShape(e,t,n,r){let i=B(t.geometry);if(!i)return null;let a=this._shadingEnabled,o=m(i,this._context.elevationProvider,this._context.renderCoordsHelper,r,{projectIfNearlyVertical:!0,requireNormals:a,outlineOutput:`vertex-data`,owner:this._context.layer});if(o==null)return null;let d=new K(o,n,this._context.layerViewUid,t.uid),f=d.renderInfo.vertexCount;if(this._needsUV){d.uvMapSpace=l(f*4,!0),d.textureElementIndices=Array(f),d.boundingRect=s(9*(d.renderInfo.polygonIndices.length/3));let e=O(d.uvMapSpace,d.boundingRect,d.textureElementIndices,d.renderInfo.positions,d.renderInfo.polygonIndices,this._context.renderCoordsHelper);d.boundingRect=c(d.boundingRect,0,9*e),d.boundingRectIndices=u(e)}if(d.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(d),this._createAs3DShapeFill(e,d),this._materials[1]&&this._createAs3DShapeOutline(d),this._logGeometryCreationWarnings(d.renderInfo,i.rings,`rings`,`FillSymbol3DLayer`),d.outGeometries.length===0)return null;let p=new g({geometries:d.outGeometries,castShadow:this._shadingEnabled,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),h=d.plateLayout,_=new F(this,p,null,(e,t,n,r,i)=>D(e,t,n,r,i,h),r);return _.alignedSampledElevation=d.renderInfo.sampledElevation,_.needsElevationUpdates=j(r.mode),_}_createAs3DShapeFill(e,t){let{mapPositions:i,positions:a,polygonIndices:o,polygonIndexCount:s,vertexCount:c,compressedNormals:l}=t.renderInfo;if(s===0||this._context.clippingExtent!=null&&(n(i,G),!r(G,this._context.clippingExtent)))return;let u=this._fastUpdates?.visualVariables.color,d=V({material:this._materials[0],indices:o,mapPositions:i,attributeData:{position:a,color:u?null:t.color,compressedNormals:l,colorFeature:u?w(u,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,textureElementIndices:this._needsUV?t.textureElementIndices:null,boundingRectIndices:this._needsUV?t.boundingRectIndices:null,olidColor:t.olidColor}});t.plateLayout=new M(c,0,null,0,s/3),N(d,t.plateLayout),t.outGeometries.push(d)}_createAs3DShapeOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderInfo;if(t.output!==`vertex-data`)return;let{outlines:i}=t;if(i!=null&&i.length!==0)for(let{mapPositions:t,position:a}of i){if(this._context.clippingExtent!=null&&(n(t,G),!r(G,this._context.clippingExtent)))continue;let i=f(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:t,attributeData:{position:a}},e.olidColor);e.outGeometries.push(i)}}_createAsOverlay(e,t,n){let r=B(t.geometry);if(r==null)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,this._materials[1]!=null&&(this._materials[1].renderPriority=this._renderPriority);let a=h(r,{drapedSpatialReference:this._context.overlaySR,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new q(a,n,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=l(o.renderInfo.vertexCount*4,!0),k(o.uvMapSpace,o.renderInfo.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.isGlobal)),o.outBoundingBox=i(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderInfo,r.rings,`rings`,`FillSymbol3DLayer`),new P(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){let{positions:i,polygonIndices:o,polygonIndexCount:s}=t.renderInfo;if(s===0)return;let c=n(i,G);if(!r(c,this._context.clippingExtent))return;a(t.outBoundingBox,c);let l=this._fastUpdates?.visualVariables.color,u=V({material:this._materials[0],indices:o,attributeData:{position:i,color:l?null:t.color,colorFeature:l?w(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new _(u,t))}_createAsOverlayOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderInfo;if(t.output!==`vertex-data`)return;let{outlines:i}=t;for(let{position:t}of i){if(n(t,G),!r(G,this._context.clippingExtent))continue;a(e.outBoundingBox,G);let i=f(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:t}},e.olidColor);e.outGeometries.push(new _(i,e))}}_getOutlineOpacity(){let e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(e==null?0:e.a)}_getOutlineColor(){let e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return L(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,n)=>this._createAsOverlay(e,t,n),createAs3DShape:(e,t,n,r)=>this._createAs3DShape(e,t,n,r)}}get _vvConvertOptions(){return new T({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??e})}}const G=o();class K extends H{constructor(e,t,n,r){super(e,n,r),this.color=t}}class q extends H{constructor(e,t,n,r){super(e,n,r),this.color=t}}function J(e){return e?.size!=null&&e.size>0&&e.color!=null&&(e.pattern==null||e.pattern.type!==`style`||e.pattern.style!==`none`)}export{W as Graphics3DPolygonFillSymbolLayer};
|
|
2
|
+
import{has}from"../../../../applications/Components/baUtils.js";import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{fromBuffer as n,intersectsClippingArea as r,empty as i,expandWithAABB as a,create as o}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as s,doubleSubArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as u}from"../../../../geometry/support/Indices.js";import{isDrivenOpacityFallbackAlwaysOpaque as d}from"../../../../renderers/visualVariables/support/visualVariableUtils.js";import{createGeometry as f}from"../../support/engineContent/line.js";import{loadTessellationUtils as p,preloadedPolygonToRenderInfoElevationAligned as m,preloadedPolygonToRenderInfoDraped as h}from"../../support/renderInfoUtils/polygon.js";import{Object3D as g}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as _}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as v}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as y}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as b}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as x}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{initFastSymbolUpdatesState as S,updateFastSymbolUpdatesState as C,getAttributeValue as w,ConvertOptions as T}from"../support/FastSymbolUpdates.js";import{createMaterial as E,uvElevationAligner as D}from"../support/patternUtils.js";import{writeMapSpaceUVCoordsPerConnectedPart as O,writeMapSpaceUVCoordsDraped as k}from"../support/uvUtils.js";import{elevationModeChangeUpdateType as A,needsElevationUpdates2D as j}from"./elevationAlignmentUtils.js";import{PlateLayoutInformation as M,updatePlateNormals as N}from"./extrudePolygon.js";import{Graphics3DDrapedGraphicLayer as P}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as F}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as I}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as L}from"./graphicUtils.js";import{parseCapType as R,computeSymbolLayerIndex as z}from"./lineUtils.js";import{geometryAsPolygon as B,createColorGeometry as V,PolygonCreationDataBase as H}from"./polygonUtils.js";const U=[`polyline`,`polygon`,`extent`];class W extends I{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,n,r){super(e,t,n,r,d(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=S(this._context.renderer,this._vvConvertOptions),await p()}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){let e=this.symbolLayer.material?.emissive;return(e?.source===`color`?e?.strength:void 0)??0}get _shadingEnabled(){return!this.draped&&!!has(`enable-feature:emissive-on-non-volumetric`)}_createMaterials(){if(this._materials.length>0)return;let{_materialColor:e,draped:n,_shadingEnabled:r}=this,i=this._getCombinedOpacityAndColor(e);this._materials[0]=E(this.symbolLayer,{color:i,forceTransparentMode:this.needsDrivenTransparentPass,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:n,shading:+!!r,castShadows:r&&this.symbolLayer.castShadows,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters},this._context),this._needsUV=this._materials[0]instanceof b;let a=this.symbolLayer.outline;if(J(a)){let e=y(a.pattern),n=R(a.pattern?a.patternCap||`butt`:`square`);this._materials[1]=new x({color:this._getOutlineColor(),width:t(a.size),polygonOffset:3,polygonOffsetIndex:z(this._renderPriority,this._renderPriorityStep),shadingEnabled:r,hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:e,cap:n,screenSizePerspective:this._outlineScreenSizePerspective},this.view)}}get _outlineScreenSizePerspective(){return!this.draped&&v(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){let t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;let n=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus(r.mode===`on-the-ground`),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,n):this._createAs3DShape(e.renderingInfo,t,n,r)}applyRendererDiff(e,t){for(let n in e.diff)if(n===`visualVariables`){if(C(this._fastUpdates,t,this._vvConvertOptions))this._materials[0]?.setParameters(this._fastUpdates.materialParameters);else return 0}else return 0;return 2}layerOpacityChanged(){if(this._materials[0]!=null){let e=this._materials[0].parameters.color,t=this._materialColor,n=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],n],forceTransparentMode:this.needsDrivenTransparentPass})}if(this._materials[1]!=null){let e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,n){let r=this._elevationContext.mode,i=A(W.elevationModeChangeTypes,n,r);if(i!==1)return i;let a=j(r);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>a)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){let e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicallyBasedRenderingChanged(){return!0}_containsRenderableGeometry(e){return e.polygonIndexCount>0?!0:this._materials[1]==null?!1:e.outline.output===`vertex-data`?e.outline.outlines.length>0:e.outlineIndexCount>0}_createAs3DShape(e,t,n,r){let i=B(t.geometry);if(!i)return null;let a=this._shadingEnabled,o=m(i,this._context.elevationProvider,this._context.renderCoordsHelper,r,{projectIfNearlyVertical:!0,requireNormals:a,outlineOutput:`vertex-data`,owner:this._context.layer});if(o==null)return null;let d=new K(o,n,this._context.layerViewUid,t.uid),f=d.renderInfo.vertexCount;if(this._needsUV){d.uvMapSpace=l(f*4,!0),d.textureElementIndices=Array(f),d.boundingRect=s(9*(d.renderInfo.polygonIndices.length/3));let e=O(d.uvMapSpace,d.boundingRect,d.textureElementIndices,d.renderInfo.positions,d.renderInfo.polygonIndices,this._context.renderCoordsHelper);d.boundingRect=c(d.boundingRect,0,9*e),d.boundingRectIndices=u(e)}if(d.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(d),this._createAs3DShapeFill(e,d),this._materials[1]&&this._createAs3DShapeOutline(d),this._logGeometryCreationWarnings(d.renderInfo,i.rings,`rings`,`FillSymbol3DLayer`),d.outGeometries.length===0)return null;let p=new g({geometries:d.outGeometries,castShadows:this._shadingEnabled,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),h=d.plateLayout,_=new F(this,p,null,(e,t,n,r,i)=>D(e,t,n,r,i,h),r);return _.alignedSampledElevation=d.renderInfo.sampledElevation,_.needsElevationUpdates=j(r.mode),_}_createAs3DShapeFill(e,t){let{mapPositions:i,positions:a,polygonIndices:o,polygonIndexCount:s,vertexCount:c,compressedNormals:l}=t.renderInfo;if(s===0||this._context.clippingExtent!=null&&(n(i,G),!r(G,this._context.clippingExtent)))return;let u=this._fastUpdates?.visualVariables.color,d=V({material:this._materials[0],indices:o,mapPositions:i,attributeData:{position:a,color:u?null:t.color,compressedNormals:l,colorFeature:u?w(u,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,boundingRect:this._needsUV?t.boundingRect:null,textureElementIndices:this._needsUV?t.textureElementIndices:null,boundingRectIndices:this._needsUV?t.boundingRectIndices:null,olidColor:t.olidColor}});t.plateLayout=new M(c,0,null,0,s/3),N(d,t.plateLayout),t.outGeometries.push(d)}_createAs3DShapeOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderInfo;if(t.output!==`vertex-data`)return;let{outlines:i}=t;if(i!=null&&i.length!==0)for(let{mapPositions:t,position:a}of i){if(this._context.clippingExtent!=null&&(n(t,G),!r(G,this._context.clippingExtent)))continue;let i=f(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:t,attributeData:{position:a}},e.olidColor);e.outGeometries.push(i)}}_createAsOverlay(e,t,n){let r=B(t.geometry);if(r==null)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,this._materials[1]!=null&&(this._materials[1].renderPriority=this._renderPriority);let a=h(r,{drapedSpatialReference:this._context.overlaySR,outlineOutput:`vertex-data`,owner:this._context.layer});if(a==null)return null;let o=new q(a,n,this._context.layerViewUid,t.uid);return this._needsUV&&(o.uvMapSpace=l(o.renderInfo.vertexCount*4,!0),k(o.uvMapSpace,o.renderInfo.positions,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.isGlobal)),o.outBoundingBox=i(),o.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(o),this._createAsOverlayFill(e,o),this._materials[1]&&this._createAsOverlayOutline(o),this._logGeometryCreationWarnings(o.renderInfo,r.rings,`rings`,`FillSymbol3DLayer`),new P(this,o.outGeometries,o.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,t){let{positions:i,polygonIndices:o,polygonIndexCount:s}=t.renderInfo;if(s===0)return;let c=n(i,G);if(!r(c,this._context.clippingExtent))return;a(t.outBoundingBox,c);let l=this._fastUpdates?.visualVariables.color,u=V({material:this._materials[0],indices:o,attributeData:{position:i,color:l?null:t.color,colorFeature:l?w(l,e.color):null,uvMapSpace:this._needsUV?t.uvMapSpace:null,olidColor:t.olidColor}});t.outGeometries.push(new _(u,t))}_createAsOverlayOutline(e){if(this._materials[1]==null)return;let{outline:t}=e.renderInfo;if(t.output!==`vertex-data`)return;let{outlines:i}=t;for(let{position:t}of i){if(n(t,G),!r(G,this._context.clippingExtent))continue;a(e.outBoundingBox,G);let i=f(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:t}},e.olidColor);e.outGeometries.push(new _(i,e))}}_getOutlineOpacity(){let e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(e==null?0:e.a)}_getOutlineColor(){let e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return L(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,n)=>this._createAsOverlay(e,t,n),createAs3DShape:(e,t,n,r)=>this._createAs3DShape(e,t,n,r)}}get _vvConvertOptions(){return new T({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??e})}}const G=o();class K extends H{constructor(e,t,n,r){super(e,n,r),this.color=t}}class q extends H{constructor(e,t,n,r){super(e,n,r),this.color=t}}function J(e){return e?.size!=null&&e.size>0&&e.color!=null&&(e.pattern==null||e.pattern.type!==`style`||e.pattern.style!==`none`)}export{W as Graphics3DPolygonFillSymbolLayer};
|