156 lines
4.1 KiB
TypeScript
156 lines
4.1 KiB
TypeScript
export namespace propagator {
|
|
|
|
export class GroundtrackPoint {
|
|
lat: number;
|
|
lon: number;
|
|
// Go type: time
|
|
t: any;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new GroundtrackPoint(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.lat = source["lat"];
|
|
this.lon = source["lon"];
|
|
this.t = this.convertValues(source["t"], null);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class PassPoint {
|
|
// Go type: time
|
|
t: any;
|
|
az: number;
|
|
el: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new PassPoint(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.t = this.convertValues(source["t"], null);
|
|
this.az = source["az"];
|
|
this.el = source["el"];
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
export class Pass {
|
|
satName: string;
|
|
// Go type: time
|
|
aos: any;
|
|
// Go type: time
|
|
los: any;
|
|
maxEl: number;
|
|
// Go type: time
|
|
maxElTime: any;
|
|
aosAz: number;
|
|
losAz: number;
|
|
maxElAz: number;
|
|
duration: number;
|
|
points: PassPoint[];
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new Pass(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.satName = source["satName"];
|
|
this.aos = this.convertValues(source["aos"], null);
|
|
this.los = this.convertValues(source["los"], null);
|
|
this.maxEl = source["maxEl"];
|
|
this.maxElTime = this.convertValues(source["maxElTime"], null);
|
|
this.aosAz = source["aosAz"];
|
|
this.losAz = source["losAz"];
|
|
this.maxElAz = source["maxElAz"];
|
|
this.duration = source["duration"];
|
|
this.points = this.convertValues(source["points"], PassPoint);
|
|
}
|
|
|
|
convertValues(a: any, classs: any, asMap: boolean = false): any {
|
|
if (!a) {
|
|
return a;
|
|
}
|
|
if (a.slice && a.map) {
|
|
return (a as any[]).map(elem => this.convertValues(elem, classs));
|
|
} else if ("object" === typeof a) {
|
|
if (asMap) {
|
|
for (const key of Object.keys(a)) {
|
|
a[key] = new classs(a[key]);
|
|
}
|
|
return a;
|
|
}
|
|
return new classs(a);
|
|
}
|
|
return a;
|
|
}
|
|
}
|
|
|
|
export class SatPosition {
|
|
name: string;
|
|
lat: number;
|
|
lon: number;
|
|
alt: number;
|
|
az: number;
|
|
el: number;
|
|
range: number;
|
|
rangeRate: number;
|
|
footprint: number;
|
|
|
|
static createFrom(source: any = {}) {
|
|
return new SatPosition(source);
|
|
}
|
|
|
|
constructor(source: any = {}) {
|
|
if ('string' === typeof source) source = JSON.parse(source);
|
|
this.name = source["name"];
|
|
this.lat = source["lat"];
|
|
this.lon = source["lon"];
|
|
this.alt = source["alt"];
|
|
this.az = source["az"];
|
|
this.el = source["el"];
|
|
this.range = source["range"];
|
|
this.rangeRate = source["rangeRate"];
|
|
this.footprint = source["footprint"];
|
|
}
|
|
}
|
|
|
|
}
|
|
|