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.
Files changed (176) hide show
  1. package/.travis.deploy.sh +41 -0
  2. package/.travis.yml +22 -0
  3. package/RELEASE.md +1 -0
  4. package/package.json +1 -2
  5. package/specs/cartesian/Cartesian.spec.ts +56 -0
  6. package/specs/gauge/Gauge.spec.ts +19 -0
  7. package/specs/organization/Organization.spec.ts +32 -0
  8. package/specs/polar/Polar.spec.ts +25 -0
  9. package/specs/quality/Position.spec.ts +18 -0
  10. package/specs/quality/QualityTools.spec.ts +120 -0
  11. package/specs/quality/SpeedMatrix.spec.ts +125 -0
  12. package/specs/radar/Radar.spec.ts +18 -0
  13. package/specs/rain/Rain.spec.ts +71 -0
  14. package/specs/tsconfig.json +12 -0
  15. package/{cartesian/CartesianMeasureValue.js → src/cartesian/CartesianMeasureValue.ts} +64 -34
  16. package/src/cartesian/CartesianValue.ts +17 -0
  17. package/src/cartesian/ICartesianMeasureValue.ts +27 -0
  18. package/src/cartesian/LatLng.ts +39 -0
  19. package/src/cartesian/RadarCartesianMeasureValue.ts +29 -0
  20. package/src/cartesian/RainCartesianMeasureValue.ts +33 -0
  21. package/src/gauge/GaugeMeasure.ts +36 -0
  22. package/src/gauge/GaugeNode.ts +46 -0
  23. package/src/gauge/GaugeNodeMap.ts +55 -0
  24. package/{index.d.ts → src/index.ts} +6 -0
  25. package/src/organization/EventNode.ts +44 -0
  26. package/{organization/Link.js → src/organization/Link.ts} +13 -13
  27. package/src/organization/Measure.ts +49 -0
  28. package/src/organization/PeopleNode.ts +36 -0
  29. package/{organization/RaainNode.js → src/organization/RaainNode.ts} +53 -29
  30. package/src/organization/TeamNode.ts +46 -0
  31. package/src/polar/AbstractPolarMeasureValue.ts +121 -0
  32. package/src/polar/GaugePolarMeasureValue.ts +15 -0
  33. package/src/polar/IPolarMeasureValue.ts +21 -0
  34. package/src/polar/MeasureValuePolarContainer.ts +28 -0
  35. package/{polar/PolarMeasureValue.js → src/polar/PolarMeasureValue.ts} +46 -27
  36. package/src/polar/PolarValue.ts +16 -0
  37. package/src/polar/RadarPolarMeasureValue.ts +43 -0
  38. package/src/polar/RainPolarMeasureValue.ts +57 -0
  39. package/{quality/QualityPoint.js → src/quality/QualityPoint.ts} +48 -23
  40. package/{quality/SpeedMatrix.js → src/quality/SpeedMatrix.ts} +117 -75
  41. package/{quality/SpeedMatrixContainer.js → src/quality/SpeedMatrixContainer.ts} +178 -91
  42. package/src/quality/history/CartesianGaugeHistory.ts +23 -0
  43. package/src/quality/history/CartesianRainHistory.ts +18 -0
  44. package/src/quality/history/PositionHistory.ts +31 -0
  45. package/src/quality/position/Position.ts +60 -0
  46. package/src/quality/position/PositionValue.ts +15 -0
  47. package/{quality/tools/QualityTools.js → src/quality/tools/QualityTools.ts} +82 -49
  48. package/src/radar/RadarMeasure.ts +27 -0
  49. package/src/radar/RadarNode.ts +46 -0
  50. package/src/radar/RadarNodeMap.ts +65 -0
  51. package/src/rain/RainComputation.ts +82 -0
  52. package/src/rain/RainComputationAbstract.ts +137 -0
  53. package/src/rain/RainComputationMap.ts +68 -0
  54. package/{rain/RainComputationQuality.js → src/rain/RainComputationQuality.ts} +56 -20
  55. package/src/rain/RainMeasure.ts +27 -0
  56. package/{rain/RainNode.js → src/rain/RainNode.ts} +76 -48
  57. package/tsconfig.json +17 -0
  58. package/tslint.json +79 -0
  59. package/cartesian/CartesianMeasureValue.d.ts +0 -41
  60. package/cartesian/CartesianMeasureValue.js.map +0 -1
  61. package/cartesian/CartesianValue.d.ts +0 -9
  62. package/cartesian/CartesianValue.js +0 -12
  63. package/cartesian/CartesianValue.js.map +0 -1
  64. package/cartesian/ICartesianMeasureValue.d.ts +0 -29
  65. package/cartesian/ICartesianMeasureValue.js +0 -3
  66. package/cartesian/ICartesianMeasureValue.js.map +0 -1
  67. package/cartesian/LatLng.d.ts +0 -12
  68. package/cartesian/LatLng.js +0 -31
  69. package/cartesian/LatLng.js.map +0 -1
  70. package/cartesian/RadarCartesianMeasureValue.d.ts +0 -15
  71. package/cartesian/RadarCartesianMeasureValue.js +0 -22
  72. package/cartesian/RadarCartesianMeasureValue.js.map +0 -1
  73. package/cartesian/RainCartesianMeasureValue.d.ts +0 -17
  74. package/cartesian/RainCartesianMeasureValue.js +0 -25
  75. package/cartesian/RainCartesianMeasureValue.js.map +0 -1
  76. package/gauge/GaugeMeasure.d.ts +0 -20
  77. package/gauge/GaugeMeasure.js +0 -24
  78. package/gauge/GaugeMeasure.js.map +0 -1
  79. package/gauge/GaugeNode.d.ts +0 -24
  80. package/gauge/GaugeNode.js +0 -31
  81. package/gauge/GaugeNode.js.map +0 -1
  82. package/gauge/GaugeNodeMap.d.ts +0 -22
  83. package/gauge/GaugeNodeMap.js +0 -42
  84. package/gauge/GaugeNodeMap.js.map +0 -1
  85. package/index.js +0 -56
  86. package/index.js.map +0 -1
  87. package/organization/EventNode.d.ts +0 -22
  88. package/organization/EventNode.js +0 -30
  89. package/organization/EventNode.js.map +0 -1
  90. package/organization/IVersion.js +0 -3
  91. package/organization/IVersion.js.map +0 -1
  92. package/organization/Link.d.ts +0 -16
  93. package/organization/Link.js.map +0 -1
  94. package/organization/Measure.d.ts +0 -20
  95. package/organization/Measure.js +0 -35
  96. package/organization/Measure.js.map +0 -1
  97. package/organization/PeopleNode.d.ts +0 -18
  98. package/organization/PeopleNode.js +0 -26
  99. package/organization/PeopleNode.js.map +0 -1
  100. package/organization/RaainNode.d.ts +0 -23
  101. package/organization/RaainNode.js.map +0 -1
  102. package/organization/TeamNode.d.ts +0 -22
  103. package/organization/TeamNode.js +0 -32
  104. package/organization/TeamNode.js.map +0 -1
  105. package/polar/AbstractPolarMeasureValue.d.ts +0 -29
  106. package/polar/AbstractPolarMeasureValue.js +0 -92
  107. package/polar/AbstractPolarMeasureValue.js.map +0 -1
  108. package/polar/GaugePolarMeasureValue.d.ts +0 -11
  109. package/polar/GaugePolarMeasureValue.js +0 -14
  110. package/polar/GaugePolarMeasureValue.js.map +0 -1
  111. package/polar/IPolarMeasureValue.d.ts +0 -19
  112. package/polar/IPolarMeasureValue.js +0 -3
  113. package/polar/IPolarMeasureValue.js.map +0 -1
  114. package/polar/MeasureValuePolarContainer.d.ts +0 -11
  115. package/polar/MeasureValuePolarContainer.js +0 -22
  116. package/polar/MeasureValuePolarContainer.js.map +0 -1
  117. package/polar/PolarMeasureValue.d.ts +0 -26
  118. package/polar/PolarMeasureValue.js.map +0 -1
  119. package/polar/PolarValue.d.ts +0 -10
  120. package/polar/PolarValue.js +0 -12
  121. package/polar/PolarValue.js.map +0 -1
  122. package/polar/RadarPolarMeasureValue.d.ts +0 -15
  123. package/polar/RadarPolarMeasureValue.js +0 -34
  124. package/polar/RadarPolarMeasureValue.js.map +0 -1
  125. package/polar/RainPolarMeasureValue.d.ts +0 -18
  126. package/polar/RainPolarMeasureValue.js +0 -42
  127. package/polar/RainPolarMeasureValue.js.map +0 -1
  128. package/quality/QualityPoint.d.ts +0 -35
  129. package/quality/QualityPoint.js.map +0 -1
  130. package/quality/SpeedMatrix.d.ts +0 -79
  131. package/quality/SpeedMatrix.js.map +0 -1
  132. package/quality/SpeedMatrixContainer.d.ts +0 -76
  133. package/quality/SpeedMatrixContainer.js.map +0 -1
  134. package/quality/history/CartesianGaugeHistory.d.ts +0 -15
  135. package/quality/history/CartesianGaugeHistory.js +0 -14
  136. package/quality/history/CartesianGaugeHistory.js.map +0 -1
  137. package/quality/history/CartesianRainHistory.d.ts +0 -11
  138. package/quality/history/CartesianRainHistory.js +0 -12
  139. package/quality/history/CartesianRainHistory.js.map +0 -1
  140. package/quality/history/PositionHistory.d.ts +0 -20
  141. package/quality/history/PositionHistory.js +0 -17
  142. package/quality/history/PositionHistory.js.map +0 -1
  143. package/quality/position/Position.d.ts +0 -22
  144. package/quality/position/Position.js +0 -50
  145. package/quality/position/Position.js.map +0 -1
  146. package/quality/position/PositionValue.d.ts +0 -9
  147. package/quality/position/PositionValue.js +0 -12
  148. package/quality/position/PositionValue.js.map +0 -1
  149. package/quality/tools/QualityTools.d.ts +0 -24
  150. package/quality/tools/QualityTools.js.map +0 -1
  151. package/radar/RadarMeasure.d.ts +0 -17
  152. package/radar/RadarMeasure.js +0 -18
  153. package/radar/RadarMeasure.js.map +0 -1
  154. package/radar/RadarNode.d.ts +0 -24
  155. package/radar/RadarNode.js +0 -31
  156. package/radar/RadarNode.js.map +0 -1
  157. package/radar/RadarNodeMap.d.ts +0 -28
  158. package/radar/RadarNodeMap.js +0 -46
  159. package/radar/RadarNodeMap.js.map +0 -1
  160. package/rain/RainComputation.d.ts +0 -34
  161. package/rain/RainComputation.js +0 -55
  162. package/rain/RainComputation.js.map +0 -1
  163. package/rain/RainComputationAbstract.d.ts +0 -41
  164. package/rain/RainComputationAbstract.js +0 -102
  165. package/rain/RainComputationAbstract.js.map +0 -1
  166. package/rain/RainComputationMap.d.ts +0 -32
  167. package/rain/RainComputationMap.js +0 -45
  168. package/rain/RainComputationMap.js.map +0 -1
  169. package/rain/RainComputationQuality.d.ts +0 -37
  170. package/rain/RainComputationQuality.js.map +0 -1
  171. package/rain/RainMeasure.d.ts +0 -18
  172. package/rain/RainMeasure.js +0 -19
  173. package/rain/RainMeasure.js.map +0 -1
  174. package/rain/RainNode.d.ts +0 -38
  175. package/rain/RainNode.js.map +0 -1
  176. /package/{organization/IVersion.d.ts → src/organization/IVersion.ts} +0 -0
