private void movingMap(int x, int y) { MapStatusBar.setCoordinate(StringUtil.toNumString(x) + " : " + StringUtil.toNumString(y)); if (mainFrame.getMapMode() == MapMode.VIEW || mainFrame.getMapMode() == MapMode.TEST_ROUTE || mainFrame.getMapMode() == MapMode.ADD_BUS || mainFrame.getMapMode() == MapMode.EDIT_BUS || mainFrame.getMapMode() == MapMode.COPY_BUS || mainFrame.getMapMode() == MapMode.EDIT_POINT) { if (dragX != MapConstants.NULL && dragY != MapConstants.NULL) { int diffX = x - dragX; int diffY = y - dragY; dragX = x; dragY = y; startX -= diffX; startY -= diffY; repaint(); } } if (mainFrame.getMapMode() == MapMode.ADD_BUS || mainFrame.getMapMode() == MapMode.EDIT_BUS || mainFrame.getMapMode() == MapMode.COPY_BUS || mainFrame.getMapMode() == MapMode.EDIT_POINT) { if (dragPoint != null) { List<PointInfo> oldMapPoint = selectMapPoint(dragPoint.getAxisX(), dragPoint.getAxisY()); dragPoint.setAxisX(x + startX); dragPoint.setAxisY(y + startY); dragPoint.setEdited(); if (dragPoint.equals(pointSelect)) { mainFrame.onSelectPoint(pointSelect); } List<PointInfo> newMapPoint = selectMapPoint(dragPoint.getAxisX(), dragPoint.getAxisY()); if (!oldMapPoint.equals(newMapPoint)) { oldMapPoint.remove(dragPoint); newMapPoint.add(dragPoint); } List<BusLine> busLines = findBusLines(dragPoint); for (int i = 0; i < busLines.size(); i++) { BusLine busLine = busLines.get(i); if (busLine.getP1Id() == dragPoint.getPId()) { busLine.setX1(dragPoint.getAxisX()); busLine.setY1(dragPoint.getAxisY()); } else if (busLine.getP2Id() == dragPoint.getPId()) { busLine.setX2(dragPoint.getAxisX()); busLine.setY2(dragPoint.getAxisY()); } } repaint(); } } }