Get tilePixelRatio from MVT tiles

This commit is contained in:
Andreas Hocevar
2017-08-02 17:45:55 +02:00
parent 007d8c2d5e
commit b3be7e7ba9
11 changed files with 113 additions and 25 deletions

View File

@@ -72,6 +72,15 @@ ol.format.Feature.prototype.adaptOptions = function(options) {
};
/**
* Get the extent from the source of the last {@link readFeatures} call.
* @return {ol.Extent} Tile extent.
*/
ol.format.Feature.prototype.getLastExtent = function() {
return null;
};
/**
* @abstract
* @return {ol.format.FormatType} Format.

View File

@@ -69,10 +69,25 @@ ol.format.MVT = function(opt_options) {
*/
this.layers_ = options.layers ? options.layers : null;
/**
* @private
* @type {ol.Extent}
*/
this.extent_ = null;
};
ol.inherits(ol.format.MVT, ol.format.Feature);
/**
* @inheritDoc
* @api
*/
ol.format.MVT.prototype.getLastExtent = function() {
return this.extent_;
};
/**
* @inheritDoc
*/
@@ -161,14 +176,17 @@ ol.format.MVT.prototype.readFeatures = function(source, opt_options) {
}
layer = tile.layers[name];
var rawFeature;
for (var i = 0, ii = layer.length; i < ii; ++i) {
rawFeature = layer.feature(i);
if (featureClass === ol.render.Feature) {
feature = this.readRenderFeature_(layer.feature(i), name);
feature = this.readRenderFeature_(rawFeature, name);
} else {
feature = this.readFeature_(layer.feature(i), name, opt_options);
feature = this.readFeature_(rawFeature, name, opt_options);
}
features.push(feature);
}
this.extent_ = layer ? [0, 0, layer.extent, layer.extent] : null;
}
return features;