@vtx/map 1.1.14 → 1.1.16
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/README.md +44 -44
- package/lib/VtxMap/AMap/AMap.js +2 -2
- package/lib/VtxMap/AMap/AMap.js.map +1 -1
- package/lib/VtxMap/OMap/Map.js +43 -43
- package/lib/VtxMap/OMap/Map.js.map +1 -1
- package/lib/VtxMap/OMap/Map.less +70 -70
- package/lib/VtxMap/OlMap/Map.css +60 -0
- package/lib/VtxMap/OlMap/Map.js +170 -90
- package/lib/VtxMap/OlMap/Map.js.map +1 -1
- package/lib/VtxMap/OlMap/Map.less +230 -164
- package/lib/VtxMap/TMap/TMap.js +18 -18
- package/lib/VtxMap/TMap/TMap.js.map +1 -1
- package/lib/VtxSearchMap/index.js.map +1 -1
- package/lib/VtxSearchMap/mapping.js.map +1 -1
- package/package.json +1 -1
package/lib/VtxMap/OMap/Map.less
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
.label-content{
|
|
2
|
-
display: inline-block;
|
|
3
|
-
padding: 5px;
|
|
4
|
-
line-height: 22px;
|
|
5
|
-
text-align: center;
|
|
6
|
-
border-radius: 5px;
|
|
7
|
-
background-color: #fff;
|
|
8
|
-
opacity: 1;
|
|
9
|
-
color: #5DD0EE;
|
|
10
|
-
transform: translate(-50%);
|
|
11
|
-
-ms-transform: translate(-50%);
|
|
12
|
-
}
|
|
13
|
-
.noselect {
|
|
14
|
-
-webkit-touch-callout: none; /* iOS Safari */
|
|
15
|
-
-webkit-user-select: none; /* Chrome/Safari/Opera */
|
|
16
|
-
-khtml-user-select: none; /* Konqueror */
|
|
17
|
-
-moz-user-select: none; /* Firefox */
|
|
18
|
-
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
19
|
-
user-select: none; /* Non-prefixed version, currently
|
|
20
|
-
not supported by any browser */
|
|
21
|
-
}
|
|
22
|
-
.vtx_gmap_html_pointCollection_a{
|
|
23
|
-
position: absolute;
|
|
24
|
-
canvas{
|
|
25
|
-
z-index: 111;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
.vtx-g-rangingPoint{
|
|
29
|
-
width: 8px;
|
|
30
|
-
height: 8px;
|
|
31
|
-
background-color: #fff;
|
|
32
|
-
border: 2px solid #108ee9;
|
|
33
|
-
display: inline-block;
|
|
34
|
-
border-radius: 8px;
|
|
35
|
-
position: relative;
|
|
36
|
-
top: 5px;
|
|
37
|
-
left: 1px;
|
|
38
|
-
}
|
|
39
|
-
.vtx-g-rangingDistance{
|
|
40
|
-
position: relative;
|
|
41
|
-
top: -36px;
|
|
42
|
-
left: 15px;
|
|
43
|
-
height: 30px;
|
|
44
|
-
line-height: 28px;
|
|
45
|
-
background-color: #fff;
|
|
46
|
-
border: 1px solid #108ee9;
|
|
47
|
-
font-size: 12px;
|
|
48
|
-
word-break: keep-all;
|
|
49
|
-
padding: 0px 3px;
|
|
50
|
-
color: #108ee9;
|
|
51
|
-
}
|
|
52
|
-
.vtx-g-rang-exit{
|
|
53
|
-
width: 12px;
|
|
54
|
-
height: 12px;
|
|
55
|
-
background-color: #fff;
|
|
56
|
-
border: 2px solid #108ee9;
|
|
57
|
-
color: #108ee9;
|
|
58
|
-
line-height: 7px;
|
|
59
|
-
text-align: center;
|
|
60
|
-
font-size: 12px;
|
|
61
|
-
cursor: pointer;
|
|
62
|
-
}
|
|
63
|
-
.vtx-g-rang-showRangTool{
|
|
64
|
-
line-height: 18px;
|
|
65
|
-
font-size: 12px;
|
|
66
|
-
border: 1px solid #108ee9;
|
|
67
|
-
word-break: keep-all;
|
|
68
|
-
background-color: #fff;
|
|
69
|
-
padding: 0px 5px;
|
|
70
|
-
}
|
|
1
|
+
.label-content{
|
|
2
|
+
display: inline-block;
|
|
3
|
+
padding: 5px;
|
|
4
|
+
line-height: 22px;
|
|
5
|
+
text-align: center;
|
|
6
|
+
border-radius: 5px;
|
|
7
|
+
background-color: #fff;
|
|
8
|
+
opacity: 1;
|
|
9
|
+
color: #5DD0EE;
|
|
10
|
+
transform: translate(-50%);
|
|
11
|
+
-ms-transform: translate(-50%);
|
|
12
|
+
}
|
|
13
|
+
.noselect {
|
|
14
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
15
|
+
-webkit-user-select: none; /* Chrome/Safari/Opera */
|
|
16
|
+
-khtml-user-select: none; /* Konqueror */
|
|
17
|
+
-moz-user-select: none; /* Firefox */
|
|
18
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
19
|
+
user-select: none; /* Non-prefixed version, currently
|
|
20
|
+
not supported by any browser */
|
|
21
|
+
}
|
|
22
|
+
.vtx_gmap_html_pointCollection_a{
|
|
23
|
+
position: absolute;
|
|
24
|
+
canvas{
|
|
25
|
+
z-index: 111;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
.vtx-g-rangingPoint{
|
|
29
|
+
width: 8px;
|
|
30
|
+
height: 8px;
|
|
31
|
+
background-color: #fff;
|
|
32
|
+
border: 2px solid #108ee9;
|
|
33
|
+
display: inline-block;
|
|
34
|
+
border-radius: 8px;
|
|
35
|
+
position: relative;
|
|
36
|
+
top: 5px;
|
|
37
|
+
left: 1px;
|
|
38
|
+
}
|
|
39
|
+
.vtx-g-rangingDistance{
|
|
40
|
+
position: relative;
|
|
41
|
+
top: -36px;
|
|
42
|
+
left: 15px;
|
|
43
|
+
height: 30px;
|
|
44
|
+
line-height: 28px;
|
|
45
|
+
background-color: #fff;
|
|
46
|
+
border: 1px solid #108ee9;
|
|
47
|
+
font-size: 12px;
|
|
48
|
+
word-break: keep-all;
|
|
49
|
+
padding: 0px 3px;
|
|
50
|
+
color: #108ee9;
|
|
51
|
+
}
|
|
52
|
+
.vtx-g-rang-exit{
|
|
53
|
+
width: 12px;
|
|
54
|
+
height: 12px;
|
|
55
|
+
background-color: #fff;
|
|
56
|
+
border: 2px solid #108ee9;
|
|
57
|
+
color: #108ee9;
|
|
58
|
+
line-height: 7px;
|
|
59
|
+
text-align: center;
|
|
60
|
+
font-size: 12px;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
}
|
|
63
|
+
.vtx-g-rang-showRangTool{
|
|
64
|
+
line-height: 18px;
|
|
65
|
+
font-size: 12px;
|
|
66
|
+
border: 1px solid #108ee9;
|
|
67
|
+
word-break: keep-all;
|
|
68
|
+
background-color: #fff;
|
|
69
|
+
padding: 0px 5px;
|
|
70
|
+
}
|
package/lib/VtxMap/OlMap/Map.css
CHANGED
|
@@ -167,3 +167,63 @@
|
|
|
167
167
|
.ol-popup-closer:after {
|
|
168
168
|
content: "✖";
|
|
169
169
|
}
|
|
170
|
+
.ol-scale-line {
|
|
171
|
+
background-color: transparent;
|
|
172
|
+
width: 113px;
|
|
173
|
+
height: 30px;
|
|
174
|
+
border-left: 1px solid #000;
|
|
175
|
+
border-right: 1px solid #000;
|
|
176
|
+
border-bottom: 1px solid #000;
|
|
177
|
+
position: absolute !important;
|
|
178
|
+
bottom: 20px !important;
|
|
179
|
+
right: 20px !important;
|
|
180
|
+
text-align: center;
|
|
181
|
+
}
|
|
182
|
+
.ol-scale-line-tl {
|
|
183
|
+
position: absolute;
|
|
184
|
+
top: 20px;
|
|
185
|
+
left: 20px;
|
|
186
|
+
background-color: transparent;
|
|
187
|
+
width: 113px;
|
|
188
|
+
height: 30px;
|
|
189
|
+
border-left: 1px solid #000;
|
|
190
|
+
border-right: 1px solid #000;
|
|
191
|
+
border-bottom: 1px solid #000;
|
|
192
|
+
text-align: center;
|
|
193
|
+
}
|
|
194
|
+
.ol-scale-line-bl {
|
|
195
|
+
position: absolute;
|
|
196
|
+
bottom: 20px;
|
|
197
|
+
left: 20px;
|
|
198
|
+
background-color: transparent;
|
|
199
|
+
width: 113px;
|
|
200
|
+
height: 30px;
|
|
201
|
+
border-left: 1px solid #000;
|
|
202
|
+
border-right: 1px solid #000;
|
|
203
|
+
border-bottom: 1px solid #000;
|
|
204
|
+
text-align: center;
|
|
205
|
+
}
|
|
206
|
+
.ol-scale-line-tr {
|
|
207
|
+
position: absolute;
|
|
208
|
+
top: 20px;
|
|
209
|
+
right: 20px;
|
|
210
|
+
background-color: transparent;
|
|
211
|
+
width: 113px;
|
|
212
|
+
height: 30px;
|
|
213
|
+
border-left: 1px solid #000;
|
|
214
|
+
border-right: 1px solid #000;
|
|
215
|
+
border-bottom: 1px solid #000;
|
|
216
|
+
text-align: center;
|
|
217
|
+
}
|
|
218
|
+
.ol-scale-line-bl {
|
|
219
|
+
position: absolute;
|
|
220
|
+
bottom: 20px;
|
|
221
|
+
right: 20px;
|
|
222
|
+
background-color: transparent;
|
|
223
|
+
width: 113px;
|
|
224
|
+
height: 30px;
|
|
225
|
+
border-left: 1px solid #000;
|
|
226
|
+
border-right: 1px solid #000;
|
|
227
|
+
border-bottom: 1px solid #000;
|
|
228
|
+
text-align: center;
|
|
229
|
+
}
|
package/lib/VtxMap/OlMap/Map.js
CHANGED
|
@@ -120,6 +120,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
120
120
|
sketch: null,
|
|
121
121
|
listener: null
|
|
122
122
|
};
|
|
123
|
+
_this.scaleControl = null;
|
|
123
124
|
_this.pointLayers = [];
|
|
124
125
|
_this.mouseNowPosition = {
|
|
125
126
|
x: 0,
|
|
@@ -295,7 +296,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
295
296
|
|
|
296
297
|
|
|
297
298
|
if (t.props.showControl) {
|
|
298
|
-
t.showControl();
|
|
299
|
+
t.showControl(t.props.showControl);
|
|
299
300
|
} // 画热力图
|
|
300
301
|
|
|
301
302
|
|
|
@@ -446,13 +447,15 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
446
447
|
|
|
447
448
|
if (!projection) {
|
|
448
449
|
projection = 'EPSG:4326';
|
|
449
|
-
}
|
|
450
|
+
} //中心点
|
|
451
|
+
|
|
450
452
|
|
|
453
|
+
var center = mapCenter && mapCenter instanceof Array && mapCenter.length == 2 ? mapCenter : [116.400433, 39.906705];
|
|
454
|
+
center = [parseFloat(center[0]), parseFloat(center[1])];
|
|
451
455
|
window.VtxMap[mapId] = t.state.gis = new ol.Map({
|
|
452
456
|
target: mapId.toString(),
|
|
453
457
|
view: new ol.View({
|
|
454
|
-
center:
|
|
455
|
-
//中心点
|
|
458
|
+
center: center,
|
|
456
459
|
zoom: mapZoomLevel || 10,
|
|
457
460
|
projection: projection,
|
|
458
461
|
minZoom: minZoom,
|
|
@@ -466,8 +469,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
466
469
|
}); // 基本地图视图
|
|
467
470
|
|
|
468
471
|
t.viewer = new ol.View({
|
|
469
|
-
center:
|
|
470
|
-
//中心点
|
|
472
|
+
center: center,
|
|
471
473
|
zoom: mapZoomLevel || 10,
|
|
472
474
|
projection: projection,
|
|
473
475
|
minZoom: minZoom,
|
|
@@ -554,6 +556,19 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
554
556
|
duration: 2000
|
|
555
557
|
});
|
|
556
558
|
}
|
|
559
|
+
} //设置地图缩放层级
|
|
560
|
+
|
|
561
|
+
}, {
|
|
562
|
+
key: "setZoomLevel",
|
|
563
|
+
value: function setZoomLevel(zoom) {
|
|
564
|
+
var t = this;
|
|
565
|
+
var z = t.state.gis.getView().getZoom();
|
|
566
|
+
|
|
567
|
+
if (z == zoom) {
|
|
568
|
+
return false;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
t.state.gis.getView().setZoom(zoom);
|
|
557
572
|
} //获取当前中心点
|
|
558
573
|
|
|
559
574
|
}, {
|
|
@@ -952,6 +967,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
952
967
|
lng = _gc$flatCoordinates[0],
|
|
953
968
|
lat = _gc$flatCoordinates[1];
|
|
954
969
|
|
|
970
|
+
gc.x = lng;
|
|
971
|
+
gc.y = lat;
|
|
955
972
|
t.addPoint([{
|
|
956
973
|
id: t.drawParam.data.id,
|
|
957
974
|
longitude: lng,
|
|
@@ -1372,10 +1389,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1372
1389
|
}
|
|
1373
1390
|
} //将制定图元展示在视野内 (强制改变地图中心位置)
|
|
1374
1391
|
|
|
1375
|
-
/*
|
|
1376
|
-
参数arg格式如下1,2
|
|
1377
|
-
1.string 格式如:'1,a,2,3,4'
|
|
1378
|
-
2.数组 ['1','2']
|
|
1392
|
+
/*
|
|
1393
|
+
参数arg格式如下1,2
|
|
1394
|
+
1.string 格式如:'1,a,2,3,4'
|
|
1395
|
+
2.数组 ['1','2']
|
|
1379
1396
|
*/
|
|
1380
1397
|
|
|
1381
1398
|
}, {
|
|
@@ -1698,12 +1715,12 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1698
1715
|
item.value.clear();
|
|
1699
1716
|
});
|
|
1700
1717
|
}
|
|
1701
|
-
/*
|
|
1702
|
-
* 添加信息窗口
|
|
1703
|
-
* params
|
|
1704
|
-
* @position: Array[longitude,latitude]
|
|
1705
|
-
* @content: String|HTML
|
|
1706
|
-
* @close: boolean
|
|
1718
|
+
/*
|
|
1719
|
+
* 添加信息窗口
|
|
1720
|
+
* params
|
|
1721
|
+
* @position: Array[longitude,latitude]
|
|
1722
|
+
* @content: String|HTML
|
|
1723
|
+
* @close: boolean
|
|
1707
1724
|
*/
|
|
1708
1725
|
|
|
1709
1726
|
}, {
|
|
@@ -1761,7 +1778,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1761
1778
|
|
|
1762
1779
|
|
|
1763
1780
|
var feature = new ol.Feature({
|
|
1764
|
-
geometry: new ol.geom.Point([item.longitude, item.latitude]),
|
|
1781
|
+
geometry: new ol.geom.Point([parseFloat(item.longitude), parseFloat(item.latitude)]),
|
|
1765
1782
|
name: item.name,
|
|
1766
1783
|
id: item.id,
|
|
1767
1784
|
params: _objectSpread({}, item)
|
|
@@ -1792,7 +1809,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1792
1809
|
|
|
1793
1810
|
var pop = new ol.Overlay({
|
|
1794
1811
|
id: item.id,
|
|
1795
|
-
position: [item.longitude, item.latitude],
|
|
1812
|
+
position: [parseFloat(item.longitude), parseFloat(item.latitude)],
|
|
1796
1813
|
positioning: 'center-center',
|
|
1797
1814
|
element: nodes,
|
|
1798
1815
|
autoPanMargin: 20,
|
|
@@ -1824,7 +1841,43 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1824
1841
|
}
|
|
1825
1842
|
|
|
1826
1843
|
if (!!item.canShowLabel && item.canShowLabel) {
|
|
1827
|
-
|
|
1844
|
+
var textStyle = _objectSpread({
|
|
1845
|
+
textAlign: 'center',
|
|
1846
|
+
//对齐方式
|
|
1847
|
+
textBaseline: 'middle',
|
|
1848
|
+
//文本基线
|
|
1849
|
+
font: 'normal 12px 微软雅黑',
|
|
1850
|
+
//字体样式
|
|
1851
|
+
text: cg.labelContent,
|
|
1852
|
+
//文本内容
|
|
1853
|
+
offsetX: cg.labelPixelX,
|
|
1854
|
+
// x轴偏置
|
|
1855
|
+
offsetY: cg.labelPixelY,
|
|
1856
|
+
// Y轴偏置
|
|
1857
|
+
fill: new ol.style.Fill({
|
|
1858
|
+
//填充样式
|
|
1859
|
+
color: '#1890ff'
|
|
1860
|
+
}),
|
|
1861
|
+
backgroundFill: new ol.style.Fill({
|
|
1862
|
+
// 填充背景
|
|
1863
|
+
color: 'rgba(255, 255, 255, 1)'
|
|
1864
|
+
}),
|
|
1865
|
+
padding: [2, 5, 2, 5]
|
|
1866
|
+
}, cg.labelStyle || {});
|
|
1867
|
+
|
|
1868
|
+
if (cg.labelStyle && cg.labelStyle.fill) {
|
|
1869
|
+
textStyle['fill'] = new ol.style.Fill({
|
|
1870
|
+
color: cg.labelStyle.fill
|
|
1871
|
+
});
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
if (cg.labelStyle && cg.labelStyle.backgroundFill) {
|
|
1875
|
+
textStyle['backgroundFill'] = new ol.style.Fill({
|
|
1876
|
+
color: cg.labelStyle.backgroundFill
|
|
1877
|
+
});
|
|
1878
|
+
} // 创建地图要素图标样式
|
|
1879
|
+
|
|
1880
|
+
|
|
1828
1881
|
style = new ol.style.Style({
|
|
1829
1882
|
image: new ol.style.Icon({
|
|
1830
1883
|
anchor: [-cg.markerContentX, -cg.markerContentY],
|
|
@@ -1837,29 +1890,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1837
1890
|
scale: cg.scale || 1
|
|
1838
1891
|
}),
|
|
1839
1892
|
// 创建地图要素文字样式
|
|
1840
|
-
text: new ol.style.Text(
|
|
1841
|
-
textAlign: 'center',
|
|
1842
|
-
//对齐方式
|
|
1843
|
-
textBaseline: 'middle',
|
|
1844
|
-
//文本基线
|
|
1845
|
-
font: 'normal 12px 微软雅黑',
|
|
1846
|
-
//字体样式
|
|
1847
|
-
text: cg.labelContent,
|
|
1848
|
-
//文本内容
|
|
1849
|
-
offsetX: cg.labelPixelX,
|
|
1850
|
-
// x轴偏置
|
|
1851
|
-
offsetY: cg.labelPixelY,
|
|
1852
|
-
// Y轴偏置
|
|
1853
|
-
fill: new ol.style.Fill({
|
|
1854
|
-
//填充样式
|
|
1855
|
-
color: 'rgba(0,0,0,0.8)'
|
|
1856
|
-
}),
|
|
1857
|
-
backgroundFill: new ol.style.Fill({
|
|
1858
|
-
// 填充背景
|
|
1859
|
-
color: 'rgba(255, 255, 255, 0.3)'
|
|
1860
|
-
}),
|
|
1861
|
-
padding: [2, 5, 2, 5]
|
|
1862
|
-
})
|
|
1893
|
+
text: new ol.style.Text(textStyle)
|
|
1863
1894
|
});
|
|
1864
1895
|
}
|
|
1865
1896
|
|
|
@@ -1897,8 +1928,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1897
1928
|
geometryType: 'point',
|
|
1898
1929
|
geometry: {
|
|
1899
1930
|
type: 'point',
|
|
1900
|
-
x: item.longitude,
|
|
1901
|
-
y: item.latitude
|
|
1931
|
+
x: parseFloat(item.longitude),
|
|
1932
|
+
y: parseFloat(item.latitude)
|
|
1902
1933
|
},
|
|
1903
1934
|
source: source
|
|
1904
1935
|
});
|
|
@@ -1955,7 +1986,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1955
1986
|
var overlay = t.state.gis.getOverlayById(item.id);
|
|
1956
1987
|
var nodes = t.parseDom(item.markerContent)[0];
|
|
1957
1988
|
overlay.setElement(nodes);
|
|
1958
|
-
overlay.setPosition([item.longitude, item.latitude]);
|
|
1989
|
+
overlay.setPosition([parseFloat(item.longitude), parseFloat(item.latitude)]);
|
|
1959
1990
|
t.state.gis.changed();
|
|
1960
1991
|
} else {
|
|
1961
1992
|
canvasDataURL(item.url || require("../images/defaultMarker.png"), {
|
|
@@ -1977,7 +2008,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1977
2008
|
});
|
|
1978
2009
|
|
|
1979
2010
|
if (item.canShowLabel) {
|
|
1980
|
-
|
|
2011
|
+
var textStyle = _objectSpread({
|
|
1981
2012
|
textAlign: 'center',
|
|
1982
2013
|
//对齐方式
|
|
1983
2014
|
textBaseline: 'middle',
|
|
@@ -1992,14 +2023,28 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
1992
2023
|
// Y轴偏置
|
|
1993
2024
|
fill: new ol.style.Fill({
|
|
1994
2025
|
//填充样式
|
|
1995
|
-
color: '
|
|
2026
|
+
color: '#1890ff'
|
|
1996
2027
|
}),
|
|
1997
2028
|
backgroundFill: new ol.style.Fill({
|
|
1998
2029
|
// 填充背景
|
|
1999
|
-
color: 'rgba(255, 255, 255,
|
|
2030
|
+
color: 'rgba(255, 255, 255, 1)'
|
|
2000
2031
|
}),
|
|
2001
2032
|
padding: [2, 5, 2, 5]
|
|
2002
|
-
});
|
|
2033
|
+
}, cg.labelStyle || {});
|
|
2034
|
+
|
|
2035
|
+
if (cg.labelStyle && cg.labelStyle.fill) {
|
|
2036
|
+
textStyle['fill'] = new ol.style.Fill({
|
|
2037
|
+
color: cg.labelStyle.fill
|
|
2038
|
+
});
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
if (cg.labelStyle && cg.labelStyle.backgroundFill) {
|
|
2042
|
+
textStyle['backgroundFill'] = new ol.style.Fill({
|
|
2043
|
+
color: cg.labelStyle.backgroundFill
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
text = new ol.style.Text(textStyle);
|
|
2003
2048
|
}
|
|
2004
2049
|
|
|
2005
2050
|
if (text) {
|
|
@@ -2014,7 +2059,7 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2014
2059
|
}
|
|
2015
2060
|
}
|
|
2016
2061
|
|
|
2017
|
-
gc.setGeometry(new ol.geom.Point([item.longitude, item.latitude]));
|
|
2062
|
+
gc.setGeometry(new ol.geom.Point([parseFloat(item.longitude), parseFloat(item.latitude)]));
|
|
2018
2063
|
|
|
2019
2064
|
_this3.GM.setGraphicParam(item.id, {
|
|
2020
2065
|
attributes: _objectSpread(_objectSpread({}, item), {}, {
|
|
@@ -2023,8 +2068,8 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2023
2068
|
geometryType: 'point',
|
|
2024
2069
|
geometry: {
|
|
2025
2070
|
type: 'point',
|
|
2026
|
-
x: item.longitude,
|
|
2027
|
-
y: item.latitude
|
|
2071
|
+
x: parseFloat(item.longitude),
|
|
2072
|
+
y: parseFloat(item.latitude)
|
|
2028
2073
|
},
|
|
2029
2074
|
source: gp.source
|
|
2030
2075
|
});
|
|
@@ -2720,33 +2765,52 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
2720
2765
|
|
|
2721
2766
|
}, {
|
|
2722
2767
|
key: "showControl",
|
|
2723
|
-
value: function showControl() {
|
|
2724
|
-
var t = this
|
|
2725
|
-
type = '',
|
|
2726
|
-
location = {
|
|
2727
|
-
top: 20,
|
|
2728
|
-
left: 20
|
|
2729
|
-
},
|
|
2730
|
-
ls = {
|
|
2731
|
-
top: 20,
|
|
2732
|
-
left: 60
|
|
2733
|
-
};
|
|
2768
|
+
value: function showControl(props) {
|
|
2769
|
+
var t = this;
|
|
2734
2770
|
var gis = t.state.gis;
|
|
2771
|
+
var config = props.showControl;
|
|
2735
2772
|
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
h = _gis$getSize4[1];
|
|
2740
|
-
|
|
2741
|
-
var scaleControl = new ol.control.ScaleLine({
|
|
2742
|
-
units: 'metric' //设置度量单位
|
|
2773
|
+
if (t.scaleControl) {
|
|
2774
|
+
gis.removeControl(t.scaleControl);
|
|
2775
|
+
}
|
|
2743
2776
|
|
|
2777
|
+
t.scaleControl = new ol.control.ScaleLine({
|
|
2778
|
+
units: 'metric',
|
|
2779
|
+
//设置度量单位
|
|
2780
|
+
className: "ol-scale-line-".concat(config.location)
|
|
2744
2781
|
});
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2782
|
+
gis.addControl(t.scaleControl);
|
|
2783
|
+
setTimeout(function () {
|
|
2784
|
+
if (config.location == 'tl') {
|
|
2785
|
+
$("div.ol-scale-line-".concat(config.location)).css({
|
|
2786
|
+
position: 'absolute',
|
|
2787
|
+
left: config.offset[0] + 65,
|
|
2788
|
+
top: config.offset[1],
|
|
2789
|
+
textAlign: 'center'
|
|
2790
|
+
});
|
|
2791
|
+
} else if (config.location == 'bl') {
|
|
2792
|
+
$("div.ol-scale-line-".concat(config.location)).css({
|
|
2793
|
+
position: 'absolute',
|
|
2794
|
+
left: config.offset[0] + 65,
|
|
2795
|
+
bottom: config.offset[1],
|
|
2796
|
+
textAlign: 'center'
|
|
2797
|
+
});
|
|
2798
|
+
} else if (config.location == 'tr') {
|
|
2799
|
+
$("div.ol-scale-line-".concat(config.location)).css({
|
|
2800
|
+
position: 'absolute',
|
|
2801
|
+
right: config.offset[0] + 65,
|
|
2802
|
+
top: config.offset[1],
|
|
2803
|
+
textAlign: 'center'
|
|
2804
|
+
});
|
|
2805
|
+
} else if (config.location == 'br') {
|
|
2806
|
+
$("div.ol-scale-line-".concat(config.location)).css({
|
|
2807
|
+
position: 'absolute',
|
|
2808
|
+
right: config.offset[0] + 65,
|
|
2809
|
+
bottom: config.offset[1],
|
|
2810
|
+
textAlign: 'center'
|
|
2811
|
+
});
|
|
2812
|
+
}
|
|
2813
|
+
}, 20);
|
|
2750
2814
|
} //设置区域限制
|
|
2751
2815
|
|
|
2752
2816
|
}, {
|
|
@@ -3017,7 +3081,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3017
3081
|
}, {
|
|
3018
3082
|
key: "calculatePointsDistance",
|
|
3019
3083
|
value: function calculatePointsDistance(fp, ep) {
|
|
3020
|
-
|
|
3084
|
+
console.log(fp, ep);
|
|
3085
|
+
var distance = ol.sphere.getDistance(fp, ep);
|
|
3086
|
+
console.log(distance);
|
|
3087
|
+
return Math.round(distance);
|
|
3021
3088
|
} //计算多个点的距离(常用于线计算)
|
|
3022
3089
|
|
|
3023
3090
|
}, {
|
|
@@ -3032,10 +3099,13 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3032
3099
|
|
|
3033
3100
|
for (var i = 0; i < ps.length; i++) {
|
|
3034
3101
|
if (i < ps.length - 1) {
|
|
3035
|
-
|
|
3102
|
+
var distance = t.calculatePointsDistance(ps[i], ps[i + 1]);
|
|
3103
|
+
console.log(distance);
|
|
3104
|
+
totalDistance += distance;
|
|
3036
3105
|
}
|
|
3037
3106
|
}
|
|
3038
3107
|
|
|
3108
|
+
console.log(totalDistance);
|
|
3039
3109
|
return Math.round(totalDistance * 100) / 100;
|
|
3040
3110
|
} //处理线和面的 经纬度数据
|
|
3041
3111
|
|
|
@@ -3480,10 +3550,10 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3480
3550
|
isClearAll = nextProps.isClearAll; // 等待地图加载
|
|
3481
3551
|
|
|
3482
3552
|
if (!t.state.mapCreated) return;
|
|
3483
|
-
/*点数据处理
|
|
3484
|
-
pointData[2]相同的点,执行刷新
|
|
3485
|
-
pointData[1]的数据在idsForGraphicId中不存在的,执行新增
|
|
3486
|
-
pointData[0]数据中多余的id,执行删除
|
|
3553
|
+
/*点数据处理
|
|
3554
|
+
pointData[2]相同的点,执行刷新
|
|
3555
|
+
pointData[1]的数据在idsForGraphicId中不存在的,执行新增
|
|
3556
|
+
pointData[0]数据中多余的id,执行删除
|
|
3487
3557
|
*/
|
|
3488
3558
|
|
|
3489
3559
|
if (mapPoints instanceof Array && t.props.mapPoints instanceof Array && !t.deepEqual(mapPoints, t.props.mapPoints)) {
|
|
@@ -3532,9 +3602,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3532
3602
|
|
|
3533
3603
|
t.updatePoint([].concat(_toConsumableArray(upds), _toConsumableArray(otherupds)));
|
|
3534
3604
|
}
|
|
3535
|
-
/*
|
|
3536
|
-
线数据处理
|
|
3537
|
-
先全删除,再新增
|
|
3605
|
+
/*
|
|
3606
|
+
线数据处理
|
|
3607
|
+
先全删除,再新增
|
|
3538
3608
|
*/
|
|
3539
3609
|
|
|
3540
3610
|
|
|
@@ -3584,9 +3654,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3584
3654
|
|
|
3585
3655
|
t.updateLine([].concat(_toConsumableArray(_upds), _toConsumableArray(_otherupds)));
|
|
3586
3656
|
}
|
|
3587
|
-
/*
|
|
3588
|
-
面数据处理
|
|
3589
|
-
先全删除,再新增
|
|
3657
|
+
/*
|
|
3658
|
+
面数据处理
|
|
3659
|
+
先全删除,再新增
|
|
3590
3660
|
*/
|
|
3591
3661
|
|
|
3592
3662
|
|
|
@@ -3636,9 +3706,9 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3636
3706
|
|
|
3637
3707
|
t.updatePolygon([].concat(_toConsumableArray(_upds2), _toConsumableArray(_otherupds2)));
|
|
3638
3708
|
}
|
|
3639
|
-
/*
|
|
3640
|
-
圆数据处理
|
|
3641
|
-
先全删除,再新增
|
|
3709
|
+
/*
|
|
3710
|
+
圆数据处理
|
|
3711
|
+
先全删除,再新增
|
|
3642
3712
|
*/
|
|
3643
3713
|
|
|
3644
3714
|
|
|
@@ -3769,6 +3839,16 @@ var OlMap = /*#__PURE__*/function (_React$Component) {
|
|
|
3769
3839
|
|
|
3770
3840
|
if (typeof isClearAreaRestriction == 'boolean' && isClearAreaRestriction || isClearAreaRestriction && isClearAreaRestriction !== t.props.isClearAreaRestriction) {
|
|
3771
3841
|
t.clearAreaRestriction();
|
|
3842
|
+
} // 设置地图层级
|
|
3843
|
+
|
|
3844
|
+
|
|
3845
|
+
if (typeof setZoomLevel == 'boolean' && setZoomLevel || setZoomLevel && setZoomLevel !== t.props.setZoomLevel) {
|
|
3846
|
+
t.setZoomLevel(mapZoomLevel);
|
|
3847
|
+
} // 比例尺控件位置改变
|
|
3848
|
+
|
|
3849
|
+
|
|
3850
|
+
if (nextProps.showControl && JSON.stringify(nextProps.showControl) != JSON.stringify(t.props.showControl)) {
|
|
3851
|
+
t.showControl(nextProps);
|
|
3772
3852
|
}
|
|
3773
3853
|
} // 地图事件
|
|
3774
3854
|
//地图点击事件
|