/* * @Author: your name * @Date: 2022-04-13 09:42:29 * @LastEditTime: 2022-04-14 16:22:10 * @LastEditors: Please set LastEditors * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @FilePath: /gassafety-progress/gassafetyprogress-web/src/utils/mapClass/xjxjmap.js */ import { EditorMap } from "./map"; export class XjxcMap extends EditorMap { iconType1 = 98; iconType2 = 99; iconType3 = 0; constructor(contaienr, config = {}, vue) { super(contaienr, (config = {}), vue); } create(data, componentDevice, componentPipe) { const path = eval(data.path); if (path.length < 1) return; console.log(path); // 开头 const deviceData1 = { longitude: path[0][0], latitude: path[0][1], iconType: this.iconType1, }; // 结尾 const deviceData2 = { longitude: path[path.length - 1][0], latitude: path[path.length - 1][1], iconType: this.iconType2, }; // 路线 const pipeData = { title:data.title ||"中燃科技", path, iconType: this.iconType3, pipePressure: 4, strokeWeight: 2, }; this.addPipeLine(pipeData, componentPipe); this.addDevice(deviceData1, componentDevice); this.addDevice(deviceData2, componentDevice); // // 前取整 const num = path.length >> 1; this.map.panTo(path[num]); } remove() { if (this.allDevice[98]?.length > 0) { this.map.remove(this.allDevice[98][0]); this.allDevice[98] = []; this.map.remove(this.allDevice[99][0]); this.allDevice[99] = []; this.map.remove(this.pipeArr[0][0]); this.pipeArr[0] = []; } } }