基于高德地图JS api开发的geojson编辑器.
http://geojson.finevis.cc/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
947 B
30 lines
947 B
import produce from "immer"; |
|
import { initState } from "../../initState"; |
|
import { IOverlay, OverlayNamePrefixs } from "@store"; |
|
import { OverlayTypes } from "@types"; |
|
|
|
export function createOverlay(state = initState, payload: any) { |
|
return produce(state, (draft) => { |
|
draft.map.status = "createOverlay"; |
|
draft.map.overlayType = payload as OverlayTypes; |
|
}); |
|
} |
|
|
|
export function finishCreateOverlay(state = initState, payload: any) { |
|
return produce(state, (draft) => { |
|
const overlay = payload as IOverlay; |
|
const { type } = overlay; |
|
// todo: uniqueName. |
|
overlay.name = OverlayNamePrefixs[type] + overlay.id; |
|
draft.map.status = ""; |
|
draft.map.overlayType = null; |
|
(type === OverlayTypes.Rectangle |
|
? draft.map.rectangles |
|
: type === OverlayTypes.Circle |
|
? draft.map.circles |
|
: type === OverlayTypes.Polygon |
|
? draft.map.polygons |
|
: draft.map.polylines |
|
).push(overlay); |
|
}); |
|
}
|
|
|