1 | /** |
1 | /** |
2 | * ZANavi, Zoff Android Navigation system. |
2 | * ZANavi, Zoff Android Navigation system. |
3 | * Copyright (C) 2011 - 2014 Zoff <zoff@zoff.cc> |
3 | * Copyright (C) 2011 - 2015 Zoff <zoff@zoff.cc> |
4 | * |
4 | * |
5 | * This program is free software; you can redistribute it and/or |
5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU General Public License |
6 | * modify it under the terms of the GNU General Public License |
7 | * version 2 as published by the Free Software Foundation. |
7 | * version 2 as published by the Free Software Foundation. |
8 | * |
8 | * |
… | |
… | |
36 | * Boston, MA 02110-1301, USA. |
36 | * Boston, MA 02110-1301, USA. |
37 | */ |
37 | */ |
38 | |
38 | |
39 | package com.zoffcc.applications.zanavi; |
39 | package com.zoffcc.applications.zanavi; |
40 | |
40 | |
|
|
41 | import java.io.File; |
41 | import java.io.IOException; |
42 | import java.io.IOException; |
42 | import java.io.InputStream; |
43 | import java.io.InputStream; |
43 | import java.util.ArrayList; |
44 | import java.util.ArrayList; |
|
|
45 | import java.util.List; |
44 | import java.util.concurrent.LinkedBlockingQueue; |
46 | import java.util.concurrent.LinkedBlockingQueue; |
45 | |
47 | |
46 | import android.annotation.SuppressLint; |
48 | import android.annotation.SuppressLint; |
|
|
49 | import android.content.Intent; |
|
|
50 | import android.content.pm.PackageManager; |
|
|
51 | import android.content.pm.ResolveInfo; |
47 | import android.graphics.Bitmap; |
52 | import android.graphics.Bitmap; |
48 | import android.graphics.BitmapFactory; |
53 | import android.graphics.BitmapFactory; |
49 | import android.graphics.Camera; |
54 | import android.graphics.Camera; |
50 | import android.graphics.Canvas; |
55 | import android.graphics.Canvas; |
51 | import android.graphics.Color; |
56 | import android.graphics.Color; |
… | |
… | |
60 | import android.graphics.Rect; |
65 | import android.graphics.Rect; |
61 | import android.os.Bundle; |
66 | import android.os.Bundle; |
62 | import android.os.Debug; |
67 | import android.os.Debug; |
63 | import android.os.Handler; |
68 | import android.os.Handler; |
64 | import android.os.Message; |
69 | import android.os.Message; |
|
|
70 | import android.speech.RecognizerIntent; |
65 | import android.support.v7.app.ActionBarActivity; |
71 | import android.support.v7.app.ActionBarActivity; |
66 | import android.util.FloatMath; |
72 | import android.util.FloatMath; |
67 | import android.util.Log; |
73 | import android.util.Log; |
|
|
74 | import android.util.TypedValue; |
68 | import android.view.Gravity; |
75 | import android.view.Gravity; |
69 | import android.view.KeyEvent; |
76 | import android.view.KeyEvent; |
70 | import android.view.MotionEvent; |
77 | import android.view.MotionEvent; |
71 | import android.view.View; |
78 | import android.view.View; |
72 | import android.view.ViewGroup; |
79 | import android.view.ViewGroup; |
|
|
80 | import android.widget.Button; |
|
|
81 | import android.widget.FrameLayout; |
|
|
82 | import android.widget.ImageButton; |
|
|
83 | import android.widget.ImageView; |
73 | import android.widget.RelativeLayout; |
84 | import android.widget.RelativeLayout; |
74 | import android.widget.ScrollView; |
85 | import android.widget.ScrollView; |
75 | import android.widget.TextView; |
86 | import android.widget.TextView; |
76 | |
87 | |
77 | import com.zoffcc.applications.zanavi.Navit.Navit_Address_Result_Struct; |
88 | import com.zoffcc.applications.zanavi.Navit.Navit_Address_Result_Struct; |
… | |
… | |
95 | static DrawLinesThread[] dl_thread = new DrawLinesThread[dl_thread_max]; |
106 | static DrawLinesThread[] dl_thread = new DrawLinesThread[dl_thread_max]; |
96 | static Boolean draw_map_one_shot = false; |
107 | static Boolean draw_map_one_shot = false; |
97 | static Boolean draw_reset_factors = false; |
108 | static Boolean draw_reset_factors = false; |
98 | static Boolean Global_Map_in_onDraw = false; |
109 | static Boolean Global_Map_in_onDraw = false; |
99 | |
110 | |
|
|
111 | static int lower_than_center_percent = 0; |
|
|
112 | |
100 | // static Boolean synch_drawing_for_map = false; |
113 | // static Boolean synch_drawing_for_map = false; |
101 | private static final Object synch_drawing_for_map = new Object(); |
114 | private static final Object synch_drawing_for_map = new Object(); |
102 | static ZANaviLinearLayout OSD_new = null; |
115 | static ZANaviLinearLayout OSD_new = null; |
103 | |
116 | |
104 | // DPI --------------------------------------------- |
117 | // DPI --------------------------------------------- |
105 | // DPI --------------------------------------------- |
118 | // DPI --------------------------------------------- |
106 | // DPI --------------------------------------------- |
119 | // DPI --------------------------------------------- |
107 | static int Global_want_dpi = 210; |
120 | static int Global_want_dpi = 210; |
108 | static int Global_want_dpi_other = 210; |
121 | static int Global_want_dpi_other = 210; |
109 | static float Global_dpi_factor = 1; // will be calculated correctly later |
122 | static float Global_dpi_factor = 1; // will be calculated correctly later |
|
|
123 | static float Global_dpi_factor_better = 1; |
110 | static int Global_Scaled_DPI_normal = 240; // we will scale the whole screen to 240 dpi on high dpi devices |
124 | static int Global_Scaled_DPI_normal = 240; // we will scale the whole screen to 240 dpi on high dpi devices |
111 | // DPI --------------------------------------------- |
125 | // DPI --------------------------------------------- |
112 | // DPI --------------------------------------------- |
126 | // DPI --------------------------------------------- |
113 | // DPI --------------------------------------------- |
127 | // DPI --------------------------------------------- |
114 | |
128 | |
115 | static Camera camera = new Camera(); |
129 | static Camera camera = new Camera(); |
116 | static Matrix cam_m = new Matrix(); |
130 | static Matrix cam_m = new Matrix(); |
117 | static Matrix cam_m_vehicle = new Matrix(); |
131 | static Matrix cam_m_vehicle = new Matrix(); |
118 | static float strech_factor_3d_map = 2.2f; |
132 | static float strech_factor_3d_map = 1.2f; // ORIG = 2.2f |
119 | static int rotate_3d_map_angle = 61; |
133 | static int rotate_3d_map_angle = 44; // ORIG = 61 |
120 | static float h_scaled = 20; |
134 | static float h_scaled = 20; // ORIG = xx set later!! |
121 | |
135 | |
122 | private Canvas draw_canvas; |
136 | private Canvas draw_canvas; |
123 | private Bitmap draw_bitmap; |
137 | private Bitmap draw_bitmap; |
124 | private Canvas draw_canvas_screen; |
138 | private Canvas draw_canvas_screen; |
125 | private Bitmap draw_bitmap_screen; |
139 | private Bitmap draw_bitmap_screen; |
126 | private Canvas draw_canvas_screen2; |
140 | private Canvas draw_canvas_screen2; |
127 | private Bitmap draw_bitmap_screen2; |
141 | private Bitmap draw_bitmap_screen2; |
|
|
142 | |
|
|
143 | private float view_srec_x = 0; |
|
|
144 | private float view_srec_y = 0; |
128 | |
145 | |
129 | static ZANaviOSDDebug01 debug_text_view = null; |
146 | static ZANaviOSDDebug01 debug_text_view = null; |
130 | |
147 | |
131 | public final int map_bg_color = Color.parseColor("#FEF9EE"); |
148 | public final int map_bg_color = Color.parseColor("#FEF9EE"); |
132 | final Paint paint_bg_color = new Paint(Color.parseColor("#FEF9EE")); |
149 | final Paint paint_bg_color = new Paint(Color.parseColor("#FEF9EE")); |
… | |
… | |
183 | |
200 | |
184 | public static Boolean MAP_DISPLAY_OFF = false; |
201 | public static Boolean MAP_DISPLAY_OFF = false; |
185 | |
202 | |
186 | public static int mCanvasWidth = 1; |
203 | public static int mCanvasWidth = 1; |
187 | public static int mCanvasHeight = 1; |
204 | public static int mCanvasHeight = 1; |
|
|
205 | public static int mCanvasWidth_overspill = 1; |
|
|
206 | public static int mCanvasHeight_overspill = 1; |
188 | |
207 | |
189 | public static final Boolean DEBUG_TOUCH = false; |
208 | public static final Boolean DEBUG_TOUCH = false; |
190 | public static Boolean ZOOM_MODE_ACTIVE = false; |
209 | public static Boolean ZOOM_MODE_ACTIVE = false; |
191 | public static float ZOOM_MODE_SCALE = 1.0f; |
210 | public static float ZOOM_MODE_SCALE = 1.0f; |
192 | public static Boolean DRAG_MODE_ACTIVE = false; |
211 | public static Boolean DRAG_MODE_ACTIVE = false; |
… | |
… | |
285 | private static long interval_for_long_press = 200L; |
304 | private static long interval_for_long_press = 200L; |
286 | |
305 | |
287 | // for touch screen |
306 | // for touch screen |
288 | private long last_touch_on_screen = 0L; |
307 | private long last_touch_on_screen = 0L; |
289 | private static long long_press_on_screen_interval = 1000L; |
308 | private static long long_press_on_screen_interval = 1000L; |
290 | private static float long_press_on_screen_max_distance = 8f; |
309 | static float long_press_on_screen_max_distance = 8f; |
291 | |
310 | |
292 | // Overlay View for Android |
311 | // Overlay View for Android |
293 | // |
312 | // |
294 | // here you can draw all the nice things you want |
313 | // here you can draw all the nice things you want |
295 | // and get touch events for it (without touching C-code) |
314 | // and get touch events for it (without touching C-code) |
… | |
… | |
310 | |
329 | |
311 | private TextView NavitMsgTv2 = null; |
330 | private TextView NavitMsgTv2 = null; |
312 | public static TextView NavitMsgTv2_ = null; |
331 | public static TextView NavitMsgTv2_ = null; |
313 | |
332 | |
314 | public static ScrollView NavitMsgTv2sc_ = null; |
333 | public static ScrollView NavitMsgTv2sc_ = null; |
|
|
334 | public static RelativeLayout no_maps_container = null; |
|
|
335 | public static RelativeLayout whats_here_container_wrap = null; |
|
|
336 | public static ImageView whats_here_pointer_image = null; |
|
|
337 | public static RelativeLayout.LayoutParams params_whats_here_container_wrap = new RelativeLayout.LayoutParams(10, 10); |
|
|
338 | public static RelativeLayout.LayoutParams params_whats_here_pointer_image = new RelativeLayout.LayoutParams(10, 10); |
|
|
339 | public static ImageButton whats_here_button_add_to; |
|
|
340 | public static ImageButton whats_here_button_whats; |
|
|
341 | public static ImageButton whats_here_button_drive; |
|
|
342 | public static TextView whats_here_text; |
|
|
343 | // public static String whats_here_text_string = ""; |
315 | |
344 | |
316 | public static NavitGlobalMap NavitGlobalMap_ = null; |
345 | public static NavitGlobalMap NavitGlobalMap_ = null; |
317 | |
346 | |
318 | public void SetCamera(int use_camera) |
347 | public void SetCamera(int use_camera) |
319 | { |
348 | { |
… | |
… | |
614 | pts[0] = Navit.NG__map_main.bitmap_w / 2; // x0 |
643 | pts[0] = Navit.NG__map_main.bitmap_w / 2; // x0 |
615 | pts[1] = 0; // y0 |
644 | pts[1] = 0; // y0 |
616 | cam_m.mapPoints(pts); // now transform the points with the 3d matrix |
645 | cam_m.mapPoints(pts); // now transform the points with the 3d matrix |
617 | //System.out.println("x1=" + pts[0] + " y1=" + pts[1]); |
646 | //System.out.println("x1=" + pts[0] + " y1=" + pts[1]); |
618 | // -- offset for horizon -- |
647 | // -- offset for horizon -- |
619 | NavitGraphics.h_scaled = pts[1] + 15; // y coord of upper border after transformation with matrix (plus extra 15 pixels that scrolling looks better) |
648 | NavitGraphics.h_scaled = pts[1] + 1; // y coord of upper border after transformation with matrix (plus extra 15 pixels that scrolling looks better) |
620 | // |
649 | // |
621 | // |
650 | // |
622 | // --- vehicle matrix |
651 | // --- vehicle matrix |
623 | cam_m_vehicle.reset(); |
652 | cam_m_vehicle.reset(); |
624 | NavitGraphics.camera.save(); |
653 | NavitGraphics.camera.save(); |
… | |
… | |
654 | STT_B_list[3] = null; |
683 | STT_B_list[3] = null; |
655 | STT_B_list[4] = null; |
684 | STT_B_list[4] = null; |
656 | |
685 | |
657 | // shadow for text on map -------------- |
686 | // shadow for text on map -------------- |
658 | s_factor = 1; |
687 | s_factor = 1; |
659 | if ((Navit.metrics.densityDpi >= 320) && (!Navit.PREF_shrink_on_high_dpi)) |
688 | if ((Navit.metrics.densityDpi >= 320) && (!Navit.p.PREF_shrink_on_high_dpi)) |
660 | { |
689 | { |
661 | s_factor = (double) Navit.metrics.densityDpi / (double) NavitGraphics.Global_Scaled_DPI_normal; |
690 | s_factor = (double) Navit.metrics.densityDpi / (double) NavitGraphics.Global_Scaled_DPI_normal; |
662 | // s_factor = 1.4; |
691 | // s_factor = 1.4; |
663 | } |
692 | } |
|
|
693 | |
664 | s_strokTextSize = (int) (8f); |
694 | // s_strokTextSize = (int) (8f); |
665 | s_strokTextSize_min = (int) (4f * s_factor); |
695 | // s_strokTextSize_min = (int) (4f * s_factor); |
|
|
696 | |
|
|
697 | // width of the text shadow for strings on map ----------- |
|
|
698 | s_strokTextSize = dp_to_px(2); |
|
|
699 | s_strokTextSize_min = dp_to_px(2); |
|
|
700 | // width of the text shadow for strings on map ----------- |
666 | |
701 | |
667 | strokeTextPaint.setARGB(255, 255, 255, 255); |
702 | strokeTextPaint.setARGB(255, 255, 255, 255); |
668 | strokeTextPaint.setTextAlign(android.graphics.Paint.Align.LEFT); |
703 | strokeTextPaint.setTextAlign(android.graphics.Paint.Align.LEFT); |
669 | strokeTextPaint.setStyle(Paint.Style.STROKE); |
704 | strokeTextPaint.setStyle(Paint.Style.STROKE); |
670 | strokeTextPaint.setStrokeWidth(s_strokTextSize); |
705 | strokeTextPaint.setStrokeWidth(s_strokTextSize); |
… | |
… | |
699 | // public void surfaceDestroyed(SurfaceHolder holder) |
734 | // public void surfaceDestroyed(SurfaceHolder holder) |
700 | // { |
735 | // { |
701 | // System.out.println("surfaceDestroyed"); |
736 | // System.out.println("surfaceDestroyed"); |
702 | // } |
737 | // } |
703 | |
738 | |
|
|
739 | // Map ---------------------------- |
|
|
740 | // Map ---------------------------- |
|
|
741 | // Map ---------------------------- |
704 | @Override |
742 | @Override |
705 | protected void onDraw(Canvas canvas) |
743 | protected void onDraw(Canvas canvas) |
706 | { |
744 | { |
707 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); |
745 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); |
708 | |
746 | |
… | |
… | |
711 | // { |
749 | // { |
712 | // return; |
750 | // return; |
713 | // } |
751 | // } |
714 | // **** // System.out.println("draw main map:isHardwareAccelerated=" + canvas.isHardwareAccelerated()); |
752 | // **** // System.out.println("draw main map:isHardwareAccelerated=" + canvas.isHardwareAccelerated()); |
715 | |
753 | |
|
|
754 | // System.out.println("onDraw:MMMMMMMMMMMMMMMMMMMMMM"); |
716 | // SYN // |
755 | // SYN // |
717 | synchronized (synch_drawing_for_map) |
756 | synchronized (synch_drawing_for_map) |
718 | { |
757 | { |
|
|
758 | // System.out.println("onDraw:MMMMMMMMMMMMMMMMMMMMMM(s)"); |
719 | // System.out.println("DO__DRAW:onDraw():- start"); |
759 | // System.out.println("DO__DRAW:onDraw():- start"); |
720 | //System.out.println("*******DRAW INIT******* " + gr_type); |
760 | //System.out.println("*******DRAW INIT******* " + gr_type); |
721 | //super.onDraw(canvas); |
761 | //super.onDraw(canvas); |
722 | |
762 | |
723 | if (!MAP_DISPLAY_OFF) |
763 | if (!MAP_DISPLAY_OFF) |
… | |
… | |
738 | //System.out.println("DO__DRAW:Java:onDraw:draw bitmap to SCREEN"); |
778 | //System.out.println("DO__DRAW:Java:onDraw:draw bitmap to SCREEN"); |
739 | //System.out.println("DO__DRAW:Java:onDraw:gzf=" + Global_Map_Zoomfactor + " scale=" + ZOOM_MODE_SCALE); |
779 | //System.out.println("DO__DRAW:Java:onDraw:gzf=" + Global_Map_Zoomfactor + " scale=" + ZOOM_MODE_SCALE); |
740 | //System.out.println("DO__DRAW:Java:onDraw:gx=" + Global_Map_TransX + " pos_x=" + pos_x); |
780 | //System.out.println("DO__DRAW:Java:onDraw:gx=" + Global_Map_TransX + " pos_x=" + pos_x); |
741 | //System.out.println("DO__DRAW:Java:onDraw:gy=" + Global_Map_TransY + " pos_y=" + pos_y); |
781 | //System.out.println("DO__DRAW:Java:onDraw:gy=" + Global_Map_TransY + " pos_y=" + pos_y); |
742 | |
782 | |
743 | if (Navit.PREF_show_3d_map) |
783 | if (Navit.p.PREF_show_3d_map) |
744 | { |
784 | { |
745 | draw_canvas_screen2.save(); |
785 | draw_canvas_screen2.save(); |
|
|
786 | |
|
|
787 | // if (Navit.GFX_OVERSPILL) |
|
|
788 | // { |
|
|
789 | // // compensate overspill |
|
|
790 | // // canvas.translate(-mCanvasWidth_overspill, -mCanvasHeight_overspill); |
|
|
791 | // // System.out.println("overspill"); |
|
|
792 | // } |
|
|
793 | |
746 | if ((ZOOM_MODE_ACTIVE) || (Global_Map_Zoomfactor != 1.0f)) |
794 | if ((ZOOM_MODE_ACTIVE) || (Global_Map_Zoomfactor != 1.0f)) |
747 | { |
795 | { |
|
|
796 | if (Navit.GFX_OVERSPILL) |
|
|
797 | { |
|
|
798 | draw_canvas_screen2.scale(ZOOM_MODE_SCALE * Global_Map_Zoomfactor, ZOOM_MODE_SCALE * Global_Map_Zoomfactor, Global_Map_TransX + Navit.NG__map_main.touch_now_center.x + mCanvasWidth_overspill, Global_Map_TransY + Navit.NG__map_main.touch_now_center.y + mCanvasHeight_overspill); |
|
|
799 | } |
|
|
800 | else |
|
|
801 | { |
748 | draw_canvas_screen2.scale(ZOOM_MODE_SCALE * Global_Map_Zoomfactor, ZOOM_MODE_SCALE * Global_Map_Zoomfactor, Global_Map_TransX + Navit.NG__map_main.touch_now_center.x, Global_Map_TransY + Navit.NG__map_main.touch_now_center.y); |
802 | draw_canvas_screen2.scale(ZOOM_MODE_SCALE * Global_Map_Zoomfactor, ZOOM_MODE_SCALE * Global_Map_Zoomfactor, Global_Map_TransX + Navit.NG__map_main.touch_now_center.x, Global_Map_TransY + Navit.NG__map_main.touch_now_center.y); |
|
|
803 | } |
749 | } |
804 | } |
750 | |
805 | |
751 | if (Global_Map_Rotationangle != 0.0f) |
806 | if (Global_Map_Rotationangle != 0.0f) |
752 | { |
807 | { |
753 | draw_canvas_screen2.rotate(Global_Map_Rotationangle, Navit.NG__vehicle.vehicle_pos_x, Navit.NG__vehicle.vehicle_pos_y); |
808 | draw_canvas_screen2.rotate(Global_Map_Rotationangle, Navit.NG__vehicle.vehicle_pos_x, Navit.NG__vehicle.vehicle_pos_y); |
… | |
… | |
762 | draw_canvas_screen2.translate((Global_Map_TransX + pos_x) / Global_Map_Zoomfactor, (Global_Map_TransY + pos_y) / Global_Map_Zoomfactor); |
817 | draw_canvas_screen2.translate((Global_Map_TransX + pos_x) / Global_Map_Zoomfactor, (Global_Map_TransY + pos_y) / Global_Map_Zoomfactor); |
763 | } |
818 | } |
764 | |
819 | |
765 | //System.out.println("DO__DRAW:onDraw():drawBitmap start"); |
820 | //System.out.println("DO__DRAW:onDraw():drawBitmap start"); |
766 | draw_canvas_screen2.drawColor(map_bg_color); // fill with yellow-ish bg color |
821 | draw_canvas_screen2.drawColor(map_bg_color); // fill with yellow-ish bg color |
|
|
822 | // draw_canvas_screen2.drawColor(Color.GREEN); // fill with yellow-ish bg color |
767 | // draw the bitmap in the offscreen buffer (offset 30 pixels to center!!) |
823 | // draw the bitmap in the offscreen buffer (offset 30 pixels to center!!) |
768 | draw_canvas_screen2.drawBitmap(draw_bitmap_screen, 0, 0, paint_for_map_display); |
824 | draw_canvas_screen2.drawBitmap(draw_bitmap_screen, 0, 0, paint_for_map_display); |
769 | //System.out.println("DO__DRAW:onDraw():drawBitmap end"); |
825 | //System.out.println("DO__DRAW:onDraw():drawBitmap end"); |
|
|
826 | |
770 | canvas.save(); |
827 | canvas.save(); |
771 | canvas.drawColor(map_bg_color); // fill with yellow-ish bg color |
828 | canvas.drawColor(map_bg_color); // fill with yellow-ish bg color |
772 | |
829 | |
773 | // 3D modus ----------------- |
830 | // 3D modus ----------------- |
774 | canvas.concat(cam_m); |
831 | canvas.concat(cam_m); |
775 | // 3D modus ----------------- |
832 | // 3D modus ----------------- |
776 | |
833 | |
777 | // draw bitmap to screen |
834 | // draw bitmap to screen |
778 | canvas.drawBitmap(draw_bitmap_screen2, 0, 0, paint_for_map_display); |
835 | canvas.drawBitmap(draw_bitmap_screen2, -mCanvasWidth_overspill, -mCanvasHeight_overspill, paint_for_map_display); |
779 | |
836 | |
780 | // ------ DEBUG ------- |
837 | // ------ DEBUG ------- |
781 | // ------ DEBUG ------- |
838 | // ------ DEBUG ------- |
|
|
839 | // ------ DEBUG ------- |
|
|
840 | // ------ DEBUG ------- |
782 | // Paint paint79 = new Paint(); |
841 | // Paint paint79 = new Paint(); |
783 | // paint79.setColor(Color.MAGENTA); |
842 | // paint79.setColor(Color.MAGENTA); |
784 | // paint79.setStrokeWidth(16); |
843 | // paint79.setStrokeWidth(16); |
785 | // paint79.setStyle(Style.STROKE); |
844 | // paint79.setStyle(Style.STROKE); |
786 | // // float y_point = (bitmap_h - (bitmap_h * 0.7f)); |
845 | // // float y_point = (bitmap_h - (bitmap_h * 0.7f)); |
787 | // float y_point = bitmap_h * 0.7f; |
846 | // float y_point = bitmap_h * 0.7f; |
788 | // canvas.drawLine(bitmap_w / 2, y_point - 20, bitmap_w / 2, y_point + 20, paint79); |
847 | // canvas.drawLine(bitmap_w / 2, y_point - 20, bitmap_w / 2, y_point + 20, paint79); |
789 | // canvas.drawLine(bitmap_w / 2 - 100, y_point, bitmap_w / 2 + 100, y_point, paint79); |
848 | // canvas.drawLine(bitmap_w / 2 - 100, y_point, bitmap_w / 2 + 100, y_point, paint79); |
790 | // |
849 | // |
791 | // Paint paint78 = new Paint(); |
850 | // Paint paint78 = new Paint(); |
792 | // paint78.setColor(Color.RED); |
851 | // paint78.setColor(Color.RED); |
793 | // paint78.setStrokeWidth(20); |
852 | // paint78.setStrokeWidth(20); |
794 | // paint78.setStyle(Style.STROKE); |
853 | // paint78.setStyle(Style.STROKE); |
795 | // canvas.drawRect(30, 30, this.getWidth() - 30, this.getHeight() - 30, paint78); |
854 | // canvas.drawRect(30, 30, this.getWidth() - 30, this.getHeight() - 30, paint78); |
|
|
855 | // ------ DEBUG ------- |
|
|
856 | // ------ DEBUG ------- |
796 | // ------ DEBUG ------- |
857 | // ------ DEBUG ------- |
797 | // ------ DEBUG ------- |
858 | // ------ DEBUG ------- |
798 | |
859 | |
799 | canvas.restore(); |
860 | canvas.restore(); |
800 | draw_canvas_screen2.restore(); |
861 | draw_canvas_screen2.restore(); |
… | |
… | |
836 | { |
897 | { |
837 | // ---------- 2D map ----------------------------------- |
898 | // ---------- 2D map ----------------------------------- |
838 | // |
899 | // |
839 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:onDraw:draw bitmap to SCREEN 2D -- START ------"); |
900 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:onDraw:draw bitmap to SCREEN 2D -- START ------"); |
840 | canvas.save(); |
901 | canvas.save(); |
|
|
902 | |
|
|
903 | if (Navit.GFX_OVERSPILL) |
|
|
904 | { |
|
|
905 | // compensate overspill |
|
|
906 | canvas.translate(-mCanvasWidth_overspill, -mCanvasHeight_overspill); |
|
|
907 | // System.out.println("overspill"); |
|
|
908 | } |
|
|
909 | |
841 | if ((ZOOM_MODE_ACTIVE) || (Global_Map_Zoomfactor != 1.0f)) |
910 | if ((ZOOM_MODE_ACTIVE) || (Global_Map_Zoomfactor != 1.0f)) |
842 | { |
911 | { |
|
|
912 | if (Navit.GFX_OVERSPILL) |
|
|
913 | { |
|
|
914 | canvas.scale(ZOOM_MODE_SCALE * Global_Map_Zoomfactor, ZOOM_MODE_SCALE * Global_Map_Zoomfactor, Global_Map_TransX + Navit.NG__map_main.touch_now_center.x + mCanvasWidth_overspill, Global_Map_TransY + Navit.NG__map_main.touch_now_center.y + mCanvasHeight_overspill); |
|
|
915 | } |
|
|
916 | else |
|
|
917 | { |
843 | canvas.scale(ZOOM_MODE_SCALE * Global_Map_Zoomfactor, ZOOM_MODE_SCALE * Global_Map_Zoomfactor, Global_Map_TransX + Navit.NG__map_main.touch_now_center.x, Global_Map_TransY + Navit.NG__map_main.touch_now_center.y); |
918 | canvas.scale(ZOOM_MODE_SCALE * Global_Map_Zoomfactor, ZOOM_MODE_SCALE * Global_Map_Zoomfactor, Global_Map_TransX + Navit.NG__map_main.touch_now_center.x, Global_Map_TransY + Navit.NG__map_main.touch_now_center.y); |
|
|
919 | } |
844 | } |
920 | } |
845 | |
921 | |
846 | if (Global_Map_Rotationangle != 0.0f) |
922 | if (Global_Map_Rotationangle != 0.0f) |
847 | { |
923 | { |
848 | canvas.rotate(Global_Map_Rotationangle, Navit.NG__vehicle.vehicle_pos_x, Navit.NG__vehicle.vehicle_pos_y); |
924 | canvas.rotate(Global_Map_Rotationangle, Navit.NG__vehicle.vehicle_pos_x, Navit.NG__vehicle.vehicle_pos_y); |
… | |
… | |
887 | @Override |
963 | @Override |
888 | protected void onSizeChanged(int w, int h, int oldw, int oldh) |
964 | protected void onSizeChanged(int w, int h, int oldw, int oldh) |
889 | { |
965 | { |
890 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); |
966 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); |
891 | |
967 | |
|
|
968 | if ((w == 0) || (h == 0)) |
|
|
969 | { |
|
|
970 | return; |
|
|
971 | } |
|
|
972 | |
|
|
973 | // -- bottom bar -- |
|
|
974 | try |
|
|
975 | { |
|
|
976 | final FrameLayout a = (FrameLayout) Navit.Global_Navit_Object.findViewById(R.id.bottom_bar_slide); |
|
|
977 | final RelativeLayout.LayoutParams pp22 = (RelativeLayout.LayoutParams) a.getLayoutParams(); |
|
|
978 | // System.out.println("hhh:1=" + a.getHeight()); |
|
|
979 | // System.out.println("hhh:3=" + pp22.topMargin); |
|
|
980 | |
|
|
981 | Navit.map_view_height = h; |
|
|
982 | |
|
|
983 | // map height + toolbar height + 80dp for topbar |
|
|
984 | Navit.cur_y_margin_bottom_bar_touch = h + Navit.actionBarHeight + Navit.bottom_bar_px - Navit.bottom_bar_slider_shadow_px; // try to put view at bottom |
|
|
985 | |
|
|
986 | // System.out.println("hhh:4=map(h)=" + h + " actionbar(h)=" + Navit.actionBarHeight + " streetname(h)=" + Navit.bottom_bar_px); |
|
|
987 | |
|
|
988 | pp22.setMargins(0, (int) Navit.cur_y_margin_bottom_bar_touch, 0, 0); // left, top, right, bottom |
|
|
989 | a.setLayoutParams(pp22); |
|
|
990 | a.requestLayout(); |
|
|
991 | } |
|
|
992 | catch (Exception e) |
|
|
993 | { |
|
|
994 | Navit.cur_y_margin_bottom_bar_touch = h + Navit.actionBarHeight + Navit.bottom_bar_px - Navit.bottom_bar_slider_shadow_px; // try to put view at bottom |
|
|
995 | } |
|
|
996 | Navit.bottom_y_margin_bottom_bar_touch = Navit.cur_y_margin_bottom_bar_touch; |
|
|
997 | // -- bottom bar -- |
|
|
998 | |
892 | mCanvasWidth = w; |
999 | mCanvasWidth = w; |
893 | mCanvasHeight = h; |
1000 | mCanvasHeight = h; |
894 | int h_dpi = h; |
1001 | int h_dpi = h; |
895 | int w_dpi = w; |
1002 | int w_dpi = w; |
896 | |
1003 | |
|
|
1004 | int oldw_overspill = oldw; |
|
|
1005 | int oldh_overspill = oldh; |
|
|
1006 | int w_overspill = w; |
|
|
1007 | int h_overspill = h; |
|
|
1008 | |
|
|
1009 | if (Navit.GFX_OVERSPILL) |
|
|
1010 | { |
|
|
1011 | // if (w > h) |
|
|
1012 | // { |
|
|
1013 | // oldw_overspill = oldw; |
|
|
1014 | // oldh_overspill = oldw; |
|
|
1015 | // w_overspill = w; |
|
|
1016 | // h_overspill = w; |
|
|
1017 | // } |
|
|
1018 | // else if (h > w) |
|
|
1019 | // { |
|
|
1020 | // oldw_overspill = oldh; |
|
|
1021 | // oldh_overspill = oldh; |
|
|
1022 | // w_overspill = h; |
|
|
1023 | // h_overspill = h; |
|
|
1024 | // } |
|
|
1025 | // else |
|
|
1026 | // { |
|
|
1027 | // // w == h square screen? :-) |
|
|
1028 | // } |
|
|
1029 | |
|
|
1030 | oldw_overspill = (int) ((double) (oldw_overspill) * Navit.OVERSPILL_FACTOR); |
|
|
1031 | oldh_overspill = (int) ((double) (oldh_overspill) * Navit.OVERSPILL_FACTOR); |
|
|
1032 | w_overspill = (int) ((double) (w_overspill) * Navit.OVERSPILL_FACTOR); |
|
|
1033 | h_overspill = (int) ((double) (h_overspill) * Navit.OVERSPILL_FACTOR); |
|
|
1034 | |
|
|
1035 | } |
|
|
1036 | |
|
|
1037 | // --------- set position of vehicle on screen to x pixel from map bottom --------- |
|
|
1038 | lower_than_center_percent = dp_to_px(10); // default value |
|
|
1039 | if (w > h) |
|
|
1040 | { |
|
|
1041 | lower_than_center_percent = dp_to_px(10); // old: 18; // default for landscape mode |
|
|
1042 | } |
|
|
1043 | |
|
|
1044 | int min_height_map_in_px = getResources().getDimensionPixelSize(R.dimen.min_map_height_in_dp); |
|
|
1045 | if (h < min_height_map_in_px) |
|
|
1046 | { |
|
|
1047 | // lower_than_center_percent = 1; // if we have not much height -> put vehicle in the middle of the screen |
|
|
1048 | lower_than_center_percent = dp_to_px(10); |
|
|
1049 | } |
|
|
1050 | |
|
|
1051 | if (Navit.GFX_OVERSPILL) |
|
|
1052 | { |
|
|
1053 | lower_than_center_percent = (int) ((float) lower_than_center_percent * Navit.OVERSPILL_FACTOR); |
|
|
1054 | } |
|
|
1055 | |
|
|
1056 | Message msg33 = new Message(); |
|
|
1057 | Bundle b33 = new Bundle(); |
|
|
1058 | b33.putInt("Callback", 103); |
|
|
1059 | if (Navit.p.PREF_show_vehicle_in_center) |
|
|
1060 | { |
|
|
1061 | b33.putString("s", "0"); |
|
|
1062 | } |
|
|
1063 | else |
|
|
1064 | { |
|
|
1065 | b33.putString("s", "" + lower_than_center_percent); |
|
|
1066 | } |
|
|
1067 | msg33.setData(b33); |
|
|
1068 | try |
|
|
1069 | { |
|
|
1070 | NavitGraphics.callback_handler.sendMessage(msg33); |
|
|
1071 | } |
|
|
1072 | catch (Exception e88) |
|
|
1073 | { |
|
|
1074 | } |
|
|
1075 | // --------- set position of vehicle on screen to x% lower than screen center --------- |
|
|
1076 | |
|
|
1077 | // System.out.println("Graphics: old:" + w + " x " + h + " old:" + oldw + " x " + oldh); |
|
|
1078 | // System.out.println("Graphics: ovs:" + w_overspill + " x " + h_overspill + " old:" + oldw_overspill + " x " + oldh_overspill); |
|
|
1079 | |
|
|
1080 | if (((w_overspill - mCanvasWidth) % 2) != 0) |
|
|
1081 | { |
|
|
1082 | oldw_overspill++; |
|
|
1083 | w_overspill++; |
|
|
1084 | } |
|
|
1085 | |
|
|
1086 | if (((h_overspill - mCanvasHeight) % 2) != 0) |
|
|
1087 | { |
|
|
1088 | oldh_overspill++; |
|
|
1089 | h_overspill++; |
|
|
1090 | } |
|
|
1091 | |
|
|
1092 | mCanvasWidth_overspill = (w_overspill - mCanvasWidth) / 2; |
|
|
1093 | mCanvasHeight_overspill = (h_overspill - mCanvasHeight) / 2; |
|
|
1094 | |
|
|
1095 | // System.out.println("Graphics: ovs:" + (mCanvasWidth_overspill) + " x " + (mCanvasHeight_overspill)); |
|
|
1096 | |
897 | // DPI |
1097 | // DPI |
898 | int have_dpi = Navit.metrics.densityDpi; |
1098 | int have_dpi = Navit.metrics.densityDpi; |
899 | if (Global_want_dpi == have_dpi) |
1099 | if (Global_want_dpi == have_dpi) |
900 | { |
1100 | { |
901 | Global_dpi_factor = 1; |
1101 | Global_dpi_factor = 1; |
902 | } |
1102 | } |
903 | { |
1103 | { |
904 | Global_dpi_factor = ((float) Global_want_dpi / (float) have_dpi); |
1104 | Global_dpi_factor = ((float) Global_want_dpi / (float) have_dpi); |
905 | } |
1105 | } |
906 | h_dpi = (int) ((float) h * Global_dpi_factor); |
1106 | h_dpi = (int) ((float) h_overspill * Global_dpi_factor); |
907 | w_dpi = (int) ((float) w * Global_dpi_factor); |
1107 | w_dpi = (int) ((float) w_overspill * Global_dpi_factor); |
908 | System.out.println("Global_dpi_factor=" + Global_dpi_factor + " h_dpi=" + h_dpi + " w_dpi=" + w_dpi); |
1108 | // System.out.println("Global_dpi_factor=" + Global_dpi_factor + " h_dpi=" + h_dpi + " w_dpi=" + w_dpi); |
|
|
1109 | |
|
|
1110 | Global_dpi_factor_better = Navit.Global_Navit_Object.getResources().getDisplayMetrics().density; |
909 | // DPI |
1111 | // DPI |
910 | |
1112 | |
911 | // check if we need to hide actionbar icons --------------------- |
1113 | // check if we need to hide actionbar icons --------------------- |
912 | try |
1114 | try |
913 | { |
1115 | { |
… | |
… | |
916 | catch (Exception e) |
1118 | catch (Exception e) |
917 | { |
1119 | { |
918 | } |
1120 | } |
919 | // check if we need to hide actionbar icons --------------------- |
1121 | // check if we need to hide actionbar icons --------------------- |
920 | |
1122 | |
921 | //Log.e("Navit", "NavitGraphics -> onSizeChanged pixels x=" + w + " pixels y=" + h); |
|
|
922 | //Log.e("Navit", "NavitGraphics -> onSizeChanged dpi=" + Navit.metrics.densityDpi); |
|
|
923 | //Log.e("Navit", "NavitGraphics -> onSizeChanged density=" + Navit.metrics.density); |
|
|
924 | //Log.e("Navit", "NavitGraphics -> onSizeChanged scaledDensity=" + Navit.metrics.scaledDensity); |
|
|
925 | |
|
|
926 | // now layout the new OSD views -------------------------- |
|
|
927 | // now layout the new OSD views -------------------------- |
|
|
928 | // now layout the new OSD views -------------------------- |
|
|
929 | // float draw_factor2 = draw_factor; |
|
|
930 | // // correct for ultra high DPI |
|
|
931 | // if (Navit.metrics.densityDpi >= 320) //&& (Navit.PREF_shrink_on_high_dpi)) |
|
|
932 | // { |
|
|
933 | // draw_factor2 = 1.8f * Navit.metrics.densityDpi / NavitGraphics.Global_want_dpi_other; |
|
|
934 | // NavitOSDJava.NavitStreetFontLetterWidth = (int) ((float) NavitOSDJava.NavitStreetFontLetterWidth_base * Navit.metrics.densityDpi / NavitGraphics.Global_want_dpi_other); |
|
|
935 | // } |
|
|
936 | // |
|
|
937 | // float real_factor = draw_factor2 / 1.5f; |
|
|
938 | // |
|
|
939 | // // overwrite locally here!!!! bad!!! |
|
|
940 | // System.out.println("xx=" + mCanvasWidth); |
|
|
941 | // System.out.println("yy=" + mCanvasHeight); |
|
|
942 | // // overwrite locally here!!!! bad!!! |
|
|
943 | // |
|
|
944 | // // abs |
|
|
945 | // NavitOSDJava.compass_radius = (int) (50 * real_factor); |
|
|
946 | // NavitOSDJava.compass_lt_x = (int) (mCanvasWidth - (2 * NavitOSDJava.compass_radius) - (16 * real_factor)); |
|
|
947 | // NavitOSDJava.compass_lt_y = (int) (mCanvasHeight - (2 * NavitOSDJava.compass_radius) - ((16 + 50) * real_factor)); |
|
|
948 | // // rel |
|
|
949 | // NavitOSDJava.compass_w = (int) (2 * NavitOSDJava.compass_radius + 16 * real_factor); |
|
|
950 | // NavitOSDJava.compass_h = (int) (2 * NavitOSDJava.compass_radius + 16 * real_factor); |
|
|
951 | // |
|
|
952 | // ZANaviOSDCompass OSD_comp01 = (ZANaviOSDCompass) OSD_new.findViewById(R.id.osd_compass); |
|
|
953 | // android.view.ViewGroup.LayoutParams params = (LayoutParams) OSD_comp01.getLayoutParams(); |
|
|
954 | // params.width = NavitOSDJava.compass_w; |
|
|
955 | // params.height = NavitOSDJava.compass_h; |
|
|
956 | // OSD_comp01.requestLayout(); |
|
|
957 | // |
|
|
958 | // // streetname -- |
|
|
959 | // NavitOSDJava.nextt_str_w = mCanvasWidth; |
|
|
960 | // NavitOSDJava.nextt_str_h = (int) (65 * real_factor); |
|
|
961 | // View OSD_streetname = (View) OSD_new.findViewById(R.id.osd_streetname); |
|
|
962 | // params = (LayoutParams) OSD_streetname.getLayoutParams(); |
|
|
963 | // System.out.println("xx=" + mCanvasWidth + " view=" + OSD_streetname); |
|
|
964 | // if (mCanvasWidth > 1900) |
|
|
965 | // { |
|
|
966 | // params.width = 1000; |
|
|
967 | // } |
|
|
968 | // else |
|
|
969 | // { |
|
|
970 | // params.width = 200; |
|
|
971 | // } |
|
|
972 | // params.height = NavitOSDJava.nextt_str_h; |
|
|
973 | // OSD_streetname.requestLayout(); |
|
|
974 | // OSD_streetname.postInvalidate(); |
|
|
975 | // // |
|
|
976 | // View fill_1 = (View) OSD_new.findViewById(R.id.fill_1); |
|
|
977 | // params = (LayoutParams) fill_1.getLayoutParams(); |
|
|
978 | // params.width = 2; |
|
|
979 | // if (mCanvasWidth > 1900) |
|
|
980 | // { |
|
|
981 | // params.height = 150; |
|
|
982 | // } |
|
|
983 | // else |
|
|
984 | // { |
|
|
985 | // params.height = 15; |
|
|
986 | // } |
|
|
987 | // fill_1.requestLayout(); |
|
|
988 | // // |
|
|
989 | // View fill_2 = (View) OSD_new.findViewById(R.id.fill_2); |
|
|
990 | // params = (LayoutParams) fill_2.getLayoutParams(); |
|
|
991 | // params.width = 2; |
|
|
992 | // params.height = 300; |
|
|
993 | // fill_2.requestLayout(); |
|
|
994 | // // |
|
|
995 | // //OSD_new.requestLayout(); |
|
|
996 | // //OSD_new.postInvalidate(); |
|
|
997 | // now layout the new OSD views -------------------------- |
|
|
998 | // now layout the new OSD views -------------------------- |
|
|
999 | // now layout the new OSD views -------------------------- |
|
|
1000 | |
|
|
1001 | super.onSizeChanged(w, h, oldw, oldh); |
1123 | super.onSizeChanged(w, h, oldw, oldh); |
1002 | |
1124 | |
1003 | if (draw_bitmap != null) |
1125 | if (draw_bitmap != null) |
1004 | { |
1126 | { |
1005 | System.out.println("Graphics: draw_bitmap new:" + w + " x " + h + " old:" + oldw + " x " + oldh); |
1127 | // System.out.println("Graphics: draw_bitmap new:" + w_overspill + " x " + h_overspill + " old:" + oldw_overspill + " x " + oldh_overspill); |
1006 | |
1128 | |
1007 | // try to avoid out of memory errors |
1129 | // try to avoid out of memory errors |
1008 | if ((oldw >= w) && (oldh >= h)) |
1130 | if ((oldw_overspill >= w_overspill) && (oldh_overspill >= h_overspill)) |
1009 | { |
1131 | { |
1010 | System.out.println("Graphics: draw_bitmap: reuse"); |
1132 | // System.out.println("Graphics: draw_bitmap: reuse"); |
1011 | } |
1133 | } |
1012 | else |
1134 | else |
1013 | { |
1135 | { |
1014 | System.out.println("Graphics: draw_bitmap: create new"); |
1136 | // System.out.println("Graphics: draw_bitmap: create new"); |
1015 | draw_bitmap.recycle(); |
1137 | draw_bitmap.recycle(); |
1016 | draw_bitmap = null; |
1138 | draw_bitmap = null; |
1017 | } |
1139 | } |
1018 | } |
1140 | } |
1019 | |
1141 | |
|
|
1142 | boolean recycle = false; |
|
|
1143 | |
1020 | if (draw_bitmap_screen != null) |
1144 | if (draw_bitmap_screen != null) |
1021 | { |
1145 | { |
1022 | System.out.println("Graphics: draw_bitmap_screen new:" + w + " x " + h + " old:" + oldw + " x " + oldh); |
1146 | // System.out.println("Graphics: draw_bitmap_screen new:" + w_overspill + " x " + h_overspill + " old:" + oldw_overspill + " x " + oldh_overspill); |
1023 | |
1147 | |
1024 | // try to avoid out of memory errors |
1148 | // try to avoid out of memory errors |
1025 | if ((oldw >= w) && (oldh >= h)) |
1149 | if ((oldw_overspill >= w_overspill) && (oldh_overspill >= h_overspill)) |
1026 | { |
1150 | { |
1027 | |
1151 | recycle = true; |
1028 | } |
1152 | } |
1029 | else |
1153 | else |
1030 | { |
1154 | { |
1031 | draw_bitmap_screen.recycle(); |
1155 | draw_bitmap_screen.recycle(); |
1032 | draw_bitmap_screen = null; |
1156 | draw_bitmap_screen = null; |
1033 | } |
1157 | } |
1034 | } |
1158 | } |
1035 | |
1159 | |
1036 | if (draw_bitmap_screen2 != null) |
1160 | if (draw_bitmap_screen2 != null) |
1037 | { |
1161 | { |
1038 | System.out.println("Graphics: draw_bitmap_screen2 new:" + w + " x " + h + " old:" + oldw + " x " + oldh); |
1162 | // System.out.println("Graphics: draw_bitmap_screen2 new:" + w_overspill + " x " + h_overspill + " old:" + oldw_overspill + " x " + oldh_overspill); |
1039 | |
1163 | |
1040 | // try to avoid out of memory errors |
1164 | // try to avoid out of memory errors |
1041 | if ((oldw >= w) && (oldh >= h)) |
1165 | if ((oldw_overspill >= w_overspill) && (oldh_overspill >= h_overspill)) |
1042 | { |
1166 | { |
1043 | |
1167 | |
1044 | } |
1168 | } |
1045 | else |
1169 | else |
1046 | { |
1170 | { |
… | |
… | |
1051 | |
1175 | |
1052 | if (draw_bitmap == null) |
1176 | if (draw_bitmap == null) |
1053 | { |
1177 | { |
1054 | try |
1178 | try |
1055 | { |
1179 | { |
|
|
1180 | // ------ ??????????????????????? |
|
|
1181 | // ------ ??????????????????????? |
|
|
1182 | // ------ ??????????????????????? |
|
|
1183 | // ------ ??????????????????????? |
|
|
1184 | // ------ ??????????????????????? |
|
|
1185 | // ------ ??????????????????????? |
|
|
1186 | // ------ ??????????????????????? |
|
|
1187 | // ------ ??????????????????????? |
1056 | draw_bitmap = Bitmap.createBitmap(w_dpi, h_dpi, Bitmap.Config.ARGB_8888); |
1188 | draw_bitmap = Bitmap.createBitmap(w_dpi, h_dpi, Bitmap.Config.ARGB_8888); // _dpi or not ?????????????????????????? |
|
|
1189 | System.out.println("_BITM_:need w-h=" + w_dpi + "-" + h_dpi + " have w-h=" + mCanvasWidth + "-" + mCanvasHeight); |
|
|
1190 | // ------ ??????????????????????? |
|
|
1191 | // ------ ??????????????????????? |
|
|
1192 | // ------ ??????????????????????? |
|
|
1193 | // ------ ??????????????????????? |
|
|
1194 | // ------ ??????????????????????? |
|
|
1195 | // ------ ??????????????????????? |
|
|
1196 | // ------ ??????????????????????? |
1057 | // draw_bitmap.setDensity(Global_want_dpi); |
1197 | // draw_bitmap.setDensity(Global_want_dpi); |
1058 | } |
1198 | } |
1059 | catch (OutOfMemoryError e) |
1199 | catch (OutOfMemoryError e) |
1060 | { |
1200 | { |
1061 | int usedMegs = (int) (Debug.getNativeHeapAllocatedSize() / 1048576L); |
1201 | int usedMegs = (int) (Debug.getNativeHeapAllocatedSize() / 1048576L); |
… | |
… | |
1068 | System.gc(); |
1208 | System.gc(); |
1069 | usedMegs = (int) (Debug.getNativeHeapAllocatedSize() / 1048576L); |
1209 | usedMegs = (int) (Debug.getNativeHeapAllocatedSize() / 1048576L); |
1070 | usedMegsString = String.format(" - Memory Used: %d MB", usedMegs); |
1210 | usedMegsString = String.format(" - Memory Used: %d MB", usedMegs); |
1071 | System.out.println("" + usedMegsString); |
1211 | System.out.println("" + usedMegsString); |
1072 | // try again |
1212 | // try again |
|
|
1213 | // draw_bitmap = Bitmap.createBitmap(w_overspill, h_overspill, Bitmap.Config.ARGB_8888); |
1073 | draw_bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); |
1214 | draw_bitmap = Bitmap.createBitmap(w_dpi, h_dpi, Bitmap.Config.ARGB_8888); |
1074 | //draw_bitmap.setDensity(Global_want_dpi); |
1215 | //draw_bitmap.setDensity(Global_want_dpi); |
1075 | } |
1216 | } |
1076 | } |
1217 | } |
1077 | |
1218 | |
|
|
1219 | // view.setLayerType(View.LAYER_TYPE_HARDWARE, null); |
|
|
1220 | |
1078 | if (draw_bitmap_screen == null) |
1221 | if (draw_bitmap_screen == null) |
1079 | { |
1222 | { |
1080 | try |
1223 | try |
1081 | { |
1224 | { |
1082 | draw_bitmap_screen = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); |
1225 | draw_bitmap_screen = Bitmap.createBitmap(w_overspill, h_overspill, Bitmap.Config.ARGB_8888); |
1083 | // DPI |
1226 | // DPI |
1084 | //draw_bitmap_screen.setDensity(Global_want_dpi); |
1227 | //draw_bitmap_screen.setDensity(Global_want_dpi); |
1085 | } |
1228 | } |
1086 | catch (OutOfMemoryError e) |
1229 | catch (OutOfMemoryError e) |
1087 | { |
1230 | { |
… | |
… | |
1095 | System.gc(); |
1238 | System.gc(); |
1096 | usedMegs = (int) (Debug.getNativeHeapAllocatedSize() / 1048576L); |
1239 | usedMegs = (int) (Debug.getNativeHeapAllocatedSize() / 1048576L); |
1097 | usedMegsString = String.format(" - Memory Used: %d MB", usedMegs); |
1240 | usedMegsString = String.format(" - Memory Used: %d MB", usedMegs); |
1098 | System.out.println("" + usedMegsString); |
1241 | System.out.println("" + usedMegsString); |
1099 | // try again |
1242 | // try again |
1100 | draw_bitmap_screen = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); |
1243 | draw_bitmap_screen = Bitmap.createBitmap(w_overspill, h_overspill, Bitmap.Config.ARGB_8888); |
1101 | //draw_bitmap_screen.setDensity(Global_want_dpi); |
1244 | //draw_bitmap_screen.setDensity(Global_want_dpi); |
1102 | } |
1245 | } |
1103 | } |
1246 | } |
1104 | |
1247 | |
1105 | if (draw_bitmap_screen2 == null) |
1248 | if (draw_bitmap_screen2 == null) |
1106 | { |
1249 | { |
1107 | try |
1250 | try |
1108 | { |
1251 | { |
1109 | draw_bitmap_screen2 = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); |
1252 | draw_bitmap_screen2 = Bitmap.createBitmap(w_overspill, h_overspill, Bitmap.Config.ARGB_8888); |
1110 | // DPI |
1253 | // DPI |
1111 | //draw_bitmap_screen2.setDensity(Global_want_dpi); |
1254 | //draw_bitmap_screen2.setDensity(Global_want_dpi); |
1112 | } |
1255 | } |
1113 | catch (OutOfMemoryError e) |
1256 | catch (OutOfMemoryError e) |
1114 | { |
1257 | { |
… | |
… | |
1122 | System.gc(); |
1265 | System.gc(); |
1123 | usedMegs = (int) (Debug.getNativeHeapAllocatedSize() / 1048576L); |
1266 | usedMegs = (int) (Debug.getNativeHeapAllocatedSize() / 1048576L); |
1124 | usedMegsString = String.format(" - Memory Used: %d MB", usedMegs); |
1267 | usedMegsString = String.format(" - Memory Used: %d MB", usedMegs); |
1125 | System.out.println("" + usedMegsString); |
1268 | System.out.println("" + usedMegsString); |
1126 | // try again |
1269 | // try again |
1127 | draw_bitmap_screen2 = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); |
1270 | draw_bitmap_screen2 = Bitmap.createBitmap(w_overspill, h_overspill, Bitmap.Config.ARGB_8888); |
1128 | //draw_bitmap_screen2.setDensity(Global_want_dpi); |
1271 | //draw_bitmap_screen2.setDensity(Global_want_dpi); |
1129 | } |
1272 | } |
1130 | } |
1273 | } |
1131 | |
1274 | |
1132 | draw_canvas = new Canvas(draw_bitmap); |
1275 | draw_canvas = new Canvas(draw_bitmap); |
1133 | // DPI |
1276 | // DPI |
1134 | draw_canvas.setDensity(Global_want_dpi); |
1277 | draw_canvas.setDensity(Global_want_dpi); |
1135 | |
1278 | |
1136 | draw_canvas_screen = new Canvas(draw_bitmap_screen); |
1279 | draw_canvas_screen = new Canvas(draw_bitmap_screen); |
1137 | // DPI |
1280 | // DPI |
1138 | //draw_canvas_screen.setDensity(Global_want_dpi); |
1281 | //draw_canvas_screen.setDensity(Global_want_dpi); |
1139 | |
1282 | |
1140 | draw_canvas_screen2 = new Canvas(draw_bitmap_screen2); |
1283 | draw_canvas_screen2 = new Canvas(draw_bitmap_screen2); |
1141 | // DPI |
1284 | // DPI |
1142 | //draw_canvas_screen2.setDensity(Global_want_dpi); |
1285 | //draw_canvas_screen2.setDensity(Global_want_dpi); |
1143 | if (gr_type == 1) |
1286 | if (gr_type == 1) |
… | |
… | |
1147 | draw_canvas_s = draw_canvas; |
1290 | draw_canvas_s = draw_canvas; |
1148 | draw_bitmap_screen_s = draw_bitmap_screen; |
1291 | draw_bitmap_screen_s = draw_bitmap_screen; |
1149 | draw_canvas_screen_s = draw_canvas_screen; |
1292 | draw_canvas_screen_s = draw_canvas_screen; |
1150 | draw_bitmap_screen_s2 = draw_bitmap_screen2; |
1293 | draw_bitmap_screen_s2 = draw_bitmap_screen2; |
1151 | draw_canvas_screen_s2 = draw_canvas_screen2; |
1294 | draw_canvas_screen_s2 = draw_canvas_screen2; |
|
|
1295 | |
|
|
1296 | if (recycle) |
|
|
1297 | { |
|
|
1298 | draw_canvas.drawColor(Color.BLACK); |
|
|
1299 | draw_canvas_screen.drawColor(Color.BLACK); |
|
|
1300 | draw_canvas_screen2.drawColor(Color.BLACK); |
|
|
1301 | } |
1152 | } |
1302 | } |
1153 | bitmap_w = w; |
1303 | bitmap_w = w; |
1154 | bitmap_h = h; |
1304 | bitmap_h = h; |
1155 | |
1305 | |
1156 | // DPI |
1306 | // DPI |
… | |
… | |
1229 | |
1379 | |
1230 | int _ACTION_POINTER_UP_ = MotionEvent.ACTION_POINTER_UP; |
1380 | int _ACTION_POINTER_UP_ = MotionEvent.ACTION_POINTER_UP; |
1231 | int _ACTION_POINTER_DOWN_ = MotionEvent.ACTION_POINTER_DOWN; |
1381 | int _ACTION_POINTER_DOWN_ = MotionEvent.ACTION_POINTER_DOWN; |
1232 | int _ACTION_MASK_ = MotionEvent.ACTION_MASK; |
1382 | int _ACTION_MASK_ = MotionEvent.ACTION_MASK; |
1233 | |
1383 | |
1234 | if (NavitAndroidOverlay.voice_rec_bar_visible) |
1384 | // if (NavitAndroidOverlay.voice_rec_bar_visible) |
1235 | { |
1385 | // { |
1236 | if (action == MotionEvent.ACTION_UP) |
1386 | // if (action == MotionEvent.ACTION_UP) |
1237 | { |
1387 | // { |
1238 | NavitAndroidOverlay.voice_rec_bar_visible = false; |
1388 | // NavitAndroidOverlay.voice_rec_bar_visible = false; |
1239 | //System.out.println("xx paint 15 xx"); |
1389 | // //System.out.println("xx paint 15 xx"); |
1240 | NavitAOverlay_s.postInvalidate(); |
1390 | // NavitAOverlay_s.postInvalidate(); |
1241 | } |
1391 | // } |
1242 | else |
1392 | // else |
1243 | { |
1393 | // { |
1244 | if (event.getPointerCount() < 2) |
1394 | // if (event.getPointerCount() < 2) |
1245 | { |
1395 | // { |
1246 | NavitAndroidOverlay.voice_rec_bar_x = x; |
1396 | // NavitAndroidOverlay.voice_rec_bar_x = x; |
1247 | NavitAndroidOverlay.voice_rec_bar_y = y; |
1397 | // NavitAndroidOverlay.voice_rec_bar_y = y; |
1248 | |
1398 | // |
1249 | if (NavitAndroidOverlay.voice_rec_bar_x > NavitAndroidOverlay.voice_rec_bar_limit) |
1399 | // if (NavitAndroidOverlay.voice_rec_bar_x > NavitAndroidOverlay.voice_rec_bar_limit) |
|
|
1400 | // { |
|
|
1401 | // NavitAndroidOverlay.voice_rec_bar_visible = false; |
|
|
1402 | // NavitAndroidOverlay.voice_rec_bar_visible2 = true; |
|
|
1403 | // //System.out.println("xx paint 16 xx"); |
|
|
1404 | // NavitAOverlay_s.postInvalidate(); |
|
|
1405 | // |
|
|
1406 | // // open voice search screen |
|
|
1407 | // try |
|
|
1408 | // { |
|
|
1409 | // Message msg = Navit.Navit_progress_h.obtainMessage(); |
|
|
1410 | // Bundle b = new Bundle(); |
|
|
1411 | // msg.what = 19; |
|
|
1412 | // msg.setData(b); |
|
|
1413 | // Navit.Navit_progress_h.sendMessage(msg); |
|
|
1414 | // } |
|
|
1415 | // catch (Exception e) |
|
|
1416 | // { |
|
|
1417 | // e.printStackTrace(); |
|
|
1418 | // } |
|
|
1419 | // } |
|
|
1420 | // else |
|
|
1421 | // { |
|
|
1422 | // //System.out.println("xx paint 17 xx"); |
|
|
1423 | // NavitAOverlay_s.postInvalidate(); |
|
|
1424 | // } |
|
|
1425 | // } |
|
|
1426 | // else |
1250 | { |
1427 | // { |
1251 | NavitAndroidOverlay.voice_rec_bar_visible = false; |
1428 | // NavitAndroidOverlay.voice_rec_bar_visible = false; |
1252 | NavitAndroidOverlay.voice_rec_bar_visible2 = true; |
|
|
1253 | //System.out.println("xx paint 16 xx"); |
1429 | // //System.out.println("xx paint 18 xx"); |
1254 | NavitAOverlay_s.postInvalidate(); |
1430 | // NavitAOverlay_s.postInvalidate(); |
1255 | |
1431 | // } |
1256 | // open voice search screen |
|
|
1257 | try |
|
|
1258 | { |
|
|
1259 | Message msg = Navit.Navit_progress_h.obtainMessage(); |
|
|
1260 | Bundle b = new Bundle(); |
|
|
1261 | msg.what = 19; |
|
|
1262 | msg.setData(b); |
|
|
1263 | Navit.Navit_progress_h.sendMessage(msg); |
|
|
1264 | } |
1432 | // } |
1265 | catch (Exception e) |
1433 | // |
1266 | { |
|
|
1267 | e.printStackTrace(); |
|
|
1268 | } |
|
|
1269 | } |
|
|
1270 | else |
|
|
1271 | { |
|
|
1272 | //System.out.println("xx paint 17 xx"); |
|
|
1273 | NavitAOverlay_s.postInvalidate(); |
|
|
1274 | } |
|
|
1275 | } |
|
|
1276 | else |
|
|
1277 | { |
|
|
1278 | NavitAndroidOverlay.voice_rec_bar_visible = false; |
|
|
1279 | //System.out.println("xx paint 18 xx"); |
|
|
1280 | NavitAOverlay_s.postInvalidate(); |
|
|
1281 | } |
|
|
1282 | } |
|
|
1283 | |
|
|
1284 | // dont do anything else with this event |
1434 | // // dont do anything else with this event |
1285 | return true; |
1435 | // return true; |
1286 | } |
1436 | // } |
1287 | |
1437 | |
1288 | // calculate value |
1438 | // calculate value |
1289 | int switch_value = (event.getAction() & _ACTION_MASK_); |
1439 | int switch_value = (event.getAction() & _ACTION_MASK_); |
1290 | if (DEBUG_TOUCH) Log.e("NavitGraphics", "switch_value=" + switch_value); |
1440 | if (DEBUG_TOUCH) Log.e("NavitGraphics", "switch_value=" + switch_value); |
1291 | if (DEBUG_TOUCH) Log.e("NavitGraphics", "getAction=" + action); |
1441 | if (DEBUG_TOUCH) Log.e("NavitGraphics", "getAction=" + action); |
… | |
… | |
1550 | //{ |
1700 | //{ |
1551 | //} |
1701 | //} |
1552 | |
1702 | |
1553 | // ??? // ButtonCallback(0, 1, x, y); // up |
1703 | // ??? // ButtonCallback(0, 1, x, y); // up |
1554 | |
1704 | |
1555 | if (!Navit.PREF_follow_gps) |
1705 | if (!Navit.p.PREF_follow_gps) |
1556 | { |
1706 | { |
|
|
1707 | if (Navit.GFX_OVERSPILL) |
|
|
1708 | { |
|
|
1709 | Navit.cwthr.CallbackGeoCalc2(1, 0, NavitGraphics.Global_dpi_factor * (mCanvasWidth / 2 + NavitGraphics.mCanvasWidth_overspill), NavitGraphics.Global_dpi_factor * (mCanvasHeight / 2 + NavitGraphics.mCanvasHeight_overspill)); |
|
|
1710 | } |
|
|
1711 | else |
|
|
1712 | { |
1557 | Navit.cwthr.CallbackGeoCalc2(1, 0, NavitGraphics.Global_dpi_factor * mCanvasWidth / 2, NavitGraphics.Global_dpi_factor * mCanvasHeight / 2); |
1713 | Navit.cwthr.CallbackGeoCalc2(1, 0, NavitGraphics.Global_dpi_factor * mCanvasWidth / 2, NavitGraphics.Global_dpi_factor * mCanvasHeight / 2); |
|
|
1714 | } |
1558 | } |
1715 | } |
1559 | |
1716 | |
1560 | // try |
1717 | // try |
1561 | // { |
1718 | // { |
1562 | // // try to show current location/streetname |
1719 | // // try to show current location/streetname |
… | |
… | |
1583 | |
1740 | |
1584 | if (DEBUG_TOUCH) Log.e("NavitGraphics", "onTouch zoom"); |
1741 | if (DEBUG_TOUCH) Log.e("NavitGraphics", "onTouch zoom"); |
1585 | |
1742 | |
1586 | float newDist = spacing(event); |
1743 | float newDist = spacing(event); |
1587 | float scale = 1.0f; |
1744 | float scale = 1.0f; |
1588 | if (newDist > 10f) |
1745 | // if (newDist > 10f) |
|
|
1746 | if (newDist > (Navit.swipeMaxOffPath / 2)) |
1589 | { |
1747 | { |
1590 | scale = newDist / oldDist; |
1748 | scale = newDist / oldDist; |
1591 | } |
1749 | } |
1592 | |
1750 | |
1593 | if (scale > 1.0f) |
1751 | if (scale > 1.0f) |
… | |
… | |
1629 | //System.out.println("sc1:" + Navit.GlobalScaleLevel); |
1787 | //System.out.println("sc1:" + Navit.GlobalScaleLevel); |
1630 | Navit.GlobalScaleLevel = (int) (Navit.GlobalScaleLevel / scale); |
1788 | Navit.GlobalScaleLevel = (int) (Navit.GlobalScaleLevel / scale); |
1631 | //System.out.println("sc1.1:" + Navit.GlobalScaleLevel); |
1789 | //System.out.println("sc1.1:" + Navit.GlobalScaleLevel); |
1632 | |
1790 | |
1633 | Navit.NG__map_main.touch_now_center = calc_center(event); |
1791 | Navit.NG__map_main.touch_now_center = calc_center(event); |
|
|
1792 | // zzzzzzzzzzzzz; |
|
|
1793 | if (Navit.GFX_OVERSPILL) |
|
|
1794 | { |
|
|
1795 | b.putString("s", (int) ((Navit.NG__map_main.touch_now_center.x + mCanvasWidth_overspill) * Global_dpi_factor) + "#" + (int) ((Navit.NG__map_main.touch_now_center.y + mCanvasHeight_overspill) * Global_dpi_factor) + "#" + Integer.toString(Navit.GlobalScaleLevel)); |
|
|
1796 | } |
|
|
1797 | else |
|
|
1798 | { |
1634 | b.putString("s", (int) (Navit.NG__map_main.touch_now_center.x * Global_dpi_factor) + "#" + (int) (Navit.NG__map_main.touch_now_center.y * Global_dpi_factor) + "#" + Integer.toString(Navit.GlobalScaleLevel)); |
1799 | b.putString("s", (int) ((Navit.NG__map_main.touch_now_center.x) * Global_dpi_factor) + "#" + (int) ((Navit.NG__map_main.touch_now_center.y) * Global_dpi_factor) + "#" + Integer.toString(Navit.GlobalScaleLevel)); |
|
|
1800 | } |
1635 | msg.setData(b); |
1801 | msg.setData(b); |
1636 | try |
1802 | try |
1637 | { |
1803 | { |
1638 | callback_handler.sendMessage(msg); |
1804 | callback_handler.sendMessage(msg); |
1639 | //System.out.println("touch: set zoom(in) level: " + Navit.GlobalScaleLevel); |
1805 | //System.out.println("touch: set zoom(in) level: " + Navit.GlobalScaleLevel); |
… | |
… | |
1703 | Message msg = new Message(); |
1869 | Message msg = new Message(); |
1704 | Bundle b = new Bundle(); |
1870 | Bundle b = new Bundle(); |
1705 | b.putInt("Callback", 61); |
1871 | b.putInt("Callback", 61); |
1706 | //System.out.println("sc2:" + Navit.GlobalScaleLevel); |
1872 | //System.out.println("sc2:" + Navit.GlobalScaleLevel); |
1707 | Navit.GlobalScaleLevel = (int) (Navit.GlobalScaleLevel / scale); |
1873 | Navit.GlobalScaleLevel = (int) (Navit.GlobalScaleLevel / scale); |
|
|
1874 | |
|
|
1875 | if (Navit.GlobalScaleLevel == ((int) (Navit.GlobalScaleLevel / scale))) |
|
|
1876 | { |
|
|
1877 | // movement was too small for (int) change. so change it anyway |
|
|
1878 | Navit.GlobalScaleLevel++; |
|
|
1879 | } |
|
|
1880 | |
1708 | if (Navit.GlobalScaleLevel < 2) |
1881 | if (Navit.GlobalScaleLevel < 2) |
1709 | { |
1882 | { |
1710 | Navit.GlobalScaleLevel = 2; |
1883 | Navit.GlobalScaleLevel = 2; |
1711 | } |
1884 | } |
1712 | //System.out.println("sc2.1:" + Navit.GlobalScaleLevel); |
1885 | //System.out.println("sc2.1:" + Navit.GlobalScaleLevel); |
1713 | Navit.NG__map_main.touch_now_center = calc_center(event); |
1886 | Navit.NG__map_main.touch_now_center = calc_center(event); |
|
|
1887 | |
|
|
1888 | if (Navit.GFX_OVERSPILL) |
|
|
1889 | { |
|
|
1890 | b.putString("s", (int) ((Navit.NG__map_main.touch_now_center.x + mCanvasWidth_overspill) * Global_dpi_factor) + "#" + (int) ((Navit.NG__map_main.touch_now_center.y + mCanvasHeight_overspill) * Global_dpi_factor) + "#" + Integer.toString(Navit.GlobalScaleLevel)); |
|
|
1891 | } |
|
|
1892 | else |
|
|
1893 | { |
1714 | b.putString("s", (int) (Navit.NG__map_main.touch_now_center.x * Global_dpi_factor) + "#" + (int) (Navit.NG__map_main.touch_now_center.y * Global_dpi_factor) + "#" + Integer.toString(Navit.GlobalScaleLevel)); |
1894 | b.putString("s", (int) ((Navit.NG__map_main.touch_now_center.x) * Global_dpi_factor) + "#" + (int) ((Navit.NG__map_main.touch_now_center.y) * Global_dpi_factor) + "#" + Integer.toString(Navit.GlobalScaleLevel)); |
|
|
1895 | } |
1715 | msg.setData(b); |
1896 | msg.setData(b); |
1716 | try |
1897 | try |
1717 | { |
1898 | { |
1718 | callback_handler.sendMessage(msg); |
1899 | callback_handler.sendMessage(msg); |
1719 | //System.out.println("touch: set zoom(out) level: " + Navit.GlobalScaleLevel); |
1900 | //System.out.println("touch: set zoom(out) level: " + Navit.GlobalScaleLevel); |
… | |
… | |
1992 | { |
2173 | { |
1993 | //System.out.println("DO__DRAW:Java:ACTION POINTER DOWN start"); |
2174 | //System.out.println("DO__DRAW:Java:ACTION POINTER DOWN start"); |
1994 | if (DEBUG_TOUCH) Log.e("NavitGraphics", "ACTION_POINTER_DOWN"); |
2175 | if (DEBUG_TOUCH) Log.e("NavitGraphics", "ACTION_POINTER_DOWN"); |
1995 | |
2176 | |
1996 | oldDist = spacing(event); |
2177 | oldDist = spacing(event); |
1997 | if (oldDist > 10f) |
2178 | // if (oldDist > 10f) |
|
|
2179 | if (oldDist > (Navit.swipeMaxOffPath / 2)) |
1998 | { |
2180 | { |
1999 | touch_mode = ZOOM; |
2181 | touch_mode = ZOOM; |
2000 | if (DEBUG_TOUCH) Log.e("NavitGraphics", "--> zoom"); |
2182 | if (DEBUG_TOUCH) Log.e("NavitGraphics", "--> zoom"); |
2001 | // zoom action starts here -------- |
2183 | // zoom action starts here -------- |
2002 | // zoom action starts here -------- |
2184 | // zoom action starts here -------- |
… | |
… | |
2372 | parent_v2.removeView(dummy_v2); |
2554 | parent_v2.removeView(dummy_v2); |
2373 | } |
2555 | } |
2374 | // ------------------------------------------------------- |
2556 | // ------------------------------------------------------- |
2375 | // ------------------------------------------------------- |
2557 | // ------------------------------------------------------- |
2376 | |
2558 | |
|
|
2559 | Button no_maps_button = (Button) activity.findViewById(R.id.no_maps_button); |
|
|
2560 | no_maps_button.setOnClickListener(new View.OnClickListener() |
|
|
2561 | { |
|
|
2562 | public void onClick(View v) |
|
|
2563 | { |
|
|
2564 | try |
|
|
2565 | { |
|
|
2566 | Message msg = Navit.Navit_progress_h.obtainMessage(); |
|
|
2567 | Bundle b = new Bundle(); |
|
|
2568 | msg.what = 31; |
|
|
2569 | msg.setData(b); |
|
|
2570 | Navit.Navit_progress_h.sendMessage(msg); |
|
|
2571 | } |
|
|
2572 | catch (Exception e) |
|
|
2573 | { |
|
|
2574 | } |
|
|
2575 | } |
|
|
2576 | }); |
|
|
2577 | |
|
|
2578 | // Navit.Global_Navit_Object.glSurfaceView.bringToFront(); |
|
|
2579 | |
|
|
2580 | View view_srec = (View) activity.findViewById(R.id.view_srec); |
|
|
2581 | |
|
|
2582 | // Disable button if no recognition service is present |
|
|
2583 | PackageManager pm = activity.getPackageManager(); |
|
|
2584 | List<ResolveInfo> activities = pm.queryIntentActivities(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0); |
|
|
2585 | if (activities.size() == 0) |
|
|
2586 | { |
|
|
2587 | // NO speech recognition installed |
|
|
2588 | view_srec.setVisibility(View.INVISIBLE); |
|
|
2589 | } |
|
|
2590 | else |
|
|
2591 | { |
|
|
2592 | // speech recognition is installed |
|
|
2593 | view_srec.bringToFront(); |
|
|
2594 | view_srec.setOnTouchListener(new View.OnTouchListener() |
|
|
2595 | { |
|
|
2596 | |
|
|
2597 | @Override |
|
|
2598 | public boolean onTouch(View v, MotionEvent m) |
|
|
2599 | { |
|
|
2600 | if ((view_srec_x == 0) || (view_srec_y == 0)) |
|
|
2601 | { |
|
|
2602 | try |
|
|
2603 | { |
|
|
2604 | view_srec_x = v.getX(); |
|
|
2605 | view_srec_y = v.getY(); |
|
|
2606 | } |
|
|
2607 | catch (NoSuchMethodError e4) |
|
|
2608 | { |
|
|
2609 | } |
|
|
2610 | |
|
|
2611 | } |
|
|
2612 | |
|
|
2613 | int a = m.getAction(); |
|
|
2614 | if (a == MotionEvent.ACTION_DOWN) |
|
|
2615 | { |
|
|
2616 | try |
|
|
2617 | { |
|
|
2618 | if ((view_srec_x != 0) && (view_srec_y != 0)) |
|
|
2619 | { |
|
|
2620 | v.setX(view_srec_x + dp_to_px(0)); |
|
|
2621 | v.setY(view_srec_y + dp_to_px(3)); |
|
|
2622 | } |
|
|
2623 | } |
|
|
2624 | catch (NoSuchMethodError e2) |
|
|
2625 | { |
|
|
2626 | } |
|
|
2627 | } |
|
|
2628 | else if (a == MotionEvent.ACTION_UP) |
|
|
2629 | { |
|
|
2630 | try |
|
|
2631 | { |
|
|
2632 | if ((view_srec_x != 0) && (view_srec_y != 0)) |
|
|
2633 | { |
|
|
2634 | v.setX(view_srec_x); |
|
|
2635 | v.setY(view_srec_y); |
|
|
2636 | } |
|
|
2637 | } |
|
|
2638 | catch (NoSuchMethodError e2) |
|
|
2639 | { |
|
|
2640 | } |
|
|
2641 | } |
|
|
2642 | return false; |
|
|
2643 | } |
|
|
2644 | }); |
|
|
2645 | |
|
|
2646 | view_srec.setOnClickListener(new View.OnClickListener() |
|
|
2647 | { |
|
|
2648 | public void onClick(View v) |
|
|
2649 | { |
|
|
2650 | try |
|
|
2651 | { |
|
|
2652 | // open voice search screen |
|
|
2653 | Message msg = Navit.Navit_progress_h.obtainMessage(); |
|
|
2654 | Bundle b = new Bundle(); |
|
|
2655 | msg.what = 19; |
|
|
2656 | msg.setData(b); |
|
|
2657 | Navit.Navit_progress_h.sendMessage(msg); |
|
|
2658 | } |
|
|
2659 | catch (Exception e) |
|
|
2660 | { |
|
|
2661 | } |
|
|
2662 | } |
|
|
2663 | }); |
|
|
2664 | } |
|
|
2665 | |
|
|
2666 | View vv_compass = (View) activity.findViewById(R.id.osd_compass_new); |
|
|
2667 | vv_compass.bringToFront(); |
|
|
2668 | |
|
|
2669 | vv_compass.setOnClickListener(new View.OnClickListener() |
|
|
2670 | { |
|
|
2671 | public void onClick(View v) |
|
|
2672 | { |
|
|
2673 | try |
|
|
2674 | { |
|
|
2675 | if (NavitAndroidOverlay.measure_mode) |
|
|
2676 | { |
|
|
2677 | NavitAndroidOverlay.measure_mode = false; |
|
|
2678 | NavitAndroidOverlay.cleanup_measure_mode(); |
|
|
2679 | ZANaviLinearLayout.redraw_OSD(1); |
|
|
2680 | ZANaviLinearLayout.redraw_OSD(2); |
|
|
2681 | } |
|
|
2682 | else |
|
|
2683 | { |
|
|
2684 | NavitAndroidOverlay.measure_mode = true; |
|
|
2685 | ZANaviLinearLayout.redraw_OSD(1); |
|
|
2686 | ZANaviLinearLayout.redraw_OSD(2); |
|
|
2687 | } |
|
|
2688 | } |
|
|
2689 | catch (Exception e) |
|
|
2690 | { |
|
|
2691 | } |
|
|
2692 | } |
|
|
2693 | }); |
|
|
2694 | |
|
|
2695 | View vv_speeding = (View) activity.findViewById(R.id.view_speeding); |
|
|
2696 | vv_speeding.bringToFront(); |
|
|
2697 | |
|
|
2698 | View vv_laneassist = (View) activity.findViewById(R.id.view_laneassist); |
|
|
2699 | vv_laneassist.bringToFront(); |
|
|
2700 | |
|
|
2701 | whats_here_container_wrap = (RelativeLayout) activity.findViewById(R.id.whats_here_container_wrap); |
|
|
2702 | whats_here_container_wrap.bringToFront(); |
|
|
2703 | params_whats_here_container_wrap = (android.widget.RelativeLayout.LayoutParams) whats_here_container_wrap.getLayoutParams(); |
|
|
2704 | |
|
|
2705 | whats_here_pointer_image = (ImageView) activity.findViewById(R.id.whats_here_pointer_image); |
|
|
2706 | whats_here_pointer_image.bringToFront(); |
|
|
2707 | params_whats_here_pointer_image = (android.widget.RelativeLayout.LayoutParams) whats_here_pointer_image.getLayoutParams(); |
|
|
2708 | |
|
|
2709 | whats_here_button_add_to = (ImageButton) activity.findViewById(R.id.whats_here_button_add_to); |
|
|
2710 | whats_here_button_whats = (ImageButton) activity.findViewById(R.id.whats_here_button_whats); |
|
|
2711 | whats_here_button_drive = (ImageButton) activity.findViewById(R.id.whats_here_button_drive); |
|
|
2712 | whats_here_text = (TextView) activity.findViewById(R.id.whats_here_text); |
|
|
2713 | |
|
|
2714 | whats_here_button_drive.setOnClickListener(new View.OnClickListener() |
|
|
2715 | { |
|
|
2716 | public void onClick(View v) |
|
|
2717 | { |
|
|
2718 | try |
|
|
2719 | { |
|
|
2720 | NavitGraphics.NavitAOverlay_s.drive_button_clicked(); |
|
|
2721 | } |
|
|
2722 | catch (Exception e) |
|
|
2723 | { |
|
|
2724 | } |
|
|
2725 | } |
|
|
2726 | }); |
|
|
2727 | |
|
|
2728 | whats_here_button_whats.setOnClickListener(new View.OnClickListener() |
|
|
2729 | { |
|
|
2730 | public void onClick(View v) |
|
|
2731 | { |
|
|
2732 | try |
|
|
2733 | { |
|
|
2734 | NavitGraphics.NavitAOverlay_s.whats_button_clicked(); |
|
|
2735 | } |
|
|
2736 | catch (Exception e) |
|
|
2737 | { |
|
|
2738 | } |
|
|
2739 | } |
|
|
2740 | }); |
|
|
2741 | |
|
|
2742 | no_maps_container = (RelativeLayout) activity.findViewById(R.id.no_maps_container); |
|
|
2743 | no_maps_container.bringToFront(); |
|
|
2744 | try |
|
|
2745 | { |
|
|
2746 | NavitGraphics.no_maps_container.setVisibility(View.INVISIBLE); |
|
|
2747 | try |
|
|
2748 | { |
|
|
2749 | NavitGraphics.no_maps_container.setActivated(false); |
|
|
2750 | } |
|
|
2751 | catch (NoSuchMethodError e) |
|
|
2752 | { |
|
|
2753 | } |
|
|
2754 | } |
|
|
2755 | catch (Exception ee3) |
|
|
2756 | { |
|
|
2757 | } |
|
|
2758 | |
|
|
2759 | View vv_bottom_bar = (View) activity.findViewById(R.id.bottom_bar_slide); |
|
|
2760 | vv_bottom_bar.bringToFront(); |
|
|
2761 | |
|
|
2762 | vv_bottom_bar = (View) activity.findViewById(R.id.bottom_bar_container); |
|
|
2763 | vv_bottom_bar.bringToFront(); |
|
|
2764 | |
2377 | // x4x activity.setContentView(relativelayout); |
2765 | // x4x activity.setContentView(relativelayout); |
2378 | // view.setDrawingCacheEnabled(true); |
2766 | // view.setDrawingCacheEnabled(true); |
2379 | // view.buildDrawingCache(); |
2767 | // view.buildDrawingCache(); |
2380 | view.requestFocus(); |
2768 | view.requestFocus(); |
2381 | |
2769 | |
… | |
… | |
2435 | //draw_canvas.setDensity(Global_want_dpi); |
2823 | //draw_canvas.setDensity(Global_want_dpi); |
2436 | |
2824 | |
2437 | this.activity = activity; |
2825 | this.activity = activity; |
2438 | view = new View(activity) |
2826 | view = new View(activity) |
2439 | { |
2827 | { |
|
|
2828 | // Vehicle --------------------------- |
|
|
2829 | // Vehicle --------------------------- |
|
|
2830 | // Vehicle --------------------------- |
2440 | protected void onDraw(Canvas canvas) |
2831 | protected void onDraw(Canvas canvas) |
2441 | { |
2832 | { |
2442 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(0, "V"); |
2833 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(0, "V"); |
2443 | |
2834 | |
2444 | // System.out.println("V.Draw x"); |
2835 | // System.out.println("V.Draw x"); |
|
|
2836 | // System.out.println("onDraw:VVVVVVVVVVVVVVVVVVVVVV"); |
2445 | |
2837 | |
2446 | //System.out.println("V.Draw x="+NG__vehicle.vehicle_pos_x+" y="+NG__vehicle.vehicle_pos_y); |
2838 | //System.out.println("V.Draw x="+NG__vehicle.vehicle_pos_x+" y="+NG__vehicle.vehicle_pos_y); |
2447 | //System.out.println("V.Draw d=" + Navit.nav_arrow_stopped.getDensity()); |
2839 | //System.out.println("V.Draw d=" + Navit.nav_arrow_stopped.getDensity()); |
2448 | //System.out.println("V.Draw w=" + Navit.nav_arrow_stopped.getWidth()); |
2840 | //System.out.println("V.Draw w=" + Navit.nav_arrow_stopped.getWidth()); |
2449 | //System.out.println("V.Draw h=" + Navit.nav_arrow_stopped.getHeight()); |
2841 | //System.out.println("V.Draw h=" + Navit.nav_arrow_stopped.getHeight()); |
… | |
… | |
2453 | { |
2845 | { |
2454 | if (Navit.DEBUG_DRAW_VEHICLE) |
2846 | if (Navit.DEBUG_DRAW_VEHICLE) |
2455 | { |
2847 | { |
2456 | if (Navit.NG__vehicle.vehicle_speed < 3) |
2848 | if (Navit.NG__vehicle.vehicle_speed < 3) |
2457 | { |
2849 | { |
2458 | if (Navit.PREF_show_3d_map) |
2850 | if (Navit.p.PREF_show_3d_map) |
2459 | { |
2851 | { |
2460 | // 3D modus ----------------- |
2852 | // 3D modus ----------------- |
2461 | canvas.save(); |
2853 | canvas.save(); |
2462 | if (Navit.PREF_show_vehicle_3d) |
2854 | //if (Navit.PREF_show_vehicle_3d) |
|
|
2855 | //{ |
|
|
2856 | canvas.concat(cam_m_vehicle); |
|
|
2857 | |
|
|
2858 | if (Navit.GFX_OVERSPILL) |
2463 | { |
2859 | { |
2464 | canvas.concat(cam_m_vehicle); |
2860 | canvas.drawBitmap(Navit.nav_arrow_stopped_small, Navit.NG__vehicle.vehicle_pos_x - (Navit.nav_arrow_stopped_small.getWidth() / 2) - NavitGraphics.mCanvasWidth_overspill, Navit.NG__vehicle.vehicle_pos_y - (Navit.nav_arrow_stopped_small.getHeight() / 2) - NavitGraphics.mCanvasHeight_overspill, null); |
|
|
2861 | } |
|
|
2862 | else |
|
|
2863 | { |
2465 | canvas.drawBitmap(Navit.nav_arrow_stopped_small, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_stopped_small.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_stopped_small.getHeight() / 2, null); |
2864 | canvas.drawBitmap(Navit.nav_arrow_stopped_small, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_stopped_small.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_stopped_small.getHeight() / 2, null); |
2466 | } |
2865 | } |
|
|
2866 | //} |
2467 | // 3D modus ----------------- |
2867 | //// 3D modus ----------------- |
|
|
2868 | //else |
|
|
2869 | //{ |
|
|
2870 | // canvas.drawBitmap(Navit.nav_arrow_stopped, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_stopped.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_stopped.getHeight() / 2, null); |
|
|
2871 | //} |
|
|
2872 | } |
|
|
2873 | else |
|
|
2874 | { |
|
|
2875 | if (Navit.GFX_OVERSPILL) |
|
|
2876 | { |
|
|
2877 | canvas.drawBitmap(Navit.nav_arrow_stopped, Navit.NG__vehicle.vehicle_pos_x - (Navit.nav_arrow_stopped.getWidth() / 2) - NavitGraphics.mCanvasWidth_overspill, Navit.NG__vehicle.vehicle_pos_y - (Navit.nav_arrow_stopped.getHeight() / 2) - NavitGraphics.mCanvasHeight_overspill, null); |
|
|
2878 | } |
2468 | else |
2879 | else |
2469 | { |
2880 | { |
2470 | canvas.drawBitmap(Navit.nav_arrow_stopped, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_stopped.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_stopped.getHeight() / 2, null); |
2881 | canvas.drawBitmap(Navit.nav_arrow_stopped, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_stopped.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_stopped.getHeight() / 2, null); |
2471 | } |
2882 | } |
2472 | } |
2883 | } |
2473 | else |
|
|
2474 | { |
|
|
2475 | canvas.drawBitmap(Navit.nav_arrow_stopped, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_stopped.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_stopped.getHeight() / 2, null); |
|
|
2476 | } |
|
|
2477 | if (Navit.PREF_show_3d_map) |
2884 | if (Navit.p.PREF_show_3d_map) |
2478 | { |
2885 | { |
2479 | // 3D modus ----------------- |
2886 | // 3D modus ----------------- |
2480 | canvas.restore(); |
2887 | canvas.restore(); |
2481 | // 3D modus ----------------- |
2888 | // 3D modus ----------------- |
2482 | } |
2889 | } |
2483 | } |
2890 | } |
2484 | else |
2891 | else |
2485 | // speed >= 3 ----------- |
2892 | // speed >= 3 ----------- |
2486 | { |
2893 | { |
2487 | if ((Navit.NG__vehicle.vehicle_direction != 0) || (Navit.PREF_show_3d_map)) |
2894 | if ((Navit.NG__vehicle.vehicle_direction != 0) || (Navit.p.PREF_show_3d_map)) |
2488 | { |
2895 | { |
2489 | canvas.save(); |
2896 | canvas.save(); |
2490 | } |
2897 | } |
2491 | |
2898 | |
2492 | if (Navit.NG__vehicle.vehicle_direction != 0) |
2899 | if (Navit.NG__vehicle.vehicle_direction != 0) |
2493 | { |
2900 | { |
2494 | // rotate nav icon if needed |
2901 | // rotate nav icon if needed |
2495 | canvas.rotate(Navit.NG__vehicle.vehicle_direction, Navit.NG__vehicle.vehicle_pos_x, Navit.NG__vehicle.vehicle_pos_y); |
2902 | canvas.rotate(Navit.NG__vehicle.vehicle_direction, Navit.NG__vehicle.vehicle_pos_x, Navit.NG__vehicle.vehicle_pos_y); |
2496 | } |
2903 | } |
2497 | |
2904 | |
2498 | if (Navit.PREF_show_3d_map) |
2905 | if (Navit.p.PREF_show_3d_map) |
2499 | { |
2906 | { |
2500 | // 3D modus ----------------- |
2907 | // 3D modus ----------------- |
2501 | if (Navit.PREF_show_vehicle_3d) |
2908 | //if (Navit.PREF_show_vehicle_3d) |
|
|
2909 | //{ |
|
|
2910 | canvas.concat(cam_m_vehicle); |
|
|
2911 | |
|
|
2912 | if (Navit.GFX_OVERSPILL) |
2502 | { |
2913 | { |
2503 | canvas.concat(cam_m_vehicle); |
2914 | canvas.drawBitmap(Navit.nav_arrow_moving_shadow_small, 2 + Navit.NG__vehicle.vehicle_pos_x - (Navit.nav_arrow_moving_shadow_small.getWidth() / 2) - NavitGraphics.mCanvasWidth_overspill, 8 + Navit.NG__vehicle.vehicle_pos_y - (Navit.nav_arrow_moving_shadow_small.getHeight() / 2) - NavitGraphics.mCanvasHeight_overspill, null); |
|
|
2915 | canvas.drawBitmap(Navit.nav_arrow_moving_small, Navit.NG__vehicle.vehicle_pos_x - (Navit.nav_arrow_moving_small.getWidth() / 2) - NavitGraphics.mCanvasWidth_overspill, Navit.NG__vehicle.vehicle_pos_y - (Navit.nav_arrow_moving_small.getHeight() / 2) - NavitGraphics.mCanvasHeight_overspill, null); |
|
|
2916 | } |
|
|
2917 | else |
|
|
2918 | { |
2504 | // offset shadow x+2 , y+8 |
2919 | // offset shadow x+2 , y+8 |
2505 | canvas.drawBitmap(Navit.nav_arrow_moving_shadow_small, 2 + Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving_shadow_small.getWidth() / 2, 8 + Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving_shadow_small.getHeight() / 2, null); |
2920 | canvas.drawBitmap(Navit.nav_arrow_moving_shadow_small, 2 + Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving_shadow_small.getWidth() / 2, 8 + Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving_shadow_small.getHeight() / 2, null); |
2506 | canvas.drawBitmap(Navit.nav_arrow_moving_small, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving_small.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving_small.getHeight() / 2, null); |
2921 | canvas.drawBitmap(Navit.nav_arrow_moving_small, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving_small.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving_small.getHeight() / 2, null); |
2507 | } |
2922 | } |
|
|
2923 | //} |
2508 | // 3D modus ----------------- |
2924 | //// 3D modus ----------------- |
2509 | else |
2925 | //else |
2510 | { |
2926 | //{ |
2511 | // offset shadow x+2 , y+8 |
2927 | // // offset shadow x+2 , y+8 |
2512 | canvas.drawBitmap(Navit.nav_arrow_moving_shadow, 2 + Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving_shadow.getWidth() / 2, 8 + Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving_shadow.getHeight() / 2, null); |
2928 | // canvas.drawBitmap(Navit.nav_arrow_moving_shadow, 2 + Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving_shadow.getWidth() / 2, 8 + Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving_shadow.getHeight() / 2, null); |
2513 | canvas.drawBitmap(Navit.nav_arrow_moving, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving.getHeight() / 2, null); |
2929 | // canvas.drawBitmap(Navit.nav_arrow_moving, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving.getHeight() / 2, null); |
2514 | } |
2930 | //} |
2515 | } |
2931 | } |
2516 | else |
2932 | else |
2517 | // 2D map ----- |
2933 | // 2D map ----- |
2518 | { |
2934 | { |
2519 | // offset shadow x+2 , y+8 |
2935 | // offset shadow x+2 , y+8 |
2520 | canvas.drawBitmap(Navit.nav_arrow_moving_shadow, 2 + Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving_shadow.getWidth() / 2, 8 + Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving_shadow.getHeight() / 2, null); |
2936 | if (Navit.GFX_OVERSPILL) |
2521 | if (Navit.tunnel_extrapolation) |
|
|
2522 | { |
2937 | { |
|
|
2938 | canvas.drawBitmap(Navit.nav_arrow_moving_shadow, 2 + Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving_shadow.getWidth() / 2 - NavitGraphics.mCanvasWidth_overspill, 8 + Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving_shadow.getHeight() / 2 - NavitGraphics.mCanvasHeight_overspill, null); |
|
|
2939 | if (Navit.tunnel_extrapolation) |
|
|
2940 | { |
2523 | canvas.drawBitmap(Navit.nav_arrow_moving_grey, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving_grey.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving_grey.getHeight() / 2, null); |
2941 | canvas.drawBitmap(Navit.nav_arrow_moving_grey, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving_grey.getWidth() / 2 - NavitGraphics.mCanvasWidth_overspill, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving_grey.getHeight() / 2 - NavitGraphics.mCanvasHeight_overspill, null); |
|
|
2942 | } |
|
|
2943 | else |
|
|
2944 | { |
|
|
2945 | canvas.drawBitmap(Navit.nav_arrow_moving, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving.getWidth() / 2 - NavitGraphics.mCanvasWidth_overspill, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving.getHeight() / 2 - NavitGraphics.mCanvasHeight_overspill, null); |
|
|
2946 | } |
2524 | } |
2947 | } |
2525 | else |
2948 | else |
2526 | { |
2949 | { |
|
|
2950 | canvas.drawBitmap(Navit.nav_arrow_moving_shadow, 2 + Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving_shadow.getWidth() / 2, 8 + Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving_shadow.getHeight() / 2, null); |
|
|
2951 | if (Navit.tunnel_extrapolation) |
|
|
2952 | { |
|
|
2953 | canvas.drawBitmap(Navit.nav_arrow_moving_grey, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving_grey.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving_grey.getHeight() / 2, null); |
|
|
2954 | } |
|
|
2955 | else |
|
|
2956 | { |
2527 | canvas.drawBitmap(Navit.nav_arrow_moving, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving.getHeight() / 2, null); |
2957 | canvas.drawBitmap(Navit.nav_arrow_moving, Navit.NG__vehicle.vehicle_pos_x - Navit.nav_arrow_moving.getWidth() / 2, Navit.NG__vehicle.vehicle_pos_y - Navit.nav_arrow_moving.getHeight() / 2, null); |
|
|
2958 | } |
2528 | } |
2959 | } |
2529 | } |
2960 | } |
2530 | |
2961 | |
2531 | if ((Navit.NG__vehicle.vehicle_direction != 0) || (Navit.PREF_show_3d_map)) |
2962 | if ((Navit.NG__vehicle.vehicle_direction != 0) || (Navit.p.PREF_show_3d_map)) |
2532 | { |
2963 | { |
2533 | canvas.restore(); |
2964 | canvas.restore(); |
2534 | } |
2965 | } |
2535 | } |
2966 | } |
2536 | |
2967 | |
2537 | // paint the sweep spot of the vehicle position!! |
2968 | // paint the sweep spot of the vehicle position!! |
2538 | // Paint paint22 = new Paint(); |
2969 | // Paint paint22 = new Paint(); |
2539 | // paint22.setStyle(Paint.Style.FILL); |
2970 | // paint22.setStyle(Paint.Style.FILL); |
2540 | // paint22.setStrokeWidth(0); |
2971 | // paint22.setStrokeWidth(0); |
2541 | // paint22.setColor(Color.RED); |
2972 | // paint22.setColor(Color.RED); |
|
|
2973 | // if (Navit.GFX_OVERSPILL) |
|
|
2974 | // { |
|
|
2975 | // canvas.drawCircle(Navit.NG__vehicle.vehicle_pos_x - mCanvasWidth_overspill, Navit.NG__vehicle.vehicle_pos_y - mCanvasHeight_overspill, 5, paint22); |
|
|
2976 | // } |
|
|
2977 | // else |
|
|
2978 | // { |
2542 | // canvas.drawCircle(Navit.NG__vehicle.vehicle_pos_x, Navit.NG__vehicle.vehicle_pos_y, 5, paint22); |
2979 | // canvas.drawCircle(Navit.NG__vehicle.vehicle_pos_x, Navit.NG__vehicle.vehicle_pos_y, 5, paint22); |
|
|
2980 | // } |
2543 | // paint the sweep spot of the vehicle position!! |
2981 | // paint the sweep spot of the vehicle position!! |
2544 | } |
2982 | } |
2545 | } |
2983 | } |
2546 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(1, "V"); |
2984 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(1, "V"); |
2547 | } |
2985 | } |
2548 | |
2986 | |
2549 | @Override |
2987 | @Override |
2550 | protected void onSizeChanged(int w, int h, int oldw, int oldh) |
2988 | protected void onSizeChanged(int w, int h, int oldw, int oldh) |
2551 | { |
2989 | { |
2552 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); |
2990 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); |
2553 | System.out.println("new width=" + w + " new height=" + h); |
2991 | System.out.println("VV:new width=" + w + " new height=" + h); |
2554 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(1); |
2992 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(1); |
2555 | } |
2993 | } |
2556 | }; |
2994 | }; |
2557 | |
2995 | |
2558 | } // END IF: parent == 1 --------------- |
2996 | } // END IF: parent == 1 --------------- |
… | |
… | |
2637 | paint_dr_polyl.setStyle(Paint.Style.STROKE); |
3075 | paint_dr_polyl.setStyle(Paint.Style.STROKE); |
2638 | |
3076 | |
2639 | // Log.e("NavitGraphics","draw_polyline"); |
3077 | // Log.e("NavitGraphics","draw_polyline"); |
2640 | // paint.setStyle(Paint.Style.STROKE); |
3078 | // paint.setStyle(Paint.Style.STROKE); |
2641 | //b_paint_antialias = paint.isAntiAlias(); |
3079 | //b_paint_antialias = paint.isAntiAlias(); |
2642 | paint_dr_polyl.setAntiAlias(Navit.PREF_use_anti_aliasing); |
3080 | paint_dr_polyl.setAntiAlias(Navit.p.PREF_use_anti_aliasing); |
2643 | //paint.setStrokeWidth(0); |
3081 | //paint.setStrokeWidth(0); |
2644 | b_paint_path.reset(); |
3082 | b_paint_path.reset(); |
2645 | b_paint_path.moveTo(c[0], c[1]); |
3083 | b_paint_path.moveTo(c[0], c[1]); |
2646 | for (int i = 2; i < c.length; i += 2) |
3084 | for (int i = 2; i < c.length; i += 2) |
2647 | { |
3085 | { |
… | |
… | |
2676 | dl_thread[dl_thread_cur].add_lines3(paint, c, order, oneway); |
3114 | dl_thread[dl_thread_cur].add_lines3(paint, c, order, oneway); |
2677 | } |
3115 | } |
2678 | |
3116 | |
2679 | static void draw_polyline2_threads(Paint paint, int c[], int order, int oneway) |
3117 | static void draw_polyline2_threads(Paint paint, int c[], int order, int oneway) |
2680 | { |
3118 | { |
2681 | if (!Navit.PREF_gui_oneway_arrows) |
3119 | if (!Navit.p.PREF_gui_oneway_arrows) |
2682 | { |
3120 | { |
2683 | return; |
3121 | return; |
2684 | } |
3122 | } |
2685 | |
3123 | |
2686 | // line less than 44px -> dont draw arrow! |
3124 | // line less than 44px -> dont draw arrow! |
… | |
… | |
2690 | len = -len; |
3128 | len = -len; |
2691 | } |
3129 | } |
2692 | if (len > (2000)) |
3130 | if (len > (2000)) |
2693 | { |
3131 | { |
2694 | paint.setStyle(Paint.Style.STROKE); |
3132 | paint.setStyle(Paint.Style.STROKE); |
2695 | paint.setAntiAlias(Navit.PREF_use_anti_aliasing); |
3133 | paint.setAntiAlias(Navit.p.PREF_use_anti_aliasing); |
2696 | |
3134 | |
2697 | // create matrix for the manipulation |
3135 | // create matrix for the manipulation |
2698 | Matrix matrix_oneway_arrows2 = new Matrix(); |
3136 | Matrix matrix_oneway_arrows2 = new Matrix(); |
2699 | |
3137 | |
2700 | int middle_x = c[0] + (int) ((c[2] - c[0]) / 2); |
3138 | int middle_x = c[0] + (int) ((c[2] - c[0]) / 2); |
… | |
… | |
2744 | Matrix matrix_oneway_arrows2 = new Matrix(); |
3182 | Matrix matrix_oneway_arrows2 = new Matrix(); |
2745 | |
3183 | |
2746 | protected void draw_polyline2(int c[], int order, int oneway) |
3184 | protected void draw_polyline2(int c[], int order, int oneway) |
2747 | { |
3185 | { |
2748 | // Log.e("NavitGraphics", "draw_polyline2 count=" + c.length); |
3186 | // Log.e("NavitGraphics", "draw_polyline2 count=" + c.length); |
2749 | if (!Navit.PREF_gui_oneway_arrows) |
3187 | if (!Navit.p.PREF_gui_oneway_arrows) |
2750 | { |
3188 | { |
2751 | return; |
3189 | return; |
2752 | } |
3190 | } |
2753 | |
3191 | |
2754 | // Paint paint = new Paint(); |
3192 | // Paint paint = new Paint(); |
… | |
… | |
3174 | |
3612 | |
3175 | static void draw_polyline3_threads(Paint paint, int c[], int order, int width) |
3613 | static void draw_polyline3_threads(Paint paint, int c[], int order, int width) |
3176 | { |
3614 | { |
3177 | // Log.e("NavitGraphics","draw_polyline3_threads"); |
3615 | // Log.e("NavitGraphics","draw_polyline3_threads"); |
3178 | paint.setStyle(Paint.Style.STROKE); |
3616 | paint.setStyle(Paint.Style.STROKE); |
3179 | paint.setAntiAlias(Navit.PREF_use_anti_aliasing); |
3617 | paint.setAntiAlias(Navit.p.PREF_use_anti_aliasing); |
3180 | paint.setStrokeWidth(width); |
3618 | paint.setStrokeWidth(width); |
3181 | // ******************* |
3619 | // ******************* |
3182 | // ******************* |
3620 | // ******************* |
3183 | // ****** paint.setColor(Color.RED); |
3621 | // ****** paint.setColor(Color.RED); |
3184 | // ******************* |
3622 | // ******************* |
… | |
… | |
3219 | set_dashes(paint_dr_poly3, dashes, order); |
3657 | set_dashes(paint_dr_poly3, dashes, order); |
3220 | |
3658 | |
3221 | //Log.e("NavitGraphics","draw_polyline3"); |
3659 | //Log.e("NavitGraphics","draw_polyline3"); |
3222 | paint_dr_poly3.setStyle(Paint.Style.STROKE); |
3660 | paint_dr_poly3.setStyle(Paint.Style.STROKE); |
3223 | //b_paint_antialias = paint.isAntiAlias(); |
3661 | //b_paint_antialias = paint.isAntiAlias(); |
3224 | paint_dr_poly3.setAntiAlias(Navit.PREF_use_anti_aliasing); |
3662 | paint_dr_poly3.setAntiAlias(Navit.p.PREF_use_anti_aliasing); |
3225 | //wsave_003 = paint.getStrokeWidth(); |
3663 | //wsave_003 = paint.getStrokeWidth(); |
3226 | paint_dr_poly3.setStrokeWidth(width); |
3664 | paint_dr_poly3.setStrokeWidth(width); |
3227 | |
3665 | |
3228 | // make lines nicer ----------- |
3666 | // make lines nicer ----------- |
3229 | paint_dr_poly3.setStrokeMiter(1); |
3667 | paint_dr_poly3.setStrokeMiter(1); |
… | |
… | |
3404 | |
3842 | |
3405 | paint_dr_poly4.setARGB(a, r, g, b); |
3843 | paint_dr_poly4.setARGB(a, r, g, b); |
3406 | set_dashes(paint_dr_poly4, dashes, order); |
3844 | set_dashes(paint_dr_poly4, dashes, order); |
3407 | |
3845 | |
3408 | //b_paint_antialias = paint.isAntiAlias(); |
3846 | //b_paint_antialias = paint.isAntiAlias(); |
3409 | paint_dr_poly4.setAntiAlias(Navit.PREF_use_anti_aliasing); |
3847 | paint_dr_poly4.setAntiAlias(Navit.p.PREF_use_anti_aliasing); |
3410 | //wsave_004 = paint.getStrokeWidth(); |
3848 | //wsave_004 = paint.getStrokeWidth(); |
3411 | |
3849 | |
3412 | if (order <= DRAW_MORE_DETAILS_TUNNEL_BRIDGES_AT_ORDER) |
3850 | if (order <= DRAW_MORE_DETAILS_TUNNEL_BRIDGES_AT_ORDER) |
3413 | { |
3851 | { |
3414 | type = 0; |
3852 | type = 0; |
… | |
… | |
3513 | { |
3951 | { |
3514 | // type:0 -> normal line |
3952 | // type:0 -> normal line |
3515 | // type:1 -> underground (tunnel) |
3953 | // type:1 -> underground (tunnel) |
3516 | // type:2 -> bridge |
3954 | // type:2 -> bridge |
3517 | |
3955 | |
3518 | paint.setAntiAlias(Navit.PREF_use_anti_aliasing); |
3956 | paint.setAntiAlias(Navit.p.PREF_use_anti_aliasing); |
3519 | |
3957 | |
3520 | if (order <= DRAW_MORE_DETAILS_TUNNEL_BRIDGES_AT_ORDER) |
3958 | if (order <= DRAW_MORE_DETAILS_TUNNEL_BRIDGES_AT_ORDER) |
3521 | { |
3959 | { |
3522 | type = 0; |
3960 | type = 0; |
3523 | } |
3961 | } |
… | |
… | |
3621 | // |
4059 | // |
3622 | // |
4060 | // |
3623 | |
4061 | |
3624 | paint.setStyle(Paint.Style.STROKE); |
4062 | paint.setStyle(Paint.Style.STROKE); |
3625 | b_paint_antialias = paint.isAntiAlias(); |
4063 | b_paint_antialias = paint.isAntiAlias(); |
3626 | paint.setAntiAlias(Navit.PREF_use_anti_aliasing); |
4064 | paint.setAntiAlias(Navit.p.PREF_use_anti_aliasing); |
3627 | |
4065 | |
3628 | Boolean normal = false; |
4066 | Boolean normal = false; |
3629 | |
4067 | |
3630 | // create matrix for the manipulation |
4068 | // create matrix for the manipulation |
3631 | Matrix matrix = new Matrix(); |
4069 | Matrix matrix = new Matrix(); |
… | |
… | |
3639 | |
4077 | |
3640 | if (order > DRAW_ONEWAY_ARROWS_AT_ORDER) |
4078 | if (order > DRAW_ONEWAY_ARROWS_AT_ORDER) |
3641 | { |
4079 | { |
3642 | if (oneway == 1) |
4080 | if (oneway == 1) |
3643 | { |
4081 | { |
3644 | if (!Navit.PREF_gui_oneway_arrows) |
4082 | if (!Navit.p.PREF_gui_oneway_arrows) |
3645 | { |
4083 | { |
3646 | return; |
4084 | return; |
3647 | } |
4085 | } |
3648 | // rotate the Bitmap |
4086 | // rotate the Bitmap |
3649 | matrix.postRotate(angle); |
4087 | matrix.postRotate(angle); |
3650 | } |
4088 | } |
3651 | else if (oneway == 2) |
4089 | else if (oneway == 2) |
3652 | { |
4090 | { |
3653 | if (!Navit.PREF_gui_oneway_arrows) |
4091 | if (!Navit.p.PREF_gui_oneway_arrows) |
3654 | { |
4092 | { |
3655 | return; |
4093 | return; |
3656 | } |
4094 | } |
3657 | // rotate the Bitmap |
4095 | // rotate the Bitmap |
3658 | matrix.postRotate(angle + 180); |
4096 | matrix.postRotate(angle + 180); |
… | |
… | |
3710 | paint_draw_polygon.setStyle(Paint.Style.FILL); |
4148 | paint_draw_polygon.setStyle(Paint.Style.FILL); |
3711 | |
4149 | |
3712 | // Log.e("NavitGraphics", "polygon " + r + " " + g + " " + b + " " + a); |
4150 | // Log.e("NavitGraphics", "polygon " + r + " " + g + " " + b + " " + a); |
3713 | |
4151 | |
3714 | // b_paint_antialias = paint2.isAntiAlias(); |
4152 | // b_paint_antialias = paint2.isAntiAlias(); |
3715 | paint_draw_polygon.setAntiAlias(Navit.PREF_use_anti_aliasing); |
4153 | paint_draw_polygon.setAntiAlias(Navit.p.PREF_use_anti_aliasing); |
3716 | b_paint_path.reset(); |
4154 | b_paint_path.reset(); |
3717 | b_paint_path.moveTo(c[0], c[1]); |
4155 | b_paint_path.moveTo(c[0], c[1]); |
3718 | for (dr_poly_i = 2; dr_poly_i < c.length; dr_poly_i += 2) |
4156 | for (dr_poly_i = 2; dr_poly_i < c.length; dr_poly_i += 2) |
3719 | { |
4157 | { |
3720 | b_paint_path.lineTo(c[dr_poly_i], c[dr_poly_i + 1]); |
4158 | b_paint_path.lineTo(c[dr_poly_i], c[dr_poly_i + 1]); |
… | |
… | |
3725 | |
4163 | |
3726 | protected void draw_polygon2(Paint paint, int c[], int order, int oneway) |
4164 | protected void draw_polygon2(Paint paint, int c[], int order, int oneway) |
3727 | { |
4165 | { |
3728 | paint.setStyle(Paint.Style.FILL); |
4166 | paint.setStyle(Paint.Style.FILL); |
3729 | b_paint_antialias = paint.isAntiAlias(); |
4167 | b_paint_antialias = paint.isAntiAlias(); |
3730 | paint.setAntiAlias(Navit.PREF_use_anti_aliasing); |
4168 | paint.setAntiAlias(Navit.p.PREF_use_anti_aliasing); |
3731 | b_paint_path.reset(); |
4169 | b_paint_path.reset(); |
3732 | b_paint_path.moveTo(c[0], c[1]); |
4170 | b_paint_path.moveTo(c[0], c[1]); |
3733 | for (int i = 2; i < c.length; i += 2) |
4171 | for (int i = 2; i < c.length; i += 2) |
3734 | { |
4172 | { |
3735 | b_paint_path.lineTo(c[i], c[i + 1]); |
4173 | b_paint_path.lineTo(c[i], c[i + 1]); |
… | |
… | |
3738 | if (order > DRAW_ONEWAY_ARROWS_AT_ORDER) |
4176 | if (order > DRAW_ONEWAY_ARROWS_AT_ORDER) |
3739 | { |
4177 | { |
3740 | if (oneway == 1) |
4178 | if (oneway == 1) |
3741 | { |
4179 | { |
3742 | paint.setColor(Color.RED); |
4180 | paint.setColor(Color.RED); |
3743 | if (!Navit.PREF_gui_oneway_arrows) |
4181 | if (!Navit.p.PREF_gui_oneway_arrows) |
3744 | { |
4182 | { |
3745 | return; |
4183 | return; |
3746 | } |
4184 | } |
3747 | } |
4185 | } |
3748 | else if (oneway == 2) |
4186 | else if (oneway == 2) |
3749 | { |
4187 | { |
3750 | paint.setColor(Color.BLUE); |
4188 | paint.setColor(Color.BLUE); |
3751 | if (!Navit.PREF_gui_oneway_arrows) |
4189 | if (!Navit.p.PREF_gui_oneway_arrows) |
3752 | { |
4190 | { |
3753 | return; |
4191 | return; |
3754 | } |
4192 | } |
3755 | } |
4193 | } |
3756 | } |
4194 | } |
… | |
… | |
3763 | { |
4201 | { |
3764 | //Log.e("NavitGraphics","draw_rectangle"); |
4202 | //Log.e("NavitGraphics","draw_rectangle"); |
3765 | Rect r = new Rect(x, y, x + w, y + h); |
4203 | Rect r = new Rect(x, y, x + w, y + h); |
3766 | paint.setStyle(Paint.Style.FILL); |
4204 | paint.setStyle(Paint.Style.FILL); |
3767 | b_paint_antialias = paint.isAntiAlias(); |
4205 | b_paint_antialias = paint.isAntiAlias(); |
3768 | paint.setAntiAlias(Navit.PREF_use_anti_aliasing); |
4206 | paint.setAntiAlias(Navit.p.PREF_use_anti_aliasing); |
3769 | //paint.setStrokeWidth(0);d |
4207 | //paint.setStrokeWidth(0);d |
3770 | draw_canvas.drawRect(r, paint); |
4208 | draw_canvas.drawRect(r, paint); |
3771 | paint.setAntiAlias(b_paint_antialias); |
4209 | paint.setAntiAlias(b_paint_antialias); |
3772 | } |
4210 | } |
3773 | |
4211 | |
… | |
… | |
3777 | // float fx = x; |
4215 | // float fx = x; |
3778 | // float fy = y; |
4216 | // float fy = y; |
3779 | // float fr = r / 2; |
4217 | // float fr = r / 2; |
3780 | paint.setStyle(Paint.Style.STROKE); |
4218 | paint.setStyle(Paint.Style.STROKE); |
3781 | b_paint_antialias = paint.isAntiAlias(); |
4219 | b_paint_antialias = paint.isAntiAlias(); |
3782 | paint.setAntiAlias(Navit.PREF_use_anti_aliasing); |
4220 | paint.setAntiAlias(Navit.p.PREF_use_anti_aliasing); |
3783 | draw_canvas.drawCircle(x, y, r / 2, paint); |
4221 | draw_canvas.drawCircle(x, y, r / 2, paint); |
3784 | paint.setAntiAlias(b_paint_antialias); |
4222 | paint.setAntiAlias(b_paint_antialias); |
3785 | } |
4223 | } |
3786 | |
4224 | |
3787 | protected void draw_text__NEW(Paint paint, int x, int y, String text, int size, int dx, int dy) |
4225 | protected void draw_text__NEW(Paint paint, int x, int y, String text, int size, int dx, int dy) |
… | |
… | |
3805 | dl_thread_cur = 0; |
4243 | dl_thread_cur = 0; |
3806 | } |
4244 | } |
3807 | |
4245 | |
3808 | // FONT ------------------ |
4246 | // FONT ------------------ |
3809 | // FONT ------------------ |
4247 | // FONT ------------------ |
3810 | if (Navit.PREF_use_custom_font == true) |
4248 | if (Navit.p.PREF_use_custom_font == true) |
3811 | { |
4249 | { |
3812 | if (paint.getTypeface() == null) |
4250 | if (paint.getTypeface() == null) |
3813 | { |
4251 | { |
3814 | try |
4252 | try |
3815 | { |
4253 | { |
… | |
… | |
3838 | static void draw_text_threads(Paint paint, int x, int y, String text, int size, int dx, int dy) |
4276 | static void draw_text_threads(Paint paint, int x, int y, String text, int size, int dx, int dy) |
3839 | { |
4277 | { |
3840 | // float fx = x; |
4278 | // float fx = x; |
3841 | // float fy = y; |
4279 | // float fy = y; |
3842 | //Log.e("NavitGraphics","Text size "+size + " vs " + paint.getTextSize()); |
4280 | //Log.e("NavitGraphics","Text size "+size + " vs " + paint.getTextSize()); |
3843 | if (Navit.PREF_map_font_size != 2) |
4281 | if (Navit.p.PREF_map_font_size != 2) |
3844 | { |
4282 | { |
3845 | if (Navit.PREF_map_font_size == 3) |
4283 | if (Navit.p.PREF_map_font_size == 3) |
3846 | { |
4284 | { |
3847 | // large |
4285 | // large |
3848 | paint.setTextSize((int) ((size / 15) * 1.4)); |
4286 | paint.setTextSize((int) ((size / 15) * 1.4)); |
3849 | } |
4287 | } |
3850 | else if (Navit.PREF_map_font_size == 4) |
4288 | else if (Navit.p.PREF_map_font_size == 4) |
3851 | { |
4289 | { |
3852 | // extra large |
4290 | // extra large |
3853 | paint.setTextSize((int) ((size / 15) * 1.7)); |
4291 | paint.setTextSize((int) ((size / 15) * 1.7)); |
3854 | } |
4292 | } |
3855 | else if (Navit.PREF_map_font_size == 5) |
4293 | else if (Navit.p.PREF_map_font_size == 5) |
3856 | { |
4294 | { |
3857 | // extra large |
4295 | // extra large |
3858 | paint.setTextSize((int) ((size / 15) * 2.2)); |
4296 | paint.setTextSize((int) ((size / 15) * 2.2)); |
3859 | } |
4297 | } |
3860 | else if (Navit.PREF_map_font_size == 1) |
4298 | else if (Navit.p.PREF_map_font_size == 1) |
3861 | { |
4299 | { |
3862 | // small |
4300 | // small |
3863 | paint.setTextSize((int) ((size / 15) * 0.72)); |
4301 | paint.setTextSize((int) ((size / 15) * 0.72)); |
3864 | } |
4302 | } |
3865 | else |
4303 | else |
… | |
… | |
3874 | paint.setTextSize(size / 15); |
4312 | paint.setTextSize(size / 15); |
3875 | } |
4313 | } |
3876 | paint.setStyle(Paint.Style.FILL); |
4314 | paint.setStyle(Paint.Style.FILL); |
3877 | // FONT ------------------ |
4315 | // FONT ------------------ |
3878 | // FONT ------------------ |
4316 | // FONT ------------------ |
3879 | if (Navit.PREF_use_custom_font == true) |
4317 | if (Navit.p.PREF_use_custom_font == true) |
3880 | { |
4318 | { |
3881 | if (paint.getTypeface() == null) |
4319 | if (paint.getTypeface() == null) |
3882 | { |
4320 | { |
3883 | try |
4321 | try |
3884 | { |
4322 | { |
… | |
… | |
3898 | paint.setTypeface(null); |
4336 | paint.setTypeface(null); |
3899 | } |
4337 | } |
3900 | } |
4338 | } |
3901 | // FONT ------------------ |
4339 | // FONT ------------------ |
3902 | // FONT ------------------ |
4340 | // FONT ------------------ |
3903 | paint.setAntiAlias(Navit.PREF_use_anti_aliasing); |
4341 | paint.setAntiAlias(Navit.p.PREF_use_anti_aliasing); |
3904 | if (dx == 0x10000 && dy == 0) |
4342 | if (dx == 0x10000 && dy == 0) |
3905 | { |
4343 | { |
3906 | draw_canvas_s.drawText(text, x, y, paint); |
4344 | draw_canvas_s.drawText(text, x, y, paint); |
3907 | } |
4345 | } |
3908 | else |
4346 | else |
… | |
… | |
3924 | paint_draw_text.setARGB(a, r, g, b); |
4362 | paint_draw_text.setARGB(a, r, g, b); |
3925 | |
4363 | |
3926 | // float fx = x; |
4364 | // float fx = x; |
3927 | // float fy = y; |
4365 | // float fy = y; |
3928 | // Log.e("NavitGraphics", "Text size " + size + " " + r + " " + g + " " + b + " " + a); |
4366 | // Log.e("NavitGraphics", "Text size " + size + " " + r + " " + g + " " + b + " " + a); |
3929 | if (Navit.PREF_map_font_size != 2) |
4367 | if (Navit.p.PREF_map_font_size != 2) |
3930 | { |
4368 | { |
3931 | if (Navit.PREF_map_font_size == 3) |
4369 | if (Navit.p.PREF_map_font_size == 3) |
3932 | { |
4370 | { |
3933 | // large |
4371 | // large |
3934 | paint_draw_text.setTextSize((int) ((size / 15) * 1.4)); |
4372 | paint_draw_text.setTextSize((int) ((size / 15) * 1.4)); |
3935 | } |
4373 | } |
3936 | else if (Navit.PREF_map_font_size == 4) |
4374 | else if (Navit.p.PREF_map_font_size == 4) |
3937 | { |
4375 | { |
3938 | // extra large |
4376 | // extra large |
3939 | paint_draw_text.setTextSize((int) ((size / 15) * 1.7)); |
4377 | paint_draw_text.setTextSize((int) ((size / 15) * 1.7)); |
3940 | } |
4378 | } |
3941 | else if (Navit.PREF_map_font_size == 5) |
4379 | else if (Navit.p.PREF_map_font_size == 5) |
3942 | { |
4380 | { |
3943 | // extra large |
4381 | // extra large |
3944 | paint_draw_text.setTextSize((int) ((size / 15) * 2.2)); |
4382 | paint_draw_text.setTextSize((int) ((size / 15) * 2.2)); |
3945 | } |
4383 | } |
3946 | else if (Navit.PREF_map_font_size == 1) |
4384 | else if (Navit.p.PREF_map_font_size == 1) |
3947 | { |
4385 | { |
3948 | // small |
4386 | // small |
3949 | paint_draw_text.setTextSize((int) ((size / 15) * 0.72)); |
4387 | paint_draw_text.setTextSize((int) ((size / 15) * 0.72)); |
3950 | } |
4388 | } |
3951 | else |
4389 | else |
… | |
… | |
3960 | paint_draw_text.setTextSize(size / 15); |
4398 | paint_draw_text.setTextSize(size / 15); |
3961 | } |
4399 | } |
3962 | paint_draw_text.setStyle(Paint.Style.FILL); |
4400 | paint_draw_text.setStyle(Paint.Style.FILL); |
3963 | // FONT ------------------ |
4401 | // FONT ------------------ |
3964 | // FONT ------------------ |
4402 | // FONT ------------------ |
3965 | if (Navit.PREF_use_custom_font == true) |
4403 | if (Navit.p.PREF_use_custom_font == true) |
3966 | { |
4404 | { |
3967 | if (paint_draw_text.getTypeface() == null) |
4405 | if (paint_draw_text.getTypeface() == null) |
3968 | { |
4406 | { |
3969 | try |
4407 | try |
3970 | { |
4408 | { |
… | |
… | |
3987 | } |
4425 | } |
3988 | } |
4426 | } |
3989 | // FONT ------------------ |
4427 | // FONT ------------------ |
3990 | // FONT ------------------ |
4428 | // FONT ------------------ |
3991 | // b_paint_antialias = paint_draw_text.isAntiAlias(); |
4429 | // b_paint_antialias = paint_draw_text.isAntiAlias(); |
3992 | paint_draw_text.setAntiAlias(Navit.PREF_use_anti_aliasing); |
4430 | paint_draw_text.setAntiAlias(Navit.p.PREF_use_anti_aliasing); |
3993 | |
4431 | |
3994 | if (paint_draw_text.getTextSize() < 30) |
4432 | if (paint_draw_text.getTextSize() < 30) |
3995 | { |
4433 | { |
3996 | strokeTextPaint.setStrokeWidth(s_strokTextSize_min); |
4434 | strokeTextPaint.setStrokeWidth(s_strokTextSize_min); |
3997 | } |
4435 | } |
… | |
… | |
4013 | b_paint_path.reset(); |
4451 | b_paint_path.reset(); |
4014 | b_paint_path.moveTo(x, y); |
4452 | b_paint_path.moveTo(x, y); |
4015 | b_paint_path.rLineTo(dx, dy); |
4453 | b_paint_path.rLineTo(dx, dy); |
4016 | |
4454 | |
4017 | strokeTextPaint.setTextSize(paint_draw_text.getTextSize()); |
4455 | strokeTextPaint.setTextSize(paint_draw_text.getTextSize()); |
|
|
4456 | // draw shadow --- |
4018 | draw_canvas.drawTextOnPath(text, b_paint_path, 0, 0, strokeTextPaint); |
4457 | draw_canvas.drawTextOnPath(text, b_paint_path, 0, 0, strokeTextPaint); |
|
|
4458 | // draw shadow --- |
|
|
4459 | |
|
|
4460 | // draw normal text --- |
4019 | draw_canvas.drawTextOnPath(text, b_paint_path, 0, 0, paint_draw_text); |
4461 | draw_canvas.drawTextOnPath(text, b_paint_path, 0, 0, paint_draw_text); |
|
|
4462 | // draw normal text --- |
4020 | } |
4463 | } |
4021 | // paint.setAntiAlias(b_paint_antialias); |
4464 | // paint.setAntiAlias(b_paint_antialias); |
4022 | } |
4465 | } |
4023 | |
4466 | |
4024 | protected void draw_image(int x, int y, Bitmap bitmap, int r, int g, int b, int a) |
4467 | protected void draw_image(int x, int y, Bitmap bitmap, int r, int g, int b, int a) |
… | |
… | |
4163 | // text3 = 20:38 --> ETA time (+1 means next day!) |
4606 | // text3 = 20:38 --> ETA time (+1 means next day!) |
4164 | // System.out.println("destination_time:" + text3); |
4607 | // System.out.println("destination_time:" + text3); |
4165 | Navit.OSD_route_001.arriving_time = text3; |
4608 | Navit.OSD_route_001.arriving_time = text3; |
4166 | Navit.OSD_route_001.arriving_time_valid = true; |
4609 | Navit.OSD_route_001.arriving_time_valid = true; |
4167 | needed_value = true; |
4610 | needed_value = true; |
|
|
4611 | |
|
|
4612 | if (Navit.OSD_route_001.arriving_time.compareTo("") == 0) |
|
|
4613 | { |
|
|
4614 | ZANaviLinearLayout.redraw_OSD(7); |
|
|
4615 | ZANaviOSDETA.last_ondraw = -1; |
|
|
4616 | } |
|
|
4617 | else if (ZANaviOSDETA.last_ondraw == -1) |
|
|
4618 | { |
|
|
4619 | ZANaviLinearLayout.redraw_OSD(7); |
|
|
4620 | ZANaviOSDETA.last_ondraw = System.currentTimeMillis(); |
|
|
4621 | } |
|
|
4622 | else if ((ZANaviOSDETA.last_ondraw + 1400) < System.currentTimeMillis()) // only every 1.4 secs. |
|
|
4623 | { |
|
|
4624 | ZANaviLinearLayout.redraw_OSD(7); |
|
|
4625 | ZANaviOSDETA.last_ondraw = System.currentTimeMillis(); |
|
|
4626 | } |
|
|
4627 | return; |
|
|
4628 | } |
|
|
4629 | else if ((text2 != null) && (text2.equals("navigation:nav_position:destination_secs_time"))) |
|
|
4630 | { |
|
|
4631 | // text3 = 342 --> time to target in seconds |
|
|
4632 | // System.out.println("destination_secs_time:" + text3); |
|
|
4633 | |
|
|
4634 | if ((text3 == null) || (text3.equals(""))) |
|
|
4635 | { |
|
|
4636 | Navit.OSD_route_001.arriving_secs_to_dest = ""; |
|
|
4637 | Navit.OSD_route_001.arriving_secs_to_dest_valid = false; |
|
|
4638 | } |
|
|
4639 | else |
|
|
4640 | { |
|
|
4641 | int secs = (Integer.parseInt(text3)) + 30; // add 30 secs to round up to next minute |
|
|
4642 | // System.out.println("SSS:secs=" + text3); |
|
|
4643 | |
|
|
4644 | // int seconds = (int) (secs) % 60; |
|
|
4645 | int minutes = (int) ((secs / (60)) % 60); |
|
|
4646 | int hours = (int) ((secs / (60 * 60)) % 24); |
|
|
4647 | int days = (int) ((secs / (60 * 60)) / 24); |
|
|
4648 | |
|
|
4649 | String days_ = ""; |
|
|
4650 | if (days > 0) |
|
|
4651 | { |
|
|
4652 | days_ = "" + days + "d "; |
|
|
4653 | } |
|
|
4654 | |
|
|
4655 | if ((hours > 0) || (days > 0)) |
|
|
4656 | { |
|
|
4657 | Navit.OSD_route_001.arriving_secs_to_dest = days_ + hours + "h " + minutes + "m"; |
|
|
4658 | } |
|
|
4659 | else |
|
|
4660 | { |
|
|
4661 | Navit.OSD_route_001.arriving_secs_to_dest = "" + minutes + " min"; |
|
|
4662 | } |
|
|
4663 | Navit.OSD_route_001.arriving_secs_to_dest_valid = true; |
|
|
4664 | needed_value = true; |
|
|
4665 | } |
|
|
4666 | |
|
|
4667 | ZANaviLinearLayout.redraw_OSD(5); |
|
|
4668 | return; |
|
|
4669 | |
4168 | } |
4670 | } |
4169 | else if ((text2 != null) && (text2.equals("navigation:nav_position:destination_length"))) |
4671 | else if ((text2 != null) && (text2.equals("navigation:nav_position:destination_length"))) |
4170 | { |
4672 | { |
4171 | // text3 = 575m -> driving distance to target |
4673 | // text3 = 575m -> driving distance to target |
4172 | // System.out.println("destination_length:" + text3); |
4674 | // System.out.println("destination_length:" + text3); |
4173 | Navit.OSD_route_001.driving_distance_to_target = text3; |
4675 | Navit.OSD_route_001.driving_distance_to_target = text3; |
4174 | Navit.OSD_route_001.driving_distance_to_target_valid = true; |
4676 | Navit.OSD_route_001.driving_distance_to_target_valid = true; |
4175 | needed_value = true; |
4677 | needed_value = true; |
|
|
4678 | |
|
|
4679 | ZANaviLinearLayout.redraw_OSD(6); |
|
|
4680 | return; |
4176 | } |
4681 | } |
4177 | else if ((text2 != null) && (text2.length() > 10) && (text2.substring(0, 11).equals("navigation:"))) |
4682 | else if ((text2 != null) && (text2.length() > 10) && (text2.substring(0, 11).equals("navigation:"))) |
4178 | { |
4683 | { |
4179 | String[] tmp_string = text2.split(":", 3); |
4684 | String[] tmp_string = text2.split(":", 3); |
4180 | if (tmp_string.length == 3) |
4685 | if (tmp_string.length == 3) |
… | |
… | |
4187 | Navit.OSD_nextturn.nextturn_distance = text3; |
4692 | Navit.OSD_nextturn.nextturn_distance = text3; |
4188 | Navit.OSD_nextturn.nextturn_distance_valid = true; |
4693 | Navit.OSD_nextturn.nextturn_distance_valid = true; |
4189 | // we need to paint the OSD in any case |
4694 | // we need to paint the OSD in any case |
4190 | last_paint_OSD = -1; |
4695 | last_paint_OSD = -1; |
4191 | needed_value = true; |
4696 | needed_value = true; |
|
|
4697 | |
|
|
4698 | ZANaviLinearLayout.redraw_OSD(4); |
|
|
4699 | return; |
4192 | } |
4700 | } |
4193 | else if (tmp_string[2].equals("street_name_systematic")) |
4701 | else if (tmp_string[2].equals("street_name_systematic")) |
4194 | { |
4702 | { |
4195 | // "navigation:******:street_name_systematic" |
4703 | // "navigation:******:street_name_systematic" |
4196 | //System.out.println("nextturn_streetname_systematic:" + text3); |
4704 | // System.out.println("nextturn_streetname_systematic:" + text3); |
4197 | Navit.OSD_nextturn.nextturn_streetname_systematic = text3; |
4705 | Navit.OSD_nextturn.nextturn_streetname_systematic = text3; |
4198 | needed_value = true; |
4706 | needed_value = true; |
|
|
4707 | |
|
|
4708 | ZANaviLinearLayout.redraw_OSD(1); |
|
|
4709 | return; |
4199 | } |
4710 | } |
4200 | else if (tmp_string[2].equals("street_name")) |
4711 | else if (tmp_string[2].equals("street_name")) |
4201 | { |
4712 | { |
4202 | // "navigation:******:street_name" |
4713 | // "navigation:******:street_name" |
4203 | //System.out.println("nextturn_streetname:" + text3); |
4714 | // System.out.println("nextturn_streetname:" + text3); |
4204 | Navit.OSD_nextturn.nextturn_streetname = text3; |
4715 | Navit.OSD_nextturn.nextturn_streetname = text3; |
4205 | needed_value = true; |
4716 | needed_value = true; |
4206 | } |
4717 | } |
4207 | } |
4718 | } |
4208 | } |
4719 | } |
… | |
… | |
4210 | { |
4721 | { |
4211 | if (NavitGraphics.navit_route_status == 0) |
4722 | if (NavitGraphics.navit_route_status == 0) |
4212 | { |
4723 | { |
4213 | if (text2.equals("tracking:street_name:")) |
4724 | if (text2.equals("tracking:street_name:")) |
4214 | { |
4725 | { |
4215 | //System.out.println("t2" + text2 + text3); |
4726 | // System.out.println("t2:" + text2 + text3); |
4216 | Navit.OSD_nextturn.nextturn_streetname = text3; |
4727 | Navit.OSD_nextturn.nextturn_streetname = text3; |
4217 | last_paint_OSD = -1; |
4728 | last_paint_OSD = -1; |
4218 | needed_value = true; |
4729 | needed_value = true; |
|
|
4730 | |
|
|
4731 | ZANaviLinearLayout.redraw_OSD(1); |
|
|
4732 | return; |
4219 | } |
4733 | } |
4220 | else if (text2.equals("tracking:street_name_systematic:")) |
4734 | else if (text2.equals("tracking:street_name_systematic:")) |
4221 | { |
4735 | { |
4222 | //System.out.println("t1" + text2 + text3); |
4736 | // System.out.println("t1:" + text2 + text3); |
4223 | Navit.OSD_nextturn.nextturn_streetname_systematic = text3; |
4737 | Navit.OSD_nextturn.nextturn_streetname_systematic = text3; |
4224 | needed_value = true; |
4738 | needed_value = true; |
4225 | } |
4739 | } |
4226 | } |
4740 | } |
4227 | } |
4741 | } |
… | |
… | |
4240 | if ((text2 == null) || (text2.equals(""))) |
4754 | if ((text2 == null) || (text2.equals(""))) |
4241 | { |
4755 | { |
4242 | Navit.OSD_nextturn.nextturn_image_valid = false; |
4756 | Navit.OSD_nextturn.nextturn_image_valid = false; |
4243 | Navit.OSD_nextturn.nextturn_image.recycle(); |
4757 | Navit.OSD_nextturn.nextturn_image.recycle(); |
4244 | } |
4758 | } |
|
|
4759 | |
4245 | if (!Navit.OSD_nextturn.nextturn_image_filename.equals(text2)) |
4760 | if (!Navit.OSD_nextturn.nextturn_image_filename.equals(text2)) |
4246 | { |
4761 | { |
4247 | // only if image is different from current image |
4762 | // only if image is different from current image |
4248 | Navit.OSD_nextturn.nextturn_image_filename = text2; |
4763 | Navit.OSD_nextturn.nextturn_image_filename = text2; |
4249 | Navit.OSD_nextturn.nextturn_image_filename_valid = true; |
4764 | Navit.OSD_nextturn.nextturn_image_filename_valid = true; |
… | |
… | |
4263 | int ResId = Navit.res_.getIdentifier("com.zoffcc.applications.zanavi:drawable/" + x, null, null); |
4778 | int ResId = Navit.res_.getIdentifier("com.zoffcc.applications.zanavi:drawable/" + x, null, null); |
4264 | // System.out.println("ResId: " + ResId); |
4779 | // System.out.println("ResId: " + ResId); |
4265 | Navit.OSD_nextturn.nextturn_image = BitmapFactory.decodeResource(Navit.res_, ResId); |
4780 | Navit.OSD_nextturn.nextturn_image = BitmapFactory.decodeResource(Navit.res_, ResId); |
4266 | Navit.OSD_nextturn.nextturn_image_valid = true; |
4781 | Navit.OSD_nextturn.nextturn_image_valid = true; |
4267 | } |
4782 | } |
|
|
4783 | |
|
|
4784 | ZANaviLinearLayout.redraw_OSD(3); |
|
|
4785 | return; |
|
|
4786 | |
4268 | } |
4787 | } |
4269 | needed_value = true; |
4788 | needed_value = true; |
4270 | } |
4789 | } |
4271 | else if (id.equals("compass")) |
4790 | else if (id.equals("compass")) |
4272 | { |
4791 | { |
… | |
… | |
4300 | { |
4819 | { |
4301 | // Navit.OSD_compass.angle_north = Float.parseFloat(text2); |
4820 | // Navit.OSD_compass.angle_north = Float.parseFloat(text2); |
4302 | Navit.OSD_compass.angle_north = i1; |
4821 | Navit.OSD_compass.angle_north = i1; |
4303 | Navit.OSD_compass.angle_north_valid = true; |
4822 | Navit.OSD_compass.angle_north_valid = true; |
4304 | needed_value = true; |
4823 | needed_value = true; |
|
|
4824 | |
|
|
4825 | ZANaviLinearLayout.redraw_OSD(2); |
|
|
4826 | return; |
4305 | } |
4827 | } |
4306 | catch (Exception e) |
4828 | catch (Exception e) |
4307 | { |
4829 | { |
4308 | //e.printStackTrace(); |
4830 | //e.printStackTrace(); |
4309 | |
4831 | |
… | |
… | |
4331 | { |
4853 | { |
4332 | try |
4854 | try |
4333 | { |
4855 | { |
4334 | last_paint_OSD = System.currentTimeMillis(); |
4856 | last_paint_OSD = System.currentTimeMillis(); |
4335 | //System.out.println("xx paint 1 xx"); |
4857 | //System.out.println("xx paint 1 xx"); |
4336 | NavitOSDJava.draw_real_wrapper(true, false); |
4858 | // **************NNNNNN*********** // NavitOSDJava.draw_real_wrapper(true, false); |
4337 | //++NavitAOSDJava_.postInvalidate(); |
4859 | //++NavitAOSDJava_.postInvalidate(); |
4338 | } |
4860 | } |
4339 | catch (Exception r) |
4861 | catch (Exception r) |
4340 | { |
4862 | { |
4341 | //r.printStackTrace(); |
4863 | //r.printStackTrace(); |
… | |
… | |
4349 | { |
4871 | { |
4350 | try |
4872 | try |
4351 | { |
4873 | { |
4352 | last_paint_OSD = System.currentTimeMillis(); |
4874 | last_paint_OSD = System.currentTimeMillis(); |
4353 | //System.out.println("xx paint 2 xx"); |
4875 | //System.out.println("xx paint 2 xx"); |
4354 | NavitOSDJava.draw_real_wrapper(true, false); |
4876 | // **************NNNNNN*********** // NavitOSDJava.draw_real_wrapper(true, false); |
4355 | // * works * // NavitOSDJava.draw_real_wrapper(true, true); |
4877 | // * works * // NavitOSDJava.draw_real_wrapper(true, true); |
4356 | } |
4878 | } |
4357 | catch (Exception r) |
4879 | catch (Exception r) |
4358 | { |
4880 | { |
4359 | //r.printStackTrace(); |
4881 | //r.printStackTrace(); |
… | |
… | |
4384 | { |
4906 | { |
4385 | //System.out.println("DO__DRAW:copy_map_buffer:drawBitmap start"); |
4907 | //System.out.println("DO__DRAW:copy_map_buffer:drawBitmap start"); |
4386 | draw_canvas_screen_s.drawBitmap(draw_bitmap_s, 0, 0, null); |
4908 | draw_canvas_screen_s.drawBitmap(draw_bitmap_s, 0, 0, null); |
4387 | //System.out.println("DO__DRAW:copy_map_buffer:drawBitmap end"); |
4909 | //System.out.println("DO__DRAW:copy_map_buffer:drawBitmap end"); |
4388 | |
4910 | |
4389 | if (Navit.PREF_show_route_rects) |
4911 | if (Navit.p.PREF_show_route_rects) |
4390 | { |
4912 | { |
|
|
4913 | // System.out.println("route_rect::start"); |
|
|
4914 | |
4391 | // --- draw debug route rects ---- |
4915 | // --- draw debug route rects ---- |
|
|
4916 | Paint paint78 = new Paint(); |
|
|
4917 | paint78.setStrokeWidth(15); |
|
|
4918 | paint78.setStyle(Style.STROKE); |
|
|
4919 | |
4392 | int i3 = 0; |
4920 | int i3 = 0; |
4393 | for (i3 = 0; i3 < route_rects.size(); i3++) |
4921 | for (i3 = 0; i3 < route_rects.size(); i3++) |
4394 | { |
4922 | { |
4395 | route_rect rr = route_rects.get(i3); |
4923 | route_rect rr = route_rects.get(i3); |
4396 | Paint paint78 = new Paint(); |
|
|
4397 | if (rr.order == -99) |
4924 | if (rr.order == -99) |
4398 | { |
4925 | { |
4399 | // rectangle to just include all waypoints |
4926 | // rectangle to just include all waypoints |
4400 | paint78.setColor(Color.RED); |
4927 | paint78.setColor(Color.RED); |
4401 | } |
4928 | } |
4402 | else if (rr.order == 8) |
4929 | else if (rr.order == 8) |
4403 | { |
4930 | { |
4404 | // rectangle around every waypoint with low detail (order = 8) |
4931 | // rectangle around every waypoint with low detail (order = 8) // larger roads |
4405 | paint78.setColor(Color.GREEN); |
4932 | paint78.setColor(Color.GREEN); |
4406 | } |
4933 | } |
4407 | else if (rr.order == 18) |
4934 | else if (rr.order == 18) |
4408 | { |
4935 | { |
4409 | // rectangle around every waypoint with high detail (order = 18) |
4936 | // rectangle around every waypoint with high detail (order = 18) // all small roads |
4410 | paint78.setColor(Color.MAGENTA); |
4937 | paint78.setColor(Color.MAGENTA); |
4411 | } |
4938 | } |
4412 | else if (rr.order == 4) |
4939 | else if (rr.order == 4) |
4413 | { |
4940 | { |
4414 | // rectangles ?? |
4941 | // rectangles ?? |
… | |
… | |
4422 | else if (rr.order == 7) |
4949 | else if (rr.order == 7) |
4423 | { |
4950 | { |
4424 | // rectangles ?? |
4951 | // rectangles ?? |
4425 | paint78.setColor(Color.YELLOW); |
4952 | paint78.setColor(Color.YELLOW); |
4426 | } |
4953 | } |
4427 | |
|
|
4428 | paint78.setStrokeWidth(15); |
|
|
4429 | paint78.setStyle(Style.STROKE); |
|
|
4430 | |
4954 | |
4431 | String left_top_on_screen_string = CallbackGeoCalc(11, rr.x1, rr.y1); |
4955 | String left_top_on_screen_string = CallbackGeoCalc(11, rr.x1, rr.y1); |
4432 | String tmp[] = left_top_on_screen_string.split(":", 2); |
4956 | String tmp[] = left_top_on_screen_string.split(":", 2); |
4433 | int xx1 = Integer.parseInt(tmp[0]); |
4957 | int xx1 = Integer.parseInt(tmp[0]); |
4434 | int yy1 = Integer.parseInt(tmp[1]); |
4958 | int yy1 = Integer.parseInt(tmp[1]); |
4435 | //System.out.println(" " + xx1 + "," + yy1); |
4959 | // System.out.println("route_rect:: " + xx1 + "," + yy1); |
4436 | |
4960 | |
4437 | left_top_on_screen_string = CallbackGeoCalc(11, rr.x2, rr.y2); |
4961 | left_top_on_screen_string = CallbackGeoCalc(11, rr.x2, rr.y2); |
4438 | tmp = left_top_on_screen_string.split(":", 2); |
4962 | tmp = left_top_on_screen_string.split(":", 2); |
4439 | int xx2 = Integer.parseInt(tmp[0]); |
4963 | int xx2 = Integer.parseInt(tmp[0]); |
4440 | int yy2 = Integer.parseInt(tmp[1]); |
4964 | int yy2 = Integer.parseInt(tmp[1]); |
4441 | //System.out.println(" " + xx2 + "," + yy2); |
4965 | // System.out.println("route_rect:: " + xx2 + "," + yy2); |
4442 | |
4966 | |
4443 | // draw the route rectanlge |
4967 | // draw the route rectanlge |
4444 | draw_canvas_screen_s.drawRect(xx1, yy1, xx2, yy2, paint78); |
4968 | draw_canvas_screen_s.drawRect(xx1 / Global_dpi_factor, yy1 / Global_dpi_factor, xx2 / Global_dpi_factor, yy2 / Global_dpi_factor, paint78); |
4445 | } |
4969 | } |
4446 | // --- draw debug route rects ---- |
4970 | // --- draw debug route rects ---- |
4447 | } |
4971 | } |
4448 | } |
4972 | } |
4449 | catch (Exception e) |
4973 | catch (Exception e) |
… | |
… | |
5457 | /** |
5981 | /** |
5458 | * return search result from C-code |
5982 | * return search result from C-code |
5459 | */ |
5983 | */ |
5460 | public void fillStringArray(String s) |
5984 | public void fillStringArray(String s) |
5461 | { |
5985 | { |
|
|
5986 | |
|
|
5987 | if (Navit.index_search_realtime) |
|
|
5988 | { |
|
|
5989 | NavitAddressSearchActivity.fillStringArrayNew(s); |
|
|
5990 | return; |
|
|
5991 | } |
|
|
5992 | |
5462 | //Log.e("NavitGraphics", "**** fillStringArray s=" + s); |
5993 | //Log.e("NavitGraphics", "**** fillStringArray s=" + s); |
5463 | // deactivate the spinner |
5994 | // deactivate the spinner |
5464 | // --> no we want to spin ** Navit.NavitAddressSearchSpinnerActive = false; |
5995 | // --> no we want to spin ** Navit.NavitAddressSearchSpinnerActive = false; |
5465 | |
5996 | |
5466 | if (s.equals("D:D")) |
5997 | if (s.equals("D:D")) |
… | |
… | |
5816 | |
6347 | |
5817 | // i=1 -> pixel a,b (x,y) -> geo string "lat(float)#lng(float)" |
6348 | // i=1 -> pixel a,b (x,y) -> geo string "lat(float)#lng(float)" |
5818 | // i=2 -> geo a,b (lat,lng) -> pixel string "x(int)#y(int)" |
6349 | // i=2 -> geo a,b (lat,lng) -> pixel string "x(int)#y(int)" |
5819 | public static native String CallbackGeoCalc(int i, float a, float b); |
6350 | public static native String CallbackGeoCalc(int i, float a, float b); |
5820 | |
6351 | |
|
|
6352 | public static native String[] GetRoadBookItems(int result_id); |
|
|
6353 | |
|
|
6354 | @SuppressLint("NewApi") |
5821 | public static void send_generic_text(int id, String text) |
6355 | public static void send_generic_text(int id, String text) |
5822 | { |
6356 | { |
5823 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); |
6357 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); |
5824 | |
6358 | |
5825 | //System.out.println("NavitOSDJava:" + id + ":" + text); |
6359 | // System.out.println("NavitOSDJava:" + id + ":" + text); |
5826 | |
6360 | |
5827 | if (id == 1) |
6361 | if (id == 1) |
5828 | { |
6362 | { |
5829 | // speech textblock |
6363 | // speech textblock |
5830 | if (NavitGraphics.NavitMsgTv2_.getVisibility() == View.VISIBLE) |
6364 | if (NavitGraphics.NavitMsgTv2_.getVisibility() == View.VISIBLE) |
… | |
… | |
5863 | //System.out.println("lane_choices2=" + text); |
6397 | //System.out.println("lane_choices2=" + text); |
5864 | Navit.lane_choices2 = text; |
6398 | Navit.lane_choices2 = text; |
5865 | } |
6399 | } |
5866 | else if (id == 8) |
6400 | else if (id == 8) |
5867 | { |
6401 | { |
5868 | if (Navit.PREF_lane_assist) |
6402 | if (Navit.p.PREF_lane_assist) |
5869 | { |
6403 | { |
5870 | |
6404 | |
5871 | // lanes: |
6405 | // lanes: |
5872 | // |
6406 | // |
5873 | // none |
6407 | // none |
… | |
… | |
5917 | } |
6451 | } |
5918 | } |
6452 | } |
5919 | } |
6453 | } |
5920 | else if (id == 9) |
6454 | else if (id == 9) |
5921 | { |
6455 | { |
5922 | if (Navit.PREF_lane_assist) |
6456 | if (Navit.p.PREF_lane_assist) |
5923 | { |
6457 | { |
5924 | |
6458 | |
5925 | // next lanes: |
6459 | // next lanes: |
5926 | // |
6460 | // |
5927 | // none |
6461 | // none |
… | |
… | |
5970 | Navit.lanes_text1 = ""; |
6504 | Navit.lanes_text1 = ""; |
5971 | } |
6505 | } |
5972 | |
6506 | |
5973 | // this is the last element -> so draw only HERE !! |
6507 | // this is the last element -> so draw only HERE !! |
5974 | //System.out.println("xx paint 3 xx"); |
6508 | //System.out.println("xx paint 3 xx"); |
5975 | NavitOSDJava.draw_real_wrapper(false, true); |
6509 | // NavitOSDJava.draw_real_wrapper(true, false); |
5976 | |
6510 | ZANaviLinearLayout.redraw_OSD(9); |
5977 | } |
6511 | } |
5978 | } |
6512 | } |
5979 | else if (id == 13) // current segment length (in meters) |
6513 | else if (id == 13) // current segment length (in meters) |
5980 | { |
6514 | { |
5981 | // System.out.println("seg_len=" + text); |
6515 | // System.out.println("seg_len=" + text); |
… | |
… | |
5983 | Navit.seg_len = Integer.parseInt(text); |
6517 | Navit.seg_len = Integer.parseInt(text); |
5984 | } |
6518 | } |
5985 | else if (id == 20) // speech commads debug info |
6519 | else if (id == 20) // speech commads debug info |
5986 | { |
6520 | { |
5987 | |
6521 | |
|
|
6522 | } |
|
|
6523 | else if (id == 21) // earth radius |
|
|
6524 | { |
|
|
6525 | Navit.__EARTH_RADIUS__ = Double.parseDouble(text); |
|
|
6526 | System.out.println("__EARTH_RADIUS__=" + Navit.__EARTH_RADIUS__); |
|
|
6527 | } |
|
|
6528 | else if (id == 22) // map accuarcy factor |
|
|
6529 | { |
|
|
6530 | Navit.__GEO_ACCURACY_FACTOR__ = Double.parseDouble(text); |
|
|
6531 | System.out.println("__GEO_ACCURACY_FACTOR__=" + Navit.__GEO_ACCURACY_FACTOR__); |
|
|
6532 | } |
|
|
6533 | else if (id == 31) |
|
|
6534 | { |
|
|
6535 | // we found a mapfile thats too old, need to update |
|
|
6536 | try |
|
|
6537 | { |
|
|
6538 | String text2 = text.replaceAll("[\n\r]", ""); |
|
|
6539 | // System.out.println("MAPFILE TOO OLD:x:<map version>:<min.needed version>:<map filename>" + text2); |
|
|
6540 | String mapfilename = text2.split(":", 3)[2]; |
|
|
6541 | File f = new File(mapfilename); |
|
|
6542 | String mapfilename_without_path = f.getName(); |
|
|
6543 | int have_version = Integer.parseInt(text2.split(":", 3)[0]); |
|
|
6544 | int need_version = Integer.parseInt(text2.split(":", 3)[1]); |
|
|
6545 | System.out.println("MAPFILE TOO OLD:y:<map version>:<min.needed version>:<map filename>" + have_version + ":" + need_version + ":" + mapfilename_without_path); |
|
|
6546 | String cat_mapfilename = NavitMapDownloader.is_in_cat_file_disk_name(mapfilename_without_path); |
|
|
6547 | System.out.println("MAPFILE TOO OLD:y:<map version>:<min.needed version>:<map filename>" + have_version + ":" + need_version + ":" + cat_mapfilename); |
|
|
6548 | |
|
|
6549 | Navit.Navit_maps_too_old = true; |
|
|
6550 | |
|
|
6551 | if (Navit.have_maps_installed()) |
|
|
6552 | { |
|
|
6553 | try |
|
|
6554 | { |
|
|
6555 | TextView no_maps_text = (TextView) Navit.Global_Navit_Object.findViewById(R.id.no_maps_text); |
|
|
6556 | no_maps_text.setText("\n\n\n" + Navit.get_text("Some Maps are too old!") + "\n" + Navit.get_text("Please update your maps") + "\n\n"); |
|
|
6557 | |
|
|
6558 | NavitGraphics.no_maps_container.setVisibility(View.VISIBLE); |
|
|
6559 | try |
|
|
6560 | { |
|
|
6561 | NavitGraphics.no_maps_container.setActivated(true); |
|
|
6562 | } |
|
|
6563 | catch (NoSuchMethodError e) |
|
|
6564 | { |
|
|
6565 | } |
|
|
6566 | NavitGraphics.no_maps_container.bringToFront(); |
|
|
6567 | } |
|
|
6568 | catch (Exception e) |
|
|
6569 | { |
|
|
6570 | e.printStackTrace(); |
|
|
6571 | } |
|
|
6572 | } |
|
|
6573 | } |
|
|
6574 | catch (Exception e) |
|
|
6575 | { |
|
|
6576 | } |
5988 | } |
6577 | } |
5989 | |
6578 | |
5990 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(1); |
6579 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(1); |
5991 | } |
6580 | } |
5992 | |
6581 | |
… | |
… | |
6073 | // ------ make vehicle smooth zoom with vehicle as center point -------------------- |
6662 | // ------ make vehicle smooth zoom with vehicle as center point -------------------- |
6074 | // ------ because center point may be any point on screen from last finger movement! |
6663 | // ------ because center point may be any point on screen from last finger movement! |
6075 | //System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:sszz:tnc x=" + Navit.NG__map_main.touch_now_center.x + " y=" + Navit.NG__map_main.touch_now_center.y); |
6664 | //System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:sszz:tnc x=" + Navit.NG__map_main.touch_now_center.x + " y=" + Navit.NG__map_main.touch_now_center.y); |
6076 | //System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:sszz:vhp x=" + Navit.NG__vehicle.vehicle_pos_x + " y=" + Navit.NG__vehicle.vehicle_pos_y); |
6665 | //System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:sszz:vhp x=" + Navit.NG__vehicle.vehicle_pos_x + " y=" + Navit.NG__vehicle.vehicle_pos_y); |
6077 | //System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:sszz:gmt x=" + Global_Map_TransX + " y=" + Global_Map_TransY); |
6666 | //System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:sszz:gmt x=" + Global_Map_TransX + " y=" + Global_Map_TransY); |
|
|
6667 | |
|
|
6668 | if (Navit.GFX_OVERSPILL) |
|
|
6669 | { |
|
|
6670 | Navit.NG__map_main.touch_now_center.x = Navit.NG__vehicle.vehicle_pos_x - NavitGraphics.mCanvasWidth_overspill; |
|
|
6671 | Navit.NG__map_main.touch_now_center.y = Navit.NG__vehicle.vehicle_pos_y - NavitGraphics.mCanvasHeight_overspill; |
|
|
6672 | } |
|
|
6673 | else |
|
|
6674 | { |
6078 | Navit.NG__map_main.touch_now_center.x = Navit.NG__vehicle.vehicle_pos_x; |
6675 | Navit.NG__map_main.touch_now_center.x = Navit.NG__vehicle.vehicle_pos_x; |
6079 | Navit.NG__map_main.touch_now_center.y = Navit.NG__vehicle.vehicle_pos_y; |
6676 | Navit.NG__map_main.touch_now_center.y = Navit.NG__vehicle.vehicle_pos_y; |
|
|
6677 | } |
|
|
6678 | |
6080 | // ------ make vehicle smooth zoom with vehicle as center point -------------------- |
6679 | // ------ make vehicle smooth zoom with vehicle as center point -------------------- |
|
|
6680 | |
|
|
6681 | float Global_Map_Zoomfactor_start = Global_Map_Zoomfactor; |
6081 | |
6682 | |
6082 | for (cur_count = 0; cur_count < Vehicle_smooth_moves_count; cur_count++) |
6683 | for (cur_count = 0; cur_count < Vehicle_smooth_moves_count; cur_count++) |
6083 | { |
6684 | { |
6084 | if (Global_SmoothDrawing_stop == false) |
6685 | if (Global_SmoothDrawing_stop == false) |
6085 | { |
6686 | { |
… | |
… | |
6115 | Global_Map_Rotationangle = Global_Map_Rotationangle - dda; |
6716 | Global_Map_Rotationangle = Global_Map_Rotationangle - dda; |
6116 | |
6717 | |
6117 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:globalzoom factor o=" + Global_Map_Zoomfactor + " ddz=" + ddz); |
6718 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:globalzoom factor o=" + Global_Map_Zoomfactor + " ddz=" + ddz); |
6118 | if (ddz != 0) |
6719 | if (ddz != 0) |
6119 | { |
6720 | { |
6120 | Global_Map_Zoomfactor = Global_Map_Zoomfactor * (1 + (cur_count + 1) * ddz) / (1 + cur_count * ddz); |
6721 | // ******OLD******* Global_Map_Zoomfactor = Global_Map_Zoomfactor * (1 + (cur_count + 1) * ddz) / (1 + cur_count * ddz); |
|
|
6722 | //System.out.println("DEBUG_SMOOTH_DRIVING:globalzoom factor 1=" + Global_Map_Zoomfactor + " ddz=" + ddz); |
|
|
6723 | //System.out.println("DEBUG_SMOOTH_DRIVING:globalzoom factor s=" + Global_Map_Zoomfactor_start); |
|
|
6724 | Global_Map_Zoomfactor = Global_Map_Zoomfactor + (ddz * Global_Map_Zoomfactor_start); |
|
|
6725 | //System.out.println("DEBUG_SMOOTH_DRIVING:globalzoom factor 2=" + Global_Map_Zoomfactor + " ddz=" + ddz); |
6121 | } |
6726 | } |
6122 | |
6727 | |
6123 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:globalzoom factor n=" + Global_Map_Zoomfactor); |
6728 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:globalzoom factor n=" + Global_Map_Zoomfactor); |
6124 | //} |
6729 | //} |
6125 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:this #" + (cur_count + 1) + ":ddx=" + Global_Map_TransX + " ddy=" + Global_Map_TransY + " dda=" + Global_Map_Rotationangle); |
6730 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:this #" + (cur_count + 1) + ":ddx=" + Global_Map_TransX + " ddy=" + Global_Map_TransY + " dda=" + Global_Map_Rotationangle); |
… | |
… | |
6225 | } |
6830 | } |
6226 | //else if (cur_count == (Vehicle_smooth_moves_count - 1)) |
6831 | //else if (cur_count == (Vehicle_smooth_moves_count - 1)) |
6227 | //{ |
6832 | //{ |
6228 | //} |
6833 | //} |
6229 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:" + (cur_count + 1)); |
6834 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:" + (cur_count + 1)); |
6230 | System.out.println("DO__DRAW:Java:postInvalidate 006"); |
6835 | // System.out.println("DO__DRAW:Java:postInvalidate 006"); |
6231 | // SYN // Navit.NG__map_main.view.postInvalidate(); |
6836 | // SYN // Navit.NG__map_main.view.postInvalidate(); |
6232 | //SurfaceView2 vw = (SurfaceView2) Navit.NG__map_main.view; |
6837 | //SurfaceView2 vw = (SurfaceView2) Navit.NG__map_main.view; |
6233 | //vw.paint_me(); |
6838 | //vw.paint_me(); |
6234 | } |
6839 | } |
6235 | } |
6840 | } |
… | |
… | |
6249 | } |
6854 | } |
6250 | |
6855 | |
6251 | public void reset_cancel_previous() |
6856 | public void reset_cancel_previous() |
6252 | { |
6857 | { |
6253 | is_thread_cancel = false; |
6858 | is_thread_cancel = false; |
6254 | System.out.println("DO__DRAW:Java:reset_cancel_previous"); |
6859 | // System.out.println("DO__DRAW:Java:reset_cancel_previous"); |
6255 | } |
6860 | } |
6256 | |
6861 | |
6257 | public void run() |
6862 | public void run() |
6258 | { |
6863 | { |
6259 | is_thread_cancel = false; |
6864 | is_thread_cancel = false; |
… | |
… | |
6429 | // System.out.println("DO__DRAW:Java:postInvalidate 001:y"); |
7034 | // System.out.println("DO__DRAW:Java:postInvalidate 001:y"); |
6430 | // SYN // view_s.postInvalidate(); |
7035 | // SYN // view_s.postInvalidate(); |
6431 | if ((System.currentTimeMillis() - last_map_postInvalidate) < 150) |
7036 | if ((System.currentTimeMillis() - last_map_postInvalidate) < 150) |
6432 | { |
7037 | { |
6433 | // too fast -> dont update |
7038 | // too fast -> dont update |
6434 | System.out.println("DEBUG_SMOOTH_DRIVING:too fast"); |
7039 | // System.out.println("DEBUG_SMOOTH_DRIVING:too fast"); |
6435 | |
7040 | |
6436 | // if (!map_c_drawing) |
7041 | // if (!map_c_drawing) |
6437 | // { |
7042 | // { |
6438 | // copy_map_buffer(); |
7043 | // copy_map_buffer(); |
6439 | // draw_reset_factors = true; |
7044 | // draw_reset_factors = true; |
… | |
… | |
6656 | { |
7261 | { |
6657 | System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:b=" + (System.currentTimeMillis() - smooth_driving_ts002)); |
7262 | System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:b=" + (System.currentTimeMillis() - smooth_driving_ts002)); |
6658 | System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:RR"); |
7263 | System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:RR"); |
6659 | } |
7264 | } |
6660 | smooth_driving_ts003 = System.currentTimeMillis(); |
7265 | smooth_driving_ts003 = System.currentTimeMillis(); |
6661 | System.out.println("DO__DRAW:Java:postInvalidate 002"); |
7266 | // System.out.println("DO__DRAW:Java:postInvalidate 002"); |
6662 | // SYN // view_s.postInvalidate(); |
7267 | // SYN // view_s.postInvalidate(); |
6663 | //view_s.paint_me(); |
7268 | //view_s.paint_me(); |
6664 | //System.out.println("DO__DRAW:Java:refresh map -> draw ready"); |
7269 | //System.out.println("DO__DRAW:Java:refresh map -> draw ready"); |
6665 | } |
7270 | } |
6666 | } |
7271 | } |
6667 | }); |
7272 | }); |
6668 | |
7273 | |
6669 | public static void set_vehicle_values_delta(int dx, int dy, int dangle2, int dzoom) |
7274 | public static void set_vehicle_values_delta(int dx, int dy, int dangle2, int dzoom, int l_old, int l_new) |
6670 | { |
7275 | { |
6671 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); |
7276 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(0); |
6672 | |
7277 | |
6673 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:set_vehicle_values_delta:start"); |
7278 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:set_vehicle_values_delta:start"); |
6674 | |
7279 | |
6675 | // DPI |
7280 | // DPI |
6676 | dx = (int) ((float) dx / NavitGraphics.Global_dpi_factor); |
7281 | dx = (int) ((float) dx / NavitGraphics.Global_dpi_factor); |
6677 | dy = (int) ((float) dy / NavitGraphics.Global_dpi_factor); |
7282 | dy = (int) ((float) dy / NavitGraphics.Global_dpi_factor); |
|
|
7283 | |
|
|
7284 | // zoom factor |
|
|
7285 | float current_horizontal_zoom_factor = 0; |
|
|
7286 | if ((l_new != 0) && (l_old != 0)) |
|
|
7287 | { |
|
|
7288 | current_horizontal_zoom_factor = (float) l_new / (float) l_old; |
|
|
7289 | } |
|
|
7290 | // System.out.println("dzoom=" + dzoom + " l_old=" + l_old + " l_new=" + l_new + " f=" + current_horizontal_zoom_factor); |
6678 | |
7291 | |
6679 | int xxx = 0; |
7292 | int xxx = 0; |
6680 | if (DEBUG_SMOOTH_DRIVING) |
7293 | if (DEBUG_SMOOTH_DRIVING) |
6681 | { |
7294 | { |
6682 | xxx = (int) (Math.random() * 1000f); |
7295 | xxx = (int) (Math.random() * 1000f); |
… | |
… | |
6702 | Navit.NG__vehicle.vehicle_direction_delta = dangle; |
7315 | Navit.NG__vehicle.vehicle_direction_delta = dangle; |
6703 | Navit.NG__vehicle.vehicle_zoom_delta = dzoom; |
7316 | Navit.NG__vehicle.vehicle_zoom_delta = dzoom; |
6704 | |
7317 | |
6705 | Global_SmoothDrawing_stop = false; |
7318 | Global_SmoothDrawing_stop = false; |
6706 | |
7319 | |
6707 | if (!Navit.PREF_use_smooth_drawing) |
7320 | if (!Navit.p.PREF_use_smooth_drawing) |
6708 | { |
7321 | { |
6709 | // disbaled via prefs |
7322 | // disbaled via prefs |
6710 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(2); |
7323 | // if (Navit.METHOD_DEBUG) Navit.my_func_name(2); |
6711 | return; |
7324 | return; |
6712 | } |
7325 | } |
… | |
… | |
6721 | // Navit.NG__vehicle.vehicle_speed --> is in "km/h" !! |
7334 | // Navit.NG__vehicle.vehicle_speed --> is in "km/h" !! |
6722 | // System.out.println("DEBUG_SMOOTH_DRIVING:v speed=" + Navit.NG__vehicle.vehicle_speed); |
7335 | // System.out.println("DEBUG_SMOOTH_DRIVING:v speed=" + Navit.NG__vehicle.vehicle_speed); |
6723 | // |
7336 | // |
6724 | if ((Navit.NG__vehicle.vehicle_speed > 2) || (Navit.NG__vehicle.vehicle_direction_delta > 0)) |
7337 | if ((Navit.NG__vehicle.vehicle_speed > 2) || (Navit.NG__vehicle.vehicle_direction_delta > 0)) |
6725 | { |
7338 | { |
6726 | if (Navit.PREF_use_more_smooth_drawing) |
7339 | if (Navit.p.PREF_use_more_smooth_drawing) |
6727 | { |
7340 | { |
6728 | // really awesome smooth (80 steps / 80 fps) +1 |
7341 | // really awesome smooth (80 steps / 80 fps) +1 |
6729 | //Vehicle_smooth_moves_count = 79; |
7342 | //Vehicle_smooth_moves_count = 79; |
6730 | //Vehicle_smooth_move_delay = 8; |
7343 | //Vehicle_smooth_move_delay = 8; |
6731 | // |
7344 | // |
… | |
… | |
6818 | ddx = (float) dx / (float) (Vehicle_smooth_moves_count + compensate); |
7431 | ddx = (float) dx / (float) (Vehicle_smooth_moves_count + compensate); |
6819 | ddy = (float) dy / (float) (Vehicle_smooth_moves_count + compensate); |
7432 | ddy = (float) dy / (float) (Vehicle_smooth_moves_count + compensate); |
6820 | //ddx_last = (float) dx - (float) (Vehicle_smooth_moves_count + compensate) * ddx; |
7433 | //ddx_last = (float) dx - (float) (Vehicle_smooth_moves_count + compensate) * ddx; |
6821 | //ddy_last = (float) dy - (float) (Vehicle_smooth_moves_count + compensate) * ddy; |
7434 | //ddy_last = (float) dy - (float) (Vehicle_smooth_moves_count + compensate) * ddy; |
6822 | |
7435 | |
6823 | final float k__ = 1f / 9f; |
|
|
6824 | final float d__ = 1f; |
|
|
6825 | if (Navit.NG__vehicle.vehicle_zoom_delta != 0) |
7436 | if (Navit.NG__vehicle.vehicle_zoom_delta != 0) |
6826 | { |
7437 | { |
6827 | // *FIX ME* ---------------------------- |
7438 | //System.out.println("zoom:ddz old=" + ddz); |
6828 | ddz = (((k__ * (float) (-Navit.NG__vehicle.vehicle_zoom_delta) + d__) * 1) - 1) / (float) (Vehicle_smooth_moves_count + compensate); |
|
|
6829 | |
|
|
6830 | if (Navit.NG__vehicle.vehicle_zoom_delta == -4) |
|
|
6831 | { |
|
|
6832 | ddz = (0.23f) / (float) (Vehicle_smooth_moves_count + compensate); |
|
|
6833 | } |
|
|
6834 | else if (Navit.NG__vehicle.vehicle_zoom_delta == 4) |
|
|
6835 | { |
|
|
6836 | ddz = -(0.23f) / (float) (Vehicle_smooth_moves_count + compensate); |
|
|
6837 | } |
|
|
6838 | else if (Navit.NG__vehicle.vehicle_zoom_delta == -10) |
|
|
6839 | { |
|
|
6840 | ddz = (0.091f) / (float) (Vehicle_smooth_moves_count + compensate); |
7439 | ddz = (current_horizontal_zoom_factor - 1.0f) / (float) (Vehicle_smooth_moves_count + compensate); |
6841 | } |
7440 | //System.out.println("zoom:ddz new=" + ddz); |
6842 | else if (Navit.NG__vehicle.vehicle_zoom_delta == 10) |
|
|
6843 | { |
|
|
6844 | ddz = -(0.091f) / (float) (Vehicle_smooth_moves_count + compensate); |
|
|
6845 | } |
|
|
6846 | // *FIX ME* ---------------------------- |
|
|
6847 | |
|
|
6848 | // correct the smooth zoom value ---------------------------- |
|
|
6849 | // |
|
|
6850 | // *FIX ME* |
|
|
6851 | // yes this is aweful, but i have not figured out how its calcuated correctly |
|
|
6852 | // so this will have to do for now |
|
|
6853 | // *FIX ME* |
|
|
6854 | if (Navit.GlobalScaleLevel > 300) |
|
|
6855 | { |
|
|
6856 | // no more smooth zoom at this zoom level! |
|
|
6857 | ddz = 0; |
|
|
6858 | } |
|
|
6859 | else if (Navit.GlobalScaleLevel > 200) |
|
|
6860 | { |
|
|
6861 | ddz = ddz / 4f; |
|
|
6862 | } |
|
|
6863 | else if (Navit.GlobalScaleLevel > 150) |
|
|
6864 | { |
|
|
6865 | ddz = ddz / 2f; |
|
|
6866 | } |
|
|
6867 | // correct the smooth zoom value |
|
|
6868 | // |
|
|
6869 | // *FIX ME* |
|
|
6870 | // yes this is aweful, but i have not figured out how its calcuated correctly |
|
|
6871 | // so this will have to do for now |
|
|
6872 | // *FIX ME* |
|
|
6873 | // |
|
|
6874 | // correct the smooth zoom value ---------------------------- |
|
|
6875 | } |
7441 | } |
6876 | else |
7442 | else |
6877 | { |
7443 | { |
6878 | ddz = 0; |
7444 | ddz = 0; |
6879 | } |
7445 | } |
… | |
… | |
6895 | static void deactivate_nav_wakelock() |
7461 | static void deactivate_nav_wakelock() |
6896 | { |
7462 | { |
6897 | try |
7463 | try |
6898 | { |
7464 | { |
6899 | Navit.is_navigating = false; |
7465 | Navit.is_navigating = false; |
6900 | System.out.println("XXNAV: Navit.is_navigating = false 001"); |
7466 | // System.out.println("XXNAV: Navit.is_navigating = false 001"); |
6901 | |
7467 | |
6902 | Message msg = Navit.Navit_progress_h.obtainMessage(); |
7468 | Message msg = Navit.Navit_progress_h.obtainMessage(); |
6903 | Bundle b = new Bundle(); |
7469 | Bundle b = new Bundle(); |
6904 | msg.what = 25; |
7470 | msg.what = 25; |
6905 | msg.setData(b); |
7471 | msg.setData(b); |
6906 | Navit.Navit_progress_h.sendMessage(msg); |
7472 | Navit.Navit_progress_h.sendMessage(msg); |
6907 | System.out.println("XXNAV: Navit.is_navigating = false 002"); |
7473 | // System.out.println("XXNAV: Navit.is_navigating = false 002"); |
6908 | } |
7474 | } |
6909 | catch (Exception e) |
7475 | catch (Exception e) |
6910 | { |
7476 | { |
6911 | e.printStackTrace(); |
7477 | e.printStackTrace(); |
6912 | } |
7478 | } |
… | |
… | |
6968 | static void activate_nav_wakelock() |
7534 | static void activate_nav_wakelock() |
6969 | { |
7535 | { |
6970 | try |
7536 | try |
6971 | { |
7537 | { |
6972 | Navit.is_navigating = true; |
7538 | Navit.is_navigating = true; |
6973 | System.out.println("XXNAV: Navit.is_navigating = TRUE"); |
7539 | // System.out.println("XXNAV: Navit.is_navigating = TRUE"); |
6974 | |
7540 | |
6975 | Message msg = Navit.Navit_progress_h.obtainMessage(); |
7541 | Message msg = Navit.Navit_progress_h.obtainMessage(); |
6976 | Bundle b = new Bundle(); |
7542 | Bundle b = new Bundle(); |
6977 | msg.what = 26; |
7543 | msg.what = 26; |
6978 | msg.setData(b); |
7544 | msg.setData(b); |
… | |
… | |
7064 | } |
7630 | } |
7065 | } |
7631 | } |
7066 | else |
7632 | else |
7067 | { |
7633 | { |
7068 | // activate line drawing from prefs setting |
7634 | // activate line drawing from prefs setting |
7069 | if (Navit.PREF_c_linedrawing) |
7635 | if (Navit.p.PREF_c_linedrawing) |
7070 | { |
7636 | { |
7071 | Message msg = new Message(); |
7637 | Message msg = new Message(); |
7072 | Bundle b = new Bundle(); |
7638 | Bundle b = new Bundle(); |
7073 | b.putInt("Callback", 85); |
7639 | b.putInt("Callback", 85); |
7074 | b.putString("s", "1"); |
7640 | b.putString("s", "1"); |
… | |
… | |
7208 | // draw_map_one_shot = true; |
7774 | // draw_map_one_shot = true; |
7209 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:map draw ready"); |
7775 | if (DEBUG_SMOOTH_DRIVING) System.out.println("DEBUG_SMOOTH_DRIVING:TMG-DEBUG:map draw ready"); |
7210 | |
7776 | |
7211 | map_c_drawing = false; |
7777 | map_c_drawing = false; |
7212 | |
7778 | |
7213 | if ((Navit.PREF_use_smooth_drawing) && (Navit.NG__vehicle.vehicle_speed > 12)) |
7779 | if ((Navit.p.PREF_use_smooth_drawing) && (Navit.NG__vehicle.vehicle_speed > 12)) |
7214 | { |
7780 | { |
7215 | // delay vehicle and map update just a tiny little bit here!! -- very experimental, also delays gps position !!! |
7781 | // delay vehicle and map update just a tiny little bit here!! -- very experimental, also delays gps position !!! |
7216 | |
7782 | |
7217 | //System.out.println("DEBUG_SMOOTH_DRIVING:map draw ready -> signal received"); |
7783 | //System.out.println("DEBUG_SMOOTH_DRIVING:map draw ready -> signal received"); |
7218 | if (STT_B_list[0] != null) |
7784 | if (STT_B_list[0] != null) |
… | |
… | |
7264 | NavitGraphics.navit_route_status = 0; |
7830 | NavitGraphics.navit_route_status = 0; |
7265 | |
7831 | |
7266 | //System.out.println("XXNAV:dd001"); |
7832 | //System.out.println("XXNAV:dd001"); |
7267 | deactivate_nav_wakelock(); |
7833 | deactivate_nav_wakelock(); |
7268 | |
7834 | |
7269 | if (Navit.PREF_enable_debug_write_gpx) |
7835 | if (Navit.p.PREF_enable_debug_write_gpx) |
7270 | { |
7836 | { |
7271 | NavitVehicle.speech_recording_end(); |
7837 | NavitVehicle.speech_recording_end(); |
7272 | } |
7838 | } |
7273 | } |
7839 | } |
7274 | else if (id == 5) |
7840 | else if (id == 5) |
… | |
… | |
7306 | // reset "beep" flag |
7872 | // reset "beep" flag |
7307 | Navit.toneG_heared = false; |
7873 | Navit.toneG_heared = false; |
7308 | |
7874 | |
7309 | // System.out.println("MAX SPEED=" + Navit.cur_max_speed); |
7875 | // System.out.println("MAX SPEED=" + Navit.cur_max_speed); |
7310 | //System.out.println("xx paint 4 xx"); |
7876 | //System.out.println("xx paint 4 xx"); |
7311 | NavitOSDJava.draw_real_wrapper(false, true); |
7877 | // NavitOSDJava.draw_real_wrapper(true, false); |
|
|
7878 | ZANaviLinearLayout.redraw_OSD(8); |
7312 | } |
7879 | } |
7313 | } |
7880 | } |
7314 | } |
7881 | } |
7315 | |
7882 | |
7316 | public static Bitmap rotate_and_scale_bitmap(Bitmap in, int w, int h, int angle) |
7883 | public static Bitmap rotate_and_scale_bitmap(Bitmap in, int w, int h, int angle) |
… | |
… | |
7371 | if (route_rects == null) |
7938 | if (route_rects == null) |
7372 | { |
7939 | { |
7373 | route_rects = new ArrayList<route_rect>(); |
7940 | route_rects = new ArrayList<route_rect>(); |
7374 | } |
7941 | } |
7375 | |
7942 | |
|
|
7943 | // System.out.println("route_rect::send:" + order + ":" + x1 + " " + y1 + " " + x2 + " " + y2); |
|
|
7944 | |
7376 | route_rect rr = new route_rect(); |
7945 | route_rect rr = new route_rect(); |
7377 | rr.x1 = x1; |
7946 | rr.x1 = x1; |
7378 | rr.y1 = y1; |
7947 | rr.y1 = y1; |
7379 | rr.x2 = x2; |
7948 | rr.x2 = x2; |
7380 | rr.y2 = y2; |
7949 | rr.y2 = y2; |
… | |
… | |
7382 | route_rects.add(rr); |
7951 | route_rects.add(rr); |
7383 | } |
7952 | } |
7384 | |
7953 | |
7385 | public static int dp_to_px(int dp) |
7954 | public static int dp_to_px(int dp) |
7386 | { |
7955 | { |
|
|
7956 | // System.out.println("FFF:dp=" + dp + " px1=" + (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, Navit.getBaseContext_.getResources().getDisplayMetrics()) + " ps2=" + (int) (((float) dp * Global_dpi_factor_better) + 0.5f)); |
|
|
7957 | |
7387 | return (int) (((float) dp / Global_dpi_factor) + 0.5); |
7958 | // return (int) (((float) dp * Global_dpi_factor_better) + 0.5f); |
|
|
7959 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, Navit.getBaseContext_.getResources().getDisplayMetrics()); |
7388 | } |
7960 | } |
7389 | |
7961 | |
7390 | public static int px_to_dp(int px) |
7962 | public static int px_to_dp(int px) |
7391 | { |
7963 | { |
|
|
7964 | // System.out.println("FFF:px=" + px + " dp1=" + (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, px, Navit.getBaseContext_.getResources().getDisplayMetrics()) + " ps2=" + (int) (((float) px / Global_dpi_factor_better) + 0.5f)); |
|
|
7965 | |
7392 | return (int) (((float) px * Global_dpi_factor) + 0.5); |
7966 | // return (int) (((float) px / Global_dpi_factor_better) + 0.5f); |
|
|
7967 | return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, px, Navit.getBaseContext_.getResources().getDisplayMetrics()); |
7393 | } |
7968 | } |
7394 | |
7969 | |
7395 | static long last_map_postInvalidate = -1L; |
7970 | static long last_map_postInvalidate = -1L; |
7396 | } |
7971 | } |