diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java index 2eb40ccf05..1c4f0fa6c5 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/marker/MapMarkerManager.java @@ -6,6 +6,7 @@ import android.text.TextUtils; import com.mogo.cloud.socket.entity.SocketDownData; import com.mogo.commons.AbsMogoApplication; +import com.mogo.commons.FunctionBuildConfig; import com.mogo.commons.debug.DebugConfig; import com.mogo.map.MogoLatLng; import com.mogo.map.marker.IMogoMarker; @@ -146,11 +147,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener, @Override public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) { DebugConfig.setStatus(DebugConfig.sDownloadSnapshot, true); -// SnapshotSetDataDrawer.getInstance().renderSnapshotData(mogoSnapshotSetData); -// Message msg = mSnapshotHandler.obtainMessage(); -// msg.obj = mogoSnapshotSetData; -// msg.what = MSG_SNAPSHOT; -// msg.sendToTarget(); + // SnapshotSetDataDrawer.getInstance().renderSnapshotData(mogoSnapshotSetData); + // Message msg = mSnapshotHandler.obtainMessage(); + // msg.obj = mogoSnapshotSetData; + // msg.what = MSG_SNAPSHOT; + // msg.sendToTarget(); } }); MogoApisHandler.getInstance() @@ -175,85 +176,88 @@ public class MapMarkerManager implements IMogoMarkerClickListener, // adas 每隔一定频率传递过来的数据 MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback(resultList -> { -// Message msg = mSnapshotHandler.obtainMessage(); -// msg.obj = resultList; -// msg.what = MSG_ADAS; -// msg.sendToTarget(); - AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(resultList); + // Message msg = mSnapshotHandler.obtainMessage(); + // msg.obj = resultList; + // msg.what = MSG_ADAS; + // msg.sendToTarget(); + // 使用与渠道配置一样的gps提供者提供的数据 + if (FunctionBuildConfig.gpsProvider != 2) { + AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(resultList); + } //添加自车的定位图标,碰撞只有一个预警,还需要和adas 联调, -// for ( ADASRecognizedResult result : resultList) { -// if (result.drawlevel == 3) { //找出可能碰撞的车 -// Logger.d("liyz", "result.drawlevel == 3 ------> "); -//// 绘制他车的线,从列表中查出可能碰撞的车的经纬度(没有或者只有一个),然后预设20米的长度 -//// 绘制碰撞的他车指引线,需要实时给数据更新 TODO -// drawLimberCollisionPolyline(result); -// //通过这个传值到 AMapViewWrapper,根据数据更新自车的模型数据 -// MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().setAdasRecognizedResult(result.drawlevel); -// } -// } + // for ( ADASRecognizedResult result : resultList) { + // if (result.drawlevel == 3) { //找出可能碰撞的车 + // Logger.d("liyz", "result.drawlevel == 3 ------> "); + //// 绘制他车的线,从列表中查出可能碰撞的车的经纬度(没有或者只有一个),然后预设20米的长度 + //// 绘制碰撞的他车指引线,需要实时给数据更新 TODO + // drawLimberCollisionPolyline(result); + // //通过这个传值到 AMapViewWrapper,根据数据更新自车的模型数据 + // MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().setAdasRecognizedResult(result.drawlevel); + // } + // } }); } -// /** -// * 实时绘制连线 -// * -// * @param result -// */ -// private void drawLimberCollisionPolyline(ADASRecognizedResult result) { -// if (result != null) { -// IMogoPolyline polyLine = LimberCollisionPolyline.getInstance().getPolyLine(); -// MogoLatLng startLatLng = new MogoLatLng(result.lat, result.lon); -// MogoLatLng endLatlng = Trigonometric.getNewLocation(startLatLng, 20, result.heading); -// Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat -// + "终点" + endLatlng.lon + "," + endLatlng.lat + "--heading =" + result.heading); -// if (polyLine != null) { -// Log.d(TAG, "drawStopLine polyLine != null"); -// polyLine.setPoints(Arrays.asList(startLatLng, endLatlng)); -// } else { -// List latLngs = new ArrayList<>(); -// latLngs.add(startLatLng); -// latLngs.add(endLatlng); -// LimberCollisionPolyline.getInstance().draw((float) result.roadWidth, latLngs); -// } -// } else { -// LimberCollisionPolyline.getInstance().clearLine(); -// } -// } + // /** + // * 实时绘制连线 + // * + // * @param result + // */ + // private void drawLimberCollisionPolyline(ADASRecognizedResult result) { + // if (result != null) { + // IMogoPolyline polyLine = LimberCollisionPolyline.getInstance().getPolyLine(); + // MogoLatLng startLatLng = new MogoLatLng(result.lat, result.lon); + // MogoLatLng endLatlng = Trigonometric.getNewLocation(startLatLng, 20, result.heading); + // Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat + // + "终点" + endLatlng.lon + "," + endLatlng.lat + "--heading =" + result.heading); + // if (polyLine != null) { + // Log.d(TAG, "drawStopLine polyLine != null"); + // polyLine.setPoints(Arrays.asList(startLatLng, endLatlng)); + // } else { + // List latLngs = new ArrayList<>(); + // latLngs.add(startLatLng); + // latLngs.add(endLatlng); + // LimberCollisionPolyline.getInstance().draw((float) result.roadWidth, latLngs); + // } + // } else { + // LimberCollisionPolyline.getInstance().clearLine(); + // } + // } -// private final static int MSG_SNAPSHOT = 1; -// private final static int MSG_ADAS = 2; -// -// /** -// * todo 后续从云端和adas侧拿到的数据 需求对数据流进行重新架构以扩展除添加marker外的其他预警类业务 -// * todo (应需要模块主动注册adas或云端数据回调,在具体模块内添加绘制需求,需要与地图侧确认是否支持并发) -// */ -// private final Handler mSnapshotHandler = new Handler(WorkThreadHandler.newInstance("snapshot-thread").getLooper()) { -// @Override -// public void handleMessage(Message msg) { -// super.handleMessage(msg); -// switch (msg.what) { -// case MSG_SNAPSHOT: -// if (msg.obj instanceof SocketDownData.LauncherSnapshotProto) { -// SnapshotSetDataDrawer.getInstance().renderSnapshotData(((SocketDownData.LauncherSnapshotProto) msg.obj)); -// } else { -// SnapshotSetDataDrawer.getInstance().renderSnapshotData(null); -// } -// break; -// case MSG_ADAS: -// // 绘制近景识别到的车辆 -// if (msg.obj instanceof List) { -// List recognizedResults = (List) msg.obj; -// AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(recognizedResults); -// } -// break; -// default: -// break; -// } -// } -// }; + // private final static int MSG_SNAPSHOT = 1; + // private final static int MSG_ADAS = 2; + // + // /** + // * todo 后续从云端和adas侧拿到的数据 需求对数据流进行重新架构以扩展除添加marker外的其他预警类业务 + // * todo (应需要模块主动注册adas或云端数据回调,在具体模块内添加绘制需求,需要与地图侧确认是否支持并发) + // */ + // private final Handler mSnapshotHandler = new Handler(WorkThreadHandler.newInstance("snapshot-thread").getLooper()) { + // @Override + // public void handleMessage(Message msg) { + // super.handleMessage(msg); + // switch (msg.what) { + // case MSG_SNAPSHOT: + // if (msg.obj instanceof SocketDownData.LauncherSnapshotProto) { + // SnapshotSetDataDrawer.getInstance().renderSnapshotData(((SocketDownData.LauncherSnapshotProto) msg.obj)); + // } else { + // SnapshotSetDataDrawer.getInstance().renderSnapshotData(null); + // } + // break; + // case MSG_ADAS: + // // 绘制近景识别到的车辆 + // if (msg.obj instanceof List) { + // List recognizedResults = (List) msg.obj; + // AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(recognizedResults); + // } + // break; + // default: + // break; + // } + // } + // }; /** * 地图上的Marker点击回调 @@ -657,9 +661,9 @@ public class MapMarkerManager implements IMogoMarkerClickListener, int radius, boolean fitBounds) { -// if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {//todo 实时在线车辆需要注释,否则在2D模式下不能展示 -// return; -// } + // if ( DebugConfig.isNeedUploadCoordinatesDurationInTime() ) {//todo 实时在线车辆需要注释,否则在2D模式下不能展示 + // return; + // } if (DebugConfig.isDebug()) { if (!DebugConfig.isRequestOnlineCarData()) {