public override void DoPaint(Graphics g, int w, int h)
        {
            var radius = Math.Min(w, h)/2 - 100;
            var radiusDot = 50;
            var xC = w / 2;
            var yC = h / 2;

            g.FillBackground(w, h, PPP.brushWhite);
            g.FillCircle(PPP.brushLightGrayA, xC, yC, radius);
            g.FillCircle(PPP.brushWhite, xC, yC, radius-radiusDot*2);
            var alpha = Frame * ALPHA_FACTOR;
            var xClock = xC + Math.Cos(alpha) * (radius - radiusDot);
            var yClock = yC + Math.Sin(alpha) * (radius - radiusDot);
            var brushBreath = (xClock > xC)
                ? PPP.brushDefault
                : PPP.brushWhite;
            g.FillCircle(brushBreath, (int)xClock, (int)yClock, radiusDot);
        }
 private void DrawBall(Graphics g, ISimulation s)
 {
     g.FillCircle(_ballBrush, s.Ball.Position, s.Ball.Radius);
     DrawDebugInfo(s.Ball, _ballBrush, _font, g);
 }
Exemplo n.º 3
0
 private void DrawSpaceMap_DrawHeightLine(Graphics g, Pen pen, Brush brush, double x, double zy, double z)
 {
     g.DrawLineD(pen, x, zy, x, z);
     g.FillCircle(brush, x, z, 6.0);
 }
