edit
This commit is contained in:
@ -13,6 +13,7 @@ import { Observable, Subject, throwError } from 'rxjs';
|
||||
import AMapLoader from '@amap/amap-jsapi-loader';
|
||||
import { amapConf } from '@conf/amap.config';
|
||||
declare var AMap: any;
|
||||
declare var AMapUI: any;
|
||||
|
||||
const CONFIG = amapConf;
|
||||
@Injectable({
|
||||
@ -82,4 +83,55 @@ export class AmapService {
|
||||
|
||||
return this.currentSub;
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加标记点
|
||||
*
|
||||
* @param poi
|
||||
*/
|
||||
setPOI(poi: POI, aMap: any) {
|
||||
AMapUI.loadUI(['overlay/SimpleMarker'], (SimpleMarker: any) => {
|
||||
//启动页面
|
||||
new SimpleMarker({
|
||||
//普通文本
|
||||
iconLabel: {
|
||||
//普通文本
|
||||
innerHTML: poi.markerLabel,
|
||||
//设置样式
|
||||
style: {
|
||||
color: '#fff',
|
||||
fontSize: '110%',
|
||||
marginTop: '2px'
|
||||
}
|
||||
},
|
||||
iconStyle: poi.color,
|
||||
map: aMap,
|
||||
position: poi.position
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export interface POI {
|
||||
markerLabel?: string;
|
||||
title: string;
|
||||
color: string;
|
||||
position: string[];
|
||||
}
|
||||
|
||||
export interface InfoItem {
|
||||
title?: string;
|
||||
content?: string;
|
||||
position: string[];
|
||||
}
|
||||
|
||||
export interface MapList {
|
||||
name: string;
|
||||
time: string;
|
||||
lnglat: string[];
|
||||
}
|
||||
|
||||
export interface PathList {
|
||||
name: string;
|
||||
points: MapList[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user