@reearth/core 0.0.7-alpha.6 → 0.0.7-alpha.61
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/LICENSE +177 -0
- package/dist/core.js +70991 -60887
- package/dist/core.umd.cjs +666 -680
- package/dist/{index-DqatWUTw.js → index-CUJ6HGQn.js} +1021 -908
- package/dist/index.d.ts +157 -71
- package/package.json +88 -74
- package/src/Map/ClusteredLayers/index.tsx +1 -1
- package/src/Map/Geoid/index.tsx +68 -0
- package/src/Map/Geoid/types.ts +8 -0
- package/src/Map/Layer/hooks.ts +7 -4
- package/src/Map/Layer/index.tsx +3 -1
- package/src/Map/Layers/hooks.ts +35 -8
- package/src/Map/Layers/index.tsx +13 -2
- package/src/Map/Layers/keys.ts +1 -0
- package/src/Map/Sketch/hooks.ts +454 -411
- package/src/Map/Sketch/index.tsx +68 -21
- package/src/Map/Sketch/sketchMachine.ts +427 -102
- package/src/Map/Sketch/sketchMachine.typegen.ts +58 -1
- package/src/Map/Sketch/types.ts +10 -20
- package/src/Map/Sketch/usePluginSketchLayer.ts +105 -0
- package/src/Map/Sketch/useSketch.ts +558 -0
- package/src/Map/Sketch/useSketchFeature.ts +198 -0
- package/src/Map/SpatialId/constants.ts +21 -0
- package/src/Map/SpatialId/hooks.ts +448 -0
- package/src/Map/SpatialId/index.tsx +63 -0
- package/src/Map/SpatialId/types.ts +68 -0
- package/src/Map/SpatialId/utils.ts +65 -0
- package/src/Map/hooks.ts +54 -8
- package/src/Map/index.tsx +42 -9
- package/src/Map/ref.ts +32 -3
- package/src/Map/types/index.ts +39 -3
- package/src/Map/types/viewerProperty.ts +10 -0
- package/src/Map/useTimelineManager.ts +4 -10
- package/src/Map/utils.ts +1 -1
- package/src/Visualizer/Error.tsx +4 -1
- package/src/Visualizer/context.tsx +5 -5
- package/src/Visualizer/coreContext.tsx +3 -1
- package/src/Visualizer/hooks.ts +56 -22
- package/src/Visualizer/index.stories.tsx +15 -0
- package/src/Visualizer/index.tsx +25 -6
- package/src/Visualizer/useViewport.ts +1 -1
- package/src/engines/Cesium/Feature/Box/hooks/box.ts +4 -4
- package/src/engines/Cesium/Feature/Box/hooks/edge.ts +1 -1
- package/src/engines/Cesium/Feature/Box/hooks/side.ts +1 -1
- package/src/engines/Cesium/Feature/Box/utils.ts +6 -0
- package/src/engines/Cesium/Feature/Ellipse/index.stories.tsx +0 -1
- package/src/engines/Cesium/Feature/Frustum/getFieldOfView.ts +2 -0
- package/src/engines/Cesium/Feature/Frustum/index.stories.tsx +0 -1
- package/src/engines/Cesium/Feature/HeatMap/HeatmapMesh.tsx +1 -1
- package/src/engines/Cesium/Feature/Marker/index.tsx +1 -1
- package/src/engines/Cesium/Feature/Model/index.stories.tsx +1 -2
- package/src/engines/Cesium/Feature/Model/index.tsx +3 -3
- package/src/engines/Cesium/Feature/PhotoOverlay/hooks.ts +2 -2
- package/src/engines/Cesium/Feature/PhotoOverlay/index.tsx +3 -1
- package/src/engines/Cesium/Feature/Polygon/index.stories.tsx +0 -1
- package/src/engines/Cesium/Feature/Polygon/index.tsx +6 -4
- package/src/engines/Cesium/Feature/Raster/index.stories.tsx +0 -1
- package/src/engines/Cesium/Feature/Raster/mvt.ts +2 -1
- package/src/engines/Cesium/Feature/Resource/index.stories.tsx +0 -1
- package/src/engines/Cesium/Feature/Resource/index.tsx +1 -27
- package/src/engines/Cesium/Feature/Resource/utils.ts +86 -91
- package/src/engines/Cesium/Feature/Tileset/hooks.ts +136 -71
- package/src/engines/Cesium/Feature/Tileset/index.stories.tsx +0 -1
- package/src/engines/Cesium/Feature/Tileset/index.tsx +1 -1
- package/src/engines/Cesium/Feature/Tileset/useClippingBox.ts +2 -2
- package/src/engines/Cesium/Feature/Tileset/useDrawClipping.ts +2 -2
- package/src/engines/Cesium/Feature/context.ts +1 -0
- package/src/engines/Cesium/Feature/index.tsx +9 -5
- package/src/engines/Cesium/Feature/utils.tsx +20 -12
- package/src/engines/Cesium/PostProcesses/hbao/AmbientOcclusion.tsx +7 -4
- package/src/engines/Cesium/Sketch/ControlPoint.tsx +128 -24
- package/src/engines/Cesium/Sketch/ExtrudedControlPoints.tsx +70 -25
- package/src/engines/Cesium/Sketch/ExtrudedMeasurement.tsx +3 -1
- package/src/engines/Cesium/Sketch/ExtrudedPolygonEntity.tsx +14 -14
- package/src/engines/Cesium/Sketch/PolylineEntity.tsx +7 -4
- package/src/engines/Cesium/Sketch/SurfaceAddingPoints.tsx +60 -0
- package/src/engines/Cesium/Sketch/SurfaceControlPoints.tsx +126 -35
- package/src/engines/Cesium/Sketch/constants.ts +5 -0
- package/src/engines/Cesium/Sketch/index.tsx +68 -29
- package/src/engines/Cesium/SpatialId/CoordinateIndicator.tsx +28 -0
- package/src/engines/Cesium/SpatialId/SpatialIdSpace.tsx +33 -0
- package/src/engines/Cesium/SpatialId/VerticalSpaceIndicator.tsx +32 -0
- package/src/engines/Cesium/SpatialId/index.ts +3 -0
- package/src/engines/Cesium/common.ts +55 -18
- package/src/engines/Cesium/core/Clock.tsx +1 -1
- package/src/engines/Cesium/core/Globe/index.tsx +73 -0
- package/src/engines/Cesium/core/Globe/useTerrainProviderPromise.ts +79 -0
- package/src/engines/Cesium/core/Imagery.test.ts +29 -11
- package/src/engines/Cesium/core/Imagery.tsx +22 -6
- package/src/engines/Cesium/core/Indicator/Indicator.tsx +2 -2
- package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/JapanGSIOptimalBVmapLabelImagery.tsx +13 -6
- package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/JapanGSIOptimalBVmapLabelImageryLayer.tsx +2 -1
- package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/JapanGSIOptimalBVmapLabelImageryProvider.ts +3 -4
- package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/JapanGSIOptimalBVmapVectorMapLabel.tsx +14 -2
- package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/helpers.ts +1 -1
- package/src/engines/Cesium/core/labels/LabelImageryLayers.tsx +10 -1
- package/src/engines/Cesium/core/presets.ts +24 -28
- package/src/engines/Cesium/helpers/getGeometryFromEntity.ts +55 -0
- package/src/engines/Cesium/hooks/useCamera.ts +2 -2
- package/src/engines/Cesium/hooks/useCameraLimiter.ts +1 -1
- package/src/engines/Cesium/hooks/useEngineRef.ts +52 -5
- package/src/engines/Cesium/hooks/useExplicitRender.ts +2 -2
- package/src/engines/Cesium/hooks/useInstance.ts +1 -1
- package/src/engines/Cesium/hooks/useLayerDragDrop.ts +3 -3
- package/src/engines/Cesium/hooks/useLayerSelectWithRect.ts +2 -2
- package/src/engines/Cesium/hooks/useOverrideGlobeShader/useOverrideGlobeShader.ts +115 -67
- package/src/engines/Cesium/hooks/useViewerProperty.ts +1 -1
- package/src/engines/Cesium/hooks.ts +55 -14
- package/src/engines/Cesium/index.stories.tsx +0 -1
- package/src/engines/Cesium/index.tsx +20 -6
- package/src/engines/Cesium/pickMany.ts +2 -0
- package/src/engines/Cesium/types.ts +1 -1
- package/src/engines/Cesium/utils/mouse.ts +1 -1
- package/src/engines/Cesium/utils/utils.ts +1 -1
- package/src/mantle/atoms/compute.test.ts +4 -4
- package/src/mantle/atoms/compute.ts +8 -4
- package/src/mantle/compat/forward.ts +1 -1
- package/src/mantle/data/geojson.ts +53 -22
- package/src/mantle/data/georss.ts +2 -2
- package/src/mantle/data/gml.ts +2 -2
- package/src/mantle/data/gpx.ts +2 -2
- package/src/mantle/data/shapefile/parseZip.ts +1 -0
- package/src/mantle/evaluator/simple/expression/README.md +392 -0
- package/src/mantle/evaluator/simple/expression/expression.test.ts +137 -0
- package/src/mantle/evaluator/simple/expression/node.ts +10 -12
- package/src/mantle/evaluator/simple/expression/variableReplacer.test.ts +178 -0
- package/src/mantle/evaluator/simple/expression/variableReplacer.ts +24 -11
- package/src/mantle/types/appearance.ts +4 -2
- package/src/mantle/types/index.ts +3 -0
- package/src/{Visualizer → shared}/interactionMode.ts +3 -2
- package/src/test/setup.ts +1 -1
- package/src/test/utils.tsx +1 -1
- package/src/types/modules.d.ts +96 -0
- package/src/utils/StringMatcher.ts +1 -1
- package/src/utils/image.ts +2 -12
- package/src/utils/use-delayed-count.ts +1 -1
- package/src/utils/use-dnd/drop.ts +1 -1
- package/src/utils/util.ts +1 -1
- package/src/utils/value.ts +2 -2
- 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-2YD5QWGR.js +0 -28
- package/dist/cesium/Workers/chunk-3T4KR75X.js +0 -26
- package/dist/cesium/Workers/chunk-46KFVW24.js +0 -26
- package/dist/cesium/Workers/chunk-4EI6PP43.js +0 -28
- package/dist/cesium/Workers/chunk-4RS52VIY.js +0 -26
- package/dist/cesium/Workers/chunk-4YLYA3DC.js +0 -26
- package/dist/cesium/Workers/chunk-5ENAGXBI.js +0 -26
- package/dist/cesium/Workers/chunk-5VIB3TI5.js +0 -26
- package/dist/cesium/Workers/chunk-6NGZLDFZ.js +0 -26
- package/dist/cesium/Workers/chunk-6RGNWVZ2.js +0 -27
- package/dist/cesium/Workers/chunk-7AZZVJ52.js +0 -26
- package/dist/cesium/Workers/chunk-AMXAQQEL.js +0 -26
- package/dist/cesium/Workers/chunk-AQW44ZPC.js +0 -26
- package/dist/cesium/Workers/chunk-CPCMDW6Z.js +0 -26
- package/dist/cesium/Workers/chunk-DNL2WDRL.js +0 -26
- package/dist/cesium/Workers/chunk-ERW7V247.js +0 -26
- package/dist/cesium/Workers/chunk-EYRIA4TP.js +0 -26
- package/dist/cesium/Workers/chunk-F7RQIJML.js +0 -26
- package/dist/cesium/Workers/chunk-FPZMU6QP.js +0 -26
- package/dist/cesium/Workers/chunk-FZDVQW7A.js +0 -26
- package/dist/cesium/Workers/chunk-GAZ2U4FO.js +0 -26
- package/dist/cesium/Workers/chunk-I44IOOT4.js +0 -26
- package/dist/cesium/Workers/chunk-IALXUAD4.js +0 -26
- package/dist/cesium/Workers/chunk-IXBUEUZL.js +0 -26
- package/dist/cesium/Workers/chunk-J3GCYV5K.js +0 -26
- package/dist/cesium/Workers/chunk-KGSZTFHZ.js +0 -26
- package/dist/cesium/Workers/chunk-KKKPU2CI.js +0 -26
- package/dist/cesium/Workers/chunk-KTEJE5KE.js +0 -26
- package/dist/cesium/Workers/chunk-KYZ3DYY6.js +0 -26
- package/dist/cesium/Workers/chunk-L2QG4MRI.js +0 -26
- package/dist/cesium/Workers/chunk-MCE3KFYN.js +0 -26
- package/dist/cesium/Workers/chunk-MMLDGXML.js +0 -26
- package/dist/cesium/Workers/chunk-MTBRPBDQ.js +0 -26
- package/dist/cesium/Workers/chunk-OKT6VBRK.js +0 -26
- package/dist/cesium/Workers/chunk-PHYDKLSY.js +0 -26
- package/dist/cesium/Workers/chunk-PWPX3224.js +0 -26
- package/dist/cesium/Workers/chunk-QHOVE6WG.js +0 -26
- package/dist/cesium/Workers/chunk-QJ6MBL22.js +0 -26
- package/dist/cesium/Workers/chunk-QKO6VIG2.js +0 -26
- package/dist/cesium/Workers/chunk-QVEE4QL2.js +0 -26
- package/dist/cesium/Workers/chunk-RXQOQZ7S.js +0 -26
- package/dist/cesium/Workers/chunk-S3ZKQKMM.js +0 -26
- package/dist/cesium/Workers/chunk-SFEUMZSK.js +0 -26
- package/dist/cesium/Workers/chunk-T75MW4X3.js +0 -26
- package/dist/cesium/Workers/chunk-TVO2A75R.js +0 -66
- package/dist/cesium/Workers/chunk-UHR36K45.js +0 -27
- package/dist/cesium/Workers/chunk-UKJCDZOR.js +0 -26
- package/dist/cesium/Workers/chunk-VKVIYER6.js +0 -26
- package/dist/cesium/Workers/chunk-VPIQWTRZ.js +0 -26
- package/dist/cesium/Workers/chunk-XSX5HRFC.js +0 -26
- package/dist/cesium/Workers/chunk-Z5WQQHSL.js +0 -26
- package/dist/cesium/Workers/chunk-Z7B2VEL5.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/core/Globe.tsx +0 -104
- /package/src/{Visualizer → shared}/featureFlags.ts +0 -0
- /package/src/{Map/Sketch/utils.ts → utils/use-window-event.ts} +0 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef, type JSX } from "react";
|
|
2
|
+
import { Globe as CesiumGlobe } from "resium";
|
|
3
|
+
|
|
4
|
+
import type { ViewerProperty } from "../../..";
|
|
5
|
+
import { toColor } from "../../common";
|
|
6
|
+
|
|
7
|
+
import useTerrainProviderPromise from "./useTerrainProviderPromise";
|
|
8
|
+
|
|
9
|
+
export type Props = {
|
|
10
|
+
property?: ViewerProperty;
|
|
11
|
+
cesiumIonAccessToken?: string;
|
|
12
|
+
onTerrainProviderChange?: () => void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default function Globe({
|
|
16
|
+
property,
|
|
17
|
+
cesiumIonAccessToken,
|
|
18
|
+
onTerrainProviderChange,
|
|
19
|
+
}: Props): JSX.Element | null {
|
|
20
|
+
const providerPromise = useTerrainProviderPromise({
|
|
21
|
+
terrain: property?.terrain?.enabled,
|
|
22
|
+
terrainType: property?.terrain?.type,
|
|
23
|
+
normal: property?.terrain?.normal,
|
|
24
|
+
ionAccessToken: property?.assets?.cesium?.terrain?.ionAccessToken || cesiumIonAccessToken,
|
|
25
|
+
ionAsset: property?.assets?.cesium?.terrain?.ionAsset,
|
|
26
|
+
ionUrl: property?.assets?.cesium?.terrain?.ionUrl,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const baseColor = useMemo(
|
|
30
|
+
() => toColor(property?.globe?.baseColor),
|
|
31
|
+
[property?.globe?.baseColor],
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const lastResolvedProviderRef = useRef<any>(null);
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
let isCancelled = false;
|
|
38
|
+
|
|
39
|
+
providerPromise
|
|
40
|
+
.then(resolvedProvider => {
|
|
41
|
+
if (isCancelled) return;
|
|
42
|
+
|
|
43
|
+
// Only trigger callback if the resolved provider is actually different
|
|
44
|
+
if (lastResolvedProviderRef.current !== resolvedProvider) {
|
|
45
|
+
lastResolvedProviderRef.current = resolvedProvider;
|
|
46
|
+
onTerrainProviderChange?.();
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
.catch(error => {
|
|
50
|
+
if (!isCancelled) {
|
|
51
|
+
console.warn("Terrain provider failed to load:", error);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return () => {
|
|
56
|
+
isCancelled = true;
|
|
57
|
+
};
|
|
58
|
+
}, [providerPromise, onTerrainProviderChange]);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<CesiumGlobe
|
|
62
|
+
baseColor={baseColor}
|
|
63
|
+
enableLighting={!!property?.globe?.enableLighting}
|
|
64
|
+
showGroundAtmosphere={property?.globe?.atmosphere?.enabled ?? true}
|
|
65
|
+
atmosphereLightIntensity={property?.globe?.atmosphere?.lightIntensity}
|
|
66
|
+
atmosphereSaturationShift={property?.globe?.atmosphere?.saturationShift}
|
|
67
|
+
atmosphereHueShift={property?.globe?.atmosphere?.hueShift}
|
|
68
|
+
atmosphereBrightnessShift={property?.globe?.atmosphere?.brightnessShift}
|
|
69
|
+
terrainProvider={providerPromise}
|
|
70
|
+
depthTestAgainstTerrain={!!property?.globe?.depthTestAgainstTerrain}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ArcGISTiledElevationTerrainProvider,
|
|
3
|
+
CesiumTerrainProvider,
|
|
4
|
+
EllipsoidTerrainProvider,
|
|
5
|
+
IonResource,
|
|
6
|
+
TerrainProvider,
|
|
7
|
+
} from "cesium";
|
|
8
|
+
import { useMemo, useRef } from "react";
|
|
9
|
+
|
|
10
|
+
import { TerrainProperty } from "../../..";
|
|
11
|
+
import { AssetsCesiumProperty } from "../../../../Map";
|
|
12
|
+
|
|
13
|
+
type TerrainType = NonNullable<TerrainProperty["type"]>;
|
|
14
|
+
|
|
15
|
+
type ProviderOpts = Pick<TerrainProperty, "normal"> &
|
|
16
|
+
AssetsCesiumProperty["terrain"] & {
|
|
17
|
+
terrain?: boolean;
|
|
18
|
+
terrainType?: TerrainType | null | undefined;
|
|
19
|
+
ionAccessToken?: string | undefined;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default function useTerrainProviderPromise(opts: ProviderOpts) {
|
|
23
|
+
// Cache promises so we don’t recreate providers on every toggle
|
|
24
|
+
const cacheRef = useRef(new Map<string, Promise<TerrainProvider>>());
|
|
25
|
+
const ellipsoidRef = useRef<TerrainProvider>(undefined);
|
|
26
|
+
|
|
27
|
+
return useMemo<Promise<TerrainProvider>>(() => {
|
|
28
|
+
if (!opts.terrain) {
|
|
29
|
+
// single shared ellipsoid provider
|
|
30
|
+
if (!ellipsoidRef.current) ellipsoidRef.current = new EllipsoidTerrainProvider();
|
|
31
|
+
return Promise.resolve(ellipsoidRef.current);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const kind = (opts.terrainType ?? "cesium") as TerrainType;
|
|
35
|
+
const key = makeKey(kind, opts);
|
|
36
|
+
let p = cacheRef.current.get(key);
|
|
37
|
+
if (!p) {
|
|
38
|
+
p = createProvider(kind, opts);
|
|
39
|
+
cacheRef.current.set(key, p);
|
|
40
|
+
}
|
|
41
|
+
return p;
|
|
42
|
+
}, [opts]);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function makeKey(type: TerrainType, opts: ProviderOpts) {
|
|
46
|
+
// Key should change when output provider would differ
|
|
47
|
+
const asset = opts.ionAsset ?? "";
|
|
48
|
+
const url = opts.ionUrl ?? "";
|
|
49
|
+
const normal = String(!!opts.normal);
|
|
50
|
+
return `${type}|asset:${asset}|url:${url}|normal:${normal}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function createProvider(type: TerrainType, opts: ProviderOpts): Promise<TerrainProvider> {
|
|
54
|
+
switch (type) {
|
|
55
|
+
case "cesium":
|
|
56
|
+
return CesiumTerrainProvider.fromUrl(
|
|
57
|
+
IonResource.fromAssetId(1, { accessToken: opts.ionAccessToken }),
|
|
58
|
+
{ requestVertexNormals: !!opts.normal, requestWaterMask: false },
|
|
59
|
+
) as Promise<TerrainProvider>;
|
|
60
|
+
|
|
61
|
+
case "arcgis":
|
|
62
|
+
return ArcGISTiledElevationTerrainProvider.fromUrl(
|
|
63
|
+
"https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer",
|
|
64
|
+
) as Promise<TerrainProvider>;
|
|
65
|
+
|
|
66
|
+
case "cesiumion":
|
|
67
|
+
if (!opts.ionAsset && !opts.ionUrl) {
|
|
68
|
+
// Fallback to ellipsoid when misconfigured
|
|
69
|
+
return Promise.resolve(new EllipsoidTerrainProvider());
|
|
70
|
+
}
|
|
71
|
+
return CesiumTerrainProvider.fromUrl(
|
|
72
|
+
opts.ionUrl ??
|
|
73
|
+
IonResource.fromAssetId(parseInt(String(opts.ionAsset), 10), {
|
|
74
|
+
accessToken: opts.ionAccessToken,
|
|
75
|
+
}),
|
|
76
|
+
{ requestVertexNormals: !!opts.normal },
|
|
77
|
+
) as Promise<TerrainProvider>;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -6,7 +6,7 @@ import { type Tile, useImageryProviders } from "./Imagery";
|
|
|
6
6
|
test("useImageryProviders", () => {
|
|
7
7
|
const provider = vi.fn(({ url }: { url?: string } = {}): any => ({ hoge: url }));
|
|
8
8
|
const provider2 = vi.fn(({ url }: { url?: string } = {}): any => ({ hoge2: url }));
|
|
9
|
-
const presets = { default: provider,
|
|
9
|
+
const presets = { default: provider, default_label: provider2 };
|
|
10
10
|
const { result, rerender } = renderHook(
|
|
11
11
|
({ tiles, cesiumIonAccessToken }: { tiles: Tile[]; cesiumIonAccessToken?: string }) =>
|
|
12
12
|
useImageryProviders({
|
|
@@ -14,23 +14,28 @@ test("useImageryProviders", () => {
|
|
|
14
14
|
presets,
|
|
15
15
|
cesiumIonAccessToken,
|
|
16
16
|
}),
|
|
17
|
-
{ initialProps: { tiles: [{ id: "1", type: "default" }] } },
|
|
17
|
+
{ initialProps: { tiles: [{ id: "1", type: "default" }], cesiumIonAccessToken: undefined } },
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
+
const typedRerender = rerender as (props: {
|
|
21
|
+
tiles: Tile[];
|
|
22
|
+
cesiumIonAccessToken?: string;
|
|
23
|
+
}) => void;
|
|
24
|
+
|
|
20
25
|
expect(result.current.providers).toEqual({ "1": ["default", undefined, { hoge: undefined }] });
|
|
21
26
|
expect(result.current.updated).toBe(true);
|
|
22
27
|
expect(provider).toBeCalledTimes(1);
|
|
23
28
|
const prevImageryProvider = result.current.providers["1"][2];
|
|
24
29
|
|
|
25
30
|
// re-render with same tiles
|
|
26
|
-
|
|
31
|
+
typedRerender({ tiles: [{ id: "1", type: "default" }] });
|
|
27
32
|
|
|
28
33
|
expect(result.current.providers).toEqual({ "1": ["default", undefined, { hoge: undefined }] });
|
|
29
34
|
expect(result.current.providers["1"][2]).toBe(prevImageryProvider); // 1's provider should be reused
|
|
30
35
|
expect(provider).toBeCalledTimes(1);
|
|
31
36
|
|
|
32
37
|
// update a tile URL
|
|
33
|
-
|
|
38
|
+
typedRerender({ tiles: [{ id: "1", type: "default", url: "a" }] });
|
|
34
39
|
|
|
35
40
|
expect(result.current.providers).toEqual({ "1": ["default", "a", { hoge: "a" }] });
|
|
36
41
|
expect(result.current.providers["1"][2]).not.toBe(prevImageryProvider);
|
|
@@ -40,7 +45,7 @@ test("useImageryProviders", () => {
|
|
|
40
45
|
const prevImageryProvider2 = result.current.providers["1"][2];
|
|
41
46
|
|
|
42
47
|
// add a tile with URL
|
|
43
|
-
|
|
48
|
+
typedRerender({
|
|
44
49
|
tiles: [
|
|
45
50
|
{ id: "2", type: "default" },
|
|
46
51
|
{ id: "1", type: "default", url: "a" },
|
|
@@ -56,7 +61,7 @@ test("useImageryProviders", () => {
|
|
|
56
61
|
expect(provider).toBeCalledTimes(3);
|
|
57
62
|
|
|
58
63
|
// sort tiles
|
|
59
|
-
|
|
64
|
+
typedRerender({
|
|
60
65
|
tiles: [
|
|
61
66
|
{ id: "1", type: "default", url: "a" },
|
|
62
67
|
{ id: "2", type: "default" },
|
|
@@ -72,7 +77,7 @@ test("useImageryProviders", () => {
|
|
|
72
77
|
expect(provider).toBeCalledTimes(3);
|
|
73
78
|
|
|
74
79
|
// delete a tile
|
|
75
|
-
|
|
80
|
+
typedRerender({
|
|
76
81
|
tiles: [{ id: "1", type: "default", url: "a" }],
|
|
77
82
|
cesiumIonAccessToken: "a",
|
|
78
83
|
});
|
|
@@ -85,18 +90,31 @@ test("useImageryProviders", () => {
|
|
|
85
90
|
expect(provider).toBeCalledTimes(4);
|
|
86
91
|
|
|
87
92
|
// update a tile type
|
|
88
|
-
|
|
89
|
-
tiles: [{ id: "1", type: "
|
|
93
|
+
typedRerender({
|
|
94
|
+
tiles: [{ id: "1", type: "default_label", url: "u" }],
|
|
90
95
|
cesiumIonAccessToken: "a",
|
|
91
96
|
});
|
|
92
97
|
|
|
93
98
|
expect(result.current.providers).toEqual({
|
|
94
|
-
"1": ["
|
|
99
|
+
"1": ["default_label", "u", { hoge2: "u" }],
|
|
95
100
|
});
|
|
96
101
|
expect(result.current.updated).toBe(true);
|
|
97
102
|
expect(provider).toBeCalledTimes(4);
|
|
98
103
|
expect(provider2).toBeCalledTimes(1);
|
|
99
104
|
|
|
100
|
-
|
|
105
|
+
// update a tile type to unexpected type
|
|
106
|
+
typedRerender({
|
|
107
|
+
tiles: [{ id: "1", type: "unexpected_type", url: "u" }],
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
expect(result.current.providers).toEqual({
|
|
111
|
+
// unexpected type is treated as "default"
|
|
112
|
+
"1": ["unexpected_type", "u", { hoge: "u" }],
|
|
113
|
+
});
|
|
114
|
+
expect(result.current.updated).toBe(true);
|
|
115
|
+
expect(provider).toBeCalledTimes(5);
|
|
116
|
+
expect(provider2).toBeCalledTimes(1);
|
|
117
|
+
|
|
118
|
+
typedRerender({ tiles: [] });
|
|
101
119
|
expect(result.current.providers).toEqual({});
|
|
102
120
|
});
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
TextureMinificationFilter,
|
|
6
6
|
} from "cesium";
|
|
7
7
|
import { isEqual } from "lodash-es";
|
|
8
|
-
import { useCallback, useMemo, useRef, useLayoutEffect, useState } from "react";
|
|
8
|
+
import { useCallback, useMemo, useRef, useLayoutEffect, useState, useEffect } from "react";
|
|
9
9
|
import { ImageryLayer } from "resium";
|
|
10
10
|
|
|
11
|
-
import { tiles as tilePresets } from "./presets";
|
|
11
|
+
import { isValidPresetTileType, PresetTileType, tiles as tilePresets } from "./presets";
|
|
12
12
|
|
|
13
13
|
export type ImageryLayerData = {
|
|
14
14
|
id: string;
|
|
@@ -31,9 +31,10 @@ export type Tile = {
|
|
|
31
31
|
export type Props = {
|
|
32
32
|
tiles?: Tile[];
|
|
33
33
|
cesiumIonAccessToken?: string;
|
|
34
|
+
onTilesChange?: () => void;
|
|
34
35
|
};
|
|
35
36
|
|
|
36
|
-
export default function ImageryLayers({ tiles, cesiumIonAccessToken }: Props) {
|
|
37
|
+
export default function ImageryLayers({ tiles, cesiumIonAccessToken, onTilesChange }: Props) {
|
|
37
38
|
const { providers, updated } = useImageryProviders({
|
|
38
39
|
tiles,
|
|
39
40
|
cesiumIonAccessToken,
|
|
@@ -47,6 +48,10 @@ export default function ImageryLayers({ tiles, cesiumIonAccessToken }: Props) {
|
|
|
47
48
|
if (updated) setCounter(c => c + 1);
|
|
48
49
|
}, [providers, updated]);
|
|
49
50
|
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
onTilesChange?.();
|
|
53
|
+
}, [tiles, counter, onTilesChange]);
|
|
54
|
+
|
|
50
55
|
return (
|
|
51
56
|
<>
|
|
52
57
|
{tiles
|
|
@@ -85,7 +90,7 @@ export function useImageryProviders({
|
|
|
85
90
|
tiles?: Tile[];
|
|
86
91
|
cesiumIonAccessToken?: string;
|
|
87
92
|
presets: {
|
|
88
|
-
[
|
|
93
|
+
[K in PresetTileType]: (opts?: {
|
|
89
94
|
url?: string;
|
|
90
95
|
cesiumIonAccessToken?: string;
|
|
91
96
|
heatmap?: boolean;
|
|
@@ -95,7 +100,7 @@ export function useImageryProviders({
|
|
|
95
100
|
}): { providers: Providers; updated: boolean } {
|
|
96
101
|
const newTile = useCallback(
|
|
97
102
|
(t: Tile, ciat?: string) =>
|
|
98
|
-
presets[t.type
|
|
103
|
+
presets[isValidPresetTileType(t.type) ? t.type : "default"]({
|
|
99
104
|
url: t.url,
|
|
100
105
|
cesiumIonAccessToken: ciat,
|
|
101
106
|
heatmap: t.heatmap,
|
|
@@ -108,6 +113,15 @@ export function useImageryProviders({
|
|
|
108
113
|
const tileKeys = tiles.map(t => t.id).join(",");
|
|
109
114
|
const prevTileKeys = useRef(tileKeys);
|
|
110
115
|
const prevProviders = useRef<Providers>({});
|
|
116
|
+
const zoomLevels = useMemo(
|
|
117
|
+
() =>
|
|
118
|
+
tiles.map(t => {
|
|
119
|
+
if (t.id && t.zoomLevel) return { [t.id]: t.zoomLevel };
|
|
120
|
+
return;
|
|
121
|
+
}),
|
|
122
|
+
[tiles],
|
|
123
|
+
);
|
|
124
|
+
const prevZoomLevels = useRef(zoomLevels);
|
|
111
125
|
|
|
112
126
|
// Manage TileProviders so that TileProvider does not need to be recreated each time tiles are updated.
|
|
113
127
|
const { providers, updated } = useMemo(() => {
|
|
@@ -169,13 +183,15 @@ export function useImageryProviders({
|
|
|
169
183
|
!!added.length ||
|
|
170
184
|
!!isCesiumAccessTokenUpdated ||
|
|
171
185
|
!isEqual(prevTileKeys.current, tileKeys) ||
|
|
186
|
+
!isEqual(prevZoomLevels.current, zoomLevels) ||
|
|
172
187
|
rawProviders.some(p => p.tile && (p.prevType !== p.tile.type || p.prevUrl !== p.tile.url));
|
|
173
188
|
|
|
174
189
|
prevTileKeys.current = tileKeys;
|
|
190
|
+
prevZoomLevels.current = zoomLevels;
|
|
175
191
|
prevCesiumIonAccessToken.current = cesiumIonAccessToken;
|
|
176
192
|
|
|
177
193
|
return { providers, updated };
|
|
178
|
-
}, [cesiumIonAccessToken, tiles, tileKeys, newTile]);
|
|
194
|
+
}, [cesiumIonAccessToken, tiles, tileKeys, newTile, zoomLevels]);
|
|
179
195
|
|
|
180
196
|
prevProviders.current = providers;
|
|
181
197
|
return { providers, updated };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="vite-plugin-svgr/client" />
|
|
2
2
|
import useTransition from "@rot1024/use-transition";
|
|
3
3
|
import { BoundingSphere, Cartesian3, SceneTransforms, Cartesian2, JulianDate } from "cesium";
|
|
4
|
-
import { useEffect, useState } from "react";
|
|
4
|
+
import { useEffect, useState, type JSX } from "react";
|
|
5
5
|
import { useCesium } from "resium";
|
|
6
6
|
|
|
7
7
|
import type { ViewerProperty } from "../../..";
|
|
@@ -74,7 +74,7 @@ export default function Indicator({
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
if (position) {
|
|
77
|
-
const pos = SceneTransforms.
|
|
77
|
+
const pos = SceneTransforms.worldToWindowCoordinates(viewer.scene, position);
|
|
78
78
|
setPos(pos);
|
|
79
79
|
setIsVisible(true);
|
|
80
80
|
} else {
|
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
type Ellipsoid,
|
|
13
13
|
type Label,
|
|
14
14
|
} from "@cesium/engine";
|
|
15
|
+
import { DistanceDisplayCondition } from "cesium";
|
|
15
16
|
import { merge, omit } from "lodash-es";
|
|
16
|
-
import { type Feature } from "protomaps";
|
|
17
|
+
import { type Feature } from "protomaps-leaflet";
|
|
17
18
|
import { memo, useCallback, useEffect, useMemo, useRef, type FC } from "react";
|
|
18
19
|
import { useCesium } from "resium";
|
|
19
20
|
import { suspend } from "suspend-react";
|
|
@@ -170,6 +171,8 @@ export interface JapanGSIOptimalBVmapLabelImageryProps {
|
|
|
170
171
|
height?: number;
|
|
171
172
|
style?: AnnotationStyle;
|
|
172
173
|
labelCollection?: LabelCollection;
|
|
174
|
+
near?: number;
|
|
175
|
+
far?: number;
|
|
173
176
|
}
|
|
174
177
|
|
|
175
178
|
export const JapanGSIOptimalBVmapLabelImagery: FC<JapanGSIOptimalBVmapLabelImageryProps> = memo(
|
|
@@ -180,6 +183,8 @@ export const JapanGSIOptimalBVmapLabelImagery: FC<JapanGSIOptimalBVmapLabelImage
|
|
|
180
183
|
height = 50,
|
|
181
184
|
style = defaultStyle,
|
|
182
185
|
labelCollection,
|
|
186
|
+
near,
|
|
187
|
+
far,
|
|
183
188
|
}) => {
|
|
184
189
|
const cesiumContext = useCesium();
|
|
185
190
|
|
|
@@ -211,7 +216,7 @@ export const JapanGSIOptimalBVmapLabelImagery: FC<JapanGSIOptimalBVmapLabelImage
|
|
|
211
216
|
return [];
|
|
212
217
|
}
|
|
213
218
|
return features.filter(
|
|
214
|
-
(feature): feature is AnnotationFeature =>
|
|
219
|
+
(feature: Feature): feature is AnnotationFeature =>
|
|
215
220
|
typeof feature.props.vt_code === "number" &&
|
|
216
221
|
// Look for annotations with 3-digits code only.
|
|
217
222
|
// https://maps.gsi.go.jp/help/pdf/vector/optbv_featurecodes.pdf
|
|
@@ -228,7 +233,7 @@ export const JapanGSIOptimalBVmapLabelImagery: FC<JapanGSIOptimalBVmapLabelImage
|
|
|
228
233
|
);
|
|
229
234
|
}, [tile, imagery]);
|
|
230
235
|
|
|
231
|
-
const labelsRef = useRef<Array<[AnnotationFeature, Label]>>();
|
|
236
|
+
const labelsRef = useRef<Array<[AnnotationFeature, Label]>>(undefined);
|
|
232
237
|
const scene = cesiumContext?.scene;
|
|
233
238
|
|
|
234
239
|
const updateVisibility = useCallback(() => {
|
|
@@ -266,7 +271,7 @@ export const JapanGSIOptimalBVmapLabelImagery: FC<JapanGSIOptimalBVmapLabelImage
|
|
|
266
271
|
}
|
|
267
272
|
const texts: string[] = [];
|
|
268
273
|
const labels = annotations
|
|
269
|
-
.map((feature): [AnnotationFeature, Label] | undefined => {
|
|
274
|
+
.map((feature: AnnotationFeature): [AnnotationFeature, Label] | undefined => {
|
|
270
275
|
const styleOptions = resolveStyle(feature.props.vt_code, style);
|
|
271
276
|
if (styleOptions == null) {
|
|
272
277
|
return undefined;
|
|
@@ -282,6 +287,8 @@ export const JapanGSIOptimalBVmapLabelImagery: FC<JapanGSIOptimalBVmapLabelImage
|
|
|
282
287
|
horizontalOrigin: HorizontalOrigin.CENTER,
|
|
283
288
|
verticalOrigin: VerticalOrigin.BOTTOM,
|
|
284
289
|
heightReference: HeightReference.CLAMP_TO_GROUND,
|
|
290
|
+
distanceDisplayCondition:
|
|
291
|
+
near || far ? new DistanceDisplayCondition(near, far) : undefined,
|
|
285
292
|
disableDepthTestDistance: Infinity,
|
|
286
293
|
...styleOptions,
|
|
287
294
|
};
|
|
@@ -294,7 +301,7 @@ export const JapanGSIOptimalBVmapLabelImagery: FC<JapanGSIOptimalBVmapLabelImage
|
|
|
294
301
|
|
|
295
302
|
const removeLabels = (): void => {
|
|
296
303
|
if (!labelCollection.isDestroyed()) {
|
|
297
|
-
labels.forEach(([, label]) => {
|
|
304
|
+
labels.forEach(([, label]: [AnnotationFeature, Label]) => {
|
|
298
305
|
labelCollection.remove(label);
|
|
299
306
|
});
|
|
300
307
|
}
|
|
@@ -308,7 +315,7 @@ export const JapanGSIOptimalBVmapLabelImagery: FC<JapanGSIOptimalBVmapLabelImage
|
|
|
308
315
|
scene?.postRender.addEventListener(removeLabels);
|
|
309
316
|
}
|
|
310
317
|
};
|
|
311
|
-
}, [style, annotations, scene, labelCollection]);
|
|
318
|
+
}, [style, annotations, scene, labelCollection, near, far]);
|
|
312
319
|
|
|
313
320
|
useEffect(() => {
|
|
314
321
|
updateVisibility();
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
import { ImageryLayerProps } from "./types";
|
|
12
12
|
|
|
13
13
|
export interface LabelImageryLayerProps
|
|
14
|
-
extends
|
|
14
|
+
extends
|
|
15
|
+
Omit<ImageryLayerProps, "imageryProvider">,
|
|
15
16
|
JapanGSIOptimalBVmapLabelImageryProviderOptions {
|
|
16
17
|
minimumLevel?: number;
|
|
17
18
|
maximumLevel?: number;
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
type TileDiscardPolicy,
|
|
12
12
|
type TilingScheme,
|
|
13
13
|
} from "@cesium/engine";
|
|
14
|
-
import { TileCache, ZxySource } from "protomaps";
|
|
14
|
+
import { TileCache, ZxySource } from "protomaps-leaflet";
|
|
15
15
|
|
|
16
16
|
import { getTileCoords, makeKey } from "./helpers";
|
|
17
17
|
|
|
@@ -93,8 +93,7 @@ export abstract class JapanGSIOptimalBVmapImageryProviderBase implements Imagery
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
export interface JapanGSIOptimalBVmapLabelImageryProviderOptions
|
|
97
|
-
extends JapanGSIOptimalBVmapImageryProviderBaseOptions {
|
|
96
|
+
export interface JapanGSIOptimalBVmapLabelImageryProviderOptions extends JapanGSIOptimalBVmapImageryProviderBaseOptions {
|
|
98
97
|
url: string;
|
|
99
98
|
minimumDataLevel: number;
|
|
100
99
|
maximumDataLevel: number;
|
|
@@ -115,7 +114,7 @@ export class JapanGSIOptimalBVmapLabelImageryProvider extends JapanGSIOptimalBVm
|
|
|
115
114
|
this.maximumDataLevel = options.maximumDataLevel;
|
|
116
115
|
|
|
117
116
|
const source = new ZxySource(options.url, false);
|
|
118
|
-
this.tileCache = new TileCache(source,
|
|
117
|
+
this.tileCache = new TileCache(source, 256);
|
|
119
118
|
|
|
120
119
|
this.image = document.createElement("canvas");
|
|
121
120
|
this.image.width = 1;
|
|
@@ -143,7 +143,9 @@ const LabelImageryCollection: FC<{
|
|
|
143
143
|
imageriesAtom: Atom<KeyedImagery[]>;
|
|
144
144
|
style?: AnnotationStyle;
|
|
145
145
|
labelCollection?: LabelCollection;
|
|
146
|
-
|
|
146
|
+
near?: number;
|
|
147
|
+
far?: number;
|
|
148
|
+
}> = ({ imageryProvider, imageriesAtom, style, labelCollection, near, far }) => {
|
|
147
149
|
const imageries = useAtomValue(imageriesAtom);
|
|
148
150
|
return (
|
|
149
151
|
<>
|
|
@@ -155,6 +157,8 @@ const LabelImageryCollection: FC<{
|
|
|
155
157
|
descendants={imagery.descendants}
|
|
156
158
|
style={style}
|
|
157
159
|
labelCollection={labelCollection}
|
|
160
|
+
near={near}
|
|
161
|
+
far={far}
|
|
158
162
|
/>
|
|
159
163
|
</Suspense>
|
|
160
164
|
))}
|
|
@@ -164,9 +168,15 @@ const LabelImageryCollection: FC<{
|
|
|
164
168
|
|
|
165
169
|
export interface VectorMapLabelProps {
|
|
166
170
|
style?: Record<string, any>;
|
|
171
|
+
near?: number;
|
|
172
|
+
far?: number;
|
|
167
173
|
}
|
|
168
174
|
|
|
169
|
-
export const JapanGSIOptimalBVmapVectorMapLabel: FC<VectorMapLabelProps> = ({
|
|
175
|
+
export const JapanGSIOptimalBVmapVectorMapLabel: FC<VectorMapLabelProps> = ({
|
|
176
|
+
style,
|
|
177
|
+
near,
|
|
178
|
+
far,
|
|
179
|
+
}) => {
|
|
170
180
|
const [imageryProvider, setImageryProvider] =
|
|
171
181
|
useState<JapanGSIOptimalBVmapLabelImageryProvider>();
|
|
172
182
|
const setRef = useCallback((handle: CesiumComponentRef<CesiumImageryLayer> | null) => {
|
|
@@ -251,6 +261,8 @@ export const JapanGSIOptimalBVmapVectorMapLabel: FC<VectorMapLabelProps> = ({ st
|
|
|
251
261
|
imageriesAtom={imageriesAtom}
|
|
252
262
|
style={style}
|
|
253
263
|
labelCollection={labels}
|
|
264
|
+
near={near}
|
|
265
|
+
far={far}
|
|
254
266
|
/>
|
|
255
267
|
)}
|
|
256
268
|
</>
|
|
@@ -8,6 +8,8 @@ export interface TileLabelConfig {
|
|
|
8
8
|
labelType: "japan_gsi_optimal_bvmap";
|
|
9
9
|
fillColor?: string;
|
|
10
10
|
outlineColor?: string;
|
|
11
|
+
near?: number;
|
|
12
|
+
far?: number;
|
|
11
13
|
style: Record<string, any>;
|
|
12
14
|
}
|
|
13
15
|
|
|
@@ -23,7 +25,14 @@ const LabelImageryLayers = memo(
|
|
|
23
25
|
if (!label) return null;
|
|
24
26
|
switch (label.labelType) {
|
|
25
27
|
case "japan_gsi_optimal_bvmap":
|
|
26
|
-
return
|
|
28
|
+
return (
|
|
29
|
+
<JapanGSIOptimalBVmapVectorMapLabel
|
|
30
|
+
key={label.id}
|
|
31
|
+
style={label.style}
|
|
32
|
+
near={label.near}
|
|
33
|
+
far={label.far}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
27
36
|
default:
|
|
28
37
|
return null;
|
|
29
38
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { WebMercatorTilingScheme } from "@cesium/engine";
|
|
2
2
|
import {
|
|
3
3
|
ImageryProvider,
|
|
4
|
-
ArcGisMapServerImageryProvider,
|
|
5
4
|
IonImageryProvider,
|
|
6
5
|
OpenStreetMapImageryProvider,
|
|
7
6
|
IonWorldImageryStyle,
|
|
@@ -11,6 +10,22 @@ import {
|
|
|
11
10
|
|
|
12
11
|
import { JapanGSIOptimalBVmapLabelImageryProvider } from "./labels/JapanGSIOptimalBVmapVectorMapLabel/JapanGSIOptimalBVmapLabelImageryProvider";
|
|
13
12
|
|
|
13
|
+
const PRESET_TILE_TYPES = [
|
|
14
|
+
"default",
|
|
15
|
+
"default_label",
|
|
16
|
+
"default_road",
|
|
17
|
+
"open_street_map",
|
|
18
|
+
"black_marble",
|
|
19
|
+
"japan_gsi_standard",
|
|
20
|
+
"url",
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export type PresetTileType = (typeof PRESET_TILE_TYPES)[number];
|
|
24
|
+
|
|
25
|
+
export const isValidPresetTileType = (type: string | undefined): type is PresetTileType => {
|
|
26
|
+
return PRESET_TILE_TYPES.includes(type as PresetTileType);
|
|
27
|
+
};
|
|
28
|
+
|
|
14
29
|
export const tiles = {
|
|
15
30
|
default: ({ cesiumIonAccessToken } = {}) =>
|
|
16
31
|
IonImageryProvider.fromAssetId(IonWorldImageryStyle.AERIAL, {
|
|
@@ -24,39 +39,20 @@ export const tiles = {
|
|
|
24
39
|
IonImageryProvider.fromAssetId(IonWorldImageryStyle.ROAD, {
|
|
25
40
|
accessToken: cesiumIonAccessToken,
|
|
26
41
|
}).catch(console.error),
|
|
27
|
-
stamen_watercolor: () =>
|
|
28
|
-
new OpenStreetMapImageryProvider({
|
|
29
|
-
url: "https://stamen-tiles.a.ssl.fastly.net/watercolor/",
|
|
30
|
-
credit: "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.",
|
|
31
|
-
fileExtension: "jpg",
|
|
32
|
-
}),
|
|
33
|
-
stamen_toner: () =>
|
|
34
|
-
new OpenStreetMapImageryProvider({
|
|
35
|
-
url: "https://stamen-tiles.a.ssl.fastly.net/toner/",
|
|
36
|
-
credit: "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA.",
|
|
37
|
-
}),
|
|
38
42
|
open_street_map: () =>
|
|
39
43
|
new OpenStreetMapImageryProvider({
|
|
40
|
-
url: "https://
|
|
41
|
-
credit:
|
|
42
|
-
"Copyright: Tiles © Esri — Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012",
|
|
44
|
+
url: "https://tile.openstreetmap.org",
|
|
45
|
+
credit: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
|
43
46
|
}),
|
|
44
|
-
esri_world_topo: () =>
|
|
45
|
-
ArcGisMapServerImageryProvider.fromUrl(
|
|
46
|
-
"https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer",
|
|
47
|
-
{
|
|
48
|
-
credit:
|
|
49
|
-
"Copyright: Tiles © Esri — Esri, DeLorme, NAVTEQ, TomTom, Intermap, iPC, USGS, FAO, NPS, NRCAN, GeoBase, Kadaster NL, Ordnance Survey, Esri Japan, METI, Esri China (Hong Kong), and the GIS User Communit",
|
|
50
|
-
enablePickFeatures: false,
|
|
51
|
-
},
|
|
52
|
-
).catch(console.error),
|
|
53
47
|
black_marble: ({ cesiumIonAccessToken } = {}) =>
|
|
54
|
-
IonImageryProvider.fromAssetId(3812, {
|
|
55
|
-
|
|
56
|
-
),
|
|
48
|
+
IonImageryProvider.fromAssetId(3812, {
|
|
49
|
+
accessToken: cesiumIonAccessToken,
|
|
50
|
+
}).catch(console.error),
|
|
57
51
|
japan_gsi_standard: () =>
|
|
58
52
|
new OpenStreetMapImageryProvider({
|
|
59
53
|
url: "https://cyberjapandata.gsi.go.jp/xyz/std/",
|
|
54
|
+
credit:
|
|
55
|
+
"<a href='https://maps.gsi.go.jp/development/ichiran.html'>国土地理院</a>, Shoreline data is derived from: United States. National Imagery and Mapping Agency. \"Vector Map Level 0 (VMAP0).\" Bethesda, MD: Denver, CO: The Agency; USGS Information Services, 1997.",
|
|
60
56
|
}),
|
|
61
57
|
url: ({ url, heatmap, tile_zoomLevel } = {}) =>
|
|
62
58
|
url
|
|
@@ -68,7 +64,7 @@ export const tiles = {
|
|
|
68
64
|
})
|
|
69
65
|
: null,
|
|
70
66
|
} as {
|
|
71
|
-
[
|
|
67
|
+
[K in PresetTileType]: (opts?: {
|
|
72
68
|
url?: string;
|
|
73
69
|
cesiumIonAccessToken?: string;
|
|
74
70
|
heatmap?: boolean;
|