[2.13.2] merge
This commit is contained in:
@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.overview.vm
|
||||
import androidx.lifecycle.*
|
||||
import com.mogo.commons.constants.HostConst
|
||||
import com.mogo.eagle.core.data.map.Infrastructure
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
|
||||
import com.mogo.eagle.core.function.overview.OverviewDao
|
||||
import com.mogo.eagle.core.function.overview.remote.OverViewServiceApi
|
||||
import com.mogo.eagle.core.function.overview.remote.V2XEvent
|
||||
@@ -74,23 +75,29 @@ class OverViewModel(
|
||||
}
|
||||
}
|
||||
|
||||
fun getAllV2XEventsByLineId(lineId: String, sn: String) {
|
||||
fun getAllV2XEventsByLineId(sn: String) {
|
||||
if (disposable != null && !disposable!!.isDisposed) {
|
||||
disposable!!.dispose()
|
||||
}
|
||||
|
||||
// 1分钟查询一次
|
||||
disposable = Observable.interval(0, 60000, TimeUnit.MILLISECONDS)
|
||||
disposable = Observable.interval(2000, 60000, TimeUnit.MILLISECONDS)
|
||||
.flatMap {
|
||||
MoGoRetrofitFactory.getInstance(HostConst.getHost())
|
||||
.create(OverViewServiceApi::class.java)
|
||||
.queryAllV2XEventsByLineId(lineId, sn)
|
||||
.map {
|
||||
if (it.code == 200 || it.code == 0) {
|
||||
return@map it.result?.v2XEventList
|
||||
} else {
|
||||
return@map null
|
||||
val lineId = getLineId()
|
||||
if (lineId > 0) {
|
||||
MoGoRetrofitFactory.getInstance(HostConst.getHost())
|
||||
.create(OverViewServiceApi::class.java)
|
||||
.queryAllV2XEventsByLineId(lineId.toString(), sn)
|
||||
.map {
|
||||
if (it.code == 200 || it.code == 0) {
|
||||
return@map it.result?.v2XEventList
|
||||
} else {
|
||||
return@map ArrayList()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Observable.just(ArrayList())
|
||||
}
|
||||
}
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -106,4 +113,16 @@ class OverViewModel(
|
||||
fun stopQueryV2XEvents() {
|
||||
disposable?.dispose()
|
||||
}
|
||||
|
||||
private fun getLineId(): Long {
|
||||
var lineId: Long = -1
|
||||
val parameter = getAutoPilotStatusInfo()
|
||||
.autopilotControlParameters
|
||||
if (parameter != null) {
|
||||
if (parameter.autoPilotLine != null) {
|
||||
lineId = parameter.autoPilotLine!!.lineId
|
||||
}
|
||||
}
|
||||
return lineId
|
||||
}
|
||||
}
|
||||
@@ -268,9 +268,9 @@ public class AMapCustomView
|
||||
if (center != null) {
|
||||
center.getLon();
|
||||
MarkerOptions markerOption = new MarkerOptions();
|
||||
LatLng latLng = new LatLng(center.getLat(),
|
||||
center.getLon());
|
||||
LatLng latLng = MarkerDrawerManager.INSTANCE.coordinateConverterWgsToGcj(mContext, center.getLat(), center.getLon());
|
||||
markerOption.position(latLng);
|
||||
markerOption.anchor(0.13f, 1f);
|
||||
markerOption.icon(BitmapDescriptorFactory.fromBitmap(getV2XBitmap()));
|
||||
markerOptionsList.add(markerOption);
|
||||
}
|
||||
@@ -282,15 +282,6 @@ public class AMapCustomView
|
||||
|
||||
public void drawV2XMarkers(ArrayList<MarkerOptions> markerOptionsList) {
|
||||
currMarkerList = mAMap.addMarkers(markerOptionsList, false);
|
||||
mAMap.setOnMarkerClickListener(marker -> {
|
||||
List<Infrastructure> infList = posInfMap.get(marker.getPosition());
|
||||
// 如果是摄像头
|
||||
if (infList != null) {
|
||||
CallerHmiManager.INSTANCE.showVideoDialog(infList);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
private Bitmap getV2XBitmap() {
|
||||
|
||||
@@ -161,4 +161,19 @@ object MarkerDrawerManager {
|
||||
mCoordinateConverter.coord(LatLng(mogoLatLng.latitude, mogoLatLng.longitude))
|
||||
return mCoordinateConverter.convert()
|
||||
}
|
||||
|
||||
/**
|
||||
* wgs84转高德坐标系
|
||||
*/
|
||||
fun coordinateConverterWgsToGcj(
|
||||
mContext: Context,
|
||||
lat: Double,
|
||||
lon: Double
|
||||
): LatLng {
|
||||
val mCoordinateConverter =
|
||||
CoordinateConverter(mContext)
|
||||
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS)
|
||||
mCoordinateConverter.coord(LatLng(lat, lon))
|
||||
return mCoordinateConverter.convert()
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -21,7 +20,6 @@ import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.function.overview.InfStructureManager;
|
||||
import com.mogo.eagle.core.function.overview.ViewModelExtKt;
|
||||
import com.mogo.eagle.core.function.overview.vm.OverViewModel;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -81,9 +79,8 @@ public class OverviewMapFragment extends BaseFragment
|
||||
@Override
|
||||
public void startQueryV2XEvents() {
|
||||
if (isAdded()) {
|
||||
long lineId = getLineId();
|
||||
if (lineId > 0 && mViewModel != null) {
|
||||
mViewModel.getAllV2XEventsByLineId("" + lineId, MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
if (mViewModel != null) {
|
||||
mViewModel.getAllV2XEventsByLineId(MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,11 +127,7 @@ public class OverviewMapFragment extends BaseFragment
|
||||
mViewModel.getV2XEventLiveData().observe(this.getViewLifecycleOwner(), v2XEvents -> {
|
||||
mAMapCustomView.showV2XEventMarkers(v2XEvents);
|
||||
});
|
||||
|
||||
long lineId = getLineId();
|
||||
if (lineId > 0) {
|
||||
mViewModel.getAllV2XEventsByLineId("" + lineId, MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
}
|
||||
mViewModel.getAllV2XEventsByLineId(MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.eagle.core.function.smp;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_MAP;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
@@ -16,8 +18,10 @@ 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.smp.IMogoSmallMapProvider;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager;
|
||||
import com.mogo.eagle.core.function.map.R;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -66,6 +70,7 @@ public class SmallMapFragment extends BaseFragment
|
||||
mSmallMapDirectionView = mRootView.findViewById(R.id.smallMapDirectionView);
|
||||
mSmallMapDirectionView.onCreateView(savedInstanceState);
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this);
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG,this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,8 +90,13 @@ public class SmallMapFragment extends BaseFragment
|
||||
@Override
|
||||
public void drawablePolyline(List<MogoLatLng> coordinates) {
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.convert(coordinates);
|
||||
UiThreadHandler.post(() -> mSmallMapDirectionView.drawablePolyline());
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mSmallMapDirectionView.convert(coordinates);
|
||||
mSmallMapDirectionView.drawablePolyline();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,9 +141,12 @@ public class SmallMapFragment extends BaseFragment
|
||||
@Override
|
||||
public void onAutopilotStatusResponse(@NotNull AutopilotStatusInfo autoPilotStatusInfo) {
|
||||
int tempStatus = autoPilotStatusInfo.getPilotmode();
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotStatusResponse:"+tempStatus+" autoPilotStatus:"+autoPilotStatus);
|
||||
if (tempStatus != 1) {
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotStatusResponse:"+tempStatus+" clearPolyline");
|
||||
clearPolyline();
|
||||
}else if (tempStatus == 1 && autoPilotStatus == 0){
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotStatusResponse:getGlobalPath");
|
||||
CallerAutoPilotManager.INSTANCE.getGlobalPath();
|
||||
}
|
||||
autoPilotStatus = tempStatus;
|
||||
@@ -160,16 +173,21 @@ public class SmallMapFragment extends BaseFragment
|
||||
|
||||
@Override
|
||||
public void onAutopilotRotting(MessagePad.GlobalPathResp globalPathResp) {
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotRotting");
|
||||
if (globalPathResp == null || globalPathResp.getWayPointsList().size() == 0) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotRotting:"+globalPathResp.getWayPointsList().size());
|
||||
|
||||
List<MogoLatLng> latLngList = new ArrayList<>();
|
||||
for (MessagePad.Location routeModel : globalPathResp.getWayPointsList()) {
|
||||
latLngList.add(new MogoLatLng(routeModel.getLatitude(), routeModel.getLongitude()));
|
||||
}
|
||||
if (latLngList.size() > 0) {
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotRotting:"+"drawablePolyline");
|
||||
drawablePolyline(latLngList);
|
||||
} else {
|
||||
CallerLogger.INSTANCE.i(M_MAP + TAG, "onAutopilotRotting:"+"clearPolyline");
|
||||
clearPolyline();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user