[fetatue]
[charter]
[轨迹截取]
This commit is contained in:
yangyakun
2023-09-25 19:26:01 +08:00
parent a3b03725a4
commit f7d8940ab4

View File

@@ -36,7 +36,6 @@ import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
import com.mogo.och.common.module.manager.autopilotmanager.OCHAdasAbilityManager
import com.mogo.och.common.module.manager.StopSideStatusManager
import com.mogo.och.common.module.manager.devicemanage.callback.LightAirconditionDoorCallback
import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
import com.mogo.och.common.module.voice.VoiceNotice
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils
@@ -113,7 +112,7 @@ class BusPassengerPresenter(view: MainFragment?) :
}
OrderStatusEnum.OrderNoLine -> {
CallerOrderListenerManager.invokeOrderRemoval();
CallerOrderListenerManager.invokeOrderRemoval()
showNoviceGuidance()
}
@@ -191,7 +190,7 @@ class BusPassengerPresenter(view: MainFragment?) :
UiThreadHandler.post {
when (actionStatus) {
StopSideStatusManager.Status.NOSTART -> {
ToastCharterUtils.showToastShort(errorInfo?:"")
ToastCharterUtils.showToastShort(errorInfo ?: "")
}
StopSideStatusManager.Status.START -> {
@@ -216,6 +215,8 @@ class BusPassengerPresenter(view: MainFragment?) :
StopSideStatusManager.Status.EndingFaile -> {
ToastCharterUtils.showToastShort("车辆系统繁忙,请稍后再试")
}
else -> {}
}
}
}
@@ -265,60 +266,65 @@ class BusPassengerPresenter(view: MainFragment?) :
private fun getStationMiddleTrajectory(
trajectoryList: MutableList<MogoLocation>,
sites: List<SiteInfoResponse.SiteInfo>
):MutableList<LatLng> {
if(sites.size<2){
var temp:LatLng
): MutableList<LatLng> {
if (sites.size < 2 || trajectoryList.isEmpty()) {
var temp: LatLng
val indexPoint = mutableListOf<LatLng>()
trajectoryList.forEach {
temp = LatLng(it.latitude,it.longitude)
temp = LatLng(it.latitude, it.longitude)
indexPoint.add(temp)
}
return indexPoint
}
val firstStation = sites.first()
val firstMogoLocation = MogoLocation()
firstMogoLocation.longitude = firstStation.GcjLon!!
firstMogoLocation.latitude = firstStation.GcjLat!!
val firstNearestPointInfo = CoordinateCalculateRouteUtil.getNearestPointInfo(
0,
trajectoryList.size, trajectoryList.toList(), firstMogoLocation, 2
)
var minIndex = Int.MAX_VALUE
var maxIndex = 0
val lastStation = sites.last()
val lastMogoLocation = MogoLocation()
lastMogoLocation.longitude = lastStation.GcjLon!!
lastMogoLocation.latitude = lastStation.GcjLat!!
val lastNearestPointInfo = CoordinateCalculateRouteUtil.getNearestPointInfo(
firstNearestPointInfo.first,
trajectoryList.size, trajectoryList.toList(), firstMogoLocation, 2
)
sites.forEach {
val firstMogoLocation = MogoLocation()
firstMogoLocation.longitude = it.GcjLon!!
firstMogoLocation.latitude = it.GcjLat!!
val firstNearestPointInfo = CoordinateCalculateRouteUtil.getNearestPointInfo(
0,
trajectoryList.size,
trajectoryList.toList(),
firstMogoLocation,
2,
useHeading = false
)
val firstIndex = if(firstNearestPointInfo.third>15){
0
}else{
if(firstNearestPointInfo.second==true){// 最近点是下一个点
firstNearestPointInfo.first
}else{// 最近点是上一个点
firstNearestPointInfo.first+1
val temp =
when (firstNearestPointInfo.second) {
true -> {// 最近点是下一个点
firstNearestPointInfo.first
}
false -> {// 最近点是上一个点
firstNearestPointInfo.first + 1
}
else -> {
-1
}
}
if (temp > 0) {
if (minIndex > temp) {
minIndex = temp
}
if (maxIndex < temp) {
maxIndex = temp
}
}
}
val lastIndex = if(lastNearestPointInfo.third>15){
trajectoryList.size-1
}else{
if(firstNearestPointInfo.second==true){// 最近点是下一个点
firstNearestPointInfo.first-1
}else{// 最近点是上一个点
firstNearestPointInfo.first
}
if (minIndex > trajectoryList.size) {
minIndex = 0
}
val subList = trajectoryList.subList(firstIndex, lastIndex)
if (maxIndex == 0) {
maxIndex = trajectoryList.size - 1
}
val subList = trajectoryList.subList(minIndex, maxIndex)
val indexPoint = mutableListOf<LatLng>()
var temp:LatLng
var temp: LatLng
subList.forEach {
temp = LatLng(it.latitude,it.longitude)
temp = LatLng(it.latitude, it.longitude)
indexPoint.add(temp)
}
return indexPoint
@@ -328,8 +334,9 @@ class BusPassengerPresenter(view: MainFragment?) :
fun drawStationInfo(sites: List<SiteInfoResponse.SiteInfo>) {
val stationsList: MutableList<SiteMarkerBean> = mutableListOf()
val stationsNameList: MutableList<SiteMarkerBean> = mutableListOf()
val stationIcon = BitmapFactory.decodeResource(context.resources, R.drawable.charter_p_map_staton_icon)
var checkMarkView:SiteMarkerBean?=null
val stationIcon =
BitmapFactory.decodeResource(context.resources, R.drawable.charter_p_map_staton_icon)
var checkMarkView: SiteMarkerBean? = null
sites.forEach {
stationsList.add(
SiteMarkerBean(
@@ -354,7 +361,7 @@ class BusPassengerPresenter(view: MainFragment?) :
)
}
}
if(checkMarkView!=null) {
if (checkMarkView != null) {
stationsNameList.add(checkMarkView!!)
}
mView?.drawOverMapViewStation(stationsList, stationsNameList)