wait to finish

This commit is contained in:
zhongchao
2022-11-10 10:54:57 +08:00
parent 7868bf626f
commit a836c31728
189 changed files with 780 additions and 4887 deletions

View File

@@ -1,9 +0,0 @@
package com.mogo.module.common.animation;
interface Animation {
void start();
void stop();
}

View File

@@ -1,70 +0,0 @@
package com.mogo.module.common.animation;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.View;
import android.widget.ProgressBar;
public class AnimationManager implements Animation {
private static final String TAG = "V2XAnimationManager";
private ProgressBar targetImageView;
private boolean isStarted = false;
private int mStartIndex = 0;
private final static int MSG_LOOP = 3004;
private long INTERVAL = 100L;
private Handler mHandler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case MSG_LOOP:
if (isStarted) {
// targetImageView.setImageResource( AnimationResources.loadingRes[mStartIndex++ % AnimationResources.loadingRes.length] );
mHandler.sendEmptyMessageDelayed(MSG_LOOP, INTERVAL);
}
break;
}
}
};
public void animationWithTarget(ProgressBar imageView, int[] resources, int duration) {
targetImageView = imageView;
INTERVAL = duration;
start();
}
@Override
synchronized public void start() {
isStarted = true;
mHandler.sendEmptyMessage(MSG_LOOP);
if (targetImageView != null) {
targetImageView.setVisibility(View.VISIBLE);
}
}
@Override
synchronized public void stop() {
isStarted = false;
mHandler.removeMessages(MSG_LOOP);
if (targetImageView != null) {
targetImageView.setVisibility(View.INVISIBLE);
}
}
public void soptWithError() {
stop();
if (targetImageView != null) {
targetImageView.setVisibility(View.VISIBLE);
}
}
public void release() {
stop();
}
}

View File

@@ -1,36 +0,0 @@
package com.mogo.module.common.animation;
import com.mogo.module.common.R;
public class AnimationResources {
public static final int loadingRes[] = {
// R.drawable.v_to_x_loading_car0000,
// R.drawable.v_to_x_loading_car0002,
// R.drawable.v_to_x_loading_car0004,
// R.drawable.v_to_x_loading_car0006,
// R.drawable.v_to_x_loading_car0008,
// R.drawable.v_to_x_loading_car0010,
// R.drawable.v_to_x_loading_car0012,
// R.drawable.v_to_x_loading_car0014,
// R.drawable.v_to_x_loading_car0016,
// R.drawable.v_to_x_loading_car0018,
// R.drawable.v_to_x_loading_car0020,
// R.drawable.v_to_x_loading_car0022,
// R.drawable.v_to_x_loading_car0024,
// R.drawable.v_to_x_loading_car0025,
// R.drawable.v_to_x_loading_car0027,
// R.drawable.v_to_x_loading_car0029,
// R.drawable.v_to_x_loading_car0031,
// R.drawable.v_to_x_loading_car0033,
// R.drawable.v_to_x_loading_car0035,
// R.drawable.v_to_x_loading_car0037,
// R.drawable.v_to_x_loading_car0039,
// R.drawable.v_to_x_loading_car0041,
// R.drawable.v_to_x_loading_car0043,
// R.drawable.v_to_x_loading_car0045,
// R.drawable.v_to_x_loading_car0047,
// R.drawable.v_to_x_loading_car0048,
};
}

View File

@@ -1,55 +0,0 @@
package com.mogo.module.common.animation;
import android.animation.TypeEvaluator;
import android.graphics.PointF;
/**
* 贝塞尔曲线估值器:计算动画的执行轨迹
*
* @params 传入贝塞尔曲线需要的四个点
* @return 通过计算返回贝塞尔曲线的坐标
*/
public class BezierEvaluator implements TypeEvaluator<PointF> {
private PointF point1;
private PointF point2;
public BezierEvaluator(PointF point1, PointF point2) {
this.point1 = point1;
this.point2 = point2;
}
@Override
public PointF evaluate(float t, PointF point0, PointF point3) {
PointF point = new PointF();
//t 取值为 [0,1]
/**
* 三阶贝塞尔公式
*
* B(t)=(1 - t)^3 P0
* + 3 t (1 - t)^2 P1
* + 3 t^2 (1 - t) P2
* + t^3 P3
*/
point.x = point0.x * (1 - t) * (1 - t) * (1 - t)
+ 3 * point1.x * t * (1 - t) * (1 - t)
+ 3 * point2.x * t * t * (1 - t)
+ point3.x * t * t * t;
/**
* 三阶贝塞尔公式
*
* B(t)=(1 - t)^3 P0
* + 3 t (1 - t)^2 P1
* + 3 t^2 (1 - t) P2
* + t^3 P3
*/
point.y = point0.y * (1 - t) * (1 - t) * (1 - t)
+ 3 * point1.y * t * (1 - t) * (1 - t)
+ 3 * point2.y * t * t * (1 - t)
+ point3.y * t * t * t;
return point;
}
}

View File

@@ -1,24 +0,0 @@
package com.mogo.module.common.animation;
import android.animation.ValueAnimator;
import android.graphics.PointF;
import android.view.View;
public class BezierListener implements ValueAnimator.AnimatorUpdateListener {
private View target;
public BezierListener(View target) {
this.target = target;
}
@Override
public void onAnimationUpdate(ValueAnimator animation) {
//这里获取到贝塞尔曲线计算出来的的x y值 赋值给view 这样就能让爱心随着曲线走啦
PointF pointF = (PointF) animation.getAnimatedValue();
target.setX(pointF.x);
target.setY(pointF.y);
// 这里偷个懒,顺便做一个alpha动画,这样alpha渐变也完成啦
target.setAlpha(1 - animation.getAnimatedFraction());
}
}

View File

@@ -1,68 +0,0 @@
package com.mogo.module.common.constants;
public enum AdasRecognizedType {
//背景
classIdBackground("background", 0),
//人
classIdPerson("person", 1),
//自行车
classIdBicycle("bicycle", 2),
//小轿车
classIdCar("car", 3),
//摩托车
classIdMoto("moto", 4),
//红绿灯
classIdTrafficSign("traffic_sign", 5),
//bus
classIdTrafficBus("traffic_bus", 6),
//truck
classIdTrafficTruck("traffic_truck", 8),
//stopLine
classIdStopLine("warning_stop_line", 9),
//预警箭头
classIdWarningArrows("warning_arrows", 10),
//未知物体
classIdUnKnow("unKnow", 100);
AdasRecognizedType(int code) {
this.code = code;
}
private String res = "";
private int code = -1;
AdasRecognizedType(String res, int code) {
this.res = res;
this.code = code;
}
public static AdasRecognizedType[] VAL = {
classIdBackground,//0
classIdPerson,
classIdBicycle,
classIdCar,
classIdMoto,
classIdTrafficSign,
classIdTrafficBus,
null,
classIdTrafficTruck,
classIdStopLine,
classIdWarningArrows,
classIdUnKnow,
};
public String getRes() {
return res;
}
public static AdasRecognizedType valueFrom(int code) {
if (code == 100) {
return classIdUnKnow;
}
if (code >= 0 && code < VAL.length) {
return VAL[code];
}
return null;
}
}

View File

@@ -1,51 +0,0 @@
package com.mogo.module.common.constants;
public
/**
* @author congtaowang
* @since 2020/10/28
*
* 描述
*/
class DataTypes {
/**
* 识别感知和云端感知数据全部标记为Marker融合数据
*/
public static final String TYPE_MARKER_MERGE = "TYPE_MARKER_MERGE";
/**
* adas识别数据Mock用
*/
public static final String TYPE_MARKER_ADAS = "TYPE_MARKER_ADAS";
/**
* 云端下发数据Mock用
*/
public static final String TYPE_MARKER_CLOUD_DATA = "TYPE_MARKER_CLOUD_DATA";
/**
* 云端下发识别目标物警告数据
*/
public static final String TYPE_MARKER_CLOUD_WARN_DATA = "TYPE_MARKER_CLOUD_WARN_DATA";
/**
* 云端下发停止线数据
*/
public static final String TYPE_MARKER_CLOUD_STOP_LINE_DATA = "TYPE_MARKER_CLOUD_STOP_LINE_DATA";
/**
* Push 事件场景 VR
*/
public static final String TYPE_MARKER_PUSH_DATA = "TYPE_MARKER_PUSH_DATA";
/**
*OBU 识别的交通元素
*/
public static final String TYPE_MARKER_OBU_DATA = "TYPE_MARKER_OBU_DATA";
/**
* 道路事件预警 水滴状道路事件类型替换为3D模型
*/
public static final String TYPE_MARKER_ROAD_WARNING_TYPE = "TYPE_MARKER_ROAD_WARNING_TYPE";
}

View File

@@ -1,28 +0,0 @@
package com.mogo.module.common.constants;
/**
* 通用接口请求host
*
* @author tong
*/
public class HostConst {
public static final String DEVA_HOST = "http://dzt-deva.zhidaozhixing.com";
public static final String LAUNCHER_SNAPSHOT_HOST = "http://dzt-launcherSnapshot.zhidaozhixing.com";
public static final String DATA_SERVICE_HOST = "http://dzt-dataService.zhidaozhixing.com";
public static final String REALTIME_LOCATION_HOST = "http://dzt-realtimeLocation.zhidaozhixing.com";
public static final String GEOFENCE_HOST = "http://dzt-geoFenceCarService.zhidaozhixing.com";
public static final String CARLIFE_HOST = "http://dzt-carlife.zhidaozhixing.com";
public static final String STRATEGY_PUSH_HOST = "http://dzt-strategyPush.zhidaozhixing.com";
public static final String CAMERA_STREAM_HOST = "http://dzt-smartTransportationAiCloud.zhidaozhixing.com";
public static final String OPEN_CAMERA_STREAM_HOST = "http://10.0.16.6:18080";
public static final String CITY_HOST = "http://dzt-city.zhidaozhixing.com";
public static final String SOCKET_CENTER_DOMAIN = "socketRegion";
// public static final String UPGRADE_APP_HOST_TEST = "http://10.0.200.12:32423?/";
public static final String UPGRADE_APP_HOST = "http://eagle-mis.zhidaozhixing.com/";
public static final String CMDB_HOST = "http://eagle-mis.zhidaozhixing.com/eagleEye-mis/cmdbapi/";
}

View File

@@ -1,9 +0,0 @@
package com.mogo.module.common.constants;
/**
* 数据库常量
*/
public class RoomConstants {
public static final String DB_NAME_V2X = "MoGoScenario.db";
public static final String TB_NAME_SCENARIO = "tb_travel_scenario";
}

View File

@@ -1,56 +0,0 @@
package com.mogo.module.common.dialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.module.common.R;
/**
* 浮在各种wm上面的dialog基类调用了window.setType
*
* @author tongchenfei
*/
public class BaseFloatDialog extends Dialog {
private static final String TAG = "BaseFloatDialog";
public BaseFloatDialog(@NonNull Context context) {
this(context, R.style.BaseFloatDialogStyle);
}
public BaseFloatDialog(@NonNull Context context, int themeResId) {
super(context, themeResId);
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD) {
addFlag();
}
}
private void addFlag() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
} else {
getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
}
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
| WindowManager.LayoutParams.FLAG_LOCAL_FOCUS_MODE);
}
@Override
public void show() {
CallerLogger.INSTANCE.d(TAG, "onShow====");
super.show();
}
@Override
public void dismiss() {
CallerLogger.INSTANCE.d( TAG, "onDismiss====");
super.dismiss();
}
}

View File

@@ -1,140 +0,0 @@
package com.mogo.module.common.dialog;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.widget.TextView;
import androidx.annotation.StringRes;
import com.mogo.module.common.R;
import com.mogo.module.common.wm.WindowManagerView;
/**
* @author congtaowang
* @since 2020-04-24
* <p>
* 显示在最上层的对话框
*/
public class WMDialog implements DialogInterface {
private WMDialogParams mParams;
private WindowManagerView mWindowManagerView;
private WMDialog( WMDialogParams params ) {
this.mParams = params;
mWindowManagerView = new WindowManagerView.Builder( mParams.mContext ).contentView( R.layout.module_commons_layout_wm_dialog ).build();
initViews();
}
public void show() {
mWindowManagerView.show();
}
private void initViews() {
TextView ok = mWindowManagerView.findViewById( R.id.module_commons_wm_dialog_button_ok );
TextView cancel = mWindowManagerView.findViewById( R.id.module_commons_wm_dialog_button_cancel );
TextView content = mWindowManagerView.findViewById( R.id.module_commons_wm_dialog_content );
ok.setText( mParams.mOkButtonText );
if ( mParams.mOnOkButtonClickListener != null ) {
ok.setOnClickListener( view -> {
if ( mParams.mOnOkButtonClickListener != null ) {
mParams.mOnOkButtonClickListener.onClick( WMDialog.this, DialogInterface.BUTTON_POSITIVE );
}
} );
}
cancel.setText( mParams.mCancelButtonText );
if ( mParams.mOnCancelButtonClickListener != null ) {
cancel.setOnClickListener( view -> {
if ( mParams.mOnCancelButtonClickListener != null ) {
mParams.mOnCancelButtonClickListener.onClick( WMDialog.this, DialogInterface.BUTTON_NEGATIVE );
}
} );
}
content.setText( mParams.mContent );
}
@Override
public void cancel() {
dismiss();
}
@Override
public void dismiss() {
mWindowManagerView.dismiss();
}
public boolean isShowing() {
return mWindowManagerView.isShowing();
}
public static class Builder {
private Context mContext;
private WMDialogParams mParams;
public Builder( Activity activity ) {
this.mContext = activity;
mParams = new WMDialogParams();
mParams.mContext = activity;
}
public Builder setContent( CharSequence content ) {
mParams.mContent = content;
return this;
}
public Builder setContent( @StringRes int content ) {
mParams.mContent = mContext.getString( content );
return this;
}
public Builder setOkButton( CharSequence buttonText, OnClickListener listener ) {
mParams.mOkButtonText = buttonText;
mParams.mOnOkButtonClickListener = listener;
return this;
}
public Builder setOkButton( @StringRes int buttonText, OnClickListener listener ) {
mParams.mOkButtonText = mContext.getText( buttonText );
mParams.mOnOkButtonClickListener = listener;
return this;
}
public Builder setCancelButton( CharSequence buttonText, OnClickListener listener ) {
mParams.mCancelButtonText = buttonText;
mParams.mOnCancelButtonClickListener = listener;
return this;
}
public Builder setCancelButton( @StringRes int buttonText, OnClickListener listener ) {
mParams.mCancelButtonText = mContext.getText( buttonText );
mParams.mOnCancelButtonClickListener = listener;
return this;
}
public Builder setOnDialogDismissListener( OnDismissListener onDialogDismissListener ) {
mParams.mOnDialogDismissListener = onDialogDismissListener;
return this;
}
public WMDialog build() {
WMDialog dialog = new WMDialog( mParams );
return dialog;
}
}
public static class WMDialogParams {
// public CharSequence mTitle;
public CharSequence mOkButtonText;
public CharSequence mCancelButtonText;
public CharSequence mContent;
public OnClickListener mOnOkButtonClickListener;
public OnClickListener mOnCancelButtonClickListener;
public OnDismissListener mOnDialogDismissListener;
public Context mContext;
}
}

View File

@@ -1,54 +0,0 @@
package com.mogo.module.common.drawer;
import android.content.Context;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.module.common.R;
import com.mogo.module.common.constants.AdasRecognizedType;
/**
* @author congtaowang
* @since 2020/10/30
* <p>
* 描述
*/
public class BaseDrawer {
protected final Context mContext;
public BaseDrawer() {
mContext = AbsMogoApplication.getApp();
}
/**
* 获取3D锚点模型资源
*
* @param type {@link AdasRecognizedType}
* @return modelRes
*/
public int getModelRes(int type) {
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
if (recognizedType == AdasRecognizedType.classIdCar) {
return R.raw.traffic_tachexiaoche;
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
return R.raw.traffic_daba;
} else if (recognizedType == AdasRecognizedType.classIdMoto) {
return R.raw.traffic_motuoche;
} else if (recognizedType == AdasRecognizedType.classIdStopLine) {
return R.raw.stopline;
} else if (recognizedType == AdasRecognizedType.classIdWarningArrows) {
return R.raw.jiantou;
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) {
return R.raw.special_vehicle;
} else if (recognizedType == AdasRecognizedType.classIdBicycle) {
return R.raw.traffic_zixingche;
} else if (recognizedType == AdasRecognizedType.classIdTrafficTruck) {
return R.raw.traffic_daba;
} else if (recognizedType == AdasRecognizedType.classIdPerson) {
return R.raw.traffic_people;
}
return R.raw.special_vehicle;
}
}

View File

