Esempio n. 1
0
    public override bool draw_latlong_raster(latlong_class latlong1, latlong_class latlong2, Vector2 offset, double zoom, double current_zoom, int resolution, Rect screen, Color color, int width)
    {
        bool    result  = true;
        Vector2 vector  = this.latlong_to_pixel(latlong1, this.map_latlong_center, current_zoom, new Vector2(screen.width, screen.height));
        Vector2 a       = this.latlong_to_pixel(latlong2, this.map_latlong_center, current_zoom, new Vector2(screen.width, screen.height));
        Vector2 vector2 = a - vector;

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

        if (Mathf.Abs(Mathf.Round(vector2.x / num2) - vector2.x / num2) > 0.01f || Mathf.Abs(Mathf.Round(vector2.y / num2) - vector2.y / num2) > 0.01f)
        {
            result = false;
            color  = Color.red;
        }
        for (float num3 = vector.x; num3 < vector.x + vector2.x; num3 += num2)
        {
            Drawing_tc1.DrawLine(new Vector2(num3, vector.y), new Vector2(num3, a.y), color, (float)width, false, screen);
        }
        for (float num4 = vector.y; num4 < vector.y + vector2.y; num4 += num2)
        {
            Drawing_tc1.DrawLine(new Vector2(vector.x, num4), new Vector2(a.x, num4), color, (float)width, false, screen);
        }
        return(result);
    }
Esempio n. 2
0
 public override 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)
 {
     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++)
     {
     }
     for (int i = 0; i < length; i++)
     {
         if (i < length - 1)
         {
             Drawing_tc1.DrawLine(new Vector2(rect.x, rect.y + (float)(i + 1) * this.select_window.node_zoom), new Vector2(rect.xMax, rect.y + (float)(i + 1) * this.select_window.node_zoom), highlightColor, (float)width, false, screen);
         }
     }
     this.drawText(rect, text, false, textColor, new Color(0.1f, 0.1f, 0.1f, (float)1), fontSize, true, 6);
     if (border)
     {
         this.DrawRect(new Rect(rect.x, rect.y, rect.width, (float)length * this.select_window.node_zoom), highlightColor, (float)width, screen);
     }
     GUI.color = Color.white;
 }
Esempio n. 3
0
 public override 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);
 }
Esempio n. 4
0
    public static bool segment_rect_intersection(Rect bounds, Drawing_tc1.point_class p)
    {
        float num  = p.p2.x - p.p1.x;
        float num2 = 0f;

        Drawing_tc1.clip_class clip_class = new Drawing_tc1.clip_class((float)0, 1f);
        int arg_173_0;

        if (Drawing_tc1.clip_test(-num, p.p1.x - bounds.xMin, clip_class) && Drawing_tc1.clip_test(num, bounds.xMax - p.p1.x, clip_class))
        {
            num2 = p.p2.y - p.p1.y;
            if (Drawing_tc1.clip_test(-num2, p.p1.y - bounds.yMin, clip_class) && Drawing_tc1.clip_test(num2, bounds.yMax - p.p1.y, clip_class))
            {
                if (clip_class.u2 < 1f)
                {
                    p.p2.x = p.p1.x + clip_class.u2 * num;
                    p.p2.y = p.p1.y + clip_class.u2 * num2;
                }
                if (clip_class.u1 > (float)0)
                {
                    p.p1.x = p.p1.x + clip_class.u1 * num;
                    p.p1.y = p.p1.y + clip_class.u1 * num2;
                }
                arg_173_0 = 1;
                return(arg_173_0 != 0);
            }
        }
        arg_173_0 = 0;
        return(arg_173_0 != 0);
    }
