hn-map 1.1.2 → 1.1.3
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 +78 -21
- package/package.json +1 -1
- package/src/base/siji_entity.ts +22 -15
- package/src/graphic/imagePoint.ts +38 -7
- package/src/graphic/numPoint.ts +12 -8
- package/src/graphic/point.ts +2 -2
- package/src/index.ts +164 -160
- package/src/layer/layer.ts +430 -415
- package/src/map.ts +394 -388
- package/src/other/geocodingTask.ts +120 -0
package/dist/index.js
CHANGED
|
@@ -463,7 +463,7 @@
|
|
|
463
463
|
// 思极key
|
|
464
464
|
sj_app_key: "",
|
|
465
465
|
sj_app_secret: "",
|
|
466
|
-
|
|
466
|
+
sj_style: "aegis://styles/aegis/Streets-Raster512"
|
|
467
467
|
};
|
|
468
468
|
var mars3d_map = /*#__PURE__*/function () {
|
|
469
469
|
function mars3d_map(id, option) {
|
|
@@ -477,7 +477,7 @@
|
|
|
477
477
|
this.event = {};
|
|
478
478
|
this.level = null;
|
|
479
479
|
this.layerList = [];
|
|
480
|
-
this.level =
|
|
480
|
+
this.level = 10;
|
|
481
481
|
deepMerge(this.option, option);
|
|
482
482
|
this.config = this.formatConfig(this.option);
|
|
483
483
|
this.map = new mars3d.Map(id, this.config);
|
|
@@ -744,6 +744,7 @@
|
|
|
744
744
|
_classCallCheck(this, siji_map);
|
|
745
745
|
this.id = null;
|
|
746
746
|
this.map = null;
|
|
747
|
+
this.geocodingTask = null;
|
|
747
748
|
this.option = JSON.parse(JSON.stringify(defaultOption));
|
|
748
749
|
this.config = null;
|
|
749
750
|
// 图层集合
|
|
@@ -756,6 +757,7 @@
|
|
|
756
757
|
deepMerge(this.option, option);
|
|
757
758
|
this.config = this.formatConfig(this.option);
|
|
758
759
|
this.map = new SGMap.Map(this.config);
|
|
760
|
+
this.geocodingTask = new SGMap.GeocodingTask();
|
|
759
761
|
this.map.on("moveend", function (e) {
|
|
760
762
|
return _this2.updateMapParams(e);
|
|
761
763
|
}); // 地图移动完成
|
|
@@ -765,13 +767,20 @@
|
|
|
765
767
|
this.map.on("pitchend", function (e) {
|
|
766
768
|
return _this2.updateMapParams(e);
|
|
767
769
|
}); // 地图俯仰角度完成
|
|
770
|
+
this.map.on("load", function (e) {
|
|
771
|
+
// 路况展示
|
|
772
|
+
var roadNetLayer = new SGMap.RoadNetLayer({
|
|
773
|
+
map: _this2.map
|
|
774
|
+
});
|
|
775
|
+
roadNetLayer.render();
|
|
776
|
+
});
|
|
768
777
|
}
|
|
769
778
|
return _createClass(siji_map, [{
|
|
770
779
|
key: "formatConfig",
|
|
771
780
|
value: function formatConfig(option) {
|
|
772
781
|
return {
|
|
773
782
|
container: this.id,
|
|
774
|
-
style: "aegis://styles/aegis/
|
|
783
|
+
style: option.sj_style || "aegis://styles/aegis/StreetsDark-v2",
|
|
775
784
|
// 默认缩放层级
|
|
776
785
|
zoom: option.level,
|
|
777
786
|
// 地图中心点
|
|
@@ -841,7 +850,7 @@
|
|
|
841
850
|
switch (eventType) {
|
|
842
851
|
case "click":
|
|
843
852
|
this.event[eventType] = function (event) {
|
|
844
|
-
callback(event
|
|
853
|
+
callback(event);
|
|
845
854
|
};
|
|
846
855
|
break;
|
|
847
856
|
case "dblclick":
|
|
@@ -1160,6 +1169,7 @@
|
|
|
1160
1169
|
})) {
|
|
1161
1170
|
console.error("已存在同名图形" + entity.id);
|
|
1162
1171
|
} else {
|
|
1172
|
+
alert(entity.id);
|
|
1163
1173
|
this.children.push(entity);
|
|
1164
1174
|
this.layerEntity.addOverlay(entity.graphic); // 添加图形
|
|
1165
1175
|
// 图层添加新图形后,需要重新调用绑定点击弹窗方法
|
|
@@ -1325,6 +1335,7 @@
|
|
|
1325
1335
|
value: function addLevelEntity(entity) {
|
|
1326
1336
|
if (entity.type == "imagePoint") {
|
|
1327
1337
|
hnMap.map.map.loadImage(entity.option.image, function (error, image) {
|
|
1338
|
+
entity.config.layout["icon-size"] = entity.option.width / image.width;
|
|
1328
1339
|
hnMap.map.map.addImage(entity.id + "_image", image);
|
|
1329
1340
|
hnMap.map.map.addLayer(entity.config);
|
|
1330
1341
|
});
|
|
@@ -1641,9 +1652,6 @@
|
|
|
1641
1652
|
key: "addPopupByAttr",
|
|
1642
1653
|
value: function addPopupByAttr() {
|
|
1643
1654
|
var _this = this;
|
|
1644
|
-
alert("添加属性弹窗");
|
|
1645
|
-
console.log(this.config);
|
|
1646
|
-
console.log(this.graphic);
|
|
1647
1655
|
// 如果已有弹窗,先关闭
|
|
1648
1656
|
this.removePopup();
|
|
1649
1657
|
this.infoWindow = new SGMap.Popup({
|
|
@@ -1653,7 +1661,6 @@
|
|
|
1653
1661
|
className: "my-popupAttr-class"
|
|
1654
1662
|
});
|
|
1655
1663
|
var handleClick = function handleClick(e) {
|
|
1656
|
-
alert("添加属性弹窗111");
|
|
1657
1664
|
// const data = e.features[0].properties;
|
|
1658
1665
|
var data = _this.option.data;
|
|
1659
1666
|
// 创建弹窗内容
|
|
@@ -1698,12 +1705,27 @@
|
|
|
1698
1705
|
}, {
|
|
1699
1706
|
key: "flyTo",
|
|
1700
1707
|
value: function flyTo() {
|
|
1708
|
+
var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1709
|
+
deepMerge(this.option, option);
|
|
1710
|
+
console.log(this.option, "=====flyTo");
|
|
1701
1711
|
var zoom = this.hnMap.map.map.getZoom();
|
|
1712
|
+
var center;
|
|
1713
|
+
if (this.option.center) {
|
|
1714
|
+
center = this.option.center;
|
|
1715
|
+
} else {
|
|
1716
|
+
if (this.type == "line" || this.type == "dash" || this.type == "flicker" || this.type == "flow" || this.type == "arrow" || this.type == "mapLabel" || this.type == "polygon" || this.type == "rectangle") {
|
|
1717
|
+
center = this.option.position[0];
|
|
1718
|
+
} else if (this.type == "route") {
|
|
1719
|
+
center = [this.option.position[0][0], this.option.position[0][1]];
|
|
1720
|
+
} else {
|
|
1721
|
+
center = this.option.position;
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1702
1724
|
this.hnMap.map.map.flyTo({
|
|
1703
1725
|
duration: 1000,
|
|
1704
1726
|
// 持续时间
|
|
1705
|
-
zoom: zoom,
|
|
1706
|
-
center:
|
|
1727
|
+
zoom: this.option.zoom || zoom,
|
|
1728
|
+
center: center
|
|
1707
1729
|
});
|
|
1708
1730
|
}
|
|
1709
1731
|
}, {
|
|
@@ -1908,7 +1930,9 @@
|
|
|
1908
1930
|
type: "Feature",
|
|
1909
1931
|
geometry: {
|
|
1910
1932
|
type: "Point",
|
|
1911
|
-
coordinates: option.position
|
|
1933
|
+
coordinates: option.position.map(function (num) {
|
|
1934
|
+
return Number(num);
|
|
1935
|
+
})
|
|
1912
1936
|
},
|
|
1913
1937
|
properties: Object.assign({
|
|
1914
1938
|
id: option.id
|
|
@@ -1943,7 +1967,9 @@
|
|
|
1943
1967
|
},
|
|
1944
1968
|
geometry: {
|
|
1945
1969
|
type: "Point",
|
|
1946
|
-
coordinates: this.option.position
|
|
1970
|
+
coordinates: this.option.position.map(function (num) {
|
|
1971
|
+
return Number(num);
|
|
1972
|
+
})
|
|
1947
1973
|
}
|
|
1948
1974
|
}]
|
|
1949
1975
|
});
|
|
@@ -2111,7 +2137,9 @@
|
|
|
2111
2137
|
type: "Feature",
|
|
2112
2138
|
geometry: {
|
|
2113
2139
|
type: "Point",
|
|
2114
|
-
coordinates: option.position
|
|
2140
|
+
coordinates: option.position.map(function (num) {
|
|
2141
|
+
return Number(num);
|
|
2142
|
+
})
|
|
2115
2143
|
},
|
|
2116
2144
|
properties: {
|
|
2117
2145
|
name: option.text
|
|
@@ -2142,7 +2170,9 @@
|
|
|
2142
2170
|
type: "Feature",
|
|
2143
2171
|
geometry: {
|
|
2144
2172
|
type: "Point",
|
|
2145
|
-
coordinates: option.position
|
|
2173
|
+
coordinates: option.position.map(function (num) {
|
|
2174
|
+
return Number(num);
|
|
2175
|
+
})
|
|
2146
2176
|
},
|
|
2147
2177
|
properties: {
|
|
2148
2178
|
name: option.num
|
|
@@ -2153,6 +2183,7 @@
|
|
|
2153
2183
|
layout: {
|
|
2154
2184
|
"icon-anchor": "center",
|
|
2155
2185
|
"text-field": "{name}",
|
|
2186
|
+
// 文本
|
|
2156
2187
|
"text-size": Number(option.size),
|
|
2157
2188
|
"text-anchor": "center" // 顶部对齐
|
|
2158
2189
|
},
|
|
@@ -2179,7 +2210,9 @@
|
|
|
2179
2210
|
},
|
|
2180
2211
|
geometry: {
|
|
2181
2212
|
type: "Point",
|
|
2182
|
-
coordinates: this.option.position
|
|
2213
|
+
coordinates: this.option.position.map(function (num) {
|
|
2214
|
+
return Number(num);
|
|
2215
|
+
})
|
|
2183
2216
|
}
|
|
2184
2217
|
}]
|
|
2185
2218
|
});
|
|
@@ -2206,7 +2239,9 @@
|
|
|
2206
2239
|
},
|
|
2207
2240
|
geometry: {
|
|
2208
2241
|
type: "Point",
|
|
2209
|
-
coordinates: this.option.position
|
|
2242
|
+
coordinates: this.option.position.map(function (num) {
|
|
2243
|
+
return Number(num);
|
|
2244
|
+
})
|
|
2210
2245
|
}
|
|
2211
2246
|
}]
|
|
2212
2247
|
});
|
|
@@ -2426,15 +2461,26 @@
|
|
|
2426
2461
|
})
|
|
2427
2462
|
},
|
|
2428
2463
|
properties: {
|
|
2429
|
-
name:
|
|
2464
|
+
name: option.text
|
|
2430
2465
|
}
|
|
2431
2466
|
}]
|
|
2432
2467
|
}
|
|
2433
2468
|
},
|
|
2434
2469
|
layout: {
|
|
2435
2470
|
"icon-image": option.id + "_image",
|
|
2436
|
-
"icon-size":
|
|
2437
|
-
|
|
2471
|
+
"icon-size": 1,
|
|
2472
|
+
"icon-ignore-placement": true,
|
|
2473
|
+
"text-ignore-placement": true,
|
|
2474
|
+
"text-field": "{name}",
|
|
2475
|
+
// 文本
|
|
2476
|
+
"text-size": option.fontSize,
|
|
2477
|
+
"text-anchor": "top",
|
|
2478
|
+
"icon-anchor": "center",
|
|
2479
|
+
"text-offset": option.offset
|
|
2480
|
+
},
|
|
2481
|
+
paint: {
|
|
2482
|
+
"text-color": option.color
|
|
2483
|
+
} // 填充样式
|
|
2438
2484
|
};
|
|
2439
2485
|
return config;
|
|
2440
2486
|
}
|
|
@@ -2468,6 +2514,18 @@
|
|
|
2468
2514
|
}
|
|
2469
2515
|
}
|
|
2470
2516
|
}
|
|
2517
|
+
for (var _key in this.config) {
|
|
2518
|
+
if (this.config.hasOwnProperty(_key)) {
|
|
2519
|
+
if (_key == "paint") {
|
|
2520
|
+
for (var _key2 in this.config[_key]) {
|
|
2521
|
+
if (this.config[_key].hasOwnProperty(_key2)) {
|
|
2522
|
+
// 遍历 paint 属性
|
|
2523
|
+
hnMap.map.map.setPaintProperty(this.config.id, _key2, this.config[_key][_key2]);
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2471
2529
|
}
|
|
2472
2530
|
}]);
|
|
2473
2531
|
}(siji_entity);
|
|
@@ -5197,7 +5255,6 @@
|
|
|
5197
5255
|
if (!HnMap.allowConstruction) {
|
|
5198
5256
|
throw new Error("请使用 HnMap.create() 创建实例");
|
|
5199
5257
|
}
|
|
5200
|
-
console.log(11111111111);
|
|
5201
5258
|
this.id = id;
|
|
5202
5259
|
this.option = option;
|
|
5203
5260
|
this.mapType = mapType;
|
|
@@ -5285,7 +5342,7 @@
|
|
|
5285
5342
|
return SGMap.tokenTask.login(option.sj_app_key, option.sj_app_secret);
|
|
5286
5343
|
case 15:
|
|
5287
5344
|
_context.n = 16;
|
|
5288
|
-
return SGMap.plugin(["SGMap.DrawPolygonHandler", "SGMap.DrawCircleHandler", "SGMap.DrawRectangleHandler", "SGMap.GeocodingTask"]);
|
|
5345
|
+
return SGMap.plugin(["SGMap.DrawPolygonHandler", "SGMap.DrawCircleHandler", "SGMap.DrawRectangleHandler", "SGMap.GeocodingTask", "SGMap.RoadNetLayer"]);
|
|
5289
5346
|
case 16:
|
|
5290
5347
|
return _context.a(3, 17);
|
|
5291
5348
|
case 17:
|
package/package.json
CHANGED
package/src/base/siji_entity.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { deepMerge } from "../util";
|
|
1
2
|
export default class siji_entity {
|
|
2
3
|
event: any = {};
|
|
3
4
|
infoWindow: any = null;
|
|
@@ -6,7 +7,7 @@ export default class siji_entity {
|
|
|
6
7
|
graphic: any = null;
|
|
7
8
|
option: any = null;
|
|
8
9
|
type: any = null;
|
|
9
|
-
show:boolean = false;
|
|
10
|
+
show: boolean = false;
|
|
10
11
|
|
|
11
12
|
constructor(hnMap: any) {
|
|
12
13
|
this.hnMap = hnMap;
|
|
@@ -16,9 +17,6 @@ export default class siji_entity {
|
|
|
16
17
|
|
|
17
18
|
// 添加属性弹窗
|
|
18
19
|
addPopupByAttr() {
|
|
19
|
-
alert("添加属性弹窗");
|
|
20
|
-
console.log(this.config);
|
|
21
|
-
console.log(this.graphic);
|
|
22
20
|
// 如果已有弹窗,先关闭
|
|
23
21
|
this.removePopup();
|
|
24
22
|
|
|
@@ -28,7 +26,6 @@ export default class siji_entity {
|
|
|
28
26
|
});
|
|
29
27
|
|
|
30
28
|
const handleClick = (e: any) => {
|
|
31
|
-
alert("添加属性弹窗111");
|
|
32
29
|
// const data = e.features[0].properties;
|
|
33
30
|
const data = this.option.data;
|
|
34
31
|
// 创建弹窗内容
|
|
@@ -47,7 +44,6 @@ export default class siji_entity {
|
|
|
47
44
|
// 添加自定义dom弹窗
|
|
48
45
|
addCustomPopup(getCustomDom: any) {
|
|
49
46
|
this.removePopup();
|
|
50
|
-
|
|
51
47
|
this.infoWindow = new SGMap.Popup({
|
|
52
48
|
offset: { bottom: [0, 0] },
|
|
53
49
|
className: "my-customPopup-class",
|
|
@@ -71,12 +67,15 @@ export default class siji_entity {
|
|
|
71
67
|
}
|
|
72
68
|
}
|
|
73
69
|
|
|
74
|
-
flyTo() {
|
|
70
|
+
flyTo(option: any = {}) {
|
|
71
|
+
deepMerge(this.option, option);
|
|
72
|
+
console.log(this.option, "=====flyTo");
|
|
75
73
|
let zoom = this.hnMap.map.map.getZoom();
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
let center;
|
|
75
|
+
if (this.option.center) {
|
|
76
|
+
center = this.option.center;
|
|
77
|
+
} else {
|
|
78
|
+
if (
|
|
80
79
|
this.type == "line" ||
|
|
81
80
|
this.type == "dash" ||
|
|
82
81
|
this.type == "flicker" ||
|
|
@@ -85,10 +84,18 @@ export default class siji_entity {
|
|
|
85
84
|
this.type == "mapLabel" ||
|
|
86
85
|
this.type == "polygon" ||
|
|
87
86
|
this.type == "rectangle"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
) {
|
|
88
|
+
center = this.option.position[0];
|
|
89
|
+
} else if (this.type == "route") {
|
|
90
|
+
center = [this.option.position[0][0], this.option.position[0][1]];
|
|
91
|
+
} else {
|
|
92
|
+
center = this.option.position;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
this.hnMap.map.map.flyTo({
|
|
96
|
+
duration: 1000, // 持续时间
|
|
97
|
+
zoom: this.option.zoom || zoom,
|
|
98
|
+
center: center,
|
|
92
99
|
});
|
|
93
100
|
}
|
|
94
101
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {deepMerge, getLevelMiddleHeight, wgs84ToGcj02Format} from "../util";
|
|
1
|
+
import { deepMerge, getLevelMiddleHeight, wgs84ToGcj02Format } from "../util";
|
|
2
2
|
import mars3d_entity from "../base/mars3d_entity";
|
|
3
3
|
import gaode_entity from "../base/gaode_entity";
|
|
4
4
|
import siji_entity from "../base/siji_entity";
|
|
@@ -51,8 +51,12 @@ export default (hnMap: any) => {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
formatConfig(option: any) {
|
|
54
|
-
const distanceDisplayCondition_far = getLevelMiddleHeight(
|
|
55
|
-
|
|
54
|
+
const distanceDisplayCondition_far = getLevelMiddleHeight(
|
|
55
|
+
option.distanceDisplayCondition_far
|
|
56
|
+
);
|
|
57
|
+
const distanceDisplayCondition_near = getLevelMiddleHeight(
|
|
58
|
+
option.distanceDisplayCondition_near
|
|
59
|
+
);
|
|
56
60
|
return {
|
|
57
61
|
id: option.id,
|
|
58
62
|
position: option.position,
|
|
@@ -174,10 +178,10 @@ export default (hnMap: any) => {
|
|
|
174
178
|
type: "Feature",
|
|
175
179
|
geometry: {
|
|
176
180
|
type: "Point",
|
|
177
|
-
coordinates: option.position.map((num:any)=>Number(num)),
|
|
181
|
+
coordinates: option.position.map((num: any) => Number(num)),
|
|
178
182
|
},
|
|
179
183
|
properties: {
|
|
180
|
-
name:
|
|
184
|
+
name: option.text,
|
|
181
185
|
},
|
|
182
186
|
},
|
|
183
187
|
],
|
|
@@ -185,8 +189,18 @@ export default (hnMap: any) => {
|
|
|
185
189
|
},
|
|
186
190
|
layout: {
|
|
187
191
|
"icon-image": option.id + "_image",
|
|
188
|
-
"icon-size":
|
|
192
|
+
"icon-size": 1,
|
|
193
|
+
"icon-ignore-placement": true,
|
|
194
|
+
"text-ignore-placement": true,
|
|
195
|
+
"text-field": "{name}", // 文本
|
|
196
|
+
"text-size": option.fontSize,
|
|
197
|
+
"text-anchor": "top",
|
|
198
|
+
"icon-anchor": "center",
|
|
199
|
+
"text-offset": option.offset,
|
|
189
200
|
},
|
|
201
|
+
paint: {
|
|
202
|
+
"text-color": option.color,
|
|
203
|
+
}, // 填充样式
|
|
190
204
|
};
|
|
191
205
|
return config;
|
|
192
206
|
}
|
|
@@ -202,7 +216,7 @@ export default (hnMap: any) => {
|
|
|
202
216
|
type: "Feature",
|
|
203
217
|
geometry: {
|
|
204
218
|
type: "Point",
|
|
205
|
-
coordinates: this.option.position.map((num:any)=>Number(num)),
|
|
219
|
+
coordinates: this.option.position.map((num: any) => Number(num)),
|
|
206
220
|
},
|
|
207
221
|
},
|
|
208
222
|
],
|
|
@@ -224,6 +238,23 @@ export default (hnMap: any) => {
|
|
|
224
238
|
}
|
|
225
239
|
}
|
|
226
240
|
}
|
|
241
|
+
|
|
242
|
+
for (let key in this.config) {
|
|
243
|
+
if (this.config.hasOwnProperty(key)) {
|
|
244
|
+
if (key == "paint") {
|
|
245
|
+
for (let key2 in this.config[key]) {
|
|
246
|
+
if (this.config[key].hasOwnProperty(key2)) {
|
|
247
|
+
// 遍历 paint 属性
|
|
248
|
+
hnMap.map.map.setPaintProperty(
|
|
249
|
+
this.config.id,
|
|
250
|
+
key2,
|
|
251
|
+
this.config[key][key2]
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
227
258
|
}
|
|
228
259
|
}
|
|
229
260
|
|
package/src/graphic/numPoint.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {deepMerge, getLevelMiddleHeight, wgs84ToGcj02Format} from "../util";
|
|
1
|
+
import { deepMerge, getLevelMiddleHeight, wgs84ToGcj02Format } from "../util";
|
|
2
2
|
import mars3d_entity from "../base/mars3d_entity";
|
|
3
3
|
import gaode_entity from "../base/gaode_entity";
|
|
4
4
|
import siji_entity from "../base/siji_entity";
|
|
@@ -35,8 +35,12 @@ export default (hnMap: any) => {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
formatConfig(option: any) {
|
|
38
|
-
const distanceDisplayCondition_far = getLevelMiddleHeight(
|
|
39
|
-
|
|
38
|
+
const distanceDisplayCondition_far = getLevelMiddleHeight(
|
|
39
|
+
option.distanceDisplayCondition_far
|
|
40
|
+
);
|
|
41
|
+
const distanceDisplayCondition_near = getLevelMiddleHeight(
|
|
42
|
+
option.distanceDisplayCondition_near
|
|
43
|
+
);
|
|
40
44
|
return {
|
|
41
45
|
id: option.id,
|
|
42
46
|
position: option.position,
|
|
@@ -140,7 +144,7 @@ export default (hnMap: any) => {
|
|
|
140
144
|
type: "Feature",
|
|
141
145
|
geometry: {
|
|
142
146
|
type: "Point",
|
|
143
|
-
coordinates: option.position,
|
|
147
|
+
coordinates: option.position.map((num: any) => Number(num)),
|
|
144
148
|
},
|
|
145
149
|
properties: {
|
|
146
150
|
name: option.text,
|
|
@@ -173,7 +177,7 @@ export default (hnMap: any) => {
|
|
|
173
177
|
type: "Feature",
|
|
174
178
|
geometry: {
|
|
175
179
|
type: "Point",
|
|
176
|
-
coordinates: option.position,
|
|
180
|
+
coordinates: option.position.map((num: any) => Number(num)),
|
|
177
181
|
},
|
|
178
182
|
properties: {
|
|
179
183
|
name: option.num,
|
|
@@ -184,7 +188,7 @@ export default (hnMap: any) => {
|
|
|
184
188
|
},
|
|
185
189
|
layout: {
|
|
186
190
|
"icon-anchor": "center",
|
|
187
|
-
"text-field": "{name}",
|
|
191
|
+
"text-field": "{name}", // 文本
|
|
188
192
|
"text-size": Number(option.size),
|
|
189
193
|
"text-anchor": "center", // 顶部对齐
|
|
190
194
|
}, // 文本样式
|
|
@@ -209,7 +213,7 @@ export default (hnMap: any) => {
|
|
|
209
213
|
properties: { name: this.option.text },
|
|
210
214
|
geometry: {
|
|
211
215
|
type: "Point",
|
|
212
|
-
coordinates: this.option.position,
|
|
216
|
+
coordinates: this.option.position.map((num: any) => Number(num)),
|
|
213
217
|
},
|
|
214
218
|
},
|
|
215
219
|
],
|
|
@@ -242,7 +246,7 @@ export default (hnMap: any) => {
|
|
|
242
246
|
properties: { name: this.option.num },
|
|
243
247
|
geometry: {
|
|
244
248
|
type: "Point",
|
|
245
|
-
coordinates: this.option.position,
|
|
249
|
+
coordinates: this.option.position.map((num: any) => Number(num)),
|
|
246
250
|
},
|
|
247
251
|
},
|
|
248
252
|
],
|
package/src/graphic/point.ts
CHANGED
|
@@ -162,7 +162,7 @@ export default (hnMap: any) => {
|
|
|
162
162
|
type: "Feature",
|
|
163
163
|
geometry: {
|
|
164
164
|
type: "Point",
|
|
165
|
-
coordinates: option.position,
|
|
165
|
+
coordinates: option.position.map((num:any)=>Number(num)),
|
|
166
166
|
},
|
|
167
167
|
properties: {
|
|
168
168
|
id: option.id,
|
|
@@ -198,7 +198,7 @@ export default (hnMap: any) => {
|
|
|
198
198
|
properties: { name: this.option.text },
|
|
199
199
|
geometry: {
|
|
200
200
|
type: "Point",
|
|
201
|
-
coordinates: this.option.position,
|
|
201
|
+
coordinates: this.option.position.map((num:any)=>Number(num)),
|
|
202
202
|
},
|
|
203
203
|
},
|
|
204
204
|
],
|