@@ -1,177 +0,0 @@
package com.mogo.module.common.drawer;
import android.text.TextUtils;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.map.MogoMarkerManager;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.marker.EmptyMarkerView;
import com.mogo.module.common.drawer.marker.IMarkerView;
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
import com.mogo.module.common.drawer.marker.OnlineCarMarkerView;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerNoveltyInfo;
import com.mogo.module.common.entity.MarkerOnlineCar;
import com.mogo.module.common.entity.MarkerShareMusic;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.enums.EventTypeEnum;
/**
* @author congtaowang
* @since 2020/10/28
* <p>
* 描述
*/
public class MarkerDrawer {
public static final int MARKER_Z_INDEX_HIGH = 100;
public static final int MARKER_Z_INDEX_LOW = 2;
private static volatile MarkerDrawer sInstance;
private MarkerDrawer() {
}
public static MarkerDrawer getInstance() {
if (sInstance == null) {
synchronized (MarkerDrawer.class) {
if (sInstance == null) {
sInstance = new MarkerDrawer();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance;
}
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, int zIndex, IMogoMarkerClickListener listener) {
return drawMapMarkerImpl(markerShowEntity, false, zIndex, 0, listener);
}
/**
* add marker, { 如果是需要在3D模式下显示则需要设置 {@link MogoMarkerOptions icon3DRes 资源id}}
*
* @param markerShowEntity marker展示数据结构体
* @param matchRoadSide 设置是否道路吸附,暂时没用到这个字段
* @param zIndex zOrder
* @param icon3DRes 3D Res资源
* @param listener marker回调
* @return {@link IMogoMarker}
*/
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, int icon3DRes, IMogoMarkerClickListener listener) {
if (markerShowEntity == null || markerShowEntity.getMarkerLocation() == null) {
return null;
}
MogoMarkerOptions options = new MogoMarkerOptions().icon3DRes(icon3DRes).set3DMode(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()).matchOnRoadSide(matchRoadSide).owner(markerShowEntity.getMarkerType()).zIndex(zIndex).data(markerShowEntity).latitude(markerShowEntity.getMarkerLocation().getLat()).longitude(markerShowEntity.getMarkerLocation().getLon());
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
Object bindObj = markerShowEntity.getBindObj();
if (bindObj instanceof MarkerExploreWay && ((MarkerExploreWay) bindObj).getPoiType() != null) {
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
options.icon3DRes(EventTypeEnum.getMarker3DRes(poiType));
}
}
IMarkerView markerView = MapMarkerAdapter.getMarkerView(AbsMogoApplication.getApp(), markerShowEntity, options);
if (markerView instanceof OnlineCarMarkerView) {
try {
options.icon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType()));
} catch (Exception e) {
options.icon(markerView.getBitmap(0));
}
options.anchor(0.5f, 0.5f);
} else {
options.icon(markerView.getView());
}
if (options.getIcon3DRes() != 0) {
options.icon(new EmptyMarkerView(AbsMogoApplication.getApp()));
options.icon(markerView.getBitmap(0));
}
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).addMarker(markerShowEntity.getMarkerType(), options);
if (marker != null) {
marker.setOwner(markerShowEntity.getMarkerType());
markerView.setMarker(marker);
marker.setOnMarkerClickListener(listener);
markerShowEntity.setMarker(marker);
}
return marker;
}
public String getPrimaryKeyFromEntity(Object entity) {
if (entity instanceof MarkerExploreWay) {
String id = ((MarkerExploreWay) entity).getInfoId();
if (!TextUtils.isEmpty(id)) {
return id;
}
}
return getCarSnFromEntity(entity);
}
private String getPrimaryKeyFromMarker(IMogoMarker marker) {
if (marker == null || marker.getObject() == null || marker.isDestroyed()) {
return null;
}
if (!(marker.getObject() instanceof MarkerShowEntity)) {
return null;
}
return getPrimaryKeyFromEntity(((MarkerShowEntity) marker.getObject()).getBindObj());
}
private String getCarSnFromEntity(Object entity) {
try {
if (entity instanceof MarkerOnlineCar) {
return ((MarkerOnlineCar) entity).getUserInfo().getSn();
} else if (entity instanceof MarkerShareMusic) {
return ((MarkerShareMusic) entity).getUserInfo().getSn();
} else if (entity instanceof MarkerNoveltyInfo) {
return ((MarkerNoveltyInfo) entity).getSn();
} else if (entity instanceof MarkerExploreWay) {
return ((MarkerExploreWay) entity).getUserInfo().getSn();
}
} catch (Exception e) {
}
return "";
}
/**
* 距离半径计算方式
*
* @param point1 点一坐标
* @param point2 点二坐标
* @return 两坐标的距离 单位M
*/
public static float calculateLineDistance(MogoLatLng point1, MogoLatLng point2) {
if (point1 != null && point2 != null) {
return calculateLineDistance(point1.lon, point1.lat, point2.lon, point2.lat);
} else {
return 0.0F;
}
}
/**
* @param lon1
* @param lat1
* @param lon2
* @param lat2
* @return 两坐标的距离 单位M
*/
public static float calculateLineDistance(double lon1, double lat1, double lon2, double lat2) {
return CoordinateUtils.calculateLineDistance(lon1, lat1, lon2, lat2);
}
}

View File

@@ -1,235 +0,0 @@
package com.mogo.module.common.drawer
import android.annotation.SuppressLint
import android.content.Context
import android.os.Handler
import android.os.Message
import android.text.TextUtils
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.data.traffic.threatLevelColor
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
import com.mogo.map.MogoMarkerManager
import com.mogo.map.marker.IMogoMarker
import com.mogo.map.marker.MogoMarkerOptions
import com.mogo.module.common.constants.DataTypes
import java.util.concurrent.ConcurrentHashMap
/**
* 此类用于obu/v2x预警绘制交通元素 2D\3D绘制
* obu:与其进行调试单独展示与debugview上感知开关相关联
* v2x:绘制云端预警marker不会做感知控制管理后续根据注解的方式来控制v2x业务
*/
@SuppressLint("StaticFieldLeak")
object TrafficMarkerDrawer {
private const val TAG = "TrafficMarkerDrawer"
private var mContext: Context? = null
// 动画持续时间
private const val stepTime = 150L
// 维护Obu识别的他车集合
private val mTrafficMap = ConcurrentHashMap<String, TrafficData>()
// 地图内部资源md5缓存便于资源复用
private val mMarkerCachesResMd5Values = ConcurrentHashMap<String, String>()
// 上一帧数据的缓存,用来做移动动画
private val mMarkersCaches = ConcurrentHashMap<String, IMogoMarker>()
// 维护一个线程定时轮询数据进行地图绘制
private val mDrawerHandler: Handler =
object : Handler(WorkThreadHandler.newInstance("other_traffic_drawer").looper) {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
if (FunctionBuildConfig.debugTrackerProvider == 1) {
drawerTrafficInfo()
}
// 延时50毫秒重复发送自己定时轮询进行车辆绘制可以及时将已经不存在车辆删除
sendEmptyMessageDelayed(0, 50L)
}
}
init {
mContext = AbsMogoApplication.getApp()
mDrawerHandler.sendEmptyMessageDelayed(1, 0L)
}
/**
* 更新识别数据,V2V预警的时候需要修改车辆颜色
*/
fun updateITrafficInfo(trafficData: TrafficData) {
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = trafficData
}
}
/**
* 更新识别数据位置
*/
fun updateITrafficLocationInfo(trafficData: TrafficData) {
if (FunctionBuildConfig.debugTrackerProvider != 1) {
return
}
val tempTraffic = mTrafficMap[trafficData.uuid]
if (tempTraffic != null) {
tempTraffic.lat = trafficData.lat
tempTraffic.lon = trafficData.lon
tempTraffic.heading = trafficData.heading
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = tempTraffic
}
} else {
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = trafficData
}
}
}
/**
* 更新识别数据颜色
*/
fun updateITrafficThreatLevelInfo(trafficData: TrafficData) {
if (FunctionBuildConfig.debugTrackerProvider != 1) {
return
}
if (trafficData != null && !TextUtils.isEmpty(trafficData.uuid)) {
val tempTraffic = mTrafficMap[trafficData.uuid]
if (tempTraffic != null) {
tempTraffic.lat = trafficData.lat
tempTraffic.lon = trafficData.lon
tempTraffic.heading = trafficData.heading
tempTraffic.threatLevel = trafficData.threatLevel
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = tempTraffic
}
} else {
if (trafficData.uuid != null) {
mTrafficMap[trafficData.uuid!!] = trafficData
}
}
}
}
/**
* 移除识别的数据
*/
fun removeCvxRvInfoIndInfo(key: String) {
if (mTrafficMap.containsKey(key)) {
mTrafficMap.remove(key)
}
}
/**
* 绘制
*/
private fun drawerTrafficInfo() {
// 数据为空的时候清除所有数据
if (mTrafficMap.isEmpty()) {
mMarkersCaches.forEach {
it.value.remove()
}
mMarkersCaches.clear()
} else {
// 循环绘制识别的数据
mTrafficMap.forEach {
// 如果数据已经存在 Marker取出做动画
if (mMarkersCaches[it.key] != null) {
mMarkersCaches[it.key]?.let { marker ->
changeDynamicMarker(marker, it.value)
}
}
// 不存在的添加Marker绘制
else {
drawObuRecognizedDataMarker(it.value)
}
}
}
}
/**
* 绘制单条
*/
private fun drawObuRecognizedDataMarker(trafficData: TrafficData) {
CallerLogger.d(
TAG,
"trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel
)
if (trafficData.type != null) {
val resId: Int = trafficData.type.traffic3DIconId
val resIdVal = resId.toString() + ""
val options = MogoMarkerOptions()
.owner(DataTypes.TYPE_MARKER_ADAS)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.gps(true)
.controlAngle(true)
.resName(mMarkerCachesResMd5Values[resIdVal])
.icon3DRes(resId)
.rotate(trafficData.heading.toFloat())
.position(
com.mogo.eagle.core.data.map.MogoLatLng(
trafficData.lat,
trafficData.lon
)
)
if (trafficData.type != TrafficTypeEnum.TYPE_TRAFFIC_ID_SPECIAL_VEHICLE) {
// 修改颜色
mMarkersCaches[trafficData.uuid]?.setAnchorColor(trafficData.threatLevelColor())
}
val marker = MogoMarkerManager.getInstance(mContext)
.addMarker(DataTypes.TYPE_MARKER_OBU_DATA, options)
// 缓存3D资源
mMarkerCachesResMd5Values[resIdVal] = marker.markerResName
// 缓存数据
if (trafficData.uuid != null) {
mMarkersCaches[trafficData.uuid!!] = marker
}
}
}
/**
* 带动画的修改Marker
*/
private fun changeDynamicMarker(
marker: IMogoMarker,
trafficData: TrafficData
) {
CallerLogger.d(
TAG,
"trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel
)
if (trafficData.type != TrafficTypeEnum.TYPE_TRAFFIC_ID_SPECIAL_VEHICLE) {
mMarkersCaches[trafficData.uuid]?.setAnchorColor(trafficData.threatLevelColor())
}
try {
marker.addDynamicAnchorPosition(
com.mogo.eagle.core.data.map.MogoLatLng(
trafficData.lat,
trafficData.lon
),
trafficData.heading.toFloat(),
stepTime
)
} catch (e: Exception) {
e.printStackTrace()
try {
drawObuRecognizedDataMarker(trafficData)
} catch (e: Exception) {
e.printStackTrace()
}
}
}
}

View File

@@ -1,141 +0,0 @@
package com.mogo.module.common.drawer;
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.MogoMarkerManager;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.drawer.marker.IMarkerView;
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerShowEntity;
/**
* 云端 预警数据绘制
*/
public class V2XWarnDataDrawer extends BaseDrawer {
private static final String TAG = "V2XWarnDataDrawer";
private static volatile V2XWarnDataDrawer sInstance;
private V2XWarnDataDrawer() {
super();
}
public static V2XWarnDataDrawer getInstance() {
if (sInstance == null) {
synchronized (V2XWarnDataDrawer.class) {
if (sInstance == null) {
sInstance = new V2XWarnDataDrawer();
}
}
}
return sInstance;
}
public synchronized void release() {
sInstance = null;
}
/**
* 识别物移动
*/
public void renderWarnData(double lon, double lat, int type, double collisionlat, double collisionLon, double angle, long showTime) {
MarkerLocation location = new MarkerLocation();
location.setLat(lat);
location.setLon(lon);
location.setAngle(angle);
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setMarkerLocation(location);
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA);
IMogoMarker marker = drawMarker(markerShowEntity, modeResType(type));
// marker.addDynamicAnchorPosition(new MogoLatLng(collisionlat, collisionLon), (float) heading, showTime * 1000);
UiThreadHandler.postDelayed(() -> {
marker.remove();
}, showTime * 1000);
}
//根据识别物类型 (行人1/自行车2/摩托车4/骑行车辆11)获取3D模型(对应查看getModelRes)
private int modeResType(int dataType) {
switch (dataType) {
case 1:
case 11:
return 1;
case 2:
return 2;
case 4:
return 4;
}
return 1;
}
public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity, int modeResType) {
MogoMarkerOptions options = new MogoMarkerOptions()
.data(markerShowEntity)
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon())
.controlAngle(true)
.rotate((float) markerShowEntity.getMarkerLocation().getAngle())
.setGps(true);
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(getModelRes(modeResType)); //TODO
options.anchorColor("#FB3C3CFF");
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);
marker.setToTop();
return marker;
}
public void drawerArrowsMarkerWithLocation(MogoLatLng location, String markerType, int type, int rotate) {
MogoMarkerOptions options = new MogoMarkerOptions()
.latitude(location.getLat())
.longitude(location.getLon())
.set3DMode(true)
.setGps(true)
.controlAngle(true)
.icon3DRes(getModelRes(type))
.anchorColor("#FB3C3CFF")
.flat(true);
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerType, options);
marker.setRotateAngle(rotate);
}
/**
* 绘制停止线 marker
*/
public void renderStopLineData(double lon, double lat) {
MarkerLocation location = new MarkerLocation();
location.setLat(lat);
location.setLon(lon);
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setMarkerLocation(location);
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_STOP_LINE_DATA);
IMogoMarker marker = drawStopLineMarker(markerShowEntity);
}
/**
* 停止线绘制
*/
public IMogoMarker drawStopLineMarker(MarkerShowEntity markerShowEntity) {
MogoMarkerOptions options = new MogoMarkerOptions()
.data(markerShowEntity)
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon())
.setGps(false);
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(getModelRes(9));
options.anchorColor("#FB3C3CFF");
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);
marker.setToTop();
return marker;
}
}

View File

@@ -1,46 +0,0 @@
package com.mogo.module.common.drawer.marker;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.Nullable;
import com.mogo.map.marker.IMogoMarker;
public
/**
* @author congtaowang
* @since 2020/12/16
*
* 描述
*/
class EmptyMarkerView extends View implements IMarkerView {
public EmptyMarkerView( Context context ) {
this( context, null );
}
public EmptyMarkerView( Context context, @Nullable AttributeSet attrs ) {
this( context, attrs, 0 );
}
public EmptyMarkerView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
super( context, attrs, defStyleAttr );
}
@Override
public View getView() {
return this;
}
@Override
public void setMarker( IMogoMarker marker ) {
}
@Override
protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec ) {
setMeasuredDimension( 1, 1 );
}
}

View File

@@ -1,23 +0,0 @@
package com.mogo.module.common.drawer.marker;
import android.graphics.Bitmap;
import android.view.View;
import com.mogo.map.marker.IMogoMarker;
/**
* @author congtaowang
* @since 2020-02-15
* <p>
* 描述
*/
public interface IMarkerView {
View getView();
default Bitmap getBitmap( int type ){
return null;
}
void setMarker( IMogoMarker marker );
}

View File

@@ -1,54 +0,0 @@
package com.mogo.module.common.drawer.marker;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.R;
import com.mogo.module.common.entity.MarkerShowEntity;
/**
* author : 李小鹏
* desc : 地图2dMarker 在3d下的展示
* version: 1.0
*/
public class MapCameraInfoView extends MapMarkerBaseView {
private String TAG = "MapCameraInfoView";
private ImageView mCameraImage;
public MapCameraInfoView(Context context ) {
super( context );
}
public MapCameraInfoView(Context context, @Nullable AttributeSet attrs ) {
super( context, attrs );
}
public MapCameraInfoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
super( context, attrs, defStyleAttr );
}
public MapCameraInfoView(Context context, MogoMarkerOptions options ) {
super( context );
mOptions = options;
}
@Override
protected void initView( Context context ) {
LayoutInflater.from( context ).inflate( R.layout.modudle_camera_layout_info, this );
mCameraImage = findViewById( R.id.iv_camera_traffic);
}
@Override
public void updateView( MarkerShowEntity markerShowEntity ) {
}
}

