[6.7.0][Opt]起终点绘制监听Och业务数据变化
This commit is contained in:
@@ -179,12 +179,14 @@ class MapContainerLayout @JvmOverloads constructor(
|
||||
override fun onAnimationStart(animation: Animator) {
|
||||
super.onAnimationStart(animation)
|
||||
isPlayingAnim = true
|
||||
overMapView.setIsPlaying(true)
|
||||
overMapView.setMapFlag(isScaled)
|
||||
}
|
||||
|
||||
override fun onAnimationCancel(animation: Animator) {
|
||||
super.onAnimationCancel(animation)
|
||||
isPlayingAnim = false
|
||||
overMapView.setIsPlaying(false)
|
||||
overMapView.swapSettings()
|
||||
updateShadowBg(isScaled)
|
||||
isScaled = !isScaled
|
||||
@@ -199,6 +201,7 @@ class MapContainerLayout @JvmOverloads constructor(
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
super.onAnimationEnd(animation)
|
||||
isPlayingAnim = false
|
||||
overMapView.setIsPlaying(false)
|
||||
overMapView.swapSettings()
|
||||
updateShadowBg(isScaled)
|
||||
isScaled = !isScaled
|
||||
|
||||
@@ -33,9 +33,11 @@ import com.amap.api.maps.model.PolylineOptions
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.data.och.OchInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.IDataCenterBizListener
|
||||
import com.mogo.eagle.core.function.business.travelreality.CrossDeviceBean
|
||||
import com.mogo.eagle.core.function.business.travelreality.DeviceInfoBean
|
||||
import com.mogo.eagle.core.function.business.travelreality.EventBean
|
||||
@@ -48,6 +50,7 @@ import com.mogo.eagle.core.function.business.travelreality.view.VideoMarkerEntit
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.map.R
|
||||
import com.mogo.eagle.core.function.smp.view.SmallMapView
|
||||
@@ -74,7 +77,8 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener,
|
||||
IMoGoPlanningRottingListener, IMoGoAutopilotStatusListener {
|
||||
IMoGoPlanningRottingListener, IMoGoAutopilotStatusListener,
|
||||
IDataCenterBizListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "TravelRealityView"
|
||||
@@ -227,6 +231,9 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
*/
|
||||
@Volatile
|
||||
private var isSmallMap: Boolean = true
|
||||
|
||||
@Volatile
|
||||
private var isPlayingAnim = false
|
||||
private var iconRes = R.drawable.small_map_car
|
||||
|
||||
@Volatile
|
||||
@@ -236,6 +243,8 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
private var mPolyline: Polyline? = null
|
||||
private var mSmallStartMarker: Marker? = null
|
||||
private var mSmallEndMarker: Marker? = null
|
||||
private var mStartLatLng: LatLng? = null
|
||||
private var mEndLatLng: LatLng? = null
|
||||
|
||||
init {
|
||||
try {
|
||||
@@ -321,6 +330,10 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
this.isSmallMap = isSmallMap
|
||||
}
|
||||
|
||||
fun setIsPlaying(isPlaying: Boolean) {
|
||||
isPlayingAnim = isPlaying
|
||||
}
|
||||
|
||||
fun swapSettings() {
|
||||
if (isSmallMap) {
|
||||
Message.obtain().apply {
|
||||
@@ -329,6 +342,7 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
}
|
||||
// 显示小地图样式
|
||||
changeMapSettings(true)
|
||||
resumeStartEndMarker()
|
||||
globalPathResp?.let {
|
||||
if (it.wayPointsList.size > 0) {
|
||||
drawRotting()
|
||||
@@ -339,6 +353,7 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
hideSmallCarMarker()
|
||||
// 显示行程总览地图样式
|
||||
changeMapSettings(false)
|
||||
resumeStartEndMarker()
|
||||
// 绘制自车
|
||||
mLocation?.let { drawCarMarker(it) }
|
||||
val globalPath = reqData
|
||||
@@ -595,6 +610,7 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
// 注册定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener("${TAG}${this.hashCode()}", this)
|
||||
CallerAutoPilotStatusListenerManager.addListener("${TAG}${this.hashCode()}", this)
|
||||
CallerDataCenterBizListener.addListener("${TAG}${this.hashCode()}", this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
@@ -606,6 +622,7 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener("${TAG}${this.hashCode()}")
|
||||
CallerPlanningRottingListenerManager.removeListener("${TAG}${this.hashCode()}")
|
||||
CallerAutoPilotStatusListenerManager.removeListener("${TAG}${this.hashCode()}")
|
||||
CallerDataCenterBizListener.removeListener("${TAG}${this.hashCode()}")
|
||||
nonFrequentHandler?.looper?.quitSafely()
|
||||
nonFrequentHandler = null
|
||||
travelNetWorkModel.cancelAllRequest()
|
||||
@@ -684,38 +701,6 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
globalData[0].lon
|
||||
)
|
||||
CallerLogger.w("$M_MAP$TAG", "起终点距离为:$distance")
|
||||
// if (distance < 2000) {
|
||||
// roadRange = maxRoadRange
|
||||
// roadWidth = minRoadWidth
|
||||
// globalWidth = minGlobalWidth
|
||||
// } else {
|
||||
// roadRange = minRoadRange
|
||||
// roadWidth = maxRoadWidth
|
||||
// globalWidth = maxGlobalWidth
|
||||
// }
|
||||
val optionList = ArrayList<MarkerOptions>()
|
||||
optionList.add(
|
||||
MarkerOptions().apply {
|
||||
icon(BitmapDescriptorFactory.fromResource(startPointDrawable))
|
||||
position(
|
||||
coordinateConverterWgsToGcj(
|
||||
globalData[0].lat,
|
||||
globalData[0].lon
|
||||
)
|
||||
)
|
||||
}
|
||||
)
|
||||
val endOption = MarkerOptions()
|
||||
endOption.icon(BitmapDescriptorFactory.fromResource(endPointDrawable))
|
||||
endOption.position(
|
||||
coordinateConverterWgsToGcj(
|
||||
globalData[globalData.size - 1].lat,
|
||||
globalData[globalData.size - 1].lon
|
||||
)
|
||||
)
|
||||
optionList.add(endOption)
|
||||
// 绘制起终点
|
||||
drawStartEndMarker(optionList)
|
||||
// 绘制全局轨迹
|
||||
drawPolyline(DRAW_POLY_LINE, globalOptions)
|
||||
}
|
||||
@@ -1523,14 +1508,6 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
clearPolyline()
|
||||
if (mAMap != null) {
|
||||
if (mCoordinatesLatLng.size >= 2) {
|
||||
// 设置开始结束Marker位置
|
||||
mSmallStartMarker!!.position = mCoordinatesLatLng[0]
|
||||
mSmallEndMarker!!.position = mCoordinatesLatLng[mCoordinatesLatLng.size - 1]
|
||||
mSmallStartMarker!!.setToTop()
|
||||
mSmallStartMarker!!.isVisible = true
|
||||
mSmallEndMarker!!.isVisible = true
|
||||
mSmallEndMarker!!.setToTop()
|
||||
|
||||
//存放所有点的经纬度
|
||||
val boundsBuilder = LatLngBounds.Builder()
|
||||
for (i in mCoordinatesLatLng.indices) {
|
||||
@@ -1571,6 +1548,15 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun hideStartEndMarker() {
|
||||
if (mSmallStartMarker != null) {
|
||||
mSmallStartMarker!!.isVisible = false
|
||||
}
|
||||
if (mSmallEndMarker != null) {
|
||||
mSmallEndMarker!!.isVisible = false
|
||||
}
|
||||
}
|
||||
|
||||
private fun hideSmallCarMarker() {
|
||||
mSmallCarMarker?.isVisible = false
|
||||
}
|
||||
@@ -1702,6 +1688,72 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
return latLngList
|
||||
}
|
||||
|
||||
override fun invokeOchInfo(ochInfo: OchInfo) {
|
||||
super.invokeOchInfo(ochInfo)
|
||||
Log.d(TAG, "invokeOchInfo:$ochInfo")
|
||||
if (ochInfo.type == 0) {
|
||||
val locList = ochInfo.latLonList
|
||||
if (locList.isEmpty() || locList.size < 2) {
|
||||
mStartLatLng = null
|
||||
mEndLatLng = null
|
||||
UiThreadHandler.post {
|
||||
hideStartEndMarker()
|
||||
}
|
||||
} else {
|
||||
// 设置开始结束Marker位置
|
||||
mStartLatLng = coordinateConverterWgsToGcj(
|
||||
locList[0].latitude,
|
||||
locList[0].longitude
|
||||
)
|
||||
mEndLatLng = coordinateConverterWgsToGcj(
|
||||
locList[1].latitude,
|
||||
locList[1].longitude
|
||||
)
|
||||
}
|
||||
if (!isPlayingAnim) {
|
||||
drawStartAndEnd()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun resumeStartEndMarker() {
|
||||
if (mStartLatLng != null && mEndLatLng != null) {
|
||||
drawStartAndEnd()
|
||||
} else {
|
||||
if (isSmallMap) {
|
||||
UiThreadHandler.post {
|
||||
hideStartEndMarker()
|
||||
}
|
||||
} else {
|
||||
drawStartEndMarker(emptyList())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun drawStartAndEnd() {
|
||||
if (isSmallMap) {
|
||||
UiThreadHandler.post {
|
||||
mSmallStartMarker!!.position = mStartLatLng
|
||||
mSmallEndMarker!!.position = mEndLatLng
|
||||
mSmallStartMarker!!.setToTop()
|
||||
mSmallStartMarker!!.isVisible = true
|
||||
mSmallEndMarker!!.isVisible = true
|
||||
mSmallEndMarker!!.setToTop()
|
||||
}
|
||||
} else {
|
||||
val options = ArrayList<MarkerOptions>()
|
||||
options.add(MarkerOptions().also { option ->
|
||||
option.icon(BitmapDescriptorFactory.fromResource(startPointDrawable))
|
||||
option.position(mStartLatLng)
|
||||
})
|
||||
options.add(MarkerOptions().also { option ->
|
||||
option.icon(BitmapDescriptorFactory.fromResource(endPointDrawable))
|
||||
option.position(mEndLatLng)
|
||||
})
|
||||
drawStartEndMarker(options)
|
||||
}
|
||||
}
|
||||
|
||||
interface OnDrawListener {
|
||||
// isEvent为true表示是事件,反之则表示全息路口
|
||||
fun onDraw(eventList: List<EventDrawBean>, isEvent: Boolean)
|
||||
|
||||
Reference in New Issue
Block a user