From 5534d59b328d56a1fc63d4cd597c9c82a8837d67 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Tue, 13 Apr 2021 19:59:28 +0800 Subject: [PATCH 01/12] 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 02/12] =?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 03/12] =?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 04/12] 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 05/12] =?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 06/12] 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 07/12] 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 ) { From 679e183859df900e7866212373d3bad6c9954d7e Mon Sep 17 00:00:00 2001 From: liujing Date: Thu, 15 Apr 2021 10:30:06 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E9=A2=84=E8=AD=A6=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E7=89=A9=E4=B8=8B=E6=96=B9=E7=BA=A2=E8=89=B2=E5=9C=86=E5=9C=88?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=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 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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 a38db88df2..71bbe6a00d 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 @@ -88,8 +88,9 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL IMogoMarker bottomMarker = drawMarkerWith2Resource(markerShowEntity); - //2D资源图片位置调整 MogoLatLng mogoLatLng = new MogoLatLng(data.getCollisionLat(), data.getCollisionLon()); + //2D资源图片位置调整 + MogoLatLng stopLineNew = Trigonometric.getNewLocation(data.getStopLines().get(1), 8, 180); MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 8, 180); IMogoMarker marker = drawMarker(markerShowEntity); @@ -100,8 +101,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 : newLocation.getLat(), - data.getDirection() == 1 ? data.getStopLines().get(1).lon : newLocation.getLon()), (float) data.getHeading(), 5000); + data.getDirection() == 1 ? stopLineNew.lat : newLocation.getLat(), + data.getDirection() == 1 ? stopLineNew.lon : newLocation.getLon()), (float) data.getHeading(), 5000); //移动完成以后,3s后消失 UiThreadHandler.postDelayed(() -> { marker.remove(); @@ -127,7 +128,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL return marker; } - public void drawerMarkerWithLocation(MarkerShowEntity markerShowEntity, MogoLatLng location){ + public void drawerMarkerWithLocation(MarkerShowEntity markerShowEntity, MogoLatLng location) { MogoMarkerOptions options = new MogoMarkerOptions() .object(markerShowEntity) .latitude(location.getLat()) @@ -140,6 +141,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL iMarkerView.setMarker(marker); marker.setToTop(); } + /* * 2D资源绘制marker底部的红色圆圈 * */ From ce46887ca1710b89525428956d5ef74089a9e84c Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Thu, 15 Apr 2021 10:51:32 +0800 Subject: [PATCH 09/12] fixed upload --- .../java/com/zhidao/roadcondition/service/CarCorderController.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt index faee34d0e5..ac1a0a8a49 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/service/CarCorderController.kt @@ -499,6 +499,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback { info.type = type //0为图片, 1为视频 info.fromType = fromType info.mainInfoId = mainInfoId + info.infoType = 1 return info } From 88886e9fcfd8edd135203d8ec458c6eb24f98c74 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Thu, 15 Apr 2021 11:02:40 +0800 Subject: [PATCH 10/12] fix bug and add note --- .../mogo/module/common/drawer/BaseDrawer.java | 272 +++++++++--------- .../SnapshotLocationController.java | 34 +-- .../com/mogo/module/service/MogoServices.java | 18 +- .../service/location/MogoRTKLocation.java | 16 +- 4 files changed, 162 insertions(+), 178 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 99f926ae0a..7ac3c2d469 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 @@ -29,12 +29,12 @@ import java.util.Set; import static java.lang.Math.PI; public -/** - * @author congtaowang - * @since 2020/10/30 - *

- * 描述 - */ + /* + * @author congtaowang + * @since 2020/10/30 + *

+ * 描述 + */ class BaseDrawer { /** @@ -48,11 +48,11 @@ class BaseDrawer { public void showSpeed() { try { - showSelfSpeed( context, + showSelfSpeed(context, marker, speed, - MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ); - } catch ( Exception e ) { + MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()); + } catch (Exception e) { e.printStackTrace(); } } @@ -79,12 +79,12 @@ class BaseDrawer { /** * 地图内部资源md5缓存,便于资源复用 */ - protected static final Map< String, String > mMarkerCachesResMd5Values = new HashMap<>(); + protected static final Map mMarkerCachesResMd5Values = new HashMap<>(); /** * 上一帧数据的缓存 */ - protected Map< String, IMogoMarker > mMarkersCaches = new HashMap<>(); + protected Map mMarkersCaches = new HashMap<>(); protected final Context mContext; @@ -101,38 +101,38 @@ class BaseDrawer { * 处理 marker 移除的线程 */ private static void initWorkThreadHandler() { - if ( mWorkThreadHandler == null ) { - mWorkThreadHandler = new Handler( WorkThreadHandler.newInstance( "3d-marker-work-thread" ).getLooper() ) { + if (mWorkThreadHandler == null) { + mWorkThreadHandler = new Handler(WorkThreadHandler.newInstance("3d-marker-work-thread").getLooper()) { @Override - public void handleMessage( Message msg ) { - super.handleMessage( msg ); - if ( msg.what == MSG_REMOVE_DIRTY_MARKERS ) { - if ( msg.obj instanceof Map ) { - removeDirtyMarkers( ( ( Map ) msg.obj ) ); - Set< String > key = ( ( Map ) msg.obj ).keySet(); - for ( String id : key ) { + public void handleMessage(Message msg) { + super.handleMessage(msg); + if (msg.what == MSG_REMOVE_DIRTY_MARKERS) { + if (msg.obj instanceof Map) { + removeDirtyMarkers(((Map) msg.obj)); + Set key = ((Map) msg.obj).keySet(); + for (String id : key) { // 清除道路缓存 - clearRoadCacheById( id ); + clearRoadCacheById(id); } - } else if ( msg.obj instanceof String ) { + } else if (msg.obj instanceof String) { MogoApisHandler.getInstance().getApis() .getMapServiceApi() - .getMarkerManager( AbsMogoApplication.getApp() ) - .removeMarkers( ( ( String ) msg.obj ) ); + .getMarkerManager(AbsMogoApplication.getApp()) + .removeMarkers(((String) msg.obj)); } } } }; } - if ( mRenderThreadHandler == null ) { - mRenderThreadHandler = new Handler( WorkThreadHandler.newInstance( "render-thread-" + new Random().nextLong() ).getLooper() ) { + if (mRenderThreadHandler == null) { + mRenderThreadHandler = new Handler(WorkThreadHandler.newInstance("render-thread-" + new Random().nextLong()).getLooper()) { @Override - public void handleMessage( Message msg ) { - super.handleMessage( msg ); - if ( msg.what == MSG_DISPLAY_SPEED ) { - if ( msg.obj instanceof SpeedData ) { - showSpeed( ( SpeedData ) msg.obj ); + public void handleMessage(Message msg) { + super.handleMessage(msg); + if (msg.what == MSG_DISPLAY_SPEED) { + if (msg.obj instanceof SpeedData) { + showSpeed((SpeedData) msg.obj); } } } @@ -143,10 +143,10 @@ class BaseDrawer { /** * 显示速度 * - * @param data + * @param data {@link SpeedData} */ - private static void showSpeed( SpeedData data ) { - if ( data == null ) { + private static void showSpeed(SpeedData data) { + if (data == null) { return; } data.showSpeed(); @@ -156,13 +156,13 @@ class BaseDrawer { * 清除无效[为 null 或者 已被销毁]的 marker */ protected void removeUselessMarker() { - if ( mMarkersCaches == null || mMarkersCaches.isEmpty() ) { + if (mMarkersCaches == null || mMarkersCaches.isEmpty()) { return; } - Iterator< IMogoMarker > iterator = mMarkersCaches.values().iterator(); - while ( iterator.hasNext() ) { + Iterator iterator = mMarkersCaches.values().iterator(); + while (iterator.hasNext()) { IMogoMarker marker = iterator.next(); - if ( marker == null || marker.isDestroyed() ) { + if (marker == null || marker.isDestroyed()) { iterator.remove(); } } @@ -171,66 +171,60 @@ class BaseDrawer { /** * 发送消息 * - * @param msg - * @param data + * @param msg 消息类型 + * @param data 数据体 */ - public void sendMessage( int msg, Object data ) { + public void sendMessage(int msg, Object data) { Message message = Message.obtain(); message.what = msg; message.obj = data; - mWorkThreadHandler.sendMessage( message ); + mWorkThreadHandler.sendMessage(message); } /** * 判断是否是绘制内容 * - * @param type - * @return + * @param type {@link AdasRecognizedType} + * @return render */ - public boolean isRenderType( int type ) { - AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type ); - if ( recognizedType == AdasRecognizedType.classIdCar + public boolean isRenderType(int type) { + AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type); + return recognizedType == AdasRecognizedType.classIdCar || recognizedType == AdasRecognizedType.classIdMoto || recognizedType == AdasRecognizedType.classIdBicycle || recognizedType == AdasRecognizedType.classIdPerson || recognizedType == AdasRecognizedType.classIdTrafficBus - || recognizedType == AdasRecognizedType.classIdTrafficTruck ) { - return true; - } - return false; + || recognizedType == AdasRecognizedType.classIdTrafficTruck; } /** * 是否展示车速 * - * @param type - * @return + * @param type {@link AdasRecognizedType} + * @return showSpeed */ - public boolean shouldShowSpeed( int type ) { - AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type ); - if ( recognizedType == AdasRecognizedType.classIdBicycle - || recognizedType == AdasRecognizedType.classIdMoto - || recognizedType == AdasRecognizedType.classIdPerson ) { - return false; - } - return true; + public boolean shouldShowSpeed(int type) { + AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type); + return recognizedType != AdasRecognizedType.classIdBicycle + && recognizedType != AdasRecognizedType.classIdMoto + && recognizedType != AdasRecognizedType.classIdPerson; } /** * 获取3D锚点模型资源 * * @param type {@link AdasRecognizedType} - * @return + * @return modelRes */ - public int getModelRes( int type ) { - AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type ); - if ( recognizedType == AdasRecognizedType.classIdCar - || recognizedType == AdasRecognizedType.classIdTrafficTruck ) { + public int getModelRes(int type) { + AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type); + if (recognizedType == AdasRecognizedType.classIdCar + || recognizedType == AdasRecognizedType.classIdTrafficTruck) { return R.raw.othercar; - } else if ( recognizedType == AdasRecognizedType.classIdTrafficBus ) { + } else if (recognizedType == AdasRecognizedType.classIdTrafficBus) { return R.raw.bus; - } else if ( recognizedType == AdasRecognizedType.classIdBicycle - || recognizedType == AdasRecognizedType.classIdMoto ) { + } else if (recognizedType == AdasRecognizedType.classIdBicycle + || recognizedType == AdasRecognizedType.classIdMoto) { return R.raw.motorbike; } return R.raw.people; @@ -244,18 +238,18 @@ class BaseDrawer { * @param lat 纬度 * @return 实际车辆颜色 */ - protected String getModelRenderColor( int type, double speed, double lon, double lat, double angle ) { + protected String getModelRenderColor(int type, double speed, double lon, double lat, double angle) { - AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type ); - if ( recognizedType == AdasRecognizedType.classIdTrafficBus ) { + AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type); + if (recognizedType == AdasRecognizedType.classIdTrafficBus) { return "#D8D8D8FF"; } // 距离策略 - double coordinates[] = getCurCoordinates(); - double distance = CoordinateUtils.calculateLineDistance( lon, lat, coordinates[0], coordinates[1] ) * 100; - if ( distance < 50 ) { + 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 ) { + } else if (distance < 100 && distance >= 50) { return Car3DModelColor.Warming.color; } @@ -263,11 +257,11 @@ class BaseDrawer { // 自车速度 >= 50% 危险 // 10% < 自车速度 < 50% 警告 double curSpeed = getCurSpeed(); - if ( curSpeed > 0 && speed > curSpeed ) { - double rate = ( ( speed - curSpeed ) / curSpeed ) * 100; - if ( rate >= 50 ) { + if (curSpeed > 0 && speed > curSpeed) { + double rate = ((speed - curSpeed) / curSpeed) * 100; + if (rate >= 50) { return Car3DModelColor.Dangerous.color; - } else if ( rate > 10 && rate < 50 ) { + } else if (rate > 10 && rate < 50) { return Car3DModelColor.Warming.color; } } @@ -279,11 +273,11 @@ class BaseDrawer { /** * 返回当前自车速度 * - * @return + * @return isCurSpeed */ private double getCurSpeed() { double speed = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastSpeed(); - if ( speed <= 0 ) { + if (speed <= 0) { speed = SnapshotLocationController.getInstance().getCurSpeed(); } return speed; @@ -295,11 +289,11 @@ class BaseDrawer { * @return */ private double[] getCurCoordinates() { - double coordinates[] = { + double[] coordinates = { MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(), MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(), }; - if ( coordinates[0] <= 0 ) { + if (coordinates[0] <= 0) { coordinates[0] = SnapshotLocationController.getInstance().getCurLon(); coordinates[1] = SnapshotLocationController.getInstance().getCurLat(); } @@ -312,13 +306,13 @@ class BaseDrawer { */ public enum Car3DModelColor { - Normal( "#D8D8D8FF" ), - Warming( "#FFD53EFF" ), - Dangerous( "#FF3C45FF" ); + Normal("#D8D8D8FF"), + Warming("#FFD53EFF"), + Dangerous("#FF3C45FF"); - private String color; + private final String color; - Car3DModelColor( String color ) { + Car3DModelColor(String color) { this.color = color; } } @@ -328,59 +322,59 @@ class BaseDrawer { /** * 展示车辆速度 * - * @param context - * @param mogoMarker - * @param speed - * @param isVrMode + * @param context 上下文 + * @param mogoMarker {@link IMogoMarker} + * @param speed 是否显示速度 + * @param isVrMode 是否是vrMode */ - public void showSelfSpeed( Context context, IMogoMarker mogoMarker, double speed, boolean isVrMode ) { - if ( mogoMarker == null || mogoMarker.isDestroyed() ) { + public void showSelfSpeed(Context context, IMogoMarker mogoMarker, double speed, boolean isVrMode) { + if (mogoMarker == null || mogoMarker.isDestroyed()) { return; } - if ( !isVrMode ) { + if (!isVrMode) { mogoMarker.hideInfoWindow(); return; } - int speedIntVal = ( int ) ( speed * 3.6 ); - if ( speedIntVal <= 0 ) { + int speedIntVal = (int) (speed * 3.6); + if (speedIntVal <= 0) { mogoMarker.hideInfoWindow(); return; } String speedVal = speedIntVal + ""; - String infoResName = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMarkerInfoResName( speedVal ); - mogoMarker.setInfoWindowOffset( 0, 20 ); - if ( TextUtils.isEmpty( infoResName ) ) { - if ( mSpeedView == null ) { - mSpeedView = new TextView( context ); - mSpeedView.setTextColor( Color.WHITE ); - mSpeedView.setTypeface( Typeface.defaultFromStyle( Typeface.BOLD ) ); - mSpeedView.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT ) ); + String infoResName = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMarkerInfoResName(speedVal); + mogoMarker.setInfoWindowOffset(0, 20); + if (TextUtils.isEmpty(infoResName)) { + if (mSpeedView == null) { + mSpeedView = new TextView(context); + mSpeedView.setTextColor(Color.WHITE); + mSpeedView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); + mSpeedView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); } - mSpeedView.setText( speedVal ); - mogoMarker.updateInfoWindowView( mSpeedView ); - MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().setMarkerInfoResName( speedVal, mogoMarker.getMarkerInfoResName() ); + mSpeedView.setText(speedVal); + mogoMarker.updateInfoWindowView(mSpeedView); + MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().setMarkerInfoResName(speedVal, mogoMarker.getMarkerInfoResName()); } else { - mogoMarker.updateInfoWindowView( infoResName ); + mogoMarker.updateInfoWindowView(infoResName); } } /** * 移除markers * - * @param dirtyMarkers + * @param dirtyMarkers 缓存marker数据 */ - protected static void removeDirtyMarkers( Map< String, IMogoMarker > dirtyMarkers ) { - if ( dirtyMarkers == null || dirtyMarkers.isEmpty() ) { + protected static void removeDirtyMarkers(Map dirtyMarkers) { + if (dirtyMarkers == null || dirtyMarkers.isEmpty()) { return; } - final Collection< IMogoMarker > dirSet = dirtyMarkers.values(); - for ( IMogoMarker value : dirSet ) { - if ( value == null || value.isDestroyed() ) { + final Collection dirSet = dirtyMarkers.values(); + for (IMogoMarker value : dirSet) { + if (value == null || value.isDestroyed()) { continue; } try { value.destroy(); - } catch ( Exception e ) { + } catch (Exception e) { e.printStackTrace(); } } @@ -393,15 +387,15 @@ class BaseDrawer { * @param id * @param marker */ - protected static void cacheMarkerIconResMd5Val( String id, IMogoMarker marker ) { - if ( marker == null || marker.isDestroyed() ) { + protected static void cacheMarkerIconResMd5Val(String id, IMogoMarker marker) { + if (marker == null || marker.isDestroyed()) { return; } String md5 = marker.getMarkerResName(); - if ( TextUtils.isEmpty( md5 ) || TextUtils.isEmpty( id ) ) { + if (TextUtils.isEmpty(md5) || TextUtils.isEmpty(id)) { return; } - mMarkerCachesResMd5Values.put( id, md5 ); + mMarkerCachesResMd5Values.put(id, md5); } /** @@ -413,14 +407,14 @@ class BaseDrawer { * @param isRtk * @return */ - public double[] matchRoad( String id, double lon, double lat, double angle, boolean isRtk ) { + public double[] matchRoad(String id, double lon, double lat, double angle, boolean isRtk) { final long start = System.currentTimeMillis(); double[] matchRoad = MogoApisHandler.getInstance() .getApis() .getMapServiceApi() .getMapUIController() - .matchRoad( id, lon, lat, angle, true, isRtk ); - Log.i( "timer-matchRoad", "cost " + ( System.currentTimeMillis() - start ) + "ms" ); + .matchRoad(id, lon, lat, angle, true, isRtk); + Log.i("timer-matchRoad", "cost " + (System.currentTimeMillis() - start) + "ms"); return matchRoad; } @@ -429,8 +423,8 @@ class BaseDrawer { * * @param id */ - public static void clearRoadCacheById( String id ) { - MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().clearRoadCacheById( id ); + public static void clearRoadCacheById(String id) { + MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().clearRoadCacheById(id); } /** @@ -442,11 +436,11 @@ class BaseDrawer { * @param curSatelliteTime * @return */ - public long computeAnimDuration( long lastSystemTime, long curSystemTime, long lastSatelliteTime, long curSatelliteTime ) { + public long computeAnimDuration(long lastSystemTime, long curSystemTime, long lastSatelliteTime, long curSatelliteTime) { long systemTimeInterval = curSystemTime - lastSystemTime; long satelliteTimeInterval = curSatelliteTime - lastSatelliteTime; long interval = systemTimeInterval < satelliteTimeInterval || satelliteTimeInterval == 0 ? systemTimeInterval : satelliteTimeInterval; - if ( interval < 45 ) { + if (interval < 45) { interval = 45; } return interval; @@ -463,37 +457,37 @@ class BaseDrawer { * @param lastLat * @return */ - protected double[] getMatchLonLat( String id, double lon, double lat, double heading, double lastLon, double lastLat ) { - double[] matchedPoint = matchRoad( id, lon, + protected double[] getMatchLonLat(String id, double lon, double lat, double heading, double lastLon, double lastLat) { + double[] matchedPoint = matchRoad(id, lon, lat, heading, true ); boolean match = false; - if ( matchedPoint != null ) { + if (matchedPoint != null) { // Logger.d( TAG, "matchPoint %s distance = %s",lineCounter, matchedPoint[2] ); match = matchedPoint[2] < 1 && matchedPoint[2] > 0; - if ( lastLon != -1 ) { + if (lastLon != -1) { double clearAngle; - if ( heading > 0 && heading <= 90 ) { + if (heading > 0 && heading <= 90) { clearAngle = heading; - } else if ( heading > 90 && heading <= 180 ) { + } else if (heading > 90 && heading <= 180) { clearAngle = 180 - heading; - } else if ( heading > 180 && heading <= 270 ) { + } else if (heading > 180 && heading <= 270) { clearAngle = heading - 180; } else { clearAngle = 360 - heading; } - double _angle = Math.atan2( Math.abs( matchedPoint[0] - lastLon ), Math.abs( matchedPoint[1] - lastLat ) ) * ( 180 / PI ); - _angle = Math.abs( clearAngle - _angle ); + double _angle = Math.atan2(Math.abs(matchedPoint[0] - lastLon), Math.abs(matchedPoint[1] - lastLat)) * (180 / PI); + _angle = Math.abs(clearAngle - _angle); // Logger.d(TAG, "matchPoint %s angel = %s", lineCounter, _angle); - if ( _angle > 22.5 ) { + if (_angle > 22.5) { match = false; } } - if ( match ) { + if (match) { lon = matchedPoint[0]; lat = matchedPoint[1]; } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/uploadintime/SnapshotLocationController.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/uploadintime/SnapshotLocationController.java index c46feff25a..f465344072 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/uploadintime/SnapshotLocationController.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/uploadintime/SnapshotLocationController.java @@ -10,11 +10,11 @@ import java.util.ArrayList; import java.util.List; public -/** +/* * @author congtaowang * @since 2020/12/14 * - * 实时坐标 + * 实时坐标数据处理中心 */ class SnapshotLocationController { @@ -40,16 +40,15 @@ class SnapshotLocationController { sInstance = null; } - private Object readResolve() { - // 阻止反序列化,必须实现 Serializable 接口 - return sInstance; - } - private CloudLocationInfo mLastLocationInfo = null; - private List< CloudLocationInfo > mLocationList = new ArrayList<>(); - private int mDataAccuracy = 0; + // GPS(1s1次) RTK(OS侧)缓存数据, + private final List< CloudLocationInfo > mLocationList = new ArrayList<>(); + // adda 工控机数据缓存 + private final List< CloudLocationInfo > mMachineCacheList = new ArrayList<>(); + + private int mDataAccuracy = 0; private double mCurSpeed; private double mCurLon; private double mCurLat; @@ -57,26 +56,23 @@ class SnapshotLocationController { /** * 同步从定位来的数据(也可能是rtk) * - * @param cli + * @param cli {@link CloudLocationInfo} */ public void syncLocationInfo( CloudLocationInfo cli ) { if ( cli == null ) { return; } mLastLocationInfo = cli; - mCurSpeed = mLastLocationInfo.getSpeed(); - mCurLon = mLastLocationInfo.getLon(); - mCurLat = mLastLocationInfo.getLat(); + mCurSpeed = cli.getSpeed(); + mCurLon = cli.getLon(); + mCurLat = cli.getLat(); mLocationList.add( cli ); } - // adda 工控机数据缓存 - private List< CloudLocationInfo > mMachineCacheList = new ArrayList<>(); - /** * 同步从工控机来的数据 * - * @param data + * @param data JSON结构化数据 */ public void syncAdasLocationInfo( JSONObject data ) { if ( data == null ) { @@ -113,7 +109,7 @@ class SnapshotLocationController { /** * 获取某一段时间内的坐标集合 * - * @return + * @return 坐标合集 */ public List< CloudLocationInfo > getSendLocationData() { @@ -144,7 +140,7 @@ class SnapshotLocationController { /** * 数据精度类型,目前按照数据来源标志 * - * @return + * @return 精度 */ public int getDataAccuracy() { Logger.d( TAG, "upload loc accuracy = %s", mDataAccuracy ); diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java index 9a0d9d421c..ca1b0bb7c4 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/MogoServices.java @@ -109,11 +109,6 @@ public class MogoServices implements IMogoMapListener, return InstanceHolder.INSTANCE; } - private Object readResolve() { - // 阻止反序列化,必须实现 Serializable 接口 - return InstanceHolder.INSTANCE; - } - private static final String TAG = "MogoServices"; /** @@ -238,7 +233,7 @@ public class MogoServices implements IMogoMapListener, /** * 手动刷新回调 */ - private RefreshCallback mCustomRefreshCallback = new RefreshCallback< MarkerResponse >() { + private final RefreshCallback mCustomRefreshCallback = new RefreshCallback< MarkerResponse >() { @Override public void onSuccess( MarkerResponse o ) { MapMarkerManager.getInstance().onSyncMarkerResponse( o ); @@ -616,16 +611,13 @@ public class MogoServices implements IMogoMapListener, private int getQueryRadius() { mCameraSouthWestPosition = mUiController.getCameraSouthWestPosition(); mCameraNorthEastPosition = mUiController.getCameraNorthEastPosition(); - int radius = 0; + int radius; if ( mIsVertical ) { radius = ( ( int ) ( getMapCameraFactWidth() / 2 ) ); } else { radius = ( ( int ) ( getMapCameraFactHeight() / 2 ) ); } - if ( radius < 1000 ) { - return 1_000; - } - return radius; + return Math.max(radius, 1000); } /** @@ -633,7 +625,7 @@ public class MogoServices implements IMogoMapListener, */ private boolean invokeRefreshWhenTranslationByUser( MogoLatLng latLng ) { try { - float factor = 0.0f; + float factor; if ( mIsVertical ) { factor = getMapCameraFactWidth(); } else { @@ -697,7 +689,7 @@ public class MogoServices implements IMogoMapListener, /** * 首次定位成功后,执行道路事件的刷新 * - * @param point + * @param point {@link MogoLatLng} */ private void startFirstLocationRequest( MogoLatLng point ) { mLastAutoRefreshLocation = point; diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java index 185291fbef..1e03387cc6 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java @@ -58,19 +58,21 @@ public class MogoRTKLocation { return criteria; } - private LocationListener locationListener = new LocationListener() { + private final LocationListener locationListener = new LocationListener() { @Override public void onLocationChanged( Location location ) { if ( location != null ) { CloudLocationInfo cloudLocationInfo = new CloudLocationInfo(); cloudLocationInfo.setAlt( location.getAltitude() ); cloudLocationInfo.setHeading( location.getBearing() ); - cloudLocationInfo.setLat( location.getLatitude() ); - cloudLocationInfo.setLon( location.getLongitude() ); - cloudLocationInfo.setSpeed( location.getSpeed() ); - cloudLocationInfo.setSatelliteTime( location.getTime() ); - cloudLocationInfo.setSystemTime( System.currentTimeMillis() ); - SnapshotLocationController.getInstance().syncLocationInfo( cloudLocationInfo ); + if(location.getLatitude() != 0.0 && location.getLongitude() != 0.0){ + cloudLocationInfo.setLat( location.getLatitude() ); + cloudLocationInfo.setLon( location.getLongitude() ); + cloudLocationInfo.setSpeed( location.getSpeed() ); + cloudLocationInfo.setSatelliteTime( location.getTime() ); + cloudLocationInfo.setSystemTime( System.currentTimeMillis() ); + SnapshotLocationController.getInstance().syncLocationInfo( cloudLocationInfo ); + } } else { Logger.e( TAG, "location == null" ); } From b2aec4216ce0aa511f450789fa66e61ce86267f8 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Thu, 15 Apr 2021 11:04:46 +0800 Subject: [PATCH 11/12] .. --- .../com/mogo/module/service/location/MogoRTKLocation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java index 1e03387cc6..dd926dbb11 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/location/MogoRTKLocation.java @@ -63,9 +63,9 @@ public class MogoRTKLocation { public void onLocationChanged( Location location ) { if ( location != null ) { CloudLocationInfo cloudLocationInfo = new CloudLocationInfo(); - cloudLocationInfo.setAlt( location.getAltitude() ); - cloudLocationInfo.setHeading( location.getBearing() ); if(location.getLatitude() != 0.0 && location.getLongitude() != 0.0){ + cloudLocationInfo.setAlt( location.getAltitude() ); + cloudLocationInfo.setHeading( location.getBearing() ); cloudLocationInfo.setLat( location.getLatitude() ); cloudLocationInfo.setLon( location.getLongitude() ); cloudLocationInfo.setSpeed( location.getSpeed() ); From af8c7fdb2ad54a2cb7bbc5a9759d988f004392ca Mon Sep 17 00:00:00 2001 From: zhongchao Date: Thu, 15 Apr 2021 11:05:56 +0800 Subject: [PATCH 12/12] fix bug --- .../common/uploadintime/SnapshotLocationController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/uploadintime/SnapshotLocationController.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/uploadintime/SnapshotLocationController.java index f465344072..da20e6f206 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/uploadintime/SnapshotLocationController.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/uploadintime/SnapshotLocationController.java @@ -101,9 +101,9 @@ class SnapshotLocationController { mLastLocationInfo = cloudLocationInfo; mMachineCacheList.add( cloudLocationInfo ); - mCurSpeed = mLastLocationInfo.getSpeed(); - mCurLon = mLastLocationInfo.getLon(); - mCurLat = mLastLocationInfo.getLat(); + mCurSpeed = cloudLocationInfo.getSpeed(); + mCurLon = cloudLocationInfo.getLon(); + mCurLat = cloudLocationInfo.getLat(); } /**