Esempio n. 1
0
        private void listView1_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedIndices.Count > 0)
            {
                try
                {
                    VoRow  row = table.Rows[listView1.SelectedIndices[0]];
                    double ra  = Coordinates.ParseRA(row[raSource.SelectedIndex - 1].ToString(), true);
                    double dec = Coordinates.ParseDec(row[decSource.SelectedIndex - 1].ToString().ToString());
                    string id;

                    VoColumn col = table.GetColumnByUcd("meta.id");
                    if (col != null)
                    {
                        id = row[col.Name].ToString();
                    }
                    else
                    {
                        id = row[0].ToString();
                    }

                    TourPlace pl = new TourPlace(id, dec, ra, Classification.Star, Constellations.Containment.FindConstellationForPoint(ra, dec), ImageSetType.Sky, -1);
                    Earth3d.MainWindow.GotoTarget(pl, false, false, false);
                }
                catch
                {
                }
            }
        }
Esempio n. 2
0
        private void listView1_ItemMouseHover(object sender, ListViewItemMouseHoverEventArgs e)
        {
            if (listView1.SelectedIndices.Count > 0)
            {
                listView1.FullRowSelect = true;
                try
                {
                    VoRow row = table.Rows[e.Item.Index];

                    // double ra = Convert.ToDouble(row[GetRAColumn().Name]) / 15;
                    // double dec = Convert.ToDouble(row[GetDecColumn().Name]);
                    double ra  = Coordinates.ParseRA(row[raSource.SelectedIndex - 1].ToString(), true);
                    double dec = Coordinates.ParseDec(row[decSource.SelectedIndex - 1].ToString());
                    string id;

                    VoColumn col = table.GetColumnByUcd("meta.id");
                    if (col != null)
                    {
                        id = row[col.Name].ToString();
                    }
                    else
                    {
                        id = row[0].ToString();
                    }

                    TourPlace pl = new TourPlace(id, dec, ra, Classification.Star, Constellations.Containment.FindConstellationForPoint(ra, dec), ImageSetType.Sky, -1);
                    Earth3d.MainWindow.SetLabelText(pl, true);
                }
                catch
                {
                }
            }
        }
Esempio n. 3
0
        private void LoadColumnsForCombos()
        {
            this.markerTypeCombo.SelectedIndex = (int)layer.PlotType;

            // bool star =  plotType.SelectedItem == "Star";
            VoColumn raColSelect   = layer.LngColumn > -1 ? table.Column[layer.LngColumn] : null;
            VoColumn decColSelect  = layer.LatColumn > -1 ? table.Column[layer.LatColumn] : null;
            VoColumn distColSelect = layer.AltColumn > -1 ? table.Column[layer.AltColumn] : null;
            VoColumn typeColSelect = layer.MarkerColumn > -1 ? table.Column[layer.MarkerColumn] : null;
            VoColumn sizeColSelect = layer.SizeColumn > -1 ? table.Column[layer.SizeColumn] : null;

            raSource.Items.Clear();
            decSource.Items.Clear();
            distanceSource.Items.Clear();
            typeSource.Items.Clear();
            sizeSource.Items.Clear();

            raSource.Items.Add("None");
            decSource.Items.Add("None");
            distanceSource.Items.Add("None");
            typeSource.Items.Add("None");
            sizeSource.Items.Add("None");

            int index = 0;

            foreach (VoColumn col in table.Columns.Values)
            {
                index = raSource.Items.Add(col);
                if (col == raColSelect)
                {
                    raSource.SelectedIndex = index;
                }

                index = decSource.Items.Add(col);

                if (col == decColSelect)
                {
                    decSource.SelectedIndex = index;
                }
                index = distanceSource.Items.Add(col);

                if (col == distColSelect)
                {
                    distanceSource.SelectedIndex = index;
                }
                index = typeSource.Items.Add(col);

                if (col == typeColSelect)
                {
                    typeSource.SelectedIndex = index;
                }

                index = sizeSource.Items.Add(col);
                if (col == sizeColSelect)
                {
                    sizeSource.SelectedIndex = index;
                }
            }
        }
