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

@@ -9,7 +9,7 @@ import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.eagle.core.network.RequestOptions;
import com.mogo.eagle.core.network.SubscribeImpl;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.module.common.constants.HostConst;
import com.mogo.eagle.core.data.constants.HostConst;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

View File

@@ -8,16 +8,13 @@ import com.mogo.eagle.core.data.bindingcar.BindingcarInfo;
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo;
import com.mogo.eagle.core.function.BindHostConst;
import com.mogo.eagle.core.function.api.bindingcar.BindingcarCallBack;
import com.mogo.eagle.core.function.bindingcar.R;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
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.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.module.common.constants.HostConst;
import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;

View File

@@ -21,7 +21,5 @@ internal object BridgeApi {
internal fun context(): Context = contextHolder?.get() ?: Utils.getApp()
internal fun statusManager() = apis?.statusManagerApi
internal fun floatViewManager() = apis?.windowManagerApi
}

View File

@@ -3,6 +3,9 @@ package com.mogo.eagle.core.function.check
import android.content.Context
import android.content.Intent
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.function.api.check.ICheckProvider
import com.mogo.eagle.core.function.api.check.IMogoCheckListener
@@ -13,9 +16,6 @@ import com.mogo.eagle.core.function.check.view.CheckActivity
import com.mogo.eagle.core.function.check.view.CheckDialog
import com.mogo.eagle.core.function.report.IPCReportManager
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.module.common.MogoApisHandler
import com.mogo.service.statusmanager.IMogoStatusChangedListener
import com.mogo.service.statusmanager.StatusDescriptor
import java.util.concurrent.ConcurrentHashMap
/**
@@ -38,11 +38,9 @@ class VehicleMonitoringManager : ICheckProvider, IMogoStatusChangedListener {
override fun init(context: Context) {
mContext = context
MogoApisHandler.getInstance().apis.statusManagerApi.registerStatusChangedListener(
TAG,
StatusDescriptor.MAIN_PAGE_RESUME,
this
)
MogoStatusManager.getInstance().registerStatusChangedListener(TAG,
StatusDescriptor.MAIN_PAGE_RESUME,
this)
//开启工控机监控节点上报服务
IPCReportManager.INSTANCE.initServer()
}
@@ -123,6 +121,9 @@ class VehicleMonitoringManager : ICheckProvider, IMogoStatusChangedListener {
override fun onDestroy() {
//停止工控机监控节点上报服务
MogoStatusManager.getInstance().unregisterStatusChangedListener(TAG,
StatusDescriptor.MAIN_PAGE_RESUME,
this)
IPCReportManager.INSTANCE.destroy()
}

View File

@@ -1,7 +1,7 @@
package com.mogo.eagle.core.function.check.net;
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.module.common.constants.HostConst;
import com.mogo.eagle.core.data.constants.HostConst;
/**
* @author liujing

View File

@@ -4,7 +4,7 @@ import com.mogo.eagle.core.data.Response
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.apiResponseCall
import com.mogo.eagle.core.network.request
import com.mogo.module.common.constants.HostConst
import com.mogo.eagle.core.data.constants.HostConst
import com.zhjt.mogo_core_function_devatools.upgrade.network.HostConst.Companion.getBaseUrl
class UpgradeVersionNetWorkModel {

View File

@@ -1,7 +1,7 @@
package com.zhjt.dispatch.model;
import static com.mogo.commons.context.ContextHolderUtil.getContext;
import static com.mogo.module.common.constants.HostConst.DATA_SERVICE_HOST;
import static com.mogo.eagle.core.data.constants.HostConst.DATA_SERVICE_HOST;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.eagle.core.data.BaseData;
@@ -13,7 +13,6 @@ import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.eagle.core.network.RequestOptions;
import com.mogo.eagle.core.network.SubscribeImpl;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.module.common.MogoApisHandler;
import java.util.HashMap;
import java.util.List;

View File

@@ -0,0 +1,56 @@
package com.mogo.eagle.core.function.hmi.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

@@ -0,0 +1,140 @@
package com.mogo.eagle.core.function.hmi.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

@@ -7,7 +7,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.hmi.WaringConst
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.module.common.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.EventTypeEnum
/**
* V2X 预警广播接收。用于跨应用,跨进程,内部也可以通过这种方式弹出预警提示框

View File

@@ -23,7 +23,7 @@ import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.debug.DebugConfig
import com.mogo.module.common.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.commons.mvp.BaseFragment
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.voice.*

View File

@@ -1,49 +1,54 @@
package com.mogo.eagle.core.function.hmi.ui.bindingcar
import android.content.Context
import android.util.Log
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.service.IMogoServiceApis
import com.mogo.service.statusmanager.IMogoStatusChangedListener
import com.mogo.service.statusmanager.StatusDescriptor
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
/**
* @brief 修改车辆对话框
* @author lixiaopeng
*/
class ModifyBindingCarDialog(context: Context) : BaseFloatDialog(context), LifecycleObserver{
class ModifyBindingCarDialog(context: Context) : BaseFloatDialog(context), LifecycleObserver {
private val TAG = "BindingCarDialog"
private var confirmTv: TextView? = null
private var cancleTv: TextView? = null
private var cancelTv: TextView? = null
private var mServiceApis: IMogoServiceApis? = null
private val statusChangedListenerForCheckNotice = IMogoStatusChangedListener { descriptor, isTrue ->
if (descriptor == StatusDescriptor.MAIN_PAGE_IS_BACKGROUND) {
dismiss()
private val statusChangedListenerForCheckNotice =
IMogoStatusChangedListener { descriptor, isTrue ->
if (descriptor == StatusDescriptor.MAIN_PAGE_IS_BACKGROUND) {
dismiss()
}
}
}
init {
setContentView(R.layout.dialog_modify_bindingcar)
setCanceledOnTouchOutside(true)
confirmTv = findViewById(R.id.tv_bindingcar_confirm)
cancleTv = findViewById(R.id.tv_bindingcar_cancel)
cancelTv = findViewById(R.id.tv_bindingcar_cancel)
confirmTv?.setOnClickListener {
modifyBindingcar()
}
cancleTv?.setOnClickListener {
cancelTv?.setOnClickListener {
dismiss()
}
MogoStatusManager.getInstance().registerStatusChangedListener(
TAG,
StatusDescriptor.MAIN_PAGE_IS_BACKGROUND,
statusChangedListenerForCheckNotice
)
}
/**
@@ -62,6 +67,11 @@ class ModifyBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifec
override fun dismiss() {
super.dismiss()
MogoStatusManager.getInstance().unregisterStatusChangedListener(
TAG,
StatusDescriptor.MAIN_PAGE_IS_BACKGROUND,
statusChangedListenerForCheckNotice
)
}
fun showModifyBindingcarDialog() {

View File

@@ -3,13 +3,13 @@ package com.mogo.eagle.core.function.hmi.ui.bindingcar
import android.content.Context
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.service.IMogoServiceApis
import com.mogo.service.statusmanager.IMogoStatusChangedListener
import com.mogo.service.statusmanager.StatusDescriptor
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
/**
@@ -20,9 +20,8 @@ class ToBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifecycle
private val TAG = "ToBindingCarDialog"
private var confirmTv: TextView? = null
private var cancleTv: TextView? = null
private var cancelTv: TextView? = null
private var mServiceApis: IMogoServiceApis? = null
private val statusChangedListenerForCheckNotice = IMogoStatusChangedListener { descriptor, isTrue ->
if (descriptor == StatusDescriptor.MAIN_PAGE_IS_BACKGROUND) {
dismiss()
@@ -34,15 +33,21 @@ class ToBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifecycle
setCanceledOnTouchOutside(true)
confirmTv = findViewById(R.id.tv_to_bindingcar_confirm)
cancleTv = findViewById(R.id.tv_to_bindingcar_cancel)
cancelTv = findViewById(R.id.tv_to_bindingcar_cancel)
confirmTv?.setOnClickListener {
toBindingcar()
}
cancleTv?.setOnClickListener {
cancelTv?.setOnClickListener {
dismiss()
}
MogoStatusManager.getInstance().registerStatusChangedListener(
TAG,
StatusDescriptor.MAIN_PAGE_IS_BACKGROUND,
statusChangedListenerForCheckNotice
)
}
/**
@@ -61,6 +66,11 @@ class ToBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifecycle
override fun dismiss() {
super.dismiss()
MogoStatusManager.getInstance().unregisterStatusChangedListener(
TAG,
StatusDescriptor.MAIN_PAGE_IS_BACKGROUND,
statusChangedListenerForCheckNotice
)
}
fun showToBindingcarDialog() {

View File

@@ -1,24 +1,19 @@
package com.mogo.eagle.core.function.hmi.ui.bindingcar
import android.content.Context
import android.opengl.Visibility
import android.util.Log
import android.view.View
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.service.IMogoServiceApis
import com.mogo.service.statusmanager.IMogoStatusChangedListener
import com.mogo.service.statusmanager.StatusDescriptor
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
/**
* @brief APP升级提示弹框
* @author lixiaopeng
*/
class UpgradeAppDialog(context: Context) : BaseFloatDialog(context), LifecycleObserver{
class UpgradeAppDialog(context: Context) : BaseFloatDialog(context), LifecycleObserver {
private val TAG = "UpgradeAppDialog"
private var confirmTv: TextView? = null
@@ -70,7 +65,13 @@ class UpgradeAppDialog(context: Context) : BaseFloatDialog(context), LifecycleOb
}
// 升级类型 1:提示升级 2:静默升级 3:强制升级
fun showUpgradeAppDialog(name: String, url: String, title: String, content: String, installType: String) {
fun showUpgradeAppDialog(
name: String,
url: String,
title: String,
content: String,
installType: String
) {
if (isShowing) {
return
}

View File

@@ -13,7 +13,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
import com.shuyu.gsyvideoplayer.GSYVideoManager
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
import com.shuyu.gsyvideoplayer.model.VideoOptionModel

View File

@@ -7,6 +7,9 @@ import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -15,11 +18,8 @@ import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform
import com.mogo.eagle.core.utilcode.util.BitmapHelper
import com.mogo.eagle.core.widget.media.video.NoticeSimpleVideoPlayer
import com.mogo.module.common.MogoApisHandler
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
import com.mogo.service.IMogoServiceApis
import com.mogo.service.statusmanager.IMogoStatusChangedListener
import com.mogo.service.statusmanager.StatusDescriptor
import com.shuyu.gsyvideoplayer.GSYVideoManager
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
@@ -94,13 +94,13 @@ class NoticeCheckDialog(context: Context) : BaseFloatDialog(context), LifecycleO
playVideo(mVideoUrl)
}
mServiceApis = MogoApisHandler.getInstance().apis
mServiceApis?.statusManagerApi?.registerStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForCheckNotice)
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForCheckNotice)
}
override fun dismiss() {
super.dismiss()
MogoStatusManager.getInstance().unregisterStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForCheckNotice)
stopLive()
}

View File

@@ -15,27 +15,25 @@ import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.module.status.StatusDescriptor;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo;
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
import com.mogo.eagle.core.data.notice.NoticeValue;
import com.mogo.eagle.core.function.api.notice.NoticeNetCallBack;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.call.notice.CallerNoticeManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.utilcode.mogo.glide.GlideApp;
import com.mogo.eagle.core.utilcode.mogo.glide.transform.GlideRoundedCornersTransform;
import com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.BitmapHelper;
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
import com.mogo.eagle.core.widget.media.video.NoticeSimpleSmallVideoPlayer;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.dialog.BaseFloatDialog;
import com.mogo.service.IMogoServiceApis;
import com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog;
import com.shuyu.gsyvideoplayer.GSYVideoManager;
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
import com.shuyu.gsyvideoplayer.listener.VideoAllCallBack;
@@ -64,9 +62,8 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
private TextView refuse;//拒绝
private TextView connect;//连接
private NoticeTrafficAdapter adapter;
private final ArrayList dataArrayList = new ArrayList();
private final ArrayList<NoticeValue> dataArrayList = new ArrayList<>();
private NoticeTrafficStyleInfo.NoticeTrafficAccountInfo mTrafficStyleInfo;
private IMogoServiceApis mServiceApis;
public NoticeTrafficDialog(@NonNull Context context, NoticeTrafficStylePushData pushData) {
super(context);
@@ -84,8 +81,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
setCanceledOnTouchOutside(true);
playerShow();//视频播放器及接操作按钮
recyclerVie();//详情信息列表
mServiceApis = MogoApisHandler.getInstance().getApis();
mServiceApis.getStatusManagerApi().registerStatusChangedListener(M_HMI + TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForNotice);
MogoStatusManager.getInstance().registerStatusChangedListener(M_HMI + TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForNotice);
}
/**
@@ -169,7 +165,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
* 开启自动驾驶
*/
private void startAutoPilot() {
if (mTrafficStyleInfo != null){
if (mTrafficStyleInfo != null) {
AutopilotControlParameters parameters = new AutopilotControlParameters();
parameters.isSpeakVoice = false;
parameters.vehicleType = 10;
@@ -356,13 +352,10 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
*/
private void requestTrafficInfo() {
CallerLogger.INSTANCE.d(M_HMI + TAG, "requestTrafficInfo");
CallerNoticeManager.getNoticeProvider().requestAccidentInfo(mPushData.getInfoId(), MoGoAiCloudClientConfig.getInstance().getSn(), new NoticeNetCallBack() {
@Override
public void callBackWithResult(NoticeTrafficStyleInfo trafficInfo) {
CallerLogger.INSTANCE.d(M_HMI + TAG, "交通事故详情::" + trafficInfo);
mTrafficStyleInfo = trafficInfo.getResult().getAccidentInfo();
infoRefresh(mTrafficStyleInfo);
}
CallerNoticeManager.getNoticeProvider().requestAccidentInfo(mPushData.getInfoId(), MoGoAiCloudClientConfig.getInstance().getSn(), trafficInfo -> {
CallerLogger.INSTANCE.d(M_HMI + TAG, "交通事故详情::" + trafficInfo);
mTrafficStyleInfo = trafficInfo.getResult().getAccidentInfo();
infoRefresh(mTrafficStyleInfo);
});
}
@@ -445,6 +438,7 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs
public void dismiss() {
super.dismiss();
CallerLogger.INSTANCE.d(M_HMI + TAG, "trafficDialog dismiss");
MogoStatusManager.getInstance().unregisterStatusChangedListener(M_HMI + TAG, StatusDescriptor.MAIN_PAGE_IS_BACKGROUND, statusChangedListenerForNotice);
releasePlayer();
}

View File

@@ -74,7 +74,7 @@ import com.mogo.map.MogoMap
import com.mogo.map.MogoMapUIController
import com.mogo.map.uicontroller.VisualAngleMode
import com.mogo.map.uicontroller.VisualAngleMode.*
import com.mogo.module.service.routeoverlay.*
import com.mogo.eagle.core.function.business.routeoverlay.*
import com.zhidao.easysocket.utils.L
import com.zhidao.support.adas.high.other.permission.BackgrounderPermission
import com.zhjt.mogo_core_function_devatools.env.*

View File

@@ -16,8 +16,7 @@ import com.mogo.eagle.core.function.call.obu.CallerOBUManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.module.service.routeoverlay.RouteStrategy
import kotlinx.android.synthetic.main.view_debug_setting.view.*
import com.mogo.eagle.core.function.business.routeoverlay.RouteStrategy
import kotlinx.android.synthetic.main.view_sop_setting.view.*
import kotlinx.android.synthetic.main.view_sop_setting.view.tbRouteDynamicEffect

View File

@@ -4,7 +4,7 @@ import android.content.Context
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.function.hmi.R
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
/**
* @author XuXinChao

View File

@@ -4,7 +4,7 @@ import android.content.Context
import android.widget.TextView
import androidx.lifecycle.LifecycleObserver
import com.mogo.eagle.core.function.hmi.R
import com.mogo.module.common.dialog.BaseFloatDialog
import com.mogo.eagle.core.function.hmi.dialog.BaseFloatDialog
/**
* @author XuXinChao

View File

@@ -31,6 +31,7 @@ import com.kwai.koom.nativeoom.leakmonitor.LeakRecord;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.commons.context.ContextHolderUtil;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.mvp.BaseFragment;
import com.mogo.commons.mvp.MvpActivity;
import com.mogo.commons.mvp.MvpFragment;
@@ -61,7 +62,6 @@ import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.rousetime.android_startup.StartupManager;
import com.rousetime.android_startup.model.LoggerLevel;
import com.rousetime.android_startup.model.StartupConfig;
@@ -91,7 +91,6 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
private static final int REQUEST_CODE_DIALOG = 100;
protected IMogoServiceApis mServiceApis;
protected IMogoStatusManager mMogoStatusManager;
protected FrameLayout mFloatingLayout;
protected View mCoverUpLayout;
@@ -102,7 +101,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
private RecyclerView mConnectInfoRV;
private ConnInfoAdapter mConnAdapter;
private List<AutopilotStatusInfo> dataList = new ArrayList<>();
private final List<AutopilotStatusInfo> dataList = new ArrayList<>();
private int mLastStatus = 0x00;
private boolean isFloatingLayerHidden = false;
@@ -225,8 +224,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
if (mServiceApis == null) {
mServiceApis = MogoApisHandler.getInstance().getApis();
}
mMogoStatusManager = mServiceApis.getStatusManagerApi();
mMogoStatusManager.setMainPageLaunchedStatus(TAG, true);
MogoStatusManager.getInstance().setMainPageLaunchedStatus(TAG, true);
}
private void initConnectInfoRV() {
@@ -274,7 +272,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
loadFunctionFragment();
// TODO 这里临时兼容进入VR模式标记状态机。有些业务OCH会根据状态判断加载
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true);
MogoStatusManager.getInstance().setVrMode(TAG, true);
// 设置地图样式
MogoMapListenerHandler.getInstance().onMapModeChanged(EnumMapUI.MAP_STYLE_DAY_VR);
});
@@ -394,23 +392,20 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
@Override
protected void onResume() {
super.onResume();
mMogoStatusManager.setMainPageResumeStatus(TAG, true);
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, false);
MogoStatusManager.getInstance().setMainPageResumeStatus(TAG, true);
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, true);
}
@Override
protected void onPause() {
super.onPause();
mMogoStatusManager.setMainPageResumeStatus(TAG, false);
MogoStatusManager.getInstance().setMainPageResumeStatus(TAG, false);
}
@Override
protected void onStop() {
super.onStop();
if (mMogoStatusManager != null) {
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, true);
}
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, true);
}
@Override
@@ -481,13 +476,13 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
listenerRegister.unregisterMarkerClickListener();
listenerRegister.unregisterHostMapListener();
}
mMogoStatusManager.setMainPageLaunchedStatus(TAG, false);
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, false);
IMogoMapUIController mapUIController = CallerMapUIServiceManager.INSTANCE.getMapUIController();
if (mapUIController != null) {
mapUIController.destroy();
}
MogoStatusManager.getInstance().setMainPageLaunchedStatus(TAG, false);
MogoStatusManager.getInstance().setMainPageIsBackgroundStatus(TAG, false);
CallerLogger.INSTANCE.d(M_HMI + TAG, "destroy.");
ContextHolderUtil.releaseContext();
MogoModulesManager.getInstance().onDestroy();

View File

@@ -26,7 +26,6 @@ import com.mogo.eagle.core.utilcode.util.ProcessUtils;
import com.mogo.map.MapApiPath;
import com.mogo.module.common.MogoModule;
import com.mogo.module.common.MogoModulePaths;
import com.mogo.module.service.ServiceConst;
import com.zhidao.support.obu.ami.AmiClientManager;
import com.zhjt.mogo_core_function_devatools.monitor.db.CpuInfo;
import com.zhjt.mogo_core_function_devatools.monitor.db.MemInfo;

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map
package com.mogo.eagle.core.function.business
import com.mogo.eagle.core.data.app.AppConfigInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.impl.collect
package com.mogo.eagle.core.function.business.collect
import android.content.Context
import android.text.TextUtils

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify;
package com.mogo.eagle.core.function.business.identify;
import java.util.List;
import java.util.Vector;

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
import com.mogo.eagle.core.data.traffic.TrafficData
import mogo.telematics.pad.MessagePad

View File

@@ -1,11 +1,11 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
import android.annotation.SuppressLint
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.w
import com.mogo.map.MogoMarkerManager
import com.mogo.module.common.MogoApisHandler
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.TrackedObject
@@ -38,7 +38,7 @@ class IdentifyBeautifyDataDrawer : Identify {
w(TAG, "感知数据为空无需渲染……")
return
}
if (!MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) {
if (!MogoStatusManager.getInstance().isVrMode) {
TrackManager.getInstance().clearAll()
w(TAG, "渲染 adas 识别的数据 当前不是VR模式")
return

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
import android.os.Handler
import android.os.Message

View File

@@ -1,12 +1,12 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
import android.annotation.SuppressLint
import androidx.collection.ArraySet
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.w
import com.mogo.map.MogoMarkerManager
import com.mogo.module.common.MogoApisHandler
import mogo.telematics.pad.MessagePad.PlanningObject
import mogo.telematics.pad.MessagePad.TrackedObject
import java.util.concurrent.ConcurrentHashMap
@@ -60,7 +60,7 @@ class IdentifyOriginDataDrawer : Identify {
w(TAG, "感知数据为空无需渲染……")
return
}
if (!MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) {
if (!MogoStatusManager.getInstance().isVrMode) {
clearOldMarker()
w(TAG, "渲染 adas 识别的数据 当前不是VR模式")
return

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify;
package com.mogo.eagle.core.function.business.identify;
public class KalmanFilter {
private final double q = 1.0E-6D;

View File

@@ -1,10 +1,9 @@
package com.mogo.eagle.core.function.map
package com.mogo.eagle.core.function.business.identify
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.base.IMoGoSubscriber
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.map.identify.IdentifyFactory
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.TrackedObject

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify;
package com.mogo.eagle.core.function.business.identify;
public class ObjQueue {

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
data class PlanningTrack(var color: String, var time: Double) {
}

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify;
package com.mogo.eagle.core.function.business.identify;
import android.annotation.SuppressLint;
import android.os.Build;

View File

@@ -1,9 +1,8 @@
package com.mogo.eagle.core.function.map.identify;
package com.mogo.eagle.core.function.business.identify;
import static com.mogo.eagle.core.function.map.identify.TrackManager.LIMIT_SPEED;
import static com.mogo.eagle.core.function.business.identify.TrackManager.LIMIT_SPEED;
import android.annotation.SuppressLint;
import android.util.Log;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
import android.annotation.SuppressLint
import com.mogo.eagle.core.data.config.FunctionBuildConfig

View File

@@ -1,13 +1,11 @@
package com.mogo.eagle.core.function.map.identify
package com.mogo.eagle.core.function.business.identify
import android.annotation.SuppressLint
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.FOUNDATION
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.data.traffic.threatLevelColor
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84SatelliteTime
import com.zhjt.service_biz.BizConfig
import mogo.telematics.pad.MessagePad
import mogo.telematics.pad.MessagePad.PlanningObject
import java.util.concurrent.ConcurrentHashMap

View File

@@ -0,0 +1,130 @@
package com.mogo.eagle.core.function.business.routeoverlay;
import androidx.annotation.NonNull;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import org.jetbrains.annotations.NotNull;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SystemStatusInfo;
public class MogoRouteOverlayManager implements
IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener, IMoGoMapLocationListener {
private static volatile MogoRouteOverlayManager sInstance;
private static final String TAG = "Route";
private final AtomicBoolean isArriveAtStation = new AtomicBoolean(false);
private final AtomicInteger autopilotMode = new AtomicInteger(0);
private final LinkedList<List<MessagePad.TrajectoryPoint>> queue = new LinkedList<>();
private MogoRouteOverlayManager() {}
public void init() {
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false);
}
public static MogoRouteOverlayManager getInstance() {
if (sInstance == null) {
synchronized (MogoRouteOverlayManager.class) {
if (sInstance == null) {
sInstance = new MogoRouteOverlayManager();
}
}
}
return sInstance;
}
@Override
public void onAutopilotTrajectory(@NonNull List<MessagePad.TrajectoryPoint> items) {
synchronized (queue) {
queue.clear();
queue.offer(items);
}
}
@Override
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
if (from != 1 || location == null) {
return;
}
if (isArriveAtStation.get() && autopilotMode.get() != 1) {
Logger.d(TAG, "--- onLocationChanged 1 -- [isDemo1: " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + ",isDemo2:" +FunctionBuildConfig.isDemoMode + ",isGps:" + isGps + ",mode:" + autopilotMode.get() + ",lon:" + location.getLongitude() + ",lat:" + location.getLatitude() + ",angle:" + location.getBearing() + "]");
RouteOverlayDrawer.getInstance().clearMogoRouteOverlay();
return;
}
boolean force = FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData;
if (!force && autopilotMode.get() != 1) {
Logger.d(TAG, "--- onLocationChanged 2 -- [isDemo1: " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + ",isDemo2:" +FunctionBuildConfig.isDemoMode + ",isGps:" + isGps + ",mode:" + autopilotMode.get() + ",lon:" + location.getLongitude() + ",lat:" + location.getLatitude() + ",angle:" + location.getBearing() + "]");
RouteOverlayDrawer.getInstance().clearMogoRouteOverlay();
return;
}
synchronized (queue) {
if (!queue.isEmpty()) {
List<MessagePad.TrajectoryPoint> items = queue.pollLast();
if (items != null && !items.isEmpty()) {
Logger.d(TAG, "--- onLocationChanged -- [isDemo1: " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + ",isDemo2:" +FunctionBuildConfig.isDemoMode + ",isGps:" + isGps + ",mode:" + autopilotMode.get() + ",lon:" + location.getLongitude() + ",lat:" + location.getLatitude() + ",angle:" + location.getBearing() + "]");
RouteOverlayDrawer.getInstance().drawTrajectoryList(items, location.getBearing());
}
}
}
}
@Override
public void onAutopilotRotting(MessagePad.GlobalPathResp globalPathResp) {}
@Override
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
int mode = autoPilotStatusInfo.getPilotmode();
if (mode == 1) {
isArriveAtStation.set(false);
}
this.autopilotMode.set(mode);
}
@Override
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) {
if (arrivalNotification == null) {
return;
}
if (!isArriveAtStation.get()) {
isArriveAtStation.set(true);
}
}
@Override
public void onAutopilotSNRequest() {
}
@Override
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @androidx.annotation.Nullable String reason) {
}
@Override
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {}
}

View File

@@ -0,0 +1,239 @@
package com.mogo.eagle.core.function.business.routeoverlay;
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.os.Handler;
import android.os.HandlerThread;
import android.util.Log;
import androidx.core.util.Pools;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.map.MogoOverlayManager;
import com.mogo.map.overlay.IMogoOverlayManager;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.module.common.utils.DrivingDirectionUtils;
import java.util.LinkedList;
import java.util.List;
import mogo.telematics.pad.MessagePad;
public class RouteOverlayDrawer {
private static final String TAG = "MogoRouteOverlayManager";
// 连接线参数
private Handler mRenderHandler;
IMogoOverlayManager mogoOverlayManager;
private static volatile RouteOverlayDrawer sInstance;
private final MogoPolylineOptions mPolylineOptions;
private volatile IMogoPolyline mMoGoPolyline;
private static final int COLOR_LIGHT = Color.parseColor("#BAEBF5");
private RouteOverlayDrawer() {
mPolylineOptions = new MogoPolylineOptions();
mPolylineOptions.zIndex(75000f);
mPolylineOptions.setGps(true);
mPolylineOptions.width(20).useGradient(true);
// 渐变色
mogoOverlayManager = MogoOverlayManager.getInstance();
// 线条粗细,渐变,渐变色值
HandlerThread renderTask = new HandlerThread("routing_render") {
@Override
protected void onLooperPrepared() {
super.onLooperPrepared();
mRenderHandler = new Handler(getLooper());
}
};
renderTask.start();
}
public static RouteOverlayDrawer getInstance() {
if (sInstance == null) {
synchronized (RouteOverlayDrawer.class) {
if (sInstance == null) {
sInstance = new RouteOverlayDrawer();
}
}
}
return sInstance;
}
public void clearMogoRouteOverlay() {
if (mRenderTask != null) {
mRenderHandler.removeCallbacks(mRenderTask);
}
if (mMoGoPolyline != null) {
mMoGoPolyline.remove();
mMoGoPolyline = null;
}
}
private class RenderTask implements Runnable {
private volatile List<MessagePad.TrajectoryPoint> routeList;
private final Pools.Pool<MogoLatLng> pools;
private final LinkedList<MogoLatLng> points;
private double bearing;
public RenderTask() {
this.pools = new Pools.SimplePool<>(500);
this.points = new LinkedList<>();
}
public void setData(List<MessagePad.TrajectoryPoint> routeList, double bearing) {
this.routeList = routeList;
this.bearing = bearing;
}
@SuppressLint("LongLogTag")
@Override
public void run() {
LinkedList<MogoLatLng> pps = this.points;
boolean isExcept = false;
int total;
try {
pps.clear();
List<MessagePad.TrajectoryPoint> routes = this.routeList;
if (routes == null || (total = routes.size()) < 2) {
isExcept = true;
return;
}
RouteStrategy.INSTANCE.start();
for (int i = 0; i < total; i++) {
MessagePad.TrajectoryPoint route = null;
try {
route = routes.get(i);
if (route == null) {
continue;
}
} catch (Throwable t) {
Log.d("Route", "render-error:" + t.getMessage());
}
if (route == null) {
//数组越界了,结束循环
break;
}
MogoLatLng acquire = pools.acquire();
double latitude = route.getLatitude();
double longitude = route.getLongitude();
if (acquire == null) {
acquire = new MogoLatLng(latitude, longitude);
} else {
acquire.lon = longitude;
acquire.lat = latitude;
}
acquire.acc = route.getAcceleration();
acquire.speed = route.getVelocity();
pps.add(acquire);
RouteStrategy.INSTANCE.check(route.getVelocity(), route.getAcceleration(), routeList.size());
}
double lon = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon();
double lat = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat();
if (points.size() > 0) {
MogoLatLng top = null;
while (points.size() != 0) {
MogoLatLng first = points.peek();
if (first == null) {
continue;
}
if (first == top) {
break;
}
lon = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon();
lat = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat();
long angle = isPointOnCarFront(lon, lat, bearing, first.lon, first.lat);
if (angle >= 90) {
RouteStrategy.INSTANCE.remove(first.acc);
pools.release(first);
points.poll();
}
top = first;
}
if (points.size() == 0) {
isExcept = true;
return;
}
MogoLatLng self = pools.acquire();
if (self == null) {
self = new MogoLatLng(lat, lon);
} else {
self.lat = lat;
self.lon = lon;
}
points.addFirst(self);
RouteStrategy.INSTANCE.end();
Strategy strategy = RouteStrategy.INSTANCE.getStrategy();
List<Integer> colors = strategy.getColors();
boolean isLightOn = strategy instanceof ColorfulStrategy && ((ColorfulStrategy) strategy).isLightOn();
if (mMoGoPolyline == null || mMoGoPolyline.isDestroyed()) {
mPolylineOptions.points(points);
mPolylineOptions.colorValues(colors);
if (isLightOn) {
mPolylineOptions.openBright(true);
mPolylineOptions.brightColor(COLOR_LIGHT);
mPolylineOptions.brightSpeed(0.5f);
} else {
mPolylineOptions.openBright(false);
}
mMoGoPolyline = mogoOverlayManager.addPolyline(mPolylineOptions);
} else {
mPolylineOptions.points(points);
mPolylineOptions.colorValues(colors);
if (isLightOn) {
mPolylineOptions.openBright(true);
mPolylineOptions.brightColor(COLOR_LIGHT);
mPolylineOptions.brightSpeed(0.5f);
} else {
mPolylineOptions.openBright(false);
}
mMoGoPolyline.setOption(mPolylineOptions);
}
if (mMoGoPolyline != null && !mMoGoPolyline.isDestroyed() && !mMoGoPolyline.isVisible()) {
mMoGoPolyline.setVisible(true);
}
} else {
isExcept = true;
}
} catch (Throwable t) {
t.printStackTrace();
} finally {
if (isExcept) {
setVisible(false);
}
if (points.size() > 0) {
for (int i = 0; i < points.size(); i++) {
MogoLatLng latLng = points.get(i);
if (latLng == null) {
continue;
}
pools.release(latLng);
}
}
}
}
private long isPointOnCarFront(double car_lon, double car_lat, double car_head, double lon, double lat) {
return DrivingDirectionUtils.getDegreeOfCar2Poi2(car_lon, car_lat, lon, lat, car_head);
}
}
private volatile RenderTask mRenderTask;
public void drawTrajectoryList(List<MessagePad.TrajectoryPoint> routeList, double bearing) {
if (mRenderTask == null) {
mRenderTask = new RenderTask();
}
mRenderTask.setData(routeList, bearing);
if (mRenderHandler != null) {
mRenderHandler.removeCallbacks(mRenderTask);
mRenderHandler.post(mRenderTask);
}
}
public void setVisible(boolean isVisible) {
if (mMoGoPolyline != null && !mMoGoPolyline.isDestroyed()) {
mMoGoPolyline.setVisible(isVisible);
}
}
}

View File

@@ -0,0 +1,166 @@
package com.mogo.eagle.core.function.business.routeoverlay
import android.animation.*
import android.graphics.*
import android.view.animation.*
import com.mogo.eagle.core.data.config.*
import com.mogo.eagle.core.utilcode.mogo.*
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_BLUE
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_BLUE_DARK
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_RED_DARK
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_TRANSPARENT
import java.util.*
import kotlin.collections.ArrayList
interface IStrategy {
fun getColors(): List<Int>
}
class Colors {
companion object {
val COLOR_BLUE = Color.parseColor("#FF2ABAD9")
val COLOR_BLUE_DARK = Color.parseColor("#FF074EFF")
val COLOR_RED_DARK = Color.parseColor("#FFFF5F00")
val COLOR_TRANSPARENT = Color.parseColor("#002ABAD9")
}
}
sealed class Strategy: IStrategy
class DefaultStrategy(private val colors: List<Int>? = null): Strategy() {
override fun getColors(): List<Int> = colors ?: listOf(COLOR_BLUE, COLOR_TRANSPARENT)
}
class ColorfulStrategy(private val colors: List<Int> = emptyList(), var isLightOn: Boolean): Strategy() {
override fun getColors(): List<Int> = colors
}
object RouteStrategy {
@Volatile
private var isEnable = !AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
private var strategy: Strategy? = null
private val colors: ArrayList<Int> = ArrayList()
private var index = 0
private val sorted: NavigableMap<Double, Int> by lazy { TreeMap() }
private var endEvaluator: ArgbEvaluator? = null
private var startColor = Int.MAX_VALUE
private var hasLessThan0 = false
fun enable(enable: Boolean) {
isEnable = enable
if (!enable) {
strategy = null
colors.clear()
}
}
fun start() {
if (sorted.isEmpty()) {
fill()
}
strategy = null
index = 0
startColor = Int.MAX_VALUE
colors.clear()
endEvaluator = null
hasLessThan0 = false
}
fun end() {
if (isEnable) {
if (colors.isEmpty()) {
return
}
val first = colors[0]
colors.add(0, first)
strategy = ColorfulStrategy(colors, true)
}
}
fun check(speed: Double, acc: Double, total: Int) {
if (!isEnable){
return
}
if (sorted.isEmpty()) {
return
}
if (acc < 0) {
hasLessThan0 = true
}
val delta = (total * 0.35).toInt()
val last = total - delta
val entry = sorted.floorEntry(acc)
if (entry != null) {
if (index >= last - 1) {
if (startColor == Int.MAX_VALUE) {
startColor = entry.value
if (endEvaluator == null) {
endEvaluator = ArgbEvaluator()
}
colors += entry.value
} else {
if (endEvaluator != null) {
val fraction = (index - last) * 1.0f / delta
colors += endEvaluator!!.evaluate(fraction, startColor, COLOR_TRANSPARENT) as Int
}
}
} else {
colors += entry.value
}
}
index++
}
fun remove(acc: Double): List<Int> {
if (!isEnable) {
return emptyList()
}
if (sorted.isEmpty()) {
throw AssertionError("sorted map must not be null.")
}
val entry = sorted.floorEntry(acc)
if (entry != null) {
colors.remove(entry.value)
}
return ArrayList(colors)
}
private fun fill() {
var startValue = -4.0
var endValue = 0.0
val step = 0.01
var current = startValue
val evaluator = ArgbEvaluator()
val interceptor = AccelerateInterpolator()
var total = endValue - startValue
while (current <= endValue) {
val fraction = interceptor.getInterpolation(((current - startValue) / total).toFloat())
val colorValue = evaluator.evaluate(fraction, COLOR_RED_DARK, COLOR_BLUE) as Int
sorted[current] = colorValue
current += step
}
startValue = 0.01
endValue = 3.0
current = startValue
total = endValue - startValue
while (current <= endValue) {
val fraction = (current - startValue) / total
val colorValue = evaluator.evaluate(fraction.toFloat(), COLOR_BLUE, COLOR_BLUE_DARK) as Int
sorted[current] = colorValue
current += step
}
}
fun getStrategy(): Strategy = if (isEnable) { (strategy ?: DefaultStrategy()) } else DefaultStrategy()
}

View File

@@ -6,7 +6,6 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.function.api.map.IMogoMapService;
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService;
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager;
import com.mogo.eagle.core.function.marker.MogoMarkerServiceImpl;
import com.mogo.map.MogoGeoSearch;
import com.mogo.map.MogoLocationClient;
import com.mogo.map.MogoMap;

View File

@@ -0,0 +1,79 @@
package com.mogo.eagle.core.function.impl;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService;
import com.mogo.eagle.core.function.impl.marker.MarkerDrawer;
import com.mogo.eagle.core.function.impl.marker.TrafficMarkerDrawer;
import com.mogo.eagle.core.function.impl.marker.V2XWarnDataDrawer;
import com.mogo.map.marker.IMogoMarker;
public class MogoMarkerServiceImpl implements IMogoMarkerService {
private static volatile MogoMarkerServiceImpl sInstance;
private static final byte[] obj = new byte[0];
private MogoMarkerServiceImpl() {
}
public static MogoMarkerServiceImpl getInstance() {
if (sInstance == null) {
synchronized (obj) {
if (sInstance == null) {
sInstance = new MogoMarkerServiceImpl();
}
}
}
return sInstance;
}
@Nullable
@Override
public IMogoMarker drawMarker(Object object) {
if (object instanceof MarkerShowEntity) {
return MarkerDrawer.getInstance().drawMapMarkerImpl(((MarkerShowEntity) object), MarkerDrawer.MARKER_Z_INDEX_HIGH, null);
}
return null;
}
@Override
public void renderWarningMoveMarker(double lon, double lat, int type, double collisionlat, double collisionLon, double angle, long showTime) {
V2XWarnDataDrawer.getInstance().renderWarnData(lon, lat, type, collisionlat, collisionLon, angle, showTime);
}
@Override
public void renderStopLineMarker(double lon, double lat) {
V2XWarnDataDrawer.getInstance().renderStopLineData(lon, lat);
}
@Override
public void drawerArrowsMarkerWithLocation(MogoLatLng location, String markerType, int type, int rotate) {
V2XWarnDataDrawer.getInstance().drawerArrowsMarkerWithLocation(location, markerType, type, rotate);
}
@Override
public void updateITrafficInfo(TrafficData trafficData) {
TrafficMarkerDrawer.INSTANCE.updateITrafficInfo(trafficData);
}
@Override
public void updateITrafficLocationInfo(TrafficData trafficData) {
TrafficMarkerDrawer.INSTANCE.updateITrafficLocationInfo(trafficData);
}
@Override
public void updateITrafficThreatLevelInfo(TrafficData trafficData) {
TrafficMarkerDrawer.INSTANCE.updateITrafficThreatLevelInfo(trafficData);
}
@Override
public void removeCvxRvInfoIndInfo(String uuid) {
TrafficMarkerDrawer.INSTANCE.removeCvxRvInfoIndInfo(uuid);
}
}

View File

@@ -0,0 +1,68 @@
package com.mogo.eagle.core.function.impl.marker;
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

@@ -0,0 +1,53 @@
package com.mogo.eagle.core.function.impl.marker;
import android.content.Context;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.module.common.R;
/**
* @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

@@ -0,0 +1,46 @@
package com.mogo.eagle.core.function.impl.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

@@ -0,0 +1,23 @@
package com.mogo.eagle.core.function.impl.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

@@ -0,0 +1,54 @@
package com.mogo.eagle.core.function.impl.marker;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.R;
/**
* 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

@@ -0,0 +1,45 @@
package com.mogo.eagle.core.function.impl.marker;
import android.content.Context;
import android.text.TextUtils;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.ModuleNames;
/**
* 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 ( MogoStatusManager.getInstance().isVrMode() ) {
return new EmptyMarkerView( context );
} else {
if ( markerShowEntity.isChecked() ) {
return new MapMarkerInfoView( context, markerShowEntity, options );
} else {
return new MapMarkerView( context, markerShowEntity, options );
}
}
}
}
}

View File

@@ -0,0 +1,152 @@
package com.mogo.eagle.core.function.impl.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.data.map.entity.MarkerShowEntity;
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.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

@@ -0,0 +1,125 @@
package com.mogo.eagle.core.function.impl.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.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
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.R;
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 (MogoStatusManager.getInstance().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

@@ -0,0 +1,95 @@
package com.mogo.eagle.core.function.impl.marker;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.eagle.core.function.map.R;
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.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 ( MogoStatusManager.getInstance().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

@@ -0,0 +1,172 @@
package com.mogo.eagle.core.function.impl.marker;
import android.text.TextUtils;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerNoveltyInfo;
import com.mogo.eagle.core.data.map.entity.MarkerOnlineCar;
import com.mogo.eagle.core.data.map.entity.MarkerShareMusic;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
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.eagle.core.data.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(MogoStatusManager.getInstance().isVrMode()).matchOnRoadSide(matchRoadSide).owner(markerShowEntity.getMarkerType()).zIndex(zIndex).data(markerShowEntity).latitude(markerShowEntity.getMarkerLocation().getLat()).longitude(markerShowEntity.getMarkerLocation().getLon());
if (MogoStatusManager.getInstance().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);
}
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

@@ -0,0 +1,73 @@
package com.mogo.eagle.core.function.impl.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 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

@@ -0,0 +1,235 @@
package com.mogo.eagle.core.function.impl.marker
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.constants.DataTypes
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 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

@@ -0,0 +1,137 @@
package com.mogo.eagle.core.function.impl.marker;
import static com.mogo.eagle.core.data.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
import static com.mogo.eagle.core.data.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
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;
/**
* 云端 预警数据绘制
*/
public class V2XWarnDataDrawer extends BaseDrawer {
private static volatile V2XWarnDataDrawer sInstance;
private static final byte[] obj = new byte[0];
private V2XWarnDataDrawer() {
super();
}
public static V2XWarnDataDrawer getInstance() {
if (sInstance == null) {
synchronized (obj) {
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));
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

@@ -15,6 +15,9 @@ import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider;
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber;
import com.mogo.eagle.core.function.business.MapPointCloudSubscriber;
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager;
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
@@ -186,6 +189,7 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
// TODO 临时初始化地图监听工控机、OBU等数据监听器用于感知元素绘制
MapIdentifySubscriber.Companion.getInstance();
MogoRouteOverlayManager.getInstance().init();
MapPointCloudSubscriber.Companion.getInstance();
}

View File

@@ -1,41 +0,0 @@
package com.mogo.eagle.core.function.marker;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.module.common.drawer.MarkerDrawer;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.service.marker.MapMarkerManager;
public class MogoMarkerServiceImpl implements IMogoMarkerService {
private static volatile MogoMarkerServiceImpl sInstance;
private static final byte[] obj = new byte[0];
private MogoMarkerServiceImpl() {
}
public static MogoMarkerServiceImpl getInstance() {
if (sInstance == null) {
synchronized (obj) {
if (sInstance == null) {
sInstance = new MogoMarkerServiceImpl();
}
}
}
return sInstance;
}
@Nullable
@Override
public IMogoMarker drawMarker(Object object) {
if (object instanceof MarkerShowEntity) {
return MapMarkerManager.getInstance().drawMapMarker(((MarkerShowEntity) object), MarkerDrawer.MARKER_Z_INDEX_HIGH);
}
return null;
}
}

View File

@@ -56,7 +56,6 @@ public class SmallMapFragment extends BaseFragment
@Override
protected void initViews() {
SmpServiceManager.init(getContext());
}
@Override
@@ -85,24 +84,14 @@ public class SmallMapFragment extends BaseFragment
public void drawablePolyline(List<MogoLatLng> coordinates) {
if (mSmallMapDirectionView != null) {
mSmallMapDirectionView.convert(coordinates);
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
mSmallMapDirectionView.drawablePolyline();
}
});
UiThreadHandler.post(() -> mSmallMapDirectionView.drawablePolyline());
}
}
@Override
public void clearPolyline() {
if (mSmallMapDirectionView != null) {
UiThreadHandler.post(new Runnable() {
@Override
public void run() {
mSmallMapDirectionView.clearPolyline();
}
});
UiThreadHandler.post(() -> mSmallMapDirectionView.clearPolyline());
}
}

View File

@@ -1,45 +0,0 @@
package com.mogo.eagle.core.function.smp;
import android.content.Context;
import com.alibaba.android.arouter.launcher.ARouter;
import com.mogo.service.IMogoServiceApis;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.service.module.IMogoRegisterCenter;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020-01-2114:01
* desc : V2X 服务
* version: 1.0
*/
public class SmpServiceManager {
private static final String TAG = "V2XServiceManager";
private static boolean isInit;
private static Context mContext;
private static IMogoServiceApis mMogoServiceApis;
private static IMogoRegisterCenter mMogoRegisterCenter;
private SmpServiceManager() {
}
public static void init(final Context context) {
if (!isInit) {
isInit = true;
mContext = context;
mMogoServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
mMogoRegisterCenter = mMogoServiceApis.getRegisterCenterApi();
}
}
public static Context getContext() {
return mContext;
}
public static IMogoRegisterCenter getMogoRegisterCenter() {
return mMogoRegisterCenter;
}
}

View File

@@ -12,7 +12,7 @@ import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MONITOR
import com.mogo.map.MogoLocationClient
import com.mogo.module.common.constants.HostConst
import com.mogo.eagle.core.data.constants.HostConst
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable

View File

@@ -19,9 +19,8 @@ import com.mogo.eagle.core.function.obu.mogo.utils.TrafficDataConvertUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.module.common.drawer.TrafficMarkerDrawer
import com.mogo.module.common.enums.EventTypeEnum
import com.mogo.module.common.enums.EventTypeHelper
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.EventTypeHelper
import com.mogo.service.IMogoServiceApis
import com.zhidao.support.obu.MogoObuManager
import com.zhidao.support.obu.OnMogoObuListener
@@ -77,16 +76,16 @@ class MogoPrivateObuManager private constructor() {
}
}
fun disConnectObu(){
fun disConnectObu() {
try {
MogoObuManager.getInstance().disConnect()
} catch (e: Exception) {
e.printStackTrace()
}
}
fun isConnected(): Boolean{
fun isConnected(): Boolean {
return MogoObuManager.getInstance().isConnected
}
@@ -219,7 +218,7 @@ class MogoPrivateObuManager private constructor() {
mContext?.let { SharedPrefsMgr.getInstance(it).putBoolean("OBU_RV", true) }
// 更新数据
TrafficDataConvertUtils.cvxRvInfoIndInfo2TrafficData(info)?.let {
TrafficMarkerDrawer.updateITrafficLocationInfo(it)
CallerMapUIServiceManager.getMarkerService()?.updateITrafficLocationInfo(it)
}
}
@@ -389,7 +388,8 @@ class MogoPrivateObuManager private constructor() {
// 更新数据
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.invokeTrackerWarningInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
// 删除
@@ -403,7 +403,8 @@ class MogoPrivateObuManager private constructor() {
CallerObuListenerManager.removeTrackerWarningInfo(it)
// 事件结束,还原车辆颜色
it.threatLevel = 0x01
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
}
@@ -507,7 +508,8 @@ class MogoPrivateObuManager private constructor() {
// 更新数据
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.invokeTrackerWarningInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
}
// 删除
@@ -519,7 +521,8 @@ class MogoPrivateObuManager private constructor() {
CallerObuListenerManager.removeTrackerWarningInfo(it)
// 事件结束,还原交通参与者颜色
it.threatLevel = 0x01
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
CallerMapUIServiceManager.getMarkerService()
?.updateITrafficThreatLevelInfo(it)
}
CallerHmiManager.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString())
}
@@ -849,21 +852,21 @@ class MogoPrivateObuManager private constructor() {
}
//前车急刹预警
EventTypeEnum.TYPE_USECASE_ID_EBW.poiType -> {
EventTypeHelper.getEBW(appId){ alert, tts ->
EventTypeHelper.getEBW(appId) { alert, tts ->
alertContent = alert
ttsContent = tts
}
}
//前向碰撞预警
EventTypeEnum.TYPE_USECASE_ID_FCW.poiType -> {
EventTypeHelper.getFCW(appId){ alert, tts ->
EventTypeHelper.getFCW(appId) { alert, tts ->
alertContent = alert
ttsContent = tts
}
}
//逆向超车预警
EventTypeEnum.TYPE_USECASE_ID_DNPW.poiType -> {
EventTypeHelper.getDNPW(appId){ alert, tts ->
EventTypeHelper.getDNPW(appId) { alert, tts ->
alertContent = alert
ttsContent = tts
}
@@ -917,7 +920,7 @@ class MogoPrivateObuManager private constructor() {
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.invokeTrackerWarningInfo(it)
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
CallerMapUIServiceManager.getMarkerService()?.updateITrafficThreatLevelInfo(it)
}
}
// 删除
@@ -930,7 +933,7 @@ class MogoPrivateObuManager private constructor() {
TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let {
CallerObuListenerManager.removeTrackerWarningInfo(it)
it.threatLevel = 0x01
TrafficMarkerDrawer.updateITrafficThreatLevelInfo(it)
CallerMapUIServiceManager.getMarkerService()?.updateITrafficThreatLevelInfo(it)
}
}
}

View File

@@ -53,6 +53,7 @@ dependencies {
implementation rootProject.ext.dependencies.mogo_v2x
implementation rootProject.ext.dependencies.mogoaicloudtrafficlive
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogocommons
implementation rootProject.ext.dependencies.modulecommon
implementation rootProject.ext.dependencies.moduleservice
implementation rootProject.ext.dependencies.mogo_core_data
@@ -62,6 +63,7 @@ dependencies {
//implementation rootProject.ext.dependencies.callchatprovider
implementation rootProject.ext.dependencies.mogo_core_res
} else {
implementation project(":foudations:mogo-commons")
implementation project(':modules:mogo-module-common')
implementation project(':modules:mogo-module-service')
implementation project(':core:mogo-core-data')

View File

@@ -8,14 +8,21 @@ import androidx.core.util.Pair
import androidx.localbroadcastmanager.content.*
import com.mogo.cloud.commons.utils.*
import com.mogo.cloud.passport.*
import com.mogo.module.common.enums.EventTypeEnum
import com.mogo.module.common.enums.EventTypeHelper
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
import com.mogo.eagle.core.data.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.EventTypeHelper
import com.mogo.commons.network.*
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_V2N
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CLOUD_SHOW
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CLOUD_V2N
import com.mogo.eagle.core.data.enums.*
import com.mogo.eagle.core.data.map.*
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
import com.mogo.eagle.core.data.traffic.*
import com.mogo.eagle.core.function.api.hmi.warning.*
import com.mogo.eagle.core.function.api.map.listener.*
@@ -49,12 +56,6 @@ import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.map.listener.*
import com.mogo.map.marker.*
import com.mogo.module.common.*
import com.mogo.module.common.drawer.*
import com.mogo.module.common.entity.*
import com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum
import com.mogo.service.statusmanager.*
import com.mogo.service.statusmanager.StatusDescriptor.ACC_STATUS
import com.mogo.service.statusmanager.StatusDescriptor.SEEK_HELPING
import com.mogo.v2x.*
import com.mogo.v2x.callback.*
import com.mogo.v2x.config.*
@@ -135,10 +136,9 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
}
})
}
BridgeApi.statusManager()?.let {
it.registerStatusChangedListener(MODULE_NAME, ACC_STATUS, this)
it.registerStatusChangedListener(MODULE_NAME, SEEK_HELPING, this)
}
MogoStatusManager.getInstance().registerStatusChangedListener(MODULE_NAME, StatusDescriptor.ACC_STATUS, this)
MogoStatusManager.getInstance().registerStatusChangedListener(MODULE_NAME, StatusDescriptor.SEEK_HELPING, this)
}
private fun unRegisterListener() {
@@ -148,10 +148,9 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
it.unregisterMogoMapListener(MODULE_NAME)
it.unregisterMogoMarkerClickListener(ModuleNames.CARD_TYPE_ROAD_CONDITION)
}
BridgeApi.statusManager()?.let {
it.unregisterStatusChangedListener(MODULE_NAME, ACC_STATUS, this)
it.unregisterStatusChangedListener(MODULE_NAME, SEEK_HELPING, this)
}
MogoStatusManager.getInstance().unregisterStatusChangedListener(MODULE_NAME, StatusDescriptor.ACC_STATUS, this)
MogoStatusManager.getInstance().unregisterStatusChangedListener(MODULE_NAME, StatusDescriptor.SEEK_HELPING, this)
}
private fun initData() {
@@ -201,7 +200,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
val v2XMessageEntity: V2XMessageEntity<V2XRoadEventEntity> =
V2XMessageEntity<V2XRoadEventEntity>()
v2XMessageEntity.type = V2XTypeEnum.ALERT_ROAD_WARNING
v2XMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING
v2XMessageEntity.isShowState = true
v2XMessageEntity.isOnlyShow = true
v2XMessageEntity.isNeedAddLine = false
@@ -242,20 +241,18 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
CallerLogger.d("$M_V2X$TAG", "状态发生改变\ndescriptor:$descriptor\nisTrue:$isTrue") // 记录状态更改
// 记录状态更改
SharedPrefsMgr.getInstance(Utils.getApp()).putBoolean("descriptor_$descriptor", isTrue)
if (descriptor == ACC_STATUS) {
if (descriptor == StatusDescriptor.ACC_STATUS) {
if (isTrue) { // 刷新配置文件
refreshStrategyConfig()
// 记录开机时间
FatigueDrivingUtils.refreshAccOnTime()
initCarForHelpStatus()
BridgeApi.statusManager()?.let {
V2XManager.forceRefresh()
}
V2XManager.forceRefresh()
} else { // 记录关机时间
SharedPrefsMgr.getInstance(Utils.getApp())
.putString(V2X_ACC_OFF_TIME_STR, TimeUtils.getNowString())
}
} else if (descriptor == SEEK_HELPING) {
} else if (descriptor == StatusDescriptor.SEEK_HELPING) {
refreshMeSeekHelp(isTrue)
}
}
@@ -267,7 +264,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
*/
private fun refreshMeSeekHelp(isTrue: Boolean) {
val entity = V2XMessageEntity<Boolean>()
entity.type = V2XTypeEnum.ALERT_CAR_FOR_HELP
entity.type = V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP
entity.content = isTrue
V2XScenarioManager.getInstance().handlerMessage(entity)
}
@@ -286,10 +283,10 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
val vehicleType: Int = resultBean.vehicleType //故障车
if (vehicleType == 4) {
refreshMeSeekHelp(true)
BridgeApi.statusManager()?.setSeekHelping(MODULE_NAME, true)
MogoStatusManager.getInstance().setSeekHelping(MODULE_NAME, true)
} else {
refreshMeSeekHelp(false)
BridgeApi.statusManager()?.setSeekHelping(MODULE_NAME, false)
MogoStatusManager.getInstance().setSeekHelping(MODULE_NAME, false)
}
}
}
@@ -360,7 +357,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
Logger.d(TAG, "--- trigger show ---:poiType:" + v2XRoadEventEntity.poiType)
TrackUtils.trackV2xRoadProduceEvent(1)
val v2XMessageEntity = V2XMessageEntity<V2XRoadEventEntity>()
v2XMessageEntity.type = V2XTypeEnum.ALERT_ROAD_WARNING
v2XMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING
v2XMessageEntity.content = v2XRoadEventEntity
v2XMessageEntity.isShowState = true
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity)
@@ -470,7 +467,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
private fun handleWarningTargetEvent(data: V2XWarningTarget) {
val v2xMessageEntity = V2XMessageEntity<V2XWarningTarget>()
v2xMessageEntity.type = V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS
v2xMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS
// 设置数据
v2xMessageEntity.content = data
val intent = Intent(BROADCAST_SCENE_HANDLER_ACTION)
@@ -491,7 +488,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
private fun handleOptimalRouteEvent(event: V2XEvent.OptimalRoute) {
val v2xMessageEntity: V2XMessageEntity<V2XOptimalRoute> =
V2XMessageEntity<V2XOptimalRoute>() // 控制类型
v2xMessageEntity.type = V2XTypeEnum.ALERT_PUSH_VR_SHOW // 设置数据
v2xMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW // 设置数据
v2xMessageEntity.content = event.data // 控制展示状态
v2xMessageEntity.isShowState = true
val intent = Intent(BROADCAST_SCENE_HANDLER_ACTION)
@@ -595,14 +592,14 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
true,
5000L
)
TrafficMarkerDrawer.updateITrafficInfo(trafficData)
CallerMapUIServiceManager.getMarkerService()?.updateITrafficInfo(trafficData)
}
2 -> {
TrafficMarkerDrawer.updateITrafficInfo(trafficData)
CallerMapUIServiceManager.getMarkerService()?.updateITrafficInfo(trafficData)
}
3 -> {
trafficData.uuid?.let {
TrafficMarkerDrawer.removeCvxRvInfoIndInfo(it)
CallerMapUIServiceManager.getMarkerService()?.removeCvxRvInfoIndInfo(it)
}
}
}

