vue2-openlayers 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +24 -0
- package/babel.config.js +5 -0
- package/dist/css/index.34f0f0b9.css +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/img/bottom_box.625e42a5.png +0 -0
- package/dist/img/car1.dd9a098b.png +0 -0
- package/dist/img/complete.2d0fa612.png +0 -0
- package/dist/img/diago_content.0d88c929.png +0 -0
- package/dist/img/diago_text_box.2e4da66b.png +0 -0
- package/dist/img/diago_title.2bd95b7a.png +0 -0
- package/dist/img/exception.a1eeefc3.png +0 -0
- package/dist/img/info1.829a6d7e.png +0 -0
- package/dist/img/info2.09e6e79e.png +0 -0
- package/dist/img/info3.3f96f756.png +0 -0
- package/dist/img/info4.6adcb927.png +0 -0
- package/dist/img/info5.ff3fdd2f.png +0 -0
- package/dist/img/info6.6e159d95.png +0 -0
- package/dist/img/left_box.40419b36.png +0 -0
- package/dist/img/money1.0743e701.png +0 -0
- package/dist/img/money2.58610d4d.png +0 -0
- package/dist/img/operating_fee.e6523ccc.png +0 -0
- package/dist/img/processing.28e46e7f.png +0 -0
- package/dist/img/public_content_box.39782fb5.png +0 -0
- package/dist/img/public_title_box1.6002afd4.png +0 -0
- package/dist/img/right_box.08458fe5.png +0 -0
- package/dist/img/success1.0cbc58af.png +0 -0
- package/dist/img/success2.af1a7499.png +0 -0
- package/dist/img/success3.d74caac5.png +0 -0
- package/dist/img/success4.37cc2343.png +0 -0
- package/dist/img/top_box.806bc756.png +0 -0
- package/dist/img/warehouse_map_popup.fa26d6cd.png +0 -0
- package/dist/img/work_error.3c528fdd.png +0 -0
- package/dist/img/work_su.0cbc58af.png +0 -0
- package/dist/img/work_wait.a2a706c9.png +0 -0
- package/dist/index.html +13 -0
- package/dist/js/chunk-vendors.901bdf0b.js +8 -0
- package/dist/js/chunk-vendors.901bdf0b.js.map +1 -0
- package/dist/js/index.29606843.js +2 -0
- package/dist/js/index.29606843.js.map +1 -0
- package/docs/.vuepress/config.js +25 -0
- package/docs/.vuepress/dist/404.html +20 -0
- package/docs/.vuepress/dist/assets/css/0.styles.7cfabf05.css +1 -0
- package/docs/.vuepress/dist/assets/img/7F8296FF-4A75-4013-BBFC-D482BF5303FF.597ff8a1.png +0 -0
- package/docs/.vuepress/dist/assets/img/gateway.98d6c8ec.jpg +0 -0
- package/docs/.vuepress/dist/assets/img/mysql_images.07b3a3e5.jpg +0 -0
- package/docs/.vuepress/dist/assets/img/nacos.741b050d.jpg +0 -0
- package/docs/.vuepress/dist/assets/img/rabbitmq.50b12be7.jpg +0 -0
- package/docs/.vuepress/dist/assets/img/redis_images.f0979945.jpg +0 -0
- package/docs/.vuepress/dist/assets/img/search.83621669.svg +1 -0
- package/docs/.vuepress/dist/assets/img/server-structure.6e0aa81e.png +0 -0
- package/docs/.vuepress/dist/assets/js/10.285f55d1.js +1 -0
- package/docs/.vuepress/dist/assets/js/11.decff412.js +1 -0
- package/docs/.vuepress/dist/assets/js/12.b9ed6e21.js +1 -0
- package/docs/.vuepress/dist/assets/js/13.d9c8c7a9.js +1 -0
- package/docs/.vuepress/dist/assets/js/14.6495a0e6.js +1 -0
- package/docs/.vuepress/dist/assets/js/15.70d64d1a.js +1 -0
- package/docs/.vuepress/dist/assets/js/16.a93c018c.js +1 -0
- package/docs/.vuepress/dist/assets/js/17.ed91eb16.js +1 -0
- package/docs/.vuepress/dist/assets/js/18.d07cd593.js +1 -0
- package/docs/.vuepress/dist/assets/js/19.4b8a0f22.js +1 -0
- package/docs/.vuepress/dist/assets/js/2.2668fa1b.js +1 -0
- package/docs/.vuepress/dist/assets/js/20.52de9326.js +1 -0
- package/docs/.vuepress/dist/assets/js/21.2293a5ca.js +1 -0
- package/docs/.vuepress/dist/assets/js/3.fd22fded.js +1 -0
- package/docs/.vuepress/dist/assets/js/4.ad26b2fa.js +1 -0
- package/docs/.vuepress/dist/assets/js/5.a1c97bcb.js +1 -0
- package/docs/.vuepress/dist/assets/js/6.32f67120.js +1 -0
- package/docs/.vuepress/dist/assets/js/7.99161716.js +1 -0
- package/docs/.vuepress/dist/assets/js/8.a0d65864.js +1 -0
- package/docs/.vuepress/dist/assets/js/9.2d06e692.js +1 -0
- package/docs/.vuepress/dist/assets/js/app.0be82e56.js +15 -0
- package/docs/.vuepress/dist/config/config_list.html +58 -0
- package/docs/.vuepress/dist/config/index.html +69 -0
- package/docs/.vuepress/dist/guide/admin.html +26 -0
- package/docs/.vuepress/dist/guide/deepchange.html +213 -0
- package/docs/.vuepress/dist/guide/gateway.html +45 -0
- package/docs/.vuepress/dist/guide/hystrix.html +26 -0
- package/docs/.vuepress/dist/guide/index.html +66 -0
- package/docs/.vuepress/dist/guide/nacos.html +26 -0
- package/docs/.vuepress/dist/guide/opsdev.html +26 -0
- package/docs/.vuepress/dist/guide/rabbitmq.html +26 -0
- package/docs/.vuepress/dist/guide/skywarking.html +52 -0
- package/docs/.vuepress/dist/guide/summary.html +74 -0
- package/docs/.vuepress/dist/help/index.html +28 -0
- package/docs/.vuepress/dist/help/markdown.html +33 -0
- package/docs/.vuepress/dist/images/7F8296FF-4A75-4013-BBFC-D482BF5303FF.png +0 -0
- package/docs/.vuepress/dist/images/gateway.jpg +0 -0
- package/docs/.vuepress/dist/images/mysql_images.jpg +0 -0
- package/docs/.vuepress/dist/images/nacos.jpg +0 -0
- package/docs/.vuepress/dist/images/rabbitmq.jpg +0 -0
- package/docs/.vuepress/dist/images/redis_images.jpg +0 -0
- package/docs/.vuepress/dist/images/server-structure.png +0 -0
- package/docs/.vuepress/dist/index.html +26 -0
- package/docs/.vuepress/dist/logo.jpg +0 -0
- package/docs/.vuepress/nav.js +34 -0
- package/docs/.vuepress/public/images/7F8296FF-4A75-4013-BBFC-D482BF5303FF.png +0 -0
- package/docs/.vuepress/public/images/gateway.jpg +0 -0
- package/docs/.vuepress/public/images/mysql_images.jpg +0 -0
- package/docs/.vuepress/public/images/nacos.jpg +0 -0
- package/docs/.vuepress/public/images/rabbitmq.jpg +0 -0
- package/docs/.vuepress/public/images/redis_images.jpg +0 -0
- package/docs/.vuepress/public/images/server-structure.png +0 -0
- package/docs/.vuepress/public/logo.jpg +0 -0
- package/docs/.vuepress/sidebar.js +62 -0
- package/docs/README.md +15 -0
- package/docs/config/README.md +108 -0
- package/docs/config/config_list.md +42 -0
- package/docs/guide/README.md +79 -0
- package/docs/guide/admin.md +25 -0
- package/docs/guide/deepchange.md +393 -0
- package/docs/guide/gateway.md +40 -0
- package/docs/guide/hystrix.md +21 -0
- package/docs/guide/nacos.md +7 -0
- package/docs/guide/opsdev.md +12 -0
- package/docs/guide/rabbitmq.md +15 -0
- package/docs/guide/skywarking.md +77 -0
- package/docs/guide/summary.md +120 -0
- package/docs/help/README.md +29 -0
- package/docs/help/markdown.md +165 -0
- package/examples/App.vue +21 -0
- package/examples/assets/css/map-base.scss +333 -0
- package/examples/assets/fonts/pmzd.ttf +0 -0
- package/examples/assets/icons/index.js +9 -0
- package/examples/assets/icons/svg/404.svg +1 -0
- package/examples/assets/icons/svg/bug.svg +1 -0
- package/examples/assets/icons/svg/build.svg +1 -0
- package/examples/assets/icons/svg/button.svg +1 -0
- package/examples/assets/icons/svg/cascader.svg +1 -0
- package/examples/assets/icons/svg/chart.svg +1 -0
- package/examples/assets/icons/svg/checkbox.svg +1 -0
- package/examples/assets/icons/svg/clipboard.svg +1 -0
- package/examples/assets/icons/svg/code.svg +1 -0
- package/examples/assets/icons/svg/color.svg +1 -0
- package/examples/assets/icons/svg/component.svg +1 -0
- package/examples/assets/icons/svg/dashboard.svg +1 -0
- package/examples/assets/icons/svg/date-range.svg +1 -0
- package/examples/assets/icons/svg/date.svg +1 -0
- package/examples/assets/icons/svg/dict.svg +1 -0
- package/examples/assets/icons/svg/documentation.svg +1 -0
- package/examples/assets/icons/svg/download.svg +1 -0
- package/examples/assets/icons/svg/drag.svg +1 -0
- package/examples/assets/icons/svg/druid.svg +1 -0
- package/examples/assets/icons/svg/edit.svg +1 -0
- package/examples/assets/icons/svg/education.svg +1 -0
- package/examples/assets/icons/svg/email.svg +1 -0
- package/examples/assets/icons/svg/example.svg +1 -0
- package/examples/assets/icons/svg/excel.svg +1 -0
- package/examples/assets/icons/svg/exit-fullscreen.svg +1 -0
- package/examples/assets/icons/svg/eye-open.svg +1 -0
- package/examples/assets/icons/svg/eye.svg +1 -0
- package/examples/assets/icons/svg/form.svg +1 -0
- package/examples/assets/icons/svg/fullscreen.svg +1 -0
- package/examples/assets/icons/svg/github.svg +1 -0
- package/examples/assets/icons/svg/guide.svg +1 -0
- package/examples/assets/icons/svg/icon.svg +1 -0
- package/examples/assets/icons/svg/input.svg +1 -0
- package/examples/assets/icons/svg/international.svg +1 -0
- package/examples/assets/icons/svg/job.svg +1 -0
- package/examples/assets/icons/svg/language.svg +1 -0
- package/examples/assets/icons/svg/link.svg +1 -0
- package/examples/assets/icons/svg/list.svg +1 -0
- package/examples/assets/icons/svg/lock.svg +1 -0
- package/examples/assets/icons/svg/log.svg +1 -0
- package/examples/assets/icons/svg/logininfor.svg +1 -0
- package/examples/assets/icons/svg/message.svg +1 -0
- package/examples/assets/icons/svg/money.svg +1 -0
- package/examples/assets/icons/svg/monitor.svg +2 -0
- package/examples/assets/icons/svg/nested.svg +1 -0
- package/examples/assets/icons/svg/number.svg +1 -0
- package/examples/assets/icons/svg/online.svg +1 -0
- package/examples/assets/icons/svg/password.svg +1 -0
- package/examples/assets/icons/svg/pdf.svg +1 -0
- package/examples/assets/icons/svg/people.svg +1 -0
- package/examples/assets/icons/svg/peoples.svg +1 -0
- package/examples/assets/icons/svg/phone.svg +1 -0
- package/examples/assets/icons/svg/post.svg +1 -0
- package/examples/assets/icons/svg/qq.svg +1 -0
- package/examples/assets/icons/svg/question.svg +1 -0
- package/examples/assets/icons/svg/radio.svg +1 -0
- package/examples/assets/icons/svg/rate.svg +1 -0
- package/examples/assets/icons/svg/redis.svg +1 -0
- package/examples/assets/icons/svg/row.svg +1 -0
- package/examples/assets/icons/svg/search.svg +1 -0
- package/examples/assets/icons/svg/select.svg +1 -0
- package/examples/assets/icons/svg/server.svg +1 -0
- package/examples/assets/icons/svg/shopping.svg +1 -0
- package/examples/assets/icons/svg/size.svg +1 -0
- package/examples/assets/icons/svg/skill.svg +1 -0
- package/examples/assets/icons/svg/slider.svg +1 -0
- package/examples/assets/icons/svg/star.svg +1 -0
- package/examples/assets/icons/svg/swagger.svg +1 -0
- package/examples/assets/icons/svg/switch.svg +1 -0
- package/examples/assets/icons/svg/system.svg +2 -0
- package/examples/assets/icons/svg/tab.svg +1 -0
- package/examples/assets/icons/svg/table.svg +1 -0
- package/examples/assets/icons/svg/textarea.svg +1 -0
- package/examples/assets/icons/svg/theme.svg +1 -0
- package/examples/assets/icons/svg/time-range.svg +1 -0
- package/examples/assets/icons/svg/time.svg +1 -0
- package/examples/assets/icons/svg/tool.svg +1 -0
- package/examples/assets/icons/svg/tree-table.svg +1 -0
- package/examples/assets/icons/svg/tree.svg +1 -0
- package/examples/assets/icons/svg/turn-right.svg +1 -0
- package/examples/assets/icons/svg/upload.svg +1 -0
- package/examples/assets/icons/svg/user.svg +1 -0
- package/examples/assets/icons/svg/validCode.svg +1 -0
- package/examples/assets/icons/svg/wechat.svg +1 -0
- package/examples/assets/icons/svg/zip.svg +1 -0
- package/examples/assets/icons/svgo.yml +22 -0
- package/examples/assets/images/close_diago.png +0 -0
- package/examples/assets/images/red_circle.png +0 -0
- package/examples/assets/images/w_mj_map.png +0 -0
- package/examples/assets/images/warehouse_map_popup.png +0 -0
- package/examples/assets/images/warehouse_map_success.png +0 -0
- package/examples/assets/images/warehouse_map_warning.png +0 -0
- package/examples/assets/js/gps.js +222 -0
- package/examples/assets/logo.png +0 -0
- package/examples/components/HelloWorld.vue +273 -0
- package/examples/components/MapPopup.vue +80 -0
- package/examples/data/510000.js +2056 -0
- package/examples/data/510000.json +2055 -0
- package/examples/data/testData.js +2088 -0
- package/examples/main.js +28 -0
- package/examples/utils/echarts/esresize.js +110 -0
- package/jsconfig.json +19 -0
- package/package.json +56 -0
- package/vue-opnelayers/demo.html +1 -0
- package/vue-opnelayers/vue-openlayers.common.js +58661 -0
- package/vue-opnelayers/vue-openlayers.common.js.map +1 -0
- package/vue-opnelayers/vue-openlayers.css +1 -0
- package/vue-opnelayers/vue-openlayers.umd.js +58672 -0
- package/vue-opnelayers/vue-openlayers.umd.js.map +1 -0
- package/vue-opnelayers/vue-openlayers.umd.min.js +2 -0
- package/vue-opnelayers/vue-openlayers.umd.min.js.map +1 -0
- package/vue.config.js +54 -0
@@ -0,0 +1,222 @@
|
|
1
|
+
/**
|
2
|
+
* WGS-84原始坐标系,一般用国际GPS纪录仪记录下来的经纬度,通过GPS定位拿到的原始经纬度
|
3
|
+
*
|
4
|
+
* GCJ-02坐标系,又名“火星坐标系”,是我国国测局独创的坐标体系,由WGS-84加密而成
|
5
|
+
*
|
6
|
+
* 百度坐标系:bd-09,百度坐标系是在GCJ-02坐标系的基础上再次加密偏移后形成的坐标系,只适用于百度地图
|
7
|
+
*/
|
8
|
+
|
9
|
+
const PI = 3.14159265358979324;
|
10
|
+
|
11
|
+
// const x_pi = 3.14159265358979324 * 3000.0 / 180.0;
|
12
|
+
|
13
|
+
function delta(lat, lon) {
|
14
|
+
// Krasovsky 1940
|
15
|
+
//
|
16
|
+
// a = 6378245.0, 1/f = 298.3
|
17
|
+
// b = a * (1 - f)
|
18
|
+
// ee = (a^2 - b^2) / a^2;
|
19
|
+
var a = 6378245.0; // a: 卫星椭球坐标投影到平面地图坐标系的投影因子。
|
20
|
+
var ee = 0.00669342162296594323; // ee: 椭球的偏心率。
|
21
|
+
var dLat = transformLat(lon - 105.0, lat - 35.0);
|
22
|
+
var dLon = transformLon(lon - 105.0, lat - 35.0);
|
23
|
+
var radLat = lat / 180.0 * PI;
|
24
|
+
var magic = Math.sin(radLat);
|
25
|
+
magic = 1 - ee * magic * magic;
|
26
|
+
var sqrtMagic = Math.sqrt(magic);
|
27
|
+
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * PI);
|
28
|
+
dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * PI);
|
29
|
+
return { 'lat': dLat + 0.000004, 'lon': dLon + 0.000004 };
|
30
|
+
}
|
31
|
+
|
32
|
+
function outOfChina(lat, lon) {
|
33
|
+
if (lon < 72.004 || lon > 137.8347)
|
34
|
+
return true;
|
35
|
+
if (lat < 0.8293 || lat > 55.8271)
|
36
|
+
return true;
|
37
|
+
return false;
|
38
|
+
}
|
39
|
+
|
40
|
+
function transformLat(x, y) {
|
41
|
+
var ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
|
42
|
+
ret += (20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0 / 3.0;
|
43
|
+
ret += (20.0 * Math.sin(y * PI) + 40.0 * Math.sin(y / 3.0 * PI)) * 2.0 / 3.0;
|
44
|
+
ret += (160.0 * Math.sin(y / 12.0 * PI) + 320 * Math.sin(y * PI / 30.0)) * 2.0 / 3.0;
|
45
|
+
return ret;
|
46
|
+
}
|
47
|
+
|
48
|
+
function transformLon(x, y) {
|
49
|
+
var ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
|
50
|
+
ret += (20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0 / 3.0;
|
51
|
+
ret += (20.0 * Math.sin(x * PI) + 40.0 * Math.sin(x / 3.0 * PI)) * 2.0 / 3.0;
|
52
|
+
ret += (150.0 * Math.sin(x / 12.0 * PI) + 300.0 * Math.sin(x / 30.0 * PI)) * 2.0 / 3.0;
|
53
|
+
return ret;
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* gps-->高德
|
58
|
+
* @param {*} wgsLat lat 纬度
|
59
|
+
* @param {*} wgsLon lng 经度
|
60
|
+
*/
|
61
|
+
export function gps2gd(wgsLat, wgsLon) {
|
62
|
+
if (typeof wgsLat === 'string') wgsLat = Number(wgsLat);
|
63
|
+
if (typeof wgsLon === 'string') wgsLon = Number(wgsLon);
|
64
|
+
if (outOfChina(wgsLat, wgsLon))
|
65
|
+
return { 'lat': wgsLat, 'lng': wgsLon };
|
66
|
+
|
67
|
+
var d = delta(wgsLat, wgsLon);
|
68
|
+
return { 'lat': wgsLat + d.lat, 'lng': wgsLon + d.lon };
|
69
|
+
}
|
70
|
+
|
71
|
+
/**
|
72
|
+
* 高德坐标系转gps
|
73
|
+
*/
|
74
|
+
export function gd2gps(gcjLat, gcjLon) {
|
75
|
+
if (typeof gcjLat === 'string') gcjLat = Number(gcjLat);
|
76
|
+
if (typeof gcjLon === 'string') gcjLon = Number(gcjLon);
|
77
|
+
if (outOfChina(gcjLat, gcjLon))
|
78
|
+
return { 'lat': gcjLat, 'lng': gcjLon };
|
79
|
+
var d = delta(gcjLat, gcjLon);
|
80
|
+
let lat = gcjLat - d.lat;
|
81
|
+
let lon = gcjLon - d.lon;
|
82
|
+
for (let i = 0; i < 1; i++) {
|
83
|
+
d = delta(lat, lon);
|
84
|
+
lat = gcjLat - d.lat;
|
85
|
+
lon = gcjLon - d.lon;
|
86
|
+
}
|
87
|
+
return { 'lat': lat, 'lng': lon };
|
88
|
+
|
89
|
+
}
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
/**
|
95
|
+
* 批量gps--->高德
|
96
|
+
* @param [{ lat :xxx,lng:xxx}] list
|
97
|
+
*/
|
98
|
+
export function batchGps2gd(list) {
|
99
|
+
let rlist = [];
|
100
|
+
for (let i = 0; i < list.length; i++) {
|
101
|
+
rlist.push(gps2gd(list[i].lat, list[i].lng))
|
102
|
+
}
|
103
|
+
return rlist;
|
104
|
+
}
|
105
|
+
// gps转高德
|
106
|
+
export function localConvertListAndSetname(list, lngName, latName) {
|
107
|
+
if (list instanceof Array) {
|
108
|
+
//原有点
|
109
|
+
let locations = list.map((n) => {
|
110
|
+
return {
|
111
|
+
lat: n[latName],
|
112
|
+
lng: n[lngName],
|
113
|
+
};
|
114
|
+
|
115
|
+
});
|
116
|
+
// console.info("批量坐标转换数量:" + locations.length);
|
117
|
+
let results = batchGps2gd(locations);
|
118
|
+
for (let i = 0; i < results.length; i++) {
|
119
|
+
list[i].P = results[i].lat;
|
120
|
+
list[i].R = results[i].lng;
|
121
|
+
}
|
122
|
+
} else if (list instanceof Object && list != null && list != undefined) {
|
123
|
+
let res = gps2gd(list[latName], list[lngName]);
|
124
|
+
list.P = res.lat || 30.573095;
|
125
|
+
list.R = res.lng || 104.066143;
|
126
|
+
}
|
127
|
+
}
|
128
|
+
////无返回 直接处理字段 阻塞型
|
129
|
+
export function localConvert(list, lngName, latName, usePR) {
|
130
|
+
if (list instanceof Array) {
|
131
|
+
//原有点
|
132
|
+
let locations = list.map(n => { return { lat: n[latName], lng: n[lngName] } });
|
133
|
+
console.info('批量坐标转换数量:' + locations.length);
|
134
|
+
let results = batchGps2gd(locations);
|
135
|
+
if (usePR) {
|
136
|
+
for (let i = 0; i < results.length; i++) {
|
137
|
+
list[i].P = results[i].lat;
|
138
|
+
list[i].R = results[i].lng;
|
139
|
+
}
|
140
|
+
} else {
|
141
|
+
for (let i = 0; i < results.length; i++) {
|
142
|
+
list[i][latName] = results[i].lat;
|
143
|
+
list[i][lngName] = results[i].lng;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
} else if ((list instanceof Object) && list != null && list != undefined) {
|
148
|
+
console.info('转换坐标1个');
|
149
|
+
let res = gps2gd(list[latName], list[lngName]);
|
150
|
+
if (usePR) {
|
151
|
+
list.P = res.lat;
|
152
|
+
list.R = res.lng;
|
153
|
+
} else {
|
154
|
+
list[latName] = res.lat;
|
155
|
+
list[lngName] = res.lng;
|
156
|
+
}
|
157
|
+
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
/// gps->Gd 转换 结构如同 [[104.31892600,30.71867200], [104.31836300,30.71835900], [104.31769800,30.71797600]]的数据机构点
|
162
|
+
export function localConvertArray(arrayList) {
|
163
|
+
arrayList.forEach(arr => {
|
164
|
+
let p = gps2gd(arr[1], arr[0])
|
165
|
+
arr[0] = p.lng;
|
166
|
+
arr[1] = p.lat;
|
167
|
+
});
|
168
|
+
return arrayList;
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
export function gpsToGd(wgLon, wgLat) {
|
173
|
+
var pi = 3.14159265358979324;
|
174
|
+
var a = 6378245.0;
|
175
|
+
var ee = 0.00669342162296594323;
|
176
|
+
var cj, cw;
|
177
|
+
|
178
|
+
if (outOfChina(wgLat, wgLon)) {
|
179
|
+
return false;
|
180
|
+
} else {
|
181
|
+
wgLat = parseFloat(wgLat);
|
182
|
+
wgLon = parseFloat(wgLon);
|
183
|
+
var dLat = transformLat(wgLon - 105.0, wgLat - 35.0);
|
184
|
+
var dLon = transformLon(wgLon - 105.0, wgLat - 35.0);
|
185
|
+
var radLat = wgLat / 180.0 * pi;
|
186
|
+
var magic = Math.sin(radLat);
|
187
|
+
magic = 1 - ee * magic * magic;
|
188
|
+
var sqrtMagic = Math.sqrt(magic);
|
189
|
+
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
|
190
|
+
dLon = (dLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
|
191
|
+
|
192
|
+
cw = wgLat + dLat;
|
193
|
+
cj = wgLon + dLon;
|
194
|
+
return [cj, cw]
|
195
|
+
}
|
196
|
+
|
197
|
+
// function outOfChina(lat, lon) {
|
198
|
+
// if (lon < 72.004 || lon > 137.8347)
|
199
|
+
// return true;
|
200
|
+
// if (lat < 0.8293 || lat > 55.8271)
|
201
|
+
// return true;
|
202
|
+
// return false;
|
203
|
+
//上面注释为判断经纬度是否在中国
|
204
|
+
// return false;
|
205
|
+
// };
|
206
|
+
|
207
|
+
function transformLat(x, y) {
|
208
|
+
var ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
|
209
|
+
ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
|
210
|
+
ret += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0;
|
211
|
+
ret += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0;
|
212
|
+
return ret;
|
213
|
+
}
|
214
|
+
|
215
|
+
function transformLon(x, y) {
|
216
|
+
var ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
|
217
|
+
ret += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
|
218
|
+
ret += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0;
|
219
|
+
ret += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0 * pi)) * 2.0 / 3.0;
|
220
|
+
return ret;
|
221
|
+
}
|
222
|
+
}
|
Binary file
|
@@ -0,0 +1,273 @@
|
|
1
|
+
<template>
|
2
|
+
<div>
|
3
|
+
<div class="map_index">
|
4
|
+
<!-- 定义地图容器与相关样式(宽高等) -->
|
5
|
+
<div id="app">
|
6
|
+
<yl-map @handleDownEvent="handleDownEvent" ref="map">
|
7
|
+
<template slot="yl-map-layers">
|
8
|
+
<yl-line :lineData="lineData" :lineFun="lineFun" v-if="tabIndex==1"></yl-line>
|
9
|
+
<yl-point :pointData="pointData" :pointFun="pointFun" :pointAnimation="tabIndex==3" v-if="tabIndex==3 || tabIndex == 2" :zIndex="3"></yl-point>
|
10
|
+
<yl-fiy-line :pointData="pointData" :pointFun="flyPointFun" :lineData="lineDataFiy" :lineFun="flyLineFun" v-if="tabIndex == 4" :zIndex="4"></yl-fiy-line>
|
11
|
+
<yl-geo-json :geoJsonUrl="geoJsonUrl" v-if="tabIndex==5" :zIndex="2"></yl-geo-json>
|
12
|
+
</template>
|
13
|
+
<template slot="yl-map-overlay">
|
14
|
+
<MapPopup :visible.sync="showDialog">
|
15
|
+
<template slot="map-popup-title">
|
16
|
+
{{ popupContent?.nodeName }}
|
17
|
+
</template>
|
18
|
+
<template slot="map-popup-main">
|
19
|
+
{{ popupContent }}
|
20
|
+
</template>
|
21
|
+
</MapPopup>
|
22
|
+
</template>
|
23
|
+
</yl-map>
|
24
|
+
</div>
|
25
|
+
<div class="btn-list">
|
26
|
+
<div class="btn" @click="changeTab(item, index + 1)" v-for="(item, index) in tableList" :key="index" :class="tabIndex==(index+1)?'active':''">{{ item.name }}</div>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</template>
|
31
|
+
|
32
|
+
<script>
|
33
|
+
import { sichuan } from "../data/510000";
|
34
|
+
import { returnFlyingSpotData } from "../data/testData";
|
35
|
+
let pointDataList = [];
|
36
|
+
returnFlyingSpotData().data.locationInfo.forEach(el=>{
|
37
|
+
pointDataList.push({
|
38
|
+
info: el,
|
39
|
+
lat: el.latitude,
|
40
|
+
lng: el.longitude
|
41
|
+
})
|
42
|
+
})
|
43
|
+
|
44
|
+
import MapPopup from "./MapPopup";
|
45
|
+
export default {
|
46
|
+
name: 'App',
|
47
|
+
components: {
|
48
|
+
MapPopup
|
49
|
+
},
|
50
|
+
data() {
|
51
|
+
return {
|
52
|
+
tabIndex: 0,
|
53
|
+
tableList: [
|
54
|
+
{name: '线型示例'},
|
55
|
+
{name: '点位示例'},
|
56
|
+
{name: '点位扩散示例'},
|
57
|
+
{name: '飞线示例'},
|
58
|
+
{name: 'geoJson数据示例'},
|
59
|
+
],
|
60
|
+
geoJsonUrl: 'http://8.137.153.28:33660/510000.json',
|
61
|
+
showDialog: false,
|
62
|
+
popupContent: null,
|
63
|
+
geoJsonState: true,
|
64
|
+
lineState: true,
|
65
|
+
pointState: false,
|
66
|
+
fiyState: false,
|
67
|
+
lineDataFiy: returnFlyingSpotData().data.relationship,
|
68
|
+
pointFun:(element)=>{
|
69
|
+
return {
|
70
|
+
style: {
|
71
|
+
src: element.subType==2?require("@/assets/images/warehouse_map_success.png"):require("@/assets/images/warehouse_map_warning.png"),
|
72
|
+
scale: 1,
|
73
|
+
},
|
74
|
+
type: 'Icon'
|
75
|
+
}
|
76
|
+
},//点样式
|
77
|
+
lineFun:()=>{
|
78
|
+
return {
|
79
|
+
color:null,
|
80
|
+
width:null
|
81
|
+
}
|
82
|
+
},//线样式
|
83
|
+
flyPointFun:(element)=>{
|
84
|
+
return {
|
85
|
+
style: {
|
86
|
+
src: element.subType==2?require("@/assets/images/w_mj_map.png"):require("@/assets/images/red_circle.png"),
|
87
|
+
scale: 1,
|
88
|
+
},
|
89
|
+
type: 'Icon'
|
90
|
+
}
|
91
|
+
},//飞点样式
|
92
|
+
flyLineFun:(element)=>{
|
93
|
+
if(element){
|
94
|
+
if(element.status==1){
|
95
|
+
return {
|
96
|
+
color: [76, 255, 255, 0.6],
|
97
|
+
width: 1.5
|
98
|
+
}
|
99
|
+
}else{
|
100
|
+
return {
|
101
|
+
color: [179, 178, 116, 1],
|
102
|
+
width: 1.5
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
return {
|
107
|
+
color: [76, 255, 255, 0.6],
|
108
|
+
width: 1.5
|
109
|
+
}
|
110
|
+
},//飞线样式
|
111
|
+
lineData:[
|
112
|
+
],//线性数据结构
|
113
|
+
pointData: pointDataList,//点数据结构
|
114
|
+
}
|
115
|
+
},
|
116
|
+
methods:{
|
117
|
+
//地图元素点击事件
|
118
|
+
handleDownEvent(coordinate, value){
|
119
|
+
this.popupContent = value;
|
120
|
+
this.$refs.map.showPopup({
|
121
|
+
position: coordinate,
|
122
|
+
offset: [5, -5],
|
123
|
+
positioning: "bottom-center",
|
124
|
+
duration: 250
|
125
|
+
});
|
126
|
+
this.showDialog = true;
|
127
|
+
},
|
128
|
+
|
129
|
+
//注意:closeOverlay()、refMapData()、fitView()使用: 给地图添加ref
|
130
|
+
|
131
|
+
//关闭弹框
|
132
|
+
closeOverlay(){
|
133
|
+
this.$refs.map.close();
|
134
|
+
this.showDialog = false;
|
135
|
+
},
|
136
|
+
//刷新地图叠加层数据
|
137
|
+
refMapData(){
|
138
|
+
this.$bus.$emit(this.$refs.map.mapId + "ready", {});
|
139
|
+
},
|
140
|
+
//移动焦点位置 传入值features:Array
|
141
|
+
// fitView(feature){
|
142
|
+
// this.$refs.map.fitViewfeatures([feature]);
|
143
|
+
// },
|
144
|
+
// 切换选项卡
|
145
|
+
changeTab(item, index) {
|
146
|
+
if (index == this.tabIndex) {
|
147
|
+
return;
|
148
|
+
}
|
149
|
+
this.tabIndex = index;
|
150
|
+
this.closeOverlay();
|
151
|
+
},
|
152
|
+
},
|
153
|
+
mounted(){
|
154
|
+
// 模拟改变线型数据值
|
155
|
+
this.lineData = [{
|
156
|
+
data: sichuan().features[0].geometry.coordinates[0],
|
157
|
+
info: sichuan().features[0].properties.name,
|
158
|
+
}]
|
159
|
+
}
|
160
|
+
}
|
161
|
+
</script>
|
162
|
+
|
163
|
+
<style lang="scss" scoped>
|
164
|
+
@import "@/assets/css/map-base.scss";
|
165
|
+
|
166
|
+
:deep() html, body, #app {
|
167
|
+
height: 100%;
|
168
|
+
margin: 0px;
|
169
|
+
}
|
170
|
+
|
171
|
+
::v-deep ::-webkit-scrollbar {
|
172
|
+
width: 0.5vh !important;
|
173
|
+
height: 0.5vh !important;
|
174
|
+
}
|
175
|
+
|
176
|
+
::v-deep ::-webkit-scrollbar-thumb {
|
177
|
+
border-radius: 2px !important;
|
178
|
+
background: rgba(31, 92, 153, 1) !important;
|
179
|
+
}
|
180
|
+
|
181
|
+
.map_index {
|
182
|
+
position: relative;
|
183
|
+
height: 100vh;
|
184
|
+
width: 100vw;
|
185
|
+
overflow: hidden;
|
186
|
+
|
187
|
+
i {
|
188
|
+
font-size: 1.2vh;
|
189
|
+
}
|
190
|
+
|
191
|
+
img {
|
192
|
+
width: 1.5vh;
|
193
|
+
height: 1.5vh;
|
194
|
+
}
|
195
|
+
|
196
|
+
#map {
|
197
|
+
position: absolute;
|
198
|
+
width: 100%;
|
199
|
+
top: 0;
|
200
|
+
left: 0;
|
201
|
+
height: 100%;
|
202
|
+
}
|
203
|
+
|
204
|
+
}
|
205
|
+
|
206
|
+
|
207
|
+
.map-popup-style{
|
208
|
+
background: rgba(0, 0, 0, 0.5);
|
209
|
+
color: #fff;
|
210
|
+
padding: 5px;
|
211
|
+
border-radius: 5px;
|
212
|
+
font-size: 12px;
|
213
|
+
max-width: 200px;
|
214
|
+
word-break: break-all;
|
215
|
+
white-space: normal;
|
216
|
+
}
|
217
|
+
|
218
|
+
.btn-list{
|
219
|
+
position: absolute;
|
220
|
+
top: 10px;
|
221
|
+
right: 10px;
|
222
|
+
z-index: 999;
|
223
|
+
padding: 10px;
|
224
|
+
border-radius: 5px;
|
225
|
+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
226
|
+
.btn{
|
227
|
+
display: flex;
|
228
|
+
flex: 1;
|
229
|
+
justify-content: center;
|
230
|
+
flex-direction: column;
|
231
|
+
align-items: center;
|
232
|
+
margin-bottom: 0.8vh;
|
233
|
+
background: #093159;
|
234
|
+
color: rgba(184, 203, 229, 1);
|
235
|
+
font-size: 1.25vh;
|
236
|
+
padding: 1vh 0.8vh;
|
237
|
+
border-radius: 2px;
|
238
|
+
cursor: pointer;
|
239
|
+
&:hover{
|
240
|
+
color: #409eff;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
.active{
|
244
|
+
background: rgba(25, 140, 255, 1);
|
245
|
+
}
|
246
|
+
}
|
247
|
+
:deep() .ol-zoom-in{
|
248
|
+
background: #093159;
|
249
|
+
color: #fff !important;
|
250
|
+
border-radius: 5px;
|
251
|
+
padding: 5px;
|
252
|
+
font-size: 12px;
|
253
|
+
margin-bottom: 10px;
|
254
|
+
cursor: pointer;
|
255
|
+
&:hover{
|
256
|
+
color: #fff;
|
257
|
+
}
|
258
|
+
}
|
259
|
+
:deep() .ol-zoom-out{
|
260
|
+
background: #093159;
|
261
|
+
color: #fff !important;
|
262
|
+
border-radius: 5px;
|
263
|
+
padding: 5px;
|
264
|
+
font-size: 12px;
|
265
|
+
cursor: pointer;
|
266
|
+
&:hover{
|
267
|
+
color: #fff;
|
268
|
+
}
|
269
|
+
}
|
270
|
+
:deep() .ol-control{
|
271
|
+
background: transparent;
|
272
|
+
}
|
273
|
+
</style>
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<template>
|
2
|
+
<div id="warehouse-popup" class="map-popup" v-if="visible">
|
3
|
+
<img
|
4
|
+
class="close_diago"
|
5
|
+
@click="close"
|
6
|
+
src="../assets/images/close_diago.png"/>
|
7
|
+
<div class="map-popup-title">
|
8
|
+
<slot name="map-popup-title"></slot>
|
9
|
+
</div>
|
10
|
+
<div class="map-popup-main">
|
11
|
+
<slot name="map-popup-main"></slot>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
</template>
|
15
|
+
|
16
|
+
<script>
|
17
|
+
export default {
|
18
|
+
name: 'MapPopup',
|
19
|
+
props: {
|
20
|
+
visible: {
|
21
|
+
type: Boolean,
|
22
|
+
default: false
|
23
|
+
}
|
24
|
+
},
|
25
|
+
data() {
|
26
|
+
return {
|
27
|
+
popupShow: false,
|
28
|
+
};
|
29
|
+
},
|
30
|
+
methods: {
|
31
|
+
close() {
|
32
|
+
this.$emit('update:visible', false);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
};
|
36
|
+
</script>
|
37
|
+
|
38
|
+
<style lang="scss" scoped>
|
39
|
+
.map-popup {
|
40
|
+
position: relative;
|
41
|
+
width: 28.43vw;
|
42
|
+
height: 17.34vw;
|
43
|
+
background-image: url("../assets/images/warehouse_map_popup.png");
|
44
|
+
background-repeat: no-repeat;
|
45
|
+
background-size: 100% 100%;
|
46
|
+
display: flex;
|
47
|
+
flex-direction: column;
|
48
|
+
padding: 0 1.56vw 1.56vw 1.56vw;
|
49
|
+
// position: absolute;
|
50
|
+
// left: 50vw;
|
51
|
+
// top: 50vh;
|
52
|
+
.map-popup-title{
|
53
|
+
font-size: 18px;
|
54
|
+
font-family: Microsoft YaHei, Microsoft YaHei;
|
55
|
+
font-weight: 700;
|
56
|
+
color: #ffffff;
|
57
|
+
height: 2.86vw;
|
58
|
+
display: flex;
|
59
|
+
align-items: center;
|
60
|
+
}
|
61
|
+
.map-popup-main {
|
62
|
+
display: flex;
|
63
|
+
align-items: center;
|
64
|
+
flex: 1;
|
65
|
+
font-size: 14px;
|
66
|
+
margin-top: 0.625vw;
|
67
|
+
padding: 1vw 1vw 0 1vw;
|
68
|
+
flex-direction: column;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
.close_diago {
|
72
|
+
height: 28px;
|
73
|
+
width: 28px;
|
74
|
+
margin-right: 20px;
|
75
|
+
cursor: pointer;
|
76
|
+
position: absolute;
|
77
|
+
top: 20px;
|
78
|
+
right: 5px;
|
79
|
+
}
|
80
|
+
</style>
|