Merge branch 'master' of github.com:openlayers/ol3 into vector

This commit is contained in:
Tim Schaub
2013-03-07 23:10:06 -07:00
120 changed files with 16315 additions and 1555 deletions

View File

@@ -24,7 +24,7 @@ ol.source.BingMaps = function(bingMapsOptions) {
goog.base(this, {
opaque: true,
projection: ol.projection.getFromCode('EPSG:3857')
projection: ol.projection.get('EPSG:3857')
});
/**
@@ -111,8 +111,8 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
};
})));
var transform = ol.projection.getTransform(
ol.projection.getFromCode('EPSG:4326'), this.getProjection());
var transform = ol.projection.getTransformFromProjections(
ol.projection.get('EPSG:4326'), this.getProjection());
var attributions = goog.array.map(
resource.imageryProviders,
function(imageryProvider) {

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
@@ -39,7 +38,7 @@ ol.source.Source = function(sourceOptions) {
*/
this.extent_ = goog.isDef(sourceOptions.extent) ?
sourceOptions.extent : goog.isDef(sourceOptions.projection) ?
sourceOptions.projection.getExtent() : null;
this.projection_.getExtent() : null;
/**
* @private

View File

@@ -74,6 +74,16 @@ ol.source.StamenProviderConfig = {
};
/**
* @const {Array.<ol.Attribution>}
*/
ol.source.STAMEN_ATTRIBUTIONS = [new ol.Attribution(
'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under ' +
'<a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. ' +
'Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under ' +
'<a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.')];
/**
* @constructor
@@ -82,14 +92,6 @@ ol.source.StamenProviderConfig = {
*/
ol.source.Stamen = function(options) {
var attribution = new ol.Attribution(
'Map tiles by <a href="http://stamen.com">Stamen Design</a>, ' +
'under ' +
'<a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. ' +
'Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, ' +
'under ' +
'<a href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>.');
var i = options.layer.indexOf('-');
var provider = i == -1 ? options.layer : options.layer.slice(0, i);
goog.asserts.assert(provider in ol.source.StamenProviderConfig);
@@ -103,7 +105,7 @@ ol.source.Stamen = function(options) {
layerConfig.extension;
goog.base(this, {
attributions: [attribution],
attributions: ol.source.STAMEN_ATTRIBUTIONS,
maxZoom: providerConfig.maxZoom,
// FIXME uncomment the following when tilegrid supports minZoom
//minZoom: providerConfig.minZoom,

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

@@ -1 +1 @@
@exportSymbol ol.source.TiledWMS
@exportSymbol ol.source.TiledWMS

View File

@@ -49,9 +49,9 @@ ol.source.TiledWMS = function(tiledWMSOptions) {
var tileExtent = tileGrid.getTileCoordExtent(tileCoord);
var projectionExtent = projection.getExtent();
extent = goog.isDef(extent) ? extent : projectionExtent;
// FIXME do we want a wrapDateLine param? The code below will break maps
// with projections that do not span the whole world width.
if (extent.minX === projectionExtent.minX &&
if (!goog.isNull(extent) && projection.isGlobal() &&
extent.minX === projectionExtent.minX &&
extent.maxX === projectionExtent.maxX) {
var numCols = Math.ceil(
(extent.maxX - extent.minX) / (tileExtent.maxX - tileExtent.minX));

View File

@@ -52,7 +52,7 @@ goog.exportSymbol('grid', grid);
ol.source.TileJSON = function(tileJsonOptions) {
goog.base(this, {
projection: ol.projection.getFromCode('EPSG:3857')
projection: ol.projection.get('EPSG:3857')
});
/**
@@ -80,15 +80,15 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function() {
var tileJSON = ol.tilejson.grids_.pop();
var epsg4326Projection = ol.projection.getFromCode('EPSG:4326');
var epsg4326Projection = ol.projection.get('EPSG:4326');
var epsg4326Extent, extent;
if (goog.isDef(tileJSON.bounds)) {
var bounds = tileJSON.bounds;
epsg4326Extent = new ol.Extent(
bounds[0], bounds[1], bounds[2], bounds[3]);
extent = epsg4326Extent.transform(
ol.projection.getTransform(epsg4326Projection, this.getProjection()));
extent = epsg4326Extent.transform(ol.projection.getTransformFromProjections(
epsg4326Projection, this.getProjection()));
this.setExtent(extent);
} else {
epsg4326Extent = null;

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;

View File

@@ -17,8 +17,8 @@ ol.source.wms.getUrl =
'REQUEST': 'GetMap',
'FORMAT': 'image/png',
'TRANSPARENT': true,
'WIDTH': size.width,
'HEIGHT': size.height
'WIDTH': Math.round(size.width),
'HEIGHT': Math.round(size.height)
};
goog.object.extend(baseParams, params);

View File

@@ -37,7 +37,7 @@ ol.source.XYZOptions;
ol.source.XYZ = function(xyzOptions) {
var projection = xyzOptions.projection ||
ol.projection.getFromCode('EPSG:3857');
ol.projection.get('EPSG:3857');
/**
* @type {ol.TileUrlFunctionType}