X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/48929e8781f9c136a142400a7a2ef1cf994f74fd..bb2c0c76ae8b85621c71d2d26e019a1871b39d50:/public/javascripts/map.js diff --git a/public/javascripts/map.js b/public/javascripts/map.js index df9d30992..66ed9e909 100644 --- a/public/javascripts/map.js +++ b/public/javascripts/map.js @@ -149,7 +149,7 @@ function addObjectToMap(url, zoom, callback) { layer.loadGML(); } -function addBoxToMap(boxbounds, attributes, line) { +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,20 +157,20 @@ function addBoxToMap(boxbounds, attributes, line) { }); map.addLayer(vectors); } - var geometry; - if (line) { + if (outline) { vertices = boxbounds.toGeometry().getVertices(); - vertices.push( new OpenLayers.Geometry.Point( vertices[0].x, vertices[0].y ) ); + 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, attributes, { + } + var box = new OpenLayers.Feature.Vector(geometry, {}, { strokeWidth: 2, strokeColor: '#ee9900', fillOpacity: 0 }); + box.fid = id; vectors.addFeatures(box);