本帖最后由 qq281255840 于 2020-2-13 01:11 编辑
麻烦各位,请问怎样用js调用单元格经纬度来查询两地行车距离和时间。(现已js内设两地经纬度运行是正常的 以下代码就是“js内置经纬度测试"按键的js)
var map = Forguncy.Page.getCell("BMap")._pageCell.cellType.map;
map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
var searchComplete = function (results){
if (transit.getStatus() != BMAP_STATUS_SUCCESS){
return ;
}
var plan = results.getPlan(0);
var output2 = plan.getDuration(true) + "\n"; //获取时间
var output = plan.getDistance(true) + "\n"; //获取距离
var page = Forguncy.Page; //获取当前页面
var textCell = page.getCell("bb"); //获取当前页面上名称为bb的单元格
textCell.setValue(output); //设置指定单元格的值
var textCell = page.getCell("aa"); //获取当前页面上名称为aa的单元格
textCell.setValue(output2); //设置指定单元格的值
}
var transit = new BMap.DrivingRoute(map, {renderOptions: {map: map},
onSearchComplete: searchComplete,
onPolylinesSet: function(){
setTimeout(function(){alert(output)},"1000");
}});
var p1= new BMap.Point(112.814751,22.264433);
var p2 = new BMap.Point(113.0966500000,23.0320710000);
transit.search( p1, p2);
|