From 399bf6ae73d636d56ecd590036964e52433b4743 Mon Sep 17 00:00:00 2001
From: endian11 <Dana_Lee1016@126.com>
Date: 星期四, 17 九月 2020 17:30:27 +0800
Subject: [PATCH] 设置一个ROUTE_MODE 为 采集模式, app HomeFragment增加这个模式的判断
---
app/src/main/java/safeluck/drive/evaluation/routecollect/impl/RouteModel.java | 50 +++++++++++++++++++++++++++++++++++++-------------
1 files changed, 37 insertions(+), 13 deletions(-)
diff --git a/app/src/main/java/safeluck/drive/evaluation/routecollect/impl/RouteModel.java b/app/src/main/java/safeluck/drive/evaluation/routecollect/impl/RouteModel.java
index fe352fa..399ca2b 100644
--- a/app/src/main/java/safeluck/drive/evaluation/routecollect/impl/RouteModel.java
+++ b/app/src/main/java/safeluck/drive/evaluation/routecollect/impl/RouteModel.java
@@ -1,11 +1,19 @@
package safeluck.drive.evaluation.routecollect.impl;
+import android.util.Log;
+
import com.anyun.exam.lib.IRemoteInterface;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import safeluck.drive.evaluation.Constant;
+import safeluck.drive.evaluation.cEventCenter.CEventCenter;
+import safeluck.drive.evaluation.cEventCenter.ICEventListener;
import safeluck.drive.evaluation.routecollect.CollectPointResult;
import safeluck.drive.evaluation.routecollect.ILoadListener;
import safeluck.drive.evaluation.routecollect.IRouteCollectInterface;
-import safeluck.drive.evaluation.routecollect.IRouteRemotePointCallback;
+import safeluck.drive.evaluation.util.Utils;
/**
* DriveJudge
@@ -13,10 +21,33 @@
* 閭锛�632393724@qq.com
* All Rights Saved! Chongqing AnYun Tech co. LTD
*/
-public class RouteModel implements IRouteCollectInterface,IRouteRemotePointCallback {
+public class RouteModel implements IRouteCollectInterface{
ILoadListener iLoadListener;
- private double sx=120.0,sy=10.03;
+ private static final String TAG = "RouteModel";
+ private ICEventListener icEventListener= new ICEventListener() {
+ @Override
+ public void onCEvent(String topic, int msgCode, int resultCode, Object obj) {
+ //,"coord_x":0.974,"coord_x_dir":"N","coord_y":-0.191,"c
+ if (iLoadListener != null){
+ CollectPointResult collectPointResult = new CollectPointResult();
+ try {
+ JSONObject jsonObject = new JSONObject((String)obj);
+ double x = jsonObject.getDouble("coord_x");
+ double y = jsonObject.getDouble("coord_y");
+
+ Log.i(TAG,String.format("閲囬泦鍒扮殑鐐广�恱=%f,y=%f]",x,y));
+ collectPointResult.setX(Utils.getdouble(x,4));
+ collectPointResult.setY(Utils.getdouble(y,4));
+ iLoadListener.finishCollectItem(collectPointResult);
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+ };
+
@Override
public void startCollect(ILoadListener listener) {
iLoadListener = listener;
@@ -24,6 +55,7 @@
//set IRouteRemotePointCallback
//濡傛灉閲囩敤application鐨刢allback 锛屽彲鑳介渶瑕佹敞鍐屼竴涓狢EventLisntener
+ CEventCenter.onBindEvent(true,icEventListener, Constant.BIND_RTK_INFO_MAP);
}
/**
@@ -32,17 +64,9 @@
@Override
public void endCollect() {
//濡傛灉閲囩敤application鐨刢allback 锛屽彲鑳介渶瑕佸弽娉ㄥ唽涓�涓狢EventLisntener 瑙g粦
+ CEventCenter.onBindEvent(false,icEventListener,Constant.BIND_RTK_INFO_MAP);
+ iLoadListener = null;
}
- @Override
- public void javaPoint(int qf, double x, double y, double z, double heading, double pitch, double roll) {
-
- if (iLoadListener != null){
- CollectPointResult collectPointResult = new CollectPointResult();
- collectPointResult.setX(sx);
- collectPointResult.setY(sy);
- iLoadListener.finishCollectItem(collectPointResult);
- }
- }
}
--
Gitblit v1.8.0