position = i + 1;
}
}
// Looking for position of source/target nodes (edge=>port=>vertex)
VertexView nodeFrom = (VertexView) edge.getSource().getParentView();
VertexView nodeTo = (VertexView) edge.getTarget().getParentView();
Point2D from = AbstractCellView.getCenterPoint(nodeFrom);
Point2D to = AbstractCellView.getCenterPoint(nodeTo);
if (from != null && to != null) {
double dy = from.getY() - to.getY();
double dx = from.getX() - to.getX();
// Calc of radius
double m = dy / dx;
double theta = Math.atan(-1 / m);
double rx = dx / Math.sqrt(dx * dx + dy * dy);
double ry = dy / Math.sqrt(dx * dx + dy * dy);
// Memorize size of source/target nodes
double sizeFrom = Math.max(nodeFrom.getBounds().getWidth(),
nodeFrom.getBounds().getHeight()) / 2.;
double sizeTo = Math.max(nodeTo.getBounds().getWidth(), nodeTo
.getBounds().getHeight()) / 2.;
// Calc position of central point
double edgeMiddleDeparture = (Math.sqrt(dx * dx + dy * dy)
- sizeFrom - sizeTo)