Ejemplo n.º 1
0
        public void Layout()
        {
            if (Controller == null || Controller.GetVisibleShapes().Any() == false)
            {
                // No visible shapes.
                LayoutFinished.RaiseEvent(this);
                return;
            }

            Cursor = Cursors.Wait;

            // The UpdateLayout() call is important, as it causes the sizes of the
            // shapes to be calculated. These sizes are needed for the layout algorithm.
            UpdateLayout();

            InvalidateVisual();

            var layout = new DiagramLayout();

            layout.CalculateLayout(Controller.GetVisibleShapes(), Controller.GetVisibleConnections(), ActualWidth, ActualHeight);
            layout.LayoutGraph();
            Surface.TidyConnections();

            CalculateZoom();

            Cursor = Cursors.Arrow;
            LayoutFinished.RaiseEvent(this);
        }
Ejemplo n.º 2
0
 protected void RaiseLayoutFinished()
 {
     LayoutFinished?.Invoke(this, EventArgs.Empty);
 }