Point2D toCenter=getCenter(to);
if (fromCenter == null) //TODO SUB this prevents crashing with external tasks, however, now they won't show up in the PERT
return;
GeneralPath path=dependency.getPath();
NetworkLinkRouting routing=(NetworkLinkRouting)getRouting();
if (vertical) routing.routePath(path,fromCenter.getX(),fromPoints[3],toCenter.getX(),toPoints[2],(fromPoints[3]+toPoints[2])/2,dependency.getType());
else routing.routePath(path,fromPoints[1],fromCenter.getY(),toPoints[0],toCenter.getY(),(fromPoints[1]+toPoints[0])/2,dependency.getType());
Color oldColor=g2.getColor();
Stroke oldStroke = g2.getStroke();
Dependency dep = dependency.getDependency();
if (dep != null && dep.isDisabled())
g2.setStroke(GraphRenderer.DISABLED_LINK_STROKE);
if (dep != null && dep.isCrossProject())
g2.setColor(GraphRenderer.EXTERNAL_LINK_COLOR);
else
g2.setColor(format.getMiddle().getColor());
g2.draw(path);
//}
if (format.getStart()==null&&format.getEnd()==null) return;
if (format.getStart()!=null){
double theta=routing.getFirstAngle();
AffineTransform transform=(theta==0)?null:AffineTransform.getRotateInstance(theta,routing.getFirstX(),routing.getFirstY());
drawLinkArrows(dep,transform,format.getEnd());
}
if (format.getEnd()!=null){
double theta=routing.getLastAngle();
AffineTransform transform=(theta==Math.PI||theta==-Math.PI)?null:AffineTransform.getRotateInstance(Math.PI-theta,routing.getLastX(),routing.getLastY());
drawLinkArrows(dep,transform,format.getEnd());
}
if (oldColor!=null) g2.setColor(oldColor);
if (oldStroke!= null) g2.setStroke(oldStroke);