merge qa_aiSdk

This commit is contained in:
zhongchao
2021-04-23 15:57:39 +08:00
20 changed files with 256 additions and 277 deletions

View File

@@ -155,19 +155,19 @@ LOGLIB_VERSION = 1.0.4
######## MogoAiCloudSDK Version
# 网络请求
MOGO_NETWORK_VERSION=1.0.70
MOGO_NETWORK_VERSION=1.0.74
# 鉴权
MOGO_PASSPORT_VERSION=1.0.70
MOGO_PASSPORT_VERSION=1.0.74
# 常链接
MOGO_SOCKET_VERSION=1.0.70
MOGO_SOCKET_VERSION=1.0.74
# 数据采集
MOGO_REALTIME_VERSION=1.0.70
MOGO_REALTIME_VERSION=1.0.74
# 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.0.70
MOGO_TANLU_VERSION=1.0.74
# 直播推流
MOGO_LIVE_VERSION=1.0.70
MOGO_LIVE_VERSION=1.0.74
# 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.0.70
MOGO_TRAFFICLIVE_VERSION=1.0.74
######## Foundation MogoAiCloud Module
# mogoAiCloud apk services

View File

@@ -298,4 +298,9 @@ public class AMapUIController implements IMogoMapUIController {
mClient.changeBearing( bearing );
}
}
@Override
public long getTileId(double lon, double lat) {
return 0;
}
}

View File

@@ -67,7 +67,7 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.6'
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.7'
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
}

View File

