From 7081074ba08da0c76d4ba729118713103134659c Mon Sep 17 00:00:00 2001 From: wujifei Date: Tue, 13 Apr 2021 19:46:19 +0800 Subject: [PATCH 1/8] =?UTF-8?q?fix#=E6=9B=B4=E6=96=B0UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/module/extensions/view/ArcView.java | 5 ++++- .../v2x/adapter/holder/V2XOtherSeekHelpVH.java | 8 ++++---- .../drawable-xhdpi/v2x_event_icon_daohang_vr.png | Bin 0 -> 2624 bytes .../res/drawable-xhdpi/v2x_event_icon_tel_vr.png | Bin 0 -> 2737 bytes .../src/main/res/drawable/bg_v2x_event_bg.xml | 2 +- .../res/drawable/bg_v2x_event_type_orange_vr.xml | 4 ++-- .../main/res/layout/item_v2x_fault_help_vr.xml | 14 +++++--------- 7 files changed, 16 insertions(+), 17 deletions(-) create mode 100644 modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_daohang_vr.png create mode 100644 modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_tel_vr.png diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/view/ArcView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/view/ArcView.java index 7c22a7c303..9dc23e7587 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/view/ArcView.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/view/ArcView.java @@ -8,6 +8,7 @@ import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; +import android.graphics.Typeface; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.view.View; @@ -69,10 +70,12 @@ public class ArcView extends View { private void drawText(Canvas canvas) { Rect mRect = new Rect(); String mValue = String.valueOf(currentValue); + mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); //绘制中心的数值 mTextPaint.getTextBounds(mValue, 0, mValue.length(), mRect); - canvas.drawText(mValue, getWidth() / 2, getHeight() / 2 + mRect.height() / 2, mTextPaint); + canvas.drawText(mValue, getWidth() / 2, getHeight() / 2 + mRect.height() / 2-10, mTextPaint); + mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL)); //绘制中心文字描述 mTextPaint.setTextSize(28); mTextPaint.getTextBounds(mDes, 0, mDes.length(), mRect); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java index 37c49f4e49..509e7d6bad 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java @@ -199,18 +199,18 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder { if (mV2XPushMessageEntity.getDistance() > 1000) { SpanUtils.with(tvDistance) .append("" + (int) mV2XPushMessageEntity.getDistance() / 1000) - .setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text)) + .setFontSize((int) itemView.getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.dimen.dp_42 : R.dimen.module_v2x_event_distance_text)) .append("公里") - .setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title)) + .setFontSize((int) itemView.getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.dimen.dp_42 : R.dimen.module_v2x_event_distance_title)) .create(); } else { SpanUtils.with(tvDistance) .append("" + (int) mV2XPushMessageEntity.getDistance()) - .setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text)) + .setFontSize((int) itemView.getResources().getDimension(V2XServiceManager.getMoGoStatusManager().isVrMode() ? R.dimen.dp_42 : R.dimen.module_v2x_event_distance_text)) .append("米") .setFontSize((int) itemView.getResources().getDimension( V2XServiceManager.getMoGoStatusManager().isVrMode() ? - R.dimen.module_v2x_event_distance_title_vr : R.dimen.module_v2x_event_distance_title)) + R.dimen.dp_42 : R.dimen.module_v2x_event_distance_title)) .create(); } SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA); diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_daohang_vr.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_daohang_vr.png new file mode 100644 index 0000000000000000000000000000000000000000..8344ac641c046618a863fc3adec42d5e41017e59 GIT binary patch literal 2624 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 literal 0 HcmV?d00001 diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_tel_vr.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/v2x_event_icon_tel_vr.png new file mode 100644 index 0000000000000000000000000000000000000000..3b65e46367dbc92a6b01f28205cfdcefef6b8a24 GIT binary patch literal 2737 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 literal 0 HcmV?d00001 diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_bg.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_bg.xml index 82d3c3395f..73892b5ac9 100644 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_bg.xml +++ b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_bg.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_orange_vr.xml b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_orange_vr.xml index 0c99dfb607..86fe790833 100644 --- a/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_orange_vr.xml +++ b/modules/mogo-module-v2x/src/main/res/drawable/bg_v2x_event_type_orange_vr.xml @@ -2,8 +2,8 @@ + android:endColor="#FFBF29" + android:startColor="#FFBF29" /> \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help_vr.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help_vr.xml index 9a39d8fd09..b69404b002 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help_vr.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_fault_help_vr.xml @@ -35,13 +35,11 @@ android:layout_marginTop="15dp" android:background="@drawable/bg_v2x_event_type_orange_vr" android:gravity="center" - android:paddingTop="@dimen/dp_2" - android:paddingBottom="@dimen/dp_5" android:text="求助" android:textColor="@android:color/white" - android:textSize="@dimen/module_v2x_event_type_title_text_size" + android:textSize="@dimen/sp_20" android:textStyle="bold" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="@id/ivFaultHelpHead" @@ -81,12 +79,11 @@ android:id="@+id/tvFaultHelpDistance" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="@dimen/dp_40" - android:layout_marginRight="@dimen/dp_40" + android:layout_marginEnd="@dimen/dp_42" + android:layout_marginRight="@dimen/dp_42" android:gravity="center_vertical" android:textColor="#FFFFFF" android:textSize="@dimen/dp_42" - android:textStyle="bold" app:layout_constraintBottom_toBottomOf="@+id/ivFaultHelpEventCall" app:layout_constraintEnd_toStartOf="@+id/ivFaultHelpEventCall" app:layout_constraintTop_toTopOf="@+id/ivFaultHelpEventCall" @@ -97,7 +94,7 @@ android:layout_width="@dimen/dp_80" android:layout_height="@dimen/dp_80" android:layout_marginRight="@dimen/dp_40" - android:src="@drawable/selector_talk_btn" + android:src="@drawable/v2x_event_icon_tel_vr" android:visibility="gone" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toStartOf="@id/ivFaultHelpEventNavi" @@ -109,8 +106,7 @@ android:layout_width="@dimen/dp_80" android:layout_height="@dimen/dp_80" android:layout_marginRight="@dimen/dp_40" - android:src="@drawable/selector_nav_btn" - android:visibility="gone" + android:src="@drawable/v2x_event_icon_daohang_vr" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" From 5534d59b328d56a1fc63d4cd597c9c82a8837d67 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Tue, 13 Apr 2021 19:59:28 +0800 Subject: [PATCH 2/8] fix bug of clear marker --- .../java/com/mogo/module/common/drawer/BaseDrawer.java | 1 - .../com/mogo/module/common/drawer/OnlineCarDrawer.java | 10 ++++++++-- .../module/common/drawer/SnapshotSetDataDrawer.java | 10 ++++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java index 491aa86bed..6814fda02f 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java @@ -59,7 +59,6 @@ class BaseDrawer { // 移除过期的 marker public static final int MSG_REMOVE_DIRTY_MARKERS = 9990; - public static final int MSG_REMOVE_ADAS_MARKERS = 9992; /** * 显示速度 diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/OnlineCarDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/OnlineCarDrawer.java index d72eb87fb5..8418f23054 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/OnlineCarDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/OnlineCarDrawer.java @@ -58,6 +58,10 @@ class OnlineCarDrawer { return sInstance; } + public void clearMarkers(){ + MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers( ModuleNames.CARD_TYPE_USER_DATA ); + } + /** * 绘制在线车辆marker * @@ -72,12 +76,12 @@ class OnlineCarDrawer { IMogoMarkerClickListener listener ) { // 将数据同步给在线车辆,避免每次 perform 的时候去拉取,造成消耗 if ( onlineCarList == null || onlineCarList.isEmpty() ) { - MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers( ModuleNames.CARD_TYPE_USER_DATA ); + clearMarkers(); return; } if ( clearOld ) { - MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers( ModuleNames.CARD_TYPE_USER_DATA ); + clearMarkers(); } int size = MarkerDrawer.getInstance().getAppropriateSize( maxAmount, onlineCarList ); @@ -191,4 +195,6 @@ class OnlineCarDrawer { } return false; } + + } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java index c5e5c5fc5b..26f50e85c4 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/SnapshotSetDataDrawer.java @@ -77,16 +77,22 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic private boolean mIsVrMode = false; + /** + * 注册StatusDescriptor.VR_MODE类型,VR_MODE状态改变回调 + * @param descriptor 状态类型 + * @param isTrue true - accOn、adas ui show、voice ui show、push ui show、v2x ui show + */ @Override public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) { Logger.d( TAG, "%s - %s", descriptor, isTrue ); mChangeCarModeStatus = true; - sendMessage( MSG_REMOVE_ADAS_MARKERS, mMarkersCaches ); + sendMessage( MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches ); mMarkersCaches = new HashMap<>(); if ( mLastPositions != null ) { mLastPositions.clear(); } - AdasRecognizedResultDrawer.getInstance().notifyVrModeChanged(); + AdasRecognizedResultDrawer.getInstance().notifyVrModeChanged(); //清除ADAS old marker data + OnlineCarDrawer.getInstance().clearMarkers(); //清除在线车辆 old marker data } public boolean isVrMode() { From 75c52c9f2263912ec809b6ddc0124101a22bbbad Mon Sep 17 00:00:00 2001 From: liujing Date: Tue, 13 Apr 2021 20:03:30 +0800 Subject: [PATCH 3/8] =?UTF-8?q?[add]=20=E9=A2=84=E8=AD=A6=E7=9B=AE?= =?UTF-8?q?=E6=A0=87=E7=89=A9=E5=BA=95=E5=B1=82=E7=9A=84=E7=BA=A2=E8=89=B2?= =?UTF-8?q?=E5=9C=86=E5=9C=88=E4=BD=8D=E7=BD=AE-=E6=9C=AA=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/drawer/V2XWarnDataDrawer.java | 10 ++-- .../module/common/utils/Trigonometric.java | 53 +++++++++++++++++++ .../module_common_warning_marker_bottom.xml | 6 +-- .../impl/MoGoV2XCloundDataManager.java | 21 ++++---- .../scene/warning/V2XWarningMarker.java | 3 +- .../mogo/module/v2x/utils/LocationUtils.java | 42 --------------- 6 files changed, 76 insertions(+), 59 deletions(-) create mode 100644 modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/Trigonometric.java 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 b6f0ed0894..b9e1b9b533 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 @@ -16,6 +16,7 @@ import com.mogo.module.common.drawer.marker.SimpleWindow3DAdapter; import com.mogo.module.common.entity.MarkerLocation; import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.common.entity.V2XWarningEntity; +import com.mogo.module.common.utils.Trigonometric; import com.mogo.module.common.view.MarkerBaseFloor; import com.mogo.service.statusmanager.IMogoStatusChangedListener; import com.mogo.service.statusmanager.StatusDescriptor; @@ -122,15 +123,16 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL } /* - * 2D资源绘制marker + * 2D资源绘制marker底部的红色圆圈 * */ private IMogoMarker drawMarkerWith2Resource(MarkerShowEntity markerShowEntity) { + MogoLatLng mogoLatLng = new MogoLatLng(markerShowEntity.getMarkerLocation().getLat(), markerShowEntity.getMarkerLocation().getLon()); + MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 80, 180); MogoMarkerOptions optionsRipple = new MogoMarkerOptions() - .latitude(markerShowEntity.getMarkerLocation().getLat()) - .longitude(markerShowEntity.getMarkerLocation().getLon()) + .latitude(newLocation.getLat()) + .longitude(newLocation.getLon()) .anchor(1.0f, 1.0f) .zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH); - optionsRipple .icon(ViewUtils.fromView(new EmptyMarkerView(mContext))); IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), optionsRipple); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/Trigonometric.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/Trigonometric.java new file mode 100644 index 0000000000..61f5a5183f --- /dev/null +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/utils/Trigonometric.java @@ -0,0 +1,53 @@ +package com.mogo.module.common.utils; + +import com.mogo.map.MogoLatLng; + +/** + * @author liujing + * @description 描述 + * @since: 2021/4/13 + */ +public class Trigonometric { + private final static double radius_b = 6378137;//大半径 + private final static double radius_s = 6356725;//小半径 + private static double mRadLo; + private static double mRadLa; + private static double Ec; + private static double Ed; + + /** + * 计算两点间的角度 + */ + public static double getAngle(double lon1, double lat1, double lon2, + double lat2) { + double fLat = Math.PI * (lat1) / 180.0; + double fLng = Math.PI * (lon1) / 180.0; + double tLat = Math.PI * (lat2) / 180.0; + double tLng = Math.PI * (lon2) / 180.0; + + double degree = (Math.atan2(Math.sin(tLng - fLng) * Math.cos(tLat), Math.cos(fLat) * Math.sin(tLat) - + Math.sin(fLat) * Math.cos(tLat) * Math.cos(tLng - fLng))) * 180.0 / Math.PI; + if (degree >= 0) { + return degree; + } else { + return 360 + degree; + } + } + + /** + * 根据角度获取指定距离点的经纬度 + */ + public static MogoLatLng getNewLocation(MogoLatLng st, double distance, double angle) { + mRadLo = st.getLon() * Math.PI / 180.; + mRadLa = st.getLat() * Math.PI / 180.; + Ec = radius_s + (radius_b - radius_s) * (90. - st.lat) / 90; + Ed = Ec * Math.cos(mRadLa); + + double dx = distance * Math.sin(Math.toRadians(angle)); + double dy = distance * Math.cos(Math.toRadians(angle)); + double lon_new = (dx / Ed + mRadLo) * 180. / Math.PI; + double lat_new = (dy / Ec + mRadLa) * 180. / Math.PI; + return new MogoLatLng(lat_new, lon_new); + } + +} diff --git a/modules/mogo-module-common/src/main/res/layout/module_common_warning_marker_bottom.xml b/modules/mogo-module-common/src/main/res/layout/module_common_warning_marker_bottom.xml index 1ec9b2b6ab..1bc7234fa3 100644 --- a/modules/mogo-module-common/src/main/res/layout/module_common_warning_marker_bottom.xml +++ b/modules/mogo-module-common/src/main/res/layout/module_common_warning_marker_bottom.xml @@ -1,12 +1,12 @@ + android:layout_height="match_parent" + android:orientation="vertical"> + android:src="@drawable/common_marker_bottom_floor" /> \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java index 6a7ff1d86d..985807685d 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java @@ -12,6 +12,7 @@ import com.mogo.map.overlay.IMogoPolyline; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.drawer.V2XWarnDataDrawer; import com.mogo.module.common.entity.V2XWarningEntity; +import com.mogo.module.common.utils.Trigonometric; import com.mogo.module.service.MarkerServiceHandler; import com.mogo.module.service.receiver.MogoReceiver; import com.mogo.module.v2x.MoGoV2XServicePaths; @@ -19,7 +20,6 @@ import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.entity.model.DrawLineInfo; import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager; -import com.mogo.module.v2x.utils.LocationUtils; import com.mogo.utils.UiThreadHandler; import com.mogo.utils.WorkThreadHandler; @@ -39,7 +39,10 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog private boolean isSelfLineClear; private List fillPoints = new ArrayList();//停止线经纬度合集 private boolean isFirstLocation = false; - private MogoLatLng carLocation; + private MogoLatLng carLocation = new MogoLatLng( + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(), + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon() + ); private static long showTime = 0; @@ -63,7 +66,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog isFirstLocation = false; if (cloundWarningInfo.getDirection() == 1) { //前方 - MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle()); + MogoLatLng newLocation = Trigonometric.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle()); //停止线前方画线 WorkThreadHandler.getInstance().postDelayed(() -> { //二轮车和行人的渲染和移动 @@ -126,7 +129,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog Log.d(V2XConst.LOG_NAME_WARN, " drawStopLine endLatlng lon =" + endLatlng.lon + "--lat =" + endLatlng.lat + "--startLatlng lon = " + startLatlng.lon + "-lat = " + startLatlng.lat); float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat); - MogoLatLng addMiddleLoc = LocationUtils.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle()); + MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle()); if (polyLine != null) { Log.d(V2XConst.LOG_NAME_WARN, "drawStopLine polyLine != null"); polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng)); @@ -158,7 +161,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon()); MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon()); float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat); - MogoLatLng addMiddleLoc = LocationUtils.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle()); + MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle()); if (polyLine != null) { Log.d(V2XConst.LOG_NAME_WARN, "polyLine != null"); polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng)); @@ -225,7 +228,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? carLocation.lat : mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getDirection() == 1 ? carLocation.lon : mCloundWarningInfo.getCollisionLon()); float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat); - addMiddleLoc = LocationUtils.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle()); + addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle()); Log.d(V2XConst.LOG_NAME_WARN, "drawSlefCarLine lon = " + carLocation.lon + "---lat = " + carLocation.lat); isFirstLocation = true; } @@ -265,11 +268,11 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog float distance = CoordinateUtils.calculateLineDistance(x.lon, x.lat, y.lon, y.lat); float average = distance / 3; //两点间的角度 - double angle = LocationUtils.getAngle(x.lon, x.lat, y.lon, y.lat); + double angle = Trigonometric.getAngle(x.lon, x.lat, y.lon, y.lat); //根据距离和角度获取下个点的经纬度 fillPoints.add(x); for (int i = 1; i < 3; i++) { - MogoLatLng newLocation = LocationUtils.getNewLocation(x, average * i, angle); + MogoLatLng newLocation = Trigonometric.getNewLocation(x, average * i, angle); fillPoints.add(newLocation); } fillPoints.add(y); @@ -280,7 +283,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog } private MogoLatLng getMogoLat(MogoLatLng latlng) { - MogoLatLng newLocation = LocationUtils.getNewLocation(latlng, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getDirection()); + MogoLatLng newLocation = Trigonometric.getNewLocation(latlng, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getDirection()); return newLocation; } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java index 75bb3d4554..9f3f54f6ce 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java @@ -16,6 +16,7 @@ import com.mogo.module.common.drawer.marker.SimpleWindow3DAdapter; import com.mogo.module.common.entity.MarkerLocation; import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.common.entity.V2XWarningEntity; +import com.mogo.module.common.utils.Trigonometric; import com.mogo.module.v2x.R; import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; @@ -99,7 +100,7 @@ public class V2XWarningMarker implements IV2XMarker { carlo = new MogoLatLng(lat, lon); } //自车行驶方向的前方*米的经纬度,该经纬度在停止线上 - MogoLatLng drawStopLineLon = LocationUtils.getNewLocation(carlo, mMarkerEntity.getStopLineDistance(), mMarkerEntity.getAngle()); + MogoLatLng drawStopLineLon = Trigonometric.getNewLocation(carlo, mMarkerEntity.getStopLineDistance(), mMarkerEntity.getAngle()); Log.d(TAG, "2D资源绘" + drawStopLineLon); MogoMarkerOptions optionsRipple = new MogoMarkerOptions() .latitude(drawStopLineLon.getLat()) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/LocationUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/LocationUtils.java index 6f6dbc047a..088586d229 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/LocationUtils.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/LocationUtils.java @@ -27,12 +27,6 @@ import com.mogo.utils.network.utils.GsonUtil; */ public class LocationUtils { private static final String TAG = "LocationUtils"; - private final static double radius_b = 6378137;//大半径 - private final static double radius_s = 6356725;//小半径 - private static double mRadLo; - private static double mRadLa; - private static double Ec; - private static double Ed; public static void geoCodeSearch(MogoLocation location, IMogoGeoSearchListener listener) { MogoRegeocodeQuery mogoRegeocodeQuery = new MogoRegeocodeQuery(); @@ -93,42 +87,6 @@ public class LocationUtils { return latLon; } - /** - * 计算两点间的角度 - */ - public static double getAngle(double lon1, double lat1, double lon2, - double lat2) { - double fLat = Math.PI * (lat1) / 180.0; - double fLng = Math.PI * (lon1) / 180.0; - double tLat = Math.PI * (lat2) / 180.0; - double tLng = Math.PI * (lon2) / 180.0; - - double degree = (Math.atan2(Math.sin(tLng - fLng) * Math.cos(tLat), Math.cos(fLat) * Math.sin(tLat) - - Math.sin(fLat) * Math.cos(tLat) * Math.cos(tLng - fLng))) * 180.0 / Math.PI; - if (degree >= 0) { - return degree; - } else { - return 360 + degree; - } - } - - /** - * 根据角度获取指定距离点的经纬度 - */ - public static MogoLatLng getNewLocation(MogoLatLng st, double distance, double angle) { - mRadLo = st.getLon() * Math.PI / 180.; - mRadLa = st.getLat() * Math.PI / 180.; - Ec = radius_s + (radius_b - radius_s) * (90. - st.lat) / 90; - Ed = Ec * Math.cos(mRadLa); - - double dx = distance * Math.sin(Math.toRadians(angle)); - double dy = distance * Math.cos(Math.toRadians(angle)); - double lon_new = (dx / Ed + mRadLo) * 180. / Math.PI; - double lat_new = (dy / Ec + mRadLa) * 180. / Math.PI; - return new MogoLatLng(lat_new, lon_new); - } - - /** * 获取传入的经纬度在车辆的什么位置 * From e10d710d128c1ec00a76336ada9527bd688e8edc Mon Sep 17 00:00:00 2001 From: liujing Date: Wed, 14 Apr 2021 10:19:03 +0800 Subject: [PATCH 4/8] =?UTF-8?q?2D=E5=9C=86=E5=9C=88=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mogo/module/common/drawer/V2XWarnDataDrawer.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 b9e1b9b533..754728253a 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 @@ -87,6 +87,11 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA); IMogoMarker bottomMarker = drawMarkerWith2Resource(markerShowEntity); + + //2D资源图片位置调整 + MogoLatLng mogoLatLng = new MogoLatLng(data.getCollisionLat(), data.getCollisionLon()); + MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 8, 180); + IMogoMarker marker = drawMarker(markerShowEntity); Log.d("liyz", "renderWarnData marker != null direction = " + data.getDirection()); //识别物 @@ -95,8 +100,8 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000); //识别物下方的红色圆圈 bottomMarker.addDynamicAnchorPosition(new MogoLatLng( - data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(), - data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000); + data.getDirection() == 1 ? data.getStopLines().get(1).lat : newLocation.getLat(), + data.getDirection() == 1 ? data.getStopLines().get(1).lon : newLocation.getLon()), (float) data.getHeading(), 5000); //移动完成以后,3s后消失 UiThreadHandler.postDelayed(() -> { marker.remove(); @@ -127,7 +132,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL * */ private IMogoMarker drawMarkerWith2Resource(MarkerShowEntity markerShowEntity) { MogoLatLng mogoLatLng = new MogoLatLng(markerShowEntity.getMarkerLocation().getLat(), markerShowEntity.getMarkerLocation().getLon()); - MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 80, 180); + MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 8, 180); MogoMarkerOptions optionsRipple = new MogoMarkerOptions() .latitude(newLocation.getLat()) .longitude(newLocation.getLon()) From 965ecb9f104d88416a09d202855f47ceb2c720d5 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Wed, 14 Apr 2021 11:43:01 +0800 Subject: [PATCH 5/8] opt --- .../mogo/module/common/drawer/BaseDrawer.java | 41 ++++++++++--------- .../com/mogo/module/v2x/V2XWaringManager.java | 7 ++-- .../v2x/listener/V2XWarnMessageListener.java | 3 +- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java index 6814fda02f..99f926ae0a 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java @@ -10,6 +10,7 @@ import android.util.Log; import android.view.ViewGroup; import android.widget.TextView; +import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.commons.AbsMogoApplication; import com.mogo.map.marker.IMogoMarker; import com.mogo.module.common.MogoApisHandler; @@ -238,7 +239,7 @@ class BaseDrawer { /** * 根据速度、经纬度计算距离判断车辆颜色 * - * @param speed 车速 + * @param speed 车速 TODO 这里很可能是adas的策略 * @param lon 经度 * @param lat 纬度 * @return 实际车辆颜色 @@ -250,26 +251,26 @@ class BaseDrawer { return "#D8D8D8FF"; } // 距离策略 -// double coordinates[] = getCurCoordinates(); -// double distance = CoordinateUtils.calculateLineDistance( lon, lat, coordinates[0], coordinates[1] ) * 100; -// if ( distance < 50 ) { -// return Car3DModelColor.Dangerous.color; -// } else if ( distance < 100 && distance >= 50 ) { -// return Car3DModelColor.Warming.color; -// } + double coordinates[] = getCurCoordinates(); + double distance = CoordinateUtils.calculateLineDistance( lon, lat, coordinates[0], coordinates[1] ) * 100; + if ( distance < 50 ) { + return Car3DModelColor.Dangerous.color; + } else if ( distance < 100 && distance >= 50 ) { + return Car3DModelColor.Warming.color; + } - // 他车车速和自车车速对比速度策略 - // 自车速度 >= 50% 危险 - // 10% < 自车速度 < 50% 警告 -// double curSpeed = getCurSpeed(); -// if ( curSpeed > 0 && speed > curSpeed ) { -// double rate = ( ( speed - curSpeed ) / curSpeed ) * 100; -// if ( rate >= 50 ) { -// return Car3DModelColor.Dangerous.color; -// } else if ( rate > 10 && rate < 50 ) { -// return Car3DModelColor.Warming.color; -// } -// } +// 他车车速和自车车速对比速度策略 +// 自车速度 >= 50% 危险 +// 10% < 自车速度 < 50% 警告 + double curSpeed = getCurSpeed(); + if ( curSpeed > 0 && speed > curSpeed ) { + double rate = ( ( speed - curSpeed ) / curSpeed ) * 100; + if ( rate >= 50 ) { + return Car3DModelColor.Dangerous.color; + } else if ( rate > 10 && rate < 50 ) { + return Car3DModelColor.Warming.color; + } + } // 默认颜色 return Car3DModelColor.Normal.color; diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java index 1f736ccfcd..2f5c7607ea 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java @@ -100,20 +100,19 @@ public class V2XWaringManager { if (v2XWarnMessageListener != null) { V2XServiceManager .getMoGoSocketManager() - .unregisterOnMessageListener(401011, v2XWarnMessageListener); + .unregisterOnMessageListener(10116, v2XWarnMessageListener); } } /** - * 道路事件,行人 TODO type + * 道路预警 弱势群体事件,行人 TODO type */ private void registerWarnListener() { v2XWarnMessageListener = new V2XWarnMessageListener(); - // 道路事件,在线车辆绘制 V2XServiceManager .getMoGoSocketManager() .registerOnMessageListener( - 401011, + 10116, v2XWarnMessageListener ); } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XWarnMessageListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XWarnMessageListener.java index fd0d2541c0..20c18f26c1 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XWarnMessageListener.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XWarnMessageListener.java @@ -20,12 +20,13 @@ public class V2XWarnMessageListener implements IMogoOnMessageListener "); //Logger.d(MODULE_NAME, "V2XMessageListener_401011==V2X地图气泡数据刷新:\n" + GsonUtil.jsonFromObject(response)); V2XUtils.runOnBackgroundThread(() -> { // 解析不同的Marker类型,然后对应的进行绘制 if (info != null) { // 解析存储道路事件 liyz - Log.d(V2XConst.LOG_NAME_WARN, "V2XWarnMessageListener onMsgReceived ----> "); + Log.d(V2XConst.LOG_NAME_WARN, "V2XWarnMessageListener onMsgReceived --22--> "); V2XServiceManager.getMoGoV2XCloundDataManager().analysisV2XCloundDataEvent(info); } }); From 8e9655a564496cabe7205ebc6c8eae9c66a51cea Mon Sep 17 00:00:00 2001 From: liujing Date: Wed, 14 Apr 2021 12:39:48 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BE=A7=E6=96=B9=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E7=89=A9=E4=B8=8E=E9=A2=84=E7=A2=B0=E6=92=9E=E7=82=B9=E4=B9=8B?= =?UTF-8?q?=E9=97=B4=E6=B7=BB=E5=8A=A0=E7=AE=AD=E5=A4=B4marker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/drawer/V2XWarnDataDrawer.java | 13 ++++++++++++ .../impl/MoGoV2XCloundDataManager.java | 20 +++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) 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 754728253a..a38db88df2 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 @@ -127,6 +127,19 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL return marker; } + public void drawerMarkerWithLocation(MarkerShowEntity markerShowEntity, MogoLatLng location){ + MogoMarkerOptions options = new MogoMarkerOptions() + .object(markerShowEntity) + .latitude(location.getLat()) + .longitude(location.getLon()); + IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); + options.icon3DRes(getModelRes(2)); //TODO + + options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF + IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options); + iMarkerView.setMarker(marker); + marker.setToTop(); + } /* * 2D资源绘制marker底部的红色圆圈 * */ diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java index 985807685d..882f35b916 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java @@ -11,6 +11,7 @@ import com.mogo.map.navi.IMogoCarLocationChangedListener2; import com.mogo.map.overlay.IMogoPolyline; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.drawer.V2XWarnDataDrawer; +import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.common.entity.V2XWarningEntity; import com.mogo.module.common.utils.Trigonometric; import com.mogo.module.service.MarkerServiceHandler; @@ -119,7 +120,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog } /** - * 绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置 + * 车辆行驶正前方绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置 */ private void drawStopLine(V2XWarningEntity info, MogoLatLng mogoLatLng) { if (info != null) { @@ -153,7 +154,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog /** - * 目标物与预碰撞点连线,并且更新数据 TODO 需要实时给行人当前位置 + * 侧方目标物与预碰撞点连线,并且更新数据 TODO 需要实时给行人当前位置 */ private void drawOtherObjectLine(V2XWarningEntity info) { if (info != null) { @@ -185,6 +186,21 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog } } + //侧面目标物与碰撞点之间添加多个小箭头 + private void addArrows(MogoLatLng startLatLng, MogoLatLng endLatLng) { + MarkerShowEntity markerShowEntity = new MarkerShowEntity(); + float distance = CoordinateUtils.calculateLineDistance( + startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat); + if (distance > 5) { + int count = (int) (distance / 5); + for (int i = 0; i < count; i++) { + MogoLatLng newLo = Trigonometric.getNewLocation( + startLatLng, 5 * i, mCloundWarningInfo.getAngle()); + V2XWarnDataDrawer.getInstance().drawerMarkerWithLocation(markerShowEntity, newLo); + } + } + } + @Override public void clearALLPOI() { From a5f521393d9d46e4478ab4ad469170002ef24fc4 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Wed, 14 Apr 2021 18:30:20 +0800 Subject: [PATCH 7/8] upgrade map version --- libraries/map-custom/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/map-custom/build.gradle b/libraries/map-custom/build.gradle index fa9c7cf8f4..28941cfea3 100644 --- a/libraries/map-custom/build.gradle +++ b/libraries/map-custom/build.gradle @@ -67,7 +67,7 @@ dependencies { implementation project(':foudations:mogo-commons') } - implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.5' + implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.6' // implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4' } From 4aba759d5244ac2f1cb55b1f60df3daa266de57e Mon Sep 17 00:00:00 2001 From: liujing Date: Thu, 15 Apr 2021 09:56:52 +0800 Subject: [PATCH 8/8] no message --- .../com/mogo/service/impl/adas/MogoADASController.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 0726219d01..252d77318b 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 @@ -138,10 +138,16 @@ public class MogoADASController implements IMogoADASController { super.handleMessage( msg ); final long start = System.currentTimeMillis(); ADASCarStateInfo stateInfo = GsonUtil.objectFromJson( ( ( String ) msg.obj ), ADASCarStateInfo.class ); - Logger.d( "ADAS-LOC-timer", "upd 到 aidl 传输耗时:%s", start - Long.valueOf( stateInfo.getValues().getStartReceiverDataTime() ) ); if ( stateInfo == null || stateInfo.getValues() == null ) { + Logger.d(TAG,"ADAS-LOC-timer","upd 到 aidl 传输数据 stateInfo or stateInfo.getValues() is null"); return; } + if(stateInfo.getValues().getStartReceiverDataTime() != null){ + Logger.d( "ADAS-LOC-timer", "upd 到 aidl 传输耗时:%s", start - Long.valueOf( stateInfo.getValues().getStartReceiverDataTime() ) ); + }else{ + Logger.d( "ADAS-LOC-timer", "upd 到 aidl 传输耗时时间字段 startReceiverDataTime is null"); + } + mLastLon = stateInfo.getValues().getLon(); mLastLat = stateInfo.getValues().getLat(); if ( mMogoAdasCarDataCallback != null ) {