Remove bundling magic for Mapbox styles script
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
/* eslint-disable openlayers-internal/no-unused-requires */
|
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.View');
|
goog.require('ol.View');
|
||||||
goog.require('ol.format.MVT');
|
goog.require('ol.format.MVT');
|
||||||
@@ -46,7 +45,7 @@ var map = new ol.Map({
|
|||||||
}),
|
}),
|
||||||
tileUrlFunction: tileUrlFunction
|
tileUrlFunction: tileUrlFunction
|
||||||
}),
|
}),
|
||||||
style: createMapboxStreetsV6Style()
|
style: createMapboxStreetsV6Style(ol.style.Style, ol.style.Fill, ol.style.Stroke, ol.style.Icon, ol.style.Text)
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
target: 'map',
|
target: 'map',
|
||||||
@@ -56,6 +55,3 @@ var map = new ol.Map({
|
|||||||
zoom: 2
|
zoom: 2
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
// ol.style.Fill, ol.style.Icon, ol.style.Stroke, ol.style.Style and
|
|
||||||
// ol.style.Text are required for createMapboxStreetsV6Style()
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* eslint-disable openlayers-internal/no-unused-requires */
|
|
||||||
|
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
goog.require('ol.View');
|
goog.require('ol.View');
|
||||||
goog.require('ol.format.MVT');
|
goog.require('ol.format.MVT');
|
||||||
@@ -25,7 +23,7 @@ var map = new ol.Map({
|
|||||||
url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' +
|
url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' +
|
||||||
'{z}/{x}/{y}.vector.pbf?access_token=' + key
|
'{z}/{x}/{y}.vector.pbf?access_token=' + key
|
||||||
}),
|
}),
|
||||||
style: createMapboxStreetsV6Style()
|
style: createMapboxStreetsV6Style(ol.style.Style, ol.style.Fill, ol.style.Stroke, ol.style.Icon, ol.style.Text)
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
target: 'map',
|
target: 'map',
|
||||||
@@ -34,6 +32,3 @@ var map = new ol.Map({
|
|||||||
zoom: 2
|
zoom: 2
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
// ol.style.Fill, ol.style.Icon, ol.style.Stroke, ol.style.Style and
|
|
||||||
// ol.style.Text are required for createMapboxStreetsV6Style()
|
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
// Styles for the mapbox-streets-v6 vector tile data set. Loosely based on
|
// Styles for the mapbox-streets-v6 vector tile data set. Loosely based on
|
||||||
// http://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6.json
|
// http://a.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6.json
|
||||||
|
|
||||||
function createMapboxStreetsV6Style() {
|
function createMapboxStreetsV6Style(Style, Fill, Stroke, Icon, Text) {
|
||||||
var fill = new ol.style.Fill({color: ''});
|
var fill = new Fill({color: ''});
|
||||||
var stroke = new ol.style.Stroke({color: '', width: 1});
|
var stroke = new Stroke({color: '', width: 1});
|
||||||
var polygon = new ol.style.Style({fill: fill});
|
var polygon = new Style({fill: fill});
|
||||||
var strokedPolygon = new ol.style.Style({fill: fill, stroke: stroke});
|
var strokedPolygon = new Style({fill: fill, stroke: stroke});
|
||||||
var line = new ol.style.Style({stroke: stroke});
|
var line = new Style({stroke: stroke});
|
||||||
var text = new ol.style.Style({text: new ol.style.Text({
|
var text = new Style({text: new Text({
|
||||||
text: '', fill: fill, stroke: stroke
|
text: '', fill: fill, stroke: stroke
|
||||||
})});
|
})});
|
||||||
var iconCache = {};
|
var iconCache = {};
|
||||||
function getIcon(iconName) {
|
function getIcon(iconName) {
|
||||||
var icon = iconCache[iconName];
|
var icon = iconCache[iconName];
|
||||||
if (!icon) {
|
if (!icon) {
|
||||||
icon = new ol.style.Style({image: new ol.style.Icon({
|
icon = new Style({image: new Icon({
|
||||||
src: 'https://cdn.rawgit.com/mapbox/maki/master/icons/' + iconName + '-15.svg',
|
src: 'https://cdn.rawgit.com/mapbox/maki/master/icons/' + iconName + '-15.svg',
|
||||||
imgSize: [15, 15]
|
imgSize: [15, 15]
|
||||||
})});
|
})});
|
||||||
|
|||||||
@@ -13,7 +13,12 @@ common.getRendererFromQueryString = function(opt_default) {};
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param {function(new:ol.style.Style, olx.style.StyleOptions=)} Style Style constructor.
|
||||||
|
* @param {function(new:ol.style.Fill, olx.style.FillOptions=)} Fill Fill constructor.
|
||||||
|
* @param {function(new:ol.style.Stroke, olx.style.StrokeOptions=)} Stroke Stroke constructor.
|
||||||
|
* @param {function(new:ol.style.Icon, olx.style.IconOptions=)} Icon Icon constructor.
|
||||||
|
* @param {function(new:ol.style.Text, olx.style.TextOptions=)} Text Text constructor.
|
||||||
* @return {function((ol.Feature|ol.render.Feature), number):
|
* @return {function((ol.Feature|ol.render.Feature), number):
|
||||||
* Array.<ol.style.Style>}
|
* Array.<ol.style.Style>}
|
||||||
*/
|
*/
|
||||||
var createMapboxStreetsV6Style = function() {};
|
var createMapboxStreetsV6Style = function(Style, Fill, Stroke, Icon, Text) {};
|
||||||
|
|||||||
Reference in New Issue
Block a user