private void DrawDecLineCollection(Graphics g, FrameLine frameLine) { if (frameLine.Collection.Count > 1) { var position = frameLine.Collection.FirstOrDefault(x => x.X > 0 && x.Y > 0); if (position != null) { var text = $"{string.Format("{0:N2}", frameLine.Angle.Degree)}°"; var size = g.MeasureString(text, gridAnnotationFont); g.DrawString(text, gridAnnotationFont, gridAnnotationBrush, (position.X), (position.Y)); } DrawFrameLineCollection(g, frameLine); } }
private void DrawFrameLineCollection(Graphics g, FrameLine frameLine) { var points = CardinalSpline(frameLine.Collection, 0.5f, frameLine.Closed); if (frameLine.StrokeThickness != 1) { using (var pen = new System.Drawing.Pen(gridPen.Color, frameLine.StrokeThickness)) { g.DrawBeziers(pen, points.ToArray()); } } else { g.DrawBeziers(gridPen, points.ToArray()); } }
private void DrawRALineCollection(Graphics g, FrameLine frameLine) { if (frameLine.Collection.Count > 1) { //Prevent annotations to overlap on southern pole var southPole = new Coordinates(0, -MAXDEC, Epoch.J2000, Coordinates.RAType.Degrees).XYProjection(currentViewport); PointF?position = frameLine.Collection.FirstOrDefault(x => x.X > 0 && x.Y > 0 && x.X < currentViewport.Width && x.Y < currentViewport.Height && Math.Abs(x.X - southPole.X) > 5 && Math.Abs(x.Y - southPole.Y) > 5); if (position != null) { var hms = Astrometry.HoursToHMS(frameLine.Angle.Hours); var text = $"{hms.Substring(0, hms.Length - 3)}h"; var size = g.MeasureString(text, gridAnnotationFont); g.DrawString(text, gridAnnotationFont, gridAnnotationBrush, (position.Value.X), Math.Max(0, (position.Value.Y - size.Height))); } DrawFrameLineCollection(g, frameLine); } }