hn-map 1.1.4 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -767,13 +767,6 @@
767
767
  this.map.on("pitchend", function (e) {
768
768
  return _this2.updateMapParams(e);
769
769
  }); // 地图俯仰角度完成
770
- this.map.on("load", function (e) {
771
- // 路况展示
772
- var roadNetLayer = new SGMap.RoadNetLayer({
773
- map: _this2.map
774
- });
775
- roadNetLayer.render();
776
- });
777
770
  }
778
771
  return _createClass(siji_map, [{
779
772
  key: "formatConfig",
@@ -943,6 +936,32 @@
943
936
  _context3.n = 1;
944
937
  return new Promise(function (resolve) {
945
938
  instance.map.on("load", function (e) {
939
+ // 路况展示
940
+ var roadNetLayer = new SGMap.RoadNetLayer({
941
+ map: instance.map
942
+ });
943
+ roadNetLayer.render();
944
+ //添加天空图层
945
+ instance.map.addLayer({
946
+ "id": "sky",
947
+ "type": "sky",
948
+ "paint": {
949
+ "sky-type": "atmosphere",
950
+ "sky-atmosphere-sun": [0, 0],
951
+ "sky-atmosphere-sun-intensity": 15
952
+ }
953
+ });
954
+ // 加载地形(需要v3.1.0,且需要新的key和secret)
955
+ // !instance.map.getSource('terrain') && instance.map.addSource('terrain',{
956
+ // type:'raster-dem',
957
+ // url:"aegis://aegis.Terrain3D",//地形高程数据源名称
958
+ // tileSize:512,
959
+ //
960
+ // })
961
+ // instance.map.setTerrain({
962
+ // source:'terrain',
963
+ // exaggeration:1,//地形夸张比例
964
+ // })
946
965
  resolve(e);
947
966
  });
948
967
  });
@@ -1393,6 +1412,10 @@
1393
1412
  hnMap.map.map.removeLayer(entity.config_routeplay.id);
1394
1413
  hnMap.map.map.removeSource(entity.config_routeplay.id);
1395
1414
  entity.imgMarker.remove();
1415
+ } else if (entity.type == "imagePoint") {
1416
+ hnMap.map.map.removeImage(entity.id + "_image");
1417
+ hnMap.map.map.removeLayer(entity.id);
1418
+ hnMap.map.map.removeSource(entity.id);
1396
1419
  } else {
1397
1420
  hnMap.map.map.removeLayer(entity.id);
1398
1421
  hnMap.map.map.removeSource(entity.id);
@@ -1406,6 +1429,7 @@
1406
1429
  value: function moveEntity(layerIds) {
1407
1430
  // 数组转字符串
1408
1431
  var s = layerIds.join(",");
1432
+ console.log("s===", s);
1409
1433
  hnMap.map.map.moveLayer(s);
1410
1434
  }
1411
1435
  }, {
@@ -1700,8 +1724,8 @@
1700
1724
  var handleClick = function handleClick(e) {
1701
1725
  var data = _this2.option.data;
1702
1726
  // const data = e.features[0].properties;
1703
- getCustomDom(data);
1704
- _this2.infoWindow.setHTML("<image-preview>");
1727
+ var dom = getCustomDom(data);
1728
+ _this2.infoWindow.setHTML(dom);
1705
1729
  _this2.infoWindow.setLngLat(e.lngLat).addTo(_this2.hnMap.map.map);
1706
1730
  };
1707
1731
  this.hnMap.map.map.on("click", this.config.id, handleClick);
@@ -5309,6 +5333,7 @@
5309
5333
  case 0:
5310
5334
  // 判断是否在子路径下
5311
5335
  basePath = window.location.pathname.endsWith("/") ? window.location.pathname : window.location.pathname.substring(0, window.location.pathname.lastIndexOf("/") + 1);
5336
+ console.log(basePath);
5312
5337
  _context.n = 1;
5313
5338
  return loadResource(basePath + "lib/turf/turf.min.js", "js");
5314
5339
  case 1:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hn-map",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "hn-map集成mars3d、高德、思极",
5
5
  "main": "dist/index.js",
6
6
  "author": "庞大仙",
@@ -53,7 +53,7 @@ export default class siji_entity {
53
53
  const data = this.option.data;
54
54
  // const data = e.features[0].properties;
55
55
  const dom = getCustomDom(data);
56
- this.infoWindow.setHTML("<image-preview>");
56
+ this.infoWindow.setHTML(dom);
57
57
  this.infoWindow.setLngLat(e.lngLat).addTo(this.hnMap.map.map);
58
58
  };
59
59
 
@@ -394,6 +394,10 @@ export default (hnMap: any) => {
394
394
  hnMap.map.map.removeLayer(entity.config_routeplay.id);
395
395
  hnMap.map.map.removeSource(entity.config_routeplay.id);
396
396
  entity.imgMarker.remove();
397
+ } else if (entity.type == "imagePoint") {
398
+ hnMap.map.map.removeImage(entity.id + "_image");
399
+ hnMap.map.map.removeLayer(entity.id);
400
+ hnMap.map.map.removeSource(entity.id);
397
401
  } else {
398
402
  hnMap.map.map.removeLayer(entity.id);
399
403
  hnMap.map.map.removeSource(entity.id);
@@ -405,6 +409,7 @@ export default (hnMap: any) => {
405
409
  moveEntity(layerIds: Array<string>) {
406
410
  // 数组转字符串
407
411
  let s = layerIds.join(",");
412
+ console.log("s===", s);
408
413
  hnMap.map.map.moveLayer(s);
409
414
  }
410
415
  clearEntity() {
package/src/map.ts CHANGED
@@ -277,11 +277,6 @@ export default (hnMap: any) => {
277
277
  this.map.on("moveend", (e: any) => this.updateMapParams(e)); // 地图移动完成
278
278
  this.map.on("zoomend", (e: any) => this.updateMapParams(e)); // 地图缩放完成
279
279
  this.map.on("pitchend", (e: any) => this.updateMapParams(e)); // 地图俯仰角度完成
280
- this.map.on("load", (e: any) => {
281
- // 路况展示
282
- let roadNetLayer = new SGMap.RoadNetLayer({ map: this.map });
283
- roadNetLayer.render();
284
- });
285
280
  }
286
281
 
287
282
  static async create(id: string, option: any) {
@@ -290,6 +285,34 @@ export default (hnMap: any) => {
290
285
  // 返回一个 Promise,等待地图的 'load' 事件
291
286
  await new Promise((resolve) => {
292
287
  instance.map.on("load", (e: any) => {
288
+ // 路况展示
289
+ let roadNetLayer = new SGMap.RoadNetLayer({ map: instance.map });
290
+ roadNetLayer.render();
291
+ //添加天空图层
292
+ instance.map.addLayer({
293
+ "id": "sky",
294
+ "type": "sky",
295
+ "paint": {
296
+ "sky-type": "atmosphere",
297
+ "sky-atmosphere-sun": [
298
+ 0,
299
+ 0
300
+ ],
301
+ "sky-atmosphere-sun-intensity": 15
302
+ }
303
+ })
304
+
305
+ // 加载地形(需要v3.1.0,且需要新的key和secret)
306
+ // !instance.map.getSource('terrain') && instance.map.addSource('terrain',{
307
+ // type:'raster-dem',
308
+ // url:"aegis://aegis.Terrain3D",//地形高程数据源名称
309
+ // tileSize:512,
310
+ //
311
+ // })
312
+ // instance.map.setTerrain({
313
+ // source:'terrain',
314
+ // exaggeration:1,//地形夸张比例
315
+ // })
293
316
  resolve(e);
294
317
  });
295
318
  });
@@ -362,7 +385,7 @@ export default (hnMap: any) => {
362
385
  callback({
363
386
  lng: event.lngLat.lng,
364
387
  lat: event.lngLat.lat,
365
- alt: event.lngLat.alt||0,
388
+ alt: event.lngLat.alt || 0,
366
389
  });
367
390
  };
368
391
  break;
package/src/util.ts CHANGED
@@ -15,36 +15,36 @@
15
15
 
16
16
  // 对象深度合并
17
17
  export function deepMerge(target: any, source: any): any {
18
- for (let key of Object.keys(source)) {
19
- if (source[key] instanceof Object && !Array.isArray(source[key])) {
20
- if (!target[key]) Object.assign(target, {[key]: {}});
21
- deepMerge(target[key], source[key]);
22
- } else {
23
- Object.assign(target, {[key]: source[key]});
24
- }
18
+ for (let key of Object.keys(source)) {
19
+ if (source[key] instanceof Object && !Array.isArray(source[key])) {
20
+ if (!target[key]) Object.assign(target, { [key]: {} });
21
+ deepMerge(target[key], source[key]);
22
+ } else {
23
+ Object.assign(target, { [key]: source[key] });
25
24
  }
26
- return target;
25
+ }
26
+ return target;
27
27
  }
28
28
 
29
29
  // 递归格式化高德坐标系
30
30
  export function wgs84ToGcj02Format(position: any): any {
31
- // 判断是否是数组
32
- if (position.every((item: any) => Array.isArray(item))) {
33
- return position.map((item: any) => {
34
- return wgs84ToGcj02Format(item);
35
- });
36
- } else if (position.every((item: any) => typeof item === "object")) {
37
- return position.map((item: any) => {
38
- let data = wgs84ToGcj02Format([item.lng, item.lat]);
39
- return {
40
- ...item,
41
- lng: data[0],
42
- lat: data[1],
43
- };
44
- });
45
- } else {
46
- return wgs84ToGcj02(position[0], position[1]);
47
- }
31
+ // 判断是否是数组
32
+ if (position.every((item: any) => Array.isArray(item))) {
33
+ return position.map((item: any) => {
34
+ return wgs84ToGcj02Format(item);
35
+ });
36
+ } else if (position.every((item: any) => typeof item === "object")) {
37
+ return position.map((item: any) => {
38
+ let data = wgs84ToGcj02Format([item.lng, item.lat]);
39
+ return {
40
+ ...item,
41
+ lng: data[0],
42
+ lat: data[1],
43
+ };
44
+ });
45
+ } else {
46
+ return wgs84ToGcj02(position[0], position[1]);
47
+ }
48
48
  }
49
49
 
50
50
  /**
@@ -54,66 +54,66 @@ export function wgs84ToGcj02Format(position: any): any {
54
54
  * @returns {[number, number]} GCJ-02经纬度数组
55
55
  */
56
56
  export function wgs84ToGcj02(wgsLng: any, wgsLat: any): any {
57
- if (!isCorrectPosition(wgsLng, wgsLat)) {
58
- return [wgsLng, wgsLat];
59
- }
60
-
61
- const a = 6378245.0; // 长半轴
62
- const ee = 0.00669342162296594323; // 扁率
63
-
64
- function transformLat(x: any, y: any): any {
65
- let ret =
66
- -100.0 +
67
- 2.0 * x +
68
- 3.0 * y +
69
- 0.2 * y * y +
70
- 0.1 * x * y +
71
- 0.2 * Math.sqrt(Math.abs(x));
72
- ret +=
73
- ((20.0 * Math.sin(6.0 * x * Math.PI) +
74
- 20.0 * Math.sin(2.0 * x * Math.PI)) *
75
- 2.0) /
76
- 3.0;
77
- ret +=
78
- ((160.0 * Math.sin((y * Math.PI) / 3.0) +
79
- 320 * Math.sin((y * Math.PI) / 30.0)) *
80
- 2.0) /
81
- 3.0;
82
- return ret;
83
- }
84
-
85
- function transformLng(x: any, y: any): any {
86
- let ret =
87
- 300.0 +
88
- x +
89
- 2.0 * y +
90
- 0.1 * x * x +
91
- 0.1 * x * y +
92
- 0.1 * Math.sqrt(Math.abs(x));
93
- ret +=
94
- ((20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(x * Math.PI)) *
95
- 2.0) /
96
- 3.0;
97
- ret +=
98
- ((150.0 * Math.sin((x * Math.PI) / 3.0) +
99
- 300.0 * Math.sin((x * Math.PI) / 15.0)) *
100
- 2.0) /
101
- 3.0;
102
- return ret;
103
- }
104
-
105
- let dLat = transformLat(wgsLng - 105.0, wgsLat - 35.0);
106
- let dLng = transformLng(wgsLng - 105.0, wgsLat - 35.0);
107
- const radLat = (wgsLat / 180.0) * Math.PI;
108
- let magic = Math.sin(radLat);
109
- magic = 1 - ee * magic * magic;
110
- const sqrtMagic = Math.sqrt(magic);
111
- dLat = (dLat * 180.0) / (((a * (1 - ee)) / (magic * sqrtMagic)) * Math.PI);
112
- dLng = (dLng * 180.0) / ((a / sqrtMagic) * Math.cos(radLat) * Math.PI);
113
- const gcjLat = wgsLat + dLat;
114
- const gcjLng = wgsLng + dLng;
115
-
116
- return [gcjLng, gcjLat];
57
+ if (!isCorrectPosition(wgsLng, wgsLat)) {
58
+ return [wgsLng, wgsLat];
59
+ }
60
+
61
+ const a = 6378245.0; // 长半轴
62
+ const ee = 0.00669342162296594323; // 扁率
63
+
64
+ function transformLat(x: any, y: any): any {
65
+ let ret =
66
+ -100.0 +
67
+ 2.0 * x +
68
+ 3.0 * y +
69
+ 0.2 * y * y +
70
+ 0.1 * x * y +
71
+ 0.2 * Math.sqrt(Math.abs(x));
72
+ ret +=
73
+ ((20.0 * Math.sin(6.0 * x * Math.PI) +
74
+ 20.0 * Math.sin(2.0 * x * Math.PI)) *
75
+ 2.0) /
76
+ 3.0;
77
+ ret +=
78
+ ((160.0 * Math.sin((y * Math.PI) / 3.0) +
79
+ 320 * Math.sin((y * Math.PI) / 30.0)) *
80
+ 2.0) /
81
+ 3.0;
82
+ return ret;
83
+ }
84
+
85
+ function transformLng(x: any, y: any): any {
86
+ let ret =
87
+ 300.0 +
88
+ x +
89
+ 2.0 * y +
90
+ 0.1 * x * x +
91
+ 0.1 * x * y +
92
+ 0.1 * Math.sqrt(Math.abs(x));
93
+ ret +=
94
+ ((20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(x * Math.PI)) *
95
+ 2.0) /
96
+ 3.0;
97
+ ret +=
98
+ ((150.0 * Math.sin((x * Math.PI) / 3.0) +
99
+ 300.0 * Math.sin((x * Math.PI) / 15.0)) *
100
+ 2.0) /
101
+ 3.0;
102
+ return ret;
103
+ }
104
+
105
+ let dLat = transformLat(wgsLng - 105.0, wgsLat - 35.0);
106
+ let dLng = transformLng(wgsLng - 105.0, wgsLat - 35.0);
107
+ const radLat = (wgsLat / 180.0) * Math.PI;
108
+ let magic = Math.sin(radLat);
109
+ magic = 1 - ee * magic * magic;
110
+ const sqrtMagic = Math.sqrt(magic);
111
+ dLat = (dLat * 180.0) / (((a * (1 - ee)) / (magic * sqrtMagic)) * Math.PI);
112
+ dLng = (dLng * 180.0) / ((a / sqrtMagic) * Math.cos(radLat) * Math.PI);
113
+ const gcjLat = wgsLat + dLat;
114
+ const gcjLng = wgsLng + dLng;
115
+
116
+ return [gcjLng, gcjLat];
117
117
  }
118
118
 
119
119
  /**
@@ -123,46 +123,46 @@ export function wgs84ToGcj02(wgsLng: any, wgsLat: any): any {
123
123
  * @returns {boolean}
124
124
  */
125
125
  export function isCorrectPosition(lng: any, lat: any): boolean {
126
- return lng <= 180 && lng >= -180 && lat <= 90 && lat >= -90;
126
+ return lng <= 180 && lng >= -180 && lat <= 90 && lat >= -90;
127
127
  }
128
128
 
129
129
  // 根据矩形左上角和右上角坐标计算矩形坐标对
130
130
  export function createRectangleCoordinates(leftTop: any, rightBottom: any) {
131
- const [leftTopLng, leftTopLat] = leftTop;
132
- const [rightBottomLng, rightBottomLat] = rightBottom;
133
-
134
- // 计算四个角点
135
- const leftTopPoint = [Number(leftTopLng), Number(leftTopLat)];
136
- const rightTopPoint = [Number(rightBottomLng), Number(leftTopLat)];
137
- const rightBottomPoint = [Number(rightBottomLng), Number(rightBottomLat)];
138
- const leftBottomPoint = [Number(leftTopLng), Number(rightBottomLat)];
139
-
140
- // 返回五个点的坐标对(首尾相同)
141
- return [
142
- leftTopPoint,
143
- rightTopPoint,
144
- rightBottomPoint,
145
- leftBottomPoint,
146
- leftTopPoint, // 闭合矩形
147
- ];
131
+ const [leftTopLng, leftTopLat] = leftTop;
132
+ const [rightBottomLng, rightBottomLat] = rightBottom;
133
+
134
+ // 计算四个角点
135
+ const leftTopPoint = [Number(leftTopLng), Number(leftTopLat)];
136
+ const rightTopPoint = [Number(rightBottomLng), Number(leftTopLat)];
137
+ const rightBottomPoint = [Number(rightBottomLng), Number(rightBottomLat)];
138
+ const leftBottomPoint = [Number(leftTopLng), Number(rightBottomLat)];
139
+
140
+ // 返回五个点的坐标对(首尾相同)
141
+ return [
142
+ leftTopPoint,
143
+ rightTopPoint,
144
+ rightBottomPoint,
145
+ leftBottomPoint,
146
+ leftTopPoint, // 闭合矩形
147
+ ];
148
148
  }
149
149
 
150
150
  export function getMapRangeHeightByLevel(level: number) {
151
- // 输入校验:限制在 1~18
152
- level = Math.max(1, Math.min(18, Math.floor(level)));
153
-
154
- // 计算指定 level 对应的高度(level >= 2 时使用指数衰减)
155
- function getHeight(lvl: number) {
156
- if (lvl === 1) {
157
- return Infinity; // level=1 表示“最大高度”,逻辑上为无穷大
158
- } else {
159
- return 32000000 / Math.pow(2, lvl - 2);
160
- }
151
+ // 输入校验:限制在 1~18
152
+ level = Math.max(1, Math.min(18, Math.floor(level)));
153
+
154
+ // 计算指定 level 对应的高度(level >= 2 时使用指数衰减)
155
+ function getHeight(lvl: number) {
156
+ if (lvl === 1) {
157
+ return Infinity; // level=1 表示“最大高度”,逻辑上为无穷大
158
+ } else {
159
+ return 32000000 / Math.pow(2, lvl - 2);
161
160
  }
161
+ }
162
162
 
163
- const endHeight = getHeight(level); // 当前 level 的“粗略”高度
164
- const startHeight = level < 18 ? getHeight(level + 1) : 0; // 下一级更细
165
- return {startHeight, endHeight};
163
+ const endHeight = getHeight(level); // 当前 level 的“粗略”高度
164
+ const startHeight = level < 18 ? getHeight(level + 1) : 0; // 下一级更细
165
+ return { startHeight, endHeight };
166
166
  }
167
167
 
168
168
  /**
@@ -172,18 +172,17 @@ export function getMapRangeHeightByLevel(level: number) {
172
172
  * @returns {number} 中间高度(米)
173
173
  */
174
174
  export function getLevelMiddleHeight(level: number): number {
175
- const {startHeight, endHeight} = getMapRangeHeightByLevel(level)
176
- // 如果 startHeight 为 0(如 level=18),几何平均会为 0,不合理
177
- // 所以 level=18 特殊处理:返回 (0 + end)/2 或直接返回 end * 0.7 左右
178
- if (startHeight === 0) {
179
- return endHeight * 0.7; // 经验值,贴近“中间感知”
180
- }
181
-
182
- // 几何平均:√(start × end)
183
- return Math.sqrt(startHeight * endHeight);
175
+ const { startHeight, endHeight } = getMapRangeHeightByLevel(level);
176
+ // 如果 startHeight 为 0(如 level=18),几何平均会为 0,不合理
177
+ // 所以 level=18 特殊处理:返回 (0 + end)/2 或直接返回 end * 0.7 左右
178
+ if (startHeight === 0) {
179
+ return endHeight * 0.7; // 经验值,贴近“中间感知”
180
+ }
181
+
182
+ // 几何平均:√(start × end)
183
+ return Math.sqrt(startHeight * endHeight);
184
184
  }
185
185
 
186
-
187
186
  /**
188
187
  * 根据地图缩放级别(level),返回对应的视野高度范围
189
188
  * 规则:
@@ -194,8 +193,8 @@ export function getLevelMiddleHeight(level: number): number {
194
193
  * @returns {[number, number]} [开始高度, 结束高度](单位:米)
195
194
  */
196
195
  export function getLevelHeightRange(level: number): [number, number] {
197
- const {startHeight, endHeight} = getMapRangeHeightByLevel(level)
198
- return [startHeight, endHeight];
196
+ const { startHeight, endHeight } = getMapRangeHeightByLevel(level);
197
+ return [startHeight, endHeight];
199
198
  }
200
199
 
201
200
  /**
@@ -203,14 +202,24 @@ export function getLevelHeightRange(level: number): [number, number] {
203
202
  * @param {number} height - 当前视野高度(米)
204
203
  * @returns {number} level
205
204
  */
206
- export function getHeightToLevel(height:number): number {
207
- if (height > 32000000) return 1;
208
- if (height <= 0) return 18;
205
+ export function getHeightToLevel(height: number): number {
206
+ if (height > 32000000) return 1;
207
+ if (height <= 0) return 18;
209
208
 
210
- // 解公式:height = 32e6 / 2^(level-2)
211
- let level = 2 + Math.log(32000000 / height) / Math.log(2);
212
- level = Math.floor(level);
209
+ // 解公式:height = 32e6 / 2^(level-2)
210
+ let level = 2 + Math.log(32000000 / height) / Math.log(2);
211
+ level = Math.floor(level);
213
212
 
214
- // 限制在 1~18
215
- return Math.max(1, Math.min(18, level));
213
+ // 限制在 1~18
214
+ return Math.max(1, Math.min(18, level));
215
+ }
216
+ // 將坐标数组中的元素字符串类型统一处理为number类型
217
+ export function convertPosition(
218
+ position: string[] | string[][]
219
+ ): number[] | number[][] {
220
+ return position.map((item) =>
221
+ Array.isArray(item)
222
+ ? (item as string[]).map((str) => Number(str))
223
+ : Number(item)
224
+ ) as number[] | number[][];
216
225
  }
@@ -1,120 +0,0 @@
1
- import { deepMerge, wgs84ToGcj02Format } from "../util";
2
-
3
- export default (hnMap: any) => {
4
- const defaultOption = {
5
- id: "",
6
- position: [],
7
- addressName: "", //地址名称
8
- region: "", //地址
9
- isEncode: false, //是否进行坐标转换
10
- iconSize: 13,
11
- offfset: [0, 0],
12
- color: "#fff",
13
- text: "",
14
- data: null,
15
- };
16
-
17
- class mars3d_class {
18
- type: any = "geocodingTask";
19
- id: any = null;
20
- option: any = JSON.parse(JSON.stringify(defaultOption));
21
- config: any = null;
22
- layerEntity: any = null;
23
-
24
- constructor(option: any) {
25
- this.id = option.id;
26
- deepMerge(this.option, option);
27
- this.config = this.formatConfig(this.option);
28
- this.layerEntity = new mars3d.layer.HeatLayer(
29
- JSON.parse(JSON.stringify(this.config))
30
- );
31
- }
32
-
33
- formatConfig(option: any) {
34
- return {
35
- id: option.id,
36
- positions: option.position,
37
-
38
- style: {
39
- opacity: option.opacity,
40
- scaleByDistance: option.scaleByDistance,
41
- clampToGround: option.clampToGround,
42
- },
43
-
44
- attr: option.data,
45
- };
46
- }
47
-
48
- set(option: any) {
49
- deepMerge(this.option, option);
50
- this.config = this.formatConfig(this.option);
51
- this.layerEntity.setOptions(this.config);
52
- }
53
-
54
- destroy() {
55
- this.layerEntity.remove(true);
56
- hnMap.map.layerList = hnMap.map.layerList.filter(
57
- (v: any) => v.id !== this.id
58
- );
59
- }
60
-
61
- flyTo() {
62
- this.layerEntity.flyTo();
63
- }
64
-
65
- clear() {
66
- this.layerEntity.clear();
67
- }
68
-
69
- setPosition(position: any) {
70
- deepMerge(this.option, { position });
71
- this.layerEntity.setPositions(position);
72
- }
73
-
74
- show() {
75
- this.layerEntity.show = true;
76
- }
77
-
78
- hide() {
79
- this.layerEntity.show = false;
80
- }
81
- }
82
-
83
- class siji_class {
84
- id: any = null;
85
- option: any = JSON.parse(JSON.stringify(defaultOption));
86
- config: any = null;
87
- layerEntity: any = null;
88
-
89
- constructor(option: any) {
90
- this.id = option.id;
91
- deepMerge(this.option, option);
92
- this.layerEntity = new SGMap.GeocodingTask();
93
- }
94
-
95
- getLnglat(option: any) {
96
- // return new Promise((resolve, reject) => {
97
- this.layerEntity
98
- .getLocation({
99
- address: option.addressName,
100
- region: option.region,
101
- isEncode: option.isEncode,
102
- })
103
- .then(function (res: any) {
104
- return res.location;
105
- });
106
- // });
107
- }
108
-
109
- easeTo(option: any) {
110
- hnMap.map.map.easeTo(option);
111
- }
112
- }
113
-
114
- const fn: any = {
115
- mars3d: mars3d_class,
116
- siji: siji_class,
117
- };
118
-
119
- return fn[hnMap.mapType];
120
- };