@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
@@ -32,8 +32,10 @@ import {
32
32
  cartesianToLatLngHeight,
33
33
  getExtrudedHeight,
34
34
  getOverriddenScreenSpaceCameraOptions,
35
+ getCredits,
35
36
  } from "../common";
36
37
  import { attachTag, getTag } from "../Feature";
38
+ import { getGeometryFromEntity } from "../helpers/getGeometryFromEntity";
37
39
  import { PickedFeature, pickManyFromViewportAsFeature } from "../pickMany";
38
40
  import { createGeometry } from "../Sketch/createGeometry";
39
41
  import { CursorType } from "../types";
@@ -48,9 +50,9 @@ import {
48
50
 
49
51
  export default function useEngineRef(
50
52
  ref: Ref<EngineRef>,
51
- cesium: RefObject<CesiumComponentRef<Cesium.Viewer>>,
53
+ cesium: RefObject<CesiumComponentRef<Cesium.Viewer> | null>,
52
54
  ): EngineRef {
53
- const cancelCameraFlight = useRef<() => void>();
55
+ const cancelCameraFlight = useRef<() => void>(undefined);
54
56
  const mouseEventCallbacks = useRef<MouseEventCallbacks>({
55
57
  click: [],
56
58
  doubleClick: [],
@@ -259,15 +261,31 @@ export default function useEngineRef(
259
261
  }
260
262
  return;
261
263
  },
262
- getExtrudedHeight: (position, windowPosition) => {
264
+ getExtrudedHeight: (position, windowPosition, allowNegative) => {
263
265
  const viewer = cesium.current?.cesiumElement;
264
266
  if (!viewer || viewer.isDestroyed()) return;
265
267
  return getExtrudedHeight(
266
268
  viewer.scene,
267
269
  new Cesium.Cartesian3(position[0], position[1], position[2]),
268
270
  new Cesium.Cartesian2(windowPosition[0], windowPosition[1]),
271
+ allowNegative,
269
272
  );
270
273
  },
274
+ getExtrudedPoint: (position, extrudedHeight) => {
275
+ if (!position || !extrudedHeight) return;
276
+ const viewer = cesium.current?.cesiumElement;
277
+ if (!viewer || viewer.isDestroyed()) return;
278
+ const point = new Cesium.Cartesian3(position[0], position[1], position[2]);
279
+ const cartesianScratch = new Cesium.Cartesian3();
280
+ const normal = viewer.scene?.globe.ellipsoid.geodeticSurfaceNormal(point, cartesianScratch);
281
+ if (!normal) return;
282
+ const extrudedPoint = Cesium.Cartesian3.add(
283
+ point,
284
+ Cesium.Cartesian3.multiplyByScalar(normal, extrudedHeight, cartesianScratch),
285
+ cartesianScratch,
286
+ );
287
+ return [extrudedPoint.x, extrudedPoint.y, extrudedPoint.z];
288
+ },
271
289
  getSurfaceDistance: (point1, point2) => {
272
290
  const viewer = cesium.current?.cesiumElement;
273
291
  if (!viewer || viewer.isDestroyed()) return;
@@ -831,6 +849,7 @@ export default function useEngineRef(
831
849
  tag.computedFeature ?? {
832
850
  type: "computedFeature",
833
851
  id: tag.featureId,
852
+ geometry: getGeometryFromEntity(viewer.clock.currentTime, entity),
834
853
  properties: convertEntityProperties(viewer.clock.currentTime, entity),
835
854
  metaData: {
836
855
  description: convertEntityDescription(viewer.clock.currentTime, entity),
@@ -938,6 +957,32 @@ export default function useEngineRef(
938
957
  tickEventCallback.current = tickEventCallback.current.filter(c => c !== cb) || [];
939
958
  },
940
959
  tickEventCallback,
960
+ calcRectangleControlPoint: (p1: Position3d, p2: Position3d, p3: Position3d) => {
961
+ const pp1 = new Cesium.Cartesian3(...p1);
962
+ const pp2 = new Cesium.Cartesian3(...p2);
963
+ const pp3 = new Cesium.Cartesian3(...p3);
964
+ const cartesianScratch1 = new Cesium.Cartesian3();
965
+ const cartesianScratch2 = new Cesium.Cartesian3();
966
+ const projection = Cesium.Cartesian3.projectVector(
967
+ Cesium.Cartesian3.subtract(pp3, pp1, cartesianScratch1),
968
+ Cesium.Cartesian3.subtract(pp2, pp1, cartesianScratch2),
969
+ cartesianScratch1,
970
+ );
971
+ const offset = Cesium.Cartesian3.subtract(
972
+ pp3,
973
+ Cesium.Cartesian3.add(pp1, projection, cartesianScratch1),
974
+ cartesianScratch2,
975
+ );
976
+ const pp4 = Cesium.Cartesian3.midpoint(pp1, pp2, cartesianScratch1);
977
+ const pp5 = Cesium.Cartesian3.add(pp4, offset, cartesianScratch2);
978
+ const p5 = [pp5.x, pp5.y, pp5.z] as Position3d;
979
+ return [p1, p2, p5];
980
+ },
981
+ getCredits: () => {
982
+ const viewer = cesium.current?.cesiumElement;
983
+ if (!viewer || viewer.isDestroyed()) return;
984
+ return getCredits(viewer);
985
+ },
941
986
  };
942
987
  }, [cesium]);
943
988
 
@@ -12,7 +12,7 @@ export default ({
12
12
  shouldRender,
13
13
  property,
14
14
  }: {
15
- cesium: RefObject<CesiumComponentRef<Viewer>>;
15
+ cesium: RefObject<CesiumComponentRef<Viewer> | null>;
16
16
  requestingRenderMode?: MutableRefObject<RequestingRenderMode>;
17
17
  isLayerDragging?: boolean;
18
18
  shouldRender?: boolean;
@@ -28,7 +28,7 @@ export default ({
28
28
  }
29
29
  }, [cesium, requestingRenderMode]);
30
30
 
31
- const explicitRenderRef = useRef<() => void>();
31
+ const explicitRenderRef = useRef<() => void>(undefined);
32
32
 
33
33
  useEffect(() => {
34
34
  explicitRenderRef.current = explicitRender;
@@ -70,7 +70,7 @@ export function useInstance<T, Keys extends unknown[], Owner>(
70
70
  descriptor: InstanceDescriptor<T, () => DisallowPromise<T>, Keys, Owner>,
71
71
  ): T {
72
72
  const [state, setState] = useState<T>();
73
- const ref = useRef<T>();
73
+ const ref = useRef<T>(undefined);
74
74
  if (ref.current == null) {
75
75
  ref.current = descriptor.create();
76
76
  }
@@ -14,7 +14,7 @@ export default ({
14
14
  onLayerDrag,
15
15
  onLayerDrop,
16
16
  }: {
17
- cesium: RefObject<CesiumComponentRef<Viewer>>;
17
+ cesium: RefObject<CesiumComponentRef<Viewer> | null>;
18
18
  isLayerDraggable?: boolean;
19
19
  onLayerDrag?: (layerId: string, featureId: string | undefined, position: LatLng) => void;
20
20
  onLayerDrop?: (
@@ -54,7 +54,7 @@ export default ({
54
54
  [cesium, onLayerDrop],
55
55
  );
56
56
 
57
- const cesiumDnD = useRef<CesiumDnD>();
57
+ const cesiumDnD = useRef<CesiumDnD>(undefined);
58
58
  useEffect(() => {
59
59
  const viewer = cesium.current?.cesiumElement;
60
60
  if (!viewer || viewer.isDestroyed()) return;
@@ -20,7 +20,7 @@ export const useLayerSelectWithRect = ({
20
20
  onLayerSelectWithRectMove,
21
21
  onLayerSelectWithRectEnd,
22
22
  }: {
23
- cesium: RefObject<CesiumComponentRef<Viewer>>;
23
+ cesium: RefObject<CesiumComponentRef<Viewer> | null>;
24
24
  engineAPI: EngineRef;
25
25
  featureFlags: number;
26
26
  onLayerSelectWithRectStart?: (e: LayerSelectWithRectStart) => void;
@@ -63,6 +63,12 @@ function makeGlobeShadersDirty(globe: Globe): void {
63
63
  // reset surface shader source to the initial state (assuming that we never
64
64
  // use custom material on globe).
65
65
  // ref: https://github.com/CesiumGS/cesium/blob/1.106/packages/engine/Source/Scene/Globe.js#L562-L572
66
+
67
+ // Safety check: ensure globe's internal properties exist before manipulation
68
+ if (!globe || globe.isDestroyed() || !(globe as any)._surface) {
69
+ return;
70
+ }
71
+
66
72
  const material = globe.material;
67
73
  if (material == null) {
68
74
  globe.material = Material.fromType("Color");
@@ -73,6 +79,18 @@ function makeGlobeShadersDirty(globe: Globe): void {
73
79
  }
74
80
  }
75
81
 
82
+ function withUniforms(globe: PrivateCesiumGlobe, add?: Record<string, () => any>) {
83
+ if (!globe._surface?._tileProvider) return;
84
+ const mm = (globe._surface._tileProvider as any)?.materialUniformMap ?? {};
85
+ (globe._surface._tileProvider as any).materialUniformMap = { ...mm, ...(add ?? {}) };
86
+ }
87
+
88
+ function removeUniforms(globe: PrivateCesiumGlobe, keys: string[]) {
89
+ const tp = globe._surface?._tileProvider as any;
90
+ if (!tp?.materialUniformMap) return;
91
+ for (const k of keys) delete tp.materialUniformMap[k];
92
+ }
93
+
76
94
  const useIBL = ({
77
95
  sphericalHarmonicCoefficients,
78
96
  globeImageBasedLighting,
@@ -124,7 +142,7 @@ const useTerrainHeatmap = ({
124
142
  cesium,
125
143
  terrain,
126
144
  }: {
127
- cesium: RefObject<CesiumComponentRef<Viewer>>;
145
+ cesium: RefObject<CesiumComponentRef<Viewer> | null>;
128
146
  terrain: TerrainProperty | undefined;
129
147
  }) => {
130
148
  const {
@@ -143,7 +161,7 @@ const useTerrainHeatmap = ({
143
161
  [
144
162
  "#ifdef APPLY_COLOR_TO_ALPHA",
145
163
  "vec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);",
146
- "colorDiff.r = max(max(colorDiff.r, colorDiff.g), colorDiff.b);",
164
+ "colorDiff.r = czm_maximumComponent(colorDiff);",
147
165
  "alpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);",
148
166
  "#endif",
149
167
  ],
@@ -184,6 +202,18 @@ const useTerrainHeatmap = ({
184
202
  return { isCustomHeatmapEnabled, shaderForTerrainHeatmap };
185
203
  };
186
204
 
205
+ async function waitTerrainReady(scene: any) {
206
+ const t = scene.terrain;
207
+ if (t?.ready) return;
208
+ await new Promise<void>(resolve => {
209
+ if (!t) return resolve();
210
+ const off = t.readyEvent.addEventListener(() => {
211
+ off();
212
+ resolve();
213
+ });
214
+ });
215
+ }
216
+
187
217
  export const useOverrideGlobeShader = ({
188
218
  cesium,
189
219
  sphericalHarmonicCoefficients,
@@ -193,7 +223,7 @@ export const useOverrideGlobeShader = ({
193
223
  enableLighting,
194
224
  terrain,
195
225
  }: {
196
- cesium: RefObject<CesiumComponentRef<Viewer>>;
226
+ cesium: RefObject<CesiumComponentRef<Viewer> | null>;
197
227
  sphericalHarmonicCoefficients?: Cartesian3[];
198
228
  globeShadowDarkness?: number;
199
229
  globeImageBasedLighting?: boolean;
@@ -201,6 +231,8 @@ export const useOverrideGlobeShader = ({
201
231
  enableLighting?: boolean;
202
232
  terrain: TerrainProperty | undefined;
203
233
  }) => {
234
+ const applyingRef = useRef(false);
235
+
204
236
  const { uniformMapForIBL, isIBLEnabled, shaderForIBL } = useIBL({
205
237
  sphericalHarmonicCoefficients,
206
238
  globeImageBasedLighting,
@@ -223,75 +255,85 @@ export const useOverrideGlobeShader = ({
223
255
 
224
256
  const needUpdateGlobeRef = useRef(false);
225
257
 
226
- const handleGlobeShader = useCallback(() => {
258
+ const handleGlobeShader = useCallback(async () => {
227
259
  // NOTE: Support the spherical harmonic coefficient only when the terrain normal is enabled.
228
260
  // Because it's difficult to control the shader for the entire globe.
229
261
  // ref: https://github.com/CesiumGS/cesium/blob/af4e2bebbef25259f049b05822adf2958fce11ff/packages/engine/Source/Shaders/GlobeFS.glsl#L408
230
262
  if (!cesium.current?.cesiumElement || !needUpdateGlobeRef.current) return;
231
263
 
232
- const globe = cesium.current.cesiumElement.scene.globe as PrivateCesiumGlobe;
264
+ if (applyingRef.current) return;
265
+ applyingRef.current = true;
233
266
 
234
- const surfaceShaderSet = globe._surfaceShaderSet;
235
- if (!surfaceShaderSet) {
236
- if (import.meta.env.DEV) {
237
- throw new Error("`globe._surfaceShaderSet` could not found");
238
- }
239
- return;
240
- }
267
+ try {
268
+ const { scene } = cesium.current.cesiumElement;
269
+ await waitTerrainReady(scene);
241
270
 
242
- const baseFragmentShaderSource = surfaceShaderSet.baseFragmentShaderSource;
271
+ const globe = cesium.current.cesiumElement.scene.globe as PrivateCesiumGlobe;
243
272
 
244
- const GlobeFS = baseFragmentShaderSource?.sources[baseFragmentShaderSource.sources.length - 1];
273
+ // Reset shaders first so we patch the freshest base
274
+ makeGlobeShadersDirty(globe);
245
275
 
246
- if (!GlobeFS || !baseFragmentShaderSource) {
247
- if (import.meta.env.DEV) {
248
- throw new Error("GlobeFS could not find.");
276
+ const surfaceShaderSet = globe._surfaceShaderSet;
277
+ if (!surfaceShaderSet) {
278
+ if (import.meta.env.DEV) {
279
+ throw new Error("`globe._surfaceShaderSet` could not found");
280
+ }
281
+ return;
249
282
  }
250
- return;
251
- }
252
283
 
253
- const matchers: StringMatcher[] = [];
254
- const shaders: string[] = [];
255
- if (isIBLEnabled && globe.enableLighting && globe.terrainProvider.hasVertexNormals) {
256
- matchers.push(shaderForIBL);
257
- shaders.push(IBLFS);
258
- }
284
+ const baseFragmentShaderSource = surfaceShaderSet.baseFragmentShaderSource;
285
+ const GlobeFS =
286
+ baseFragmentShaderSource?.sources[baseFragmentShaderSource.sources.length - 1];
259
287
 
260
- if (isCustomHeatmapEnabled) {
261
- // This will log the variables needed in the shader below.
262
- // we need the minHeight, maxHeight and logarithmic
263
- matchers.push(shaderForTerrainHeatmap);
264
- shaders.push(HeatmapForTerrainFS);
265
- }
288
+ if (!GlobeFS || !baseFragmentShaderSource) {
289
+ if (import.meta.env.DEV) {
290
+ throw new Error("GlobeFS could not find.");
291
+ }
292
+ return;
293
+ }
266
294
 
267
- // This means there is no overridden shader.
268
- if (!matchers.length) return;
295
+ const matchers: StringMatcher[] = [];
296
+ const shaders: string[] = [];
297
+ const terrainHasNormals = !!(globe.terrainProvider as any)?.hasVertexNormals;
269
298
 
270
- needUpdateGlobeRef.current = false;
299
+ if (isIBLEnabled && globe.enableLighting && terrainHasNormals) {
300
+ matchers.push(shaderForIBL);
301
+ shaders.push(IBLFS);
302
+ }
271
303
 
272
- if (!globe?._surface?._tileProvider) {
273
- if (import.meta.env.DEV) {
274
- throw new Error("`globe._surface._tileProvider.materialUniformMap` could not found");
304
+ if (isCustomHeatmapEnabled && terrainHasNormals) {
305
+ // This will log the variables needed in the shader below.
306
+ // we need the minHeight, maxHeight and logarithmic
307
+ matchers.push(shaderForTerrainHeatmap);
308
+ shaders.push(HeatmapForTerrainFS);
275
309
  }
276
- return;
277
- }
278
310
 
279
- makeGlobeShadersDirty(globe);
311
+ // This means there is no overridden shader.
312
+ if (!matchers.length) return;
280
313
 
281
- const replacedGlobeFS = defaultMatcher.concat(...matchers).execute(GlobeFS);
314
+ needUpdateGlobeRef.current = false;
282
315
 
283
- globe._surface._tileProvider.materialUniformMap = {
284
- ...(globe._surface._tileProvider.materialUniformMap ?? {}),
285
- ...uniformMapForIBL,
286
- };
316
+ if (!globe?._surface?._tileProvider) {
317
+ if (import.meta.env.DEV) {
318
+ throw new Error("`globe._surface._tileProvider.materialUniformMap` could not found");
319
+ }
320
+ return;
321
+ }
287
322
 
288
- surfaceShaderSet.baseFragmentShaderSource = new ShaderSource({
289
- sources: [
290
- ...baseFragmentShaderSource.sources.slice(0, -1),
291
- GlobeFSDefinitions + replacedGlobeFS + shaders.join(""),
292
- ],
293
- defines: baseFragmentShaderSource.defines,
294
- });
323
+ const replacedGlobeFS = defaultMatcher.concat(...matchers).execute(GlobeFS);
324
+
325
+ withUniforms(globe, isIBLEnabled ? uniformMapForIBL : undefined);
326
+
327
+ surfaceShaderSet.baseFragmentShaderSource = new ShaderSource({
328
+ sources: [
329
+ ...baseFragmentShaderSource.sources.slice(0, -1),
330
+ GlobeFSDefinitions + replacedGlobeFS + shaders.join(""),
331
+ ],
332
+ defines: baseFragmentShaderSource.defines,
333
+ });
334
+ } finally {
335
+ applyingRef.current = false;
336
+ }
295
337
  }, [
296
338
  cesium,
297
339
  isCustomHeatmapEnabled,
@@ -317,6 +359,10 @@ export const useOverrideGlobeShader = ({
317
359
 
318
360
  return () => {
319
361
  if (!globe.isDestroyed()) {
362
+ removeUniforms(globe, [
363
+ "u_reearth_sphericalHarmonicCoefficients",
364
+ "u_reearth_globeImageBasedLighting",
365
+ ]);
320
366
  // Reset customized shader to default
321
367
  makeGlobeShadersDirty(globe);
322
368
  }
@@ -9,7 +9,7 @@ export default ({
9
9
  cesium,
10
10
  property,
11
11
  }: {
12
- cesium: RefObject<CesiumComponentRef<Viewer>>;
12
+ cesium: RefObject<CesiumComponentRef<Viewer> | null>;
13
13
  property?: ViewerProperty;
14
14
  }) => {
15
15
  const sceneLight = useMemo(() => {
@@ -27,6 +27,7 @@ import type {
27
27
  import { e2eAccessToken, setE2ECesiumViewer } from "../../e2eConfig";
28
28
  import { ComputedFeature, DataType, SelectedFeatureInfo, LatLng, Camera } from "../../mantle";
29
29
  import {
30
+ Credits,
30
31
  LayerLoadEvent,
31
32
  LayerSelectWithRectEnd,
32
33
  LayerSelectWithRectMove,
@@ -37,7 +38,7 @@ import {
37
38
  import { TimelineManagerRef } from "../../Map/useTimelineManager";
38
39
  import { FEATURE_FLAGS } from "../../Visualizer/featureFlags";
39
40
 
40
- import { isSelectable } from "./common";
41
+ import { getCredits, isSelectable } from "./common";
41
42
  import { getTag, type Context as FeatureContext } from "./Feature";
42
43
  import { arrayToCartecian3 } from "./helpers/sphericalHaromic";
43
44
  import useCamera from "./hooks/useCamera";
@@ -89,6 +90,7 @@ export default ({
89
90
  onLayerLoad,
90
91
  onCameraChange,
91
92
  onMount,
93
+ onCreditsUpdate,
92
94
  }: {
93
95
  ref: React.ForwardedRef<EngineRef>;
94
96
  property?: ViewerProperty;
@@ -97,7 +99,7 @@ export default ({
97
99
  layerId?: string;
98
100
  featureId?: string;
99
101
  };
100
- layersRef?: RefObject<LayersRef>;
102
+ layersRef?: RefObject<LayersRef | null>;
101
103
  selectionReason?: LayerSelectionReason;
102
104
  meta?: Record<string, unknown>;
103
105
  featureFlags: number;
@@ -128,6 +130,7 @@ export default ({
128
130
  onLayerLoad?: (e: LayerLoadEvent) => void;
129
131
  onCameraChange?: (camera: Camera) => void;
130
132
  onMount?: () => void;
133
+ onCreditsUpdate?: (credits: Credits) => void;
131
134
  }) => {
132
135
  const cesium = useRef<CesiumComponentRef<CesiumViewer>>(null);
133
136
 
@@ -237,8 +240,8 @@ export default ({
237
240
  | Primitive
238
241
  | GroundPrimitive
239
242
  | ImageryLayer
240
- >();
241
- const prevSelectedImageryFeatureId = useRef<string | undefined>();
243
+ >(undefined);
244
+ const prevSelectedImageryFeatureId = useRef<string | undefined>(undefined);
242
245
 
243
246
  // manage layer selection
244
247
  useEffect(() => {
@@ -557,8 +560,11 @@ export default ({
557
560
  if (pickRay) {
558
561
  const l = await scene.imageryLayers.pickImageryLayerFeatures(pickRay, scene);
559
562
 
560
- // NOTE: For now we only send the first selected feature to onLayerSelect instead of sending all of them: @pyshx
561
- const f = l?.[0];
563
+ // Find the topmost overlaid feature.
564
+ const f = l?.findLast(f => {
565
+ const appearanceType = f?.data?.appearanceType;
566
+ return appearanceType && f?.data?.feature?.[appearanceType]?.show !== false;
567
+ });
562
568
 
563
569
  const appearanceType = f?.data?.appearanceType;
564
570
 
@@ -648,6 +654,22 @@ export default ({
648
654
  viewer.scene.requestRender();
649
655
  }, []);
650
656
 
657
+ const onCreditsUpdateRef = useRef(onCreditsUpdate);
658
+ onCreditsUpdateRef.current = onCreditsUpdate;
659
+ const updateCredits = useCallback(() => {
660
+ if (!onCreditsUpdateRef.current) return;
661
+ // currently we don't have a proper way to get the credits update event
662
+ // wait for 3 seconds to get latest credits
663
+ // some internal property is been used here.
664
+ setTimeout(() => {
665
+ if (!onCreditsUpdateRef.current) return;
666
+ const viewer = cesium.current?.cesiumElement;
667
+ if (!viewer || viewer.isDestroyed()) return;
668
+ const credits = getCredits(viewer);
669
+ onCreditsUpdateRef.current(credits);
670
+ }, 3000);
671
+ }, []);
672
+
651
673
  const context = useMemo<FeatureContext>(
652
674
  () => ({
653
675
  selectionReason,
@@ -662,8 +684,17 @@ export default ({
662
684
  toXYZ: engineAPI.toXYZ,
663
685
  toWindowPosition: engineAPI.toWindowPosition,
664
686
  isPositionVisible: engineAPI.isPositionVisible,
687
+ updateCredits,
665
688
  }),
666
- [selectionReason, engineAPI, onLayerEdit, onLayerVisibility, onLayerLoad, timelineManagerRef],
689
+ [
690
+ selectionReason,
691
+ engineAPI,
692
+ onLayerEdit,
693
+ onLayerVisibility,
694
+ onLayerLoad,
695
+ timelineManagerRef,
696
+ updateCredits,
697
+ ],
667
698
  );
668
699
 
669
700
  useEffect(() => {
@@ -728,6 +759,14 @@ export default ({
728
759
  unmountCamera?.();
729
760
  }, [unmountCamera]);
730
761
 
762
+ const handleTilesChange = useCallback(() => {
763
+ updateCredits();
764
+ }, [updateCredits]);
765
+
766
+ const handleTerrainProviderChange = useCallback(() => {
767
+ updateCredits();
768
+ }, [updateCredits]);
769
+
731
770
  return {
732
771
  cesium,
733
772
  cesiumIonAccessToken,
@@ -747,6 +786,8 @@ export default ({
747
786
  handleClick,
748
787
  handleMount,
749
788
  handleUnmount,
789
+ handleTilesChange,
790
+ handleTerrainProviderChange,
750
791
  };
751
792
  };
752
793
 
@@ -755,9 +796,10 @@ function tileProperties(
755
796
  ): { key: string; value: any }[] {
756
797
  return t
757
798
  .getPropertyIds()
758
- .reduce<
759
- { key: string; value: any }[]
760
- >((a, b) => [...a, { key: b, value: t.getProperty(b) }], []);
799
+ .reduce<{ key: string; value: any }[]>(
800
+ (a, b) => [...a, { key: b, value: t.getProperty(b) }],
801
+ [],
802
+ );
761
803
  }
762
804
 
763
805
  function getLayerId(target: RootEventTarget): string | undefined {
@@ -47,6 +47,7 @@ const Cesium: React.ForwardRefRenderFunction<EngineRef, EngineProps> = (
47
47
  shouldRender,
48
48
  layerSelectionReason,
49
49
  meta,
50
+ displayCredits,
50
51
  layersRef,
51
52
  featureFlags,
52
53
  requestingRenderMode,
@@ -63,6 +64,7 @@ const Cesium: React.ForwardRefRenderFunction<EngineRef, EngineProps> = (
63
64
  onMount,
64
65
  onLayerVisibility,
65
66
  onLayerLoad,
67
+ onCreditsUpdate,
66
68
  },
67
69
  ref,
68
70
  ) => {
@@ -85,6 +87,8 @@ const Cesium: React.ForwardRefRenderFunction<EngineRef, EngineProps> = (
85
87
  handleClick,
86
88
  handleMount,
87
89
  handleUnmount,
90
+ handleTilesChange,
91
+ handleTerrainProviderChange,
88
92
  } = useHooks({
89
93
  ref,
90
94
  property,
@@ -112,6 +116,7 @@ const Cesium: React.ForwardRefRenderFunction<EngineRef, EngineProps> = (
112
116
  onLayerLoad,
113
117
  onCameraChange,
114
118
  onMount,
119
+ onCreditsUpdate,
115
120
  });
116
121
 
117
122
  return (
@@ -133,7 +138,7 @@ const Cesium: React.ForwardRefRenderFunction<EngineRef, EngineProps> = (
133
138
  navigationHelpButton={false}
134
139
  projectionPicker={false}
135
140
  sceneModePicker={false}
136
- creditContainer={creditContainer}
141
+ creditContainer={displayCredits ? undefined : creditContainer}
137
142
  style={{
138
143
  width: small ? "300px" : "auto",
139
144
  height: small ? "300px" : "100%",
@@ -158,7 +163,11 @@ const Cesium: React.ForwardRefRenderFunction<EngineRef, EngineProps> = (
158
163
  onWheel={mouseEventHandles.wheel}>
159
164
  <Event onMount={handleMount} onUnmount={handleUnmount} />
160
165
  <Clock timelineManagerRef={timelineManagerRef} />
161
- <ImageryLayers tiles={property?.tiles} cesiumIonAccessToken={cesiumIonAccessToken} />
166
+ <ImageryLayers
167
+ tiles={property?.tiles}
168
+ cesiumIonAccessToken={cesiumIonAccessToken}
169
+ onTilesChange={handleTilesChange}
170
+ />
162
171
  <LabelImageryLayers tileLabels={property?.tileLabels} />
163
172
  <Indicator property={property} timelineManagerRef={timelineManagerRef} />
164
173
  <ScreenSpaceEventHandler useDefault>
@@ -252,7 +261,11 @@ const Cesium: React.ForwardRefRenderFunction<EngineRef, EngineProps> = (
252
261
  saturationShift={property?.sky?.skyAtmosphere?.saturationShift}
253
262
  brightnessShift={property?.sky?.skyAtmosphere?.brightnessShift}
254
263
  />
255
- <Globe property={property} cesiumIonAccessToken={cesiumIonAccessToken} />
264
+ <Globe
265
+ property={property}
266
+ cesiumIonAccessToken={cesiumIonAccessToken}
267
+ onTerrainProviderChange={handleTerrainProviderChange}
268
+ />
256
269
  <featureContext.Provider value={context}>{ready ? children : null}</featureContext.Provider>
257
270
  <AmbientOcclusion
258
271
  {...AMBIENT_OCCLUSION_QUALITY[property?.render?.ambientOcclusion?.quality || "low"]}
@@ -21,4 +21,4 @@ export type PrivateCesiumGlobe = Globe & {
21
21
  };
22
22
  };
23
23
 
24
- export type CursorType = "default" | "auto" | "help" | "pointer" | "grab" | "crosshair";
24
+ export type CursorType = "default" | "auto" | "help" | "pointer" | "grab" | "crosshair" | "wait";
@@ -51,8 +51,9 @@ export function computeAtom(cache?: typeof globalDataFeaturesCache) {
51
51
  );
52
52
 
53
53
  const computedResult = atom<EvalResult | undefined>(undefined);
54
- const finalFeatures = atom(get =>
55
- get(computedResult)?.features?.map((f): ComputedFeature => merge({ ...f }, get(overrides))),
54
+ const finalFeatures = atom(
55
+ get =>
56
+ get(computedResult)?.features?.map((f): ComputedFeature => merge({ ...f }, get(overrides))),
56
57
  );
57
58
  const layerStatus = atom<ComputedLayerStatus>("fetching");
58
59
  const dataAtoms = dataAtom(cache);
@@ -109,7 +110,11 @@ export function computeAtom(cache?: typeof globalDataFeaturesCache) {
109
110
  return true;
110
111
  }
111
112
 
112
- const curFeatures = processGeoJSON(currentLayer.data.value);
113
+ const curFeatures = processGeoJSON(
114
+ currentLayer.data.value,
115
+ undefined,
116
+ currentLayer.data.idProperty,
117
+ );
113
118
  if (curFeatures.length === prevFeatures?.length) {
114
119
  return !curFeatures.every((cur, i) => {
115
120
  const prev = prevFeatures[i];