~shikharkohli/sahana-eden/gsoc1

« back to all changes in this revision

Viewing changes to views/gis/ol_layers_gpx.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
 
{{for layer in gpx_layers:}}
2
 
  {{name = re.sub('\W', '_', layer)}}
3
 
    iconURL = "{{=URL(r=request, c='default', f='download', args=gpx_layers[layer].marker)}}";
4
 
    icon_img.src = iconURL;
5
 
    width = icon_img.width;
6
 
    height = icon_img.height;
7
 
    if(width > max_w){
8
 
        height = ((max_w / width) * height);
9
 
        width = max_w;
10
 
    }
11
 
    if(height > max_h){
12
 
        width = ((max_h / height) * width);
13
 
        height = max_h;
14
 
    }
15
 
    style_marker.graphicWidth = width;
16
 
    style_marker.graphicHeight = height;
17
 
    style_marker.graphicXOffset = -(width / 2);
18
 
    style_marker.graphicYOffset = -height;
19
 
    style_marker.externalGraphic = iconURL;
20
 
    var gpxLayer{{=name}} = new OpenLayers.Layer.GML( "{{=layer}}", "{{=URL(r=request, c='default', f='download', args=gpx_layers[layer].url)}}", {
21
 
        format: OpenLayers.Format.GPX, style: style_marker, projection: proj4326});
22
 
    {{if gpx_layers[layer].visibility:}}
23
 
      gpxLayer{{=name}}.setVisibility(true);
24
 
    {{else:}}
25
 
      gpxLayer{{=name}}.setVisibility(false);
26
 
    {{pass}}
27
 
    map.addLayer(gpxLayer{{=name}});
28
 
{{pass}}