[RoutingOpt]切换到CallerLogger
This commit is contained in:
@@ -4,14 +4,10 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_OLD
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.deva.scene.SceneModule;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
@@ -22,18 +18,12 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant;
|
||||
import com.mogo.module.common.utils.DrivingDirectionUtils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
@@ -119,13 +109,13 @@ public class MogoRouteOverlayManager implements
|
||||
trajectoryMsg.append(lat).append(",");
|
||||
}
|
||||
trajectoryMsg.append("}");
|
||||
Log.d(M_OLD_ROUTE + TAG, "receive router data:" + items.size());
|
||||
Log.d(M_OLD_ROUTE + TAG, trajectoryMsg.toString());
|
||||
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "receive router data:" + items.size());
|
||||
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, trajectoryMsg.toString());
|
||||
} else {
|
||||
Log.d(M_OLD_ROUTE + TAG, "receive router data:" + items.size());
|
||||
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "receive router data:" + items.size());
|
||||
}
|
||||
} finally {
|
||||
Log.d(M_OLD_ROUTE + TAG, "--- onAutopilotTrajectory -- cost:" + (SystemClock.elapsedRealtime() - start) + " ms");
|
||||
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "--- onAutopilotTrajectory -- cost:" + (SystemClock.elapsedRealtime() - start) + " ms");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +201,7 @@ public class MogoRouteOverlayManager implements
|
||||
if (isExcept) {
|
||||
RouteOverlayDrawer.getInstance(mContext).setVisible(false);
|
||||
}
|
||||
Log.d(M_OLD_ROUTE + TAG, "--- onLocationChanged -- cost:" + (SystemClock.elapsedRealtime() - start) + " ms");
|
||||
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "--- onLocationChanged -- cost:" + (SystemClock.elapsedRealtime() - start) + " ms");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import android.graphics.Color;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import androidx.core.util.Pools;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
@@ -159,15 +158,16 @@ public class RouteOverlayDrawer {
|
||||
public void run() {
|
||||
LinkedList<MogoLatLng> points = this.points;
|
||||
points.clear();
|
||||
boolean isExcept = false;
|
||||
try {
|
||||
long drawStart = SystemClock.elapsedRealtime();
|
||||
List<MessagePad.TrajectoryPoint> routes = this.routeList;
|
||||
if (routes == null || routes.size() < 2) {
|
||||
setVisible(false);
|
||||
int total;
|
||||
if (routes == null || (total = routes.size()) < 2) {
|
||||
isExcept = true;
|
||||
return;
|
||||
}
|
||||
int total = routes.size();
|
||||
for (int i = 0; i < total ; i++) {
|
||||
for (int i = 0; i < total; i++) {
|
||||
MessagePad.TrajectoryPoint route = null;
|
||||
try {
|
||||
route = routes.get(i);
|
||||
@@ -175,7 +175,7 @@ public class RouteOverlayDrawer {
|
||||
continue;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
Log.d(M_OLD_ROUTE + TAG, "render-error:" + t.getMessage());
|
||||
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "render-error:" + t.getMessage());
|
||||
}
|
||||
if (route == null) {
|
||||
//数组越界了,结束循环
|
||||
@@ -196,13 +196,13 @@ public class RouteOverlayDrawer {
|
||||
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);
|
||||
MogoLatLng top = null;
|
||||
int remove = 0;
|
||||
long angle;
|
||||
while (i++ < max) {
|
||||
MogoLatLng first = points.peek();
|
||||
@@ -214,53 +214,10 @@ public class RouteOverlayDrawer {
|
||||
}
|
||||
angle = isPointOnCarFront(lon, lat, location.getBearing(), first.lon, first.lat);
|
||||
if (angle >= 90) {
|
||||
Log.d(M_OLD_ROUTE + TAG, "render - removeCount:" + (++remove));
|
||||
points.poll();
|
||||
}
|
||||
top = first;
|
||||
}
|
||||
//distance
|
||||
// if (top != null) {
|
||||
// double distance = DrivingDirectionUtils.distance(top.lon, top.lat, lon, lat) * 10_0000;
|
||||
// angle = isPointOnCarFront(lon, lat, location.getBearing(), top.lon, top.lat);
|
||||
// Log.d(M_OLD_ROUTE + TAG, "render - distance:" + distance + ",angle:" + angle);
|
||||
// if (distance > 4.0 && angle >= 80) {
|
||||
// float bearing = location.getBearing();
|
||||
// Pair<Double, Double> p_car_f = DrivingDirectionUtils.calculateNewPoint(lon, lat, bearing, 5);
|
||||
// Pair<Double, Double> p_rout_f = DrivingDirectionUtils.calculateNewPoint(top.lon, top.lat, bearing, 5);
|
||||
// if (p_car_f != null && p_rout_f != null) {
|
||||
// Stack<MogoLatLng> stack = new Stack<>();
|
||||
// stack.add(new MogoLatLng(p_car_f.second, p_car_f.first));
|
||||
// double new_bear = bearing + 90;
|
||||
// while (distance > 0.1) {
|
||||
// distance /= 2;
|
||||
// Pair<Double, Double> p = DrivingDirectionUtils.calculateNewPoint(p_car_f.first, p_car_f.second, new_bear, distance);
|
||||
// if (p == null) {
|
||||
// break;
|
||||
// }
|
||||
// stack.push(new MogoLatLng(p.second, p.first));
|
||||
// }
|
||||
// Log.d("XXXX", "----stack:" + stack.size());
|
||||
// long newAngle = DrivingDirectionUtils.getDegreeOfCar2Poi2(p_rout_f.first, p_rout_f.second, top.lon, top.lat, bearing);
|
||||
// Log.d("XXXX", "----newAngle:" + newAngle);
|
||||
// while (newAngle > 90) {
|
||||
// Log.d("XXXX", "----newAngle:" + newAngle);
|
||||
// points.poll();
|
||||
// MogoLatLng peek = points.peek();
|
||||
// if (peek == null) {
|
||||
// points.poll();
|
||||
// continue;
|
||||
// }
|
||||
// newAngle = DrivingDirectionUtils.getDegreeOfCar2Poi2(p_rout_f.first, p_rout_f.second, peek.lon, peek.lat, bearing);
|
||||
// }
|
||||
// while (!stack.isEmpty()) {
|
||||
// MogoLatLng pop = stack.pop();
|
||||
// points.addFirst(pop);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
MogoLatLng self = pools.acquire();
|
||||
if (self == null) {
|
||||
self = new MogoLatLng(lat, lon);
|
||||
@@ -280,15 +237,16 @@ public class RouteOverlayDrawer {
|
||||
mMoGoPolyline.setVisible(true);
|
||||
}
|
||||
} else {
|
||||
if(mMoGoPolyline != null) {
|
||||
mMoGoPolyline.setVisible(false);
|
||||
}
|
||||
isExcept = true;
|
||||
}
|
||||
long drawEnd = SystemClock.elapsedRealtime();
|
||||
Log.d(M_OLD_ROUTE + TAG, "drawTrajectoryList cost : " + (drawEnd - drawStart));
|
||||
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "drawTrajectoryList cost : " + (drawEnd - drawStart) + "ms and isExcept:" + isExcept);
|
||||
} catch (Throwable t) {
|
||||
Log.d(M_OLD_ROUTE + TAG, "drawTrajectoryList error : " + t);
|
||||
CallerLogger.INSTANCE.d(M_OLD_ROUTE + TAG, "drawTrajectoryList error (isExcept: "+isExcept+") : " + t);
|
||||
} finally {
|
||||
if (isExcept) {
|
||||
setVisible(false);
|
||||
}
|
||||
if (points.size() > 0) {
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
MogoLatLng latLng = points.get(i);
|
||||
|
||||
Reference in New Issue
Block a user