Merge branch 'dev_robotaxi-d-app-module_290_220715_2.9.0' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_robotaxi-d-app-module_290_220715_2.9.0

This commit is contained in:
xinfengkun
2022-07-22 22:32:09 +08:00
24 changed files with 137 additions and 81 deletions

View File

@@ -42,6 +42,9 @@ public class BusPassengerModelLoopManager {
public void startOrStopRouteAndWipe() {
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "startOrStopRouteWipe()");
if (mRouteWipeDisposable == null){
mRouteWipeDisposable = new CompositeDisposable();
}
Disposable disposable = startLoopRouteAndWipe()
.doOnSubscribe(new Consumer<Disposable>() {
@Override
@@ -93,6 +96,9 @@ public class BusPassengerModelLoopManager {
public void startCalculateRouteInfoLoop() {
CallerLogger.INSTANCE.i(M_BUS_P + TAG, "startCalculateRouteInfoLoop()");
if (mCalculateRouteDisposable == null){
mCalculateRouteDisposable = new CompositeDisposable();
}
Disposable disposable = startLoopCalculateRouteInfo()
.doOnSubscribe(new Consumer<Disposable>() {
@Override

View File

@@ -64,9 +64,8 @@ public class BusPassengerMapDirectionView
private CameraUpdate mCameraUpdate;
private Context mContext;
private List<Integer> colorList = new ArrayList<>();
// List<BitmapDescriptor> textureList = new ArrayList<>();
// List<Integer> texIndexList = new ArrayList<>();
List<BitmapDescriptor> textureList = new ArrayList<>();
List<Integer> texIndexList = new ArrayList<>();
private int mHaveArrivedIndex = 0;
private List<Marker> mLineMarkers = new ArrayList<>();
@@ -222,8 +221,6 @@ public class BusPassengerMapDirectionView
}
if (mAMap != null) {
addRouteColorList();
if (mCoordinatesLatLng.size() > 2) {
//设置线段纹理
@@ -232,9 +229,9 @@ public class BusPassengerMapDirectionView
polylineOptions.useGradient(true);
polylineOptions.width(10); //线段宽度
polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound);
// polylineOptions.setCustomTextureList(textureList);
// polylineOptions.setCustomTextureIndex(texIndexList);
polylineOptions.colorValues(colorList);
polylineOptions.setCustomTextureList(textureList);
polylineOptions.setCustomTextureIndex(texIndexList);
// polylineOptions.colorValues(colorList);
// polylineOptions.setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow));
// 绘制线
@@ -248,17 +245,15 @@ public class BusPassengerMapDirectionView
* 添加画线颜色值
*/
private void addRouteColorList() {
// for (int i = 0 ; i < mHaveArrivedIndex; i++){
// textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow));
// texIndexList.add(i);
// }
//
// for (int i = mHaveArrivedIndex; i < mCoordinatesLatLng.size(); i++){
// textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow));
// texIndexList.add(i);
// }
for (int i = 0; i < mCoordinatesLatLng.size(); i++) {
colorList.add(Color.argb(255, 70, 147, 253));//路线颜色
textureList.clear();
texIndexList.clear();
for (int i = 0; i < mCoordinatesLatLng.size(); i++){
if (i <= mHaveArrivedIndex){
textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow_arrived));
}else {
textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_arrow_un_arrive));
}
texIndexList.add(i);
}
}
@@ -335,6 +330,7 @@ public class BusPassengerMapDirectionView
mCoordinatesLatLng.clear();
mCoordinatesLatLng.addAll(latLngs);
mHaveArrivedIndex = haveArrivedIndex;
addRouteColorList();
}
public void clearLineMarkers(){

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

View File

@@ -26,6 +26,7 @@ import com.mogo.och.bus.constant.BusConst;
import com.mogo.och.bus.presenter.BusPresenter;
import com.mogo.och.bus.ui.BusSwitchLineActivity;
import com.mogo.och.bus.view.SlidePanelView;
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
import java.util.List;
@@ -337,27 +338,43 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
*/
private void setOrRemoveMapMaker(boolean isAdd, String uuid, double lat, double longi,int resourceId) {
if (isAdd) {
CallerLogger.INSTANCE.d(M_BUS + "setMapMaker= ", uuid + "=latitude=" + lat + ",longitude=" + longi);
Runnable setMapMarkerRunnable = new Runnable() {
@Override
public void run() {
CallerLogger.INSTANCE.d(M_BUS + "setMapMaker= "+Thread.currentThread().getName(),
uuid + "=latitude=" + lat + ",longitude=" + longi);
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(BusConst.TYPE_MARKER_BUS_ORDER)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.gps(true)
.controlAngle(true)
.icon3DRes(resourceId)
.latitude(lat)
.longitude(longi);
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .addMarker(uuid, options);
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(
longi,lat,-1);
if (null != centerLine){ // 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致
marker.setRotateAngle(centerLine.getAngle().floatValue());
}
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(BusConst.TYPE_MARKER_BUS_ORDER)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.gps(true)
.controlAngle(true)
.icon3DRes(resourceId)
.latitude(lat)
.longitude(longi);
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .addMarker(uuid, options);
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(
longi,lat,-1);
if (null != centerLine){ // 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致
marker.setRotateAngle(centerLine.getAngle().floatValue());
}
}
};
OCHThreadPoolManager.getsInstance().execute(setMapMarkerRunnable);
}else {
CallerLogger.INSTANCE.d(M_BUS + "RemoveMapMaker=",uuid+"=latitude="+lat+",longitude="+longi);
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers(uuid);
Runnable removeMapMarkerRunnable = new Runnable() {
@Override
public void run() {
CallerLogger.INSTANCE.d(M_BUS + "RemoveMapMaker="+Thread.currentThread().getName(),
uuid+"=latitude="+lat+",longitude="+longi);
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers(uuid);
}
};
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable);
}
}

View File

@@ -12,5 +12,5 @@ import mogo.telematics.pad.MessagePad;
*/
public interface IOCHTaxiPassengerAutopilotPlanningCallback {
void setLineMarker(List<LatLng> models);
void routeResultByServer(List<LatLng> models);
void routeResultByServer(List<LatLng> models,int haveArrivedIndex);
}

View File

@@ -617,10 +617,10 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
public void loopRouteAndWipe() {
if (mLocationsModels != null && mLocationsModels.size() > 0){
List<LatLng> lastPoints = CoordinateCalculateRouteUtil
.getRemainPointListByCompare(mLocationsModels,mLongitude,mLatitude);
int haveArrivedIndex = CoordinateCalculateRouteUtil
.getArrivedPointIndex(mLocationsModels,mLongitude,mLatitude);
if (mAutopilotPlanningCallback != null){
mAutopilotPlanningCallback.routeResultByServer(lastPoints);
mAutopilotPlanningCallback.routeResultByServer(mLocationsModels,haveArrivedIndex);
}
}
}

View File

@@ -35,7 +35,7 @@ public class TaxiPassengerModelLoopManager {
private Disposable mInAndWaitServiceDisposable; //进行中、待服务订单列表轮询
private Disposable mQueryOrderRemainingDisposable; //心跳轮询
private CompositeDisposable mRouteWipeDisposable; //轨迹擦除
private CompositeDisposable mRouteWipeDisposable = new CompositeDisposable(); //轨迹擦除
private Disposable mReadyToAutopilotDisposable; //轮询是否可开启自动驾驶
public void startReadyToAutopilot() {
@@ -60,6 +60,9 @@ public class TaxiPassengerModelLoopManager {
}
public void startRouteAndWipe() {
if (mRouteWipeDisposable == null){
mRouteWipeDisposable = new CompositeDisposable();
}
CallerLogger.INSTANCE.i(M_TAXI_P + TAG, "startRouteAndWipe()");
Disposable disposable = startLoopRouteAndWipe()
.doOnSubscribe(new Consumer<Disposable>() {

View File

@@ -74,13 +74,13 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
runOnUIThread(() -> mView.setLineMarker(models));
}
@Override
public void routeResultByServer(List<LatLng> models) {
public void routeResultByServer(List<LatLng> models, int haveArrivedIndex) {
if (models == null) return;
runOnUIThread(() -> mView.routeResultByServer(models));
runOnUIThread(() -> mView.routeResultByServer(models,haveArrivedIndex));
}
@Override
public void onCurrentOrderStatusChanged(TaxiPassengerOrderQueryRespBean.Result order) {
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, GsonUtil.jsonFromObject(order));

View File

@@ -3,7 +3,6 @@ package com.mogo.och.taxi.passenger.ui;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -19,6 +18,7 @@ import com.amap.api.maps.CameraUpdateFactory;
import com.amap.api.maps.CoordinateConverter;
import com.amap.api.maps.TextureMapView;
import com.amap.api.maps.UiSettings;
import com.amap.api.maps.model.BitmapDescriptor;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.CameraPosition;
import com.amap.api.maps.model.CustomMapStyleOptions;
@@ -61,8 +61,10 @@ public class TaxiPassengerMapDirectionView
private Polyline mPolyline;
private CameraUpdate mCameraUpdate;
private Context mContext;
private int mHaveArrivedIndex;
private List<Integer> colorList = new ArrayList<>();
List<BitmapDescriptor> textureList = new ArrayList<>();
List<Integer> texIndexList = new ArrayList<>();
private ITaxiPassengerMapViewCallback mITaxiPassengerMapViewCallback;
@@ -232,7 +234,7 @@ public class TaxiPassengerMapDirectionView
}
if (mAMap != null) {
addRouteColorList();
// addRouteColorList();
if (mCoordinatesLatLng.size() > 2) {
//设置线段纹理
@@ -243,7 +245,9 @@ public class TaxiPassengerMapDirectionView
//polylineOptions.useGradient(true);
polylineOptions.width(15);
polylineOptions.lineCapType(PolylineOptions.LineCapType.LineCapRound);
polylineOptions.setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow));
polylineOptions.setCustomTextureList(textureList);
polylineOptions.setCustomTextureIndex(texIndexList);
// polylineOptions.setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow_un_arrive));
// 绘制线
mPolyline = mAMap.addPolyline(polylineOptions);
@@ -256,12 +260,20 @@ public class TaxiPassengerMapDirectionView
* 添加画线颜色值
*/
private void addRouteColorList() {
textureList.clear();
texIndexList.clear();
for (int i = 0; i < mCoordinatesLatLng.size(); i++){
if (i <= mCoordinatesLatLng.size()/2){
colorList.add(Color.argb(255, 31, 195, 255));//start
// if (i <= mCoordinatesLatLng.size()/2){
// colorList.add(Color.argb(255, 31, 195, 255));//start
// }else {
// colorList.add(Color.argb(255, 87, 171, 255));//end
// }
if (i <= mHaveArrivedIndex){
textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow_arrived));
}else {
colorList.add(Color.argb(255, 87, 171, 255));//end
textureList.add(BitmapDescriptorFactory.fromResource(R.drawable.taxi_p_map_arrow_un_arrive));
}
texIndexList.add(i);
}
}
@@ -344,6 +356,13 @@ public class TaxiPassengerMapDirectionView
mCoordinatesLatLng.addAll(latLngs);
}
public void setCoordinatesLatLng(List<LatLng> latLngs, int haveArrivedIndex){
mCoordinatesLatLng.clear();
mCoordinatesLatLng.addAll(latLngs);
mHaveArrivedIndex = haveArrivedIndex;
addRouteColorList();
}
@Override
public void onCameraChange(CameraPosition cameraPosition) {
mITaxiPassengerMapViewCallback.onCameraChange(cameraPosition.bearing);

View File

@@ -228,18 +228,18 @@ public class TaxiPassengerServingOrderFragment extends
}
}
public void routeResultByServer(List<LatLng> latLngList) {
public void routeResultByServer(List<LatLng> latLngList,int haveArrivedIndex) {
CallerLogger.INSTANCE.d(M_TAXI_P + TAG, "routeResultByServer:" + latLngList.size());
if (latLngList.size() > 0) {
drawablePolylineByServerRoute(latLngList);
drawablePolylineByServerRoute(latLngList,haveArrivedIndex);
} else {
clearPolyline();
}
}
public void drawablePolylineByServerRoute(List<LatLng> mCoordinatesLatLng){
public void drawablePolylineByServerRoute(List<LatLng> mCoordinatesLatLng,int haveArrivedIndex){
if (mMapDirectionView != null){
mMapDirectionView.setCoordinatesLatLng(mCoordinatesLatLng);
mMapDirectionView.setCoordinatesLatLng(mCoordinatesLatLng,haveArrivedIndex);
UiThreadHandler.post(new Runnable() {
@Override
public void run() {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 897 B

View File

@@ -32,6 +32,7 @@ import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.och.common.module.utils.DateTimeUtil;
import com.mogo.och.common.module.utils.NumberFormatUtil;
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
import com.mogo.och.taxi.callback.ITaxiNaviChangedCallback;
import com.mogo.och.taxi.constant.TaxiConst;
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
@@ -602,28 +603,42 @@ public class TaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implement
*/
private void setOrRemoveMapMaker(boolean isAdd, String uuid, List<Double> station,int resourceId){
if (isAdd){
CallerLogger.INSTANCE.d(M_TAXI + "setMapMaker= ",uuid+"=latitude="
+station.get(1)+",longitude="+station.get(0));
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(TaxiConst.TYPE_MARKER_TAXI_ORDER)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.gps(true)
.controlAngle(true)
.icon3DRes(resourceId)
.latitude(station.get(1))
.longitude(station.get(0));
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).addMarker(uuid, options);
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(station.get(0)
,station.get(1),-1);
if (null != centerLine){// 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致
marker.setRotateAngle(centerLine.getAngle().floatValue());
}
//开启线程执行起终点marker设置
Runnable setMapMarkerRunnable = new Runnable() {
@Override
public void run() {
CallerLogger.INSTANCE.d(M_TAXI + "setMapMaker= " + Thread.currentThread().getName(),
uuid + "=latitude=" + station.get(1) + ",longitude=" + station.get(0));
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(TaxiConst.TYPE_MARKER_TAXI_ORDER)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.gps(true)
.controlAngle(true)
.icon3DRes(resourceId)
.latitude(station.get(1))
.longitude(station.get(0));
IMogoMarker marker = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).addMarker(uuid, options);
CenterLine centerLine = CallerHDMapManager.INSTANCE.getCenterLineInfo(station.get(0)
, station.get(1), -1);
if (null != centerLine) {// 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致
marker.setRotateAngle(centerLine.getAngle().floatValue());
}
}
};
OCHThreadPoolManager.getsInstance().execute(setMapMarkerRunnable);
}else {
CallerLogger.INSTANCE.d(M_TAXI + "RemoveMapMaker=",uuid+"=latitude="+station.get(1)+",longitude="+station.get(0));
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .removeMarkers(uuid);
//开启线程移除起终点marker设置
Runnable removeMapMarkerRunnable = new Runnable() {
@Override
public void run() {
CallerLogger.INSTANCE.d(M_TAXI + "RemoveMapMaker=" + Thread.currentThread().getName(),
uuid + "=latitude=" + station.get(1) + ",longitude=" + station.get(0));
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers(uuid);
}
};
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable);
}
}

View File

@@ -12,8 +12,8 @@
<dimen name="module_map_display_overview_right_margin">200px</dimen>
<dimen name="module_small_map_padding">40px</dimen>
<dimen name="module_small_map_view_border_width">700px</dimen>
<dimen name="module_small_map_view_border_width">400px</dimen>
<dimen name="module_small_map_border_view_width">550px</dimen>
<dimen name="module_small_map_view_width">660px</dimen>
<dimen name="module_small_map_view_width">360px</dimen>
</resources>

View File

@@ -12,7 +12,7 @@
<dimen name="module_map_display_overview_right_margin">100px</dimen>
<dimen name="module_small_map_padding">30px</dimen>
<dimen name="module_small_map_view_border_width">588px</dimen>
<dimen name="module_small_map_border_view_width">550px</dimen>
<dimen name="module_small_map_view_width">560px</dimen>
<dimen name="module_small_map_view_border_width">288px</dimen>
<dimen name="module_small_map_border_view_width">450px</dimen>
<dimen name="module_small_map_view_width">260px</dimen>
</resources>