Skip to content

Commit

Permalink
GraphConnection Bendpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
BauePhil authored and azoitl committed Aug 24, 2023
1 parent e444ae5 commit 8f98735
Showing 1 changed file with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import org.eclipse.draw2d.PolylineConnection;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.draw2d.geometry.PrecisionPoint;

import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Display;
Expand Down Expand Up @@ -713,7 +716,7 @@ class GraphLayoutConnection implements LayoutRelationship {

@Override
public void clearBendPoints() {
// @tag TODO : add bendpoints
connectionFigure.getPoints().removeAllPoints();
}

@Override
Expand All @@ -738,7 +741,24 @@ public void populateLayoutConstraint(LayoutConstraint constraint) {

@Override
public void setBendPoints(LayoutBendPoint[] bendPoints) {
// @tag TODO : add bendpoints
PointList points = new PointList();

//source
points.addPoint(
getSource().getLocation().x + getSource().getSize().width / 2,
getSource().getLocation().y + getSource().getSize().height / 2);
//bend points
for (LayoutBendPoint p : bendPoints) {
if (p.getIsControlPoint()) {
points.addPoint(new PrecisionPoint(p.getX(), p.getY()));
}
}
//destination
points.addPoint(
getDestination().getLocation().x + getDestination().getSize().width / 2,
getDestination().getLocation().y + getDestination().getSize().height / 2);

connectionFigure.setPoints(points);
}

@Override
Expand Down

0 comments on commit 8f98735

Please sign in to comment.