[Taxi passenger V1.1.0] taxi/bus driver 起终点加载3d模型

This commit is contained in:
wangmingjun
2022-03-24 19:23:13 +08:00
parent 37be6cc1d7
commit e8732c3767
5 changed files with 50 additions and 43 deletions

View File

@@ -19,6 +19,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.map.MogoMarkerManager;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.och.bus.R;
import com.mogo.och.bus.bean.OchBusStation;
import com.mogo.och.bus.constant.OchBusConst;
@@ -172,34 +173,34 @@ public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBus
startStationFlagVisibility = View.VISIBLE;
isArriveAtStartStation = true;
mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_start));
// CallerLogger.INSTANCE.d("MapMaker= ","起点=");
setOrRemoveMapMaker(true, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon(), R.drawable.icon_station_start_end);
, startStation.getLon());
setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon(), R.drawable.icon_station_start_end);
, endStation.getLon());
} else if (currentStation > 0 && currentStation < stationList.size() - 1) {// 是否到达站点
// CallerLogger.INSTANCE.d("MapMaker= ","中间=");
isArriveAtStation = true;
// mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_start1));
setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon(), R.drawable.icon_station_start_end);
, startStation.getLon());
setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon(), R.drawable.icon_station_start_end);
, endStation.getLon());
} else if (currentStation == stationList.size() - 1) {// 是否到达终点
// CallerLogger.INSTANCE.d("MapMaker= ","终点=");
isArriveEndStation = true;
nextStationName = "--";
mStartStationFlag.setText(getResources().getString(R.string.bus_arrive_to_end_end));
startStationFlagVisibility = View.VISIBLE;
endStationFlagVisibility = View.INVISIBLE;
setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon(), R.drawable.icon_station_start_end);
, startStation.getLon());
if (isArrived) {
setOrRemoveMapMaker(false, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon(), R.drawable.icon_station_start_end);
, endStation.getLon());
} else {
setOrRemoveMapMaker(true, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon(), R.drawable.icon_station_start_end);
, endStation.getLon());
}
}
@@ -292,11 +293,11 @@ public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBus
//移除起点终点
if (null != startStation) {
setOrRemoveMapMaker(false, OchBusConst.BUS_START_MAP_MAKER, startStation.getLat()
, startStation.getLon(), R.drawable.icon_station_start_end);
, startStation.getLon());
}
if (null != endStation) {
setOrRemoveMapMaker(false, OchBusConst.BUS_END_MAP_MAKER, endStation.getLat()
, endStation.getLon(), R.drawable.icon_station_start_end);
, endStation.getLon());
}
}
}
@@ -317,20 +318,21 @@ public class OchBusFragment extends BaseOchBusTabFragment<OchBusFragment, OchBus
*
* @param isAdd
* @param uuid
* @param iconId
*/
private void setOrRemoveMapMaker(boolean isAdd, String uuid, double lat, double longi, int iconId) {
private void setOrRemoveMapMaker(boolean isAdd, String uuid, double lat, double longi) {
if (isAdd) {
CallerLogger.INSTANCE.d("setMapMaker= ", uuid + "=latitude=" + lat + ",longitude=" + longi);
MogoMarkerOptions options = new MogoMarkerOptions();
options.anchorColor("#000000");//不设置报错,暂时随便设置个
options.setGps(true);//使用wgs 必须设置true
options.scale(0.15f);
Bitmap bitmap = BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), iconId, null);
options.icon(bitmap);
options.latitude(lat);
options.longitude(longi);
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).addMarker(uuid, options);
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(DataTypes.TYPE_MARKER_ADAS)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.gps(true)
.controlAngle(true)
.icon3DRes(R.raw.start_and_end)
.latitude(lat)
.longitude(longi);
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .addMarker(uuid, options);
}else {
CallerLogger.INSTANCE.d("RemoveMapMaker=",uuid+"=latitude="+lat+",longitude="+longi);
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).removeMarkers(uuid);

Binary file not shown.

View File

