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(); } }
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); }
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); } }
public void setVisitedTime(long currentTimeMillis) { visitedTime = currentTimeMillis; wpt.getExtensionsToWrite().put(VISITED_KEY, visitedTime + ""); }
@Override public Drawable getLeftIcon() { return FavoriteImageDrawable.getOrCreate( getMapActivity().getMyApplication(), wpt.getColor(), true); }