~shikharkohli/sahana-eden/gsoc1

« back to all changes in this revision

Viewing changes to views/gis/ol_layers_features_all.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
 
var proj_current = map.getProjectionObject();
2
 
 
3
 
// Layer to hold Draft Features
4
 
featuresLayer = new OpenLayers.Layer.Vector("Draft Features", {displayInLayerSwitcher: false});
5
 
map.addLayer(featuresLayer);
6
 
 
7
 
featuresLayer.events.register('featureadded', featuresLayer, function(){
8
 
   // ToDo: Support 2 Modes via if: else:
9
 
   // Add a point with popup (for use from map_viewing_client)
10
 
   shn_gis_map_create_feature;
11
 
   // Add a point without popup (for use from add_feature during module CRUD)
12
 
   //shn_gis_map_add_geometry;
13
 
});
14
 
 
15
 
// Show Busy cursor whilst loading Draft Features
16
 
map.registerEvents(featuresLayer);
17
 
 
18
 
// FeatureGroup Layers
19
 
var parser = new OpenLayers.Format.WKT();
20
 
var geom, popupContentHTML, iconURL;
21
 
var featuresLayers = new Array();
22
 
 
23
 
{{for feature_group in feature_groups:}}
24
 
{{fgname = feature_group.name.replace(' ', '_').replace(':', '_')}}
25
 
var featuresLayer{{=fgname}} = new OpenLayers.Layer.Vector("{{=fgname}}", {displayInLayerSwitcher: true});
26
 
map.addLayer(featuresLayer{{=fgname}});
27
 
featuresLayers.push(featuresLayer{{=fgname}});
28
 
featuresLayer{{=fgname}}.events.on({ "featureselected": onFeatureSelect, "featureunselected": onFeatureUnselect });
29
 
{{for feature in features[feature_group.id]:}}
30
 
  {{if feature.gis_location.id and feature.gis_location.wkt:}}
31
 
    geom = parser.read('{{=feature.gis_location.wkt}}').geometry;
32
 
    geom = geom.transform(proj4326, projection_current);
33
 
    popupContentHTML = "{{include 'gis/ol_features_popup.html'}}";
34
 
    iconURL = '{{=URL(r=request, c='default', f='download', args=[feature.marker])}}';
35
 
    add_Feature_with_popup(featuresLayer{{=fgname}}, '{{=feature.gis_location.uuid}}', geom, popupContentHTML, iconURL);
36
 
  {{else:}}
37
 
  {{pass}}
38
 
{{pass}}
39
 
{{pass}}
40
 
allLayers = allLayers.concat(featuresLayers);
 
 
b'\\ No newline at end of file'