예제 #1
0
        static public bool draw_latlong_raster(latlong_class center, latlong_class latlong1, latlong_class latlong2, Vector2 offset, double zoom, double current_zoom, int resolution, Rect screen, Color color, int width)
        {
            // map_latlong_center
            bool    result  = true;
            Vector2 vector  = Mathw.latlong_to_pixel(latlong1, center, current_zoom, new Vector2(screen.width, screen.height));
            Vector2 vector2 = Mathw.latlong_to_pixel(latlong2, center, current_zoom, new Vector2(screen.width, screen.height));
            Vector2 vector3 = vector2 - vector;

            vector  += new Vector2(-offset.x, offset.y);
            vector2 += new Vector2(-offset.x, offset.y);
            double num  = Mathf.Pow(2, (float)(zoom - current_zoom));
            float  num2 = (float)(resolution / num);

            if (Mathf.Abs(Mathf.Round(vector3.x / num2) - vector3.x / num2) > 0.01f || Mathf.Abs(Mathf.Round(vector3.y / num2) - vector3.y / num2) > 0.01f)
            {
                result = false;
                color  = Color.red;
            }
            for (float num3 = vector.x; num3 < vector.x + vector3.x; num3 += num2)
            {
                Drawing_tc1.DrawLine(new Vector2(num3, vector.y), new Vector2(num3, vector2.y), color, width, false, screen);
            }
            for (float num4 = vector.y; num4 < vector.y + vector3.y; num4 += num2)
            {
                Drawing_tc1.DrawLine(new Vector2(vector.x, num4), new Vector2(vector2.x, num4), color, width, false, screen);
            }
            return(result);
        }
예제 #2
0
 static public void DrawRect(Rect rect, Color color, float width, Rect screen)
 {
     Drawing_tc1.DrawLine(new Vector2(rect.xMin, rect.yMin), new Vector2(rect.xMax, rect.yMin), color, width, false, screen);
     Drawing_tc1.DrawLine(new Vector2(rect.xMin, rect.yMin), new Vector2(rect.xMin, rect.yMax), color, width, false, screen);
     Drawing_tc1.DrawLine(new Vector2(rect.xMin, rect.yMax), new Vector2(rect.xMax, rect.yMax), color, width, false, screen);
     Drawing_tc1.DrawLine(new Vector2(rect.xMax, rect.yMin), new Vector2(rect.xMax, rect.yMax), color, width, false, screen);
 }
예제 #3
0
 static public void drawJoinNode(Rect rect, int length, string text, float fontSize, bool label2, float labelHeight, Color backgroundColor, Color highlightColor, Color highlightColor2, Color textColor, bool border, int width, Rect screen, bool select, Color select_color, bool active, float zoom)
 {
     if (!select)
     {
         highlightColor  += new Color(-0.3f, -0.3f, -0.3f);
         highlightColor2 += new Color(-0.3f, -0.3f, -0.3f);
     }
     GUI.color = highlightColor;
     for (int i = 0; i < length; i++)
     {
         EditorGUI.DrawPreviewTexture(new Rect(rect.x, rect.y + i * zoom, rect.width, labelHeight), tex2);
     }
     for (int i = 0; i < length; i++)
     {
         if (i < length - 1)
         {
             Drawing_tc1.DrawLine(new Vector2(rect.x, rect.y + (i + 1) * zoom), new Vector2(rect.xMax, rect.y + (i + 1) * zoom), highlightColor, width, false, screen);
         }
     }
     drawText(rect, text, false, textColor, new Color(0.1f, 0.1f, 0.1f, 1), fontSize, true, 6);
     if (border)
     {
         DrawRect(new Rect(rect.x, rect.y, rect.width, (float)length * zoom), highlightColor, width, screen);
     }
     GUI.color = Color.white;
 }
예제 #4
0
        static public void draw_arrow(Vector2 point1, int length, int length_arrow, float rotation, Color color, int width, Rect screen)
        {
            length_arrow = (int)(Mathf.Sqrt(2f) * length_arrow);
            Vector2 vector  = Mathw.calc_rotation_pixel(point1.x, point1.y - length, point1.x, point1.y, rotation);
            Vector2 pointB  = Mathw.calc_rotation_pixel(vector.x - length_arrow, vector.y - length_arrow, vector.x, vector.y, -180 + rotation);
            Vector2 pointB2 = Mathw.calc_rotation_pixel(vector.x + length_arrow, vector.y - length_arrow, vector.x, vector.y, 180 + rotation);

            Drawing_tc1.DrawLine(point1, vector, color, width, false, screen);
            Drawing_tc1.DrawLine(vector, pointB, color, width, false, screen);
            Drawing_tc1.DrawLine(vector, pointB2, color, width, false, screen);
        }
