[bugfix]
[mPolyline 置null]
This commit is contained in:
@@ -41,7 +41,7 @@ class BusPassengerMapDirectionView @JvmOverloads constructor(
|
||||
|
||||
companion object {
|
||||
//小地图名称
|
||||
const val TAG = "TPMapDirectionView"
|
||||
const val TAG = "BusPassengerMapDirectionView"
|
||||
}
|
||||
|
||||
private lateinit var mAMapNaviView: TextureMapView
|
||||
@@ -116,7 +116,7 @@ class BusPassengerMapDirectionView @JvmOverloads constructor(
|
||||
// 设置地图的样式
|
||||
mAMap.uiSettings.apply {
|
||||
isZoomControlsEnabled = false // 地图缩放级别的交换按钮
|
||||
setAllGesturesEnabled(false) // 所有手势
|
||||
setAllGesturesEnabled(true) // 所有手势
|
||||
isMyLocationButtonEnabled = false // 显示默认的定位按钮
|
||||
setLogoBottomMargin(-150) //设置Logo下边界距离屏幕底部的边距,设置为负值即可
|
||||
}
|
||||
@@ -148,9 +148,9 @@ class BusPassengerMapDirectionView @JvmOverloads constructor(
|
||||
mAMap.setOnCameraChangeListener(this)
|
||||
}
|
||||
|
||||
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
|
||||
return true
|
||||
}
|
||||
// override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
|
||||
// return true
|
||||
// }
|
||||
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (mogoLocation == null) {
|
||||
@@ -212,8 +212,10 @@ class BusPassengerMapDirectionView @JvmOverloads constructor(
|
||||
mPolyline!!.options.customTextureIndex = texIndexList
|
||||
return
|
||||
}
|
||||
textureList.add(mArrivedRes)
|
||||
textureList.add(mUnArrivedRes)
|
||||
if(textureList.isEmpty()) {
|
||||
textureList.add(mArrivedRes)
|
||||
textureList.add(mUnArrivedRes)
|
||||
}
|
||||
//设置线段纹理
|
||||
val polylineOptions = PolylineOptions().apply {
|
||||
addAll(allPoints)
|
||||
@@ -231,6 +233,7 @@ class BusPassengerMapDirectionView @JvmOverloads constructor(
|
||||
override fun clearPolyline() {
|
||||
if (mPolyline != null) {
|
||||
mPolyline!!.remove()
|
||||
mPolyline = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class TaxiPassengerMapDirectionView @JvmOverloads constructor(
|
||||
|
||||
companion object {
|
||||
//小地图名称
|
||||
const val TAG = "TPMapDirectionView"
|
||||
const val TAG = "TaxiPassengerMapDirectionView"
|
||||
private const val zoomLevel = 13.0f
|
||||
}
|
||||
|
||||
@@ -212,8 +212,10 @@ class TaxiPassengerMapDirectionView @JvmOverloads constructor(
|
||||
mPolyline!!.options.customTextureIndex = texIndexList
|
||||
return
|
||||
}
|
||||
textureList.add(mArrivedRes)
|
||||
textureList.add(mUnArrivedRes)
|
||||
if(textureList.isEmpty()) {
|
||||
textureList.add(mArrivedRes)
|
||||
textureList.add(mUnArrivedRes)
|
||||
}
|
||||
//设置线段纹理
|
||||
val polylineOptions = PolylineOptions().apply {
|
||||
addAll(allPoints)
|
||||
@@ -231,6 +233,7 @@ class TaxiPassengerMapDirectionView @JvmOverloads constructor(
|
||||
override fun clearPolyline() {
|
||||
if (mPolyline != null) {
|
||||
mPolyline!!.remove()
|
||||
mPolyline = null
|
||||
}
|
||||
mStartMarker.isVisible = false
|
||||
mEndMarker.isVisible = false
|
||||
|
||||
@@ -219,8 +219,10 @@ class TaxiMapDirectionView @JvmOverloads constructor(
|
||||
mPolyline!!.options.customTextureIndex = texIndexList
|
||||
return
|
||||
}
|
||||
textureList.add(mArrivedRes)
|
||||
textureList.add(mUnArrivedRes)
|
||||
if(textureList.isEmpty()) {
|
||||
textureList.add(mArrivedRes)
|
||||
textureList.add(mUnArrivedRes)
|
||||
}
|
||||
//设置线段纹理
|
||||
val polylineOptions = PolylineOptions().apply {
|
||||
addAll(allPoints)
|
||||
@@ -238,6 +240,7 @@ class TaxiMapDirectionView @JvmOverloads constructor(
|
||||
override fun clearPolyline() {
|
||||
if (mPolyline != null) {
|
||||
mPolyline!!.remove()
|
||||
mPolyline = null
|
||||
}
|
||||
mStartMarker.isVisible = false
|
||||
mEndMarker.isVisible = false
|
||||
@@ -281,6 +284,6 @@ class TaxiMapDirectionView @JvmOverloads constructor(
|
||||
|
||||
companion object {
|
||||
//小地图名称
|
||||
const val TAG = "TPMapDirectionView"
|
||||
const val TAG = "TaxiMapDirectionView"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user