2D资源实现停止线
This commit is contained in:
@@ -7,10 +7,15 @@ import android.util.Log;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
|
||||
import com.mogo.module.common.drawer.marker.EmptyMarkerView;
|
||||
import com.mogo.module.common.drawer.marker.SimpleWindow3DAdapter;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
@@ -19,14 +24,17 @@ 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.IMoGoV2XCloundDataManager;
|
||||
import com.mogo.module.v2x.marker.V2XFrontTargetMarkerView;
|
||||
import com.mogo.module.v2x.utils.LocationUtils;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.V2X_FRONT_WARNING_MARKER;
|
||||
import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
|
||||
/**
|
||||
@@ -68,7 +76,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
//绘制识别物与交汇点连线,并且更新连线数据
|
||||
drawStopLine(cloundWarningInfo, newLocation);
|
||||
//添加停止线marker
|
||||
handleStopLine();
|
||||
drawStopLineWith2Resource();
|
||||
}, 200);
|
||||
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
@@ -113,6 +121,32 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 2D资源绘制停止线
|
||||
* */
|
||||
private void drawStopLineWith2Resource() {
|
||||
mCloundWarningInfo.setCarLocation(new MogoLatLng(39.976866,116.417622));//测试数据
|
||||
MogoLatLng carlo = mCloundWarningInfo.getCarLocation();
|
||||
if (carlo == null){
|
||||
double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
|
||||
double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
|
||||
carlo = new MogoLatLng(lat, lon);
|
||||
}
|
||||
MogoLatLng drawStopLineLon = LocationUtils.getNewLocation(carlo, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getAngle());
|
||||
|
||||
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
|
||||
.latitude(drawStopLineLon.getLat())
|
||||
.longitude(drawStopLineLon.getLon())
|
||||
.anchor(0.5f, 0.5f)
|
||||
.zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
|
||||
|
||||
optionsRipple
|
||||
.icon(ViewUtils.fromView(new EmptyMarkerView(V2XServiceManager.getContext())));
|
||||
IMogoMarker stopLine = V2XServiceManager.getMarkerManager().addMarker(V2X_FRONT_WARNING_MARKER, optionsRipple);
|
||||
stopLine.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(V2XServiceManager.getContext())));
|
||||
stopLine.showInfoWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制停止线前方线 TODO 需要实时给行人当前位置
|
||||
*/
|
||||
@@ -201,7 +235,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
/**
|
||||
* 绘制自车连线
|
||||
*/
|
||||
private void drawSlefCarLine (Location latLng) {
|
||||
private void drawSlefCarLine(Location latLng) {
|
||||
if (!isSelfLineClear) {
|
||||
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
|
||||
if (mCloundWarningInfo != null) {
|
||||
@@ -262,7 +296,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
private MogoLatLng getMogoLat(MogoLatLng latlng) {
|
||||
MogoLatLng newLocation = LocationUtils.getNewLocation(latlng, mCloundWarningInfo.getDistance(), mCloundWarningInfo.getDirection());
|
||||
|
||||
return newLocation;
|
||||
return newLocation;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ public class V2XWarningMarker implements IV2XMarker {
|
||||
}
|
||||
optionsRipple
|
||||
.icon(ViewUtils.fromView(new EmptyMarkerView(V2XServiceManager.getContext())));
|
||||
// optionsRipple.icon3DRes(com.mogo.module.common.R.raw.people);
|
||||
optimalMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_FRONT_WARNING_MARKER, optionsRipple);
|
||||
optimalMarker.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(V2XServiceManager.getContext())));
|
||||
optimalMarker.showInfoWindow();
|
||||
|
||||
Reference in New Issue
Block a user