getProjection method on parsers

With this, vector sources/layers do not need to make
assumptions on the data projection.
This commit is contained in:
ahocevar
2013-07-22 15:02:08 +02:00
parent 82a158bdd2
commit 55697dea28
4 changed files with 21 additions and 6 deletions

View File

@@ -418,7 +418,7 @@ ol.layer.Vector.prototype.groupFeaturesBySymbolizerLiteral =
/**
* @param {Object|Element|Document|string} data Feature data.
* @param {ol.parser.Parser} parser Feature parser.
* @param {ol.parser.FeatureParser} parser Feature parser.
* @param {ol.Projection} projection This sucks. The layer should be a view in
* one projection.
*/
@@ -439,6 +439,9 @@ ol.layer.Vector.prototype.parseFeatures = function(data, parser, projection) {
var addFeatures = function(features) {
var sourceProjection = this.getSource().getProjection();
if (goog.isNull(sourceProjection)) {
sourceProjection = parser.getProjection();
}
var transform = ol.proj.getTransform(sourceProjection, projection);
transform(