Exemplo n.º 1
0
        public void GetInfo(CelestialObjectInfo <Star> info)
        {
            Star        s       = info.Body;
            SkyContext  c       = info.Context;
            StarDetails details = c.Get(ReadStarDetails, s.Number);

            info
            .SetTitle(string.Join(", ", s.Names))
            .SetSubtitle(Text.Get("Star.Type"))

            .AddRow("Constellation", Constellations.FindConstellation(c.Get(Equatorial, s.Number), c.JulianDay))

            .AddHeader(Text.Get("Star.Equatorial"))
            .AddRow("Equatorial.Alpha", c.Get(Equatorial, s.Number).Alpha)
            .AddRow("Equatorial.Delta", c.Get(Equatorial, s.Number).Delta)

            .AddHeader(Text.Get("Star.Equatorial0"))
            .AddRow("Equatorial0.Alpha", s.Equatorial0.Alpha)
            .AddRow("Equatorial0.Delta", s.Equatorial0.Delta)

            .AddHeader(Text.Get("Star.Horizontal"))
            .AddRow("Horizontal.Azimuth")
            .AddRow("Horizontal.Altitude")

            .AddHeader(Text.Get("Star.RTS"))
            .AddRow("RTS.Rise")
            .AddRow("RTS.Transit")
            .AddRow("RTS.Set")
            .AddRow("RTS.Duration")

            .AddHeader(Text.Get("Star.Visibility"))
            .AddRow("Visibility.Begin")
            .AddRow("Visibility.End")
            .AddRow("Visibility.Duration")
            .AddRow("Visibility.Period")

            .AddHeader(Text.Get("Star.Properties"))
            .AddRow("Magnitude", s.Mag)
            .AddRow("IsInfraredSource", details.IsInfraredSource)
            .AddRow("SpectralClass", details.SpectralClass);

            if (!string.IsNullOrEmpty(details.Pecularity))
            {
                info.AddRow("Pecularity", details.Pecularity);
            }

            if (details.RadialVelocity != null)
            {
                info.AddRow("RadialVelocity", details.RadialVelocity + " km/s");
            }
        }
Exemplo n.º 2
0
        public StarDetails GetStarDetails(ushort hrNumber)
        {
            var details = new StarDetails();

            using (var sr = new StreamReader(STARS_FILE, Encoding.Default))
            {
                sr.BaseStream.Seek((hrNumber - 1) * RecordLength, SeekOrigin.Begin);
                string line = sr.ReadLine();

                details.IsInfraredSource = line[41] == 'I';
                details.SpectralClass    = line.Substring(127, 20).Trim();
                details.Pecularity       = line.Substring(147, 1).Trim();

                string radialVelocity = line.Substring(166, 4).Trim();

                details.RadialVelocity = string.IsNullOrEmpty(radialVelocity) ? (int?)null : int.Parse(radialVelocity);
            }

            return(details);
        }