Skip to content

Commit

Permalink
take corner radius into account
Browse files Browse the repository at this point in the history
Signed-off-by: Lev Nachmanson <[email protected]>
  • Loading branch information
levnach committed Mar 18, 2024
1 parent 722cd81 commit bc7c7d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion GraphLayout/MSAGL/Miscellaneous/LayoutHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public static void RouteAndLabelEdges(GeometryGraph geometryGraph, LayoutAlgorit
if (mode == EdgeRoutingMode.Rectilinear ||
mode == EdgeRoutingMode.RectilinearToCenter) {
RectilinearInteractiveEditor.CreatePortsAndRouteEdges(
layoutSettings.NodeSeparation / 3,
ers.CornerRadius,
layoutSettings.NodeSeparation / 3,
nodes,
edgesToRoute,
Expand Down
4 changes: 3 additions & 1 deletion GraphLayout/MSAGL/Routing/Rectilinear/Nudging/Nudger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ bool HasGroups {
}

Dictionary<AxisEdge, Polyline> axisEdgesToObstaclesTheyOriginatedFrom;
private double minimalEdgeSeparation = 2;

List<Path> Paths { get; set; }

Expand All @@ -47,7 +48,7 @@ internal Nudger(IEnumerable<Path> paths, double cornerFitRad, IEnumerable<Polyli
HierarchyOfGroups = RectangleNode<Shape, Point>.CreateRectangleNodeOnEnumeration(
ancestorsSets.Keys.Where(shape => shape.IsGroup).Select(group => new RectangleNode<Shape, Point>(group, group.BoundingBox)));
Obstacles = obstacles;
EdgeSeparation = 2 * cornerFitRad;
EdgeSeparation = Math.Max(2 * cornerFitRad, MinimalEdgeSeparation);
Paths = new List<Path>(paths);
HierarchyOfObstacles =
RectangleNode<Polyline, Point>.CreateRectangleNodeOnEnumeration(
Expand Down Expand Up @@ -656,6 +657,7 @@ IEnumerable<Shape> GetMinCommonAncestors(EdgeGeometry edgeGeometry) {
///
/// </summary>
protected Dictionary<Port, Shape> PortToShapes { get; private set; }
public double MinimalEdgeSeparation { get => minimalEdgeSeparation; private set => minimalEdgeSeparation = value; }

Set<Shape> AncestorsForPort(Port port) {
Shape shape;
Expand Down

0 comments on commit bc7c7d0

Please sign in to comment.