Skip to content

Commit

Permalink
Merge branch 'osmandapp:master' into hardy_Afa+thres
Browse files Browse the repository at this point in the history
  • Loading branch information
sonora authored Oct 31, 2023
2 parents 47eeb3f + cbf715a commit ed04e4f
Show file tree
Hide file tree
Showing 144 changed files with 3,390 additions and 1,362 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ Thumbs.db

# Output files
build

#Rendering test files
OsmAnd-java/src/test/resources/rendering/*
20 changes: 19 additions & 1 deletion OsmAnd-api/src/net/osmand/aidlapi/gpx/HideGpxParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@
import android.os.Bundle;
import android.os.Parcel;

import androidx.annotation.Nullable;

import net.osmand.aidlapi.AidlParams;

public class HideGpxParams extends AidlParams {

@Nullable
private String filePath;
@Nullable
private String fileName;

public HideGpxParams(String fileName) {
public HideGpxParams(@Nullable String fileName) {
this(null, fileName);
}

public HideGpxParams(@Nullable String filePath, @Nullable String fileName) {
this.filePath = filePath;
this.fileName = fileName;
}

Expand All @@ -29,17 +39,25 @@ public HideGpxParams[] newArray(int size) {
}
};

@Nullable
public String getFileName() {
return fileName;
}

@Nullable
public String getFilePath() {
return filePath;
}

@Override
public void writeToBundle(Bundle bundle) {
bundle.putString("fileName", fileName);
bundle.putString("filePath", filePath);
}

@Override
protected void readFromBundle(Bundle bundle) {
fileName = bundle.getString("fileName");
filePath = bundle.getString("filePath");
}
}
3 changes: 3 additions & 0 deletions OsmAnd-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ task collectTestResources(type: Copy) {
from("../../resources/test-resources") {
include "*"
include "/search/*"
include "/rendering/*"
include "/rendering/maps/*"
include "/rendering/geotiffs/*"
}
from("../../resources/poi") {
include "poi_types.xml"
Expand Down
21 changes: 12 additions & 9 deletions OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.osmand.binary;

import static net.osmand.router.GeneralRouter.*;

import java.util.Arrays;


Expand Down Expand Up @@ -827,16 +829,17 @@ public String getHighway() {
return getHighway(types, region);
}

public boolean hasPrivateAccess() {
int sz = types.length;
for (int i = 0; i < sz; i++) {
RouteTypeRule r = region.quickGetEncodingRule(types[i]);
if ("motorcar".equals(r.getTag())
|| "motor_vehicle".equals(r.getTag())
|| "vehicle".equals(r.getTag())
|| "access".equals(r.getTag())) {
if (r.getValue().equals("private")) {
public boolean hasPrivateAccess(GeneralRouterProfile profile) {
for (int type : types) {
RouteTypeRule rule = region.quickGetEncodingRule(type);
String tag = rule.getTag();
if (rule.getValue().equals("private")) {
if ("vehicle".equals(tag) || "access".equals(tag)) {
return true;
} else if (profile == GeneralRouterProfile.CAR) {
return "motorcar".equals(tag) || "motor_vehicle".equals(tag);
} else if (profile == GeneralRouterProfile.BICYCLE) {
return "bicycle".equals(tag);
}
}
}
Expand Down
20 changes: 20 additions & 0 deletions OsmAnd-java/src/main/java/net/osmand/gpx/GPXUtilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,23 @@ public static long parseTime(String text, SimpleDateFormat format, SimpleDateFor
return time;
}

public static long getCreationTime(GPXFile gpxFile) {
long time = 0;
if (gpxFile != null) {
if (gpxFile.metadata != null && gpxFile.metadata.time > 0) {
time = gpxFile.metadata.time;
} else if (gpxFile.getLastPoint() != null && gpxFile.getLastPoint().time > 0) {
time = gpxFile.getLastPoint().time;
} else if (gpxFile.modifiedTime > 0) {
time = gpxFile.modifiedTime;
}
}
if (time == 0) {
time = System.currentTimeMillis();
}
return time;
}

private static SimpleDateFormat getTimeFormatter() {
SimpleDateFormat format = new SimpleDateFormat(GPX_TIME_PATTERN, Locale.US);
format.setTimeZone(TimeZone.getTimeZone("UTC"));
Expand Down Expand Up @@ -1726,6 +1743,9 @@ public static GPXFile loadGPXFile(InputStream stream, GPXExtensionsReader extens
if (addGeneralTrack) {
gpxFile.addGeneralTrack();
}
if (gpxFile.metadata.time == 0) {
gpxFile.metadata.time = getCreationTime(gpxFile);
}
} catch (Exception e) {
gpxFile.error = e;
log.error("Error reading gpx", e); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ protected MapRulType parseBaseRuleType(XmlPullParser parser, MapRulType parentCa
rtype.propagateToNodes = MapRulType.PropagateToNodesType.CENTER;
}
}
String propagateToNodesPrefix = parser.getAttributeValue("", "propagateToNodesPrefix");
if (propagateToNodesPrefix != null) {
rtype.propagateToNodesPrefix = propagateToNodesPrefix;
}

String order = parser.getAttributeValue("", "order");
if(!Algorithms.isEmpty(order)) {
Expand Down Expand Up @@ -547,6 +551,7 @@ public static class MapRulType {
protected Map<String, String> relationGroupNameTags;
protected Map<String, String> relationGroupAdditionalTags;
protected PropagateToNodesType propagateToNodes = PropagateToNodesType.NONE;
protected String propagateToNodesPrefix;

protected TagValuePattern tagValuePattern;
protected boolean additional;
Expand Down Expand Up @@ -740,6 +745,10 @@ public PropagateToNodesType getPropagateToNodesType() {
return propagateToNodes;
}

public String getPropagateToNodesPrefix() {
return propagateToNodesPrefix;
}

public enum PropagateToNodesType {
NONE,
ALL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ private boolean needRequestPrivateAccessRouting(RoutingContext ctx, List<LatLon>
for (LatLon latLon : points) {
RouteSegmentPoint rp = findRouteSegment(latLon.getLatitude(), latLon.getLongitude(), ctx, null);
if (rp != null && rp.road != null) {
if (rp.road.hasPrivateAccess()) {
if (rp.road.hasPrivateAccess(ctx.config.router.getProfile())) {
res = true;
break;
}
Expand Down
Loading

0 comments on commit ed04e4f

Please sign in to comment.