| | |
| | | zhijiao type = 5*/ |
| | | |
| | | |
| | | private int map_item; |
| | | private int map_item;//type |
| | | |
| | | //0 退出(考试完毕) |
| | | //1 进入(正在进行考试) 2-待考 |
| | |
| | | import android.graphics.Paint; |
| | | import android.graphics.Path; |
| | | import android.os.Bundle; |
| | | import android.os.Handler; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | import android.view.LayoutInflater; |
| | |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | import java.util.concurrent.ScheduledExecutorService; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import safeluck.drive.evaluation.Constant; |
| | |
| | | private boolean isDrawing = false; |
| | | private int pixels = 80; |
| | | |
| | | private long count =0; |
| | | private long lastcount =0; |
| | | |
| | | private ICEventListener speedListener = new ICEventListener() { |
| | | @Override |
| | |
| | | } |
| | | if (msgCode == Constant.LEFT_RIGHT_DISTANCE){ |
| | | String str = (String)obj; |
| | | count++; |
| | | |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(str); |
| | |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | private ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); |
| | | |
| | | |
| | | public static SupportFragment newInstance() { |
| | | return new MapFragment(); |
| | |
| | | gson = new Gson(); |
| | | initView(view); |
| | | consumer.execute(new CalRunnable()); |
| | | scheduledExecutorService.scheduleAtFixedRate(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Log.i(TAG,"1s到"); |
| | | if (lastcount==count){ |
| | | Log.i(TAG,"已经没在发消息了"); |
| | | leftDistance = 0.0; |
| | | rightDistance = 0.0; |
| | | } |
| | | lastcount = count; |
| | | } |
| | | },1000,1000, TimeUnit.MILLISECONDS); |
| | | return view; |
| | | } |
| | | private int avaliableHeight,avalibleWidth; |
| | |
| | | Path pathText = new Path(); |
| | | pathText.moveTo(base_x-110, base_y-35); |
| | | pathText.lineTo(base_x-20, base_y-35); |
| | | canvas3.drawTextOnPath(String.valueOf(leftDistance), pathText, 0, 0, mPaint);//逆时针生成 |
| | | if (leftDistance == 0.0){ |
| | | |
| | | canvas3.drawTextOnPath("...", pathText, 0, 0, mPaint);//逆时针生成 |
| | | }else{ |
| | | |
| | | canvas3.drawTextOnPath(String.valueOf(leftDistance), pathText, 0, 0, mPaint);//逆时针生成 |
| | | } |
| | | } |
| | | if (osdMoveDirect != null) { |
| | | Path pathText = new Path(); |
| | | pathText.moveTo(base_x+30, base_y-35); |
| | | pathText.lineTo(base_x+110, base_y-35); |
| | | canvas3.drawTextOnPath(String.valueOf(rightDistance), pathText, 0, 0, mPaint);//逆时针生成 |
| | | if (rightDistance == 0.0){ |
| | | |
| | | canvas3.drawTextOnPath("...", pathText, 0, 0, mPaint);//逆时针生成 |
| | | }else{ |
| | | canvas3.drawTextOnPath(String.valueOf(rightDistance), pathText, 0, 0, mPaint);//逆时针生成 |
| | | } |
| | | |
| | | } |
| | | paint.setColor(Color.RED); |
| | | canvas3.drawLine(base_x-120,base_y-200,base_x-120,base_y+200,paint); |
| | |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | import java.util.concurrent.ScheduledExecutorService; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import safeluck.drive.evaluation.Constant; |
| | |
| | | private LinkedBlockingQueue queue = new LinkedBlockingQueue(100); |
| | | private ExecutorService producer = Executors.newSingleThreadExecutor(); |
| | | private ExecutorService consumer = Executors.newSingleThreadExecutor(); |
| | | |
| | | |
| | | private long count =0; |
| | | private long lastcount =0; |
| | | private ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); |
| | | @Nullable |
| | | @Override |
| | | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| | |
| | | gson = new Gson(); |
| | | initView(view); |
| | | consumer.execute(new CalRunnable()); |
| | | scheduledExecutorService.scheduleAtFixedRate(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | Log.i(TAG,"1s到"); |
| | | if (lastcount==count){ |
| | | Log.i(TAG,"已经没在发消息了"); |
| | | leftDistance = 0.0; |
| | | rightDistance = 0.0; |
| | | } |
| | | lastcount = count; |
| | | } |
| | | },1000,1000, TimeUnit.MILLISECONDS); |
| | | return view; |
| | | } |
| | | private int avaliableHeight,avalibleWidth; |
| | |
| | | Path pathText = new Path(); |
| | | pathText.moveTo(base_x-110, base_y-35); |
| | | pathText.lineTo(base_x-20, base_y-35); |
| | | canvas3.drawTextOnPath(String.valueOf(leftDistance), pathText, 0, 0, mPaint);//逆时针生成 |
| | | if (leftDistance == 0.0){ |
| | | |
| | | canvas3.drawTextOnPath("...", pathText, 0, 0, mPaint);//逆时针生成 |
| | | }else{ |
| | | |
| | | canvas3.drawTextOnPath(String.valueOf(leftDistance), pathText, 0, 0, mPaint);//逆时针生成 |
| | | } |
| | | } |
| | | if (osdMoveDirect != null) { |
| | | Path pathText = new Path(); |
| | | pathText.moveTo(base_x+30, base_y-35); |
| | | pathText.lineTo(base_x+110, base_y-35); |
| | | canvas3.drawTextOnPath(String.valueOf(rightDistance), pathText, 0, 0, mPaint);//逆时针生成 |
| | | if (rightDistance == 0.0){ |
| | | |
| | | canvas3.drawTextOnPath("...", pathText, 0, 0, mPaint);//逆时针生成 |
| | | }else{ |
| | | canvas3.drawTextOnPath(String.valueOf(rightDistance), pathText, 0, 0, mPaint);//逆时针生成 |
| | | } |
| | | } |
| | | paint.setColor(Color.RED); |
| | | canvas3.drawLine(base_x-120,base_y-200,base_x-120,base_y+200,paint); |
| | |
| | | Log.i(TAG, "ExamStatus onChanged: "); |
| | | if (examStatus!=null && examStatus.size()>0){ |
| | | showChangKaoOrLukao(examStatus.get(0).getStartExam()); |
| | | MyLog.i(TAG,"考试状态更新"); |
| | | MyLog.i(TAG,"考试状态更新"+examStatus.get(0).getStartExam()); |
| | | examStatusList.clear(); |
| | | examStatusList.addAll(examStatus); |
| | | mHandler.obtainMessage(ADD_DATA).sendToTarget(); |
| | |
| | | |
| | | |
| | | |
| | | ; |
| | | 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; |
| | | |
| | | while (m.find()){ |
| | | i++; |
| | | str = m.group(); |
| | | System.out.println(m.matches()+" str="+str); |
| | | } |
| | | System.out.println(m.matches()+" i="+i); |
| | | |
| | | |
| | | } |
| | | |
| | | public static Point Calc3Point(Point p1,Point p2,double L ){ |