[map-sdk]地图版本3.3.3.7

This commit is contained in:
wangyanjun
2023-12-26 14:19:04 +08:00
parent ae9fabf854
commit 73c6d61133
355 changed files with 786 additions and 108 deletions

View File

@@ -1025,6 +1025,10 @@ class MapEngine {
setStyleName("night")
else if(styleMode== MapAutoApi.MAP_STYLE_DAY_VR)
setStyleName("day")
else if(styleMode== MapAutoApi.MAP_STYLE_DAY_VR_BUS)
setStyleName("bus_day")
else if(styleMode== MapAutoApi.MAP_STYLE_DAY_VR_TAXI)
setStyleName("taxi_day")
}
private external fun loadJni(projectDir: String, mapView: MapView?,assetManager: AssetManager?): Long

View File

@@ -596,7 +596,7 @@ class MapView(context: Context, private val mMapStyleParams: IMapStyleParams, pr
}
if (isRenderFirst) {
isRenderFirst = false
if(mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_NIGHT_VR || mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_DAY_VR) {
if(mMapStyleParams.getStyleMode() >= MapAutoApi.MAP_STYLE_NIGHT_VR) {
mMapController?.setMapViewVisualAngle(mMapStyleParams.getVrAngleDefaultMode())
}
mHandler.sendEmptyMessage(INIT_COMPLETE)
@@ -729,7 +729,7 @@ class MapView(context: Context, private val mMapStyleParams: IMapStyleParams, pr
mMapEngine.setScreenToOriginDis(mMapStyleParams.getCarPosition())
if (mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_NIGHT_VR || mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_DAY_VR) {
if (mMapStyleParams.getStyleMode() >= MapAutoApi.MAP_STYLE_NIGHT_VR) {
if (DEBUG) {
Log.i(TAG, "mapop-surfaceop----onSurfaceCreated,Vr")
}
@@ -779,7 +779,7 @@ class MapView(context: Context, private val mMapStyleParams: IMapStyleParams, pr
return true
}
if (isCanZoom) {
if(mMapStyleParams.isSwitchViewAngle() && (mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_NIGHT_VR || mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_DAY_VR)){
if(mMapStyleParams.isSwitchViewAngle() && (mMapStyleParams.getStyleMode() >= MapAutoApi.MAP_STYLE_NIGHT_VR)){
var type = mMapStyleParams.getVrAngleDefaultMode()
when(mMapStyleParams.getVrAngleMode()){
mMapStyleParams.getVrAngleDefaultMode()->{
@@ -1083,13 +1083,13 @@ class MapView(context: Context, private val mMapStyleParams: IMapStyleParams, pr
private var isScroll = true
//可以斜滑
private var isFling = false
private var isFling = true
//可以旋转
private var isRotate = false
private var isRotate = true
//可以缩放
private var isCanZoom = false
private var isCanZoom = true
private var isVr = true
@@ -1151,10 +1151,10 @@ class MapView(context: Context, private val mMapStyleParams: IMapStyleParams, pr
}
fun onMapFocusChanging() {
// if (DEBUG) {
// Log.i(TAG, "mapop--onMapFocusChanging")
// }
// mHandler.sendEmptyMessage(FOCUS_CHANGE)
if (DEBUG) {
Log.i(TAG, "mapop--onMapFocusChanging")
}
mHandler.sendEmptyMessage(FOCUS_CHANGE)
}
fun onMapZoomChanging(zoomIndex: Float) {
@@ -1168,23 +1168,23 @@ class MapView(context: Context, private val mMapStyleParams: IMapStyleParams, pr
}
fun onMapRAngleChanging(angle:Float) {
// if (DEBUG) {
// Log.i(TAG, "mapop--onMapRAngleChanging")
// }
// val msg = Message.obtain()
// msg.what = ROTATE_CHANGE
// msg.obj = angle
// mHandler.sendMessage(msg)
if (DEBUG) {
Log.i(TAG, "mapop--onMapRAngleChanging:${angle}")
}
val msg = Message.obtain()
msg.what = ROTATE_CHANGE
msg.obj = angle
mHandler.sendMessage(msg)
}
fun onMapDAngleChanging(angle:Float) {
// if (DEBUG) {
// Log.i(TAG, "mapop--onMapDAngleChanging:${angle}")
// }
// val msg = Message.obtain()
// msg.what = DAngle_CHANGE
// msg.obj = angle
// mHandler.sendMessage(msg)
if (DEBUG) {
Log.i(TAG, "mapop--onMapDAngleChanging:${angle}")
}
val msg = Message.obtain()
msg.what = DAngle_CHANGE
msg.obj = angle
mHandler.sendMessage(msg)
}
override fun loadP(

View File

@@ -993,13 +993,14 @@ class MapController(private var context: Context?, private val mMapView: IMapVie
}
mMapStyleParams.setVrPerspectiveMode(arrays[0])
mMapStyleParams.setVrEyeHeight(arrays[1])
if(mMapStyleParams.getVrAngleMode()==ConstantExt.MAP_STYLE_VR_BRIDGE){
var fac = 100.0f/(arrays[0]*8f)/20f
var lookAtZ = alt + 5.0f
var cameraHeight = arrays[2] + lookAtZ
arrays[2]=cameraHeight*fac;
mMapView.getMapEngine().setScreenToOriginDis(lookAtZ*fac)
}
//底层读取中心线的高度,暂时不用轨迹的高度
// if(mMapStyleParams.getVrAngleMode()==ConstantExt.MAP_STYLE_VR_BRIDGE){
// var fac = 100.0f/(arrays[0]*8f)/20f
// var lookAtZ = alt + 5.0f
// var cameraHeight = arrays[2] + lookAtZ
// arrays[2]=cameraHeight*fac;
// mMapView.getMapEngine().setScreenToOriginDis(lookAtZ*fac)
// }
if (lastAnimZoom == arrays[0] && lastOverLookAngle == arrays[1] && lastEyeHeight == arrays[2]) {
mMapView.getMapEngine()
@@ -1371,7 +1372,7 @@ class MapController(private var context: Context?, private val mMapView: IMapVie
-1
)
delay(1000)
mMapView.getMapEngine().setCfgKeyVal("isSkyBoxFastChange", "disable")
//mMapView.getMapEngine().setCfgKeyVal("isSkyBoxFastChange", "disable")
mMapView.getMapEngine().setCfgKeyVal(ConstantExt.FOG, "enable")
mMapView.getMapEngine().setCfgKeyVal(ConstantExt.SKYBOX, "enable")
}

View File

@@ -56,7 +56,7 @@ class PanelBtnLocation(context: Context?,private val mMapController: IMapControl
setPos(0, 20, 10, 25)
setMyGravity(Gravity.BOTTOM or Gravity.RIGHT)
val style = mMapController.getMapStyleParams().getStyleMode()
if(style == MapAutoApi.MAP_STYLE_DAY || style == MapAutoApi.MAP_STYLE_DAY_VR){
if(style == MapAutoApi.MAP_STYLE_DAY || style >= MapAutoApi.MAP_STYLE_DAY_VR){
btn_pos.setImageResource(R.mipmap.icon_location_day)
}else{
btn_pos.setImageResource(R.mipmap.icon_location_night)

View File

@@ -51,7 +51,7 @@ class PanelZoom(context: Context?,private val mMapController:IMapController) : P
setMyGravity(Gravity.RIGHT or Gravity.BOTTOM)
setPos(0, 165, 0, 25)
val style = mMapController.getMapStyleParams().getStyleMode()
if(style == MapAutoApi.MAP_STYLE_DAY || style == MapAutoApi.MAP_STYLE_DAY_VR){
if(style == MapAutoApi.MAP_STYLE_DAY || style >= MapAutoApi.MAP_STYLE_DAY_VR){
img_zoom_in.setImageResource(R.mipmap.icon_zoom_in_day)
img_zoom_out.setImageResource(R.mipmap.icon_zoom_out_day)
}else{

View File

@@ -0,0 +1,24 @@
package com.zhidaoauto.map.sdk.inner.utils
object ColorUtil {
fun getColor(segments: List<Pair<Int, Int>>): List<Int>? {
val gradientColors = mutableListOf<Int>()
for (i in 0 until segments.size - 1) {
val (startPercent, startColor) = segments[i]
val (endPercent, endColor) = segments[i + 1]
for (j in startPercent until endPercent step 10) {
val percent = (j - startPercent).toFloat() / (endPercent - startPercent).toFloat()
val interpolatedAlpha= startColor + (endColor - startColor) * percent
gradientColors.add(interpolatedAlpha.toInt())
}
}
// Add the last color
gradientColors.add(segments.last().second)
return gradientColors
}
}

View File

@@ -53,10 +53,8 @@ object MapAutoApi {
const val MAP_STYLE_NIGHT_NAV = 4 //夜间导航模式
const val MAP_STYLE_NIGHT_VR = 5 //夜间VR模式
const val MAP_STYLE_DAY_VR = 6 //白天VR
const val MAP_STYLE_VR_ROAM = 7 //漫游模式
const val MAP_STYLE_VR_TRANS = 8//过渡模式
const val MAP_STYLE_VR_ERHAI_B2 = 9//洱海模式
const val MAP_STYLE_VR_SKY_BOX = 10 //天空盒模式
const val MAP_STYLE_DAY_VR_BUS = 7 //小巴车白天VR
const val MAP_STYLE_DAY_VR_TAXI = 8 //TAXI白天VR
const val MAP_STYLE_VR_ANGLE_NEAR = 0
const val MAP_STYLE_VR_ANGLE_MIDDLE = 1
@@ -65,6 +63,11 @@ object MapAutoApi {
const val MAP_STYLE_VR_ANGLE_TOP = 4
const val MAP_STYLE_VR_ANGLE_CROSS = 5
const val MAP_STYLE_VR_ANGLE_MIDDLE_XIAOBA = 6
const val MAP_STYLE_VR_ROAM = 7 //漫游模式
const val MAP_STYLE_VR_TRANS = 8//过渡模式
const val MAP_STYLE_VR_ERHAI_B2 = 9//洱海模式
const val MAP_STYLE_VR_SKY_BOX = 10 //天空盒模式
const val ROAM_DIS_1KM = 1000f

View File

@@ -44,7 +44,7 @@ class MyLocationStyle(
private var locationCount = 0
private var is3D: Boolean = false
private var carId: Int = 0
private var isDisplayAnim: Boolean = false
private var isDisplayAnim: Boolean = true
private var mMarker: Marker? = null
private var lastExecuteTime = -1L
@@ -76,7 +76,7 @@ class MyLocationStyle(
init {
car3DResId = mMapStyleParams?.getLocationIcon3DRes() ?: R.raw.car
carResId = mMapStyleParams?.getLocationIconRes() ?: R.mipmap.map_custom_self_car_night
isDisplayAnim = mMapStyleParams?.isDisplayAnim()?: false
isDisplayAnim = mMapStyleParams?.isDisplayAnim()?: true
}
fun getSelfMarker(): Marker? {
@@ -90,7 +90,7 @@ class MyLocationStyle(
if (isDisplayAnim) {
mMarker?.getMarkeOptions()?.let {
it.animMarkerRes(guangquanResId, mMapController).animWaitFrame(animWaitFrame)
.period(animPeriod)
.period(animPeriod).animScale(0.85f)
mMarker?.setMarkerOptions(it)
}
} else {
@@ -181,7 +181,7 @@ class MyLocationStyle(
if (isDisplayAnim) {
markerOptions?.animWaitFrame(animWaitFrame)?.period(animPeriod)
?.animType(1)?.anchorType(1)
?.animType(1)?.anchorType(1)?.animScale(0.85f)
markerOptions?.animMarkerRes(guangquanResId, mMapController)
} else {
//待增加删除之前动画模型的逻辑
@@ -230,6 +230,7 @@ class MyLocationStyle(
.animType(1)
.anchorType(1)
.animWaitFrame(animWaitFrame)
.animScale(0.85f)
.period(animPeriod)
if (isDisplayAnim) {
options.animMarkerRes(guangquanResId, mMapController)

View File

@@ -118,6 +118,13 @@ public class Marker(private var markerOptions: MarkerOptions,private var mMapCon
mMapController?.updateAnchorProperty(id,"scale","${markerOptions?.scale ?: scale}")
}
fun setAnimScale(animScale: Float) {
markerOptions.animScale(animScale)
mMapController?.updateAnchorProperty(id,"animScale","${markerOptions?.animScale ?: animScale}")
}
fun getClickable(): Boolean {
return markerOptions.isClickable()!!
}

View File

@@ -120,6 +120,8 @@ class MarkerOptions {
var averageFlag: Int = 1
var animScale = 1f
constructor(mapController: IMapController?) {
this.id = mapController?.getRecycleId() ?: UUID.randomUUID().toString()
@@ -148,6 +150,7 @@ class MarkerOptions {
markerInfoName =""
controlAngle = false
vrIcon = false
animScale = 1f
icons.clear()
}
@@ -588,6 +591,11 @@ class MarkerOptions {
return this
}
fun animScale(animScale: Float): MarkerOptions{
this.animScale = animScale
return this
}
fun getPosition(): LonLatPoint? {
return originLonLatPoint
}

View File

@@ -26,7 +26,7 @@ class MarkerSimpleData {
var text: String = ""
//状态
var status: Int = 0
//置灰
//置灰 0 不置灰 1 置灰
var grayScale: Int = 0

View File

@@ -75,6 +75,8 @@ class PolylineOptions {
private var isBright = false
private var isArrow = false
constructor(mapController: IMapController?){
this.mMapController = mapController
id = UUID.randomUUID().toString()
@@ -86,7 +88,14 @@ class PolylineOptions {
this.lineWidth = lineWidth.toFloat()
this.lonLatPoints = lonLatPoints
}
fun setIsArrow(b: Boolean): PolylineOptions{
this.isArrow = b
return this
}
fun getIsArrow(): Boolean{
return isArrow
}
fun color(color: Int): PolylineOptions{
this.color = color
return this
@@ -306,6 +315,7 @@ class PolylineOptions {
", useTexture=" + useTexture +
", maxIndex=" + maxIndex +
", isFacade=" + isFacade +
", isArrow=" + isArrow +
'}'
}
}

View File

@@ -7,6 +7,7 @@ import com.zhidaoauto.map.data.point.LonLatPoint
import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG
import com.zhidaoauto.map.sdk.inner.abs.IMapController
import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy
import com.zhidaoauto.map.sdk.inner.utils.ColorUtil
import com.zhidaoauto.map.sdk.inner.utils.MathUtils
import kotlin.math.abs
import kotlin.math.absoluteValue
@@ -314,4 +315,8 @@ object MapTools {
return MathUtils.isInRegion(lon, lat, list)
}
fun getColorAlpha(segments: List<Pair<Int, Int>>): List<Int>?{
return ColorUtil.getColor(segments)
}
}

View File

@@ -457,7 +457,7 @@ class TaskManager private constructor() {
val array = (trackStr + trackStr1).split(",")
val list = ArrayList<LonLatPoint>()
for( i in 0 until array.size step 2){
list.add(LonLatPoint(array[i].toDouble(),array[i+1].toDouble()))
list.add(LonLatPoint(array[i].toDoubleOrNull()?:0.0,array[i+1].toDoubleOrNull()?:0.0))
}
mapAutoView.getMapAutoViewHelper()?.setRoamTrajectory(list)
}
@@ -680,8 +680,8 @@ class TaskManager private constructor() {
if (it.status == 1) {
RoadHelper.getInstance()
?.getCrossRoadById(
it.tile_id.toInt(),
it.cross_id.toLong(),
it.tile_id.toIntOrNull()?:1,
it.cross_id.toLongOrNull()?:1L,
object :
IResult<ArrayList<LonLatPoint>> {
override fun result(
@@ -719,7 +719,7 @@ class TaskManager private constructor() {
})
}
monitorGetZebraLine(lonlatPoint, mapAutoView)
// monitorGetZebraLine(lonlatPoint, mapAutoView)
}
fun monitorDelLine() {
@@ -820,9 +820,9 @@ class TaskManager private constructor() {
while (buffreader != null && buffreader.readLine().also { line = it } != null) {
val lines = line!!.split(",")
val lonLatPoint = LonLatPoint()
lonLatPoint.longitude = lines[1].trim().toDouble()
lonLatPoint.latitude = lines[2].trim().toDouble()
lonLatPoint.angle = lines[4].trim().toDouble()
lonLatPoint.longitude = lines[1].trim().toDoubleOrNull()?:0.0
lonLatPoint.latitude = lines[2].trim().toDoubleOrNull()?:0.0
lonLatPoint.angle = lines[4].trim().toDoubleOrNull()?:0.0
list.add(lonLatPoint)
}
trackMap[index] = list
@@ -876,17 +876,17 @@ class TaskManager private constructor() {
var angle: Double
var type: Int
if (i == 0) {
id = other[1].trim().toLong()
lon = other[2].trim().toDouble()
lat = other[3].trim().toDouble()
angle = other[5].trim().toDouble()
type = other[7].trim().toInt()
id = other[1].trim().toLongOrNull()?:1L
lon = other[2].trim().toDoubleOrNull()?:0.0
lat = other[3].trim().toDoubleOrNull()?:0.0
angle = other[5].trim().toDoubleOrNull()?:0.0
type = other[7].trim().toIntOrNull()?:1
} else {
id = other[0].trim().toLong()
lon = other[1].trim().toDouble()
lat = other[2].trim().toDouble()
angle = other[4].trim().toDouble()
type = other[6].trim().toInt()
id = other[0].trim().toLongOrNull()?:1L
lon = other[1].trim().toDoubleOrNull()?:0.0
lat = other[2].trim().toDoubleOrNull()?:0.0
angle = other[4].trim().toDoubleOrNull()?:0.0
type = other[6].trim().toIntOrNull()?:1
}
if (i == count - 1) {
centerMarkerOptions.lon = lon

View File

@@ -427,7 +427,7 @@ class MapAutoViewHelper(mapAutoView: MapAutoView) {
/**
* 设置地图模式
*
* @param stylemode 视图模式 0 日间模式 1夜间模式 2SATEL模式 3日间导航模式 4夜间导航模式
* @param stylemode 视图模式 0 日间模式 1夜间模式 2SATEL模式 3日间导航模式 4夜间导航模式 5:夜间vr模式 6 默认白天模式 7 小巴车白天VR 8 Taxi白天
*/
fun setMapStyle(stylemode: Int) {
if (CompileConfig.DEBUG) {