Examples of GanttLinkRouting


Examples of com.projity.pm.graphic.gantt.link_routing.GanttLinkRouting

    private double[] extraPoints=new double[3];
    public void execute(Object arg0) {
      format = (BarFormat)arg0;

      GanttLinkRouting routing=(GanttLinkRouting)((GanttParams)graphInfo).getRouting();
      CoordinatesConverter coord=((GanttParams)graphInfo).getCoord();
      //if (format.getMiddle()!=null){
          GraphicNode from=dependency.getPredecessor();
          GraphicNode to=dependency.getSuccessor();
          int type=dependency.getType();
        int fromSign=(type==DependencyType.SF||type==DependencyType.SS)?-1:1;
        int toSign=(type==DependencyType.FS||type==DependencyType.SS)?-1:1;
        double fx0=coord.toX(from.getStart());
        double fx1=coord.toX(from.getEnd());
        fx1=CoordinatesConverter.adaptSmallBarEndX(fx0,fx1,from,config);
        double tx0=coord.toX(to.getStart());
        double tx1=coord.toX(to.getEnd());
        tx1=CoordinatesConverter.adaptSmallBarEndX(tx0,tx1,to,config);
        double x0=fromSign<0?fx0:fx1;
        double x1=toSign<0?tx0:tx1;
        int rowHeight=((GanttParams)graphInfo).getRowHeight();
        int yOffset=config.getGanttBarYOffset()+config.getGanttBarHeight()/2;
        int y0=rowHeight*from.getRow();
        int y1=rowHeight*to.getRow();
        double y2=Math.max(y0,y1);
        y0+=yOffset;
        y1+=yOffset;

        GeneralPath path=dependency.getPath();
        ((GanttLinkRouting)routing).routePath(path,x0,y0,x1,y1,y2,y1+to.getGanttShapeHeight()/2,y1-to.getGanttShapeHeight()/2,type);



        Color oldColor=g2.getColor();
        Stroke oldStroke = g2.getStroke();
        Dependency dep = dependency.getDependency();
        if (dep.isDisabled()) g2.setStroke(DISABLED_LINK_STROKE);
        if (dep.isCrossProject()) g2.setColor(/*dep.isDirty()?Color.ORANGE:*/EXTERNAL_LINK_COLOR);
        else g2.setColor(/*dep.isDirty()?Color.RED:*/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.getStart());
      }
      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);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.