/// <inheritdoc/>
        public void ApplyLayout(LayoutGraph graph)
        {
            var affectedNodesDP = graph.GetDataProvider(AffectedNodesDpKey);

            for (IEdgeCursor ec = graph.GetEdgeCursor(); ec.Ok; ec.Next())
            {
                Edge       e    = ec.Edge;
                YPointPath path = graph.GetPath(e);
                //adjust source point
                if (affectedNodesDP == null || affectedNodesDP.GetBool(e.Source))
                {
                    AdjustPortLocation(graph, e, path, true);
                }
                if (affectedNodesDP == null || affectedNodesDP.GetBool(e.Target))
                {
                    AdjustPortLocation(graph, e, path, false);
                }
            }
        }
Ejemplo n.º 2
0
        public LayoutGraphPanel(LayoutGraph graph)
        {
            if (!GroupingSupport.IsFlat(graph))
            {
                grouping = new GroupingSupport(graph);
            }

            this.BackColor   = Color.White;
            this.BorderStyle = BorderStyle.Fixed3D;
            this.AutoScroll  = true;
            global::yWorks.Algorithms.Geometry.Rectangle2D rect = LayoutGraphUtilities.GetBoundingBox(graph, graph.GetNodeCursor(), graph.GetEdgeCursor());
            this.HScroll        = true;
            this.VScroll        = true;
            this.layoutGraph    = graph;
            this.edgePen        = new Pen(Brushes.Black, 1);
            this.nodeBorderPen  = new Pen(Brushes.DarkGray, 1);
            this.labelBorderPen = new Pen(Brushes.Red, 1);
            this.nodeFillBrush  = new SolidBrush(nodeFillColor);
            this.labelBrush     = Brushes.Black;
            this.labelFont      = new Font("sansserif", 6);
            this.MouseDown     += new MouseEventHandler(LayoutGraphPanel_MouseDown);
            SetWorldRect(rect.X - insets, rect.Y - insets, rect.Width + insets * 2, rect.Height + insets * 2);
        }