@reearth/core 0.0.7-alpha.5 → 0.0.7-alpha.50

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.
Files changed (480) hide show
  1. package/dist/core.js +58676 -51066
  2. package/dist/core.umd.cjs +3959 -3915
  3. package/dist/{index-DqatWUTw.js → index-DqGWVPtz.js} +0 -1
  4. package/dist/index.d.ts +150 -34
  5. package/package.json +55 -39
  6. package/src/Map/ClusteredLayers/index.tsx +1 -1
  7. package/src/Map/Geoid/index.tsx +68 -0
  8. package/src/Map/Geoid/types.ts +8 -0
  9. package/src/Map/Layer/hooks.ts +7 -4
  10. package/src/Map/Layer/index.tsx +3 -1
  11. package/src/Map/Layers/hooks.ts +19 -2
  12. package/src/Map/Layers/index.tsx +13 -2
  13. package/src/Map/Layers/keys.ts +1 -0
  14. package/src/Map/Sketch/hooks.ts +453 -410
  15. package/src/Map/Sketch/index.tsx +67 -20
  16. package/src/Map/Sketch/sketchMachine.ts +359 -4
  17. package/src/Map/Sketch/sketchMachine.typegen.ts +58 -1
  18. package/src/Map/Sketch/types.ts +10 -20
  19. package/src/Map/Sketch/usePluginSketchLayer.ts +105 -0
  20. package/src/Map/Sketch/useSketch.ts +559 -0
  21. package/src/Map/Sketch/useSketchFeature.ts +198 -0
  22. package/src/Map/SpatialId/constants.ts +21 -0
  23. package/src/Map/SpatialId/hooks.ts +448 -0
  24. package/src/Map/SpatialId/index.tsx +63 -0
  25. package/src/Map/SpatialId/types.ts +68 -0
  26. package/src/Map/SpatialId/utils.ts +65 -0
  27. package/src/Map/hooks.ts +54 -8
  28. package/src/Map/index.tsx +41 -8
  29. package/src/Map/ref.ts +32 -3
  30. package/src/Map/types/index.ts +39 -3
  31. package/src/Map/types/viewerProperty.ts +10 -0
  32. package/src/Map/useTimelineManager.ts +2 -2
  33. package/src/Map/utils.ts +1 -1
  34. package/src/Visualizer/context.tsx +5 -5
  35. package/src/Visualizer/coreContext.tsx +2 -0
  36. package/src/Visualizer/hooks.ts +54 -20
  37. package/src/Visualizer/index.tsx +22 -3
  38. package/src/Visualizer/interactionMode.ts +2 -1
  39. package/src/Visualizer/useViewport.ts +1 -1
  40. package/src/engines/Cesium/Feature/Box/hooks/box.ts +4 -4
  41. package/src/engines/Cesium/Feature/HeatMap/HeatmapMesh.tsx +1 -1
  42. package/src/engines/Cesium/Feature/Model/index.tsx +3 -3
  43. package/src/engines/Cesium/Feature/PhotoOverlay/hooks.ts +1 -1
  44. package/src/engines/Cesium/Feature/PhotoOverlay/index.tsx +3 -1
  45. package/src/engines/Cesium/Feature/Polygon/index.tsx +6 -4
  46. package/src/engines/Cesium/Feature/Raster/mvt.ts +2 -1
  47. package/src/engines/Cesium/Feature/Resource/utils.ts +86 -91
  48. package/src/engines/Cesium/Feature/Tileset/hooks.ts +135 -70
  49. package/src/engines/Cesium/Feature/Tileset/index.tsx +1 -1
  50. package/src/engines/Cesium/Feature/Tileset/useClippingBox.ts +2 -2
  51. package/src/engines/Cesium/Feature/context.ts +1 -0
  52. package/src/engines/Cesium/Feature/index.tsx +7 -3
  53. package/src/engines/Cesium/Feature/utils.tsx +18 -7
  54. package/src/engines/Cesium/Shaders/OverriddenShaders/GlobeFS/IBL.glsl +6 -10
  55. package/src/engines/Cesium/Sketch/ControlPoint.tsx +128 -24
  56. package/src/engines/Cesium/Sketch/ExtrudedControlPoints.tsx +70 -25
  57. package/src/engines/Cesium/Sketch/ExtrudedMeasurement.tsx +3 -1
  58. package/src/engines/Cesium/Sketch/ExtrudedPolygonEntity.tsx +14 -14
  59. package/src/engines/Cesium/Sketch/PolylineEntity.tsx +7 -4
  60. package/src/engines/Cesium/Sketch/SurfaceAddingPoints.tsx +60 -0
  61. package/src/engines/Cesium/Sketch/SurfaceControlPoints.tsx +125 -35
  62. package/src/engines/Cesium/Sketch/constants.ts +5 -0
  63. package/src/engines/Cesium/Sketch/index.tsx +68 -29
  64. package/src/engines/Cesium/SpatialId/CoordinateIndicator.tsx +28 -0
  65. package/src/engines/Cesium/SpatialId/SpatialIdSpace.tsx +33 -0
  66. package/src/engines/Cesium/SpatialId/VerticalSpaceIndicator.tsx +32 -0
  67. package/src/engines/Cesium/SpatialId/index.ts +3 -0
  68. package/src/engines/Cesium/common.ts +52 -16
  69. package/src/engines/Cesium/core/Clock.tsx +1 -1
  70. package/src/engines/Cesium/core/Globe/index.tsx +73 -0
  71. package/src/engines/Cesium/core/Globe/useTerrainProviderPromise.ts +79 -0
  72. package/src/engines/Cesium/core/Imagery.test.ts +29 -11
  73. package/src/engines/Cesium/core/Imagery.tsx +22 -6
  74. package/src/engines/Cesium/core/Indicator/Indicator.tsx +1 -1
  75. package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/JapanGSIOptimalBVmapLabelImagery.tsx +9 -2
  76. package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/JapanGSIOptimalBVmapVectorMapLabel.tsx +14 -2
  77. package/src/engines/Cesium/core/labels/LabelImageryLayers.tsx +10 -1
  78. package/src/engines/Cesium/core/presets.ts +24 -28
  79. package/src/engines/Cesium/helpers/getGeometryFromEntity.ts +55 -0
  80. package/src/engines/Cesium/hooks/useCamera.ts +1 -1
  81. package/src/engines/Cesium/hooks/useCameraLimiter.ts +1 -1
  82. package/src/engines/Cesium/hooks/useEngineRef.ts +48 -3
  83. package/src/engines/Cesium/hooks/useExplicitRender.ts +2 -2
  84. package/src/engines/Cesium/hooks/useInstance.ts +1 -1
  85. package/src/engines/Cesium/hooks/useLayerDragDrop.ts +2 -2
  86. package/src/engines/Cesium/hooks/useLayerSelectWithRect.ts +1 -1
  87. package/src/engines/Cesium/hooks/useOverrideGlobeShader/useOverrideGlobeShader.ts +98 -52
  88. package/src/engines/Cesium/hooks/useViewerProperty.ts +1 -1
  89. package/src/engines/Cesium/hooks.ts +52 -10
  90. package/src/engines/Cesium/index.tsx +16 -3
  91. package/src/engines/Cesium/types.ts +1 -1
  92. package/src/mantle/atoms/compute.ts +8 -3
  93. package/src/mantle/data/geojson.ts +53 -22
  94. package/src/mantle/data/shapefile/parseZip.ts +1 -0
  95. package/src/mantle/evaluator/simple/expression/expression.test.ts +72 -0
  96. package/src/mantle/evaluator/simple/expression/node.ts +10 -12
  97. package/src/mantle/types/appearance.ts +4 -2
  98. package/src/mantle/types/index.ts +3 -0
  99. package/src/test/utils.tsx +1 -1
  100. package/src/utils/image.ts +2 -12
  101. package/src/utils/use-delayed-count.ts +1 -1
  102. package/src/utils/use-dnd/drop.ts +1 -1
  103. package/src/utils/util.ts +1 -1
  104. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_0.json +0 -1
  105. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_1.json +0 -1
  106. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_10.json +0 -1
  107. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_11.json +0 -1
  108. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_12.json +0 -1
  109. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_13.json +0 -1
  110. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_14.json +0 -1
  111. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_15.json +0 -1
  112. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_16.json +0 -1
  113. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_17.json +0 -1
  114. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_18.json +0 -1
  115. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_19.json +0 -1
  116. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_2.json +0 -1
  117. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_20.json +0 -1
  118. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_21.json +0 -1
  119. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_22.json +0 -1
  120. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_23.json +0 -1
  121. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_24.json +0 -1
  122. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_25.json +0 -1
  123. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_26.json +0 -1
  124. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_27.json +0 -1
  125. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_3.json +0 -1
  126. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_4.json +0 -1
  127. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_5.json +0 -1
  128. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_6.json +0 -1
  129. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_7.json +0 -1
  130. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_8.json +0 -1
  131. package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_9.json +0 -1
  132. package/dist/cesium/Assets/Images/bing_maps_credit.png +0 -0
  133. package/dist/cesium/Assets/Images/cesium_credit.png +0 -0
  134. package/dist/cesium/Assets/Images/google_earth_credit.png +0 -0
  135. package/dist/cesium/Assets/Images/ion-credit.png +0 -0
  136. package/dist/cesium/Assets/Textures/LensFlare/DirtMask.jpg +0 -0
  137. package/dist/cesium/Assets/Textures/LensFlare/StarBurst.jpg +0 -0
  138. package/dist/cesium/Assets/Textures/NaturalEarthII/0/0/0.jpg +0 -0
  139. package/dist/cesium/Assets/Textures/NaturalEarthII/0/1/0.jpg +0 -0
  140. package/dist/cesium/Assets/Textures/NaturalEarthII/1/0/0.jpg +0 -0
  141. package/dist/cesium/Assets/Textures/NaturalEarthII/1/0/1.jpg +0 -0
  142. package/dist/cesium/Assets/Textures/NaturalEarthII/1/1/0.jpg +0 -0
  143. package/dist/cesium/Assets/Textures/NaturalEarthII/1/1/1.jpg +0 -0
  144. package/dist/cesium/Assets/Textures/NaturalEarthII/1/2/0.jpg +0 -0
  145. package/dist/cesium/Assets/Textures/NaturalEarthII/1/2/1.jpg +0 -0
  146. package/dist/cesium/Assets/Textures/NaturalEarthII/1/3/0.jpg +0 -0
  147. package/dist/cesium/Assets/Textures/NaturalEarthII/1/3/1.jpg +0 -0
  148. package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/0.jpg +0 -0
  149. package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/1.jpg +0 -0
  150. package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/2.jpg +0 -0
  151. package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/3.jpg +0 -0
  152. package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/0.jpg +0 -0
  153. package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/1.jpg +0 -0
  154. package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/2.jpg +0 -0
  155. package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/3.jpg +0 -0
  156. package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/0.jpg +0 -0
  157. package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/1.jpg +0 -0
  158. package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/2.jpg +0 -0
  159. package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/3.jpg +0 -0
  160. package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/0.jpg +0 -0
  161. package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/1.jpg +0 -0
  162. package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/2.jpg +0 -0
  163. package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/3.jpg +0 -0
  164. package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/0.jpg +0 -0
  165. package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/1.jpg +0 -0
  166. package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/2.jpg +0 -0
  167. package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/3.jpg +0 -0
  168. package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/0.jpg +0 -0
  169. package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/1.jpg +0 -0
  170. package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/2.jpg +0 -0
  171. package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/3.jpg +0 -0
  172. package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/0.jpg +0 -0
  173. package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/1.jpg +0 -0
  174. package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/2.jpg +0 -0
  175. package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/3.jpg +0 -0
  176. package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/0.jpg +0 -0
  177. package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/1.jpg +0 -0
  178. package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/2.jpg +0 -0
  179. package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/3.jpg +0 -0
  180. package/dist/cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml +0 -14
  181. package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg +0 -0
  182. package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_my.jpg +0 -0
  183. package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg +0 -0
  184. package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_px.jpg +0 -0
  185. package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_py.jpg +0 -0
  186. package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg +0 -0
  187. package/dist/cesium/Assets/Textures/maki/airfield.png +0 -0
  188. package/dist/cesium/Assets/Textures/maki/airport.png +0 -0
  189. package/dist/cesium/Assets/Textures/maki/alcohol-shop.png +0 -0
  190. package/dist/cesium/Assets/Textures/maki/america-football.png +0 -0
  191. package/dist/cesium/Assets/Textures/maki/art-gallery.png +0 -0
  192. package/dist/cesium/Assets/Textures/maki/bakery.png +0 -0
  193. package/dist/cesium/Assets/Textures/maki/bank.png +0 -0
  194. package/dist/cesium/Assets/Textures/maki/bar.png +0 -0
  195. package/dist/cesium/Assets/Textures/maki/baseball.png +0 -0
  196. package/dist/cesium/Assets/Textures/maki/basketball.png +0 -0
  197. package/dist/cesium/Assets/Textures/maki/beer.png +0 -0
  198. package/dist/cesium/Assets/Textures/maki/bicycle.png +0 -0
  199. package/dist/cesium/Assets/Textures/maki/building.png +0 -0
  200. package/dist/cesium/Assets/Textures/maki/bus.png +0 -0
  201. package/dist/cesium/Assets/Textures/maki/cafe.png +0 -0
  202. package/dist/cesium/Assets/Textures/maki/camera.png +0 -0
  203. package/dist/cesium/Assets/Textures/maki/campsite.png +0 -0
  204. package/dist/cesium/Assets/Textures/maki/car.png +0 -0
  205. package/dist/cesium/Assets/Textures/maki/cemetery.png +0 -0
  206. package/dist/cesium/Assets/Textures/maki/cesium.png +0 -0
  207. package/dist/cesium/Assets/Textures/maki/chemist.png +0 -0
  208. package/dist/cesium/Assets/Textures/maki/cinema.png +0 -0
  209. package/dist/cesium/Assets/Textures/maki/circle-stroked.png +0 -0
  210. package/dist/cesium/Assets/Textures/maki/circle.png +0 -0
  211. package/dist/cesium/Assets/Textures/maki/city.png +0 -0
  212. package/dist/cesium/Assets/Textures/maki/clothing-store.png +0 -0
  213. package/dist/cesium/Assets/Textures/maki/college.png +0 -0
  214. package/dist/cesium/Assets/Textures/maki/commercial.png +0 -0
  215. package/dist/cesium/Assets/Textures/maki/cricket.png +0 -0
  216. package/dist/cesium/Assets/Textures/maki/cross.png +0 -0
  217. package/dist/cesium/Assets/Textures/maki/dam.png +0 -0
  218. package/dist/cesium/Assets/Textures/maki/danger.png +0 -0
  219. package/dist/cesium/Assets/Textures/maki/disability.png +0 -0
  220. package/dist/cesium/Assets/Textures/maki/dog-park.png +0 -0
  221. package/dist/cesium/Assets/Textures/maki/embassy.png +0 -0
  222. package/dist/cesium/Assets/Textures/maki/emergency-telephone.png +0 -0
  223. package/dist/cesium/Assets/Textures/maki/entrance.png +0 -0
  224. package/dist/cesium/Assets/Textures/maki/farm.png +0 -0
  225. package/dist/cesium/Assets/Textures/maki/fast-food.png +0 -0
  226. package/dist/cesium/Assets/Textures/maki/ferry.png +0 -0
  227. package/dist/cesium/Assets/Textures/maki/fire-station.png +0 -0
  228. package/dist/cesium/Assets/Textures/maki/fuel.png +0 -0
  229. package/dist/cesium/Assets/Textures/maki/garden.png +0 -0
  230. package/dist/cesium/Assets/Textures/maki/gift.png +0 -0
  231. package/dist/cesium/Assets/Textures/maki/golf.png +0 -0
  232. package/dist/cesium/Assets/Textures/maki/grocery.png +0 -0
  233. package/dist/cesium/Assets/Textures/maki/hairdresser.png +0 -0
  234. package/dist/cesium/Assets/Textures/maki/harbor.png +0 -0
  235. package/dist/cesium/Assets/Textures/maki/heart.png +0 -0
  236. package/dist/cesium/Assets/Textures/maki/heliport.png +0 -0
  237. package/dist/cesium/Assets/Textures/maki/hospital.png +0 -0
  238. package/dist/cesium/Assets/Textures/maki/ice-cream.png +0 -0
  239. package/dist/cesium/Assets/Textures/maki/industrial.png +0 -0
  240. package/dist/cesium/Assets/Textures/maki/land-use.png +0 -0
  241. package/dist/cesium/Assets/Textures/maki/laundry.png +0 -0
  242. package/dist/cesium/Assets/Textures/maki/library.png +0 -0
  243. package/dist/cesium/Assets/Textures/maki/lighthouse.png +0 -0
  244. package/dist/cesium/Assets/Textures/maki/lodging.png +0 -0
  245. package/dist/cesium/Assets/Textures/maki/logging.png +0 -0
  246. package/dist/cesium/Assets/Textures/maki/london-underground.png +0 -0
  247. package/dist/cesium/Assets/Textures/maki/marker-stroked.png +0 -0
  248. package/dist/cesium/Assets/Textures/maki/marker.png +0 -0
  249. package/dist/cesium/Assets/Textures/maki/minefield.png +0 -0
  250. package/dist/cesium/Assets/Textures/maki/mobilephone.png +0 -0
  251. package/dist/cesium/Assets/Textures/maki/monument.png +0 -0
  252. package/dist/cesium/Assets/Textures/maki/museum.png +0 -0
  253. package/dist/cesium/Assets/Textures/maki/music.png +0 -0
  254. package/dist/cesium/Assets/Textures/maki/oil-well.png +0 -0
  255. package/dist/cesium/Assets/Textures/maki/park.png +0 -0
  256. package/dist/cesium/Assets/Textures/maki/park2.png +0 -0
  257. package/dist/cesium/Assets/Textures/maki/parking-garage.png +0 -0
  258. package/dist/cesium/Assets/Textures/maki/parking.png +0 -0
  259. package/dist/cesium/Assets/Textures/maki/pharmacy.png +0 -0
  260. package/dist/cesium/Assets/Textures/maki/pitch.png +0 -0
  261. package/dist/cesium/Assets/Textures/maki/place-of-worship.png +0 -0
  262. package/dist/cesium/Assets/Textures/maki/playground.png +0 -0
  263. package/dist/cesium/Assets/Textures/maki/police.png +0 -0
  264. package/dist/cesium/Assets/Textures/maki/polling-place.png +0 -0
  265. package/dist/cesium/Assets/Textures/maki/post.png +0 -0
  266. package/dist/cesium/Assets/Textures/maki/prison.png +0 -0
  267. package/dist/cesium/Assets/Textures/maki/rail-above.png +0 -0
  268. package/dist/cesium/Assets/Textures/maki/rail-light.png +0 -0
  269. package/dist/cesium/Assets/Textures/maki/rail-metro.png +0 -0
  270. package/dist/cesium/Assets/Textures/maki/rail-underground.png +0 -0
  271. package/dist/cesium/Assets/Textures/maki/rail.png +0 -0
  272. package/dist/cesium/Assets/Textures/maki/religious-christian.png +0 -0
  273. package/dist/cesium/Assets/Textures/maki/religious-jewish.png +0 -0
  274. package/dist/cesium/Assets/Textures/maki/religious-muslim.png +0 -0
  275. package/dist/cesium/Assets/Textures/maki/restaurant.png +0 -0
  276. package/dist/cesium/Assets/Textures/maki/roadblock.png +0 -0
  277. package/dist/cesium/Assets/Textures/maki/rocket.png +0 -0
  278. package/dist/cesium/Assets/Textures/maki/school.png +0 -0
  279. package/dist/cesium/Assets/Textures/maki/scooter.png +0 -0
  280. package/dist/cesium/Assets/Textures/maki/shop.png +0 -0
  281. package/dist/cesium/Assets/Textures/maki/skiing.png +0 -0
  282. package/dist/cesium/Assets/Textures/maki/slaughterhouse.png +0 -0
  283. package/dist/cesium/Assets/Textures/maki/soccer.png +0 -0
  284. package/dist/cesium/Assets/Textures/maki/square-stroked.png +0 -0
  285. package/dist/cesium/Assets/Textures/maki/square.png +0 -0
  286. package/dist/cesium/Assets/Textures/maki/star-stroked.png +0 -0
  287. package/dist/cesium/Assets/Textures/maki/star.png +0 -0
  288. package/dist/cesium/Assets/Textures/maki/suitcase.png +0 -0
  289. package/dist/cesium/Assets/Textures/maki/swimming.png +0 -0
  290. package/dist/cesium/Assets/Textures/maki/telephone.png +0 -0
  291. package/dist/cesium/Assets/Textures/maki/tennis.png +0 -0
  292. package/dist/cesium/Assets/Textures/maki/theatre.png +0 -0
  293. package/dist/cesium/Assets/Textures/maki/toilets.png +0 -0
  294. package/dist/cesium/Assets/Textures/maki/town-hall.png +0 -0
  295. package/dist/cesium/Assets/Textures/maki/town.png +0 -0
  296. package/dist/cesium/Assets/Textures/maki/triangle-stroked.png +0 -0
  297. package/dist/cesium/Assets/Textures/maki/triangle.png +0 -0
  298. package/dist/cesium/Assets/Textures/maki/village.png +0 -0
  299. package/dist/cesium/Assets/Textures/maki/warehouse.png +0 -0
  300. package/dist/cesium/Assets/Textures/maki/waste-basket.png +0 -0
  301. package/dist/cesium/Assets/Textures/maki/water.png +0 -0
  302. package/dist/cesium/Assets/Textures/maki/wetland.png +0 -0
  303. package/dist/cesium/Assets/Textures/maki/zoo.png +0 -0
  304. package/dist/cesium/Assets/Textures/moonSmall.jpg +0 -0
  305. package/dist/cesium/Assets/Textures/pin.svg +0 -1
  306. package/dist/cesium/Assets/Textures/waterNormals.jpg +0 -0
  307. package/dist/cesium/Assets/Textures/waterNormalsSmall.jpg +0 -0
  308. package/dist/cesium/Assets/approximateTerrainHeights.json +0 -1
  309. package/dist/cesium/ThirdParty/Workers/package.json +0 -1
  310. package/dist/cesium/ThirdParty/Workers/pako_deflate.min.js +0 -1
  311. package/dist/cesium/ThirdParty/Workers/pako_inflate.min.js +0 -1
  312. package/dist/cesium/ThirdParty/Workers/z-worker-pako.js +0 -1
  313. package/dist/cesium/ThirdParty/basis_transcoder.wasm +0 -0
  314. package/dist/cesium/ThirdParty/draco_decoder.wasm +0 -0
  315. package/dist/cesium/ThirdParty/google-earth-dbroot-parser.js +0 -1
  316. package/dist/cesium/Widgets/Animation/Animation.css +0 -127
  317. package/dist/cesium/Widgets/Animation/lighter.css +0 -70
  318. package/dist/cesium/Widgets/BaseLayerPicker/BaseLayerPicker.css +0 -108
  319. package/dist/cesium/Widgets/BaseLayerPicker/lighter.css +0 -22
  320. package/dist/cesium/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.css +0 -102
  321. package/dist/cesium/Widgets/CesiumInspector/CesiumInspector.css +0 -113
  322. package/dist/cesium/Widgets/CesiumWidget/CesiumWidget.css +0 -124
  323. package/dist/cesium/Widgets/CesiumWidget/lighter.css +0 -14
  324. package/dist/cesium/Widgets/FullscreenButton/FullscreenButton.css +0 -8
  325. package/dist/cesium/Widgets/Geocoder/Geocoder.css +0 -70
  326. package/dist/cesium/Widgets/Geocoder/lighter.css +0 -17
  327. package/dist/cesium/Widgets/I3SBuildingSceneLayerExplorer/I3SBuildingSceneLayerExplorer.css +0 -27
  328. package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png +0 -0
  329. package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldImagery.png +0 -0
  330. package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png +0 -0
  331. package/dist/cesium/Widgets/Images/ImageryProviders/bingAerial.png +0 -0
  332. package/dist/cesium/Widgets/Images/ImageryProviders/bingAerialLabels.png +0 -0
  333. package/dist/cesium/Widgets/Images/ImageryProviders/bingRoads.png +0 -0
  334. package/dist/cesium/Widgets/Images/ImageryProviders/blueMarble.png +0 -0
  335. package/dist/cesium/Widgets/Images/ImageryProviders/earthAtNight.png +0 -0
  336. package/dist/cesium/Widgets/Images/ImageryProviders/mapQuestOpenStreetMap.png +0 -0
  337. package/dist/cesium/Widgets/Images/ImageryProviders/mapboxSatellite.png +0 -0
  338. package/dist/cesium/Widgets/Images/ImageryProviders/mapboxStreets.png +0 -0
  339. package/dist/cesium/Widgets/Images/ImageryProviders/mapboxTerrain.png +0 -0
  340. package/dist/cesium/Widgets/Images/ImageryProviders/naturalEarthII.png +0 -0
  341. package/dist/cesium/Widgets/Images/ImageryProviders/openStreetMap.png +0 -0
  342. package/dist/cesium/Widgets/Images/ImageryProviders/sentinel-2.png +0 -0
  343. package/dist/cesium/Widgets/Images/ImageryProviders/stadiaAlidadeSmooth.png +0 -0
  344. package/dist/cesium/Widgets/Images/ImageryProviders/stadiaAlidadeSmoothDark.png +0 -0
  345. package/dist/cesium/Widgets/Images/ImageryProviders/stamenToner.png +0 -0
  346. package/dist/cesium/Widgets/Images/ImageryProviders/stamenWatercolor.png +0 -0
  347. package/dist/cesium/Widgets/Images/NavigationHelp/Mouse.svg +0 -84
  348. package/dist/cesium/Widgets/Images/NavigationHelp/MouseLeft.svg +0 -76
  349. package/dist/cesium/Widgets/Images/NavigationHelp/MouseMiddle.svg +0 -76
  350. package/dist/cesium/Widgets/Images/NavigationHelp/MouseRight.svg +0 -76
  351. package/dist/cesium/Widgets/Images/NavigationHelp/Touch.svg +0 -120
  352. package/dist/cesium/Widgets/Images/NavigationHelp/TouchDrag.svg +0 -129
  353. package/dist/cesium/Widgets/Images/NavigationHelp/TouchRotate.svg +0 -76
  354. package/dist/cesium/Widgets/Images/NavigationHelp/TouchTilt.svg +0 -135
  355. package/dist/cesium/Widgets/Images/NavigationHelp/TouchZoom.svg +0 -74
  356. package/dist/cesium/Widgets/Images/TerrainProviders/CesiumWorldTerrain.png +0 -0
  357. package/dist/cesium/Widgets/Images/TerrainProviders/Ellipsoid.png +0 -0
  358. package/dist/cesium/Widgets/Images/TimelineIcons.png +0 -0
  359. package/dist/cesium/Widgets/Images/info-loading.gif +0 -0
  360. package/dist/cesium/Widgets/InfoBox/InfoBox.css +0 -92
  361. package/dist/cesium/Widgets/InfoBox/InfoBoxDescription.css +0 -178
  362. package/dist/cesium/Widgets/NavigationHelpButton/NavigationHelpButton.css +0 -93
  363. package/dist/cesium/Widgets/NavigationHelpButton/lighter.css +0 -38
  364. package/dist/cesium/Widgets/PerformanceWatchdog/PerformanceWatchdog.css +0 -15
  365. package/dist/cesium/Widgets/ProjectionPicker/ProjectionPicker.css +0 -38
  366. package/dist/cesium/Widgets/SceneModePicker/SceneModePicker.css +0 -56
  367. package/dist/cesium/Widgets/SelectionIndicator/SelectionIndicator.css +0 -20
  368. package/dist/cesium/Widgets/Timeline/Timeline.css +0 -103
  369. package/dist/cesium/Widgets/Timeline/lighter.css +0 -23
  370. package/dist/cesium/Widgets/VRButton/VRButton.css +0 -8
  371. package/dist/cesium/Widgets/Viewer/Viewer.css +0 -107
  372. package/dist/cesium/Widgets/VoxelInspector/VoxelInspector.css +0 -16
  373. package/dist/cesium/Widgets/lighter.css +0 -237
  374. package/dist/cesium/Widgets/lighterShared.css +0 -46
  375. package/dist/cesium/Widgets/shared.css +0 -103
  376. package/dist/cesium/Widgets/widgets.css +0 -1346
  377. package/dist/cesium/Workers/chunk-2ED5WI77.js +0 -26
  378. package/dist/cesium/Workers/chunk-2MBPFWCP.js +0 -26
  379. package/dist/cesium/Workers/chunk-3C74MLG3.js +0 -26
  380. package/dist/cesium/Workers/chunk-45U7TTT3.js +0 -26
  381. package/dist/cesium/Workers/chunk-4N7SRDH5.js +0 -26
  382. package/dist/cesium/Workers/chunk-4T6AS6BZ.js +0 -26
  383. package/dist/cesium/Workers/chunk-5AG2MVRM.js +0 -26
  384. package/dist/cesium/Workers/chunk-5Z6L2FHX.js +0 -26
  385. package/dist/cesium/Workers/chunk-6AUUBDOF.js +0 -26
  386. package/dist/cesium/Workers/chunk-74N6MC2V.js +0 -26
  387. package/dist/cesium/Workers/chunk-7VJK3KHI.js +0 -26
  388. package/dist/cesium/Workers/chunk-7VZHIB6P.js +0 -26
  389. package/dist/cesium/Workers/chunk-7X2YQ6I4.js +0 -27
  390. package/dist/cesium/Workers/chunk-B2SKQ7LU.js +0 -26
  391. package/dist/cesium/Workers/chunk-B4TQDFIE.js +0 -26
  392. package/dist/cesium/Workers/chunk-B6TRTFAA.js +0 -26
  393. package/dist/cesium/Workers/chunk-BK3HCS7I.js +0 -26
  394. package/dist/cesium/Workers/chunk-BOPB43LN.js +0 -26
  395. package/dist/cesium/Workers/chunk-C6DMEJQ7.js +0 -26
  396. package/dist/cesium/Workers/chunk-CN7UN2OZ.js +0 -26
  397. package/dist/cesium/Workers/chunk-CSISXEG7.js +0 -26
  398. package/dist/cesium/Workers/chunk-CUOR5F7T.js +0 -28
  399. package/dist/cesium/Workers/chunk-DGCK3LD2.js +0 -30
  400. package/dist/cesium/Workers/chunk-DXEZYE3K.js +0 -62
  401. package/dist/cesium/Workers/chunk-EXBFEYPQ.js +0 -26
  402. package/dist/cesium/Workers/chunk-FK5KFB6H.js +0 -26
  403. package/dist/cesium/Workers/chunk-HPBHKP5S.js +0 -26
  404. package/dist/cesium/Workers/chunk-JCJ24DHF.js +0 -26
  405. package/dist/cesium/Workers/chunk-JEWHFDAA.js +0 -26
  406. package/dist/cesium/Workers/chunk-JZLZJJQD.js +0 -26
  407. package/dist/cesium/Workers/chunk-KRZBI2MU.js +0 -26
  408. package/dist/cesium/Workers/chunk-KTTUANTJ.js +0 -26
  409. package/dist/cesium/Workers/chunk-LDCAXLGS.js +0 -26
  410. package/dist/cesium/Workers/chunk-LOPN5R3I.js +0 -26
  411. package/dist/cesium/Workers/chunk-MDLPQIMP.js +0 -26
  412. package/dist/cesium/Workers/chunk-MRR3RGFO.js +0 -26
  413. package/dist/cesium/Workers/chunk-NPBZI5YA.js +0 -26
  414. package/dist/cesium/Workers/chunk-NUSW5B6A.js +0 -26
  415. package/dist/cesium/Workers/chunk-OUXRUXNB.js +0 -26
  416. package/dist/cesium/Workers/chunk-QPOPEH3M.js +0 -26
  417. package/dist/cesium/Workers/chunk-R2AN7EKC.js +0 -26
  418. package/dist/cesium/Workers/chunk-RURL6ZX2.js +0 -26
  419. package/dist/cesium/Workers/chunk-SUQM3OSW.js +0 -28
  420. package/dist/cesium/Workers/chunk-UBIRX2SP.js +0 -26
  421. package/dist/cesium/Workers/chunk-VAKC5J5C.js +0 -26
  422. package/dist/cesium/Workers/chunk-VHNZBQTR.js +0 -27
  423. package/dist/cesium/Workers/chunk-VKV642QV.js +0 -26
  424. package/dist/cesium/Workers/chunk-VMSXG4OA.js +0 -26
  425. package/dist/cesium/Workers/chunk-VQZSIOZW.js +0 -26
  426. package/dist/cesium/Workers/chunk-WZUWQMI7.js +0 -26
  427. package/dist/cesium/Workers/chunk-YBI55DLZ.js +0 -26
  428. package/dist/cesium/Workers/chunk-YEJWCH6C.js +0 -26
  429. package/dist/cesium/Workers/chunk-YPDO7SPO.js +0 -26
  430. package/dist/cesium/Workers/chunk-ZYWD6OQH.js +0 -26
  431. package/dist/cesium/Workers/combineGeometry.js +0 -26
  432. package/dist/cesium/Workers/createBoxGeometry.js +0 -26
  433. package/dist/cesium/Workers/createBoxOutlineGeometry.js +0 -26
  434. package/dist/cesium/Workers/createCircleGeometry.js +0 -26
  435. package/dist/cesium/Workers/createCircleOutlineGeometry.js +0 -26
  436. package/dist/cesium/Workers/createCoplanarPolygonGeometry.js +0 -26
  437. package/dist/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +0 -26
  438. package/dist/cesium/Workers/createCorridorGeometry.js +0 -26
  439. package/dist/cesium/Workers/createCorridorOutlineGeometry.js +0 -26
  440. package/dist/cesium/Workers/createCylinderGeometry.js +0 -26
  441. package/dist/cesium/Workers/createCylinderOutlineGeometry.js +0 -26
  442. package/dist/cesium/Workers/createEllipseGeometry.js +0 -26
  443. package/dist/cesium/Workers/createEllipseOutlineGeometry.js +0 -26
  444. package/dist/cesium/Workers/createEllipsoidGeometry.js +0 -26
  445. package/dist/cesium/Workers/createEllipsoidOutlineGeometry.js +0 -26
  446. package/dist/cesium/Workers/createFrustumGeometry.js +0 -26
  447. package/dist/cesium/Workers/createFrustumOutlineGeometry.js +0 -26
  448. package/dist/cesium/Workers/createGeometry.js +0 -26
  449. package/dist/cesium/Workers/createGroundPolylineGeometry.js +0 -26
  450. package/dist/cesium/Workers/createPlaneGeometry.js +0 -26
  451. package/dist/cesium/Workers/createPlaneOutlineGeometry.js +0 -26
  452. package/dist/cesium/Workers/createPolygonGeometry.js +0 -26
  453. package/dist/cesium/Workers/createPolygonOutlineGeometry.js +0 -26
  454. package/dist/cesium/Workers/createPolylineGeometry.js +0 -26
  455. package/dist/cesium/Workers/createPolylineVolumeGeometry.js +0 -26
  456. package/dist/cesium/Workers/createPolylineVolumeOutlineGeometry.js +0 -26
  457. package/dist/cesium/Workers/createRectangleGeometry.js +0 -26
  458. package/dist/cesium/Workers/createRectangleOutlineGeometry.js +0 -26
  459. package/dist/cesium/Workers/createSimplePolylineGeometry.js +0 -26
  460. package/dist/cesium/Workers/createSphereGeometry.js +0 -26
  461. package/dist/cesium/Workers/createSphereOutlineGeometry.js +0 -26
  462. package/dist/cesium/Workers/createTaskProcessorWorker.js +0 -26
  463. package/dist/cesium/Workers/createVectorTileClampedPolylines.js +0 -26
  464. package/dist/cesium/Workers/createVectorTileGeometries.js +0 -26
  465. package/dist/cesium/Workers/createVectorTilePoints.js +0 -26
  466. package/dist/cesium/Workers/createVectorTilePolygons.js +0 -26
  467. package/dist/cesium/Workers/createVectorTilePolylines.js +0 -26
  468. package/dist/cesium/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -26
  469. package/dist/cesium/Workers/createVerticesFromHeightmap.js +0 -26
  470. package/dist/cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +0 -26
  471. package/dist/cesium/Workers/createWallGeometry.js +0 -26
  472. package/dist/cesium/Workers/createWallOutlineGeometry.js +0 -26
  473. package/dist/cesium/Workers/decodeDraco.js +0 -26
  474. package/dist/cesium/Workers/decodeGoogleEarthEnterprisePacket.js +0 -26
  475. package/dist/cesium/Workers/decodeI3S.js +0 -26
  476. package/dist/cesium/Workers/transcodeKTX2.js +0 -56
  477. package/dist/cesium/Workers/transferTypedArrayTest.js +0 -26
  478. package/dist/cesium/Workers/upsampleQuantizedTerrainMesh.js +0 -26
  479. package/src/engines/Cesium/core/Globe.tsx +0 -104
  480. /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, foobar: provider2 };
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
- rerender({ tiles: [{ id: "1", type: "default" }] });
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
- rerender({ tiles: [{ id: "1", type: "default", url: "a" }] });
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
- rerender({
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
- rerender({
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
- rerender({
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
- rerender({
89
- tiles: [{ id: "1", type: "foobar", url: "u" }],
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": ["foobar", "u", { hoge2: "u" }],
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
- rerender({ tiles: [] });
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
- [key: string]: (opts?: {
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 || "default"]({
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 "../../..";
@@ -12,6 +12,7 @@ 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
17
  import { type Feature } from "protomaps";
17
18
  import { memo, useCallback, useEffect, useMemo, useRef, type FC } from "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
 
@@ -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(() => {
@@ -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
  };
@@ -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();
@@ -143,7 +143,9 @@ const LabelImageryCollection: FC<{
143
143
  imageriesAtom: Atom<KeyedImagery[]>;
144
144
  style?: AnnotationStyle;
145
145
  labelCollection?: LabelCollection;
146
- }> = ({ imageryProvider, imageriesAtom, style, labelCollection }) => {
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> = ({ style }) => {
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 <JapanGSIOptimalBVmapVectorMapLabel key={label.id} style={label.style} />;
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://a.tile.openstreetmap.org/",
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, { accessToken: cesiumIonAccessToken }).catch(
55
- console.error,
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
- [key: string]: (opts?: {
67
+ [K in PresetTileType]: (opts?: {
72
68
  url?: string;
73
69
  cesiumIonAccessToken?: string;
74
70
  heatmap?: boolean;
@@ -0,0 +1,55 @@
1
+ import { Cartesian3, Entity, JulianDate, PolygonHierarchy } from "cesium";
2
+
3
+ import { Geometry } from "../../../mantle";
4
+
5
+ export function getMarkerCoordinates(
6
+ entity: Entity,
7
+ currentTime: JulianDate,
8
+ ): [number, number, number] {
9
+ const position = entity.position?.getValue(currentTime) as Cartesian3 | undefined;
10
+ return [position?.x ?? 0, position?.y ?? 0, position?.z ?? 0];
11
+ }
12
+
13
+ export function getGeometryFromEntity(currentTime: JulianDate, entity: Entity) {
14
+ if (entity.point || entity.billboard || entity.label) {
15
+ const coordinates = getMarkerCoordinates(entity, currentTime);
16
+
17
+ const geometry: Geometry = {
18
+ type: "Point",
19
+ coordinates,
20
+ };
21
+ return geometry;
22
+ }
23
+
24
+ if (entity.polyline) {
25
+ const positions = entity.polyline?.positions?.getValue(currentTime) as Cartesian3[];
26
+ const coordinates = positions?.map(position => [
27
+ position?.x ?? 0,
28
+ position?.y ?? 0,
29
+ position?.z ?? 0,
30
+ ]);
31
+
32
+ const geometry: Geometry = {
33
+ type: "LineString",
34
+ coordinates,
35
+ };
36
+ return geometry;
37
+ }
38
+
39
+ if (entity.polygon) {
40
+ const hierarchy = entity.polygon?.hierarchy?.getValue(currentTime) as PolygonHierarchy;
41
+ const coordinates = hierarchy?.positions?.map(position => [
42
+ position?.x ?? 0,
43
+ position?.y ?? 0,
44
+ position?.z ?? 0,
45
+ ]);
46
+
47
+ const geometry: Geometry = {
48
+ type: "Polygon",
49
+ coordinates: [coordinates],
50
+ };
51
+ return geometry;
52
+ }
53
+
54
+ return undefined;
55
+ }
@@ -21,7 +21,7 @@ export default ({
21
21
  cameraForceHorizontalRoll = false,
22
22
  onCameraChange,
23
23
  }: {
24
- cesium: RefObject<CesiumComponentRef<Viewer>>;
24
+ cesium: RefObject<CesiumComponentRef<Viewer> | null>;
25
25
  property?: ViewerProperty;
26
26
  engineAPI: EngineRef;
27
27
  featureFlags: number;
@@ -20,7 +20,7 @@ const targetWidth = 1000000;
20
20
  const targetLength = 1000000;
21
21
 
22
22
  export function useCameraLimiter(
23
- cesium: RefObject<CesiumComponentRef<CesiumViewer>>,
23
+ cesium: RefObject<CesiumComponentRef<CesiumViewer> | null>,
24
24
  camera: Camera | undefined,
25
25
  property: CameraLimiterProperty | undefined,
26
26
  ) {