lizhanwei
2020-01-15 03cd18e291173c329356108d5838114fee7b2022
app/src/main/java/safeluck/drive/evaluation/fragment/MapFragment.java
@@ -322,8 +322,22 @@
    private ICEventListener icEventListener = new ICEventListener() {
        @Override
        public void onCEvent(String topic, int msgCode, int resultCode, Object obj) {
            MyLog.i(TAG, (String) obj);
            RealTimeCarPos timeCarPos = gson.fromJson((String) obj, RealTimeCarPos.class);
            CThreadPoolExecutor.runInBackground(new CalRunnable((String)obj));
        }
    };
    class CalRunnable implements Runnable{
        private String json;
        public CalRunnable(String obj) {
           this.json = obj;
        }
        @Override
        public void run() {
            MyLog.i(TAG, json);
            RealTimeCarPos timeCarPos = gson.fromJson((String) json, RealTimeCarPos.class);
            List<Double> points = timeCarPos.getPoint();
            line = 0;
            map_line = 0;
@@ -362,7 +376,13 @@
                        for(int j=0; j<pointBeanList.size();j++){
                            List<Double> xys = pointBeanList.get(i).getXy();
                            map = new double[xys.size()][2];
                            if(j==0){
                                map = new double[xys.size()][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);
@@ -379,11 +399,9 @@
                    }
                }
            }
            CThreadPoolExecutor.runInBackground(new NeedForSpeed(car, map));
            DrawMap(map,car);
        }
    };
    }
    @Override
    public void onAttach(Context context) {
        super.onAttach(context);