Merge branch 'master' of ssh://github.com/osmandapp/Osmand

This commit is contained in:
Victor Shcherb 2014-12-07 01:25:19 +01:00
commit a324188066
5 changed files with 176 additions and 52 deletions

View file

@ -391,6 +391,90 @@ public class RouteResultPreparation {
dist += result.get(i).getDistance();
}
}
determineTurnsToMerge(leftside, result);
}
private void determineTurnsToMerge(boolean leftside, List<RouteSegmentResult> result) {
for (int i = result.size() - 2; i >= 0; i--) {
RouteSegmentResult currentSegment = result.get(i);
RouteSegmentResult nextSegment = null;
// We need to get the next segment that has a turn and lanes attached.
for (int j = i + 1; j < result.size(); j++) {
RouteSegmentResult possibleSegment = result.get(j);
if (possibleSegment.getTurnType() != null && possibleSegment.getTurnType().getLanes() != null) {
nextSegment = possibleSegment;
break;
}
}
if (nextSegment == null) {
continue;
}
TurnType currentTurn = currentSegment.getTurnType();
TurnType nextTurn = nextSegment.getTurnType();
if (currentTurn == null || currentTurn.getLanes() == null || nextTurn == null || nextTurn.getLanes() == null) {
continue;
}
// Only allow slight turns that are nearby to be merged.
if (currentSegment.getDistance() < 60 && nextTurn.getLanes().length <= currentTurn.getLanes().length
&& TurnType.isSlightTurn(currentTurn.getValue())) {
mergeTurnLanes(leftside, currentSegment, nextSegment);
}
}
}
private void mergeTurnLanes(boolean leftSide, RouteSegmentResult currentSegment, RouteSegmentResult nextSegment) {
TurnType currentTurn = currentSegment.getTurnType();
TurnType nextTurn = nextSegment.getTurnType();
boolean isUsingTurnLanes = TurnType.getPrimaryTurn(currentTurn.getLanes()[0]) != 0
&& TurnType.getPrimaryTurn(nextTurn.getLanes()[0]) != 0;
if (isUsingTurnLanes) {
int[] lanes = new int[currentTurn.getLanes().length];
// Unset the allowed lane bit
for (int i = 0; i < lanes.length; i++) {
lanes[i] = currentTurn.getLanes()[i] & ~1;
}
// Find the first lane that matches (based on the turn being taken), and how many lanes match
int matchingIndex = 0;
int maxMatchedLanes = 0;
for (int i = 0; i < lanes.length; i++) {
int matchedLanes = 0;
for (int j = 0; j < nextTurn.getLanes().length - i; j++) {
if (TurnType.getPrimaryTurn(nextTurn.getLanes()[j])
== TurnType.getPrimaryTurn(currentTurn.getLanes()[i + j])) {
matchedLanes++;
} else {
break;
}
}
if (matchedLanes > maxMatchedLanes) {
matchingIndex = i;
maxMatchedLanes = matchedLanes;
}
}
if (maxMatchedLanes <= 1) {
return;
}
// Copy the allowed bit from the next segment's lanes to the current segment's matching lanes
for (int i = matchingIndex; i - matchingIndex < nextTurn.getLanes().length; i++) {
lanes[i] |= nextTurn.getLanes()[i - matchingIndex] & 1;
}
currentTurn.setLanes(lanes);
int turn = inferTurnFromLanes(lanes);
if (turn != 0 && turn != currentTurn.getValue()) {
TurnType newTurnType = TurnType.valueOf(turn, leftSide);
newTurnType.setLanes(lanes);
newTurnType.setSkipToSpeak(currentTurn.isSkipToSpeak());
currentSegment.setTurnType(newTurnType);
}
}
}
private static final int MAX_SPEAK_PRIORITY = 5;
@ -563,6 +647,7 @@ public class RouteResultPreparation {
int right = 0;
boolean speak = false;
int speakPriority = Math.max(highwaySpeakPriority(prevSegm.getObject().getHighway()), highwaySpeakPriority(currentSegm.getObject().getHighway()));
boolean otherRoutesExist = false;
if (attachedRoutes != null) {
for (RouteSegmentResult attached : attachedRoutes) {
double ex = MapUtils.degreesDiff(attached.getBearingBegin(), currentSegm.getBearingBegin());
@ -577,6 +662,9 @@ public class RouteResultPreparation {
kr = true;
left += countLanesMinOne(attached);
speak = speak || rsSpeakPriority <= speakPriority;
} else if (mpi >= TURN_DEGREE_MIN) {
// Indicate that there are other turns at this intersection, and displaying the lanes may be helpful here.
otherRoutesExist = true;
}
}
}
@ -603,13 +691,33 @@ public class RouteResultPreparation {
double devation = Math.abs(MapUtils.degreesDiff(prevSegm.getBearingEnd(), currentSegm.getBearingBegin()));
boolean makeSlightTurn = devation > 5 && (!isMotorway(prevSegm) || !isMotorway(currentSegm));
if (kl) {
if (kl && kr) {
t = TurnType.valueOf(TurnType.C, leftSide);
t.setSkipToSpeak(!speak);
} else if (kl) {
t = TurnType.valueOf(makeSlightTurn ? TurnType.TSLL : TurnType.KL, leftSide);
t.setSkipToSpeak(!speak);
}
if (kr) {
} else if (kr) {
t = TurnType.valueOf(makeSlightTurn ? TurnType.TSLR : TurnType.KR, leftSide);
t.setSkipToSpeak(!speak);
} else if (otherRoutesExist && getTurnLanesString(prevSegm) != null) {
// Maybe going straight at a 90-degree intersection
t = TurnType.valueOf(TurnType.C, leftSide);
t.setSkipToSpeak(true);
// When going straight, the lanes have to be calculated from the previous segment, not the current/next segment.
int prevLanes = countLanesMinOne(prevSegm);
t.setLanes(attachTurnLanesData(prevSegm, new int[prevLanes]));
// Manually set the allowed lanes based on the turn type
for (int i = 0; i < t.getLanes().length; i++) {
if (TurnType.getPrimaryTurn(t.getLanes()[i]) == TurnType.C) {
t.getLanes()[i] |= 1;
}
}
return t;
}
if (t != null && lanes != null) {
int[] calcLanes = attachTurnLanesData(prevSegm, lanes);

View file

@ -253,4 +253,8 @@ public class TurnType {
public static boolean isRightTurn(int type) {
return type == TR || type == TSHR || type == TSLR;
}
public static boolean isSlightTurn(int type) {
return type == TSLL || type == TSLR || type == C || type == KL || type == KR;
}
}

View file

@ -13,12 +13,12 @@
<string name="poi_aerialway_goods">Güterseilbahn</string>
<string name="poi_aerialway_j_bar">Schlepplift</string>
<string name="poi_aerialway_magic_carpet">Teppichlift</string>
<string name="poi_aerialway_mixed_lift">Hybrid-Lift</string>
<string name="poi_aerialway_mixed_lift">Hybridlift</string>
<string name="poi_aerialway_platter">Plattenlift</string>
<string name="poi_aerialway_rope_tow">Übungslift</string>
<string name="poi_aerialway_station">Seilbahnstation</string>
<string name="poi_aerialway_t_bar">Schlepplift</string>
<string name="poi_aeroway_gate">Flughafen-Gate</string>
<string name="poi_aeroway_gate">Flughafengate</string>
<string name="poi_aeroway_terminal">Flughafenterminal</string>
<string name="poi_agricultural_engines_craft">Landmaschinen</string>
<string name="poi_airport">Flughafen</string>
@ -43,7 +43,7 @@
<string name="poi_baby_goods">Babyartikel</string>
<string name="poi_baby_hatch">Babyklappe</string>
<string name="poi_bag_shop">Taschen</string>
<string name="poi_bailiff">Bailiff</string>
<string name="poi_bailiff">Gerichtsvollzieher</string>
<string name="poi_bakery">Bäckerei</string>
<string name="poi_bank">Bank</string>
<string name="poi_bar">Bar</string>
@ -129,15 +129,15 @@
<string name="poi_club_charity">Sozialkaufhaus</string>
<string name="poi_club_chess">Schach</string>
<string name="poi_club_cinema">Kino</string>
<string name="poi_club_computer">Computergeschäft</string>
<string name="poi_club_ethnic">Folkloreverein</string>
<string name="poi_club_computer">Computer-Klub</string>
<string name="poi_club_ethnic">Folklore</string>
<string name="poi_club_fan">Fanklub</string>
<string name="poi_club_fishing">Fischklub</string>
<string name="poi_club_game">Spielklub</string>
<string name="poi_club_history">Geschichtsklub</string>
<string name="poi_club_hunting">Jagdtverein</string>
<string name="poi_club_linux">Linux club</string>
<string name="poi_club_motorcycle">Motorradgeschäft</string>
<string name="poi_club_linux">Linux Klub</string>
<string name="poi_club_motorcycle">Motorrad</string>
<string name="poi_club_music">Musikladen</string>
<string name="poi_club_nature">Naturverein</string>
<string name="poi_club_photography">Fotographieklub</string>
@ -151,7 +151,7 @@
<string name="poi_community_centre">Gemeindezentrum</string>
<string name="poi_company">Firma</string>
<string name="poi_compressed_air">Druckluft</string>
<string name="poi_computer_craft">Rechenzentrum</string>
<string name="poi_computer_craft">Computer</string>
<string name="poi_computer_shop">Computer-Geschäft</string>
<string name="poi_confectionery">Süßwaren</string>
<string name="poi_construction">Anlage</string>
@ -204,7 +204,7 @@
<string name="poi_fire_station">Feuerwehr</string>
<string name="poi_fire_water_pond">Löschteich</string>
<string name="poi_first_aid">Erste Hilfe</string>
<string name="poi_fishing_place">Fischereiplatz</string>
<string name="poi_fishing_place">Fischen</string>
<string name="poi_fishing_shop">Angelzeug</string>
<string name="poi_fjord">Fjord</string>
<string name="poi_florist">Blumenhandlung</string>
@ -220,7 +220,7 @@
<string name="poi_garages">Garage</string>
<string name="poi_garden_centre">Gartencenter</string>
<string name="poi_gardener">Gärtner</string>
<string name="poi_gas_shop">Flüssiggasgeschäft</string>
<string name="poi_gas_shop">Flüssiggas</string>
<string name="poi_gate">Tor</string>
<string name="poi_general_shop">Gemischtwarenhandlung</string>
<string name="poi_geyser">Geisir</string>
@ -279,13 +279,13 @@
<string name="poi_kindergarten">Kindergarten</string>
<string name="poi_kiosk">Kiosk</string>
<string name="poi_kitchen_shop">Küchengeräte</string>
<string name="poi_korfbal">Korfbal</string>
<string name="poi_korfbal">Korfball</string>
<string name="poi_landfill">Mülldeponie</string>
<string name="poi_laundry">Wäscherei</string>
<string name="poi_lawyer">Rechtsanwalt</string>
<string name="poi_leisure_track">Sportbahn</string>
<string name="poi_library">Bücherei</string>
<string name="poi_lift_gate">Hebetür</string>
<string name="poi_lift_gate">Schranken</string>
<string name="poi_lighthouse">Leuchtturm</string>
<string name="poi_locality">Lokalität</string>
<string name="poi_lock_gate">Schleusentor</string>
@ -304,7 +304,7 @@
<string name="poi_military_bunker">Bunker</string>
<string name="poi_military_danger_area">Gefahrenbereich</string>
<string name="poi_military_naval_base">Marinestützpunkt</string>
<string name="poi_military_nuclear_explosion_site">Atombombenexplosiongebiet</string>
<string name="poi_military_nuclear_explosion_site">Atombombenexplosionsgebiet</string>
<string name="poi_military_range">Militärbereich</string>
<string name="poi_mine_historic">Historisches Bergwerk</string>
<string name="poi_mineshaft">Mineshaft</string>
@ -364,14 +364,14 @@
<string name="poi_place_allotments">Kleingartensiedlung</string>
<string name="poi_place_farm">Farm</string>
<string name="poi_place_of_worship">Kultstätte</string>
<string name="poi_place_of_worship_buddhist">Kultstätte: Buddhistischh</string>
<string name="poi_place_of_worship_christian">Kultstätte: Christlich</string>
<string name="poi_place_of_worship_hindu">Kultstätte: Hinduistisch</string>
<string name="poi_place_of_worship_jewish">Kultstätte: Jüdisch</string>
<string name="poi_place_of_worship_muslim">Kultstätte: Muslimisch</string>
<string name="poi_place_of_worship_shinto">Kultstätte: Shintoistisch</string>
<string name="poi_place_of_worship_sikh">Kultstätte: Sikh</string>
<string name="poi_place_of_worship_taoist">Kultstätte: Taoistisch</string>
<string name="poi_place_of_worship_buddhist">Buddhistische Kultstätte</string>
<string name="poi_place_of_worship_christian">Christliche Kultstätte</string>
<string name="poi_place_of_worship_hindu">Hinduistische Kultstätte</string>
<string name="poi_place_of_worship_jewish">Jüdische Kultstätte</string>
<string name="poi_place_of_worship_muslim">Muslimische Kultstätte</string>
<string name="poi_place_of_worship_shinto">Shintoistische Kultstätte</string>
<string name="poi_place_of_worship_sikh">Sikh Kultstätte</string>
<string name="poi_place_of_worship_taoist">Taoistische Kultstätte</string>
<string name="poi_plasterer">Plasterer</string>
<string name="poi_playground">Spielplatz</string>
<string name="poi_plumber">Installateur</string>
@ -388,11 +388,11 @@
<string name="poi_prosecutor">Staatsanwalt</string>
<string name="poi_psychotherapist">Psychotherapeut</string>
<string name="poi_pub">Kneipe</string>
<string name="poi_public_transport_platform">Öffentlicher Personennahverkehr</string>
<string name="poi_public_transport_platform">Öff. Personennahverkehr</string>
<string name="poi_public_transport_platform_bus">Bushaltestelle</string>
<string name="poi_public_transport_platform_tram">Straßenbahnhaltestelle</string>
<string name="poi_public_transport_platform_trolleybus">Oberleitungsbushaltestelle</string>
<string name="poi_public_transport_station">Öffentliches Verkehrsmittel</string>
<string name="poi_public_transport_station">Öff. Verkehrsmittel-Station</string>
<string name="poi_quarry">Steinbruch</string>
<string name="poi_raceway">Gerinne</string>
<string name="poi_racquet">Schläger</string>
@ -436,16 +436,16 @@
<string name="poi_seamark_beacon">Leuchtturm</string>
<string name="poi_seamark_beacon_cardinal">Hauptleuchtturm</string>
<string name="poi_seamark_beacon_lateral">Nebenleuchtturm</string>
<string name="poi_seamark_beacon_safe_water">Wassergeschützer Leuchtturm</string>
<string name="poi_seamark_beacon_safe_water">Sicheres Gewässer-Leuchtturm</string>
<string name="poi_seamark_beacon_special_purpose">Sonderleuchtturm</string>
<string name="poi_seamark_berth">Ankerplatz</string>
<string name="poi_seamark_bridge">Seezeichenbrücke</string>
<string name="poi_seamark_building">Seegebäude</string>
<string name="poi_seamark_buoy_cardinal">Hauptboje</string>
<string name="poi_seamark_buoy_installation">Installationsboje</string>
<string name="poi_seamark_buoy_isolated_danger">Boje, isolaierte Gefahr</string>
<string name="poi_seamark_buoy_isolated_danger">Boje, isolierte Gefahr</string>
<string name="poi_seamark_buoy_lateral">Nebenboje</string>
<string name="poi_seamark_buoy_safe_water">Sicherswasserboje</string>
<string name="poi_seamark_buoy_safe_water">Sicheres Gewässer-Boje</string>
<string name="poi_seamark_buoy_special_purpose">Sonderboje</string>
<string name="poi_seamark_daymark">Tagzeichen</string>
<string name="poi_seamark_distance_mark">Entfernungsmarke</string>
@ -462,16 +462,16 @@
<string name="poi_seamark_light_minor">Nebenleuchtseezeichen</string>
<string name="poi_seamark_light_vessel">Schiffsleuchtseezeichen</string>
<string name="poi_seamark_mooring">Ankerplatz</string>
<string name="poi_seamark_notice">Hinweis, Seezeichenk</string>
<string name="poi_seamark_notice">Hinweis</string>
<string name="poi_seamark_pile">Pfahl</string>
<string name="poi_seamark_radar_transponder">Radarantwortbake</string>
<string name="poi_seamark_radio_station">Funkstation, Seezeichen</string>
<string name="poi_seamark_rock">Felsen, Seezeichen</string>
<string name="poi_seamark_signal_station_traffic">Signalstelle, Verkehr</string>
<string name="poi_seamark_signal_station_warning">Signalstelle, Warnung</string>
<string name="poi_seamark_radar_transponder">Radarsender</string>
<string name="poi_seamark_radio_station">Funkstation</string>
<string name="poi_seamark_rock">Felsen</string>
<string name="poi_seamark_signal_station_traffic">Signalstelle: Verkehr</string>
<string name="poi_seamark_signal_station_warning">Signalstelle: Warnung</string>
<string name="poi_seamark_small_craft_facility">Sportbooteinrichtung</string>
<string name="poi_seamark_topmark">Baken, Seezeichen</string>
<string name="poi_seamark_wreck">Wrsck, Seezeichen</string>
<string name="poi_seamark_topmark">Baken</string>
<string name="poi_seamark_wreck">Wrack</string>
<string name="poi_second_hand">Gebrauchtwaren</string>
<string name="poi_service_tyres">Reifenhändler</string>
<string name="poi_ses_station">SES-Station</string>
@ -588,4 +588,9 @@
<string name="poi_works">Anlage</string>
<string name="poi_wreck">Schiffswrack</string>
<string name="poi_zoo">Zoo</string>
<string name="poi_american_football">Amerik. Football</string>
<string name="poi_base">Base-Jumping</string>
<string name="poi_bmx_sport">BMX</string>
<string name="poi_canadian_football">Kanad. Football</string>
<string name="poi_surfing">Surfen</string>
</resources>

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="traffic_warning_speed_limit">Geschwindigkeitsbegrenzung</string>
<string name="traffic_warning_border_control">Grenzkontrolle</string>
@ -290,7 +290,7 @@
<string name="offline_edition">Offline-Bearbeitung</string>
<string name="offline_edition_descr">Immer Offline-Bearbeitung verwenden</string>
<string name="update_poi_does_not_change_indexes">Das Bearbeiten von POIs innerhalb von OsmAnd beeinflusst nicht die Offline-Karten, sondern wird in einer eigenen Datei gespeichert.</string>
<string name="local_openstreetmap_uploading">hochladen…</string>
<string name="local_openstreetmap_uploading">Hochladen…</string>
<string name="local_openstreetmap_were_uploaded">{0} POI/Bugs wurden hochgeladen</string>
<string name="local_openstreetmap_uploadall">Alle hochladen</string>
@ -625,7 +625,7 @@
<string name="menu_save_directions">Route speichern</string>
<string name="local_index_upload_gpx_description">GPX Dateien an OSM-Gemeinschaft übermitteln. Die Dateien können dort zur Kartenverbesserung verwendet werden.</string>
<string name="local_index_items_uploaded">%1$d von %2$d Datei(en) erfolgreich hochgeladen.</string>
<string name="local_index_mi_upload_gpx">Senden an OSM</string>
<string name="local_index_mi_upload_gpx">An OSM senden</string>
<string name="show_more_map_detail">Mehr Kartendetails</string>
<string name="show_more_map_detail_descr">Einige Vektor-Daten (Straßen etc.) bereits bei kleineren Vergrößerungen zeigen</string>
<string name="favourites_delete_multiple_succesful">Favorit(en) erfolgreich gelöscht.</string>
@ -776,7 +776,7 @@
<string name="amenity_type_historic">Historisches</string>
<string name="amenity_type_landuse">Landnutzung</string>
<string name="amenity_type_leisure">Freizeit</string>
<string name="amenity_type_man_made">von Menschenhand</string>
<string name="amenity_type_man_made">Von Menschenhand</string>
<string name="amenity_type_military">Militär</string>
<string name="amenity_type_natural">Natur</string>
<string name="amenity_type_office">Büro</string>
@ -848,8 +848,8 @@
<string name="renderer_load_exception">Fehler aufgetreten: Renderer wurde nicht geladen</string>
<string name="renderers">Vektor-Renderer</string>
<string name="renderers_descr">Wähle Anzeigemodus für Offline-Vektor-Karten</string>
<string name="poi_context_menu_website">Zeige POI-Internetseite</string>
<string name="poi_context_menu_call">Zeige POI-Telefon</string>
<string name="poi_context_menu_website">POI-Internetseite anzeigen</string>
<string name="poi_context_menu_call">POI-Telefon anzeigen</string>
<string name="website">Internetseite</string>
<string name="phone">Telefon</string>
<string name="download_type_to_filter">Filtern nach Typ</string>
@ -968,8 +968,8 @@
<string name="transport_route_distance">Streckenlänge</string>
<string name="transport">Öffentlicher Personenverkehr</string>
<string name="default_buttons_ok">OK</string>
<string name="show_transport_over_map_description">Zeige öffentliche Haltestellen auf der Karte</string>
<string name="show_transport_over_map">Zeige Haltestellen</string>
<string name="show_transport_over_map_description">Öffentl. Haltestellen auf der Karte anzeigen</string>
<string name="show_transport_over_map">Haltestellen anzeigen</string>
<string name="hello">Navigationsanwendung OsmAnd</string>
<string name="update_poi_success">POI-Daten wurden erfolgreich aktualisiert ({0} wurden geladen)</string>
<string name="update_poi_error_local">Fehler beim aktualisieren der Offline-Daten</string>
@ -1896,7 +1896,7 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
<string name="osmo_user_joined">Nutzer %1$s hat die Gruppe %2$s betreten</string>
<string name="osmo_user_left">Nutzer %1$s hat die Gruppe %2$s verlassen</string>
<string name="osmo_show_group_notifications">Gruppenbenachrichtigungen anzeigen</string>
<string name="osmo_show_group_notifications_descr">Zeige Pop-up-Meldung, wenn eine Nutzer der Gruppe beitritt oder sie verlässt</string>
<string name="osmo_show_group_notifications_descr">Pop-up-Meldung, wenn eine Nutzer der Gruppe beitritt oder sie verlässt anzeigen</string>
<string name="osmo_tracker_id_share">Um eine Verbindung zum Gerät %2$s herzustellen, bitte den Link %3$s antippen oder die Tracker-ID (%1$s) angeben</string>
<string name="osmo_auth_error_short">Anmeldung fehlgeschlagen</string>
<string name="osmo_auth_error">Fehler bei der OsMo-Anmeldung: %1$s.\n Möglicherweise ist der Dienst nicht verfügbar oder Ihre Anmeldung ist abgelaufen.\n Fortsetzen mit einer neuen Registrierung?</string>
@ -2023,4 +2023,10 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
<string name="everything_up_to_date">Alles ist aktuell</string>
<string name="use_opengl_render">OpenGL-Renderung verwenden</string>
<string name="use_opengl_render_descr">Hardware beschleunigte OpenGL-Renderung verwenden (Funktioniert nicht auf allen Geräten)</string>
<string name="no_internet_connection">Herunterladen nicht möglich. Zum Fortsetzen mit WLAN verbinden!</string>
<string name="download_tab_downloads">Heruntergeladen</string>
<string name="download_tab_updates">Aktualisierungen</string>
<string name="download_tab_local">Lokal</string>
<string name="wake_on_voice">Bildschirm aktivieren</string>
<string name="wake_on_voice_descr">Bei Annäherung einer Richtungsänderung den Bildschirm einschalten</string>
</resources>

View file

@ -2023,4 +2023,5 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="download_tab_local">In de omgeving</string>
<string name="navigate_point_easting">Oostwaarde</string>
<string name="navigate_point_northing">Noordwaarde</string>
<string name="navigate_point_zone">Zone</string>
</resources>