From d2f93c0726e93ae4f191cc252a76a3add8149eea Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期五, 03 四月 2020 11:39:23 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/endian11/DriveJudge

---
 app/src/main/java/safeluck/drive/evaluation/Constant.java                        |    1 
 app/src/main/java/safeluck/drive/evaluation/app.java                             |    4 
 app/src/main/res/layout/layout_mapfragment.xml                                   |   35 
 app/src/main/java/safeluck/drive/evaluation/fragment/RoadDriveMapFragmentaa.java |  133 +++--
 app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java            | 1172 ++++++++++++++++++++++++++++++++++----------------
 5 files changed, 904 insertions(+), 441 deletions(-)

diff --git a/app/src/main/java/safeluck/drive/evaluation/Constant.java b/app/src/main/java/safeluck/drive/evaluation/Constant.java
index 2100f97..dd9a534 100644
--- a/app/src/main/java/safeluck/drive/evaluation/Constant.java
+++ b/app/src/main/java/safeluck/drive/evaluation/Constant.java
@@ -89,6 +89,7 @@
     public static final int EXIT_CURRENT_ITEM = 0;//閫�鍑烘煇鍦哄湴
     public static final String RTK_INFO_SAT_QF = "RTK_INFO_SAT_QF";//浠嶳TK info涓幏鍙栫殑鍗槦棰楁暟鍜宷f 缁勬垚鐨刯son
     public static final int SUBJECT_III = 3;//璺��
+    public static final int LEFT_RIGHT_DISTANCE = 0x0020;
     public static String exam_enter_exitdata="exam_enter_exitdata";
     public static int Chang_di = 2;
     public static int DaoLu_night = 3;
diff --git a/app/src/main/java/safeluck/drive/evaluation/app.java b/app/src/main/java/safeluck/drive/evaluation/app.java
index 548d988..88854ca 100644
--- a/app/src/main/java/safeluck/drive/evaluation/app.java
+++ b/app/src/main/java/safeluck/drive/evaluation/app.java
@@ -456,7 +456,9 @@
                 }
 
                 break;
-
+            case Constant.LEFT_RIGHT_DISTANCE:
+                CEventCenter.dispatchEvent(Constant.BIND_RTK_SPEED_TOPIC,cmd,0,json);
+                break;
         }
 
     }
diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java b/app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java
index 187d6e5..1733684 100644
--- a/app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java
+++ b/app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java
@@ -7,8 +7,6 @@
 import android.graphics.Paint;
 import android.graphics.Path;
 import android.os.Bundle;
-import android.os.Handler;
-import android.text.LoginFilter;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.LayoutInflater;
@@ -17,13 +15,13 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.LinearLayout;
+import android.widget.Toast;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.appcompat.widget.Toolbar;
 
 
-import com.anyun.exam.lib.AYSdk;
 import com.anyun.exam.lib.MyLog;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
@@ -34,7 +32,6 @@
 
 import java.lang.reflect.Type;
 import java.math.BigDecimal;
-import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
@@ -46,7 +43,6 @@
 import safeluck.drive.evaluation.R;
 import safeluck.drive.evaluation.bean.ExamMap;
 import safeluck.drive.evaluation.bean.ExamPlatformData;
-import safeluck.drive.evaluation.bean.Point;
 import safeluck.drive.evaluation.bean.RealTimeCarPos;
 import safeluck.drive.evaluation.cEventCenter.CEventCenter;
 import safeluck.drive.evaluation.cEventCenter.ICEventListener;
@@ -61,8 +57,9 @@
  * 閭锛�632393724@qq.com
  * All Rights Saved! Chongqing AnYun Tech co. LTD
  */
-public class MapFragment extends SupportFragment {
+public class MapFragment extends SupportFragment implements View.OnClickListener {
     private boolean isDrawing = false;
+    private int pixels = 80;
     private ICEventListener rtcmicEventListener = new ICEventListener() {
         @Override
         public void onCEvent(String topic, int msgCode, int resultCode, final Object obj) {
@@ -75,29 +72,27 @@
                         toolbar.setTitle((String)obj);
                     }
                 });
-                }
-        }
-    };
-    private ICEventListener debugTxticEventListener = new ICEventListener() {
-        @Override
-        public void onCEvent(String topic, int msgCode, int resultCode, final Object obj) {
-            if (msgCode == Constant.DEBUG_TXT){
-                CThreadPoolExecutor.runOnMainThread(new Runnable() {
-                    @Override
-                    public void run() {
-                        Log.i(TAG, "subtitle="+(String)obj);
-                        toolbar.setSubtitle((String)obj);
-                    }
-                });
-
             }
         }
     };
+
     private ICEventListener speedListener = new ICEventListener() {
         @Override
         public void onCEvent(String topic, int msgCode, int resultCode, Object obj) {
             if (msgCode == Constant.RTK_INFO){
                 gpsSpeed = (double)obj;
+            }
+            if (msgCode == Constant.LEFT_RIGHT_DISTANCE){
+                String str = (String)obj;
+
+                try {
+                    JSONObject jsonObject = new JSONObject(str);
+                    leftDistance = Utils.getdouble(jsonObject.getDouble("left"),3);
+                    rightDistance = Utils.getdouble(jsonObject.getDouble("right"),3);
+
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                }
             }
         }
     };
@@ -116,7 +111,10 @@
     private Toolbar toolbar;
 
     private Bitmap bmp = null;
+    private Bitmap bmp2 = null;
+
     private Canvas canvas2 = null;
+    private Canvas canvas3 = null;
     private Paint paint = null;
     private int screen_width = 0, screen_height = 0;
     private String osdHeading = null;
@@ -126,14 +124,16 @@
 
     private int map_id;
     private double gpsSpeed = 0;
+    private double leftDistance = 0;
+    private double rightDistance = 0;
 
     double allMap[][][];
     double map[][] = {{-2.4065, 30.7090}, {-3.0759, 30.3599}, { -2.6023, 29.2578}, {-3.3316,28.9383},{-3.8247,30.0293},
-        {-3.4503,30.1946}, {-2.9669,29.0981}, { -3.6962, 28.7786}, {-4.1991, 29.8640}};
+            {-3.4503,30.1946}, {-2.9669,29.0981}, { -3.6962, 28.7786}, {-4.1991, 29.8640}};
     double map_other[][] = {{-2.4065, 30.7090}, {-3.0759, 30.3599}, { -2.6023, 29.2578}, {-3.3316,28.9383},{-3.8247,30.0293},
-        {-3.4503,30.1946}, {-2.9669,29.0981}};
+            {-3.4503,30.1946}, {-2.9669,29.0981}};
 
-//    double map[][] ;
+    //    double map[][] ;
     double car[][] = {{8.278, 1.467}, {7.2780000000000009, 1.467}, {7.2780000000000009, -1.533}, {8.278, -1.533}
             , {9.278, -1.5330000000000004}, {9.277999999999999, 1.467000000000001}};
     Gson gson;
@@ -152,22 +152,15 @@
         consumer.execute(new CalRunnable());
         return view;
     }
-private int avaliableHeight,avalibleWidth;
+    private int avaliableHeight,avalibleWidth;
     private void initView(View view) {
-        toolbar = view.findViewById(R.id.toolbar);
-        toolbar.setTitle("绠�鍗曞湴鍥�");
-        toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
-        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                _mActivity.onBackPressed();
-            }
-        });
- avaliableHeight= getResources().getDisplayMetrics().heightPixels;
-avalibleWidth = getResources().getDisplayMetrics().widthPixels;
+
+        avaliableHeight= getResources().getDisplayMetrics().heightPixels;
+        avalibleWidth = getResources().getDisplayMetrics().widthPixels;
         Log.i(TAG, "initView: aliwidht="+avalibleWidth+" height="+avaliableHeight);
         mSurfaceView = view.findViewById(R.id.surfaceview);
