我改编了@ Jakob的Google Maps API V3代码。 希望能帮助别人。
MarkerClusterer.prototype.A
ddCluster = function(clat, clng, csize)
{
this.setZoomOnClick(false);
if (typeof this.aAddClusterIcons == "undefined"){
this.aAddClusterIcons = [];
}
this.activeMap_ = this.getMap();
var clusterlocation = new google.maps.LatLng(clat, clng)
var CI = new ClusterIcon(new Cluster(this), this.getStyles, this.getGridSize());
var index = 0;
var dv = csize;
while (dv !== 0) {
dv = parseInt(dv/10, 10);
index++;
}
var style = this.styles_[index-1];
$.extend(CI, {sums_ : {text : csize, index: index}, url_ : style['url'], width_ : style['width'], height_ : style['height'], anchorIcon_: [clat, clng]});
CI.setCenter(clusterlocation);
CI.setMap(this.activeMap_);
CI.show();
this.aAddClusterIcons.push(CI);
}
MarkerClusterer.prototype.RemoveClusters = function(clat, clng, csize)
{
if (typeof this.aAddClusterIcons == "undefined"){
this.aAddClusterIcons = [];
}
$.each(this.aAddClusterIcons, function(iIndex, oObj){
oObj.onRemove();
});
this.aAddClusterIcons = [];
}
是啊,这有MarkerClusterer手动处理我的标记的功能,但如果我在我的分贝10.000标志,这是waaaaaay到costy到通过网络发送的数据,更不用说已经MarkerClusterer使所有的计算,所以我想知道如何添加一个ClusterMarker,以便我(服务器端)可以进行一些计算,并通过线路发送没有markerdetails的集群标记,指示存在ie。该群集中有1532个标记。顺便说一句。 bounds_changed比zoom_changed更好,因为它在移动地图时获得。 – Jakob 2011-01-27 11:42:58