Changeset 1180

Show
Ignore:
Timestamp:
06/05/09 18:38:43 (3 years ago)
Author:
wyatt
Message:

Start at adding TriMet? map type for Portland region.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • TripPlanner/branches/rb-0.4/tripplanner/public/javascripts/gmap.js

    r1009 r1180  
    7676  createMap: function(container) { 
    7777    var map = new GMap2(container); 
     78    if (byCycle.UI.region_id === 'portlandor') { 
     79      map.addMapType(this.makeTriMetMapType()); 
     80    } 
    7881    map.setCenter(new GLatLng(0, 0), 7); 
    7982    map.addControl(new GLargeMapControl()); 
     
    180183    return this.map.getZoom(); 
    181184  }, 
    182    
     185 
    183186  setZoom: function(zoom) { 
    184187    this.map.setZoom(zoom); 
     
    201204    return line; 
    202205  }, 
    203    
    204   drawPolyLineFromEncodedPoints: function (points, levels, color, weight,  
     206 
     207  drawPolyLineFromEncodedPoints: function (points, levels, color, weight, 
    205208                                           opacity) { 
    206209    var line = new GPolyline.fromEncoded({ 
     
    214217    }); 
    215218    this.map.addOverlay(line); 
    216     return line;   
     219    return line; 
    217220  }, 
    218221 
     
    384387    }; 
    385388    layer.isPng = function() { return true; }; 
    386     layer.getOpacity = function() { return .625; }; 
    387      
     389    layer.getOpacity = function() { return 0.625; }; 
     390 
    388391    return new GTileLayerOverlay(layer); 
     392  }, 
     393 
     394  makeTriMetMapType: function () { 
     395    var projection = new GMercatorProjection(10); 
     396    var copyrights = new GCopyrightCollection('&copy; <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; 
    389408  } 
    390409});