Skip to content

Commit

Permalink
Actualize TravelGpx type/activity strings, fix npe
Browse files Browse the repository at this point in the history
  • Loading branch information
RZR-UA committed Dec 13, 2024
1 parent 981fc84 commit 5dfebfd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion OsmAnd-java/src/main/java/net/osmand/osm/MapPoiTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class MapPoiTypes {
public static final String ROUTE_ARTICLE_POINT = "route_article_point";
public static final String CATEGORY = "category";
public static final String ROUTE_TRACK = "route_track"; // routes:route_track (no activity)
public static final String ROUTES_PREFIX = "routes_"; // routes:routes_xxx (activity type)
public static final String ROUTES_PREFIX = "routes_"; // routes:routes_xxx (any activity type)
public static final String ROUTE_TRACK_POINT = "route_track_point";

private PoiTranslator poiTranslator = null;
Expand Down
22 changes: 9 additions & 13 deletions OsmAnd/res/values/phrases.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5454,19 +5454,15 @@

<string name="poi_route_article">Travel Articles</string>
<string name="poi_route_article_point">Travel Points</string>
<string name="poi_route_track">Other routes</string>
<string name="poi_route_track_point">Other routes points</string>
<string name="poi_routes_bicycle">Bicycle</string>
<string name="poi_routes_trekking">Hiking</string>
<string name="poi_routes_running">Running</string>
<string name="poi_routes_pedestrian">Walking</string>
<string name="poi_routes_kayak">Water sports</string>
<string name="poi_routes_horse">Horse riding</string>
<string name="poi_routes_skiing">Winter sports</string>
<string name="poi_routes_snowmobile">Snowmobile</string>
<string name="poi_routes_fitness">Fitness trails</string>
<string name="poi_routes_inline_skates">Inline skates</string>
<string name="poi_routes_mountain_bike">Mountain biking</string>
<string name="poi_route_track_point">Route points</string>
<string name="poi_routes_driving">Driving</string>
<string name="poi_routes_motorcycling">Motorcycling</string>
<string name="poi_routes_foot">Foot</string>
<string name="poi_routes_winter_sport">Winter sports</string>
<string name="poi_routes_cycling">Cycling</string>
<string name="poi_routes_air_sports">Air Sports</string>
<string name="poi_routes_water_sport">Water sports</string>
<string name="poi_routes_other">Other routes</string>

<string name="poi_name_etymology">Name etymology</string>
<string name="poi_name_left">Name of the left side</string>
Expand Down
5 changes: 4 additions & 1 deletion OsmAnd/src/net/osmand/plus/render/TravelRendererHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ public void updateRouteTrackFilters() {
routeTrackFilters.add(app.getPoiFilters().getFilterById(PoiUIFilter.STD_PREFIX + subTypeKeyName));
}
}
routeTrackFilters.add(app.getPoiFilters().getFilterById(PoiUIFilter.STD_PREFIX + ROUTE_TRACK));
PoiUIFilter filter = app.getPoiFilters().getFilterById(PoiUIFilter.STD_PREFIX + ROUTE_TRACK);
if (filter != null) {
routeTrackFilters.add(filter);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ private TravelGpx getTravelGpx(File file, Amenity amenity) {
travelGpx.description = Algorithms.emptyIfNull(amenity.getTagContent(Amenity.DESCRIPTION));
travelGpx.routeId = Algorithms.emptyIfNull(amenity.getTagContent(Amenity.ROUTE_ID));
travelGpx.user = Algorithms.emptyIfNull(amenity.getTagContent(USER));
travelGpx.activityType = Algorithms.emptyIfNull(amenity.getTagContent(ACTIVITY_TYPE));
travelGpx.activityType = Algorithms.emptyIfNull(amenity.getTagContent(ACTIVITY_TYPE)); // TODO
travelGpx.ref = Algorithms.emptyIfNull(amenity.getRef());
travelGpx.totalDistance = Algorithms.parseFloatSilently(amenity.getTagContent(DISTANCE), 0);
travelGpx.diffElevationUp = Algorithms.parseDoubleSilently(amenity.getTagContent(DIFF_ELEVATION_UP), 0);
Expand All @@ -342,7 +342,7 @@ public boolean accept(PoiCategory type, String subcategory) {
return true;
}
if (ROUTE_TRACK.equals(filter) && subcategory.startsWith(ROUTES_PREFIX)) {
return true; // include routes:routes_xxx by routes:route_track filter
return true; // include routes:routes_xxx with routes:route_track filter
}
}
return false;
Expand Down Expand Up @@ -1287,7 +1287,7 @@ private synchronized GpxFile buildGpxFile(@NonNull List<BinaryMapIndexReader> re
if (gpxFileExtensions.containsKey(GpxUtilities.ACTIVITY_TYPE)) {
gpxFile.getMetadata().getExtensionsToWrite()
.put(GpxUtilities.ACTIVITY_TYPE, gpxFileExtensions.get(GpxUtilities.ACTIVITY_TYPE));
gpxFileExtensions.remove(GpxUtilities.ACTIVITY_TYPE); // move activity to metadata
gpxFileExtensions.remove(GpxUtilities.ACTIVITY_TYPE); // move activity to metadata TODO fixme
}
gpxFile.getExtensionsToWrite().putAll(gpxFileExtensions); // finally
}
Expand Down

0 comments on commit 5dfebfd

Please sign in to comment.