Allow strings to be used wherever projections are needed
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
@exportObjectLiteralProperty ol.View2DOptions.center ol.Coordinate|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.center ol.Coordinate|undefined
|
||||||
@exportObjectLiteralProperty ol.View2DOptions.maxResolution number|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.maxResolution number|undefined
|
||||||
@exportObjectLiteralProperty ol.View2DOptions.numZoomLevels number|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.numZoomLevels number|undefined
|
||||||
@exportObjectLiteralProperty ol.View2DOptions.projection ol.Projection|string|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.projection ol.ProjectionLike
|
||||||
@exportObjectLiteralProperty ol.View2DOptions.resolution number|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.resolution number|undefined
|
||||||
@exportObjectLiteralProperty ol.View2DOptions.resolutions Array.<number>|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.resolutions Array.<number>|undefined
|
||||||
@exportObjectLiteralProperty ol.View2DOptions.rotation number|undefined
|
@exportObjectLiteralProperty ol.View2DOptions.rotation number|undefined
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
@exportObjectLiteral ol.control.MousePositionOptions
|
@exportObjectLiteral ol.control.MousePositionOptions
|
||||||
@exportObjectLiteralProperty ol.control.MousePositionOptions.coordinateFormat ol.CoordinateFormatType|undefined
|
@exportObjectLiteralProperty ol.control.MousePositionOptions.coordinateFormat ol.CoordinateFormatType|undefined
|
||||||
@exportObjectLiteralProperty ol.control.MousePositionOptions.map ol.Map|undefined
|
@exportObjectLiteralProperty ol.control.MousePositionOptions.map ol.Map|undefined
|
||||||
@exportObjectLiteralProperty ol.control.MousePositionOptions.projection ol.Projection|undefined
|
@exportObjectLiteralProperty ol.control.MousePositionOptions.projection ol.ProjectionLike
|
||||||
@exportObjectLiteralProperty ol.control.MousePositionOptions.target Element|undefined
|
@exportObjectLiteralProperty ol.control.MousePositionOptions.target Element|undefined
|
||||||
@exportObjectLiteralProperty ol.control.MousePositionOptions.undefinedHTML string|undefined
|
@exportObjectLiteralProperty ol.control.MousePositionOptions.undefinedHTML string|undefined
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
|
|
||||||
@exportObjectLiteral ol.source.DebugTileSourceOptions
|
@exportObjectLiteral ol.source.DebugTileSourceOptions
|
||||||
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.extent ol.Extent|undefined
|
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.extent ol.Extent|undefined
|
||||||
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.projection ol.Projection|undefined
|
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.projection ol.ProjectionLike
|
||||||
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.tileGrid ol.tilegrid.TileGrid|undefined
|
@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.tileGrid ol.tilegrid.TileGrid|undefined
|
||||||
|
|
||||||
@exportObjectLiteral ol.source.SingleImageWMSOptions
|
@exportObjectLiteral ol.source.SingleImageWMSOptions
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.crossOrigin null|string|undefined
|
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.crossOrigin null|string|undefined
|
||||||
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.extent ol.Extent|undefined
|
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.extent ol.Extent|undefined
|
||||||
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.params Object.<string,*>
|
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.params Object.<string,*>
|
||||||
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.projection ol.Projection|undefined
|
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.projection ol.ProjectionLike
|
||||||
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.resolutions Array.<number>|undefined
|
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.resolutions Array.<number>|undefined
|
||||||
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.url string|undefined
|
@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.url string|undefined
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
@exportObjectLiteralProperty ol.source.StaticImageOptions.extent ol.Extent|undefined
|
@exportObjectLiteralProperty ol.source.StaticImageOptions.extent ol.Extent|undefined
|
||||||
@exportObjectLiteralProperty ol.source.StaticImageOptions.imageExtent ol.Extent|undefined
|
@exportObjectLiteralProperty ol.source.StaticImageOptions.imageExtent ol.Extent|undefined
|
||||||
@exportObjectLiteralProperty ol.source.StaticImageOptions.imageSize ol.Size|undefined
|
@exportObjectLiteralProperty ol.source.StaticImageOptions.imageSize ol.Size|undefined
|
||||||
@exportObjectLiteralProperty ol.source.StaticImageOptions.projection ol.Projection|undefined
|
@exportObjectLiteralProperty ol.source.StaticImageOptions.projection ol.ProjectionLike
|
||||||
@exportObjectLiteralProperty ol.source.StaticImageOptions.url string|undefined
|
@exportObjectLiteralProperty ol.source.StaticImageOptions.url string|undefined
|
||||||
|
|
||||||
@exportObjectLiteral ol.source.TiledWMSOptions
|
@exportObjectLiteral ol.source.TiledWMSOptions
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.extent ol.Extent|undefined
|
@exportObjectLiteralProperty ol.source.TiledWMSOptions.extent ol.Extent|undefined
|
||||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.tileGrid ol.tilegrid.TileGrid|undefined
|
@exportObjectLiteralProperty ol.source.TiledWMSOptions.tileGrid ol.tilegrid.TileGrid|undefined
|
||||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.maxZoom number|undefined
|
@exportObjectLiteralProperty ol.source.TiledWMSOptions.maxZoom number|undefined
|
||||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.projection ol.Projection|undefined
|
@exportObjectLiteralProperty ol.source.TiledWMSOptions.projection ol.ProjectionLike
|
||||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.url string|undefined
|
@exportObjectLiteralProperty ol.source.TiledWMSOptions.url string|undefined
|
||||||
@exportObjectLiteralProperty ol.source.TiledWMSOptions.urls Array.<string>|undefined
|
@exportObjectLiteralProperty ol.source.TiledWMSOptions.urls Array.<string>|undefined
|
||||||
|
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ ol.control.MousePosition = function(opt_options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.Projection|undefined}
|
* @type {ol.Projection}
|
||||||
*/
|
*/
|
||||||
this.projection_ = options.projection;
|
this.projection_ = ol.projection.get(options.projection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -168,7 +168,7 @@ ol.control.MousePosition.prototype.updateHTML_ = function(pixel) {
|
|||||||
var html = this.undefinedHTML_;
|
var html = this.undefinedHTML_;
|
||||||
if (!goog.isNull(pixel)) {
|
if (!goog.isNull(pixel)) {
|
||||||
if (this.renderedProjection_ != this.mapProjection_) {
|
if (this.renderedProjection_ != this.mapProjection_) {
|
||||||
if (goog.isDef(this.projection_)) {
|
if (!goog.isNull(this.projection_)) {
|
||||||
this.transform_ = ol.projection.getTransform(
|
this.transform_ = ol.projection.getTransform(
|
||||||
this.mapProjection_, this.projection_);
|
this.mapProjection_, this.projection_);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+28
-12
@@ -1,4 +1,5 @@
|
|||||||
goog.provide('ol.Projection');
|
goog.provide('ol.Projection');
|
||||||
|
goog.provide('ol.ProjectionLike');
|
||||||
goog.provide('ol.ProjectionUnits');
|
goog.provide('ol.ProjectionUnits');
|
||||||
goog.provide('ol.projection');
|
goog.provide('ol.projection');
|
||||||
|
|
||||||
@@ -23,6 +24,12 @@ ol.ENABLE_PROJ4JS = true;
|
|||||||
ol.HAVE_PROJ4JS = ol.ENABLE_PROJ4JS && typeof Proj4js == 'object';
|
ol.HAVE_PROJ4JS = ol.ENABLE_PROJ4JS && typeof Proj4js == 'object';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {ol.Projection|string|undefined}
|
||||||
|
*/
|
||||||
|
ol.ProjectionLike;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
@@ -422,20 +429,29 @@ ol.projection.removeTransform = function(source, destination) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} code Code which is a combination of authority and identifier
|
* @param {ol.ProjectionLike} projectionLike Either a code string which is a
|
||||||
* such as “EPSG:4326”.
|
* combination of authority and identifier such as “EPSG:4326”, or an
|
||||||
|
* existing projection object, or undefined.
|
||||||
* @return {ol.Projection} Projection.
|
* @return {ol.Projection} Projection.
|
||||||
*/
|
*/
|
||||||
ol.projection.get = function(code) {
|
ol.projection.get = function(projectionLike) {
|
||||||
var projection = ol.projection.projections_[code];
|
var projection;
|
||||||
if (ol.HAVE_PROJ4JS && !goog.isDef(projection)) {
|
if (projectionLike instanceof ol.Projection) {
|
||||||
projection = ol.projection.getProj4jsProjectionFromCode_({
|
projection = projectionLike;
|
||||||
code: code,
|
} else if (goog.isString(projectionLike)) {
|
||||||
extent: null
|
var code = projectionLike;
|
||||||
});
|
projection = ol.projection.projections_[code];
|
||||||
}
|
if (ol.HAVE_PROJ4JS && !goog.isDef(projection)) {
|
||||||
if (!goog.isDef(projection)) {
|
projection = ol.projection.getProj4jsProjectionFromCode_({
|
||||||
goog.asserts.assert(goog.isDef(projection));
|
code: code,
|
||||||
|
extent: null
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!goog.isDef(projection)) {
|
||||||
|
goog.asserts.assert(goog.isDef(projection));
|
||||||
|
projection = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
projection = null;
|
projection = null;
|
||||||
}
|
}
|
||||||
return projection;
|
return projection;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ goog.require('ol.source.Source');
|
|||||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||||
* crossOrigin: (null|string|undefined),
|
* crossOrigin: (null|string|undefined),
|
||||||
* extent: (null|ol.Extent|undefined),
|
* extent: (null|ol.Extent|undefined),
|
||||||
* projection: (ol.Projection|undefined),
|
* projection: ol.ProjectionLike,
|
||||||
* resolutions: (Array.<number>|undefined),
|
* resolutions: (Array.<number>|undefined),
|
||||||
* imageUrlFunction: (ol.ImageUrlFunctionType|
|
* imageUrlFunction: (ol.ImageUrlFunctionType|
|
||||||
* undefined)}}
|
* undefined)}}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ goog.require('ol.tilegrid.TileGrid');
|
|||||||
* crossOrigin: (null|string|undefined),
|
* crossOrigin: (null|string|undefined),
|
||||||
* extent: (ol.Extent|undefined),
|
* extent: (ol.Extent|undefined),
|
||||||
* opaque: (boolean|undefined),
|
* opaque: (boolean|undefined),
|
||||||
* projection: (ol.Projection|undefined),
|
* projection: ol.ProjectionLike,
|
||||||
* tileGrid: (ol.tilegrid.TileGrid|undefined),
|
* tileGrid: (ol.tilegrid.TileGrid|undefined),
|
||||||
* tileUrlFunction: (ol.TileUrlFunctionType|undefined)}}
|
* tileUrlFunction: (ol.TileUrlFunctionType|undefined)}}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ goog.require('goog.events.EventType');
|
|||||||
goog.require('goog.functions');
|
goog.require('goog.functions');
|
||||||
goog.require('ol.Attribution');
|
goog.require('ol.Attribution');
|
||||||
goog.require('ol.Extent');
|
goog.require('ol.Extent');
|
||||||
goog.require('ol.Projection');
|
goog.require('ol.projection');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||||
* extent: (ol.Extent|undefined),
|
* extent: (ol.Extent|undefined),
|
||||||
* projection: (ol.Projection|undefined)}}
|
* projection: ol.ProjectionLike}}
|
||||||
*/
|
*/
|
||||||
ol.source.SourceOptions;
|
ol.source.SourceOptions;
|
||||||
|
|
||||||
@@ -30,8 +30,7 @@ ol.source.Source = function(sourceOptions) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.Projection}
|
* @type {ol.Projection}
|
||||||
*/
|
*/
|
||||||
this.projection_ = goog.isDef(sourceOptions.projection) ?
|
this.projection_ = ol.projection.get(sourceOptions.projection);
|
||||||
sourceOptions.projection : null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ goog.provide('ol.source.StaticImage');
|
|||||||
|
|
||||||
goog.require('ol.Image');
|
goog.require('ol.Image');
|
||||||
goog.require('ol.ImageUrlFunctionType');
|
goog.require('ol.ImageUrlFunctionType');
|
||||||
|
goog.require('ol.projection');
|
||||||
goog.require('ol.source.ImageSource');
|
goog.require('ol.source.ImageSource');
|
||||||
|
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ ol.source.StaticImage = function(options) {
|
|||||||
var imageExtent = options.imageExtent;
|
var imageExtent = options.imageExtent;
|
||||||
var imageSize = options.imageSize;
|
var imageSize = options.imageSize;
|
||||||
var imageResolution = imageExtent.getHeight() / imageSize.height;
|
var imageResolution = imageExtent.getHeight() / imageSize.height;
|
||||||
var projection = goog.isDef(options.projection) ? options.projection : null;
|
var projection = ol.projection.get(options.projection);
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
attributions: options.attributions,
|
attributions: options.attributions,
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ goog.provide('ol.source.TileSourceOptions');
|
|||||||
goog.require('goog.functions');
|
goog.require('goog.functions');
|
||||||
goog.require('ol.Attribution');
|
goog.require('ol.Attribution');
|
||||||
goog.require('ol.Extent');
|
goog.require('ol.Extent');
|
||||||
goog.require('ol.Projection');
|
|
||||||
goog.require('ol.Tile');
|
goog.require('ol.Tile');
|
||||||
goog.require('ol.TileCoord');
|
goog.require('ol.TileCoord');
|
||||||
goog.require('ol.TileRange');
|
goog.require('ol.TileRange');
|
||||||
@@ -16,7 +15,7 @@ goog.require('ol.tilegrid.TileGrid');
|
|||||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||||
* extent: (ol.Extent|undefined),
|
* extent: (ol.Extent|undefined),
|
||||||
* opaque: (boolean|undefined),
|
* opaque: (boolean|undefined),
|
||||||
* projection: (ol.Projection|undefined),
|
* projection: ol.ProjectionLike,
|
||||||
* tileGrid: (ol.tilegrid.TileGrid|undefined)}}
|
* tileGrid: (ol.tilegrid.TileGrid|undefined)}}
|
||||||
*/
|
*/
|
||||||
ol.source.TileSourceOptions;
|
ol.source.TileSourceOptions;
|
||||||
|
|||||||
Reference in New Issue
Block a user