[map-sdk]同步地图3.2.0修改 add new class

This commit is contained in:
jiaguofeng
2023-09-19 11:22:48 +08:00
parent a08df54c4a
commit dc0fb1360a
14 changed files with 363 additions and 3 deletions

View File

@@ -80,7 +80,8 @@ MOGO_LOCATION_VERSION=1.4.7.16
MOGO_TELEMATIC_VERSION=1.4.7.16
######## MogoAiCloudSDK Version ########
# 自研地图
MAP_SDK_VERSION=2.14.3.12
MAP_SDK_VERSION=3.2.0.13
MAP_SDK_DATA_VERSION=1.0.0.3
MAP_SDK_OPERATION_VERSION=1.1.4.1
# websocket
WEBSOCKET_VERSION=1.1.7

View File

@@ -65,8 +65,8 @@ dependencies {
implementation 'com.zhidaoauto.map:net:1.0.1'
implementation 'com.zhidaoauto.machine:mapcore:3.2.0.13'
implementation 'com.zhidaoauto.machine:mapdata:1.0.0.3'
implementation "com.zhidaoauto.machine:mapcore:${MAP_SDK_VERSION}"
implementation "com.zhidaoauto.machine:mapdata:${MAP_SDK_DATA_VERSION}"
}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 KiB

View File

@@ -0,0 +1,82 @@
package com.autonavi.nge
import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG
import com.zhidaoauto.map.sdk.inner.road.RoadResultController.Companion.instance
class MapBox {
init {
llaInit(this)
}
external fun llaInit(mapBox: MapBox?)
external fun llaGetCenterLine(dLon: Double, dLat: Double, fAngle: Float, isCancel: Boolean = false)
external fun llaStopLine(dLon: Double, dLat: Double, fAngle: Float, isCancel: Boolean = false)
external fun llaGetZebraLine(dLon: Double, dLat: Double, fAngle: Float, isCancel: Boolean = false)
external fun llaGetTrafficLight(dLon: Double, dLat: Double, fAngle: Float, isCancel: Boolean = false)
external fun llaMergedRoadRect(dLon: Double, dLat: Double, fAngle: Float, isCancel: Boolean = false)
external fun llaGetRoadLimitSpeed(dLon: Double, dLat: Double, fAngle: Float, isCancel: Boolean = false)
external fun llaGetRoadLimitSpeedByRoadId(tileId: Int, roadId: Int, isCancel: Boolean = false)
external fun llaGetCenterLineRange(
dLon: Double,
dLat: Double,
fAngle: Float,
fDis: Float,
isSmooth: Boolean,
orders: Int,
isCancel: Boolean = false
)
external fun llaGetRoadName(dLon: Double, dLat: Double, fAngle: Float, isCancel: Boolean = false)
external fun llaGetCenterLineRoadNode(
dLon: Double,
dLat: Double,
fAngle: Float,
fDis: Float,
isCancel: Boolean = false
)
external fun llaGetCrossRoad(dLon: Double, dLat: Double, fAngle: Float, isCancel: Boolean = false)
external fun llaGetCrossRoadById(tileId: Int, id: Long, isCancel: Boolean = false)
external fun llaIsInZebraLine(dLon: Double, dLat: Double, fAngle: Float, isCancel: Boolean = false)
external fun llaGetZebraLineByDistance(
dLon: Double,
dLat: Double,
fAngle: Float,
dis: Float,
isCancel: Boolean = false
)
external fun updateCacheFile(isCancel: Boolean = false)
external fun modifyRedisFileVersion(version: Int, isCancel: Boolean = false)
/*@return value format: cityCode1,chineseCityName1,englishCityName1,isCache1;cityCode2,chineseCityName2,englishCityName2,isCache2;...;*/
external fun getAllCityCode(isCancel: Boolean = false)
external fun cacheHDDataByCity(id: Int, isCancel: Boolean = false)
external fun getCityCode(lon: Double, lat: Double, isCancel: Boolean = false)
external fun getCacheProgressByCity(id: Int)
external fun cacheHDDataByCityLonLat(lon: Double, lat: Double, isCancel: Boolean = false)
external fun cancelCacheHDData()
external fun initFileCacheByCity(lon: Double, lat: Double, isCancel: Boolean = false)
external fun getHdDataVersionByCity(lon: Double, lat: Double, isCancel: Boolean = false)
external fun getCityBoundary(cityCode: Int, isCancel: Boolean = false)
external fun cancelTask()
external fun llaRelease()
fun resultCallbackByteStream(key: String?, result: ByteArray?) {
if (DEBUG) {
// Log.d(TAG, "roadop--resultCallbackDouble: " +"key:" + key + " + " result:"+ result.length);
}
if (result == null || result.size < 1) {
return
}
instance.dispatchRoadResult(0, key!!, result)
}
companion object {
private const val TAG = "MapBox"
init {
System.loadLibrary("map")
}
}
}

