Merge remote-tracking branch 'origin/master'
Conflicts: OsmAnd/res/values-de/strings.xml
This commit is contained in:
commit
2aa8af059b
68 changed files with 805 additions and 1159 deletions
|
@ -135,7 +135,6 @@ public class BinaryRoutePlanner {
|
|||
checkIfGraphIsEmpty(ctx, ctx.getPlanRoadDirection() >= 0, graphDirectSegments, start, visitedDirectSegments,
|
||||
"Route is not found from selected start point.");
|
||||
if (ctx.planRouteIn2Directions()) {
|
||||
if(!graphDirectSegments.isEmpty() && !graphReverseSegments.isEmpty())
|
||||
forwardSearch = (nonHeuristicSegmentsComparator.compare(graphDirectSegments.peek(), graphReverseSegments.peek()) < 0);
|
||||
// if (graphDirectSegments.size() * 2 > graphReverseSegments.size()) {
|
||||
// forwardSearch = false;
|
||||
|
|
|
@ -226,7 +226,6 @@
|
|||
|
||||
<activity android:name="net.osmand.plus.development.TestVoiceActivity" />
|
||||
<activity android:name="net.osmand.plus.download.DownloadActivity" android:label="@string/local_index_descr_title" />
|
||||
<activity android:name="net.osmand.core.android.GLActivity" android:label="Sample" />
|
||||
<activity android:name="net.osmand.plus.osmedit.LocalOpenstreetmapActivity" android:label="@string/local_openstreetmap_act_title" />
|
||||
|
||||
<!-- keep android:process on a separate line !! -->
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="net.osmand.core.samples.android.sample1.GLActivity">
|
||||
|
||||
<android.opengl.GLSurfaceView
|
||||
android:id="@+id/glSurfaceView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</FrameLayout>
|
6
OsmAnd/res/layout/atlas_map_renderer_view.xml
Normal file
6
OsmAnd/res/layout/atlas_map_renderer_view.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<net.osmand.core.android.AtlasMapRendererView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/atlasMapRendererView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
|
@ -7,12 +7,16 @@
|
|||
android:background="@drawable/bg_cardui"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/search_for"
|
||||
style="@style/DashboardSubHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:text="@string/search_for" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.opengl.GLSurfaceView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/glSurfaceView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</android.opengl.GLSurfaceView>
|
|
@ -12,9 +12,9 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/glSurfaceStub"
|
||||
android:inflatedId="@+id/glSurfaceView"
|
||||
android:layout="@layout/gl_surface"
|
||||
android:id="@+id/atlasMapRendererViewStub"
|
||||
android:inflatedId="@+id/atlasMapRendererView"
|
||||
android:layout="@layout/atlas_map_renderer_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="auto_zoom_none">Без аўтаматычнага масштабіраваньня</string>
|
||||
<string name="auto_zoom_close">Зачыніць</string>
|
||||
<string name="auto_zoom_far">Для сярэдняга масштаба</string>
|
||||
|
@ -1915,7 +1915,6 @@ OsmAnd мае адкрыты зыходны код і актыўна разві
|
|||
<string name="speed_limit_exceed_message">Задаць дапушчальнае значэньне перавышэньня хуткасьці, пры якім вы атрымаеце галасавое паведамленьне.</string>
|
||||
<string name="fav_point_emoticons_message">Назва ўлюбёнай кропкі была зьменена на %1$s для магчымасьці захаваньня радка з эматыконам ў файл.</string>
|
||||
<string name="print_route">Паказаць маршрут</string>
|
||||
<string name="test_native_render">Тэст натыўнай візуалізацыі</string>
|
||||
<string name="fav_point_dublicate">Дубляваньне назвы ўлюбёнага пункту</string>
|
||||
<string name="fav_point_dublicate_message">Назва ўлюбёнага пункту %1$s была зьменена для прадухіленьня дубляваньня імёнаў.</string>
|
||||
<string name="use_native_render">Выкарыстоўваць натыўную візуалізацыю</string>
|
||||
|
@ -1926,7 +1925,6 @@ OsmAnd мае адкрыты зыходны код і актыўна разві
|
|||
<string name="logged_as">Вы ўвайшлі як %1$s</string>
|
||||
<string name="osmo_no_connection_msg">Сэрвіс OsMo не даступны:\n- Праверце спалучэньне;\n- Праверце налады;\n- Праверце наш Twitter: https://twitter.com/OsMomobi</string>
|
||||
<string name="anonymous_user_hint">Ананімнаму карыстальніку недаступныя:\n- Вытварэньне груп;\n- Сінхранізацыя груп і прыстасаваньняў з серверам;\n- Кіраваньне групамі і прыстасаваньнямі ў асабістым кабінеце.</string>
|
||||
<string name="test_native_render_msg">Пачаць працу з натыўнай візуалізацыяй</string>
|
||||
<string name="configure_map">Настройка мапы</string>
|
||||
<string name="search_radius_proximity">Паблізу ад</string>
|
||||
<string name="rendering_category_details">Падрабязнасьці</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="tip_recent_changes_1_5_t">Промени в 1.5:
|
||||
\n\t* Гласови предупреждения за пътни ограничения и камери
|
||||
\n\t* Гласово обявяване имената на улиците
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="show_warnings_title">Mostra els missatges d\'avís…</string>
|
||||
<string name="map_widget_fluorescent">Rutes amb fluorescència</string>
|
||||
<string name="map_widget_show_ruler">Mostra el regle</string>
|
||||
|
@ -1856,8 +1856,6 @@ La llista de països inclosos (bàsicament tot el món!): Afganistan, Albània,
|
|||
<string name="text_size">Mida del text</string>
|
||||
<string name="fav_point_dublicate">Nom de punt preferit duplicat</string>
|
||||
<string name="fav_point_dublicate_message">S\'ha canviat el nom del vostre punt preferit a %1$s per evitar duplicitats.</string>
|
||||
<string name="test_native_render">Prova de renderització nativa</string>
|
||||
<string name="test_native_render_msg">Inicia l\'activitat amb renderització nativa</string>
|
||||
<string name="use_native_render">Utilitza la renderització nativa</string>
|
||||
<string name="use_native_render_descr">Ús de renderització C++ en comptes de Java</string>
|
||||
<string name="fav_point_emoticons_message">El nom del vostre punt preferit s\'ha canviat a %1$s per facilitar el desar bé la cadena amb emoticones en un fitxer.</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="switch_to_raster_map_to_see">Vektorové mapy toto místo neobsahují. Mapová data můžete stáhnout v Nastaveních (Spravovat mapové soubory), nebo se přepněte na online mapy.</string>
|
||||
<string name="tip_recent_changes_0_7_2_t">"Změny ve verzi 0.7.2 :
|
||||
\n\t- Native rendering pro všechna zařízení
|
||||
|
@ -1732,8 +1732,6 @@ s často kladenými otázkami.</string>
|
|||
<string name="text_size_descr">Nastavit velikost písma na mapě.</string>
|
||||
<string name="fav_point_dublicate">Název oblíbeného bodu je již použit</string>
|
||||
<string name="fav_point_dublicate_message">Aby nevznikla duplicita, oblíbený bod byl uložen jako %1$s.</string>
|
||||
<string name="test_native_render">Test nativního vykreslování</string>
|
||||
<string name="test_native_render_msg">Spustí činnost s nativním vykreslováním</string>
|
||||
<string name="use_native_render">Použít nativní vykreslování</string>
|
||||
<string name="use_native_render_descr">Použít C++ vykreslování místo Javy</string>
|
||||
<string name="print_route">Vytisknout trasu</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="srtm_paid_version_msg">Overvej at købe Højdekurve udvidelsen (\'Contour lines\') på Google Play for at støtte den videre udvikling.</string>
|
||||
<string name="av_def_action_video">Optag video</string>
|
||||
<string name="av_def_action_audio">Optag audio</string>
|
||||
|
@ -1805,8 +1805,6 @@
|
|||
<string name="text_size">Tekststørrelse</string>
|
||||
<string name="fav_point_dublicate">Favoritnavn dublet</string>
|
||||
<string name="fav_point_dublicate_message">Favoritnavn er ændret til %1$s for at undgå dubletter.</string>
|
||||
<string name="test_native_render">Test indbygget optegning</string>
|
||||
<string name="test_native_render_msg">Start aktivitet med indbygget optegning</string>
|
||||
<string name="use_native_render">Brug indbygget optegning</string>
|
||||
<string name="use_native_render_descr">Brug C++ optegning i stedet for Java</string>
|
||||
<string name="print_route">Udskriv rute</string>
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
<resources>
|
||||
<string name="bidforfix_loading">Lädt gerade</string>
|
||||
<string name="bidforfix_supporters">%1$d Unterstützer</string>
|
||||
<string name="bidforfix_funded">bereits gespendet: %d%%</string>
|
||||
<string name="bidforfix_funded">Bereits gespendet: %d%%</string>
|
||||
</resources>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<string name="poi_hospital">Krankenhaus</string>
|
||||
<string name="poi_hostel">Jugendherberge</string>
|
||||
<string name="poi_hotel">Hotel</string>
|
||||
<string name="poi_mine_historic">Historisches bergwerk</string>
|
||||
<string name="poi_mine_historic">Historisches Bergwerk</string>
|
||||
<string name="poi_monastery">Kloster</string>
|
||||
<string name="poi_motel">Motel</string>
|
||||
<string name="poi_monument">Monument</string>
|
||||
|
|
|
@ -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>
|
||||
|
@ -999,7 +999,7 @@
|
|||
<string name="route_general_information">Gesamtentfernung: %1$s\nReisezeit: %2$d h %3$d min</string>
|
||||
<string name="router_service_descr">Online- oder Offline-Dienst zur Routenberechnung wählen</string>
|
||||
<string name="router_service">Navigationsdienst</string>
|
||||
<string name="sd_dir_not_accessible">Auf den Daten-Ordner auf der SD-Karte kann nicht zugegriffen werden</string>
|
||||
<string name="sd_dir_not_accessible">Auf den Daten-Ordner auf der SD-Karte kann nicht zugegriffen werden!</string>
|
||||
<string name="download_question">Herunterladen {0} - {1}?</string>
|
||||
<string name="download_question_exist">Offline Daten für {0} existieren schon ({1}). Wollen Sie die überschreiben ({2})?</string>
|
||||
<string name="address">Adresse</string>
|
||||
|
@ -1535,7 +1535,7 @@
|
|||
<string name="routing_attr_avoid_motorway_description">Autobahnen vermeiden</string>
|
||||
<string name="routing_attr_weight_name">Gewichtsbeschränkung</string>
|
||||
<string name="routing_attr_weight_description">Angabe eines Fahrzeuggewichts für die Zulässigkeit Route</string>
|
||||
<string name="android_19_location_disabled">"Seit Android 4.4 (KitKat) können neue Karten-Downloads nicht mehr am Speicherort früherer Android-Versionen gespeichert werden (%s). Jetzt den zulässigen Speicherort wählen und alle OsmAnd Dateien dorthin kopieren?
|
||||
<string name="android_19_location_disabled">"Seit Android 4.4 (KitKat) können neue Karten-Downloads nicht mehr am Speicherort früherer Android-Versionen gespeichert werden (%s). Jetzt den zulässigen Speicherort wählen und alle OsmAnd-Dateien dorthin kopieren?
|
||||
\n Hinweis 1: Die ursprünglichen Dateien bleiben hiervon unberührt, können aber nachfolgend manuell gelöscht werden.
|
||||
\n Hinweis 2: Die Dateien können dann nicht mehr von OsmAnd und OsmAnd+ gemeinsam genutzt werden."</string>
|
||||
<string name="application_dir_change_warning2">Soll Osmand auch die Dateien an den neuen Speicherort verschieben?</string>
|
||||
|
@ -1975,8 +1975,6 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
|
|||
<string name="text_size">Schriftgröße</string>
|
||||
<string name="fav_point_dublicate">Doppelung beim Favoriten-Namen</string>
|
||||
<string name="fav_point_dublicate_message">Name des Favoriten bereits vergeben, er wurde auf %1$s geändert.</string>
|
||||
<string name="test_native_render">Nativen Renderer testen</string>
|
||||
<string name="test_native_render_msg">Nutzt den nativen Renderer</string>
|
||||
<string name="use_native_render">Nativen Renderer benutzen</string>
|
||||
<string name="use_native_render_descr">C++ Renderer statt Java-Renderer nutzen</string>
|
||||
<string name="fav_point_emoticons_message">Der Name des Favoriten wurde auf %1$s geändert, denn Zeichenketten mit Emoticons können nicht gespeichert werden.</string>
|
||||
|
@ -2014,6 +2012,9 @@ Afghanistan, Ägypten, Albanien, Algerien, Andorra, Angola, Anguilla, Antigua an
|
|||
<string name="rendering_category_hide">Ausblenden</string>
|
||||
<string name="lock_screen_request_explanation">%1$s benötigt diese Berechtigung, um den Bildschirm auszuschalten (Energiesparfunktion).</string>
|
||||
<string name="advanced_settings">Erweitert</string>
|
||||
<string name="home_button">Start</string>
|
||||
<string name="coordinates">Koordinaten</string>
|
||||
<string name="error_avoid_specific_road">Nächstgelegene Straße konnte nicht gefunden werden</string>
|
||||
<string name="osmo_use_https_descr">Sichere Verbindung zum Server</string>
|
||||
<string name="osmo_use_https">Nutze https</string>
|
||||
<string name="map_update">Karten</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="btn_add_tag">Προσθήκη Ετικέτας</string>
|
||||
<string name="btn_advanced_mode">Λειτουργία για προχωρημένους…</string>
|
||||
<string name="poi_filter_parking">Στάθμευση</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="layer_map_appearance">Configura pantalla</string>
|
||||
|
@ -1839,8 +1839,6 @@ Afganistán, Albania, Alemania, Andorra, Angola, Anguila, Antigua y Barbuda, Ant
|
|||
<string name="text_size">Tamaño de texto</string>
|
||||
<string name="fav_point_dublicate">Nombre de punto favorito duplicado</string>
|
||||
<string name="fav_point_dublicate_message">Hemos cambiado el nombre de tu punto favorito a %1$s para evitar nombres duplicados.</string>
|
||||
<string name="test_native_render">Probar renderización nativa</string>
|
||||
<string name="test_native_render_msg">Iniciar la actividad con renderización nativa</string>
|
||||
<string name="use_native_render">Usar renderización nativa</string>
|
||||
<string name="use_native_render_descr">Usar el renderizado C++ en lugar de Java</string>
|
||||
<string name="print_route">Imprimir ruta</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="offline_edition">Modifications hors-ligne</string>
|
||||
<string name="offline_edition_descr">Toujours utiliser l\'édition hors-ligne</string>
|
||||
<string name="tip_recent_changes_0_7_1_t">"Changements en 0.7.1 :
|
||||
|
@ -1821,8 +1821,6 @@ Afghanistan, Albanie, Algérie, Allemagne, Andorre, Angola, Anguilla, Antigua-et
|
|||
<string name="fav_point_dublicate">Ce nom est déjà utilisé pour un favori.</string>
|
||||
<string name="fav_point_dublicate_message">Nous avons modifié le nom de votre favori en %1$s pour éviter les doublons.</string>
|
||||
<string name="text_size_descr">Sélectionnez la taille du texte sur la carte.</string>
|
||||
<string name="test_native_render">Tester le moteur de rendu natif</string>
|
||||
<string name="test_native_render_msg">Démarrer l\'activité avec le moteur de rendu natif</string>
|
||||
<string name="use_native_render">Utiliser le moteur natif de rendu</string>
|
||||
<string name="use_native_render_descr">Utiliser le moteur de rendu C++ au lieu de Java</string>
|
||||
<string name="print_route">Exporter l\'itinéraire</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="fav_point_dublicate_message">O nome do punto favorito foi cambiado a %1$s para evitar os duplicados.</string>
|
||||
<string name="text_size_descr">Configurar o tamaño da letra no mapa.</string>
|
||||
<string name="text_size">Tamaño da letra</string>
|
||||
|
@ -16,8 +16,6 @@
|
|||
<string name="tip_search_t">"Pódense buscar sitios directamente no mapa con «Empregar o lugar» → «Buscar preto de aquí» ou chamando pola pantalla de busca mediante «Menú» → «Buscar».\n\nA pantalla de busca fornece modelos para buscar\n\t* polo enderezo\n\t* mediante coordenadas\n\t* como punto de interese (PDI, por tipo ou polo nome)\n\t* mediante o historial de buscas\n\t* ou mediante os favoritos predefinidos.\n\nCon todas as coincidencias hai un menú de contexto ou barra de accións que ofrece opcións tipo «Indicacións a» ou «Mostrar no mapa», etc. "</string>
|
||||
<string name="fav_point_emoticons_message">Cambiamos o punto favorito a %1$s para facilitar que se garde a cadea con emoticonas nun ficheiro.</string>
|
||||
<string name="print_route">Imprimir o itinerario</string>
|
||||
<string name="test_native_render">Probar o renderizador nativo</string>
|
||||
<string name="test_native_render_msg">Inicia a actividade cun renderizador nativo</string>
|
||||
<string name="fav_point_dublicate">O nome do punto favorito está duplicado</string>
|
||||
<string name="use_native_render">Empregar o renderizador nativo</string>
|
||||
<string name="use_native_render_descr">Empregar o renderizador en C++ en troques de en Java</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="map_widget_gps_info">GPS informacije</string>
|
||||
<string name="access_arrival_time">Vrijeme dolaska</string>
|
||||
<string name="item_checked">provjereno</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="tip_recent_changes_0_7_2_t">"A 0.7.2 kiadás változásai:
|
||||
\n\t- Natív renderelő minden eszközre
|
||||
\n\t- Offline POI szerkesztés
|
||||
|
@ -1767,8 +1767,6 @@
|
|||
<string name="traffic_warning_calming">Forgalomcsillapító</string>
|
||||
<string name="traffic_warning_speed_camera">Traffipax</string>
|
||||
<string name="traffic_warning">Forgalmi figyelmeztetés</string>
|
||||
<string name="test_native_render">Natív renderelés tesztelése</string>
|
||||
<string name="test_native_render_msg">Natív renderelő elindítása</string>
|
||||
<string name="fav_point_dublicate">Kedevenc hely név duplikáció</string>
|
||||
<string name="fav_point_dublicate_message">A duplikáció elkerülése érdekében módosítottuk a kedvenc hely nevét erre: %1$s.</string>
|
||||
<string name="use_native_render">Natív renderelő használata</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="download_hillshade_item">Տարածքի ռելիեֆ</string>
|
||||
<string name="download_hillshade_maps">Տարածքի մգեցված ռելիեֆով քարտեզներ</string>
|
||||
<string name="dist_control_start">Սկիզբ</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="use_fluorescent_overlays">Sovrapposizioni fluorescenti</string>
|
||||
<string name="use_fluorescent_overlays_descr">Usa colori fluorescenti per visualizzare tracce e percorsi</string>
|
||||
<string name="offline_edition">Modifiche offline</string>
|
||||
|
@ -1964,7 +1964,7 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
|
|||
<string name="speak_poi">Annuncia PDI nelle vicinanze</string>
|
||||
<string name="index_tours">Itinerari</string>
|
||||
<string name="flat_list_waypoints">Tutto</string>
|
||||
<string name="record_plugin_description">Registra le tue tracce con il pulsante dedicato nello schermo della mappa. Mostra le impostazioni per la registrazione dei tuoi viaggi in file GPX localmente o online utilizzando un servizio web.</string>
|
||||
<string name="record_plugin_description">Registra le tue tracce con il pulsante dedicato nello schermo della mappa. Mostra le impostazioni per la registrazione dei vostri viaggi in file GPX localmente o online utilizzando un servizio web.</string>
|
||||
<string name="record_plugin_name">Registra i tuoi viaggi</string>
|
||||
<string name="int_hour">h</string>
|
||||
<string name="duration">Durata</string>
|
||||
|
@ -1986,8 +1986,6 @@ Si consiglia di aggiungere uno o più punti intermedi per migliorarne le prestaz
|
|||
<string name="local_index_description">Clicca su un oggetto per visualizzare maggiori dettagli, tieni premuto per disattivarlo o cancellarlo. Dati attualmente nel dispositivo (%1$s liberi):</string>
|
||||
<string name="text_size_descr">Imposta la dimensione del testo sulla mappa.</string>
|
||||
<string name="text_size">Dimensione del testo</string>
|
||||
<string name="test_native_render">Prova il rendering nativo</string>
|
||||
<string name="test_native_render_msg">Inizia l\'attività con il rendering nativo</string>
|
||||
<string name="fav_point_dublicate">Duplicato del nome del punto preferito</string>
|
||||
<string name="fav_point_dublicate_message">Per evitare duplicati il nome del vostro punto preferito è stato modificato in %1$s.</string>
|
||||
<string name="use_native_render">Usa il rendering nativo</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="installing_new_resources">新しいデータを展開中…</string>
|
||||
<string name="internet_connection_required_for_online_route">オンライン経路案内を使用しようとしていますが
|
||||
インターネット接続されていません。</string>
|
||||
|
@ -2062,8 +2062,6 @@ OsmAndはオープンソースであり、活発に開発が進められいま
|
|||
<string name="speed_limit_exceed_message">制限速度超過による警告音声の許容値を選択。</string>
|
||||
<string name="fav_point_emoticons_message">お気に入り地点名%1$sはファイルに絵文字を含む文字列を保存し、分かり易いよう変更されています。</string>
|
||||
<string name="print_route">経路印刷</string>
|
||||
<string name="test_native_render">ネイティブレンダリングのテスト</string>
|
||||
<string name="test_native_render_msg">ネイティブレンダリングを有効化して開始</string>
|
||||
<string name="fav_point_dublicate">お気に入り地点の重複</string>
|
||||
<string name="fav_point_dublicate_message">名前の重複を避けるために、%1$s にお気に入り地点の名前を変更しました。</string>
|
||||
<string name="use_native_render">ネイティブレンダリングを使用</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="vector_maps_may_display_faster_on_some_devices">벡터 맵이 더욱 빠르게 표시됩니다. 하지만, 어떤 기기에서는 잘 작동하지 않을 수 있습니다.</string>
|
||||
|
||||
<string name="play_commands_of_currently_selected_voice">현재 선택된 음성 명령을 재생합니다</string>
|
||||
|
@ -2035,8 +2035,6 @@
|
|||
<string name="text_size">텍스트 크기</string>
|
||||
<string name="fav_point_dublicate">즐겨찾기 포인트 이름 중복</string>
|
||||
<string name="fav_point_dublicate_message">중복된 포인트 이름을 방지 하기 위해서 %1$s 에 즐겨찾기 포인트 이름을 변경합니다.</string>
|
||||
<string name="test_native_render">기본 렌더링 테스트</string>
|
||||
<string name="test_native_render_msg">기본 렌더링으로 활동(activity)을 시작합니다</string>
|
||||
<string name="use_native_render">기본 렌더링 사용</string>
|
||||
<string name="use_native_render_descr">Java 대신 C++ 렌더링을 사용합니다</string>
|
||||
<string name="print_route">경로 인쇄</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="dist_control_start">donya hich wafay bom niya, zhyan hich khoshi bom niya, mrdn jegay shanaziya</string>
|
||||
<string name="local_indexes_cat_av">زانیاری دەنگ/ڤیدیۆ</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="starting_point_too_far">Pradžios taškas yra per toli nuo artimiausio kelio.</string>
|
||||
<string name="shared_location">Bendrinta vieta</string>
|
||||
<string name="osmand_parking_warning">Dėmesio</string>
|
||||
|
@ -1807,8 +1807,6 @@
|
|||
<string name="local_index_description">Spustelėkite bet kurį elementą, norėdami gauti daugiau informacijos, paspauskite ir laikykite, norėdami išjungti arba ištrinti. Dabartiniai duomenys įrenginyje (%1$s laisva):</string>
|
||||
<string name="print_route">Išspausdinti maršrutą</string>
|
||||
<string name="fav_point_emoticons_message">Mes pakeitėme jūsų įsimintos vietos pavadinimą į %1$s, nes teksto su veidukais išsaugoti faile neįmanoma.</string>
|
||||
<string name="test_native_render">Testuoti aparatinį atvaizdavimą</string>
|
||||
<string name="test_native_render_msg">Pradeda veiklą su aparatiniu atvaizdavimu</string>
|
||||
<string name="use_native_render">Naudoti aparatinį atvaizdavimą</string>
|
||||
<string name="use_native_render_descr">Naudoti C++ vietoje Java atvaizdavimo</string>
|
||||
<string name="speed_limit_exceed">Greičio ribojimo viršijimo reikšmė</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="plugins_screen">Spraudņu pārvaldnieks</string>
|
||||
<string name="select_plugin_to_activate">Atzīmējiet spraudni, lai to aktivizētu (varētu būt nepieciešams OsmAnd restarts)</string>
|
||||
<string name="prefs_plugins_descr">Spraudņi iespējo aplikācijas papildus funkcijas un uzstādījumus kā piemēram sekošana, enerģijas taupīšana, pieejamība un daudzas citas</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="rendering_attr_roadColors_description">Velg fargeskjema for veier:</string>
|
||||
<string name="rendering_attr_roadColors_name">Veifargeskjema</string>
|
||||
<string name="map_widget_show_destination_arrow">Vis retning til målet</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="layer_map_appearance">Configureer scherm</string>
|
||||
|
@ -1967,8 +1967,6 @@ 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 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>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="tip_recent_changes_0_6_9_t">"Zmiany w 0.6.9: \n\t- poprawiono renderowanie map offline \n\t- szybkie renderowanie natywne (wersja eksperymentalna - może nie działać na niektórych urządzeniach) \n\t- poprawki w interfejsie \n\t- dodano wyświetlanie informacji o wysokości (altitude) \n\t- nowe tłumaczenia (polskie, wietnamskie) \n\t- inne, mniejsze poprawki "</string>
|
||||
|
||||
<string name="use_transparent_map_theme">Przezroczysty styl</string>
|
||||
|
@ -1910,8 +1910,6 @@ Afganistan, Afryka Południowa, Albania, Algieria, Andora, Angola, Anguilla, Ant
|
|||
<string name="text_size">Rozmiar tekstu</string>
|
||||
<string name="fav_point_dublicate">Zduplikowana nazwa ulubionego punktu</string>
|
||||
<string name="fav_point_dublicate_message">Zmieniliśmy nazwa twojego ulubionego punktu na %1$s w celu uniknięcia duplikatów nazw.</string>
|
||||
<string name="test_native_render">Test renderowania natywnego</string>
|
||||
<string name="test_native_render_msg">Rozpocznij aktywność z renderowaniem natywnym</string>
|
||||
<string name="use_native_render">Użyj renderowania natywnego</string>
|
||||
<string name="use_native_render_descr">Użyj kodu renderowania C++ zamiast Java</string>
|
||||
<string name="speed_limit_exceed">Tolerancja ograniczenia prędkości</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="osmo_use_https_descr">Использовать безопасное соединение с сервером</string>
|
||||
<string name="osmo_use_https">Использовать https</string>
|
||||
|
@ -1776,7 +1776,6 @@
|
|||
<string name="traffic_warning">Ограничение скорости</string>
|
||||
<string name="speed_limit_exceed_message">Выберите допустимое значение превышения скорости выше которого вы получите голосовое предупреждение.</string>
|
||||
<string name="speed_limit_exceed">Допустимое значение превышения скорости</string>
|
||||
<string name="test_native_render">Тест нативной визуализации</string>
|
||||
<string name="fav_point_emoticons_message">Название избранной точки было изменено на %1$s для возможности сохранения строки со смайликом в файл.</string>
|
||||
<string name="print_route">Печать маршрута</string>
|
||||
<string name="fav_point_dublicate">Дублирование названия избранной точки</string>
|
||||
|
@ -1786,7 +1785,6 @@
|
|||
<string name="text_size_descr">Установите размер текста для карты.</string>
|
||||
<string name="text_size">Размер текста</string>
|
||||
<string name="local_index_description">Нажмите на любой элемент списка для просмотра более подробной информации, нажмите и удерживайте, чтобы поместить в архив или удалить. Текущие данные на устройстве (%1$s свободно):</string>
|
||||
<string name="test_native_render_msg">Запустить activity с нативной визуализацией</string>
|
||||
<string name="osmo_device_not_found">Устройство не обнаружено</string>
|
||||
<string name="anonymous_user">Анонимный пользователь</string>
|
||||
<string name="osmo_no_connection_msg">Сервис OsMo не доступен:\n- проверьте соединение;\n- проверьте настройки;\n- проверьте наш Twitter: https://twitter.com/OsMomobi</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="always_center_position_on_map">Ammustra sa positzione semper a su tzentru</string>
|
||||
<string name="voice_pref_title">Boghe</string>
|
||||
<string name="misc_pref_title">Mistura</string>
|
||||
|
@ -1742,8 +1742,6 @@ Si cussigiat de annànghere unu o prus puntos intermedios pro megiorare sas pres
|
|||
<string name="text_size">Mannària de su testu</string>
|
||||
<string name="fav_point_dublicate_message">Amus cambiau su nùmene de su prefèrridu tuo a %1$s pro evitare nùmenes dòpios.</string>
|
||||
<string name="fav_point_dublicate">Nùmene dòpiu in sos prefèrridos</string>
|
||||
<string name="test_native_render">Collàuda sa renderizatzione nativa</string>
|
||||
<string name="test_native_render_msg">Incumentza s\'atividade cun sa renderizatzione nativa</string>
|
||||
<string name="use_native_render">Imprea sa renderizatzione nativa</string>
|
||||
<string name="use_native_render_descr">Imprea sa renderizatzione C++ imbetzes de Java</string>
|
||||
<string name="print_route">Imprenta àndala</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="recording_context_menu_show">Zobraziť</string>
|
||||
<string name="recording_photo_description">Fotografia %1$s zachytená dňa %2$s</string>
|
||||
<string name="av_def_action_picture">Zachytiť fotografiu</string>
|
||||
|
@ -1952,8 +1952,6 @@ Afganistan, Albánsko, Alžírsko, Andora, Angola, Anguilla, Antigua a Barbuda,
|
|||
<string name="text_size">Veľkosť textu</string>
|
||||
<string name="fav_point_dublicate">Duplicitný názov obľúbeného bodu</string>
|
||||
<string name="fav_point_dublicate_message">Názov obľúbeného bodu bol zmenený na %1$s, aby nevznikla duplicita.</string>
|
||||
<string name="test_native_render">Testovať natívne vykresľovanie</string>
|
||||
<string name="test_native_render_msg">Spustí činnosť s natívnym vykresľovaním</string>
|
||||
<string name="use_native_render">Použiť natívne vykresľovanie</string>
|
||||
<string name="use_native_render_descr">Použiť vykresľovanie v C++ namiesto Javy</string>
|
||||
<string name="fav_point_emoticons_message">Názov obľúbeného bodu bol upravený na %1$s, aby bolo možné správne uložiť názov s emotikonom do súboru.</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="search_button">Iskanje</string>
|
||||
<string name="search_activity">Iskanje</string>
|
||||
<string name="settings_Button">Nastavitve</string>
|
||||
|
@ -1965,10 +1965,8 @@ Seznam držav (praktično ves svet!): Afganistan, Albanija, Alžirija, Andora, A
|
|||
<string name="speed_limit_exceed">Toleranca omejitve hitrosti</string>
|
||||
<string name="speed_limit_exceed_message">Izberite mejo tolerance omejitve hitrosti, nad katero boste prejeli glasovno opozorilo.</string>
|
||||
<string name="print_route">Tiskanje poti</string>
|
||||
<string name="test_native_render">Poskus izvirnega upodabljanja</string>
|
||||
<string name="use_native_render_descr">Uporabi C++ upodabljanje namesto Java</string>
|
||||
<string name="tip_recent_changes_1_9_t">"Spremembe v 1.9:\n\t* Posodobljeni stili zemljevida s upodabljanjem površine cestišča, transportnih plasti in pohodniških simbolov\n\t* Iskanje POI na poti\n\t* Označi cesto kot neprehodno na sejo\n\t* Lažje nalaganje in posodabljanje zemljevidov\n\t* Vizualno in zvočno obvestilo, ki se izvede ko se približujete točkam\n\t* Tisk poti in informacij o zavojih\n\t* Podpora pasov za zavijanje\n\t* Podpora Android Wear\n\t* Veliko sprememb grafičnega vmesnika\n\t* Ločena povečava za velikost črk na zemljevidu\n\t* Posebna zvočna obvestila v primeru, da niste na poti\n\t* Funkcionalnost prijave v OsMo\n\t* Popravilo OsMo nezdružljivosti različic "</string>
|
||||
<string name="test_native_render_msg">Začetek aktivnosti z izvirnim upodabljanjem</string>
|
||||
<string name="fav_point_dublicate">Podvojeno ime priljubljene lokacije</string>
|
||||
<string name="fav_point_dublicate_message">Ime vaše priljubljene lokacije je bilo spremenjeno v %1$s, da bi se izognili podvojenih imen.</string>
|
||||
<string name="use_native_render">Uporabi izvirno upodabljanje</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="screen_is_locked">För att låsa upp skärmen tryck på låsikonen</string>
|
||||
<string name="ChooseCountry">Välj land</string>
|
||||
<string name="choose_city">Välj stad</string>
|
||||
|
@ -1690,8 +1690,6 @@
|
|||
<string name="local_index_description">Peta på en post för att se fler detaljer, tryck och håll för att inaktivera eller ta bort. Data på enheten (%1$s ledigt):</string>
|
||||
<string name="text_size_descr">Ange textstorlek på kartan.</string>
|
||||
<string name="text_size">Textstorlek</string>
|
||||
<string name="test_native_render">Testa inbyggd rendering</string>
|
||||
<string name="test_native_render_msg">Startar aktivitet med inbyggd rendering</string>
|
||||
<string name="fav_point_dublicate">Duplicerat namn på favoritpunkt</string>
|
||||
<string name="fav_point_dublicate_message">Namnet på din favoritpunkt %1$s ändrades för att undvika duplicerade namn.</string>
|
||||
<string name="use_native_render">Använd inbyggd rendering</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="close_changeset">Değişiklik listesini kapat</string>
|
||||
<string name="zxing_barcode_scanner_not_found">ZXing Barcode Scanner uygulaması kurulu değil. Uygulama marketinde aramak ister misiniz?</string>
|
||||
<string name="rendering_attr_roadColors_description">Yol renk şemasını seç:</string>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Language: Vietnamese; Language code: vi
|
||||
Translator: Le Viet Thanh; email: lethanhx2k@gmail.com -->
|
||||
<resources>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources><string name="rendering_attr_roadColors_description">選擇道路的色彩調配:</string>
|
||||
<string name="rendering_attr_roadColors_name">道路的色彩調配</string>
|
||||
<string name="map_widget_show_destination_arrow">顯示目的地方向</string>
|
||||
|
@ -1793,8 +1793,6 @@
|
|||
<string name="text_size">文字大小</string>
|
||||
<string name="fav_point_dublicate">我的最愛標點,名稱重複</string>
|
||||
<string name="fav_point_dublicate_message">我們把我的最愛標點名稱,改為 %1$s 以避免名稱重複。</string>
|
||||
<string name="test_native_render">測試原生繪製</string>
|
||||
<string name="test_native_render_msg">開始啟動原生繪製</string>
|
||||
<string name="use_native_render">使用原生繪製</string>
|
||||
<string name="use_native_render_descr">使用 C++ 替代 JAVA 繪製</string>
|
||||
<string name="print_route">列印路線</string>
|
||||
|
|
|
@ -214,6 +214,8 @@
|
|||
|
||||
<string name="poi_pier">Pier</string>
|
||||
<string name="poi_surveillance">Surveillance</string>
|
||||
<string name="poi_observatory">Observatory</string>
|
||||
<string name="poi_astronomical_observatory">Astronomical observatory</string>
|
||||
<string name="poi_construction">Construction</string>
|
||||
<string name="poi_works">Works</string>
|
||||
<string name="poi_mineshaft">Mineshaft</string>
|
||||
|
@ -404,6 +406,8 @@
|
|||
<string name="poi_caravan_site">Caravan site</string>
|
||||
<string name="poi_picnic_site">Picnic site</string>
|
||||
<string name="poi_spring">Spring</string>
|
||||
<string name="poi_hot_spring">Hot spring</string>
|
||||
<string name="poi_geyser">Geyser</string>
|
||||
<string name="poi_cemetery">Cemetery</string>
|
||||
<string name="poi_grave_yard">Graveyard</string>
|
||||
<string name="poi_shelter">Shelter</string>
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="error_avoid_specific_road">Nearest road was not found</string>
|
||||
<string name="home_button">Home</string>
|
||||
<string name="osmo_use_https_descr">Use secure connection with server</string>
|
||||
<string name="osmo_use_https">Use https</string>
|
||||
|
@ -69,8 +70,6 @@
|
|||
<string name ="speed_limit_exceed_message">Select speed limit tolerance margin, above which you will receive a voice warning.</string>
|
||||
<string name="fav_point_emoticons_message">The favorite point name has been modified to %1$s to facilitate properly saving the string with emoticons to a file.</string>
|
||||
<string name="print_route">Print route</string>
|
||||
<string name="test_native_render">Test native rendering</string>
|
||||
<string name="test_native_render_msg">Starts activity with native rendering</string>
|
||||
<string name="fav_point_dublicate">Favorite point name duplicate</string>
|
||||
<string name="fav_point_dublicate_message">We changed your favorite point name to %1$s to avoid duplicated names.</string>
|
||||
<string name="use_native_render">Use native rendering</string>
|
||||
|
|
|
@ -1,508 +0,0 @@
|
|||
package net.osmand.core.android;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
import javax.microedition.khronos.egl.EGLDisplay;
|
||||
import javax.microedition.khronos.egl.EGLSurface;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import net.osmand.core.jni.*;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.QuadPoint;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.helpers.TwoFingerTapDetector;
|
||||
import net.osmand.plus.render.NativeOsmandLibrary;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.opengl.EGL14;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.GestureDetector.OnDoubleTapListener;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class GLActivity extends Activity {
|
||||
|
||||
static {
|
||||
NativeOsmandLibrary.loadLibrary("gnustl_shared");
|
||||
NativeOsmandLibrary.loadLibrary("Qt5Core");
|
||||
NativeOsmandLibrary.loadLibrary("Qt5Network");
|
||||
NativeOsmandLibrary.loadLibrary("Qt5Sql");
|
||||
NativeOsmandLibrary.loadLibrary("OsmAndCoreWithJNI");
|
||||
}
|
||||
private static final String TAG = "OsmAndCoreSample";
|
||||
|
||||
private CoreResourcesFromAndroidAssetsCustom _coreResources;
|
||||
|
||||
private float _displayDensityFactor;
|
||||
private int _referenceTileSize;
|
||||
private int _rasterTileSize;
|
||||
private IMapStylesCollection _mapStylesCollection;
|
||||
private ResolvedMapStyle _mapStyle;
|
||||
private ObfsCollection _obfsCollection;
|
||||
private MapPresentationEnvironment _mapPresentationEnvironment;
|
||||
private MapPrimitiviser _mapPrimitiviser;
|
||||
private ObfMapObjectsProvider _obfMapObjectsProvider;
|
||||
private MapPrimitivesProvider _mapPrimitivesProvider;
|
||||
private MapObjectsSymbolsProvider _mapObjectsSymbolsProvider;
|
||||
private MapRasterLayerProvider _mapRasterLayerProvider;
|
||||
private OnlineRasterMapLayerProvider _onlineMapRasterLayerProvider;
|
||||
private IMapRenderer _mapRenderer;
|
||||
private GpuWorkerThreadPrologue _gpuWorkerThreadPrologue;
|
||||
private GpuWorkerThreadEpilogue _gpuWorkerThreadEpilogue;
|
||||
private RenderRequestCallback _renderRequestCallback;
|
||||
private QIODeviceLogSink _fileLogSink;
|
||||
private RotatedTileBox currentViewport = null;
|
||||
|
||||
private GestureDetector gestureDetector;
|
||||
|
||||
|
||||
protected OsmandApplication getApp() {
|
||||
return (OsmandApplication) getApplication();
|
||||
}
|
||||
|
||||
private boolean afterTwoFingerTap = false;
|
||||
TwoFingerTapDetector twoFingerTapDetector = new TwoFingerTapDetector() {
|
||||
@Override
|
||||
public void onTwoFingerTap() {
|
||||
afterTwoFingerTap = true;
|
||||
currentViewport.setZoom(currentViewport.getZoom() - 1);
|
||||
updateView();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
OsmandSettings st = getApp().getSettings();
|
||||
WindowManager mgr = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
mgr.getDefaultDisplay().getMetrics(dm);
|
||||
currentViewport = new RotatedTileBox.RotatedTileBoxBuilder().
|
||||
setLocation(st.getLastKnownMapLocation().getLatitude(),
|
||||
st.getLastKnownMapLocation().getLongitude()).setZoomAndScale(st.getLastKnownMapZoom(), 0).
|
||||
setPixelDimensions(dm.widthPixels, dm.heightPixels).build();
|
||||
currentViewport.setDensity(dm.density);
|
||||
|
||||
|
||||
|
||||
gestureDetector = new GestureDetector(this, new android.view.GestureDetector.OnGestureListener() {
|
||||
|
||||
@Override
|
||||
public boolean onSingleTapUp(MotionEvent e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onShowPress(MotionEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
|
||||
final QuadPoint cp = currentViewport.getCenterPixelPoint();
|
||||
final LatLon latlon = currentViewport.getLatLonFromPixel(cp.x + distanceX, cp.y + distanceY);
|
||||
currentViewport.setLatLonCenter(latlon.getLatitude(), latlon.getLongitude());
|
||||
updateView();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLongPress(MotionEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDown(MotionEvent e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
gestureDetector.setOnDoubleTapListener(new OnDoubleTapListener() {
|
||||
@Override
|
||||
public boolean onSingleTapConfirmed(MotionEvent e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDoubleTapEvent(MotionEvent e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onDoubleTap(MotionEvent e) {
|
||||
currentViewport.setZoom(currentViewport.getZoom() + 1);
|
||||
updateView();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
setContentView(R.layout.activity_gl);
|
||||
|
||||
// Get device display density factor
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
_displayDensityFactor = displayMetrics.density;
|
||||
_referenceTileSize = (int)(256 * _displayDensityFactor);
|
||||
_rasterTileSize = Integer.highestOneBit(_referenceTileSize - 1) * 2;
|
||||
Log.i(TAG, "displayDensityFactor = " + _displayDensityFactor);
|
||||
Log.i(TAG, "referenceTileSize = " + _referenceTileSize);
|
||||
Log.i(TAG, "rasterTileSize = " + _rasterTileSize);
|
||||
|
||||
Log.i(TAG, "Initializing core...");
|
||||
_coreResources = CoreResourcesFromAndroidAssetsCustom.loadFromCurrentApplication(this);
|
||||
OsmAndCore.InitializeCore(_coreResources.instantiateProxy());
|
||||
|
||||
File directory =getApp().getAppPath("");
|
||||
_fileLogSink = QIODeviceLogSink.createFileLogSink(directory.getAbsolutePath() + "/osmandcore.log");
|
||||
Logger.get().addLogSink(_fileLogSink);
|
||||
|
||||
Log.i(TAG, "Going to resolve default embedded style...");
|
||||
_mapStylesCollection = new MapStylesCollection();
|
||||
_mapStyle = _mapStylesCollection.getResolvedStyleByName("default");
|
||||
if (_mapStyle == null)
|
||||
{
|
||||
Log.e(TAG, "Failed to resolve style 'default'");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
Log.i(TAG, "Going to prepare OBFs collection");
|
||||
_obfsCollection = new ObfsCollection();
|
||||
|
||||
Log.i(TAG, "Will load OBFs from " + directory.getAbsolutePath());
|
||||
_obfsCollection.addDirectory(directory.getAbsolutePath(), false);
|
||||
|
||||
Log.i(TAG, "Going to prepare all resources for renderer");
|
||||
_mapPresentationEnvironment = new MapPresentationEnvironment(
|
||||
_mapStyle,
|
||||
_displayDensityFactor,
|
||||
"en"); //TODO: here should be current locale
|
||||
//mapPresentationEnvironment->setSettings(configuration.styleSettings);
|
||||
_mapPrimitiviser = new MapPrimitiviser(
|
||||
_mapPresentationEnvironment);
|
||||
_obfMapObjectsProvider = new ObfMapObjectsProvider(
|
||||
_obfsCollection);
|
||||
_mapPrimitivesProvider = new MapPrimitivesProvider(
|
||||
_obfMapObjectsProvider,
|
||||
_mapPrimitiviser,
|
||||
_rasterTileSize);
|
||||
_mapObjectsSymbolsProvider = new MapObjectsSymbolsProvider(
|
||||
_mapPrimitivesProvider,
|
||||
_rasterTileSize);
|
||||
_mapRasterLayerProvider = new MapRasterLayerProvider_Software(
|
||||
_mapPrimitivesProvider);
|
||||
|
||||
_onlineMapRasterLayerProvider = OnlineTileSources.getBuiltIn().createProviderFor("Mapnik (OsmAnd)");
|
||||
|
||||
Log.i(TAG, "Going to create renderer");
|
||||
_mapRenderer = OsmAndCore.createMapRenderer(MapRendererClass.AtlasMapRenderer_OpenGLES2);
|
||||
if (_mapRenderer == null)
|
||||
{
|
||||
Log.e(TAG, "Failed to create map renderer 'AtlasMapRenderer_OpenGLES2'");
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
AtlasMapRendererConfiguration atlasRendererConfiguration = AtlasMapRendererConfiguration.Casts.upcastFrom(_mapRenderer.getConfiguration());
|
||||
atlasRendererConfiguration.setReferenceTileSizeOnScreenInPixels(_referenceTileSize);
|
||||
_mapRenderer.setConfiguration(AtlasMapRendererConfiguration.Casts.downcastTo_MapRendererConfiguration(atlasRendererConfiguration));
|
||||
|
||||
_mapRenderer.addSymbolsProvider(_mapObjectsSymbolsProvider);
|
||||
updateView();
|
||||
/*
|
||||
IMapRasterLayerProvider mapnik = OnlineTileSources.getBuiltIn().createProviderFor("Mapnik (OsmAnd)");
|
||||
if (mapnik == null)
|
||||
Log.e(TAG, "Failed to create mapnik");
|
||||
*/
|
||||
_mapRenderer.setMapLayerProvider(0, _mapRasterLayerProvider);
|
||||
|
||||
_glSurfaceView = (GLSurfaceView) findViewById(R.id.glSurfaceView);
|
||||
//TODO:_glSurfaceView.setPreserveEGLContextOnPause(true);
|
||||
_glSurfaceView.setEGLContextClientVersion(2);
|
||||
_glSurfaceView.setEGLContextFactory(new EGLContextFactory());
|
||||
_glSurfaceView.setRenderer(new Renderer());
|
||||
_glSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
|
||||
}
|
||||
|
||||
protected void updateView() {
|
||||
_mapRenderer.setAzimuth(0.0f);
|
||||
_mapRenderer.setElevationAngle(90);
|
||||
_mapRenderer.setTarget(new PointI(currentViewport.getCenter31X(), currentViewport.getCenter31Y()));
|
||||
_mapRenderer.setZoom((float)currentViewport.getZoom() + (float)currentViewport.getZoomScale());
|
||||
}
|
||||
|
||||
private GLSurfaceView _glSurfaceView;
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (twoFingerTapDetector.onTouchEvent(event)) {
|
||||
return true;
|
||||
}
|
||||
return gestureDetector.onTouchEvent(event);
|
||||
}
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
_glSurfaceView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
_glSurfaceView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (_mapStylesCollection != null) {
|
||||
_mapStylesCollection.delete();
|
||||
_mapStylesCollection = null;
|
||||
}
|
||||
|
||||
if (_mapStyle != null) {
|
||||
_mapStyle.delete();
|
||||
_mapStyle = null;
|
||||
}
|
||||
|
||||
if (_obfsCollection != null) {
|
||||
_obfsCollection.delete();
|
||||
_obfsCollection = null;
|
||||
}
|
||||
|
||||
if (_mapPresentationEnvironment != null) {
|
||||
_mapPresentationEnvironment.delete();
|
||||
_mapPresentationEnvironment = null;
|
||||
}
|
||||
|
||||
if (_mapPrimitiviser != null) {
|
||||
_mapPrimitiviser.delete();
|
||||
_mapPrimitiviser = null;
|
||||
}
|
||||
|
||||
if (_obfMapObjectsProvider != null) {
|
||||
_obfMapObjectsProvider.delete();
|
||||
_obfMapObjectsProvider = null;
|
||||
}
|
||||
|
||||
if (_mapPrimitivesProvider != null) {
|
||||
_mapPrimitivesProvider.delete();
|
||||
_mapPrimitivesProvider = null;
|
||||
}
|
||||
|
||||
if (_mapObjectsSymbolsProvider != null) {
|
||||
_mapObjectsSymbolsProvider.delete();
|
||||
_mapObjectsSymbolsProvider = null;
|
||||
}
|
||||
|
||||
if (_mapRasterLayerProvider != null) {
|
||||
_mapRasterLayerProvider.delete();
|
||||
_mapRasterLayerProvider = null;
|
||||
}
|
||||
|
||||
if (_mapRenderer != null) {
|
||||
_mapRenderer.delete();
|
||||
_mapRenderer = null;
|
||||
}
|
||||
|
||||
OsmAndCore.ReleaseCore();
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private class RenderRequestCallback extends MapRendererSetupOptions.IFrameUpdateRequestCallback {
|
||||
@Override
|
||||
public void method(IMapRenderer mapRenderer) {
|
||||
_glSurfaceView.requestRender();
|
||||
}
|
||||
}
|
||||
|
||||
public class GpuWorkerThreadPrologue extends MapRendererSetupOptions.IGpuWorkerThreadPrologue {
|
||||
public GpuWorkerThreadPrologue(EGL10 egl, EGLDisplay eglDisplay, EGLContext context, EGLSurface surface) {
|
||||
_egl = egl;
|
||||
_eglDisplay = eglDisplay;
|
||||
_context = context;
|
||||
_eglSurface = surface;
|
||||
}
|
||||
|
||||
private final EGL10 _egl;
|
||||
private final EGLDisplay _eglDisplay;
|
||||
private final EGLContext _context;
|
||||
private final EGLSurface _eglSurface;
|
||||
|
||||
@Override
|
||||
public void method(IMapRenderer mapRenderer) {
|
||||
try {
|
||||
if (!_egl.eglMakeCurrent(_eglDisplay, _eglSurface, _eglSurface, _context))
|
||||
Log.e(TAG, "Failed to set GPU worker context active: " + _egl.eglGetError());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to set GPU worker context active", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class GpuWorkerThreadEpilogue extends MapRendererSetupOptions.IGpuWorkerThreadEpilogue {
|
||||
public GpuWorkerThreadEpilogue(EGL10 egl) {
|
||||
_egl = egl;
|
||||
}
|
||||
|
||||
private final EGL10 _egl;
|
||||
|
||||
@Override
|
||||
public void method(IMapRenderer mapRenderer) {
|
||||
try {
|
||||
if (!_egl.eglWaitGL())
|
||||
Log.e(TAG, "Failed to wait for GPU worker context: " + _egl.eglGetError());
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to wait for GPU worker context", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class EGLContextFactory implements GLSurfaceView.EGLContextFactory {
|
||||
private EGLContext _gpuWorkerContext;
|
||||
private EGLSurface _gpuWorkerFakeSurface;
|
||||
|
||||
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
|
||||
final String eglExtensions = egl.eglQueryString(display, EGL10.EGL_EXTENSIONS);
|
||||
Log.i(TAG, "EGL extensions: " + eglExtensions);
|
||||
final String eglVersion = egl.eglQueryString(display, EGL10.EGL_VERSION);
|
||||
Log.i(TAG, "EGL version: " + eglVersion);
|
||||
|
||||
Log.i(TAG, "Creating main context...");
|
||||
final int[] contextAttribList = {
|
||||
EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL10.EGL_NONE };
|
||||
|
||||
EGLContext mainContext = null;
|
||||
try {
|
||||
mainContext = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, contextAttribList);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to create main context", e);
|
||||
}
|
||||
if (mainContext == null || mainContext == EGL10.EGL_NO_CONTEXT) {
|
||||
Log.e(TAG, "Failed to create main context: " + egl.eglGetError());
|
||||
mainContext = null;
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
Log.i(TAG, "Creating GPU worker context...");
|
||||
try {
|
||||
_gpuWorkerContext = egl.eglCreateContext(
|
||||
display,
|
||||
eglConfig,
|
||||
mainContext,
|
||||
contextAttribList);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to create GPU worker context", e);
|
||||
}
|
||||
if (_gpuWorkerContext == null || _gpuWorkerContext == EGL10.EGL_NO_CONTEXT)
|
||||
{
|
||||
Log.e(TAG, "Failed to create GPU worker context: " + egl.eglGetError());
|
||||
_gpuWorkerContext = null;
|
||||
}
|
||||
|
||||
if (_gpuWorkerContext != null)
|
||||
{
|
||||
Log.i(TAG, "Creating GPU worker fake surface...");
|
||||
try {
|
||||
final int[] surfaceAttribList = {
|
||||
EGL10.EGL_WIDTH, 1,
|
||||
EGL10.EGL_HEIGHT, 1,
|
||||
EGL10.EGL_NONE };
|
||||
_gpuWorkerFakeSurface = egl.eglCreatePbufferSurface(display, eglConfig, surfaceAttribList);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Failed to create GPU worker fake surface", e);
|
||||
}
|
||||
if (_gpuWorkerFakeSurface == null || _gpuWorkerFakeSurface == EGL10.EGL_NO_SURFACE)
|
||||
{
|
||||
Log.e(TAG, "Failed to create GPU worker fake surface: " + egl.eglGetError());
|
||||
_gpuWorkerFakeSurface = null;
|
||||
}
|
||||
}
|
||||
|
||||
MapRendererSetupOptions rendererSetupOptions = new MapRendererSetupOptions();
|
||||
if (_gpuWorkerContext != null && _gpuWorkerFakeSurface != null) {
|
||||
rendererSetupOptions.setGpuWorkerThreadEnabled(true);
|
||||
_gpuWorkerThreadPrologue = new GpuWorkerThreadPrologue(egl, display, _gpuWorkerContext, _gpuWorkerFakeSurface);
|
||||
rendererSetupOptions.setGpuWorkerThreadPrologue(_gpuWorkerThreadPrologue.getBinding());
|
||||
_gpuWorkerThreadEpilogue = new GpuWorkerThreadEpilogue(egl);
|
||||
rendererSetupOptions.setGpuWorkerThreadEpilogue(_gpuWorkerThreadEpilogue.getBinding());
|
||||
} else {
|
||||
rendererSetupOptions.setGpuWorkerThreadEnabled(false);
|
||||
}
|
||||
_renderRequestCallback = new RenderRequestCallback();
|
||||
rendererSetupOptions.setFrameUpdateRequestCallback(_renderRequestCallback.getBinding());
|
||||
_mapRenderer.setup(rendererSetupOptions);
|
||||
|
||||
return mainContext;
|
||||
}
|
||||
|
||||
public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
|
||||
egl.eglDestroyContext(display, context);
|
||||
|
||||
if (_gpuWorkerContext != null) {
|
||||
egl.eglDestroyContext(display, _gpuWorkerContext);
|
||||
_gpuWorkerContext = null;
|
||||
}
|
||||
|
||||
if (_gpuWorkerFakeSurface != null) {
|
||||
egl.eglDestroySurface(display, _gpuWorkerFakeSurface);
|
||||
_gpuWorkerFakeSurface = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class Renderer implements GLSurfaceView.Renderer {
|
||||
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
|
||||
Log.i(TAG, "onSurfaceCreated");
|
||||
if (_mapRenderer.isRenderingInitialized())
|
||||
_mapRenderer.releaseRendering();
|
||||
}
|
||||
|
||||
public void onSurfaceChanged(GL10 gl, int width, int height) {
|
||||
Log.i(TAG, "onSurfaceChanged");
|
||||
_mapRenderer.setViewport(new AreaI(0, 0, height, width));
|
||||
_mapRenderer.setWindowSize(new PointI(width, height));
|
||||
|
||||
if (!_mapRenderer.isRenderingInitialized())
|
||||
{
|
||||
if (!_mapRenderer.initializeRendering())
|
||||
Log.e(TAG, "Failed to initialize rendering");
|
||||
}
|
||||
}
|
||||
|
||||
public void onDrawFrame(GL10 gl) {
|
||||
_mapRenderer.update();
|
||||
|
||||
if (_mapRenderer.prepareFrame())
|
||||
_mapRenderer.renderFrame();
|
||||
|
||||
gl.glFlush();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
477
OsmAnd/src/net/osmand/core/android/MapRendererContext.java
Normal file
477
OsmAnd/src/net/osmand/core/android/MapRendererContext.java
Normal file
|
@ -0,0 +1,477 @@
|
|||
package net.osmand.core.android;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import net.osmand.core.jni.IMapTiledSymbolsProvider;
|
||||
import net.osmand.core.jni.IObfsCollection;
|
||||
import net.osmand.core.jni.IRasterMapLayerProvider;
|
||||
import net.osmand.core.jni.MapObjectsSymbolsProvider;
|
||||
import net.osmand.core.jni.MapPresentationEnvironment;
|
||||
import net.osmand.core.jni.MapPrimitivesProvider;
|
||||
import net.osmand.core.jni.MapPrimitiviser;
|
||||
import net.osmand.core.jni.MapRasterLayerProvider_Software;
|
||||
import net.osmand.core.jni.ObfMapObjectsProvider;
|
||||
import net.osmand.core.jni.QStringStringHash;
|
||||
import net.osmand.core.jni.MapPresentationEnvironment.LanguagePreference;
|
||||
import net.osmand.core.jni.ResolvedMapStyle;
|
||||
|
||||
/**
|
||||
* Context container and utility class for MapRendererView and derivatives.
|
||||
*
|
||||
* @author Alexey Pelykh
|
||||
*
|
||||
*/
|
||||
public class MapRendererContext {
|
||||
|
||||
public MapRendererContext() {
|
||||
}
|
||||
|
||||
public MapRendererContext(MapRendererView mapRendererView) {
|
||||
_mapRendererView = mapRendererView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronisation object used to perform state changes atomically
|
||||
*/
|
||||
private final Object _syncObject = new Object();
|
||||
|
||||
/**
|
||||
* Reference to map renderer view that is currently managed by this
|
||||
* context
|
||||
*/
|
||||
private MapRendererView _mapRendererView;
|
||||
|
||||
/**
|
||||
* Get currently bound map renderer view
|
||||
* @return Reference to MapRendererView
|
||||
*/
|
||||
public MapRendererView getMapRendererView() {
|
||||
synchronized (_syncObject) {
|
||||
return _mapRendererView;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bounds specified map renderer view to this context
|
||||
* @param mapRendererView Reference to MapRendererView
|
||||
*/
|
||||
public void setMapRendererView(MapRendererView mapRendererView) {
|
||||
synchronized (_syncObject) {
|
||||
boolean update = (_mapRendererView != mapRendererView);
|
||||
if (!update)
|
||||
return;
|
||||
|
||||
_mapRendererView = mapRendererView;
|
||||
if (_mapRendererView != null)
|
||||
apply();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display density factor
|
||||
*/
|
||||
private float _displayDensityFactor = 1;
|
||||
|
||||
/**
|
||||
* Reference tile size on screen in pixels
|
||||
*/
|
||||
private float _referenceTileSize = 256;
|
||||
|
||||
/**
|
||||
* Raster tile size in texels
|
||||
*/
|
||||
private int _rasterTileSize = 256;
|
||||
|
||||
/**
|
||||
* Get current display density factor
|
||||
* @return Display density factor
|
||||
*/
|
||||
public float getDisplayDensityFactor() {
|
||||
synchronized (_syncObject) {
|
||||
return _displayDensityFactor;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set display density factor and update context (if needed)
|
||||
* @param displayDensityFactor New display density factor
|
||||
*/
|
||||
public void setDisplayDensityFactor(float displayDensityFactor) {
|
||||
synchronized (_syncObject) {
|
||||
boolean update = (_displayDensityFactor != displayDensityFactor);
|
||||
if (!update)
|
||||
return;
|
||||
|
||||
_displayDensityFactor = displayDensityFactor;
|
||||
_referenceTileSize = 256.0f * _displayDensityFactor;
|
||||
_rasterTileSize = Integer.highestOneBit((int)_referenceTileSize - 1) * 2;
|
||||
|
||||
if (_mapRendererView instanceof AtlasMapRendererView)
|
||||
((AtlasMapRendererView)_mapRendererView).setReferenceTileSizeOnScreenInPixels(_referenceTileSize);
|
||||
if (_mapPresentationEnvironment != null)
|
||||
updateMapPresentationEnvironment();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference to resolved map style (if used)
|
||||
*/
|
||||
private ResolvedMapStyle _mapStyle;
|
||||
|
||||
/**
|
||||
* Get current map style
|
||||
* @return Reference to current map style
|
||||
*/
|
||||
public ResolvedMapStyle getMapStyle() {
|
||||
synchronized (_syncObject) {
|
||||
return _mapStyle;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set map style and update context (if needed)
|
||||
* @param mapStyle
|
||||
*/
|
||||
public void setMapStyle(ResolvedMapStyle mapStyle) {
|
||||
synchronized (_syncObject) {
|
||||
boolean update = (_mapStyle != mapStyle);
|
||||
if (!update)
|
||||
return;
|
||||
|
||||
_mapStyle = mapStyle;
|
||||
if (_mapPresentationEnvironment != null)
|
||||
updateMapPresentationEnvironment();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference to map style settings (if present)
|
||||
*/
|
||||
private Map<String, String> _mapStyleSettings;
|
||||
|
||||
/**
|
||||
* Get current map style settings
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> getMapStyleSettings() {
|
||||
synchronized (_syncObject) {
|
||||
if (_mapStyleSettings == null)
|
||||
return null;
|
||||
return Collections.unmodifiableMap(_mapStyleSettings);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set map style settings and update context (if needed)
|
||||
* @param mapStyleSettings Map style settings
|
||||
*/
|
||||
public void setMapStyleSettings(Map<String, String> mapStyleSettings) {
|
||||
synchronized (_syncObject) {
|
||||
boolean update = !_mapStyleSettings.equals(mapStyleSettings);
|
||||
if (!update)
|
||||
return;
|
||||
|
||||
_mapStyleSettings = new HashMap<String, String>(mapStyleSettings);
|
||||
if (_mapPresentationEnvironment != null)
|
||||
updateMapPresentationEnvironment();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Locale language
|
||||
*/
|
||||
private String _localeLanguageId = "en";
|
||||
|
||||
/**
|
||||
* Get current locale language
|
||||
* @return Locale language identifier
|
||||
*/
|
||||
public String getLocaleLanguageId() {
|
||||
synchronized (_syncObject) {
|
||||
return _localeLanguageId;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set current locale language and update context (if needed)
|
||||
* @param localeLanguageId Locale language identifier
|
||||
*/
|
||||
public void setLocaleLanguageId(String localeLanguageId) {
|
||||
synchronized (_syncObject) {
|
||||
boolean update = !_localeLanguageId.equals(localeLanguageId);
|
||||
if (!update)
|
||||
return;
|
||||
|
||||
_localeLanguageId = localeLanguageId;
|
||||
if (_mapPresentationEnvironment != null)
|
||||
updateMapPresentationEnvironment();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Language preference
|
||||
*/
|
||||
private LanguagePreference _languagePreference = LanguagePreference.LocalizedAndNative;
|
||||
|
||||
/**
|
||||
* Get current language preference
|
||||
* @return Language preference
|
||||
*/
|
||||
public LanguagePreference getLanguagePreference() {
|
||||
synchronized (_syncObject) {
|
||||
return _languagePreference;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language preference and update context (if needed)
|
||||
* @param languagePreference
|
||||
*/
|
||||
public void setLanguagePreference(LanguagePreference languagePreference) {
|
||||
synchronized (_syncObject) {
|
||||
boolean update = (_languagePreference != languagePreference);
|
||||
if (!update)
|
||||
return;
|
||||
|
||||
_languagePreference = languagePreference;
|
||||
if (_mapPresentationEnvironment != null)
|
||||
updateMapPresentationEnvironment();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference to OBFs collection (if present)
|
||||
*/
|
||||
private IObfsCollection _obfsCollection;
|
||||
|
||||
/**
|
||||
* Get current OBFs collection
|
||||
* @return OBFs collection
|
||||
*/
|
||||
public IObfsCollection getObfsCollection() {
|
||||
synchronized (_syncObject) {
|
||||
return _obfsCollection;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set OBFs collection and update context (if needed)
|
||||
* @param obfsCollection
|
||||
*/
|
||||
public void setObfsCollection(IObfsCollection obfsCollection) {
|
||||
synchronized (_syncObject) {
|
||||
boolean update = (_obfsCollection != obfsCollection);
|
||||
if (!update)
|
||||
return;
|
||||
|
||||
_obfsCollection = obfsCollection;
|
||||
if (_obfMapObjectsProvider != null)
|
||||
updateObfMapObjectsProvider();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference to map presentation environment (if used)
|
||||
*/
|
||||
private MapPresentationEnvironment _mapPresentationEnvironment;
|
||||
|
||||
/**
|
||||
* Update map presentation environment and everything that depends on it
|
||||
*/
|
||||
private void updateMapPresentationEnvironment() {
|
||||
// Create new map presentation environment
|
||||
_mapPresentationEnvironment = new MapPresentationEnvironment(
|
||||
_mapStyle,
|
||||
_displayDensityFactor,
|
||||
_localeLanguageId,
|
||||
_languagePreference);
|
||||
|
||||
// Apply map style settings
|
||||
if (_mapStyleSettings != null) {
|
||||
QStringStringHash convertedStyleSettings = new QStringStringHash();
|
||||
for (Iterator<Map.Entry<String, String>> itSetting = _mapStyleSettings
|
||||
.entrySet().iterator(); itSetting.hasNext();) {
|
||||
Map.Entry<String, String> setting = itSetting.next();
|
||||
convertedStyleSettings.set(setting.getKey(), setting.getValue());
|
||||
}
|
||||
_mapPresentationEnvironment.setSettings(convertedStyleSettings);
|
||||
}
|
||||
|
||||
// Update all dependencies
|
||||
if (_mapPrimitiviser != null)
|
||||
updateMapPrimitiviser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference to map primitiviser (if used)
|
||||
*/
|
||||
private MapPrimitiviser _mapPrimitiviser;
|
||||
|
||||
/**
|
||||
* Update map primitiviser and everything that depends on it
|
||||
*/
|
||||
private void updateMapPrimitiviser() {
|
||||
// Create new map primitiviser
|
||||
_mapPrimitiviser = new MapPrimitiviser(_mapPresentationEnvironment);
|
||||
|
||||
// Update all dependencies
|
||||
if (_mapPrimitivesProvider != null)
|
||||
updateMapPrimitivesProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference to OBF map objects provider (if used)
|
||||
*/
|
||||
private ObfMapObjectsProvider _obfMapObjectsProvider;
|
||||
|
||||
/**
|
||||
* Update OBF map objects provider and everything that depends on it
|
||||
*/
|
||||
private void updateObfMapObjectsProvider() {
|
||||
_obfMapObjectsProvider = new ObfMapObjectsProvider(
|
||||
_obfsCollection);
|
||||
|
||||
// Update all dependencies
|
||||
if (_mapPrimitivesProvider != null)
|
||||
updateMapPrimitivesProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference to map primitives provider (if used)
|
||||
*/
|
||||
private MapPrimitivesProvider _mapPrimitivesProvider;
|
||||
|
||||
/**
|
||||
* Update map primitives provider and everything that depends on it
|
||||
*/
|
||||
private void updateMapPrimitivesProvider() {
|
||||
// Create new map primitives provider
|
||||
_mapPrimitivesProvider = new MapPrimitivesProvider(
|
||||
_obfMapObjectsProvider,
|
||||
_mapPrimitiviser,
|
||||
_rasterTileSize);
|
||||
|
||||
// Update all dependencies
|
||||
if (_obfMapRasterLayerProvider != null)
|
||||
updateObfMapRasterLayerProvider();
|
||||
if (_obfMapSymbolsProvider != null)
|
||||
updateObfMapSymbolsProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference to OBF map raster layer provider (if used)
|
||||
*/
|
||||
private IRasterMapLayerProvider _obfMapRasterLayerProvider;
|
||||
|
||||
/**
|
||||
* Index of OBF map raster layer in bound map renderer view (if set)
|
||||
*/
|
||||
private Integer _obfMapRasterLayer;
|
||||
|
||||
/**
|
||||
* Update OBF map raster layer provider and everything that depends on it
|
||||
*/
|
||||
private void updateObfMapRasterLayerProvider() {
|
||||
// Create new OBF map raster layer provider
|
||||
_obfMapRasterLayerProvider = new MapRasterLayerProvider_Software(
|
||||
_mapPrimitivesProvider);
|
||||
|
||||
// In case there's bound view and configured layer, perform setup
|
||||
if(_mapRendererView != null && _obfMapRasterLayer != null)
|
||||
_mapRendererView.setMapLayerProvider(_obfMapRasterLayer, _obfMapRasterLayerProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference to OBF map symbols provider (if used)
|
||||
*/
|
||||
private IMapTiledSymbolsProvider _obfMapSymbolsProvider;
|
||||
|
||||
/**
|
||||
* Update OBF map symbols provider and everything that depends on it
|
||||
*/
|
||||
private void updateObfMapSymbolsProvider() {
|
||||
// If there's current provider and bound view, remove it
|
||||
if (_obfMapSymbolsProvider != null && _mapRendererView != null)
|
||||
_mapRendererView.removeSymbolsProvider(_obfMapSymbolsProvider);
|
||||
|
||||
// Create new OBF map symbols provider
|
||||
_obfMapSymbolsProvider = new MapObjectsSymbolsProvider(
|
||||
_mapPrimitivesProvider,
|
||||
_referenceTileSize);
|
||||
|
||||
// If there's bound view, add new provider
|
||||
if (_mapRendererView != null)
|
||||
_mapRendererView.addSymbolsProvider(_obfMapSymbolsProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply current context to view
|
||||
*/
|
||||
private void apply() {
|
||||
if (_mapRendererView instanceof AtlasMapRendererView)
|
||||
((AtlasMapRendererView)_mapRendererView).setReferenceTileSizeOnScreenInPixels(_referenceTileSize);
|
||||
|
||||
// Layers
|
||||
if (_obfMapRasterLayer != null && _obfMapRasterLayerProvider != null)
|
||||
_mapRendererView.setMapLayerProvider(_obfMapRasterLayer, _obfMapRasterLayerProvider);
|
||||
|
||||
// Symbols
|
||||
if (_obfMapSymbolsProvider != null)
|
||||
_mapRendererView.addSymbolsProvider(_obfMapSymbolsProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup OBF map on layer 0 with symbols
|
||||
* @param obfsCollection OBFs collection
|
||||
*/
|
||||
public void setupObfMap(ResolvedMapStyle mapStyle, IObfsCollection obfsCollection) {
|
||||
setupObfMap(mapStyle, obfsCollection, 0, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup OBF map on specified layer with optional symbols
|
||||
* @param obfsCollection OBFs collection
|
||||
* @param layer Layer index
|
||||
* @param withSymbols True if with symbols, false otherwise
|
||||
*/
|
||||
public void setupObfMap(ResolvedMapStyle mapStyle,
|
||||
IObfsCollection obfsCollection,
|
||||
int layer,
|
||||
boolean withSymbols) {
|
||||
synchronized (_syncObject) {
|
||||
boolean update = false;
|
||||
|
||||
if (_mapStyle != mapStyle) {
|
||||
_mapStyle = mapStyle;
|
||||
update = true;
|
||||
}
|
||||
|
||||
if (_obfsCollection != obfsCollection) {
|
||||
_obfsCollection = obfsCollection;
|
||||
update = true;
|
||||
}
|
||||
|
||||
if (_obfMapRasterLayer == null || _obfMapRasterLayer != layer) {
|
||||
_obfMapRasterLayer = layer;
|
||||
update = true;
|
||||
}
|
||||
|
||||
if (withSymbols != (_obfMapSymbolsProvider != null)) {
|
||||
update = true;
|
||||
}
|
||||
|
||||
if (!update)
|
||||
return;
|
||||
|
||||
updateMapPresentationEnvironment();
|
||||
updateMapPrimitiviser();
|
||||
updateMapPrimitivesProvider();
|
||||
updateObfMapObjectsProvider();
|
||||
updateObfMapRasterLayerProvider();
|
||||
updateObfMapSymbolsProvider();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -42,9 +42,8 @@ public class CurrentPositionHelper {
|
|||
ctx = new RoutePlannerFrontEnd(false).buildRoutingContext(cfg, null, app.getResourceManager().getRoutingMapFiles());
|
||||
}
|
||||
|
||||
public synchronized RouteDataObject runUpdateInThread(double lat , double lon) {
|
||||
public synchronized RouteDataObject runUpdateInThread(double lat, double lon) throws IOException {
|
||||
RoutePlannerFrontEnd rp = new RoutePlannerFrontEnd(false);
|
||||
try {
|
||||
if (ctx == null || am != app.getSettings().getApplicationMode()) {
|
||||
initCtx(app);
|
||||
if (ctx == null) {
|
||||
|
@ -56,21 +55,19 @@ public class CurrentPositionHelper {
|
|||
return null;
|
||||
}
|
||||
return sg.getRoad();
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void scheduleRouteSegmentFind(final Location loc){
|
||||
if(calculatingThread == Thread.currentThread()) {
|
||||
lastFound = runUpdateInThread(loc.getLatitude(), loc.getLongitude());
|
||||
lastFound = runUpdateInThreadCatch(loc.getLatitude(), loc.getLongitude());
|
||||
} else if(calculatingThread == null && loc != null) {
|
||||
Runnable run = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
lastFound = runUpdateInThread(loc.getLatitude(), loc.getLongitude());
|
||||
lastFound = runUpdateInThreadCatch(loc.getLatitude(), loc.getLongitude());
|
||||
if (lastAskedLocation != loc) {
|
||||
// refresh and run new task if needed
|
||||
getLastKnownRouteSegment(lastAskedLocation);
|
||||
|
@ -85,6 +82,15 @@ public class CurrentPositionHelper {
|
|||
|
||||
}
|
||||
|
||||
protected RouteDataObject runUpdateInThreadCatch(double latitude, double longitude) {
|
||||
try {
|
||||
return runUpdateInThread(latitude, longitude);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static double getOrthogonalDistance(RouteDataObject r, Location loc){
|
||||
double d = 1000;
|
||||
if (r.getPointsLength() > 0) {
|
||||
|
|
|
@ -21,7 +21,6 @@ import net.osmand.plus.helpers.WaypointHelper;
|
|||
import net.osmand.plus.routing.RouteCalculationResult;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import android.app.Activity;
|
||||
import android.view.Window;
|
||||
|
||||
public class OsmAndAppCustomization {
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ public class OsmAndLocationProvider implements SensorEventListener {
|
|||
}
|
||||
|
||||
public RouteDataObject findRoute(double lat , double lon) {
|
||||
return currentPositionHelper.runUpdateInThread(lat, lon);
|
||||
return currentPositionHelper.runUpdateInThreadCatch(lat, lon);
|
||||
}
|
||||
|
||||
public void resumeAllUpdates() {
|
||||
|
|
|
@ -33,7 +33,7 @@ import net.osmand.plus.render.RendererRegistry;
|
|||
import net.osmand.plus.resources.ResourceManager;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.sherpafy.SherpafyCustomization;
|
||||
import net.osmand.plus.views.corenative.NativeQtLibrary;
|
||||
import net.osmand.plus.views.corenative.NativeCoreContext;
|
||||
import net.osmand.plus.voice.CommandPlayer;
|
||||
import net.osmand.plus.voice.CommandPlayerException;
|
||||
import net.osmand.plus.voice.CommandPlayerFactory;
|
||||
|
@ -121,6 +121,8 @@ public class OsmandApplication extends Application {
|
|||
MapActivity mapActivity;
|
||||
DownloadActivity downloadActivity;
|
||||
|
||||
// Typeface
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
long timeToStart = System.currentTimeMillis();
|
||||
|
@ -558,7 +560,7 @@ public class OsmandApplication extends Application {
|
|||
if (osmandSettings.USE_NATIVE_RENDER.get()) {
|
||||
if (!osmandSettings.CPP_RENDER_FAILED.get()) {
|
||||
osmandSettings.CPP_RENDER_FAILED.set(true);
|
||||
boolean success = NativeQtLibrary.tryCatchInit(this);
|
||||
boolean success = NativeCoreContext.tryCatchInit(this);
|
||||
if (success) {
|
||||
osmandSettings.CPP_RENDER_FAILED.set(false);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
import net.osmand.access.AccessibleAlertBuilder;
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -42,6 +41,7 @@ import android.graphics.drawable.ColorDrawable;
|
|||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.format.DateFormat;
|
||||
|
@ -57,7 +57,6 @@ import com.actionbarsherlock.view.Menu;
|
|||
import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
/**
|
||||
* Created by Denis on 05.11.2014.
|
||||
*/
|
||||
public class DashboardActivity extends BaseDownloadActivity {
|
||||
public static final boolean TIPS_AND_TRICKS = false;
|
||||
|
@ -71,11 +70,11 @@ public class DashboardActivity extends BaseDownloadActivity {
|
|||
private static final String EXCEPTION_FILE_SIZE = "EXCEPTION_FS"; //$NON-NLS-1$
|
||||
|
||||
private static final String CONTRIBUTION_VERSION_FLAG = "CONTRIBUTION_VERSION_FLAG";
|
||||
private static final int HELP_ID = 0;
|
||||
private static final int SETTINGS_ID = 1;
|
||||
private static final int EXIT_ID = 2;
|
||||
private ProgressDialog startProgressDialog;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
getMyApplication().applyTheme(this);
|
||||
|
@ -156,25 +155,22 @@ public class DashboardActivity extends BaseDownloadActivity {
|
|||
android.support.v4.app.FragmentTransaction fragmentTransaction = manager.beginTransaction();
|
||||
//after rotation list of fragments in fragment transaction is not cleared
|
||||
//so we need to check whether some fragments are already existing
|
||||
if (manager.findFragmentByTag(DashSearchFragment.TAG) == null){
|
||||
DashSearchFragment searchFragment = new DashSearchFragment();
|
||||
fragmentTransaction.add(R.id.content, searchFragment, DashSearchFragment.TAG);
|
||||
}
|
||||
if (manager.findFragmentByTag(DashMapFragment.TAG) == null){
|
||||
DashMapFragment mapFragment = new DashMapFragment();
|
||||
fragmentTransaction.add(R.id.content, mapFragment, DashMapFragment.TAG);
|
||||
}
|
||||
|
||||
if (manager.findFragmentByTag(DashSearchFragment.TAG) == null){
|
||||
DashSearchFragment searchFragment = new DashSearchFragment();
|
||||
fragmentTransaction.add(R.id.content, searchFragment, DashSearchFragment.TAG);
|
||||
}
|
||||
if (manager.findFragmentByTag(DashFavoritesFragment.TAG) == null){
|
||||
DashFavoritesFragment favoritesFragment = new DashFavoritesFragment();
|
||||
fragmentTransaction.add(R.id.content, favoritesFragment, DashFavoritesFragment.TAG);
|
||||
}
|
||||
|
||||
if (manager.findFragmentByTag(DashUpdatesFragment.TAG) == null){
|
||||
DashUpdatesFragment updatesFragment = new DashUpdatesFragment();
|
||||
fragmentTransaction.add(R.id.content, updatesFragment, DashUpdatesFragment.TAG);
|
||||
}
|
||||
|
||||
if (manager.findFragmentByTag(DashPluginsFragment.TAG) == null){
|
||||
DashPluginsFragment pluginsFragment = new DashPluginsFragment();
|
||||
fragmentTransaction.add(R.id.content, pluginsFragment, DashPluginsFragment.TAG).commit();
|
||||
|
@ -282,6 +278,10 @@ public class DashboardActivity extends BaseDownloadActivity {
|
|||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
checkVectorIndexesDownloaded();
|
||||
// Do some action on close
|
||||
// FIXME uncomment
|
||||
// app.getResourceManager().getRenderer().clearCache();
|
||||
// mapView.refreshMap(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
@ -382,12 +382,12 @@ public class DashboardActivity extends BaseDownloadActivity {
|
|||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.add(0, 0, 0, R.string.tips_and_tricks).setIcon(R.drawable.ic_ac_help)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
menu.add(0, 1, 0, R.string.settings).setIcon(R.drawable.ic_ac_settings)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||
menu.add(0, 2, 0, R.string.exit_Button).setIcon(R.drawable.ic_ac_close)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
menu.add(0, HELP_ID, 0, R.string.tips_and_tricks).setIcon(R.drawable.ic_ac_help)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
menu.add(0, SETTINGS_ID, 0, R.string.settings).setIcon(R.drawable.ic_ac_settings)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
menu.add(0, EXIT_ID, 0, R.string.exit_Button).setIcon(R.drawable.ic_ac_close)
|
||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -400,7 +400,7 @@ public class DashboardActivity extends BaseDownloadActivity {
|
|||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||
if (item.getItemId() == 0) {
|
||||
if (item.getItemId() == HELP_ID) {
|
||||
if(TIPS_AND_TRICKS) {
|
||||
TipsAndTricksActivity activity = new TipsAndTricksActivity(this);
|
||||
Dialog dlg = activity.getDialogToShowTips(false, true);
|
||||
|
@ -409,10 +409,10 @@ public class DashboardActivity extends BaseDownloadActivity {
|
|||
final Intent helpIntent = new Intent(this, HelpActivity.class);
|
||||
startActivity(helpIntent);
|
||||
}
|
||||
} else if (item.getItemId() == 1){
|
||||
} else if (item.getItemId() == SETTINGS_ID){
|
||||
final Intent settings = new Intent(this, appCustomization.getSettingsActivity());
|
||||
startActivity(settings);
|
||||
} else if (item.getItemId() == 2){
|
||||
} else if (item.getItemId() == EXIT_ID){
|
||||
getMyApplication().closeApplication(this);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.osmand.access.AccessibilityPlugin;
|
|||
import net.osmand.access.AccessibleActivity;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.access.MapAccessibilityActions;
|
||||
import net.osmand.core.android.AtlasMapRendererView;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.QuadPoint;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
|
@ -46,7 +47,7 @@ import net.osmand.plus.views.OsmAndMapLayersView;
|
|||
import net.osmand.plus.views.OsmAndMapSurfaceView;
|
||||
import net.osmand.plus.views.OsmandMapLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.corenative.NativeQtLibrary;
|
||||
import net.osmand.plus.views.corenative.NativeCoreContext;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.app.Dialog;
|
||||
|
@ -91,7 +92,7 @@ public class MapActivity extends AccessibleActivity implements
|
|||
|
||||
/** Called when the activity is first created. */
|
||||
private OsmandMapTileView mapView;
|
||||
private GLSurfaceView glSurfaceView;
|
||||
private AtlasMapRendererView atlasMapRendererView;
|
||||
|
||||
private MapActivityActions mapActions;
|
||||
private MapActivityLayers mapLayers;
|
||||
|
@ -151,14 +152,16 @@ public class MapActivity extends AccessibleActivity implements
|
|||
app.checkApplicationIsBeingInitialized(this, startProgressDialog);
|
||||
parseLaunchIntentLocation();
|
||||
|
||||
if(settings.USE_NATIVE_RENDER.get() && NativeQtLibrary.isInit()) {
|
||||
ViewStub stub = (ViewStub) findViewById(R.id.glSurfaceStub);
|
||||
glSurfaceView = (GLSurfaceView) stub.inflate();
|
||||
if(settings.USE_NATIVE_RENDER.get() && NativeCoreContext.isInit()) {
|
||||
ViewStub stub = (ViewStub) findViewById(R.id.atlasMapRendererViewStub);
|
||||
atlasMapRendererView = (AtlasMapRendererView) stub.inflate();
|
||||
OsmAndMapLayersView ml = (OsmAndMapLayersView) findViewById(R.id.MapLayersView);
|
||||
ml.setVisibility(View.VISIBLE);
|
||||
NativeQtLibrary.initView(glSurfaceView);
|
||||
atlasMapRendererView.setAzimuth(0);
|
||||
atlasMapRendererView.setElevationAngle(90);
|
||||
NativeCoreContext.getMapRendererContext().setMapRendererView(atlasMapRendererView);
|
||||
mapView = ml.getMapView();
|
||||
mapView.setMapRender(NativeQtLibrary.getMapRenderer());
|
||||
mapView.setMapRender(atlasMapRendererView);
|
||||
} else {
|
||||
OsmAndMapSurfaceView surf = (OsmAndMapSurfaceView) findViewById(R.id.MapView);
|
||||
surf.setVisibility(View.VISIBLE);
|
||||
|
@ -442,8 +445,8 @@ public class MapActivity extends AccessibleActivity implements
|
|||
|
||||
OsmandPlugin.onMapActivityResume(this);
|
||||
mapView.refreshMap(true);
|
||||
if(glSurfaceView != null) {
|
||||
glSurfaceView.onResume();
|
||||
if(atlasMapRendererView != null) {
|
||||
atlasMapRendererView.handleOnResume();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -611,6 +614,9 @@ public class MapActivity extends AccessibleActivity implements
|
|||
mapViewTrackingUtilities.setMapView(null);
|
||||
cancelNotification();
|
||||
app.getResourceManager().getMapTileDownloader().removeDownloaderCallback(mapView);
|
||||
if(atlasMapRendererView != null) {
|
||||
atlasMapRendererView.handleOnDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelNotification() {
|
||||
|
@ -657,8 +663,8 @@ public class MapActivity extends AccessibleActivity implements
|
|||
app.getResourceManager().interruptRendering();
|
||||
app.getResourceManager().setBusyIndicator(null);
|
||||
OsmandPlugin.onMapActivityPause(this);
|
||||
if(glSurfaceView != null) {
|
||||
glSurfaceView.onPause();
|
||||
if(atlasMapRendererView != null) {
|
||||
atlasMapRendererView.handleOnPause();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
|
|||
getString(R.string.lang_hu),
|
||||
getString(R.string.lang_id) + incompleteSuffix,
|
||||
getString(R.string.lang_it),
|
||||
getString(R.string.lang_ja) + incompleteSuffix,
|
||||
getString(R.string.lang_ja),
|
||||
getString(R.string.lang_ko),
|
||||
getString(R.string.lang_lv),
|
||||
getString(R.string.lang_lt),
|
||||
|
@ -258,7 +258,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity {
|
|||
getString(R.string.lang_pt),
|
||||
getString(R.string.lang_ro),
|
||||
getString(R.string.lang_ru),
|
||||
getString(R.string.lang_sc) + incompleteSuffix,
|
||||
getString(R.string.lang_sc),
|
||||
getString(R.string.lang_sr) + incompleteSuffix,
|
||||
getString(R.string.lang_zh_CN) + incompleteSuffix,
|
||||
getString(R.string.lang_sk),
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
package net.osmand.plus.api.render;
|
||||
|
||||
|
||||
public interface Paint {
|
||||
public enum Style {
|
||||
FILL (0),
|
||||
STROKE (1),
|
||||
FILL_AND_STROKE (2);
|
||||
Style(int nativeInt) {
|
||||
this.nativeInt = nativeInt;
|
||||
}
|
||||
final int nativeInt;
|
||||
}
|
||||
|
||||
public enum Cap {
|
||||
BUTT (0),
|
||||
ROUND (1),
|
||||
SQUARE (2);
|
||||
private Cap(int nativeInt) {
|
||||
this.nativeInt = nativeInt;
|
||||
}
|
||||
final int nativeInt;
|
||||
}
|
||||
|
||||
public enum Join {
|
||||
MITER (0),
|
||||
ROUND (1),
|
||||
BEVEL (2);
|
||||
private Join(int nativeInt) {
|
||||
this.nativeInt = nativeInt;
|
||||
}
|
||||
final int nativeInt;
|
||||
}
|
||||
|
||||
public enum Align {
|
||||
LEFT (0),
|
||||
CENTER (1),
|
||||
RIGHT (2);
|
||||
private Align(int nativeInt) {
|
||||
this.nativeInt = nativeInt;
|
||||
}
|
||||
final int nativeInt;
|
||||
}
|
||||
|
||||
void setColor(int color);
|
||||
|
||||
int getColor();
|
||||
|
||||
void setTextAlign(Align align);
|
||||
|
||||
void setStrokeWidth(float width);
|
||||
|
||||
void setAntiAlias(boolean flag);
|
||||
|
||||
void setStyle(Style style);
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package net.osmand.plus.api.render;
|
||||
|
||||
public interface Path {
|
||||
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package net.osmand.plus.api.render;
|
||||
|
||||
public class Typeface {
|
||||
|
||||
}
|
|
@ -21,6 +21,7 @@ import net.osmand.plus.OsmAndFormatter;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -36,7 +37,7 @@ public class DashFavoritesFragment extends DashBaseFragment {
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_favorites_fragment, container, false);
|
||||
Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Medium.ttf");
|
||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||
((TextView) view.findViewById(R.id.fav_text)).setTypeface(typeface);
|
||||
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
|
||||
|
||||
|
|
|
@ -15,6 +15,9 @@ import net.osmand.map.MapTileDownloader.DownloadRequest;
|
|||
import net.osmand.map.MapTileDownloader.IMapDownloaderCallback;
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.MapActivityActions;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.plus.render.MapVectorLayer;
|
||||
import net.osmand.plus.resources.ResourceManager;
|
||||
import net.osmand.plus.views.MapTextLayer;
|
||||
|
@ -41,22 +44,25 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
|
|||
getMyApplication().getResourceManager().getMapTileDownloader().addDownloaderCallback(this);
|
||||
}
|
||||
|
||||
protected void startMapActivity() {
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_map_fragment, container, false);
|
||||
setupMapView(view);
|
||||
Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Medium.ttf");
|
||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||
((TextView) view.findViewById(R.id.map_text)).setTypeface(typeface);
|
||||
((Button) view.findViewById(R.id.show_map)).setTypeface(typeface);
|
||||
|
||||
(view.findViewById(R.id.show_map)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Activity activity = getActivity();
|
||||
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||
final Intent mapIndent = new Intent(activity, appCustomization.getMapActivity());
|
||||
activity.startActivityForResult(mapIndent, 0);
|
||||
startMapActivity();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
return view;
|
||||
|
@ -64,6 +70,13 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
|
|||
|
||||
private void setupMapView(View view){
|
||||
OsmAndMapSurfaceView surf = (OsmAndMapSurfaceView) view.findViewById(R.id.MapView);
|
||||
surf.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startMapActivity();
|
||||
}
|
||||
});
|
||||
osmandMapTileView = surf.getMapView();
|
||||
osmandMapTileView.getView().setVisibility(View.VISIBLE);
|
||||
osmandMapTileView.removeAllLayers();
|
||||
|
@ -75,10 +88,16 @@ public class DashMapFragment extends DashBaseFragment implements IMapDownloader
|
|||
osmandMapTileView.addLayer(mapVectorLayer, 0.5f);
|
||||
osmandMapTileView.setMainLayer(mapVectorLayer);
|
||||
mapVectorLayer.setVisible(true);
|
||||
osmandMapTileView.setShowMapPosition(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
LatLon lm = getMyApplication().getSettings().getLastKnownMapLocation();
|
||||
int zm = getMyApplication().getSettings().getLastKnownMapZoom();
|
||||
osmandMapTileView.setLatLon(lm.getLatitude(), lm.getLongitude());
|
||||
osmandMapTileView.setIntZoom(zm);
|
||||
osmandMapTileView.setComplexZoom(zm, osmandMapTileView.getSettingsZoomScale());
|
||||
osmandMapTileView.refreshMap(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -27,7 +28,7 @@ public class DashPluginsFragment extends DashBaseFragment {
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_plugins_fragment, container, false);
|
||||
Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Medium.ttf");
|
||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||
((TextView) view.findViewById(R.id.plugin_text)).setTypeface(typeface);
|
||||
((Button) view.findViewById(R.id.show_all)).setTypeface(typeface);
|
||||
view.findViewById(R.id.show_all).setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
|
||||
/**
|
||||
* Created by Denis on 24.11.2014.
|
||||
|
@ -25,7 +29,7 @@ public class DashSearchFragment extends DashBaseFragment {
|
|||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_search_fragment, container, false);
|
||||
setupButtons(view);
|
||||
Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Medium.ttf");
|
||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||
((TextView) view.findViewById(R.id.search_for)).setTypeface(typeface);
|
||||
return view;
|
||||
}
|
||||
|
@ -39,6 +43,8 @@ public class DashSearchFragment extends DashBaseFragment {
|
|||
private void setupButtons(View view){
|
||||
final Activity activity = getActivity();
|
||||
final OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||
// EditText searchText = (EditText) view.findViewById(R.id.search_text);
|
||||
// searchText.addTextChangedListener(textWatcher);
|
||||
(view.findViewById(R.id.poi)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.LinkedHashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.osmand.core.android.GLActivity;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.SettingsBaseActivity;
|
||||
|
@ -45,19 +44,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
|
|||
cat.addPreference(createCheckBoxPreference(settings.USE_NATIVE_RENDER, R.string.use_native_render,R.string.use_native_render_descr));
|
||||
|
||||
Preference pref = new Preference(this);
|
||||
pref.setTitle(R.string.test_native_render);
|
||||
pref.setSummary(R.string.test_native_render_msg);
|
||||
pref.setKey("test_native_render");
|
||||
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
startActivity(new Intent(SettingsDevelopmentActivity.this, GLActivity.class));
|
||||
return true;
|
||||
}
|
||||
});
|
||||
cat.addPreference(pref);
|
||||
|
||||
pref = new Preference(this);
|
||||
pref.setTitle(R.string.test_voice_prompts);
|
||||
pref.setSummary(R.string.play_commands_of_currently_selected_voice);
|
||||
pref.setKey("test_voice_commands");
|
||||
|
|
|
@ -27,6 +27,7 @@ import android.widget.ArrayAdapter;
|
|||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class AvoidSpecificRoads {
|
||||
private List<RouteDataObject> missingRoads;
|
||||
|
@ -143,14 +144,23 @@ public class AvoidSpecificRoads {
|
|||
}
|
||||
private void findRoad(final MapActivity activity, final LatLon loc) {
|
||||
new AsyncTask<LatLon, Void, RouteDataObject>() {
|
||||
Exception e = null;
|
||||
|
||||
@Override
|
||||
protected RouteDataObject doInBackground(LatLon... params) {
|
||||
try {
|
||||
return app.getLocationProvider().findRoute(loc.getLatitude(), loc.getLongitude());
|
||||
} catch (Exception e) {
|
||||
this.e = e;
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void onPostExecute(RouteDataObject result) {
|
||||
if(result != null) {
|
||||
if(e != null) {
|
||||
Toast.makeText(activity, R.string.error_avoid_specific_road, Toast.LENGTH_LONG).show();
|
||||
} else if(result != null) {
|
||||
getBuilder().addImpassableRoad(result);
|
||||
RoutingHelper rh = app.getRoutingHelper();
|
||||
if(rh.isRouteCalculated() || rh.isRouteBeingCalculated()) {
|
||||
|
|
27
OsmAnd/src/net/osmand/plus/helpers/FontCache.java
Normal file
27
OsmAnd/src/net/osmand/plus/helpers/FontCache.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
package net.osmand.plus.helpers;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Typeface;
|
||||
|
||||
public class FontCache {
|
||||
private static Map<String, Typeface> fontMap = new ConcurrentHashMap<String, Typeface>();
|
||||
public static final String ROBOTO_MEDIUM = "fonts/Roboto-Medium.ttf";
|
||||
public static final String ROBOTO_REGULAR = "fonts/Roboto-Regular.ttf";
|
||||
|
||||
public static Typeface getRobotoMedium(Context context) {
|
||||
return getFont(context, ROBOTO_MEDIUM);
|
||||
}
|
||||
|
||||
public static Typeface getFont(Context context, String fontName) {
|
||||
if (fontMap.containsKey(fontName)) {
|
||||
return fontMap.get(fontName);
|
||||
} else {
|
||||
Typeface tf = Typeface.createFromAsset(context.getAssets(), fontName);
|
||||
fontMap.put(fontName, tf);
|
||||
return tf;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -614,15 +614,15 @@ public class MapRenderRepositories {
|
|||
// calculate data box
|
||||
QuadRect dataBox = requestedBox.getLatLonBounds();
|
||||
long now = System.currentTimeMillis();
|
||||
if (cObjectsBox.left > dataBox.left || cObjectsBox.top > dataBox.top || cObjectsBox.right < dataBox.right
|
||||
|| cObjectsBox.bottom < dataBox.bottom || (nativeLib != null) == (cNativeObjects == null)) {
|
||||
if (cObjectsBox.left > dataBox.left || cObjectsBox.top < dataBox.top || cObjectsBox.right < dataBox.right
|
||||
|| cObjectsBox.bottom > dataBox.bottom || (nativeLib != null) == (cNativeObjects == null)) {
|
||||
// increase data box in order for rotate
|
||||
if ((dataBox.right - dataBox.left) > (dataBox.top - dataBox.bottom)) {
|
||||
double wi = (dataBox.right - dataBox.left) * .2;
|
||||
double wi = (dataBox.right - dataBox.left) * .05;
|
||||
dataBox.left -= wi;
|
||||
dataBox.right += wi;
|
||||
} else {
|
||||
double hi = (dataBox.top - dataBox.bottom) * .2;
|
||||
double hi = (dataBox.top - dataBox.bottom) * .05;
|
||||
dataBox.top += hi;
|
||||
dataBox.bottom -= hi;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.render;
|
||||
|
||||
import net.osmand.core.android.MapRendererView;
|
||||
import net.osmand.core.jni.IMapRenderer;
|
||||
import net.osmand.core.jni.PointI;
|
||||
import net.osmand.data.QuadPointDouble;
|
||||
|
@ -89,7 +90,7 @@ public class MapVectorLayer extends BaseMapLayer {
|
|||
tileLayer.drawTileMap(canvas, tilesRect);
|
||||
resourceManager.getRenderer().interruptLoadingMap();
|
||||
} else {
|
||||
final IMapRenderer mapRenderer = view.getMapRenderer();
|
||||
final MapRendererView mapRenderer = view.getMapRenderer();
|
||||
if (mapRenderer != null) {
|
||||
// opengl renderer
|
||||
mapRenderer.setTarget(new PointI(tilesRect.getCenter31X(), tilesRect.getCenter31Y()));
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.graphics.Canvas;
|
|||
import android.util.AttributeSet;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.View;
|
||||
|
||||
public class OsmAndMapLayersView extends View {
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.view.SurfaceView;
|
|||
public class OsmAndMapSurfaceView extends SurfaceView implements Callback {
|
||||
|
||||
private OsmandMapTileView mapView;
|
||||
private OnClickListener onClickListener;
|
||||
|
||||
public OsmAndMapSurfaceView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
@ -52,6 +53,11 @@ public class OsmAndMapSurfaceView extends SurfaceView implements Callback {
|
|||
return r;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnClickListener(OnClickListener l) {
|
||||
super.setOnClickListener(l);
|
||||
this.onClickListener = l;
|
||||
}
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
Boolean r = mapView.onKeyDown(keyCode, event);
|
||||
|
@ -63,6 +69,9 @@ public class OsmAndMapSurfaceView extends SurfaceView implements Callback {
|
|||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if(onClickListener != null) {
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
return mapView.onTouchEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.osmand.PlatformUtil;
|
|||
import net.osmand.access.AccessibilityActionsProvider;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.access.MapExplorer;
|
||||
import net.osmand.core.jni.IMapRenderer;
|
||||
import net.osmand.core.android.MapRendererView;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.QuadPoint;
|
||||
import net.osmand.data.QuadPointDouble;
|
||||
|
@ -30,6 +30,7 @@ import net.osmand.util.MapUtils;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
|
@ -146,7 +147,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
|
||||
private DisplayMetrics dm;
|
||||
|
||||
private IMapRenderer mapRenderer;
|
||||
private MapRendererView mapRenderer;
|
||||
|
||||
private OsmandApplication application;
|
||||
|
||||
|
@ -514,6 +515,7 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
return additional.fps;
|
||||
}
|
||||
|
||||
@SuppressLint("WrongCall")
|
||||
public void drawOverMap(Canvas canvas, RotatedTileBox tileBox, DrawSettings drawSettings) {
|
||||
if(mapRenderer == null) {
|
||||
fillCanvas(canvas, drawSettings);
|
||||
|
@ -736,11 +738,11 @@ public class OsmandMapTileView implements IMapDownloaderCallback {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void setMapRender(IMapRenderer mapRenderer) {
|
||||
public void setMapRender(MapRendererView mapRenderer) {
|
||||
this.mapRenderer = mapRenderer;
|
||||
}
|
||||
|
||||
public IMapRenderer getMapRenderer() {
|
||||
public MapRendererView getMapRenderer() {
|
||||
return mapRenderer;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
package net.osmand.plus.views.corenative;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
import net.osmand.core.android.CoreResourcesFromAndroidAssetsCustom;
|
||||
import net.osmand.core.android.MapRendererContext;
|
||||
import net.osmand.core.android.NativeCore;
|
||||
import net.osmand.core.jni.Logger;
|
||||
import net.osmand.core.jni.MapStylesCollection;
|
||||
import net.osmand.core.jni.ObfsCollection;
|
||||
import net.osmand.core.jni.QIODeviceLogSink;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
||||
/**
|
||||
* Created by Denis on 01.10.2014.
|
||||
*/
|
||||
public class NativeCoreContext {
|
||||
private static final String TAG = "NativeCoreContext";
|
||||
|
||||
private static boolean init;
|
||||
|
||||
public static boolean isInit() {
|
||||
return init;
|
||||
}
|
||||
|
||||
public static boolean tryCatchInit(OsmandApplication app) {
|
||||
try {
|
||||
init(app);
|
||||
return true;
|
||||
} catch(Throwable t) {
|
||||
t.printStackTrace();
|
||||
Log.e(TAG, "Failed to initialize", t);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void init(OsmandApplication app) {
|
||||
if (!init && NativeCore.isAvailable()) {
|
||||
if (!NativeCore.isLoaded())
|
||||
NativeCore.load(CoreResourcesFromAndroidAssetsCustom.loadFromCurrentApplication(app));
|
||||
if (NativeCore.isLoaded()) {
|
||||
|
||||
File directory = app.getAppPath("");
|
||||
Logger.get().addLogSink(QIODeviceLogSink.createFileLogSink(
|
||||
directory.getAbsolutePath() + "osmandcore.log"));
|
||||
|
||||
WindowManager mgr = (WindowManager)app.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
mgr.getDefaultDisplay().getMetrics(dm);
|
||||
|
||||
// Get device display density factor
|
||||
// DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
// act.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
DisplayMetrics displayMetrics = app.getResources().getDisplayMetrics();
|
||||
// TODO getSettings().getSettingsZoomScale() + Math.sqrt(Math.max(0, getDensity() - 1))
|
||||
float scaleCoefficient = displayMetrics.density;
|
||||
if (Math.min(dm.widthPixels / (dm.density * 160), dm.heightPixels / (dm.density * 160)) > 2.5f) {
|
||||
// large screen
|
||||
scaleCoefficient *= 1.5f;
|
||||
}
|
||||
float displayDensityFactor = scaleCoefficient;
|
||||
|
||||
_obfsCollection = new ObfsCollection();
|
||||
_obfsCollection.addDirectory(directory.getAbsolutePath(), false);
|
||||
|
||||
_mapStylesCollection = new MapStylesCollection();
|
||||
|
||||
_mapRendererContext = new MapRendererContext();
|
||||
_mapRendererContext.setDisplayDensityFactor(displayDensityFactor);
|
||||
_mapRendererContext.setupObfMap(
|
||||
_mapStylesCollection.getResolvedStyleByName("default"),
|
||||
_obfsCollection);
|
||||
|
||||
init = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static MapStylesCollection _mapStylesCollection;
|
||||
|
||||
private static ObfsCollection _obfsCollection;
|
||||
|
||||
private static MapRendererContext _mapRendererContext;
|
||||
|
||||
public static MapRendererContext getMapRendererContext() {
|
||||
return _mapRendererContext;
|
||||
}
|
||||
}
|
|
@ -1,329 +0,0 @@
|
|||
package net.osmand.plus.views.corenative;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.egl.EGLContext;
|
||||
import javax.microedition.khronos.egl.EGLDisplay;
|
||||
import javax.microedition.khronos.egl.EGLSurface;
|
||||
|
||||
import net.osmand.core.android.CoreResourcesFromAndroidAssetsCustom;
|
||||
import net.osmand.core.jni.AtlasMapRendererConfiguration;
|
||||
import net.osmand.core.jni.ObfMapObjectsProvider;
|
||||
import net.osmand.core.jni.MapPrimitivesProvider;
|
||||
import net.osmand.core.jni.MapRasterLayerProvider_Software;
|
||||
import net.osmand.core.jni.MapObjectsSymbolsProvider;
|
||||
import net.osmand.core.jni.IMapRenderer;
|
||||
import net.osmand.core.jni.Logger;
|
||||
import net.osmand.core.jni.MapPresentationEnvironment;
|
||||
import net.osmand.core.jni.MapRendererClass;
|
||||
import net.osmand.core.jni.MapRendererSetupOptions;
|
||||
import net.osmand.core.jni.MapStylesCollection;
|
||||
import net.osmand.core.jni.ObfsCollection;
|
||||
import net.osmand.core.jni.OnlineRasterMapLayerProvider;
|
||||
import net.osmand.core.jni.OnlineTileSources;
|
||||
import net.osmand.core.jni.OsmAndCore;
|
||||
import net.osmand.core.jni.MapPrimitiviser;
|
||||
import net.osmand.core.jni.QIODeviceLogSink;
|
||||
import net.osmand.core.jni.ResolvedMapStyle;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.render.NativeCppLibrary;
|
||||
import android.content.Context;
|
||||
import android.opengl.EGL14;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
|
||||
/**
|
||||
* Created by Denis on 01.10.2014.
|
||||
*/
|
||||
public class NativeQtLibrary {
|
||||
|
||||
private static boolean OFFLINE_MAP = true;
|
||||
private static IMapRenderer mapRenderer;
|
||||
public static final String NATIVE_TAG = "NativeRender";
|
||||
|
||||
private static List<Object> doNotGc = new ArrayList<Object>();
|
||||
private static boolean init;
|
||||
|
||||
|
||||
private static <T> T notGc(T obj){
|
||||
doNotGc.add(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
private static <T> T notGcFor1Egl(T obj){
|
||||
doNotGc.add(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
public static void initView(GLSurfaceView glSurfaceView) {
|
||||
System.out.println("Init GL View");
|
||||
//TODO:_glSurfaceView.setPreserveEGLContextOnPause(true);
|
||||
glSurfaceView.setEGLContextClientVersion(2);
|
||||
glSurfaceView.setEGLContextFactory(new EGLContextFactory(glSurfaceView));
|
||||
glSurfaceView.setRenderer(new NativeRenderer(mapRenderer));
|
||||
glSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
|
||||
mapRenderer.setAzimuth(0.0f);
|
||||
mapRenderer.setElevationAngle(90);
|
||||
}
|
||||
|
||||
public static IMapRenderer getMapRenderer() {
|
||||
return mapRenderer;
|
||||
}
|
||||
|
||||
public static boolean isInit() {
|
||||
return init;
|
||||
}
|
||||
|
||||
public static boolean tryCatchInit(OsmandApplication app) {
|
||||
try {
|
||||
init(app);
|
||||
return true;
|
||||
} catch(Throwable t) {
|
||||
t.printStackTrace();
|
||||
Log.e(NATIVE_TAG, "Failed to initialize");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void init(OsmandApplication app) {
|
||||
if (!init) {
|
||||
loadLibraries();
|
||||
initRenderer(app);
|
||||
init = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadLibraries() {
|
||||
NativeCppLibrary.loadLibrary("gnustl_shared");
|
||||
NativeCppLibrary.loadLibrary("Qt5Core");
|
||||
NativeCppLibrary.loadLibrary("Qt5Network");
|
||||
NativeCppLibrary.loadLibrary("Qt5Sql");
|
||||
NativeCppLibrary.loadLibrary("OsmAndCoreWithJNI");
|
||||
}
|
||||
|
||||
private static void initRenderer(OsmandApplication app) {
|
||||
WindowManager mgr = (WindowManager)app.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
mgr.getDefaultDisplay().getMetrics(dm);
|
||||
|
||||
// Get device display density factor
|
||||
// DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
// act.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
DisplayMetrics displayMetrics = app.getResources().getDisplayMetrics();
|
||||
// TODO getSettings().getSettingsZoomScale() + Math.sqrt(Math.max(0, getDensity() - 1))
|
||||
float scaleCoefficient = displayMetrics.density;
|
||||
if (Math.min(dm.widthPixels / (dm.density * 160), dm.heightPixels / (dm.density * 160)) > 2.5f) {
|
||||
// large screen
|
||||
scaleCoefficient *= 1.5f;
|
||||
}
|
||||
float displayDensityFactor = scaleCoefficient;
|
||||
int referenceTileSize = (int)(256 * displayDensityFactor);
|
||||
int rasterTileSize = Integer.highestOneBit(referenceTileSize - 1) * 2;
|
||||
Log.i(NATIVE_TAG, "displayDensityFactor = " + displayDensityFactor +
|
||||
" referenceTileSize = " + referenceTileSize + " rasterTileSize = " + rasterTileSize);
|
||||
Log.i(NATIVE_TAG, "Initializing core...");
|
||||
CoreResourcesFromAndroidAssetsCustom coreResources = notGc(CoreResourcesFromAndroidAssetsCustom.loadFromCurrentApplication(app));
|
||||
OsmAndCore.InitializeCore(coreResources.instantiateProxy());
|
||||
|
||||
// initialize log
|
||||
File directory = app.getAppPath("");
|
||||
QIODeviceLogSink fileLogSink =
|
||||
notGc(QIODeviceLogSink.createFileLogSink(directory.getAbsolutePath() + "osmandcore.log"));
|
||||
Logger.get().addLogSink(fileLogSink);
|
||||
|
||||
Log.i(NATIVE_TAG, "Going to resolve default embedded style...");
|
||||
MapStylesCollection mapStylesCollection = notGc(new MapStylesCollection());
|
||||
ResolvedMapStyle mapStyle = mapStylesCollection.getResolvedStyleByName("default");
|
||||
if (mapStyle == null) {
|
||||
throw new IllegalStateException("Failed to resolve style 'default'");
|
||||
|
||||
}
|
||||
Log.i(NATIVE_TAG, "Will load OBFs from " + directory.getAbsolutePath());
|
||||
ObfsCollection obfsCollection = notGc(new ObfsCollection());
|
||||
obfsCollection.addDirectory(directory.getAbsolutePath(), false);
|
||||
|
||||
Log.i(NATIVE_TAG, "Going to prepare all resources for renderer");
|
||||
Log.i(NATIVE_TAG, "Going to create renderer");
|
||||
mapRenderer = OsmAndCore.createMapRenderer(MapRendererClass.AtlasMapRenderer_OpenGLES2);
|
||||
if (mapRenderer == null) {
|
||||
throw new IllegalArgumentException("Failed to create map renderer 'AtlasMapRenderer_OpenGLES2'");
|
||||
}
|
||||
|
||||
AtlasMapRendererConfiguration atlasRendererConfiguration = AtlasMapRendererConfiguration.Casts.upcastFrom(mapRenderer.getConfiguration());
|
||||
atlasRendererConfiguration.setReferenceTileSizeOnScreenInPixels(referenceTileSize);
|
||||
mapRenderer.setConfiguration(AtlasMapRendererConfiguration.Casts.downcastTo_MapRendererConfiguration(atlasRendererConfiguration));
|
||||
|
||||
if (OFFLINE_MAP){
|
||||
MapPresentationEnvironment presentation = notGc(new MapPresentationEnvironment(mapStyle, displayDensityFactor, "en"));
|
||||
//TODO: here should be current locale
|
||||
//mapPresentationEnvironment->setSettings(configuration.styleSettings);
|
||||
MapPrimitivesProvider mapPrimitivesProvider = notGc(new MapPrimitivesProvider(
|
||||
notGc(new ObfMapObjectsProvider(obfsCollection)),
|
||||
notGc(new MapPrimitiviser(presentation)), rasterTileSize));
|
||||
MapRasterLayerProvider_Software mapRasterLayerProvider = notGc(new MapRasterLayerProvider_Software(
|
||||
mapPrimitivesProvider));
|
||||
mapRenderer.setMapLayerProvider(0, mapRasterLayerProvider);
|
||||
MapObjectsSymbolsProvider mapObjectsSymbolsProvider = notGc(new MapObjectsSymbolsProvider(
|
||||
mapPrimitivesProvider, rasterTileSize));
|
||||
mapRenderer.addSymbolsProvider(mapObjectsSymbolsProvider);
|
||||
} else {
|
||||
OnlineRasterMapLayerProvider onlineMapRasterLayerProvider = notGc(OnlineTileSources.getBuiltIn()
|
||||
.createProviderFor("Mapnik (OsmAnd)"));
|
||||
mapRenderer.setMapLayerProvider(0, onlineMapRasterLayerProvider);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static class EGLContextFactory implements GLSurfaceView.EGLContextFactory {
|
||||
private EGLContext gpuWorkerContext;
|
||||
private EGLSurface gpuWorkerFakeSurface;
|
||||
private GLSurfaceView glSurfaceView;
|
||||
|
||||
public EGLContextFactory(GLSurfaceView glSurfaceView) {
|
||||
this.glSurfaceView = glSurfaceView;
|
||||
}
|
||||
|
||||
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
|
||||
final String eglExtensions = egl.eglQueryString(display, EGL10.EGL_EXTENSIONS);
|
||||
Log.i(NATIVE_TAG, "EGL extensions: " + eglExtensions);
|
||||
final String eglVersion = egl.eglQueryString(display, EGL10.EGL_VERSION);
|
||||
Log.i(NATIVE_TAG, "EGL version: " + eglVersion);
|
||||
|
||||
Log.i(NATIVE_TAG, "Creating main context...");
|
||||
final int[] contextAttribList = { EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
|
||||
|
||||
EGLContext mainContext = null;
|
||||
try {
|
||||
mainContext = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, contextAttribList);
|
||||
} catch (Exception e) {
|
||||
Log.e(NATIVE_TAG, "Failed to create main context", e);
|
||||
}
|
||||
if (mainContext == null || mainContext == EGL10.EGL_NO_CONTEXT) {
|
||||
Log.e(NATIVE_TAG, "Failed to create main context: " + egl.eglGetError());
|
||||
mainContext = null;
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
Log.i(NATIVE_TAG, "Creating GPU worker context...");
|
||||
try {
|
||||
gpuWorkerContext = egl.eglCreateContext(display, eglConfig, mainContext, contextAttribList);
|
||||
} catch (Exception e) {
|
||||
Log.e(NATIVE_TAG, "Failed to create GPU worker context", e);
|
||||
}
|
||||
if (gpuWorkerContext == null || gpuWorkerContext == EGL10.EGL_NO_CONTEXT) {
|
||||
Log.e(NATIVE_TAG, "Failed to create GPU worker context: " + egl.eglGetError());
|
||||
gpuWorkerContext = null;
|
||||
}
|
||||
|
||||
if (gpuWorkerContext != null) {
|
||||
Log.i(NATIVE_TAG, "Creating GPU worker fake surface...");
|
||||
try {
|
||||
final int[] surfaceAttribList = { EGL10.EGL_WIDTH, 1, EGL10.EGL_HEIGHT, 1, EGL10.EGL_NONE };
|
||||
gpuWorkerFakeSurface = egl.eglCreatePbufferSurface(display, eglConfig, surfaceAttribList);
|
||||
} catch (Exception e) {
|
||||
Log.e(NATIVE_TAG, "Failed to create GPU worker fake surface", e);
|
||||
}
|
||||
if (gpuWorkerFakeSurface == null || gpuWorkerFakeSurface == EGL10.EGL_NO_SURFACE) {
|
||||
Log.e(NATIVE_TAG, "Failed to create GPU worker fake surface: " + egl.eglGetError());
|
||||
gpuWorkerFakeSurface = null;
|
||||
}
|
||||
}
|
||||
|
||||
MapRendererSetupOptions rendererSetupOptions = notGcFor1Egl(new MapRendererSetupOptions());
|
||||
if (gpuWorkerContext != null && gpuWorkerFakeSurface != null) {
|
||||
rendererSetupOptions.setGpuWorkerThreadEnabled(true);
|
||||
GpuWorkerThreadPrologue gpuWorkerThreadPrologue = notGcFor1Egl(new GpuWorkerThreadPrologue(egl,
|
||||
display, gpuWorkerContext, gpuWorkerFakeSurface));
|
||||
rendererSetupOptions.setGpuWorkerThreadPrologue(gpuWorkerThreadPrologue.getBinding());
|
||||
GpuWorkerThreadEpilogue gpuWorkerThreadEpilogue = notGcFor1Egl(new GpuWorkerThreadEpilogue(egl));
|
||||
rendererSetupOptions.setGpuWorkerThreadEpilogue(gpuWorkerThreadEpilogue.getBinding());
|
||||
} else {
|
||||
rendererSetupOptions.setGpuWorkerThreadEnabled(false);
|
||||
}
|
||||
RenderRequestCallback renderRequestCallback = notGcFor1Egl(new RenderRequestCallback(glSurfaceView));
|
||||
rendererSetupOptions.setFrameUpdateRequestCallback(renderRequestCallback.getBinding());
|
||||
mapRenderer.setup(rendererSetupOptions);
|
||||
|
||||
return mainContext;
|
||||
}
|
||||
|
||||
public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
|
||||
egl.eglDestroyContext(display, context);
|
||||
|
||||
if (gpuWorkerContext != null) {
|
||||
egl.eglDestroyContext(display, gpuWorkerContext);
|
||||
gpuWorkerContext = null;
|
||||
}
|
||||
|
||||
if (gpuWorkerFakeSurface != null) {
|
||||
egl.eglDestroySurface(display, gpuWorkerFakeSurface);
|
||||
gpuWorkerFakeSurface = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class GpuWorkerThreadEpilogue extends MapRendererSetupOptions.IGpuWorkerThreadEpilogue {
|
||||
public GpuWorkerThreadEpilogue(EGL10 egl) {
|
||||
_egl = egl;
|
||||
}
|
||||
|
||||
private final EGL10 _egl;
|
||||
|
||||
@Override
|
||||
public void method(IMapRenderer mapRenderer) {
|
||||
try {
|
||||
if (!_egl.eglWaitGL())
|
||||
Log.e(NATIVE_TAG, "Failed to wait for GPU worker context: " + _egl.eglGetError());
|
||||
} catch (Exception e) {
|
||||
Log.e(NATIVE_TAG, "Failed to wait for GPU worker context", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class GpuWorkerThreadPrologue extends MapRendererSetupOptions.IGpuWorkerThreadPrologue {
|
||||
public GpuWorkerThreadPrologue(EGL10 egl, EGLDisplay eglDisplay, EGLContext context, EGLSurface surface) {
|
||||
_egl = egl;
|
||||
_eglDisplay = eglDisplay;
|
||||
_context = context;
|
||||
_eglSurface = surface;
|
||||
}
|
||||
|
||||
private final EGL10 _egl;
|
||||
private final EGLDisplay _eglDisplay;
|
||||
private final EGLContext _context;
|
||||
private final EGLSurface _eglSurface;
|
||||
|
||||
@Override
|
||||
public void method(IMapRenderer mapRenderer) {
|
||||
try {
|
||||
if (!_egl.eglMakeCurrent(_eglDisplay, _eglSurface, _eglSurface, _context))
|
||||
Log.e(NATIVE_TAG, "Failed to set GPU worker context active: " + _egl.eglGetError());
|
||||
} catch (Exception e) {
|
||||
Log.e(NATIVE_TAG, "Failed to set GPU worker context active", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class RenderRequestCallback extends MapRendererSetupOptions.IFrameUpdateRequestCallback {
|
||||
private GLSurfaceView glSurfaceView;
|
||||
|
||||
public RenderRequestCallback(GLSurfaceView glSurfaceView) {
|
||||
this.glSurfaceView = glSurfaceView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void method(IMapRenderer mapRenderer) {
|
||||
glSurfaceView.requestRender();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package net.osmand.plus.views.corenative;
|
||||
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.util.Log;
|
||||
import net.osmand.core.jni.AreaI;
|
||||
import net.osmand.core.jni.IMapRenderer;
|
||||
import net.osmand.core.jni.PointI;
|
||||
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
/**
|
||||
* Created by Denis on 01.10.2014.
|
||||
*/
|
||||
public class NativeRenderer implements GLSurfaceView.Renderer {
|
||||
private IMapRenderer mapRenderer;
|
||||
|
||||
|
||||
public NativeRenderer(IMapRenderer mapRenderer){
|
||||
this.mapRenderer = mapRenderer;
|
||||
}
|
||||
|
||||
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
|
||||
Log.i(NativeQtLibrary.NATIVE_TAG, "onSurfaceCreated");
|
||||
if (mapRenderer.isRenderingInitialized())
|
||||
mapRenderer.releaseRendering();
|
||||
}
|
||||
|
||||
public void onSurfaceChanged(GL10 gl, int width, int height) {
|
||||
Log.i(NativeQtLibrary.NATIVE_TAG, "onSurfaceChanged");
|
||||
mapRenderer.setViewport(new AreaI(0, 0, height, width));
|
||||
mapRenderer.setWindowSize(new PointI(width, height));
|
||||
|
||||
if (!mapRenderer.isRenderingInitialized())
|
||||
{
|
||||
if (!mapRenderer.initializeRendering())
|
||||
Log.e(NativeQtLibrary.NATIVE_TAG, "Failed to initialize rendering");
|
||||
}
|
||||
}
|
||||
|
||||
public void onDrawFrame(GL10 gl) {
|
||||
mapRenderer.update();
|
||||
if (mapRenderer.prepareFrame())
|
||||
mapRenderer.renderFrame();
|
||||
gl.glFlush();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue