Projekt

Obecné

Profil

Stáhnout (2.96 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
    /// <author>Alex Konig</author>
10
    class WeatherInfo
11
    {
12
        /// <summary> Temperature in °C </summary>
13
        public double temp;
14
        /// <summary> Probability of rain in % </summary>
15
        public int rain;
16
        /// <summary> Wind in m/s </summary>
17
        public double wind;
18
        /// <summary> Luminance </summary>
19
        public double lum;
20
        /// <summary> General weather conditions </summary>
21
        public WeatherConditions condition;
22

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

    
28
        public WeatherInfo()
29
        {
30
            condition = WeatherConditions.Dark;
31
        }
32

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

    
51
            condition = ValueToConditions.TransferLuxToConditions(lum);
52
        }
53

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

    
72
            lum = ValueToConditions.TransferConditionsToLux(condition);
73
        }
74

    
75
        /// <summary>
76
        /// To string
77
        /// </summary>
78
        /// <returns>interval start temperature probability of rain wind    weather condition</returns>
79
        public override string ToString()
80
        {
81
            return $"{startTime} \t {temp}°C \t {rain}% \t {wind}m/s \t {condition.ToString()} \t {lum}";
82
        }
83

    
84
    }
85
}
(3-3/3)