diff --git a/externs/olx.js b/externs/olx.js index 3591e56cc1..ebf684f3b2 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -3864,7 +3864,6 @@ olx.source.TileImageOptions.prototype.wrapX; * @typedef {{attributions: (Array.|undefined), * format: ol.format.Feature, * logo: (string|olx.LogoOptions|undefined), - * projection: ol.proj.ProjectionLike, * tileGrid: ol.tilegrid.TileGrid, * tileUrlFunction: (ol.TileUrlFunctionType|undefined), * url: (string|undefined), @@ -3898,15 +3897,6 @@ olx.source.TileVectorOptions.prototype.format; olx.source.TileVectorOptions.prototype.logo; -/** - * Destination projection. If provided, features will be transformed to this - * projection. If not provided, features will not be transformed. - * @type {ol.proj.ProjectionLike} - * @api - */ -olx.source.TileVectorOptions.prototype.projection; - - /** * Tile grid. * @type {ol.tilegrid.TileGrid} diff --git a/src/ol/source/tilevectorsource.js b/src/ol/source/tilevectorsource.js index 1a3642fb3e..a1714c3f88 100644 --- a/src/ol/source/tilevectorsource.js +++ b/src/ol/source/tilevectorsource.js @@ -5,8 +5,9 @@ goog.require('goog.asserts'); goog.require('goog.object'); goog.require('ol.TileCoord'); goog.require('ol.TileUrlFunction'); -goog.require('ol.source.FormatVector'); +goog.require('ol.featureloader'); goog.require('ol.source.State'); +goog.require('ol.source.Vector'); goog.require('ol.tilegrid.TileGrid'); @@ -17,7 +18,7 @@ goog.require('ol.tilegrid.TileGrid'); * into tiles in a fixed grid pattern. * * @constructor - * @extends {ol.source.FormatVector} + * @extends {ol.source.Vector} * @param {olx.source.TileVectorOptions} options Options. * @api */ @@ -25,11 +26,20 @@ ol.source.TileVector = function(options) { goog.base(this, { attributions: options.attributions, - format: options.format, logo: options.logo, - projection: options.projection + projection: undefined, + state: ol.source.State.READY }); + /** + * @private + * @type {ol.format.Feature} + */ + this.format_ = options.format; + + goog.asserts.assert(goog.isDefAndNotNull(this.format_), + 'ol.source.TileVector requires a format'); + /** * @private * @type {ol.tilegrid.TileGrid} @@ -63,7 +73,7 @@ ol.source.TileVector = function(options) { } }; -goog.inherits(ol.source.TileVector, ol.source.FormatVector); +goog.inherits(ol.source.TileVector, ol.source.Vector); /** @@ -258,7 +268,7 @@ ol.source.TileVector.prototype.loadFeatures = */ function success(tileKey, features) { tiles[tileKey] = features; - this.setState(ol.source.State.READY); + this.changed(); } for (x = tileRange.minX; x <= tileRange.maxX; ++x) { for (y = tileRange.minY; y <= tileRange.maxY; ++y) { @@ -271,8 +281,9 @@ ol.source.TileVector.prototype.loadFeatures = var url = tileUrlFunction(tileCoord, 1, projection); if (goog.isDef(url)) { tiles[tileKey] = []; - this.loadFeaturesFromURL(url, goog.partial(success, tileKey), - goog.nullFunction, this); + var loader = ol.featureloader.loadFeaturesXhr(url, this.format_, + goog.partial(success, tileKey)); + loader.call(this, extent, resolution, projection); } } }