lizhanwei
2020-04-08 2f7c993b5d856f852645d998385be8fcec82acea
完成http下载地图和车辆模型,目前app每次重启都会下载地图
6个文件已修改
2个文件已添加
578 ■■■■■ 已修改文件
app/src/main/java/safeluck/drive/evaluation/DB/rtktb/RTKConfigUpdateWorker.kt 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/MainActivity.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/fragment/RoadDriveMapFragmentaa.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/httpmodule/HttpCarRespBean.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/httpmodule/HttpRoadMapRsp.java 241 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/httpmodule/HttpYardRsp.java 163 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/httpmodule/RetrofitCreator.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/util/Utils.java 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/DB/rtktb/RTKConfigUpdateWorker.kt
@@ -1,7 +1,7 @@
package safeluck.drive.evaluation.DB.rtktb
import android.content.Context
import android.os.Looper
import android.os.Environment
import android.text.TextUtils
import android.util.Log
import android.widget.Toast
@@ -21,9 +21,12 @@
import safeluck.drive.evaluation.bean.ExamPlatformData
import safeluck.drive.evaluation.httpmodule.HttpCarRespBean
import safeluck.drive.evaluation.httpmodule.HttpRequetBean
import safeluck.drive.evaluation.httpmodule.HttpRoadMapRsp
import safeluck.drive.evaluation.httpmodule.HttpYardRsp
import safeluck.drive.evaluation.httpmodule.RetrofitCreator.Companion.getRestService
import safeluck.drive.evaluation.im.IMSClientBootstrap
import safeluck.drive.evaluation.platformMessage.PlatFormConstant
import safeluck.drive.evaluation.util.CThreadPoolExecutor
import safeluck.drive.evaluation.util.FileUtil
import java.io.IOException
@@ -66,9 +69,49 @@
                            e.printStackTrace()
                        }
                        Log.i(TAG, "服务器返回的body=$str")
                        if (Looper.myLooper() == Looper.getMainLooper()) {
                            Toast.makeText(applicationContext, "主线程", Toast.LENGTH_SHORT).show()
                        jsonObject = JSONObject(str)
                        val result = jsonObject!!.getBoolean("result")
                        if (result){
                            if (str!!.contains("road")){
                                val map = gson.fromJson<HttpRoadMapRsp>(str,HttpRoadMapRsp::class.java)
                                if (map.isResult){
                                    if (map.data != null){
                                        if (map.data.map_json.type.equals("road")){
                                            ExamPlatformData.getInstance().setNewRoadMapPath(Environment.getExternalStorageDirectory().absolutePath + "/"
                                                    + applicationContext.getPackageName() + "/roadmap.json")
                                            CThreadPoolExecutor.runInBackground(Runnable{
                                                str = gson.toJson(map.data.map_json)
                                                FileUtil.writeTxtFileToSD(applicationContext,"roadmap.json",str,"")
                                            })
                                        }
                                    }
                                }
                            }else{
                                val yard = gson.fromJson<HttpYardRsp>(str,HttpYardRsp::class.java)
                                if (yard.isResult){
                                    if (yard.data !=null){
                                        Log.i(TAG,"yard====")
                                        ExamPlatformData.getInstance().setNewMapPath(Environment.getExternalStorageDirectory().absolutePath + "/"
                                                + applicationContext.getPackageName() + "/yard.json")
                                        CThreadPoolExecutor.runInBackground(Runnable{
                                            str = gson.toJson(yard.data.map_json)
                                            FileUtil.writeTxtFileToSD(applicationContext,"yard.json",str,"")
                                        })
                                    }
                                }
                            }
                        }else{
                            Toast.makeText(applicationContext,jsonObject!!.getString("data"),Toast.LENGTH_SHORT).show()
                        }
                    }
                    override fun onFailure(call: Call<ResponseBody>, t: Throwable) {
@@ -84,21 +127,33 @@
                        try {
                            str = response.body()!!.string()
                            Log.i(TAG, "服务器返回的body=$str")
                            val car = gson.fromJson<HttpCarRespBean>(str,HttpCarRespBean::class.java)
                            if (car.isResult){
                                if (car.data !=null){
                                    str = gson.toJson(car.data.map_json)
                                    Log.i(TAG, "解析之后的车模型=$str")
                                    FileUtil.writeTxtFileToSD(applicationContext,"car.json",str,"")
                            jsonObject = JSONObject(str)
                            val result = jsonObject!!.getBoolean("result")
                            if (result){
                                val car = gson.fromJson<HttpCarRespBean>(str,HttpCarRespBean::class.java)
                                if (car.isResult){
                                    if (car.data !=null){
                                        ExamPlatformData.getInstance().carModelPath = Environment.getExternalStorageDirectory().absolutePath + "/" +
                                                applicationContext.getPackageName() + "/car.json"
                                        Log.i(TAG, "解析之后的车模型=$str")
                                        CThreadPoolExecutor.runInBackground(Runnable{
                                            str = gson.toJson(car.data.map_json)
                                            FileUtil.writeTxtFileToSD(applicationContext,"car.json",str,"")
                                        })
                                    }
                                }
                            }else{
                                Toast.makeText(applicationContext,jsonObject!!.getString("data"),Toast.LENGTH_SHORT).show()
                            }
                        } catch (e: IOException) {
                            e.printStackTrace()
                        }
                        if (Looper.myLooper() == Looper.getMainLooper()) {
                            Toast.makeText(applicationContext, "主线程", Toast.LENGTH_SHORT).show()
                        }
                    }
                    override fun onFailure(call: Call<ResponseBody>, t: Throwable) {
app/src/main/java/safeluck/drive/evaluation/MainActivity.java
@@ -300,7 +300,6 @@
            }
            Log.i(TAG, "onClick: msg len "+jkRegisterMessage.getMessageLen()+" "+       jkRegisterMessage.props.value);
            byte[] str = jkRegisterMessage.toBytes();
            MessageProcessor.getInstance().sendMessage(jkRegisterMessage);
            Log.i(TAG, "onClick: "+ BytesUtils.bytesToHexString(str)+" ============");
app/src/main/java/safeluck/drive/evaluation/fragment/RoadDriveMapFragmentaa.java
@@ -394,7 +394,6 @@
                    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
@@ -467,6 +466,7 @@
        }
//        canvas2.drawPath(path, paint);
        paint.setColor(Color.BLACK);
        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));
@@ -600,7 +600,6 @@
        canvas3.drawCircle((float) (base_x + (car[tire.get(1)][0]) * scale_x), (float) (base_y + (car[tire.get(1)][1]) * scale_y), 2.5f, paint);
        canvas3.drawCircle((float) (base_x + (car[tire.get(2)][0]) * scale_x), (float) (base_y + (car[tire.get(2)][1]) * scale_y), 2.5f, paint);
        canvas3.drawCircle((float) (base_x + (car[tire.get(3)][0]) * scale_x), (float) (base_y + (car[tire.get(3)][1]) * scale_y), 2.5f, paint);
        Path pathCanvs3 = new Path();
app/src/main/java/safeluck/drive/evaluation/httpmodule/HttpCarRespBean.java
@@ -3,6 +3,7 @@
import java.util.List;
public class HttpCarRespBean {
    /**
     * result : true
     * data : {"server":"gps.safeluck.com","port":"3301","map_json":{"axial":[0,12],"left_front_tire":[8,9],"main_ant":[-9151.5063,13030.5118],"right_front_tire":[20,21],"right_rear_tire":[22,23],"name":"科二场考车模型","left_rear_tire":[10,11],"type":"car","body":[0,1,2,3,4,5,6,7,12,13,14,15,16,17,18,19],"point":[-9149.6063,13033.0768,-9149.9978,13033.3124,-9150.3258,13033.3485,-9150.8341,13032.8985,-9151.7318,13031.6639,-9152.3573,13030.83,-9152.5214,13030.5639,-9152.602,13030.3105,-9150.8053,13032.8843,-9150.6537,13032.7602,-9152.3352,13030.8124,-9152.221,13030.7008,-9152.092,13029.7892,-9151.4638,13029.4333,-9151.2111,13029.568,-9150.9808,13029.8341,-9150.3546,13030.6796,-9149.458,13031.8642,-9149.1611,13032.4276,-9149.2827,13032.7653,-9149.4842,13031.8708,-9149.6176,13031.9937,-9151.0011,13029.8717,-9151.1367,13029.9878]},"pzh":"豫E8000测"}
@@ -88,13 +89,13 @@
            private String name;
            private String type;
            private List<Double> axial;
            private List<Double> left_front_tire;
            private List<Integer> axial;
            private List<Integer> left_front_tire;
            private List<Double> main_ant;
            private List<Double> right_front_tire;
            private List<Double> right_rear_tire;
            private List<Double> left_rear_tire;
            private List<Double> body;
            private List<Integer> right_front_tire;
            private List<Integer> right_rear_tire;
            private List<Integer> left_rear_tire;
            private List<Integer> body;
            private List<Double> point;
            public String getName() {
@@ -113,19 +114,19 @@
                this.type = type;
            }
            public List<Double> getAxial() {
            public List<Integer> getAxial() {
                return axial;
            }
            public void setAxial(List<Double> axial) {
            public void setAxial(List<Integer> axial) {
                this.axial = axial;
            }
            public List<Double> getLeft_front_tire() {
            public List<Integer> getLeft_front_tire() {
                return left_front_tire;
            }
            public void setLeft_front_tire(List<Double> left_front_tire) {
            public void setLeft_front_tire(List<Integer> left_front_tire) {
                this.left_front_tire = left_front_tire;
            }
@@ -137,35 +138,35 @@
                this.main_ant = main_ant;
            }
            public List<Double> getRight_front_tire() {
            public List<Integer> getRight_front_tire() {
                return right_front_tire;
            }
            public void setRight_front_tire(List<Double> right_front_tire) {
            public void setRight_front_tire(List<Integer> right_front_tire) {
                this.right_front_tire = right_front_tire;
            }
            public List<Double> getRight_rear_tire() {
            public List<Integer> getRight_rear_tire() {
                return right_rear_tire;
            }
            public void setRight_rear_tire(List<Double> right_rear_tire) {
            public void setRight_rear_tire(List<Integer> right_rear_tire) {
                this.right_rear_tire = right_rear_tire;
            }
            public List<Double> getLeft_rear_tire() {
            public List<Integer> getLeft_rear_tire() {
                return left_rear_tire;
            }
            public void setLeft_rear_tire(List<Double> left_rear_tire) {
            public void setLeft_rear_tire(List<Integer> left_rear_tire) {
                this.left_rear_tire = left_rear_tire;
            }
            public List<Double> getBody() {
            public List<Integer> getBody() {
                return body;
            }
            public void setBody(List<Double> body) {
            public void setBody(List<Integer> body) {
                this.body = body;
            }
app/src/main/java/safeluck/drive/evaluation/httpmodule/HttpRoadMapRsp.java
New file
@@ -0,0 +1,241 @@
package safeluck.drive.evaluation.httpmodule;
import java.util.List;
public class HttpRoadMapRsp {
    /**
     * result : true
     * data : {"server":"gps.safeluck.com","port":"3301","map_json":{"maps":[{"area":[45,38,39,46],"id":8890,"item":106,"stop_flag":0,"stop_line":[41,42],"red_line":[[43,44]],"tts":"路口右转弯"},{"area":[53,48,49,54],"id":8891,"item":107,"stop_flag":0,"stop_line":[51,52],"tts":"通过人行横道"},{"area":[],"id":8892,"item":102,"stop_flag":0,"stop_line":[],"tts":"加减档"},{"area":[63,58,59,64],"id":8893,"item":110,"stop_flag":0,"stop_line":[61,62],"tts":"前方掉头"},{"area":[71,66,67,72],"id":8894,"item":101,"road_edge_line":[[73,74]],"stop_flag":0,"stop_line":[69,70],"tts":"直线行驶"},{"area":[],"id":8895,"item":103,"road_edge_line":[[77,78]],"stop_flag":0,"stop_line":[],"tts":"靠边停车"},{"area":[87,80,81,88],"id":8896,"item":105,"stop_flag":0,"stop_line":[83,84],"red_line":[[85,86]],"tts":"路口左转弯"},{"area":[95,90,91,96],"id":8897,"item":108,"stop_flag":0,"stop_line":[93,94],"tts":"通过学校区域"},{"area":[103,98,99,104],"id":8898,"item":109,"stop_flag":0,"stop_line":[101,102],"tts":"通过公共汽车站"},{"area":[111,106,107,112],"id":8900,"item":104,"stop_flag":0,"stop_line":[109,110],"tts":"通过路口"},{"all_trigger_line":[[8890,45,46],[8891,53,54],[8892,55,56],[8893,63,64],[8894,71,72],[8895,75,76],[8896,87,88],[8897,95,96],[8898,103,104],[8900,111,112]],"green_line":[[27,28],[33,34]],"id":8899,"item":100,"red_area":[[47,48,49,50]],"red_line":[[0,1,2,3,4,5,6,7,8,9,10,11,12,13],[14,15],[16,17,18,19,20,21,22,23,24,25,26],[29,30],[31,32],[35,36]],"stop_flag":0}],"name":"科三路考新地图","type":"road","points":[-8647.003,14590.7213,-8643.5524,14578.1376,-8643.4688,14577.3293,-8643.4743,14576.6703,-8643.6189,14575.6231,-8643.8986,14574.7303,-8644.429,14573.7859,-8645.0267,14573.0804,-8645.7975,14572.5144,-8646.6964,14572.0564,-8647.9003,14571.5898,-8649.254,14571.2718,-8651.2344,14570.9548,-8676.9505,14567.7086,-8677.008,14564.2895,-8647.9699,14568.5768,-8677.1016,14560.8499,-8648.6754,14565.6031,-8647.0386,14565.793,-8645.5361,14565.9325,-8643.9894,14565.9878,-8642.4894,14565.828,-8641.1371,14565.3513,-8640.1083,14564.4899,-8639.3371,14563.1737,-8638.7768,14561.5024,-8615.0639,14476.9774,-8611.3183,14477.2584,-8643.7051,14592.6597,-8640.3308,14593.415,-8608.1896,14478.7504,-8607.5516,14478.8765,-8639.2427,14591.991,-8636.3273,14594.4586,-8603.9223,14479.1086,-8600.1545,14479.3763,-8632.4911,14594.4536,-8643.6786,14578.4015,-8641.0622,14569.2537,-8634.1519,14571.662,-8636.5751,14580.2974,-8643.6786,14578.4015,-8636.5751,14580.2974,-8641.0622,14569.2537,-8634.1519,14571.662,-8646.4285,14588.016,-8639.2769,14589.9255,-8634.4653,14545.6261,-8632.5501,14538.899,-8625.5379,14540.9341,-8627.4065,14547.6014,-8634.4653,14545.6261,-8627.4065,14547.6014,-8637.2035,14555.2439,-8630.1052,14557.2304,-8626.3309,14516.8481,-8618.8811,14518.887,-8615.147,14476.9265,-8612.3882,14467.0731,-8597.9713,14471.9742,-8600.4647,14480.9003,-8615.147,14476.9265,-8600.4647,14480.9003,-8617.8432,14486.5562,-8603.1551,14490.5316,-8607.0038,14504.1069,-8616.1047,14536.1608,-8623.4875,14535.0492,-8614.6801,14502.1867,-8607.0038,14504.1069,-8614.6801,14502.1867,-8604.2725,14494.4871,-8612.0914,14492.5276,-8607.3643,14503.5206,-8616.3071,14536.8527,-8620.0983,14550.3554,-8627.0878,14547.8972,-8619.878,14549.5298,-8626.2008,14572.0174,-8630.8126,14588.3057,-8634.1112,14600.1533,-8640.9894,14596.3771,-8635.6092,14577.056,-8630.8126,14588.3057,-8635.6092,14577.056,-8634.1112,14600.1533,-8640.9894,14596.3771,-8628.1304,14578.6721,-8632.9266,14567.4225,-8667.0986,14568.9677,-8676.8874,14567.7089,-8676.2956,14564.3175,-8666.6833,14565.7012,-8667.0986,14568.9677,-8666.6833,14565.7012,-8657.1803,14570.2432,-8656.7853,14567.126]},"pzh":"e8000ce"}
     */
    private boolean result;
    private DataBean data;
    public boolean isResult() {
        return result;
    }
    public void setResult(boolean result) {
        this.result = result;
    }
    public DataBean getData() {
        return data;
    }
    public void setData(DataBean data) {
        this.data = data;
    }
    public static class DataBean {
        /**
         * server : gps.safeluck.com
         * port : 3301
         * map_json : {"maps":[{"area":[45,38,39,46],"id":8890,"item":106,"stop_flag":0,"stop_line":[41,42],"red_line":[[43,44]],"tts":"路口右转弯"},{"area":[53,48,49,54],"id":8891,"item":107,"stop_flag":0,"stop_line":[51,52],"tts":"通过人行横道"},{"area":[],"id":8892,"item":102,"stop_flag":0,"stop_line":[],"tts":"加减档"},{"area":[63,58,59,64],"id":8893,"item":110,"stop_flag":0,"stop_line":[61,62],"tts":"前方掉头"},{"area":[71,66,67,72],"id":8894,"item":101,"road_edge_line":[[73,74]],"stop_flag":0,"stop_line":[69,70],"tts":"直线行驶"},{"area":[],"id":8895,"item":103,"road_edge_line":[[77,78]],"stop_flag":0,"stop_line":[],"tts":"靠边停车"},{"area":[87,80,81,88],"id":8896,"item":105,"stop_flag":0,"stop_line":[83,84],"red_line":[[85,86]],"tts":"路口左转弯"},{"area":[95,90,91,96],"id":8897,"item":108,"stop_flag":0,"stop_line":[93,94],"tts":"通过学校区域"},{"area":[103,98,99,104],"id":8898,"item":109,"stop_flag":0,"stop_line":[101,102],"tts":"通过公共汽车站"},{"area":[111,106,107,112],"id":8900,"item":104,"stop_flag":0,"stop_line":[109,110],"tts":"通过路口"},{"all_trigger_line":[[8890,45,46],[8891,53,54],[8892,55,56],[8893,63,64],[8894,71,72],[8895,75,76],[8896,87,88],[8897,95,96],[8898,103,104],[8900,111,112]],"green_line":[[27,28],[33,34]],"id":8899,"item":100,"red_area":[[47,48,49,50]],"red_line":[[0,1,2,3,4,5,6,7,8,9,10,11,12,13],[14,15],[16,17,18,19,20,21,22,23,24,25,26],[29,30],[31,32],[35,36]],"stop_flag":0}],"name":"科三路考新地图","type":"road","points":[-8647.003,14590.7213,-8643.5524,14578.1376,-8643.4688,14577.3293,-8643.4743,14576.6703,-8643.6189,14575.6231,-8643.8986,14574.7303,-8644.429,14573.7859,-8645.0267,14573.0804,-8645.7975,14572.5144,-8646.6964,14572.0564,-8647.9003,14571.5898,-8649.254,14571.2718,-8651.2344,14570.9548,-8676.9505,14567.7086,-8677.008,14564.2895,-8647.9699,14568.5768,-8677.1016,14560.8499,-8648.6754,14565.6031,-8647.0386,14565.793,-8645.5361,14565.9325,-8643.9894,14565.9878,-8642.4894,14565.828,-8641.1371,14565.3513,-8640.1083,14564.4899,-8639.3371,14563.1737,-8638.7768,14561.5024,-8615.0639,14476.9774,-8611.3183,14477.2584,-8643.7051,14592.6597,-8640.3308,14593.415,-8608.1896,14478.7504,-8607.5516,14478.8765,-8639.2427,14591.991,-8636.3273,14594.4586,-8603.9223,14479.1086,-8600.1545,14479.3763,-8632.4911,14594.4536,-8643.6786,14578.4015,-8641.0622,14569.2537,-8634.1519,14571.662,-8636.5751,14580.2974,-8643.6786,14578.4015,-8636.5751,14580.2974,-8641.0622,14569.2537,-8634.1519,14571.662,-8646.4285,14588.016,-8639.2769,14589.9255,-8634.4653,14545.6261,-8632.5501,14538.899,-8625.5379,14540.9341,-8627.4065,14547.6014,-8634.4653,14545.6261,-8627.4065,14547.6014,-8637.2035,14555.2439,-8630.1052,14557.2304,-8626.3309,14516.8481,-8618.8811,14518.887,-8615.147,14476.9265,-8612.3882,14467.0731,-8597.9713,14471.9742,-8600.4647,14480.9003,-8615.147,14476.9265,-8600.4647,14480.9003,-8617.8432,14486.5562,-8603.1551,14490.5316,-8607.0038,14504.1069,-8616.1047,14536.1608,-8623.4875,14535.0492,-8614.6801,14502.1867,-8607.0038,14504.1069,-8614.6801,14502.1867,-8604.2725,14494.4871,-8612.0914,14492.5276,-8607.3643,14503.5206,-8616.3071,14536.8527,-8620.0983,14550.3554,-8627.0878,14547.8972,-8619.878,14549.5298,-8626.2008,14572.0174,-8630.8126,14588.3057,-8634.1112,14600.1533,-8640.9894,14596.3771,-8635.6092,14577.056,-8630.8126,14588.3057,-8635.6092,14577.056,-8634.1112,14600.1533,-8640.9894,14596.3771,-8628.1304,14578.6721,-8632.9266,14567.4225,-8667.0986,14568.9677,-8676.8874,14567.7089,-8676.2956,14564.3175,-8666.6833,14565.7012,-8667.0986,14568.9677,-8666.6833,14565.7012,-8657.1803,14570.2432,-8656.7853,14567.126]}
         * pzh : e8000ce
         */
        private String server;
        private String port;
        private MapJsonBean map_json;
        private String pzh;
        public String getServer() {
            return server;
        }
        public void setServer(String server) {
            this.server = server;
        }
        public String getPort() {
            return port;
        }
        public void setPort(String port) {
            this.port = port;
        }
        public MapJsonBean getMap_json() {
            return map_json;
        }
        public void setMap_json(MapJsonBean map_json) {
            this.map_json = map_json;
        }
        public String getPzh() {
            return pzh;
        }
        public void setPzh(String pzh) {
            this.pzh = pzh;
        }
        public static class MapJsonBean {
            /**
             * maps : [{"area":[45,38,39,46],"id":8890,"item":106,"stop_flag":0,"stop_line":[41,42],"red_line":[[43,44]],"tts":"路口右转弯"},{"area":[53,48,49,54],"id":8891,"item":107,"stop_flag":0,"stop_line":[51,52],"tts":"通过人行横道"},{"area":[],"id":8892,"item":102,"stop_flag":0,"stop_line":[],"tts":"加减档"},{"area":[63,58,59,64],"id":8893,"item":110,"stop_flag":0,"stop_line":[61,62],"tts":"前方掉头"},{"area":[71,66,67,72],"id":8894,"item":101,"road_edge_line":[[73,74]],"stop_flag":0,"stop_line":[69,70],"tts":"直线行驶"},{"area":[],"id":8895,"item":103,"road_edge_line":[[77,78]],"stop_flag":0,"stop_line":[],"tts":"靠边停车"},{"area":[87,80,81,88],"id":8896,"item":105,"stop_flag":0,"stop_line":[83,84],"red_line":[[85,86]],"tts":"路口左转弯"},{"area":[95,90,91,96],"id":8897,"item":108,"stop_flag":0,"stop_line":[93,94],"tts":"通过学校区域"},{"area":[103,98,99,104],"id":8898,"item":109,"stop_flag":0,"stop_line":[101,102],"tts":"通过公共汽车站"},{"area":[111,106,107,112],"id":8900,"item":104,"stop_flag":0,"stop_line":[109,110],"tts":"通过路口"},{"all_trigger_line":[[8890,45,46],[8891,53,54],[8892,55,56],[8893,63,64],[8894,71,72],[8895,75,76],[8896,87,88],[8897,95,96],[8898,103,104],[8900,111,112]],"green_line":[[27,28],[33,34]],"id":8899,"item":100,"red_area":[[47,48,49,50]],"red_line":[[0,1,2,3,4,5,6,7,8,9,10,11,12,13],[14,15],[16,17,18,19,20,21,22,23,24,25,26],[29,30],[31,32],[35,36]],"stop_flag":0}]
             * name : 科三路考新地图
             * type : road
             * points : [-8647.003,14590.7213,-8643.5524,14578.1376,-8643.4688,14577.3293,-8643.4743,14576.6703,-8643.6189,14575.6231,-8643.8986,14574.7303,-8644.429,14573.7859,-8645.0267,14573.0804,-8645.7975,14572.5144,-8646.6964,14572.0564,-8647.9003,14571.5898,-8649.254,14571.2718,-8651.2344,14570.9548,-8676.9505,14567.7086,-8677.008,14564.2895,-8647.9699,14568.5768,-8677.1016,14560.8499,-8648.6754,14565.6031,-8647.0386,14565.793,-8645.5361,14565.9325,-8643.9894,14565.9878,-8642.4894,14565.828,-8641.1371,14565.3513,-8640.1083,14564.4899,-8639.3371,14563.1737,-8638.7768,14561.5024,-8615.0639,14476.9774,-8611.3183,14477.2584,-8643.7051,14592.6597,-8640.3308,14593.415,-8608.1896,14478.7504,-8607.5516,14478.8765,-8639.2427,14591.991,-8636.3273,14594.4586,-8603.9223,14479.1086,-8600.1545,14479.3763,-8632.4911,14594.4536,-8643.6786,14578.4015,-8641.0622,14569.2537,-8634.1519,14571.662,-8636.5751,14580.2974,-8643.6786,14578.4015,-8636.5751,14580.2974,-8641.0622,14569.2537,-8634.1519,14571.662,-8646.4285,14588.016,-8639.2769,14589.9255,-8634.4653,14545.6261,-8632.5501,14538.899,-8625.5379,14540.9341,-8627.4065,14547.6014,-8634.4653,14545.6261,-8627.4065,14547.6014,-8637.2035,14555.2439,-8630.1052,14557.2304,-8626.3309,14516.8481,-8618.8811,14518.887,-8615.147,14476.9265,-8612.3882,14467.0731,-8597.9713,14471.9742,-8600.4647,14480.9003,-8615.147,14476.9265,-8600.4647,14480.9003,-8617.8432,14486.5562,-8603.1551,14490.5316,-8607.0038,14504.1069,-8616.1047,14536.1608,-8623.4875,14535.0492,-8614.6801,14502.1867,-8607.0038,14504.1069,-8614.6801,14502.1867,-8604.2725,14494.4871,-8612.0914,14492.5276,-8607.3643,14503.5206,-8616.3071,14536.8527,-8620.0983,14550.3554,-8627.0878,14547.8972,-8619.878,14549.5298,-8626.2008,14572.0174,-8630.8126,14588.3057,-8634.1112,14600.1533,-8640.9894,14596.3771,-8635.6092,14577.056,-8630.8126,14588.3057,-8635.6092,14577.056,-8634.1112,14600.1533,-8640.9894,14596.3771,-8628.1304,14578.6721,-8632.9266,14567.4225,-8667.0986,14568.9677,-8676.8874,14567.7089,-8676.2956,14564.3175,-8666.6833,14565.7012,-8667.0986,14568.9677,-8666.6833,14565.7012,-8657.1803,14570.2432,-8656.7853,14567.126]
             */
            private String name;
            private String type;
            private List<MapsBean> maps;
            private List<Double> points;
            public String getName() {
                return name;
            }
            public void setName(String name) {
                this.name = name;
            }
            public String getType() {
                return type;
            }
            public void setType(String type) {
                this.type = type;
            }
            public List<MapsBean> getMaps() {
                return maps;
            }
            public void setMaps(List<MapsBean> maps) {
                this.maps = maps;
            }
            public List<Double> getPoints() {
                return points;
            }
            public void setPoints(List<Double> points) {
                this.points = points;
            }
            public static class MapsBean {
                /**
                 * area : [45,38,39,46]
                 * id : 8890.0
                 * item : 106.0
                 * stop_flag : 0.0
                 * stop_line : [41,42]
                 * red_line : [[43,44]]
                 * tts : 路口右转弯
                 * road_edge_line : [[73,74]]
                 * all_trigger_line : [[8890,45,46],[8891,53,54],[8892,55,56],[8893,63,64],[8894,71,72],[8895,75,76],[8896,87,88],[8897,95,96],[8898,103,104],[8900,111,112]]
                 * green_line : [[27,28],[33,34]]
                 * red_area : [[47,48,49,50]]
                 */
                private int id;
                private int item;
                private String tts;
                private int stop_flag;
                private List<List<Integer>> red_line;
                private List<List<Integer>> green_line;
                private List<List<Integer>> all_trigger_line;
                private List<List<Integer>> red_area;
                private List<Integer> stop_line;
                private List<Integer> area;
                private List<List<Integer>> road_edge_line;
                public String getTts() {
                    return tts;
                }
                public void setTts(String tts) {
                    this.tts = tts;
                }
                public int getId() {
                    return id;
                }
                public void setId(int id) {
                    this.id = id;
                }
                public int getItem() {
                    return item;
                }
                public void setItem(int item) {
                    this.item = item;
                }
                public int getStop_flag() {
                    return stop_flag;
                }
                public void setStop_flag(int stop_flag) {
                    this.stop_flag = stop_flag;
                }
                public List<List<Integer>> getRed_line() {
                    return red_line;
                }
                public void setRed_line(List<List<Integer>> red_line) {
                    this.red_line = red_line;
                }
                public List<List<Integer>> getGreen_line() {
                    return green_line;
                }
                public void setGreen_line(List<List<Integer>> green_line) {
                    this.green_line = green_line;
                }
                public List<List<Integer>> getAll_trigger_line() {
                    return all_trigger_line;
                }
                public void setAll_trigger_line(List<List<Integer>> all_trigger_line) {
                    this.all_trigger_line = all_trigger_line;
                }
                public List<List<Integer>> getRed_area() {
                    return red_area;
                }
                public void setRed_area(List<List<Integer>> red_area) {
                    this.red_area = red_area;
                }
                public List<Integer> getStop_line() {
                    return stop_line;
                }
                public void setStop_line(List<Integer> stop_line) {
                    this.stop_line = stop_line;
                }
                public List<Integer> getArea() {
                    return area;
                }
                public void setArea(List<Integer> area) {
                    this.area = area;
                }
                public List<List<Integer>> getRoad_edge_line() {
                    return road_edge_line;
                }
                public void setRoad_edge_line(List<List<Integer>> road_edge_line) {
                    this.road_edge_line = road_edge_line;
                }
            }
        }
    }
}
app/src/main/java/safeluck/drive/evaluation/httpmodule/HttpYardRsp.java
New file
@@ -0,0 +1,163 @@
package safeluck.drive.evaluation.httpmodule;
import com.google.gson.annotations.SerializedName;
import java.util.List;
public class HttpYardRsp {
    /**
     * result : true
     * data : {"server":"gps.safeluck.com","port":"3301","map_json":{"name":"ø∆∂˛≥°øºµÿÕº","type":"yard","items":[{"id":876,"item":3,"point":[{"x-y":[16589.2108,-7592.2752,16587.738,-7588.9626,16581.1917,-7592.3313,16580.1238,-7590.1814,16573.4773,-7593.6051,16574.5939,-7595.7506,16568.6578,-7598.8277,16570.2548,-7602.0429]}]},{"id":879,"item":2,"point":[{"x-y":[16631.9724,-7572.0083,16640.7097,-7567.8933,16638.8423,-7563.8859,16639.3253,-7563.5842,16641.2092,-7567.6242,16641.4985,-7567.4958,16639.6009,-7563.438,16640.095,-7563.1417,16642.0225,-7567.2532]}]},{"id":877,"item":1,"point":[{"x-y":[16606.5718,-7592.7425,16609.7972,-7598.9155,16615.6195,-7595.8881,16617.9794,-7600.5532,16620.2055,-7599.3555,16617.8385,-7594.7065,16623.7326,-7591.5665,16620.5822,-7585.3858]}]},{"id":878,"item":5,"point":[{"x-y":[16601.7211,-7627.4499,16604.7674,-7625.387,16607.3525,-7630.2736,16611.6697,-7628.0306,16613.0442,-7631.3969,16605.8191,-7635.1681]}]},{"id":875,"item":4,"point":[{"x-y":[16582.5745,-7625.2715,16583.3317,-7626.2782,16584.3733,-7627.0041,16585.3725,-7627.3071,16586.6709,-7627.2873,16587.8216,-7626.8839,16588.8947,-7626.0781,16589.5949,-7624.9904,16590.0621,-7623.8121,16590.628,-7622.7458,16591.3904,-7621.7376,16592.2946,-7620.9083,16593.2589,-7620.2455,16594.1722,-7619.8063,16595.3586,-7619.4565,16596.6087,-7619.2749,16598.3161,-7619.4024,16599.5229,-7619.7126,16600.5292,-7620.151,16601.5604,-7620.8035,16602.481,-7621.6376,16603.0784,-7622.348,16603.3629,-7622.755]},{"x-y":[16579.3086,-7626.9764,16579.8354,-7627.7888,16580.3393,-7628.4316,16581.181,-7629.2701,16582.0667,-7629.9052,16583.1605,-7630.4413,16584.3072,-7630.818,16585.5416,-7630.993,16586.918,-7630.9599,16588.0948,-7630.7205,16589.1489,-7630.3119,16590.3826,-7629.6211,16591.2856,-7628.8977,16592.0383,-7628.0128,16592.8408,-7626.7007,16593.3354,-7625.4394,16593.886,-7624.4265,16594.9656,-7623.4808,16596.0498,-7623.0286,16597.3348,-7622.955,16598.4564,-7623.2286,16599.4254,-7623.7931,16600.1166,-7624.5026]}]}]},"pzh":"\u2018\u2022E9701≤\u201a"}
     */
    private boolean result;
    private DataBean data;
    public boolean isResult() {
        return result;
    }
    public void setResult(boolean result) {
        this.result = result;
    }
    public DataBean getData() {
        return data;
    }
    public void setData(DataBean data) {
        this.data = data;
    }
    public static class DataBean {
        /**
         * server : gps.safeluck.com
         * port : 3301
         * map_json : {"name":"ø∆∂˛≥°øºµÿÕº","type":"yard","items":[{"id":876,"item":3,"point":[{"x-y":[16589.2108,-7592.2752,16587.738,-7588.9626,16581.1917,-7592.3313,16580.1238,-7590.1814,16573.4773,-7593.6051,16574.5939,-7595.7506,16568.6578,-7598.8277,16570.2548,-7602.0429]}]},{"id":879,"item":2,"point":[{"x-y":[16631.9724,-7572.0083,16640.7097,-7567.8933,16638.8423,-7563.8859,16639.3253,-7563.5842,16641.2092,-7567.6242,16641.4985,-7567.4958,16639.6009,-7563.438,16640.095,-7563.1417,16642.0225,-7567.2532]}]},{"id":877,"item":1,"point":[{"x-y":[16606.5718,-7592.7425,16609.7972,-7598.9155,16615.6195,-7595.8881,16617.9794,-7600.5532,16620.2055,-7599.3555,16617.8385,-7594.7065,16623.7326,-7591.5665,16620.5822,-7585.3858]}]},{"id":878,"item":5,"point":[{"x-y":[16601.7211,-7627.4499,16604.7674,-7625.387,16607.3525,-7630.2736,16611.6697,-7628.0306,16613.0442,-7631.3969,16605.8191,-7635.1681]}]},{"id":875,"item":4,"point":[{"x-y":[16582.5745,-7625.2715,16583.3317,-7626.2782,16584.3733,-7627.0041,16585.3725,-7627.3071,16586.6709,-7627.2873,16587.8216,-7626.8839,16588.8947,-7626.0781,16589.5949,-7624.9904,16590.0621,-7623.8121,16590.628,-7622.7458,16591.3904,-7621.7376,16592.2946,-7620.9083,16593.2589,-7620.2455,16594.1722,-7619.8063,16595.3586,-7619.4565,16596.6087,-7619.2749,16598.3161,-7619.4024,16599.5229,-7619.7126,16600.5292,-7620.151,16601.5604,-7620.8035,16602.481,-7621.6376,16603.0784,-7622.348,16603.3629,-7622.755]},{"x-y":[16579.3086,-7626.9764,16579.8354,-7627.7888,16580.3393,-7628.4316,16581.181,-7629.2701,16582.0667,-7629.9052,16583.1605,-7630.4413,16584.3072,-7630.818,16585.5416,-7630.993,16586.918,-7630.9599,16588.0948,-7630.7205,16589.1489,-7630.3119,16590.3826,-7629.6211,16591.2856,-7628.8977,16592.0383,-7628.0128,16592.8408,-7626.7007,16593.3354,-7625.4394,16593.886,-7624.4265,16594.9656,-7623.4808,16596.0498,-7623.0286,16597.3348,-7622.955,16598.4564,-7623.2286,16599.4254,-7623.7931,16600.1166,-7624.5026]}]}]}
         * pzh : ‘•E9701≤‚
         */
        private String server;
        private String port;
        private MapJsonBean map_json;
        private String pzh;
        public String getServer() {
            return server;
        }
        public void setServer(String server) {
            this.server = server;
        }
        public String getPort() {
            return port;
        }
        public void setPort(String port) {
            this.port = port;
        }
        public MapJsonBean getMap_json() {
            return map_json;
        }
        public void setMap_json(MapJsonBean map_json) {
            this.map_json = map_json;
        }
        public String getPzh() {
            return pzh;
        }
        public void setPzh(String pzh) {
            this.pzh = pzh;
        }
        public static class MapJsonBean {
            /**
             * name : ø∆∂˛≥°øºµÿÕº
             * type : yard
             * items : [{"id":876,"item":3,"point":[{"x-y":[16589.2108,-7592.2752,16587.738,-7588.9626,16581.1917,-7592.3313,16580.1238,-7590.1814,16573.4773,-7593.6051,16574.5939,-7595.7506,16568.6578,-7598.8277,16570.2548,-7602.0429]}]},{"id":879,"item":2,"point":[{"x-y":[16631.9724,-7572.0083,16640.7097,-7567.8933,16638.8423,-7563.8859,16639.3253,-7563.5842,16641.2092,-7567.6242,16641.4985,-7567.4958,16639.6009,-7563.438,16640.095,-7563.1417,16642.0225,-7567.2532]}]},{"id":877,"item":1,"point":[{"x-y":[16606.5718,-7592.7425,16609.7972,-7598.9155,16615.6195,-7595.8881,16617.9794,-7600.5532,16620.2055,-7599.3555,16617.8385,-7594.7065,16623.7326,-7591.5665,16620.5822,-7585.3858]}]},{"id":878,"item":5,"point":[{"x-y":[16601.7211,-7627.4499,16604.7674,-7625.387,16607.3525,-7630.2736,16611.6697,-7628.0306,16613.0442,-7631.3969,16605.8191,-7635.1681]}]},{"id":875,"item":4,"point":[{"x-y":[16582.5745,-7625.2715,16583.3317,-7626.2782,16584.3733,-7627.0041,16585.3725,-7627.3071,16586.6709,-7627.2873,16587.8216,-7626.8839,16588.8947,-7626.0781,16589.5949,-7624.9904,16590.0621,-7623.8121,16590.628,-7622.7458,16591.3904,-7621.7376,16592.2946,-7620.9083,16593.2589,-7620.2455,16594.1722,-7619.8063,16595.3586,-7619.4565,16596.6087,-7619.2749,16598.3161,-7619.4024,16599.5229,-7619.7126,16600.5292,-7620.151,16601.5604,-7620.8035,16602.481,-7621.6376,16603.0784,-7622.348,16603.3629,-7622.755]},{"x-y":[16579.3086,-7626.9764,16579.8354,-7627.7888,16580.3393,-7628.4316,16581.181,-7629.2701,16582.0667,-7629.9052,16583.1605,-7630.4413,16584.3072,-7630.818,16585.5416,-7630.993,16586.918,-7630.9599,16588.0948,-7630.7205,16589.1489,-7630.3119,16590.3826,-7629.6211,16591.2856,-7628.8977,16592.0383,-7628.0128,16592.8408,-7626.7007,16593.3354,-7625.4394,16593.886,-7624.4265,16594.9656,-7623.4808,16596.0498,-7623.0286,16597.3348,-7622.955,16598.4564,-7623.2286,16599.4254,-7623.7931,16600.1166,-7624.5026]}]}]
             */
            private String name;
            private String type;
            private List<ItemsBean> items;
            public String getName() {
                return name;
            }
            public void setName(String name) {
                this.name = name;
            }
            public String getType() {
                return type;
            }
            public void setType(String type) {
                this.type = type;
            }
            public List<ItemsBean> getItems() {
                return items;
            }
            public void setItems(List<ItemsBean> items) {
                this.items = items;
            }
            public static class ItemsBean {
                /**
                 * id : 876
                 * item : 3
                 * point : [{"x-y":[16589.2108,-7592.2752,16587.738,-7588.9626,16581.1917,-7592.3313,16580.1238,-7590.1814,16573.4773,-7593.6051,16574.5939,-7595.7506,16568.6578,-7598.8277,16570.2548,-7602.0429]}]
                 */
                private int id;
                private int item;
                private List<PointBean> point;
                public int getId() {
                    return id;
                }
                public void setId(int id) {
                    this.id = id;
                }
                public double getItem() {
                    return item;
                }
                public void setItem(int item) {
                    this.item = item;
                }
                public List<PointBean> getPoint() {
                    return point;
                }
                public void setPoint(List<PointBean> point) {
                    this.point = point;
                }
                public static class PointBean {
                    @SerializedName("x-y")
                    private List<Double> xy;
                    public List<Double> getXy() {
                        return xy;
                    }
                    public void setXy(List<Double> xy) {
                        this.xy = xy;
                    }
                }
            }
        }
    }
}
app/src/main/java/safeluck/drive/evaluation/httpmodule/RetrofitCreator.kt
@@ -10,7 +10,7 @@
        private val REST_SERVICE = RETROFIT_CLIENT.create(AYApiService::class.java)
        public fun getRestService()=REST_SERVICE
        fun getRestService()=REST_SERVICE
    }
app/src/main/java/safeluck/drive/evaluation/util/Utils.java
@@ -361,19 +361,49 @@
        String str = "{\"result\":true,\"data\":{\"server\":\"gps.safeluck.com\",\"port\":\"3301\",\"map_json\":{\"axial\":[0.0,12.0],\"left_front_tire\":[8.0,9.0],\"main_ant\":[-9151.5063,13030.5118],\"right_front_tire\":[20.0,21.0],\"right_rear_tire\":[22.0,23.0],\"name\":\"科二场考车模型\",\"left_rear_tire\":[10.0,11.0],\"type\":\"car\",\"body\":[0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0],\"point\":[-9149.6063,13033.0768,-9149.9978,13033.3124,-9150.3258,13033.3485,-9150.8341,13032.8985,-9151.7318,13031.6639,-9152.3573,13030.83,-9152.5214,13030.5639,-9152.602,13030.3105,-9150.8053,13032.8843,-9150.6537,13032.7602,-9152.3352,13030.8124,-9152.221,13030.7008,-9152.092,13029.7892,-9151.4638,13029.4333,-9151.2111,13029.568,-9150.9808,13029.8341,-9150.3546,13030.6796,-9149.458,13031.8642,-9149.1611,13032.4276,-9149.2827,13032.7653,-9149.4842,13031.8708,-9149.6176,13031.9937,-9151.0011,13029.8717,-9151.1367,13029.9878]},\"pzh\":\"豫E8000测\"}}";
        String pattern = "(\\d{1,2}\\.[0]{1})";
        Pattern r = Pattern.compile(pattern);
        Matcher m = r.matcher(str);
        int i= 0;
       System.out.println("http="+parseHttpRsp(str));
        while (m.find()){
            i++;
            str = m.group();
            System.out.println(m.matches()+" str="+str);
    }
    public static String parseHttpRsp(String str){
        StringBuilder stringBuilder = new StringBuilder();
        int begin =0;
        String patternAll = "\\d+\\.[0-9]{1,4}";
        Pattern all = Pattern.compile(patternAll);
        Matcher mall = all.matcher(str);
        int k = 0;
        String pattern111 = "^\\d{1,2}\\.[0]{1}$";
        Pattern pattern1111= Pattern.compile(pattern111);
        while (mall.find()){
            String temp=mall.group();
            Matcher mmm = pattern1111.matcher(temp);
            int start =mall.start();
            int end= mall.end();
            if (mmm.matches()){
                String mmmStr = mmm.group();
                String intNumber = mmmStr.substring(0,mmmStr.indexOf("."));
                System.out.println("mmmStr="+mmmStr+" intNumber="+intNumber+" start="+start+"end="+end);
                String bbbb = str.substring(begin,start);
                stringBuilder.append(bbbb+intNumber);
                begin = 0;
                begin+=end;
                k++;
            }
        }
        System.out.println(m.matches()+" i="+i);
        stringBuilder.append(str.substring(begin));
        return stringBuilder.toString();
    }
    public static Point Calc3Point(Point p1,Point p2,double L ){