From 8d351bd0a88c11fb982370ce969b5e4731d314fb Mon Sep 17 00:00:00 2001
From: yy1717 <fctom1215@outlook.com>
Date: 星期四, 05 三月 2020 15:02:22 +0800
Subject: [PATCH] 更新地图

---
 app/src/main/assets/map.json                                          |   10 ++++++++++
 app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java |    9 +++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/app/src/main/assets/map.json b/app/src/main/assets/map.json
index 9e77d70..705fd4d 100644
--- a/app/src/main/assets/map.json
+++ b/app/src/main/assets/map.json
@@ -29,5 +29,15 @@
       "x-y": [-2.8984, 31.6962, -2.4065, 30.7090, -3.0759, 30.3599, -2.6023, 29.2578, -3.6962, 28.7786,-4.6667 ,30.7457]
     }
     ]
+  },
+  {
+    "id": 867,
+    "item": 4,
+    "point": [{
+      "x-y": [-1.6249, 32.5992, -1.7749, 32.8655, -1.9249, 33.0460, -2.0749, 33.1807, -2.2249, 33.2842, -2.3749, 33.3635, -2.5249, 33.4228, -2.6749, 33.4643, -2.8249, 33.4897, -2.9749, 33.4998, -3.1249, 33.4948, -3.2749, 33.4746, -3.4249, 33.4386, -3.5749, 33.3855, -3.7249, 33.3132, -3.8749, 33.2184, -4.0249, 33.0953, -4.1749, 32.9550, -4.3249, 32.8386, -4.4749, 32.7428, -4.6249, 32.6645, -4.7749, 32.6014, -4.9249, 32.5520, -5.0749, 32.5153, -5.2249, 32.4906, -5.3749, 32.4774, -5.5249, 32.4755, -5.6749, 32.4849, -5.8249, 32.5057, -5.9749, 32.5384, -6.1249, 32.5834, -6.2749, 32.6418, -6.4249, 32.7149, -6.5749, 32.8045, -6.7249, 32.9136, -6.8749, 33.0466, -7.0249, 33.2110, -7.1749, 33.4213, -7.3249, 33.7149, -7.4749, 34.4749]
+    },{
+      "x-y": [-1.1249, 32.6956, -1.2749, 33.0119, -1.4249, 33.2325, -1.5749, 33.4032, -1.7249, 33.5408, -1.8749, 33.6535, -2.0249, 33.7462, -2.1749, 33.8219, -2.3249, 33.8826, -2.4749, 33.9298, -2.6249, 33.9645, -2.7749, 33.9873, -2.9249, 33.9986, -3.0749, 33.9986, -3.2249, 33.9873, -3.3749, 33.9646, -3.5249, 33.9299, -3.6749, 33.8827, -3.8249, 33.8220, -3.9749, 33.7463, -4.1249, 33.6537, -4.2749, 33.5410, -4.4249, 33.4037, -4.5749, 33.2749, -4.7249, 33.1758, -4.8749, 33.1001, -5.0249, 33.0440, -5.1749, 33.0052, -5.3249, 32.9824, -5.4749, 32.9749, -5.6249, 32.9824, -5.7749, 33.0052, -5.9249, 33.0440, -6.0749, 33.1001, -6.2249, 33.1758, -6.3749, 33.2749, -6.5249, 33.4037, -6.6749, 33.5749, -6.8249, 33.8210, -6.9749, 34.4749]
+    }
+    ]
   }
 ]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
\ No newline at end of file
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 1ee38f5..156ac7e 100644
--- a/app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java
+++ b/app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java
@@ -288,7 +288,7 @@
 
                 Path path = new Path();
         Log.i(TAG, "DrawMap: map.length:"+map.length);
-                if (map.length != 9) {
+                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++) {
@@ -296,7 +296,7 @@
                         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 {
+                } 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));
 
@@ -311,6 +311,11 @@
 
                     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));
+                    }
                 }
                 canvas2.drawPath(path, paint);
 

--
Gitblit v1.8.0