app/src/main/java/safeluck/drive/evaluation/Constant.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/DB/exam_status/ExamStatusOutWorker.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/app.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/arcgis/MapSingleTapListener.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/bean/RTKInfoBean.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/fragment/JiaXiaoFragment.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
lib/src/main/java/com/anyun/exam/lib/IAYExamListener.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
lib/src/main/java/com/anyun/exam/lib/SvrManager.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
app/src/main/java/safeluck/drive/evaluation/Constant.java
@@ -91,6 +91,8 @@ public static final int SUBJECT_III = 3;//路考 public static final int LEFT_RIGHT_DISTANCE = 0x0020; public static final String NEED_MAPS_CAR = "need_maps_car"; //用于地图车辆移动 坐标 public static final String BIND_RTK_INFO_MAP = "bind_rtk_info_map"; public static String exam_enter_exitdata="exam_enter_exitdata"; public static int Chang_di = 2; public static int DaoLu_night = 3; app/src/main/java/safeluck/drive/evaluation/DB/exam_status/ExamStatusOutWorker.kt
@@ -39,7 +39,7 @@ private val tempQs: MutableList<QuestionBean> = java.util.ArrayList() override fun doWork(): Result { val examType =WorkRoomDataBase.getWorkRoomDataBase(applicationContext).examStatusDao.startExamInt; MyLog.i(TAG+"do work") simulateNightBean.setExam(0) val list = ExamPlatformData.getInstance().simulate_light_tips @@ -54,6 +54,7 @@ simulateNightBean.setQuestion(tempQs) if (inputData.getInt(safeluck.drive.evaluation.Constant.NEED_MAPS_CAR,0)==1){ MyLog.i("Constant.NEED_MAPS_CAR,") sendMapInfo() sendVehicleInfo() } app/src/main/java/safeluck/drive/evaluation/app.java
@@ -96,7 +96,7 @@ FileUtil.createdirs(getApplicationContext()); //考试状态 ,一些初始状态,app一些状态应该先初始化一下 initData(); } @@ -109,6 +109,8 @@ int type = WorkRoomDataBase.getWorkRoomDataBase(getApplicationContext()).getExamStatusDao().getStartExamInt(); ExamPlatformData.getInstance().setExamType(type); OneTimeWorkRequest examStatausOutWorker = OneTimeWorkRequest.from(ExamStatusOutWorker.class); sendMapInfo(); sendVechileInfo(); OneTimeWorkRequest mcuUpgradeWorker = OneTimeWorkRequest.from(MCUUpgradeWorker.class); WorkManager.getInstance(getApplicationContext()).beginWith(examStatausOutWorker).then(mcuUpgradeWorker).enqueue(); }); @@ -417,6 +419,8 @@ e.printStackTrace(); } CEventCenter.dispatchEvent(Constant.BIND_RTK_INFO_MAP,cmd,0,json); if (ExamPlatformData.getInstance().getExamplatformStatus()==ExamPlatformData.DEV_LOGIN){ try { @@ -492,7 +496,21 @@ } } private String last0206Str=""; @Override public void bindStatus(int code) { MyLog.i(String.format("bindStatus = %d",code)); if (code == 0){ ExamPlatformData.getInstance().getTTS().speak("服务绑定成功"); initData(); }else{ ExamPlatformData.getInstance().getTTS().speak("服务异常死亡"); } } private String last0206Str=""; private int lastSatNum= 0; private int lastQf = 0; @@ -553,7 +571,7 @@ byte[] fileContent = FileUtil.readFile(roadmapPath); if (fileContent != null){ String str = new String(fileContent); Log.i(TAG, "文件内容:"+str); MyLog.i("文件内容:"+str); AYSdk.getInstance().sendCmd(Constant.PUSH_ROAD_MAP_INFO,str); }else{ MyLog.i(String.format("文件:%s不存在",roadmapPath)); app/src/main/java/safeluck/drive/evaluation/arcgis/MapSingleTapListener.kt
New file @@ -0,0 +1,36 @@ package safeluck.drive.evaluation.arcgis import android.content.Context import android.graphics.Point import android.view.MotionEvent import android.widget.Toast import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener import com.esri.arcgisruntime.mapping.view.MapView /** * * @ProjectName: DriveJudge * @Package: safeluck.drive.evaluation.arcgis * @ClassName: MapSingleTapListener * @Description: java类作用描述 * @Author: 李占伟 * @CreateDate: 20/7/16 下午5:12 * @UpdateUser: 更新者 * @UpdateDate: 20/7/16 下午5:12 * @UpdateRemark: 更新说明 * @Version: 1.0 */ class MapSingleTapListener(context: Context, mapView: MapView) : DefaultMapViewOnTouchListener(context, mapView) { private var mContext: Context = context val TAG = MapSingleTapListener::class.java.canonicalName override fun onSingleTapConfirmed(e: MotionEvent?): Boolean { var mapPoint = mMapView.screenToLocation(e?.x?.toInt()?.let { Point(it, e.y.toInt()) }) showMessage(String.format("User tapped on the map at (%.3f,%.3f)", mapPoint.getX(), mapPoint.getY())) return true } private fun showMessage(message: String) { Toast.makeText(mContext,message,Toast.LENGTH_SHORT).show() } } app/src/main/java/safeluck/drive/evaluation/bean/RTKInfoBean.java
New file @@ -0,0 +1,171 @@ package safeluck.drive.evaluation.bean; /** * @ProjectName: DriveJudge * @Package: safeluck.drive.evaluation.bean * @ClassName: RTKInfoBean * @Description: java类作用描述 * @Author: 李占伟 * @CreateDate: 20/7/20 上午11:27 * @UpdateUser: 更新者 * @UpdateDate: 20/7/20 上午11:27 * @UpdateRemark: 更新说明 * @Version: 1.0 */ public class RTKInfoBean { /** * utc : 20200720032340.60 * qf : 3 * coord_x : -7600.317 * coord_x_dir : N * coord_y : 16574.11 * coord_y_dir : E * heading : 0.0 * pitch : 0.0 * roll : 0.0 * sat_num : 14 * latitude : 33.270174833333336 * longitude : 120.78765005 * altitude : 58.9666 * speed : 1.72591488 * track_ture : 0.0 */ private String utc; private int qf; private double coord_x; private String coord_x_dir; private double coord_y; private String coord_y_dir; private double heading; private double pitch; private double roll; private int sat_num; private double latitude; private double longitude; private double altitude; private double speed; private double track_ture; public String getUtc() { return utc; } public void setUtc(String utc) { this.utc = utc; } public int getQf() { return qf; } public void setQf(int qf) { this.qf = qf; } public double getCoord_x() { return coord_x; } public void setCoord_x(double coord_x) { this.coord_x = coord_x; } public String getCoord_x_dir() { return coord_x_dir; } public void setCoord_x_dir(String coord_x_dir) { this.coord_x_dir = coord_x_dir; } public double getCoord_y() { return coord_y; } public void setCoord_y(double coord_y) { this.coord_y = coord_y; } public String getCoord_y_dir() { return coord_y_dir; } public void setCoord_y_dir(String coord_y_dir) { this.coord_y_dir = coord_y_dir; } public double getHeading() { return heading; } public void setHeading(double heading) { this.heading = heading; } public double getPitch() { return pitch; } public void setPitch(double pitch) { this.pitch = pitch; } public double getRoll() { return roll; } public void setRoll(double roll) { this.roll = roll; } public int getSat_num() { return sat_num; } public void setSat_num(int sat_num) { this.sat_num = sat_num; } public double getLatitude() { return latitude; } public void setLatitude(double latitude) { this.latitude = latitude; } public double getLongitude() { return longitude; } public void setLongitude(double longitude) { this.longitude = longitude; } public double getAltitude() { return altitude; } public void setAltitude(double altitude) { this.altitude = altitude; } public double getSpeed() { return speed; } public void setSpeed(double speed) { this.speed = speed; } public double getTrack_ture() { return track_ture; } public void setTrack_ture(double track_ture) { this.track_ture = track_ture; } } app/src/main/java/safeluck/drive/evaluation/fragment/JiaXiaoFragment.java
@@ -1,21 +1,25 @@ package safeluck.drive.evaluation.fragment; import android.content.Context; import android.graphics.Color; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.esri.arcgisruntime.ArcGISRuntimeEnvironment; import com.esri.arcgisruntime.arcgisservices.ArcGISMapServiceInfo; import com.esri.arcgisruntime.concurrent.ListenableFuture; import com.esri.arcgisruntime.data.ServiceFeatureTable; import com.esri.arcgisruntime.geometry.Point; import com.esri.arcgisruntime.geometry.PointCollection; @@ -55,14 +59,23 @@ import java.util.Iterator; import java.util.List; import java.util.ListIterator; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import me.yokeyword.fragmentation.SupportFragment; import safeluck.drive.evaluation.Constant; import safeluck.drive.evaluation.R; import safeluck.drive.evaluation.app; import safeluck.drive.evaluation.arcgis.MapSingleTapListener; import safeluck.drive.evaluation.bean.ExamPlatformData; import safeluck.drive.evaluation.bean.GisCarModel; import safeluck.drive.evaluation.bean.RTKInfoBean; import safeluck.drive.evaluation.cEventCenter.CEventCenter; import safeluck.drive.evaluation.cEventCenter.ICEventListener; import safeluck.drive.evaluation.util.CThreadPoolExecutor; import safeluck.drive.evaluation.util.FileUtil; import safeluck.drive.evaluation.util.Utils; @@ -74,10 +87,37 @@ * All Rights Saved! Chongqing AnYun Tech co. LTD */ public class JiaXiaoFragment extends SupportFragment { private static final String TAG = JiaXiaoFragment.class.getSimpleName(); private Gson gson = new Gson(); private ICEventListener icEventListener = new ICEventListener() { @Override public void onCEvent(String topic, int msgCode, int resultCode, Object obj) { synchronized (JiaXiaoFragment.class){ String json = (String)obj; Log.i(TAG,String.format("当前线程号%d,json=%s",Thread.currentThread().getId(),json)); RTKInfoBean rtkInfoBean = gson.fromJson(json,RTKInfoBean.class); Log.i(TAG,String.format("CThreadPoolExecutor,当前线程号%d,Coord_x=%f,Coord_y=%f", Thread.currentThread().getId(),rtkInfoBean.getCoord_x(),rtkInfoBean .getCoord_y())); yaw = rtkInfoBean.getHeading(); startX = rtkInfoBean.getCoord_y(); startY = rtkInfoBean.getCoord_x(); addGraphicLayer(yaw,startX,startY); } } }; public static SupportFragment newInstance(){ return new JiaXiaoFragment(); } private static final String TAG = JiaXiaoFragment.class.getSimpleName(); private MapView mMapView ; private static final int MSG_CAR = 100; @@ -108,13 +148,14 @@ View view = inflater.inflate(R.layout.layout_arc_gis,container,false); mMapView = view.findViewById(R.id.mapView); Log.i(TAG,String.format("当前线程号%d,json=%s",Thread.currentThread().getId(),"onCreateView")); setupMap(); addTrailheadsLayer(); // addImageLayer(); addGraphicLayer(0,startX,startY); mHandler.sendEmptyMessageDelayed(MSG_CAR,1000); // mHandler.sendEmptyMessageDelayed(MSG_CAR,1000); // drawPolygon(); return view; } private SublayerList mSublayersList; @@ -130,9 +171,11 @@ } private void addTrailheadsLayer() { //一定不能少了最后的 / String url = "http://192.168.0.47:6080/arcgis/rest/services/%E5%9C%9F%E4%B8%BB%E8%80%83%E5%9C%BA/MapServer/"; // String url = "http://192.168.0.47:6080/arcgis/rest/services/test/MapServer/"; // String url = "http://192.168.0.47:6080/arcgis/rest/services/Testmap_3/MapServer/"; ArcGISMapImageLayer arcGISMapImageLayer = new ArcGISMapImageLayer(url); arcGISMapImageLayer.loadAsync(); arcGISMapImageLayer.addLoadStatusChangedListener(loadStatusChangedEvent -> { @@ -141,6 +184,7 @@ Log.i(TAG,"ServiceFeatureTables size = "+tables.size()); for (int i = tables.size()-1; i >= 0; i--) { // for (int i =0; i < tables.size(); i++) { ServiceFeatureTable serviceFeatureTable = new ServiceFeatureTable(url+String.valueOf(i)); FeatureLayer featureLayer = new FeatureLayer(serviceFeatureTable); @@ -150,8 +194,23 @@ } }); final ListenableFuture<Boolean> viewPointSetFuture = mMapView.setViewpointRotationAsync(90); viewPointSetFuture.addDoneListener(() -> { try{ boolean completed = viewPointSetFuture.get(); if (completed){ Log.i(TAG,"Rotation completed successfully"); } }catch (InterruptedException e){ Log.i(TAG,"Rotation Interrupted"); }catch (ExecutionException e){ } }); mMapView.setOnTouchListener(new MapSingleTapListener(getContext(),mMapView)); } @@ -161,13 +220,18 @@ SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.rgb(232,0,0), 0.5f); SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.argb(255,232,0,0), lineSymbol); PointCollection points = new PointCollection(SpatialReference.create(4544)); String carFilePath = ExamPlatformData.getInstance().getCarModelPath(); if (TextUtils.isEmpty(carFilePath)){ Toast.makeText(_mActivity, "车辆模型文件不存在", Toast.LENGTH_SHORT).show(); return; } CThreadPoolExecutor.runInBackground(new Runnable() { @Override public void run() { StringBuffer buffer= FileUtil.readAssetTxtFile(app.getAppContext(),"giscar.json"); Log.i(TAG,"giscar="+buffer.toString()); GisCarModel gisCarModel= new Gson().fromJson(buffer.toString(),GisCarModel.class); // List<safeluck.drive.evaluation.bean.Point> carNew=Utils.getCarPoint(0,45,new safeluck.drive.evaluation.bean.Point(-8633.77199999988,14471.793700000271)); byte[] fileContentBytes=FileUtil.readFile(carFilePath); String buffer= new String(fileContentBytes); // Log.i(TAG,"giscar="+buffer); GisCarModel gisCarModel= new Gson().fromJson(buffer,GisCarModel.class); List<safeluck.drive.evaluation.bean.Point> carNew=Utils.getCarPoint(0,yaw,new safeluck.drive.evaluation.bean.Point(x,y)); List<Integer> bodys =gisCarModel.getBody(); for (int i = 0; i <bodys.size(); i++) { @@ -189,6 +253,9 @@ drawPoint(new Point(x,y)); if (mMapView != null){ mMapView.setViewpointCenterAsync(new Point(x,y)); } } }); @@ -415,6 +482,13 @@ if (mMapView != null) { mMapView.dispose(); } CEventCenter.onBindEvent(false,icEventListener, Constant.BIND_RTK_INFO_MAP); super.onDetach(); } @Override public void onAttach(Context context) { super.onAttach(context); CEventCenter.onBindEvent(true,icEventListener,Constant.BIND_RTK_INFO_MAP); } } lib/src/main/java/com/anyun/exam/lib/IAYExamListener.java
@@ -10,4 +10,5 @@ */ public interface IAYExamListener { void callBackMsg(int code,String json); void bindStatus(int code);//0-绑定成功 -1 binderDied 1 } lib/src/main/java/com/anyun/exam/lib/SvrManager.java
@@ -28,6 +28,9 @@ private IAYExamListener mCallback; //远程服务接口 private IRemoteInterface remoteInterface; private int BIND_SUCC = 0; private int BIND_binderDied = -1; static SvrManager getInstance() { return ourInstance; } @@ -49,6 +52,9 @@ @Override public void binderDied() { MyLog.e(TAG,"IBinder.DeathRecipient binderDied"); if (mCallback != null){ mCallback.bindStatus(BIND_binderDied); } if (remoteInterface == null){ MyLog.e(TAG,"IBinder.DeathRecipient binderDied remoteInterface == null ,return"); return; @@ -98,6 +104,9 @@ //设置死亡代理 service.linkToDeath(mDeathRecipient,0); MyLog.i("绑定服务onServiceConnected"); if(mCallback!=null){ mCallback.bindStatus(BIND_SUCC); } remoteInterface.registListener(RemoteCallback); } catch (RemoteException e) { e.printStackTrace();