public override void Render(IMapContext map) { Graphics g = map.Graphics; bool isGround = settings.Get <bool>("Ground"); bool showMeteors = settings.Get("Meteors"); bool onlyActive = settings.Get("MeteorsOnlyActive"); bool showLabels = settings.Get("MeteorsLabels"); int activityClassLimit = 4; if (!showMeteors) { return; } var meteors = calc.GetCelestialObjects().Where(m => Angle.Separation(map.Center, m.Horizontal) < map.ViewAngle); if (isGround) { meteors = meteors.Where(m => m.Horizontal.Altitude >= 0); } if (onlyActive) { meteors = meteors.Where(m => m.IsActive); } meteors = meteors.Where(m => m.ActivityClass <= activityClassLimit); var color = map.GetColor("ColorMeteors"); var pen = new Pen(color); var brush = new SolidBrush(color); var font = settings.Get <Font>("MeteorsLabelsFont"); foreach (var meteor in meteors) { PointF p = map.Project(meteor.Horizontal); if (!map.IsOutOfScreen(p)) { g.DrawXCross(pen, p, 5); map.AddDrawnObject(meteor); if (showLabels) { map.DrawObjectCaption(font, brush, meteor.Name, p, 10); } } } }
private ICollection <AstroEvent> FindInstants(AstroEventsContext context, Func <Meteor, short> func, Func <Meteor, string> text) { var events = new List <AstroEvent>(); int fromYear = new Date(context.From, context.GeoLocation.UtcOffset).Year; int toYear = new Date(context.To, context.GeoLocation.UtcOffset).Year; for (int year = fromYear; year <= toYear; year++) { double jd0 = Date.JulianDay0(year); events.AddRange( meteorsCalc.GetCelestialObjects() // TODO: limit by setting .Where(m => m.ActivityClass <= 3) .Select(m => new AstroEvent(jd0 + func(m), text(m), noExactTime: true)) .Where(e => e.JulianDay >= context.From && e.JulianDay <= context.To)); } return(events); }