if (dockersNode.size() == 2) {
nextPointInLineX += targetInfo.getX();
nextPointInLineY += targetInfo.getY();
}
Line2D firstLine = new Line2D(sourceRefLineX, sourceRefLineY, nextPointInLineX, nextPointInLineY);
String sourceRefStencilId = BpmnJsonConverterUtil.getStencilId(sourceRefNode);
String targetRefStencilId = BpmnJsonConverterUtil.getStencilId(targetRefNode);
List<Point> graphicInfoList = new ArrayList<Point>();
if (DI_CIRCLES.contains(sourceRefStencilId)) {
Circle2D eventCircle = new Circle2D(sourceInfo.getX() + sourceDockersX,
sourceInfo.getY() + sourceDockersY, sourceDockersX);
Collection<Point2D> intersections = eventCircle.intersections(firstLine);
Point2D intersection = intersections.iterator().next();
graphicInfoList.add(createGraphicInfo(intersection.getX(), intersection.getY()));
} else if (DI_RECTANGLES.contains(sourceRefStencilId)) {
Polyline2D rectangle = createRectangle(sourceInfo);
Collection<Point2D> intersections = rectangle.intersections(firstLine);
Point2D intersection = intersections.iterator().next();
graphicInfoList.add(createGraphicInfo(intersection.getX(), intersection.getY()));
} else if (DI_GATEWAY.contains(sourceRefStencilId)) {
Polyline2D gatewayRectangle = createGateway(sourceInfo);
Collection<Point2D> intersections = gatewayRectangle.intersections(firstLine);
Point2D intersection = intersections.iterator().next();
graphicInfoList.add(createGraphicInfo(intersection.getX(), intersection.getY()));
}
Line2D lastLine = null;
if (dockersNode.size() > 2) {
for(int i = 1; i < dockersNode.size() - 1; i++) {
double x = dockersNode.get(i).get(EDITOR_BOUNDS_X).getDoubleValue();
double y = dockersNode.get(i).get(EDITOR_BOUNDS_Y).getDoubleValue();
graphicInfoList.add(createGraphicInfo(x, y));
}
double startLastLineX = dockersNode.get(dockersNode.size() - 2).get(EDITOR_BOUNDS_X).getDoubleValue();
double startLastLineY = dockersNode.get(dockersNode.size() - 2).get(EDITOR_BOUNDS_Y).getDoubleValue();
double endLastLineX = dockersNode.get(dockersNode.size() - 1).get(EDITOR_BOUNDS_X).getDoubleValue();
double endLastLineY = dockersNode.get(dockersNode.size() - 1).get(EDITOR_BOUNDS_Y).getDoubleValue();
endLastLineX += targetInfo.getX();
endLastLineY += targetInfo.getY();
lastLine = new Line2D(startLastLineX, startLastLineY, endLastLineX, endLastLineY);
} else {
lastLine = firstLine;
}