Merge branch 'dev2_aiSdk' of http://gitlab.zhidaoauto.com/ecos/yycp-service/Launcher into dev2_aiSdk
This commit is contained in:
@@ -42,6 +42,8 @@ dependencies {
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.accountsdk
|
||||
api rootProject.ext.dependencies.mogoaicloudrealtime
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
api rootProject.ext.dependencies.ttsbase
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
package com.mogo.commons.data;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description adas识别数据需要转换一下
|
||||
* @since 2021/4/23
|
||||
*/
|
||||
public class ADASRecognizedResultConvert {
|
||||
|
||||
/**
|
||||
* 识别物体类型
|
||||
*/
|
||||
public int type;
|
||||
|
||||
/**
|
||||
* 识别物体唯一标识
|
||||
*/
|
||||
public String uuid;
|
||||
|
||||
/**
|
||||
* 红绿灯颜色
|
||||
*/
|
||||
public String color;
|
||||
|
||||
/**
|
||||
* 车ID
|
||||
*/
|
||||
public String carId;
|
||||
|
||||
/**
|
||||
* 识别物体的纬度
|
||||
*/
|
||||
public double lat;
|
||||
|
||||
/**
|
||||
* 识别物体的经度
|
||||
*/
|
||||
public double lon;
|
||||
|
||||
/**
|
||||
* 车头朝向
|
||||
*/
|
||||
public double heading;
|
||||
|
||||
/**
|
||||
* 系统时间
|
||||
*/
|
||||
public long systemTime;
|
||||
|
||||
/**
|
||||
* 定位卫星时间
|
||||
*/
|
||||
public long satelliteTime;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
public double alt;
|
||||
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
public double speed;
|
||||
|
||||
/**
|
||||
* 莫顿码
|
||||
*/
|
||||
public long mortonCode;
|
||||
|
||||
/**
|
||||
* 实际距离
|
||||
* 使用distanceX和distanceY计算
|
||||
*/
|
||||
public double distance;
|
||||
|
||||
/**
|
||||
* 数据来源精度
|
||||
* 0:普通定位
|
||||
* 1:高精定位
|
||||
*/
|
||||
public int dataAccuracy;
|
||||
|
||||
/**
|
||||
* 道路ID
|
||||
*/
|
||||
private String roadId;
|
||||
|
||||
/**
|
||||
* 车道ID-2D路段
|
||||
*/
|
||||
private String laneId;
|
||||
|
||||
/**
|
||||
* 车道号:中心线编号为0,中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3
|
||||
*/
|
||||
private int laneNum;
|
||||
|
||||
/**
|
||||
* 限速
|
||||
*/
|
||||
private double rateLimiting;
|
||||
|
||||
/**
|
||||
* 车道宽度
|
||||
*/
|
||||
private double roadWidth;
|
||||
}
|
||||
@@ -50,6 +50,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.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -1044,7 +1045,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(String result) {
|
||||
//liyz
|
||||
public void setAdasRecognizedResult(ADASRecognizedResult result) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,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.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -817,7 +818,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(String result) {
|
||||
//liyz
|
||||
public void setAdasRecognizedResult(ADASRecognizedResult result) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,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.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
@@ -300,7 +301,7 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(String result) {
|
||||
public void setAdasRecognizedResult(ADASRecognizedResult result) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setAdasRecognizedResult(result);
|
||||
}
|
||||
|
||||
@@ -16,8 +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.data.ADASRecognizedResultConvert;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
@@ -35,6 +33,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.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
@@ -288,15 +287,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
}
|
||||
|
||||
private ADASRecognizedResultConvert mAdasResultConvert;
|
||||
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(String result) {
|
||||
Log.d("liyz", "------- setAdasRecognizedResult ------>");
|
||||
mAdasResultConvert = GsonUtil.objectFromJson(result, ADASRecognizedResultConvert.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrafficEnabled(boolean visible) {
|
||||
if (checkAMapView()) {
|
||||
@@ -773,23 +763,35 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
if (mSelfMarker == null) { //TODO mAdasResultConvert
|
||||
Log.d("liyz", "-------1------>");
|
||||
try {
|
||||
mSelfMarker = mMapView.getMapAutoViewHelper().getMyLocationStyle().getSelfMarker();
|
||||
mSelfMarker.setInfoWindowEnable(true);
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} else {
|
||||
Log.d("liyz", "-------2------>");
|
||||
// mSelfMarker.marker3DIcon(R.raw.people);
|
||||
// } else {
|
||||
// WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
// mSelfMarker.marker3DIcon(R.raw.people);
|
||||
// }, 10000);
|
||||
|
||||
// if (mAdasResult.type == 1) { //通过不同的方向类型来改变车模,目前暂定三种模型,还未定
|
||||
// Log.d("liyz", "-------1------>")
|
||||
// mSelfMarker.marker3DIcon(R.raw.people);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
showSelfSpeed(location.getSpeed());
|
||||
}
|
||||
|
||||
private ADASRecognizedResult mAdasResult;
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(ADASRecognizedResult result) {
|
||||
mAdasResult = result;
|
||||
}
|
||||
|
||||
|
||||
private TextView mSpeedView = null;
|
||||
private int mLastYOffset = 20;
|
||||
|
||||
|
||||
@@ -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.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
|
||||
import org.json.JSONObject;
|
||||
@@ -359,7 +360,7 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(String result) {
|
||||
public void setAdasRecognizedResult(ADASRecognizedResult result) {
|
||||
if (mClient != null) {
|
||||
mClient.setAdasRecognizedResult(result);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.annotation.Nullable;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -236,7 +237,7 @@ public interface IMogoMapUIController {
|
||||
*/
|
||||
void changeBearing( float bearing );
|
||||
|
||||
void setAdasRecognizedResult(String result);
|
||||
void setAdasRecognizedResult(ADASRecognizedResult result);
|
||||
|
||||
/**
|
||||
* 获取瓦片id
|
||||
|
||||
@@ -12,6 +12,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.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONObject;
|
||||
@@ -403,7 +404,7 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(String result) {
|
||||
public void setAdasRecognizedResult(ADASRecognizedResult result) {
|
||||
initDelegate();
|
||||
if (mDelegate != null) {
|
||||
mDelegate.setAdasRecognizedResult(result);
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description adas识别数据需要转换一下
|
||||
* @since 2021/4/23
|
||||
*/
|
||||
public class ADASRecognizedResultConvert {
|
||||
|
||||
/**
|
||||
* 识别物体类型
|
||||
*/
|
||||
public int type;
|
||||
|
||||
/**
|
||||
* 识别物体唯一标识
|
||||
*/
|
||||
public String uuid;
|
||||
|
||||
/**
|
||||
* 红绿灯颜色
|
||||
*/
|
||||
public String color;
|
||||
|
||||
/**
|
||||
* 车ID
|
||||
*/
|
||||
public String carId;
|
||||
|
||||
/**
|
||||
* 识别物体的纬度
|
||||
*/
|
||||
public double lat;
|
||||
|
||||
/**
|
||||
* 识别物体的经度
|
||||
*/
|
||||
public double lon;
|
||||
|
||||
/**
|
||||
* 车头朝向
|
||||
*/
|
||||
public double heading;
|
||||
|
||||
/**
|
||||
* 系统时间
|
||||
*/
|
||||
public long systemTime;
|
||||
|
||||
/**
|
||||
* 定位卫星时间
|
||||
*/
|
||||
public long satelliteTime;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
public double alt;
|
||||
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
public double speed;
|
||||
|
||||
/**
|
||||
* 莫顿码
|
||||
*/
|
||||
public long mortonCode;
|
||||
|
||||
/**
|
||||
* 实际距离
|
||||
* 使用distanceX和distanceY计算
|
||||
*/
|
||||
public double distance;
|
||||
|
||||
/**
|
||||
* 数据来源精度
|
||||
* 0:普通定位
|
||||
* 1:高精定位
|
||||
*/
|
||||
public int dataAccuracy;
|
||||
|
||||
/**
|
||||
* 道路ID
|
||||
*/
|
||||
private String roadId;
|
||||
|
||||
/**
|
||||
* 车道ID-2D路段
|
||||
*/
|
||||
private String laneId;
|
||||
|
||||
/**
|
||||
* 车道号:中心线编号为0,中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3
|
||||
*/
|
||||
private int laneNum;
|
||||
|
||||
/**
|
||||
* 限速
|
||||
*/
|
||||
private double rateLimiting;
|
||||
|
||||
/**
|
||||
* 车道宽度
|
||||
*/
|
||||
private double roadWidth;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = "/service/base/info" )
|
||||
@Route(path = "/service/base/info")
|
||||
class MogoMainService extends Service implements IMogoLocationListener {
|
||||
|
||||
private static final String TAG = "MogoMainService";
|
||||
@@ -39,10 +39,10 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
Logger.d( TAG, "基本服务启动" );
|
||||
Logger.d(TAG, "基本服务启动");
|
||||
mServiceApis = MogoApisHandler.getInstance().getApis();
|
||||
initAndStartLocation();
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
loadBaseModules();
|
||||
startTanluService();
|
||||
initADAS();
|
||||
@@ -56,53 +56,61 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind( Intent intent ) {
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand( Intent intent, int flags, int startId ) {
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private void initAndStartLocation() {
|
||||
Logger.d( TAG, "开始定位" );
|
||||
mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() );
|
||||
mLocationClient.addLocationListener( this );
|
||||
mLocationClient.start( 2_000L );
|
||||
Logger.d(TAG, "开始定位");
|
||||
if (mServiceApis != null) {
|
||||
mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp());
|
||||
mLocationClient.addLocationListener(this);
|
||||
mLocationClient.start(2_000L);
|
||||
}
|
||||
}
|
||||
|
||||
private void initGpsSimulatorListener() {
|
||||
mServiceApis.getMapServiceApi().getNavi( this ).registerCarLocationChangedListener( EventDispatchCenter.getInstance() );
|
||||
if (mServiceApis != null) {
|
||||
mServiceApis.getMapServiceApi().getNavi(this).registerCarLocationChangedListener(EventDispatchCenter.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
private void loadBaseModules() {
|
||||
Logger.d( TAG, "加载基本模块" );
|
||||
Logger.d(TAG, "加载基本模块");
|
||||
MogoModulesManager.getInstance().loadBaseModule();
|
||||
}
|
||||
|
||||
private void startTanluService() {
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
Logger.d( TAG, "startTanluService ---------- " );
|
||||
mServiceApis.getTanluApi().startTanluService();
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
Logger.d(TAG, "startTanluService ---------- ");
|
||||
if (mServiceApis != null) {
|
||||
mServiceApis.getTanluApi().startTanluService();
|
||||
}
|
||||
}, 2_000L
|
||||
);
|
||||
}
|
||||
|
||||
private void initADAS() {
|
||||
mServiceApis.getAdasControllerApi().init( AbsMogoApplication.getApp() );
|
||||
if (mServiceApis != null) {
|
||||
mServiceApis.getAdasControllerApi().init(AbsMogoApplication.getApp());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
EventDispatchCenter.getInstance().onLocationChanged( location );
|
||||
public void onLocationChanged(MogoLocation location) {
|
||||
EventDispatchCenter.getInstance().onLocationChanged(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if ( mLocationClient != null ) {
|
||||
mLocationClient.removeLocationListener( this );
|
||||
if (mLocationClient != null) {
|
||||
mLocationClient.removeLocationListener(this);
|
||||
mLocationClient.stop();
|
||||
mLocationClient.destroy();
|
||||
mLocationClient = null;
|
||||
|
||||
@@ -271,8 +271,6 @@ public class MediaWindow implements MediaView{
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if (mWindowPlayPause != null){
|
||||
mWindowPlayPause.setImageResource(R.drawable.module_media_window_pop_pause);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
@@ -61,6 +62,7 @@ public class MarkerServiceHandler {
|
||||
private static IMogoFragmentManager sFragmentManager;
|
||||
private static ICarsChattingProvider sCarChatting;
|
||||
private static IV2XProvider sIV2XProvider;
|
||||
private static IMogoOverlayManager sIMogoOverlayManager;
|
||||
|
||||
// private static IMogoGpsSimulatorManager sGpsSimulatorManager;
|
||||
|
||||
@@ -77,6 +79,7 @@ public class MarkerServiceHandler {
|
||||
sMogoSocketManager = sApis.getSocketManagerApi( context );
|
||||
sMogoAnalytics = sApis.getAnalyticsApi();
|
||||
sMarkerManager = sMapService.getMarkerManager( context );
|
||||
sIMogoOverlayManager = sMapService.getOverlayManager(context);
|
||||
sNavi = sMapService.getNavi( context );
|
||||
sMapUIController = sMapService.getMapUIController();
|
||||
sLocationClient = sMapService.getSingletonLocationClient( context );
|
||||
@@ -87,7 +90,6 @@ public class MarkerServiceHandler {
|
||||
sADASController = sApis.getAdasControllerApi();
|
||||
sLauncher = sApis.getLauncherApi();
|
||||
sFragmentManager = sApis.getFragmentManagerApi();
|
||||
|
||||
sCarChatting = ( ICarsChattingProvider ) ARouter.getInstance().build( CallChattingProviderConstant.CAR_CALL_PROVIDER ).navigation( context );
|
||||
sIV2XProvider = sApis.getV2XListenerManager();
|
||||
|
||||
@@ -172,7 +174,15 @@ public class MarkerServiceHandler {
|
||||
return sCarChatting;
|
||||
}
|
||||
|
||||
// public static IMogoGpsSimulatorManager getGpsSimulatorManager() {
|
||||
public static IMogoOverlayManager getsIMogoOverlayManager() {
|
||||
return sIMogoOverlayManager;
|
||||
}
|
||||
|
||||
public static void setsIMogoOverlayManager(IMogoOverlayManager sIMogoOverlayManager) {
|
||||
MarkerServiceHandler.sIMogoOverlayManager = sIMogoOverlayManager;
|
||||
}
|
||||
|
||||
// public static IMogoGpsSimulatorManager getGpsSimulatorManager() {
|
||||
// return sGpsSimulatorManager;
|
||||
// }
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -16,6 +17,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
@@ -36,12 +38,15 @@ import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.common.utils.CloudPoiManager;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.polyline.LimberCollisionPolyline;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
@@ -62,6 +67,7 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -78,8 +84,7 @@ import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_
|
||||
public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
IMogoOnMessageListener< MarkerResponse >,
|
||||
IMogoBizActionDoneListener,
|
||||
IMogoADASControlStatusChangedListener,
|
||||
IMogoCarLocationChangedListener2 {
|
||||
IMogoADASControlStatusChangedListener {
|
||||
private static final String TAG = "MapMarkerManager";
|
||||
|
||||
private Context mContext;
|
||||
@@ -126,7 +131,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
CloudPoiManager.getInstance().updateFromConfig( context );
|
||||
MarkerServiceHandler.getActionManager().registerBizActionDoneListener( this );
|
||||
MarkerServiceHandler.getApis().getRegisterCenterApi().registerADASControlStatusChangedListener( TAG, this );
|
||||
MogoApisHandler.getInstance().getApis().getRegisterCenterApi().registerCarLocationChangedListener(TAG, this);
|
||||
|
||||
if ( CallChatApi.getInstance().getApiProvider() != null ) {
|
||||
CallChatApi.getInstance().getApiProvider().registerUserWindowStatusListener( TAG, mContext, new ICallChatResponse() {
|
||||
|
||||
@@ -162,83 +167,58 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
msg.sendToTarget();
|
||||
}
|
||||
} );
|
||||
|
||||
// adas 每隔一秒传递的数据
|
||||
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback( resultList -> {
|
||||
// 绘制近景识别到的车辆
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
|
||||
//绘制他车的线 liyz TODO
|
||||
|
||||
//添加自车的定位图标,碰撞只有一个预警 TODO
|
||||
ADASRecognizedResult result = null;
|
||||
for (int i = 0; i < resultList.size(); i++) {
|
||||
result = resultList.get(i);
|
||||
}
|
||||
//添加自车的定位图标,碰撞只有一个预警,还需要和adas 联调,还需要改 liyz
|
||||
// ADASRecognizedResult result = null;
|
||||
// for (int i = 0; i < resultList.size(); i++) {
|
||||
// result = resultList.get(i);
|
||||
// if (result.type) { //找出可能碰撞的车
|
||||
// result = resultList.get(i);
|
||||
// }
|
||||
|
||||
//通过这个传值 ADASRecognizedResult
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().setAdasRecognizedResult(GsonUtil.jsonFromObject(result));
|
||||
//绘制他车的线,从列表中查出可能碰撞的车的经纬度(没有或者只有一个),然后预设20米的长度
|
||||
//绘制碰撞的他车指引线,需要实时给数据更新 TODO
|
||||
// drawLimberCollisionPolyline(result);
|
||||
// }
|
||||
|
||||
// //通过这个传值到 AMapViewWrapper,根据数据更新自车的模型数据 ADASRecognizedResult
|
||||
// MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().setAdasRecognizedResult(result);
|
||||
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged2(Location latLng) {
|
||||
Log.d("liyz", "long =" + latLng.getLongitude() + "---lat = " + latLng.getLatitude());
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(latLng.getLatitude());
|
||||
location.setLon(latLng.getLongitude());
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setMarkerLocation(location);
|
||||
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA);
|
||||
|
||||
IMogoMarker marker = drawMarker(markerShowEntity);
|
||||
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
int resId = getModelRes(6);
|
||||
marker.use3DResource( resId );
|
||||
}, 10000);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLatLng latLng) {
|
||||
|
||||
}
|
||||
|
||||
public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.object(markerShowEntity)
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(getModelRes(6)); //TODO
|
||||
|
||||
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
|
||||
return marker;
|
||||
}
|
||||
|
||||
public int getModelRes(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
if (recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck) {
|
||||
return com.mogo.module.common.R.raw.othercar;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
|
||||
return com.mogo.module.common.R.raw.bus;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto) {
|
||||
return com.mogo.module.common.R.raw.motorbike;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdStopLine) {
|
||||
return com.mogo.module.common.R.raw.stopline;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdWarningArrows) {
|
||||
return com.mogo.module.common.R.raw.arraw;
|
||||
/**
|
||||
* 实时绘制连线
|
||||
* @param result
|
||||
*/
|
||||
private void drawLimberCollisionPolyline(ADASRecognizedResult result) {
|
||||
if (result != null) {
|
||||
IMogoPolyline polyLine = LimberCollisionPolyline.getInstance().getPolyLine();
|
||||
MogoLatLng startLatLng = new MogoLatLng(result.lat, result.lon);
|
||||
MogoLatLng endLatlng = Trigonometric.getNewLocation(startLatLng, 20, result.heading);
|
||||
Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat
|
||||
+ "终点" + endLatlng.lon + "," + endLatlng.lat + "--heading =" + result.heading);
|
||||
if (polyLine != null) {
|
||||
Log.d(TAG, "drawStopLine polyLine != null");
|
||||
polyLine.setPoints(Arrays.asList(startLatLng, endLatlng));
|
||||
} else {
|
||||
List<MogoLatLng> latLngs = new ArrayList<>();
|
||||
latLngs.add(startLatLng);
|
||||
latLngs.add(endLatlng);
|
||||
LimberCollisionPolyline.getInstance().draw((float) result.roadWidth, latLngs);
|
||||
}
|
||||
} else {
|
||||
LimberCollisionPolyline.getInstance().clearLine();
|
||||
}
|
||||
return com.mogo.module.common.R.raw.people;
|
||||
}
|
||||
|
||||
|
||||
private Handler mSnapshotHandler = new Handler( WorkThreadHandler.newInstance( "snapshot-thread" ).getLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.mogo.module.service.polyline;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 前车碰撞的画线
|
||||
* @since 2021/4/25
|
||||
*/
|
||||
public class LimberCollisionPolyline {
|
||||
|
||||
private volatile static LimberCollisionPolyline mInstance = null;
|
||||
|
||||
private IMogoPolyline mMoGoPolyline;
|
||||
// 连接线参数
|
||||
private MogoPolylineOptions mPolylineOptions;
|
||||
// 线路径集合
|
||||
private List<MogoLatLng> mPolylinePointList;
|
||||
|
||||
|
||||
public static LimberCollisionPolyline getInstance() {
|
||||
if (mInstance == null) {
|
||||
synchronized (LimberCollisionPolyline.class) {
|
||||
if (mInstance == null) {
|
||||
mInstance = new LimberCollisionPolyline();
|
||||
}
|
||||
}
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
protected LimberCollisionPolyline() {
|
||||
mPolylineOptions = new MogoPolylineOptions();
|
||||
// 绘制路径集合
|
||||
mPolylinePointList = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
public IMogoPolyline draw(float width, List<MogoLatLng> polylinePoint) {
|
||||
try {
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mPolylinePointList.clear();
|
||||
}
|
||||
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
// colors.add(0x0DE32F46);
|
||||
colors.add(0xD9E32F46);
|
||||
colors.add(0x0DE32F46);
|
||||
|
||||
// 线条粗细,渐变,渐变色值 TODO liyz 宽度需要传过来
|
||||
options.width(60).useGradient(true).colorValues(colors);
|
||||
for (int i = 0; i < polylinePoint.size(); i++) {
|
||||
options.add(polylinePoint.get(i));
|
||||
}
|
||||
// 绘制线的对象
|
||||
mMoGoPolyline = MarkerServiceHandler.getsIMogoOverlayManager().addPolyline(options);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return mMoGoPolyline;
|
||||
}
|
||||
|
||||
|
||||
public IMogoPolyline getPolyLine() {
|
||||
return mMoGoPolyline;
|
||||
}
|
||||
|
||||
public void clearLine() {
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mMoGoPolyline = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
*/
|
||||
public class V2XWaringManager {
|
||||
|
||||
List<MogoLatLng> lonLats = new ArrayList<>();
|
||||
private Context mContext;
|
||||
|
||||
private static V2XWaringManager mV2XWaringManager;
|
||||
@@ -111,7 +110,6 @@ public class V2XWaringManager {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,43 +149,6 @@ public class V2XWaringManager {
|
||||
String adasResult = (String) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
|
||||
//测试数据
|
||||
testData(adasResult);
|
||||
|
||||
// adas 每隔一秒传递的他车或行人数据,避免重复。
|
||||
// V2XServiceManager.getmIMogoADASController().addAdasRecognizedDataCallback(resultList -> {
|
||||
// // 处理他车车身变色,这个可以使用 TODO
|
||||
// AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
|
||||
//
|
||||
// // adas自车定位,显示红色碰撞预警图,以及解除碰撞
|
||||
// double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
|
||||
// double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
|
||||
// //需要把自车的经纬度前移到车头,然后打点红色的marker
|
||||
//
|
||||
// } );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加2d的碰撞 marker
|
||||
*
|
||||
* @param markerShowEntity
|
||||
* @return
|
||||
*/
|
||||
private IMogoMarker drawMarker2dResource(MarkerShowEntity markerShowEntity) {
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(markerShowEntity.getMarkerLocation().getLat(), markerShowEntity.getMarkerLocation().getLon());
|
||||
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 8, 180);
|
||||
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
|
||||
.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);
|
||||
|
||||
marker.setInfoWindowAdapter(new AheadCollisionWindow3DAdapter(mContext));
|
||||
marker.showInfoWindow();
|
||||
return marker;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user