Package org.eclipse.dd.dc

Examples of org.eclipse.dd.dc.Bounds


     
      JsonNode dockersNode = edgeNode.get(EDITOR_DOCKERS);
      double sourceDockersX = dockersNode.get(0).get(EDITOR_BOUNDS_X).getDoubleValue();
      double sourceDockersY = dockersNode.get(0).get(EDITOR_BOUNDS_Y).getDoubleValue();
     
      Bounds sourceInfo = BpmnModelUtil.getBpmnShape(bpmnModel, BpmnJsonConverterUtil.getElementId(sourceRefNode)).getBounds();
      Bounds targetInfo = BpmnModelUtil.getBpmnShape(bpmnModel, BpmnJsonConverterUtil.getElementId(targetRefNode)).getBounds();
     
      double sourceRefLineX = sourceInfo.getX() + sourceDockersX;
      double sourceRefLineY = sourceInfo.getY() + sourceDockersY;
     
      double nextPointInLineX;
      double nextPointInLineY;
     
      nextPointInLineX = dockersNode.get(1).get(EDITOR_BOUNDS_X).getDoubleValue();
      nextPointInLineY = dockersNode.get(1).get(EDITOR_BOUNDS_Y).getDoubleValue();
      if (dockersNode.size() == 2) {
        nextPointInLineX += targetInfo.getX();
        nextPointInLineY += targetInfo.getY();
      }
     
      Line2D firstLine = new Line2D(sourceRefLineX, sourceRefLineY, nextPointInLineX, nextPointInLineY);
     
      String sourceRefStencilId = BpmnJsonConverterUtil.getStencilId(sourceRefNode);
      String targetRefStencilId = BpmnJsonConverterUtil.getStencilId(targetRefNode);
     
      List<Point> graphicInfoList = new ArrayList<Point>();
     
      if (DI_CIRCLES.contains(sourceRefStencilId)) {
        Circle2D eventCircle = new Circle2D(sourceInfo.getX() + sourceDockersX,
            sourceInfo.getY() + sourceDockersY, sourceDockersX);
       
        Collection<Point2D> intersections = eventCircle.intersections(firstLine);
        Point2D intersection = intersections.iterator().next();
        graphicInfoList.add(createGraphicInfo(intersection.getX(), intersection.getY()));
     
      } else if (DI_RECTANGLES.contains(sourceRefStencilId)) {
        Polyline2D rectangle = createRectangle(sourceInfo);
       
        Collection<Point2D> intersections = rectangle.intersections(firstLine);
        Point2D intersection = intersections.iterator().next();
        graphicInfoList.add(createGraphicInfo(intersection.getX(), intersection.getY()));
     
      } else if (DI_GATEWAY.contains(sourceRefStencilId)) {
        Polyline2D gatewayRectangle = createGateway(sourceInfo);
       
        Collection<Point2D> intersections = gatewayRectangle.intersections(firstLine);
        Point2D intersection = intersections.iterator().next();
        graphicInfoList.add(createGraphicInfo(intersection.getX(), intersection.getY()));
      }
     
      Line2D lastLine = null;
     
      if (dockersNode.size() > 2) {
        for(int i = 1; i < dockersNode.size() - 1; i++) {
          double x = dockersNode.get(i).get(EDITOR_BOUNDS_X).getDoubleValue();
          double y = dockersNode.get(i).get(EDITOR_BOUNDS_Y).getDoubleValue();
          graphicInfoList.add(createGraphicInfo(x, y));
        }
       
        double startLastLineX = dockersNode.get(dockersNode.size() - 2).get(EDITOR_BOUNDS_X).getDoubleValue();
        double startLastLineY = dockersNode.get(dockersNode.size() - 2).get(EDITOR_BOUNDS_Y).getDoubleValue();
       
        double endLastLineX = dockersNode.get(dockersNode.size() - 1).get(EDITOR_BOUNDS_X).getDoubleValue();
        double endLastLineY = dockersNode.get(dockersNode.size() - 1).get(EDITOR_BOUNDS_Y).getDoubleValue();
       
        endLastLineX += targetInfo.getX();
        endLastLineY += targetInfo.getY();
       
        lastLine = new Line2D(startLastLineX, startLastLineY, endLastLineX, endLastLineY);
       
      } else {
        lastLine = firstLine;
      }
     
      if (DI_RECTANGLES.contains(targetRefStencilId)) {
        Polyline2D rectangle = createRectangle(targetInfo);
       
        Collection<Point2D> intersections = rectangle.intersections(lastLine);
        Point2D intersection = intersections.iterator().next();
        graphicInfoList.add(createGraphicInfo(intersection.getX(), intersection.getY()));
       
      } else if (DI_CIRCLES.contains(targetRefStencilId)) {
       
        double targetDockersX = dockersNode.get(dockersNode.size() - 1).get(EDITOR_BOUNDS_X).getDoubleValue();
        double targetDockersY = dockersNode.get(dockersNode.size() - 1).get(EDITOR_BOUNDS_Y).getDoubleValue();
       
        Circle2D eventCircle = new Circle2D(targetInfo.getX() + targetDockersX,
            targetInfo.getY() + targetDockersY, targetDockersX);
       
        Collection<Point2D> intersections = eventCircle.intersections(lastLine);
        Point2D intersection = intersections.iterator().next();
        graphicInfoList.add(createGraphicInfo(intersection.getX(), intersection.getY()));
       
View Full Code Here


    SubProcess subProcess = (SubProcess) flowElement;
    propertiesNode.put("activitytype", "Sub-Process");
    propertiesNode.put("subprocesstype", "Embedded");
    ArrayNode subProcessShapesArrayNode = objectMapper.createArrayNode();
  
    Bounds graphicInfo =  BpmnModelUtil.getBpmnShape(model, flowElement.getId()).getBounds();
    processor.processFlowElements(subProcess.getFlowElements(), model, subProcessShapesArrayNode,
        graphicInfo.getX(), graphicInfo.getY(),null);
    flowElementNode.put("childShapes", subProcessShapesArrayNode);
  }
