public void Draw(Graphics graphics, RectangleD cameraBounds, IIconRenderable orbitingBody) { var traceBounds = new List<RectangleF>(); for (int i = 1; i < _points.Count; i++) { DVector2 orbitPoint = _points[i]; if (cameraBounds.Contains(orbitPoint)) { PointF localPoint = RenderUtils.WorldToScreen(orbitPoint, cameraBounds); if (i == _apogeeIndex) { RenderApogee(graphics, localPoint); } else if (i == _perigeeIndex) { RenderPerigee(graphics, localPoint); } else { traceBounds.Add(new RectangleF(localPoint.X, localPoint.Y, 2, 2)); } } } if (cameraBounds.Contains(_points[0])) { double visibility = orbitingBody.Visibility(cameraBounds); if (visibility < 1) { PointF iconPoint = RenderUtils.WorldToScreen(_points[0], cameraBounds); var iconBounds = new RectangleF(iconPoint.X - 5, iconPoint.Y - 5, 10, 10); var iconColor = Color.FromArgb((int)((1 - visibility) * 255), orbitingBody.IconColor.R, orbitingBody.IconColor.G, orbitingBody.IconColor.B); graphics.FillEllipse(new SolidBrush(iconColor), iconBounds); } } RenderUtils.DrawRectangles(graphics, traceBounds, orbitingBody.IconColor); }
public void Draw(Graphics graphics, RectangleD cameraBounds, IIconRenderable orbitingBody) { var traceBounds = new List <RectangleF>(); for (int i = 1; i < _points.Count; i++) { DVector2 orbitPoint = _points[i]; if (cameraBounds.Contains(orbitPoint)) { PointF localPoint = RenderUtils.WorldToScreen(orbitPoint, cameraBounds); if (i == _apogeeIndex) { RenderApogee(graphics, localPoint); } else if (i == _perigeeIndex) { RenderPerigee(graphics, localPoint); } else { traceBounds.Add(new RectangleF(localPoint.X, localPoint.Y, 2, 2)); } } } if (cameraBounds.Contains(_points[0])) { double visibility = orbitingBody.Visibility(cameraBounds); if (visibility < 1) { PointF iconPoint = RenderUtils.WorldToScreen(_points[0], cameraBounds); var iconBounds = new RectangleF(iconPoint.X - 5, iconPoint.Y - 5, 10, 10); var iconColor = Color.FromArgb((int)((1 - visibility) * 255), orbitingBody.IconColor.R, orbitingBody.IconColor.G, orbitingBody.IconColor.B); graphics.FillEllipse(new SolidBrush(iconColor), iconBounds); } } RenderUtils.DrawRectangles(graphics, traceBounds, orbitingBody.IconColor); }