This repository was archived by the owner on Apr 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathMapKit.js
More file actions
70 lines (55 loc) · 1.76 KB
/
MapKit.js
File metadata and controls
70 lines (55 loc) · 1.76 KB
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
(function() {
var cordovaRef = window.PhoneGap || window.Cordova || window.cordova;
var MapKit = function() {
this.options = {
buttonCallback: 'window.mapKit.onMapCallback',
height: 460,
diameter: 1000,
atBottom: true,
lat: 49.281468,
lon: -123.104446
};
this.mapType = {
MAP_TYPE_NONE: 0, //No base map tiles.
MAP_TYPE_NORMAL: 1, //Basic maps.
MAP_TYPE_SATELLITE: 2, //Satellite maps with no labels.
MAP_TYPE_TERRAIN: 3, //Terrain maps.
MAP_TYPE_HYBRID: 4 //Satellite maps with a transparent layer of major streets.
};
this.iconColors = {
HUE_RED: 0.0,
HUE_ORANGE: 30.0,
HUE_YELLOW: 60.0,
HUE_GREEN: 120.0,
HUE_CYAN: 180.0,
HUE_AZURE: 210.0,
HUE_BLUE: 240.0,
HUE_VIOLET: 270.0,
HUE_MAGENTA: 300.0,
HUE_ROSE: 330.0
};
};
MapKit.prototype = {
onMapCallback: function(pindex) {
// alert('Index of selected pin: ' + pindex);
},
showMap: function(success, error) {
cordovaRef.exec(success, error, 'MapKit', 'showMap', [this.options]);
},
addMapPins: function(pins, success, error) {
cordovaRef.exec(success, error, 'MapKit', 'addMapPins', [pins]);
},
clearMapPins: function(success, error) {
cordovaRef.exec(success, error, 'MapKit', 'clearMapPins', []);
},
hideMap: function(success, error) {
cordovaRef.exec(success, error, 'MapKit', 'hideMap', []);
},
changeMapType: function(mapType, success, error) {
cordovaRef.exec(success, error, 'MapKit', 'changeMapType', [mapType ? { "mapType": mapType } :{ "mapType": 0 }]);
}
};
cordovaRef.addConstructor(function() {
window.mapKit = new MapKit();
});
})();