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); }
/// <summary> /// Creates a VerticalSeparationConstraint for each edge in the given set to structural constraints, /// to require these edges to be downward pointing. Also checks for cycles, and edges involved /// in a cycle receive no VerticalSeparationConstraint, but can optionally receive a circle constraint. /// </summary> /// <param name="edges"></param> /// <param name="settings"></param> /// <param name="horizontalSolver"></param> /// <param name="verticalSolver"></param> internal static void GenerateEdgeConstraints( IEnumerable <Edge> edges, IdealEdgeLengthSettings settings, AxisSolver horizontalSolver, AxisSolver verticalSolver) { if (settings.EdgeDirectionConstraints == Directions.None) { return; } EdgeConstraintGenerator g = new EdgeConstraintGenerator(edges, settings, horizontalSolver, verticalSolver); g.GenerateSeparationConstraints(); }
/// <summary> /// Creates a VerticalSeparationConstraint for each edge in the given set to structural constraints, /// to require these edges to be downward pointing. Also checks for cycles, and edges involved /// in a cycle receive no VerticalSeparationConstraint, but can optionally receive a circle constraint. /// </summary> /// <param name="edges"></param> /// <param name="settings"></param> /// <param name="horizontalSolver"></param> /// <param name="verticalSolver"></param> internal static void GenerateEdgeConstraints( IEnumerable<Edge> edges, IdealEdgeLengthSettings settings, AxisSolver horizontalSolver, AxisSolver verticalSolver) { if (settings.EdgeDirectionConstraints == Directions.None) { return; } EdgeConstraintGenerator g = new EdgeConstraintGenerator(edges, settings, horizontalSolver, verticalSolver); g.GenerateSeparationConstraints(); // we have in the past used Circular constraints to better show cycles... it's a little experimental though // so it's not currently enabled //foreach (var c in g.CyclicComponents) { // constraints.Add(new ProcrustesCircleConstraint(c)); //} }
/// <summary> /// Creates a VerticalSeparationConstraint for each edge in the given set to structural constraints, /// to require these edges to be downward pointing. Also checks for cycles, and edges involved /// in a cycle receive no VerticalSeparationConstraint, but can optionally receive a circle constraint. /// </summary> /// <param name="edges"></param> /// <param name="settings"></param> /// <param name="horizontalSolver"></param> /// <param name="verticalSolver"></param> internal static void GenerateEdgeConstraints( IEnumerable <Edge> edges, IdealEdgeLengthSettings settings, AxisSolver horizontalSolver, AxisSolver verticalSolver) { if (settings.EdgeDirectionConstraints == Directions.None) { return; } EdgeConstraintGenerator g = new EdgeConstraintGenerator(edges, settings, horizontalSolver, verticalSolver); g.GenerateSeparationConstraints(); // we have in the past used Circular constraints to better show cycles... it's a little experimental though // so it's not currently enabled //foreach (var c in g.CyclicComponents) { // constraints.Add(new ProcrustesCircleConstraint(c)); //} }