From 2516de1365ea0ed8a5a4fefafed46d993af5a592 Mon Sep 17 00:00:00 2001
From: lizhanwei <Dana_Lee1016@126.com>
Date: 星期四, 05 三月 2020 15:32:09 +0800
Subject: [PATCH] 提交曲线

---
 app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 50 insertions(+), 10 deletions(-)

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 156ac7e..e59a92b 100644
--- a/app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java
+++ b/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];
+
+                                        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;
                                     }
 
-                                    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);
-                                            map[map_line][1] = value;
-                                            map_line++;
-                                        }
-                                    }
+
 
                                 }
                                 break;

--
Gitblit v1.8.0