Commit 9627b999 authored by fengruiyu's avatar fengruiyu

搜索地址回调的问题已经修改

android so库已经修改完成
优化App的体积大小问题 30M优化到23M
parent daec8624
...@@ -24,7 +24,8 @@ android { ...@@ -24,7 +24,8 @@ android {
//配置so文件 //配置so文件
ndk { ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips" //abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
abiFilters "armeabi-v7a", "arm64-v8a"
} }
manifestPlaceholders = [CHANNEL_NAME_VALUE: "street", manifestPlaceholders = [CHANNEL_NAME_VALUE: "street",
......
...@@ -2,28 +2,28 @@ ...@@ -2,28 +2,28 @@
// console.log(data) // console.log(data)
// } // }
var isWindowLoad=false; var isWindowLoad = false;//页面加载
var BridgeIsLoad=false; var BridgeIsLoad = false;//框架加载
function tryAllIsOk(){ function tryAllIsOk() {
console.log("tryAllIsOk","isWindowLoad",isWindowLoad,"BridgeIsLoad",BridgeIsLoad) //console.log("tryAllIsOk", "isWindowLoad", isWindowLoad, "BridgeIsLoad", BridgeIsLoad)
if(isWindowLoad){ if (isWindowLoad) {
try { try {
doAppFun("allIsOk"); doAppFun("allIsOk");
} catch (e) { } catch (e) {
console.log('allisOk',e) // console.log('allisOk', e)
// alert("app未接受开始自动跳转" + e) // alert("app未接受开始自动跳转" + e)
setTimeout(function(){ setTimeout(function () {
doAppFun("allIsOk"); doAppFun("allIsOk");
},1500); }, 1500);
} }
} }
} }
function toVurl(a, innerData) { function toVurl(a, innerData) {
var data=JSON.stringify(innerData); var data = JSON.stringify(innerData);
if (a == 'b') { if (a == 'b') {
try { try {
doAppFun("toBVr", data); doAppFun("toBVr", data);
...@@ -37,7 +37,7 @@ function toVurl(a, innerData) { ...@@ -37,7 +37,7 @@ function toVurl(a, innerData) {
try { try {
doAppFun("toVr", data); doAppFun("toVr", data);
} catch (e) { } catch (e) {
console.log('toVr', data) // console.log('toVr', data)
//alert("app未接受开始自动跳转" + e) //alert("app未接受开始自动跳转" + e)
} }
...@@ -46,11 +46,10 @@ function toVurl(a, innerData) { ...@@ -46,11 +46,10 @@ function toVurl(a, innerData) {
} }
function allIsOk(a, data) { function allIsOk(a, data) {
console.log("innerAllIsOk") //console.log("innerAllIsOk")
isWindowLoad=true; isWindowLoad = true;
tryAllIsOk(); tryAllIsOk();
// setTimeout(function(){ // setTimeout(function(){
// //
// },1000); // },1000);
...@@ -67,15 +66,16 @@ function doAppFun(funstr, params) { ...@@ -67,15 +66,16 @@ function doAppFun(funstr, params) {
funstr funstr
, params , params
, function (responseData) { , function (responseData) {
console.log(responseData) // console.log(responseData)
} }
); );
} }
function centerChanged() { function centerChanged() {
try { try {
doAppFun("centerChanged"); doAppFun("centerChanged");
} catch (e) { } catch (e) {
console.log("tips",msg) // console.log("tips", msg)
//alert("app未弹框==>" + msg + e) //alert("app未弹框==>" + msg + e)
} }
} }
...@@ -84,7 +84,7 @@ function tips(msg) { ...@@ -84,7 +84,7 @@ function tips(msg) {
try { try {
doAppFun("tips", msg); doAppFun("tips", msg);
} catch (e) { } catch (e) {
console.log("tips",msg) //console.log("tips", msg)
//alert("app未弹框==>" + msg + e) //alert("app未弹框==>" + msg + e)
} }
} }
...@@ -98,8 +98,8 @@ function connectWebViewJavascriptBridge(callback) { ...@@ -98,8 +98,8 @@ function connectWebViewJavascriptBridge(callback) {
'WebViewJavascriptBridgeReady' 'WebViewJavascriptBridgeReady'
, function () { , function () {
callback(WebViewJavascriptBridge) callback(WebViewJavascriptBridge)
BridgeIsLoad=true; BridgeIsLoad = true;
tryAllIsOk() tryAllIsOk()
}, },
false false
); );
...@@ -115,24 +115,23 @@ connectWebViewJavascriptBridge(function (bridge) { ...@@ -115,24 +115,23 @@ connectWebViewJavascriptBridge(function (bridge) {
'Javascript Responds': 'Wee!' 'Javascript Responds': 'Wee!'
}; };
responseCallback(data); responseCallback(data);
}); });
//Android调用js方法:functionInJs方法名称需要保持一致 ,并返回给Android通知 //Android调用js方法:functionInJs方法名称需要保持一致 ,并返回给Android通知
bridge.registerHandler("initZsMap", function (data, responseCallback) { bridge.registerHandler("initZsMap", function (data, responseCallback) {
initZsMap(data); vm.initZsMap(data);
responseCallback("suc:initZsMap"); responseCallback("suc:initZsMap");
}); });
bridge.registerHandler("addZoom", function (data, responseCallback) { bridge.registerHandler("addZoom", function (data, responseCallback) {
addZoom(); vm.addZoom();
responseCallback("suc:addZoom"); responseCallback("suc:addZoom");
}); });
bridge.registerHandler("reduceZoom", function (data, responseCallback) { bridge.registerHandler("reduceZoom", function (data, responseCallback) {
reduceZoom(); vm.reduceZoom();
responseCallback("suc:reduceZoom"); responseCallback("suc:reduceZoom");
}); });
......
...@@ -10,9 +10,9 @@ function CheckChinese(val) { ...@@ -10,9 +10,9 @@ function CheckChinese(val) {
// function toBLatLng(point, f) { // function toBLatLng(point, f) {
// // 百度地图API功能 // // 百度地图API功能
// //
// var ggPoint = new BMapGL.Point(point.lng, point.lat); // var ggPoint = new BMap.Point(point.lng, point.lat);
// //
// var convertor = new BMapGL.Convertor(); // var convertor = new BMap.Convertor();
// var pointArr = []; // var pointArr = [];
// pointArr.push(ggPoint); // pointArr.push(ggPoint);
// //
...@@ -20,7 +20,7 @@ function CheckChinese(val) { ...@@ -20,7 +20,7 @@ function CheckChinese(val) {
// //
// console.log("转换后百度ip", ); // console.log("转换后百度ip", );
// console.log(data.points[0]) // console.log(data.points[0])
// var geoc = new BMapGL.Geocoder(); // var geoc = new BMap.Geocoder();
// //
// geoc.getLocation(data.points[0], function (rs) { // geoc.getLocation(data.points[0], function (rs) {
// //console.log(rs) // //console.log(rs)
...@@ -50,31 +50,33 @@ function CheckChinese(val) { ...@@ -50,31 +50,33 @@ function CheckChinese(val) {
// //
// } // }
//var rpoint = CoordinateUtil.wgs84_to_bd(point)
function toBLatLng(point, f) { function toGPoint(point) {
return CoordinateUtil.getWgs84xy(point);
}
var rpoint = CoordinateUtil.wgs84_to_bd(point) function toBPoint(point) {
return CoordinateUtil.wgs84_to_bd(point);
}
console.log("工具类转换后", rpoint);
var geoc = new BMapGL.Geocoder();
var data = new BMapGL.Point(rpoint.lng,rpoint.lat); function getLocation(rpoint, f) {
// console.log("工具类转换后", rpoint);
var geoc = new BMap.Geocoder();
var data = new BMap.Point(rpoint.lng, rpoint.lat);
geoc.getLocation(data, function (rs) { geoc.getLocation(data, function (rs) {
console.log(rs)
var addComp = rs.addressComponents; var addComp = rs.addressComponents;
console.log(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + console.log(addComp.province);
addComp.street + ", " + addComp.streetNumber); //+ ", " + addComp.city + ", " + addComp.district + ", " addComp.street + ", " + addComp.streetNumber);
// console.log( CheckChinese(addComp.province),typeof(addComp.province),addComp.province.indexOf("台湾")!=-1,CheckChinese(addComp.province)&&addComp.province!="台湾省") // console.log( CheckChinese(addComp.province),typeof(addComp.province),addComp.province.indexOf("台湾")!=-1,CheckChinese(addComp.province)&&addComp.province!="台湾省")
var res = data; var res = data;
res.c = CheckChinese(addComp.province)&&addComp.province!="台湾省"; res.c = CheckChinese(addComp.province) && addComp.province != "台湾省";
f && f(res) f && f(res)
}) })
} }
// getBAr(data.points[0])
// function getBAr(point){
function bvr(point) { function bvr(point) {
var panoramaService = new BMap.PanoramaService(); var panoramaService = new BMap.PanoramaService();
panoramaService.getPanoramaByLocation(new BMap.Point(point.lng, point.lat), 10000, function (data) { panoramaService.getPanoramaByLocation(new BMap.Point(point.lng, point.lat), 10000, function (data) {
...@@ -84,33 +86,22 @@ function bvr(point) { ...@@ -84,33 +86,22 @@ function bvr(point) {
tips("暂无街景") tips("暂无街景")
return; return;
} }
panoramaInfo += '全景id为:' + data.id + '\n'; // panoramaInfo += '全景id为:' + data.id + '\n';
panoramaInfo += '<br/>全景路段名为:' + data.description + '\n'; panoramaInfo = '全景路段名为:' + data.description;
panoramaInfo += '<br/>坐标为:' + data.position.lng + ':' + data.position.lat + '\n'; // panoramaInfo += '<br/>坐标为:' + data.position.lng + ':' + data.position.lat + '\n';
console.log(panoramaInfo); console.log(panoramaInfo);
// tips("准备跳转国内" + data.description) // tips("准备跳转国内" + data.description)
var params = { var params = {
"d": data.id, "d": data.id,
"title": data.description "title": data.description
} }
toVurl('b',params) toVurl('b', params)
}); });
} }
// function getblc(f) {
//
// var geolocation = new BMap.Geolocation();
// geolocation.getCurrentPosition(function (r) {
// if (this.getStatus() == BMAP_STATUS_SUCCESS) {
// f&&f(r.point)
// //alert('您的位置:' + r.point.lng + ',' + r.point.lat);
// } else {
// // alert('failed' + this.getStatus());
// }
// });
// }
window.google = window.google || {};
google.maps = google.maps || {};
//强行阻断地图加载
//获取加载参数
var G_ZSYDA;//gmapinitneed
function loadGoogleMap(Yda) {
//window.google.maps.Load&&window.google.maps.Load(Yda);
G_ZSYDA = Yda;
}
var initMap;//gneedfun
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 () {
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",
"CN",
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();
})();
...@@ -28,7 +28,7 @@ var CoordinateUtil = { ...@@ -28,7 +28,7 @@ var CoordinateUtil = {
//gs84转国测局 //gs84转国测局
wgs84togcj02: function(lng, lat) { wgs84togcj02: function(lng, lat) {
var dlat = CoordinateUtil.transformlat(lng - 105.0, lat - 35.0); var dlat = CoordinateUtil.transformlat(lng - 105.0, lat - 35.0);
var dlng = CoordinateUtil.transformlng(lng - 105.0, lat - 35.0); var dlng = CoordinateUtil.transformlng(lng - 105.0, lat - 35.0);
var radlat = lat / 180.0 * CoordinateUtil.pi; var radlat = lat / 180.0 * CoordinateUtil.pi;
var magic = Math.sin(radlat); var magic = Math.sin(radlat);
magic = 1 - CoordinateUtil.ee * magic * magic; magic = 1 - CoordinateUtil.ee * magic * magic;
...@@ -44,8 +44,8 @@ var CoordinateUtil = { ...@@ -44,8 +44,8 @@ var CoordinateUtil = {
}, },
//国测局转百度 //国测局转百度
gcj02tobd09: function(lng, lat) { gcj02tobd09: function(lng, lat) {
var z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * CoordinateUtil.x_pi); var z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * CoordinateUtil.x_pi);
var theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * CoordinateUtil.x_pi); var theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * CoordinateUtil.x_pi);
var bd_lng = z * Math.cos(theta) + 0.0065; var bd_lng = z * Math.cos(theta) + 0.0065;
var bd_lat = z * Math.sin(theta) + 0.006; var bd_lat = z * Math.sin(theta) + 0.006;
return { return {
...@@ -55,8 +55,8 @@ var CoordinateUtil = { ...@@ -55,8 +55,8 @@ var CoordinateUtil = {
}, },
//国测局转84 //国测局转84
gcj02towgs84: function(lng, lat) { gcj02towgs84: function(lng, lat) {
var dlat = CoordinateUtil.transformlat(lng - 105.0, lat - 35.0); var dlat = CoordinateUtil.transformlat(lng - 105.0, lat - 35.0);
var dlng = CoordinateUtil.transformlng(lng - 105.0, lat - 35.0); var dlng = CoordinateUtil.transformlng(lng - 105.0, lat - 35.0);
var radlat = lat / 180.0 * CoordinateUtil.pi; var radlat = lat / 180.0 * CoordinateUtil.pi;
var magic = Math.sin(radlat); var magic = Math.sin(radlat);
magic = 1 - CoordinateUtil.ee * magic * magic; magic = 1 - CoordinateUtil.ee * magic * magic;
...@@ -86,13 +86,12 @@ var CoordinateUtil = { ...@@ -86,13 +86,12 @@ var CoordinateUtil = {
ret += (150.0 * Math.sin(lng / 12.0 * CoordinateUtil.pi) + 300.0 * Math.sin(lng / 30.0 * CoordinateUtil.pi)) * 2.0 / 3.0; ret += (150.0 * Math.sin(lng / 12.0 * CoordinateUtil.pi) + 300.0 * Math.sin(lng / 30.0 * CoordinateUtil.pi)) * 2.0 / 3.0;
return ret; return ret;
}, },
getWgs84xy:function(x,y){ getWgs84xy:function(point){
//先转 国测局坐标 //先转 国测局坐标
var doubles_gcj = CoordinateUtil.bd09togcj02(x, y); //(x 117. y 36. ) var doubles_gcj = CoordinateUtil.bd09togcj02(point.lng, point.lat); //(x 117. y 36. )
//国测局坐标转wgs84 //国测局坐标转wgs84
var doubles_wgs84 = CoordinateUtil.gcj02towgs84(doubles_gcj.lng, doubles_gcj.lat); var doubles_wgs84 = CoordinateUtil.gcj02towgs84(doubles_gcj.lng, doubles_gcj.lat);
//返回 纠偏后 坐标 //返回 纠偏后 坐标
return doubles_wgs84; return doubles_wgs84;
}, },
wgs84_to_bd:function(point){ wgs84_to_bd:function(point){
...@@ -101,7 +100,7 @@ var CoordinateUtil = { ...@@ -101,7 +100,7 @@ var CoordinateUtil = {
//国测局坐标转bd //国测局坐标转bd
var doubles_bd = CoordinateUtil.gcj02tobd09(doubles_gcj.lng, doubles_gcj.lat); var doubles_bd = CoordinateUtil.gcj02tobd09(doubles_gcj.lng, doubles_gcj.lat);
//返回 纠偏后 坐标 //返回 纠偏后 坐标
return doubles_bd; return doubles_bd;
} }
} }
......
This diff is collapsed.
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="./common/url.js"></script>
<script> <script>
document.write('<script type="text/javascript"' + document.write('<script type="text/javascript"' +
' src="https://api.map.baidu.com/api?v=3.0&ak=' + getParam("bk") + '"><\/script>') ' src="https://api.map.baidu.com/api?v=3.0&ak=' + getParam("bk") + '"><\/script>')
...@@ -48,8 +49,6 @@ ...@@ -48,8 +49,6 @@
//全景图展示 //全景图展示
var panorama = new BMap.Panorama('panorama'); var panorama = new BMap.Panorama('panorama');
// panorama.setPosition(new BMap.Point(120.320032, 31.589666)); //根据经纬度坐标展示全景图 // panorama.setPosition(new BMap.Point(120.320032, 31.589666)); //根据经纬度坐标展示全景图
...@@ -86,7 +85,7 @@ ...@@ -86,7 +85,7 @@
} }
var map = new BMap.Map("normal_map", mapOption); var map = new BMap.Map("normal_map", mapOption);
var testpoint = new BMap.Point(120.320032, 31.589666); var testpoint = new BMap.Point(120.320032, 31.589666);
map.centerAndZoom(testpoint, 18); map.centerAndZoom(testpoint, 15);
// 创建小车图标 // 创建小车图标
var myIcon = new BMap.Icon("./common/bm.jpg", new BMap.Size(40, 63),{ var myIcon = new BMap.Icon("./common/bm.jpg", new BMap.Size(40, 63),{
// anchor: new BMap.Size(0, 0) // anchor: new BMap.Size(0, 0)
......
...@@ -21,9 +21,12 @@ ...@@ -21,9 +21,12 @@
} }
#map { #map {
width: 100%;
height: 100%; height: 100%;
position: relative;
} }
.d1 { .d1 {
width: 70px; width: 70px;
height: 90px; height: 90px;
...@@ -34,41 +37,54 @@ ...@@ -34,41 +37,54 @@
left: 50%; left: 50%;
margin-left: -35px; margin-left: -35px;
} }
/*.gmnoprint{*/
/* display: none !important;*/
/*}*/
</style>
<script type="text/javascript" charset="UTF-8" src="./common/latlng.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/url.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/zsc.js"></script> #bmap {
<script type="text/javascript" charset="UTF-8" src="./zsmap.js"></script> width: 100%;
<script> height: 100%;
document.write('<script type="text/javascript"' + overflow: hidden;
' src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak='+getParam("bk")+'"><\/script>' margin: 0;
position:absolute;
+'<script type="text/javascript"' + font-family: "微软雅黑";
' src="https://api.map.baidu.com/api?v=3.0&ak='+getParam("bk")+'"><\/script>'); }
</script>
<script src="https://code.bdstatic.com/npm/jquery@1.12.4/dist/jquery.min.js"></script> .anchorBL,a{
display: none !important;
}
#map .gmnoprint{
display: none !important;
}
<script src="./common/baidu.js" async=""></script> </style>
<script type="text/javascript" charset="UTF-8" src="./common/ap.js" async=""></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/common.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/util.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/map.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/onion.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/controls.js"></script>
</head> </head>
<body> <body>
<div id="maps" style="height: 100%;width: 100%;padding: 0;margin:0;">
<div id="map" style="position: relative; overflow: hidden;"> <div id="map" v-show="!NOWUSEBAIDU"></div>
<div id="bmap" v-show="true||NOWUSEBAIDU"></div>
<img src="./common/icon.jpg" @click="vrs()" class="d1" id="im">
</div> </div>
<img src="./common/icon.jpg" onclick="al()" class="d1" id="im">
</img>
<script src="./zsmap_files/js" async=""></script>
</body> </body>
<script type="text/javascript" charset="UTF-8" src="./common/vue.min.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/latlng.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/url.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/zsc.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/gmap.js"></script>
<script type="text/javascript" charset="UTF-8" src="./common/bmap.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap.js"></script>
<script>
document.write('<script type="text/javascript"' +
' src="https://api.map.baidu.com/api?v=3.0&ak=' + getParam("bk") + '"><\/script>');
</script>
<script src="./common/jquery.min.js"></script>
<script src="./common/baidu.js" async=""></script>
<script type="text/javascript" charset="UTF-8" src="./common/ap.js" async=""></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/common.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/util.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/map.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/onion.js"></script>
<script type="text/javascript" charset="UTF-8" src="./zsmap_files/controls.js"></script>
<script src="./zsmap_files/js" async=""></script>
</html> </html>
This diff is collapsed.
This diff is collapsed.
...@@ -8,4 +8,6 @@ class MutualBean { ...@@ -8,4 +8,6 @@ class MutualBean {
var d:String?=null var d:String?=null
var lat:String?=null var lat:String?=null
var lng:String?=null var lng:String?=null
var blat:String?=null
var blng:String?=null
} }
\ No newline at end of file
...@@ -54,7 +54,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) { ...@@ -54,7 +54,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) {
ApiModel.checkUpgrade(lifecycleProvider, vo) ApiModel.checkUpgrade(lifecycleProvider, vo)
.safeSubscribe(object .safeSubscribe(object
: HttpSubscribeImpl<BaseResponse<Version>>( : HttpSubscribeImpl<BaseResponse<Version>>(
this@MainViewModel, false null, false
) { ) {
override fun onBusinessSuccess(response: BaseResponse<Version>) { override fun onBusinessSuccess(response: BaseResponse<Version>) {
response.result?.apply { response.result?.apply {
......
...@@ -131,7 +131,6 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel ...@@ -131,7 +131,6 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
} }
//加载完成 //加载完成
binding.webview.registerHandler("allIsOk") { _, _ -> binding.webview.registerHandler("allIsOk") { _, _ ->
KLog.e("Sfsadfa","allIsOk")
initZsMap() initZsMap()
} }
...@@ -165,8 +164,14 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel ...@@ -165,8 +164,14 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
* 调用JS * 调用JS
*/ */
private fun initZsMap() { private fun initZsMap() {
val bd09ToGcj02 = GPSConverterUtils.bd09_To_Gcj02(gps.lat, gps.lat)
val mutualBean = MutualBean()
mutualBean.lat = bd09ToGcj02.lat.toString()
mutualBean.lng = bd09ToGcj02.lng.toString()
mutualBean.blat = gps.lat.toString()
mutualBean.blng = gps.lng.toString()
binding.webview.callHandler("initZsMap" binding.webview.callHandler("initZsMap"
,Gson().toJson(GPSConverterUtils.bd09_To_Gcj02(gps.lat,gps.lng)) ) { ,Gson().toJson(mutualBean) ) {
} }
} }
...@@ -227,6 +232,12 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel ...@@ -227,6 +232,12 @@ class GoogleMapFragment() : BaseFragment<ActivityGoogleMapBinding, HomeViewModel
} }
}) })
viewModel.pt.observe(this, Observer { viewModel.pt.observe(this, Observer {
val bd09ToGcj02 = GPSConverterUtils.bd09_To_Gcj02(it.lat, it.lat)
val mutualBean = MutualBean()
mutualBean.lat = bd09ToGcj02.lat.toString()
mutualBean.lng =bd09ToGcj02.lng.toString()
mutualBean.blat = it.lat.toString()
mutualBean.blng = it.lng.toString()
binding.webview.callHandler("initZsMap" binding.webview.callHandler("initZsMap"
,Gson().toJson(it) ) { ,Gson().toJson(it) ) {
} }
......
...@@ -116,8 +116,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE ...@@ -116,8 +116,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding, HomeViewModel>(), SensorE
viewModel.pt.observe(this, Observer { viewModel.pt.observe(this, Observer {
if (it == null) return@Observer if (it == null) return@Observer
// 默认 天安门 // 默认 天安门
val gps = GPSConverterUtils.gcj02_To_Bd09(it.lat, it.lng) val center = LatLng(it.lat, it.lng)
val center = LatLng(gps.lat, gps.lng)
setNewMapStatus(center) setNewMapStatus(center)
binding.scrollLayout.toggle(ScrollLayout.STATUS_CLOSE) binding.scrollLayout.toggle(ScrollLayout.STATUS_CLOSE)
}) })
......
...@@ -34,6 +34,7 @@ class HomeViewModel(application: Application) : BaseViewModel(application) { ...@@ -34,6 +34,7 @@ class HomeViewModel(application: Application) : BaseViewModel(application) {
var addressItemBinding = var addressItemBinding =
ItemBinding.of<HomeButtonItemVM>(BR.viewModel, R.layout.item_home_button) ItemBinding.of<HomeButtonItemVM>(BR.viewModel, R.layout.item_home_button)
//搜索页面回调 谷歌GPS
var pt = MutableLiveData<GPS>() var pt = MutableLiveData<GPS>()
val authorizedBean = MutableLiveData<AuthorizedBean>() val authorizedBean = MutableLiveData<AuthorizedBean>()
......
...@@ -51,6 +51,7 @@ public class GPSConverterUtils { ...@@ -51,6 +51,7 @@ public class GPSConverterUtils {
} }
/** /**
* 谷歌转百度
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 GCJ-02 坐标转换成 BD-09 坐标 * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 将 GCJ-02 坐标转换成 BD-09 坐标
* *
* @param gg_lat * @param gg_lat
...@@ -66,6 +67,7 @@ public class GPSConverterUtils { ...@@ -66,6 +67,7 @@ public class GPSConverterUtils {
} }
/** /**
* 百度转谷歌
* * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 * * 将 BD-09 坐标转换成GCJ-02 坐标 * * @param * * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换算法 * * 将 BD-09 坐标转换成GCJ-02 坐标 * * @param
* bd_lat * @param bd_lon * @return * bd_lat * @param bd_lon * @return
*/ */
......
...@@ -39,7 +39,7 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV ...@@ -39,7 +39,7 @@ class MintsWebViewActivity : BaseActivity<ActivityMintsWebViewBinding, MintsWebV
} }
fun toBaduVR(d:String?,bk:String?):String{ fun toBaduVR(d:String?,bk:String?):String{
KLog.i("MintsWebViewActivity","file:///android_asset/web/mr.html?d=${d}&bk=${bk}") KLog.i("MintsWebViewActivity","file:///android_asset/web/mr.html?d=${d}&bk=${bk}")
return "file:///android_asset/web/m.html?d=${d}&bk=${bk}" return "file:///android_asset/web/mr.html?d=${d}&bk=${bk}"
} }
fun toBaduVR(lat:String?,lng:String?,bk:String?):String{ fun toBaduVR(lat:String?,lng:String?,bk:String?):String{
......
...@@ -23,20 +23,19 @@ ...@@ -23,20 +23,19 @@
<ImageView <ImageView
android:visibility="gone" android:visibility="gone"
android:id="@+id/image_map_history" android:id="@+id/image_map_history"
android:layout_width="35dp" android:layout_width="35dp"
android:layout_height="35dp" android:layout_height="35dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:src="@mipmap/map_history_icon" android:src="@mipmap/map_history_icon"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/image_map_change" /> app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/image_location_icon" android:id="@+id/image_location_icon"
android:layout_width="35dp" android:layout_width="35dp"
android:layout_height="35dp" android:layout_height="35dp"
android:layout_marginBottom="120dp" android:layout_marginBottom="220dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:src="@mipmap/location_icon" android:src="@mipmap/location_icon"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
android:id="@+id/image_location_icon" android:id="@+id/image_location_icon"
android:layout_width="35dp" android:layout_width="35dp"
android:layout_height="35dp" android:layout_height="35dp"
android:layout_marginBottom="120dp" android:layout_marginBottom="220dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:src="@mipmap/location_icon" android:src="@mipmap/location_icon"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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