View File

@@ -0,0 +1,13 @@
package com.zhidaoauto.map.sdk.open.city
class CityCodeInfo {
val id:Int = 0// 城市主键
val cityNameId:Int = 0// 中国地区代码(国标)
val cityName:String = ""// 城市拼音
val cityHz:String=""// 城市汉字名
override fun toString(): String {
return "CityCodeInfo(id=$id, cityNameId=$cityNameId, cityName='$cityName', cityHz='$cityHz')"
}
}

View File

@@ -0,0 +1,33 @@
package com.zhidaoauto.map.sdk.open.city
import android.util.Log
import com.zhidao.map.net.api.Result
import com.zhidaoauto.map.sdk.inner.CompileConfig
import com.zhidaoauto.map.sdk.inner.controller.CommonController
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
object CityCodeModel {
private val cityCodeRepository by lazy { CityCodeRepository() }
fun getCityCodeByLonLat(lon:Double,lat:Double, call: CityCodeResult){
var cityCodeInfo = CityCodeInfo()
CommonController.instance.scope?.launch(Dispatchers.IO) {
val result = cityCodeRepository.getCityCodeInfo(lon, lat)
if(CompileConfig.DEBUG) {
Log.d("getCityCodeInfo", "result: ${result}")
}
if (result is Result.Success) {
if(result.data != null){
cityCodeInfo = result.data
call.result(0, cityCodeInfo, "获取CityCode成功")
}else {
call.result(1, cityCodeInfo, "获取CityCode失败")
}
}else{
call.result(1, cityCodeInfo, "获取CityCode失败")
}
}
}
}

View File

@@ -0,0 +1,18 @@
package com.zhidaoauto.map.sdk.open.city
import com.zhidao.map.net.api.BaseRepository
import com.zhidao.map.net.api.Result
import com.zhidaoauto.map.sdk.open.net.CityCodeRetrofitClient
class CityCodeRepository: BaseRepository() {
suspend fun getCityCodeInfo(lon:Double,lat:Double): Result<CityCodeInfo> {
return safeApiCall(
call = { executeResponse(CityCodeRetrofitClient.service.getCityCodeInfo("${lon}", "${lat}"), {}) },
errorMessage = "返回失败!"
)
}
}

View File

@@ -0,0 +1,5 @@
package com.zhidaoauto.map.sdk.open.city
interface CityCodeResult {
fun result(code:Int, data: CityCodeInfo, message: String?)
}

View File

@@ -0,0 +1,82 @@
package com.zhidaoauto.map.sdk.open.net
import android.util.Log
import com.zhidao.map.net.api.BaseRetrofitClient
import com.zhidaoauto.map.sdk.inner.CompileConfig
import okhttp3.Interceptor
import okhttp3.OkHttpClient
object CityCodeRetrofitClient : BaseRetrofitClient() {
val service by lazy { getService(
CityCodeService::class.java,
CityCodeService.BASE_URL
) }
// private val cookieJar by lazy {
// PersistentCookieJar(
// SetCookieCache(),
// SharedPrefsCookiePersistor(VideoApplication.sContext)
// )
// }
override fun handleBuilder(builder: OkHttpClient.Builder) {
// val httpCacheDirectory = File(TinyApplication.sContext.cacheDir, "responses")
// val cacheSize = 10 * 1024 * 1024L // 10 MiB
// val cache = Cache(httpCacheDirectory, cacheSize)
// builder.cache(cache)
// .cookieJar(cookieJar)
// .addInterceptor { chain ->
// var request = chain.request()
// if (!NetworkUtils.isConnected()) {
// request = request.newBuilder()
// .cacheControl(CacheControl.FORCE_CACHE)
// .build()
// }
// val response = chain.proceed(request)
// if (!NetworkUtils.isConnected()) {
// val maxAge = 60 * 60
// response.newBuilder()
// .removeHeader("Pragma")
// .header("Cache-Control", "public, max-age=$maxAge")
// .build()
// } else {
// val maxStale = 60 * 60 * 24 * 28 // tolerate 4-weeks stale
// response.newBuilder()
// .removeHeader("Pragma")
// .header("Cache-Control", "public, only-if-cached, max-stale=$maxStale")
// .build()
// }
//
// response
// }
builder.addInterceptor(bodyInterceptor)
}
private val bodyInterceptor = Interceptor { chain ->
val requestBuilder = chain.request().newBuilder()
val url = chain.request().url().toString()
if (CompileConfig.DEBUG) {
Log.i("httpop", "intercept: $url")
}
// if (checkTokenUrl(url)) {
// val token by Preference(Preference.USER_GSON, "")
// if (!TextUtils.isEmpty(token)) {
// requestBuilder.addHeader("token", token)
// }
// }
requestBuilder.addHeader("Content-Type","application/x-www-form-urlencoded")
requestBuilder.url(chain.request().url())
chain.proceed(requestBuilder.build())
}
private fun checkTokenUrl(url: String): Boolean {
return if (url.contains("/login")) {
false
} else true
}
}

