예제 #1
0
 public static void PerformLayout(Graphics graphics, IEnumerable <Node> nodes)
 {
     foreach (var node in nodes.Reverse <Node>())
     {
         GraphRenderer.PerformLayout(graphics, node);
     }
 }
예제 #2
0
        public virtual void RenderPin(Graphics graphics)
        {
            using (var brush = new SolidBrush(GraphRenderer.GetArrowLineColor(state)))
            {
                graphics.FillEllipse(brush, PinBounds);
            }

            if (state == RenderState.None)
            {
                graphics.DrawEllipse(Pens.Black, PinBounds);
            }
            else
            // When we're compatible, but not dragging from this node we render a highlight
            if ((state & (RenderState.Compatible | RenderState.Dragging)) == RenderState.Compatible)
            {
                // First draw the normal black border
                graphics.DrawEllipse(Pens.Black, PinBounds);

                // Draw an additional highlight around the connector
                RectangleF highlightBounds = new RectangleF(PinBounds.X, PinBounds.Y, PinBounds.Width, PinBounds.Height);
                highlightBounds.Width  += 10;
                highlightBounds.Height += 10;
                highlightBounds.X      -= 5;
                highlightBounds.Y      -= 5;
                graphics.DrawEllipse(Pens.OrangeRed, highlightBounds);
            }
            else
            {
                graphics.DrawArc(Pens.Black, PinBounds, 90, 180);
                using (var pen = new Pen(GraphRenderer.GetArrowLineColor(state)))
                {
                    graphics.DrawArc(pen, PinBounds, 270, 180);
                }
            }
        }
예제 #3
0
        public static void Render(Graphics graphics, IEnumerable <Node> nodes, bool showLabels)
        {
            var skipConnections = new HashSet <NodeConnection>();

            foreach (var node in nodes.Reverse <Node>())
            {
                GraphRenderer.RenderConnections(graphics, node, skipConnections, showLabels);
            }
            foreach (var node in nodes.Reverse <Node>())
            {
                GraphRenderer.Render(graphics, node);
            }
        }