Ejemplo n.º 1
0
        static private void WriteMagnitudes(Exoplanet exoplanet)
        {
            Writer.WriteStartElement("Magnitudes");

            if (IsDefined(exoplanet.Star.Magnitude.V))
            {
                Writer.WriteAttributeString("V", exoplanet.Star.Magnitude.V);
            }

            if (IsDefined(exoplanet.Star.Magnitude.I))
            {
                Writer.WriteAttributeString("I", exoplanet.Star.Magnitude.I);
            }

            if (IsDefined(exoplanet.Star.Magnitude.J))
            {
                Writer.WriteAttributeString("J", exoplanet.Star.Magnitude.J);
            }

            if (IsDefined(exoplanet.Star.Magnitude.H))
            {
                Writer.WriteAttributeString("H", exoplanet.Star.Magnitude.H);
            }

            if (IsDefined(exoplanet.Star.Magnitude.K))
            {
                Writer.WriteAttributeString("K", exoplanet.Star.Magnitude.K);
            }

            Writer.WriteEndElement();
        }
Ejemplo n.º 2
0
        static void ReadStar(Exoplanet exoplanet)
        {
            Reader.ReadToFollowing("Star");

            while (Reader.MoveToNextAttribute())
            {
                switch (Reader.Name)
                {
                case "Name":
                    exoplanet.Star.Name = Reader.Value;
                    break;

                case "RightAccession":
                    exoplanet.Star.RightAccession = Reader.Value;
                    break;

                case "Declination":
                    exoplanet.Star.Declination = Reader.Value;
                    break;

                case "AlternateNames":
                    exoplanet.Star.AlternateNames = Reader.Value;
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        static void ReadMagnitudes(Exoplanet exoplanet)
        {
            Reader.ReadToFollowing("Magnitudes");

            while (Reader.MoveToNextAttribute())
            {
                switch (Reader.Name)
                {
                case "V":
                    exoplanet.Star.Magnitude.V = Reader.Value;
                    break;

                case "I":
                    exoplanet.Star.Magnitude.I = Reader.Value;
                    break;

                case "J":
                    exoplanet.Star.Magnitude.J = Reader.Value;
                    break;

                case "H":
                    exoplanet.Star.Magnitude.H = Reader.Value;
                    break;

                case "K":
                    exoplanet.Star.Magnitude.K = Reader.Value;
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        static void ReadTconj(Exoplanet exoplanet)
        {
            if (string.Equals(Version, Constant.Version1))
            {
                exoplanet.Tconj         = string.Empty;
                exoplanet.TconjErrorMin = string.Empty;
                exoplanet.TconjErrorMax = string.Empty;
            }
            else
            {
                Reader.ReadToFollowing("Tconj");

                while (Reader.MoveToNextAttribute())
                {
                    switch (Reader.Name)
                    {
                    case "value":
                        exoplanet.Tconj = Reader.Value;
                        break;

                    case "errorMin":
                        exoplanet.TconjErrorMin = Reader.Value;
                        break;

                    case "errorMax":
                        exoplanet.TconjErrorMax = Reader.Value;
                        break;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        static private int WriteExoplanet(XmlWriter writer, string line)
        {
            //
            // kludge: .csv's can contain commas and / or tabs within in the data, these may occur in literals that are in double quotes
            //

            if (IsCommaDelimited == true)
            {
                line = line.Replace('\t', ' ');
                line = Helper.ReplaceInQuotedDelimitor(line);
            }
            else
            {
                line = line.Replace(',', ';');
                line = Helper.ReplaceInQuotedDelimitor(line);
            }

            char []   delimiterChars = { ',', '\t' };
            string [] strings        = line.Split(delimiterChars);

            if (NumberOfStrings == strings.Length)
            {
                Exoplanet exoplanet = new Exoplanet();

                exoplanet.AssignFromSubstrings(strings);
                exoplanet.CorrectErrors();
                WriteXML.WriteExoplanet(writer, exoplanet, Version);
            }
            else
            {
                ReadErrors += line + "\r";
            }

            return(0);
        }
Ejemplo n.º 6
0
        static void ReadExoplanet(Exoplanet exoplanet)
        {
            Reader.ReadToFollowing("Exoplanet");

            Reader.MoveToFirstAttribute();
            exoplanet.Name = Reader.Value.Trim();
        }
        static private bool IsComputable(Exoplanet exoplanet)
        {
            if (exoplanet != null)
            {
                if (exoplanet.Star != null)
                {
                    if (Helper.IsDefined(exoplanet.Star.Property.SPType))
                    {
                        string spectral = exoplanet.Star.Property.SPType.Substring(0, 1);

                        if (spectral == "B" || spectral == "A" || spectral == "F" || spectral == "G" || spectral == "K" || spectral == "M")
                        {
                            if (Helper.IsDefined(exoplanet.Star.Magnitude.V))
                            {
                                if (Helper.IsDefined(exoplanet.Star.Property.Distance))
                                {
                                    if (Helper.IsDefined(exoplanet.SemiMajorAxis))
                                    {
                                        return(true);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 8
0
        static private int WriteExoplanet(XmlWriter writer, string line)
        {
            string [] strings = new string [NumberOfStrings];

            for (int index = 0; index < Pipes.Length - 1; ++index)
            {
                string stringer = line.Substring(Pipes [index] + 1, Pipes [index + 1] - Pipes [index]);
                stringer        = stringer.Replace("null", string.Empty);
                strings [index] = stringer.Trim();
            }

            if (NumberOfStrings == strings.Length)
            {
                Exoplanet exoplanet = new Exoplanet();

                exoplanet.AssignFromSubstrings(strings);
                exoplanet.CorrectErrors();
                WriteXML.WriteExoplanet(writer, exoplanet, Version);
            }
            else
            {
                ReadErrors += line + "\r";
            }

            return(0);
        }
        private void ExoplanetListView_Click(object sender, EventArgs e)
        {
            if (ExoplanetListView.SelectedItems.Count == 1)
            {
                Exoplanet exoplanet = ( Exoplanet )ExoplanetListView.SelectedItems [0].Tag;

                displayAllDetails(exoplanet);
                Focus();
            }
        }
Ejemplo n.º 10
0
        static private void WriteAngularDistance(Exoplanet exoplanet)
        {
            Writer.WriteStartElement("AngularDistance");

            if (IsDefined(exoplanet.AngularDistance))
            {
                Writer.WriteAttributeString("value", exoplanet.AngularDistance);
            }

            Writer.WriteEndElement();
        }
        private void displayAllDetails(Exoplanet exoplanet)
        {
            if (ExoplanetDetails == null)
            {
                ExoplanetDetails = new ExoplanetDetails(this);
            }

            ExoplanetDetails.DisplayDetails(exoplanet);
            ExoplanetDetails.Show();
            ExoplanetDetails.BringToFront();
        }
Ejemplo n.º 12
0
        static private void WriteUpdated(Exoplanet exoplanet)
        {
            Writer.WriteStartElement("Updated");

            if (IsDefined(exoplanet.Updated))
            {
                Writer.WriteAttributeString("value", exoplanet.Updated);
            }

            Writer.WriteEndElement();
        }
Ejemplo n.º 13
0
        static private void WriteLogG(Exoplanet exoplanet)
        {
            Writer.WriteStartElement("LogG");

            if (IsDefined(exoplanet.LogG))
            {
                Writer.WriteAttributeString("value", exoplanet.LogG);
            }

            Writer.WriteEndElement();
        }
Ejemplo n.º 14
0
        static private void WriteMolecules(Exoplanet exoplanet)
        {
            Writer.WriteStartElement("Molecules");

            if (IsDefined(exoplanet.Molecules))
            {
                Writer.WriteAttributeString("value", exoplanet.Molecules);
            }

            Writer.WriteEndElement();
        }
Ejemplo n.º 15
0
        static public int WriteExoplanet(XmlWriter writer, Exoplanet exoplanet, string version)
        {
            Writer  = writer;
            Version = version;

            exoplanet.CorrectErrors();

            WriteExoplanet(exoplanet);

            return(0);
        }
Ejemplo n.º 16
0
        static private void WritePublicationStatus(Exoplanet exoplanet)
        {
            Writer.WriteStartElement("PublicationStatus");

            if (IsDefined(exoplanet.Status))
            {
                Writer.WriteAttributeString("value", exoplanet.Status);
            }

            Writer.WriteEndElement();
        }
Ejemplo n.º 17
0
        static private void WriteDetectionType(Exoplanet exoplanet)
        {
            Writer.WriteStartElement("DetectionType");

            if (IsDefined(exoplanet.DetectionType))
            {
                Writer.WriteAttributeString("value", exoplanet.DetectionType);
            }

            Writer.WriteEndElement();
        }
        static private double ComputeAbsoluteLuminosity(Exoplanet exoplanet)
        {
            double mv       = double.Parse(exoplanet.Star.Magnitude.V);
            double distance = double.Parse(exoplanet.Star.Property.Distance);

            double Mv = mv - 5.0 * Math.Log(distance / 10.0);

            double Mbol = Mv + Correction(exoplanet);

            double absLuminosity = Math.Pow(10.0, (Mbol - 4.72) / -2.5);

            return(absLuminosity);
        }
Ejemplo n.º 19
0
 static void ReadRadiusDetectionType(Exoplanet exoplanet)
 {
     if (string.Equals(Version, Constant.Version1))
     {
         exoplanet.RadiusDetectionType = string.Empty;
     }
     else
     {
         Reader.ReadToFollowing("RadiusDetectionType");
         Reader.MoveToFirstAttribute();
         exoplanet.RadiusDetectionType = Reader.Value;
     }
 }
Ejemplo n.º 20
0
        private bool Parse(Exoplanet exoplanet, PlotTypes plotType, out double value)
        {
            bool isValid = false;

            value = 0.0;

            switch (plotType)
            {
            case PlotTypes.Mass:
                isValid = double.TryParse(exoplanet.Mass, out value);
                break;

            case PlotTypes.Radius:
                isValid = double.TryParse(exoplanet.Radius, out value);
                break;

            case PlotTypes.OrbitalPeriod:
                isValid = double.TryParse(exoplanet.OrbitalPeriod, out value);
                break;

            case PlotTypes.SemiMajorAxis:
                isValid = double.TryParse(exoplanet.SemiMajorAxis, out value);
                break;

            case PlotTypes.Eccentricity:
                isValid = double.TryParse(exoplanet.Eccentricity, out value);
                break;

            case PlotTypes.AngularDistance:
                isValid = double.TryParse(exoplanet.AngularDistance, out value);
                break;

            case PlotTypes.Inclination:
                isValid = double.TryParse(exoplanet.Inclination, out value);
                break;

            case PlotTypes.TemperatureCalculated:
                isValid = double.TryParse(exoplanet.TemperatureCalculated, out value);
                break;

            case PlotTypes.Omega:
                isValid = double.TryParse(exoplanet.Omega, out value);
                break;

            case PlotTypes.VelocitySemiamplitude:
                isValid = double.TryParse(exoplanet.VelocitySemiamplitude, out value);
                break;
            }

            return(isValid);
        }
Ejemplo n.º 21
0
        static private void WriteAlternateNames(Exoplanet exoplanet)
        {
            if (string.Equals(Version, Constant.Version2) || string.Equals(Version, Constant.Version3))
            {
                Writer.WriteStartElement("AlternateNames");

                if (IsDefined(exoplanet.AlternateNames))
                {
                    Writer.WriteAttributeString("value", exoplanet.AlternateNames);
                }

                Writer.WriteEndElement();
            }
        }
Ejemplo n.º 22
0
        static private void WriteRadiusDetectionType(Exoplanet exoplanet)
        {
            if (string.Equals(Version, Constant.Version2) || string.Equals(Version, Constant.Version3))
            {
                Writer.WriteStartElement("RadiusDetectionType");

                if (IsDefined(exoplanet.RadiusDetectionType))
                {
                    Writer.WriteAttributeString("value", exoplanet.RadiusDetectionType);
                }

                Writer.WriteEndElement();
            }
        }
Ejemplo n.º 23
0
        static public int Write(TextWriter textWriter, Exoplanet exoplanet)
        {
            if (string.Equals(Version, Constant.Version1))
            {
                return(WriteVersion1(textWriter, exoplanet));
            }
            else if (string.Equals(Version, Constant.Version2))
            {
                return(WriteVersion2(textWriter, exoplanet));
            }
            else if (string.Equals(Version, Constant.Version3))
            {
                return(WriteVersion3(textWriter, exoplanet));
            }

            return(0);
        }
Ejemplo n.º 24
0
        static private void WriteStar(Exoplanet exoplanet)
        {
            Writer.WriteStartElement("Star");

            Writer.WriteAttributeString("Name", exoplanet.Star.Name);
            Writer.WriteAttributeString("RightAccession", exoplanet.Star.RightAccession);
            Writer.WriteAttributeString("Declination", exoplanet.Star.Declination);

            if (string.Equals(Version, Constant.Version3))
            {
                Writer.WriteAttributeString("AlternateNames", exoplanet.Star.AlternateNames);
            }

            WriteMagnitudes(exoplanet);
            WriteProperties(exoplanet);

            Writer.WriteEndElement();
        }
        static private double Correction(Exoplanet exoplanet)
        {
            switch (exoplanet.Star.Property.SPType.Substring(0, 1))
            {
            case "B": return(-2.0);

            case "A": return(-0.3);

            case "F": return(-0.15);

            case "G": return(-0.4);

            case "K": return(-0.8);

            case "M": return(-2.0);

            default: return(0.0);
            }
        }
        void ExoplanetListView_Key(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Down:
            case Keys.Up:
            case Keys.PageDown:
            case Keys.PageUp:
            case Keys.Home:
            case Keys.End:
                if (ExoplanetListView.SelectedItems.Count == 1)
                {
                    Exoplanet exoplanet = ( Exoplanet )ExoplanetListView.SelectedItems [0].Tag;

                    displayAllDetails(exoplanet);
                    Focus();
                }
                break;
            }
        }
Ejemplo n.º 27
0
        static private void WriteTemperatures(Exoplanet exoplanet)
        {
            Writer.WriteStartElement("Temperatures");

            if (IsDefined(exoplanet.TemperatureCalculated))
            {
                Writer.WriteAttributeString("Calculated", exoplanet.TemperatureCalculated);
            }

            if (IsDefined(exoplanet.TemperatureMeasured))
            {
                Writer.WriteAttributeString("Measured", exoplanet.TemperatureMeasured);
            }

            if (IsDefined(exoplanet.TemperatureHotPointLo))
            {
                Writer.WriteAttributeString("HotPointLon", exoplanet.TemperatureHotPointLo);
            }

            Writer.WriteEndElement();
        }
Ejemplo n.º 28
0
        static private void WriteOmega(Exoplanet exoplanet)
        {
            Writer.WriteStartElement("Omega");

            if (IsDefined(exoplanet.Omega))
            {
                Writer.WriteAttributeString("value", exoplanet.Omega);
            }

            if (IsDefined(exoplanet.OmegaErrorMin))
            {
                Writer.WriteAttributeString("errorMin", exoplanet.OmegaErrorMin);
            }

            if (IsDefined(exoplanet.OmegaErrorMax))
            {
                Writer.WriteAttributeString("errorMax", exoplanet.OmegaErrorMax);
            }

            Writer.WriteEndElement();
        }
Ejemplo n.º 29
0
        static private void WriteLambdaAngle(Exoplanet exoplanet)
        {
            Writer.WriteStartElement("LambdaAngle");

            if (IsDefined(exoplanet.LambdaAngle))
            {
                Writer.WriteAttributeString("value", exoplanet.LambdaAngle);
            }

            if (IsDefined(exoplanet.LambdaAngleErrorMin))
            {
                Writer.WriteAttributeString("errorMin", exoplanet.LambdaAngleErrorMin);
            }

            if (IsDefined(exoplanet.LambdaAngleErrorMax))
            {
                Writer.WriteAttributeString("errorMax", exoplanet.LambdaAngleErrorMax);
            }

            Writer.WriteEndElement();
        }
Ejemplo n.º 30
0
        static private void WriteTperi(Exoplanet exoplanet)
        {
            Writer.WriteStartElement("Tperi");

            if (IsDefined(exoplanet.Tperi))
            {
                Writer.WriteAttributeString("value", exoplanet.Tperi);
            }

            if (IsDefined(exoplanet.TperiErrorMin))
            {
                Writer.WriteAttributeString("errorMin", exoplanet.TperiErrorMin);
            }

            if (IsDefined(exoplanet.TperiErrorMax))
            {
                Writer.WriteAttributeString("errorMax", exoplanet.TperiErrorMax);
            }

            Writer.WriteEndElement();
        }