Package org.eclipse.zest.layouts

Examples of org.eclipse.zest.layouts.LayoutBendPoint


     * @return the last bendpoint entity or null if there are no bendpoints
     */
    private SimpleNode drawBendPoints(SimpleRelationship rel, GC gcBuffer) {
      final String DUMMY_TITLE = "dummy";
      LayoutBendPoint[] bendPoints = (rel).getBendPoints();
      LayoutBendPoint bp;
      SimpleNode startEntity = (SimpleNode) rel.getSourceInLayout();
      SimpleNode destEntity = null;

      double srcX = startEntity.getX() + startEntity.getWidth() / 2.0;
      double srcY = startEntity.getY() + startEntity.getHeight() / 2.0;
      for (int i = 1; i < bendPoints.length - 1; i++) {
        bp = bendPoints[i];
        destEntity = new SimpleNode(DUMMY_TITLE, bp.getX(), bp.getY(), 0.01, 0.01);
        drawEdge(srcX, srcY, bp.getX(), bp.getY(), rel, gcBuffer);
        startEntity = destEntity;
        srcX = startEntity.getX();
        srcY = startEntity.getY();
      }
      return destEntity;
View Full Code Here


     * @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());
View Full Code Here

TOP

Related Classes of org.eclipse.zest.layouts.LayoutBendPoint

Copyright © 2018 www.massapicom. 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.