[Fix]全览地图V2X数据坐标系转换
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user