opt
This commit is contained in:
@@ -729,6 +729,11 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
return getMap().getZoomLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
|
||||
return getMap().getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviStarted() {
|
||||
if ( checkAMapView() ) {
|
||||
|
||||
@@ -564,6 +564,11 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
return getMap().getZoomLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
|
||||
return getMap().getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviStarted() {
|
||||
if ( checkMapView() ) {
|
||||
|
||||
@@ -163,6 +163,14 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
|
||||
if (mClient != null) {
|
||||
return mClient.getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
if (mClient != null) {
|
||||
|
||||
@@ -522,6 +522,11 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
return getMap().getZoomLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
|
||||
return getMap().getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
return ObjectUtils.fromAMap(MapTools.INSTANCE.getVisibleRegion().getRightTopPoint());
|
||||
|
||||
@@ -149,6 +149,14 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
|
||||
if ( mClient != null ) {
|
||||
return mClient.getRoadWidth(lon,lat,angle,isGpsLocation,isRTK);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
if ( mClient != null ) {
|
||||
|
||||
@@ -121,6 +121,10 @@ public interface IMogoMapUIController {
|
||||
*/
|
||||
float getZoomLevel();
|
||||
|
||||
/**
|
||||
* 获取道路的宽度
|
||||
*/
|
||||
float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK);
|
||||
|
||||
/**
|
||||
* 获取视图东北角坐标
|
||||
|
||||
@@ -174,6 +174,16 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
|
||||
initDelegate();
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
initDelegate();
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
package com.mogo.module.v2x.listener;
|
||||
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.model.CloundWarningInfo;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
|
||||
/**
|
||||
* desc: 下发的云端预警数据
|
||||
*/
|
||||
public class V2XWarnMessageListener implements IMogoOnMessageListener<CloundWarningInfo> {
|
||||
public class V2XWarnMessageListener implements IMogoOnMessageListener<V2XWarningEntity> {
|
||||
|
||||
@Override
|
||||
public Class<CloundWarningInfo> target() {
|
||||
return CloundWarningInfo.class;
|
||||
public Class<V2XWarningEntity> target() {
|
||||
return V2XWarningEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(CloundWarningInfo info) {
|
||||
public void onMsgReceived(V2XWarningEntity info) {
|
||||
//Logger.d(MODULE_NAME, "V2XMessageListener_401011==V2X地图气泡数据刷新:\n" + GsonUtil.jsonFromObject(response));
|
||||
V2XUtils.runOnBackgroundThread(() -> {
|
||||
// 解析不同的Marker类型,然后对应的进行绘制
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.module.v2x.manager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.module.v2x.entity.model.CloundWarningInfo;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
|
||||
/**
|
||||
* desc: V2X 处理云端预警消息
|
||||
@@ -11,7 +11,7 @@ public interface IMoGoV2XCloundDataManager extends IProvider {
|
||||
/**
|
||||
* 处理下发数据
|
||||
*/
|
||||
void analysisV2XCloundDataEvent(CloundWarningInfo cloundWarningInfo);
|
||||
void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo);
|
||||
|
||||
/**
|
||||
* 清除 所有的 POI
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.model.DrawLineInfo;
|
||||
import com.mogo.module.v2x.manager.IMoGoPersonWarnPolylineManager;
|
||||
import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -34,6 +33,9 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
|
||||
float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getStartLocation().lon,
|
||||
info.getStartLocation().lat, (float) info.getHeading(), true, true);
|
||||
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
|
||||
@@ -46,7 +48,9 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan
|
||||
}
|
||||
|
||||
// 线条粗细,渐变,渐变色值
|
||||
options.width(60).useGradient(true).colorValues(colors);
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager roadWidth = " + roadWidth);
|
||||
options.width(roadWidth).useGradient(true).colorValues(colors);
|
||||
// options.width(60).useGradient(true).colorValues(colors);
|
||||
// 当前车辆位置
|
||||
options.add(info.getStartLocation());
|
||||
// 目标车辆位置
|
||||
@@ -54,7 +58,6 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan
|
||||
|
||||
// 绘制线的对象
|
||||
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager drawableWarnPolyline -----> ");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -9,10 +9,10 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.v2x.MoGoV2XServicePaths;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.model.CloundWarningInfo;
|
||||
import com.mogo.module.v2x.entity.model.DrawLineInfo;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager;
|
||||
|
||||
@@ -25,7 +25,7 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
*/
|
||||
@Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER)
|
||||
public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMogoCarLocationChangedListener2 {
|
||||
private CloundWarningInfo mCloundWarningInfo;
|
||||
private V2XWarningEntity mCloundWarningInfo;
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
@@ -33,7 +33,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
}
|
||||
|
||||
@Override
|
||||
public void analysisV2XCloundDataEvent(CloundWarningInfo cloundWarningInfo) {
|
||||
public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) {
|
||||
mCloundWarningInfo = cloundWarningInfo;
|
||||
|
||||
//TODO 根据判断条件,决定是否画线或者删除线
|
||||
@@ -49,18 +49,18 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
/**
|
||||
* 绘制行人和二轮车连线,并且更新数据
|
||||
*/
|
||||
private void drawOtherObjectLine(CloundWarningInfo info) {
|
||||
private void drawOtherObjectLine(V2XWarningEntity info) {
|
||||
IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline();
|
||||
if (info != null) {
|
||||
if (polyLine != null) {
|
||||
polyLine.setPoints(Arrays.asList(new MogoLatLng(info.startLocation.lat, info.startLocation.lon),
|
||||
new MogoLatLng(info.endLocation.lat, info.endLocation.lon)));
|
||||
polyLine.setPoints(Arrays.asList(new MogoLatLng(info.getLat(), info.getLon()),
|
||||
new MogoLatLng(info.getCollisionLat(), info.getCollisionLon())));
|
||||
} else {
|
||||
DrawLineInfo lineInfo = new DrawLineInfo();
|
||||
// MogoLatLng startLatlng = new MogoLatLng(39.968919,116.407642);
|
||||
// MogoLatLng endLatlng = new MogoLatLng(40.010906,116.423821);
|
||||
MogoLatLng startLatlng = new MogoLatLng(info.startLocation.lat,info.startLocation.lon);
|
||||
MogoLatLng endLatlng = new MogoLatLng(info.endLocation.lat,info.endLocation.lon);
|
||||
MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());
|
||||
MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());
|
||||
lineInfo.setStartLocation(startLatlng);
|
||||
lineInfo.setEndLocation(endLatlng);
|
||||
lineInfo.setHeading(info.heading);
|
||||
@@ -90,7 +90,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
if (mCloundWarningInfo != null) {
|
||||
if (mogoPolyline != null) {
|
||||
mogoPolyline.setPoints(Arrays.asList(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()),
|
||||
new MogoLatLng(mCloundWarningInfo.endLocation.lat, mCloundWarningInfo.endLocation.lon)));
|
||||
new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon())));
|
||||
|
||||
} else {
|
||||
Log.e(V2XConst.LOG_NAME_WARN, "V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline() == null");
|
||||
@@ -98,7 +98,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
// MogoLatLng startLatlng = new MogoLatLng(39.968919, 116.407642);
|
||||
// MogoLatLng endLatlng = new MogoLatLng(40.010906, 116.423821);
|
||||
MogoLatLng startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
|
||||
MogoLatLng endLatlng = new MogoLatLng(mCloundWarningInfo.endLocation.lat, mCloundWarningInfo.endLocation.lon);
|
||||
MogoLatLng endLatlng = new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon());
|
||||
info.setHeading(latLng.getBearing());
|
||||
info.setStartLocation(startLatlng);
|
||||
info.setEndLocation(endLatlng);
|
||||
|
||||
@@ -37,7 +37,9 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
|
||||
// 渐变色
|
||||
float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getStartLocation().lon,
|
||||
info.getStartLocation().lat, (float) info.getHeading(), true, true);
|
||||
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
|
||||
if (info.getType().equals("1")) { //预警 TODO
|
||||
@@ -48,8 +50,9 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
colors.add(0xFFE32F46);
|
||||
}
|
||||
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + roadWidth);
|
||||
// 线条粗细,渐变,渐变色值
|
||||
options.width(60).useGradient(true).colorValues(colors);
|
||||
options.width(roadWidth).useGradient(true).colorValues(colors);
|
||||
// 当前车辆位置
|
||||
options.add(info.getStartLocation());
|
||||
// 目标车辆位置
|
||||
@@ -57,7 +60,6 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
|
||||
// 绘制线的对象
|
||||
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager drawableWarnPolyline -----> ");
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user