View Full Code Here

  protected void convertElementToJson(ObjectNode propertiesNode, FlowElement flowElement) {
    SubProcess subProcess = (SubProcess) flowElement;
    propertiesNode.put("activitytype", "Event-Sub-Process");
    propertiesNode.put("subprocesstype", "Embedded");
    ArrayNode subProcessShapesArrayNode = objectMapper.createArrayNode();
    Bounds graphicInfo = BpmnModelUtil.getBpmnShape(model, flowElement.getId()).getBounds();
    processor.processFlowElements(subProcess.getFlowElements(), model, subProcessShapesArrayNode,
        graphicInfo.getX() + subProcessX, graphicInfo.getY() + subProcessY,null);
    flowElementNode.put("childShapes", subProcessShapesArrayNode);
  }
View Full Code Here

    this.processor = processor;
    this.subProcessX = subProcessX;
    this.subProcessY = subProcessY;
    this.shapesArrayNode = shapesArrayNode;
    BPMNShape bpmnShape=BpmnModelUtil.getBpmnShape(model, flowElement.getId());
    Bounds bounds=bpmnShape.getBounds();
    String stencilId = null;
    stencilId = getStencilId(flowElement);
    double upleftX = bounds.getX() - subProcessX;
    double upleftY = bounds.getY() - subProcessY;
    //坐标修正
    if(DI_CIRCLES.contains(stencilId) || DI_GATEWAY.contains(stencilId)){
      upleftX += REVERSION_X;
      upleftY += REVERSION_Y;
    }
    flowElementNode = BpmnJsonConverterUtil.createChildShape(flowElement.getId(), stencilId,
        bounds.getX() - subProcessX + bounds.getWidth(),
        bounds.getY() - subProcessY + bounds.getHeight(),
        upleftX, upleftY);
    shapesArrayNode.add(flowElementNode);
    ObjectNode propertiesNode = objectMapper.createObjectNode();
    propertiesNode.put(PROPERTY_OVERRIDE_ID, flowElement.getId());
    if (StringUtils.isNotEmpty(flowElement.getName())) {
View Full Code Here

    return new Comparator<ContainerShape>() {

      @Override
      public int compare(ContainerShape c1, ContainerShape c2) {
        BPMNShape bpmnShape1 = BusinessObjectUtil.getFirstElementOfType(c1, BPMNShape.class);
        Bounds bounds1 = bpmnShape1.getBounds();
        BPMNShape bpmnShape2 = BusinessObjectUtil.getFirstElementOfType(c2, BPMNShape.class);
        Bounds bounds2 = bpmnShape2.getBounds();
        return new Float(bounds1.getY()).compareTo(new Float(bounds2.getY()));
      }

    };
  }
View Full Code Here

      List<ContainerShape> bottom, Diagram diagram) {

    int y = 0;
    for (ContainerShape container : top) {
      BPMNShape bpmnShape = BusinessObjectUtil.getFirstElementOfType(container, BPMNShape.class);
      Bounds bounds = bpmnShape.getBounds();
      int hAcc = (int) bounds.getHeight();
      gaService.setLocationAndSize(container.getGraphicsAlgorithm(), 0, y, w, hAcc);
      y += hAcc;
      resizeParticipantBandChildren(container, w);
      DIUtils.updateDIShape(container);
      AnchorUtil.relocateFixPointAnchors(container, w, (int) bounds.getHeight());
      AnchorUtil.reConnect(bpmnShape, diagram);
    }

    Collections.reverse(bottom); // start from bottom towards center
    y = h;
    for (ContainerShape container : bottom) {
      BPMNShape bpmnShape = BusinessObjectUtil.getFirstElementOfType(container, BPMNShape.class);
      Bounds bounds = bpmnShape.getBounds();
      y -= bounds.getHeight();
      gaService.setLocationAndSize(container.getGraphicsAlgorithm(), 0, y, w, (int) bounds.getHeight());
      resizeParticipantBandChildren(container, w);
      DIUtils.updateDIShape(container);
      AnchorUtil.relocateFixPointAnchors(container, w, (int) bounds.getHeight());
      AnchorUtil.reConnect(bpmnShape, diagram);
    }
  }
