3 function highlightChangeset(id) {
4 var feature = vectors.getFeatureByFid(id);
5 var bounds = feature.geometry.getBounds();
7 if (bounds.containsBounds(map.getExtent())) {
8 bounds = map.getExtent().scale(1.1);
11 if (highlight) vectors.removeFeatures(highlight);
13 highlight = new OpenLayers.Feature.Vector(bounds.toGeometry(), {}, {
15 strokeColor: "#ee9900",
20 vectors.addFeatures(highlight);
22 $("#tr-changeset-" + id).addClass("selected");
25 function unHighlightChangeset(id) {
26 vectors.removeFeatures(highlight);
28 $("#tr-changeset-" + id).removeClass("selected");
31 $(document).ready(function () {
32 var map = createMap("changeset_list_map", {
34 new OpenLayers.Control.Navigation(),
35 new OpenLayers.Control.Zoom(),
36 new OpenLayers.Control.SimplePanZoom()
40 var bounds = new OpenLayers.Bounds();
42 $("[data-changeset]").each(function () {
43 var changeset = $(this).data('changeset');
45 var bbox = new OpenLayers.Bounds(changeset.bbox.minlon, changeset.bbox.minlat, changeset.bbox.maxlon, changeset.bbox.maxlat);
49 addBoxToMap(bbox, changeset.id, true);
54 "featureselected": function(feature) {
55 highlightChangeset(feature.feature.fid);
57 "featureunselected": function(feature) {
58 unHighlightChangeset(feature.feature.fid);
62 var selectControl = new OpenLayers.Control.SelectFeature(vectors, {
66 map.addControl(selectControl);
67 selectControl.activate();
69 var params = OSM.mapParams();
71 map.zoomToExtent(proj(new OpenLayers.Bounds(params.minlon, params.minlat, params.maxlon, params.maxlat)));
73 map.zoomToExtent(proj(bounds));