lizhanwei
2020-03-20 d2e846db8685fecddd2307a9d8be623de90ee53a
app/src/main/java/safeluck/drive/evaluation/fragment/RoadDriveMapFragmentaa.java
@@ -112,17 +112,13 @@
    private int map_id;
    private double gpsSpeed = 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}};
    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}};
    //    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;
    private LinearLayout linearLayout;//surfaceview的父容器,为了移动surfaceview而使用,因为scrollto不能移动view,
    private LinkedBlockingQueue queue = new LinkedBlockingQueue(100);
    private ExecutorService producer = Executors.newSingleThreadExecutor();
    private ExecutorService consumer = Executors.newSingleThreadExecutor();
@@ -227,23 +223,7 @@
                }
            }
        }
        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);
@@ -308,6 +288,7 @@
                    paint.setStrokeWidth(1.5f);
                    paint.setAntiAlias(true);
                    paint.setColor(Color.RED);
                    paint.setPathEffect(null);
                    Log.i(TAG,"redLinesSize"+redLines.size());
                    for (List<Integer> redline: redLines
                    ) {
@@ -323,13 +304,13 @@
                        }
                    }
//                    canvas2.drawPath(path,paint);
                    canvas2.drawPath(path,paint);
                    //画虚线(分道线)
                    paint.reset();
                    paint.setStyle(Paint.Style.STROKE);
                    paint.setStrokeWidth(1.5f);
                    paint.setAntiAlias(true);
                    paint.setColor(Color.WHITE);
//                    paint.setColor(Color.WHITE);
                    paint.setPathEffect(new DashPathEffect(new float[] {15, 15}, 0));
                    for (List<Integer> greenline:
                            greenLines){
@@ -353,8 +334,7 @@
        }
        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));
@@ -366,7 +346,8 @@
        canvas2.drawPath(path, paint);
        paint.setStyle(Paint.Style.FILL_AND_STROKE);
        paint.setPathEffect(null);
        paint.setColor(Color.BLACK);
        if (osdHeading != null) {
            Path pathText = new Path();
            pathText.moveTo(10, 170);
@@ -446,8 +427,7 @@
    boolean flag = true;
    class CalRunnable implements Runnable{
        private String json;
        private int cmd;
        @Override
        public void run() {
@@ -490,7 +470,7 @@
                    car = new double[points.size() / 2][2];
                    line =0 ;map_line=0;
                    for (int i = 0; i < points.size(); i++) {
                        if ((i % 2) == 0) {
                            car[line][0] = points.get(i);