Example #1
0
 Forecast(int temp, Rainfall rain, Cloudy clou, int hum, int ws, Wind_direction wd, Cities city)
 {
     this.temperature    = temp;
     this.rainfall       = rain;
     this.cloudy         = clou;
     this.humidity       = hum;
     this.wind_strength  = ws;
     this.wind_direction = wd;
     number_of_forecasts++;
 }
Example #2
0
        public static Wind_direction Change_direction(Wind_direction curr_dir, int steps)
        {
            var temp = (Wind_direction)(((int)curr_dir + steps) % 4);

            if (temp < 0)
            {
                return(4 + temp);
            }
            else
            {
                return(temp);
            }
        }
Example #3
0
        public static void Move(Coordinate current_coordinate, Wind_direction direction, int steps)
        {
            switch (direction)
            {
            case Wind_direction.N:
                current_coordinate.Y += steps;
                break;

            case Wind_direction.E:
                current_coordinate.X += steps;
                break;

            case Wind_direction.S:
                current_coordinate.Y -= steps;
                break;

            case Wind_direction.W:
                current_coordinate.X -= steps;
                break;
            }
        }
Example #4
0
        public ActionResult FutureWeather()
        {
            #region WybórDnia
            string NumberDayString = null;
            if (!Request["0"].IsEmpty())
            {
                NumberDayString = Request["0"];
            }


            int NumberDay = Convert.ToInt32(NumberDayString);


            FutureWeatherInfo.root futureWeather = new FutureWeatherInfo.root();
            FutureWeather          dowloand      = new FutureWeather();

            futureWeather = dowloand.DownloandFutureWeather(publicLat, publicLon);
            ViewBag.test  = publicLat + " " + publicLon;

            UnixTime unixTime = new UnixTime();


            if (futureWeather.daily != null)
            {
                ViewBag.NazwaMiasta = Nazwa_Miasta;


                ViewBag.Dzieńtygodnia               = unixTime.AktualnyDzieńString(futureWeather.daily[NumberDay].dt);
                ViewBag.futureWeatherDt             = futureWeather.daily[NumberDay].dt;
                ViewBag.futureWeatherSunrise        = unixTime.Aktualna_Godzina(futureWeather.daily[NumberDay].sunrise);
                ViewBag.futureWeatherSunset         = unixTime.Aktualna_Godzina(futureWeather.daily[NumberDay].sunset);
                ViewBag.futureWeatherTempMorn       = futureWeather.daily[NumberDay].temp.morn;
                ViewBag.futureWeatherTempDay        = futureWeather.daily[NumberDay].temp.day;
                ViewBag.futureWeatherTempEve        = futureWeather.daily[NumberDay].temp.eve;
                ViewBag.futureWeatherTempNight      = futureWeather.daily[NumberDay].temp.night;
                ViewBag.futureWeatherTempMin        = futureWeather.daily[NumberDay].temp.min;
                ViewBag.futureWeatherTempMax        = futureWeather.daily[NumberDay].temp.max;
                ViewBag.futureWeatherFeelsLikeMorn  = futureWeather.daily[NumberDay].feels_Like.morn;
                ViewBag.futureWeatherFeelsLikeDay   = futureWeather.daily[NumberDay].feels_Like.day;
                ViewBag.futureWeatherFeelsLikeEve   = futureWeather.daily[NumberDay].feels_Like.eve;
                ViewBag.futureWeatherFeelsLikeNight = futureWeather.daily[NumberDay].feels_Like.night;
                ViewBag.futureWeatherPressure       = futureWeather.daily[NumberDay].pressure;
                ViewBag.futureWeatherHumidity       = futureWeather.daily[NumberDay].humidity;
                ViewBag.futureWeatherDewPoint       = futureWeather.daily[NumberDay].dew_point;
                ViewBag.futureWeatherWindSpeed      = futureWeather.daily[NumberDay].wind_speed;
                ViewBag.futureWeatherWindGust       = futureWeather.daily[NumberDay].wind_gust;
                var kierunek_wiatr = new Wind_direction().kierunek_wiatru(((int)futureWeather.daily[NumberDay].wind_deg));


                ViewBag.futureWeatherWindDeg    = kierunek_wiatr;
                ViewBag.futureWeatherClouds     = futureWeather.daily[NumberDay].clouds;
                ViewBag.futureWeatherUvi        = futureWeather.daily[NumberDay].uvi;
                ViewBag.futureWeatherVisibility = futureWeather.daily[NumberDay].visibility;
                ViewBag.futureWeatherPop        = futureWeather.daily[NumberDay].pop * 100;
                ViewBag.futureWeatherRain       = futureWeather.daily[NumberDay].rain;
                ViewBag.futureWeatherSnow       = futureWeather.daily[NumberDay].snow;
            } //szegóły wybranego dnia
            else
            {
                ViewBag.error = "Nie udało się pobrać danych";
            }
            #endregion

            string Szegulowe_dane = "1";
            if (!Request["Wiecej_danych"].IsEmpty())
            {
                Szegulowe_dane = Request["Wiecej_danych"];
            }
            if (Szegulowe_dane == "1")
            {
                ViewBag.PokazSzeguloweDane  = "hidden";
                ViewBag.PokazSzeguloweDane2 = "visible";
                ViewBag.Szegułowe_Dane      = "Pokaz";
            }
            else if (Szegulowe_dane == "0")
            {
                ViewBag.PokazSzeguloweDane  = "visible";
                ViewBag.PokazSzeguloweDane2 = "hidden";
                ViewBag.Szegułowe_Dane      = "Schowaj";
            }



            return(View());
        }