地图模块适配

This commit is contained in:
jiaguofeng
2023-08-11 14:51:19 +08:00
parent 661816af8f
commit 74c0a81e68
30 changed files with 452 additions and 674 deletions

View File

@@ -17,6 +17,7 @@ import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
import com.zhidaoauto.map.sdk.open.marker.MarkerSimpleData;
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
import java.util.ArrayList;
import java.util.List;
@@ -32,7 +33,7 @@ import mogo.yycp.api.proto.SocketDownData;
*/
public class ObjectUtils {
public static MarkerOptions fromMogo(Point.Options opt) {
public static MarkerOptions fromMogo(Point.Options opt, MapAutoView mapAutoView) {
if (opt == null) {
return null;
@@ -49,15 +50,15 @@ public class ObjectUtils {
}
MarkerOptions markerOptions;
if(TextUtils.isEmpty(opt.getId())){
markerOptions = new MarkerOptions();
markerOptions = new MarkerOptions(mapAutoView.getMapController());
}else{
markerOptions = new MarkerOptions(opt.getId());
markerOptions = new MarkerOptions(opt.getId(),mapAutoView.getMapController());
}
markerOptions.setGps(opt.isGps())
.position(new LonLatPoint(opt.getLongitude(), opt.getLatitude()))
.anchor(opt.getU(), opt.getV())
.icons(descriptors)
.icons(descriptors,mapAutoView.getMapController())
.period(opt.getPeriod())
.controlAngle(opt.isControlAngle())
.rotateAngle(opt.getRotate())
@@ -84,10 +85,10 @@ public class ObjectUtils {
} else {
BitmapDescriptor descriptor = getBitmapDescriptorFromMogo(opt.getIcon(), opt.getIconView());
if (descriptor != null) {
markerOptions.markerIcon(descriptor);
markerOptions.markerIcon(descriptor,mapAutoView.getMapController());
}
if (opt.getIcon3DRes() != 0) {
markerOptions.marker3DIcon(opt.getIcon3DRes());
markerOptions.marker3DIcon(opt.getIcon3DRes(),mapAutoView.getMapController());
}
}
String title = opt.getTitle();
@@ -170,11 +171,11 @@ public class ObjectUtils {
return new MogoLatLng(point.getLatitude(), point.getLongitude());
}
public static PolylineOptions fromMogo(Polyline.Options options) {
public static PolylineOptions fromMogo(Polyline.Options options,MapAutoView mapAutoView) {
if (options == null) {
return null;
}
PolylineOptions target = new PolylineOptions();
PolylineOptions target = new PolylineOptions(mapAutoView.getMapController());
target.setGps(options.isUseGps());
if (options.getPoints() != null) {
List<LonLatPoint> points = new ArrayList<>();
@@ -193,15 +194,15 @@ public class ObjectUtils {
target.useFacade(options.getUseFacade());
target.setVisible(options.isVisible());
if (options.getMaxIndex() >= 0f) {
target.maxIndex = options.getMaxIndex();
target.maxIndex(options.getMaxIndex());
}
if (options.getColors() != null) {
target.colorValues(options.getColors());
}
if (options.isLightOn()) {
target.isBright = true;
target.brightColor = options.getLightColor();
target.brightSpeed = options.getLightSpeed();
target.setIsBright(true);
target.setBrightColor(options.getLightColor());
target.setBrightSpeed(options.getLightSpeed());
}
return target;
}
@@ -223,23 +224,23 @@ public class ObjectUtils {
CenterLine resultCenterLine = null;
if (centerLine != null) {
resultCenterLine = new CenterLine();
resultCenterLine.setId(centerLine.id);
resultCenterLine.setLane_id(centerLine.lane_id);
resultCenterLine.setAngle(centerLine.angle);
resultCenterLine.setRoad_id(centerLine.road_id);
resultCenterLine.setTile_id(centerLine.tile_id);
resultCenterLine.setId(centerLine.getId());
resultCenterLine.setLane_id(centerLine.getLane_id());
resultCenterLine.setAngle(centerLine.getAngle());
resultCenterLine.setRoad_id(centerLine.getRoad_id());
resultCenterLine.setTile_id(centerLine.getTile_id());
ArrayList<com.mogo.eagle.core.data.map.LonLatPoint> arrayList = new ArrayList<>();
if (centerLine.points != null) {
for (com.zhidaoauto.map.sdk.open.query.LonLatPoint point : centerLine.points) {
if (centerLine.getPoints() != null) {
for (com.zhidaoauto.map.sdk.open.query.LonLatPoint point : centerLine.getPoints()) {
com.mogo.eagle.core.data.map.LonLatPoint lonLatPoint = new com.mogo.eagle.core.data.map.LonLatPoint();
lonLatPoint.setAltitude(point.altitude);
lonLatPoint.setAngle(point.angle);
lonLatPoint.setDistance(point.distance);
lonLatPoint.setLatitude(point.latitude);
lonLatPoint.setLongitude(point.longitude);
lonLatPoint.setProvider(point.provider);
lonLatPoint.setSpeed(point.speed);
lonLatPoint.setDuration(point.duration);
lonLatPoint.setAltitude(point.getAltitude());
lonLatPoint.setAngle(point.getAngle());
lonLatPoint.setDistance(point.getDistance());
lonLatPoint.setLatitude(point.getLatitude());
lonLatPoint.setLongitude(point.getLongitude());
lonLatPoint.setProvider(point.getProvider());
lonLatPoint.setSpeed(point.getSpeed());
lonLatPoint.setDuration(point.getDuration());
arrayList.add(lonLatPoint);
}
resultCenterLine.setPoints(arrayList);