Merge branch 'km' into dev2_aiSdk

This commit is contained in:
liujing
2021-05-12 18:20:28 +08:00
6 changed files with 32 additions and 18 deletions

View File

@@ -94,7 +94,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
//移动完成以后3s后消失
UiThreadHandler.postDelayed(() -> {
marker.remove();
}, 8000);
}, data.getShowTime());
}
@@ -180,13 +180,8 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setMarkerLocation(location);
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_STOP_LINE_DATA);
IMogoMarker marker = drawStopLineMarker(markerShowEntity);
//移动完成以后3s后消失
UiThreadHandler.postDelayed(() -> {
marker.remove();
}, 8000);
}
@@ -205,7 +200,6 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);
marker.setToTop();
return marker;
}

View File

@@ -4,6 +4,8 @@ import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.map.uicontroller.VisualAngleMode;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
@@ -63,6 +65,7 @@ public class V2XScenarioManager implements IV2XScenarioManager {
V2XUtils.runOnUiThread(() -> {
// 提取之前存储的场景
if (v2XMessageEntity != null) {
sceneChange();
// 广播给应用内部其它模块
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
@@ -138,6 +141,17 @@ public class V2XScenarioManager implements IV2XScenarioManager {
}
}
/**
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52833468
* 道路事件触发后,切换到中景
*/
private void sceneChange() {
if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().
getCurrentMapVisualAngle() != VisualAngleMode.MODE_MEDIUM_SIGHT) {
V2XServiceManager.getMapService().getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT);
}
}
private void hidOtherPanel() {
try {
// 与其它面板互斥

View File

@@ -68,7 +68,7 @@ public class V2XWarningMarker implements IV2XMarker {
* 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算
* */
private MogoLatLng middleLocationInStopLine;
private static long showTime = 4000;
private static long showTime = 5000;
private float bearing;
@Override
@@ -78,13 +78,14 @@ public class V2XWarningMarker implements IV2XMarker {
drawLineWithEntity();
} catch (Exception e) {
Log.d(TAG,e.toString());
Log.d(TAG, e.toString());
}
}
public void drawLineWithEntity() {
showTime = mCloundWarningInfo.getShowTime();
showTime = mCloundWarningInfo.getShowTime() > 0 ? mCloundWarningInfo.getShowTime() : 5000;
Log.d(TAG, "显示时间为++" + String.valueOf(showTime));
pointsBetween();
bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing();
//预警蒙层
@@ -107,7 +108,7 @@ public class V2XWarningMarker implements IV2XMarker {
handleStopLine();
//自车画线
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
}, 500);
}, 0);
UiThreadHandler.postDelayed(() -> {
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
@@ -127,7 +128,7 @@ public class V2XWarningMarker implements IV2XMarker {
//车辆静止的时候
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
}, 500);
}, 0);
//延迟3秒清理线
UiThreadHandler.postDelayed(() -> {
@@ -217,6 +218,10 @@ public class V2XWarningMarker implements IV2XMarker {
V2XWarnDataDrawer.getInstance().renderStopLineData(entity);
}
}
//移动完成以后3s后消失
UiThreadHandler.postDelayed(() -> {
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_STOP_LINE_DATA);
}, mCloundWarningInfo.getShowTime());
} catch (Exception e) {
e.printStackTrace();
}
@@ -231,8 +236,8 @@ public class V2XWarningMarker implements IV2XMarker {
* 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算
* */
private MogoLatLng getMiddleLocationInStopLine() {
Log.d(TAG, "计算停止线上的某个点"+String.valueOf(carLocation.lat+","+String.valueOf(carLocation.lon)));
if (carLocation.lat == 0 || carLocation.lon == 0){
Log.d(TAG, "计算停止线上的某个点" + String.valueOf(carLocation.lat + "," + String.valueOf(carLocation.lon)));
if (carLocation.lat == 0 || carLocation.lon == 0) {
Log.d(TAG, "获取不到车的位置");
}
MogoLatLng newLocation = Trigonometric.getNewLocation(carLocation, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getAngle());
@@ -341,6 +346,7 @@ public class V2XWarningMarker implements IV2XMarker {
}
//延迟3秒清理线
UiThreadHandler.postDelayed(() -> {
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
}, showTime);
@@ -372,7 +378,7 @@ public class V2XWarningMarker implements IV2XMarker {
stopLine.showInfoWindow();
UiThreadHandler.postDelayed(() -> {
stopLine.hideInfoWindow();
}, 8000);
}, showTime);
}
public void onCarLocationChanged2(Location latLng) {

View File

@@ -23,6 +23,6 @@
"stopLineDistance": 60,
"warningContent": "注意自行车",
"heading": 0,
"showTime": 8000,
"showTime": 5000,
"roadwidth": 4.0
}

View File

@@ -24,6 +24,6 @@
"stopLineDistance": 60,
"warningContent": "小心行人",
"heading": 0,
"showTime": 8000,
"showTime": 5000,
"roadwidth": 4.0
}

View File

@@ -23,6 +23,6 @@
"stopLineDistance": 60,
"warningContent": "注意摩托车",
"heading": 0,
"showTime": 8000,
"showTime": 5000,
"roadwidth": 4.0
}