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 %>");
13 function highlightChangeset(id) {
14 var feature = vectors.getFeatureByFid(id);
15 var bounds = feature.geometry.getBounds();
17 if (bounds.containsBounds(map.getExtent())) {
18 bounds = map.getExtent().scale(1.1);
21 if (highlight) vectors.removeFeatures(highlight);
23 highlight = new OpenLayers.Feature.Vector(bounds.toGeometry(), {}, {
25 strokeColor: "#ee9900",
30 vectors.addFeatures(highlight);
32 $("tr-changeset-" + id).addClassName("selected");
35 function unHighlightChangeset(id) {
36 vectors.removeFeatures(highlight);
38 $("tr-changeset-" + id).removeClassName("selected");
42 var map = createMap("changeset_list_map", {
44 new OpenLayers.Control.Navigation(),
45 new OpenLayers.Control.PanZoom(),
46 new OpenLayers.Control.PanZoomBar()
50 var bounds = new OpenLayers.Bounds();
52 <% @edits.each do |edit| %>
53 <% if edit.has_valid_bbox? %>
54 <% bbox = edit.bbox.to_unscaled %>
55 var minlon = <%= bbox.min_lon %>;
56 var minlat = <%= bbox.min_lat %>;
57 var maxlon = <%= bbox.max_lon %>;
58 var maxlat = <%= bbox.max_lat %>;
59 var bbox = new OpenLayers.Bounds(minlon, minlat, maxlon, maxlat);
63 addBoxToMap(bbox, "<%= edit.id %>", true);
68 "featureselected": function(feature) {
69 highlightChangeset(feature.feature.fid);
71 "featureunselected": function(feature) {
72 unHighlightChangeset(feature.feature.fid);
76 var selectControl = new OpenLayers.Control.SelectFeature(vectors, {
80 map.addControl(selectControl);
81 selectControl.activate();
84 setMapExtent(new OpenLayers.Bounds(<%= @bbox %>));
90 Event.observe(window, "load", init);