[6.5.0]
[fix] [小地图算法修改]
This commit is contained in:
@@ -578,6 +578,20 @@ object CoordinateCalculateRouteUtil {
|
||||
return 360-bearing
|
||||
}
|
||||
|
||||
fun getHeadingAngleTemp(locationLongitude: Double, locationLatitude: Double,
|
||||
nextPointLongitude: Double, nextPointLatitude: Double): Double {
|
||||
val lat1Rad = Math.toRadians(locationLatitude)
|
||||
val lat2Rad = Math.toRadians(nextPointLatitude)
|
||||
val lon1Rad = Math.toRadians(locationLongitude)
|
||||
val lon2Rad = Math.toRadians(nextPointLongitude)
|
||||
|
||||
val y = sin(lon2Rad - lon1Rad) * cos(lat2Rad)
|
||||
val x = cos(lat1Rad) * sin(lat2Rad) - sin(lat1Rad) * cos(lat2Rad) * cos(lon2Rad - lon1Rad)
|
||||
|
||||
val bearing = Math.toDegrees(atan2(y, x))
|
||||
return (bearing + 360) % 360
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -420,7 +420,7 @@ class SimpleMapView : View, SimpleMapViewModel.SimpleMapCallback {
|
||||
val nextPointList = mutableListOf<NearPointView>()
|
||||
nextLineData.clear()
|
||||
nextList.forEachIndexed { index, currentPoint ->
|
||||
val headingAngle = CoordinateCalculateRouteUtil.getHeadingAngle(
|
||||
val headingAngle = CoordinateCalculateRouteUtil.getHeadingAngleTemp(
|
||||
carLocation.longitude,
|
||||
carLocation.latitude,
|
||||
currentPoint.location.longitude,
|
||||
@@ -492,7 +492,7 @@ class SimpleMapView : View, SimpleMapViewModel.SimpleMapCallback {
|
||||
val prePointList = mutableListOf<NearPointView>()
|
||||
preLineData.clear()
|
||||
preList.forEachIndexed { index, currentPoint ->
|
||||
val headingAngle = CoordinateCalculateRouteUtil.getHeadingAngle(
|
||||
val headingAngle = CoordinateCalculateRouteUtil.getHeadingAngleTemp(
|
||||
carLocation.longitude,
|
||||
carLocation.latitude,
|
||||
currentPoint.location.longitude,
|
||||
|
||||
Reference in New Issue
Block a user