Ejemplo n.º 1
0
 /** Starts route generation after the calculate button has been pressed. */
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == calcButton) {
     OsmMap map = frame.getMap();
     List<Position> positions =
         routeCalculator.calculateRoute(map.getMarkers(), map, waySelection.getSelectedIndex());
     frame.getMap().createTrack(ROUTE_TRACK_NAME, positions);
   }
 }
Ejemplo n.º 2
0
  public RoutePlannerApp(String[] args) {
    frame = new MapViewFrame(args);
    frame.setTitle("OSM Route Planner");
    routeCalculator = createRouteCalculator();
    JToolBar toolbar = frame.getToolbar();
    toolbar.addSeparator();
    waySelection = new JComboBox(routeCalculator.getWaySelectionOptions());
    toolbar.add(waySelection);
    toolbar.addSeparator();
    calcButton = new JButton("Calculate Route");
    calcButton.setEnabled(frame.getMap().getMarkers().size() >= 2);
    calcButton.addActionListener(this);
    toolbar.add(calcButton);

    frame.getMap().addMapDataEventListener(new MapDataEventHandler());
  }