上海预案管理平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.3 KiB

const mapSupplier: number = 1;//1:高德
import { IMap, IMapOptions, IMarker, IPixel, IMarkOptions, ILngLat } from './map'
import { GaoDeLngLat, GaoDeMap, GaoDeMarker, GaoDePixel } from './gaode-map'
import { KeDaLngLat, KeDaMap, KeDaMarker, KeDaPixel } from './keda-map';
export class MapFactory {
public static MapInstance(container: string, options: IMapOptions | any): IMap {
switch (mapSupplier) {
case 1: return new GaoDeMap(container, options);
case 2: return new KeDaMap(container, options);
default: return null;
}
}
public static PixelInstance(x: number, y: number): IPixel {
switch (mapSupplier) {
case 1: return new GaoDePixel(x, y);
case 2: return new KeDaPixel(x, y);
default: return null;
}
}
public static MarkerInstance(options: IMarkOptions): IMarker {
switch (mapSupplier) {
case 1: return new GaoDeMarker(options);
case 2: return new KeDaMarker(options);
default: return null;
}
}
public static LngLatInstance(x: number, y: number): ILngLat {
switch (mapSupplier) {
case 1: return new GaoDeLngLat(x, y);
case 2: return new KeDaLngLat(x, y);
default: return null;
}
}
}