Make ol.source.TileVector inherit from ol.source.Vector
This commit is contained in:
@@ -3864,7 +3864,6 @@ olx.source.TileImageOptions.prototype.wrapX;
|
|||||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||||
* format: ol.format.Feature,
|
* format: ol.format.Feature,
|
||||||
* logo: (string|olx.LogoOptions|undefined),
|
* logo: (string|olx.LogoOptions|undefined),
|
||||||
* projection: ol.proj.ProjectionLike,
|
|
||||||
* tileGrid: ol.tilegrid.TileGrid,
|
* tileGrid: ol.tilegrid.TileGrid,
|
||||||
* tileUrlFunction: (ol.TileUrlFunctionType|undefined),
|
* tileUrlFunction: (ol.TileUrlFunctionType|undefined),
|
||||||
* url: (string|undefined),
|
* url: (string|undefined),
|
||||||
@@ -3898,15 +3897,6 @@ olx.source.TileVectorOptions.prototype.format;
|
|||||||
olx.source.TileVectorOptions.prototype.logo;
|
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.
|
* Tile grid.
|
||||||
* @type {ol.tilegrid.TileGrid}
|
* @type {ol.tilegrid.TileGrid}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ goog.require('goog.asserts');
|
|||||||
goog.require('goog.object');
|
goog.require('goog.object');
|
||||||
goog.require('ol.TileCoord');
|
goog.require('ol.TileCoord');
|
||||||
goog.require('ol.TileUrlFunction');
|
goog.require('ol.TileUrlFunction');
|
||||||
goog.require('ol.source.FormatVector');
|
goog.require('ol.featureloader');
|
||||||
goog.require('ol.source.State');
|
goog.require('ol.source.State');
|
||||||
|
goog.require('ol.source.Vector');
|
||||||
goog.require('ol.tilegrid.TileGrid');
|
goog.require('ol.tilegrid.TileGrid');
|
||||||
|
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ goog.require('ol.tilegrid.TileGrid');
|
|||||||
* into tiles in a fixed grid pattern.
|
* into tiles in a fixed grid pattern.
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.FormatVector}
|
* @extends {ol.source.Vector}
|
||||||
* @param {olx.source.TileVectorOptions} options Options.
|
* @param {olx.source.TileVectorOptions} options Options.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
@@ -25,11 +26,20 @@ ol.source.TileVector = function(options) {
|
|||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
attributions: options.attributions,
|
attributions: options.attributions,
|
||||||
format: options.format,
|
|
||||||
logo: options.logo,
|
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
|
* @private
|
||||||
* @type {ol.tilegrid.TileGrid}
|
* @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) {
|
function success(tileKey, features) {
|
||||||
tiles[tileKey] = features;
|
tiles[tileKey] = features;
|
||||||
this.setState(ol.source.State.READY);
|
this.changed();
|
||||||
}
|
}
|
||||||
for (x = tileRange.minX; x <= tileRange.maxX; ++x) {
|
for (x = tileRange.minX; x <= tileRange.maxX; ++x) {
|
||||||
for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
|
for (y = tileRange.minY; y <= tileRange.maxY; ++y) {
|
||||||
@@ -271,8 +281,9 @@ ol.source.TileVector.prototype.loadFeatures =
|
|||||||
var url = tileUrlFunction(tileCoord, 1, projection);
|
var url = tileUrlFunction(tileCoord, 1, projection);
|
||||||
if (goog.isDef(url)) {
|
if (goog.isDef(url)) {
|
||||||
tiles[tileKey] = [];
|
tiles[tileKey] = [];
|
||||||
this.loadFeaturesFromURL(url, goog.partial(success, tileKey),
|
var loader = ol.featureloader.loadFeaturesXhr(url, this.format_,
|
||||||
goog.nullFunction, this);
|
goog.partial(success, tileKey));
|
||||||
|
loader.call(this, extent, resolution, projection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user