~costales/unav/0.62-choose-tiles

« back to all changes in this revision

Viewing changes to nav/class/UI.js

  • Committer: costales
  • Date: 2016-08-01 14:51:15 UTC
  • Revision ID: costales.marcos@gmail.com-20160801145115-c282tqgxb402vrc6
Choose tiles

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
        this.zoom_unav = true;
30
30
        this.map_stretched = true;
31
31
        
32
 
        this.map_layer = 0;
33
 
 
34
32
        this.marker_pos = new ol.Overlay({
35
33
                positioning: 'center-center',
36
34
                element: document.getElementById('marker_pos')
126
124
        return this.center_onpos;
127
125
}
128
126
 
129
 
UI.prototype.set_map_layer = function(value) {
130
 
        this.map_layer = value;
131
 
        if (value == 0) {
132
 
                this.map.getLayers().getArray()[0].setVisible(true);  // Online
133
 
                this.map.getLayers().getArray()[1].setVisible(false); // Offline
134
 
                $('#map_attribution').show();
135
 
                $(".map").removeClass('body_bg');
136
 
        }
137
 
        else {
138
 
                this.map.getLayers().getArray()[0].setVisible(false); // Online
139
 
                this.map.getLayers().getArray()[1].setVisible(true);  // Offline
140
 
                $('#map_attribution').hide();
141
 
                $(".map").addClass('body_bg');
142
 
        }
143
 
}
144
 
 
145
 
UI.prototype.get_map_layer = function() {
146
 
        return this.map_layer;
 
127
UI.prototype.set_map_layer = function(layer) {
 
128
        switch (layer) {
 
129
                case 'terrain':
 
130
                        this.map.getLayers().getArray()[0].setVisible(true);  // Online terrain
 
131
                        this.map.getLayers().getArray()[1].setVisible(false); // Online OSM
 
132
                        this.map.getLayers().getArray()[2].setVisible(false); // Offline
 
133
                        $('#map_attribution').html("<span onclick=\"qml_go_url('https://mapzen.com')\">© Mapzen</span> <span onclick=\"qml_go_url('http://stamen.com')\">© Stamen</span> <span onclick=\"qml_go_url('http://www.openstreetmap.org/copyright')\">© OpenStreetMap contributors</span>");
 
134
                        $('#map_attribution').show();
 
135
                        $(".map").removeClass('body_bg');
 
136
                        break;
 
137
                case 'OSM':
 
138
                        this.map.getLayers().getArray()[0].setVisible(false); // Online terrain
 
139
                        this.map.getLayers().getArray()[1].setVisible(true);  // Online OSM
 
140
                        this.map.getLayers().getArray()[2].setVisible(false); // Offline
 
141
                        $('#map_attribution').html("<span onclick=\"qml_go_url('https://mapzen.com')\">© Mapzen</span> <span onclick=\"qml_go_url('http://www.openstreetmap.org/copyright')\">© OpenStreetMap contributors</span>");
 
142
                        $('#map_attribution').show();
 
143
                        $(".map").removeClass('body_bg');
 
144
                        break;
 
145
                case 'offline':
 
146
                        this.map.getLayers().getArray()[0].setVisible(false); // Online terrain
 
147
                        this.map.getLayers().getArray()[1].setVisible(false); // Online OSM
 
148
                        this.map.getLayers().getArray()[2].setVisible(true);  // Offline
 
149
                        $('#map_attribution').show();
 
150
                        $(".map").addClass('body_bg');
 
151
                        break;
 
152
        }
147
153
}
148
154
 
149
155
UI.prototype.set_center_1st_pos = function(status) {