Add a worldExtent to ol.proj.Projection
This commit is contained in:
committed by
Andreas Hocevar
parent
9de010c791
commit
9f19569144
+9
-1
@@ -293,7 +293,8 @@ olx.OverlayOptions.prototype.insertFirst;
|
|||||||
* units: (ol.proj.Units|string),
|
* units: (ol.proj.Units|string),
|
||||||
* extent: (ol.Extent|undefined),
|
* extent: (ol.Extent|undefined),
|
||||||
* axisOrientation: (string|undefined),
|
* axisOrientation: (string|undefined),
|
||||||
* global: (boolean|undefined)}}
|
* global: (boolean|undefined),
|
||||||
|
* worldExtent: (ol.Extent|undefined)}}
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
olx.ProjectionOptions;
|
olx.ProjectionOptions;
|
||||||
@@ -334,6 +335,13 @@ olx.ProjectionOptions.prototype.axisOrientation;
|
|||||||
olx.ProjectionOptions.prototype.global;
|
olx.ProjectionOptions.prototype.global;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The world extent for the SRS.
|
||||||
|
* @type {ol.Extent|undefined}
|
||||||
|
*/
|
||||||
|
olx.ProjectionOptions.prototype.worldExtent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object literal with config options for the view.
|
* Object literal with config options for the view.
|
||||||
* @typedef {{center: (ol.Coordinate|undefined),
|
* @typedef {{center: (ol.Coordinate|undefined),
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ ol.proj.EPSG3857_ = function(code) {
|
|||||||
code: code,
|
code: code,
|
||||||
units: ol.proj.Units.METERS,
|
units: ol.proj.Units.METERS,
|
||||||
extent: ol.proj.EPSG3857.EXTENT,
|
extent: ol.proj.EPSG3857.EXTENT,
|
||||||
global: true
|
global: true,
|
||||||
|
worldExtent: ol.proj.EPSG3857.WORLD_EXTENT
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
goog.inherits(ol.proj.EPSG3857_, ol.proj.Projection);
|
goog.inherits(ol.proj.EPSG3857_, ol.proj.Projection);
|
||||||
@@ -61,6 +62,13 @@ ol.proj.EPSG3857.EXTENT = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @const
|
||||||
|
* @type {ol.Extent}
|
||||||
|
*/
|
||||||
|
ol.proj.EPSG3857.WORLD_EXTENT = [-180, -85, 180, 85];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists several projection codes with the same meaning as EPSG:3857.
|
* Lists several projection codes with the same meaning as EPSG:3857.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ ol.proj.EPSG4326_ = function(code, opt_axisOrientation) {
|
|||||||
units: ol.proj.Units.DEGREES,
|
units: ol.proj.Units.DEGREES,
|
||||||
extent: ol.proj.EPSG4326.EXTENT,
|
extent: ol.proj.EPSG4326.EXTENT,
|
||||||
axisOrientation: opt_axisOrientation,
|
axisOrientation: opt_axisOrientation,
|
||||||
global: true
|
global: true,
|
||||||
|
worldExtent: ol.proj.EPSG4326.EXTENT
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
goog.inherits(ol.proj.EPSG4326_, ol.proj.Projection);
|
goog.inherits(ol.proj.EPSG4326_, ol.proj.Projection);
|
||||||
|
|||||||
@@ -86,6 +86,13 @@ ol.proj.Projection = function(options) {
|
|||||||
*/
|
*/
|
||||||
this.extent_ = goog.isDef(options.extent) ? options.extent : null;
|
this.extent_ = goog.isDef(options.extent) ? options.extent : null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {ol.Extent}
|
||||||
|
*/
|
||||||
|
this.worldExtent_ = goog.isDef(options.worldExtent) ?
|
||||||
|
options.worldExtent : null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {string}
|
* @type {string}
|
||||||
@@ -148,6 +155,16 @@ ol.proj.Projection.prototype.getMetersPerUnit = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the world extent for this projection.
|
||||||
|
* @return {ol.Extent} Extent.
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
ol.proj.Projection.prototype.getWorldExtent = function() {
|
||||||
|
return this.worldExtent_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the axis orientation of this projection.
|
* Get the axis orientation of this projection.
|
||||||
* Example values are:
|
* Example values are:
|
||||||
@@ -198,6 +215,17 @@ ol.proj.Projection.prototype.setExtent = function(extent) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the world extent for this projection.
|
||||||
|
* @param {ol.Extent} worldExtent World extent
|
||||||
|
* [minlon, minlat, maxlon, maxlat].
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
ol.proj.Projection.prototype.setWorldExtent = function(worldExtent) {
|
||||||
|
this.worldExtent_ = worldExtent;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the resolution of the point in degrees. For projections with degrees as
|
* Get the resolution of the point in degrees. For projections with degrees as
|
||||||
* the unit this will simply return the provided resolution. For other
|
* the unit this will simply return the provided resolution. For other
|
||||||
|
|||||||
Reference in New Issue
Block a user