示例#1
0
        private void showPlanetCurves(PlanetId id)
        {
            foreach (KeyValuePair <int, CurveItem> kvp in Curves[id])
            {
                LineItem line = kvp.Value as LineItem;

                if (line == null)
                {
                    continue;
                }

                if (line.Symbol.Type == SymbolType.None && !zedLongTerm.GraphPane.CurveList.Contains(line))
                {
                    showCurve(zedLongTerm, line, true);
                }
                else if (line.Symbol.Type != SymbolType.None)
                {
                    PlanetEventFlag category = (PlanetEventFlag)kvp.Key;

                    if (concernedEventCategories.Contains(category) && !zedLongTerm.GraphPane.CurveList.Contains(line))
                    {
                        showCurve(zedLongTerm, line, false);
                    }
                    else if (!concernedEventCategories.Contains(category) && zedLongTerm.GraphPane.CurveList.Contains(line))
                    {
                        removeCurve(zedLongTerm, line);
                    }
                }
            }
        }
示例#2
0
        private CurveItem eventCurveOf(PlanetId id, PlanetEventFlag category, List <IPlanetEvent> events)
        {
            List <double> yValues = new List <double>();
            List <double> xValues = new List <double>();

            String name  = String.Format("{0}-{1}", Planet.Glyphs[id], category);
            Color  color = Planet.PlanetsColors.ContainsKey(id) ? Planet.PlanetsColors[id].First() : Color.Gray;

            foreach (IPlanetEvent evt in events)
            {
                if (category == PlanetEventFlag.AspectCategory)
                {
                    ExactAspectEvent aspEvent = evt as ExactAspectEvent;
                    if (aspEvent != null && aspEvent.TheAspect.Importance < defaultAspectImportance)
                    {
                        continue;
                    }
                    else if (concernedPlanet != PlanetId.SE_ECL_NUT && aspEvent.Interior != concernedPlanet && aspEvent.Exterior != concernedPlanet)
                    {
                        continue;
                    }
                }
                yValues.Add(evt.Where.Longitude);
                xValues.Add(evt.When.DateTime.ToOADate());
            }

            LineItem line = new LineItem(name, xValues.ToArray(), yValues.ToArray(), color, defaultEventSymbolType[category], 0);

            line.Symbol.Size = defaultSymbolSize;
            if (category == PlanetEventFlag.EclipseOccultationCategory)
            {
                line.Symbol.Fill = new Fill(Color.Black);
            }
            return(line);
        }
示例#3
0
        public List <IPlanetEvent> this[SeFlg centric, PlanetEventFlag category]
        {
            get
            {
                if ((centric != SeFlg.HELIOCENTRIC && centric != SeFlg.GEOCENTRIC) || !PlanetEvent.PlanetEventSymbolToCategory.ContainsValue(category))
                {
                    throw new ArgumentOutOfRangeException();
                }

                List <IPlanetEvent> result = new List <IPlanetEvent>();

                if (centric == SeFlg.GEOCENTRIC && GeoAspectarian.ContainsKey(category))
                {
                    foreach (KeyValuePair <PlanetId, List <IPlanetEvent> > kvp in GeoAspectarian[category])
                    {
                        if (kvp.Value.Count != 0)
                        {
                            result.AddRange(kvp.Value);
                        }
                    }
                }
                else if (centric == SeFlg.HELIOCENTRIC && HelioAspectarian.ContainsKey(category))
                {
                    foreach (KeyValuePair <PlanetId, List <IPlanetEvent> > kvp in HelioAspectarian[category])
                    {
                        if (kvp.Value.Count != 0)
                        {
                            result.AddRange(kvp.Value);
                        }
                    }
                }

                return((result.Count == 0) ? null : result);
            }
        }
示例#4
0
        public CurveItem this[PlanetId id, PlanetEventFlag category]
        {
            get
            {
                if (!Curves.ContainsKey(id) || !Curves[id].ContainsKey((int)category))
                {
                    return(null);
                }
                return(Curves[id][(int)category]);
            }
            set
            {
                if (!Curves.ContainsKey(id))
                {
                    Curves.Add(id, new Dictionary <int, CurveItem>());
                }

                if (!Curves[id].ContainsKey((int)category))
                {
                    Curves[id].Add((int)category, null);
                }

                Curves[id][(int)category] = value;
            }
        }
