Examples of FixPointAnchor


Examples of org.eclipse.graphiti.mm.pictograms.FixPointAnchor

    }
  }

  private Connection createConnectionAndSetBendpoints(BPMNEdge bpmnEdge, PictogramElement sourceElement,
      PictogramElement targetElement) {
    FixPointAnchor sourceAnchor = createAnchor(sourceElement);
    FixPointAnchor targetAnchor = createAnchor(targetElement);

    AddConnectionContext context = new AddConnectionContext(sourceAnchor, targetAnchor);
    context.setNewObject(bpmnEdge.getBpmnElement());

    IAddFeature addFeature = featureProvider.getAddFeature(context);
View Full Code Here

Examples of org.eclipse.graphiti.mm.pictograms.FixPointAnchor

    }
    return null;
  }

  private FixPointAnchor createAnchor(PictogramElement elem) {
    FixPointAnchor sa = peService.createFixPointAnchor((AnchorContainer) elem);
    sa.setReferencedGraphicsAlgorithm(elem.getGraphicsAlgorithm());
    Rectangle rect = gaService.createInvisibleRectangle(sa);
    gaService.setSize(rect, 1, 1);
    return sa;
  }
View Full Code Here

Examples of org.eclipse.graphiti.mm.pictograms.FixPointAnchor

  public static FixPointAnchor createAnchor(Shape s, AnchorLocation loc, int x, int y) {
    IGaService gaService = Graphiti.getGaService();
    IPeService peService = Graphiti.getPeService();

    FixPointAnchor anchor = peService.createFixPointAnchor(s);
    peService.setPropertyValue(anchor, BOUNDARY_FIXPOINT_ANCHOR, loc.getKey());
    anchor.setLocation(gaService.createPoint(x, y));
    gaService.createInvisibleRectangle(anchor);

    return anchor;
  }
View Full Code Here

