@reearth/core 0.0.7-alpha.0 → 0.0.7-alpha.10
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/dist/core.js +34320 -34354
- package/dist/core.umd.cjs +3868 -3826
- package/dist/{index-DqatWUTw.js → index-DqGWVPtz.js} +0 -1
- package/dist/index.d.ts +217 -212
- package/package.json +8 -8
- package/src/Map/ClusteredLayers/index.tsx +2 -2
- package/src/Map/Layer/index.tsx +3 -3
- package/src/Map/Layers/hooks.ts +10 -0
- package/src/Map/Layers/index.tsx +2 -2
- package/src/Map/Sketch/hooks.ts +52 -72
- package/src/Map/Sketch/index.tsx +2 -24
- package/src/Map/Sketch/preset.ts +2 -0
- package/src/Map/Sketch/types.ts +31 -0
- package/src/Map/hooks.ts +0 -4
- package/src/Map/index.tsx +8 -5
- package/src/Map/ref.ts +4 -7
- package/src/Map/types/index.ts +34 -216
- package/src/Map/types/viewerProperty.ts +215 -0
- package/src/Map/useTimelineManager.ts +5 -3
- package/src/Map/utils.ts +1 -43
- package/src/Visualizer/coreContext.tsx +1 -8
- package/src/Visualizer/hooks.ts +20 -77
- package/src/Visualizer/index.stories.tsx +4 -48
- package/src/Visualizer/index.tsx +8 -6
- package/src/Visualizer/useCoreAPI.ts +30 -0
- package/src/engines/Cesium/Feature/Ellipse/index.stories.tsx +1 -1
- package/src/engines/Cesium/Feature/Frustum/index.stories.tsx +1 -1
- package/src/engines/Cesium/Feature/Model/index.stories.tsx +1 -1
- package/src/engines/Cesium/Feature/Model/index.tsx +10 -9
- package/src/engines/Cesium/Feature/Polygon/index.stories.tsx +8 -6
- package/src/engines/Cesium/Feature/Raster/index.stories.tsx +2 -2
- package/src/engines/Cesium/Feature/Resource/index.stories.tsx +1 -1
- package/src/engines/Cesium/Feature/Tileset/hooks.ts +12 -11
- package/src/engines/Cesium/Feature/Tileset/index.stories.tsx +1 -1
- package/src/engines/Cesium/Feature/Tileset/index.tsx +4 -4
- package/src/engines/Cesium/Feature/Tileset/useClippingBox.ts +10 -1
- package/src/engines/Cesium/Feature/index.tsx +5 -4
- package/src/engines/Cesium/Feature/utils.tsx +3 -2
- package/src/engines/Cesium/Shaders/OverriddenShaders/GlobeFS/IBL.glsl +6 -10
- package/src/engines/Cesium/core/Globe.tsx +36 -68
- package/src/engines/Cesium/core/Imagery.test.ts +9 -9
- package/src/engines/Cesium/core/Imagery.tsx +17 -19
- package/src/engines/Cesium/core/Indicator/Indicator.tsx +8 -8
- package/src/engines/Cesium/hooks/useCamera.ts +135 -0
- package/src/engines/Cesium/{cameraLimiter.ts → hooks/useCameraLimiter.ts} +22 -45
- package/src/engines/Cesium/{useEngineRef.test.tsx → hooks/useEngineRef.test.tsx} +38 -34
- package/src/engines/Cesium/{useEngineRef.ts → hooks/useEngineRef.ts} +43 -41
- package/src/engines/Cesium/hooks/useExplicitRender.ts +65 -0
- package/src/engines/Cesium/hooks/useLayerDragDrop.ts +77 -0
- package/src/engines/Cesium/{VertexTerrainElevationMaterial.ts → hooks/useOverrideGlobeShader/VertexTerrainElevationMaterial.ts} +3 -2
- package/src/engines/Cesium/{useOverrideGlobeShader.ts → hooks/useOverrideGlobeShader/useOverrideGlobeShader.ts} +20 -17
- package/src/engines/Cesium/hooks/useViewerProperty.ts +90 -0
- package/src/engines/Cesium/hooks.ts +129 -366
- package/src/engines/Cesium/index.stories.tsx +1 -1
- package/src/engines/Cesium/index.tsx +60 -62
- package/src/engines/index.ts +1 -1
- package/src/mantle/atoms/compute.ts +5 -1
- package/src/mantle/compat/types.ts +7 -7
- package/src/mantle/data/geojson.ts +53 -22
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_0.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_1.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_10.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_11.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_12.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_13.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_14.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_15.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_16.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_17.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_18.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_19.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_2.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_20.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_21.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_22.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_23.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_24.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_25.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_26.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_27.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_3.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_4.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_5.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_6.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_7.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_8.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_9.json +0 -1
- package/dist/cesium/Assets/Images/bing_maps_credit.png +0 -0
- package/dist/cesium/Assets/Images/cesium_credit.png +0 -0
- package/dist/cesium/Assets/Images/google_earth_credit.png +0 -0
- package/dist/cesium/Assets/Images/ion-credit.png +0 -0
- package/dist/cesium/Assets/Textures/LensFlare/DirtMask.jpg +0 -0
- package/dist/cesium/Assets/Textures/LensFlare/StarBurst.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/0/0/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/0/1/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/0/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/0/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/1/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/1/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/2/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/2/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/3/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/3/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml +0 -14
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_my.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_px.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_py.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg +0 -0
- package/dist/cesium/Assets/Textures/maki/airfield.png +0 -0
- package/dist/cesium/Assets/Textures/maki/airport.png +0 -0
- package/dist/cesium/Assets/Textures/maki/alcohol-shop.png +0 -0
- package/dist/cesium/Assets/Textures/maki/america-football.png +0 -0
- package/dist/cesium/Assets/Textures/maki/art-gallery.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bakery.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bank.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bar.png +0 -0
- package/dist/cesium/Assets/Textures/maki/baseball.png +0 -0
- package/dist/cesium/Assets/Textures/maki/basketball.png +0 -0
- package/dist/cesium/Assets/Textures/maki/beer.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bicycle.png +0 -0
- package/dist/cesium/Assets/Textures/maki/building.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bus.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cafe.png +0 -0
- package/dist/cesium/Assets/Textures/maki/camera.png +0 -0
- package/dist/cesium/Assets/Textures/maki/campsite.png +0 -0
- package/dist/cesium/Assets/Textures/maki/car.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cemetery.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cesium.png +0 -0
- package/dist/cesium/Assets/Textures/maki/chemist.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cinema.png +0 -0
- package/dist/cesium/Assets/Textures/maki/circle-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/circle.png +0 -0
- package/dist/cesium/Assets/Textures/maki/city.png +0 -0
- package/dist/cesium/Assets/Textures/maki/clothing-store.png +0 -0
- package/dist/cesium/Assets/Textures/maki/college.png +0 -0
- package/dist/cesium/Assets/Textures/maki/commercial.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cricket.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cross.png +0 -0
- package/dist/cesium/Assets/Textures/maki/dam.png +0 -0
- package/dist/cesium/Assets/Textures/maki/danger.png +0 -0
- package/dist/cesium/Assets/Textures/maki/disability.png +0 -0
- package/dist/cesium/Assets/Textures/maki/dog-park.png +0 -0
- package/dist/cesium/Assets/Textures/maki/embassy.png +0 -0
- package/dist/cesium/Assets/Textures/maki/emergency-telephone.png +0 -0
- package/dist/cesium/Assets/Textures/maki/entrance.png +0 -0
- package/dist/cesium/Assets/Textures/maki/farm.png +0 -0
- package/dist/cesium/Assets/Textures/maki/fast-food.png +0 -0
- package/dist/cesium/Assets/Textures/maki/ferry.png +0 -0
- package/dist/cesium/Assets/Textures/maki/fire-station.png +0 -0
- package/dist/cesium/Assets/Textures/maki/fuel.png +0 -0
- package/dist/cesium/Assets/Textures/maki/garden.png +0 -0
- package/dist/cesium/Assets/Textures/maki/gift.png +0 -0
- package/dist/cesium/Assets/Textures/maki/golf.png +0 -0
- package/dist/cesium/Assets/Textures/maki/grocery.png +0 -0
- package/dist/cesium/Assets/Textures/maki/hairdresser.png +0 -0
- package/dist/cesium/Assets/Textures/maki/harbor.png +0 -0
- package/dist/cesium/Assets/Textures/maki/heart.png +0 -0
- package/dist/cesium/Assets/Textures/maki/heliport.png +0 -0
- package/dist/cesium/Assets/Textures/maki/hospital.png +0 -0
- package/dist/cesium/Assets/Textures/maki/ice-cream.png +0 -0
- package/dist/cesium/Assets/Textures/maki/industrial.png +0 -0
- package/dist/cesium/Assets/Textures/maki/land-use.png +0 -0
- package/dist/cesium/Assets/Textures/maki/laundry.png +0 -0
- package/dist/cesium/Assets/Textures/maki/library.png +0 -0
- package/dist/cesium/Assets/Textures/maki/lighthouse.png +0 -0
- package/dist/cesium/Assets/Textures/maki/lodging.png +0 -0
- package/dist/cesium/Assets/Textures/maki/logging.png +0 -0
- package/dist/cesium/Assets/Textures/maki/london-underground.png +0 -0
- package/dist/cesium/Assets/Textures/maki/marker-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/marker.png +0 -0
- package/dist/cesium/Assets/Textures/maki/minefield.png +0 -0
- package/dist/cesium/Assets/Textures/maki/mobilephone.png +0 -0
- package/dist/cesium/Assets/Textures/maki/monument.png +0 -0
- package/dist/cesium/Assets/Textures/maki/museum.png +0 -0
- package/dist/cesium/Assets/Textures/maki/music.png +0 -0
- package/dist/cesium/Assets/Textures/maki/oil-well.png +0 -0
- package/dist/cesium/Assets/Textures/maki/park.png +0 -0
- package/dist/cesium/Assets/Textures/maki/park2.png +0 -0
- package/dist/cesium/Assets/Textures/maki/parking-garage.png +0 -0
- package/dist/cesium/Assets/Textures/maki/parking.png +0 -0
- package/dist/cesium/Assets/Textures/maki/pharmacy.png +0 -0
- package/dist/cesium/Assets/Textures/maki/pitch.png +0 -0
- package/dist/cesium/Assets/Textures/maki/place-of-worship.png +0 -0
- package/dist/cesium/Assets/Textures/maki/playground.png +0 -0
- package/dist/cesium/Assets/Textures/maki/police.png +0 -0
- package/dist/cesium/Assets/Textures/maki/polling-place.png +0 -0
- package/dist/cesium/Assets/Textures/maki/post.png +0 -0
- package/dist/cesium/Assets/Textures/maki/prison.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail-above.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail-light.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail-metro.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail-underground.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail.png +0 -0
- package/dist/cesium/Assets/Textures/maki/religious-christian.png +0 -0
- package/dist/cesium/Assets/Textures/maki/religious-jewish.png +0 -0
- package/dist/cesium/Assets/Textures/maki/religious-muslim.png +0 -0
- package/dist/cesium/Assets/Textures/maki/restaurant.png +0 -0
- package/dist/cesium/Assets/Textures/maki/roadblock.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rocket.png +0 -0
- package/dist/cesium/Assets/Textures/maki/school.png +0 -0
- package/dist/cesium/Assets/Textures/maki/scooter.png +0 -0
- package/dist/cesium/Assets/Textures/maki/shop.png +0 -0
- package/dist/cesium/Assets/Textures/maki/skiing.png +0 -0
- package/dist/cesium/Assets/Textures/maki/slaughterhouse.png +0 -0
- package/dist/cesium/Assets/Textures/maki/soccer.png +0 -0
- package/dist/cesium/Assets/Textures/maki/square-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/square.png +0 -0
- package/dist/cesium/Assets/Textures/maki/star-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/star.png +0 -0
- package/dist/cesium/Assets/Textures/maki/suitcase.png +0 -0
- package/dist/cesium/Assets/Textures/maki/swimming.png +0 -0
- package/dist/cesium/Assets/Textures/maki/telephone.png +0 -0
- package/dist/cesium/Assets/Textures/maki/tennis.png +0 -0
- package/dist/cesium/Assets/Textures/maki/theatre.png +0 -0
- package/dist/cesium/Assets/Textures/maki/toilets.png +0 -0
- package/dist/cesium/Assets/Textures/maki/town-hall.png +0 -0
- package/dist/cesium/Assets/Textures/maki/town.png +0 -0
- package/dist/cesium/Assets/Textures/maki/triangle-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/triangle.png +0 -0
- package/dist/cesium/Assets/Textures/maki/village.png +0 -0
- package/dist/cesium/Assets/Textures/maki/warehouse.png +0 -0
- package/dist/cesium/Assets/Textures/maki/waste-basket.png +0 -0
- package/dist/cesium/Assets/Textures/maki/water.png +0 -0
- package/dist/cesium/Assets/Textures/maki/wetland.png +0 -0
- package/dist/cesium/Assets/Textures/maki/zoo.png +0 -0
- package/dist/cesium/Assets/Textures/moonSmall.jpg +0 -0
- package/dist/cesium/Assets/Textures/pin.svg +0 -1
- package/dist/cesium/Assets/Textures/waterNormals.jpg +0 -0
- package/dist/cesium/Assets/Textures/waterNormalsSmall.jpg +0 -0
- package/dist/cesium/Assets/approximateTerrainHeights.json +0 -1
- package/dist/cesium/ThirdParty/Workers/package.json +0 -1
- package/dist/cesium/ThirdParty/Workers/pako_deflate.min.js +0 -1
- package/dist/cesium/ThirdParty/Workers/pako_inflate.min.js +0 -1
- package/dist/cesium/ThirdParty/Workers/z-worker-pako.js +0 -1
- package/dist/cesium/ThirdParty/basis_transcoder.wasm +0 -0
- package/dist/cesium/ThirdParty/draco_decoder.wasm +0 -0
- package/dist/cesium/ThirdParty/google-earth-dbroot-parser.js +0 -1
- package/dist/cesium/Widgets/Animation/Animation.css +0 -127
- package/dist/cesium/Widgets/Animation/lighter.css +0 -70
- package/dist/cesium/Widgets/BaseLayerPicker/BaseLayerPicker.css +0 -108
- package/dist/cesium/Widgets/BaseLayerPicker/lighter.css +0 -22
- package/dist/cesium/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.css +0 -102
- package/dist/cesium/Widgets/CesiumInspector/CesiumInspector.css +0 -113
- package/dist/cesium/Widgets/CesiumWidget/CesiumWidget.css +0 -124
- package/dist/cesium/Widgets/CesiumWidget/lighter.css +0 -14
- package/dist/cesium/Widgets/FullscreenButton/FullscreenButton.css +0 -8
- package/dist/cesium/Widgets/Geocoder/Geocoder.css +0 -70
- package/dist/cesium/Widgets/Geocoder/lighter.css +0 -17
- package/dist/cesium/Widgets/I3SBuildingSceneLayerExplorer/I3SBuildingSceneLayerExplorer.css +0 -27
- package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldImagery.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/bingAerial.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/bingAerialLabels.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/bingRoads.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/blueMarble.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/earthAtNight.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/mapQuestOpenStreetMap.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/mapboxSatellite.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/mapboxStreets.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/mapboxTerrain.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/naturalEarthII.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/openStreetMap.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/sentinel-2.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/stadiaAlidadeSmooth.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/stadiaAlidadeSmoothDark.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/stamenToner.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/stamenWatercolor.png +0 -0
- package/dist/cesium/Widgets/Images/NavigationHelp/Mouse.svg +0 -84
- package/dist/cesium/Widgets/Images/NavigationHelp/MouseLeft.svg +0 -76
- package/dist/cesium/Widgets/Images/NavigationHelp/MouseMiddle.svg +0 -76
- package/dist/cesium/Widgets/Images/NavigationHelp/MouseRight.svg +0 -76
- package/dist/cesium/Widgets/Images/NavigationHelp/Touch.svg +0 -120
- package/dist/cesium/Widgets/Images/NavigationHelp/TouchDrag.svg +0 -129
- package/dist/cesium/Widgets/Images/NavigationHelp/TouchRotate.svg +0 -76
- package/dist/cesium/Widgets/Images/NavigationHelp/TouchTilt.svg +0 -135
- package/dist/cesium/Widgets/Images/NavigationHelp/TouchZoom.svg +0 -74
- package/dist/cesium/Widgets/Images/TerrainProviders/CesiumWorldTerrain.png +0 -0
- package/dist/cesium/Widgets/Images/TerrainProviders/Ellipsoid.png +0 -0
- package/dist/cesium/Widgets/Images/TimelineIcons.png +0 -0
- package/dist/cesium/Widgets/Images/info-loading.gif +0 -0
- package/dist/cesium/Widgets/InfoBox/InfoBox.css +0 -92
- package/dist/cesium/Widgets/InfoBox/InfoBoxDescription.css +0 -178
- package/dist/cesium/Widgets/NavigationHelpButton/NavigationHelpButton.css +0 -93
- package/dist/cesium/Widgets/NavigationHelpButton/lighter.css +0 -38
- package/dist/cesium/Widgets/PerformanceWatchdog/PerformanceWatchdog.css +0 -15
- package/dist/cesium/Widgets/ProjectionPicker/ProjectionPicker.css +0 -38
- package/dist/cesium/Widgets/SceneModePicker/SceneModePicker.css +0 -56
- package/dist/cesium/Widgets/SelectionIndicator/SelectionIndicator.css +0 -20
- package/dist/cesium/Widgets/Timeline/Timeline.css +0 -103
- package/dist/cesium/Widgets/Timeline/lighter.css +0 -23
- package/dist/cesium/Widgets/VRButton/VRButton.css +0 -8
- package/dist/cesium/Widgets/Viewer/Viewer.css +0 -107
- package/dist/cesium/Widgets/VoxelInspector/VoxelInspector.css +0 -16
- package/dist/cesium/Widgets/lighter.css +0 -237
- package/dist/cesium/Widgets/lighterShared.css +0 -46
- package/dist/cesium/Widgets/shared.css +0 -103
- package/dist/cesium/Widgets/widgets.css +0 -1346
- package/dist/cesium/Workers/chunk-2ED5WI77.js +0 -26
- package/dist/cesium/Workers/chunk-2MBPFWCP.js +0 -26
- package/dist/cesium/Workers/chunk-3C74MLG3.js +0 -26
- package/dist/cesium/Workers/chunk-45U7TTT3.js +0 -26
- package/dist/cesium/Workers/chunk-4N7SRDH5.js +0 -26
- package/dist/cesium/Workers/chunk-4T6AS6BZ.js +0 -26
- package/dist/cesium/Workers/chunk-5AG2MVRM.js +0 -26
- package/dist/cesium/Workers/chunk-5Z6L2FHX.js +0 -26
- package/dist/cesium/Workers/chunk-6AUUBDOF.js +0 -26
- package/dist/cesium/Workers/chunk-74N6MC2V.js +0 -26
- package/dist/cesium/Workers/chunk-7VJK3KHI.js +0 -26
- package/dist/cesium/Workers/chunk-7VZHIB6P.js +0 -26
- package/dist/cesium/Workers/chunk-7X2YQ6I4.js +0 -27
- package/dist/cesium/Workers/chunk-B2SKQ7LU.js +0 -26
- package/dist/cesium/Workers/chunk-B4TQDFIE.js +0 -26
- package/dist/cesium/Workers/chunk-B6TRTFAA.js +0 -26
- package/dist/cesium/Workers/chunk-BK3HCS7I.js +0 -26
- package/dist/cesium/Workers/chunk-BOPB43LN.js +0 -26
- package/dist/cesium/Workers/chunk-C6DMEJQ7.js +0 -26
- package/dist/cesium/Workers/chunk-CN7UN2OZ.js +0 -26
- package/dist/cesium/Workers/chunk-CSISXEG7.js +0 -26
- package/dist/cesium/Workers/chunk-CUOR5F7T.js +0 -28
- package/dist/cesium/Workers/chunk-DGCK3LD2.js +0 -30
- package/dist/cesium/Workers/chunk-DXEZYE3K.js +0 -62
- package/dist/cesium/Workers/chunk-EXBFEYPQ.js +0 -26
- package/dist/cesium/Workers/chunk-FK5KFB6H.js +0 -26
- package/dist/cesium/Workers/chunk-HPBHKP5S.js +0 -26
- package/dist/cesium/Workers/chunk-JCJ24DHF.js +0 -26
- package/dist/cesium/Workers/chunk-JEWHFDAA.js +0 -26
- package/dist/cesium/Workers/chunk-JZLZJJQD.js +0 -26
- package/dist/cesium/Workers/chunk-KRZBI2MU.js +0 -26
- package/dist/cesium/Workers/chunk-KTTUANTJ.js +0 -26
- package/dist/cesium/Workers/chunk-LDCAXLGS.js +0 -26
- package/dist/cesium/Workers/chunk-LOPN5R3I.js +0 -26
- package/dist/cesium/Workers/chunk-MDLPQIMP.js +0 -26
- package/dist/cesium/Workers/chunk-MRR3RGFO.js +0 -26
- package/dist/cesium/Workers/chunk-NPBZI5YA.js +0 -26
- package/dist/cesium/Workers/chunk-NUSW5B6A.js +0 -26
- package/dist/cesium/Workers/chunk-OUXRUXNB.js +0 -26
- package/dist/cesium/Workers/chunk-QPOPEH3M.js +0 -26
- package/dist/cesium/Workers/chunk-R2AN7EKC.js +0 -26
- package/dist/cesium/Workers/chunk-RURL6ZX2.js +0 -26
- package/dist/cesium/Workers/chunk-SUQM3OSW.js +0 -28
- package/dist/cesium/Workers/chunk-UBIRX2SP.js +0 -26
- package/dist/cesium/Workers/chunk-VAKC5J5C.js +0 -26
- package/dist/cesium/Workers/chunk-VHNZBQTR.js +0 -27
- package/dist/cesium/Workers/chunk-VKV642QV.js +0 -26
- package/dist/cesium/Workers/chunk-VMSXG4OA.js +0 -26
- package/dist/cesium/Workers/chunk-VQZSIOZW.js +0 -26
- package/dist/cesium/Workers/chunk-WZUWQMI7.js +0 -26
- package/dist/cesium/Workers/chunk-YBI55DLZ.js +0 -26
- package/dist/cesium/Workers/chunk-YEJWCH6C.js +0 -26
- package/dist/cesium/Workers/chunk-YPDO7SPO.js +0 -26
- package/dist/cesium/Workers/chunk-ZYWD6OQH.js +0 -26
- package/dist/cesium/Workers/combineGeometry.js +0 -26
- package/dist/cesium/Workers/createBoxGeometry.js +0 -26
- package/dist/cesium/Workers/createBoxOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createCircleGeometry.js +0 -26
- package/dist/cesium/Workers/createCircleOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createCoplanarPolygonGeometry.js +0 -26
- package/dist/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createCorridorGeometry.js +0 -26
- package/dist/cesium/Workers/createCorridorOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createCylinderGeometry.js +0 -26
- package/dist/cesium/Workers/createCylinderOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createEllipseGeometry.js +0 -26
- package/dist/cesium/Workers/createEllipseOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createEllipsoidGeometry.js +0 -26
- package/dist/cesium/Workers/createEllipsoidOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createFrustumGeometry.js +0 -26
- package/dist/cesium/Workers/createFrustumOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createGeometry.js +0 -26
- package/dist/cesium/Workers/createGroundPolylineGeometry.js +0 -26
- package/dist/cesium/Workers/createPlaneGeometry.js +0 -26
- package/dist/cesium/Workers/createPlaneOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createPolygonGeometry.js +0 -26
- package/dist/cesium/Workers/createPolygonOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createPolylineGeometry.js +0 -26
- package/dist/cesium/Workers/createPolylineVolumeGeometry.js +0 -26
- package/dist/cesium/Workers/createPolylineVolumeOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createRectangleGeometry.js +0 -26
- package/dist/cesium/Workers/createRectangleOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createSimplePolylineGeometry.js +0 -26
- package/dist/cesium/Workers/createSphereGeometry.js +0 -26
- package/dist/cesium/Workers/createSphereOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createTaskProcessorWorker.js +0 -26
- package/dist/cesium/Workers/createVectorTileClampedPolylines.js +0 -26
- package/dist/cesium/Workers/createVectorTileGeometries.js +0 -26
- package/dist/cesium/Workers/createVectorTilePoints.js +0 -26
- package/dist/cesium/Workers/createVectorTilePolygons.js +0 -26
- package/dist/cesium/Workers/createVectorTilePolylines.js +0 -26
- package/dist/cesium/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -26
- package/dist/cesium/Workers/createVerticesFromHeightmap.js +0 -26
- package/dist/cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +0 -26
- package/dist/cesium/Workers/createWallGeometry.js +0 -26
- package/dist/cesium/Workers/createWallOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/decodeDraco.js +0 -26
- package/dist/cesium/Workers/decodeGoogleEarthEnterprisePacket.js +0 -26
- package/dist/cesium/Workers/decodeI3S.js +0 -26
- package/dist/cesium/Workers/transcodeKTX2.js +0 -56
- package/dist/cesium/Workers/transferTypedArrayTest.js +0 -26
- package/dist/cesium/Workers/upsampleQuantizedTerrainMesh.js +0 -26
- /package/src/engines/Cesium/{JapanSeaLevelEllipsoid.ts → hooks/useOverrideGlobeShader/JapanSeaLevelEllipsoid.ts} +0 -0
- /package/src/engines/Cesium/{vertexTerrainElevationMaterial.glsl → hooks/useOverrideGlobeShader/vertexTerrainElevationMaterial.glsl} +0 -0
|
@@ -12,7 +12,7 @@ import { useRef } from "react";
|
|
|
12
12
|
import type { CesiumComponentRef } from "resium";
|
|
13
13
|
import { vi, expect, test, afterEach } from "vitest";
|
|
14
14
|
|
|
15
|
-
import type { EngineRef, Clock } from "
|
|
15
|
+
import type { EngineRef, Clock } from "../../..";
|
|
16
16
|
|
|
17
17
|
import useEngineRef from "./useEngineRef";
|
|
18
18
|
|
|
@@ -57,86 +57,86 @@ test("bind mouse events", () => {
|
|
|
57
57
|
expect(mockMouseEventCallback).toHaveBeenCalledWith(props);
|
|
58
58
|
|
|
59
59
|
result.current.current?.onDoubleClick(mockMouseEventCallback);
|
|
60
|
-
expect(result.current.current?.mouseEventCallbacks.
|
|
60
|
+
expect(result.current.current?.mouseEventCallbacks.doubleClick[0]).toBe(mockMouseEventCallback);
|
|
61
61
|
|
|
62
|
-
result.current.current?.mouseEventCallbacks.
|
|
62
|
+
result.current.current?.mouseEventCallbacks.doubleClick[0]?.(props);
|
|
63
63
|
expect(mockMouseEventCallback).toHaveBeenCalledTimes(2);
|
|
64
64
|
expect(mockMouseEventCallback).toHaveBeenCalledWith(props);
|
|
65
65
|
|
|
66
66
|
result.current.current?.onMouseDown(mockMouseEventCallback);
|
|
67
|
-
expect(result.current.current?.mouseEventCallbacks.
|
|
67
|
+
expect(result.current.current?.mouseEventCallbacks.mouseDown[0]).toBe(mockMouseEventCallback);
|
|
68
68
|
|
|
69
|
-
result.current.current?.mouseEventCallbacks.
|
|
69
|
+
result.current.current?.mouseEventCallbacks.mouseDown[0]?.(props);
|
|
70
70
|
expect(mockMouseEventCallback).toHaveBeenCalledTimes(3);
|
|
71
71
|
expect(mockMouseEventCallback).toHaveBeenCalledWith(props);
|
|
72
72
|
|
|
73
73
|
result.current.current?.onMouseUp(mockMouseEventCallback);
|
|
74
|
-
expect(result.current.current?.mouseEventCallbacks.
|
|
74
|
+
expect(result.current.current?.mouseEventCallbacks.mouseUp[0]).toBe(mockMouseEventCallback);
|
|
75
75
|
|
|
76
|
-
result.current.current?.mouseEventCallbacks.
|
|
76
|
+
result.current.current?.mouseEventCallbacks.mouseUp[0]?.(props);
|
|
77
77
|
expect(mockMouseEventCallback).toHaveBeenCalledTimes(4);
|
|
78
78
|
expect(mockMouseEventCallback).toHaveBeenCalledWith(props);
|
|
79
79
|
|
|
80
80
|
result.current.current?.onRightClick(mockMouseEventCallback);
|
|
81
|
-
expect(result.current.current?.mouseEventCallbacks.
|
|
81
|
+
expect(result.current.current?.mouseEventCallbacks.rightClick[0]).toBe(mockMouseEventCallback);
|
|
82
82
|
|
|
83
|
-
result.current.current?.mouseEventCallbacks.
|
|
83
|
+
result.current.current?.mouseEventCallbacks.rightClick[0]?.(props);
|
|
84
84
|
expect(mockMouseEventCallback).toHaveBeenCalledTimes(5);
|
|
85
85
|
expect(mockMouseEventCallback).toHaveBeenCalledWith(props);
|
|
86
86
|
|
|
87
87
|
result.current.current?.onRightDown(mockMouseEventCallback);
|
|
88
|
-
expect(result.current.current?.mouseEventCallbacks.
|
|
88
|
+
expect(result.current.current?.mouseEventCallbacks.rightDown[0]).toBe(mockMouseEventCallback);
|
|
89
89
|
|
|
90
|
-
result.current.current?.mouseEventCallbacks.
|
|
90
|
+
result.current.current?.mouseEventCallbacks.rightDown[0]?.(props);
|
|
91
91
|
expect(mockMouseEventCallback).toHaveBeenCalledTimes(6);
|
|
92
92
|
expect(mockMouseEventCallback).toHaveBeenCalledWith(props);
|
|
93
93
|
|
|
94
94
|
result.current.current?.onRightUp(mockMouseEventCallback);
|
|
95
|
-
expect(result.current.current?.mouseEventCallbacks.
|
|
95
|
+
expect(result.current.current?.mouseEventCallbacks.rightUp[0]).toBe(mockMouseEventCallback);
|
|
96
96
|
|
|
97
|
-
result.current.current?.mouseEventCallbacks.
|
|
97
|
+
result.current.current?.mouseEventCallbacks.rightUp[0]?.(props);
|
|
98
98
|
expect(mockMouseEventCallback).toHaveBeenCalledTimes(7);
|
|
99
99
|
expect(mockMouseEventCallback).toHaveBeenCalledWith(props);
|
|
100
100
|
|
|
101
101
|
result.current.current?.onMiddleClick(mockMouseEventCallback);
|
|
102
|
-
expect(result.current.current?.mouseEventCallbacks.
|
|
102
|
+
expect(result.current.current?.mouseEventCallbacks.middleClick[0]).toBe(mockMouseEventCallback);
|
|
103
103
|
|
|
104
|
-
result.current.current?.mouseEventCallbacks.
|
|
104
|
+
result.current.current?.mouseEventCallbacks.middleClick[0]?.(props);
|
|
105
105
|
expect(mockMouseEventCallback).toHaveBeenCalledTimes(8);
|
|
106
106
|
expect(mockMouseEventCallback).toHaveBeenCalledWith(props);
|
|
107
107
|
|
|
108
108
|
result.current.current?.onMiddleDown(mockMouseEventCallback);
|
|
109
|
-
expect(result.current.current?.mouseEventCallbacks.
|
|
109
|
+
expect(result.current.current?.mouseEventCallbacks.middleDown[0]).toBe(mockMouseEventCallback);
|
|
110
110
|
|
|
111
|
-
result.current.current?.mouseEventCallbacks.
|
|
111
|
+
result.current.current?.mouseEventCallbacks.middleDown[0]?.(props);
|
|
112
112
|
expect(mockMouseEventCallback).toHaveBeenCalledTimes(9);
|
|
113
113
|
expect(mockMouseEventCallback).toHaveBeenCalledWith(props);
|
|
114
114
|
|
|
115
115
|
result.current.current?.onMiddleUp(mockMouseEventCallback);
|
|
116
|
-
expect(result.current.current?.mouseEventCallbacks.
|
|
116
|
+
expect(result.current.current?.mouseEventCallbacks.middleUp[0]).toBe(mockMouseEventCallback);
|
|
117
117
|
|
|
118
|
-
result.current.current?.mouseEventCallbacks.
|
|
118
|
+
result.current.current?.mouseEventCallbacks.middleUp[0]?.(props);
|
|
119
119
|
expect(mockMouseEventCallback).toHaveBeenCalledTimes(10);
|
|
120
120
|
expect(mockMouseEventCallback).toHaveBeenCalledWith(props);
|
|
121
121
|
|
|
122
122
|
result.current.current?.onMouseMove(mockMouseEventCallback);
|
|
123
|
-
expect(result.current.current?.mouseEventCallbacks.
|
|
123
|
+
expect(result.current.current?.mouseEventCallbacks.mouseMove[0]).toBe(mockMouseEventCallback);
|
|
124
124
|
|
|
125
|
-
result.current.current?.mouseEventCallbacks.
|
|
125
|
+
result.current.current?.mouseEventCallbacks.mouseMove[0]?.(props);
|
|
126
126
|
expect(mockMouseEventCallback).toHaveBeenCalledTimes(11);
|
|
127
127
|
expect(mockMouseEventCallback).toHaveBeenCalledWith(props);
|
|
128
128
|
|
|
129
129
|
result.current.current?.onMouseEnter(mockMouseEventCallback);
|
|
130
|
-
expect(result.current.current?.mouseEventCallbacks.
|
|
130
|
+
expect(result.current.current?.mouseEventCallbacks.mouseEnter[0]).toBe(mockMouseEventCallback);
|
|
131
131
|
|
|
132
|
-
result.current.current?.mouseEventCallbacks.
|
|
132
|
+
result.current.current?.mouseEventCallbacks.mouseEnter[0]?.(props);
|
|
133
133
|
expect(mockMouseEventCallback).toHaveBeenCalledTimes(12);
|
|
134
134
|
expect(mockMouseEventCallback).toHaveBeenCalledWith(props);
|
|
135
135
|
|
|
136
136
|
result.current.current?.onMouseLeave(mockMouseEventCallback);
|
|
137
|
-
expect(result.current.current?.mouseEventCallbacks.
|
|
137
|
+
expect(result.current.current?.mouseEventCallbacks.mouseLeave[0]).toBe(mockMouseEventCallback);
|
|
138
138
|
|
|
139
|
-
result.current.current?.mouseEventCallbacks.
|
|
139
|
+
result.current.current?.mouseEventCallbacks.mouseLeave[0]?.(props);
|
|
140
140
|
expect(mockMouseEventCallback).toHaveBeenCalledTimes(13);
|
|
141
141
|
expect(mockMouseEventCallback).toHaveBeenCalledWith(props);
|
|
142
142
|
|
|
@@ -188,10 +188,11 @@ test("zoom", async () => {
|
|
|
188
188
|
return engineRef;
|
|
189
189
|
});
|
|
190
190
|
|
|
191
|
-
const commons = await import("
|
|
191
|
+
const commons = await import("../common");
|
|
192
|
+
const zoom = vi.spyOn(commons, "zoom");
|
|
192
193
|
|
|
193
194
|
result.current.current?.zoomIn(10);
|
|
194
|
-
expect(
|
|
195
|
+
expect(zoom).toHaveBeenCalledTimes(1);
|
|
195
196
|
expect(commons.zoom).toHaveBeenCalledWith(
|
|
196
197
|
{
|
|
197
198
|
viewer,
|
|
@@ -221,6 +222,7 @@ test("call orbit when camera focuses on center", async () => {
|
|
|
221
222
|
rotateUp: vi.fn(),
|
|
222
223
|
look: vi.fn(),
|
|
223
224
|
move: vi.fn(),
|
|
225
|
+
getPickRay: vi.fn(),
|
|
224
226
|
positionCartographic: new Cartesian3(),
|
|
225
227
|
},
|
|
226
228
|
mode: SceneMode.SCENE3D,
|
|
@@ -247,15 +249,14 @@ test("call orbit when camera focuses on center", async () => {
|
|
|
247
249
|
return [engineRef, cesium] as const;
|
|
248
250
|
});
|
|
249
251
|
|
|
250
|
-
const commons = await import("
|
|
252
|
+
const commons = await import("../common");
|
|
253
|
+
const getCenterCamera = vi.spyOn(commons, "getCenterCamera");
|
|
251
254
|
|
|
252
255
|
const [engineRef, cesium] = result.current;
|
|
253
256
|
|
|
254
257
|
engineRef.current?.orbit(90);
|
|
255
|
-
expect(
|
|
256
|
-
expect(cesium.current.cesiumElement?.scene.camera.
|
|
257
|
-
expect(cesium.current.cesiumElement?.scene.camera.rotateUp).toHaveBeenCalled();
|
|
258
|
-
expect(cesium.current.cesiumElement?.scene.camera.lookAtTransform).toHaveBeenCalledTimes(2);
|
|
258
|
+
expect(getCenterCamera).toHaveBeenCalled();
|
|
259
|
+
expect(cesium.current.cesiumElement?.scene.camera.lookAtTransform).toHaveBeenCalledTimes(1);
|
|
259
260
|
});
|
|
260
261
|
|
|
261
262
|
test("call orbit when camera does not focus on center", async () => {
|
|
@@ -268,6 +269,7 @@ test("call orbit when camera does not focus on center", async () => {
|
|
|
268
269
|
rotateUp: vi.fn(),
|
|
269
270
|
look: vi.fn(),
|
|
270
271
|
move: vi.fn(),
|
|
272
|
+
getPickRay: vi.fn(),
|
|
271
273
|
positionWC: new Cartesian3(),
|
|
272
274
|
positionCartographic: new Cartesian3(),
|
|
273
275
|
},
|
|
@@ -294,12 +296,13 @@ test("call orbit when camera does not focus on center", async () => {
|
|
|
294
296
|
return [engineRef, cesium] as const;
|
|
295
297
|
});
|
|
296
298
|
|
|
297
|
-
const commons = await import("
|
|
299
|
+
const commons = await import("../common");
|
|
300
|
+
const getCenterCamera = vi.spyOn(commons, "getCenterCamera");
|
|
298
301
|
|
|
299
302
|
const [engineRef, cesium] = result.current;
|
|
300
303
|
|
|
301
304
|
engineRef.current?.orbit(90);
|
|
302
|
-
expect(
|
|
305
|
+
expect(getCenterCamera).toHaveBeenCalled();
|
|
303
306
|
expect(cesium.current.cesiumElement?.scene.camera.look).toHaveBeenCalledTimes(2);
|
|
304
307
|
expect(cesium.current.cesiumElement?.scene.camera.lookAtTransform).toHaveBeenCalledTimes(2);
|
|
305
308
|
});
|
|
@@ -314,6 +317,7 @@ test("orbit on 2D mode", async () => {
|
|
|
314
317
|
rotateUp: vi.fn(),
|
|
315
318
|
look: vi.fn(),
|
|
316
319
|
move: vi.fn(),
|
|
320
|
+
getPickRay: vi.fn(),
|
|
317
321
|
positionWC: new Cartesian3(),
|
|
318
322
|
positionCartographic: new Cartesian3(),
|
|
319
323
|
},
|
|
@@ -4,11 +4,9 @@ import { ClockStep, JulianDate, Math as CesiumMath } from "cesium";
|
|
|
4
4
|
import { useImperativeHandle, Ref, RefObject, useMemo, useRef } from "react";
|
|
5
5
|
import { CesiumComponentRef } from "resium";
|
|
6
6
|
|
|
7
|
-
import type { EngineRef, MouseEventProps, Feature, ComputedFeature } from "
|
|
8
|
-
import { MouseEventCallbacks, TickEventCallback } from "
|
|
9
|
-
import {
|
|
10
|
-
import { Position2d, Position3d } from "../../types";
|
|
11
|
-
|
|
7
|
+
import type { EngineRef, MouseEventProps, Feature, ComputedFeature } from "../..";
|
|
8
|
+
import { MouseEventCallbacks, TickEventCallback, SketchType } from "../../../Map";
|
|
9
|
+
import { Position2d, Position3d } from "../../../types";
|
|
12
10
|
import {
|
|
13
11
|
getLocationFromScreen,
|
|
14
12
|
flyTo,
|
|
@@ -34,11 +32,11 @@ import {
|
|
|
34
32
|
cartesianToLatLngHeight,
|
|
35
33
|
getExtrudedHeight,
|
|
36
34
|
getOverriddenScreenSpaceCameraOptions,
|
|
37
|
-
} from "
|
|
38
|
-
import { attachTag, getTag } from "
|
|
39
|
-
import { PickedFeature, pickManyFromViewportAsFeature } from "
|
|
40
|
-
import { createGeometry } from "
|
|
41
|
-
import { CursorType } from "
|
|
35
|
+
} from "../common";
|
|
36
|
+
import { attachTag, getTag } from "../Feature";
|
|
37
|
+
import { PickedFeature, pickManyFromViewportAsFeature } from "../pickMany";
|
|
38
|
+
import { createGeometry } from "../Sketch/createGeometry";
|
|
39
|
+
import { CursorType } from "../types";
|
|
42
40
|
import {
|
|
43
41
|
convertCesium3DTileFeatureProperties,
|
|
44
42
|
convertEntityDescription,
|
|
@@ -46,7 +44,7 @@ import {
|
|
|
46
44
|
convertObjToComputedFeature,
|
|
47
45
|
findEntity,
|
|
48
46
|
findFeaturesFromLayer,
|
|
49
|
-
} from "
|
|
47
|
+
} from "../utils/utils";
|
|
50
48
|
|
|
51
49
|
export default function useEngineRef(
|
|
52
50
|
ref: Ref<EngineRef>,
|
|
@@ -55,18 +53,18 @@ export default function useEngineRef(
|
|
|
55
53
|
const cancelCameraFlight = useRef<() => void>();
|
|
56
54
|
const mouseEventCallbacks = useRef<MouseEventCallbacks>({
|
|
57
55
|
click: [],
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
doubleClick: [],
|
|
57
|
+
mouseDown: [],
|
|
58
|
+
mouseUp: [],
|
|
59
|
+
rightClick: [],
|
|
60
|
+
rightDown: [],
|
|
61
|
+
rightUp: [],
|
|
62
|
+
middleClick: [],
|
|
63
|
+
middleDown: [],
|
|
64
|
+
middleUp: [],
|
|
65
|
+
mouseMove: [],
|
|
66
|
+
mouseEnter: [],
|
|
67
|
+
mouseLeave: [],
|
|
70
68
|
wheel: [],
|
|
71
69
|
});
|
|
72
70
|
const tickEventCallback = useRef<TickEventCallback[]>([]);
|
|
@@ -239,6 +237,8 @@ export default function useEngineRef(
|
|
|
239
237
|
setView: camera => {
|
|
240
238
|
const viewer = cesium.current?.cesiumElement;
|
|
241
239
|
if (!viewer || viewer.isDestroyed()) return false;
|
|
240
|
+
if (camera.lat === undefined || camera.lng === undefined || camera.height === undefined)
|
|
241
|
+
return false;
|
|
242
242
|
const scene = viewer.scene;
|
|
243
243
|
if (camera.lng || camera.lat || camera.height) {
|
|
244
244
|
const xyz = Cesium.Cartesian3.fromDegrees(camera.lng, camera.lat, camera.height);
|
|
@@ -539,13 +539,15 @@ export default function useEngineRef(
|
|
|
539
539
|
const oldTransform = Cesium.Matrix4.clone(camera.transform);
|
|
540
540
|
|
|
541
541
|
const center = getCenterCamera({ camera, scene });
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
542
|
+
if (center || camera.positionWC) {
|
|
543
|
+
// Get fixed frame from center to globe ellipsoid.
|
|
544
|
+
const frame = Cesium.Transforms.eastNorthUpToFixedFrame(
|
|
545
|
+
center || camera.positionWC,
|
|
546
|
+
scene.globe.ellipsoid,
|
|
547
|
+
);
|
|
547
548
|
|
|
548
|
-
|
|
549
|
+
camera.lookAtTransform(frame);
|
|
550
|
+
}
|
|
549
551
|
|
|
550
552
|
if (viewer.scene.mode !== Cesium.SceneMode.SCENE3D) {
|
|
551
553
|
camera.move(
|
|
@@ -675,40 +677,40 @@ export default function useEngineRef(
|
|
|
675
677
|
mouseEventCallbacks.current.click.push(cb);
|
|
676
678
|
},
|
|
677
679
|
onDoubleClick: (cb: (props: MouseEventProps) => void) => {
|
|
678
|
-
mouseEventCallbacks.current.
|
|
680
|
+
mouseEventCallbacks.current.doubleClick.push(cb);
|
|
679
681
|
},
|
|
680
682
|
onMouseDown: (cb: (props: MouseEventProps) => void) => {
|
|
681
|
-
mouseEventCallbacks.current.
|
|
683
|
+
mouseEventCallbacks.current.mouseDown.push(cb);
|
|
682
684
|
},
|
|
683
685
|
onMouseUp: (cb: (props: MouseEventProps) => void) => {
|
|
684
|
-
mouseEventCallbacks.current.
|
|
686
|
+
mouseEventCallbacks.current.mouseUp.push(cb);
|
|
685
687
|
},
|
|
686
688
|
onRightClick: (cb: (props: MouseEventProps) => void) => {
|
|
687
|
-
mouseEventCallbacks.current.
|
|
689
|
+
mouseEventCallbacks.current.rightClick.push(cb);
|
|
688
690
|
},
|
|
689
691
|
onRightDown: (cb: (props: MouseEventProps) => void) => {
|
|
690
|
-
mouseEventCallbacks.current.
|
|
692
|
+
mouseEventCallbacks.current.rightDown.push(cb);
|
|
691
693
|
},
|
|
692
694
|
onRightUp: (cb: (props: MouseEventProps) => void) => {
|
|
693
|
-
mouseEventCallbacks.current.
|
|
695
|
+
mouseEventCallbacks.current.rightUp.push(cb);
|
|
694
696
|
},
|
|
695
697
|
onMiddleClick: (cb: (props: MouseEventProps) => void) => {
|
|
696
|
-
mouseEventCallbacks.current.
|
|
698
|
+
mouseEventCallbacks.current.middleClick.push(cb);
|
|
697
699
|
},
|
|
698
700
|
onMiddleDown: (cb: (props: MouseEventProps) => void) => {
|
|
699
|
-
mouseEventCallbacks.current.
|
|
701
|
+
mouseEventCallbacks.current.middleDown.push(cb);
|
|
700
702
|
},
|
|
701
703
|
onMiddleUp: (cb: (props: MouseEventProps) => void) => {
|
|
702
|
-
mouseEventCallbacks.current.
|
|
704
|
+
mouseEventCallbacks.current.middleUp.push(cb);
|
|
703
705
|
},
|
|
704
706
|
onMouseMove: (cb: (props: MouseEventProps) => void) => {
|
|
705
|
-
mouseEventCallbacks.current.
|
|
707
|
+
mouseEventCallbacks.current.mouseMove.push(cb);
|
|
706
708
|
},
|
|
707
709
|
onMouseEnter: (cb: (props: MouseEventProps) => void) => {
|
|
708
|
-
mouseEventCallbacks.current.
|
|
710
|
+
mouseEventCallbacks.current.mouseEnter.push(cb);
|
|
709
711
|
},
|
|
710
712
|
onMouseLeave: (cb: (props: MouseEventProps) => void) => {
|
|
711
|
-
mouseEventCallbacks.current.
|
|
713
|
+
mouseEventCallbacks.current.mouseLeave.push(cb);
|
|
712
714
|
},
|
|
713
715
|
onWheel: (cb: (props: MouseEventProps) => void) => {
|
|
714
716
|
mouseEventCallbacks.current.wheel.push(cb);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Viewer } from "cesium";
|
|
2
|
+
import { MutableRefObject, RefObject, useCallback, useEffect, useRef } from "react";
|
|
3
|
+
import { CesiumComponentRef } from "resium";
|
|
4
|
+
|
|
5
|
+
import { RequestingRenderMode, ViewerProperty } from "../../../Map";
|
|
6
|
+
import { FORCE_REQUEST_RENDER, NO_REQUEST_RENDER, REQUEST_RENDER_ONCE } from "../../../Map/hooks";
|
|
7
|
+
|
|
8
|
+
export default ({
|
|
9
|
+
cesium,
|
|
10
|
+
requestingRenderMode,
|
|
11
|
+
isLayerDragging,
|
|
12
|
+
shouldRender,
|
|
13
|
+
property,
|
|
14
|
+
}: {
|
|
15
|
+
cesium: RefObject<CesiumComponentRef<Viewer>>;
|
|
16
|
+
requestingRenderMode?: MutableRefObject<RequestingRenderMode>;
|
|
17
|
+
isLayerDragging?: boolean;
|
|
18
|
+
shouldRender?: boolean;
|
|
19
|
+
property?: ViewerProperty;
|
|
20
|
+
}) => {
|
|
21
|
+
// explicit rendering
|
|
22
|
+
const explicitRender = useCallback(() => {
|
|
23
|
+
const viewer = cesium.current?.cesiumElement;
|
|
24
|
+
if (!requestingRenderMode?.current || !viewer || viewer.isDestroyed()) return;
|
|
25
|
+
viewer.scene.requestRender();
|
|
26
|
+
if (requestingRenderMode.current === REQUEST_RENDER_ONCE) {
|
|
27
|
+
requestingRenderMode.current = NO_REQUEST_RENDER;
|
|
28
|
+
}
|
|
29
|
+
}, [cesium, requestingRenderMode]);
|
|
30
|
+
|
|
31
|
+
const explicitRenderRef = useRef<() => void>();
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
explicitRenderRef.current = explicitRender;
|
|
35
|
+
}, [explicitRender]);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
const viewer = cesium.current?.cesiumElement;
|
|
39
|
+
if (!viewer || viewer.isDestroyed()) return;
|
|
40
|
+
return viewer.scene.postUpdate.addEventListener(() => {
|
|
41
|
+
explicitRenderRef.current?.();
|
|
42
|
+
});
|
|
43
|
+
}, [cesium]);
|
|
44
|
+
|
|
45
|
+
// render one frame when scene property changes
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (requestingRenderMode) {
|
|
48
|
+
requestingRenderMode.current = REQUEST_RENDER_ONCE;
|
|
49
|
+
}
|
|
50
|
+
}, [property, requestingRenderMode]);
|
|
51
|
+
|
|
52
|
+
// force render when timeline is animating or is shouldRender
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const viewer = cesium.current?.cesiumElement;
|
|
55
|
+
if (!viewer || viewer.isDestroyed()) return;
|
|
56
|
+
if (requestingRenderMode) {
|
|
57
|
+
requestingRenderMode.current =
|
|
58
|
+
isLayerDragging || shouldRender
|
|
59
|
+
? FORCE_REQUEST_RENDER
|
|
60
|
+
: requestingRenderMode.current === REQUEST_RENDER_ONCE
|
|
61
|
+
? REQUEST_RENDER_ONCE
|
|
62
|
+
: NO_REQUEST_RENDER;
|
|
63
|
+
}
|
|
64
|
+
}, [cesium, isLayerDragging, shouldRender, requestingRenderMode]);
|
|
65
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Cartesian3, Entity, Viewer } from "cesium";
|
|
2
|
+
import CesiumDnD, { Context } from "cesium-dnd";
|
|
3
|
+
import { RefObject, useCallback, useEffect, useRef } from "react";
|
|
4
|
+
import { CesiumComponentRef } from "resium";
|
|
5
|
+
|
|
6
|
+
import { LatLng } from "../../../utils";
|
|
7
|
+
import { isDraggable, isSelectable } from "../common";
|
|
8
|
+
import { getTag } from "../Feature";
|
|
9
|
+
import { convertCartesian3ToPosition } from "../utils/utils";
|
|
10
|
+
|
|
11
|
+
export default ({
|
|
12
|
+
cesium,
|
|
13
|
+
isLayerDraggable,
|
|
14
|
+
onLayerDrag,
|
|
15
|
+
onLayerDrop,
|
|
16
|
+
}: {
|
|
17
|
+
cesium: RefObject<CesiumComponentRef<Viewer>>;
|
|
18
|
+
isLayerDraggable?: boolean;
|
|
19
|
+
onLayerDrag?: (layerId: string, featureId: string | undefined, position: LatLng) => void;
|
|
20
|
+
onLayerDrop?: (
|
|
21
|
+
layerId: string,
|
|
22
|
+
featureId: string | undefined,
|
|
23
|
+
position: LatLng | undefined,
|
|
24
|
+
) => void;
|
|
25
|
+
}) => {
|
|
26
|
+
// enable Drag and Drop Layers
|
|
27
|
+
const handleLayerDrag = useCallback(
|
|
28
|
+
(e: Entity, position: Cartesian3 | undefined, _context: Context): boolean | void => {
|
|
29
|
+
const viewer = cesium.current?.cesiumElement;
|
|
30
|
+
if (!viewer || viewer.isDestroyed() || !isSelectable(e) || !isDraggable(e)) return false;
|
|
31
|
+
|
|
32
|
+
const pos = convertCartesian3ToPosition(cesium.current?.cesiumElement, position);
|
|
33
|
+
if (!pos) return false;
|
|
34
|
+
|
|
35
|
+
const tag = getTag(e);
|
|
36
|
+
if (!tag) return false;
|
|
37
|
+
|
|
38
|
+
onLayerDrag?.(tag.layerId || "", tag.featureId, pos);
|
|
39
|
+
},
|
|
40
|
+
[cesium, onLayerDrag],
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const handleLayerDrop = useCallback(
|
|
44
|
+
(e: Entity, position: Cartesian3 | undefined): boolean | void => {
|
|
45
|
+
const viewer = cesium.current?.cesiumElement;
|
|
46
|
+
if (!viewer || viewer.isDestroyed()) return false;
|
|
47
|
+
|
|
48
|
+
const tag = getTag(e);
|
|
49
|
+
const pos = convertCartesian3ToPosition(cesium.current?.cesiumElement, position);
|
|
50
|
+
onLayerDrop?.(tag?.layerId || "", tag?.featureId || "", pos);
|
|
51
|
+
|
|
52
|
+
return false; // let apollo-client handle optimistic updates
|
|
53
|
+
},
|
|
54
|
+
[cesium, onLayerDrop],
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const cesiumDnD = useRef<CesiumDnD>();
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
const viewer = cesium.current?.cesiumElement;
|
|
60
|
+
if (!viewer || viewer.isDestroyed()) return;
|
|
61
|
+
cesiumDnD.current = new CesiumDnD(viewer, {
|
|
62
|
+
onDrag: handleLayerDrag,
|
|
63
|
+
onDrop: handleLayerDrop,
|
|
64
|
+
dragDelay: 1000,
|
|
65
|
+
initialDisabled: !isLayerDraggable,
|
|
66
|
+
});
|
|
67
|
+
return () => {
|
|
68
|
+
if (!viewer || viewer.isDestroyed()) return;
|
|
69
|
+
cesiumDnD.current?.disable();
|
|
70
|
+
};
|
|
71
|
+
}, [cesium, isLayerDraggable, handleLayerDrag, handleLayerDrop]);
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
handleLayerDrag,
|
|
75
|
+
handleLayerDrop,
|
|
76
|
+
};
|
|
77
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Ellipsoid, Material } from "cesium";
|
|
2
2
|
|
|
3
|
-
import { createColorMapImage } from "
|
|
4
|
-
import { turboColorMap } from "
|
|
3
|
+
import { createColorMapImage } from "../../Feature/HeatMap/colorMap";
|
|
4
|
+
import { turboColorMap } from "../../Feature/HeatMap/constants";
|
|
5
|
+
|
|
5
6
|
import { JapanSeaLevelEllipsoid } from "./JapanSeaLevelEllipsoid";
|
|
6
7
|
import source from "./vertexTerrainElevationMaterial.glsl?raw";
|
|
7
8
|
|
|
@@ -8,15 +8,15 @@ import { Viewer, Globe, Material, Cartesian3 } from "cesium";
|
|
|
8
8
|
import { RefObject, useCallback, useEffect, useMemo, useRef } from "react";
|
|
9
9
|
import { CesiumComponentRef } from "resium";
|
|
10
10
|
|
|
11
|
-
import { TerrainProperty } from "
|
|
12
|
-
import { useImmutableFunction } from "
|
|
13
|
-
import { StringMatcher } from "
|
|
14
|
-
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
11
|
+
import { TerrainProperty } from "../../..";
|
|
12
|
+
import { useImmutableFunction } from "../../../../hooks/useRefFunction";
|
|
13
|
+
import { StringMatcher } from "../../../../utils/StringMatcher";
|
|
14
|
+
import { createColorMapImage } from "../../Feature/HeatMap/colorMap";
|
|
15
|
+
import GlobeFSDefinitions from "../../Shaders/OverriddenShaders/GlobeFS/Definitions.glsl?raw";
|
|
16
|
+
import HeatmapForTerrainFS from "../../Shaders/OverriddenShaders/GlobeFS/HeatmapForTerrain.glsl?raw";
|
|
17
|
+
import IBLFS from "../../Shaders/OverriddenShaders/GlobeFS/IBL.glsl?raw";
|
|
18
|
+
import { PrivateCesiumGlobe } from "../../types";
|
|
19
|
+
|
|
20
20
|
import { VertexTerrainElevationMaterial } from "./VertexTerrainElevationMaterial";
|
|
21
21
|
|
|
22
22
|
const defaultMatcher = new StringMatcher()
|
|
@@ -122,17 +122,19 @@ const useIBL = ({
|
|
|
122
122
|
|
|
123
123
|
const useTerrainHeatmap = ({
|
|
124
124
|
cesium,
|
|
125
|
-
terrain
|
|
126
|
-
heatmapType,
|
|
127
|
-
heatmapMaxHeight,
|
|
128
|
-
heatmapMinHeight,
|
|
129
|
-
heatmapLogarithmic,
|
|
130
|
-
heatmapColorLUT,
|
|
131
|
-
} = {},
|
|
125
|
+
terrain,
|
|
132
126
|
}: {
|
|
133
127
|
cesium: RefObject<CesiumComponentRef<Viewer>>;
|
|
134
128
|
terrain: TerrainProperty | undefined;
|
|
135
129
|
}) => {
|
|
130
|
+
const {
|
|
131
|
+
type: heatmapType,
|
|
132
|
+
maxHeight: heatmapMaxHeight,
|
|
133
|
+
minHeight: heatmapMinHeight,
|
|
134
|
+
logarithmic: heatmapLogarithmic,
|
|
135
|
+
colorLUT: heatmapColorLUT,
|
|
136
|
+
} = terrain?.elevationHeatMap ?? {};
|
|
137
|
+
|
|
136
138
|
const isCustomHeatmapEnabled = useMemo(() => heatmapType === "custom", [heatmapType]);
|
|
137
139
|
|
|
138
140
|
const shaderForTerrainHeatmap = useMemo(
|
|
@@ -141,7 +143,7 @@ const useTerrainHeatmap = ({
|
|
|
141
143
|
[
|
|
142
144
|
"#ifdef APPLY_COLOR_TO_ALPHA",
|
|
143
145
|
"vec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);",
|
|
144
|
-
"colorDiff.r =
|
|
146
|
+
"colorDiff.r = czm_maximumComponent(colorDiff);",
|
|
145
147
|
"alpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);",
|
|
146
148
|
"#endif",
|
|
147
149
|
],
|
|
@@ -206,6 +208,7 @@ export const useOverrideGlobeShader = ({
|
|
|
206
208
|
enableLighting,
|
|
207
209
|
});
|
|
208
210
|
|
|
211
|
+
// Terrain Heatmap is actually a built-in feature for globe, it renders as a heatmap using terrain height data.
|
|
209
212
|
const { isCustomHeatmapEnabled, shaderForTerrainHeatmap } = useTerrainHeatmap({
|
|
210
213
|
cesium,
|
|
211
214
|
terrain,
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Cartesian3, Color, DirectionalLight, SceneMode, SunLight, Viewer } from "cesium";
|
|
2
|
+
import { RefObject, useMemo } from "react";
|
|
3
|
+
import { CesiumComponentRef } from "resium";
|
|
4
|
+
|
|
5
|
+
import { ViewerProperty } from "../..";
|
|
6
|
+
|
|
7
|
+
// TODO: move all viewer property -> resium component prop logic here (from the gerneal long Cesium/hooks file)
|
|
8
|
+
export default ({
|
|
9
|
+
cesium,
|
|
10
|
+
property,
|
|
11
|
+
}: {
|
|
12
|
+
cesium: RefObject<CesiumComponentRef<Viewer>>;
|
|
13
|
+
property?: ViewerProperty;
|
|
14
|
+
}) => {
|
|
15
|
+
const sceneLight = useMemo(() => {
|
|
16
|
+
let light;
|
|
17
|
+
if (property?.scene?.light?.type === "sunLight") {
|
|
18
|
+
light = new SunLight({
|
|
19
|
+
color: property.scene?.light?.color
|
|
20
|
+
? Color.fromCssColorString(property.scene.light.color)
|
|
21
|
+
: undefined,
|
|
22
|
+
intensity: property.scene?.light?.intensity,
|
|
23
|
+
});
|
|
24
|
+
} else if (property?.scene?.light?.type === "directionalLight") {
|
|
25
|
+
light = new DirectionalLight({
|
|
26
|
+
direction: new Cartesian3(
|
|
27
|
+
property?.scene?.light?.direction?.[0] ?? 1,
|
|
28
|
+
property?.scene?.light?.direction?.[1] ?? 0,
|
|
29
|
+
property?.scene?.light?.direction?.[2] ?? 0,
|
|
30
|
+
),
|
|
31
|
+
color: property.scene?.light?.color
|
|
32
|
+
? Color.fromCssColorString(property.scene.light.color)
|
|
33
|
+
: undefined,
|
|
34
|
+
intensity: property.scene?.light?.intensity,
|
|
35
|
+
});
|
|
36
|
+
} else {
|
|
37
|
+
light = cesium.current?.cesiumElement?.scene.light;
|
|
38
|
+
if (light) {
|
|
39
|
+
light.color = property?.scene?.light?.color
|
|
40
|
+
? Color.fromCssColorString(property.scene.light.color)
|
|
41
|
+
: light.color;
|
|
42
|
+
light.intensity = property?.scene?.light?.intensity
|
|
43
|
+
? property.scene.light.intensity
|
|
44
|
+
: light.intensity;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return light;
|
|
48
|
+
}, [
|
|
49
|
+
cesium,
|
|
50
|
+
property?.scene?.light?.type,
|
|
51
|
+
property?.scene?.light?.color,
|
|
52
|
+
property?.scene?.light?.direction,
|
|
53
|
+
property?.scene?.light?.intensity,
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
const sceneBackgroundColor = useMemo(
|
|
57
|
+
() =>
|
|
58
|
+
property?.scene?.backgroundColor
|
|
59
|
+
? Color.fromCssColorString(property.scene.backgroundColor)
|
|
60
|
+
: undefined,
|
|
61
|
+
[property?.scene?.backgroundColor],
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const sceneMsaaSamples = useMemo(() => {
|
|
65
|
+
// TODO: FXAA doesn't support alpha blending in Cesium, so we will enable FXAA when this is fixed.
|
|
66
|
+
// viewer.scene.postProcessStages.fxaa.enabled = property?.render?.antialias === "high";
|
|
67
|
+
return property?.render?.antialias === "extreme"
|
|
68
|
+
? 8
|
|
69
|
+
: property?.render?.antialias === "high"
|
|
70
|
+
? 6
|
|
71
|
+
: property?.render?.antialias === "medium"
|
|
72
|
+
? 4
|
|
73
|
+
: 1;
|
|
74
|
+
}, [property?.render?.antialias]);
|
|
75
|
+
|
|
76
|
+
const sceneMode = useMemo(() => {
|
|
77
|
+
return property?.scene?.mode === "2d"
|
|
78
|
+
? SceneMode.SCENE2D
|
|
79
|
+
: property?.scene?.mode === "columbus"
|
|
80
|
+
? SceneMode.COLUMBUS_VIEW
|
|
81
|
+
: SceneMode.SCENE3D;
|
|
82
|
+
}, [property?.scene?.mode]);
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
sceneLight,
|
|
86
|
+
sceneBackgroundColor,
|
|
87
|
+
sceneMsaaSamples,
|
|
88
|
+
sceneMode,
|
|
89
|
+
};
|
|
90
|
+
};
|