コード例 #1
0
  public int findGridNearElementHorizontal(AbstractElement element) {
    int x = element.getMiddleX();
    int xDiff = Integer.MAX_VALUE;
    int xNew = 0;

    for (AbstractElement e : tweetFlow.getmElements().values()) {
      if (e instanceof ServiceRequest) {
        if ((element.getId() != e.getId()) && ((Math.abs(x - e.getMiddleX())) < xDiff)) {
          xDiff = Math.abs(x - e.getMiddleX());
          xNew = e.getMiddleX();
        }
      }
    }

    return xNew;
  }
コード例 #2
0
  public boolean isThereGridNearElementHorizontal(AbstractElement element) {
    int x = element.getMiddleX();
    int xDiff = Integer.MAX_VALUE;

    for (AbstractElement e : tweetFlow.getmElements().values()) {
      if (e instanceof ServiceRequest) {
        if ((element.getId() != e.getId()) && ((Math.abs(x - e.getMiddleX())) < xDiff)) {
          xDiff = Math.abs(x - e.getMiddleX());
        }
      }
    }

    if (xDiff < 15) return true;

    return false;
  }
コード例 #3
0
 public void selectElementsOnGrid(int x) {
   for (AbstractElement e : tweetFlow.getmElements().values()) {
     if (e instanceof ServiceRequest) {
       if (e.getMiddleX() == x) {
         tweetFlow.getmSelected().put(e.getId(), e);
         e.modeSelected();
       }
     }
   }
 }