Skip to content

Commit

Permalink
Merge branch 'master' into rzr-click
Browse files Browse the repository at this point in the history
  • Loading branch information
RZR-UA committed Dec 4, 2024
2 parents 21c3726 + 78048df commit 9409b54
Show file tree
Hide file tree
Showing 24 changed files with 5,326 additions and 74 deletions.
56 changes: 23 additions & 33 deletions OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public class GeneralRouter implements VehicleRouter {

// cached values
private boolean restrictionsAware = true;
private float sharpTurn;
private float roundaboutTurn;
private float slightTurn;
private float sharpTurn, shortWaySharpTurn;
private float slightTurn, shortWaySlightTurn;
private float roundaboutTurn, shortWayRoundaboutTurn;
// speed in m/s
private float minSpeed = 0.28f;
// speed in m/s
Expand All @@ -97,8 +97,7 @@ public class GeneralRouter implements VehicleRouter {
public String[] hhNativeFilter = new String[0]; // getFilteredTags() as flat Array (JNI)
public String[] hhNativeParameterValues = new String[0]; // parameterValues as flat Array (JNI)
private final GeneralRouter root;



public enum RouteDataObjectAttribute {
ROAD_SPEED("speed"),
ROAD_PRIORITIES("priority"),
Expand Down Expand Up @@ -293,6 +292,12 @@ public void addAttribute(String k, String v) {
minSpeed = parseSilentFloat(v, minSpeed * 3.6f) / 3.6f;
} else if (k.equals("maxDefaultSpeed") || k.equals("maxSpeed")) {
maxSpeed = parseSilentFloat(v, maxSpeed * 3.6f) / 3.6f;
} else if (k.equals("shortWaySharpTurn")) {
shortWaySharpTurn = parseSilentFloat(v, shortWaySharpTurn);
} else if (k.equals("shortWaySlightTurn")) {
shortWaySlightTurn = parseSilentFloat(v, shortWaySlightTurn);
} else if (k.equals("shortWayRoundaboutTurn")) {
shortWayRoundaboutTurn = parseSilentFloat(v, shortWayRoundaboutTurn);
}
}

Expand Down Expand Up @@ -682,16 +687,16 @@ public float getMaxSpeed() {
return maxSpeed;
}

public double getLeftTurn() {
return sharpTurn;
private float getSharpTurnPenalty() {
return shortestRoute ? shortWaySharpTurn : sharpTurn;
}

public double getRightTurn() {
return slightTurn;
private float getSlightTurnPenalty() {
return shortestRoute ? shortWaySlightTurn : slightTurn;
}

public double getRoundaboutTurn() {
return roundaboutTurn;
private float getRoundaboutTurnPenalty() {
return shortestRoute ? shortWayRoundaboutTurn : roundaboutTurn;
}

@Override
Expand All @@ -703,42 +708,27 @@ public double calculateTurnTime(RouteSegment segment, RouteSegment prev) {
totalPenalty += Math.abs(ts - prevTs) / 2;
}

// int[] pt = prev.getRoad().getPointTypes(prevSegmentEnd);
// if(pt != null) {
// RouteRegion reg = prev.getRoad().region;
// for (int i = 0; i < pt.length; i++) {
// RouteTypeRule r = reg.quickGetEncodingRule(pt[i]);
// if ("highway".equals(r.getTag()) && "traffic_signals".equals(r.getValue())) {
// // traffic signals don't add turn info
// return 0;
// }
// }
// }
if (shortestRoute) {
return totalPenalty;
}
if(segment.getRoad().roundabout() && !prev.getRoad().roundabout()) {
double rt = getRoundaboutTurn();
if(rt > 0) {
if (segment.getRoad().roundabout() && !prev.getRoad().roundabout()) {
double rt = getRoundaboutTurnPenalty();
if (rt > 0) {
totalPenalty += rt;
}
} else if (getLeftTurn() > 0 || getRightTurn() > 0) {
} else if (getSharpTurnPenalty() > 0 || getSlightTurnPenalty() > 0) {
double a1 = segment.getRoad().directionRoute(segment.getSegmentStart(), segment.isPositive());
double a2 = prev.getRoad().directionRoute(prev.getSegmentEnd(), !prev.isPositive());
double diff = Math.abs(MapUtils.alignAngleDifference(a1 - a2 - Math.PI));
if (diff > Math.PI / 1.5) {
totalPenalty += getLeftTurn(); // >120 degree (U-turn)
totalPenalty += getSharpTurnPenalty(); // >120 degree (U-turn)
} else if (diff > Math.PI / 3) {
totalPenalty += getRightTurn(); // >60 degree (standard)
totalPenalty += getSlightTurnPenalty(); // >60 degree (standard)
} else if (diff > Math.PI / 6) {
totalPenalty += getRightTurn() / 2; // >30 degree (light)
totalPenalty += getSlightTurnPenalty() / 2; // >30 degree (light)
// totalPenalty += getRightTurn() * diff * 3 / Math.PI; // to think
}
}

return totalPenalty;
}


@Override
public boolean containsAttribute(String attribute) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ package net.osmand.shared.util

import co.touchlab.stately.collections.ConcurrentMutableMap
import net.osmand.shared.data.KLatLon
import kotlin.math.*
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import net.osmand.shared.data.KQuadRect
import net.osmand.shared.extensions.toDegrees
import net.osmand.shared.extensions.toRadians
import kotlin.math.*

/**
* This utility class includes :
Expand Down Expand Up @@ -860,4 +857,7 @@ object KMapUtils {
}
return KGeoParsedPoint(lat, lon, z)
}

fun interpolateLatLon(lat1: Double, lon1: Double, lat2: Double, lon2: Double, fraction: Double) =
KLatLon(lat1 + (lat2 - lat1) * fraction, lon1 + (lon2 - lon1) * fraction)
}
5 changes: 4 additions & 1 deletion OsmAnd/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5575,7 +5575,7 @@
<string name="connect_obd_instructions_step1">Připojte skener k portu OBD-II vozidla.</string>
<string name="connect_obd_instructions_step2">Nastartujte motor vozidla</string>
<string name="connect_obd_instructions_step3">Povolte v zařízení Bluetooth</string>
<string name="connect_obd_instructions_step4">Klepněte na možnost „Připojit“ a vyberte skener ze seznamu.</string>
<string name="connect_obd_instructions_step4">Klepněte na možnost „%1$s“ a vyberte skener ze seznamu.</string>
<string name="obd_fuel_left_liters">Zbývající palivo (litry)</string>
<string name="shared_string_bluetooth">Bluetooth</string>
<string name="connect_obd_instructions_title">OsmAnd podporuje připojení Bluetooth ke skenerům OBD-II.</string>
Expand Down Expand Up @@ -5674,4 +5674,7 @@
<string name="shared_string_engine">Motor</string>
<string name="vehicle_metrics_recording_description">Vyberte parametry, které se mají zaznamenat do GPX souboru.</string>
<string name="auto_zoom_3d_angle">Úhel automatického 3D zoomu</string>
<string name="location_interpolation_percent">Procento interpolace polohy</string>
<string name="location_interpolation_percent_desc">Nastavení procenta interpolace polohy během navigace po trase. Tento parametr snižuje zpoždění polohy na mapě během animace.</string>
<string name="shared_string_interpolation">Interpolace</string>
</resources>
6 changes: 3 additions & 3 deletions OsmAnd/res/values-de/phrases.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3101,7 +3101,7 @@
<string name="poi_animal_shelter_purpose">Tierheimzweck</string>
<string name="poi_owner">Eigentümer</string>
<string name="poi_spaceport">Raumfahrtzentrum</string>
<string name="poi_lock_basin">Schiffsschleuse</string>
<string name="poi_lock_basin">Schleusenkammer</string>
<string name="poi_animal_shelter_purpose_adoption_yes">Vermittlung: ja</string>
<string name="poi_animal_shelter_purpose_adoption_no">Vermittlung: nein</string>
<string name="poi_animal_shelter_purpose_release_yes">Auswilderung: ja</string>
Expand Down Expand Up @@ -4569,8 +4569,8 @@
<string name="poi_draft">Fahrwasserstiefe</string>
<string name="poi_boat_destination">Bootszugang: Anlieger</string>
<string name="poi_boat_permissive">Bootszugang: zulässig</string>
<string name="poi_lock_ref">Referenz einer Schleuse</string>
<string name="poi_lock_height">Höhe einer Schleuse</string>
<string name="poi_lock_ref">Schleusen-Referenz</string>
<string name="poi_lock_height">Schleusenhöhe</string>
<string name="poi_boat_designated">Bootszugang: ausgewiesen</string>
<string name="poi_boat_private">Bootszugang: privat</string>
<string name="poi_boat_yes">Bootszugang: ja</string>
Expand Down
6 changes: 2 additions & 4 deletions OsmAnd/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3770,7 +3770,7 @@
<string name="use_live_routing">OsmAnd Live Daten</string>
<string name="complex_routing_descr">Zwei-Phasen-Routenberechnung für die Autonavigation.</string>
<string name="use_native_pt">Native ÖPNV Entwicklung</string>
<string name="use_native_pt_desc">Wechseln zur Java (sicher) Berechnung des ÖPNV-Routings</string>
<string name="use_native_pt_desc">Wechseln zur ÖPNV-Routenberechnung mit Java (sicher)</string>
<string name="osm_edit_logout_success">Abgemeldet</string>
<string name="file_already_imported">Datei wurde bereits in OsmAnd importiert</string>
<string name="perform_oauth_authorization">Anmeldung über OAuth</string>
Expand Down Expand Up @@ -4473,9 +4473,7 @@
<string name="please_provide_group_name_message">Bitte benennen Sie die Gruppe.</string>
<string name="exit_import">Beenden\?</string>
<string name="import_tracks_descr">%1$s, enthält %2$s separate Tracks. Wählen Sie die zu importierenden Tracks aus.</string>
<string name="location_source_descr">Standardmäßig verwendet OsmAnd, wenn es von Google Play installiert wurde, %1$s zur Standortbestimmung.
\n
\nWenn Sie ungenaue Standortinformationen erhalten oder ein Gerät ohne %2$s verwenden, versuchen Sie, zu „%3$s“ zu wechseln</string>
<string name="location_source_descr">Standardmäßig verwendet OsmAnd, wenn es von Google Play installiert wurde, %1$s zur Standortbestimmung.\n\nWenn Sie ungenaue Standortinformationen erhalten oder ein Gerät ohne %2$s verwenden, versuchen Sie, zu „%3$s“ zu wechseln.</string>
<string name="location_source">Standortquelle</string>
<string name="points_selection_descr">Schließen und alle Änderungen verwerfen\?</string>
<string name="exit_import_descr">Beenden, ohne die Änderungen zu speichern\?</string>
Expand Down
2 changes: 1 addition & 1 deletion OsmAnd/res/values-eo/phrases.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
<string name="poi_organic">Ekologiaj produktaĵoj</string>
<string name="poi_outdoor">Vojaĝil-vendejo</string>
<string name="poi_paint">Farbovendejo</string>
<string name="poi_pet">Dombest-vendejo</string>
<string name="poi_pet">Hejmbesta vendejo</string>
<string name="poi_photo">Fotovendejo</string>
<string name="poi_radiotechnics">Elektronik-parta vendejo</string>
<string name="poi_second_hand">Brokantejo</string>
Expand Down
3 changes: 3 additions & 0 deletions OsmAnd/res/values-eo/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5686,4 +5686,7 @@
<string name="connect_new_scanner">Konekti novan skanilon</string>
<string name="vehicle_metrics_recording_description">Elekti parametrojn por registri al la GPX-dosiero.</string>
<string name="shared_string_engine">Motoro</string>
<string name="location_interpolation_percent">Elcento de interpolo de pozicio</string>
<string name="location_interpolation_percent_desc">Agordi elcenton de alproksimigo de pozicio dum navigi laŭ kurso. Tiu ĉi parametro malpliigas prokraston vidigi vian movbildan pozicion sur la mapo.</string>
<string name="shared_string_interpolation">Interpolo</string>
</resources>
3 changes: 3 additions & 0 deletions OsmAnd/res/values-es-rAR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5528,4 +5528,7 @@
<string name="av_audio_sample_rate">Tasa de muestra del audio</string>
<string name="av_audio_sample_rate_descr">Marcá la tasa de muestra del audio.</string>
<string name="connect_new_scanner">Conectar nuevo escáner</string>
<string name="location_interpolation_percent">Porcentaje de interpolación de la ubicación</string>
<string name="location_interpolation_percent_desc">Define el porcentaje de interpolación de la ubicación, al navegar por la ruta. Esto reduce el desfase del movimiento de la ubicación en el mapa.</string>
<string name="shared_string_interpolation">Interpolación</string>
</resources>
Loading

0 comments on commit 9409b54

Please sign in to comment.