import { ILngLat, IMap, IMapOptions, IMarker, IPixel, ISelf, ITileLayer } from './map' declare var KMap: any; class KedaBasic implements ISelf { self: any; discriminator: string = "ISelf"; } export class KeDaMap extends KedaBasic implements IMap { constructor(container: string, options: IMapOptions) { //地图初始化 super(); let that = this let opt = Object.assign({}, { containerId: container }, options) as any; opt.configUrl = "/assets/kmap/Kmap.config.json"; opt.targetCoordinateType = "WGS84"; let mapLayer = function () { if (opt.viewMode && opt.viewMode=="3D") { let data = { type: 'FeatureCollection', features: [ { type: 'Feature', geometry: { type: 'Point', coordinates: [121.495126354, 31.241993148] }, properties: {height: 30} } ] }; that.self.add3DLayer({data: data}); } } opt.onLoadMap = mapLayer this.self = new KMap(opt); } setAdministrativeAreaStyle(conponent: any, getData?: Function, setData?: Function) { //自定义 行政区划 样式 throw new Error('Method not implemented.'); } setBounds(zoom?: any, x?: any, y?: any, is?: boolean) { throw new Error('Method not implemented.'); } setFitView(options: any) { throw new Error('Method not implemented.'); } containerToLngLat(e: any) { throw new Error('Method not implemented.'); } clearMap() { throw new Error('Method not implemented.'); } distance(a: number[], b: number[]) { throw new Error('Method not implemented.'); } getCity(callback: Function) { throw new Error('Method not implemented.'); } setZoomAndCenter(zoom: number, pos: number[]) { throw new Error('Method not implemented.'); } plugin(eventName: string[], callback: Function) { throw new Error('Method not implemented.'); } getBounds() { throw new Error('Method not implemented.'); } add(obj: any) { throw new Error('Method not implemented.'); } remove(obj: any) { throw new Error('Method not implemented.'); } setCity(city: string) { let that = this if (city.includes("上海")) { window.setTimeout(function(){ that.self.flyTo({ zoom:9, point:[121.495126354, 31.241993148] }); },10000) } } setZoom(zoom:number) { this.self.zoomTo({ zoom:zoom }); } getZoom():number { let num this.self.getZoom({ callback:(e)=>{ num = e.data; } }) return num } setCenter(pos: number[]) { this.self.flyTo({point:pos}) } getCenter() { let center this.self.getCenter({ callback: function (data) { console.log(data); } }); return center } on(eventName: string, callback: Function): void { let eventMapProfile = { complete: "load", click: "click", rightclick: "contextmenu" }; this.self.addEventOnMap({ event: eventMapProfile[eventName], handler: callback }); } } export class KeDaPixel extends KedaBasic implements IPixel { constructor(x: number, y: number) { super(); this.self = [x, y]; } } export class KeDaMarker extends KedaBasic implements IMarker { constructor(options: any) { super(); let d = { offset: options.offset, element: options.content }; this.self = d; } setContent(html: string) { throw new Error('Method not implemented.'); } setPosition(x: number[]) { throw new Error('Method not implemented.'); } _position: number[]; setMap() { throw new Error('Method not implemented.'); } get id(): string { throw new Error('Method not implemented.'); } set id(str: string) { throw new Error('Method not implemented.'); } on(eventName: string, callback: Function): void { throw new Error('Method not implemented.'); } } export class KeDaLngLat extends KedaBasic implements ILngLat { constructor(x: number, y: number) { super(); this.self = new KMap.LngLat(x, y); } lng: number; lat: number; offset(x: number, y: number) { throw new Error('Method not implemented.'); } } export class KedaTileLayer extends KedaBasic implements ITileLayer { constructor() { super(); } Satellite() { return this } RoadNet() { return this } }