-
Notifications
You must be signed in to change notification settings - Fork 7
/
fdsncommon.ts
78 lines (63 loc) · 1.5 KB
/
fdsncommon.ts
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
/**
* commonalities with all types of FDSN Web Services
*/
import { isNonEmptyStringArg, checkProtocol,} from './util';
export const IRIS_HOST = "service.iris.edu";
export class FDSNCommon {
/** @private */
_specVersion: string;
/** @private */
_protocol: string;
/** @private */
_host: string;
/** @private */
_port: number;
/** @private */
_nodata: number|undefined;
/** @private */
_timeoutSec: number;
constructor(host?: string) {
this._specVersion = "1";
this._host = IRIS_HOST;
this._protocol = checkProtocol();
if (isNonEmptyStringArg(host)) {
this._host = host;
}
this._port = 80;
this._timeoutSec = 30;
}
}
export class LatLonRegion {
}
export class LatLonBox extends LatLonRegion {
west: number;
east: number;
south: number;
north: number;
constructor(west: number, east: number, south: number, north: number) {
super();
this.west = west;
this.east = east;
this.south = south;
this.north = north;
}
asLeafletBounds(): [[number, number],[number, number]] {
return [
[this.south, this.west],
[this.north,this.east]
];
}
}
export class LatLonRadius extends LatLonRegion {
latitude: number;
longitude: number;
minRadius: number;
maxRadius: number;
constructor(latitude: number, longitude: number, minRadius: number, maxRadius: number) {
super();
this.latitude = latitude;
this.longitude = longitude;
this.minRadius = minRadius;
this.maxRadius = maxRadius;
}
}