Package org.eclipse.graphiti.datatypes

Examples of org.eclipse.graphiti.datatypes.ILocation


    if ((node.eContainer() instanceof SubProcess || (node.eContainer() instanceof Process || node.eContainer() instanceof SubChoreography)
        && lanes.isEmpty())) {
      ContainerShape containerShape = (ContainerShape) elements.get(node.eContainer());
      if (containerShape != null) {
        target = containerShape;
        ILocation loc = Graphiti.getPeLayoutService().getLocationRelativeToDiagram(target);
        x -= loc.getX();
        y -= loc.getY();
      }
    } else if (!lanes.isEmpty()) {
      for (Lane lane : lanes) {
        target = (ContainerShape) elements.get(lane);
        ILocation loc = Graphiti.getPeLayoutService().getLocationRelativeToDiagram(target);
        x -= loc.getX();
        y -= loc.getY();
      }
    }
    context.setTargetContainer(target);
    context.setLocation(x, y);
  }
View Full Code Here


  private void setAnchorLocation(PictogramElement elem, FixPointAnchor anchor, Point point) {
    org.eclipse.graphiti.mm.algorithms.styles.Point p = gaService.createPoint((int) point.getX(),
        (int) point.getY());

    ILocation loc = Graphiti.getPeLayoutService().getLocationRelativeToDiagram((Shape) elem);

    int x = p.getX() - loc.getX();
    int y = p.getY() - loc.getY();

    p.setX(x);
    p.setY(y);

    anchor.setLocation(p);
View Full Code Here

  }

  public static PositionOnLine getPositionOnLineUsingAbsoluteCoordinates(Shape eventShape, Shape activityShape) {
    IPeService peService = Graphiti.getPeService();
    GraphicsAlgorithm eventGa = eventShape.getGraphicsAlgorithm();
    ILocation eventLoc = peService.getLocationRelativeToDiagram(eventShape);
    GraphicsAlgorithm activityGa = activityShape.getGraphicsAlgorithm();
    ILocation activityLoc = peService.getLocationRelativeToDiagram(activityShape);

    return getPositionOnLine(eventLoc.getX(), eventLoc.getY(), eventGa.getWidth(), eventGa.getHeight(),
            activityLoc.getX(), activityLoc.getY(), activityGa.getWidth(), activityGa.getHeight());
  }
View Full Code Here

    int x = context.getX();
    int y = context.getY();

    if (!(context.getTargetContainer() instanceof Diagram)) {
      ILocation loc = peService.getLocationRelativeToDiagram(context.getTargetContainer());
      x += loc.getX();
      y += loc.getY();
    }

    BoundaryEvent event = BusinessObjectUtil.getFirstElementOfType(context.getShape(), BoundaryEvent.class);
    GraphicsAlgorithm eventGa = context.getShape().getGraphicsAlgorithm();
    ContainerShape activityContainer = (ContainerShape) BusinessObjectUtil.getFirstBaseElementFromDiagram(diagram,
            event.getAttachedToRef());
    GraphicsAlgorithm activityGa = activityContainer.getGraphicsAlgorithm();
    ILocation activityLoc = peService.getLocationRelativeToDiagram(activityContainer);

    if (!(activityContainer.equals(context.getTargetContainer()) || activityContainer.eContainer().equals(
            context.getTargetContainer()))) {
      return false;
    }

    PositionOnLine pos = getPositionOnLine(x, y, eventGa.getWidth(), eventGa.getHeight(), activityLoc.getX(),
            activityLoc.getY(), activityGa.getWidth(), activityGa.getHeight());
    return pos.isLegalPosition();
  }
View Full Code Here

      ContainerShape taskContainer = context.getTargetContainer();
      ContainerShape parentContainer = (ContainerShape) context.getPictogramElement().eContainer();

      IPeService peService = Graphiti.getPeService();

      ILocation loc = peService.getLocationRelativeToDiagram(taskContainer);
      MoveShapeContext c = (MoveShapeContext) context;
      int eventX = loc.getX() + context.getX();
      int eventY = loc.getY() + context.getY();

      if (!(parentContainer instanceof Diagram)) {
        loc = peService.getLocationRelativeToDiagram(parentContainer);
        eventX = eventX - loc.getX();
        eventY = eventY - loc.getY();
      }

      c.setLocation(eventX, eventY);
      c.setTargetContainer(parentContainer);
    }
