X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=www%2Fplugins%2Fgis%2Flib%2Fleaflet%2Fplugins%2FKML.js;fp=www%2Fplugins%2Fgis%2Flib%2Fleaflet%2Fplugins%2FKML.js;h=096c1c3341e68f662bde30f0685f954264a5d326;hb=c0f18416f529232b5555c6410a8765a5125ebcd3;hp=acdc4e8f3db8c8cb77c3a9e2026f8f5a9328c19e;hpb=50522c53acc9e61a4a7de3a1890c4ba93e2f61b4;p=lhc%2Fweb%2Fwww.git diff --git a/www/plugins/gis/lib/leaflet/plugins/KML.js b/www/plugins/gis/lib/leaflet/plugins/KML.js index acdc4e8f..096c1c33 100755 --- a/www/plugins/gis/lib/leaflet/plugins/KML.js +++ b/www/plugins/gis/lib/leaflet/plugins/KML.js @@ -3,7 +3,7 @@ L.KML = L.FeatureGroup.extend({ async: true }, - initialize: function(kml, options) { + initialize: function (kml, options) { L.Util.setOptions(this, options); this._kml = kml; this._layers = {}; @@ -13,7 +13,7 @@ L.KML = L.FeatureGroup.extend({ } }, - loadXML: function(url, cb, options, async) { + loadXML: function (url, cb, options, async) { if (async === undefined) async = this.options.async; if (options === undefined) options = this.options; @@ -36,6 +36,7 @@ L.KML = L.FeatureGroup.extend({ setTimeout(function () { xdr.send(); }, 0); } else { req.open('GET', url, async); + req.setRequestHeader('Accept', 'application/vnd.google-earth.kml+xml'); try { req.overrideMimeType('text/xml'); // unsupported by IE } catch (e) { } @@ -47,13 +48,13 @@ L.KML = L.FeatureGroup.extend({ } }, - addKML: function(url, options, async) { + addKML: function (url, options, async) { var _this = this; - var cb = function(gpx, options) { _this._addKML(gpx, options); }; + var cb = function (kml) { _this._addKML(kml); }; this.loadXML(url, cb, options, async); }, - _addKML: function(xml, options) { + _addKML: function (xml) { var layers = L.KML.parseKML(xml); if (!layers || !layers.length) return; for (var i = 0; i < layers.length; i++) { @@ -106,7 +107,7 @@ L.Util.extend(L.KML, { return !e || e === folder; }, - parseStyles: function(xml) { + parseStyles: function (xml) { var styles = {}; var sl = xml.getElementsByTagName('Style'); for (var i=0, len=sl.length; i' + name + '' + descr); }); } @@ -399,7 +400,7 @@ L.Util.extend(L.KML, { ] ); var attributes = {Icon: true, href: true, color: true}; - function _parse(xml) { + function _parse (xml) { var options = {}, ioptions = {}; for (var i = 0; i < xml.childNodes.length; i++) { var e = xml.childNodes[i]; @@ -469,7 +470,7 @@ L.RotatedImageOverlay = L.ImageOverlay.extend({ if (L.DomUtil.TRANSFORM) { // use the CSS transform rule if available this._image.style[L.DomUtil.TRANSFORM] += ' rotate(' + this.options.angle + 'deg)'; - } else if(L.Browser.ie) { + } else if (L.Browser.ie) { // fallback for IE6, IE7, IE8 var rad = this.options.angle * (Math.PI / 180), costheta = Math.cos(rad), @@ -478,7 +479,7 @@ L.RotatedImageOverlay = L.ImageOverlay.extend({ costheta + ', M12=' + (-sintheta) + ', M21=' + sintheta + ', M22=' + costheta + ')'; } }, - getBounds: function() { + getBounds: function () { return this._bounds; } });