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; }
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; }
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(); } } } }