예제 #1
0
        private static void MarsTest2(PlanetId id)
        {
            Rectascension destination = new Rectascension(346.7);

            DateTimeOffset since = new DateTimeOffset(1951, 3, 14, 1, 1, 0, TimeSpan.Zero);

            for (int i = 0; i < 10; i++)
            {
                destination = new Rectascension(destination.Degrees + i * 330);
                DateTimeOffset date = Ephemeris.DateOfPlanetPosition(id, since, destination);

                double   jul_ut = Utilities.ToJulianDay(date);
                Position actual = Utilities.GeocentricPositionOfJulian(jul_ut, id);
                double   dif    = actual.Longitude - destination.Degrees;

                Console.WriteLine("{0}: {1} on {2}, dif = {3:F4}", date, id, actual.ToString("Astro0", null), dif);
                since = date + TimeSpan.FromDays(60);
            }
        }
예제 #2
0
        /// <summary>
        /// Highlight the interiorPos position of selected planets or averages.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (currentIndicators.Count != 0)
            {
                foreach (GraphObj obj in currentIndicators)
                {
                    zedLongTerm.GraphPane.GraphObjList.Remove(obj);
                }
                currentIndicators.Clear();
            }

            #region Draw the line to highlight interiorPos planet positions
            DateTimeOffset now        = DateTimeOffset.UtcNow;
            string         timeString = DateTimeOffset.Now.ToString("MM-dd HH:mm");

            now = new DateTimeOffset(now.Year, now.Month, now.Day, now.Hour, now.Minute, 0, TimeSpan.Zero);

            double x = now.DateTime.ToOADate();

            LineObj nowIndicator = new LineObj(x, zedLongTerm.GraphPane.YAxis.Scale.Min - 10, x, zedLongTerm.GraphPane.YAxis.Scale.Max + 10);
            nowIndicator.Line.Style = System.Drawing.Drawing2D.DashStyle.Dash;
            nowIndicator.Line.Color = Color.Gray;
            currentIndicators.Add(nowIndicator);

            #region With the lable of local time under the line

            TextObj timeIndicator = new TextObj(timeString, x, 0, CoordType.AxisXYScale);
            timeIndicator.Location.AlignH           = AlignH.Center;
            timeIndicator.Location.AlignV           = AlignV.Top;
            timeIndicator.FontSpec.Fill.Color       = Color.Yellow;
            timeIndicator.FontSpec.Fill.IsVisible   = true;
            timeIndicator.FontSpec.Border.IsVisible = true;
            timeIndicator.FontSpec.Size             = 6f;
            currentIndicators.Add(timeIndicator);

            #endregion


            if (checkBoxReadings.Checked)
            {
                for (int i = 0; i < CurrentEphemeris.Luminaries.Count; i++)
                {
                    CheckBox cb  = panelStars.Controls[i] as CheckBox;
                    Position pos = null;

                    if (cb != null && cb.Checked)
                    {
                        PlanetId id    = CurrentEphemeris.Luminaries[i];
                        string   label = null;
                        double   y     = 180;

                        if (id < PlanetId.SE_FICT_OFFSET)
                        {
                            pos   = CurrentEphemeris[now, id];
                            y     = pos.Longitude;
                            label = string.Format("{0}: {1} ({2})", Planet.Glyphs[id], pos.Longitude.ToString("F1"), Rectascension.AstroStringOf(pos.Longitude));
                        }
                        else if (OrbitsDict[PositionValueIndex.Longitude].ContainsKey(id))
                        {
                            int    todayIndex = (int)Math.Floor(x - since.DateTime.ToOADate());
                            double y1         = OrbitsDict[PositionValueIndex.Longitude][id][todayIndex];
                            double y2         = OrbitsDict[PositionValueIndex.Longitude][id][todayIndex + 1];
                            y = y1 + (y2 - y1) / (x - since.DateTime.ToOADate());

                            label = string.Format("{0}: {1:F1} ({2})", Planet.Glyphs[id], y, Rectascension.AstroStringOf(y));
                        }

                        TextObj posText = lableOf(label, x, y);
                        posText.Location.AlignV = y < 180 ? AlignV.Bottom : AlignV.Top;
                        currentIndicators.Add(posText);
                    }
                }
            }

            #endregion

            foreach (GraphObj obj in currentIndicators)
            {
                zedLongTerm.GraphPane.GraphObjList.Add(obj);
            }

            zedLongTerm.Invalidate();
        }