diff --git a/examples/mapquest.js b/examples/mapquest.js
index f5673778b9..6a35142d07 100644
--- a/examples/mapquest.js
+++ b/examples/mapquest.js
@@ -4,30 +4,28 @@ goog.require('ol.View2D');
goog.require('ol.layer.Group');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
-goog.require('ol.source.MapQuestHybrid');
-goog.require('ol.source.MapQuestOSM');
-goog.require('ol.source.MapQuestOpenAerial');
+goog.require('ol.source.MapQuest');
var layers = [
new ol.layer.Tile({
style: 'Road',
- source: new ol.source.MapQuestOSM()
+ source: new ol.source.MapQuest({layer: 'osm'})
}),
new ol.layer.Tile({
style: 'Aerial',
visible: false,
- source: new ol.source.MapQuestOpenAerial()
+ source: new ol.source.MapQuest({layer: 'sat'})
}),
new ol.layer.Group({
style: 'AerialWithLabels',
visible: false,
layers: [
new ol.layer.Tile({
- source: new ol.source.MapQuestOpenAerial()
+ source: new ol.source.MapQuest({layer: 'sat'})
}),
new ol.layer.Tile({
- source: new ol.source.MapQuestHybrid()
+ source: new ol.source.MapQuest({layer: 'hyb'})
})
]
})
diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc
index da4e24de3f..16e061f833 100644
--- a/src/objectliterals.jsdoc
+++ b/src/objectliterals.jsdoc
@@ -651,6 +651,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
diff --git a/src/ol/source/mapquestsource.exports b/src/ol/source/mapquestsource.exports
index fee2b2e18b..cef1c0dcaf 100644
--- a/src/ol/source/mapquestsource.exports
+++ b/src/ol/source/mapquestsource.exports
@@ -1,3 +1 @@
-@exportSymbol ol.source.MapQuestOSM
-@exportSymbol ol.source.MapQuestOpenAerial
-@exportSymbol ol.source.MapQuestHybrid
+@exportSymbol ol.source.MapQuest
diff --git a/src/ol/source/mapquestsource.js b/src/ol/source/mapquestsource.js
index fd0e2666d2..d32a12e927 100644
--- a/src/ol/source/mapquestsource.js
+++ b/src/ol/source/mapquestsource.js
@@ -1,7 +1,6 @@
-goog.provide('ol.source.MapQuestHybrid');
-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');
@@ -14,96 +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 ' +
- 'MapQuest'
- }),
- 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,
+ tileLoadFunction: options.tileLoadFunction,
+ url: url
+ });
+
+};
+goog.inherits(ol.source.MapQuest, ol.source.XYZ);
+
+
+/**
+ * @const
+ * @type {ol.Attribution}
+ */
+ol.source.MapQuest.TILE_ATTRIBUTION = new ol.Attribution({
+ html: 'Tiles Courtesy of ' +
+ 'MapQuest'
+});
+
+
+/**
+ * @type {Object.)}>}
+ */
+ol.source.MapQuestConfig = {
+ 'osm': {
maxZoom: 28,
- tileLoadFunction: options.tileLoadFunction,
- url: 'http://otile{1-4}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg'
- });
-
-};
-goog.inherits(ol.source.MapQuestOSM, ol.source.XYZ);
-
-
-
-/**
- * @constructor
- * @extends {ol.source.XYZ}
- * @param {olx.source.MapQuestOptions=} opt_options MapQuest options.
- * @todo stability experimental
- */
-ol.source.MapQuestOpenAerial = function(opt_options) {
-
- var options = goog.isDef(opt_options) ? opt_options : {};
-
- var attributions = [
- new ol.Attribution({
- html: 'Tiles Courtesy of ' +
- 'MapQuest'
- }),
- 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',
+ 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'
- });
-
-};
-goog.inherits(ol.source.MapQuestOpenAerial, ol.source.XYZ);
-
-
-
-/**
- * @constructor
- * @extends {ol.source.XYZ}
- * @param {olx.source.MapQuestOptions=} opt_options MapQuest options.
- * @todo stability experimental
- */
-ol.source.MapQuestHybrid = function(opt_options) {
-
- var options = goog.isDef(opt_options) ? opt_options : {};
-
- var attributions = [
- new ol.Attribution({
- html: 'Tiles Courtesy of ' +
- 'MapQuest'
- }),
- ol.source.OSM.DATA_ATTRIBUTION
- ];
-
- goog.base(this, {
- attributions: attributions,
- crossOrigin: 'anonymous',
- logo: 'http://developer.mapquest.com/content/osm/mq_logo.png',
+ 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,
- opaque: true,
- tileLoadFunction: options.tileLoadFunction,
- url: 'http://oatile{1-4}.mqcdn.com/tiles/1.0.0/hyb/{z}/{x}/{y}.jpg'
- });
-
+ attributions: [
+ ol.source.MapQuest.TILE_ATTRIBUTION,
+ ol.source.OSM.DATA_ATTRIBUTION
+ ]
+ }
};
-goog.inherits(ol.source.MapQuestHybrid, ol.source.XYZ);