update changelog
This commit is contained in:
parent
92c704f33b
commit
bcc2c6f67f
66
dist/leaflet-src.js
vendored
66
dist/leaflet-src.js
vendored
@ -2508,7 +2508,12 @@ L.Icon = L.Class.extend({
|
|||||||
_createIcon: function (name) {
|
_createIcon: function (name) {
|
||||||
var src = this._getIconUrl(name);
|
var src = this._getIconUrl(name);
|
||||||
|
|
||||||
if (!src) { return null; }
|
if (!src) {
|
||||||
|
if (name === 'icon') {
|
||||||
|
throw new Error("iconUrl not set in Icon options (see the docs).");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
var img = this._createImg(src);
|
var img = this._createImg(src);
|
||||||
this._setIconStyles(img, name);
|
this._setIconStyles(img, name);
|
||||||
@ -2578,7 +2583,14 @@ L.Icon.Default = L.Icon.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_getIconUrl: function (name) {
|
_getIconUrl: function (name) {
|
||||||
|
var key = name + 'Url';
|
||||||
|
|
||||||
|
if (this.options[key]) {
|
||||||
|
return this.options[key];
|
||||||
|
}
|
||||||
|
|
||||||
var path = L.Icon.Default.imagePath;
|
var path = L.Icon.Default.imagePath;
|
||||||
|
|
||||||
if (!path) {
|
if (!path) {
|
||||||
throw new Error("Couldn't autodetect L.Icon.Default.imagePath, set it manually.");
|
throw new Error("Couldn't autodetect L.Icon.Default.imagePath, set it manually.");
|
||||||
}
|
}
|
||||||
@ -4700,57 +4712,64 @@ L.GeoJSON = L.FeatureGroup.extend({
|
|||||||
initialize: function (geojson, options) {
|
initialize: function (geojson, options) {
|
||||||
L.Util.setOptions(this, options);
|
L.Util.setOptions(this, options);
|
||||||
|
|
||||||
this._geojson = geojson;
|
|
||||||
this._layers = {};
|
this._layers = {};
|
||||||
|
|
||||||
if (geojson) {
|
if (geojson) {
|
||||||
this.addGeoJSON(geojson);
|
this.addData(geojson);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addGeoJSON: function (geojson) {
|
addData: function (geojson) {
|
||||||
var features = geojson.features,
|
var features = geojson.features,
|
||||||
i, len;
|
i, len;
|
||||||
|
|
||||||
if (features) {
|
if (features) {
|
||||||
for (i = 0, len = features.length; i < len; i++) {
|
for (i = 0, len = features.length; i < len; i++) {
|
||||||
this.addGeoJSON(features[i]);
|
this.addData(features[i]);
|
||||||
}
|
}
|
||||||
return;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
var isFeature = (geojson.type === 'Feature'),
|
var options = this.options,
|
||||||
geometry = isFeature ? geojson.geometry : geojson,
|
style = options.style;
|
||||||
layer = L.GeoJSON.geometryToLayer(geometry, this.options.pointToLayer);
|
|
||||||
|
|
||||||
this.fire('featureparse', {
|
if (options.filter && !options.filter(geojson)) { return; }
|
||||||
layer: layer,
|
|
||||||
properties: geojson.properties,
|
|
||||||
geometryType: geometry.type,
|
|
||||||
bbox: geojson.bbox,
|
|
||||||
id: geojson.id,
|
|
||||||
geometry: geojson.geometry
|
|
||||||
});
|
|
||||||
|
|
||||||
this.addLayer(layer);
|
var layer = L.GeoJSON.geometryToLayer(geojson, options.pointToLayer);
|
||||||
|
|
||||||
|
if (style) {
|
||||||
|
if (typeof style === 'function') {
|
||||||
|
style = style(geojson);
|
||||||
|
}
|
||||||
|
if (layer.setStyle) {
|
||||||
|
layer.setStyle(style);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.onEachFeature) {
|
||||||
|
options.onEachFeature(geojson, layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.addLayer(layer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
L.Util.extend(L.GeoJSON, {
|
L.Util.extend(L.GeoJSON, {
|
||||||
geometryToLayer: function (geometry, pointToLayer) {
|
geometryToLayer: function (geojson, pointToLayer) {
|
||||||
var coords = geometry.coordinates,
|
var geometry = geojson.type === 'Feature' ? geojson.geometry : geojson,
|
||||||
|
coords = geometry.coordinates,
|
||||||
layers = [],
|
layers = [],
|
||||||
latlng, latlngs, i, len, layer;
|
latlng, latlngs, i, len, layer;
|
||||||
|
|
||||||
switch (geometry.type) {
|
switch (geometry.type) {
|
||||||
case 'Point':
|
case 'Point':
|
||||||
latlng = this.coordsToLatLng(coords);
|
latlng = this.coordsToLatLng(coords);
|
||||||
return pointToLayer ? pointToLayer(latlng) : new L.Marker(latlng);
|
return pointToLayer ? pointToLayer(geojson, latlng) : new L.Marker(latlng);
|
||||||
|
|
||||||
case 'MultiPoint':
|
case 'MultiPoint':
|
||||||
for (i = 0, len = coords.length; i < len; i++) {
|
for (i = 0, len = coords.length; i < len; i++) {
|
||||||
latlng = this.coordsToLatLng(coords[i]);
|
latlng = this.coordsToLatLng(coords[i]);
|
||||||
layer = pointToLayer ? pointToLayer(latlng) : new L.Marker(latlng);
|
layer = pointToLayer ? pointToLayer(geojson, latlng) : new L.Marker(latlng);
|
||||||
layers.push(layer);
|
layers.push(layer);
|
||||||
}
|
}
|
||||||
return new L.FeatureGroup(layers);
|
return new L.FeatureGroup(layers);
|
||||||
@ -4799,6 +4818,7 @@ L.Util.extend(L.GeoJSON, {
|
|||||||
latlng = levelsDeep ?
|
latlng = levelsDeep ?
|
||||||
this.coordsToLatLngs(coords[i], levelsDeep - 1, reverse) :
|
this.coordsToLatLngs(coords[i], levelsDeep - 1, reverse) :
|
||||||
this.coordsToLatLng(coords[i], reverse);
|
this.coordsToLatLng(coords[i], reverse);
|
||||||
|
|
||||||
latlngs.push(latlng);
|
latlngs.push(latlng);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4807,7 +4827,7 @@ L.Util.extend(L.GeoJSON, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
L.geoJson = function (geojson, options) {
|
L.geoJson = function (geojson, options) {
|
||||||
return new L.GeoJson(geojson, options);
|
return new L.GeoJSON(geojson, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
2
dist/leaflet.js
vendored
2
dist/leaflet.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user