~shikharkohli/sahana-eden/gsoc1

« back to all changes in this revision

Viewing changes to views/gis/ol_start_vars.js

  • Committer: Shikhar Kohli
  • Date: 2010-08-11 18:40:09 UTC
  • mfrom: (802.1.156 eden)
  • Revision ID: shikharkohli@gmail.com-20100811184009-yy8zag5dowlam0ip
Merge trunk and update (a bit) of JS

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// make map available for easy debugging
2
 
var map;
3
 
var mapPanel, toolbar;
4
 
//var treeModel;
5
 
//var features = new Array();
6
 
var featuresLayer, currentFeature;
7
 
//var pointControl, lineControl, polygonControl;
8
 
//var selectControl, dragControl
9
 
var popupControl;
10
 
var allLayers = new Array();
11
 
 
12
 
OpenLayers.ImgPath = '/{{=request.application}}/static/img/gis/openlayers/';
13
 
// avoid pink tiles
14
 
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
15
 
OpenLayers.Util.onImageLoadErrorColor = "transparent";
16
 
 
17
 
// Set Proxy Host
18
 
OpenLayers.ProxyHost = '{{=URL(r=request, c='gis', f='proxy?url=')}}';
19
 
 
20
 
// See http://crschmidt.net/~crschmidt/spherical_mercator.html#reprojecting-points
21
 
var proj4326 = new OpenLayers.Projection('EPSG:4326');
22
 
var projection_current = new OpenLayers.Projection('EPSG:{{=projection}}');
23
 
 
24
 
{{if lat and lon:}}
25
 
  // Provided by URL (Bookmark) or from feature (display_feature()) or from config (map_viewing_client())
26
 
  var lat = {{=lat}};
27
 
  var lon = {{=lon}};
28
 
  var center = new OpenLayers.LonLat(lon, lat);
29
 
  center.transform(proj4326, projection_current);
30
 
{{else:}}
31
 
  // Calculate from Bounds (display_features())
32
 
  var bottom_left = new OpenLayers.LonLat({{=lon_min}}, {{=lat_min}});
33
 
  bottom_left.transform(proj4326, projection_current);
34
 
  var left = bottom_left.lon;
35
 
  var bottom = bottom_left.lat;
36
 
  top_right = new OpenLayers.LonLat({{=lon_max}}, {{=lat_max}});
37
 
  top_right.transform(proj4326, projection_current);
38
 
  var right = top_right.lon;
39
 
  var top = top_right.lat;
40
 
  var bounds = OpenLayers.Bounds.fromArray([left, bottom, right, top]);
41
 
  var center = bounds.getCenterLonLat();
42
 
{{pass}}
43
 
 
44
 
// Map Options
45
 
var options = {
46
 
    displayProjection: proj4326,
47
 
    projection: projection_current,
48
 
    units: "{{=units}}",
49
 
    maxResolution: {{=maxResolution}},
50
 
    maxExtent: new OpenLayers.Bounds({{=maxExtent}}),
51
 
    numZoomLevels: {{=numZoomLevels}}
52
 
};