[3.4.0-map-sdk] code tyle
This commit is contained in:
@@ -119,7 +119,7 @@ object MapAutoApi {
|
||||
MapStyleHelper.loadStyleOver.set(true)
|
||||
}
|
||||
if (!TextUtils.isEmpty(mapParams.getCachePath())) {
|
||||
MapDataHelper.updateData(context, mapParams.getCachePath()!!)
|
||||
MapDataHelper.updateData(context, mapParams.getCachePath())
|
||||
}else{
|
||||
MapDataHelper.updateData(context, CommonUtils.getCachePath(context))
|
||||
}
|
||||
@@ -194,8 +194,8 @@ object MapAutoApi {
|
||||
mapAutoView.getClerk()?.setIsRecordLogs(isRecordLogs)
|
||||
}
|
||||
|
||||
private val RULE_MORTON: Double = Math.pow(2.0, 32.0) / 360.0
|
||||
private val RULE_MORTON_TO_LONLAT: Double = 360.0 / Math.pow(2.0, 32.0)
|
||||
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 val NDS_90_DEGREES: Long = 0x3fffffff
|
||||
private val NDS_180_DEGREES: Long = 0x7fffffff
|
||||
private val NDS_360_DEGREES: Long = 4294967295
|
||||
@@ -275,18 +275,18 @@ object MapAutoApi {
|
||||
// Clerk.add()
|
||||
// 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -372,13 +372,13 @@ object MapAutoApi {
|
||||
}
|
||||
|
||||
private fun getLeftBottomOfTile(tileId:Long):Coord {
|
||||
return getLeftBottomOfTileWithLevel(tileId, getLevelOfTileId(tileId));
|
||||
return getLeftBottomOfTileWithLevel(tileId, getLevelOfTileId(tileId))
|
||||
}
|
||||
|
||||
fun getLonlatOfTile(tileId: Long):Coord_d{
|
||||
// Clerk.add("$tileId")
|
||||
val coord = getLeftBottomOfTile(tileId)
|
||||
val result = Coord_d();
|
||||
val result = Coord_d()
|
||||
val lon = String.format("%.9f", coord.x * RULE_MORTON_TO_LONLAT).toDouble()
|
||||
val lat = String.format("%.9f", coord.y * RULE_MORTON_TO_LONLAT).toDouble()
|
||||
result.lon = lon
|
||||
@@ -394,7 +394,7 @@ object MapAutoApi {
|
||||
}
|
||||
|
||||
private fun getLeftBottomOfTileWithLevel(tileId:Long, level:Int):Coord {
|
||||
val indexOfTile = getIndexOfTileIdWithLevel(tileId,level).toLong()
|
||||
val indexOfTile = getIndexOfTileIdWithLevel(tileId,level)
|
||||
//System.out.println("indexOfTile:level:${level},${indexOfTile}")
|
||||
val mortonCode = indexOfTile shl (2 * (31 - level))
|
||||
// val mortonCode1 = tileId*Math.pow(2.0,2.0*(31-level)).toLong()
|
||||
@@ -404,10 +404,10 @@ object MapAutoApi {
|
||||
//System.out.println("mortonCodeToCoord:${coord.x},${coord.y}")
|
||||
normalizeCoord(coord)
|
||||
// NOTE: 处理边界的偏移问题
|
||||
coord.x += 1;
|
||||
coord.y += 1;
|
||||
coord.x += 1
|
||||
coord.y += 1
|
||||
//System.out.println("normalizeCoord:${coord.x},${coord.y}")
|
||||
return coord;
|
||||
return coord
|
||||
}
|
||||
|
||||
fun getTileBoundingBox(tileId:Long):Box{
|
||||
@@ -415,7 +415,7 @@ object MapAutoApi {
|
||||
val level = getLevelOfTileId(tileId)
|
||||
// println("level:$level")
|
||||
val coord = getLeftBottomOfTileWithLevel(tileId, level)
|
||||
val result = Box();
|
||||
val result = Box()
|
||||
val lon = String.format("%.9f", coord.x * RULE_MORTON_TO_LONLAT).toDouble()
|
||||
val lat = String.format("%.9f", coord.y * RULE_MORTON_TO_LONLAT).toDouble()
|
||||
result.lbLon = lon
|
||||
@@ -489,7 +489,7 @@ object MapAutoApi {
|
||||
val curLon = 112.598977
|
||||
val curLat = 26.831300
|
||||
println("---$curLon,$curLat-----")
|
||||
tileId = getTileID(curLon,curLat,16)
|
||||
// tileId = getTileID(curLon,curLat,16)
|
||||
tileId = 5572659558
|
||||
println("getTileID-16:${tileId}")
|
||||
var box = getTileBoundingBox(tileId)
|
||||
|
||||
Reference in New Issue
Block a user