Projekt

Obecné

Profil

Stáhnout (2.82 KB) Statistiky
| Větev: | Tag: | Revize:
1
using System;
2

    
3
namespace ServerApp.Parser.OutputInfo
4
{
5
    /// <summary>
6
    /// Class representing the weather in a given interval at ZCU
7
    /// - shortest possible interval is 1h
8
    /// </summary>
9
    class WeatherInfo
10
    {
11
        /// <summary> Temperature in °C </summary>
12
        public double temp;
13
        /// <summary> Probability of rain in % </summary>
14
        public int rain;
15
        /// <summary> Wind in m/s </summary>
16
        public double wind;
17
        /// <summary> Luminance </summary>
18
        public double lum;
19
        /// <summary> General weather conditions </summary>
20
        public WeatherConditions condition;
21

    
22
        /// <summary> Start of interval </summary>
23
        DateTime startTime;
24
        /// <summary> Length of interval in hours </summary>
25
        int intervalLength;
26

    
27
        /// <summary>
28
        /// Constructor
29
        /// </summary>
30
        /// <param name="startTime">Start of the interval</param>
31
        /// <param name="temp">Temperature in °C</param>
32
        /// <param name="rain">Probability of rain in %</param>
33
        /// <param name="wind">Wind in m/w</param>
34
        /// <param name="lum">Luminance in lux</param>
35
        /// <param name="intervalLength">Interval length</param>
36
        public WeatherInfo(DateTime startTime, double temp, int rain, double wind, double lum, int intervalLength)
37
        {
38
            this.startTime = startTime;
39
            this.temp = temp;
40
            this.rain = rain;
41
            this.wind = wind;
42
            this.lum = lum;
43
            this.intervalLength = intervalLength;
44

    
45
            condition = LuxToConditions.TransferLuxToConditions(lum);
46
        }
47

    
48
        /// <summary>
49
        /// Constructor
50
        /// </summary>
51
        /// <param name="startTime">Start of the interval</param>
52
        /// <param name="temp">Temperature in °C</param>
53
        /// <param name="rain">Probability of rain in %</param>
54
        /// <param name="wind">Wind in m/s</param>
55
        /// <param name="condition">Weather conditions</param>
56
        /// <param name="intervalLength">Interval length</param>
57
        public WeatherInfo(DateTime startTime, double temp, int rain, double wind, WeatherConditions condition, int intervalLength)
58
        {
59
            this.startTime = startTime;
60
            this.temp = temp;
61
            this.rain = rain;
62
            this.wind = wind;
63
            this.condition = condition;
64
            this.intervalLength = intervalLength;
65

    
66
            lum = LuxToConditions.TransferConditionsToLux(condition);
67
        }
68

    
69
        /// <summary>
70
        /// To string
71
        /// </summary>
72
        /// <returns>interval start temperature probability of rain wind    weather condition</returns>
73
        public override string ToString()
74
        {
75
            return $"{startTime.ToString()} \t {temp}°C \t {rain}% \t {wind}m/s \t {condition.ToString()}";
76
        }
77

    
78
    }
79
}
(3-3/3)