Merge branch 'dev_minibus-d_230425_3.2.0' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_minibus-d_230425_3.2.0
This commit is contained in:
@@ -19,8 +19,13 @@ project.android.productFlavors {
|
||||
// ②连接的工控机IP地址
|
||||
buildConfigField 'String', 'ADAS_CONNECT_IP', "\"192.168.8.102\""
|
||||
|
||||
// ③是否需要重写状态栏
|
||||
buildConfigField 'boolean', 'IS_REPLACE_STATUSVIEW', 'true'
|
||||
if (isCurrentDriver("bus")) {
|
||||
// ③是否需要重写状态栏
|
||||
buildConfigField 'boolean', 'IS_REPLACE_STATUSVIEW', 'false'
|
||||
} else if (isCurrentPassenger("bus")) {
|
||||
// ③是否需要重写状态栏
|
||||
buildConfigField 'boolean', 'IS_REPLACE_STATUSVIEW', 'true'
|
||||
}
|
||||
|
||||
// ④构建 是否支持多屏异显异交互
|
||||
buildConfigField 'boolean', 'IS_MULTI_DISPLAY', 'false'
|
||||
|
||||
@@ -129,6 +129,8 @@ object MarkerDrawerManager {
|
||||
heading: Double
|
||||
): Int {
|
||||
var currentIndex = 0 //记录疑似点
|
||||
// 是否超过200KM
|
||||
var isLongDistance = false
|
||||
if (routePoints.isNotEmpty()) {
|
||||
//基础点
|
||||
val baseLatLng = routePoints[0]
|
||||
@@ -136,11 +138,15 @@ object MarkerDrawerManager {
|
||||
var baseDiffDis = CoordinateUtils.calculateLineDistance(
|
||||
realLon, realLat, baseLatLng.longitude, baseLatLng.latitude
|
||||
) // lon,lat, prelon, prelat
|
||||
if (baseDiffDis > 200000) {
|
||||
isLongDistance = true
|
||||
}
|
||||
val size = routePoints.size
|
||||
for (i in 1 until size) {
|
||||
val latLng = routePoints[i]
|
||||
// 深拷贝数据用于高德地图上轨迹线的绘制
|
||||
newPoints.add(LatLng(latLng.latitude, latLng.longitude))
|
||||
if (isLongDistance) continue
|
||||
val diff = CoordinateUtils.calculateLineDistance(
|
||||
realLon, realLat, latLng.longitude, latLng.latitude
|
||||
)
|
||||
@@ -160,15 +166,20 @@ object MarkerDrawerManager {
|
||||
}
|
||||
}
|
||||
Log.d("MarkerDrawerManager", "当次计算已走过的点的索引为:$currentIndex,存储的上次索引为:$lastArrivedIndex")
|
||||
if (currentIndex < lastArrivedIndex) {
|
||||
if (lastArrivedIndex < size) {
|
||||
currentIndex = lastArrivedIndex
|
||||
if (!isLongDistance) {
|
||||
// 过滤缓存的非当次轨迹的索引,并且出现车已走过索引跳跃过大时视为无效复用上一次计算结果
|
||||
if (currentIndex < lastArrivedIndex || (lastArrivedIndex >= 0 && currentIndex - lastArrivedIndex >= 10)) {
|
||||
if (lastArrivedIndex < size) {
|
||||
currentIndex = lastArrivedIndex
|
||||
}
|
||||
} else {
|
||||
lastArrivedIndex = currentIndex
|
||||
}
|
||||
if (size >= 2) {
|
||||
newPoints.add(currentIndex + 1, LatLng(realLat, realLon))
|
||||
return currentIndex + 1
|
||||
}
|
||||
} else {
|
||||
lastArrivedIndex = currentIndex
|
||||
}
|
||||
newPoints.add(currentIndex + 1, LatLng(realLat, realLon))
|
||||
return currentIndex + 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -15,10 +15,7 @@ import android.widget.TextView
|
||||
import androidx.annotation.MainThread
|
||||
import androidx.core.graphics.drawable.toBitmap
|
||||
import ch.hsr.geohash.GeoHash
|
||||
import com.amap.api.maps.AMap
|
||||
import com.amap.api.maps.CameraUpdate
|
||||
import com.amap.api.maps.CameraUpdateFactory
|
||||
import com.amap.api.maps.TextureMapView
|
||||
import com.amap.api.maps.*
|
||||
import com.amap.api.maps.model.*
|
||||
import com.mogo.eagle.core.data.map.Infrastructure
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
@@ -359,10 +356,7 @@ class OverMapView @JvmOverloads constructor(
|
||||
resources.getDrawable(R.drawable.transparent_background, null)
|
||||
.toBitmap(AutoSizeUtils.dp2px(context, 32f), AutoSizeUtils.dp2px(context, 230f))
|
||||
)
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, this)
|
||||
initAMapView(context)
|
||||
// 注册定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
|
||||
//设置全览模式
|
||||
overLayerView?.setOnClickListener { displayCustomOverView() }
|
||||
overLayerView?.let {
|
||||
@@ -407,6 +401,9 @@ class OverMapView @JvmOverloads constructor(
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, this)
|
||||
// 注册定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
|
||||
CallerFuncBizListenerManager.addListener(TAG, object : IFuncBizProvider {
|
||||
override fun onInfStructures(map: HashMap<String, ArrayList<Infrastructure>>?) {
|
||||
geoHashInfMap = map
|
||||
@@ -692,21 +689,25 @@ class OverMapView @JvmOverloads constructor(
|
||||
boundsBuilder.include(currentLatLng)
|
||||
val cameraPosition = CameraPosition.Builder().tilt(mTilt).build()
|
||||
//第二个参数为四周留空宽度
|
||||
mAMap!!.moveCamera(
|
||||
CameraUpdateFactory.newLatLngBoundsRect(
|
||||
boundsBuilder.build(),
|
||||
AutoSizeUtils.dp2px(context, leftPadding.toFloat()),
|
||||
AutoSizeUtils.dp2px(context, rightPadding.toFloat()),
|
||||
AutoSizeUtils.dp2px(context, topPadding.toFloat()),
|
||||
AutoSizeUtils.dp2px(context, bottomPadding.toFloat())
|
||||
if (mAMap != null) {
|
||||
mAMap!!.moveCamera(
|
||||
CameraUpdateFactory.newLatLngBoundsRect(
|
||||
boundsBuilder.build(),
|
||||
AutoSizeUtils.dp2px(context, leftPadding.toFloat()),
|
||||
AutoSizeUtils.dp2px(context, rightPadding.toFloat()),
|
||||
AutoSizeUtils.dp2px(context, topPadding.toFloat()),
|
||||
AutoSizeUtils.dp2px(context, bottomPadding.toFloat())
|
||||
)
|
||||
)
|
||||
)
|
||||
mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
}
|
||||
} else {
|
||||
//设置希望展示的地图缩放级别
|
||||
val cameraPosition = CameraPosition.Builder()
|
||||
.target(mCarMarker!!.position).tilt(mTilt).zoom(zoomLevel.toFloat()).build()
|
||||
mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
if (mCarMarker != null && mAMap != null) {
|
||||
//设置希望展示的地图缩放级别
|
||||
val cameraPosition = CameraPosition.Builder()
|
||||
.target(mCarMarker!!.position).tilt(mTilt).zoom(zoomLevel.toFloat()).build()
|
||||
mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -718,14 +719,16 @@ class OverMapView @JvmOverloads constructor(
|
||||
*/
|
||||
private fun drawCarMarker(location: MogoLocation?) {
|
||||
if (location == null) return
|
||||
if (mCarMarker != null) {
|
||||
val currentLatLng = LatLng(location.latitude, location.longitude)
|
||||
mCarMarker!!.rotateAngle = (360 - location.heading).toFloat()
|
||||
mCarMarker!!.position = currentLatLng
|
||||
mCarMarker!!.setToTop()
|
||||
if (mCompassMarker != null) {
|
||||
mCompassMarker!!.rotateAngle = (360 - location.heading).toFloat()
|
||||
mCompassMarker!!.position = currentLatLng
|
||||
singlePool.execute {
|
||||
if (mCarMarker != null) {
|
||||
val currentLatLng = LatLng(location.latitude, location.longitude)
|
||||
mCarMarker!!.rotateAngle = (360 - location.heading).toFloat()
|
||||
mCarMarker!!.position = currentLatLng
|
||||
mCarMarker!!.setToTop()
|
||||
if (mCompassMarker != null) {
|
||||
mCompassMarker!!.rotateAngle = (360 - location.heading).toFloat()
|
||||
mCompassMarker!!.position = currentLatLng
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -780,6 +783,7 @@ class OverMapView @JvmOverloads constructor(
|
||||
texIndexList.add(i - 1)
|
||||
}
|
||||
if (mAMap != null && coordinates.size > 2) {
|
||||
// Log.d(TAG, "绘制时轨迹点数为:${coordinates.size},纹理数为:${textureList.size},车辆index为:$locIndex")
|
||||
//设置线段纹理
|
||||
val polylineOptions = PolylineOptions()
|
||||
polylineOptions.addAll(coordinates)
|
||||
@@ -869,33 +873,40 @@ class OverMapView @JvmOverloads constructor(
|
||||
if (!isOnlyCarLocation) {
|
||||
val cameraPosition = CameraPosition.Builder().tilt(mTilt).build()
|
||||
//第二个参数为四周留空宽度
|
||||
mAMap!!.moveCamera(
|
||||
CameraUpdateFactory.newLatLngBoundsRect(
|
||||
boundsBuilder.build(),
|
||||
AutoSizeUtils.dp2px(context, leftPadding.toFloat()),
|
||||
AutoSizeUtils.dp2px(context, rightPadding.toFloat()),
|
||||
AutoSizeUtils.dp2px(context, topPadding.toFloat()),
|
||||
AutoSizeUtils.dp2px(context, bottomPadding.toFloat())
|
||||
if (mAMap != null) {
|
||||
mAMap!!.moveCamera(
|
||||
CameraUpdateFactory.newLatLngBoundsRect(
|
||||
boundsBuilder.build(),
|
||||
AutoSizeUtils.dp2px(context, leftPadding.toFloat()),
|
||||
AutoSizeUtils.dp2px(context, rightPadding.toFloat()),
|
||||
AutoSizeUtils.dp2px(context, topPadding.toFloat()),
|
||||
AutoSizeUtils.dp2px(context, bottomPadding.toFloat())
|
||||
)
|
||||
)
|
||||
)
|
||||
mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
}
|
||||
} else {
|
||||
//设置希望展示的地图缩放级别
|
||||
val cameraPosition = CameraPosition.Builder()
|
||||
.target(mCarMarker!!.position).tilt(mTilt).zoom(zoomLevel.toFloat()).build()
|
||||
mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
if (mCarMarker != null && mAMap != null) {
|
||||
val cameraPosition = CameraPosition.Builder()
|
||||
.target(mCarMarker!!.position).tilt(mTilt).zoom(zoomLevel.toFloat()).build()
|
||||
mAMap!!.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onChassisLocationGCJ02(gnssInfo: MogoLocation?) {
|
||||
gnssInfo?.let {
|
||||
mLocation = it
|
||||
lonLatHeading = Triple(it.longitude, it.latitude, it.heading)
|
||||
drawCarMarker(it)
|
||||
if (isFirstLocation) {
|
||||
displayCustomOverView()
|
||||
isFirstLocation = false
|
||||
// 在中国境内
|
||||
if (CoordinateConverter.isAMapDataAvailable(it.latitude, it.longitude)) {
|
||||
mLocation = it
|
||||
lonLatHeading = Triple(it.longitude, it.latitude, it.heading)
|
||||
drawCarMarker(it)
|
||||
if (isFirstLocation) {
|
||||
displayCustomOverView()
|
||||
isFirstLocation = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user