opt
This commit is contained in:
@@ -31,4 +31,12 @@ public class MoGoV2XServicePaths {
|
||||
@Keep
|
||||
public static final String PATH_V2X_POLYLINE_MANAGER = "/v2xPolylineManager/api";
|
||||
|
||||
/**
|
||||
* V2X 道路事件与车辆的连接线
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_V2X_WARN_POLYLINE_MANAGER = "/v2xWarnPolylineManager/api";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.mogo.module.v2x.alarm.V2XCalculateServer;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XMarkerManager;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XPolylineManager;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager;
|
||||
import com.mogo.module.v2x.network.V2XRefreshModel;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
@@ -96,6 +97,7 @@ public class V2XServiceManager {
|
||||
private static IMoGoV2XMarkerManager moGoV2XMarkerManager;
|
||||
private static IMoGoV2XPolylineManager moGoV2XPolylineManager;
|
||||
private static IMoGoV2XStatusManager moGoV2XStatusManager;
|
||||
private static IMoGoWarnPolylineManager moGoWarnPolylineManager;
|
||||
|
||||
private V2XServiceManager() {
|
||||
|
||||
@@ -147,6 +149,8 @@ public class V2XServiceManager {
|
||||
|
||||
moGoV2XMarkerManager = (IMoGoV2XMarkerManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_MARKER_MANAGER).navigation(context);
|
||||
moGoV2XPolylineManager = (IMoGoV2XPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_POLYLINE_MANAGER).navigation(context);
|
||||
moGoWarnPolylineManager = (IMoGoWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER).navigation(context);
|
||||
|
||||
moGoV2XStatusManager = (IMoGoV2XStatusManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(context);
|
||||
}
|
||||
}
|
||||
@@ -239,6 +243,10 @@ public class V2XServiceManager {
|
||||
return moGoV2XPolylineManager;
|
||||
}
|
||||
|
||||
public static IMoGoWarnPolylineManager getMoGoWarnPolylineManager() {
|
||||
return moGoWarnPolylineManager;
|
||||
}
|
||||
|
||||
public static IMoGoV2XStatusManager getMoGoV2XStatusManager() {
|
||||
if (moGoV2XStatusManager == null) {
|
||||
moGoV2XStatusManager = (IMoGoV2XStatusManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(V2XUtils.getApp());
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.module.v2x.manager;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
|
||||
/**
|
||||
* 绘制可变宽度和渐变的线
|
||||
*/
|
||||
public interface IMoGoWarnPolylineManager extends IProvider {
|
||||
/**
|
||||
* 绘制连接线,目标车,与当前车辆间连线
|
||||
*
|
||||
* @param context
|
||||
* @param roadEventEntity
|
||||
*/
|
||||
void drawableWarnPolyline(Context context, V2XRoadEventEntity roadEventEntity);
|
||||
|
||||
/**
|
||||
* 移除连接线
|
||||
*/
|
||||
void clearLine();
|
||||
|
||||
IMogoPolyline getMogoWarnPolyline();
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.mogo.module.v2x.manager.impl;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.MoGoV2XServicePaths;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 当前车辆与道路事件的连接线
|
||||
*/
|
||||
@Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER)
|
||||
public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
private static final String TAG = "MoGoWarnPolylineManager";
|
||||
private static IMogoPolyline mMogoPolyline;
|
||||
|
||||
//TODO liyz
|
||||
@Override
|
||||
public void drawableWarnPolyline(Context context, V2XRoadEventEntity roadEventEntity) {
|
||||
try {
|
||||
if (mMogoPolyline != null) {
|
||||
mMogoPolyline.remove();
|
||||
}
|
||||
if ((V2XServiceManager.getMoGoV2XStatusManager().isRoadEventPOIShow()
|
||||
|| V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpPOIShow())
|
||||
&& V2XServiceManager.getV2XStatusManager().getTargetMoGoLatLng() != null) {
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
|
||||
switch (roadEventEntity.getPoiType()) {
|
||||
case V2XPoiTypeEnum.ALERT_TRAFFIC_LIGHT_SUGGEST:
|
||||
case V2XPoiTypeEnum.ALERT_TRAFFIC_LIGHT_WARNING:
|
||||
case V2XPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
case V2XPoiTypeEnum.ALERT_CAR_TROUBLE_WARNING + "":
|
||||
colors.add(0xFFFFA31A);
|
||||
colors.add(0xFFFFA31A);
|
||||
break;
|
||||
default:
|
||||
colors.add(0xFFE32F46);
|
||||
colors.add(0xFFE32F46);
|
||||
break;
|
||||
}
|
||||
|
||||
// 线条粗细,渐变,渐变色值
|
||||
options.width(10).useGradient(true).colorValues(colors);
|
||||
|
||||
// 当前车辆位置
|
||||
MogoLatLng carLocation = V2XServiceManager.getNavi().getCarLocation();
|
||||
if (carLocation != null) {
|
||||
options.add(carLocation);
|
||||
} else {
|
||||
options.add(V2XServiceManager.getV2XStatusManager().getLocation());
|
||||
}
|
||||
// 目标车辆位置
|
||||
options.add(V2XServiceManager.getV2XStatusManager().getTargetMoGoLatLng());
|
||||
|
||||
// 绘制线的对象
|
||||
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearLine() {
|
||||
if (mMogoPolyline != null) {
|
||||
mMogoPolyline.remove();
|
||||
mMogoPolyline = null;
|
||||
V2XServiceManager.getV2XStatusManager().setAlarmInfo(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 绘制连接线的对象
|
||||
*/
|
||||
@Override
|
||||
public IMogoPolyline getMogoWarnPolyline() {
|
||||
return mMogoPolyline;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user