Provide the ability to get the layer name from a MapQuest source

This commit is contained in:
Bart van den Eijnden
2015-02-11 15:46:02 +01:00
parent b529f0f0a0
commit eafa5419c3

View File

@@ -24,10 +24,17 @@ ol.source.MapQuest = function(opt_options) {
var layerConfig = ol.source.MapQuestConfig[options.layer];
/**
* Layer. Possible values are `osm`, `sat`, and `hyb`.
* @type {string}
* @private
*/
this.layer_ = options.layer;
var protocol = ol.IS_HTTPS ? 'https:' : 'http:';
var url = goog.isDef(options.url) ? options.url :
protocol + '//otile{1-4}-s.mqcdn.com/tiles/1.0.0/' +
options.layer + '/{z}/{x}/{y}.jpg';
this.layer_ + '/{z}/{x}/{y}.jpg';
goog.base(this, {
attributions: layerConfig.attributions,
@@ -81,3 +88,12 @@ ol.source.MapQuestConfig = {
]
}
};
/**
* @return {string} Layer.
* @api
*/
ol.source.MapQuest.prototype.getLayer = function() {
return this.layer_;
};