Exemple #1
0
        //Draw the actual map texture
        private void mapDraw(int id)
        {
            MapTexture = bigmap.getPartialMap();

            GUILayout.Label("", GUILayout.Width(MapTexture.width), GUILayout.Height(MapTexture.height));

            TextureRect        = GUILayoutUtility.GetLastRect();
            TextureRect.width  = bigmap.MapWidth;
            TextureRect.height = bigmap.MapHeight;

            if (drawGrid)
            {
                gridLines = new Dictionary <int, List <List <Vector2d> > >();
                gridLines = SCANuiUtil.drawGridLine(TextureRect, bigmap);
                drawGrid  = false;
            }

            GUI.DrawTexture(TextureRect, MapTexture);

            if (bigmap.Projection == MapProjection.Polar)
            {
                rc.x = TextureRect.x + TextureRect.width / 2 - TextureRect.width / 8;
                rc.y = TextureRect.y + TextureRect.height / 8;
                SCANuiUtil.drawLabel(rc, "S", false, true, true);
                rc.x = TextureRect.x + TextureRect.width / 2 + TextureRect.width / 8;
                SCANuiUtil.drawLabel(rc, "N", false, true, true);
            }

            if (SCANcontroller.controller.map_grid)
            {
                if (gridLines.Count > 0)
                {
                    GL.PushMatrix();
                    foreach (List <Vector2d> points in gridLines[0])
                    {
                        SCANuiUtil.drawGridLines(points, bigmap.MapWidth, TextureRect.x, TextureRect.y, SCANuiUtil.blackLineColor);
                    }
                    foreach (List <Vector2d> points in gridLines[1])
                    {
                        SCANuiUtil.drawGridLines(points, bigmap.MapWidth, TextureRect.x, TextureRect.y, SCANuiUtil.lineColor);
                    }
                    GL.PopMatrix();
                }
            }
        }
        private void mapDraw(int id)
        {
            MapTexture = bigmap.getPartialMap();

            //A blank label used as a template for the actual map texture
            if (IsResizing)
            {
                //Set minimum map size during re-sizing
                dW = resizeW;
                if (dW < WindowSize_Min.x)
                {
                    dW = WindowSize_Min.x;
                }
                dH = dW / 2f;
                GUILayout.Label("", GUILayout.Width(dW), GUILayout.Height(dH));
            }
            else
            {
                GUILayout.Label("", GUILayout.Width(MapTexture.width), GUILayout.Height(MapTexture.height));
            }

            TextureRect        = GUILayoutUtility.GetLastRect();
            TextureRect.width  = bigmap.MapWidth;
            TextureRect.height = bigmap.MapHeight;

            //Generate the grid lines
            if (drawGrid)
            {
                gridLines = new Dictionary <int, List <List <Vector2d> > >();
                gridLines = SCANuiUtil.drawGridLine(TextureRect, bigmap);
                drawGrid  = false;
            }

            //Stretches the existing map while re-sizing
            if (IsResizing)
            {
                TextureRect.width  = dW;
                TextureRect.height = dH;
                GUI.DrawTexture(TextureRect, MapTexture, ScaleMode.StretchToFill);
            }
            else
            {
                GUI.DrawTexture(TextureRect, MapTexture);
            }

            //Add the North/South labels to the polar projection
            if (bigmap.Projection == MapProjection.Polar)
            {
                rc.x = TextureRect.x + TextureRect.width / 2 - TextureRect.width / 8;
                rc.y = TextureRect.y + TextureRect.height / 8;
                SCANuiUtil.drawLabel(rc, "S", false, true, true);
                rc.x = TextureRect.x + TextureRect.width / 2 + TextureRect.width / 8;
                SCANuiUtil.drawLabel(rc, "N", false, true, true);
            }

            if (SCANcontroller.controller.map_grid && !IsResizing)
            {
                if (gridLines.Count > 0)
                {
                    GL.PushMatrix();
                    foreach (List <Vector2d> points in gridLines[0])
                    {
                        SCANuiUtil.drawGridLines(points, bigmap.MapWidth, TextureRect.x, TextureRect.y, SCANuiUtil.blackLineColor);
                    }
                    foreach (List <Vector2d> points in gridLines[1])
                    {
                        SCANuiUtil.drawGridLines(points, bigmap.MapWidth, TextureRect.x, TextureRect.y, SCANuiUtil.lineColor);
                    }
                    GL.PopMatrix();
                }
            }

            //Draw the orbit overlays
            if (SCANcontroller.controller.map_orbit)
            {
                SCANuiUtil.drawOrbit(TextureRect, bigmap, v, bigmap.Body);
            }
        }