You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.6 KiB
JavaScript
45 lines
1.6 KiB
JavaScript
//校园里百度地图
|
|
var TT_API_KEY = "bsyeCEEdtDb5Z7dBSAFEPYVS7AETsO9z";
|
|
var TT_SECRET_KEY = "aSqjktpzBZrR9aC65uQSXKumsMQgkEGq";
|
|
var MAP_DIV = "container";
|
|
var MapIcon = [];
|
|
var BDMap = null;
|
|
var MapType = "";
|
|
|
|
function initialize() {
|
|
BDMap = new BMap.Map(MAP_DIV);
|
|
BDMap.centerAndZoom(new BMapGL.Point(p.MapCenter[0], p.MapCenter[1]), 13);
|
|
BDMap.enableScrollWheelZoom(true);
|
|
BDMap.setMapStyle({style: 'midnight'});
|
|
MapIcon = [new BMapGL.Icon("/yyyzweb/common/images/arrow/arrow_b.png", new BMapGL.Size(30, 30))
|
|
, new BMapGL.Icon("/yyyzweb/common/images/arrow/arrow_y.png", new BMapGL.Size(30, 30))
|
|
, new BMapGL.Icon("/yyyzweb/common/images/arrow/arrow_b2.png", new BMapGL.Size(30, 30))];
|
|
}
|
|
|
|
function changeMapType() {
|
|
$("#b_gtype").removeClass("icon-globe icon-th");
|
|
if (MapType == "") {
|
|
MapType = "1";
|
|
BDMap.setMapType(BMAP_EARTH_MAP);
|
|
$("#b_gtype").html(" 电子地图");
|
|
$("#b_gtype").addClass("icon-th");
|
|
} else {
|
|
MapType = "";
|
|
BDMap.setMapType(BMAP_NORMAL_MAP);
|
|
$("#b_gtype").html(" 卫星地图");
|
|
$("#b_gtype").addClass("icon-globe");
|
|
}
|
|
}
|
|
|
|
function BDMap_loadScript(_callback) {
|
|
_callback = _callback != null ? _callback : "initialize";
|
|
let script = document.createElement("script");
|
|
script.src = "//api.map.baidu.com/api?v=3.0&ak=" + TT_API_KEY + "&callback=" + _callback;
|
|
document.body.appendChild(script);
|
|
}
|
|
|
|
function toMapCenter() {
|
|
if (p.MapCenter != null && p.MapCenter.length == 2) {
|
|
BDMap.panTo(new BMapGL.Point(p.MapCenter[0], p.MapCenter[1]));
|
|
}
|
|
} |