Browse Source

引入科达js文件并配置

上海一张图
陈鹏飞 4 years ago
parent
commit
bde1c16b55
  1. 1
      angular.json
  2. 13
      src/assets/kmap/Kmap.config.json
  3. 81
      src/assets/kmap/kmap-service-main-kd.js
  4. 2
      src/index.html
  5. 5
      src/modules/map/declare/factory.ts
  6. 42
      src/modules/map/declare/keda-map.ts

1
angular.json

@ -35,6 +35,7 @@
"scripts": [
"node_modules/echarts/dist/echarts.js",
"src/assets/mTokenK1/mToken_K1.js",
"src/assets/kmap/kmap-service-main-kd.js",
"./node_modules/swiper/js/swiper.min.js",
"src/assets/chartstheme/westeros.js",
"src/assets/chartstheme/walden.js",

13
src/assets/kmap/Kmap.config.json

@ -0,0 +1,13 @@
{
"DIST_URL": "./kmap-service-main-kd.js",
"TOKEN": "E203F172F1A54CD5B3CEDD107B8F4E43",
"CT_SERVER_URL": "https://10.14.183.81",
"USERMNG_SERVER": "",
"SEARCH_SERVER": "",
"WS_SERVER": "",
"ROUTING_SERVER": "",
"STORAGE_SERVER": "",
"COORDINATETYPE": "",
"INDOOR_MAP_MAX_ZOOM": 24
}

81
src/assets/kmap/kmap-service-main-kd.js

File diff suppressed because one or more lines are too long

2
src/index.html

@ -21,7 +21,7 @@
<body>
<app-root></app-root>
</body>
<script type="text/javascript" src="./assets/kmap/kmap-service-main-kd.js"></script>
<!-- <script src="http://10.81.73.39:8000/webapi/maps?v=2.0&key=e4b359dc7b03f9418b7497f807131346&plugin=AMap.Driving,AMap.MouseTool,AMap.RangingTool"></script>
<script src="http://10.81.73.39:8000/webapi/ui/1.1/main.js"></script> -->
<script src="https://webapi.amap.com/maps?v=2.0&key=e4b359dc7b03f9418b7497f807131346&plugin=AMap.Driving,AMap.MouseTool,AMap.RangingTool"></script>

5
src/modules/map/declare/factory.ts

@ -1,8 +1,8 @@
const mapSupplier: number = 1; //1:高德
const mapSupplier: number = 1; // 1:高德, 2:科达
import { IMap, IMapOptions, IMarker, IPixel, IMarkOptions, ILngLat, ILayer, ICircle, IMarkerCluster, IRenderClusterMarker, IInfoWindow, IMouseTool, IIcon, ISize, IIconOptions, ITileLayer, IDriving, IDrivingOptions, IAutocomplete, IPlaceSearch } from './map'
import { GaodeCircle, GaodeIcon, GaodeInfoWindow, GaodeLayer, GaoDeLngLat, GaoDeMap, GaoDeMarker, GaoDeMarkerCluster, GaodeMouseTool, GaoDePixel, GaoDeRenderClusterMarker, GaodeTileLayer, GaodeSize, GaodeDriving, GaodeAutocomplete, GaodePlaceSearch } from './gaode-map'
import { KeDaLngLat, KeDaMap, KeDaMarker, KeDaPixel } from './keda-map';
import { KeDaLngLat, KeDaMap, KeDaMarker, KeDaPixel, KedaTileLayer } from './keda-map';
import MapTools from './map-tools';
export class MapFactory {
@ -62,6 +62,7 @@ export class MapFactory {
public static TileLayerInstance(): ITileLayer {
switch (mapSupplier) {
case 1: return new GaodeTileLayer();
case 2: return new KedaTileLayer();
default: return null;
}
}

42
src/modules/map/declare/keda-map.ts

@ -1,11 +1,17 @@
import { ILngLat, IMap, IMapOptions, IMarker, IPixel } from './map'
import { ILngLat, IMap, IMapOptions, IMarker, IPixel, ISelf, ITileLayer } from './map'
declare var KMap: any;
export class KeDaMap implements IMap {
class KedaBasic implements ISelf {
self: any;
discriminator: string = "ISelf";
}
export class KeDaMap extends KedaBasic implements IMap {
constructor(container: string, options: IMapOptions) {
super();
let opt = Object.assign({}, { containerId: container }, options) as any;
opt.configUrl = "";
opt.configUrl = "../../../assets/kmap/Kmap.config.json";
opt.targetCoordinateType = "WGS84",
this.self = new KMap(opt);
}
setAdministrativeAreaStyle(conponent: any, getData?: Function, setData?: Function) { //自定义 行政区划 样式
@ -38,7 +44,6 @@ export class KeDaMap implements IMap {
getBounds() {
throw new Error('Method not implemented.');
}
discriminator= 'ISelf';
add(obj: any) {
throw new Error('Method not implemented.');
}
@ -46,7 +51,7 @@ export class KeDaMap implements IMap {
throw new Error('Method not implemented.');
}
setCity(city: string) {
throw new Error('Method not implemented.');
console.log(1)
}
setZoom(zoom) {
throw new Error('Method not implemented.');
@ -73,17 +78,16 @@ export class KeDaMap implements IMap {
}
}
export class KeDaPixel implements IPixel {
self: any;
export class KeDaPixel extends KedaBasic implements IPixel {
constructor(x: number, y: number) {
super();
this.self = [x, y];
}
discriminator= 'ISelf';
}
export class KeDaMarker implements IMarker {
self: any;
export class KeDaMarker extends KedaBasic implements IMarker {
constructor(options: any) {
super();
let d = {
offset: options.offset,
element: options.content
@ -109,11 +113,10 @@ export class KeDaMarker implements IMarker {
on(eventName: string, callback: Function): void {
throw new Error('Method not implemented.');
}
discriminator= 'ISelf';
}
export class KeDaLngLat implements ILngLat {
self: any;
export class KeDaLngLat extends KedaBasic implements ILngLat {
constructor(x: number, y: number) {
super();
this.self = new KMap.LngLat(x, y);
}
lng: number;
@ -121,5 +124,16 @@ export class KeDaLngLat implements ILngLat {
offset(x: number, y: number) {
throw new Error('Method not implemented.');
}
discriminator= 'ISelf';
}
export class KedaTileLayer extends KedaBasic implements ITileLayer {
constructor() {
super();
}
Satellite() {
return this
}
RoadNet() {
return this
}
}
Loading…
Cancel
Save