Esempio n. 1
0
 void SetupConstraints()
 {
     AddConstraintLevel(0);
     if (settings.AvoidOverlaps)
     {
         AddConstraintLevel(2);
     }
     foreach (IConstraint c in settings.StructuralConstraints)
     {
         AddConstraintLevel(c.Level);
         if (c is VerticalSeparationConstraint)
         {
             verticalSolver.AddStructuralConstraint(c);
         }
         else if (c is HorizontalSeparationConstraint)
         {
             horizontalSolver.AddStructuralConstraint(c);
         }
         else
         {
             AddConstraint(c);
         }
     }
     EdgeConstraintGenerator.GenerateEdgeConstraints(graph.Edges, settings.IdealEdgeLength, horizontalSolver,
                                                     verticalSolver);
 }
 private void AddEConstraint(Node u, Node v)
 {
     horizontalSolver.AddStructuralConstraint(
         new HorizontalSeparationConstraint(v, u, (u.Width + v.Width) / 2 + settings.ConstrainedEdgeSeparation));
 }
 private void AddSConstraint(Node u, Node v)
 {
     verticalSolver.AddStructuralConstraint(
         new VerticalSeparationConstraint(u, v, (u.Height + v.Height) / 2 + settings.ConstrainedEdgeSeparation));
 }