Beispiel #1
0
  @Override
  protected Point getNonStdConnectIn(Direction dir) {
    Point c = this.getConnect(Direction.TOP);

    if (dir.equals(Direction.LEFT)) c.x -= (int) (10 * getZoom());
    else if (dir.equals(Direction.RIGHT)) c.x += (int) (10 * getZoom());

    if (this.arrowIn())
      Connector.drawArrow(
          this.getGraphics(), getZoom(), c.x, c.y - (int) (10 * getZoom()), c.x, c.y);
    else this.getGraphics().drawLine(c.x, c.y - (int) (10 * getZoom()), c.x, c.y);
    c.y -= (int) (10 * getZoom());
    return c;
  }
Beispiel #2
0
  public void paint(float zoomFactor, int gotoPosition) {
    if (from_element.connectOut_overrideable() && to_element.connectIn() && to_element.arrowIn()) {
      Point from = from_element.getNonStdConnectOut(dir);
      Point to = to_element.getNonStdConnectIn(dir);
      Point to_origin = to_element.getConnect(dir);

      int x = gotoPosition;
      graphics.drawLine(from.x, from.y, x, from.y);
      graphics.drawLine(x, from.y, x, to.y);

      if (to.x == to_origin.x && to.y == to_origin.y) {
        float zoom = zoomFactor;
        Connector.drawArrow(graphics, zoom, x, to.y, to.x, to.y);
      } else {
        graphics.drawLine(x, to.y, to.x, to.y);
      }
    }
  }
Beispiel #3
0
  @Override
  public void connectTo(Element e) {
    if (e != null) {
      if (this.connectOut_overrideable() && e.connectIn()) {
        Point from = this.getPosition();
        Point to = e.getConnect(Direction.TOP);
        if (from.x == to.x) from = this.getConnect(Direction.BOTTOM);
        else if (from.x < to.x) from = this.getConnect(Direction.RIGHT);
        else if (from.x > to.x) from = this.getConnect(Direction.LEFT);

        if (from.x != to.x) {
          this.getGraphics()
              .drawLine(from.x, from.y, to.x, to.y - (int) (Const.PAD * getZoom()) * 2);
          from.x = to.x;
          from.y = (int) (to.y - Const.PAD * getZoom() * 2);
        }

        if (this.arrowOut() && e.arrowIn())
          Connector.drawArrow(this.getGraphics(), getZoom(), from.x, from.y, to.x, to.y);
        else this.getGraphics().drawLine(from.x, from.y, to.x, to.y);
      }
    }
  }