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(); } } } }
public int findGridHorizontal() { int x = tweetFlow.getTouchElement().getMiddleX(); int xDiff = Integer.MAX_VALUE; int xNew = 0; for (AbstractElement e : tweetFlow.getmElements().values()) { if (e instanceof ServiceRequest) { if (tweetFlow.getTouchElement().getId() != e.getId()) { if ((Math.abs(x - e.getMiddleX())) < xDiff) { xDiff = Math.abs(x - e.getMiddleX()); xNew = e.getMiddleX(); } } } } return xNew; }
public boolean isThereGridHorizontal() { int x = tweetFlow.getTouchElement().getMiddleX(); int xDiff = Integer.MAX_VALUE; for (AbstractElement e : tweetFlow.getmElements().values()) { if (e instanceof ServiceRequest) { if (tweetFlow.getTouchElement().getId() != e.getId()) { if ((Math.abs(x - e.getMiddleX())) < xDiff) { xDiff = Math.abs(x - e.getMiddleX()); } } } } if (xDiff < 30) return true; return false; }
public ArrayList<ServiceRequest> getElementsOnGrid(int x) { ArrayList<ServiceRequest> gridElements = new ArrayList<ServiceRequest>(); for (AbstractElement e : tweetFlow.getmElements().values()) { if (e instanceof ServiceRequest) { if (e.getMiddleX() == x) { gridElements.add((ServiceRequest) e); } } } return gridElements; }
public int getTouchOnGrid(int xScaled) { int x = xScaled - mOffsetX; int xDiff = Integer.MAX_VALUE; int xNew = 0; for (AbstractElement e : tweetFlow.getmElements().values()) { if (e instanceof ServiceRequest) { if ((Math.abs(x - e.getMiddleX())) < xDiff) { xDiff = Math.abs(x - e.getMiddleX()); xNew = e.getMiddleX(); } } } return xNew; }
public boolean isTouchOnGrid(int xScaled) { int x = xScaled - mOffsetX; int xDiff = Integer.MAX_VALUE; for (AbstractElement e : tweetFlow.getmElements().values()) { if (e instanceof ServiceRequest) { if ((Math.abs(x - e.getMiddleX())) < xDiff) { xDiff = Math.abs(x - e.getMiddleX()); } } } if (xDiff < 30) return true; return false; }
public int findGridNearGridHorizontal(ArrayList<ServiceRequest> gridElements) { int x = gridElements.get(0).getMiddleX(); int xDiff = Integer.MAX_VALUE; int xNew = 0; for (AbstractElement e : tweetFlow.getmElements().values()) { if (e instanceof ServiceRequest) { if ((!gridElements.contains(e)) && ((Math.abs(x - e.getMiddleX())) < xDiff)) { xDiff = Math.abs(x - e.getMiddleX()); xNew = e.getMiddleX(); } } } return xNew; }
public boolean isThereGridNearGridHorizontal(ArrayList<ServiceRequest> gridElements) { if (gridElements == null) return false; if (gridElements.isEmpty()) return false; int x = gridElements.get(0).getMiddleX(); int xDiff = Integer.MAX_VALUE; for (AbstractElement e : tweetFlow.getmElements().values()) { if (e instanceof ServiceRequest) { if ((!gridElements.contains(e)) && ((Math.abs(x - e.getMiddleX())) < xDiff)) { xDiff = Math.abs(x - e.getMiddleX()); } } } if (xDiff < 15) return true; return false; }
public void draw(Canvas canvas) { if (rasterOn) { horizontalRasterCT = (canvas.getWidth() / RASTER_HORIZONTAL_WIDTH) + 3; Paint paint = new Paint(); paint.setPathEffect(new DashPathEffect(new float[] {10, 3, 6, 3}, 1)); float scale = editorView.getmScaleFactor(); if ((snapMode == SNAP_OFF) || (snapMode == SNAP_RASTER)) { paint.setColor(Color.BLUE); ArrayList<Integer> gridLines = createRasterLines(); for (int i = 0; i < gridLines.size(); i++) { canvas.drawLine( gridLines.get(i), (int) ((0 - mOffsetY) / scale), gridLines.get(i), (int) ((canvas.getHeight() - mOffsetY) / scale), paint); } } if (snapMode == SNAP_GRID) { paint.setColor(Color.RED); for (AbstractElement e : tweetFlow.getmElements().values()) { if (e instanceof ServiceRequest) { canvas.drawLine( e.getMiddleX(), (int) ((0 - mOffsetY) / scale), e.getMiddleX(), (int) ((canvas.getHeight() - mOffsetY) / scale), paint); } } } } }