[Taxi-d 280 Taxi-p 130] 乘客屏增加小地图估计擦除功能
This commit is contained in:
@@ -11,6 +11,6 @@ import mogo.telematics.pad.MessagePad;
|
|||||||
* @date: 2021/11/1
|
* @date: 2021/11/1
|
||||||
*/
|
*/
|
||||||
public interface IOCHTaxiPassengerAutopilotPlanningCallback {
|
public interface IOCHTaxiPassengerAutopilotPlanningCallback {
|
||||||
void routeResult(List<MessagePad.Location> models);
|
void setLineMarker(List<LatLng> models);
|
||||||
void routeResultByServer(List<LatLng> models);
|
void routeResultByServer(List<LatLng> models);
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,7 @@ import com.mogo.cloud.commons.utils.CoordinateUtils;
|
|||||||
import com.mogo.commons.debug.DebugConfig;
|
import com.mogo.commons.debug.DebugConfig;
|
||||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||||
|
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
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.autopilot.IMoGoAutopilotStatusListener;
|
||||||
import com.mogo.eagle.core.function.api.v2x.LimitingVelocityListener;
|
import com.mogo.eagle.core.function.api.v2x.LimitingVelocityListener;
|
||||||
@@ -56,6 +57,7 @@ import com.mogo.service.statusmanager.StatusDescriptor;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -103,6 +105,8 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
|||||||
|
|
||||||
private double mLongitude, mLatitude;
|
private double mLongitude, mLatitude;
|
||||||
|
|
||||||
|
private List<LatLng> mLocationsModels = new ArrayList<>();
|
||||||
|
|
||||||
private TaxiPassengerModel() {
|
private TaxiPassengerModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,12 +575,54 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
|||||||
public void onAutopilotRotting(@Nullable MessagePad.GlobalPathResp routeList) {
|
public void onAutopilotRotting(@Nullable MessagePad.GlobalPathResp routeList) {
|
||||||
if (null != routeList && routeList.getWayPointsList().size() > 0){
|
if (null != routeList && routeList.getWayPointsList().size() > 0){
|
||||||
calculateRouteLineSum(CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext,routeList.getWayPointsList()));
|
calculateRouteLineSum(CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjListCommon(mContext,routeList.getWayPointsList()));
|
||||||
updateRouteResult(routeList.getWayPointsList());
|
setRouteLineMarker(routeList.getWayPointsList());
|
||||||
|
startToRouteAndWipe(routeList.getWayPointsList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public void startToRouteAndWipe(List<MessagePad.Location> models) {
|
||||||
|
List<LatLng> latLngModels = CoordinateCalculateRouteUtil
|
||||||
|
.coordinateConverterWgsToGcjListCommon(mContext,models);
|
||||||
|
mLocationsModels.clear();
|
||||||
|
mLocationsModels.addAll(latLngModels);
|
||||||
|
startOrStopRouteAndWipe(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实时轨迹擦除
|
||||||
|
* @param isStart
|
||||||
|
*/
|
||||||
|
public void startOrStopRouteAndWipe(boolean isStart){
|
||||||
|
if (isStart){
|
||||||
|
TaxiPassengerModelLoopManager.getInstance().startOrStopRouteAndWipe();
|
||||||
|
}else {
|
||||||
|
TaxiPassengerModelLoopManager.getInstance().stopOrStopRouteAndWipe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loopRouteAndWipe() {
|
||||||
|
if (mLocationsModels != null && mLocationsModels.size() > 0){
|
||||||
|
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
|
||||||
|
.getRemainPointListByCompare(mLocationsModels,mLongitude,mLatitude);
|
||||||
|
if (mAutopilotPlanningCallback != null){
|
||||||
|
mAutopilotPlanningCallback.routeResultByServer(lastPoints);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置小地图路径的起终点marker
|
||||||
|
*/
|
||||||
|
public void setRouteLineMarker(List<MessagePad.Location> models){
|
||||||
|
List<LatLng> latLngModels = CoordinateCalculateRouteUtil
|
||||||
|
.coordinateConverterWgsToGcjListCommon(mContext,models);
|
||||||
|
if (mAutopilotPlanningCallback != null){
|
||||||
|
mAutopilotPlanningCallback.setLineMarker(latLngModels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 限速监听
|
* 限速监听
|
||||||
*/
|
*/
|
||||||
@@ -590,11 +636,6 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public void updateRouteResult(List<MessagePad.Location> models){
|
|
||||||
if (mAutopilotPlanningCallback != null){
|
|
||||||
mAutopilotPlanningCallback.routeResult(models);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 导航订单起点到终点 获得剩余时间,里程,预计到达时间
|
* 导航订单起点到终点 获得剩余时间,里程,预计到达时间
|
||||||
*/
|
*/
|
||||||
@@ -647,7 +688,12 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
|||||||
if (data != null && data.data != null && data.data != null && data.data.size() > 0){
|
if (data != null && data.data != null && data.data != null && data.data.size() > 0){
|
||||||
if (mAutopilotPlanningCallback != null){
|
if (mAutopilotPlanningCallback != null){
|
||||||
calculateRouteLineSum(data.data);
|
calculateRouteLineSum(data.data);
|
||||||
mAutopilotPlanningCallback.routeResultByServer(data.data);
|
if (mAutopilotPlanningCallback != null){
|
||||||
|
mAutopilotPlanningCallback.setLineMarker(data.data);
|
||||||
|
}
|
||||||
|
mLocationsModels.clear();
|
||||||
|
mLocationsModels.addAll(data.data);
|
||||||
|
startOrStopRouteAndWipe(true);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
queryOrderRouteList();
|
queryOrderRouteList();
|
||||||
|
|||||||
@@ -31,6 +31,28 @@ public class TaxiPassengerModelLoopManager {
|
|||||||
|
|
||||||
private Disposable mInAndWaitServiceDisposable; //进行中、待服务订单列表轮询
|
private Disposable mInAndWaitServiceDisposable; //进行中、待服务订单列表轮询
|
||||||
private Disposable mQueryOrderRemainingDisposable; //心跳轮询
|
private Disposable mQueryOrderRemainingDisposable; //心跳轮询
|
||||||
|
private Disposable mRouteWipeDisposable; //心跳轮询
|
||||||
|
|
||||||
|
public void startOrStopRouteAndWipe() {
|
||||||
|
if (mRouteWipeDisposable != null && !mRouteWipeDisposable.isDisposed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CallerLogger.INSTANCE.i(M_TAXI_P + TAG, "startOrStopRouteWipe()");
|
||||||
|
mRouteWipeDisposable = Observable.interval(TaxiPassengerConst.LOOP_DELAY,
|
||||||
|
TaxiPassengerConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
|
||||||
|
.map((aLong -> aLong + 1))
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(aLong -> TaxiPassengerModel.getInstance().loopRouteAndWipe());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopOrStopRouteAndWipe() {
|
||||||
|
if (mRouteWipeDisposable != null) {
|
||||||
|
CallerLogger.INSTANCE.i(M_TAXI_P + TAG, "stopOrStopRouteWipe()");
|
||||||
|
mRouteWipeDisposable.dispose();
|
||||||
|
mRouteWipeDisposable = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void startInAndWaitOrdersLoop() {
|
public void startInAndWaitOrdersLoop() {
|
||||||
if (mInAndWaitServiceDisposable != null && !mInAndWaitServiceDisposable.isDisposed()) {
|
if (mInAndWaitServiceDisposable != null && !mInAndWaitServiceDisposable.isDisposed()) {
|
||||||
|
|||||||
@@ -69,15 +69,12 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void routeResult(List<MessagePad.Location> models) {
|
public void setLineMarker(List<LatLng> models) {
|
||||||
if (models == null) return;
|
if (models == null) return;
|
||||||
List<MogoLatLng> latLngList = new ArrayList<>();
|
runOnUIThread(() -> mView.setLineMarker(models));
|
||||||
for (MessagePad.Location routeModel : models) {
|
|
||||||
latLngList.add(new MogoLatLng(routeModel.getLatitude(), routeModel.getLongitude()));
|
|
||||||
}
|
|
||||||
runOnUIThread(() -> mView.routeResult(latLngList));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void routeResultByServer(List<LatLng> models) {
|
public void routeResultByServer(List<LatLng> models) {
|
||||||
if (models == null) return;
|
if (models == null) return;
|
||||||
|
|||||||
@@ -15,4 +15,9 @@ public interface ITaxiPassengerMapDirectionView {
|
|||||||
* 清除路径线
|
* 清除路径线
|
||||||
*/
|
*/
|
||||||
void clearPolyline();
|
void clearPolyline();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置路径中起终点marker
|
||||||
|
*/
|
||||||
|
void setLineMarker();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,6 +229,14 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
|||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
|
removeListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeListener(){
|
||||||
|
if (mStartAutopilotView == null || mStartAutopilotView.get() == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mStartAutopilotView.get().setOnClickStartAutopilotBtnCallback(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -289,6 +297,7 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
|
|||||||
if (mStartAutopilotView == null || mStartAutopilotView.get() == null){
|
if (mStartAutopilotView == null || mStartAutopilotView.get() == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
mStartAutopilotView.get().setOnClickStartAutopilotBtnCallback(null);
|
||||||
OverlayViewUtils.dismissOverlayView(mStartAutopilotView.get());
|
OverlayViewUtils.dismissOverlayView(mStartAutopilotView.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,24 +205,36 @@ public class TaxiPassengerMapDirectionView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLineMarker() {
|
||||||
|
if (mStartMarker != null) {
|
||||||
|
mStartMarker.setVisible(false);
|
||||||
|
}
|
||||||
|
if (mEndMarker != null) {
|
||||||
|
mEndMarker.setVisible(false);
|
||||||
|
}
|
||||||
|
if (mCoordinatesLatLng.size() > 2) {
|
||||||
|
// 设置开始结束Marker位置
|
||||||
|
LatLng startLatLng = mCoordinatesLatLng.get(0);
|
||||||
|
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
|
||||||
|
|
||||||
|
mStartMarker.setPosition(startLatLng);
|
||||||
|
mEndMarker.setPosition(endLatLng);
|
||||||
|
mStartMarker.setVisible(true);
|
||||||
|
mEndMarker.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawablePolyline() {
|
public void drawablePolyline() {
|
||||||
clearPolyline();
|
if (mPolyline != null) {
|
||||||
|
mPolyline.remove();
|
||||||
|
}
|
||||||
if (mAMap != null) {
|
if (mAMap != null) {
|
||||||
|
|
||||||
addRouteColorList();
|
addRouteColorList();
|
||||||
|
|
||||||
if (mCoordinatesLatLng.size() > 2) {
|
if (mCoordinatesLatLng.size() > 2) {
|
||||||
// 设置开始结束Marker位置
|
|
||||||
|
|
||||||
LatLng startLatLng = mCoordinatesLatLng.get(0);
|
|
||||||
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
|
|
||||||
|
|
||||||
mStartMarker.setPosition(startLatLng);
|
|
||||||
mEndMarker.setPosition(endLatLng);
|
|
||||||
mStartMarker.setVisible(true);
|
|
||||||
mEndMarker.setVisible(true);
|
|
||||||
|
|
||||||
//设置线段纹理
|
//设置线段纹理
|
||||||
PolylineOptions polylineOptions = new PolylineOptions();
|
PolylineOptions polylineOptions = new PolylineOptions();
|
||||||
polylineOptions.addAll(mCoordinatesLatLng);
|
polylineOptions.addAll(mCoordinatesLatLng);
|
||||||
@@ -273,7 +285,6 @@ public class TaxiPassengerMapDirectionView
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearPolyline() {
|
public void clearPolyline() {
|
||||||
// mCoordinatesLatLng.clear();
|
|
||||||
if (mPolyline != null) {
|
if (mPolyline != null) {
|
||||||
mPolyline.remove();
|
mPolyline.remove();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,10 +208,17 @@ public class TaxiPassengerServingOrderFragment extends
|
|||||||
TaxiPassengerModel.getInstance().destoryGeocodeSearch();
|
TaxiPassengerModel.getInstance().destoryGeocodeSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void routeResult(List<MogoLatLng> latLngList) {
|
public void setLineMarker(List<LatLng> latLngList){
|
||||||
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "routeResult:" + latLngList.size());
|
|
||||||
if (latLngList.size() > 0) {
|
if (latLngList.size() > 0) {
|
||||||
drawablePolyline(latLngList);
|
if (mMapDirectionView != null) {
|
||||||
|
mMapDirectionView.setCoordinatesLatLng(latLngList);
|
||||||
|
UiThreadHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mMapDirectionView.setLineMarker();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
clearPolyline();
|
clearPolyline();
|
||||||
}
|
}
|
||||||
@@ -226,23 +233,6 @@ public class TaxiPassengerServingOrderFragment extends
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 绘制
|
|
||||||
*
|
|
||||||
* @param coordinates
|
|
||||||
*/
|
|
||||||
private void drawablePolyline(List<MogoLatLng> coordinates) {
|
|
||||||
if (mMapDirectionView != null) {
|
|
||||||
mMapDirectionView.convert(coordinates);
|
|
||||||
UiThreadHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mMapDirectionView.drawablePolyline();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void drawablePolylineByServerRoute(List<LatLng> mCoordinatesLatLng){
|
public void drawablePolylineByServerRoute(List<LatLng> mCoordinatesLatLng){
|
||||||
if (mMapDirectionView != null){
|
if (mMapDirectionView != null){
|
||||||
mMapDirectionView.setCoordinatesLatLng(mCoordinatesLatLng);
|
mMapDirectionView.setCoordinatesLatLng(mCoordinatesLatLng);
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ public class TPRouteDataTestUtils {
|
|||||||
builder.setLongitude(s.getDouble("lon"));
|
builder.setLongitude(s.getDouble("lon"));
|
||||||
list.add(builder.build());
|
list.add(builder.build());
|
||||||
}
|
}
|
||||||
TaxiPassengerModel.getInstance().updateRouteResult(list);
|
TaxiPassengerModel.getInstance().setRouteLineMarker(list);
|
||||||
|
TaxiPassengerModel.getInstance().startToRouteAndWipe(list);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user