wait to finish
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.function.map
|
||||
package com.mogo.eagle.core.function.business
|
||||
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.function.impl.collect
|
||||
package com.mogo.eagle.core.function.business.collect
|
||||
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.function.map.identify;
|
||||
package com.mogo.eagle.core.function.business.identify;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.function.map.identify
|
||||
package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import mogo.telematics.pad.MessagePad
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.mogo.eagle.core.function.map.identify
|
||||
package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
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.module.common.MogoApisHandler
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
|
||||
@@ -38,7 +38,7 @@ class IdentifyBeautifyDataDrawer : Identify {
|
||||
w(TAG, "感知数据为空无需渲染……")
|
||||
return
|
||||
}
|
||||
if (!MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) {
|
||||
if (!MogoStatusManager.getInstance().isVrMode) {
|
||||
TrackManager.getInstance().clearAll()
|
||||
w(TAG, "渲染 adas 识别的数据 当前不是VR模式")
|
||||
return
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.function.map.identify
|
||||
package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.mogo.eagle.core.function.map.identify
|
||||
package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.collection.ArraySet
|
||||
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.module.common.MogoApisHandler
|
||||
import mogo.telematics.pad.MessagePad.PlanningObject
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
@@ -60,7 +60,7 @@ class IdentifyOriginDataDrawer : Identify {
|
||||
w(TAG, "感知数据为空无需渲染……")
|
||||
return
|
||||
}
|
||||
if (!MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) {
|
||||
if (!MogoStatusManager.getInstance().isVrMode) {
|
||||
clearOldMarker()
|
||||
w(TAG, "渲染 adas 识别的数据 当前不是VR模式")
|
||||
return
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.function.map.identify;
|
||||
package com.mogo.eagle.core.function.business.identify;
|
||||
|
||||
public class KalmanFilter {
|
||||
private final double q = 1.0E-6D;
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.mogo.eagle.core.function.map
|
||||
package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoSubscriber
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
|
||||
import com.mogo.eagle.core.function.map.identify.IdentifyFactory
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.function.map.identify;
|
||||
package com.mogo.eagle.core.function.business.identify;
|
||||
|
||||
public class ObjQueue {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.function.map.identify
|
||||
package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
data class PlanningTrack(var color: String, var time: Double) {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.function.map.identify;
|
||||
package com.mogo.eagle.core.function.business.identify;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Build;
|
||||
@@ -1,9 +1,8 @@
|
||||
package com.mogo.eagle.core.function.map.identify;
|
||||
package com.mogo.eagle.core.function.business.identify;
|
||||
|
||||
import static com.mogo.eagle.core.function.map.identify.TrackManager.LIMIT_SPEED;
|
||||
import static com.mogo.eagle.core.function.business.identify.TrackManager.LIMIT_SPEED;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.eagle.core.function.map.identify
|
||||
package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
@@ -1,13 +1,11 @@
|
||||
package com.mogo.eagle.core.function.map.identify
|
||||
package com.mogo.eagle.core.function.business.identify
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.FOUNDATION
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.data.traffic.threatLevelColor
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getCurWgs84SatelliteTime
|
||||
import com.zhjt.service_biz.BizConfig
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.PlanningObject
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.mogo.eagle.core.function.business.routeoverlay;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
public class MogoRouteOverlayManager implements
|
||||
IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener, IMoGoMapLocationListener {
|
||||
private static volatile MogoRouteOverlayManager sInstance;
|
||||
private static final String TAG = "Route";
|
||||
|
||||
private final AtomicBoolean isArriveAtStation = new AtomicBoolean(false);
|
||||
private final AtomicInteger autopilotMode = new AtomicInteger(0);
|
||||
|
||||
private final LinkedList<List<MessagePad.TrajectoryPoint>> queue = new LinkedList<>();
|
||||
|
||||
private MogoRouteOverlayManager() {}
|
||||
|
||||
|
||||
public void init() {
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false);
|
||||
}
|
||||
|
||||
public static MogoRouteOverlayManager getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (MogoRouteOverlayManager.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new MogoRouteOverlayManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotTrajectory(@NonNull List<MessagePad.TrajectoryPoint> items) {
|
||||
synchronized (queue) {
|
||||
queue.clear();
|
||||
queue.offer(items);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
|
||||
if (from != 1 || location == null) {
|
||||
return;
|
||||
}
|
||||
if (isArriveAtStation.get() && autopilotMode.get() != 1) {
|
||||
Logger.d(TAG, "--- onLocationChanged 1 -- [isDemo1: " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + ",isDemo2:" +FunctionBuildConfig.isDemoMode + ",isGps:" + isGps + ",mode:" + autopilotMode.get() + ",lon:" + location.getLongitude() + ",lat:" + location.getLatitude() + ",angle:" + location.getBearing() + "]");
|
||||
RouteOverlayDrawer.getInstance().clearMogoRouteOverlay();
|
||||
return;
|
||||
}
|
||||
boolean force = FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData;
|
||||
if (!force && autopilotMode.get() != 1) {
|
||||
Logger.d(TAG, "--- onLocationChanged 2 -- [isDemo1: " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + ",isDemo2:" +FunctionBuildConfig.isDemoMode + ",isGps:" + isGps + ",mode:" + autopilotMode.get() + ",lon:" + location.getLongitude() + ",lat:" + location.getLatitude() + ",angle:" + location.getBearing() + "]");
|
||||
RouteOverlayDrawer.getInstance().clearMogoRouteOverlay();
|
||||
return;
|
||||
}
|
||||
synchronized (queue) {
|
||||
if (!queue.isEmpty()) {
|
||||
List<MessagePad.TrajectoryPoint> items = queue.pollLast();
|
||||
if (items != null && !items.isEmpty()) {
|
||||
Logger.d(TAG, "--- onLocationChanged -- [isDemo1: " + FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData + ",isDemo2:" +FunctionBuildConfig.isDemoMode + ",isGps:" + isGps + ",mode:" + autopilotMode.get() + ",lon:" + location.getLongitude() + ",lat:" + location.getLatitude() + ",angle:" + location.getBearing() + "]");
|
||||
RouteOverlayDrawer.getInstance().drawTrajectoryList(items, location.getBearing());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp globalPathResp) {}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
int mode = autoPilotStatusInfo.getPilotmode();
|
||||
if (mode == 1) {
|
||||
isArriveAtStation.set(false);
|
||||
}
|
||||
this.autopilotMode.set(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification arrivalNotification) {
|
||||
if (arrivalNotification == null) {
|
||||
return;
|
||||
}
|
||||
if (!isArriveAtStation.get()) {
|
||||
isArriveAtStation.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAutopilotSNRequest() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotGuardian(MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotIpcConnectStatusChanged(int status, @androidx.annotation.Nullable String reason) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
package com.mogo.eagle.core.function.business.routeoverlay;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
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.CallerAutoPilotStatusListenerManager;
|
||||
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.module.common.utils.DrivingDirectionUtils;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class RouteOverlayDrawer {
|
||||
|
||||
private static final String TAG = "MogoRouteOverlayManager";
|
||||
|
||||
// 连接线参数
|
||||
private Handler mRenderHandler;
|
||||
IMogoOverlayManager mogoOverlayManager;
|
||||
private static volatile RouteOverlayDrawer sInstance;
|
||||
private final MogoPolylineOptions mPolylineOptions;
|
||||
private volatile IMogoPolyline mMoGoPolyline;
|
||||
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();
|
||||
}
|
||||
|
||||
public static RouteOverlayDrawer getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (RouteOverlayDrawer.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new RouteOverlayDrawer();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void clearMogoRouteOverlay() {
|
||||
if (mRenderTask != null) {
|
||||
mRenderHandler.removeCallbacks(mRenderTask);
|
||||
}
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mMoGoPolyline = null;
|
||||
}
|
||||
}
|
||||
|
||||
private class RenderTask implements Runnable {
|
||||
private volatile List<MessagePad.TrajectoryPoint> routeList;
|
||||
|
||||
private final Pools.Pool<MogoLatLng> pools;
|
||||
private final LinkedList<MogoLatLng> points;
|
||||
|
||||
private double bearing;
|
||||
|
||||
public RenderTask() {
|
||||
this.pools = new Pools.SimplePool<>(500);
|
||||
this.points = new LinkedList<>();
|
||||
}
|
||||
|
||||
public void setData(List<MessagePad.TrajectoryPoint> routeList, double bearing) {
|
||||
this.routeList = routeList;
|
||||
this.bearing = bearing;
|
||||
}
|
||||
|
||||
@SuppressLint("LongLogTag")
|
||||
@Override
|
||||
public void run() {
|
||||
LinkedList<MogoLatLng> pps = this.points;
|
||||
boolean isExcept = false;
|
||||
int total;
|
||||
try {
|
||||
pps.clear();
|
||||
List<MessagePad.TrajectoryPoint> routes = this.routeList;
|
||||
if (routes == null || (total = routes.size()) < 2) {
|
||||
isExcept = true;
|
||||
return;
|
||||
}
|
||||
RouteStrategy.INSTANCE.start();
|
||||
for (int i = 0; i < total; i++) {
|
||||
MessagePad.TrajectoryPoint route = null;
|
||||
try {
|
||||
route = routes.get(i);
|
||||
if (route == null) {
|
||||
continue;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
Log.d("Route", "render-error:" + t.getMessage());
|
||||
}
|
||||
if (route == null) {
|
||||
//数组越界了,结束循环
|
||||
break;
|
||||
}
|
||||
MogoLatLng acquire = pools.acquire();
|
||||
double latitude = route.getLatitude();
|
||||
double longitude = route.getLongitude();
|
||||
if (acquire == null) {
|
||||
acquire = new MogoLatLng(latitude, longitude);
|
||||
} else {
|
||||
acquire.lon = longitude;
|
||||
acquire.lat = latitude;
|
||||
}
|
||||
acquire.acc = route.getAcceleration();
|
||||
acquire.speed = route.getVelocity();
|
||||
pps.add(acquire);
|
||||
RouteStrategy.INSTANCE.check(route.getVelocity(), route.getAcceleration(), routeList.size());
|
||||
}
|
||||
double lon = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon();
|
||||
double lat = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat();
|
||||
if (points.size() > 0) {
|
||||
MogoLatLng top = null;
|
||||
while (points.size() != 0) {
|
||||
MogoLatLng first = points.peek();
|
||||
if (first == null) {
|
||||
continue;
|
||||
}
|
||||
if (first == top) {
|
||||
break;
|
||||
}
|
||||
lon = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon();
|
||||
lat = CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat();
|
||||
long angle = isPointOnCarFront(lon, lat, bearing, first.lon, first.lat);
|
||||
if (angle >= 90) {
|
||||
RouteStrategy.INSTANCE.remove(first.acc);
|
||||
pools.release(first);
|
||||
points.poll();
|
||||
}
|
||||
top = first;
|
||||
}
|
||||
if (points.size() == 0) {
|
||||
isExcept = true;
|
||||
return;
|
||||
}
|
||||
MogoLatLng self = pools.acquire();
|
||||
if (self == null) {
|
||||
self = new MogoLatLng(lat, lon);
|
||||
} else {
|
||||
self.lat = lat;
|
||||
self.lon = lon;
|
||||
}
|
||||
points.addFirst(self);
|
||||
RouteStrategy.INSTANCE.end();
|
||||
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);
|
||||
} 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);
|
||||
}
|
||||
if (mMoGoPolyline != null && !mMoGoPolyline.isDestroyed() && !mMoGoPolyline.isVisible()) {
|
||||
mMoGoPolyline.setVisible(true);
|
||||
}
|
||||
} else {
|
||||
isExcept = true;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
} finally {
|
||||
if (isExcept) {
|
||||
setVisible(false);
|
||||
}
|
||||
if (points.size() > 0) {
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
MogoLatLng latLng = points.get(i);
|
||||
if (latLng == null) {
|
||||
continue;
|
||||
}
|
||||
pools.release(latLng);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private long isPointOnCarFront(double car_lon, double car_lat, double car_head, double lon, double lat) {
|
||||
return DrivingDirectionUtils.getDegreeOfCar2Poi2(car_lon, car_lat, lon, lat, car_head);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public void setVisible(boolean isVisible) {
|
||||
if (mMoGoPolyline != null && !mMoGoPolyline.isDestroyed()) {
|
||||
mMoGoPolyline.setVisible(isVisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package com.mogo.eagle.core.function.business.routeoverlay
|
||||
|
||||
import android.animation.*
|
||||
import android.graphics.*
|
||||
import android.view.animation.*
|
||||
import com.mogo.eagle.core.data.config.*
|
||||
import com.mogo.eagle.core.utilcode.mogo.*
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_BLUE
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_BLUE_DARK
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_RED_DARK
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.Colors.Companion.COLOR_TRANSPARENT
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
|
||||
interface IStrategy {
|
||||
fun getColors(): List<Int>
|
||||
}
|
||||
|
||||
class Colors {
|
||||
|
||||
companion object {
|
||||
val COLOR_BLUE = Color.parseColor("#FF2ABAD9")
|
||||
val COLOR_BLUE_DARK = Color.parseColor("#FF074EFF")
|
||||
val COLOR_RED_DARK = Color.parseColor("#FFFF5F00")
|
||||
val COLOR_TRANSPARENT = Color.parseColor("#002ABAD9")
|
||||
}
|
||||
}
|
||||
|
||||
sealed class Strategy: IStrategy
|
||||
|
||||
class DefaultStrategy(private val colors: List<Int>? = null): Strategy() {
|
||||
|
||||
override fun getColors(): List<Int> = colors ?: listOf(COLOR_BLUE, COLOR_TRANSPARENT)
|
||||
}
|
||||
|
||||
class ColorfulStrategy(private val colors: List<Int> = emptyList(), var isLightOn: Boolean): Strategy() {
|
||||
override fun getColors(): List<Int> = colors
|
||||
}
|
||||
|
||||
object RouteStrategy {
|
||||
|
||||
@Volatile
|
||||
private var isEnable = !AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
|
||||
|
||||
private var strategy: Strategy? = null
|
||||
|
||||
private val colors: ArrayList<Int> = ArrayList()
|
||||
|
||||
private var index = 0
|
||||
|
||||
private val sorted: NavigableMap<Double, Int> by lazy { TreeMap() }
|
||||
|
||||
private var endEvaluator: ArgbEvaluator? = null
|
||||
|
||||
private var startColor = Int.MAX_VALUE
|
||||
|
||||
private var hasLessThan0 = false
|
||||
|
||||
fun enable(enable: Boolean) {
|
||||
isEnable = enable
|
||||
if (!enable) {
|
||||
strategy = null
|
||||
colors.clear()
|
||||
}
|
||||
}
|
||||
|
||||
fun start() {
|
||||
if (sorted.isEmpty()) {
|
||||
fill()
|
||||
}
|
||||
strategy = null
|
||||
index = 0
|
||||
startColor = Int.MAX_VALUE
|
||||
colors.clear()
|
||||
endEvaluator = null
|
||||
hasLessThan0 = false
|
||||
}
|
||||
|
||||
fun end() {
|
||||
if (isEnable) {
|
||||
if (colors.isEmpty()) {
|
||||
return
|
||||
}
|
||||
val first = colors[0]
|
||||
colors.add(0, first)
|
||||
strategy = ColorfulStrategy(colors, true)
|
||||
}
|
||||
}
|
||||
|
||||
fun check(speed: Double, acc: Double, total: Int) {
|
||||
if (!isEnable){
|
||||
return
|
||||
}
|
||||
if (sorted.isEmpty()) {
|
||||
return
|
||||
}
|
||||
if (acc < 0) {
|
||||
hasLessThan0 = true
|
||||
}
|
||||
val delta = (total * 0.35).toInt()
|
||||
val last = total - delta
|
||||
val entry = sorted.floorEntry(acc)
|
||||
if (entry != null) {
|
||||
if (index >= last - 1) {
|
||||
if (startColor == Int.MAX_VALUE) {
|
||||
startColor = entry.value
|
||||
if (endEvaluator == null) {
|
||||
endEvaluator = ArgbEvaluator()
|
||||
}
|
||||
colors += entry.value
|
||||
} else {
|
||||
if (endEvaluator != null) {
|
||||
val fraction = (index - last) * 1.0f / delta
|
||||
colors += endEvaluator!!.evaluate(fraction, startColor, COLOR_TRANSPARENT) as Int
|
||||
}
|
||||
}
|
||||
} else {
|
||||
colors += entry.value
|
||||
}
|
||||
}
|
||||
index++
|
||||
}
|
||||
|
||||
fun remove(acc: Double): List<Int> {
|
||||
if (!isEnable) {
|
||||
return emptyList()
|
||||
}
|
||||
if (sorted.isEmpty()) {
|
||||
throw AssertionError("sorted map must not be null.")
|
||||
}
|
||||
val entry = sorted.floorEntry(acc)
|
||||
if (entry != null) {
|
||||
colors.remove(entry.value)
|
||||
}
|
||||
return ArrayList(colors)
|
||||
}
|
||||
|
||||
private fun fill() {
|
||||
var startValue = -4.0
|
||||
var endValue = 0.0
|
||||
val step = 0.01
|
||||
var current = startValue
|
||||
val evaluator = ArgbEvaluator()
|
||||
val interceptor = AccelerateInterpolator()
|
||||
var total = endValue - startValue
|
||||
while (current <= endValue) {
|
||||
val fraction = interceptor.getInterpolation(((current - startValue) / total).toFloat())
|
||||
val colorValue = evaluator.evaluate(fraction, COLOR_RED_DARK, COLOR_BLUE) as Int
|
||||
sorted[current] = colorValue
|
||||
current += step
|
||||
}
|
||||
startValue = 0.01
|
||||
endValue = 3.0
|
||||
current = startValue
|
||||
total = endValue - startValue
|
||||
while (current <= endValue) {
|
||||
val fraction = (current - startValue) / total
|
||||
val colorValue = evaluator.evaluate(fraction.toFloat(), COLOR_BLUE, COLOR_BLUE_DARK) as Int
|
||||
sorted[current] = colorValue
|
||||
current += step
|
||||
}
|
||||
}
|
||||
|
||||
fun getStrategy(): Strategy = if (isEnable) { (strategy ?: DefaultStrategy()) } else DefaultStrategy()
|
||||
}
|
||||
@@ -6,7 +6,6 @@ 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.eagle.core.function.marker.MogoMarkerServiceImpl;
|
||||
import com.mogo.map.MogoGeoSearch;
|
||||
import com.mogo.map.MogoLocationClient;
|
||||
import com.mogo.map.MogoMap;
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
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.MarkerDrawer;
|
||||
import com.mogo.eagle.core.function.impl.marker.TrafficMarkerDrawer;
|
||||
import com.mogo.eagle.core.function.impl.marker.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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.mogo.eagle.core.function.impl.marker;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.mogo.eagle.core.function.impl.marker;
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mogo.eagle.core.function.impl.marker;
|
||||
|
||||
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 );
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.mogo.eagle.core.function.impl.marker;
|
||||
|
||||
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.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.R;
|
||||
|
||||
/**
|
||||
* 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 ) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.mogo.eagle.core.function.impl.marker;
|
||||
|
||||
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;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
|
||||
/**
|
||||
* 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(), ModuleNames.CARD_TYPE_USER_DATA ) ) {
|
||||
return OnlineCarMarkerView.getInstance();
|
||||
} else {
|
||||
if ( MogoStatusManager.getInstance().isVrMode() ) {
|
||||
return new EmptyMarkerView( context );
|
||||
} else {
|
||||
if ( markerShowEntity.isChecked() ) {
|
||||
return new MapMarkerInfoView( context, markerShowEntity, options );
|
||||
} else {
|
||||
return new MapMarkerView( context, markerShowEntity, options );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.mogo.eagle.core.function.impl.marker;
|
||||
|
||||
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.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.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.imageloader.IMogoImageLoaderListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.imageloader.MogoImageView;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.mogo.eagle.core.function.impl.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.module.status.MogoStatusManager;
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
|
||||
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.marker.PoiWrapper;
|
||||
import com.mogo.module.common.utils.CloudPoiManager;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-0619:55
|
||||
* desc : 地图Marker图标带文本信息
|
||||
* version: 1.0
|
||||
*/
|
||||
public class MapMarkerInfoView extends MapMarkerBaseView {
|
||||
private String TAG = "MapMarkerInfoView";
|
||||
|
||||
private TextView tvMarkerContent;
|
||||
private LinearLayout clMarkerContent;
|
||||
private ImageView ivReverseTriangle;
|
||||
|
||||
public MapMarkerInfoView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public MapMarkerInfoView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
public MapMarkerInfoView(Context context, MarkerShowEntity markerShowEntity, MogoMarkerOptions options) {
|
||||
super(context);
|
||||
mOptions = options;
|
||||
try {
|
||||
updateView(markerShowEntity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.modudle_services_marker_layout_info, this);
|
||||
ivUserHead = findViewById(R.id.ivUserHead);
|
||||
// ivIcon = findViewById( R.id.ivIcon );
|
||||
ivIcon = findViewById(R.id.ivIcon);
|
||||
clMarkerContent = findViewById(R.id.clMarkerContent);
|
||||
ivReverseTriangle = findViewById(R.id.ivReverseTriangle);
|
||||
ivCar = findViewById(R.id.ivCar);
|
||||
tvMarkerContent = findViewById(R.id.tvMarkerContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateView(MarkerShowEntity markerShowEntity) {
|
||||
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
|
||||
if (MogoStatusManager.getInstance().isVrMode()) {
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_yellow_vr);
|
||||
} else {
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_location_yellow);
|
||||
}
|
||||
clMarkerContent.setBackgroundResource(R.drawable.bg_map_marker_yellow_info);
|
||||
ivReverseTriangle.setImageResource(R.drawable.bg_shape_reverse_yellow);
|
||||
switch (markerShowEntity.getMarkerType()) {
|
||||
case ModuleNames.CARD_TYPE_USER_DATA:
|
||||
ivUserHead.setVisibility(View.VISIBLE);
|
||||
ivIcon.setVisibility(View.INVISIBLE);
|
||||
loadImageWithMarker(markerShowEntity);
|
||||
ivCar.setImageResource(R.drawable.icon_map_marker_car_gray);
|
||||
//ivCar.setRotation(new Random().nextInt(360));
|
||||
ivCar.setRotation((float) markerShowEntity.getMarkerLocation().getAngle());
|
||||
break;
|
||||
case ModuleNames.CARD_TYPE_ROAD_CONDITION:
|
||||
ivUserHead.setVisibility(View.INVISIBLE);
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
|
||||
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.getIconInfoUrl(), poiWrapper.getIconInfoRes());
|
||||
} else {
|
||||
CallerLogger.INSTANCE.e(TAG, "未能根据poiType获取对应poi信息,无法渲染info marker====" + poiType);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (!TextUtils.isEmpty(markerShowEntity.getTextContent())) {
|
||||
String content;
|
||||
if (markerShowEntity.getTextContent().length() > 8) {
|
||||
content = markerShowEntity.getTextContent().substring(0, 7) + "...";
|
||||
} else {
|
||||
content = markerShowEntity.getTextContent();
|
||||
}
|
||||
tvMarkerContent.setText(content);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.mogo.eagle.core.function.impl.marker;
|
||||
|
||||
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.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.module.common.ModuleNames;
|
||||
import com.mogo.module.common.marker.PoiWrapper;
|
||||
import com.mogo.module.common.utils.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 ModuleNames.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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package com.mogo.eagle.core.function.impl.marker;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.module.status.MogoStatusManager;
|
||||
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.map.MogoMarkerManager;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.eagle.core.data.enums.EventTypeEnum;
|
||||
|
||||
/**
|
||||
* @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(EventTypeEnum.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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.mogo.eagle.core.function.impl.marker;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.R;
|
||||
|
||||
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 ) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
package com.mogo.eagle.core.function.impl.marker
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import android.text.TextUtils
|
||||
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) {
|
||||
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) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制
|
||||
*/
|
||||
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,
|
||||
"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,
|
||||
"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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.mogo.eagle.core.function.impl.marker;
|
||||
|
||||
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.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)
|
||||
private int modeResType(int dataType) {
|
||||
switch (dataType) {
|
||||
case 1:
|
||||
case 11:
|
||||
return 1;
|
||||
case 2:
|
||||
return 2;
|
||||
case 4:
|
||||
return 4;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,9 @@ import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider;
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener;
|
||||
import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber;
|
||||
import com.mogo.eagle.core.function.business.MapPointCloudSubscriber;
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager;
|
||||
@@ -186,6 +189,7 @@ public class MapFragment extends MvpFragment<MapView, MapPresenter>
|
||||
|
||||
// TODO 临时初始化地图监听工控机、OBU等数据监听器,用于感知元素绘制
|
||||
MapIdentifySubscriber.Companion.getInstance();
|
||||
MogoRouteOverlayManager.getInstance().init();
|
||||
MapPointCloudSubscriber.Companion.getInstance();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.mogo.eagle.core.function.marker;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.marker.MapMarkerManager;
|
||||
|
||||
|
||||
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 MapMarkerManager.getInstance().drawMapMarker(((MarkerShowEntity) object), MarkerDrawer.MARKER_Z_INDEX_HIGH);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -56,7 +56,6 @@ public class SmallMapFragment extends BaseFragment
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
SmpServiceManager.init(getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,24 +84,14 @@ public class SmallMapFragment extends BaseFragment
|
||||
public void drawablePolyline(List<MogoLatLng> coordinates) {
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.convert(coordinates);
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mSmallMapDirectionView.drawablePolyline();
|
||||
}
|
||||
});
|
||||
UiThreadHandler.post(() -> mSmallMapDirectionView.drawablePolyline());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPolyline() {
|
||||
if (mSmallMapDirectionView != null) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mSmallMapDirectionView.clearPolyline();
|
||||
}
|
||||
});
|
||||
UiThreadHandler.post(() -> mSmallMapDirectionView.clearPolyline());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020-01-2114:01
|
||||
* desc : V2X 服务
|
||||
* version: 1.0
|
||||
*/
|
||||
public class SmpServiceManager {
|
||||
private static final String TAG = "V2XServiceManager";
|
||||
private static boolean isInit;
|
||||
private static Context mContext;
|
||||
private static IMogoServiceApis mMogoServiceApis;
|
||||
private static IMogoRegisterCenter mMogoRegisterCenter;
|
||||
|
||||
private SmpServiceManager() {
|
||||
|
||||
}
|
||||
|
||||
public static void init(final Context context) {
|
||||
if (!isInit) {
|
||||
isInit = true;
|
||||
mContext = context;
|
||||
mMogoServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
|
||||
mMogoRegisterCenter = mMogoServiceApis.getRegisterCenterApi();
|
||||
}
|
||||
}
|
||||
|
||||
public static Context getContext() {
|
||||
return mContext;
|
||||
}
|
||||
|
||||
public static IMogoRegisterCenter getMogoRegisterCenter() {
|
||||
return mMogoRegisterCenter;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user