lizhanwei
2020-03-05 2516de1365ea0ed8a5a4fefafed46d993af5a592
提交曲线
1个文件已修改
50 ■■■■■ 已修改文件
app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java
@@ -127,6 +127,9 @@
//    double map[][] = {{1, 1}, {10, 1}, {10, 10}, {1, 10}};
    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}};
@@ -238,6 +241,21 @@
                        }
                    }
                }
 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);
@@ -316,6 +334,14 @@
                    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));
                        }
                    }
                }
                canvas2.drawPath(path, paint);
@@ -383,6 +409,7 @@
    int line = 0;
    int map_line = 0;
    int map_line_other = 0;
    private StringBuffer stringBuffer = new StringBuffer();
    class MessageRemoteService{
        public int msgCode;
@@ -455,6 +482,7 @@
                    line = 0;
                    map_line = 0;
                    map_line_other = 0;
                    car = new double[points.size()/2][2];
@@ -526,21 +554,33 @@
                                    List<Double> xys = pointBeanList.get(j).getXy();
                                    if(j==0){
                                        map = new double[xys.size()/2][2];
                                    }else{
                                        MyLog.i(TAG,"暂时还不支持曲线");
                                        break;
                                    }
                                    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 + " 位置:" + i);
                                                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;