public void nodeDown(int x, int y) { log.info("nodeDn x=" + x + ", y=" + y); if (dtoLinks == null) { log.info("dtoLinks==null"); dtoLinks = new DTOLinks(); SCL.getCurrSecCanvas().getDtoCanvas().setDtoLinks(dtoLinks); } dtoLink = null; moving = false; Iterator<DTOLink> it = dtoLinks.getDTOLinks().iterator(); while (it.hasNext()) { DTOLink p = it.next(); if ((Math.abs(x - getCoord(p.getX())) ^ 2) + (Math.abs(y - getCoord(p.getY())) ^ 2) < (nodeRadius ^ 2)) { dtoLink = p; return; } } clear(); DTOLink p = new DTOLink(); p.setCanvasMapId(SCL.getCurrSecCanvas().getDtoCanvas().getId()); p.setX(getRevCoord(x)); p.setY(getRevCoord(y)); dtoLinks.getDTOLinks().add(p); SCL.getCanvasDialog().updateCurrLinkNodes(); draw(false); }
public void nodeMove(int x, int y) { log.info("nodeMve"); if (dtoLink != null) { if (Math.pow(x - getCoord(dtoLink.getX()), 2) + Math.pow(y - getCoord(dtoLink.getY()), 2) > Math.pow(nodeRadius, 2)) { moving = true; clear(); dtoLink.setX(getRevCoord(x)); dtoLink.setY(getRevCoord(y)); draw(false); } } SCL.getCanvasDialog().updateCurrLinkNodes(); }