raain-model 1.11.4 → 1.11.6

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 (174) hide show
  1. package/cartesian/CartesianMeasureValue.d.ts +41 -0
  2. package/{src/cartesian/CartesianMeasureValue.ts → cartesian/CartesianMeasureValue.js} +34 -64
  3. package/cartesian/CartesianMeasureValue.js.map +1 -0
  4. package/cartesian/CartesianValue.d.ts +9 -0
  5. package/cartesian/CartesianValue.js +12 -0
  6. package/cartesian/CartesianValue.js.map +1 -0
  7. package/cartesian/ICartesianMeasureValue.d.ts +29 -0
  8. package/cartesian/ICartesianMeasureValue.js +3 -0
  9. package/cartesian/ICartesianMeasureValue.js.map +1 -0
  10. package/cartesian/LatLng.d.ts +12 -0
  11. package/cartesian/LatLng.js +31 -0
  12. package/cartesian/LatLng.js.map +1 -0
  13. package/cartesian/RadarCartesianMeasureValue.d.ts +15 -0
  14. package/cartesian/RadarCartesianMeasureValue.js +22 -0
  15. package/cartesian/RadarCartesianMeasureValue.js.map +1 -0
  16. package/cartesian/RainCartesianMeasureValue.d.ts +17 -0
  17. package/cartesian/RainCartesianMeasureValue.js +25 -0
  18. package/cartesian/RainCartesianMeasureValue.js.map +1 -0
  19. package/gauge/GaugeMeasure.d.ts +20 -0
  20. package/gauge/GaugeMeasure.js +24 -0
  21. package/gauge/GaugeMeasure.js.map +1 -0
  22. package/gauge/GaugeNode.d.ts +24 -0
  23. package/gauge/GaugeNode.js +31 -0
  24. package/gauge/GaugeNode.js.map +1 -0
  25. package/gauge/GaugeNodeMap.d.ts +22 -0
  26. package/gauge/GaugeNodeMap.js +42 -0
  27. package/gauge/GaugeNodeMap.js.map +1 -0
  28. package/{src/index.ts → index.d.ts} +0 -6
  29. package/index.js +56 -0
  30. package/index.js.map +1 -0
  31. package/organization/EventNode.d.ts +22 -0
  32. package/organization/EventNode.js +30 -0
  33. package/organization/EventNode.js.map +1 -0
  34. package/organization/IVersion.js +3 -0
  35. package/organization/IVersion.js.map +1 -0
  36. package/organization/Link.d.ts +16 -0
  37. package/{src/organization/Link.ts → organization/Link.js} +13 -13
  38. package/organization/Link.js.map +1 -0
  39. package/organization/Measure.d.ts +20 -0
  40. package/organization/Measure.js +35 -0
  41. package/organization/Measure.js.map +1 -0
  42. package/organization/PeopleNode.d.ts +18 -0
  43. package/organization/PeopleNode.js +26 -0
  44. package/organization/PeopleNode.js.map +1 -0
  45. package/organization/RaainNode.d.ts +23 -0
  46. package/{src/organization/RaainNode.ts → organization/RaainNode.js} +29 -53
  47. package/organization/RaainNode.js.map +1 -0
  48. package/organization/TeamNode.d.ts +22 -0
  49. package/organization/TeamNode.js +32 -0
  50. package/organization/TeamNode.js.map +1 -0
  51. package/package.json +1 -1
  52. package/polar/AbstractPolarMeasureValue.d.ts +29 -0
  53. package/{src/polar/AbstractPolarMeasureValue.ts → polar/AbstractPolarMeasureValue.js} +29 -53
  54. package/polar/AbstractPolarMeasureValue.js.map +1 -0
  55. package/polar/GaugePolarMeasureValue.d.ts +11 -0
  56. package/polar/GaugePolarMeasureValue.js +14 -0
  57. package/polar/GaugePolarMeasureValue.js.map +1 -0
  58. package/polar/IPolarMeasureValue.d.ts +19 -0
  59. package/polar/IPolarMeasureValue.js +3 -0
  60. package/polar/IPolarMeasureValue.js.map +1 -0
  61. package/polar/MeasureValuePolarContainer.d.ts +11 -0
  62. package/polar/MeasureValuePolarContainer.js +22 -0
  63. package/polar/MeasureValuePolarContainer.js.map +1 -0
  64. package/polar/PolarMeasureValue.d.ts +26 -0
  65. package/{src/polar/PolarMeasureValue.ts → polar/PolarMeasureValue.js} +27 -46
  66. package/polar/PolarMeasureValue.js.map +1 -0
  67. package/polar/PolarValue.d.ts +10 -0
  68. package/polar/PolarValue.js +12 -0
  69. package/polar/PolarValue.js.map +1 -0
  70. package/polar/RadarPolarMeasureValue.d.ts +15 -0
  71. package/polar/RadarPolarMeasureValue.js +34 -0
  72. package/polar/RadarPolarMeasureValue.js.map +1 -0
  73. package/polar/RainPolarMeasureValue.d.ts +18 -0
  74. package/polar/RainPolarMeasureValue.js +42 -0
  75. package/polar/RainPolarMeasureValue.js.map +1 -0
  76. package/quality/QualityPoint.d.ts +35 -0
  77. package/{src/quality/QualityPoint.ts → quality/QualityPoint.js} +23 -48
  78. package/quality/QualityPoint.js.map +1 -0
  79. package/quality/SpeedMatrix.d.ts +83 -0
  80. package/{src/quality/SpeedMatrix.ts → quality/SpeedMatrix.js} +78 -116
  81. package/quality/SpeedMatrix.js.map +1 -0
  82. package/quality/SpeedMatrixContainer.d.ts +80 -0
  83. package/{src/quality/SpeedMatrixContainer.ts → quality/SpeedMatrixContainer.js} +76 -141
  84. package/quality/SpeedMatrixContainer.js.map +1 -0
  85. package/quality/history/CartesianGaugeHistory.d.ts +15 -0
  86. package/quality/history/CartesianGaugeHistory.js +14 -0
  87. package/quality/history/CartesianGaugeHistory.js.map +1 -0
  88. package/quality/history/CartesianRainHistory.d.ts +11 -0
  89. package/quality/history/CartesianRainHistory.js +12 -0
  90. package/quality/history/CartesianRainHistory.js.map +1 -0
  91. package/quality/history/PositionHistory.d.ts +20 -0
  92. package/quality/history/PositionHistory.js +17 -0
  93. package/quality/history/PositionHistory.js.map +1 -0
  94. package/quality/position/Position.d.ts +22 -0
  95. package/quality/position/Position.js +50 -0
  96. package/quality/position/Position.js.map +1 -0
  97. package/quality/position/PositionValue.d.ts +9 -0
  98. package/quality/position/PositionValue.js +12 -0
  99. package/quality/position/PositionValue.js.map +1 -0
  100. package/quality/tools/QualityTools.d.ts +24 -0
  101. package/{src/quality/tools/QualityTools.ts → quality/tools/QualityTools.js} +49 -82
  102. package/quality/tools/QualityTools.js.map +1 -0
  103. package/radar/RadarMeasure.d.ts +17 -0
  104. package/radar/RadarMeasure.js +18 -0
  105. package/radar/RadarMeasure.js.map +1 -0
  106. package/radar/RadarNode.d.ts +24 -0
  107. package/radar/RadarNode.js +31 -0
  108. package/radar/RadarNode.js.map +1 -0
  109. package/radar/RadarNodeMap.d.ts +28 -0
  110. package/radar/RadarNodeMap.js +46 -0
  111. package/radar/RadarNodeMap.js.map +1 -0
  112. package/rain/RainComputation.d.ts +34 -0
  113. package/rain/RainComputation.js +55 -0
  114. package/rain/RainComputation.js.map +1 -0
  115. package/rain/RainComputationAbstract.d.ts +41 -0
  116. package/rain/RainComputationAbstract.js +102 -0
  117. package/rain/RainComputationAbstract.js.map +1 -0
  118. package/rain/RainComputationMap.d.ts +32 -0
  119. package/rain/RainComputationMap.js +45 -0
  120. package/rain/RainComputationMap.js.map +1 -0
  121. package/rain/RainComputationQuality.d.ts +37 -0
  122. package/{src/rain/RainComputationQuality.ts → rain/RainComputationQuality.js} +20 -56
  123. package/rain/RainComputationQuality.js.map +1 -0
  124. package/rain/RainMeasure.d.ts +18 -0
  125. package/rain/RainMeasure.js +19 -0
  126. package/rain/RainMeasure.js.map +1 -0
  127. package/rain/RainNode.d.ts +38 -0
  128. package/{src/rain/RainNode.ts → rain/RainNode.js} +48 -76
  129. package/rain/RainNode.js.map +1 -0
  130. package/.travis.deploy.sh +0 -41
  131. package/.travis.yml +0 -22
  132. package/specs/cartesian/Cartesian.spec.ts +0 -56
  133. package/specs/gauge/Gauge.spec.ts +0 -19
  134. package/specs/organization/Organization.spec.ts +0 -32
  135. package/specs/polar/Polar.spec.ts +0 -25
  136. package/specs/quality/Position.spec.ts +0 -18
  137. package/specs/quality/QualityTools.spec.ts +0 -120
  138. package/specs/quality/SpeedMatrix.spec.ts +0 -125
  139. package/specs/radar/Radar.spec.ts +0 -18
  140. package/specs/rain/Rain.spec.ts +0 -71
  141. package/specs/tsconfig.json +0 -12
  142. package/src/cartesian/CartesianValue.ts +0 -17
  143. package/src/cartesian/ICartesianMeasureValue.ts +0 -27
  144. package/src/cartesian/LatLng.ts +0 -39
  145. package/src/cartesian/RadarCartesianMeasureValue.ts +0 -29
  146. package/src/cartesian/RainCartesianMeasureValue.ts +0 -33
  147. package/src/gauge/GaugeMeasure.ts +0 -36
  148. package/src/gauge/GaugeNode.ts +0 -46
  149. package/src/gauge/GaugeNodeMap.ts +0 -55
  150. package/src/organization/EventNode.ts +0 -44
  151. package/src/organization/Measure.ts +0 -49
  152. package/src/organization/PeopleNode.ts +0 -36
  153. package/src/organization/TeamNode.ts +0 -46
  154. package/src/polar/GaugePolarMeasureValue.ts +0 -15
  155. package/src/polar/IPolarMeasureValue.ts +0 -21
  156. package/src/polar/MeasureValuePolarContainer.ts +0 -28
  157. package/src/polar/PolarValue.ts +0 -16
  158. package/src/polar/RadarPolarMeasureValue.ts +0 -43
  159. package/src/polar/RainPolarMeasureValue.ts +0 -57
  160. package/src/quality/history/CartesianGaugeHistory.ts +0 -23
  161. package/src/quality/history/CartesianRainHistory.ts +0 -18
  162. package/src/quality/history/PositionHistory.ts +0 -31
  163. package/src/quality/position/Position.ts +0 -60
  164. package/src/quality/position/PositionValue.ts +0 -15
  165. package/src/radar/RadarMeasure.ts +0 -27
  166. package/src/radar/RadarNode.ts +0 -46
  167. package/src/radar/RadarNodeMap.ts +0 -65
  168. package/src/rain/RainComputation.ts +0 -82
  169. package/src/rain/RainComputationAbstract.ts +0 -137
  170. package/src/rain/RainComputationMap.ts +0 -68
  171. package/src/rain/RainMeasure.ts +0 -27
  172. package/tsconfig.json +0 -17
  173. package/tslint.json +0 -79
  174. /package/{src/organization/IVersion.ts → organization/IVersion.d.ts} +0 -0
