[MAP] 高精地图Marker绘制逻辑重构
This commit is contained in:
@@ -5,7 +5,7 @@ import androidx.collection.ArraySet
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.w
|
||||
import com.mogo.map.MogoMarkerManager
|
||||
import com.mogo.map.identify.MogoIdentifyManager
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
@@ -58,14 +58,14 @@ class IdentifyAiCloudDataDrawer : Identify {
|
||||
val key = it.next() as String
|
||||
it.remove()
|
||||
mMarkersCaches.remove(key)
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
|
||||
.removeMarker(key.hashCode().toString())
|
||||
}
|
||||
|
||||
val filterList = filterTrafficData(resultList)
|
||||
if (filterList.size > 0) {
|
||||
// 绘制新数据
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
|
||||
.updateBatchAiMarkerPosition(filterList)
|
||||
}
|
||||
}
|
||||
@@ -93,7 +93,7 @@ class IdentifyAiCloudDataDrawer : Identify {
|
||||
trafficDataUuidList.clear()
|
||||
mMarkersCaches.forEach { (uuid, _) ->
|
||||
mMarkersCaches.remove(uuid)
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
|
||||
.removeMarker(uuid.hashCode().toString())
|
||||
}
|
||||
mFilterTrafficData.clear()
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.w
|
||||
import com.mogo.map.MogoMarkerManager
|
||||
import com.mogo.map.identify.MogoIdentifyManager
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
|
||||
@@ -49,7 +49,7 @@ class IdentifyBeautifyDataDrawer : Identify {
|
||||
val filterList = TrackManager.getInstance().filterTrafficData(resultList)
|
||||
if (filterList.size > 0) {
|
||||
// 绘制新数据
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
|
||||
.updateBatchMarkerPosition(filterList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.w
|
||||
import com.mogo.map.MogoMarkerManager
|
||||
import com.mogo.map.identify.MogoIdentifyManager
|
||||
import mogo.telematics.pad.MessagePad.PlanningObject
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
@@ -82,14 +82,14 @@ class IdentifyOriginDataDrawer : Identify {
|
||||
val key = it.next() as String
|
||||
it.remove()
|
||||
mMarkersCaches.remove(key)
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
|
||||
.removeMarker(key)
|
||||
}
|
||||
|
||||
val filterList = filterTrafficData(resultList)
|
||||
if (filterList.size > 0) {
|
||||
// 绘制新数据
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
|
||||
.updateBatchMarkerPosition(filterList)
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ class IdentifyOriginDataDrawer : Identify {
|
||||
@SuppressLint("NewApi")
|
||||
override fun clearOldMarker() {
|
||||
for (uuid in trafficDataUuidList) {
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
|
||||
.removeMarker(uuid)
|
||||
}
|
||||
trafficDataUuidList.clear()
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2CellId;
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2LatLng;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.identify.MogoIdentifyManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -150,7 +150,7 @@ public class TrackManager {
|
||||
cellIdCaches.remove(key);
|
||||
mMarkersCaches.remove(key);
|
||||
WarningHelper.INSTANCE.remove(key);
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
|
||||
.removeMarker(key);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class TrackManager {
|
||||
WarningHelper.INSTANCE.clear();
|
||||
mMarkersCaches.forEach((uuid, trackObj) -> {
|
||||
trackObj.clear();
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
MogoIdentifyManager.getInstance(AbsMogoApplication.getApp())
|
||||
.removeMarker(uuid);
|
||||
});
|
||||
mMarkersCaches.clear();
|
||||
|
||||
@@ -5,20 +5,16 @@ import android.graphics.Color;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.util.Pools;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils;
|
||||
import com.mogo.map.MogoOverlayManager;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
|
||||
import com.mogo.map.overlay.IMoGoOverlayManager;
|
||||
import com.mogo.map.overlay.core.Level;
|
||||
import com.mogo.map.overlay.line.Polyline;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class RouteOverlayDrawer {
|
||||
@@ -27,28 +23,32 @@ public class RouteOverlayDrawer {
|
||||
|
||||
// 连接线参数
|
||||
private Handler mRenderHandler;
|
||||
IMogoOverlayManager mogoOverlayManager;
|
||||
private final IMoGoOverlayManager mogoOverlayManager;
|
||||
private static volatile RouteOverlayDrawer sInstance;
|
||||
private final MogoPolylineOptions mPolylineOptions;
|
||||
private volatile IMogoPolyline mMoGoPolyline;
|
||||
private Polyline.Options mPolylineOptions;
|
||||
private static final int COLOR_LIGHT = Color.parseColor("#BAEBF5");
|
||||
|
||||
|
||||
private RouteOverlayDrawer() {
|
||||
mPolylineOptions = new MogoPolylineOptions();
|
||||
mPolylineOptions.zIndex(75000f);
|
||||
mPolylineOptions.setGps(true);
|
||||
mPolylineOptions.width(20).useGradient(true);
|
||||
// 渐变色
|
||||
mogoOverlayManager = MogoOverlayManager.getInstance();
|
||||
// 线条粗细,渐变,渐变色值
|
||||
HandlerThread renderTask = new HandlerThread("routing_render") {
|
||||
@Override
|
||||
protected void onLooperPrepared() {
|
||||
super.onLooperPrepared();
|
||||
mRenderHandler = new Handler(getLooper());
|
||||
}
|
||||
};
|
||||
renderTask.start();
|
||||
mogoOverlayManager = CallerMapUIServiceManager.INSTANCE.getOverlayManager();
|
||||
if (mogoOverlayManager != null) {
|
||||
mPolylineOptions = new Polyline.Options.Builder("router_overlay", Level.GUIDE_ROUTE_LINE)
|
||||
.setUseGps(true)
|
||||
.setWidth(20)
|
||||
.setIsGradient(true)
|
||||
.build();
|
||||
|
||||
// 线条粗细,渐变,渐变色值
|
||||
HandlerThread renderTask = new HandlerThread("routing_render") {
|
||||
@Override
|
||||
protected void onLooperPrepared() {
|
||||
super.onLooperPrepared();
|
||||
mRenderHandler = new Handler(getLooper());
|
||||
}
|
||||
};
|
||||
renderTask.start();
|
||||
}
|
||||
}
|
||||
|
||||
public static RouteOverlayDrawer getInstance() {
|
||||
@@ -63,12 +63,11 @@ public class RouteOverlayDrawer {
|
||||
}
|
||||
|
||||
public void clearMogoRouteOverlay() {
|
||||
if (mRenderTask != null) {
|
||||
mRenderHandler.removeCallbacks(mRenderTask);
|
||||
}
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mMoGoPolyline = null;
|
||||
if (mogoOverlayManager != null) {
|
||||
if (mRenderTask != null) {
|
||||
mRenderHandler.removeCallbacks(mRenderTask);
|
||||
}
|
||||
mogoOverlayManager.removeAllLinesInLevel(Level.GUIDE_ROUTE_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,9 +92,14 @@ public class RouteOverlayDrawer {
|
||||
@SuppressLint("LongLogTag")
|
||||
@Override
|
||||
public void run() {
|
||||
IMoGoOverlayManager overlayManager = mogoOverlayManager;
|
||||
if (overlayManager == null) {
|
||||
return;
|
||||
}
|
||||
LinkedList<MogoLatLng> pps = this.points;
|
||||
boolean isExcept = false;
|
||||
int total;
|
||||
|
||||
try {
|
||||
pps.clear();
|
||||
List<MessagePad.TrajectoryPoint> routes = this.routeList;
|
||||
@@ -170,32 +174,30 @@ public class RouteOverlayDrawer {
|
||||
Strategy strategy = RouteStrategy.INSTANCE.getStrategy();
|
||||
List<Integer> colors = strategy.getColors();
|
||||
boolean isLightOn = strategy instanceof ColorfulStrategy && ((ColorfulStrategy) strategy).isLightOn();
|
||||
if (mMoGoPolyline == null || mMoGoPolyline.isDestroyed()) {
|
||||
mPolylineOptions.points(points);
|
||||
mPolylineOptions.colorValues(colors);
|
||||
if (isLightOn) {
|
||||
mPolylineOptions.openBright(true);
|
||||
mPolylineOptions.brightColor(COLOR_LIGHT);
|
||||
mPolylineOptions.brightSpeed(0.5f);
|
||||
} else {
|
||||
mPolylineOptions.openBright(false);
|
||||
}
|
||||
mMoGoPolyline = mogoOverlayManager.addPolyline(mPolylineOptions);
|
||||
Polyline.Options.Builder builder;
|
||||
if (mPolylineOptions == null) {
|
||||
builder = new Polyline.Options.Builder("router_overlay", Level.GUIDE_ROUTE_LINE)
|
||||
.setUseGps(true)
|
||||
.setWidth(20)
|
||||
.setIsGradient(true);
|
||||
} else {
|
||||
mPolylineOptions.points(points);
|
||||
mPolylineOptions.colorValues(colors);
|
||||
if (isLightOn) {
|
||||
mPolylineOptions.openBright(true);
|
||||
mPolylineOptions.brightColor(COLOR_LIGHT);
|
||||
mPolylineOptions.brightSpeed(0.5f);
|
||||
} else {
|
||||
mPolylineOptions.openBright(false);
|
||||
}
|
||||
mMoGoPolyline.setOption(mPolylineOptions);
|
||||
builder = mPolylineOptions.builder();
|
||||
}
|
||||
if (mMoGoPolyline != null && !mMoGoPolyline.isDestroyed() && !mMoGoPolyline.isVisible()) {
|
||||
mMoGoPolyline.setVisible(true);
|
||||
builder.points(points);
|
||||
builder.colors(colors);
|
||||
if (isLightOn) {
|
||||
builder.setLightOn(true);
|
||||
builder.setLightColor(COLOR_LIGHT);
|
||||
builder.setLightSpeed(0.5f);
|
||||
} else {
|
||||
builder.setLightOn(false);
|
||||
}
|
||||
builder.setVisible(true);
|
||||
Polyline.Options options = builder.build();
|
||||
if (mPolylineOptions == null) {
|
||||
mPolylineOptions = options;
|
||||
}
|
||||
overlayManager.showOrUpdateLine(options);
|
||||
} else {
|
||||
isExcept = true;
|
||||
}
|
||||
@@ -225,19 +227,25 @@ public class RouteOverlayDrawer {
|
||||
private volatile RenderTask mRenderTask;
|
||||
|
||||
public void drawTrajectoryList(List<MessagePad.TrajectoryPoint> routeList, double bearing) {
|
||||
if (mRenderTask == null) {
|
||||
mRenderTask = new RenderTask();
|
||||
}
|
||||
mRenderTask.setData(routeList, bearing);
|
||||
if (mRenderHandler != null) {
|
||||
mRenderHandler.removeCallbacks(mRenderTask);
|
||||
mRenderHandler.post(mRenderTask);
|
||||
if (mogoOverlayManager != null) {
|
||||
if (mRenderTask == null) {
|
||||
mRenderTask = new RenderTask();
|
||||
}
|
||||
mRenderTask.setData(routeList, bearing);
|
||||
if (mRenderHandler != null) {
|
||||
mRenderHandler.removeCallbacks(mRenderTask);
|
||||
mRenderHandler.post(mRenderTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setVisible(boolean isVisible) {
|
||||
if (mMoGoPolyline != null && !mMoGoPolyline.isDestroyed()) {
|
||||
mMoGoPolyline.setVisible(isVisible);
|
||||
if (mogoOverlayManager != null) {
|
||||
if (isVisible) {
|
||||
mogoOverlayManager.showAllLinesInLevel(Level.GUIDE_ROUTE_LINE);
|
||||
} else {
|
||||
mogoOverlayManager.hideAllLinesInLevel(Level.GUIDE_ROUTE_LINE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,15 +5,11 @@ import android.content.Context;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.function.api.map.IMogoMapService;
|
||||
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService;
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager;
|
||||
import com.mogo.map.MoGoOverlayManager;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.MogoOverlayManager;
|
||||
import com.mogo.map.location.GDLocationClient;
|
||||
import com.mogo.map.location.IMogoGDLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.overlay.IMoGoOverlayManager;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
/**
|
||||
@@ -25,15 +21,6 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
@Route(path = MogoServicePaths.PATH_SERVICES_MAP)
|
||||
public class MogoMapService implements IMogoMapService {
|
||||
|
||||
@Override
|
||||
public IMogoMarkerManager getMarkerManager(Context context) {
|
||||
return MogoMarkerManager.getInstance(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarkerService getMarkerService() {
|
||||
return MogoMarkerServiceImpl.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapUIController getMapUIController() {
|
||||
@@ -41,8 +28,8 @@ public class MogoMapService implements IMogoMapService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoOverlayManager getOverlayManager() {
|
||||
return MogoOverlayManager.getInstance();
|
||||
public IMoGoOverlayManager getOverlayManager() {
|
||||
return MoGoOverlayManager.INSTANCE.overlay();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService;
|
||||
import com.mogo.eagle.core.function.impl.marker.drawer.MarkerDrawer;
|
||||
import com.mogo.eagle.core.function.impl.marker.drawer.TrafficMarkerDrawer;
|
||||
import com.mogo.eagle.core.function.impl.marker.drawer.V2XWarnDataDrawer;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
|
||||
public class MogoMarkerServiceImpl implements IMogoMarkerService {
|
||||
|
||||
private static volatile MogoMarkerServiceImpl sInstance;
|
||||
private static final byte[] obj = new byte[0];
|
||||
|
||||
private MogoMarkerServiceImpl() {
|
||||
|
||||
}
|
||||
|
||||
public static MogoMarkerServiceImpl getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (obj) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoMarkerServiceImpl();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IMogoMarker drawMarker(Object object) {
|
||||
if (object instanceof MarkerShowEntity) {
|
||||
return MarkerDrawer.getInstance().drawMapMarkerImpl(((MarkerShowEntity) object), MarkerDrawer.MARKER_Z_INDEX_HIGH, null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderWarningMoveMarker(double lon, double lat, int type, double collisionlat, double collisionLon, double angle, long showTime) {
|
||||
V2XWarnDataDrawer.getInstance().renderWarnData(lon, lat, type, collisionlat, collisionLon, angle, showTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderStopLineMarker(double lon, double lat) {
|
||||
V2XWarnDataDrawer.getInstance().renderStopLineData(lon, lat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawerArrowsMarkerWithLocation(MogoLatLng location, String markerType, int type, int rotate) {
|
||||
V2XWarnDataDrawer.getInstance().drawerArrowsMarkerWithLocation(location, markerType, type, rotate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateITrafficInfo(TrafficData trafficData) {
|
||||
TrafficMarkerDrawer.INSTANCE.updateITrafficInfo(trafficData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateITrafficLocationInfo(TrafficData trafficData) {
|
||||
TrafficMarkerDrawer.INSTANCE.updateITrafficLocationInfo(trafficData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateITrafficThreatLevelInfo(TrafficData trafficData) {
|
||||
TrafficMarkerDrawer.INSTANCE.updateITrafficThreatLevelInfo(trafficData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCvxRvInfoIndInfo(String uuid) {
|
||||
TrafficMarkerDrawer.INSTANCE.removeCvxRvInfoIndInfo(uuid);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl.marker;
|
||||
|
||||
public enum AdasRecognizedType {
|
||||
//背景
|
||||
classIdBackground("background", 0),
|
||||
//人
|
||||
classIdPerson("person", 1),
|
||||
//自行车
|
||||
classIdBicycle("bicycle", 2),
|
||||
//小轿车
|
||||
classIdCar("car", 3),
|
||||
//摩托车
|
||||
classIdMoto("moto", 4),
|
||||
//红绿灯
|
||||
classIdTrafficSign("traffic_sign", 5),
|
||||
//bus
|
||||
classIdTrafficBus("traffic_bus", 6),
|
||||
//truck
|
||||
classIdTrafficTruck("traffic_truck", 8),
|
||||
//stopLine
|
||||
classIdStopLine("warning_stop_line", 9),
|
||||
//预警箭头
|
||||
classIdWarningArrows("warning_arrows", 10),
|
||||
|
||||
//未知物体
|
||||
classIdUnKnow("unKnow", 100);
|
||||
|
||||
AdasRecognizedType(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
private String res = "";
|
||||
private int code = -1;
|
||||
|
||||
AdasRecognizedType(String res, int code) {
|
||||
this.res = res;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public static AdasRecognizedType[] VAL = {
|
||||
classIdBackground,//0
|
||||
classIdPerson,
|
||||
classIdBicycle,
|
||||
classIdCar,
|
||||
classIdMoto,
|
||||
classIdTrafficSign,
|
||||
classIdTrafficBus,
|
||||
null,
|
||||
classIdTrafficTruck,
|
||||
classIdStopLine,
|
||||
classIdWarningArrows,
|
||||
classIdUnKnow,
|
||||
};
|
||||
|
||||
public String getRes() {
|
||||
return res;
|
||||
}
|
||||
|
||||
public static AdasRecognizedType valueFrom(int code) {
|
||||
if (code == 100) {
|
||||
return classIdUnKnow;
|
||||
}
|
||||
if (code >= 0 && code < VAL.length) {
|
||||
return VAL[code];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl.marker.drawer;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.function.impl.marker.AdasRecognizedType;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/30
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class BaseDrawer {
|
||||
|
||||
protected final Context mContext;
|
||||
|
||||
public BaseDrawer() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取3D锚点模型资源
|
||||
*
|
||||
* @param type {@link AdasRecognizedType}
|
||||
* @return modelRes
|
||||
*/
|
||||
public int getModelRes(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
if (recognizedType == AdasRecognizedType.classIdCar) {
|
||||
return R.raw.traffic_tachexiaoche;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
|
||||
return R.raw.traffic_daba;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdMoto) {
|
||||
return R.raw.traffic_motuoche;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdStopLine) {
|
||||
return R.raw.stopline;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdWarningArrows) {
|
||||
return R.raw.jiantou;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) {
|
||||
return R.raw.special_vehicle;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdBicycle) {
|
||||
return R.raw.traffic_zixingche;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdTrafficTruck) {
|
||||
return R.raw.traffic_daba;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdPerson) {
|
||||
return R.raw.traffic_people;
|
||||
}
|
||||
return R.raw.special_vehicle;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl.marker.drawer;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.module.status.MogoStatusManager;
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnumNew;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerNoveltyInfo;
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerOnlineCar;
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerShareMusic;
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
|
||||
import com.mogo.eagle.core.function.impl.marker.view.EmptyMarkerView;
|
||||
import com.mogo.eagle.core.function.impl.marker.view.IMarkerView;
|
||||
import com.mogo.eagle.core.function.impl.marker.view.MapMarkerAdapter;
|
||||
import com.mogo.eagle.core.function.impl.marker.view.OnlineCarMarkerView;
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/28
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MarkerDrawer {
|
||||
|
||||
public static final int MARKER_Z_INDEX_HIGH = 100;
|
||||
public static final int MARKER_Z_INDEX_LOW = 2;
|
||||
|
||||
private static volatile MarkerDrawer sInstance;
|
||||
|
||||
private MarkerDrawer() {
|
||||
}
|
||||
|
||||
public static MarkerDrawer getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (MarkerDrawer.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MarkerDrawer();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, int zIndex, IMogoMarkerClickListener listener) {
|
||||
return drawMapMarkerImpl(markerShowEntity, false, zIndex, 0, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* add marker, { 如果是需要在3D模式下显示,则需要设置 {@link MogoMarkerOptions icon3DRes 资源id}}
|
||||
*
|
||||
* @param markerShowEntity marker展示数据结构体
|
||||
* @param matchRoadSide 设置是否道路吸附,暂时没用到这个字段
|
||||
* @param zIndex zOrder
|
||||
* @param icon3DRes 3D Res资源
|
||||
* @param listener marker回调
|
||||
* @return {@link IMogoMarker}
|
||||
*/
|
||||
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, int icon3DRes, IMogoMarkerClickListener listener) {
|
||||
if (markerShowEntity == null || markerShowEntity.getMarkerLocation() == null) {
|
||||
return null;
|
||||
}
|
||||
MogoMarkerOptions options = new MogoMarkerOptions().icon3DRes(icon3DRes).set3DMode(MogoStatusManager.getInstance().isVrMode()).matchOnRoadSide(matchRoadSide).owner(markerShowEntity.getMarkerType()).zIndex(zIndex).data(markerShowEntity).latitude(markerShowEntity.getMarkerLocation().getLat()).longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
|
||||
if (MogoStatusManager.getInstance().isVrMode()) {
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
if (bindObj instanceof MarkerExploreWay && ((MarkerExploreWay) bindObj).getPoiType() != null) {
|
||||
String poiType = ((MarkerExploreWay) bindObj).getPoiType();
|
||||
options.icon3DRes(EventTypeEnumNew.getMarker3DRes(poiType));
|
||||
}
|
||||
|
||||
}
|
||||
IMarkerView markerView = MapMarkerAdapter.getMarkerView(AbsMogoApplication.getApp(), markerShowEntity, options);
|
||||
if (markerView instanceof OnlineCarMarkerView) {
|
||||
try {
|
||||
options.icon(markerView.getBitmap(((MarkerOnlineCar) markerShowEntity.getBindObj()).getCarInfo().getVehicleType()));
|
||||
} catch (Exception e) {
|
||||
options.icon(markerView.getBitmap(0));
|
||||
}
|
||||
options.anchor(0.5f, 0.5f);
|
||||
} else {
|
||||
options.icon(markerView.getView());
|
||||
}
|
||||
|
||||
if (options.getIcon3DRes() != 0) {
|
||||
options.icon(new EmptyMarkerView(AbsMogoApplication.getApp()));
|
||||
options.icon(markerView.getBitmap(0));
|
||||
}
|
||||
|
||||
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
if (marker != null) {
|
||||
marker.setOwner(markerShowEntity.getMarkerType());
|
||||
markerView.setMarker(marker);
|
||||
marker.setOnMarkerClickListener(listener);
|
||||
}
|
||||
return marker;
|
||||
}
|
||||
|
||||
public String getPrimaryKeyFromEntity(Object entity) {
|
||||
if (entity instanceof MarkerExploreWay) {
|
||||
String id = ((MarkerExploreWay) entity).getInfoId();
|
||||
if (!TextUtils.isEmpty(id)) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
return getCarSnFromEntity(entity);
|
||||
}
|
||||
|
||||
private String getPrimaryKeyFromMarker(IMogoMarker marker) {
|
||||
if (marker == null || marker.getObject() == null || marker.isDestroyed()) {
|
||||
return null;
|
||||
}
|
||||
if (!(marker.getObject() instanceof MarkerShowEntity)) {
|
||||
return null;
|
||||
}
|
||||
return getPrimaryKeyFromEntity(((MarkerShowEntity) marker.getObject()).getBindObj());
|
||||
}
|
||||
|
||||
private String getCarSnFromEntity(Object entity) {
|
||||
try {
|
||||
if (entity instanceof MarkerOnlineCar) {
|
||||
return ((MarkerOnlineCar) entity).getUserInfo().getSn();
|
||||
} else if (entity instanceof MarkerShareMusic) {
|
||||
return ((MarkerShareMusic) entity).getUserInfo().getSn();
|
||||
} else if (entity instanceof MarkerNoveltyInfo) {
|
||||
return ((MarkerNoveltyInfo) entity).getSn();
|
||||
} else if (entity instanceof MarkerExploreWay) {
|
||||
return ((MarkerExploreWay) entity).getUserInfo().getSn();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 距离半径计算方式
|
||||
*
|
||||
* @param point1 点一坐标
|
||||
* @param point2 点二坐标
|
||||
* @return 两坐标的距离 单位:米(M)
|
||||
*/
|
||||
public static float calculateLineDistance(MogoLatLng point1, MogoLatLng point2) {
|
||||
if (point1 != null && point2 != null) {
|
||||
return calculateLineDistance(point1.lon, point1.lat, point2.lon, point2.lat);
|
||||
} else {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lon1
|
||||
* @param lat1
|
||||
* @param lon2
|
||||
* @param lat2
|
||||
* @return 两坐标的距离 单位:米(M)
|
||||
*/
|
||||
public static float calculateLineDistance(double lon1, double lat1, double lon2, double lat2) {
|
||||
return CoordinateUtils.calculateLineDistance(lon1, lat1, lon2, lat2);
|
||||
}
|
||||
}
|
||||
@@ -1,245 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl.marker.drawer
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.DataTypes
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.data.traffic.threatLevelColor
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
|
||||
import com.mogo.map.MogoMarkerManager
|
||||
import com.mogo.map.marker.IMogoMarker
|
||||
import com.mogo.map.marker.MogoMarkerOptions
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
* 此类用于obu/v2x预警绘制交通元素 2D\3D绘制
|
||||
* obu:与其进行调试单独展示,与debugview上感知开关相关联
|
||||
* v2x:绘制云端预警marker,不会做感知控制管理,后续根据注解的方式来控制v2x业务
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object TrafficMarkerDrawer {
|
||||
|
||||
private const val TAG = "TrafficMarkerDrawer"
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
// 动画持续时间
|
||||
private const val stepTime = 150L
|
||||
|
||||
// 维护Obu识别的他车集合
|
||||
private val mTrafficMap = ConcurrentHashMap<String, TrafficData>()
|
||||
|
||||
// 地图内部资源md5缓存,便于资源复用
|
||||
private val mMarkerCachesResMd5Values = ConcurrentHashMap<String, String>()
|
||||
|
||||
// 上一帧数据的缓存,用来做移动动画
|
||||
private val mMarkersCaches = ConcurrentHashMap<String, IMogoMarker>()
|
||||
|
||||
// 维护一个线程定时轮询数据进行地图绘制
|
||||
private val mDrawerHandler: Handler =
|
||||
object : Handler(WorkThreadHandler.newInstance("other_traffic_drawer").looper) {
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
if (FunctionBuildConfig.debugTrackerProvider == 1) {
|
||||
drawerTrafficInfo()
|
||||
}
|
||||
// 延时50毫秒重复发送自己,定时轮询进行车辆绘制,可以及时将已经不存在车辆删除
|
||||
sendEmptyMessageDelayed(0, 50L)
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
mContext = AbsMogoApplication.getApp()
|
||||
mDrawerHandler.sendEmptyMessageDelayed(1, 0L)
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新识别数据,V2V预警的时候需要修改车辆颜色
|
||||
*/
|
||||
fun updateITrafficInfo(trafficData: TrafficData) {
|
||||
if (trafficData.uuid != null) {
|
||||
mTrafficMap[trafficData.uuid!!] = trafficData
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新识别数据位置
|
||||
*/
|
||||
fun updateITrafficLocationInfo(trafficData: TrafficData) {
|
||||
CallerLogger.d(TAG, "updateITrafficLocationInfo trafficData = $trafficData")
|
||||
CallerLogger.d(TAG,
|
||||
"trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel + "----FunctionBuildConfig.debugTrackerProvider = " + FunctionBuildConfig.debugTrackerProvider)
|
||||
if (FunctionBuildConfig.debugTrackerProvider != 1) {
|
||||
return
|
||||
}
|
||||
val tempTraffic = mTrafficMap[trafficData.uuid]
|
||||
if (tempTraffic != null) {
|
||||
tempTraffic.lat = trafficData.lat
|
||||
tempTraffic.lon = trafficData.lon
|
||||
tempTraffic.heading = trafficData.heading
|
||||
if (trafficData.uuid != null) {
|
||||
mTrafficMap[trafficData.uuid!!] = tempTraffic
|
||||
}
|
||||
} else {
|
||||
if (trafficData.uuid != null) {
|
||||
mTrafficMap[trafficData.uuid!!] = trafficData
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新识别数据颜色
|
||||
*/
|
||||
fun updateITrafficThreatLevelInfo(trafficData: TrafficData) {
|
||||
CallerLogger.d(TAG,
|
||||
"trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel + "----FunctionBuildConfig.debugTrackerProvider = " + FunctionBuildConfig.debugTrackerProvider)
|
||||
if (FunctionBuildConfig.debugTrackerProvider != 1) {
|
||||
return
|
||||
}
|
||||
if (trafficData != null && !TextUtils.isEmpty(trafficData.uuid)) {
|
||||
val tempTraffic = mTrafficMap[trafficData.uuid]
|
||||
if (tempTraffic != null) {
|
||||
tempTraffic.lat = trafficData.lat
|
||||
tempTraffic.lon = trafficData.lon
|
||||
tempTraffic.heading = trafficData.heading
|
||||
tempTraffic.threatLevel = trafficData.threatLevel
|
||||
if (trafficData.uuid != null) {
|
||||
mTrafficMap[trafficData.uuid!!] = tempTraffic
|
||||
}
|
||||
} else {
|
||||
if (trafficData.uuid != null) {
|
||||
mTrafficMap[trafficData.uuid!!] = trafficData
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除识别的数据
|
||||
*/
|
||||
fun removeCvxRvInfoIndInfo(key: String) {
|
||||
if (mTrafficMap.containsKey(key)) {
|
||||
mTrafficMap.remove(key)
|
||||
mMarkersCaches.get(key)?.let {
|
||||
it.remove()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制
|
||||
*/
|
||||
private fun drawerTrafficInfo() {
|
||||
// 数据为空的时候清除所有数据
|
||||
if (mTrafficMap.isEmpty()) {
|
||||
mMarkersCaches.forEach {
|
||||
it.value.remove()
|
||||
}
|
||||
mMarkersCaches.clear()
|
||||
} else {
|
||||
// 循环绘制识别的数据
|
||||
mTrafficMap.forEach {
|
||||
|
||||
// 如果数据已经存在 Marker,取出做动画
|
||||
if (mMarkersCaches[it.key] != null) {
|
||||
mMarkersCaches[it.key]?.let { marker ->
|
||||
changeDynamicMarker(marker, it.value)
|
||||
}
|
||||
}
|
||||
// 不存在的添加Marker绘制
|
||||
else {
|
||||
drawObuRecognizedDataMarker(it.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绘制单条
|
||||
*/
|
||||
private fun drawObuRecognizedDataMarker(trafficData: TrafficData) {
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"drawObuRecognizedDataMarker trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel
|
||||
)
|
||||
if (trafficData.type != null) {
|
||||
val resId: Int = trafficData.type.traffic3DIconId
|
||||
|
||||
val resIdVal = resId.toString() + ""
|
||||
|
||||
val options = MogoMarkerOptions()
|
||||
.owner(DataTypes.TYPE_MARKER_ADAS)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.set3DMode(true)
|
||||
.gps(true)
|
||||
.controlAngle(true)
|
||||
.resName(mMarkerCachesResMd5Values[resIdVal])
|
||||
.icon3DRes(resId)
|
||||
.rotate(trafficData.heading.toFloat())
|
||||
.position(
|
||||
com.mogo.eagle.core.data.map.MogoLatLng(
|
||||
trafficData.lat,
|
||||
trafficData.lon
|
||||
)
|
||||
)
|
||||
|
||||
if (trafficData.type != TrafficTypeEnum.TYPE_TRAFFIC_ID_SPECIAL_VEHICLE) {
|
||||
// 修改颜色
|
||||
mMarkersCaches[trafficData.uuid]?.setAnchorColor(trafficData.threatLevelColor())
|
||||
}
|
||||
val marker = MogoMarkerManager.getInstance(mContext)
|
||||
.addMarker(DataTypes.TYPE_MARKER_OBU_DATA, options)
|
||||
|
||||
// 缓存3D资源
|
||||
mMarkerCachesResMd5Values[resIdVal] = marker.markerResName
|
||||
// 缓存数据
|
||||
if (trafficData.uuid != null) {
|
||||
mMarkersCaches[trafficData.uuid!!] = marker
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 带动画的修改Marker
|
||||
*/
|
||||
private fun changeDynamicMarker(
|
||||
marker: IMogoMarker,
|
||||
trafficData: TrafficData
|
||||
) {
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"changeDynamicMarker trafficData.type = " + trafficData.type + "---trafficData.threatLevel = " + trafficData.threatLevel
|
||||
)
|
||||
if (trafficData.type != TrafficTypeEnum.TYPE_TRAFFIC_ID_SPECIAL_VEHICLE) {
|
||||
mMarkersCaches[trafficData.uuid]?.setAnchorColor(trafficData.threatLevelColor())
|
||||
}
|
||||
|
||||
try {
|
||||
marker.addDynamicAnchorPosition(
|
||||
com.mogo.eagle.core.data.map.MogoLatLng(
|
||||
trafficData.lat,
|
||||
trafficData.lon
|
||||
),
|
||||
trafficData.heading.toFloat(),
|
||||
stepTime
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
try {
|
||||
drawObuRecognizedDataMarker(trafficData)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl.marker.drawer;
|
||||
|
||||
import static com.mogo.eagle.core.data.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
|
||||
import static com.mogo.eagle.core.data.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
|
||||
import com.mogo.eagle.core.function.impl.marker.view.IMarkerView;
|
||||
import com.mogo.eagle.core.function.impl.marker.view.MapMarkerAdapter;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
|
||||
|
||||
/**
|
||||
* 云端 预警数据绘制
|
||||
*/
|
||||
public class V2XWarnDataDrawer extends BaseDrawer {
|
||||
|
||||
private static volatile V2XWarnDataDrawer sInstance;
|
||||
private static final byte[] obj = new byte[0];
|
||||
|
||||
private V2XWarnDataDrawer() {
|
||||
super();
|
||||
}
|
||||
|
||||
public static V2XWarnDataDrawer getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (obj) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new V2XWarnDataDrawer();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 识别物移动
|
||||
*/
|
||||
public void renderWarnData(double lon, double lat, int type, double collisionlat, double collisionLon, double angle, long showTime) {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(lat);
|
||||
location.setLon(lon);
|
||||
location.setAngle(angle);
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setMarkerLocation(location);
|
||||
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA);
|
||||
IMogoMarker marker = drawMarker(markerShowEntity, modeResType(type));
|
||||
// marker.addDynamicAnchorPosition(new MogoLatLng(collisionlat, collisionLon), (float) heading, showTime * 1000);
|
||||
UiThreadHandler.postDelayed(marker::remove, showTime * 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据识别物类型 (行人1/自行车2/摩托车4/骑行车辆11)获取3D模型(对应查看getModelRes)
|
||||
*
|
||||
* @param dataType 数据类型
|
||||
* @return 做完映射后的数据类型
|
||||
*/
|
||||
private int modeResType(int dataType) {
|
||||
switch (dataType) {
|
||||
case 1:
|
||||
case 11:
|
||||
return 1;
|
||||
case 2:
|
||||
return 2;
|
||||
case 4:
|
||||
return 4;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制3D元素
|
||||
*
|
||||
* @param markerShowEntity 要展示的3d数据类型
|
||||
* @param modeResType
|
||||
* @return
|
||||
*/
|
||||
public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity, int modeResType) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.data(markerShowEntity)
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon())
|
||||
.controlAngle(true)
|
||||
.rotate((float) markerShowEntity.getMarkerLocation().getAngle())
|
||||
.setGps(true);
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(getModelRes(modeResType));
|
||||
options.anchorColor("#FB3C3CFF");
|
||||
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
|
||||
return marker;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制箭头
|
||||
* @param location
|
||||
* @param markerType
|
||||
* @param type
|
||||
* @param rotate
|
||||
*/
|
||||
public void drawerArrowsMarkerWithLocation(MogoLatLng location, String markerType, int type, int rotate) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.latitude(location.getLat())
|
||||
.longitude(location.getLon())
|
||||
.set3DMode(true)
|
||||
.setGps(true)
|
||||
.controlAngle(true)
|
||||
.icon3DRes(getModelRes(type))
|
||||
.anchorColor("#FB3C3CFF")
|
||||
.flat(true);
|
||||
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerType, options);
|
||||
marker.setRotateAngle(rotate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制停止线 marker
|
||||
*/
|
||||
public void renderStopLineData(double lon, double lat) {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(lat);
|
||||
location.setLon(lon);
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setMarkerLocation(location);
|
||||
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_STOP_LINE_DATA);
|
||||
IMogoMarker marker = drawStopLineMarker(markerShowEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止线绘制
|
||||
*/
|
||||
public IMogoMarker drawStopLineMarker(MarkerShowEntity markerShowEntity) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.data(markerShowEntity)
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon())
|
||||
.setGps(false);
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(getModelRes(9));
|
||||
options.anchorColor("#FB3C3CFF");
|
||||
IMogoMarker marker = MogoMarkerManager.getInstance(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
return marker;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl.marker.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/16
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class EmptyMarkerView extends View implements IMarkerView {
|
||||
|
||||
public EmptyMarkerView( Context context ) {
|
||||
this( context, null );
|
||||
}
|
||||
|
||||
public EmptyMarkerView( Context context, @Nullable AttributeSet attrs ) {
|
||||
this( context, attrs, 0 );
|
||||
}
|
||||
|
||||
public EmptyMarkerView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
|
||||
super( context, attrs, defStyleAttr );
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarker( IMogoMarker marker ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec ) {
|
||||
setMeasuredDimension( 1, 1 );
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl.marker.view;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-15
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public interface IMarkerView {
|
||||
|
||||
View getView();
|
||||
|
||||
default Bitmap getBitmap( int type ){
|
||||
return null;
|
||||
}
|
||||
|
||||
void setMarker( IMogoMarker marker );
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl.marker.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.ImageView;
|
||||
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
|
||||
/**
|
||||
* author : 李小鹏
|
||||
* desc : 地图2dMarker 在3d下的展示
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapCameraInfoView extends MapMarkerBaseView {
|
||||
private String TAG = "MapCameraInfoView";
|
||||
|
||||
private ImageView mCameraImage;
|
||||
|
||||
|
||||
public MapCameraInfoView(Context context ) {
|
||||
super( context );
|
||||
}
|
||||
|
||||
public MapCameraInfoView(Context context, @Nullable AttributeSet attrs ) {
|
||||
super( context, attrs );
|
||||
}
|
||||
|
||||
public MapCameraInfoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
|
||||
super( context, attrs, defStyleAttr );
|
||||
}
|
||||
|
||||
public MapCameraInfoView(Context context, MogoMarkerOptions options ) {
|
||||
super( context );
|
||||
mOptions = options;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView( Context context ) {
|
||||
LayoutInflater.from( context ).inflate( R.layout.modudle_camera_layout_info, this );
|
||||
mCameraImage = findViewById( R.id.iv_camera_traffic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateView( MarkerShowEntity markerShowEntity ) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl.marker.view;
|
||||
|
||||
import static com.mogo.commons.module.ServiceConst.CARD_TYPE_USER_DATA;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.module.status.MogoStatusManager;
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-1015:55
|
||||
* desc : 地图Marker的适配器
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerAdapter {
|
||||
|
||||
/**
|
||||
* 获取 MarkerShowEntity 填充好的 MarkerView
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param markerShowEntity 要填充的数据
|
||||
* @return MarkerView
|
||||
*/
|
||||
public static IMarkerView getMarkerView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options) {
|
||||
|
||||
if (TextUtils.equals(markerShowEntity.getMarkerType(), CARD_TYPE_USER_DATA)) {
|
||||
return OnlineCarMarkerView.getInstance();
|
||||
} else {
|
||||
if (MogoStatusManager.getInstance().isVrMode()) {
|
||||
return new EmptyMarkerView(context);
|
||||
} else {
|
||||
return new MapMarkerView(context, markerShowEntity, options);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl.marker.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Looper;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.glide.GlideImageLoader;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.eagle.core.utilcode.util.ViewUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.WindowUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.imageloader.IMogoImageLoaderListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-1310:55
|
||||
* desc : 地图上抽离的Marker的共性
|
||||
* version: 1.0
|
||||
*/
|
||||
public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerView {
|
||||
private String TAG = "MapMarkerBaseView";
|
||||
|
||||
protected Context mContext;
|
||||
protected MogoMarkerOptions mOptions;
|
||||
protected MogoImageView ivUserHead;
|
||||
protected MogoImageView ivIcon;
|
||||
protected ImageView ivCar;
|
||||
protected IMogoMarker mMarker;
|
||||
|
||||
public MapMarkerBaseView(Context context) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public MapMarkerBaseView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mContext = context;
|
||||
initView(context);
|
||||
}
|
||||
|
||||
public MapMarkerBaseView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mContext = context;
|
||||
initView(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarker(IMogoMarker marker) {
|
||||
this.mMarker = marker;
|
||||
}
|
||||
|
||||
protected abstract void initView(Context context);
|
||||
|
||||
public abstract void updateView(MarkerShowEntity markerShowEntity);
|
||||
|
||||
protected void loadImageWithMarker(final MarkerShowEntity markerShowEntity) {
|
||||
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
UiThreadHandler.post(() -> {
|
||||
runOnUiThread(markerShowEntity);
|
||||
});
|
||||
} else {
|
||||
runOnUiThread(markerShowEntity);
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadPoiTypeIcon(String url, int res) {
|
||||
ivIcon.setImageResource(res);
|
||||
if (Looper.myLooper() != Looper.getMainLooper()) {
|
||||
UiThreadHandler.post(() -> loadPoiTypeIconInUiThread(url, res));
|
||||
} else {
|
||||
loadPoiTypeIconInUiThread(url, res);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadPoiTypeIconInUiThread(String url, int res) {
|
||||
if (mMarker != null) {
|
||||
mMarker.setIcon(ViewUtils.fromView(MapMarkerBaseView.this));
|
||||
}
|
||||
if (!url.isEmpty()) {
|
||||
ivIcon.setPlaceHolder(res);
|
||||
ivIcon.setFailureHolder(res);
|
||||
GlideImageLoader.getInstance().displayImage(url,
|
||||
ivIcon, WindowUtils.dip2px(mContext, 50), WindowUtils.dip2px(mContext, 50),
|
||||
new IMogoImageLoaderListener() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted(Bitmap bitmap) {
|
||||
// 使用view渲染地图marker,刷新纹理的时候,需要重新用view生成纹理,然后在设置
|
||||
if (mMarker != null) {
|
||||
mMarker.setIcon(ViewUtils.fromView(MapMarkerBaseView.this));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void runOnUiThread(final MarkerShowEntity markerShowEntity) {
|
||||
if (!TextUtils.isEmpty(markerShowEntity.getIconUrl())) {
|
||||
GlideImageLoader.getInstance().displayImage(markerShowEntity.getIconUrl(),
|
||||
ivUserHead,
|
||||
WindowUtils.dip2px(mContext, 50), WindowUtils.dip2px(mContext, 50),
|
||||
new IMogoImageLoaderListener() {
|
||||
@Override
|
||||
public void onStart() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted(Bitmap bitmap) {
|
||||
// 使用view渲染地图marker,刷新纹理的时候,需要重新用view生成纹理,然后在设置
|
||||
if (mMarker != null) {
|
||||
mMarker.setIcon(ViewUtils.fromView(MapMarkerBaseView.this));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Exception e) {
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
ivUserHead.setBackgroundResource(R.drawable.icon_default_user_head);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl.marker.view;
|
||||
|
||||
import static com.mogo.commons.module.ServiceConst.CARD_TYPE_ROAD_CONDITION;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.module.status.MogoStatusManager;
|
||||
import com.mogo.eagle.core.data.map.PoiWrapper;
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.eagle.core.data.config.CloudPoiManager;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-0619:55
|
||||
* desc : 地图Marker图标
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerView extends MapMarkerBaseView {
|
||||
private String TAG = "MapMarkerView";
|
||||
|
||||
private FrameLayout clMarkerTopView;
|
||||
private MarkerShowEntity mMarkerShowEntity;
|
||||
|
||||
public MapMarkerView( Context context ) {
|
||||
super( context );
|
||||
}
|
||||
|
||||
public MapMarkerView( Context context, @Nullable AttributeSet attrs ) {
|
||||
super( context, attrs );
|
||||
}
|
||||
|
||||
public MapMarkerView( Context context, @Nullable AttributeSet attrs, int defStyleAttr ) {
|
||||
super( context, attrs, defStyleAttr );
|
||||
}
|
||||
|
||||
public MapMarkerView( Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options ) {
|
||||
super( context );
|
||||
mOptions = options;
|
||||
mMarkerShowEntity = markerShowEntity;
|
||||
try {
|
||||
updateView( markerShowEntity );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView( Context context ) {
|
||||
if ( MogoStatusManager.getInstance().isVrMode() ) {
|
||||
LayoutInflater.from( context ).inflate( R.layout.modudle_services_marker_vr_layout, this );
|
||||
} else {
|
||||
LayoutInflater.from( context ).inflate( R.layout.modudle_services_marker_layout, this );
|
||||
}
|
||||
clMarkerTopView = findViewById( R.id.clMarkerTopView );
|
||||
ivIcon = findViewById( R.id.ivIcon );
|
||||
ivCar = findViewById( R.id.ivCar );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateView( MarkerShowEntity markerShowEntity ) {
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
switch ( markerShowEntity.getMarkerType() ) {
|
||||
case CARD_TYPE_ROAD_CONDITION:
|
||||
if ( mMarkerShowEntity != null && mMarkerShowEntity.isChecked() ) {
|
||||
clMarkerTopView.setBackgroundResource( R.drawable.module_services_marker_vr_bkg_checked );
|
||||
}
|
||||
if ( bindObj instanceof MarkerExploreWay && ( ( MarkerExploreWay ) bindObj ).getPoiType() != null ) {
|
||||
// 根据poiType获取对应的图片
|
||||
String poiType = ( ( MarkerExploreWay ) bindObj ).getPoiType();
|
||||
PoiWrapper poiWrapper =
|
||||
CloudPoiManager.getInstance().getWrapperByPoiType( poiType );
|
||||
if ( poiWrapper != null ) {
|
||||
// 加载图片
|
||||
loadPoiTypeIcon( poiWrapper.getIconUrl(), poiWrapper.getIconRes() );
|
||||
} else {
|
||||
CallerLogger.INSTANCE.e( TAG, "未能根据poiType获取对应poi信息,无法渲染marker====" + poiType );
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.mogo.eagle.core.function.impl.marker.view;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-30
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class OnlineCarMarkerView implements IMarkerView {
|
||||
|
||||
private static Map< Integer, SoftReference< Bitmap > > sRef = new HashMap<>();
|
||||
|
||||
private OnlineCarMarkerView() {
|
||||
// private constructor
|
||||
}
|
||||
|
||||
private static final class InstanceHolder {
|
||||
private static final OnlineCarMarkerView INSTANCE = new OnlineCarMarkerView();
|
||||
}
|
||||
|
||||
public static OnlineCarMarkerView getInstance() {
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bitmap getBitmap( int vehicleType ) {
|
||||
if ( sRef.get( vehicleType ) == null || sRef.get( vehicleType ).get() == null
|
||||
|| sRef.get( vehicleType ).get().isRecycled() ) {
|
||||
switch ( vehicleType ) {
|
||||
case 5:
|
||||
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_taxi ) ) );
|
||||
break;
|
||||
case 6:
|
||||
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_bus ) ) );
|
||||
break;
|
||||
case 1:
|
||||
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_110 ) ) );
|
||||
break;
|
||||
case 2:
|
||||
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_120 ) ) );
|
||||
break;
|
||||
case 7:
|
||||
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_type_119 ) ) );
|
||||
break;
|
||||
default:
|
||||
sRef.put( vehicleType, new SoftReference<>( BitmapFactory.decodeResource( AbsMogoApplication.getApp().getResources(), R.drawable.icon_map_marker_car_gray ) ) );
|
||||
}
|
||||
}
|
||||
return sRef.get( vehicleType ).get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarker( IMogoMarker marker ) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user