raain-model 2.6.10 → 3.0.1

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 (215) hide show
  1. package/CHANGELOG.md +94 -7
  2. package/README.md +14 -13
  3. package/RELEASE_PROCESS.md +91 -4
  4. package/cartesian/CartesianMeasureValue.d.ts +46 -0
  5. package/{src/cartesian/CartesianMeasureValue.ts → cartesian/CartesianMeasureValue.js} +41 -73
  6. package/cartesian/CartesianMeasureValue.js.map +1 -0
  7. package/cartesian/CartesianTools.d.ts +32 -0
  8. package/{src/cartesian/CartesianTools.ts → cartesian/CartesianTools.js} +69 -130
  9. package/cartesian/CartesianTools.js.map +1 -0
  10. package/cartesian/CartesianValue.d.ts +14 -0
  11. package/cartesian/CartesianValue.js +17 -0
  12. package/cartesian/CartesianValue.js.map +1 -0
  13. package/cartesian/EarthMap.d.ts +5 -0
  14. package/cartesian/EarthMap.js +3 -0
  15. package/cartesian/EarthMap.js.map +1 -0
  16. package/cartesian/ICartesianMeasureValue.d.ts +23 -0
  17. package/cartesian/ICartesianMeasureValue.js +3 -0
  18. package/cartesian/ICartesianMeasureValue.js.map +1 -0
  19. package/cartesian/LatLng.d.ts +16 -0
  20. package/cartesian/LatLng.js +34 -0
  21. package/cartesian/LatLng.js.map +1 -0
  22. package/cartesian/RadarCartesianMeasureValue.d.ts +27 -0
  23. package/cartesian/RadarCartesianMeasureValue.js +24 -0
  24. package/cartesian/RadarCartesianMeasureValue.js.map +1 -0
  25. package/cartesian/RainCartesianMeasureValue.d.ts +25 -0
  26. package/cartesian/RainCartesianMeasureValue.js +25 -0
  27. package/cartesian/RainCartesianMeasureValue.js.map +1 -0
  28. package/cartesian/index.js +25 -0
  29. package/cartesian/index.js.map +1 -0
  30. package/gauge/GaugeMeasure.d.ts +30 -0
  31. package/gauge/GaugeMeasure.js +30 -0
  32. package/gauge/GaugeMeasure.js.map +1 -0
  33. package/gauge/GaugeNode.d.ts +95 -0
  34. package/{src/gauge/GaugeNode.ts → gauge/GaugeNode.js} +28 -54
  35. package/gauge/GaugeNode.js.map +1 -0
  36. package/gauge/GaugeNodeMap.d.ts +35 -0
  37. package/gauge/GaugeNodeMap.js +42 -0
  38. package/gauge/GaugeNodeMap.js.map +1 -0
  39. package/gauge/index.js +20 -0
  40. package/gauge/index.js.map +1 -0
  41. package/index.js +24 -0
  42. package/index.js.map +1 -0
  43. package/organization/EventNode.d.ts +30 -0
  44. package/organization/EventNode.js +30 -0
  45. package/organization/EventNode.js.map +1 -0
  46. package/organization/IVersion.js +3 -0
  47. package/organization/IVersion.js.map +1 -0
  48. package/organization/Link.d.ts +16 -0
  49. package/{src/organization/Link.ts → organization/Link.js} +15 -15
  50. package/organization/Link.js.map +1 -0
  51. package/organization/Measure.d.ts +30 -0
  52. package/organization/Measure.js +51 -0
  53. package/organization/Measure.js.map +1 -0
  54. package/organization/PeopleNode.d.ts +23 -0
  55. package/{src/organization/PeopleNode.ts → organization/PeopleNode.js} +10 -20
  56. package/organization/PeopleNode.js.map +1 -0
  57. package/organization/RaainNode.d.ts +95 -0
  58. package/{src/organization/RaainNode.ts → organization/RaainNode.js} +38 -63
  59. package/organization/RaainNode.js.map +1 -0
  60. package/organization/TeamNode.d.ts +51 -0
  61. package/organization/TeamNode.js +52 -0
  62. package/organization/TeamNode.js.map +1 -0
  63. package/organization/index.js +24 -0
  64. package/organization/index.js.map +1 -0
  65. package/package.json +4 -2
  66. package/polar/AbstractPolarMeasureValue.d.ts +31 -0
  67. package/{src/polar/AbstractPolarMeasureValue.ts → polar/AbstractPolarMeasureValue.js} +34 -62
  68. package/polar/AbstractPolarMeasureValue.js.map +1 -0
  69. package/polar/IPolarMeasureValue.d.ts +19 -0
  70. package/polar/IPolarMeasureValue.js +3 -0
  71. package/polar/IPolarMeasureValue.js.map +1 -0
  72. package/polar/MeasureValuePolarContainer.d.ts +24 -0
  73. package/{src/polar/MeasureValuePolarContainer.ts → polar/MeasureValuePolarContainer.js} +13 -29
  74. package/polar/MeasureValuePolarContainer.js.map +1 -0
  75. package/polar/PolarFilter.d.ts +16 -0
  76. package/polar/PolarFilter.js +45 -0
  77. package/polar/PolarFilter.js.map +1 -0
  78. package/polar/PolarMeasureValue.d.ts +51 -0
  79. package/{src/polar/PolarMeasureValue.ts → polar/PolarMeasureValue.js} +62 -125
  80. package/polar/PolarMeasureValue.js.map +1 -0
  81. package/polar/PolarMeasureValueMap.d.ts +45 -0
  82. package/{src/polar/PolarMeasureValueMap.ts → polar/PolarMeasureValueMap.js} +88 -165
  83. package/polar/PolarMeasureValueMap.js.map +1 -0
  84. package/polar/PolarValue.d.ts +10 -0
  85. package/polar/PolarValue.js +12 -0
  86. package/polar/PolarValue.js.map +1 -0
  87. package/polar/RadarPolarMeasureValue.d.ts +33 -0
  88. package/{src/polar/RadarPolarMeasureValue.ts → polar/RadarPolarMeasureValue.js} +31 -39
  89. package/polar/RadarPolarMeasureValue.js.map +1 -0
  90. package/polar/RainPolarMeasureValue.d.ts +24 -0
  91. package/polar/RainPolarMeasureValue.js +46 -0
  92. package/polar/RainPolarMeasureValue.js.map +1 -0
  93. package/polar/index.js +25 -0
  94. package/polar/index.js.map +1 -0
  95. package/quality/QualityPoint.d.ts +37 -0
  96. package/{src/quality/QualityPoint.ts → quality/QualityPoint.js} +33 -56
  97. package/quality/QualityPoint.js.map +1 -0
  98. package/quality/SpeedMatrix.d.ts +83 -0
  99. package/{src/quality/SpeedMatrix.ts → quality/SpeedMatrix.js} +76 -117
  100. package/quality/SpeedMatrix.js.map +1 -0
  101. package/quality/SpeedMatrixContainer.d.ts +102 -0
  102. package/{src/quality/SpeedMatrixContainer.ts → quality/SpeedMatrixContainer.js} +103 -210
  103. package/quality/SpeedMatrixContainer.js.map +1 -0
  104. package/quality/history/CartesianGaugeHistory.d.ts +15 -0
  105. package/quality/history/CartesianGaugeHistory.js +14 -0
  106. package/quality/history/CartesianGaugeHistory.js.map +1 -0
  107. package/quality/history/CartesianRainHistory.d.ts +9 -0
  108. package/quality/history/CartesianRainHistory.js +11 -0
  109. package/quality/history/CartesianRainHistory.js.map +1 -0
  110. package/quality/history/PositionHistory.d.ts +20 -0
  111. package/quality/history/PositionHistory.js +17 -0
  112. package/quality/history/PositionHistory.js.map +1 -0
  113. package/{src/quality/index.ts → quality/index.d.ts} +0 -3
  114. package/quality/index.js +26 -0
  115. package/quality/index.js.map +1 -0
  116. package/quality/position/Position.d.ts +22 -0
  117. package/quality/position/Position.js +50 -0
  118. package/quality/position/Position.js.map +1 -0
  119. package/quality/position/PositionValue.d.ts +9 -0
  120. package/quality/position/PositionValue.js +12 -0
  121. package/quality/position/PositionValue.js.map +1 -0
  122. package/quality/tools/QualityTools.d.ts +9 -0
  123. package/{src/quality/tools/QualityTools.ts → quality/tools/QualityTools.js} +17 -18
  124. package/quality/tools/QualityTools.js.map +1 -0
  125. package/radar/RadarMeasure.d.ts +38 -0
  126. package/radar/RadarMeasure.js +33 -0
  127. package/radar/RadarMeasure.js.map +1 -0
  128. package/radar/RadarNode.d.ts +41 -0
  129. package/radar/RadarNode.js +58 -0
  130. package/radar/RadarNode.js.map +1 -0
  131. package/radar/RadarNodeMap.d.ts +51 -0
  132. package/radar/RadarNodeMap.js +50 -0
  133. package/radar/RadarNodeMap.js.map +1 -0
  134. package/radar/index.js +20 -0
  135. package/radar/index.js.map +1 -0
  136. package/rain/MergeStrategy.d.ts +13 -0
  137. package/rain/MergeStrategy.js +11 -0
  138. package/rain/MergeStrategy.js.map +1 -0
  139. package/rain/RainComputation.d.ts +59 -0
  140. package/rain/RainComputation.js +68 -0
  141. package/rain/RainComputation.js.map +1 -0
  142. package/rain/RainComputationAbstract.d.ts +89 -0
  143. package/rain/RainComputationAbstract.js +207 -0
  144. package/rain/RainComputationAbstract.js.map +1 -0
  145. package/rain/RainComputationMap.d.ts +113 -0
  146. package/{src/rain/RainComputationMap.ts → rain/RainComputationMap.js} +26 -60
  147. package/rain/RainComputationMap.js.map +1 -0
  148. package/rain/RainComputationQuality.d.ts +58 -0
  149. package/{src/rain/RainComputationQuality.ts → rain/RainComputationQuality.js} +52 -89
  150. package/rain/RainComputationQuality.js.map +1 -0
  151. package/rain/RainMeasure.d.ts +17 -0
  152. package/rain/RainMeasure.js +18 -0
  153. package/rain/RainMeasure.js.map +1 -0
  154. package/rain/RainNode.d.ts +60 -0
  155. package/rain/RainNode.js +198 -0
  156. package/rain/RainNode.js.map +1 -0
  157. package/{src/rain/index.ts → rain/index.d.ts} +1 -0
  158. package/rain/index.js +24 -0
  159. package/rain/index.js.map +1 -0
  160. package/.cursorignore +0 -10
  161. package/.github/workflows/ci.yml +0 -29
  162. package/LICENSE +0 -21
  163. package/RELEASE.md +0 -19
  164. package/specs/REQUIREMENTS.md +0 -42
  165. package/specs/TECHNICAL.md +0 -57
  166. package/specs/cartesian/Cartesian.spec.ts +0 -82
  167. package/specs/cartesian/CartesianTools.spec.ts +0 -121
  168. package/specs/gauge/Gauge.spec.ts +0 -39
  169. package/specs/organization/Organization.spec.ts +0 -38
  170. package/specs/polar/Polar.spec.ts +0 -267
  171. package/specs/quality/Position.spec.ts +0 -18
  172. package/specs/quality/QualityPointEdgeCases.spec.ts +0 -215
  173. package/specs/quality/QualityTools.spec.ts +0 -67
  174. package/specs/quality/SpeedMatrix.spec.ts +0 -214
  175. package/specs/radar/Radar.spec.ts +0 -129
  176. package/specs/rain/Rain.spec.ts +0 -334
  177. package/specs/tsconfig.json +0 -12
  178. package/src/cartesian/CartesianValue.ts +0 -26
  179. package/src/cartesian/EarthMap.ts +0 -5
  180. package/src/cartesian/ICartesianMeasureValue.ts +0 -22
  181. package/src/cartesian/LatLng.ts +0 -43
  182. package/src/cartesian/RadarCartesianMeasureValue.ts +0 -32
  183. package/src/cartesian/RainCartesianMeasureValue.ts +0 -32
  184. package/src/gauge/GaugeMeasure.ts +0 -42
  185. package/src/gauge/GaugeNodeMap.ts +0 -55
  186. package/src/organization/EventNode.ts +0 -43
  187. package/src/organization/Measure.ts +0 -61
  188. package/src/organization/TeamNode.ts +0 -91
  189. package/src/polar/IPolarMeasureValue.ts +0 -21
  190. package/src/polar/PolarFilter.ts +0 -46
  191. package/src/polar/PolarValue.ts +0 -16
  192. package/src/polar/RainPolarMeasureValue.ts +0 -57
  193. package/src/quality/history/CartesianGaugeHistory.ts +0 -23
  194. package/src/quality/history/CartesianRainHistory.ts +0 -15
  195. package/src/quality/history/PositionHistory.ts +0 -31
  196. package/src/quality/position/Position.ts +0 -59
  197. package/src/quality/position/PositionValue.ts +0 -15
  198. package/src/radar/RadarMeasure.ts +0 -41
  199. package/src/radar/RadarNode.ts +0 -78
  200. package/src/radar/RadarNodeMap.ts +0 -61
  201. package/src/rain/MergeStrategy.ts +0 -15
  202. package/src/rain/RainComputation.ts +0 -96
  203. package/src/rain/RainComputationAbstract.ts +0 -262
  204. package/src/rain/RainMeasure.ts +0 -25
  205. package/src/rain/RainNode.ts +0 -235
  206. package/tsconfig.json +0 -17
  207. package/tslint.json +0 -79
  208. package/typedoc.json +0 -31
  209. /package/{src/cartesian/index.ts → cartesian/index.d.ts} +0 -0
  210. /package/{src/gauge/index.ts → gauge/index.d.ts} +0 -0
  211. /package/{src/index.ts → index.d.ts} +0 -0
  212. /package/{src/organization/IVersion.ts → organization/IVersion.d.ts} +0 -0
  213. /package/{src/organization/index.ts → organization/index.d.ts} +0 -0
  214. /package/{src/polar/index.ts → polar/index.d.ts} +0 -0
  215. /package/{src/radar/index.ts → radar/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,91 +0,0 @@
1
- import {PeopleNode} from './PeopleNode';
2
- import {RaainNode} from './RaainNode';
3
-
4
- /**
5
- * Represents a team in the RAAIN system.
6
- * This class manages team members and their contracts.
7
- *
8
- * @remarks
9
- * Used in the API endpoint: api/teams?name=customerTeam
10
- *
11
- * @example
12
- * ```typescript
13
- * const teamNode = new TeamNode({
14
- * id: 'team1',
15
- * name: 'Customer Team',
16
- * description: 'Main customer support team',
17
- * contracts: ['basic', 'premium'],
18
- * contacts: [peopleNode1, peopleNode2]
19
- * });
20
- * ```
21
- */
22
- export class TeamNode extends RaainNode {
23
-
24
- /** Type identifier for team nodes */
25
- public static TYPE = 'team';
26
-
27
- /** Unique identifier for the team */
28
- public id: any | string;
29
-
30
- /** Name of the team */
31
- public name: string;
32
-
33
- /** Description of the team */
34
- public description: string;
35
-
36
- /** Array of contract types associated with the team */
37
- public contracts: string[];
38
-
39
- /** Array of team members */
40
- public contacts: PeopleNode[];
41
-
42
- /**
43
- * Creates a new TeamNode instance.
44
- *
45
- * @param json - Configuration object
46
- * @param json.id - Unique identifier
47
- * @param json.name - Optional name of the team
48
- * @param json.description - Optional description
49
- * @param json.contracts - Optional array of contract types
50
- * @param json.contacts - Optional array of team members
51
- */
52
- constructor(json: {
53
- id: any | string,
54
- name?: string,
55
- description?: string,
56
- contracts?: string[],
57
- contacts?: PeopleNode[]
58
- }) {
59
- super(json);
60
-
61
- this.id = json.id;
62
- this.name = json.name;
63
- this.description = json.description;
64
- this.contracts = json.contracts;
65
- this.contacts = json.contacts;
66
- }
67
-
68
- /**
69
- * Converts the team node to a JSON object.
70
- *
71
- * @returns A JSON object containing the team's data
72
- */
73
- public toJSON(): any {
74
- return {
75
- id: this.id,
76
- name: this.name,
77
- description: this.description,
78
- contracts: this.contracts,
79
- contacts: this.contacts,
80
- } as any;
81
- }
82
-
83
- /**
84
- * Returns the link type for team nodes.
85
- *
86
- * @returns The string 'team'
87
- */
88
- protected getLinkType(): string {
89
- return TeamNode.TYPE;
90
- }
91
- }
@@ -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,78 +0,0 @@
1
- import {Link, RaainNode, TeamNode} from '../organization';
2
-
3
- /**
4
- * api/radars/:id
5
- */
6
- export class RadarNode extends RaainNode {
7
-
8
- public static TYPE = 'radar';
9
-
10
- public name: string;
11
- public description: string;
12
- public technicalInfos: string;
13
- public latitude: number;
14
- public longitude: number;
15
- public team: TeamNode;
16
-
17
- // internal
18
- private configurationAsJSON: string;
19
-
20
- constructor(json: {
21
- id: string,
22
- latitude: number,
23
- longitude: number,
24
- name: string,
25
- team: TeamNode,
26
- description?: string,
27
- technicalInfos?: string,
28
- links?: Link[] | RaainNode[],
29
- version?: string,
30
- configurationAsJSON?: any,
31
- }) {
32
- super(json);
33
- this.latitude = json.latitude;
34
- this.longitude = json.longitude;
35
- this.name = json.name;
36
- this.description = json.description;
37
- this.technicalInfos = json.technicalInfos;
38
- this.team = json.team;
39
- this.setConfiguration(json.configurationAsJSON);
40
- }
41
-
42
- public toJSON(): any {
43
- const json = super.toJSON();
44
- json['name'] = this.name;
45
- json['description'] = this.description;
46
- json['technicalInfos'] = this.technicalInfos;
47
- json['latitude'] = this.latitude;
48
- json['longitude'] = this.longitude;
49
- json['team'] = this.team?.id || this.team;
50
- json['configurationAsJSON'] = this.configurationAsJSON;
51
- return json;
52
- }
53
-
54
- public setConfiguration(configuration: string | any) {
55
- let conf = configuration;
56
- try {
57
- conf = JSON.parse(configuration);
58
- } catch (ignored) {
59
- }
60
-
61
- if (conf) {
62
- this.configurationAsJSON = JSON.stringify(conf);
63
- }
64
- }
65
-
66
- public getConfiguration(): any {
67
- try {
68
- return JSON.parse(this.configurationAsJSON);
69
- } catch (e) {
70
- }
71
- return null;
72
- }
73
-
74
- protected getLinkType(): string {
75
- return RadarNode.TYPE;
76
- }
77
-
78
- }
@@ -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
- }