mapserver/server/static/js/LayerManager.js

27 lines
551 B
JavaScript
Raw Normal View History

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