File indexing completed on 2026-04-09 07:58:27
0001 GMaps.prototype.getFromFusionTables = function(options) {
0002 var events = options.events;
0003
0004 delete options.events;
0005
0006 var fusion_tables_options = options,
0007 layer = new google.maps.FusionTablesLayer(fusion_tables_options);
0008
0009 for (var ev in events) {
0010 (function(object, name) {
0011 google.maps.event.addListener(object, name, function(e) {
0012 events[name].apply(this, [e]);
0013 });
0014 })(layer, ev);
0015 }
0016
0017 this.layers.push(layer);
0018
0019 return layer;
0020 };
0021
0022 GMaps.prototype.loadFromFusionTables = function(options) {
0023 var layer = this.getFromFusionTables(options);
0024 layer.setMap(this.map);
0025
0026 return layer;
0027 };
0028
0029 GMaps.prototype.getFromKML = function(options) {
0030 var url = options.url,
0031 events = options.events;
0032
0033 delete options.url;
0034 delete options.events;
0035
0036 var kml_options = options,
0037 layer = new google.maps.KmlLayer(url, kml_options);
0038
0039 for (var ev in events) {
0040 (function(object, name) {
0041 google.maps.event.addListener(object, name, function(e) {
0042 events[name].apply(this, [e]);
0043 });
0044 })(layer, ev);
0045 }
0046
0047 this.layers.push(layer);
0048
0049 return layer;
0050 };
0051
0052 GMaps.prototype.loadFromKML = function(options) {
0053 var layer = this.getFromKML(options);
0054 layer.setMap(this.map);
0055
0056 return layer;
0057 };
0058
0059 GMaps.prototype.addLayer = function(layerName, options) {
0060
0061 options = options || {};
0062 var layer;
0063
0064 switch(layerName) {
0065 case 'weather': this.singleLayers.weather = layer = new google.maps.weather.WeatherLayer();
0066 break;
0067 case 'clouds': this.singleLayers.clouds = layer = new google.maps.weather.CloudLayer();
0068 break;
0069 case 'traffic': this.singleLayers.traffic = layer = new google.maps.TrafficLayer();
0070 break;
0071 case 'transit': this.singleLayers.transit = layer = new google.maps.TransitLayer();
0072 break;
0073 case 'bicycling': this.singleLayers.bicycling = layer = new google.maps.BicyclingLayer();
0074 break;
0075 case 'panoramio':
0076 this.singleLayers.panoramio = layer = new google.maps.panoramio.PanoramioLayer();
0077 layer.setTag(options.filter);
0078 delete options.filter;
0079
0080
0081 if (options.click) {
0082 google.maps.event.addListener(layer, 'click', function(event) {
0083 options.click(event);
0084 delete options.click;
0085 });
0086 }
0087 break;
0088 case 'places':
0089 this.singleLayers.places = layer = new google.maps.places.PlacesService(this.map);
0090
0091
0092 if (options.search || options.nearbySearch || options.radarSearch) {
0093 var placeSearchRequest = {
0094 bounds : options.bounds || null,
0095 keyword : options.keyword || null,
0096 location : options.location || null,
0097 name : options.name || null,
0098 radius : options.radius || null,
0099 rankBy : options.rankBy || null,
0100 types : options.types || null
0101 };
0102
0103 if (options.radarSearch) {
0104 layer.radarSearch(placeSearchRequest, options.radarSearch);
0105 }
0106
0107 if (options.search) {
0108 layer.search(placeSearchRequest, options.search);
0109 }
0110
0111 if (options.nearbySearch) {
0112 layer.nearbySearch(placeSearchRequest, options.nearbySearch);
0113 }
0114 }
0115
0116
0117 if (options.textSearch) {
0118 var textSearchRequest = {
0119 bounds : options.bounds || null,
0120 location : options.location || null,
0121 query : options.query || null,
0122 radius : options.radius || null
0123 };
0124
0125 layer.textSearch(textSearchRequest, options.textSearch);
0126 }
0127 break;
0128 }
0129
0130 if (layer !== undefined) {
0131 if (typeof layer.setOptions == 'function') {
0132 layer.setOptions(options);
0133 }
0134 if (typeof layer.setMap == 'function') {
0135 layer.setMap(this.map);
0136 }
0137
0138 return layer;
0139 }
0140 };
0141
0142 GMaps.prototype.removeLayer = function(layer) {
0143 if (typeof(layer) == "string" && this.singleLayers[layer] !== undefined) {
0144 this.singleLayers[layer].setMap(null);
0145
0146 delete this.singleLayers[layer];
0147 }
0148 else {
0149 for (var i = 0; i < this.layers.length; i++) {
0150 if (this.layers[i] === layer) {
0151 this.layers[i].setMap(null);
0152 this.layers.splice(i, 1);
0153
0154 break;
0155 }
0156 }
0157 }
0158 };