| | |
| | | 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; |
| | |
| | | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | CThreadPoolExecutor.runInBackground(new NeedForSpeed(car, map)); |
| | | DrawMap(map,car); |
| | | } |
| | | }; |
| | | |
| | | } |
| | | @Override |
| | | public void onAttach(Context context) { |
| | | super.onAttach(context); |