Move busui to seperate repository
[bus.git] / owa.map.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
OWA.map = function() {
        
        return; 
}
 
OWA.map.prototype = {
 
        markers: new Object,
        
        config: '',
        
        dom_id: 'map',
                
        height: "100%",
        
        width: "100%",
        
        mapType: '',
        
        placeMarkers: function() {
        
                var lvmarkers = this.markers;
                var dom_id = this.dom_id;
                var mType = this.getMapSettings();
                
                
                jQuery(document).ready(function(){
                        
                        jQuery('#'+ dom_id).jmap('init', mType);
                        
                        for(k in lvmarkers) {
                                
                                jQuery('#'+ dom_id).jmap('AddMarker', lvmarkers[k]);
                                        
                        }
                
                });
        
                return;
        
        },
        
        getMapSettings: function() {
        
                switch(this.mapType) {
                
                        case 'earth':
                                return {'mapType': G_SATELLITE_3D_MAP,'mapZoom': 3,'mapCenter':[30.958639, -90.162516], 'mapShowjMapsIcon': false, 'mapEnableType': true, 'mapEnableOverview': true};
 
                                break;
                                
                        default:
                                
                                return {'mapType': G_NORMAL_MAP,'mapZoom': 2,'mapCenter':[8.958639, -3.162516], 'mapShowjMapsIcon': false, 'mapEnableType': true, 'mapEnableOverview': true};
 
                
                }
                
        },
        
        reloadMap: function(t) {
                
                this.mapType = t;
                this.placeMarkers();
                return;
        }
                
}
 
// Bind event handlers
jQuery(document).ready(function(){  
        //jQuery.getScript(OWA.config.js_url + "includes/jquery/tablesorter/jquery.tablesorter.js");     
        jQuery('.owa_map-type-control').click(owa_map_changeView);
        
});
 
function owa_map_changeView() {
 
        // get the map id
        var dom_id = jQuery(this).siblings('.jmap').get(0).id;
        var type = jQuery(this).attr('maptype');
        OWA.items[dom_id].reloadMap(type);
        return;
 
}