Allow strings to be used wherever projections are needed

This commit is contained in:
Tom Payne
2013-03-06 18:48:53 +01:00
parent afcbec469a
commit eaa17758bd
8 changed files with 45 additions and 30 deletions

View File

@@ -16,7 +16,7 @@ goog.require('ol.source.Source');
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* crossOrigin: (null|string|undefined),
* extent: (null|ol.Extent|undefined),
* projection: (ol.Projection|undefined),
* projection: ol.ProjectionLike,
* resolutions: (Array.<number>|undefined),
* imageUrlFunction: (ol.ImageUrlFunctionType|
* undefined)}}

View File

@@ -18,7 +18,7 @@ goog.require('ol.tilegrid.TileGrid');
* crossOrigin: (null|string|undefined),
* extent: (ol.Extent|undefined),
* opaque: (boolean|undefined),
* projection: (ol.Projection|undefined),
* projection: ol.ProjectionLike,
* tileGrid: (ol.tilegrid.TileGrid|undefined),
* tileUrlFunction: (ol.TileUrlFunctionType|undefined)}}
*/

View File

@@ -5,13 +5,13 @@ goog.require('goog.events.EventType');
goog.require('goog.functions');
goog.require('ol.Attribution');
goog.require('ol.Extent');
goog.require('ol.Projection');
goog.require('ol.projection');
/**
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* extent: (ol.Extent|undefined),
* projection: (ol.Projection|undefined)}}
* projection: ol.ProjectionLike}}
*/
ol.source.SourceOptions;
@@ -30,8 +30,7 @@ ol.source.Source = function(sourceOptions) {
* @private
* @type {ol.Projection}
*/
this.projection_ = goog.isDef(sourceOptions.projection) ?
sourceOptions.projection : null;
this.projection_ = ol.projection.get(sourceOptions.projection);
/**
* @private

View File

@@ -2,6 +2,7 @@ goog.provide('ol.source.StaticImage');
goog.require('ol.Image');
goog.require('ol.ImageUrlFunctionType');
goog.require('ol.projection');
goog.require('ol.source.ImageSource');
@@ -19,7 +20,7 @@ ol.source.StaticImage = function(options) {
var imageExtent = options.imageExtent;
var imageSize = options.imageSize;
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, {
attributions: options.attributions,

View File

@@ -4,7 +4,6 @@ goog.provide('ol.source.TileSourceOptions');
goog.require('goog.functions');
goog.require('ol.Attribution');
goog.require('ol.Extent');
goog.require('ol.Projection');
goog.require('ol.Tile');
goog.require('ol.TileCoord');
goog.require('ol.TileRange');
@@ -16,7 +15,7 @@ goog.require('ol.tilegrid.TileGrid');
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
* extent: (ol.Extent|undefined),
* opaque: (boolean|undefined),
* projection: (ol.Projection|undefined),
* projection: ol.ProjectionLike,
* tileGrid: (ol.tilegrid.TileGrid|undefined)}}
*/
ol.source.TileSourceOptions;