import { EditPolygonTool } from './edit/EditPolygonTool' import { EditRectangleTool } from './edit/EditRectangleTool' import { EditEllipseTool } from './edit/EditEllipseTool' import { EditBufferCircleTool } from './edit/EditBufferCircleTool' const EDIT_TOOL_MAP = { polygon: EditPolygonTool, rectangle: EditRectangleTool, ellipse: EditEllipseTool, buffer: EditBufferCircleTool, } export class EditManager { constructor(viewer) { this.viewer = viewer this.activeTool = null } start(type, data, options = {}) { this.destroy() const Tool = EDIT_TOOL_MAP[type] if (!Tool) return null this.activeTool = new Tool(this.viewer, options) this.activeTool.start(data) return this.activeTool } destroy() { if (this.activeTool) { this.activeTool.destroy() this.activeTool = null } } }