@hztxi/cesium-engine 25.0.7 → 26.2.1
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/Build/Workers/chunk-2NCNUVAT.js +56 -0
- package/Build/Workers/chunk-2ZYRUVVU.js +301 -0
- package/Build/Workers/chunk-36IU7N4V.js +1284 -0
- package/Build/Workers/chunk-3BDLET5S.js +198 -0
- package/Build/Workers/chunk-3PRHI4KX.js +241 -0
- package/Build/Workers/chunk-3R6E2SH4.js +672 -0
- package/Build/Workers/chunk-3ZKKXEXL.js +415 -0
- package/Build/Workers/chunk-47KVKPTO.js +415 -0
- package/Build/Workers/chunk-4N227IPR.js +973 -0
- package/Build/Workers/chunk-4P6OAPBM.js +97 -0
- package/Build/Workers/chunk-4ZOLEPZK.js +519 -0
- package/Build/Workers/chunk-5EF3WWQG.js +352 -0
- package/Build/Workers/chunk-5I76476T.js +288 -0
- package/Build/Workers/chunk-5PBZKBAP.js +511 -0
- package/Build/Workers/chunk-5RVAAW26.js +82 -0
- package/Build/Workers/chunk-5VWK76PO.js +511 -0
- package/Build/Workers/chunk-77DBX23X.js +455 -0
- package/Build/Workers/chunk-7GQOWCSN.js +959 -0
- package/Build/Workers/chunk-7J2ONMKC.js +198 -0
- package/Build/Workers/chunk-7MHUHXZZ.js +219 -0
- package/Build/Workers/chunk-7MQPHOAS.js +455 -0
- package/Build/Workers/chunk-7NJ5O7TP.js +387 -0
- package/Build/Workers/chunk-7Y642MCO.js +352 -0
- package/Build/Workers/chunk-7ZFKBLUE.js +1054 -0
- package/Build/Workers/chunk-A7LGY5XS.js +140 -0
- package/Build/Workers/chunk-AN2NVYL6.js +1483 -0
- package/Build/Workers/chunk-B7PT2VL5.js +630 -0
- package/Build/Workers/chunk-C6XQGBPV.js +476 -0
- package/Build/Workers/chunk-CAEC5DA2.js +57 -0
- package/Build/Workers/chunk-CBCOHH5O.js +837 -0
- package/Build/Workers/chunk-CEMXKBQO.js +1800 -0
- package/Build/Workers/chunk-CKW3STKA.js +1067 -0
- package/Build/Workers/chunk-CV5RICKT.js +1992 -0
- package/Build/Workers/chunk-DBWSISJT.js +56 -0
- package/Build/Workers/chunk-DSBSPPPJ.js +1344 -0
- package/Build/Workers/chunk-DSGLDRTI.js +278 -0
- package/Build/Workers/chunk-DXD7OPSP.js +1992 -0
- package/Build/Workers/chunk-DXECZBSA.js +368 -0
- package/Build/Workers/chunk-DZIRO6ZK.js +682 -0
- package/Build/Workers/chunk-E4CRPGX5.js +140 -0
- package/Build/Workers/chunk-E4IVMEBH.js +52 -0
- package/Build/Workers/chunk-ECN3VUMA.js +73 -0
- package/Build/Workers/chunk-ECSKVHUB.js +476 -0
- package/Build/Workers/chunk-EL4B5CSQ.js +162 -0
- package/Build/Workers/chunk-FAYBQGKO.js +219 -0
- package/Build/Workers/chunk-FGCXPEZM.js +3201 -0
- package/Build/Workers/chunk-FHCRXPA6.js +44 -0
- package/Build/Workers/chunk-FQ42MT7M.js +58 -0
- package/Build/Workers/chunk-FQDYQG4P.js +1284 -0
- package/Build/Workers/chunk-FTCBY5HH.js +138 -0
- package/Build/Workers/chunk-GI5RWJAY.js +101 -0
- package/Build/Workers/chunk-GNLMSDRO.js +945 -0
- package/Build/Workers/chunk-GVUJ6O3R.js +73 -0
- package/Build/Workers/chunk-HCGU7OCG.js +97 -0
- package/Build/Workers/chunk-HRIPVWSC.js +58 -0
- package/Build/Workers/chunk-IC3BR6SC.js +102 -0
- package/Build/Workers/chunk-IU3YAYPT.js +1344 -0
- package/Build/Workers/chunk-J7MZR7B2.js +1483 -0
- package/Build/Workers/chunk-KSIEJYNL.js +3822 -0
- package/Build/Workers/chunk-KT3GG7AW.js +754 -0
- package/Build/Workers/chunk-KYCEM22I.js +1800 -0
- package/Build/Workers/chunk-LJTQW46H.js +57 -0
- package/Build/Workers/chunk-LMQGYJME.js +672 -0
- package/Build/Workers/chunk-LOBYJQA4.js +76 -0
- package/Build/Workers/chunk-LOF32O7F.js +163 -0
- package/Build/Workers/chunk-LOTIJA7D.js +124 -0
- package/Build/Workers/chunk-M7Z3MPAX.js +973 -0
- package/Build/Workers/chunk-MHNLTQHO.js +3201 -0
- package/Build/Workers/chunk-ML7OMD72.js +2342 -0
- package/Build/Workers/chunk-NBTGXEMT.js +945 -0
- package/Build/Workers/chunk-NQZC37F7.js +38 -0
- package/Build/Workers/chunk-O3X3D2Z3.js +352 -0
- package/Build/Workers/chunk-OBUIHPKF.js +352 -0
- package/Build/Workers/chunk-PAEWNYIV.js +138 -0
- package/Build/Workers/chunk-PANJ7YH6.js +102 -0
- package/Build/Workers/chunk-PCL3Y7H5.js +82 -0
- package/Build/Workers/chunk-PIIUGRQD.js +387 -0
- package/Build/Workers/chunk-POKD22OT.js +2719 -0
- package/Build/Workers/chunk-PQMA7MFS.js +9237 -0
- package/Build/Workers/chunk-PURIPUSY.js +682 -0
- package/Build/Workers/chunk-QQZPPXY4.js +3822 -0
- package/Build/Workers/chunk-QXLQLGL2.js +1067 -0
- package/Build/Workers/chunk-RC4YC3VU.js +278 -0
- package/Build/Workers/chunk-RGNNWVR6.js +171 -0
- package/Build/Workers/chunk-SBBIEHYT.js +44 -0
- package/Build/Workers/chunk-SWVZTU6X.js +305 -0
- package/Build/Workers/chunk-T3EUPM5A.js +454 -0
- package/Build/Workers/chunk-TA6IU2XL.js +171 -0
- package/Build/Workers/chunk-TLSGD5TR.js +280 -0
- package/Build/Workers/chunk-TOXDLWKZ.js +368 -0
- package/Build/Workers/chunk-TZBM6TAB.js +124 -0
- package/Build/Workers/chunk-U2OY6MX6.js +398 -0
- package/Build/Workers/chunk-UCY4B5EV.js +288 -0
- package/Build/Workers/chunk-V52FEPCV.js +754 -0
- package/Build/Workers/chunk-VBEXZBG5.js +147 -0
- package/Build/Workers/chunk-VC76B6GM.js +959 -0
- package/Build/Workers/chunk-VCUOYHWC.js +519 -0
- package/Build/Workers/chunk-VJIL5H6K.js +2719 -0
- package/Build/Workers/chunk-VMF7KOGY.js +162 -0
- package/Build/Workers/chunk-W5OCKMPJ.js +101 -0
- package/Build/Workers/chunk-XHT5SVP4.js +52 -0
- package/Build/Workers/chunk-XITBARMZ.js +2342 -0
- package/Build/Workers/chunk-XLQZNQ4Z.js +163 -0
- package/Build/Workers/chunk-XZ6HDXKM.js +76 -0
- package/Build/Workers/chunk-Y7NDFEQ3.js +398 -0
- package/Build/Workers/chunk-YBBQDYX2.js +301 -0
- package/Build/Workers/chunk-YHPYPVAB.js +837 -0
- package/Build/Workers/chunk-YNKK6BXY.js +454 -0
- package/Build/Workers/chunk-YRAJ74HR.js +305 -0
- package/Build/Workers/chunk-YULTZK5O.js +147 -0
- package/Build/Workers/chunk-YUNQYP3Z.js +9237 -0
- package/Build/Workers/chunk-Z7BONRW2.js +241 -0
- package/Build/Workers/chunk-ZK2R3DEJ.js +1054 -0
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +18 -18
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +39 -39
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +33 -33
- package/Build/Workers/createCorridorGeometry.js +36 -37
- package/Build/Workers/createCorridorOutlineGeometry.js +34 -35
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +20 -20
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +20 -20
- package/Build/Workers/createGeometry.js +25 -24
- package/Build/Workers/createGroundPolylineGeometry.js +26 -26
- package/Build/Workers/createMvtTile.js +111 -19
- package/Build/Workers/createPlaneGeometry.js +18 -18
- package/Build/Workers/createPlaneOutlineGeometry.js +17 -17
- package/Build/Workers/createPolygonGeometry.js +36 -36
- package/Build/Workers/createPolygonOutlineGeometry.js +33 -33
- package/Build/Workers/createPolylineGeometry.js +28 -28
- package/Build/Workers/createPolylineVolumeGeometry.js +38 -36
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +32 -31
- package/Build/Workers/createRectangleGeometry.js +29 -29
- package/Build/Workers/createRectangleOutlineGeometry.js +23 -23
- package/Build/Workers/createSimplePolylineGeometry.js +26 -26
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +26 -26
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -23
- package/Build/Workers/createVerticesFromHeightmap.js +23 -23
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +21 -21
- package/Build/Workers/createWallGeometry.js +26 -26
- package/Build/Workers/createWallOutlineGeometry.js +26 -26
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +993 -2334
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +23 -23
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +26 -26
- package/Source/Core/ArcGISTiledElevationTerrainProvider.js +1 -5
- package/Source/Core/BoundingRectangle.js +6 -8
- package/Source/Core/BoundingSphere.js +0 -3
- package/Source/Core/Cartesian2.js +1 -1
- package/Source/Core/Cartesian3.js +1 -1
- package/Source/Core/Cartesian4.js +1 -1
- package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +3 -4
- package/Source/Core/Color.js +1 -0
- package/Source/Core/ComponentDatatype.js +35 -0
- package/Source/Core/CoplanarPolygonGeometry.js +2 -2
- package/Source/Core/CorridorGeometry.js +2 -4
- package/Source/Core/CorridorOutlineGeometry.js +1 -3
- package/Source/Core/EarthOrientationParameters.js +2 -2
- package/Source/Core/EllipseGeometryLibrary.js +2 -2
- package/Source/Core/EllipsoidGeodesic.js +3 -3
- package/Source/Core/EllipsoidRhumbLine.js +1 -1
- package/Source/Core/Heap.js +1 -1
- package/Source/Core/HermitePolynomialApproximation.js +215 -179
- package/Source/Core/InterpolationAlgorithm.js +58 -50
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/JulianDate.js +1 -1
- package/Source/Core/LagrangePolynomialApproximation.js +55 -52
- package/Source/Core/LinearApproximation.js +69 -66
- package/Source/Core/MapProjection.js +1 -0
- package/Source/Core/Math.js +59 -0
- package/Source/Core/Matrix2.js +3 -3
- package/Source/Core/Matrix3.js +3 -3
- package/Source/Core/Matrix4.js +1 -1
- package/Source/Core/OrthographicFrustum.js +1 -1
- package/Source/Core/PerspectiveFrustum.js +1 -1
- package/Source/Core/PolygonGeometry.js +2 -2
- package/Source/Core/PolygonGeometryLibrary.js +1 -1
- package/Source/Core/PolygonOutlineGeometry.js +1 -1
- package/Source/Core/PolylineGeometry.js +1 -1
- package/Source/Core/PolylineVolumeGeometryLibrary.js +1 -1
- package/Source/Core/Rectangle.js +7 -1
- package/Source/Core/RectangleOutlineGeometry.js +1 -1
- package/Source/Core/Resource.js +1 -1
- package/Source/Core/ScreenSpaceEventHandler.js +51 -41
- package/Source/Core/SimplePolylineGeometry.js +1 -1
- package/Source/Core/TerrainEncoding.js +2 -2
- package/Source/Core/TerrainMesh.js +3 -3
- package/Source/Core/TerrainPicker.js +180 -168
- package/Source/Core/TimeIntervalCollection.js +1 -3
- package/Source/Core/Tipsify.js +1 -1
- package/Source/Core/Transforms.js +5 -1
- package/Source/Core/VectorPipeline.js +1117 -0
- package/Source/Core/VectorProvider.js +429 -0
- package/Source/Core/WallOutlineGeometry.js +1 -1
- package/Source/Core/createColorRamp.js +37 -0
- package/Source/Core/getTimestamp.js +4 -2
- package/Source/Core/globalTypes.js +25 -0
- package/Source/Core/writeTextToCanvas.js +1 -0
- package/Source/DataSources/CompositeEntityCollection.js +0 -1
- package/Source/DataSources/CzmlDataSource.js +14 -0
- package/Source/DataSources/DataSourceDisplay.js +1 -1
- package/Source/DataSources/GeoJsonDataSource.js +0 -1
- package/Source/DataSources/GeometryVisualizer.js +1 -1
- package/Source/DataSources/KmlDataSource.js +529 -557
- package/Source/DataSources/PathGraphics.js +8 -1
- package/Source/DataSources/PathMode.js +27 -0
- package/Source/DataSources/PathVisualizer.js +298 -1
- package/Source/DataSources/PolylineVisualizer.js +1 -1
- package/Source/DataSources/StaticOutlineGeometryBatch.js +1 -1
- package/Source/Renderer/AutomaticUniforms.js +23 -0
- package/Source/Renderer/Context.js +9 -3
- package/Source/Renderer/DrawCommand.js +22 -0
- package/Source/Renderer/Framebuffer.js +4 -0
- package/Source/Renderer/Pass.js +11 -9
- package/Source/Renderer/Texture.js +12 -1
- package/Source/Renderer/UniformState.js +7 -0
- package/Source/Renderer/VertexArray.js +1 -1
- package/Source/Renderer/createUniform.js +346 -239
- package/Source/Renderer/createUniformArray.js +494 -381
- package/Source/Scene/ArcGisMapServerImageryProvider.js +0 -5
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +2 -1
- package/Source/Scene/BillboardCollection.js +15 -5
- package/Source/Scene/BillboardTexture.js +5 -3
- package/Source/Scene/BufferPointCollection.js +11 -1
- package/Source/Scene/BufferPolygonCollection.js +26 -0
- package/Source/Scene/BufferPolylineCollection.js +2 -0
- package/Source/Scene/BufferPrimitiveCollection.js +105 -32
- package/Source/Scene/Camera.js +85 -9
- package/Source/Scene/CameraEventAggregator.js +30 -18
- package/Source/Scene/CameraFlightPath.js +7 -4
- package/Source/Scene/Cesium3DTile.js +102 -4
- package/Source/Scene/Cesium3DTileContent.js +195 -254
- package/Source/Scene/Cesium3DTileContentFactory.js +10 -2
- package/Source/Scene/Cesium3DTileOptimizations.js +4 -6
- package/Source/Scene/Cesium3DTileStyle.js +40 -0
- package/Source/Scene/Cesium3DTileset.js +213 -8
- package/Source/Scene/Cesium3DTilesetTraversal.js +14 -0
- package/Source/Scene/ClippingPlaneCollection.js +4 -4
- package/Source/Scene/ClippingPolygon.js +2 -0
- package/Source/Scene/ClippingPolygonCollection.js +2 -2
- package/Source/Scene/Composite3DTileContent.js +254 -292
- package/Source/Scene/Controllers/Controller.js +63 -0
- package/Source/Scene/Controllers/ControllerHost.js +78 -0
- package/Source/Scene/Controllers/HybridScreenSpacePanCameraController.js +106 -0
- package/Source/Scene/Controllers/MouseButton.js +32 -0
- package/Source/Scene/Controllers/ScreenSpaceElevatorCameraController.js +295 -0
- package/Source/Scene/Controllers/ScreenSpaceInputBindings.js +154 -0
- package/Source/Scene/Controllers/ScreenSpaceMapCameraController.js +310 -0
- package/Source/Scene/Controllers/ScreenSpaceTiltOrbitCameraController.js +642 -0
- package/Source/Scene/Controllers/ScreenSpaceZoomCameraController.js +431 -0
- package/Source/Scene/Controllers/defaultPickWorldPosition.js +84 -0
- package/Source/Scene/DerivedCommand.js +98 -0
- package/Source/Scene/EdgeDisplayMode.js +50 -0
- package/Source/Scene/EdgeFramebuffer.js +1 -5
- package/Source/Scene/Empty3DTileContent.js +100 -132
- package/Source/Scene/Expression.js +6 -8
- package/Source/Scene/FrameState.js +17 -0
- package/Source/Scene/GaussianSplat3DTileContent.js +436 -478
- package/Source/Scene/GeoJsonPrimitive.js +874 -0
- package/Source/Scene/Geometry3DTileContent.js +151 -185
- package/Source/Scene/Globe.js +22 -1
- package/Source/Scene/GlobeDepth.js +27 -1
- package/Source/Scene/GlobeSurfaceShaderSet.js +637 -540
- package/Source/Scene/GlobeSurfaceTile.js +575 -398
- package/Source/Scene/GlobeSurfaceTileProvider.js +1412 -1184
- package/Source/Scene/GltfBufferViewLoader.js +3 -3
- package/Source/Scene/GltfLoader.js +146 -3
- package/Source/Scene/GltfLoaderUtil.js +20 -4
- package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +10 -0
- package/Source/Scene/GltfPipeline/removeUnusedElements.js +21 -11
- package/Source/Scene/GltfSpzLoader.js +1 -1
- package/Source/Scene/GltfVertexBufferLoader.js +6 -3
- package/Source/Scene/I3SDataProvider.js +1 -1
- package/Source/Scene/I3SLayer.js +1 -1
- package/Source/Scene/I3SNode.js +2 -2
- package/Source/Scene/ImageryLayer.js +2 -2
- package/Source/Scene/ImageryLayerCollection.js +190 -6
- package/Source/Scene/Implicit3DTileContent.js +192 -216
- package/Source/Scene/ImplicitTileCoordinates.js +17 -0
- package/Source/Scene/IonImageryProvider.js +1 -5
- package/Source/Scene/Label.js +4 -4
- package/Source/Scene/LabelCollection.js +4 -1
- package/Source/Scene/MVTDataProvider.js +555 -0
- package/Source/Scene/Material.js +1 -0
- package/Source/Scene/Model/B3dmLoader.js +1 -2
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +82 -312
- package/Source/Scene/Model/Extensions/Gpm/GltfGpmLoader.js +4 -0
- package/Source/Scene/Model/I3dmLoader.js +1 -1
- package/Source/Scene/Model/InstancingPipelineStage.js +4 -7
- package/Source/Scene/Model/MaterialPipelineStage.js +124 -1
- package/Source/Scene/Model/Model.js +45 -10
- package/Source/Scene/Model/Model3DTileContent.js +424 -458
- package/Source/Scene/Model/ModelClippingPlanesPipelineStage.js +28 -1
- package/Source/Scene/Model/ModelDrawCommand.js +180 -8
- package/Source/Scene/Model/ModelDrawCommands.js +4 -0
- package/Source/Scene/Model/ModelSceneGraph.js +21 -0
- package/Source/Scene/Model/ModelUtility.js +5 -0
- package/Source/Scene/Model/PickingPipelineStage.js +29 -0
- package/Source/Scene/Model/PrimitiveRenderResources.js +24 -0
- package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +645 -153
- package/Source/Scene/ModelComponents.js +112 -0
- package/Source/Scene/Multiple3DTileContent.js +291 -334
- package/Source/Scene/MvtLabelCandidates.js +295 -0
- package/Source/Scene/MvtLabelManager.js +1069 -0
- package/Source/Scene/Picking.js +19 -3
- package/Source/Scene/PlanarFillIdFramebuffer.js +172 -0
- package/Source/Scene/PntsParser.js +1 -1
- package/Source/Scene/PolylineCollection.js +5 -3
- package/Source/Scene/PostProcessStage.js +4 -2
- package/Source/Scene/QuadtreePrimitive.js +3 -2
- package/Source/Scene/ResourceCache.js +7 -4
- package/Source/Scene/ResourceCacheKey.js +21 -18
- package/Source/Scene/Scene.js +237 -11
- package/Source/Scene/SceneTransforms.js +6 -5
- package/Source/Scene/ShadowMap.js +9 -3
- package/Source/Scene/ShadowMapShader.js +50 -2
- package/Source/Scene/SnapFramebuffer.js +121 -0
- package/Source/Scene/Snapping.js +184 -0
- package/Source/Scene/TerrainFillMesh.js +3 -2
- package/Source/Scene/Tileset3DTileContent.js +113 -146
- package/Source/Scene/UrlTemplate3DTilesDataProvider.js +543 -0
- package/Source/Scene/Vector3DTileContent.js +207 -237
- package/Source/Scene/VectorGltf3DTileContent.js +185 -45
- package/Source/Scene/View.js +10 -8
- package/Source/Scene/VoxelPrimitive.js +159 -175
- package/Source/Scene/VoxelProvider.js +64 -91
- package/Source/Scene/VoxelTraversal.js +1 -1
- package/Source/Scene/buildVectorGltfFromMVT.js +1208 -0
- package/Source/Scene/buildVoxelCustomShader.js +199 -0
- package/Source/Scene/createElevationBandMaterial.js +1 -1
- package/Source/Scene/decodeMVT.js +877 -0
- package/Source/Scene/findMeshoptExtension.js +23 -0
- package/Source/Scene/renderBufferPointCollection.js +114 -64
- package/Source/Scene/renderBufferPolygonCollection.js +245 -53
- package/Source/Scene/renderBufferPolylineCollection.js +271 -145
- package/Source/Shaders/BillboardCollectionVS.glsl +23 -25
- package/Source/Shaders/BillboardCollectionVS.js +23 -25
- package/Source/Shaders/BufferPointMaterialFS.glsl +1 -0
- package/Source/Shaders/BufferPointMaterialFS.js +1 -0
- package/Source/Shaders/BufferPointMaterialVS.glsl +19 -9
- package/Source/Shaders/BufferPointMaterialVS.js +20 -10
- package/Source/Shaders/BufferPolygonMaterialFS.glsl +13 -0
- package/Source/Shaders/BufferPolygonMaterialFS.js +13 -0
- package/Source/Shaders/BufferPolygonMaterialVS.glsl +22 -4
- package/Source/Shaders/BufferPolygonMaterialVS.js +23 -5
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +16 -2
- package/Source/Shaders/BufferPolylineMaterialVS.js +17 -3
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.js +11 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.js +11 -0
- package/Source/Shaders/Builtin/Constants/passClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
- package/Source/Shaders/GlobeFS.glsl +10 -6
- package/Source/Shaders/GlobeFS.js +10 -6
- package/Source/Shaders/Materials/PolylineGlowMaterial.glsl +1 -1
- package/Source/Shaders/Materials/PolylineGlowMaterial.js +1 -1
- package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +0 -1
- package/Source/Shaders/Model/EdgeVisibilityStageVS.js +0 -1
- package/Source/Shaders/Model/MaterialStageFS.glsl +8 -2
- package/Source/Shaders/Model/MaterialStageFS.js +8 -2
- package/Source/Shaders/Model/ModelFS.glsl +105 -0
- package/Source/Shaders/Model/ModelFS.js +105 -0
- package/Source/Shaders/VectorCommon.glsl +178 -0
- package/Source/Shaders/VectorCommon.js +180 -0
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/Source/Widget/CesiumWidget.js +30 -0
- package/Source/Workers/createMvtTile.js +39 -0
- package/Source/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2
- package/Source/Workers/incrementallyBuildTerrainPicker.js +2 -0
- package/index.js +113 -83
- package/package.json +13 -13
|
@@ -0,0 +1,874 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/** @import {GeoJson, GeoJsonFeature, GeoJsonGeometry, GeoJsonPosition} from "../Core/globalTypes.js"; */
|
|
4
|
+
/** @import FrameState from "./FrameState.js"; */
|
|
5
|
+
|
|
6
|
+
import Cartesian2 from "../Core/Cartesian2.js";
|
|
7
|
+
import Cartesian3 from "../Core/Cartesian3.js";
|
|
8
|
+
import Check from "../Core/Check.js";
|
|
9
|
+
import defined from "../Core/defined.js";
|
|
10
|
+
import destroyObject from "../Core/destroyObject.js";
|
|
11
|
+
import DeveloperError from "../Core/DeveloperError.js";
|
|
12
|
+
import Ellipsoid from "../Core/Ellipsoid.js";
|
|
13
|
+
import Frozen from "../Core/Frozen.js";
|
|
14
|
+
import PolygonPipeline from "../Core/PolygonPipeline.js";
|
|
15
|
+
import Resource from "../Core/Resource.js";
|
|
16
|
+
import RuntimeError from "../Core/RuntimeError.js";
|
|
17
|
+
import BufferPoint from "./BufferPoint.js";
|
|
18
|
+
import BufferPointCollection from "./BufferPointCollection.js";
|
|
19
|
+
import BufferPolygon from "./BufferPolygon.js";
|
|
20
|
+
import BufferPolygonCollection from "./BufferPolygonCollection.js";
|
|
21
|
+
import BufferPolyline from "./BufferPolyline.js";
|
|
22
|
+
import BufferPolylineCollection from "./BufferPolylineCollection.js";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @typedef {object} GeoJsonPrimitiveConstructorOptions
|
|
26
|
+
* @property {object} [geoJson]
|
|
27
|
+
* @property {Resource|string} [url]
|
|
28
|
+
* @property {Ellipsoid} [ellipsoid=Ellipsoid.default]
|
|
29
|
+
* @property {boolean} [allowPicking=true]
|
|
30
|
+
* @property {boolean} [show=true]
|
|
31
|
+
* @property {function(number, object, Record<string, unknown>):object} [pickObjectFactory]
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Lightweight GeoJSON loader that converts features directly into
|
|
36
|
+
* {@link BufferPointCollection}, {@link BufferPolylineCollection}, and
|
|
37
|
+
* {@link BufferPolygonCollection}.
|
|
38
|
+
*
|
|
39
|
+
* Unlike {@link GeoJsonDataSource}, this path does not create entities.
|
|
40
|
+
* Instead, it exposes high-throughput buffer primitive collections that can be
|
|
41
|
+
* added directly to {@link Scene#primitives}.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* const loader = await Cesium.GeoJsonPrimitive.fromUrl("./data.geojson");
|
|
45
|
+
* viewer.scene.primitives.add(loader);
|
|
46
|
+
*
|
|
47
|
+
* loader.points; // BufferPointCollection | undefined
|
|
48
|
+
* loader.polylines; // BufferPolylineCollection | undefined
|
|
49
|
+
* loader.polygons; // BufferPolygonCollection | undefined
|
|
50
|
+
* loader.ids; // source feature IDs
|
|
51
|
+
* loader.properties; // source feature properties
|
|
52
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
53
|
+
*/
|
|
54
|
+
class GeoJsonPrimitive {
|
|
55
|
+
/**
|
|
56
|
+
* @param {GeoJsonPrimitiveConstructorOptions} [options]
|
|
57
|
+
*/
|
|
58
|
+
constructor(options) {
|
|
59
|
+
options = options ?? Frozen.EMPTY_OBJECT;
|
|
60
|
+
|
|
61
|
+
//>>includeStart('debug', pragmas.debug);
|
|
62
|
+
if (!defined(options.geoJson)) {
|
|
63
|
+
throw new DeveloperError("options.geoJson is required.");
|
|
64
|
+
}
|
|
65
|
+
//>>includeEnd('debug');
|
|
66
|
+
|
|
67
|
+
const parseResult = parseGeoJson(/** @type {GeoJson} */ (options.geoJson));
|
|
68
|
+
const allowPicking = options.allowPicking ?? true;
|
|
69
|
+
const ellipsoid = options.ellipsoid ?? Ellipsoid.default;
|
|
70
|
+
let packedPositionsScratch = new Float64Array(0);
|
|
71
|
+
/** @param {number} requiredLength */
|
|
72
|
+
function getPackedPositionScratch(requiredLength) {
|
|
73
|
+
if (packedPositionsScratch.length < requiredLength) {
|
|
74
|
+
packedPositionsScratch = new Float64Array(requiredLength);
|
|
75
|
+
}
|
|
76
|
+
return packedPositionsScratch;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
this.show = options.show ?? true;
|
|
80
|
+
this._url = options.url;
|
|
81
|
+
this._ids = parseResult.ids;
|
|
82
|
+
this._properties = parseResult.properties;
|
|
83
|
+
this._featureCount = parseResult.ids.length;
|
|
84
|
+
this._pickObjectFactory = options.pickObjectFactory;
|
|
85
|
+
this._points = undefined;
|
|
86
|
+
this._polylines = undefined;
|
|
87
|
+
this._polygons = undefined;
|
|
88
|
+
|
|
89
|
+
if (parseResult.pointCount > 0) {
|
|
90
|
+
/** @type {Record<string, unknown>} */
|
|
91
|
+
const pointOptions = {
|
|
92
|
+
primitiveCountMax: parseResult.pointCount,
|
|
93
|
+
allowPicking: allowPicking,
|
|
94
|
+
};
|
|
95
|
+
this._points = new BufferPointCollection(pointOptions);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (parseResult.polylineCount > 0) {
|
|
99
|
+
/** @type {Record<string, unknown>} */
|
|
100
|
+
const polylineOptions = {
|
|
101
|
+
primitiveCountMax: parseResult.polylineCount,
|
|
102
|
+
vertexCountMax: parseResult.polylineVertexCount,
|
|
103
|
+
allowPicking: allowPicking,
|
|
104
|
+
};
|
|
105
|
+
this._polylines = new BufferPolylineCollection(polylineOptions);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (parseResult.polygonCount > 0) {
|
|
109
|
+
/** @type {Record<string, unknown>} */
|
|
110
|
+
const polygonOptions = {
|
|
111
|
+
primitiveCountMax: parseResult.polygonCount,
|
|
112
|
+
vertexCountMax: parseResult.polygonVertexCount,
|
|
113
|
+
holeCountMax: parseResult.polygonHoleCount,
|
|
114
|
+
triangleCountMax: parseResult.polygonTriangleCount,
|
|
115
|
+
allowPicking: allowPicking,
|
|
116
|
+
};
|
|
117
|
+
this._polygons = new BufferPolygonCollection(polygonOptions);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const scratch = new Cartesian3();
|
|
121
|
+
let pointIndex = 0;
|
|
122
|
+
let polylineIndex = 0;
|
|
123
|
+
let polygonIndex = 0;
|
|
124
|
+
|
|
125
|
+
for (let i = 0; i < parseResult.features.length; i++) {
|
|
126
|
+
const feature = parseResult.features[i];
|
|
127
|
+
const featureId = feature.featureId;
|
|
128
|
+
const sourceProperties = this._properties[featureId];
|
|
129
|
+
|
|
130
|
+
for (let j = 0; j < feature.points.length; j++) {
|
|
131
|
+
const idx = pointIndex++;
|
|
132
|
+
this._points.add({
|
|
133
|
+
featureId: featureId,
|
|
134
|
+
position: toCartesian(feature.points[j], ellipsoid, scratch),
|
|
135
|
+
pickObject: allowPicking
|
|
136
|
+
? createPickObject(
|
|
137
|
+
this,
|
|
138
|
+
idx,
|
|
139
|
+
this._points,
|
|
140
|
+
BufferPoint,
|
|
141
|
+
sourceProperties,
|
|
142
|
+
)
|
|
143
|
+
: undefined,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
for (let j = 0; j < feature.polylines.length; j++) {
|
|
148
|
+
const idx = polylineIndex++;
|
|
149
|
+
this._polylines.add({
|
|
150
|
+
featureId: featureId,
|
|
151
|
+
positions: packPositionsToScratch(
|
|
152
|
+
feature.polylines[j],
|
|
153
|
+
ellipsoid,
|
|
154
|
+
getPackedPositionScratch,
|
|
155
|
+
),
|
|
156
|
+
pickObject: allowPicking
|
|
157
|
+
? createPickObject(
|
|
158
|
+
this,
|
|
159
|
+
idx,
|
|
160
|
+
this._polylines,
|
|
161
|
+
BufferPolyline,
|
|
162
|
+
sourceProperties,
|
|
163
|
+
)
|
|
164
|
+
: undefined,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
for (let j = 0; j < feature.polygons.length; j++) {
|
|
169
|
+
const polygon = feature.polygons[j];
|
|
170
|
+
const idx = polygonIndex++;
|
|
171
|
+
this._polygons.add({
|
|
172
|
+
featureId: featureId,
|
|
173
|
+
positions: packPositionsToScratch(
|
|
174
|
+
polygon.positions,
|
|
175
|
+
ellipsoid,
|
|
176
|
+
getPackedPositionScratch,
|
|
177
|
+
),
|
|
178
|
+
holes: polygon.holes,
|
|
179
|
+
triangles: polygon.triangles,
|
|
180
|
+
pickObject: allowPicking
|
|
181
|
+
? createPickObject(
|
|
182
|
+
this,
|
|
183
|
+
idx,
|
|
184
|
+
this._polygons,
|
|
185
|
+
BufferPolygon,
|
|
186
|
+
sourceProperties,
|
|
187
|
+
)
|
|
188
|
+
: undefined,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Loader source URL when created via {@link GeoJsonPrimitive.fromUrl}.
|
|
196
|
+
*
|
|
197
|
+
* @type {string|undefined}
|
|
198
|
+
* @readonly
|
|
199
|
+
*/
|
|
200
|
+
get url() {
|
|
201
|
+
const url = this._url;
|
|
202
|
+
if (!defined(url)) {
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
return url instanceof Resource ? url.getUrlComponent(true) : url;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Feature count represented by the loaded collections.
|
|
210
|
+
*
|
|
211
|
+
* @type {number}
|
|
212
|
+
* @readonly
|
|
213
|
+
*/
|
|
214
|
+
get featureCount() {
|
|
215
|
+
return this._featureCount;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Lookup table from integer ID generated by GeoJsonPrimitive, to integer or string Feature ID from GeoJSON source.
|
|
220
|
+
*
|
|
221
|
+
* @type {Array<string|number|undefined>}
|
|
222
|
+
* @readonly
|
|
223
|
+
*/
|
|
224
|
+
get ids() {
|
|
225
|
+
return this._ids;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Source GeoJSON properties, indexed by generated integer ID.
|
|
230
|
+
*
|
|
231
|
+
* @type {Array<Record<string, unknown>>}
|
|
232
|
+
* @readonly
|
|
233
|
+
*/
|
|
234
|
+
get properties() {
|
|
235
|
+
return this._properties;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Buffer point collection for point geometries.
|
|
240
|
+
*
|
|
241
|
+
* @type {BufferPointCollection|undefined}
|
|
242
|
+
* @readonly
|
|
243
|
+
*/
|
|
244
|
+
get points() {
|
|
245
|
+
return this._points;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Buffer polyline collection for linestring geometries.
|
|
250
|
+
*
|
|
251
|
+
* @type {BufferPolylineCollection|undefined}
|
|
252
|
+
* @readonly
|
|
253
|
+
*/
|
|
254
|
+
get polylines() {
|
|
255
|
+
return this._polylines;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Buffer polygon collection for polygon geometries.
|
|
260
|
+
*
|
|
261
|
+
* @type {BufferPolygonCollection|undefined}
|
|
262
|
+
* @readonly
|
|
263
|
+
*/
|
|
264
|
+
get polygons() {
|
|
265
|
+
return this._polygons;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Loads GeoJSON from a URL or {@link Resource}.
|
|
270
|
+
*
|
|
271
|
+
* @param {Resource|string} url
|
|
272
|
+
* @param {GeoJsonPrimitiveConstructorOptions} [options]
|
|
273
|
+
* @returns {Promise<GeoJsonPrimitive>}
|
|
274
|
+
*/
|
|
275
|
+
static async fromUrl(url, options) {
|
|
276
|
+
//>>includeStart('debug', pragmas.debug);
|
|
277
|
+
if (!defined(url)) {
|
|
278
|
+
throw new DeveloperError("url is required.");
|
|
279
|
+
}
|
|
280
|
+
//>>includeEnd('debug');
|
|
281
|
+
|
|
282
|
+
const resource = Resource.createIfNeeded(url);
|
|
283
|
+
const geoJson = await resource.fetchJson();
|
|
284
|
+
if (!defined(geoJson)) {
|
|
285
|
+
throw new RuntimeError(
|
|
286
|
+
`Failed to load GeoJSON from ${resource.getUrlComponent(true)}.`,
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return GeoJsonPrimitive.fromGeoJson(geoJson, {
|
|
291
|
+
...options,
|
|
292
|
+
url: resource,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Creates a loader directly from a parsed GeoJSON object.
|
|
298
|
+
*
|
|
299
|
+
* @param {object} geoJson
|
|
300
|
+
* @param {GeoJsonPrimitiveConstructorOptions} [options]
|
|
301
|
+
* @returns {GeoJsonPrimitive}
|
|
302
|
+
*/
|
|
303
|
+
static fromGeoJson(geoJson, options) {
|
|
304
|
+
return new GeoJsonPrimitive({
|
|
305
|
+
...options,
|
|
306
|
+
geoJson: geoJson,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @param {number} featureId
|
|
312
|
+
*/
|
|
313
|
+
getId(featureId) {
|
|
314
|
+
//>>includeStart('debug', pragmas.debug);
|
|
315
|
+
Check.typeOf.number.greaterThanOrEquals("featureId", featureId, 0);
|
|
316
|
+
Check.typeOf.number.lessThan("featureId", featureId, this._featureCount);
|
|
317
|
+
//>>includeEnd('debug');
|
|
318
|
+
return this._ids[featureId];
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* @param {number} featureId
|
|
323
|
+
*/
|
|
324
|
+
getProperties(featureId) {
|
|
325
|
+
//>>includeStart('debug', pragmas.debug);
|
|
326
|
+
Check.typeOf.number.greaterThanOrEquals("featureId", featureId, 0);
|
|
327
|
+
Check.typeOf.number.lessThan("featureId", featureId, this._featureCount);
|
|
328
|
+
//>>includeEnd('debug');
|
|
329
|
+
return this._properties[featureId];
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* @param {FrameState} frameState
|
|
334
|
+
* @private
|
|
335
|
+
*/
|
|
336
|
+
update(frameState) {
|
|
337
|
+
if (!this.show) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
if (defined(this._points)) {
|
|
342
|
+
this._points.update(frameState);
|
|
343
|
+
}
|
|
344
|
+
if (defined(this._polylines)) {
|
|
345
|
+
this._polylines.update(frameState);
|
|
346
|
+
}
|
|
347
|
+
if (defined(this._polygons)) {
|
|
348
|
+
this._polygons.update(frameState);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
destroy() {
|
|
353
|
+
if (this._points) {
|
|
354
|
+
this._points.destroy();
|
|
355
|
+
this._points = undefined;
|
|
356
|
+
}
|
|
357
|
+
if (this._polylines) {
|
|
358
|
+
this._polylines.destroy();
|
|
359
|
+
this._polylines = undefined;
|
|
360
|
+
}
|
|
361
|
+
if (this._polygons) {
|
|
362
|
+
this._polygons.destroy();
|
|
363
|
+
this._polygons = undefined;
|
|
364
|
+
}
|
|
365
|
+
return destroyObject(this);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
isDestroyed() {
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* @param {GeoJsonPrimitive} loader
|
|
375
|
+
* @param {number} index
|
|
376
|
+
* @param {{get: function(number, object): object}} collection
|
|
377
|
+
* @param {function(new: object)} PrimitiveClass
|
|
378
|
+
* @param {Record<string, unknown>} properties
|
|
379
|
+
* @returns {object}
|
|
380
|
+
* @ignore
|
|
381
|
+
*/
|
|
382
|
+
function createPickObject(
|
|
383
|
+
loader,
|
|
384
|
+
index,
|
|
385
|
+
collection,
|
|
386
|
+
PrimitiveClass,
|
|
387
|
+
properties,
|
|
388
|
+
) {
|
|
389
|
+
if (defined(loader._pickObjectFactory)) {
|
|
390
|
+
return loader._pickObjectFactory(index, collection, properties);
|
|
391
|
+
}
|
|
392
|
+
return {
|
|
393
|
+
index,
|
|
394
|
+
collection,
|
|
395
|
+
get primitive() {
|
|
396
|
+
// Cannot reuse primitives; scene.drillPick() appends to a list.
|
|
397
|
+
return collection.get(index, new PrimitiveClass());
|
|
398
|
+
},
|
|
399
|
+
parentPrimitive: loader,
|
|
400
|
+
properties,
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* @param {GeoJson} geoJson
|
|
406
|
+
* @ignore
|
|
407
|
+
*/
|
|
408
|
+
function parseGeoJson(geoJson) {
|
|
409
|
+
const featureInputs = getInputFeatures(geoJson);
|
|
410
|
+
|
|
411
|
+
/** @type {Array<{featureId:number, points:Array<GeoJsonPosition>, polylines:Array<Array<GeoJsonPosition>>, polygons:Array<{positions:Array<GeoJsonPosition>, holes:Uint32Array, triangles:Uint32Array}>}>} */
|
|
412
|
+
const features = [];
|
|
413
|
+
/** @type {Array<string|number|undefined>} */
|
|
414
|
+
const ids = [];
|
|
415
|
+
/** @type {Array<Record<string, unknown>>} */
|
|
416
|
+
const properties = [];
|
|
417
|
+
|
|
418
|
+
let pointCount = 0;
|
|
419
|
+
let polylineCount = 0;
|
|
420
|
+
let polylineVertexCount = 0;
|
|
421
|
+
let polygonCount = 0;
|
|
422
|
+
let polygonVertexCount = 0;
|
|
423
|
+
let polygonHoleCount = 0;
|
|
424
|
+
let polygonTriangleCount = 0;
|
|
425
|
+
|
|
426
|
+
for (let i = 0; i < featureInputs.length; i++) {
|
|
427
|
+
const featureInput = featureInputs[i];
|
|
428
|
+
/** @type {{points: Array<GeoJsonPosition>, polylines: Array<Array<GeoJsonPosition>>, polygons: Array<{positions: Array<GeoJsonPosition>, holes: Uint32Array, triangles: Uint32Array}>}} */
|
|
429
|
+
const featureGeometries = {
|
|
430
|
+
points: [],
|
|
431
|
+
polylines: [],
|
|
432
|
+
polygons: [],
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
appendGeometry(featureInput.geometry, featureGeometries);
|
|
436
|
+
|
|
437
|
+
if (
|
|
438
|
+
featureGeometries.points.length === 0 &&
|
|
439
|
+
featureGeometries.polylines.length === 0 &&
|
|
440
|
+
featureGeometries.polygons.length === 0
|
|
441
|
+
) {
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const featureId = ids.length;
|
|
446
|
+
ids.push(featureInput.id);
|
|
447
|
+
properties.push(
|
|
448
|
+
// @ts-expect-error Casting changes .d.ts output, a suspected bug in tsd-jsdoc.
|
|
449
|
+
isPlainObject(featureInput.properties)
|
|
450
|
+
? featureInput.properties
|
|
451
|
+
: Frozen.EMPTY_OBJECT,
|
|
452
|
+
);
|
|
453
|
+
|
|
454
|
+
for (let j = 0; j < featureGeometries.polygons.length; j++) {
|
|
455
|
+
const polygon = featureGeometries.polygons[j];
|
|
456
|
+
polygonHoleCount += polygon.holes.length;
|
|
457
|
+
polygonTriangleCount += polygon.triangles.length / 3;
|
|
458
|
+
polygonVertexCount += polygon.positions.length;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
for (let j = 0; j < featureGeometries.polylines.length; j++) {
|
|
462
|
+
polylineVertexCount += featureGeometries.polylines[j].length;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
pointCount += featureGeometries.points.length;
|
|
466
|
+
polylineCount += featureGeometries.polylines.length;
|
|
467
|
+
polygonCount += featureGeometries.polygons.length;
|
|
468
|
+
|
|
469
|
+
features.push({
|
|
470
|
+
featureId: featureId,
|
|
471
|
+
points: featureGeometries.points,
|
|
472
|
+
polylines: featureGeometries.polylines,
|
|
473
|
+
polygons: featureGeometries.polygons,
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
return {
|
|
478
|
+
features: features,
|
|
479
|
+
ids: ids,
|
|
480
|
+
properties: properties,
|
|
481
|
+
pointCount: pointCount,
|
|
482
|
+
polylineCount: polylineCount,
|
|
483
|
+
polylineVertexCount: polylineVertexCount,
|
|
484
|
+
polygonCount: polygonCount,
|
|
485
|
+
polygonVertexCount: polygonVertexCount,
|
|
486
|
+
polygonHoleCount: polygonHoleCount,
|
|
487
|
+
polygonTriangleCount: polygonTriangleCount,
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* @param {GeoJson} geoJson
|
|
493
|
+
* @returns {Array<GeoJsonFeature>}
|
|
494
|
+
* @ignore
|
|
495
|
+
*/
|
|
496
|
+
function getInputFeatures(geoJson) {
|
|
497
|
+
if (!defined(geoJson) || !defined(geoJson.type)) {
|
|
498
|
+
throw new RuntimeError("GeoJSON object must define 'type'.");
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
switch (geoJson.type) {
|
|
502
|
+
case "FeatureCollection": {
|
|
503
|
+
const fc = /** @type {{ features: GeoJsonFeature[] }} */ (geoJson);
|
|
504
|
+
return fc.features;
|
|
505
|
+
}
|
|
506
|
+
case "Feature":
|
|
507
|
+
return [/** @type {GeoJsonFeature} */ (geoJson)];
|
|
508
|
+
default:
|
|
509
|
+
if (isGeometryType(geoJson.type)) {
|
|
510
|
+
return [
|
|
511
|
+
{
|
|
512
|
+
type: "Feature",
|
|
513
|
+
geometry: /** @type {GeoJsonGeometry} */ (geoJson),
|
|
514
|
+
properties: Frozen.EMPTY_OBJECT,
|
|
515
|
+
id: undefined,
|
|
516
|
+
},
|
|
517
|
+
];
|
|
518
|
+
}
|
|
519
|
+
throw new RuntimeError(`Unsupported GeoJSON type: ${geoJson.type}`);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* @param {GeoJsonGeometry | null | undefined} geometry
|
|
525
|
+
* @param {{points: Array<GeoJsonPosition>, polylines: Array<GeoJsonPosition[]>, polygons: Array<object>}} result
|
|
526
|
+
* @ignore
|
|
527
|
+
*/
|
|
528
|
+
function appendGeometry(geometry, result) {
|
|
529
|
+
if (!defined(geometry) || !defined(geometry.type)) {
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
switch (geometry.type) {
|
|
534
|
+
case "Point":
|
|
535
|
+
appendPoint(geometry.coordinates, result.points);
|
|
536
|
+
return;
|
|
537
|
+
case "MultiPoint":
|
|
538
|
+
appendMultiPoint(
|
|
539
|
+
/** @type {unknown[]} */ (geometry.coordinates),
|
|
540
|
+
result.points,
|
|
541
|
+
);
|
|
542
|
+
return;
|
|
543
|
+
case "LineString":
|
|
544
|
+
appendLineString(geometry.coordinates, result.polylines);
|
|
545
|
+
return;
|
|
546
|
+
case "MultiLineString":
|
|
547
|
+
appendMultiLineString(
|
|
548
|
+
/** @type {unknown[]} */ (geometry.coordinates),
|
|
549
|
+
result.polylines,
|
|
550
|
+
);
|
|
551
|
+
return;
|
|
552
|
+
case "Polygon":
|
|
553
|
+
appendPolygon(geometry.coordinates, result.polygons);
|
|
554
|
+
return;
|
|
555
|
+
case "MultiPolygon":
|
|
556
|
+
appendMultiPolygon(
|
|
557
|
+
/** @type {unknown[]} */ (geometry.coordinates),
|
|
558
|
+
result.polygons,
|
|
559
|
+
);
|
|
560
|
+
return;
|
|
561
|
+
case "GeometryCollection":
|
|
562
|
+
appendGeometryCollection(geometry.geometries, result);
|
|
563
|
+
return;
|
|
564
|
+
default:
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* @param {Array<GeoJsonGeometry>} geometries
|
|
571
|
+
* @param {{points: Array<GeoJsonPosition>, polylines: Array<Array<GeoJsonPosition>>, polygons: Array<object>}} result
|
|
572
|
+
* @ignore
|
|
573
|
+
*/
|
|
574
|
+
function appendGeometryCollection(geometries, result) {
|
|
575
|
+
if (!Array.isArray(geometries)) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
for (let i = 0; i < geometries.length; i++) {
|
|
580
|
+
appendGeometry(geometries[i], result);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* @param {unknown} coordinates
|
|
586
|
+
* @param {Array<GeoJsonPosition>} points
|
|
587
|
+
* @ignore
|
|
588
|
+
*/
|
|
589
|
+
function appendPoint(coordinates, points) {
|
|
590
|
+
const position = normalizePosition(coordinates);
|
|
591
|
+
if (defined(position)) {
|
|
592
|
+
points.push(position);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* @param {Array.<unknown>} coordinates
|
|
598
|
+
* @param {Array<GeoJsonPosition>} points
|
|
599
|
+
* @ignore
|
|
600
|
+
*/
|
|
601
|
+
function appendMultiPoint(coordinates, points) {
|
|
602
|
+
for (let i = 0; i < coordinates.length; i++) {
|
|
603
|
+
appendPoint(coordinates[i], points);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* @param {unknown} coordinates
|
|
609
|
+
* @param {Array<Array<GeoJsonPosition>>} polylines
|
|
610
|
+
* @ignore
|
|
611
|
+
*/
|
|
612
|
+
function appendLineString(coordinates, polylines) {
|
|
613
|
+
const polyline = normalizeLine(coordinates);
|
|
614
|
+
if (defined(polyline) && polyline.length >= 2) {
|
|
615
|
+
polylines.push(polyline);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* @param {Array.<unknown>} coordinates
|
|
621
|
+
* @param {Array<Array<GeoJsonPosition>>} polylines
|
|
622
|
+
* @ignore
|
|
623
|
+
*/
|
|
624
|
+
function appendMultiLineString(coordinates, polylines) {
|
|
625
|
+
for (let i = 0; i < coordinates.length; i++) {
|
|
626
|
+
appendLineString(coordinates[i], polylines);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* @param {unknown} coordinates
|
|
632
|
+
* @param {Array<object>} polygons
|
|
633
|
+
* @ignore
|
|
634
|
+
*/
|
|
635
|
+
function appendPolygon(coordinates, polygons) {
|
|
636
|
+
const polygon = normalizePolygon(coordinates);
|
|
637
|
+
if (defined(polygon)) {
|
|
638
|
+
polygons.push(polygon);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* @param {Array.<unknown>} coordinates
|
|
644
|
+
* @param {Array<object>} polygons
|
|
645
|
+
* @ignore
|
|
646
|
+
*/
|
|
647
|
+
function appendMultiPolygon(coordinates, polygons) {
|
|
648
|
+
for (let i = 0; i < coordinates.length; i++) {
|
|
649
|
+
appendPolygon(coordinates[i], polygons);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* @param {unknown} coordinates
|
|
655
|
+
* @returns {Array<GeoJsonPosition> | undefined}
|
|
656
|
+
* @ignore
|
|
657
|
+
*/
|
|
658
|
+
function normalizeLine(coordinates) {
|
|
659
|
+
if (!Array.isArray(coordinates)) {
|
|
660
|
+
return undefined;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
const line = [];
|
|
664
|
+
for (let i = 0; i < coordinates.length; i++) {
|
|
665
|
+
const position = normalizePosition(coordinates[i]);
|
|
666
|
+
if (defined(position)) {
|
|
667
|
+
line.push(position);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
return line.length >= 2 ? line : undefined;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* @param {unknown} rings
|
|
676
|
+
* @returns {{positions: Array<GeoJsonPosition>, holes: Uint32Array, triangles: Uint32Array} | undefined}
|
|
677
|
+
* @ignore
|
|
678
|
+
*/
|
|
679
|
+
function normalizePolygon(rings) {
|
|
680
|
+
if (!Array.isArray(rings) || rings.length === 0) {
|
|
681
|
+
return undefined;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
const normalizedRings = [];
|
|
685
|
+
for (let i = 0; i < rings.length; i++) {
|
|
686
|
+
const ring = normalizeRing(rings[i]);
|
|
687
|
+
if (defined(ring)) {
|
|
688
|
+
normalizedRings.push(ring);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
if (normalizedRings.length === 0) {
|
|
693
|
+
return undefined;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
const outerRing = normalizedRings[0];
|
|
697
|
+
if (outerRing.length < 3) {
|
|
698
|
+
return undefined;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
const positions2D = [];
|
|
702
|
+
const positions = [];
|
|
703
|
+
const holes = [];
|
|
704
|
+
|
|
705
|
+
for (let i = 0; i < normalizedRings.length; i++) {
|
|
706
|
+
const ring = normalizedRings[i];
|
|
707
|
+
if (ring.length < 3) {
|
|
708
|
+
continue;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
if (i > 0) {
|
|
712
|
+
holes.push(positions.length);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
for (let j = 0; j < ring.length; j++) {
|
|
716
|
+
const position = ring[j];
|
|
717
|
+
positions.push(position);
|
|
718
|
+
positions2D.push(new Cartesian2(position[0], position[1]));
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
if (positions.length < 3) {
|
|
723
|
+
return undefined;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
const triangles = PolygonPipeline.triangulate(positions2D, holes);
|
|
727
|
+
if (!defined(triangles) || triangles.length < 3) {
|
|
728
|
+
return undefined;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
return {
|
|
732
|
+
positions: positions,
|
|
733
|
+
holes: new Uint32Array(holes),
|
|
734
|
+
triangles: new Uint32Array(triangles),
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* @param {unknown} coordinates
|
|
740
|
+
* @returns {Array<GeoJsonPosition> | undefined}
|
|
741
|
+
* @ignore
|
|
742
|
+
*/
|
|
743
|
+
function normalizeRing(coordinates) {
|
|
744
|
+
if (!Array.isArray(coordinates)) {
|
|
745
|
+
return undefined;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
const ring = [];
|
|
749
|
+
for (let i = 0; i < coordinates.length; i++) {
|
|
750
|
+
const position = normalizePosition(coordinates[i]);
|
|
751
|
+
if (defined(position)) {
|
|
752
|
+
ring.push(position);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
if (ring.length < 3) {
|
|
757
|
+
return undefined;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
if (ring.length > 1 && samePosition(ring[0], ring[ring.length - 1])) {
|
|
761
|
+
// GeoJSON rings require the first and last position to be identical.
|
|
762
|
+
// BufferPolygonCollection uses LINE_LOOP topology and prohibits duplicate
|
|
763
|
+
// start/end vertices, so we remove the closing duplicate here.
|
|
764
|
+
ring.pop();
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
return ring.length >= 3 ? ring : undefined;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* @param {unknown} coordinates
|
|
772
|
+
* @returns {GeoJsonPosition | undefined}
|
|
773
|
+
* @ignore
|
|
774
|
+
*/
|
|
775
|
+
function normalizePosition(coordinates) {
|
|
776
|
+
if (!Array.isArray(coordinates) || coordinates.length < 2) {
|
|
777
|
+
return undefined;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
const longitude = coordinates[0];
|
|
781
|
+
const latitude = coordinates[1];
|
|
782
|
+
const height = coordinates[2] ?? 0.0;
|
|
783
|
+
|
|
784
|
+
if (
|
|
785
|
+
!Number.isFinite(longitude) ||
|
|
786
|
+
!Number.isFinite(latitude) ||
|
|
787
|
+
!Number.isFinite(height)
|
|
788
|
+
) {
|
|
789
|
+
return undefined;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
return [longitude, latitude, height];
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* @param {GeoJsonPosition} left
|
|
797
|
+
* @param {GeoJsonPosition} right
|
|
798
|
+
* @ignore
|
|
799
|
+
*/
|
|
800
|
+
function samePosition(left, right) {
|
|
801
|
+
return left[0] === right[0] && left[1] === right[1] && left[2] === right[2];
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* @param {string} type
|
|
806
|
+
* @returns {boolean}
|
|
807
|
+
* @ignore
|
|
808
|
+
*/
|
|
809
|
+
function isGeometryType(type) {
|
|
810
|
+
return (
|
|
811
|
+
type === "Point" ||
|
|
812
|
+
type === "MultiPoint" ||
|
|
813
|
+
type === "LineString" ||
|
|
814
|
+
type === "MultiLineString" ||
|
|
815
|
+
type === "Polygon" ||
|
|
816
|
+
type === "MultiPolygon" ||
|
|
817
|
+
type === "GeometryCollection"
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/**
|
|
822
|
+
* @param {GeoJsonPosition} position
|
|
823
|
+
* @param {Ellipsoid} ellipsoid
|
|
824
|
+
* @param {Cartesian3} result
|
|
825
|
+
* @returns {Cartesian3}
|
|
826
|
+
* @ignore
|
|
827
|
+
*/
|
|
828
|
+
function toCartesian(position, ellipsoid, result) {
|
|
829
|
+
return Cartesian3.fromDegrees(
|
|
830
|
+
position[0],
|
|
831
|
+
position[1],
|
|
832
|
+
position[2] ?? 0,
|
|
833
|
+
ellipsoid,
|
|
834
|
+
result,
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
const scratchCartesian = new Cartesian3();
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* Packs positions into a reusable scratch typed array and returns a subarray
|
|
842
|
+
* view matching the required length. Callers may reuse the underlying scratch
|
|
843
|
+
* buffer after collection.add(), since values are copied into collection memory.
|
|
844
|
+
*
|
|
845
|
+
* @param {Array<GeoJsonPosition>} positions
|
|
846
|
+
* @param {Ellipsoid} ellipsoid
|
|
847
|
+
* @param {function(number):Float64Array} getScratch
|
|
848
|
+
* @returns {Float64Array}
|
|
849
|
+
* @ignore
|
|
850
|
+
*/
|
|
851
|
+
function packPositionsToScratch(positions, ellipsoid, getScratch) {
|
|
852
|
+
const requiredLength = positions.length * 3;
|
|
853
|
+
const packed = getScratch(requiredLength);
|
|
854
|
+
|
|
855
|
+
for (let i = 0; i < positions.length; i++) {
|
|
856
|
+
const cartesian = toCartesian(positions[i], ellipsoid, scratchCartesian);
|
|
857
|
+
packed[i * 3] = cartesian.x;
|
|
858
|
+
packed[i * 3 + 1] = cartesian.y;
|
|
859
|
+
packed[i * 3 + 2] = cartesian.z;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
return packed.subarray(0, requiredLength);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* @param {unknown} value
|
|
867
|
+
* @returns {boolean}
|
|
868
|
+
* @ignore
|
|
869
|
+
*/
|
|
870
|
+
function isPlainObject(value) {
|
|
871
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
export default GeoJsonPrimitive;
|