View File

@@ -1,45 +0,0 @@
package com.mogo.module.common.drawer.marker;
import android.content.Context;
import android.text.TextUtils;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.MarkerShowEntity;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020-01-1015:55
* desc : 地图Marker的适配器
* version: 1.0
*/
public class MapMarkerAdapter {
/**
* 获取 MarkerShowEntity 填充好的 MarkerView
*
* @param context 上下文
* @param markerShowEntity 要填充的数据
* @return MarkerView
*/
public static IMarkerView getMarkerView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
if ( TextUtils.equals( markerShowEntity.getMarkerType(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
return OnlineCarMarkerView.getInstance();
} else {
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
return new EmptyMarkerView( context );
} else {
if ( markerShowEntity.isChecked() ) {
return new MapMarkerInfoView( context, markerShowEntity, options );
} else {
return new MapMarkerView( context, markerShowEntity, options );
}
}
}
}
}

View File

@@ -1,152 +0,0 @@
package com.mogo.module.common.drawer.marker;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Looper;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.utilcode.mogo.glide.GlideImageLoader;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.eagle.core.utilcode.util.ViewUtils;
import com.mogo.eagle.core.utilcode.util.WindowUtils;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.R;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.eagle.core.utilcode.mogo.imageloader.IMogoImageLoaderListener;
import com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020-01-1310:55
* desc : 地图上抽离的Marker的共性
* version: 1.0
*/
public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerView {
private String TAG = "MapMarkerBaseView";
protected Context mContext;
protected MogoMarkerOptions mOptions;
protected MogoImageView ivUserHead;
protected MogoImageView ivIcon;
protected ImageView ivCar;
protected IMogoMarker mMarker;
public MapMarkerBaseView(Context context) {
super(context);
mContext = context;
initView(context);
}
public MapMarkerBaseView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
mContext = context;
initView(context);
}
public MapMarkerBaseView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mContext = context;
initView(context);
}
@Override
public void setMarker(IMogoMarker marker) {
this.mMarker = marker;
}
protected abstract void initView(Context context);
public abstract void updateView(MarkerShowEntity markerShowEntity);
protected void loadImageWithMarker(final MarkerShowEntity markerShowEntity) {
if (Looper.myLooper() != Looper.getMainLooper()) {
UiThreadHandler.post(() -> {
runOnUiThread(markerShowEntity);
});
} else {
runOnUiThread(markerShowEntity);
}
}
protected void loadPoiTypeIcon(String url, int res) {
ivIcon.setImageResource(res);
if (Looper.myLooper() != Looper.getMainLooper()) {
UiThreadHandler.post(() -> loadPoiTypeIconInUiThread(url, res));
} else {
loadPoiTypeIconInUiThread(url, res);
}
}
private void loadPoiTypeIconInUiThread(String url, int res) {
if (mMarker != null) {
mMarker.setIcon(ViewUtils.fromView(MapMarkerBaseView.this));
}
if (!url.isEmpty()) {
ivIcon.setPlaceHolder(res);
ivIcon.setFailureHolder(res);
GlideImageLoader.getInstance().displayImage(url,
ivIcon, WindowUtils.dip2px(mContext, 50), WindowUtils.dip2px(mContext, 50),
new IMogoImageLoaderListener() {
@Override
public void onStart() {
}
@Override
public void onCompleted(Bitmap bitmap) {
// 使用view渲染地图marker刷新纹理的时候需要重新用view生成纹理然后在设置
if (mMarker != null) {
mMarker.setIcon(ViewUtils.fromView(MapMarkerBaseView.this));
}
}
@Override
public void onFailure(Exception e) {
}
});
}
}
private void runOnUiThread(final MarkerShowEntity markerShowEntity) {
if (!TextUtils.isEmpty(markerShowEntity.getIconUrl())) {
GlideImageLoader.getInstance().displayImage(markerShowEntity.getIconUrl(),
ivUserHead,
WindowUtils.dip2px(mContext, 50), WindowUtils.dip2px(mContext, 50),
new IMogoImageLoaderListener() {
@Override
public void onStart() {
}
@Override
public void onCompleted(Bitmap bitmap) {
// 使用view渲染地图marker刷新纹理的时候需要重新用view生成纹理然后在设置
if (mMarker != null) {
mMarker.setIcon(ViewUtils.fromView(MapMarkerBaseView.this));
}
}
@Override
public void onFailure(Exception e) {
}
});
} else {
ivUserHead.setBackgroundResource(R.drawable.icon_default_user_head);
}
}
@Override
public View getView() {
return this;
}
}

View File

@@ -1,125 +0,0 @@
package com.mogo.module.common.drawer.marker;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.marker.PoiWrapper;
import com.mogo.module.common.utils.CloudPoiManager;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020-01-0619:55
* desc : 地图Marker图标带文本信息
* version: 1.0
*/
public class MapMarkerInfoView extends MapMarkerBaseView {
private String TAG = "MapMarkerInfoView";
private TextView tvMarkerContent;
private LinearLayout clMarkerContent;
private ImageView ivReverseTriangle;
public MapMarkerInfoView(Context context) {
super(context);
}
public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public MapMarkerInfoView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options) {
super(context);
mOptions = options;
try {
updateView(markerShowEntity);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected void initView(Context context) {
LayoutInflater.from(context).inflate(R.layout.modudle_services_marker_layout_info, this);
ivUserHead = findViewById(R.id.ivUserHead);
// ivIcon = findViewById( R.id.ivIcon );
ivIcon = findViewById(R.id.ivIcon);
clMarkerContent = findViewById(R.id.clMarkerContent);
ivReverseTriangle = findViewById(R.id.ivReverseTriangle);
ivCar = findViewById(R.id.ivCar);
tvMarkerContent = findViewById(R.id.tvMarkerContent);
}
@Override
public void updateView(MarkerShowEntity markerShowEntity) {
Object bindObj = markerShowEntity.getBindObj();
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
ivCar.setImageResource(R.drawable.icon_map_marker_location_yellow_vr);
} else {
ivCar.setImageResource(R.drawable.icon_map_marker_location_yellow);
}
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_yellow_info);
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_yellow);
switch (markerShowEntity.getMarkerType()) {
case ModuleNames.CARD_TYPE_USER_DATA:
ivUserHead.setVisibility(View.VISIBLE);
ivIcon.setVisibility(View.INVISIBLE);
loadImageWithMarker(markerShowEntity);
ivCar.setImageResource(R.drawable.icon_map_marker_car_gray);
//ivCar.setRotation(new Random().nextInt(360));
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
break;
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
ivUserHead.setVisibility(View.INVISIBLE);
ivIcon.setVisibility(View.VISIBLE);
if (bindObj instanceof MarkerExploreWay && ((MarkerExploreWay) bindObj).getPoiType() != null) {
// 根据poiType获取对应的图片
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
PoiWrapper poiWrapper =
CloudPoiManager.getInstance().getWrapperByPoiType(poiType);
if (poiWrapper != null) {
// 加载图片
loadPoiTypeIcon(poiWrapper.getIconInfoUrl(), poiWrapper.getIconInfoRes());
} else {
CallerLogger.INSTANCE.e(TAG, "未能根据poiType获取对应poi信息无法渲染info marker====" + poiType);
}
}
break;
default:
break;
}
if (!TextUtils.isEmpty(markerShowEntity.getTextContent())) {
String content;
if (markerShowEntity.getTextContent().length() > 8) {
content = markerShowEntity.getTextContent().substring(0, 7) + "...";
} else {
content = markerShowEntity.getTextContent();
}
tvMarkerContent.setText(content);
}
}
}

View File

@@ -1,95 +0,0 @@
package com.mogo.module.common.drawer.marker;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.ModuleNames;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.marker.PoiWrapper;
import com.mogo.module.common.utils.CloudPoiManager;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020-01-0619:55
* desc : 地图Marker图标
* version: 1.0
*/
public class MapMarkerView extends MapMarkerBaseView {
private String TAG = "MapMarkerView";
private FrameLayout clMarkerTopView;
private MarkerShowEntity mMarkerShowEntity;
public MapMarkerView( Context context ) {
super( context );
}
public MapMarkerView( Context context, @Nullable AttributeSet attrs ) {
super( context, attrs );
}
public MapMarkerView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
super( context, attrs, defStyleAttr );
}
public MapMarkerView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
super( context );
mOptions = options;
mMarkerShowEntity = markerShowEntity;
try {
updateView( markerShowEntity );
} catch ( Exception e ) {
e.printStackTrace();
}
}
@Override
protected void initView( Context context ) {
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
LayoutInflater.from( context ).inflate( R.layout.modudle_services_marker_vr_layout, this );
} else {
LayoutInflater.from( context ).inflate( R.layout.modudle_services_marker_layout, this );
}
clMarkerTopView = findViewById( R.id.clMarkerTopView );
ivIcon = findViewById( R.id.ivIcon );
ivCar = findViewById( R.id.ivCar );
}
@Override
public void updateView( MarkerShowEntity markerShowEntity ) {
Object bindObj = markerShowEntity.getBindObj();
switch ( markerShowEntity.getMarkerType() ) {
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
if ( mMarkerShowEntity != null && mMarkerShowEntity.isChecked() ) {
clMarkerTopView.setBackgroundResource( R.drawable.module_services_marker_vr_bkg_checked );
}
if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) {
// 根据poiType获取对应的图片
String poiType = ( ( MarkerExploreWay ) bindObj ).getPoiType();
PoiWrapper poiWrapper =
CloudPoiManager.getInstance().getWrapperByPoiType( poiType );
if ( poiWrapper != null ) {
// 加载图片
loadPoiTypeIcon( poiWrapper.getIconUrl(), poiWrapper.getIconRes() );
} else {
CallerLogger.INSTANCE.e( TAG, "未能根据poiType获取对应poi信息无法渲染marker====" + poiType );
}
}
break;
default:
break;
}
}
}

View File

@@ -1,74 +0,0 @@
package com.mogo.module.common.drawer.marker;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.module.common.R;
import java.lang.ref.SoftReference;
import java.util.HashMap;
import java.util.Map;
/**
* @author congtaowang
* @since 2020-04-30
* <p>
* 描述
*/
public class OnlineCarMarkerView implements IMarkerView {
private static Map< Integer, SoftReference< Bitmap > > sRef = new HashMap<>();
private static Map< Integer, SoftReference< Bitmap > > sTypedRef = new HashMap<>();
private OnlineCarMarkerView() {
// private constructor
}
private static final class InstanceHolder {
private static final OnlineCarMarkerView INSTANCE = new OnlineCarMarkerView();
}
public static OnlineCarMarkerView getInstance() {
return InstanceHolder.INSTANCE;
}
@Override
public View getView() {
return null;
}
@Override
public Bitmap getBitmap( int vehicleType ) {
if ( sRef.get( vehicleType ) == null || sRef.get( vehicleType ).get() == null
|| sRef.get( vehicleType ).get().isRecycled() ) {
switch ( vehicleType ) {
case 5:
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_taxi ) ) );
break;
case 6:
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_bus ) ) );
break;
case 1:
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_110 ) ) );
break;
case 2:
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_120 ) ) );
break;
case 7:
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_119 ) ) );
break;
default:
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_gray ) ) );
}
}
return sRef.get( vehicleType ).get();
}
@Override
public void setMarker( IMogoMarker marker ) {
}
}

View File

@@ -1,41 +0,0 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
@SuppressWarnings("unused")
public class MarkerActivitiesScope implements Serializable {
private String content;
private boolean isCheck;
public String getContent() {
if (TextUtils.isEmpty(content)) {
return "";
}
return content;
}
public void setContent(String content) {
this.content = content;
}
public boolean getIsCheck() {
return isCheck;
}
public void setIsCheck(boolean isCheck) {
this.isCheck = isCheck;
}
@Override
public String toString() {
return "MarkerActivitiesScope{" +
"content='" + content + '\'' +
", isCheck=" + isCheck +
'}';
}
}

View File

@@ -1,46 +0,0 @@
package com.mogo.module.common.entity;
import java.io.Serializable;
@SuppressWarnings("unused")
public class MarkerCarChat implements Serializable {
private String type;
private MarkerLocation location;
private MarkerUserInfo userInfo;
public MarkerLocation getLocation() {
return location;
}
public void setLocation(MarkerLocation location) {
this.location = location;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public MarkerUserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(MarkerUserInfo userInfo) {
this.userInfo = userInfo;
}
@Override
public String toString() {
return "MarkerCarChat{" +
"location=" + location +
", type='" + type + '\'' +
", userInfo=" + userInfo +
'}';
}
}

View File

@@ -1,106 +0,0 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
@SuppressWarnings("unused")
public class MarkerCarInfo implements Serializable {
private String carBrandLogoUrl;
private String carTypeName;
private int vehicleType;
private CarLiveInfo carLiveInfo;
public String getCarBrandLogoUrl() {
if (TextUtils.isEmpty(carBrandLogoUrl)) {
return "";
}
return carBrandLogoUrl;
}
public void setCarBrandLogoUrl(String carBrandLogoUrl) {
this.carBrandLogoUrl = carBrandLogoUrl;
}
public String getCarTypeName() {
if (TextUtils.isEmpty(carTypeName)) {
return "";
}
return carTypeName;
}
public void setCarTypeName(String carTypeName) {
this.carTypeName = carTypeName;
}
public int getVehicleType() {
return vehicleType;
}
public void setVehicleType(int vehicleType) {
this.vehicleType = vehicleType;
}
public CarLiveInfo getCarLiveInfo() {
return carLiveInfo;
}
public void setCarLiveInfo(CarLiveInfo carLiveInfo) {
this.carLiveInfo = carLiveInfo;
}
public static class CarLiveInfo implements Serializable {
//rtmp视频直播地址rtmp://
private String videoUrl;
//直播频道【直播心跳接口参数】C_1
private String videoChannel;
//直播源sn【直播心跳接口参数】XTCBA90740400625
private String videoSn;
public String getVideoUrl() {
return videoUrl;
}
public void setVideoUrl(String videoUrl) {
this.videoUrl = videoUrl;
}
public String getVideoChannel() {
return videoChannel;
}
public void setVideoChannel(String videoChannel) {
this.videoChannel = videoChannel;
}
public String getVideoSn() {
return videoSn;
}
public void setVideoSn(String videoSn) {
this.videoSn = videoSn;
}
@Override
public String toString() {
return "CarLiveInfo{" +
"videoUrl='" + videoUrl + '\'' +
", videoChannel='" + videoChannel + '\'' +
", videoSn='" + videoSn + '\'' +
'}';
}
}
@Override
public String toString() {
return "MarkerCarInfo{" +
"carBrandLogoUrl='" + carBrandLogoUrl + '\'' +
", carTypeName='" + carTypeName + '\'' +
", vehicleType=" + vehicleType +
", carLiveInfo=" + carLiveInfo +
'}';
}
}

View File

@@ -1,43 +0,0 @@
package com.mogo.module.common.entity;
import java.util.List;
/**
* Created by ihoudf on 2020-04-16.
**/
public class MarkerCarPois {
private List coordinates;
private double angle; // 车头角度
private String adcode;
public List getCoordinates() {
return coordinates;
}
public void setCoordinates(List coordinates) {
this.coordinates = coordinates;
}
public double getAngle() {
return angle;
}
public void setAngle(double angle) {
this.angle = angle;
}
public String getAdcode() {
return adcode;
}
public void setAdcode(String adcode) {
this.adcode = adcode;
}
@Override
public String toString() {
return "MarkerCarPois{" + "coordinates=" + coordinates + ", angle=" + angle + ", adcode" +
"='" + adcode + '\'' + '}';
}
}

View File

@@ -9,54 +9,9 @@ import java.util.List;
public class MarkerCardResult extends BaseData {
private List<String> dataType; // 要查询的类型
private List<MarkerCarChat> carChat;
private List<MarkerShareMusic> shareMusic;
private List<MarkerNoveltyInfo> noveltyInfo;
private List<MarkerOnlineCar> onlineCar;
private List<MarkerExploreWay> exploreWay;
private long messageTime;
public List<MarkerCarChat> getCarChat() {
return carChat;
}
public void setCarChat(List<MarkerCarChat> carChat) {
this.carChat = carChat;
}
public List<MarkerExploreWay> getExploreWay() {
return exploreWay;
}
public void setExploreWay(List<MarkerExploreWay> exploreWay) {
this.exploreWay = exploreWay;
}
public List<MarkerOnlineCar> getOnlineCar() {
return onlineCar;
}
public void setOnlineCar(List<MarkerOnlineCar> onlineCar) {
this.onlineCar = onlineCar;
}
public List<MarkerShareMusic> getShareMusic() {
return shareMusic;
}
public void setShareMusic(List<MarkerShareMusic> shareMusic) {
this.shareMusic = shareMusic;
}
public List<MarkerNoveltyInfo> getNoveltyInfo() {
return noveltyInfo;
}
public void setNoveltyInfo(List<MarkerNoveltyInfo> noveltyInfo) {
this.noveltyInfo = noveltyInfo;
}
public List<String> getDataType() {
return dataType;
}

View File

@@ -1,166 +0,0 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
@SuppressWarnings("unused")
public class MarkerDynamicData implements Serializable {
//QQ音乐懒人听书乐听头条 2 为书籍听书3 为新闻,1 为qq音乐
private int type;
private String mediaId;//qq音乐id书的bookId
//qq音乐url 懒人听书为“”
private String mediaUrl;
//歌曲名 ,当前播放书名,新闻标题内容
private String mediaName;
//演唱歌手,当前章节,新闻来源
private String mediaSinger;
//歌曲封面,书籍封面,新闻预览图
private String mediaImg;
//音乐类别,类似经典 流行只有qq特有
private String mediaType;
private int maxTime;//音频总时长
private String bookInfo;//懒人听书json串
//当前播放时长,可以不加,播放进度单独独立出来
private int curTime;
//是否是本地音频只有qq音乐
private boolean isLocalMedia;//本地
//播放模式,顺序,单曲循环,随机
private int mediaPlayMode;
//1 播放 2 缓冲 0 暂停/停止 -1 播放错误
private int playState;
public String getMediaId() {
return mediaId;
}
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
public String getMediaUrl() {
return mediaUrl;
}
public void setMediaUrl(String mediaUrl) {
this.mediaUrl = mediaUrl;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getPlayState() {
return playState;
}
public void setPlayState(int playState) {
this.playState = playState;
}
public String getMediaName() {
if (TextUtils.isEmpty(mediaName)) {
return "";
}
return mediaName;
}
public void setMediaName(String mediaName) {
this.mediaName = mediaName;
}
public String getMediaSinger() {
if (TextUtils.isEmpty(mediaSinger)) {
return "";
}
return mediaSinger;
}
public void setMediaSinger(String mediaSinger) {
this.mediaSinger = mediaSinger;
}
public String getMediaImg() {
return mediaImg;
}
public void setMediaImg(String mediaImg) {
this.mediaImg = mediaImg;
}
public long getMaxTime() {
return maxTime;
}
public void setMaxTime(int maxTime) {
this.maxTime = maxTime;
}
public long getCurTime() {
return curTime;
}
public void setCurTime(int curTime) {
this.curTime = curTime;
}
public String getMediaType() {
if (TextUtils.isEmpty(mediaType)) {
return "";
}
return mediaType;
}
public void setMediaType(String mediaType) {
this.mediaType = mediaType;
}
public boolean isLocalMedia() {
return isLocalMedia;
}
public void setLocalMedia(boolean localMedia) {
isLocalMedia = localMedia;
}
public int getMediaPlayMode() {
return mediaPlayMode;
}
public void setMediaPlayMode(int mediaPlayMode) {
this.mediaPlayMode = mediaPlayMode;
}
public String getBookInfo() {
return bookInfo;
}
public void setBookInfo(String bookInfo) {
this.bookInfo = bookInfo;
}
@Override
public String toString() {
return "MarkerDynamicData{" +
"type=" + type +
", mediaId='" + mediaId + '\'' +
", mediaUrl='" + mediaUrl + '\'' +
", mediaName='" + mediaName + '\'' +
", mediaSinger='" + mediaSinger + '\'' +
", mediaImg='" + mediaImg + '\'' +
", mediaType='" + mediaType + '\'' +
", maxTime=" + maxTime +
", bookInfo='" + bookInfo + '\'' +
", curTime=" + curTime +
", isLocalMedia=" + isLocalMedia +
", mediaPlayMode=" + mediaPlayMode +
", playState=" + playState +
'}';
}
}

View File

@@ -1,241 +0,0 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import com.mogo.module.common.enums.EventTypeEnum;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@SuppressWarnings("unused")
public class MarkerExploreWay implements Serializable {
private String infoId;
private String type;//卡片类型,
/**
* @see EventTypeEnum
*/
private String poiType;
private String sn;
private MarkerLocation location;//位置信息
private int direction;//方位角度
private boolean canLive;//是否可直播1为可直播0不可直播
private int fileType;//是图片还是视频1视频0图片
private String addr;//北京市朝阳区三里屯街道108号
private long generateTime;//时间戳
private String cityName;//:"城市名称",
private double distance;//距离
private MarkerUserInfo userInfo;//用户信息
private List<MarkerExploreWayItem> items;//视频地址和图片地址
//上报类型1-用户上报2-后台上报 3-三方上报
private String uploadType;
private boolean fabulous;
// http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
// 1 需要用户判断是否拥堵 进行UGC问答
private int infoCheckNode;
public Map<String, Object> extras = null;
public String getAddr() {
if (TextUtils.isEmpty(addr)) {
return "未知道路";
}
return addr;
}
public void setAddr(String addr) {
this.addr = addr;
}
public boolean getCanLive() {
return canLive;
}
public void setCanLive(boolean canLive) {
this.canLive = canLive;
}
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
public float getDirection() {
return direction;
}
public void setDirection(int direction) {
this.direction = direction;
}
public double getDistance() {
return distance;
}
public void setDistance(double distance) {
this.distance = distance;
}
public double getFileType() {
return fileType;
}
public void setFileType(int fileType) {
this.fileType = fileType;
}
public Long getGenerateTime() {
return generateTime;
}
public void setGenerateTime(Long generateTime) {
this.generateTime = generateTime;
}
public List<MarkerExploreWayItem> getItems() {
return items;
}
public void setItems(List<MarkerExploreWayItem> items) {
this.items = items;
}
public MarkerLocation getLocation() {
return location;
}
public void setLocation(MarkerLocation location) {
this.location = location;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public MarkerUserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(MarkerUserInfo userInfo) {
this.userInfo = userInfo;
}
public String getInfoId() {
return infoId;
}
public int getInfoIdInt() {
try {
return Integer.parseInt(infoId);
} catch (NumberFormatException e) {
e.printStackTrace();
return -1;
}
}
public void setInfoId(String infoId) {
this.infoId = infoId;
}
public String getPoiType() {
if (TextUtils.isEmpty(poiType)) {
return EventTypeEnum.FOURS_BLOCK_UP.getPoiType();
}
return poiType;
}
public void setPoiType(String poiType) {
this.poiType = poiType;
}
public String getUploadType() {
return uploadType;
}
public void setUploadType(String uploadType) {
this.uploadType = uploadType;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MarkerExploreWay that = (MarkerExploreWay) o;
return Objects.equals(infoId, that.infoId) &&
Objects.equals(type, that.type) &&
Objects.equals(poiType, that.poiType);
}
@Override
public int hashCode() {
return Objects.hash(infoId, type, poiType);
}
public boolean isCanLive() {
return canLive;
}
public void setGenerateTime(long generateTime) {
this.generateTime = generateTime;
}
public int getInfoCheckNode() {
return infoCheckNode;
}
public void setInfoCheckNode(int infoCheckNode) {
this.infoCheckNode = infoCheckNode;
}
public boolean isFabulous() {
return fabulous;
}
public void setFabulous(boolean fabulous) {
this.fabulous = fabulous;
}
@Override
public String toString() {
return "MarkerExploreWay{" +
"infoId='" + infoId + '\'' +
", type='" + type + '\'' +
", poiType='" + poiType + '\'' +
", sn='" + sn + '\'' +
", location=" + location +
", direction=" + direction +
", canLive=" + canLive +
", fileType=" + fileType +
", addr='" + addr + '\'' +
", generateTime=" + generateTime +
", cityName='" + cityName + '\'' +
", distance=" + distance +
", userInfo=" + userInfo +
", items=" + items +
", uploadType='" + uploadType + '\'' +
", fabulous=" + fabulous +
", infoCheckNode=" + infoCheckNode +
'}';
}
}

View File

@@ -1,67 +0,0 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
/**
* 道路情报V2X预警地图道路事件POI违章停车POI等
*/
@SuppressWarnings("unused")
public class MarkerExploreWayItem implements Serializable {
private String thumbnail;
private String url;
private String content;
private double illegalCount;
public String getThumbnail() {
if (TextUtils.isEmpty(thumbnail)) {
return "";
}
return thumbnail;
}
public void setThumbnail(String thumbnail) {
this.thumbnail = thumbnail;
}
public String getUrl() {
if (TextUtils.isEmpty(url)) {
return "";
}
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public double getIllegalCount() {
return illegalCount;
}
public void setIllegalCount(double illegalCount) {
this.illegalCount = illegalCount;
}
@Override
public String toString() {
return "MarkerExploreWayItem{" +
"thumbnail='" + thumbnail + '\'' +
", url='" + url + '\'' +
", content='" + content + '\'' +
", illegalCount='" + illegalCount + '\'' +
'}';
}
}

View File

@@ -1,71 +0,0 @@
package com.mogo.module.common.entity;
import java.io.Serializable;
import java.util.List;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020-01-1615:12
* desc : 爱好
* version: 1.0
*/
public class MarkerHobbyDatum implements Serializable {
private List<MarkerOnlineTag> singerTop2; // 最喜欢的两位歌手
private List<MarkerOnlineTag> songTypeTop2; // 最喜欢的两种音乐类型
private List<MarkerOnlineTag> newsType; // 最喜欢的资讯类型
private List<MarkerOnlineTag> listenBookTop2; // 最喜欢听的两本书
private List<MarkerOnlineTag> ifSociety; // 是否喜爱社交
public List<MarkerOnlineTag> getSingerTop2() {
return singerTop2;
}
public void setSingerTop2(List<MarkerOnlineTag> singerTop2) {
this.singerTop2 = singerTop2;
}
public List<MarkerOnlineTag> getSongTypeTop2() {
return songTypeTop2;
}
public void setSongTypeTop2(List<MarkerOnlineTag> songTypeTop2) {
this.songTypeTop2 = songTypeTop2;
}
public List<MarkerOnlineTag> getNewsType() {
return newsType;
}
public void setNewsType(List<MarkerOnlineTag> newsType) {
this.newsType = newsType;
}
public List<MarkerOnlineTag> getListenBookTop2() {
return listenBookTop2;
}
public void setListenBookTop2(List<MarkerOnlineTag> listenBookTop2) {
this.listenBookTop2 = listenBookTop2;
}
public List<MarkerOnlineTag> getIfSociety() {
return ifSociety;
}
public void setIfSociety(List<MarkerOnlineTag> ifSociety) {
this.ifSociety = ifSociety;
}
@Override
public String toString() {
return "MarkerHobbyDatum{" +
"singerTop2=" + singerTop2 +
", songTypeTop2=" + songTypeTop2 +
", newsType=" + newsType +
", listenBookTop2=" + listenBookTop2 +
", ifSociety=" + ifSociety +
'}';
}
}

View File

@@ -1,61 +0,0 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
@SuppressWarnings("unused")
public class MarkerLocation implements Serializable {
private double lat;//纬度
private double lon;//经度
private double angle;//车头角度,可以没有
private String address;//具体的位置信息
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public double getAngle() {
return angle;
}
public void setAngle(double angle) {
this.angle = angle;
}
public String getAddress() {
if (TextUtils.isEmpty(address)) {
return "";
}
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Override
public String toString() {
return "MarkerLocation{" +
"lat=" + lat +
", lon=" + lon +
", angle=" + angle +
", address='" + address + '\'' +
'}';
}
}

View File

@@ -1,195 +0,0 @@
package com.mogo.module.common.entity;
/**
* 新鲜事儿Marker数据
*/
public class MarkerNoveltyInfo {
private String type;
private String sn;
private MarkerLocation location;
private String poiType;
private ContentData contentData;
public ContentData getContentData() {
return contentData;
}
public void setContentData(ContentData contentData) {
this.contentData = contentData;
}
public MarkerLocation getLocation() {
return location;
}
public void setLocation(MarkerLocation location) {
this.location = location;
}
public String getPoiType() {
return poiType;
}
public void setPoiType(String poiType) {
this.poiType = poiType;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public static class ContentData {
private String content;
private String iconUrl;
private String imgUrl;
private String infoId;
private long likeNum;
private String title;
private String gasPrices;
private boolean displayNavigation;
private boolean desplayHost;
private boolean fabulous;
private String styleType;
//上报类型1-用户上报2-后台上报 3-三方上报
private String uploadType;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getIconUrl() {
return iconUrl;
}
public void setIconUrl(String iconUrl) {
this.iconUrl = iconUrl;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
public String getInfoId() {
return infoId;
}
public void setInfoId(String infoId) {
this.infoId = infoId;
}
public long getLikeNum() {
return likeNum;
}
public void setLikeNum(long likeNum) {
this.likeNum = likeNum;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public boolean isDisplayNavigation() {
return displayNavigation;
}
public void setDisplayNavigation(boolean displayNavigation) {
this.displayNavigation = displayNavigation;
}
public String getStyleType() {
return styleType;
}
public void setStyleType(String styleType) {
this.styleType = styleType;
}
public String getGasPrices() {
return gasPrices;
}
public void setGasPrices(String gasPrices) {
this.gasPrices = gasPrices;
}
public boolean isDesplayHost() {
return desplayHost;
}
public void setDesplayHost(boolean desplayHost) {
this.desplayHost = desplayHost;
}
public boolean isFabulous() {
return fabulous;
}
public void setFabulous(boolean fabulous) {
this.fabulous = fabulous;
}
public String getUploadType() {
return uploadType;
}
public void setUploadType(String uploadType) {
this.uploadType = uploadType;
}
@Override
public String toString() {
return "ContentData{" +
"content='" + content + '\'' +
", iconUrl='" + iconUrl + '\'' +
", imgUrl='" + imgUrl + '\'' +
", infoId='" + infoId + '\'' +
", likeNum=" + likeNum +
", title='" + title + '\'' +
", gasPrices='" + gasPrices + '\'' +
", displayNavigation=" + displayNavigation +
", desplayHost=" + desplayHost +
", fabulous=" + fabulous +
", styleType='" + styleType + '\'' +
", uploadType='" + uploadType + '\'' +
'}';
}
}
@Override
public String toString() {
return "MarkerNoveltyInfo{" +
"type='" + type + '\'' +
", sn='" + sn + '\'' +
", location=" + location +
", poiType='" + poiType + '\'' +
", contentData=" + contentData +
'}';
}
}

View File

@@ -1,105 +0,0 @@
package com.mogo.module.common.entity;
import java.io.Serializable;
import java.util.List;
public class MarkerOnlineCar implements Serializable {
private String type;//卡片类型
private MarkerLocation location;//所在位置
private Boolean isFocus;//isFocus":"0-未关注1-关注
private MarkerUserInfo userInfo;//用户数据
private MarkerCarInfo carInfo;//车辆数据
private List<MarkerCarPois> pois;//车辆路线
private MarkerDynamicData dynamicData;//动态数据
private MarkerHobbyDatum hobbyData;//爱好数据集合
private List<MarkerActivitiesScope> activitiesScope;//活动范围数据集合
private int compatibility;//匹配度
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public MarkerLocation getLocation() {
return location;
}
public void setLocation(MarkerLocation location) {
this.location = location;
}
public Boolean getFocus() {
return isFocus;
}
public void setFocus(Boolean focus) {
isFocus = focus;
}
public MarkerUserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(MarkerUserInfo userInfo) {
this.userInfo = userInfo;
}
public MarkerCarInfo getCarInfo() {
return carInfo;
}
public void setCarInfo(MarkerCarInfo carInfo) {
this.carInfo = carInfo;
}
public List<MarkerCarPois> getPois() {
return pois;
}
public void setPois(List<MarkerCarPois> pois) {
this.pois = pois;
}
public MarkerDynamicData getDynamicData() {
return dynamicData;
}
public void setDynamicData(MarkerDynamicData dynamicData) {
this.dynamicData = dynamicData;
}
public MarkerHobbyDatum getHobbyData() {
return hobbyData;
}
public void setHobbyData(MarkerHobbyDatum hobbyData) {
this.hobbyData = hobbyData;
}
public List<MarkerActivitiesScope> getActivitiesScope() {
return activitiesScope;
}
public void setActivitiesScope(List<MarkerActivitiesScope> activitiesScope) {
this.activitiesScope = activitiesScope;
}
public int getCompatibility() {
return compatibility;
}
public void setCompatibility(int compatibility) {
this.compatibility = compatibility;
}
@Override
public String toString() {
return "MarkerOnlineCar{" + "type='" + type + '\'' + ", location=" + location + ", " +
"isFocus=" + isFocus + ", userInfo=" + userInfo + ", carInfo=" + carInfo + ", " + "pois=" + pois + ", dynamicData=" + dynamicData + ", hobbyData=" + hobbyData + "," + " activitiesScope=" + activitiesScope + ", compatibility=" + compatibility + '}';
}
}

View File

@@ -1,41 +0,0 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
@SuppressWarnings("unused")
public class MarkerOnlineTag implements Serializable {
private String content;
private boolean isCheck;
public String getContent() {
if (TextUtils.isEmpty(content)) {
return "";
}
return content;
}
public void setContent(String content) {
this.content = content;
}
public boolean getIsCheck() {
return isCheck;
}
public void setIsCheck(boolean isCheck) {
this.isCheck = isCheck;
}
@Override
public String toString() {
return "MarkerHobbyDatum{" +
"content='" + content + '\'' +
", isCheck=" + isCheck +
'}';
}
}

View File

@@ -1,155 +0,0 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
@SuppressWarnings("unused")
public class MarkerShareMusic implements Serializable {
private String bookInfo;
private int id;
private int likeNumber;
private MarkerLocation location;
private String mediaId;
private String mediaImg;
private String mediaName;
private String mediaSinger;
private String mediaUrl;
private String shareContentText;
private int shareType;
private String type;
private MarkerUserInfo userInfo;
public String getBookInfo() {
return bookInfo;
}
public void setBookInfo(String bookInfo) {
this.bookInfo = bookInfo;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getLikeNumber() {
return likeNumber;
}
public void setLikeNumber(int likeNumber) {
this.likeNumber = likeNumber;
}
public String getMediaId() {
return mediaId;
}
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
public String getMediaImg() {
if (TextUtils.isEmpty(mediaImg)) {
return "";
}
return mediaImg;
}
public void setMediaImg(String mediaImg) {
this.mediaImg = mediaImg;
}
public String getMediaName() {
if (TextUtils.isEmpty(mediaName)) {
return "";
}
return mediaName;
}
public void setMediaName(String mediaName) {
this.mediaName = mediaName;
}
public String getMediaSinger() {
return mediaSinger;
}
public void setMediaSinger(String mediaSinger) {
this.mediaSinger = mediaSinger;
}
public String getMediaUrl() {
return mediaUrl;
}
public void setMediaUrl(String mediaUrl) {
this.mediaUrl = mediaUrl;
}
public String getShareContentText() {
return shareContentText;
}
public void setShareContentText(String shareContentText) {
this.shareContentText = shareContentText;
}
public int getShareType() {
return shareType;
}
public void setShareType(int shareType) {
this.shareType = shareType;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public MarkerUserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(MarkerUserInfo userInfo) {
this.userInfo = userInfo;
}
public MarkerLocation getLocation() {
return location;
}
public void setLocation(MarkerLocation location) {
this.location = location;
}
@Override
public String toString() {
return "MarkerShareMusic{" +
"bookInfo='" + bookInfo + '\'' +
", id=" + id +
", likeNumber=" + likeNumber +
", location=" + location +
", mediaId='" + mediaId + '\'' +
", mediaImg='" + mediaImg + '\'' +
", mediaName='" + mediaName + '\'' +
", mediaSinger='" + mediaSinger + '\'' +
", mediaUrl='" + mediaUrl + '\'' +
", shareContentText='" + shareContentText + '\'' +
", shareType=" + shareType +
", type='" + type + '\'' +
", userInfo=" + userInfo +
'}';
}
}

View File

@@ -1,131 +0,0 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import com.mogo.map.marker.IMogoMarker;
import java.lang.ref.WeakReference;
import java.util.Objects;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020-01-1015:47
* desc : 用来跟Marker View 绑定使用,内容、状态等设置
* version: 1.0
*/
public class MarkerShowEntity {
// false - 没选中true - 选中
private boolean isChecked;
// false - 非高亮true - 高亮
private boolean isHighlighted;
// icon 地址,例如:头像,唱片图片,探路缩略,可能为空展示默认图
private String iconUrl;
// 要展示的文本
private String textContent;
// Marker 类型
private String markerType;
// 绑定 MarkerView 的数据
private Object bindObj;
//Marker 经纬度位置信息
private MarkerLocation markerLocation;
private IMogoMarker mMarker;
public boolean isChecked() {
return isChecked;
}
public void setChecked(boolean checked) {
isChecked = checked;
}
public boolean isHighlighted() {
return isHighlighted;
}
public void setHighlighted(boolean highlighted) {
isHighlighted = highlighted;
}
public String getIconUrl() {
return iconUrl;
}
public void setIconUrl(String iconUrl) {
this.iconUrl = iconUrl;
}
public String getTextContent() {
if (TextUtils.isEmpty(textContent)) {
return "";
}
return textContent;
}
public void setTextContent(String textContent) {
this.textContent = textContent;
}
public String getMarkerType() {
return markerType;
}
public void setMarkerType(String markerType) {
this.markerType = markerType;
}
public Object getBindObj() {
return bindObj;
}
public void setBindObj(Object bindObj) {
this.bindObj = bindObj;
}
public MarkerLocation getMarkerLocation() {
return markerLocation;
}
public void setMarkerLocation(MarkerLocation markerLocation) {
this.markerLocation = markerLocation;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MarkerShowEntity that = (MarkerShowEntity) o;
return Objects.equals(iconUrl, that.iconUrl) &&
Objects.equals(textContent, that.textContent) &&
Objects.equals(markerType, that.markerType) &&
Objects.equals(bindObj, that.bindObj) &&
Objects.equals(markerLocation, that.markerLocation);
}
public void setMarker( IMogoMarker marker ) {
this.mMarker = marker;
}
public IMogoMarker getMarker() {
return mMarker;
}
@Override
public int hashCode() {
return Objects.hash(iconUrl, textContent, markerType, bindObj, markerLocation);
}
@Override
public String toString() {
return "MarkerShowEntity{" +
"isChecked=" + isChecked +
", isHighlighted=" + isHighlighted +
", iconUrl='" + iconUrl + '\'' +
", textContent='" + textContent + '\'' +
", markerType='" + markerType + '\'' +
", bindObj=" + bindObj +
", markerLocation=" + markerLocation +
'}';
}
}

View File

@@ -1,208 +0,0 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import java.io.Serializable;
import java.util.Calendar;
@SuppressWarnings("unused")
public class MarkerUserInfo implements Serializable {
private String sn;
private long userId;
private String userName;//用户昵称
private String userHead;//用户头像
private String gender;//gender": "男也可以012根据实际库存返回即可
private Integer age;// 年龄段,可以为空,与车聊聊一致
// TODO V2X临时字段接口出好后进行修改
private String lastActiveweekAvgscore;//末次活跃周驾驶行为平均得分
private String safeLabel;//车辆安全标签
private int safeLabelType;//1老司机 2安全驾驶 3危险驾驶
public void setAge(Integer age) {
this.age = age;
}
public int getAgeNumber() {
if (age != null) {
return age;
}
return -1;
}
public String getAge() {
try {
if (getAgeNumber() >= 0) {
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
//2020-30=1990
double ageDiffer = year - getAgeNumber();
String ageStr = "" + ageDiffer;
char[] ageChars = ageStr.toCharArray();
//1990
char ageChar = ageChars[2];
String ageString = "未设置";
switch (ageChar) {
case '0':
ageString = "00后";
break;
case '1':
ageString = "10后";
break;
case '2':
ageString = "20后";
break;
case '3':
ageString = "30后";
break;
case '4':
ageString = "40后";
break;
case '5':
ageString = "50后";
break;
case '6':
ageString = "60后";
break;
case '7':
ageString = "70后";
break;
case '8':
ageString = "80后";
break;
case '9':
ageString = "90后";
break;
}
return ageString;
} else {
return "";
}
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
public int getGenderValue() {
if (!TextUtils.isEmpty(gender)) {
if ("".equals(gender)) {
return 0;
}
return 1;
} else {
return 0;
}
}
public String getGender() {
if (TextUtils.isEmpty(gender)) {
return "未设置";
}
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public void setGender(int gender) {
if (gender == 0) {
this.gender = "";
} else {
this.gender = "";
}
}
public String getSn() {
if (TextUtils.isEmpty(sn)) {
return "";
}
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public String getUserHead() {
if (TextUtils.isEmpty(userHead)) {
return "";
}
return userHead;
}
public void setUserHead(String userHead) {
this.userHead = userHead;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserName() {
if (TextUtils.isEmpty(userName)) {
return "用户未设置昵称";
}
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public void setUserId(long userId) {
this.userId = userId;
}
public String getLastActiveweekAvgscore() {
return lastActiveweekAvgscore;
}
public void setLastActiveweekAvgscore(String lastActiveweekAvgscore) {
this.lastActiveweekAvgscore = lastActiveweekAvgscore;
}
public String getSafeLabel() {
return safeLabel;
}
public void setSafeLabel(String safeLabel) {
this.safeLabel = safeLabel;
}
public int getSafeLabelType() {
return safeLabelType;
}
public void setSafeLabelType(int safeLabelType) {
this.safeLabelType = safeLabelType;
}
@Override
public String toString() {
return "MarkerUserInfo{" +
"sn='" + sn + '\'' +
", userId=" + userId +
", userName='" + userName + '\'' +
", userHead='" + userHead + '\'' +
", gender='" + gender + '\'' +
", age=" + age +
", lastActiveweekAvgscore='" + lastActiveweekAvgscore + '\'' +
", safeLabel='" + safeLabel + '\'' +
", safeLabelType=" + safeLabelType +
'}';
}
}

View File

@@ -1,51 +0,0 @@
package com.mogo.module.common.entity;
import com.mogo.utils.sqlite.annotation.DbDatabase;
import com.mogo.utils.sqlite.annotation.DbField;
import com.mogo.utils.sqlite.annotation.DbTable;
/**
* V2X 被点赞的事件
*
* @author donghongyu
*/
@DbDatabase(dbName = "MoGoScenario.db")
@DbTable(tableName = "tb_event_zan")
public class V2XEventZanData {
/**
* 事件ID
*/
@DbField(fieldName = "eventId")
public String eventId;
/**
* 触发时间
*/
@DbField(fieldName = "triggerTime")
public Long triggerTime;
public String getEventId() {
return eventId;
}
public void setEventId(String eventId) {
this.eventId = eventId;
}
public Long getTriggerTime() {
return triggerTime;
}
public void setTriggerTime(Long triggerTime) {
this.triggerTime = triggerTime;
}
@Override
public String toString() {
return "V2XEventZanData{" +
"eventId=" + eventId +
", triggerTime=" + triggerTime +
'}';
}
}

View File

@@ -1,97 +0,0 @@
package com.mogo.module.common.entity;
import com.mogo.module.common.constants.RoomConstants;
import com.mogo.utils.sqlite.annotation.DbDatabase;
import com.mogo.utils.sqlite.annotation.DbField;
import com.mogo.utils.sqlite.annotation.DbTable;
/**
* V2X 道路历史事件
*
* @author donghongyu
*/
@DbDatabase(dbName = RoomConstants.DB_NAME_V2X)
@DbTable(tableName = RoomConstants.TB_NAME_SCENARIO)
public class V2XHistoryScenarioData {
/**
* 事件类型
*/
@DbField(fieldName = "scenarioType")
public Integer scenarioType;
/**
* 事件触发时间
*/
@DbField(fieldName = "triggerTime")
public Long triggerTime;
/**
* 事件json
*/
@DbField(fieldName = "eventJsonData")
public String eventJsonData;
/**
* 事件json HashCode
* 只取json中的几个代表性字段,表示唯一性,因为图片地址会经常被改变
*/
@DbField(fieldName = "eventJsonDataHashCode")
public Integer eventJsonDataHashCode;
/**
* 事件是否被处理过了true-处理过了。false-未处理过
*/
@DbField(fieldName = "isDispose")
public Boolean isDispose;
public Integer getScenarioType() {
return scenarioType;
}
public void setScenarioType(Integer scenarioType) {
this.scenarioType = scenarioType;
}
public String getEventJsonData() {
return eventJsonData;
}
public void setEventJsonData(String eventJsonData) {
this.eventJsonData = eventJsonData;
}
public Long getTriggerTime() {
return triggerTime;
}
public void setTriggerTime(Long triggerTime) {
this.triggerTime = triggerTime;
}
public Boolean isDispose() {
return isDispose;
}
public void setDispose(Boolean dispose) {
isDispose = dispose;
}
public Integer getEventJsonDataHashCode() {
return eventJsonDataHashCode;
}
public void setEventJsonDataHashCode(Integer eventJsonDataHashCode) {
this.eventJsonDataHashCode = eventJsonDataHashCode;
}
@Override
public V2XHistoryScenarioData clone() {
try {
return (V2XHistoryScenarioData) super.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return this;
}
}

View File

@@ -1,66 +0,0 @@
package com.mogo.module.common.entity;
import java.util.Objects;
/**
* 可直播车机基本信息,再通过 appDataService/integratedServices/app/push/no/livePush/v1
* 获取直播信息
* @author donghongyu
*/
public class V2XLiveCarInfoEntity {
private String sn;
private double lon;
private double lat;
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
V2XLiveCarInfoEntity that = (V2XLiveCarInfoEntity) o;
return Double.compare(that.lon, lon) == 0 &&
Double.compare(that.lat, lat) == 0 &&
Objects.equals(sn, that.sn);
}
@Override
public int hashCode() {
return Objects.hash(sn, lon, lat);
}
@Override
public String toString() {
return "V2XLiveCarEntity{" +
"sn='" + sn + '\'' +
", lon=" + lon +
", lat=" + lat +
'}';
}
}

View File

@@ -1,212 +0,0 @@
package com.mogo.module.common.entity;
import androidx.annotation.IntDef;
import java.io.Serializable;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Objects;
/**
* e-mail : 1358506549@qq.com
* date : 2020/5/15 4:35 PM
* desc : V2X 场景消息聚合
* version: 1.0
*
* @author donghongyu
*/
public class V2XMessageEntity<T> implements Serializable {
/**
* 场景类型
*
* @see V2XTypeEnum
*/
@MessageType
int type;
/**
* 是否展示对话框
* true-展示false-不展示
*/
boolean showState;
/**
* 是否需要判断重复事件
* true-判断false-不判断
* 默认需要判断
*/
boolean isNeedCompareSameScenario = true;
//是否播报tts
private boolean onlyShow = false;
//本机与事件是否连线
private boolean needAddLine = true;
/**
* 场景具体的数据内容
*/
T content;
public int getType() {
return type;
}
public void setType(@MessageType int type) {
this.type = type;
}
public boolean isShowState() {
return showState;
}
public void setShowState(boolean showState) {
this.showState = showState;
}
public boolean isNeedCompareSameScenario() {
return isNeedCompareSameScenario;
}
public void setNeedCompareSameScenario(boolean needCompareSameScenario) {
isNeedCompareSameScenario = needCompareSameScenario;
}
public T getContent() {
return content;
}
public void setContent(T content) {
this.content = content;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
V2XMessageEntity<?> that = (V2XMessageEntity<?>) o;
return type == that.type &&
content.equals(that.content);
}
@Override
public int hashCode() {
return Objects.hash(type, content);
}
public boolean isOnlyShow() {
return onlyShow;
}
public void setOnlyShow(boolean onlyShow) {
this.onlyShow = onlyShow;
}
public boolean isNeedAddLine() {
return needAddLine;
}
public void setNeedAddLine(boolean needAddLine) {
this.needAddLine = needAddLine;
}
/**
* V2X 场景类型
*/
public interface V2XTypeEnum {
// 默认展示详情
int DEFAULT_WINDOW = 0;
// 道路事件预警
int ALERT_ROAD_WARNING = 1_000;
// 他车求助预警
int ALERT_SEEK_WARNING = 1_001;
// 疲劳驾驶预警
int ALERT_FATIGUE_DRIVING = 1_002;
// 后台推送展示 Window
int ALERT_PUSH_WINDOW_WARNING = 1_003;
// 后台推送展示 Toast
int ALERT_PUSH_TOAST_WARNING = 1_004;
// 后台推送展示 展示的直播
int ALERT_PUSH_LIVE_CAR_WARNING = 1_005;
// V2X场景动画展示
int ALERT_ANIMATION_WARNING = 1_006;
// 道路事件直播预警
int ALERT_ROAD_LIVE_CAR_WARNING = 1_007;
// 道路事件违章停车
int ALERT_ILLEGAL_PARK_WARNING = 1_008;
// 用户UGC反馈事件准确性弹窗
int ALERT_EVENT_UGC_WARNING = 1_009;
// 呼叫、请求直播事件
int ALERT_VOICE_CALL_FOR_LIVECAR_SHOW = 1_010;
// 基于预判目的地道路事件的路线推荐
int ALERT_RECOMMEND_ROUTE = 1_011;
// 基于预判目的地违章高发停车场推荐
int ALERT_RECOMMEND_PARKING = 1_012;
// 弱势交通参与者401018
int ALERT_THE_FRONT_WEAKNESS = 40_1018;
// 关闭红色边框预警
int ALERT_THE_FRONT_CRASH_WARNING_NON = 0;
// 前方行人碰撞预警
int ALERT_THE_FRONT_CRASH_WARNING_TOP = 1;
// 后方碰撞预警
int ALERT_THE_FRONT_CRASH_WARNING_BOTTOM = 2;
// 左前方碰撞预警
int ALERT_THE_FRONT_CRASH_WARNING_LEFT = 3;
// 右前方碰撞预警
int ALERT_THE_FRONT_CRASH_WARNING_RIGHT = 4;
// 左后方碰撞预警
int ALERT_THE_FRONT_CRASH_WARNING_BOTTOM_LEFT = 5;
// 右后方碰撞预警
int ALERT_THE_FRONT_CRASH_WARNING_BOTTOM_RIGHT = 6;
// 推送VR消息展示
int ALERT_PUSH_VR_SHOW = 2_000;
// 自车求助
int ALERT_CAR_FOR_HELP = 8_000;
// obu事件
int ALERT_OBU_EVENT = 9_000;
}
@IntDef(value = {
V2XTypeEnum.ALERT_ROAD_WARNING,
V2XTypeEnum.ALERT_SEEK_WARNING,
V2XTypeEnum.ALERT_FATIGUE_DRIVING,
V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING,
V2XTypeEnum.ALERT_PUSH_TOAST_WARNING,
V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING,
V2XTypeEnum.ALERT_ANIMATION_WARNING,
V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING,
V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING,
V2XTypeEnum.ALERT_EVENT_UGC_WARNING,
V2XTypeEnum.ALERT_CAR_FOR_HELP,
V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW,
V2XTypeEnum.ALERT_RECOMMEND_ROUTE,
V2XTypeEnum.ALERT_RECOMMEND_PARKING,
V2XTypeEnum.ALERT_PUSH_VR_SHOW,
V2XTypeEnum.ALERT_OBU_EVENT,
V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS,
})
@Target({
ElementType.PARAMETER,
ElementType.FIELD,
ElementType.METHOD,
}) //表示注解作用范围,参数注解,成员注解,方法注解
@Retention(RetentionPolicy.SOURCE) //表示注解所存活的时间,在运行时,而不会存在 .class 文件中
public @interface MessageType { //接口,定义新的注解类型
}
@Override
public String toString() {
return "V2XMessageEntity{" +
"type=" + type +
", showState=" + showState +
", isNeedCompareSameScenario=" + isNeedCompareSameScenario +
", onlyShow=" + onlyShow +
", needAddLine=" + needAddLine +
", content=" + content +
'}';
}
}

View File

@@ -1,173 +0,0 @@
package com.mogo.module.common.entity;
import android.text.TextUtils;
import com.mogo.module.common.enums.EventTypeEnum;
import java.io.Serializable;
import java.util.Objects;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/13 11:17 AM
* desc : 道路事件的聚合位置、详情用于V2X情况下展示
* version: 1.0
*/
public class V2XRoadEventEntity implements Serializable {
/**
* @see EventTypeEnum
*/
// 事件类型
private String poiType;
// 事件位置
private MarkerLocation location;
// 具体的信息
private MarkerExploreWay noveltyInfo;
// tts 提示
private String tts;
// ADAS 展示文案
private String alarmContent;
// 距离当前车辆的距离
private double distance;
// 默认展示时间
private int expireTime;
// 展示Button
private boolean isShowEventButton;
// 绑定 MarkerView 的数据, 业务需要啥数据就传入啥数据
private Object bindObj;
public MarkerLocation getLocation() {
return location;
}
public void setLocation(MarkerLocation location) {
this.location = location;
}
public String getPoiType() {
if (TextUtils.isEmpty(poiType)) {
return "";
}
return poiType;
}
public void setPoiType(String poiType) {
this.poiType = poiType;
}
public String getTts(boolean haveLiveCar) {
if (EventTypeEnum.GHOST_PROBE.getPoiType().equals(poiType)) {
tts = EventTypeEnum.GHOST_PROBE.getTts();
return tts;
}
tts = "前方#" + (int) getDistance() + "米#";
tts += EventTypeEnum.getTts(getPoiType());
if (haveLiveCar) {
tts += ",查看实况请说确定。";
setShowEventButton(true);
} else {
tts += ",请注意躲避。";
setShowEventButton(false);
}
return tts;
}
/**
* 检测到附近#道路施工#,确认该信息是否正确?您可以说“正确”或“错误”帮助其他车友。
*/
public String getTtsWithFeedback() {
tts = "检测到附近";
tts += EventTypeEnum.getTtsWithFeedback(getPoiType());
tts += ",确认该信息是否正确?您可以说“正确”或“错误”帮助其他车友。";
return tts;
}
public String getTts() {
return tts;
}
public void setTts(String tts) {
this.tts = tts;
}
public boolean isShowEventButton() {
return isShowEventButton;
}
public void setShowEventButton(boolean showEventButton) {
isShowEventButton = showEventButton;
}
public String getAlarmContent() {
alarmContent = EventTypeEnum.getAlarmContent(getPoiType());
return alarmContent;
}
public void setAlarmContent(String alarmContent) {
this.alarmContent = alarmContent;
}
public double getDistance() {
return distance;
}
public void setDistance(double distance) {
this.distance = distance;
}
public int getExpireTime() {
return expireTime;
}
public void setExpireTime(int expireTime) {
this.expireTime = expireTime;
}
public MarkerExploreWay getNoveltyInfo() {
return noveltyInfo;
}
public void setNoveltyInfo(MarkerExploreWay noveltyInfo) {
this.noveltyInfo = noveltyInfo;
}
public Object getBindObj() {
return bindObj;
}
public void setBindObj(Object bindObj) {
this.bindObj = bindObj;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
V2XRoadEventEntity that = (V2XRoadEventEntity) o;
return Objects.equals(noveltyInfo.getInfoId(), that.noveltyInfo.getInfoId()) &&
Objects.equals(poiType, that.poiType);
}
@Override
public int hashCode() {
return Objects.hash(poiType, noveltyInfo.getInfoId());
}
@Override
public String toString() {
return "V2XRoadEventEntity{" +
"poiType='" + poiType + '\'' +
", location=" + location +
", noveltyInfo=" + noveltyInfo +
", tts='" + tts + '\'' +
", alarmContent='" + alarmContent + '\'' +
", distance=" + distance +
", expireTime=" + expireTime +
", isShowEventButton=" + isShowEventButton +
", bindObj=" + bindObj +
'}';
}
}

View File

@@ -1,268 +0,0 @@
package com.mogo.module.common.entity;
import com.mogo.eagle.core.data.map.MogoLatLng;
import java.io.Serializable;
import java.util.List;
/**
* @author liujing
* @description 预警目标物数据模型
* @since: 2021/3/26
*/
public class V2XWarningEntity implements Serializable {
//事件类型 行人1/自行车2/摩托车4/骑行车辆11
private int type;
//目标物位置
private double lat;
private double lon;
//目标物颜色
public String targetColor;
//目标物距离
private double distance;
//预测碰撞点位置
private double collisionLat;
private double collisionLon;
//朝向 角度
private double angle;
//方位 前 后 左 右
private int direction;
//速度
private float speed;
//停止线经纬度
private List<MogoLatLng> stopLines;
//自车到停止线距离
private double stopLineDistance;
//道路唯一标识
public String roadId;
//车道唯一标识
public String laneId;
//识别物体唯一标识
public String uuid;
//红绿灯颜色
public String color;
//车ID 暂不使用
public String carId;
//预警文案
private String warningContent;
//车头朝向
public double heading;
//系统时间 暂时没用
public long systemTime;
//定位卫星时间 暂时没用
public long satelliteTime;
//预警蒙层等展示时长
private long showTime;
//设计划线宽度与道路同宽
private float roadwidth;
//自组字段
//tts播报
private String tts;
//自车位置
private MogoLatLng carLocation;
public MogoLatLng getCarLocation() {
return carLocation;
}
public void setTts(int type) {
switch (type) {
case 1:
case 11:
this.tts = "注意行人";
break;
case 2:
this.tts = "注意自行车";
break;
case 4:
this.tts = "注意摩托车";
break;
default:
break;
}
}
public void setType(int type) {
this.type = type;
}
public void setDistance(double distance) {
this.distance = distance;
}
public void setLat(double lat) {
this.lat = lat;
}
public void setLon(double lon) {
this.lon = lon;
}
public void setCollisionLat(double collisionLat) {
this.collisionLat = collisionLat;
}
public void setCollisionLon(double collisionLon) {
this.collisionLon = collisionLon;
}
public void setAngle(double angle) {
this.angle = angle;
}
public void setDirection(int direction) {
this.direction = direction;
}
public void setTts(String tts) {
this.tts = tts;
}
public void setSpeed(float speed) {
this.speed = speed;
}
public long getShowTime() {
return showTime;
}
public void setShowTime(long showTime) {
this.showTime = showTime;
}
public void setStopLineDistance(double stopLineDistance) {
this.stopLineDistance = stopLineDistance;
}
public void setWarningContent(String warningContent) {
this.warningContent = warningContent;
}
public void setStopLines(List<MogoLatLng> stopLines) {
this.stopLines = stopLines;
}
public void setCarLocation(MogoLatLng carLocation) {
this.carLocation = carLocation;
}
public int getType() {
return type;
}
public double getLat() {
return lat;
}
public double getLon() {
return lon;
}
public double getCollisionLat() {
return collisionLat;
}
public double getCollisionLon() {
return collisionLon;
}
public double getDistance() {
return distance;
}
public double getAngle() {
return angle;
}
public int getDirection() {
return direction;
}
public float getSpeed() {
return speed;
}
public String getUuid() {
return uuid;
}
public String getColor() {
return color;
}
public String getWarningContent() {
return warningContent;
}
public double getHeading() {
return heading;
}
public long getSystemTime() {
return systemTime;
}
public long getSatelliteTime() {
return satelliteTime;
}
public String getTts() {
if (warningContent == null) {
setTts(type);
return tts;
}
return warningContent;
}
public double getStopLineDistance() {
return stopLineDistance;
}
public List<MogoLatLng> getStopLines() {
return stopLines;
}
public float getRoadwidth() {
return roadwidth;
}
public void setRoadwidth(float roadwidth) {
this.roadwidth = roadwidth;
}
@Override
public String toString() {
return "V2XWarningEntity{" +
"type=" + type +
", lat=" + lat +
", lon=" + lon +
", targetColor='" + targetColor + '\'' +
", distance=" + distance +
", collisionLat=" + collisionLat +
", collisionLon=" + collisionLon +
", angle=" + angle +
", direction=" + direction +
", speed=" + speed +
", stopLines=" + stopLines +
", stopLineDistance=" + stopLineDistance +
", roadId='" + roadId + '\'' +
", laneId='" + laneId + '\'' +
", uuid='" + uuid + '\'' +
", color='" + color + '\'' +
", carId='" + carId + '\'' +
", warningContent='" + warningContent + '\'' +
", heading=" + heading +
", systemTime=" + systemTime +
", satelliteTime=" + satelliteTime +
", showTime=" + showTime +
", roadwidth=" + roadwidth +
", tts='" + tts + '\'' +
", carLocation=" + carLocation +
'}';
}
}

View File

@@ -1,843 +0,0 @@
package com.mogo.module.common.enums
import com.mogo.module.common.R
import com.mogo.module.common.utils.CloudPoiManager
import com.zhidao.support.obu.constants.ObuConstants
/**
* OBU、V2N事件类型枚举类
*/
enum class EventTypeEnum(
val poiType: String, val poiTypeStr: String = "",
val poiTypeStrVr: String = "",
val poiTypeSrcVr: Int = R.drawable.v2x_icon_live_logo,
val content: String = "", val tts: String = ""
) {
//交通检查
TRAFFIC_CHECK(
"10002", "交通检查", "前方交通检查",
R.drawable.v2x_icon_jiaotongjiancha_vr, "前方交通检查", "交通检查"
),
//封路
ROAD_CLOSED(
"10003", "封路", "前方封路", R.drawable.v2x_icon_fenglu_vr,
"前方封路", "道路封路"
),
//施工
FOURS_ROAD_WORK(
"10006", "道路施工", "道路施工", R.drawable.icon_warning_v2x_road_construction,
"道路施工", "道路施工"
),
//施工-AI云下发
AI_ROAD_WORK(
"100061", "道路施工", "道路施工", R.drawable.icon_warning_v2x_road_construction,
"道路施工", "道路施工"
),
//拥堵
FOURS_BLOCK_UP(
"10007", "道路拥堵", "前方拥堵", R.drawable.icon_warning_v2x_congestion,
"前方道路拥堵", "道路拥堵"
),
//积水
FOURS_PONDING(
"10008", "道路积水", "前方道路积水", R.drawable.v2x_icon_jishui_vr,
"前方道路积水", "道路积水"
),
//浓雾
FOURS_FOG(
"10010", "出现浓雾", "浓雾预警", R.drawable.v2x_icon_nongwu_vr,
"前方出现浓雾", "出现浓雾"
),
//结冰
FOURS_ICE(
"10011", "路面结冰", "路面结冰", R.drawable.v2x_icon_jiebing_vr,
"前方路面结冰", "路面结冰"
),
//事故
FOURS_ACCIDENT(
"10013", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"
),
//重大事故
FOURS_ACCIDENT_01(
"1001301", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"
),
//特大事故
FOURS_ACCIDENT_02(
"1001302", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"
),
//较大事故
FOURS_ACCIDENT_03(
"1001303", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"
),
//一般事故
FOURS_ACCIDENT_04(
"1001304", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"
),
//轻微事故
FOURS_ACCIDENT_05(
"1001305", "交通事故", "前方交通事故", R.drawable.v2x_icon_jiaotongshigu_vr,
"前方交通事故", "交通事故"
),
//实时路况
FOURS_LIVING("10015", "实时路况"),
//违章停车
ILLEGAL_PARK_LIVING("10016"),
//路面湿滑
ROAD_SLIPPERY("10021"),
//鬼探头类型
GHOST_PROBE("10024", "前方盲区行人预警", "前方盲区行人预警", R.drawable.icon_warning_v2x_pedestrian_crossing,
"前方盲区行人通行,请注意", "前方盲区即将有行人通过,请减速慢行"),
//接管
TAKE_OVER_EVENT(
"20000", "注意周围、立即接管", "注意周围、立即接管", R.drawable.icon_warning_take_over,
"注意周围、立即接管", "自动驾驶退出请立即接管"
),
// 前方静止or慢速车辆报警
ALERT_FRONT_CAR("99999"),
// 限行管理
ALERT_TRAFFIC_CONTROL("99998"),
// 红绿灯事件、是建议以多少速度驶过
ALERT_TRAFFIC_LIGHT_SUGGEST("99997"),
// 红绿灯事件、一种是绿灯不足3秒
ALERT_TRAFFIC_LIGHT_WARNING("99996"),
// 故障车辆
ALERT_CAR_TROUBLE_WARNING("20007"),
// 疲劳驾驶
ALERT_FATIGUE_DRIVING("99993"),
// 违章停车
ALERT_ILLEGAL_PARK("99992"),
TYPE_USECASE_ID_EBW(
ObuConstants.USE_CASE_ID.EBW.toString(),
"紧急制动预警",
poiTypeSrcVr = R.drawable.icon_warning_v2x_emergency_brake,
content = "前车急刹车",
tts = "前车急刹车"
),
TYPE_USECASE_ID_FCW(
ObuConstants.USE_CASE_ID.FCW.toString(),
"前向碰撞预警",
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
content = "前车碰撞预警",
tts = "小心前车"
),
TYPE_USECASE_ID_ICW(
ObuConstants.USE_CASE_ID.ICW.toString(),
"交叉路口碰撞预警",
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
content = "交叉路口碰撞预警",
tts = "注意交叉路口车辆"
),
TYPE_USECASE_ID_CLW(
ObuConstants.USE_CASE_ID.CLW.toString(),
"车辆失控预警",
poiTypeSrcVr = R.drawable.icon_warning_v2x_vehicle_control,
content = "前%s失控预警",
tts = "小心%s失控车辆"
),
TYPE_USECASE_ID_DNPW(
ObuConstants.USE_CASE_ID.DNPW.toString(),
"逆向超车预警",
poiTypeSrcVr = R.drawable.icon_warning_v2x_reverse_overtaking,
content = "逆向超车预警",
tts = "注意对向来车"
),
TYPE_USECASE_ID_AVW(
ObuConstants.USE_CASE_ID.AVW.toString(),
"异常车辆提醒",
poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle,
content = "%s车异常",
tts = "小心%s异常车辆"
),
TYPE_USECASE_ID_BSW(
ObuConstants.USE_CASE_ID.BSW.toString(),
"盲区预警",
poiTypeSrcVr = R.drawable.icon_warning_v2x_blind_area_collision,
content = "%s后盲区预警",
tts = "注意%s后车辆"
),
TYPE_USECASE_ID_LCW(
ObuConstants.USE_CASE_ID.LCW.toString(),
"变道预警",
poiTypeSrcVr = R.drawable.icon_warning_v2x_reverse_overtaking,
content = "%s向变道预警",
tts = "注意%s后车辆"
),//注意左后车辆/注意右后车辆
TYPE_USECASE_ID_EVW(
ObuConstants.USE_CASE_ID.EVW.toString(),
"紧急车辆提醒",
poiTypeSrcVr = R.drawable.icon_warning_v2x_special_vehicle_access,
content = "注意特种车辆通行",
tts = "请避让特种车辆"
),
TYPE_USECASE_ID_VRUCW_PERSON(
0X2B0201.toString(),
"弱势交通参与者碰撞预警",
poiTypeSrcVr = R.drawable.icon_warning_v2x_pedestrian_crossing,
content = "注意行人",
tts = "注意行人"
),//行人/摩托车碰撞预警
TYPE_USECASE_ID_VRUCW_MOTORBIKE(
0X2B0202.toString(),
"弱势交通参与者碰撞预警",
poiTypeSrcVr = R.drawable.icon_warning_v2x_motorcycle_collision,
content = "注意摩托车",
tts = "注意摩托车"
),//摩托车碰撞预警
TYPE_USECASE_ID_SLW(
ObuConstants.USE_CASE_ID.SLW.toString(),
"限速预警",
poiTypeSrcVr = R.drawable.icon_warning_v2x_over_speed,
content = "已超速",
tts = "已超速"
),
TYPE_USECASE_ID_LTA(
ObuConstants.USE_CASE_ID.LTA.toString(),
"左转辅助",
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
content = "左转碰撞预警",
tts = "注意路口对向来车"
),
TYPE_USECASE_ID_HLW(
ObuConstants.USE_CASE_ID.HLW.toString(),
"道路危险情况预警",
poiTypeSrcVr = R.drawable.icon_warning_v2x_road_dangerous,
content = "道路危险情况预警",
tts = "前方路况危险,小心行驶"
),//(如果能给出具体的类别,则播报具体危险类别)
TYPE_USECASE_OPTIMAL_LANE(
ObuConstants.USE_CASE_ID.HLW.toString(),
"最优车道",
poiTypeSrcVr = R.drawable.v2x_icon_live_logo,
content = "最优车道",
tts = "最优车道"
),
TYPE_USECASE_ID_IVS(
ObuConstants.USE_CASE_ID.IVS.toString(),
"车内标牌",
poiTypeSrcVr = R.drawable.icon_warning_v2x_road_construction,
content = "车内标牌",
tts = ""
),
TYPE_USECASE_ID_TJW(
ObuConstants.USE_CASE_ID.TJW.toString(),
"前方拥堵提醒",
poiTypeSrcVr = R.drawable.icon_warning_v2x_congestion,
content = "前方%d米道路拥堵",
tts = "前方拥堵,减速慢行"
),
TYPE_USECASE_ID_IVP(
ObuConstants.USE_CASE_ID.IVP.toString(),
"闯红灯预警",
poiTypeSrcVr = R.drawable.icon_warning_v2x_traffic_lights_red,
content = "路口红灯,禁止通行",
tts = "路口红灯,禁止通行"
),
TYPE_USECASE_ID_IVP_GREEN(
0x2B091.toString(),
"绿波通行",
poiTypeSrcVr = R.drawable.icon_warning_v2x_traffic_lights_green,
content = "建议车速 %s KM/H",
tts = "建议车速 %s KM/H"
),
TYPE_USECASE_ID_COC(
ObuConstants.USE_CASE_ID.COC.toString(),
"预留",
poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle,
content = "路况预警",
tts = "路况预警"
),
TYPE_USECASE_ID_ROAD_TRAMCAR(
0x2C01.toString(),
"前方有轨电车提醒",
poiTypeSrcVr = R.drawable.icon_warning_v2x_tramcar,
content = "注意前方有轨电车",
tts = "注意前方有轨电车驶过"
),
TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP(
0x2C02.toString(),
"前方左转急弯",
poiTypeSrcVr = R.drawable.icon_warning_v2x_turn_left_sharp,
content = "注意前方左转急弯",
tts = "前方路口左转急弯,减速慢行",
),
TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP(
0x2C03.toString(),
"前方右转急弯",
poiTypeSrcVr = R.drawable.icon_warning_v2x_turn_right_sharp,
content = "注意前方右转急弯",
tts = "前方路口右转急弯,减速慢行"
),
TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING(
0x2C04.toString(),
"人行横道",
poiTypeSrcVr = R.drawable.icon_warning_v2x_pedestrian_crossing,
content = "注意前方人行横道",
tts = "前方人行横道,减速慢行"
),
TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL(
0x2C05.toString(),
"学校",
poiTypeSrcVr = R.drawable.icon_warning_v2x_school,
content = "注意前方学校",
tts = "前方学校,减速慢行"
),
TYPE_USECASE_ID_ROAD_COLLISION_WARNING(
0x2C06.toString(),
"事故易发路段",
poiTypeSrcVr = R.drawable.icon_warning_v2x_collision_warning,
content = "注意当前路段事故多发",
tts = "当前路段事故多发,请小心驾驶"
),
TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG(
0x2C07.toString(),
"环岛行驶",
poiTypeSrcVr = R.drawable.icon_warning_v2x_roundaboutpng,
content = "注意前方驶入环岛",
tts = "即将驶入环岛,减速慢行"
),
TYPE_USECASE_ID_ROAD_TEST_SECTION(
0x2C08.toString(),
"驾校考试路段",
poiTypeSrcVr = R.drawable.icon_warning_v2x_test_section,
content = "注意前方驾校考试路段",
tts = "驾校考试路段,请小心驾驶"
),
TYPE_USECASE_ID_ROAD_HUMP_BRIDGE(
0x2C09.toString(),
"驼峰桥",
poiTypeSrcVr = R.drawable.icon_warning_v2x_hump_bridge,
content = "注意前方驼峰桥",
tts = "注意即将驶入驼峰桥,请小心驾驶"
),
TYPE_USECASE_ID_ROAD_NO_PARKING(
0x2C10.toString(),
"禁止停车",
poiTypeSrcVr = R.drawable.icon_warning_v2x_no_parking,
content = "注意当前路段禁止停车",
tts = "当前路段,禁止停车"
),
TYPE_USECASE_ID_ROAD_GIVE_WAY(
0x2C11.toString(),
"减速慢行",
poiTypeSrcVr = R.drawable.icon_warning_v2x_give_way,
content = "注意路况复杂,减速慢行",
tts = "路况复杂,减速慢行"
),
TYPE_ERROR(
ObuConstants.USE_CASE_ID.ERROR.toString(),
"未知/错误/异常",
poiTypeSrcVr = R.drawable.icon_warning_v2x_abnormal_vehicle,
content = "",
tts = ""
),
TYPE_VIP_IDENTIFICATION("10022", "", "", R.drawable.icon_warning_v2x_vip_turn_light, "VIP车辆优先通行", "已为您变灯,请优先通行"),
TYPE_VIP_ERROR_IDENTIFICATION("10023", "", "", R.drawable.icon_warning_v2x_vip_turn_light, "请求失败,", "请求失败,请稍后重试"),
TYPE_OPTIMAL_ROUTE_RECOMMEND("2000", "", "", R.drawable.icon_warning_v2x_optimal_route, "为您推荐最优路线", "已为您选择最优路线");
companion object {
@JvmStatic
fun getPoiTypeStr(poiType: String): String {
// 先获取网络配置的poi对应的名称
CloudPoiManager.getInstance().getWrapperByPoiType(poiType)?.let {
return it.title
}
// 如果获取不到,那么就用本地默认的
return when (poiType) {
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeStr
ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeStr
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeStr
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeStr
FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeStr
FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeStr
FOURS_FOG.poiType -> FOURS_FOG.poiTypeStr
FOURS_ICE.poiType -> FOURS_ICE.poiTypeStr
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType,
FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeStr
FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeStr
GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeStr
else -> "其它道路事件"
}
}
@JvmStatic
fun getPoiTypeStrVr(poiType: String): String {
return when (poiType) {
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeStrVr
ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeStrVr
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeStrVr
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeStrVr
FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeStrVr
FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeStrVr
FOURS_FOG.poiType -> FOURS_FOG.poiTypeStrVr
FOURS_ICE.poiType -> FOURS_ICE.poiTypeStrVr
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType,
FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeStrVr
FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeStrVr
GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeStrVr
else -> "其它道路事件"
}
}
@JvmStatic
fun getPoiTypeSrcVr(poiType: String): Int {
return when (poiType) {
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeSrcVr
ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeSrcVr
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeSrcVr
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeSrcVr
FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeSrcVr
FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeSrcVr
FOURS_FOG.poiType -> FOURS_FOG.poiTypeSrcVr
FOURS_ICE.poiType -> FOURS_ICE.poiTypeSrcVr
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType,
FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.poiTypeSrcVr
FOURS_LIVING.poiType -> FOURS_LIVING.poiTypeSrcVr
else -> R.drawable.v2x_icon_live_logo
}
}
/**
* 获取道路事件的背景色
*/
@JvmStatic
fun getPoiTypeBg(poiType: String, isVrMode: Boolean): Int {
return when (poiType) {
FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType-> if (isVrMode) R.drawable.bg_v2x_event_type_orange_vr else R.drawable.bg_v2x_event_type_orange
TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType,
FOURS_PONDING.poiType, FOURS_FOG.poiType, FOURS_ICE.poiType, FOURS_ACCIDENT.poiType,
FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> if (isVrMode) R.drawable.bg_v2x_event_type_red_vr else R.drawable.bg_v2x_event_type_read
else -> {
if (isVrMode) R.drawable.bg_v2x_event_type_red_vr else R.drawable.bg_v2x_event_type_read
}
}
}
@JvmStatic
fun getPoiTypeBgForShareItem(poiType: String): Int {
return when (poiType) {
FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType ->
R.drawable.bg_v2x_event_type_orange
TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType,
FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, FOURS_PONDING.poiType,
FOURS_FOG.poiType, FOURS_ICE.poiType,
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType,
FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType,
FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType ->
R.drawable.bg_v2x_event_type_read
else -> R.drawable.bg_v2x_event_type_read
}
}
/**
* 判断是否是道路预警事件
*/
@JvmStatic
fun isRoadEvent(poiType: String?): Boolean {
return when (poiType) {
TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType,
FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, FOURS_BLOCK_UP.poiType,
FOURS_PONDING.poiType, FOURS_FOG.poiType,
FOURS_ICE.poiType, FOURS_ACCIDENT.poiType,
FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType,
FOURS_ACCIDENT_05.poiType, GHOST_PROBE.poiType, AI_ROAD_WORK.poiType -> true
else -> false
}
}
/**
* 是否需要UGC预警
*/
@JvmStatic
fun isNeedRoadEventUgc(poiType: String?): Boolean {
return when (poiType) {
ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType,
FOURS_BLOCK_UP.poiType, FOURS_ACCIDENT.poiType,
FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType,
FOURS_ACCIDENT_05.poiType, GHOST_PROBE.poiType -> true
else -> false
}
}
@JvmStatic
fun getTts(poiType: String?): String {
return when (poiType) {
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.tts
ROAD_CLOSED.poiType -> ROAD_CLOSED.tts
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.tts
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.tts
FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.tts
FOURS_PONDING.poiType -> FOURS_PONDING.tts
FOURS_FOG.poiType -> FOURS_FOG.tts
FOURS_ICE.poiType -> FOURS_ICE.tts
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.tts
else -> "道路事件"
}
}
@JvmStatic
fun getTtsWithFeedback(poiType: String?): String {
return when (poiType) {
TRAFFIC_CHECK.poiType -> "交通检查"
ROAD_CLOSED.poiType -> "封路"
FOURS_ROAD_WORK.poiType -> "施工"
AI_ROAD_WORK.poiType -> "施工"
FOURS_BLOCK_UP.poiType -> "道路拥堵"
FOURS_PONDING.poiType -> "道路积水"
FOURS_FOG.poiType -> "出现浓雾"
FOURS_ICE.poiType -> "路面结冰"
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故"
else -> "道路事件"
}
}
@JvmStatic
fun getAlarmContent(poiType: String?): String {
return when (poiType) {
TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.content
ROAD_CLOSED.poiType -> ROAD_CLOSED.content
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.content
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.content
FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.content
FOURS_PONDING.poiType -> FOURS_PONDING.content
FOURS_FOG.poiType -> FOURS_FOG.content
FOURS_ICE.poiType -> FOURS_ICE.content
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType ->
FOURS_ACCIDENT.content
GHOST_PROBE.poiType -> GHOST_PROBE.content
else -> "道路事件"
}
}
@JvmStatic
fun getTypeSmallRes(type: String): Int {
return when (type) {
TRAFFIC_CHECK.poiType ->
R.drawable.mogo_image_jiaotongjiancha_small
ROAD_CLOSED.poiType -> R.drawable.mogo_image_fenglu_small
FOURS_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_small
AI_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_small
FOURS_BLOCK_UP.poiType -> R.drawable.mogo_image_yongdu_small
FOURS_PONDING.poiType -> R.drawable.mogo_image_jishui_small
FOURS_ICE.poiType -> R.drawable.mogo_image_jiebing_small
FOURS_FOG.poiType -> R.drawable.mogo_image_nongwu_small
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType ->
R.drawable.mogo_image_accident_small
else -> R.drawable.mogo_image_shishilukuang_small
}
}
@JvmStatic
fun getTypeRes(type: String): Int {
return when (type) {
TRAFFIC_CHECK.poiType -> R.drawable.mogo_image_jiaotongjiancha_nor
ROAD_CLOSED.poiType -> R.drawable.mogo_image_fenglu_nor
FOURS_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_nor
AI_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_nor
FOURS_BLOCK_UP.poiType -> R.drawable.mogo_image_yongdu_nor
FOURS_PONDING.poiType -> R.drawable.mogo_image_jishui_nor
FOURS_ICE.poiType -> R.drawable.mogo_image_jiebing_nor
FOURS_FOG.poiType -> R.drawable.mogo_image_nongwu_nor
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType ->
R.drawable.mogo_image_jiaotongshigu_nor
else -> R.drawable.mogo_image_shishlukuang_nor
}
}
@JvmStatic
fun getTypeName(type: String?): String {
return when (type) {
ROAD_CLOSED.poiType -> "封路"
FOURS_ICE.poiType -> "道路结冰"
FOURS_FOG.poiType -> "浓雾"
TRAFFIC_CHECK.poiType -> "交通检查"
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故"
FOURS_BLOCK_UP.poiType -> "拥堵"
FOURS_ROAD_WORK.poiType -> "施工"
AI_ROAD_WORK.poiType -> "施工"
FOURS_PONDING.poiType -> "道路积水"
else -> "实时路况"
}
}
@JvmStatic
fun getMarker3DRes(poiType: String?): Int {
return when (poiType) {
FOURS_BLOCK_UP.poiType -> R.raw.v2x_yongdu
FOURS_ACCIDENT.poiType -> R.raw.v2x_shigu
FOURS_LIVING.poiType -> R.raw.v2x_shishilukuang
FOURS_FOG.poiType -> R.raw.v2x_nongwu
TRAFFIC_CHECK.poiType -> R.raw.v2x_jiaotongjiancha
FOURS_ROAD_WORK.poiType -> R.raw.v2x_daolushigong
AI_ROAD_WORK.poiType -> R.raw.v2x_daolushigong
FOURS_ICE.poiType -> R.raw.v2x_daolujiebing
FOURS_PONDING.poiType -> R.raw.v2x_daolujishui
GHOST_PROBE.poiType -> R.raw.v2x_guzhangqiuzhu
else -> 0
}
}
@JvmStatic
fun getTypeNameTTS(type: String?): String {
return when (type) {
ROAD_CLOSED.poiType -> "封路"
FOURS_ICE.poiType -> "道路结冰"
FOURS_FOG.poiType -> "浓雾"
TRAFFIC_CHECK.poiType -> "交通检查"
FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType,
FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故"
FOURS_BLOCK_UP.poiType -> "拥堵"
FOURS_ROAD_WORK.poiType -> "施工"
AI_ROAD_WORK.poiType -> "施工"
FOURS_PONDING.poiType -> "道路积水"
else -> "实时路况"
}
}
@JvmStatic
fun getUpdateIconRes(poiType: String?): Int {
return when (poiType) {
//交通检查
TRAFFIC_CHECK.poiType -> {
R.drawable.v_to_x_marker_2
}
//封路
ROAD_CLOSED.poiType -> {
R.drawable.v_to_x_marker_16
}
//施工
FOURS_ROAD_WORK.poiType -> {
R.drawable.v_to_x_marker_11
}
//AI施工
AI_ROAD_WORK.poiType -> {
R.drawable.v_to_x_marker_11
}
//拥堵
FOURS_BLOCK_UP.poiType -> {
R.drawable.v_to_x_marker_5
}
//积水
FOURS_PONDING.poiType -> {
R.drawable.v_to_x_marker_6
}
//浓雾
FOURS_FOG.poiType -> {
R.drawable.v_to_x_marker_9
}
//结冰
FOURS_ICE.poiType -> {
R.drawable.v_to_x_marker_8
}
//事故
FOURS_ACCIDENT.poiType -> {
R.drawable.v_to_x_marker_7
}
//事故
FOURS_LIVING.poiType -> {
R.drawable.v_to_x_marker_1
}
//红绿灯数据
ALERT_TRAFFIC_LIGHT_SUGGEST.poiType -> {
R.drawable.v_to_x_marker_3
}
//红绿灯数据
ALERT_TRAFFIC_LIGHT_WARNING.poiType -> {
R.drawable.v_to_x_marker_3
}
//前方静止or慢速车辆报警
ALERT_FRONT_CAR.poiType -> {
R.drawable.v_to_x_warning_car_red
}
// 故障车辆
ALERT_CAR_TROUBLE_WARNING.poiType -> {
R.drawable.icon_car_red
}
else -> 0
}
}
//===================告警类事件===================
@JvmStatic
fun getWarningIcon(poiType: String?): Int {
return when (poiType) {
TYPE_USECASE_ID_EBW.poiType -> TYPE_USECASE_ID_EBW.poiTypeSrcVr
TYPE_USECASE_ID_FCW.poiType -> TYPE_USECASE_ID_FCW.poiTypeSrcVr
TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.poiTypeSrcVr
TYPE_USECASE_ID_CLW.poiType -> TYPE_USECASE_ID_CLW.poiTypeSrcVr
TYPE_USECASE_ID_DNPW.poiType -> TYPE_USECASE_ID_DNPW.poiTypeSrcVr
TYPE_USECASE_ID_AVW.poiType -> TYPE_USECASE_ID_AVW.poiTypeSrcVr
TYPE_USECASE_ID_BSW.poiType -> TYPE_USECASE_ID_BSW.poiTypeSrcVr
TYPE_USECASE_ID_LCW.poiType -> TYPE_USECASE_ID_LCW.poiTypeSrcVr
TYPE_USECASE_ID_EVW.poiType -> TYPE_USECASE_ID_EVW.poiTypeSrcVr
TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.poiTypeSrcVr
TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType -> TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiTypeSrcVr
TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.poiTypeSrcVr
TYPE_USECASE_ID_LTA.poiType -> TYPE_USECASE_ID_LTA.poiTypeSrcVr
TYPE_USECASE_ID_HLW.poiType -> TYPE_USECASE_ID_HLW.poiTypeSrcVr
TYPE_USECASE_ID_IVS.poiType -> TYPE_USECASE_ID_IVS.poiTypeSrcVr
TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.poiTypeSrcVr
TYPE_USECASE_ID_IVP.poiType -> TYPE_USECASE_ID_IVP.poiTypeSrcVr
TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.poiTypeSrcVr
TYPE_USECASE_ID_COC.poiType -> TYPE_USECASE_ID_COC.poiTypeSrcVr
TYPE_USECASE_ID_ROAD_TRAMCAR.poiType -> TYPE_USECASE_ID_ROAD_TRAMCAR.poiTypeSrcVr
TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiTypeSrcVr
TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiTypeSrcVr
TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiTypeSrcVr
TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiTypeSrcVr
TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType -> TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiTypeSrcVr
TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiType -> TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiTypeSrcVr
TYPE_USECASE_ID_ROAD_TEST_SECTION.poiType -> TYPE_USECASE_ID_ROAD_TEST_SECTION.poiTypeSrcVr
TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType -> TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiTypeSrcVr
TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.poiTypeSrcVr
TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType -> TYPE_USECASE_ID_ROAD_GIVE_WAY.poiTypeSrcVr
TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.poiTypeSrcVr
TYPE_ERROR.poiType -> TYPE_ERROR.poiTypeSrcVr
TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.poiTypeSrcVr
GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeSrcVr
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeSrcVr
else -> TYPE_ERROR.poiTypeSrcVr
}
}
@JvmStatic
fun getWarningContent(poiType: String?): String {
return when (poiType) {
TYPE_USECASE_ID_EBW.poiType -> TYPE_USECASE_ID_EBW.content
TYPE_USECASE_ID_FCW.poiType -> TYPE_USECASE_ID_FCW.content
TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.content
TYPE_USECASE_ID_CLW.poiType -> TYPE_USECASE_ID_CLW.content
TYPE_USECASE_ID_DNPW.poiType -> TYPE_USECASE_ID_DNPW.content
TYPE_USECASE_ID_AVW.poiType -> TYPE_USECASE_ID_AVW.content
TYPE_USECASE_ID_BSW.poiType -> TYPE_USECASE_ID_BSW.content
TYPE_USECASE_ID_LCW.poiType -> TYPE_USECASE_ID_LCW.content
TYPE_USECASE_ID_EVW.poiType -> TYPE_USECASE_ID_EVW.content
TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.content
TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType -> TYPE_USECASE_ID_VRUCW_MOTORBIKE.content
TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.content
TYPE_USECASE_ID_LTA.poiType -> TYPE_USECASE_ID_LTA.content
TYPE_USECASE_ID_HLW.poiType -> TYPE_USECASE_ID_HLW.content
TYPE_USECASE_ID_IVS.poiType -> TYPE_USECASE_ID_IVS.content
TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.content
TYPE_USECASE_ID_IVP.poiType -> TYPE_USECASE_ID_IVP.content
TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.content
TYPE_USECASE_ID_COC.poiType -> TYPE_USECASE_ID_COC.content
TYPE_USECASE_ID_ROAD_TRAMCAR.poiType -> TYPE_USECASE_ID_ROAD_TRAMCAR.content
TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.content
TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.content
TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.content
TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.content
TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType -> TYPE_USECASE_ID_ROAD_COLLISION_WARNING.content
TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiType -> TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.content
TYPE_USECASE_ID_ROAD_TEST_SECTION.poiType -> TYPE_USECASE_ID_ROAD_TEST_SECTION.content
TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType -> TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.content
TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.content
TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType -> TYPE_USECASE_ID_ROAD_GIVE_WAY.content
TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.content
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.content
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.content
TYPE_ERROR.poiType -> TYPE_ERROR.content
TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.content
GHOST_PROBE.poiType -> GHOST_PROBE.content
else -> TYPE_ERROR.content
}
}
@JvmStatic
fun getWarningTts(poiType: String?): String {
return when (poiType) {
TYPE_USECASE_ID_EBW.poiType -> TYPE_USECASE_ID_EBW.tts
TYPE_USECASE_ID_FCW.poiType -> TYPE_USECASE_ID_FCW.tts
TYPE_USECASE_ID_ICW.poiType -> TYPE_USECASE_ID_ICW.tts
TYPE_USECASE_ID_CLW.poiType -> TYPE_USECASE_ID_CLW.tts
TYPE_USECASE_ID_DNPW.poiType -> TYPE_USECASE_ID_DNPW.tts
TYPE_USECASE_ID_AVW.poiType -> TYPE_USECASE_ID_AVW.tts
TYPE_USECASE_ID_BSW.poiType -> TYPE_USECASE_ID_BSW.tts
TYPE_USECASE_ID_LCW.poiType -> TYPE_USECASE_ID_LCW.tts
TYPE_USECASE_ID_EVW.poiType -> TYPE_USECASE_ID_EVW.tts
TYPE_USECASE_ID_VRUCW_PERSON.poiType -> TYPE_USECASE_ID_VRUCW_PERSON.tts
TYPE_USECASE_ID_VRUCW_MOTORBIKE.poiType -> TYPE_USECASE_ID_VRUCW_MOTORBIKE.tts
TYPE_USECASE_ID_SLW.poiType -> TYPE_USECASE_ID_SLW.tts
TYPE_USECASE_ID_LTA.poiType -> TYPE_USECASE_ID_LTA.tts
TYPE_USECASE_ID_HLW.poiType -> TYPE_USECASE_ID_HLW.tts
TYPE_USECASE_ID_IVS.poiType -> TYPE_USECASE_ID_IVS.tts
TYPE_USECASE_ID_TJW.poiType -> TYPE_USECASE_ID_TJW.tts
TYPE_USECASE_ID_IVP.poiType -> TYPE_USECASE_ID_IVP.tts
TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.tts
TYPE_USECASE_ID_COC.poiType -> TYPE_USECASE_ID_COC.tts
TYPE_USECASE_ID_ROAD_TRAMCAR.poiType -> TYPE_USECASE_ID_ROAD_TRAMCAR.tts
TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_LEFT_SHARP.tts
TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.poiType -> TYPE_USECASE_ID_ROAD_TURN_RIGHT_SHARP.tts
TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_CROSSING.tts
TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.poiType -> TYPE_USECASE_ID_ROAD_PEDESTRIAN_SCHOOL.tts
TYPE_USECASE_ID_ROAD_COLLISION_WARNING.poiType -> TYPE_USECASE_ID_ROAD_COLLISION_WARNING.tts
TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.poiType -> TYPE_USECASE_ID_ROAD_ROUNDABOUTPNG.tts
TYPE_USECASE_ID_ROAD_TEST_SECTION.poiType -> TYPE_USECASE_ID_ROAD_TEST_SECTION.tts
TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.poiType -> TYPE_USECASE_ID_ROAD_HUMP_BRIDGE.tts
TYPE_USECASE_ID_ROAD_NO_PARKING.poiType -> TYPE_USECASE_ID_ROAD_NO_PARKING.tts
TYPE_USECASE_ID_ROAD_GIVE_WAY.poiType -> TYPE_USECASE_ID_ROAD_GIVE_WAY.tts
TYPE_VIP_IDENTIFICATION.poiType -> TYPE_VIP_IDENTIFICATION.tts
FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.tts
AI_ROAD_WORK.poiType -> AI_ROAD_WORK.tts
TYPE_ERROR.poiType -> TYPE_ERROR.tts
TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.tts
GHOST_PROBE.poiType -> GHOST_PROBE.tts
else -> TYPE_ERROR.tts
}
}
}
}

View File

@@ -1,189 +0,0 @@
package com.mogo.module.common.enums
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_AVW
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_BSW
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_CLW
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_DNPW
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_EBW
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_FCW
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_LCW
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_LTA
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_OPT_LINE
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_VRU
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_VRU_RI
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2N
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.V2V
import com.mogo.eagle.core.data.enums.WarningDirectionEnum
import com.mogo.eagle.core.data.enums.isLeft
import com.mogo.eagle.core.data.enums.isRight
import com.zhjt.service_biz.BizConfig
class EventTypeHelper {
companion object {
//变道预警
@BizConfig(V2V, "", BIZ_LCW)
fun getLCW(
appId: Int,
direction: WarningDirectionEnum,
data: ((alert: String, tts: String) -> Unit)
) {
when {
direction.isLeft() -> {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString() + ""),
EventTypeEnum.getWarningTts(appId.toString() + "")
)
}
direction.isRight() -> {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString() + ""),
EventTypeEnum.getWarningTts(appId.toString() + "")
)
}
else -> {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString()),
EventTypeEnum.getWarningTts(appId.toString())
)
}
}
}
//车辆失控预警
@BizConfig(V2V, "", BIZ_CLW)
fun getCLW(
appId: Int,
direction: WarningDirectionEnum,
data: ((alert: String, tts: String) -> Unit)
) {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString() + direction.desc),
EventTypeEnum.getWarningContent(appId.toString() + direction.desc)
)
}
//左转辅助
@BizConfig(V2V, "", BIZ_LTA)
fun getLTA(appId: Int, data: ((alert: String, tts: String) -> Unit)) {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString()),
EventTypeEnum.getWarningTts(appId.toString())
)
}
//异常车辆提醒
@BizConfig(V2V, "", BIZ_AVW)
fun getAVW(
appId: Int,
direction: WarningDirectionEnum,
data: ((alert: String, tts: String) -> Unit)
) {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString() + direction.desc),
EventTypeEnum.getWarningTts(appId.toString() + direction.desc)
)
}
//盲区预警
@BizConfig(V2V, "", BIZ_BSW)
fun getBSW(
appId: Int,
direction: WarningDirectionEnum,
data: ((alert: String, tts: String, visualAngle: Boolean) -> Unit)
) {
when {
direction.isLeft() -> {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString() + ""),
EventTypeEnum.getWarningTts(appId.toString() + ""),
true
)
}
direction.isRight() -> {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString() + ""),
EventTypeEnum.getWarningTts(appId.toString() + ""),
true
)
}
else -> {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString()),
EventTypeEnum.getWarningTts(appId.toString()),
false
)
}
}
}
//弱势交通碰撞预警
@BizConfig(V2N, "", BIZ_VRU)
fun getVRU(data: ((appId: Int, tts: String, content: String) -> Unit)) {
data.invoke(
EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt(),
EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.tts,
EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.content
)
}
//弱势交通逆行预警
@BizConfig(V2N, "", BIZ_VRU_RI)
fun getVRURI(data: ((appId: Int, tts: String, content: String) -> Unit)) {
data.invoke(
EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt(),
"行人逆行预警",
"行人逆行预警"
)
}
//最优车道
@BizConfig(V2N, "", BIZ_OPT_LINE)
fun getOptLine(data: ((appId: Int, tts: String, content: String) -> Unit)) {
data.invoke(
EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.poiType.toInt(),
EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.tts,
EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.content
)
}
//前方道路拥堵预警
fun getTJW(data: ((appId: Int, tts: String, content: String) -> Unit)) {
data.invoke(
EventTypeEnum.FOURS_BLOCK_UP.poiType.toInt(),
EventTypeEnum.FOURS_BLOCK_UP.tts,
EventTypeEnum.FOURS_BLOCK_UP.content
)
}
//前车急刹
@BizConfig(V2V, "", BIZ_EBW)
fun getEBW(appId: Int, data: ((tts: String, content: String) -> Unit)) {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString()),
EventTypeEnum.getWarningTts(appId.toString())
)
}
//前向碰撞预警
@BizConfig(V2V, "", BIZ_FCW)
fun getFCW(appId: Int, data: ((tts: String, content: String) -> Unit)) {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString()),
EventTypeEnum.getWarningTts(appId.toString())
)
}
//逆向超车预警
@BizConfig(V2V, "", BIZ_DNPW)
fun getDNPW(appId: Int, data: ((tts: String, content: String) -> Unit)) {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString()),
EventTypeEnum.getWarningTts(appId.toString())
)
}
}
}

