Exemplo n.º 1
0
 /**
  * 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);
   }
 }
Exemplo n.º 2
0
  /** 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
    }
  }