[V2X]道路施工(AI云)事件代码逻辑优化
This commit is contained in:
@@ -3,13 +3,12 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.road;
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.core.util.Pair;
|
||||
|
||||
import com.google.protobuf.FieldOrBuilder;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.function.v2x.R;
|
||||
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.MogoOverlayManager;
|
||||
@@ -20,7 +19,6 @@ import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -48,9 +46,18 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
|
||||
MarkerExploreWay noveltyInfo = entity.getNoveltyInfo();
|
||||
if (noveltyInfo != null && noveltyInfo.extras != null && noveltyInfo.extras.containsKey("polygon")) {
|
||||
Object extra = noveltyInfo.extras.get("polygon");
|
||||
if (pyramids.size() > 0) {
|
||||
for (IMogoMarker m : pyramids) {
|
||||
m.remove();
|
||||
}
|
||||
pyramids.clear();
|
||||
}
|
||||
if (polyline != null && polyline.isVisible()) {
|
||||
polyline.remove();
|
||||
}
|
||||
if (extra instanceof List) {
|
||||
List l = (List) extra;
|
||||
if (l.size() >= 3) {
|
||||
if (l.size() > 0) {
|
||||
List<Pair<Double, Double>> polygons = new ArrayList<>();
|
||||
for (int i = 0; i < l.size(); i++) {
|
||||
Object o = l.get(i);
|
||||
@@ -88,24 +95,25 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
|
||||
if (polygons.size() > 1) {
|
||||
if (overlayManager == null) {
|
||||
overlayManager = MogoOverlayManager.getInstance();
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
colors.add(Color.argb(100, 255, 0, 0));
|
||||
colors.add(Color.argb(100, 0, 255, 0));
|
||||
options.colorValues(colors);
|
||||
List<MogoLatLng> points = new ArrayList<>();
|
||||
for (int i = 0; i < polygons.size(); i++) {
|
||||
Pair<Double, Double> p = polygons.get(i);
|
||||
points.add(new MogoLatLng(p.second, p.first));
|
||||
}
|
||||
options.points(points);
|
||||
options.useGradient(true);
|
||||
options.useFacade(true);
|
||||
options.setGps(true);
|
||||
options.width(5f);
|
||||
polyline = overlayManager.addPolyline(options);
|
||||
}
|
||||
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
colors.add(Color.argb(100, 255, 0, 0));
|
||||
colors.add(Color.argb(100, 0, 255, 0));
|
||||
options.colorValues(colors);
|
||||
List<MogoLatLng> points = new ArrayList<>();
|
||||
for (int i = 0; i < polygons.size(); i++) {
|
||||
Pair<Double, Double> p = polygons.get(i);
|
||||
points.add(new MogoLatLng(p.second, p.first));
|
||||
}
|
||||
options.points(points);
|
||||
options.useGradient(true);
|
||||
options.useFacade(true);
|
||||
options.setGps(true);
|
||||
options.width(5f);
|
||||
options.maxIndex(2000000f);
|
||||
polyline = overlayManager.addPolyline(options);
|
||||
polyline.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,6 +133,19 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
|
||||
if (polyLineManager != null) {
|
||||
polyLineManager.clearLine();
|
||||
}
|
||||
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null && v2xStatus.isRoadEventPOIShow()) {
|
||||
if (polyline != null) {
|
||||
polyline.remove();
|
||||
}
|
||||
if (pyramids.size() > 0) {
|
||||
for (IMogoMarker marker : pyramids) {
|
||||
marker.remove();
|
||||
}
|
||||
pyramids.clear();
|
||||
}
|
||||
}
|
||||
IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
|
||||
if (v2xMarker != null) {
|
||||
// 移除事件POI
|
||||
@@ -132,15 +153,5 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
|
||||
// 绘制上次的数据
|
||||
v2xMarker.drawableLastAllPOI();
|
||||
}
|
||||
|
||||
if (polyline != null) {
|
||||
polyline.remove();
|
||||
}
|
||||
if (pyramids.size() > 0) {
|
||||
for (IMogoMarker marker : pyramids) {
|
||||
marker.remove();
|
||||
}
|
||||
pyramids.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user