View File

@@ -0,0 +1,20 @@
package com.zhidaoauto.map.sdk.open.net
import com.zhidao.map.net.api.BaseResponse
import com.zhidaoauto.map.sdk.open.city.CityCodeInfo
import retrofit2.http.GET
import retrofit2.http.Query
interface CityCodeService {
companion object {
const val BASE_URL = "https://webhdmap.zhidaozhixing.com"//BuildConfig.BaseUrl
}
@GET("/getCityByLatLon")
suspend fun getCityCodeInfo(
@Query("lon") lon: String,
@Query("lat") lat: String
): BaseResponse<CityCodeInfo>
}

View File

@@ -0,0 +1,50 @@
//package com.zhidaoauto.map.sdk.open.query
//
//import android.content.Context
//import com.zhidaoauto.map.sdk.inner.search.GeocoderSearchHelper
//import com.zhidaoauto.map.sdk.open.abs.search.IGeocodeSearch
//import com.zhidaoauto.map.sdk.open.exception.MapException
//
//class GeocodeSearch(context: Context) {
// private var mIGeocodeSearch: IGeocodeSearch? = null
// private var mContext: Context? = null
// @Throws(MapException::class)
// fun getFromLocation(regeocodeQuery: RegeocodeQuery?): RegeocodeAddress? {
// return if (mIGeocodeSearch != null) mIGeocodeSearch!!.getFromLocation(regeocodeQuery!!) else null
// }
//
// @Throws(MapException::class)
// fun getFromLocationName(geocodeQuery: GeocodeQuery?): List<GeocodeAddress?>? {
// return if (mIGeocodeSearch != null) mIGeocodeSearch!!.getFromLocationName(geocodeQuery!!) else null
// }
//
// fun setOnGeocodeSearchListener(listener: OnGeocodeSearchListener?) {
// if (mIGeocodeSearch != null) {
// mIGeocodeSearch!!.setOnGeocodeSearchListener(listener)
// }
// }
//
// fun getFromLocationAsyn(regeocodeQuery: RegeocodeQuery?) {
// if (mIGeocodeSearch != null) {
// mIGeocodeSearch!!.getFromLocationAsyn(regeocodeQuery)
// }
// }
//
// fun getFromLocationNameAsyn(geocodeQuery: GeocodeQuery?) {
// if (mIGeocodeSearch != null) {
// mIGeocodeSearch!!.getFromLocationNameAsyn(geocodeQuery)
// }
// }
//
//
//
// companion object {
// const val GPS = "gps"
// const val AMAP = "autonavi"
// }
//
// init {
// this.mContext = context
// mIGeocodeSearch = GeocoderSearchHelper(mContext!!)
// }
//}

View File

@@ -0,0 +1,40 @@
//package com.zhidaoauto.map.sdk.open.query
//
//import android.content.Context
//import com.zhidaoauto.map.sdk.inner.search.InputSearchHelper
//import com.zhidaoauto.map.sdk.open.abs.search.IInputtipsSearch
//import com.zhidaoauto.map.sdk.open.exception.MapException
//
//class Inputtips(context: Context, query: InputtipsQuery) {
// private var inputtipsSearch: IInputtipsSearch
//
// var query: InputtipsQuery?
// get() = if (inputtipsSearch != null) inputtipsSearch.getQuery() else null
// set(query) {
// if (inputtipsSearch != null && query != null) {
// inputtipsSearch.setQuery(query)
// }
// }
//
// fun setInputtipsListener(listener: InputtipsListener?) {
// if (inputtipsSearch != null) {
// inputtipsSearch.setInputtipsListener(listener)
// }
// }
//
// fun requestInputtipsAsyn() {
// if (inputtipsSearch != null) {
// inputtipsSearch.requestInputtipsAsyn()
// }
// }
//
// @Throws(MapException::class)
// fun requestInputtips(): List<Tip>? {
// return if (inputtipsSearch != null) inputtipsSearch.requestInputtips() else null
// }
//
//
// init {
// inputtipsSearch = InputSearchHelper(context, query)
// }
//}