Exemplo n.º 4
0
        public void DrawSpaceMap(Graphics g)
        {
            List<IDisposable> ListObjectsToDispose = new List<IDisposable>();

            #region INIT everything and DRAW Background

            int i, j, fleetNumber, podNumber, randomThreshold;
            double x, zy, z, xe, zye, ze, angle, radius1, radius2, radius3, angleStart, angleEnd;
            double sizeAnomaly, sizeVessel, sizeSelection,
                sizeNamelessBlackholeOuter, sizeNamelessBlackholeInner, sizeNamelessNebula, sizeNamelessAsteroid, sizeNamelessMineBright, sizeNamelessMineDark;
            string name;
            double screen_y_scale = Settings.Current.YScale * GetMapScale();

            //objects for every1
            Random rnd = new Random();

            //DRAW BACKGROUND
            g.Clear(Settings.Current.GetColor(MapColors.MapBackground));

            #endregion

            #region DRAW Nameless Objects

            // calculate sizes
            sizeNamelessNebula = Space.NebulaWidth * GetMapScale();
            sizeNamelessAsteroid = Space.AsteroidWidth * GetMapScale();
            sizeNamelessAsteroid = (sizeNamelessAsteroid < 7.0 ? 7.0 : sizeNamelessAsteroid);
            sizeNamelessMineBright = 9.0;
            sizeNamelessMineDark = 3.0;

            // nebulas
            Brush brushNebula = Settings.Current.GetBrush(MapColors.Nebula);
            ListObjectsToDispose.Add(brushNebula);
            Brush brushNebulaBG = Settings.Current.GetBrush(MapColors.NebulaBG);
            ListObjectsToDispose.Add(brushNebulaBG);
            Pen penNebula = new Pen(brushNebula, 1);
            ListObjectsToDispose.Add(penNebula);

            // astreoids
            Brush brushAsteroid = (sizeNamelessAsteroid > 12.5) ? Settings.Current.GetBrush(MapColors.AsteroidBright) : Settings.Current.GetBrush(MapColors.Asteroid);
            ListObjectsToDispose.Add(brushAsteroid);
            Brush brushAsteroidBG = Settings.Current.GetBrush(MapColors.AsteroidBG);
            ListObjectsToDispose.Add(brushAsteroidBG);
            Pen penAsteroid = new Pen(brushAsteroid, (int)Math.Round(sizeNamelessAsteroid / 5));
            ListObjectsToDispose.Add(penAsteroid);
            Pen penAsteroidBG = new Pen(brushAsteroidBG, (int)Math.Round(sizeNamelessAsteroid / 5));
            ListObjectsToDispose.Add(penAsteroidBG);

            // mines
            Brush brushMine = Settings.Current.GetBrush(MapColors.Mine);
            ListObjectsToDispose.Add(brushMine);
            Brush brushMineDark = Settings.Current.GetBrush(MapColors.MineDark);
            ListObjectsToDispose.Add(brushMineDark);
            Brush brushMineBG = Settings.Current.GetBrush(MapColors.MineBG);
            ListObjectsToDispose.Add(brushMineBG);
            Pen penMine = new Pen(brushMine, 1);
            ListObjectsToDispose.Add(penMine);
            Pen penMineDark = new Pen(brushMineDark, 1);
            ListObjectsToDispose.Add(penMineDark);
            Pen penMineBG = new Pen(brushMineBG, 1);
            ListObjectsToDispose.Add(penMineBG);

            //height
            Brush brushDarkHeight = Settings.Current.GetBrush(MapColors.MapNamelessHeightMarker);
            ListObjectsToDispose.Add(brushDarkHeight);
            Pen penDarkHeight = new Pen(brushDarkHeight, 1);
            ListObjectsToDispose.Add(penDarkHeight);

            // Background objects
            foreach (MapObjectNameless item in SpaceMap.BackgroundNamelessObjects)
            {
                randomThreshold = item._type == MapObjectNamelessType.asteroids ? 6 : 2; //random_threshold
                rnd = new Random(item.randomSeed);
                angleStart = item.A_Start_rad ?? 0.0;
                angleEnd = (item.A_End_rad ?? Math.PI * 2.0);
                if (angleStart > angleEnd)
                {
                    double tmp = angleEnd;
                    angleEnd = angleStart;
                    angleStart = tmp;
                }

                for (i = 0; i < item.count; i++)
                {
                    if (!DrawSpaceMap_GetPoint(screen_y_scale, rnd, item, i, angleStart, angleEnd, out x, out zy, out z))
                        continue;

                    if (!Settings.Current.UseYForNameless)
                        zy = z;

                    switch (item._type)
                    {
                        case MapObjectNamelessType.asteroids:
                            g.DrawCircle(penAsteroidBG, x, zy, sizeNamelessAsteroid);
                            break;
                        case MapObjectNamelessType.nebulas:
                            g.DrawCircle(penNebula, x, zy, sizeNamelessNebula);
                            g.FillCircle(brushNebulaBG, x, zy, sizeNamelessNebula);
                            break;
                        case MapObjectNamelessType.mines:
                            g.DrawCircle(penMineBG, x, zy, sizeNamelessMineBright);
                            break;
                    }
                }
            }

            foreach (MapObjectNameless item in SpaceMap.NamelessObjects)
            {
                randomThreshold = item._type == MapObjectNamelessType.asteroids ? 6 : 2; //random_threshold
                rnd = new Random(item.randomSeed);
                angleStart = item.A_Start_rad ?? 0.0;
                angleEnd = (item.A_End_rad ?? Math.PI * 2.0);
                if (angleStart > angleEnd)
                {
                    double tmp = angleEnd;
                    angleEnd = angleStart;
                    angleStart = tmp;
                }

                for (i = 0; i < item.count; i++)
                {
                    if (!DrawSpaceMap_GetPoint(screen_y_scale, rnd, item, i, angleStart, angleEnd, out x, out zy, out z))
                        continue;

                    if (!Settings.Current.UseYForNameless)
                        zy = z;

                    if (zy < z - randomThreshold)
                        DrawSpaceMap_DrawHeightLine(g, penDarkHeight, brushDarkHeight, x, zy, z);

                    switch (item._type)
                    {
                        case MapObjectNamelessType.asteroids:
                            g.DrawCircle(penAsteroid, x, zy, sizeNamelessAsteroid);
                            break;
                        case MapObjectNamelessType.nebulas:
                            g.FillCircle(brushNebula, x, zy, sizeNamelessNebula);
                            break;
                        case MapObjectNamelessType.mines:
                            g.DrawCircle(penMine, x, zy, sizeNamelessMineBright);
                            g.DrawCircle(penMineDark, x, zy, sizeNamelessMineDark);
                            break;
                    }
                    if (zy > z + randomThreshold)
                        DrawSpaceMap_DrawHeightLine(g, penDarkHeight, brushDarkHeight, x, zy, z);
                }
            }

            #endregion

            #region DRAW Grid and Quadrant captions

            Pen penGrid = new Pen(Settings.Current.GetColor(MapColors.MapGridLine), 1);
            ListObjectsToDispose.Add(penGrid);
            for (i = 0; i < 6; i++)
                g.DrawLine(penGrid,
                    PointXToScreen(i * 20000),
                    PointZToScreen(0),
                    PointXToScreen(i * 20000),
                    PointZToScreen(Space.MaxZ));
            for (i = 0; i < 6; i++)
                g.DrawLine(penGrid,
                    PointXToScreen(0),
                    PointZToScreen(i * 20000),
                    PointXToScreen(Space.MaxX),
                    PointZToScreen(i * 20000));

            //3. DRAW QUANDRANT CAPTIONS
            Brush brushQuadrant = Settings.Current.GetBrush(MapColors.MapGridLine);
            ListObjectsToDispose.Add(brushQuadrant);
            Font fontQuadrant = Settings.Current.GetFont(MapFonts.QuadrantText);
            if (fontQuadrant.Size > 2900.0 * GetMapScale())
            {
                fontQuadrant = new Font(fontQuadrant.FontFamily, (float)(2900.0 * GetMapScale()), fontQuadrant.Style);
                ListObjectsToDispose.Add(fontQuadrant);
            }
            for (i = 0; i < 5; i++)
                for (j = 0; j < 5; j++)
                    g.DrawString(Convert.ToChar(Convert.ToInt32('A') + j).ToString() + Convert.ToString(i + 1), fontQuadrant, brushQuadrant,
                        PointXToScreen(i * 20000 + 90),
                        PointXToScreen(j * 20000 + 20));

            #endregion

            #region INIT Named objects

            Brush brushHeight = Settings.Current.GetBrush(MapColors.MapHeightMarker);
            ListObjectsToDispose.Add(brushHeight);
            Pen penHeight = new Pen(brushHeight, 1);
            ListObjectsToDispose.Add(penHeight);

            //for all fonts that use center output
            StringFormat drawFormat = new StringFormat();
            ListObjectsToDispose.Add(drawFormat);
            drawFormat.Alignment = StringAlignment.Center;
            //for anomalies
            Brush brushAnomaly = Settings.Current.GetBrush(MapColors.Anomaly);
            ListObjectsToDispose.Add(brushAnomaly);
            sizeAnomaly = 1 + 100 * GetMapScale();
            //for vessels
            sizeVessel = 1 + 1500 * GetMapScale();
            sizeVessel = sizeVessel > 30 ? 30 : sizeVessel;
            Point vesselPoint0 = new Point(0, -70);
            Point vesselPoint1 = new Point(50, 50);
            Point vesselPoint2 = new Point(0, 05);
            Point vesselPoint3 = new Point(-50, 50);
            Point[] tp = new Point[4];
            //for enemies
            Brush brushEnemy = Settings.Current.GetBrush(MapColors.Enemy);
            ListObjectsToDispose.Add(brushEnemy);
            Brush brushEnemyBG = Settings.Current.GetBrush(MapColors.EnemyBG);
            ListObjectsToDispose.Add(brushEnemyBG);
            Pen penEnemyBG = new Pen(brushEnemyBG, 1);
            ListObjectsToDispose.Add(penEnemyBG);
            Font fontEnemy = Settings.Current.GetFont(MapFonts.ObjectText);
            if (fontEnemy.Size > sizeVessel / 2)
            {
                fontEnemy = new Font(fontEnemy.FontFamily, sizeVessel / 2.0 < 8.0 ? 8.0f : (float)(sizeVessel / 2.0), fontEnemy.Style);
                ListObjectsToDispose.Add(fontEnemy);
            }
            Font fontFleet = Settings.Current.GetFont(MapFonts.FleetText);
            //for stations
            Brush brushStation = Settings.Current.GetBrush(MapColors.Station);
            ListObjectsToDispose.Add(brushStation);
            Pen penStation = new Pen(brushStation, RoundToNearestOddInt(sizeVessel / 5.0));
            ListObjectsToDispose.Add(penStation);
            Pen penStationBG = new Pen(Settings.Current.GetBrush(MapColors.StationBG), 1);
            ListObjectsToDispose.Add(penStationBG);
            Font fontStation = Settings.Current.GetFont(MapFonts.ObjectText);
            if (fontStation.Size > sizeVessel / 2)
            {
                fontStation = new Font(fontStation.FontFamily, sizeVessel / 2.0 < 8.0 ? 8.0f : (float)(sizeVessel / 2.0), fontStation.Style);
                ListObjectsToDispose.Add(fontStation);
            }
            //for generics
            Brush brushGenericMesh = Settings.Current.GetBrush(MapColors.GenericMesh);
            ListObjectsToDispose.Add(brushGenericMesh);
            Pen penGenericMesh1 = new Pen(brushGenericMesh, RoundToNearestOddInt(sizeVessel / 5.0));
            ListObjectsToDispose.Add(penGenericMesh1);
            Pen penGenericMesh2 = new Pen(brushGenericMesh, FloorToIntNot2(sizeVessel / 10.0));
            ListObjectsToDispose.Add(penGenericMesh2);
            Brush brushGenericMeshSolid = new SolidBrush(Settings.Current.GetColor(MapColors.GenericMesh));
            ListObjectsToDispose.Add(brushGenericMeshSolid);
            Font fontGenericMesh = Settings.Current.GetFont(MapFonts.ObjectText);
            if (fontGenericMesh.Size > sizeVessel / 2)
            {
                fontGenericMesh = new Font(fontGenericMesh.FontFamily, sizeVessel / 2.0 < 8.0 ? 8 : (float)(sizeVessel / 2.0), fontGenericMesh.Style);
                ListObjectsToDispose.Add(fontGenericMesh);
            }
            Brush brushGenericMeshBG = Settings.Current.GetBrush(MapColors.GenericMeshBG);
            ListObjectsToDispose.Add(brushGenericMeshBG);
            Pen penGenericMeshBG = new Pen(brushGenericMeshBG, 1);
            ListObjectsToDispose.Add(penGenericMeshBG);
            //for monsters
            Brush brushMonster = Settings.Current.GetBrush(MapColors.Monster);
            ListObjectsToDispose.Add(brushMonster);
            Pen penMonster = new Pen(brushMonster, RoundToNearestOddInt(sizeVessel / 10.0));
            ListObjectsToDispose.Add(penMonster);
            Font fontMonster = Settings.Current.GetFont(MapFonts.ObjectText);
            if (fontMonster.Size > sizeVessel / 2)
            {
                fontMonster = new Font(fontMonster.FontFamily, sizeVessel / 2.0 < 8.0 ? 8.0f : (float)(sizeVessel / 2.0), fontMonster.Style);
                ListObjectsToDispose.Add(fontMonster);
            }
            //for neutrals
            Brush brushNeutral = Settings.Current.GetBrush(MapColors.Neutral);
            ListObjectsToDispose.Add(brushNeutral);
            Font fontNeutral = Settings.Current.GetFont(MapFonts.ObjectText);
            if (fontNeutral.Size > sizeVessel / 2)
            {
                fontNeutral = new Font(fontNeutral.FontFamily, sizeVessel / 2.0 < 8.0 ? 8.0f: (float)(sizeVessel / 2.0), fontNeutral.Style);
                ListObjectsToDispose.Add(fontNeutral);
            }
            Brush brushNeutralBG = Settings.Current.GetBrush(MapColors.NeutralBG);
            ListObjectsToDispose.Add(brushNeutralBG);
            Pen penNeutralBG = new Pen(brushNeutralBG, 1);
            ListObjectsToDispose.Add(penNeutralBG);
            //for player(s????)
            Brush brushPlayer = Settings.Current.GetBrush(MapColors.Player);
            ListObjectsToDispose.Add(brushPlayer);
            Font fontPlayer = Settings.Current.GetFont(MapFonts.ObjectText);
            if (fontPlayer.Size > sizeVessel / 2)
            {
                fontPlayer = new Font(fontPlayer.FontFamily, sizeVessel / 2.0 < 8.0 ? 8.0f: (float)(sizeVessel / 2.0), fontPlayer.Style);
                ListObjectsToDispose.Add(fontPlayer);
            }
            Brush brushPlayerBG = Settings.Current.GetBrush(MapColors.PlayerBG);
            ListObjectsToDispose.Add(brushPlayerBG);
            Pen penPlayerBG = new Pen(brushPlayerBG, 1);
            ListObjectsToDispose.Add(penPlayerBG);
            //for whale(s????)
            Brush brushWhale = Settings.Current.GetBrush(MapColors.Whale);
            ListObjectsToDispose.Add(brushWhale);
            Font fontWhale = Settings.Current.GetFont(MapFonts.ObjectText);
            if (fontWhale.Size > sizeVessel / 2)
            {
                fontWhale = new Font(fontWhale.FontFamily, sizeVessel / 2.0 < 8.0 ? 8.0f: (float)(sizeVessel / 2.0), fontWhale.Style);
                ListObjectsToDispose.Add(fontWhale);
            }
            Brush brushWhaleBG = Settings.Current.GetBrush(MapColors.WhaleBG);
            ListObjectsToDispose.Add(brushWhaleBG);
            Pen penWhaleBG = new Pen(brushWhaleBG, 1);
            ListObjectsToDispose.Add(penWhaleBG);
            //for BH
            sizeNamelessBlackholeOuter = 4750 * GetMapScale();
            sizeNamelessBlackholeInner = 550 * GetMapScale();
            Brush brushBlackHole = Settings.Current.GetBrush(MapColors.BlackHole);
            ListObjectsToDispose.Add(brushBlackHole);
            Pen penBlackHoleOuter = new Pen(brushBlackHole, RoundToNearestOddInt(sizeNamelessBlackholeOuter / 8.0));
            ListObjectsToDispose.Add(penBlackHoleOuter);
            Pen penBlackHoleInner = new Pen(brushBlackHole, (sizeNamelessBlackholeOuter < 275) ? RoundToNearestOddInt(sizeNamelessBlackholeOuter / 55.0) : 5);
            ListObjectsToDispose.Add(penBlackHoleInner);
            Font fontBlackHole = Settings.Current.GetFont(MapFonts.ObjectText);
            if (fontBlackHole.Size > sizeNamelessBlackholeOuter / 4)
            {
                fontBlackHole = new Font(fontBlackHole.FontFamily, sizeNamelessBlackholeOuter / 4.0 < 8.0 ? 8.0f : (float)(sizeNamelessBlackholeOuter / 4.0), fontBlackHole.Style);
                ListObjectsToDispose.Add(fontBlackHole);
            }
            Pen penBlackHoleBG = new Pen(brushBlackHole);
            ListObjectsToDispose.Add(penBlackHoleBG);
            Font fontAnomaly = Settings.Current.GetFont(MapFonts.ObjectText);
            if (fontAnomaly.Size > sizeVessel / 2)
            {
                fontAnomaly = new Font(fontAnomaly.FontFamily, sizeVessel / 2.0 < 8.0 ? 8.0f : (float)(sizeVessel / 2.0), fontAnomaly.Style);
                ListObjectsToDispose.Add(fontAnomaly);
            }

            #endregion

            #region DRAW Low priority Named Objects (black holes)

            foreach (MapObjectNamed mo in SpaceMap.NamedObjects)
            {
                x = PointXToScreen(mo.Coordinates.X_Scr);
                zy = PointZToScreen(mo.Coordinates.Z_Scr) - mo.Coordinates.Y_Scr * screen_y_scale;
                z = PointZToScreen(mo.Coordinates.Z_Scr);

                if (!Settings.Current.UseYForNamed)
                    zy = z;

                switch (mo.TypeToString)
                {
                    case "blackHole":
                        if (zy < z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        g.DrawCircle(penBlackHoleOuter, x , zy, sizeNamelessBlackholeOuter * 30.0 / 32);
                        g.DrawCircle(penBlackHoleInner, x , zy, sizeNamelessBlackholeInner * 32.0 / 32.0);
                        if (zy > z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        name = string.IsNullOrEmpty(mo.name) ? "" : (string.IsNullOrWhiteSpace(mo.name) && Settings.Current.MarkWhitespaceNamesOnSpaceMap ? "<" + mo.name + ">" : mo.name);
                        g.DrawStringD(name, fontBlackHole, brushBlackHole, x, zy - sizeNamelessBlackholeOuter * 16.0 / 32.0 - fontBlackHole.Size - RoundToNearestOddInt(sizeNamelessBlackholeOuter / 8.0) - 2.0, drawFormat);
                        break;
                }
            }

            foreach (MapObjectNamed mo in SpaceMap.BacgkroundNamedObjects)
            {
                x = PointXToScreen(mo.Coordinates.X_Scr);
                zy = PointZToScreen(mo.Coordinates.Z_Scr) - mo.Coordinates.Y_Scr * screen_y_scale;
                z = PointZToScreen(mo.Coordinates.Z_Scr);

                if (!Settings.Current.UseYForNamed)
                    zy = z;

                switch (mo.TypeToString)
                {
                    case "blackHole":
                        g.DrawCircle(penBlackHoleBG, x, zy, sizeNamelessBlackholeOuter * 30.0 / 32.0);
                        break;
                }
            }

            #endregion

            #region DRAW BG Named Objects

            foreach (MapObjectNamed mo in SpaceMap.BacgkroundNamedObjects)
            {
                x = PointXToScreen(mo.Coordinates.X_Scr);
                zy = PointZToScreen(mo.Coordinates.Z_Scr) - mo.Coordinates.Y_Scr * screen_y_scale;
                z = PointZToScreen(mo.Coordinates.Z_Scr);

                if (!Settings.Current.UseYForNamed)
                    zy = z;

                 switch (mo.TypeToString)
                {
                    case "enemy":
                        angle = ((MapObjectNamedA)mo).A_rad;
                        tp[0] = DrawSpaceMap_RotateScalePoint(vesselPoint0, x, zy, angle, sizeVessel);
                        tp[1] = DrawSpaceMap_RotateScalePoint(vesselPoint1, x, zy, angle, sizeVessel);
                        tp[2] = DrawSpaceMap_RotateScalePoint(vesselPoint2, x, zy, angle, sizeVessel);
                        tp[3] = DrawSpaceMap_RotateScalePoint(vesselPoint3, x, zy, angle, sizeVessel);
                        g.DrawPolygon(penEnemyBG, tp);
                        break;
                    case "player":
                        angle = ((MapObjectNamedA)mo).A_rad;
                        tp[0] = DrawSpaceMap_RotateScalePoint(vesselPoint0, x, zy, angle, sizeVessel);
                        tp[1] = DrawSpaceMap_RotateScalePoint(vesselPoint1, x, zy, angle, sizeVessel);
                        tp[2] = DrawSpaceMap_RotateScalePoint(vesselPoint2, x, zy, angle, sizeVessel);
                        tp[3] = DrawSpaceMap_RotateScalePoint(vesselPoint3, x, zy, angle, sizeVessel);
                        g.DrawPolygon(penPlayerBG, tp);
                        break;
                    case "whale":
                        angle = ((MapObjectNamedA)mo).A_rad;
                        tp[0] = DrawSpaceMap_RotateScalePoint(vesselPoint0, x, zy, angle, sizeVessel * 0.8);
                        tp[1] = DrawSpaceMap_RotateScalePoint(vesselPoint1, x, zy, angle, sizeVessel * 0.8);
                        tp[2] = DrawSpaceMap_RotateScalePoint(vesselPoint2, x, zy, angle, sizeVessel * 0.8);
                        tp[3] = DrawSpaceMap_RotateScalePoint(vesselPoint3, x, zy, angle, sizeVessel * 0.8);
                        g.DrawPolygon(penWhaleBG, tp);
                        break;
                    case "neutral":
                        angle = ((MapObjectNamedA)mo).A_rad;
                        tp[0] = DrawSpaceMap_RotateScalePoint(vesselPoint0, x, zy, angle, sizeVessel);
                        tp[1] = DrawSpaceMap_RotateScalePoint(vesselPoint1, x, zy, angle, sizeVessel);
                        tp[2] = DrawSpaceMap_RotateScalePoint(vesselPoint2, x, zy, angle, sizeVessel);
                        tp[3] = DrawSpaceMap_RotateScalePoint(vesselPoint3, x, zy, angle, sizeVessel);
                        g.DrawPolygon(penNeutralBG, tp);
                        break;
                    case "station":
                        g.DrawCircle(penStationBG, x, zy, sizeVessel * 18.0 / 20.0);
                        break;
                    case "genericMesh":
                        angle = ((MapObjectNamedA)mo).A_rad;
                        tp[0] = DrawSpaceMap_RotateScalePoint(vesselPoint0, x, zy, angle, sizeVessel * 0.8);
                        tp[1] = DrawSpaceMap_RotateScalePoint(vesselPoint1, x, zy, angle, sizeVessel * 0.8);
                        tp[2] = DrawSpaceMap_RotateScalePoint(vesselPoint2, x, zy, angle, sizeVessel * 0.8);
                        tp[3] = DrawSpaceMap_RotateScalePoint(vesselPoint3, x, zy, angle, sizeVessel * 0.8);
                        g.DrawCircle(penGenericMeshBG, x, zy, sizeVessel * 14.0 / 20.0);
                        break;

                }
            }

            #endregion

            #region DRAW Normal priority objects (all except anomalies and blackholes)

            foreach (MapObjectNamed mo in SpaceMap.NamedObjects)
            {
                x = PointXToScreen(mo.Coordinates.X_Scr);
                zy = PointZToScreen(mo.Coordinates.Z_Scr) - mo.Coordinates.Y_Scr * screen_y_scale;
                z = PointZToScreen(mo.Coordinates.Z_Scr);
                if (!Settings.Current.UseYForNamed)
                    zy = z;

                switch (mo.TypeToString)
                {
                    case "enemy":
                        if (zy < z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        angle = ((MapObjectNamedA)mo).A_rad;
                        tp[0] = DrawSpaceMap_RotateScalePoint(vesselPoint0, x, zy, angle, sizeVessel);
                        tp[1] = DrawSpaceMap_RotateScalePoint(vesselPoint1, x, zy, angle, sizeVessel);
                        tp[2] = DrawSpaceMap_RotateScalePoint(vesselPoint2, x, zy, angle, sizeVessel);
                        tp[3] = DrawSpaceMap_RotateScalePoint(vesselPoint3, x, zy, angle, sizeVessel);
                        g.FillPolygon(brushEnemy, tp);
                        if (zy > z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        name = string.IsNullOrEmpty(mo.name) ? "" : (string.IsNullOrWhiteSpace(mo.name) && Settings.Current.MarkWhitespaceNamesOnSpaceMap ? "<" + mo.name + ">" : mo.name);
                        g.DrawStringD(name, fontEnemy, brushEnemy, x, zy - fontEnemy.Size * 3.0 - 2.0, drawFormat);
                        bool fleetNumberNotInt = !Helper.IntTryParse(((MapObjectNamed_enemy)mo).fleetnumber, out  fleetNumber);
                        g.DrawStringD(fleetNumberNotInt  ? "x" : fleetNumber == -1 ? "" : fleetNumber >= 0 && fleetNumber <= 99 ? fleetNumber.ToString() : "<!>", fontFleet, brushEnemy, x + sizeVessel * 2.0 / 3.0 + 2.0, zy + sizeVessel * 2.0 / 3.0 + 2.0, StringFormat.GenericDefault);
                        break;
                    case "player":
                        if (zy < z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        angle = ((MapObjectNamedA)mo).A_rad;
                        tp[0] = DrawSpaceMap_RotateScalePoint(vesselPoint0, x, zy, angle, sizeVessel);
                        tp[1] = DrawSpaceMap_RotateScalePoint(vesselPoint1, x, zy, angle, sizeVessel);
                        tp[2] = DrawSpaceMap_RotateScalePoint(vesselPoint2, x, zy, angle, sizeVessel);
                        tp[3] = DrawSpaceMap_RotateScalePoint(vesselPoint3, x, zy, angle, sizeVessel);
                        g.FillPolygon(brushPlayer, tp);
                        if (zy > z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        name = string.IsNullOrEmpty(mo.name) ? "" : (string.IsNullOrWhiteSpace(mo.name) && Settings.Current.MarkWhitespaceNamesOnSpaceMap ? "<" + mo.name + ">" : mo.name);
                        g.DrawStringD(name, fontPlayer, brushPlayer, x, zy - fontPlayer.Size * 3.0 - 2.0, drawFormat);
                        break;
                    case "whale":
                        if (zy < z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        angle = ((MapObjectNamedA)mo).A_rad;
                        tp[0] = DrawSpaceMap_RotateScalePoint(vesselPoint0, x, zy, angle, sizeVessel * 0.80);
                        tp[1] = DrawSpaceMap_RotateScalePoint(vesselPoint1, x, zy, angle, sizeVessel * 0.80);
                        tp[2] = DrawSpaceMap_RotateScalePoint(vesselPoint2, x, zy, angle, sizeVessel * 0.80);
                        tp[3] = DrawSpaceMap_RotateScalePoint(vesselPoint3, x, zy, angle, sizeVessel * 0.80);
                        g.FillPolygon(brushWhale, tp);
                        if (zy > z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        name = string.IsNullOrEmpty(mo.name) ? "" : (string.IsNullOrWhiteSpace(mo.name) && Settings.Current.MarkWhitespaceNamesOnSpaceMap ? "<" + mo.name + ">" : mo.name);
                        g.DrawStringD(name, fontWhale, brushWhale, x, zy - fontWhale.Size * 3.0 - 2.0, drawFormat);
                        bool podNumberNotInt = !Helper.IntTryParse(((MapObjectNamed_whale)mo).podnumber, out podNumber);
                        g.DrawStringD(podNumberNotInt ? "x" : (podNumber >= 0 && podNumber <= 9) ? podNumber.ToString() : "<!>", fontFleet, brushWhale, x + sizeVessel * 2.0 / 3.0 + 2.0, zy + sizeVessel * 2.0 / 3.0 + 2.0, StringFormat.GenericDefault);
                        break;
                    case "neutral":
                        if (zy < z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        angle = ((MapObjectNamedA)mo).A_rad;
                        tp[0] = DrawSpaceMap_RotateScalePoint(vesselPoint0, x, zy, angle, sizeVessel);
                        tp[1] = DrawSpaceMap_RotateScalePoint(vesselPoint1, x, zy, angle, sizeVessel);
                        tp[2] = DrawSpaceMap_RotateScalePoint(vesselPoint2, x, zy, angle, sizeVessel);
                        tp[3] = DrawSpaceMap_RotateScalePoint(vesselPoint3, x, zy, angle, sizeVessel);
                        g.FillPolygon(brushNeutral, tp);
                        if (zy > z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        name = string.IsNullOrEmpty(mo.name) ? "" : (string.IsNullOrWhiteSpace(mo.name) && Settings.Current.MarkWhitespaceNamesOnSpaceMap ? "<" + mo.name + ">" : mo.name);
                        g.DrawStringD(name, fontNeutral, brushNeutral, x, zy - fontNeutral.Size * 3.0 - 2.0, drawFormat);
                        break;
                    case "station":
                        if (zy < z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        g.DrawCircle(penStation, x, zy, sizeVessel * 18.0 / 20.0);
                        if (zy > z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        name = string.IsNullOrEmpty(mo.name) ? "" : (string.IsNullOrWhiteSpace(mo.name) && Settings.Current.MarkWhitespaceNamesOnSpaceMap ? "<" + mo.name + ">" : mo.name);
                        g.DrawStringD(name, fontStation, brushStation, x, zy - fontStation.Size * 3.0 - 2.0, drawFormat);
                        break;
                    case "genericMesh":
                        Pen penGenericMeshCurrent1, penGenericMeshCurrent2, penGenericMeshCurrent3;
                        Brush brushGenericMeshCurrent;
                        if (zy < z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        angle = ((MapObjectNamedA)mo).A_rad;
                        tp[0] = DrawSpaceMap_RotateScalePoint(vesselPoint0, x, zy, angle, sizeVessel * 0.80);
                        tp[1] = DrawSpaceMap_RotateScalePoint(vesselPoint1, x, zy, angle, sizeVessel * 0.80);
                        tp[2] = DrawSpaceMap_RotateScalePoint(vesselPoint2, x, zy, angle, sizeVessel * 0.80);
                        tp[3] = DrawSpaceMap_RotateScalePoint(vesselPoint3, x, zy, angle, sizeVessel * 0.80);
                        bool tooDark = false;
                        if (!Settings.Current.UseGenericMeshColor)
                        {
                            brushGenericMeshCurrent = brushGenericMeshSolid;
                            penGenericMeshCurrent1 = penGenericMesh1;
                            penGenericMeshCurrent2 = penGenericMesh2;
                            penGenericMeshCurrent3 = null;
                        }
                        else if (((MapObjectNamed_genericMesh)mo).Color_Blue * 0.0722 + ((MapObjectNamed_genericMesh)mo).Color_Green * 0.7152 + ((MapObjectNamed_genericMesh)mo).Color_Red * 0.2126 <= Settings.Current.MinimalLuminance)
                        {
                            //Code to mix the colors
                            //genericMeshBrushCurrent = new SolidBrush(((MapObjectNamed_genericMesh)mo).Color);
                            //genericMeshPenCurrent1 = new Pen(genericMeshBrushCurrent, __ro((db)s_v / 5));
                            //genericMeshPenCurrent2 = new Pen(genericMeshBrushCurrent, __rn2((db)s_v / 10));
                            //genericMeshPenCurrent3 = genericMeshPen1;
                            //genericMeshBrushCurrent = genericMeshSolidBrush;
                            //toodark = true;
                            brushGenericMeshCurrent = brushGenericMeshSolid;
                            penGenericMeshCurrent1 = penGenericMesh1;
                            penGenericMeshCurrent2 = penGenericMesh2;
                            penGenericMeshCurrent3 = null;
                        }
                        else
                        {
                            brushGenericMeshCurrent = new SolidBrush(((MapObjectNamed_genericMesh)mo).Color);
                            penGenericMeshCurrent1 = new Pen(brushGenericMeshCurrent, RoundToNearestOddInt(sizeVessel / 5.0));
                            penGenericMeshCurrent2 = new Pen(brushGenericMeshCurrent, FloorToIntNot2(sizeVessel / 10.0));
                            penGenericMeshCurrent3 = null;
                        }
                        if (tooDark)
                            g.DrawCircle(penGenericMeshCurrent3, x, zy, sizeVessel * 18.0 / 20.0);
                            g.DrawCircle(penGenericMeshCurrent1, x, zy, sizeVessel * 14.0 / 20.0);
                        g.DrawPolygon(penGenericMeshCurrent2, tp);
                        if (zy > z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        name = string.IsNullOrEmpty(mo.name) ? "" : (string.IsNullOrWhiteSpace(mo.name) && Settings.Current.MarkWhitespaceNamesOnSpaceMap ? "<" + mo.name + ">" : mo.name);
                        g.DrawStringD(name, fontGenericMesh, brushGenericMeshCurrent, x, zy - fontGenericMesh.Size * 3.0 - 2.0, drawFormat);
                        penGenericMeshCurrent1 = null;
                        penGenericMeshCurrent2 = null;
                        penGenericMeshCurrent3 = null;
                        break;
                    case "monster":
                        if (zy < z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        g.DrawCircle(penMonster, x, zy, sizeVessel * 18.0 / 20.0);
                        if (zy > z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        name = string.IsNullOrEmpty(mo.name) ? "" : (string.IsNullOrWhiteSpace(mo.name) && Settings.Current.MarkWhitespaceNamesOnSpaceMap ? "<" + mo.name + ">" : mo.name);
                        g.DrawStringD(name, fontMonster, brushMonster, x, zy - fontMonster.Size * 3.0 - 2.0, drawFormat);
                        break;
                }
            }

            #endregion

            #region DRAW High priority named objects (anomalies)

            foreach (MapObjectNamed mo in SpaceMap.NamedObjects)
            {
                x = PointXToScreen(mo.Coordinates.X_Scr);
                zy = PointZToScreen(mo.Coordinates.Z_Scr) - mo.Coordinates.Y_Scr * screen_y_scale;
                z = PointZToScreen(mo.Coordinates.Z_Scr);

                if (!Settings.Current.UseYForNamed)
                    zy = z;

                switch (mo.TypeToString)
                {
                    case "anomaly":
                        if (zy < z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        g.FillSquare(brushAnomaly, x, zy, sizeAnomaly);
                        if (zy > z)
                            DrawSpaceMap_DrawHeightLine(g, penHeight, brushHeight, x, zy, z);
                        name = string.IsNullOrEmpty(mo.name) ? "" : (string.IsNullOrWhiteSpace(mo.name) && Settings.Current.MarkWhitespaceNamesOnSpaceMap ? "<" + mo.name + ">" : mo.name);
                        g.DrawStringD(name, fontAnomaly, brushAnomaly, x, zy - fontAnomaly.Size * 3.0 - 2.0, drawFormat);
                        break;
                }
            }

            #endregion

            #region DRAW Selection brackets

            Pen penSelection = new Pen(Settings.Current.GetColor(MapColors.MapSelection));
            ListObjectsToDispose.Add(penSelection);
            Pen penSelectionDark = new Pen(Settings.Current.GetColor(MapColors.MapSelectionDark));
            ListObjectsToDispose.Add(penSelectionDark);
            sizeSelection = 10 + 1500 * GetMapScale();
            sizeSelection = sizeSelection > 40 ? 40 : sizeSelection;

            if (SpaceMap.SelectionNameless != null)
            {
                x = PointXToScreen(SpaceMap.SelectionNameless.CoordinatesStart.X_Scr);
                zy = PointZToScreen(SpaceMap.SelectionNameless.CoordinatesStart.Z_Scr) - SpaceMap.SelectionNameless.CoordinatesStart.Y_Scr * screen_y_scale;
                z = PointZToScreen(SpaceMap.SelectionNameless.CoordinatesStart.Z_Scr);
                xe = PointXToScreen(SpaceMap.SelectionNameless.CoordinatesEnd.X_Scr);
                zye = PointZToScreen(SpaceMap.SelectionNameless.CoordinatesEnd.Z_Scr) - SpaceMap.SelectionNameless.CoordinatesEnd.Y_Scr * screen_y_scale;
                ze = PointZToScreen(SpaceMap.SelectionNameless.CoordinatesEnd.Z_Scr);
                radius1 = (SpaceMap.SelectionNameless.radius + SpaceMap.SelectionNameless.randomRange) * GetMapScale();
                radius2 = SpaceMap.SelectionNameless.radius * GetMapScale();
                radius3 = radius2 * 2 - radius1;

                angleStart = SpaceMap.SelectionNameless.A_Start_deg ?? 0.0;
                angleEnd = SpaceMap.SelectionNameless.A_End_deg ?? 360.0;
                if (angleStart > angleEnd)
                {
                    double tmp = angleEnd;
                    angleEnd = angleStart;
                    angleStart = tmp;
                }
                angleEnd = angleEnd - angleStart;
                angleStart = angleStart - 90;

                //if (!_use_y_for_nameless)
                if (true)
                {
                    zy = z;
                    zye = ze;
                }

                if (SpaceMap.SelectionNameless.radius > 0)
                {
                    if (SpaceMap.SelectionNameless.A_Start_deg == null && SpaceMap.SelectionNameless.A_End_deg == null)
                    {
                        g.DrawCircle(penSelection, x, zy, radius2 * 2.0);
                    }
                    else
                    {
                        //Dark circle
                        g.DrawCircle(penSelectionDark, x, zy, radius2 * 2.0);
                        //Bright arc
                        g.DrawCircleArc(penSelection, x, zy, radius2 * 2.0, angleStart, angleEnd);
                        //Lines that show the arc boundaries
                        g.DrawLineD(penSelection, x, zy, x - (radius1 + sizeSelection * 1.5) * Math.Sin(Math.PI * 3.0 / 2.0 - angleStart / 360.0 * Math.PI * 2.0),
                                                        zy - (radius1 + sizeSelection * 1.5) * Math.Cos(Math.PI * 3.0 / 2.0 - angleStart / 360.0 * Math.PI * 2.0));
                        g.DrawLineD(penSelection, x, zy, x - (radius1 + sizeSelection * 1.5) * Math.Sin(Math.PI * 3.0 / 2.0 - (angleStart + angleEnd) / 360.0 * Math.PI * 2.0),
                                                        zy - (radius1 + sizeSelection * 1.5) * Math.Cos(Math.PI * 3.0 / 2.0 - (angleStart + angleEnd) / 360.0 * Math.PI * 2.0));
                        //Angles on the end of the arc boundaries
                        g.DrawLineD(penSelection,
                             x - (radius1 + sizeSelection * 1.5) * Math.Sin(Math.PI * 3.0 / 2.0 - angleStart / 360.0 * Math.PI * 2.0),
                            zy - (radius1 + sizeSelection * 1.5) * Math.Cos(Math.PI * 3.0 / 2.0 - angleStart / 360.0 * Math.PI * 2.0),
                             x - (radius1 + sizeSelection * 1.5) * Math.Sin(Math.PI * 3.0 / 2.0 - angleStart / 360.0 * Math.PI * 2.0) + sizeSelection / 4.0 * Math.Sin(Math.PI * 4.0 / 2.0 - angleStart / 360.0 * Math.PI * 2.0),
                            zy - (radius1 + sizeSelection * 1.5) * Math.Cos(Math.PI * 3.0 / 2.0 - angleStart / 360.0 * Math.PI * 2.0) + sizeSelection / 4.0 * Math.Cos(Math.PI * 4.0 / 2.0 - angleStart / 360.0 * Math.PI * 2.0));
                        g.DrawLineD(penSelection,
                             x - (radius1 + sizeSelection * 1.5) * Math.Sin(Math.PI * 3.0 / 2.0 - (angleStart + angleEnd) / 360.0 * Math.PI * 2.0),
                            zy - (radius1 + sizeSelection * 1.5) * Math.Cos(Math.PI * 3.0 / 2.0 - (angleStart + angleEnd) / 360.0 * Math.PI * 2.0),
                             x - (radius1 + sizeSelection * 1.5) * Math.Sin(Math.PI * 3.0 / 2.0 - (angleStart + angleEnd) / 360.0 * Math.PI * 2.0) + sizeSelection / 4.0 * Math.Sin(Math.PI * 2.0 / 2.0 - (angleStart + angleEnd) / 360.0 * Math.PI * 2.0),
                            zy - (radius1 + sizeSelection * 1.5) * Math.Cos(Math.PI * 3.0 / 2.0 - (angleStart + angleEnd) / 360.0 * Math.PI * 2.0) + sizeSelection / 4.0 * Math.Cos(Math.PI * 2.0 / 2.0 - (angleStart + angleEnd) / 360.0 * Math.PI * 2.0));
                    }

                    if (SpaceMap.SelectionNameless.randomRange > 0)
                    {
                        g.DrawCircle(penSelectionDark, x, zy, radius1 * 2.0);
                        if (radius3 > 0)
                            g.DrawCircle(penSelectionDark, x, zy, radius3 * 2.0);
                    }
                    //Crosshair on the rad2 of the circle
                    g.DrawLineD(penSelection, x, zy - radius2, x, zy - radius2 - sizeSelection / 2.0);
                    g.DrawLineD(penSelection, x, zy + radius2, x, zy + radius2 + sizeSelection / 2.0);
                    g.DrawLineD(penSelection, x - radius2, zy, x - radius2 - sizeSelection / 2.0, zy);
                    g.DrawLineD(penSelection, x + radius2, zy, x + radius2 + sizeSelection / 2.0, zy);
                }
                else
                {
                    //Get angle from start to end
                    // Negate X and Y values
                    double pxRes = x - xe;
                    double pyRes = zy - zye;
                    double angleSpan = 0.0;
                    // Calculate the angle
                    if (pxRes == 0.0)
                    {
                        if (pyRes == 0.0) angleSpan = 0.0;
                        else
                            if (pyRes > 0.0) angleSpan = System.Math.PI / 2.0;
                            else angleSpan = System.Math.PI * 3.0 / 2.0;
                    }
                    else if (pyRes == 0.0)
                    {
                        if (pxRes > 0.0) angleSpan = 0.0;
                        else angleSpan = System.Math.PI;
                    }
                    else
                    {
                        if (pxRes < 0.0)
                            angleSpan = System.Math.Atan(pyRes / pxRes) + System.Math.PI;
                        else
                            if (pyRes < 0.0) angleSpan = System.Math.Atan(pyRes / pxRes) + (2 * System.Math.PI);
                            else angleSpan = System.Math.Atan(pyRes / pxRes);
                    }

                    double angleLeft = (angleSpan - Math.PI / 2.0) * 360.0 / 2.0 / Math.PI;
                    double angleRight = (angleSpan + Math.PI / 2.0) * 360.0 / 2.0 / Math.PI;
                    while (angleLeft < 0.0) angleLeft += 360.0;
                    while (angleRight < 0.0) angleRight += 360.0;
                    while (angleLeft >= 360.0) angleLeft -= 360.0;
                    while (angleRight > 360.0) angleRight -= 360.0;

                    g.DrawLineD(penSelection, x, zy, xe, zye);
                    if (SpaceMap.SelectionNameless.randomRange > 0)
                    {
                        g.DrawLineD(penSelectionDark,
                              x + radius1 * Math.Cos(angleSpan + Math.PI / 2.0),
                             zy + radius1 * Math.Sin(angleSpan + Math.PI / 2.0),
                             xe + radius1 * Math.Cos(angleSpan + Math.PI / 2.0),
                            zye + radius1 * Math.Sin(angleSpan + Math.PI / 2.0));
                        g.DrawLineD(penSelectionDark,
                              x - radius1 * Math.Cos(angleSpan + Math.PI / 2.0),
                             zy - radius1 * Math.Sin(angleSpan + Math.PI / 2.0),
                             xe - radius1 * Math.Cos(angleSpan + Math.PI / 2.0),
                            zye - radius1 * Math.Sin(angleSpan + Math.PI / 2.0));
                        if (radius1 >= 1.0)
                        {
                            g.DrawCircleArc(penSelectionDark, x, zy, radius1 * 2.0, angleLeft, 180.0);
                            g.DrawCircleArc(penSelectionDark, xe, zye, radius1 * 2.0, angleRight, 180.0);
                        }
                    }

                    g.DrawLineD(penSelection, x, zy - radius2, x, zy - radius2 - sizeSelection / 2.0);
                    g.DrawLineD(penSelection, x, zy + radius2, x, zy + radius2 + sizeSelection / 2.0);
                    g.DrawLineD(penSelection, x - radius2, zy, x - radius2 - sizeSelection / 2.0, zy);
                    g.DrawLineD(penSelection, x + radius2, zy, x + radius2 + sizeSelection / 2.0, zy);
                    g.DrawLineD(penSelectionDark, xe, zye - radius2, xe, zye - radius2 - sizeSelection / 2.0);
                    g.DrawLineD(penSelectionDark, xe, zye + radius2, xe, zye + radius2 + sizeSelection / 2.0);
                    g.DrawLineD(penSelectionDark, xe - radius2, zye, xe - radius2 - sizeSelection / 2.0, zye);
                    g.DrawLineD(penSelectionDark, xe + radius2, zye, xe + radius2 + sizeSelection / 2.0, zye);
                }
            }
            else
            {
                foreach (MapObjectNamed mo in SpaceMap.GetSelectionNamed())
                {
                    x = PointXToScreen(mo.Coordinates.X_Scr);
                    zy = PointZToScreen(mo.Coordinates.Z_Scr) - mo.Coordinates.Y_Scr * screen_y_scale;
                    z = PointZToScreen(mo.Coordinates.Z_Scr);

                    if (!Settings.Current.UseYForNamed)
                        zy = z;

                    switch (mo.TypeToString)
                    {
                        case "anomaly":
                            g.DrawSquare(penSelection, x, zy, 20 + sizeAnomaly);
                            break;
                        case "blackHole":
                            g.DrawSquare(penSelection, x, zy, sizeNamelessBlackholeOuter * 36.0 / 32);
                            break;
                        default:
                            g.DrawSquare(penSelection, x, zy, sizeSelection);
                            break;
                    }
                }
            }

            #endregion

            #region DRAW Selection mean point and selection rectangle

            int vecx, vecy, vecz;
            if (SpaceMap.Selection_GetCenterOfMass(out vecx, out vecy, out vecz))
            {
                x = PointXToScreen(vecx);
                zy = PointZToScreen(vecz) - vecy * screen_y_scale;
                z = PointZToScreen(vecz);

                g.DrawLineD(penSelectionDark, x, z - sizeSelection / 2.0, x, z + sizeSelection / 2.0);
                g.DrawLineD(penSelectionDark, x - sizeSelection / 2.0, z, x + sizeSelection / 2.0, z);
            }

            //7. Draw selection rectangle when mass-selecting
            Brush brushSelectionRectangle = Settings.Current.GetBrush(MapColors.MapSelectionRectangle);
            ListObjectsToDispose.Add(brushSelectionRectangle);
            Pen penSelectionRectangle = new Pen(brushSelectionRectangle);
            ListObjectsToDispose.Add(penSelectionRectangle);

            if (GetFocused() && _beingSelected && (_curPointX != _selectPointX || _curPointY != _selectPointY))
            {
                xe = Math.Max(_curPointX, _selectPointX);
                ze = Math.Max(_curPointY, _selectPointY);
                x = Math.Min(_curPointX, _selectPointX);
                z = Math.Min(_curPointY, _selectPointY);

                g.DrawRectangleD(penSelectionRectangle, x, z, xe - x, ze - z);
            }

            #endregion

            #region DRAW Special Object

            if (SpaceMap.SelectionSpecial is SpecialMapObject_DestroyCircle)
            {
                SpecialMapObject_DestroyCircle item = (SpecialMapObject_DestroyCircle)SpaceMap.SelectionSpecial;
                Brush brushHeightSpecial = new HatchBrush(HatchStyle.WideDownwardDiagonal, penHeight.Color);
                ListObjectsToDispose.Add(brushHeightSpecial);
                Pen penHeightSpecial = new Pen(brushHeightSpecial);
                ListObjectsToDispose.Add(penHeightSpecial);

                x = PointXToScreen(item.Coordinates.X_Scr);
                zy = PointZToScreen(item.Coordinates.Z_Scr) - item.Coordinates.Y_Scr * screen_y_scale;
                z = PointZToScreen(item.Coordinates.Z_Scr);
                radius2 = item.Radius * GetMapScale();

                if (!Settings.Current.UseYForSelection)
                    zy = z;

                if (zy < z)
                {
                    g.DrawLineD(penHeightSpecial, x - radius2, zy, x - radius2, z);
                    g.DrawLineD(penHeightSpecial, x + radius2, zy, x + radius2, z);
                }
                //Crosshair at the middle of the bg circle
                g.DrawLineD(penDarkHeight, x, z - sizeSelection / 4.0, x, z + sizeSelection / 4.0);
                g.DrawLineD(penDarkHeight, x - sizeSelection / 4.0, z, x + sizeSelection / 4.0, z);
                //Line from the middle of zy to the middle of the z
                g.DrawLineD(penHeightSpecial, x, zy, x, z);
                //Circle
                g.DrawCircle(penSelection, x, zy, radius2 * 2.0);
                //Crosshair around the radius
                g.DrawLineD(penSelection, x, zy - radius2, x, zy - radius2 - sizeSelection / 2.0);
                g.DrawLineD(penSelection, x, zy + radius2, x, zy + radius2 + sizeSelection / 2.0);
                g.DrawLineD(penSelection, x - radius2, zy, x - radius2 - sizeSelection / 2.0, zy);
                g.DrawLineD(penSelection, x + radius2, zy, x + radius2 + sizeSelection / 2.0, zy);
                //Crosshair at the middle of the circle
                g.DrawLineD(penSelection, x, zy - sizeSelection / 4.0, x, zy + sizeSelection / 4.0);
                g.DrawLineD(penSelection, x - sizeSelection / 4.0, zy, x + sizeSelection / 4.0, zy);
                if (zy > z)
                {
                    g.DrawLineD(penHeightSpecial, x - radius2, zy, x - radius2, z);
                    g.DrawLineD(penHeightSpecial, x + radius2, zy, x + radius2, z);
                }
                //y circle
                if (Settings.Current.UseYForSelection && radius2 >= 1.0)
                {
                    int num = 36;
                    for (i = 0; i < num; i++)
                        g.DrawCircleArc(penHeight, x, z, radius2 * 2.0, i * 360.0 / num, 360.0 / num / 4.0);
                }
            }

            if (SpaceMap.SelectionSpecial is SpecialMapObject_PointTarget)
            {
                SpecialMapObject_PointTarget item = (SpecialMapObject_PointTarget)SpaceMap.SelectionSpecial;
                Brush brushHeightSpecial = new HatchBrush(HatchStyle.WideDownwardDiagonal, penHeight.Color);
                ListObjectsToDispose.Add(brushHeightSpecial);
                Pen penHeightSpecial = new Pen(brushHeightSpecial);
                ListObjectsToDispose.Add(penHeightSpecial);

                x = PointXToScreen(item.Coordinates.X_Scr);
                zy = PointZToScreen(item.Coordinates.Z_Scr) - item.Coordinates.Y_Scr * screen_y_scale;
                z = PointZToScreen(item.Coordinates.Z_Scr);

                if (!Settings.Current.UseYForSelection)
                    zy = z;

                //Crosshair at the middle of the bg circle
                g.DrawLineD(penDarkHeight, x, z - sizeSelection / 4.0, x, z + sizeSelection / 4.0);
                g.DrawLineD(penDarkHeight, x - sizeSelection / 4.0, z, x + sizeSelection / 4.0, z);
                //Line from the middle of zy to the middle of the z
                g.DrawLineD(penHeightSpecial, x, zy, x, z);
                //Crosshair at the middle of the circle
                g.DrawLineD(penSelection, x, zy - sizeSelection / 4.0, x, zy + sizeSelection / 4.0);
                g.DrawLineD(penSelection, x - sizeSelection / 4.0, zy, x + sizeSelection / 4.0, zy);
            }

            if (SpaceMap.SelectionSpecial is SpecialMapObject_BoxSphere)
            {
                SpecialMapObject_BoxSphere item = (SpecialMapObject_BoxSphere)SpaceMap.SelectionSpecial;
                Brush brushHeightSpecial = new HatchBrush(HatchStyle.WideDownwardDiagonal, penHeight.Color);
                ListObjectsToDispose.Add(brushHeightSpecial);
                Pen penHeightSpecial = new Pen(brushHeightSpecial);
                ListObjectsToDispose.Add(penHeightSpecial);

                if (item.SphereBox == SphereBox.Sphere)
                {
                    x = PointXToScreen(item.CoordinatesStart.X_Scr);
                    zy = PointZToScreen(item.CoordinatesStart.Z_Scr) - item.CoordinatesStart.Y_Scr * screen_y_scale;
                    z = PointZToScreen(item.CoordinatesStart.Z_Scr);
                    radius2 = item.Radius * GetMapScale();
                    radius3 = sizeSelection / 2 > radius2 / 2 && item.InOut == InsideOutside.Outside ? radius2 / 2 : sizeSelection / 2;
                    radius3 = item.InOut == InsideOutside.Inside ? radius3 : -radius3;

                    if (!Settings.Current.UseYForSelection)
                        zy = z;

                    if (zy < z)
                    {
                        g.DrawLineD(penHeightSpecial, x - radius2, zy, x - radius2, z);
                        g.DrawLineD(penHeightSpecial, x + radius2, zy, x + radius2, z);
                    }
                    //Crosshair at the middle of the bg circle
                    g.DrawLineD(penDarkHeight, x, z - sizeSelection / 4.0, x, z + sizeSelection / 4.0);
                    g.DrawLineD(penDarkHeight, x - sizeSelection / 4.0, z, x + sizeSelection / 4.0, z);
                    //Line froDm the middle of zy to the middle of the z
                    g.DrawLineD(penHeightSpecial, x, zy, x, z);
                    //Circle
                    g.DrawCircle(penSelection, x, zy, radius2 * 2.0);
                    //Crosshair around the radius
                    g.DrawLineD(penSelection, x, zy - radius2, x, zy - radius2 - radius3);
                    g.DrawLineD(penSelection, x, zy + radius2, x, zy + radius2 + radius3);
                    g.DrawLineD(penSelection, x - radius2, zy, x - radius2 - radius3, zy);
                    g.DrawLineD(penSelection, x + radius2, zy, x + radius2 + radius3, zy);
                    //Crosshair at the middle of the circle
                    g.DrawLineD(penSelection, x, zy - sizeSelection / 4.0, x, zy + sizeSelection / 4.0);
                    g.DrawLineD(penSelection, x - sizeSelection / 4.0, zy, x + sizeSelection / 4.0, zy);
                    if (zy > z)
                    {
                        g.DrawLineD(penHeightSpecial, x - radius2, zy, x - radius2, z);
                        g.DrawLineD(penHeightSpecial, x + radius2, zy, x + radius2, z);
                    }
                    //y circle
                    if (Settings.Current.UseYForSelection && radius2 >= 1.0)
                    {
                        int num = 36;
                        for (i = 0; i < num; i++)
                            g.DrawCircleArc(penHeight, x, z, radius2 * 2.0, i * 360.0 / num, 360.0 / num / 4.0);
                    }
                }
                else
                {
                    x = PointXToScreen(Math.Min(item.CoordinatesStart.X_Scr, item.CoordinatesEnd.X_Scr));
                    z = PointZToScreen(Math.Min(item.CoordinatesStart.Z_Scr, item.CoordinatesEnd.Z_Scr));
                    xe = PointXToScreen(Math.Max(item.CoordinatesStart.X_Scr, item.CoordinatesEnd.X_Scr));
                    ze = PointZToScreen(Math.Max(item.CoordinatesStart.Z_Scr, item.CoordinatesEnd.Z_Scr));
                    radius2 = 3.5;
                    radius3 = sizeSelection / 2 > Math.Min(xe - x, ze - z) / 2 && item.InOut == InsideOutside.Outside ? Math.Min(xe - x, ze - z) / 2 : sizeSelection / 2;
                    radius3 = item.InOut == InsideOutside.Inside ? radius3 : -radius3;

                    g.DrawRectangleD(penSelection, x, z, xe - x, ze - z);

                    g.DrawLineD(penSelection, x, z / 2.0 + ze / 2.0, x - radius3, z / 2.0 + ze / 2.0);
                    g.DrawLineD(penSelection, x / 2.0 + xe / 2.0, z, x / 2.0 + xe / 2.0, z - radius3);
                    g.DrawLineD(penSelection, xe, z / 2 + ze / 2.0, xe + radius3, z / 2.0 + ze / 2.0);
                    g.DrawLineD(penSelection, x / 2.0 + xe / 2.0, ze, x / 2.0 + xe / 2.0, ze + radius3);

                    x = PointXToScreen(item.CoordinatesStart.X_Scr);
                    z = PointZToScreen(item.CoordinatesStart.Z_Scr);
                    xe = PointXToScreen(item.CoordinatesEnd.X_Scr);
                    ze = PointZToScreen(item.CoordinatesEnd.Z_Scr);

                    g.DrawCircle(penSelection, x, z, radius2 * 2.0);
                    g.DrawSquare(penSelection, xe, ze, radius2 * 2.0);
                }
            }
            #endregion

            #region Dispose
            foreach (IDisposable objectToDispose in ListObjectsToDispose)
                objectToDispose.Dispose();
            #endregion
        }
Exemplo n.º 5
0
 public override void Draw(Graphics g, float x, float y)
 {
     g.FillCircle(brush, x, y, Radius);
 }