Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public FieldOfView(int telescope, int camera, int eyepiece)
 {
     Telescope = GetTelescope(telescope);
     Camera = GetCamera(camera);
 }
Exemplo n.º 3
0
 public FieldOfView()
 {
     Telescope = null;
     Camera = null;
 }
Exemplo n.º 4
0
 public FieldOfView()
 {
     this.Telescope = null;
     this.Camera = null;
 }