1 $(document).ready(function () {
4 function highlightChangeset(id) {
5 var feature = vectors.getFeatureByFid(id);
6 var bounds = feature.geometry.getBounds();
8 if (bounds.containsBounds(map.getExtent())) {
9 bounds = map.getExtent().scale(1.1);
12 if (highlight) vectors.removeFeatures(highlight);
14 highlight = new OpenLayers.Feature.Vector(bounds.toGeometry(), {}, {
16 strokeColor: "#ee9900",
21 vectors.addFeatures(highlight);
23 $("#tr-changeset-" + id).addClass("selected");
26 function unHighlightChangeset(id) {
27 vectors.removeFeatures(highlight);
29 $("#tr-changeset-" + id).removeClass("selected");
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));
76 $("[data-changeset]").mouseover(function() {
77 highlightChangeset($(this).data("changeset").id);
80 $("[data-changeset]").mouseout(function() {
81 unHighlightChangeset($(this).data("changeset").id);