raain-model 2.6.10 → 2.6.11

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 (210) hide show
  1. package/README.md +2 -12
  2. package/RELEASE_PROCESS.md +11 -6
  3. package/cartesian/CartesianMeasureValue.d.ts +40 -0
  4. package/{src/cartesian/CartesianMeasureValue.ts → cartesian/CartesianMeasureValue.js} +41 -73
  5. package/cartesian/CartesianMeasureValue.js.map +1 -0
  6. package/cartesian/CartesianTools.d.ts +32 -0
  7. package/{src/cartesian/CartesianTools.ts → cartesian/CartesianTools.js} +69 -130
  8. package/cartesian/CartesianTools.js.map +1 -0
  9. package/cartesian/CartesianValue.d.ts +14 -0
  10. package/cartesian/CartesianValue.js +17 -0
  11. package/cartesian/CartesianValue.js.map +1 -0
  12. package/cartesian/EarthMap.d.ts +5 -0
  13. package/cartesian/EarthMap.js +3 -0
  14. package/cartesian/EarthMap.js.map +1 -0
  15. package/cartesian/ICartesianMeasureValue.d.ts +23 -0
  16. package/cartesian/ICartesianMeasureValue.js +3 -0
  17. package/cartesian/ICartesianMeasureValue.js.map +1 -0
  18. package/cartesian/LatLng.d.ts +16 -0
  19. package/cartesian/LatLng.js +34 -0
  20. package/cartesian/LatLng.js.map +1 -0
  21. package/cartesian/RadarCartesianMeasureValue.d.ts +17 -0
  22. package/cartesian/RadarCartesianMeasureValue.js +22 -0
  23. package/cartesian/RadarCartesianMeasureValue.js.map +1 -0
  24. package/cartesian/RainCartesianMeasureValue.d.ts +17 -0
  25. package/cartesian/RainCartesianMeasureValue.js +23 -0
  26. package/cartesian/RainCartesianMeasureValue.js.map +1 -0
  27. package/cartesian/index.js +25 -0
  28. package/cartesian/index.js.map +1 -0
  29. package/gauge/GaugeMeasure.d.ts +20 -0
  30. package/gauge/GaugeMeasure.js +30 -0
  31. package/gauge/GaugeMeasure.js.map +1 -0
  32. package/gauge/GaugeNode.d.ts +85 -0
  33. package/{src/gauge/GaugeNode.ts → gauge/GaugeNode.js} +20 -48
  34. package/gauge/GaugeNode.js.map +1 -0
  35. package/gauge/GaugeNodeMap.d.ts +24 -0
  36. package/gauge/GaugeNodeMap.js +40 -0
  37. package/gauge/GaugeNodeMap.js.map +1 -0
  38. package/gauge/index.js +20 -0
  39. package/gauge/index.js.map +1 -0
  40. package/index.js +24 -0
  41. package/index.js.map +1 -0
  42. package/organization/EventNode.d.ts +22 -0
  43. package/organization/EventNode.js +30 -0
  44. package/organization/EventNode.js.map +1 -0
  45. package/organization/IVersion.js +3 -0
  46. package/organization/IVersion.js.map +1 -0
  47. package/organization/Link.d.ts +16 -0
  48. package/{src/organization/Link.ts → organization/Link.js} +15 -15
  49. package/organization/Link.js.map +1 -0
  50. package/organization/Measure.d.ts +22 -0
  51. package/organization/Measure.js +45 -0
  52. package/organization/Measure.js.map +1 -0
  53. package/organization/PeopleNode.d.ts +18 -0
  54. package/{src/organization/PeopleNode.ts → organization/PeopleNode.js} +10 -20
  55. package/organization/PeopleNode.js.map +1 -0
  56. package/organization/RaainNode.d.ts +91 -0
  57. package/{src/organization/RaainNode.ts → organization/RaainNode.js} +38 -63
  58. package/organization/RaainNode.js.map +1 -0
  59. package/organization/TeamNode.d.ts +63 -0
  60. package/{src/organization/TeamNode.ts → organization/TeamNode.js} +13 -36
  61. package/organization/TeamNode.js.map +1 -0
  62. package/organization/index.js +24 -0
  63. package/organization/index.js.map +1 -0
  64. package/package.json +1 -1
  65. package/polar/AbstractPolarMeasureValue.d.ts +29 -0
  66. package/{src/polar/AbstractPolarMeasureValue.ts → polar/AbstractPolarMeasureValue.js} +32 -58
  67. package/polar/AbstractPolarMeasureValue.js.map +1 -0
  68. package/polar/IPolarMeasureValue.d.ts +19 -0
  69. package/polar/IPolarMeasureValue.js +3 -0
  70. package/polar/IPolarMeasureValue.js.map +1 -0
  71. package/polar/MeasureValuePolarContainer.d.ts +19 -0
  72. package/{src/polar/MeasureValuePolarContainer.ts → polar/MeasureValuePolarContainer.js} +13 -29
  73. package/polar/MeasureValuePolarContainer.js.map +1 -0
  74. package/polar/PolarFilter.d.ts +16 -0
  75. package/polar/PolarFilter.js +45 -0
  76. package/polar/PolarFilter.js.map +1 -0
  77. package/polar/PolarMeasureValue.d.ts +51 -0
  78. package/{src/polar/PolarMeasureValue.ts → polar/PolarMeasureValue.js} +62 -125
  79. package/polar/PolarMeasureValue.js.map +1 -0
  80. package/polar/PolarMeasureValueMap.d.ts +45 -0
  81. package/{src/polar/PolarMeasureValueMap.ts → polar/PolarMeasureValueMap.js} +88 -165
  82. package/polar/PolarMeasureValueMap.js.map +1 -0
  83. package/polar/PolarValue.d.ts +10 -0
  84. package/polar/PolarValue.js +12 -0
  85. package/polar/PolarValue.js.map +1 -0
  86. package/polar/RadarPolarMeasureValue.d.ts +27 -0
  87. package/{src/polar/RadarPolarMeasureValue.ts → polar/RadarPolarMeasureValue.js} +21 -34
  88. package/polar/RadarPolarMeasureValue.js.map +1 -0
  89. package/polar/RainPolarMeasureValue.d.ts +20 -0
  90. package/polar/RainPolarMeasureValue.js +42 -0
  91. package/polar/RainPolarMeasureValue.js.map +1 -0
  92. package/polar/index.js +25 -0
  93. package/polar/index.js.map +1 -0
  94. package/quality/QualityPoint.d.ts +37 -0
  95. package/{src/quality/QualityPoint.ts → quality/QualityPoint.js} +33 -56
  96. package/quality/QualityPoint.js.map +1 -0
  97. package/quality/SpeedMatrix.d.ts +83 -0
  98. package/{src/quality/SpeedMatrix.ts → quality/SpeedMatrix.js} +76 -117
  99. package/quality/SpeedMatrix.js.map +1 -0
  100. package/quality/SpeedMatrixContainer.d.ts +102 -0
  101. package/{src/quality/SpeedMatrixContainer.ts → quality/SpeedMatrixContainer.js} +103 -210
  102. package/quality/SpeedMatrixContainer.js.map +1 -0
  103. package/quality/history/CartesianGaugeHistory.d.ts +15 -0
  104. package/quality/history/CartesianGaugeHistory.js +14 -0
  105. package/quality/history/CartesianGaugeHistory.js.map +1 -0
  106. package/quality/history/CartesianRainHistory.d.ts +9 -0
  107. package/quality/history/CartesianRainHistory.js +11 -0
  108. package/quality/history/CartesianRainHistory.js.map +1 -0
  109. package/quality/history/PositionHistory.d.ts +20 -0
  110. package/quality/history/PositionHistory.js +17 -0
  111. package/quality/history/PositionHistory.js.map +1 -0
  112. package/{src/quality/index.ts → quality/index.d.ts} +0 -3
  113. package/quality/index.js +26 -0
  114. package/quality/index.js.map +1 -0
  115. package/quality/position/Position.d.ts +22 -0
  116. package/quality/position/Position.js +50 -0
  117. package/quality/position/Position.js.map +1 -0
  118. package/quality/position/PositionValue.d.ts +9 -0
  119. package/quality/position/PositionValue.js +12 -0
  120. package/quality/position/PositionValue.js.map +1 -0
  121. package/quality/tools/QualityTools.d.ts +9 -0
  122. package/{src/quality/tools/QualityTools.ts → quality/tools/QualityTools.js} +17 -18
  123. package/quality/tools/QualityTools.js.map +1 -0
  124. package/radar/RadarMeasure.d.ts +19 -0
  125. package/radar/RadarMeasure.js +30 -0
  126. package/radar/RadarMeasure.js.map +1 -0
  127. package/radar/RadarNode.d.ts +30 -0
  128. package/{src/radar/RadarNode.ts → radar/RadarNode.js} +19 -41
  129. package/radar/RadarNode.js.map +1 -0
  130. package/radar/RadarNodeMap.d.ts +26 -0
  131. package/radar/RadarNodeMap.js +44 -0
  132. package/radar/RadarNodeMap.js.map +1 -0
  133. package/radar/index.js +20 -0
  134. package/radar/index.js.map +1 -0
  135. package/rain/MergeStrategy.d.ts +13 -0
  136. package/rain/MergeStrategy.js +11 -0
  137. package/rain/MergeStrategy.js.map +1 -0
  138. package/rain/RainComputation.d.ts +42 -0
  139. package/rain/RainComputation.js +65 -0
  140. package/rain/RainComputation.js.map +1 -0
  141. package/rain/RainComputationAbstract.d.ts +73 -0
  142. package/{src/rain/RainComputationAbstract.ts → rain/RainComputationAbstract.js} +69 -135
  143. package/rain/RainComputationAbstract.js.map +1 -0
  144. package/rain/RainComputationMap.d.ts +97 -0
  145. package/{src/rain/RainComputationMap.ts → rain/RainComputationMap.js} +22 -55
  146. package/rain/RainComputationMap.js.map +1 -0
  147. package/rain/RainComputationQuality.d.ts +40 -0
  148. package/{src/rain/RainComputationQuality.ts → rain/RainComputationQuality.js} +42 -80
  149. package/rain/RainComputationQuality.js.map +1 -0
  150. package/rain/RainMeasure.d.ts +17 -0
  151. package/rain/RainMeasure.js +18 -0
  152. package/rain/RainMeasure.js.map +1 -0
  153. package/rain/RainNode.d.ts +46 -0
  154. package/{src/rain/RainNode.ts → rain/RainNode.js} +72 -117
  155. package/rain/RainNode.js.map +1 -0
  156. package/rain/index.js +23 -0
  157. package/rain/index.js.map +1 -0
  158. package/.cursorignore +0 -10
  159. package/.github/workflows/ci.yml +0 -29
  160. package/LICENSE +0 -21
  161. package/RELEASE.md +0 -19
  162. package/specs/REQUIREMENTS.md +0 -42
  163. package/specs/TECHNICAL.md +0 -57
  164. package/specs/cartesian/Cartesian.spec.ts +0 -82
  165. package/specs/cartesian/CartesianTools.spec.ts +0 -121
  166. package/specs/gauge/Gauge.spec.ts +0 -39
  167. package/specs/organization/Organization.spec.ts +0 -38
  168. package/specs/polar/Polar.spec.ts +0 -267
  169. package/specs/quality/Position.spec.ts +0 -18
  170. package/specs/quality/QualityPointEdgeCases.spec.ts +0 -215
  171. package/specs/quality/QualityTools.spec.ts +0 -67
  172. package/specs/quality/SpeedMatrix.spec.ts +0 -214
  173. package/specs/radar/Radar.spec.ts +0 -129
  174. package/specs/rain/Rain.spec.ts +0 -334
  175. package/specs/tsconfig.json +0 -12
  176. package/src/cartesian/CartesianValue.ts +0 -26
  177. package/src/cartesian/EarthMap.ts +0 -5
  178. package/src/cartesian/ICartesianMeasureValue.ts +0 -22
  179. package/src/cartesian/LatLng.ts +0 -43
  180. package/src/cartesian/RadarCartesianMeasureValue.ts +0 -32
  181. package/src/cartesian/RainCartesianMeasureValue.ts +0 -32
  182. package/src/gauge/GaugeMeasure.ts +0 -42
  183. package/src/gauge/GaugeNodeMap.ts +0 -55
  184. package/src/organization/EventNode.ts +0 -43
  185. package/src/organization/Measure.ts +0 -61
  186. package/src/polar/IPolarMeasureValue.ts +0 -21
  187. package/src/polar/PolarFilter.ts +0 -46
  188. package/src/polar/PolarValue.ts +0 -16
  189. package/src/polar/RainPolarMeasureValue.ts +0 -57
  190. package/src/quality/history/CartesianGaugeHistory.ts +0 -23
  191. package/src/quality/history/CartesianRainHistory.ts +0 -15
  192. package/src/quality/history/PositionHistory.ts +0 -31
  193. package/src/quality/position/Position.ts +0 -59
  194. package/src/quality/position/PositionValue.ts +0 -15
  195. package/src/radar/RadarMeasure.ts +0 -41
  196. package/src/radar/RadarNodeMap.ts +0 -61
  197. package/src/rain/MergeStrategy.ts +0 -15
  198. package/src/rain/RainComputation.ts +0 -96
  199. package/src/rain/RainMeasure.ts +0 -25
  200. package/tsconfig.json +0 -17
  201. package/tslint.json +0 -79
  202. package/typedoc.json +0 -31
  203. /package/{src/cartesian/index.ts → cartesian/index.d.ts} +0 -0
  204. /package/{src/gauge/index.ts → gauge/index.d.ts} +0 -0
  205. /package/{src/index.ts → index.d.ts} +0 -0
  206. /package/{src/organization/IVersion.ts → organization/IVersion.d.ts} +0 -0
  207. /package/{src/organization/index.ts → organization/index.d.ts} +0 -0
  208. /package/{src/polar/index.ts → polar/index.d.ts} +0 -0
  209. /package/{src/radar/index.ts → radar/index.d.ts} +0 -0
  210. /package/{src/rain/index.ts → rain/index.d.ts} +0 -0
