change the callerlogger

This commit is contained in:
zhongchao
2022-03-14 21:50:11 +08:00
parent e19ff59a89
commit 6102e55ed3
1315 changed files with 4162 additions and 61965 deletions

View File

@@ -1,6 +1,8 @@
package com.mogo.map.impl.custom;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import static com.mogo.map.marker.MarkerType.MAP_STATIC;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.impl.custom.marker.AMapMarkerWrapper;
import com.mogo.map.impl.custom.marker.MarkerWrapperClickHelper;
import com.mogo.map.marker.IMogoMarker;
@@ -11,8 +13,6 @@ import com.zhidaoauto.map.sdk.open.marker.Marker;
import java.util.Map;
import static com.mogo.map.marker.MarkerType.MAP_STATIC;
/**
* @author congtaowang
* @since 2019-12-24
@@ -51,10 +51,10 @@ public class AMapMarkerClickHandler {
return false;
}
//地图道路上静态数暂时只过滤traffic类型下发点击事件
if (MarkerWrapperClickHelper.getInstance().isStaticMarker(marker.getId())){
IMogoMarker iMogoMarker = new AMapMarkerWrapper(marker,new MogoMarkerOptions());
if (MarkerWrapperClickHelper.getInstance().isStaticMarker(marker.getId())) {
IMogoMarker iMogoMarker = new AMapMarkerWrapper(marker, new MogoMarkerOptions());
iMogoMarker.setOwner(MAP_STATIC); //TODO 后续可能由于类型比较多需要owner匹配机制,以及控制owner细粒度
Logger.d("AMapMarkerWrapper", "traffic marker 点击回调");
CallerLogger.INSTANCE.d("AMapMarkerWrapper", "traffic marker 点击回调");
return MogoMarkersHandler.getInstance().onStaticMarkerClicked(iMogoMarker);
}
@@ -62,7 +62,7 @@ public class AMapMarkerClickHandler {
if (mogoMarkerMap.containsKey(marker.getId())) {
IMogoMarker mogoMarker = mogoMarkerMap.get(marker.getId());
final IMogoMarkerClickListener listener = mogoMarker.getOnMarkerClickListener();
Logger.d("AMapMarkerWrapper", "marker 点击回调%s -> %s", mogoMarker, marker);
CallerLogger.INSTANCE.d("AMapMarkerWrapper", "marker 点击回调 mogoMarker " + mogoMarker + ", marker :" + marker);
if (listener != null) {
boolean result = listener.onMarkerClicked(mogoMarker);
if (result) {

View File

@@ -19,7 +19,6 @@ import android.view.View;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
@@ -27,7 +26,7 @@ import com.mogo.eagle.core.function.call.map.CallerLocationUpdaterManager;
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager;
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapStyleListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
@@ -117,7 +116,7 @@ public class AMapViewWrapper implements IMogoMapView,
public AMapViewWrapper(MapAutoView mMapView) {
startTime = System.currentTimeMillis();
Logger.i(TAG, "autoop--AMapViewWrapper: init");
CallerLogger.INSTANCE.i(TAG, "autoop--AMapViewWrapper: init");
this.mMapView = mMapView;
initViews();
initListeners();
@@ -160,7 +159,7 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.setOnCameraChangeListener(this);
mMapView.setOnMapStyleListener(this);
mMapView.setOnMapViewVisualAngleChangeListener(this);
Logger.d(TAG, "styleop - initListeners - setOnMapStyleListener - view %s", mMapView);
CallerLogger.INSTANCE.d(TAG, "styleop - initListeners - setOnMapStyleListener - view " + mMapView);
}
private Context getContext() {
@@ -181,7 +180,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onCreate(Bundle bundle) {
if (mMapView != null) {
mMapView.onCreate(bundle);
Logger.d(TAG, "map onCreate");
CallerLogger.INSTANCE.d(TAG, "map onCreate");
}
}
@@ -189,7 +188,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onResume() {
if (mMapView != null) {
mMapView.onResume();
Logger.d(TAG, "map onResume");
CallerLogger.INSTANCE.d(TAG, "map onResume");
}
}
@@ -197,7 +196,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onPause() {
if (mMapView != null) {
mMapView.onPause();
Logger.d(TAG, "map onPause");
CallerLogger.INSTANCE.d(TAG, "map onPause");
}
}
@@ -211,7 +210,7 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.setOnMapClickListener(null);
mMapView.getLocationClient().unRegisterListener(this);
mMapView.setOnCameraChangeListener(null);
Logger.d(TAG, "map onDestroy");
CallerLogger.INSTANCE.d(TAG, "map onDestroy");
}
}
@@ -219,7 +218,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onSaveInstanceState(Bundle outState) {
if (mMapView != null) {
mMapView.onSaveInstanceState(outState);
Logger.d(TAG, "map onSaveInstanceState");
CallerLogger.INSTANCE.d(TAG, "map onSaveInstanceState");
}
}
@@ -270,9 +269,9 @@ public class AMapViewWrapper implements IMogoMapView,
if (mCurrentUI == EnumMapUI.Type_VR) {
return MapControlResult.ERROR;
}
Logger.d(TAG, "changeZoom %s", zoom);
CallerLogger.INSTANCE.d(TAG, "changeZoom : " + zoom);
if (DebugConfig.isDebug()) {
Logger.d(TAG, Log.getStackTraceString(new Throwable()));
CallerLogger.INSTANCE.d(TAG, Log.getStackTraceString(new Throwable()));
}
getMap().changeZoom(zoom);
return MapControlResult.SUCCESS;
@@ -284,7 +283,7 @@ public class AMapViewWrapper implements IMogoMapView,
return;
}
Logger.d(TAG, "设置的样式 = %s", ui);
CallerLogger.INSTANCE.d(TAG, "设置的样式 :" + ui);
if (checkAMapView()) {
mMapView.getMapAutoViewHelper().setScaleVRMode(true);
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR);
@@ -321,11 +320,11 @@ public class AMapViewWrapper implements IMogoMapView,
public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) {
MapAutoViewHelper mapAutoViewHelper = mMapView.getMapAutoViewHelper();
if (mapAutoViewHelper != null) {
Logger.d(TAG, " 用户更改视距 currentThread : " + Thread.currentThread().getName());
CallerLogger.INSTANCE.d(TAG, " 用户更改视距 currentThread : " + Thread.currentThread().getName());
mVisualAngleMode = angelMode;
if (angelMode == MODE_CLOSE_SIGHT) {
if (mogoLatLng == null) {
Logger.e(TAG, "切换地图近景需要传入要移动的经纬度数据");
CallerLogger.INSTANCE.e(TAG, "切换地图近景需要传入要移动的经纬度数据");
return;
}
// 近景传入经纬度为点击地图上静态marker经纬度数据为GPS坐标点。
@@ -348,7 +347,7 @@ public class AMapViewWrapper implements IMogoMapView,
private boolean checkAMapView() {
if (mMapView == null || mMapView.getMapAutoViewHelper() == null) {
Logger.e(TAG, "自研mapView实例为空请检查");
CallerLogger.INSTANCE.e(TAG, "自研mapView实例为空请检查");
return false;
}
return true;
@@ -356,13 +355,13 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void moveToCenter(MogoLatLng latLng, boolean animate) {
Logger.d(TAG, "move to center %s", latLng);
CallerLogger.INSTANCE.d(TAG, "move to center " + latLng);
if (latLng == null || latLng.lat == 0.0d || latLng.lon == 0.0d) {
Logger.e(TAG, "latlng = null or is illegal");
CallerLogger.INSTANCE.e(TAG, "latlng = null or is illegal");
return;
}
if (DebugConfig.isDebug()) {
Logger.d(TAG, Log.getStackTraceString(new Throwable()));
CallerLogger.INSTANCE.d(TAG, Log.getStackTraceString(new Throwable()));
}
loseLockMode();
mMapView.getMapAutoViewHelper().animateCamera(new LonLatPoint(latLng.lon, latLng.lat));
@@ -370,7 +369,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void showMyLocation(boolean visible) {
Logger.d(TAG, "showMyLocation1 %s", visible);
CallerLogger.INSTANCE.d(TAG, "showMyLocation1 " + visible);
// 如果是VR模式
if (mCurrentUI == EnumMapUI.Type_VR) {
return;
@@ -388,9 +387,8 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void showMyLocation(View view) {
Logger.d(TAG, "showMyLocation %s", "view");
if (DebugConfig.isDebug()) {
Logger.d(TAG, Log.getStackTraceString(new Throwable()));
CallerLogger.INSTANCE.d(TAG, Log.getStackTraceString(new Throwable()));
}
if (checkAMapView()) {
MyLocationStyle style = mMapView.getMapAutoViewHelper().getMyLocationStyle();
@@ -419,7 +417,7 @@ public class AMapViewWrapper implements IMogoMapView,
if (mCurrentUI == EnumMapUI.Type_VR) {
return;
}
Logger.d(TAG, "锁车");
CallerLogger.INSTANCE.d(TAG, "锁车");
mMapView.getMapAutoViewHelper().setLockMode(true);
mIsCarLocked = true;
}
@@ -430,7 +428,7 @@ public class AMapViewWrapper implements IMogoMapView,
if (mCurrentUI == EnumMapUI.Type_VR) {
return;
}
Logger.d(TAG, "解锁锁车");
CallerLogger.INSTANCE.d(TAG, "解锁锁车");
mMapView.getMapAutoViewHelper().setLockMode(false);
mIsCarLocked = false;
}
@@ -491,7 +489,7 @@ public class AMapViewWrapper implements IMogoMapView,
if (mCurrentUI == EnumMapUI.Type_VR) {
return;
}
Logger.d(TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY);
CallerLogger.INSTANCE.d(TAG, "setPointToCenter x : " + mapCenterX + " y : " + mapCenterY);
mMapView.getMapAutoViewHelper().setPointToCenter((float) mapCenterX, (float) mapCenterY);
}
}
@@ -528,7 +526,7 @@ public class AMapViewWrapper implements IMogoMapView,
if (checkAMapView()) {
if (mMapView.getMapAutoViewHelper() != null) {
mMapView.getMapAutoViewHelper().setRenderFps(fps);
Logger.d(TAG, "设置刷新帧率 fps = %s", fps);
CallerLogger.INSTANCE.d(TAG, "设置刷新帧率 fps = " + fps);
}
}
}
@@ -539,10 +537,10 @@ public class AMapViewWrapper implements IMogoMapView,
return;
}
if (mCurrentUI == EnumMapUI.Type_VR) {
Logger.w(TAG, "vr 模式下忽略该设置");
CallerLogger.INSTANCE.w(TAG, "vr 模式下忽略该设置");
return;
}
Logger.i(TAG, "showBounds:%s -%s-%s- %b ", tag, carPosition.toString(), bound.toShortString(), lockCarPosition);
CallerLogger.INSTANCE.i(TAG, "showBounds : " + tag + " , " + carPosition.toString() + " , " + bound.toShortString() + " , " + lockCarPosition);
try {
LatLngBounds latLngBounds = MogoMapUtils.getLatLngBounds(carPosition, lonLats, lockCarPosition);
if (!lockCarPosition) {
@@ -551,7 +549,7 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.getMapAutoViewHelper().setCenter(ObjectUtils.fromMogo(carPosition));
mMapView.getMapAutoViewHelper().moveCamera(CameraUpdateFactory.INSTANCE.newLatLngBounds(latLngBounds, bound.left, bound.right, bound.top, bound.bottom));
} catch (Exception e) {
Logger.e(TAG, e, "%s error.", tag);
CallerLogger.INSTANCE.e(TAG, "tag : " + tag + " error : " + e);
}
}
@@ -695,14 +693,14 @@ public class AMapViewWrapper implements IMogoMapView,
if (!mIsDelayed) {
mIsDelayed = true;
UiThreadHandler.postDelayed(() -> {
//Logger.d(TAG, "倒计时结束");
//CallerLogger.INSTANCE.d(TAG, "倒计时结束");
mIsFirstLocated = false;
}, 5_000L);
}
} else {
mIsFirstLocated = true;
mIsDelayed = false;
Logger.d(TAG, "同步定位:" + GsonUtils.toJson(location));
CallerLogger.INSTANCE.d(TAG, "同步定位:" + GsonUtils.toJson(location));
MapStyleController.getInstance().onLocationChanged(location, this);
}
}
@@ -716,13 +714,13 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onMapInit() {
Logger.i(TAG, "autoop--onMapInit: ");
CallerLogger.INSTANCE.i(TAG, "autoop--onMapInit: ");
MogoMapListenerHandler.getInstance().onMapLoaded();
}
@Override
public void onMapLoaded() {
Logger.i(TAG, "autoop--onMapLoaded: ");
CallerLogger.INSTANCE.i(TAG, "autoop--onMapLoaded: ");
mMapLoaded = true;
CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition();
Trace.beginSection("timer.onCameraChangeFinish");
@@ -748,18 +746,18 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onRoadLoaded(@Nullable String s) {
Logger.i(TAG, "autoop--onMapLoaded: ");
CallerLogger.INSTANCE.i(TAG, "autoop--onMapLoaded: ");
}
@Override
public void onMapStatusChanged(int type, int value) {
//Logger.i(TAG, "mapop--onMapStatusChanged-: " + type + "," + value);
//CallerLogger.INSTANCE.i(TAG, "mapop--onMapStatusChanged-: " + type + "," + value);
}
@Override
public void onMapViewVisualAngleChange(int i) {
Logger.d(TAG, " 地图自动更改视距 currentThread : " + Thread.currentThread().getName());
CallerLogger.INSTANCE.d(TAG, " 地图自动更改视距 currentThread : " + Thread.currentThread().getName());
mVisualAngleMode = getVisualAngleMode(i);
MogoMapListenerHandler.getInstance().onMapVisualAngleChanged(mVisualAngleMode);
}
@@ -785,12 +783,12 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onCameraChange(int type, int value) {
//Logger.i(TAG, "mapop--onCameraChange-: " + type + "," + value);
//CallerLogger.INSTANCE.i(TAG, "mapop--onCameraChange-: " + type + "," + value);
}
@Override
public void onCameraChangeFinish(@Nullable CameraPosition cameraPosition) {
// Logger.i( TAG, "mapop--onCameraChangeFinish-: " + cameraPosition + "cost:" + ( System.currentTimeMillis() - startTime ) );
// CallerLogger.INSTANCE.i( TAG, "mapop--onCameraChangeFinish-: " + cameraPosition + "cost:" + ( System.currentTimeMillis() - startTime ) );
if (cameraPosition != null) {
Trace.beginSection("timer.onCameraChangeFinish");
MogoMapListenerHandler.getInstance().onMapChanged(ObjectUtils.fromAMap(cameraPosition.getTarget()),
@@ -810,7 +808,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onChangeMapStyle(int styleId) {
EnumMapUI last = mCurrentUI;
Logger.d(TAG, "currentMapStyle = %s", styleId);
CallerLogger.INSTANCE.d(TAG, "currentMapStyle = " + styleId);
if (styleId == MapAutoApi.MAP_STYLE_DAY
|| styleId == MapAutoApi.MAP_STYLE_DAY_NAV) {
@@ -825,7 +823,7 @@ public class AMapViewWrapper implements IMogoMapView,
}
if (last == mCurrentUI) {
Logger.d(TAG, "currentUI is same as last = %s", mCurrentUI);
CallerLogger.INSTANCE.d(TAG, "currentUI is same as last = " + mCurrentUI);
return;
}
@@ -836,11 +834,11 @@ public class AMapViewWrapper implements IMogoMapView,
return;
}
}
Logger.d(TAG, Log.getStackTraceString(new Throwable()));
CallerLogger.INSTANCE.d(TAG, Log.getStackTraceString(new Throwable()));
if (mCurrentUI != null) {
UiThreadHandler.post(() -> {
try {
Logger.d(TAG, "currentUI = %s", mCurrentUI);
CallerLogger.INSTANCE.d(TAG, "currentUI = " + mCurrentUI);
MogoMapListenerHandler.getInstance().onMapModeChanged(mCurrentUI);
CallerMapStyleListenerManager.INSTANCE.invokeMapStyleChange(styleId);
} catch (Exception e) {
@@ -862,12 +860,12 @@ public class AMapViewWrapper implements IMogoMapView,
public void onStyleAutoChanged(boolean isVrMode) {
if (isVrMode) {
if (mCurrentUI != EnumMapUI.Type_VR) {
Logger.d(TAG, "自动切换为vr模式");
CallerLogger.INSTANCE.d(TAG, "自动切换为vr模式");
changeMapMode(EnumMapUI.Type_VR);
}
} else {
if (mCurrentUI == EnumMapUI.Type_VR) {
Logger.d(TAG, "自动切换为2D模式");
CallerLogger.INSTANCE.d(TAG, "自动切换为2D模式");
if (mIsLightStyle) {
changeMapMode(EnumMapUI.Type_Light);
} else {
@@ -886,7 +884,7 @@ public class AMapViewWrapper implements IMogoMapView,
TipToast.shortTip(mRtkEnable ? "已开启rtk道路匹配" : "已开启gps道路匹配");
mMapView.getLocationClient().rtkEnable(mRtkEnable);
} catch (Exception e) {
Logger.e(TAG, e, "rtkEnable");
CallerLogger.INSTANCE.e(TAG, "rtkEnable has exception : " + e);
}
}
@@ -896,7 +894,7 @@ public class AMapViewWrapper implements IMogoMapView,
return;
}
if (data == null) {
Logger.d(TAG, "停止使用rtk定位数据");
CallerLogger.INSTANCE.d(TAG, "停止使用rtk定位数据");
return;
}
double lon = data.optDouble("lon", -1);
@@ -1006,13 +1004,11 @@ public class AMapViewWrapper implements IMogoMapView,
if (roadCache == null || roadCache == noCache) {
SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad(((float) wgs[0]), ((float) wgs[1]), ((float) angle), isGpsLocation, isRTK);
if (singlePointRoadInfo != null && singlePointRoadInfo.getCoords() != null && !singlePointRoadInfo.getCoords().isEmpty()) {
// Log.i("timer-matchRoad-4", "cost " + (System.currentTimeMillis() - start) + "ms roadId: " + singlePointRoadInfo.getRoadId());
roadCache = new RoadCacheWrapper(singlePointRoadInfo.getCoords());
roadCache.setLaneWidth(singlePointRoadInfo.getLaneWidth());
}
}
// Log.i("timer-matchRoad-1", "cost " + (System.currentTimeMillis() - start) + "ms");
if (roadCache != null
&& roadCache.getRoad() != null
&& !roadCache.getRoad().isEmpty()) {
@@ -1024,16 +1020,16 @@ public class AMapViewWrapper implements IMogoMapView,
if (matchThreshold > 0 && matchedPoint[2] > 0 && matchedPoint[2] <= matchThreshold) {
// 目标车在阈值范围内
roadCacheMap.put(id, roadCache);
// Logger.i("timer-matchRoad-3", "cost " + (System.currentTimeMillis() - start) + "ms");
// CallerLogger.INSTANCE.i("timer-matchRoad-3", "cost " + (System.currentTimeMillis() - start) + "ms");
return matchedPoint;
// Logger.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms roadId: "+roadCache.getLastLat());
// CallerLogger.INSTANCE.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms roadId: "+roadCache.getLastLat());
} else if (matchedPoint[2] > matchThreshold && matchedPoint[2] < 1.5) {
// 目标车在阈值范围外,也就是说距离道路中心线太远了,就不吸附了
return null;
} else {
// 目标车到道路中心线的映射点不在道路上也就是已经使出了缓存的那条道路需要重新获取一条道路用useCache这个参数来避免重复递归
roadCacheMap.put(id, noCache);
// Logger.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms roadId: " + roadCache.getLastLat());
// CallerLogger.INSTANCE.i("timer-matchRoad-2", "cost " + (System.currentTimeMillis() - start) + "ms roadId: " + roadCache.getLastLat());
if (usdCache) {
return matchRoad(id, lon, lat, angle, isGpsLocation, isRTK, false);
} else {

View File

@@ -3,8 +3,7 @@ package com.mogo.map.impl.custom;
import android.content.Context;
import android.graphics.Point;
import com.mogo.eagle.core.data.traffic.TrafficData;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.IMogoMap;
import com.mogo.map.IMogoUiSettings;
import com.mogo.map.impl.custom.marker.AMapInfoWindowAdapter;
@@ -55,7 +54,7 @@ public class AMapWrapper implements IMogoMap {
private IMogoUiSettings mUiSettings;
public AMapWrapper(MapAutoViewHelper map, MapAutoView mapView, IMogoMapUIController controller) {
Logger.i(TAG, "autoop--AMapWrapper: init" + this);
CallerLogger.INSTANCE.i(TAG, "autoop--AMapWrapper: init" + this);
this.mAMap = map;
sAMap = map;
this.mMapView = mapView;
@@ -87,13 +86,13 @@ public class AMapWrapper implements IMogoMap {
@Override
public IMogoMarker addMarker(String tag, MogoMarkerOptions options) {
//Logger.i(TAG, "autoop-addMarker: " + tag + ",MogoMarkerOptions:" + options + ",AMap:" + (mAMap != null) + ",this:" + this);
//CallerLogger.INSTANCE.i(TAG, "autoop-addMarker: " + tag + ",MogoMarkerOptions:" + options + ",AMap:" + (mAMap != null) + ",this:" + this);
if (!checkAMap()) {
return null;
}
MarkerOptions markerOptions = ObjectUtils.fromMogo(options);
if (markerOptions == null) {
Logger.e(TAG, "marker参数为空");
CallerLogger.INSTANCE.e(TAG, "marker参数为空");
return null;
}
final IMogoMarker mogoMarker = new AMapMarkerWrapper(mAMap.addMarker(markerOptions), options);
@@ -112,19 +111,19 @@ public class AMapWrapper implements IMogoMap {
for (MessagePad.TrackedObject mogoMarkerOptions : optionsArrayList) {
MarkerSimpleData markerOptions = ObjectUtils.fromTrafficData(mogoMarkerOptions);
if (markerOptions == null) {
Logger.e(TAG, "marker参数为空");
CallerLogger.INSTANCE.e(TAG, "marker参数为空");
break;
}
markerOptionsArrayList.add(markerOptions);
}
MarkerHelper.INSTANCE.updateBatchMarkerPositon(markerOptionsArrayList,false,8.0f,0,100);
MarkerHelper.INSTANCE.updateBatchMarkerPositon(markerOptionsArrayList, false, 8.0f, 0, 100);
}
@Override
public String addPreVehicleModel(int type, int modelRes) {
try {
return MarkerHelper.INSTANCE.addPreVehicleModel(type, modelRes);
return MarkerHelper.INSTANCE.addPreVehicleModel(type, modelRes);
} catch (Exception e) {
e.printStackTrace();
}
@@ -261,7 +260,7 @@ public class AMapWrapper implements IMogoMap {
@Override
public void changeZoom(float zoom) {
Logger.d(TAG, "changeZoom %s", zoom);
CallerLogger.INSTANCE.d(TAG, "changeZoom : " + zoom);
if (checkAMap()) {
mAMap.setZoom((int) zoom);
}
@@ -285,7 +284,7 @@ public class AMapWrapper implements IMogoMap {
public IMogoPolyline addPolyline(MogoPolylineOptions options) {
if (checkAMap()) {
PolylineOptions polylineOptions = ObjectUtils.fromMogo(options);
Logger.d(TAG, "addPolyline %s", polylineOptions.toString());
CallerLogger.INSTANCE.d(TAG, "addPolyline :" + polylineOptions.toString());
if (polylineOptions == null) {
return null;
}
@@ -309,7 +308,7 @@ public class AMapWrapper implements IMogoMap {
mAMap = mMapView.getMapAutoViewHelper();
sAMap = mAMap;
if (mAMap == null) {
Logger.e(TAG, "自研map实例为空请检查");
CallerLogger.INSTANCE.e(TAG, "自研map实例为空请检查");
return false;
}
return true;

View File

@@ -1,10 +1,9 @@
package com.mogo.map.impl.custom;
import android.content.Context;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.IMogoMapApiBuilder;
import com.mogo.map.IMogoMapView;
import com.mogo.map.MapApiPath;
@@ -56,7 +55,7 @@ public class CustomMapApiBuilder implements IMogoMapApiBuilder {
@Override
public IMogoMapView getMapView(Context context) {
Log.d(TAG, "setDebugMode==true");
CallerLogger.INSTANCE.d(TAG, "setDebugMode==true");
MapParams mapParams = MapParams.Companion.init();
mapParams.setDebugMode(false)
//todo 1-使用本地地图数据0-使用在线地图数据
@@ -71,7 +70,7 @@ public class CustomMapApiBuilder implements IMogoMapApiBuilder {
MapAutoApi.INSTANCE.init(context, mapParams);
MapAutoView mapAutoView = new MapAutoView(context);
//mapAutoView.registerRenderListener(l -> Log.i(TAG, "renderTime: " + l));
//mapAutoView.registerRenderListener(l -> CallerLogger.INSTANCE.i(TAG, "renderTime: " + l));
IMogoMapView mapView = new AMapViewWrapper(mapAutoView);
return mapView;
}
@@ -88,6 +87,6 @@ public class CustomMapApiBuilder implements IMogoMapApiBuilder {
@Override
public void init(Context context) {
Logger.d(TAG, "init");
CallerLogger.INSTANCE.d(TAG, "init");
}
}

View File

@@ -2,10 +2,9 @@ package com.mogo.map.impl.custom.location;
import android.content.Context;
import android.os.Trace;
import android.util.Log;
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.impl.custom.utils.ObjectUtils;
import com.mogo.map.location.IMogoLocationClient;
@@ -108,7 +107,6 @@ public class ALocationClient implements IMogoLocationClient {
@Override
public void onLocationChanged( @NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location ) {
//Log.w("DHY-location", location.getLon() + "," + location.getLat() + " ALocationClient-onLocationChanged:location");
if ( mIsDestroyed ) {
destroyWarming();
return;
@@ -120,7 +118,6 @@ public class ALocationClient implements IMogoLocationClient {
}
Trace.beginSection( "timer.onLocationChanged" );
mLastLocation = ObjectUtils.fromLocation( location );
//Log.w("DHY-location", mLastLocation.getLongitude() + "," + mLastLocation.getLatitude() + " ALocationClient-onLocationChanged:mLastLocation");
UiThreadHandler.post(() -> CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(mLastLocation));
Set< IMogoLocationListener > listeners = MogoLocationListenerRegister.getInstance().getListeners();
@@ -135,7 +132,7 @@ public class ALocationClient implements IMogoLocationClient {
}
private void destroyWarming() {
Logger.w( TAG, "location client has destroyed." );
CallerLogger.INSTANCE.w( TAG, "location client has destroyed." );
}
@Override

View File

@@ -7,7 +7,7 @@ import android.view.View;
import android.view.animation.Interpolator;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.impl.custom.utils.ObjectUtils;
import com.mogo.map.marker.IMogoInfoWindowAdapter;
import com.mogo.map.marker.IMogoMarker;
@@ -53,39 +53,39 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
private MogoMarkerOptions mMogoMarkerOptions;
private String mOwner;
public AMapMarkerWrapper( Marker marker, MogoMarkerOptions mogoMarkerOptions ) {
public AMapMarkerWrapper(Marker marker, MogoMarkerOptions mogoMarkerOptions) {
this.mMarker = marker;
if ( marker != null ) {
if (marker != null) {
// 设置自研 marker 的object对象为 IMogoMarker 实例。!!!!
marker.setMObject( this );
if ( !TextUtils.isEmpty( mogoMarkerOptions.getAnchorColor() ) ) {
marker.setAnchorColor( mogoMarkerOptions.getAnchorColor() );
marker.setMObject(this);
if (!TextUtils.isEmpty(mogoMarkerOptions.getAnchorColor())) {
marker.setAnchorColor(mogoMarkerOptions.getAnchorColor());
}
MarkerWrapperClickHelper.getInstance().setMogoMarkerMap( marker.getId(), this );
MarkerWrapperClickHelper.getInstance().setMogoMarkerMap(marker.getId(), this);
}
setObject( mogoMarkerOptions.getObject() );
setObject(mogoMarkerOptions.getObject());
this.mMogoMarkerOptions = mogoMarkerOptions;
mMogoMarkerOptions.addObserver( this );
mMogoMarkerOptions.addObserver(this);
}
@Override
public void update( Observable o, Object arg ) {
if ( isDestroyed() ) {
public void update(Observable o, Object arg) {
if (isDestroyed()) {
return;
}
setMarkerOptions( mMogoMarkerOptions );
setMarkerOptions(mMogoMarkerOptions);
}
@Override
public void destroy() {
if ( mMogoMarkerOptions != null ) {
if (mMogoMarkerOptions != null) {
mMogoMarkerOptions.deleteObservers();
mMogoMarkerOptions = null;
}
if ( mMarker != null ) {
if (mMarker != null) {
mMarker.remove();
mMarker.setMObject( null );
mMarker.setOnInfoWindowClickListener( null );
mMarker.setMObject(null);
mMarker.setOnInfoWindowClickListener(null);
mMarker = null;
}
mMogoInfoWindowAdapter = null;
@@ -101,66 +101,66 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
@Override
public void hideInfoWindow() {
if ( mMarker != null ) {
if (mMarker != null) {
mMarker.hideInfoWindow();
}
}
@Override
public void setAlpha( float alpha ) {
if ( mMarker != null ) {
mMarker.setAlpha( alpha );
public void setAlpha(float alpha) {
if (mMarker != null) {
mMarker.setAlpha(alpha);
}
}
@Override
public void setAnchor( float anchorU, float anchorV ) {
if ( mMarker != null ) {
mMarker.setAnchor( anchorU, anchorV );
public void setAnchor(float anchorU, float anchorV) {
if (mMarker != null) {
mMarker.setAnchor(anchorU, anchorV);
}
}
@Override
public void setDraggable( boolean paramBoolean ) {
if ( mMarker != null ) {
mMarker.setDraggable( paramBoolean );
public void setDraggable(boolean paramBoolean) {
if (mMarker != null) {
mMarker.setDraggable(paramBoolean);
}
}
@Override
public void setIcon( Bitmap icon ) {
if ( icon == null || icon.isRecycled() ) {
public void setIcon(Bitmap icon) {
if (icon == null || icon.isRecycled()) {
return;
}
if ( mMarker != null ) {
mMarker.setIcon( icon );
if (mMarker != null) {
mMarker.setIcon(icon);
}
}
@Override
public void setIcons( ArrayList< Bitmap > icons ) {
if ( icons == null || icons.isEmpty() ) {
public void setIcons(ArrayList<Bitmap> icons) {
if (icons == null || icons.isEmpty()) {
return;
}
ArrayList< BitmapDescriptor > descriptors = new ArrayList<>();
for ( Bitmap icon : icons ) {
if ( icon == null || icon.isRecycled() ) {
ArrayList<BitmapDescriptor> descriptors = new ArrayList<>();
for (Bitmap icon : icons) {
if (icon == null || icon.isRecycled()) {
continue;
}
descriptors.add( BitmapDescriptorFactory.INSTANCE.fromBitmap( icon ) );
descriptors.add(BitmapDescriptorFactory.INSTANCE.fromBitmap(icon));
}
if ( descriptors.isEmpty() ) {
if (descriptors.isEmpty()) {
return;
}
if ( mMarker != null ) {
mMarker.setIcons( descriptors );
if (mMarker != null) {
mMarker.setIcons(descriptors);
}
}
@Override
public void setInfoWindowEnable( boolean enabled ) {
if ( mMarker != null ) {
if ( enabled ) {
public void setInfoWindowEnable(boolean enabled) {
if (mMarker != null) {
if (enabled) {
mMarker.showInfoWindow();
} else {
mMarker.hideInfoWindow();
@@ -169,20 +169,20 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
}
@Override
public void setMarkerOptions( MogoMarkerOptions opt ) {
public void setMarkerOptions(MogoMarkerOptions opt) {
final MarkerOptions options = ObjectUtils.fromMogo( opt );
if ( options == null ) {
final MarkerOptions options = ObjectUtils.fromMogo(opt);
if (options == null) {
return;
}
if ( mMarker != null ) {
mMarker.setMarkerOptions( options );
setObject( opt.getObject() );
if (mMarker != null) {
mMarker.setMarkerOptions(options);
setObject(opt.getObject());
}
}
@Override
public void setObject( Object object ) {
public void setObject(Object object) {
mObject = object;
}
@@ -192,87 +192,87 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
}
@Override
public void setPeriod( int period ) {
if ( mMarker != null ) {
mMarker.setPeriod( period );
public void setPeriod(int period) {
if (mMarker != null) {
mMarker.setPeriod(period);
}
}
@Override
public void setPosition( double lat, double lng ) {
if ( mMarker != null ) {
mMarker.setPosition( new LonLatPoint( lng, lat ) );
public void setPosition(double lat, double lng) {
if (mMarker != null) {
mMarker.setPosition(new LonLatPoint(lng, lat));
}
}
@Override
public MogoLatLng getPosition() {
if ( mMarker != null ) {
if (mMarker != null) {
final LonLatPoint latLng = mMarker.getPosition();
return ObjectUtils.fromAMap( latLng );
return ObjectUtils.fromAMap(latLng);
}
return null;
}
@Override
public void setRotateAngle( float rotate ) {
if ( mMarker != null ) {
mMarker.setRotateAngle( rotate );
public void setRotateAngle(float rotate) {
if (mMarker != null) {
mMarker.setRotateAngle(rotate);
}
}
@Override
public void setSnippet( String snippet ) {
if ( mMarker != null ) {
mMarker.setSnippet( snippet );
public void setSnippet(String snippet) {
if (mMarker != null) {
mMarker.setSnippet(snippet);
}
}
@Override
public void setTitle( String title ) {
if ( mMarker != null ) {
mMarker.setTitle( title );
public void setTitle(String title) {
if (mMarker != null) {
mMarker.setTitle(title);
}
}
@Override
public void setToTop() {
if ( mMarker != null ) {
if (mMarker != null) {
mMarker.setToTop();
}
}
@Override
public void setVisible( boolean visible ) {
if ( mMarker != null ) {
mMarker.setVisible( visible );
public void setVisible(boolean visible) {
if (mMarker != null) {
mMarker.setVisible(visible);
}
}
@Override
public void setZIndex( int zIndex ) {
if ( mMarker != null ) {
mMarker.setZIndex( zIndex );
public void setZIndex(int zIndex) {
if (mMarker != null) {
mMarker.setZIndex(zIndex);
}
}
@Override
public void showInfoWindow() {
if ( mMarker != null ) {
if (mMarker != null) {
mMarker.showInfoWindow();
}
}
@Override
public String getMarkerAssInfo() {
if ( mMarker != null ) {
if (mMarker != null) {
return mMarker.getMarkeOptions().getAssInfo();
}
return null;
}
@Override
public void setOnMarkerClickListener( IMogoMarkerClickListener listener ) {
public void setOnMarkerClickListener(IMogoMarkerClickListener listener) {
mMogoMarkerClickListener = listener;
}
@@ -282,7 +282,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
}
@Override
public void setInfoWindowAdapter( IMogoInfoWindowAdapter adapter ) {
public void setInfoWindowAdapter(IMogoInfoWindowAdapter adapter) {
mMogoInfoWindowAdapter = adapter;
}
@@ -292,11 +292,11 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
}
@Override
public void setMarkerIconView( IMogoMarkerIconViewCreator creator ) {
if ( creator != null ) {
View iconView = creator.createView( this );
if ( iconView != null ) {
mMarker.setIcon( iconView );
public void setMarkerIconView(IMogoMarkerIconViewCreator creator) {
if (creator != null) {
View iconView = creator.createView(this);
if (iconView != null) {
mMarker.setIcon(iconView);
}
}
}
@@ -307,25 +307,25 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
}
@Override
public void setOwner( String mOwner ) {
public void setOwner(String mOwner) {
this.mOwner = mOwner;
}
@Override
public String getOwner() {
if ( mOwner != null ) {
if (mOwner != null) {
return mOwner;
}
if ( mMogoMarkerOptions != null ) {
if (mMogoMarkerOptions != null) {
return mMogoMarkerOptions.getOwner();
}
return null;
}
@Override
public void setPositionByPixels( Point position ) {
if ( mMarker != null ) {
mMarker.setPosition( MapTools.INSTANCE.fromScreenLocation( position ) );
public void setPositionByPixels(Point position) {
if (mMarker != null) {
mMarker.setPosition(MapTools.INSTANCE.fromScreenLocation(position));
}
}
@@ -339,146 +339,146 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
}
@Override
public void startScaleAnimation( float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator ) {
if ( isDestroyed() ) {
public void startScaleAnimation(float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator) {
if (isDestroyed()) {
return;
}
startScaleAnimation( fromX, toX, fromY, toY, duration, interpolator, null );
startScaleAnimation(fromX, toX, fromY, toY, duration, interpolator, null);
}
@Override
public void startScaleAnimation( float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator, OnMarkerAnimationListener listener ) {
if ( isDestroyed() ) {
public void startScaleAnimation(float fromX, float toX, float fromY, float toY, int duration, Interpolator interpolator, OnMarkerAnimationListener listener) {
if (isDestroyed()) {
return;
}
MarkerScaleAnimation animationScale = new MarkerScaleAnimation( fromX, toX );
animationScale.setDuration( duration );
MarkerScaleAnimation animationScale = new MarkerScaleAnimation(fromX, toX);
animationScale.setDuration(duration);
// animationScale.setFillMode(Animation.FILL_MODE_FORWARDS);
// animationScale.setInterpolator(interpolator);
animationScale.setAnimationListener( new MarkerAnimationListener() {
animationScale.setAnimationListener(new MarkerAnimationListener() {
@Override
public void onAnimationEnd( @NotNull Animation animation ) {
if ( isDestroyed() ) {
public void onAnimationEnd(@NotNull Animation animation) {
if (isDestroyed()) {
return;
}
if ( listener != null ) {
if (listener != null) {
listener.onAnimEnd();
}
}
@Override
public void onAnimationRepeat( @NotNull Animation animation ) {
public void onAnimationRepeat(@NotNull Animation animation) {
}
@Override
public void onAnimationStart( @NotNull Animation animation ) {
if ( isDestroyed() ) {
public void onAnimationStart(@NotNull Animation animation) {
if (isDestroyed()) {
return;
}
if ( listener != null ) {
if (listener != null) {
listener.onAnimStart();
}
}
} );
});
mMarker.setMarkerScaleAnimation( animationScale );
mMarker.setMarkerScaleAnimation(animationScale);
mMarker.startAnimation();
}
@Override
public void startJumpAnimation( float high, long duration, Interpolator interpolator, OnMarkerAnimationListener listener ) {
if ( isDestroyed() || high <= 0.0f || interpolator == null || duration < 0 ) {
public void startJumpAnimation(float high, long duration, Interpolator interpolator, OnMarkerAnimationListener listener) {
if (isDestroyed() || high <= 0.0f || interpolator == null || duration < 0) {
return;
}
try {
final LonLatPoint latLng = ObjectUtils.fromMogo( getPosition() );
final LonLatPoint latLng = ObjectUtils.fromMogo(getPosition());
// Point point = AMapWrapper.getAMap().getProjection().toScreenLocation(latLng);
// point.y -= WindowUtils.dip2px(AbsMogoApplication.getApp(), high);
// LatLng target = AMapWrapper.getAMap().getProjection().fromScreenLocation(point);
//使用TranslateAnimation,填写一个需要移动的目标点
MarkerTranslateAnimation animation = new MarkerTranslateAnimation( latLng );
MarkerTranslateAnimation animation = new MarkerTranslateAnimation(latLng);
// animation.setInterpolator(interpolator);
animation.setAnimationListener( new MarkerAnimationListener() {
animation.setAnimationListener(new MarkerAnimationListener() {
@Override
public void onAnimationEnd( @NotNull Animation animation ) {
if ( isDestroyed() ) {
public void onAnimationEnd(@NotNull Animation animation) {
if (isDestroyed()) {
return;
}
if ( listener != null ) {
if (listener != null) {
listener.onAnimEnd();
}
}
@Override
public void onAnimationRepeat( @NotNull Animation animation ) {
public void onAnimationRepeat(@NotNull Animation animation) {
}
@Override
public void onAnimationStart( @NotNull Animation animation ) {
if ( isDestroyed() ) {
public void onAnimationStart(@NotNull Animation animation) {
if (isDestroyed()) {
return;
}
if ( listener != null ) {
if (listener != null) {
listener.onAnimStart();
}
}
} );
});
//整个移动所需要的时间
animation.setDuration( duration * 1000 );
animation.setDuration(duration * 1000);
//设置动画
mMarker.setTranslateAnimation( animation );
mMarker.setTranslateAnimation(animation);
mMarker.startAnimation();
} catch ( Exception e ) {
Logger.e( TAG, e, "error." );
} catch (Exception e) {
CallerLogger.INSTANCE.e(TAG, "error : " + e);
}
}
@Override
public void setClickable( boolean clickable ) {
if ( mMarker != null ) {
mMarker.setClickable( clickable );
public void setClickable(boolean clickable) {
if (mMarker != null) {
mMarker.setClickable(clickable);
}
}
@Override
public void startSmooth( List< MogoLatLng > points, int duration ) {
startSmoothInMs( points, duration * 1000 );
public void startSmooth(List<MogoLatLng> points, int duration) {
startSmoothInMs(points, duration * 1000L);
}
@Override
public void startSmoothInMs( List< MogoLatLng > points, long duration ) {
if ( isDestroyed() ) {
public void startSmoothInMs(List<MogoLatLng> points, long duration) {
if (isDestroyed()) {
return;
}
if ( mMarker == null ) {
if (mMarker == null) {
return;
}
if ( points == null || points.isEmpty() ) {
if (points == null || points.isEmpty()) {
return;
}
ArrayList< LonLatPoint > newPoints = new ArrayList<>();
for ( int i = 0; i < points.size(); i++ ) {
LonLatPoint point = ObjectUtils.fromMogo( points.get( i ) );
if ( point == null ) {
ArrayList<LonLatPoint> newPoints = new ArrayList<>();
for (int i = 0; i < points.size(); i++) {
LonLatPoint point = ObjectUtils.fromMogo(points.get(i));
if (point == null) {
continue;
}
newPoints.add( point );
newPoints.add(point);
}
if ( newPoints.isEmpty() ) {
if (newPoints.isEmpty()) {
return;
}
mMarker.startSmooth( newPoints, ( int ) duration );
mMarker.startSmooth(newPoints, (int) duration);
}
@Override
public void startScaleAnimationWithAlpha( float fromX, float toX, float fromY, float toY, float fromAlpha, float toAlpha, int duration, Interpolator interpolator, OnMarkerAnimationListener listener ) {
public void startScaleAnimationWithAlpha(float fromX, float toX, float fromY, float toY, float fromAlpha, float toAlpha, int duration, Interpolator interpolator, OnMarkerAnimationListener listener) {
}
@@ -488,98 +488,98 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
}
@Override
public void setGps( boolean isGps ) {
if ( mMarker != null ) {
mMarker.setGps( isGps );
public void setGps(boolean isGps) {
if (mMarker != null) {
mMarker.setGps(isGps);
}
}
@Override
public String use3DResource( int model3D ) {
public String use3DResource(int model3D) {
try {
mMarker.marker3DIcon( model3D );
mMarker.marker3DIcon(model3D);
return mMarker.getMarkeOptions().getMarkerIconName();
} catch ( Exception e ) {
Logger.e( TAG, e, "use3DResource" );
} catch (Exception e) {
CallerLogger.INSTANCE.e(TAG, "use3DResource has exception : " + e);
}
return null;
}
@Override
public void use3DResource( String resName ) {
public void use3DResource(String resName) {
try {
mMarker.getMarkeOptions().setVrIcon( true );
mMarker.setMarkerOptions( mMarker.getMarkeOptions().setMarkerIconName( resName ) );
} catch ( Exception e ) {
Logger.e( TAG, e, "use3DResource" );
mMarker.getMarkeOptions().setVrIcon(true);
mMarker.setMarkerOptions(mMarker.getMarkeOptions().setMarkerIconName(resName));
} catch (Exception e) {
CallerLogger.INSTANCE.e(TAG,"use3DResource has exception : " + e);
}
}
@Override
public void use2DResource( String resName ) {
public void use2DResource(String resName) {
try {
mMarker.getMarkeOptions().setVrIcon( false );
mMarker.setMarkerOptions( mMarker.getMarkeOptions().setMarkerIconName( resName ) );
} catch ( Exception e ) {
Logger.e( TAG, e, "use3DResource" );
mMarker.getMarkeOptions().setVrIcon(false);
mMarker.setMarkerOptions(mMarker.getMarkeOptions().setMarkerIconName(resName));
} catch (Exception e) {
CallerLogger.INSTANCE.e(TAG, "use3DResource has exception : " + e);
}
}
private String mLastAnchorColor = "";
@Override
public void setAnchorColor( String anchorColor ) {
if ( TextUtils.equals( mLastAnchorColor, anchorColor ) ) {
public void setAnchorColor(String anchorColor) {
if (TextUtils.equals(mLastAnchorColor, anchorColor)) {
return;
}
if (mMogoMarkerOptions != null) {
mMogoMarkerOptions.anchorColor( anchorColor );
mMogoMarkerOptions.anchorColor(anchorColor);
}
if (mMarker != null) {
mMarker.setAnchorColor( anchorColor );
mMarker.setAnchorColor(anchorColor);
}
mLastAnchorColor = anchorColor;
}
@Override
public void updateInfoWindowView( View view ) {
public void updateInfoWindowView(View view) {
try {
mMarker.setInfoWindowView( view );
} catch ( Exception e ) {
mMarker.setInfoWindowView(view);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void updateInfoWindowView( String viewResName ) {
public void updateInfoWindowView(String viewResName) {
try {
mMarker.setMarkerInfoName( viewResName );
} catch ( Exception e ) {
mMarker.setMarkerInfoName(viewResName);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void setInfoWindowOffset( int offsetX, int offsetY ) {
public void setInfoWindowOffset(int offsetX, int offsetY) {
try {
mMarker.setInfoWindowOffset( offsetX, offsetY );
} catch ( Exception e ) {
mMarker.setInfoWindowOffset(offsetX, offsetY);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void addDynamicAnchorPosition( MogoLatLng latLng, float angle, long duration ) {
mMarker.addDynamicAnchorPostion( new LonLatPoint( latLng.lon, latLng.lat, angle ), System.currentTimeMillis(), ( int ) duration);
public void addDynamicAnchorPosition(MogoLatLng latLng, float angle, long duration) {
mMarker.addDynamicAnchorPostion(new LonLatPoint(latLng.lon, latLng.lat, angle), System.currentTimeMillis(), (int) duration);
}
@Override
public String getMarkerResName() {
if ( mMarker != null ) {
if (mMarker != null) {
try {
return mMarker.getMarkeOptions().getMarkerIconName();
} catch ( Exception e ) {
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -588,10 +588,10 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
@Override
public String getMarkerInfoResName() {
if ( mMarker != null ) {
if (mMarker != null) {
try {
return mMarker.getMarkeOptions().getMarkerInfoName();
} catch ( Exception e ) {
} catch (Exception e) {
e.printStackTrace();
}
}

View File

@@ -2,7 +2,7 @@ package com.mogo.map.impl.custom.search;
import android.content.Context;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.impl.custom.utils.ObjectUtils;
import com.mogo.map.search.inputtips.IMogoInputtipsListener;
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
@@ -60,7 +60,7 @@ public class InputtipsSearch implements IMogoInputtipsSearch, InputtipsListener
mListener.onGetInputtips(getResult(list));
}
} else {
Logger.e(TAG, "errorcode = " + i);
CallerLogger.INSTANCE.e(TAG, "errorcode = " + i);
}
}

View File

@@ -2,7 +2,7 @@ package com.mogo.map.impl.custom.search;
import android.content.Context;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.exception.MogoMapException;
import com.mogo.map.impl.custom.utils.ObjectUtils;
import com.mogo.map.search.geo.MogoPoiItem;
@@ -15,7 +15,6 @@ import com.zhidaoauto.map.sdk.open.query.OnPoiSearchListener;
import com.zhidaoauto.map.sdk.open.query.PoiItem;
import com.zhidaoauto.map.sdk.open.query.PoiSearch;
import com.zhidaoauto.map.sdk.open.query.PoiSearchResult;
import com.zhidaoauto.map.sdk.open.query.PoiCategory;
import org.jetbrains.annotations.Nullable;
@@ -38,94 +37,94 @@ public class PoiSearchClient implements IMogoPoiSearch, OnPoiSearchListener {
private IMogoPoiSearchListener mListener;
private MogoSearchBound mBound;
public PoiSearchClient( Context context, MogoPoiSearchQuery query ) {
public PoiSearchClient(Context context, MogoPoiSearchQuery query) {
try {
mQuery = query;
mClient = new PoiSearch( context, ObjectUtils.fromMogo( mQuery ) );
mClient.setOnPoiSearchListener( this );
mClient = new PoiSearch(context, ObjectUtils.fromMogo(mQuery));
mClient.setOnPoiSearchListener(this);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void setPoiSearchListener( IMogoPoiSearchListener listener ) {
public void setPoiSearchListener(IMogoPoiSearchListener listener) {
mListener = listener;
}
@Override
public void searchPOIAsyn() {
if ( mClient != null ) {
if (mClient != null) {
mClient.searchPOIAsyn();
}
}
@Override
public MogoPoiResult searchPOI() throws MogoMapException {
if ( mClient != null ) {
if (mClient != null) {
try {
PoiSearchResult search = mClient.searchPOI();
return ObjectUtils.fromAMap( search );
} catch ( Exception e ) {
throw new MogoMapException( e );
return ObjectUtils.fromAMap(search);
} catch (Exception e) {
throw new MogoMapException(e);
}
}
return null;
}
@Override
public void setQuery( MogoPoiSearchQuery query ) {
public void setQuery(MogoPoiSearchQuery query) {
mQuery = query;
if ( mClient != null ) {
mClient.setQuery( ObjectUtils.fromMogo( mQuery ) );
if (mClient != null) {
mClient.setQuery(ObjectUtils.fromMogo(mQuery));
}
}
@Override
public MogoPoiItem searchPOIId( String poiId ) throws MogoMapException {
if ( mClient != null ) {
public MogoPoiItem searchPOIId(String poiId) throws MogoMapException {
if (mClient != null) {
try {
PoiItem poiItem = mClient.searchPOIId( poiId );
return ObjectUtils.fromAMap( poiItem );
} catch ( Exception e ) {
throw new MogoMapException( e );
PoiItem poiItem = mClient.searchPOIId(poiId);
return ObjectUtils.fromAMap(poiItem);
} catch (Exception e) {
throw new MogoMapException(e);
}
}
return null;
}
@Override
public void searchPOIIdAsyn( String poiId ) {
if ( mClient != null ) {
mClient.searchPOIIdAsyn( poiId );
public void searchPOIIdAsyn(String poiId) {
if (mClient != null) {
mClient.searchPOIIdAsyn(poiId);
}
}
@Override
public void setBound( MogoSearchBound bound ) {
public void setBound(MogoSearchBound bound) {
mBound = bound;
if ( mClient != null ) {
mClient.setBound( ObjectUtils.fromMogo( mBound ) );
if (mClient != null) {
mClient.setBound(ObjectUtils.fromMogo(mBound));
}
}
@Override
public void onPoiSearched( PoiSearchResult poiResult, int errorCode ) {
if ( errorCode != 0 ) {
Logger.e( TAG, "errorcode is %d", errorCode );
public void onPoiSearched(PoiSearchResult poiResult, int errorCode) {
if (errorCode != 0) {
CallerLogger.INSTANCE.e(TAG, "errorCode is " + errorCode);
}
if ( mListener != null ) {
mListener.onPoiSearched( ObjectUtils.fromAMap( poiResult ), errorCode );
if (mListener != null) {
mListener.onPoiSearched(ObjectUtils.fromAMap(poiResult), errorCode);
}
}
@Override
public void onPoiItemSearched( PoiItem poiItem, int errorCode ) {
if ( errorCode != 0 ) {
Logger.e( TAG, "errorcode is %d", errorCode );
public void onPoiItemSearched(PoiItem poiItem, int errorCode) {
if (errorCode != 0) {
CallerLogger.INSTANCE.e(TAG, "errorCode is " + errorCode);
}
if ( mListener != null ) {
mListener.onPoiItemSearched( ObjectUtils.fromAMap( poiItem ), errorCode );
if (mListener != null) {
mListener.onPoiItemSearched(ObjectUtils.fromAMap(poiItem), errorCode);
}
}

View File

@@ -2,7 +2,7 @@ package com.mogo.map.impl.custom.utils;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
import java.util.List;
@@ -38,13 +38,13 @@ public class PointInterpolatorUtil {
MogoLatLng current = points.get(i);
MogoLatLng next = points.get(i + 1);
float distance = CoordinateUtils.calculateLineDistance(current.lon, current.lat, next.lon, next.lat);
Logger.d(TAG, i + ": " + distance);
CallerLogger.INSTANCE.d(TAG, i + ": " + distance);
if (distance > DISTANCE_THRESHOLD) {
int inter = (int) (distance / DISTANCE_THRESHOLD) + 1;
for (int j = 1; j < inter; j++) {
double newLat = current.lat + (next.lat - current.lat) * j / inter;
double newLon = current.lon + (next.lon - current.lon) * j / inter;
Logger.d(TAG, "distance: " + distance + ", j: " + j + ", nextLat: " + next.lat + ", nextLon: " + next.lon + ", newLat: " + newLat + ", newLon: " + newLon);
CallerLogger.INSTANCE.d(TAG, "distance: " + distance + ", j: " + j + ", nextLat: " + next.lat + ", nextLon: " + next.lon + ", newLat: " + newLat + ", newLon: " + newLon);
points.add(i + 1, new MogoLatLng(newLat, newLon));
current = points.get(++i);
}