public VoTableLayer()
        {
            table = null;
            filename = "";

            PlotType = PlotTypes.Circle;
        }
 public override void LoadData(string path)
 {
     filename  = path;
     table     = new VoTable(path);
     LngColumn = table.GetRAColumn().Index;
     LatColumn = table.GetDecColumn().Index;
 }
        private void VoRegistrySearch(string keyword)
        {
            try
            {
                lastKeyword = keyword;
                string filename = string.Format(@"{0}\NVOREG.XML", Path.GetTempPath());
                string url      = String.Format("http://nvo.stsci.edu//vor10/NVORegInt.asmx/VOTCapabilityPredicate?predicate=(title%20like%20'%25{0}%25'%20or%20shortname%20like%20'%25{0}%25')&capability={1}", keyword, coneSearch ? "ConeSearch" : "SIAP");


                if (!FileDownload.DownloadFile(url, filename, true))
                {
                    return;
                }

                if (!File.Exists(filename))
                {
                    return;
                }


                string      data = File.ReadAllText(filename);
                XmlDocument doc  = new XmlDocument();
                doc.LoadXml(data);
                registry = new VoTable(doc);

                LoadRegistryResults();
            }
            catch
            {
                fromRegistry.Checked = false;
                fromRegistry.Enabled = false;
                ResourceList.Items.Add(new ListViewItem(Language.GetLocalizedText(915, "Can't access NVO Registry at this time")));
            }
        }
 public VoTableLayer(VoTable table)
 {
     this.table = table;
     filename = table.LoadFilename;
     LngColumn = table.GetRAColumn().Index;
     LatColumn = table.GetDecColumn().Index;
     PlotType = PlotTypes.Circle;
 }
 public VoTableLayer(VoTable table)
 {
     this.table    = table;
     this.filename = table.LoadFilename;
     LngColumn     = table.GetRAColumn().Index;
     LatColumn     = table.GetDecColumn().Index;
     PlotType      = PlotTypes.Circle;
 }
Exemple #6
0
        public void DisplaySearchResults(VoTable table)
        {
            searchResults.Clear();
            int count = 0;

            foreach (VoRow row in table.Rows)
            {
                double ra  = Convert.ToDouble(row["RA"]) / 15;
                double dec = Convert.ToDouble(row["DEC"]);

                TourPlace pl = new TourPlace(row["id"].ToString(), dec, ra, Classification.Star, Constellations.Containment.FindConstellationForPoint(ra, dec), ImageSetType.Sky, -1);
                searchResults.Add(pl);
                if (count++ > 200)
                {
                    break;
                }
            }
            UpdateMarkers();
        }
 public override void LoadData(string path)
 {
     filename = path;
     table = new VoTable(path);
     LngColumn = table.GetRAColumn().Index;
     LatColumn = table.GetDecColumn().Index;
 }
        public static VoTableLayer AddVoTableLayer(VoTable table, string title)
        {
            VoTableLayer layer = new VoTableLayer(table);
            layer.Name = title;
            layer.Astronomical = true;
            layer.ReferenceFrame = "Sky";
            LayerList.Add(layer.ID, layer);
            AllMaps["Sky"].Layers.Add(layer);
            AllMaps["Sky"].Open = true;
            layer.Enabled = true;
            version++;
            LoadTree();

            return layer;
        }
        private void vOTableToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();
            openFile.Filter = "VOTable|*.xml";
            if (openFile.ShowDialog() == DialogResult.OK)
            {
                string filename = openFile.FileName;
                Cursor.Current = Cursors.WaitCursor;
                try
                {
                    VoTable voTable = new VoTable(filename);
                    VoTableLayer layer = LayerManager.AddVoTableLayer(voTable, Path.GetFileName(filename));

                    VOTableViewer viewer = new VOTableViewer();
                    viewer.Layer = layer;
                    viewer.Show();
                    ShowLayersWindows = true;
                }
                catch
                {
                    //todo localization
                    UiTools.ShowMessageBox(Language.GetLocalizedText(695, "Could Not Open VO Table File. Please ensure it is valid"));
                }
                Cursor.Current = Cursors.Default;
            }
        }
        public void RunVoSearch(string url, string ID)
        {
            string filename = Path.GetTempFileName();
            Cursor.Current = Cursors.WaitCursor;

            if (!FileDownload.DownloadFile(url, filename, true))
            {
                return;
            }

            try
            {
                VoTable voTable = new VoTable(filename);
                voTable.SampId = ID;
                if (!voTable.error)
                {
                    VOTableViewer viewer = new VOTableViewer();
                    VoTableLayer layer = LayerManager.AddVoTableLayer(voTable, "VO Table");

                    if (ID != null)
                    {
                        Samp.sampKnownTableIds.Add(ID, layer);

                    }
                    Samp.sampKnownTableUrls.Add(url, layer);
                    viewer.Layer = layer;
                    viewer.Show();
                    ShowLayersWindows = true;

                }
                else
                {
                    UiTools.ShowMessageBox(voTable.errorText);
                }
            }
            catch
            {
                WebWindow.OpenUrl(url, true);
            }
            Cursor.Current = Cursors.Default;
        }
 private void VOTableViewer_FormClosed(object sender, FormClosedEventArgs e)
 {
     layer.Viewer = null;
     layer = null;
     table = null;
 }
 public VoRow(VoTable owner)
 {
     Owner = owner;
 }
        public void DisplaySearchResults(VoTable table)
        {
            searchResults.Clear();
            var count = 0;
            foreach(var row in table.Rows)
            {
                var ra = Convert.ToDouble(row["RA"])/15;
                var dec = Convert.ToDouble(row["DEC"]);

                var pl = new TourPlace(row["id"].ToString(), dec, ra, Classification.Star, Constellations.Containment.FindConstellationForPoint(ra, dec), ImageSetType.Sky, -1);
                searchResults.Add( pl);
                if (count++ > 200)
                {
                    break;
                }
            }
            UpdateMarkers();
        }
