extended mapview to give information about the current visible tile
layer, continued work on printing
This commit is contained in:
@@ -16,7 +16,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
// map view/model
|
||||
// [extending Leaflet L.Map with setView/fitBounds methods that respect UI visibility]
|
||||
// [extending Leaflet L.Map with setView/fitBounds methods that respect UI visibility, better layerControl]
|
||||
OSRM.MapView = L.Map.extend({
|
||||
setViewUI: function(position, zoom, no_animation) {
|
||||
if( OSRM.GUI.visible == true ) {
|
||||
@@ -50,5 +50,25 @@ OSRM.MapView = L.Map.extend({
|
||||
var centerPoint = this._getTopLeftPoint().add(viewHalf.divideBy(2));
|
||||
|
||||
return this.unproject(centerPoint, this._zoom, unbounded);
|
||||
},
|
||||
addLayerControl: function( layerControl ) {
|
||||
if( this.layerControl )
|
||||
return;
|
||||
|
||||
this.layerControl = layerControl;
|
||||
this.addControl(this.layerControl);
|
||||
},
|
||||
getActiveLayerId: function() {
|
||||
var tile_server_id = 0;
|
||||
|
||||
var tile_servers = OSRM.DEFAULTS.TILE_SERVERS;
|
||||
var tile_server_name = this.layerControl.getActiveLayerName();
|
||||
for(var i=0, size=tile_servers.length; i<size; i++)
|
||||
if( tile_servers[tile_server_id].display_name == tile_server_name ) {
|
||||
tile_server_id = i;
|
||||
break;
|
||||
}
|
||||
|
||||
return tile_server_id;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user