[V2X][Road]城市占道施工适配地图视角切换逻辑

This commit is contained in:
renwj
2022-10-17 19:52:13 +08:00
parent 0ada00a5c5
commit a8eb16f43e
6 changed files with 50 additions and 4 deletions

View File

@@ -34,6 +34,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -138,6 +139,7 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
//切换地图的远近视图
if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isLongSight()) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
AiRoadMarker.INSTANCE.restore();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
@@ -145,10 +147,12 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
.inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS, BusConst.TYPE_MARKER_BUS_ORDER);
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
AiRoadMarker.INSTANCE.clear();
} else {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
AiRoadMarker.INSTANCE.restore();
}
}
});

View File

@@ -20,6 +20,7 @@ import com.mogo.eagle.core.function.api.hmi.view.IViewNotification;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.MogoMapUIController;
@@ -135,14 +136,17 @@ public class TaxiPassengerBaseFragment extends MvpFragment<TaxiPassengerBaseFrag
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mMapswitchBtn.setImageResource(R.drawable.taxi_p_switch_map_medium);
AiRoadMarker.INSTANCE.restore();
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS);
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
mMapswitchBtn.setImageResource(R.drawable.taxi_p_switch_map_long);
AiRoadMarker.INSTANCE.clear();
} else {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).visibleAllMarkers();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mMapswitchBtn.setImageResource(R.drawable.taxi_p_switch_map_medium);
AiRoadMarker.INSTANCE.restore();
}
//OverlayLeftViewUtils.INSTANCE.dismissOverlayView();
}

View File

@@ -34,6 +34,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListener
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
@@ -197,15 +198,18 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .visibleAllMarkers();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_medium);
AiRoadMarker.INSTANCE.restore();
} else if (MogoMapUIController.getInstance().getCurrentMapVisualAngle().isMediumSight()) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
.inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS, TaxiConst.TYPE_MARKER_TAXI_ORDER);
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_long);
AiRoadMarker.INSTANCE.clear();
} else {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()) .visibleAllMarkers();
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
mSwitchBtnIcon.setImageResource(R.drawable.taxi_switch_map_medium);
AiRoadMarker.INSTANCE.restore();
}
} finally {

View File

@@ -7,6 +7,7 @@ import android.widget.*
import com.mogo.commons.*
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.function.hmi.R.drawable
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.*
import com.mogo.map.*
import com.mogo.map.uicontroller.*
import com.mogo.map.uicontroller.VisualAngleMode.MODE_MEDIUM_SIGHT
@@ -37,16 +38,19 @@ class PerspectiveSwitchView @JvmOverloads constructor(
.visibleAllMarkers()
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
textSwitch.setText(R.string.module_map_model_normal)
AiRoadMarker.restore()
} else if (MogoMapUIController.getInstance().currentMapVisualAngle.isMediumSight) {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
.inVisibleWithoutMarkers(DataTypes.TYPE_MARKER_ADAS)
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
textSwitch.setText(R.string.module_map_model_faster)
AiRoadMarker.clear()
} else {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
.visibleAllMarkers()
MogoMapUIController.getInstance().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
textSwitch.setText(R.string.module_map_model_normal)
AiRoadMarker.restore()
}
}
}

View File

@@ -93,7 +93,7 @@ object AiRoadMarker {
Logger.d(TAG, "--- consumer --- 3 ---: isTrigger => $isTrigger")
if (isTrigger) {
marker.set(top)
marker(top)
marker(top, true)
} else {
synchronized(markers) {
markers.remove(top)
@@ -187,7 +187,7 @@ object AiRoadMarker {
}
}
fun marker(marker: Marker) {
fun marker(marker: Marker, drawMarker: Boolean) {
val location = carLocation.get() ?: return
//施工中心点前方的自车行驶方向上300米距离
val l1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), 300f)
@@ -239,7 +239,9 @@ object AiRoadMarker {
return
}
removeLine()
marker.entity?.apply { V2XAiRoadEventMarker.drawMarkers(this) }
if (drawMarker) {
marker.entity?.apply { V2XAiRoadEventMarker.drawMarkers(this) }
}
val evaluator = ArgbEvaluator()
val interceptor = DecelerateInterpolator(1.5f)
val total = points.size
@@ -275,11 +277,39 @@ object AiRoadMarker {
}
fun unMarker(marker: Marker) {
Logger.d(TAG, "--- unMarker ---")
markers -= marker
removeLine()
V2XAiRoadEventMarker.removeMarkers(null)
}
fun clear() {
hideLine()
// V2XAiRoadEventMarker.removeMarkers(null)
}
fun restore() {
showLine()
val marker = marker.get()
if (marker != null) {
marker(marker, false)
}
}
private fun hideLine() {
val old = line.get()
if (old != null && !old.isDestroyed) {
old.isVisible = false
}
}
private fun showLine() {
val old = line.get()
if (old != null && !old.isDestroyed) {
old.isVisible = true
}
}
private fun isOutOfRange(markerLon: Double, markerLat: Double, carLon: Double, carLat: Double, carAngle: Double): Boolean {
return !isFrontOfCar(markerLon, markerLat, carLon, carLat, carAngle)
}

View File

@@ -83,7 +83,7 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
MarkerLocation location = noveltyInfo.getLocation();
AiRoadMarker.Marker m = new AiRoadMarker.Marker(gpsLocation.second, gpsLocation.first, location.getAngle(), polygons, null, entity);
mMarker = m;
AiRoadMarker.INSTANCE.marker(m);
AiRoadMarker.INSTANCE.marker(m, true);
}
}