[3.4.0-map-sdk] update ,wait to test

This commit is contained in:
zhongchao
2023-08-29 17:06:14 +08:00
parent b421d2dc3f
commit 6bef1de3fc
90 changed files with 1272 additions and 3766 deletions

1
libraries/mapmodule/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View File

@@ -1133,7 +1133,7 @@ class MapView(context: Context, private val mMapStyleParams: IMapStyleParams, pr
//可以缩放
private var isCanZoom = true
private var isVr = false
private var isVr = true
override fun isTouching(): Boolean {
return isTouchingFlag

View File

@@ -34,7 +34,7 @@ interface IEventController {
fun dispatchCameraChangeFinishListener(position: CameraPosition?)
fun addMapTouchListener(mapTouchListener: OnMapTouchListener)
fun removeMapTouchListener(mapTouchListener: OnMapTouchListener)
fun dispatchMapTouchListener(event: MotionEvent?): Boolean
fun dispatchMapTouchListener(event: MotionEvent): Boolean
fun isMapTouchListenerListEmpty(): Boolean
fun addMapClickListener(mapClickListener: OnMapClickListener)
fun removeMapClickListener(mapClickListener: OnMapClickListener)

View File

@@ -146,7 +146,7 @@ interface IMapController {
): Boolean
fun updatePointCloudDataByPb(
dataArray: ByteArray,
dataArray: ByteArray?,
isTrasformer: Boolean,
isResidual: Boolean,
isReset: Boolean

View File

@@ -130,7 +130,7 @@ class MapEventController(): IEventController {
}
override fun dispatchMapTouchListener(event: MotionEvent?): Boolean{
override fun dispatchMapTouchListener(event: MotionEvent): Boolean{
mMapTouchListenerList?.let {
for(listener in it){
return listener.onTouch(event)

View File

@@ -1855,7 +1855,7 @@ class MapController(private var context: Context?, private val mMapView: IMapVie
return mMapView.getMapEngine().updatePointCloudData(dataStr, isTrasformer, isResidual, isReset)
}
override fun updatePointCloudDataByPb(dataArray: ByteArray, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean): Boolean {
override fun updatePointCloudDataByPb(dataArray: ByteArray?, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean): Boolean {
return mMapView.getMapEngine().updatePointCloudDataByPb(dataArray, isTrasformer, isResidual, isReset)
}

View File

@@ -2,14 +2,14 @@ package com.zhidaoauto.map.sdk.inner.utils
import android.util.Log
import com.zhidaoauto.map.data.point.LonLatPoint
import com.zhidaoauto.map.sdk.inner.CompileConfig
import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG
import java.lang.Math.round
import java.math.BigDecimal
import java.text.DateFormat
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.TimeZone
import kotlin.math.absoluteValue
import kotlin.math.*
object MathUtils {
@@ -20,20 +20,19 @@ object MathUtils {
* 大地坐标系资料WGS-84 长半径a=6378137 短半径b=6356752.3142 扁率f=1/298.2572236
*/
/** 长半径a=6378137 */
private val EARTH_R = 6378137
private val a = 6378137.0;
private const val EARTH_R = 6378137
private const val a = 6378137.0
/** 短半径b=6356752.3142 */
private val b = 6356752.3142;
private const val b = 6356752.3142
/** 扁率f=1/298.2572236 */
private val f = 1 / 298.2572236;
private const val f = 1 / 298.2572236
private val jl_jd = 102834.74258026089786013677476285 // 每经度单位米;
private val jl_wd = 111712.69150641055729984301412873 // 每纬度单位米;
private const val jl_jd = 102834.74258026089786013677476285 // 每经度单位米
private const val jl_wd = 111712.69150641055729984301412873 // 每纬度单位米
fun getRound(value: Double, scale: Int): Double {
val bg = BigDecimal(value)
val result: Double = bg.setScale(scale, BigDecimal.ROUND_HALF_UP).toDouble()
return result
return bg.setScale(scale, BigDecimal.ROUND_HALF_UP).toDouble()
}
fun getRound(value: Double): Double {
@@ -50,7 +49,7 @@ object MathUtils {
val lastOfLast = list[list.size - 2]
val last = list[list.size - 1]
val includeAngle = getIncludeAngle(lastOfLast, last, current)
if (CompileConfig.DEBUG) {
if (DEBUG) {
Log.i(TAG, "getFitLonLatPoint:includeAngle:${includeAngle} ")
}
if (includeAngle >= 1.0) {
@@ -60,10 +59,10 @@ object MathUtils {
val dx = lastOfLast.longitude - last.longitude
val dy = lastOfLast.latitude - last.latitude
var u = dx * (current.longitude - lastOfLast.longitude) + dy * (current.latitude - lastOfLast.latitude)
u /= Math.pow(dx, 2.0) + Math.pow(dy, 2.0)
u /= dx.pow(2.0) + dy.pow(2.0)
val targetX = lastOfLast.longitude + u * dx
val targetY = lastOfLast.latitude + u * dy
if (CompileConfig.DEBUG) {
if (DEBUG) {
Log.i(TAG, "getFitLonLatPoint:origin:${current.longitude},${current.latitude}-->${targetX},${targetY} ")
}
current.longitude = targetX
@@ -80,44 +79,39 @@ object MathUtils {
val dx2 = two.longitude - zero.longitude
val dy2 = two.latitude - zero.latitude
val innerVector = dx1 * dx2 + dy1 * dy2
var radins = Math.acos(innerVector / (Math.sqrt(Math.pow(dx1, 2.0) + Math.pow(dy1, 2.0)) * Math.sqrt(Math.pow(dx2, 2.0) + Math.pow(dy2, 2.0))))
return Math.toDegrees(radins)
val radians = acos(innerVector / (sqrt(dx1.pow(2.0) + dy1.pow(2.0)) * sqrt(dx2.pow(2.0) + dy2.pow(2.0))))
return Math.toDegrees(radians)
}
/**
* UTM角度转换为经纬度对应的角度
*/
fun convertAngle(angle: Double, lon: Double, lat: Double): Double {
var angleOrigin = 450 - angle
var radianOrigin = Math.toRadians(angleOrigin.toDouble())
var radianLat = Math.toRadians(lat)
val radianDeal = Math.atan2(Math.tan(radianOrigin) * Math.cos(radianLat),1.0)
var ruler = 270
if (angle >= 0 && angle < 180) {
ruler = 90
val angleOrigin = 450 - angle
val radianOrigin = Math.toRadians(angleOrigin)
val radianLat = Math.toRadians(lat)
val radianDeal = atan2(tan(radianOrigin) * cos(radianLat), 1.0)
val ruler: Int = if (angle >= 0 && angle < 180) {
90
} else {
ruler = 270
270
}
val result = ruler - Math.toDegrees(radianDeal)
return result
return ruler - Math.toDegrees(radianDeal)
}
/**
* 角度转换为经纬度对应的角度
*/
fun convertFlatAngle(angle: Double, lon: Double, lat: Double): Double {
var angleOrigin = angle
var radianOrigin = Math.toRadians(angleOrigin.toDouble())
var radianLat = Math.toRadians(lat)
val radianDeal = Math.atan2(Math.tan(radianOrigin) * Math.cos(radianLat),1.0)
var ruler = 270
if (angle >= 0 && angle < 180) {
ruler = 90
val radianOrigin = Math.toRadians(angle)
val radianLat = Math.toRadians(lat)
val radianDeal = atan2(tan(radianOrigin) * cos(radianLat), 1.0)
val ruler = if (angle >= 0 && angle < 180) {
90
} else {
ruler = 270
270
}
val result = ruler - Math.toDegrees(radianDeal)
return result
return ruler - Math.toDegrees(radianDeal)
}
@@ -164,15 +158,15 @@ object MathUtils {
return distance(front.longitude,front.latitude,end.longitude,end.latitude)
}
fun getDistance(lon1:Double ,lat1:Double ,lon2:Double ,lat2:Double):Double {
var radLat1 = Math.toRadians(lat1);
var radLat2 = Math.toRadians(lat2);
var a = radLat1 - radLat2;
var b = Math.toRadians(lon1) - Math.toRadians(lon2);
var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2.0) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2.0)));
s = s * EARTH_R;
s = Math.round(s * 10000) / 10000.0;
return s;
fun getDistance(lon1:Double ,lat1:Double ,lon2:Double ,lat2:Double):Double {
val radLat1 = Math.toRadians(lat1)
val radLat2 = Math.toRadians(lat2)
val a = radLat1 - radLat2
val b = Math.toRadians(lon1) - Math.toRadians(lon2)
var s = 2 * asin(sqrt(sin(a / 2).pow(2.0) + cos(radLat1) * cos(radLat2) * sin(b / 2).pow(2.0)))
s *= EARTH_R
s = round(s * 10000) / 10000.0
return s
}
@@ -181,10 +175,10 @@ object MathUtils {
if (distance == 0f) {
return null
}
val radian = Math.toRadians(angle.toDouble())
val radianCoangle = Math.toRadians(90.0 - angle.toDouble())
var nLon = lon + distance * Math.sin(radian)/100000.0
var nLat = lat + distance * Math.sin(radianCoangle)/100000.0
val radian = Math.toRadians(angle)
val radianCoAngle = Math.toRadians(90.0 - angle)
val nLon = lon + distance * sin(radian) /100000.0
val nLat = lat + distance * sin(radianCoAngle) /100000.0
return LonLatPoint(nLon, nLat, 0.0,angle)
}
@@ -209,14 +203,13 @@ object MathUtils {
* @param @return 参数
* @return String 平移后的经纬度 返回类型
*/
fun right(lon: Double, lat: Double, dist: Double): String? {
fun right(lon: Double, lat: Double, dist: Double): String {
val d: Double = dist / a
val cs = Math.cos(rad(lat))
val cs = cos(rad(lat))
val c = d / cs * 180.0 / Math.PI
return (lon + c).toString() + "," + lat
}
/**
*
* @Title: top
@@ -227,7 +220,7 @@ object MathUtils {
* @param @return 参数
* @return String 平移后的经纬度 返回类型
*/
fun top(lon: Double, lat: Double, dist: Double): String? {
fun top(lon: Double, lat: Double, dist: Double): String {
val d: Double = dist / a
val c = d / Math.PI * 180.0
return lon.toString() + "," + (lat + c)
@@ -239,32 +232,32 @@ object MathUtils {
fun getAngle(pLine: ArrayList<LonLatPoint>): Float {
var tempAngle = 0.0
if (pLine.size == 1) {
tempAngle = pLine.get(0).angle
tempAngle = pLine[0].angle
} else {
var lonLatPoint = pLine.get(pLine.size - 1)
var lastlonLatPoint: LonLatPoint? = null
pLine?.let {
val lonLatPoint = pLine[pLine.size - 1]
var lastLonLatPoint: LonLatPoint?
pLine.let {
if (it.size < 5) {
lastlonLatPoint = pLine.get(0);
lastLonLatPoint = pLine[0]
} else {
lastlonLatPoint = pLine.get(3);
var dis = distance(lonLatPoint.longitude, lonLatPoint.latitude, lastlonLatPoint!!.longitude, lastlonLatPoint!!.latitude)
lastLonLatPoint = pLine[3]
val dis = distance(lonLatPoint.longitude, lonLatPoint.latitude, lastLonLatPoint!!.longitude, lastLonLatPoint!!.latitude)
if (dis < 0.2) {
lastlonLatPoint = pLine.get(0)
lastLonLatPoint = if (dis < 0.2) {
pLine[0]
} else if (dis < 0.8) {
lastlonLatPoint = pLine.get(1)
pLine[1]
} else if (dis < 1.2) {
lastlonLatPoint = pLine.get(2)
pLine[2]
} else {
lastlonLatPoint = pLine.get(3)
pLine[3]
}
}
}
if (lonLatPoint != null && lastlonLatPoint != null) {
if (lonLatPoint != null && lastLonLatPoint != null) {
tempAngle = GisGeomTool.getAngleToNorth(
getRound(lonLatPoint.longitude) - getRound(lastlonLatPoint!!.longitude),
getRound(lonLatPoint.latitude) - getRound(lastlonLatPoint!!.latitude)
getRound(lonLatPoint.longitude) - getRound(lastLonLatPoint!!.longitude),
getRound(lonLatPoint.latitude) - getRound(lastLonLatPoint!!.latitude)
)
}
@@ -273,7 +266,7 @@ object MathUtils {
}
}
if (DEBUG) {
Log.i(TAG, "angleop--tempAngle: ${tempAngle}")
Log.i(TAG, "angleop--tempAngle: $tempAngle")
}
return tempAngle.toFloat()
@@ -287,75 +280,68 @@ object MathUtils {
var index = 0
var diffValOrigin = 0.0f
var diffValCal = 0.0f
var lonLatPoint = pLine.get(pLine.size - 1)
val lonLatPoint = pLine[pLine.size - 1]
if (pLine.size == 1) {
tempAngle = lonLatPoint.angle
} else {
var lastlonLatPoint: LonLatPoint? = null
lastlonLatPoint = pLine.get(pLine.size - 2);
var dis = distance(lonLatPoint.longitude, lonLatPoint.latitude, lastlonLatPoint!!.longitude, lastlonLatPoint!!.latitude)
var lastLonLatPoint: LonLatPoint = pLine[pLine.size - 2]
val dis = distance(lonLatPoint.longitude, lonLatPoint.latitude, lastLonLatPoint.longitude, lastLonLatPoint.latitude)
if (dis < 0.2) {
index = 0
index = if (dis < 0.2) {
0
} else if (dis < 0.8) {
index = 1
1
} else if (dis < 1.2) {
index = 2
2
} else {
index = 3
3
}
if (index >= pLine.size) {
index = pLine.size-2
}
lastlonLatPoint = pLine.get(index)
if (lonLatPoint != null && lastlonLatPoint != null) {
tempAngle = GisGeomTool.getAngleToNorth(
getRound(lonLatPoint.longitude) - getRound(lastlonLatPoint!!.longitude),
getRound(lonLatPoint.latitude) - getRound(lastlonLatPoint!!.latitude)
)
}
lastLonLatPoint = pLine[index]
tempAngle = GisGeomTool.getAngleToNorth(
getRound(lonLatPoint.longitude) - getRound(lastLonLatPoint.longitude),
getRound(lonLatPoint.latitude) - getRound(lastLonLatPoint.latitude)
)
if (tempAngle == -400.0) {
if (angles != null && angles.size > 0){
tempAngle = angles.get(angles.size - 1)
tempAngle = if (angles != null && angles.size > 0){
angles[angles.size - 1]
}else {
tempAngle = lonLatPoint.angle
lonLatPoint.angle
}
}
var midAngle = tempAngle
}
return tempAngle.toFloat()
}
fun getLocationAngle(pLine: ArrayList<LonLatPoint>): Float {
var tempAngle = 0.0
val MAX_DISTANCE = 6
var index = 0
var lonLatPoint = pLine.get(pLine.size - 1)
val lonLatPoint = pLine[pLine.size - 1]
if (pLine.size == 1) {
tempAngle = lonLatPoint.angle
} else {
var lastlonLatPoint: LonLatPoint? = null
var lastLonLatPoint: LonLatPoint? = null
var dis = 0.0
for (i in 1 .. pLine.size-1){
lastlonLatPoint = pLine.get(pLine.size - 1 - i)
lastlonLatPoint?.let{
lastLonLatPoint = pLine[pLine.size - 1 - i]
lastLonLatPoint.let{
dis = distance(lonLatPoint.longitude, lonLatPoint.latitude, it.longitude, it.latitude)
index = pLine.size - 1 - i
Log.d(TAG, "angleooo--distance: ${dis}, index: ${index}")
Log.d(TAG, "angleooo--distance: ${dis}, index: $index")
}
if(dis >= MAX_DISTANCE){
break
}
}
if (lonLatPoint != null && lastlonLatPoint != null) {
if (lonLatPoint != null && lastLonLatPoint != null) {
tempAngle = GisGeomTool.getAngleToNorth(
lonLatPoint.longitude - lastlonLatPoint!!.longitude,
lonLatPoint.latitude - lastlonLatPoint!!.latitude
lonLatPoint.longitude - lastLonLatPoint.longitude,
lonLatPoint.latitude - lastLonLatPoint.latitude
)
}
@@ -364,11 +350,11 @@ object MathUtils {
}
if (DEBUG) {
Log.d(TAG, "angleooo-lastlonLatPoint: ${lastlonLatPoint}distance:${dis},index:${index}, tempAngle:${tempAngle}")
Log.d(TAG, "angleooo-lastlonLatPoint: ${lastLonLatPoint}distance:${dis},index:${index}, tempAngle:${tempAngle}")
}
if(DEBUG) {
for (lonlat in pLine) {
Log.d(TAG, "angleooo-lonlat: ${lonlat}")
for (lonLat in pLine) {
Log.d(TAG, "angleooo-lonlat: $lonLat")
}
}
@@ -379,9 +365,9 @@ object MathUtils {
fun utcToUnix(time: Long):Long{
val calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"))
calendar.timeInMillis = time
val localFormater = DateFormat.getInstance();//当地时间格式
localFormater.setTimeZone(TimeZone.getDefault());
val localTime = localFormater.format(calendar.getTime());
val localFormatter = DateFormat.getInstance()//当地时间格式
localFormatter.timeZone = TimeZone.getDefault()
val localTime = localFormatter.format(calendar.time)
return SimpleDateFormat().parse(localTime).time
}
@@ -389,7 +375,7 @@ object MathUtils {
if (DEBUG) {
Log.i(TAG, "getSmoothPoints: 平滑原始数据:${line.size}")
}
var list: ArrayList<LonLatPoint> = ArrayList<LonLatPoint>()
val list: ArrayList<LonLatPoint> = ArrayList()
if(line.size < 11){
return line
}
@@ -421,9 +407,9 @@ object MathUtils {
for (j in numBefore until i){
sumY += line[j].latitude
}
var num = numAfter - numBefore
var x = sumX/num
var y = sumY/num
val num = numAfter - numBefore
val x = sumX/num
val y = sumY/num
val lonlatPoint = LonLatPoint(x, y)
list.add(lonlatPoint)
}
@@ -437,18 +423,18 @@ object MathUtils {
if (DEBUG) {
Log.i(TAG, "getPoints: 插值原始数据:${line.size}")
}
var lonLatPoints: ArrayList<LonLatPoint> = ArrayList<LonLatPoint>()
if(line != null && line.size > 0) {
val lonLatPoints: ArrayList<LonLatPoint> = ArrayList()
if(line.size > 0) {
var startLonLatPoint = line[0]
for (i in 0 until line.size - 1) {
var start = startLonLatPoint
var end = line[i + 1]
val start = startLonLatPoint
val end = line[i + 1]
if (i == 0) {
lonLatPoints.add(start)
}
val x = end.latitude - start.latitude
val y = end.longitude - start.longitude
val dis = Math.sqrt(x * x + y * y).absoluteValue * 100000
val dis = sqrt(x * x + y * y).absoluteValue * 100000
val unit = dis / factor
val num = unit.toInt()
if(num <= 0){
@@ -460,11 +446,11 @@ object MathUtils {
for (i in 1..num) {
val lon = start.longitude + numY * i
val lat = start.latitude + numX * i
val lonlatPoint = LonLatPoint(lon, lat)
val lonLatPoint = LonLatPoint(lon, lat)
if (i == num) {
startLonLatPoint = lonlatPoint
startLonLatPoint = lonLatPoint
}
lonLatPoints.add(lonlatPoint)
lonLatPoints.add(lonLatPoint)
}
}
@@ -478,14 +464,14 @@ object MathUtils {
fun getTravelList(travel: String): ArrayList<LonLatPoint>{
var list = ArrayList<LonLatPoint>()
val list = ArrayList<LonLatPoint>()
var mTravel = travel.trim()
if(mTravel.isNotEmpty()){
if(mTravel.endsWith(",")){
mTravel = mTravel.trim(',')
}
var array = mTravel.split(",")
val array = mTravel.split(",")
if(array != null && array.size >= 2 && array.size%2 == 0){
for(i in 0..array.size-1 step 2){
val lonLatPoint = LonLatPoint(array[i].toDouble(), array[i+1].toDouble())
@@ -533,25 +519,25 @@ object MathUtils {
*/
fun destination(lng: Double, lat: Double, heading: Double, distance: Double): DoubleArray {
//计算扇形的眯点坐标
val heading = (heading + 360) % 360
val bearing = (heading + 360) % 360
val rad = Math.PI / 180
val radInv = 180 / Math.PI
var lonRad = lng * rad
var latRad = lat * rad
var rheading = heading * rad
var sinLatRad = Math.sin(latRad)
var cosLatRad = Math.cos(latRad)
var cosDistR = Math.cos(distance / EARTH_R)
var sinDistR = Math.sin(distance / EARTH_R)
var lat2 = Math.asin(
sinLatRad * cosDistR + cosLatRad * sinDistR * Math.cos(rheading)
val lonRad = lng * rad
val latRad = lat * rad
val rHeading = bearing * rad
val sinLatRad = sin(latRad)
val cosLatRad = cos(latRad)
val cosDistR = cos(distance / EARTH_R)
val sinDistR = sin(distance / EARTH_R)
var lat2 = asin(
sinLatRad * cosDistR + cosLatRad * sinDistR * cos(rHeading)
)
var lon2 = lonRad +
Math.atan2(
Math.sin(rheading) * sinDistR * cosLatRad,
cosDistR - sinLatRad * Math.sin(lat2)
);
lon2 = lon2 * radInv;
atan2(
sin(rHeading) * sinDistR * cosLatRad,
cosDistR - sinLatRad * sin(lat2)
)
lon2 *= radInv
lon2 = if (lon2 > 180) {
lon2 - 360
} else {
@@ -561,7 +547,7 @@ object MathUtils {
lon2
}
}
lat2 = lat2 * radInv
lat2 *= radInv
return doubleArrayOf(lon2, lat2)
}
@@ -668,20 +654,19 @@ object MathUtils {
}
// 计算两个线段的夹角
fun computeAngle(segment1: Pair<LonLatPoint, LonLatPoint>, segment2: Pair<LonLatPoint, LonLatPoint>): Double? {
fun computeAngle(segment1: Pair<LonLatPoint, LonLatPoint>, segment2: Pair<LonLatPoint, LonLatPoint>): Double {
// 计算线段1的方向向量
val v1 = LonLatPoint(segment1.second.longitude - segment1.first.longitude, segment1.second.latitude - segment1.first.latitude)
// 计算线段2的方向向量
val v2 = LonLatPoint(segment2.second.longitude - segment2.first.longitude, segment2.second.latitude - segment2.first.latitude)
// 计算向量夹角的余弦值
val cosAngle = (v1.longitude * v2.longitude + v1.latitude * v2.latitude) / (Math.sqrt(v1.longitude * v1.longitude + v1.latitude * v1.latitude) * Math.sqrt(v2.longitude * v2.longitude + v2.latitude * v2.latitude))
val cosAngle = (v1.longitude * v2.longitude + v1.latitude * v2.latitude) / (sqrt(v1.longitude * v1.longitude + v1.latitude * v1.latitude) * sqrt(v2.longitude * v2.longitude + v2.latitude * v2.latitude))
// 返回角度值
return Math.toDegrees(Math.acos(cosAngle))
return Math.toDegrees(acos(cosAngle))
}
// 获取距离自车最近的点及其下标
fun getNearestPoints(mLonlatPoint: LonLatPoint, pointList: MutableList<LonLatPoint>): MutableList<LonLatPoint>?{
fun getNearestPoints(mLonLatPoint: LonLatPoint, pointList: MutableList<LonLatPoint>): MutableList<LonLatPoint>?{
if (pointList.isEmpty()) {
return null
}
@@ -689,7 +674,7 @@ object MathUtils {
var nearestIndex = -1
for ((index, point) in pointList.withIndex()) {
val distance = distance(mLonlatPoint, point)
val distance = distance(mLonLatPoint, point)
if (distance < minDistance) {
minDistance = distance
nearestIndex = index
@@ -700,21 +685,18 @@ object MathUtils {
}
fun isInRegion(lon: Double, lat: Double, list: List<List<Double>>?): Boolean {
var iSum: Int
val iCount: Int
var iIndex: Int
var dLon1 = 0.0
var dLon2 = 0.0
var dLat1 = 0.0
var dLat2 = 0.0
var dLon1:Double
var dLon2:Double
var dLat1:Double
var dLat2:Double
var dLon: Double
list?: return false
if (list.size < 3) {
return false
}
iSum = 0
iCount = list.size
iIndex = 0
var iSum = 0
val iCount = list.size
var iIndex = 0
while (iIndex < iCount) {
if (iIndex == iCount - 1) {
dLon1 = list[iIndex][0]
@@ -729,7 +711,7 @@ object MathUtils {
}
// 以下语句判断A点是否在边的两端点的水平平行线之间在则可能有交点开始判断交点是否在左射线上
if (lat >= dLat1 && lat < dLat2 || lat >= dLat2 && lat < dLat1) {
if (Math.abs(dLat1 - dLat2) > 0) {
if (abs(dLat1 - dLat2) > 0) {
//得到 A点向左射线与边的交点的x坐标
dLon = dLon1 - (dLon1 - dLon2) * (dLat1 - lat) / (dLat1 - dLat2)
// 如果交点在A点左侧说明是做射线与 边的交点),则射线与边的全部交点数加一:

View File

@@ -3,5 +3,5 @@ package com.zhidaoauto.map.sdk.open.abs
import android.view.MotionEvent
interface OnMapTouchListener {
fun onTouch(event: MotionEvent?):Boolean
fun onTouch(event: MotionEvent):Boolean
}

View File

@@ -27,7 +27,7 @@ object PointCloudHelper {
* @param isReset 是否重置数据
* @return 是否执行
*/
fun updatePointCloudDataByPb(dataArray: ByteArray, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean,mapController: IMapController?):Boolean{
fun updatePointCloudDataByPb(dataArray: ByteArray?, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean,mapController: IMapController?):Boolean{
return mapController?.updatePointCloudDataByPb(dataArray,isTrasformer,isResidual,isReset)?:false
}

View File

@@ -25,7 +25,7 @@ class MapStyleParams: IMapStyleParams {
private var mLocationIcon3DRes = R.raw.car
//显示高精地图元素
private var hdVisibileArray = intArrayOf(
private var hdVisibleArray = intArrayOf(
HDTypes.DIVIDER.type,
HDTypes.ROAD_AREA.type,
HDTypes.STOP_LINE.type,
@@ -170,7 +170,7 @@ class MapStyleParams: IMapStyleParams {
override fun getHDVisibileArray(): IntArray {
return hdVisibileArray
return hdVisibleArray
}
/**
@@ -178,7 +178,7 @@ class MapStyleParams: IMapStyleParams {
* @param filter 参照 HDTypes
*/
override fun setHDVisibileArray(filter: IntArray): MapStyleParams {
this.hdVisibileArray = filter
this.hdVisibleArray = filter
return this;
}
@@ -345,7 +345,7 @@ class MapStyleParams: IMapStyleParams {
override fun toString(): String {
return "MapStyleParams( zoom=$zoom, carPosition=$carPosition, isAutoSwitch=$isAutoSwitch, isAutoLocation=$isAutoLocation, hdVisibileArray=${hdVisibileArray.contentToString()}, styleMode=$styleMode, perspectiveMode=$perspectiveMode, vrPerspectiveMode=$vrPerspectiveMode, vrAngleMode=$vrAngleMode, isSwitchViewAngle=$isSwitchViewAngle, vrEyeHeight=$vrEyeHeight, zoomVal=$zoomVal, minDistanceForPosition=$minDistanceForPosition, isShadowEnable=$isShadowEnable, styleName='$styleName')"
return "MapStyleParams( zoom=$zoom, carPosition=$carPosition, isAutoSwitch=$isAutoSwitch, isAutoLocation=$isAutoLocation, hdVisibileArray=${hdVisibleArray.contentToString()}, styleMode=$styleMode, perspectiveMode=$perspectiveMode, vrPerspectiveMode=$vrPerspectiveMode, vrAngleMode=$vrAngleMode, isSwitchViewAngle=$isSwitchViewAngle, vrEyeHeight=$vrEyeHeight, zoomVal=$zoomVal, minDistanceForPosition=$minDistanceForPosition, isShadowEnable=$isShadowEnable, styleName='$styleName')"
}