Commit ba364355 authored by fengruiyu's avatar fengruiyu

Merge branch 'dev_1.0.0' of http://39.97.65.143:81/android/android_street into fry_dev

 Conflicts:
	app/src/main/assets/web/zsmap.js
	app/src/main/res/mipmap-xhdpi/icon_me1.png
	app/src/main/res/mipmap-xhdpi/icon_me2.png
	app/src/main/res/mipmap-xhdpi/icon_me3.png
	app/src/main/res/mipmap-xhdpi/icon_me4.png
	app/src/main/res/mipmap-xhdpi/icon_me5.png
	app/src/main/res/mipmap-xhdpi/icon_me6.png
	app/src/main/res/mipmap-xhdpi/icon_me7.png
	app/src/main/res/mipmap-xhdpi/icon_me8.png
parents 9627b999 5d3b2b3f
//var arr =[120.31, 31.58]
var B_MAP;
let G_MAP;//gmap
window.google = window.google || {};
google.maps = google.maps || {};
let map;//fun
var canclick = true;
var ZSYDa;//gmapinitneed
var mapInited = false;
//强行阻断地图加载
//获取加载参数
function loadGoogleMap(Yda) {
//window.google.maps.Load&&window.google.maps.Load(Yda);
ZSYDa = Yda;
}
function GF_addZoom() {
var zoom = G_MAP.getZoom();
if (zoom == 20) {
tip("已放大至最大级别")
(function () {
var modules = google.maps.modules = {};
google.maps.__gjsload__ = function (name, text) {
modules[name] = text;
};
google.maps.Load = function (apiLoad) {
delete google.maps.Load;
apiLoad([
0.009999999776482582,
[
null,
[
getMb1U(),
null,
null,
null,
1,
"904",
[
"http://khms0.google.com/kh?v=904\u0026hl=zh-CN\u0026",
"http://khms1.google.com/kh?v=904\u0026hl=zh-CN\u0026"
]
],
null,
null,
null,
null,
[
[
"http://cbks0.googleapis.com/cbk?",
"http://cbks1.googleapis.com/cbk?"
]
],
[
getMb2U(),
null,
null,
null,
null,
"130",
[
"http://khms0.google.com/kh?v=130\u0026hl=zh-CN\u0026",
"http://khms1.google.com/kh?v=130\u0026hl=zh-CN\u0026"
]
]
],
[
"zh-CN",
"US",
null,
0,
null,
null,
"http://maps.gstatic.com/mapfiles/",
null,
getRequestUrl(),
getRequestUrl(''),
null,
"http://maps.google.com",
null,
"http://maps.gstatic.com/maps-api-v3/api/images/",
"http://www.google.com/maps",
null,
"http://www.google.com",
1,
"http://maps.googleapis.com/maps_api_js_slo/log?hasfast=true"
],
[
getRequestUrl() + "/maps-api-v3/api/js/45/7/intl/zh_cn",
"3.45.7"
],
[
3420973460
],
null,
null,
null,
null,
null,
null,
"initMap",
null,
null,
1,
"http://khms.googleapis.com/mz?v=904\u0026",
getZsKey(),
"http://earthbuilder.googleapis.com",
"http://earthbuilder.googleapis.com",
null,
"http://mts.googleapis.com/maps/vt/icon",
[
[
getRequestUrl() + "/maps/vt"
],
[
getRequestUrl() + "/maps/vt"
],
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
[
"http://www.google.com/maps/vt"
],
"/maps/vt",
565000000,
565,
565290767
],
2,
500,
[
null,
null,
null,
null,
"http://www.google.com/maps/preview/log204",
"",
"http://static.panoramio.com.storage.googleapis.com/photos/",
[
"http://geo0.ggpht.com/cbk",
"http://geo1.ggpht.com/cbk",
"http://geo2.ggpht.com/cbk",
"http://geo3.ggpht.com/cbk"
],
getRequestUrl() + "/maps/api/js/GeoPhotoService.GetMetadata",
getRequestUrl() + "/maps/api/js/GeoPhotoService.SingleImageSearch",
getVrUrls(),
],
null,
null,
null,
null,
"/maps/api/js/ApplicationService.GetEntityDetails",
0,
null,
null,
null,
null,
[],
[
"45.7"
],
1,
0,
[
1
],
null,
null,
null,
0.009999999776482582
], loadScriptTime);
};
var loadScriptTime = (new Date).getTime();
})();
function al() {
if (canclick) {
canclick = false;
setTimeout(function () {
canclick = true;
}, 1200);
} else {
return;
}
zoom += 1;
G_MAP.setZoom(zoom);
var center = map.getCenter();
console.log(center)
const geocoder = new google.maps.Geocoder();
const latlng = {
lat: parseFloat(center.lat()),
lng: parseFloat(center.lng()),
};
toBLatLng(latlng, function (res) {
console.log(res)
if (res.c) {
// tips("猜测为国内,准备使用百度")
bvr(res)
} else {
// tips("猜测为国外,准备使用谷歌")
tosh(center)
}
});
}
function GF_reduceZoom() {
var zoom = G_MAP.getZoom();
if (zoom == 0) {
tip("已缩放至最小级别")
return;
}
zoom -= 1;
G_MAP.setZoom(zoom);
function tosh(center) {
console.log("查询国外或中国台湾街景")
var ser = new google.maps.StreetViewService();
const request = {
location: {
lat: center.lat(),
lng: center.lng()
},
radius: 10000,
preference: 'nearest', //google.maps.StreetViewPreference.NEAREST,
};
ser.getPanorama(request, function (a) {
if (a == null || a.location == null) {
tips("暂无街景")
return;
}
console.log(a.location.description)
console.log(a.location.latLng.lat() + ',' + a.location.latLng.lng())
// console.log("准备模拟app跳转至外国街景:" + a.location.description + "==>./streets.html?a=" + a.location.latLng
// .lat() + "&b=" + a.location.latLng.lng())
var params = {
"lng": a.location.latLng.lng(),
"lat": a.location.latLng.lat(),
"title": a.location.description
}
toVurl('g', params)
})
}
function B_addZoom() {
var zoom = B_MAP.getZoom();
if (zoom == 19) {
//var arr =[120.31, 31.58]
var initMap = function () {
console.log("initMap>>first")
map = new google.maps.Map(document.getElementById("map"), {
zoom: 14,
// RotateControlOptions :RIGHT_CENTER,
center: {
lat: 39.90960456049752,
lng: 116.3972282409668
},
mapTypeId: "hybrid",
zoomControl: false,
mapTypeControl: false,
scaleControl: false,
streetViewControl: false,
rotateControl: false,
fullscreenControl: false,
clickableIcons: false,
zoomControlOptions: {
position: google.maps.ControlPosition.RIGHT_CENTER,
},
// scaleControlOptions:true,
});
/**
* HYBRID 此地图类型在卫星图像上显示主要街道的透明图层。
ROADMAP 此地图类型显示普通街道地图。
SATELLITE 此地图类型显示卫星图像。
TERRAIN 此地图类型显示具有地形和植被等物理特征的地图。
*/
}
function addZoom() {
var zoom = map.getZoom();
if(zoom==20){
tip("已放大至最大级别")
return;
}
zoom += 1;
B_MAP.setZoom(zoom);
map.setZoom(zoom);
}
function B_reduceZoom() {
var zoom = B_MAP.getZoom();
if (zoom == 1) {
function reduceZoom() {
var zoom = map.getZoom();
if(zoom==0){
tip("已缩放至最小级别")
return;
}
zoom -= 1;
B_MAP.setZoom(zoom);
map.setZoom(zoom);
}
var vm = new Vue({
el: '#maps',
data: {
NOWUSEBAIDU: true,
G_MAPINITED: false,//initStatus
B_MAPINITED: false,//initStatus
canclick: true,
},
created: function () {
// console.log('llll')
},
methods: {
vrs: function () {
var th = this;
if (th.canclick) {
th.canclick = false;
setTimeout(function () {
th.canclick = true;
}, 1200);
} else {
return;
}
if (!this.NOWUSEBAIDU) {
var center = G_MAP.getCenter();
const geocoder = new google.maps.Geocoder();
const latlng = {
lat: parseFloat(center.lat()),
lng: parseFloat(center.lng()),
};
//var point={lat:center.lat(),lng:center.lng()};
tosh(center);
} else {
var center = B_MAP.getCenter();
bvr(center)
}
},
addZoom: function () {
if (this.NOWUSEBAIDU) {
B_addZoom()
} else {
GF_addZoom();
}
},
reduceZoom: function () {
if (this.NOWUSEBAIDU) {
B_reduceZoom()
} else {
GF_reduceZoom();
}
},
initZsMap: function (pointStr) {
var th = this;
var allPoint = JSON.parse(pointStr)
var bpoint = {lat: allPoint.blat, lng: allPoint.blng};
var gpoint = {lat: allPoint.lat, lng: allPoint.lng};
getLocation(bpoint, function (res) {
if (res.c) {
console.log("猜测为国内,准备使用百度")
th.B_initmap(bpoint, 14);
} else {
console.log("猜测为国外,准备使用谷歌")
th.G_initMap(gpoint, 14);
}
});
},
G_initMap: function (point, zoomLevel) {
console.log("initG==>", point, zoomLevel)
if (zoomLevel == undefined || zoomLevel == null)
zoomLevel = 15;
this.NOWUSEBAIDU = false;
var th = this;
if (th.G_MAPINITED == false) {//第一次初始化
th.G_MAPINITED = true;
initMap = function () {
G_MAP = new google.maps.Map(document.getElementById("map"), {
zoom: zoomLevel,
// RotateControlOptions :RIGHT_CENTER,
center: point,
mapTypeId: "hybrid",
zoomControl: false,
mapTypeControl: false,
scaleControl: false,
streetViewControl: false,
rotateControl: false,
fullscreenControl: false,
clickableIcons: false,
zoomControlOptions: {
position: google.maps.ControlPosition.RIGHT_CENTER,
},
// scaleControlOptions:true,
});
/**
* HYBRID 此地图类型在卫星图像上显示主要街道的透明图层。
ROADMAP 此地图类型显示普通街道地图。
SATELLITE 此地图类型显示卫星图像。
TERRAIN 此地图类型显示具有地形和植被等物理特征的地图。
*/
// G_MAP.addListener("center_changed", () => {
// console.log("center_changed", {lat: G_MAP.getCenter().lat(), lng: G_MAP.getCenter().lng()})
// });
G_MAP.addListener('zoom_changed', () => {
vm.G_TO_B();
});
G_MAP.addListener("dragend", () => {
console.log("dragend", {lat: G_MAP.getCenter().lat(), lng: G_MAP.getCenter().lng()})
// th.G_TO_BMAP();
centerChanged();
vm.G_TO_B();
});
}
window.google.maps.Load && window.google.maps.Load(G_ZSYDA);
} else {
G_MAP.panTo(point)//第二次初始化
G_MAP.setZoom(zoomLevel)
}
},
G_TO_B:function(){
var th=this;
var zoom = G_MAP.getZoom();
console.log("g zoom",zoom)
if (zoom < 7)
return;
var gpoint = {lat: G_MAP.getCenter().lat(), lng: G_MAP.getCenter().lng()}
var bpoint = toBPoint(gpoint)
getLocation(bpoint, function (res) {
if (res.c) {
var level = G_MAP.getZoom() + 1;
if (level < 3)
level = 3;
if (level > 18)
level = 18;
console.log("猜测为国内,准备谷歌转百度,bpoint==>goint:level", gpoint, bpoint, level)
th.B_initmap(bpoint, level)
}
});
},
B_initmap: function (point, zoomLevel) {
this.NOWUSEBAIDU = true;
console.log("initB==>", point, zoomLevel)
// setTimeout(function () {
if (zoomLevel == undefined || zoomLevel == null)
zoomLevel = 6;
var th = vm;
if (th.B_MAPINITED == false) {
th.B_MAPINITED = true;
// 百度地图API功能
// $("#map").hide();
B_MAP = new BMap.Map("bmap", {
mapType: BMAP_HYBRID_MAP,
enableBizAuthLogo: false
}); // 创建Map实例
B_MAP.centerAndZoom(new BMap.Point(point.lng, point.lat), zoomLevel); // 初始化地图,设置中心点坐标和地图级别
// B_MAP.enableScrollWheelZoom();
// B_MAP.addControl(new BMap.NavigationControl());
// B_MAP.addControl(new BMap.ScaleControl());
// B_MAP.addControl(new BMap.OverviewMapControl());
B_MAP.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
B_MAP.addEventListener('dragend', function (e) {
centerChanged();
vm.B_TO_G();
});
B_MAP.addEventListener('zoomstart', function (type, target) {
// var zoom = B_MAP.getZoom();
// console.log('start zoom=', zoom, ' type=', type, ' ,target=', target);
vm.B_TO_G();
});
} else {
B_MAP.centerAndZoom(new BMap.Point(point.lng, point.lat), zoomLevel); // 初始化地图,设置中心点坐标和地图级别
console.log(">>>>>>>", point, B_MAP.getCenter())
}
// },500)
},
B_TO_G: function () {
var th = this;
var zoom = B_MAP.getZoom();
console.log(' zoom=', zoom);
var point=B_MAP.getCenter();
this.initCenter(point)
if (zoom < 8)//小于9不切换
return;
getLocation(point, function (res) {
if (!res.c) {
var gpoint = toGPoint(res)
var level = B_MAP.getZoom() - 1;
console.log(level)
// if(level<7)
// return;
if (level < 0)
level = 0;
if (level > 20)
level = 20;
console.log("猜测为国外,准备百度转谷歌,bpoint==>goint:level", res, gpoint, level)
th.G_initMap(gpoint, level);
}
});
},
initCenter: function (point) {
if (this.NOWUSEBAIDU && this.G_MAPINITED) {
var gpoint = toGPoint(point)
console.log("同步谷歌中心")
G_MAP.setCenter(point)
}
if (!this.NOWUSEBAIDU&&this.B_MAPINITED) {
var bpoint = toBPoint(point)
console.log("同步百度中心")
B_MAP.setCenter(bpoint)
}
}
}
})
window.onload = function () {
// console.log("window.load_+++++++++++=")
console.log("window.load_+++++++++++=")
allIsOk();
// vm.initZsMap('{"lat":40.24438115650203,"lng":111.12933614537451,"blat":40.24438115650203,"blng":111.12933614537451}')
// initZsMap('{"lat":35.69,"lng":139.69}')
}
function initZsMap(pointStr) {
console.log(">>", pointStr)
var point = JSON.parse(pointStr)
if (mapInited == false) {//第一次初始化
mapInited = true;
initMap = function () {
console.log("initMap>>second")
map = new google.maps.Map(document.getElementById("map"), {
zoom: 14,
// RotateControlOptions :RIGHT_CENTER,
center: point,
mapTypeId: "hybrid",
zoomControl: false,
mapTypeControl: false,
scaleControl: false,
streetViewControl: false,
rotateControl: false,
fullscreenControl: false,
clickableIcons: false,
zoomControlOptions: {
position: google.maps.ControlPosition.RIGHT_CENTER,
},
// scaleControlOptions:true,
});
map.addListener("center_changed", () => {
centerChanged();
});
/**
* HYBRID 此地图类型在卫星图像上显示主要街道的透明图层。
ROADMAP 此地图类型显示普通街道地图。
SATELLITE 此地图类型显示卫星图像。
TERRAIN 此地图类型显示具有地形和植被等物理特征的地图。
*/
}
window.google.maps.Load && window.google.maps.Load(ZSYDa);
} else {
map.panTo(point)//第二次初始化
}
}
// window.onload = function() {
// allIsOk();
// }
......@@ -56,7 +56,7 @@ google.maps = google.maps || {};
],
[
"zh-CN",
"CN",
"US",
null,
0,
null,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment