From 15bb3d3b54f802e1e0fa5dfef91175141af796da Mon Sep 17 00:00:00 2001 From: yangyakun Date: Mon, 13 Mar 2023 11:45:12 +0800 Subject: [PATCH] =?UTF-8?q?[sweeper]=20[=E9=83=A8=E5=88=86=E8=BD=A8?= =?UTF-8?q?=E8=BF=B9=E4=B8=8D=E5=B1=95=E7=A4=BA]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mogo/och/sweeper/view/WeltMapOverView.kt | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/WeltMapOverView.kt b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/WeltMapOverView.kt index 22e0e73042..38dcd50fb1 100644 --- a/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/WeltMapOverView.kt +++ b/OCH/mogo-och-sweeper/src/main/java/com/mogo/och/sweeper/view/WeltMapOverView.kt @@ -36,6 +36,8 @@ class WeltMapOverView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener { private var mRoutePolylines: Polyline?=null // private val mLineMarkers: MutableList = mutableListOf() private var mEndStationMarker: Marker? = null + private var mogoDistanceLocationMax: LatLng?=null + private var aPointDistanceMax = 0.0F private var mFirst: Boolean = false //清扫车任务地图 @@ -153,9 +155,27 @@ class WeltMapOverView : ConstraintLayout, IMoGoChassisLocationGCJ02Listener { if (mTaskCoordinatesLatLng.size > 0) { //存放经纬度 for (i in mTaskCoordinatesLatLng.indices) { - boundsBuilder.include(mTaskCoordinatesLatLng[i]) + 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) + } boundsBuilder.include(currentLatLng) mAMap?.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(), 100, 100, 100, 100))