Beispiel #1
0
 private void fileLayoutToolStripMenuItem_Click(object sender, EventArgs e)
 {
     foreach (Shape s in display1.Diagram.Shapes) {
         s.X = 100;
         s.Y = 100;
     }
     RepulsionLayouter layouter = new RepulsionLayouter(project1);
     layouter.SpringRate = 8;
     layouter.Repulsion = 3;
     layouter.RepulsionRange = 500;
     layouter.Friction = 0;
     layouter.Mass = 50;
     layouter.AllShapes = display1.Diagram.Shapes;
     layouter.Shapes = display1.Diagram.Shapes;
     //
     layouter.Prepare();
     layouter.Execute(10);
     layouter.Fit(50, 50, display1.Diagram.Width - 100, display1.Diagram.Height - 100);
 }
        public void PerformTableLayouting(List<TableModel> tableContainer)
        {
            RepulsionLayouter layouter = new RepulsionLayouter(Project)
            {
                SpringRate = 10,
                Repulsion = 40,
                RepulsionRange = 510,
                Friction = 0,
                Mass = 1200,
                AllShapes = TableDiagram.Shapes,
                Shapes = TableDiagram.Shapes
            };

            layouter.Prepare();
            layouter.Execute(10);
            layouter.Fit(50, 50, TableDiagram.Width - 100, TableDiagram.Height - 100);

            foreach (var tabModel in tableContainer)
            {
                var shape = TableDiagram.Shapes.Single(t => t.Tag.ToString() == tabModel.Name);
                tabModel.ShapePlacementInfo.Location = new Point(shape.X, shape.Y);
            }
        }