- /*
- This function borrowed from the latest version of OpenLayers.Layer.Vector. OSM is using an older version.
- http://trac.osgeo.org/openlayers/browser/trunk/openlayers/lib/OpenLayers/Layer/Vector.js
- */
- function getFeaturesByAttribute(obj, attrName, attrValue) {
- var i,
- feature,
- len = obj.features.length,
- foundFeatures = [];
- for(i = 0; i < len; i++) {
- feature = obj.features[i];
- if(feature && feature.attributes) {
- if (feature.attributes[attrName] === attrValue) {
- foundFeatures.push(feature);
- }
- }
- }
- return foundFeatures;
+ var highlight;
+
+ function highlightChangeset(id) {
+ var feature = vectors.getFeatureByFid(id);
+ var bounds = feature.geometry.getBounds();
+
+ if (bounds.containsBounds(map.getExtent())) {
+ bounds = map.getExtent().scale(1.1);
+ }
+
+ if (highlight) vectors.removeFeatures(highlight);
+
+ highlight = new OpenLayers.Feature.Vector(bounds.toGeometry(), {}, {
+ strokeWidth: 2,
+ strokeColor: "#ee9900",
+ fillColor: "#ffff55",
+ fillOpacity: 0.5
+ });
+
+ vectors.addFeatures(highlight);
+
+ $("tr-changeset-" + id).addClassName("selected");
+ }
+
+ function unHighlightChangeset(id) {
+ vectors.removeFeatures(highlight);
+
+ $("tr-changeset-" + id).removeClassName("selected");