Ejemplo n.º 1
0
        public void Draw(Graphics graphics, RectangleD cameraBounds, IMapRenderable 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 && i > 1)
                    {
                        RenderApogee(graphics, localPoint);
                    }
                    else if (i == _perigeeIndex)
                    {
                        RenderPerigee(graphics, localPoint);
                    }
                    else
                    {
                        traceBounds.Add(new RectangleF(localPoint.X, localPoint.Y, 2, 2));
                    }
                }
            }

            if (_points.Count > 0 && cameraBounds.Contains(_points[0]))
            {
                RenderStart(graphics, cameraBounds, orbitingBody, _points[0]);
            }

            RenderUtils.DrawRectangles(graphics, traceBounds, orbitingBody.IconColor);
        }
Ejemplo n.º 2
0
        public void Draw(Graphics graphics, Camera camera, IMapRenderable orbitingBody)
        {
            var traceBounds = new List <RectangleF>();

            for (int i = 1; i < _points.Count; i++)
            {
                DVector2 orbitPoint = _points[i];

                if (camera.Contains(orbitPoint))
                {
                    PointF localPoint = RenderUtils.WorldToScreen(orbitPoint, camera.Bounds);

                    if (i == _apogeeIndex && i > 1)
                    {
                        RenderApogee(graphics, localPoint);
                    }
                    else if (i == _perigeeIndex)
                    {
                        RenderPerigee(graphics, localPoint);
                    }
                    else
                    {
                        traceBounds.Add(new RectangleF(localPoint.X, localPoint.Y, 2, 2));
                    }
                }
            }

            if (_points.Count > 0 && camera.Contains(_points[0]))
            {
                RenderStart(graphics, camera.Bounds, orbitingBody, _points[0]);
            }

            RenderUtils.DrawRectangles(graphics, traceBounds, orbitingBody.IconColor);
        }
Ejemplo n.º 3
0
        private static void RenderStart(Graphics graphics, RectangleD cameraBounds, IMapRenderable orbitingBody, DVector2 start)
        {
            double visibility = orbitingBody.Visibility(cameraBounds);

            if (visibility < 1)
            {
                PointF iconPoint = RenderUtils.WorldToScreen(start, 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);
            }
        }
Ejemplo n.º 4
0
        private static void RenderStart(Graphics graphics, RectangleD cameraBounds, IMapRenderable orbitingBody, DVector2 start)
        {
            double visibility = orbitingBody.Visibility(cameraBounds);

            if (visibility < 1)
            {
                PointF iconPoint = RenderUtils.WorldToScreen(start, 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);
            }
        }