Esempio n. 4
0
        public void LoadFromXML(XmlDocument xml)
        {
            XmlNode voTable = xml["VOTABLE"];

            if (voTable == null)
            {
                return;
            }
            int index = 0;

            try
            {
                XmlNode table = voTable["RESOURCE"]["TABLE"];
                if (table != null)
                {
                    foreach (XmlNode node in table.ChildNodes)
                    {
                        if (node.Name == "FIELD")
                        {
                            VoColumn col = new VoColumn(node, index++);
                            Columns.Add(col.Name, col);
                            Column.Add(col);
                        }
                    }
                }
            }
            catch
            {
                error     = true;
                errorText = voTable["DESCRIPTION"].InnerText.ToString();
            }
            try
            {
                XmlNode tableData = voTable["RESOURCE"]["TABLE"]["DATA"]["TABLEDATA"];
                if (tableData != null)
                {
                    foreach (XmlNode node in tableData.ChildNodes)
                    {
                        if (node.Name == "TR")
                        {
                            VoRow row = new VoRow(this);
                            row.ColumnData = new object[Columns.Count];
                            index          = 0;
                            foreach (XmlNode child in node.ChildNodes)
                            {
                                row.ColumnData[index++] = child.InnerText.Trim();
                            }
                            Rows.Add(row);
                        }
                    }
                }
            }
            catch
            {
            }
        }
Esempio n. 5
0
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listView1.SelectedIndices.Count > 0)
            {
                listView1.FullRowSelect = true;
                try
                {
                    VoRow row = table.Rows[listView1.SelectedIndices[0]];

                    table.SelectedRow = row;
                    layer.CleanUp();
                    double ra  = Coordinates.ParseRA(row[raSource.SelectedIndex - 1].ToString(), true);
                    double dec = Coordinates.ParseDec(row[decSource.SelectedIndex - 1].ToString());
                    string id;

                    VoColumn col = table.GetColumnByUcd("meta.id");
                    if (col != null)
                    {
                        id = row[col.Name].ToString();
                    }
                    else
                    {
                        id = row[0].ToString();
                    }

                    TourPlace pl = new TourPlace(id, dec, ra, Classification.Star, Constellations.Containment.FindConstellationForPoint(ra, dec), ImageSetType.Sky, -1);
                    Earth3d.MainWindow.SetLabelText(pl, true);

                    if (table.SampId != null)
                    {
                        Earth3d.MainWindow.sampConnection.TableHighlightRow("", table.SampId, listView1.SelectedIndices[0]);
                    }
                }
                catch
                {
                }
            }
        }
Esempio n. 6
0
        private void listView1_ColumnClick(object sender, ColumnClickEventArgs e)
        {
            VoColumn col = table.Columns[listView1.Columns[e.Column].Text];

            UiTools.ShowMessageBox("Name = " + col.Name + "; ucd=" + col.Ucd + "; type=" + col.Type.ToString());
        }
Esempio n. 7
0
        public void LoadFromXML(XmlDocument xml)
        {
            XmlNode voTable = xml["VOTABLE"];

            if (voTable == null)
            {
                return;
            }
            var index = 0;
            try
            {
                XmlNode table = voTable["RESOURCE"]["TABLE"];
                if (table != null)
                {
                    foreach (XmlNode node in table.ChildNodes)
                    {
                        if (node.Name == "FIELD")
                        {
                            var col = new VoColumn(node, index++);
                            Columns.Add(col.Name, col);
                            Column.Add(col);
                        }
                    }
                }
            }
            catch
            {
                error = true;
                errorText = voTable["DESCRIPTION"].InnerText;
            }
            try
            {
                XmlNode tableData = voTable["RESOURCE"]["TABLE"]["DATA"]["TABLEDATA"];
                if (tableData != null)
                {
                    foreach (XmlNode node in tableData.ChildNodes)
                    {
                        if (node.Name == "TR")
                        {
                            var row = new VoRow(this);
                            row.ColumnData = new object[Columns.Count];
                            index = 0;
                            foreach (XmlNode child in node.ChildNodes)
                            {
                                row.ColumnData[index++] = child.InnerText.Trim();
                            }
                            Rows.Add(row);
                        }
                    }
                }
            }
            catch
            {
            }
        }
