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

This commit is contained in:
Victor Shcherb 2014-10-26 23:50:58 +01:00
commit 4a757ae29d
11 changed files with 187 additions and 30 deletions

View file

@ -5,6 +5,7 @@ import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@ -641,7 +642,7 @@ public class RouteResultPreparation {
if (t != null && lanes != null) {
t.setLanes(lanes);
attachTurnLanesData(leftSide, prevSegm, t);
t = attachTurnLanesData(leftSide, prevSegm, t);
}
return t;
}
@ -671,18 +672,18 @@ public class RouteResultPreparation {
}
}
private void attachTurnLanesData(boolean leftSide, RouteSegmentResult prevSegm, TurnType t) {
private TurnType attachTurnLanesData(boolean leftSide, RouteSegmentResult prevSegm, TurnType t) {
int lanes = prevSegm.getObject().getLanes();
String turnLanes = getTurnLanesString(prevSegm);
if (turnLanes == null) {
return;
return t;
}
String[] splitLaneOptions = turnLanes.split("\\|", -1);
if (splitLaneOptions.length != lanes) {
// Error in data or missing data
return;
return t;
}
if (t.getLanes().length != lanes) {
@ -699,7 +700,7 @@ public class RouteResultPreparation {
if (options == 1) {
if (outgoingLanesIndex + 1 >= t.getLanes().length) {
// Likely an error in data
return;
return t;
}
int usability = t.getLanes()[outgoingLanesIndex] | t.getLanes()[outgoingLanesIndex + 1];
sourceLanes.add(usability);
@ -707,7 +708,7 @@ public class RouteResultPreparation {
sourceLanesIndex++;
} else {
// Not supported
return;
return t;
}
} else {
// Only one allowed turn; behave normally
@ -727,6 +728,8 @@ public class RouteResultPreparation {
}
assignTurns(splitLaneOptions, t);
t = inferTurnFromLanes(t, leftSide);
return t;
}
private int countOccurrences(String haystack, char needle) {
@ -782,6 +785,66 @@ public class RouteResultPreparation {
}
}
private TurnType inferTurnFromLanes(TurnType t, boolean leftSide) {
List<Integer> possibleTurns = new ArrayList<Integer>();
for (int i = 0; i < t.getLanes().length; i++) {
if ((t.getLanes()[i] & 1) == 0) {
continue;
}
if (possibleTurns.isEmpty()) {
// Nothing is in the list to compare to, so add the first elements
possibleTurns.add(TurnType.getPrimaryTurn(t.getLanes()[i]));
if (TurnType.getSecondaryTurn(t.getLanes()[i]) != 0) {
possibleTurns.add(TurnType.getSecondaryTurn(t.getLanes()[i]));
}
} else {
List<Integer> laneTurns = new ArrayList<Integer>();
laneTurns.add(TurnType.getPrimaryTurn(t.getLanes()[i]));
if (TurnType.getSecondaryTurn(t.getLanes()[i]) != 0) {
laneTurns.add(TurnType.getSecondaryTurn(t.getLanes()[i]));
}
possibleTurns.retainAll(laneTurns);
if (possibleTurns.isEmpty()) {
// No common turns, so can't determine anything.
return t;
}
}
}
// Remove all turns from lanes not selected...because those aren't it
for (int i = 0; i < t.getLanes().length; i++) {
if ((t.getLanes()[i] & 1) == 0 && !possibleTurns.isEmpty()) {
List<Integer> notLaneTurns = new ArrayList<Integer>();
notLaneTurns.add(TurnType.getPrimaryTurn(t.getLanes()[i]));
if (TurnType.getSecondaryTurn(t.getLanes()[i]) != 0) {
notLaneTurns.add(TurnType.getSecondaryTurn(t.getLanes()[i]));
}
possibleTurns.removeAll(notLaneTurns);
}
}
// Checking to see that there is only one unique turn
if (new HashSet<Integer>(possibleTurns).size() == 1) {
TurnType derivedTurnType = TurnType.valueOf(possibleTurns.get(0), leftSide);
derivedTurnType.setLanes(t.getLanes());
derivedTurnType.setSkipToSpeak(t.isSkipToSpeak());
t = derivedTurnType;
// Because only the primary turn is displayed, if the turn to be taken is currently set as the secondary turn, then that needs to be switched around.
for (int i = 0; i < t.getLanes().length; i++) {
if (TurnType.getSecondaryTurn(t.getLanes()[i]) == t.getValue()) {
int temp = TurnType.getSecondaryTurn(t.getLanes()[i]);
t.setSecondaryTurn(i, TurnType.getPrimaryTurn(t.getLanes()[i]));
t.setPrimaryTurn(i, temp);
}
}
}
return t;
}
private boolean isMotorway(RouteSegmentResult s){
String h = s.getObject().getHighway();
return "motorway".equals(h) || "motorway_link".equals(h) ||

View file

@ -522,7 +522,7 @@ OsmAnd мае адкрыты зыходны код і актыўна разві
<string name="day_night_info_description">Узыход: %1$s \nЗаход: %2$s</string>
<string name="day_night_info">Узыход/заход</string>
<string name="map_widget_day_night">Рэжым дзень/ноч</string>
<string name="map_widget_vector_attributes">Налады адмалёўкі:</string>
<string name="map_widget_vector_attributes">Налады адмалёўкі</string>
<string name="map_widget_renderer">Стыль мапы</string>
@ -1578,7 +1578,7 @@ OsmAnd мае адкрыты зыходны код і актыўна разві
<string name="speech_rate_descr">Задайце хуткасць вымаўленьня для TTS</string>
<string name="speech_rate">Хуткасьць вымаўленьня</string>
<string name="disable_complex_routing">Адключыць складаную маршрутызацыю</string>
<string name="map_widget_map_rendering">Адмалёўка мапы:</string>
<string name="map_widget_map_rendering">Адмалёўка мапы</string>
<string name="app_mode_motorcycle">матацыкл</string>
<string name="app_mode_aircraft">Самалёт</string>
<string name="tip_faq">Частыя пытаньні</string>
@ -1982,4 +1982,12 @@ OsmAnd мае адкрыты зыходны код і актыўна разві
<string name="test_native_render_msg">Пачаць працу з натыўнай візуалізацыяй</string>
<string name="configure_map">Настройка мапы</string>
<string name="search_radius_proximity">Паблізу ад</string>
<string name="rendering_category_details">Падрабязнасьці</string>
<string name="rendering_category_transport">Транспарт</string>
<string name="layers_category_show">Паказаць</string>
<string name="map_widget_top">Радок стану</string>
<string name="map_widget_right">Правая панэль</string>
<string name="map_widget_left">Левая панэль</string>
<string name="rendering_category_others">Іншыя атрыбуты мапы</string>
<string name="map_widget_appearance_rem">Астатнія элементы</string>
</resources>

View file

@ -265,7 +265,7 @@
<string name="filterpoi_activity">Crea un filtre pels PDI</string>
<string name="day_night_info_description">Alba: %1$s
\nCapvespre: %2$s</string>
<string name="map_widget_vector_attributes">Atributs de renderització:</string>
<string name="map_widget_vector_attributes">Atributs de renderització</string>
<string name="map_widget_renderer">Estil de renderització</string>
<string name="map_widget_mini_route">Minimapa de ruta</string>
<string name="select_animate_speedup">Selecciona l\'acceleració de la ruta animada</string>
@ -1324,7 +1324,7 @@
<string name="amenity_type_seamark">Balisa marina</string>
<string name="app_modes_choose_descr">Seleccioneu els perfils d\'ús visibles a l\'aplicació</string>
<string name="app_modes_choose">Perfils de l\'aplicació</string>
<string name="map_widget_map_rendering">Renderitzat del mapa:</string>
<string name="map_widget_map_rendering">Renderitzat del mapa</string>
<string name="app_mode_hiking">Senderisme</string>
<string name="app_mode_motorcycle">Moto</string>
<string name="app_mode_boat">Vaixell</string>
@ -1912,4 +1912,14 @@ La llista de països inclosos (bàsicament tot el món!): Afganistan, Albània,
<string name="anonymous_user_hint">Un usuari anònim no pot:\n- crear grups;\n- sincronitzar grups i dispositius amb el servidor;\n- gestionar grups i dispositius en privat.</string>
<string name="anonymous_user">Usuari anònim</string>
<string name="logged_as">S\'ha iniciat sessió com a %1$s</string>
<string name="rendering_category_details">Detalls</string>
<string name="rendering_category_transport">Transport</string>
<string name="rendering_category_others">Altres atributs del mapa</string>
<string name="map_widget_appearance_rem">Elements pendents</string>
<string name="map_widget_top">Barra d\'estat</string>
<string name="map_widget_right">Tauler dret</string>
<string name="map_widget_left">Tauler esquerre</string>
<string name="layers_category_show">Mostrar</string>
<string name="configure_map">Configureu mapa</string>
<string name="search_radius_proximity">A prop de</string>
</resources>

View file

@ -187,7 +187,7 @@
\nSolnedgang: %2$s</string>
<string name="day_night_info">Dag/nat information</string>
<string name="map_widget_day_night">Dag-/natkort</string>
<string name="map_widget_vector_attributes">Optegningsattributter:</string>
<string name="map_widget_vector_attributes">Optegningsattributter</string>
<string name="map_widget_renderer">Kortformat</string>
@ -1461,7 +1461,7 @@ Nogle af de centrale funktioner:
<string name="app_mode_motorcycle">Motorcykel</string>
<string name="app_mode_boat">Båd</string>
<string name="app_mode_aircraft">Fly</string>
<string name="map_widget_map_rendering">Kortoptegning:</string>
<string name="map_widget_map_rendering">Kortoptegning</string>
<string name="app_modes_choose_descr">Vælg tilgængelige brugerprofiler</string>
<string name="app_modes_choose">Programprofiler</string>
<string name="amenity_type_seamark">Sømærke</string>
@ -1842,4 +1842,12 @@ Nogle af de centrale funktioner:
<string name="logged_as">Logget ind som %1$s</string>
<string name="configure_map">Konfigurer kort</string>
<string name="search_radius_proximity">I nærheden af</string>
<string name="rendering_category_details">Detaljer</string>
<string name="rendering_category_transport">Transport</string>
<string name="rendering_category_others">Andre kortattributter</string>
<string name="map_widget_appearance_rem">Resterende elementer</string>
<string name="map_widget_top">Statuslinjen</string>
<string name="map_widget_right">Højre panel</string>
<string name="map_widget_left">Venstre panel</string>
<string name="layers_category_show">Vis</string>
</resources>

View file

@ -1838,4 +1838,14 @@ Afghanistan, Albanie, Algérie, Allemagne, Andorre, Angola, Anguilla, Antigua-et
<string name="anonymous_user_hint">Un utilisateur anonyme ne peut pas :\n- Créer des groupes;\n- Synchroniser les groupes et les périphériques avec le serveur;\n- Gérer les groupes et les périphériques dans un espace privé.</string>
<string name="anonymous_user">Utilisateur anonyme</string>
<string name="logged_as">Connecté entant que %1$s</string>
<string name="rendering_category_details">Détails</string>
<string name="rendering_category_transport">Transport</string>
<string name="rendering_category_others">Autres éléments de la carte</string>
<string name="map_widget_appearance_rem">Éléments restants</string>
<string name="map_widget_top">Barre d\'état</string>
<string name="map_widget_right">Panneau de droite</string>
<string name="map_widget_left">Panneau de gauche</string>
<string name="layers_category_show">Afficher</string>
<string name="configure_map">Configurer la carte</string>
<string name="search_radius_proximity">A proximité de</string>
</resources>

View file

@ -2103,4 +2103,14 @@ Vanuatu, Venezuela, Vietnam, Wallis and Futuna, Western Sahara, Yemen, Zambia, Z
<string name="anonymous_user_hint">익명의 사용자는 아래 사항을 할 수 없습니다:\n- 그룹 생성;\n- 그룹 및 장치를 서버와 동기화;\n- 그룹 및 장치를 관리 (개인 사무실에서).</string>
<string name="anonymous_user">익명의 사용자</string>
<string name="logged_as">%1$s 사용자로 로그인 됨</string>
<string name="rendering_category_details">세부 정보</string>
<string name="rendering_category_transport">운송</string>
<string name="rendering_category_others">다른 지도 속성</string>
<string name="map_widget_appearance_rem">나머지 요소</string>
<string name="map_widget_top">상태 표시줄</string>
<string name="map_widget_right">오른쪽 패널</string>
<string name="map_widget_left">왼쪽된 패널</string>
<string name="layers_category_show">표시</string>
<string name="configure_map">지도 구성</string>
<string name="search_radius_proximity">근접에서</string>
</resources>

View file

@ -1017,7 +1017,7 @@
<string name="day_night_info_description">Zonsopgang: %1$s \nZonsondergang: %2$s</string>
<string name="day_night_info">Dag/nacht info</string>
<string name="map_widget_day_night">Dag/nacht kaart</string>
<string name="map_widget_vector_attributes">Kaartweergave attributen:</string>
<string name="map_widget_vector_attributes">Kaartweergave attributen</string>
<string name="map_widget_renderer">Kaartstijl</string>
<string name="tip_rotation_switching_t_v2">Je kan kiezen hoe de kaart gedraaid wordt door op het kompas-icoon te tikken.
\n\nDe keuzes zijn:
@ -1599,7 +1599,7 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="app_mode_motorcycle">Motorfiets</string>
<string name="app_mode_boat">Boot</string>
<string name="app_mode_aircraft">Vliegtuig</string>
<string name="map_widget_map_rendering">Kaartweergave:</string>
<string name="map_widget_map_rendering">Kaartweergave</string>
<string name="app_modes_choose_descr">Kies de profielen die in Osmand zichtbaar zijn</string>
<string name="app_modes_choose">Toepassingsprofielen</string>
<string name="amenity_type_seamark">boei / baken</string>
@ -1973,12 +1973,26 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="text_size">Tekstgrootte</string>
<string name="fav_point_dublicate_message">Favoriet bestaat al: de naam is veranderd in %1$s</string>
<string name="fav_point_dublicate">Favoriet met deze naam bestaat al</string>
<string name="test_native_render">Test \"native rendering\"</string>
<string name="test_native_render_msg">Gebruik deze keer de C++ renderer in plaats van Java</string>
<string name="use_native_render">Gebruik \"native renderer\"</string>
<string name="use_native_render_descr">Gebruik C++ renderer in plaats van Java</string>
<string name="test_native_render">Test \"native weergave\"</string>
<string name="test_native_render_msg">Start activiteit met oorspronkelijke weergave</string>
<string name="use_native_render">Gebruik oorspronkelijke weergave</string>
<string name="use_native_render_descr">Gebruik C++ weergave in plaats van Java</string>
<string name="fav_point_emoticons_message">Favoriet bewaard als %1s omdat vreemde tekens niet opgeslagen kunnen worden in een bestand.</string>
<string name="print_route">Route afdrukken</string>
<string name="speed_limit_exceed">Te hoge snelheid melden bij...</string>
<string name="speed_limit_exceed_message">Hoeveel de maximumsnelheid mag worden overschreden voordat een melding volgt.</string>
<string name="rendering_category_transport">Vervoer</string>
<string name="rendering_category_others">Overige kaart attributen</string>
<string name="map_widget_appearance_rem">Resterende onderdelen</string>
<string name="map_widget_top">Statusbalk</string>
<string name="map_widget_right">Rechter kolom</string>
<string name="map_widget_left">Linker kolom</string>
<string name="layers_category_show">Tonen</string>
<string name="configure_map">Kaart instellen</string>
<string name="search_radius_proximity">In de buurt van</string>
<string name="osmo_device_not_found">Apparaat niet gevonden</string>
<string name="osmo_no_connection_msg">OsMo service is niet beschikbaar:\n- Controleer de verbinding;\n- Controleer de instellingen;\n- Kijk op Twitter: https://twitter.com/OsMomobi</string>
<string name="anonymous_user_hint">een anonieme gebruiker kan niet:\n- een groep aanmaken;\n- groepen en apparaten synchroniseren met de server;\n- groepen en apparaten beheren in een eigen omgeving.</string>
<string name="anonymous_user">Anonieme gebruiker</string>
<string name="logged_as">Ingelogd als %1$s</string>
</resources>

View file

@ -1063,7 +1063,7 @@
\nZápad slnka: %2$s</string>
<string name="day_night_info">Info o dni/noci</string>
<string name="map_widget_day_night">Denná/nočná mapa</string>
<string name="map_widget_vector_attributes">Atribúty vykresľovania:</string>
<string name="map_widget_vector_attributes">Atribúty vykresľovania</string>
<string name="map_widget_renderer">Štýl vykresľovania</string>
<string name="osmand_short_description_80_chars">OsmAnd je open source navigácia s offline aj online mapami</string>
<string name="osmand_plus_short_description_80_chars">OsmAnd je open source navigácia s offline aj online mapami</string>
@ -1623,7 +1623,7 @@ Afganistan, Albánsko, Alžírsko, Andora, Angola, Anguilla, Antigua a Barbuda,
<string name="app_mode_boat">Loď</string>
<string name="app_mode_aircraft">Lietadlo</string>
<string name="app_modes_choose">Profily aplikácie</string>
<string name="map_widget_map_rendering">Vykresľovanie mapy:</string>
<string name="map_widget_map_rendering">Vykresľovanie mapy</string>
<string name="app_modes_choose_descr">Zvoľte profily použitia viditeľné v aplikácii</string>
<string name="amenity_type_seamark">Morská značka</string>
@ -2009,4 +2009,14 @@ Afganistan, Albánsko, Alžírsko, Andora, Angola, Anguilla, Antigua a Barbuda,
<string name="logged_as">Prihlásený ako %1$s</string>
<string name="osmo_no_connection_msg">Služba OsMo nie je dostupná:\n- skontrolujte pripojenie;\n- skontrolujte nastavenie;\n- pozrite na náš Twitter: https://twitter.com/OsMomobi</string>
<string name="anonymous_user_hint">Anonymný používateľ nemôže:\n- vytvárať skupiny;\n- synchronizovať skupiny a zariadenia so serverom;\n- spravovať skupiny a zariadenia v súkromnej kancelárii.</string>
<string name="rendering_category_details">Podrobnosti</string>
<string name="rendering_category_transport">Doprava</string>
<string name="rendering_category_others">Iné vlastnosti mapy</string>
<string name="map_widget_appearance_rem">Zvyšné elementy</string>
<string name="map_widget_top">Stavový riadok</string>
<string name="map_widget_right">Pravý panel</string>
<string name="map_widget_left">Ľavý panel</string>
<string name="layers_category_show">Zobraziť</string>
<string name="configure_map">Nastaviť mapu</string>
<string name="search_radius_proximity">Blízko k</string>
</resources>

View file

@ -92,7 +92,7 @@
<string name="day_night_info_description">日出:%1$s \n日落%2$s</string>
<string name="day_night_info">日/夜資訊</string>
<string name="map_widget_day_night">日/夜地圖</string>
<string name="map_widget_vector_attributes">繪製屬性</string>
<string name="map_widget_vector_attributes">繪製屬性</string>
<string name="map_widget_renderer">地圖樣式</string>
@ -1454,7 +1454,7 @@
<string name="app_mode_motorcycle">機車</string>
<string name="app_mode_boat"></string>
<string name="app_mode_aircraft">飛航</string>
<string name="map_widget_map_rendering">地圖繪製</string>
<string name="map_widget_map_rendering">地圖繪製</string>
<string name="app_modes_choose_descr">在應用程式中選取現有的設定檔</string>
<string name="app_modes_choose">應用設定檔</string>
<string name="amenity_type_seamark">航線標識</string>
@ -1833,4 +1833,14 @@
<string name="anonymous_user_hint">匿名使用者不能:\n- 建立群組;\n- 以伺服器同步群組和裝置;\n- 在個人的辦事處所管理群組和裝置。</string>
<string name="anonymous_user">匿名使用者</string>
<string name="logged_as">已登入於 %1$s</string>
<string name="rendering_category_details">詳細資訊</string>
<string name="rendering_category_transport">運輸</string>
<string name="rendering_category_others">其它地圖屬性</string>
<string name="map_widget_appearance_rem">剩餘元件</string>
<string name="map_widget_top">狀態列</string>
<string name="map_widget_right">右面板</string>
<string name="map_widget_left">左面板</string>
<string name="layers_category_show">顯示</string>
<string name="configure_map">組態地圖</string>
<string name="search_radius_proximity">在接近度上</string>
</resources>

View file

@ -243,10 +243,14 @@ public class RouteCalculationResult {
if (routeInd < list.size()) {
int lind = routeInd;
if(turn.isRoundAbout()) {
int roundAboutEnd = prevLocationSize - 1;
// take next name for roundabout (not roundabout name)
while(lind < list.size() -1 && list.get(lind).getObject().roundabout()) {
roundAboutEnd += Math.abs(list.get(lind).getEndPointIndex()-list.get(lind).getStartPointIndex());
lind++;
}
// Consider roundabout end.
info.routeEndPointOffset = roundAboutEnd;
}
RouteSegmentResult next = list.get(lind);
info.setRef(next.getObject().getRef());
@ -689,7 +693,9 @@ public class RouteCalculationResult {
public void updateCurrentRoute(int currentRoute) {
this.currentRoute = currentRoute;
while (currentDirectionInfo < directions.size() - 1 && directions.get(currentDirectionInfo + 1).routePointOffset < currentRoute) {
while (currentDirectionInfo < directions.size() - 1
&& directions.get(currentDirectionInfo + 1).routePointOffset < currentRoute
&& directions.get(currentDirectionInfo + 1).routeEndPointOffset < currentRoute) {
currentDirectionInfo++;
}
while(nextIntermediate < intermediatePoints.length) {
@ -721,7 +727,7 @@ public class RouteCalculationResult {
/*public */NextDirectionInfo getNextRouteDirectionInfo(NextDirectionInfo info, Location fromLoc, boolean toSpeak) {
int dirInfo = currentDirectionInfo;
if (dirInfo < directions.size()) {
int dist = listDistance[currentRoute];
// Locate next direction of interest
int nextInd = dirInfo + 1;
if (toSpeak) {
while (nextInd < directions.size()) {
@ -732,11 +738,17 @@ public class RouteCalculationResult {
nextInd++;
}
}
int dist = listDistance[currentRoute];
if (fromLoc != null) {
dist += fromLoc.distanceTo(locations.get(currentRoute));
}
if (nextInd < directions.size()) {
info.directionInfo = directions.get(nextInd);
if (directions.get(nextInd).routePointOffset <= currentRoute
&& currentRoute <= directions.get(nextInd).routeEndPointOffset)
// We are not into a puntual direction.
dist -= listDistance[directions.get(nextInd).routeEndPointOffset];
else
dist -= listDistance[directions.get(nextInd).routePointOffset];
}
if(intermediatePoints != null && nextIntermediate < intermediatePoints.length) {

View file

@ -7,6 +7,8 @@ import net.osmand.router.TurnType;
public class RouteDirectionInfo {
// location when you should action (turn or go ahead)
public int routePointOffset;
// location where direction end. useful for roundabouts.
public int routeEndPointOffset = 0;
// Type of action to take
private TurnType turnType;
// Description of the turn and route after