Merge branch 'feature/v1.0.4' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into feature/v1.0.4

This commit is contained in:
wangcongtao
2020-04-22 15:15:57 +08:00
4 changed files with 43 additions and 77 deletions

View File

@@ -385,7 +385,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
mCurrentModuleName = ServiceConst.CARD_TYPE_BUSINESS_OPERATION;
}
// List< MarkerOnlineCar > onlineCarList = markerCardResult.getOnlineCar();
List<MarkerOnlineCar> onlineCarList = markerCardResult.getOnlineCar();
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
List<MarkerShareMusic> shareMusicList = markerCardResult.getShareMusic();
List<MarkerNoveltyInfo> noveltyInfoList = markerCardResult.getNoveltyInfo();
@@ -399,7 +399,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
break;
case ServiceConst.CARD_TYPE_CARS_CHATTING:
case ServiceConst.CARD_TYPE_USER_DATA:
// drawOnlineCarMarkers( onlineCarList, ServiceConst.MAX_AMOUNT_SINGLE_CARD );
drawOnlineCarMarkers(onlineCarList, ServiceConst.MAX_AMOUNT_SINGLE_CARD);
break;
case ServiceConst.CARD_TYPE_ROAD_CONDITION:
drawRoadConditionMarker(exploreWayList, ServiceConst.MAX_AMOUNT_SINGLE_CARD);
@@ -421,7 +421,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
List<MarkerShareMusic> shareMusicList = markerCardResult.getShareMusic();
List<MarkerNoveltyInfo> noveltyInfoList = markerCardResult.getNoveltyInfo();
// drawOnlineCarMarkers( onlineCarList, ServiceConst.MAX_AMOUNT_ALL );
drawOnlineCarMarkers(onlineCarList, ServiceConst.MAX_AMOUNT_ALL);
drawRoadConditionMarker(exploreWayList, ServiceConst.MAX_AMOUNT_ALL);
drawShareMusicMarker(shareMusicList, ServiceConst.MAX_AMOUNT_ALL);
drawNoveltyMarker(noveltyInfoList, ServiceConst.MAX_AMOUNT_ALL);
@@ -438,11 +438,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
return;
}
for (int i = 0; i < carMarkers.size(); i++) {
IMogoMarker marker = carMarkers.get(i);
marker.destroy();
}
double nearlyDistance = Float.MAX_VALUE;
int size = getAppropriateSize(maxAmount, onlineCarList);
for (int i = 0; i < size; i++) {
@@ -459,25 +454,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
IMogoMarker iMogoMarker = drawMapMarker(markerShowEntity);
carMarkers.add(iMogoMarker);
List<MarkerCarPois> poisList = markerOnlineCar.getPois();
if (poisList.size() > 0){
List<MogoLatLng> points = new ArrayList<>();
if (poisList.size() == 1){
points.add(new MogoLatLng(markerLocation.getLat(),markerLocation.getLon()));
}
for (int j = 0; j < poisList.size(); j++) {
MarkerCarPois pois = poisList.get(j);
double lat = pois.getCoordinates()[1];
double lng = pois.getCoordinates()[0];
points.add(new MogoLatLng(lat,lng));
}
iMogoMarker.startSmooth(points,mCarSmoothDuration);
}
startSmooth(iMogoMarker, markerOnlineCar, markerLocation);
// 计算在线车辆距离当前车辆的距离,每次都与最后一次距离最近的进行比较,保留距离最近的车辆,进行卡片展示
try {
@@ -590,7 +567,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
markerShowEntity.setBindObj(noveltyInfo);
markerShowEntity.setMarkerLocation(markerLocation);
markerShowEntity.setMarkerType(noveltyInfo.getType());
markerShowEntity.setTextContent(noveltyInfo.getLocation().getAddress());
String address = noveltyInfo.getLocation().getAddress();
if (!TextUtils.isEmpty(address)) {
markerShowEntity.setTextContent(address);
} else {
markerShowEntity.setTextContent(noveltyInfo.getContentData().getTitle());
}
drawMapMarker(markerShowEntity);
}
}
@@ -802,12 +784,10 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
public void getOnlineCarData(MogoLatLng latlng) {
// if (mCurrentModuleName.equals(ServiceConst.CARD_TYPE_USER_DATA)){
mCarLatLng = latlng;
getOnlineCarList();
UiThreadHandler.removeCallbacks(runnable);
UiThreadHandler.postDelayed(runnable, mCarSmoothDuration * 1000);
// }
}
private Runnable runnable = new Runnable() {
@@ -818,52 +798,22 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
};
private double lat = 39.969161;
private double lng = 116.412334;
private int a = 0;
private void getOnlineCarList() {
mRefreshModel.queryOnLineCarWithRoute(mCarLatLng, false, false, new RefreshCallback() {
@Override
public void onSuccess(Object o) {
Logger.i(TAG, "11111111211" + o.toString());
// MarkerResponse data = (MarkerResponse)o;
// MarkerCardResult result = data.getResult();
// if (result == null) {
// return;
// }
//
// List<MarkerOnlineCar> onlineCarList = result.getOnlineCar();
// drawOnlineCarMarkers( onlineCarList, ServiceConst.MAX_AMOUNT_SINGLE_CARD );
a++;
if (a == 3){
MarkerResponse data = (MarkerResponse) o;
MarkerCardResult result = data.getResult();
if (result == null) {
return;
}
MarkerLocation location = new MarkerLocation();
location.setLat(lat);
location.setLon(lng);
lng += 0.003;
double[] coor2 = {lng,lat};
MarkerCarPois pois2 = new MarkerCarPois();
pois2.setCoordinates(coor2);
List pois = new ArrayList<>();
pois.add(pois2);
MarkerOnlineCar onlineCar = new MarkerOnlineCar();
onlineCar.setLocation(location);
onlineCar.setType(ServiceConst.CARD_TYPE_USER_DATA);
onlineCar.setPois(pois);
List<MarkerOnlineCar> onlineCarList = new ArrayList<>();
onlineCarList.add(onlineCar);
for (int i = 0; i < carMarkers.size(); i++) {
IMogoMarker marker = carMarkers.get(i);
marker.destroy();
}
List<MarkerOnlineCar> onlineCarList = result.getOnlineCar();
drawOnlineCarMarkers(onlineCarList, ServiceConst.MAX_AMOUNT_SINGLE_CARD);
}
@Override
@@ -873,6 +823,23 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
});
}
private void startSmooth(IMogoMarker iMogoMarker, MarkerOnlineCar markerOnlineCar,
MarkerLocation markerLocation) {
carMarkers.add(iMogoMarker);
List<MarkerCarPois> poisList = markerOnlineCar.getPois();
if (poisList.size() > 0) {
List<MogoLatLng> points = new ArrayList<>();
for (int j = 0; j < poisList.size(); j++) {
MarkerCarPois pois = poisList.get(j);
double lat = new Double(pois.getCoordinates().get(1).toString());
double lng = new Double(pois.getCoordinates().get(0).toString());
points.add(new MogoLatLng(lat, lng));
}
points.add(new MogoLatLng(markerLocation.getLat(), markerLocation.getLon()));
iMogoMarker.startSmooth(points, mCarSmoothDuration);
}
}
private boolean ignoreDrawRequest() {
return MarkerServiceHandler.getMogoStatusManager().isSearchUIShow() || MarkerServiceHandler.getMogoStatusManager().isADASShow();