示例#1
0
        public void Ecliptical()
        {
            var ecl = SolarEphem.Ecliptical(2448908.5);

            Assert.AreEqual(new DMS("199* 54' 32.19''"), new DMS(ecl.Lambda));
            Assert.AreEqual(0.99766, ecl.Distance, 1e-5);
        }
示例#2
0
        /// <summary>
        /// Creates new instance of <see cref="LocationVM"/>
        /// </summary>
        public LocationVM(ISky sky, ISettings settings)
        {
            CrdsEquatorial eqSun = SolarEphem.Ecliptical(sky.Context.JulianDay).ToEquatorial(sky.Context.Epsilon);

            ObserverLocation = new CrdsGeographical(sky.Context.GeoLocation);
            SunHourAngle     = Coordinates.HourAngle(sky.Context.SiderealTime, 0, eqSun.Alpha);
            SunDeclination   = eqSun.Delta;
            IsNightMode      = settings.Get <ColorSchema>("Schema") == ColorSchema.Red;

            OkCommand             = new Command(Ok);
            CancelCommand         = new Command(Close);
            EndSearchModeCommand  = new Command(EndSearchMode);
            SelectLocationCommand = new Command(SelectLocation);

            string line;
            string filePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Data", "TimeZones.dat");

            using (StreamReader file = new StreamReader(filePath))
            {
                while ((line = file.ReadLine()) != null)
                {
                    // skip first and empty lines
                    if (line.StartsWith("CountryCode") ||
                        string.IsNullOrWhiteSpace(line))
                    {
                        continue;
                    }

                    string[] chunks = line.Split('\t');
                    TimeZones.Add(new TimeZoneItem()
                    {
                        TimeZoneId = chunks[1], UtcOffset = double.Parse(chunks[4], CultureInfo.InvariantCulture)
                    });
                }
                file.Close();
            }
        }