Exemplo n.º 1
0
 private void parseGPXFile(GPXFile gpx) {
   this.gpx = gpx;
   Route rt = getRoute();
   currentPoints.clear();
   if (rt != null) {
     TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
     String locName = targetPointsHelper.getPointNavigateDescription();
     for (int i = 0; i < rt.points.size(); i++) {
       WptPt wptPt = rt.points.get(i);
       RoutePoint rtp = new RoutePoint();
       rtp.gpxOrder = i;
       rtp.wpt = wptPt;
       String time = wptPt.getExtensionsToRead().get(VISITED_KEY);
       try {
         rtp.visitedTime = Long.parseLong(time);
       } catch (NumberFormatException e) {
       }
       rtp.isNextNavigate =
           rtp.visitedTime == 0 && locName != null && locName.equals(wptPt.name);
       if (rtp.isNextNavigate) {
         locName = null;
       }
       currentPoints.add(rtp);
     }
     sortPoints();
   }
 }
Exemplo n.º 2
0
 public String exportFavorites(File f) {
   GPXFile gpx = new GPXFile();
   for (FavouritePoint p : getFavorites().getFavouritePoints()) {
     if (p.isStored()) {
       WptPt pt = new WptPt();
       pt.lat = p.getLatitude();
       pt.lon = p.getLongitude();
       pt.name = p.getName() + "_" + p.getCategory();
       gpx.points.add(pt);
     }
   }
   return GPXUtilities.writeGpxFile(f, gpx, this);
 }
Exemplo n.º 3
0
 public void setGpxFileToDisplay(GPXFile gpxFileToDisplay, boolean showCurrentGpxFile) {
   this.gpxFileToDisplay = gpxFileToDisplay;
   osmandSettings.SHOW_CURRENT_GPX_TRACK.set(showCurrentGpxFile);
   if (gpxFileToDisplay == null) {
     getFavorites().setFavoritePointsFromGPXFile(null);
   } else {
     List<FavouritePoint> pts = new ArrayList<FavouritePoint>();
     for (WptPt p : gpxFileToDisplay.points) {
       FavouritePoint pt = new FavouritePoint();
       pt.setLatitude(p.lat);
       pt.setLongitude(p.lon);
       if (p.name == null) {
         p.name = "";
       }
       pt.setName(p.name);
       pts.add(pt);
     }
     gpxFileToDisplay.proccessPoints();
     getFavorites().setFavoritePointsFromGPXFile(pts);
   }
 }
Exemplo n.º 4
0
 public void setVisitedTime(long currentTimeMillis) {
   visitedTime = currentTimeMillis;
   wpt.getExtensionsToWrite().put(VISITED_KEY, visitedTime + "");
 }
Exemplo n.º 5
0
 @Override
 public Drawable getLeftIcon() {
   return FavoriteImageDrawable.getOrCreate(
       getMapActivity().getMyApplication(), wpt.getColor(), true);
 }