View Full Code Here

      }
     
    } else {
     
      Shape sourceShape = (Shape) getPictogramElement(sourceElement);
      ILocation sourceShapeLocation = Graphiti.getLayoutService().getLocationRelativeToDiagram(sourceShape);
      int sourceX = sourceShapeLocation.getX();
      int sourceY = sourceShapeLocation.getY();
     
      Shape targetShape = (Shape) getPictogramElement(targetElement);
      ILocation targetShapeLocation = Graphiti.getLayoutService().getLocationRelativeToDiagram(targetShape);
      int targetX = targetShapeLocation.getX();
      int targetY = targetShapeLocation.getY();
     
      if (sourceElement instanceof Gateway && targetElement instanceof Gateway == false) {
        if (((sourceGraphics.getY() + 10) < targetGraphics.getY()
            || (sourceGraphics.getY() - 10) > targetGraphics.getY())  &&
            (sourceGraphics.getX() + (sourceGraphics.getWidth() / 2)) < targetGraphics.getX()) {
View Full Code Here

 
  protected void updateFlowElement(BaseElement flowElement) {
    PictogramElement picElement = featureProvider.getPictogramElementForBusinessObject(flowElement);
    if(picElement instanceof Shape) {
      Shape shape = (Shape) picElement;
      ILocation shapeLocation = Graphiti.getLayoutService().getLocationRelativeToDiagram(shape);
      model.getBpmnModel().addGraphicInfo(flowElement.getId(), createGraphicInfo(shapeLocation.getX(), shapeLocation.getY(),
              shape.getGraphicsAlgorithm().getWidth(), shape.getGraphicsAlgorithm().getHeight()));
    }
  }
View Full Code Here

    List<GraphicInfo> flowGraphicsList = createFlowGraphicInfoList(sourceShape, targetShape, freeFormConnection);
    model.getBpmnModel().addFlowGraphicInfoList(association.getId(), flowGraphicsList);
  }
 
  protected List<GraphicInfo> createFlowGraphicInfoList(Shape sourceElement, Shape targetElement, FreeFormConnection freeFormConnection) {
    ILocation sourceLocation = Graphiti.getLayoutService().getLocationRelativeToDiagram(sourceElement);
    int sourceX = sourceLocation.getX();
    int sourceY = sourceLocation.getY();
    int sourceWidth = sourceElement.getGraphicsAlgorithm().getWidth();
    int sourceHeight = sourceElement.getGraphicsAlgorithm().getHeight();
    int sourceMiddleX = sourceX + (sourceWidth / 2);
    int sourceMiddleY = sourceY + (sourceHeight / 2);
    int sourceBottomY = sourceY + sourceHeight;
   
    ILocation targetLocation = Graphiti.getLayoutService().getLocationRelativeToDiagram(targetElement);
    int targetX = targetLocation.getX();
    int targetY = targetLocation.getY();
    int targetWidth = targetElement.getGraphicsAlgorithm().getWidth();
    int targetHeight = targetElement.getGraphicsAlgorithm().getHeight();
    int targetMiddleX = targetX + (targetWidth / 2);
    int targetMiddleY = targetY + (targetHeight / 2);
    int targetBottomY = targetY + targetHeight;
View Full Code Here

      }
     
    } else {
     
      Shape sourceShape = (Shape) getPictogramElement(sourceElement);
      ILocation sourceShapeLocation = Graphiti.getLayoutService().getLocationRelativeToDiagram(sourceShape);
      int sourceX = sourceShapeLocation.getX();
      int sourceY = sourceShapeLocation.getY();
     
      Shape targetShape = (Shape) getPictogramElement(targetElement);
      ILocation targetShapeLocation = Graphiti.getLayoutService().getLocationRelativeToDiagram(targetShape);
      int targetX = targetShapeLocation.getX();
      int targetY = targetShapeLocation.getY();
     
      if (sourceElement instanceof Gateway && targetElement instanceof Gateway == false) {
        if (((sourceGraphics.getY() + 10) < targetGraphics.getY()
            || (sourceGraphics.getY() - 10) > targetGraphics.getY())  &&
            (sourceGraphics.getX() + (sourceGraphics.getWidth() / 2)) < targetGraphics.getX()) {
View Full Code Here

  protected void postMoveShape(IMoveShapeContext context) {
    final Shape shape = context.getShape();

    // get the activity itself to determine its boundary events
    final Activity activity = (Activity) getBusinessObjectForPictogramElement(shape);
    ILocation shapeLocationAfterMove = Graphiti.getLayoutService().getLocationRelativeToDiagram(shape);
    moveActivityChilds(activity, shapeLocationAfterMove);
   
    Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
   
    if (context.getSourceContainer() != context.getTargetContainer()) {
View Full Code Here

TOP

Related Classes of org.eclipse.graphiti.datatypes.ILocation

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.