yy1717
2021-04-13 5d6bac072277e62113bedbe6ab608ea88866cd3c
显示多条科目二曲线
1个文件已修改
61 ■■■■■ 已修改文件
app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java
@@ -488,7 +488,7 @@
    }
    public void DrawMapAll(double yaw, List<Double> mainAnt, double[][][] map, double [][]map_other, double[][] car,
    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;
@@ -533,17 +533,23 @@
            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();
        for (int x = 0; x < map_other.length; x++) {
            if (map_other[x] == null || map_other[x].length == 0) {
                continue;
            }
            Log.d(TAG, "预绘制曲线 " + x + " 点数 "+ map_other[x].length);
            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];
            for (int i = 0; map_other[x] != null && i < map_other[x].length; i++) {
                PointF oldPoint = new PointF(map_other[x][i][0], map_other[x][i][1]);
                PointF newPoint = rotatePoint(oldPoint, mainPoint, yaw);
                map_other[x][i][0] = newPoint.getX();
                map_other[x][i][1] = newPoint.getY();
                map_other[x][i][0] = map_other[x][i][0] - mainPoint.getX();
                map_other[x][i][1] = map_other[x][i][1] - mainPoint.getY();
                map_other[x][i][1] = -map_other[x][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;
@@ -689,10 +695,10 @@
                    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_other.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));
                if (map_other[k].length>9){
                    path.moveTo((float) (base_x + (map_other[k][0][0] - min_x) * scale_x), (float) (base_y + (map_other[k][0][1] - min_y) * scale_y));
                    for (int i = 1; i < map_other[k].length; i++) {
                        path.lineTo((float) (base_x + (map_other[k][i][0] - min_x) * scale_x), (float) (base_y + (map_other[k][i][1] - min_y) * scale_y));
                    }
                }
            }
@@ -1266,7 +1272,11 @@
                    }
                    map_id = -1;
                    if (map_id == -1){
                        double allOtherMap[][][];
                        allMap =new double[examMaps.getItems().size()][][];
                        allOtherMap = new double[examMaps.getItems().size()][][];
                        for (int i = 0; i < examMaps.getItems().size(); i++) {
                            ExamMap.ItemsBean examMap = examMaps.getItems().get(i);
@@ -1274,6 +1284,9 @@
                            for(int j=0; j<pointBeanList.size();j++){
                                List<Double> xys = pointBeanList.get(j).getXy();
                                Log.d(TAG, String.format("123 j = %d size = %d", j, xys.size()));
                                if(j==0){
                                    map = new double[xys.size()/2][2];
                                    allMap[sanwei] = new double[xys.size()/2][2];
@@ -1288,11 +1301,12 @@
                                        }
                                    }
                                    allMap[sanwei] = map.clone();
                                    sanwei++;
                                }else{
//                                MyLog.i(TAG,"all支持曲线");
                                MyLog.i(TAG,String.format("曲线 %d, 点数 %d", sanwei, xys.size()/2));
                                    map_other = new double[xys.size()/2][2];
                                    allOtherMap[sanwei] = new double[xys.size()/2][2];
                                    map_line_other = 0;
                                    for (int k=0; k<xys.size();k++){
                                        if ((k % 2) == 0) {
                                            map_other[map_line_other][0] = xys.get(k);
@@ -1302,20 +1316,20 @@
                                            map_line_other++;
                                        }
                                    }
                                    allOtherMap[sanwei] = map_other.clone();
                                }
                            }
                            sanwei++;
                        }
                        double [][]mapOther;
                        mapOther = map_other.clone();
                        DrawMapAll(yaw, mainAnt,allMap, mapOther, car,body,tire);
//                        DrawMapAll(yaw, mainAnt,allMap, mapOther, car,body,tire);
                        DrawMapAll(yaw, mainAnt,allMap, allOtherMap, car,body,tire);
                    }else{
                        for (int i = 0; i < examMaps.getItems().size(); i++) {
                            ExamMap.ItemsBean examMap = examMaps.getItems().get(i);
@@ -1324,6 +1338,9 @@
                                for(int j=0; j<pointBeanList.size();j++){
                                    List<Double> xys = pointBeanList.get(j).getXy();
                                    Log.d(TAG, String.format("j = %d size = %d", j, xys.size()));
                                    if(j==0){
                                        map = new double[xys.size()/2][2];