Hi,
I've few nodes (vertical) connected with routed links. But they are overlapping.
Here is the code,
private createVerticalNodes() {
var node1 = this.diagram.getFactory().createShapeNode(new Rect(500, 0, 200, 50));
node1.setText("node 1");
node1.setBrush("white");
node1.setTextAlignment(Alignment.Center);
node1.setTextPadding(new Thickness(10, 10, 10, 10));
node1.setFont(new Font("Meiryo UI", 15, true, false, false));
node1.resizeToFitText(common.Diagramming.FitSize.KeepWidth);
this.diagram.addItem(node1);
var node2 = this.diagram.getFactory().createShapeNode(new Rect(500, 200, 200, 50));
node2.setText("node 2");
node2.setBrush("white");
node2.setTextAlignment(Alignment.Center);
node2.setTextPadding(new Thickness(10, 10, 10, 10));
node2.setFont(new Font("Meiryo UI", 15, true, false, false));
node2.resizeToFitText(common.Diagramming.FitSize.KeepWidth);
this.diagram.addItem(node2);
var node3 = this.diagram.getFactory().createShapeNode(new Rect(500, 400, 200, 50));
node3.setText("node 3");
node3.setBrush("white");
node3.setTextAlignment(Alignment.Center);
node3.setTextPadding(new Thickness(10, 10, 10, 10));
node3.setFont(new Font("Meiryo UI", 15, true, false, false));
node3.resizeToFitText(common.Diagramming.FitSize.KeepWidth);
this.diagram.addItem(node3);
var node4 = this.diagram.getFactory().createShapeNode(new Rect(500, 600, 200, 50));
node4.setText("node 4");
node4.setBrush("white");
node4.setTextAlignment(Alignment.Center);
node4.setTextPadding(new Thickness(10, 10, 10, 10));
node4.setFont(new Font("Meiryo UI", 15, true, false, false));
node4.resizeToFitText(common.Diagramming.FitSize.KeepWidth);
this.diagram.addItem(node4);
var link1 = this.diagram.getFactory().createDiagramLink(node1, node2);
link1.setAutoRoute(true);
link1.setBrush("blue");
link1.setStroke("blue");
link1.setStrokeThickness(3);
link1.route();
var link2 = this.diagram.getFactory().createDiagramLink(node2, node3);
link2.setAutoRoute(true);
link2.setBrush("#82E0AA");
link2.setStroke("#82E0AA");
link2.setStrokeThickness(3);
link2.route();
var link3 = this.diagram.getFactory().createDiagramLink(node3, node4);
link3.setBrush("#7D3C98");
link3.setStroke("#7D3C98");
link3.setStrokeThickness(3);
link3.setAutoRoute(true);
link3.route();
var link4 = this.diagram.getFactory().createDiagramLink(node1, node4);
link4.setAutoRoute(true);
link4.setBrush("Orange");
link4.setStroke("Orange");
link4.setStrokeThickness(3);
link4.route();
this.diagram.repaint();
}
Attached the screen shots. Also uploaded the complete code in the below url,
https://drive.google.com/open?id=1K8t0uEg7LW9ZUZ-UJe0-EOaVfRetnkNmMay I know how to auto route these links properly without overlapping. Thanks !
Regards,
Kannan