[RoutingOpt]移除最小移除点数限制
[RoutingOpt]移除最小移除点数限制 [RoutingOpt]逻辑优化
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user