Examples of org.eclipse.graphiti.mm.pictograms.FixPointAnchor

    Map<AnchorLocation, BoundaryAnchor> targetBoundaryAnchors = getBoundaryAnchors(target);

    if (connection instanceof FreeFormConnectionImpl) {
      EList<Point> bendpoints = ((FreeFormConnectionImpl) connection).getBendpoints();
      if (bendpoints.size() > 0) {
        FixPointAnchor sourceAnchor = getCorrectAnchor(sourceBoundaryAnchors, bendpoints.get(0));
        FixPointAnchor targetAnchor = getCorrectAnchor(targetBoundaryAnchors,
            bendpoints.get(bendpoints.size() - 1));
        return new Tuple<FixPointAnchor, FixPointAnchor>(sourceAnchor, targetAnchor);
      }
    }

    BoundaryAnchor sourceTop = sourceBoundaryAnchors.get(AnchorLocation.TOP);
    BoundaryAnchor sourceBottom = sourceBoundaryAnchors.get(AnchorLocation.BOTTOM);
    BoundaryAnchor sourceLeft = sourceBoundaryAnchors.get(AnchorLocation.LEFT);
    BoundaryAnchor sourceRight = sourceBoundaryAnchors.get(AnchorLocation.RIGHT);
    BoundaryAnchor targetBottom = targetBoundaryAnchors.get(AnchorLocation.BOTTOM);
    BoundaryAnchor targetTop = targetBoundaryAnchors.get(AnchorLocation.TOP);
    BoundaryAnchor targetRight = targetBoundaryAnchors.get(AnchorLocation.RIGHT);
    BoundaryAnchor targetLeft = targetBoundaryAnchors.get(AnchorLocation.LEFT);

    boolean sLower = sourceTop.location.getY() > targetBottom.location.getY();
    boolean sHigher = sourceBottom.location.getY() < targetTop.location.getY();
    boolean sRight = sourceLeft.location.getX() > targetRight.location.getX();
    boolean sLeft = sourceRight.location.getX() < targetLeft.location.getX();

    if (sLower) {
      if (!sLeft && !sRight) {
        return new Tuple<FixPointAnchor, FixPointAnchor>(sourceTop.anchor, targetBottom.anchor);
      } else if (sLeft) {
        FixPointAnchor fromTopAnchor = getCorrectAnchor(targetBoundaryAnchors,
            peService.getLocationRelativeToDiagram(sourceTop.anchor));
        FixPointAnchor fromRightAnchor = getCorrectAnchor(targetBoundaryAnchors,
            peService.getLocationRelativeToDiagram(sourceRight.anchor));

        double topLength = getLength(peService.getLocationRelativeToDiagram(fromTopAnchor),
            peService.getLocationRelativeToDiagram(sourceTop.anchor));
        double rightLength = getLength(peService.getLocationRelativeToDiagram(fromRightAnchor),
            peService.getLocationRelativeToDiagram(sourceRight.anchor));

        if (topLength < rightLength) {
          return new Tuple<FixPointAnchor, FixPointAnchor>(sourceTop.anchor, fromTopAnchor);
        } else {
          return new Tuple<FixPointAnchor, FixPointAnchor>(sourceRight.anchor, fromRightAnchor);
        }
      } else {
        FixPointAnchor fromTopAnchor = getCorrectAnchor(targetBoundaryAnchors,
            peService.getLocationRelativeToDiagram(sourceTop.anchor));
        FixPointAnchor fromLeftAnchor = getCorrectAnchor(targetBoundaryAnchors,
            peService.getLocationRelativeToDiagram(sourceLeft.anchor));

        double topLength = getLength(peService.getLocationRelativeToDiagram(fromTopAnchor),
            peService.getLocationRelativeToDiagram(sourceTop.anchor));
        double leftLength = getLength(peService.getLocationRelativeToDiagram(fromLeftAnchor),
            peService.getLocationRelativeToDiagram(sourceLeft.anchor));
        if (topLength < leftLength) {
          return new Tuple<FixPointAnchor, FixPointAnchor>(sourceTop.anchor, fromTopAnchor);
        } else {
          return new Tuple<FixPointAnchor, FixPointAnchor>(sourceLeft.anchor, fromLeftAnchor);
        }
      }

    }

    if (sHigher) {
      if (!sLeft && !sRight) {
        return new Tuple<FixPointAnchor, FixPointAnchor>(sourceBottom.anchor, targetTop.anchor);
      } else if (sLeft) {
        FixPointAnchor fromBottomAnchor = getCorrectAnchor(targetBoundaryAnchors,
            peService.getLocationRelativeToDiagram(sourceBottom.anchor));
        FixPointAnchor fromRightAnchor = getCorrectAnchor(targetBoundaryAnchors,
            peService.getLocationRelativeToDiagram(sourceRight.anchor));

        double bottomLength = getLength(peService.getLocationRelativeToDiagram(fromBottomAnchor),
            peService.getLocationRelativeToDiagram(sourceBottom.anchor));
        double rightLength = getLength(peService.getLocationRelativeToDiagram(fromRightAnchor),
            peService.getLocationRelativeToDiagram(sourceRight.anchor));

        if (bottomLength < rightLength) {
          return new Tuple<FixPointAnchor, FixPointAnchor>(sourceBottom.anchor, fromBottomAnchor);
        } else {
          return new Tuple<FixPointAnchor, FixPointAnchor>(sourceRight.anchor, fromRightAnchor);
        }
      } else {
        FixPointAnchor fromBottomAnchor = getCorrectAnchor(targetBoundaryAnchors,
            peService.getLocationRelativeToDiagram(sourceBottom.anchor));
        FixPointAnchor fromLeftAnchor = getCorrectAnchor(targetBoundaryAnchors,
            peService.getLocationRelativeToDiagram(sourceLeft.anchor));

        double bottomLength = getLength(peService.getLocationRelativeToDiagram(fromBottomAnchor),
            peService.getLocationRelativeToDiagram(sourceBottom.anchor));
        double leftLength = getLength(peService.getLocationRelativeToDiagram(fromLeftAnchor),
View Full Code Here

Examples of org.eclipse.graphiti.mm.pictograms.FixPointAnchor

  }

  public static void relocateFixPointAnchors(Shape shape, int w, int h) {
    Map<AnchorLocation, BoundaryAnchor> anchors = AnchorUtil.getBoundaryAnchors(shape);

    FixPointAnchor anchor = anchors.get(AnchorLocation.TOP).anchor;
    anchor.setLocation(gaService.createPoint(w / 2, 0));

    anchor = anchors.get(AnchorLocation.RIGHT).anchor;
    anchor.setLocation(gaService.createPoint(w, h / 2));

    anchor = anchors.get(AnchorLocation.BOTTOM).anchor;
    anchor.setLocation(gaService.createPoint(w / 2, h));

    anchor = anchors.get(AnchorLocation.LEFT).anchor;
    anchor.setLocation(gaService.createPoint(0, h / 2));
  }
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.