]> git.openstreetmap.org Git - rails.git/blobdiff - public/javascripts/map.js
Update the rss feed logo, to use the new logo.
[rails.git] / public / javascripts / map.js
index 090d4abc258398ae227f8ff99b3a130de740f438..66ed9e909492ca0efc6c3950cf64f617aa5d5c0c 100644 (file)
@@ -149,7 +149,7 @@ function addObjectToMap(url, zoom, callback) {
    layer.loadGML();
 }
 
-function addBoxToMap(boxbounds) {
+function addBoxToMap(boxbounds, id, outline) {
    if (!vectors) {
      // Be aware that IE requires Vector layers be initialised on page load, and not under deferred script conditions
      vectors = new OpenLayers.Layer.Vector("Boxes", {
@@ -157,12 +157,20 @@ function addBoxToMap(boxbounds) {
      });
      map.addLayer(vectors);
    }
-   var geometry = boxbounds.toGeometry().transform(epsg4326, map.getProjectionObject());
+   var geometry;
+   if (outline) {
+     vertices = boxbounds.toGeometry().getVertices();
+     vertices.push(new OpenLayers.Geometry.Point(vertices[0].x, vertices[0].y));
+     geometry = new OpenLayers.Geometry.LineString(vertices).transform(epsg4326, map.getProjectionObject());
+   } else {
+     geometry = boxbounds.toGeometry().transform(epsg4326, map.getProjectionObject());
+   }
    var box = new OpenLayers.Feature.Vector(geometry, {}, {
       strokeWidth: 2,
       strokeColor: '#ee9900',
       fillOpacity: 0
    });
+   box.fid = id;
 
    vectors.addFeatures(box);