Ejemplo n.º 1
0
    @Override
    protected void onPostExecute(SchedulePlot schedulePlot) {

      // CPSC 210 Students: This method should plot the route onto the map
      // with the given line colour specified in schedulePlot. If there is
      // no route to plot, a dialog box should be displayed.

      // To actually make something show on the map, you can use overlays.
      // For instance, the following code should show a line on a map
      // PathOverlay po = createPathOverlay("#FFFFFF");
      // po.addPoint(point1); // one end of line
      // po.addPoint(point2); // second end of line
      // scheduleOverlay.add(po);
      // OverlayManager om = mapView.getOverlayManager();
      // om.addAll(scheduleOverlay);
      // mapView.invalidate(); // cause map to redraw

      PathOverlay po = createPathOverlay(schedulePlot.getColourOfLine());
      // plot buildings of the schedule
      plotBuildings(schedulePlot);
      // if there is no route, display no route
      if (schedulePlot.getRoute() == null) {
        AlertDialog aDialog = createSimpleDialog("NO ROUTE TO PLOT");
        aDialog.show();
        // otherwise plot the route
      } else {
        // get the list of geopoints of the schedulePlot
        List<GeoPoint> points = schedulePlot.getRoute();
        for (GeoPoint point : points) {
          po.addPoint(point);
        }
        scheduleOverlay.add(po);
        OverlayManager om = mapView.getOverlayManager();
        om.addAll(scheduleOverlay);
        mapView.invalidate();
      }
    }