raain-model 1.10.25 → 1.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.deploy.sh +41 -0
- package/.travis.yml +22 -0
- package/RELEASE.md +1 -0
- package/package.json +1 -2
- package/specs/cartesian/Cartesian.spec.ts +56 -0
- package/specs/gauge/Gauge.spec.ts +19 -0
- package/specs/organization/Organization.spec.ts +32 -0
- package/specs/polar/Polar.spec.ts +25 -0
- package/specs/quality/Position.spec.ts +18 -0
- package/specs/quality/QualityTools.spec.ts +120 -0
- package/specs/quality/SpeedMatrix.spec.ts +125 -0
- package/specs/radar/Radar.spec.ts +18 -0
- package/specs/rain/Rain.spec.ts +71 -0
- package/specs/tsconfig.json +12 -0
- package/{cartesian/CartesianMeasureValue.js → src/cartesian/CartesianMeasureValue.ts} +64 -34
- package/src/cartesian/CartesianValue.ts +17 -0
- package/src/cartesian/ICartesianMeasureValue.ts +27 -0
- package/src/cartesian/LatLng.ts +39 -0
- package/src/cartesian/RadarCartesianMeasureValue.ts +29 -0
- package/src/cartesian/RainCartesianMeasureValue.ts +33 -0
- package/src/gauge/GaugeMeasure.ts +36 -0
- package/src/gauge/GaugeNode.ts +46 -0
- package/src/gauge/GaugeNodeMap.ts +55 -0
- package/{index.d.ts → src/index.ts} +6 -0
- package/src/organization/EventNode.ts +44 -0
- package/{organization/Link.js → src/organization/Link.ts} +13 -13
- package/src/organization/Measure.ts +49 -0
- package/src/organization/PeopleNode.ts +36 -0
- package/{organization/RaainNode.js → src/organization/RaainNode.ts} +53 -29
- package/src/organization/TeamNode.ts +46 -0
- package/src/polar/AbstractPolarMeasureValue.ts +121 -0
- package/src/polar/GaugePolarMeasureValue.ts +15 -0
- package/src/polar/IPolarMeasureValue.ts +21 -0
- package/src/polar/MeasureValuePolarContainer.ts +28 -0
- package/{polar/PolarMeasureValue.js → src/polar/PolarMeasureValue.ts} +46 -27
- package/src/polar/PolarValue.ts +16 -0
- package/src/polar/RadarPolarMeasureValue.ts +43 -0
- package/src/polar/RainPolarMeasureValue.ts +57 -0
- package/{quality/QualityPoint.js → src/quality/QualityPoint.ts} +48 -23
- package/{quality/SpeedMatrix.js → src/quality/SpeedMatrix.ts} +117 -75
- package/{quality/SpeedMatrixContainer.js → src/quality/SpeedMatrixContainer.ts} +178 -91
- package/src/quality/history/CartesianGaugeHistory.ts +23 -0
- package/src/quality/history/CartesianRainHistory.ts +18 -0
- package/src/quality/history/PositionHistory.ts +31 -0
- package/src/quality/position/Position.ts +60 -0
- package/src/quality/position/PositionValue.ts +15 -0
- package/{quality/tools/QualityTools.js → src/quality/tools/QualityTools.ts} +82 -49
- package/src/radar/RadarMeasure.ts +27 -0
- package/src/radar/RadarNode.ts +46 -0
- package/src/radar/RadarNodeMap.ts +65 -0
- package/src/rain/RainComputation.ts +82 -0
- package/src/rain/RainComputationAbstract.ts +137 -0
- package/src/rain/RainComputationMap.ts +68 -0
- package/{rain/RainComputationQuality.js → src/rain/RainComputationQuality.ts} +56 -20
- package/src/rain/RainMeasure.ts +27 -0
- package/{rain/RainNode.js → src/rain/RainNode.ts} +76 -48
- package/tsconfig.json +17 -0
- package/tslint.json +79 -0
- package/cartesian/CartesianMeasureValue.d.ts +0 -41
- package/cartesian/CartesianMeasureValue.js.map +0 -1
- package/cartesian/CartesianValue.d.ts +0 -9
- package/cartesian/CartesianValue.js +0 -12
- package/cartesian/CartesianValue.js.map +0 -1
- package/cartesian/ICartesianMeasureValue.d.ts +0 -29
- package/cartesian/ICartesianMeasureValue.js +0 -3
- package/cartesian/ICartesianMeasureValue.js.map +0 -1
- package/cartesian/LatLng.d.ts +0 -12
- package/cartesian/LatLng.js +0 -31
- package/cartesian/LatLng.js.map +0 -1
- package/cartesian/RadarCartesianMeasureValue.d.ts +0 -15
- package/cartesian/RadarCartesianMeasureValue.js +0 -22
- package/cartesian/RadarCartesianMeasureValue.js.map +0 -1
- package/cartesian/RainCartesianMeasureValue.d.ts +0 -17
- package/cartesian/RainCartesianMeasureValue.js +0 -25
- package/cartesian/RainCartesianMeasureValue.js.map +0 -1
- package/gauge/GaugeMeasure.d.ts +0 -20
- package/gauge/GaugeMeasure.js +0 -24
- package/gauge/GaugeMeasure.js.map +0 -1
- package/gauge/GaugeNode.d.ts +0 -24
- package/gauge/GaugeNode.js +0 -31
- package/gauge/GaugeNode.js.map +0 -1
- package/gauge/GaugeNodeMap.d.ts +0 -22
- package/gauge/GaugeNodeMap.js +0 -42
- package/gauge/GaugeNodeMap.js.map +0 -1
- package/index.js +0 -56
- package/index.js.map +0 -1
- package/organization/EventNode.d.ts +0 -22
- package/organization/EventNode.js +0 -30
- package/organization/EventNode.js.map +0 -1
- package/organization/IVersion.js +0 -3
- package/organization/IVersion.js.map +0 -1
- package/organization/Link.d.ts +0 -16
- package/organization/Link.js.map +0 -1
- package/organization/Measure.d.ts +0 -20
- package/organization/Measure.js +0 -35
- package/organization/Measure.js.map +0 -1
- package/organization/PeopleNode.d.ts +0 -18
- package/organization/PeopleNode.js +0 -26
- package/organization/PeopleNode.js.map +0 -1
- package/organization/RaainNode.d.ts +0 -23
- package/organization/RaainNode.js.map +0 -1
- package/organization/TeamNode.d.ts +0 -22
- package/organization/TeamNode.js +0 -32
- package/organization/TeamNode.js.map +0 -1
- package/polar/AbstractPolarMeasureValue.d.ts +0 -29
- package/polar/AbstractPolarMeasureValue.js +0 -92
- package/polar/AbstractPolarMeasureValue.js.map +0 -1
- package/polar/GaugePolarMeasureValue.d.ts +0 -11
- package/polar/GaugePolarMeasureValue.js +0 -14
- package/polar/GaugePolarMeasureValue.js.map +0 -1
- package/polar/IPolarMeasureValue.d.ts +0 -19
- package/polar/IPolarMeasureValue.js +0 -3
- package/polar/IPolarMeasureValue.js.map +0 -1
- package/polar/MeasureValuePolarContainer.d.ts +0 -11
- package/polar/MeasureValuePolarContainer.js +0 -22
- package/polar/MeasureValuePolarContainer.js.map +0 -1
- package/polar/PolarMeasureValue.d.ts +0 -26
- package/polar/PolarMeasureValue.js.map +0 -1
- package/polar/PolarValue.d.ts +0 -10
- package/polar/PolarValue.js +0 -12
- package/polar/PolarValue.js.map +0 -1
- package/polar/RadarPolarMeasureValue.d.ts +0 -15
- package/polar/RadarPolarMeasureValue.js +0 -34
- package/polar/RadarPolarMeasureValue.js.map +0 -1
- package/polar/RainPolarMeasureValue.d.ts +0 -18
- package/polar/RainPolarMeasureValue.js +0 -42
- package/polar/RainPolarMeasureValue.js.map +0 -1
- package/quality/QualityPoint.d.ts +0 -35
- package/quality/QualityPoint.js.map +0 -1
- package/quality/SpeedMatrix.d.ts +0 -79
- package/quality/SpeedMatrix.js.map +0 -1
- package/quality/SpeedMatrixContainer.d.ts +0 -76
- package/quality/SpeedMatrixContainer.js.map +0 -1
- package/quality/history/CartesianGaugeHistory.d.ts +0 -15
- package/quality/history/CartesianGaugeHistory.js +0 -14
- package/quality/history/CartesianGaugeHistory.js.map +0 -1
- package/quality/history/CartesianRainHistory.d.ts +0 -11
- package/quality/history/CartesianRainHistory.js +0 -12
- package/quality/history/CartesianRainHistory.js.map +0 -1
- package/quality/history/PositionHistory.d.ts +0 -20
- package/quality/history/PositionHistory.js +0 -17
- package/quality/history/PositionHistory.js.map +0 -1
- package/quality/position/Position.d.ts +0 -22
- package/quality/position/Position.js +0 -50
- package/quality/position/Position.js.map +0 -1
- package/quality/position/PositionValue.d.ts +0 -9
- package/quality/position/PositionValue.js +0 -12
- package/quality/position/PositionValue.js.map +0 -1
- package/quality/tools/QualityTools.d.ts +0 -24
- package/quality/tools/QualityTools.js.map +0 -1
- package/radar/RadarMeasure.d.ts +0 -17
- package/radar/RadarMeasure.js +0 -18
- package/radar/RadarMeasure.js.map +0 -1
- package/radar/RadarNode.d.ts +0 -24
- package/radar/RadarNode.js +0 -31
- package/radar/RadarNode.js.map +0 -1
- package/radar/RadarNodeMap.d.ts +0 -28
- package/radar/RadarNodeMap.js +0 -46
- package/radar/RadarNodeMap.js.map +0 -1
- package/rain/RainComputation.d.ts +0 -34
- package/rain/RainComputation.js +0 -55
- package/rain/RainComputation.js.map +0 -1
- package/rain/RainComputationAbstract.d.ts +0 -41
- package/rain/RainComputationAbstract.js +0 -102
- package/rain/RainComputationAbstract.js.map +0 -1
- package/rain/RainComputationMap.d.ts +0 -32
- package/rain/RainComputationMap.js +0 -45
- package/rain/RainComputationMap.js.map +0 -1
- package/rain/RainComputationQuality.d.ts +0 -37
- package/rain/RainComputationQuality.js.map +0 -1
- package/rain/RainMeasure.d.ts +0 -18
- package/rain/RainMeasure.js +0 -19
- package/rain/RainMeasure.js.map +0 -1
- package/rain/RainNode.d.ts +0 -38
- package/rain/RainNode.js.map +0 -1
- /package/{organization/IVersion.d.ts → src/organization/IVersion.ts} +0 -0
|
@@ -1,70 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import {ICartesianMeasureValue} from './ICartesianMeasureValue';
|
|
2
|
+
import {CartesianValue} from './CartesianValue';
|
|
3
|
+
import {LatLng} from './LatLng';
|
|
4
|
+
|
|
5
|
+
export class CartesianMeasureValue implements ICartesianMeasureValue {
|
|
6
|
+
|
|
7
|
+
protected cartesianValues: CartesianValue[];
|
|
8
|
+
protected cartesianPixelWidth: LatLng;
|
|
9
|
+
|
|
10
|
+
constructor(json: {
|
|
11
|
+
cartesianValues: string | CartesianValue[],
|
|
12
|
+
cartesianPixelWidth: { lat: number, lng: number } | LatLng,
|
|
13
|
+
}
|
|
14
|
+
) {
|
|
15
|
+
|
|
16
|
+
if (!json?.cartesianValues || !json?.cartesianPixelWidth) {
|
|
9
17
|
throw new Error('CartesianMeasureValue needs cartesianValues && cartesianPixelWidth');
|
|
10
18
|
}
|
|
19
|
+
|
|
11
20
|
this.setCartesianValuesAsAny(json.cartesianValues);
|
|
12
21
|
this.setCartesianPixelWidth(json.cartesianPixelWidth);
|
|
22
|
+
|
|
13
23
|
}
|
|
14
|
-
|
|
24
|
+
|
|
25
|
+
static From(obj: any): CartesianMeasureValue {
|
|
15
26
|
const created = new CartesianMeasureValue({
|
|
16
27
|
cartesianValues: [],
|
|
17
|
-
cartesianPixelWidth: {
|
|
28
|
+
cartesianPixelWidth: {lat: 0, lng: 0}
|
|
18
29
|
});
|
|
30
|
+
|
|
19
31
|
if (typeof obj.cartesianValues !== 'undefined') {
|
|
20
32
|
created.setCartesianValuesAsAny(obj.cartesianValues);
|
|
21
33
|
}
|
|
34
|
+
|
|
22
35
|
if (typeof obj.cartesianPixelWidth !== 'undefined' &&
|
|
23
36
|
typeof obj.cartesianPixelWidth.lat !== 'undefined' &&
|
|
24
37
|
typeof obj.cartesianPixelWidth.lng !== 'undefined') {
|
|
25
38
|
created.setCartesianPixelWidth(obj.cartesianPixelWidth);
|
|
26
39
|
}
|
|
40
|
+
|
|
27
41
|
return created;
|
|
28
42
|
}
|
|
29
|
-
|
|
30
|
-
|
|
43
|
+
|
|
44
|
+
getCartesianValuesStringified(): string {
|
|
45
|
+
return JSON.stringify({cartesianValues: this.cartesianValues});
|
|
31
46
|
}
|
|
32
|
-
|
|
47
|
+
|
|
48
|
+
getCartesianValues(): CartesianValue[] {
|
|
33
49
|
return this.cartesianValues;
|
|
34
50
|
}
|
|
35
|
-
|
|
51
|
+
|
|
52
|
+
setCartesianValues(cartesianValues: CartesianValue[]): void {
|
|
36
53
|
this.cartesianValues = cartesianValues;
|
|
37
54
|
}
|
|
38
|
-
|
|
55
|
+
|
|
56
|
+
setCartesianValuesAsString(s: string): void {
|
|
39
57
|
let values = JSON.parse(s);
|
|
40
58
|
if (values.cartesianValues) {
|
|
41
59
|
values = values.cartesianValues;
|
|
42
60
|
}
|
|
61
|
+
|
|
43
62
|
if (Array.isArray(values)) {
|
|
44
63
|
this.cartesianValues = [];
|
|
45
64
|
values.forEach(v => {
|
|
46
|
-
this.cartesianValues.push(new
|
|
65
|
+
this.cartesianValues.push(new CartesianValue(v));
|
|
47
66
|
});
|
|
48
67
|
}
|
|
49
68
|
}
|
|
50
|
-
|
|
51
|
-
|
|
69
|
+
|
|
70
|
+
toJSON(stringify = false): JSON {
|
|
71
|
+
|
|
72
|
+
let cartesianValues: any = this.cartesianValues;
|
|
52
73
|
if (stringify) {
|
|
53
|
-
cartesianValues = JSON.stringify(this.cartesianValues)
|
|
74
|
+
cartesianValues = JSON.stringify(this.cartesianValues)
|
|
54
75
|
}
|
|
55
|
-
|
|
76
|
+
|
|
77
|
+
const json: any = {
|
|
56
78
|
cartesianValues,
|
|
57
79
|
cartesianPixelWidth: this.cartesianPixelWidth,
|
|
58
80
|
};
|
|
59
81
|
return json;
|
|
60
82
|
}
|
|
61
|
-
|
|
83
|
+
|
|
84
|
+
toJSONWithCartesianValuesStringified(): JSON {
|
|
62
85
|
return {
|
|
63
86
|
cartesianValues: JSON.stringify(this.cartesianValues),
|
|
64
87
|
cartesianPixelWidth: this.cartesianPixelWidth,
|
|
65
|
-
};
|
|
88
|
+
} as any;
|
|
66
89
|
}
|
|
67
|
-
|
|
90
|
+
|
|
91
|
+
getCartesianValue(json: { lat: number, lng: number }): CartesianValue {
|
|
68
92
|
for (const value of this.cartesianValues) {
|
|
69
93
|
if (value.lat === json.lat && value.lng === json.lng) {
|
|
70
94
|
return value;
|
|
@@ -72,7 +96,12 @@ class CartesianMeasureValue {
|
|
|
72
96
|
}
|
|
73
97
|
return null;
|
|
74
98
|
}
|
|
75
|
-
|
|
99
|
+
|
|
100
|
+
getCartesianValueRounded(json: {
|
|
101
|
+
lat: number,
|
|
102
|
+
lng: number,
|
|
103
|
+
scale: number
|
|
104
|
+
}): CartesianValue {
|
|
76
105
|
for (const value of this.cartesianValues) {
|
|
77
106
|
const latRounded1 = Math.round(json.lat / json.scale) * json.scale;
|
|
78
107
|
const lngRounded1 = Math.round(json.lng / json.scale) * json.scale;
|
|
@@ -84,23 +113,24 @@ class CartesianMeasureValue {
|
|
|
84
113
|
}
|
|
85
114
|
return null;
|
|
86
115
|
}
|
|
87
|
-
|
|
88
|
-
|
|
116
|
+
|
|
117
|
+
setCartesianValue(json: { lat: number, lng: number, value: number }): void {
|
|
118
|
+
this.cartesianValues.push(new CartesianValue(json));
|
|
89
119
|
}
|
|
90
|
-
|
|
120
|
+
|
|
121
|
+
getCartesianPixelWidth(): LatLng {
|
|
91
122
|
return this.cartesianPixelWidth;
|
|
92
123
|
}
|
|
93
|
-
|
|
94
|
-
|
|
124
|
+
|
|
125
|
+
setCartesianPixelWidth(latLng: { lat: number, lng: number } | LatLng): void {
|
|
126
|
+
this.cartesianPixelWidth = new LatLng(latLng);
|
|
95
127
|
}
|
|
96
|
-
|
|
128
|
+
|
|
129
|
+
protected setCartesianValuesAsAny(cartesianValues: any) {
|
|
97
130
|
if (typeof cartesianValues === 'string') {
|
|
98
131
|
this.setCartesianValuesAsString(cartesianValues);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
132
|
+
} else {
|
|
101
133
|
this.setCartesianValues(cartesianValues);
|
|
102
134
|
}
|
|
103
135
|
}
|
|
104
136
|
}
|
|
105
|
-
exports.CartesianMeasureValue = CartesianMeasureValue;
|
|
106
|
-
//# sourceMappingURL=CartesianMeasureValue.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {LatLng} from './LatLng';
|
|
2
|
+
|
|
3
|
+
export class CartesianValue extends LatLng {
|
|
4
|
+
|
|
5
|
+
public value: number;
|
|
6
|
+
|
|
7
|
+
constructor(json: {
|
|
8
|
+
value: number,
|
|
9
|
+
lat: number,
|
|
10
|
+
lng: number
|
|
11
|
+
}
|
|
12
|
+
) {
|
|
13
|
+
super(json);
|
|
14
|
+
this.value = json.value;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {CartesianValue} from './CartesianValue';
|
|
2
|
+
import {LatLng} from './LatLng';
|
|
3
|
+
|
|
4
|
+
export interface ICartesianMeasureValue {
|
|
5
|
+
|
|
6
|
+
getCartesianValuesStringified(): string;
|
|
7
|
+
|
|
8
|
+
getCartesianValues(): CartesianValue[];
|
|
9
|
+
|
|
10
|
+
setCartesianValues(cartesianValues: CartesianValue[]): void;
|
|
11
|
+
|
|
12
|
+
setCartesianValuesAsString(s: string): void;
|
|
13
|
+
|
|
14
|
+
toJSON(): JSON;
|
|
15
|
+
|
|
16
|
+
toJSONWithCartesianValuesStringified(): JSON;
|
|
17
|
+
|
|
18
|
+
getCartesianValue(json: { lat: number, lng: number }): CartesianValue;
|
|
19
|
+
|
|
20
|
+
getCartesianValueRounded(json: { lat: number, lng: number, scale?: number }): CartesianValue;
|
|
21
|
+
|
|
22
|
+
setCartesianValue(json: { lat: number, lng: number, value: number }): void;
|
|
23
|
+
|
|
24
|
+
getCartesianPixelWidth(): LatLng;
|
|
25
|
+
|
|
26
|
+
setCartesianPixelWidth(json: { lat: number, lng: number }): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {QualityTools} from '../quality/tools/QualityTools';
|
|
2
|
+
|
|
3
|
+
export class LatLng {
|
|
4
|
+
|
|
5
|
+
public lat: number;
|
|
6
|
+
public lng: number;
|
|
7
|
+
|
|
8
|
+
constructor(json: {
|
|
9
|
+
lat: number,
|
|
10
|
+
lng: number,
|
|
11
|
+
}) {
|
|
12
|
+
if (typeof json?.lat === 'undefined' || typeof json?.lng === 'undefined') {
|
|
13
|
+
throw new Error('LatLng needs valid latitude && longitude');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
this.lat = json.lat;
|
|
17
|
+
this.lng = json.lng;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public equals(v: LatLng) {
|
|
21
|
+
return this.lat === v.lat && this.lng === v.lng;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
setPrecision(precision: number = 12) {
|
|
25
|
+
const tenPower = Math.pow(10, precision);
|
|
26
|
+
this.lat = Math.round(this.lat * tenPower) / tenPower;
|
|
27
|
+
this.lng = Math.round(this.lng * tenPower) / tenPower;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
rounded(scale: LatLng) {
|
|
31
|
+
this.lat = QualityTools.RoundLatLng(this.lat, scale.lat, true);
|
|
32
|
+
this.lng = QualityTools.RoundLatLng(this.lng, scale.lng, true);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
limitPrecision(precision = 12) {
|
|
36
|
+
this.lat = QualityTools.LimitWithPrecision(this.lat, precision);
|
|
37
|
+
this.lng = QualityTools.LimitWithPrecision(this.lng, precision);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {CartesianValue} from './CartesianValue';
|
|
2
|
+
import {CartesianMeasureValue} from './CartesianMeasureValue';
|
|
3
|
+
|
|
4
|
+
export class RadarCartesianMeasureValue extends CartesianMeasureValue {
|
|
5
|
+
|
|
6
|
+
public angle: number;
|
|
7
|
+
|
|
8
|
+
constructor(json: {
|
|
9
|
+
cartesianValues: string | CartesianValue[],
|
|
10
|
+
cartesianPixelWidth: { lat: number, lng: number },
|
|
11
|
+
angle: number,
|
|
12
|
+
}) {
|
|
13
|
+
|
|
14
|
+
super(json);
|
|
15
|
+
this.angle = json.angle;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
toJSON(stringify = false): JSON {
|
|
19
|
+
const json: any = super.toJSON(stringify);
|
|
20
|
+
json.angle = this.angle;
|
|
21
|
+
return json;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
toJSONWithCartesianValuesStringified(): JSON {
|
|
25
|
+
const json: any = super.toJSONWithCartesianValuesStringified();
|
|
26
|
+
json.angle = this.angle;
|
|
27
|
+
return json;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {IVersion} from '../organization/IVersion';
|
|
2
|
+
import {CartesianValue} from './CartesianValue';
|
|
3
|
+
import {CartesianMeasureValue} from './CartesianMeasureValue';
|
|
4
|
+
|
|
5
|
+
export class RainCartesianMeasureValue extends CartesianMeasureValue implements IVersion {
|
|
6
|
+
|
|
7
|
+
private readonly version: string;
|
|
8
|
+
|
|
9
|
+
constructor(json: {
|
|
10
|
+
cartesianValues: string | CartesianValue[],
|
|
11
|
+
cartesianPixelWidth: { lat: number, lng: number },
|
|
12
|
+
version?: string,
|
|
13
|
+
}) {
|
|
14
|
+
super(json);
|
|
15
|
+
this.version = json.version;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getVersion(): string {
|
|
19
|
+
return this.version;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
toJSON(stringify = false): JSON {
|
|
23
|
+
const json: any = super.toJSON(stringify);
|
|
24
|
+
json.version = this.getVersion();
|
|
25
|
+
return json;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
toJSONWithCartesianValuesStringified(): JSON {
|
|
29
|
+
const json: any = super.toJSONWithCartesianValuesStringified();
|
|
30
|
+
json.version = this.getVersion();
|
|
31
|
+
return json;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {Measure} from '../organization/Measure';
|
|
2
|
+
import {IPolarMeasureValue} from '../polar/IPolarMeasureValue';
|
|
3
|
+
import {ICartesianMeasureValue} from '../cartesian/ICartesianMeasureValue';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* api/gauges/:id/measures/:id
|
|
7
|
+
*/
|
|
8
|
+
export class GaugeMeasure extends Measure {
|
|
9
|
+
|
|
10
|
+
public static TYPE = 'gauge-measure';
|
|
11
|
+
public timeInSec: number;
|
|
12
|
+
|
|
13
|
+
constructor(json: {
|
|
14
|
+
id: string,
|
|
15
|
+
values: IPolarMeasureValue[] | ICartesianMeasureValue[] | Measure[] | number[],
|
|
16
|
+
date?: Date,
|
|
17
|
+
validity?: number,
|
|
18
|
+
timeInSec?: number,
|
|
19
|
+
configurationAsJSON?: string | any,
|
|
20
|
+
}
|
|
21
|
+
) {
|
|
22
|
+
super(json);
|
|
23
|
+
this.timeInSec = json.timeInSec >= 0 ? json.timeInSec : -1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public toJSON(): JSON {
|
|
27
|
+
const json = super.toJSON();
|
|
28
|
+
json['timeInSec'] = this.timeInSec;
|
|
29
|
+
return json;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
protected getLinkType(): string {
|
|
33
|
+
return GaugeMeasure.TYPE;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {RaainNode} from '../organization/RaainNode';
|
|
2
|
+
import {Link} from '../organization/Link';
|
|
3
|
+
import {TeamNode} from '../organization/TeamNode';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* api/gauges/:id
|
|
7
|
+
*/
|
|
8
|
+
export class GaugeNode extends RaainNode {
|
|
9
|
+
|
|
10
|
+
public static TYPE = 'gauge';
|
|
11
|
+
|
|
12
|
+
public name: string;
|
|
13
|
+
public latitude: number;
|
|
14
|
+
public longitude: number;
|
|
15
|
+
public team: TeamNode;
|
|
16
|
+
|
|
17
|
+
constructor(json: {
|
|
18
|
+
id: string,
|
|
19
|
+
latitude: number,
|
|
20
|
+
longitude: number,
|
|
21
|
+
name?: string,
|
|
22
|
+
links?: Link[] | RaainNode[],
|
|
23
|
+
team?: TeamNode,
|
|
24
|
+
version?: string,
|
|
25
|
+
}) {
|
|
26
|
+
super(json);
|
|
27
|
+
this.latitude = json.latitude;
|
|
28
|
+
this.longitude = json.longitude;
|
|
29
|
+
this.name = json.name;
|
|
30
|
+
this.team = json.team;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public toJSON(): JSON {
|
|
34
|
+
const json = super.toJSON();
|
|
35
|
+
json['latitude'] = this.latitude;
|
|
36
|
+
json['longitude'] = this.longitude;
|
|
37
|
+
json['name'] = this.name;
|
|
38
|
+
json['team'] = this.team?.id || this.team;
|
|
39
|
+
return json;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected getLinkType(): string {
|
|
43
|
+
return GaugeNode.TYPE;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {Link} from '../organization/Link';
|
|
2
|
+
import {GaugeNode} from './GaugeNode';
|
|
3
|
+
import {GaugeMeasure} from './GaugeMeasure';
|
|
4
|
+
import {RaainNode} from '../organization/RaainNode';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* api/gauges/:id?format=map&begin=...
|
|
8
|
+
*/
|
|
9
|
+
export class GaugeNodeMap extends GaugeNode {
|
|
10
|
+
|
|
11
|
+
private map: string; // GaugeMeasure[]; stringified
|
|
12
|
+
|
|
13
|
+
constructor(json: {
|
|
14
|
+
id: string,
|
|
15
|
+
latitude: number,
|
|
16
|
+
longitude: number,
|
|
17
|
+
map?: string,
|
|
18
|
+
name?: string,
|
|
19
|
+
links?: Link[] | RaainNode[],
|
|
20
|
+
version?: string,
|
|
21
|
+
}) {
|
|
22
|
+
super(json);
|
|
23
|
+
this.setMapData(json.map);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public toJSON(): JSON {
|
|
27
|
+
const json = super.toJSON();
|
|
28
|
+
if (this.map) {
|
|
29
|
+
json['map'] = this.map;
|
|
30
|
+
}
|
|
31
|
+
return json;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public setMapData(mapData: GaugeMeasure[] | string) {
|
|
35
|
+
if (!mapData) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let map = mapData;
|
|
40
|
+
try {
|
|
41
|
+
if (typeof (mapData) !== 'string') {
|
|
42
|
+
map = JSON.stringify(mapData);
|
|
43
|
+
}
|
|
44
|
+
} catch (e) {
|
|
45
|
+
}
|
|
46
|
+
this.map = map.toString();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public getMapData(): GaugeMeasure[] {
|
|
50
|
+
if (!this.map) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
return JSON.parse(this.map);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -4,6 +4,7 @@ export * from './organization/PeopleNode';
|
|
|
4
4
|
export * from './organization/Link';
|
|
5
5
|
export * from './organization/RaainNode';
|
|
6
6
|
export * from './organization/TeamNode';
|
|
7
|
+
|
|
7
8
|
export * from './quality/QualityPoint';
|
|
8
9
|
export * from './quality/SpeedMatrix';
|
|
9
10
|
export * from './quality/SpeedMatrixContainer';
|
|
@@ -14,17 +15,21 @@ export * from './quality/tools/QualityTools';
|
|
|
14
15
|
export * from './cartesian/LatLng';
|
|
15
16
|
export * from './quality/position/Position';
|
|
16
17
|
export * from './quality/position/PositionValue';
|
|
18
|
+
|
|
17
19
|
export * from './gauge/GaugeNode';
|
|
18
20
|
export * from './gauge/GaugeMeasure';
|
|
19
21
|
export * from './gauge/GaugeNodeMap';
|
|
22
|
+
|
|
20
23
|
export * from './radar/RadarMeasure';
|
|
21
24
|
export * from './radar/RadarNodeMap';
|
|
22
25
|
export * from './radar/RadarNode';
|
|
26
|
+
|
|
23
27
|
export * from './rain/RainMeasure';
|
|
24
28
|
export * from './rain/RainNode';
|
|
25
29
|
export * from './rain/RainComputationQuality';
|
|
26
30
|
export * from './rain/RainComputation';
|
|
27
31
|
export * from './rain/RainComputationMap';
|
|
32
|
+
|
|
28
33
|
export * from './polar/GaugePolarMeasureValue';
|
|
29
34
|
export * from './polar/MeasureValuePolarContainer';
|
|
30
35
|
export * from './polar/PolarMeasureValue';
|
|
@@ -32,6 +37,7 @@ export * from './polar/PolarValue';
|
|
|
32
37
|
export * from './polar/RadarPolarMeasureValue';
|
|
33
38
|
export * from './polar/RainPolarMeasureValue';
|
|
34
39
|
export * from './polar/IPolarMeasureValue';
|
|
40
|
+
|
|
35
41
|
export * from './cartesian/CartesianValue';
|
|
36
42
|
export * from './cartesian/CartesianMeasureValue';
|
|
37
43
|
export * from './cartesian/RadarCartesianMeasureValue';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* api/notifications/:id
|
|
3
|
+
*/
|
|
4
|
+
export class EventNode {
|
|
5
|
+
public id: string;
|
|
6
|
+
public title: string;
|
|
7
|
+
public status: number;
|
|
8
|
+
public red: boolean;
|
|
9
|
+
public description: string;
|
|
10
|
+
public created: Date;
|
|
11
|
+
public modified: Date;
|
|
12
|
+
|
|
13
|
+
constructor(json: {
|
|
14
|
+
id: string,
|
|
15
|
+
title: string,
|
|
16
|
+
status: number,
|
|
17
|
+
red: boolean,
|
|
18
|
+
description: string,
|
|
19
|
+
created: Date,
|
|
20
|
+
modified: Date
|
|
21
|
+
}
|
|
22
|
+
) {
|
|
23
|
+
this.id = json.id;
|
|
24
|
+
this.title = json.title;
|
|
25
|
+
this.status = json.status;
|
|
26
|
+
this.red = json.red;
|
|
27
|
+
this.description = json.description;
|
|
28
|
+
this.created = json.created;
|
|
29
|
+
this.modified = json.modified;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public toJSON(): JSON {
|
|
33
|
+
return {
|
|
34
|
+
id: this.id,
|
|
35
|
+
title: this.title,
|
|
36
|
+
status: this.status,
|
|
37
|
+
red: this.red,
|
|
38
|
+
description: this.description,
|
|
39
|
+
created: this.created,
|
|
40
|
+
modified: this.modified,
|
|
41
|
+
} as any;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Link = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Hateoas Links :
|
|
6
3
|
* [ {
|
|
@@ -8,27 +5,30 @@ exports.Link = void 0;
|
|
|
8
5
|
* href: string // like "https://.../rains/2"
|
|
9
6
|
* },...]
|
|
10
7
|
*/
|
|
11
|
-
class Link {
|
|
12
|
-
constructor(
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
export class Link {
|
|
9
|
+
constructor(
|
|
10
|
+
public rel: string,
|
|
11
|
+
public href: string
|
|
12
|
+
) {
|
|
15
13
|
}
|
|
16
|
-
|
|
14
|
+
|
|
15
|
+
public static isCloneable(object: any): boolean {
|
|
17
16
|
return object && object.rel && object.href;
|
|
18
17
|
}
|
|
19
|
-
|
|
18
|
+
|
|
19
|
+
public static clone(object: any): Link {
|
|
20
20
|
return new Link(object.rel, object.href);
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
public getId(): string {
|
|
23
24
|
const urls = this.href.split('/');
|
|
24
25
|
// can be enforced : verify rel in -2 urls ?...
|
|
25
26
|
return urls[urls.length - 1];
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
+
|
|
29
|
+
public getLinkType(): string {
|
|
28
30
|
const urls = this.href.split('/');
|
|
29
31
|
// can be enforced : verify rel in -2 urls ?...
|
|
30
32
|
return urls[0];
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
|
-
exports.Link = Link;
|
|
34
|
-
//# sourceMappingURL=Link.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {IPolarMeasureValue} from '../polar/IPolarMeasureValue';
|
|
2
|
+
import {RaainNode} from './RaainNode';
|
|
3
|
+
import {ICartesianMeasureValue} from '../cartesian/ICartesianMeasureValue';
|
|
4
|
+
|
|
5
|
+
export class Measure extends RaainNode {
|
|
6
|
+
public date: Date;
|
|
7
|
+
public values: IPolarMeasureValue[] | ICartesianMeasureValue[] | Measure[] | number[];
|
|
8
|
+
// -> why array ? because you can have potential different angle from the Radar
|
|
9
|
+
|
|
10
|
+
public validity: number
|
|
11
|
+
private configurationAsJSON: string;
|
|
12
|
+
|
|
13
|
+
constructor(json: {
|
|
14
|
+
id: string,
|
|
15
|
+
values: IPolarMeasureValue[] | ICartesianMeasureValue[] | Measure[] | number[],
|
|
16
|
+
date?: Date,
|
|
17
|
+
validity?: number,
|
|
18
|
+
configurationAsJSON?: string | any,
|
|
19
|
+
}
|
|
20
|
+
) {
|
|
21
|
+
super(json);
|
|
22
|
+
this.values = json.values ? json.values : [];
|
|
23
|
+
this.date = json.date ? new Date(json.date) : undefined;
|
|
24
|
+
this.validity = json.validity >= 0 ? json.validity : -1;
|
|
25
|
+
this.setConfiguration(json.configurationAsJSON);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public setConfiguration(configuration: string | any) {
|
|
29
|
+
let conf = configuration;
|
|
30
|
+
try {
|
|
31
|
+
conf = JSON.parse(configuration);
|
|
32
|
+
} catch (ignored) {
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
this.configurationAsJSON = JSON.stringify(conf);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public toJSON(options: { removeValues?: boolean } = {}): JSON {
|
|
39
|
+
const json = super.toJSON();
|
|
40
|
+
json['date'] = this.date?.toISOString();
|
|
41
|
+
json['validity'] = this.validity;
|
|
42
|
+
json['configurationAsJSON'] = this.configurationAsJSON;
|
|
43
|
+
|
|
44
|
+
if (!options?.removeValues) {
|
|
45
|
+
json['values'] = this.values;
|
|
46
|
+
}
|
|
47
|
+
return json;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* api/teams/:id => contacts
|
|
3
|
+
*/
|
|
4
|
+
export class PeopleNode {
|
|
5
|
+
|
|
6
|
+
public id: string;
|
|
7
|
+
public role: string;
|
|
8
|
+
public email: string;
|
|
9
|
+
public name: string;
|
|
10
|
+
public comments: string; // potential additional info
|
|
11
|
+
|
|
12
|
+
constructor(json: {
|
|
13
|
+
id: string,
|
|
14
|
+
role: string,
|
|
15
|
+
email: string,
|
|
16
|
+
name: string,
|
|
17
|
+
comments: string
|
|
18
|
+
}
|
|
19
|
+
) {
|
|
20
|
+
this.id = json.id;
|
|
21
|
+
this.role = json.role;
|
|
22
|
+
this.email = json.email;
|
|
23
|
+
this.name = json.name;
|
|
24
|
+
this.comments = json.comments;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public toJSON(): JSON {
|
|
28
|
+
return {
|
|
29
|
+
id: this.id,
|
|
30
|
+
role: this.role,
|
|
31
|
+
email: this.email,
|
|
32
|
+
name: this.name,
|
|
33
|
+
comments: this.comments,
|
|
34
|
+
} as any;
|
|
35
|
+
}
|
|
36
|
+
}
|