Tidy up new box code.
authorTom Hughes <tom@compton.nu>
Wed, 8 Apr 2009 23:14:50 +0000 (23:14 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 8 Apr 2009 23:14:50 +0000 (23:14 +0000)
public/javascripts/map.js

index a52cd0a7047dcd43006ae2bd68466b5d8e64affe..71edee56cdfda8431656c32b33bc91d64be66bf5 100644 (file)
@@ -118,16 +118,16 @@ function addMarkerToMap(position, icon, description) {
    return marker;
 }
 
-function addBoxToMap(boxbounds) {      
-   box = new OpenLayers.Feature.Vector(
-            boxbounds.toGeometry().transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()) );
+function addBoxToMap(boxbounds) {
+   var geometry = boxbounds.toGeometry().transform(epsg4326, map.getProjectionObject());
+   var box = new OpenLayers.Feature.Vector(geometry, {}, {
+      strokeWidth: 3,
+      strokeColor: '#0000ff',
+      fillOpacity: 0,
+   });
    
-   box.style = {
-         'strokeWidth': 3,
-         'strokeColor': '#0000ff',
-         'fillOpacity': 0,
-       };
    vectors.addFeatures(box);
+
    return box;
 }