Expose the map renderer type to the public API

In the case  where the map decides itself which renderer to use. It can
be convenient for the developer to have knowledge of the choice made.
This commit is contained in:
Hadrien Tulipe
2014-05-01 18:12:48 +02:00
parent d9c5e0c1ba
commit 1d6f9ca80b
5 changed files with 39 additions and 0 deletions

View File

@@ -726,6 +726,15 @@ ol.Map.prototype.getPixelFromCoordinate = function(coordinate) {
}; };
/**
* Get the map renderer.
* @return {ol.renderer.Map} Renderer
*/
ol.Map.prototype.getRenderer = function() {
return this.renderer_;
};
/** /**
* Get the size of this map. * Get the size of this map.
* @return {ol.Size|undefined} The size in pixels of the map in the DOM. * @return {ol.Size|undefined} The size in pixels of the map in the DOM.

View File

@@ -126,6 +126,14 @@ ol.renderer.canvas.Map.prototype.getCanvasLayerRenderer = function(layer) {
}; };
/**
* @inheritDoc
*/
ol.renderer.canvas.Map.prototype.getType = function() {
return 'canvas';
};
/** /**
* @inheritDoc * @inheritDoc
*/ */

View File

@@ -75,6 +75,14 @@ ol.renderer.dom.Map.prototype.createLayerRenderer = function(layer) {
}; };
/**
* @inheritDoc
*/
ol.renderer.dom.Map.prototype.getType = function() {
return 'dom';
};
/** /**
* @inheritDoc * @inheritDoc
*/ */

View File

@@ -163,6 +163,12 @@ ol.renderer.Map.prototype.getMap = function() {
}; };
/**
* @return {string} Type
*/
ol.renderer.Map.prototype.getType = goog.abstractMethod;
/** /**
* @param {string} layerKey Layer key. * @param {string} layerKey Layer key.
* @return {ol.renderer.Layer} Layer renderer. * @return {ol.renderer.Layer} Layer renderer.

View File

@@ -346,6 +346,14 @@ ol.renderer.webgl.Map.prototype.getTileTextureQueue = function() {
}; };
/**
* @inheritDoc
*/
ol.renderer.webgl.Map.prototype.getType = function() {
return 'webgl';
};
/** /**
* @param {goog.events.Event} event Event. * @param {goog.events.Event} event Event.
* @protected * @protected