Exemplo 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);
   }
 }
Exemplo 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());
  }
Exemplo n.º 3
0
 /**
  * Loads the default map if necessary and returns the frame (useful for integration into an AIMA
  * demo application).
  */
 public MapViewFrame constructApplicationFrame() {
   if (frame.getMap().isEmpty()) frame.readMap(DataResource.getULMFileResource());
   return frame;
 }
Exemplo n.º 4
0
 public void showFrame() {
   frame.setSize(800, 600);
   frame.setVisible(true);
 }