Exemple #14
0
 public VoRow(VoTable owner)
 {
     Owner = owner;
 }
Exemple #15
0
 private void VOTableViewer_FormClosed(object sender, FormClosedEventArgs e)
 {
     layer.Viewer = null;
     layer        = null;
     table        = null;
 }
        private void VoRegistrySearch(string keyword)
        {
            try
            {
                lastKeyword = keyword;
                var filename = string.Format(@"{0}\NVOREG.XML", Path.GetTempPath());
                var url = String.Format("http://nvo.stsci.edu//vor10/NVORegInt.asmx/VOTCapabilityPredicate?predicate=(title%20like%20'%25{0}%25'%20or%20shortname%20like%20'%25{0}%25')&capability={1}", keyword, coneSearch ? "ConeSearch" : "SIAP");

                if (!FileDownload.DownloadFile(url, filename, true))
                {
                    return;
                }

                if (!File.Exists(filename))
                {
                    return;
                }

                var data = File.ReadAllText(filename);
                var doc = new XmlDocument();
                doc.LoadXml(data);
                registry = new VoTable(doc);

                LoadRegistryResults();
            }
            catch
            {
                fromRegistry.Checked = false;
                fromRegistry.Enabled = false;
                ResourceList.Items.Add(new ListViewItem(Language.GetLocalizedText(915, "Can't access NVO Registry at this time")));
            }
        }
        private void uSNONVOConeSearchToolStripMenuItem_Click(object sender, EventArgs e)
        {

            string url = String.Format("http://nedwww.ipac.caltech.edu/cgi-bin/nph-objsearch?search_type=Near+Position+Search&of=xml_main&RA={0}&DEC={1}&SR={2}", (contextMenuTargetObject.RA * 15).ToString(), contextMenuTargetObject.Dec.ToString(), fovAngle.ToString());
            WebClient client = new WebClient();

            try
            {
                string data = client.DownloadString(url);
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(data);
                VoTable voTable = new VoTable(doc);
   
                VoTableLayer layer = LayerManager.AddVoTableLayer(voTable, "VO Table");
                VOTableViewer viewer = new VOTableViewer();
                viewer.Layer = layer;

                viewer.Show();
                ShowLayersWindows = true;
            }
            catch
            {
                WebWindow.OpenUrl(url, true);
            }
  
        }