1
0
forked from MTSR/mapserver
mapserver/server/static/js/LayerManager.js

27 lines
551 B
JavaScript
Raw Normal View History

2019-02-01 12:58:26 +01:00
'use strict';
2019-01-29 21:07:29 +01:00
2019-02-01 13:20:50 +01:00
function LayerManager(layers, map){
2019-02-01 13:28:26 +01:00
this.listeners = [];
this.currentLayer = layers[0];
2019-02-01 13:20:50 +01:00
map.on('baselayerchange', function (e) {
console.log("baselayerchange", e.layer);
2019-02-01 13:28:26 +01:00
//TODO
2019-02-01 13:20:50 +01:00
});
2019-02-01 13:28:26 +01:00
2019-02-01 12:58:26 +01:00
}
2019-01-29 21:07:29 +01:00
2019-02-01 12:58:26 +01:00
LayerManager.prototype.addListener = function(listener){
2019-02-01 13:28:26 +01:00
this.listeners.push(listener);
};
LayerManager.prototype.removeListener = function(listener){
this.listeners = this.listeners.filter(function(el){
return el != listener;
});
2019-02-01 12:58:26 +01:00
};
2019-01-29 21:07:29 +01:00
2019-02-01 12:58:26 +01:00
LayerManager.prototype.getCurrentLayer = function(){
2019-02-01 13:28:26 +01:00
return this.currentLayer;
2019-02-01 12:46:38 +01:00
};