From 81c55de7598ff15f56de6341727ed46f7f9eed18 Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Wed, 29 Jun 2011 22:39:50 +0100 Subject: Move to Vector layer rather than Markers, to be able to use the Strategy/Protocol features. --- web/js/map-OpenLayers.js | 84 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 15 deletions(-) (limited to 'web/js/map-OpenLayers.js') diff --git a/web/js/map-OpenLayers.js b/web/js/map-OpenLayers.js index e4de17764..fb11b89fa 100644 --- a/web/js/map-OpenLayers.js +++ b/web/js/map-OpenLayers.js @@ -41,30 +41,55 @@ YAHOO.util.Event.onContentReady('map', function() { return false; }); - fixmystreet.markers = new OpenLayers.Layer.Markers("Markers"); + var pin_layer_options = { + styleMap: new OpenLayers.StyleMap({ + 'default': new OpenLayers.Style({ + externalGraphic: "/i/pin${type}.gif", + graphicWidth: 32, + graphicHeight: 59, + graphicOpacity: 1, + graphicXOffset: -1, + graphicYOffset: -59 + }) + }) + }; + if (fixmystreet.page == 'around') { + //pin_layer_options.strategies = [ new OpenLayers.Strategy.BBOX() ]; + //pin_layer_options.protocol = new OpenLayers.Protocol.HTTP({ + // url: '/rss', + // params: fixmystreet.all_pins ? { all_pins: 1 } : { }, + // format: OpenLayers.Format.GeoRSS + //}); + } + fixmystreet.markers = new OpenLayers.Layer.Vector("Pins", pin_layer_options); + var cols = { 'red':'R', 'green':'G', 'blue':'B', 'purple':'P' }; + var markers = []; for (var i=0; i