From 390da88ced91755cc5cda243d74097a6c830ca0c Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Fri, 23 Apr 2021 18:43:32 +0800 Subject: [PATCH 1/4] fix conflict --- .../data/ADASRecognizedResultConvert.java | 107 ++++++++++++++++++ .../map/impl/amap/AMapNaviViewWrapper.java | 5 + .../mogo/map/impl/amap/AMapViewWrapper.java | 5 + .../amap/uicontroller/AMapUIController.java | 7 ++ .../mogo/map/impl/custom/AMapViewWrapper.java | 23 +++- .../custom/uicontroller/AMapUIController.java | 7 ++ .../uicontroller/IMogoMapUIController.java | 3 +- .../com/mogo/map/MogoMapUIController.java | 8 ++ .../common/drawer/V2XWarnDataDrawer.java | 1 - .../entity/ADASRecognizedResultConvert.java | 107 ++++++++++++++++++ .../service/intent/MockIntentHandler.java | 1 + .../service/marker/MapMarkerManager.java | 86 +++++++++++++- .../service/impl/adas/MogoADASController.java | 3 + 13 files changed, 356 insertions(+), 7 deletions(-) create mode 100644 foudations/mogo-commons/src/main/java/com/mogo/commons/data/ADASRecognizedResultConvert.java create mode 100644 modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/ADASRecognizedResultConvert.java diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/data/ADASRecognizedResultConvert.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/data/ADASRecognizedResultConvert.java new file mode 100644 index 0000000000..8f95af1893 --- /dev/null +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/data/ADASRecognizedResultConvert.java @@ -0,0 +1,107 @@ +package com.mogo.commons.data; + +/** + * @author lixiaopeng + * @description adas识别数据需要转换一下 + * @since 2021/4/23 + */ +public class ADASRecognizedResultConvert { + + /** + * 识别物体类型 + */ + public int type; + + /** + * 识别物体唯一标识 + */ + public String uuid; + + /** + * 红绿灯颜色 + */ + public String color; + + /** + * 车ID + */ + public String carId; + + /** + * 识别物体的纬度 + */ + public double lat; + + /** + * 识别物体的经度 + */ + public double lon; + + /** + * 车头朝向 + */ + public double heading; + + /** + * 系统时间 + */ + public long systemTime; + + /** + * 定位卫星时间 + */ + public long satelliteTime; + + /** + * 海拔 + */ + public double alt; + + /** + * 速度 + */ + public double speed; + + /** + * 莫顿码 + */ + public long mortonCode; + + /** + * 实际距离 + * 使用distanceX和distanceY计算 + */ + public double distance; + + /** + * 数据来源精度 + * 0:普通定位 + * 1:高精定位 + */ + public int dataAccuracy; + + /** + * 道路ID + */ + private String roadId; + + /** + * 车道ID-2D路段 + */ + private String laneId; + + /** + * 车道号:中心线编号为0,中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3 + */ + private int laneNum; + + /** + * 限速 + */ + private double rateLimiting; + + /** + * 车道宽度 + */ + private double roadWidth; +} diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java index 46a19654e9..52db642357 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java @@ -1037,4 +1037,9 @@ public class AMapNaviViewWrapper implements IMogoMapView, mMapView.getMap().moveCamera( CameraUpdateFactory.changeBearing( bearing ) ); } } + + @Override + public void setAdasRecognizedResult(String result) { + //liyz + } } diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java index 42d06f624f..c8092157b5 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java @@ -810,4 +810,9 @@ public class AMapViewWrapper implements IMogoMapView, mMapView.getMap().moveCamera( CameraUpdateFactory.changeBearing( bearing ) ); } } + + @Override + public void setAdasRecognizedResult(String result) { + //liyz + } } diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java index 5061ea4b39..a3736b90b5 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java @@ -299,6 +299,13 @@ public class AMapUIController implements IMogoMapUIController { } } + @Override + public void setAdasRecognizedResult(String result) { + if ( mClient != null ) { + mClient.setAdasRecognizedResult(result); + } + } + @Override public long getTileId(double lon, double lat) { return 0; diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index b3c6c20f0e..c24ffaf4bf 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -16,6 +16,8 @@ import android.view.ViewGroup; import android.view.animation.Interpolator; import android.widget.TextView; +import com.autonavi.nge.map.LonLat; +import com.mogo.commons.data.ADASRecognizedResultConvert; import com.mogo.commons.debug.DebugConfig; import com.mogo.map.IMogoMap; import com.mogo.map.IMogoMapView; @@ -35,6 +37,7 @@ import com.mogo.map.uicontroller.MapCameraPosition; import com.mogo.map.uicontroller.MapControlResult; import com.mogo.utils.TipToast; import com.mogo.utils.UiThreadHandler; +import com.mogo.utils.WorkThreadHandler; import com.mogo.utils.logger.Logger; import com.zhidaoauto.map.sdk.open.MapAutoApi; import com.zhidaoauto.map.sdk.open.abs.MapStatusListener; @@ -284,6 +287,15 @@ public class AMapViewWrapper implements IMogoMapView, } + private ADASRecognizedResultConvert mAdasResultConvert; + + + @Override + public void setAdasRecognizedResult(String result) { + Log.d("liyz", "------- setAdasRecognizedResult ------>"); + mAdasResultConvert = GsonUtil.objectFromJson(result, ADASRecognizedResultConvert.class); + } + @Override public void setTrafficEnabled(boolean visible) { if (checkAMapView()) { @@ -759,12 +771,20 @@ public class AMapViewWrapper implements IMogoMapView, } } - if (mSelfMarker == null) { + if (mSelfMarker == null) { //TODO mAdasResultConvert + Log.d("liyz", "-------1------>"); try { mSelfMarker = mMapView.getMapAutoViewHelper().getMyLocationStyle().getSelfMarker(); mSelfMarker.setInfoWindowEnable(true); + } catch (Exception e) { } + } else { + Log.d("liyz", "-------2------>"); + mSelfMarker.marker3DIcon(R.raw.people); +// WorkThreadHandler.getInstance().postDelayed(() -> { +// mSelfMarker.marker3DIcon(R.raw.people); +// }, 10000); } showSelfSpeed(location.getSpeed()); } @@ -999,6 +1019,7 @@ public class AMapViewWrapper implements IMogoMapView, } } + //TODO @Override public void syncLocation2Map(JSONObject data) { if (!checkAMapView()) { diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java index 184f7f7ff0..5aed07f73e 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java @@ -357,4 +357,11 @@ public class AMapUIController implements IMogoMapUIController { mClient.clearRoadCacheById(id); } } + + @Override + public void setAdasRecognizedResult(String result) { + if (mClient != null) { + mClient.setAdasRecognizedResult(result); + } + } } diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java index 0634cec1f7..77d1460bab 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java @@ -6,7 +6,6 @@ import android.location.Location; import android.view.View; import android.view.animation.Interpolator; -import androidx.annotation.DrawableRes; import androidx.annotation.Nullable; import com.mogo.map.MogoLatLng; @@ -237,6 +236,8 @@ public interface IMogoMapUIController { */ void changeBearing( float bearing ); + void setAdasRecognizedResult(String result); + /** * 获取瓦片id * @param lon 经度 diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java index d6d009fed0..14b7db6a78 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java @@ -401,4 +401,12 @@ public class MogoMapUIController implements IMogoMapUIController { mDelegate.clearRoadCacheById(id); } } + + @Override + public void setAdasRecognizedResult(String result) { + initDelegate(); + if (mDelegate != null) { + mDelegate.setAdasRecognizedResult(result); + } + } } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java index 1cca2829bc..3e22d2154d 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java @@ -95,7 +95,6 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 5, 180); IMogoMarker marker = drawMarker(markerShowEntity); - Log.d("liyz", "renderWarnData marker != null direction = " + data.getDirection()); //识别物 marker.addDynamicAnchorPosition(new MogoLatLng( data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(), diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/ADASRecognizedResultConvert.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/ADASRecognizedResultConvert.java new file mode 100644 index 0000000000..2753190150 --- /dev/null +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/ADASRecognizedResultConvert.java @@ -0,0 +1,107 @@ +package com.mogo.module.common.entity; + +/** + * @author lixiaopeng + * @description adas识别数据需要转换一下 + * @since 2021/4/23 + */ +public class ADASRecognizedResultConvert { + + /** + * 识别物体类型 + */ + public int type; + + /** + * 识别物体唯一标识 + */ + public String uuid; + + /** + * 红绿灯颜色 + */ + public String color; + + /** + * 车ID + */ + public String carId; + + /** + * 识别物体的纬度 + */ + public double lat; + + /** + * 识别物体的经度 + */ + public double lon; + + /** + * 车头朝向 + */ + public double heading; + + /** + * 系统时间 + */ + public long systemTime; + + /** + * 定位卫星时间 + */ + public long satelliteTime; + + /** + * 海拔 + */ + public double alt; + + /** + * 速度 + */ + public double speed; + + /** + * 莫顿码 + */ + public long mortonCode; + + /** + * 实际距离 + * 使用distanceX和distanceY计算 + */ + public double distance; + + /** + * 数据来源精度 + * 0:普通定位 + * 1:高精定位 + */ + public int dataAccuracy; + + /** + * 道路ID + */ + private String roadId; + + /** + * 车道ID-2D路段 + */ + private String laneId; + + /** + * 车道号:中心线编号为0,中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3 + */ + private int laneNum; + + /** + * 限速 + */ + private double rateLimiting; + + /** + * 车道宽度 + */ + private double roadWidth; +} diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java index 8c02e0b6f2..7899318da8 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/intent/MockIntentHandler.java @@ -662,6 +662,7 @@ public class MockIntentHandler implements IntentHandler { mLocationMockHandler.sendEmptyMessageDelayed( 101, 100L ); } + public void onAdasCarDataCallback( ADASCarStateInfo stateInfo ) { if ( stateInfo != null && stateInfo.getValues() != null ) { JSONObject data = new JSONObject(); 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 3b7f234f6a..dc85957d66 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 @@ -2,9 +2,11 @@ package com.mogo.module.service.marker; import android.content.Context; import android.graphics.Rect; +import android.location.Location; import android.os.Handler; import android.os.Message; import android.text.TextUtils; +import android.util.Log; import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.debug.DebugConfig; @@ -12,9 +14,14 @@ import com.mogo.map.MogoLatLng; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.IMogoMarkerClickListener; import com.mogo.map.marker.IMogoMarkerManager; +import com.mogo.map.marker.MogoMarkerOptions; +import com.mogo.map.navi.IMogoCarLocationChangedListener2; import com.mogo.map.uicontroller.EnumMapUI; +import com.mogo.map.uicontroller.IMogoMapUIController; import com.mogo.module.common.ModuleNames; +import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.api.CallChatApi; +import com.mogo.module.common.constants.AdasRecognizedType; import com.mogo.module.common.drawer.AdasRecognizedResultDrawer; import com.mogo.module.common.drawer.MarkerDrawer; import com.mogo.module.common.drawer.OnlineCarDrawer; @@ -25,6 +32,7 @@ import com.mogo.module.common.drawer.marker.MapMarkerAdapter; import com.mogo.module.common.drawer.marker.OnlineCarMarkerView; import com.mogo.module.common.entity.MarkerCardResult; import com.mogo.module.common.entity.MarkerExploreWay; +import com.mogo.module.common.entity.MarkerLocation; import com.mogo.module.common.entity.MarkerOnlineCar; import com.mogo.module.common.entity.MarkerResponse; import com.mogo.module.common.entity.MarkerShowEntity; @@ -35,6 +43,7 @@ import com.mogo.module.service.ServiceConst; import com.mogo.module.service.network.RefreshCallback; import com.mogo.module.service.network.RefreshModel; import com.mogo.realtime.api.MoGoAiCloudRealTime; +import com.mogo.realtime.entity.ADASRecognizedResult; import com.mogo.realtime.entity.MogoSnapshotSetData; import com.mogo.realtime.socket.IMogoCloudOnMsgListener; import com.mogo.service.adas.IMogoADASControlStatusChangedListener; @@ -45,6 +54,7 @@ import com.mogo.utils.ThreadPoolService; import com.mogo.utils.UiThreadHandler; import com.mogo.utils.ViewUtils; import com.mogo.utils.WorkThreadHandler; +import com.mogo.utils.network.utils.GsonUtil; import com.zhidao.carchattingprovider.ICallChatResponse; import org.json.JSONArray; @@ -56,6 +66,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA; + /** * author : donghongyu * e-mail : 1358506549@qq.com @@ -66,7 +78,8 @@ import java.util.Map; public class MapMarkerManager implements IMogoMarkerClickListener, IMogoOnMessageListener< MarkerResponse >, IMogoBizActionDoneListener, - IMogoADASControlStatusChangedListener { + IMogoADASControlStatusChangedListener, + IMogoCarLocationChangedListener2 { private static final String TAG = "MapMarkerManager"; private Context mContext; @@ -113,7 +126,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, CloudPoiManager.getInstance().updateFromConfig( context ); MarkerServiceHandler.getActionManager().registerBizActionDoneListener( this ); MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener( TAG, this ); - + MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerCarLocationChangedListener(TAG, this); if ( CallChatApi.getInstance().getApiProvider() != null ) { CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener( TAG, mContext, new ICallChatResponse() { @@ -153,14 +166,79 @@ public class MapMarkerManager implements IMogoMarkerClickListener, MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback( resultList -> { // 绘制近景识别到的车辆 AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList ); - //绘制他车的线 lixp TODO + //绘制他车的线 liyz TODO - //添加自车的定位图标 TODO + //添加自车的定位图标,碰撞只有一个预警 TODO + ADASRecognizedResult result = null; + for (int i = 0; i < resultList.size(); i++) { + result = resultList.get(i); + } + //通过这个传值 ADASRecognizedResult + MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().setAdasRecognizedResult(GsonUtil.jsonFromObject(result)); } ); } + @Override + public void onCarLocationChanged2(Location latLng) { + Log.d("liyz", "long =" + latLng.getLongitude() + "---lat = " + latLng.getLatitude()); + MarkerLocation location = new MarkerLocation(); + location.setLat(latLng.getLatitude()); + location.setLon(latLng.getLongitude()); + + MarkerShowEntity markerShowEntity = new MarkerShowEntity(); + markerShowEntity.setMarkerLocation(location); + markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA); + + IMogoMarker marker = drawMarker(markerShowEntity); + + WorkThreadHandler.getInstance().postDelayed(() -> { + int resId = getModelRes(6); + marker.use3DResource( resId ); + }, 10000); + + } + + @Override + public void onCarLocationChanged(MogoLatLng latLng) { + + } + + public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity) { + MogoMarkerOptions options = new MogoMarkerOptions() + .object(markerShowEntity) + .latitude(markerShowEntity.getMarkerLocation().getLat()) + .longitude(markerShowEntity.getMarkerLocation().getLon()); + IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); + options.icon3DRes(getModelRes(6)); //TODO + + options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF + IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options); + iMarkerView.setMarker(marker); + marker.setToTop(); + + return marker; + } + + public int getModelRes(int type) { + AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type); + if (recognizedType == AdasRecognizedType.classIdCar + || recognizedType == AdasRecognizedType.classIdTrafficTruck) { + return com.mogo.module.common.R.raw.othercar; + } else if (recognizedType == AdasRecognizedType.classIdTrafficBus) { + return com.mogo.module.common.R.raw.bus; + } else if (recognizedType == AdasRecognizedType.classIdBicycle + || recognizedType == AdasRecognizedType.classIdMoto) { + return com.mogo.module.common.R.raw.motorbike; + } else if (recognizedType == AdasRecognizedType.classIdStopLine) { + return com.mogo.module.common.R.raw.stopline; + } else if (recognizedType == AdasRecognizedType.classIdWarningArrows) { + return com.mogo.module.common.R.raw.arraw; + } + return com.mogo.module.common.R.raw.people; + } + private Handler mSnapshotHandler = new Handler( WorkThreadHandler.newInstance( "snapshot-thread" ).getLooper() ) { @Override public void handleMessage( Message msg ) { diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java index 63e3371371..0d37b62e52 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/adas/MogoADASController.java @@ -169,6 +169,7 @@ public class MogoADASController implements IMogoADASController { if ( bean == null ) { continue; } + //liyz AdasAIDLOwnerCarRectModel model = new AdasAIDLOwnerCarRectModel(); model.setId( bean.getId() ); model.setXl( bean.getXl() ); @@ -190,6 +191,8 @@ public class MogoADASController implements IMogoADASController { model.setSpeed( bean.getSpeed() ); model.setDataAccuracy( bean.getDataAccuracy() ); model.setDistance( bean.getDistance() ); + + data.add( model ); Logger.d( TAG, "识别距离:x = %s, y = %s", model.getDistance_x(), model.getDistance_y() ); From 4f1be59e06e7650f4987cbf176b8aecd21996596 Mon Sep 17 00:00:00 2001 From: liujing Date: Fri, 23 Apr 2021 20:06:31 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/v2x/scenario/scene/warning/V2XWarningWindow.java | 3 +-- .../src/main/res/raw/scenario_warning_event_data.json | 4 ++-- .../src/main/res/raw/scenario_warning_event_data_left.json | 4 ++-- .../main/res/raw/scenario_warning_event_data_pedestrians.json | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java index c03fae1521..307b019ba7 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java @@ -80,8 +80,7 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow { break; } distance.setText(String.valueOf(mV2XWarningEntity.getDistance()) + "米"); - warningTextView.setText(mV2XWarningEntity.getWarningContent()); - mV2XWarningEntity.setTts(0); + warningTextView.setText(mV2XWarningEntity.getWarningContent());//验证云端数据是否 AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(mV2XWarningEntity.getTts()); } //3秒后移除提示弹框 diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json index 5ad88b34a1..a7ce0d6e0d 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json @@ -1,5 +1,5 @@ { - "type": 10013, + "type": 1, "lat": 26.88299257, "lon": 112.5642132, "distance": 2, @@ -21,7 +21,7 @@ "speed": 11.108121, "targetColor": "#FF4040", "stopLineDistance": 60, - "warningContent": "小心行人", + "warningContent": "注意自行车", "heading": 0, "showTime": 8000, "roadwidth": 4.0 diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json index 29ddc9d6d1..897cb37e59 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json @@ -1,5 +1,5 @@ { - "type": 10013, + "type": 2, "lat": 26.88299257, "lon": 112.5642132, "distance": 2, @@ -21,7 +21,7 @@ "speed": 11.108121, "targetColor": "#FF4040", "stopLineDistance": 60, - "warningContent": "小心行人", + "warningContent": "注意摩托车", "heading": 0, "showTime": 8000, "roadwidth": 4.0 diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json index 0dcb2f00a7..9e854a8efe 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json @@ -1,5 +1,5 @@ { - "type": 10013, + "type": 0, "lat": 26.88299257, "lon": 112.5642132, "distance": 2, @@ -21,7 +21,7 @@ "speed": 11.108121, "targetColor": "#FF4040", "stopLineDistance": 60, - "warningContent": "小心行人", + "warningContent": "注意行人", "heading": 0, "showTime": 8000, "roadwidth": 4.0 From 48d5bc90448b26eea401b8972a0939375e18240f Mon Sep 17 00:00:00 2001 From: zhongchao Date: Fri, 23 Apr 2021 21:02:02 +0800 Subject: [PATCH 3/4] fixbug --- .idea/misc.xml | 2 +- .../java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java | 5 +++++ .../main/java/com/mogo/map/impl/amap/AMapViewWrapper.java | 5 +++++ .../main/java/com/mogo/map/impl/custom/AMapViewWrapper.java | 3 ++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 97b9126cee..733acb1920 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java index 52db642357..a613ac51e8 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java @@ -1038,6 +1038,11 @@ public class AMapNaviViewWrapper implements IMogoMapView, } } + @Override + public long getTileId(double lon, double lat) { + return getMap().getUIController().getTileId(lon,lat); + } + @Override public void setAdasRecognizedResult(String result) { //liyz diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java index c8092157b5..57c8ca3287 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java @@ -811,6 +811,11 @@ public class AMapViewWrapper implements IMogoMapView, } } + @Override + public long getTileId(double lon, double lat) { + return getMap().getUIController().getTileId(lon,lat); + } + @Override public void setAdasRecognizedResult(String result) { //liyz diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index c24ffaf4bf..0dcb745b3a 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -39,6 +39,7 @@ import com.mogo.utils.TipToast; import com.mogo.utils.UiThreadHandler; import com.mogo.utils.WorkThreadHandler; import com.mogo.utils.logger.Logger; +import com.mogo.utils.network.utils.GsonUtil; import com.zhidaoauto.map.sdk.open.MapAutoApi; import com.zhidaoauto.map.sdk.open.abs.MapStatusListener; import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener; @@ -781,7 +782,7 @@ public class AMapViewWrapper implements IMogoMapView, } } else { Log.d("liyz", "-------2------>"); - mSelfMarker.marker3DIcon(R.raw.people); +// mSelfMarker.marker3DIcon(R.raw.people); // WorkThreadHandler.getInstance().postDelayed(() -> { // mSelfMarker.marker3DIcon(R.raw.people); // }, 10000); From b87d8f38ffed241ea32da798a10e0ed32847ae1b Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Fri, 23 Apr 2021 21:32:13 +0800 Subject: [PATCH 4/4] opt --- .../mogo/map/impl/custom/AMapViewWrapper.java | 8 +- .../entity/ADASRecognizedResultConvert.java | 107 ------------------ .../mogo/module/media/window/MediaWindow.java | 2 - .../service/marker/MapMarkerManager.java | 80 ++----------- 4 files changed, 14 insertions(+), 183 deletions(-) delete mode 100644 modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/ADASRecognizedResultConvert.java diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index 0dcb745b3a..3ed503ae0f 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -293,7 +293,7 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void setAdasRecognizedResult(String result) { - Log.d("liyz", "------- setAdasRecognizedResult ------>"); + Log.d("liyz", "------- setAdasRecognizedResult ------>result = " + result); mAdasResultConvert = GsonUtil.objectFromJson(result, ADASRecognizedResultConvert.class); } @@ -773,15 +773,15 @@ public class AMapViewWrapper implements IMogoMapView, } if (mSelfMarker == null) { //TODO mAdasResultConvert - Log.d("liyz", "-------1------>"); +// Log.d("liyz", "-------1------>"); try { mSelfMarker = mMapView.getMapAutoViewHelper().getMyLocationStyle().getSelfMarker(); mSelfMarker.setInfoWindowEnable(true); } catch (Exception e) { } - } else { - Log.d("liyz", "-------2------>"); +// } else { +// Log.d("liyz", "-------2------>"); // mSelfMarker.marker3DIcon(R.raw.people); // WorkThreadHandler.getInstance().postDelayed(() -> { // mSelfMarker.marker3DIcon(R.raw.people); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/ADASRecognizedResultConvert.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/ADASRecognizedResultConvert.java deleted file mode 100644 index 2753190150..0000000000 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/ADASRecognizedResultConvert.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.mogo.module.common.entity; - -/** - * @author lixiaopeng - * @description adas识别数据需要转换一下 - * @since 2021/4/23 - */ -public class ADASRecognizedResultConvert { - - /** - * 识别物体类型 - */ - public int type; - - /** - * 识别物体唯一标识 - */ - public String uuid; - - /** - * 红绿灯颜色 - */ - public String color; - - /** - * 车ID - */ - public String carId; - - /** - * 识别物体的纬度 - */ - public double lat; - - /** - * 识别物体的经度 - */ - public double lon; - - /** - * 车头朝向 - */ - public double heading; - - /** - * 系统时间 - */ - public long systemTime; - - /** - * 定位卫星时间 - */ - public long satelliteTime; - - /** - * 海拔 - */ - public double alt; - - /** - * 速度 - */ - public double speed; - - /** - * 莫顿码 - */ - public long mortonCode; - - /** - * 实际距离 - * 使用distanceX和distanceY计算 - */ - public double distance; - - /** - * 数据来源精度 - * 0:普通定位 - * 1:高精定位 - */ - public int dataAccuracy; - - /** - * 道路ID - */ - private String roadId; - - /** - * 车道ID-2D路段 - */ - private String laneId; - - /** - * 车道号:中心线编号为0,中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3 - */ - private int laneNum; - - /** - * 限速 - */ - private double rateLimiting; - - /** - * 车道宽度 - */ - private double roadWidth; -} diff --git a/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow.java b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow.java index 959540c180..2099f36f8f 100644 --- a/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow.java +++ b/modules/mogo-module-media/src/main/java/com/mogo/module/media/window/MediaWindow.java @@ -271,8 +271,6 @@ public class MediaWindow implements MediaView{ } } else { - - if (mWindowPlayPause != null){ mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause); } 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 dc85957d66..72db237f88 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 @@ -78,8 +78,7 @@ import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_ public class MapMarkerManager implements IMogoMarkerClickListener, IMogoOnMessageListener< MarkerResponse >, IMogoBizActionDoneListener, - IMogoADASControlStatusChangedListener, - IMogoCarLocationChangedListener2 { + IMogoADASControlStatusChangedListener { private static final String TAG = "MapMarkerManager"; private Context mContext; @@ -126,7 +125,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener, CloudPoiManager.getInstance().updateFromConfig( context ); MarkerServiceHandler.getActionManager().registerBizActionDoneListener( this ); MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener( TAG, this ); - MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerCarLocationChangedListener(TAG, this); + if ( CallChatApi.getInstance().getApiProvider() != null ) { CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener( TAG, mContext, new ICallChatResponse() { @@ -166,79 +165,20 @@ public class MapMarkerManager implements IMogoMarkerClickListener, MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback( resultList -> { // 绘制近景识别到的车辆 AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList ); - //绘制他车的线 liyz TODO + //绘制他车的线 liyz //添加自车的定位图标,碰撞只有一个预警 TODO - ADASRecognizedResult result = null; - for (int i = 0; i < resultList.size(); i++) { - result = resultList.get(i); - } - - //通过这个传值 ADASRecognizedResult - MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().setAdasRecognizedResult(GsonUtil.jsonFromObject(result)); +// ADASRecognizedResult result = null; +// for (int i = 0; i < resultList.size(); i++) { +// result = resultList.get(i); +// } +// +// //通过这个传值 ADASRecognizedResult +// MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().setAdasRecognizedResult(GsonUtil.jsonFromObject(result)); } ); } - @Override - public void onCarLocationChanged2(Location latLng) { - Log.d("liyz", "long =" + latLng.getLongitude() + "---lat = " + latLng.getLatitude()); - MarkerLocation location = new MarkerLocation(); - location.setLat(latLng.getLatitude()); - location.setLon(latLng.getLongitude()); - - MarkerShowEntity markerShowEntity = new MarkerShowEntity(); - markerShowEntity.setMarkerLocation(location); - markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA); - - IMogoMarker marker = drawMarker(markerShowEntity); - - WorkThreadHandler.getInstance().postDelayed(() -> { - int resId = getModelRes(6); - marker.use3DResource( resId ); - }, 10000); - - } - - @Override - public void onCarLocationChanged(MogoLatLng latLng) { - - } - - public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity) { - MogoMarkerOptions options = new MogoMarkerOptions() - .object(markerShowEntity) - .latitude(markerShowEntity.getMarkerLocation().getLat()) - .longitude(markerShowEntity.getMarkerLocation().getLon()); - IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); - options.icon3DRes(getModelRes(6)); //TODO - - options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF - IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options); - iMarkerView.setMarker(marker); - marker.setToTop(); - - return marker; - } - - public int getModelRes(int type) { - AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type); - if (recognizedType == AdasRecognizedType.classIdCar - || recognizedType == AdasRecognizedType.classIdTrafficTruck) { - return com.mogo.module.common.R.raw.othercar; - } else if (recognizedType == AdasRecognizedType.classIdTrafficBus) { - return com.mogo.module.common.R.raw.bus; - } else if (recognizedType == AdasRecognizedType.classIdBicycle - || recognizedType == AdasRecognizedType.classIdMoto) { - return com.mogo.module.common.R.raw.motorbike; - } else if (recognizedType == AdasRecognizedType.classIdStopLine) { - return com.mogo.module.common.R.raw.stopline; - } else if (recognizedType == AdasRecognizedType.classIdWarningArrows) { - return com.mogo.module.common.R.raw.arraw; - } - return com.mogo.module.common.R.raw.people; - } - private Handler mSnapshotHandler = new Handler( WorkThreadHandler.newInstance( "snapshot-thread" ).getLooper() ) { @Override public void handleMessage( Message msg ) {