Пример #1
0
	public SkyModel(double julianDay, LocationData location){
			
		if (INSTANCE == null) {
			INSTANCE = this;
		}

		this.location = location;
		this.jd =  julianDay;

		sun               = new SunModel (jd, location);
		moon        	  = new MoonModel (jd, location);
		MercuryModel mercuryModel = new MercuryModel (jd, location);
		VenusModel venusModel     = new VenusModel(jd, location);
		MarsModel marsModel       = new MarsModel (jd, location);
		JupiterModel jupiterModel = new JupiterModel (jd, location);
		SaturnModel saturnModel   = new SaturnModel (jd, location);
		UranusModel uranusModel   = new UranusModel(jd, location);
		NeptuneModel neptuneModel = new NeptuneModel(jd, location);

		planets = new Dictionary<string, PlanetModel> ();
		planets["Mercury"] = mercuryModel;
		planets["Venus"]   = venusModel;
		planets["Mars"]    = marsModel;
		planets["Jupiter"] = jupiterModel;
		planets["Saturn"]  = saturnModel;
		planets["Uranus"]  = uranusModel;
		planets["Neptune"] = neptuneModel;


		starPositionsDictionary = new Dictionary<EquatorialCoords, int> ();
		planetPositionsDictionary = new Dictionary<EquatorialCoords, PlanetModel> ();


	}
Пример #2
0
        private async void GetSunData(object sender, EventArgs e)
        {
            SunProcessor objSunProcessor = new SunProcessor();
            SunModel     objSunDetails   = await objSunProcessor.LoadSunData("", "");

            lblSunRiseValue.Text = objSunDetails.Sunrise;
            lblSunSetValue.Text  = objSunDetails.Sunset;
        }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        sim      = SimController.INSTANCE;
        distance = .9f * sim.radius;

        sun = sim.skyModel.GetSun();

        float size = 20.0f;        //transform.localScale.magnitude;

        transform.localScale = new Vector3(size, size, size);

        dirLight = GetComponent <Light> ();

        SetPosition();

        //Debug.Log("light pos -> "+ dirLight.transform.position.ToString ());
    }
Пример #4
0
        private async void button1_Click(object sender, EventArgs e)
        {
            SunsetTextBox.Text  = "";
            SunriseTextBox.Text = "";

            SunModel result = new SunModel();

            try
            {
                result = await SunProcessor.LoadSunTime();
            }
            catch (Exception)
            {
                MessageBox.Show("Error!", "SunProcessor");
            }

            SunriseTextBox.Text = result.Sunrise.ToLocalTime().ToShortTimeString();
            SunsetTextBox.Text  = result.Sunset.ToLocalTime().ToShortTimeString();
        }
Пример #5
0
	public void SetSun(SunModel sun){ this.sun = sun; }
Пример #6
0
        public List <TourModel> tourModel(string id)
        {
            System.Diagnostics.Debug.WriteLine("debug apifindvalue:" + id);
            try
            {
                string poststring = "";
                if (id == "")
                {
                    System.Diagnostics.Debug.WriteLine("if");
                    poststring = "api/Tour/";
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("else");
                    poststring = "api/Tour/" + id;
                }
                System.Diagnostics.Debug.WriteLine(poststring);
                var response = new RestClient("http://localhost:58696").Execute(new RestRequest(poststring, Method.GET)).Content;
                List <TourModel> tourList = new JavaScriptSerializer().Deserialize <List <TourModel> >(response);

                foreach (TourModel t in tourList)
                {
                    try
                    {
                        SunModel S      = sunModel(t.position.x, t.position.y);
                        var      format = "h:mm:ss tt";
                        t.sunrise    = DateTime.ParseExact(S.results.sunrise, format, CultureInfo.InvariantCulture);
                        t.sunset     = DateTime.ParseExact(S.results.sunset, format, CultureInfo.InvariantCulture);
                        t.day_length = S.results.day_length;
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine("Exception på SunModel: " + e);
                    }

                    try
                    {
                        ElevasionModel E = elevasionModel(t.position.x, t.position.y);
                        t.elevation = Convert.ToInt32(E.results[0].elevation);
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine("Exception på ElevationModel: " + e);
                    }

                    try
                    {
                        WeatherModel W = weatherModel(t.position.x, t.position.y);
                        t.temperature        = W.main.temp;
                        t.weatherdescription = W.weather[0].description;
                        t.weathericon        = W.weather[0].icon;
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine("Exception på WeatherModel: " + e);
                    }
                    try
                    {
                        GeoModel G = geoModel(t.position.x, t.position.y);

                        for (int i = 0; i < G.results.Count; i++)
                        {
                            System.Diagnostics.Debug.WriteLine("loop:" + i + G.results[0].address_components[i].types[0]);
                            if (G.results[0].address_components[i].types[0] == "administrative_area_level_1")
                            {
                                t.county = G.results[0].address_components[i].long_name;
                            }
                            else if (G.results[0].address_components[i].types[0] == "country")
                            {
                                t.country = G.results[0].address_components[i].long_name;
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        System.Diagnostics.Debug.WriteLine("Exception på GeoModel: " + e);
                    }
                }
                return(tourList);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e);
                ViewBag.message = e;
                return(null);
            }
        }