예제 #5
0
        static public void draw_grid(Rect rect, int tile_x, int tile_y, Color color, int width, Rect screen)
        {
            Vector2 vector = new Vector2();

            vector.x = rect.width / tile_x;
            vector.y = rect.height / tile_y;
            for (float num = rect.x; num <= rect.xMax + vector.x / 2; num += vector.x)
            {
                Drawing_tc1.DrawLine(new Vector2(num, rect.y), new Vector2(num, rect.yMax), color, width, false, screen);
            }
            for (float num2 = rect.y; num2 <= rect.yMax + vector.y / 2; num2 += vector.y)
            {
                Drawing_tc1.DrawLine(new Vector2(rect.x, num2), new Vector2(rect.xMax, num2), color, width, false, screen);
            }
        }
예제 #6
0
        static public void draw_scale_grid(Rect rect, Vector2 offset, float zoom, float scale, Color color, int width, bool draw_center, Rect screen)
        {
            Vector2 vector = new Vector2(screen.width, screen.height) / 2 + offset;
            float   num2   = vector.x - rect.x;
            float   num3   = vector.y - rect.y;
            int     num4   = (int)(num2 / zoom);

            num4 = (int)(num2 - num4 * zoom);
            num4 = (int)(num4 + rect.x);
            int num5 = Mathw.calc_rest_value((vector.x - num4) / zoom, 10);

            if (num5 < 0)
            {
                num5 = -9 - num5;
            }
            else
            {
                num5 = 9 - num5;
            }
            int num7 = (int)(num3 / zoom);

            num7 = (int)(num3 - num7 * zoom);
            num7 = (int)(num7 + rect.y);
            for (float num8 = num4; num8 <= rect.xMax; num8 += zoom)
            {
                Drawing_tc1.DrawLine(new Vector2(num8, rect.y), new Vector2(num8, rect.yMax), color, width, false, screen);
                if (num5 > 9)
                {
                    num5 = 0;
                }
                num5++;
            }
            for (float num9 = num7; num9 <= rect.yMax; num9 += zoom)
            {
                Drawing_tc1.DrawLine(new Vector2(rect.x, num9), new Vector2(rect.xMax, num9), color, width, false, screen);
            }
            if (draw_center)
            {
                Drawing_tc1.DrawLine(new Vector2(vector.x, rect.y), new Vector2(vector.x, rect.yMax), color, width + 2, false, screen);
                Drawing_tc1.DrawLine(new Vector2(rect.x, vector.y), new Vector2(rect.xMax, vector.y), color, width + 2, false, screen);
            }
        }
예제 #7
0
        static public bool drawGUIBox(Rect rect, edit_class edit, float fontSize, bool label2, float labelHeight, Color backgroundColor, Color highlightColor, Color highlightColor2, Color textColor, bool border, int width, Rect screen, bool select, Color select_color, bool active)
        {
            if (!select)
            {
                highlightColor  += new Color(-0.3f, -0.3f, -0.3f);
                highlightColor2 += new Color(-0.3f, -0.3f, -0.3f);
            }
            GUI.color = highlightColor;
            EditorGUI.DrawPreviewTexture(new Rect(rect.x, rect.y, rect.width, labelHeight), tex2);
            bool result = drawText(rect, edit, false, textColor, new Color(0.1f, 0.1f, 0.1f, 1), fontSize, true, 6);

            if (label2)
            {
                GUI.color = highlightColor2;
                EditorGUI.DrawPreviewTexture(new Rect(rect.x, rect.yMax - labelHeight, rect.width, labelHeight), tex2);
                GUI.color = Color.white;
                if (!active)
                {
                    Drawing_tc1.DrawLine(new Vector2(rect.x + 1, rect.y + labelHeight + 1), new Vector2(rect.xMax - 1, rect.yMax - labelHeight - 1), new Color(1, 0, 0, 0.7f), 3, false, screen);
                    Drawing_tc1.DrawLine(new Vector2(rect.x + 1, rect.yMax - labelHeight - 1), new Vector2(rect.xMax - 1, rect.y + labelHeight + 1), new Color(1, 0, 0, 0.7f), 3, false, screen);
                }
            }
            else if (!active)
            {
                Drawing_tc1.DrawLine(new Vector2(rect.x + 1, rect.y + labelHeight + 1), new Vector2(rect.xMax - 1, rect.yMax - 1), new Color(1, 0, 0, 0.7f), 3, false, screen);
                Drawing_tc1.DrawLine(new Vector2(rect.x + 1, rect.yMax - 1), new Vector2(rect.xMax - 1, rect.y + labelHeight + 1), new Color(1, 0, 0, 0.7f), 3, false, screen);
            }
            if (border)
            {
                DrawRect(rect, highlightColor, width, screen);
                Drawing_tc1.DrawLine(new Vector2(rect.x, rect.y + labelHeight), new Vector2(rect.xMax, rect.y + labelHeight), highlightColor, width, false, screen);
                if (label2)
                {
                    Drawing_tc1.DrawLine(new Vector2(rect.x, rect.yMax - labelHeight), new Vector2(rect.xMax, rect.yMax - labelHeight), highlightColor, width, false, screen);
                }
            }
            GUI.color = Color.white;
            return(result);
        }