This commit is contained in:
cracklesparkle
2025-01-10 11:38:00 +09:00
parent 59fded5cab
commit 2bf657e8ed
10 changed files with 855 additions and 210 deletions

View File

@ -19,6 +19,7 @@ interface MapState {
statusText: string;
satMapsProvider: SatelliteMapsProvider;
selectedObjectType: number | null;
alignMode: boolean;
}
export const useMapStore = create<MapState>(() => ({
@ -35,6 +36,7 @@ export const useMapStore = create<MapState>(() => ({
statusText: '',
satMapsProvider: 'google',
selectedObjectType: null,
alignMode: false
}));
const setCurrentZ = (z: number | undefined) => useMapStore.setState(() => ({ currentZ: z }))
@ -45,26 +47,21 @@ const setStatusText = (t: string) => useMapStore.setState(() => ({ statusText: t
const setSatMapsProvider = (p: SatelliteMapsProvider) => useMapStore.setState(() => ({ satMapsProvider: p }))
const setSelectedObjectType = (t: number | null) => useMapStore.setState(() => ({ selectedObjectType: t }))
const setMap = (m: Map | null) => useMapStore.setState(() => ({ map: m }))
const setAlignMode = (m: boolean) => useMapStore.setState(() => ({ alignMode: m }))
const setTipPoint = (tipPoint: Point | null) => {
useMapStore.setState(() => ({ tipPoint: tipPoint }))
}
const getTipPoint = () => {
return useMapStore.getState().tipPoint
}
const getTipPoint = () => useMapStore.getState().tipPoint
const getMap = () => {
return useMapStore.getState().map
}
const getAlignMode = () => useMapStore.getState().alignMode
const setMeasureType = (tool: "LineString" | "Polygon") => {
useMapStore.setState(() => ({ measureType: tool }))
}
const getMap = () => useMapStore.getState().map
const getMeasureType = () => {
return useMapStore.getState().measureType
}
const setMeasureType = (tool: "LineString" | "Polygon") => useMapStore.setState(() => ({ measureType: tool }))
const getMeasureType = () => useMapStore.getState().measureType
const setCurrentTool = (tool: ToolType) => {
tool === useMapStore.getState().currentTool
@ -72,17 +69,11 @@ const setCurrentTool = (tool: ToolType) => {
: useMapStore.setState(() => ({ currentTool: tool }))
}
const getCurrentTool = () => {
return useMapStore.getState().currentTool
}
const getCurrentTool = () => useMapStore.getState().currentTool
const getMeasureShowSegments = () => {
return useMapStore.getState().measureShowSegments
}
const getMeasureShowSegments = () => useMapStore.getState().measureShowSegments
const getMeasureClearPrevious = () => {
return useMapStore.getState().measureClearPrevious
}
const getMeasureClearPrevious = () => useMapStore.getState().measureClearPrevious
const setMeasureShowSegments = (bool: boolean) => {
useMapStore.setState(() => ({ measureShowSegments: bool }))
@ -111,5 +102,7 @@ export {
setSatMapsProvider,
setSelectedObjectType,
setMap,
getMap
getMap,
setAlignMode,
getAlignMode
}