Esempio n. 5
0
    public static void DrawLineWindows(Vector2 pointA, Vector2 pointB, Color color, float width, bool antiAlias)
    {
        Color     color2 = GUI.color;
        Matrix4x4 matrix = GUI.matrix;

        if (antiAlias)
        {
            width *= (float)3;
        }
        float   num       = Vector3.Angle(pointB - pointA, Vector2.right) * (float)((pointA.y > pointB.y) ? -1 : 1);
        float   magnitude = (pointB - pointA).magnitude;
        Vector3 vector    = new Vector3(pointA.x, pointA.y, (float)0);

        GUI.color  = color;
        GUI.matrix = Drawing_tc1.translationMatrix(vector) * GUI.matrix;
        GUIUtility.ScaleAroundPivot(new Vector2(magnitude, width), new Vector2(-0.5f, (float)0));
        GUI.matrix = Drawing_tc1.translationMatrix(-vector) * GUI.matrix;
        GUIUtility.RotateAroundPivot(num, new Vector2((float)0, (float)0));
        GUI.matrix = Drawing_tc1.translationMatrix(vector + new Vector3(width / (float)2, -magnitude / (float)2) * Mathf.Sin(num * 0.0174532924f)) * GUI.matrix;
        if (!antiAlias)
        {
            GUI.DrawTexture(new Rect((float)0, (float)0, (float)1, (float)1), Drawing_tc1.lineTex);
        }
        else
        {
            GUI.DrawTexture(new Rect((float)0, (float)0, (float)1, (float)1), Drawing_tc1.aaLineTex);
        }
        GUI.matrix = matrix;
        GUI.color  = color2;
    }
Esempio n. 6
0
    public override void draw_arrow(Vector2 point1, int length, int length_arrow, float rotation, Color color, int width, Rect screen)
    {
        length_arrow = (int)(Mathf.Sqrt(2f) * (float)length_arrow);
        Vector2 vector  = this.calc_rotation_pixel(point1.x, point1.y - (float)length, point1.x, point1.y, rotation);
        Vector2 pointB  = this.calc_rotation_pixel(vector.x - (float)length_arrow, vector.y - (float)length_arrow, vector.x, vector.y, (float)-180 + rotation);
        Vector2 pointB2 = this.calc_rotation_pixel(vector.x + (float)length_arrow, vector.y - (float)length_arrow, vector.x, vector.y, (float)180 + rotation);

        Drawing_tc1.DrawLine(point1, vector, color, (float)width, false, screen);
        Drawing_tc1.DrawLine(vector, pointB, color, (float)width, false, screen);
        Drawing_tc1.DrawLine(vector, pointB2, color, (float)width, false, screen);
    }
Esempio n. 7
0
    public static void BezierLine(Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width, bool antiAlias, int segments, Rect screen)
    {
        Vector2 pointA = Drawing_tc1.cubeBezier(start, startTangent, end, endTangent, (float)0);

        for (int i = 1; i <= segments; i++)
        {
            Vector2 vector = Drawing_tc1.cubeBezier(start, startTangent, end, endTangent, (float)(i / segments));
            Drawing_tc1.DrawLine(pointA, vector, color, width, antiAlias, screen);
            pointA = vector;
        }
    }
Esempio n. 8
0
    public static void DrawBezier(Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width, int segments)
    {
        Vector2 start2 = Drawing_tc1.CubeBezier(start, startTangent, end, endTangent, (float)0);

        for (int i = 1; i <= segments; i++)
        {
            Vector2 vector = Drawing_tc1.CubeBezier(start, startTangent, end, endTangent, (float)(i / segments));
            Drawing_tc1.DrawLine(start2, vector, color, width);
            start2 = vector;
        }
    }
Esempio n. 9
0
    public static void DrawBox(Rect box, Color color, float width)
    {
        Vector2 vector  = new Vector2(box.xMin, box.yMin);
        Vector2 vector2 = new Vector2(box.xMax, box.yMin);
        Vector2 vector3 = new Vector2(box.xMax, box.yMax);
        Vector2 vector4 = new Vector2(box.xMin, box.yMax);

        Drawing_tc1.DrawLine(vector, vector2, color, width);
        Drawing_tc1.DrawLine(vector2, vector3, color, width);
        Drawing_tc1.DrawLine(vector3, vector4, color, width);
        Drawing_tc1.DrawLine(vector4, vector, color, width);
    }
Esempio n. 10
0
    public static void DrawConnectingCurve(Vector2 start, Vector2 end, Color color, float width)
    {
        Vector2 a            = start - end;
        Vector2 startTangent = start;

        startTangent.x -= (a / (float)2).x;
        Vector2 endTangent = end;

        endTangent.x += (a / (float)2).x;
        int segments = Mathf.FloorToInt(a.magnitude / (float)20 * (float)3);

        Drawing_tc1.DrawBezier(start, startTangent, end, endTangent, color, width, segments);
    }
