Merge remote-tracking branch 'openlayers/master' into vector-api
This commit is contained in:
@@ -592,6 +592,7 @@
|
||||
|
||||
/**
|
||||
* @typedef {Object} olx.source.MapQuestOptions
|
||||
* @property {string} layer Layer.
|
||||
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
|
||||
* function to load a tile given a URL.
|
||||
* @todo stability experimental
|
||||
|
||||
@@ -30,11 +30,11 @@ ol.ENABLE_WEBGL = true;
|
||||
|
||||
|
||||
/**
|
||||
* The ratio between physical pixels and device-independent pixels
|
||||
* (dips) on the device (`window.devicePixelRatio`).
|
||||
* @const {number}
|
||||
* @todo stability experimental
|
||||
*/
|
||||
* The ratio between physical pixels and device-independent pixels
|
||||
* (dips) on the device (`window.devicePixelRatio`).
|
||||
* @const {number}
|
||||
* @todo stability experimental
|
||||
*/
|
||||
ol.BrowserFeature.DEVICE_PIXEL_RATIO = goog.global.devicePixelRatio || 1;
|
||||
|
||||
|
||||
@@ -87,10 +87,10 @@ ol.BrowserFeature.HAS_GEOLOCATION = 'geolocation' in goog.global.navigator;
|
||||
|
||||
|
||||
/**
|
||||
* True if browser supports touch events.
|
||||
* @const {boolean}
|
||||
* True if browser supports touch events.
|
||||
* @const {boolean}
|
||||
* @todo stability experimental
|
||||
*/
|
||||
*/
|
||||
ol.BrowserFeature.HAS_TOUCH = ol.ASSUME_TOUCH ||
|
||||
(goog.global.document &&
|
||||
'ontouchstart' in goog.global.document.documentElement) ||
|
||||
|
||||
@@ -205,7 +205,6 @@ ol.layer.Group.prototype.getLayerStatesArray = function(opt_obj) {
|
||||
layerState.hue += ownLayerState.hue;
|
||||
layerState.opacity *= ownLayerState.opacity;
|
||||
layerState.saturation *= ownLayerState.saturation;
|
||||
layerState.sourceState = this.getSourceState();
|
||||
layerState.visible = layerState.visible && ownLayerState.visible;
|
||||
layerState.maxResolution = Math.min(
|
||||
layerState.maxResolution, ownLayerState.maxResolution);
|
||||
@@ -221,30 +220,5 @@ ol.layer.Group.prototype.getLayerStatesArray = function(opt_obj) {
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.layer.Group.prototype.getSourceState = function() {
|
||||
// Return the layer group's source state based on the best source state of its
|
||||
// children:
|
||||
// - if any child is READY, return READY
|
||||
// - otherwise, if any child is LOADING, return LOADING
|
||||
// - otherwise, all children must be in ERROR, return ERROR
|
||||
// - otherwise, there are no children, return READY
|
||||
var layerSourceStates = [0, 0, 0];
|
||||
var layers = this.getLayers().getArray();
|
||||
var n = layers.length;
|
||||
var i;
|
||||
for (i = 0; i < n; ++i) {
|
||||
var layerSourceState = layers[i].getSourceState();
|
||||
goog.asserts.assert(layerSourceState < layerSourceStates.length);
|
||||
++layerSourceStates[layerSourceState];
|
||||
}
|
||||
if (layerSourceStates[ol.source.State.READY]) {
|
||||
return ol.source.State.READY;
|
||||
} else if (layerSourceStates[ol.source.State.LOADING]) {
|
||||
return ol.source.State.LOADING;
|
||||
} else if (layerSourceStates[ol.source.State.ERROR]) {
|
||||
goog.asserts.assert(layerSourceStates[ol.source.State.ERROR] == n);
|
||||
return ol.source.State.ERROR;
|
||||
} else {
|
||||
goog.asserts.assert(n === 0);
|
||||
return ol.source.State.READY;
|
||||
}
|
||||
return ol.source.State.READY;
|
||||
};
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
@exportSymbol ol.source.MapQuestOSM
|
||||
@exportSymbol ol.source.MapQuestOpenAerial
|
||||
@exportSymbol ol.source.MapQuest
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
goog.provide('ol.source.MapQuestOSM');
|
||||
goog.provide('ol.source.MapQuestOpenAerial');
|
||||
goog.provide('ol.source.MapQuest');
|
||||
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.source.OSM');
|
||||
goog.require('ol.source.XYZ');
|
||||
@@ -13,63 +13,66 @@ goog.require('ol.source.XYZ');
|
||||
* @param {olx.source.MapQuestOptions=} opt_options MapQuest options.
|
||||
* @todo stability experimental
|
||||
*/
|
||||
ol.source.MapQuestOSM = function(opt_options) {
|
||||
ol.source.MapQuest = function(opt_options) {
|
||||
|
||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||
goog.asserts.assert(options.layer in ol.source.MapQuestConfig);
|
||||
|
||||
var attributions = [
|
||||
new ol.Attribution({
|
||||
html: 'Tiles Courtesy of ' +
|
||||
'<a href="http://www.mapquest.com/" target="_blank">MapQuest</a>'
|
||||
}),
|
||||
ol.source.OSM.DATA_ATTRIBUTION
|
||||
];
|
||||
var layerConfig = ol.source.MapQuestConfig[options.layer];
|
||||
|
||||
var url = 'http://otile{1-4}.mqcdn.com/tiles/1.0.0/' +
|
||||
options.layer + '/{z}/{x}/{y}.jpg';
|
||||
|
||||
goog.base(this, {
|
||||
attributions: attributions,
|
||||
attributions: layerConfig.attributions,
|
||||
crossOrigin: 'anonymous',
|
||||
logo: 'http://developer.mapquest.com/content/osm/mq_logo.png',
|
||||
maxZoom: layerConfig.maxZoom,
|
||||
opaque: true,
|
||||
maxZoom: 28,
|
||||
tileLoadFunction: options.tileLoadFunction,
|
||||
url: 'http://otile{1-4}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg'
|
||||
url: url
|
||||
});
|
||||
|
||||
};
|
||||
goog.inherits(ol.source.MapQuestOSM, ol.source.XYZ);
|
||||
|
||||
goog.inherits(ol.source.MapQuest, ol.source.XYZ);
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.source.XYZ}
|
||||
* @param {olx.source.MapQuestOptions=} opt_options MapQuest options.
|
||||
* @todo stability experimental
|
||||
* @const
|
||||
* @type {ol.Attribution}
|
||||
*/
|
||||
ol.source.MapQuestOpenAerial = function(opt_options) {
|
||||
ol.source.MapQuest.TILE_ATTRIBUTION = new ol.Attribution({
|
||||
html: 'Tiles Courtesy of ' +
|
||||
'<a href="http://www.mapquest.com/" target="_blank">MapQuest</a>'
|
||||
});
|
||||
|
||||
var options = goog.isDef(opt_options) ? opt_options : {};
|
||||
|
||||
var attributions = [
|
||||
new ol.Attribution({
|
||||
html: 'Tiles Courtesy of ' +
|
||||
'<a href="http://www.mapquest.com/" target="_blank">MapQuest</a>'
|
||||
}),
|
||||
new ol.Attribution({
|
||||
html: 'Portions Courtesy NASA/JPL-Caltech and ' +
|
||||
'U.S. Depart. of Agriculture, Farm Service Agency'
|
||||
})
|
||||
];
|
||||
|
||||
goog.base(this, {
|
||||
attributions: attributions,
|
||||
crossOrigin: 'anonymous',
|
||||
logo: 'http://developer.mapquest.com/content/osm/mq_logo.png',
|
||||
/**
|
||||
* @type {Object.<string, {maxZoom: number, attributions: (Array.<ol.Attribution>)}>}
|
||||
*/
|
||||
ol.source.MapQuestConfig = {
|
||||
'osm': {
|
||||
maxZoom: 28,
|
||||
attributions: [
|
||||
ol.source.MapQuest.TILE_ATTRIBUTION,
|
||||
ol.source.OSM.DATA_ATTRIBUTION
|
||||
]
|
||||
},
|
||||
'sat': {
|
||||
maxZoom: 18,
|
||||
opaque: true,
|
||||
tileLoadFunction: options.tileLoadFunction,
|
||||
url: 'http://oatile{1-4}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg'
|
||||
});
|
||||
|
||||
attributions: [
|
||||
ol.source.MapQuest.TILE_ATTRIBUTION,
|
||||
new ol.Attribution({
|
||||
html: 'Portions Courtesy NASA/JPL-Caltech and ' +
|
||||
'U.S. Depart. of Agriculture, Farm Service Agency'
|
||||
})
|
||||
]
|
||||
},
|
||||
'hyb': {
|
||||
maxZoom: 18,
|
||||
attributions: [
|
||||
ol.source.MapQuest.TILE_ATTRIBUTION,
|
||||
ol.source.OSM.DATA_ATTRIBUTION
|
||||
]
|
||||
}
|
||||
};
|
||||
goog.inherits(ol.source.MapQuestOpenAerial, ol.source.XYZ);
|
||||
|
||||
@@ -21,6 +21,7 @@ ol.QuadKeyCharCode = {
|
||||
* @param {number} z Zoom level.
|
||||
* @param {number} x X.
|
||||
* @param {number} y Y.
|
||||
* @struct
|
||||
*/
|
||||
ol.TileCoord = function(z, x, y) {
|
||||
|
||||
|
||||
@@ -89,14 +89,7 @@ ol.tilegrid.XYZ.prototype.createTileCoordTransform = function(opt_options) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (goog.isDef(opt_tileCoord)) {
|
||||
opt_tileCoord.z = z;
|
||||
opt_tileCoord.x = x;
|
||||
opt_tileCoord.y = -y - 1;
|
||||
return opt_tileCoord;
|
||||
} else {
|
||||
return new ol.TileCoord(z, x, -y - 1);
|
||||
}
|
||||
return ol.TileCoord.createOrUpdate(z, x, -y - 1, opt_tileCoord);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -74,13 +74,6 @@ ol.tilegrid.Zoomify.prototype.createTileCoordTransform = function(opt_options) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (goog.isDef(opt_tileCoord)) {
|
||||
opt_tileCoord.z = z;
|
||||
opt_tileCoord.x = x;
|
||||
opt_tileCoord.y = -y - 1;
|
||||
return opt_tileCoord;
|
||||
} else {
|
||||
return new ol.TileCoord(z, x, -y - 1);
|
||||
}
|
||||
return ol.TileCoord.createOrUpdate(z, x, -y - 1, opt_tileCoord);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user