From bf0b81b573afb3b7d88cd9ac5c2e3abbbceca5da Mon Sep 17 00:00:00 2001 From: lby Date: Thu, 9 Jan 2025 17:37:55 +0800 Subject: [PATCH] feat: support spatial id (#64) --- example/App.tsx | 6 + example/components/OptionsPanel/index.tsx | 21 ++ example/components/ui/slider.tsx | 26 ++ example/hooks.ts | 18 +- package.json | 2 + src/Map/Sketch/hooks.ts | 30 +- src/Map/SpatialId/hooks.ts | 293 +++++++++++++++++++ src/Map/SpatialId/index.tsx | 36 +++ src/Map/SpatialId/types.ts | 45 +++ src/Map/SpatialId/utils.ts | 79 +++++ src/Map/hooks.ts | 23 +- src/Map/index.tsx | 11 + src/Map/ref.ts | 11 + src/Map/types/index.ts | 1 + src/Visualizer/hooks.ts | 1 + src/Visualizer/index.tsx | 3 +- src/Visualizer/interactionMode.ts | 3 +- src/engines/Cesium/Feature/Polygon/index.tsx | 8 +- src/engines/Cesium/SpatialId/index.tsx | 42 +++ src/engines/Cesium/common.ts | 5 +- src/engines/Cesium/hooks/useEngineRef.ts | 5 +- src/mantle/types/appearance.ts | 1 + yarn.lock | 60 ++++ 23 files changed, 713 insertions(+), 17 deletions(-) create mode 100644 example/components/ui/slider.tsx create mode 100644 src/Map/SpatialId/hooks.ts create mode 100644 src/Map/SpatialId/index.tsx create mode 100644 src/Map/SpatialId/types.ts create mode 100644 src/Map/SpatialId/utils.ts create mode 100644 src/engines/Cesium/SpatialId/index.tsx diff --git a/example/App.tsx b/example/App.tsx index f2b68e5..d10bbfa 100644 --- a/example/App.tsx +++ b/example/App.tsx @@ -37,6 +37,9 @@ function App() { handleDeleteSketchFeature, handleCreditsUpdate, handleGetCredits, + handleSpatialIdPick, + spatialIdZoom, + handleSpatialIdZoomChange, } = useHooks(); return ( @@ -61,6 +64,9 @@ function App() { handleApplyEditSketchFeature={handleApplyEditSketchFeature} handleDeleteSketchFeature={handleDeleteSketchFeature} handleGetCredits={handleGetCredits} + handleSpatialIdPick={handleSpatialIdPick} + spatialIdZoom={spatialIdZoom} + handleSpatialIdZoomChange={handleSpatialIdZoomChange} /> void; handleDeleteSketchFeature: () => void; handleGetCredits: () => void; + handleSpatialIdPick: () => void; + spatialIdZoom: number; + handleSpatialIdZoomChange: (v: number[]) => void; }; const OptionsPanel: FC = ({ @@ -59,6 +63,9 @@ const OptionsPanel: FC = ({ handleApplyEditSketchFeature, handleDeleteSketchFeature, handleGetCredits, + handleSpatialIdPick, + spatialIdZoom, + handleSpatialIdZoomChange, }) => { const [open, setOpen] = useState(false); @@ -176,6 +183,20 @@ const OptionsPanel: FC = ({ + + + + +