// 复杂的自定义图片覆盖物
function ComplexCustomOverlay(point){
this._point = point;
}
ComplexCustomOverlay.prototype = new BMap.Overlay();
ComplexCustomOverlay.prototype.initialize = function(map){
this._map = map;
var div = this._div = document.createElement("div");
div.style.position = "absolute";
div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
div.style.border = "2px solid #fff";
div.style.height = "48px";
div.style.width = "48px";
div.style.lineHeight = "18px";
div.style.whiteSpace = "nowrap";
div.style.MozUserSelect = "none";
div.style.fontSize = "12px";
var arrow = this._arrow = document.createElement("img");
arrow.src = case_pic;
arrow.style.width = "48px";
arrow.style.height = "48px";
arrow.style.top = "22px";
arrow.style.left = "10px";
div.appendChild(arrow);
var that = this;
var arrow = this._arrow = document.createElement("div");
arrow.style.background = "url(/tpl/default/theme/new201607/images/officed_label3.png) no-repeat";
arrow.style.position = "absolute";
arrow.style.width = "48px";
arrow.style.height = "48px";
arrow.style.top = "50px";
arrow.style.left = "12px";
arrow.style.overflow = "hidden";
div.appendChild(arrow);
pro_map_new.getPanes().labelPane.appendChild(div);
return div;
}
ComplexCustomOverlay.prototype.draw = function(){
var map = this._map;
var pixel = map.pointToOverlayPixel(this._point);
this._div.style.left = pixel.x - parseInt(this._arrow.style.left) + "px";
this._div.style.top = pixel.y - 30 + "px";
}
//添加监听事件(必有)
ComplexCustomOverlay.prototype.addEventListener = function(event,fun){
this._div['on'+event] = fun;
}
var myCompOverlay = new ComplexCustomOverlay(pro_point_new);
pro_map_new.addOverlay(myCompOverlay);