コード例 #1
0
ファイル: Painter.cs プロジェクト: geg-antonyan/VisualGraph
        private void DrawOrientedEdge(Graphics g, OrientEdgeModel edge, vec2 min, vec2 max)
        {
            vec2 A = new vec2(edge.PosA);
            vec2 B = new vec2(edge.PosB);

            if (Clip.RectangleClip(ref A, ref B, min, max))
            {
                g.DrawLine(pen, A.x, A.y, B.x, B.y);
            }
            B = new vec2(edge.PosB);
            vec2 C = new vec2(edge.PosC);

            if (Clip.RectangleClip(ref B, ref C, min, max))
            {
                g.DrawLine(pen, B.x, B.y, C.x, C.y);
            }
            C = new vec2(edge.PosC);
            vec2 D = new vec2(edge.PosD);

            if (Clip.RectangleClip(ref C, ref D, min, max) && (C - D).Length() > 6)
            {
                endPen.Color = pen.Color;
                endPen.Width = pen.Width;
                if (!D.Equals(edge.PosD))
                {
                    ServiceFunctions.Swap(ref D, ref C);
                }
                g.DrawLine(endPen, C.x, C.y, D.x, D.y);
            }
            if (edge.Weighted && Clip.SimpleClip(new vec2(edge.WeightPos.x + 5f, edge.WeightPos.y + 5f), max, min, GlobalParameters.Radius))
            {
                DrawWeight(g, edge, min, max);
            }
        }