function LayersInterface(map) { this.map = map; // map interface object this.elLrCyklo = null; this.elLrTurist = null; this.elLrSR = null; this._create = function() { this.elLrCyklo = document.getElementById('rb_vrstva_cyklo'); this.elLrTurist = document.getElementById('rb_vrstva_turist'); this.elLrSR = document.getElementById('cb_vrstva_relief'); var mapType = this.map.getMapType(); var sr = this.map.isOnRelief; this.elSelectMapType(mapType); if (sr) { this.elShowSR(); } else { this.elHideSR(); } this.attachEvents(); } this.setMapTypeOnly = function(id) { if (!id) { this.map.activateLayerCyklo(); } else { this.map.activateLayerTurist(); } } this.elSelectMapType = function(id) { if (id == 1) { if (this.elLrTurist) { this.elLrTurist.checked = true; } } else { if (this.elLrCyklo) { this.elLrCyklo.checked = true; } } } this.elShowSR = function() { if (this.elLrSR) { this.elLrSR.checked = true; } } this.elHideSR = function() { if (this.elLrSR) { this.elLrSR.checked = false; } } this.onClickElLrCyklo = function() { this.setMapTypeOnly(0); } this.onClickElLrTurist = function() { this.setMapTypeOnly(1); } this.onClickElLrSR = function() { var sr = this.map.isOnRelief; if (sr) { this.map.deactivateLayerRelief(); } else { this.map.activateLayerRelief(); } } this.attachEvents = function() { if (this.elLrCyklo) { $(this.elLrCyklo).bind('click', jQuery.proxy(this.onClickElLrCyklo, this)); } if (this.elLrTurist) { $(this.elLrTurist).bind('click', jQuery.proxy(this.onClickElLrTurist, this)); } if (this.elLrSR) { $(this.elLrSR).bind('click', jQuery.proxy(this.onClickElLrSR, this)); } //GEvent.addListener(this.map.gmap, "moveend", jQuery.proxy(this.onUpdateLayers, this)); } this._create(); }