Ejemplo n.º 1
0
  protected void recalculatePoints(
      RouteCalculationResult route, int type, List<List<LocationPointWrapper>> locationPoints) {
    // sync SHOW settings not otherwise accessible in settings menu (needed so that waypoint
    // dialogue correctly inflates selected categories upon startup)
    app.getSettings().SHOW_NEARBY_POI.set(app.getSettings().ANNOUNCE_NEARBY_POI.get());
    app.getSettings().SHOW_NEARBY_FAVORITES.set(app.getSettings().ANNOUNCE_NEARBY_FAVORITES.get());
    app.getSettings().SHOW_WPT.set(app.getSettings().ANNOUNCE_WPT.get());

    boolean all = type == -1;
    if (route != null && !route.isEmpty()) {
      if ((type == FAVORITES || all)) {
        final List<LocationPointWrapper> array = clearAndGetArray(locationPoints, FAVORITES);
        if (showFavorites()) {
          findLocationPoints(
              route,
              FAVORITES,
              array,
              app.getFavorites().getFavouritePoints(),
              announceFavorites());
          sortList(array);
        }
      }
      if ((type == ALARMS || all)) {
        final List<LocationPointWrapper> array = clearAndGetArray(locationPoints, ALARMS);
        calculateAlarms(route, array);
        sortList(array);
      }
      if ((type == WAYPOINTS || all)) {
        final List<LocationPointWrapper> array = clearAndGetArray(locationPoints, WAYPOINTS);
        if (showGPXWaypoints()) {
          findLocationPoints(
              route,
              WAYPOINTS,
              array,
              app.getAppCustomization().getWaypoints(),
              announceGPXWaypoints());
          findLocationPoints(
              route, WAYPOINTS, array, route.getLocationPoints(), announceGPXWaypoints());
          sortList(array);
        }
      }
      if ((type == POI || all)) {
        final List<LocationPointWrapper> array = clearAndGetArray(locationPoints, POI);
        if (showPOI()) {
          calculatePoi(route, array);
          sortList(array);
        }
      }
    }
  }
Ejemplo n.º 2
0
 public List<LocationPointWrapper> getAllPoints() {
   List<LocationPointWrapper> points = new ArrayList<WaypointHelper.LocationPointWrapper>();
   List<List<LocationPointWrapper>> local = locationPoints;
   TIntArrayList ps = pointsProgress;
   for (int i = 0; i < local.size(); i++) {
     List<LocationPointWrapper> loc = local.get(i);
     if (ps.get(i) < loc.size()) {
       points.addAll(loc.subList(ps.get(i), loc.size()));
     }
   }
   getTargets(points);
   sortList(points);
   return points;
 }