-
+        view.findViewById(R.id.btn_reduce).setOnClickListener(this);
+        view.findViewById(R.id.btn_amplify).setOnClickListener(this);
         holder = mSurfaceView.getHolder();
 
         holder.addCallback(new SurfaceHolder.Callback() {
@@ -181,9 +174,15 @@
                     screen_height = canvas.getHeight();
                     surfaceHolder.unlockCanvasAndPost(canvas);
 
-                    bmp = Bitmap.createBitmap(screen_width, screen_height, Bitmap.Config.ARGB_8888);
+                    bmp = Bitmap.createBitmap(screen_width*2/3, screen_height, Bitmap.Config.ARGB_8888);
                     canvas2 = new Canvas(bmp);
                     canvas2.drawColor(Color.WHITE);
+
+                    bmp2 = Bitmap.createBitmap(screen_width/3, screen_height, Bitmap.Config.ARGB_8888);
+                    canvas3 = new Canvas(bmp2);
+                    canvas3.drawColor(Color.WHITE);
+
+                    Log.d(TAG, "BMP W = " + bmp.getWidth() + "BMP H = " + bmp.getHeight());
 
                     paint = new Paint();
 
@@ -194,6 +193,7 @@
                     paint.setStyle(Paint.Style.STROKE);
 
                     holder.lockCanvas();
+                    canvas.drawBitmap(bmp2, screen_width/3, 0, paint);
                     canvas.drawBitmap(bmp, 0, 0, paint);
                     holder.unlockCanvasAndPost(canvas);
                 }
@@ -216,186 +216,188 @@
         if (canvas2 == null || bmp == null) {
             return;
         }
-                double base_x = 300, base_y = 20;
-                double max_x = 0, min_x = 0, max_y = 0, min_y = 0;
+//        _mActivity.runOnUiThread(new Runnable() {
+//            @Override
+//            public void run() {
+        double base_x = 300, base_y = 20;
+        double max_x = 0, min_x = 0, max_y = 0, min_y = 0;
 
-                Log.d(TAG, "DrawMap map size " + map.length + " car size " + car.length+"map other length="+map_other.length);
+        Log.d(TAG, "DrawMap map size " + map.length + " car size " + car.length);
 
-                for (int i = 0; i < map.length; i++) {
-                    if (i == 0) {
-                        max_x = map[0][0];
-                        min_x = map[0][0];
-                        max_y = map[0][1];
-                        min_y = map[0][1];
-                    } else {
-                        if (max_x < map[i][0]) {
-                            max_x = map[i][0];
-                        }
-                        if (min_x > map[i][0]) {
-                            min_x = map[i][0];
-                        }
-                        if (max_y < map[i][1]) {
-                            max_y = map[i][1];
-                        }
-                        if (min_y > map[i][1]) {
-                            min_y = map[i][1];
-                        }
-                    }
+        for (int i = 0; i < map.length; i++) {
+            if (i == 0) {
+                max_x = map[0][0];
+                min_x = map[0][0];
+                max_y = map[0][1];
+                min_y = map[0][1];
+            } else {
+                if (max_x < map[i][0]) {
+                    max_x = map[i][0];
                 }
-                if (map_other.length>9){
-                    for (int i = 0; i < map_other.length; i++) {
-
-                        if (max_x < map_other[i][0]) {
-                            max_x = map_other[i][0];
-                        }
-                        if (min_x > map_other[i][0]) {
-                            min_x = map_other[i][0];
-                        }
-                        if (max_y < map_other[i][1]) {
-                            max_y = map_other[i][1];
-                        }
-                        if (min_y > map_other[i][1]) {
-                            min_y = map_other[i][1];
-                        }
-                    }
+                if (min_x > map[i][0]) {
+                    min_x = map[i][0];
                 }
-
-
-                Log.d(TAG, "DrawMap max_x " + max_x + " max_y " + max_y + " min_x " + min_x + " min_y " + min_y);
-
-//                for (int i = 0; i < car.length; i++) {
-//                    if (max_x < car[i][0]) {
-//                        max_x = car[i][0];
-//                    }
-//                    if (min_x > car[i][0]) {
-//                        min_x = car[i][0];
-//                    }
-//                    if (max_y < car[i][1]) {
-//                        max_y = car[i][1];
-//                    }
-//                    if (min_y > car[i][1]) {
-//                        min_y = car[i][1];
-//                    }
-//                }
-
-                Log.d(TAG, "DrawMap max_x " + max_x + " max_y " + max_y + " min_x " + min_x + " min_y " + min_y);
-
-                long scale_x = Math.round((screen_width - base_x - 10) / (max_x - min_x));
-                long scale_y = Math.round((screen_height - base_y - 10) / (max_y - min_y));
-
-                if (scale_x >= scale_y) {
-                    scale_x = scale_y;
-                } else {
-                    scale_y = scale_x;
+                if (max_y < map[i][1]) {
+                    max_y = map[i][1];
                 }
-
-                Log.d(TAG, "DrawMap scale_x " + scale_x + " scale_y " + scale_y);
-
-
-                canvas2.drawColor(Color.WHITE);
-
-                if (paint == null || canvas2==null){
-                    return;
+                if (min_y > map[i][1]) {
+                    min_y = map[i][1];
                 }
-                paint.setStyle(Paint.Style.FILL_AND_STROKE);
-                paint.setColor(Color.BLUE);
+            }
+        }
+        if (map_other.length>9){
+            for (int i = 0; i < map_other.length; i++) {
 
-                canvas2.drawCircle((float) (base_x + (mainAnt.get(0) - min_x) * scale_x), (float) (base_y + (0 - mainAnt.get(1) - min_y) * scale_y), 2, paint);
+                if (max_x < map_other[i][0]) {
+                    max_x = map_other[i][0];
+                }
+                if (min_x > map_other[i][0]) {
+                    min_x = map_other[i][0];
+                }
+                if (max_y < map_other[i][1]) {
+                    max_y = map_other[i][1];
+                }
+                if (min_y > map_other[i][1]) {
+                    min_y = map_other[i][1];
+                }
+            }
+        }
 
-                paint.setColor(Color.RED);
-                canvas2.drawCircle((float) (base_x + (car[tire.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(0)][1] - min_y) * scale_y), 2.5f, paint);
-                canvas2.drawCircle((float) (base_x + (car[tire.get(1)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(1)][1] - min_y) * scale_y), 2.5f, paint);
-                canvas2.drawCircle((float) (base_x + (car[tire.get(2)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(2)][1] - min_y) * scale_y), 2.5f, paint);
-                canvas2.drawCircle((float) (base_x + (car[tire.get(3)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(3)][1] - min_y) * scale_y), 2.5f, paint);
 
-                paint.setStyle(Paint.Style.STROKE);
-                paint.setColor(Color.BLACK);
+        Log.d(TAG, "DrawMap max_x " + max_x + " max_y " + max_y + " min_x " + min_x + " min_y " + min_y);
 
-                Path path = new Path();
+        for (int i = 0; i < car.length; i++) {
+            if (max_x < car[i][0]) {
+                max_x = car[i][0];
+            }
+            if (min_x > car[i][0]) {
+                min_x = car[i][0];
+            }
+            if (max_y < car[i][1]) {
+                max_y = car[i][1];
+            }
+            if (min_y > car[i][1]) {
+                min_y = car[i][1];
+            }
+        }
+
+        Log.d(TAG, "DrawMap max_x " + max_x + " max_y " + max_y + " min_x " + min_x + " min_y " + min_y);
+
+        long scale_x = Math.round((bmp.getWidth() - base_x - 10) / (max_x - min_x));
+        long scale_y = Math.round((bmp.getHeight() - base_y - 10) / (max_y - min_y));
+
+        if (scale_x >= scale_y) {
+            scale_x = scale_y;
+        } else {
+            scale_y = scale_x;
+        }
+
+        Log.d(TAG, "DrawMap scale_x " + scale_x + " scale_y " + scale_y);
+
+        canvas2.drawColor(Color.WHITE);
+
+        if (paint == null || canvas2==null){
+            return;
+        }
+        paint.setStyle(Paint.Style.FILL_AND_STROKE);
+        paint.setColor(Color.BLUE);
+
+        canvas2.drawCircle((float) (base_x + (mainAnt.get(0) - min_x) * scale_x), (float) (base_y + (0 - mainAnt.get(1) - min_y) * scale_y), 2, paint);
+
+        paint.setColor(Color.RED);
+        canvas2.drawCircle((float) (base_x + (car[tire.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(0)][1] - min_y) * scale_y), 2.5f, paint);
+        canvas2.drawCircle((float) (base_x + (car[tire.get(1)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(1)][1] - min_y) * scale_y), 2.5f, paint);
+        canvas2.drawCircle((float) (base_x + (car[tire.get(2)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(2)][1] - min_y) * scale_y), 2.5f, paint);
+        canvas2.drawCircle((float) (base_x + (car[tire.get(3)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(3)][1] - min_y) * scale_y), 2.5f, paint);
+
+        paint.setStyle(Paint.Style.STROKE);
+        paint.setColor(Color.BLACK);
+
+        Path path = new Path();
         Log.i(TAG, "DrawMap: map.length:"+map.length);
-                if (map.length < 9) {
-                    Log.d(TAG, "DrawMap X = " + String.format("%f", (float) (base_x + (map[0][0] - min_x) * scale_x)) + " Y = " + String.format("%f", (float) (base_y + (map[0][1] - min_y) * scale_y)));
-                    path.moveTo((float) (base_x + (map[0][0] - min_x) * scale_x), (float) (base_y + (map[0][1] - min_y) * scale_y));
-                    for (int i = 1; i < map.length; i++) {
-                        Log.d(TAG, "DrawMap to X = " + (float) (base_x + (map[i][0] - min_x) * scale_x) + " Y = " + (float) (base_y + (map[i][1] - min_y) * scale_y));
-                        path.lineTo((float) (base_x + (map[i][0] - min_x) * scale_x), (float) (base_y + (map[i][1] - min_y) * scale_y));
-                    }
-                    path.close();
-                } else if (map.length == 9) {
-                    path.moveTo((float) (base_x + (map[0][0] - min_x) * scale_x), (float) (base_y + (map[0][1] - min_y) * scale_y));
-                    path.lineTo((float) (base_x + (map[8][0] - min_x) * scale_x), (float) (base_y + (map[8][1] - min_y) * scale_y));
+        if (map.length < 9) {
+            Log.d(TAG, "DrawMap X = " + String.format("%f", (float) (base_x + (map[0][0] - min_x) * scale_x)) + " Y = " + String.format("%f", (float) (base_y + (map[0][1] - min_y) * scale_y)));
+            path.moveTo((float) (base_x + (map[0][0] - min_x) * scale_x), (float) (base_y + (map[0][1] - min_y) * scale_y));
+            for (int i = 1; i < map.length; i++) {
+                Log.d(TAG, "DrawMap to X = " + (float) (base_x + (map[i][0] - min_x) * scale_x) + " Y = " + (float) (base_y + (map[i][1] - min_y) * scale_y));
+                path.lineTo((float) (base_x + (map[i][0] - min_x) * scale_x), (float) (base_y + (map[i][1] - min_y) * scale_y));
+            }
+            path.close();
+        } else if (map.length == 9) {
+            path.moveTo((float) (base_x + (map[0][0] - min_x) * scale_x), (float) (base_y + (map[0][1] - min_y) * scale_y));
+            path.lineTo((float) (base_x + (map[8][0] - min_x) * scale_x), (float) (base_y + (map[8][1] - min_y) * scale_y));
 
-                    path.moveTo((float) (base_x + (map[2][0] - min_x) * scale_x), (float) (base_y + (map[2][1] - min_y) * scale_y));
-                    path.lineTo((float) (base_x + (map[1][0] - min_x) * scale_x), (float) (base_y + (map[1][1] - min_y) * scale_y));
+            path.moveTo((float) (base_x + (map[2][0] - min_x) * scale_x), (float) (base_y + (map[2][1] - min_y) * scale_y));
+            path.lineTo((float) (base_x + (map[1][0] - min_x) * scale_x), (float) (base_y + (map[1][1] - min_y) * scale_y));
 
-                    path.moveTo((float) (base_x + (map[3][0] - min_x) * scale_x), (float) (base_y + (map[3][1] - min_y) * scale_y));
-                    path.lineTo((float) (base_x + (map[4][0] - min_x) * scale_x), (float) (base_y + (map[4][1] - min_y) * scale_y));
+            path.moveTo((float) (base_x + (map[3][0] - min_x) * scale_x), (float) (base_y + (map[3][1] - min_y) * scale_y));
+            path.lineTo((float) (base_x + (map[4][0] - min_x) * scale_x), (float) (base_y + (map[4][1] - min_y) * scale_y));
 
-                    path.moveTo((float) (base_x + (map[6][0] - min_x) * scale_x), (float) (base_y + (map[6][1] - min_y) * scale_y));
-                    path.lineTo((float) (base_x + (map[5][0] - min_x) * scale_x), (float) (base_y + (map[5][1] - min_y) * scale_y));
+            path.moveTo((float) (base_x + (map[6][0] - min_x) * scale_x), (float) (base_y + (map[6][1] - min_y) * scale_y));
+            path.lineTo((float) (base_x + (map[5][0] - min_x) * scale_x), (float) (base_y + (map[5][1] - min_y) * scale_y));
 
-                    path.moveTo((float) (base_x + (map[7][0] - min_x) * scale_x), (float) (base_y + (map[7][1] - min_y) * scale_y));
-                    path.lineTo((float) (base_x + (map[8][0] - min_x) * scale_x), (float) (base_y + (map[8][1] - min_y) * scale_y));
-                } else {
-                    path.moveTo((float) (base_x + (map[0][0] - min_x) * scale_x), (float) (base_y + (map[0][1] - min_y) * scale_y));
-                    for (int i = 1; i < map.length; i++) {
-                        path.lineTo((float) (base_x + (map[i][0] - min_x) * scale_x), (float) (base_y + (map[i][1] - min_y) * scale_y));
-                    }
+            path.moveTo((float) (base_x + (map[7][0] - min_x) * scale_x), (float) (base_y + (map[7][1] - min_y) * scale_y));
+            path.lineTo((float) (base_x + (map[8][0] - min_x) * scale_x), (float) (base_y + (map[8][1] - min_y) * scale_y));
+        } else {
+            path.moveTo((float) (base_x + (map[0][0] - min_x) * scale_x), (float) (base_y + (map[0][1] - min_y) * scale_y));
+            for (int i = 1; i < map.length; i++) {
+                path.lineTo((float) (base_x + (map[i][0] - min_x) * scale_x), (float) (base_y + (map[i][1] - min_y) * scale_y));
+            }
 
-                    if (map_other.length>9){
-                        path.moveTo((float) (base_x + (map_other[0][0] - min_x) * scale_x), (float) (base_y + (map_other[0][1] - min_y) * scale_y));
-                        for (int i = 1; i < map.length; i++) {
-                            path.lineTo((float) (base_x + (map_other[i][0] - min_x) * scale_x), (float) (base_y + (map_other[i][1] - min_y) * scale_y));
-                        }
-                    }
-
-                    for (int i = 0, j = 0; i < map.length && j < map_other.length; i++, j++) {
-                        path.moveTo((float) (base_x + (map[i][0] - min_x) * scale_x), (float) (base_y + (map[i][1] - min_y) * scale_y));
-                        path.lineTo((float) (base_x + (map_other[j][0] - min_x) * scale_x), (float) (base_y + (map_other[j][1] - min_y) * scale_y));
-                    }
-
+            if (map_other.length>9){
+                path.moveTo((float) (base_x + (map_other[0][0] - min_x) * scale_x), (float) (base_y + (map_other[0][1] - min_y) * scale_y));
+                for (int i = 1; i < map.length; i++) {
+                    path.lineTo((float) (base_x + (map_other[i][0] - min_x) * scale_x), (float) (base_y + (map_other[i][1] - min_y) * scale_y));
                 }
-                canvas2.drawPath(path, paint);
+            }
 
-                path.moveTo((float) (base_x + (car[body.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(0)][1] - min_y) * scale_y));
-                for (int i = 1; i < body.size(); i++){
-                    Log.d(TAG, "for 寰幆 DrawMap to X = " + (float) (base_x + (car[body.get(i)][0] - min_x) * scale_x)+ " Y = " + (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y));
-                    path.lineTo((float) (base_x + (car[body.get(i)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y));
-                }
+            for (int i = 0, j = 0; i < map.length && j < map_other.length; i++, j++) {
+                path.moveTo((float) (base_x + (map[i][0] - min_x) * scale_x), (float) (base_y + (map[i][1] - min_y) * scale_y));
+                path.lineTo((float) (base_x + (map_other[j][0] - min_x) * scale_x), (float) (base_y + (map_other[j][1] - min_y) * scale_y));
+            }
 
-                path.close();
+        }
+        canvas2.drawPath(path, paint);
 
-                canvas2.drawPath(path, paint);
+        path.moveTo((float) (base_x + (car[body.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(0)][1] - min_y) * scale_y));
+        for (int i = 1; i < body.size(); i++){
+            Log.d(TAG, "for 寰幆 DrawMap to X = " + (float) (base_x + (car[body.get(i)][0] - min_x) * scale_x)+ " Y = " + (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y));
+            path.lineTo((float) (base_x + (car[body.get(i)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y));
+        }
 
-                paint.setStyle(Paint.Style.FILL_AND_STROKE);
+        path.close();
 
-                if (osdHeading != null) {
-                    Path pathText = new Path();
-                    pathText.moveTo(10, 170);
-                    pathText.lineTo(700, 170);
-                    canvas2.drawTextOnPath(osdHeading, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
-                }
+        canvas2.drawPath(path, paint);
 
-                if (osdMoveDirect != null) {
-                    Path pathText = new Path();
-                    pathText.moveTo(10, 30);
-                    pathText.lineTo(700, 30);
-                    canvas2.drawTextOnPath(osdMoveDirect, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
-                }
+        paint.setStyle(Paint.Style.FILL_AND_STROKE);
 
-                if (osdRtkSpeed != null) {
-                    Path pathText = new Path();
-                    pathText.moveTo(10, 240);
-                    pathText.lineTo(700, 240);
-                    canvas2.drawTextOnPath(osdRtkSpeed, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
-                }
+        if (osdHeading != null) {
+            Path pathText = new Path();
+            pathText.moveTo(10, 170);
+            pathText.lineTo(700, 170);
+            canvas2.drawTextOnPath(osdHeading, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+        }
 
-                if (osdQf != null) {
-                    Path pathText = new Path();
-                    pathText.moveTo(10, 120);
-                    pathText.lineTo(700, 120);
-                    canvas2.drawTextOnPath(osdQf, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
-                }
+//        if (osdMoveDirect != null) {
+//            Path pathText = new Path();
+//            pathText.moveTo(10, 30);
+//            pathText.lineTo(700, 30);
+//            canvas2.drawTextOnPath(osdMoveDirect, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+//        }
+
+//        if (osdRtkSpeed != null) {
+//            Path pathText = new Path();
+//            pathText.moveTo(10, 240);
+//            pathText.lineTo(700, 240);
+//            canvas2.drawTextOnPath(osdRtkSpeed, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+//        }
+
+//        if (osdQf != null) {
+//            Path pathText = new Path();
+//            pathText.moveTo(10, 120);
+//            pathText.lineTo(700, 120);
+//            canvas2.drawTextOnPath(osdQf, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+//        }
 
         {
             BigDecimal bd = new BigDecimal(gpsSpeed);
@@ -408,30 +410,139 @@
             canvas2.drawTextOnPath("GPS閫熷害:" + bd, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
         }
 
-                // 鎻愪氦鐢诲竷
-                Canvas canvas = holder.lockCanvas();
-                if (canvas != null){
+        // 鎻愪氦鐢诲竷
+        Canvas canvas = holder.lockCanvas();
+        if (canvas != null){
 
-                    canvas.drawBitmap(bmp, 0, 0, paint);
-                    holder.unlockCanvasAndPost(canvas);
-                }
+            canvas.drawBitmap(bmp, 0, 0, paint);
+            holder.unlockCanvasAndPost(canvas);
+        }
     }
-    public void DrawMapAll(List<Double> mainAnt, final double[][][] map, final double[][] car,
-                        List<Integer>body, List<Integer> tire) {
-        if (canvas2 == null || bmp == null) {
+
+    @Override
+    public void onClick(View v) {
+        switch (v.getId()){
+            case R.id.btn_reduce:
+
+                if (pixels < 5){
+                    pixels = 5;
+                    Toast.makeText(_mActivity, "宸茬粡鏄渶灏忎簡锛屼笉鑳藉啀灏忎簡", Toast.LENGTH_SHORT).show();
+                }else{
+                    pixels -= 5;
+                }
+                break;
+            case R.id.btn_amplify:
+                if (pixels >80){
+                    Toast.makeText(_mActivity, "宸茬粡鏄渶澶т簡", Toast.LENGTH_SHORT).show();
+                    pixels = 80;
+                }else{
+                    pixels+=5;
+                }
+                break;
+        }
+    }
+
+    class PointF {
+        double x;
+        double y;
+
+        public PointF(double x, double y) {
+            this.x = x;
+            this.y = y;
+        }
+
+        double getX() {
+            return x;
+        }
+
+        double getY() {
+            return y;
+        }
+
+        void setX(double x) {
+            this.x = x;
+        }
+
+        void setY(double y) {
+            this.y = y;
+        }
+    }
+
+    public PointF rotatePoint(PointF oldPoint, PointF centre, double degree) {
+        PointF newPoint = new PointF(0, 0);
+
+        newPoint.setX( (oldPoint.getX()-centre.getX())*Math.cos(Math.toRadians(degree)) - (oldPoint.getY()-centre.getY())*Math.sin(Math.toRadians(degree)) + centre.getX() );
+        newPoint.setY ( (oldPoint.getX()-centre.getX())*Math.sin(Math.toRadians(degree)) + (oldPoint.getY()-centre.getY())*Math.cos(Math.toRadians(degree)) + centre.getY() );
+
+        return newPoint;
+    }
+
+
+    public void DrawMapAll(double yaw, List<Double> mainAnt, double[][][] map, double [][]map_other, double[][] car,
+                           List<Integer>body, List<Integer> tire) {
+        if (canvas2 == null || bmp == null || bmp2 == null || canvas3 == null) {
             return;
         }
         long scale_x,scale_y;
 //        _mActivity.runOnUiThread(new Runnable() {
 //            @Override
 //            public void run() {
-                double base_x = 300, base_y = 20;
-                double max_x = 0, min_x = 0, max_y = 0, min_y = 0;
+        float base_x = 300;
+        float base_y = 20;
+        double max_x = 0, min_x = 0, max_y = 0, min_y = 0;
 
 //                Log.d(TAG, "DrawMap map size " + map.length + " car size " + car.length);
 
+        PointF mainPoint = new PointF(mainAnt.get(0), mainAnt.get(1));
+
+//        Log.d(TAG, String.format("涓诲ぉ绾� X = %f Y = %f 鏃嬭浆瑙掑害 %f", mainPoint.getX(), mainPoint.getY(), yaw));
 
         for (int x = 0; x < map.length; x++) {
+            for (int j = 0; j < map[x].length; j++) {
+                PointF oldPoint = new PointF(map[x][j][0], map[x][j][1]);
+
+                PointF newPoint = rotatePoint(oldPoint, mainPoint, yaw );
+
+                map[x][j][0] = newPoint.getX();
+                map[x][j][1] = newPoint.getY();
+
+                map[x][j][0] = map[x][j][0] - mainPoint.getX();
+                map[x][j][1] = map[x][j][1] - mainPoint.getY();
+                map[x][j][1] = -map[x][j][1];
+            }
+        }
+
+        for (int i = 0; i < car.length; i++) {
+            PointF oldPoint = new PointF(car[i][0], car[i][1]);
+            PointF newPoint = rotatePoint(oldPoint, mainPoint, yaw );
+            car[i][0] = newPoint.getX();
+            car[i][1] = newPoint.getY();
+
+            car[i][0] = car[i][0] - mainPoint.getX();
+            car[i][1] = car[i][1] - mainPoint.getY();
+            car[i][1] = -car[i][1];
+        }
+
+        for (int i = 0; i < map_other.length; i++) {
+            PointF oldPoint = new PointF(map_other[i][0], map_other[i][1]);
+            PointF newPoint = rotatePoint(oldPoint, mainPoint, yaw );
+            map_other[i][0] = newPoint.getX();
+            map_other[i][1] = newPoint.getY();
+
+            map_other[i][0] = map_other[i][0] - mainPoint.getX();
+            map_other[i][1] = map_other[i][1] - mainPoint.getY();
+            map_other[i][1] = -map_other[i][1];
+        }
+
+        scale_x = Math.round(Math.abs(pixels / Math.sqrt(Math.pow(car[0][0], 2) + Math.pow(car[0][1], 2)) ));
+        scale_y = scale_x;
+
+        base_x = bmp.getWidth() / 2;
+        base_y = bmp.getHeight() * 7 / 10;
+
+        Log.d(TAG, String.format("DrawMapAll scale_x = %d 杞﹀ご鎹� = %f", scale_x, Math.sqrt(Math.pow(car[0][0], 2) + Math.pow(car[0][1], 2))));
+
+/*        for (int x = 0; x < map.length; x++) {
             for (int j = 0; j < map[x].length; j++) {
                 if (x == 0&&j==0) {
                     max_x = map[0][0][0];
@@ -505,7 +616,7 @@
             scale_x = scale_y;
         } else {
             scale_y = scale_x;
-        }
+        }*/
 
 //        Log.d(TAG, "DrawMapAll scale_x " + scale_x + " scale_y " + scale_y);
 
@@ -517,39 +628,34 @@
         }
         paint.setStyle(Paint.Style.FILL_AND_STROKE);
         paint.setColor(Color.BLUE);
-
-        canvas2.drawCircle((float) (base_x + (mainAnt.get(0) - min_x) * scale_x), (float) (base_y + (0 - mainAnt.get(1) - min_y) * scale_y), 2, paint);
+//        canvas2.drawCircle((float) (base_x + (mainAnt.get(0) - min_x) * scale_x), (float) (base_y + (mainAnt.get(1) - min_y) * scale_y), 2, paint);
+        canvas2.drawCircle((float) base_x, (float) base_y, 2, paint);
 
         paint.setColor(Color.RED);
-        canvas2.drawCircle((float) (base_x + (car[tire.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(0)][1] - min_y) * scale_y), 2.5f, paint);
-        canvas2.drawCircle((float) (base_x + (car[tire.get(1)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(1)][1] - min_y) * scale_y), 2.5f, paint);
-        canvas2.drawCircle((float) (base_x + (car[tire.get(2)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(2)][1] - min_y) * scale_y), 2.5f, paint);
-        canvas2.drawCircle((float) (base_x + (car[tire.get(3)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(3)][1] - min_y) * scale_y), 2.5f, paint);
+//        canvas2.drawCircle((float) (base_x + (car[tire.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(0)][1] - min_y) * scale_y), 2.5f, paint);
+//        canvas2.drawCircle((float) (base_x + (car[tire.get(1)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(1)][1] - min_y) * scale_y), 2.5f, paint);
+//        canvas2.drawCircle((float) (base_x + (car[tire.get(2)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(2)][1] - min_y) * scale_y), 2.5f, paint);
+//        canvas2.drawCircle((float) (base_x + (car[tire.get(3)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(3)][1] - min_y) * scale_y), 2.5f, paint);
 
-
+        canvas2.drawCircle((float) (base_x + (car[tire.get(0)][0]) * scale_x), (float) (base_y + (car[tire.get(0)][1]) * scale_y), 2.5f, paint);
+        canvas2.drawCircle((float) (base_x + (car[tire.get(1)][0]) * scale_x), (float) (base_y + (car[tire.get(1)][1]) * scale_y), 2.5f, paint);
+        canvas2.drawCircle((float) (base_x + (car[tire.get(2)][0]) * scale_x), (float) (base_y + (car[tire.get(2)][1]) * scale_y), 2.5f, paint);
+        canvas2.drawCircle((float) (base_x + (car[tire.get(3)][0]) * scale_x), (float) (base_y + (car[tire.get(3)][1]) * scale_y), 2.5f, paint);
 
         paint.setStyle(Paint.Style.STROKE);
         paint.setColor(Color.BLACK);
 
-
-
-
-
         Path path = new Path();
 
         for (int k = 0; k < map.length; k++) {
-
-
-
-
             Log.i(TAG, String.format("all DrawMap: map[%d].length=[%d]",k,map[k].length));
             if (map[k].length < 9) {
 //                Log.d(TAG, String.format("map[%d][0][0]=%f,X=%f",k,map[k][0][0], (float) (base_x + (map[k][0][0] - min_x) * scale_x)) + String.format("map[%d][0][1]=%f,Y=%f",k,map[k][0][1], (float) (base_y + (map[k][0][1] - min_y) * scale_y)));
-                path.moveTo((float) (base_x + (map[k][0][0] - min_x) * scale_x), (float) (base_y + (map[k][0][1] - min_y) * scale_y));
+                path.moveTo((float) (base_x + (map[k][0][0]) * scale_x), (float) (base_y + (map[k][0][1]) * scale_y));
                 for (int i = 1; i < map[k].length; i++) {
 //                    Log.i(TAG,String.format("map[%d][%d][0]=%f,to X=%f",k,i,map[k][i][0],(float) (base_x + (map[k][i][0] - min_x) * scale_x)));
 //                    Log.i(TAG,String.format("map[%d][%d][1]=%f,to Y=%f",k,i,map[k][i][1],(float) (base_y + (map[k][i][1] - min_y) * scale_y)));
-                    path.lineTo((float) (base_x + (map[k][i][0] - min_x) * scale_x), (float) (base_y + (map[k][i][1] - min_y) * scale_y));
+                    path.lineTo((float) (base_x + (map[k][i][0]) * scale_x), (float) (base_y + (map[k][i][1]) * scale_y));
                 }
                 path.close();
             } else if (map[k].length == 9) {
@@ -586,78 +692,368 @@
                 }
 
             }
-
-
         }
 
         canvas2.drawPath(path, paint);
 
-                path.moveTo((float) (base_x + (car[body.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(0)][1] - min_y) * scale_y));
-                for (int i = 1; i < body.size(); i++){
+        path.moveTo((float) (base_x + (car[body.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(0)][1] - min_y) * scale_y));
+        for (int i = 1; i < body.size(); i++){
 //                    Log.d(TAG, "for 寰幆 DrawMap to X = " + (float) (base_x + (car[body.get(i)][0] - min_x) * scale_x)+ " Y = " + (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y));
-                    Log.i(TAG,String.format("car[%d][0]=%f,to X =%f,car[%d][1]=%f,to Y=%f",i,car[body.get(i)][0],
-                            (float) (base_x + (car[body.get(i)][0] - min_x) * scale_x),i,car[body.get(i)][1],(float) (base_y + (car[body.get(i)][1] - min_y) * scale_y)));
-                    path.lineTo((float) (base_x + (car[body.get(i)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y));
-                }
+            Log.i(TAG,String.format("car[%d][0]=%f,to X =%f,car[%d][1]=%f,to Y=%f",i,car[body.get(i)][0],
+                    (float) (base_x + (car[body.get(i)][0] - min_x) * scale_x),i,car[body.get(i)][1],(float) (base_y + (car[body.get(i)][1] - min_y) * scale_y)));
+            path.lineTo((float) (base_x + (car[body.get(i)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y));
+        }
 
-                path.close();
+        path.close();
 
-                canvas2.drawPath(path, paint);
+        canvas2.drawPath(path, paint);
 
 
-                paint.setStyle(Paint.Style.FILL_AND_STROKE);
+        paint.setStyle(Paint.Style.FILL_AND_STROKE);
 
-                if (osdHeading != null) {
-                    Path pathText = new Path();
-                    pathText.moveTo(10, 170);
-                    pathText.lineTo(700, 170);
-                    canvas2.drawTextOnPath(osdHeading, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
-                }
+        canvas3.drawColor(Color.YELLOW);
 
-                if (osdMoveDirect != null) {
-                    Path pathText = new Path();
-                    pathText.moveTo(10, 30);
-                    pathText.lineTo(700, 30);
-                    canvas2.drawTextOnPath(osdMoveDirect, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
-                }
+        if (osdHeading != null) {
+            Path pathText = new Path();
+            pathText.moveTo(10, 30);
+            pathText.lineTo(700, 30);
+            canvas3.drawTextOnPath(osdHeading, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+        }
 
-                if (osdRtkSpeed != null) {
-                    Path pathText = new Path();
-                    pathText.moveTo(10, 240);
-                    pathText.lineTo(700, 240);
-                    canvas2.drawTextOnPath(osdRtkSpeed, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
-                }
-
-                if (osdQf != null) {
-                    Path pathText = new Path();
-                    pathText.moveTo(10, 120);
-                    pathText.lineTo(700, 120);
-                    canvas2.drawTextOnPath(osdQf, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
-                }
-
-        {
-            BigDecimal bd = new BigDecimal(gpsSpeed);
-            bd = bd.setScale(3, BigDecimal.ROUND_HALF_UP);
-
+//        if (osdMoveDirect != null) {
+//            Path pathText = new Path();
+//            pathText.moveTo(10, 30);
+//            pathText.lineTo(700, 30);
+//            canvas3.drawTextOnPath(osdMoveDirect, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+//        }
+//
+        if (osdRtkSpeed != null) {
             Path pathText = new Path();
             pathText.moveTo(10, 70);
             pathText.lineTo(700, 70);
-
-            canvas2.drawTextOnPath("GPS閫熷害:" + bd, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+            canvas3.drawTextOnPath(osdRtkSpeed, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
         }
+//
+//        if (osdQf != null) {
+//            Path pathText = new Path();
+//            pathText.moveTo(10, 120);
+//            pathText.lineTo(700, 120);
+//            canvas3.drawTextOnPath(osdQf, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+//        }
+
+//        {
+//            BigDecimal bd = new BigDecimal(gpsSpeed);
+//            bd = bd.setScale(3, BigDecimal.ROUND_HALF_UP);
+//
+//            Path pathText = new Path();
+//            pathText.moveTo(10, 70);
+//            pathText.lineTo(700, 70);
+//
+//            canvas3.drawTextOnPath("GPS閫熷害:" + bd, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+//        }
 
 
-                // 鎻愪氦鐢诲竷
-                Canvas canvas = holder.lockCanvas();
-                if (canvas != null){
 
-                    canvas.drawBitmap(bmp, 0, 0, paint);
-                    holder.unlockCanvasAndPost(canvas);
-                }
+        base_x = 170;
+        base_y = 350;
+
+        scale_x=scale_y = 27;
+
+        paint.setStyle(Paint.Style.FILL_AND_STROKE);
+        paint.setColor(Color.BLUE);
+//        canvas2.drawCircle((float) (base_x + (mainAnt.get(0) - min_x) * scale_x), (float) (base_y + (mainAnt.get(1) - min_y) * scale_y), 2, paint);
+        canvas3.drawCircle((float) base_x, (float) base_y, 2, paint);
+
+        paint.setColor(Color.RED);
+
+        canvas3.drawCircle((float) (base_x + (car[tire.get(0)][0]) * scale_x), (float) (base_y + (car[tire.get(0)][1]) * scale_y), 2.5f, paint);
+        canvas3.drawCircle((float) (base_x + (car[tire.get(1)][0]) * scale_x), (float) (base_y + (car[tire.get(1)][1]) * scale_y), 2.5f, paint);
+        canvas3.drawCircle((float) (base_x + (car[tire.get(2)][0]) * scale_x), (float) (base_y + (car[tire.get(2)][1]) * scale_y), 2.5f, paint);
+        canvas3.drawCircle((float) (base_x + (car[tire.get(3)][0]) * scale_x), (float) (base_y + (car[tire.get(3)][1]) * scale_y), 2.5f, paint);
+
+
+
+        Path pathCanvs3 = new Path();
+        pathCanvs3.moveTo((float) (base_x + (car[body.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(0)][1] - min_y) * scale_y));
+        for (int i = 1; i < body.size(); i++){
+//                    Log.d(TAG, "for 寰幆 DrawMap to X = " + (float) (base_x + (car[body.get(i)][0] - min_x) * scale_x)+ " Y = " + (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y));
+            Log.i(TAG,String.format("car[%d][0]=%f,to X =%f,car[%d][1]=%f,to Y=%f",i,car[body.get(i)][0],
+                    (float) (base_x + (car[body.get(i)][0] - min_x) * scale_x),i,car[body.get(i)][1],(float) (base_y + (car[body.get(i)][1] - min_y) * scale_y)));
+            pathCanvs3.lineTo((float) (base_x + (car[body.get(i)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y));
+        }
+        paint.setStyle(Paint.Style.STROKE);
+        paint.setColor(Color.BLACK);
+        pathCanvs3.close();
+        canvas3.drawPath(pathCanvs3,paint);
+
+        Paint mPaint = new Paint();
+        mPaint.setTextSize(20);
+        mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
+        osdMoveDirect="9.4345";
+        if (osdMoveDirect != null) {
+            Path pathText = new Path();
+            pathText.moveTo(base_x-110, base_y-35);
+            pathText.lineTo(base_x-20, base_y-35);
+            canvas3.drawTextOnPath(String.valueOf(leftDistance), pathText, 0, 0, mPaint);//閫嗘椂閽堢敓鎴�
+        }
+        if (osdMoveDirect != null) {
+            Path pathText = new Path();
+            pathText.moveTo(base_x+30, base_y-35);
+            pathText.lineTo(base_x+110, base_y-35);
+            canvas3.drawTextOnPath(String.valueOf(rightDistance), pathText, 0, 0, mPaint);//閫嗘椂閽堢敓鎴�
+        }
+        paint.setColor(Color.RED);
+        canvas3.drawLine(base_x-120,base_y-200,base_x-120,base_y+200,paint);
+        canvas3.drawLine(base_x+120,base_y-200,base_x+120,base_y+200,paint);
+
+        DrawArrows(canvas3,Color.GREEN,15f,base_x-20,base_y-30,base_x-120,base_y-30);//宸﹁竟绠ご锛堝乏杈硅窛
+        DrawArrows(canvas3,Color.GREEN,15f,base_x+20,base_y-30,base_x+120,base_y-30);//鍙宠竟绠ご锛堣竟璺�
+
+
+        // 鎻愪氦鐢诲竷
+        Canvas canvas = holder.lockCanvas();
+        if (canvas != null){
+
+            canvas.drawBitmap(bmp, 0, 0, paint);
+            canvas.drawBitmap(bmp2, screen_width*2/3, 0, paint);
+            holder.unlockCanvasAndPost(canvas);
+        }
 //            }
 //        });
     }
+    /*
+        public void DrawMapAll(List<Double> mainAnt, final double[][][] map, final double[][] car,
+            List<Integer>body, List<Integer> tire) {
+                if (canvas2 == null || bmp == null) {
+                    return;
+                }
+                long scale_x,scale_y;
+    //        _mActivity.runOnUiThread(new Runnable() {
+    //            @Override
+    //            public void run() {
+                    double base_x = 300, base_y = 20;
+                    double max_x = 0, min_x = 0, max_y = 0, min_y = 0;
 
+    //                Log.d(TAG, "DrawMap map size " + map.length + " car size " + car.length);
+
+
+            for (int x = 0; x < map.length; x++) {
+                for (int j = 0; j < map[x].length; j++) {
+                    if (x == 0&&j==0) {
+                        max_x = map[0][0][0];
+                        min_x = map[0][0][0];
+                        max_y = map[0][0][1];
+                        min_y = map[0][0][1];
+                    } else {
+    //                    Log.i(TAG,String.format("map[%d][%d][0]=%f",x,j,map[x][j][0]));
+    //                    Log.i(TAG,String.format("map[%d][%d][1]=%f",x,j,map[x][j][1]));
+    //                    Log.i(TAG,String.format("max_x=%f,max_y=%f,min_x=%f,min_y=%f",max_x,max_y,min_x,min_y));
+                        if (max_x < map[x][j][0]) {
+
+                            max_x = map[x][j][0];
+                        }
+                        if (min_x > map[x][j][0]) {
+                            min_x = map[x][j][0];
+                        }
+                        if (max_y < map[x][j][1]) {
+                            max_y = map[x][j][1];
+                        }
+                        if (min_y > map[x][j][1]) {
+                            min_y = map[x][j][1];
+                        }
+                    }
+                }
+            }
+
+    //        Log.d(TAG, "all 鍦板浘DrawMap max_x " + max_x + " max_y " + max_y + " min_x " + min_x + " min_y " + min_y);
+            if (map_other.length>9){
+                for (int i = 0; i < map_other.length; i++) {
+
+                    if (max_x < map_other[i][0]) {
+                        max_x = map_other[i][0];
+                    }
+                    if (min_x > map_other[i][0]) {
+                        min_x = map_other[i][0];
+                    }
+                    if (max_y < map_other[i][1]) {
+                        max_y = map_other[i][1];
+                    }
+                    if (min_y > map_other[i][1]) {
+                        min_y = map_other[i][1];
+                    }
+                }
+            }
+
+
+    //        Log.d(TAG, "DrawMap鍙﹀涓�鏉℃洸绾� max_x " + max_x + " max_y " + max_y + " min_x " + min_x + " min_y " + min_y);
+
+            for (int i = 0; i < car.length; i++) {
+                if (max_x < car[i][0]) {
+                    max_x = car[i][0];
+                }
+                if (min_x > car[i][0]) {
+                    min_x = car[i][0];
+                }
+                if (max_y < car[i][1]) {
+                    max_y = car[i][1];
+                }
+                if (min_y > car[i][1]) {
+                    min_y = car[i][1];
+                }
+            }
+
+    //        Log.d(TAG, "DrawMapAll 鍜岃溅姣攎ax_x " + max_x + " max_y " + max_y + " min_x " + min_x + " min_y " + min_y);
+
+            scale_x = Math.round((screen_width - base_x - 10) / (max_x - min_x));
+            scale_y = Math.round((screen_height - base_y - 10) / (max_y - min_y));
+
+            if (scale_x >= scale_y) {
+                scale_x = scale_y;
+            } else {
+                scale_y = scale_x;
+            }
+
+    //        Log.d(TAG, "DrawMapAll scale_x " + scale_x + " scale_y " + scale_y);
+
+
+            canvas2.drawColor(Color.WHITE);
+
+            if (paint == null || canvas2==null){
+                return;
+            }
+            paint.setStyle(Paint.Style.FILL_AND_STROKE);
+            paint.setColor(Color.BLUE);
+
+            canvas2.drawCircle((float) (base_x + (mainAnt.get(0) - min_x) * scale_x), (float) (base_y + (0 - mainAnt.get(1) - min_y) * scale_y), 2, paint);
+
+            paint.setColor(Color.RED);
+            canvas2.drawCircle((float) (base_x + (car[tire.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(0)][1] - min_y) * scale_y), 2.5f, paint);
+            canvas2.drawCircle((float) (base_x + (car[tire.get(1)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(1)][1] - min_y) * scale_y), 2.5f, paint);
+            canvas2.drawCircle((float) (base_x + (car[tire.get(2)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(2)][1] - min_y) * scale_y), 2.5f, paint);
+            canvas2.drawCircle((float) (base_x + (car[tire.get(3)][0] - min_x) * scale_x), (float) (base_y + (car[tire.get(3)][1] - min_y) * scale_y), 2.5f, paint);
+
+            paint.setStyle(Paint.Style.STROKE);
+            paint.setColor(Color.BLACK);
+
+            Path path = new Path();
+
+            for (int k = 0; k < map.length; k++) {
+                Log.i(TAG, String.format("all DrawMap: map[%d].length=[%d]",k,map[k].length));
+                if (map[k].length < 9) {
+    //                Log.d(TAG, String.format("map[%d][0][0]=%f,X=%f",k,map[k][0][0], (float) (base_x + (map[k][0][0] - min_x) * scale_x)) + String.format("map[%d][0][1]=%f,Y=%f",k,map[k][0][1], (float) (base_y + (map[k][0][1] - min_y) * scale_y)));
+                    path.moveTo((float) (base_x + (map[k][0][0] - min_x) * scale_x), (float) (base_y + (map[k][0][1] - min_y) * scale_y));
+                    for (int i = 1; i < map[k].length; i++) {
+    //                    Log.i(TAG,String.format("map[%d][%d][0]=%f,to X=%f",k,i,map[k][i][0],(float) (base_x + (map[k][i][0] - min_x) * scale_x)));
+    //                    Log.i(TAG,String.format("map[%d][%d][1]=%f,to Y=%f",k,i,map[k][i][1],(float) (base_y + (map[k][i][1] - min_y) * scale_y)));
+                        path.lineTo((float) (base_x + (map[k][i][0] - min_x) * scale_x), (float) (base_y + (map[k][i][1] - min_y) * scale_y));
+                    }
+                    path.close();
+                } else if (map[k].length == 9) {
+                    path.moveTo((float) (base_x + (map[k][0][0] - min_x) * scale_x), (float) (base_y + (map[k][0][1] - min_y) * scale_y));
+                    path.lineTo((float) (base_x + (map[k][8][0] - min_x) * scale_x), (float) (base_y + (map[k][8][1] - min_y) * scale_y));
+
+                    path.moveTo((float) (base_x + (map[k][2][0] - min_x) * scale_x), (float) (base_y + (map[k][2][1] - min_y) * scale_y));
+                    path.lineTo((float) (base_x + (map[k][1][0] - min_x) * scale_x), (float) (base_y + (map[k][1][1] - min_y) * scale_y));
+
+                    path.moveTo((float) (base_x + (map[k][3][0] - min_x) * scale_x), (float) (base_y + (map[k][3][1] - min_y) * scale_y));
+                    path.lineTo((float) (base_x + (map[k][4][0] - min_x) * scale_x), (float) (base_y + (map[k][4][1] - min_y) * scale_y));
+
+                    path.moveTo((float) (base_x + (map[k][6][0] - min_x) * scale_x), (float) (base_y + (map[k][6][1] - min_y) * scale_y));
+                    path.lineTo((float) (base_x + (map[k][5][0] - min_x) * scale_x), (float) (base_y + (map[k][5][1] - min_y) * scale_y));
+
+                    path.moveTo((float) (base_x + (map[k][7][0] - min_x) * scale_x), (float) (base_y + (map[k][7][1] - min_y) * scale_y));
+                    path.lineTo((float) (base_x + (map[k][8][0] - min_x) * scale_x), (float) (base_y + (map[k][8][1] - min_y) * scale_y));
+                } else {
+                    path.moveTo((float) (base_x + (map[k][0][0] - min_x) * scale_x), (float) (base_y + (map[k][0][1] - min_y) * scale_y));
+                    for (int i = 1; i < map[k].length; i++) {
+                        path.lineTo((float) (base_x + (map[k][i][0] - min_x) * scale_x), (float) (base_y + (map[k][i][1] - min_y) * scale_y));
+                    }
+
+                    if (map_other.length>9){
+                        path.moveTo((float) (base_x + (map_other[0][0] - min_x) * scale_x), (float) (base_y + (map_other[0][1] - min_y) * scale_y));
+                        for (int i = 1; i < map[k].length; i++) {
+                            path.lineTo((float) (base_x + (map_other[i][0] - min_x) * scale_x), (float) (base_y + (map_other[i][1] - min_y) * scale_y));
+                        }
+                    }
+
+                    for (int i = 0, j = 0; i < map[k].length && j < map_other.length; i++, j++) {
+                        path.moveTo((float) (base_x + (map[k][i][0] - min_x) * scale_x), (float) (base_y + (map[k][i][1] - min_y) * scale_y));
+                        path.lineTo((float) (base_x + (map_other[j][0] - min_x) * scale_x), (float) (base_y + (map_other[j][1] - min_y) * scale_y));
+                    }
+
+                }
+
+
+            }
+
+            canvas2.drawPath(path, paint);
+
+                    path.moveTo((float) (base_x + (car[body.get(0)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(0)][1] - min_y) * scale_y));
+                    for (int i = 1; i < body.size(); i++){
+    //                    Log.d(TAG, "for 寰幆 DrawMap to X = " + (float) (base_x + (car[body.get(i)][0] - min_x) * scale_x)+ " Y = " + (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y));
+                        Log.i(TAG,String.format("car[%d][0]=%f,to X =%f,car[%d][1]=%f,to Y=%f",i,car[body.get(i)][0],
+                                (float) (base_x + (car[body.get(i)][0] - min_x) * scale_x),i,car[body.get(i)][1],(float) (base_y + (car[body.get(i)][1] - min_y) * scale_y)));
+                        path.lineTo((float) (base_x + (car[body.get(i)][0] - min_x) * scale_x), (float) (base_y + (car[body.get(i)][1] - min_y) * scale_y));
+                    }
+
+                    path.close();
+
+                    canvas2.drawPath(path, paint);
+
+
+                    paint.setStyle(Paint.Style.FILL_AND_STROKE);
+
+                    if (osdHeading != null) {
+                        Path pathText = new Path();
+                        pathText.moveTo(10, 170);
+                        pathText.lineTo(700, 170);
+                        canvas2.drawTextOnPath(osdHeading, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+                    }
+
+                    if (osdMoveDirect != null) {
+                        Path pathText = new Path();
+                        pathText.moveTo(10, 30);
+                        pathText.lineTo(700, 30);
+                        canvas2.drawTextOnPath(osdMoveDirect, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+                    }
+
+                    if (osdRtkSpeed != null) {
+                        Path pathText = new Path();
+                        pathText.moveTo(10, 240);
+                        pathText.lineTo(700, 240);
+                        canvas2.drawTextOnPath(osdRtkSpeed, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+                    }
+
+                    if (osdQf != null) {
+                        Path pathText = new Path();
+                        pathText.moveTo(10, 120);
+                        pathText.lineTo(700, 120);
+                        canvas2.drawTextOnPath(osdQf, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+                    }
+
+            {
+                BigDecimal bd = new BigDecimal(gpsSpeed);
+                bd = bd.setScale(3, BigDecimal.ROUND_HALF_UP);
+
+                Path pathText = new Path();
+                pathText.moveTo(10, 70);
+                pathText.lineTo(700, 70);
+
+                canvas2.drawTextOnPath("GPS閫熷害:" + bd, pathText, 0, 0, paint);//閫嗘椂閽堢敓鎴�
+            }
+
+
+                    // 鎻愪氦鐢诲竷
+                    Canvas canvas = holder.lockCanvas();
+                    if (canvas != null){
+
+                        canvas.drawBitmap(bmp, 0, 0, paint);
+                        holder.unlockCanvasAndPost(canvas);
+                    }
+    //            }
+    //        });
+        }
+    */
     int line = 0;
     int map_line = 0;
     int map_line_other = 0;
@@ -728,7 +1124,7 @@
 
                     BigDecimal bd = new BigDecimal(timeCarPos.getSpeed());
                     bd = bd.setScale(3, BigDecimal.ROUND_HALF_UP);
-                    osdRtkSpeed = "璁$畻閫熷害:" + bd;
+                    osdRtkSpeed = "閫熷害:" + bd;
 
                     osdQf = "QF锛�" + String.valueOf(timeCarPos.getQf());
 
@@ -743,7 +1139,7 @@
                         if ((i % 2) == 0) {
                             car[line][0] = points.get(i);
                         } else {
-                            double value = 0 - points.get(i);
+                            double value = points.get(i);
                             car[line][1] = value;
                             line++;
                         }
@@ -752,7 +1148,6 @@
                     map_id = timeCarPos.getMap_id();
 
                     List<Double> mainAnt = timeCarPos.getMain_ant();
-                    Point mainPoint = new Point(mainAnt.get(0), mainAnt.get(1));
                     List<Integer> tire1 = timeCarPos.getLeft_front_tire();
                     List<Integer> tire2 = timeCarPos.getRight_front_tire();
                     List<Integer> tire3 = timeCarPos.getLeft_rear_tire();
@@ -761,6 +1156,8 @@
                     List<Integer> body = timeCarPos.getBody();
 
                     List<Integer> tire = new ArrayList<>();
+
+                    double yaw = timeCarPos.getHeading();
 
                     tire.add(tire1.get(0));
                     tire.add(tire2.get(0));
@@ -790,140 +1187,109 @@
 
                     Type type = new TypeToken<List<ExamMap>>(){}.getType();
                     if (buffer != null){
-                       examMaps= gson.fromJson(buffer.toString().trim(), type);
+                        examMaps= gson.fromJson(buffer.toString().trim(), type);
                     }else{
                         examMaps = gson.fromJson(newmap.trim(),type);
                     }
+                    map_id = -1;
+                    if (map_id == -1){
+                        allMap =new double[examMaps.size()][][];
+                        for (int i = 0; i < examMaps.size(); i++) {
+                            ExamMap examMap = examMaps.get(i);
 
-                if (map_id == -1){
-                    allMap =new double[examMaps.size()][][];
-                    for (int i = 0; i < examMaps.size(); i++) {
-                        ExamMap examMap = examMaps.get(i);
-
-                        List<ExamMap.PointBean> pointBeanList = examMap.getPoint();
-
-                        for(int j=0; j<pointBeanList.size();j++){
-                            List<Double> xys = pointBeanList.get(j).getXy();
-                            if(j==0){
-                                map = new double[xys.size()/2][2];
-                                allMap[sanwei] = new double[xys.size()/2][2];
-                                map_line = 0;
-                                for (int k=0; k<xys.size();k++){
-                                    if ((k % 2) == 0) {
-                                        map[map_line][0] = xys.get(k);
-                                    } else {
-                                        double value = 0 - xys.get(k);
-                                        map[map_line][1] = value;
-                                        map_line++;
-                                    }
-                                }
-                                allMap[sanwei] = map.clone();
-                                sanwei++;
-
-                            }else{
-//                                MyLog.i(TAG,"all鏀寔鏇茬嚎");
-                                map_other = new double[xys.size()/2][2];
-                                for (int k=0; k<xys.size();k++){
-                                    if ((k % 2) == 0) {
-                                        map_other[map_line_other][0] = xys.get(k);
-                                    } else {
-                                        double value = 0 - xys.get(k);
-                                        map_other[map_line_other][1] = value;
-                                        map_line_other++;
-                                    }
-                                }
-                            }
-
-
-
-                        }
-
-
-                    }
-                    DrawMapAll(mainAnt,allMap,car,body,tire);
-                }else{
-                    for (int i = 0; i < examMaps.size(); i++) {
-                        ExamMap examMap = examMaps.get(i);
-                        if (map_id == examMap.getId()){
                             List<ExamMap.PointBean> pointBeanList = examMap.getPoint();
 
                             for(int j=0; j<pointBeanList.size();j++){
                                 List<Double> xys = pointBeanList.get(j).getXy();
                                 if(j==0){
                                     map = new double[xys.size()/2][2];
-
-
-
+                                    allMap[sanwei] = new double[xys.size()/2][2];
+                                    map_line = 0;
                                     for (int k=0; k<xys.size();k++){
                                         if ((k % 2) == 0) {
                                             map[map_line][0] = xys.get(k);
                                         } else {
                                             double value = xys.get(k);
-                                            Log.i(TAG, "onCEvent: map鏂板��=" + value + " 浣嶇疆锛�" + k);
                                             map[map_line][1] = value;
                                             map_line++;
                                         }
                                     }
-                                    Log.i(TAG,String.format("涓嬮潰寮�濮嬫棆杞紝map.length=%d",map.length));
-                                    Point point2 = new Point(map[0][0],map[0][1]);
-                                    double deg = 0.0;
-                                    switch (map.length){
-
-                                        case 8:
-                                            Point point1 = new Point(map[map.length-1][0],map[map.length-1][1]);
-                                            deg = Utils.YawOf(point2,point1);
-                                            deg +=270;
-                                            for (int k = 0; k < map.length; k++) {
-                                                Point point11 = new Point(map[k][0],map[k][1]);
-                                                Point point = Utils.rotatePoint(point11,point2,deg);
-                                                map[k][0] = point.getX();
-                                                map[k][1] = 0-point.getY();
-                                                Log.i(TAG,String.format("鏃嬭浆鍚庣殑鍊糾ap[%d][0]=%f,map[%d][1]=%f,deg=%f",k,map[k][0],k,map[k][1],deg));
-                                            }
-                                            break;
-                                        case 9:
-                                            break;
-                                        case 6:
-                                            break;
-                                            default:
-                                                break;
-                                    }
-                                    for (int k = 0; k < car.length; k++) {
-                                        Point oldPoint = new Point(car[k][0], car[k][1]);
-                                        Point newPoint = Utils.rotatePoint(oldPoint, point2, deg );
-                                        car[k][0] = newPoint.getX();
-                                        car[k][1] = newPoint.getY();
-
-//                                        car[k][0] = car[k][0] - point2.getX();
-//                                        car[k][1] = car[k][1] - point2.getY();
-//                                        car[k][1] = -car[k][1];
-                                        Log.i(TAG,String.format("鏃嬭浆鍚庣殑鍊糲ar[%d][0]=%f,car[%d][1]=%f,deg=%f",k,car[k][0],k,car[k][1],deg));
-                                    }
+                                    allMap[sanwei] = map.clone();
+                                    sanwei++;
 
                                 }else{
-                                    MyLog.i(TAG,"鏆傛椂鏀寔鏇茬嚎");
+//                                MyLog.i(TAG,"all鏀寔鏇茬嚎");
                                     map_other = new double[xys.size()/2][2];
                                     for (int k=0; k<xys.size();k++){
                                         if ((k % 2) == 0) {
                                             map_other[map_line_other][0] = xys.get(k);
                                         } else {
-                                            double value = 0 - xys.get(k);
+                                            double value = xys.get(k);
                                             map_other[map_line_other][1] = value;
                                             map_line_other++;
                                         }
                                     }
-                                    break;
                                 }
 
 
 
                             }
-                            break;
-                        }
-                    }
 
-                    DrawMap(mainAnt, map, car, body, tire);
-                }
+
+                        }
+
+                        double [][]mapOther;
+
+                        mapOther = map_other.clone();
+
+                        DrawMapAll(yaw, mainAnt,allMap, mapOther, car,body,tire);
+                    }else{
+                        for (int i = 0; i < examMaps.size(); i++) {
+                            ExamMap examMap = examMaps.get(i);
+                            if (map_id == examMap.getId()){
+                                List<ExamMap.PointBean> pointBeanList = examMap.getPoint();
+
+                                for(int j=0; j<pointBeanList.size();j++){
+                                    List<Double> xys = pointBeanList.get(j).getXy();
+                                    if(j==0){
+                                        map = new double[xys.size()/2][2];
+
+
+
+                                        for (int k=0; k<xys.size();k++){
+                                            if ((k % 2) == 0) {
+                                                map[map_line][0] = xys.get(k);
+                                            } else {
+                                                double value = 0 - xys.get(k);
+                                                Log.i(TAG, "onCEvent: map鏂板��=" + value + " 浣嶇疆锛�" + k);
+                                                map[map_line][1] = value;
+                                                map_line++;
+                                            }
+                                        }
+                                    }else{
+                                        MyLog.i(TAG,"鏆傛椂鏀寔鏇茬嚎");
+                                        map_other = new double[xys.size()/2][2];
+                                        for (int k=0; k<xys.size();k++){
+                                            if ((k % 2) == 0) {
+                                                map_other[map_line_other][0] = xys.get(k);
+                                            } else {
+                                                double value = 0 - xys.get(k);
+                                                map_other[map_line_other][1] = value;
+                                                map_line_other++;
+                                            }
+                                        }
+                                        break;
+                                    }
+
+
+
+                                }
+                                break;
+                            }
+                        }
+
+                        DrawMap(mainAnt, map, car, body, tire);
+                    }
 
                 }
             }
@@ -933,8 +1299,6 @@
     public void onAttach(Context context) {
         super.onAttach(context);
         CEventCenter.onBindEvent(true, icEventListener, Constant.REAL_TIME_POS_CAR_TOPIC);
-        CEventCenter.onBindEvent(true, rtcmicEventListener, Constant.BIND_RTCM_TOPIC);
-        CEventCenter.onBindEvent(true, debugTxticEventListener, Constant.BIND_DEBUG_TXT);
         CEventCenter.onBindEvent(true, speedListener, Constant.BIND_RTK_SPEED_TOPIC);
     }
 
@@ -945,8 +1309,64 @@
         producer.shutdown();
         consumer.shutdown();
         CEventCenter.onBindEvent(false, icEventListener, Constant.REAL_TIME_POS_CAR_TOPIC);
-        CEventCenter.onBindEvent(false, icEventListener, Constant.BIND_RTCM_TOPIC);
-        CEventCenter.onBindEvent(false, icEventListener, Constant.BIND_DEBUG_TXT);
         CEventCenter.onBindEvent(false, speedListener, Constant.BIND_RTK_SPEED_TOPIC);
     }
+
+
+
+    void DrawArrows(Canvas canvas, int color, float arrowSize, float x1,
+                    float y1, float x2, float y2) {
+        paint.setAntiAlias(true);
+        paint.setStyle(Paint.Style.STROKE);
+        paint.setColor(color);
+
+        // 鐢荤洿绾�
+        canvas.drawLine(x1, y1, x2, y2, paint);
+
+        // 绠ご涓殑绗竴鏉$嚎鐨勮捣鐐�
+        int x3 = 0;
+        int y3 = 0;
+
+        // 绠ご涓殑绗簩鏉$嚎鐨勮捣鐐�
+        int x4 = 0;
+        int y4 = 0;
+
+        double awrad = Math.atan(3.5 / 8);
+        double[] arrXY_1 = rotateVec(x2 - x1, y2 - y1, awrad, arrowSize);
+        double[] arrXY_2 = rotateVec(x2 - x1, y2 - y1, -awrad, arrowSize);
+
+        // 绗竴绔偣
+        Double X3 = Double.valueOf(x2 - arrXY_1[0]);
+        x3 = X3.intValue();
+        Double Y3 = Double.valueOf(y2 - arrXY_1[1]);
+        y3 = Y3.intValue();
+
+        // 绗簩绔偣
+        Double X4 = Double.valueOf(x2 - arrXY_2[0]);
+        x4 = X4.intValue();
+        Double Y4 = Double.valueOf(y2 - arrXY_2[1]);
+        y4 = Y4.intValue();
+
+        Path arrowsPath = new Path();
+        arrowsPath.moveTo(x2, y2);
+        arrowsPath.lineTo(x3, y3);
+        arrowsPath.lineTo(x4, y4);
+        arrowsPath.close();
+        canvas.drawLine(x3, y3, x2, y2, paint);
+        canvas.drawLine(x4, y4, x2, y2, paint);
+    }
+
+    private double[] rotateVec(float px, float py, double ang, double arrowSize) {
+        double mathstr[] = new double[2];
+        double vx = px * Math.cos(ang) - py * Math.sin(ang);
+        double vy = px * Math.sin(ang) + py * Math.cos(ang);
+        double d = Math.sqrt(vx * vx + vy * vy);
+        vx = vx / d * arrowSize;
+        vy = vy / d * arrowSize;
+        mathstr[0] = vx;
+        mathstr[1] = vy;
+        return mathstr;
+    }
+
+
 }
diff --git a/app/src/main/java/safeluck/drive/evaluation/fragment/RoadDriveMapFragmentaa.java b/app/src/main/java/safeluck/drive/evaluation/fragment/RoadDriveMapFragmentaa.java
index 4847c6c..47f828a 100644
--- a/app/src/main/java/safeluck/drive/evaluation/fragment/RoadDriveMapFragmentaa.java
+++ b/app/src/main/java/safeluck/drive/evaluation/fragment/RoadDriveMapFragmentaa.java
@@ -16,6 +16,7 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.LinearLayout;
+import android.widget.Toast;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -45,41 +46,13 @@
 import safeluck.drive.evaluation.util.CThreadPoolExecutor;
 import safeluck.drive.evaluation.util.FileUtil;
 
-public class RoadDriveMapFragmentaa extends SupportFragment {
+public class RoadDriveMapFragmentaa extends SupportFragment implements View.OnClickListener {
 
     private static final int ALL_MAP = 100;
+    private int pixels = 80;
     private boolean isDrawing = false;
     private StringBuffer buffer = null;//瀛樻斁鍦板浘鐨刡uffer
-    private ICEventListener rtcmicEventListener = new ICEventListener() {
-        @Override
-        public void onCEvent(String topic, int msgCode, int resultCode, final Object obj) {
-            if (msgCode == Constant.DEBUG_RTCM){
-
-                CThreadPoolExecutor.runOnMainThread(new Runnable() {
-                    @Override
-                    public void run() {
-                        Log.i(TAG, "title="+(String)obj);
-                        toolbar.setTitle((String)obj);
-                    }
-                });
-            }
-        }
-    };
-    private ICEventListener debugTxticEventListener = new ICEventListener() {
-        @Override
-        public void onCEvent(String topic, int msgCode, int resultCode, final Object obj) {
-            if (msgCode == Constant.DEBUG_TXT){
-                CThreadPoolExecutor.runOnMainThread(new Runnable() {
-                    @Override
-                    public void run() {
-                        Log.i(TAG, "subtitle="+(String)obj);
-                        toolbar.setSubtitle((String)obj);
-                    }
-                });
-
-            }
-        }
-    };
+   
     private ICEventListener speedListener = new ICEventListener() {
         @Override
         public void onCEvent(String topic, int msgCode, int resultCode, Object obj) {
@@ -137,20 +110,13 @@
     }
     private int avaliableHeight,avalibleWidth;
     private void initView(View view) {
-        toolbar = view.findViewById(R.id.toolbar);
-        toolbar.setTitle("绠�鍗曞湴鍥�");
-        toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
-        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                _mActivity.onBackPressed();
-            }
-        });
+
         avaliableHeight= getResources().getDisplayMetrics().heightPixels;
         avalibleWidth = getResources().getDisplayMetrics().widthPixels;
         Log.i(TAG, "initView: aliwidht="+avalibleWidth+" height="+avaliableHeight);
         mSurfaceView = view.findViewById(R.id.surfaceview);
-
+        view.findViewById(R.id.btn_reduce).setOnClickListener(this);
+        view.findViewById(R.id.btn_amplify).setOnClickListener(this);
         holder = mSurfaceView.getHolder();
 
         holder.addCallback(new SurfaceHolder.Callback() {
@@ -268,7 +234,7 @@
             car[i][1] = -car[i][1];
         }
 
-        scale_x = Math.round(Math.abs(80 / Math.sqrt(Math.pow(car[0][0], 2) + Math.pow(car[0][1], 2)) ));
+        scale_x = Math.round(Math.abs(pixels / Math.sqrt(Math.pow(car[0][0], 2) + Math.pow(car[0][1], 2)) ));
         scale_y = scale_x;
 
         base_x = bmp.getWidth() / 2;
@@ -680,8 +646,6 @@
     public void onAttach(Context context) {
         super.onAttach(context);
         CEventCenter.onBindEvent(true, icEventListener, Constant.REAL_TIME_POS_CAR_TOPIC);
-        CEventCenter.onBindEvent(true, rtcmicEventListener, Constant.BIND_RTCM_TOPIC);
-        CEventCenter.onBindEvent(true, debugTxticEventListener, Constant.BIND_DEBUG_TXT);
         CEventCenter.onBindEvent(true, speedListener, Constant.BIND_RTK_SPEED_TOPIC);
     }
 
@@ -692,9 +656,86 @@
         producer.shutdown();
         consumer.shutdown();
         CEventCenter.onBindEvent(false, icEventListener, Constant.REAL_TIME_POS_CAR_TOPIC);
-        CEventCenter.onBindEvent(false, icEventListener, Constant.BIND_RTCM_TOPIC);
-        CEventCenter.onBindEvent(false, icEventListener, Constant.BIND_DEBUG_TXT);
         CEventCenter.onBindEvent(false, speedListener, Constant.BIND_RTK_SPEED_TOPIC);
     }
+    @Override
+    public void onClick(View v) {
+        switch (v.getId()){
+            case R.id.btn_reduce:
+
+                if (pixels < 5){
+                    pixels = 5;
+                    Toast.makeText(_mActivity, "宸茬粡鏄渶灏忎簡锛屼笉鑳藉啀灏忎簡", Toast.LENGTH_SHORT).show();
+                }else{
+                    pixels -= 5;
+                }
+                break;
+            case R.id.btn_amplify:
+                if (pixels >80){
+                    Toast.makeText(_mActivity, "宸茬粡鏄渶澶т簡", Toast.LENGTH_SHORT).show();
+                    pixels = 80;
+                }else{
+                    pixels+=5;
+                }
+                break;
+        }
+    }
+
+
+
+    void DrawArrows(Canvas canvas, int color, float arrowSize, float x1,
+                    float y1, float x2, float y2) {
+        paint.setAntiAlias(true);
+        paint.setStyle(Paint.Style.STROKE);
+        paint.setColor(color);
+
+        // 鐢荤洿绾�
+        canvas.drawLine(x1, y1, x2, y2, paint);
+
+        // 绠ご涓殑绗竴鏉$嚎鐨勮捣鐐�
+        int x3 = 0;
+        int y3 = 0;
+
+        // 绠ご涓殑绗簩鏉$嚎鐨勮捣鐐�
+        int x4 = 0;
+        int y4 = 0;
+
+        double awrad = Math.atan(3.5 / 8);
+        double[] arrXY_1 = rotateVec(x2 - x1, y2 - y1, awrad, arrowSize);
+        double[] arrXY_2 = rotateVec(x2 - x1, y2 - y1, -awrad, arrowSize);
+
+        // 绗竴绔偣
+        Double X3 = Double.valueOf(x2 - arrXY_1[0]);
+        x3 = X3.intValue();
+        Double Y3 = Double.valueOf(y2 - arrXY_1[1]);
+        y3 = Y3.intValue();
+
+        // 绗簩绔偣
+        Double X4 = Double.valueOf(x2 - arrXY_2[0]);
+        x4 = X4.intValue();
+        Double Y4 = Double.valueOf(y2 - arrXY_2[1]);
+        y4 = Y4.intValue();
+
+        Path arrowsPath = new Path();
+        arrowsPath.moveTo(x2, y2);
+        arrowsPath.lineTo(x3, y3);
+        arrowsPath.lineTo(x4, y4);
+        arrowsPath.close();
+        canvas.drawLine(x3, y3, x2, y2, paint);
+        canvas.drawLine(x4, y4, x2, y2, paint);
+    }
+
+    private double[] rotateVec(float px, float py, double ang, double arrowSize) {
+        double mathstr[] = new double[2];
+        double vx = px * Math.cos(ang) - py * Math.sin(ang);
+        double vy = px * Math.sin(ang) + py * Math.cos(ang);
+        double d = Math.sqrt(vx * vx + vy * vy);
+        vx = vx / d * arrowSize;
+        vy = vy / d * arrowSize;
+        mathstr[0] = vx;
+        mathstr[1] = vy;
+        return mathstr;
+    }
+
 
 }
diff --git a/app/src/main/res/layout/layout_mapfragment.xml b/app/src/main/res/layout/layout_mapfragment.xml
index 94b9469..edc85b3 100644
--- a/app/src/main/res/layout/layout_mapfragment.xml
+++ b/app/src/main/res/layout/layout_mapfragment.xml
@@ -1,26 +1,25 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical" android:layout_width="match_parent"
     android:layout_height="match_parent">
-    <com.google.android.material.appbar.AppBarLayout
-        xmlns:android="http://schemas.android.com/apk/res/android"
-        xmlns:app="http://schemas.android.com/apk/res-auto"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:theme="@style/AppTheme.AppBarOverlay">
 
-        <androidx.appcompat.widget.Toolbar
-            android:id="@+id/toolbar"
-            android:layout_width="match_parent"
-            android:layout_height="?attr/actionBarSize"
-            android:background="?attr/colorPrimary"
-            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
-            app:popupTheme="@style/AppTheme.NoActionBar.PopupOverlay"
-            app:titleTextAppearance="@style/Toolbar_TextAppearance_White"/>
-
-    </com.google.android.material.appbar.AppBarLayout>
     <SurfaceView
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:id="@+id/surfaceview"/>
-</LinearLayout>
\ No newline at end of file
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="bottom|left"
+        android:id="@+id/btn_amplify"
+        android:background="@drawable/btn_state_save"
+        android:text="鏀惧ぇ"/>
+    <Button
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="bottom|left"
+        android:id="@+id/btn_reduce"
+        android:background="@drawable/btn_state_save"
+        android:layout_marginLeft="120dp"
+        android:text="缂╁皬"/>
+</FrameLayout>
\ No newline at end of file

--
Gitblit v1.8.0