* @param bendEdges
* @return the last bendpoint entity or null if there are no bendpoints
*/
private void drawBendPoints(LayoutRelationship rel, Graphics g) {
final String DUMMY_TITLE = "dummy";
LayoutBendPoint bp;
SimpleNode startEntity = (SimpleNode) rel.getSourceInLayout();
SimpleNode destEntity = (SimpleNode) rel.getDestinationInLayout();
double srcX = startEntity.getX();
double srcY = startEntity.getY();
// Transform the bendpoints to this coordinate system
LayoutBendPoint[] bendPoints = ((SimpleRelationship) rel).getBendPoints();
srcX = bendPoints[1].getX();
srcY = bendPoints[1].getY();
int bpNum = 2;
while (bpNum < bendPoints.length - 1) { // ignore first and last bendpoints (src and dest)
int currentBpNum = bpNum;
bp = bendPoints[bpNum];
if (bp.getIsControlPoint()) {
if (bendPoints[bpNum + 1].getIsControlPoint()) {
destEntity = new SimpleNode(DUMMY_TITLE, bendPoints[bpNum + 2].getX(), bendPoints[bpNum + 2].getY(), 0.01, 0.01);
drawCurvedRelationship(srcX, srcY, bp.getX(), bp.getY(), bendPoints[bpNum + 1].getX(), bendPoints[bpNum + 1].getY(), bendPoints[bpNum + 2].getX(), bendPoints[bpNum + 2].getY(), g);
bpNum += 4;
} else {
destEntity = new SimpleNode(DUMMY_TITLE, bp.getX(), bp.getY(), 0.01, 0.01);
}
} else {
drawRelationship(srcX, srcY, bp.getX(), bp.getY(), g);
bpNum++;
destEntity = new SimpleNode(DUMMY_TITLE, bp.getX(), bp.getY(), 0.01, 0.01);
}
startEntity = destEntity;
if (currentBpNum == bendPoints.length - 2) { // last point
// draw an arrow in the middle of the line
double dx = getLength(srcX, destEntity.getX());