[6.5.0] feat: 增加公交站点管理类;
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
package com.mogo.map
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.map.entities.BusStation
|
||||
import com.mogo.map.entities.Lane
|
||||
import com.mogo.map.entities.RoadInfo
|
||||
import com.zhidaoauto.map.data.point.LonLatPoint
|
||||
import com.zhidaoauto.map.data.road.CenterLine
|
||||
|
||||
interface IMogoData {
|
||||
@@ -54,7 +56,13 @@ interface IMogoData {
|
||||
/**
|
||||
* 获取道路宽度
|
||||
*/
|
||||
fun getRoadWidth(lon: Double, lat: Double, angle: Float, isGpsLocation: Boolean, isRTK: Boolean): Float
|
||||
fun getRoadWidth(
|
||||
lon: Double,
|
||||
lat: Double,
|
||||
angle: Float,
|
||||
isGpsLocation: Boolean,
|
||||
isRTK: Boolean
|
||||
): Float
|
||||
|
||||
/**
|
||||
* 获取行车方向
|
||||
@@ -75,17 +83,24 @@ interface IMogoData {
|
||||
/**
|
||||
* 通过cityCode,缓存城市HDMap
|
||||
*/
|
||||
fun cacheHDDataByCity(progress:((cityId: Int, progress: Double) -> Unit), result:((cityId: Int, state: Int) -> Unit))
|
||||
fun cacheHDDataByCity(
|
||||
progress: ((cityId: Int, progress: Double) -> Unit),
|
||||
result: ((cityId: Int, state: Int) -> Unit)
|
||||
)
|
||||
|
||||
/**
|
||||
* 通过经纬度信息,缓存城市HDMap
|
||||
*/
|
||||
fun cacheHDDataByCityByLonLat(location: MogoLocation, progress:((cityId: Int, progress: Double) -> Unit), result:((cityId: Int, state: Int) -> Unit))
|
||||
fun cacheHDDataByCityByLonLat(
|
||||
location: MogoLocation,
|
||||
progress: ((cityId: Int, progress: Double) -> Unit),
|
||||
result: ((cityId: Int, state: Int) -> Unit)
|
||||
)
|
||||
|
||||
/**
|
||||
* 当前城市离线数据是否已缓存
|
||||
*/
|
||||
fun isCityDataCached(cache:((Boolean) -> Unit))
|
||||
fun isCityDataCached(cache: ((Boolean) -> Unit))
|
||||
|
||||
/**
|
||||
* 取消下载 城市HDMap
|
||||
@@ -101,4 +116,9 @@ interface IMogoData {
|
||||
* 根据瓦片Id和道路Id获取车道数据
|
||||
*/
|
||||
fun getLaneInfo(tileId: Long, roadId: Int): List<Lane>
|
||||
|
||||
/**
|
||||
* 获取公交站点集合
|
||||
*/
|
||||
fun getBusStation(routeList: ArrayList<LonLatPoint>): List<BusStation>
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.map.entities
|
||||
|
||||
data class BusStation(
|
||||
var busStationPoints: List<com.zhidaoauto.map.data.point.LonLatPoint>,
|
||||
var id: Int,
|
||||
var roadId: Int,
|
||||
var type: Int
|
||||
) {
|
||||
override fun toString(): String {
|
||||
return "BusStation(busStationPoints=$busStationPoints, id=$id, roadId=$roadId, type=$type)"
|
||||
}
|
||||
|
||||
fun getBusStationId(): String {
|
||||
return "${id}_${roadId}"
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,15 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import com.mogo.map.MogoData.Companion.mogoMapData
|
||||
import com.mogo.map.entities.BusStation
|
||||
import com.mogo.map.entities.Lane
|
||||
import com.mogo.map.location.GDLocationClient.Companion.gdLocationClient
|
||||
import com.mogo.map.utils.HDMapUtils.getHDCityCode
|
||||
import com.zhidaoauto.map.data.point.LonLatPoint
|
||||
import com.zhidaoauto.map.data.road.CenterLine
|
||||
import com.zhidaoauto.map.data.road.RoadNameInfo
|
||||
import com.zhidaoauto.map.data.road.RoadRectInfos
|
||||
import com.zhidaoauto.map.data.road.RoutePath
|
||||
import com.zhidaoauto.map.data.routeinfo.RoadInfo
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi
|
||||
import com.zhidaoauto.map.sdk.open.abs.IResult
|
||||
@@ -82,7 +85,7 @@ object MapDataWrapper : IMogoData {
|
||||
call: ((CenterLine?) -> Unit)
|
||||
) {
|
||||
try {
|
||||
MapDataApi.getCenterLineRangeInfo(lon, lat, angle, distance,false,6,
|
||||
MapDataApi.getCenterLineRangeInfo(lon, lat, angle, distance, false, 6,
|
||||
object : IResult<CenterLine> {
|
||||
override fun result(code: Int, result: CenterLine?) {
|
||||
call.invoke(result)
|
||||
@@ -206,7 +209,7 @@ object MapDataWrapper : IMogoData {
|
||||
location.longitude, location.latitude,
|
||||
object : OnHdDataDownByCityListener {
|
||||
override fun onMapHDDataCacheProgressByCity(id: Int, p: Double) {
|
||||
progress.invoke(id, p * 100)
|
||||
progress.invoke(id, p * 100)
|
||||
}
|
||||
|
||||
override fun onMapHDDataCacheStateByCity(id: Int, state: Int) {
|
||||
@@ -266,12 +269,38 @@ object MapDataWrapper : IMogoData {
|
||||
})
|
||||
latch.await()
|
||||
Logger.d(TAG, "getRoadInfo --- 2 ---: code -> $tempCode, data -> $tempData")
|
||||
return com.mogo.map.entities.RoadInfo(tempCode, tempData?.tile_id?.toLong()?:0L, tempData?.road_id?.toInt() ?: 0, tempData?.road_name ?: "")
|
||||
return com.mogo.map.entities.RoadInfo(
|
||||
tempCode,
|
||||
tempData?.tile_id?.toLong() ?: 0L,
|
||||
tempData?.road_id?.toInt() ?: 0,
|
||||
tempData?.road_name ?: ""
|
||||
)
|
||||
}
|
||||
|
||||
override fun getLaneInfo(tileId: Long, roadId: Int): List<Lane> {
|
||||
return MapDataApi.getLaneInfo(tileId, roadId)?.map { itx ->
|
||||
Lane(itx.laneId, itx.laneWidth, itx.laneLatLonPoints.map { Pair(it.longitude, it.latitude) })
|
||||
Lane(
|
||||
itx.laneId,
|
||||
itx.laneWidth,
|
||||
itx.laneLatLonPoints.map { Pair(it.longitude, it.latitude) })
|
||||
} ?: emptyList()
|
||||
}
|
||||
|
||||
override fun getBusStation(routeList: ArrayList<LonLatPoint>): MutableList<BusStation> {
|
||||
val latch = CountDownLatch(1)
|
||||
val resultList = mutableListOf<BusStation>()
|
||||
MapDataApi.getBusStation(routeList, object : IResult<RoutePath> {
|
||||
override fun result(code: Int, result: RoutePath?) {
|
||||
result?.steps?.forEach {
|
||||
it?.busStations?.forEach {
|
||||
val busStation = BusStation(it.busStationPoints, it.id, it.roadId, it.type)
|
||||
resultList.add(busStation)
|
||||
}
|
||||
}
|
||||
latch.countDown()
|
||||
}
|
||||
})
|
||||
latch.await()
|
||||
return resultList
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user