Merge pull request #1868 from twpayne/wrap-x

Add wrapX option to ol.source.XYZ
This commit is contained in:
Tom Payne
2014-03-17 14:16:56 +01:00
2 changed files with 6 additions and 3 deletions

View File

@@ -996,6 +996,8 @@
* @property {string|undefined} url URL template. Must include `{x}`, `{y}`,
* and `{z}` placeholders.
* @property {Array.<string>|undefined} urls An array of URL templates.
* @property {boolean|undefined} wrapX Whether to wrap the world horizontally.
* Default is `true`.
* @todo stability experimental
*/

View File

@@ -3,7 +3,6 @@ goog.provide('ol.source.XYZ');
goog.require('ol.Attribution');
goog.require('ol.TileUrlFunction');
goog.require('ol.TileUrlFunctionType');
goog.require('ol.proj');
goog.require('ol.source.TileImage');
goog.require('ol.tilegrid.XYZ');
@@ -17,7 +16,8 @@ goog.require('ol.tilegrid.XYZ');
*/
ol.source.XYZ = function(options) {
var projection = options.projection || ol.proj.get('EPSG:3857');
var projection = goog.isDef(options.projection) ?
options.projection : 'EPSG:3857';
var maxZoom = goog.isDef(options.maxZoom) ? options.maxZoom : 18;
@@ -41,7 +41,8 @@ ol.source.XYZ = function(options) {
* @type {ol.TileCoordTransformType}
*/
this.tileCoordTransform_ = tileGrid.createTileCoordTransform({
extent: options.extent
extent: options.extent,
wrapX: options.wrapX
});
if (goog.isDef(options.tileUrlFunction)) {