change the callerlogger
This commit is contained in:
@@ -8,14 +8,14 @@ import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.map.collect.IMoGoMapDataCollectProvider
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.zhidaoauto.map.operational.open.GatherApi
|
||||
import com.zhidaoauto.map.operational.open.GatherParams
|
||||
import com.zhidaoauto.map.operational.open.GatherParams.Companion
|
||||
import com.zhidaoauto.map.operational.open.abs.OnTaskListener
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
@@ -40,7 +40,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
ConcurrentHashMap()
|
||||
}
|
||||
|
||||
override val functionName: String = TAG
|
||||
override val functionName: String = "$M_MAP$TAG"
|
||||
|
||||
@Volatile
|
||||
private var hasInit = false
|
||||
@@ -60,20 +60,20 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
executor.get()?.setCarSn(carSn)
|
||||
}
|
||||
MoGoAiCloudClient.getInstance().addTokenCallbacks(this)
|
||||
Logger.d(TAG, "--------- init --------")
|
||||
Logger.d(TAG, "executor: ${ executor.get()?.hashCode() ?: 0 }")
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- init --------")
|
||||
CallerLogger.d("$M_MAP$TAG", "executor: ${ executor.get()?.hashCode() ?: 0 }")
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
CallerMapLocationListenerManager.removeListener(TAG)
|
||||
Logger.d(TAG, "--------- onDestroy --------")
|
||||
CallerMapLocationListenerManager.removeListener("$M_MAP$TAG")
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- onDestroy --------")
|
||||
executor.get()?.setOnTaskListener(null)
|
||||
listeners.clear()
|
||||
map.clear()
|
||||
}
|
||||
|
||||
override fun registerOnMapCollectTaskListener(listener: IMoGoMapDataCollectProvider.OnMapCollectCmdListener?) {
|
||||
Logger.d(TAG, "--------- registerOnMapCollectTaskListener --------")
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- registerOnMapCollectTaskListener --------")
|
||||
listener ?: return
|
||||
if (listeners.contains(listener)) {
|
||||
return
|
||||
@@ -82,7 +82,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
}
|
||||
|
||||
override fun unRegisterOnMapCollectTaskListener(listener: IMoGoMapDataCollectProvider.OnMapCollectCmdListener?) {
|
||||
Logger.d(TAG, "--------- unRegisterOnMapCollectTaskListener --------")
|
||||
CallerLogger.d("$M_MAP$TAG", "--------- unRegisterOnMapCollectTaskListener --------")
|
||||
listener ?: return
|
||||
if (!listeners.contains(listener)) {
|
||||
return
|
||||
@@ -97,40 +97,40 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
videoPath: String,
|
||||
reason: String
|
||||
) {
|
||||
Logger.d(TAG, "-- finish:[$id, $state, $gpsPath, $videoPath, $reason]")
|
||||
CallerLogger.d("$M_MAP$TAG", "-- finish:[$id, $state, $gpsPath, $videoPath, $reason]")
|
||||
try {
|
||||
if (isInValidStatus()) {
|
||||
Logger.w(TAG, "-- finish: 状态无效")
|
||||
CallerLogger.w("$M_MAP$TAG", "-- finish: 状态无效")
|
||||
return
|
||||
}
|
||||
if (!map.containsKey(id)) {
|
||||
Logger.w(TAG, "-- finish: 无相关指令")
|
||||
CallerLogger.w("$M_MAP$TAG", "-- finish: 无相关指令")
|
||||
return
|
||||
}
|
||||
Logger.d(TAG, "-- finish: 结束任务[$id]")
|
||||
CallerLogger.d("$M_MAP$TAG", "-- finish: 结束任务[$id]")
|
||||
executor.get()?.finishTask(id, state, gpsPath, videoPath, reason)
|
||||
} catch (e : Throwable) {
|
||||
e.printStackTrace()
|
||||
Logger.e(TAG, "-- finish:\n$e");
|
||||
CallerLogger.e("$M_MAP$TAG", "-- finish:\n$e")
|
||||
} finally {
|
||||
map[id] = Status.FINISH
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTaskFinish(id: Int, time: Long) {
|
||||
Logger.d(TAG, "地图模块下发结束采集指令 -> [$id, $time]")
|
||||
CallerLogger.d("$M_MAP$TAG", "地图模块下发结束采集指令 -> [$id, $time]")
|
||||
if (!map.containsKey(id) || map[id] == Status.FINISH) {
|
||||
Logger.w(TAG, "地图模块下发结束采集指令 -> 任务[$id]已经提前完成,无需再次请求自动驾驶模块结束采集")
|
||||
CallerLogger.w("$M_MAP$TAG", "地图模块下发结束采集指令 -> 任务[$id]已经提前完成,无需再次请求自动驾驶模块结束采集")
|
||||
return
|
||||
}
|
||||
Logger.d(TAG, "地图模块下发结束采集指令 -> [$id, $time] -> 调用自动驾驶模块,结束数据采集")
|
||||
CallerLogger.d("$M_MAP$TAG", "地图模块下发结束采集指令 -> [$id, $time] -> 调用自动驾驶模块,结束数据采集")
|
||||
listeners.forEach {
|
||||
it.onMapCollectEnd(id, time)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTaskStart(id: Int, time: Long) {
|
||||
Logger.d(TAG, "地图模块下发开始采集指令 -> [$id, $time]")
|
||||
CallerLogger.d("$M_MAP$TAG", "地图模块下发开始采集指令 -> [$id, $time]")
|
||||
map[id] = Status.INIT
|
||||
listeners.forEach {
|
||||
it.onMapCollectStart(id, time)
|
||||
@@ -142,7 +142,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
if (!hasInit) {
|
||||
executor.get()?.also {
|
||||
hasInit = true
|
||||
Logger.d(TAG, "告之地图sdk,定义数据可以用了")
|
||||
CallerLogger.d("$M_MAP$TAG", "告之地图sdk,定义数据可以用了")
|
||||
it.setIsInit()
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
|
||||
}
|
||||
|
||||
override fun onTokenGot(token: String?, sn: String?) {
|
||||
Logger.d(TAG, "-- onTokenGot --> $sn")
|
||||
CallerLogger.d("$M_MAP$TAG", "-- onTokenGot --> $sn")
|
||||
sn?.let {
|
||||
executor.get()?.setCarSn(it)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoUiSettings;
|
||||
import com.mogo.map.MogoMapView;
|
||||
@@ -35,7 +34,7 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
private MogoMapView mMogoMapView;
|
||||
private IMogoMap mMogoMap;
|
||||
|
||||
private boolean mIsControllerByOthersStatus = false;
|
||||
private final boolean mIsControllerByOthersStatus = false;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -96,7 +95,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
@Override
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
Logger.d( TAG, "onActivityCreated" );
|
||||
initMapView();
|
||||
}
|
||||
|
||||
@@ -236,8 +234,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
angle = 16.5f;
|
||||
}
|
||||
return angle;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAP;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -32,11 +33,11 @@ import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils;
|
||||
import com.mogo.eagle.core.function.smp.view.ISmallMapDirectionView;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.widget.RoundLayout;
|
||||
import com.mogo.module.common.utils.DrivingDirectionUtils;
|
||||
|
||||
@@ -64,8 +65,8 @@ public class SmallMapDirectionView
|
||||
private Marker mEndMarker;
|
||||
|
||||
private int zoomLevel = 15;
|
||||
private List<LatLng> mCoordinatesLatLng = new ArrayList<>();
|
||||
private List<MogoLatLng> mCoordinatesLatLngCurrent = new ArrayList<>();
|
||||
private final List<LatLng> mCoordinatesLatLng = new ArrayList<>();
|
||||
private final List<MogoLatLng> mCoordinatesLatLngCurrent = new ArrayList<>();
|
||||
private Polyline mPolyline;
|
||||
private CameraUpdate mCameraUpdate;
|
||||
private Context mContext;
|
||||
@@ -88,11 +89,10 @@ public class SmallMapDirectionView
|
||||
}
|
||||
|
||||
private void initView(Context context) {
|
||||
Logger.d(TAG, "initView");
|
||||
mContext = context;
|
||||
View smpView = LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
|
||||
|
||||
mAMapNaviView = (TextureMapView) smpView.findViewById(R.id.aMapNaviView);
|
||||
mAMapNaviView = smpView.findViewById(R.id.aMapNaviView);
|
||||
// rlSmallMapBorder = findViewById(R.id.rlSmallMapBorder);
|
||||
// rlSmallMapBorder.addView(mAMapNaviView);
|
||||
|
||||
@@ -141,19 +141,16 @@ public class SmallMapDirectionView
|
||||
uiSettings.setAllGesturesEnabled(false);// 所有手势
|
||||
uiSettings.setMyLocationButtonEnabled(false); // 显示默认的定位按钮
|
||||
uiSettings.setLogoBottomMargin(-150); //设置Logo下边界距离屏幕底部的边距,设置为负值即可
|
||||
mAMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() {
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
Logger.d(TAG, "smp---onMapLoaded");
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext()))
|
||||
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext()));
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions);
|
||||
mAMapNaviView.getMap().setPointToCenter(mAMapNaviView.getWidth() / 2, mAMapNaviView.getHeight() / 2);
|
||||
}
|
||||
mAMap.setOnMapLoadedListener(() -> {
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, "smp---onMapLoaded");
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions1 = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext()))
|
||||
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext()));
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions1);
|
||||
mAMapNaviView.getMap().setPointToCenter(mAMapNaviView.getWidth() / 2, mAMapNaviView.getHeight() / 2);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -166,8 +163,7 @@ public class SmallMapDirectionView
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@Nullable MogoLocation location) {
|
||||
//Logger.d(TAG, "onCarLocationChanged2 :" + location.getLatitude()+":"+location.getLongitude());
|
||||
if (location == null){
|
||||
if (location == null) {
|
||||
return;
|
||||
}
|
||||
LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
@@ -192,15 +188,13 @@ public class SmallMapDirectionView
|
||||
// 与结束位置进行 GeoHash 0-12
|
||||
// GeoHash endGeoHash = GeoHash.withCharacterPrecision(endLatLng.latitude, endLatLng.longitude, 7);
|
||||
// GeoHash currentGeoHash = GeoHash.withCharacterPrecision(currentLatLng.latitude, currentLatLng.longitude, 7);
|
||||
// Log.d(MODULE_NAME, "currentGeoHash=" + currentGeoHash);
|
||||
// Log.d(MODULE_NAME, "endGeoHash=" + endGeoHash);
|
||||
|
||||
float calculateDistance = CoordinateUtils.calculateLineDistance(
|
||||
endLatLng.latitude, endLatLng.longitude,
|
||||
currentLatLng.latitude, currentLatLng.longitude
|
||||
);
|
||||
|
||||
Log.d(TAG, "calculateDistance=" + calculateDistance);
|
||||
CallerLogger.INSTANCE.d(M_MAP + TAG, "calculateDistance=" + calculateDistance);
|
||||
if (calculateDistance <= 5) {
|
||||
clearPolyline();
|
||||
mCoordinatesLatLng.clear();
|
||||
@@ -214,7 +208,7 @@ public class SmallMapDirectionView
|
||||
mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
}
|
||||
|
||||
private void removeLoction(Location latLng) {
|
||||
private void removeLocation(Location latLng) {
|
||||
for (LatLng l : mCoordinatesLatLng) {
|
||||
if (!isPointOnCarFront(latLng, l)) {
|
||||
mCoordinatesLatLng.remove(l);
|
||||
@@ -233,11 +227,7 @@ public class SmallMapDirectionView
|
||||
int diffAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
carLon, carLat, poiLon, poiLat, (int) carAngle);
|
||||
|
||||
if (diffAngle <= 90) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return diffAngle <= 90;
|
||||
}
|
||||
|
||||
|
||||
@@ -249,7 +239,6 @@ public class SmallMapDirectionView
|
||||
// mCoordinatesLatLng.addAll(latLngs);
|
||||
// for (LatLng coordinate : mCoordinatesLatLng) {
|
||||
// mCoordinatesLatLng.add(new LatLng(coordinate.getLat(), coordinate.getLon()));
|
||||
// Log.e("",coordinate.latitude+":"+coordinate.longitude);
|
||||
// }
|
||||
if (mAMap != null) {
|
||||
if (mCoordinatesLatLng.size() > 2) {
|
||||
@@ -288,8 +277,7 @@ public class SmallMapDirectionView
|
||||
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
|
||||
mCoordinateConverter.coord(new LatLng(mogoLatLng.lat, mogoLatLng.lon));
|
||||
LatLng latLng = mCoordinateConverter.convert();
|
||||
return latLng;
|
||||
return mCoordinateConverter.convert();
|
||||
}
|
||||
|
||||
public List<LatLng> CoordinateConverterFrom84ForList(Context mContext, List<MogoLatLng> mogoLatLngList) {
|
||||
@@ -315,7 +303,7 @@ public class SmallMapDirectionView
|
||||
}
|
||||
}
|
||||
|
||||
public void resetPolyine() {
|
||||
public void resetPolyLine() {
|
||||
mCoordinatesLatLng.clear();
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
@@ -166,7 +165,6 @@ public class SmallMapFragment extends BaseFragment
|
||||
for (MessagePad.Location routeModel : globalPathResp.getWayPointsList()) {
|
||||
latLngList.add(new MogoLatLng(routeModel.getLatitude(), routeModel.getLongitude()));
|
||||
}
|
||||
Log.e(TAG, "routeResult:" + latLngList.size());
|
||||
if (latLngList.size() > 0) {
|
||||
drawablePolyline(latLngList);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user