@reearth/core 0.0.7-alpha.7 → 0.0.7-alpha.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +177 -0
- package/dist/core.js +71433 -61051
- package/dist/core.umd.cjs +666 -680
- package/dist/{index-DqatWUTw.js → index-CUJ6HGQn.js} +1021 -908
- package/dist/index.d.ts +195 -73
- package/package.json +88 -74
- package/src/Map/ClusteredLayers/index.tsx +1 -1
- package/src/Map/Geoid/index.tsx +68 -0
- package/src/Map/Geoid/types.ts +8 -0
- package/src/Map/Layer/hooks.ts +7 -4
- package/src/Map/Layer/index.tsx +3 -1
- package/src/Map/Layers/hooks.ts +45 -12
- package/src/Map/Layers/index.tsx +13 -2
- package/src/Map/Layers/keys.ts +1 -0
- package/src/Map/Sketch/hooks.ts +454 -411
- package/src/Map/Sketch/index.tsx +68 -21
- package/src/Map/Sketch/sketchMachine.ts +640 -237
- package/src/Map/Sketch/sketchMachine.typegen.ts +58 -1
- package/src/Map/Sketch/types.ts +10 -20
- package/src/Map/Sketch/usePluginSketchLayer.ts +105 -0
- package/src/Map/Sketch/useSketch.ts +558 -0
- package/src/Map/Sketch/useSketchFeature.ts +198 -0
- package/src/Map/SpatialId/constants.ts +21 -0
- package/src/Map/SpatialId/hooks.ts +448 -0
- package/src/Map/SpatialId/index.tsx +63 -0
- package/src/Map/SpatialId/types.ts +68 -0
- package/src/Map/SpatialId/utils.ts +65 -0
- package/src/Map/hooks.ts +54 -8
- package/src/Map/index.tsx +42 -9
- package/src/Map/ref.ts +32 -3
- package/src/Map/types/customProvider.ts +32 -0
- package/src/Map/types/index.ts +42 -3
- package/src/Map/types/viewerProperty.ts +12 -1
- package/src/Map/useTimelineManager.ts +4 -10
- package/src/Map/utils.ts +1 -1
- package/src/Visualizer/Error.tsx +4 -1
- package/src/Visualizer/context.tsx +5 -5
- package/src/Visualizer/coreContext.tsx +3 -1
- package/src/Visualizer/hooks.ts +56 -22
- package/src/Visualizer/index.stories.tsx +15 -0
- package/src/Visualizer/index.tsx +29 -6
- package/src/Visualizer/useViewport.ts +1 -1
- package/src/engines/Cesium/Feature/Box/hooks/box.ts +4 -4
- package/src/engines/Cesium/Feature/Box/hooks/edge.ts +1 -1
- package/src/engines/Cesium/Feature/Box/hooks/side.ts +1 -1
- package/src/engines/Cesium/Feature/Box/utils.ts +6 -0
- package/src/engines/Cesium/Feature/Ellipse/index.stories.tsx +0 -1
- package/src/engines/Cesium/Feature/Frustum/getFieldOfView.ts +2 -0
- package/src/engines/Cesium/Feature/Frustum/index.stories.tsx +0 -1
- package/src/engines/Cesium/Feature/HeatMap/HeatmapMesh.tsx +1 -1
- package/src/engines/Cesium/Feature/Marker/index.tsx +1 -1
- package/src/engines/Cesium/Feature/Model/index.stories.tsx +1 -2
- package/src/engines/Cesium/Feature/Model/index.tsx +3 -3
- package/src/engines/Cesium/Feature/PhotoOverlay/hooks.ts +2 -2
- package/src/engines/Cesium/Feature/PhotoOverlay/index.tsx +3 -1
- package/src/engines/Cesium/Feature/Polygon/index.stories.tsx +0 -1
- package/src/engines/Cesium/Feature/Polygon/index.tsx +6 -4
- package/src/engines/Cesium/Feature/Raster/index.stories.tsx +0 -1
- package/src/engines/Cesium/Feature/Raster/mvt.ts +2 -1
- package/src/engines/Cesium/Feature/Resource/index.stories.tsx +0 -1
- package/src/engines/Cesium/Feature/Resource/index.tsx +1 -27
- package/src/engines/Cesium/Feature/Resource/utils.ts +86 -91
- package/src/engines/Cesium/Feature/Tileset/hooks.ts +273 -87
- package/src/engines/Cesium/Feature/Tileset/index.stories.tsx +0 -1
- package/src/engines/Cesium/Feature/Tileset/index.tsx +7 -14
- package/src/engines/Cesium/Feature/Tileset/useClippingBox.ts +2 -2
- package/src/engines/Cesium/Feature/Tileset/useDrawClipping.ts +2 -2
- package/src/engines/Cesium/Feature/context.ts +3 -0
- package/src/engines/Cesium/Feature/index.tsx +27 -10
- package/src/engines/Cesium/Feature/utils.tsx +20 -12
- package/src/engines/Cesium/PostProcesses/hbao/AmbientOcclusion.tsx +7 -4
- package/src/engines/Cesium/Sketch/ControlPoint.tsx +128 -24
- package/src/engines/Cesium/Sketch/ExtrudedControlPoints.tsx +70 -25
- package/src/engines/Cesium/Sketch/ExtrudedMeasurement.tsx +3 -1
- package/src/engines/Cesium/Sketch/ExtrudedPolygonEntity.tsx +14 -14
- package/src/engines/Cesium/Sketch/PolylineEntity.tsx +7 -4
- package/src/engines/Cesium/Sketch/SurfaceAddingPoints.tsx +60 -0
- package/src/engines/Cesium/Sketch/SurfaceControlPoints.tsx +126 -35
- package/src/engines/Cesium/Sketch/constants.ts +5 -0
- package/src/engines/Cesium/Sketch/index.tsx +68 -29
- package/src/engines/Cesium/SpatialId/CoordinateIndicator.tsx +28 -0
- package/src/engines/Cesium/SpatialId/SpatialIdSpace.tsx +33 -0
- package/src/engines/Cesium/SpatialId/VerticalSpaceIndicator.tsx +32 -0
- package/src/engines/Cesium/SpatialId/index.ts +3 -0
- package/src/engines/Cesium/common.ts +55 -18
- package/src/engines/Cesium/core/Clock.tsx +1 -1
- package/src/engines/Cesium/core/Globe/index.tsx +69 -0
- package/src/engines/Cesium/core/Globe/useTerrainProviderPromise.ts +81 -0
- package/src/engines/Cesium/core/Imagery.test.ts +299 -42
- package/src/engines/Cesium/core/Imagery.tsx +282 -54
- package/src/engines/Cesium/core/Indicator/Indicator.tsx +2 -2
- package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/JapanGSIOptimalBVmapLabelImagery.tsx +13 -6
- package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/JapanGSIOptimalBVmapLabelImageryLayer.tsx +2 -1
- package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/JapanGSIOptimalBVmapLabelImageryProvider.ts +3 -4
- package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/JapanGSIOptimalBVmapVectorMapLabel.tsx +14 -2
- package/src/engines/Cesium/core/labels/JapanGSIOptimalBVmapVectorMapLabel/helpers.ts +1 -1
- package/src/engines/Cesium/core/labels/LabelImageryLayers.tsx +10 -1
- package/src/engines/Cesium/core/presets.ts +122 -48
- package/src/engines/Cesium/helpers/getGeometryFromEntity.ts +55 -0
- package/src/engines/Cesium/hooks/useCamera.ts +2 -2
- package/src/engines/Cesium/hooks/useCameraLimiter.ts +1 -1
- package/src/engines/Cesium/hooks/useEngineRef.ts +52 -5
- package/src/engines/Cesium/hooks/useExplicitRender.ts +2 -2
- package/src/engines/Cesium/hooks/useInstance.ts +1 -1
- package/src/engines/Cesium/hooks/useLayerDragDrop.ts +3 -3
- package/src/engines/Cesium/hooks/useLayerSelectWithRect.ts +2 -2
- package/src/engines/Cesium/hooks/useOverrideGlobeShader/useOverrideGlobeShader.ts +115 -67
- package/src/engines/Cesium/hooks/useViewerProperty.ts +1 -1
- package/src/engines/Cesium/hooks.ts +68 -17
- package/src/engines/Cesium/index.stories.tsx +0 -1
- package/src/engines/Cesium/index.tsx +38 -8
- package/src/engines/Cesium/pickMany.ts +2 -0
- package/src/engines/Cesium/types.ts +1 -1
- package/src/engines/Cesium/utils/mouse.ts +1 -1
- package/src/engines/Cesium/utils/utils.ts +1 -1
- package/src/mantle/atoms/compute.test.ts +4 -4
- package/src/mantle/atoms/compute.ts +8 -4
- package/src/mantle/compat/forward.ts +1 -1
- package/src/mantle/data/geojson.ts +49 -26
- package/src/mantle/data/georss.ts +2 -2
- package/src/mantle/data/gml.ts +2 -2
- package/src/mantle/data/gpx.ts +2 -2
- package/src/mantle/data/shapefile/parseZip.ts +1 -0
- package/src/mantle/evaluator/simple/expression/README.md +392 -0
- package/src/mantle/evaluator/simple/expression/expression.test.ts +137 -0
- package/src/mantle/evaluator/simple/expression/node.ts +10 -12
- package/src/mantle/evaluator/simple/expression/variableReplacer.test.ts +178 -0
- package/src/mantle/evaluator/simple/expression/variableReplacer.ts +24 -11
- package/src/mantle/types/appearance.ts +4 -2
- package/src/mantle/types/index.ts +5 -0
- package/src/{Visualizer → shared}/interactionMode.ts +3 -2
- package/src/test/setup.ts +1 -1
- package/src/test/utils.tsx +1 -1
- package/src/types/modules.d.ts +96 -0
- package/src/utils/StringMatcher.ts +1 -1
- package/src/utils/image.ts +2 -12
- package/src/utils/use-delayed-count.ts +1 -1
- package/src/utils/use-dnd/drop.ts +1 -1
- package/src/utils/util.ts +1 -1
- package/src/utils/value.ts +2 -2
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_0.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_1.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_10.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_11.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_12.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_13.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_14.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_15.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_16.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_17.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_18.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_19.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_2.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_20.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_21.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_22.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_23.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_24.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_25.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_26.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_27.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_3.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_4.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_5.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_6.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_7.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_8.json +0 -1
- package/dist/cesium/Assets/IAU2006_XYS/IAU2006_XYS_9.json +0 -1
- package/dist/cesium/Assets/Images/bing_maps_credit.png +0 -0
- package/dist/cesium/Assets/Images/cesium_credit.png +0 -0
- package/dist/cesium/Assets/Images/google_earth_credit.png +0 -0
- package/dist/cesium/Assets/Images/ion-credit.png +0 -0
- package/dist/cesium/Assets/Textures/LensFlare/DirtMask.jpg +0 -0
- package/dist/cesium/Assets/Textures/LensFlare/StarBurst.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/0/0/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/0/1/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/0/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/0/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/1/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/1/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/2/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/2/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/3/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/1/3/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/0/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/1/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/2/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/3/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/4/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/5/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/6/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/0.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/1.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/2.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/2/7/3.jpg +0 -0
- package/dist/cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml +0 -14
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_my.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_px.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_py.jpg +0 -0
- package/dist/cesium/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg +0 -0
- package/dist/cesium/Assets/Textures/maki/airfield.png +0 -0
- package/dist/cesium/Assets/Textures/maki/airport.png +0 -0
- package/dist/cesium/Assets/Textures/maki/alcohol-shop.png +0 -0
- package/dist/cesium/Assets/Textures/maki/america-football.png +0 -0
- package/dist/cesium/Assets/Textures/maki/art-gallery.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bakery.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bank.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bar.png +0 -0
- package/dist/cesium/Assets/Textures/maki/baseball.png +0 -0
- package/dist/cesium/Assets/Textures/maki/basketball.png +0 -0
- package/dist/cesium/Assets/Textures/maki/beer.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bicycle.png +0 -0
- package/dist/cesium/Assets/Textures/maki/building.png +0 -0
- package/dist/cesium/Assets/Textures/maki/bus.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cafe.png +0 -0
- package/dist/cesium/Assets/Textures/maki/camera.png +0 -0
- package/dist/cesium/Assets/Textures/maki/campsite.png +0 -0
- package/dist/cesium/Assets/Textures/maki/car.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cemetery.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cesium.png +0 -0
- package/dist/cesium/Assets/Textures/maki/chemist.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cinema.png +0 -0
- package/dist/cesium/Assets/Textures/maki/circle-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/circle.png +0 -0
- package/dist/cesium/Assets/Textures/maki/city.png +0 -0
- package/dist/cesium/Assets/Textures/maki/clothing-store.png +0 -0
- package/dist/cesium/Assets/Textures/maki/college.png +0 -0
- package/dist/cesium/Assets/Textures/maki/commercial.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cricket.png +0 -0
- package/dist/cesium/Assets/Textures/maki/cross.png +0 -0
- package/dist/cesium/Assets/Textures/maki/dam.png +0 -0
- package/dist/cesium/Assets/Textures/maki/danger.png +0 -0
- package/dist/cesium/Assets/Textures/maki/disability.png +0 -0
- package/dist/cesium/Assets/Textures/maki/dog-park.png +0 -0
- package/dist/cesium/Assets/Textures/maki/embassy.png +0 -0
- package/dist/cesium/Assets/Textures/maki/emergency-telephone.png +0 -0
- package/dist/cesium/Assets/Textures/maki/entrance.png +0 -0
- package/dist/cesium/Assets/Textures/maki/farm.png +0 -0
- package/dist/cesium/Assets/Textures/maki/fast-food.png +0 -0
- package/dist/cesium/Assets/Textures/maki/ferry.png +0 -0
- package/dist/cesium/Assets/Textures/maki/fire-station.png +0 -0
- package/dist/cesium/Assets/Textures/maki/fuel.png +0 -0
- package/dist/cesium/Assets/Textures/maki/garden.png +0 -0
- package/dist/cesium/Assets/Textures/maki/gift.png +0 -0
- package/dist/cesium/Assets/Textures/maki/golf.png +0 -0
- package/dist/cesium/Assets/Textures/maki/grocery.png +0 -0
- package/dist/cesium/Assets/Textures/maki/hairdresser.png +0 -0
- package/dist/cesium/Assets/Textures/maki/harbor.png +0 -0
- package/dist/cesium/Assets/Textures/maki/heart.png +0 -0
- package/dist/cesium/Assets/Textures/maki/heliport.png +0 -0
- package/dist/cesium/Assets/Textures/maki/hospital.png +0 -0
- package/dist/cesium/Assets/Textures/maki/ice-cream.png +0 -0
- package/dist/cesium/Assets/Textures/maki/industrial.png +0 -0
- package/dist/cesium/Assets/Textures/maki/land-use.png +0 -0
- package/dist/cesium/Assets/Textures/maki/laundry.png +0 -0
- package/dist/cesium/Assets/Textures/maki/library.png +0 -0
- package/dist/cesium/Assets/Textures/maki/lighthouse.png +0 -0
- package/dist/cesium/Assets/Textures/maki/lodging.png +0 -0
- package/dist/cesium/Assets/Textures/maki/logging.png +0 -0
- package/dist/cesium/Assets/Textures/maki/london-underground.png +0 -0
- package/dist/cesium/Assets/Textures/maki/marker-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/marker.png +0 -0
- package/dist/cesium/Assets/Textures/maki/minefield.png +0 -0
- package/dist/cesium/Assets/Textures/maki/mobilephone.png +0 -0
- package/dist/cesium/Assets/Textures/maki/monument.png +0 -0
- package/dist/cesium/Assets/Textures/maki/museum.png +0 -0
- package/dist/cesium/Assets/Textures/maki/music.png +0 -0
- package/dist/cesium/Assets/Textures/maki/oil-well.png +0 -0
- package/dist/cesium/Assets/Textures/maki/park.png +0 -0
- package/dist/cesium/Assets/Textures/maki/park2.png +0 -0
- package/dist/cesium/Assets/Textures/maki/parking-garage.png +0 -0
- package/dist/cesium/Assets/Textures/maki/parking.png +0 -0
- package/dist/cesium/Assets/Textures/maki/pharmacy.png +0 -0
- package/dist/cesium/Assets/Textures/maki/pitch.png +0 -0
- package/dist/cesium/Assets/Textures/maki/place-of-worship.png +0 -0
- package/dist/cesium/Assets/Textures/maki/playground.png +0 -0
- package/dist/cesium/Assets/Textures/maki/police.png +0 -0
- package/dist/cesium/Assets/Textures/maki/polling-place.png +0 -0
- package/dist/cesium/Assets/Textures/maki/post.png +0 -0
- package/dist/cesium/Assets/Textures/maki/prison.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail-above.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail-light.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail-metro.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail-underground.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rail.png +0 -0
- package/dist/cesium/Assets/Textures/maki/religious-christian.png +0 -0
- package/dist/cesium/Assets/Textures/maki/religious-jewish.png +0 -0
- package/dist/cesium/Assets/Textures/maki/religious-muslim.png +0 -0
- package/dist/cesium/Assets/Textures/maki/restaurant.png +0 -0
- package/dist/cesium/Assets/Textures/maki/roadblock.png +0 -0
- package/dist/cesium/Assets/Textures/maki/rocket.png +0 -0
- package/dist/cesium/Assets/Textures/maki/school.png +0 -0
- package/dist/cesium/Assets/Textures/maki/scooter.png +0 -0
- package/dist/cesium/Assets/Textures/maki/shop.png +0 -0
- package/dist/cesium/Assets/Textures/maki/skiing.png +0 -0
- package/dist/cesium/Assets/Textures/maki/slaughterhouse.png +0 -0
- package/dist/cesium/Assets/Textures/maki/soccer.png +0 -0
- package/dist/cesium/Assets/Textures/maki/square-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/square.png +0 -0
- package/dist/cesium/Assets/Textures/maki/star-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/star.png +0 -0
- package/dist/cesium/Assets/Textures/maki/suitcase.png +0 -0
- package/dist/cesium/Assets/Textures/maki/swimming.png +0 -0
- package/dist/cesium/Assets/Textures/maki/telephone.png +0 -0
- package/dist/cesium/Assets/Textures/maki/tennis.png +0 -0
- package/dist/cesium/Assets/Textures/maki/theatre.png +0 -0
- package/dist/cesium/Assets/Textures/maki/toilets.png +0 -0
- package/dist/cesium/Assets/Textures/maki/town-hall.png +0 -0
- package/dist/cesium/Assets/Textures/maki/town.png +0 -0
- package/dist/cesium/Assets/Textures/maki/triangle-stroked.png +0 -0
- package/dist/cesium/Assets/Textures/maki/triangle.png +0 -0
- package/dist/cesium/Assets/Textures/maki/village.png +0 -0
- package/dist/cesium/Assets/Textures/maki/warehouse.png +0 -0
- package/dist/cesium/Assets/Textures/maki/waste-basket.png +0 -0
- package/dist/cesium/Assets/Textures/maki/water.png +0 -0
- package/dist/cesium/Assets/Textures/maki/wetland.png +0 -0
- package/dist/cesium/Assets/Textures/maki/zoo.png +0 -0
- package/dist/cesium/Assets/Textures/moonSmall.jpg +0 -0
- package/dist/cesium/Assets/Textures/pin.svg +0 -1
- package/dist/cesium/Assets/Textures/waterNormals.jpg +0 -0
- package/dist/cesium/Assets/Textures/waterNormalsSmall.jpg +0 -0
- package/dist/cesium/Assets/approximateTerrainHeights.json +0 -1
- package/dist/cesium/ThirdParty/Workers/package.json +0 -1
- package/dist/cesium/ThirdParty/Workers/pako_deflate.min.js +0 -1
- package/dist/cesium/ThirdParty/Workers/pako_inflate.min.js +0 -1
- package/dist/cesium/ThirdParty/Workers/z-worker-pako.js +0 -1
- package/dist/cesium/ThirdParty/basis_transcoder.wasm +0 -0
- package/dist/cesium/ThirdParty/draco_decoder.wasm +0 -0
- package/dist/cesium/ThirdParty/google-earth-dbroot-parser.js +0 -1
- package/dist/cesium/Widgets/Animation/Animation.css +0 -127
- package/dist/cesium/Widgets/Animation/lighter.css +0 -70
- package/dist/cesium/Widgets/BaseLayerPicker/BaseLayerPicker.css +0 -108
- package/dist/cesium/Widgets/BaseLayerPicker/lighter.css +0 -22
- package/dist/cesium/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.css +0 -102
- package/dist/cesium/Widgets/CesiumInspector/CesiumInspector.css +0 -113
- package/dist/cesium/Widgets/CesiumWidget/CesiumWidget.css +0 -124
- package/dist/cesium/Widgets/CesiumWidget/lighter.css +0 -14
- package/dist/cesium/Widgets/FullscreenButton/FullscreenButton.css +0 -8
- package/dist/cesium/Widgets/Geocoder/Geocoder.css +0 -70
- package/dist/cesium/Widgets/Geocoder/lighter.css +0 -17
- package/dist/cesium/Widgets/I3SBuildingSceneLayerExplorer/I3SBuildingSceneLayerExplorer.css +0 -27
- package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldHillshade.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldImagery.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/ArcGisMapServiceWorldOcean.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/bingAerial.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/bingAerialLabels.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/bingRoads.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/blueMarble.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/earthAtNight.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/mapQuestOpenStreetMap.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/mapboxSatellite.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/mapboxStreets.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/mapboxTerrain.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/naturalEarthII.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/openStreetMap.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/sentinel-2.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/stadiaAlidadeSmooth.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/stadiaAlidadeSmoothDark.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/stamenToner.png +0 -0
- package/dist/cesium/Widgets/Images/ImageryProviders/stamenWatercolor.png +0 -0
- package/dist/cesium/Widgets/Images/NavigationHelp/Mouse.svg +0 -84
- package/dist/cesium/Widgets/Images/NavigationHelp/MouseLeft.svg +0 -76
- package/dist/cesium/Widgets/Images/NavigationHelp/MouseMiddle.svg +0 -76
- package/dist/cesium/Widgets/Images/NavigationHelp/MouseRight.svg +0 -76
- package/dist/cesium/Widgets/Images/NavigationHelp/Touch.svg +0 -120
- package/dist/cesium/Widgets/Images/NavigationHelp/TouchDrag.svg +0 -129
- package/dist/cesium/Widgets/Images/NavigationHelp/TouchRotate.svg +0 -76
- package/dist/cesium/Widgets/Images/NavigationHelp/TouchTilt.svg +0 -135
- package/dist/cesium/Widgets/Images/NavigationHelp/TouchZoom.svg +0 -74
- package/dist/cesium/Widgets/Images/TerrainProviders/CesiumWorldTerrain.png +0 -0
- package/dist/cesium/Widgets/Images/TerrainProviders/Ellipsoid.png +0 -0
- package/dist/cesium/Widgets/Images/TimelineIcons.png +0 -0
- package/dist/cesium/Widgets/Images/info-loading.gif +0 -0
- package/dist/cesium/Widgets/InfoBox/InfoBox.css +0 -92
- package/dist/cesium/Widgets/InfoBox/InfoBoxDescription.css +0 -178
- package/dist/cesium/Widgets/NavigationHelpButton/NavigationHelpButton.css +0 -93
- package/dist/cesium/Widgets/NavigationHelpButton/lighter.css +0 -38
- package/dist/cesium/Widgets/PerformanceWatchdog/PerformanceWatchdog.css +0 -15
- package/dist/cesium/Widgets/ProjectionPicker/ProjectionPicker.css +0 -38
- package/dist/cesium/Widgets/SceneModePicker/SceneModePicker.css +0 -56
- package/dist/cesium/Widgets/SelectionIndicator/SelectionIndicator.css +0 -20
- package/dist/cesium/Widgets/Timeline/Timeline.css +0 -103
- package/dist/cesium/Widgets/Timeline/lighter.css +0 -23
- package/dist/cesium/Widgets/VRButton/VRButton.css +0 -8
- package/dist/cesium/Widgets/Viewer/Viewer.css +0 -107
- package/dist/cesium/Widgets/VoxelInspector/VoxelInspector.css +0 -16
- package/dist/cesium/Widgets/lighter.css +0 -237
- package/dist/cesium/Widgets/lighterShared.css +0 -46
- package/dist/cesium/Widgets/shared.css +0 -103
- package/dist/cesium/Widgets/widgets.css +0 -1346
- package/dist/cesium/Workers/chunk-2YD5QWGR.js +0 -28
- package/dist/cesium/Workers/chunk-3T4KR75X.js +0 -26
- package/dist/cesium/Workers/chunk-46KFVW24.js +0 -26
- package/dist/cesium/Workers/chunk-4EI6PP43.js +0 -28
- package/dist/cesium/Workers/chunk-4RS52VIY.js +0 -26
- package/dist/cesium/Workers/chunk-4YLYA3DC.js +0 -26
- package/dist/cesium/Workers/chunk-5ENAGXBI.js +0 -26
- package/dist/cesium/Workers/chunk-5VIB3TI5.js +0 -26
- package/dist/cesium/Workers/chunk-6NGZLDFZ.js +0 -26
- package/dist/cesium/Workers/chunk-6RGNWVZ2.js +0 -27
- package/dist/cesium/Workers/chunk-7AZZVJ52.js +0 -26
- package/dist/cesium/Workers/chunk-AMXAQQEL.js +0 -26
- package/dist/cesium/Workers/chunk-AQW44ZPC.js +0 -26
- package/dist/cesium/Workers/chunk-CPCMDW6Z.js +0 -26
- package/dist/cesium/Workers/chunk-DNL2WDRL.js +0 -26
- package/dist/cesium/Workers/chunk-ERW7V247.js +0 -26
- package/dist/cesium/Workers/chunk-EYRIA4TP.js +0 -26
- package/dist/cesium/Workers/chunk-F7RQIJML.js +0 -26
- package/dist/cesium/Workers/chunk-FPZMU6QP.js +0 -26
- package/dist/cesium/Workers/chunk-FZDVQW7A.js +0 -26
- package/dist/cesium/Workers/chunk-GAZ2U4FO.js +0 -26
- package/dist/cesium/Workers/chunk-I44IOOT4.js +0 -26
- package/dist/cesium/Workers/chunk-IALXUAD4.js +0 -26
- package/dist/cesium/Workers/chunk-IXBUEUZL.js +0 -26
- package/dist/cesium/Workers/chunk-J3GCYV5K.js +0 -26
- package/dist/cesium/Workers/chunk-KGSZTFHZ.js +0 -26
- package/dist/cesium/Workers/chunk-KKKPU2CI.js +0 -26
- package/dist/cesium/Workers/chunk-KTEJE5KE.js +0 -26
- package/dist/cesium/Workers/chunk-KYZ3DYY6.js +0 -26
- package/dist/cesium/Workers/chunk-L2QG4MRI.js +0 -26
- package/dist/cesium/Workers/chunk-MCE3KFYN.js +0 -26
- package/dist/cesium/Workers/chunk-MMLDGXML.js +0 -26
- package/dist/cesium/Workers/chunk-MTBRPBDQ.js +0 -26
- package/dist/cesium/Workers/chunk-OKT6VBRK.js +0 -26
- package/dist/cesium/Workers/chunk-PHYDKLSY.js +0 -26
- package/dist/cesium/Workers/chunk-PWPX3224.js +0 -26
- package/dist/cesium/Workers/chunk-QHOVE6WG.js +0 -26
- package/dist/cesium/Workers/chunk-QJ6MBL22.js +0 -26
- package/dist/cesium/Workers/chunk-QKO6VIG2.js +0 -26
- package/dist/cesium/Workers/chunk-QVEE4QL2.js +0 -26
- package/dist/cesium/Workers/chunk-RXQOQZ7S.js +0 -26
- package/dist/cesium/Workers/chunk-S3ZKQKMM.js +0 -26
- package/dist/cesium/Workers/chunk-SFEUMZSK.js +0 -26
- package/dist/cesium/Workers/chunk-T75MW4X3.js +0 -26
- package/dist/cesium/Workers/chunk-TVO2A75R.js +0 -66
- package/dist/cesium/Workers/chunk-UHR36K45.js +0 -27
- package/dist/cesium/Workers/chunk-UKJCDZOR.js +0 -26
- package/dist/cesium/Workers/chunk-VKVIYER6.js +0 -26
- package/dist/cesium/Workers/chunk-VPIQWTRZ.js +0 -26
- package/dist/cesium/Workers/chunk-XSX5HRFC.js +0 -26
- package/dist/cesium/Workers/chunk-Z5WQQHSL.js +0 -26
- package/dist/cesium/Workers/chunk-Z7B2VEL5.js +0 -26
- package/dist/cesium/Workers/combineGeometry.js +0 -26
- package/dist/cesium/Workers/createBoxGeometry.js +0 -26
- package/dist/cesium/Workers/createBoxOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createCircleGeometry.js +0 -26
- package/dist/cesium/Workers/createCircleOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createCoplanarPolygonGeometry.js +0 -26
- package/dist/cesium/Workers/createCoplanarPolygonOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createCorridorGeometry.js +0 -26
- package/dist/cesium/Workers/createCorridorOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createCylinderGeometry.js +0 -26
- package/dist/cesium/Workers/createCylinderOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createEllipseGeometry.js +0 -26
- package/dist/cesium/Workers/createEllipseOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createEllipsoidGeometry.js +0 -26
- package/dist/cesium/Workers/createEllipsoidOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createFrustumGeometry.js +0 -26
- package/dist/cesium/Workers/createFrustumOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createGeometry.js +0 -26
- package/dist/cesium/Workers/createGroundPolylineGeometry.js +0 -26
- package/dist/cesium/Workers/createPlaneGeometry.js +0 -26
- package/dist/cesium/Workers/createPlaneOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createPolygonGeometry.js +0 -26
- package/dist/cesium/Workers/createPolygonOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createPolylineGeometry.js +0 -26
- package/dist/cesium/Workers/createPolylineVolumeGeometry.js +0 -26
- package/dist/cesium/Workers/createPolylineVolumeOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createRectangleGeometry.js +0 -26
- package/dist/cesium/Workers/createRectangleOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createSimplePolylineGeometry.js +0 -26
- package/dist/cesium/Workers/createSphereGeometry.js +0 -26
- package/dist/cesium/Workers/createSphereOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/createTaskProcessorWorker.js +0 -26
- package/dist/cesium/Workers/createVectorTileClampedPolylines.js +0 -26
- package/dist/cesium/Workers/createVectorTileGeometries.js +0 -26
- package/dist/cesium/Workers/createVectorTilePoints.js +0 -26
- package/dist/cesium/Workers/createVectorTilePolygons.js +0 -26
- package/dist/cesium/Workers/createVectorTilePolylines.js +0 -26
- package/dist/cesium/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -26
- package/dist/cesium/Workers/createVerticesFromHeightmap.js +0 -26
- package/dist/cesium/Workers/createVerticesFromQuantizedTerrainMesh.js +0 -26
- package/dist/cesium/Workers/createWallGeometry.js +0 -26
- package/dist/cesium/Workers/createWallOutlineGeometry.js +0 -26
- package/dist/cesium/Workers/decodeDraco.js +0 -26
- package/dist/cesium/Workers/decodeGoogleEarthEnterprisePacket.js +0 -26
- package/dist/cesium/Workers/decodeI3S.js +0 -26
- package/dist/cesium/Workers/transcodeKTX2.js +0 -56
- package/dist/cesium/Workers/transferTypedArrayTest.js +0 -26
- package/dist/cesium/Workers/upsampleQuantizedTerrainMesh.js +0 -26
- package/src/engines/Cesium/core/Globe.tsx +0 -104
- /package/src/{Visualizer → shared}/featureFlags.ts +0 -0
- /package/src/{Map/Sketch/utils.ts → utils/use-window-event.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import LRUCache from "lru-cache";
|
|
2
|
-
import { useEffect, useMemo } from "react";
|
|
1
|
+
import { LRUCache } from "lru-cache";
|
|
2
|
+
import { useEffect, useMemo, type JSX } from "react";
|
|
3
3
|
|
|
4
4
|
import type { AppearanceTypes, FeatureComponentProps, ComputedLayer } from "../..";
|
|
5
5
|
import { ComputedFeature, DataType, guessType } from "../../../mantle";
|
|
@@ -65,6 +65,7 @@ const displayConfig: Record<DataType, (keyof typeof components)[] | "auto"> = {
|
|
|
65
65
|
tms: ["raster"],
|
|
66
66
|
"3dtiles": ["3dtiles"],
|
|
67
67
|
"osm-buildings": ["3dtiles"],
|
|
68
|
+
"reearth-buildings": ["3dtiles"],
|
|
68
69
|
"google-photorealistic": ["3dtiles"],
|
|
69
70
|
gpx: "auto",
|
|
70
71
|
shapefile: "auto",
|
|
@@ -96,6 +97,7 @@ const FEATURE_DELEGATE_THRESHOLD = 6000;
|
|
|
96
97
|
export default function Feature({
|
|
97
98
|
layer,
|
|
98
99
|
isHidden,
|
|
100
|
+
sketchEditingFeature,
|
|
99
101
|
...props
|
|
100
102
|
}: FeatureComponentProps): JSX.Element | null {
|
|
101
103
|
const data = extractSimpleLayerData(layer);
|
|
@@ -110,7 +112,19 @@ export default function Feature({
|
|
|
110
112
|
displayType.every(k => components[k][1].noFeature && !components[k][1].noLayer);
|
|
111
113
|
const useTransition = !!layer?.transition?.useTransition;
|
|
112
114
|
const cacheable = !data?.updateInterval && !useTransition;
|
|
113
|
-
const
|
|
115
|
+
const dataSourceKey = useMemo(
|
|
116
|
+
() =>
|
|
117
|
+
generateIDWithMD5(
|
|
118
|
+
JSON.stringify({
|
|
119
|
+
type: data?.type,
|
|
120
|
+
url: data?.url,
|
|
121
|
+
layers: data?.layers,
|
|
122
|
+
provider: data?.provider,
|
|
123
|
+
googleMapApiKey: data?.serviceTokens?.googleMapApiKey,
|
|
124
|
+
}),
|
|
125
|
+
),
|
|
126
|
+
[data?.type, data?.url, data?.layers, data?.provider, data?.serviceTokens?.googleMapApiKey],
|
|
127
|
+
);
|
|
114
128
|
|
|
115
129
|
const { requestRender } = useContext();
|
|
116
130
|
// TODO: Find a way to wait updating the entity
|
|
@@ -131,16 +145,19 @@ export default function Feature({
|
|
|
131
145
|
const useSceneSpecularEnvironmentMaps =
|
|
132
146
|
!!props.viewerProperty?.scene?.imageBasedLighting?.specularEnvironmentMaps;
|
|
133
147
|
|
|
134
|
-
const isVisible =
|
|
148
|
+
const isVisible =
|
|
149
|
+
layer.layer.visible !== false &&
|
|
150
|
+
!isHidden &&
|
|
151
|
+
!(sketchEditingFeature?.layerId === layer.id && sketchEditingFeature?.feature?.id === f?.id);
|
|
135
152
|
|
|
136
153
|
const componentId =
|
|
137
|
-
|
|
154
|
+
dataSourceKey +
|
|
138
155
|
generateIDWithMD5(
|
|
139
156
|
`${layer.id}_${
|
|
140
157
|
f?.id ?? ""
|
|
141
158
|
}_${k}_${isVisible}_${useSceneSphericalHarmonicCoefficients}_${useSceneSpecularEnvironmentMaps}_${
|
|
142
159
|
JSON.stringify(f?.[k]) ?? ""
|
|
143
|
-
}_${JSON.stringify(layer.transition) ?? ""}`,
|
|
160
|
+
}_${JSON.stringify(layer.transition) ?? ""}_${JSON.stringify(f?.geometry) ?? ""}`,
|
|
144
161
|
);
|
|
145
162
|
|
|
146
163
|
if (cacheable) {
|
|
@@ -172,7 +189,7 @@ export default function Feature({
|
|
|
172
189
|
<C
|
|
173
190
|
{...props}
|
|
174
191
|
key={!useTransition ? componentId : undefined}
|
|
175
|
-
id={!useTransition ? componentId : f?.id ?? layer.id}
|
|
192
|
+
id={!useTransition ? componentId : (f?.id ?? layer.id)}
|
|
176
193
|
property={f ? f[k] : layer[k] || pickProperty(k, layer)}
|
|
177
194
|
geometry={f?.geometry}
|
|
178
195
|
feature={f}
|
|
@@ -216,9 +233,9 @@ export default function Feature({
|
|
|
216
233
|
layer?.layer?.type === "simple" && !!layer?.layer?.["3dtiles"]?.specularEnvironmentMaps;
|
|
217
234
|
|
|
218
235
|
// "noFeature" component should be recreated when the following value is changed.
|
|
219
|
-
// data
|
|
236
|
+
// data source, Cesium Ion token, isVisible
|
|
220
237
|
const key =
|
|
221
|
-
|
|
238
|
+
dataSourceKey +
|
|
222
239
|
generateIDWithMD5(
|
|
223
240
|
`${
|
|
224
241
|
layer?.id || ""
|
|
@@ -238,7 +255,7 @@ export default function Feature({
|
|
|
238
255
|
})}
|
|
239
256
|
</>
|
|
240
257
|
);
|
|
241
|
-
}, [areAllDisplayTypeNoFeature, displayType, layer, isHidden,
|
|
258
|
+
}, [areAllDisplayTypeNoFeature, displayType, layer, isHidden, dataSourceKey, props]);
|
|
242
259
|
|
|
243
260
|
return (
|
|
244
261
|
<>
|
|
@@ -16,16 +16,17 @@ import {
|
|
|
16
16
|
Primitive,
|
|
17
17
|
GroundPrimitive,
|
|
18
18
|
} from "cesium";
|
|
19
|
-
import md5 from "js-md5";
|
|
20
|
-
import { pick } from "lodash-es";
|
|
19
|
+
import { md5 } from "js-md5";
|
|
20
|
+
import { cloneDeep, pick } from "lodash-es";
|
|
21
21
|
import {
|
|
22
22
|
ComponentProps,
|
|
23
23
|
ComponentType,
|
|
24
24
|
ForwardedRef,
|
|
25
25
|
forwardRef,
|
|
26
|
+
useCallback,
|
|
26
27
|
useLayoutEffect,
|
|
27
28
|
useMemo,
|
|
28
|
-
|
|
29
|
+
useState,
|
|
29
30
|
} from "react";
|
|
30
31
|
import { type CesiumComponentRef, Entity } from "resium";
|
|
31
32
|
|
|
@@ -86,10 +87,11 @@ function EntityExtComponent(
|
|
|
86
87
|
}: ComponentProps<typeof Entity> & Tag,
|
|
87
88
|
ref: ForwardedRef<CesiumComponentRef<CesiumEntity>>,
|
|
88
89
|
) {
|
|
89
|
-
const
|
|
90
|
+
const [entity, setEntity] = useState<CesiumComponentRef<CesiumEntity> | null>(null);
|
|
90
91
|
|
|
91
92
|
useLayoutEffect(() => {
|
|
92
|
-
|
|
93
|
+
if (!entity?.cesiumElement) return;
|
|
94
|
+
attachTag(entity.cesiumElement, {
|
|
93
95
|
layerId: layerId || props.id,
|
|
94
96
|
featureId,
|
|
95
97
|
draggable,
|
|
@@ -105,10 +107,12 @@ function EntityExtComponent(
|
|
|
105
107
|
props.id,
|
|
106
108
|
unselectable,
|
|
107
109
|
hideIndicator,
|
|
108
|
-
|
|
110
|
+
entity,
|
|
109
111
|
]);
|
|
110
112
|
|
|
111
|
-
|
|
113
|
+
const handleRef = useCallback((r: CesiumComponentRef<CesiumEntity>) => setEntity(r), []);
|
|
114
|
+
|
|
115
|
+
return <Entity ref={composeRefs(ref, handleRef)} {...props} />;
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
export function attachTag(
|
|
@@ -232,13 +236,20 @@ export const extractSimpleLayer = (
|
|
|
232
236
|
if (l?.type !== "simple") {
|
|
233
237
|
return;
|
|
234
238
|
}
|
|
235
|
-
|
|
239
|
+
// Proxy object lead to issues when creating mvt imagery provider, so convert to plain object
|
|
240
|
+
// Not sure for other types, but to keep consistency, convert all simple layers here
|
|
241
|
+
// It should be okey since simple layer data is supposed to be simple enough and computed data should not be included
|
|
242
|
+
return toPlainObject(l);
|
|
236
243
|
};
|
|
237
244
|
|
|
238
245
|
export const extractSimpleLayerData = (layer: ComputedLayer | undefined): Data | undefined => {
|
|
239
246
|
return extractSimpleLayer(layer)?.data;
|
|
240
247
|
};
|
|
241
248
|
|
|
249
|
+
export const toPlainObject = <T,>(obj: T): T => {
|
|
250
|
+
return cloneDeep(obj);
|
|
251
|
+
};
|
|
252
|
+
|
|
242
253
|
export const toColor = (c?: string) => {
|
|
243
254
|
if (!c || typeof c !== "string") return undefined;
|
|
244
255
|
|
|
@@ -274,10 +285,7 @@ export const toDistanceDisplayCondition = (
|
|
|
274
285
|
};
|
|
275
286
|
|
|
276
287
|
export const generateIDWithMD5 = (id: string) => {
|
|
277
|
-
|
|
278
|
-
hash.update(id);
|
|
279
|
-
|
|
280
|
-
return hash.hex();
|
|
288
|
+
return md5(id);
|
|
281
289
|
};
|
|
282
290
|
|
|
283
291
|
export const usePick = <T extends object, U extends keyof T>(
|
|
@@ -12,8 +12,7 @@ import {
|
|
|
12
12
|
} from "./createAmbientOcclusionStage";
|
|
13
13
|
|
|
14
14
|
export interface AmbientOcclusionProps
|
|
15
|
-
extends Omit<AmbientOcclusionStageOptions, "prefix">,
|
|
16
|
-
Partial<AmbientOcclusionStageUniforms> {
|
|
15
|
+
extends Omit<AmbientOcclusionStageOptions, "prefix">, Partial<AmbientOcclusionStageUniforms> {
|
|
17
16
|
enabled?: boolean;
|
|
18
17
|
}
|
|
19
18
|
|
|
@@ -83,7 +82,11 @@ export const AmbientOcclusionStage = ({
|
|
|
83
82
|
|
|
84
83
|
usePreRender(() => {
|
|
85
84
|
const frustum = scene?.camera.frustum;
|
|
86
|
-
if (
|
|
85
|
+
if (
|
|
86
|
+
frustum instanceof PerspectiveFrustum &&
|
|
87
|
+
frustum.fovy !== undefined &&
|
|
88
|
+
frustum.aspectRatio !== undefined
|
|
89
|
+
) {
|
|
87
90
|
const cotFovy = 1 / Math.tan(frustum.fovy / 2);
|
|
88
91
|
stage.uniforms.focalLength.x = cotFovy * frustum.aspectRatio;
|
|
89
92
|
stage.uniforms.focalLength.y = cotFovy;
|
|
@@ -111,7 +114,7 @@ export const AmbientOcclusion: FC<AmbientOcclusionProps> = props => {
|
|
|
111
114
|
// Screen-space camera controller should detect collision
|
|
112
115
|
const cameraHeight = scene.camera.positionCartographic.height - globeHeight;
|
|
113
116
|
const frustum = scene?.camera.frustum;
|
|
114
|
-
if (frustum instanceof PerspectiveFrustum) {
|
|
117
|
+
if (frustum instanceof PerspectiveFrustum && frustum.fov !== undefined) {
|
|
115
118
|
scene.camera.frustum.near =
|
|
116
119
|
CesiumMath.clamp(cameraHeight - 1, 1, 5) / Math.tan(frustum.fov / 2);
|
|
117
120
|
}
|
|
@@ -5,37 +5,42 @@ import {
|
|
|
5
5
|
type PositionProperty,
|
|
6
6
|
type Property,
|
|
7
7
|
} from "@cesium/engine";
|
|
8
|
-
import { useMemo, useRef, type FC } from "react";
|
|
8
|
+
import { useCallback, useMemo, useRef, type FC } from "react";
|
|
9
9
|
import { Entity } from "resium";
|
|
10
10
|
import invariant from "tiny-invariant";
|
|
11
11
|
|
|
12
12
|
import { useConstant } from "../../../utils";
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
import { ADDING_POINT_COLOR, DEFAULT_EDIT_COLOR, SELECTED_EDIT_COLOR } from "./constants";
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
image.height = 16;
|
|
23
|
-
const context = image.getContext("2d");
|
|
24
|
-
invariant(context != null);
|
|
25
|
-
context.fillStyle = "white";
|
|
26
|
-
context.fillRect(3, 3, 10, 10);
|
|
27
|
-
context.strokeStyle = "black";
|
|
28
|
-
context.lineWidth = 2;
|
|
29
|
-
context.strokeRect(3, 3, 10, 10);
|
|
30
|
-
return image;
|
|
31
|
-
}
|
|
16
|
+
import { ControlPointMouseEventHandler } from ".";
|
|
17
|
+
|
|
18
|
+
let drawPointImage: HTMLCanvasElement | undefined;
|
|
19
|
+
let editPointImage: HTMLCanvasElement | undefined;
|
|
20
|
+
let selectedPointImage: HTMLCanvasElement | undefined;
|
|
21
|
+
let addingPointImage: HTMLCanvasElement | undefined;
|
|
32
22
|
|
|
33
23
|
export interface ControlPointProps {
|
|
34
24
|
position: Property | Cartesian3;
|
|
35
25
|
clampToGround?: boolean;
|
|
26
|
+
index: number;
|
|
27
|
+
isEditing?: boolean;
|
|
28
|
+
isSelected?: boolean;
|
|
29
|
+
isAddingPoint?: boolean;
|
|
30
|
+
isExtrudedControlPoint?: boolean;
|
|
31
|
+
handleControlPointMouseEvent?: ControlPointMouseEventHandler;
|
|
36
32
|
}
|
|
37
33
|
|
|
38
|
-
export const ControlPoint: FC<ControlPointProps> = ({
|
|
34
|
+
export const ControlPoint: FC<ControlPointProps> = ({
|
|
35
|
+
position,
|
|
36
|
+
clampToGround = false,
|
|
37
|
+
index,
|
|
38
|
+
isEditing,
|
|
39
|
+
isSelected,
|
|
40
|
+
isAddingPoint,
|
|
41
|
+
isExtrudedControlPoint,
|
|
42
|
+
handleControlPointMouseEvent,
|
|
43
|
+
}) => {
|
|
39
44
|
const positionRef = useRef(position);
|
|
40
45
|
positionRef.current = position;
|
|
41
46
|
const positionProperty = useConstant(
|
|
@@ -53,15 +58,114 @@ export const ControlPoint: FC<ControlPointProps> = ({ position, clampToGround =
|
|
|
53
58
|
() => ({
|
|
54
59
|
position: positionProperty,
|
|
55
60
|
billboard: {
|
|
56
|
-
image:
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
image: isEditing
|
|
62
|
+
? isAddingPoint
|
|
63
|
+
? getAddingPointImage()
|
|
64
|
+
: isSelected
|
|
65
|
+
? getSelectedPointImage()
|
|
66
|
+
: getEditPointImage()
|
|
67
|
+
: getDrawPointImage(),
|
|
68
|
+
width: isEditing ? 16 : 8,
|
|
69
|
+
height: isEditing ? 16 : 8,
|
|
59
70
|
heightReference: clampToGround ? HeightReference.CLAMP_TO_GROUND : HeightReference.NONE,
|
|
60
71
|
disableDepthTestDistance: Infinity,
|
|
61
72
|
},
|
|
62
73
|
}),
|
|
63
|
-
[clampToGround, positionProperty],
|
|
74
|
+
[clampToGround, positionProperty, isAddingPoint, isEditing, isSelected],
|
|
64
75
|
);
|
|
65
76
|
|
|
66
|
-
|
|
77
|
+
const handleMouseDown = useCallback(() => {
|
|
78
|
+
handleControlPointMouseEvent?.(index, !!isExtrudedControlPoint, "mousedown");
|
|
79
|
+
}, [index, isExtrudedControlPoint, handleControlPointMouseEvent]);
|
|
80
|
+
|
|
81
|
+
const handleMouseClick = useCallback(() => {
|
|
82
|
+
handleControlPointMouseEvent?.(index, !!isExtrudedControlPoint, "click");
|
|
83
|
+
}, [index, isExtrudedControlPoint, handleControlPointMouseEvent]);
|
|
84
|
+
|
|
85
|
+
return <Entity {...options} onMouseDown={handleMouseDown} onClick={handleMouseClick} />;
|
|
67
86
|
};
|
|
87
|
+
|
|
88
|
+
function getDrawPointImage(): HTMLCanvasElement {
|
|
89
|
+
if (drawPointImage != null) {
|
|
90
|
+
return drawPointImage;
|
|
91
|
+
}
|
|
92
|
+
drawPointImage = document.createElement("canvas");
|
|
93
|
+
drawPointImage.width = 16;
|
|
94
|
+
drawPointImage.height = 16;
|
|
95
|
+
const ctx = drawPointImage.getContext("2d");
|
|
96
|
+
invariant(ctx != null);
|
|
97
|
+
ctx.fillStyle = "white";
|
|
98
|
+
ctx.fillRect(3, 3, 10, 10);
|
|
99
|
+
ctx.strokeStyle = "black";
|
|
100
|
+
ctx.lineWidth = 2;
|
|
101
|
+
ctx.strokeRect(3, 3, 10, 10);
|
|
102
|
+
return drawPointImage;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function getEditPointImage(): HTMLCanvasElement {
|
|
106
|
+
return getImage(editPointImage, {
|
|
107
|
+
size: 32,
|
|
108
|
+
color: "white",
|
|
109
|
+
strokeColor: DEFAULT_EDIT_COLOR,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function getSelectedPointImage(): HTMLCanvasElement {
|
|
114
|
+
return getImage(selectedPointImage, {
|
|
115
|
+
size: 32,
|
|
116
|
+
color: "white",
|
|
117
|
+
strokeColor: SELECTED_EDIT_COLOR,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function getAddingPointImage(): HTMLCanvasElement {
|
|
122
|
+
if (addingPointImage != null) {
|
|
123
|
+
return addingPointImage;
|
|
124
|
+
}
|
|
125
|
+
addingPointImage = document.createElement("canvas");
|
|
126
|
+
addingPointImage.width = 32;
|
|
127
|
+
addingPointImage.height = 32;
|
|
128
|
+
const ctx = addingPointImage.getContext("2d");
|
|
129
|
+
invariant(ctx != null);
|
|
130
|
+
ctx.beginPath();
|
|
131
|
+
ctx.arc(16, 16, 12, 0, 2 * Math.PI);
|
|
132
|
+
ctx.fillStyle = "white";
|
|
133
|
+
ctx.fill();
|
|
134
|
+
ctx.strokeStyle = ADDING_POINT_COLOR;
|
|
135
|
+
ctx.lineWidth = 4;
|
|
136
|
+
ctx.stroke();
|
|
137
|
+
ctx.beginPath();
|
|
138
|
+
ctx.moveTo(16, 8);
|
|
139
|
+
ctx.lineTo(16, 24);
|
|
140
|
+
ctx.stroke();
|
|
141
|
+
ctx.moveTo(8, 16);
|
|
142
|
+
ctx.lineTo(24, 16);
|
|
143
|
+
ctx.stroke();
|
|
144
|
+
return addingPointImage;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function getImage(
|
|
148
|
+
canvas: HTMLCanvasElement | undefined,
|
|
149
|
+
options: {
|
|
150
|
+
size: number;
|
|
151
|
+
color: string;
|
|
152
|
+
strokeColor: string;
|
|
153
|
+
},
|
|
154
|
+
): HTMLCanvasElement {
|
|
155
|
+
if (canvas != null) {
|
|
156
|
+
return canvas;
|
|
157
|
+
}
|
|
158
|
+
canvas = document.createElement("canvas");
|
|
159
|
+
canvas.width = options.size;
|
|
160
|
+
canvas.height = options.size;
|
|
161
|
+
const ctx = canvas.getContext("2d");
|
|
162
|
+
invariant(ctx != null);
|
|
163
|
+
ctx.beginPath();
|
|
164
|
+
ctx.arc(options.size / 2, options.size / 2, options.size / 2 - 4, 0, 2 * Math.PI);
|
|
165
|
+
ctx.fillStyle = options.color;
|
|
166
|
+
ctx.fill();
|
|
167
|
+
ctx.strokeStyle = options.strokeColor;
|
|
168
|
+
ctx.lineWidth = 4;
|
|
169
|
+
ctx.stroke();
|
|
170
|
+
return canvas;
|
|
171
|
+
}
|
|
@@ -1,46 +1,91 @@
|
|
|
1
|
-
import { Cartesian3,
|
|
1
|
+
import { Cartesian3, Color } from "@cesium/engine";
|
|
2
2
|
import { memo, type FC } from "react";
|
|
3
|
-
import { useCesium } from "resium";
|
|
4
|
-
import invariant from "tiny-invariant";
|
|
5
3
|
|
|
4
|
+
import { Position3d } from "../../../types";
|
|
5
|
+
|
|
6
|
+
import { DEFAULT_EDIT_COLOR } from "./constants";
|
|
6
7
|
import { ControlPoint } from "./ControlPoint";
|
|
7
8
|
import { type GeometryOptions } from "./createGeometry";
|
|
8
9
|
import { ExtrudedMeasurement } from "./ExtrudedMeasurement";
|
|
9
10
|
|
|
11
|
+
import { ControlPointMouseEventHandler } from ".";
|
|
12
|
+
|
|
10
13
|
export interface ExtrudedControlPointsProps {
|
|
11
14
|
geometryOptions: GeometryOptions;
|
|
12
15
|
extrudedHeight: number;
|
|
16
|
+
extrudedPoint?: Position3d;
|
|
17
|
+
centroidBasePoint?: Position3d;
|
|
18
|
+
centroidExtrudedPoint?: Position3d;
|
|
19
|
+
catchedExtrudedPoint?: boolean;
|
|
13
20
|
color?: Color;
|
|
21
|
+
isEditing?: boolean;
|
|
22
|
+
handleControlPointMouseEvent?: ControlPointMouseEventHandler;
|
|
14
23
|
}
|
|
15
24
|
|
|
16
|
-
const cartesianScratch = new Cartesian3();
|
|
17
|
-
|
|
18
25
|
const ExtrudedControlPoints: FC<ExtrudedControlPointsProps> = memo(
|
|
19
|
-
({
|
|
20
|
-
|
|
26
|
+
({
|
|
27
|
+
geometryOptions: { controlPoints, type },
|
|
28
|
+
extrudedHeight,
|
|
29
|
+
color,
|
|
30
|
+
isEditing,
|
|
31
|
+
extrudedPoint: extrudedPointPosition,
|
|
32
|
+
centroidBasePoint: extrudeBasePointPosition,
|
|
33
|
+
centroidExtrudedPoint: extrudeControlPointPosition,
|
|
34
|
+
catchedExtrudedPoint,
|
|
35
|
+
handleControlPointMouseEvent,
|
|
36
|
+
}) => {
|
|
21
37
|
const controlPoint = controlPoints[controlPoints.length - 1];
|
|
22
|
-
const normal = viewer?.scene?.globe.ellipsoid.geodeticSurfaceNormal(
|
|
23
|
-
controlPoint,
|
|
24
|
-
cartesianScratch,
|
|
25
|
-
);
|
|
26
38
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
39
|
+
const extrudedPoint = extrudedPointPosition
|
|
40
|
+
? new Cartesian3(...extrudedPointPosition)
|
|
41
|
+
: undefined;
|
|
42
|
+
|
|
43
|
+
const heightBasePoint = extrudeBasePointPosition
|
|
44
|
+
? new Cartesian3(...extrudeBasePointPosition)
|
|
45
|
+
: undefined;
|
|
46
|
+
|
|
47
|
+
const centroidExtrudedPoint = extrudeControlPointPosition
|
|
48
|
+
? new Cartesian3(...extrudeControlPointPosition)
|
|
49
|
+
: undefined;
|
|
33
50
|
|
|
34
51
|
return (
|
|
35
52
|
<>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
{extrudedPoint && (
|
|
54
|
+
<>
|
|
55
|
+
<ControlPoint
|
|
56
|
+
index={-1}
|
|
57
|
+
position={extrudedPoint}
|
|
58
|
+
isEditing={isEditing}
|
|
59
|
+
isExtrudedControlPoint
|
|
60
|
+
handleControlPointMouseEvent={handleControlPointMouseEvent}
|
|
61
|
+
/>
|
|
62
|
+
{(!isEditing || catchedExtrudedPoint) && (
|
|
63
|
+
<ExtrudedMeasurement
|
|
64
|
+
a={controlPoint}
|
|
65
|
+
b={extrudedPoint}
|
|
66
|
+
extrudedHeight={extrudedHeight}
|
|
67
|
+
color={isEditing ? Color.fromCssColorString(DEFAULT_EDIT_COLOR) : color}
|
|
68
|
+
showLine={type !== "extrudedPolygon"}
|
|
69
|
+
/>
|
|
70
|
+
)}
|
|
71
|
+
</>
|
|
72
|
+
)}
|
|
73
|
+
{heightBasePoint && (
|
|
74
|
+
<ControlPoint
|
|
75
|
+
index={-1}
|
|
76
|
+
position={heightBasePoint}
|
|
77
|
+
isEditing={isEditing}
|
|
78
|
+
isExtrudedControlPoint
|
|
79
|
+
/>
|
|
80
|
+
)}
|
|
81
|
+
{centroidExtrudedPoint && (
|
|
82
|
+
<ControlPoint
|
|
83
|
+
index={-1}
|
|
84
|
+
position={centroidExtrudedPoint}
|
|
85
|
+
isEditing={isEditing}
|
|
86
|
+
isExtrudedControlPoint
|
|
87
|
+
/>
|
|
88
|
+
)}
|
|
44
89
|
</>
|
|
45
90
|
);
|
|
46
91
|
},
|
|
@@ -46,6 +46,7 @@ export interface ExtrudedMeasurementProps {
|
|
|
46
46
|
b: Cartesian3;
|
|
47
47
|
extrudedHeight: number;
|
|
48
48
|
color?: Color;
|
|
49
|
+
showLine?: boolean;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
export const ExtrudedMeasurement: FC<ExtrudedMeasurementProps> = ({
|
|
@@ -53,6 +54,7 @@ export const ExtrudedMeasurement: FC<ExtrudedMeasurementProps> = ({
|
|
|
53
54
|
b,
|
|
54
55
|
extrudedHeight,
|
|
55
56
|
color,
|
|
57
|
+
showLine,
|
|
56
58
|
}) => {
|
|
57
59
|
const position = useConstant(() => new Cartesian3());
|
|
58
60
|
return (
|
|
@@ -64,7 +66,7 @@ export const ExtrudedMeasurement: FC<ExtrudedMeasurementProps> = ({
|
|
|
64
66
|
: `${(extrudedHeight / 1000).toFixed(1)} km`}
|
|
65
67
|
</MeasurementText>
|
|
66
68
|
</ScreenSpaceElement>
|
|
67
|
-
<MeasurementLine a={a} b={b} color={color} />
|
|
69
|
+
{showLine && <MeasurementLine a={a} b={b} color={color} />}
|
|
68
70
|
</>
|
|
69
71
|
);
|
|
70
72
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CallbackProperty,
|
|
3
3
|
ClassificationType,
|
|
4
|
+
Color,
|
|
4
5
|
ColorMaterialProperty,
|
|
5
6
|
HeightReference,
|
|
6
7
|
ShadowMode,
|
|
7
|
-
type Color,
|
|
8
8
|
type PolygonHierarchy,
|
|
9
9
|
} from "@cesium/engine";
|
|
10
10
|
import { useMemo, useRef, type FC } from "react";
|
|
@@ -12,60 +12,60 @@ import { useMemo, useRef, type FC } from "react";
|
|
|
12
12
|
import { useConstant } from "../../../utils";
|
|
13
13
|
import { useContext } from "../Feature/context";
|
|
14
14
|
|
|
15
|
+
import { DEFAULT_EDIT_COLOR } from "./constants";
|
|
15
16
|
import { Entity, type EntityProps } from "./Entity";
|
|
16
17
|
|
|
17
18
|
export interface ExtrudedPolygonEntityProps {
|
|
18
|
-
dynamic?: boolean;
|
|
19
19
|
id?: string;
|
|
20
20
|
hierarchy: PolygonHierarchy;
|
|
21
21
|
extrudedHeight: number;
|
|
22
22
|
color?: Color;
|
|
23
23
|
disableShadow?: boolean;
|
|
24
|
-
|
|
24
|
+
isEditing?: boolean;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export const ExtrudedPolygonEntity: FC<ExtrudedPolygonEntityProps> = ({
|
|
28
|
-
dynamic = false,
|
|
29
28
|
id,
|
|
30
29
|
hierarchy: hierarchyProp,
|
|
31
30
|
extrudedHeight: extrudedHeightProp,
|
|
32
31
|
color,
|
|
33
32
|
disableShadow = false,
|
|
34
|
-
|
|
33
|
+
isEditing,
|
|
35
34
|
}) => {
|
|
36
35
|
const hierarchyRef = useRef(hierarchyProp);
|
|
37
36
|
hierarchyRef.current = hierarchyProp;
|
|
38
37
|
const hierarchyProperty = useConstant(
|
|
39
38
|
() => new CallbackProperty(() => hierarchyRef.current, false),
|
|
40
39
|
);
|
|
41
|
-
const hierarchy =
|
|
40
|
+
const hierarchy = hierarchyProperty;
|
|
42
41
|
|
|
43
42
|
const extrudedHeightRef = useRef(extrudedHeightProp);
|
|
44
43
|
extrudedHeightRef.current = extrudedHeightProp;
|
|
45
44
|
const extrudedHeightProperty = useConstant(
|
|
46
45
|
() => new CallbackProperty(() => extrudedHeightRef.current, false),
|
|
47
46
|
);
|
|
48
|
-
const extrudedHeight =
|
|
47
|
+
const extrudedHeight = extrudedHeightProperty;
|
|
49
48
|
|
|
50
49
|
const options = useMemo(
|
|
51
50
|
(): EntityProps => ({
|
|
52
51
|
polygon: {
|
|
53
52
|
hierarchy,
|
|
53
|
+
heightReference: HeightReference.RELATIVE_TO_TERRAIN,
|
|
54
54
|
extrudedHeight,
|
|
55
|
-
extrudedHeightReference: HeightReference.
|
|
55
|
+
extrudedHeightReference: HeightReference.RELATIVE_TO_TERRAIN,
|
|
56
|
+
// extrudedHeightReference: HeightReference.NONE,
|
|
56
57
|
fill: true,
|
|
57
58
|
outline: true,
|
|
58
59
|
outlineWidth: 1,
|
|
59
|
-
outlineColor:
|
|
60
|
-
|
|
60
|
+
outlineColor: isEditing
|
|
61
|
+
? Color.fromCssColorString(DEFAULT_EDIT_COLOR)
|
|
62
|
+
: color?.withAlpha(1),
|
|
63
|
+
material: new ColorMaterialProperty(isEditing ? color?.withAlpha(0.2) : color),
|
|
61
64
|
classificationType: ClassificationType.TERRAIN,
|
|
62
65
|
shadows: disableShadow ? ShadowMode.DISABLED : ShadowMode.ENABLED,
|
|
63
|
-
...(enableRelativeHeight
|
|
64
|
-
? { height: 0, heightReference: HeightReference.RELATIVE_TO_GROUND }
|
|
65
|
-
: undefined),
|
|
66
66
|
},
|
|
67
67
|
}),
|
|
68
|
-
[extrudedHeight, disableShadow, hierarchy, color,
|
|
68
|
+
[extrudedHeight, disableShadow, hierarchy, color, isEditing],
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
const { requestRender } = useContext();
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import { CallbackProperty, ClassificationType,
|
|
1
|
+
import { CallbackProperty, ClassificationType, Color, type Cartesian3 } from "@cesium/engine";
|
|
2
2
|
import { useMemo, useRef, type FC } from "react";
|
|
3
3
|
|
|
4
4
|
import { useConstant } from "../../../utils";
|
|
5
5
|
import { useContext } from "../Feature/context";
|
|
6
6
|
|
|
7
|
+
import { DEFAULT_EDIT_COLOR } from "./constants";
|
|
7
8
|
import { Entity, type EntityProps } from "./Entity";
|
|
8
9
|
|
|
9
10
|
export interface PolylineEntityProps {
|
|
10
11
|
dynamic?: boolean;
|
|
11
12
|
positions: Cartesian3[];
|
|
12
13
|
color?: Color;
|
|
14
|
+
isEditing?: boolean;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export const PolylineEntity: FC<PolylineEntityProps> = ({
|
|
16
18
|
dynamic = false,
|
|
17
19
|
positions: positionsProp,
|
|
18
20
|
color,
|
|
21
|
+
isEditing,
|
|
19
22
|
}) => {
|
|
20
23
|
const positionsRef = useRef(positionsProp);
|
|
21
24
|
positionsRef.current = positionsProp;
|
|
@@ -28,13 +31,13 @@ export const PolylineEntity: FC<PolylineEntityProps> = ({
|
|
|
28
31
|
(): EntityProps => ({
|
|
29
32
|
polyline: {
|
|
30
33
|
positions,
|
|
31
|
-
width: 1.5,
|
|
32
|
-
material: color,
|
|
34
|
+
width: isEditing ? 1.5 : 1.5,
|
|
35
|
+
material: isEditing ? Color.fromCssColorString(DEFAULT_EDIT_COLOR) : color,
|
|
33
36
|
classificationType: ClassificationType.TERRAIN,
|
|
34
37
|
clampToGround: true,
|
|
35
38
|
},
|
|
36
39
|
}),
|
|
37
|
-
[color, positions],
|
|
40
|
+
[color, positions, isEditing],
|
|
38
41
|
);
|
|
39
42
|
|
|
40
43
|
const { requestRender } = useContext();
|