eagle 顺义测试 调整路线绘制策略
This commit is contained in:
@@ -192,36 +192,36 @@ public class SmallMapDirectionView
|
||||
}
|
||||
|
||||
|
||||
if (mCoordinatesLatLng.size() > 1) {
|
||||
mCoordinatesLatLngCurrent.clear();
|
||||
for (LatLng lng : mCoordinatesLatLng) {
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(lng.latitude, lng.longitude);
|
||||
mCoordinatesLatLngCurrent.add(mogoLatLng);
|
||||
}
|
||||
|
||||
// 结束位置
|
||||
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
|
||||
// 与结束位置进行 GeoHash 0-12
|
||||
// GeoHash endGeoHash = GeoHash.withCharacterPrecision(endLatLng.latitude, endLatLng.longitude, 7);
|
||||
// GeoHash currentGeoHash = GeoHash.withCharacterPrecision(currentLatLng.latitude, currentLatLng.longitude, 7);
|
||||
// Log.d(MODULE_NAME, "currentGeoHash=" + currentGeoHash);
|
||||
// Log.d(MODULE_NAME, "endGeoHash=" + endGeoHash);
|
||||
|
||||
float calculateDistance = CoordinateUtils.calculateLineDistance(
|
||||
endLatLng.latitude, endLatLng.longitude,
|
||||
currentLatLng.latitude, currentLatLng.longitude
|
||||
);
|
||||
|
||||
Log.d(MODULE_NAME, "calculateDistance=" + calculateDistance);
|
||||
if (calculateDistance <= 20) {
|
||||
clearPolyline();
|
||||
} else {
|
||||
drawablePolyline(mCoordinatesLatLngCurrent);
|
||||
}
|
||||
} else {
|
||||
//设置希望展示的地图缩放级别
|
||||
mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLatLng, zoomLevel));
|
||||
}
|
||||
// if (mCoordinatesLatLng.size() > 1) {
|
||||
// mCoordinatesLatLngCurrent.clear();
|
||||
// for (LatLng lng : mCoordinatesLatLng) {
|
||||
// MogoLatLng mogoLatLng = new MogoLatLng(lng.latitude, lng.longitude);
|
||||
// mCoordinatesLatLngCurrent.add(mogoLatLng);
|
||||
// }
|
||||
//
|
||||
// // 结束位置
|
||||
// LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
|
||||
// // 与结束位置进行 GeoHash 0-12
|
||||
//// GeoHash endGeoHash = GeoHash.withCharacterPrecision(endLatLng.latitude, endLatLng.longitude, 7);
|
||||
//// GeoHash currentGeoHash = GeoHash.withCharacterPrecision(currentLatLng.latitude, currentLatLng.longitude, 7);
|
||||
//// Log.d(MODULE_NAME, "currentGeoHash=" + currentGeoHash);
|
||||
//// Log.d(MODULE_NAME, "endGeoHash=" + endGeoHash);
|
||||
//
|
||||
// float calculateDistance = CoordinateUtils.calculateLineDistance(
|
||||
// endLatLng.latitude, endLatLng.longitude,
|
||||
// currentLatLng.latitude, currentLatLng.longitude
|
||||
// );
|
||||
//
|
||||
// Log.d(MODULE_NAME, "calculateDistance=" + calculateDistance);
|
||||
// if (calculateDistance <= 20) {
|
||||
// clearPolyline();
|
||||
// } else {
|
||||
// drawablePolyline(mCoordinatesLatLngCurrent);
|
||||
// }
|
||||
// } else {
|
||||
// //设置希望展示的地图缩放级别
|
||||
// mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLatLng, zoomLevel));
|
||||
// }
|
||||
CameraPosition cameraPosition = new CameraPosition.Builder().target(mCarMarker.getPosition()).bearing(latLng.getBearing()).tilt(0).zoom(zoomLevel).build();
|
||||
mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
}
|
||||
@@ -234,11 +234,12 @@ public class SmallMapDirectionView
|
||||
@Override
|
||||
public void drawablePolyline(List<MogoLatLng> coordinates) {
|
||||
clearPolyline();
|
||||
mCoordinatesLatLng.clear();
|
||||
// mCoordinatesLatLng.clear();
|
||||
List<LatLng> latLngs = CoordinateConverterFrom84ForList(mContext,coordinates);
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
// for (MogoLatLng coordinate : coordinates) {
|
||||
// mCoordinatesLatLng.add(new LatLng(coordinate.getLat(), coordinate.getLon()));
|
||||
// for (LatLng coordinate : mCoordinatesLatLng) {
|
||||
//// mCoordinatesLatLng.add(new LatLng(coordinate.getLat(), coordinate.getLon()));
|
||||
//// Log.e("",coordinate.latitude+":"+coordinate.longitude);
|
||||
// }
|
||||
if (mAMap != null) {
|
||||
if (mCoordinatesLatLng.size() > 2) {
|
||||
@@ -281,7 +282,6 @@ public class SmallMapDirectionView
|
||||
}
|
||||
|
||||
public List<LatLng> CoordinateConverterFrom84ForList(Context mContext, List<MogoLatLng> mogoLatLngList){
|
||||
|
||||
List<LatLng> list = new ArrayList<>();
|
||||
for (MogoLatLng m:mogoLatLngList) {
|
||||
LatLng mogoLatLng = CoordinateConverterFrom84(mContext,m);
|
||||
@@ -326,4 +326,10 @@ public class SmallMapDirectionView
|
||||
mAMapNaviView.onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
public void setRouteList(List<MogoLatLng> coordinates) {
|
||||
// mCoordinatesLatLng.clear();
|
||||
// List<LatLng> latLngs = CoordinateConverterFrom84ForList(mContext,coordinates);
|
||||
// mCoordinatesLatLng.addAll(latLngs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ public class SmallMapFragment extends Fragment {
|
||||
|
||||
public void drawablePolyline(List<MogoLatLng> coordinates) {
|
||||
if (mSmallMapDirectionView != null) {
|
||||
mSmallMapDirectionView.setRouteList(coordinates);
|
||||
mSmallMapDirectionView.drawablePolyline(coordinates);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class SmallMapProvider implements IMogoSmallMapProvider, IMogoStatusChang
|
||||
mActivity = activity;
|
||||
mContainerId = containerId;
|
||||
SmpServiceManager.init(mActivity);
|
||||
//MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasAutopilotRouteCallBack(this);
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasAutopilotRouteCallBack(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,7 +63,7 @@ public class SmallMapProvider implements IMogoSmallMapProvider, IMogoStatusChang
|
||||
MogoServicePaths.PATH_SMALL_MAP,
|
||||
StatusDescriptor.MAIN_PAGE_RESUME,
|
||||
this);
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasAutopilotRouteCallBack(this);
|
||||
// MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasAutopilotRouteCallBack(this);
|
||||
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
showPanel();
|
||||
@@ -132,6 +132,7 @@ public class SmallMapProvider implements IMogoSmallMapProvider, IMogoStatusChang
|
||||
|
||||
@Override
|
||||
public void routeResult(List<MogoLatLng> routeList) {
|
||||
Log.e("lianglihui","SmallMapProvider");
|
||||
if (routeList != null && routeList.size() > 0) {
|
||||
drawablePolyline(routeList);
|
||||
} else {
|
||||
|
||||
@@ -88,23 +88,23 @@ public class RouteOverlayDrawer {
|
||||
}
|
||||
}else {
|
||||
// 将当前车辆位置放进去
|
||||
mPolylinePointList.add(new MogoLatLng(carLocal.getLatitude(), carLocal.getLongitude()));
|
||||
// mPolylinePointList.add(new MogoLatLng(carLocal.getLatitude(), carLocal.getLongitude()));
|
||||
for (MogoLatLng polyline : routelist) {
|
||||
// Log.e("IMogoPolyline",polyline.getLat()+":"+polyline.lon);
|
||||
//需要剔除已经行驶过的经纬度,这里需要比对推荐路线集合中的点是否在当前车辆行驶方向前面如果不在则抛弃
|
||||
if (LocationUtils.isPointOnCarFront(carLocal, polyline)) {
|
||||
}
|
||||
Log.e("lianglihui",polyline.getLat()+":"+polyline.getLon());
|
||||
mPolylinePointList.add(polyline);
|
||||
//需要剔除已经行驶过的经纬度,这里需要比对推荐路线集合中的点是否在当前车辆行驶方向前面如果不在则抛弃
|
||||
// Log.e("lianglihui",polyline.getLat()+":"+polyline.getLon());
|
||||
}
|
||||
}
|
||||
|
||||
// 过滤后台推送的推荐路线集合
|
||||
|
||||
mPolylineOptions.setGps(true);
|
||||
mPolylineColors.addAll(ColorUtils.getGradientAlpha("#002965ED", "#FF2965ED", "#002965ED", mPolylinePointList.size()));
|
||||
// 替换路径集合
|
||||
mPolylineOptions.points(mPolylinePointList);
|
||||
mPolylineOptions.setGps(true);
|
||||
// 线条粗细,渐变,渐变色值
|
||||
mPolylineOptions.width(25).useGradient(true).colorValues(mPolylineColors);
|
||||
// 绘制线
|
||||
|
||||
Reference in New Issue
Block a user