[sweeper]

[地图圈选范围]
This commit is contained in:
yangyakun
2023-03-13 21:53:36 +08:00
parent 7c10ae5e29
commit 15b5258d2d
2 changed files with 7 additions and 18 deletions

View File

@@ -37,8 +37,6 @@ class WeltMapOverView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener {
private var mRoutePolylines: Polyline?=null
// private val mLineMarkers: MutableList<Marker?> = mutableListOf()
private var mEndStationMarker: Marker? = null
private var mogoDistanceLocationMax: LatLng?=null
private var aPointDistanceMax = 0.0F
private var mFirst: Boolean = false
//清扫车任务地图
@@ -58,6 +56,7 @@ class WeltMapOverView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener {
initAMapView()
// 注册定位监听
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
CallerChassisLocationGCJ02ListenerManager.setListenerHz(TAG,5)
}
private fun initAMapView() {
@@ -156,24 +155,10 @@ class WeltMapOverView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener {
for (i in mTaskCoordinatesLatLng.indices) {
val latLng = mTaskCoordinatesLatLng[i]
boundsBuilder.include(latLng)
try {
val calculateLineDistance = CoordinateUtils.calculateLineDistance(
latLng.longitude,
latLng.latitude,
currentLatLng.latitude,
currentLatLng.longitude
)
if(calculateLineDistance>aPointDistanceMax){
aPointDistanceMax = calculateLineDistance
mogoDistanceLocationMax = currentLatLng
}
}catch (e:Exception){
CallerLogger.e(TAG,e.stackTrace)
}
}
}
mogoDistanceLocationMax?.let {
boundsBuilder.include(it)
mRoutePolylines?.points?.forEach {latLng->
boundsBuilder.include(latLng)
}
boundsBuilder.include(currentLatLng)
mAMap?.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(), 100, 100, 100, 100))

View File

@@ -55,6 +55,7 @@ class WeltSmallMapView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener {
initAMapView()
// 注册定位监听
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
CallerChassisLocationGCJ02ListenerManager.setListenerHz(TAG,5)
}
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
@@ -71,6 +72,9 @@ class WeltSmallMapView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener {
boundsBuilder.include(mTaskCoordinatesLatLng[i])
}
}
mRoutePolylines?.points?.forEach {latLng->
boundsBuilder.include(latLng)
}
boundsBuilder.include(currentLatLng)
mAMap!!.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(), 100, 100, 100, 100))
}