Merge branch 'dev_robo_240612_6.5.0_tmp' of gitlab.zhidaoauto.com:SCA/L4HA/AndroidApp/MoGoEagleEye into dev_robo_240612_6.5.0_tmp
This commit is contained in:
@@ -28,7 +28,7 @@ public class MogoApplication extends MainMoGoApplication {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
// TraceNodeCore.Companion.getTraceNodeCore().setDebugMode(false); //todo
|
||||
// TraceNodeCore.Companion.getTraceNodeCore().setDebugMode(false); //debuggable验证时打开
|
||||
ARouterStartUp.init(this);
|
||||
ConfigStartUp.init(this);
|
||||
tryEnableStrictMode();
|
||||
|
||||
@@ -16,12 +16,12 @@ import com.mogo.eagle.core.function.api.datacenter.union.IMoGoTrafficLightListen
|
||||
import com.mogo.eagle.core.function.api.v2x.IMoGoVipSetListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallerTrafficLightListenerManager
|
||||
import com.mogo.eagle.core.function.call.v2x.CallVipSetListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
|
||||
import com.mogo.eagle.core.utilcode.util.LocationUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.function.biz.v2x.trafficlight.core.MogoTrafficLightManager
|
||||
@@ -108,10 +108,7 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener,
|
||||
val distance = if (roadResult != null && roadResult.rectLatLngs.size >= 2) {
|
||||
getMinDistance(roadResult.rectLatLngs, it.latitude, it.longitude)
|
||||
} else {
|
||||
CallerMapUIServiceManager.getMapUIController()?.calculateLineDistance(
|
||||
MogoLatLng(it.latitude, it.longitude),
|
||||
MogoLatLng(trafficLightResult.lat, trafficLightResult.lon)
|
||||
) ?: 0f
|
||||
CoordinateUtils.calculateLineDistance(it.latitude, it.longitude,trafficLightResult.lat, trafficLightResult.lon)
|
||||
}
|
||||
CallerLogger.d(
|
||||
"$M_V2X$TAG",
|
||||
|
||||
@@ -117,6 +117,7 @@ open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocatio
|
||||
//The animation interval of Map
|
||||
private var mDuration = 100
|
||||
//whether to set weather
|
||||
@Volatile
|
||||
private var mIsWeatherEnable = true
|
||||
//The controller of weather
|
||||
private var mWeatherController: IWeatherController? = null
|
||||
|
||||
@@ -65,10 +65,10 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
MogoMap.Companion.getMapInstance().clear(getInstanceTag());
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onDestroy();
|
||||
}
|
||||
MogoMap.Companion.getMapInstance().clear(getInstanceTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,6 +52,10 @@ data class Polyline(val id: String, val owner: String, val level: Level, val opt
|
||||
|
||||
val lightSpeed: Float = builder.lightSpeed
|
||||
|
||||
val customTexture: Bitmap? = builder.customTexture
|
||||
|
||||
val isShowArrow: Boolean = builder.isShowArrow
|
||||
|
||||
fun builder(): Builder {
|
||||
return builder
|
||||
}
|
||||
@@ -92,6 +96,10 @@ data class Polyline(val id: String, val owner: String, val level: Level, val opt
|
||||
|
||||
internal var lightSpeed: Float = 0f
|
||||
|
||||
internal var customTexture: Bitmap? = null
|
||||
|
||||
internal var isShowArrow: Boolean = false
|
||||
|
||||
fun setId(id: String) = apply {
|
||||
this.id = id
|
||||
}
|
||||
@@ -160,6 +168,14 @@ data class Polyline(val id: String, val owner: String, val level: Level, val opt
|
||||
this.lightSpeed = speed
|
||||
}
|
||||
|
||||
fun setCustomTexture(texture: Bitmap) = apply {
|
||||
this.customTexture = texture
|
||||
}
|
||||
|
||||
fun isShowArrow(show: Boolean) = apply {
|
||||
this.isShowArrow = show
|
||||
}
|
||||
|
||||
fun build(): Options {
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
id = UUID.randomUUID().toString()
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.*
|
||||
import androidx.annotation.*
|
||||
import com.mogo.map.overlay.core.*
|
||||
import com.mogo.map.overlay.proxy.point.*
|
||||
import java.lang.ref.WeakReference
|
||||
import java.util.*
|
||||
|
||||
data class Point(val id: String, val owner: String, val level: Level, val option: Options) {
|
||||
@@ -149,6 +150,11 @@ data class Point(val id: String, val owner: String, val level: Level, val option
|
||||
* 是否切换到当前marker所在的视角
|
||||
*/
|
||||
val moveToCenter: Boolean = builder.moveToCenter
|
||||
|
||||
/**
|
||||
* marker点击事件处理
|
||||
*/
|
||||
val onClickHandler: WeakReference<((id:String) -> Unit)>? = builder.onMarkerClickListener
|
||||
|
||||
fun builder(): Builder {
|
||||
return builder
|
||||
@@ -280,6 +286,11 @@ data class Point(val id: String, val owner: String, val level: Level, val option
|
||||
*/
|
||||
internal var moveToCenter: Boolean = true
|
||||
|
||||
/**
|
||||
* Marker点击事件回调
|
||||
*/
|
||||
internal var onMarkerClickListener:WeakReference<((id: String) -> Unit)>? = null
|
||||
|
||||
fun setId(id: String) = apply {
|
||||
this.id = id
|
||||
}
|
||||
@@ -411,6 +422,13 @@ data class Point(val id: String, val owner: String, val level: Level, val option
|
||||
this.moveToCenter = flag
|
||||
}
|
||||
|
||||
/**
|
||||
* marker点击事件监听
|
||||
*/
|
||||
fun onClick(listener: ((id: String) -> Unit)) = apply {
|
||||
this.onMarkerClickListener = WeakReference(listener)
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建Options对象
|
||||
*/
|
||||
|
||||
@@ -164,15 +164,6 @@ interface IMogoMapUIController {
|
||||
*/
|
||||
fun forceRender()
|
||||
|
||||
/**
|
||||
* 计算两点之间的距离
|
||||
*
|
||||
* @param p1
|
||||
* @param p2
|
||||
* @return
|
||||
*/
|
||||
fun calculateLineDistance(p1: MogoLatLng, p2: MogoLatLng): Float
|
||||
|
||||
/**
|
||||
* 锁车状态
|
||||
*
|
||||
|
||||
@@ -539,13 +539,6 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle
|
||||
}
|
||||
}
|
||||
|
||||
override fun calculateLineDistance(p1: MogoLatLng, p2: MogoLatLng): Float {
|
||||
return MogoMapUtils.calculateLineDistance(
|
||||
ObjectUtils.fromMogo(p1),
|
||||
ObjectUtils.fromMogo(p2)
|
||||
)
|
||||
}
|
||||
|
||||
@get:Synchronized
|
||||
override val isCarLocked: Boolean
|
||||
get() = mMapView.getMapAutoViewHelper()!!.getLockMode()
|
||||
|
||||
@@ -12,7 +12,9 @@ import com.mogo.map.overlay.wrapper.point.AMapPointWrapper
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController
|
||||
import com.mogo.map.utils.ObjectUtils
|
||||
import com.zhidaoauto.map.sdk.open.renders.marker.BatchMarkerOptions
|
||||
import com.zhidaoauto.map.sdk.open.renders.marker.Marker
|
||||
import com.zhidaoauto.map.sdk.open.renders.marker.MarkerSimpleData
|
||||
import com.zhidaoauto.map.sdk.open.renders.marker.OnMarkClickListener
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
@@ -54,6 +56,13 @@ class AMapWrapper(map: MapAutoViewHelper?, mapView: MapAutoView, controller: IMo
|
||||
return null
|
||||
}
|
||||
val delegate = mAMap!!.addMarker(markerOptions) ?: return null
|
||||
options.onClickHandler?.get()?.also {
|
||||
delegate.setOnMarkClickListener(object : OnMarkClickListener {
|
||||
override fun onMarkClick(marker: Marker) {
|
||||
it.invoke(marker.getId() ?: "")
|
||||
}
|
||||
})
|
||||
}
|
||||
return AMapPointWrapper(options.id, delegate, mMapView)
|
||||
}
|
||||
|
||||
|
||||
@@ -88,46 +88,4 @@ public class MogoMapUtils {
|
||||
|
||||
return new LatLngBounds.Builder().include( new LonLatPoint( east, north ) ).include( new LonLatPoint( west, south ) ).build();
|
||||
}
|
||||
|
||||
public static float calculateLineDistance(LonLatPoint var0, LonLatPoint var1) {
|
||||
if (var0 != null && var1 != null) {
|
||||
try {
|
||||
double var2 = var0.getLongitude();
|
||||
double var4 = var0.getLatitude();
|
||||
double var6 = var1.getLongitude();
|
||||
double var8 = var1.getLatitude();
|
||||
var2 *= 0.01745329251994329D;
|
||||
var4 *= 0.01745329251994329D;
|
||||
var6 *= 0.01745329251994329D;
|
||||
var8 *= 0.01745329251994329D;
|
||||
double var10 = Math.sin(var2);
|
||||
double var12 = Math.sin(var4);
|
||||
double var14 = Math.cos(var2);
|
||||
double var16 = Math.cos(var4);
|
||||
double var18 = Math.sin(var6);
|
||||
double var20 = Math.sin(var8);
|
||||
double var22 = Math.cos(var6);
|
||||
double var24 = Math.cos(var8);
|
||||
double[] var28 = new double[3];
|
||||
double[] var29 = new double[3];
|
||||
var28[0] = var16 * var14;
|
||||
var28[1] = var16 * var10;
|
||||
var28[2] = var12;
|
||||
var29[0] = var24 * var22;
|
||||
var29[1] = var24 * var18;
|
||||
var29[2] = var20;
|
||||
return (float)(Math.asin(Math.sqrt((var28[0] - var29[0]) * (var28[0] - var29[0]) + (var28[1] - var29[1]) * (var28[1] - var29[1]) + (var28[2] - var29[2]) * (var28[2] - var29[2])) / 2.0D) * 1.27420015798544E7D);
|
||||
} catch (Throwable var26) {
|
||||
var26.printStackTrace();
|
||||
return 0.0F;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
throw new Exception("非法坐标值");
|
||||
} catch (Exception var27) {
|
||||
var27.printStackTrace();
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,6 +229,16 @@ public class ObjectUtils {
|
||||
target.setIsBright(true);
|
||||
target.setBrightColor(options.getLightColor());
|
||||
target.setBrightSpeed(options.getLightSpeed());
|
||||
} else {
|
||||
target.setIsBright(false);
|
||||
}
|
||||
Bitmap bitmap = options.getCustomTexture();
|
||||
if (bitmap != null) {
|
||||
target.useTexture(true);
|
||||
target.customTexture(bitmap);
|
||||
}
|
||||
if (options.isShowArrow()) {
|
||||
target.setIsArrow(true);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
@@ -55,27 +55,6 @@ public class PointInterpolatorUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 道路吸附算法
|
||||
* <p>
|
||||
* 所谓的道路数据,实际就是道路对应的点集,每两个点之间是直线,但是两点间距并不固定,点集内点的数量也不固定,点集是有序的,按道路方向排序,road[0]是起点。
|
||||
* 为了避免拐弯道路的问题,先使用{@link #getCloseTwoPoint(int, int, double, double, List)}从道路数据里面找出距离目标点最近的两个点,记为A、B,最近的两个点就在目标点一前一后排列,
|
||||
* 这样的话,求一下目标点到AB的垂直映射以及距离{@link #getFootAndMinDistance(double, double, double, double, double, double)},就是吸附后的经纬度和距离
|
||||
*
|
||||
* @param lon 目标经度
|
||||
* @param lat 目标纬度
|
||||
* @param road 目标道路数据
|
||||
* @return double[]{吸附后的经度,吸附后的纬度,目标经纬度距离道路的垂直距离}
|
||||
*/
|
||||
public static double[] mergeToRoad(double lon, double lat, ArrayList<LonLatPoint> road) {
|
||||
int closeStart = 0;
|
||||
int closeEnd = road.size() - 1;
|
||||
int[] result = getCloseTwoPoint(closeStart, closeEnd, lon, lat, road);
|
||||
LonLatPoint start = road.get(result[0]);
|
||||
LonLatPoint end = road.get(result[1]);
|
||||
return getFootAndMinDistance(lon, lat, start.getLongitude(), start.getLatitude(), end.getLongitude(), end.getLatitude());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取距离目标点经纬度最近的道路点index
|
||||
* <p>
|
||||
|
||||
Reference in New Issue
Block a user