100 lines
3.6 KiB
Kotlin
100 lines
3.6 KiB
Kotlin
package com.mogo.map
|
|
|
|
import android.content.Context
|
|
import android.util.AttributeSet
|
|
import android.util.Log
|
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
|
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
|
import com.mogo.eagle.core.data.enums.Carmodel.T2
|
|
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
|
import com.zhidaoauto.map.sdk.inner.abs.IMapController
|
|
import com.zhidaoauto.map.sdk.inner.abs.IMarkerController
|
|
import com.zhidaoauto.map.sdk.open.abs.view.IMapStyleParams
|
|
import com.zhidaoauto.map.sdk.open.renders.marker.Marker
|
|
import com.zhidaoauto.map.sdk.open.renders.marker.MarkerOptions
|
|
import com.zhidaoauto.map.sdk.open.view.HDTypes
|
|
import com.zhidaoauto.map.sdk.open.view.MapAutoView
|
|
|
|
class MoGoAutoView: MapAutoView {
|
|
|
|
companion object {
|
|
private const val TAG = "MoGoAutoView"
|
|
}
|
|
|
|
constructor(context: Context) : super(context)
|
|
constructor(context: Context, mapStyleParams: IMapStyleParams) : super(context, mapStyleParams)
|
|
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
|
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
|
|
|
|
init {
|
|
Log.d(TAG, "--- MoGoAutoView --- init --")
|
|
val hdVisibleArray = arrayListOf(
|
|
HDTypes.DIVIDER.type,
|
|
HDTypes.ROAD_AREA.type,
|
|
HDTypes.STOP_LINE.type,
|
|
HDTypes.ARROW.type,
|
|
HDTypes.STATION_BRIDGE.type,
|
|
HDTypes.ZEBRA_LINE.type,
|
|
HDTypes.GREEN_BELT.type,
|
|
HDTypes.DIVERSION.type,
|
|
HDTypes.SAFE_ISLAND.type,
|
|
HDTypes.ALPHANUMERIC.type,
|
|
HDTypes.GUARDBAR.type,
|
|
HDTypes.TRAFFIC_DEVICE.type,
|
|
HDTypes.building.type,
|
|
HDTypes.streetLight.type,
|
|
HDTypes.area.type,
|
|
HDTypes.regional.type,
|
|
HDTypes.geometricLinear.type,
|
|
HDTypes.geometricSurface.type,
|
|
HDTypes.poi.type
|
|
)
|
|
if (AppIdentityModeUtils.isTaxiPassenger(
|
|
FunctionBuildConfig.appIdentityMode
|
|
)
|
|
) {
|
|
hdVisibleArray.add(HDTypes.CABLE.type)
|
|
hdVisibleArray.add(HDTypes.SIGNAL_LINE.type)
|
|
}
|
|
getMapStyleParams()?.also {
|
|
Log.d(TAG, "--- MoGoAutoView --- init 1 --")
|
|
it.setHDVisibileArray(hdVisibleArray.toIntArray())
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun getMarkerController(mapController: IMapController): IMarkerController {
|
|
return MarkerControllerWrapper(super.getMarkerController(mapController))
|
|
}
|
|
|
|
private class MarkerControllerWrapper(private val controller: IMarkerController): IMarkerController by controller {
|
|
|
|
override fun addSelfCar(markerOptions: MarkerOptions): Marker? {
|
|
Log.d(TAG, "addSelfCar-> ${HdMapBuildConfig.currentCarVrIconRes}")
|
|
if (HdMapBuildConfig.currentCarVrIconRes == T2.rawValue) {
|
|
Log.d(TAG, "addSelfCar-> T2 --")
|
|
markerOptions.scale = 1.05f
|
|
}
|
|
return controller.addSelfCar(markerOptions)
|
|
}
|
|
}
|
|
|
|
override fun onAttachedToWindow() {
|
|
super.onAttachedToWindow()
|
|
Log.d(TAG, "-- onAttachedToWindow --")
|
|
CallerMapUIServiceManager.getOverlayManager()?.clear()
|
|
}
|
|
|
|
override fun onDetachedFromWindow() {
|
|
super.onDetachedFromWindow()
|
|
Log.d(TAG, "-- onDetachedFromWindow --")
|
|
CallerMapUIServiceManager.getOverlayManager()?.clear()
|
|
}
|
|
|
|
override fun onDestroy() {
|
|
super.onDestroy()
|
|
Log.d(TAG, "--- onDestroy() ---")
|
|
}
|
|
} |