-
Notifications
You must be signed in to change notification settings - Fork 8
Manhattan routing improvement #376
base: master
Are you sure you want to change the base?
Manhattan routing improvement #376
Conversation
6a84c43
to
2817d55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this great improvement.
I have a couple of comments but most of them are non-critical and related to linting and codestyle.
In general please avoid unnecessary empty lines and double check if all newly created files have a copyright header.
I think implementing this feature directly in the change-bounds tool can lead to a couple of issues especially if a routing style other than Manhattan is used.
I suggest to refactor the auto-rerouting behavior into a separate class which is optionally injected into the change bounds tool. This way the feature is only activated if explicitly bound by a client implementation.
|
||
import { ElementAndRoutingPoints } from "../tools/change-bounds-tool"; | ||
|
||
export class SaveModelEdgesAction implements Action { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename to ChangeRoutingPointsAction
.
constructor(public newRoutingPoints: ElementAndRoutingPoints[]) { } | ||
} | ||
|
||
export class SaveModelKeyboardListener extends KeyListener { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this KeyListener? CTRL + s
triggers a SaveModelAction
which persists the entire model state anyways
@@ -113,6 +113,7 @@ public boolean equals(Object obj) { | |||
public static final String LAYOUT = "layout"; | |||
public static final String VALIDATE_LABEL_EDIT_ACTION = "validateLabelEdit"; | |||
public static final String SET_LABEL_EDIT_VALIDATION_RESULT_ACTION = "setLabelEditValidationResult"; | |||
public static final String SAVE_MODEL_EDGES = "saveModelEdges"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to CHANGE_ROUTING_POINTS
import com.eclipsesource.glsp.api.action.Action; | ||
import com.eclipsesource.glsp.api.model.ElementAndRoutingPoints; | ||
|
||
public class SaveModelEdgesAction extends Action{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to ChangeRoutingPointsAction
return "SaveModelEdgesAction [newRoutingPoints=" + newRoutingPoints + "]"; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary empty lines
EList<GPoint> routingPoints = edge.getRoutingPoints(); | ||
routingPoints.clear(); | ||
routingPoints.addAll(elementAndRoutingPoints.getRoutingPoints()); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary empty line
@@ -72,7 +70,7 @@ public DefaultActionProvider() { | |||
} | |||
|
|||
private void addDefaultActions() { | |||
defaultActions.add(new ApplyLabelEditOperationAction()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this was accidentally removed during merging. Please add again.
@@ -104,7 +102,6 @@ private void addDefaultActions() { | |||
defaultActions.add(new SetModelAction()); | |||
defaultActions.add(new SetOperationsAction()); | |||
defaultActions.add(new SetPopupModelAction()); | |||
defaultActions.add(new SetEditLabelValidationResultAction()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this was accidentally removed during merging. Please add again.
@@ -113,7 +110,6 @@ private void addDefaultActions() { | |||
defaultActions.add(new ReconnectConnectionOperationAction()); | |||
defaultActions.add(new RerouteConnectionOperationAction()); | |||
defaultActions.add(new LayoutAction()); | |||
defaultActions.add(new ValidateLabelEditAction()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this was accidentally removed during merging. Please add again.
// Spacing unit used for rerouting in case of collision | ||
private SPACING: number = 5; | ||
|
||
constructor(protected tool: ChangeBoundsTool, protected edgeRouterRegistry: EdgeRouterRegistry, protected manhattanRouter: ManhattanEdgeRouter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the manhattanRouter
field even used?
If so: Please remove and retrieve the corresponding router for each edge from the registry individually (since the routing type can differ from edge to edge)
07008a3
to
65d1c32
Compare
65d1c32
to
1fe16a9
Compare
Manhattan routing has been improved so that edges don't go through elements anymore.
However if 2 elements are too close to each other the edge will be routed through one of them. An issue will be opened for this.