[Fix]全览地图V2X数据坐标系转换

This commit is contained in:
chenfufeng
2022-12-29 14:09:05 +08:00
parent ad6b943ebe
commit 2670e77a1f
2 changed files with 16 additions and 11 deletions

View File

@@ -268,8 +268,7 @@ public class AMapCustomView
if (center != null) {
center.getLon();
MarkerOptions markerOption = new MarkerOptions();
LatLng latLng = new LatLng(center.getLat(),
center.getLon());
LatLng latLng = MarkerDrawerManager.INSTANCE.coordinateConverterWgsToGcj(mContext, center.getLat(), center.getLon());
markerOption.position(latLng);
markerOption.icon(BitmapDescriptorFactory.fromBitmap(getV2XBitmap()));
markerOptionsList.add(markerOption);
@@ -282,15 +281,6 @@ public class AMapCustomView
public void drawV2XMarkers(ArrayList<MarkerOptions> markerOptionsList) {
currMarkerList = mAMap.addMarkers(markerOptionsList, false);
mAMap.setOnMarkerClickListener(marker -> {
List<Infrastructure> infList = posInfMap.get(marker.getPosition());
// 如果是摄像头
if (infList != null) {
CallerHmiManager.INSTANCE.showVideoDialog(infList);
return true;
}
return false;
});
}
private Bitmap getV2XBitmap() {

View File

@@ -161,4 +161,19 @@ object MarkerDrawerManager {
mCoordinateConverter.coord(LatLng(mogoLatLng.latitude, mogoLatLng.longitude))
return mCoordinateConverter.convert()
}
/**
* wgs84转高德坐标系
*/
fun coordinateConverterWgsToGcj(
mContext: Context,
lat: Double,
lon: Double
): LatLng {
val mCoordinateConverter =
CoordinateConverter(mContext)
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS)
mCoordinateConverter.coord(LatLng(lat, lon))
return mCoordinateConverter.convert()
}
}