|
|
|
const mapSupplier: number = 1; //1:高德
|
|
|
|
|
|
|
|
import { IMap, IMapOptions, IMarker, IPixel, IMarkOptions, ILngLat, ILayer, ICircle, IMarkerCluster, IRenderClusterMarker } from './map'
|
|
|
|
import { GaodeCircle, GaodeLayer, GaoDeLngLat, GaoDeMap, GaoDeMarker, GaoDeMarkerCluster, GaoDePixel, GaoDeRenderClusterMarker } from './gaode-map'
|
|
|
|
import { KeDaLngLat, KeDaMap, KeDaMarker, KeDaPixel } from './keda-map';
|
|
|
|
import MapTools from './map-tools';
|
|
|
|
|
|
|
|
export class MapFactory {
|
|
|
|
public static MapInstance(container: string, options: IMapOptions | any): IMap {
|
|
|
|
let config = MapTools.InstanceConvert(options);
|
|
|
|
switch (mapSupplier) {
|
|
|
|
case 1: return new GaoDeMap(container, config);
|
|
|
|
case 2: return new KeDaMap(container, config);
|
|
|
|
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 MarkerClusterInstance(map:IMap,list:Object[],options:object): IMarkerCluster {
|
|
|
|
switch (mapSupplier) {
|
|
|
|
case 1: return new GaoDeMarkerCluster(map,list,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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static LayerInstance(options:any):ILayer{
|
|
|
|
switch (mapSupplier) {
|
|
|
|
case 1: return new GaodeLayer(options);
|
|
|
|
default: return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static CircleInstance(options:any):ICircle{
|
|
|
|
switch (mapSupplier) {
|
|
|
|
case 1: return new GaodeCircle(options);
|
|
|
|
default: return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static RenderClusterMarkerInstance(context,dom:string,pixel:IPixel):IRenderClusterMarker{
|
|
|
|
switch (mapSupplier) {
|
|
|
|
case 1: return new GaoDeRenderClusterMarker();
|
|
|
|
default: return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|