void createStation(int x, int y) { for (Station station : allStations) { if (station.checkPosition(x, y)) { return; } } String nameStation = JOptionPane.showInputDialog("Name station"); if (nameStation != null) { if (!nameStation.equals("")) { Station station = new Station(allStations.size(), nameStation, "N" + x + "_" + y, x, y); allStations.add(station); this.createVertex(station.getxPosition(), station.getyPosition()); } } }
public synchronized boolean deleteTile(int x, int y) { Station tempStation = null; for (Station station : allStations) { if (station.checkPosition(x, y)) { tempStation = station; break; } } allStations.remove(tempStation); Vertex tempVertex = null; for (Vertex vertex : allVertexes) { if (vertex.checkPosition(x, y)) { tempVertex = vertex; break; } } allVertexes.remove(tempVertex); return true; }
void selectTile(int x, int y) { selectedVertex = null; selectedStation = null; for (Vertex vertex : allVertexes) { if (vertex.checkPosition(x, y)) { selectedVertex = vertex; break; } } for (Station station : allStations) { if (station.checkPosition(x, y)) { selectedStation = station; break; } } if (selectedVertex != null) { this.mapMakerView.getShowDataPanel().getNewPodcarButton().setEnabled(true); } else { this.mapMakerView.getShowDataPanel().getNewPodcarButton().setEnabled(false); } }