View File

@@ -1,10 +1,10 @@
package com.mogo.eagle.core.function.v2x.events.alarm;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.function.v2x.events.utils.DrivingDirectionUtils;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.enums.EventTypeEnum;
import com.mogo.eagle.core.data.enums.EventTypeEnum;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;
import io.netty.util.internal.ConcurrentSet;

View File

@@ -8,7 +8,6 @@ import com.mogo.eagle.core.function.v2x.events.manager.*
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshModel
import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.module.common.MogoApisHandler
import com.mogo.service.statusmanager.IMogoStatusManager
import java.lang.ref.WeakReference
import java.util.concurrent.atomic.AtomicReference
@@ -60,8 +59,6 @@ internal object BridgeApi {
fun context(): Context = this.context.get()?.get() ?: Utils.getApp()
fun statusManager(): IMogoStatusManager? = apis?.statusManagerApi
fun v2xMarker() = v2xMarker
fun v2xPolyline() = v2xPolyline

View File

@@ -6,8 +6,8 @@ import android.text.TextUtils;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerOnlineCar;
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
import com.mogo.eagle.core.data.map.entity.MarkerOnlineCar;
import java.io.Serializable;
import java.util.ArrayList;

View File

@@ -2,7 +2,7 @@ package com.mogo.eagle.core.function.v2x.events.entity.net;
import com.google.gson.annotations.Expose;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
import com.mogo.eagle.core.data.map.entity.V2XLiveCarInfoEntity;
import java.io.Serializable;
import java.util.List;

View File

@@ -1,7 +1,7 @@
package com.mogo.eagle.core.function.v2x.events.entity.panel;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.enums.EventTypeEnum;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.enums.EventTypeEnum;
import java.io.Serializable;
import java.util.ArrayList;

View File

@@ -1,7 +1,7 @@
package com.mogo.eagle.core.function.v2x.events.entity.panel;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import java.util.List;

View File

@@ -3,8 +3,8 @@ package com.mogo.eagle.core.function.v2x.events.manager;
import android.content.Context;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.v2x.data.V2XMarkerCardResult;
import java.util.concurrent.CopyOnWriteArrayList;

View File

@@ -3,8 +3,8 @@ package com.mogo.eagle.core.function.v2x.events.manager;
import android.content.Context;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.entity.V2XRoadEventEntity;
/**
* author : donghongyu

View File

@@ -2,7 +2,7 @@ package com.mogo.eagle.core.function.v2x.events.manager;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
/**
* author : donghongyu

View File

@@ -6,9 +6,15 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
@@ -25,14 +31,7 @@ import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.enums.EventTypeEnum;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.Utils;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.eagle.core.data.enums.EventTypeEnum;
import com.mogo.v2x.V2XManager;
import com.mogo.v2x.data.V2XMarkerCardResult;
import com.mogo.v2x.data.V2XMarkerExploreWay;
@@ -58,6 +57,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
private static final CopyOnWriteArraySet<V2XRoadEventEntity> mV2XRoadEventEntityArrayList = new CopyOnWriteArraySet<>();
// 上次的道路事件的预警Marker
private static IMogoMarker mAlarmInfoMarker;
public static final String CARD_TYPE_NOVELTY = "CARD_TYPE_NOVELTY";
@Override
public void drawableLastAllPOI() {
@@ -81,10 +81,8 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
// 事件位置
MarkerLocation location = v2XRoadEventEntity.getLocation();
if (location != null) {
float calculateDistance = Utils.calculateLineDistance(
new MogoLatLng(location.getLat(), location.getLon()),
new MogoLatLng(currentLocation.getLatitude(), currentLocation.getLongitude())
);
float calculateDistance = CoordinateUtils.calculateLineDistance(location.getLat(), location.getLon(),
currentLocation.getLatitude(), currentLocation.getLongitude());
v2XRoadEventEntity.setDistance(calculateDistance);
}
roadEventEntities.add(v2XRoadEventEntity);
@@ -157,16 +155,12 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
markerShowEntity.setChecked(false);
markerShowEntity.setTextContent(markerExploreWay.getAddr());
markerShowEntity.setMarkerLocation(markerExploreWay.getLocation());
markerShowEntity.setMarkerType(ServiceConst.CARD_TYPE_NOVELTY);
markerShowEntity.setMarkerType(CARD_TYPE_NOVELTY);
optionsRipple.icons(V2XMarkerAdapter.getV2XRoadEventViewGif(context, roadEventEntity));
optionsRipple.period(1);
boolean isVrMode = false;
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
isVrMode = statusManager.isVrMode();
}
if (isVrMode) {
if (MogoStatusManager.getInstance().isVrMode()) {
mAlarmInfoMarker = Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerService()).drawMarker(markerShowEntity);
} else {
optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity));

View File

@@ -3,11 +3,11 @@ package com.mogo.eagle.core.function.v2x.events.manager.impl;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.entity.V2XRoadEventEntity;
/**
* author : donghongyu

View File

@@ -3,13 +3,12 @@ package com.mogo.eagle.core.function.v2x.events.manager.impl;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusChangedListener;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusDescriptor;
import com.mogo.service.statusmanager.IMogoStatusManager;
import java.util.List;
import java.util.Map;
@@ -54,10 +53,7 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
@Override
public void setRoadEventPOIShow(String tag, boolean show) {
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
statusManager.setV2XUIShow(V2XConst.MODULE_NAME, show);
}
MogoStatusManager.getInstance().setV2XUIShow(V2XConst.MODULE_NAME, show);
mStatus.put(V2XStatusDescriptor.RoadEventPOI_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.RoadEventPOI_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.RoadEventPOI_UI);

View File

@@ -3,9 +3,9 @@ package com.mogo.eagle.core.function.v2x.events.marker;
import android.content.Context;
import android.graphics.Bitmap;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.enums.EventTypeEnum;
import com.mogo.eagle.core.data.enums.EventTypeEnum;
import java.util.ArrayList;

View File

@@ -5,10 +5,10 @@ import android.content.Context
import android.graphics.Bitmap
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
import com.mogo.eagle.core.function.v2x.R
import com.mogo.eagle.core.utilcode.util.ViewUtils
import com.mogo.module.common.entity.V2XRoadEventEntity
import com.mogo.module.common.enums.EventTypeEnum
import com.mogo.eagle.core.data.enums.EventTypeEnum
import kotlinx.android.synthetic.main.view_marker_event_car.view.*
/**

View File

@@ -1,7 +1,7 @@
package com.mogo.eagle.core.function.v2x.events.network;
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.module.common.constants.HostConst;
import com.mogo.eagle.core.data.constants.HostConst;
/**
* 应对不同接口对应不同服务域名的工厂累

View File

@@ -3,9 +3,9 @@ package com.mogo.eagle.core.function.v2x.events.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst
import com.mogo.eagle.core.function.v2x.events.scenario.impl.V2XScenarioManager
import com.mogo.module.common.entity.V2XMessageEntity
import java.lang.Exception
class SceneBroadcastReceiver: BroadcastReceiver() {

View File

@@ -6,20 +6,19 @@ import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.function.call.chat.CallerChatManager;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes;
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes;
import com.mogo.eagle.core.function.v2x.events.utils.TestOnLineCarUtils;
import com.mogo.eagle.core.function.v2x.events.utils.V2XSQLiteUtils;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.service.statusmanager.IMogoStatusManager;
import java.util.List;
@@ -66,7 +65,8 @@ public class TestPanelBroadcastReceiver extends BroadcastReceiver {
// 存储本地,出行动态作展示
saveLocalStory(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING,
v2XMessageEntity.getContent().getNoveltyInfo());
} if (sceneType == 2) {// 触发AI道路施工事件
}
if (sceneType == 2) {// 触发AI道路施工事件
V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioAIRoadEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
@@ -129,10 +129,7 @@ public class TestPanelBroadcastReceiver extends BroadcastReceiver {
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
statusManager.setSeekHelping(V2XConst.MODULE_NAME, true);
}
MogoStatusManager.getInstance().setSeekHelping(V2XConst.MODULE_NAME, true);
} else if (sceneType == 20) {// 小地图绘制线
List<MogoLatLng> coordinates = TestOnLineCarUtils.getTestCoordinates();
CallerSmpManager.drawablePolyline(coordinates);

View File

@@ -1,6 +1,6 @@
package com.mogo.eagle.core.function.v2x.events.scenario;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
/**
* author : donghongyu

View File

@@ -1,6 +1,7 @@
package com.mogo.eagle.core.function.v2x.events.scenario;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
/**
* author : donghongyu

View File

@@ -2,9 +2,10 @@ package com.mogo.eagle.core.function.v2x.events.scenario.impl;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
import com.mogo.eagle.core.function.v2x.events.scenario.IV2XScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
import com.mogo.module.common.entity.V2XMessageEntity;
/**
* author : donghongyu

View File

@@ -6,22 +6,19 @@ import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.scenario.IV2XScenarioManager;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.road.V2XRoadEventScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.route.V2XOptimalRouteVREventScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.warning.V2XFrontWarningScenario;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.map.MogoMapUIController;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.service.statusmanager.IMogoStatusManager;
/**
* author : donghongyu
@@ -74,12 +71,7 @@ public class V2XScenarioManager implements IV2XScenarioManager {
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS:
sceneChange();
boolean isVrMode1 = false;
IMogoStatusManager statusManager1 = BridgeApi.INSTANCE.statusManager();
if (statusManager1 != null) {
isVrMode1 = statusManager1.isVrMode();
}
if (isVrMode1) {
if (MogoStatusManager.getInstance().isVrMode()) {
mV2XScenario = new V2XFrontWarningScenario();
} else {
mV2XScenario = null;

View File

@@ -12,6 +12,7 @@ import androidx.lifecycle.Lifecycle.Event.ON_CREATE
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
import com.mogo.eagle.core.data.map.*
import com.mogo.eagle.core.data.map.MapRoadInfo.StopLine
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
import com.mogo.eagle.core.function.api.map.listener.*
import com.mogo.eagle.core.function.api.v2x.*
import com.mogo.eagle.core.function.call.map.*
@@ -23,7 +24,6 @@ import com.mogo.eagle.core.utilcode.kotlin.*
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.mogo.map.*
import com.mogo.map.overlay.*
import com.mogo.module.common.entity.*
import com.mogo.module.common.utils.*
import io.netty.util.internal.*
import java.lang.Runnable

View File

@@ -4,13 +4,13 @@ import android.graphics.*
import android.util.*
import com.mogo.cloud.commons.utils.*
import com.mogo.eagle.core.data.map.*
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.context
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.v2xMarker
import com.mogo.map.*
import com.mogo.map.R.raw
import com.mogo.map.marker.*
import com.mogo.map.overlay.*
import com.mogo.module.common.entity.*
import com.mogo.module.common.utils.*
import java.util.*
import java.util.concurrent.atomic.*

View File

@@ -2,15 +2,15 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.road;
import androidx.core.util.Pair;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.enums.EventTypeEnum;
import com.mogo.eagle.core.data.enums.EventTypeEnum;
import java.util.ArrayList;
import java.util.List;

View File

@@ -4,6 +4,9 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.eagle.core.data.enums.WarningDirectionEnum;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager;
@@ -13,10 +16,7 @@ import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.enums.EventTypeEnum;
import com.mogo.eagle.core.data.enums.EventTypeEnum;
import java.util.HashMap;
import java.util.Map;
@@ -68,7 +68,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
boolean onlyShow = getV2XMessageEntity().isOnlyShow();
if (!onlyShow) {
// 设置TTS
getV2XMessageEntity().getContent().getTts(false);
getV2XMessageEntity().getContent().getTts();
}
showWindow();
String poiType = getV2XMessageEntity().getContent().getPoiType();

View File

@@ -4,6 +4,7 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
@@ -13,7 +14,6 @@ import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.module.common.entity.V2XMessageEntity;
import java.util.concurrent.TimeUnit;

View File

@@ -9,13 +9,13 @@ import android.text.style.ForegroundColorSpan;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.enums.WarningDirectionEnum;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener;
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.v2x.data.V2XWarningTarget;
import java.math.BigDecimal;
import java.util.Locale;

View File

@@ -1,29 +1,29 @@
package com.mogo.eagle.core.function.v2x.events.scenario.scene.warning;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X;
import static com.mogo.eagle.core.data.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
import static com.mogo.eagle.core.data.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_FRONT_WARNING_MARKER;
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 static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.entity.model.DrawLineInfo;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoPersonWarnPolylineManager;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoStopPolylineManager;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoWarnPolylineManager;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.MogoMarkerManager;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
import com.mogo.module.common.utils.Trigonometric;
import com.mogo.v2x.data.V2XLocation;
import com.mogo.v2x.data.V2XWarningTarget;
@@ -31,6 +31,7 @@ import com.mogo.v2x.data.V2XWarningTarget;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
/**
* @author liujing
@@ -110,7 +111,7 @@ public class V2XWarningMarker implements IV2XMarker {
warningLocation);
*/
V2XWarnDataDrawer.getInstance().renderWarnData(mCloundWarningInfo.getLon(), mCloundWarningInfo.getLat(), mCloundWarningInfo.getType(), mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon(), mCloundWarningInfo.getAngle(), mCloundWarningInfo.getShowTime());
Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerService()).renderWarningMoveMarker(mCloundWarningInfo.getLon(), mCloundWarningInfo.getLat(), mCloundWarningInfo.getType(), mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon(), mCloundWarningInfo.getAngle(), mCloundWarningInfo.getShowTime());
//添加停止线marker
//衡阳交付-取消划线需求,只渲染识别物红色模型移动过程
@@ -134,8 +135,13 @@ public class V2XWarningMarker implements IV2XMarker {
CallerLogger.INSTANCE.d(M_V2X + TAG, "数据为空carLocation == null");
}
*/
V2XWarnDataDrawer.getInstance().renderWarnData(mCloundWarningInfo.getLon(), mCloundWarningInfo.getLat(), mCloundWarningInfo.getType(), mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon(), mCloundWarningInfo.getAngle(), mCloundWarningInfo.getShowTime());
Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerService()).renderWarningMoveMarker(mCloundWarningInfo.getLon()
, mCloundWarningInfo.getLat()
, mCloundWarningInfo.getType()
, mCloundWarningInfo.getCollisionLat()
, mCloundWarningInfo.getCollisionLon()
, mCloundWarningInfo.getAngle()
, mCloundWarningInfo.getShowTime());
}, 0);
}
@@ -271,7 +277,7 @@ public class V2XWarningMarker implements IV2XMarker {
entity.setLat(latLng.lat);
entity.setLon(latLng.lon);
entity.setHeading(mCloundWarningInfo.getHeading());
V2XWarnDataDrawer.getInstance().renderStopLineData(entity.getLon(), entity.getLat());
Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerService()).renderStopLineMarker(entity.getLon(), entity.getLat());
}
}
} catch (Exception e) {
@@ -417,7 +423,7 @@ public class V2XWarningMarker implements IV2XMarker {
for (int i = 0; i < count; i++) {
MogoLatLng newLo = Trigonometric.getNewLocation(
startLatLng.getLon(), startLatLng.getLat(), 5 * (i + 1), Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat));
V2XWarnDataDrawer.getInstance().drawerArrowsMarkerWithLocation(newLo, WARNING_ARROWS, 10, new Double(rotate).intValue());
Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerService()).drawerArrowsMarkerWithLocation(newLo, WARNING_ARROWS, 10, new Double(rotate).intValue());
CallerLogger.INSTANCE.d(M_V2X + TAG, "小箭头位置" + newLo);
}
}
@@ -427,7 +433,7 @@ public class V2XWarningMarker implements IV2XMarker {
//线随车动
public void onCarLocationChanged2(MogoLocation latLng) {
carLocation = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() && isSelfLineClear == false) {
if (MogoStatusManager.getInstance().isVrMode() && !isSelfLineClear) {
if (mCloundWarningInfo != null) {
V2XLocation v2XLocation = new V2XLocation();
v2XLocation.setLat(latLng.getLatitude());
@@ -437,7 +443,7 @@ public class V2XWarningMarker implements IV2XMarker {
//衡阳交付-取消划线需求,只渲染识别物红色模型移动过程
//drawSelfCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing());
}
CallerLogger.INSTANCE.d(M_V2X + TAG, "车辆行驶轨迹" + String.valueOf(latLng.getLongitude()) + "," + String.valueOf(latLng.getLatitude()));
CallerLogger.INSTANCE.d(M_V2X + TAG, "车辆行驶轨迹" + latLng.getLongitude() + "," + latLng.getLatitude());
}
@Override

View File

@@ -1,8 +1,8 @@
package com.mogo.eagle.core.function.v2x.events.utils
import com.mogo.module.common.entity.MarkerExploreWay
import com.mogo.module.common.entity.MarkerLocation
import com.mogo.module.common.entity.MarkerUserInfo
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay
import com.mogo.eagle.core.data.map.entity.MarkerLocation
import com.mogo.eagle.core.data.map.entity.MarkerUserInfo
import com.mogo.v2x.data.MarkerExploreWayItem
import com.mogo.v2x.data.V2XMarkerExploreWay
import com.mogo.v2x.data.V2XMarkerLocation
@@ -16,7 +16,7 @@ fun V2XMarkerLocation?.toMarkerLocation(): MarkerLocation? = if (this == null) n
it.angle = this.angle
}
fun MarkerExploreWayItem?.toMarkerExploreWayItem(): com.mogo.module.common.entity.MarkerExploreWayItem? = if (this == null) null else com.mogo.module.common.entity.MarkerExploreWayItem().also {
fun MarkerExploreWayItem?.toMarkerExploreWayItem(): com.mogo.eagle.core.data.map.entity.MarkerExploreWayItem? = if (this == null) null else com.mogo.eagle.core.data.map.entity.MarkerExploreWayItem().also {
it.illegalCount = this.illegalCount
it.content = this.content
it.url = this.url

View File

@@ -1,20 +1,19 @@
package com.mogo.eagle.core.function.v2x.events.utils;
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING;
import static com.mogo.eagle.core.data.map.entity.V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
import com.mogo.eagle.core.data.map.entity.MarkerResponse;
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.data.map.entity.V2XWarningEntity;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XOptimalRouteDataRes;
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSpecialCarRes;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.v2x.event.V2XEvent;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;

View File

@@ -2,13 +2,13 @@ package com.mogo.eagle.core.function.v2x.events.utils;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X;
import com.mogo.eagle.core.data.map.entity.V2XEventZanData;
import com.mogo.eagle.core.data.map.entity.V2XHistoryScenarioData;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.sqlite.SQLIDao;
import com.mogo.eagle.core.utilcode.util.TimeUtils;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.module.common.entity.V2XEventZanData;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
import com.mogo.utils.sqlite.SQLDaoFactory;
import java.util.List;

View File

@@ -12,9 +12,8 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.service.statusmanager.IMogoStatusManager;
/**
@@ -42,11 +41,7 @@ public class HeartLikeView extends LinearLayout implements Animator.AnimatorList
super(context, attrs, defStyleAttr);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.HeartLikeView, defStyleAttr,
0);
boolean isVrMode = false;
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
isVrMode = statusManager.isVrMode();
}
boolean isVrMode = MogoStatusManager.getInstance().isVrMode();
boolean showGrayBack = typedArray.getBoolean(R.styleable.HeartLikeView_showGrayBack, false);
@@ -57,14 +52,12 @@ public class HeartLikeView extends LinearLayout implements Animator.AnimatorList
inflate(context, isVrMode ? R.layout.view_heart_like_vr : R.layout.view_heart_like, this);
mIllegalParkingLike = findViewById(R.id.ivIllegalParkingLike);
}
boolean finalIsVrMode = isVrMode;
setOnClickListener(v -> {
if (!isAnimator) {
isAnimator = true;
if (mAnimatorSet == null) {
mAnimatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(getContext(),
finalIsVrMode ? R.animator.v2x_like_heart_animation_vr : R.animator.v2x_like_heart_animation);
isVrMode ? R.animator.v2x_like_heart_animation_vr : R.animator.v2x_like_heart_animation);
mAnimatorSet.setTarget(mIllegalParkingLike);
mAnimatorSet.addListener(this);
}
@@ -84,12 +77,7 @@ public class HeartLikeView extends LinearLayout implements Animator.AnimatorList
if (mOnClickCallListener != null) {
mOnClickCallListener.onClicked(HeartLikeView.this);
}
boolean isVrMode = false;
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
isVrMode = statusManager.isVrMode();
}
if (isVrMode) {
if (MogoStatusManager.getInstance().isVrMode()) {
mIllegalParkingLike.setImageResource(R.drawable.module_common_icon_like_selected_vr);
}
}

View File

@@ -13,9 +13,8 @@ import android.widget.LinearLayout;
import androidx.annotation.Nullable;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.service.statusmanager.IMogoStatusManager;
/**
@@ -42,29 +41,24 @@ public class HeartUnLikeView extends LinearLayout implements Animator.AnimatorLi
public HeartUnLikeView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
boolean isVrMode = false;
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
isVrMode = statusManager.isVrMode();
}
boolean isVrMode = MogoStatusManager.getInstance().isVrMode();
inflate(context, isVrMode ? R.layout.view_heart_unlike_vr : R.layout.view_heart_unlike, this);
mIllegalParkingUnLike = findViewById(R.id.ivIllegalParkingUnLike);
animationImageView = findViewById(R.id.animationImage);
boolean finalIsVrMode = isVrMode;
setOnClickListener(v -> {
if (!isAnimator) {
isAnimator = true;
if (mAnimatorSet == null) {
mAnimatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(getContext(),
finalIsVrMode ?
isVrMode ?
R.animator.v2x_unlike_heart_animation_vr : R.animator.v2x_unlike_heart_animation);
mAnimatorSet.setTarget(mIllegalParkingUnLike);
mAnimatorSet.addListener(this);
}
mAnimatorSet.start();
}
if (finalIsVrMode) {
if (isVrMode) {
animationImageView.setVisibility(View.VISIBLE);
Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.v2x_unlike_heart_scale_ani_vr);
animationImageView.startAnimation(animation);
@@ -84,12 +78,7 @@ public class HeartUnLikeView extends LinearLayout implements Animator.AnimatorLi
if (mOnClickCallListener != null) {
mOnClickCallListener.onClicked(HeartUnLikeView.this);
}
boolean isVrMode = false;
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
if (statusManager != null) {
isVrMode = statusManager.isVrMode();
}
if (isVrMode) {
if (MogoStatusManager.getInstance().isVrMode()) {
mIllegalParkingUnLike.setImageResource(R.drawable.module_common_icon_unlike_selected_vr);
}
}

View File

@@ -7,6 +7,7 @@ import android.view.View
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.function.v2x.R
import com.mogo.eagle.core.widget.glide.SkinAbleBitmapTarget
import com.shuyu.gsyvideoplayer.GSYVideoManager
@@ -14,8 +15,6 @@ import com.shuyu.gsyvideoplayer.utils.GSYVideoType
import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.statusManager
import com.mogo.service.statusmanager.IMogoStatusManager
class SimpleCoverVideoPlayer : StandardGSYVideoPlayer {
@@ -45,12 +44,7 @@ class SimpleCoverVideoPlayer : StandardGSYVideoPlayer {
}
override fun getLayoutId(): Int {
var isVrMode = false
val statusManager: IMogoStatusManager? = statusManager()
if (statusManager != null) {
isVrMode = statusManager.isVrMode
}
if (isVrMode) {
if (MogoStatusManager.getInstance().isVrMode) {
return R.layout.v2x_road_video_plyer_layout_vr
}
return R.layout.v2x_road_video_plyer_layout

View File

@@ -19,6 +19,7 @@ import com.mogo.cloud.trafficlive.api.ITrafficIntersectionLiveCallBack;
import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.data.map.entity.MarkerCarInfo;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
@@ -30,7 +31,6 @@ import com.mogo.eagle.core.widget.RoundLayout;
import com.mogo.eagle.core.widget.media.video.SimpleVideoPlayer;
import com.mogo.map.MogoLocationClient;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.module.common.entity.MarkerCarInfo;
import com.shuyu.gsyvideoplayer.GSYVideoManager;
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
import com.shuyu.gsyvideoplayer.cache.CacheFactory;

View File

@@ -16,6 +16,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.map.entity.MarkerCarInfo;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceCallbackListener;
@@ -24,7 +25,6 @@ import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceManager;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.eagle.core.widget.RoundLayout;
import com.mogo.module.common.entity.MarkerCarInfo;
import com.tencent.rtmp.ITXLivePlayListener;
import com.tencent.rtmp.TXLiveConstants;
import com.tencent.rtmp.TXLivePlayConfig;

Some files were not shown because too many files have changed in this diff Show More