diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 83405b8de1..4ff10f68a5 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -91,6 +91,7 @@
+
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java
index 0eba5d780f..b6f0ed0894 100644
--- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java
@@ -1,19 +1,26 @@
package com.mogo.module.common.drawer;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
import android.util.Log;
import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
+import com.mogo.module.common.R;
+import com.mogo.module.common.drawer.marker.EmptyMarkerView;
import com.mogo.module.common.drawer.marker.IMarkerView;
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
+import com.mogo.module.common.drawer.marker.SimpleWindow3DAdapter;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
+import com.mogo.module.common.view.MarkerBaseFloor;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.UiThreadHandler;
+import com.mogo.utils.ViewUtils;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
@@ -78,15 +85,21 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
markerShowEntity.setMarkerLocation(location);
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA);
+ IMogoMarker bottomMarker = drawMarkerWith2Resource(markerShowEntity);
IMogoMarker marker = drawMarker(markerShowEntity);
Log.d("liyz", "renderWarnData marker != null direction = " + data.getDirection());
+ //识别物
marker.addDynamicAnchorPosition(new MogoLatLng(
data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(),
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
-
+ //识别物下方的红色圆圈
+ bottomMarker.addDynamicAnchorPosition(new MogoLatLng(
+ data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(),
+ data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
//移动完成以后,3s后消失
UiThreadHandler.postDelayed(() -> {
marker.remove();
+ bottomMarker.remove();
}, 8000);
}
@@ -108,6 +121,25 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
return marker;
}
+ /*
+ * 2D资源绘制marker
+ * */
+ private IMogoMarker drawMarkerWith2Resource(MarkerShowEntity markerShowEntity) {
+ MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
+ .latitude(markerShowEntity.getMarkerLocation().getLat())
+ .longitude(markerShowEntity.getMarkerLocation().getLon())
+ .anchor(1.0f, 1.0f)
+ .zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
+
+ optionsRipple
+ .icon(ViewUtils.fromView(new EmptyMarkerView(mContext)));
+ IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), optionsRipple);
+
+ marker.setInfoWindowAdapter(new SimpleWindow3DAdapter(new MarkerBaseFloor(mContext)));
+ marker.showInfoWindow();
+ return marker;
+ }
+
/**
* 绘制停止线 marker
*
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/MarkerBaseFloor.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/MarkerBaseFloor.java
new file mode 100644
index 0000000000..d42b79ebce
--- /dev/null
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/MarkerBaseFloor.java
@@ -0,0 +1,40 @@
+package com.mogo.module.common.view;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+
+import androidx.annotation.Nullable;
+
+import com.mogo.module.common.R;
+import com.mogo.module.common.drawer.marker.MapMarkerBaseView;
+import com.mogo.module.common.entity.MarkerShowEntity;
+
+/**
+ * @author liujing
+ * @description 描述
+ * @since: 2021/4/13
+ */
+public class MarkerBaseFloor extends MapMarkerBaseView {
+ public MarkerBaseFloor(Context context) {
+ super(context);
+ }
+
+ public MarkerBaseFloor(Context context, @Nullable AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public MarkerBaseFloor(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ @Override
+ protected void initView(Context context) {
+ LayoutInflater.from( context ).inflate(R.layout.module_common_warning_marker_bottom, this );
+ }
+
+ @Override
+ public void updateView(MarkerShowEntity markerShowEntity) {
+
+ }
+}
diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/common_marker_bottom_floor.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/common_marker_bottom_floor.png
new file mode 100644
index 0000000000..a46f85caff
Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/common_marker_bottom_floor.png differ
diff --git a/modules/mogo-module-common/src/main/res/layout/module_common_warning_marker_bottom.xml b/modules/mogo-module-common/src/main/res/layout/module_common_warning_marker_bottom.xml
new file mode 100644
index 0000000000..1ec9b2b6ab
--- /dev/null
+++ b/modules/mogo-module-common/src/main/res/layout/module_common_warning_marker_bottom.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java
index 6e4b115c29..6a7ff1d86d 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java
@@ -51,63 +51,67 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
@Override
public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) {
- Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> ");
- mCloundWarningInfo = cloundWarningInfo;
- showTime = mCloundWarningInfo.getShowTime();
- pointsBetween();
+ if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
+ Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> ");
+ mCloundWarningInfo = cloundWarningInfo;
+ showTime = mCloundWarningInfo.getShowTime();
+ pointsBetween();
- //预警蒙层
- MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getType(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
- isSelfLineClear = false;
- isFirstLocation = false;
+ //预警蒙层
+ MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getType(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
+ isSelfLineClear = false;
+ isFirstLocation = false;
- if (cloundWarningInfo.getDirection() == 1) { //前方
- MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle());
- //停止线前方画线
- WorkThreadHandler.getInstance().postDelayed(() -> {
- //二轮车和行人的渲染和移动
- V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
- //绘制识别物与交汇点连线,并且更新连线数据
- drawStopLine(cloundWarningInfo, newLocation);
- //添加停止线marker
- handleStopLine();
- }, 800);
+ if (cloundWarningInfo.getDirection() == 1) { //前方
+ MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle());
+ //停止线前方画线
+ WorkThreadHandler.getInstance().postDelayed(() -> {
+ //二轮车和行人的渲染和移动
+ V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
+ //绘制识别物与交汇点连线,并且更新连线数据
+ drawStopLine(cloundWarningInfo, newLocation);
+ //添加停止线marker
+ handleStopLine();
+ }, 500);
- UiThreadHandler.postDelayed(() -> {
- V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
- V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
- V2XServiceManager.getMoGoStopPolylineManager().clearLine();
- isSelfLineClear = true;
- }, showTime);
+ UiThreadHandler.postDelayed(() -> {
+ V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
+ V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
+ V2XServiceManager.getMoGoStopPolylineManager().clearLine();
+ isSelfLineClear = true;
+ }, showTime);
- } else { //左侧或者右侧
- WorkThreadHandler.getInstance().postDelayed(() -> {
- //绘制识别物与交汇点连线,并且更新连线数据
- drawOtherObjectLine(cloundWarningInfo);
- //二轮车和行人的渲染和移动
- V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
- }, 500);
+ } else { //左侧或者右侧
+ WorkThreadHandler.getInstance().postDelayed(() -> {
+ //绘制识别物与交汇点连线,并且更新连线数据
+ drawOtherObjectLine(cloundWarningInfo);
+ //二轮车和行人的渲染和移动
+ V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
+ }, 500);
- //延迟3秒清理线
- UiThreadHandler.postDelayed(() -> {
- V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
- V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
- isSelfLineClear = true;
- }, showTime);
+ //延迟3秒清理线
+ UiThreadHandler.postDelayed(() -> {
+ V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
+ V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
+ isSelfLineClear = true;
+ }, showTime);
+ }
}
}
private void handleStopLine() {
- for (int i = 0; i < fillPoints.size(); i++) {
- V2XWarningEntity entity = new V2XWarningEntity();
- MogoLatLng latLng = (MogoLatLng) fillPoints.get(i);
- entity.setLat(latLng.lat);
- entity.setLon(latLng.lon);
- entity.setCollisionLat(mCloundWarningInfo.getCollisionLat());
- entity.setCollisionLon(mCloundWarningInfo.getCollisionLon());
- entity.heading = mCloundWarningInfo.heading;
- V2XWarnDataDrawer.getInstance().renderStopLineData(entity);
+ if (mCloundWarningInfo != null) {
+ for (int i = 0; i < fillPoints.size(); i++) {
+ V2XWarningEntity entity = new V2XWarningEntity();
+ MogoLatLng latLng = (MogoLatLng) fillPoints.get(i);
+ entity.setLat(latLng.lat);
+ entity.setLon(latLng.lon);
+ entity.setCollisionLat(mCloundWarningInfo.getCollisionLat());
+ entity.setCollisionLon(mCloundWarningInfo.getCollisionLon());
+ entity.heading = mCloundWarningInfo.heading;
+ V2XWarnDataDrawer.getInstance().renderStopLineData(entity);
+ }
}
}
@@ -115,14 +119,14 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
* 绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置
*/
private void drawStopLine(V2XWarningEntity info, MogoLatLng mogoLatLng) {
- IMogoPolyline polyLine = V2XServiceManager.getMoGoStopPolylineManager().getMogoStopPolyline();
- MogoLatLng startLatlng = new MogoLatLng(carLocation.lat, carLocation.lon);
- MogoLatLng endLatlng = new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon);
- Log.d(V2XConst.LOG_NAME_WARN, " drawStopLine endLatlng lon =" + endLatlng.lon + "--lat =" + endLatlng.lat
- + "--startLatlng lon = " + startLatlng.lon + "-lat = " + startLatlng.lat);
- float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
- MogoLatLng addMiddleLoc = LocationUtils.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());
if (info != null) {
+ IMogoPolyline polyLine = V2XServiceManager.getMoGoStopPolylineManager().getMogoStopPolyline();
+ MogoLatLng startLatlng = new MogoLatLng(carLocation.lat, carLocation.lon);
+ MogoLatLng endLatlng = new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon);
+ Log.d(V2XConst.LOG_NAME_WARN, " drawStopLine endLatlng lon =" + endLatlng.lon + "--lat =" + endLatlng.lat
+ + "--startLatlng lon = " + startLatlng.lon + "-lat = " + startLatlng.lat);
+ float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
+ MogoLatLng addMiddleLoc = LocationUtils.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());
if (polyLine != null) {
Log.d(V2XConst.LOG_NAME_WARN, "drawStopLine polyLine != null");
polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
@@ -140,7 +144,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
V2XServiceManager.getMoGoStopPolylineManager().drawStopPolyline(getContext(), lineInfo);
}
} else {
- Log.e(V2XConst.LOG_NAME_WARN, "drawStopLine info == null");
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
}
}
@@ -150,12 +153,12 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
* 目标物与预碰撞点连线,并且更新数据 TODO 需要实时给行人当前位置
*/
private void drawOtherObjectLine(V2XWarningEntity info) {
- IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline();
- MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());
- MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());
- float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
- MogoLatLng addMiddleLoc = LocationUtils.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());
if (info != null) {
+ IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline();
+ MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());
+ MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());
+ float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
+ MogoLatLng addMiddleLoc = LocationUtils.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());
if (polyLine != null) {
Log.d(V2XConst.LOG_NAME_WARN, "polyLine != null");
polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
@@ -190,8 +193,14 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
@Override
public void onCarLocationChanged2(Location latLng) {
// Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
- //当行人经纬度交点 开始画线,否则清理
- mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
+ if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
+ //当行人经纬度交点 开始画线,否则清理
+ if (mCloundWarningInfo != null) {
+ mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
+ }
+ drawSlefCarLine(latLng);
+ }
+ carLocation = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
drawSlefCarLine(latLng);
}
@@ -237,7 +246,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info);
}
} else {
- Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mCloundWarningInfo == null");
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
}
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java
index d7f2bdbba2..75bb3d4554 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java
@@ -100,7 +100,7 @@ public class V2XWarningMarker implements IV2XMarker {
}
//自车行驶方向的前方*米的经纬度,该经纬度在停止线上
MogoLatLng drawStopLineLon = LocationUtils.getNewLocation(carlo, mMarkerEntity.getStopLineDistance(), mMarkerEntity.getAngle());
- Log.d(TAG, "2D资源绘制停止线" + drawStopLineLon);
+ Log.d(TAG, "2D资源绘" + drawStopLineLon);
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
.latitude(drawStopLineLon.getLat())
.longitude(drawStopLineLon.getLon())