@@ -1048,6 +1048,8 @@ public class MogoOCHTaxiModelNew {
@Override
public void onAutopilotArriveAtStation(MessagePad.ArrivalNotification data) {
CallerLogger.INSTANCE.i(M_TAXI + TAG, "onAutopilotArriveAtStation = " + data.toString());
if (data == null || !checkCurrentOCHOrder()
|| (getCurOrderStatus() == OrderStatusEnum.ArriveAtEndStation)) {
return;

View File

@@ -28,6 +28,7 @@ import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.MogoMarkerManager;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.och.taxi.callback.IOCHTaxiNaviChangedCallback;
import com.mogo.och.taxi.constant.OCHTaxiConst;
import com.mogo.och.taxi.constant.OrderStatusEnum;
@@ -368,35 +369,35 @@ public class OCHTaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implem
showNotice(mActivity.getString(R.string.module_och_taxi_new_order));
startNaviToStartStation(false, mOrderStartStationLat, mOrderStartStationLng);
showOrHideNavi(true);
setOrRemoveMapMaker(true, OCHTaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint,R.drawable.icon_station_start_end);
setOrRemoveMapMaker(true,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint,R.drawable.icon_station_start_end);
setOrRemoveMapMaker(true, OCHTaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint);
setOrRemoveMapMaker(true,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint);
break;
case Cancel:
mOrderCancel.setVisibility(View.VISIBLE);
showNotice(mActivity.getString(R.string.module_och_taxi_order_cancel));
showOrHideNavi(false);
setOrRemoveMapMaker(false, OCHTaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint,R.drawable.icon_station_start_end);
setOrRemoveMapMaker(false,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint,R.drawable.icon_station_start_end);
setOrRemoveMapMaker(false, OCHTaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint);
setOrRemoveMapMaker(false,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint);
break;
case ArriveAtStartStation:
mOrderCancel.setVisibility(View.VISIBLE);
showNotice(mActivity.getString(R.string.module_och_taxi_order_status_ph_text));
showOrHideNavi(false);
setOrRemoveMapMaker(true, OCHTaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint,R.drawable.icon_station_start_end);
setOrRemoveMapMaker(true,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint,R.drawable.icon_station_start_end);
setOrRemoveMapMaker(true, OCHTaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint);
setOrRemoveMapMaker(true,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint);
break;
case OnTheWayToEndStation:
// showNotice("欢迎使用蘑菇智行");
mOrderCancel.setVisibility(View.VISIBLE);
showOrHideNavi(false);
setOrRemoveMapMaker(false, OCHTaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint,R.drawable.icon_station_start_end);
setOrRemoveMapMaker(true,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint,R.drawable.icon_station_start_end);
setOrRemoveMapMaker(false, OCHTaxiConst.TAXI_START_MAP_MAKER,order.startSitePoint);
setOrRemoveMapMaker(true,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint);
break;
case ArriveAtEndStation:
mOrderCancel.setVisibility(View.GONE);
showNotice(mActivity.getString(R.string.module_och_taxi_order_complete_1));
showOrHideNavi(false);
setOrRemoveMapMaker(false,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint,R.drawable.icon_station_start_end);
setOrRemoveMapMaker(false,OCHTaxiConst.TAXI_END_MAP_MAKER,order.endSitePoint);
break;
case JourneyCompleted:
mOrderCancel.setVisibility(View.GONE);
@@ -522,20 +523,22 @@ public class OCHTaxiBeingServerdOrdersFragment extends BaseTaxiUIFragment implem
* @param isAdd
* @param uuid
* @param station
* @param iconId
*/
private void setOrRemoveMapMaker(boolean isAdd, String uuid, List<Double> station, int iconId){
private void setOrRemoveMapMaker(boolean isAdd, String uuid, List<Double> station){
if (isAdd){
CallerLogger.INSTANCE.d(M_TAXI + "setMapMaker= ",uuid+"=latitude="+station.get(1)+",longitude="+station.get(0));
MogoMarkerOptions options = new MogoMarkerOptions();
options.anchorColor("#000000");//不设置报错,暂时随便设置个
options.setGps(true);//使用wgs 必须设置true
options.scale(0.15f);
Bitmap bitmap = BitmapFactory.decodeResource(mActivity.getResources(), iconId, null);
options.icon(bitmap);
options.latitude(station.get(1));
options.longitude(station.get(0));
MogoMarkerOptions options = new MogoMarkerOptions()
.owner(DataTypes.TYPE_MARKER_ADAS)
.anchor(0.5f, 0.5f)
.set3DMode(true)
.gps(true)
.controlAngle(true)
.icon3DRes(R.raw.start_and_end)
.latitude(station.get(1))
.longitude(station.get(0));
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .addMarker(uuid, options);
}else {
CallerLogger.INSTANCE.d(M_TAXI + "RemoveMapMaker=",uuid+"=latitude="+station.get(1)+",longitude="+station.get(0));
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .removeMarkers(uuid);

Binary file not shown.