|
|
@ -1,9 +1,11 @@ |
|
|
|
|
|
|
|
import { message, Popconfirm, Modal } from "antd"; |
|
|
|
|
|
|
|
import { registerHotkey, downloadJSON } from "@utils"; |
|
|
|
|
|
|
|
|
|
|
|
import { IStore } from "./type"; |
|
|
|
import { IStore } from "./type"; |
|
|
|
import { registerHotkey } from "@utils"; |
|
|
|
import { getGeoJSON } from "./utils"; |
|
|
|
import { getGeoJSON } from "./utils/getGeoJSON"; |
|
|
|
|
|
|
|
import { OverlayTypes } from "../types/enum"; |
|
|
|
import { OverlayTypes } from "../types/enum"; |
|
|
|
import { EditorAction } from "./actions"; |
|
|
|
import { EditorAction } from "./actions"; |
|
|
|
import { downloadJSON } from "../utils/download"; |
|
|
|
|
|
|
|
interface IGlobalController { |
|
|
|
interface IGlobalController { |
|
|
|
saveGeoJSON: () => void; |
|
|
|
saveGeoJSON: () => void; |
|
|
|
saveProject: () => void; |
|
|
|
saveProject: () => void; |
|
|
@ -16,6 +18,7 @@ interface IGlobalController { |
|
|
|
createPolygon: () => void; |
|
|
|
createPolygon: () => void; |
|
|
|
createPolyline: () => void; |
|
|
|
createPolyline: () => void; |
|
|
|
createCircle: () => void; |
|
|
|
createCircle: () => void; |
|
|
|
|
|
|
|
deleteOverlays: () => void; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 全局控制器, 用以复用一些快捷方法.
|
|
|
|
// 全局控制器, 用以复用一些快捷方法.
|
|
|
@ -72,12 +75,24 @@ export class GlobelController implements IGlobalController { |
|
|
|
this._store.dispatch(EditorAction.createOverlay(type)); |
|
|
|
this._store.dispatch(EditorAction.createOverlay(type)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deleteOverlays() { |
|
|
|
|
|
|
|
const { selectedIds } = this.mapState; |
|
|
|
|
|
|
|
if (selectedIds?.length == 0) return; |
|
|
|
|
|
|
|
Modal.confirm({ |
|
|
|
|
|
|
|
title: "确定删除覆盖物吗?", |
|
|
|
|
|
|
|
onOk: () => { |
|
|
|
|
|
|
|
this._store.dispatch(EditorAction.deleteOverlays()); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private _bindOperations() { |
|
|
|
private _bindOperations() { |
|
|
|
this.saveGeoJSON = this.saveGeoJSON.bind(this); |
|
|
|
this.saveGeoJSON = this.saveGeoJSON.bind(this); |
|
|
|
this.createRectangle = this.createRectangle.bind(this); |
|
|
|
this.createRectangle = this.createRectangle.bind(this); |
|
|
|
this.createPolygon = this.createPolygon.bind(this); |
|
|
|
this.createPolygon = this.createPolygon.bind(this); |
|
|
|
this.createPolyline = this.createPolyline.bind(this); |
|
|
|
this.createPolyline = this.createPolyline.bind(this); |
|
|
|
this.createCircle = this.createCircle.bind(this); |
|
|
|
this.createCircle = this.createCircle.bind(this); |
|
|
|
|
|
|
|
this.deleteOverlays = this.deleteOverlays.bind(this); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private _registerHotkeys() { |
|
|
|
private _registerHotkeys() { |
|
|
@ -98,6 +113,8 @@ export class GlobelController implements IGlobalController { |
|
|
|
alt: true, |
|
|
|
alt: true, |
|
|
|
ctrl: true, |
|
|
|
ctrl: true, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
registerHotkey("Delete", { callback: this.deleteOverlays }); |
|
|
|
|
|
|
|
|
|
|
|
registerHotkey("p", { callback: this.showCommand, alt: true }); |
|
|
|
registerHotkey("p", { callback: this.showCommand, alt: true }); |
|
|
|
registerHotkey("1", { |
|
|
|
registerHotkey("1", { |
|
|
|
callback: this.createRectangle, |
|
|
|
callback: this.createRectangle, |
|
|
|