@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{set as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{add as n,normalize as r,dot as i,distance as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o,clone as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lerp as c}from"../../../../core/mathUtils.js";import l from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as u,createRenderScreenPointArray3 as d,createScreenPointArray as f}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as p}from"../../../../core/units.js";import{create as m,copy as h,negativeInfinity as g,expandWithNestedArray as _}from"../../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as v}from"../../../../geometry/support/normalizeUtils.js";import{create as y}from"../../../../geometry/support/ray.js";import{sv3d as b}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as x}from"../../../../support/elevationInfoUtils.js";import{TaskPriority as S}from"../../../support/Scheduler.js";import{g as C}from"../../../../chunks/cameraUtilsSpherical.js";import{fromRenderAtEye as w,fromScreen as T}from"../../support/geometryUtils/ray.js";import{computeMapPointFromVec3d as E}from"../../support/hitTest.js";import{defaultTolerance as D,Intersector as O,defaultScreenPolygonPrimitiveProcessor as k}from"../../webgl-engine/lib/Intersector.js";import{RayIntersectionQuery as A,DrapedScreenPolygonIntersectionQuery as j}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as M}from"../../webgl-engine/lib/IntersectorResult.js";import{SliceScreenPolygonPrimitiveProcessor as N,createSliceExtrusionHalfspacePlanes as P,clipPolygonAgainstSlicedAwayHalfspaces as F,sliceFilterPredicate as I}from"../../webgl-engine/lib/intersectorUtils.js";import{prepareScreenPolygonIntersectionQuery as L}from"../../webgl-engine/lib/screenPolygonIntersectionUtils.js";class R{constructor(e,t,n){this.isGlobal=e,this._forEachLayer=t,this._view=n,this._externalIntersectionHandlers=new l,this._tolerance=D,this._tmpRay=y(),this._tmpRegion=m(),this._validateHUDIntersector=new O(this.isGlobal),this._validateHUDIntersector.options.hud=!1,this._screenPolygonIntersectionTask=this._view.resourceController.scheduler.registerTask(S.SCREEN_POLYGON_INTERSECTION)}destroy(){this._screenPolygonIntersectionTask.remove(),this._externalIntersectionHandlers.prune()}get screenPolygonIntersectionTask(){return this._screenPolygonIntersectionTask}intersectScreen(e,t,n){return this.intersectRay(this._getPickRay(e,this._tmpRay),H(this.isGlobal),t,n)}intersectScreenFreePointFallback(e,t,n){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,n)}intersectRayFreePointFallback(e,t,n){return this.intersectRay(e,H(this.isGlobal),t,n)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,n,r){return t.options.selectionMode=!1,t.options.store=0,this.computeIntersection(e,t,!1,r),t.results.min?t.results.min.getIntersectionPoint(n):!1}getCenterRayWithSubpixelOffset(e,t,n=.5,r=.5){return e.getRenderCenter(Z,n,r),Z[0]+=.0466,Z[1]-=.0123,w(e,Z,t)}intersectIntersectorScreen(e,t,n){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,!1,n)}async intersectIntersectorScreenPolygon(e,t,n){t.polygonResults.init();let r=this._view.state.camera,i=await L(r,e);i!=null&&await this._screenPolygonIntersectionTask.scheduleGenerator(e=>this._intersectIntersectorScreenPolygon(r,t,i,n,e))}*_intersectIntersectorScreenPolygon(e,t,n,r,i){let a=new U(r,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!r||!(`include`in r||`exclude`in r),t.camera=e,t.metersPerRenderUnit=this._view.renderCoordsHelper.unitInMeters,t.point=null,t.screenPolygonPrimitiveProcessor=k,yield*t.intersectScreenPolygon(a.layers,n);let o=this._view.slice.plane,s=o?new N(o):null;t.screenPolygonPrimitiveProcessor=s??k,yield*t.intersectScreenPolygon(a.sliceableLayers,n),t.screenPolygonPrimitiveProcessor=k,yield*this._intersectPolygonHandlersGenerator(t,a,n,null,s,void 0,!0,i),yield*this._intersectDrapedScreenPolygon(t,a,n,r),yield*t.intersectHUDScreenPolygon(a.layers,n),t.screenPolygonPrimitiveProcessor=s??k,yield*t.intersectHUDScreenPolygon(a.sliceableLayers,n),t.polygonResults.sortResults()}intersectToolIntersectorScreen(e,t,n){let r=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(r,t,n)}intersectToolIntersectorRay(e,t,n){t.options.selectionMode=!0,this.computeIntersection(e,t,!1,n);let r=t.results.min;this._view.groundView.opaque||M(r)&&r.intersector!==7||(t.options.selectionMode=!1,this.computeIntersection(e,t,!1,n))}setTolerance(e=D){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort((e,t)=>e.type===7?1:t.type===7?-1:0)}removeIntersectionHandler(e){this._externalIntersectionHandlers.removeUnordered(e)!=null&&this._externalIntersectionHandlers.sort((e,t)=>e.type===7?1:t.type===7?-1:0)}_getPickRay(e,t){let n=this._view.state.camera;return T(n,e,t)}_intersectRayFreePointLocal(e,t){return this.isGlobal||e==null||n(t,e.origin,r(b.get(),e.direction)),!1}intersectElevationFromScreen(e,t,n=0,r=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,n,r)}_intersectElevation(e,t,n=0,a=null){if(e==null)return null;let o=this._view,{renderCoordsHelper:s}=o,c=p(o.spatialReference),l=t==null?`absolute-height`:t.mode,d=x(t)/c,f=(l===`on-the-ground`?0:d+n)*c/s.unitInMeters,{camera:m}=o.state;if(l===`absolute-height`){let t=s.getAltitude(m.eye),n=i(r(K,e.direction),s.worldUpAtPosition(m.eye,q));if(t<f&&n<0||t>=f&&n>0)return null;if(s.intersectInfiniteManifold(e,f,K)){let e=E(o,K);return e.z??=0,e.z-=d,e}return null}let h=m.projectToRenderScreen(e.origin,u(b.get())),g=new U(null,this._forEachLayer),_=o.slice.plane,v=_?I(_):null,y=new O(this.isGlobal);y.options.store=0,y.options.verticalOffset=f,y.options.normalRequired=!1;let S=this._createRayIntersectionQuery(e,h,!1);y.metersPerRenderUnit=this._view.renderCoordsHelper.unitInMeters,y.reset(S.beginPoint,S.endPoint,m),y.point=h;let C=null;if(a&&`type`in a&&a.type===`graphics`){let e=o.allLayerViews.find(e=>e.layer===a)?.uid;C=e?t=>t.layerViewUid===e:null}else a&&(C=e=>e.graphicUid!==a.uid);switch(l){case`relative-to-scene`:y.intersect(g.layers,S.screenPoint,this._tolerance,null,e=>(!C||C(e))&&!!e.lastValidElevationBB),this._intersectRayHandlers(y,g,S,v,!1,e=>e.type===2||e.type===7||e.type===8,!1);break;case`on-the-ground`:case`relative-to-ground`:this._intersectRayHandlers(y,g,S,v,!1,e=>e.isGround,!1)}if(y.results.min.getIntersectionPoint(K)){let e=E(o,K);return e.z=n,e}return null}computeIntersection(e,t,n,r){if(e==null)return;let i=this._view.state.camera,a=i.projectToRenderScreen(e.origin,u(b.get())),o=new U(r,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!r||!(`include`in r||`exclude`in r);let s=this._createRayIntersectionQuery(e,a,n);t.metersPerRenderUnit=this._view.renderCoordsHelper.unitInMeters,t.reset(s.beginPoint,s.endPoint,i),t.intersect(o.layers,s.screenPoint,this._tolerance,null,o.objectFilter);let c=this._view.slice.plane,l=c?I(c):null;t.intersect(o.sliceableLayers,s.screenPoint,this._tolerance,l,o.objectFilter);let d=r&&(r.requiresGroundFeedback||r.enableDraped);this._intersectRayHandlers(t,o,s,l,!!d,e=>o.allowedIntersectorTypes==null||o.allowedIntersectorTypes.has(e.type));let f=b.get(),p=this._view,m=p.groundView.spatialReference;if(r&&r.enableDraped&&m!=null&&t.results.ground.getIntersectionPoint(f)){let e=p.overlayManager.renderer,n=p.renderCoordsHelper.spatialReference,r=b.get();p.renderCoordsHelper.fromRenderCoords(f,r,m),r[2]=p.elevationProvider?.getElevation(f[0],f[1],f[2],n,`ground`)??0,e.intersectRay(t,r,t.results.ground,e=>o.filterRenderGeometry(e))}t.sortResults(),this._processHUDResults(t)}_processHUDResults(e){let t=e.results.hud;h(this._tmpRegion,g);let n=[],r=this._tmpRegion,i=e=>{n.push(new z(e))};e.sortResults(t.all),t.min.distance!=null&&i(t.min);for(let e of t.all)t.min.target.object!==e.target.object&&t.max.target.object!==e.target.object&&i(e);if(t.max.distance!=null&&t.max.target.object!==t.min.target.object&&i(t.max),!n.length)return;r[0]===r[2]&&(r[2]+=1),r[1]===r[3]&&(r[3]+=1);let a=!0,o=e.results.max.distance==null,s=0;for(let t of n)a&&=(e.results.min.copy(t.result),!1),o&&e.results.max.copy(t.result),e.options.store===2&&e.results.all.splice(s++,0,t.result)}_createRayIntersectionQuery(e,t,r){return new A(e.origin,n(o(),e.origin,e.direction),t,r)}_intersectRayHandlers(e,t,n,r,i,a=()=>!0,o=!0){let{options:s}=e,c=s.isFiltered,l=s.filteredLayerViewUids;for(let{handler:c,filterPredicate:l,isFiltered:u,filteredLayerViewUids:d}of this._getFilteredIntersectionHandlers(t,r,null,a,o))(!u||c.isGround&&i)&&(s.isFiltered=u,s.filteredLayerViewUids=d,c.intersectRay(e,l,e.rayBegin,e.rayEnd,n.screenPoint,n.isVerticalRay));s.isFiltered=c,s.filteredLayerViewUids=l}*_intersectPolygonHandlersGenerator(e,t,n,r,i,a=()=>!0,o=!0,s){let{options:c}=e,l=c.isFiltered,u=c.filteredLayerViewUids,d=e.screenPolygonPrimitiveProcessor;for(let{handler:l,screenPolygonPrimitiveProcessor:u,isFiltered:d,filteredLayerViewUids:f}of this._getFilteredIntersectionHandlers(t,r,i,a,o))d||l.intersectScreenPolygon==null||(c.isFiltered=d,c.filteredLayerViewUids=f,e.screenPolygonPrimitiveProcessor=u??k,yield*l.intersectScreenPolygon(e,n,s));c.isFiltered=l,c.filteredLayerViewUids=u,e.screenPolygonPrimitiveProcessor=d}*_intersectDrapedScreenPolygon(e,t,n,r){let{basemapTerrain:i,overlayManager:a}=this._view,o=this._view.groundView.spatialReference!=null&&!a.renderer.isEmpty;if(!e.options.selectionMode||!r?.enableDraped||!o)return;let s=yield*this._createDrapedPolygonIntersectionQueries(n,i.slicePlaneEnabled?this._view.slice.plane:null);s!=null&&(yield*this._view.overlayManager.renderer.intersectScreenPolygon(e,s,e=>t.filterRenderGeometry(e)))}*_createDrapedPolygonIntersectionQueries(n,r){let{state:{camera:{eye:i}},pointsOfInterest:o}=this._view,l=this._view.groundView.spatialReference,u=[],d=r?[]:null,f=C(this._view,o.focus.renderLocation),p=v(l),m=1/0,h=null,g=K,_=q,y=e=>{if(!this._intersectDrapedScreenPolygonPoint(g,_,e))return!1;let n=h!=null&&p?h+p.shortestSignedDiff(h,g[0]):g[0];return h=n,u.push(t(n,g[1])),d&&d.push(s(_)),m=Math.min(m,a(i,_)),!0},{points:b}=n,{length:x}=b;for(let t=0;t<x;t++){let n=b[t],r=b[(t+1)%x];for(let t=0;t<f;t++){let i=t/f;if(!y(t===0?n:e(Y,c(n[0],r[0],i),c(n[1],r[1],i))))return null;yield}}if(!Number.isFinite(m))return null;if(r==null||!d)return[G(u,m)];let S=this._clipDrapedScreenPolygonIntersectionQueries(d,r,p,i);return S.length>0?S:null}_clipDrapedScreenPolygonIntersectionQueries(e,t,n,r){let i=[],a=P(t);for(let t of F(a,e)){let e=this._createDrapedQueryFromRenderPolygon(t,n,r);e!=null&&i.push(e)}return i.sort((e,t)=>e.distance-t.distance),i}_createDrapedQueryFromRenderPolygon(e,n,r){let{renderCoordsHelper:i}=this._view,o=this._view.groundView.spatialReference,s=[],c=1/0,l=null;for(let u of e){if(!i.fromRenderCoords(u,X,o))return null;let e=l!=null&&n?l+n.shortestSignedDiff(l,X[0]):X[0];l=e,s.push(t(e,X[1])),c=Math.min(c,a(r,u))}return s.length>=3&&Number.isFinite(c)?G(s,c):null}_intersectDrapedScreenPolygonPoint(e,t,n){let r=this._getPickRay(n,this._tmpRay);if(r==null)return!1;let{renderCoordsHelper:i}=this._view;this._intersectGroundPoint(t,r,n)||i.intersectManifoldClosestSilhouette(r,0,t);let a=this._view.groundView.spatialReference;return!!i.fromRenderCoords(t,e,a)}_intersectGroundPoint(e,t,n){let r=this._view.state.camera,i=new U(null,this._forEachLayer),a=new O(this.isGlobal);J[0]=n[0],J[1]=n[1],J[2]=0;let o=this._createRayIntersectionQuery(t,J,!1);return a.options.selectionMode=!0,a.options.store=0,a.options.normalRequired=!1,a.options.selectOpaqueTerrainOnly=!1,a.reset(o.beginPoint,o.endPoint,r),this._intersectRayHandlers(a,i,o,null,!0,e=>e.isGround,!1),a.results.ground.getIntersectionPoint(e)}*_getFilteredIntersectionHandlers(e,t,n,r=()=>!0,i=!0){for(let a of this._externalIntersectionHandlers){if(!r(a))continue;let o=!1,s=[];if(i){let t=a.layerViewUid,n=a.sublayerId,r=Array.isArray(t),i=r?t:[t],c=!1;for(let t of i)e.filterLayerViewUid(t,n)?c=!0:r&&s.push(t);o=!c}yield new B(a,a.slicePlaneEnabled?t:null,a.slicePlaneEnabled?n:null,o,s)}}}class z{constructor(e){this.result=e,this.screenPoint=d()}}class B{constructor(e,t,n,r,i){this.handler=e,this.filterPredicate=t,this.screenPolygonPrimitiveProcessor=n,this.isFiltered=r,this.filteredLayerViewUids=i}}let V;function H(e){return V&&V.isGlobal===e||(V=new O(e)),V}class U{constructor(e,t){this.layers=[],this.sliceableLayers=[],this.include=e?.include,this.exclude=e?.exclude,this.objectFilter=e?.objectFilter,this.allowedIntersectorTypes=e?.allowedIntersectorTypes,t(e=>{e.pickable&&this.filterLayerViewUid(e.apiLayerViewUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)})}filterLayerViewUid(e,t){let{include:n,exclude:r}=this;if(e==null)return n==null&&r==null;let i=n instanceof Map?n.get(e)??!1:n?.has(e),a=r instanceof Map?r.get(e)??!1:r?.has(e);return(i==null||(typeof i==`boolean`?i:t!=null&&i.has(t)))&&(a==null||!(typeof a==`boolean`?a:t!=null&&a.has(t)))}filterRenderGeometry(e){return this.filterLayerViewUid(e.layerViewUid)}}function W(e){return typeof e==`object`&&!!e&&`intersectRay`in e}function G(e,t){return new j(e,_(m(g),e),t)}const K=o(),q=o(),J=d(),Y=f(),X=o(),Z=d();export{R as SceneIntersectionHelper,W as isIntersectionHandler};
|
|
2
|
+
import{set as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{add as n,normalize as r,dot as i,distance as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o,clone as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lerp as c}from"../../../../core/mathUtils.js";import l from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as u,createRenderScreenPointArray3 as d,createScreenPointArray as f}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as p}from"../../../../core/units.js";import{create as m,copy as h,negativeInfinity as g,expandWithNestedArray as _}from"../../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as v}from"../../../../geometry/support/normalizeUtils.js";import{create as y}from"../../../../geometry/support/ray.js";import{sv3d as b}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as x}from"../../../../support/elevationInfoUtils.js";import{TaskPriority as S,noBudget as C}from"../../../support/Scheduler.js";import{Yield as w}from"../../../support/Yield.js";import{g as T}from"../../../../chunks/cameraUtilsSpherical.js";import{fromRenderAtEye as E,fromScreen as D}from"../../support/geometryUtils/ray.js";import{computeMapPointFromVec3d as O}from"../../support/hitTest.js";import{defaultTolerance as k,Intersector as A,defaultScreenPolygonPrimitiveProcessor as j}from"../../webgl-engine/lib/Intersector.js";import{RayIntersectionQuery as M,DrapedScreenPolygonIntersectionQuery as N}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as P}from"../../webgl-engine/lib/IntersectorResult.js";import{SliceScreenPolygonPrimitiveProcessor as F,createSliceExtrusionHalfspacePlanes as I,clipPolygonAgainstSlicedAwayHalfspaces as L,sliceFilterPredicate as R}from"../../webgl-engine/lib/intersectorUtils.js";import{prepareScreenPolygonIntersectionQuery as z}from"../../webgl-engine/lib/screenPolygonIntersectionUtils.js";class B{constructor(e,t,n){this.isGlobal=e,this._forEachLayer=t,this._view=n,this._externalIntersectionHandlers=new l,this._tolerance=k,this._tmpRay=y(),this._tmpRegion=m(),this._validateHUDIntersector=new A(this.isGlobal),this._validateHUDIntersector.options.hud=!1,this._screenPolygonIntersectionTask=this._view.resourceController.scheduler.registerTask(S.SCREEN_POLYGON_INTERSECTION)}destroy(){this._screenPolygonIntersectionTask.remove(),this._externalIntersectionHandlers.prune()}get screenPolygonIntersectionTask(){return this._screenPolygonIntersectionTask}intersectScreen(e,t,n){return this.intersectRay(this._getPickRay(e,this._tmpRay),W(this.isGlobal),t,n)}intersectScreenFreePointFallback(e,t,n){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,n)}intersectRayFreePointFallback(e,t,n){return this.intersectRay(e,W(this.isGlobal),t,n)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,n,r){return this.intersectRayBudgeted(e,t,n,C,r)===!0}intersectRayBudgeted(e,t,n,r,i){return e?(t.options.selectionMode=!1,t.options.store=0,this.computeIntersection(e,t,!1,i,r)?t.results.min?t.results.min.getIntersectionPoint(n):!1:w):!1}getCenterRayWithSubpixelOffset(e,t,n=.5,r=.5){return e.getRenderCenter($,n,r),$[0]+=.0466,$[1]-=.0123,E(e,$,t)}intersectIntersectorScreen(e,t,n){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,!1,n)}async intersectIntersectorScreenPolygon(e,t,n){t.polygonResults.init();let r=this._view.state.camera,i=await z(r,e);i!=null&&await this._screenPolygonIntersectionTask.scheduleGenerator(e=>this._intersectIntersectorScreenPolygon(r,t,i,n,e))}*_intersectIntersectorScreenPolygon(e,t,n,r,i){let a=new G(r,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!r||!(`include`in r||`exclude`in r),t.camera=e,t.metersPerRenderUnit=this._view.renderCoordsHelper.unitInMeters,t.point=null,t.screenPolygonPrimitiveProcessor=j,yield*t.intersectScreenPolygon(a.layers,n);let o=this._view.slice.plane,s=o?new F(o):null;t.screenPolygonPrimitiveProcessor=s??j,yield*t.intersectScreenPolygon(a.sliceableLayers,n),t.screenPolygonPrimitiveProcessor=j,yield*this._intersectPolygonHandlersGenerator(t,a,n,null,s,void 0,!0,i),yield*this._intersectDrapedScreenPolygon(t,a,n,r),yield*t.intersectHUDScreenPolygon(a.layers,n),t.screenPolygonPrimitiveProcessor=s??j,yield*t.intersectHUDScreenPolygon(a.sliceableLayers,n),t.polygonResults.sortResults()}intersectToolIntersectorScreen(e,t,n){let r=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(r,t,n)}intersectToolIntersectorRay(e,t,n){t.options.selectionMode=!0,this.computeIntersection(e,t,!1,n);let r=t.results.min;this._view.groundView.opaque||P(r)&&r.intersector!==7||(t.options.selectionMode=!1,this.computeIntersection(e,t,!1,n))}setTolerance(e=k){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort((e,t)=>e.type===7?1:t.type===7?-1:0)}removeIntersectionHandler(e){this._externalIntersectionHandlers.removeUnordered(e)!=null&&this._externalIntersectionHandlers.sort((e,t)=>e.type===7?1:t.type===7?-1:0)}_getPickRay(e,t){let n=this._view.state.camera;return D(n,e,t)}_intersectRayFreePointLocal(e,t){return this.isGlobal||e==null||n(t,e.origin,r(b.get(),e.direction)),!1}intersectElevationFromScreen(e,t,n=0,r=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,n,r)}_intersectElevation(e,t,n=0,a=null){if(e==null)return null;let o=this._view,{renderCoordsHelper:s}=o,c=p(o.spatialReference),l=t==null?`absolute-height`:t.mode,d=x(t)/c,f=(l===`on-the-ground`?0:d+n)*c/s.unitInMeters,{camera:m}=o.state;if(l===`absolute-height`){let t=s.getAltitude(m.eye),n=i(r(J,e.direction),s.worldUpAtPosition(m.eye,Y));if(t<f&&n<0||t>=f&&n>0)return null;if(s.intersectInfiniteManifold(e,f,J)){let e=O(o,J);return e.z??=0,e.z-=d,e}return null}let h=m.projectToRenderScreen(e.origin,u(b.get())),g=new G(null,this._forEachLayer),_=o.slice.plane,v=_?R(_):null,y=new A(this.isGlobal);y.options.store=0,y.options.verticalOffset=f,y.options.normalRequired=!1;let S=this._createRayIntersectionQuery(e,h,!1);y.metersPerRenderUnit=this._view.renderCoordsHelper.unitInMeters,y.reset(S.beginPoint,S.endPoint,m),y.point=h;let C=null;if(a&&`type`in a&&a.type===`graphics`){let e=o.allLayerViews.find(e=>e.layer===a)?.uid;C=e?t=>t.layerViewUid===e:null}else a&&(C=e=>e.graphicUid!==a.uid);switch(l){case`relative-to-scene`:y.intersect(g.layers,S.screenPoint,this._tolerance,null,e=>(!C||C(e))&&!!e.lastValidElevationBB),this._intersectRayHandlers(y,g,S,v,!1,e=>e.type===2||e.type===7||e.type===8,!1);break;case`on-the-ground`:case`relative-to-ground`:this._intersectRayHandlers(y,g,S,v,!1,e=>e.isGround,!1)}if(y.results.min.getIntersectionPoint(J)){let e=O(o,J);return e.z=n,e}return null}computeIntersection(e,t,n,r,i){if(e==null)return!0;let a=this._view.state.camera,o=a.projectToRenderScreen(e.origin,u(b.get())),s=new G(r,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!r||!(`include`in r||`exclude`in r);let c=this._createRayIntersectionQuery(e,o,n);t.metersPerRenderUnit=this._view.renderCoordsHelper.unitInMeters,t.reset(c.beginPoint,c.endPoint,a),t.intersect(s.layers,c.screenPoint,this._tolerance,null,s.objectFilter);let l=this._view.slice.plane,d=l?R(l):null;t.intersect(s.sliceableLayers,c.screenPoint,this._tolerance,d,s.objectFilter);let f=r&&(r.requiresGroundFeedback||r.enableDraped);if(!this._intersectRayHandlers(t,s,c,d,!!f,e=>s.allowedIntersectorTypes==null||s.allowedIntersectorTypes.has(e.type),!0,i))return!1;let p=b.get(),m=this._view,h=m.groundView.spatialReference;if(r&&r.enableDraped&&h!=null&&t.results.ground.getIntersectionPoint(p)){let e=m.overlayManager.renderer,n=m.renderCoordsHelper.spatialReference,r=b.get();m.renderCoordsHelper.fromRenderCoords(p,r,h),r[2]=m.elevationProvider?.getElevation(p[0],p[1],p[2],n,`ground`)??0,e.intersectRay(t,r,t.results.ground,e=>s.filterRenderGeometry(e))}return t.sortResults(),this._processHUDResults(t),!0}_processHUDResults(e){let t=e.results.hud;h(this._tmpRegion,g);let n=[],r=this._tmpRegion,i=e=>{n.push(new V(e))};e.sortResults(t.all),t.min.distance!=null&&i(t.min);for(let e of t.all)t.min.target.object!==e.target.object&&t.max.target.object!==e.target.object&&i(e);if(t.max.distance!=null&&t.max.target.object!==t.min.target.object&&i(t.max),!n.length)return;r[0]===r[2]&&(r[2]+=1),r[1]===r[3]&&(r[3]+=1);let a=!0,o=e.results.max.distance==null,s=0;for(let t of n)a&&=(e.results.min.copy(t.result),!1),o&&e.results.max.copy(t.result),e.options.store===2&&e.results.all.splice(s++,0,t.result)}_createRayIntersectionQuery(e,t,r){return new M(e.origin,n(o(),e.origin,e.direction),t,r)}_intersectRayHandlers(e,t,n,r,i,a=()=>!0,o=!0,s){let{options:c}=e,l=c.isFiltered,u=c.filteredLayerViewUids,d=!0;for(let{handler:l,filterPredicate:u,isFiltered:f,filteredLayerViewUids:p}of this._getFilteredIntersectionHandlers(t,r,null,a,o))if((!f||l.isGround&&i)&&(c.isFiltered=f,c.filteredLayerViewUids=p,l.intersectRay(e,u,e.rayBegin,e.rayEnd,n.screenPoint,n.isVerticalRay,s)===!1)){d=!1;break}return c.isFiltered=l,c.filteredLayerViewUids=u,d}*_intersectPolygonHandlersGenerator(e,t,n,r,i,a=()=>!0,o=!0,s){let{options:c}=e,l=c.isFiltered,u=c.filteredLayerViewUids,d=e.screenPolygonPrimitiveProcessor;for(let{handler:l,screenPolygonPrimitiveProcessor:u,isFiltered:d,filteredLayerViewUids:f}of this._getFilteredIntersectionHandlers(t,r,i,a,o))d||l.intersectScreenPolygon==null||(c.isFiltered=d,c.filteredLayerViewUids=f,e.screenPolygonPrimitiveProcessor=u??j,yield*l.intersectScreenPolygon(e,n,s));c.isFiltered=l,c.filteredLayerViewUids=u,e.screenPolygonPrimitiveProcessor=d}*_intersectDrapedScreenPolygon(e,t,n,r){let{basemapTerrain:i,overlayManager:a}=this._view,o=this._view.groundView.spatialReference!=null&&!a.renderer.isEmpty;if(!e.options.selectionMode||!r?.enableDraped||!o)return;let s=yield*this._createDrapedPolygonIntersectionQueries(n,i.slicePlaneEnabled?this._view.slice.plane:null);s!=null&&(yield*this._view.overlayManager.renderer.intersectScreenPolygon(e,s,e=>t.filterRenderGeometry(e)))}*_createDrapedPolygonIntersectionQueries(n,r){let{state:{camera:{eye:i}},pointsOfInterest:o}=this._view,l=this._view.groundView.spatialReference,u=[],d=r?[]:null,f=T(this._view,o.focus.renderLocation),p=v(l),m=1/0,h=null,g=J,_=Y,y=e=>{if(!this._intersectDrapedScreenPolygonPoint(g,_,e))return!1;let n=h!=null&&p?h+p.shortestSignedDiff(h,g[0]):g[0];return h=n,u.push(t(n,g[1])),d&&d.push(s(_)),m=Math.min(m,a(i,_)),!0},{points:b}=n,{length:x}=b;for(let t=0;t<x;t++){let n=b[t],r=b[(t+1)%x];for(let t=0;t<f;t++){let i=t/f;if(!y(t===0?n:e(Z,c(n[0],r[0],i),c(n[1],r[1],i))))return null;yield}}if(!Number.isFinite(m))return null;if(r==null||!d)return[q(u,m)];let S=this._clipDrapedScreenPolygonIntersectionQueries(d,r,p,i);return S.length>0?S:null}_clipDrapedScreenPolygonIntersectionQueries(e,t,n,r){let i=[],a=I(t);for(let t of L(a,e)){let e=this._createDrapedQueryFromRenderPolygon(t,n,r);e!=null&&i.push(e)}return i.sort((e,t)=>e.distance-t.distance),i}_createDrapedQueryFromRenderPolygon(e,n,r){let{renderCoordsHelper:i}=this._view,o=this._view.groundView.spatialReference,s=[],c=1/0,l=null;for(let u of e){if(!i.fromRenderCoords(u,Q,o))return null;let e=l!=null&&n?l+n.shortestSignedDiff(l,Q[0]):Q[0];l=e,s.push(t(e,Q[1])),c=Math.min(c,a(r,u))}return s.length>=3&&Number.isFinite(c)?q(s,c):null}_intersectDrapedScreenPolygonPoint(e,t,n){let r=this._getPickRay(n,this._tmpRay);if(r==null)return!1;let{renderCoordsHelper:i}=this._view;this._intersectGroundPoint(t,r,n)||i.intersectManifoldClosestSilhouette(r,0,t);let a=this._view.groundView.spatialReference;return!!i.fromRenderCoords(t,e,a)}_intersectGroundPoint(e,t,n){let r=this._view.state.camera,i=new G(null,this._forEachLayer),a=new A(this.isGlobal);X[0]=n[0],X[1]=n[1],X[2]=0;let o=this._createRayIntersectionQuery(t,X,!1);return a.options.selectionMode=!0,a.options.store=0,a.options.normalRequired=!1,a.options.selectOpaqueTerrainOnly=!1,a.reset(o.beginPoint,o.endPoint,r),this._intersectRayHandlers(a,i,o,null,!0,e=>e.isGround,!1),a.results.ground.getIntersectionPoint(e)}*_getFilteredIntersectionHandlers(e,t,n,r=()=>!0,i=!0){for(let a of this._externalIntersectionHandlers){if(!r(a))continue;let o=!1,s=[];if(i){let t=a.layerViewUid,n=a.sublayerId,r=Array.isArray(t),i=r?t:[t],c=!1;for(let t of i)e.filterLayerViewUid(t,n)?c=!0:r&&s.push(t);o=!c}yield new H(a,a.slicePlaneEnabled?t:null,a.slicePlaneEnabled?n:null,o,s)}}}class V{constructor(e){this.result=e,this.screenPoint=d()}}class H{constructor(e,t,n,r,i){this.handler=e,this.filterPredicate=t,this.screenPolygonPrimitiveProcessor=n,this.isFiltered=r,this.filteredLayerViewUids=i}}let U;function W(e){return U&&U.isGlobal===e||(U=new A(e)),U}class G{constructor(e,t){this.layers=[],this.sliceableLayers=[],this.include=e?.include,this.exclude=e?.exclude,this.objectFilter=e?.objectFilter,this.allowedIntersectorTypes=e?.allowedIntersectorTypes,t(e=>{e.pickable&&this.filterLayerViewUid(e.apiLayerViewUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)})}filterLayerViewUid(e,t){let{include:n,exclude:r}=this;if(e==null)return n==null&&r==null;let i=n instanceof Map?n.get(e)??!1:n?.has(e),a=r instanceof Map?r.get(e)??!1:r?.has(e);return(i==null||(typeof i==`boolean`?i:t!=null&&i.has(t)))&&(a==null||!(typeof a==`boolean`?a:t!=null&&a.has(t)))}filterRenderGeometry(e){return this.filterLayerViewUid(e.layerViewUid)}}function K(e){return typeof e==`object`&&!!e&&`intersectRay`in e}function q(e,t){return new N(e,_(m(g),e),t)}const J=o(),Y=o(),X=d(),Z=f(),Q=o(),$=d();export{B as SceneIntersectionHelper,K as isIntersectionHandler};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{crossAndNormalize as e,copy as t,scale as n,subtract as r,add as i,distance as a,normalize as o,cross as s,dot as c,scaleAndAdd as l,length as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{createScreenPointArray as f}from"../../../../core/screenUtils.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{fromValues as m}from"../../../../geometry/support/lineSegment.js";import{create as h,fromPositionAndNormal as g,distance as _,projectPoint as v,projectVector as y,intersectLineSegment as b}from"../../../../geometry/support/plane.js";import{create as x}from"../../../../geometry/support/ray.js";import{Sphere as S}from"../../../../geometry/support/sphere.js";import{getVoxelWasm as ee}from"../../layers/VoxelWasm.js";import{fromScreenAtEye as te}from"../../support/geometryUtils/ray.js";import{fromRenderCamera as C}from"../../webgl.js";import{Intersector as w}from"../../webgl-engine/lib/Intersector.js";import T from"../../webgl/RenderCamera.js";import{pickPointAndInitSphere as E,sphereOrPlanePointFromScreenPoint as D,intersectPlaneFromScreenPoint as O,searchAreaSize as k}from"./navigationUtils.js";import{OffsetCorrectionController as ne}from"./OffsetCorrectionController.js";const A=1.5,j={xSpeedMultiplier:A,ySpeedMultiplier:A,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12,i3sNodeDownwardCheckDistanceInMeters:5},M=d(),N=d(),P=f(),F=d(),I=h(),L=d(),R=d(),z=d(),B=d(),V=d(),re=d(),H=d(),U=d(),W=d(),G=d(),K=f(),q=x(),J=new S,Y=d(),ie=h(),X=d(),ae=d();function oe(e,t){return y(t,e.viewForward,M),i(N,e.eye,M),e.projectToScreen(N,P),P[1]}function se(t,u,d){let f=t.eye;if(a(u.center,f)<u.radius)return o(V,f),s(re,V,t.viewRight),i(N,f,re),t.projectToScreen(N,K),K[1];let p=t.up;te(t,d,q);let m=u.radius;if(e(F,p,q.direction),g(f,F,I),_(I,u.center)>m)return null;v(I,u.center,L);let h=a(u.center,L),y=Math.sqrt(m**2-h**2);r(R,f,L),o(z,R),e(B,F,z);let b=c(R,z),x=c(R,B),S=Math.sqrt(b**2+x**2),ee=Math.sqrt(S**2-y**2),C=y**2/S**2,w=y/S**2*ee,T=C*b,E=w*-x,D=C*x,O=w*b,k=T+E,ne=T-E,A=D+O,j=D-O;return i(H,L,l(H,n(H,z,k),B,A)),i(U,L,l(U,n(U,z,ne),B,j)),r(W,H,f),o(W,W),r(G,U,f),o(G,G),c(t.viewForward,W)>=c(t.viewForward,G)?t.projectToScreen(H,K):t.projectToScreen(U,K),K[1]}function ce(e,t,n=!0){return n?e<t:e<=t}function Z(e,t,n=!0){return n?e>t:e>=t}function le(e,t,n){return t?e>n:e<n}function Q(e,t){let n=e.fullHeight/e.pixelRatio,r=Math.max(t,n-t);return Math.max(j.minimumHorizonPadding,j.relativeHorizonPadding*r)}function ue(e,t){return[de(e,t),fe(e,t)]}function de(e,t){let n=e.fullHeight/e.pixelRatio;return Math.min(n,t+Q(e,t))}function fe(e,t){return Math.max(0,t-Q(e,t))}function pe(e,t,n){let r={translation:e,location:t};return n&&(r.normal=n),r}function me(e){let{view:t}=e;return t.
|
|
2
|
+
import{crossAndNormalize as e,copy as t,scale as n,subtract as r,add as i,distance as a,normalize as o,cross as s,dot as c,scaleAndAdd as l,length as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{createScreenPointArray as f}from"../../../../core/screenUtils.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{fromValues as m}from"../../../../geometry/support/lineSegment.js";import{create as h,fromPositionAndNormal as g,distance as _,projectPoint as v,projectVector as y,intersectLineSegment as b}from"../../../../geometry/support/plane.js";import{create as x}from"../../../../geometry/support/ray.js";import{Sphere as S}from"../../../../geometry/support/sphere.js";import{getVoxelWasm as ee}from"../../layers/VoxelWasm.js";import{fromScreenAtEye as te}from"../../support/geometryUtils/ray.js";import{fromRenderCamera as C}from"../../webgl.js";import{Intersector as w}from"../../webgl-engine/lib/Intersector.js";import T from"../../webgl/RenderCamera.js";import{pickPointAndInitSphere as E,sphereOrPlanePointFromScreenPoint as D,intersectPlaneFromScreenPoint as O,searchAreaSize as k}from"./navigationUtils.js";import{OffsetCorrectionController as ne}from"./OffsetCorrectionController.js";const A=1.5,j={xSpeedMultiplier:A,ySpeedMultiplier:A,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12,i3sNodeDownwardCheckDistanceInMeters:5},M=d(),N=d(),P=f(),F=d(),I=h(),L=d(),R=d(),z=d(),B=d(),V=d(),re=d(),H=d(),U=d(),W=d(),G=d(),K=f(),q=x(),J=new S,Y=d(),ie=h(),X=d(),ae=d();function oe(e,t){return y(t,e.viewForward,M),i(N,e.eye,M),e.projectToScreen(N,P),P[1]}function se(t,u,d){let f=t.eye;if(a(u.center,f)<u.radius)return o(V,f),s(re,V,t.viewRight),i(N,f,re),t.projectToScreen(N,K),K[1];let p=t.up;te(t,d,q);let m=u.radius;if(e(F,p,q.direction),g(f,F,I),_(I,u.center)>m)return null;v(I,u.center,L);let h=a(u.center,L),y=Math.sqrt(m**2-h**2);r(R,f,L),o(z,R),e(B,F,z);let b=c(R,z),x=c(R,B),S=Math.sqrt(b**2+x**2),ee=Math.sqrt(S**2-y**2),C=y**2/S**2,w=y/S**2*ee,T=C*b,E=w*-x,D=C*x,O=w*b,k=T+E,ne=T-E,A=D+O,j=D-O;return i(H,L,l(H,n(H,z,k),B,A)),i(U,L,l(U,n(U,z,ne),B,j)),r(W,H,f),o(W,W),r(G,U,f),o(G,G),c(t.viewForward,W)>=c(t.viewForward,G)?t.projectToScreen(H,K):t.projectToScreen(U,K),K[1]}function ce(e,t,n=!0){return n?e<t:e<=t}function Z(e,t,n=!0){return n?e>t:e>=t}function le(e,t,n){return t?e>n:e<n}function Q(e,t){let n=e.fullHeight/e.pixelRatio,r=Math.max(t,n-t);return Math.max(j.minimumHorizonPadding,j.relativeHorizonPadding*r)}function ue(e,t){return[de(e,t),fe(e,t)]}function de(e,t){let n=e.fullHeight/e.pixelRatio;return Math.min(n,t+Q(e,t))}function fe(e,t){return Math.max(0,t-Q(e,t))}function pe(e,t,n){let r={translation:e,location:t};return n&&(r.normal=n),r}function me(e){let{view:t}=e;return t.state.isGlobal?he(e):ge(e)}function he(e){let{view:n,originalScreenPoint:r,horizonY:i,horizonPadding:s,outTranslation:c,outGrabLocation:l,outGrabNormal:u,intersectionOptions:d,depthSearchSize:f}=e,m=n.state.camera,h=pe(c,l,u);J.radius=p(n.spatialReference).radius;let g=E(n,m,r,J.radius,1,d);if(g.scenePickPoint==null)return!1;let _=g.hasGeometryIntersection;t(Y,g.scenePickPoint),t(h.location,Y);let v=g.sphere;h.normal&&g.normal&&t(h.normal,g.normal);let y=ve(r,i,s,_),b=_?a(Y,m.eye):1/0;return y.wasAdjusted&&ye({view:n,screenAdjustment:y,intersector:$(n),fallbackCheck:(e,t,n)=>{let r=D(v,m,e,t);return r&&n&&o(n,t),r},output:h,intersectionOptions:d}),xe({view:n,screenPoint:y.adjustedScreenPoint,camera:m,initialDistance:b,depthSearchSize:f??k,output:h}),!0}function ge(e){let{view:n,originalScreenPoint:r,horizonY:i,horizonPadding:s,outTranslation:c,outGrabLocation:u,outGrabNormal:d,intersectionOptions:f,depthSearchSize:p}=e,m=n.sceneIntersectionHelper,h=n.state.camera,_=$(n),v=pe(c,u,d);m.intersectIntersectorScreen(r,_,f);let y=_.results.min.getIntersectionPoint(Y),b=y?a(Y,h.eye):1/0;y&&(t(v.location,Y),v.normal&&t(v.normal,_.results.min.normal)),n.renderCoordsHelper.worldUpAtPosition(h.eye,V),l(X,h.eye,V,-h.relativeElevation),g(X,V,ie);let x=ve(r,i,s,y);return x.wasAdjusted&&ye({view:n,screenAdjustment:x,intersector:_,fallbackCheck:(e,t,n)=>{let r=O(ie,h,e,t);return r&&n&&o(n,V),r},output:v,intersectionOptions:f}),xe({view:n,screenPoint:x.adjustedScreenPoint,camera:h,initialDistance:b,depthSearchSize:p??k,output:v}),!0}function _e(e,t,n,r){return!r&&ce(e,t)||r&&le(e,!1,n[0])?n[0]:!r&&Z(e,t,!1)?n[1]:null}function ve(e,t,n,r){let i=_e(e[1],t,n,r);return{originalScreenPoint:e,adjustedScreenPoint:f(e[0],i??e[1]),horizonY:t,horizonPadding:n,wasAdjusted:i!==null}}function $(e){let t=new w(e.state.isGlobal);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function ye(e){let{view:n,screenAdjustment:r,fallbackCheck:i,intersector:a,output:o,intersectionOptions:s}=e,c=n.sceneIntersectionHelper;c.intersectIntersectorScreen(r.adjustedScreenPoint,a,{...s,requiresGroundFeedback:!0});let l=a.results.min.getIntersectionPoint(o.location);if(l){o.normal&&t(o.normal,a.results.min.normal);return}let u=be(r);c.intersectIntersectorScreen(u,a,{...s,requiresGroundFeedback:!0}),l=a.results.min.getIntersectionPoint(o.location),l?o.normal&&t(o.normal,a.results.min.normal):(l=i(r.adjustedScreenPoint,o.location,o.normal),l||i(u,o.location,o.normal))}function be(e){let{originalScreenPoint:t,adjustedScreenPoint:n,horizonY:r,horizonPadding:i}=e,a=Z(n[1],r)?Math.min(i[1],t[1]):Math.max(i[0],t[1]);return f(n[0],a)}function xe(e){Se(e),Ce(e)}function Se(e){let{view:n,camera:i,output:a}=e,{offset:o}=n.navigation.mode;if(!o)return;let{translation:s,location:c}=a;n.renderCoordsHelper.worldUpAtPosition(i.eye,V),l(X,i.eye,V,-o),g(X,V,I),b(I,m(i.eye,r(M,c,i.eye)),X)&&(t(c,X),r(s,c,i.eye))}function Ce(e){let{view:t,screenPoint:a,camera:s,initialDistance:c,depthSearchSize:l,output:d}=e,f=l>0?t.stage.renderView.getMinimalDepthForArea(ee(t),a[0],a[1],s,l):null;r(d.translation,d.location,s.eye);let p=Math.min(u(d.translation),c);f&&f<=p&&(p=f),o(d.translation,d.translation),n(d.translation,d.translation,p),i(d.location,d.translation,s.eye)}async function we(e,t,n,r,i){let a=new T().copyFrom(e.state.camera);if(Te({view:e,camera:a,forwardDirection:t,forwardDistance:n,detectCollisions:!0}))return r?r.smoothlyCorrectGroundElevation({camera:a,deltaTime:i}):new ne(e).immediatelyCorrectGroundElevation({camera:a,correctionLimit:100}),e.goTo(C(e,a),{duration:500,liftOffDisabled:!0})}function Te(o){let{view:s,camera:c,forwardDirection:l,forwardDistance:d,detectCollisions:f}=o,p=s.navigation.mode;if(p.type!==`ground`)return!1;s.renderCoordsHelper.worldUpAtPosition(c.eye,V);let m=s.sceneIntersectionHelper,h=$(s),g=e(M,V,e(M,l,V));t(q.origin,c.eye),n(q.direction,g,d);let _=m.intersectRay(q,h,Y,{include:p.include,exclude:p.exclude}),v=r(ae,c.center,c.eye);return!f||!_||a(Y,c.eye)>Math.abs(d)?c.eye=i(M,q.origin,q.direction):(r(M,Y,c.eye),u(M)>2&&(Ee(M,M,.25,2),c.eye=i(M,c.eye,M))),c.center=i(M,c.eye,v),!0}function Ee(e,t,r,i){let a=u(e),o=Math.min(r,Math.max(a-i,0)/a);n(t,e,o)}export{Te as advanceGroundNavigationCamera,Q as computeHorizonPadding,ue as computeHorizonPaddingLimits,me as findGroundNavigationGrabLocation,oe as findPlaneHorizonY,se as findSphereHorizonY,we as groundNavigationAdvance,j as groundNavigationConstants,ce as isAboveHorizon,Z as isBelowHorizon,Ee as shortenTranslation,le as shouldClampScreenY};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{cyclicalPI as e}from"../../../../core/Cyclical.js";import{IDENTITY as t,create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromRotation as r,exactEquals as i,multiply as a,rotate as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as l,length as u,dot as d,subtract as f,normalize as p,squaredDistance as m,copy as h,transformMat4 as g,add as _,distance as ee,cross as v,scale as y,lerp as te,set as ne}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as re,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{deg2rad as x,clamp as ie,acosClamped as S,asinClamped as ae}from"../../../../core/mathUtils.js";import{createScreenPointArray as oe}from"../../../../core/screenUtils.js";import{create as se,axis as ce,fromPoints as le,wrapAxisAngle as ue}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as C,vectorCoordinates as de}from"../../../../geometry/support/coordinateSystem.js";import{create as fe,fromNormalAndOffset as pe,intersectRay as w}from"../../../../geometry/support/plane.js";import{Sphere as me}from"../../../../geometry/support/sphere.js";import{sm4d as he,sv3d as T}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as E,fromScreen as ge}from"../../support/geometryUtils/ray.js";import{intersectScreen as _e}from"../../support/geometryUtils/sphere.js";import{Intersector as ve}from"../../webgl-engine/lib/Intersector.js";import{terrainId as ye}from"../../webgl-engine/lib/verticalOffsetUtils.js";import be from"../../webgl/RenderCamera.js";const xe=30,Se=[1,3e8],Ce=8,we=[200,1508e5],Te=5,Ee=50,De=5,Oe=10,ke=90,D=1e-6,Ae={exclude:new Set([ye])};function je(e,t,n){return n[0]=t[0]/(e.fullWidth/e.pixelRatio),n[1]=t[1]/(e.fullHeight/e.pixelRatio),n}function Me(e){for(;e>Math.PI;)e-=2*Math.PI;for(;e<-Math.PI;)e+=2*Math.PI;return e}function O(e,n,a){let o=r(he.get(),a[3],ce(a));o==null||i(o,t)||(f(J,e.eye,n),g(J,J,o),e.eye=_(J,J,n),f(J,e.center,n),g(J,J,o),e.center=_(J,J,n),e.up=g(J,e.up,o))}function Ne(e,t,n,r){return w(e,ge(t,n,Q),r)}function Pe(e,t,n,r){return w(e,E(t,n,Q),r)}function Fe(e,t,n,r){let i=T.get(),a=1-n;f(i,t,e.eye);let o=u(i),s=o*(1-a);a>=0&&s<r&&(s=r,a=-(s-o)/o),Math.abs(o-s)<D||(y(i,i,a),e.eye=_(J,e.eye,i),e.center=te(J,e.center,t,a))}function Ie(e,t,n){t.getScreenCenter(Le),_e(e,t,Le,J)&&(t.center=J);let r=t.distance,i=r*n;if(Math.abs(r-i)<D)return;let a=y(T.get(),t.viewForward,i);t.eye=f(J,t.center,a)}const Le=oe();function Re(e,t){ne(t,0,0,0);for(let n of e)_(t,t,n);y(t,t,1/e.length)}function ze(e,t,n,r){return Math.sin(e/u(t))*(n+r.radius)}function Be(e,t,n,r){return ze(Math.PI/2,t,n,r)+(e-Math.PI/2)}const k={Elevation:3e4,Angle:x(16)},A=x(80);function Ve(e,t,n,r,i,a){let o=e.sceneIntersectionHelper,s=new ve(e.state.isGlobal);s.options.selectionMode=!1,s.options.store=0,s.options.hud=!1,s.options.normalRequired=!0;let c=null,d=b(),f=new me,p=!0,m=!0,{eye:h}=t;o.intersectIntersectorScreen(n,s,a);let g=s.results.min;return g.getIntersectionPoint(d)&&!l(h,d)&&at(h,d,r)?(c=re(g.normal),f.radius=u(d)):(m=!1,f.radius=!t.aboveGround||i===0?u(t.eye)-t.relativeElevation:Math.max(u(t.center),.9*r),i===1?We(f,t,n,d):p=_e(f,t,n,d)),{sphere:f,scenePickPoint:p?d:null,hasGeometryIntersection:m,intersectorType:g.intersector,normal:c}}function He(e,t,n,r){let i=e.relativeElevation;if(i>k.Elevation&&r
|
|
2
|
+
import{cyclicalPI as e}from"../../../../core/Cyclical.js";import{IDENTITY as t,create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromRotation as r,exactEquals as i,multiply as a,rotate as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as l,length as u,dot as d,subtract as f,normalize as p,squaredDistance as m,copy as h,transformMat4 as g,add as _,distance as ee,cross as v,scale as y,lerp as te,set as ne}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as re,create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{deg2rad as x,clamp as ie,acosClamped as S,asinClamped as ae}from"../../../../core/mathUtils.js";import{createScreenPointArray as oe}from"../../../../core/screenUtils.js";import{create as se,axis as ce,fromPoints as le,wrapAxisAngle as ue}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as C,vectorCoordinates as de}from"../../../../geometry/support/coordinateSystem.js";import{create as fe,fromNormalAndOffset as pe,intersectRay as w}from"../../../../geometry/support/plane.js";import{Sphere as me}from"../../../../geometry/support/sphere.js";import{sm4d as he,sv3d as T}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as E,fromScreen as ge}from"../../support/geometryUtils/ray.js";import{intersectScreen as _e}from"../../support/geometryUtils/sphere.js";import{Intersector as ve}from"../../webgl-engine/lib/Intersector.js";import{terrainId as ye}from"../../webgl-engine/lib/verticalOffsetUtils.js";import be from"../../webgl/RenderCamera.js";const xe=30,Se=[1,3e8],Ce=8,we=[200,1508e5],Te=5,Ee=50,De=5,Oe=10,ke=90,D=1e-6,Ae={exclude:new Set([ye])};function je(e,t,n){return n[0]=t[0]/(e.fullWidth/e.pixelRatio),n[1]=t[1]/(e.fullHeight/e.pixelRatio),n}function Me(e){for(;e>Math.PI;)e-=2*Math.PI;for(;e<-Math.PI;)e+=2*Math.PI;return e}function O(e,n,a){let o=r(he.get(),a[3],ce(a));o==null||i(o,t)||(f(J,e.eye,n),g(J,J,o),e.eye=_(J,J,n),f(J,e.center,n),g(J,J,o),e.center=_(J,J,n),e.up=g(J,e.up,o))}function Ne(e,t,n,r){return w(e,ge(t,n,Q),r)}function Pe(e,t,n,r){return w(e,E(t,n,Q),r)}function Fe(e,t,n,r){let i=T.get(),a=1-n;f(i,t,e.eye);let o=u(i),s=o*(1-a);a>=0&&s<r&&(s=r,a=-(s-o)/o),Math.abs(o-s)<D||(y(i,i,a),e.eye=_(J,e.eye,i),e.center=te(J,e.center,t,a))}function Ie(e,t,n){t.getScreenCenter(Le),_e(e,t,Le,J)&&(t.center=J);let r=t.distance,i=r*n;if(Math.abs(r-i)<D)return;let a=y(T.get(),t.viewForward,i);t.eye=f(J,t.center,a)}const Le=oe();function Re(e,t){ne(t,0,0,0);for(let n of e)_(t,t,n);y(t,t,1/e.length)}function ze(e,t,n,r){return Math.sin(e/u(t))*(n+r.radius)}function Be(e,t,n,r){return ze(Math.PI/2,t,n,r)+(e-Math.PI/2)}const k={Elevation:3e4,Angle:x(16)},A=x(80);function Ve(e,t,n,r,i,a){let o=e.sceneIntersectionHelper,s=new ve(e.state.isGlobal);s.options.selectionMode=!1,s.options.store=0,s.options.hud=!1,s.options.normalRequired=!0;let c=null,d=b(),f=new me,p=!0,m=!0,{eye:h}=t;o.intersectIntersectorScreen(n,s,a);let g=s.results.min;return g.getIntersectionPoint(d)&&!l(h,d)&&at(h,d,r)?(c=re(g.normal),f.radius=u(d)):(m=!1,f.radius=!t.aboveGround||i===0?u(t.eye)-t.relativeElevation:Math.max(u(t.center),.9*r),i===1?We(f,t,n,d):p=_e(f,t,n,d)),{sphere:f,scenePickPoint:p?d:null,hasGeometryIntersection:m,intersectorType:g.intersector,normal:c}}function He(e,t,n,r){let i=e.relativeElevation;if(i>k.Elevation&&r)return 1;E(e,t,$);let a=Math.sign(i),o=n.worldUpAtPosition(e.eye,J);return-a*d(o,$.direction)<Math.sin(k.Angle)*u($.direction)?0:1}function Ue(e,t,n){f(j,n,t),e.eye=f(J,e.eye,j),e.center=f(J,e.center,j)}const j=b();function We(e,t,n,r){let i=E(t,n,Q);return i!=null&&(e.closestPointOnSilhouette(i,M),e.intersectRay(i,r)?m(M,i.origin)<m(r,i.origin)?(h(r,M),!1):!0:(f(N,t.eye,t.center),p(N,N),pe(N,-d(p(N,N),M),Ge),w(Ge,i,r),!1))}const M=b(),N=b(),Ge=fe();function Ke(t,n,r,i,a,o){let s=0;if(v(Z,t,n),f(Y,t,n),u(t)<=a||!i.aboveGround){v(r,Y,i.eye);let c=d(t,n)/(u(t)*u(n));if(c<.9999)s=S(c);else{let e=u(v(b(),t,n))/(u(t)*u(n));s=ae(e)}let l=Math.cos(ie(e.normalize(x(o)),0,A));s=-s-Math.max(0,u(n)-a)/(l*a)}else f(qe,i.eye,i.center),v(r,Y,qe),s=-u(Y)/a;return p(r,r),y(r,r,u(Z)),s}const qe=b();function P(t,n,r,i){let a,o,s=Math.cos(ie(e.normalize(x(i)),0,A));return a=n>r?-(n-r)/(s*r):n<-r?Math.PI-(n+r)/(s*r):S(n/r),o=t>r?-(t-r)/(s*r):t<-r?Math.PI-(t+r)/(s*r):S(t/r),(o-a)*r}function Je(e,t,n,r,i,a,o,c,l,u){let f=P(e[2],t[2],a.radius,c),m=l?P(e[0],t[0],a.radius,180):t[0]-e[0],h=Math.sin(o)*m-Math.cos(o)*f,g=Math.cos(o)*m+Math.sin(o)*f;p(J,i);let _=l?h/Math.sqrt(Math.abs(a.radius**2-d(n,J)**2)):h/a.radius,ee=g/Math.sqrt(Math.abs(a.radius**2-d(n,r)**2));s(u,_,ee)}function Ye(e,t,n,r,i,a,o,s,c,l){v(Z,e,t),C(a.up,a.eye,B,V,H),C([0,0,1],a.eye,R,z,ot),h(n,z),h(r,R),p(n,n),y(n,n,u(Z)),de(e,p(V,V),p(H,H),p(B,B),st),de(t,V,H,B,ct),Je(st,ct,e,R,z,o,s,c,l,i)}function Xe(e,t,n,i,o,s,c){r(W,o,i),r(G,c,s),a(K,W,G),f(t,e,n),g(t,t,K),_(t,t,n)}function Ze(e,t,n,i,o,s){r(W,i,n),r(G,s,o),a(K,W,G),f(J,e.eye,t),g(J,J,K),e.eye=_(J,J,t),f(J,e.center,t),g(J,J,K),e.center=_(J,J,t),f(J,e.up,t),g(J,J,K),e.up=_(J,J,t)}const F={Pole:.95,Angle:x(18),Tilt:45,TiltHysteresisMargin:1e-7};let I=!1;function L(e,t,n,r,i,a){let o=Math.abs(r)>Math.PI-F.Angle||Math.abs(r)<F.Angle,s=(Math.abs(e[2])<n*F.Pole||Math.abs(t)>n)&&a;return o&&s?!I&&i<F.Tilt-F.TiltHysteresisMargin?I=!0:I&&i>F.Tilt+F.TiltHysteresisMargin&&(I=!1):I=!1,I}function Qe(e,t,n,r,i,a){if(a)le(n,r,lt),O(t,e.center,lt);else{let a=Ke(n,r,ut,t,e.radius,i);O(t,e.center,ue(ut,a))}}function $e(e,t,n,r,i,a,o){let s=o?20:1;h(q,r),X.copyFrom(t);let c,l;for(let r=0;r<s&&m(n,q)>1e-12&&(c=m(n,q),Ye(n,q,z,R,U,X,e,i,a,o),Ze(X,e.center,R,U[1],z,U[0]),Xe(q,q,e.center,R,U[1],z,U[0]),l=m(n,q),l<c||r===0);r++)t.copyFrom(X)}function et(t,n,r,i,a,o,s){L(r,d(n.up,r),t.radius,-e.normalize(x(a)),o,n.aboveGround)?$e(t,n,r,i,-e.normalize(x(a)),o,s):Qe(t,n,r,i,o,s)}function tt(e,t,n,r,i,a){let{eye:s}=e;C([0,0,1],s,R,z,ot);let c=t.translation[0]*n.pan,l=i.mode===`zoom`?0:t.translation[1]*n.pan,f=Math.max(Math.sqrt(Math.abs(1-d(e.center,R)**2/u(e.center)**2)),.5),p=(Math.sin(a)*l+Math.cos(a)*c)/f,m=-Math.cos(a)*l+Math.sin(a)*c;switch(o(r.pan.matrix,r.pan.matrix,p,R),r.pan.enabled=!0,i.mode){case`pan`:o(r.pan.matrix,r.pan.matrix,m,z),r.pan.enabled=!0;break;case`zoom`:r.zoom=-t.translation[1]*n.zoom}}function nt(e,t,n,r,i){let{eye:a,viewRight:s}=e,c=v(T.get(),s,a),l=t.translation[0]*n.pan;switch(l!==0&&(o(r.pan.matrix,r.pan.matrix,-l,c),r.pan.enabled=!0),i.mode){case`pan`:{let e=t.translation[1]*n.pan;e!==0&&(o(r.pan.matrix,r.pan.matrix,e,s),r.pan.enabled=!0);break}case`zoom`:r.zoom=-t.translation[1]*n.zoom}}function rt(t,n,r,i,a,o,s,c,l){L(t.center,d(t.up,t.center),u(t.center),-e.normalize(x(o)),s,n.aboveGround)?tt(n,r,i,c,l,-e.normalize(x(a))):nt(n,r,i,c,l)}function it(e,t,n=1/0){let r=Math.abs(d(e,t));return Math.min(n,1/r)}function at(e,t,n){let r=ee(e,t),i=u(e);return r<Math.max(i,n)}const R=b(),z=b(),ot=b(),B=b(),V=b(),H=b(),st=b(),ct=b(),U=c(),lt=se(),W=n(),G=n(),K=n(),q=b(),J=b(),Y=b();let X=new be;const Z=b(),ut=b();function dt(){X=new be}const Q={origin:b(),direction:b()},$={origin:b(),direction:b()};export{A as TiltThresholdPanningSpeed,k as VerticalPanTresholds,Ue as applyPanPlanar,Qe as applyPanSphericalDirectRotation,$e as applyPanSphericalPreserveHeading,O as applyRotation,Ze as applyRotationWithTwoAxes,Ie as applyZoomOnSphere,Fe as applyZoomToPoint,Re as centroid,dt as cleanupNavigationUtils,D as distanceComparisonTolerance,Ae as excludeTerrain,it as getTiltScaleFactor,He as inferNavigationMode,Ne as intersectPlaneFromScreenPoint,Pe as intersectPlaneFromScreenPointAtEye,at as isHitOnSamePlanetSide,P as lengthFromPoints,Te as maxPanDistanceModifier,De as maxRotatePivotDistanceModifier,xe as maxZoomPivotDistanceModifier,Ce as maxZoomStepDistanceModifier,Ee as minPinchAndPanCameraHeight,Oe as minRotatePivotDistance,je as normalizeCoordinate,Me as normalizeRotationDelta,Be as offSurfaceTiltToEyeTiltGlobal,ze as onSurfaceTiltToEyeTiltGlobal,rt as panMotionToRotationMatrix,et as panToPosition,Ve as pickPointAndInitSphere,F as preservingHeadingThresholds,Xe as rotatePointAroundTwoAxes,Ke as rotationAngleAndAxisDirectRotation,Ye as rotationAnglesAndAxesHeadingPreserving,Je as rotationAnglesHeadingPreserving,ke as searchAreaSize,L as shouldPreserveHeading,We as sphereOrPlanePointFromScreenPoint,Se as zoomPivotDistanceClamp,we as zoomStepDistanceClamp};
|
|
@@ -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}from"../../../core/accessorSupport/decorators/property.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{EventedAccessor as r}from"../../../core/Evented.js";import{on as i}from"../../../core/reactiveUtils.js";import{IntegratedMeshSemantics as a}from"../../../layers/support/IntegratedMeshSemantics.js";import{isIntegratedMeshLayerView as o}from"../../support/layerViewUtils.js";import{noBudget as s}from"../../support/Scheduler.js";let c=class extends r{constructor(e){super(e),this._integratedMeshElevationUpdateHandles=new Map}initialize(){let e=this._integratedMeshElevationUpdateHandles;this.addHandles([i(()=>this.view.groundView,`elevation-change`,e=>this._elevationChange(e)),this.view.allLayerViews.on(`change`,t=>{t.added.forEach(t=>{if(!o(t)||a.contributesToGroundElevation(t.layer,t.replacesTerrain))return;let n=t.elevationProvider.on(`elevation-change`,e=>this._elevationChange(e));e.set(t,n),this.addHandles(n,t)}),t.removed.forEach(t=>{o(t)&&(this.removeHandles(t),e.delete(t))})})])}intersect(e,t,n,r){this.intersectBudgeted(e,t,n,r,s)}intersectBudgeted(e,t,n,r,i){if(!this.view.groundView.intersectBudgeted(e,t,n,r,i))return!1;for(let
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{EventedAccessor as r}from"../../../core/Evented.js";import{on as i}from"../../../core/reactiveUtils.js";import{IntegratedMeshSemantics as a}from"../../../layers/support/IntegratedMeshSemantics.js";import{isIntegratedMeshLayerView as o}from"../../support/layerViewUtils.js";import{noBudget as s}from"../../support/Scheduler.js";let c=class extends r{constructor(e){super(e),this._integratedMeshElevationUpdateHandles=new Map}initialize(){let e=this._integratedMeshElevationUpdateHandles;this.addHandles([i(()=>this.view.groundView,`elevation-change`,e=>this._elevationChange(e)),this.view.allLayerViews.on(`change`,t=>{t.added.forEach(t=>{if(!o(t)||a.contributesToGroundElevation(t.layer,t.replacesTerrain))return;let n=t.elevationProvider.on(`elevation-change`,e=>this._elevationChange(e));e.set(t,n),this.addHandles(n,t)}),t.removed.forEach(t=>{o(t)&&(this.removeHandles(t),e.delete(t))})})])}intersect(e,t,n,r){this.intersectBudgeted(e,t,n,r,s)}intersectBudgeted(e,t,n,r,i){if(!this.view.groundView.intersectBudgeted(e,t,n,r,i))return!1;for(let a of this._integratedMeshElevationUpdateHandles.keys())if(!a.intersect(e,t,n,r,i))return!1;return!0}_elevationChange(e){this.emit(`elevation-change`,e)}};e([t({constructOnly:!0})],c.prototype,`view`,void 0),c=e([n(`esri.views.3d.support.GroundAndIMSurface`)],c);export{c as GroundAndIMSurface};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";function t(e){return a[e]}function n(){return has(`esri-iPhone`)?`low`:`medium`}const r={reset(){a=o()}},i={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430};let a=o();function o(){return{low:s(`low`),medium:s(`medium`),high:s(`high`)}}function s(t){let n=!!has(`esri-mobile`),r=!has(`ios`),a=e=>e[t];return{graphics3D:{maxTotalNumberOfFeatures:a({low:5e4,medium:15e4,high:3e5}),maxNumberOfDrawCalls:a({low:8e3,medium:17e3,high:17e3}),maxTotalNumberOfVertices:a({low:255e4,medium:625e4,high:125e5}),polygonLodFactor:a({low:.5,medium:n?.8:1,high:n?1.2:2}),polylineLodFactor:a({low:1,medium:n?1.2:1.5,high:n?1.2:2}),snapshotAvailable:a({low:!1,medium:r,high:r}),skipHighSymbolLods:a({low:!0,medium:!1,high:!1})},heatmap:{pixelRatio:a({low:.125,medium:.25,high:.5})},sceneService:{objectLoDFactor:a({low:.2,medium:1,high:1}),
|
|
2
|
+
import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";function t(e){return a[e]}function n(){return has(`esri-iPhone`)?`low`:`medium`}const r={reset(){a=o()}},i={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430};let a=o();function o(){return{low:s(`low`),medium:s(`medium`),high:s(`high`)}}function s(t){let n=!!has(`esri-mobile`),r=!has(`ios`),a=e=>e[t];return{graphics3D:{maxTotalNumberOfFeatures:a({low:5e4,medium:15e4,high:3e5}),maxNumberOfDrawCalls:a({low:8e3,medium:17e3,high:17e3}),maxTotalNumberOfVertices:a({low:255e4,medium:625e4,high:125e5}),polygonLodFactor:a({low:.5,medium:n?.8:1,high:n?1.2:2}),polylineLodFactor:a({low:1,medium:n?1.2:1.5,high:n?1.2:2}),snapshotAvailable:a({low:!1,medium:r,high:r}),skipHighSymbolLods:a({low:!0,medium:!1,high:!1})},heatmap:{pixelRatio:a({low:.125,medium:.25,high:.5})},sceneService:{objectLoDFactor:a({low:.2,medium:1,high:1}),meshLoDFactor:a({low:.6,medium:1,high:1}),pointCloudLoDFactor:a({low:.5,medium:1,high:1})},gaussianSplat:{minimumPixelRadius:a({low:2,medium:1,high:.5}),minimumOpacity:a({low:0,medium:1,high:2}),maximumNumberOfGaussians:a({low:1e6,medium:n?1e6:3e6,high:6e6})},flow:{maxTotalNumberOfStreamlines:a({low:5e3,medium:2e4,high:2e4}),maxTracingResolution:a({low:1024,medium:2048,high:2048}),transitionEnabled:a({low:!1,medium:!0,high:!0})},tiledSurface:{lodBias:a({low:-1,medium:0,high:0}),angledSplitBias:a({low:.5,medium:1,high:1}),elevationLevelDelta:a({low:3,medium:3,high:2})},fadeDuration:e(a({low:0,medium:400,high:400})),physicallyBasedRenderingEnabled:a({low:!1,medium:!0,high:!0}),maxTexturePixels:a({low:n?1024**2:2048**2,medium:n?2048**2:4096**2,high:n?4096**2:1/0}),memoryLimit:a({low:200+i.IPhone12Pro,medium:n?600+i.GalaxyS20:750+i.FullHD,high:n?900+i.SurfacePro7:1500+i.FullHDRetina})*1048576,additionalCacheMemory:a({low:0,medium:n?-100:150,high:n?-150:0})*1048576,maximumPixelRatio:a({low:1,medium:1,high:n?1:1/0})}}export{r as QualityProfileTest,n as getDefaultQualityProfileName,t as getQualityProfileSettings};
|
|
@@ -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{Milliseconds as i}from"../../../core/time.js";let a=class extends t{constructor(e={}){super(e),this.minTotalNumberOfFeatures=2e3,this.maxTotalNumberOfFeatures=5e4,this.maxNumberOfDrawCalls=17e3,this.maxTotalNumberOfVertices=17e5,this.snapshotAvailable=!0,this.polygonLodFactor=1,this.polylineLodFactor=1,this.skipHighSymbolLods=!1}};e([n()],a.prototype,`maxTotalNumberOfFeatures`,void 0),e([n()],a.prototype,`maxNumberOfDrawCalls`,void 0),e([n()],a.prototype,`maxTotalNumberOfVertices`,void 0),e([n()],a.prototype,`snapshotAvailable`,void 0),e([n()],a.prototype,`polygonLodFactor`,void 0),e([n()],a.prototype,`polylineLodFactor`,void 0),e([n()],a.prototype,`skipHighSymbolLods`,void 0),a=e([r(`esri.views.3d.support.QualitySettings.Graphics3DSettings`)],a);let o=class extends t{constructor(e={}){super(e),this.objectLoDFactor=1,this.
|
|
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{Milliseconds as i}from"../../../core/time.js";let a=class extends t{constructor(e={}){super(e),this.minTotalNumberOfFeatures=2e3,this.maxTotalNumberOfFeatures=5e4,this.maxNumberOfDrawCalls=17e3,this.maxTotalNumberOfVertices=17e5,this.snapshotAvailable=!0,this.polygonLodFactor=1,this.polylineLodFactor=1,this.skipHighSymbolLods=!1}};e([n()],a.prototype,`maxTotalNumberOfFeatures`,void 0),e([n()],a.prototype,`maxNumberOfDrawCalls`,void 0),e([n()],a.prototype,`maxTotalNumberOfVertices`,void 0),e([n()],a.prototype,`snapshotAvailable`,void 0),e([n()],a.prototype,`polygonLodFactor`,void 0),e([n()],a.prototype,`polylineLodFactor`,void 0),e([n()],a.prototype,`skipHighSymbolLods`,void 0),a=e([r(`esri.views.3d.support.QualitySettings.Graphics3DSettings`)],a);let o=class extends t{constructor(e={}){super(e),this.objectLoDFactor=1,this.meshLoDFactor=1,this.pointCloudLoDFactor=1}};e([n()],o.prototype,`objectLoDFactor`,void 0),e([n()],o.prototype,`meshLoDFactor`,void 0),e([n()],o.prototype,`pointCloudLoDFactor`,void 0),o=e([r(`esri.views.3d.support.QualitySettings.SceneServiceSettings`)],o);let s=class extends t{constructor(e={}){super(e),this.lodBias=0,this.angledSplitBias=1,this.elevationLevelDelta=3}};e([n()],s.prototype,`lodBias`,void 0),e([n()],s.prototype,`angledSplitBias`,void 0),e([n()],s.prototype,`elevationLevelDelta`,void 0),s=e([r(`esri.views.3d.support.QualitySettings.TiledSurfaceSettings`)],s);let c=class extends t{constructor(e={}){super(e),this.minimumPixelRadius=1,this.minimumOpacity=1,this.maximumNumberOfGaussians=2e6}};e([n()],c.prototype,`minimumPixelRadius`,void 0),e([n()],c.prototype,`minimumOpacity`,void 0),e([n()],c.prototype,`maximumNumberOfGaussians`,void 0),c=e([r(`esri.views.3d.support.QualitySettings.GaussianSplatSettings`)],c);let l=class extends t{constructor(e={}){super(e),this.pixelRatio=1}};e([n()],l.prototype,`pixelRatio`,void 0),l=e([r(`esri.views.3d.support.QualitySettings.HeatmapSettings`)],l);let u=class extends t{constructor(){super(...arguments),this.maxTotalNumberOfStreamlines=1e5,this.maxTracingResolution=2048,this.transitionEnabled=!0}};e([n()],u.prototype,`maxTotalNumberOfStreamlines`,void 0),e([n()],u.prototype,`maxTracingResolution`,void 0),e([n()],u.prototype,`transitionEnabled`,void 0),u=e([r(`esri.views.3d.support.QualitySettings.FlowSettings`)],u);let d=class extends t{constructor(e){super(e),this.graphics3D=new a,this.sceneService=new o,this.tiledSurface=new s,this.gaussianSplat=new c,this.heatmap=new l,this.flow=new u,this.fadeDuration=i(400),this.physicallyBasedRenderingEnabled=!1,this.maxTexturePixels=1/0,this.memoryLimit=786432e3,this.additionalCacheMemory=0,this.maximumPixelRatio=1/0}};e([n({type:a})],d.prototype,`graphics3D`,void 0),e([n({type:o})],d.prototype,`sceneService`,void 0),e([n({type:s})],d.prototype,`tiledSurface`,void 0),e([n({type:c})],d.prototype,`gaussianSplat`,void 0),e([n({type:l})],d.prototype,`heatmap`,void 0),e([n({type:u})],d.prototype,`flow`,void 0),e([n()],d.prototype,`fadeDuration`,void 0),e([n()],d.prototype,`physicallyBasedRenderingEnabled`,void 0),e([n()],d.prototype,`maxTexturePixels`,void 0),e([n()],d.prototype,`memoryLimit`,void 0),e([n()],d.prototype,`additionalCacheMemory`,void 0),e([n()],d.prototype,`maximumPixelRatio`,void 0),d=e([r(`esri.views.3d.support.QualitySettings`)],d);const f=d;export{f as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{removeMaybe as e}from"../../../../core/maybe.js";import{TaskPriority as t}from"../../../support/Scheduler.js";import{memoryEstimators as n}from"../../layers/graphics/defaultSymbolComplexity.js";import{BufferObject3D as r}from"../../webgl-engine/lib/BufferObject3D.js";import{WebGLLayer as i}from"../../webgl-engine/lib/WebGLLayer.js";import{streamlinGeometryBatchSize as a}from"./constants.js";import{StreamlineResources3D as o}from"./StreamlineResources3D.js";class s extends o{constructor(e,t,r,i,a){let o=n.LINE_ROUND.bytesPerFeature;super(e,t,r,i,o),this._view=a,this._objects3D=[],this._engineLayer=null,this._frameTask=null}get attached(){return this._engineLayer!=null}async attach(){let{geometries:e}=this;e!=null&&(this.detach(),this._frameTask=this._view.resourceController.scheduler.registerTask(t.FLOW_GENERATOR),await this._frameTask.scheduleGenerator(t=>this._addGeometryToLayer(e,t)))}detach(){this.attached&&(this._engineLayer?.removeMany(this._objects3D),this._objects3D.forEach(e=>e.dispose()),this._engineLayer?.commit(),this._objects3D=[],this._engineLayer=null,this._frameTask=e(this._frameTask))}async*_addGeometryToLayer(e,t){let{stage:n}=this._view,o=new i(n,{pickable:!1,updatePolicy:1});for(let n=0;n<e.length;n+=a){let i=new r({geometries:e.slice(n,n+a)
|
|
2
|
+
import{removeMaybe as e}from"../../../../core/maybe.js";import{TaskPriority as t}from"../../../support/Scheduler.js";import{memoryEstimators as n}from"../../layers/graphics/defaultSymbolComplexity.js";import{BufferObject3D as r}from"../../webgl-engine/lib/BufferObject3D.js";import{WebGLLayer as i}from"../../webgl-engine/lib/WebGLLayer.js";import{streamlinGeometryBatchSize as a}from"./constants.js";import{StreamlineResources3D as o}from"./StreamlineResources3D.js";class s extends o{constructor(e,t,r,i,a){let o=n.LINE_ROUND.bytesPerFeature;super(e,t,r,i,o),this._view=a,this._objects3D=[],this._engineLayer=null,this._frameTask=null}get attached(){return this._engineLayer!=null}async attach(){let{geometries:e}=this;e!=null&&(this.detach(),this._frameTask=this._view.resourceController.scheduler.registerTask(t.FLOW_GENERATOR),await this._frameTask.scheduleGenerator(t=>this._addGeometryToLayer(e,t)))}detach(){this.attached&&(this._engineLayer?.removeMany(this._objects3D),this._objects3D.forEach(e=>e.dispose()),this._engineLayer?.commit(),this._objects3D=[],this._engineLayer=null,this._frameTask=e(this._frameTask))}async*_addGeometryToLayer(e,t){let{stage:n}=this._view,o=new i(n,{pickable:!1,updatePolicy:1});for(let n=0;n<e.length;n+=a){let i=new r({geometries:e.slice(n,n+a)});o.add(i),this._objects3D.push(i),o.commit(),t.madeProgress(),t.done&&(t=yield)}this._engineLayer=o}}export{s as StreamlineResources3DShape};
|
|
@@ -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{copy as r,distance as i,scale as a,add as o,exactEquals as s,squaredLength as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clamp as u}from"../../../../core/mathUtils.js";import{removeMaybe as d,destroyMaybe as f}from"../../../../core/maybe.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import m from"../../../../geometry/Point.js";import{projectBoundingRect as h}from"../../../../geometry/projection/projectBoundingRect.js";import{create as g}from"../../../../geometry/support/aaBoundingRect.js";import{PropertiesPool as _}from"../../../support/PropertiesPool.js";import{noBudget as v}from"../../../support/Scheduler.js";import{Yield as y}from"../../../support/Yield.js";import{debugFlags as b}from"../debugFlags.js";import{PointOfInterest as x}from"./PointOfInterest.js";let S=class extends x{constructor(e){super(e),this._propertiesPool=new _({location:()=>new m,renderLocation:()=>l()},this),this._currentSurfaceAltitude=0,this._latestSurfaceAltitude=0,this.distance=0,this.renderLocation=l(),this._updatingType=
|
|
2
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{copy as r,distance as i,scale as a,add as o,exactEquals as s,squaredLength as c}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clamp as u}from"../../../../core/mathUtils.js";import{removeMaybe as d,destroyMaybe as f}from"../../../../core/maybe.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import m from"../../../../geometry/Point.js";import{projectBoundingRect as h}from"../../../../geometry/projection/projectBoundingRect.js";import{create as g}from"../../../../geometry/support/aaBoundingRect.js";import{PropertiesPool as _}from"../../../support/PropertiesPool.js";import{noBudget as v}from"../../../support/Scheduler.js";import{Yield as y}from"../../../support/Yield.js";import{debugFlags as b}from"../debugFlags.js";import{PointOfInterest as x}from"./PointOfInterest.js";let S=class extends x{constructor(e){super(e),this._propertiesPool=new _({location:()=>new m,renderLocation:()=>l()},this),this._currentSurfaceAltitude=0,this._latestSurfaceAltitude=0,this.distance=0,this.renderLocation=l(),this._updatingType=null}initialize(){this._frameWorker=this.scheduler.registerTask(this.task,this),this.runTask()}destroy(){this._frameWorker=d(this._frameWorker),this._propertiesPool=f(this._propertiesPool)}get _camera(){return this.state.contentCamera}get location(){let e=this._propertiesPool?.get(`location`);return e?(e.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e),e):new m}get updating(){return this._updatingType!==null}updateRenderLocation(){this._updatingType=`all-content`,this._updateRenderLocation()}get estimatedSurfaceAltitude(){return this._latestSurfaceAltitude}get readyToRun(){return this.updating}runTask(e=v){let t=this.estimateSurfaceAltitudeAtCenter(e,this._updatingType??`all-content`);return typeof t==`number`?(this._latestSurfaceAltitude=t,this._updateRenderLocation(),this._updatingType=null,e.madeProgress(),y):(this._updatingType=t,y)}_updateRenderLocation(){let e=C,t=this._calculateSurfaceIntersection(this._currentSurfaceAltitude,e),n=this._currentSurfaceAltitude!==this._latestSurfaceAltitude;!t&&n&&(t=this._calculateSurfaceIntersection(this._latestSurfaceAltitude,e),t&&(this._currentSurfaceAltitude=this._latestSurfaceAltitude));let c=w;t&&this._latestSurfaceAltitudeChangesDistance(e,c)&&(r(e,c),this._currentSurfaceAltitude=this._latestSurfaceAltitude),t?this.distance=i(this._camera.eye,e):(a(e,this._camera.viewForward,this._get(`distance`)),o(e,e,this._camera.eye)),s(this._get(`renderLocation`),e)||this._set(`renderLocation`,r(this._propertiesPool.get(`renderLocation`),e))}_calculateSurfaceIntersection(e,t){let n=this._camera;if(!this.renderCoordsHelper.intersectInfiniteManifold(n.ray,e,t))return!1;if(this.state.isGlobal){let r=p(this.renderCoordsHelper.spatialReference).radius,s=r+e,l=c(n.eye),u=l<s*s,d=i(n.eye,t);if(u&&d>r/4){let e=s-Math.sqrt(l);return a(t,n.viewForward,e),o(t,t,n.eye),!0}}else{let e=this.surface?.ready?this.surface.groundExtent:null;e!=null&&h(e,this.surface?.spatialReference,T,this.renderCoordsHelper.spatialReference)&&(t[0]=u(t[0],T[0],T[2]),t[1]=u(t[1],T[1],T[3]))}return!0}_latestSurfaceAltitudeChangesDistance(e,t){if(this._latestSurfaceAltitude===this._currentSurfaceAltitude||e==null)return!1;if(this._calculateSurfaceIntersection(this._latestSurfaceAltitude,t)){if(!b.ENABLE_OPTIMIZATIONS)return!0;let n=this._camera.eye;if(i(n,e)!==i(n,t))return!0}return!1}};e([t({constructOnly:!0})],S.prototype,`scheduler`,void 0),e([t({constructOnly:!0})],S.prototype,`surface`,void 0),e([t({constructOnly:!0})],S.prototype,`task`,void 0),e([t()],S.prototype,`distance`,void 0),e([t({constructOnly:!0})],S.prototype,`estimateSurfaceAltitudeAtCenter`,void 0),e([t({readOnly:!0})],S.prototype,`location`,null),e([t({readOnly:!0})],S.prototype,`renderLocation`,void 0),e([t()],S.prototype,`_updatingType`,void 0),e([t()],S.prototype,`updating`,null),S=e([n(`esri.views.3d.support.pointsOfInterest.CenterOnSurface`)],S);const C=l(),w=l(),T=g();export{S as CenterOnSurface};
|
|
@@ -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"../../../../core/has.js";import{add as i,exactEquals as a,copy 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{watch as c,sync as l,initial as u,when as d,on as f}from"../../../../core/reactiveUtils.js";import{UpdatingHandles as p}from"../../../../core/support/UpdatingHandles.js";import{create as m}from"../../../../geometry/support/ray.js";import{PropertiesPool as h}from"../../../support/PropertiesPool.js";import{TaskPriority as g,noBudget as _}from"../../../support/Scheduler.js";import{Yield as v}from"../../../support/Yield.js";import{Intersector as y}from"../../webgl-engine/lib/Intersector.js";import{terrainId as b}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{debugFlags as x}from"../debugFlags.js";import{DebugPoint as S}from"../debugUtils.js";import{fromRenderAtEye as C}from"../geometryUtils/ray.js";import{CameraOnSurface as w}from"./CameraOnSurface.js";import{CenterOnSurface as T}from"./CenterOnSurface.js";import{ContentGeometryUpdates as E}from"./ContentGeometryUpdates.js";import{Focus as D}from"./Focus.js";import{StableSurfaceCenter as O}from"./StableSurfaceCenter.js";import{SurfaceGeometryUpdates as k}from"./SurfaceGeometryUpdates.js";let A=class extends t{constructor(e){super(e),this.renderPointOfView=s(),this._pois=[],this._updatingHandles=new p,this._debugCenters=null,this._tmpRay=m(),this._centerRayDirty=!0,this._surfaceAltitudeAtCenter=0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenter=0,this._contentAltitudeAtCenterDirty=!0,this._contentChangedSinceLastUpdate=!0,this._geometryPois=[],this._propertiesPool=new h({renderPointOfView:()=>s()},this),this._contentIntersector=new y(e.view.state.isGlobal),this._surfaceIntersector=new y(e.view.state.isGlobal),this._surfaceIntersector.options.invisibleTerrain=!1,this._surfaceIntersector.options.store=0}initialize(){let{state:e,groundView:t,renderCoordsHelper:n,map:r}=this.view,i=this.view.groundAndIMSurface,a=e=>this._estimateSurfaceAltitudeAtCenter(e),o=this.view.resourceController.scheduler,s=t?.elevationQueryCache,p={state:e,scheduler:o,renderCoordsHelper:n},m={...p,surface:t};this._set(`centerOnSurfaceInfrequent`,new T({...m,task:g.POINT_OF_INTEREST_INFREQUENT,estimateSurfaceAltitudeAtCenter:a})),this._set(`centerOnSurfaceFrequent`,new T({...m,task:g.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:a})),this._set(`centerOnContent`,new T({...m,task:g.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:(e,t)=>this._estimateContentAltitudeAtCenter(e,t)})),this._set(`cameraOnSurface`,new w({...m,cache:s,task:g.POINT_OF_INTEREST_INFREQUENT,map:r})),this._set(`surfaceGeometryUpdates`,new k({...p,surface:i,centerOnSurfaces:[this.centerOnSurfaceFrequent,this.centerOnContent,this.centerOnSurfaceInfrequent]})),this._set(`contentGeometryUpdates`,new E(this.view.allLayerViews,()=>this.view.graphicsView)),this._set(`surfaceOrigin`,new O({cache:s,view:this.view})),this._set(`focus`,new D({...p,centerOnSurface:this.centerOnSurfaceFrequent,estimateSurfaceIntersectionAtRenderPoint:(e,t,n)=>this._estimateSurfaceIntersectionAtRenderPoint(e,this.view.state.contentCamera,t,n)})),this._pois.push(this.centerOnContent,this.centerOnSurfaceFrequent,this.centerOnSurfaceInfrequent,this.cameraOnSurface,this.focus),this._geometryPois.push(this.centerOnContent,this.centerOnSurfaceFrequent,this.centerOnSurfaceInfrequent,this.focus),this.addHandles([c(()=>e.contentCamera,e=>this._cameraChanged(e),l),this._updatingHandles.add(()=>t.groundExtent,()=>this._updateGeometryPointsOfInterest()),this._updatingHandles.add(()=>this.view.map?.ground?.navigationConstraint?.type,e=>{this._surfaceIntersector.options.backfacesTerrain=e===`none`},u),d(()=>!t.updating&&this._contentChangedSinceLastUpdate,()=>{this._updateGeometryPointsOfInterest(),this._contentChangedSinceLastUpdate=!1},l),f(()=>this.surfaceGeometryUpdates.events,`request-update`,()=>this._updateGeometryPointsOfInterest()),f(()=>this.contentGeometryUpdates.events,`request-update`,()=>{this._contentChangedSinceLastUpdate=!0,this._updateCenterOnContent()}),this._updatingHandles.add(()=>x.SHOW_POI,e=>this._setDebug(e),u)]),this._cameraChanged(this.view.state.contentCamera);for(let e of this._pois)e.runTask()}destroy(){this._setDebug(!1),this._propertiesPool.destroy();for(let e of this._pois)e.destroy();this._pois.length=0,this.surfaceOrigin.destroy(),this._updatingHandles.destroy(),this._set(`centerOnSurfaceInfrequent`,null),this._set(`centerOnSurfaceFrequent`,null),this._set(`centerOnContent`,null),this._set(`cameraOnSurface`,null),this._set(`surfaceGeometryUpdates`,null),this._set(`contentGeometryUpdates`,null),this._set(`surfaceOrigin`,null),this._set(`focus`,null)}get updating(){return!!(this.surfaceGeometryUpdates?.updating||this._pois.some(e=>e.updating))||this._updatingHandles.updating}get _centerRay(){return this._centerRayDirty&&=(this._centerRayCached=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(this.view.state.contentCamera,this._tmpRay),!1),this._centerRayCached}_estimateContentAltitudeAtCenter(e,t){if(!this._contentAltitudeAtCenterDirty)return this._contentAltitudeAtCenter;let n=this._centerRay;if(n==null)return this._contentAltitudeAtCenter;if(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"../../../../core/has.js";import{add as i,exactEquals as a,copy 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{watch as c,sync as l,initial as u,when as d,on as f}from"../../../../core/reactiveUtils.js";import{UpdatingHandles as p}from"../../../../core/support/UpdatingHandles.js";import{create as m}from"../../../../geometry/support/ray.js";import{PropertiesPool as h}from"../../../support/PropertiesPool.js";import{TaskPriority as g,noBudget as _}from"../../../support/Scheduler.js";import{Yield as v}from"../../../support/Yield.js";import{Intersector as y}from"../../webgl-engine/lib/Intersector.js";import{terrainId as b}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{debugFlags as x}from"../debugFlags.js";import{DebugPoint as S}from"../debugUtils.js";import{fromRenderAtEye as C}from"../geometryUtils/ray.js";import{CameraOnSurface as w}from"./CameraOnSurface.js";import{CenterOnSurface as T}from"./CenterOnSurface.js";import{ContentGeometryUpdates as E}from"./ContentGeometryUpdates.js";import{Focus as D}from"./Focus.js";import{StableSurfaceCenter as O}from"./StableSurfaceCenter.js";import{SurfaceGeometryUpdates as k}from"./SurfaceGeometryUpdates.js";let A=class extends t{constructor(e){super(e),this.renderPointOfView=s(),this._pois=[],this._updatingHandles=new p,this._debugCenters=null,this._tmpRay=m(),this._centerRayDirty=!0,this._surfaceAltitudeAtCenter=0,this._surfaceAltitudeAtCenterDirty=!0,this._contentIntersectorOptions={exclude:new Set([b])},this._contentAltitudeAtCenter=0,this._contentAltitudeAtCenterDirty=!0,this._contentChangedSinceLastUpdate=!0,this._geometryPois=[],this._propertiesPool=new h({renderPointOfView:()=>s()},this),this._contentIntersector=new y(e.view.state.isGlobal),this._surfaceIntersector=new y(e.view.state.isGlobal),this._surfaceIntersector.options.invisibleTerrain=!1,this._surfaceIntersector.options.store=0}initialize(){let{state:e,groundView:t,renderCoordsHelper:n,map:r}=this.view,i=this.view.groundAndIMSurface,a=e=>this._estimateSurfaceAltitudeAtCenter(e),o=this.view.resourceController.scheduler,s=t?.elevationQueryCache,p={state:e,scheduler:o,renderCoordsHelper:n},m={...p,surface:t};this._set(`centerOnSurfaceInfrequent`,new T({...m,task:g.POINT_OF_INTEREST_INFREQUENT,estimateSurfaceAltitudeAtCenter:a})),this._set(`centerOnSurfaceFrequent`,new T({...m,task:g.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:a})),this._set(`centerOnContent`,new T({...m,task:g.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:(e,t)=>this._estimateContentAltitudeAtCenter(e,t)})),this._set(`cameraOnSurface`,new w({...m,cache:s,task:g.POINT_OF_INTEREST_INFREQUENT,map:r})),this._set(`surfaceGeometryUpdates`,new k({...p,surface:i,centerOnSurfaces:[this.centerOnSurfaceFrequent,this.centerOnContent,this.centerOnSurfaceInfrequent]})),this._set(`contentGeometryUpdates`,new E(this.view.allLayerViews,()=>this.view.graphicsView)),this._set(`surfaceOrigin`,new O({cache:s,view:this.view})),this._set(`focus`,new D({...p,centerOnSurface:this.centerOnSurfaceFrequent,estimateSurfaceIntersectionAtRenderPoint:(e,t,n)=>this._estimateSurfaceIntersectionAtRenderPoint(e,this.view.state.contentCamera,t,n)})),this._pois.push(this.centerOnContent,this.centerOnSurfaceFrequent,this.centerOnSurfaceInfrequent,this.cameraOnSurface,this.focus),this._geometryPois.push(this.centerOnContent,this.centerOnSurfaceFrequent,this.centerOnSurfaceInfrequent,this.focus),this.addHandles([c(()=>e.contentCamera,e=>this._cameraChanged(e),l),this._updatingHandles.add(()=>t.groundExtent,()=>this._updateGeometryPointsOfInterest()),this._updatingHandles.add(()=>this.view.map?.ground?.navigationConstraint?.type,e=>{this._surfaceIntersector.options.backfacesTerrain=e===`none`},u),d(()=>!t.updating&&this._contentChangedSinceLastUpdate,()=>{this._updateGeometryPointsOfInterest(),this._contentChangedSinceLastUpdate=!1},l),f(()=>this.surfaceGeometryUpdates.events,`request-update`,()=>this._updateGeometryPointsOfInterest()),f(()=>this.contentGeometryUpdates.events,`request-update`,()=>{this._contentChangedSinceLastUpdate=!0,this._updateCenterOnContent()}),this._updatingHandles.add(()=>x.SHOW_POI,e=>this._setDebug(e),u)]),this._cameraChanged(this.view.state.contentCamera);for(let e of this._pois)e.runTask()}destroy(){this._setDebug(!1),this._propertiesPool.destroy();for(let e of this._pois)e.destroy();this._pois.length=0,this.surfaceOrigin.destroy(),this._updatingHandles.destroy(),this._set(`centerOnSurfaceInfrequent`,null),this._set(`centerOnSurfaceFrequent`,null),this._set(`centerOnContent`,null),this._set(`cameraOnSurface`,null),this._set(`surfaceGeometryUpdates`,null),this._set(`contentGeometryUpdates`,null),this._set(`surfaceOrigin`,null),this._set(`focus`,null)}get updating(){return!!(this.surfaceGeometryUpdates?.updating||this._pois.some(e=>e.updating))||this._updatingHandles.updating}get _centerRay(){return this._centerRayDirty&&=(this._centerRayCached=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(this.view.state.contentCamera,this._tmpRay),!1),this._centerRayCached}_estimateContentAltitudeAtCenter(e,t){if(!this._contentAltitudeAtCenterDirty)return this._contentAltitudeAtCenter;let n=this._centerRay;if(n==null)return this._contentAltitudeAtCenter;let r=!1;if(t===`all-content`&&(r=this.view.sceneIntersectionHelper.intersectRayBudgeted(n,this._contentIntersector,j,e,this._contentIntersectorOptions),r===v))return`all-content`;if(r)this._contentAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(j);else{let t=this._estimateSurfaceAltitudeAtCenter(e);if(t===`surface-only`)return t;this._contentAltitudeAtCenter=t}return this._contentAltitudeAtCenterDirty=!1,this._contentAltitudeAtCenter}_estimateSurfaceAltitudeAtCenter(e=_){let{view:t}=this,{groundAndIMSurface:n}=t;if(!n)return 0;if(!this._surfaceAltitudeAtCenterDirty)return this._surfaceAltitudeAtCenter;let r=this._centerRay;if(r==null)return this._surfaceAltitudeAtCenter;let a=r.origin,o=i(j,r.origin,r.direction);return this._surfaceIntersector.resetWithRay(r,t.state.contentCamera),n.intersectBudgeted(this._surfaceIntersector,null,a,o,e)?(this._surfaceIntersector.results.min.getIntersectionPoint(j)&&(this._surfaceAltitudeAtCenter=t.renderCoordsHelper.getAltitude(j)),this._surfaceAltitudeAtCenterDirty=!1,this._surfaceAltitudeAtCenter):`surface-only`}_estimateSurfaceIntersectionAtRenderPoint(e,t,n,r=_){let a=C(t,e,M);if(a==null)return null;let o=a.origin,s=i(j,a.origin,a.direction);return this._surfaceIntersector.resetWithRay(a,t),this.view.groundAndIMSurface.intersectBudgeted(this._surfaceIntersector,null,o,s,r)?this._surfaceIntersector.results.min.getIntersectionPoint(n)?n:null:v}_cameraChanged(e){this._updateAllPointsOfInterest();let t=e.eye;a(this.renderPointOfView,t)||this._set(`renderPointOfView`,o(this._propertiesPool.get(`renderPointOfView`),t))}_updateAllPointsOfInterest(){this._invalidateCenterEstimates();for(let e of this._pois)e.updateRenderLocation()}_updateGeometryPointsOfInterest(){this._invalidateCenterEstimates();for(let e of this._geometryPois)e.updateRenderLocation()}_invalidateCenterEstimates(){this._centerRayDirty=!0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenterDirty=!0}_updateCenterOnContent(){this._contentAltitudeAtCenterDirty=!0,this.centerOnContent.updateRenderLocation()}_setDebug(e){if(!e)this._debugCenters?.forEach(e=>e.hide()),this.removeHandles(`debug`);else{if(!this._debugCenters){this._debugCenters=new Map;let e=this.view.graphics;this._debugCenters.set(this.centerOnContent,new S(e,`red`,`CenterOnContent`)),this._debugCenters.set(this.centerOnSurfaceFrequent,new S(e,`red`,`CenterOnSurface`)),this._debugCenters.set(this.centerOnSurfaceInfrequent,new S(e,`red`,`CenterOnSurface`)),this._debugCenters.set(this.cameraOnSurface,new S(e,`blue`,`CameraOnSurface`)),this._debugCenters.set(this.focus,new S(e,`green`,`Focus`))}for(let e of this._pois)this.addHandles(this._updatingHandles.add(()=>e.renderLocation,t=>this._debugCenters?.get(e)?.show(t,e.renderCoordsHelper.spatialReference),u),`debug`)}}get test(){}};e([n()],A.prototype,`centerOnContent`,void 0),e([n()],A.prototype,`centerOnSurfaceFrequent`,void 0),e([n()],A.prototype,`centerOnSurfaceInfrequent`,void 0),e([n()],A.prototype,`cameraOnSurface`,void 0),e([n()],A.prototype,`focus`,void 0),e([n()],A.prototype,`renderPointOfView`,void 0),e([n()],A.prototype,`surfaceOrigin`,void 0),e([n()],A.prototype,`contentGeometryUpdates`,void 0),e([n()],A.prototype,`surfaceGeometryUpdates`,void 0),e([n({constructOnly:!0})],A.prototype,`view`,void 0),e([n()],A.prototype,`updating`,null),A=e([r(`esri.views.3d.support.pointsOfInterest.PointsOfInterest`)],A);const j=s(),M=m();export{A as PointsOfInterest};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{parameter as t}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TileBlendTechniqueConfiguration as n}from"./TileBlendTechniqueConfiguration.js";class r extends n{constructor(){super(...arguments),this.background=0}}e([t({count:2})],r.prototype,`background`,void 0);export{r as BlendLayersTechniqueConfiguration};
|
|
2
|
+
import{__decorate as e}from"tslib";import{parameter as t}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TileBlendTechniqueConfiguration as n}from"./TileBlendTechniqueConfiguration.js";class r extends n{constructor(){super(...arguments),this.background=0}get needsUV(){return this.background!==1||this.output!==2}}e([t({count:2})],r.prototype,`background`,void 0);export{r as BlendLayersTechniqueConfiguration};
|
|
@@ -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{cyclicalPI as i}from"../../../core/Cyclical.js";import"../../../core/has.js";import{subtract as a}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as o,subtract as s,copy as c,distance as l}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as d,scale as f,add as p}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as m,create as h}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{clamp as g,deg2rad as ee}from"../../../core/mathUtils.js";import{destroyMaybe as _}from"../../../core/maybe.js";import{watch as v,sync as y,on as b}from"../../../core/reactiveUtils.js";import{getReferenceEllipsoid as x}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as S}from"../../../geometry/projection/projectVectorToVector.js";import{create as C,width as w,center as T,copy as E,intersection as D,contains as te,offset as O}from"../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as k}from"../../../geometry/support/normalizeUtils.js";import{create as A,wrap as j}from"../../../geometry/support/ray.js";import{Sphere as M}from"../../../geometry/support/sphere.js";import{angleAroundAxis as N}from"../../../geometry/support/vector.js";import{y2lat as P}from"../../../geometry/support/webMercatorUtils.js";import{TaskPriority as F,noBudget as I}from"../../support/Scheduler.js";import{Yield as L}from"../../support/Yield.js";import{viewAngle as R}from"../state/utils/viewUtils.js";import{debugFlags as z}from"../support/debugFlags.js";import{DebugPoint as B}from"../support/debugUtils.js";import{getPlanarDistanceToGroundRatio as V}from"../support/planarDistanceToGroundRatio.js";import{Intersector as H}from"../webgl-engine/lib/Intersector.js";import{fromValues as U}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as W}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as G,ensureTextureSize as K}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as ne}from"../webgl-engine/parts/renderUtils.js";import{OverlayRenderer as re}from"./OverlayRenderer.js";const q=1.3,ie=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let J,Y=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0,this.groundView=e.view.groundView}initialize(){let{view:e}=this;this.renderer=new re({parent:this}),e.stage.renderer.plugins.add(this.renderer);let t=()=>this.requestRender();this._groundIntersector=new H(e.state.isGlobal),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([v(()=>this.renderer.hasHighlights,t),this.renderer.events.on(`has-water`,()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on(`content-changed`,t),v(()=>e.state.camera.pixelRatio,t),v(()=>e.state.alignPixelEnabled,t),this.renderer.events.on(`textures-disposed`,()=>this.groundView.requestRender(1)),v(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),v(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),y),b(()=>e.groundAndIMSurface,`elevation-change`,()=>this.setPlacementDirty()),e.on(`resize`,()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(F.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,_(this.renderer)),J&&=(J.hide(),null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;let t=this.view.renderSpatialReference;e!=null&&t!=null?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=k(e))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||z.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!(this.terrainSurface.enabled&&this.terrainSurface.freeze)&&this.groundView.ready}get _isSpherical(){return this.view.state.isGlobal}get mapUnitsToPlanarDistanceRatio(){return this._spatialReference!=null&&this._spatialReference.isGeographic&&this._isSpherical?x(this._spatialReference).metersPerDegree:1}getPlanarDistanceToGroundRatio(e){return this._spatialReference==null?1:V(this._spatialReference,this._isSpherical,e)}get _overlayStretch(){return q/this.view.resolutionScale}get longitudeCyclical(){return this.renderer.longitudeCyclical}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(e){return this._contentUpdated=!1,this.renderer.time=e,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange(`readyToRun`)}registerGeometryDrapeSource(e){let t=new W({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){this.renderer.overlays.length===2&&e.setDrapingExtent!=null&&this._spatialReference!=null&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange(`readyToRun`))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,n){if(!this._spatialReference||!this.view.pointsOfInterest?.centerOnSurfaceFrequent)return L;let r=this._computeOverlayHeight(t),i=this._computeOverlayExtents(t,r,Q,e);this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.overlayStretch=Q.stretch;let a=this._updateOverlay(0,Q.inner,r,+Q.pixelRatioAdjustment,Q.mapUnitsPerPixel),o=w(Q.inner)/w(Q.outer),s=this._updateOverlay(1,Q.outer,r,o*Q.pixelRatioAdjustment,Q.mapUnitsPerPixel);if((a===1||s===1)&&(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.groundView.updateOverlayParameters(),this.groundView.requestRender(n)),(a!==0||s!==0)&&this.requestRender(),this._placementDirty=!i,e.madeProgress(),this._placementDirty)return L}_computeOverlayHeight(e){let t=this.view.state.contentPixelRatio*this.view.resolutionScale,n=e.fullWidth/e.pixelRatio*t,r=e.fullHeight/e.pixelRatio*t,i=Math.ceil(Math.max(n,r)*1.5),{maxPreferredTexturePixels:a,maxTextureSize:o}=this.view.stage.renderView.renderingContext.parameters,s=o*.5;return G(K({width:i,height:i},{maxPreferredTexturePixels:a*2,maxTextureSize:s})[1],s)}get overlays(){return this.renderer.overlays}_updateOverlay(e,t,n,r,i){if(this.renderer.overlays.length===0)return 0;let a=this.renderer.overlays[e],o=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=r,ae(t,a.extent)&&n===a.resolution)return o===i?0:2;a.setExtent(t),a.resolution=n;let s=T(a.extent);return a.renderLocalOrigin=U(s[0],s[1],0,`OV_${this._latestOriginId++}`),1}overlayPixelSizeInMapUnits(e,t){if(this.renderer.overlays.length===0)return t();let n=this.renderer.overlays[0],r=this.renderer.overlays[1],i=this._pointIsInExtent(e,n.extent)?n:r;return(i.extent[2]-i.extent[0])/i.resolution}reloadShaders(){ne(),this.requestRender(),this.runTask(I)}requestRender(e=1){this.renderer.hasOverlays?(e===1?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,n,r,i,a=I){let s=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,le,t,n);if(s==null)return!1;let c=s.origin,l=o(Z,s.origin,s.direction);if(this._groundIntersector.reset(c,l,e),this._groundIntersector.intersect([]),!this.view.groundAndIMSurface.intersectBudgeted(this._groundIntersector,null,c,l,a))return L;let u=this._groundIntersector.results.min;return u.getIntersectionPoint(i)&&u.withinDistance(r)}_findHorizonBasedPointOfInterest(e,t,n=I){let r=.5,a=.55,o=this.view.renderCoordsHelper.getAltitude(e.eye),c=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,u=g(c.estimatedSurfaceAltitude,e.aboveGround?-1/0:o+l,e.aboveGround?o-l:1/0),f=e.aboveGround;if(this.view.viewingMode===`global`){let t=Z;$.radius=x(this.view.spatialReference).radius+u,$.closestPointOnSilhouette(j(e.eye,e.viewForward),t),s(t,t,e.eye);let n=i.normalize(N(e.viewForward,t,e.viewRight))/e.fovY+.5,o=n<=0||n>=1?.5:a;r=f?o*n:n+o*(1-n)}else{let t=Math.PI*.5-Math.acos(-e.viewForward[2]),n=m(0,Math.tan(t),1,0),i=d(n,n,e.projectionMatrix)[1],o=g(.5+.5*i,0,1);r=o===1||o===0?.5:f?o*a:1-(1-o)*a}return this._intersectGroundFromView(e,.5,r,c.distance,t,n)}_computeOverlayExtents(e,t,n,r=I){let{view:i}=this,o=i.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,s=u(),d=this._findHorizonBasedPointOfInterest(e,s,r);d&&d!==L||c(s,o);let m=this._renderSR;z.OVERLAY_SHOW_CENTER?(J??=new B(i.graphics,`red`),J.show(s,m)):J?.hide();let h=Math.max(.1,l(e.eye,s)),g=R(i.renderCoordsHelper,o,e.eye),_=this._spatialReference;this._overlaySREqualsRenderSR||S(s,m,s,_);let v=this._isSpherical,y=this.groundView.groundExtent,b=!v&&_?.isGeographic,C=b&&_?1/x(_).metersPerDegree:1,T=i.state.contentPixelRatio,O=e.computeScreenPixelSizeAtDistance(h)/T*C;n.mapUnitsPerPixel=b?O:O/this.mapUnitsToPlanarDistanceRatio,n.stretch=this._overlayStretch;let k=t*O/2*n.stretch,A=!1,j=b?90:1/0;v&&y&&_&&(_.isWebMercator?(k/=Math.cos(P(s[1])),j=y[3]):(A=!0,k/=x(_).metersPerDegree,j=90),k>=j&&(k=j,s[1]=0,_.isWebMercator&&(s[0]=0)));let M=1;A&&(M=1/Math.max(.2,Math.cos(Math.abs(ee(s[1])))),k*M>180&&(M=180/k),n.mapUnitsPerPixel*=M);let N=Math.log(2)/12;k=Math.exp(Math.round(Math.log(k)/N)*N);let F=k*M,V=.5*t/(32*F),H=.5*t/(32*k);s[0]=Math.round(s[0]*V)/V,s[1]=Math.round(s[1]*H)/H;let U=n.inner;U[0]=s[0]-F,U[1]=s[1]-k,U[2]=s[0]+F,U[3]=s[1]+k,v&&this._shiftExtentToFitBounds(U,1/0,j);let W=n.outer;if(y&&6*F>w(y))E(W,y);else if(Math.PI/2-Math.abs(g-Math.PI/2)<=.25*Math.PI)W[0]=U[0]-F,W[1]=U[1]-k,W[2]=U[2]+F,W[3]=U[3]+k;else{S(e.eye,m,Z,_),a(X,s,Z);let t=-Math.atan2(X[1],X[0])+Math.PI*.125;t<0&&(t+=2*Math.PI);let n=Math.floor(t/(Math.PI*.25));f(X,ie[n],k*2),X[0]*=M,X[2]*=M,p(W,U,X)}if(v&&this.longitudeCyclical)W[0]=this.longitudeCyclical.clamp(W[0]),W[2]=this.longitudeCyclical.clamp(W[2]),W[1]=Math.max(W[1],-j),W[3]=Math.min(W[3],j);else{let e=D(U,y,se),t=D(W,y,ce);te(e,t)&&(W[2]=W[0],W[3]=W[1])}let G=Math.abs(U[2]-U[0])/t;return n.mapUnitsPerPixel=Math.max(n.mapUnitsPerPixel,G),n.pixelRatioAdjustment=n.mapUnitsPerPixel/G,d!==L}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;let t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;let n=this.renderer.computeValidity();return this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t),n!==this.renderer.computeValidity()&&(this.groundView.updateOverlayParameters(),this.groundView.requestRender(1)),this.groundView.requestRender(t),t===1&&this.terrainSurface.requestUpdate(),this.renderer}_pointIsInExtent(e,t){if(this.longitudeCyclical)return this.longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];let n=e.x,r=e.y;return n>t[0]&&n<t[2]&&r>t[1]&&r<t[3]}_shiftExtentToFitBounds(e,t,n){let r=0,i=0;e[0]<-t?r=e[0]+t:e[2]>t&&(r=t-e[2]),e[1]<-n?i=e[1]+n:e[3]>n&&(i=n-e[3]),O(e,r,i)}get test(){}};e([n()],Y.prototype,`_spatialReference`,void 0),e([n({readOnly:!0})],Y.prototype,`readyToRun`,null),e([n()],Y.prototype,`_placementDirty`,void 0),e([n()],Y.prototype,`_contentUpdated`,void 0),e([n()],Y.prototype,`_isSpherical`,null),e([n()],Y.prototype,`mapUnitsToPlanarDistanceRatio`,null),e([n()],Y.prototype,`renderer`,void 0),e([n({constructOnly:!0})],Y.prototype,`view`,void 0),e([n({constructOnly:!0})],Y.prototype,`groundView`,void 0),e([n({constructOnly:!0})],Y.prototype,`terrainSurface`,void 0),e([n()],Y.prototype,`updating`,null),Y=e([r(`esri.views.3d.terrain.OverlayManager`)],Y);function ae(e,t){let n=z.ENABLE_OPTIMIZATIONS?1e-5*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]):0;return Math.abs(t[0]-e[0])<=n&&Math.abs(t[1]-e[1])<=n&&Math.abs(t[2]-e[2])<=n&&Math.abs(t[3]-e[3])<=n}class oe{constructor(){this.inner=C(),this.outer=C(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=q}}const X=h(),Z=u(),Q=new oe,se=C(),ce=C(),le=A(),$=new M;export{Y as OverlayManager};
|
|
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{cyclicalPI as i}from"../../../core/Cyclical.js";import"../../../core/has.js";import{subtract as a}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{add as o,subtract as s,copy as c,distance as l}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as d,scale as f,add as p}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as m,create as h}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{clamp as g,deg2rad as ee}from"../../../core/mathUtils.js";import{destroyMaybe as _}from"../../../core/maybe.js";import{watch as v,sync as y,on as b}from"../../../core/reactiveUtils.js";import{getReferenceEllipsoid as x}from"../../../geometry/ellipsoidUtils.js";import{projectVectorToVector as S}from"../../../geometry/projection/projectVectorToVector.js";import{create as C,width as w,center as T,copy as E,intersection as D,contains as te,offset as O}from"../../../geometry/support/aaBoundingRect.js";import{createSpatialReferenceCyclical as k}from"../../../geometry/support/normalizeUtils.js";import{create as A,wrap as j}from"../../../geometry/support/ray.js";import{Sphere as M}from"../../../geometry/support/sphere.js";import{angleAroundAxis as N}from"../../../geometry/support/vector.js";import{y2lat as P}from"../../../geometry/support/webMercatorUtils.js";import{TaskPriority as F,noBudget as I}from"../../support/Scheduler.js";import{Yield as L}from"../../support/Yield.js";import{viewAngle as R}from"../state/utils/viewUtils.js";import{debugFlags as z}from"../support/debugFlags.js";import{DebugPoint as B}from"../support/debugUtils.js";import{getPlanarDistanceToGroundRatio as V}from"../support/planarDistanceToGroundRatio.js";import{Intersector as H}from"../webgl-engine/lib/Intersector.js";import{fromValues as U}from"../webgl-engine/lib/LocalOriginFactory.js";import{SortedRenderGeometryRenderer as W}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{applyTextureResizeModulo as G,ensureTextureSize as K}from"../webgl-engine/lib/textureUtils.js";import{removeLoadedShaderModules as ne}from"../webgl-engine/parts/renderUtils.js";import{OverlayRenderer as re}from"./OverlayRenderer.js";const q=1.3,ie=[[-.1,-2,3.9,2],[-.1,-3.9,3.9,.1],[-2,-3.9,2,.1],[-3.9,-3.9,.1,.1],[-3.9,-2,.1,2],[-3.9,-.1,.1,3.9],[-2,-.1,2,3.9],[-.1,-.1,3.9,3.9]];let J,Y=class extends t{constructor(e){super(e),this._renderSR=null,this._overlaySREqualsRenderSR=!0,this._drapeSources=new Set,this._drapeTargets=new Set,this._placementDirty=!1,this._contentUpdated=!1,this._drawTexturesDirty=!1,this._drawTexturesAnimateDirty=!1,this._latestOriginId=0,this.groundView=e.view.groundView}initialize(){let{view:e}=this;this.renderer=new re({parent:this}),e.stage.renderer.plugins.add(this.renderer);let t=()=>this.requestRender();this._groundIntersector=new H(e.state.isGlobal),this._groundIntersector.options.backfacesTerrain=!0,this._groundIntersector.options.invisibleTerrain=!0,this._groundIntersector.options.hud=!1,this.addHandles([v(()=>this.renderer.hasHighlights,t),this.renderer.events.on(`has-water`,()=>e.stage?.renderer.updateHasFlags()),this.renderer.events.on(`content-changed`,t),v(()=>e.state.camera.pixelRatio,t),v(()=>e.state.alignPixelEnabled,t),this.renderer.events.on(`textures-disposed`,()=>this.groundView.requestRender(1)),v(()=>[e.pointsOfInterest?.renderPointOfView,e.pointsOfInterest?.centerOnSurfaceFrequent?.location],()=>this.setPlacementDirty()),v(()=>[e.state?.pixelRatio,e.state?.contentPixelRatio],()=>this.setPlacementDirty(),y),b(()=>e.groundAndIMSurface,`elevation-change`,()=>this.setPlacementDirty()),e.on(`resize`,()=>this.setPlacementDirty()),e.resourceController.scheduler.registerTask(F.OVERLAY,this)]),e.stage.renderer.overlay=this}destroy(){this.view?.stage&&(this.view.stage.renderer.plugins.remove(this.renderer),this.view.stage.renderer.overlay=null,_(this.renderer)),J&&=(J.hide(),null),this.renderer=null}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.renderer.longitudeCyclical=null;let t=this.view.renderSpatialReference;e!=null&&t!=null?(this._renderSR=t,this._overlaySREqualsRenderSR=e.equals(this._renderSR),this._isSpherical&&(this.renderer.longitudeCyclical=k(e))):this.renderer.disposeOverlays()}get readyToRun(){return this._placementDirty&&(this._drapeSources.size>0||this.view.graphics.length>0||z.OVERLAY_DRAW_DEBUG_TEXTURE)&&!!this._spatialReference&&!(this.terrainSurface.enabled&&this.terrainSurface.freeze)&&this.groundView.ready}get _isSpherical(){return this.view.state.isGlobal}get mapUnitsToPlanarDistanceRatio(){return this._spatialReference!=null&&this._spatialReference.isGeographic&&this._isSpherical?x(this._spatialReference).metersPerDegree:1}getPlanarDistanceToGroundRatio(e){return this._spatialReference==null?1:V(this._spatialReference,this._isSpherical,e)}get _overlayStretch(){return q/this.view.resolutionScale}get longitudeCyclical(){return this.renderer.longitudeCyclical}get updating(){return this.readyToRun||!!this.renderer?.updating||this._contentUpdated}render(e){return this._contentUpdated=!1,this.renderer.time=e,this.renderer.processSyncDrapeSources(),this.renderer.precompileShaders(this.view.state)?this._drawOverlays():null}get hasOverlays(){return this.renderer.hasOverlays}registerDrapeSource(e,t){this._drapeSources.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.registerDrapeSource(e,t),this._updateDrapeSourceExtent(e),this._setContentDirty(),this.notifyChange(`readyToRun`)}registerGeometryDrapeSource(e){let t=new W({stage:this.view.stage,drapeSource:e,rendererContext:this.renderer});return this.registerDrapeSource(e,t),t}_updateDrapeSourceExtent(e){this.renderer.overlays.length===2&&e.setDrapingExtent!=null&&this._spatialReference!=null&&e.setDrapingExtent(this.renderer.overlays,this._spatialReference)}unregisterDrapeSource(e){this._drapeSources.has(e)&&(this._drapeSources.delete(e),this.renderer.removeDrapeSourceRenderer(e),this.renderer.ensureDrapeSources(this._drapeSources),this._setContentDirty(),this.notifyChange(`readyToRun`))}registerDrapeTarget(e){this._drapeTargets.add(e),this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources)}unregisterDrapeTarget(e){this._drapeTargets.delete(e),this.renderer.ensureDrapeTargets(this._drapeTargets)}_setContentDirty(){this.setPlacementDirty(),this.requestRender()}setPlacementDirty(){this._placementDirty=!0}runTask(e){return this.updateOverlays(e,this.view.state.contentCamera,1)}updateOverlays(e,t,n){if(!this._spatialReference||!this.view.pointsOfInterest?.centerOnSurfaceFrequent)return L;let r=this._computeOverlayHeight(t),i=this._computeOverlayExtents(t,r,Q,e);this.renderer.ensureOverlays(this._drapeTargets,this._drapeSources),this.renderer.overlayStretch=Q.stretch;let a=this._updateOverlay(0,Q.inner,r,+Q.pixelRatioAdjustment,Q.mapUnitsPerPixel),o=w(Q.inner)/w(Q.outer),s=this._updateOverlay(1,Q.outer,r,o*Q.pixelRatioAdjustment,Q.mapUnitsPerPixel);if((a===1||s===1)&&(this._drapeSources.forEach(e=>this._updateDrapeSourceExtent(e)),this.groundView.updateOverlayParameters(),this.groundView.requestRender(n)),(a!==0||s!==0)&&this.requestRender(),this._placementDirty=!i,e.madeProgress(),this._placementDirty)return L}_computeOverlayHeight(e){let t=this.view.state.contentPixelRatio*this.view.resolutionScale,n=e.fullWidth/e.pixelRatio*t,r=e.fullHeight/e.pixelRatio*t,i=Math.ceil(Math.max(n,r)*1.5),{maxPreferredTexturePixels:a,maxTextureSize:o}=this.view.stage.renderView.renderingContext.parameters,s=o*.5;return G(K({width:i,height:i},{maxPreferredTexturePixels:a*2,maxTextureSize:s})[1],s)}get overlays(){return this.renderer.overlays}_updateOverlay(e,t,n,r,i){if(this.renderer.overlays.length===0)return 0;let a=this.renderer.overlays[e],o=a.mapUnitsPerPixel;if(a.mapUnitsPerPixel=i,a.pixelRatio=r,ae(t,a.extent)&&n===a.resolution)return o===i?0:2;a.setExtent(t),a.resolution=n;let s=T(a.extent);return a.renderLocalOrigin=U(s[0],s[1],0,`OV_${this._latestOriginId++}`),1}overlayPixelSizeInMapUnits(e,t){if(this.renderer.overlays.length===0)return t();let n=this.renderer.overlays[0],r=this.renderer.overlays[1],i=this._pointIsInExtent(e,n.extent)?n:r;return(i.extent[2]-i.extent[0])/i.resolution}reloadShaders(){ne(),this.requestRender(),this.runTask(I)}requestRender(e=1){this.renderer.hasOverlays?(e===1?(this._contentUpdated=!0,this._drawTexturesDirty=!0):this._drawTexturesAnimateDirty=!0,this.view.stage.renderView.requestRender(e)):this.setPlacementDirty()}_intersectGroundFromView(e,t,n,r,i,a=I){let s=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(e,le,t,n);if(s==null)return!1;let c=s.origin,l=o(Z,s.origin,s.direction);if(this._groundIntersector.reset(c,l,e),this._groundIntersector.intersect([]),!this.view.groundAndIMSurface.intersectBudgeted(this._groundIntersector,null,c,l,a))return L;let u=this._groundIntersector.results.min;return u.getIntersectionPoint(i)&&u.withinDistance(r)}_findHorizonBasedPointOfInterest(e,t,n=I){let r=.5,a=.55,o=this.view.renderCoordsHelper.getAltitude(e.eye),c=this.view.pointsOfInterest.centerOnSurfaceFrequent,l=1e-5,u=g(c.estimatedSurfaceAltitude,e.aboveGround?-1/0:o+l,e.aboveGround?o-l:1/0),f=e.aboveGround;if(this.view.state.isGlobal){let t=Z;$.radius=x(this.view.spatialReference).radius+u,$.closestPointOnSilhouette(j(e.eye,e.viewForward),t),s(t,t,e.eye);let n=i.normalize(N(e.viewForward,t,e.viewRight))/e.fovY+.5,o=n<=0||n>=1?.5:a;r=f?o*n:n+o*(1-n)}else{let t=Math.PI*.5-Math.acos(-e.viewForward[2]),n=m(0,Math.tan(t),1,0),i=d(n,n,e.projectionMatrix)[1],o=g(.5+.5*i,0,1);r=o===1||o===0?.5:f?o*a:1-(1-o)*a}return this._intersectGroundFromView(e,.5,r,c.distance,t,n)}_computeOverlayExtents(e,t,n,r=I){let{view:i}=this,o=i.pointsOfInterest.centerOnSurfaceFrequent.renderLocation,s=u(),d=this._findHorizonBasedPointOfInterest(e,s,r);d&&d!==L||c(s,o);let m=this._renderSR;z.OVERLAY_SHOW_CENTER?(J??=new B(i.graphics,`red`),J.show(s,m)):J?.hide();let h=Math.max(.1,l(e.eye,s)),g=R(i.renderCoordsHelper,o,e.eye),_=this._spatialReference;this._overlaySREqualsRenderSR||S(s,m,s,_);let v=this._isSpherical,y=this.groundView.groundExtent,b=!v&&_?.isGeographic,C=b&&_?1/x(_).metersPerDegree:1,T=i.state.contentPixelRatio,O=e.computeScreenPixelSizeAtDistance(h)/T*C;n.mapUnitsPerPixel=b?O:O/this.mapUnitsToPlanarDistanceRatio,n.stretch=this._overlayStretch;let k=t*O/2*n.stretch,A=!1,j=b?90:1/0;v&&y&&_&&(_.isWebMercator?(k/=Math.cos(P(s[1])),j=y[3]):(A=!0,k/=x(_).metersPerDegree,j=90),k>=j&&(k=j,s[1]=0,_.isWebMercator&&(s[0]=0)));let M=1;A&&(M=1/Math.max(.2,Math.cos(Math.abs(ee(s[1])))),k*M>180&&(M=180/k),n.mapUnitsPerPixel*=M);let N=Math.log(2)/12;k=Math.exp(Math.round(Math.log(k)/N)*N);let F=k*M,V=.5*t/(32*F),H=.5*t/(32*k);s[0]=Math.round(s[0]*V)/V,s[1]=Math.round(s[1]*H)/H;let U=n.inner;U[0]=s[0]-F,U[1]=s[1]-k,U[2]=s[0]+F,U[3]=s[1]+k,v&&this._shiftExtentToFitBounds(U,1/0,j);let W=n.outer;if(y&&6*F>w(y))E(W,y);else if(Math.PI/2-Math.abs(g-Math.PI/2)<=.25*Math.PI)W[0]=U[0]-F,W[1]=U[1]-k,W[2]=U[2]+F,W[3]=U[3]+k;else{S(e.eye,m,Z,_),a(X,s,Z);let t=-Math.atan2(X[1],X[0])+Math.PI*.125;t<0&&(t+=2*Math.PI);let n=Math.floor(t/(Math.PI*.25));f(X,ie[n],k*2),X[0]*=M,X[2]*=M,p(W,U,X)}if(v&&this.longitudeCyclical)W[0]=this.longitudeCyclical.clamp(W[0]),W[2]=this.longitudeCyclical.clamp(W[2]),W[1]=Math.max(W[1],-j),W[3]=Math.min(W[3],j);else{let e=D(U,y,se),t=D(W,y,ce);te(e,t)&&(W[2]=W[0],W[3]=W[1])}let G=Math.abs(U[2]-U[0])/t;return n.mapUnitsPerPixel=Math.max(n.mapUnitsPerPixel,G),n.pixelRatioAdjustment=n.mapUnitsPerPixel/G,d!==L}_drawOverlays(e=this.view.state){if(!this._drawTexturesDirty&&!this._drawTexturesAnimateDirty)return this.renderer;let t=!this._drawTexturesDirty&&this._drawTexturesAnimateDirty?0:1;this._drawTexturesDirty=this._drawTexturesAnimateDirty=!1;let n=this.renderer.computeValidity();return this.renderer.releaseRenderTargets(t),this.renderer.drawOverlays(e,t),n!==this.renderer.computeValidity()&&(this.groundView.updateOverlayParameters(),this.groundView.requestRender(1)),this.groundView.requestRender(t),t===1&&this.terrainSurface.requestUpdate(),this.renderer}_pointIsInExtent(e,t){if(this.longitudeCyclical)return this.longitudeCyclical.contains(t[0],t[2],e.x)&&e.y>=t[1]&&e.y<=t[3];let n=e.x,r=e.y;return n>t[0]&&n<t[2]&&r>t[1]&&r<t[3]}_shiftExtentToFitBounds(e,t,n){let r=0,i=0;e[0]<-t?r=e[0]+t:e[2]>t&&(r=t-e[2]),e[1]<-n?i=e[1]+n:e[3]>n&&(i=n-e[3]),O(e,r,i)}get test(){}};e([n()],Y.prototype,`_spatialReference`,void 0),e([n({readOnly:!0})],Y.prototype,`readyToRun`,null),e([n()],Y.prototype,`_placementDirty`,void 0),e([n()],Y.prototype,`_contentUpdated`,void 0),e([n()],Y.prototype,`_isSpherical`,null),e([n()],Y.prototype,`mapUnitsToPlanarDistanceRatio`,null),e([n()],Y.prototype,`renderer`,void 0),e([n({constructOnly:!0})],Y.prototype,`view`,void 0),e([n({constructOnly:!0})],Y.prototype,`groundView`,void 0),e([n({constructOnly:!0})],Y.prototype,`terrainSurface`,void 0),e([n()],Y.prototype,`updating`,null),Y=e([r(`esri.views.3d.terrain.OverlayManager`)],Y);function ae(e,t){let n=z.ENABLE_OPTIMIZATIONS?1e-5*Math.max(e[2]-e[0],e[3]-e[1],t[2]-t[0],t[3]-t[1]):0;return Math.abs(t[0]-e[0])<=n&&Math.abs(t[1]-e[1])<=n&&Math.abs(t[2]-e[2])<=n&&Math.abs(t[3]-e[3])<=n}class oe{constructor(){this.inner=C(),this.outer=C(),this.mapUnitsPerPixel=0,this.pixelRatioAdjustment=1,this.stretch=q}}const X=h(),Z=u(),Q=new oe,se=C(),ce=C(),le=A(),$=new M;export{Y as OverlayManager};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{clamp as e,isPowerOfTwo as t}from"../../../core/mathUtils.js";import{maxUint16 as n}from"../../../core/typedArrayUtil.js";import{empty as r}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as i}from"../../../geometry/support/aaBoundingRect.js";import{compressNormal as a}from"../webgl-engine/lib/Normals.js";import{sampleElevation as o,sampleSingleElevation as s}from"./ElevationData.js";import{PatchGeometryLUT as c}from"./PatchGeometryLUT.js";import{zeroToFour as l,neighborTileIfLoadedOrSelf as u}from"./PatchRenderData.js";import{maxPatchTesselation as d,elevationNoDataValue as f}from"./TerrainConst.js";import{internalAssert as p,enableTerrainInternalChecks as m,neighborEdgeIndices as h,almostEquals as g}from"./terrainUtils.js";import{isCornerNeighbor as _}from"./Tile.js";import{compareTilesByLij as v}from"./tileUtils.js";function y(e,t){let{tile:n,geometry:i,geometryState:a}=e,{extentInRadians:o,surface:s}=n,{isWebMercator:c,renderer:l}=s,{numVerticesPerSide:u,wireframe:d}=a,f=u-1,p=(u-2)**2,m=c&&(t===2||t===3),h=c&&(t===1||t===3),g=(+!!m+ +!!h)*De*u,_=Se(a),v=4*_,y=p+g+v,S=l.tileGeometryCache.acquire(y);i.numVerticesPerSide=u,i.vertexAttributes=S,i.maxEdgeVertexCount=_;let{boundingBox:C}=i;r(C);let w=P(e);$.update(f,o,w),x(e),i.poleVerticesStartIndex=p;let T=b(e,m,h);i.edgeVerticesStartIndex=p+g,te(e),O(e,Te,Ee),W(i,T,d),e.intersectionData=null}function b(e,t,r){let{tile:i,localOrigin:o,geometry:s}=e,{extent:c,ellipsoid:l}=i,{boundingBox:u,numVerticesPerSide:d,vertexAttributes:f,poleVerticesStartIndex:p}=s,m=d-1,h=o[0],g=o[1],_=o[2],v=l.radius,y=c[1],b=c[3],x=[],S=p,C=(e,t)=>{let r=t*d;xe(-h,-g,-_+e*v,u),x.push(new oe(e===1,r,e===1?0:2,S,De));let i=j(e===-1?y:b,v),o=e*Math.PI/2-i,s=(e===1?1:-1)*.99,c=v+0,{position:l,uv0:p}=f,{typedBuffer:C,typedBufferStride:w}=f.normalCompressed;for(let e=1;e<=De;++e){let t=i+e/De*o,r=Math.cos(t),d=Math.sin(t);for(let e=0;e<=m;e++){let t=e/m,i=$.sinLonLUT[e],o=$.cosLonLUT[e]*r,f=i*r,v=d,y=o*c-h,b=f*c-g,x=v*c-_;xe(y,b,x,u),l.setValues(S,y,b,x),p.setValues(S,Math.round(t*n),Math.round(s*n)),a(C,S,o,f,v,w),++S}}};return t&&C(-1,0),r&&C(1,m),x}function x(e){let t=e.geometryState.samplerData,n=t?.length===1?t[0]:null;n?S(e,n):C(e)}function S(e,t){let{tile:n}=e;if(!n.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:o}=e,{numVerticesPerSide:s}=i,c=s-2,l=s-1,{vertexAttributes:u,boundingBox:d}=r,{position:f,uv0:p}=u,{typedBuffer:m,typedBufferStride:h}=u.normalCompressed,{extent:g}=n,_=n.ellipsoid.radius,v=o[0],y=o[1],b=o[2],x=f.typedBuffer,S=f.typedBufferStride,C=p.typedBuffer,E=p.typedBufferStride;w(l,g,t);let D=0,O=t.data.values;if(1<=c){let e=le[1],t=$.sinLatLUT[1],n=$.cosLatLUT[1];for(let r=1;r<=c;r++){let i=$.sinLonLUT[r],a=$.cosLonLUT[r],o=_+T(r,1,O),s=-v+o*a*n,c=-y+o*i*n,l=-b+o*t;xe(s,c,l,d);let u=(r-1)*S;x[u]=s,x[u+1]=c,x[u+2]=l;let f=(r-1)*E;C[f]=le[r],C[f+1]=e}}for(let e=1;e<=c;e++){let t=$.sinLatLUT[e],n=$.cosLatLUT[e],r=e+1,i=le[r],o=$.sinLatLUT[r],s=$.cosLatLUT[r],u=$.sinLonLUT[0],f=$.cosLonLUT[0],p=_+T(0,e,O),g=f*n*p-v,w=u*n*p-y,k=t*p-b,A=D*S,j=x[A],M=x[A+1],N=x[A+2];for(let u=1;u<=c;u++){let f=$.sinLonLUT[u],p=$.cosLonLUT[u],A=0,P=0,F=0;if(u<c){let e=(D+1)*S;A=x[e],P=x[e+1],F=x[e+2]}else{let r=$.sinLonLUT[l],i=$.cosLonLUT[l],a=_+T(l,e,O);A=i*n*a-v,P=r*n*a-y,F=t*a-b}let I=g,L=w,R=k;g=j,w=M,k=N,j=A,M=P,N=F;let z=A-I,B=P-L,V=F-R,H=0,U=0,ee=0;if(e>1){let e=(D-c)*S;H=x[e],U=x[e+1],ee=x[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=_+T(u,0,O);H=p*t*n-v,U=f*t*n-y,ee=e*n-b}let W=_+T(u,r,O),G=p*s*W-v,K=f*s*W-y,q=o*W-b;if(e<c){let e=D+c,t=e*S;x[t]=G,x[t+1]=K,x[t+2]=q,xe(G,K,q,d);let n=e*E;C[n]=le[u],C[n+1]=i}let J=H-G,Y=U-K,X=ee-q,te=p*n,Z=f*n,ne=t;ne*ne<.999&&(te=V*Y-B*X,Z=z*X-V*J,ne=B*J-z*Y),a(m,D,te,Z,ne,h),++D}}}function C(e){let{tile:t}=e;if(!t.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:s}=e,{numVerticesPerSide:c,samplerData:l}=i,u=c-2,d=c-1,{vertexAttributes:f,boundingBox:p}=r,{position:m,uv0:h}=f,{typedBuffer:g,typedBufferStride:_}=f.normalCompressed,{extent:v}=t,y=v[0],b=v[2],x=v[1],S=v[3],C=t.ellipsoid.radius,w=s[0],T=s[1],E=s[2],D=m.typedBuffer,O=m.typedBufferStride,k=1/d,A=0;if(1<=u){let e=k,t=x*(1-e)+S*e,r=$.sinLatLUT[1],i=$.cosLatLUT[1];for(let a=1;a<=u;a++){let s=a*k,c=y*(1-s)+b*s,u=$.sinLonLUT[a],d=$.cosLonLUT[a],f=C+o(c,t,l),m=-w+f*d*i,g=-T+f*u*i,_=-E+f*r;xe(m,g,_,p);let v=(a-1)*O;D[v]=m,D[v+1]=g,D[v+2]=_,h.setValues(a-1,Math.round(s*n),Math.round(e*n))}}for(let e=1;e<=u;e++){let t=e*k,r=x*(1-t)+S*t,i=$.sinLatLUT[e],s=$.cosLatLUT[e],c=e+1,f=c*k,m=x*(1-f)+S*f,v=$.sinLatLUT[c],j=$.cosLatLUT[c],M=$.sinLonLUT[0],N=$.cosLonLUT[0],P=C+o(y,r,l),F=N*s*P-w,I=M*s*P-T,L=i*P-E,R=A*O,z=D[R],B=D[R+1],V=D[R+2];for(let t=1;t<=u;t++){let c=t*k,S=y*(1-c)+b*c,M=$.sinLonLUT[t],N=$.cosLonLUT[t],P=0,R=0,H=0;if(t<u){let e=(A+1)*O;P=D[e],R=D[e+1],H=D[e+2]}else{let e=$.sinLonLUT[d],t=$.cosLonLUT[d],n=C+o(b,r,l);P=t*s*n-w,R=e*s*n-T,H=i*n-E}let U=F,ee=I,W=L;F=z,I=B,L=V,z=P,B=R,V=H;let G=P-U,K=R-ee,q=H-W,J=0,Y=0,X=0;if(e>1){let e=(A-u)*O;J=D[e],Y=D[e+1],X=D[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=C+o(S,x,l);J=N*t*n-w,Y=M*t*n-T,X=e*n-E}let te=C+o(S,m,l),Z=N*j*te-w,ne=M*j*te-T,re=v*te-E;if(e<u){let e=A+u,t=e*O;D[t]=Z,D[t+1]=ne,D[t+2]=re,xe(Z,ne,re,p),h.setValues(e,Math.round(c*n),Math.round(f*n))}let ie=J-Z,Q=Y-ne,ae=X-re,oe=N*s,se=M*s,ce=i;ce*ce<.999&&(oe=q*Q-K*ae,se=G*ae-q*ie,ce=K*ie-G*Q);let le=1/Math.sqrt(oe*oe+se*se+ce*ce);a(g,A,oe*le,se*le,ce*le,_),++A}}}function w(t,r,i){let a=r[0],o=r[2],s=r[1],c=r[3],l=1/t,{dx:u,dy:d,x0:f,y1:p,safeWidth:m}=i,h=i.data.width;for(let r=0;r<=t;r++){let t=r*l,i=e(u*(a*(1-t)+o*t-f),0,m),g=Math.floor(i);ue[r]=g,pe[r]=i-g;let _=e(d*(p-(s*(1-t)+c*t)),0,m),v=Math.floor(_);de[r]=v*h,fe[r]=(v+1)*h,me[r]=_-v,le[r]=Math.round(t*n)}}function T(e,t,n){let r=ue[e],i=pe[e],a=de[t],o=fe[t],s=me[t],c=a+r,l=n[c],u=n[c+1],d=n[o+r],f=n[o+r+1];if(l+d+u+f>=ce)return 0;let p=l+(u-l)*i;return p+(d+(f-d)*i-p)*s}function E(e,t=!1){e.tile.intersectsClippingArea&&(O(e,t?Te:e.dirtyEdges,t?Ee:e.dirtyCorners),Q(e),e.intersectionData=null)}function D(e){e.tile.intersectsClippingArea&&(Z(e),O(e,Te,Ee),Q(e),ae(e),e.intersectionData=null)}function O(e,t,n){e.tile.intersectsClippingArea&&(n&&A(e,n),t&&k(e,t),(n||t)&&be(e.geometry.boundingBox))}function k(e,r){let{geometry:i,geometryState:c,tile:l,localOrigin:d}=e,{level:f,extent:_,extentInRadians:y,ellipsoid:b}=l,x=b.radius,S=y[0],C=y[2],w=y[1],T=y[3],{samplerData:E}=c,D=_[0],O=_[2],k=_[1],A=_[3],j=P(e),{boundingBox:M,vertexAttributes:N}=i,F=d[0],I=d[1],L=d[2],{position:R,uv0:z}=N,B=R.typedBuffer,V=R.typedBufferStride,H=z.typedBuffer,U=z.typedBufferStride,{typedBuffer:ee,typedBufferStride:W}=N.normalCompressed,G=E?.length===1?E[0]:null,K=(e,t,n)=>G?s(e,t,G)??0:o(e,t,E)??0;for(let d=0;d<4;++d){if(!(r&1<<d))continue;let y=d===1||d===3,b=c.edgeResolutions[d];p(t(b));let N=b+1,P=u(l,c.edgePeerNeighbors[d]);if(_e(l,P,d)&&ne(e,d,P))continue;let R=P!=null;p(!R||P.level===l.level),p(!R||v(l,P)<=0);let z=P?.renderData?.geometryState;if(m){let e=l.surface;if(!P&&e&&!e.updatingRootTiles){let t=h[d],n=l.findNeighborTile(t,e=>e.loaded||e.leaf||e.level===l.level);n?n.intersectsClippingArea&&(p(!n.loaded),p(!n.leaf),p(n.level===f)):p(e?.rootTiles==null||!l.shouldHaveNeighbor(t))}}let q=d===1?_[2]:_[0],J=P?.extent,Y=J&&y?d===1?J[0]:J[2]:q,X=d===0?_[3]:_[1],te=+(d===1),Z=+(d===0),re=d===1?C:S,ie=d===0?T:w,Q=Math.sin(re),ae=Math.cos(re),oe=Math.sin(ie),se=Math.cos(ie),$=z?.samplerData,ce=$?.length===1?$[0]:null,le=(e,t,n)=>ce?s(n,t,ce)??0:o(n,t,$)??0,ue=R?(e,t,n)=>(K(e,t)+le(e,t,n))*.5:K,de=i.outerEdgesOffsetAndLength[d*2+0],fe=G!=null||E!=null&&E.some(e=>e!=null),pe=ce!=null||$!=null&&$.some(e=>e!=null),me=fe||pe,he=1/b,ge=n*he,ve=te*n,ye=Z*n,be=de;p(!J||g(J[2]-J[0],_[2]-_[0])),(()=>{let e=d===1?-1:+(d===3),t=d===0?-1:+(d===2),n=(_[2]-_[0])*he,r=e*n,i=t*n,c=C-S,l=y?c*he*e:0,u=y?0:t*he,f=Z,p=y?re+l:re,m=y?Math.sin(p):Q,h=y?Math.cos(p):ae,g=y?re-l:re,v=y?Math.sin(g):Q,b=y?Math.cos(g):ae,w=f+u,T=y?ie:j(w),P=y?oe:Math.sin(T),z=y?se:Math.cos(T),K=f-u,J=y?ie:j(K),te=y?oe:Math.sin(J),ne=y?se:Math.cos(J),le=0,de=0,fe=0;{let e=0*he,t=y?q:D*(1-e)+O*e,n=y?Y:t,r=y?k*(1-e)+A*e:X,i=y?re:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);le=o*l*u,de=a*l*u,fe=c*u}let pe=0,_e=0,Se=0;{let e=+he,t=y?q:D*(1-e)+O*e,n=y?Y:t,r=y?k*(1-e)+A*e:X,i=y?re:S*(1-e)+C*e,a=y?Q:Math.sin(i),o=y?ae:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):oe,l=y?Math.cos(s):se,u=x+ue(t,r,n);pe=o*l*u,_e=a*l*u,Se=c*u}for(let e=1;e<N-1;++e){let t=0,n=0,c=0;{let r=(e+1)*he,i=y?q:D*(1-r)+O*r,a=y?Y:i,o=y?k*(1-r)+A*r:X,s=y?re:S*(1-r)+C*r,l=y?Q:Math.sin(s),u=y?ae:Math.cos(s),d=y?j(r):ie,f=y?Math.sin(d):oe,p=y?Math.cos(d):se,m=x+ue(i,o,a);t=u*p*m,n=l*p*m,c=f*m}let l=t,u=n,f=c,p=pe,g=_e,_=Se;pe=l,_e=u,Se=f;{let t=be+e,n=t*V,r=p-F,i=g-I,a=_-L;B[n]=r,B[n+1]=i,B[n+2]=a,xe(r,i,a,M);let o=Math.round(e*ge),s=t*U;H[s]=y?ve:o,H[s+1]=y?o:ye}let w=le,T=de,N=fe;le=p,de=g,fe=_;let K=p,J=g,Z=_,Ce=1/Math.sqrt(K*K+J*J+Z*Z),we=Z*Ce,Te=0,Ee=0,De=0;if(me&&we*we<.999){let t=0,n=0,a=0;{let e=d===0?-1:1;t=e*(l-w),n=e*(u-T),a=e*(f-N)}{let c=e*he,l=y?q:D*(1-c)+O*c,u=y?Y:l,f=y?k*(1-c)+A*c:X,p=y?re:S*(1-c)+C*c,g=y?Q:Math.sin(p),_=y?ae:Math.cos(p),w=y?j(c):ie,T=y?Math.sin(w):oe,M=y?Math.cos(w):se,N=K,F=J,I=Z;if(R){let e=u-r,t=f-i,n=x+(ce?s(e,t,ce)??0:o(e,t,$)??0),a=y?v:g,c=y?b:_,l=y?T:te,d=y?M:ne;N=c*d*n,F=a*d*n,I=l*n}{let e=l+r,c=f+i,u=x+(G?s(e,c,G)??0:o(e,c,E)??0),p=y?m:g,v=y?h:_,b=y?T:P,S=y?M:z,C=v*S*u,w=p*S*u,D=b*u;R||(N=2*K-C,F=2*J-w,I=2*Z-D);let O=d===3?-1:1,k=O*(N-C),A=O*(F-w),j=O*(I-D);Te=a*A-n*j,Ee=t*j-a*k,De=n*k-t*A;let L=1/Math.sqrt(Te*Te+Ee*Ee+De*De);Te*=L,Ee*=L,De*=L}}}else Te=K*Ce,Ee=J*Ce,De=Z*Ce;a(ee,be+e,Te,Ee,De,W)}})()}}function A(e,t){re(e,t)}function j(e,t){return Math.PI/2-2*Math.atan(Math.exp(-e/t))}function M(e,t,n,r){return j(e*(1-r)+t*r,n)}function N(e,t,n){return e*(1-n)+t*n}function P(e){let{tile:t}=e;if(t.surface.isWebMercator){let e=t.extent,n=t.ellipsoid.radius;return t=>M(e[1],e[3],n,t)}let n=t.extentInRadians;return e=>N(n[1],n[3],e)}function F(e){let{tile:t,geometryState:n,geometry:i}=e,{extent:a,surface:o}=t,{wireframe:s}=n,c=a[0],l=a[1],u=a[2],d=a[3],f=u-c,p=d-l,{numVerticesPerSide:m,clippingArea:h}=n,g=h==null?0:Math.max(0,(h[0]-c)/f),_=h==null?0:Math.max(0,(h[1]-l)/p),v=h==null?1:Math.min(1,(h[2]-c)/f),y=h==null?1:Math.min(1,(h[3]-l)/p),b=(m-2)**2,x=Se(n),S=b+4*x,C=o.renderer.tileGeometryCache.acquire(S),{boundingBox:w}=i;r(w),i.numVerticesPerSide=m,i.vertexAttributes=C,i.maxEdgeVertexCount=x,i.minu=g,i.minv=_,i.maxu=v,i.maxv=y,I(e),i.edgeVerticesStartIndex=b,te(e),z(e,Te,Ee),W(i,[],s),e.intersectionData=null}function I(t){let r=t.tile;if(!r.intersectsClippingArea)return;let{geometry:i,geometryState:c,localOrigin:l}=t,{samplerData:u,clippingArea:d,numVerticesPerSide:f}=c,{surface:p,extent:m,ellipsoid:h}=r,{isWebMercatorOnPlateCarree:g}=p,_=d??he,v=m[0],y=m[1],b=m[2],x=m[3],S=Math.max(v,_[0]),C=Math.min(b,_[2]),w=Math.max(y,_[1]),T=Math.min(x,_[3]),E=h.radius,D=r.horizontalScale,O=f-1,k=f-2,{minu:A,minv:j,maxu:M,maxv:N,boundingBox:P,vertexAttributes:F}=i,{position:I,uv0:L}=F,{typedBuffer:R,typedBufferStride:z}=F.normalCompressed,B=l[0],V=l[1],H=l[2],U=I.typedBuffer,ee=I.typedBufferStride,W=0,G=e(y,w,T),K=g?(Math.PI/2-2*Math.atan(Math.exp(-G/E)))*E:G*D,q=1/O,J=e(y*(1-q)+x*q,w,T),Y=g?(Math.PI/2-2*Math.atan(Math.exp(-J/E)))*E:J*D,X=K,te=Y,Z=u?.length===1?u[0]:null,ne=Z?(e,t)=>s(e,t,Z)??0:(e,t)=>o(e,t,u)??0;for(let t=1;t<=k;t++){let r=t/O,i=e(y*(1-r)+x*r,w,T),o=e(r,j,N),s=te,c=(t-1)/O,l=e(y*(1-c)+x*c,w,T),u=X,d=(t+1)/O,f=e(y*(1-d)+x*d,w,T),p=g?(Math.PI/2-2*Math.atan(Math.exp(-f/E)))*E:f*D,m=e(d,j,N);X=te,te=p;let h=e(v,S,C),_=h*D,F=ne(h,i),I=1/O,G=e(I,A,M),K=e(v*(1-G)+b*G,S,C),q=G,J=K,Y=K*D,Z=ne(K,i);if(t===1){let t=Y-B,r=X-V,i=Z-H,a=0*ee;U[a]=t,U[a+1]=r,U[a+2]=i,xe(t,r,i,P);let s=e(I,A,M);L.setValues(W,Math.round(s*n),Math.round(o*n))}for(let r=1;r<=k;r++){let c=Y,d=Z,h=(r+1)/O,g=e(h,A,M),y=e(v*(1-h)+b*h,S,C),x=J;J=y;{let e=W+1,a=e*ee;if(t===1||r===k){let c=ne(y,i),l=y*D,u=s,d=c;if(t===1&&r<k){let t=l-B,r=u-V,i=d-H;U[a]=t,U[a+1]=r,U[a+2]=i,xe(t,r,i,P),L.setValues(e,Math.round(g*n),Math.round(o*n))}Y=l,Z=d}else Y=U[a]+B,Z=U[a+2]+H}let w=Y,T=Z,E=_,j=F;_=c,F=d;let N=(W-k)*ee,I=t===1?ne(x,l):U[N+2]+H,G=ne(x,f);if(t<k){let e=W+k,t=e*ee,r=c-B,i=p-V,a=G-H;U[t]=r,U[t+1]=i,U[t+2]=a,xe(r,i,a,P);let o=q;q=g,L.setValues(e,Math.round(o*n),Math.round(m*n))}{let e=w-E,t=T-j,n=u-p,r=I-G,i=n*t,o=e*r,s=-n*e,c=i*i+o*o+s*s;if(c===0)a(R,W,0,0,1,z);else{let e=1/Math.sqrt(c);a(R,W,i*e,o*e,s*e,z)}}++W}}}function L(e){e.tile.intersectsClippingArea&&(Z(e),z(e,Te,Ee),Q(e),ae(e),e.intersectionData=null)}function R(e,t=!1){e.tile.intersectsClippingArea&&(z(e,t?Te:e.dirtyEdges,t?Ee:e.dirtyCorners),Q(e),e.intersectionData=null)}function z(e,t,n){e.tile.intersectsClippingArea&&(n&&V(e,n),t&&B(e,t),(n||t)&&be(e.geometry.boundingBox))}function B(n,r){let{geometry:i,geometryState:a,localOrigin:c}=n,l=n.tile,{surface:d,extent:f}=l,{clippingArea:g,samplerData:_}=a,y=g??he,b=f[0],x=f[2],S=f[1],C=f[3],w=[C>y[3],x>y[2],S<y[1],b<y[0]],T=l.horizontalScale,E=ee(d.isWebMercatorOnPlateCarree,l.ellipsoid.radius,T),{minu:D,minv:O,maxu:k,maxv:A,boundingBox:j}=i,M=Math.max(b,y[0]),N=Math.min(x,y[2]),P=Math.max(S,y[1]),F=Math.min(C,y[3]),I=c[0],L=c[1],R=c[2],z=_?.length===1?_[0]:void 0,B=z?(e,t)=>s(e,t,z)??0:(e,t)=>o(e,t,_)??0;for(let c=0;c<4;++c){if(!(r&1<<c))continue;let f=c===1||c===3,g=a.edgeResolutions[c];p(t(g));let y=g+1,z=w[c],V=u(l,a.edgePeerNeighbors[c]);if(!z&&_e(l,V,c)&&ne(n,c,V))continue;let H=V!=null&&!z,U=V?.renderData?.geometryState;if(m&&(p(!H||V.level===l.level),p(!H||v(l,V)<=0),l&&!V&&!d.updatingRootTiles)){let e=h[c],t=l.findNeighborTile(e,e=>e.loaded||e.leaf||e.level===l.level);d.updatingRootTiles||(t?t.intersectsClippingArea&&(p(!t.loaded),p(!t.leaf),p(t.level===l.level)):p(d?.rootTiles==null||!l.shouldHaveNeighbor(e)))}let ee=e(c===1?x:b,M,N),W=e(c===0?C:S,P,F),G=U?.samplerData,K=e(+(c===1),D,k),q=e(+(c===0),O,A),J=G?.length===1?G[0]:null,Y=(e,t)=>J?s(e,t,J)??0:o(e,t,G)??0,X=H?(e,t)=>(Y(e,t)+B(e,t))*.5:B,te=(x-b)/g,Z=f?c===1?te:-te:0,re=f?0:c===0?te:-te,ie=-Z,Q=-re,ae=0,oe=0,se=0;{let t=0/g,n=f?ee:e(b*(1-t)+x*t,M,N),r=f?e(S*(1-t)+C*t,P,F):W,i=X(n,r);ae=n*T,oe=E(r),se=i}let $=0,ce=0,le=0;{let t=1/g,n=f?ee:e(b*(1-t)+x*t,M,N),r=f?e(S*(1-t)+C*t,P,F):W,i=X(n,r),a=n*T,o=E(r),s=i;$=a,ce=o,le=s}for(let t=1;t<y-1;++t){let n=t/g,r=$,a=ce,s=le;{let o=f?K:e(n,D,k),l=f?e(n,O,A):q,u=r-I,d=a-L,p=s-R;xe(u,d,p,j),i.setEdgeVertexFromValuesRawPositionUV(c,t,u,d,p,o,l)}{let n=(t+1)/g,r=f?ee:e(b*(1-n)+x*n,M,N),i=f?e(S*(1-n)+C*n,P,F):W,a=X(r,i);$=r*T,ce=E(i),le=a}let l=$,u=ce,d=le,p=ae,m=oe,h=se;ae=r,oe=a,se=s;let v=0,y=0,w=0;if(f){let t=u-a,i=d-s,l=m-a,f=h-s,p=e(S*(1-n)+C*n,P,F),g=ee+ie,b=p,x=g*T,E=o(g,b,_),D=x-r,O=E-s,k=c===3?-1:1;if(v=k*(-l+t)*O,y=k*D*(-f+i),w=-k*D*(-l+t),H){let e=ee+Z,n=p,a=e*T,c=o(e,n,G),u=a-r,d=c-s;v=(-l+t)*(O-d),y=(D-u)*(-f+i),w=-(D-u)*(-l+t)}}else{let t=l-r,i=d-s,u=p-r,f=h-s,m=e(b*(1-n)+x*n,M,N),g=m,S=W+Q,C=o(g,S,_)-s,T=E(S)-a,D=c===2?-1:1;if(v=D*T*(-f+i),y=D*(-u+t)*C,w=-D*T*(-u+t),H){let e=m,n=W+re,r=E(n),c=o(e,n,G)-s,l=r-a;v=(-T+l)*(-f+i),y=(-u+t)*(-C+c),w=-(-T+l)*(-u+t)}}let z=1/Math.sqrt(v*v+y*y+w*w);i.setEdgeNormalFromValues(c,t,v*z,y*z,w*z)}}}function V(e,t){re(e,t)}function H(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function U(e,t){return e*t}function ee(e,t,n){return e?e=>H(e,t):e=>U(e,n)}function W(e,t,n){let{numVerticesPerSide:r,vertexAttributes:i,maxEdgeVertexCount:a}=e,o=r-1,s=i.count,c=r-3,u=r-3,d=2*c*u,f=4*(o+a-3),p=l.reduce((t,n)=>t+(o+e.getEdgeCount(n)-3),0),m=t.reduce((e,t)=>e+o*((t.latitudeResolution-1)*2+1),0),h=3*(n?2:1),g=(d+f+m)*h;e.indices=s>=65536?new Uint32Array(g):new Uint16Array(g),e.indexCount=(d+p+m)*h,e.poleIndicesStartIndex=d*h,e.edgeIndicesStartIndex=(d+m)*h,n?(J(e),Y(e,t),X(e)):(G(e),K(e,t),q(e))}function G(e){let{numVerticesPerSide:t,indices:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=t-2,c=t-3,l=t-3,u=0;for(let e=0;e<c;++e){let t=e*s;for(let e=0;e<l;++e){let r=t+e,i=r+1,c=i+s,l=c-1;Ce(r,i,c,l,o,a)?(n[u]=r,n[u+1]=i,n[u+2]=c,n[u+3]=c,n[u+4]=l,n[u+5]=r):(n[u]=r,n[u+1]=i,n[u+2]=l,n[u+3]=l,n[u+4]=i,n[u+5]=c),u+=6}}}function K(e,t){let{numVerticesPerSide:n,indices:r,poleIndicesStartIndex:i}=e,a=n-1,o=i;for(let i of t){let t=i.isNorth?1:2,s=i.isNorth?2:1,c=i.isNorth?3:4,l=i.isNorth?4:3,u=e.getEdgeVertexIndex(i.connectedOuterEdgeOffset,0),d=1;for(let e=0;e<i.latitudeResolution;++e){let f=e===0?i.rowOffset:u+n;for(let n=0;n<a;n++){let a=f+n;r[o]=u,r[o+t]=u+1,r[o+s]=a,e<i.latitudeResolution-1?(r[o+c]=u+1,r[o+l]=a+1,r[o+5]=a,o+=6):o+=3,u+=d}u=f,d=1}}}function q(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;p(u===i-1);let d=n===1||n===2,f=d?1:2,m=d?2:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,p=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||p<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+f]=n,t[o+m]=b,o+=3}}e.indexCount=o}function J(e){let{indices:t,numVerticesPerSide:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=n-2,c=0;for(let e=0;e<n-3;++e){let r=e*s;for(let i=0;i<n-3;++i){let n=e*s+i,l=n+1,u=l+s,d=u-1,f=r+i,p=f+1,m=p+s;Ce(f,p,m,m-1,o,a)?(we(t,c,n,l,u),c+=6,we(t,c,u,d,n)):(we(t,c,n,l,d),c+=6,we(t,c,d,u,l)),c+=6}}}function Y(e,t){let{indices:n,numVerticesPerSide:r,poleIndicesStartIndex:i}=e,a=r-1,o=i;for(let i of t){let t=i.connectedOuterEdgeOffset,s=e.getEdgeVertexIndex(t,0),c=1;for(let e=0;e<i.latitudeResolution;++e){let t=e===0?i.rowOffset:s+r;for(let r=0;r<a;r++)we(n,o,s,s+1,t+r),o+=6,e<i.latitudeResolution-1&&(we(n,o,s+1,t+r+1,t+r),o+=6),s+=c;s=t,c=1}}}function X(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;p(u===i-1);let d=n===1||n===2,f=d?1:3,m=d?3:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,p=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||p<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+f]=n,t[o+f+1]=n,t[o+m]=b,t[o+m+1]=b,t[o+5]=e,o+=6}}e.indexCount=o}function te(e){let{geometry:t,geometryState:n}=e,{edgeResolutions:r}=n,{numVerticesPerSide:i,edgeVerticesStartIndex:a}=t,o=i-2,s=a;for(let e=0;e<4;++e){{let t=e===1?o-1:0,n=e===0?o-1:0,r=e===0||e===2,i=+!!r,a=+!r,s=n*o+t,c=a*o+i,l=ye[e];l.vertex0Index=s,l.stride=c,l.count=o}{let n=r[e]+1;t.outerEdgesOffsetAndLength[e*2+0]=s,t.outerEdgesOffsetAndLength[e*2+1]=n,s+=n}}}function Z(e){te(e),e.geometryState.wireframe?X(e.geometry):q(e.geometry)}function ne(r,i,a){let{geometryState:o,geometry:s,tile:c,localOrigin:l}=r,u=i===1||i===3,d=o.edgeResolutions[i];p(t(d));let f=d+1,{boundingBox:m,minu:h,minv:g,maxu:_,maxv:v,vertexAttributes:y}=s,b=e(+(i===1),h,_),x=e(+(i===0),g,v),S=a.renderData,C=S.geometryState;if(!C||!S.geometry.vertexAttributes)return!1;let w=S.geometry,T=(i+2)%4,E=w.getEdgeCount(T),D=c.getNeighborEdgeStartVertexIndex(i,a)*d,O=d*2**(c.level-a.level);p(C.edgeResolutions[T]===O),p(E-1===O);let k=S.localOrigin[0]-l[0],A=S.localOrigin[1]-l[1],j=S.localOrigin[2]-l[2],M=s.getEdgeFirstVertexIndex(i),{position:N,uv0:P}=y,F=N.typedBuffer,I=N.typedBufferStride,L=y.normalCompressed,R=L.typedBuffer,z=L.typedBufferStride,B=w.vertexAttributes,V=w.getEdgeFirstVertexIndex(T),H=B.position.typedBuffer,U=B.position.typedBufferStride,ee=B.normalCompressed.typedBuffer,W=B.normalCompressed.typedBufferStride;for(let t=1;t<f-1;++t){let r=D+t,i=M+t,a=V+r,o=i*I,s=a*U,c=H[s]+k,l=H[s+1]+A,f=H[s+2]+j;F[o]=c,F[o+1]=l,F[o+2]=f,xe(c,l,f,m);let p=i*z,y=a*W;R[p]=ee[y],R[p+1]=ee[y+1];let S=t/d,C=u?b:e(S,h,_),w=u?e(S,g,v):x;P.setValues(i,Math.round(C*n),Math.round(w*n))}return!0}function re(t,r){let{geometry:i,geometryState:a,localOrigin:s}=t,{clippingArea:c,samplerData:l}=a,{minu:u,minv:d,maxu:f,maxv:m,boundingBox:h,vertexAttributes:g}=i,_=t.tile,{surface:y,ellipsoid:b,extent:x,extentInRadians:S,horizontalScale:C}=_,w=y.view?.viewingMode===`local`,T=b.radius,E=0,D=0,O=0,k=w?(()=>{let t=c,n=t!=null&&(x[3]>t[3]||x[2]>t[2]||x[1]<t[1]||x[0]<t[0]),r=ee(y.isWebMercatorOnPlateCarree,T,C);return(i,a,o)=>{let s=i===0?x[0]:x[2],c=a===0?x[1]:x[3],l=n?e(s,t[0],t[2]):s,u=n?e(c,t[1],t[3]):c,d=o;E=l*C,D=r(u),O=d}})():(e,t,n)=>{let r=S[t===0?1:3],i=S[e===0?0:2],a=Math.cos(r),o=Math.sin(r),s=Math.sin(i),c=Math.cos(i),l=T+n;E=c*a*l,D=s*a*l,O=o*l},A=0,j=0,M=0,N=0,F=0,I=0,L=0,R=0,z=0,B=w&&y.isWebMercatorOnPlateCarree,V=(e,t,n,r,i)=>{let a=0,o=0,s=0;if(w){let e=t*C,i=B?(Math.PI/2-2*Math.atan(Math.exp(-n/T)))*T:n*C,c=r;a=e-E,o=i-D,s=c-O}else{let i=P(e),c=e.tile,l=c.extent,u=c.extentInRadians,d=(t-l[0])/(l[2]-l[0]),f=(n-l[1])/(l[3]-l[1]),p=u[0]*(1-d)+u[2]*d,m=i(f),h=Math.cos(m),g=Math.sin(m),_=Math.sin(p),v=Math.cos(p),y=T+r,b=v*h*y,x=_*h*y,S=g*y;a=b-E,o=x-D,s=S-O}switch(i){case 0:L+=a,R+=o,z+=s;break;case 1:N-=a,F-=o,I-=s;break;case 2:L-=a,R-=o,z-=s;break;case 3:N+=a,F+=o,I+=s}},H=c??he,U=x[0],W=x[2],G=x[1],K=x[3],q=[K>H[3],W>H[2],G<H[1],U<H[0]],J=Math.max(U,H[0]),Y=Math.min(W,H[2]),X=Math.max(G,H[1]),te=Math.min(K,H[3]),Z=e=>Math.max(H[0],Math.min(H[2],e)),ne=e=>Math.max(H[1],Math.min(H[3],e)),re=e=>{let t=a.cornerNeighborCornerTiles;A=0,j=0,M=1,N=0,F=0,I=0,L=0,R=0,z=0;let n=1/0;for(let r=0;r<4;++r){let i=t[e*4+r];n=Math.min(n,i?.level??1/0)}for(let r=0;r<4;++r){let i=t[e*4+r];ge[r]=i?.level===n?i:null}let r=1,i=0;for(let e=0;e<4;++e){let t=ge[e];t&&(r=Math.max(r,t?.renderData.geometryState.numVerticesPerSide),i=t.extent[2]-t.extent[0])}let s=i,c=r;p(c>1);let l=s/c;for(let e=0;e<4;++e){let t=ge[(e+3)%4],n=ge[e%4];if(!t&&!n)continue;let r=e===0?1:e===1?2:e===2?3:0,i=e===0?2:e===1?3:e===2?0:1;if(t&&n){let a=se[e][0]*l,s=se[e][1]*l,c=t.extent,u=Z(c[r===0||r===1?2:0]+a),d=ne(c[r===0||r===3?3:1]+s),f=n.extent,p=Z(f[i===0||i===1?2:0]+a),m=ne(f[i===0||i===3?3:1]+s),h=t.renderData,g=n.renderData,_=o(u,d,h.geometryState.samplerData),v=o(p,m,g.geometryState.samplerData);V(h,u,d,.5*(_+v),e)}else{let a=t??n,s=t?r:i,c=a.extent,u=se[e],d=Z(c[s===0||s===1?2:0]+u[0]*l),f=ne(c[s===0||s===3?3:1]+u[1]*l),p=a.renderData,m=o(d,f,p.geometryState.samplerData);V(p,d,f,m,e)}}if(!w){let e=Math.sqrt(E*E+D*D+O*O);A=E/e,j=D/e,M=O/e}if(w||M*M<.999){let e=Math.sqrt(N*N+F*F+I*I);N/=e,F/=e,I/=e;let t=Math.sqrt(L*L+R*R+z*z);L/=t,R/=t,z/=t,A=I*R-F*z,j=N*z-I*L,M=F*L-N*R;let n=1/Math.sqrt(A*A+j*j+M*M);A*=n,j*=n,M*=n}},Q=a.cornerNeighborCornerTiles;for(let t=0;t<4;++t){if(!(r&1<<t))continue;let c=t,y=(t+1)%4,b=+(t===0||t===1),x=+(t===0||t===3),S=e(b,u,f),C=e(x,d,m),w=i.getEdgeFirstVertexIndex(c),T=i.getEdgeCount(c),N=t===0||t===3?T-1:0,P=i.getEdgeFirstVertexIndex(y),F=i.getEdgeCount(y),I=t===0||t===1?F-1:0,L=-1;for(let e=0;e<4;++e){let n=Q[t*4+e],r=Q[t*4+L];n&&(L===-1||v(r,n)>0)&&(L=e)}let R=L,z=Q[t*4+R];if(z!==_){let e=_.level-z.level,r=2**e,i=[z.lij[0]+e,z.lij[1]*r,z.lij[2]*r],o=[i[1]+r===_.lij[1],t===0&&(R===1||R===0&&z!==Q[t*4+3])||t===1&&(R===0||R===1&&z!==Q[t*4+2]),i[1]===_.lij[1]+1,t===2&&(R===3||R===2&&z!==Q[t*4+1])||t===3&&(R===2||R===3&&z!==Q[t*4+0])],c=o.reduce((e,t)=>e+ +!!t,0);p(c===1||c===2);let l=-1,u=-1,d=z.renderData;if(c===1){let e=o.findIndex(e=>e);p(0<=e&&e<=3),l=(e+2)%4;let n=a.edgeResolutions[e];u=_.getNeighborEdgeStartVertexIndex(e,z)*n+n*+(e===0&&t===0||e===1&&t===0||e===2&&t===1||e===3&&t===3)}else{p(o[1]||o[3]),l=o[1]?3:1;let e=d.geometryState.edgeResolutions[l];u=t===0||t===3?0:e}let f=d.geometry;{let e=w+N,t=P+I,r=f.getEdgeFirstVertexIndex(l)+u,i=f.vertexAttributes,a=d.localOrigin,o=i.position,c=o.typedBuffer,p=r*o.typedBufferStride,m=c[p]+a[0]-s[0],_=c[p+1]+a[1]-s[1],v=c[p+2]+a[2]-s[2];xe(m,_,v,h);let y=g.position,b=y.typedBuffer,x=e*y.typedBufferStride;b[x]=m,b[x+1]=_,b[x+2]=v;let T=t*y.typedBufferStride;b[T]=m,b[T+1]=_,b[T+2]=v;let E=g.uv0;E.setValues(e,Math.round(S*n),Math.round(C*n)),E.setValues(t,Math.round(S*n),Math.round(C*n));{let n=i.normalCompressed.typedBuffer,a=r*i.normalCompressed.typedBufferStride,o=g.normalCompressed,s=o.typedBuffer;{let t=e*o.typedBufferStride;s[t]=n[a],s[t+1]=n[a+1]}{let e=t*o.typedBufferStride;s[e]=n[a],s[e+1]=n[a+1]}}}}else{let n=q[c],r=q[y],a;if(n||r){let t=e(U*(1-b)+W*b,J,Y),n=e(G*(1-x)+K*x,X,te);a=o(t,n,l)}else a=ie(Q,t);k(b,x,a),re(t);let u=E-s[0],d=D-s[1],f=O-s[2];xe(u,d,f,h),i.setEdgeVertexFromValuesRawPositionUVNormal(c,N,u,d,f,S,C,A,j,M),i.setEdgeVertexFromValuesRawPositionUVNormal(y,I,u,d,f,S,C,A,j,M)}}for(let e=0;e<4;++e)ge[e]=null}function ie(e,t){let n=t*4,r=l.reduce((t,r)=>Math.min(t,e[n+r]?.level??1/0),1/0);m&&(p(!e[n+0]||!e[n+2]||_(e[n+0],e[n+2],5)),p(!e[n+1]||!e[n+3]||_(e[n+1],e[n+3],7)));let i=0,a=0;for(let t=0;t<4;++t){let s=e[n+t];if(s?.level===r){let e=t===0||t===1,n=t===0||t===3,r=s.extent,c=r[e?0:2],l=r[n?1:3],u=s.renderData?.geometryState?.samplerData,d=o(c,l,u);a+=d,i++}}let s=i?a/i:0;return p(s!=null),s}function Q(e){let{vao:t,geometry:n}=e,{vertexAttributes:r,edgeVerticesStartIndex:i}=n,{position:a}=r,o=a.typedBuffer,s=i*a.typedBufferStride,c=(n.getEdgeFirstVertexIndex(3)+n.getEdgeCount(3))*a.typedBufferStride;t.buffer()?.setSubData(o,s,s,c)}function ae(e){let{vao:t,geometry:n}=e,{indices:r,indexCount:i,edgeIndicesStartIndex:a}=n;t.indexBuffer.setSubData(r,a,a,i)}class oe{constructor(e,t,n,r,i){this.isNorth=e,this.connectedRowOffset=t,this.connectedOuterEdgeOffset=n,this.rowOffset=r,this.latitudeResolution=i}}const se=[[0,1],[1,0],[0,-1],[-1,0]],$=new c,ce=.5*f,le=new Uint16Array(d+1),ue=new Int32Array(d+1),de=new Int32Array(d+1),fe=new Int32Array(d+1),pe=new Float64Array(d+1),me=new Float64Array(d+1),he=i(-1/0,-1/0,1/0,1/0),ge=[null,null,null,null];function _e(e,t,n){if(!t)return!1;let r=v(e,t);return r>0||r===0&&n>=2}class ve{constructor(){this.vertex0Index=0,this.stride=1,this.count=0}getVertexIndex(e){return p(0<=e&&e<this.count),this.vertex0Index+this.stride*e}}const ye=[new ve,new ve,new ve,new ve];function be(e){for(let t=0;t<3;t++)e[t]=Math.min(e[t],Math.fround(e[t])),e[t+3]=Math.max(e[t+3],Math.fround(e[t+3]))}function xe(e,t,n,r){r[0]=Math.min(r[0],e),r[3]=Math.max(r[3],e),r[1]=Math.min(r[1],t),r[4]=Math.max(r[4],t),r[2]=Math.min(r[2],n),r[5]=Math.max(r[5],n)}function Se(e){let{edgeResolutions:t,numVerticesPerSide:n}=e,r=1+Math.max(...t);return Math.max(n,r)}function Ce(e,t,n,r,i,a){let o=e*i,s=a[o],c=a[o+1],l=a[o+2],u=t*i,d=a[u],f=a[u+1],p=a[u+2],m=n*i,h=a[m],g=a[m+1],_=a[m+2],v=r*i,y=a[v],b=a[v+1],x=a[v+2],S=(s-h)*(s-h)+(c-g)*(c-g)+(l-_)*(l-_);return(d-y)*(d-y)+(f-b)*(f-b)+(p-x)*(p-x)>S}function we(e,t,n,r,i){e[t]=n,e[t+1]=r,e[t+2]=r,e[t+3]=i,e[t+4]=i,e[t+5]=n}const Te=15,Ee=15,De=6;export{F as createPlanarGlobePatch,y as createSphericalGlobePatch,L as updateEdgeElevationsAndResolutionsPlanar,D as updateEdgeElevationsAndResolutionsSpherical,R as updateEdgesAndCornersPlanar,E as updateEdgesAndCornersSpherical};
|
|
2
|
+
import{clamp as e,isPowerOfTwo as t}from"../../../core/mathUtils.js";import{maxUint16 as n}from"../../../core/typedArrayUtil.js";import{empty as r}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as i}from"../../../geometry/support/aaBoundingRect.js";import{compressNormal as a}from"../webgl-engine/lib/Normals.js";import{sampleElevation as o,sampleSingleElevation as s}from"./ElevationData.js";import{PatchGeometryLUT as c}from"./PatchGeometryLUT.js";import{zeroToFour as l,neighborTileIfLoadedOrSelf as u}from"./PatchRenderData.js";import{maxPatchTesselation as d,elevationNoDataValue as f}from"./TerrainConst.js";import{internalAssert as p,enableTerrainInternalChecks as m,neighborEdgeIndices as h,almostEquals as g}from"./terrainUtils.js";import{isCornerNeighbor as _}from"./Tile.js";import{compareTilesByLij as v}from"./tileUtils.js";function y(e,t){let{tile:n,geometry:i,geometryState:a}=e,{extentInRadians:o,surface:s}=n,{isWebMercator:c,renderer:l}=s,{numVerticesPerSide:u,wireframe:d}=a,f=u-1,p=(u-2)**2,m=c&&(t===2||t===3),h=c&&(t===1||t===3),g=(+!!m+ +!!h)*De*u,_=Se(a),v=4*_,y=p+g+v,S=l.tileGeometryCache.acquire(y);i.numVerticesPerSide=u,i.vertexAttributes=S,i.maxEdgeVertexCount=_;let{boundingBox:C}=i;r(C);let w=P(e);$.update(f,o,w),x(e),i.poleVerticesStartIndex=p;let T=b(e,m,h);i.edgeVerticesStartIndex=p+g,ne(e),O(e,Te,Ee),W(i,T,d),e.intersectionData=null}function b(e,t,r){let{tile:i,localOrigin:o,geometry:s}=e,{extent:c,ellipsoid:l}=i,{boundingBox:u,numVerticesPerSide:d,vertexAttributes:f,poleVerticesStartIndex:p}=s,m=d-1,h=o[0],g=o[1],_=o[2],v=l.radius,y=c[1],b=c[3],x=[],S=p,C=(e,t)=>{let r=t*d;xe(-h,-g,-_+e*v,u),x.push(new Q(e===1,r,e===1?0:2,S,De));let i=j(e===-1?y:b,v),o=e*Math.PI/2-i,s=(e===1?1:-1)*.99,c=v+0,{position:l,uv0:p}=f,{typedBuffer:C,typedBufferStride:w}=f.normalCompressed;for(let e=1;e<=De;++e){let t=i+e/De*o,r=Math.cos(t),d=Math.sin(t);for(let e=0;e<=m;e++){let t=e/m,i=$.sinLonLUT[e],o=$.cosLonLUT[e]*r,f=i*r,v=d,y=o*c-h,b=f*c-g,x=v*c-_;xe(y,b,x,u),l.setValues(S,y,b,x),p.setValues(S,Math.round(t*n),Math.round(s*n)),a(C,S,o,f,v,w),++S}}};return t&&C(-1,0),r&&C(1,m),x}function x(e){let t=e.geometryState.samplerData,n=t?.length===1?t[0]:null;n?S(e,n):C(e)}function S(e,t){let{tile:n}=e;if(!n.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:o}=e,{numVerticesPerSide:s}=i,c=s-2,l=s-1,{vertexAttributes:u,boundingBox:d}=r,{position:f,uv0:p}=u,{typedBuffer:m,typedBufferStride:h}=u.normalCompressed,{extent:g}=n,_=n.ellipsoid.radius,v=o[0],y=o[1],b=o[2],x=f.typedBuffer,S=f.typedBufferStride,C=p.typedBuffer,E=p.typedBufferStride;w(l,g,t);let D=0,O=t.data.values;if(1<=c){let e=le[1],t=$.sinLatLUT[1],n=$.cosLatLUT[1];for(let r=1;r<=c;r++){let i=$.sinLonLUT[r],a=$.cosLonLUT[r],o=_+T(r,1,O),s=-v+o*a*n,c=-y+o*i*n,l=-b+o*t;xe(s,c,l,d);let u=(r-1)*S;x[u]=s,x[u+1]=c,x[u+2]=l;let f=(r-1)*E;C[f]=le[r],C[f+1]=e}}for(let e=1;e<=c;e++){let t=$.sinLatLUT[e],n=$.cosLatLUT[e],r=e+1,i=le[r],o=$.sinLatLUT[r],s=$.cosLatLUT[r],u=$.sinLonLUT[0],f=$.cosLonLUT[0],p=_+T(0,e,O),g=f*n*p-v,w=u*n*p-y,k=t*p-b,A=D*S,j=x[A],M=x[A+1],N=x[A+2];for(let u=1;u<=c;u++){let f=$.sinLonLUT[u],p=$.cosLonLUT[u],A=0,P=0,F=0;if(u<c){let e=(D+1)*S;A=x[e],P=x[e+1],F=x[e+2]}else{let r=$.sinLonLUT[l],i=$.cosLonLUT[l],a=_+T(l,e,O);A=i*n*a-v,P=r*n*a-y,F=t*a-b}let I=g,L=w,R=k;g=j,w=M,k=N,j=A,M=P,N=F;let z=A-I,B=P-L,V=F-R,H=0,U=0,ee=0;if(e>1){let e=(D-c)*S;H=x[e],U=x[e+1],ee=x[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=_+T(u,0,O);H=p*t*n-v,U=f*t*n-y,ee=e*n-b}let W=_+T(u,r,O),G=p*s*W-v,K=f*s*W-y,q=o*W-b;if(e<c){let e=D+c,t=e*S;x[t]=G,x[t+1]=K,x[t+2]=q,xe(G,K,q,d);let n=e*E;C[n]=le[u],C[n+1]=i}let J=H-G,Y=U-K,te=ee-q,ne=p*n,X=f*n,re=t;re*re<.999&&(ne=V*Y-B*te,X=z*te-V*J,re=B*J-z*Y),a(m,D,ne,X,re,h),++D}}}function C(e){let{tile:t}=e;if(!t.intersectsClippingArea)return;let{geometry:r,geometryState:i,localOrigin:s}=e,{numVerticesPerSide:c,samplerData:l}=i,u=c-2,d=c-1,{vertexAttributes:f,boundingBox:p}=r,{position:m,uv0:h}=f,{typedBuffer:g,typedBufferStride:_}=f.normalCompressed,{extent:v}=t,y=v[0],b=v[2],x=v[1],S=v[3],C=t.ellipsoid.radius,w=s[0],T=s[1],E=s[2],D=m.typedBuffer,O=m.typedBufferStride,k=1/d,A=0;if(1<=u){let e=k,t=x*(1-e)+S*e,r=$.sinLatLUT[1],i=$.cosLatLUT[1];for(let a=1;a<=u;a++){let s=a*k,c=y*(1-s)+b*s,u=$.sinLonLUT[a],d=$.cosLonLUT[a],f=C+o(c,t,l),m=-w+f*d*i,g=-T+f*u*i,_=-E+f*r;xe(m,g,_,p);let v=(a-1)*O;D[v]=m,D[v+1]=g,D[v+2]=_,h.setValues(a-1,Math.round(s*n),Math.round(e*n))}}for(let e=1;e<=u;e++){let t=e*k,r=x*(1-t)+S*t,i=$.sinLatLUT[e],s=$.cosLatLUT[e],c=e+1,f=c*k,m=x*(1-f)+S*f,v=$.sinLatLUT[c],j=$.cosLatLUT[c],M=$.sinLonLUT[0],N=$.cosLonLUT[0],P=C+o(y,r,l),F=N*s*P-w,I=M*s*P-T,L=i*P-E,R=A*O,z=D[R],B=D[R+1],V=D[R+2];for(let t=1;t<=u;t++){let c=t*k,S=y*(1-c)+b*c,M=$.sinLonLUT[t],N=$.cosLonLUT[t],P=0,R=0,H=0;if(t<u){let e=(A+1)*O;P=D[e],R=D[e+1],H=D[e+2]}else{let e=$.sinLonLUT[d],t=$.cosLonLUT[d],n=C+o(b,r,l);P=t*s*n-w,R=e*s*n-T,H=i*n-E}let U=F,ee=I,W=L;F=z,I=B,L=V,z=P,B=R,V=H;let G=P-U,K=R-ee,q=H-W,J=0,Y=0,te=0;if(e>1){let e=(A-u)*O;J=D[e],Y=D[e+1],te=D[e+2]}else{let e=$.sinLatLUT[0],t=$.cosLatLUT[0],n=C+o(S,x,l);J=N*t*n-w,Y=M*t*n-T,te=e*n-E}let ne=C+o(S,m,l),X=N*j*ne-w,re=M*j*ne-T,Z=v*ne-E;if(e<u){let e=A+u,t=e*O;D[t]=X,D[t+1]=re,D[t+2]=Z,xe(X,re,Z,p),h.setValues(e,Math.round(c*n),Math.round(f*n))}let ie=J-X,ae=Y-re,oe=te-Z,Q=N*s,se=M*s,ce=i;ce*ce<.999&&(Q=q*ae-K*oe,se=G*oe-q*ie,ce=K*ie-G*ae);let le=1/Math.sqrt(Q*Q+se*se+ce*ce);a(g,A,Q*le,se*le,ce*le,_),++A}}}function w(t,r,i){let a=r[0],o=r[2],s=r[1],c=r[3],l=1/t,{dx:u,dy:d,x0:f,y1:p,safeWidth:m}=i,h=i.data.width;for(let r=0;r<=t;r++){let t=r*l,i=e(u*(a*(1-t)+o*t-f),0,m),g=Math.floor(i);ue[r]=g,pe[r]=i-g;let _=e(d*(p-(s*(1-t)+c*t)),0,m),v=Math.floor(_);de[r]=v*h,fe[r]=(v+1)*h,me[r]=_-v,le[r]=Math.round(t*n)}}function T(e,t,n){let r=ue[e],i=pe[e],a=de[t],o=fe[t],s=me[t],c=a+r,l=n[c],u=n[c+1],d=n[o+r],f=n[o+r+1];if(l+d+u+f>=ce)return 0;let p=l+(u-l)*i;return p+(d+(f-d)*i-p)*s}function E(e,t=!1){e.tile.intersectsClippingArea&&(O(e,t?Te:e.dirtyEdges,t?Ee:e.dirtyCorners),ae(e),e.intersectionData=null)}function D(e){e.tile.intersectsClippingArea&&(X(e),O(e,Te,Ee),ae(e),oe(e),e.intersectionData=null)}function O(e,t,n){e.tile.intersectsClippingArea&&(n&&A(e,n),t&&k(e,t),(n||t)&&be(e.geometry.boundingBox))}function k(e,r){let{geometry:i,geometryState:c,tile:l,localOrigin:d}=e,{level:f,extent:_,extentInRadians:y,ellipsoid:b}=l,x=b.radius,S=y[0],C=y[2],w=y[1],T=y[3],{samplerData:E}=c,D=_[0],O=_[2],k=_[1],A=_[3],j=P(e),{boundingBox:M,vertexAttributes:N}=i,F=d[0],I=d[1],L=d[2],{position:R,uv0:z}=N,B=R.typedBuffer,V=R.typedBufferStride,H=z.typedBuffer,U=z.typedBufferStride,{typedBuffer:ee,typedBufferStride:W}=N.normalCompressed,G=E?.length===1?E[0]:null,K=(e,t,n)=>G?s(e,t,G)??0:o(e,t,E)??0;for(let d=0;d<4;++d){if(!(r&1<<d))continue;let y=d===1||d===3,b=c.edgeResolutions[d];p(t(b));let N=b+1,P=u(l,c.edgePeerNeighbors[d]);if(_e(l,P,d)&&re(e,d,P))continue;let R=P!=null;p(!R||P.level===l.level),p(!R||v(l,P)<=0);let z=P?.renderData?.geometryState;if(m){let e=l.surface;if(!P&&e&&!e.updatingRootTiles){let t=h[d],n=l.findNeighborTile(t,e=>e.loaded||e.leaf||e.level===l.level);n?n.intersectsClippingArea&&(p(!n.loaded),p(!n.leaf),p(n.level===f)):p(e?.rootTiles==null||!l.shouldHaveNeighbor(t))}}let q=d===1?_[2]:_[0],J=P?.extent,Y=J&&y?d===1?J[0]:J[2]:q,te=d===0?_[3]:_[1],ne=+(d===1),X=+(d===0),Z=d===1?C:S,ie=d===0?T:w,ae=Math.sin(Z),oe=Math.cos(Z),Q=Math.sin(ie),se=Math.cos(ie),$=z?.samplerData,ce=$?.length===1?$[0]:null,le=(e,t,n)=>ce?s(n,t,ce)??0:o(n,t,$)??0,ue=R?(e,t,n)=>(K(e,t)+le(e,t,n))*.5:K,de=i.outerEdgesOffsetAndLength[d*2+0],fe=G!=null||E!=null&&E.some(e=>e!=null),pe=ce!=null||$!=null&&$.some(e=>e!=null),me=fe||pe,he=1/b,ge=n*he,ve=ne*n,ye=X*n,be=de;p(!J||g(J[2]-J[0],_[2]-_[0])),(()=>{let e=d===1?-1:+(d===3),t=d===0?-1:+(d===2),n=(_[2]-_[0])*he,r=e*n,i=t*n,c=C-S,l=y?c*he*e:0,u=y?0:t*he,f=X,p=y?Z+l:Z,m=y?Math.sin(p):ae,h=y?Math.cos(p):oe,g=y?Z-l:Z,v=y?Math.sin(g):ae,b=y?Math.cos(g):oe,w=f+u,T=y?ie:j(w),P=y?Q:Math.sin(T),z=y?se:Math.cos(T),K=f-u,J=y?ie:j(K),ne=y?Q:Math.sin(J),re=y?se:Math.cos(J),le=0,de=0,fe=0;{let e=0*he,t=y?q:D*(1-e)+O*e,n=y?Y:t,r=y?k*(1-e)+A*e:te,i=y?Z:S*(1-e)+C*e,a=y?ae:Math.sin(i),o=y?oe:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):Q,l=y?Math.cos(s):se,u=x+ue(t,r,n);le=o*l*u,de=a*l*u,fe=c*u}let pe=0,_e=0,Se=0;{let e=+he,t=y?q:D*(1-e)+O*e,n=y?Y:t,r=y?k*(1-e)+A*e:te,i=y?Z:S*(1-e)+C*e,a=y?ae:Math.sin(i),o=y?oe:Math.cos(i),s=y?j(e):ie,c=y?Math.sin(s):Q,l=y?Math.cos(s):se,u=x+ue(t,r,n);pe=o*l*u,_e=a*l*u,Se=c*u}for(let e=1;e<N-1;++e){let t=0,n=0,c=0;{let r=(e+1)*he,i=y?q:D*(1-r)+O*r,a=y?Y:i,o=y?k*(1-r)+A*r:te,s=y?Z:S*(1-r)+C*r,l=y?ae:Math.sin(s),u=y?oe:Math.cos(s),d=y?j(r):ie,f=y?Math.sin(d):Q,p=y?Math.cos(d):se,m=x+ue(i,o,a);t=u*p*m,n=l*p*m,c=f*m}let l=t,u=n,f=c,p=pe,g=_e,_=Se;pe=l,_e=u,Se=f;{let t=be+e,n=t*V,r=p-F,i=g-I,a=_-L;B[n]=r,B[n+1]=i,B[n+2]=a,xe(r,i,a,M);let o=Math.round(e*ge),s=t*U;H[s]=y?ve:o,H[s+1]=y?o:ye}let w=le,T=de,N=fe;le=p,de=g,fe=_;let K=p,J=g,X=_,Ce=1/Math.sqrt(K*K+J*J+X*X),we=X*Ce,Te=0,Ee=0,De=0;if(me&&we*we<.999){let t=0,n=0,a=0;{let e=d===0?-1:1;t=e*(l-w),n=e*(u-T),a=e*(f-N)}{let c=e*he,l=y?q:D*(1-c)+O*c,u=y?Y:l,f=y?k*(1-c)+A*c:te,p=y?Z:S*(1-c)+C*c,g=y?ae:Math.sin(p),_=y?oe:Math.cos(p),w=y?j(c):ie,T=y?Math.sin(w):Q,M=y?Math.cos(w):se,N=K,F=J,I=X;if(R){let e=u-r,t=f-i,n=x+(ce?s(e,t,ce)??0:o(e,t,$)??0),a=y?v:g,c=y?b:_,l=y?T:ne,d=y?M:re;N=c*d*n,F=a*d*n,I=l*n}{let e=l+r,c=f+i,u=x+(G?s(e,c,G)??0:o(e,c,E)??0),p=y?m:g,v=y?h:_,b=y?T:P,S=y?M:z,C=v*S*u,w=p*S*u,D=b*u;R||(N=2*K-C,F=2*J-w,I=2*X-D);let O=d===3?-1:1,k=O*(N-C),A=O*(F-w),j=O*(I-D);Te=a*A-n*j,Ee=t*j-a*k,De=n*k-t*A;let L=1/Math.sqrt(Te*Te+Ee*Ee+De*De);Te*=L,Ee*=L,De*=L}}}else Te=K*Ce,Ee=J*Ce,De=X*Ce;a(ee,be+e,Te,Ee,De,W)}})()}}function A(e,t){Z(e,t)}function j(e,t){return Math.PI/2-2*Math.atan(Math.exp(-e/t))}function M(e,t,n,r){return j(e*(1-r)+t*r,n)}function N(e,t,n){return e*(1-n)+t*n}function P(e){let{tile:t}=e;if(t.surface.isWebMercator){let e=t.extent,n=t.ellipsoid.radius;return t=>M(e[1],e[3],n,t)}let n=t.extentInRadians;return e=>N(n[1],n[3],e)}function F(e){let{tile:t,geometryState:n,geometry:i}=e,{extent:a,surface:o}=t,{wireframe:s}=n,c=a[0],l=a[1],u=a[2],d=a[3],f=u-c,p=d-l,{numVerticesPerSide:m,clippingArea:h}=n,g=h==null?0:Math.max(0,(h[0]-c)/f),_=h==null?0:Math.max(0,(h[1]-l)/p),v=h==null?1:Math.min(1,(h[2]-c)/f),y=h==null?1:Math.min(1,(h[3]-l)/p),b=(m-2)**2,x=Se(n),S=b+4*x,C=o.renderer.tileGeometryCache.acquire(S),{boundingBox:w}=i;r(w),i.numVerticesPerSide=m,i.vertexAttributes=C,i.maxEdgeVertexCount=x,i.minu=g,i.minv=_,i.maxu=v,i.maxv=y,I(e),i.edgeVerticesStartIndex=b,ne(e),z(e,Te,Ee),W(i,[],s),e.intersectionData=null}function I(t){let r=t.tile;if(!r.intersectsClippingArea)return;let{geometry:i,geometryState:c,localOrigin:l}=t,{samplerData:u,clippingArea:d,numVerticesPerSide:f}=c,{surface:p,extent:m,ellipsoid:h}=r,{isWebMercatorOnPlateCarree:g}=p,_=d??he,v=m[0],y=m[1],b=m[2],x=m[3],S=Math.max(v,_[0]),C=Math.min(b,_[2]),w=Math.max(y,_[1]),T=Math.min(x,_[3]),E=h.radius,D=r.horizontalScale,O=f-1,k=f-2,{minu:A,minv:j,maxu:M,maxv:N,boundingBox:P,vertexAttributes:F}=i,{position:I,uv0:L}=F,{typedBuffer:R,typedBufferStride:z}=F.normalCompressed,B=l[0],V=l[1],H=l[2],U=I.typedBuffer,ee=I.typedBufferStride,W=0,G=e(y,w,T),K=g?(Math.PI/2-2*Math.atan(Math.exp(-G/E)))*E:G*D,q=1/O,J=e(y*(1-q)+x*q,w,T),Y=g?(Math.PI/2-2*Math.atan(Math.exp(-J/E)))*E:J*D,te=K,ne=Y,X=u?.length===1?u[0]:null,re=X?(e,t)=>s(e,t,X)??0:(e,t)=>o(e,t,u)??0;for(let t=1;t<=k;t++){let r=t/O,i=e(y*(1-r)+x*r,w,T),o=e(r,j,N),s=ne,c=(t-1)/O,l=e(y*(1-c)+x*c,w,T),u=te,d=(t+1)/O,f=e(y*(1-d)+x*d,w,T),p=g?(Math.PI/2-2*Math.atan(Math.exp(-f/E)))*E:f*D,m=e(d,j,N);te=ne,ne=p;let h=e(v,S,C),_=h*D,F=re(h,i),I=1/O,G=e(I,A,M),K=e(v*(1-G)+b*G,S,C),q=G,J=K,Y=K*D,X=re(K,i);if(t===1){let t=Y-B,r=te-V,i=X-H,a=0*ee;U[a]=t,U[a+1]=r,U[a+2]=i,xe(t,r,i,P);let s=e(I,A,M);L.setValues(W,Math.round(s*n),Math.round(o*n))}for(let r=1;r<=k;r++){let c=Y,d=X,h=(r+1)/O,g=e(h,A,M),y=e(v*(1-h)+b*h,S,C),x=J;J=y;{let e=W+1,a=e*ee;if(t===1||r===k){let c=re(y,i),l=y*D,u=s,d=c;if(t===1&&r<k){let t=l-B,r=u-V,i=d-H;U[a]=t,U[a+1]=r,U[a+2]=i,xe(t,r,i,P),L.setValues(e,Math.round(g*n),Math.round(o*n))}Y=l,X=d}else Y=U[a]+B,X=U[a+2]+H}let w=Y,T=X,E=_,j=F;_=c,F=d;let N=(W-k)*ee,I=t===1?re(x,l):U[N+2]+H,G=re(x,f);if(t<k){let e=W+k,t=e*ee,r=c-B,i=p-V,a=G-H;U[t]=r,U[t+1]=i,U[t+2]=a,xe(r,i,a,P);let o=q;q=g,L.setValues(e,Math.round(o*n),Math.round(m*n))}{let e=w-E,t=T-j,n=u-p,r=I-G,i=n*t,o=e*r,s=-n*e,c=i*i+o*o+s*s;if(c===0)a(R,W,0,0,1,z);else{let e=1/Math.sqrt(c);a(R,W,i*e,o*e,s*e,z)}}++W}}}function L(e){e.tile.intersectsClippingArea&&(X(e),z(e,Te,Ee),ae(e),oe(e),e.intersectionData=null)}function R(e,t=!1){e.tile.intersectsClippingArea&&(z(e,t?Te:e.dirtyEdges,t?Ee:e.dirtyCorners),ae(e),e.intersectionData=null)}function z(e,t,n){e.tile.intersectsClippingArea&&(n&&V(e,n),t&&B(e,t),(n||t)&&be(e.geometry.boundingBox))}function B(n,r){let{geometry:i,geometryState:a,localOrigin:c}=n,l=n.tile,{surface:d,extent:f}=l,{clippingArea:g,samplerData:_}=a,y=g??he,b=f[0],x=f[2],S=f[1],C=f[3],w=[C>y[3],x>y[2],S<y[1],b<y[0]],T=l.horizontalScale,E=ee(d.isWebMercatorOnPlateCarree,l.ellipsoid.radius,T),{minu:D,minv:O,maxu:k,maxv:A,boundingBox:j}=i,M=Math.max(b,y[0]),N=Math.min(x,y[2]),P=Math.max(S,y[1]),F=Math.min(C,y[3]),I=c[0],L=c[1],R=c[2],z=_?.length===1?_[0]:void 0,B=z?(e,t)=>s(e,t,z)??0:(e,t)=>o(e,t,_)??0;for(let c=0;c<4;++c){if(!(r&1<<c))continue;let f=c===1||c===3,g=a.edgeResolutions[c];p(t(g));let y=g+1,z=w[c],V=u(l,a.edgePeerNeighbors[c]);if(!z&&_e(l,V,c)&&re(n,c,V))continue;let H=V!=null&&!z,U=V?.renderData?.geometryState;if(m&&(p(!H||V.level===l.level),p(!H||v(l,V)<=0),l&&!V&&!d.updatingRootTiles)){let e=h[c],t=l.findNeighborTile(e,e=>e.loaded||e.leaf||e.level===l.level);d.updatingRootTiles||(t?t.intersectsClippingArea&&(p(!t.loaded),p(!t.leaf),p(t.level===l.level)):p(d?.rootTiles==null||!l.shouldHaveNeighbor(e)))}let ee=e(c===1?x:b,M,N),W=e(c===0?C:S,P,F),G=U?.samplerData,K=e(+(c===1),D,k),q=e(+(c===0),O,A),J=G?.length===1?G[0]:null,Y=(e,t)=>J?s(e,t,J)??0:o(e,t,G)??0,te=H?(e,t)=>(Y(e,t)+B(e,t))*.5:B,ne=(x-b)/g,X=f?c===1?ne:-ne:0,Z=f?0:c===0?ne:-ne,ie=-X,ae=-Z,oe=0,Q=0,se=0;{let t=0/g,n=f?ee:e(b*(1-t)+x*t,M,N),r=f?e(S*(1-t)+C*t,P,F):W,i=te(n,r);oe=n*T,Q=E(r),se=i}let $=0,ce=0,le=0;{let t=1/g,n=f?ee:e(b*(1-t)+x*t,M,N),r=f?e(S*(1-t)+C*t,P,F):W,i=te(n,r),a=n*T,o=E(r),s=i;$=a,ce=o,le=s}for(let t=1;t<y-1;++t){let n=t/g,r=$,a=ce,s=le;{let o=f?K:e(n,D,k),l=f?e(n,O,A):q,u=r-I,d=a-L,p=s-R;xe(u,d,p,j),i.setEdgeVertexFromValuesRawPositionUV(c,t,u,d,p,o,l)}{let n=(t+1)/g,r=f?ee:e(b*(1-n)+x*n,M,N),i=f?e(S*(1-n)+C*n,P,F):W,a=te(r,i);$=r*T,ce=E(i),le=a}let l=$,u=ce,d=le,p=oe,m=Q,h=se;oe=r,Q=a,se=s;let v=0,y=0,w=0;if(f){let t=u-a,i=d-s,l=m-a,f=h-s,p=e(S*(1-n)+C*n,P,F),g=ee+ie,b=p,x=g*T,E=o(g,b,_),D=x-r,O=E-s,k=c===3?-1:1;if(v=k*(-l+t)*O,y=k*D*(-f+i),w=-k*D*(-l+t),H){let e=ee+X,n=p,a=e*T,c=o(e,n,G),u=a-r,d=c-s;v=(-l+t)*(O-d),y=(D-u)*(-f+i),w=-(D-u)*(-l+t)}}else{let t=l-r,i=d-s,u=p-r,f=h-s,m=e(b*(1-n)+x*n,M,N),g=m,S=W+ae,C=o(g,S,_)-s,T=E(S)-a,D=c===2?-1:1;if(v=D*T*(-f+i),y=D*(-u+t)*C,w=-D*T*(-u+t),H){let e=m,n=W+Z,r=E(n),c=o(e,n,G)-s,l=r-a;v=(-T+l)*(-f+i),y=(-u+t)*(-C+c),w=-(-T+l)*(-u+t)}}let z=1/Math.sqrt(v*v+y*y+w*w);i.setEdgeNormalFromValues(c,t,v*z,y*z,w*z)}}}function V(e,t){Z(e,t)}function H(e,t){return(Math.PI/2-2*Math.atan(Math.exp(-e/t)))*t}function U(e,t){return e*t}function ee(e,t,n){return e?e=>H(e,t):e=>U(e,n)}function W(e,t,n){let{numVerticesPerSide:r,vertexAttributes:i,maxEdgeVertexCount:a}=e,o=r-1,s=i.count,c=r-3,u=r-3,d=2*c*u,f=4*(o+a-3),p=l.reduce((t,n)=>t+(o+e.getEdgeCount(n)-3),0),m=t.reduce((e,t)=>e+o*((t.latitudeResolution-1)*2+1),0),h=3*(n?2:1),g=(d+f+m)*h;e.indices=s>=65536?new Uint32Array(g):new Uint16Array(g),e.indexCount=(d+p+m)*h,e.poleIndicesStartIndex=d*h,e.edgeIndicesStartIndex=(d+m)*h,n?(J(e),Y(e,t),te(e)):(G(e),K(e,t),q(e))}function G(e){let{numVerticesPerSide:t,indices:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=t-2,c=t-3,l=t-3,u=0;for(let e=0;e<c;++e){let t=e*s;for(let e=0;e<l;++e){let r=t+e,i=r+1,c=i+s,l=c-1;Ce(r,i,c,l,o,a)?(n[u]=r,n[u+1]=i,n[u+2]=c,n[u+3]=c,n[u+4]=l,n[u+5]=r):(n[u]=r,n[u+1]=i,n[u+2]=l,n[u+3]=l,n[u+4]=i,n[u+5]=c),u+=6}}}function K(e,t){let{numVerticesPerSide:n,indices:r,poleIndicesStartIndex:i}=e,a=n-1,o=i;for(let i of t){let t=i.isNorth?1:2,s=i.isNorth?2:1,c=i.isNorth?3:4,l=i.isNorth?4:3,u=e.getEdgeVertexIndex(i.connectedOuterEdgeOffset,0),d=1;for(let e=0;e<i.latitudeResolution;++e){let f=e===0?i.rowOffset:u+n;for(let n=0;n<a;n++){let a=f+n;r[o]=u,r[o+t]=u+1,r[o+s]=a,e<i.latitudeResolution-1?(r[o+c]=u+1,r[o+l]=a+1,r[o+5]=a,o+=6):o+=3,u+=d}u=f,d=1}}}function q(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;p(u===i-1);let d=n===1||n===2,f=d?1:2,m=d?2:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,p=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||p<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+f]=n,t[o+m]=b,o+=3}}e.indexCount=o}function J(e){let{indices:t,numVerticesPerSide:n,vertexAttributes:r}=e,{position:i}=r,{typedBuffer:a,typedBufferStride:o}=i,s=n-2,c=0;for(let e=0;e<n-3;++e){let r=e*s;for(let i=0;i<n-3;++i){let n=e*s+i,l=n+1,u=l+s,d=u-1,f=r+i,p=f+1,m=p+s;Ce(f,p,m,m-1,o,a)?(we(t,c,n,l,u),c+=6,we(t,c,u,d,n)):(we(t,c,n,l,d),c+=6,we(t,c,d,u,l)),c+=6}}}function Y(e,t){let{indices:n,numVerticesPerSide:r,poleIndicesStartIndex:i}=e,a=r-1,o=i;for(let i of t){let t=i.connectedOuterEdgeOffset,s=e.getEdgeVertexIndex(t,0),c=1;for(let e=0;e<i.latitudeResolution;++e){let t=e===0?i.rowOffset:s+r;for(let r=0;r<a;r++)we(n,o,s,s+1,t+r),o+=6,e<i.latitudeResolution-1&&(we(n,o,s+1,t+r+1,t+r),o+=6),s+=c;s=t,c=1}}}function te(e){let{indices:t,numVerticesPerSide:n,edgeIndicesStartIndex:r}=e,i=n-1,a=i-2,o=r;for(let n=0;n<4;++n){let r=ye[n],s=0,c=0,l=e.getEdgeCount(n),u=r.count;p(u===i-1);let d=n===1||n===2,f=d?1:3,m=d?3:1,h=e.getEdgeFirstVertexIndex(n),g=r.vertex0Index,_=r.stride;for(;s<l-1||c<u-1;){let e=g+c*_,n=h+s*1,r=s<l-1,d=c<u-1,p=r?0+i*(s+.5)/(l-1):0,v=d?1+a*(c+.5)/(u-1):0,y=r&&(!d||p<=v);y?++s:++c;let b=y?n+1:e+_;t[o]=e,t[o+f]=n,t[o+f+1]=n,t[o+m]=b,t[o+m+1]=b,t[o+5]=e,o+=6}}e.indexCount=o}function ne(e){let{geometry:t,geometryState:n}=e,{edgeResolutions:r}=n,{numVerticesPerSide:i,edgeVerticesStartIndex:a}=t,o=i-2,s=a;for(let e=0;e<4;++e){{let t=e===1?o-1:0,n=e===0?o-1:0,r=e===0||e===2,i=+!!r,a=+!r,s=n*o+t,c=a*o+i,l=ye[e];l.vertex0Index=s,l.stride=c,l.count=o}{let n=r[e]+1;t.outerEdgesOffsetAndLength[e*2+0]=s,t.outerEdgesOffsetAndLength[e*2+1]=n,s+=n}}}function X(e){ne(e),e.geometryState.wireframe?te(e.geometry):q(e.geometry)}function re(r,i,a){let{geometryState:o,geometry:s,tile:c,localOrigin:l}=r,u=i===1||i===3,d=o.edgeResolutions[i];p(t(d));let f=d+1,{boundingBox:m,minu:h,minv:g,maxu:_,maxv:v,vertexAttributes:y}=s,b=e(+(i===1),h,_),x=e(+(i===0),g,v),S=a.renderData,C=S.geometryState;if(!C||!S.geometry.vertexAttributes)return!1;let w=S.geometry,T=(i+2)%4,E=w.getEdgeCount(T),D=c.getNeighborEdgeStartVertexIndex(i,a)*d,O=d*2**(c.level-a.level);p(C.edgeResolutions[T]===O),p(E-1===O);let k=S.localOrigin[0]-l[0],A=S.localOrigin[1]-l[1],j=S.localOrigin[2]-l[2],M=s.getEdgeFirstVertexIndex(i),{position:N,uv0:P}=y,F=N.typedBuffer,I=N.typedBufferStride,L=y.normalCompressed,R=L.typedBuffer,z=L.typedBufferStride,B=w.vertexAttributes,V=w.getEdgeFirstVertexIndex(T),H=B.position.typedBuffer,U=B.position.typedBufferStride,ee=B.normalCompressed.typedBuffer,W=B.normalCompressed.typedBufferStride;for(let t=1;t<f-1;++t){let r=D+t,i=M+t,a=V+r,o=i*I,s=a*U,c=H[s]+k,l=H[s+1]+A,f=H[s+2]+j;F[o]=c,F[o+1]=l,F[o+2]=f,xe(c,l,f,m);let p=i*z,y=a*W;R[p]=ee[y],R[p+1]=ee[y+1];let S=t/d,C=u?b:e(S,h,_),w=u?e(S,g,v):x;P.setValues(i,Math.round(C*n),Math.round(w*n))}return!0}function Z(t,r){let{geometry:i,geometryState:a,localOrigin:s}=t,{clippingArea:c,samplerData:l}=a,{minu:u,minv:d,maxu:f,maxv:m,boundingBox:h,vertexAttributes:g}=i,_=t.tile,{surface:y,ellipsoid:b,extent:x,extentInRadians:S,horizontalScale:C}=_,w=b.radius,T=0,E=0,D=0,O=()=>{let t=c,n=t!=null&&(x[3]>t[3]||x[2]>t[2]||x[1]<t[1]||x[0]<t[0]),r=ee(y.isWebMercatorOnPlateCarree,w,C);return(i,a,o)=>{let s=i===0?x[0]:x[2],c=a===0?x[1]:x[3],l=n?e(s,t[0],t[2]):s,u=n?e(c,t[1],t[3]):c,d=o;T=l*C,E=r(u),D=d}},k=(e,t,n)=>{let r=S[t===0?1:3],i=S[e===0?0:2],a=Math.cos(r),o=Math.sin(r),s=Math.sin(i),c=Math.cos(i),l=w+n;T=c*a*l,E=s*a*l,D=o*l},A=y.isGlobal,j=A?k:O(),M=0,N=0,F=0,I=0,L=0,R=0,z=0,B=0,V=0,H=!A&&y.isWebMercatorOnPlateCarree,U=(e,t,n,r,i)=>{let a=0,o=0,s=0;if(A){let i=P(e),c=e.tile,l=c.extent,u=c.extentInRadians,d=(t-l[0])/(l[2]-l[0]),f=(n-l[1])/(l[3]-l[1]),p=u[0]*(1-d)+u[2]*d,m=i(f),h=Math.cos(m),g=Math.sin(m),_=Math.sin(p),v=Math.cos(p),y=w+r,b=v*h*y,x=_*h*y,S=g*y;a=b-T,o=x-E,s=S-D}else{let e=t*C,i=H?(Math.PI/2-2*Math.atan(Math.exp(-n/w)))*w:n*C,c=r;a=e-T,o=i-E,s=c-D}switch(i){case 0:z+=a,B+=o,V+=s;break;case 1:I-=a,L-=o,R-=s;break;case 2:z-=a,B-=o,V-=s;break;case 3:I+=a,L+=o,R+=s}},W=c??he,G=x[0],K=x[2],q=x[1],J=x[3],Y=[J>W[3],K>W[2],q<W[1],G<W[0]],te=Math.max(G,W[0]),ne=Math.min(K,W[2]),X=Math.max(q,W[1]),re=Math.min(J,W[3]),Z=e=>Math.max(W[0],Math.min(W[2],e)),ae=e=>Math.max(W[1],Math.min(W[3],e)),oe=e=>{let t=a.cornerNeighborCornerTiles;M=0,N=0,F=1,I=0,L=0,R=0,z=0,B=0,V=0;let n=1/0;for(let r=0;r<4;++r){let i=t[e*4+r];n=Math.min(n,i?.level??1/0)}for(let r=0;r<4;++r){let i=t[e*4+r];ge[r]=i?.level===n?i:null}let r=1,i=0;for(let e=0;e<4;++e){let t=ge[e];t&&(r=Math.max(r,t?.renderData.geometryState.numVerticesPerSide),i=t.extent[2]-t.extent[0])}let s=i,c=r;p(c>1);let l=s/c;for(let e=0;e<4;++e){let t=ge[(e+3)%4],n=ge[e%4];if(!t&&!n)continue;let r=e===0?1:e===1?2:e===2?3:0,i=e===0?2:e===1?3:e===2?0:1;if(t&&n){let a=se[e][0]*l,s=se[e][1]*l,c=t.extent,u=Z(c[r===0||r===1?2:0]+a),d=ae(c[r===0||r===3?3:1]+s),f=n.extent,p=Z(f[i===0||i===1?2:0]+a),m=ae(f[i===0||i===3?3:1]+s),h=t.renderData,g=n.renderData,_=o(u,d,h.geometryState.samplerData),v=o(p,m,g.geometryState.samplerData);U(h,u,d,.5*(_+v),e)}else{let a=t??n,s=t?r:i,c=a.extent,u=se[e],d=Z(c[s===0||s===1?2:0]+u[0]*l),f=ae(c[s===0||s===3?3:1]+u[1]*l),p=a.renderData,m=o(d,f,p.geometryState.samplerData);U(p,d,f,m,e)}}if(A){let e=Math.sqrt(T*T+E*E+D*D);M=T/e,N=E/e,F=D/e}if(!A||F*F<.999){let e=Math.sqrt(I*I+L*L+R*R);I/=e,L/=e,R/=e;let t=Math.sqrt(z*z+B*B+V*V);z/=t,B/=t,V/=t,M=R*B-L*V,N=I*V-R*z,F=L*z-I*B;let n=1/Math.sqrt(M*M+N*N+F*F);M*=n,N*=n,F*=n}},Q=a.cornerNeighborCornerTiles;for(let t=0;t<4;++t){if(!(r&1<<t))continue;let c=t,y=(t+1)%4,b=+(t===0||t===1),x=+(t===0||t===3),S=e(b,u,f),C=e(x,d,m),w=i.getEdgeFirstVertexIndex(c),O=i.getEdgeCount(c),k=t===0||t===3?O-1:0,A=i.getEdgeFirstVertexIndex(y),P=i.getEdgeCount(y),I=t===0||t===1?P-1:0,L=-1;for(let e=0;e<4;++e){let n=Q[t*4+e],r=Q[t*4+L];n&&(L===-1||v(r,n)>0)&&(L=e)}let R=L,z=Q[t*4+R];if(z!==_){let e=_.level-z.level,r=2**e,i=[z.lij[0]+e,z.lij[1]*r,z.lij[2]*r],o=[i[1]+r===_.lij[1],t===0&&(R===1||R===0&&z!==Q[t*4+3])||t===1&&(R===0||R===1&&z!==Q[t*4+2]),i[1]===_.lij[1]+1,t===2&&(R===3||R===2&&z!==Q[t*4+1])||t===3&&(R===2||R===3&&z!==Q[t*4+0])],c=o.reduce((e,t)=>e+ +!!t,0);p(c===1||c===2);let l=-1,u=-1,d=z.renderData;if(c===1){let e=o.findIndex(e=>e);p(0<=e&&e<=3),l=(e+2)%4;let n=a.edgeResolutions[e];u=_.getNeighborEdgeStartVertexIndex(e,z)*n+n*+(e===0&&t===0||e===1&&t===0||e===2&&t===1||e===3&&t===3)}else{p(o[1]||o[3]),l=o[1]?3:1;let e=d.geometryState.edgeResolutions[l];u=t===0||t===3?0:e}let f=d.geometry;{let e=w+k,t=A+I,r=f.getEdgeFirstVertexIndex(l)+u,i=f.vertexAttributes,a=d.localOrigin,o=i.position,c=o.typedBuffer,p=r*o.typedBufferStride,m=c[p]+a[0]-s[0],_=c[p+1]+a[1]-s[1],v=c[p+2]+a[2]-s[2];xe(m,_,v,h);let y=g.position,b=y.typedBuffer,x=e*y.typedBufferStride;b[x]=m,b[x+1]=_,b[x+2]=v;let T=t*y.typedBufferStride;b[T]=m,b[T+1]=_,b[T+2]=v;let E=g.uv0;E.setValues(e,Math.round(S*n),Math.round(C*n)),E.setValues(t,Math.round(S*n),Math.round(C*n));{let n=i.normalCompressed.typedBuffer,a=r*i.normalCompressed.typedBufferStride,o=g.normalCompressed,s=o.typedBuffer;{let t=e*o.typedBufferStride;s[t]=n[a],s[t+1]=n[a+1]}{let e=t*o.typedBufferStride;s[e]=n[a],s[e+1]=n[a+1]}}}}else{let n=Y[c],r=Y[y],a;if(n||r){let t=e(G*(1-b)+K*b,te,ne),n=e(q*(1-x)+J*x,X,re);a=o(t,n,l)}else a=ie(Q,t);j(b,x,a),oe(t);let u=T-s[0],d=E-s[1],f=D-s[2];xe(u,d,f,h),i.setEdgeVertexFromValuesRawPositionUVNormal(c,k,u,d,f,S,C,M,N,F),i.setEdgeVertexFromValuesRawPositionUVNormal(y,I,u,d,f,S,C,M,N,F)}}for(let e=0;e<4;++e)ge[e]=null}function ie(e,t){let n=t*4,r=l.reduce((t,r)=>Math.min(t,e[n+r]?.level??1/0),1/0);m&&(p(!e[n+0]||!e[n+2]||_(e[n+0],e[n+2],5)),p(!e[n+1]||!e[n+3]||_(e[n+1],e[n+3],7)));let i=0,a=0;for(let t=0;t<4;++t){let s=e[n+t];if(s?.level===r){let e=t===0||t===1,n=t===0||t===3,r=s.extent,c=r[e?0:2],l=r[n?1:3],u=s.renderData?.geometryState?.samplerData,d=o(c,l,u);a+=d,i++}}let s=i?a/i:0;return p(s!=null),s}function ae(e){let{vao:t,geometry:n}=e,{vertexAttributes:r,edgeVerticesStartIndex:i}=n,{position:a}=r,o=a.typedBuffer,s=i*a.typedBufferStride,c=(n.getEdgeFirstVertexIndex(3)+n.getEdgeCount(3))*a.typedBufferStride;t.buffer()?.setSubData(o,s,s,c)}function oe(e){let{vao:t,geometry:n}=e,{indices:r,indexCount:i,edgeIndicesStartIndex:a}=n;t.indexBuffer.setSubData(r,a,a,i)}class Q{constructor(e,t,n,r,i){this.isNorth=e,this.connectedRowOffset=t,this.connectedOuterEdgeOffset=n,this.rowOffset=r,this.latitudeResolution=i}}const se=[[0,1],[1,0],[0,-1],[-1,0]],$=new c,ce=.5*f,le=new Uint16Array(d+1),ue=new Int32Array(d+1),de=new Int32Array(d+1),fe=new Int32Array(d+1),pe=new Float64Array(d+1),me=new Float64Array(d+1),he=i(-1/0,-1/0,1/0,1/0),ge=[null,null,null,null];function _e(e,t,n){if(!t)return!1;let r=v(e,t);return r>0||r===0&&n>=2}class ve{constructor(){this.vertex0Index=0,this.stride=1,this.count=0}getVertexIndex(e){return p(0<=e&&e<this.count),this.vertex0Index+this.stride*e}}const ye=[new ve,new ve,new ve,new ve];function be(e){for(let t=0;t<3;t++)e[t]=Math.min(e[t],Math.fround(e[t])),e[t+3]=Math.max(e[t+3],Math.fround(e[t+3]))}function xe(e,t,n,r){r[0]=Math.min(r[0],e),r[3]=Math.max(r[3],e),r[1]=Math.min(r[1],t),r[4]=Math.max(r[4],t),r[2]=Math.min(r[2],n),r[5]=Math.max(r[5],n)}function Se(e){let{edgeResolutions:t,numVerticesPerSide:n}=e,r=1+Math.max(...t);return Math.max(n,r)}function Ce(e,t,n,r,i,a){let o=e*i,s=a[o],c=a[o+1],l=a[o+2],u=t*i,d=a[u],f=a[u+1],p=a[u+2],m=n*i,h=a[m],g=a[m+1],_=a[m+2],v=r*i,y=a[v],b=a[v+1],x=a[v+2],S=(s-h)*(s-h)+(c-g)*(c-g)+(l-_)*(l-_);return(d-y)*(d-y)+(f-b)*(f-b)+(p-x)*(p-x)>S}function we(e,t,n,r,i){e[t]=n,e[t+1]=r,e[t+2]=r,e[t+3]=i,e[t+4]=i,e[t+5]=n}const Te=15,Ee=15,De=6;export{F as createPlanarGlobePatch,y as createSphericalGlobePatch,L as updateEdgeElevationsAndResolutionsPlanar,D as updateEdgeElevationsAndResolutionsSpherical,R as updateEdgesAndCornersPlanar,E as updateEdgesAndCornersSpherical};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{parameter as t}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TileBlendTechniqueConfiguration as n}from"./TileBlendTechniqueConfiguration.js";class r extends n{constructor(){super(...arguments),this.colorizerType=0,this.stretchType=0,this.applyColormap=!0,this.requireBilinearWithNN=!1}}e([t({count:3})],r.prototype,`colorizerType`,void 0),e([t({count:2})],r.prototype,`stretchType`,void 0),e([t()],r.prototype,`applyColormap`,void 0),e([t()],r.prototype,`requireBilinearWithNN`,void 0);export{r as RasterColorizerTechniqueConfiguration};
|
|
2
|
+
import{__decorate as e}from"tslib";import{parameter as t}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js";import{TileBlendTechniqueConfiguration as n}from"./TileBlendTechniqueConfiguration.js";class r extends n{constructor(){super(...arguments),this.colorizerType=0,this.stretchType=0,this.applyColormap=!0,this.requireBilinearWithNN=!1,this.needsUV=!0}}e([t({count:3})],r.prototype,`colorizerType`,void 0),e([t({count:2})],r.prototype,`stretchType`,void 0),e([t()],r.prototype,`applyColormap`,void 0),e([t()],r.prototype,`requireBilinearWithNN`,void 0);export{r as RasterColorizerTechniqueConfiguration};
|