merge
This commit is contained in:
@@ -137,9 +137,9 @@ class MogoOCHTaxiModel {
|
||||
// if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
// restoreOrderInfo();
|
||||
// }
|
||||
// if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
// querryCarStatus();
|
||||
// }
|
||||
if ( NetworkUtils.isConnected( mContext ) ) {
|
||||
querryCarStatus();
|
||||
}
|
||||
}
|
||||
|
||||
public void querryCarStatus() {
|
||||
@@ -186,15 +186,16 @@ class MogoOCHTaxiModel {
|
||||
private void restoreOrderInfo() {
|
||||
Logger.d( TAG, "重新查询订单状态" );
|
||||
mRetryCounter = 0;
|
||||
if ( mCurrentOCHOrder == null ) {
|
||||
// 订单恢复
|
||||
String orderInfo = SharedPrefsMgr.getInstance( mContext ).getString( SP_KEY_OCH_TAXI_ORDER );
|
||||
Logger.d(TAG,"restoreOrderInfo:"+orderInfo);
|
||||
if ( !TextUtils.isEmpty( orderInfo ) ) {
|
||||
mCurrentOCHOrder = GsonUtil.objectFromJson( orderInfo, OCHTaxiOrderResponse.class );
|
||||
}
|
||||
}
|
||||
query2RestoreOrderStatus(mCurrentOCHOrder == null ? null : mCurrentOCHOrder.orderNo);
|
||||
// if ( mCurrentOCHOrder == null ) {
|
||||
// // 订单恢复
|
||||
// String orderInfo = SharedPrefsMgr.getInstance( mContext ).getString( SP_KEY_OCH_TAXI_ORDER );
|
||||
// Logger.d(TAG,"restoreOrderInfo:"+orderInfo);
|
||||
// if ( !TextUtils.isEmpty( orderInfo ) ) {
|
||||
// mCurrentOCHOrder = GsonUtil.objectFromJson( orderInfo, OCHTaxiOrderResponse.class );
|
||||
// }
|
||||
// }
|
||||
// query2RestoreOrderStatus(mCurrentOCHOrder == null ? null : mCurrentOCHOrder.orderNo);
|
||||
query2RestoreOrderStatus(null);
|
||||
}
|
||||
|
||||
// private void restoreOrderInfo_() {
|
||||
@@ -236,7 +237,7 @@ class MogoOCHTaxiModel {
|
||||
queryOCHOrderStatus( orderNo, new OCHOrderStatusCallback< OCHTaxiOrderResponse2 >() {
|
||||
@Override
|
||||
public void onSuccess( OCHTaxiOrderResponse2 data ) {
|
||||
|
||||
Logger.d( TAG, "query2RestoreOrderStatus:"+ data.toString());
|
||||
if ( data == null || data.data == null) {
|
||||
Logger.d( TAG, "订单已取消或已完成" );
|
||||
clearCurrentOCHOrder();
|
||||
@@ -332,18 +333,26 @@ class MogoOCHTaxiModel {
|
||||
mCurrentOCHOrder.drivingRoutes = new ArrayList<>();
|
||||
OCHTaxiOrderResponse.OCHTaxiStation startStation = new OCHTaxiOrderResponse.OCHTaxiStation();
|
||||
List< Double > startStationCoordinate = data.data.startStationCoordinate;
|
||||
if (startStationCoordinate != null && startStationCoordinate.size()>1){
|
||||
startStation.lon = startStationCoordinate.get( 0 );
|
||||
startStation.lat = startStationCoordinate.get( 1 );
|
||||
List< Double > startGcjStationCoordinate = data.data.startGcjStationCoordinate;
|
||||
if (startStationCoordinate != null && startStationCoordinate.size()>1 &&
|
||||
startGcjStationCoordinate!= null && startGcjStationCoordinate.size() > 1){
|
||||
startStation.lon = startGcjStationCoordinate.get( 0 );
|
||||
startStation.lat = startGcjStationCoordinate.get( 1 );
|
||||
startStation.wgsLon = startStationCoordinate.get(0);
|
||||
startStation.wgsLat = startStationCoordinate.get(1);
|
||||
startStation.siteId = data.data.startStationId;
|
||||
startStation.siteName = data.data.startStation;
|
||||
mCurrentOCHOrder.drivingRoutes.add( startStation );
|
||||
}
|
||||
OCHTaxiOrderResponse.OCHTaxiStation endStation = new OCHTaxiOrderResponse.OCHTaxiStation();
|
||||
List< Double > endStationCoordinate = data.data.endStationCoordinate;
|
||||
if (endStationCoordinate != null && endStationCoordinate.size()>1){
|
||||
endStation.lon = endStationCoordinate.get( 0 );
|
||||
endStation.lat = endStationCoordinate.get( 1 );
|
||||
List< Double > endGcjStationCoordinate = data.data.endGcjStationCoordinate;
|
||||
if (endStationCoordinate != null && endStationCoordinate.size()>1 &&
|
||||
endGcjStationCoordinate!=null && endGcjStationCoordinate.size() > 1){
|
||||
endStation.lon = endGcjStationCoordinate.get( 0 );
|
||||
endStation.lat = endGcjStationCoordinate.get( 1 );
|
||||
endStation.wgsLon = endStationCoordinate.get( 0 );
|
||||
endStation.wgsLat = endStationCoordinate.get( 1 );
|
||||
endStation.siteId = data.data.endStationId;
|
||||
endStation.siteName = data.data.endStation;
|
||||
mCurrentOCHOrder.drivingRoutes.add( endStation );
|
||||
@@ -553,6 +562,7 @@ class MogoOCHTaxiModel {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "收到新订单" + GsonUtil.jsonFromObject(obj));
|
||||
|
||||
mCurrentOCHOrder = obj;
|
||||
cacheOrderInfo2Native( mCurrentOCHOrder );
|
||||
Location location = MogoApisHandler.getInstance()
|
||||
@@ -789,8 +799,8 @@ class MogoOCHTaxiModel {
|
||||
|
||||
RemoteControlAutoPilotParameters parameters = new RemoteControlAutoPilotParameters();
|
||||
parameters.vehicleType = mCurrentOCHOrder.orderType;
|
||||
parameters.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 0 ).lat, mCurrentOCHOrder.drivingRoutes.get( 0 ).lon );
|
||||
parameters.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 1 ).lat, mCurrentOCHOrder.drivingRoutes.get( 1 ).lon );
|
||||
parameters.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 0 ).wgsLat, mCurrentOCHOrder.drivingRoutes.get( 0 ).wgsLon );
|
||||
parameters.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( mCurrentOCHOrder.drivingRoutes.get( 1 ).wgsLat, mCurrentOCHOrder.drivingRoutes.get( 1 ).wgsLon );
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getAdasControllerApi()
|
||||
@@ -807,6 +817,16 @@ class MogoOCHTaxiModel {
|
||||
return mCurrentOCHOrder;
|
||||
}
|
||||
|
||||
public void calculateTravelDistance(Location carLocation){
|
||||
if (mCurrentOCHOrder.drivingRoutes != null && mCurrentOCHOrder.drivingRoutes.size()>0){
|
||||
OCHTaxiOrderResponse.OCHTaxiStation endStationOCHLocation = mCurrentOCHOrder.drivingRoutes.get(1);
|
||||
double distance = CoordinateUtils.calculateLineDistance(
|
||||
endStationOCHLocation.lon, endStationOCHLocation.lat,
|
||||
carLocation.getLongitude(), carLocation.getLatitude());
|
||||
mCurrentOCHOrder.decreaseTravelDistance(distance);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束自动驾驶
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@ enum OCHOrderStatus {
|
||||
UserArriveAtStartStation( 3 ),
|
||||
OnTheWayToEndStation( 4 ),
|
||||
ArriveAtEndStation( 5 ),
|
||||
Completed( 6 ),
|
||||
Completed( 6 ),//行程完成
|
||||
Cancel( 7 );
|
||||
|
||||
private int code;
|
||||
|
||||
@@ -33,7 +33,7 @@ class OCHTaxiOrderResponse implements Parcelable {
|
||||
* @param distance
|
||||
*/
|
||||
public void decreaseTravelDistance( double distance ) {
|
||||
travelDistance -= ( ( float ) distance / 1000f );
|
||||
travelDistance = ( ( float ) distance / 1000f );
|
||||
if ( travelDistance < 0 ) {
|
||||
travelDistance = 0;
|
||||
}
|
||||
@@ -42,9 +42,10 @@ class OCHTaxiOrderResponse implements Parcelable {
|
||||
public static class OCHTaxiStation implements Parcelable {
|
||||
public String siteId;
|
||||
public String siteName;
|
||||
public double lon;
|
||||
public double lon;// 用于计算距离
|
||||
public double lat;
|
||||
|
||||
public double wgsLon;//用于自动驾驶
|
||||
public double wgsLat;
|
||||
public OCHTaxiStation() {
|
||||
}
|
||||
|
||||
@@ -59,6 +60,8 @@ class OCHTaxiOrderResponse implements Parcelable {
|
||||
dest.writeString( this.siteName );
|
||||
dest.writeDouble( this.lon );
|
||||
dest.writeDouble( this.lat );
|
||||
dest.writeDouble( this.wgsLon );
|
||||
dest.writeDouble( this.wgsLat );
|
||||
}
|
||||
|
||||
protected OCHTaxiStation( Parcel in ) {
|
||||
@@ -66,6 +69,8 @@ class OCHTaxiOrderResponse implements Parcelable {
|
||||
this.siteName = in.readString();
|
||||
this.lon = in.readDouble();
|
||||
this.lat = in.readDouble();
|
||||
this.wgsLon = in.readDouble();
|
||||
this.wgsLat = in.readDouble();
|
||||
}
|
||||
|
||||
public static final Creator< OCHTaxiStation > CREATOR = new Creator< OCHTaxiStation >() {
|
||||
|
||||
@@ -36,6 +36,7 @@ class OCHTaxiOrderResponse2 extends BaseData {
|
||||
public String startStationId;
|
||||
// 起点站点
|
||||
public List< Double > startStationCoordinate;
|
||||
public List< Double > startGcjStationCoordinate;//高德坐标系 用于距离计算
|
||||
|
||||
// 目的站名称
|
||||
public String endStation;
|
||||
@@ -43,6 +44,7 @@ class OCHTaxiOrderResponse2 extends BaseData {
|
||||
public String endStationId;
|
||||
// 终点站点
|
||||
public List< Double > endStationCoordinate;
|
||||
public List< Double > endGcjStationCoordinate;//高德坐标系 用于距离计算
|
||||
|
||||
public String orderStartTime;
|
||||
public String cityCode;
|
||||
|
||||
@@ -170,6 +170,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSpeakedEndingNotice = false;
|
||||
/**
|
||||
* 初始化订单信息
|
||||
*/
|
||||
@@ -180,7 +181,7 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
slidePanelView.setVisibility( View.VISIBLE );
|
||||
slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_end_station ) );
|
||||
mOrderStatus.setText( R.string.module_och_taxi_arrive_at_end_station2 );
|
||||
showNotice( getString( R.string.module_och_taxi_order_complete_1) );
|
||||
SpeakNoticeOnce();
|
||||
} else if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
Logger.d( TAG, "已经去往终点" );
|
||||
slidePanelView.setVisibility( View.GONE );
|
||||
@@ -188,15 +189,6 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
} else if ( MogoOCHTaxiModel.getInstance().isArriveAtStartStation() ) {
|
||||
Logger.d( TAG, "已经达到起点" );
|
||||
mOrderStatus.setText( R.string.module_och_taxi_waiting );
|
||||
// if ( MogoOCHTaxiModel.getInstance().isUserArriveAtStartStation() ) {
|
||||
// Logger.d( TAG, "乘客已上车" );
|
||||
// slidePanelView.setVisibility( View.VISIBLE );
|
||||
//// if ( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE ) {
|
||||
//// } else {
|
||||
//// slidePanelView.setVisibility( View.GONE );
|
||||
//// }
|
||||
// slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_start_station ) );
|
||||
// }
|
||||
slidePanelView.setVisibility( View.VISIBLE );
|
||||
slidePanelView.setText( getString( R.string.module_och_taxi_arrive_at_start_station ) );
|
||||
} else if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
|
||||
@@ -206,6 +198,13 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void SpeakNoticeOnce(){
|
||||
if (!isSpeakedEndingNotice){
|
||||
isSpeakedEndingNotice = true;
|
||||
showNotice( getString( R.string.module_och_taxi_order_complete_1) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新订单基本信息
|
||||
*/
|
||||
@@ -259,10 +258,10 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
Logger.d( TAG, "更新状态失败2" );
|
||||
}
|
||||
} );
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener( TAG, this );
|
||||
// MogoApisHandler.getInstance()
|
||||
// .getApis()
|
||||
// .getRegisterCenterApi()
|
||||
// .unregisterCarLocationChangedListener( TAG, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -367,7 +366,6 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged( MogoLatLng latLng ) {
|
||||
|
||||
}
|
||||
|
||||
private Location mLocation;
|
||||
@@ -377,18 +375,17 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
OCHTaxiUiController.getInstance().runOnUIThread( () -> {
|
||||
calculateTravelDistance( location );
|
||||
} );
|
||||
|
||||
//坐标转换
|
||||
MogoLocation loc = new MogoLocation();
|
||||
loc.setTime(loc.getTime());
|
||||
loc.setAccuracy(location.getAccuracy());
|
||||
loc.setSpeed(location.getSpeed());
|
||||
loc.setLongitude(location.getLongitude());
|
||||
loc.setLatitude(location.getLatitude());
|
||||
loc.setAltitude(location.getAltitude());
|
||||
loc.setBearing(location.getBearing());
|
||||
loc.setProvider(location.getProvider());
|
||||
mogoLocation = loc;
|
||||
// //坐标转换
|
||||
// MogoLocation loc = new MogoLocation();
|
||||
// loc.setTime(loc.getTime());
|
||||
// loc.setAccuracy(location.getAccuracy());
|
||||
// loc.setSpeed(location.getSpeed());
|
||||
// loc.setLongitude(location.getLongitude());
|
||||
// loc.setLatitude(location.getLatitude());
|
||||
// loc.setAltitude(location.getAltitude());
|
||||
// loc.setBearing(location.getBearing());
|
||||
// loc.setProvider(location.getProvider());
|
||||
// mogoLocation = loc;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -400,21 +397,26 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
if ( location == null ) {
|
||||
return;
|
||||
}
|
||||
if ( !MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
return;
|
||||
}
|
||||
if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
|
||||
return;
|
||||
}
|
||||
// if ( !MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( MogoOCHTaxiModel.getInstance().isArriveAtEndStation() ) {
|
||||
// return;
|
||||
// }
|
||||
if ( mLocation == null ) {
|
||||
mLocation = location;
|
||||
}
|
||||
double distance = CoordinateUtils.calculateLineDistance(
|
||||
location.getLongitude(), location.getLatitude(),
|
||||
mLocation.getLongitude(), mLocation.getLatitude()
|
||||
);
|
||||
if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
|
||||
MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().decreaseTravelDistance( distance );
|
||||
// double distance = CoordinateUtils.calculateLineDistance(
|
||||
// location.getLongitude(), location.getLatitude(),
|
||||
// mLocation.getLongitude(), mLocation.getLatitude()
|
||||
// );
|
||||
// Logger.e("lianglihui","calculateTravelDistance:"+distance);
|
||||
|
||||
if ( MogoOCHTaxiModel.getInstance().isOnTheWay2EndStation() &&
|
||||
MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() &&
|
||||
!MogoOCHTaxiModel.getInstance().isArriveAtEndStation()) {
|
||||
MogoOCHTaxiModel.getInstance().calculateTravelDistance(location);
|
||||
// MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().decreaseTravelDistance( distance );
|
||||
updateOrderBaseStatusInfo();
|
||||
}
|
||||
mLocation = location;
|
||||
@@ -448,10 +450,14 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
getPanelView().setVisibility(View.INVISIBLE);
|
||||
hideSlidePanel();
|
||||
changeOperationViewVisible(View.VISIBLE);
|
||||
}else {
|
||||
isSpeakedEndingNotice = false;
|
||||
} else {
|
||||
getPanelView().setVisibility(View.VISIBLE);
|
||||
changeOperationViewVisible(View.INVISIBLE);
|
||||
}
|
||||
if (status == OCHOrderStatus.OnTheWayToStartStation.getCode()){
|
||||
showNotice("收到新订单");
|
||||
}
|
||||
updateOrderStatus();
|
||||
});
|
||||
}
|
||||
@@ -460,11 +466,11 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
@Override
|
||||
public void routeResult(List<MogoLatLng> routeList) {
|
||||
if (routeList == null ) return;
|
||||
double distance = calculateTravelDistance(mogoLocation,routeList);
|
||||
if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
|
||||
MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().decreaseTravelDistance( distance );
|
||||
updateOrderBaseStatusInfo();
|
||||
}
|
||||
// double distance = calculateTravelDistance(mogoLocation,routeList);
|
||||
// if ( MogoOCHTaxiModel.getInstance().checkCurrentOCHOrder() ) {
|
||||
// MogoOCHTaxiModel.getInstance().getCurrentOCHOrder().decreaseTravelDistance( distance );
|
||||
// updateOrderBaseStatusInfo();
|
||||
// }
|
||||
// Logger.d("lianglihui","routeResult 剩余导航距离:"+distance);
|
||||
// if (routeList != null && routeList.size() >0){
|
||||
// Logger.d("lianglihui","routeResult:"+routeList.size());
|
||||
@@ -506,7 +512,6 @@ class OCHTaxiFragment extends BaseOchFragment< OCHTaxiView, OCHTaxiPresenter > i
|
||||
public void onArriveAt(AdasOCHData data) {
|
||||
Logger.d( TAG, "行程结束");
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().cancelAutopilot();
|
||||
// AIAssist.getInstance( getContext() ).speakTTSVoice( "即将到达目的地,请您携带好随身物品,安全下车。" );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="module_och_taxi_arrive_at_start_station">乘客已上车,准备出发</string>
|
||||
<string name="module_och_taxi_arrive_at_start_station">确认上车,行程开始</string>
|
||||
<string name="module_och_taxi_arrive_at_end_station">到达站点,乘客已下车</string>
|
||||
<string name="module_och_taxi_order_status_ph_text">已到达上车站点,等待乘客上车</string>
|
||||
<string name="module_och_taxi_order_distance_anchor_text">预计里程</string>
|
||||
|
||||
@@ -110,4 +110,7 @@ fix crash
|
||||
修改崩溃
|
||||
|
||||
8.5.63
|
||||
修改infoWindow崩溃
|
||||
修改infoWindow崩溃
|
||||
|
||||
8.5.64
|
||||
修改崩溃
|
||||
@@ -80,17 +80,15 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
*/
|
||||
public void renderWarnData(V2XWarningEntity data) {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(data.getDirection() == 1 ? data.getStopLines().get(0).lat : data.getLat());
|
||||
location.setLon(data.getDirection() == 1 ? data.getStopLines().get(0).lon : data.getLon());
|
||||
location.setLat(data.getLat());
|
||||
location.setLon(data.getLon());
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setMarkerLocation(location);
|
||||
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA);
|
||||
IMogoMarker marker = drawMarker(markerShowEntity, modeResType(data.getType()));
|
||||
//识别物
|
||||
marker.addDynamicAnchorPosition(new MogoLatLng(
|
||||
data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(),
|
||||
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
|
||||
marker.addDynamicAnchorPosition(new MogoLatLng(data.getCollisionLat(), data.getCollisionLon()), (float) data.getHeading(), 5000);
|
||||
//移动完成以后,3s后消失
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
marker.remove();
|
||||
@@ -98,19 +96,16 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
|
||||
}
|
||||
|
||||
//根据识别物类型 (行人0/自行车1/摩托车2/小汽车3/公交车4)获取3D模型(对应查看getModelRes)
|
||||
//根据识别物类型 (行人1/自行车2/摩托车4/骑行车辆11)获取3D模型(对应查看getModelRes)
|
||||
private int modeResType(int dataType) {
|
||||
switch (dataType) {
|
||||
case 0:
|
||||
return 1;
|
||||
case 1:
|
||||
return 2;
|
||||
case 11:
|
||||
return 1;
|
||||
case 2:
|
||||
return 4;
|
||||
case 3:
|
||||
return 3;
|
||||
return 2;
|
||||
case 4:
|
||||
return 6;
|
||||
return 4;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
*/
|
||||
public class V2XWarningEntity implements Serializable {
|
||||
|
||||
//事件类型 行人0/自行车1/摩托车2/小汽车3/公交车4
|
||||
//事件类型 行人1/自行车2/摩托车4/骑行车辆11
|
||||
private int type;
|
||||
//目标物位置
|
||||
private double lat;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<dimen name="dp_32">42px</dimen>
|
||||
<dimen name="module_v2n_tip_width">628px</dimen>
|
||||
<dimen name="module_v2n_tip_height">188px</dimen>
|
||||
<dimen name="module_v2n_tip_text_width">106px</dimen>
|
||||
<dimen name="module_v2n_tip_text_margin_right">52px</dimen>
|
||||
<dimen name="module_v2n_tip_text_width">120px</dimen>
|
||||
<dimen name="module_v2n_tip_text_margin_right">26px</dimen>
|
||||
<dimen name="module_v2n_image_margin_left">37px</dimen>
|
||||
<dimen name="module_v2x_brake_tip_width">435px</dimen>
|
||||
<dimen name="module_v2x_brake_tip_height">186px</dimen>
|
||||
|
||||
@@ -58,7 +58,7 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
/*
|
||||
* 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算
|
||||
* */
|
||||
private MogoLatLng middleLocationInStopLine;
|
||||
private MogoLatLng middleLocationInStopLine = new MogoLatLng(0,0);
|
||||
private static long showTime = 5000;
|
||||
private float bearing;
|
||||
|
||||
@@ -75,8 +75,8 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
}
|
||||
|
||||
public void drawLineWithEntity() {
|
||||
showTime = mCloundWarningInfo.getShowTime() > 0 ? mCloundWarningInfo.getShowTime() : 5000;
|
||||
Log.d(TAG, "显示时间为++" + String.valueOf(showTime));
|
||||
showTime = mCloundWarningInfo.getShowTime() > 0 ? mCloundWarningInfo.getShowTime()*1000 : 5000;
|
||||
Log.d(TAG, "显示时间为++" + String.valueOf(showTime)+"识别物类型:"+String.valueOf(mCloundWarningInfo.getType()));
|
||||
pointsBetween();
|
||||
bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing();
|
||||
isSelfLineClear = false;
|
||||
@@ -95,8 +95,12 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
drawRedWarningLineFrontOfStopLine(mCloundWarningInfo, middleLocationInStopLine, warningLocation);
|
||||
//添加停止线marker
|
||||
handleStopLine();
|
||||
//自车画线
|
||||
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
if (carLocation.lat != 0 && carLocation.lon != 0){
|
||||
//自车画线
|
||||
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
}else {
|
||||
Log.d(TAG,"自车定位数据为空carLocation == null");
|
||||
}
|
||||
}, 0);
|
||||
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
@@ -114,7 +118,11 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
|
||||
V2XWarnDataDrawer.getInstance().renderWarnData(mCloundWarningInfo);
|
||||
//车辆静止的时候
|
||||
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
if (carLocation.lat != 0 && carLocation.lon != 0){
|
||||
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
}else {
|
||||
Log.d(TAG,"数据为空carLocation == null");
|
||||
}
|
||||
|
||||
}, 0);
|
||||
|
||||
@@ -242,16 +250,15 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
if (!isSelfLineClear) {
|
||||
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
|
||||
if (mCloundWarningInfo != null) {
|
||||
MogoLatLng startLatlng = null;
|
||||
MogoLatLng endLatlng = null;
|
||||
MogoLatLng addMiddleLoc = null;
|
||||
MogoLatLng startLatlng = new MogoLatLng(0,0);
|
||||
MogoLatLng endLatlng = new MogoLatLng(0,0);
|
||||
MogoLatLng addMiddleLoc = new MogoLatLng(0,0);
|
||||
|
||||
if (!isFirstLocation) {
|
||||
carLocation = getMogoLat(new MogoLatLng(lat, lon));
|
||||
isFirstLocation = true;
|
||||
}
|
||||
//绘制线的终点(在停止线上或者预碰撞点上)
|
||||
|
||||
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(),
|
||||
mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon());
|
||||
//自车位置
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/module_v2n_image_margin_left"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/v2x_road_front_car_warning" />
|
||||
|
||||
<TextView
|
||||
@@ -22,7 +22,7 @@
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="@dimen/dp_28"
|
||||
android:maxWidth="@dimen/module_v2n_tip_text_width"
|
||||
android:text="1.2米"
|
||||
android:text="112米"
|
||||
android:textColor="@color/v2x_FF3036"
|
||||
android:textSize="@dimen/dp_32" />
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@+id/warning_distance"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:layout_marginRight="@dimen/module_v2n_tip_text_margin_right"
|
||||
android:layout_toRightOf="@+id/warning_type_image"
|
||||
android:text="前车碰撞预警"
|
||||
|
||||
Reference in New Issue
Block a user