Esempio n. 11
0
    public override void draw_grid(Rect rect, int tile_x, int tile_y, Color color, int width, Rect screen)
    {
        Vector2 vector = default(Vector2);

        vector.x = rect.width / (float)tile_x;
        vector.y = rect.height / (float)tile_y;
        for (float num = rect.x; num <= rect.xMax + vector.x / (float)2; num += vector.x)
        {
            Drawing_tc1.DrawLine(new Vector2(num, rect.y), new Vector2(num, rect.yMax), color, (float)width, false, screen);
        }
        for (float num2 = rect.y; num2 <= rect.yMax + vector.y / (float)2; num2 += vector.y)
        {
            Drawing_tc1.DrawLine(new Vector2(rect.x, num2), new Vector2(rect.xMax, num2), color, (float)width, false, screen);
        }
    }
Esempio n. 12
0
    public override void draw_scale_grid(Rect rect, Vector2 offset, float zoom, float scale, Color color, int width, bool draw_center, Rect screen)
    {
        float   num     = 0f;
        Vector2 vector  = new Vector2(screen.width, screen.height) / (float)2 + offset;
        Vector2 vector2 = default(Vector2);
        Vector2 vector3 = default(Vector2);
        float   num2    = vector.x - rect.x;
        float   num3    = vector.y - rect.y;
        int     num4    = (int)(num2 / zoom);

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

        if (num5 < 0)
        {
            num5 = -9 - num5;
        }
        else
        {
            num5 = 9 - num5;
        }
        int num6 = (int)(-((vector.x - (float)num4) / zoom) + (float)(9 - num5));
        int num7 = (int)(num3 / zoom);

        num7 = (int)(num3 - (float)num7 * zoom);
        num7 = (int)((float)num7 + rect.y);
        for (float num8 = (float)num4; num8 <= rect.xMax; num8 += zoom)
        {
            Drawing_tc1.DrawLine(new Vector2(num8, rect.y), new Vector2(num8, rect.yMax), color, (float)width, false, screen);
            if (num5 > 9)
            {
                num5 = 0;
            }
            num5++;
        }
        for (float num9 = (float)num7; num9 <= rect.yMax; num9 += zoom)
        {
            Drawing_tc1.DrawLine(new Vector2(rect.x, num9), new Vector2(rect.xMax, num9), color, (float)width, false, screen);
        }
        if (draw_center)
        {
            Drawing_tc1.DrawLine(new Vector2(vector.x, rect.y), new Vector2(vector.x, rect.yMax), color, (float)(width + 2), false, screen);
            Drawing_tc1.DrawLine(new Vector2(rect.x, vector.y), new Vector2(rect.xMax, vector.y), color, (float)(width + 2), false, screen);
        }
    }
Esempio n. 13
0
    public static void DrawLineMac(Vector2 pointA, Vector2 pointB, Color color, float width, bool antiAlias)
    {
        Color     color2 = GUI.color;
        Matrix4x4 matrix = GUI.matrix;
        float     num    = width;

        if (antiAlias)
        {
            width *= (float)3;
        }
        float num2      = Vector3.Angle(pointB - pointA, Vector2.right) * (float)((pointA.y > pointB.y) ? -1 : 1);
        float magnitude = (pointB - pointA).magnitude;

        if (magnitude > 0.01f)
        {
            Vector3 vector = new Vector3(pointA.x, pointA.y, (float)0);
            Vector3 b      = new Vector3((pointB.x - pointA.x) * 0.5f, (pointB.y - pointA.y) * 0.5f, (float)0);
            Vector3 b2     = Vector3.zero;
            if (antiAlias)
            {
                b2 = new Vector3(-num * 1.5f * Mathf.Sin(num2 * 0.0174532924f), num * 1.5f * Mathf.Cos(num2 * 0.0174532924f));
            }
            else
            {
                b2 = new Vector3(-num * 0.5f * Mathf.Sin(num2 * 0.0174532924f), num * 0.5f * Mathf.Cos(num2 * 0.0174532924f));
            }
            GUI.color  = color;
            GUI.matrix = Drawing_tc1.translationMatrix(vector) * GUI.matrix;
            GUIUtility.ScaleAroundPivot(new Vector2(magnitude, width), new Vector2(-0.5f, (float)0));
            GUI.matrix = Drawing_tc1.translationMatrix(-vector) * GUI.matrix;
            GUIUtility.RotateAroundPivot(num2, Vector2.zero);
            GUI.matrix = Drawing_tc1.translationMatrix(vector - b2 - b) * GUI.matrix;
            if (antiAlias)
            {
                GUI.DrawTexture(new Rect((float)0, (float)0, (float)1, (float)1), Drawing_tc1.aaLineTex);
            }
            else
            {
                GUI.DrawTexture(new Rect((float)0, (float)0, (float)1, (float)1), Drawing_tc1.lineTex);
            }
        }
        GUI.matrix = matrix;
        GUI.color  = color2;
    }
