[base_3.4.0-map-sdk]

This commit is contained in:
zhongchao
2023-08-16 14:01:53 +08:00
parent 73a2dfdc95
commit f7a1ebc51b
5 changed files with 46 additions and 137 deletions

View File

@@ -30,10 +30,8 @@ import android.view.View;
import androidx.annotation.NonNull;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.data.map.MapRoadInfo;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
@@ -44,7 +42,6 @@ import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapRomaListener;
import com.mogo.eagle.core.function.call.map.CallerMapStyleListenerManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.hdcache.IHdCacheListener;
@@ -87,9 +84,7 @@ import com.zhidaoauto.map.sdk.open.marker.Marker;
import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener;
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
import com.zhidaoauto.map.sdk.open.road.RoadCross;
import com.zhidaoauto.map.sdk.open.road.RoadRectInfos;
import com.zhidaoauto.map.sdk.open.road.StopLine;
import com.zhidaoauto.map.sdk.open.routeinfo.RoadInfo;
import com.zhidaoauto.map.sdk.open.tools.MapTools;
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
@@ -102,10 +97,9 @@ import java.util.ArrayList;
import java.util.List;
public class AMapViewWrapper implements IMogoMapView,
public class AMapViewWrapper implements IMogoMapView, //地图实例和接口操作对象
IMogoMapUIController,
OnMapLoadedListener,
MapStatusListener,
OnCameraChangeListener,
OnMapClickListener,
OnMapTouchListener,
@@ -170,16 +164,17 @@ public class AMapViewWrapper implements IMogoMapView,
return;
}
MapAutoViewHelper options = mMapView.getMapAutoViewHelper();
if (options != null) {
options.setScaleVRMode(true);
}
//todo configStartUp配置
ThreadUtils.getIoPool().submit(() -> {
if (options != null) {
//设置手势是否可以缩放 isCanZoom true 可缩放 false 不可缩放
options.setZoomGesturesEnabled(true);
options.setScaleVRMode(true);
options.setWeatherEnable(false);
// options.setAllGesturesEnabled(false); //禁止全部手势
if (options.getMyLocationStyle() != null) {
options.getMyLocationStyle().setDisplayAnimEnable(true);
}
// if (options.getMyLocationStyle() != null) {
// //是否显示光圈,耗时
// options.getMyLocationStyle().setDisplayAnimEnable(true);
// }
//修改自车模型,未来需区分车的类型
options.setMyLocationStyle(options.getMyLocationStyle().myLocationIcon(HdMapBuildConfig.currentCarVrIconRes, true));
}
@@ -199,7 +194,7 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.setOnRoamStatusListener(this);
mMapView.setOnMapViewVisualAngleChangeListener(this);
mMapView.setOnRoadInfoListener(this, 1);
MapAutoApi.INSTANCE.registerLogListener(this,mMapView.getEventController());
MapAutoApi.INSTANCE.registerLogListener(this, mMapView.getEventController());
CallerLogger.INSTANCE.d(M_MAP + TAG, "styleop - initListeners - setOnMapStyleListener - view " + mMapView);
}
@@ -234,7 +229,7 @@ public class AMapViewWrapper implements IMogoMapView,
MapRoadInfo.StopLine stopInfo = convert(stopLine);
LonLatPoint p1 = points.get(0);
LonLatPoint p2 = points.get(points.size() - 1);
double distanceOfCarToStopLine = MapDataApi.INSTANCE.getNearstFromPointToSegment(carLoc.getLongitude(), carLoc.getLatitude(), p1.getLongitude(), p1.getLatitude(), p2.getLongitude(), p2.getLatitude()) * 10_0000;
double distanceOfCarToStopLine = MapDataApi.INSTANCE.getClosestFromPointToSegment(carLoc.getLongitude(), carLoc.getLatitude(), p1.getLongitude(), p1.getLatitude(), p2.getLongitude(), p2.getLatitude()) * 10_0000;
stopInfo.setDistanceOfCarToStopLine(distanceOfCarToStopLine);
//CallerLogger.INSTANCE.d(M_MAP + TAG, "onStopLineInfo: --- distance: " + distanceOfCarToStopLine);
CallerMapRoadListenerManager.INSTANCE.invokeListenersOnStopLineGet(stopInfo);
@@ -318,7 +313,7 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.setOnMapTouchListener(null);
mMapView.setOnMapClickListener(null);
mMapView.setOnCameraChangeListener(null);
MapAutoApi.INSTANCE.unregisterLogListener(this,mMapView.getEventController());
MapAutoApi.INSTANCE.unregisterLogListener(this, mMapView.getEventController());
CallerLogger.INSTANCE.d(M_MAP + TAG, "map onDestroy");
}
@@ -485,15 +480,6 @@ public class AMapViewWrapper implements IMogoMapView,
}
}
public void initMyLocation() {
if (checkAMapView()) {
mMapView.getMarkerController().addPreModel(R.raw.guangquan);
// MarkerHelper.addPreModel(R.raw.guangquan_day)
mMapView.getMapAutoViewHelper().setMyLocationEnabled(true);
}
}
@Override
public float getScalePerPixel() {
return getMap().getScalePerPixel();
@@ -551,7 +537,7 @@ public class AMapViewWrapper implements IMogoMapView,
public Point getLocationPointInScreen(MogoLatLng latLng) {
if (checkAMapView()) {
try {
return MapTools.INSTANCE.toScreenLocation(ObjectUtils.fromMogo(latLng),mMapView.getMapController());
return MapTools.INSTANCE.toScreenLocation(ObjectUtils.fromMogo(latLng), mMapView.getMapController());
} catch (Exception e) {
e.printStackTrace();
return null;
@@ -565,7 +551,7 @@ public class AMapViewWrapper implements IMogoMapView,
if (checkAMapView()) {
try {
return ObjectUtils.fromAMap(
MapTools.INSTANCE.fromScreenLocation(point,mMapView.getMapController()));
MapTools.INSTANCE.fromScreenLocation(point, mMapView.getMapController()));
} catch (Exception e) {
e.printStackTrace();
return null;
@@ -703,20 +689,17 @@ public class AMapViewWrapper implements IMogoMapView,
return getMap().getUIController().getTileId(lon, lat);
}
@Override
public void result(@NonNull String filePath) {
CallerMapDevaListenerManager.INSTANCE.invokeUploadLogFile(filePath);
}
@Override
public void onMapClick(@Nullable LonLatPoint lonLatPoint) {
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().onMapClick(ObjectUtils.fromAMap(lonLatPoint));
}
//渲染第一帧
@ChainLog(
linkChainLog = CHAIN_TYPE_INIT_STATUS,
linkCode = CHAIN_SOURCE_INIT,
@@ -729,6 +712,7 @@ public class AMapViewWrapper implements IMogoMapView,
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().onMapLoaded();
}
//地图视图准备
@ChainLog(
linkChainLog = CHAIN_TYPE_INIT_STATUS,
linkCode = CHAIN_SOURCE_INIT,
@@ -745,11 +729,14 @@ public class AMapViewWrapper implements IMogoMapView,
cameraPosition.getTilt(),
cameraPosition.getBearing());
initMapView();
initMyLocation();
loadPreVehicleModel();
}
}
@Override
public void onRoadLoaded(@Nullable String s) {
}
@Override
public boolean onTouch(@Nullable MotionEvent motionEvent) {
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().onTouch(motionEvent);
@@ -761,14 +748,6 @@ public class AMapViewWrapper implements IMogoMapView,
// mMarkerClickHandler.handleMarkerClicked(markerInfo);
}
@Override
public void onRoadLoaded(@Nullable String s) {
}
@Override
public void onMapStatusChanged(int type, int value) {
}
@Override
public void onRoamStatus(int status, @NonNull String msg) {
CallerMapRomaListener.INSTANCE.invokeMapRomaStatus(status, msg);
@@ -968,7 +947,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void setLockMode(boolean isLock) {
if (checkAMapView()) {
Log.d("TTTTT", "setLockMode:" +isLock);
Log.d("TTTTT", "setLockMode:" + isLock);
mMapView.getMapAutoViewHelper().setLockMode(isLock);
}
}
@@ -1013,7 +992,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void setIsDrawPointCloud(Boolean isDrawPointCloud) {
try {
// 是否绘制点云
PointCloudHelper.INSTANCE.setIsDrawPointCloud(isDrawPointCloud,mMapView.getMapController());
PointCloudHelper.INSTANCE.setIsDrawPointCloud(isDrawPointCloud, mMapView.getMapController());
} catch (Exception e) {
e.printStackTrace();
}
@@ -1022,13 +1001,13 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void setPointCloudSize(Float pointCloudSize) {
//设置点云大小
PointCloudHelper.INSTANCE.setPointCloudSize(pointCloudSize,mMapView.getMapController());
PointCloudHelper.INSTANCE.setPointCloudSize(pointCloudSize, mMapView.getMapController());
}
@Override
public void setPointCloudColor(String color) {
// 设置点云颜色
PointCloudHelper.INSTANCE.setPointCloudColor(color,mMapView.getMapController());
PointCloudHelper.INSTANCE.setPointCloudColor(color, mMapView.getMapController());
}
@Override

View File

@@ -21,6 +21,7 @@ object MapDataWrapper {
* @param angle 角度
* @param call 回调
*/
@Synchronized
fun getCenterLineInfo(lon: Double, lat: Double, angle: Float,call:IResult<CenterLine>){
MapDataApi.getCenterLineInfo(
lon,