Clusterer=function(map) { this.map=map; this.markers=[]; this.clusters=[]; this.timeout=null; this.currentZoomLevel=map.getZoom(); this.maxVisibleMarkers=Clusterer.defaultMaxVisibleMarkers; this.gridSize=Clusterer.defaultGridSize; this.minMarkersPerCluster=Clusterer.defaultMinMarkersPerCluster; this.maxLinesPerInfoBox=Clusterer.defaultMaxLinesPerInfoBox; this.icon=Clusterer.defaultIcon; GEvent.addListener(map,'zoomend',Clusterer.MakeCaller(Clusterer.Display,this)); GEvent.addListener(map,'moveend',Clusterer.MakeCaller(Clusterer.Display,this)); GEvent.addListener(map,'infowindowclose',Clusterer.MakeCaller(Clusterer.PopDown,this));}; Clusterer.defaultMaxVisibleMarkers=80; Clusterer.defaultGridSize=5; Clusterer.defaultMinMarkersPerCluster=5; Clusterer.defaultMaxLinesPerInfoBox=5; Clusterer.defaultIcon=new GIcon(); Clusterer.defaultIcon.image='./img/blue.png'; Clusterer.defaultIcon.shadow='./img/shadow.png'; Clusterer.defaultIcon.iconSize=new GSize(30,30); Clusterer.defaultIcon.shadowSize=new GSize(47,30); Clusterer.defaultIcon.iconAnchor=new GPoint(15,25); Clusterer.defaultIcon.infoWindowAnchor=new GPoint(5,15); //Clusterer.defaultIcon.infoShadowAnchor=new GPoint(0,25); Clusterer.prototype.SetIcon=function(icon) {this.icon=icon;}; Clusterer.prototype.SetMaxVisibleMarkers=function(n){this.maxVisibleMarkers=n;}; Clusterer.prototype.SetMinMarkersPerCluster=function(n){this.minMarkersPerCluster=n;}; Clusterer.prototype.SetMaxLinesPerInfoBox=function(n){this.maxLinesPerInfoBox=n;}; Clusterer.prototype.AddMarker=function(marker,title,lien) {if(marker.setMap!=null) marker.setMap(this.map); marker.title=title; marker.lien=lien; marker.onMap=false; this.markers.push(marker); this.DisplayLater();}; Clusterer.prototype.RemoveMarker=function(marker) { for(var i=0;i2){ if(newZoomLevel!=clusterer.currentZoomLevel) { for(i=0;iclusterer.maxVisibleMarkers) {var latRange=bounds.getNorthEast().lat()-bounds.getSouthWest().lat(); var latInc=latRange/clusterer.gridSize; var lngInc=latInc/Math.cos((bounds.getNorthEast().lat()+bounds.getSouthWest().lat())/2.0*Math.PI/180.0); for(var lat=bounds.getSouthWest().lat(); lat<=bounds.getNorthEast().lat(); lat+=latInc) for(var lng=bounds.getSouthWest().lng(); lng<=bounds.getNorthEast().lng();lng+=lngInc) {cluster=new Object();cluster.clusterer=clusterer;cluster.bounds=new GLatLngBounds(new GLatLng(lat,lng),new GLatLng(lat+latInc,lng+lngInc));cluster.markers=[];cluster.markerCount=0;cluster.onMap=false;cluster.marker=null;clusterer.clusters.push(cluster);} for(i=0;i=0;--i) if(clusterer.clusters[i]!=null) break;else --clusterer.clusters.length; for(i=0;i14){ titre= marker.title + ' Plus'; } else{ titre=''+marker.title+''; } {++n;html+='';if(marker.getIcon().smallImage!=null) html+='';else html+='';html+='' + titre + '';if(n==clusterer.maxLinesPerInfoBox-1&&cluster.markerCount>clusterer.maxLinesPerInfoBox) {html+='...et '+(cluster.markerCount-n)+' de plus';break;}}} html+=''; clusterer.map.closeInfoWindow(); cluster.marker.openInfoWindowHtml(html); clusterer.poppedUpCluster=cluster; }; Clusterer.RePop=function(clusterer) { if(clusterer.poppedUpCluster!=null) Clusterer.PopUp(clusterer.poppedUpCluster); }; Clusterer.PopDown=function(clusterer) { clusterer.poppedUpCluster=null; }; Clusterer.prototype.ClearCluster=function(cluster) {var i,marker; for(i=0;i