Changeset 1180
- Timestamp:
- 06/05/09 18:38:43 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
TripPlanner/branches/rb-0.4/tripplanner/public/javascripts/gmap.js
r1009 r1180 76 76 createMap: function(container) { 77 77 var map = new GMap2(container); 78 if (byCycle.UI.region_id === 'portlandor') { 79 map.addMapType(this.makeTriMetMapType()); 80 } 78 81 map.setCenter(new GLatLng(0, 0), 7); 79 82 map.addControl(new GLargeMapControl()); … … 180 183 return this.map.getZoom(); 181 184 }, 182 185 183 186 setZoom: function(zoom) { 184 187 this.map.setZoom(zoom); … … 201 204 return line; 202 205 }, 203 204 drawPolyLineFromEncodedPoints: function (points, levels, color, weight, 206 207 drawPolyLineFromEncodedPoints: function (points, levels, color, weight, 205 208 opacity) { 206 209 var line = new GPolyline.fromEncoded({ … … 214 217 }); 215 218 this.map.addOverlay(line); 216 return line; 219 return line; 217 220 }, 218 221 … … 384 387 }; 385 388 layer.isPng = function() { return true; }; 386 layer.getOpacity = function() { return .625; };387 389 layer.getOpacity = function() { return 0.625; }; 390 388 391 return new GTileLayerOverlay(layer); 392 }, 393 394 makeTriMetMapType: function () { 395 var projection = new GMercatorProjection(10); 396 var copyrights = new GCopyrightCollection('© <a href="http://trimet.org/">TriMet</a>'); 397 var wms_url = 'http://tilec.trimet.org/tilecache/tilecache.py?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=currentOSPN&FORMAT=image/pngSRS=EPSG:2913&WIDTH=256&HEIGHT=256'; 398 var layer = new GTileLayer(copyrights, 0, 9); 399 layer.isPng = function() { return true; }; 400 layer.getOpacity = function() { return 1.0; }; 401 layer.getTileUrl = function(tile, zoom) { 402 var bbox = [7628293, 660879, 7632389, 664975].join(','); 403 var tile_url = [wms_url, "&BBOX=", bbox].join(''); 404 return tile_url; 405 }; 406 var trimet_map_type = new GMapType(layer, projection, 'TriMet'); 407 return trimet_map_type; 389 408 } 390 409 });