Add parsing for gml:Curve
This commit is contained in:
@@ -132,6 +132,26 @@ ol.format.GML.patchesParser_ = function(node, objectStack) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @private
|
||||
* @return {Array.<number>} flat coordinates.
|
||||
*/
|
||||
ol.format.GML.segmentsParser_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
|
||||
goog.asserts.assert(node.localName == 'segments');
|
||||
var result = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>} */ ([null]),
|
||||
ol.format.GML.SEGMENTS_PARSERS_, node, objectStack);
|
||||
if (!goog.isDef(result)) {
|
||||
return null;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
@@ -152,6 +172,26 @@ ol.format.GML.polygonPatchParser_ = function(node, objectStack) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @private
|
||||
* @return {Array.<number>} flat coordinates.
|
||||
*/
|
||||
ol.format.GML.lineStringSegmentParser_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
|
||||
goog.asserts.assert(node.localName == 'LineStringSegment');
|
||||
var result = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>} */ ([null]),
|
||||
ol.format.GML.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack);
|
||||
if (!goog.isDef(result)) {
|
||||
return null;
|
||||
} else {
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
@@ -292,6 +332,28 @@ ol.format.GML.readSurface_ = function(node, objectStack) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @private
|
||||
* @return {ol.geom.LineString|undefined} LineString.
|
||||
*/
|
||||
ol.format.GML.readCurve_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
|
||||
goog.asserts.assert(node.localName == 'Curve');
|
||||
var flatCoordinates = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<number>} */ ([null]),
|
||||
ol.format.GML.CURVE_PARSERS_, node, objectStack);
|
||||
if (goog.isDefAndNotNull(flatCoordinates)) {
|
||||
var lineString = new ol.geom.LineString(null);
|
||||
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
|
||||
return lineString;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
@@ -360,7 +422,8 @@ ol.format.GML.GEOMETRY_PARSERS_ = ol.xml.makeParsersNS(
|
||||
'LineString': ol.xml.makeArrayPusher(ol.format.GML.readLineString_),
|
||||
'LinearRing' : ol.xml.makeArrayPusher(ol.format.GML.readLinearRing_),
|
||||
'Polygon': ol.xml.makeArrayPusher(ol.format.GML.readPolygon_),
|
||||
'Surface': ol.xml.makeArrayPusher(ol.format.GML.readSurface_)
|
||||
'Surface': ol.xml.makeArrayPusher(ol.format.GML.readSurface_),
|
||||
'Curve': ol.xml.makeArrayPusher(ol.format.GML.readCurve_)
|
||||
});
|
||||
|
||||
|
||||
@@ -399,6 +462,17 @@ ol.format.GML.SURFACE_PARSERS_ = ol.xml.makeParsersNS(
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML.CURVE_PARSERS_ = ol.xml.makeParsersNS(
|
||||
ol.format.GML.NAMESPACE_URIS_, {
|
||||
'segments': ol.xml.makeReplacer(ol.format.GML.segmentsParser_)
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
|
||||
@@ -410,6 +484,18 @@ ol.format.GML.PATCHES_PARSERS_ = ol.xml.makeParsersNS(
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
|
||||
* @private
|
||||
*/
|
||||
ol.format.GML.SEGMENTS_PARSERS_ = ol.xml.makeParsersNS(
|
||||
ol.format.GML.NAMESPACE_URIS_, {
|
||||
'LineStringSegment': ol.xml.makeReplacer(
|
||||
ol.format.GML.lineStringSegmentParser_)
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.xml.Parser>>}
|
||||
|
||||
Reference in New Issue
Block a user