@@ -9,7 +9,6 @@ import android.location.Location;
import android.os.Bundle;
import android.os.Trace;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
@@ -17,7 +16,6 @@ import android.view.ViewGroup;
import android.view.animation.Interpolator;
import android.widget.TextView;
import com.autonavi.nge.map.LonLat;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.IMogoMap;
import com.mogo.map.IMogoMapView;
@@ -38,7 +36,6 @@ import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.utils.TipToast;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
import com.zhidaoauto.map.sdk.open.abs.MapStatusListener;
import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener;
@@ -57,7 +54,6 @@ import com.zhidaoauto.map.sdk.open.location.RTKAutopilotLocationBean;
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory;
import com.zhidaoauto.map.sdk.open.marker.Marker;
import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener;
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
import com.zhidaoauto.map.sdk.open.tools.MapTools;
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
@@ -67,10 +63,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
public class AMapViewWrapper implements IMogoMapView,
@@ -729,6 +723,11 @@ public class AMapViewWrapper implements IMogoMapView,
}
}
@Override
public long getTileId(double lon, double lat) {
return getMap().getUIController().getTileId(lon,lat);
}
@Override
public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location) {
Location sysLocation = new Location(location.getProvider());
@@ -796,13 +795,13 @@ public class AMapViewWrapper implements IMogoMapView,
String speedVal = String.valueOf(speedIntVal);
String infoResName = ResIdCache.getVal(speedVal);
int offset = 20;
if ( !mMapView.getMapAutoViewHelper().getLockMode() ) {
if (!mMapView.getMapAutoViewHelper().getLockMode()) {
offset = 30;
}
if ( offset != mLastYOffset ) {
if (offset != mLastYOffset) {
mLastYOffset = offset;
}
mSelfMarker.setInfoWindowOffset( 0, offset );
mSelfMarker.setInfoWindowOffset(0, offset);
if (TextUtils.isEmpty(infoResName)) {
if (mSpeedView == null) {
mSpeedView = new TextView(mMapView.getContext());
@@ -958,7 +957,7 @@ public class AMapViewWrapper implements IMogoMapView,
/**
* 切换到车头朝上
*/
private void change2CarUp(){
private void change2CarUp() {
mMapView.getMapAutoViewHelper().setMapViewPerspective(MapAutoApi.MAP_PERSPECTIVE_UP_CAR);
}
@@ -1029,9 +1028,9 @@ public class AMapViewWrapper implements IMogoMapView,
bean.setAcceleration(acceleration);
bean.setAlt(alt);
bean.setSystemTime(systemTime);
bean.setSatelliteTime( satelliteTime );
bean.setSatelliteTime(satelliteTime);
bean.setReceiverDataTime(receiverDataTime);
bean.setAdasSatelliteTime( adasSatelliteTime );
bean.setAdasSatelliteTime(adasSatelliteTime);
bean.setLon(lon);
bean.setGnss_speed(((float) speed));
bean.setLat(lat);
@@ -1063,24 +1062,24 @@ public class AMapViewWrapper implements IMogoMapView,
/**
* 带缓存的道路匹配算法
*
* <p>
* 使用{@link MapDataApi#INSTANCE#getSinglePointMatchRoad()}这个方法获取道路数据会存在一定耗时目前是4-10ms因为请求频繁为了
* 减小这部分耗时使用一个ConcurrentHashMap{@link #roadCacheMap}缓存道路数据此缓存是以目标车id为key道路数据为value以此减少
* 道路数据获取次数。
*
* <p>
* 当出现道路改变的情况需要重新获取道路数据采用递归的方式重获道路数据以及添加缓存为了避免一直获取不到道路数据一直递归增加useCache参数跳出递归。
*
* <p>
* 道路改变的情况主要分为:
* 1. 目标车距离道路中心线距离超过阈值 matchThreshold取路宽的1/4为阈值
* 2. 目标车到道路中心线的映射点不在道路上(此判断在{@link PointInterpolatorUtil#mergeToRoad(double, double, List)}),也就是说已经驶出了这条道路
* 1. 目标车距离道路中心线距离超过阈值 matchThreshold取路宽的1/4为阈值
* 2. 目标车到道路中心线的映射点不在道路上(此判断在{@link PointInterpolatorUtil#mergeToRoad(double, double, List)}),也就是说已经驶出了这条道路
*
* @param id 目标车唯一标识
* @param lon 目标车经度
* @param lat 目标车纬度
* @param angle 目标车角度
* @param id 目标车唯一标识
* @param lon 目标车经度
* @param lat 目标车纬度
* @param angle 目标车角度
* @param isGpsLocation true-使用gps定位数据
* @param isRTK true-使用rtk数据
* @param usdCache true-使用道路缓存 false-不使用道路缓存
* @param isRTK true-使用rtk数据
* @param usdCache true-使用道路缓存 false-不使用道路缓存
* @return double[]{匹配后经度,匹配后纬度,目标车距离车道中心线距离},若匹配后经纬度值为-1则没有匹配成功
*/
private double[] matchRoad(String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK, boolean usdCache) {
@@ -1089,7 +1088,7 @@ public class AMapViewWrapper implements IMogoMapView,
RoadCacheWrapper roadCache = roadCacheMap.get(id);
double matchThreshold = -1;
if (roadCache == null||roadCache == noCache) {
if (roadCache == null || roadCache == noCache) {
SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad(((float) wgs[0]), ((float) wgs[1]), ((float) angle), isGpsLocation, isRTK);
if (singlePointRoadInfo != null && singlePointRoadInfo.getCoords() != null && !singlePointRoadInfo.getCoords().isEmpty()) {
Log.i("timer-matchRoad-4", "cost " + (System.currentTimeMillis() - start) + "ms roadId: " + singlePointRoadInfo.getRoadId());
@@ -1127,7 +1126,7 @@ public class AMapViewWrapper implements IMogoMapView,
matchThreshold = roadCache.getLaneWidth() / 4;
double[] matchedPoint = PointInterpolatorUtil.mergeToRoad(wgs[0], wgs[1], roadCache.getRoad());
if (matchThreshold>0&&matchedPoint[2] > 0 && matchedPoint[2] <= matchThreshold) {
if (matchThreshold > 0 && matchedPoint[2] > 0 && matchedPoint[2] <= matchThreshold) {
// 目标车在阈值范围内
roadCacheMap.put(id, roadCache);
Log.i("timer-matchRoad-3", "cost " + (System.currentTimeMillis() - start) + "ms");
@@ -1152,8 +1151,8 @@ public class AMapViewWrapper implements IMogoMapView,
}
@Override
public String getMarkerInfoResName( String speedVal ) {
return ResIdCache.getVal( speedVal );
public String getMarkerInfoResName(String speedVal) {
return ResIdCache.getVal(speedVal);
}
@Override

View File

@@ -2,7 +2,6 @@ package com.mogo.map.impl.custom;
import android.content.Context;
import android.graphics.Point;
import android.util.Log;
import com.mogo.map.IMogoMap;
import com.mogo.map.IMogoUiSettings;
@@ -51,13 +50,13 @@ public class AMapWrapper implements IMogoMap {
private IMogoUiSettings mUiSettings;
public AMapWrapper(MapAutoViewHelper map, MapAutoView mapView, IMogoMapUIController controller) {
Logger.i(TAG, "autoop--AMapWrapper: init"+this);
Logger.i(TAG, "autoop--AMapWrapper: init" + this);
this.mAMap = map;
sAMap = map;
this.mMapView = mapView;
mUIcontroller = controller;
// 设置实现自定义 info window
MapAutoApi.INSTANCE.setInfoWindowAdapter( new AMapInfoWindowAdapter() );
MapAutoApi.INSTANCE.setInfoWindowAdapter(new AMapInfoWindowAdapter());
AMapUIController.getInstance().initClient(mUIcontroller);
}
@@ -83,7 +82,7 @@ public class AMapWrapper implements IMogoMap {
@Override
public IMogoMarker addMarker(String tag, MogoMarkerOptions options) {
Logger.i(TAG, "autoop-addMarker: " + tag + ",MogoMarkerOptions:" + options + ",AMap:" + (mAMap != null)+",this:"+this);
Logger.i(TAG, "autoop-addMarker: " + tag + ",MogoMarkerOptions:" + options + ",AMap:" + (mAMap != null) + ",this:" + this);
if (!checkAMap()) {
return null;
}
@@ -134,7 +133,7 @@ public class AMapWrapper implements IMogoMap {
multiPointOverlayOptions.setData(markerOptions);
multiPointOverlayOptions.setMarkerIcon(R.drawable.marker_blue);
List<MarkerOptions> data = mAMap.addMarkers(multiPointOverlayOptions).getOptions().getData();
for (int i = 0 ;i< data.size();i++){
for (int i = 0; i < data.size(); i++) {
markers.add(new Marker(data.get(i)));
}
if (markers == null || markers.isEmpty()) {
@@ -168,7 +167,7 @@ public class AMapWrapper implements IMogoMap {
@Override
public void setPointToCenter(int x, int y) {
if (checkAMap()) {
LonLatPoint lonLatPoint = MapTools.INSTANCE.fromScreenLocation(new Point(x,y));
LonLatPoint lonLatPoint = MapTools.INSTANCE.fromScreenLocation(new Point(x, y));
mAMap.setCenter(lonLatPoint);
}
}
@@ -176,21 +175,21 @@ public class AMapWrapper implements IMogoMap {
@Override
public void setTouchPoiEnable(boolean touchPoiEnable) {
if (checkAMap()) {
mAMap.setTouchPoiEnable( touchPoiEnable );
mAMap.setTouchPoiEnable(touchPoiEnable);
}
}
@Override
public void setTrafficEnable(boolean enable) {
if (checkAMap()) {
mAMap.setTraffic( enable );
mAMap.setTraffic(enable);
}
}
@Override
public void showBuildings(boolean enabled) {
if (checkAMap()) {
mAMap.showBuildings( enabled );
mAMap.showBuildings(enabled);
}
}
@@ -204,7 +203,7 @@ public class AMapWrapper implements IMogoMap {
@Override
public void showMapText(boolean enable) {
if (checkAMap()) {
mAMap.showMapText( enable );
mAMap.showMapText(enable);
}
}
@@ -217,7 +216,7 @@ public class AMapWrapper implements IMogoMap {
@Override
public float getScalePerPixel() {
if ( checkAMap() ) {
if (checkAMap()) {
return mAMap.getScalePerPixel();
}
return 0;
@@ -247,19 +246,19 @@ public class AMapWrapper implements IMogoMap {
@Override
public IMogoPolyline addPolyline(MogoPolylineOptions options) {
if ( checkAMap() ) {
PolylineOptions polylineOptions = ObjectUtils.fromMogo( options );
if (checkAMap()) {
PolylineOptions polylineOptions = ObjectUtils.fromMogo(options);
Logger.d(TAG, "addPolyline %s", polylineOptions.toString());
if ( polylineOptions == null ) {
if (polylineOptions == null) {
return null;
}
Polyline polyline = null;
if (polylineOptions.getLineWidth() > 0){
if (polylineOptions.getLineWidth() > 0) {
polyline = mAMap.drawThickLine(polylineOptions);
}else {
} else {
polyline = mAMap.drawLine(polylineOptions);
}
return new AMapPolylineWrapper( polyline, options );
return new AMapPolylineWrapper(polyline, options);
}
return null;
}

View File

@@ -13,6 +13,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
import org.json.JSONObject;
@@ -286,6 +287,11 @@ public class AMapUIController implements IMogoMapUIController {
}
}
@Override
public long getTileId(double lon, double lat) {
return MapAutoApi.INSTANCE.getTileID(lon,lat,13); // 13为默认获取瓦片层级级别
}
@Override
public void setAnchorScale( float x, float y ) {

View File

@@ -237,6 +237,15 @@ public interface IMogoMapUIController {
*/
void changeBearing( float bearing );
/**
* 获取瓦片id
* @param lon 经度
* @param lat 纬度
* @return 瓦片id
*/
long getTileId(double lon, double lat);
default void setAnchorScale( float x, float y ) {
}

View File

@@ -3,7 +3,6 @@ package com.mogo.map;
import android.graphics.Point;
import android.graphics.Rect;
import android.location.Location;
import android.util.Log;
import android.view.View;
import android.view.animation.Interpolator;
@@ -38,9 +37,9 @@ public class MogoMapUIController implements IMogoMapUIController {
}
public static MogoMapUIController getInstance() {
if ( sInstance == null ) {
synchronized ( MogoMapUIController.class ) {
if ( sInstance == null ) {
if (sInstance == null) {
synchronized (MogoMapUIController.class) {
if (sInstance == null) {
sInstance = new MogoMapUIController();
}
}
@@ -48,7 +47,7 @@ public class MogoMapUIController implements IMogoMapUIController {
return sInstance;
}
public void setDelegate( IMogoMapUIController mDelegate ) {
public void setDelegate(IMogoMapUIController mDelegate) {
this.mDelegate = mDelegate;
}
@@ -57,77 +56,77 @@ public class MogoMapUIController implements IMogoMapUIController {
}
@Override
public void setTrafficEnabled( boolean visible ) {
public void setTrafficEnabled(boolean visible) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setTrafficEnabled( visible );
if (mDelegate != null) {
mDelegate.setTrafficEnabled(visible);
}
}
@Override
public MapControlResult changeZoom( boolean zoom ) {
public MapControlResult changeZoom(boolean zoom) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.changeZoom( zoom );
if (mDelegate != null) {
return mDelegate.changeZoom(zoom);
}
return MapControlResult.ERROR;
}
@Override
public MapControlResult changeZoom( float zoom ) {
public MapControlResult changeZoom(float zoom) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.changeZoom( zoom );
if (mDelegate != null) {
return mDelegate.changeZoom(zoom);
}
return MapControlResult.ERROR;
}
@Override
public void changeMapMode( EnumMapUI mode ) {
public void changeMapMode(EnumMapUI mode) {
initDelegate();
if ( mDelegate != null ) {
Logger.d( TAG, "set type: %s", mode.name() );
mDelegate.changeMapMode( mode );
if (mDelegate != null) {
Logger.d(TAG, "set type: %s", mode.name());
mDelegate.changeMapMode(mode);
}
}
@Override
public void moveToCenter( MogoLatLng latLng, boolean animate ) {
public void moveToCenter(MogoLatLng latLng, boolean animate) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.moveToCenter( latLng, animate );
if (mDelegate != null) {
mDelegate.moveToCenter(latLng, animate);
}
}
@Override
public void showMyLocation( boolean visible ) {
public void showMyLocation(boolean visible) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.showMyLocation( visible );
if (mDelegate != null) {
mDelegate.showMyLocation(visible);
}
}
@Override
public void emphasizeMyLocation() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
mDelegate.emphasizeMyLocation();
}
}
@Override
public void showMyLocation( View view ) {
public void showMyLocation(View view) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.showMyLocation( view );
if (mDelegate != null) {
mDelegate.showMyLocation(view);
}
}
@Override
public void recoverLockMode() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
mDelegate.recoverLockMode();
}
}
@@ -135,31 +134,31 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void loseLockMode() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
mDelegate.loseLockMode();
}
}
@Override
public void setLockZoom( int var1 ) {
public void setLockZoom(int var1) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setLockZoom( var1 );
if (mDelegate != null) {
mDelegate.setLockZoom(var1);
}
}
@Override
public void displayOverview( Rect bounds ) {
public void displayOverview(Rect bounds) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.displayOverview( bounds );
if (mDelegate != null) {
mDelegate.displayOverview(bounds);
}
}
@Override
public float getScalePerPixel() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getScalePerPixel();
}
return 0;
@@ -168,7 +167,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public float getZoomLevel() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getZoomLevel();
}
return 0;
@@ -177,7 +176,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
}
@@ -187,7 +186,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getCameraNorthEastPosition() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getCameraNorthEastPosition();
}
return null;
@@ -196,7 +195,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getCameraSouthWestPosition() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getCameraSouthWestPosition();
}
return null;
@@ -205,75 +204,75 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getWindowCenterLocation() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getWindowCenterLocation();
}
return null;
}
@Override
public void setPointToCenter( double mapCenterX, double mapCenterY ) {
public void setPointToCenter(double mapCenterX, double mapCenterY) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setPointToCenter( mapCenterX, mapCenterY );
if (mDelegate != null) {
mDelegate.setPointToCenter(mapCenterX, mapCenterY);
}
}
@Override
public Point getLocationPointInScreen( MogoLatLng latLng ) {
public Point getLocationPointInScreen(MogoLatLng latLng) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getLocationPointInScreen( latLng );
if (mDelegate != null) {
return mDelegate.getLocationPointInScreen(latLng);
}
return null;
}
@Override
public MogoLatLng getLocationMogoLatLngInScreen( Point point ) {
public MogoLatLng getLocationMogoLatLngInScreen(Point point) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getLocationMogoLatLngInScreen( point );
if (mDelegate != null) {
return mDelegate.getLocationMogoLatLngInScreen(point);
}
return null;
}
@Override
public void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator, long duration ) {
public void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator, long duration) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.startJumpAnimation( marker, high, interpolator, duration );
if (mDelegate != null) {
mDelegate.startJumpAnimation(marker, high, interpolator, duration);
}
}
@Override
public void setRenderFps( int fps ) {
public void setRenderFps(int fps) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setRenderFps( fps );
if (mDelegate != null) {
mDelegate.setRenderFps(fps);
}
}
@Override
public void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition ) {
public void showBounds(String tag, MogoLatLng carPosition, List<MogoLatLng> lonLats, Rect bound, boolean lockCarPosition) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.showBounds( tag, carPosition, lonLats, bound, lockCarPosition );
if (mDelegate != null) {
mDelegate.showBounds(tag, carPosition, lonLats, bound, lockCarPosition);
}
}
@Override
public void forceRender() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
mDelegate.forceRender();
}
}
@Override
public float calculateLineDistance( MogoLatLng p1, MogoLatLng p2 ) throws Exception {
public float calculateLineDistance(MogoLatLng p1, MogoLatLng p2) throws Exception {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.calculateLineDistance( p1, p2 );
if (mDelegate != null) {
return mDelegate.calculateLineDistance(p1, p2);
}
return 0;
}
@@ -281,67 +280,72 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public EnumMapUI getCurrentUiMode() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getCurrentUiMode();
}
return null;
}
@Override
public void changeMyLocation( Location location ) {
public void changeMyLocation(Location location) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.changeMyLocation( location );
if (mDelegate != null) {
mDelegate.changeMyLocation(location);
}
}
@Override
public boolean isCarLocked() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.isCarLocked();
}
return false;
}
@Override
public void setCarCursorOption( CarCursorOption option ) {
public void setCarCursorOption(CarCursorOption option) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setCarCursorOption( option );
if (mDelegate != null) {
mDelegate.setCarCursorOption(option);
}
}
@Override
public MapCameraPosition getMapCameraPosition() {
initDelegate();
if ( mDelegate != null ) {
if (mDelegate != null) {
return mDelegate.getMapCameraPosition();
}
return null;
}
@Override
public void changeBearing( float bearing ) {
public void changeBearing(float bearing) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.changeBearing( bearing );
if (mDelegate != null) {
mDelegate.changeBearing(bearing);
}
}
@Override
public void rtkEnable( boolean enable ) {
public long getTileId(double lon, double lat) {
return mDelegate.getTileId(lon, lat);
}
@Override
public void rtkEnable(boolean enable) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.rtkEnable( enable );
if (mDelegate != null) {
mDelegate.rtkEnable(enable);
}
}
@Override
public void syncLocation2Map( JSONObject data ) {
public void syncLocation2Map(JSONObject data) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.syncLocation2Map( data );
if (mDelegate != null) {
mDelegate.syncLocation2Map(data);
}
}
@@ -351,42 +355,42 @@ public class MogoMapUIController implements IMogoMapUIController {
}
private void initDelegate() {
if ( mDelegate == null ) {
if (mDelegate == null) {
mDelegate = MogoMapDelegateFactory.getMapUIControllerDelegate();
}
}
@Override
public void openVrMode( boolean zoomGestureEnable ) {
public void openVrMode(boolean zoomGestureEnable) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.openVrMode( zoomGestureEnable );
if (mDelegate != null) {
mDelegate.openVrMode(zoomGestureEnable);
}
}
@Override
public double[] matchRoad( String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK ) {
public double[] matchRoad(String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.matchRoad( id, lon, lat, angle, isGpsLocation, isRTK );
if (mDelegate != null) {
return mDelegate.matchRoad(id, lon, lat, angle, isGpsLocation, isRTK);
}
return null;
}
@Override
public String getMarkerInfoResName( String speedVal ) {
public String getMarkerInfoResName(String speedVal) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getMarkerInfoResName( speedVal );
if (mDelegate != null) {
return mDelegate.getMarkerInfoResName(speedVal);
}
return null;
}
@Override
public void setMarkerInfoResName( String speedVal, String val ) {
public void setMarkerInfoResName(String speedVal, String val) {
initDelegate();
if ( mDelegate != null ) {
mDelegate.setMarkerInfoResName( speedVal, val );
if (mDelegate != null) {
mDelegate.setMarkerInfoResName(speedVal, val);
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.module.common.uploadintime;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.realtime.entity.CloudLocationInfo;
import com.mogo.utils.logger.Logger;
@@ -98,6 +99,7 @@ class SnapshotLocationController {
cloudLocationInfo.setSpeed( speed );
cloudLocationInfo.setSatelliteTime( satelliteTime );
cloudLocationInfo.setSystemTime( systemTime );
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon,lat)));
mLastLocationInfo = cloudLocationInfo;
mMachineCacheList.add( cloudLocationInfo );

View File

@@ -8,6 +8,7 @@ import android.location.LocationManager;
import android.os.Bundle;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.uploadintime.SnapshotLocationController;
import com.mogo.realtime.entity.CloudLocationInfo;
import com.mogo.utils.logger.Logger;
@@ -29,77 +30,79 @@ public class MogoRTKLocation {
}
public void init() {
locationManager = ( LocationManager ) AbsMogoApplication.getApp().getApplicationContext().getSystemService( Context.LOCATION_SERVICE );
String provider = locationManager.getBestProvider( getCriteria(), true );
Logger.d( TAG, "init provider : " + provider );
if ( locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) {
locationManager = (LocationManager) AbsMogoApplication.getApp().getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
String provider = locationManager.getBestProvider(getCriteria(), true);
Logger.d(TAG, "init provider : " + provider);
if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
try {
locationManager.requestLocationUpdates( provider, 0, 0, locationListener );
Location location = locationManager.getLastKnownLocation( provider );
if ( location != null ) {
Logger.i( TAG, "location : " + location.toString() );
locationManager.requestLocationUpdates(provider, 0, 0, locationListener);
Location location = locationManager.getLastKnownLocation(provider);
if (location != null) {
Logger.i(TAG, "location : " + location.toString());
}
} catch ( Exception e ) {
} catch (Exception e) {
e.printStackTrace();
Logger.d( TAG, "RTK LocationManager requestLocationUpdates has Exception : " + e.getMessage() );
Logger.d(TAG, "RTK LocationManager requestLocationUpdates has Exception : " + e.getMessage());
}
} else {
Logger.d( TAG, "RTK LocationManager Provider GPS_PROVIDER unable" );
Logger.d(TAG, "RTK LocationManager Provider GPS_PROVIDER unable");
}
}
private Criteria getCriteria() {
Criteria criteria = new Criteria();
criteria.setAccuracy( Criteria.ACCURACY_FINE ); //高精
criteria.setAltitudeRequired( false );
criteria.setBearingRequired( true );
criteria.setSpeedRequired( true );
criteria.setPowerRequirement( Criteria.POWER_LOW );
criteria.setAccuracy(Criteria.ACCURACY_FINE); //高精
criteria.setAltitudeRequired(false);
criteria.setBearingRequired(true);
criteria.setSpeedRequired(true);
criteria.setPowerRequirement(Criteria.POWER_LOW);
return criteria;
}
private final LocationListener locationListener = new LocationListener() {
@Override
public void onLocationChanged( Location location ) {
if ( location != null ) {
public void onLocationChanged(Location location) {
if (location != null) {
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
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() );
cloudLocationInfo.setSatelliteTime( location.getTime() );
cloudLocationInfo.setSystemTime( System.currentTimeMillis() );
SnapshotLocationController.getInstance().syncLocationInfo( cloudLocationInfo );
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());
cloudLocationInfo.setSatelliteTime(location.getTime());
cloudLocationInfo.setSystemTime(System.currentTimeMillis());
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
.getTileId(location.getLongitude(), location.getLatitude())));
SnapshotLocationController.getInstance().syncLocationInfo(cloudLocationInfo);
}
} else {
Logger.e( TAG, "location == null" );
Logger.e(TAG, "location == null");
}
}
@Override
public void onStatusChanged( String provider, int status, Bundle extras ) {
Logger.d( TAG, "onStatusChanged status: " + status );
public void onStatusChanged(String provider, int status, Bundle extras) {
Logger.d(TAG, "onStatusChanged status: " + status);
}
@Override
public void onProviderEnabled( String provider ) {
Logger.d( TAG, "onProviderEnabled" );
public void onProviderEnabled(String provider) {
Logger.d(TAG, "onProviderEnabled");
}
@Override
public void onProviderDisabled( String provider ) {
Logger.d( TAG, "onProviderEnabled" );
public void onProviderDisabled(String provider) {
Logger.d(TAG, "onProviderEnabled");
}
};
public void stop() {
Logger.d( TAG, "stop RTK Location" );
if ( locationManager != null && locationListener != null ) {
locationManager.removeUpdates( locationListener );
Logger.d(TAG, "stop RTK Location");
if (locationManager != null && locationListener != null) {
locationManager.removeUpdates(locationListener);
} else {
Logger.d( TAG, "stop failed , reason : loc" + locationManager + " , or loc listener: " + locationListener + " is null" );
Logger.d(TAG, "stop failed , reason : loc" + locationManager + " , or loc listener: " + locationListener + " is null");
}
}
}

View File

@@ -9,7 +9,7 @@ import com.mogo.module.v2x.listener.V2XMessageListener_401009;
import com.mogo.module.v2x.listener.V2XMessageListener_401010;
import com.mogo.module.v2x.listener.V2XMessageListener_401011;
import com.mogo.module.v2x.listener.V2XMessageListener_401012;
import com.mogo.module.v2x.listener.V2XMessageListener_401019;
import com.mogo.module.v2x.listener.V2XMessageListener_401020;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -33,7 +33,7 @@ public class V2XSocketManager {
private V2XMessageListener_401007 v2XMessageListener_401007;
private V2XMessageListener_401009 v2XMessageListener_401009;
private V2XMessageListener_401010 v2XMessageListener_401010;
private V2XMessageListener_401019 v2XMessageListener_401019;
private V2XMessageListener_401020 mV2XMessageListener_401020;
private V2XSocketManager() {
@@ -112,10 +112,10 @@ public class V2XSocketManager {
.getMoGoSocketManager()
.unregisterOnMessageListener(401009, v2XMessageListener_401009);
}
if (v2XMessageListener_401019 != null) {
if (mV2XMessageListener_401020 != null) {
V2XServiceManager
.getMoGoSocketManager()
.unregisterOnMessageListener(401019, v2XMessageListener_401019);
.unregisterOnMessageListener(401019, mV2XMessageListener_401020);
}
}
@@ -231,13 +231,13 @@ public class V2XSocketManager {
* * 最优路线推荐
*/
public void register401019() {
v2XMessageListener_401019 = new V2XMessageListener_401019();
mV2XMessageListener_401020 = new V2XMessageListener_401020();
// 道路事件,在线车辆绘制
V2XServiceManager
.getMoGoSocketManager()
.registerOnMessageListener(
401019,
v2XMessageListener_401019
401020,
mV2XMessageListener_401020
);
}

View File

@@ -21,7 +21,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* @description 车路云场景预警-云下发数据监听 最优路线推荐
* @since: 2021/4/13
*/
public class V2XMessageListener_401019 implements IMogoOnMessageListener<V2XOptimalRouteDataRes> {
public class V2XMessageListener_401020 implements IMogoOnMessageListener<V2XOptimalRouteDataRes> {
@Override
public Class target() {
return V2XOptimalRouteDataRes.class;
@@ -29,7 +29,7 @@ public class V2XMessageListener_401019 implements IMogoOnMessageListener<V2XOpti
@Override
public void onMsgReceived(V2XOptimalRouteDataRes message) {
Logger.i(MODULE_NAME, "V2XMessageListener_401019" + message);
Logger.i(MODULE_NAME, "V2XMessageListener_401020" + message);
// 将接收到的数据转换成最优车道推荐的场景数据
if (message != null

View File

@@ -55,7 +55,7 @@ public class V2XVoiceCallLiveCarWindow extends V2XBasWindow
: R.layout.window_see_carlive_video, this);
CarZegoLiveVideoView mV2XCarLiveVideoView = findViewById(R.id.videoPlayer);
tvCountDown = findViewById(R.id.tvCountDown);
ImageView ivLiveVideoClose = findViewById(R.id.liveVideoClose);
// ImageView ivLiveVideoClose = findViewById(R.id.liveVideoClose);
ivVideoPlayingSign = findViewById(R.id.ivVideoPlayingSign);
mV2XCarLiveVideoView.addOnVideoStatusChangeListener(videoPlaying -> {
isVideoPlay = videoPlaying;
@@ -65,7 +65,7 @@ public class V2XVoiceCallLiveCarWindow extends V2XBasWindow
stopCountDown();
}
});
ivLiveVideoClose.setOnClickListener(v -> close());
// ivLiveVideoClose.setOnClickListener(v -> close());
}
@Override

View File

@@ -109,8 +109,6 @@ public class CarZegoLiveVideoView extends RoundLayout {
if (!TextUtils.isEmpty(liveSn)) {
CarZegoLiveVideoView.this.liveSn = liveSn;
}
mLoading.setVisibility(VISIBLE);
mClLoadError.setVisibility(GONE);
refreshStatusToListener(true);
mLoading.setVisibility(GONE);
mClLoadError.setVisibility(GONE);

View File

@@ -121,7 +121,7 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
/**
* 开始直播
*
* @param carLiveInfo 直播的车机,如果没有直播的地址需要重新获取最新的直播地址
* @param carLiveInfo 直播数据
*/
public void startLive(MarkerCarInfo.CarLiveInfo carLiveInfo) {
// 进行直播播放
@@ -131,36 +131,6 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
setCarLiveInfo(carLiveInfo);
playLiveVideo(carLiveInfo);
}
// 根据SN重新获取直播流地址
else {
// V2XServiceManager
// .getV2XRefreshModel()
// .livePush(new V2XRefreshCallback<V2XLivePushVoRes>() {
// @Override
// public void onSuccess(V2XLivePushVoRes result) {
// Logger.e(MODULE_NAME, "从服务端获取最新直播信息:" + GsonUtil.jsonFromObject(result));
// mClLoadError.setVisibility(GONE);
// mClLoadError.setVisibility(GONE);
// try {
// MarkerCarInfo.CarLiveInfo carRealLiveInfo = new MarkerCarInfo.CarLiveInfo();
// carRealLiveInfo.setVideoUrl(result.getResult().getPlayUrl().getRtmp());
// carRealLiveInfo.setVideoSn(carLiveInfo.getVideoSn());
// carRealLiveInfo.setVideoChannel(result.getResult().getVideoChannel());
// setCarLiveInfo(carLiveInfo);
// playLiveVideo(carRealLiveInfo);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
//
// @Override
// public void onFail(String msg) {
// Logger.e(MODULE_NAME, "播放器:" + msg);
// mLoading.setVisibility(GONE);
// mClLoadError.setVisibility(VISIBLE);
// }
// }, carLiveInfo.getVideoSn(), 0);
}
}
}
@@ -212,26 +182,6 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
}
}
/**
* 刷新直播心跳
*
* @param carLiveInfo 直播info
*/
private void startHeartLive(MarkerCarInfo.CarLiveInfo carLiveInfo) {
try {
if (carLiveInfo != null && !TextUtils.isEmpty(carLiveInfo.getVideoSn())
&& !TextUtils.isEmpty(carLiveInfo.getVideoChannel())) {
V2XServiceManager
.getV2XRefreshModel()
.refreshHeartBeat(carLiveInfo.getVideoSn(),
carLiveInfo.getVideoChannel(),
null);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void stopLive(MarkerCarInfo.CarLiveInfo carLiveInfo) {
try {
Logger.w(MODULE_NAME, "心跳:关闭直播...");

View File

@@ -30,8 +30,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone"
tools:visibility="visible">
android:visibility="gone">
<ImageView
android:id="@+id/ivErrorIcon"

View File

@@ -20,5 +20,6 @@
android:layout_marginTop="@dimen/dp_20"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
android:src="@drawable/module_v2x_vr_close" />
</RelativeLayout>

View File

@@ -20,6 +20,7 @@
android:layout_marginTop="@dimen/dp_20"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
android:src="@drawable/module_v2x_vr_close" />
</RelativeLayout>

View File

@@ -1,8 +1,10 @@
package com.mogo.service.impl.adas;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.commons.utils.MortonCode;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.adas.entity.ADASWarnMessage;
import com.zhidao.autopilotservice.model.AdasAIDLOwnerCarRectModel;
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
@@ -10,68 +12,71 @@ import com.zhidao.support.adas.high.bean.WarnMessageInfo;
import java.util.ArrayList;
import java.util.List;
public
/*
* @author congtaowang
* @since 2020/10/25
*
* 对象转换类
*/
class AdasObjectUtils {
public class AdasObjectUtils {
public static ADASWarnMessage fromAdasObject( WarnMessageInfo info ) {
if ( info == null ) {
public static ADASWarnMessage fromAdasObject(WarnMessageInfo info) {
if (info == null) {
return null;
}
ADASWarnMessage warnMessage = new ADASWarnMessage();
warnMessage.content = info.getContent();
warnMessage.level = info.getLevel();
try {
warnMessage.type = Integer.parseInt( info.getType() );
} catch ( NumberFormatException e ) {
warnMessage.type = Integer.parseInt(info.getType());
} catch (NumberFormatException e) {
return null;
}
warnMessage.value = info.getValue();
return warnMessage;
}
public static List<ADASRecognizedResult> regroupData(List< AdasAIDLOwnerCarRectModel > datums ) {
if ( datums == null || datums.isEmpty() ) {
public static List<ADASRecognizedResult> regroupData(List<AdasAIDLOwnerCarRectModel> datums) {
if (datums == null || datums.isEmpty()) {
return null;
}
List< ADASRecognizedResult > recognizedListResults = new ArrayList<>();
for ( AdasAIDLOwnerCarRectModel model : datums ) {
if ( model == null ) {
List<ADASRecognizedResult> recognizedListResults = new ArrayList<>();
for (AdasAIDLOwnerCarRectModel model : datums) {
if (model == null) {
continue;
}
ADASRecognizedResult recognizedListResult = fromAdasObject( model );
if ( recognizedListResult != null ) {
recognizedListResults.add( recognizedListResult );
ADASRecognizedResult recognizedListResult = fromAdasObject(model);
if (recognizedListResult != null) {
recognizedListResults.add(recognizedListResult);
}
}
return recognizedListResults;
}
public static ADASRecognizedResult fromAdasObject( AdasAIDLOwnerCarRectModel model ) {
if ( model == null ) {
public static ADASRecognizedResult fromAdasObject(AdasAIDLOwnerCarRectModel model) {
if (model == null) {
return null;
}
ADASRecognizedResult result = new ADASRecognizedResult();
result.uuid = model.getUuid();
result.lat = model.getLat();
result.lon = model.getLon();
result.type = Integer.parseInt( model.getType() );
result.type = Integer.parseInt(model.getType());
result.heading = model.getHeading();
result.systemTime = Long.parseLong( model.getSystemTime() );
result.satelliteTime = Long.parseLong( model.getSatelliteTime() );
result.systemTime = Long.parseLong(model.getSystemTime());
result.satelliteTime = Long.parseLong(model.getSatelliteTime());
result.alt = model.getAlt();
result.color = model.getColor();
result.speed = model.getSpeed();
result.carId = model.getCarId();
result.dataAccuracy = model.dataAccuracy;
result.distance = model.distance;
result.mortonCode = MortonCode.wrapEncodeMorton( result.lon, result.lat );
result.mortonCode = MortonCode.wrapEncodeMorton(result.lon, result.lat);
IMogoMapUIController mogoMapUIController = ARouter.getInstance().navigation(IMogoServiceApis.class).getMapServiceApi().getMapUIController();
if (mogoMapUIController != null) {
result.tileId = String.valueOf(mogoMapUIController.getTileId(result.lon, result.lat));
}
return result;
}
}

View File

@@ -24,7 +24,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
*/
@Route(path = MogoServicePaths.PATH_V2X_FRONT_CRASH_WARNING)
public class V2XManager implements IV2XProvider {
private Map<String, CopyOnWriteArrayList<IV2XListener>> mListeners = new ConcurrentHashMap<>();
private final Map<String, CopyOnWriteArrayList<IV2XListener>> mListeners = new ConcurrentHashMap<>();
@Override
public void registerIntentListener(String intent, IV2XListener listener) {
@@ -50,9 +50,7 @@ public class V2XManager implements IV2XProvider {
public void warningChangedForListenerWithDirection(int direction, String command) {
List<IV2XListener> listeners = mListeners.get(command);
if (listeners != null && !listeners.isEmpty()) {
Iterator<IV2XListener> iterator = listeners.iterator();
while (iterator.hasNext()) {
IV2XListener listener = iterator.next();
for (IV2XListener listener : listeners) {
if (listener != null) {
listener.warningChangedWithDirection(direction);
}