87,910
社区成员
发帖
与我相关
我的任务
分享
function mtp() {
// 设置默认停靠位置和偏移量
this.defaultAnchor = BMAP_ANCHOR_TOP_RIGHT;
this.defaultOffset = new BMap.Size(10, 10);
}
mtp.prototype = new BMap.Control();
mtp.prototype.initialize = function (map) {
// 创建一个DOM元素
var d = document.createElement("div");
var e2 = document.createElement("input");
e2.type = "button";
e2.value = "卫星";
// 添加文字说明
d.appendChild(e2);
// 绑定事件
d.onclick = function () {
map.getTileLayer(MapType.BMAP_SATELLITE_MAP);
}
map.getContainer().appendChild(d)
return d;
}
map.addControl(new mtp());
map.getTileLayer(MapType.BMAP_PERSPECTIVE_MAP);