1 <div id="changeset_list_map">
4 <script type="text/javascript">
7 function highlightChangeset(id) {
8 var feature = vectors.getFeatureByFid(id);
9 var bounds = feature.geometry.getBounds();
11 if (bounds.containsBounds(map.getExtent())) {
12 bounds = map.getExtent().scale(1.1);
15 if (highlight) vectors.removeFeatures(highlight);
17 highlight = new OpenLayers.Feature.Vector(bounds.toGeometry(), {}, {
19 strokeColor: "#ee9900",
24 vectors.addFeatures(highlight);
26 $("#tr-changeset-" + id).addClass("selected");
29 function unHighlightChangeset(id) {
30 vectors.removeFeatures(highlight);
32 $("#tr-changeset-" + id).removeClass("selected");
35 $(document).ready(function () {
36 var map = createMap("changeset_list_map", {
38 new OpenLayers.Control.Navigation(),
39 new OpenLayers.Control.Zoom(),
40 new OpenLayers.Control.SimplePanZoom()
44 var bounds = new OpenLayers.Bounds();
46 $("[data-changeset]").each(function () {
47 var changeset = $(this).data('changeset');
49 var bbox = new OpenLayers.Bounds(changeset.bbox.minlon, changeset.bbox.minlat, changeset.bbox.maxlon, changeset.bbox.maxlat);
53 addBoxToMap(bbox, changeset.id, true);
58 "featureselected": function(feature) {
59 highlightChangeset(feature.feature.fid);
61 "featureunselected": function(feature) {
62 unHighlightChangeset(feature.feature.fid);
66 var selectControl = new OpenLayers.Control.SelectFeature(vectors, {
70 map.addControl(selectControl);
71 selectControl.activate();
73 var params = OSM.mapParams();
75 map.zoomToExtent(proj(new OpenLayers.Bounds(params.minlon, params.minlat, params.maxlon, params.maxlat)));
77 map.zoomToExtent(proj(bounds));