Changeset 9596 for src/django_gheat/wlheatmap/templates/js/LayerBase.js
- Timestamp:
- Aug 28, 2011, 3:08:38 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/wlheatmap/templates/js/LayerBase.js
r9592 r9596 184 184 initialize: function(name, options) { 185 185 var url = get_balanced_urls('http://', {{ settings.DJANGO_CDN_DOMAINS|safe }}, 186 '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__organization__name =WirelessLeiden');186 '{{ settings.DJANGO_PREFIX }}/wlheatmap/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__organization__name__startswith=Wireless'); 187 187 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 188 188 var newArguments = [name, url, options]; … … 207 207 CLASS_NAME: "OpenLayers.Layer.Overlay" 208 208 }); 209 210 var foo; 211 212 // create the layer styleMap by giving the default style a context 213 var context = { 214 getSize: function(feature) { 215 var resolution = map.getResolution(); 216 var scale = map.getZoom(); 217 var base = 1; 218 if (scale > 16) { 219 base = 5; 220 } else if (scale > 14) { 221 base = 20; 222 } else { 223 base = 50; 224 } 225 return (base / map.getResolution()); 226 }, 227 getColor: function(feature) { 228 return feature.attributes.color; 229 230 } 231 }; 232 var template = { 233 pointRadius: "${getSize}", // using context.getSize(feature) 234 fillColor: "${getColor}", // using context.getColor(feature) 235 strokeWidth: 0.5, 236 }; 237 var nodesStyle = new OpenLayers.Style(template, {context: context}); 238 239 OpenLayers.Layer.GML.NodesOverlay = OpenLayers.Class(OpenLayers.Layer.GML, { 240 initialize: function(name, options) { 241 var url = "{% url wlheatmap.feature.nodes_json %}"; 242 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options); 243 var newArguments = [name, url, options]; 244 OpenLayers.Layer.GML.prototype.initialize.apply(this, newArguments); 245 }, 246 colour: '0,255,0', 247 projection: new OpenLayers.Projection("EPSG:4326"), 248 styleMap: new OpenLayers.StyleMap(nodesStyle), 249 format: OpenLayers.Format.GeoJSON, 250 CLASS_NAME: "OpenLayers.Layer.Overlay" 251 }); 252
Note:
See TracChangeset
for help on using the changeset viewer.