Don't rely on goog.functions in vector-layer example

This commit is contained in:
Tom Payne
2013-11-12 17:15:34 +01:00
parent 77b7abb96a
commit fc2fece872

View File

@@ -1,6 +1,4 @@
// NOCOMPILE // NOCOMPILE
// FIXME don't rely on goog.* functions
goog.require('goog.functions');
goog.require('ol.Map'); goog.require('ol.Map');
goog.require('ol.RendererHint'); goog.require('ol.RendererHint');
goog.require('ol.View2D'); goog.require('ol.View2D');
@@ -26,6 +24,15 @@ var map = new ol.Map({
}); });
var vectorSource = new ol.source.Vector(); var vectorSource = new ol.source.Vector();
var style = {
fill: {
color: 'rgba(255, 255, 255, 0.6)'
},
stroke: {
color: '#319FD3',
width: 1
}
};
$.get('data/countries.geojson', function(data) { $.get('data/countries.geojson', function(data) {
var format = new ol.format.GeoJSON(); var format = new ol.format.GeoJSON();
@@ -38,14 +45,9 @@ $.get('data/countries.geojson', function(data) {
}); });
map.getLayers().push(new ol.layer.Vector({ map.getLayers().push(new ol.layer.Vector({
source: vectorSource, source: vectorSource,
styleFunction: goog.functions.constant({ styleFunction: function(feature) {
fill: { return style;
color: 'rgba(255, 255, 255, 0.6)' }
},
stroke: {
color: '#319FD3'
}
})
})); }));
}); });