|
@@ -1028,6 +1028,7 @@
|
|
|
mapDataListHC:[],
|
|
|
lampEditFunIsfirst:true,
|
|
|
markerListHC:[],
|
|
|
+ markerListHCEn:[],
|
|
|
roadId:0,
|
|
|
projectId:0,
|
|
|
companyId:'',
|
|
@@ -2928,7 +2929,6 @@
|
|
|
}
|
|
|
this.getProjectCompany(this.lampId,data => {
|
|
|
let bd_decrypt = this.bd_decrypt(data.data.longitude,data.data.latitude)
|
|
|
- console.log(data.data.longitude,data.data.latitude,'--',bd_decrypt.lng,bd_decrypt.lat,'==========')
|
|
|
data.data.longitude = bd_decrypt.lng.toFixed(8);
|
|
|
data.data.latitude = bd_decrypt.lat.toFixed(8);
|
|
|
let JDstr = '';
|
|
@@ -2977,7 +2977,7 @@
|
|
|
if(this_.mapTCtype == 'TileLayer'){
|
|
|
div = '<div class="lm_img_mover" style="text-align:center;border:11px solid '+borderColor+'; border-radius:50%;cursor:pointer;"><div style="text-align:center;background:'+bgColor+';background-clip: padding-box;border:2px solid #fff; height: 16px; width: 16px; border-radius:50%;"></div></div>';
|
|
|
}else{
|
|
|
- div = `<div class="lm_img_mover" style="width:42px;height:42px;background-image:url('./src/img/GIS/lamp_type/lamp_night_${this_.lampType}_${data.data.direction}.png');background-size:100% 100%;background-position: 0 0;"></div>`;
|
|
|
+ div = `<div class="lm_img_mover" style="width:42px;height:42px;background-image:url(${require('../img/GIS/lamp_type/lamp_night_'+this_.lampType+'_'+data.data.direction+'.png')});background-size:100% 100%;background-position: 0 0;"></div>`;
|
|
|
}
|
|
|
this_.positionPicker = new RichMarker({
|
|
|
position:new google.maps.LatLng(Number(this.lampLatitude),Number(this.lampLongitude)),
|
|
@@ -3079,11 +3079,16 @@
|
|
|
},1)
|
|
|
}
|
|
|
if(this.browserLanguage == 'bd'){
|
|
|
+ let wgs84togcj02 = this_.wgs84togcj02(data.data.longitude,data.data.latitude)
|
|
|
+ data.data.longitude = wgs84togcj02.lng.toFixed(8);
|
|
|
+ data.data.latitude = wgs84togcj02.lat.toFixed(8);
|
|
|
+ this.lampLongitude = data.data.longitude;
|
|
|
+ this.lampLatitude = data.data.latitude;
|
|
|
let url;
|
|
|
if(this_.mapTCtype == 'TileLayer'){
|
|
|
- url = './src/img/GIS/'+this_.lampType+'-icon.png';
|
|
|
+ url = require('../img/GIS/'+this_.lampType+'-icon.png');
|
|
|
}else{
|
|
|
- url = './src/img/GIS/lamp_type/lamp_night_'+this_.lampType+'_'+data.data.direction+'.png';
|
|
|
+ url = require('../img/GIS/lamp_type/lamp_night_'+this_.lampType+'_'+data.data.direction+'.png');
|
|
|
}
|
|
|
/*路灯方向*/
|
|
|
AMapUI.loadUI(['misc/PositionPicker'], function(PositionPicker) {
|
|
@@ -3102,9 +3107,9 @@
|
|
|
$('.lampLongitude'+lmId).text(positionResult.position.lng);
|
|
|
$('.lampLatitude'+lmId).html(positionResult.position.lat);
|
|
|
|
|
|
- let bd_encrypt = this_.bd_encrypt(positionResult.position.lng,positionResult.position.lat)
|
|
|
- positionResult.position.lng = bd_encrypt.bd_lng;
|
|
|
- positionResult.position.lat = bd_encrypt.bd_lat;
|
|
|
+ // let gcj02towgs84 = this_.gcj02towgs84(positionResult.position.lng,positionResult.position.lat)
|
|
|
+ // positionResult.position.lng = gcj02towgs84.bd_lng;
|
|
|
+ // positionResult.position.lat = gcj02towgs84.bd_lat;
|
|
|
|
|
|
this_.lampLongitude = positionResult.position.lng;
|
|
|
this_.lampLatitude = positionResult.position.lat;
|
|
@@ -3132,6 +3137,7 @@
|
|
|
// console.log(className)
|
|
|
if(className[0] == 'determine_l'){
|
|
|
|
|
|
+ let gcj02towgs84 = this_.gcj02towgs84(this_.lampLongitude,this_.lampLatitude)
|
|
|
baseApi.ajax_post(
|
|
|
allUrl.gisMap.changeLocation,
|
|
|
{
|
|
@@ -3140,8 +3146,8 @@
|
|
|
token:this_.token,
|
|
|
id:lmId,
|
|
|
type:type,
|
|
|
- longitude:this_.lampLongitude,
|
|
|
- latitude:this_.lampLatitude,
|
|
|
+ longitude:gcj02towgs84.bd_lng,
|
|
|
+ latitude:gcj02towgs84.bd_lat,
|
|
|
},
|
|
|
{},
|
|
|
data =>{
|
|
@@ -3164,9 +3170,9 @@
|
|
|
this_.positionPicker.stop();
|
|
|
for(let d of this_.mapDataListHC){
|
|
|
if(d.id == lmId){
|
|
|
- let bd_decrypt = this_.bd_decrypt(this_.lampLongitude,this_.lampLatitude)
|
|
|
- d.latitude = bd_decrypt.lat
|
|
|
- d.longitude = bd_decrypt.lng
|
|
|
+ let wgs84togcj02 = this_.wgs84togcj02(this_.lampLongitude,this_.lampLatitude)
|
|
|
+ d.latitude = wgs84togcj02.lat
|
|
|
+ d.longitude = wgs84togcj02.lng
|
|
|
}
|
|
|
}
|
|
|
this_.cluster.clearMarkers();
|
|
@@ -3189,8 +3195,8 @@
|
|
|
$('.lamp_'+this_.lampId).css('display','block')
|
|
|
}
|
|
|
this_.cluster.clearMarkers();
|
|
|
- let bd_encrypt = this_.bd_encrypt(this_.lampLongitude,this_.lampLatitude)
|
|
|
- this_.mapGet('lamp',[bd_encrypt.bd_lng,bd_encrypt.bd_lat],this_.mapDataListHC);
|
|
|
+ let gcj02towgs84 = this_.gcj02towgs84(this_.lampLongitude,this_.lampLatitude)
|
|
|
+ this_.mapGet('lamp',[gcj02towgs84.bd_lng,gcj02towgs84.bd_lat],this_.mapDataListHC);
|
|
|
this_.lampId = '-1';
|
|
|
this_.monitorId = '-1';
|
|
|
Notification.closeAll();
|
|
@@ -3693,6 +3699,7 @@
|
|
|
let encrypt_low = this_.bd_encrypt(this_.map.getSouthWest().lng(),this_.map.getSouthWest().lat())
|
|
|
let encrypt_high = this_.bd_encrypt(this_.map.getNorthEast().lng(),this_.map.getNorthEast().lat())
|
|
|
// console.log(this_.map.getNorthEast().lat(),this)
|
|
|
+
|
|
|
baseApi.ajax_post(
|
|
|
allUrl.gisMap.mapGet,
|
|
|
{
|
|
@@ -3763,14 +3770,14 @@
|
|
|
d.setMap(null)
|
|
|
}
|
|
|
}
|
|
|
- for(let d of this_.markerListHC){
|
|
|
+ for(let d of this_.markerListHCEn){
|
|
|
if(d.onRemove){
|
|
|
d.setMap(null);
|
|
|
}
|
|
|
}
|
|
|
this_.markersHC = [];
|
|
|
// console.log(this_.map,this_.marker)
|
|
|
- this_.markerListHC = [];
|
|
|
+ this_.markerListHCEn = [];
|
|
|
let mapTCtype = this.map.getMapTypeId();
|
|
|
if(mapTCtype == 'roadmap'){
|
|
|
this_.mapTCtype = 'TileLayer'
|
|
@@ -3918,7 +3925,7 @@
|
|
|
this_.map.setZoom(this_.map.getZoom()+1);
|
|
|
this_.map.setCenter(new google.maps.LatLng(this.getPosition().lat(),this.getPosition().lng()));
|
|
|
})
|
|
|
- this_.markerListHC.push(this_.marker)
|
|
|
+ this_.markerListHCEn.push(this_.marker)
|
|
|
}else if(d.is_video == 1){
|
|
|
this_.marker = new RichMarker({
|
|
|
position:new google.maps.LatLng(Number(d.latitude),Number(d.longitude)),
|
|
@@ -4012,10 +4019,10 @@
|
|
|
// });
|
|
|
// }else{
|
|
|
if(isNew){
|
|
|
- let decrypt = this.bd_decrypt(data.data.longitude,data.data.latitude)
|
|
|
- data.data.longitude = decrypt.lng;
|
|
|
- data.data.latitude = decrypt.lat;
|
|
|
- // console.log(data.data.longitude,data.data.latitude,'===========')
|
|
|
+ let wgs84togcj02 = this.wgs84togcj02(data.data.longitude,data.data.latitude)
|
|
|
+ data.data.longitude = wgs84togcj02.lng;
|
|
|
+ data.data.latitude = wgs84togcj02.lat;
|
|
|
+ console.log(wgs84togcj02,data.data.latitude,'===========')
|
|
|
/*创建地图*/
|
|
|
this.map = new AMap.Map("container", {
|
|
|
resizeEnable: true,
|
|
@@ -4045,7 +4052,8 @@
|
|
|
}
|
|
|
let lampId = '';
|
|
|
if(type == 'lamp'){
|
|
|
- XY = [this.bd_decrypt(XY[0],XY[1]).lng,this.bd_decrypt(XY[0],XY[1]).lat];
|
|
|
+ XY = [this.wgs84togcj02(XY[0],XY[1]).lng,this.wgs84togcj02(XY[0],XY[1]).lat];
|
|
|
+ console.log(XY[0],XY[1],this.wgs84togcj02(XY[0],XY[1]),this.wgs84togcj02(XY[0],XY[1]).lng)
|
|
|
this_.map.setZoomAndCenter(17,XY)
|
|
|
lampId = this_.lampId;
|
|
|
}else{
|
|
@@ -4058,8 +4066,8 @@
|
|
|
// this.$store.commit('setLoadingGetMap',{
|
|
|
// loadingGetMap:true,
|
|
|
// })
|
|
|
- let encrypt_low = this.bd_encrypt(this.map.getBounds().southwest.lng,this.map.getBounds().southwest.lat)
|
|
|
- let encrypt_high = this.bd_encrypt(this.map.getBounds().northeast.lng,this.map.getBounds().northeast.lat)
|
|
|
+ let encrypt_low = this.gcj02towgs84(this.map.getBounds().southwest.lng,this.map.getBounds().southwest.lat)
|
|
|
+ let encrypt_high = this.gcj02towgs84(this.map.getBounds().northeast.lng,this.map.getBounds().northeast.lat)
|
|
|
|
|
|
baseApi.ajax_post(
|
|
|
allUrl.gisMap.mapGet,
|
|
@@ -4087,8 +4095,8 @@
|
|
|
this_.map.on('dragend', function() {
|
|
|
clearTimeout(this_.timeoutMap)
|
|
|
this_.timeoutMap = setTimeout(function(){
|
|
|
- let encrypt_low = this_.bd_encrypt(this_.map.getBounds().southwest.lng,this_.map.getBounds().southwest.lat)
|
|
|
- let encrypt_high = this_.bd_encrypt(this_.map.getBounds().northeast.lng,this_.map.getBounds().northeast.lat)
|
|
|
+ let encrypt_low = this_.gcj02towgs84(this_.map.getBounds().southwest.lng,this_.map.getBounds().southwest.lat)
|
|
|
+ let encrypt_high = this_.gcj02towgs84(this_.map.getBounds().northeast.lng,this_.map.getBounds().northeast.lat)
|
|
|
|
|
|
this_.cluster.clearMarkers();
|
|
|
baseApi.ajax_post(
|
|
@@ -4124,8 +4132,8 @@
|
|
|
// loadingGetMap:true,
|
|
|
// })
|
|
|
|
|
|
- let encrypt_low = this_.bd_encrypt(this_.map.getBounds().southwest.lng,this_.map.getBounds().southwest.lat)
|
|
|
- let encrypt_high = this_.bd_encrypt(this_.map.getBounds().northeast.lng,this_.map.getBounds().northeast.lat)
|
|
|
+ let encrypt_low = this_.gcj02towgs84(this_.map.getBounds().southwest.lng,this_.map.getBounds().southwest.lat)
|
|
|
+ let encrypt_high = this_.gcj02towgs84(this_.map.getBounds().northeast.lng,this_.map.getBounds().northeast.lat)
|
|
|
|
|
|
this_.cluster.clearMarkers();
|
|
|
baseApi.ajax_post(
|
|
@@ -4167,9 +4175,9 @@
|
|
|
this_.markerListHC = [];
|
|
|
for(let d of data){
|
|
|
if(!isTrue){
|
|
|
- let decrypt = this_.bd_decrypt(d.longitude,d.latitude);
|
|
|
- d.longitude = decrypt.lng;
|
|
|
- d.latitude = decrypt.lat;
|
|
|
+ let wgs84togcj02 = this_.wgs84togcj02(d.longitude,d.latitude);
|
|
|
+ d.longitude = wgs84togcj02.lng;
|
|
|
+ d.latitude = wgs84togcj02.lat;
|
|
|
}
|
|
|
|
|
|
if((!this_.lampEdit && d.id != this_.lampId) || this_.lampEdit){
|
|
@@ -4532,28 +4540,117 @@
|
|
|
},
|
|
|
//百度坐标转高德(传入经度、纬度)
|
|
|
bd_decrypt(bd_lng, bd_lat) {
|
|
|
- var X_PI = Math.PI * 3000.0 / 180.0;
|
|
|
- var x = bd_lng - 0.0065;
|
|
|
- var y = bd_lat - 0.006;
|
|
|
- var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * X_PI);
|
|
|
- var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * X_PI);
|
|
|
- var gg_lng = z * Math.cos(theta);
|
|
|
- var gg_lat = z * Math.sin(theta);
|
|
|
- return {lng: gg_lng, lat: gg_lat}
|
|
|
+ // var X_PI = Math.PI * 3000.0 / 180.0;
|
|
|
+ // var x = bd_lng - 0.0065;
|
|
|
+ // var y = bd_lat - 0.006;
|
|
|
+ // var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * X_PI);
|
|
|
+ // var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * X_PI);
|
|
|
+ // var gg_lng = z * Math.cos(theta);
|
|
|
+ // var gg_lat = z * Math.sin(theta);
|
|
|
+ // return {lng: gg_lng, lat: gg_lat}
|
|
|
+ return {lng: bd_lng, lat: bd_lat}
|
|
|
},
|
|
|
//高德坐标转百度(传入经度、纬度)
|
|
|
bd_encrypt(gg_lng, gg_lat) {
|
|
|
- var X_PI = Math.PI * 3000.0 / 180.0;
|
|
|
- var x = gg_lng, y = gg_lat;
|
|
|
- var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * X_PI);
|
|
|
- var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * X_PI);
|
|
|
- var bd_lng = z * Math.cos(theta) + 0.0065;
|
|
|
- var bd_lat = z * Math.sin(theta) + 0.006;
|
|
|
+ // var X_PI = Math.PI * 3000.0 / 180.0;
|
|
|
+ // var x = gg_lng, y = gg_lat;
|
|
|
+ // var z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * X_PI);
|
|
|
+ // var theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * X_PI);
|
|
|
+ // var bd_lng = z * Math.cos(theta) + 0.0065;
|
|
|
+ // var bd_lat = z * Math.sin(theta) + 0.006;
|
|
|
+ // return {
|
|
|
+ // bd_lat: bd_lat,
|
|
|
+ // bd_lng: bd_lng
|
|
|
+ // };
|
|
|
return {
|
|
|
- bd_lat: bd_lat,
|
|
|
- bd_lng: bd_lng
|
|
|
+ bd_lat: gg_lat,
|
|
|
+ bd_lng: gg_lng
|
|
|
};
|
|
|
},
|
|
|
+ wgs84togcj02(lng, lat) {
|
|
|
+ // var x_PI = 3.14159265358979324 * 3000.0 / 180.0;
|
|
|
+ var PI = 3.1415926535897932384626;
|
|
|
+ var a = 6378245.0;
|
|
|
+ var ee = 0.00669342162296594323;
|
|
|
+ // function out_of_china(lng, lat) {
|
|
|
+ // // return (lng < 72.004 || lng > 137.8347) || ((lat < 0.8293 || lat > 55.8271) || false);
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // if (out_of_china(lng, lat)) {
|
|
|
+ // // return [lng, lat]
|
|
|
+ // return {lng: lng, lat: lat}
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ var dlat = this.transformlat(lng - 105.0, lat - 35.0);
|
|
|
+ var dlng = this.transformlng(lng - 105.0, lat - 35.0);
|
|
|
+ var radlat = lat / 180.0 * PI;
|
|
|
+ var magic = Math.sin(radlat);
|
|
|
+ magic = 1 - ee * magic * magic;
|
|
|
+ var sqrtmagic = Math.sqrt(magic);
|
|
|
+ dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
|
|
|
+ dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
|
|
|
+ var mglat = Number(lat) + Number(dlat);
|
|
|
+ var mglng = Number(lng) + Number(dlng);
|
|
|
+ // return [mglng, mglat]
|
|
|
+ return {lng: mglng, lat: mglat}
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ gcj02towgs84(lng, lat) {
|
|
|
+ // var x_PI = 3.14159265358979324 * 3000.0 / 180.0;
|
|
|
+ var PI = 3.1415926535897932384626;
|
|
|
+ var a = 6378245.0;
|
|
|
+ var ee = 0.00669342162296594323;
|
|
|
+ // function out_of_china(lng, lat) {
|
|
|
+ // // return (lng < 72.004 || lng > 137.8347) || ((lat < 0.8293 || lat > 55.8271) || false);
|
|
|
+ // return false;
|
|
|
+ // }
|
|
|
+ // if (out_of_china(lng, lat)) {
|
|
|
+ // // return [lng, lat]
|
|
|
+ // return {
|
|
|
+ // bd_lat: lat,
|
|
|
+ // bd_lng: lng
|
|
|
+ // };
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ var dlat = this.transformlat(lng - 105.0, lat - 35.0);
|
|
|
+ var dlng = this.transformlng(lng - 105.0, lat - 35.0);
|
|
|
+ var radlat = lat / 180.0 * PI;
|
|
|
+ var magic = Math.sin(radlat);
|
|
|
+ magic = 1 - ee * magic * magic;
|
|
|
+ var sqrtmagic = Math.sqrt(magic);
|
|
|
+ dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
|
|
|
+ dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
|
|
|
+ var mglat = Number(lat) + Number(dlat);
|
|
|
+ var mglng = Number(lng) + Number(dlng);
|
|
|
+ // return [lng * 2 - mglng, lat * 2 - mglat]
|
|
|
+ return {
|
|
|
+ bd_lat: lat * 2 - mglat,
|
|
|
+ bd_lng: lng * 2 - mglng
|
|
|
+ };
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ transformlat(lng, lat) {
|
|
|
+ // var x_PI = 3.14159265358979324 * 3000.0 / 180.0;
|
|
|
+ var PI = 3.1415926535897932384626;
|
|
|
+ // var a = 6378245.0;
|
|
|
+ // var ee = 0.00669342162296594323;
|
|
|
+ var ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
|
|
|
+ ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
|
|
|
+ ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0;
|
|
|
+ ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0;
|
|
|
+ return ret
|
|
|
+ },
|
|
|
+ transformlng(lng, lat) {
|
|
|
+ // var x_PI = 3.14159265358979324 * 3000.0 / 180.0;
|
|
|
+ var PI = 3.1415926535897932384626;
|
|
|
+ // var a = 6378245.0;
|
|
|
+ // var ee = 0.00669342162296594323;
|
|
|
+ var ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
|
|
|
+ ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
|
|
|
+ ret += (20.0 * Math.sin(lng * PI) + 40.0 * Math.sin(lng / 3.0 * PI)) * 2.0 / 3.0;
|
|
|
+ ret += (150.0 * Math.sin(lng / 12.0 * PI) + 300.0 * Math.sin(lng / 30.0 * PI)) * 2.0 / 3.0;
|
|
|
+ return ret
|
|
|
+ },
|
|
|
maplampListDW(){
|
|
|
let this_ = this;
|
|
|
let isTrue = false,longitude,latitude;
|