void showViewer_Click(object sender, EventArgs e)
        {
            if (layerTree.SelectedNode.Tag is VoTableLayer)
            {
                VoTableLayer layer = layerTree.SelectedNode.Tag as VoTableLayer;

                if (layer.Viewer != null)
                {
                    layer.Viewer.Show();
                }
                else
                {
                    VOTableViewer viewer = new VOTableViewer();
                    viewer.Layer = layer;
                    viewer.Show();
                }
            }
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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;
            }
        }
Ejemplo n.º 4
0
        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);
            }
  
        }