/** * Accepts {@link Stop} List to draw stops on map for specific set of Stop objects. * * @param stopList - List of Stop objects */ private void drawClosestMapStops(List<Stop> stopList, String address) { try { mapControl = mainView.getMapControl(); mapControl.setCenterPosition(mainModel.getSearchGeoPosition(address)); mapControl.setZoom(2); mapControl.addWaypoint(getWayPoints(stopList), stopList); mapControl.addHomeWaypoint(mainModel.getSearchWayPoint(address)); mapControl.getStopsNearHome(); } catch (ServiceUnavailableException e) { mainView.notifyAndExit(MainView.NEXTBUS_SERVICE_UNAVAILABLE); } catch (InvalidAddressException e) { mainView.updateStatus(MainView.INVALID_ADDRESS); } }
/** * Accepts Route Tag value to retrieve Route object. Gets list of GeoPosition points using Route * object. Draws route on map based on retrieved GeoPosition points. * * @param routeTag - Route Object Tag value (String) */ private void drawMapRoute(String routeTag) { try { Route route = mainModel.getRoute(routeTag); RouteConfig routeConfig = mainModel.getRouteConfig(route); ArrayList<Path> ttfPaths = mainModel.getPathList(route); mapControl = mainView.getMapControl(); mapControl.drawRoute(routeConfig, ttfPaths); mapControl.getAllOverlays(); mainView.updateMapViewer(); } catch (ServiceUnavailableException e) { mainView.notifyAndExit(MainView.NEXTBUS_SERVICE_UNAVAILABLE); } }
/** Action performed when row is selected */ public void rowSelectedAction(JTable table) { try { Thread.sleep(200); } catch (InterruptedException e) { e.printStackTrace(); } try { int row = table.getSelectedRow(); int latCol = table.getModel().getColumnCount() - 2; int lonCol = table.getModel().getColumnCount() - 1; BigDecimal lat = new BigDecimal((String) table.getModel().getValueAt(row, latCol)); BigDecimal lon = new BigDecimal((String) table.getModel().getValueAt(row, lonCol)); mapControl.setCenterPosition(lat, lon); mapControl.setZoom(1); } catch (IndexOutOfBoundsException e) { // Do Nothing } }
/** * Accepts {@link Stop} List to draw stops on map for specific set of Stop objects. * * @param stopList - List of Stop objects */ private void drawMapStops(List<Stop> stopList) { mapControl = mainView.getMapControl(); mapControl.addWaypoint(getWayPoints(stopList), stopList); mapControl.getAllOverlays(); }