[3.4.0-map-sdk] code style
This commit is contained in:
@@ -52,8 +52,8 @@ public class SharedMemoryService {
|
|||||||
|
|
||||||
HDMapProvider.setDataFileSource(MapHelper.INSTANCE.getMMapParams().getDataFileSource());
|
HDMapProvider.setDataFileSource(MapHelper.INSTANCE.getMMapParams().getDataFileSource());
|
||||||
HDMapProvider.setDataRedisSource(MapHelper.INSTANCE.getMMapParams().getDataRedisFileSource());
|
HDMapProvider.setDataRedisSource(MapHelper.INSTANCE.getMMapParams().getDataRedisFileSource());
|
||||||
if (!TextUtils.isEmpty(MapHelper.INSTANCE.getMMapParams().getHdmapPath())) {
|
if (!TextUtils.isEmpty(MapHelper.INSTANCE.getMMapParams().getHdMapPath())) {
|
||||||
HDMapProvider.setDataDir(MapHelper.INSTANCE.getMMapParams().getHdmapPath());
|
HDMapProvider.setDataDir(MapHelper.INSTANCE.getMMapParams().getHdMapPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
String dir = Constant.getNDSDataPath();
|
String dir = Constant.getNDSDataPath();
|
||||||
@@ -64,7 +64,7 @@ public class SharedMemoryService {
|
|||||||
if (CompileConfig.INSTANCE.getDEBUG()) {
|
if (CompileConfig.INSTANCE.getDEBUG()) {
|
||||||
Log.i(TAG, "autoop-dir:" + dir+",SharedMemory--cachePath:"+cachePath);
|
Log.i(TAG, "autoop-dir:" + dir+",SharedMemory--cachePath:"+cachePath);
|
||||||
}
|
}
|
||||||
initSharedMemory_Native(dir, cachePath,MapHelper.INSTANCE.getMMapParams().getQzoneFilterArray());
|
initSharedMemory_Native(dir, cachePath,MapHelper.INSTANCE.getMMapParams().getQZoneFilterArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import android.graphics.Canvas
|
|||||||
object CommonUtils {
|
object CommonUtils {
|
||||||
|
|
||||||
fun getScreenWidth(context: Context): Int {
|
fun getScreenWidth(context: Context): Int {
|
||||||
val displayMetrics = context.resources.getDisplayMetrics()
|
val displayMetrics = context.resources.displayMetrics
|
||||||
return displayMetrics.widthPixels
|
return displayMetrics.widthPixels
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getScreenHeight(context: Context): Int {
|
fun getScreenHeight(context: Context): Int {
|
||||||
val displayMetrics = context.resources.getDisplayMetrics()
|
val displayMetrics = context.resources.displayMetrics
|
||||||
return displayMetrics.heightPixels
|
return displayMetrics.heightPixels
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,8 +31,8 @@ object CommonUtils {
|
|||||||
val bgHeight = background.height
|
val bgHeight = background.height
|
||||||
val fgWidth = foreground.width
|
val fgWidth = foreground.width
|
||||||
val fgHeight = foreground.height
|
val fgHeight = foreground.height
|
||||||
val newmap = Bitmap.createBitmap(bgWidth, bgHeight, Bitmap.Config.ARGB_8888)
|
val newMap = Bitmap.createBitmap(bgWidth, bgHeight, Bitmap.Config.ARGB_8888)
|
||||||
val canvas = Canvas(newmap)
|
val canvas = Canvas(newMap)
|
||||||
canvas.drawBitmap(background, 0f, 0f, null)
|
canvas.drawBitmap(background, 0f, 0f, null)
|
||||||
canvas.drawBitmap(
|
canvas.drawBitmap(
|
||||||
foreground, (bgWidth - fgWidth) / 2f,
|
foreground, (bgWidth - fgWidth) / 2f,
|
||||||
@@ -40,12 +40,11 @@ object CommonUtils {
|
|||||||
)
|
)
|
||||||
canvas.save()
|
canvas.save()
|
||||||
canvas.restore()
|
canvas.restore()
|
||||||
return newmap
|
return newMap
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCachePath(context: Context?): String{
|
fun getCachePath(context: Context?): String{
|
||||||
var cachePath = ""
|
val cachePath = if (context != null) {
|
||||||
cachePath = if (context != null) {
|
|
||||||
context.filesDir.absolutePath + "/vr_tiles"
|
context.filesDir.absolutePath + "/vr_tiles"
|
||||||
} else {
|
} else {
|
||||||
"sdcard/vr_tiles"
|
"sdcard/vr_tiles"
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import com.zhidaoauto.map.sdk.open.view.MapAutoView
|
|||||||
import io.netty.buffer.Unpooled
|
import io.netty.buffer.Unpooled
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.nio.charset.Charset
|
import java.nio.charset.Charset
|
||||||
|
import kotlin.math.abs
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
|
|
||||||
|
|
||||||
@@ -127,8 +128,8 @@ object MapAutoApi {
|
|||||||
// VR
|
// VR
|
||||||
if(mapParams.getDataFileSource() == 0){
|
if(mapParams.getDataFileSource() == 0){
|
||||||
MapHdDataHelper.initDataMgr(context)
|
MapHdDataHelper.initDataMgr(context)
|
||||||
}else if (TextUtils.isEmpty(mapParams.getHdmapPath())) {
|
}else if (TextUtils.isEmpty(mapParams.getHdMapPath())) {
|
||||||
mapParams.setHdmapPath("${customPath}/shmdata")
|
mapParams.setHdMapPath("${customPath}/shmdata")
|
||||||
MapHdDataHelper.copyAssetsToSdcard(context, "hdmapData", "${customPath}/shmdata/hdmapData")
|
MapHdDataHelper.copyAssetsToSdcard(context, "hdmapData", "${customPath}/shmdata/hdmapData")
|
||||||
}else{
|
}else{
|
||||||
MapHdDataHelper.loadDataOver.set(true)
|
MapHdDataHelper.loadDataOver.set(true)
|
||||||
@@ -240,11 +241,11 @@ object MapAutoApi {
|
|||||||
* 莫顿码转换为经纬度
|
* 莫顿码转换为经纬度
|
||||||
*/
|
*/
|
||||||
private fun fromMortonCode(mortonCode: Long): LonLat {
|
private fun fromMortonCode(mortonCode: Long): LonLat {
|
||||||
var coord: Coord = mortonCodeToCoord(mortonCode)
|
val coord: Coord = mortonCodeToCoord(mortonCode)
|
||||||
|
|
||||||
normalizeCoord(coord)
|
normalizeCoord(coord)
|
||||||
var lon = String.format("%.8f", coord.x * RULE_MORTON_TO_LONLAT).toDouble()
|
val lon = String.format("%.8f", coord.x * RULE_MORTON_TO_LONLAT).toDouble()
|
||||||
var lat = String.format("%.8f", coord.y * RULE_MORTON_TO_LONLAT).toDouble()
|
val lat = String.format("%.8f", coord.y * RULE_MORTON_TO_LONLAT).toDouble()
|
||||||
return LonLat(lon, lat)
|
return LonLat(lon, lat)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +253,7 @@ object MapAutoApi {
|
|||||||
* 莫顿码转换为莫顿坐标
|
* 莫顿码转换为莫顿坐标
|
||||||
*/
|
*/
|
||||||
private fun mortonCodeToCoord(mortonCodeParam: Long):Coord {
|
private fun mortonCodeToCoord(mortonCodeParam: Long):Coord {
|
||||||
var coord: Coord = Coord()
|
val coord = Coord()
|
||||||
var mortonCode = mortonCodeParam
|
var mortonCode = mortonCodeParam
|
||||||
var bit: Long = 1
|
var bit: Long = 1
|
||||||
coord.x = 0
|
coord.x = 0
|
||||||
@@ -314,8 +315,7 @@ object MapAutoApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//lng>73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55
|
//lng>73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55
|
||||||
fun randomLonlat(): LonLatPoint {
|
fun randomLonLat(): LonLatPoint {
|
||||||
|
|
||||||
// return randomLonLatArea(73.66, 135.05, 3.86, 53.55)
|
// return randomLonLatArea(73.66, 135.05, 3.86, 53.55)
|
||||||
return randomLonLatArea(100.01, 118.02, 21.36, 43.55)
|
return randomLonLatArea(100.01, 118.02, 21.36, 43.55)
|
||||||
}
|
}
|
||||||
@@ -343,15 +343,15 @@ object MapAutoApi {
|
|||||||
|
|
||||||
fun angleDiff(a:Double,b:Double):Double{
|
fun angleDiff(a:Double,b:Double):Double{
|
||||||
val d1: Double = a - b
|
val d1: Double = a - b
|
||||||
var d2: Double = 360 - Math.abs(d1)
|
var d2: Double = 360 - abs(d1)
|
||||||
//d1>0,那么相当于从b顺时针旋转d1能到a,那么当这个旋转角度大于180度时,不如从b逆时针旋d2转到a(取反那一步就代表逆时针旋转)
|
//d1>0,那么相当于从b顺时针旋转d1能到a,那么当这个旋转角度大于180度时,不如从b逆时针旋d2转到a(取反那一步就代表逆时针旋转)
|
||||||
if (d1 > 0){
|
if (d1 > 0){
|
||||||
d2 *= -1.0
|
d2 *= -1.0
|
||||||
}
|
}
|
||||||
if (Math.abs(d1) < Math.abs(d2)){
|
return if (abs(d1) < abs(d2)){
|
||||||
return d1
|
d1
|
||||||
} else{
|
} else{
|
||||||
return d2
|
d2
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -379,8 +379,8 @@ object MapAutoApi {
|
|||||||
// Clerk.add("$tileId")
|
// Clerk.add("$tileId")
|
||||||
val coord = getLeftBottomOfTile(tileId)
|
val coord = getLeftBottomOfTile(tileId)
|
||||||
val result = Coord_d();
|
val result = Coord_d();
|
||||||
var lon = String.format("%.9f", coord.x * RULE_MORTON_TO_LONLAT).toDouble()
|
val lon = String.format("%.9f", coord.x * RULE_MORTON_TO_LONLAT).toDouble()
|
||||||
var lat = String.format("%.9f", coord.y * RULE_MORTON_TO_LONLAT).toDouble()
|
val lat = String.format("%.9f", coord.y * RULE_MORTON_TO_LONLAT).toDouble()
|
||||||
result.lon = lon
|
result.lon = lon
|
||||||
result.lat = lat
|
result.lat = lat
|
||||||
// System.out.println("getLonlatOfTile:${lon},${lat}")
|
// System.out.println("getLonlatOfTile:${lon},${lat}")
|
||||||
@@ -399,7 +399,7 @@ object MapAutoApi {
|
|||||||
val mortonCode = indexOfTile shl (2 * (31 - level))
|
val mortonCode = indexOfTile shl (2 * (31 - level))
|
||||||
// val mortonCode1 = tileId*Math.pow(2.0,2.0*(31-level)).toLong()
|
// val mortonCode1 = tileId*Math.pow(2.0,2.0*(31-level)).toLong()
|
||||||
//System.out.println("mortonCode:${mortonCode}")
|
//System.out.println("mortonCode:${mortonCode}")
|
||||||
var coord = mortonCodeToCoord(mortonCode)
|
val coord = mortonCodeToCoord(mortonCode)
|
||||||
|
|
||||||
//System.out.println("mortonCodeToCoord:${coord.x},${coord.y}")
|
//System.out.println("mortonCodeToCoord:${coord.x},${coord.y}")
|
||||||
normalizeCoord(coord)
|
normalizeCoord(coord)
|
||||||
@@ -416,8 +416,8 @@ object MapAutoApi {
|
|||||||
// println("level:$level")
|
// println("level:$level")
|
||||||
val coord = getLeftBottomOfTileWithLevel(tileId, level)
|
val coord = getLeftBottomOfTileWithLevel(tileId, level)
|
||||||
val result = Box();
|
val result = Box();
|
||||||
var lon = String.format("%.9f", coord.x * RULE_MORTON_TO_LONLAT).toDouble()
|
val lon = String.format("%.9f", coord.x * RULE_MORTON_TO_LONLAT).toDouble()
|
||||||
var lat = String.format("%.9f", coord.y * RULE_MORTON_TO_LONLAT).toDouble()
|
val lat = String.format("%.9f", coord.y * RULE_MORTON_TO_LONLAT).toDouble()
|
||||||
result.lbLon = lon
|
result.lbLon = lon
|
||||||
result.lbLat = lat
|
result.lbLat = lat
|
||||||
val c: Int = getTileSize(level) - 1
|
val c: Int = getTileSize(level) - 1
|
||||||
@@ -471,32 +471,32 @@ object MapAutoApi {
|
|||||||
|
|
||||||
//112.59231238564,26.83079549695
|
//112.59231238564,26.83079549695
|
||||||
|
|
||||||
var array1 = TransformUtils.transformGcj02toWgs84(26.875038,112.538527)
|
val array1 = TransformUtils.transformGcj02toWgs84(26.875038,112.538527)
|
||||||
System.out.println("GPS:${array1!![0]},${array1!![1]}")
|
println("GPS:${array1[0]},${array1[1]}")
|
||||||
var array = TransformUtils.transformGcj02toWgs84(26.83079549695, 112.59231238564)
|
val array = TransformUtils.transformGcj02toWgs84(26.83079549695, 112.59231238564)
|
||||||
System.out.println("GPS:${array!![0]},${array!![1]}")
|
println("GPS:${array[0]},${array[1]}")
|
||||||
val code = toMortonCode(array!![0], array!![1])
|
val code = toMortonCode(array[0], array[1])
|
||||||
System.out.println("code:${code}")
|
println("code:${code}")
|
||||||
var tileId = getTileIdByMortonCode(code,13)
|
var tileId = getTileIdByMortonCode(code,13)
|
||||||
System.out.println("tileId:${tileId}")
|
println("tileId:${tileId}")
|
||||||
val lonLat = fromMortonCode(code)
|
val lonLat = fromMortonCode(code)
|
||||||
System.out.println("LonLat--GPS:${lonLat}")
|
println("LonLat--GPS:${lonLat}")
|
||||||
System.out.println("getTileID-13:${getTileID(100.14754525, 25.76392892,13)}")
|
println("getTileID-13:${getTileID(100.14754525, 25.76392892,13)}")
|
||||||
System.out.println("getTileID-13:${getTileID(112.577272,26.828447,13)}")
|
println("getTileID-13:${getTileID(112.577272,26.828447,13)}")
|
||||||
System.out.println("getTileID-14:${getTileID(112.5719037958,26.8208054862,14)}")
|
println("getTileID-14:${getTileID(112.5719037958,26.8208054862,14)}")
|
||||||
System.out.println("getTileID-15:${getTileID(112.5719037958,26.8208054862,15)}")
|
println("getTileID-15:${getTileID(112.5719037958,26.8208054862,15)}")
|
||||||
System.out.println("getTileID-16:${getTileID(112.5719037958,26.8208054862,16)}")
|
println("getTileID-16:${getTileID(112.5719037958,26.8208054862,16)}")
|
||||||
val curLon = 112.598977
|
val curLon = 112.598977
|
||||||
val curLat = 26.831300
|
val curLat = 26.831300
|
||||||
println("---$curLon,$curLat-----")
|
println("---$curLon,$curLat-----")
|
||||||
tileId = getTileID(curLon,curLat,16)
|
tileId = getTileID(curLon,curLat,16)
|
||||||
tileId = 5572659558
|
tileId = 5572659558
|
||||||
System.out.println("getTileID-16:${tileId}")
|
println("getTileID-16:${tileId}")
|
||||||
var box = getTileBoundingBox(tileId)
|
var box = getTileBoundingBox(tileId)
|
||||||
System.out.println("getTileBoundingBox:${box.lbLon},${box.lbLat},${box.rtLon},${box.rtLat}")
|
println("getTileBoundingBox:${box.lbLon},${box.lbLat},${box.rtLon},${box.rtLat}")
|
||||||
|
|
||||||
var unitLon = (box.rtLon-box.lbLon)/1250.0
|
val unitLon = (box.rtLon-box.lbLon)/1250.0
|
||||||
var unitLat = (box.rtLon-box.lbLon)/1250.0
|
val unitLat = (box.rtLon-box.lbLon)/1250.0
|
||||||
val upX = (box.rtLon-curLon)
|
val upX = (box.rtLon-curLon)
|
||||||
val upY = (box.rtLat-curLat)
|
val upY = (box.rtLat-curLat)
|
||||||
val downX = (box.rtLon-box.lbLon)
|
val downX = (box.rtLon-box.lbLon)
|
||||||
@@ -511,11 +511,11 @@ object MapAutoApi {
|
|||||||
// System.out.println("getLeftBottomOfTile:${coord.x},${coord.y}")
|
// System.out.println("getLeftBottomOfTile:${coord.x},${coord.y}")
|
||||||
|
|
||||||
val coord_d = getLonlatOfTile(5613151104)
|
val coord_d = getLonlatOfTile(5613151104)
|
||||||
System.out.println("getLonlatOfTile:${coord_d.lon},${coord_d.lat}")
|
println("getLonlatOfTile:${coord_d.lon},${coord_d.lat}")
|
||||||
box = getTileBoundingBox(5613151104)
|
box = getTileBoundingBox(5613151104)
|
||||||
System.out.println("getTileBoundingBox:${box.lbLon},${box.lbLat},${box.rtLon},${box.rtLat}")
|
println("getTileBoundingBox:${box.lbLon},${box.lbLat},${box.rtLon},${box.rtLat}")
|
||||||
box = getTileBoundingBox(5572660368)
|
box = getTileBoundingBox(5572660368)
|
||||||
System.out.println("-getTileBoundingBox:${box.lbLon},${box.lbLat},${box.rtLon},${box.rtLat}")
|
println("-getTileBoundingBox:${box.lbLon},${box.lbLat},${box.rtLon},${box.rtLat}")
|
||||||
println("--------")
|
println("--------")
|
||||||
val byteBuffer = Unpooled.buffer()
|
val byteBuffer = Unpooled.buffer()
|
||||||
val str = "1111112345678sjkfdhdkb"
|
val str = "1111112345678sjkfdhdkb"
|
||||||
@@ -525,18 +525,18 @@ object MapAutoApi {
|
|||||||
byteBuffer.writeInt(999)
|
byteBuffer.writeInt(999)
|
||||||
byteBuffer.writeInt(12)
|
byteBuffer.writeInt(12)
|
||||||
val length = byteBuffer.readInt()
|
val length = byteBuffer.readInt()
|
||||||
System.out.println("${length}")
|
println("$length")
|
||||||
System.out.println("${byteBuffer.readCharSequence(length, Charset.forName("utf-8"))}")
|
println("${byteBuffer.readCharSequence(length, Charset.forName("utf-8"))}")
|
||||||
System.out.println("${byteBuffer.readBoolean()}")
|
println("${byteBuffer.readBoolean()}")
|
||||||
System.out.println("${byteBuffer.readInt()}")
|
println("${byteBuffer.readInt()}")
|
||||||
|
|
||||||
val lon = 116.410669178793
|
val lon = 116.410669178793
|
||||||
val lat = 39.9908766892266
|
val lat = 39.9908766892266
|
||||||
val angle = 179.9999991082
|
val angle = 179.9999991082
|
||||||
val res = MathUtils.convertAngle(angle,lon, lat)
|
val res = MathUtils.convertAngle(angle,lon, lat)
|
||||||
System.out.println("$res")
|
println("$res")
|
||||||
System.out.println("${Math.toDegrees(3.62347793579102)}")
|
println("${Math.toDegrees(3.62347793579102)}")
|
||||||
System.out.println("${Math.toDegrees(1.13428950309753)}")
|
println("${Math.toDegrees(1.13428950309753)}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ package com.zhidaoauto.map.sdk.open
|
|||||||
import com.zhidaoauto.map.sdk.inner.common.MapHelper
|
import com.zhidaoauto.map.sdk.inner.common.MapHelper
|
||||||
import com.zhidaoauto.map.sdk.inner.map.MapController
|
import com.zhidaoauto.map.sdk.inner.map.MapController
|
||||||
|
|
||||||
class MapParams {
|
class MapParams private constructor() {
|
||||||
|
|
||||||
private var debugMode: Boolean = MapHelper.debug
|
private var debugMode: Boolean = MapHelper.debug
|
||||||
|
|
||||||
// GPS(WGS84) 0 ;GCJ-02(高德) 1; BD09(百度) 2;
|
// GPS(WGS84) 0 GCJ-02(高德) 1 BD09(百度) 2
|
||||||
private var coordinateType: Int = COORDINATETYPE_GCJ02
|
private var coordinateType: Int = COORDINATETYPE_GCJ02
|
||||||
|
|
||||||
// 样式
|
// 样式
|
||||||
@@ -17,19 +17,16 @@ class MapParams {
|
|||||||
private var cachePath: String = ""
|
private var cachePath: String = ""
|
||||||
|
|
||||||
// 高精数据目录
|
// 高精数据目录
|
||||||
private var hdmapPath: String = ""
|
private var hdMapPath: String = ""
|
||||||
|
|
||||||
private var dataFileSource = 0 // 1,本地文件。非1,redis获取
|
private var dataFileSource = 0 // 1,本地文件。非1,redis获取
|
||||||
private var dataRedisSource = 0 // 1,测试redis(42)。2 长期测试redis 3 演示redis 0正式redis(根据域名访问的)
|
private var dataRedisSource = 0 // 1,测试redis(42)。2 长期测试redis 3 演示redis 0正式redis(根据域名访问的)
|
||||||
|
|
||||||
private var qzoneFilterArray = IntArray(0)
|
private var qZoneFilterArray = IntArray(0)
|
||||||
|
|
||||||
//开启日志
|
//开启日志
|
||||||
private var isRecordLogs = true
|
private var isRecordLogs = true
|
||||||
|
|
||||||
private constructor()
|
|
||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
// 地图坐标系统GPS(WGS84)
|
// 地图坐标系统GPS(WGS84)
|
||||||
const val COORDINATETYPE_WGS84 = 1
|
const val COORDINATETYPE_WGS84 = 1
|
||||||
@@ -48,12 +45,10 @@ class MapParams {
|
|||||||
const val STYLE_ERHAI = "erhai"
|
const val STYLE_ERHAI = "erhai"
|
||||||
const val STYLE_NORMAL = "normal"
|
const val STYLE_NORMAL = "normal"
|
||||||
|
|
||||||
|
|
||||||
fun init(): MapParams {
|
fun init(): MapParams {
|
||||||
return MapParams()
|
return MapParams()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,7 +57,7 @@ class MapParams {
|
|||||||
*/
|
*/
|
||||||
fun setCoordinateType(coordinateType: Int): MapParams {
|
fun setCoordinateType(coordinateType: Int): MapParams {
|
||||||
this.coordinateType = coordinateType
|
this.coordinateType = coordinateType
|
||||||
return this;
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,7 +66,7 @@ class MapParams {
|
|||||||
*/
|
*/
|
||||||
fun setDebugMode(debug: Boolean): MapParams {
|
fun setDebugMode(debug: Boolean): MapParams {
|
||||||
this.debugMode = debug
|
this.debugMode = debug
|
||||||
return this;
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,7 +75,7 @@ class MapParams {
|
|||||||
*/
|
*/
|
||||||
fun setStyleDir(stylePath: String): MapParams {
|
fun setStyleDir(stylePath: String): MapParams {
|
||||||
this.stylePath = stylePath
|
this.stylePath = stylePath
|
||||||
return this;
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,45 +84,44 @@ class MapParams {
|
|||||||
*/
|
*/
|
||||||
fun setCachePath(cachePath: String): MapParams {
|
fun setCachePath(cachePath: String): MapParams {
|
||||||
this.cachePath = cachePath
|
this.cachePath = cachePath
|
||||||
return this;
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置数据路径
|
* 设置数据路径
|
||||||
* @param hdmapPath 路径
|
* @param hdMapPath 路径
|
||||||
*/
|
*/
|
||||||
fun setHdmapPath(hdmapPath: String): MapParams {
|
fun setHdMapPath(hdMapPath: String): MapParams {
|
||||||
this.hdmapPath = hdmapPath
|
this.hdMapPath = hdMapPath
|
||||||
return this;
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCoordinateType(): Int {
|
fun getCoordinateType(): Int {
|
||||||
return coordinateType
|
return coordinateType
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getQzoneFilterArray(): IntArray {
|
fun getQZoneFilterArray(): IntArray {
|
||||||
return qzoneFilterArray
|
return qZoneFilterArray
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置数据区域
|
* 设置数据区域
|
||||||
* @param filter 区域数组
|
* @param filter 区域数组
|
||||||
*/
|
*/
|
||||||
fun setQzoneFilterArray(filter: IntArray): MapParams {
|
fun setQZoneFilterArray(filter: IntArray): MapParams {
|
||||||
this.qzoneFilterArray = filter
|
this.qZoneFilterArray = filter
|
||||||
return this;
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCachePath(): String? {
|
fun getCachePath(): String {
|
||||||
return cachePath
|
return cachePath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getHdMapPath(): String {
|
||||||
fun getHdmapPath(): String? {
|
return hdMapPath
|
||||||
return hdmapPath
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getStyleDir(): String? {
|
fun getStyleDir(): String {
|
||||||
return stylePath
|
return stylePath
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +170,7 @@ class MapParams {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "MapParams(debugMode=$debugMode, stylePath='$stylePath', cachePath='$cachePath', hdmapPath='$hdmapPath', dataFileSource=$dataFileSource, dataRedisSource=$dataRedisSource, qzoneFilterArray=${qzoneFilterArray.contentToString()}, isRecordLogs=$isRecordLogs)"
|
return "MapParams(debugMode=$debugMode, stylePath='$stylePath', cachePath='$cachePath', hdmapPath='$hdMapPath', dataFileSource=$dataFileSource, dataRedisSource=$dataRedisSource, qzoneFilterArray=${qZoneFilterArray.contentToString()}, isRecordLogs=$isRecordLogs)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zhidaoauto.map.sdk.open.data
|
package com.zhidaoauto.map.sdk.open.data
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.app.ActivityManager
|
import android.app.ActivityManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
@@ -26,14 +27,13 @@ import com.zhidaoauto.map.sdk.inner.utils.Recorder
|
|||||||
import com.zhidaoauto.map.sdk.open.abs.IResult
|
import com.zhidaoauto.map.sdk.open.abs.IResult
|
||||||
import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener
|
import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener
|
||||||
|
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
object MapDataApi {
|
object MapDataApi {
|
||||||
|
|
||||||
private val TAG = javaClass.simpleName
|
private const val TAG = "MapDataApi"
|
||||||
|
|
||||||
private var mContext:Context? = null
|
private var mContext:Context? = null
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun getContext():Context?{
|
fun getContext():Context?{
|
||||||
return mContext
|
return mContext
|
||||||
}
|
}
|
||||||
@@ -49,11 +49,11 @@ object MapDataApi {
|
|||||||
fun destroy(){
|
fun destroy(){
|
||||||
RoadHelper.getInstance()?.release()
|
RoadHelper.getInstance()?.release()
|
||||||
if(CompileConfig.DEBUG){
|
if(CompileConfig.DEBUG){
|
||||||
Log.w(TAG, "destroyop--:RoadHelper.destory")
|
Log.w(TAG, "destroyop--:RoadHelper.destroy")
|
||||||
}
|
}
|
||||||
SharedMemoryService.getInstance(mContext).exit()
|
SharedMemoryService.getInstance(mContext).exit()
|
||||||
if(CompileConfig.DEBUG){
|
if(CompileConfig.DEBUG){
|
||||||
Log.w(TAG, "destroyop--:SharedMemoryService.destory")
|
Log.w(TAG, "destroyop--:SharedMemoryService.destroy")
|
||||||
}
|
}
|
||||||
mContext = null
|
mContext = null
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ object MapDataApi {
|
|||||||
val runningServices = myManager
|
val runningServices = myManager
|
||||||
.getRunningServices(50) as ArrayList<ActivityManager.RunningServiceInfo>
|
.getRunningServices(50) as ArrayList<ActivityManager.RunningServiceInfo>
|
||||||
for (info in runningServices) {
|
for (info in runningServices) {
|
||||||
if (info.service.className.equals(ServiceName)) {
|
if (info.service.className == ServiceName) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,9 +239,9 @@ object MapDataApi {
|
|||||||
/**
|
/**
|
||||||
* 获取道路路口信息
|
* 获取道路路口信息
|
||||||
*/
|
*/
|
||||||
fun getCrossRoad(dLon: Double, dlat: Double , fAngle: Float,call: IResult<RoadCross>){
|
fun getCrossRoad(dLon: Double, dLat: Double , fAngle: Float,call: IResult<RoadCross>){
|
||||||
Recorder.add("roadop-getCrossRoad:$dLon,$dlat,$fAngle")
|
Recorder.add("roadop-getCrossRoad:$dLon,$dLat,$fAngle")
|
||||||
RoadHelper.getInstance()?.getCrossRoad(dLon, dlat, fAngle,call)
|
RoadHelper.getInstance()?.getCrossRoad(dLon, dLat, fAngle,call)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 根据路口id获取道路信息
|
* 根据路口id获取道路信息
|
||||||
|
|||||||
@@ -4,12 +4,11 @@ import android.graphics.Point
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.autonavi.nge.map.LonLat
|
import com.autonavi.nge.map.LonLat
|
||||||
import com.zhidaoauto.map.data.point.LonLatPoint
|
import com.zhidaoauto.map.data.point.LonLatPoint
|
||||||
import com.zhidaoauto.map.sdk.inner.CompileConfig
|
|
||||||
import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG
|
import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG
|
||||||
import com.zhidaoauto.map.sdk.inner.abs.IMapController
|
import com.zhidaoauto.map.sdk.inner.abs.IMapController
|
||||||
import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy
|
import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy
|
||||||
import com.zhidaoauto.map.sdk.inner.utils.MathUtils
|
import com.zhidaoauto.map.sdk.inner.utils.MathUtils
|
||||||
import kotlin.math.absoluteValue
|
import kotlin.math.*
|
||||||
|
|
||||||
object MapTools {
|
object MapTools {
|
||||||
|
|
||||||
@@ -21,13 +20,13 @@ object MapTools {
|
|||||||
* 屏幕坐标转经纬度
|
* 屏幕坐标转经纬度
|
||||||
*/
|
*/
|
||||||
fun fromScreenLocation(paramPoint: Point,mMapController: IMapController?): LonLatPoint {
|
fun fromScreenLocation(paramPoint: Point,mMapController: IMapController?): LonLatPoint {
|
||||||
if (CompileConfig.DEBUG) {
|
if (DEBUG) {
|
||||||
Log.i(TAG, "lonlatop--fromScreenLocation--${paramPoint.toString()}")
|
Log.i(TAG, "lonlatop--fromScreenLocation--${paramPoint.toString()}")
|
||||||
}
|
}
|
||||||
var lonLat = mMapController?.pixelsToLonlat(paramPoint.x.toFloat(), paramPoint.y.toFloat())
|
val lonLat = mMapController?.pixelsToLonlat(paramPoint.x.toFloat(), paramPoint.y.toFloat())
|
||||||
lonLat?.let {
|
lonLat?.let {
|
||||||
val lonLatPoint = CommonProxy.getInstance().getLonLatProxy().switchLonLat(it)
|
val lonLatPoint = CommonProxy.getInstance().getLonLatProxy().switchLonLat(it)
|
||||||
if (CompileConfig.DEBUG) {
|
if (DEBUG) {
|
||||||
Log.i(
|
Log.i(
|
||||||
TAG,
|
TAG,
|
||||||
"lonlatop-toScreenLocation-toOuter-before:${lonLat},after:${lonLatPoint}"
|
"lonlatop-toScreenLocation-toOuter-before:${lonLat},after:${lonLatPoint}"
|
||||||
@@ -42,16 +41,16 @@ object MapTools {
|
|||||||
* 经纬度转屏幕坐标
|
* 经纬度转屏幕坐标
|
||||||
*/
|
*/
|
||||||
fun toScreenLocation(lonLatPoint: LonLatPoint,mMapController: IMapController?): Point {
|
fun toScreenLocation(lonLatPoint: LonLatPoint,mMapController: IMapController?): Point {
|
||||||
var lonLat: LonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint)
|
val lonLat: LonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint)
|
||||||
if (CompileConfig.DEBUG) {
|
if (DEBUG) {
|
||||||
Log.i(TAG, "lonlatop-toScreenLocation-toInner-before:${lonLatPoint},after:${lonLat}")
|
Log.i(TAG, "lonlatop-toScreenLocation-toInner-before:${lonLatPoint},after:${lonLat}")
|
||||||
}
|
}
|
||||||
var point = mMapController?.lonlatToPixels(
|
val point = mMapController?.lonlatToPixels(
|
||||||
lonLat.lon,
|
lonLat.lon,
|
||||||
lonLat.lat
|
lonLat.lat
|
||||||
)
|
)
|
||||||
point?.let {
|
point?.let {
|
||||||
if (CompileConfig.DEBUG) {
|
if (DEBUG) {
|
||||||
Log.i(TAG, "lonlatop-toScreenLocation-result-${point}")
|
Log.i(TAG, "lonlatop-toScreenLocation-result-${point}")
|
||||||
}
|
}
|
||||||
return Point(point.x.toInt(), point.y.toInt())
|
return Point(point.x.toInt(), point.y.toInt())
|
||||||
@@ -79,9 +78,9 @@ object MapTools {
|
|||||||
* 批量经纬度转屏幕坐标
|
* 批量经纬度转屏幕坐标
|
||||||
*/
|
*/
|
||||||
fun toScreenLocations(data: List<LonLatPoint>,mMapController: IMapController?): List<Point> {
|
fun toScreenLocations(data: List<LonLatPoint>,mMapController: IMapController?): List<Point> {
|
||||||
var arrayList: ArrayList<Point> = ArrayList()
|
val arrayList: ArrayList<Point> = ArrayList()
|
||||||
for (pp in data) {
|
for (pp in data) {
|
||||||
var point = toScreenLocation(pp,mMapController)
|
val point = toScreenLocation(pp,mMapController)
|
||||||
arrayList.add(point)
|
arrayList.add(point)
|
||||||
}
|
}
|
||||||
return arrayList
|
return arrayList
|
||||||
@@ -91,9 +90,9 @@ object MapTools {
|
|||||||
* 批量屏幕坐标转经纬度
|
* 批量屏幕坐标转经纬度
|
||||||
*/
|
*/
|
||||||
fun fromScreenLocations(data: List<Point>,mMapController: IMapController?): List<LonLatPoint> {
|
fun fromScreenLocations(data: List<Point>,mMapController: IMapController?): List<LonLatPoint> {
|
||||||
var arrayList: ArrayList<LonLatPoint> = ArrayList()
|
val arrayList: ArrayList<LonLatPoint> = ArrayList()
|
||||||
for (pp in data) {
|
for (pp in data) {
|
||||||
var lonLat = fromScreenLocation(pp,mMapController)
|
val lonLat = fromScreenLocation(pp,mMapController)
|
||||||
arrayList.add(lonLat)
|
arrayList.add(lonLat)
|
||||||
}
|
}
|
||||||
return arrayList
|
return arrayList
|
||||||
@@ -131,21 +130,21 @@ object MapTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getLonLats(start: LonLatPoint, end: LonLatPoint): List<LonLatPoint> {
|
fun getLonLats(start: LonLatPoint, end: LonLatPoint): List<LonLatPoint> {
|
||||||
var lonLatPoints: ArrayList<LonLatPoint> = ArrayList<LonLatPoint>()
|
val lonLatPoints: ArrayList<LonLatPoint> = ArrayList<LonLatPoint>()
|
||||||
val x = end.latitude - start.latitude
|
val x = end.latitude - start.latitude
|
||||||
val y = end.longitude - start.longitude
|
val y = end.longitude - start.longitude
|
||||||
val dis = Math.sqrt(x * x + y * y).absoluteValue
|
val dis = sqrt(x * x + y * y).absoluteValue
|
||||||
val num = (dis / 0.000001).toInt()
|
val num = (dis / 0.000001).toInt()
|
||||||
val numX = x / num.toDouble()
|
val numX = x / num.toDouble()
|
||||||
val numY = y / num.toDouble()
|
val numY = y / num.toDouble()
|
||||||
for (i in 1..num) {
|
for (i in 1..num) {
|
||||||
val lon = start.longitude + numY * i
|
val lon = start.longitude + numY * i
|
||||||
val lat = start.latitude + numX * i
|
val lat = start.latitude + numX * i
|
||||||
val lonlatPoint = LonLatPoint(lon, lat)
|
val lonLatPoint = LonLatPoint(lon, lat)
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "lonlatPoint: ${lonlatPoint}")
|
Log.d(TAG, "lonlatPoint: $lonLatPoint")
|
||||||
}
|
}
|
||||||
lonLatPoints.add(lonlatPoint)
|
lonLatPoints.add(lonLatPoint)
|
||||||
|
|
||||||
}
|
}
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
@@ -155,8 +154,8 @@ object MapTools {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun HaverSin(theta: Double): Double {
|
fun haverSin(theta: Double): Double {
|
||||||
val v = Math.sin(theta / 2)
|
val v = sin(theta / 2)
|
||||||
return v * v
|
return v * v
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,18 +179,18 @@ object MapTools {
|
|||||||
var lon1 = lon1
|
var lon1 = lon1
|
||||||
var lat2 = lat2
|
var lat2 = lat2
|
||||||
var lon2 = lon2
|
var lon2 = lon2
|
||||||
lat1 = ConvertDegreesToRadians(lat1)
|
lat1 = convertDegreesToRadians(lat1)
|
||||||
lon1 = ConvertDegreesToRadians(lon1)
|
lon1 = convertDegreesToRadians(lon1)
|
||||||
lat2 = ConvertDegreesToRadians(lat2)
|
lat2 = convertDegreesToRadians(lat2)
|
||||||
lon2 = ConvertDegreesToRadians(lon2)
|
lon2 = convertDegreesToRadians(lon2)
|
||||||
|
|
||||||
//差值
|
//差值
|
||||||
val vLon = Math.abs(lon1 - lon2)
|
val vLon = abs(lon1 - lon2)
|
||||||
val vLat = Math.abs(lat1 - lat2)
|
val vLat = abs(lat1 - lat2)
|
||||||
|
|
||||||
//h is the great circle distance in radians, great circle就是一个球体上的切面,它的圆心即是球心的一个周长最大的圆。
|
//h is the great circle distance in radians, great circle就是一个球体上的切面,它的圆心即是球心的一个周长最大的圆。
|
||||||
val h = HaverSin(vLat) + Math.cos(lat1) * Math.cos(lat2) * HaverSin(vLon)
|
val h = haverSin(vLat) + cos(lat1) * cos(lat2) * haverSin(vLon)
|
||||||
return 2 * EARTH_RADIUS * Math.asin(Math.sqrt(h))
|
return 2 * EARTH_RADIUS * asin(sqrt(h))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -199,38 +198,38 @@ object MapTools {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="degrees">角度</param>
|
/// <param name="degrees">角度</param>
|
||||||
/// <returns>弧度</returns>
|
/// <returns>弧度</returns>
|
||||||
fun ConvertDegreesToRadians(degrees: Double): Double {
|
fun convertDegreesToRadians(degrees: Double): Double {
|
||||||
return degrees * Math.PI / 180
|
return degrees * Math.PI / 180
|
||||||
}
|
}
|
||||||
|
|
||||||
fun ConvertRadiansToDegrees(radian: Double): Double {
|
fun convertRadiansToDegrees(radian: Double): Double {
|
||||||
return radian * 180.0 / Math.PI
|
return radian * 180.0 / Math.PI
|
||||||
}
|
}
|
||||||
|
|
||||||
val f = 1 / 298.257223563
|
const val f = 1 / 298.257223563
|
||||||
val b = 6356752.3142
|
const val b = 6356752.3142
|
||||||
val a = 6378137
|
const val a = 6378137
|
||||||
|
|
||||||
fun getDestinceLonLat(lonlat: LonLat, angle: Double, dist: Float): LonLat {
|
fun getDestinceLonLat(lonLat: LonLat, angle: Double, dist: Float): LonLat {
|
||||||
var angleRadHeading = angle / 180 * Math.PI
|
val angleRadHeading = angle / 180 * Math.PI
|
||||||
var newLat = 0.0
|
var newLat = 0.0
|
||||||
var newLong = 0.0
|
var newLong = 0.0
|
||||||
|
|
||||||
val distRatio = dist / EARTH_RADIUS
|
val distRatio = dist / EARTH_RADIUS
|
||||||
val distRatioSine = Math.sin(distRatio)
|
val distRatioSine = sin(distRatio)
|
||||||
val distRatioCosine = Math.cos(distRatio)
|
val distRatioCosine = cos(distRatio)
|
||||||
|
|
||||||
val startLatRad = lonlat.lat / 180 * Math.PI
|
val startLatRad = lonLat.lat / 180 * Math.PI
|
||||||
val startLonRad = lonlat.lon / 180 * Math.PI
|
val startLonRad = lonLat.lon / 180 * Math.PI
|
||||||
|
|
||||||
val startLatCos = Math.cos(startLatRad)
|
val startLatCos = cos(startLatRad)
|
||||||
val startLatSin = Math.sin(startLatRad)
|
val startLatSin = sin(startLatRad)
|
||||||
|
|
||||||
val endLatRads = Math.asin(startLatSin * distRatioCosine + startLatCos * distRatioSine * Math.cos(angleRadHeading))
|
val endLatRads = asin(startLatSin * distRatioCosine + startLatCos * distRatioSine * cos(angleRadHeading))
|
||||||
val endLonRads = (startLonRad
|
val endLonRads = (startLonRad
|
||||||
+ Math.atan2(
|
+ atan2(
|
||||||
Math.sin(angleRadHeading) * distRatioSine * startLatCos,
|
sin(angleRadHeading) * distRatioSine * startLatCos,
|
||||||
distRatioCosine - startLatSin * Math.sin(endLatRads)
|
distRatioCosine - startLatSin * sin(endLatRads)
|
||||||
))
|
))
|
||||||
newLat = endLatRads / Math.PI * 180
|
newLat = endLatRads / Math.PI * 180
|
||||||
newLong = endLonRads / Math.PI * 180
|
newLong = endLonRads / Math.PI * 180
|
||||||
@@ -238,22 +237,22 @@ object MapTools {
|
|||||||
return LonLat(newLong, newLat)
|
return LonLat(newLong, newLat)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDistance(lastLonlat: LonLat, lonlat: LonLat): Double {
|
fun getDistance(lastLonLat: LonLat, lonLat: LonLat): Double {
|
||||||
val x = lonlat.lat - lastLonlat.lat
|
val x = lonLat.lat - lastLonLat.lat
|
||||||
val y = lonlat.lon - lastLonlat.lon
|
val y = lonLat.lon - lastLonLat.lon
|
||||||
return Math.sqrt(x * x + y * y).absoluteValue
|
return sqrt(x * x + y * y).absoluteValue
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getNextLonLat(lastLonlat: LonLat, lonlat: LonLat, length: Double): LonLat {
|
fun getNextLonLat(lastLonLat: LonLat, lonLat: LonLat, length: Double): LonLat {
|
||||||
val x = lonlat.lat - lastLonlat.lat
|
val x = lonLat.lat - lastLonLat.lat
|
||||||
val y = lonlat.lon - lastLonlat.lon
|
val y = lonLat.lon - lastLonLat.lon
|
||||||
val distance = Math.sqrt(x * x + y * y).absoluteValue
|
val distance = sqrt(x * x + y * y).absoluteValue
|
||||||
val scale = length / distance
|
val scale = length / distance
|
||||||
if(CompileConfig.DEBUG){
|
if(DEBUG){
|
||||||
Log.i(TAG,"centerop-mattop:length:${length},distance:${distance},scale:${scale}")
|
Log.i(TAG,"centerop-mattop:length:${length},distance:${distance},scale:${scale}")
|
||||||
}
|
}
|
||||||
val lon = lastLonlat.lon + y * scale
|
val lon = lastLonLat.lon + y * scale
|
||||||
val lat = lastLonlat.lat + x * scale
|
val lat = lastLonLat.lat + x * scale
|
||||||
return LonLat(lon, lat)
|
return LonLat(lon, lat)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,16 +265,15 @@ object MapTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//转换WGS_84坐标
|
//转换WGS_84坐标
|
||||||
fun switchLonLatWGS84(lonLatPoint: LonLatPoint): LonLatPoint{
|
fun switchLonLatWGS84(lonLatPoint: LonLatPoint): LonLatPoint {
|
||||||
val lonlat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint)
|
val lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint)
|
||||||
val lonLatPoint_WGS84 = LonLatPoint(lonlat.lon, lonlat.lat)
|
return LonLatPoint(lonLat.lon, lonLat.lat)
|
||||||
return lonLatPoint_WGS84
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//转换高德坐标
|
//转换高德坐标
|
||||||
fun switchLonLat(lonLatPoint: LonLatPoint): LonLatPoint{
|
fun switchLonLat(lonLatPoint: LonLatPoint): LonLatPoint {
|
||||||
val lonlat = LonLat(lonLatPoint.longitude, lonLatPoint.latitude)
|
val lonLat = LonLat(lonLatPoint.longitude, lonLatPoint.latitude)
|
||||||
val lonLatPoint = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonlat)
|
return CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLat)
|
||||||
return lonLatPoint
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class MonitorPressApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun exit() {
|
fun exit() {
|
||||||
TaskManager.instance.monitorCancleCacheHdData()
|
TaskManager.instance.monitorCancelCacheHdData()
|
||||||
mainFlag = false
|
mainFlag = false
|
||||||
TaskManager.instance.exit()
|
TaskManager.instance.exit()
|
||||||
mMainJob?.cancel()
|
mMainJob?.cancel()
|
||||||
@@ -91,7 +91,7 @@ class MonitorPressApi {
|
|||||||
} catch (e1: IOException) {
|
} catch (e1: IOException) {
|
||||||
Log.e(TAG, "memoryop-e1", e1)
|
Log.e(TAG, "memoryop-e1", e1)
|
||||||
}
|
}
|
||||||
TaskManager.instance.LoadOtherCarsToMemory(mOtherCarPath)
|
TaskManager.instance.loadOtherCarsToMemory(mOtherCarPath)
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var randomsq = 10
|
var randomsq = 10
|
||||||
while (mainFlag) {
|
while (mainFlag) {
|
||||||
@@ -154,7 +154,7 @@ class MonitorPressApi {
|
|||||||
}
|
}
|
||||||
15 -> {
|
15 -> {
|
||||||
// TaskManager.instance.monitorMarkerAdd(trackIndex,mapAutoView)
|
// TaskManager.instance.monitorMarkerAdd(trackIndex,mapAutoView)
|
||||||
TaskManager.instance.monitorCancleCacheHdData()
|
TaskManager.instance.monitorCancelCacheHdData()
|
||||||
}
|
}
|
||||||
16 -> {
|
16 -> {
|
||||||
withContext(Dispatchers.Main){
|
withContext(Dispatchers.Main){
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ object RecorderUtils {
|
|||||||
|
|
||||||
//读取指定目录下的所有TXT文件的文件名
|
//读取指定目录下的所有TXT文件的文件名
|
||||||
fun getFileName(files: Array<File>?, end: String): ArrayList<String>? {
|
fun getFileName(files: Array<File>?, end: String): ArrayList<String>? {
|
||||||
var list = ArrayList<String>()
|
val list = ArrayList<String>()
|
||||||
if (files != null) { // 先判断目录是否为空,否则会报空指针
|
if (files != null) { // 先判断目录是否为空,否则会报空指针
|
||||||
for (file in files) {
|
for (file in files) {
|
||||||
val fileName: String = file.getName()
|
val fileName: String = file.name
|
||||||
if (fileName.endsWith(end)) {
|
if (fileName.endsWith(end)) {
|
||||||
list.add(fileName)
|
list.add(fileName)
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ object RecorderUtils {
|
|||||||
val dir = dealLogFile(name)
|
val dir = dealLogFile(name)
|
||||||
if (dir != null) {
|
if (dir != null) {
|
||||||
try {
|
try {
|
||||||
val fw = FileWriter("${dir}", true)
|
val fw = FileWriter("$dir", true)
|
||||||
// fw.write("${DateUtils.getCurrentTime()} $content\r\n")
|
// fw.write("${DateUtils.getCurrentTime()} $content\r\n")
|
||||||
fw.write("$content\r\n")
|
fw.write("$content\r\n")
|
||||||
fw.close()
|
fw.close()
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user