Esempio n. 14
0
    public static void DrawRoundedBox(Rect box, float radius, Color color, float width)
    {
        Vector2 vector  = default(Vector2);
        Vector2 vector2 = default(Vector2);
        Vector2 vector3 = default(Vector2);
        Vector2 vector4 = default(Vector2);
        Vector2 vector5 = default(Vector2);
        Vector2 vector6 = default(Vector2);
        Vector2 vector7 = default(Vector2);
        Vector2 vector8 = default(Vector2);

        vector  = new Vector2(box.xMin + radius, box.yMin);
        vector2 = new Vector2(box.xMax - radius, box.yMin);
        vector3 = new Vector2(box.xMax, box.yMin + radius);
        vector4 = new Vector2(box.xMax, box.yMax - radius);
        vector5 = new Vector2(box.xMax - radius, box.yMax);
        vector6 = new Vector2(box.xMin + radius, box.yMax);
        vector7 = new Vector2(box.xMin, box.yMax - radius);
        vector8 = new Vector2(box.xMin, box.yMin + radius);
        Drawing_tc1.DrawLine(vector, vector2, color, width);
        Drawing_tc1.DrawLine(vector3, vector4, color, width);
        Drawing_tc1.DrawLine(vector5, vector6, color, width);
        Drawing_tc1.DrawLine(vector7, vector8, color, width);
        Vector2 startTangent = default(Vector2);
        Vector2 endTangent   = default(Vector2);
        float   num          = radius / (float)2;

        startTangent = new Vector2(vector8.x, vector8.y + num);
        endTangent   = new Vector2(vector.x - num, vector.y);
        Drawing_tc1.DrawBezier(vector8, startTangent, vector, endTangent, color, width);
        startTangent = new Vector2(vector2.x + num, vector2.y);
        endTangent   = new Vector2(vector3.x, vector3.y - num);
        Drawing_tc1.DrawBezier(vector2, startTangent, vector3, endTangent, color, width);
        startTangent = new Vector2(vector4.x, vector4.y + num);
        endTangent   = new Vector2(vector5.x + num, vector5.y);
        Drawing_tc1.DrawBezier(vector4, startTangent, vector5, endTangent, color, width);
        startTangent = new Vector2(vector6.x - num, vector6.y);
        endTangent   = new Vector2(vector7.x, vector7.y + num);
        Drawing_tc1.DrawBezier(vector6, startTangent, vector7, endTangent, color, width);
    }
Esempio n. 15
0
 public static void DrawLine(Vector2 start, Vector2 end, Color color, float width)
 {
     if (!RuntimeServices.EqualityOperator(Event.current, null))
     {
         if (Event.current.type == EventType.Repaint)
         {
             Drawing_tc1.point_class point_class = new Drawing_tc1.point_class(start, end);
             Drawing_tc1.CreateMaterial();
             Drawing_tc1.lineMaterial.SetPass(0);
             Vector3 vector  = default(Vector3);
             Vector3 vector2 = default(Vector3);
             if (width == (float)1)
             {
                 GL.Begin(1);
                 GL.Color(color);
                 vector  = new Vector3(start.x, start.y, (float)0);
                 vector2 = new Vector3(end.x, end.y, (float)0);
                 GL.Vertex(vector);
                 GL.Vertex(vector2);
             }
             else
             {
                 GL.Begin(7);
                 GL.Color(color);
                 vector  = new Vector3(end.y, start.x, (float)0);
                 vector2 = new Vector3(start.y, end.x, (float)0);
                 Vector3 b  = (vector - vector2).normalized * width / 2f;
                 Vector3 a  = new Vector3(start.x, start.y, (float)0);
                 Vector3 a2 = new Vector3(end.x, end.y, (float)0);
                 GL.Vertex(a - b);
                 GL.Vertex(a + b);
                 GL.Vertex(a2 + b);
                 GL.Vertex(a2 - b);
             }
             GL.End();
         }
     }
 }
