1 <%= javascript_include_tag '/openlayers/OpenLayers.js' %>
2 <%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
3 <%= javascript_include_tag 'map.js' %>
5 <div id="changeset_list_map">
8 <script type="text/javascript">
9 OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
11 function highlightChangeset(id) {
12 var feature = vectors.getFeatureByFid(id);
13 feature.style.strokeColor = "#ffff55";
14 feature.style.strokeWidth = 4;
17 $("tr-changeset-" + id).addClassName("selected");
20 function unHighlightChangeset(id) {
21 var feature = vectors.getFeatureByFid(id);
22 feature.style.strokeColor = "#ee9900";
23 feature.style.strokeWidth = 2;
26 $("tr-changeset-" + id).removeClassName("selected");
30 var map = createMap("changeset_list_map", {
32 new OpenLayers.Control.Navigation(),
33 new OpenLayers.Control.PanZoom(),
34 new OpenLayers.Control.PanZoomBar()
38 var bounds = new OpenLayers.Bounds();
40 <% @edits.each do |edit| %>
41 var minlon = <%= edit.min_lon / GeoRecord::SCALE.to_f %>;
42 var minlat = <%= edit.min_lat / GeoRecord::SCALE.to_f %>;
43 var maxlon = <%= edit.max_lon / GeoRecord::SCALE.to_f %>;
44 var maxlat = <%= edit.max_lat / GeoRecord::SCALE.to_f %>;
45 var bbox = new OpenLayers.Bounds(minlon, minlat, maxlon, maxlat);
48 box = addBoxToMap(bbox, "<%= edit.id %>", true);
52 "featureselected": function(feature) {
53 highlightChangeset(feature.feature.fid);
55 "featureunselected": function(feature) {
56 unHighlightChangeset(feature.feature.fid);
60 var selectControl = new OpenLayers.Control.SelectFeature(vectors, {
64 map.addControl(selectControl);
65 selectControl.activate();
68 setMapExtent(new OpenLayers.Bounds(<%= @bbox %>));
74 Event.observe(window, "load", init);