[Log]日志统一使用CallerLogger

This commit is contained in:
renwj
2022-03-22 19:23:06 +08:00
parent 229debcd4b
commit fd4059cb81
6 changed files with 62 additions and 47 deletions

View File

@@ -175,36 +175,37 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onRoadIdInfo(@androidx.annotation.Nullable String roadId) {
if (!TextUtils.isEmpty(roadId)) {
Log.d(TAG, "-- onRoadIdInfo --RoadId:" + roadId);
if (roadId != null && !TextUtils.isEmpty(roadId)) {
CallerLogger.INSTANCE.d("${M_DEVA}${TAG}", "onRoadIdInfo::" + roadId);
CallerMapRoadListenerManager.INSTANCE.invokeListenersOnRoadIdGet(roadId);
} else {
CallerLogger.INSTANCE.d("${M_DEVA}${TAG}", "onRoadIdInfo::null");
}
}
@Override
public void onStopLineInfo(@androidx.annotation.Nullable StopLine stopLine) {
Log.d(TAG, "-- onStopLineInfo -- 1 --:" + (stopLine != null ? stopLine.toString() : null) + "-> road_id:" + mRoadId);
MogoLocation carLoc = CallerMapLocationListenerManager.INSTANCE.getCurrentLocation();
if (stopLine != null && !TextUtils.isEmpty(stopLine.road_id) && stopLine.points != null && stopLine.points.size() > 0) {
ArrayList<LonLatPoint> points = stopLine.points;
if (carLoc != null) {
CallerLogger.INSTANCE.d("${M_DEVA}${TAG}", "onStopLineInfo:stop_line" + stopLine + ", car_loc:{lon: " + carLoc.getLatitude() + ", lat: " + carLoc.getLongitude() + "}");
MapRoadInfo.StopLine stopInfo = convert(stopLine);
LonLatPoint match = new LonLatPoint();
double ret = MapDataApi.INSTANCE.GetDisFromPointToLine(convert(carLoc), points, match, 1);
Log.d(TAG, "-- onStopLineInfo --- ret: "+ ret);
double distanceOfCarToStopLine = -1.0;
if (Double.compare(ret, -1.0) != 0) {
distanceOfCarToStopLine = MapTools.INSTANCE.distance(carLoc.getLatitude(), carLoc.getLongitude(), match.getLatitude(), match.getLongitude());
stopInfo.setDistanceOfCarToStopLine(distanceOfCarToStopLine);
} else {
LonLatPoint p1 = points.get(0);
LonLatPoint p2 = points.get(points.size() - 1);
distanceOfCarToStopLine = MapDataApi.INSTANCE.getNearstFromPointToSegment(carLoc.getLongitude(), carLoc.getLatitude(), p1.longitude, p1.latitude, p2.longitude, p2.latitude);
stopInfo.setDistanceOfCarToStopLine(distanceOfCarToStopLine);
}
Log.d(TAG, "-- onStopLineInfo --- distance: "+ distanceOfCarToStopLine);
CallerLogger.INSTANCE.d("${M_DEVA}${TAG}", "onStopLineInfo: --- ret: "+ ret);
LonLatPoint p1 = points.get(0);
LonLatPoint p2 = points.get(points.size() - 1);
double distanceOfCarToStopLine = MapDataApi.INSTANCE.getNearstFromPointToSegment(carLoc.getLongitude(), carLoc.getLatitude(), p1.longitude, p1.latitude, p2.longitude, p2.latitude);
stopInfo.setDistanceOfCarToStopLine(distanceOfCarToStopLine);
CallerLogger.INSTANCE.d("${M_DEVA}${TAG}", "onStopLineInfo: --- distance: "+ distanceOfCarToStopLine);
CallerMapRoadListenerManager.INSTANCE.invokeListenersOnStopLineGet(stopInfo);
}
} else {
if (carLoc != null) {
CallerLogger.INSTANCE.d("${M_DEVA}${TAG}", "onStopLineInfo::null, car_loc:{lon: " + carLoc.getLatitude() + ", lat: " + carLoc.getLongitude() + "}");
}
}
}