Esempio n. 8
0
        protected override bool PrepVertexBuffer(float opacity)
        {
            VoColumn col = table.GetColumnByUcd("meta.id");

            if (col == null)
            {
                col = table.Column[0];
            }

            if (shapeFileVertex == null)
            {
                bool siapSet = IsSiapResultSet();

                if (lineList2d == null)
                {
                    lineList2d = new LineList();
                }
                lineList2d.Clear();

                VoColumn stcsCol = table.GetColumnByUcd("phys.area;obs.field");

                if (stcsCol == null && table.Columns.ContainsKey("regionSTCS"))
                {
                    stcsCol = table.Columns["regionSTCS"];
                }

                if (PlotType == PlotTypes.Gaussian)
                {
                    MarkerScale = MarkerScales.World;
                }
                else
                {
                    MarkerScale = MarkerScales.Screen;
                }

                List <TimeSeriesPointVertex> vertList = new List <TimeSeriesPointVertex>();
                List <UInt32>         indexList       = new List <UInt32>();
                TimeSeriesPointVertex lastItem        = new TimeSeriesPointVertex();
                positions.Clear();
                UInt32 currentIndex = 0;
                Color  color        = Color.FromArgb((int)(opacity * (float)Color.A), Color);

                pointScaleType = PointScaleTypes.StellarMagnitude;

                foreach (VoRow row in table.Rows)
                {
                    try
                    {
                        if (lngColumn > -1 && latColumn > -1)
                        {
                            double Xcoord = Coordinates.ParseRA(row[this.LngColumn].ToString(), true) * 15 + 180;
                            double Ycoord = Coordinates.ParseDec(row[this.LatColumn].ToString());
                            lastItem.Position = Coordinates.GeoTo3dDouble(Ycoord, Xcoord).Vector311;
                            positions.Add(lastItem.Position);
                            lastItem.Color = color;
                            if (sizeColumn > -1)
                            {
                                try
                                {
                                    if (MarkerScale == MarkerScales.Screen)
                                    {
                                        lastItem.PointSize = 20f;
                                    }
                                    else
                                    {
                                        switch (pointScaleType)
                                        {
                                        case PointScaleTypes.Linear:
                                            lastItem.PointSize = Convert.ToSingle(row[sizeColumn]);
                                            break;

                                        case PointScaleTypes.Log:
                                            lastItem.PointSize = (float)Math.Log(Convert.ToSingle(row[sizeColumn]));
                                            break;

                                        case PointScaleTypes.Power:
                                            lastItem.PointSize = (float)Math.Pow(2, Convert.ToSingle(row[sizeColumn]));
                                            break;

                                        case PointScaleTypes.StellarMagnitude:
                                        {
                                            double size = Convert.ToSingle(row[sizeColumn]);
                                            lastItem.PointSize = (float)(40 / Math.Pow(1.6, size)) * 10;
                                        }
                                        break;

                                        case PointScaleTypes.Constant:
                                            lastItem.PointSize = 1;
                                            break;

                                        default:
                                            break;
                                        }
                                    }
                                }
                                catch
                                {
                                    lastItem.PointSize = .01f;
                                }
                            }
                            else
                            {
                                if (MarkerScale == MarkerScales.Screen)
                                {
                                    lastItem.PointSize = 20;
                                }
                                else
                                {
                                    lastItem.PointSize = (float)Math.Pow(2, 1) * 100;
                                }
                            }


                            if (startDateColumn > -1)
                            {
                                DateTime dateTime = DateTime.Parse(row[startDateColumn].ToString());
                                lastItem.Tu = (float)SpaceTimeController.UtcToJulian(dateTime);
                                lastItem.Tv = 0;
                            }


                            vertList.Add(lastItem);
                            currentIndex++;
                        }


                        if (siapSet && stcsCol != null)
                        {
                            AddSiapStcRow(stcsCol.Name, row, row == table.SelectedRow);
                        }
                    }

                    catch
                    {
                    }
                    lines = false;
                }

                if (siapSet && stcsCol != null)
                {
                    AddSiapStcRow(stcsCol.Name, table.SelectedRow, true);
                }


                shapeVertexCount = vertList.Count;
                if (shapeVertexCount == 0)
                {
                    shapeVertexCount = 1;
                }
                shapeFileVertex = new TimeSeriesPointSpriteSet(RenderContext11.PrepDevice, vertList.ToArray());
            }
            return(true);
        }