¡Ayúdanos a traducir esta Web y consigue licencias gratis!
Usuario anónimo  |  Ingresar  |  Regístrate

MarkerClusterer

El MarkerClusterer forma parte del GMaps Utility Library.

Buenísima utilidad que elimina de un plumazo el problema de la lentitud al tener muchos iconos en el mismo mapa, además de hacerlo más usable al usuario.






Code.aspx
<cc1:GMap ID="GMap1" runat="server" />
Code.aspx.cs
GMap1.addGMapUI(new GMapUI());
GMap1.GZoom = 2;

GMap2.addGMapUI(new GMapUI());
GMap2.GZoom = 2;

List<GMarker> markers = new List<GMarker>();

Random r = new Random();
for (int i = 0; i < 200; i++)
{
markers.Add(new GMarker(new GLatLng(r.Next(0, 60), r.Next(-30, 30))));
GListener listener = new GListener(gMarker.ID, GListener.Event.click, string.Format(@"function () {{{0}.openInfoWindowHtml('<center>{1}</center>');}}", gMarker.ID, i));
GMap1.Add(listener);
}

GMap2.markerClusterer = new MarkerClusterer(markers);


MarkerClustererStyleOptions markerClustererStyleOptions = new MarkerClustererStyleOptions();
markerClustererStyleOptions.textColor = Color.Yellow;

MarkerClustererOptions markerClustererOptions = new MarkerClustererOptions(60, 10);


MarkerClustererStyleOptions styleOptionsA = new MarkerClustererStyleOptions();
styleOptionsA.height = 36;
styleOptionsA.width = 40;
styleOptionsA.anchor_x = 6;
styleOptionsA.anchor_y = 0;
styleOptionsA.textColor = Color.Blue;
styleOptionsA.url = "http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/images/conv40.png";

MarkerClustererStyleOptions styleOptionsB = new MarkerClustererStyleOptions();
styleOptionsB.height = 35;
styleOptionsB.width = 35;
styleOptionsB.anchor_x = 16;
styleOptionsB.anchor_y = 0;
styleOptionsB.textColor = Color.WhiteSmoke;
styleOptionsB.url = "http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/images/people35.png";




markerClustererOptions.markerClustererStylesOptions.Add(styleOptionsA);
markerClustererOptions.markerClustererStylesOptions.Add(styleOptionsB);


MarkerClusterer markerClusterer = new MarkerClusterer(markers, markerClustererOptions);

GMap1.markerClusterer = markerClusterer;
Powered by Subgurim.NET