Merge branch 'dev_robotaxi-d-app-module_2110_220915_2.11.0' into 'test_robotaxi-d-app-module_2110_220915_2.11.0.1'

Dev robotaxi d app module 2110 220915 2.11.0

See merge request zhjt/AndroidApp/MoGoEagleEye!226
This commit is contained in:
wangmingjun
2022-09-28 11:27:19 +00:00
39 changed files with 1006 additions and 47958 deletions

View File

@@ -48,6 +48,7 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
BusPassengerStation station = mStations.get(position);
StationViewHolder viewHolder = (StationViewHolder)holder;
viewHolder.stationName.setText(station.getName());
BlinkAnimationUtil.clearAnimation(viewHolder.stationCircle);
if (position == 0){ //第一个 起点
viewHolder.stationTagTxt.setText("");
viewHolder.stationStationTag.setBackground(mContext.getDrawable(R.drawable.bg_bus_p_start_tag_bg));
@@ -58,7 +59,6 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_green);
BlinkAnimationUtil.setAnimation(viewHolder.stationCircle);
}else {
BlinkAnimationUtil.clearAnimation(viewHolder.stationCircle);
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_gray);
}
@@ -74,7 +74,6 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
BusPassengerStation preStation = mStations.get(position -1);
if (station.getDrivingStatus() == STATION_STATUS_LEAVING ||
(station.getDrivingStatus() == STATION_STATUS_STOPPED && station.isLeaving())){ //过站
BlinkAnimationUtil.clearAnimation(viewHolder.stationCircle);
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
viewHolder.curArrowBg.setImageResource(R.drawable.bus_p_line_grey);
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_gray);
@@ -91,7 +90,6 @@ public class BusPassengerLineStationsAdapter extends RecyclerView.Adapter<Recycl
}else if (station.getDrivingStatus() == STATION_STATUS_ARRIVING &&
(preStation.getDrivingStatus() == STATION_STATUS_ARRIVING
|| preStation.getDrivingStatus() == STATION_STATUS_STOPPED)){ //未到站的并且前面也是未到站或者刚到站的
BlinkAnimationUtil.clearAnimation(viewHolder.stationCircle);
viewHolder.stationName.setTextColor(mContext.getResources().getColor(R.color.bus_p_station_txt_color));
viewHolder.curArrowBg.setImageResource(R.drawable.bus_p_line_blue);
viewHolder.stationCircle.setImageResource(R.drawable.bus_p_point_blue);

View File

@@ -106,14 +106,14 @@ public class BusPassengerMapDirectionView
initAMapView();
// 注册定位监听
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
// 注册定位监听
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG);
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG, false);
}
private void initAMapView() {
@@ -182,7 +182,7 @@ public class BusPassengerMapDirectionView
@Override
public void onLocationChanged(@Nullable MogoLocation location, int from) {
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
if (location == null) {
return;
}

View File

@@ -147,7 +147,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_260"
android:paddingBottom="@dimen/dp_30"
android:paddingBottom="@dimen/dp_20"
android:paddingLeft="@dimen/dp_30"
android:paddingRight="@dimen/bus_p_route_info_margin_right"
android:requiresFadingEdge="vertical"

View File

@@ -22,12 +22,13 @@
app:layout_constraintTop_toBottomOf="@+id/bus_p_cur_arrow_bg"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="62px"
android:layout_height="62px"
android:src="@drawable/bus_p_point_gray"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@+id/bus_p_station"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_station"/>
app:layout_constraintTop_toTopOf="@+id/bus_p_circle"
app:layout_constraintBottom_toBottomOf="@+id/bus_p_circle"
app:layout_constraintLeft_toLeftOf="@+id/bus_p_circle"
app:layout_constraintRight_toRightOf="@+id/bus_p_circle"/>
<ImageView
android:id="@+id/bus_p_circle"

View File

@@ -91,10 +91,6 @@ public class BusPresenter extends Presenter<BusFragment>
BusOrderModel.getInstance().setPassengerCallback(null);
}
public void queryBusRoutes() {
BusOrderModel.getInstance().queryBusRoutes();
}
public void abortTask() {
BusOrderModel.getInstance().abortTask();
}

View File

@@ -6,7 +6,6 @@ import android.view.LayoutInflater
import android.widget.ImageView
import android.widget.LinearLayout
import androidx.core.content.ContextCompat
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.bus.R
import com.mogo.och.common.module.utils.BlinkAnimationUtil
import kotlinx.android.synthetic.main.bus_stations_common_item.view.*
@@ -33,31 +32,43 @@ class BusStationCommonItem @JvmOverloads constructor(
busStationNameTv.setTextColor(color)
}
fun setStationPointBg(type: Int){ // 0:灰色 过站 1绿色 到站或者即将到站 2蓝色未到站
UiThreadHandler.post(Runnable {
BlinkAnimationUtil.clearAnimation(busCircleIv)
when(type){
0 -> {
busCircleIv.setImageDrawable(null)
busCircleIv.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_point_grey_bus))
}
1 -> {
busCircleIv.setImageDrawable(null)
busCircleIv.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_point_green_bus))
BlinkAnimationUtil.setAnimation(busCircleIv)
}
2 -> {
busCircleIv.setImageDrawable(null)
busCircleIv.setImageDrawable(ContextCompat.getDrawable(context,R.drawable.icon_point_blue_bus))
}
fun setStationPointBg(type: Int) { // 0:灰色 过站 1绿色 到站或者即将到站 2蓝色未到站
BlinkAnimationUtil.clearAnimation(busCircleIv)
when (type) {
0 -> {
busCircleIvBg.visibility = GONE
busCircleIv.setImageDrawable(
ContextCompat.getDrawable(
context,
R.drawable.icon_point_grey_bus
)
)
}
})
1 -> {
busCircleIvBg.visibility = VISIBLE
busCircleIv.setImageDrawable(
ContextCompat.getDrawable(
context,
R.drawable.icon_point_green_bus
)
)
BlinkAnimationUtil.setAnimation(busCircleIv)
}
2 -> {
busCircleIvBg.visibility = GONE
busCircleIv.setImageDrawable(
ContextCompat.getDrawable(
context,
R.drawable.icon_point_blue_bus
)
)
}
}
}
fun getCircleImageView() : ImageView{
return busCircleIv;
return busCircleIv
}
fun setStationArrowBg(type: Int){// 0:灰色 过站 1绿色 前往下一站 2蓝色 未到站

View File

@@ -16,6 +16,7 @@ import com.mogo.och.common.module.biz.constant.TaxiLoginStatusEnum
import com.mogo.och.common.module.biz.constant.LoginStatusManager
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
import com.mogo.och.common.module.biz.network.OchCommonServiceManager
import com.mogo.och.common.module.utils.ToastUtilsOch
/**
* Created by pangfan on 2021/8/19
@@ -93,7 +94,7 @@ object OchCommonLoginModel{
}
override fun onFail(code: Int, msg: String) {
ToastUtils.showShort("$code,$msg")
ToastUtilsOch.showWithCodeMessage(code,msg)
}
})
}
@@ -127,7 +128,7 @@ object OchCommonLoginModel{
}
override fun onFail(code: Int, msg: String) {
ToastUtils.showShort("$code,$msg")
ToastUtilsOch.showWithCodeMessage(code,msg)
}
})
}

View File

@@ -54,6 +54,14 @@ class TaxiLoginDialogFragment : MvpDialogFragment<TaxiLoginDialogFragment?, OchC
setStyle(STYLE_NO_TITLE, R.style.DialogFullScreen) //dialog全屏
}
override fun onResume() {
super.onResume()
dialog?.let {
it.window?.let {window->
BarUtils.setNavBarVisibility(window,false)
}
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,

View File

@@ -12,6 +12,13 @@ public class BlinkAnimationUtil {
//实现图片闪烁效果
public static void setAnimation(ImageView imageView) {
Object animObject = imageView.getTag(imageView.getId());
if (animObject instanceof AnimatorSet){
AnimatorSet animatorSet = (AnimatorSet)animObject;
animatorSet.start();
return;
}
AnimatorSet animationSet = new AnimatorSet();
imageView.setTag(imageView.getId(),animationSet);
@@ -32,7 +39,7 @@ public class BlinkAnimationUtil {
Object animObject = imageView.getTag(imageView.getId());
if (animObject instanceof AnimatorSet){
AnimatorSet animatorSet = (AnimatorSet)animObject;
animatorSet.cancel();
animatorSet.end();
}
}
}

View File

@@ -104,14 +104,14 @@ public class TaxiPassengerMapDirectionView
initAMapView();
// 注册定位监听
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
// 注册定位监听
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG);
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG, false);
}
private void initAMapView() {
@@ -180,7 +180,7 @@ public class TaxiPassengerMapDirectionView
@Override
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from) {
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
if (location == null){
return;
}

View File

@@ -13,6 +13,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.BarUtils
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.common.module.utils.NumberFormatUtil
import com.mogo.och.taxi.passenger.R
@@ -293,6 +294,7 @@ class VideoActivity : AppCompatActivity() {
override fun onResume() {
super.onResume()
BarUtils.setNavBarVisibility(window,false)
val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager
val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager)
if(centerItemPosition<0){

View File

@@ -61,54 +61,54 @@ class RoadAITest {
.setRoadId("200091")
.setLaneNo("-2")
.setTileId("556834853")
.setBearing(156)
.setBearing(90)
.build())
.setPoint(GPSPoint_PB
.newBuilder()
.setLat(26.819533419884188)
.setLon(112.57506466334905)
.setLat(40.20313763799314)
.setLon(116.72844402744953)
.build())
.build())
.addPolygon(0, GPSPoint_PB
.newBuilder()
.setLat(26.819544927961125)
.setLon(112.57503948748804)
.setLat(40.20314863899314)
.setLon(116.72844412744953)
.build())
.addPolygon(1, GPSPoint_PB
.newBuilder()
.setLat(26.81953162903423)
.setLon(112.57503758421541)
.setLat(40.20314563819314)
.setLon(116.72844412744953)
.build())
.addPolygon(2, GPSPoint_PB
.newBuilder()
.setLat(26.81952255026517)
.setLon(112.5750496963295)
.setLat(40.20312263869314)
.setLon(116.72844401744953)
.build())
.addPolygon(3, GPSPoint_PB
.newBuilder()
.setLat(26.819517691652617)
.setLon(112.57507582382465)
.build())
.addPolygon(4, GPSPoint_PB
.newBuilder()
.setLat(26.819521911807858)
.setLon(112.57508983920647)
.build())
.addPolygon(5, GPSPoint_PB
.newBuilder()
.setLat(26.819535210732194)
.setLon(112.57509174248064)
.build())
.addPolygon(6, GPSPoint_PB
.newBuilder()
.setLat(26.81954428950259)
.setLon(112.5750796303722)
.build())
.addPolygon(7, GPSPoint_PB
.newBuilder()
.setLat(26.819549148117684)
.setLon(112.57505350287552)
.setLat(40.20322763889314)
.setLon(116.7284381644953)
.build())
// .addPolygon(4, GPSPoint_PB
// .newBuilder()
// .setLat(26.819521911807858)
// .setLon(112.57508983920647)
// .build())
// .addPolygon(5, GPSPoint_PB
// .newBuilder()
// .setLat(26.819535210732194)
// .setLon(112.57509174248064)
// .build())
// .addPolygon(6, GPSPoint_PB
// .newBuilder()
// .setLat(26.81954428950259)
// .setLon(112.5750796303722)
// .build())
// .addPolygon(7, GPSPoint_PB
// .newBuilder()
// .setLat(26.819549148117684)
// .setLon(112.57505350287552)
// .build())
.addRoad(0, Road_PB
.newBuilder()
.setRoadId("200090")

View File

@@ -50,6 +50,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPointCloudList
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager.invokeAutopilotRecordResult
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotVehicleStateListenerManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister
import com.zhidao.support.adas.high.AdasManager
import com.zhidao.support.adas.high.OnAdasListener
@@ -210,6 +211,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
autopilotStatusInfo.dockVersion = it.dockVersion
AppConfigInfo.dockerVersion = it.dockVersion
}
CallerLogger.d("Upgrade", "origin = ${autopilotStatusInfo.connectStatus} -----now = ${AppConfigInfo.isConnectAutopilot} ")
AppConfigInfo.isConnectAutopilot = autopilotStatusInfo.connectStatus
AppConfigInfo.connectStatusDescribe = autopilotStatusInfo.connectStatusDescribe
invokeAutoPilotStatus()
@@ -311,7 +313,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
header: MessagePad.Header,
carConfigResp: MessagePad.CarConfigResp?
) {
if (HdMapBuildConfig.isMapLoaded && carConfigResp != null) {
if (/*HdMapBuildConfig.isMapLoaded &&*/ carConfigResp != null) {
AppConfigInfo.plateNumber = carConfigResp.plateNumber//车牌号
AppConfigInfo.iPCMacAddress = carConfigResp.macAddress//工控机MAC地址
AppConfigInfo.protocolVersionNumber = carConfigResp.protocolVersionValue//工控机协议版本

View File

@@ -137,13 +137,23 @@ class MoGoAdasMsgConnectStatusListenerImpl : OnAdasConnectStatusListener,
*/
private fun syncBasicInfoToAutopilot(sn: String? = null) {
CallerLogger.d("$M_ADAS_IMPL$TAG", "同步PAD的SN给工控机……")
// 设置PAD-SN给工控,网络环境
AdasManager.getInstance()
.sendBasicInfoResp(
MoGoAiCloudClientConfig.getInstance().sn,
getEnvironment(),
getTerminalRole()
)
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
// 设置PAD-SN给工控,网络环境
AdasManager.getInstance()
.sendBasicInfoResp(
MoGoAiCloudClientConfig.getInstance().sn,
getEnvironment(),
getTerminalRole()
)
} else {
// 乘客屏先不传sn
AdasManager.getInstance()
.sendBasicInfoResp(
"",
getEnvironment(),
getTerminalRole()
)
}
}
private fun getEnvironment(): Int {

View File

@@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.autopilot.adapter;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
@@ -115,6 +116,7 @@ public class MoGoHandAdasMsgManager implements
@Override
public void onAutopilotCarConfig(@NotNull MessagePad.CarConfigResp carConfigResp) {
if (carConfigResp != null && !TextUtils.isEmpty(carConfigResp.getMacAddress())) {
Log.d("Upgrade", "MoGoHandAdasMsgManager address = " + carConfigResp.getMacAddress());
CallerBindingcarManager.getBindingcarProvider().getBindingcarInfo(carConfigResp.getMacAddress(), MoGoAiCloudClientConfig.getInstance().getSn());
}
}

View File

@@ -63,6 +63,7 @@ public class UpgradeAppNetWorkManager {
// String mac = "48:b0:2d:3a:bc:78";
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
int versionCode = AppUtils.getAppVersionCode();
CallerLogger.INSTANCE.d(TAG, "getAppUpgradeInfo mac = " + mac + "---type = " + screenType + "---sn = " + sn + "---versionCode =" + versionCode);
Log.d("Upgrade", "mac = " + mac + "---type = " + screenType + "---sn = " + sn + "---versionCode =" + versionCode);
UpgradeAppRequest request = new UpgradeAppRequest(sn, mac, screenType);
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
@@ -84,6 +85,7 @@ public class UpgradeAppNetWorkManager {
}
} else {
Log.e(TAG, "onNext info == null");
CallerLogger.INSTANCE.d(TAG, "UpgradeAppInfo onNext info == null");
}
}

