ol.Projection now takes a single argument

which is called ol.ProjectionOptions.
This commit is contained in:
Bruno Binet
2013-03-06 19:41:10 +01:00
parent 8dd3093f4c
commit 9d88273161
7 changed files with 51 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
@exportSymbol ol.Projection
@exportClass ol.Projection ol.ProjectionOptions
@exportProperty ol.Projection.prototype.getAxisOrientation
@exportProperty ol.Projection.prototype.getCode
@exportProperty ol.Projection.prototype.getExtent

View File

@@ -46,46 +46,41 @@ ol.METERS_PER_UNIT[ol.ProjectionUnits.METERS] = 1;
/**
* @constructor
* @param {string} code Code.
* @param {ol.ProjectionUnits} units Units.
* @param {ol.Extent} extent Extent.
* @param {string=} opt_axisOrientation Axis orientation.
* @param {boolean=} opt_global Wether the projection is global.
* @param {ol.ProjectionOptions} options Options object.
*/
ol.Projection =
function(code, units, extent, opt_axisOrientation, opt_global) {
ol.Projection = function(options) {
/**
* @private
* @type {string}
*/
this.code_ = code;
this.code_ = options.code;
/**
* @private
* @type {ol.ProjectionUnits}
*/
this.units_ = units;
this.units_ = options.units;
/**
* @private
* @type {ol.Extent}
*/
this.extent_ = extent;
this.extent_ = options.extent;
/**
* @private
* @type {string}
*/
this.axisOrientation_ = goog.isDef(opt_axisOrientation) ?
opt_axisOrientation : 'enu';
this.axisOrientation_ = goog.isDef(options.axisOrientation) ?
options.axisOrientation : 'enu';
/**
* @private
* @type {string}
* @type {boolean}
*/
this.global_ = goog.isDef(opt_global) ?
opt_global : false;
this.global_ = goog.isDef(options.global) ?
options.global : false;
/**
* @private
@@ -188,7 +183,12 @@ ol.Proj4jsProjection_ = function(code, proj4jsProj) {
var units = /** @type {ol.ProjectionUnits} */ (proj4jsProj.units);
goog.base(this, code, units, null, proj4jsProj.axis);
goog.base(this, {
code: code,
units: units,
extent: null,
axisOrientation: proj4jsProj.axis
});
/**
* @private

View File

@@ -15,8 +15,11 @@ goog.require('ol.projection');
* @param {string} code Code.
*/
ol.projection.EPSG3857 = function(code) {
goog.base(
this, code, ol.ProjectionUnits.METERS, ol.projection.EPSG3857.EXTENT);
goog.base(this, {
code: code,
units: ol.ProjectionUnits.METERS,
extent: ol.projection.EPSG3857.EXTENT
});
};
goog.inherits(ol.projection.EPSG3857, ol.Projection);

View File

@@ -14,8 +14,12 @@ goog.require('ol.projection');
* @param {string=} opt_axisOrientation Axis orientation.
*/
ol.projection.EPSG4326 = function(code, opt_axisOrientation) {
goog.base(this, code, ol.ProjectionUnits.DEGREES,
ol.projection.EPSG4326.EXTENT, opt_axisOrientation);
goog.base(this, {
code: code,
units: ol.ProjectionUnits.DEGREES,
extent: ol.projection.EPSG4326.EXTENT,
axisOrientation: opt_axisOrientation
});
};
goog.inherits(ol.projection.EPSG4326, ol.Projection);