View Full Code Here

    if (bandShape == null) {
      bandShape = peService.createContainerShape(parent, true);
    }

    Bounds bounds = bpmnShape.getBounds();
    int w = (int) bounds.getWidth();
    int h = (int) bounds.getHeight();

    Diagram diagram = peService.getDiagramForPictogramElement(parent);
    RoundedRectangle band = gaService.createRoundedRectangle(bandShape, R, R);
    band.setForeground(gaService.manageColor(diagram, StyleUtil.CLASS_FOREGROUND));
    band.setBackground(initiating ? gaService.manageColor(diagram, IColorConstant.WHITE) : gaService.manageColor(
View Full Code Here

    if (bandShape == null) {
      bandShape = peService.createContainerShape(parent, true);
    }

    Bounds bounds = bpmnShape.getBounds();
    int w = (int) bounds.getWidth();
    int h = (int) bounds.getHeight();

    ILocation parentLoc = peService.getLocationRelativeToDiagram(parent);
    int y = (int) bounds.getY() - parentLoc.getY();

    Diagram diagram = peService.getDiagramForPictogramElement(parent);
    RoundedRectangle band = gaService.createRoundedRectangle(bandShape, R, R);
    band.setForeground(gaService.manageColor(diagram, StyleUtil.CLASS_FOREGROUND));
    band.setBackground(initiating ? gaService.manageColor(diagram, IColorConstant.WHITE) : gaService.manageColor(
View Full Code Here

    if (bandShape == null) {
      bandShape = peService.createContainerShape(parent, true);
    }

    Bounds bounds = bpmnShape.getBounds();
    int w = (int) bounds.getWidth();
    int h = (int) bounds.getHeight();

    ILocation parentLoc = peService.getLocationRelativeToDiagram(parent);
    int y = (int) bounds.getY() - parentLoc.getY();

    Diagram diagram = peService.getDiagramForPictogramElement(parent);
    Rectangle band = gaService.createRectangle(bandShape);
    band.setForeground(gaService.manageColor(diagram, StyleUtil.CLASS_FOREGROUND));
    band.setBackground(initiating ? gaService.manageColor(diagram, IColorConstant.WHITE) : gaService.manageColor(
View Full Code Here

    if (bottomMessageName == null) {
      bottomMessageName = new String();
    }

    BPMNShape bpmnShape = BusinessObjectUtil.getFirstElementOfType(choreographyContainer, BPMNShape.class);
    Bounds bounds = bpmnShape.getBounds();
    int x = (int) ((bounds.getX() + bounds.getWidth() / 2) - (ENV_W / 2));

    if (!hasTopMessage && shouldDrawTopMessage) {
      int y = (int) (bounds.getY() - ENVELOPE_HEIGHT_MODIFIER - ENV_H);
      drawMessageLink(topMessageName, topBoundaryAnchor, x, y, isFilled(topAndBottom.getFirst()));
    } else if (hasTopMessage && !shouldDrawTopMessage) {
      PictogramElement envelope = (PictogramElement) topConnections.get(topConnectionIndex).getEnd().eContainer();
      peService.deletePictogramElement(topConnections.get(topConnectionIndex));
      peService.deletePictogramElement(envelope);
    } else if (hasTopMessage && shouldDrawTopMessage) {
      PictogramElement envelope = (PictogramElement) topConnections.get(topConnectionIndex).getEnd().eContainer();
      setMessageLabel(topMessageName, envelope);
    }

    if (!hasBottomMessage && shouldDrawBottomMessage) {
      int y = (int) (bounds.getY() + bounds.getHeight() + ENVELOPE_HEIGHT_MODIFIER);
      drawMessageLink(bottomMessageName, bottomBoundaryAnchor, x, y, isFilled(topAndBottom.getSecond()));
    } else if (hasBottomMessage && !shouldDrawBottomMessage) {
      PictogramElement envelope = (PictogramElement) bottomConnections.get(bottomConnectionIndex).getEnd()
          .eContainer();
      peService.deletePictogramElement(bottomConnections.get(bottomConnectionIndex));
View Full Code Here

TOP

Related Classes of org.eclipse.dd.dc.Bounds

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.