@@ -1,60 +0,0 @@
1
- export class Position {
2
- static DEFAULT_PRECISION = 6;
3
- public x: number;
4
- public y: number;
5
- private readonly precision: number;
6
-
7
- constructor(json: {
8
- x: number,
9
- y: number
10
- }) {
11
- this.x = json.x;
12
- this.y = json.y;
13
- this.precision = Position.DEFAULT_PRECISION;
14
- }
15
-
16
- static uniq = (a: Position[]): Position[] => {
17
- const set = [];
18
- for (const p of a) {
19
- const same = set.filter(s => s.x === p.x && s.y === p.y);
20
- if (same.length <= 0) {
21
- set.push(p);
22
- }
23
- }
24
- return set;
25
- }
26
-
27
- setPrecision(precision: number = Position.DEFAULT_PRECISION) {
28
- const tenPower = Math.pow(10, precision);
29
- const xy = this.getXY(precision);
30
- this.x = xy.x;
31
- this.y = xy.y;
32
- }
33
-
34
-
35
- getXY(precision?: number): { x: number, y: number } {
36
- if (typeof precision === 'undefined') {
37
- return {x: this.x, y: this.y};
38
- }
39
-
40
- const tenPower = Math.pow(10, precision);
41
- return {
42
- x: Math.round(this.x * tenPower) / tenPower,
43
- y: Math.round(this.y * tenPower) / tenPower,
44
- };
45
- }
46
-
47
- samePosition(p: Position, precision?: number) {
48
- const xy = this.getXY(precision);
49
- return xy.x === p.x && xy.y === p.y;
50
- }
51
-
52
- getPrecision(): number {
53
- return this.precision;
54
- }
55
-
56
- getXYScaled(scale: number): { x: number, y: number } {
57
- const precision = Math.round(Math.log10(1 / scale));
58
- return this.getXY(precision);
59
- }
60
- }
@@ -1,15 +0,0 @@
1
- import {Position} from '../position/Position';
2
-
3
-
4
- export class PositionValue extends Position {
5
- public value: number;
6
-
7
- constructor(json: {
8
- x: number,
9
- y: number,
10
- value: number
11
- }) {
12
- super(json);
13
- this.value = json.value;
14
- }
15
- }
@@ -1,27 +0,0 @@
1
- import {Measure} from '../organization/Measure';
2
- import {IPolarMeasureValue} from '../polar/IPolarMeasureValue';
3
- import {ICartesianMeasureValue} from '../cartesian/ICartesianMeasureValue';
4
-
5
- /**
6
- * api/radars/:id/measures/:id
7
- */
8
- export class RadarMeasure extends Measure {
9
-
10
- public static TYPE = 'radar-measure';
11
-
12
- constructor(json: {
13
- id: string,
14
- values: IPolarMeasureValue[] | ICartesianMeasureValue[] | Measure[] | number[],
15
- date?: Date,
16
- validity?: number,
17
- configurationAsJSON?: string | any,
18
- }
19
- ) {
20
- super(json);
21
- }
22
-
23
- protected getLinkType(): string {
24
- return RadarMeasure.TYPE;
25
- }
26
- }
27
-
@@ -1,46 +0,0 @@
1
- import {RaainNode} from '../organization/RaainNode';
2
- import {Link} from '../organization/Link';
3
- import {TeamNode} from '../organization/TeamNode';
4
-
5
- /**
6
- * api/radars/:id
7
- */
8
- export class RadarNode extends RaainNode {
9
-
10
- public static TYPE = 'radar';
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['name'] = this.name;
36
- json['latitude'] = this.latitude;
37
- json['longitude'] = this.longitude;
38
- json['team'] = this.team?.id || this.team;
39
- return json;
40
- }
41
-
42
- protected getLinkType(): string {
43
- return RadarNode.TYPE;
44
- }
45
-
46
- }
@@ -1,65 +0,0 @@
1
- import {RadarMeasure} from './RadarMeasure';
2
- import {RadarNode} from './RadarNode';
3
- import {Link} from '../organization/Link';
4
- import {RaainNode} from '../organization/RaainNode';
5
- import {TeamNode} from '../organization/TeamNode';
6
-
7
- /**
8
- * api/radars/:radarId?format=map&...
9
- */
10
- export class RadarNodeMap extends RadarNode {
11
-
12
- public periodBegin: Date;
13
- public periodEnd: Date;
14
- private map: string; // RadarMeasure[]; stringified
15
-
16
- constructor(json: {
17
- id: string,
18
- latitude: number,
19
- longitude: number,
20
- periodBegin: Date,
21
- periodEnd: Date,
22
- map: RadarMeasure[] | string,
23
- name?: string,
24
- links?: Link[] | RaainNode[],
25
- team?: TeamNode,
26
- version?: string,
27
- }) {
28
- super(json);
29
- this.periodBegin = new Date(json.periodBegin);
30
- this.periodEnd = new Date(json.periodEnd);
31
- this.setMapData(json.map);
32
- }
33
-
34
- public toJSON(): JSON {
35
- const json = super.toJSON();
36
- if (this.map) {
37
- json['map'] = this.map;
38
- }
39
- json['periodBegin'] = this.periodBegin.toISOString();
40
- json['periodEnd'] = this.periodEnd.toISOString();
41
- return json;
42
- }
43
-
44
- public setMapData(mapData: RadarMeasure[] | string) {
45
- if (!mapData) {
46
- return;
47
- }
48
-
49
- let map = mapData;
50
- try {
51
- if (typeof (mapData) !== 'string') {
52
- map = JSON.stringify(mapData);
53
- }
54
- } catch (e) {
55
- }
56
- this.map = map.toString();
57
- }
58
-
59
- public getMapData(): RadarMeasure[] {
60
- if (!this.map) {
61
- return [];
62
- }
63
- return JSON.parse(this.map);
64
- }
65
- }
@@ -1,82 +0,0 @@
1
- import {RaainNode} from '../organization/RaainNode';
2
- import {Link} from '../organization/Link';
3
- import {RainPolarMeasureValue} from '../polar/RainPolarMeasureValue';
4
- import {RainCartesianMeasureValue} from '../cartesian/RainCartesianMeasureValue';
5
- import {RainComputationAbstract} from './RainComputationAbstract';
6
-
7
- /**
8
- * api/rains/:rainId/computations/:computationId
9
- * or as an array on
10
- * api/rains/:id/computations?format=id&begin=...
11
- */
12
- export class RainComputation extends RainComputationAbstract {
13
-
14
- public static TYPE = 'rain-computation';
15
-
16
- // why array ? because you can have different angle from the Radar
17
- public results: RainPolarMeasureValue[] | RainCartesianMeasureValue[];
18
-
19
- // not "values" (aka Measure.values), but "results" from computation
20
-
21
- constructor(json: {
22
- id: string,
23
- periodBegin: Date,
24
- periodEnd: Date,
25
- isReady: boolean,
26
-
27
- results: RainPolarMeasureValue[] | RainCartesianMeasureValue[],
28
-
29
- links?: Link[] | RaainNode[],
30
- version?: string,
31
- quality?: number,
32
- progressIngest?: number,
33
- progressComputing?: number,
34
- timeSpentInMs?: number,
35
- isDoneDate?: Date,
36
- launchedBy?: string,
37
- rain?: RaainNode[],
38
- radars?: Link[] | RaainNode[],
39
-
40
- }) {
41
- super(json);
42
- this.setResults(json.results);
43
- }
44
-
45
- public toJSON(stringify = false): JSON {
46
- const json = super.toJSON();
47
- json['results'] = this.results.map(r => r.toJSON(stringify));
48
- return json;
49
- }
50
-
51
- protected getLinkType(): string {
52
- return RainComputation.TYPE;
53
- }
54
-
55
- private setResults(results: string[] | RainPolarMeasureValue[] | RainCartesianMeasureValue[]) {
56
- if (typeof results === 'string') {
57
- results = JSON.parse(results);
58
- }
59
-
60
- if (!results || results.length === 0 || !Array.isArray(results)) {
61
- this.results = [];
62
- return;
63
- }
64
-
65
- this.results = results.map(r => {
66
- if (typeof r === 'string' && r.indexOf('polars') >= 0) {
67
- return new RainPolarMeasureValue(JSON.parse(r));
68
- } else if (r.polars) {
69
- return new RainPolarMeasureValue(r);
70
- }
71
- if (typeof r === 'string' && r.indexOf('cartesian') >= 0) {
72
- return new RainCartesianMeasureValue(JSON.parse(r));
73
- } else if (r.cartesianValues) {
74
- return new RainCartesianMeasureValue(r);
75
- } else {
76
- return r;
77
- }
78
- });
79
- }
80
-
81
- }
82
-
@@ -1,137 +0,0 @@
1
- import {RaainNode} from '../organization/RaainNode';
2
- import {Link} from '../organization/Link';
3
- import {RadarNode} from '../radar/RadarNode';
4
- import {RainNode} from './RainNode';
5
- import {RadarMeasure} from '../radar/RadarMeasure';
6
-
7
- /**
8
- * not used directly
9
- */
10
- export class RainComputationAbstract extends RaainNode {
11
-
12
- public quality: number;
13
- public progressIngest: number;
14
- public progressComputing: number;
15
- public timeSpentInMs: number;
16
- public periodBegin: Date;
17
- public periodEnd: Date;
18
- public isReady: boolean;
19
- public isDoneDate: Date;
20
- public launchedBy: string;
21
- public name: string;
22
-
23
- constructor(json: {
24
- id: string,
25
- periodBegin: Date,
26
- periodEnd: Date,
27
- isReady: boolean,
28
-
29
- links?: Link[] | RaainNode[],
30
- version?: string,
31
- quality?: number,
32
- progressIngest?: number,
33
- progressComputing?: number,
34
- timeSpentInMs?: number,
35
- isDoneDate?: Date,
36
- launchedBy?: string,
37
- rain?: RaainNode[],
38
- radars?: Link[] | RaainNode[],
39
-
40
- }) {
41
- super(json);
42
-
43
- this.periodBegin = new Date(json.periodBegin);
44
- this.periodEnd = new Date(json.periodEnd);
45
- this.quality = json.quality >= 0 ? json.quality : -1;
46
- this.progressIngest = json.progressIngest >= 0 ? json.progressIngest : -1;
47
- this.progressComputing = json.progressComputing >= 0 ? json.progressComputing : -1;
48
- this.timeSpentInMs = json.timeSpentInMs;
49
- this.isReady = !!json.isReady;
50
- this.isDoneDate = json.isDoneDate ? new Date(json.isDoneDate) : undefined;
51
- this.launchedBy = json.launchedBy;
52
-
53
- this.replaceRainLink(json.links);
54
- this.replaceRainLink(json.rain);
55
- this.addRadarLinks(json.links);
56
- this.addRadarLinks(json.radars);
57
- }
58
-
59
- private static _getRadarLinks(linksToPurify: any[]): any[] {
60
- if (!linksToPurify || linksToPurify.length === 0) {
61
- return [];
62
- }
63
-
64
- return linksToPurify.map(l => {
65
- if (l instanceof Link) {
66
- return l;
67
- } else if (l && l['_id']) {
68
- return new RadarNode({id: l['_id'].toString(), latitude: 0, longitude: 0});
69
- } else if (l && l.id) {
70
- return new RadarNode({
71
- id: l.id.toString(),// 'hex'
72
- latitude: 0, longitude: 0
73
- });
74
- }
75
- });
76
- }
77
-
78
- private static _getRadarMeasureLinks(linksToPurify: any[]): any[] {
79
- if (!linksToPurify || linksToPurify.length === 0) {
80
- return [];
81
- }
82
-
83
- return linksToPurify.map(l => {
84
- if (l instanceof Link) {
85
- return l;
86
- } else if (l && l['_id']) {
87
- return new RadarMeasure({id: l['_id'].toString(), values: []});
88
- } else if (l && l.id) {
89
- return new RadarMeasure({id: l.id.toString(), values: []}); // 'hex'
90
- }
91
- });
92
- }
93
-
94
- private static _getRainLink(linkToPurify: RaainNode): RainNode {
95
- if (!linkToPurify || !linkToPurify.id) {
96
- return null;
97
- }
98
-
99
- return new RainNode({
100
- id: linkToPurify.id.toString(), // 'hex'
101
- latitude: 0, longitude: 0
102
- });
103
- }
104
-
105
- public toJSON(): JSON {
106
- const json = super.toJSON();
107
- json['periodBegin'] = this.periodBegin.toISOString();
108
- json['periodEnd'] = this.periodEnd.toISOString();
109
- json['quality'] = this.quality;
110
- json['progressIngest'] = this.progressIngest;
111
- json['progressComputing'] = this.progressComputing;
112
- json['timeSpentInMs'] = this.timeSpentInMs;
113
- json['isReady'] = this.isReady;
114
- json['isDoneDate'] = this.isDoneDate?.toISOString();
115
- json['launchedBy'] = this.launchedBy;
116
- json['name'] = this.name;
117
- return json;
118
- }
119
-
120
- public addRadarLinks(linksToAdd: Link[] | RaainNode[]): void {
121
- this.addLinks(RainComputationAbstract._getRadarLinks(linksToAdd));
122
- }
123
-
124
- public replaceRainLink(linksToAdd: Link | RaainNode | any): void {
125
- this.addLinks([RainComputationAbstract._getRainLink(linksToAdd)]);
126
- }
127
-
128
- public addRadarMeasureLinks(linksToAdd: Link[] | any[]): void {
129
- this.addLinks(RainComputationAbstract._getRadarMeasureLinks(linksToAdd));
130
- }
131
-
132
- protected getLinkType(): string {
133
- throw Error('abstract');
134
- }
135
-
136
- }
137
-
@@ -1,68 +0,0 @@
1
- import {RainComputationAbstract} from './RainComputationAbstract';
2
- import {Link} from '../organization/Link';
3
- import {RainMeasure} from './RainMeasure';
4
- import {RaainNode} from '../organization/RaainNode';
5
-
6
- /**
7
- * api/rains/:id/computations/:computationId?format=map&...
8
- * or with
9
- * api/rains/:id/computations?format=map&begin=...
10
- */
11
- export class RainComputationMap extends RainComputationAbstract {
12
-
13
- private map: string; // RainMeasure[]; stringified
14
-
15
- constructor(json: {
16
- id: string,
17
- periodBegin: Date,
18
- periodEnd: Date,
19
- isReady: boolean,
20
-
21
- map: RainMeasure[] | string,
22
-
23
- links?: Link[] | RaainNode[],
24
- version?: string,
25
- quality?: number,
26
- progressIngest?: number,
27
- progressComputing?: number,
28
- timeSpentInMs?: number,
29
- isDoneDate?: Date,
30
- launchedBy?: string,
31
- rain?: RaainNode[],
32
- radars?: Link[] | RaainNode[],
33
- }) {
34
- super(json);
35
- this.setMapData(json.map);
36
- }
37
-
38
- public toJSON(): JSON {
39
- const json = super.toJSON();
40
- if (this.map) {
41
- json['map'] = this.map;
42
- delete json['results'];
43
- }
44
- return json;
45
- }
46
-
47
- public setMapData(mapData: RainMeasure[] | string) {
48
- if (!mapData) {
49
- return;
50
- }
51
-
52
- let map = mapData;
53
- try {
54
- if (typeof (mapData) !== 'string') {
55
- map = JSON.stringify(mapData);
56
- }
57
- } catch (e) {
58
- }
59
- this.map = map.toString();
60
- }
61
-
62
- public getMapData(): RainMeasure[] {
63
- if (!this.map) {
64
- return [];
65
- }
66
- return JSON.parse(this.map);
67
- }
68
- }
@@ -1,27 +0,0 @@
1
- import {Measure} from '../organization/Measure';
2
- import {IPolarMeasureValue} from '../polar/IPolarMeasureValue';
3
- import {ICartesianMeasureValue} from '../cartesian/ICartesianMeasureValue';
4
-
5
- /**
6
- * // not existing? api/rains/:id/measures/:id
7
- * but coming from api/rains/:id/computations/:id?format=map => getMapData()
8
- */
9
- export class RainMeasure extends Measure {
10
-
11
- public static TYPE = 'rain-measure';
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
- super(json);
21
- }
22
-
23
- protected getLinkType(): string {
24
- return RainMeasure.TYPE;
25
- }
26
- }
27
-
package/tsconfig.json DELETED
@@ -1,17 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2018",
4
- "module": "commonjs",
5
- "declaration": true,
6
- "sourceMap": true,
7
- "outDir": "dist"
8
- },
9
- "exclude": [
10
- "node_modules",
11
- "dist",
12
- "examples",
13
- "specs",
14
- "coverage",
15
- ".coverage"
16
- ]
17
- }
package/tslint.json DELETED
@@ -1,79 +0,0 @@
1
- {
2
- "extends": "tslint:recommended",
3
- "rules": {
4
- "variable-name": false,
5
- "array-type": false,
6
- "arrow-parens": false,
7
- "deprecation": {
8
- "severity": "warn"
9
- },
10
- "import-blacklist": [
11
- true,
12
- "rxjs/Rx"
13
- ],
14
- "interface-name": false,
15
- "max-classes-per-file": false,
16
- "max-line-length": [
17
- true,
18
- 140
19
- ],
20
- "member-access": false,
21
- "member-ordering": [
22
- true,
23
- {
24
- "order": [
25
- "static-field",
26
- "instance-field",
27
- "static-method",
28
- "instance-method"
29
- ]
30
- }
31
- ],
32
- "no-consecutive-blank-lines": false,
33
- "no-console": [
34
- true,
35
- "debug",
36
- "info",
37
- "time",
38
- "timeEnd",
39
- "trace"
40
- ],
41
- "no-empty": false,
42
- "no-inferrable-types": [
43
- true,
44
- "ignore-params"
45
- ],
46
- "no-non-null-assertion": true,
47
- "no-redundant-jsdoc": true,
48
- "no-switch-case-fall-through": true,
49
- "no-use-before-declare": true,
50
- "no-var-requires": false,
51
- "object-literal-key-quotes": [
52
- true,
53
- "as-needed"
54
- ],
55
- "object-literal-sort-keys": false,
56
- "ordered-imports": false,
57
- "quotemark": [
58
- true,
59
- "single"
60
- ],
61
- "trailing-comma": false,
62
- "no-output-on-prefix": true,
63
- "use-input-property-decorator": true,
64
- "use-output-property-decorator": true,
65
- "use-host-property-decorator": true,
66
- "no-input-rename": true,
67
- "no-string-literal": false,
68
- "no-output-rename": true,
69
- "use-life-cycle-interface": true,
70
- "use-pipe-transform-interface": true,
71
- "one-variable-per-declaration": false,
72
- "component-class-suffix": [
73
- true,
74
- "Page",
75
- "Component"
76
- ],
77
- "directive-class-suffix": true
78
- }
79
- }