Exemplo n.º 1
0
  /* Changes the size of the Gateway Node. */
  private void manipulateSplit(
      CanonicalProcessType cpf,
      AnnotationsType anf,
      GraphicsType splitGraphicsType,
      NodeType splitNode) {
    int index;
    BigDecimal newX, newY;
    PositionType position;
    GraphicsType targetAnn, targetEdgeAnn;
    SplitType split = (SplitType) splitNode;

    BigDecimal oldH = splitGraphicsType.getSize().getHeight();
    BigDecimal oldW = splitGraphicsType.getSize().getWidth();
    BigDecimal oldX = splitGraphicsType.getPosition().get(0).getX();
    BigDecimal oldY = splitGraphicsType.getPosition().get(0).getY();

    Map<EdgeType, NodeType> targets = findSplitNodeTargets(cpf, split.getId());
    for (Map.Entry<EdgeType, NodeType> target : targets.entrySet()) {
      targetAnn = findGraphicsType(anf, target.getValue().getId());
      targetEdgeAnn = findGraphicsType(anf, target.getKey().getId());

      if (targetAnn != null) {
        newX =
            targetAnn
                .getSize()
                .getWidth()
                .divide(divisor)
                .add(targetAnn.getPosition().get(0).getX());
        newY = targetAnn.getPosition().get(0).getY();

        index = 0;
        for (PositionType targetEdgePos : targetEdgeAnn.getPosition()) {
          if (!((targetEdgePos.getX().compareTo(oldX) > 0)
              && (targetEdgePos.getX().compareTo(oldX.add(oldW)) < 0)
              && (targetEdgePos.getY().compareTo(oldY) > 0)
              && (targetEdgePos.getY().compareTo(oldY.add(oldH)) < 0))) {
            position = new PositionType();
            position.setX(newX);
            position.setY(newY);

            targetEdgeAnn.getPosition().set(index, position);
          }
          index++;
        }
      }
    }
  }