| | |
| | | import com.google.gson.reflect.TypeToken; |
| | | |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.util.List; |
| | | |
| | |
| | | pathText.lineTo(700, 30); |
| | | canvas2.drawTextOnPath(osd2, pathText, 0, 0, paint);//逆时针生成 |
| | | } |
| | | if (osd3 != null) { |
| | | Path pathText = new Path(); |
| | | pathText.moveTo(10, 240); |
| | | pathText.lineTo(700, 130); |
| | | canvas2.drawTextOnPath(osd2, pathText, 0, 0, paint);//逆时针生成 |
| | | } |
| | | |
| | | // 提交画布 |
| | | Canvas canvas = holder.lockCanvas(); |
| | |
| | | |
| | | int line = 0; |
| | | int map_line = 0; |
| | | private StringBuffer stringBuffer = new StringBuffer(); |
| | | private ICEventListener icEventListener = new ICEventListener() { |
| | | @Override |
| | | public void onCEvent(String topic, int msgCode, int resultCode, Object obj) { |
| | | |
| | | CThreadPoolExecutor.runInBackground(new CalRunnable((String)obj)); |
| | | CThreadPoolExecutor.runInBackground(new CalRunnable(msgCode,(String)obj)); |
| | | |
| | | } |
| | | }; |
| | | class CalRunnable implements Runnable{ |
| | | |
| | | private String json; |
| | | public CalRunnable(String obj) { |
| | | private int cmd; |
| | | public CalRunnable(int cmd,String obj) { |
| | | this.json = obj; |
| | | this.cmd = cmd; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | MyLog.i(TAG, json); |
| | | if (!(cmd == Constant.REAL_TIME_CAR_POS)){ |
| | | if (cmd == Constant.DEBUG_RTCM){ |
| | | stringBuffer.append("\tRTCM:"); |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(json); |
| | | int length = jsonObject.getInt("length"); |
| | | stringBuffer.append(length); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if (cmd == Constant.DEBUG_TXT){ |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(json); |
| | | String info = jsonObject.getString("info"); |
| | | stringBuffer.append("\tinfo:"); |
| | | stringBuffer.append(info); |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | osd3 = stringBuffer.toString(); |
| | | if (osd3!=null && osd3.contains("info:")&&osd3.contains("RTCM:")){ |
| | | |
| | | stringBuffer.delete(0,stringBuffer.length()); |
| | | } |
| | | RealTimeCarPos timeCarPos = gson.fromJson((String) json, RealTimeCarPos.class); |
| | | List<Double> points = timeCarPos.getPoint(); |
| | | switch (timeCarPos.getMove()){ |