diff --git a/src/ol/format/featureformat.js b/src/ol/format/featureformat.js index 0243780755..364ba16a86 100644 --- a/src/ol/format/featureformat.js +++ b/src/ol/format/featureformat.js @@ -1,6 +1,7 @@ goog.provide('ol.format.Feature'); -goog.require('goog.functions'); +goog.require('goog.array'); +goog.require('ol.geom.Geometry'); goog.require('ol.proj'); @@ -150,25 +151,33 @@ ol.format.Feature.prototype.writeGeometry = goog.abstractMethod; /** - * @param {ol.geom.Geometry} geometry Geometry. + * @param {ol.geom.Geometry|ol.Extent} geometry Geometry. * @param {boolean} write Set to true for writing, false for reading. - * @param {boolean} clone The geometry will be cloned before transforming. * @param {(olx.format.WriteOptions|olx.format.ReadOptions)=} opt_options * Options. - * @return {ol.geom.Geometry} Transformed geometry. + * @return {ol.geom.Geometry|ol.Extent} Transformed geometry. * @protected */ ol.format.Feature.transformWithOptions = function( - geometry, write, clone, opt_options) { + geometry, write, opt_options) { var featureProjection = goog.isDef(opt_options) ? ol.proj.get(opt_options.featureProjection) : null; var dataProjection = goog.isDef(opt_options) ? ol.proj.get(opt_options.dataProjection) : null; if (!goog.isNull(featureProjection) && !goog.isNull(dataProjection) && !ol.proj.equivalent(featureProjection, dataProjection)) { - return (clone ? geometry.clone() : geometry).transform( - write ? featureProjection : dataProjection, - write ? dataProjection : featureProjection); + if (geometry instanceof ol.geom.Geometry) { + return (write ? geometry.clone() : geometry).transform( + write ? featureProjection : dataProjection, + write ? dataProjection : featureProjection); + } else { + // FIXME this is necessary because ol.format.GML treats extents + // as geometries + return ol.proj.transformExtent( + write ? goog.array.clone(geometry) : geometry, + write ? featureProjection : dataProjection, + write ? dataProjection : featureProjection); + } } else { return geometry; } diff --git a/src/ol/format/geojsonformat.js b/src/ol/format/geojsonformat.js index 3c34782ee9..17c4f4a9c6 100644 --- a/src/ol/format/geojsonformat.js +++ b/src/ol/format/geojsonformat.js @@ -75,8 +75,9 @@ ol.format.GeoJSON.readGeometry_ = function(object, opt_options) { } var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type]; goog.asserts.assert(goog.isDef(geometryReader)); - return ol.format.Feature.transformWithOptions( - geometryReader(object), false, false, opt_options); + return /** @type {ol.geom.Geometry} */ ( + ol.format.Feature.transformWithOptions( + geometryReader(object), false, opt_options)); }; @@ -176,9 +177,8 @@ ol.format.GeoJSON.readPolygonGeometry_ = function(object) { ol.format.GeoJSON.writeGeometry_ = function(geometry, opt_options) { var geometryWriter = ol.format.GeoJSON.GEOMETRY_WRITERS_[geometry.getType()]; goog.asserts.assert(goog.isDef(geometryWriter)); - return geometryWriter( - ol.format.Feature.transformWithOptions( - geometry, true, true, opt_options)); + return geometryWriter(/** @type {ol.geom.Geometry} */ ( + ol.format.Feature.transformWithOptions(geometry, true, opt_options))); }; diff --git a/src/ol/format/gmlformat.js b/src/ol/format/gmlformat.js index c771cb7d6c..3e2cdada0b 100644 --- a/src/ol/format/gmlformat.js +++ b/src/ol/format/gmlformat.js @@ -1,3 +1,6 @@ +// FIXME Envelopes should not be treated as geometries! readEnvelope_ is part +// of GEOMETRY_PARSERS_ and methods using GEOMETRY_PARSERS_ do not expect +// envelopes/extents, only geometries! goog.provide('ol.format.GML'); goog.require('goog.asserts'); @@ -162,8 +165,8 @@ ol.format.GML.readGeometry = function(node, objectStack) { var geometry = ol.xml.pushParseAndPop(/** @type {ol.geom.Geometry} */(null), ol.format.GML.GEOMETRY_PARSERS_, node, objectStack); if (goog.isDefAndNotNull(geometry)) { - return ol.format.Feature.transformWithOptions( - geometry, false, false, context); + return /** @type {ol.geom.Geometry} */ ( + ol.format.Feature.transformWithOptions(geometry, false, context)); } else { return undefined; } @@ -1469,7 +1472,7 @@ ol.format.GML.writeGeometry = function(node, geometry, objectStack) { } else { goog.asserts.assertInstanceof(geometry, ol.geom.Geometry); value = - ol.format.Feature.transformWithOptions(geometry, true, true, context); + ol.format.Feature.transformWithOptions(geometry, true, context); } ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ (item), ol.format.GML.GEOMETRY_SERIALIZERS_, diff --git a/src/ol/format/gpxformat.js b/src/ol/format/gpxformat.js index 707c11778f..3fcae43c0a 100644 --- a/src/ol/format/gpxformat.js +++ b/src/ol/format/gpxformat.js @@ -5,6 +5,7 @@ goog.require('goog.asserts'); goog.require('goog.dom.NodeType'); goog.require('goog.object'); goog.require('ol.Feature'); +goog.require('ol.format.Feature'); goog.require('ol.format.XMLFeature'); goog.require('ol.format.XSD'); goog.require('ol.geom.LineString'); @@ -180,6 +181,7 @@ ol.format.GPX.parseTrkSeg_ = function(node, objectStack) { ol.format.GPX.readRte_ = function(node, objectStack) { goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT); goog.asserts.assert(node.localName == 'rte'); + var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var values = ol.xml.pushParseAndPop({ 'flatCoordinates': [] }, ol.format.GPX.RTE_PARSERS_, node, objectStack); @@ -191,6 +193,7 @@ ol.format.GPX.readRte_ = function(node, objectStack) { goog.object.remove(values, 'flatCoordinates'); var geometry = new ol.geom.LineString(null); geometry.setFlatCoordinates(ol.geom.GeometryLayout.XYZM, flatCoordinates); + ol.format.Feature.transformWithOptions(geometry, false, options); var feature = new ol.Feature(geometry); feature.setProperties(values); return feature; @@ -206,6 +209,7 @@ ol.format.GPX.readRte_ = function(node, objectStack) { ol.format.GPX.readTrk_ = function(node, objectStack) { goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT); goog.asserts.assert(node.localName == 'trk'); + var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var values = ol.xml.pushParseAndPop({ 'flatCoordinates': [], 'ends': [] @@ -221,6 +225,7 @@ ol.format.GPX.readTrk_ = function(node, objectStack) { var geometry = new ol.geom.MultiLineString(null); geometry.setFlatCoordinates( ol.geom.GeometryLayout.XYZM, flatCoordinates, ends); + ol.format.Feature.transformWithOptions(geometry, false, options); var feature = new ol.Feature(geometry); feature.setProperties(values); return feature; @@ -236,6 +241,7 @@ ol.format.GPX.readTrk_ = function(node, objectStack) { ol.format.GPX.readWpt_ = function(node, objectStack) { goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT); goog.asserts.assert(node.localName == 'wpt'); + var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var values = ol.xml.pushParseAndPop( {}, ol.format.GPX.WPT_PARSERS_, node, objectStack); if (!goog.isDef(values)) { @@ -244,6 +250,7 @@ ol.format.GPX.readWpt_ = function(node, objectStack) { var coordinates = ol.format.GPX.appendCoordinate_([], node, values); var geometry = new ol.geom.Point( coordinates, ol.geom.GeometryLayout.XYZM); + ol.format.Feature.transformWithOptions(geometry, false, options); var feature = new ol.Feature(geometry); feature.setProperties(values); return feature; @@ -439,13 +446,11 @@ ol.format.GPX.prototype.readFeatureFromNode = function(node, opt_options) { if (!goog.isDef(featureReader)) { return null; } - var feature = featureReader(node, []); + var feature = featureReader(node, [this.getReadOptions(node, opt_options)]); if (!goog.isDef(feature)) { return null; } this.handleReadExtensions_([feature]); - ol.format.XMLFeature.transformFeaturesWithOptions( - [feature], false, this.getReadOptions(node, opt_options)); return feature; }; @@ -473,11 +478,9 @@ ol.format.GPX.prototype.readFeaturesFromNode = function(node, opt_options) { if (node.localName == 'gpx') { var features = ol.xml.pushParseAndPop( /** @type {Array.} */ ([]), ol.format.GPX.GPX_PARSERS_, - node, []); + node, [this.getReadOptions(node, opt_options)]); if (goog.isDef(features)) { this.handleReadExtensions_(features); - ol.format.XMLFeature.transformFeaturesWithOptions( - features, false, this.getReadOptions(node, opt_options)); return features; } else { return []; @@ -585,11 +588,14 @@ ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) { * @private */ ol.format.GPX.writeRte_ = function(node, feature, objectStack) { + var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); var properties = feature.getProperties(); var context = {node: node, 'properties': properties}; var geometry = feature.getGeometry(); if (goog.isDef(geometry)) { goog.asserts.assertInstanceof(geometry, ol.geom.LineString); + geometry = /** @type {ol.geom.LineString} */ + (ol.format.Feature.transformWithOptions(geometry, true, options)); goog.object.set(context, 'geometryLayout', geometry.getLayout()); goog.object.set(properties, 'rtept', geometry.getCoordinates()); } @@ -609,11 +615,14 @@ ol.format.GPX.writeRte_ = function(node, feature, objectStack) { * @private */ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) { + var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); var properties = feature.getProperties(); var context = {node: node, 'properties': properties}; var geometry = feature.getGeometry(); if (goog.isDef(geometry)) { goog.asserts.assertInstanceof(geometry, ol.geom.MultiLineString); + geometry = /** @type {ol.geom.MultiLineString} */ + (ol.format.Feature.transformWithOptions(geometry, true, options)); goog.object.set(properties, 'trkseg', geometry.getLineStrings()); } var parentNode = objectStack[objectStack.length - 1].node; @@ -647,12 +656,15 @@ ol.format.GPX.writeTrkSeg_ = function(node, lineString, objectStack) { * @private */ ol.format.GPX.writeWpt_ = function(node, feature, objectStack) { + var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); var context = objectStack[objectStack.length - 1]; goog.asserts.assert(goog.isObject(context)); goog.object.set(context, 'properties', feature.getProperties()); var geometry = feature.getGeometry(); if (goog.isDef(geometry)) { goog.asserts.assertInstanceof(geometry, ol.geom.Point); + geometry = /** @type {ol.geom.Point} */ + (ol.format.Feature.transformWithOptions(geometry, true, options)); goog.object.set(context, 'geometryLayout', geometry.getLayout()); ol.format.GPX.writeWptType_(node, geometry.getCoordinates(), objectStack); } @@ -870,11 +882,8 @@ ol.format.GPX.prototype.writeFeaturesNode = function(features, opt_options) { //FIXME Serialize metadata var gpx = ol.xml.createElementNS('http://www.topografix.com/GPX/1/1', 'gpx'); - features = ol.format.XMLFeature.transformFeaturesWithOptions( - features, true, opt_options); - ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ ({node: gpx}), ol.format.GPX.GPX_SERIALIZERS_, - ol.format.GPX.GPX_NODE_FACTORY_, features, []); + ol.format.GPX.GPX_NODE_FACTORY_, features, [opt_options]); return gpx; }; diff --git a/src/ol/format/igcformat.js b/src/ol/format/igcformat.js index d1347e9e39..841e608fa0 100644 --- a/src/ol/format/igcformat.js +++ b/src/ol/format/igcformat.js @@ -175,7 +175,7 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) { ol.geom.GeometryLayout.XYM : ol.geom.GeometryLayout.XYZM; lineString.setFlatCoordinates(layout, flatCoordinates); var feature = new ol.Feature(ol.format.Feature.transformWithOptions( - lineString, false, false, opt_options)); + lineString, false, opt_options)); feature.setProperties(properties); return feature; }; diff --git a/src/ol/format/kmlformat.js b/src/ol/format/kmlformat.js index fa4d28948a..85e369f011 100644 --- a/src/ol/format/kmlformat.js +++ b/src/ol/format/kmlformat.js @@ -16,6 +16,7 @@ goog.require('ol.Feature'); goog.require('ol.array'); goog.require('ol.color'); goog.require('ol.feature'); +goog.require('ol.format.Feature'); goog.require('ol.format.XMLFeature'); goog.require('ol.format.XSD'); goog.require('ol.geom.Geometry'); @@ -1431,6 +1432,10 @@ ol.format.KML.prototype.readPlacemark_ = function(node, objectStack) { if (!goog.isNull(id)) { feature.setId(id); } + var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); + if (goog.isDefAndNotNull(object.geometry)) { + ol.format.Feature.transformWithOptions(object.geometry, false, options); + } feature.setProperties(object); feature.setStyle(this.featureStyleFunction_); return feature; @@ -1508,10 +1513,9 @@ ol.format.KML.prototype.readFeatureFromNode = function(node, opt_options) { return null; } goog.asserts.assert(node.localName == 'Placemark'); - var feature = this.readPlacemark_(node, []); + var feature = this.readPlacemark_( + node, [this.getReadOptions(node, opt_options)]); if (goog.isDef(feature)) { - ol.format.XMLFeature.transformFeaturesWithOptions( - [feature], false, this.getReadOptions(node, opt_options)); return feature; } else { return null; @@ -1542,19 +1546,17 @@ ol.format.KML.prototype.readFeaturesFromNode = function(node, opt_options) { var features; var localName = ol.xml.getLocalName(node); if (localName == 'Document' || localName == 'Folder') { - features = this.readDocumentOrFolder_(node, []); + features = this.readDocumentOrFolder_( + node, [this.getReadOptions(node, opt_options)]); if (goog.isDef(features)) { - ol.format.XMLFeature.transformFeaturesWithOptions( - features, false, this.getReadOptions(node, opt_options)); return features; } else { return []; } } else if (localName == 'Placemark') { - var feature = this.readPlacemark_(node, []); + var feature = this.readPlacemark_( + node, [this.getReadOptions(node, opt_options)]); if (goog.isDef(feature)) { - ol.format.XMLFeature.transformFeaturesWithOptions( - [feature], false, this.getReadOptions(node, opt_options)); return [feature]; } else { return []; @@ -1966,9 +1968,14 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) { ol.xml.OBJECT_PROPERTY_NODE_FACTORY, values, objectStack, orderedKeys); // serialize geometry + var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); + var geometry = feature.getGeometry(); + if (goog.isDefAndNotNull(geometry)) { + geometry = + ol.format.Feature.transformWithOptions(geometry, true, options); + } ol.xml.pushSerializeAndPop(context, ol.format.KML.PLACEMARK_SERIALIZERS_, - ol.format.KML.GEOMETRY_NODE_FACTORY_, - [feature.getGeometry()], objectStack); + ol.format.KML.GEOMETRY_NODE_FACTORY_, [geometry], objectStack); }; @@ -2527,9 +2534,6 @@ ol.format.KML.prototype.writeFeaturesNode = function(features, opt_options) { ol.xml.setAttributeNS(kml, xmlSchemaInstanceUri, 'xsi:schemaLocation', ol.format.KML.SCHEMA_LOCATION_); - features = ol.format.XMLFeature.transformFeaturesWithOptions( - features, true, opt_options); - var /** @type {ol.xml.NodeStackItem} */ context = {node: kml}; var properties = {}; if (features.length > 1) { @@ -2540,6 +2544,6 @@ ol.format.KML.prototype.writeFeaturesNode = function(features, opt_options) { var orderedKeys = ol.format.KML.KML_SEQUENCE_[kml.namespaceURI]; var values = ol.xml.makeSequence(properties, orderedKeys); ol.xml.pushSerializeAndPop(context, ol.format.KML.KML_SERIALIZERS_, - ol.xml.OBJECT_PROPERTY_NODE_FACTORY, values, [], orderedKeys); + ol.xml.OBJECT_PROPERTY_NODE_FACTORY, values, [opt_options], orderedKeys); return kml; }; diff --git a/src/ol/format/osmxmlformat.js b/src/ol/format/osmxmlformat.js index 7831e7f32f..fb23b224a2 100644 --- a/src/ol/format/osmxmlformat.js +++ b/src/ol/format/osmxmlformat.js @@ -6,6 +6,7 @@ goog.require('goog.asserts'); goog.require('goog.dom.NodeType'); goog.require('goog.object'); goog.require('ol.Feature'); +goog.require('ol.format.Feature'); goog.require('ol.format.XMLFeature'); goog.require('ol.geom.LineString'); goog.require('ol.geom.Point'); @@ -59,6 +60,7 @@ ol.format.OSMXML.prototype.getExtensions = function() { ol.format.OSMXML.readNode_ = function(node, objectStack) { goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT); goog.asserts.assert(node.localName == 'node'); + var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var state = /** @type {Object} */ (objectStack[objectStack.length - 1]); var id = node.getAttribute('id'); var coordinates = /** @type {Array.} */ ([ @@ -72,6 +74,7 @@ ol.format.OSMXML.readNode_ = function(node, objectStack) { }, ol.format.OSMXML.NODE_PARSERS_, node, objectStack); if (!goog.object.isEmpty(values.tags)) { var geometry = new ol.geom.Point(coordinates); + ol.format.Feature.transformWithOptions(geometry, false, options); var feature = new ol.Feature(geometry); feature.setId(id); feature.setProperties(values.tags); @@ -88,6 +91,7 @@ ol.format.OSMXML.readNode_ = function(node, objectStack) { ol.format.OSMXML.readWay_ = function(node, objectStack) { goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT); goog.asserts.assert(node.localName == 'way'); + var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var id = node.getAttribute('id'); var values = ol.xml.pushParseAndPop({ ndrefs: [], @@ -109,6 +113,7 @@ ol.format.OSMXML.readWay_ = function(node, objectStack) { geometry = new ol.geom.LineString(null); geometry.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates); } + ol.format.Feature.transformWithOptions(geometry, false, options); var feature = new ol.Feature(geometry); feature.setId(id); feature.setProperties(values.tags); @@ -206,14 +211,13 @@ ol.format.OSMXML.prototype.readFeatures; */ ol.format.OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) { goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT); + var options = this.getReadOptions(node, opt_options); if (node.localName == 'osm') { var state = ol.xml.pushParseAndPop({ nodes: {}, features: [] - }, ol.format.OSMXML.PARSERS_, node, []); + }, ol.format.OSMXML.PARSERS_, node, [options]); if (goog.isDef(state.features)) { - ol.format.XMLFeature.transformFeaturesWithOptions( - state.features, false, this.getReadOptions(node, opt_options)); return state.features; } } diff --git a/src/ol/format/polylineformat.js b/src/ol/format/polylineformat.js index 0cb41b57bb..c80e423565 100644 --- a/src/ol/format/polylineformat.js +++ b/src/ol/format/polylineformat.js @@ -314,9 +314,10 @@ ol.format.Polyline.prototype.readGeometryFromText = var coordinates = ol.geom.flat.inflate.coordinates( flatCoordinates, 0, flatCoordinates.length, 2); - return ol.format.Feature.transformWithOptions( - new ol.geom.LineString(coordinates), false, false, - this.adaptOptionsWithDefaultDataProjection(opt_options)); + return /** @type {ol.geom.Geometry} */ ( + ol.format.Feature.transformWithOptions( + new ol.geom.LineString(coordinates), false, + this.adaptOptionsWithDefaultDataProjection(opt_options))); }; @@ -383,7 +384,7 @@ ol.format.Polyline.prototype.writeGeometryText = goog.asserts.assertInstanceof(geometry, ol.geom.LineString); geometry = /** @type {ol.geom.LineString} */ (ol.format.Feature.transformWithOptions( - geometry, true, true, + geometry, true, this.adaptOptionsWithDefaultDataProjection(opt_options))); var flatCoordinates = geometry.getFlatCoordinates(); var stride = geometry.getStride(); diff --git a/src/ol/format/topojsonformat.js b/src/ol/format/topojsonformat.js index ab7bd47794..7c9e74d2a7 100644 --- a/src/ol/format/topojsonformat.js +++ b/src/ol/format/topojsonformat.js @@ -259,8 +259,8 @@ ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs, geometry = geometryReader(object, arcs); } var feature = new ol.Feature(); - feature.setGeometry(ol.format.Feature.transformWithOptions( - geometry, false, false, opt_options)); + feature.setGeometry(/** @type {ol.geom.Geometry} */ ( + ol.format.Feature.transformWithOptions(geometry, false, opt_options))); if (goog.isDef(object.id)) { feature.setId(object.id); } diff --git a/src/ol/format/wfsformat.js b/src/ol/format/wfsformat.js index ca7eea37d1..d4098c2ee5 100644 --- a/src/ol/format/wfsformat.js +++ b/src/ol/format/wfsformat.js @@ -105,17 +105,18 @@ ol.format.WFS.prototype.readFeatures; * @inheritDoc */ ol.format.WFS.prototype.readFeaturesFromNode = function(node, opt_options) { - var objectStack = [{ + var context = { 'featureType': this.featureType_, 'featureNS': this.featureNS_ - }]; + }; + goog.object.extend(context, this.getReadOptions(node, + goog.isDef(opt_options) ? opt_options : {})); + var objectStack = [context]; var features = ol.xml.pushParseAndPop([], ol.format.GML.FEATURE_COLLECTION_PARSERS, node, objectStack); if (!goog.isDef(features)) { features = []; } - ol.format.XMLFeature.transformFeaturesWithOptions( - features, false, this.getReadOptions(node, opt_options)); return features; }; diff --git a/src/ol/format/wktformat.js b/src/ol/format/wktformat.js index d0c1f0a930..328e95537a 100644 --- a/src/ol/format/wktformat.js +++ b/src/ol/format/wktformat.js @@ -283,8 +283,8 @@ ol.format.WKT.prototype.readGeometry; ol.format.WKT.prototype.readGeometryFromText = function(text, opt_options) { var geometry = this.parse_(text); if (goog.isDef(geometry)) { - return ol.format.Feature.transformWithOptions( - geometry, false, false, opt_options); + return /** @type {ol.geom.Geometry} */ ( + ol.format.Feature.transformWithOptions(geometry, false, opt_options)); } else { return null; } @@ -366,8 +366,8 @@ ol.format.WKT.prototype.writeGeometry; * @inheritDoc */ ol.format.WKT.prototype.writeGeometryText = function(geometry, opt_options) { - return ol.format.WKT.encode_(ol.format.Feature.transformWithOptions( - geometry, true, true, opt_options)); + return ol.format.WKT.encode_(/** @type {ol.geom.Geometry} */ ( + ol.format.Feature.transformWithOptions(geometry, true, opt_options))); }; diff --git a/src/ol/format/xmlfeatureformat.js b/src/ol/format/xmlfeatureformat.js index 90ecddc10f..319de0c18d 100644 --- a/src/ol/format/xmlfeatureformat.js +++ b/src/ol/format/xmlfeatureformat.js @@ -250,39 +250,3 @@ ol.format.XMLFeature.prototype.writeGeometry = function(geometry, opt_options) { * @return {Node} Node. */ ol.format.XMLFeature.prototype.writeGeometryNode = goog.abstractMethod; - - -/** - * @param {Array.} features Features. - * @param {boolean} write Set to true for writing, false for reading. For - * writing, the features will be cloned before transforming. - * @param {(olx.format.WriteOptions|olx.format.ReadOptions)=} opt_options - * Options. - * @protected - * @return {Array.} Features. - */ -ol.format.XMLFeature.transformFeaturesWithOptions = function( - features, write, opt_options) { - var featureProjection = goog.isDef(opt_options) ? - ol.proj.get(opt_options.featureProjection) : null; - var dataProjection = goog.isDef(opt_options) ? - ol.proj.get(opt_options.dataProjection) : null; - - if (!goog.isNull(featureProjection) && !goog.isNull(dataProjection) && - !ol.proj.equivalent(featureProjection, dataProjection)) { - if (write) { - features = goog.array.map(features, function(feature) { - return feature.clone(); - }); - } - - goog.array.forEach(features, function(feature) { - var geom = feature.getGeometry(); - if (goog.isDef(geom)) { - feature.setGeometry(ol.format.Feature.transformWithOptions( - geom, write, false, opt_options)); - } - }); - } - return features; -};