Exemplo n.º 1
0
Arquivo: Metar.cs Projeto: dfr0/moon
		public Weather (string proximity, string intensity, string descriptor,
				string precipitation, string obscuration, string misc)
		{
			if (proximity == "VC")
				this.intensity = WeatherIntensity.Vincinity;
			
			switch (intensity) {
				case "-":
					this.intensity |= WeatherIntensity.Light;
					break;
					
				case "":
					this.intensity |= WeatherIntensity.Moderate;
					break;
					
				case "+":
					this.intensity |= WeatherIntensity.Heavy;
					break;
			}
			
			switch (descriptor) {
				case "MI":
					this.descriptor = WeatherDescriptor.Shallow;
					break;

				case "PR":
					this.descriptor = WeatherDescriptor.Partial;
					break;

				case "BC":
					this.descriptor = WeatherDescriptor.Patches;
					break;

				case "DR":
					this.descriptor = WeatherDescriptor.LowDrifting;
					break;

				case "BL":
					this.descriptor = WeatherDescriptor.Blowing;
					break;

				case "SH":
					this.descriptor = WeatherDescriptor.Shower;
					break;

				case "TH":
					this.descriptor = WeatherDescriptor.Thunderstorm;
					break;

				case "FZ":
					this.descriptor = WeatherDescriptor.Freezing;
					break;

				default:
					this.descriptor = WeatherDescriptor.Invalid;
					break;
			};

			switch (precipitation) {
				case "DZ":
					this.precipitation = WeatherPrecipitation.Drizzle;
					break;

				case "RA":
					this.precipitation = WeatherPrecipitation.Rain;
					break;

				case "SN":
					this.precipitation = WeatherPrecipitation.Snow;
					break;

				case "SG":
					this.precipitation = WeatherPrecipitation.SnowGrains;
					break;
					
				case "IC":
					this.precipitation = WeatherPrecipitation.IceCrystals;
					break;

				case "PE":
					this.precipitation = WeatherPrecipitation.IcePellets;
					break;

				case "GR":
					this.precipitation = WeatherPrecipitation.Hail;
					break;

				case "GS":
					this.precipitation = WeatherPrecipitation.SmallHail;
					break;

				case "UP":
					this.precipitation = WeatherPrecipitation.Unknown;
					break;

				default:
					this.precipitation = WeatherPrecipitation.Invalid;
					break;
			};

			switch (obscuration) {
				case "BR":
					this.obscuration = WeatherObscuration.Mist;
					break;

				case "FG":
					this.obscuration = WeatherObscuration.Fog;
					break;

				case "FU":
					this.obscuration = WeatherObscuration.Smoke;
					break;

				case "VA":
					this.obscuration = WeatherObscuration.VolcanicAsh;
					break;

				case "DU":
					this.obscuration = WeatherObscuration.Dust;
					break;

				case "SA":
					this.obscuration = WeatherObscuration.Sand;
					break;

				case "HZ":
					this.obscuration = WeatherObscuration.Haze;
					break;

				case "PY":
					this.obscuration = WeatherObscuration.Spray;
					break;

				default:
					this.obscuration = WeatherObscuration.Invalid;
					break;
			};

			switch (misc) {
				case "PO":
					this.misc = WeatherMisc.DustWhirls;
					break;

				case "SQ":
					this.misc = WeatherMisc.Squalls;
					break;

				case "FC":
					this.misc = WeatherMisc.Tornado;
					break;

				case "SS":
					this.misc = WeatherMisc.DustStorm;
					break;

				default:
					this.misc = WeatherMisc.Invalid;
					break;
			};
		}
Exemplo n.º 2
0
        public Weather(string proximity, string intensity, string descriptor,
                       string precipitation, string obscuration, string misc)
        {
            if (proximity == "VC")
            {
                this.intensity = WeatherIntensity.Vincinity;
            }

            switch (intensity)
            {
            case "-":
                this.intensity |= WeatherIntensity.Light;
                break;

            case "":
                this.intensity |= WeatherIntensity.Moderate;
                break;

            case "+":
                this.intensity |= WeatherIntensity.Heavy;
                break;
            }

            switch (descriptor)
            {
            case "MI":
                this.descriptor = WeatherDescriptor.Shallow;
                break;

            case "PR":
                this.descriptor = WeatherDescriptor.Partial;
                break;

            case "BC":
                this.descriptor = WeatherDescriptor.Patches;
                break;

            case "DR":
                this.descriptor = WeatherDescriptor.LowDrifting;
                break;

            case "BL":
                this.descriptor = WeatherDescriptor.Blowing;
                break;

            case "SH":
                this.descriptor = WeatherDescriptor.Shower;
                break;

            case "TH":
                this.descriptor = WeatherDescriptor.Thunderstorm;
                break;

            case "FZ":
                this.descriptor = WeatherDescriptor.Freezing;
                break;

            default:
                this.descriptor = WeatherDescriptor.Invalid;
                break;
            }
            ;

            switch (precipitation)
            {
            case "DZ":
                this.precipitation = WeatherPrecipitation.Drizzle;
                break;

            case "RA":
                this.precipitation = WeatherPrecipitation.Rain;
                break;

            case "SN":
                this.precipitation = WeatherPrecipitation.Snow;
                break;

            case "SG":
                this.precipitation = WeatherPrecipitation.SnowGrains;
                break;

            case "IC":
                this.precipitation = WeatherPrecipitation.IceCrystals;
                break;

            case "PE":
                this.precipitation = WeatherPrecipitation.IcePellets;
                break;

            case "GR":
                this.precipitation = WeatherPrecipitation.Hail;
                break;

            case "GS":
                this.precipitation = WeatherPrecipitation.SmallHail;
                break;

            case "UP":
                this.precipitation = WeatherPrecipitation.Unknown;
                break;

            default:
                this.precipitation = WeatherPrecipitation.Invalid;
                break;
            }
            ;

            switch (obscuration)
            {
            case "BR":
                this.obscuration = WeatherObscuration.Mist;
                break;

            case "FG":
                this.obscuration = WeatherObscuration.Fog;
                break;

            case "FU":
                this.obscuration = WeatherObscuration.Smoke;
                break;

            case "VA":
                this.obscuration = WeatherObscuration.VolcanicAsh;
                break;

            case "DU":
                this.obscuration = WeatherObscuration.Dust;
                break;

            case "SA":
                this.obscuration = WeatherObscuration.Sand;
                break;

            case "HZ":
                this.obscuration = WeatherObscuration.Haze;
                break;

            case "PY":
                this.obscuration = WeatherObscuration.Spray;
                break;

            default:
                this.obscuration = WeatherObscuration.Invalid;
                break;
            }
            ;

            switch (misc)
            {
            case "PO":
                this.misc = WeatherMisc.DustWhirls;
                break;

            case "SQ":
                this.misc = WeatherMisc.Squalls;
                break;

            case "FC":
                this.misc = WeatherMisc.Tornado;
                break;

            case "SS":
                this.misc = WeatherMisc.DustStorm;
                break;

            default:
                this.misc = WeatherMisc.Invalid;
                break;
            }
            ;
        }