-
Notifications
You must be signed in to change notification settings - Fork 5
/
googlemapsutil.js
89 lines (78 loc) · 2.97 KB
/
googlemapsutil.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
/*!
* gmaputil
* Copyright(c) 2013 Shunsuke <[email protected]>
* MIT Licensed
*/
var objectutil = require('./lib/objectutil.js')
, Directions = require('./lib/directions.js')
, Distancematrix = require('./lib/distancematrix.js')
, Elevation = require('./lib/elevation.js')
, Geocoding = require('./lib/geocoding.js')
, Timezone = require('./lib/timezone.js')
, StaticMaps = require('./lib/staticmaps.js');
var directions = new Directions()
, distancematrix = new Distancematrix()
, elevation = new Elevation()
, geocoding = new Geocoding()
, timezone = new Timezone()
, staticmaps = new StaticMaps();
var services = [];
services.push(directions);
services.push(distancematrix);
services.push(elevation);
services.push(geocoding);
services.push(timezone);
services.push(staticmaps);
var gmaputil = {
setProxy: function(proxy, port) {
for (var i = 0; i < services.length; i++) {
services[i].setProxy(proxy, port);
}
},
setParameter: function(key, value) {
for (var i = 0; i < services.length; i++) {
services[i].setParameter(key, value);
}
},
clearParameter: function() {
for (var i = 0; i < services.length; i++) {
services[i].clearParameter();
}
},
setOutput: function(type) {
for (var i = 0; i < services.length; i++) {
services[i].setOutput(type);
}
},
directions: function(origin, destination, options, cb, sensor, isHttps, isRequest) {
directions.directions(origin, destination, options, cb, sensor, isHttps, isRequest);
},
distancematrix: function(origins, destinations, options, cb, sensor, isHttps, isRequest) {
distancematrix.distancematrix(origins, destinations, options, cb, sensor, isHttps, isRequest);
},
locations: function(locations, options, cb, sensor, isHttps, isRequest) {
elevation.locations(locations, options, cb, sensor, isHttps, isRequest);
},
path: function(path, sample, options, cb, sensor, isHttps, isRequest) {
elevation.path(path, sample, options, cb, sensor, isHttps, isRequest);
},
geocoding: function(address, options, cb, sensor, isHttps, isRequest) {
geocoding.geocoding(address, options, cb, sensor, isHttps, isRequest);
},
reverseGeocoding: function(lat, lng, options, cb, sensor, isHttps, isRequest) {
geocoding.reverseGeocoding(lat, lng, options, cb, sensor, isHttps, isRequest);
},
timezone: function(lat, lng, timestamp, options, cb, sensor, isHttps, isRequest) {
timezone.timezone(lat, lng, timestamp, options, cb, sensor, isHttps, isRequest);
},
staticmapas: function(parameters, cb, sensor, isHttps, isRequest) {
staticmaps.staticmaps(parameters, cb, sensor, isHttps, isRequest);
}
};
module.exports = gmaputil;
module.exports.Directions = Directions;
module.exports.Distancematrix = Distancematrix;
module.exports.Elevation = Elevation;
module.exports.Geocoding = Geocoding;
module.exports.Timezone = Timezone;
module.exports.StaticMaps = StaticMaps;