[3.4.0-map-sdk] code style
This commit is contained in:
@@ -12,6 +12,7 @@ import com.zhidaoauto.map.sdk.inner.utils.Recorder
|
||||
import io.netty.buffer.Unpooled
|
||||
import java.math.BigDecimal
|
||||
import java.nio.charset.Charset
|
||||
import kotlin.math.pow
|
||||
|
||||
object NavAutoApi {
|
||||
private val TAG = javaClass.simpleName
|
||||
@@ -40,7 +41,7 @@ object NavAutoApi {
|
||||
Recorder.i(instance,content)
|
||||
}
|
||||
|
||||
fun destory() {
|
||||
fun destroy() {
|
||||
CommonController.instance.exit()
|
||||
}
|
||||
|
||||
@@ -49,23 +50,23 @@ object NavAutoApi {
|
||||
return MapHelper.mMapParams
|
||||
}
|
||||
|
||||
val RULE_MORTON: Double = Math.pow(2.0, 32.0) / 360.0
|
||||
val RULE_MORTON_TO_LONLAT: Double = 360.0 / Math.pow(2.0, 32.0)
|
||||
val NDS_90_DEGREES: Long = 0x3fffffff
|
||||
val NDS_180_DEGREES: Long = 0x7fffffff
|
||||
val NDS_360_DEGREES: Long = 4294967295
|
||||
private val RULE_MORTON: Double = 2.0.pow(32.0) / 360.0
|
||||
private val RULE_MORTON_TO_LONLAT: Double = 360.0 / 2.0.pow(32.0)
|
||||
private const val NDS_90_DEGREES: Long = 0x3fffffff
|
||||
private const val NDS_180_DEGREES: Long = 0x7fffffff
|
||||
private const val NDS_360_DEGREES: Long = 4294967295
|
||||
|
||||
/**
|
||||
* 经纬度转换莫顿码
|
||||
*/
|
||||
fun toMortonCode(lon: Double, lat: Double): Long {
|
||||
var bit: Long = 1
|
||||
var mortonCode: Long = 0;
|
||||
var mortonCode: Long = 0
|
||||
var x: Long = (lon * RULE_MORTON).toLong()
|
||||
var y: Long = (lat * RULE_MORTON).toLong()
|
||||
System.out.println("morton---:${x},${y}")
|
||||
println("morton---:$x,$y")
|
||||
if (y < 0) {
|
||||
y += 0x7FFFFFFF;
|
||||
y += 0x7FFFFFFF
|
||||
}
|
||||
y = y shl 1
|
||||
for (i in 0 until 32) {
|
||||
@@ -86,12 +87,12 @@ object NavAutoApi {
|
||||
* 莫顿码转换为经纬度
|
||||
*/
|
||||
fun fromMortonCode(mortonCode: Long): LonLat {
|
||||
var coord: Coord = Coord()
|
||||
val coord = Coord()
|
||||
mortonCodeToCoord(mortonCode, coord)
|
||||
System.out.println("morton---:${coord.x},${coord.y}")
|
||||
println("morton---:${coord.x},${coord.y}")
|
||||
normalizeCoord(coord)
|
||||
var lon = String.format("%.6f", coord.x * RULE_MORTON_TO_LONLAT).toDouble()
|
||||
var lat = String.format("%.6f", coord.y * RULE_MORTON_TO_LONLAT).toDouble()
|
||||
val lon = String.format("%.6f", coord.x * RULE_MORTON_TO_LONLAT).toDouble()
|
||||
val lat = String.format("%.6f", coord.y * RULE_MORTON_TO_LONLAT).toDouble()
|
||||
return LonLat(lon, lat)
|
||||
}
|
||||
|
||||
@@ -118,18 +119,18 @@ object NavAutoApi {
|
||||
fun normalizeCoord(result: Coord) {
|
||||
// if x > 180 degrees, then subtract 360 degrees
|
||||
if (result.x > NDS_180_DEGREES) {
|
||||
result.x -= NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well
|
||||
result.x -= NDS_360_DEGREES + 1 // add 1 because 0 must be counted as well
|
||||
} else if (result.x < -NDS_180_DEGREES) // if x < 180 , x += 360
|
||||
{
|
||||
result.x += NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well
|
||||
result.x += NDS_360_DEGREES + 1 // add 1 because 0 must be counted as well
|
||||
}
|
||||
|
||||
// if y > 90 degrees, then subtract 180 degrees
|
||||
if (result.y > NDS_90_DEGREES) {
|
||||
result.y -= NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well
|
||||
result.y -= NDS_180_DEGREES + 1 // add 1 because 0 must be counted as well
|
||||
} else if (result.y < -NDS_90_DEGREES) // if y < 90, y += 180
|
||||
{
|
||||
result.y += NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well
|
||||
result.y += NDS_180_DEGREES + 1 // add 1 because 0 must be counted as well
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,10 +172,10 @@ object NavAutoApi {
|
||||
byteBuffer.writeInt(999)
|
||||
byteBuffer.writeInt(12)
|
||||
val length = byteBuffer.readInt()
|
||||
System.out.println("${length}")
|
||||
System.out.println("${byteBuffer.readCharSequence(length, Charset.forName("utf-8"))}")
|
||||
System.out.println("${byteBuffer.readBoolean()}")
|
||||
System.out.println("${byteBuffer.readInt()}")
|
||||
println("$length")
|
||||
println("${byteBuffer.readCharSequence(length, Charset.forName("utf-8"))}")
|
||||
println("${byteBuffer.readBoolean()}")
|
||||
println("${byteBuffer.readInt()}")
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@ package com.zhidaoauto.map.sdk.open
|
||||
import com.autonavi.nge.routing.RoutingProvider
|
||||
import com.zhidaoauto.map.sdk.open.nav.NaviViewShowMode
|
||||
|
||||
class NavParams {
|
||||
|
||||
|
||||
class NavParams private constructor() {
|
||||
|
||||
//是否选择导航路线
|
||||
private var isRouteSelectShow: Boolean = true
|
||||
@@ -33,10 +31,6 @@ class NavParams {
|
||||
private var mode = 0
|
||||
private var showMode = NaviViewShowMode.SHOW_MODE_LOCK_CAR
|
||||
|
||||
|
||||
private constructor()
|
||||
|
||||
|
||||
companion object {
|
||||
// default cost model
|
||||
const val COSTMODEL_DEFAULT = RoutingProvider.COSTMODEL_DEFAULT
|
||||
@@ -53,7 +47,6 @@ class NavParams {
|
||||
return NavParams()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun setRouteSelectShow(isRouteSelectShow: Boolean): NavParams {
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
//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!!)
|
||||
// }
|
||||
//}
|
||||
@@ -1,40 +0,0 @@
|
||||
//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)
|
||||
// }
|
||||
//}
|
||||
@@ -16,7 +16,7 @@ class CustomMapStyleOptions {
|
||||
}
|
||||
|
||||
//设置自定义样式路径
|
||||
fun setStyleDataPath(styleDataPath: String?): CustomMapStyleOptions? {
|
||||
fun setStyleDataPath(styleDataPath: String?): CustomMapStyleOptions {
|
||||
this.styleDataPath = styleDataPath
|
||||
return this
|
||||
}
|
||||
@@ -27,7 +27,7 @@ class CustomMapStyleOptions {
|
||||
}
|
||||
|
||||
//设置自定义样式纹理路径
|
||||
fun setStyleTexturePath(styleTexturePath: String?): CustomMapStyleOptions? {
|
||||
fun setStyleTexturePath(styleTexturePath: String?): CustomMapStyleOptions {
|
||||
this.styleTexturePath = styleTexturePath
|
||||
return this
|
||||
}
|
||||
@@ -38,7 +38,7 @@ class CustomMapStyleOptions {
|
||||
}
|
||||
|
||||
//设置自定义样式二进制,使用二进制可以更快加载出自定义样式
|
||||
fun setStyleData(styleData: ByteArray?): CustomMapStyleOptions? {
|
||||
fun setStyleData(styleData: ByteArray?): CustomMapStyleOptions {
|
||||
this.styleData = styleData
|
||||
return this
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class CustomMapStyleOptions {
|
||||
}
|
||||
|
||||
//设置自定义样式纹理二进制,使用二进制可以更快加载出自定义样式
|
||||
fun setStyleTextureData(styleTextureData: ByteArray?): CustomMapStyleOptions? {
|
||||
fun setStyleTextureData(styleTextureData: ByteArray?): CustomMapStyleOptions {
|
||||
this.styleTextureData = styleTextureData
|
||||
return this
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class CustomMapStyleOptions {
|
||||
}
|
||||
|
||||
//设置的底图自定义样式对应的styleID
|
||||
fun setStyleId(styleId: String?): CustomMapStyleOptions? {
|
||||
fun setStyleId(styleId: String?): CustomMapStyleOptions {
|
||||
this.styleId = styleId
|
||||
return this
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class CustomMapStyleOptions {
|
||||
}
|
||||
|
||||
//设置是否开启底图自定义样式, 默认为开启
|
||||
fun setEnable(enable: Boolean): CustomMapStyleOptions? {
|
||||
fun setEnable(enable: Boolean): CustomMapStyleOptions {
|
||||
this.enable = enable
|
||||
return this
|
||||
}
|
||||
@@ -82,7 +82,7 @@ class CustomMapStyleOptions {
|
||||
}
|
||||
|
||||
//设置样式额外的配置,比如路况,背景颜色等,使用二进制可以更快加载出自定义样式,如果设置了则不会读取
|
||||
fun setStyleExtraData(styleExtraData: ByteArray?): CustomMapStyleOptions? {
|
||||
fun setStyleExtraData(styleExtraData: ByteArray?): CustomMapStyleOptions {
|
||||
this.styleExtraData = styleExtraData
|
||||
return this
|
||||
}
|
||||
@@ -93,7 +93,7 @@ class CustomMapStyleOptions {
|
||||
}
|
||||
|
||||
//设置样式额外的配置,比如路况,背景颜色等 文件路径
|
||||
fun setStyleExtraPath(styleExtraPath: String?): CustomMapStyleOptions? {
|
||||
fun setStyleExtraPath(styleExtraPath: String?): CustomMapStyleOptions {
|
||||
this.styleExtraPath = styleExtraPath
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -42,12 +42,13 @@ import com.zhidaoauto.map.sdk.open.view.MapStyleParams.Companion.MAP_PERSPECTIVE
|
||||
import com.zhidaoauto.map.sdk.open.weather.WeatherRepository
|
||||
import com.zhidaoauto.map.sdk.open.weather.WeatherType
|
||||
import kotlinx.coroutines.*
|
||||
import java.lang.Runnable
|
||||
import java.util.*
|
||||
|
||||
open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocation {
|
||||
|
||||
private val TAG = javaClass.simpleName
|
||||
companion object{
|
||||
private const val TAG = "MapAutoView"
|
||||
}
|
||||
|
||||
//The instance of MapView
|
||||
private var mMapView: MapView? = null
|
||||
@@ -66,8 +67,7 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
//The helper of MapView
|
||||
private var mMapAutoViewHelper: MapAutoViewHelper? = null
|
||||
|
||||
|
||||
//Longtitude
|
||||
//Longitude
|
||||
private var mLocationLon: Double = 0.0
|
||||
//Latitude
|
||||
private var mLocationLat: Double = 0.0
|
||||
@@ -77,7 +77,7 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
private var mLocationHeading: Double = 0.0
|
||||
|
||||
//The status of init
|
||||
private var isFirst = true;
|
||||
private var isFirst = true
|
||||
//The model of lock the car
|
||||
private var lockMode: Boolean = true
|
||||
//The moving status of animal
|
||||
@@ -155,7 +155,7 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
// 获取自定义属性值
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.MapAutoView)
|
||||
var zoom = typedArray.getInt(R.styleable.MapAutoView_zoom, 20)
|
||||
if(zoom < 9 && zoom > 23){
|
||||
if(zoom in 24 downTo 8){
|
||||
zoom = 20
|
||||
}
|
||||
val carPosition = typedArray.getFloat(R.styleable.MapAutoView_carPosition, ConstantExt.MAP_STYLE_VR_POSITION_MIDDLE)
|
||||
@@ -271,7 +271,6 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
return mMapController?.getClerk()
|
||||
}
|
||||
|
||||
|
||||
override fun setLockCar(lock: Boolean) {
|
||||
if (CompileConfig.DEBUG) {
|
||||
Log.i(TAG, "autoop-lockop-mapop-lockcarop--setLockCar:${lockMode}-->${lock}:${Thread.currentThread().id}")
|
||||
@@ -281,7 +280,7 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
mMapController?.setConstAnchorPositionFlag(true)
|
||||
mMapController?.shakeMapManual()
|
||||
} else {
|
||||
isMoveAnim = false;
|
||||
isMoveAnim = false
|
||||
if(mLocationLon > 0 && mLocationLat > 0){
|
||||
setCenter()
|
||||
}
|
||||
@@ -293,7 +292,6 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
return lockMode
|
||||
}
|
||||
|
||||
|
||||
private fun initMapView() {
|
||||
if (CompileConfig.DEBUG) {
|
||||
Log.i(TAG, "autoop-mapop-initMapView--start")
|
||||
@@ -302,8 +300,6 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
mMapStyleParams?.let { mMapStyleParams ->
|
||||
// init MapView
|
||||
mMapView = MapView(context, mMapStyleParams, this@MapAutoView)
|
||||
|
||||
|
||||
if(mEventController == null){
|
||||
mEventController = MapEventController()
|
||||
}
|
||||
@@ -322,9 +318,6 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
mMarkerController = MarkerController(mapController)
|
||||
mapController.setMarkerController(mMarkerController)
|
||||
}
|
||||
|
||||
|
||||
|
||||
mLocationView = LocationHelper(context, mMarkerController, mMapController,mMapStyleParams)
|
||||
mMapController?.setLocalView(mLocationView)
|
||||
|
||||
@@ -334,9 +327,6 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
mPanelManager = PanelManager(this@MapAutoView, context, mMapController)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
mMapAutoViewHelper = MapAutoViewHelper(this@MapAutoView)
|
||||
mMapController?.setFollowCarMode(true)
|
||||
if (CompileConfig.DEBUG) {
|
||||
@@ -350,7 +340,7 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
Log.i(TAG, "autoop-locationop-lockop-onLocationChanged-location:${mogoLocation},${mLocationLat},${mLocationLon},${mMapView}")
|
||||
}
|
||||
if (mMapView == null) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
mMapStyleParams?.let {
|
||||
// Use the previous position for small displacements
|
||||
@@ -426,8 +416,6 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
mMapController?.resetChangeAngleTime()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
val mogoLocation = MogoLocation()
|
||||
mogoLocation.lon = lonLatPoint.longitude
|
||||
@@ -460,7 +448,6 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun setCenter() {
|
||||
if (TransformUtils.outOfChina(mLocationLat, mLocationLon)) {
|
||||
return
|
||||
@@ -468,11 +455,9 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
if (CompileConfig.DEBUG) {
|
||||
Log.i(TAG, "autoop---setCenter--centerop-lockMode:${getLockCar()},${mLocationLon},${mLocationLat},${mLocationHeading}")
|
||||
}
|
||||
|
||||
mMapController?.animateTo(mLocationLon, mLocationLat, mLocationAlt, -mLocationHeading.toFloat(), 100)
|
||||
}
|
||||
|
||||
|
||||
private val mHandler = @SuppressLint("HandlerLeak")
|
||||
object : Handler() {
|
||||
override fun handleMessage(msg: Message) {
|
||||
@@ -586,7 +571,7 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
isMoveAnim = true
|
||||
mLocationView?.getMyLocationStyle()?.setLonLat(LonLat(lonLatPoint.longitude, lonLatPoint.latitude),heading)
|
||||
if(handler != null) {
|
||||
handler.postDelayed(Runnable {
|
||||
handler.postDelayed({
|
||||
mMapController?.setConstAnchorPositionFlag(false)
|
||||
mMapController?.shakeMapManual()
|
||||
}, 60)
|
||||
@@ -633,10 +618,10 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
loopFlag = false
|
||||
updateWeatherJob?.cancel()
|
||||
|
||||
mPanelManager = null;
|
||||
mMapController = null;
|
||||
mPanelManager = null
|
||||
mMapController = null
|
||||
mMapAutoViewHelper = null
|
||||
mTrafficHelper = null;
|
||||
mTrafficHelper = null
|
||||
mEventController?.exit()
|
||||
mPanelManager = null
|
||||
mMapView = null
|
||||
@@ -867,7 +852,7 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
if(mEventController == null){
|
||||
mEventController = MapEventController()
|
||||
}
|
||||
onMapChangeListener?.let {
|
||||
onMapChangeListener.let {
|
||||
mEventController?.addMapChangeListener(it)
|
||||
}
|
||||
}
|
||||
@@ -920,11 +905,11 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
) {
|
||||
//Temporarily ignore
|
||||
return
|
||||
mMapView?.let{
|
||||
if (mMapController?.isTrafficOn()?: false) {
|
||||
mTrafficHelper?.loadTraffic(tileId, leftTopLon, leftTopLat, leftBottomLon, leftBottomLat, rightTopLon, rightTopLat, rightBottomLon, rightBottomLat, roadInfo)
|
||||
}
|
||||
}
|
||||
// mMapView?.let{
|
||||
// if (mMapController?.isTrafficOn()?: false) {
|
||||
// mTrafficHelper?.loadTraffic(tileId, leftTopLon, leftTopLat, leftBottomLon, leftBottomLat, rightTopLon, rightTopLat, rightBottomLon, rightBottomLat, roadInfo)
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -947,10 +932,10 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
mogoLocation.heading.toFloat(),
|
||||
object :
|
||||
IResult<CenterLine> {
|
||||
override fun result(code: Int, centerLine: CenterLine?) {
|
||||
override fun result(code: Int, result: CenterLine?) {
|
||||
mEventController?.dispatchRoadIdInfo(
|
||||
centerLine?.road_id,
|
||||
centerLine?.lane_id
|
||||
result?.road_id,
|
||||
result?.lane_id
|
||||
)
|
||||
}
|
||||
})
|
||||
@@ -959,8 +944,8 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
mogoLocation.lat,
|
||||
mogoLocation.heading.toFloat(),
|
||||
object : IResult<StopLine> {
|
||||
override fun result(code: Int, stopLine: StopLine?) {
|
||||
mEventController?.dispatchStopLineInfo(stopLine)
|
||||
override fun result(code: Int, result: StopLine?) {
|
||||
mEventController?.dispatchStopLineInfo(result)
|
||||
}
|
||||
|
||||
})
|
||||
@@ -969,8 +954,8 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
mogoLocation.lat,
|
||||
mogoLocation.heading.toFloat(),
|
||||
object : IResult<RoadCross> {
|
||||
override fun result(code: Int, roadCross: RoadCross?) {
|
||||
mEventController?.dispatchRoadCrossInfo(roadCross)
|
||||
override fun result(code: Int, result: RoadCross?) {
|
||||
mEventController?.dispatchRoadCrossInfo(result)
|
||||
}
|
||||
|
||||
})
|
||||
@@ -1016,15 +1001,13 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
}else{
|
||||
mMapController?.setWeatherType(WeatherType.DEFULT.type)
|
||||
}
|
||||
|
||||
delay(15 * 60 * 1000)
|
||||
|
||||
} else {
|
||||
Log.d(TAG, "获取天气信息失败!")
|
||||
|
||||
if (CompileConfig.DEBUG) {
|
||||
Log.d(TAG, "获取天气信息失败!")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
delay(10000)
|
||||
}
|
||||
|
||||
@@ -29,7 +29,9 @@ import com.zhidaoauto.map.sdk.open.weather.WeatherResult
|
||||
class MapAutoViewHelper(mapAutoView: MapAutoView) {
|
||||
private val mMapAutoView: MapAutoView
|
||||
|
||||
val TAG = javaClass.simpleName
|
||||
companion object{
|
||||
private const val TAG = "MapAutoViewHelper"
|
||||
}
|
||||
|
||||
init {
|
||||
mMapAutoView = mapAutoView
|
||||
@@ -54,9 +56,9 @@ class MapAutoViewHelper(mapAutoView: MapAutoView) {
|
||||
mMapAutoView.getClerk()?.add("$param")
|
||||
var overAngle = (getMapDAngle())?:6.5f
|
||||
mMapAutoView.getMapController()?.setScreenToOriginDis(param);
|
||||
overAngle = overAngle+0.01f
|
||||
overAngle += 0.01f
|
||||
setMapDAngle(overAngle)
|
||||
overAngle = overAngle-0.01f
|
||||
overAngle -= 0.01f
|
||||
setMapDAngle(overAngle)
|
||||
}
|
||||
|
||||
@@ -86,7 +88,7 @@ class MapAutoViewHelper(mapAutoView: MapAutoView) {
|
||||
if (getLockMode()) {
|
||||
return
|
||||
}
|
||||
var lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint)
|
||||
val lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint)
|
||||
if (TransformUtils.outOfChina(lonLat.lat, lonLat.lon)) {
|
||||
return
|
||||
}
|
||||
@@ -108,7 +110,7 @@ class MapAutoViewHelper(mapAutoView: MapAutoView) {
|
||||
if (getLockMode()) {
|
||||
return
|
||||
}
|
||||
var lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint)
|
||||
val lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint)
|
||||
if (TransformUtils.outOfChina(lonLat.lat, lonLat.lon)) {
|
||||
return
|
||||
}
|
||||
@@ -128,10 +130,10 @@ class MapAutoViewHelper(mapAutoView: MapAutoView) {
|
||||
*/
|
||||
fun getCenter(): LonLatPoint {
|
||||
mMapAutoView.getClerk()?.add()
|
||||
var center = DoubleArray(2)
|
||||
val center = DoubleArray(2)
|
||||
mMapAutoView.getMapController()?.getCenter(center)
|
||||
var lon: Double = center[0]
|
||||
var lat: Double = center[1]
|
||||
val lon: Double = center[0]
|
||||
val lat: Double = center[1]
|
||||
return CommonProxy.getInstance().getLonLatProxy().switchLonLat(LonLat(lon, lat))
|
||||
}
|
||||
|
||||
@@ -766,13 +768,13 @@ class MapAutoViewHelper(mapAutoView: MapAutoView) {
|
||||
MapCameraMessage.Type.newCameraPosition -> {
|
||||
//1. center 、俯仰角、缩放比例、偏航角
|
||||
mapCameraMessage.cameraPosition?.let {
|
||||
var centerTarget = it.target
|
||||
val centerTarget = it.target
|
||||
if (CompileConfig.DEBUG) {
|
||||
Log.e(TAG, "target:${centerTarget}")
|
||||
}
|
||||
setCenter(centerTarget)
|
||||
mMapAutoView.getMapController()?.setZoom(it.zoom.toInt())
|
||||
var tilt = it.tilt
|
||||
val tilt = it.tilt
|
||||
mMapAutoView.getMapController()?.tilt(tilt)
|
||||
if (CompileConfig.DEBUG) {
|
||||
Log.e("test", "warnning!现在还不支持偏航角~~")
|
||||
|
||||
@@ -9,8 +9,6 @@ import com.zhidaoauto.map.sdk.open.abs.view.IMapStyleParams
|
||||
|
||||
class MapStyleParams: IMapStyleParams {
|
||||
|
||||
|
||||
|
||||
// zoom级别
|
||||
private var zoom: Int = 20
|
||||
|
||||
@@ -119,8 +117,6 @@ class MapStyleParams: IMapStyleParams {
|
||||
const val MAP_STYLE_VR_TRANS = 8
|
||||
//洱海B2车辆模式
|
||||
const val MAP_STYLE_VR_ERHAI_B2 = 9
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,15 +125,12 @@ class MapStyleParams: IMapStyleParams {
|
||||
*/
|
||||
override fun setShadowEnable(enable: Boolean): MapStyleParams {
|
||||
this.isShadowEnable = enable
|
||||
return this;
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
override fun setZoom(zoom: Int): MapStyleParams {
|
||||
this.zoom = zoom
|
||||
return this;
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,17 +139,16 @@ class MapStyleParams: IMapStyleParams {
|
||||
*/
|
||||
override fun setCarPosition(offset: Float): MapStyleParams {
|
||||
this.carPosition = offset
|
||||
return this;
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置模式
|
||||
* @param styleMode 模式
|
||||
*/
|
||||
override fun setStyleMode(styleMode: Int): MapStyleParams {
|
||||
this.styleMode = styleMode
|
||||
return this;
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,10 +157,9 @@ class MapStyleParams: IMapStyleParams {
|
||||
*/
|
||||
override fun setPerspectiveMode(perspectiveMode: Int): MapStyleParams {
|
||||
this.perspectiveMode = perspectiveMode
|
||||
return this;
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
override fun getHDVisibileArray(): IntArray {
|
||||
return hdVisibleArray
|
||||
}
|
||||
@@ -179,7 +170,7 @@ class MapStyleParams: IMapStyleParams {
|
||||
*/
|
||||
override fun setHDVisibileArray(filter: IntArray): MapStyleParams {
|
||||
this.hdVisibleArray = filter
|
||||
return this;
|
||||
return this
|
||||
}
|
||||
|
||||
override fun getStyleMode(): Int {
|
||||
|
||||
@@ -16,7 +16,7 @@ object WeatherModel {
|
||||
CommonController.instance.scope?.launch(Dispatchers.IO) {
|
||||
val result = weatherRepository.getInfo(lon, lat)
|
||||
if(CompileConfig.DEBUG) {
|
||||
Log.d("getWeatherInfo", "result: ${result}")
|
||||
Log.d("getWeatherInfo", "result: $result")
|
||||
}
|
||||
if (result is Result.Success) {
|
||||
if(result.data != null){
|
||||
|
||||
@@ -9,8 +9,8 @@ class WeatherRepository: BaseRepository() {
|
||||
|
||||
suspend fun getInfo(lon:Double,lat:Double): Result<WeatherInfo> {
|
||||
val map = HashMap<String,String>()
|
||||
map.put("lon","$lon")
|
||||
map.put("lat","$lat")
|
||||
map["lon"] = "$lon"
|
||||
map["lat"] = "$lat"
|
||||
|
||||
return safeApiCall(
|
||||
|
||||
|
||||
Reference in New Issue
Block a user