Map multiple LineStringSegments to a one LineString

This commit is contained in:
Andreas Hocevar
2022-06-10 18:17:02 +02:00
parent 28b99b30a8
commit 2a8cc3d2f5
3 changed files with 46 additions and 9 deletions

View File

@@ -13,6 +13,7 @@ import {
XML_SCHEMA_INSTANCE_URI,
createElementNS,
getAllTextContent,
makeArrayExtender,
makeArrayPusher,
makeChildAppender,
makeReplacer,
@@ -189,13 +190,7 @@ class GML3 extends GMLBase {
* @return {Array<number>|undefined} flat coordinates.
*/
readSegment(node, objectStack) {
return pushParseAndPop(
[null],
this.SEGMENTS_PARSERS,
node,
objectStack,
this
);
return pushParseAndPop([], this.SEGMENTS_PARSERS, node, objectStack, this);
}
/**
@@ -1161,7 +1156,9 @@ GML3.prototype.PATCHES_PARSERS = {
*/
GML3.prototype.SEGMENTS_PARSERS = {
'http://www.opengis.net/gml': {
'LineStringSegment': makeReplacer(GML3.prototype.readLineStringSegment),
'LineStringSegment': makeArrayExtender(
GML3.prototype.readLineStringSegment
),
},
};

View File

@@ -169,7 +169,9 @@ GML32.prototype.PATCHES_PARSERS = {
*/
GML32.prototype.SEGMENTS_PARSERS = {
'http://www.opengis.net/gml/3.2': {
'LineStringSegment': makeReplacer(GML3.prototype.readLineStringSegment),
'LineStringSegment': makeArrayExtender(
GML3.prototype.readLineStringSegment
),
},
};