From 568e40fc388b91f0363f24d85ac9734a36080d72 Mon Sep 17 00:00:00 2001 From: Adam Blok Date: Tue, 6 Oct 2020 15:22:10 +0200 Subject: [PATCH 1/2] XHR instance --- src/Request.js | 6 +++++- src/WFS.js | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Request.js b/src/Request.js index 926f998..7edd978 100644 --- a/src/Request.js +++ b/src/Request.js @@ -2,7 +2,7 @@ * Created by PRadostev on 02.02.2015. */ -L.Util.request = function (options) { +L.Util.request = function (options, xhrReferenceCallback) { options = L.extend({ async: true, method: 'POST', @@ -25,6 +25,10 @@ L.Util.request = function (options) { // good bye IE 6,7 var xhr = new XMLHttpRequest(); + if (xhrReferenceCallback) { + xhrReferenceCallback(xhr); + } + xhr.onreadystatechange = function () { if (xhr.readyState === 4) { if (xhr.status === 200) { diff --git a/src/WFS.js b/src/WFS.js index a61e21a..f76e9c5 100644 --- a/src/WFS.js +++ b/src/WFS.js @@ -35,6 +35,8 @@ L.WFS = L.FeatureGroup.extend({ state: {}, + xhr: null, + initialize: function (options, readFormat) { L.setOptions(this, options); @@ -191,6 +193,8 @@ L.WFS = L.FeatureGroup.extend({ return that; } + }, function(xhr) { + that.xhr = xhr; }); }, From 8102e6a85eb25431acdd09cb333622f46745ad05 Mon Sep 17 00:00:00 2001 From: Adam Blok Date: Fri, 9 Oct 2020 16:09:11 +0200 Subject: [PATCH 2/2] Added support of gml:MultiGeometry --- src/Format/Format.GML.js | 1 + src/Format/Parsers/Layers/LineString.js | 2 ++ src/Format/Parsers/Layers/MultiGeometry.js | 8 +++++++- src/WFS.js | 9 ++++++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Format/Format.GML.js b/src/Format/Format.GML.js index 8aa7dfa..6342227 100644 --- a/src/Format/Format.GML.js +++ b/src/Format/Format.GML.js @@ -23,6 +23,7 @@ L.Format.GML = L.Format.Base.extend({ this.appendParser(new L.GML.MultiCurve()); this.appendParser(new L.GML.MultiSurface()); this.appendParser(new L.GML.MultiPoint()); + this.appendParser(new L.GML.MultiGeometry()); }, /** diff --git a/src/Format/Parsers/Layers/LineString.js b/src/Format/Parsers/Layers/LineString.js index f2759b5..d7ef4a6 100644 --- a/src/Format/Parsers/Layers/LineString.js +++ b/src/Format/Parsers/Layers/LineString.js @@ -7,6 +7,8 @@ L.GML.LineString = L.GML.LineStringNode.extend({ + elementTag: 'gml:LineString', + includes: L.GML.CoordsToLatLngMixin, /** diff --git a/src/Format/Parsers/Layers/MultiGeometry.js b/src/Format/Parsers/Layers/MultiGeometry.js index e4b8581..1064685 100644 --- a/src/Format/Parsers/Layers/MultiGeometry.js +++ b/src/Format/Parsers/Layers/MultiGeometry.js @@ -32,10 +32,16 @@ */ L.GML.MultiGeometry = L.GML.Geometry.extend({ + + elementTag: 'gml:MultiGeometry', + includes: [L.GML.ParserContainerMixin, L.GML.CoordsToLatLngMixin], initialize: function () { this.initializeParserContainer(); + this.appendParser(new L.GML.Point()); + this.appendParser(new L.GML.LineString()); + this.appendParser(new L.GML.Polygon()); }, /** @@ -58,6 +64,6 @@ L.GML.MultiGeometry = L.GML.Geometry.extend({ } } - return this.transform(childObjects, options); + return childObjects; } }); diff --git a/src/WFS.js b/src/WFS.js index f76e9c5..04e6ba0 100644 --- a/src/WFS.js +++ b/src/WFS.js @@ -169,7 +169,14 @@ L.WFS = L.FeatureGroup.extend({ if (element.setStyle) { element.setStyle(that.options.style(element)); } - that.addLayer(element); + + if (Array.isArray(element)) { + for (var i = 0 ; i < element.length ; i++) { + that.addLayer(element[i]); + } + } else { + that.addLayer(element); + } }); } else { layers.forEach(function (element) {