[RoutingOpt]移除最小移除点数限制

[RoutingOpt]移除最小移除点数限制

[RoutingOpt]逻辑优化
This commit is contained in:
renwj
2022-05-30 20:08:03 +08:00
parent 5b8f7a0e2d
commit a5af953b15
3 changed files with 21 additions and 14 deletions

View File

@@ -36,7 +36,11 @@ open class AutopilotStatusInfo : Serializable, Cloneable {
* 定位是否可用
*/
var locationStatus = false
@Volatile
var locationLat = 0.0
@Volatile
var locationLon = 0.0
var satelliteTime = 0L

View File

@@ -18,6 +18,7 @@ import java.util.concurrent.ConcurrentHashMap
object CallerAutoPilotStatusListenerManager : CallerBase() {
// 存储最后一次回调的数据,当有新当位置注册了监听将此数据回调过去,防止有些模块注册顺序问题导致无法获取最新状态
@Volatile
private var mAutopilotStatusInfo: AutopilotStatusInfo = AutopilotStatusInfo()
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步

View File

@@ -152,7 +152,6 @@ public class RouteOverlayDrawer {
this.routeList = routeList;
}
@SuppressLint("LongLogTag")
@Override
public void run() {
@@ -192,19 +191,12 @@ public class RouteOverlayDrawer {
}
points.add(acquire);
}
MogoLocation location = this.location;
double lon = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon();
double lat = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat();
if (lon == 0.0 || lat == 0.0) {
isExcept = true;
return;
}
if (location != null && points.size() > 0) {
int i = 0;
int max = Math.min(20, points.size() / 2);
int removeCount = 0;
if (points.size() > 0) {
MogoLatLng top = null;
long angle;
while (i++ < max) {
while (points.size() != 0) {
MogoLatLng first = points.peek();
if (first == null) {
continue;
@@ -212,12 +204,22 @@ public class RouteOverlayDrawer {
if (first == top) {
break;
}
angle = isPointOnCarFront(lon, lat, location.getBearing(), first.lon, first.lat);
lon = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon();
lat = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat();
long angle = isPointOnCarFront(lon, lat, location.getBearing(), first.lon, first.lat);
if (angle >= 90) {
removeCount++;
pools.release(first);
points.poll();
}
top = first;
}
if (points.size() == 0) {
isExcept = true;
return;
}
MogoLatLng self = pools.acquire();
if (self == null) {
self = new MogoLatLng(lat, lon);
@@ -236,11 +238,11 @@ public class RouteOverlayDrawer {
if (mMoGoPolyline != null && !mMoGoPolyline.isDestroyed() && !mMoGoPolyline.isVisible()) {
mMoGoPolyline.setVisible(true);
}
} else {
} else {
isExcept = true;
}
long drawEnd = SystemClock.elapsedRealtime();
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "drawTrajectoryList cost : " + (drawEnd - drawStart) + "ms and isExcept:" + isExcept);
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "drawTrajectoryList cost : " + (drawEnd - drawStart) + "ms and isExcept:" + isExcept + "::removeCount:" + removeCount + "::total:" + total);
} catch (Throwable t) {
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "drawTrajectoryList error (isExcept: "+isExcept+") : " + t);
} finally {