|
|
|
@ -7,11 +7,31 @@ class KedaBasic implements ISelf {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export class KeDaMap extends KedaBasic implements IMap { |
|
|
|
|
constructor(container: string, options: IMapOptions) { |
|
|
|
|
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",
|
|
|
|
|
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) { //自定义 行政区划 样式
|
|
|
|
@ -51,19 +71,41 @@ export class KeDaMap extends KedaBasic implements IMap {
|
|
|
|
|
throw new Error('Method not implemented.'); |
|
|
|
|
} |
|
|
|
|
setCity(city: string) { |
|
|
|
|
console.log(1) |
|
|
|
|
} |
|
|
|
|
setZoom(zoom) { |
|
|
|
|
throw new Error('Method not implemented.'); |
|
|
|
|
} |
|
|
|
|
setCenter([x, y]) { |
|
|
|
|
throw new Error('Method not implemented.'); |
|
|
|
|
} |
|
|
|
|
getZoom() { |
|
|
|
|
throw new Error('Method not implemented.'); |
|
|
|
|
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() { |
|
|
|
|
throw new Error('Method not implemented.'); |
|
|
|
|
let center |
|
|
|
|
this.self.getCenter({ |
|
|
|
|
callback: function (data) { |
|
|
|
|
console.log(data); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return center |
|
|
|
|
} |
|
|
|
|
on(eventName: string, callback: Function): void { |
|
|
|
|
let eventMapProfile = { |
|
|
|
|