View File

@@ -47,7 +47,7 @@ class FuncConfigCenter : IMogoOnMessageListener<FuncConfig>, IMoGoAutopilotCarCo
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {
if (!carConfigResp.macAddress.isNullOrEmpty()) {
UiThreadHandler.post {
funcConfigNetWorkModel.requestFuncConfig({
funcConfigNetWorkModel.requestFuncConfig(carConfigResp.macAddress, {
SPUtils.getInstance("biz_config").put("config", GsonUtils.toJson(it))
refreshConfig(it)
}, {

View File

@@ -21,6 +21,7 @@ class FuncConfigNetWorkModel {
private var error: ((String) -> Unit)? = null
fun requestFuncConfig(
mac:String,
onSuccess: ((FuncConfig) -> Unit)? = null,
onError: ((String) -> Unit)? = null
) {
@@ -34,11 +35,8 @@ class FuncConfigNetWorkModel {
error = onError
}
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
// map["sn"] = "X20202203105S688HZ"
map["mac"] = DeviceUtils.getMacAddress()
// map["mac"] = "48:b0:2d:3a:bc:78"
map["mac"] = mac
map["channelVersion"] = FuncConfigConst.getChannelCode()
// map["channelVersion"] = 1
}
loader {
apiCall {
@@ -51,7 +49,7 @@ class FuncConfigNetWorkModel {
} else {
if (retryTime < 3) {
retryTime += 1
requestFuncConfig()
requestFuncConfig(mac)
} else {
error?.invoke("FuncConfig error msg is null")
}
@@ -60,7 +58,7 @@ class FuncConfigNetWorkModel {
onError {
if (retryTime < 3) {
retryTime += 1
requestFuncConfig()
requestFuncConfig(mac)
} else if (it.message != null) {
error?.invoke(it.message ?: "FuncConfig error msg is null")
}

View File

@@ -11,7 +11,6 @@ import android.text.Html
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.widget.*
import androidx.annotation.RequiresApi
import androidx.appcompat.widget.PopupMenu
import androidx.constraintlayout.widget.ConstraintLayout
@@ -61,7 +60,6 @@ import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.ui.logcatch.ILogViewListener
import com.mogo.eagle.core.function.hmi.ui.logcatch.LogInfoView
import com.mogo.eagle.core.function.hmi.ui.upgrade.UpgradeListAdapter
import com.mogo.eagle.core.network.*
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.LogLevel
@@ -186,7 +184,7 @@ class DebugSettingView @JvmOverloads constructor(
// 添加 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.addListener(TAG, this)
// 添加 地图样式改变 监听
CallerMapLocationListenerManager.addListener(TAG, this)
CallerMapLocationListenerManager.addListener(TAG, this, false)
// 添加 域控制器感知数据 监听
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
// 添加 规划路径相关回调 监听
@@ -221,7 +219,7 @@ class DebugSettingView @JvmOverloads constructor(
// 移除 ADAS车辆状态&定位 监听
CallerAutopilotCarStatusListenerManager.removeListener(TAG)
// 移除 地图样式改变 监听
CallerMapLocationListenerManager.removeListener(TAG)
CallerMapLocationListenerManager.removeListener(TAG, false)
// 移除 域控制器感知数据 监听
CallerAutopilotIdentifyListenerManager.removeListener(TAG)
// 移除 规划路径相关回调 监听
@@ -2014,7 +2012,7 @@ class DebugSettingView @JvmOverloads constructor(
}
}
override fun onLocationChanged(location: MogoLocation?, from: Int) {
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
}
/**

View File

@@ -76,22 +76,23 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
}
private void queryAppUpgrade() {
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
Log.e("Upgrade", "queryAppUpgrade isConnectAutopilot = " + AppConfigInfo.INSTANCE.isConnectAutopilot());
if (AppConfigInfo.INSTANCE.isConnectAutopilot()) {
MoGoHandAdasMsgManager.getInstance(getBaseContext()).getConfig();
}
}
},8000);
// UiThreadHandler.postDelayed(new Runnable() {
// @Override
// public void run() {
// CallerLogger.INSTANCE.d("Upgrade","queryAppUpgrade isConnectAutopilot = " + AppConfigInfo.INSTANCE.isConnectAutopilot());
// Log.e("Upgrade", "queryAppUpgrade isConnectAutopilot = " + AppConfigInfo.INSTANCE.isConnectAutopilot());
// if (AppConfigInfo.INSTANCE.isConnectAutopilot()) {
// MoGoHandAdasMsgManager.getInstance(getBaseContext()).getConfig();
// }
// }
// },9000);
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
CallerBindingcarManager.getBindingcarProvider().queryAppUpgrade();
}
},10000);
},9000);
}
private void checkMonitorDb() {

View File

@@ -6,7 +6,6 @@ import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.cloud.passport.IMoGoTokenCallback
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_MAP
import com.mogo.eagle.core.data.map.MogoLocation
@@ -46,7 +45,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
private var hasInit = false
override fun init(context: Context?) {
CallerMapLocationListenerManager.addListener(functionName, this)
CallerMapLocationListenerManager.addListener(functionName, this, false)
executor.set(context?.let {
GatherApi.also { itx ->
itx.init(it,
@@ -65,7 +64,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
}
override fun onDestroy() {
CallerMapLocationListenerManager.removeListener("$M_MAP$TAG")
CallerMapLocationListenerManager.removeListener("$M_MAP$TAG", false)
CallerLogger.d("$M_MAP$TAG", "--------- onDestroy --------")
executor.get()?.setOnTaskListener(null)
listeners.clear()
@@ -148,7 +147,7 @@ class MoGoMapDataCollectProvider : IMoGoMapDataCollectProvider, OnTaskListener,
}
}
override fun onLocationChanged(location: MogoLocation?, from: Int) {
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
location ?: return
executor.get()?.updateLocation(
location.longitude,

View File

@@ -43,12 +43,12 @@ object TrackerSourceHelper {
}
if (isV2I(data).second) {
color = "#00AEFF"
color = "#00AEFFFF"
}
//等级最高
if (isObu(data).second) {
color = "#36D3FE"
color = "#36D3FEFF"
// obu预警
isObu(data).first?.let {
val obuColor = WarningHelper.getObuColor(it.id)

View File

@@ -130,7 +130,7 @@ public class AMapCustomView
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
initAMapView(context);
// 注册定位监听
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false);
//设置全览模式
overLayerView.setOnClickListener(v -> {
displayCustomOverView();
@@ -258,7 +258,7 @@ public class AMapCustomView
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
// 注册定位监听
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG);
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG, false);
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(TAG);
}
@@ -269,7 +269,7 @@ public class AMapCustomView
@Override
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from) {
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
mLocation = location;
MarkerDrawerManager.INSTANCE.setLonLat(new Pair(location.getLongitude(), location.getLatitude()));
drawCarMarker(location);

View File

@@ -99,14 +99,14 @@ public class SmallMapDirectionView
initAMapView();
// 注册定位监听
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
// 注册定位监听
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG);
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG, false);
}
private void initAMapView() {
@@ -162,7 +162,7 @@ public class SmallMapDirectionView
@Override
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from) {
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
if (location == null) {
return;
}

View File

@@ -14,7 +14,6 @@ import com.mogo.cloud.passport.IMoGoTokenCallback
import com.mogo.cloud.passport.MoGoAiCloudClient
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.network.ParamsUtil
import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_CLOUD_V2N
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_CLOUD_SHOW
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_CLOUD_V2N
@@ -140,7 +139,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
private fun registerListener() {
V2XManager.addCallback(this)
CallerMapLocationListenerManager.addListener(TAG, this)
CallerMapLocationListenerManager.addListener(TAG, this, false)
BridgeApi.registerCenter()?.let {
it.registerMogoMapListener(MODULE_NAME, this)
it.registerMogoMarkerClickListener(
@@ -160,7 +159,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
private fun unRegisterListener() {
V2XManager.removeCallback(this)
CallerMapLocationListenerManager.removeListener(TAG)
CallerMapLocationListenerManager.removeListener(TAG, false)
BridgeApi.registerCenter()?.let {
it.unregisterMogoMapListener(MODULE_NAME)
it.unregisterMogoMarkerClickListener(ModuleNames.CARD_TYPE_ROAD_CONDITION)
@@ -331,7 +330,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
})
}
override fun onLocationChanged(location: MogoLocation?, from: Int) {
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
location ?: return
BridgeApi.location.set(location)
if (V2XManager.hasInit()) {
@@ -485,7 +484,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
val p = CoordinateUtils.transformWgsToGcj(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0)
l4.lon = p[0]
l4.lat = p[1]
AiRoadMarker.enqueue(Marker(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.map { d ->
AiRoadMarker.enqueue(Marker(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0, this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.map { d ->
android.util.Pair(d.lon, d.lat)
}))
l4.angle = this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0

View File

@@ -1,8 +1,10 @@
package com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad
import android.animation.*
import android.content.*
import android.graphics.*
import android.util.*
import android.view.animation.*
import androidx.lifecycle.*
import androidx.lifecycle.Lifecycle.Event
import androidx.lifecycle.Lifecycle.Event.ON_CREATE
@@ -10,7 +12,6 @@ import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
import com.mogo.eagle.core.data.map.*
import com.mogo.eagle.core.data.map.MapRoadInfo.StopLine
import com.mogo.eagle.core.function.api.map.listener.*
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.call.map.*
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.OnRoadListener
import com.mogo.eagle.core.utilcode.kotlin.*
@@ -22,6 +23,7 @@ import io.netty.util.internal.*
import java.util.*
import java.util.concurrent.*
import java.util.concurrent.atomic.*
import kotlin.collections.ArrayList
/**
* Ai云道路施工事件道路颜色标记类
@@ -40,19 +42,19 @@ object AiRoadMarker {
private val overlayManager by lazy { MogoOverlayManager.getInstance() }
private val redLine by lazy { AtomicReference<IMogoPolyline>() }
private val line by lazy { AtomicReference<IMogoPolyline>() }
private val redLineColors = arrayListOf(Color.parseColor("#002ABAD9"), Color.parseColor("#FF7A30"))
private val START_COLOR = Color.parseColor("#002ABAD9")
private val END_COLOR = Color.parseColor("#FFFF7A30")
private val markerCache = ConcurrentSet<Marker>()
private val markers = ConcurrentSet<Marker>()
private val redLineOptions by lazy {
private val options by lazy {
MogoPolylineOptions().apply {
zIndex(40000f)
setGps(true)
width(30f)
width(50f)
useGradient(true)
colorValues(redLineColors)
}
}
@@ -70,21 +72,30 @@ object AiRoadMarker {
pool.execute {
var interrupted = false
Log.d(TAG, "--- consumer --- 0 ---")
Logger.d(TAG, "--- consumer --- 0 ---")
while (!interrupted) {
try {
Log.d(TAG, "--- consumer --- 1 ---")
Logger.d(TAG, "--- consumer --- 1 ---")
val top = queue.take() ?: continue
Log.d(TAG, "--- consumer --- 2 ---")
val location = carLocation.get() ?: continue
val isFrontOfCar = isFrontOfCar(top.poi_lon, top.poi_lat, location.first, location.second, location.third)
val isSameRoad = isSameRoad(top.poi_lon, top.poi_lat, location.first, location.second, location.third)
Log.d(TAG, "--- consumer --- 3 ---isFrontOfCar: $isFrontOfCar, isSameRoad: $isSameRoad")
if (isFrontOfCar && isSameRoad) {
Logger.d(TAG, "--- consumer --- 2 ---")
val location = carLocation.get()
if (location == null) {
if (queue.isEmpty()) {
synchronized(markers) {
markers.clear()
}
}
continue
}
val isTrigger = isTriggerEvent(top.poi_lon, top.poi_lat, location.first, location.second, location.third)
Logger.d(TAG, "--- consumer --- 3 ---: isTrigger => $isTrigger")
if (isTrigger) {
marker.set(top)
marker(top)
} else {
markerCache.remove(top)
synchronized(markers) {
markers.remove(top)
}
}
interrupted = Thread.currentThread().isInterrupted
} catch (e: InterruptedException) {
@@ -95,11 +106,12 @@ object AiRoadMarker {
}
}
private fun isSameRoad(x1: Double, y1: Double, x2: Double, y2: Double, angle: Double): Boolean {
val c1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(x1, y1, angle.toFloat(), 500f)
val c2 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(x2, y2, angle.toFloat(), 500f)
Log.d(TAG, "isSameRoad--: [$x1, $y1, ${c1.road_id}] ==> [$x2, $y2, ${c2.road_id}]")
return c1 != null && c2 != null && c1.road_id.isNotEmpty() && c1.road_id == c2.road_id
private fun isTriggerEvent(x1: Double, y1: Double, x2: Double, y2: Double, a2: Double): Boolean {
val angle = DrivingDirectionUtils.getDegreeOfCar2Poi2(x2, y2, x1, y1, a2)
if (angle <= 60 && DrivingDirectionUtils.distance(x1, y1, x2, y2) <= 300) {
return true
}
return false
}
private val onRoadListener = object : OnRoadListener {
@@ -107,7 +119,7 @@ object AiRoadMarker {
private var hasCrossRoad = false
override fun onRoadIdInfo(roadId: String) {
Log.d(TAG, "--- onRoadInfo --- roadId: $roadId")
Logger.d(TAG, "--- onRoadInfo --- roadId: $roadId")
val oldRoadId = this.roadId
if (oldRoadId != roadId) {
if (hasCrossRoad) {
@@ -117,7 +129,7 @@ object AiRoadMarker {
this.roadId = roadId
}
override fun onStopLineInfo(info: StopLine) {
Log.d(TAG, "--- onStopLineInfo --- info: $info")
Logger.d(TAG, "--- onStopLineInfo --- info: $info")
if (!hasCrossRoad) {
hasCrossRoad = true
}
@@ -127,17 +139,17 @@ object AiRoadMarker {
private val onLocationListener = object : IMoGoMapLocationListener {
override fun onLocationChanged(location: MogoLocation?, from: Int) {
if (location == null) {
override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) {
if (location == null || !isGps) {
return
}
try {
val loc = arrayOf(CallerAutoPilotStatusListenerManager.getCurWgs84Lon(), CallerAutoPilotStatusListenerManager.getCurWgs84Lat())
val loc = arrayOf(location.longitude, location.latitude)
carLocation.set(Triple(loc[0], loc[1], location.bearing.toDouble()))
val marker = marker.get() ?: return
val isOutOfRange = isOutOfRange(marker.poi_lon, marker.poi_lat, carLocation.get().first, carLocation.get().second, carLocation.get().third)
if (isOutOfRange) {
Log.d(TAG, "--- onLocationChanged: isOutOfRange --- ")
Logger.d(TAG, "--- onLocationChanged: isOutOfRange --- ")
unMarker(marker)
}
} catch (t: Throwable) {
@@ -148,42 +160,48 @@ object AiRoadMarker {
private fun onCreate() {
CallerMapRoadListenerManager.registerRoadListener(TAG, onRoadListener)
CallerMapLocationListenerManager.addListener(TAG, onLocationListener)
CallerMapLocationListenerManager.addListener(TAG, onLocationListener, true)
}
private fun onDestroy() {
CallerMapRoadListenerManager.unRegisterRoadListener(TAG)
CallerMapLocationListenerManager.removeListener(TAG)
CallerMapLocationListenerManager.removeListener(TAG, true)
pool.shutdownNow()
removeRedLine()
removeLine()
}
fun enqueue(marker: Marker) {
Log.d(TAG, "--- enqueue --- 1 ---")
if (markerCache.contains(marker)) {
Log.d(TAG, "--- enqueue --- cache hit ---")
Logger.d(TAG, "--- enqueue --- 1 ---")
if (markers.contains(marker)) {
Logger.d(TAG, "--- enqueue --- cache hit ---")
return
}
Log.d(TAG, "--- enqueue --- 2 ---")
markerCache += marker
Logger.d(TAG, "--- enqueue --- 2 ---")
synchronized(markers) {
markers += marker
}
pool.execute {
Log.d(TAG, "--- enqueue --- 3 ---${Thread.currentThread().name}::${Thread.currentThread().id}")
Logger.d(TAG, "--- enqueue --- 3 ---${Thread.currentThread().name}::${Thread.currentThread().id}")
queue.put(marker)
}
}
private fun marker(marker: Marker) {
Log.d(TAG, "--- marker --- 1 ---")
val location = carLocation.get() ?: return
Log.d(TAG, "--- marker --- 2 ---")
removeRedLine()
//施工中心点前方的自车行驶方向上300米距离
val l1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), 300f)
//施工中心点后方的自车行驶方向上300米距离
Log.d(TAG, "--- marker --- 3 --- l1: $l1")
Logger.d(TAG, "--- marker --- 3 --- l1: $l1")
val l2 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), -300f)
Log.d(TAG, "--- marker --- 4 --- l2: $l2")
if (l1.points.isEmpty() || l2.points.isEmpty()) {
Logger.d(TAG, "--- marker --- 3 --- return ----")
synchronized(markers) {
markers.remove(marker)
}
return
}
Logger.d(TAG, "--- marker --- 4 --- l2: $l2")
val points = LinkedList<MogoLatLng>()
if (l2 != null && l2.points.isNotEmpty()) {
points.addAll(l2.points.reversed().map {
@@ -192,7 +210,7 @@ object AiRoadMarker {
}
val centerX= marker.poi_lon
val centerY = marker.poi_lat
Log.d(TAG, "--- marker --- 5 --- marker: $marker")
Logger.d(TAG, "--- marker --- 5 --- marker: $marker")
val farthestPoint = marker.polygon?.let {
var find: Pair<Double, Double> = Pair(centerX, centerY)
var min = Long.MAX_VALUE
@@ -203,46 +221,61 @@ object AiRoadMarker {
find = p
}
}
MogoLatLng(find.second, find.second)
MogoLatLng(find.second, find.first)
} ?: MogoLatLng(centerY, centerX)
marker.farthestPoint = Pair(farthestPoint.lon, farthestPoint.lat)
Log.d(TAG, "--- marker --- 6 --- marker: $marker")
Logger.d(TAG, "--- marker --- 6 --- marker: $marker")
if (l1 != null && l1.points.isNotEmpty()) {
for (l in l1.points) {
if (DrivingDirectionUtils.getDegreeOfCar2Poi2(farthestPoint.lon, farthestPoint.lat, l.first, l.second, location.third) < 90L) {
if (DrivingDirectionUtils.getDegreeOfCar2Poi2(farthestPoint.lon, farthestPoint.lat, l.first, l.second, location.third + 180) < 90L) {
points.add(l.let { MogoLatLng(it.second, it.first) })
}
}
}
var line = redLine.get()
redLineOptions.points(points)
Log.d(TAG, "--- marker --- 7 --- points: ${points.size}")
if (points.size <= 1) {
synchronized(markers) {
markers.remove(marker)
}
return
}
removeLine()
val evaluator = ArgbEvaluator()
val interceptor = DecelerateInterpolator(1.5f)
val total = points.size
val colors = ArrayList<Int>()
(0..total).forEach { i ->
colors += evaluator.evaluate(interceptor.getInterpolation(i * 1f / total), START_COLOR, END_COLOR) as Int
}
var line = line.get()
options.points(points)
options.colorValues(colors)
Logger.d(TAG, "--- marker --- 7 --- points: ${points.size}")
if (line == null || line.isDestroyed) {
val l = overlayManager.addPolyline(redLineOptions)
this.redLine.set(l)
val l = overlayManager.addPolyline(options)
this.line.set(l)
line = l
} else {
line.setOption(redLineOptions)
line.setOption(options)
}
if (!line.isVisible) {
line.isVisible = true
}
}
private fun removeRedLine() {
val old = redLine.get()
Log.d(TAG, "--- removeRedLine --- 1 ---")
private fun removeLine() {
val old = line.get()
Logger.d(TAG, "--- removeRedLine --- 1 ---")
if (old != null) {
Log.d(TAG, "--- removeRedLine --- 2 ---")
redLine.set(null)
Logger.d(TAG, "--- removeRedLine --- 2 ---")
line.set(null)
old.isVisible = false
old.remove()
}
}
private fun unMarker(marker: Marker) {
markerCache -= marker
removeRedLine()
markers -= marker
removeLine()
}
private fun isOutOfRange(markerLon: Double, markerLat: Double, carLon: Double, carLat: Double, carAngle: Double): Boolean {
@@ -257,6 +290,7 @@ object AiRoadMarker {
data class Marker(
val poi_lat: Double,
val poi_lon: Double,
val poi_angle: Double,
val polygon: List<Pair<Double, Double>>?,
var farthestPoint: Pair<Double, Double>? = null
) {

View File

@@ -106,7 +106,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapL
}
@Override
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from) {
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
sV2XWarningMarker.onCarLocationChanged2(location);
}

View File

@@ -28,7 +28,7 @@ enum class TrafficTypeEnum(
"",
R.raw.traffic_people,
R.raw.xingren,
R.raw.traffic_people
R.raw.xingren
),
TYPE_TRAFFIC_ID_BICYCLE(
2,

View File

@@ -13,5 +13,5 @@ interface IMoGoMapLocationListener {
*
* @param location 新定位点
*/
fun onLocationChanged(location: MogoLocation?, from: Int)
fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean)
}

View File

@@ -1,5 +1,6 @@
package com.mogo.eagle.core.function.call.autopilot
import android.util.*
import androidx.annotation.Nullable
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
@@ -65,14 +66,18 @@ object CallerAutoPilotStatusListenerManager : CallerBase() {
* 获取当前时刻WGS84 lat
*/
fun getCurWgs84Lat(): Double {
return mAutopilotStatusInfo.locationLat
val locationLat = mAutopilotStatusInfo.locationLat
Log.d("GO", "wgs84_lat:" + locationLat)
return locationLat
}
/**
* 获取当前时刻WGS84 lon
*/
fun getCurWgs84Lon(): Double {
return mAutopilotStatusInfo.locationLon
val locationLon = mAutopilotStatusInfo.locationLon
Log.d("GO", "wgs84_lon:" + locationLon)
return locationLon
}
/**

View File

@@ -11,6 +11,8 @@ import java.util.concurrent.ConcurrentHashMap
*/
object CallerAutopilotCarConfigListenerManager : CallerBase() {
private var mCarConfigResp: MessagePad.CarConfigResp?= null
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val M_AUTOPILOT_CAR_CONFIG_LISTENERS: ConcurrentHashMap<String, IMoGoAutopilotCarConfigListener> =
ConcurrentHashMap()
@@ -28,6 +30,10 @@ object CallerAutopilotCarConfigListenerManager : CallerBase() {
return
}
M_AUTOPILOT_CAR_CONFIG_LISTENERS[tag] = listener
mCarConfigResp?.let {
listener.onAutopilotCarConfig(it)
}
}
/**
@@ -59,6 +65,7 @@ object CallerAutopilotCarConfigListenerManager : CallerBase() {
*/
@Synchronized
fun invokeAutopilotCarConfigData(carConfigResp: MessagePad.CarConfigResp) {
mCarConfigResp = carConfigResp
M_AUTOPILOT_CAR_CONFIG_LISTENERS.forEach {
val listener = it.value
listener.onAutopilotCarConfig(carConfigResp)

View File

@@ -16,10 +16,19 @@ object CallerMapLocationListenerManager : CallerBase() {
// 记录地图最后一次位置
private var mLocation: MogoLocation? = null
/**
* 记录最后一次高精坐标的位置
*/
private var mGpsLocation: MogoLocation? = null
// 存储所有注册了监听的对象invokeXXXX进行遍历回调将信息同步
private val mMapStyleChangeListeners: ConcurrentHashMap<String, IMoGoMapLocationListener> =
ConcurrentHashMap()
// 高精坐标回调
private val mGpsChangedListeners: ConcurrentHashMap<String, IMoGoMapLocationListener> = ConcurrentHashMap()
/**
* 获取当前经纬度
*/
@@ -27,44 +36,76 @@ object CallerMapLocationListenerManager : CallerBase() {
return mLocation
}
/**
* 获取当前高精坐标
*/
fun getCurrentGpsLocation(): MogoLocation? {
return mGpsLocation
}
/**
* 添加 地图样式改变 监听
* @param tag 标记,用来注销监听使用
* @param listener 监听回调
*/
fun addListener(
@Nullable tag: String,
@Nullable listener: IMoGoMapLocationListener
) {
if (mMapStyleChangeListeners.containsKey(tag)) {
return
fun addListener(@Nullable tag: String, @Nullable listener: IMoGoMapLocationListener, isGps: Boolean) {
if (!isGps) {
if (mMapStyleChangeListeners.containsKey(tag)) {
return
}
mMapStyleChangeListeners[tag] = listener
listener.onLocationChanged(mLocation, 0, isGps)
} else {
if (mGpsChangedListeners.containsKey(tag)) {
return
}
mGpsChangedListeners[tag] = listener
listener.onLocationChanged(mGpsLocation, 0, isGps)
}
mMapStyleChangeListeners[tag] = listener
listener.onLocationChanged(mLocation, 0)
}
/**
* 删除 地图样式改变 监听
* @param tag 标记,用来注销监听使用
*/
fun removeListener(@Nullable tag: String) {
if (!mMapStyleChangeListeners.containsKey(tag)) {
return
fun removeListener(@Nullable tag: String, isGps: Boolean) {
if (!isGps) {
if (!mMapStyleChangeListeners.containsKey(tag)) {
return
}
mMapStyleChangeListeners.remove(tag)
} else {
if (!mGpsChangedListeners.containsKey(tag)) {
return
}
mGpsChangedListeners.remove(tag)
}
mMapStyleChangeListeners.remove(tag)
}
/**
* 删除 地图样式改变 监听
* @param listener 要删除的监听对象
*/
fun removeListener(@Nullable listener: IMoGoMapLocationListener) {
if (!mMapStyleChangeListeners.containsValue(listener)) {
return
}
mMapStyleChangeListeners.forEach {
if (it.value == listener) {
mMapStyleChangeListeners.remove(it.key)
fun removeListener(@Nullable listener: IMoGoMapLocationListener, isGps: Boolean) {
if (!isGps) {
if (!mMapStyleChangeListeners.containsValue(listener)) {
return
}
mMapStyleChangeListeners.forEach {
if (it.value == listener) {
mMapStyleChangeListeners.remove(it.key)
}
}
} else {
if (!mGpsChangedListeners.containsValue(listener)) {
return
}
mGpsChangedListeners.forEach {
if (it.value == listener) {
mGpsChangedListeners.remove(it.key)
}
}
}
}
@@ -73,20 +114,25 @@ object CallerMapLocationListenerManager : CallerBase() {
* 触发 地图样式改变 监听
*/
fun invokeMapLocationChangeListener() {
invokeMapLocationChangeListener(mLocation, 0)
invokeMapLocationChangeListener(mLocation, 0, false)
}
/**
* 触发 地图样式改变 监听
* @param location 选中状态
*/
fun invokeMapLocationChangeListener(location: MogoLocation?, from: Int) {
mLocation = location
mMapStyleChangeListeners.forEach {
val tag = it.key
val listener = it.value
listener.onLocationChanged(location, from)
fun invokeMapLocationChangeListener(location: MogoLocation?, from: Int, isGps: Boolean) {
if (!isGps) {
mLocation = location
mMapStyleChangeListeners.forEach {
val listener = it.value
listener.onLocationChanged(location, from, isGps)
}
} else {
mGpsLocation = location
mGpsChangedListeners.forEach {
it.value.onLocationChanged(location, from, isGps)
}
}
}
}

View File

@@ -5,6 +5,7 @@ import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.map.road.RoadNameInfo;
import com.mogo.map.uicontroller.IMogoMapUIController;
import java.util.ArrayList;
@@ -185,4 +186,14 @@ public interface IMogoMap {
* @return 中心线相关数据
*/
CenterLine getCenterLineRangeInfo(double lon, double lat, float angle, float distance);
/**
* 根据自车经纬度和航向角,获取道路名称
* @param lon 经度
* @param lat 纬度
* @param angle 航向角
* @return 道路名称等相关信息
*/
RoadNameInfo getRoadName(double lon, double lat, float angle);
}

View File

@@ -0,0 +1,3 @@
package com.mogo.map.road
data class RoadNameInfo(val tile_id: String? = "", val road_id: String? = "", val road_name: String? = "")

View File

@@ -72,6 +72,7 @@ import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
import com.zhidaoauto.map.sdk.open.camera.CameraUpdateFactory;
import com.zhidaoauto.map.sdk.open.camera.LatLngBounds;
import com.zhidaoauto.map.sdk.open.data.MapDataApi;
import com.zhidaoauto.map.sdk.open.location.LocationClient;
import com.zhidaoauto.map.sdk.open.location.LocationListener;
import com.zhidaoauto.map.sdk.open.location.MyLocationStyle;
import com.zhidaoauto.map.sdk.open.location.RTKAutopilotLocationBean;
@@ -125,6 +126,8 @@ public class AMapViewWrapper implements IMogoMapView,
private boolean mIsFirstLocated = true;
private boolean mIsDelayed = false;
private final LocationListener mGpsLocationListener = location -> CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(ObjectUtils.fromLocation(location), 0, true);
public AMapViewWrapper(MapAutoView mMapView) {
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--AMapViewWrapper: init");
this.mMapView = mMapView;
@@ -186,7 +189,11 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.setOnMapLoadedListener(this);
mMapView.setOnMapTouchListener(this);
mMapView.setOnMapClickListener(this);
mMapView.getLocationClient().registerListener(this);
LocationClient client = mMapView.getLocationClient();
if (client != null) {
client.registerListener(this);
client.registerGpsListener(mGpsLocationListener);
}
mMapView.registerListener(this, MapAutoApi.LISTENER_TYPE_ZOOM);
mMapView.registerListener(this, MapAutoApi.LISTENER_TYPE_ROTATE);
mMapView.registerListener(this, MapAutoApi.LISTENER_TYPE_3D);
@@ -720,7 +727,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void run() {
if (location != null) {
CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(location, 1);
CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(location, 1, false);
location = null;
}
}
@@ -734,7 +741,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location) {
MogoLocation currentLocation = ObjectUtils.fromLocation(location);
if (Looper.myLooper() == Looper.getMainLooper()) {
CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(currentLocation, 1);
CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(currentLocation, 1, false);
} else {
if (mLocationTask == null) {
mLocationTask = new LocationTask();
@@ -1004,19 +1011,27 @@ public class AMapViewWrapper implements IMogoMapView,
if (gnssInfo.getLongitude() == -1) {
return;
}
RTKAutopilotLocationBean bean = new RTKAutopilotLocationBean();
bean.setYaw_rate(gnssInfo.getYawRate());
bean.setHeading(gnssInfo.getHeading());
bean.setAcceleration(gnssInfo.getAcceleration());
bean.setAlt(gnssInfo.getAltitude());
bean.setSystemTime(Double.valueOf(gnssInfo.getSystemTime()).longValue());
LonLatPoint bean = new LonLatPoint();
bean.setAngle(gnssInfo.getHeading());
bean.setAltitude(gnssInfo.getAltitude());
bean.setLongitude(gnssInfo.getLongitude());
bean.setLatitude(gnssInfo.getLatitude());
bean.setSatelliteTime(Double.valueOf(gnssInfo.getSatelliteTime() * 1000).longValue());
bean.setLon(gnssInfo.getLongitude());
bean.setLat(gnssInfo.getLatitude());
bean.setGnss_speed(((float) gnssInfo.getGnssSpeed()));
bean.setReceiverDataTime(System.currentTimeMillis());
bean.setSpeed((float) gnssInfo.getGnssSpeed());
// RTKAutopilotLocationBean bean = new RTKAutopilotLocationBean();
// bean.setYaw_rate(gnssInfo.getYawRate());
// bean.setHeading(gnssInfo.getHeading());
// bean.setAcceleration(gnssInfo.getAcceleration());
// bean.setAlt(gnssInfo.getAltitude());
// bean.setSystemTime(Double.valueOf(gnssInfo.getSystemTime()).longValue());
// bean.setSatelliteTime(Double.valueOf(gnssInfo.getSatelliteTime() * 1000).longValue());
// bean.setLon(gnssInfo.getLongitude());
// bean.setLat(gnssInfo.getLatitude());
// bean.setGnss_speed(((float) gnssInfo.getGnssSpeed()));
// bean.setReceiverDataTime(System.currentTimeMillis());
// 使用外部定位数据修改自车位置
mMapView.getLocationClient().updateRTKAutoPilotLocation(bean);
// mMapView.getLocationClient().updateRTKAutoPilotLocation(bean);
mMapView.getLocationClient().updateLocation(bean);
CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getContext()).updateLocation(bean);
CallerMapDataCollectorManager.INSTANCE.setIsInit();
}

View File

@@ -17,6 +17,7 @@ import com.mogo.map.marker.MogoMarkersHandler;
import com.mogo.map.overlay.AMapPolylineWrapper;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.map.road.RoadNameInfo;
import com.mogo.map.uicontroller.AMapUIController;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.utils.ObjectUtils;
@@ -334,6 +335,16 @@ public class AMapWrapper implements IMogoMap {
return ret;
}
@Override
public RoadNameInfo getRoadName(double lon, double lat, float angle) {
// com.zhidaoauto.map.sdk.open.road.RoadNameInfo info = MapDataApi.INSTANCE.getRoadName(lon, lat, angle);
// RoadNameInfo ret = null;
// if (info != null) {
// ret = new RoadNameInfo(info.tile_id, info.road_id, info.road_name);
// }
return null;
}
private List<Pair<Double, Double>> convert(List<LonLatPoint> points) {
if (points == null || points.isEmpty()) {
return Collections.emptyList();

View File

@@ -11,6 +11,7 @@ import com.mogo.map.utils.ObjectUtils;
import com.zhidaoauto.map.sdk.open.location.LocationClient;
import com.zhidaoauto.map.sdk.open.location.LocationListener;
import com.zhidaoauto.map.sdk.open.location.RTKAutopilotLocationBean;
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
import org.jetbrains.annotations.NotNull;
@@ -115,7 +116,7 @@ public class ALocationClient implements IMogoLocationClient {
}
Trace.beginSection( "timer.onLocationChanged" );
mLastLocation = ObjectUtils.fromLocation( location );
UiThreadHandler.post(() -> CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(mLastLocation, 0));
UiThreadHandler.post(() -> CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(mLastLocation, 0, false));
Set< IMogoLocationListener > listeners = MogoLocationListenerRegister.getInstance().getListeners();
synchronized ( listeners ) {
@@ -140,10 +141,16 @@ public class ALocationClient implements IMogoLocationClient {
if (locationToUpdate instanceof MogoLocation) {
return;
}
if (locationToUpdate instanceof RTKAutopilotLocationBean) {
RTKAutopilotLocationBean current = (RTKAutopilotLocationBean) locationToUpdate;
// if (locationToUpdate instanceof RTKAutopilotLocationBean) {
// RTKAutopilotLocationBean current = (RTKAutopilotLocationBean) locationToUpdate;
// if (mClient != null) {
// mClient.updateRTKAutoPilotLocation(current);
// }
// }
if (locationToUpdate instanceof com.zhidaoauto.map.sdk.open.query.LonLatPoint) {
LonLatPoint current = (LonLatPoint) locationToUpdate;
if (mClient != null) {
mClient.updateRTKAutoPilotLocation(current);
mClient.updateLocation(current);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -45,7 +45,7 @@ public class MogoRouteOverlayManager implements
public void init() {
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this);
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this);
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, this, false);
}
public static MogoRouteOverlayManager getInstance() {
@@ -68,7 +68,7 @@ public class MogoRouteOverlayManager implements
}
@Override
public void onLocationChanged(@Nullable MogoLocation location, int from) {
public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location, int from, boolean isGps) {
if (from != 1 || location == null) {
return;
}