private void telescopeCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            Telescope scope = (Telescope)telescopeCombo.SelectedItem;

            focalLengthText.Text     = scope.FocalLength.ToString();
            focalRatioText.Text      = (Math.Floor(scope.FRatio * 100 + .5) / 100).ToString("0.00");
            apertureText.Text        = scope.Aperture.ToString();
            moutTypeText.Text        = scope.MountType;
            opticalDesignText.Text   = scope.OpticalDesign;
            manufacturerUrlLink.Text = scope.Url;
            Fov.Telescope            = (Telescope)telescopeCombo.SelectedItem;
            Properties.Settings.Default.FovTelescope = ((string)Fov.Telescope.Manufacturer + Fov.Telescope.Name).GetHashCode32();
        }
 void ComputePrimeFocusFov(Telescope scope, Imager chip)
 {
     double width  = (2 * Math.Atan(chip.Width / (2 * scope.FocalLength))) / RC;
     double height = (2 * Math.Atan(chip.Height / (2 * scope.FocalLength))) / RC;
 }
        static FieldOfView()
        {
            Telescopes = new List <Telescope>();
            Cameras    = new List <Camera>();

            if (!Directory.Exists(Properties.Settings.Default.CahceDirectory))
            {
                Directory.CreateDirectory(Properties.Settings.Default.CahceDirectory);
            }

            if (!Directory.Exists(Properties.Settings.Default.CahceDirectory + @"data"))
            {
                Directory.CreateDirectory(Properties.Settings.Default.CahceDirectory + @"data");
            }

            DataSetManager.DownloadFile("http://www.worldwidetelescope.org/wwtweb/catalog.aspx?X=instruments", Properties.Settings.Default.CahceDirectory + @"data\instruments.xml", false, true);
            XmlDocument doc = new XmlDocument();

            doc.Load(Properties.Settings.Default.CahceDirectory + @"data\instruments.xml");


            XmlNode root   = doc["root"];
            XmlNode scopes = root.SelectSingleNode("Telescopes");

            foreach (XmlNode child in scopes.ChildNodes)
            {
                Telescope scope = new Telescope(child.Attributes["Manufacturer"].Value, child.InnerText,
                                                Convert.ToDouble(child.Attributes["FocalLength"].Value.ToString()),
                                                Convert.ToDouble(child.Attributes["Aperture"].Value.ToString()),
                                                child.Attributes["ManufacturerUrl"].Value.ToString(),
                                                child.Attributes["MountType"].Value.ToString(),
                                                child.Attributes["OpticalDesign"].Value.ToString());
                Telescopes.Add(scope);
            }

            XmlNode cams = root.SelectSingleNode("Cameras");

            foreach (XmlNode child in cams.ChildNodes)
            {
                Camera camera = new Camera
                                (
                    child.Attributes["Manufacturer"].Value,
                    child.InnerText.Trim(),
                    child.Attributes["ManufacturersURL"].Value.ToString()
                                );
                foreach (XmlNode grandChild in child)
                {
                    if (grandChild.Name != "#text")
                    {
                        Imager imager = new Imager
                                        (
                            Convert.ToInt32(grandChild.Attributes["ID"].Value.ToString()),
                            grandChild.Attributes["Type"].Value.ToString(),
                            Convert.ToDouble(grandChild.Attributes["Width"].Value.ToString()),
                            Convert.ToDouble(grandChild.Attributes["Height"].Value.ToString()),
                            Convert.ToDouble(grandChild.Attributes["HorizontalPixels"].Value.ToString()),
                            Convert.ToDouble(grandChild.Attributes["VerticalPixels"].Value.ToString()),
                            Convert.ToDouble(grandChild.Attributes["CenterX"].Value.ToString()),
                            Convert.ToDouble(grandChild.Attributes["CenterY"].Value.ToString()),
                            Convert.ToDouble(grandChild.Attributes["Rotation"].Value.ToString()),
                            grandChild.Attributes["Filter"].Value.ToString());
                        camera.Chips.Add(imager);
                    }
                }
                Cameras.Add(camera);
            }
        }
        static FieldOfView()
        {
            Telescopes = new List<Telescope>();
            Cameras = new List<Camera>();

            if (!Directory.Exists(Properties.Settings.Default.CahceDirectory))
            {
                Directory.CreateDirectory(Properties.Settings.Default.CahceDirectory);
            }

            if (!Directory.Exists(Properties.Settings.Default.CahceDirectory+@"data"))
            {
                Directory.CreateDirectory(Properties.Settings.Default.CahceDirectory+@"data");
            }

            DataSetManager.DownloadFile("http://www.worldwidetelescope.org/wwtweb/catalog.aspx?X=instruments", Properties.Settings.Default.CahceDirectory + @"data\instruments.xml", false, true);
            var doc = new XmlDocument();
            doc.Load(Properties.Settings.Default.CahceDirectory + @"data\instruments.xml");

            XmlNode root = doc["root"];
            var scopes = root.SelectSingleNode("Telescopes");
            foreach (XmlNode child in scopes.ChildNodes)
            {
                var scope = new Telescope(child.Attributes["Manufacturer"].Value, child.InnerText,
                    Convert.ToDouble(child.Attributes["FocalLength"].Value),
                    Convert.ToDouble(child.Attributes["Aperture"].Value),
                    child.Attributes["ManufacturerUrl"].Value,
                    child.Attributes["MountType"].Value,
                    child.Attributes["OpticalDesign"].Value);
                Telescopes.Add(scope);
            }

            var cams = root.SelectSingleNode("Cameras");
            foreach (XmlNode child in cams.ChildNodes)
            {
                var camera = new Camera
                    (
                    child.Attributes["Manufacturer"].Value,
                    child.InnerText.Trim(),
                    child.Attributes["ManufacturersURL"].Value
                    );
                foreach (XmlNode grandChild in child)
                {
                    if (grandChild.Name != "#text")
                    {
                        var imager = new Imager
                            (
                                Convert.ToInt32(grandChild.Attributes["ID"].Value),
                                grandChild.Attributes["Type"].Value,
                                Convert.ToDouble(grandChild.Attributes["Width"].Value),
                                Convert.ToDouble(grandChild.Attributes["Height"].Value),
                                Convert.ToDouble(grandChild.Attributes["HorizontalPixels"].Value),
                                Convert.ToDouble(grandChild.Attributes["VerticalPixels"].Value),
                                Convert.ToDouble(grandChild.Attributes["CenterX"].Value),
                                Convert.ToDouble(grandChild.Attributes["CenterY"].Value),
                                Convert.ToDouble(grandChild.Attributes["Rotation"].Value),
                                grandChild.Attributes["Filter"].Value);
                        camera.Chips.Add(imager);
                    }
                }
                Cameras.Add(camera);
            }
        }
 void ComputePrimeFocusFov(Telescope scope, Imager chip)
 {
     var width = (2 * Math.Atan(chip.Width / (2 * scope.FocalLength))) / RC;
     var height = (2 * Math.Atan(chip.Height / (2 * scope.FocalLength))) / RC;
 }
 public FieldOfView()
 {
     Telescope = null;
     Camera = null;
 }
 public FieldOfView(int telescope, int camera, int eyepiece)
 {
     Telescope = GetTelescope(telescope);
     Camera = GetCamera(camera);
 }
 public FieldOfView()
 {
     this.Telescope = null;
     this.Camera = null;
 }