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 ( highlight ) vectors.removeFeatures(highlight);
19 highlight = new OpenLayers.Feature.Vector(bounds.toGeometry(), {}, {
21 strokeColor: "#ee9900",
26 vectors.addFeatures(highlight);
28 $("tr-changeset-" + id).addClassName("selected");
31 function unHighlightChangeset(id) {
32 vectors.removeFeatures(highlight);
34 $("tr-changeset-" + id).removeClassName("selected");
38 var map = createMap("changeset_list_map", {
40 new OpenLayers.Control.Navigation(),
41 new OpenLayers.Control.PanZoom(),
42 new OpenLayers.Control.PanZoomBar()
46 var bounds = new OpenLayers.Bounds();
48 <% @edits.each do |edit| %>
49 var minlon = <%= edit.min_lon / GeoRecord::SCALE.to_f %>;
50 var minlat = <%= edit.min_lat / GeoRecord::SCALE.to_f %>;
51 var maxlon = <%= edit.max_lon / GeoRecord::SCALE.to_f %>;
52 var maxlat = <%= edit.max_lat / GeoRecord::SCALE.to_f %>;
53 var bbox = new OpenLayers.Bounds(minlon, minlat, maxlon, maxlat);
56 box = addBoxToMap(bbox, "<%= edit.id %>", true);
60 "featureselected": function(feature) {
61 highlightChangeset(feature.feature.fid);
63 "featureunselected": function(feature) {
64 unHighlightChangeset(feature.feature.fid);
68 var selectControl = new OpenLayers.Control.SelectFeature(vectors, {
72 map.addControl(selectControl);
73 selectControl.activate();
76 setMapExtent(new OpenLayers.Bounds(<%= @bbox %>));
82 Event.observe(window, "load", init);