@@ -1,61 +0,0 @@
1
- import {IPolarMeasureValue} from '../polar';
2
- import {RaainNode} from './RaainNode';
3
- import {ICartesianMeasureValue} from '../cartesian';
4
-
5
- export class Measure extends RaainNode {
6
- public date: Date;
7
- // -> why array ? because you have different angle/axis from the Radar
8
- public values: IPolarMeasureValue[] | ICartesianMeasureValue[] | number[];
9
- public validity: number;
10
-
11
- // internal
12
- private configurationAsJSON: string;
13
-
14
- constructor(json: {
15
- id: string,
16
- values: IPolarMeasureValue[] | ICartesianMeasureValue[] | number[],
17
- date?: Date,
18
- validity?: number,
19
- configurationAsJSON?: string,
20
- version?: string,
21
- }
22
- ) {
23
- super(json);
24
- this.values = json.values ? json.values : [];
25
- this.date = json.date ? new Date(json.date) : undefined;
26
- this.validity = json.validity >= 0 ? json.validity : -1;
27
- this.setConfiguration(json.configurationAsJSON);
28
- }
29
-
30
- public setConfiguration(configuration: string | any) {
31
- let conf = configuration;
32
- try {
33
- conf = JSON.parse(configuration);
34
- } catch (ignored) {
35
- }
36
-
37
- if (conf) {
38
- this.configurationAsJSON = JSON.stringify(conf);
39
- }
40
- }
41
-
42
- public toJSON(options: { removeValues?: boolean } = {}): any {
43
- const json = super.toJSON();
44
- json['date'] = this.date?.toISOString();
45
- json['validity'] = this.validity;
46
- json['configurationAsJSON'] = this.configurationAsJSON;
47
-
48
- if (!options?.removeValues) {
49
- json['values'] = this.values;
50
- }
51
- return json;
52
- }
53
-
54
- public getConfiguration(): any {
55
- try {
56
- return JSON.parse(this.configurationAsJSON);
57
- } catch (e) {
58
- }
59
- return null;
60
- }
61
- }
@@ -1,21 +0,0 @@
1
- import {MeasureValuePolarContainer} from './MeasureValuePolarContainer';
2
- import {PolarValue} from './PolarValue';
3
-
4
- export interface IPolarMeasureValue {
5
-
6
- getAzimuthsCount(): number;
7
-
8
- getPolarEdgesCount(): number;
9
-
10
- getPolarsStringified(): string;
11
-
12
- getPolars(): MeasureValuePolarContainer[];
13
-
14
- toJSON(options?: any): any;
15
-
16
- toJSONWithPolarStringified(): any;
17
-
18
- getPolarValue(json: { azimuthInDegrees: number, distanceInMeters: number }): PolarValue;
19
-
20
- setPolarValue(json: { azimuthInDegrees: number, distanceInMeters: number, value: number }): void;
21
- }
@@ -1,46 +0,0 @@
1
- export class PolarFilter {
2
- azimuthMin: number;
3
- azimuthMax: number;
4
- edgeMin: number;
5
- edgeMax: number;
6
-
7
- constructor(json?: {
8
- azimuthMin?: number;
9
- azimuthMax?: number;
10
- edgeMin?: number;
11
- edgeMax?: number;
12
- }) {
13
- if (typeof json?.azimuthMin !== 'undefined') this.azimuthMin = json.azimuthMin;
14
- if (typeof json?.azimuthMax !== 'undefined') this.azimuthMax = json.azimuthMax;
15
- if (typeof json?.edgeMin !== 'undefined') this.edgeMin = json.edgeMin;
16
- if (typeof json?.edgeMax !== 'undefined') this.edgeMax = json.edgeMax;
17
- }
18
-
19
- protected static min(a: number, b: number): number {
20
- if (typeof a === 'undefined') return b;
21
- if (typeof b === 'undefined') return a;
22
- return Math.min(a, b);
23
- }
24
-
25
- protected static max(a: number, b: number): number {
26
- if (typeof a === 'undefined') return b;
27
- if (typeof b === 'undefined') return a;
28
- return Math.max(a, b);
29
- }
30
-
31
- merging(polarFilter?: PolarFilter): PolarFilter {
32
- return new PolarFilter({
33
- azimuthMin: PolarFilter.max(polarFilter?.azimuthMin, this.azimuthMin),
34
- azimuthMax: PolarFilter.min(polarFilter?.azimuthMax, this.azimuthMax),
35
- edgeMin: PolarFilter.max(polarFilter?.edgeMin, this.edgeMin),
36
- edgeMax: PolarFilter.min(polarFilter?.edgeMax, this.edgeMax),
37
- });
38
- }
39
-
40
- equal(polarFilter: PolarFilter): boolean {
41
- return this.azimuthMin === polarFilter.azimuthMin &&
42
- this.azimuthMax === polarFilter.azimuthMax &&
43
- this.edgeMin === polarFilter.edgeMin &&
44
- this.edgeMax === polarFilter.edgeMax;
45
- }
46
- }
@@ -1,16 +0,0 @@
1
- export class PolarValue {
2
- public value: number;
3
- public polarAzimuthInDegrees: number;
4
- public polarDistanceInMeters: number;
5
-
6
- constructor(json: {
7
- value: number,
8
- polarAzimuthInDegrees: number,
9
- polarDistanceInMeters: number
10
- }) {
11
- this.value = json.value;
12
- this.polarAzimuthInDegrees = json.polarAzimuthInDegrees;
13
- this.polarDistanceInMeters = json.polarDistanceInMeters;
14
- }
15
- }
16
-
@@ -1,57 +0,0 @@
1
- import {IPolarMeasureValue} from './IPolarMeasureValue';
2
- import {IVersion} from '../organization';
3
- import {AbstractPolarMeasureValue} from './AbstractPolarMeasureValue';
4
- import {PolarMeasureValue} from './PolarMeasureValue';
5
-
6
- /**
7
- * Computed Rain with polar value containers
8
- */
9
- export class RainPolarMeasureValue extends AbstractPolarMeasureValue implements IPolarMeasureValue, IVersion {
10
-
11
- private readonly version: string;
12
-
13
- constructor(json: {
14
- polarMeasureValue: RainPolarMeasureValue | PolarMeasureValue | string,
15
- version?: string
16
- }) {
17
- super(json);
18
-
19
- if (json.polarMeasureValue instanceof RainPolarMeasureValue) {
20
- this.version = json.polarMeasureValue.version;
21
- return;
22
- }
23
-
24
- this.version = json.version;
25
- }
26
-
27
- static From(obj: IPolarMeasureValue | any): RainPolarMeasureValue {
28
- let version: string,
29
- polarMeasureValue: PolarMeasureValue;
30
-
31
- if (typeof obj.version === 'string') {
32
- version = obj.version;
33
- }
34
-
35
- if (typeof obj.polarMeasureValue !== 'undefined') {
36
- polarMeasureValue = obj.polarMeasureValue;
37
- }
38
-
39
- return new RainPolarMeasureValue({polarMeasureValue, version});
40
- }
41
-
42
- public toJSON(options = {
43
- stringify: false
44
- }): any {
45
- const json: any = super.toJSON(options);
46
- json.version = this.version;
47
- return json;
48
- }
49
-
50
- public toJSONWithPolarStringified(): any {
51
- return this.toJSON({stringify: true});
52
- }
53
-
54
- public getVersion(): string {
55
- return this.version;
56
- }
57
- }
@@ -1,23 +0,0 @@
1
- import {CartesianValue} from '../../cartesian/CartesianValue';
2
-
3
- export class CartesianGaugeHistory {
4
- public gaugeId: string;
5
- public gaugeLabel: string;
6
- public date: Date;
7
- public value: CartesianValue;
8
- public configurationAsJSON: string;
9
-
10
- constructor(json: {
11
- gaugeId: string,
12
- gaugeLabel: string,
13
- date: Date,
14
- value: CartesianValue,
15
- configurationAsJSON: string,
16
- }) {
17
- this.gaugeId = json.gaugeId;
18
- this.gaugeLabel = json.gaugeLabel;
19
- this.date = json.date;
20
- this.value = json.value;
21
- this.configurationAsJSON = json.configurationAsJSON;
22
- }
23
- }
@@ -1,15 +0,0 @@
1
- import {CartesianValue} from '../../cartesian';
2
-
3
- export class CartesianRainHistory {
4
-
5
- public date: Date;
6
- public computedValue: CartesianValue;
7
-
8
- constructor(json: {
9
- date: Date,
10
- computedValue: CartesianValue
11
- }) {
12
- this.date = json.date;
13
- this.computedValue = json.computedValue;
14
- }
15
- }
@@ -1,31 +0,0 @@
1
- import {PositionValue} from '../position/PositionValue';
2
-
3
- export class PositionHistory extends PositionValue {
4
- public id: string;
5
- public label: string;
6
- public date: Date;
7
- public valueFromGauge: number;
8
- public valueFromRain: number;
9
- public configurationAsJSON: string;
10
-
11
- constructor(json: {
12
- id: string,
13
- label: string,
14
- date: Date,
15
- x: number,
16
- y: number,
17
- value: number,
18
- valueFromGauge?: number,
19
- valueFromRain?: number,
20
- configurationAsJSON?: string,
21
- }) {
22
- super(json);
23
-
24
- this.id = json.id;
25
- this.label = json.label;
26
- this.date = json.date;
27
- this.valueFromGauge = json.valueFromGauge;
28
- this.valueFromRain = json.valueFromRain;
29
- this.configurationAsJSON = json.configurationAsJSON;
30
- }
31
- }
@@ -1,59 +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
- getXY(precision?: number): { x: number, y: number } {
35
- if (typeof precision === 'undefined') {
36
- return {x: this.x, y: this.y};
37
- }
38
-
39
- const tenPower = Math.pow(10, precision);
40
- return {
41
- x: Math.round(this.x * tenPower) / tenPower,
42
- y: Math.round(this.y * tenPower) / tenPower,
43
- };
44
- }
45
-
46
- samePosition(p: Position, precision?: number) {
47
- const xy = this.getXY(precision);
48
- return xy.x === p.x && xy.y === p.y;
49
- }
50
-
51
- getPrecision(): number {
52
- return this.precision;
53
- }
54
-
55
- getXYScaled(scale: number): { x: number, y: number } {
56
- const precision = Math.round(Math.log10(1 / scale));
57
- return this.getXY(precision);
58
- }
59
- }
@@ -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,41 +0,0 @@
1
- import {Measure} from '../organization';
2
- import {IPolarMeasureValue} from '../polar';
3
- import {ICartesianMeasureValue} from '../cartesian';
4
- import {RadarNode} from './RadarNode';
5
-
6
- /**
7
- * api/radars/:id/measures/:id
8
- */
9
- export class RadarMeasure extends Measure {
10
-
11
- public static TYPE = 'radar-measure';
12
-
13
- constructor(json: {
14
- id: string,
15
- values: IPolarMeasureValue[] | ICartesianMeasureValue[] | number[],
16
- date?: Date,
17
- validity?: number,
18
- configurationAsJSON?: string,
19
- radar?: string,
20
- }
21
- ) {
22
- super(json);
23
- if (json.radar) {
24
- this.addLinks([new RadarNode({id: json.radar, latitude: NaN, longitude: NaN, team: null, name: null})]);
25
- }
26
- }
27
-
28
- public toJSON(options?: any): any {
29
- const json = super.toJSON(options);
30
- const radarLink = this.getLink(RadarNode.TYPE);
31
- if (radarLink) {
32
- json['radar'] = radarLink.getId();
33
- }
34
-
35
- return json;
36
- }
37
-
38
- protected getLinkType(): string {
39
- return RadarMeasure.TYPE;
40
- }
41
- }
@@ -1,61 +0,0 @@
1
- import {RadarMeasure} from './RadarMeasure';
2
- import {RadarNode} from './RadarNode';
3
- import {Link, RaainNode, TeamNode} from '../organization';
4
-
5
- /**
6
- * api/radars/:radarId?format=map&...
7
- */
8
- export class RadarNodeMap extends RadarNode {
9
-
10
- public date: Date;
11
- private map: string; // RadarMeasure[]; stringified
12
-
13
- constructor(json: {
14
- id: string,
15
- latitude: number,
16
- longitude: number,
17
- date: Date,
18
- map: RadarMeasure[] | string,
19
- name: string,
20
- description: string,
21
- team: TeamNode,
22
- links?: Link[] | RaainNode[],
23
- version?: string,
24
- configurationAsJSON?: any,
25
- }) {
26
- super(json);
27
- this.date = new Date(json.date);
28
- this.setMapData(json.map);
29
- }
30
-
31
- public toJSON(): any {
32
- const json = super.toJSON();
33
- if (this.map) {
34
- json['map'] = this.map;
35
- }
36
- json['date'] = this.date.toISOString();
37
- return json;
38
- }
39
-
40
- public setMapData(mapData: RadarMeasure[] | string) {
41
- if (!mapData) {
42
- return;
43
- }
44
-
45
- let map = mapData;
46
- try {
47
- if (typeof (mapData) !== 'string') {
48
- map = JSON.stringify(mapData);
49
- }
50
- } catch (e) {
51
- }
52
- this.map = map.toString();
53
- }
54
-
55
- public getMapData(): RadarMeasure[] {
56
- if (!this.map) {
57
- return [];
58
- }
59
- return JSON.parse(this.map);
60
- }
61
- }
@@ -1,15 +0,0 @@
1
- import {LatLng} from '../cartesian';
2
-
3
- export enum MergeStrategy {
4
- NONE = 'none',
5
- SUM = 'sum',
6
- AVERAGE = 'average',
7
- MAX = 'max',
8
- }
9
-
10
- export interface MergeLatLng {
11
- sum: number;
12
- max: number;
13
- count: number;
14
- latLng: LatLng;
15
- }
@@ -1,96 +0,0 @@
1
- import {Link, RaainNode} from '../organization';
2
- import {RainPolarMeasureValue} from '../polar';
3
- import {CartesianTools, LatLng, RainCartesianMeasureValue} from '../cartesian';
4
- import {RainComputationAbstract} from './RainComputationAbstract';
5
- import {RainMeasure} from './RainMeasure';
6
- import {MergeStrategy} from './MergeStrategy';
7
-
8
- /**
9
- * api/rains/:rainId/computations/:computationId
10
- * or as an array on
11
- * api/rains/:id/computations?format=id&begin=...
12
- */
13
- export class RainComputation extends RainComputationAbstract {
14
-
15
- public static TYPE = 'rain-computation';
16
-
17
- // why "results" ? because "values" came from Measure.values, "results" came from computation
18
- // why array ? because you can have different angle/axis from the Radar
19
- public results: RainPolarMeasureValue[] | RainCartesianMeasureValue[];
20
-
21
- constructor(json: {
22
- id: string,
23
- date: Date,
24
- isReady: boolean,
25
- results: RainPolarMeasureValue[] | RainCartesianMeasureValue[],
26
- links?: Link[] | RaainNode[],
27
- version?: string,
28
- quality?: number,
29
- progressIngest?: number,
30
- progressComputing?: number,
31
- timeSpentInMs?: number,
32
- isDoneDate?: Date,
33
- launchedBy?: string,
34
- rain?: Link | RaainNode,
35
- radars?: Link[] | RaainNode[],
36
-
37
- }) {
38
- super(json);
39
- this.setResults(json.results);
40
- }
41
-
42
- public toJSON(options = {
43
- stringify: false
44
- }): any {
45
- const json = super.toJSON();
46
- json['results'] = this.results.map(r => r.toJSON(options));
47
- return json;
48
- }
49
-
50
- mergeCartesianResults(options: {
51
- mergeStrategy: MergeStrategy,
52
- mergeLimitPoints: [LatLng, LatLng],
53
- cartesianTools: CartesianTools,
54
- removeNullValues?: boolean,
55
- }): RainMeasure[] {
56
-
57
- this.buildLatLngMatrix(options);
58
-
59
- return this.mergeRainMeasures([new RainMeasure({
60
- id: this.id,
61
- values: this.results,
62
- date: this.date
63
- })], options);
64
- }
65
-
66
- protected getLinkType(): string {
67
- return RainComputation.TYPE;
68
- }
69
-
70
- private setResults(results: string[] | RainPolarMeasureValue[] | RainCartesianMeasureValue[]) {
71
- if (typeof results === 'string') {
72
- results = JSON.parse(results);
73
- }
74
-
75
- if (!results || results.length === 0 || !Array.isArray(results)) {
76
- this.results = [];
77
- return;
78
- }
79
-
80
- this.results = results.map(r => {
81
- if (typeof r === 'string' && r.indexOf('polarMeasureValue') >= 0) {
82
- return new RainPolarMeasureValue(JSON.parse(r));
83
- } else if (r.polarMeasureValue) {
84
- return new RainPolarMeasureValue(r);
85
- }
86
- if (typeof r === 'string' && r.indexOf('cartesian') >= 0) {
87
- return new RainCartesianMeasureValue(JSON.parse(r));
88
- } else if (r.cartesianValues) {
89
- return new RainCartesianMeasureValue(r);
90
- } else {
91
- return r;
92
- }
93
- });
94
- }
95
-
96
- }
@@ -1,25 +0,0 @@
1
- import {Measure} from '../organization';
2
- import {IPolarMeasureValue} from '../polar';
3
- import {ICartesianMeasureValue} from '../cartesian';
4
-
5
- /**
6
- * api/rains/:id/computations/:id?format=map => RainComputationMap getMapData() => RainMeasure[]
7
- */
8
- export class RainMeasure extends Measure {
9
-
10
- public static TYPE = 'rain-measure';
11
-
12
- constructor(json: {
13
- id: string,
14
- values: IPolarMeasureValue[] | ICartesianMeasureValue[] | number[],
15
- date?: Date,
16
- validity?: number,
17
- configurationAsJSON?: string,
18
- }) {
19
- super(json);
20
- }
21
-
22
- protected getLinkType(): string {
23
- return RainMeasure.TYPE;
24
- }
25
- }
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
- }