[Change]
迁移 IdentifyDataDrawer.java到MoGoEagleEye.core.function-impl.mogo-core-function-map。 地图相关的功能进行聚合,为后续融合做准备。如果需要对数据进行拦截处理,也在这里添加拦截器,不要直接修改IdentifyDataDrawer Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -9,16 +9,12 @@ import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.cloud.socket.entity.SocketDownDataHelper;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.function.api.map.IMogoMapFrameController;
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
@@ -38,8 +34,6 @@ import com.mogo.map.search.geo.MogoRegeocodeResult;
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.dialog.WMDialog;
|
||||
import com.mogo.module.common.drawer.IdentifyDataDrawer;
|
||||
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
|
||||
@@ -483,30 +477,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
mLocationMockHandler.sendEmptyMessageDelayed(100, 50L);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理路侧模拟数据意图
|
||||
*/
|
||||
private void handleRoadSideMockDataIntent() throws Exception {
|
||||
if (roadSizeBr == null) {
|
||||
roadSizeBr = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("roadSide.txt"))); //todo 需要重新模拟一个test数据
|
||||
}
|
||||
String carsLine = roadSizeBr.readLine();
|
||||
SocketDownData.LauncherSnapshotProto.Builder data = SocketDownData.LauncherSnapshotProto.newBuilder();
|
||||
List<SocketDownData.CloudRoadDataProto> allList = GsonUtil.arrayFromJson(carsLine, SocketDownData.CloudRoadDataProto.class);
|
||||
if (allList == null || allList.size() == 0) {
|
||||
return;
|
||||
}
|
||||
for (SocketDownData.CloudRoadDataProto cloudRoadData : allList) {
|
||||
cloudRoadData.toBuilder()
|
||||
.setWgslat(cloudRoadData.getLon())
|
||||
.setWgslon(cloudRoadData.getLon())
|
||||
.setFromType(SocketDownDataHelper.FROM_ROAD_UNIT);
|
||||
}
|
||||
data.addAllAllList(allList);
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(data.build());
|
||||
mLocationMockHandler.sendEmptyMessageDelayed(101, 100L);
|
||||
}
|
||||
|
||||
|
||||
public void onAdasCarDataCallback(AutopilotCarStateInfo stateInfo) {
|
||||
if (stateInfo != null && stateInfo.getValues() != null) {
|
||||
@@ -549,23 +519,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
br = null;
|
||||
}
|
||||
}
|
||||
// 模拟ADAS数据
|
||||
else if (msg.what == 3) {
|
||||
try {
|
||||
handleMockAdasIntent();
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
if (readers != null) {
|
||||
for (BufferedReader reader : readers) {
|
||||
if (reader != null) reader.close();
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
readers = null;
|
||||
}
|
||||
}
|
||||
// 模拟单个车数据
|
||||
else if (msg.what == 100) {
|
||||
try {
|
||||
@@ -574,38 +527,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
// 处理路侧模拟数据意图
|
||||
else if (msg.what == 101) {
|
||||
try {
|
||||
handleRoadSideMockDataIntent();
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
roadSizeBr.close();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
roadSizeBr = null;
|
||||
}
|
||||
}
|
||||
// 处理模拟Adas汽车意图
|
||||
else if (msg.what == 8) {
|
||||
try {
|
||||
handleMockAdasCarIntent();
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
if (readers2 != null) {
|
||||
for (BufferedReader reader : readers2) {
|
||||
if (reader != null) {
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
readers2 = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -685,76 +606,4 @@ public class MockIntentHandler implements IntentHandler {
|
||||
private BufferedReader[] readers = null;
|
||||
private BufferedReader[] readers2 = null;
|
||||
|
||||
/**
|
||||
* 处理模拟ADAS数据意图
|
||||
*/
|
||||
private boolean handleMockAdasIntent() throws Exception {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
if (readers == null) {
|
||||
readers = new BufferedReader[10];
|
||||
for (int i = 0; i < 10; i++) {
|
||||
readers[i] = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("adas" + i + ".txt")));
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<TrafficData> trafficData = new ArrayList<>();
|
||||
for (BufferedReader reader : readers) {
|
||||
String line = reader.readLine();
|
||||
TrafficData adasRecognizedResult = GsonUtil.objectFromJson(line, TrafficData.class);
|
||||
if (adasRecognizedResult != null) {
|
||||
trafficData.add(adasRecognizedResult);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (FunctionBuildConfig.isDrawIdentifyData) {
|
||||
// ThreadUtils.getSinglePool().execute(() ->
|
||||
// IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData)
|
||||
// );
|
||||
} else {
|
||||
IdentifyDataDrawer.getInstance().clearOldMarker();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理模拟Adas汽车意图
|
||||
*/
|
||||
private boolean handleMockAdasCarIntent() throws Exception {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
if (readers2 == null) {
|
||||
readers2 = new BufferedReader[3];
|
||||
for (int i = 0; i < 3; i++) {
|
||||
readers2[i] = new BufferedReader(new InputStreamReader(AbsMogoApplication.getApp().getAssets().open("adascar" + i + ".txt")));
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<TrafficData> trafficData = new ArrayList<>();
|
||||
for (BufferedReader reader : readers2) {
|
||||
String line = reader.readLine();
|
||||
TrafficData adasRecognizedResult = GsonUtil.objectFromJson(line, TrafficData.class);
|
||||
if (adasRecognizedResult != null) {
|
||||
trafficData.add(adasRecognizedResult);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (FunctionBuildConfig.isDrawIdentifyData) {
|
||||
// ThreadUtils.getSinglePool().execute(() ->
|
||||
// IdentifyDataDrawer.getInstance().renderAdasRecognizedResult(trafficData)
|
||||
// );
|
||||
} else {
|
||||
IdentifyDataDrawer.getInstance().clearOldMarker();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user