|
|
|
import { ILngLat, IMap, IMapOptions, IMarker, IMarkOptions, IPixel } from './map'
|
|
|
|
import MapTools from './map-tools';
|
|
|
|
declare var AMap: any;
|
|
|
|
|
|
|
|
export class GaoDeMap implements IMap {
|
|
|
|
self: any;//AMap.Map
|
|
|
|
constructor(container: string, options: IMapOptions) {
|
|
|
|
this.self = new AMap.Map(container, options);
|
|
|
|
}
|
|
|
|
discriminator: 'ISelf';
|
|
|
|
add(obj: any) {
|
|
|
|
return this.self.add(obj)
|
|
|
|
}
|
|
|
|
remove(obj: any) {
|
|
|
|
return this.self.remove(obj)
|
|
|
|
}
|
|
|
|
setCity(city: string) {
|
|
|
|
return this.self.setCity(city)
|
|
|
|
}
|
|
|
|
setZoom(zoom) {
|
|
|
|
return this.self.setZoom(zoom)
|
|
|
|
}
|
|
|
|
setCenter([x, y]) {
|
|
|
|
return this.self.setCenter([x, y])
|
|
|
|
}
|
|
|
|
getCenter() {
|
|
|
|
return this.self.getCenter();
|
|
|
|
}
|
|
|
|
getZoom() {
|
|
|
|
return this.self.getZoom();
|
|
|
|
}
|
|
|
|
on(eventName: string, callback: Function): void {
|
|
|
|
this.self.on(eventName, callback);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class GaoDePixel implements IPixel {
|
|
|
|
self: any;
|
|
|
|
constructor(x: number, y: number) {
|
|
|
|
this.self = new AMap.Pixel(x, y);
|
|
|
|
}
|
|
|
|
discriminator: 'ISelf';
|
|
|
|
}
|
|
|
|
|
|
|
|
export class GaoDeMarker implements IMarker {
|
|
|
|
self: any;
|
|
|
|
constructor(options: IMarkOptions) {
|
|
|
|
let conf = MapTools.InstanceConvert(options);
|
|
|
|
this.self = new AMap.Marker(options);
|
|
|
|
}
|
|
|
|
get id(): string {
|
|
|
|
return this.self
|
|
|
|
}
|
|
|
|
set id(str: string) {
|
|
|
|
this.self.id = str;
|
|
|
|
}
|
|
|
|
on(eventName: string, callback: Function): void {
|
|
|
|
this.self.on(eventName, callback);
|
|
|
|
}
|
|
|
|
discriminator: 'ISelf';
|
|
|
|
}
|
|
|
|
|
|
|
|
export class GaoDeLngLat implements ILngLat {
|
|
|
|
self: any;
|
|
|
|
constructor(x: number, y: number) {
|
|
|
|
this.self = new AMap.LngLat(x, y);
|
|
|
|
}
|
|
|
|
discriminator: 'ISelf';
|
|
|
|
}
|