Implement read transforms for ol.format.OSMXML

This commit is contained in:
tsauerwein
2014-08-08 17:25:05 +02:00
parent b05f880f7c
commit bfb6c2e3b8
2 changed files with 109 additions and 1 deletions

View File

@@ -189,6 +189,7 @@ ol.format.OSMXML.NODE_PARSERS_ = ol.xml.makeParsersNS(
*
* @function
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
* @param {olx.format.ReadOptions=} opt_options Read options.
* @return {Array.<ol.Feature>} Features.
* @api
*/
@@ -198,7 +199,7 @@ ol.format.OSMXML.prototype.readFeatures;
/**
* @inheritDoc
*/
ol.format.OSMXML.prototype.readFeaturesFromNode = function(node) {
ol.format.OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
if (node.localName == 'osm') {
var state = ol.xml.pushParseAndPop({
@@ -206,6 +207,8 @@ ol.format.OSMXML.prototype.readFeaturesFromNode = function(node) {
features: []
}, ol.format.OSMXML.PARSERS_, node, []);
if (goog.isDef(state.features)) {
ol.format.XMLFeature.transformFeaturesWithOptions(
state.features, false, this.getReadOptions(node, opt_options));
return state.features;
}
}