[3.4.0-map-sdk] convert stopline
This commit is contained in:
@@ -8,10 +8,8 @@ import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.data.map.MapRoadInfo
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager.setIsInit
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapDevaListenerManager.invokeUploadLogFile
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.invokeListenersOnRoadIdGet
|
||||
@@ -42,7 +40,6 @@ import com.zhidaoauto.map.sdk.open.business.PointCloudHelper.setPointCloudSize
|
||||
import com.zhidaoauto.map.sdk.open.business.PointCloudHelper.updatePointCloudDataByPb
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraPosition
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraUpdateFactory.newLatLngBounds
|
||||
import com.zhidaoauto.map.sdk.open.data.MapDataApi.getNearstFromPointToSegment
|
||||
import com.zhidaoauto.map.sdk.open.location.MyLocationStyle
|
||||
import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory.convertViewToBitmap
|
||||
import com.zhidaoauto.map.sdk.open.marker.Marker
|
||||
@@ -209,54 +206,17 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle
|
||||
}
|
||||
|
||||
override fun onRoadCrossInfo(roadCross: RoadCross?) {
|
||||
//todo
|
||||
d(SceneConstant.M_MAP + TAG, "onRoadCrossInfo:roadCross$roadCross")
|
||||
}
|
||||
|
||||
//todo 多实例 对象替换
|
||||
override fun onStopLineInfo(stopLine: StopLine?) {
|
||||
val carLoc = getChassisLocationWGS84()
|
||||
if (stopLine != null && stopLine.road_id.isNotEmpty() && stopLine.points.size > 0) {
|
||||
val points = stopLine.points
|
||||
d(SceneConstant.M_MAP + TAG, "onStopLineInfo:stop_line$stopLine")
|
||||
val stopInfo = convert(stopLine)
|
||||
val p1 = points[0]
|
||||
val p2 = points[points.size - 1]
|
||||
val distanceOfCarToStopLine = getNearstFromPointToSegment(
|
||||
carLoc.longitude,
|
||||
carLoc.latitude,
|
||||
p1.longitude,
|
||||
p1.latitude,
|
||||
p2.longitude,
|
||||
p2.latitude
|
||||
) * 100000
|
||||
stopInfo.distanceOfCarToStopLine = distanceOfCarToStopLine
|
||||
d(SceneConstant.M_MAP + TAG, "onStopLineInfo: --- distance: $distanceOfCarToStopLine")
|
||||
invokeListenersOnStopLineGet(stopInfo)
|
||||
}
|
||||
}
|
||||
|
||||
private fun convert(line: StopLine): MapRoadInfo.StopLine {
|
||||
val ret = MapRoadInfo.StopLine()
|
||||
ret.distance = line.distance
|
||||
ret.laneId = line.lane_id
|
||||
ret.roadId = line.road_id
|
||||
ret.tieId = line.tile_id
|
||||
val points = line.points
|
||||
if (points.size > 0) {
|
||||
val newPoints: MutableList<MogoLatLng> = ArrayList()
|
||||
for (i in points.indices) {
|
||||
val lonLatPoint = points[i]
|
||||
val latLng = MogoLatLng(lonLatPoint.latitude, lonLatPoint.longitude)
|
||||
latLng.duration = lonLatPoint.duration
|
||||
latLng.angle = lonLatPoint.angle
|
||||
latLng.speed = lonLatPoint.speed
|
||||
latLng.altitude = lonLatPoint.altitude
|
||||
latLng.provider = lonLatPoint.provider
|
||||
newPoints.add(latLng)
|
||||
stopLine?.let {
|
||||
if(it.road_id.isNotEmpty() && it.points.size > 0){
|
||||
d(SceneConstant.M_MAP + TAG, "onStopLineInfo: $it")
|
||||
invokeListenersOnStopLineGet(it)
|
||||
}
|
||||
ret.points = newPoints
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
override fun changeZoom(zoom: Float) {
|
||||
|
||||
Reference in New Issue
Block a user