Esempio n. 16
0
    public override 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;
        bool result = this.drawText(rect, edit, false, textColor, new Color(0.1f, 0.1f, 0.1f, (float)1), fontSize, true, 6);

        if (label2)
        {
            GUI.color = highlightColor2;
            GUI.color = Color.white;
            if (!active)
            {
                Drawing_tc1.DrawLine(new Vector2(rect.x + (float)1, rect.y + labelHeight + (float)1), new Vector2(rect.xMax - (float)1, rect.yMax - labelHeight - (float)1), new Color((float)1, (float)0, (float)0, 0.7f), (float)3, false, screen);
                Drawing_tc1.DrawLine(new Vector2(rect.x + (float)1, rect.yMax - labelHeight - (float)1), new Vector2(rect.xMax - (float)1, rect.y + labelHeight + (float)1), new Color((float)1, (float)0, (float)0, 0.7f), (float)3, false, screen);
            }
        }
        else if (!active)
        {
            Drawing_tc1.DrawLine(new Vector2(rect.x + (float)1, rect.y + labelHeight + (float)1), new Vector2(rect.xMax - (float)1, rect.yMax - (float)1), new Color((float)1, (float)0, (float)0, 0.7f), (float)3, false, screen);
            Drawing_tc1.DrawLine(new Vector2(rect.x + (float)1, rect.yMax - (float)1), new Vector2(rect.xMax - (float)1, rect.y + labelHeight + (float)1), new Color((float)1, (float)0, (float)0, 0.7f), (float)3, false, screen);
        }
        if (border)
        {
            this.DrawRect(rect, highlightColor, (float)width, screen);
            Drawing_tc1.DrawLine(new Vector2(rect.x, rect.y + labelHeight), new Vector2(rect.xMax, rect.y + labelHeight), highlightColor, (float)width, false, screen);
            if (label2)
            {
                Drawing_tc1.DrawLine(new Vector2(rect.x, rect.yMax - labelHeight), new Vector2(rect.xMax, rect.yMax - labelHeight), highlightColor, (float)width, false, screen);
            }
        }
        GUI.color = Color.white;
        return(result);
    }
Esempio n. 17
0
    public static void DrawBezier(Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width)
    {
        int segments = Mathf.FloorToInt((start - end).magnitude / (float)20) * 3;

        Drawing_tc1.DrawBezier(start, startTangent, end, endTangent, color, width, segments);
    }
Esempio n. 18
0
 public static void curveOutIn(Rect wr, Rect wr2, Color color, Color shadow, int width, Rect screen)
 {
     Drawing_tc1.BezierLine(new Vector2(wr.x + wr.width, wr.y + (float)width + wr.height / (float)2), new Vector2(wr.x + wr.width + Mathf.Abs(wr2.x - (wr.x + wr.width)) / (float)2, wr.y + (float)width + wr.height / (float)2), new Vector2(wr2.x, wr2.y + (float)width + wr2.height / (float)2), new Vector2(wr2.x - Mathf.Abs(wr2.x - (wr.x + wr.width)) / (float)2, wr2.y + (float)width + wr2.height / (float)2), shadow, (float)width, true, 20, screen);
     Drawing_tc1.BezierLine(new Vector2(wr.x + wr.width, wr.y + wr.height / (float)2), new Vector2(wr.x + wr.width + Mathf.Abs(wr2.x - (wr.x + wr.width)) / (float)2, wr.y + wr.height / (float)2), new Vector2(wr2.x, wr2.y + wr2.height / (float)2), new Vector2(wr2.x - Mathf.Abs(wr2.x - (wr.x + wr.width)) / (float)2, wr2.y + wr2.height / (float)2), color, (float)width, true, 20, screen);
 }
Esempio n. 19
0
    public static void DrawBox(Vector2 topLeftCorner, Vector2 bottomRightCorner, Color color, float width)
    {
        Rect box = new Rect(topLeftCorner.x, topLeftCorner.y, bottomRightCorner.x - topLeftCorner.x, bottomRightCorner.y - topLeftCorner.y);

        Drawing_tc1.DrawBox(box, color, width);
    }
Esempio n. 20
0
 public static void DrawLine(Vector2 pointA, Vector2 pointB, Color color, float width, bool antiAlias, Rect screen)
 {
     Drawing_tc1.clippingBounds = screen;
     Drawing_tc1.DrawLine(pointA, pointB, color, width);
 }