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 {
|
||||
|
||||
Reference in New Issue
Block a user