View File

@@ -8,7 +8,7 @@ import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.module.common.R;
import com.mogo.module.common.enums.EventTypeEnum;
import com.mogo.eagle.core.data.enums.EventTypeEnum;
import com.mogo.module.common.marker.PoiWrapper;
import java.util.List;

View File

@@ -1,96 +0,0 @@
package com.mogo.module.common.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.mogo.module.common.R;
import com.mogo.module.common.animation.AnimationResources;
import com.mogo.module.common.animation.AnimationManager;
public class NetworkLoadingView extends RelativeLayout {
private ProgressBar loadView;
private TextView textView;
private AnimationManager mAnimationManager;
public Button refresButton;
private String loadingText = "正在获取信息…";
public NetworkLoadingView(Context context) {
super(context);
}
public NetworkLoadingView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.network_loading_item, this);
initView();
/*
添加动画图片资源
* */
setLoadingImage(AnimationResources.loadingRes);
}
public NetworkLoadingView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
public void initView() {
mAnimationManager = new AnimationManager();
loadView = findViewById(R.id.loading_imageview);
textView = findViewById(R.id.loading_text);
refresButton = findViewById(R.id.refresh_button);
}
public void setLoadingText(String text) {
if (textView != null) {
textView.setText(text);
}
}
public void setLoadingImage(int[] resources) {
mAnimationManager.animationWithTarget(loadView, resources, 100);
}
public void start() {
if (mAnimationManager != null) {
mAnimationManager.start();
this.setVisibility(View.VISIBLE);
}
if (refresButton != null) {
refresButton.setVisibility(GONE);
}
if (textView != null) {
textView.setText(loadingText);
}
}
public void stop() {
if (mAnimationManager != null) {
mAnimationManager.stop();
this.setVisibility(GONE);
}
}
public void stopWithError(String errormsg, int showRefreshButton) {
if (mAnimationManager != null) {
mAnimationManager.soptWithError();
}
if (textView != null) {
textView.setText(errormsg);
}
if (refresButton != null) {
refresButton.setVisibility(showRefreshButton);
}
}
}