示例#5
0
        public DeclinationEvent(PlanetId id, DateTimeOffset time, Position pos, PlanetEventFlag kind)
            : base(id, time, pos)
        {
            if (kind < PlanetEventFlag.OnEquator || kind > PlanetEventFlag.SouthMost)
            {
                throw new Exception();
            }

            Kind = kind;
        }
示例#6
0
        public RectascensionEvent(PlanetId id, DateTimeOffset time, Position pos, PlanetEventFlag kind)
            : base(id, time, pos)
        {
            if (kind != PlanetEventFlag.Direct && kind != PlanetEventFlag.Retrograde)
            {
                throw new Exception();
            }

            Kind = kind;
        }
示例#7
0
        public ExactAspectEvent(DateTimeOffset time, Position pos1, Position pos2, Aspect theAspect, PlanetEventFlag kind)
            : base(pos1.Owner, time, pos1)
        {
            Pair = new PlanetPair(pos1.Owner, pos2.Owner);

            if (Interior != Where.Owner)
            {
                Who   = Pair.Interior;
                Where = pos2;
            }

            ExteriorPosition = pos1.Owner > pos2.Owner ? pos1 : pos2;
            TheAspect        = theAspect;
            Kind             = kind;
        }
示例#8
0
        private string zedLongTerm_PointValueEvent(ZedGraphControl sender, GraphPane pane, CurveItem curve, int iPt)
        {
            LineItem line = curve as LineItem;

            if (line == null)
            {
                return("");
            }

            string name = curve.Label.Text;

            PlanetId id = Planet.GlyphToPlanetId[name[0]];

            if (line.Symbol.Type == SymbolType.None)
            {
                PointPair      pt   = curve.Points[iPt];
                DateTimeOffset time = new DateTimeOffset(DateTime.FromOADate(pt.X), TimeSpan.Zero);

                return(string.Format("{0}: {1} @ {2:F1}", time.ToString("MM-dd"), name, pt.Y));
            }
            else
            {
                PlanetEventFlag category = (from kvp in defaultEventSymbolType
                                            where kvp.Value == line.Symbol.Type
                                            select kvp.Key).FirstOrDefault();

                if (category != PlanetEventFlag.AspectCategory)
                {
                    IPlanetEvent evt = TheAspectarian[category][id][iPt];

                    return(evt.ToString());
                }
                else
                {
                    PointPair      pt   = curve.Points[iPt];
                    DateTimeOffset time = new DateTimeOffset(DateTime.FromOADate(pt.X), TimeSpan.Zero);

                    IPlanetEvent closestEvt = (from one in TheAspectarian[category][id]
                                               orderby Math.Abs((one.When - time).TotalDays)
                                               select one
                                               ).First();
                    return(closestEvt.ToString());
                }
            }
        }
示例#9
0
        public List <IPlanetEvent> this[SeFlg centric, PlanetEventFlag category, PlanetId id]
        {
            get
            {
                if ((centric != SeFlg.HELIOCENTRIC && centric != SeFlg.GEOCENTRIC) || !PlanetEvent.PlanetEventSymbolToCategory.ContainsValue(category))
                {
                    throw new ArgumentOutOfRangeException();
                }

                if (centric == SeFlg.GEOCENTRIC && GeoAspectarian.ContainsKey(category) && GeoAspectarian[category].ContainsKey(id))
                {
                    return(GeoAspectarian[category][id]);
                }
                else if (centric == SeFlg.HELIOCENTRIC && HelioAspectarian.ContainsKey(category) && HelioAspectarian[category].ContainsKey(id))
                {
                    return(HelioAspectarian[category][id]);
                }

                return(null);
            }
        }
示例#10
0
        private Dictionary <PlanetId, List <IPlanetEvent> > classify(Ephemeris theEphe, PlanetEventFlag category)
        {
            List <IPlanetEvent> events = theEphe[Since, Until, category];

            if (events != null && events.Count != 0)
            {
                Dictionary <PlanetId, List <IPlanetEvent> > result = new Dictionary <PlanetId, List <IPlanetEvent> >();
                foreach (IPlanetEvent evt in events)
                {
                    if (negligiblePlanets != null && (negligiblePlanets.Contains(evt.Who)))
                    {
                        continue;
                    }

                    if (!result.ContainsKey(evt.Who))
                    {
                        result.Add(evt.Who, new List <IPlanetEvent>());
                    }

                    result[evt.Who].Add(evt);
                }
                return(result);
            }

            return(null);
        }
示例#11
0
 public Similarity(PlanetEventFlag category, PlanetId who)
 {
     Category = category;
     Who      = who;
 }