Delegate transformation to ol.format.*

Fixes #2604.
This commit is contained in:
Erik Timmers
2014-08-30 08:56:43 +02:00
parent 36e5fb8bdc
commit 1da5be6ffb

View File

@@ -12,7 +12,6 @@ goog.require('goog.net.XhrIo.ResponseType');
goog.require('goog.userAgent');
goog.require('ol.format.FormatType');
goog.require('ol.has');
goog.require('ol.proj');
goog.require('ol.source.State');
goog.require('ol.source.Vector');
goog.require('ol.xml');
@@ -119,21 +118,6 @@ ol.source.FormatVector.prototype.loadFeaturesFromURL =
*/
ol.source.FormatVector.prototype.readFeatures = function(source) {
var format = this.format;
var features = format.readFeatures(source);
var featureProjection = format.readProjection(source);
var projection = this.getProjection();
if (!goog.isNull(projection) && !goog.isNull(featureProjection)) {
if (!ol.proj.equivalent(featureProjection, projection)) {
var transform = ol.proj.getTransform(featureProjection, projection);
var i, ii;
for (i = 0, ii = features.length; i < ii; ++i) {
var feature = features[i];
var geometry = feature.getGeometry();
if (goog.isDefAndNotNull(geometry)) {
geometry.applyTransform(transform);
}
}
}
}
return features;
return format.readFeatures(source, {featureProjection: projection});
};