ol.Projection now takes a single argument
which is called ol.ProjectionOptions.
This commit is contained in:
@@ -14,9 +14,12 @@ goog.require('ol.source.SingleImageWMS');
|
|||||||
goog.require('ol.source.TiledWMS');
|
goog.require('ol.source.TiledWMS');
|
||||||
|
|
||||||
|
|
||||||
var epsg21781 = new ol.Projection('EPSG:21781', ol.ProjectionUnits.METERS,
|
var epsg21781 = new ol.Projection({
|
||||||
// Validity extent from http://spatialreference.org
|
code: 'EPSG:21781',
|
||||||
new ol.Extent(485869.5728, 76443.1884, 837076.5648, 299941.7864));
|
units: ol.ProjectionUnits.METERS,
|
||||||
|
// Validity extent from http://spatialreference.org
|
||||||
|
extent: new ol.Extent(485869.5728, 76443.1884, 837076.5648, 299941.7864)
|
||||||
|
});
|
||||||
ol.projection.addProjection(epsg21781);
|
ol.projection.addProjection(epsg21781);
|
||||||
|
|
||||||
var extent = new ol.Extent(420000, 30000, 900000, 350000);
|
var extent = new ol.Extent(420000, 30000, 900000, 350000);
|
||||||
|
|||||||
@@ -153,3 +153,10 @@
|
|||||||
|
|
||||||
@exportObjectLiteral ol.tilegrid.XYZOptions
|
@exportObjectLiteral ol.tilegrid.XYZOptions
|
||||||
@exportObjectLiteralProperty ol.tilegrid.XYZOptions.maxZoom number
|
@exportObjectLiteralProperty ol.tilegrid.XYZOptions.maxZoom number
|
||||||
|
|
||||||
|
@exportObjectLiteral ol.ProjectionOptions
|
||||||
|
@exportObjectLiteralProperty ol.ProjectionOptions.code string
|
||||||
|
@exportObjectLiteralProperty ol.ProjectionOptions.units ol.ProjectionUnits
|
||||||
|
@exportObjectLiteralProperty ol.ProjectionOptions.extent ol.Extent
|
||||||
|
@exportObjectLiteralProperty ol.ProjectionOptions.axisOrientation string|undefined
|
||||||
|
@exportObjectLiteralProperty ol.ProjectionOptions.global boolean|undefined
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@exportSymbol ol.Projection
|
@exportClass ol.Projection ol.ProjectionOptions
|
||||||
@exportProperty ol.Projection.prototype.getAxisOrientation
|
@exportProperty ol.Projection.prototype.getAxisOrientation
|
||||||
@exportProperty ol.Projection.prototype.getCode
|
@exportProperty ol.Projection.prototype.getCode
|
||||||
@exportProperty ol.Projection.prototype.getExtent
|
@exportProperty ol.Projection.prototype.getExtent
|
||||||
|
|||||||
+16
-16
@@ -46,46 +46,41 @@ ol.METERS_PER_UNIT[ol.ProjectionUnits.METERS] = 1;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {string} code Code.
|
* @param {ol.ProjectionOptions} options Options object.
|
||||||
* @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.
|
|
||||||
*/
|
*/
|
||||||
ol.Projection =
|
ol.Projection = function(options) {
|
||||||
function(code, units, extent, opt_axisOrientation, opt_global) {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
this.code_ = code;
|
this.code_ = options.code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.ProjectionUnits}
|
* @type {ol.ProjectionUnits}
|
||||||
*/
|
*/
|
||||||
this.units_ = units;
|
this.units_ = options.units;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.Extent}
|
* @type {ol.Extent}
|
||||||
*/
|
*/
|
||||||
this.extent_ = extent;
|
this.extent_ = options.extent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
this.axisOrientation_ = goog.isDef(opt_axisOrientation) ?
|
this.axisOrientation_ = goog.isDef(options.axisOrientation) ?
|
||||||
opt_axisOrientation : 'enu';
|
options.axisOrientation : 'enu';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {string}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.global_ = goog.isDef(opt_global) ?
|
this.global_ = goog.isDef(options.global) ?
|
||||||
opt_global : false;
|
options.global : false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -188,7 +183,12 @@ ol.Proj4jsProjection_ = function(code, proj4jsProj) {
|
|||||||
|
|
||||||
var units = /** @type {ol.ProjectionUnits} */ (proj4jsProj.units);
|
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
|
* @private
|
||||||
|
|||||||
@@ -15,8 +15,11 @@ goog.require('ol.projection');
|
|||||||
* @param {string} code Code.
|
* @param {string} code Code.
|
||||||
*/
|
*/
|
||||||
ol.projection.EPSG3857 = function(code) {
|
ol.projection.EPSG3857 = function(code) {
|
||||||
goog.base(
|
goog.base(this, {
|
||||||
this, code, ol.ProjectionUnits.METERS, ol.projection.EPSG3857.EXTENT);
|
code: code,
|
||||||
|
units: ol.ProjectionUnits.METERS,
|
||||||
|
extent: ol.projection.EPSG3857.EXTENT
|
||||||
|
});
|
||||||
};
|
};
|
||||||
goog.inherits(ol.projection.EPSG3857, ol.Projection);
|
goog.inherits(ol.projection.EPSG3857, ol.Projection);
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,12 @@ goog.require('ol.projection');
|
|||||||
* @param {string=} opt_axisOrientation Axis orientation.
|
* @param {string=} opt_axisOrientation Axis orientation.
|
||||||
*/
|
*/
|
||||||
ol.projection.EPSG4326 = function(code, opt_axisOrientation) {
|
ol.projection.EPSG4326 = function(code, opt_axisOrientation) {
|
||||||
goog.base(this, code, ol.ProjectionUnits.DEGREES,
|
goog.base(this, {
|
||||||
ol.projection.EPSG4326.EXTENT, opt_axisOrientation);
|
code: code,
|
||||||
|
units: ol.ProjectionUnits.DEGREES,
|
||||||
|
extent: ol.projection.EPSG4326.EXTENT,
|
||||||
|
axisOrientation: opt_axisOrientation
|
||||||
|
});
|
||||||
};
|
};
|
||||||
goog.inherits(ol.projection.EPSG4326, ol.Projection);
|
goog.inherits(ol.projection.EPSG4326, ol.Projection);
|
||||||
|
|
||||||
|
|||||||
@@ -305,8 +305,16 @@ describe('ol.projection', function() {
|
|||||||
var units = ol.ProjectionUnits.DEGREES;
|
var units = ol.ProjectionUnits.DEGREES;
|
||||||
|
|
||||||
it('removes functions cached by addTransform', function() {
|
it('removes functions cached by addTransform', function() {
|
||||||
var foo = new ol.Projection('foo', units, extent);
|
var foo = new ol.Projection({
|
||||||
var bar = new ol.Projection('bar', units, extent);
|
code: 'foo',
|
||||||
|
units: units,
|
||||||
|
extent: extent
|
||||||
|
});
|
||||||
|
var bar = new ol.Projection({
|
||||||
|
code: 'bar',
|
||||||
|
units: units,
|
||||||
|
extent: extent
|
||||||
|
});
|
||||||
var transform = function(input, output, dimension) {return input};
|
var transform = function(input, output, dimension) {return input};
|
||||||
ol.projection.addTransform(foo, bar, transform);
|
ol.projection.addTransform(foo, bar, transform);
|
||||||
expect(ol.projection.transforms_).not.toBeUndefined();
|
expect(ol.projection.transforms_).not.toBeUndefined();
|
||||||
|
|||||||
Reference in New Issue
Block a user