[sweeper]
[地图圈选范围]
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user