Skip to content
This repository has been archived by the owner on Jan 15, 2020. It is now read-only.

Manhattan routing improvement #376

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gabrieldulca
Copy link
Contributor

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.

@gabrieldulca gabrieldulca force-pushed the routing-improvement branch 3 times, most recently from 6a84c43 to 2817d55 Compare September 18, 2019 14:20
Copy link
Collaborator

@tortmayr tortmayr left a 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 {
Copy link
Collaborator

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 {
Copy link
Collaborator

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";
Copy link
Collaborator

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{
Copy link
Collaborator

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 + "]";
}


Copy link
Collaborator

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());

Copy link
Collaborator

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());
Copy link
Collaborator

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());
Copy link
Collaborator

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());
Copy link
Collaborator

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) {
Copy link
Collaborator

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)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants