Do not require an extent for global projections
This commit is contained in:
@@ -120,9 +120,13 @@ ol.proj.Projection = function(options) {
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.global_ = goog.isDef(options.global) ? options.global : false;
|
||||
if (this.global_) {
|
||||
goog.asserts.assert(!goog.isNull(this.extent_));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.canWrapX_ = this.global_ && !goog.isNull(this.extent_);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -175,6 +179,14 @@ ol.proj.Projection = function(options) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {boolean} The projection is suitable for wrapping the x-axis
|
||||
*/
|
||||
ol.proj.Projection.prototype.canWrapX = function() {
|
||||
return this.canWrapX_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the code for this projection, e.g. 'EPSG:4326'.
|
||||
* @return {string} Code.
|
||||
@@ -258,6 +270,7 @@ ol.proj.Projection.prototype.isGlobal = function() {
|
||||
*/
|
||||
ol.proj.Projection.prototype.setGlobal = function(global) {
|
||||
this.global_ = global;
|
||||
this.canWrapX_ = global && !goog.isNull(this.extent_);
|
||||
};
|
||||
|
||||
|
||||
@@ -284,6 +297,7 @@ ol.proj.Projection.prototype.setDefaultTileGrid = function(tileGrid) {
|
||||
*/
|
||||
ol.proj.Projection.prototype.setExtent = function(extent) {
|
||||
this.extent_ = extent;
|
||||
this.canWrapX_ = this.global_ && !goog.isNull(extent);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user