@@ -1,70 +1,94 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CartesianMeasureValue = void 0;
4
- const CartesianValue_1 = require("./CartesianValue");
5
- const LatLng_1 = require("./LatLng");
6
- class CartesianMeasureValue {
7
- constructor(json) {
8
- if (!(json === null || json === void 0 ? void 0 : json.cartesianValues) || !(json === null || json === void 0 ? void 0 : json.cartesianPixelWidth)) {
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
- static From(obj) {
24
+
25
+ static From(obj: any): CartesianMeasureValue {
15
26
  const created = new CartesianMeasureValue({
16
27
  cartesianValues: [],
17
- cartesianPixelWidth: { lat: 0, lng: 0 }
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
- getCartesianValuesStringified() {
30
- return JSON.stringify({ cartesianValues: this.cartesianValues });
43
+
44
+ getCartesianValuesStringified(): string {
45
+ return JSON.stringify({cartesianValues: this.cartesianValues});
31
46
  }
32
- getCartesianValues() {
47
+
48
+ getCartesianValues(): CartesianValue[] {
33
49
  return this.cartesianValues;
34
50
  }
35
- setCartesianValues(cartesianValues) {
51
+
52
+ setCartesianValues(cartesianValues: CartesianValue[]): void {
36
53
  this.cartesianValues = cartesianValues;
37
54
  }
38
- setCartesianValuesAsString(s) {
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 CartesianValue_1.CartesianValue(v));
65
+ this.cartesianValues.push(new CartesianValue(v));
47
66
  });
48
67
  }
49
68
  }
50
- toJSON(stringify = false) {
51
- let cartesianValues = this.cartesianValues;
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
- const json = {
76
+
77
+ const json: any = {
56
78
  cartesianValues,
57
79
  cartesianPixelWidth: this.cartesianPixelWidth,
58
80
  };
59
81
  return json;
60
82
  }
61
- toJSONWithCartesianValuesStringified() {
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
- getCartesianValue(json) {
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
- getCartesianValueRounded(json) {
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
- setCartesianValue(json) {
88
- this.cartesianValues.push(new CartesianValue_1.CartesianValue(json));
116
+
117
+ setCartesianValue(json: { lat: number, lng: number, value: number }): void {
118
+ this.cartesianValues.push(new CartesianValue(json));
89
119
  }
90
- getCartesianPixelWidth() {
120
+
121
+ getCartesianPixelWidth(): LatLng {
91
122
  return this.cartesianPixelWidth;
92
123
  }
93
- setCartesianPixelWidth(latLng) {
94
- this.cartesianPixelWidth = new LatLng_1.LatLng(latLng);
124
+
125
+ setCartesianPixelWidth(latLng: { lat: number, lng: number } | LatLng): void {
126
+ this.cartesianPixelWidth = new LatLng(latLng);
95
127
  }
96
- setCartesianValuesAsAny(cartesianValues) {
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(rel, href) {
13
- this.rel = rel;
14
- this.href = href;
8
+ export class Link {
9
+ constructor(
10
+ public rel: string,
11
+ public href: string
12
+ ) {
15
13
  }
16
- static isCloneable(object) {
14
+
15
+ public static isCloneable(object: any): boolean {
17
16
  return object && object.rel && object.href;
18
17
  }
19
- static clone(object) {
18
+
19
+ public static clone(object: any): Link {
20
20
  return new Link(object.rel, object.href);
21
21
  }
22
- getId() {
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
- getLinkType() {
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
+ }