|
Veronica |
Visualizzazione ingrandita della mappa |
/** * Create the markers, with infowindow. * Create sidebar categories and entries. */ var bounds = new GLatLngBounds(); GMap2.prototype.populate = function(points, options){ var opts = options||{}; var noCat = true; if(opts.cat||opts.iCat) noCat = false; var catName = opts.cat||""; var bar = opts.sidebar; var myCat; var newCats = []; for (var i=0; i < points.length; i++) { if(opts.iCat){ // category from file contents catName = points[i].textArray[opts.iCat]; } var theIcon = opts.icon||CAT_ICONS[catName]||CAT_ICONS["DEFAULT_ICON"]; if(!bar.cats[catName]&&!noCat){ // create a category if not found myCat = new BarCategory(bar, catName, {icon:theIcon}); newCats.push(myCat); } var iLabel = opts.iLabel||2; var label = points[i].textArray[iLabel]; points[i].marker = new GMarker(points[i],{title:label, icon:theIcon}); this.addOverlay(points[i].marker); bounds.extend(points[i]); // this must be considered createInfoWindow(points[i],opts); if(noCat){ bar.addEntry(points[i],opts); }else{ myCat.addEntry(points[i],opts); } } myCat.check.checked = opts.checked||false; myCat.update(); for(var i=0;i