update
1.添加急救路线
This commit is contained in:
@@ -9,6 +9,7 @@ import { defaultOption, getZoom, mapKey, mapPlugin } from '/@/assets/mapUtils/ma
|
||||
|
||||
let AMap = null;
|
||||
export const Map = {
|
||||
aMap: null,
|
||||
map: null,
|
||||
overlayGroup: null, // 地图中marker
|
||||
circleGroup: null, //直升机背景圆
|
||||
@@ -19,6 +20,9 @@ export const Map = {
|
||||
infoWindow: null, //地图弹窗
|
||||
driveLine: null, // 导航轨迹线
|
||||
emergencyMarker: null, // 应急人员marker
|
||||
startMarker: null,
|
||||
endMarker: null,
|
||||
clearSOrE: null,
|
||||
/**
|
||||
* @desc 地图舒适化
|
||||
* @param el dom元素 id选择器
|
||||
@@ -34,6 +38,7 @@ export const Map = {
|
||||
plugins: mapPlugin, // 需要使用的的插件列表,如比例尺'AMap.Scale'等
|
||||
}).then((res) => {
|
||||
AMap = res;
|
||||
this.aMap = res;
|
||||
const { zoom, center, mapStyle } = { ...defaultOption, ...option };
|
||||
//基本地图加载
|
||||
this.map = new AMap.Map(el, {
|
||||
@@ -476,4 +481,40 @@ export const Map = {
|
||||
this.clearNaviLine();
|
||||
this.clearEmergencyMarker();
|
||||
},
|
||||
createSMarker(position: any) {
|
||||
if (this.startMarker) {
|
||||
this.startMarker?.setMap(null);
|
||||
this.startMarker = null;
|
||||
}
|
||||
|
||||
this.startMarker = new AMap.Marker({
|
||||
position: position,
|
||||
offset: new AMap.Pixel(0, 0),
|
||||
});
|
||||
this.map.add(this.startMarker);
|
||||
this.setZoomCenter(position);
|
||||
},
|
||||
createEMarker(position: any) {
|
||||
if (this.endMarker) {
|
||||
this.endMarker?.setMap(null);
|
||||
this.endMarker = null;
|
||||
}
|
||||
|
||||
this.endMarker = new AMap.Marker({
|
||||
position: position,
|
||||
offset: new AMap.Pixel(0, 0),
|
||||
});
|
||||
this.map.add(this.endMarker);
|
||||
this.setZoomCenter(position);
|
||||
},
|
||||
clearSOrE() {
|
||||
if (this.startMarker) {
|
||||
this.startMarker?.setMap(null);
|
||||
this.startMarker = null;
|
||||
}
|
||||
if (this.endMarker) {
|
||||
this.endMarker?.setMap(null);
|
||||
this.endMarker = null;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user