Merge branch 'dev_robotaxi-d-app-module_2110_220915_2.11.0' into 'test_robotaxi-d-app-module_2110_220915_2.11.0.1'
Dev robotaxi d app module 2110 220915 2.11.0 See merge request zhjt/AndroidApp/MoGoEagleEye!256
This commit is contained in:
@@ -157,6 +157,7 @@ public class BusPassengerModel {
|
||||
|| data.getResult() == null
|
||||
|| data.getResult().getSites() == null) {
|
||||
routesResult = null;
|
||||
startOrStopCalculateRouteInfo(false);
|
||||
if (mRouteLineInfoCallback != null){
|
||||
mRouteLineInfoCallback.showNoTaskView();
|
||||
}
|
||||
|
||||
@@ -147,17 +147,6 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
runOnUIThread(() -> mView.clearBusStationsMarkers());
|
||||
}
|
||||
|
||||
private void functionDemoModeChange() {
|
||||
// CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel ="," functionDemoModeChange ="+mCurrentStation);
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& ((mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1)
|
||||
|| ((mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1)
|
||||
&& BusOrderModel.getInstance().isGoingToNextStation()))) {
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideSlidePanel() {
|
||||
if (mView != null) {
|
||||
@@ -184,9 +173,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
switch (state) {
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE:
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
if (currentAutopilotStatus == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {//2-->1语音提示
|
||||
// AIAssist.getInstance( getContext() ).speakTTSVoice( "已进入人工驾驶模式" );
|
||||
}
|
||||
|
||||
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE;
|
||||
// 设置UI【自动驾驶】按钮是否展示
|
||||
runOnUIThread(() -> mView.onAutopilotEnableChange(true));
|
||||
@@ -195,11 +182,8 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
// }
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& (
|
||||
(mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1)
|
||||
|| (
|
||||
(mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1)
|
||||
&& BusOrderModel.getInstance().isGoingToNextStation()
|
||||
)
|
||||
(mCurrentStation >= 0 && mCurrentStation <= mStationList.size() - 1)
|
||||
&& BusOrderModel.getInstance().isGoingToNextStation()
|
||||
)
|
||||
) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能");
|
||||
@@ -212,11 +196,11 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING:
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING;
|
||||
// 改变UI自动驾驶状态
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
|
||||
BusOrderModel.getInstance().triggerStartServiceEvent(
|
||||
BusOrderModel.getInstance().isRestartAutopilot(), true);
|
||||
}
|
||||
// 改变UI自动驾驶状态
|
||||
runOnUIThread(() -> mView.onAutopilotStatusChanged(currentAutopilotStatus));
|
||||
break;
|
||||
case IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE:
|
||||
if (currentAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
@@ -226,11 +210,9 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
currentAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE;
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& (
|
||||
(mCurrentStation > 0 && mCurrentStation < mStationList.size() - 1)
|
||||
|| (
|
||||
(mCurrentStation == 0 || mCurrentStation == mStationList.size() - 1)
|
||||
&& BusOrderModel.getInstance().isGoingToNextStation()
|
||||
)
|
||||
(mCurrentStation >= 0 && mCurrentStation <= mStationList.size() - 1)
|
||||
&& BusOrderModel.getInstance().isGoingToNextStation()
|
||||
|
||||
)
|
||||
) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + "BusOrderModel=", "有美化功能");
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotActionsListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
@@ -57,10 +58,18 @@ public class OCHAdasAbilityManager implements IMoGoAutopilotActionsListener {
|
||||
public void onAutopilotAbility(@Nullable AutopilotAbility ability) {
|
||||
isAutopilotAbility = true;
|
||||
autopilotAbilityReason = null;
|
||||
if (ability.gear == null || ability.gear == Chassis.GearPosition.GEAR_P || ability.gear == Chassis.GearPosition.GEAR_R) {
|
||||
if (ability.gear == null || ability.gear == Chassis.GearPosition.GEAR_P ||
|
||||
ability.gear == Chassis.GearPosition.GEAR_R) {
|
||||
isAutopilotAbility = false;
|
||||
autopilotAbilityReason = "挡位不正常";
|
||||
}
|
||||
|
||||
if (DebugConfig.getProductFlavor() == "fPadLenovoOchBus" &&
|
||||
ability.gear == Chassis.GearPosition.GEAR_N){ //bus档位不正常
|
||||
isAutopilotAbility = false;
|
||||
autopilotAbilityReason = "挡位不正常";
|
||||
}
|
||||
|
||||
if (isAutopilotAbility)
|
||||
if (ability.brake > 0) {
|
||||
isAutopilotAbility = false;
|
||||
|
||||
@@ -1304,7 +1304,13 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
/**
|
||||
* 升级app弹框
|
||||
*/
|
||||
override fun showUpgradeDialog(name: String, url: String, title: String, content: String, installType: String) {
|
||||
override fun showUpgradeDialog(
|
||||
name: String,
|
||||
url: String,
|
||||
title: String,
|
||||
content: String,
|
||||
installType: String
|
||||
) {
|
||||
if (upgradeAppDialog == null) {
|
||||
upgradeAppDialog = UpgradeAppDialog(requireContext())
|
||||
}
|
||||
@@ -1379,6 +1385,7 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
* 工控机监控节点上报
|
||||
*/
|
||||
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
|
||||
Log.d("EmArrow-1013", "onAutopilotGuardian : $guardianInfo , takeOver : $takeOver")
|
||||
ThreadUtils.runOnUiThread {
|
||||
guardianInfo?.let {
|
||||
if (reportList.size > 49) {
|
||||
@@ -1404,8 +1411,11 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
EXIT_AUTOPILOT_FOR_LOCATION,
|
||||
EXIT_AUTOPILOT_FOR_CHASSIS,
|
||||
EXIT_AUTOPILOT_FOR_DISTANCE -> {
|
||||
if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData
|
||||
&& getAutoPilotStatusInfo().state != STATUS_AUTOPILOT_RUNNING) {
|
||||
Log.d(
|
||||
"EmArrow-1013",
|
||||
"it code : ${it.code} , state : ${getAutoPilotStatusInfo().state}"
|
||||
)
|
||||
if (getAutoPilotStatusInfo().state != STATUS_AUTOPILOT_RUNNING) {
|
||||
showWarningV2X(
|
||||
EventTypeEnum.TAKE_OVER_EVENT.poiType,
|
||||
EventTypeEnum.TAKE_OVER_EVENT.content,
|
||||
@@ -1413,11 +1423,13 @@ class MoGoHmiFragment : MvpFragment<MoGoHmiContract.View?, HmiPresenter?>(),
|
||||
EventTypeEnum.TAKE_OVER_EVENT.poiType,
|
||||
object : IMoGoWarningStatusListener {
|
||||
override fun onShow() {
|
||||
Log.d("EmArrow-1013", "onShow")
|
||||
takeOver = true
|
||||
clTakeOverView.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun onDismiss() {
|
||||
Log.d("EmArrow-1013", "onDismiss")
|
||||
takeOver = false
|
||||
clTakeOverView.visibility = View.GONE
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
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.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
@@ -54,6 +55,8 @@ import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* 小地图的方向View
|
||||
*
|
||||
@@ -62,7 +65,7 @@ import java.util.TimerTask;
|
||||
*/
|
||||
public class SmallMapDirectionView
|
||||
extends RelativeLayout
|
||||
implements IMoGoMapLocationListener, ISmallMapDirectionView {
|
||||
implements IMoGoMapLocationListener, ISmallMapDirectionView, IMoGoAutopilotStatusListener {
|
||||
|
||||
//小地图名称
|
||||
public static final String TAG = "SmallMapDirectionView";
|
||||
@@ -367,4 +370,9 @@ public class SmallMapDirectionView
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(@org.jetbrains.annotations.Nullable MessagePad.ArrivalNotification arrivalNotification) {
|
||||
clearPolyline();
|
||||
mCoordinatesLatLng.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,93 +1,77 @@
|
||||
package com.mogo.eagle.core.function.v2x.events
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.content.*
|
||||
import android.os.*
|
||||
import android.provider.Settings.System
|
||||
import android.util.*
|
||||
import androidx.core.util.Pair
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import androidx.localbroadcastmanager.content.*
|
||||
import com.mogo.cloud.commons.utils.*
|
||||
import com.mogo.cloud.passport.IMoGoTokenCallback
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.network.ParamsUtil
|
||||
import com.mogo.cloud.passport.*
|
||||
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.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.data.enums.*
|
||||
import com.mogo.eagle.core.data.map.*
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
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.function.call.map.CallerMapLocationListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
|
||||
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.*
|
||||
import com.mogo.eagle.core.function.call.hmi.*
|
||||
import com.mogo.eagle.core.function.call.map.*
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooClose
|
||||
import com.mogo.eagle.core.function.v2x.events.alarm.V2XAlarmServer
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
|
||||
import com.mogo.eagle.core.function.v2x.events.alarm.*
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.*
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.context
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.BROADCAST_SCENE_EXTRA_KEY
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.BROADCAST_SCENE_HANDLER_ACTION
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.MODULE_NAME
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_ACC_OFF_TIME_STR
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_STRATEGY_PUSH
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XSeekHelpRes
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.net.V2XStrategyPushRes
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager
|
||||
import com.mogo.eagle.core.function.v2x.events.network.V2XRefreshCallback
|
||||
import com.mogo.eagle.core.function.v2x.events.observer.V2XOptimalRouteObserver
|
||||
import com.mogo.eagle.core.function.v2x.events.receiver.SceneBroadcastReceiver
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.V2XScenarioManager
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.*
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.*
|
||||
import com.mogo.eagle.core.function.v2x.events.entity.net.*
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.*
|
||||
import com.mogo.eagle.core.function.v2x.events.network.*
|
||||
import com.mogo.eagle.core.function.v2x.events.observer.*
|
||||
import com.mogo.eagle.core.function.v2x.events.receiver.*
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.impl.*
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.*
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker.Marker
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.road.*
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.*
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.V2XVoiceManager
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.MapUtils
|
||||
import com.mogo.eagle.core.function.v2x.events.voice.*
|
||||
import com.mogo.eagle.core.network.utils.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.*
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.marker.IMogoMarker
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener
|
||||
import com.mogo.module.common.ModuleNames
|
||||
import com.mogo.module.common.drawer.TrafficMarkerDrawer
|
||||
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.module.common.enums.EventTypeEnum
|
||||
import com.mogo.module.common.enums.EventTypeHelper
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener
|
||||
import com.mogo.service.statusmanager.StatusDescriptor
|
||||
import com.mogo.module.common.enums.*
|
||||
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.V2XManager
|
||||
import com.mogo.v2x.callback.IV2XCallback
|
||||
import com.mogo.v2x.config.V2XConfig
|
||||
import com.mogo.v2x.*
|
||||
import com.mogo.v2x.callback.*
|
||||
import com.mogo.v2x.config.*
|
||||
import com.mogo.v2x.data.*
|
||||
import com.mogo.v2x.event.V2XEvent
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.cache.CacheFactory
|
||||
import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager
|
||||
import com.shuyu.gsyvideoplayer.model.VideoOptionModel
|
||||
import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
|
||||
import com.shuyu.gsyvideoplayer.player.PlayerFactory
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
import com.zhjt.service.chain.TracingConstants
|
||||
import com.mogo.v2x.event.*
|
||||
import com.shuyu.gsyvideoplayer.*
|
||||
import com.shuyu.gsyvideoplayer.cache.*
|
||||
import com.shuyu.gsyvideoplayer.model.*
|
||||
import com.shuyu.gsyvideoplayer.player.*
|
||||
import com.shuyu.gsyvideoplayer.utils.*
|
||||
import com.zhjt.service.chain.*
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.android.asCoroutineDispatcher
|
||||
import kotlinx.coroutines.android.*
|
||||
import roadwork.Road.RW_PB
|
||||
import tv.danmaku.ijk.media.player.IjkMediaPlayer
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import tv.danmaku.ijk.media.player.*
|
||||
import java.util.concurrent.*
|
||||
import java.util.concurrent.atomic.*
|
||||
|
||||
|
||||
object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallback,
|
||||
@@ -345,6 +329,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
|
||||
private fun refreshCarState(location: MogoLocation) {
|
||||
V2XStatusManager.getInstance().location = location
|
||||
// V2XAiRoadEventMarker.onLocationChanged(location)
|
||||
// 只有车速大于 5 的时候进行计算
|
||||
if (location.speed < 5) return
|
||||
val v2xPolyline = BridgeApi.v2xPolyline()?.mogoPolyline
|
||||
@@ -476,6 +461,15 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
|
||||
private val RW_PB.toRoadMarker: V2XMarkerCardResult
|
||||
get() = V2XMarkerCardResult().also { l1 ->
|
||||
this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.also { old ->
|
||||
l1.extras = HashMap<String, List<Pair<Double, Double>>>().also { extra ->
|
||||
extra["polygon"] = old.map { d ->
|
||||
Pair(d.lon, d.lat)
|
||||
}
|
||||
|
||||
extra["gps_location"] = listOf(Pair(this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.point?.lat ?: 0.0))
|
||||
}
|
||||
}
|
||||
l1.exploreWay = ArrayList<V2XMarkerExploreWay>().also { l2 ->
|
||||
l2.add(V2XMarkerExploreWay().also { l3 ->
|
||||
l3.poiType = this.roadwork?.poiType?.toString()
|
||||
@@ -484,23 +478,22 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
val p = CoordinateUtils.transformWgsToGcj(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0)
|
||||
l4.lon = p[0]
|
||||
l4.lat = p[1]
|
||||
AiRoadMarker.enqueue(Marker(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0, this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.map { d ->
|
||||
android.util.Pair(d.lon, d.lat)
|
||||
}))
|
||||
l4.angle = this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0
|
||||
}
|
||||
})
|
||||
}
|
||||
this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.also { old ->
|
||||
l1.extras = HashMap<String, List<Pair<Double, Double>>>().also { extra ->
|
||||
extra["polygon"] = old.map { d ->
|
||||
val p = CoordinateUtils.transformWgsToGcj(d.lat, d.lon)
|
||||
Pair(p[0], p[1])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// private fun buildRoadEntity(e: V2XMarkerExploreWay, extra: Map<String, Any>? = null): V2XRoadEventEntity { // 记录道路事件
|
||||
// val v2XRoadEventEntity = V2XRoadEventEntity()
|
||||
// v2XRoadEventEntity.location = e.location.toMarkerLocation() // 探路目前只有上报拥堵
|
||||
// v2XRoadEventEntity.poiType = EventTypeEnum.AI_ROAD_WORK.poiType
|
||||
// v2XRoadEventEntity.noveltyInfo = e.toMarkExploreWay(extra)
|
||||
// v2XRoadEventEntity.expireTime = 20000
|
||||
// return v2XRoadEventEntity
|
||||
// }
|
||||
|
||||
private fun handleWarningTargetEvent(data: V2XWarningTarget) {
|
||||
val v2xMessageEntity = V2XMessageEntity<V2XWarningTarget>()
|
||||
v2xMessageEntity.type = V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS
|
||||
|
||||
@@ -79,4 +79,8 @@ public interface IMoGoV2XMarkerManager extends IProvider {
|
||||
void clearALLPOI();
|
||||
|
||||
|
||||
/**
|
||||
* 强制清除道路事件POI
|
||||
*/
|
||||
void forceClearAlarmPOI();
|
||||
}
|
||||
|
||||
@@ -148,8 +148,9 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
|
||||
v2XRoadEventEntity.setLocation(EntityUtilsKt.toMarkerLocation(markerLocation));
|
||||
// 探路目前只有上报拥堵
|
||||
v2XRoadEventEntity.setPoiType(markerExploreWay.getPoiType());
|
||||
String poi = markerExploreWay.getPoiType();
|
||||
|
||||
v2XRoadEventEntity.setPoiType(poi);
|
||||
v2XRoadEventEntity.setNoveltyInfo(EntityUtilsKt.toMarkExploreWay(markerExploreWay,markerCardResult.getExtras()));
|
||||
v2XRoadEventEntity.setExpireTime(20000);
|
||||
mV2XRoadEventEntityArrayList.add(v2XRoadEventEntity);
|
||||
@@ -319,6 +320,13 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceClearAlarmPOI() {
|
||||
if (mAlarmInfoMarker != null) {
|
||||
mAlarmInfoMarker.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad
|
||||
import android.animation.*
|
||||
import android.content.*
|
||||
import android.graphics.*
|
||||
import android.util.*
|
||||
import android.view.animation.*
|
||||
import androidx.core.util.Pair
|
||||
import androidx.lifecycle.*
|
||||
import androidx.lifecycle.Lifecycle.Event
|
||||
import androidx.lifecycle.Lifecycle.Event.ON_CREATE
|
||||
@@ -14,10 +14,12 @@ import com.mogo.eagle.core.data.map.MapRoadInfo.StopLine
|
||||
import com.mogo.eagle.core.function.api.map.listener.*
|
||||
import com.mogo.eagle.core.function.call.map.*
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.OnRoadListener
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.scene.road.*
|
||||
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.util.*
|
||||
@@ -138,7 +140,6 @@ object AiRoadMarker {
|
||||
|
||||
private val onLocationListener = object : IMoGoMapLocationListener {
|
||||
|
||||
|
||||
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
|
||||
if (location == null || !isGps) {
|
||||
return
|
||||
@@ -170,7 +171,6 @@ object AiRoadMarker {
|
||||
removeLine()
|
||||
}
|
||||
|
||||
|
||||
fun enqueue(marker: Marker) {
|
||||
Logger.d(TAG, "--- enqueue --- 1 ---")
|
||||
if (markers.contains(marker)) {
|
||||
@@ -187,7 +187,7 @@ object AiRoadMarker {
|
||||
}
|
||||
}
|
||||
|
||||
private fun marker(marker: Marker) {
|
||||
fun marker(marker: Marker) {
|
||||
val location = carLocation.get() ?: return
|
||||
//施工中心点前方的自车行驶方向上300米距离
|
||||
val l1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), 300f)
|
||||
@@ -239,6 +239,7 @@ object AiRoadMarker {
|
||||
return
|
||||
}
|
||||
removeLine()
|
||||
marker.entity?.apply { V2XAiRoadEventMarker.drawMarkers(this) }
|
||||
val evaluator = ArgbEvaluator()
|
||||
val interceptor = DecelerateInterpolator(1.5f)
|
||||
val total = points.size
|
||||
@@ -273,9 +274,10 @@ object AiRoadMarker {
|
||||
}
|
||||
}
|
||||
|
||||
private fun unMarker(marker: Marker) {
|
||||
fun unMarker(marker: Marker) {
|
||||
markers -= marker
|
||||
removeLine()
|
||||
V2XAiRoadEventMarker.removeMarkers(null)
|
||||
}
|
||||
|
||||
private fun isOutOfRange(markerLon: Double, markerLat: Double, carLon: Double, carLat: Double, carAngle: Double): Boolean {
|
||||
@@ -291,8 +293,9 @@ object AiRoadMarker {
|
||||
val poi_lat: Double,
|
||||
val poi_lon: Double,
|
||||
val poi_angle: Double,
|
||||
val polygon: List<Pair<Double, Double>>?,
|
||||
var farthestPoint: Pair<Double, Double>? = null
|
||||
val polygon: List<androidx.core.util.Pair<Double, Double>>?,
|
||||
var farthestPoint: androidx.core.util.Pair<Double, Double>? = null,
|
||||
var entity: V2XRoadEventEntity? = null
|
||||
) {
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road
|
||||
|
||||
import android.util.*
|
||||
import com.mogo.cloud.commons.utils.*
|
||||
import com.mogo.eagle.core.data.map.*
|
||||
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.*
|
||||
import kotlin.Pair
|
||||
|
||||
object V2XAiRoadEventMarker {
|
||||
|
||||
private val current = AtomicReference<Pair<IMogoPolyline?, List<IMogoMarker>?>>()
|
||||
|
||||
private val v2xLocation = AtomicReference<MogoLocation>()
|
||||
|
||||
private val carLocation = AtomicReference<MogoLocation>()
|
||||
|
||||
private val timer = Timer()
|
||||
|
||||
private val timerTask by lazy { AtomicReference<TimerTask>() }
|
||||
|
||||
private val distance = AtomicInteger(0)
|
||||
|
||||
fun drawMarkers(entity: V2XRoadEventEntity): Pair<IMogoPolyline?, List<IMogoMarker>?>? {
|
||||
removeMarkers(current.get())
|
||||
timerTask.get()?.cancel()
|
||||
val extra = entity.noveltyInfo.extras.get("polygon");
|
||||
if (extra is List<*>) {
|
||||
val l = extra
|
||||
if (l.size > 0) {
|
||||
val polygons: MutableList<androidx.core.util.Pair<Double, Double>> = ArrayList()
|
||||
for (i in l.indices) {
|
||||
val o = l[i]!! as? androidx.core.util.Pair<*, *> ?: continue
|
||||
val p = o
|
||||
val first = p.first
|
||||
val second = p.second
|
||||
if (first == null || second == null) {
|
||||
continue
|
||||
}
|
||||
if (first !is Double || second !is Double) {
|
||||
continue
|
||||
}
|
||||
val xx = CoordinateUtils.transformWgsToGcj(second, first)
|
||||
polygons.add(androidx.core.util.Pair.create(xx[0], xx[1]))
|
||||
}
|
||||
if (polygons.size > 0) {
|
||||
val markers = ArrayList<IMogoMarker>(polygons.size)
|
||||
for (i in polygons.indices) {
|
||||
val p = polygons[i]
|
||||
val options = MogoMarkerOptions().data(entity).latitude(p.second).longitude(p.first)
|
||||
options.anchor(0.5f, 0.5f)
|
||||
options.icon3DRes(raw.sanjiaozhui)
|
||||
try {
|
||||
val marker = MogoMarkerManager.getInstance(context()).addMarker("road_pyramid_" + entity.getPoiType(), options)
|
||||
markers += marker
|
||||
} catch (t: Throwable) {
|
||||
t.printStackTrace()
|
||||
}
|
||||
}
|
||||
if (markers.size > 0) {
|
||||
v2xMarker()?.drawableAlarmPOI(context(), entity, null)
|
||||
val l2 = entity.noveltyInfo?.location ?: return null
|
||||
v2xLocation.set(MogoLocation().also { it.longitude = l2.lon; it.latitude = l2.lat; it.bearing = l2.angle.toFloat() })
|
||||
current.set(Pair(null, markers))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return current.get()
|
||||
}
|
||||
|
||||
fun removeMarkers(pair: Pair<IMogoPolyline?, List<IMogoMarker>?>?) {
|
||||
if (pair != null) {
|
||||
realRemove(pair)
|
||||
} else {
|
||||
val prev = current.get()
|
||||
if (prev != null) {
|
||||
realRemove(prev)
|
||||
val v2xMarker = v2xMarker()
|
||||
v2xMarker?.also {
|
||||
it.forceClearAlarmPOI()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun realRemove(pair: Pair<IMogoPolyline?, List<IMogoMarker>?>) {
|
||||
val line = pair.first
|
||||
if (line != null && line.isVisible) {
|
||||
line.remove()
|
||||
}
|
||||
val markers = pair.second
|
||||
if (markers != null && markers.isNotEmpty()) {
|
||||
for (m in markers) {
|
||||
m.remove()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun onLocationChanged(location: MogoLocation) {
|
||||
val markerLocation = v2xLocation.get()
|
||||
carLocation.set(location)
|
||||
if (markerLocation != null) {
|
||||
if (isOutOfRange(markerLocation.longitude, markerLocation.latitude, location.longitude, location.latitude, location.bearing.toDouble())) {
|
||||
v2xLocation.set(null)
|
||||
this.distance.set(0)
|
||||
timer.schedule(object : TimerTask() {
|
||||
override fun run() {
|
||||
val carLocation = this@V2XAiRoadEventMarker.carLocation.get()
|
||||
Log.d("XXXXX", "timer do action ---: marker_lon: ${markerLocation.longitude}, marker_lat: ${markerLocation.latitude}, car_lon:${carLocation.longitude}, car_lat: ${carLocation.latitude}")
|
||||
checkDistanceIsValid(markerLocation.longitude, markerLocation.latitude, carLocation)
|
||||
}
|
||||
}.also { this.timerTask.set(it) }, 1000, 1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun checkDistanceIsValid(x1: Double, y1: Double, location: MogoLocation) {
|
||||
val distance = DrivingDirectionUtils.distance(x1, y1, location.longitude, location.latitude)
|
||||
Log.d("XXXXX", "distance: $distance")
|
||||
if (this.distance.addAndGet(distance.toInt()) >= 100) {
|
||||
Log.d("XXXXX", "remove marker")
|
||||
removeMarkers(null)
|
||||
this.timerTask.get()?.cancel()
|
||||
}
|
||||
}
|
||||
|
||||
private fun isOutOfRange(markerLon: Double, markerLat: Double, carLon: Double, carLat: Double, carAngle: Double): Boolean {
|
||||
return !isFrontOfCar(markerLon, markerLat, carLon, carLat, carAngle)
|
||||
}
|
||||
|
||||
private fun isFrontOfCar(markerLon: Double, markerLat: Double, carLon: Double, carLat: Double, carAngle: Double): Boolean {
|
||||
val degree = DrivingDirectionUtils.getDegreeOfCar2Poi2(carLon, carLat, markerLon, markerLat, carAngle)
|
||||
return degree < 90
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,21 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.core.util.Pair;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
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.manager.IMoGoV2XStatusManager;
|
||||
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.map.MogoMarkerManager;
|
||||
import com.mogo.map.MogoOverlayManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 道路V2X事件的Marker
|
||||
@@ -28,11 +23,7 @@ import java.util.List;
|
||||
public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
|
||||
|
||||
|
||||
private final List<IMogoMarker> pyramids = new ArrayList<>();
|
||||
|
||||
private IMogoPolyline polyline;
|
||||
|
||||
private IMogoOverlayManager overlayManager;
|
||||
private AiRoadMarker.Marker mMarker;
|
||||
|
||||
@Override
|
||||
public void drawPOI(V2XRoadEventEntity entity) {
|
||||
@@ -42,57 +33,59 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
|
||||
if (marker != null) {
|
||||
marker.clearAlarmPOI();
|
||||
if (entity != null) {
|
||||
marker.drawableAlarmPOI(BridgeApi.INSTANCE.context(), entity, null);
|
||||
MarkerExploreWay noveltyInfo = entity.getNoveltyInfo();
|
||||
if (noveltyInfo != null && noveltyInfo.extras != null && noveltyInfo.extras.containsKey("polygon")) {
|
||||
Object extra = noveltyInfo.extras.get("polygon");
|
||||
if (pyramids.size() > 0) {
|
||||
for (IMogoMarker m : pyramids) {
|
||||
m.remove();
|
||||
}
|
||||
pyramids.clear();
|
||||
if (!Objects.equals(entity.getPoiType(), EventTypeEnum.AI_ROAD_WORK.getPoiType())) {
|
||||
AiRoadMarker.Marker prev = mMarker;
|
||||
if (prev != null) {
|
||||
AiRoadMarker.INSTANCE.unMarker(prev);
|
||||
mMarker = null;
|
||||
}
|
||||
if (polyline != null && polyline.isVisible()) {
|
||||
polyline.remove();
|
||||
marker.drawableAlarmPOI(BridgeApi.INSTANCE.context(), entity, null);
|
||||
} else {
|
||||
AiRoadMarker.Marker prev = mMarker;
|
||||
if (prev != null) {
|
||||
AiRoadMarker.INSTANCE.unMarker(prev);
|
||||
mMarker = null;
|
||||
}
|
||||
if (extra instanceof List) {
|
||||
List l = (List) extra;
|
||||
if (l.size() > 0) {
|
||||
List<Pair<Double, Double>> polygons = new ArrayList<>();
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
Object o = l.get(i);
|
||||
if (!(o instanceof Pair)) {
|
||||
continue;
|
||||
}
|
||||
Pair p = (Pair) o;
|
||||
Object first = p.first;
|
||||
Object second = p.second;
|
||||
if (first == null || second == null) {
|
||||
continue;
|
||||
}
|
||||
if (!(first instanceof Double) || !(second instanceof Double)) {
|
||||
continue;
|
||||
}
|
||||
polygons.add(Pair.create((Double) first, (Double) second));
|
||||
}
|
||||
|
||||
if (polygons.size() > 0) {
|
||||
for (int i = 0; i < polygons.size(); i++) {
|
||||
Pair<Double, Double> p = polygons.get(i);
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.data(entity)
|
||||
.latitude(p.second)
|
||||
.longitude(p.first);
|
||||
options.anchor(0.5f, 0.5f);
|
||||
options.icon3DRes(R.raw.sanjiaozhui);
|
||||
try {
|
||||
pyramids.add(MogoMarkerManager.getInstance(BridgeApi.INSTANCE.context()).addMarker("road_pyramid_" + entity.getPoiType(), options));
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
MarkerExploreWay noveltyInfo = entity.getNoveltyInfo();
|
||||
if (noveltyInfo != null && noveltyInfo.extras != null) {
|
||||
List<Pair<Double, Double>> polygons = new ArrayList<>();
|
||||
Pair<Double, Double> gpsLocation = null;
|
||||
if (noveltyInfo.extras.containsKey("polygon")) {
|
||||
Object extra = noveltyInfo.extras.get("polygon");
|
||||
if (extra instanceof List) {
|
||||
List l = (List) extra;
|
||||
if (l.size() > 0) {
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
Object o = l.get(i);
|
||||
if (!(o instanceof Pair)) {
|
||||
continue;
|
||||
}
|
||||
Pair p = (Pair) o;
|
||||
Object first = p.first;
|
||||
Object second = p.second;
|
||||
if (first == null || second == null) {
|
||||
continue;
|
||||
}
|
||||
if (!(first instanceof Double) || !(second instanceof Double)) {
|
||||
continue;
|
||||
}
|
||||
polygons.add(Pair.create((Double) first, (Double) second));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (noveltyInfo.extras.containsKey("gps_location")) {
|
||||
gpsLocation = (Pair<Double, Double>) ((List)(noveltyInfo.extras.get("gps_location"))).get(0);
|
||||
}
|
||||
|
||||
if (!polygons.isEmpty() && gpsLocation != null) {
|
||||
MarkerLocation location = noveltyInfo.getLocation();
|
||||
AiRoadMarker.Marker m = new AiRoadMarker.Marker(gpsLocation.second, gpsLocation.first, location.getAngle(), polygons, null, entity);
|
||||
mMarker = m;
|
||||
AiRoadMarker.INSTANCE.marker(m);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,19 +102,6 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
|
||||
if (polyLineManager != null) {
|
||||
polyLineManager.clearLine();
|
||||
}
|
||||
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null && v2xStatus.isRoadEventPOIShow()) {
|
||||
if (polyline != null) {
|
||||
polyline.remove();
|
||||
}
|
||||
if (pyramids.size() > 0) {
|
||||
for (IMogoMarker marker : pyramids) {
|
||||
marker.remove();
|
||||
}
|
||||
pyramids.clear();
|
||||
}
|
||||
}
|
||||
IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
|
||||
if (v2xMarker != null) {
|
||||
// 移除事件POI
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user