Remove private and protected scope from GML methods and members

This commit is contained in:
Andreas Hocevar
2020-04-13 23:35:44 +02:00
parent a2ae18d89a
commit e14e41bcfb
4 changed files with 253 additions and 378 deletions

View File

@@ -73,10 +73,9 @@ class GML2 extends GMLBase {
/** /**
* @param {Node} node Node. * @param {Node} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {Array<number>|undefined} Flat coordinates. * @return {Array<number>|undefined} Flat coordinates.
*/ */
readFlatCoordinates_(node, objectStack) { readFlatCoordinates(node, objectStack) {
const s = getAllTextContent(node, false).replace(/^\s*|\s*$/g, ''); const s = getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
const context = /** @type {import("../xml.js").NodeStackItem} */ (objectStack[0]); const context = /** @type {import("../xml.js").NodeStackItem} */ (objectStack[0]);
const containerSrs = context['srsName']; const containerSrs = context['srsName'];
@@ -106,10 +105,9 @@ class GML2 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {import("../extent.js").Extent|undefined} Envelope. * @return {import("../extent.js").Extent|undefined} Envelope.
*/ */
readBox_(node, objectStack) { readBox(node, objectStack) {
/** @type {Array<number>} */ /** @type {Array<number>} */
const flatCoordinates = pushParseAndPop( const flatCoordinates = pushParseAndPop(
[null], [null],
@@ -129,9 +127,8 @@ class GML2 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
*/ */
innerBoundaryIsParser_(node, objectStack) { innerBoundaryIsParser(node, objectStack) {
/** @type {Array<number>|undefined} */ /** @type {Array<number>|undefined} */
const flatLinearRing = pushParseAndPop( const flatLinearRing = pushParseAndPop(
undefined, undefined,
@@ -151,9 +148,8 @@ class GML2 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
*/ */
outerBoundaryIsParser_(node, objectStack) { outerBoundaryIsParser(node, objectStack) {
/** @type {Array<number>|undefined} */ /** @type {Array<number>|undefined} */
const flatLinearRing = pushParseAndPop( const flatLinearRing = pushParseAndPop(
undefined, undefined,
@@ -260,9 +256,8 @@ class GML2 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {import("../geom/LineString.js").default} geometry LineString geometry. * @param {import("../geom/LineString.js").default} geometry LineString geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeCurveOrLineString_(node, geometry, objectStack) { writeCurveOrLineString(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const srsName = context['srsName']; const srsName = context['srsName'];
if (node.nodeName !== 'LineStringSegment' && srsName) { if (node.nodeName !== 'LineStringSegment' && srsName) {
@@ -286,13 +281,12 @@ class GML2 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {import("../geom/LineString.js").default} line LineString geometry. * @param {import("../geom/LineString.js").default} line LineString geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeLineStringOrCurveMember_(node, line, objectStack) { writeLineStringOrCurveMember(node, line, objectStack) {
const child = this.GEOMETRY_NODE_FACTORY_(line, objectStack); const child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
if (child) { if (child) {
node.appendChild(child); node.appendChild(child);
this.writeCurveOrLineString_(child, line, objectStack); this.writeCurveOrLineString(child, line, objectStack);
} }
} }
@@ -300,9 +294,8 @@ class GML2 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {import("../geom/MultiLineString.js").default} geometry MultiLineString geometry. * @param {import("../geom/MultiLineString.js").default} geometry MultiLineString geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeMultiCurveOrLineString_(node, geometry, objectStack) { writeMultiCurveOrLineString(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const hasZ = context['hasZ']; const hasZ = context['hasZ'];
const srsName = context['srsName']; const srsName = context['srsName'];
@@ -313,7 +306,7 @@ class GML2 extends GMLBase {
const lines = geometry.getLineStrings(); const lines = geometry.getLineStrings();
pushSerializeAndPop( pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName, curve: curve}, {node: node, hasZ: hasZ, srsName: srsName, curve: curve},
this.LINESTRINGORCURVEMEMBER_SERIALIZERS_, this.LINESTRINGORCURVEMEMBER_SERIALIZERS,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,
lines, lines,
objectStack, objectStack,
@@ -349,7 +342,7 @@ class GML2 extends GMLBase {
pushSerializeAndPop( pushSerializeAndPop(
/** @type {import("../xml.js").NodeStackItem} */ /** @type {import("../xml.js").NodeStackItem} */
(item), (item),
this.GEOMETRY_SERIALIZERS_, this.GEOMETRY_SERIALIZERS,
this.GEOMETRY_NODE_FACTORY_, this.GEOMETRY_NODE_FACTORY_,
[value], [value],
objectStack, objectStack,
@@ -402,16 +395,15 @@ class GML2 extends GMLBase {
writeCurveSegments_(node, line, objectStack) { writeCurveSegments_(node, line, objectStack) {
const child = createElementNS(node.namespaceURI, 'LineStringSegment'); const child = createElementNS(node.namespaceURI, 'LineStringSegment');
node.appendChild(child); node.appendChild(child);
this.writeCurveOrLineString_(child, line, objectStack); this.writeCurveOrLineString(child, line, objectStack);
} }
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {import("../geom/Polygon.js").default} geometry Polygon geometry. * @param {import("../geom/Polygon.js").default} geometry Polygon geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeSurfaceOrPolygon_(node, geometry, objectStack) { writeSurfaceOrPolygon(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const hasZ = context['hasZ']; const hasZ = context['hasZ'];
const srsName = context['srsName']; const srsName = context['srsName'];
@@ -422,7 +414,7 @@ class GML2 extends GMLBase {
const rings = geometry.getLinearRings(); const rings = geometry.getLinearRings();
pushSerializeAndPop( pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName}, {node: node, hasZ: hasZ, srsName: srsName},
this.RING_SERIALIZERS_, this.RING_SERIALIZERS,
this.RING_NODE_FACTORY_, this.RING_NODE_FACTORY_,
rings, rings,
objectStack, objectStack,
@@ -465,19 +457,18 @@ class GML2 extends GMLBase {
writeSurfacePatches_(node, polygon, objectStack) { writeSurfacePatches_(node, polygon, objectStack) {
const child = createElementNS(node.namespaceURI, 'PolygonPatch'); const child = createElementNS(node.namespaceURI, 'PolygonPatch');
node.appendChild(child); node.appendChild(child);
this.writeSurfaceOrPolygon_(child, polygon, objectStack); this.writeSurfaceOrPolygon(child, polygon, objectStack);
} }
/** /**
* @param {Node} node Node. * @param {Node} node Node.
* @param {import("../geom/LinearRing.js").default} ring LinearRing geometry. * @param {import("../geom/LinearRing.js").default} ring LinearRing geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeRing_(node, ring, objectStack) { writeRing(node, ring, objectStack) {
const linearRing = createElementNS(node.namespaceURI, 'LinearRing'); const linearRing = createElementNS(node.namespaceURI, 'LinearRing');
node.appendChild(linearRing); node.appendChild(linearRing);
this.writeLinearRing_(linearRing, ring, objectStack); this.writeLinearRing(linearRing, ring, objectStack);
} }
/** /**
@@ -509,9 +500,8 @@ class GML2 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {import("../geom/Point.js").default} geometry Point geometry. * @param {import("../geom/Point.js").default} geometry Point geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writePoint_(node, geometry, objectStack) { writePoint(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const hasZ = context['hasZ']; const hasZ = context['hasZ'];
const srsName = context['srsName']; const srsName = context['srsName'];
@@ -529,9 +519,8 @@ class GML2 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {import("../geom/MultiPoint.js").default} geometry MultiPoint geometry. * @param {import("../geom/MultiPoint.js").default} geometry MultiPoint geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeMultiPoint_(node, geometry, objectStack) { writeMultiPoint(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const hasZ = context['hasZ']; const hasZ = context['hasZ'];
const srsName = context['srsName']; const srsName = context['srsName'];
@@ -541,7 +530,7 @@ class GML2 extends GMLBase {
const points = geometry.getPoints(); const points = geometry.getPoints();
pushSerializeAndPop( pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName}, {node: node, hasZ: hasZ, srsName: srsName},
this.POINTMEMBER_SERIALIZERS_, this.POINTMEMBER_SERIALIZERS,
makeSimpleNodeFactory('pointMember'), makeSimpleNodeFactory('pointMember'),
points, points,
objectStack, objectStack,
@@ -554,21 +543,19 @@ class GML2 extends GMLBase {
* @param {Node} node Node. * @param {Node} node Node.
* @param {import("../geom/Point.js").default} point Point geometry. * @param {import("../geom/Point.js").default} point Point geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writePointMember_(node, point, objectStack) { writePointMember(node, point, objectStack) {
const child = createElementNS(node.namespaceURI, 'Point'); const child = createElementNS(node.namespaceURI, 'Point');
node.appendChild(child); node.appendChild(child);
this.writePoint_(child, point, objectStack); this.writePoint(child, point, objectStack);
} }
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {import("../geom/LinearRing.js").default} geometry LinearRing geometry. * @param {import("../geom/LinearRing.js").default} geometry LinearRing geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeLinearRing_(node, geometry, objectStack) { writeLinearRing(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const srsName = context['srsName']; const srsName = context['srsName'];
if (srsName) { if (srsName) {
@@ -583,9 +570,8 @@ class GML2 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {import("../geom/MultiPolygon.js").default} geometry MultiPolygon geometry. * @param {import("../geom/MultiPolygon.js").default} geometry MultiPolygon geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeMultiSurfaceOrPolygon_(node, geometry, objectStack) { writeMultiSurfaceOrPolygon(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const hasZ = context['hasZ']; const hasZ = context['hasZ'];
const srsName = context['srsName']; const srsName = context['srsName'];
@@ -596,7 +582,7 @@ class GML2 extends GMLBase {
const polygons = geometry.getPolygons(); const polygons = geometry.getPolygons();
pushSerializeAndPop( pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName, surface: surface}, {node: node, hasZ: hasZ, srsName: srsName, surface: surface},
this.SURFACEORPOLYGONMEMBER_SERIALIZERS_, this.SURFACEORPOLYGONMEMBER_SERIALIZERS,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,
polygons, polygons,
objectStack, objectStack,
@@ -609,13 +595,12 @@ class GML2 extends GMLBase {
* @param {Node} node Node. * @param {Node} node Node.
* @param {import("../geom/Polygon.js").default} polygon Polygon geometry. * @param {import("../geom/Polygon.js").default} polygon Polygon geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeSurfaceOrPolygonMember_(node, polygon, objectStack) { writeSurfaceOrPolygonMember(node, polygon, objectStack) {
const child = this.GEOMETRY_NODE_FACTORY_(polygon, objectStack); const child = this.GEOMETRY_NODE_FACTORY_(polygon, objectStack);
if (child) { if (child) {
node.appendChild(child); node.appendChild(child);
this.writeSurfaceOrPolygon_(child, polygon, objectStack); this.writeSurfaceOrPolygon(child, polygon, objectStack);
} }
} }
@@ -623,7 +608,6 @@ class GML2 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {import("../extent.js").Extent} extent Extent. * @param {import("../extent.js").Extent} extent Extent.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeEnvelope(node, extent, objectStack) { writeEnvelope(node, extent, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
@@ -636,7 +620,7 @@ class GML2 extends GMLBase {
pushSerializeAndPop( pushSerializeAndPop(
/** @type {import("../xml.js").NodeStackItem} */ /** @type {import("../xml.js").NodeStackItem} */
({node: node}), ({node: node}),
this.ENVELOPE_SERIALIZERS_, this.ENVELOPE_SERIALIZERS,
OBJECT_PROPERTY_NODE_FACTORY, OBJECT_PROPERTY_NODE_FACTORY,
values, values,
objectStack, objectStack,
@@ -665,41 +649,37 @@ class GML2 extends GMLBase {
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = { GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'coordinates': makeReplacer(GML2.prototype.readFlatCoordinates_), 'coordinates': makeReplacer(GML2.prototype.readFlatCoordinates),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GML2.prototype.FLAT_LINEAR_RINGS_PARSERS = { GML2.prototype.FLAT_LINEAR_RINGS_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'innerBoundaryIs': GML2.prototype.innerBoundaryIsParser_, 'innerBoundaryIs': GML2.prototype.innerBoundaryIsParser,
'outerBoundaryIs': GML2.prototype.outerBoundaryIsParser_, 'outerBoundaryIs': GML2.prototype.outerBoundaryIsParser,
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML2.prototype.BOX_PARSERS_ = { GML2.prototype.BOX_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'coordinates': makeArrayPusher(GML2.prototype.readFlatCoordinates_), 'coordinates': makeArrayPusher(GML2.prototype.readFlatCoordinates),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GML2.prototype.GEOMETRY_PARSERS = { GML2.prototype.GEOMETRY_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
@@ -710,35 +690,32 @@ GML2.prototype.GEOMETRY_PARSERS = {
'LinearRing': makeReplacer(GMLBase.prototype.readLinearRing), 'LinearRing': makeReplacer(GMLBase.prototype.readLinearRing),
'Polygon': makeReplacer(GMLBase.prototype.readPolygon), 'Polygon': makeReplacer(GMLBase.prototype.readPolygon),
'MultiPolygon': makeReplacer(GMLBase.prototype.readMultiPolygon), 'MultiPolygon': makeReplacer(GMLBase.prototype.readMultiPolygon),
'Box': makeReplacer(GML2.prototype.readBox_), 'Box': makeReplacer(GML2.prototype.readBox),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML2.prototype.GEOMETRY_SERIALIZERS_ = { GML2.prototype.GEOMETRY_SERIALIZERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'Curve': makeChildAppender(GML2.prototype.writeCurveOrLineString_), 'Curve': makeChildAppender(GML2.prototype.writeCurveOrLineString),
'MultiCurve': makeChildAppender( 'MultiCurve': makeChildAppender(GML2.prototype.writeMultiCurveOrLineString),
GML2.prototype.writeMultiCurveOrLineString_ 'Point': makeChildAppender(GML2.prototype.writePoint),
), 'MultiPoint': makeChildAppender(GML2.prototype.writeMultiPoint),
'Point': makeChildAppender(GML2.prototype.writePoint_), 'LineString': makeChildAppender(GML2.prototype.writeCurveOrLineString),
'MultiPoint': makeChildAppender(GML2.prototype.writeMultiPoint_),
'LineString': makeChildAppender(GML2.prototype.writeCurveOrLineString_),
'MultiLineString': makeChildAppender( 'MultiLineString': makeChildAppender(
GML2.prototype.writeMultiCurveOrLineString_ GML2.prototype.writeMultiCurveOrLineString
), ),
'LinearRing': makeChildAppender(GML2.prototype.writeLinearRing_), 'LinearRing': makeChildAppender(GML2.prototype.writeLinearRing),
'Polygon': makeChildAppender(GML2.prototype.writeSurfaceOrPolygon_), 'Polygon': makeChildAppender(GML2.prototype.writeSurfaceOrPolygon),
'MultiPolygon': makeChildAppender( 'MultiPolygon': makeChildAppender(
GML2.prototype.writeMultiSurfaceOrPolygon_ GML2.prototype.writeMultiSurfaceOrPolygon
), ),
'Surface': makeChildAppender(GML2.prototype.writeSurfaceOrPolygon_), 'Surface': makeChildAppender(GML2.prototype.writeSurfaceOrPolygon),
'MultiSurface': makeChildAppender( 'MultiSurface': makeChildAppender(
GML2.prototype.writeMultiSurfaceOrPolygon_ GML2.prototype.writeMultiSurfaceOrPolygon
), ),
'Envelope': makeChildAppender(GML2.prototype.writeEnvelope), 'Envelope': makeChildAppender(GML2.prototype.writeEnvelope),
}, },
@@ -746,61 +723,56 @@ GML2.prototype.GEOMETRY_SERIALIZERS_ = {
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML2.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { GML2.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lineStringMember': makeChildAppender( 'lineStringMember': makeChildAppender(
GML2.prototype.writeLineStringOrCurveMember_ GML2.prototype.writeLineStringOrCurveMember
), ),
'curveMember': makeChildAppender( 'curveMember': makeChildAppender(
GML2.prototype.writeLineStringOrCurveMember_ GML2.prototype.writeLineStringOrCurveMember
), ),
}, },
}; };
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML2.prototype.RING_SERIALIZERS_ = { GML2.prototype.RING_SERIALIZERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'outerBoundaryIs': makeChildAppender(GML2.prototype.writeRing_), 'outerBoundaryIs': makeChildAppender(GML2.prototype.writeRing),
'innerBoundaryIs': makeChildAppender(GML2.prototype.writeRing_), 'innerBoundaryIs': makeChildAppender(GML2.prototype.writeRing),
}, },
}; };
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML2.prototype.POINTMEMBER_SERIALIZERS_ = { GML2.prototype.POINTMEMBER_SERIALIZERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'pointMember': makeChildAppender(GML2.prototype.writePointMember_), 'pointMember': makeChildAppender(GML2.prototype.writePointMember),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML2.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { GML2.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'surfaceMember': makeChildAppender( 'surfaceMember': makeChildAppender(
GML2.prototype.writeSurfaceOrPolygonMember_ GML2.prototype.writeSurfaceOrPolygonMember
), ),
'polygonMember': makeChildAppender( 'polygonMember': makeChildAppender(
GML2.prototype.writeSurfaceOrPolygonMember_ GML2.prototype.writeSurfaceOrPolygonMember
), ),
}, },
}; };
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML2.prototype.ENVELOPE_SERIALIZERS_ = { GML2.prototype.ENVELOPE_SERIALIZERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lowerCorner': makeChildAppender(writeStringTextNode), 'lowerCorner': makeChildAppender(writeStringTextNode),
'upperCorner': makeChildAppender(writeStringTextNode), 'upperCorner': makeChildAppender(writeStringTextNode),

View File

@@ -113,14 +113,13 @@ class GML3 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {MultiLineString|undefined} MultiLineString. * @return {MultiLineString|undefined} MultiLineString.
*/ */
readMultiCurve_(node, objectStack) { readMultiCurve(node, objectStack) {
/** @type {Array<LineString>} */ /** @type {Array<LineString>} */
const lineStrings = pushParseAndPop( const lineStrings = pushParseAndPop(
[], [],
this.MULTICURVE_PARSERS_, this.MULTICURVE_PARSERS,
node, node,
objectStack, objectStack,
this this
@@ -136,14 +135,13 @@ class GML3 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {MultiPolygon|undefined} MultiPolygon. * @return {MultiPolygon|undefined} MultiPolygon.
*/ */
readMultiSurface_(node, objectStack) { readMultiSurface(node, objectStack) {
/** @type {Array<Polygon>} */ /** @type {Array<Polygon>} */
const polygons = pushParseAndPop( const polygons = pushParseAndPop(
[], [],
this.MULTISURFACE_PARSERS_, this.MULTISURFACE_PARSERS,
node, node,
objectStack, objectStack,
this this
@@ -156,31 +154,28 @@ class GML3 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
*/ */
curveMemberParser_(node, objectStack) { curveMemberParser(node, objectStack) {
parseNode(this.CURVEMEMBER_PARSERS_, node, objectStack, this); parseNode(this.CURVEMEMBER_PARSERS, node, objectStack, this);
} }
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
*/ */
surfaceMemberParser_(node, objectStack) { surfaceMemberParser(node, objectStack) {
parseNode(this.SURFACEMEMBER_PARSERS_, node, objectStack, this); parseNode(this.SURFACEMEMBER_PARSERS, node, objectStack, this);
} }
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {Array<(Array<number>)>|undefined} flat coordinates. * @return {Array<(Array<number>)>|undefined} flat coordinates.
*/ */
readPatch_(node, objectStack) { readPatch(node, objectStack) {
return pushParseAndPop( return pushParseAndPop(
[null], [null],
this.PATCHES_PARSERS_, this.PATCHES_PARSERS,
node, node,
objectStack, objectStack,
this this
@@ -190,13 +185,12 @@ class GML3 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {Array<number>|undefined} flat coordinates. * @return {Array<number>|undefined} flat coordinates.
*/ */
readSegment_(node, objectStack) { readSegment(node, objectStack) {
return pushParseAndPop( return pushParseAndPop(
[null], [null],
this.SEGMENTS_PARSERS_, this.SEGMENTS_PARSERS,
node, node,
objectStack, objectStack,
this this
@@ -206,10 +200,9 @@ class GML3 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {Array<(Array<number>)>|undefined} flat coordinates. * @return {Array<(Array<number>)>|undefined} flat coordinates.
*/ */
readPolygonPatch_(node, objectStack) { readPolygonPatch(node, objectStack) {
return pushParseAndPop( return pushParseAndPop(
[null], [null],
this.FLAT_LINEAR_RINGS_PARSERS, this.FLAT_LINEAR_RINGS_PARSERS,
@@ -222,10 +215,9 @@ class GML3 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {Array<number>|undefined} flat coordinates. * @return {Array<number>|undefined} flat coordinates.
*/ */
readLineStringSegment_(node, objectStack) { readLineStringSegment(node, objectStack) {
return pushParseAndPop( return pushParseAndPop(
[null], [null],
this.GEOMETRY_FLAT_COORDINATES_PARSERS, this.GEOMETRY_FLAT_COORDINATES_PARSERS,
@@ -238,9 +230,8 @@ class GML3 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
*/ */
interiorParser_(node, objectStack) { interiorParser(node, objectStack) {
/** @type {Array<number>|undefined} */ /** @type {Array<number>|undefined} */
const flatLinearRing = pushParseAndPop( const flatLinearRing = pushParseAndPop(
undefined, undefined,
@@ -260,9 +251,8 @@ class GML3 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
*/ */
exteriorParser_(node, objectStack) { exteriorParser(node, objectStack) {
/** @type {Array<number>|undefined} */ /** @type {Array<number>|undefined} */
const flatLinearRing = pushParseAndPop( const flatLinearRing = pushParseAndPop(
undefined, undefined,
@@ -282,14 +272,13 @@ class GML3 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {Polygon|undefined} Polygon. * @return {Polygon|undefined} Polygon.
*/ */
readSurface_(node, objectStack) { readSurface(node, objectStack) {
/** @type {Array<Array<number>>} */ /** @type {Array<Array<number>>} */
const flatLinearRings = pushParseAndPop( const flatLinearRings = pushParseAndPop(
[null], [null],
this.SURFACE_PARSERS_, this.SURFACE_PARSERS,
node, node,
objectStack, objectStack,
this this
@@ -311,14 +300,13 @@ class GML3 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {LineString|undefined} LineString. * @return {LineString|undefined} LineString.
*/ */
readCurve_(node, objectStack) { readCurve(node, objectStack) {
/** @type {Array<number>} */ /** @type {Array<number>} */
const flatCoordinates = pushParseAndPop( const flatCoordinates = pushParseAndPop(
[null], [null],
this.CURVE_PARSERS_, this.CURVE_PARSERS,
node, node,
objectStack, objectStack,
this this
@@ -334,14 +322,13 @@ class GML3 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {import("../extent.js").Extent|undefined} Envelope. * @return {import("../extent.js").Extent|undefined} Envelope.
*/ */
readEnvelope_(node, objectStack) { readEnvelope(node, objectStack) {
/** @type {Array<number>} */ /** @type {Array<number>} */
const flatCoordinates = pushParseAndPop( const flatCoordinates = pushParseAndPop(
[null], [null],
this.ENVELOPE_PARSERS_, this.ENVELOPE_PARSERS,
node, node,
objectStack, objectStack,
this this
@@ -357,10 +344,9 @@ class GML3 extends GMLBase {
/** /**
* @param {Node} node Node. * @param {Node} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {Array<number>|undefined} Flat coordinates. * @return {Array<number>|undefined} Flat coordinates.
*/ */
readFlatPos_(node, objectStack) { readFlatPos(node, objectStack) {
let s = getAllTextContent(node, false); let s = getAllTextContent(node, false);
const re = /^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/; const re = /^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/;
/** @type {Array<number>} */ /** @type {Array<number>} */
@@ -402,10 +388,9 @@ class GML3 extends GMLBase {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {Array<number>|undefined} Flat coordinates. * @return {Array<number>|undefined} Flat coordinates.
*/ */
readFlatPosList_(node, objectStack) { readFlatPosList(node, objectStack) {
const s = getAllTextContent(node, false).replace(/^\s*|\s*$/g, ''); const s = getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
const context = objectStack[0]; const context = objectStack[0];
const containerSrs = context['srsName']; const containerSrs = context['srsName'];
@@ -531,9 +516,8 @@ class GML3 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {import("../geom/Point.js").default} geometry Point geometry. * @param {import("../geom/Point.js").default} geometry Point geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writePoint_(node, geometry, objectStack) { writePoint(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const srsName = context['srsName']; const srsName = context['srsName'];
if (srsName) { if (srsName) {
@@ -560,7 +544,7 @@ class GML3 extends GMLBase {
pushSerializeAndPop( pushSerializeAndPop(
/** @type {import("../xml.js").NodeStackItem} */ /** @type {import("../xml.js").NodeStackItem} */
({node: node}), ({node: node}),
this.ENVELOPE_SERIALIZERS_, this.ENVELOPE_SERIALIZERS,
OBJECT_PROPERTY_NODE_FACTORY, OBJECT_PROPERTY_NODE_FACTORY,
values, values,
objectStack, objectStack,
@@ -573,9 +557,8 @@ class GML3 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {import("../geom/LinearRing.js").default} geometry LinearRing geometry. * @param {import("../geom/LinearRing.js").default} geometry LinearRing geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeLinearRing_(node, geometry, objectStack) { writeLinearRing(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const srsName = context['srsName']; const srsName = context['srsName'];
if (srsName) { if (srsName) {
@@ -610,9 +593,8 @@ class GML3 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {Polygon} geometry Polygon geometry. * @param {Polygon} geometry Polygon geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeSurfaceOrPolygon_(node, geometry, objectStack) { writeSurfaceOrPolygon(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const hasZ = context['hasZ']; const hasZ = context['hasZ'];
const srsName = context['srsName']; const srsName = context['srsName'];
@@ -623,7 +605,7 @@ class GML3 extends GMLBase {
const rings = geometry.getLinearRings(); const rings = geometry.getLinearRings();
pushSerializeAndPop( pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName}, {node: node, hasZ: hasZ, srsName: srsName},
this.RING_SERIALIZERS_, this.RING_SERIALIZERS,
this.RING_NODE_FACTORY_, this.RING_NODE_FACTORY_,
rings, rings,
objectStack, objectStack,
@@ -641,9 +623,8 @@ class GML3 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {LineString} geometry LineString geometry. * @param {LineString} geometry LineString geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeCurveOrLineString_(node, geometry, objectStack) { writeCurveOrLineString(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const srsName = context['srsName']; const srsName = context['srsName'];
if (node.nodeName !== 'LineStringSegment' && srsName) { if (node.nodeName !== 'LineStringSegment' && srsName) {
@@ -667,9 +648,8 @@ class GML3 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {MultiPolygon} geometry MultiPolygon geometry. * @param {MultiPolygon} geometry MultiPolygon geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeMultiSurfaceOrPolygon_(node, geometry, objectStack) { writeMultiSurfaceOrPolygon(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const hasZ = context['hasZ']; const hasZ = context['hasZ'];
const srsName = context['srsName']; const srsName = context['srsName'];
@@ -680,7 +660,7 @@ class GML3 extends GMLBase {
const polygons = geometry.getPolygons(); const polygons = geometry.getPolygons();
pushSerializeAndPop( pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName, surface: surface}, {node: node, hasZ: hasZ, srsName: srsName, surface: surface},
this.SURFACEORPOLYGONMEMBER_SERIALIZERS_, this.SURFACEORPOLYGONMEMBER_SERIALIZERS,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,
polygons, polygons,
objectStack, objectStack,
@@ -693,9 +673,8 @@ class GML3 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {import("../geom/MultiPoint.js").default} geometry MultiPoint geometry. * @param {import("../geom/MultiPoint.js").default} geometry MultiPoint geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeMultiPoint_(node, geometry, objectStack) { writeMultiPoint(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const srsName = context['srsName']; const srsName = context['srsName'];
const hasZ = context['hasZ']; const hasZ = context['hasZ'];
@@ -705,7 +684,7 @@ class GML3 extends GMLBase {
const points = geometry.getPoints(); const points = geometry.getPoints();
pushSerializeAndPop( pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName}, {node: node, hasZ: hasZ, srsName: srsName},
this.POINTMEMBER_SERIALIZERS_, this.POINTMEMBER_SERIALIZERS,
makeSimpleNodeFactory('pointMember'), makeSimpleNodeFactory('pointMember'),
points, points,
objectStack, objectStack,
@@ -718,9 +697,8 @@ class GML3 extends GMLBase {
* @param {Element} node Node. * @param {Element} node Node.
* @param {MultiLineString} geometry MultiLineString geometry. * @param {MultiLineString} geometry MultiLineString geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeMultiCurveOrLineString_(node, geometry, objectStack) { writeMultiCurveOrLineString(node, geometry, objectStack) {
const context = objectStack[objectStack.length - 1]; const context = objectStack[objectStack.length - 1];
const hasZ = context['hasZ']; const hasZ = context['hasZ'];
const srsName = context['srsName']; const srsName = context['srsName'];
@@ -731,7 +709,7 @@ class GML3 extends GMLBase {
const lines = geometry.getLineStrings(); const lines = geometry.getLineStrings();
pushSerializeAndPop( pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName, curve: curve}, {node: node, hasZ: hasZ, srsName: srsName, curve: curve},
this.LINESTRINGORCURVEMEMBER_SERIALIZERS_, this.LINESTRINGORCURVEMEMBER_SERIALIZERS,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,
lines, lines,
objectStack, objectStack,
@@ -744,25 +722,23 @@ class GML3 extends GMLBase {
* @param {Node} node Node. * @param {Node} node Node.
* @param {import("../geom/LinearRing.js").default} ring LinearRing geometry. * @param {import("../geom/LinearRing.js").default} ring LinearRing geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeRing_(node, ring, objectStack) { writeRing(node, ring, objectStack) {
const linearRing = createElementNS(node.namespaceURI, 'LinearRing'); const linearRing = createElementNS(node.namespaceURI, 'LinearRing');
node.appendChild(linearRing); node.appendChild(linearRing);
this.writeLinearRing_(linearRing, ring, objectStack); this.writeLinearRing(linearRing, ring, objectStack);
} }
/** /**
* @param {Node} node Node. * @param {Node} node Node.
* @param {Polygon} polygon Polygon geometry. * @param {Polygon} polygon Polygon geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeSurfaceOrPolygonMember_(node, polygon, objectStack) { writeSurfaceOrPolygonMember(node, polygon, objectStack) {
const child = this.GEOMETRY_NODE_FACTORY_(polygon, objectStack); const child = this.GEOMETRY_NODE_FACTORY_(polygon, objectStack);
if (child) { if (child) {
node.appendChild(child); node.appendChild(child);
this.writeSurfaceOrPolygon_(child, polygon, objectStack); this.writeSurfaceOrPolygon(child, polygon, objectStack);
} }
} }
@@ -770,25 +746,23 @@ class GML3 extends GMLBase {
* @param {Node} node Node. * @param {Node} node Node.
* @param {import("../geom/Point.js").default} point Point geometry. * @param {import("../geom/Point.js").default} point Point geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writePointMember_(node, point, objectStack) { writePointMember(node, point, objectStack) {
const child = createElementNS(node.namespaceURI, 'Point'); const child = createElementNS(node.namespaceURI, 'Point');
node.appendChild(child); node.appendChild(child);
this.writePoint_(child, point, objectStack); this.writePoint(child, point, objectStack);
} }
/** /**
* @param {Node} node Node. * @param {Node} node Node.
* @param {LineString} line LineString geometry. * @param {LineString} line LineString geometry.
* @param {Array<*>} objectStack Node stack. * @param {Array<*>} objectStack Node stack.
* @private
*/ */
writeLineStringOrCurveMember_(node, line, objectStack) { writeLineStringOrCurveMember(node, line, objectStack) {
const child = this.GEOMETRY_NODE_FACTORY_(line, objectStack); const child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
if (child) { if (child) {
node.appendChild(child); node.appendChild(child);
this.writeCurveOrLineString_(child, line, objectStack); this.writeCurveOrLineString(child, line, objectStack);
} }
} }
@@ -801,7 +775,7 @@ class GML3 extends GMLBase {
writeSurfacePatches_(node, polygon, objectStack) { writeSurfacePatches_(node, polygon, objectStack) {
const child = createElementNS(node.namespaceURI, 'PolygonPatch'); const child = createElementNS(node.namespaceURI, 'PolygonPatch');
node.appendChild(child); node.appendChild(child);
this.writeSurfaceOrPolygon_(child, polygon, objectStack); this.writeSurfaceOrPolygon(child, polygon, objectStack);
} }
/** /**
@@ -813,7 +787,7 @@ class GML3 extends GMLBase {
writeCurveSegments_(node, line, objectStack) { writeCurveSegments_(node, line, objectStack) {
const child = createElementNS(node.namespaceURI, 'LineStringSegment'); const child = createElementNS(node.namespaceURI, 'LineStringSegment');
node.appendChild(child); node.appendChild(child);
this.writeCurveOrLineString_(child, line, objectStack); this.writeCurveOrLineString(child, line, objectStack);
} }
/** /**
@@ -843,7 +817,7 @@ class GML3 extends GMLBase {
pushSerializeAndPop( pushSerializeAndPop(
/** @type {import("../xml.js").NodeStackItem} */ /** @type {import("../xml.js").NodeStackItem} */
(item), (item),
this.GEOMETRY_SERIALIZERS_, this.GEOMETRY_SERIALIZERS,
this.GEOMETRY_NODE_FACTORY_, this.GEOMETRY_NODE_FACTORY_,
[value], [value],
objectStack, objectStack,
@@ -1050,31 +1024,28 @@ class GML3 extends GMLBase {
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = { GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'pos': makeReplacer(GML3.prototype.readFlatPos_), 'pos': makeReplacer(GML3.prototype.readFlatPos),
'posList': makeReplacer(GML3.prototype.readFlatPosList_), 'posList': makeReplacer(GML3.prototype.readFlatPosList),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GML3.prototype.FLAT_LINEAR_RINGS_PARSERS = { GML3.prototype.FLAT_LINEAR_RINGS_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'interior': GML3.prototype.interiorParser_, 'interior': GML3.prototype.interiorParser,
'exterior': GML3.prototype.exteriorParser_, 'exterior': GML3.prototype.exteriorParser,
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GML3.prototype.GEOMETRY_PARSERS = { GML3.prototype.GEOMETRY_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
@@ -1085,115 +1056,106 @@ GML3.prototype.GEOMETRY_PARSERS = {
'LinearRing': makeReplacer(GMLBase.prototype.readLinearRing), 'LinearRing': makeReplacer(GMLBase.prototype.readLinearRing),
'Polygon': makeReplacer(GMLBase.prototype.readPolygon), 'Polygon': makeReplacer(GMLBase.prototype.readPolygon),
'MultiPolygon': makeReplacer(GMLBase.prototype.readMultiPolygon), 'MultiPolygon': makeReplacer(GMLBase.prototype.readMultiPolygon),
'Surface': makeReplacer(GML3.prototype.readSurface_), 'Surface': makeReplacer(GML3.prototype.readSurface),
'MultiSurface': makeReplacer(GML3.prototype.readMultiSurface_), 'MultiSurface': makeReplacer(GML3.prototype.readMultiSurface),
'Curve': makeReplacer(GML3.prototype.readCurve_), 'Curve': makeReplacer(GML3.prototype.readCurve),
'MultiCurve': makeReplacer(GML3.prototype.readMultiCurve_), 'MultiCurve': makeReplacer(GML3.prototype.readMultiCurve),
'Envelope': makeReplacer(GML3.prototype.readEnvelope_), 'Envelope': makeReplacer(GML3.prototype.readEnvelope),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML3.prototype.MULTICURVE_PARSERS_ = { GML3.prototype.MULTICURVE_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'curveMember': makeArrayPusher(GML3.prototype.curveMemberParser_), 'curveMember': makeArrayPusher(GML3.prototype.curveMemberParser),
'curveMembers': makeArrayPusher(GML3.prototype.curveMemberParser_), 'curveMembers': makeArrayPusher(GML3.prototype.curveMemberParser),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML3.prototype.MULTISURFACE_PARSERS_ = { GML3.prototype.MULTISURFACE_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'surfaceMember': makeArrayPusher(GML3.prototype.surfaceMemberParser_), 'surfaceMember': makeArrayPusher(GML3.prototype.surfaceMemberParser),
'surfaceMembers': makeArrayPusher(GML3.prototype.surfaceMemberParser_), 'surfaceMembers': makeArrayPusher(GML3.prototype.surfaceMemberParser),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML3.prototype.CURVEMEMBER_PARSERS_ = { GML3.prototype.CURVEMEMBER_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'LineString': makeArrayPusher(GMLBase.prototype.readLineString), 'LineString': makeArrayPusher(GMLBase.prototype.readLineString),
'Curve': makeArrayPusher(GML3.prototype.readCurve_), 'Curve': makeArrayPusher(GML3.prototype.readCurve),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML3.prototype.SURFACEMEMBER_PARSERS_ = { GML3.prototype.SURFACEMEMBER_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon), 'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon),
'Surface': makeArrayPusher(GML3.prototype.readSurface_), 'Surface': makeArrayPusher(GML3.prototype.readSurface),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML3.prototype.SURFACE_PARSERS_ = { GML3.prototype.SURFACE_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'patches': makeReplacer(GML3.prototype.readPatch_), 'patches': makeReplacer(GML3.prototype.readPatch),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML3.prototype.CURVE_PARSERS_ = { GML3.prototype.CURVE_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'segments': makeReplacer(GML3.prototype.readSegment_), 'segments': makeReplacer(GML3.prototype.readSegment),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML3.prototype.ENVELOPE_PARSERS_ = { GML3.prototype.ENVELOPE_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lowerCorner': makeArrayPusher(GML3.prototype.readFlatPosList_), 'lowerCorner': makeArrayPusher(GML3.prototype.readFlatPosList),
'upperCorner': makeArrayPusher(GML3.prototype.readFlatPosList_), 'upperCorner': makeArrayPusher(GML3.prototype.readFlatPosList),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML3.prototype.PATCHES_PARSERS_ = { GML3.prototype.PATCHES_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'PolygonPatch': makeReplacer(GML3.prototype.readPolygonPatch_), 'PolygonPatch': makeReplacer(GML3.prototype.readPolygonPatch),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML3.prototype.SEGMENTS_PARSERS_ = { GML3.prototype.SEGMENTS_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'LineStringSegment': makeReplacer(GML3.prototype.readLineStringSegment_), 'LineStringSegment': makeReplacer(GML3.prototype.readLineStringSegment),
}, },
}; };
@@ -1210,20 +1172,18 @@ GML3.prototype.writeFeatures;
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML3.prototype.RING_SERIALIZERS_ = { GML3.prototype.RING_SERIALIZERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'exterior': makeChildAppender(GML3.prototype.writeRing_), 'exterior': makeChildAppender(GML3.prototype.writeRing),
'interior': makeChildAppender(GML3.prototype.writeRing_), 'interior': makeChildAppender(GML3.prototype.writeRing),
}, },
}; };
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML3.prototype.ENVELOPE_SERIALIZERS_ = { GML3.prototype.ENVELOPE_SERIALIZERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lowerCorner': makeChildAppender(writeStringTextNode), 'lowerCorner': makeChildAppender(writeStringTextNode),
'upperCorner': makeChildAppender(writeStringTextNode), 'upperCorner': makeChildAppender(writeStringTextNode),
@@ -1232,68 +1192,62 @@ GML3.prototype.ENVELOPE_SERIALIZERS_ = {
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML3.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { GML3.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'surfaceMember': makeChildAppender( 'surfaceMember': makeChildAppender(
GML3.prototype.writeSurfaceOrPolygonMember_ GML3.prototype.writeSurfaceOrPolygonMember
), ),
'polygonMember': makeChildAppender( 'polygonMember': makeChildAppender(
GML3.prototype.writeSurfaceOrPolygonMember_ GML3.prototype.writeSurfaceOrPolygonMember
), ),
}, },
}; };
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML3.prototype.POINTMEMBER_SERIALIZERS_ = { GML3.prototype.POINTMEMBER_SERIALIZERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'pointMember': makeChildAppender(GML3.prototype.writePointMember_), 'pointMember': makeChildAppender(GML3.prototype.writePointMember),
}, },
}; };
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML3.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { GML3.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lineStringMember': makeChildAppender( 'lineStringMember': makeChildAppender(
GML3.prototype.writeLineStringOrCurveMember_ GML3.prototype.writeLineStringOrCurveMember
), ),
'curveMember': makeChildAppender( 'curveMember': makeChildAppender(
GML3.prototype.writeLineStringOrCurveMember_ GML3.prototype.writeLineStringOrCurveMember
), ),
}, },
}; };
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML3.prototype.GEOMETRY_SERIALIZERS_ = { GML3.prototype.GEOMETRY_SERIALIZERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'Curve': makeChildAppender(GML3.prototype.writeCurveOrLineString_), 'Curve': makeChildAppender(GML3.prototype.writeCurveOrLineString),
'MultiCurve': makeChildAppender( 'MultiCurve': makeChildAppender(GML3.prototype.writeMultiCurveOrLineString),
GML3.prototype.writeMultiCurveOrLineString_ 'Point': makeChildAppender(GML3.prototype.writePoint),
), 'MultiPoint': makeChildAppender(GML3.prototype.writeMultiPoint),
'Point': makeChildAppender(GML3.prototype.writePoint_), 'LineString': makeChildAppender(GML3.prototype.writeCurveOrLineString),
'MultiPoint': makeChildAppender(GML3.prototype.writeMultiPoint_),
'LineString': makeChildAppender(GML3.prototype.writeCurveOrLineString_),
'MultiLineString': makeChildAppender( 'MultiLineString': makeChildAppender(
GML3.prototype.writeMultiCurveOrLineString_ GML3.prototype.writeMultiCurveOrLineString
), ),
'LinearRing': makeChildAppender(GML3.prototype.writeLinearRing_), 'LinearRing': makeChildAppender(GML3.prototype.writeLinearRing),
'Polygon': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon_), 'Polygon': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon),
'MultiPolygon': makeChildAppender( 'MultiPolygon': makeChildAppender(
GML3.prototype.writeMultiSurfaceOrPolygon_ GML3.prototype.writeMultiSurfaceOrPolygon
), ),
'Surface': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon_), 'Surface': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon),
'MultiSurface': makeChildAppender( 'MultiSurface': makeChildAppender(
GML3.prototype.writeMultiSurfaceOrPolygon_ GML3.prototype.writeMultiSurfaceOrPolygon
), ),
'Envelope': makeChildAppender(GML3.prototype.writeEnvelope), 'Envelope': makeChildAppender(GML3.prototype.writeEnvelope),
}, },

View File

@@ -36,31 +36,28 @@ GML32.prototype.namespace = 'http://www.opengis.net/gml/3.2';
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GML32.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = { GML32.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'pos': makeReplacer(GML3.prototype.readFlatPos_), 'pos': makeReplacer(GML3.prototype.readFlatPos),
'posList': makeReplacer(GML3.prototype.readFlatPosList_), 'posList': makeReplacer(GML3.prototype.readFlatPosList),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GML32.prototype.FLAT_LINEAR_RINGS_PARSERS = { GML32.prototype.FLAT_LINEAR_RINGS_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'interior': GML3.prototype.interiorParser_, 'interior': GML3.prototype.interiorParser,
'exterior': GML3.prototype.exteriorParser_, 'exterior': GML3.prototype.exteriorParser,
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GML32.prototype.GEOMETRY_PARSERS = { GML32.prototype.GEOMETRY_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
@@ -71,142 +68,131 @@ GML32.prototype.GEOMETRY_PARSERS = {
'LinearRing': makeReplacer(GMLBase.prototype.readLinearRing), 'LinearRing': makeReplacer(GMLBase.prototype.readLinearRing),
'Polygon': makeReplacer(GMLBase.prototype.readPolygon), 'Polygon': makeReplacer(GMLBase.prototype.readPolygon),
'MultiPolygon': makeReplacer(GMLBase.prototype.readMultiPolygon), 'MultiPolygon': makeReplacer(GMLBase.prototype.readMultiPolygon),
'Surface': makeReplacer(GML32.prototype.readSurface_), 'Surface': makeReplacer(GML32.prototype.readSurface),
'MultiSurface': makeReplacer(GML3.prototype.readMultiSurface_), 'MultiSurface': makeReplacer(GML3.prototype.readMultiSurface),
'Curve': makeReplacer(GML32.prototype.readCurve_), 'Curve': makeReplacer(GML32.prototype.readCurve),
'MultiCurve': makeReplacer(GML3.prototype.readMultiCurve_), 'MultiCurve': makeReplacer(GML3.prototype.readMultiCurve),
'Envelope': makeReplacer(GML32.prototype.readEnvelope_), 'Envelope': makeReplacer(GML32.prototype.readEnvelope),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.MULTICURVE_PARSERS_ = { GML32.prototype.MULTICURVE_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'curveMember': makeArrayPusher(GML3.prototype.curveMemberParser_), 'curveMember': makeArrayPusher(GML3.prototype.curveMemberParser),
'curveMembers': makeArrayPusher(GML3.prototype.curveMemberParser_), 'curveMembers': makeArrayPusher(GML3.prototype.curveMemberParser),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.MULTISURFACE_PARSERS_ = { GML32.prototype.MULTISURFACE_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'surfaceMember': makeArrayPusher(GML3.prototype.surfaceMemberParser_), 'surfaceMember': makeArrayPusher(GML3.prototype.surfaceMemberParser),
'surfaceMembers': makeArrayPusher(GML3.prototype.surfaceMemberParser_), 'surfaceMembers': makeArrayPusher(GML3.prototype.surfaceMemberParser),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.CURVEMEMBER_PARSERS_ = { GML32.prototype.CURVEMEMBER_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'LineString': makeArrayPusher(GMLBase.prototype.readLineString), 'LineString': makeArrayPusher(GMLBase.prototype.readLineString),
'Curve': makeArrayPusher(GML3.prototype.readCurve_), 'Curve': makeArrayPusher(GML3.prototype.readCurve),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.SURFACEMEMBER_PARSERS_ = { GML32.prototype.SURFACEMEMBER_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon), 'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon),
'Surface': makeArrayPusher(GML3.prototype.readSurface_), 'Surface': makeArrayPusher(GML3.prototype.readSurface),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.SURFACE_PARSERS_ = { GML32.prototype.SURFACE_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'patches': makeReplacer(GML3.prototype.readPatch_), 'patches': makeReplacer(GML3.prototype.readPatch),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.CURVE_PARSERS_ = { GML32.prototype.CURVE_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'segments': makeReplacer(GML3.prototype.readSegment_), 'segments': makeReplacer(GML3.prototype.readSegment),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.ENVELOPE_PARSERS_ = { GML32.prototype.ENVELOPE_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'lowerCorner': makeArrayPusher(GML3.prototype.readFlatPosList_), 'lowerCorner': makeArrayPusher(GML3.prototype.readFlatPosList),
'upperCorner': makeArrayPusher(GML3.prototype.readFlatPosList_), 'upperCorner': makeArrayPusher(GML3.prototype.readFlatPosList),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.PATCHES_PARSERS_ = { GML32.prototype.PATCHES_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'PolygonPatch': makeReplacer(GML3.prototype.readPolygonPatch_), 'PolygonPatch': makeReplacer(GML3.prototype.readPolygonPatch),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.SEGMENTS_PARSERS_ = { GML32.prototype.SEGMENTS_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'LineStringSegment': makeReplacer(GML3.prototype.readLineStringSegment_), 'LineStringSegment': makeReplacer(GML3.prototype.readLineStringSegment),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.MULTIPOINT_PARSERS_ = { GML32.prototype.MULTIPOINT_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'pointMember': makeArrayPusher(GMLBase.prototype.pointMemberParser_), 'pointMember': makeArrayPusher(GMLBase.prototype.pointMemberParser),
'pointMembers': makeArrayPusher(GMLBase.prototype.pointMemberParser_), 'pointMembers': makeArrayPusher(GMLBase.prototype.pointMemberParser),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.MULTILINESTRING_PARSERS_ = { GML32.prototype.MULTILINESTRING_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'lineStringMember': makeArrayPusher( 'lineStringMember': makeArrayPusher(
GMLBase.prototype.lineStringMemberParser_ GMLBase.prototype.lineStringMemberParser
), ),
'lineStringMembers': makeArrayPusher( 'lineStringMembers': makeArrayPusher(
GMLBase.prototype.lineStringMemberParser_ GMLBase.prototype.lineStringMemberParser
), ),
}, },
}; };
@@ -214,32 +200,29 @@ GML32.prototype.MULTILINESTRING_PARSERS_ = {
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.MULTIPOLYGON_PARSERS_ = { GML32.prototype.MULTIPOLYGON_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'polygonMember': makeArrayPusher(GMLBase.prototype.polygonMemberParser_), 'polygonMember': makeArrayPusher(GMLBase.prototype.polygonMemberParser),
'polygonMembers': makeArrayPusher(GMLBase.prototype.polygonMemberParser_), 'polygonMembers': makeArrayPusher(GMLBase.prototype.polygonMemberParser),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.POINTMEMBER_PARSERS_ = { GML32.prototype.POINTMEMBER_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'Point': makeArrayPusher(GMLBase.prototype.readFlatCoordinatesFromNode_), 'Point': makeArrayPusher(GMLBase.prototype.readFlatCoordinatesFromNode),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.LINESTRINGMEMBER_PARSERS_ = { GML32.prototype.LINESTRINGMEMBER_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'LineString': makeArrayPusher(GMLBase.prototype.readLineString), 'LineString': makeArrayPusher(GMLBase.prototype.readLineString),
}, },
@@ -248,9 +231,8 @@ GML32.prototype.LINESTRINGMEMBER_PARSERS_ = {
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GML32.prototype.POLYGONMEMBER_PARSERS_ = { GML32.prototype.POLYGONMEMBER_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon), 'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon),
}, },
@@ -259,30 +241,27 @@ GML32.prototype.POLYGONMEMBER_PARSERS_ = {
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GML32.prototype.RING_PARSERS = { GML32.prototype.RING_PARSERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'LinearRing': makeReplacer(GMLBase.prototype.readFlatLinearRing_), 'LinearRing': makeReplacer(GMLBase.prototype.readFlatLinearRing),
}, },
}; };
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML32.prototype.RING_SERIALIZERS_ = { GML32.prototype.RING_SERIALIZERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'exterior': makeChildAppender(GML3.prototype.writeRing_), 'exterior': makeChildAppender(GML3.prototype.writeRing),
'interior': makeChildAppender(GML3.prototype.writeRing_), 'interior': makeChildAppender(GML3.prototype.writeRing),
}, },
}; };
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML32.prototype.ENVELOPE_SERIALIZERS_ = { GML32.prototype.ENVELOPE_SERIALIZERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'lowerCorner': makeChildAppender(writeStringTextNode), 'lowerCorner': makeChildAppender(writeStringTextNode),
'upperCorner': makeChildAppender(writeStringTextNode), 'upperCorner': makeChildAppender(writeStringTextNode),
@@ -291,68 +270,62 @@ GML32.prototype.ENVELOPE_SERIALIZERS_ = {
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML32.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { GML32.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'surfaceMember': makeChildAppender( 'surfaceMember': makeChildAppender(
GML3.prototype.writeSurfaceOrPolygonMember_ GML3.prototype.writeSurfaceOrPolygonMember
), ),
'polygonMember': makeChildAppender( 'polygonMember': makeChildAppender(
GML3.prototype.writeSurfaceOrPolygonMember_ GML3.prototype.writeSurfaceOrPolygonMember
), ),
}, },
}; };
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML32.prototype.POINTMEMBER_SERIALIZERS_ = { GML32.prototype.POINTMEMBER_SERIALIZERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'pointMember': makeChildAppender(GML3.prototype.writePointMember_), 'pointMember': makeChildAppender(GML3.prototype.writePointMember),
}, },
}; };
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML32.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { GML32.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'lineStringMember': makeChildAppender( 'lineStringMember': makeChildAppender(
GML3.prototype.writeLineStringOrCurveMember_ GML3.prototype.writeLineStringOrCurveMember
), ),
'curveMember': makeChildAppender( 'curveMember': makeChildAppender(
GML3.prototype.writeLineStringOrCurveMember_ GML3.prototype.writeLineStringOrCurveMember
), ),
}, },
}; };
/** /**
* @type {Object<string, Object<string, import("../xml.js").Serializer>>} * @type {Object<string, Object<string, import("../xml.js").Serializer>>}
* @private
*/ */
GML32.prototype.GEOMETRY_SERIALIZERS_ = { GML32.prototype.GEOMETRY_SERIALIZERS = {
'http://www.opengis.net/gml/3.2': { 'http://www.opengis.net/gml/3.2': {
'Curve': makeChildAppender(GML3.prototype.writeCurveOrLineString_), 'Curve': makeChildAppender(GML3.prototype.writeCurveOrLineString),
'MultiCurve': makeChildAppender( 'MultiCurve': makeChildAppender(GML3.prototype.writeMultiCurveOrLineString),
GML3.prototype.writeMultiCurveOrLineString_ 'Point': makeChildAppender(GML32.prototype.writePoint),
), 'MultiPoint': makeChildAppender(GML3.prototype.writeMultiPoint),
'Point': makeChildAppender(GML32.prototype.writePoint_), 'LineString': makeChildAppender(GML3.prototype.writeCurveOrLineString),
'MultiPoint': makeChildAppender(GML3.prototype.writeMultiPoint_),
'LineString': makeChildAppender(GML3.prototype.writeCurveOrLineString_),
'MultiLineString': makeChildAppender( 'MultiLineString': makeChildAppender(
GML3.prototype.writeMultiCurveOrLineString_ GML3.prototype.writeMultiCurveOrLineString
), ),
'LinearRing': makeChildAppender(GML3.prototype.writeLinearRing_), 'LinearRing': makeChildAppender(GML3.prototype.writeLinearRing),
'Polygon': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon_), 'Polygon': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon),
'MultiPolygon': makeChildAppender( 'MultiPolygon': makeChildAppender(
GML3.prototype.writeMultiSurfaceOrPolygon_ GML3.prototype.writeMultiSurfaceOrPolygon
), ),
'Surface': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon_), 'Surface': makeChildAppender(GML3.prototype.writeSurfaceOrPolygon),
'MultiSurface': makeChildAppender( 'MultiSurface': makeChildAppender(
GML3.prototype.writeMultiSurfaceOrPolygon_ GML3.prototype.writeMultiSurfaceOrPolygon
), ),
'Envelope': makeChildAppender(GML3.prototype.writeEnvelope), 'Envelope': makeChildAppender(GML3.prototype.writeEnvelope),
}, },

View File

@@ -347,10 +347,7 @@ class GMLBase extends XMLFeature {
* @return {Point|undefined} Point. * @return {Point|undefined} Point.
*/ */
readPoint(node, objectStack) { readPoint(node, objectStack) {
const flatCoordinates = this.readFlatCoordinatesFromNode_( const flatCoordinates = this.readFlatCoordinatesFromNode(node, objectStack);
node,
objectStack
);
if (flatCoordinates) { if (flatCoordinates) {
return new Point(flatCoordinates, GeometryLayout.XYZ); return new Point(flatCoordinates, GeometryLayout.XYZ);
} }
@@ -365,7 +362,7 @@ class GMLBase extends XMLFeature {
/** @type {Array<Array<number>>} */ /** @type {Array<Array<number>>} */
const coordinates = pushParseAndPop( const coordinates = pushParseAndPop(
[], [],
this.MULTIPOINT_PARSERS_, this.MULTIPOINT_PARSERS,
node, node,
objectStack, objectStack,
this this
@@ -386,7 +383,7 @@ class GMLBase extends XMLFeature {
/** @type {Array<LineString>} */ /** @type {Array<LineString>} */
const lineStrings = pushParseAndPop( const lineStrings = pushParseAndPop(
[], [],
this.MULTILINESTRING_PARSERS_, this.MULTILINESTRING_PARSERS,
node, node,
objectStack, objectStack,
this this
@@ -405,7 +402,7 @@ class GMLBase extends XMLFeature {
/** @type {Array<Polygon>} */ /** @type {Array<Polygon>} */
const polygons = pushParseAndPop( const polygons = pushParseAndPop(
[], [],
this.MULTIPOLYGON_PARSERS_, this.MULTIPOLYGON_PARSERS,
node, node,
objectStack, objectStack,
this this
@@ -418,28 +415,25 @@ class GMLBase extends XMLFeature {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
*/ */
pointMemberParser_(node, objectStack) { pointMemberParser(node, objectStack) {
parseNode(this.POINTMEMBER_PARSERS_, node, objectStack, this); parseNode(this.POINTMEMBER_PARSERS, node, objectStack, this);
} }
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
*/ */
lineStringMemberParser_(node, objectStack) { lineStringMemberParser(node, objectStack) {
parseNode(this.LINESTRINGMEMBER_PARSERS_, node, objectStack, this); parseNode(this.LINESTRINGMEMBER_PARSERS, node, objectStack, this);
} }
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
*/ */
polygonMemberParser_(node, objectStack) { polygonMemberParser(node, objectStack) {
parseNode(this.POLYGONMEMBER_PARSERS_, node, objectStack, this); parseNode(this.POLYGONMEMBER_PARSERS, node, objectStack, this);
} }
/** /**
@@ -448,10 +442,7 @@ class GMLBase extends XMLFeature {
* @return {LineString|undefined} LineString. * @return {LineString|undefined} LineString.
*/ */
readLineString(node, objectStack) { readLineString(node, objectStack) {
const flatCoordinates = this.readFlatCoordinatesFromNode_( const flatCoordinates = this.readFlatCoordinatesFromNode(node, objectStack);
node,
objectStack
);
if (flatCoordinates) { if (flatCoordinates) {
const lineString = new LineString(flatCoordinates, GeometryLayout.XYZ); const lineString = new LineString(flatCoordinates, GeometryLayout.XYZ);
return lineString; return lineString;
@@ -463,10 +454,9 @@ class GMLBase extends XMLFeature {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {Array<number>|undefined} LinearRing flat coordinates. * @return {Array<number>|undefined} LinearRing flat coordinates.
*/ */
readFlatLinearRing_(node, objectStack) { readFlatLinearRing(node, objectStack) {
const ring = pushParseAndPop( const ring = pushParseAndPop(
null, null,
this.GEOMETRY_FLAT_COORDINATES_PARSERS, this.GEOMETRY_FLAT_COORDINATES_PARSERS,
@@ -487,10 +477,7 @@ class GMLBase extends XMLFeature {
* @return {LinearRing|undefined} LinearRing. * @return {LinearRing|undefined} LinearRing.
*/ */
readLinearRing(node, objectStack) { readLinearRing(node, objectStack) {
const flatCoordinates = this.readFlatCoordinatesFromNode_( const flatCoordinates = this.readFlatCoordinatesFromNode(node, objectStack);
node,
objectStack
);
if (flatCoordinates) { if (flatCoordinates) {
return new LinearRing(flatCoordinates, GeometryLayout.XYZ); return new LinearRing(flatCoordinates, GeometryLayout.XYZ);
} }
@@ -527,10 +514,9 @@ class GMLBase extends XMLFeature {
/** /**
* @param {Element} node Node. * @param {Element} node Node.
* @param {Array<*>} objectStack Object stack. * @param {Array<*>} objectStack Object stack.
* @private
* @return {Array<number>} Flat coordinates. * @return {Array<number>} Flat coordinates.
*/ */
readFlatCoordinatesFromNode_(node, objectStack) { readFlatCoordinatesFromNode(node, objectStack) {
return pushParseAndPop( return pushParseAndPop(
null, null,
this.GEOMETRY_FLAT_COORDINATES_PARSERS, this.GEOMETRY_FLAT_COORDINATES_PARSERS,
@@ -589,7 +575,6 @@ GMLBase.prototype.namespace = GMLNS;
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GMLBase.prototype.FLAT_LINEAR_RINGS_PARSERS = { GMLBase.prototype.FLAT_LINEAR_RINGS_PARSERS = {
'http://www.opengis.net/gml': {}, 'http://www.opengis.net/gml': {},
@@ -598,7 +583,6 @@ GMLBase.prototype.FLAT_LINEAR_RINGS_PARSERS = {
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GMLBase.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = { GMLBase.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {
'http://www.opengis.net/gml': {}, 'http://www.opengis.net/gml': {},
@@ -607,7 +591,6 @@ GMLBase.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GMLBase.prototype.GEOMETRY_PARSERS = { GMLBase.prototype.GEOMETRY_PARSERS = {
'http://www.opengis.net/gml': {}, 'http://www.opengis.net/gml': {},
@@ -616,27 +599,25 @@ GMLBase.prototype.GEOMETRY_PARSERS = {
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GMLBase.prototype.MULTIPOINT_PARSERS_ = { GMLBase.prototype.MULTIPOINT_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'pointMember': makeArrayPusher(GMLBase.prototype.pointMemberParser_), 'pointMember': makeArrayPusher(GMLBase.prototype.pointMemberParser),
'pointMembers': makeArrayPusher(GMLBase.prototype.pointMemberParser_), 'pointMembers': makeArrayPusher(GMLBase.prototype.pointMemberParser),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GMLBase.prototype.MULTILINESTRING_PARSERS_ = { GMLBase.prototype.MULTILINESTRING_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lineStringMember': makeArrayPusher( 'lineStringMember': makeArrayPusher(
GMLBase.prototype.lineStringMemberParser_ GMLBase.prototype.lineStringMemberParser
), ),
'lineStringMembers': makeArrayPusher( 'lineStringMembers': makeArrayPusher(
GMLBase.prototype.lineStringMemberParser_ GMLBase.prototype.lineStringMemberParser
), ),
}, },
}; };
@@ -644,32 +625,29 @@ GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GMLBase.prototype.MULTIPOLYGON_PARSERS_ = { GMLBase.prototype.MULTIPOLYGON_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'polygonMember': makeArrayPusher(GMLBase.prototype.polygonMemberParser_), 'polygonMember': makeArrayPusher(GMLBase.prototype.polygonMemberParser),
'polygonMembers': makeArrayPusher(GMLBase.prototype.polygonMemberParser_), 'polygonMembers': makeArrayPusher(GMLBase.prototype.polygonMemberParser),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GMLBase.prototype.POINTMEMBER_PARSERS_ = { GMLBase.prototype.POINTMEMBER_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'Point': makeArrayPusher(GMLBase.prototype.readFlatCoordinatesFromNode_), 'Point': makeArrayPusher(GMLBase.prototype.readFlatCoordinatesFromNode),
}, },
}; };
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = { GMLBase.prototype.LINESTRINGMEMBER_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'LineString': makeArrayPusher(GMLBase.prototype.readLineString), 'LineString': makeArrayPusher(GMLBase.prototype.readLineString),
}, },
@@ -678,9 +656,8 @@ GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @private
*/ */
GMLBase.prototype.POLYGONMEMBER_PARSERS_ = { GMLBase.prototype.POLYGONMEMBER_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon), 'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon),
}, },
@@ -689,11 +666,10 @@ GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
/** /**
* @const * @const
* @type {Object<string, Object<string, import("../xml.js").Parser>>} * @type {Object<string, Object<string, import("../xml.js").Parser>>}
* @protected
*/ */
GMLBase.prototype.RING_PARSERS = { GMLBase.prototype.RING_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'LinearRing': makeReplacer(GMLBase.prototype.readFlatLinearRing_), 'LinearRing': makeReplacer(GMLBase.prototype.readFlatLinearRing),
}, },
}; };