New file |
| | |
| | | package safeluck.drive.evaluation.bean; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MyApplication2 |
| | | * Created by lzw on 2020/1/14. 18:20:54 |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class ExamMap { |
| | | |
| | | /** |
| | | * id : 863 |
| | | * item : 1 |
| | | * point : [{"x-y":[-11.9669,28.013,-11.5114,27.137,-10.8069,27.5039,-10.2969,26.4212,-9.2102,26.8894,-9.6513,28.0027,-8.9758,28.3797,-9.5057,29.3232]},{"x-y":[-11.9669,28.013,-11.5114,27.137,-10.8069,27.5039,-10.2969,26.4212,-9.2102,26.8894,-9.6513,28.0027,-8.9758,28.3797,-9.5057,29.3232]}] |
| | | */ |
| | | |
| | | private int id; |
| | | private int item; |
| | | private List<PointBean> point; |
| | | |
| | | 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 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; |
| | | } |
| | | } |
| | | } |
| | |
| | | private List<Integer> right_front_tire; |
| | | private List<Integer> left_rear_tire; |
| | | private List<Integer> right_rear_tire; |
| | | private List<Integer> body; |
| | | private List<Double> point; |
| | | |
| | | public String getUtc() { |
| | |
| | | this.right_rear_tire = right_rear_tire; |
| | | } |
| | | |
| | | public List<Integer> getBody() { |
| | | return body; |
| | | } |
| | | |
| | | public void setBody(List<Integer> body) { |
| | | this.body = body; |
| | | } |
| | | |
| | | public List<Double> getPoint() { |
| | | return point; |
| | | } |
| | |
| | | |
| | | import com.anyun.exam.lib.MyLog; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.util.List; |
| | | |
| | | import me.yokeyword.fragmentation.SupportFragment; |
| | | import safeluck.drive.evaluation.Constant; |
| | | import safeluck.drive.evaluation.R; |
| | | import safeluck.drive.evaluation.bean.ExamMap; |
| | | import safeluck.drive.evaluation.bean.RealTimeCarPos; |
| | | import safeluck.drive.evaluation.cEventCenter.CEventCenter; |
| | | import safeluck.drive.evaluation.cEventCenter.ICEventListener; |
| | | import safeluck.drive.evaluation.util.CThreadPoolExecutor; |
| | | import safeluck.drive.evaluation.util.FileUtil; |
| | | |
| | | |
| | | /** |
| | |
| | | private String osd = null; |
| | | private String osd2 = null; |
| | | private String osd3 = null; |
| | | private int map_id; |
| | | double map[][] = {{1, 1}, {10, 1}, {10, 10}, {1, 10}}; |
| | | double car[][] = {{8.278, 1.467}, {7.2780000000000009, 1.467}, {7.2780000000000009, -1.533}, {8.278, -1.533} |
| | | , {9.278, -1.5330000000000004}, {9.277999999999999, 1.467000000000001}}; |
| | |
| | | } |
| | | |
| | | int line = 0; |
| | | int map_line = 0; |
| | | private ICEventListener icEventListener = new ICEventListener() { |
| | | @Override |
| | | public void onCEvent(String topic, int msgCode, int resultCode, Object obj) { |
| | |
| | | RealTimeCarPos timeCarPos = gson.fromJson((String) obj, RealTimeCarPos.class); |
| | | List<Double> points = timeCarPos.getPoint(); |
| | | line = 0; |
| | | map_line = 0; |
| | | |
| | | for (int i = 0; i < points.size(); i++) { |
| | | if ((i % 2) == 0) { |
| | |
| | | } |
| | | |
| | | } |
| | | CThreadPoolExecutor.runInBackground(new NeedForSpeed(car,map)); |
| | | map_id = timeCarPos.getMap_id(); |
| | | // 1 - 倒库 |
| | | // 2 - 坡起 |
| | | // 3 - 侧方停车 |
| | | // 4 - 曲线行驶 |
| | | // 5 - 直角转弯 |
| | | |
| | | |
| | | StringBuffer buffer = FileUtil.readTxtFileFromSD(_mActivity,Constant.MAP); |
| | | Type type = new TypeToken<List<ExamMap>>(){}.getType(); |
| | | if (buffer != null){ |
| | | List<ExamMap> examMaps = gson.fromJson(buffer.toString().trim(), type); |
| | | for (int i = 0; i < examMaps.size(); i++) { |
| | | ExamMap examMap = examMaps.get(i); |
| | | if (map_id == examMap.getId()){ |
| | | List<ExamMap.PointBean> pointBeanList = examMap.getPoint(); |
| | | for(int j=0; j<pointBeanList.size();j++){ |
| | | if ((j % 2) == 0) { |
| | | map[map_line][0] = points.get(i); |
| | | } else { |
| | | double value = 0 - points.get(i); |
| | | Log.i(TAG, "onCEvent: map新值=" + value + " 位置:" + i); |
| | | map[map_line][1] = value; |
| | | map_line++; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | CThreadPoolExecutor.runInBackground(new NeedForSpeed(car, map)); |
| | | } |
| | | }; |
| | | |