This commit is contained in:
zhongchao
2021-04-01 10:57:55 +08:00
57 changed files with 884 additions and 223 deletions

View File

@@ -729,6 +729,11 @@ public class AMapNaviViewWrapper implements IMogoMapView,
return getMap().getZoomLevel();
}
@Override
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
return getMap().getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
}
@Override
public void onNaviStarted() {
if ( checkAMapView() ) {

View File

@@ -564,6 +564,11 @@ public class AMapViewWrapper implements IMogoMapView,
return getMap().getZoomLevel();
}
@Override
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
return getMap().getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
}
@Override
public void onNaviStarted() {
if ( checkMapView() ) {

View File

@@ -253,6 +253,11 @@ public class AMapWrapper implements IMogoMap {
return true;
}
@Override
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
return 0;
}
private Context getContext() {
return mContext;
}

View File

@@ -163,6 +163,14 @@ public class AMapUIController implements IMogoMapUIController {
return 0;
}
@Override
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
if (mClient != null) {
return mClient.getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
}
return 0;
}
@Override
public MogoLatLng getCameraNorthEastPosition() {
if (mClient != null) {

View File

@@ -67,7 +67,7 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.4.8'
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.1'
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
}

View File

@@ -522,6 +522,11 @@ public class AMapViewWrapper implements IMogoMapView,
return getMap().getZoomLevel();
}
@Override
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
return getMap().getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
}
@Override
public MogoLatLng getCameraNorthEastPosition() {
return ObjectUtils.fromAMap(MapTools.INSTANCE.getVisibleRegion().getRightTopPoint());

View File

@@ -20,6 +20,7 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.utils.logger.Logger;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
import com.zhidaoauto.map.sdk.open.data.MapDataApi;
import com.zhidaoauto.map.sdk.open.data.SinglePointRoadInfo;
import com.zhidaoauto.map.sdk.open.marker.Marker;
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
import com.zhidaoauto.map.sdk.open.marker.MultiPointOverlayOptions;
@@ -275,6 +276,13 @@ public class AMapWrapper implements IMogoMap {
return true;
}
@Override
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad(lon, lat, angle, isGpsLocation, isRTK);
return singlePointRoadInfo.getLaneWidth();
}
private Context getContext() {
return mMapView.getContext();
}

View File

@@ -149,6 +149,14 @@ public class AMapUIController implements IMogoMapUIController {
return 0;
}
@Override
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
if ( mClient != null ) {
return mClient.getRoadWidth(lon,lat,angle,isGpsLocation,isRTK);
}
return 0;
}
@Override
public MogoLatLng getCameraNorthEastPosition() {
if ( mClient != null ) {

View File

@@ -130,6 +130,11 @@ public interface IMogoMap {
*/
float getZoomLevel();
/**
* 获取道路的宽度
*/
float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK);
/**
* 添加线段
*

View File

@@ -121,6 +121,11 @@ public interface IMogoMapUIController {
*/
float getZoomLevel();
/**
* 获取道路的宽度
*/
float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK);
/**
* 获取视图东北角坐标
*/

View File

@@ -174,6 +174,16 @@ public class MogoMapUIController implements IMogoMapUIController {
return 0;
}
@Override
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
initDelegate();
if ( mDelegate != null ) {
return mDelegate.getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
}
return 0;
}
@Override
public MogoLatLng getCameraNorthEastPosition() {
initDelegate();

View File

@@ -80,7 +80,6 @@ class HttpClient private constructor(baseUrl: String) {
if (httpDns != null) {
builder.dns(Dns { hostname: String? ->
val addresses = httpDns.lookup(hostname)
// Log.d("liyz", "addresses 1 = $addresses")
if (addresses != null && !addresses.isEmpty()) {
return@Dns addresses
}

View File

@@ -19,6 +19,7 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.main.MainActivity;
import com.mogo.module.main.cards.MogoModulesManager;
import com.mogo.module.main.utils.DisplayEffectsHelper;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.och.IMogoOCH;
import com.mogo.service.intent.IMogoIntentListener;
@@ -54,6 +55,7 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
mServiceApis.getV2XListenerManager().registerIntentListener(MogoReceiver.ACTION_V2X_FRONT_WARNING, this);
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG,
StatusDescriptor.VR_MODE, this);
DisplayEffectsHelper.getInstance().init(clSpecialEffect);
}
@Override
@@ -175,6 +177,14 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
mApps.setVisibility(View.VISIBLE);
}
mEntrance.setLayoutParams(entranceParams);
if (descriptor == StatusDescriptor.VR_MODE) {
if (isTrue) {
clSpecialEffect.setVisibility(View.VISIBLE);
} else {
clSpecialEffect.setVisibility(View.GONE);
}
}
}
@Override

View File

@@ -15,6 +15,7 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.R;
import com.mogo.module.common.api.CallChatApi;
import com.mogo.module.common.constants.DataTypes;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.common.utils.SimpleHandlerThreadPool;
import com.mogo.realtime.entity.CloudRoadData;
import com.mogo.realtime.entity.MogoSnapshotSetData;
@@ -136,6 +137,70 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
return false;
}
/**
* 绘制 marker
*
* @param data 道路数据
* @return {@link IMogoMarker}
*/
// public IMogoMarker drawWarnDataMarker( V2XWarningEntity data ) {
// if ( data == null ) {
// return null;
// }
//
// MogoMarkerOptions options = new MogoMarkerOptions()
// .owner( DataTypes.TYPE_MARKER_CLOUD_DATA )
// .anchor( 0.5f, 0.5f )
// .rotate( ( float ) data.getHeading() )
// .object( data )
// .gps( true )
// .controlAngle( true )
// .position( new MogoLatLng( data.getWgslat(), data.getWgslon() ) );
// String resIdVal = null;
// if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
// options.set3DMode( true );
// // TODO: 2021/3/23 后端算法提供显示颜色
// options.anchorColor( getModelRenderColor( data.getType(), data.getSpeed(), data.getWgslon(), data.getWgslat(), data.getHeading() ) );
// int resId = getModelRes( data.getType() );
// resIdVal = resId + "";
// options.resName( mMarkerCachesResMd5Values.get( resIdVal ) );
// options.icon3DRes( resId );
// } else {
// options.set3DMode( false );
// View view = inflateView( data );
// options.icon( view );
// resIdVal = view.getId() + "";
// }
// IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_CLOUD_DATA, options );
// cacheMarkerIconResMd5Val( resIdVal, marker );
//
// if ( !TextUtils.isEmpty( data.getSn() ) ) {
// bindClickListener( marker );
// }
//
// return marker;
// }
/**
*
* @param data
*/
// public void renderWarnData(V2XWarningEntity data ) {
//
// IMogoMarker marker = drawWarnDataMarker(data);
//
// if ( marker == null ) {
// continue;
// }
//
//
// renderSnapshotOneFrame( marker, uniqueKey, cloudRoadData, newMarkersCaches );
//
//
// }
/**
* mogo 他车、mogo 他车识别的社会车辆、路边单元识别的车辆
*

View File

@@ -14,7 +14,9 @@ public class V2XWarningEntity implements Serializable {
//目标物位置
private double lat;
private double lon;
//距离
//目标物颜色
public String targetColor;
//目标物距离
private double distance;
//预测碰撞点位置
private double collisionLat;
@@ -28,9 +30,30 @@ public class V2XWarningEntity implements Serializable {
//停止线经纬度
private double stopLineLat;
private double stopLineLon;
//自车到停止线距离
private double stopLineDistance;
//道路唯一标识
public String roadId;
//车道唯一标识
public String laneId;
//识别物体唯一标识
public String uuid;
//红绿灯颜色
public String color;
//车ID 暂不使用
public String carId;
//预警文案
private String tipContent;
private String warningContent;
//车头朝向
public double heading;
//系统时间 暂时没用
public long systemTime;
//定位卫星时间 暂时没用
public long satelliteTime;
//莫顿码 暂时没用
public long mortonCode;
//自组字段
//tts播报
private String tts;
//打点位置
@@ -54,15 +77,15 @@ public class V2XWarningEntity implements Serializable {
public void setTipContent(int type) {
switch (type) {
case 0:
this.tipContent = "行人碰撞预警";
this.warningContent = "行人碰撞预警";
break;
case 1:
case 3:
case 4:
this.tipContent = "前车碰撞预警";
this.warningContent = "前车碰撞预警";
break;
case 2:
this.tipContent = "摩托车碰撞预警";
this.warningContent = "摩托车碰撞预警";
break;
default:
break;
@@ -121,6 +144,10 @@ public class V2XWarningEntity implements Serializable {
this.direction = direction;
}
public void setTts(String tts) {
this.tts = tts;
}
public void setSpeed(float speed) {
this.speed = speed;
}
@@ -129,7 +156,6 @@ public class V2XWarningEntity implements Serializable {
return type;
}
public double getLat() {
return lat;
}
@@ -150,7 +176,6 @@ public class V2XWarningEntity implements Serializable {
return distance;
}
public double getAngle() {
return angle;
}
@@ -163,13 +188,54 @@ public class V2XWarningEntity implements Serializable {
return speed;
}
public String getTipContent() {
if (this.tipContent == null) {
public String getTargetColor() {
return targetColor;
}
public String getRoadId() {
return roadId;
}
public String getLaneId() {
return laneId;
}
public String getUuid() {
return uuid;
}
public String getColor() {
return color;
}
public String getCarId() {
return carId;
}
public String getWarningContent() {
if (this.warningContent == null) {
setTipContent(type);
}
return tipContent;
return warningContent;
}
public double getHeading() {
return heading;
}
public long getSystemTime() {
return systemTime;
}
public long getSatelliteTime() {
return satelliteTime;
}
public long getMortonCode() {
return mortonCode;
}
public String getTts() {
if (tts == null) {
setTts(type);
@@ -177,22 +243,6 @@ public class V2XWarningEntity implements Serializable {
return tts;
}
public void setStopLineLat(double stopLineLat) {
this.stopLineLat = stopLineLat;
}
public void setStopLineLon(double stopLineLon) {
this.stopLineLon = stopLineLon;
}
public void setTipContent(String tipContent) {
this.tipContent = tipContent;
}
public void setTts(String tts) {
this.tts = tts;
}
public double getStopLineLat() {
return stopLineLat;
}
@@ -215,9 +265,18 @@ public class V2XWarningEntity implements Serializable {
", speed=" + speed +
", stopLineLat=" + stopLineLat +
", stopLineLon=" + stopLineLon +
", tipContent='" + tipContent + '\'' +
", roadId='" + roadId + '\'' +
", laneId='" + laneId + '\'' +
", uuid='" + uuid + '\'' +
", color='" + color + '\'' +
", carId='" + carId + '\'' +
", warningContent='" + warningContent + '\'' +
", tts='" + tts + '\'' +
", location=" + location +
", heading=" + heading +
", systemTime=" + systemTime +
", satelliteTime=" + satelliteTime +
", mortonCode=" + mortonCode +
'}';
}
}

View File

@@ -8,7 +8,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -37,8 +36,6 @@ import com.mogo.commons.voice.AIAssist;
import com.mogo.map.MogoLatLng;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationClient;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.navi.IMogoAimlessModeListener;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
@@ -204,7 +201,6 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private TextView tvYellow;
private TextView tvRed;
private TextView tvGreen;
private ImageView ivBg;
@@ -365,14 +361,13 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
// 根据本地配置设置自车图标
MyLocationUtil.setMyLocationIconUrl(getContext());
flSpeed = (FrameLayout) findViewById(R.id.fl_speed);
mouduleArc = (ArcView) findViewById(R.id.moudule_arc);
clTrafficLight = (ConstraintLayout) findViewById(R.id.cl_traffic_light);
tvYellow = (TextView) findViewById(R.id.tv_yellow);
tvRed = (TextView) findViewById(R.id.tv_red);
tvGreen = (TextView) findViewById(R.id.tv_green);
ivBg = (ImageView) findViewById(R.id.iv_bg);
// GlideApp.with(getContext()).load(R.drawable.yun_bg).into(ivBg);
}
private int debugPanelClickCount = 0;
@@ -404,7 +399,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
localIsVrMode = true;
flSpeed.setVisibility(View.VISIBLE);
clTrafficLight.setVisibility(View.VISIBLE);
// clTrafficLight.setVisibility(View.VISIBLE);
}
}

View File

@@ -4,6 +4,9 @@
<gradient
android:endColor="#3B3F6D"
android:startColor="#3B3F6D" />
<!-- <stroke-->
<!-- android:width="1dp"-->
<!-- android:color="#182155" />-->
<corners
android:bottomLeftRadius="@dimen/dp_100"
android:bottomRightRadius="@dimen/dp_20"

View File

@@ -6,6 +6,9 @@
android:gradientRadius="50%p"
android:startColor="#93354E"
android:type="radial" />
<!-- <stroke-->
<!-- android:width="1dp"-->
<!-- android:color="#182155" />-->
<corners
android:bottomLeftRadius="@dimen/dp_100"
android:bottomRightRadius="@dimen/dp_20"

View File

@@ -5,10 +5,9 @@
android:id="@+id/module_entrance_id_top_motion_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv_bg"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include
layout="@layout/module_ext_layout_extensions"
android:layout_width="match_parent"
@@ -33,9 +32,9 @@
android:layout_height="@dimen/dp_300"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:padding="@dimen/dp_20"
android:background="@drawable/yi_biao_pan_bg_nor"
android:elevation="@dimen/dp_20"
android:elevation="@dimen/dp_10"
android:padding="@dimen/dp_20"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">

View File

@@ -9,6 +9,7 @@ import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.commons.context.ContextHolderUtil;
import com.mogo.commons.debug.DebugConfig;
@@ -23,6 +24,7 @@ import com.mogo.module.common.map.MapCenterPointStrategy;
import com.mogo.module.common.map.Scene;
import com.mogo.module.main.cards.MogoModulesManager;
import com.mogo.module.main.service.MogoMainService;
import com.mogo.module.main.utils.DisplayEffectsHelper;
import com.mogo.module.main.windowview.FloatingViewHandler;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
@@ -46,7 +48,7 @@ import java.util.List;
* <p>
* 描述:加载各个模块
*/
public class MainActivity extends MvpActivity< MainView, MainPresenter > implements MainView,
public class MainActivity extends MvpActivity<MainView, MainPresenter> implements MainView,
IMogoLocationListener,
IMogoADASControlStatusChangedListener,
FragmentStackTransactionListener {
@@ -71,18 +73,20 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
protected ImageView mWarningRight;
protected ImageView mWarningBottom;
protected ConstraintLayout clSpecialEffect;
@Override
protected int getLayoutId() {
if ( !DebugConfig.isMapBased() ) {
if (!DebugConfig.isMapBased()) {
return R.layout.module_main_activity_main_no_map;
}
return R.layout.module_main_activity_main;
}
@Override
protected void beforeSetContentView( Bundle savedInstanceState ) {
protected void beforeSetContentView(Bundle savedInstanceState) {
init();
installSkinManager( savedInstanceState );
installSkinManager(savedInstanceState);
}
/**
@@ -90,135 +94,137 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
*
* @param savedInstanceState
*/
private void installSkinManager( Bundle savedInstanceState ) {
mServiceApis.getMapServiceApi().getMapViewInstanceHandler().createMapViewInstance( this );
mServiceApis.getSkinSupportInstallerApi().install( getApplication() );
mServiceApis.getSkinSupportInstallerApi().onCompensateActivityCreated( this, savedInstanceState );
private void installSkinManager(Bundle savedInstanceState) {
mServiceApis.getMapServiceApi().getMapViewInstanceHandler().createMapViewInstance(this);
mServiceApis.getSkinSupportInstallerApi().install(getApplication());
mServiceApis.getSkinSupportInstallerApi().onCompensateActivityCreated(this, savedInstanceState);
}
@Override
protected void initViews() {
getWindow().setBackgroundDrawable( null );
getWindow().setBackgroundDrawable(null);
mApps = findViewById( R.id.module_main_id_apps_fragment_container );
mEntrance = findViewById( R.id.module_main_id_entrance_fragment_container );
mEventPanel = findViewById( R.id.module_main_id_event_panel_fragment_container );
mFloatingLayout = findViewById( R.id.module_main_id_floating_view );
mLeftShadowFrame = findViewById( R.id.module_main_id_map_left_shadow_frame );
mCoverUpLayout = findViewById( R.id.module_main_id_cover_up );
mLeftPanelLayout = findViewById( R.id.module_main_id_left_panel_fragment_container );
mHistoryMessagePanel = findViewById( R.id.module_main_id_message_history_fragment_container );
mApps = findViewById(R.id.module_main_id_apps_fragment_container);
mEntrance = findViewById(R.id.module_main_id_entrance_fragment_container);
mEventPanel = findViewById(R.id.module_main_id_event_panel_fragment_container);
mFloatingLayout = findViewById(R.id.module_main_id_floating_view);
mLeftShadowFrame = findViewById(R.id.module_main_id_map_left_shadow_frame);
mCoverUpLayout = findViewById(R.id.module_main_id_cover_up);
mLeftPanelLayout = findViewById(R.id.module_main_id_left_panel_fragment_container);
mHistoryMessagePanel = findViewById(R.id.module_main_id_message_history_fragment_container);
mWarningTop = findViewById(R.id.warning_top);
mWarningLeft = findViewById(R.id.warning_left);
mWarningRight = findViewById(R.id.warning_right);
mWarningBottom = findViewById(R.id.warning_bottom);
// 避免事件穿透导致地图被滑动
mLeftShadowFrame.setOnClickListener( view -> {
} );
FloatingViewHandler.init( mFloatingLayout );
clSpecialEffect = findViewById(R.id.cl_special_effect);
mServiceApis.getOnlineCarPanelApi().initContainer( R.id.module_main_id_message_history_fragment_container, this );
if ( CallChatApi.getInstance().getApiProvider() != null ) {
CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer( "init", R.id.module_main_id_message_history_fragment_container, this );
// 避免事件穿透导致地图被滑动
mLeftShadowFrame.setOnClickListener(view -> {
});
FloatingViewHandler.init(mFloatingLayout);
mServiceApis.getOnlineCarPanelApi().initContainer(R.id.module_main_id_message_history_fragment_container, this);
if (CallChatApi.getInstance().getApiProvider() != null) {
CallChatApi.getInstance().getApiProvider().initVehicleTeamContainer("init", R.id.module_main_id_message_history_fragment_container, this);
}
}
// 隐藏布局
protected void hideLayout() {
mEntrance.setVisibility( View.GONE );
mEventPanel.setVisibility( View.GONE );
mFloatingLayout.setVisibility( View.GONE );
mEntrance.setVisibility(View.GONE);
mEventPanel.setVisibility(View.GONE);
mFloatingLayout.setVisibility(View.GONE);
}
// 显示布局
protected void showLayout() {
mEntrance.setVisibility( View.VISIBLE );
mEventPanel.setVisibility( View.VISIBLE );
mFloatingLayout.setVisibility( View.VISIBLE );
mEntrance.setVisibility(View.VISIBLE);
mEventPanel.setVisibility(View.VISIBLE);
mFloatingLayout.setVisibility(View.VISIBLE);
}
@Override
protected void onCreate( @Nullable Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
ContextHolderUtil.holdContext( this );
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ContextHolderUtil.holdContext(this);
mPresenter.postLoadModuleMsg();
NetworkUtils.listenNetStrength( this );
NetworkUtils.listenNetStrength(this);
}
private void init() {
if ( mServiceApis == null ) {
if (mServiceApis == null) {
mServiceApis = MogoApisHandler.getInstance().getApis();
}
mServiceApis.getShareManager().resetContext( this );
mServiceApis.getAuthManagerApi().showAuth( this );
mServiceApis.getShareManager().resetContext(this);
mServiceApis.getAuthManagerApi().showAuth(this);
mMogoStatusManager = mServiceApis.getStatusManagerApi();
mMogoStatusManager.setMainPageLaunchedStatus( TAG, true );
AutopilotServiceManage.getInstance().init( getContext() );
mMogoStatusManager.setMainPageLaunchedStatus(TAG, true);
AutopilotServiceManage.getInstance().init(getContext());
}
@Override
public void loadModules() {
final long start = System.currentTimeMillis();
MogoModulesManager.getInstance().init( this );
MogoModulesManager.getInstance().init(this);
loadSplash();
if ( DebugConfig.isMapBased() ) {
if ( mServiceApis.getMapServiceApi() != null ) {
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostMapListener( EventDispatchCenter.getInstance() );
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostNaviListener( EventDispatchCenter.getInstance() );
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostAimlessModeListener( EventDispatchCenter.getInstance() );
mServiceApis.getMapServiceApi().getHostListenerRegister().registerMarkerClickListener( EventDispatchCenter.getInstance() );
if (DebugConfig.isMapBased()) {
if (mServiceApis.getMapServiceApi() != null) {
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostMapListener(EventDispatchCenter.getInstance());
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostNaviListener(EventDispatchCenter.getInstance());
mServiceApis.getMapServiceApi().getHostListenerRegister().registerHostAimlessModeListener(EventDispatchCenter.getInstance());
mServiceApis.getMapServiceApi().getHostListenerRegister().registerMarkerClickListener(EventDispatchCenter.getInstance());
}
}
if ( DebugConfig.isSkinSupported() ) {
if (DebugConfig.isSkinSupported()) {
initAdasControlStatusListener();
}
if ( DebugConfig.isMapBased() ) {
EventDispatchCenter.getInstance().setMapLoadedCallback( () -> {
Logger.d( TAG, "map loaded." + Thread.currentThread().getName() );
if (DebugConfig.isMapBased()) {
EventDispatchCenter.getInstance().setMapLoadedCallback(() -> {
Logger.d(TAG, "map loaded." + Thread.currentThread().getName());
resetMapCenterPoint();
resetMapUiStyle();
loadOthersModules();
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
} );
MogoModulesManager.getInstance().loadMapModule( R.id.module_main_id_map_fragment_container );
Log.i("timer", "cost " + (System.currentTimeMillis() - start) + "ms");
});
MogoModulesManager.getInstance().loadMapModule(R.id.module_main_id_map_fragment_container);
} else {
loadOthersModules();
}
mMogoFragmentManager = mServiceApis.getFragmentManagerApi();
mMogoFragmentManager.init( this, R.id.module_main_id_search_fragment );
mMogoFragmentManager.initMessageHistoryContainerId( R.id.module_main_id_message_history_fragment_container );
mMogoFragmentManager.registerMainFragmentStackTransactionListener( this );
mMogoFragmentManager.init(this, R.id.module_main_id_search_fragment);
mMogoFragmentManager.initMessageHistoryContainerId(R.id.module_main_id_message_history_fragment_container);
mMogoFragmentManager.registerMainFragmentStackTransactionListener(this);
}
@Override
public void onTransaction( int size ) {
if ( size == 0 ) {
public void onTransaction(int size) {
if (size == 0) {
showLayout();
} else if ( size == 1 ) {
} else if (size == 1) {
hideLayout();
}
}
private void resetMapUiStyle(){
private void resetMapUiStyle() {
final EnumMapUI mapUI = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getCurrentSkinMode();
mServiceApis.getMapServiceApi().getMapUIController().changeMapMode( mapUI );
mServiceApis.getMapServiceApi().getMapUIController().changeMapMode(mapUI);
}
private void resetMapCenterPoint() {
// 右移地图中心点
MapCenterPointStrategy.init();
MapCenterPointStrategy.setMapCenterPointByScene( mServiceApis.getMapServiceApi().getMapUIController(), Scene.AIMLESS );
MapCenterPointStrategy.setMapCenterPointByScene(mServiceApis.getMapServiceApi().getMapUIController(), Scene.AIMLESS);
}
protected void loadOthersModules() {
@@ -233,60 +239,60 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
}
private void initAdasControlStatusListener() {
mServiceApis.getRegisterCenterApi().registerADASControlStatusChangedListener( TAG, this );
AdasConfigApiController.getInstance().registerAdasSettingUiListener( EventDispatchCenter.getInstance() );
AdasConfigApiController.getInstance().registerAdasSettingSkinModelListener( EventDispatchCenter.getInstance() );
AdasConfigApiController.getInstance().init( getApplicationContext() );
LoggerController.setPrinterLog( DebugConfig.isDebug() );
mServiceApis.getRegisterCenterApi().registerADASControlStatusChangedListener(TAG, this);
AdasConfigApiController.getInstance().registerAdasSettingUiListener(EventDispatchCenter.getInstance());
AdasConfigApiController.getInstance().registerAdasSettingSkinModelListener(EventDispatchCenter.getInstance());
AdasConfigApiController.getInstance().init(getApplicationContext());
LoggerController.setPrinterLog(DebugConfig.isDebug());
}
private void startBaseService() {
Intent intent = new Intent( this, MogoMainService.class );
startService( intent );
Intent intent = new Intent(this, MogoMainService.class);
startService(intent);
}
protected void loadContainerModules() {
MogoModulesManager.getInstance().loadEntrancesModule( R.id.module_main_id_entrance_fragment_container );
MogoModulesManager.getInstance().loadEventPanelModule( R.id.module_main_id_event_panel_fragment_container );
MogoModulesManager.getInstance().loadLeftPanelModule( R.id.module_main_id_left_panel_fragment_container );
MogoModulesManager.getInstance().loadEntrancesModule(R.id.module_main_id_entrance_fragment_container);
MogoModulesManager.getInstance().loadEventPanelModule(R.id.module_main_id_event_panel_fragment_container);
MogoModulesManager.getInstance().loadLeftPanelModule(R.id.module_main_id_left_panel_fragment_container);
}
@Override
public void hideCoverUpLayout() {
getWindow().setBackgroundDrawable( null );
mCoverUpLayout.setVisibility( View.GONE );
getWindow().setBackgroundDrawable(null);
mCoverUpLayout.setVisibility(View.GONE);
mServiceApis.getAdasControllerApi().showADAS();
}
@Override
public void loadCardModules() {
List< IMogoModuleProvider > providers = MogoModulesManager.getInstance().loadCardsModule();
List<IMogoModuleProvider> providers = MogoModulesManager.getInstance().loadCardsModule();
}
@Override
public void loadSplash() {
MogoModulesManager.getInstance().loadSplashModule( R.id.module_main_id_splash_container );
MogoModulesManager.getInstance().loadSplashModule(R.id.module_main_id_splash_container);
}
@NonNull
@Override
protected MainPresenter createPresenter() {
return new MainPresenter( this );
return new MainPresenter(this);
}
@Override
public void onLocationChanged( MogoLocation location ) {
EventDispatchCenter.getInstance().onLocationChanged( location );
public void onLocationChanged(MogoLocation location) {
EventDispatchCenter.getInstance().onLocationChanged(location);
}
@Override
public void onMapUiModeChanged( EnumMapUI mapUI ) {
switch ( mapUI ) {
public void onMapUiModeChanged(EnumMapUI mapUI) {
switch (mapUI) {
case Type_Night:
mServiceApis.getSkinSupportInstallerApi().loadSkin( SkinMode.Night );
mServiceApis.getSkinSupportInstallerApi().loadSkin(SkinMode.Night);
break;
case Type_Light:
mServiceApis.getSkinSupportInstallerApi().loadSkin( SkinMode.Light );
mServiceApis.getSkinSupportInstallerApi().loadSkin(SkinMode.Light);
break;
}
}
@@ -294,26 +300,26 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
@Override
protected void onResume() {
super.onResume();
mMogoStatusManager.setMainPageResumeStatus( TAG, true );
mMogoStatusManager.setMainPageIsBackgroundStatus( TAG, false );
if ( mCoverUpLayout.getVisibility() != View.VISIBLE ) {
mMogoStatusManager.setMainPageResumeStatus(TAG, true);
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, false);
if (mCoverUpLayout.getVisibility() != View.VISIBLE) {
mServiceApis.getAdasControllerApi().showADAS();
}
if ( mServiceApis.getLauncherApi() != null ) {
mServiceApis.getLauncherApi().setFloatButtonVisible( false );
if (mServiceApis.getLauncherApi() != null) {
mServiceApis.getLauncherApi().setFloatButtonVisible(false);
}
}
@Override
protected void onPause() {
super.onPause();
mMogoStatusManager.setMainPageResumeStatus( TAG, false );
mMogoStatusManager.setMainPageResumeStatus(TAG, false);
mServiceApis.getAuthManagerApi().dismiss();
if ( shouldCloseADASPanelWhenPause() ) {
if (shouldCloseADASPanelWhenPause()) {
mServiceApis.getAdasControllerApi().closeADAS();
}
if ( mServiceApis.getLauncherApi() != null ) {
mServiceApis.getLauncherApi().setFloatButtonVisible( true );
if (mServiceApis.getLauncherApi() != null) {
mServiceApis.getLauncherApi().setFloatButtonVisible(true);
}
}
@@ -327,21 +333,21 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
@Override
protected void onStop() {
super.onStop();
mMogoStatusManager.setMainPageIsBackgroundStatus( TAG, true );
if ( shouldCloseADASPanelWhenPause() ) {
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, true);
if (shouldCloseADASPanelWhenPause()) {
mServiceApis.getAdasControllerApi().closeADAS();
}
}
@Override
public void onBackPressed() {
if ( mMogoFragmentManager == null
|| mMogoFragmentManager.getStackSize() <= 0 ) {
if ( DebugConfig.isLauncher() ) {
if (mMogoFragmentManager == null
|| mMogoFragmentManager.getStackSize() <= 0) {
if (DebugConfig.isLauncher()) {
doWhenBackPressed();
return;
} else {
if ( doWhenBackPressed() ) {
if (doWhenBackPressed()) {
return;
}
super.onBackPressed();
@@ -356,14 +362,14 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
}
@Override
protected void onNewIntent( Intent intent ) {
super.onNewIntent( intent );
mPresenter.handleSchemeIntent( intent, true );
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
mPresenter.handleSchemeIntent(intent, true);
}
@Override
public IMogoServiceApis getApis() {
if ( mServiceApis == null ) {
if (mServiceApis == null) {
mServiceApis = MogoApisHandler.getInstance().getApis();
}
return mServiceApis;
@@ -376,9 +382,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterHostAimlessModeListener();
mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterHostNaviListener();
mServiceApis.getMapServiceApi().getHostListenerRegister().unregisterHostMapListener();
mServiceApis.getRegisterCenterApi().unregisterADASControlStatusChangedListener( TAG );
mMogoStatusManager.setMainPageLaunchedStatus( TAG, false );
mMogoStatusManager.setMainPageIsBackgroundStatus( TAG, false );
mServiceApis.getRegisterCenterApi().unregisterADASControlStatusChangedListener(TAG);
mMogoStatusManager.setMainPageLaunchedStatus(TAG, false);
mMogoStatusManager.setMainPageIsBackgroundStatus(TAG, false);
mMogoFragmentManager.unregisterMainFragmentStackTransactionListener();
mMogoFragmentManager.destroy();
mMogoFragmentManager = null;
@@ -386,7 +392,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
mServiceApis.getMapServiceApi().getMapUIController().destroy();
AdasConfigApiController.getInstance().release();
mServiceApis.getAdasControllerApi().release();
Logger.d( TAG, "destroy." );
Logger.d(TAG, "destroy.");
mServiceApis.getRefreshStrategyControllerApi().clearAllData();
mServiceApis.getOnlineCarPanelApi().clear();
ContextHolderUtil.releaseContext();

View File

@@ -0,0 +1,47 @@
package com.mogo.module.main.utils;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.view.View;
import com.mogo.module.main.R;
/**
* created by wujifei on 2021/3/30 14:05
* describe:
*/
public class DisplayEffectsHelper {
private volatile static DisplayEffectsHelper instance = null;
private AnimatorSet animatorSet;
public static DisplayEffectsHelper getInstance() {
if (instance == null) {
synchronized (DisplayEffectsHelper.class) {
if (instance == null) {
instance = new DisplayEffectsHelper();
}
}
}
return instance;
}
public void init(View rootView) {
View view1 = rootView.findViewById(R.id.iv_wu1);
View view2 = rootView.findViewById(R.id.iv_wu2);
ObjectAnimator animator1 = ObjectAnimator.ofFloat(view1, "alpha", 0f, 1f, 0f);
ObjectAnimator animator2 = ObjectAnimator.ofFloat(view1, "translationX", -500, 100f, 300f);
ObjectAnimator animator3 = ObjectAnimator.ofFloat(view1, "scaleX", 1f, 1.5f, 2f);
ObjectAnimator animator4 = ObjectAnimator.ofFloat(view1, "scaleY", 1f, 1.5f, 2f);
ObjectAnimator animator5 = ObjectAnimator.ofFloat(view2, "alpha", 0f, 1f, 0f);
ObjectAnimator animator6 = ObjectAnimator.ofFloat(view2, "translationX", 500, -100f, -300f);
ObjectAnimator animator7 = ObjectAnimator.ofFloat(view2, "scaleX", 1f, 1.5f, 2f);
ObjectAnimator animator8 = ObjectAnimator.ofFloat(view2, "scaleY", 1f, 1.5f, 2f);
animatorSet = new AnimatorSet();
animatorSet.playTogether(animator1, animator2, animator3, animator4, animator5, animator6, animator7, animator8);
animatorSet.setDuration(5000);
}
public void display() {
animatorSet.start();
}
}

View File

@@ -0,0 +1,27 @@
package com.mogo.module.main.utils;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.v2x.DisplayEffectsInterface;
/**
* created by wujifei on 2021/3/30 15:45
* describe:
*/
@Route(path = MogoServicePaths.PATH_MAIN_DISPLAY_EFFECTS_MANAGER)
public class DisplayEffectsManager implements DisplayEffectsInterface {
private Context context;
@Override
public void init(Context context) {
this.context = context;
}
@Override
public void displayEffects(String type) {
DisplayEffectsHelper.getInstance().display();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 KiB

View File

@@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/module_main_window_background_color"
android:orientation="vertical">
@@ -12,6 +13,30 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_special_effect"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ImageView
android:id="@+id/iv_wu1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/wu1"
android:alpha="0"
app:layout_constraintStart_toStartOf="parent" />
<ImageView
android:id="@+id/iv_wu2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/wu2"
android:alpha="0"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/warning_top"
android:layout_width="match_parent"

View File

@@ -37,6 +37,12 @@ public class MoGoV2XServicePaths {
@Keep
public static final String PATH_V2X_WARN_POLYLINE_MANAGER = "/v2xWarnPolylineManager/api";
/**
* V2X 二轮车和行人连接线
*/
@Keep
public static final String PATH_V2X_PERSON_WARN_POLYLINE_MANAGER = "/v2xPersonWarnPolylineManager/api";
/**
* V2X 云端数据处理
*/

View File

@@ -145,4 +145,9 @@ public class V2XConst {
* */
public static final String V2X_FRONT_WARNING_MARKER = "V2X_FRONT_WARNING_MARKER";
/**
* V2X预警日志tag
*/
public static final String LOG_NAME_WARN = "liyz";
}

View File

@@ -92,6 +92,7 @@ public class V2XMarkerService implements V2XRefreshCallback<MarkerResponse> {
// 设置地图定位监听
V2XServiceManager.getMogoRegisterCenter()
.registerMogoLocationListener(MODULE_NAME, V2XLocationListener.getInstance());
V2XServiceManager.getMogoRegisterCenter().registerCarLocationChangedListener( MODULE_NAME, V2XLocationListener.getInstance());
Logger.d(MODULE_NAME, "V2X道路事件开启V2X地图气泡自动绘制。");
if (refreshHandler == null) {

View File

@@ -303,7 +303,7 @@ public class V2XModuleProvider implements
V2XServiceManager.getV2XMarkerService().startAutoRefresh();
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
V2XServiceManager.getMapUIController().recoverLockMode();
Log.d("liyz", "V2XModuleProvider ------> ");
Log.d(V2XConst.LOG_NAME_WARN, "V2XModuleProvider ------> ");
//注册adas数据通道
V2XWaringManager.getInstance().registerAdasSocketMessage(mContext);
}

View File

@@ -16,6 +16,7 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.v2x.alarm.V2XCalculateServer;
import com.mogo.module.v2x.manager.IMoGoPersonWarnPolylineManager;
import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager;
import com.mogo.module.v2x.manager.IMoGoV2XMarkerManager;
import com.mogo.module.v2x.manager.IMoGoV2XPolylineManager;
@@ -45,6 +46,7 @@ import com.mogo.service.share.IMogoTrafficUploadProvider;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
import com.mogo.service.strategy.IMogoRefreshStrategyController;
import com.mogo.service.v2x.DisplayEffectsInterface;
import com.mogo.service.windowview.IMogoTopViewManager;
import com.mogo.service.windowview.IMogoWindowManager;
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
@@ -76,6 +78,7 @@ public class V2XServiceManager {
private static IMogoGeoSearch mIMogoGeoSearch;
private static IMogoSearchManager mIMogoSearchManager;
private static IMogoTopViewManager mMogoTopViewManager;
private static DisplayEffectsInterface displayEffectsManager;
private static IMogoStatusManager mMogoStatusManager;
private static IMogoWindowManager mIMogoWindowManager;
private static IMogoImageloader mImageLoader;
@@ -110,6 +113,7 @@ public class V2XServiceManager {
private static IMoGoV2XPolylineManager moGoV2XPolylineManager;
private static IMoGoV2XStatusManager moGoV2XStatusManager;
private static IMoGoWarnPolylineManager moGoWarnPolylineManager;
private static IMoGoPersonWarnPolylineManager moGoPersonWarnPolylineManager;
private static IMoGoV2XCloundDataManager moGoV2XCloundDataManager;
private V2XServiceManager() {
@@ -135,6 +139,7 @@ public class V2XServiceManager {
mMogoEntranceButtonController = mMogoServiceApis.getEntranceButtonController();
mMogoActionManager = mMogoServiceApis.getActionManagerApi();
mMogoTopViewManager = mMogoServiceApis.getTopViewManager();
displayEffectsManager = mMogoServiceApis.getDisplayEffectsManager();
mIMogoSearchManager = mMogoServiceApis.getSearchManagerApi();
mIMogoMarkerService = mMogoServiceApis.getMarkerService();
mIMogoShareManager = mMogoServiceApis.getShareManager();
@@ -164,6 +169,7 @@ public class V2XServiceManager {
moGoV2XPolylineManager = (IMoGoV2XPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_POLYLINE_MANAGER).navigation(context);
moGoWarnPolylineManager = (IMoGoWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER).navigation(context);
moGoV2XCloundDataManager = (IMoGoV2XCloundDataManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER).navigation(context);
moGoPersonWarnPolylineManager = (IMoGoPersonWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_PERSON_WARN_POLYLINE_MANAGER).navigation(context);
moGoV2XStatusManager = (IMoGoV2XStatusManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(context);
}
@@ -178,6 +184,10 @@ public class V2XServiceManager {
return mMogoTopViewManager;
}
public static DisplayEffectsInterface getDisplayEffectsManager(){
return displayEffectsManager;
}
public static IMogoEntranceButtonController getMogoEntranceButtonController() {
return mMogoEntranceButtonController;
}
@@ -332,4 +342,13 @@ public class V2XServiceManager {
public static void setMoGoV2XCloundDataManager(IMoGoV2XCloundDataManager moGoV2XCloundDataManager) {
V2XServiceManager.moGoV2XCloundDataManager = moGoV2XCloundDataManager;
}
public static IMoGoPersonWarnPolylineManager getMoGoPersonWarnPolylineManager() {
return moGoPersonWarnPolylineManager;
}
public static void setMoGoPersonWarnPolylineManager(IMoGoPersonWarnPolylineManager moGoPersonWarnPolylineManager) {
V2XServiceManager.moGoPersonWarnPolylineManager = moGoPersonWarnPolylineManager;
}
}

View File

@@ -24,7 +24,6 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext;
public class V2XWaringManager {
List<MogoLatLng> lonLats = new ArrayList<>();
List<ADASRecognizedResult> resultList = new ArrayList<>();
private Context mContext;
private static V2XWaringManager mV2XWaringManager;
@@ -51,7 +50,7 @@ public class V2XWaringManager {
* 注册长链接消息处理
*/
public void registerAdasSocketMessage(Context context) {
Logger.d("liyz", "开始注册Socket通道....");
Logger.d(V2XConst.LOG_NAME_WARN, "开始注册Socket通道....");
mContext = context;
//根据云端,绘制自车和交点,以及行人或二轮车与交点的绘制
@@ -64,7 +63,7 @@ public class V2XWaringManager {
* 反注册消息通道,不再进行接受
*/
public void unregisterAdasSocketMessage() {
Logger.w("liyz", "反注册Socket通道....");
Logger.w(V2XConst.LOG_NAME_WARN, "反注册Socket通道....");
if (v2XWarnMessageListener != null) {
V2XServiceManager
.getMoGoSocketManager()
@@ -94,9 +93,7 @@ public class V2XWaringManager {
* 处理adas返回的数据
*/
private void handleAdasData() {
Log.d("liyz", "V2XWaringManager ---- handleAdasData ---0-- ");
//清理
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
Log.d(V2XConst.LOG_NAME_WARN, "V2XWaringManager ---- handleAdasData ");
// 绘制连接线 TODO 来的是列表数据
DrawLineInfo info1 = new DrawLineInfo();
@@ -104,13 +101,12 @@ public class V2XWaringManager {
MogoLatLng endLatlng1 = new MogoLatLng(40.010906,116.423821);
info1.setStartLocation(startLatlng1);
info1.setEndLocation(endLatlng1);
V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(getContext(), info1);
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info1);
// adas 每隔一秒传递的他车或行人数据
V2XServiceManager.getmIMogoADASController().addAdasRecognizedDataCallback(resultList -> {
// 绘制近景识别到的车辆,行人和二轮车 TODO
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
Log.d("liyz", "V2XWaringManager ---- handleAdasData ----- ");
//清理
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
@@ -121,7 +117,7 @@ public class V2XWaringManager {
MogoLatLng endLatlng = new MogoLatLng(39.971089,116.407384);
info.setStartLocation(startLatlng);
info.setEndLocation(endLatlng);
V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(mContext, info);
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(mContext, info);
//更新数据
for (ADASRecognizedResult result : resultList) {
@@ -135,7 +131,7 @@ public class V2XWaringManager {
double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
Log.d("liyz", "lon = " + lon + "----lat = " + lat);
Log.d(V2XConst.LOG_NAME_WARN, "lon = " + lon + "----lat = " + lat);
//绘制自车数据 liyz
// DrawLineInfo info = new DrawLineInfo();

View File

@@ -25,8 +25,11 @@ import com.mogo.module.common.entity.MarkerUserInfo;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.wm.WindowManagerView;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
@@ -55,6 +58,7 @@ import java.util.List;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
@@ -269,6 +273,11 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
ivEvent.setImageResource(EventTypeUtils.getPoiTypeSrcVr(mNoveltyInfo.getPoiType()));
tvEvent.setText(EventTypeUtils.getPoiTypeStrVr(mNoveltyInfo.getPoiType()));
if (mNoveltyInfo.getPoiType() == V2XPoiTypeEnum.FOURS_FOG) {
}
V2XServiceManager.getDisplayEffectsManager().displayEffects(V2XPoiTypeEnum.FOURS_FOG);
// MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(ALERT_THE_FRONT_CRASH_WARNING_TOP, MogoReceiver.ACTION_V2X_FRONT_WARNING);
tvEventAddress.setText(mNoveltyInfo.getAddr());
tvEventDistance.setText("距离 " + (int) mNoveltyInfo.getDistance() + "");

View File

@@ -58,12 +58,12 @@ public class CloundWarningInfo {
/**
* 识别物经纬度
* */
private MogoLatLng startLocation;
public MogoLatLng startLocation;
/**
* 行人经纬度交点
*/
private MogoLatLng endLocation;
public MogoLatLng endLocation;
/**
* 停止线的纬度

View File

@@ -1,11 +1,13 @@
package com.mogo.module.v2x.listener;
import android.content.Context;
import android.location.Location;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.search.geo.IMogoGeoSearchListener;
import com.mogo.map.search.geo.MogoGeocodeResult;
@@ -48,7 +50,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : V2X中用到的位置监听。处理刷新频率以及位置改变是否触发道路事件警报
* version: 1.0
*/
public class V2XLocationListener implements IMogoLocationListener, CarStatusListener {
public class V2XLocationListener implements IMogoLocationListener, CarStatusListener, IMogoCarLocationChangedListener2 {
private String TAG = "V2XLocationListener";
private MogoLocation mLastCarLocation;
@@ -71,8 +73,31 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
return mV2XLocationListener;
}
@Override
public void onCarLocationChanged( MogoLatLng latLng ) {
// do not impl
}
@Override
public void onCarLocationChanged2( Location location ) {
MogoLocation loc = new MogoLocation();
loc.setTime( loc.getTime());
loc.setAccuracy( location.getAccuracy() );
loc.setSpeed( location.getSpeed());
loc.setLongitude( location.getLongitude() );
loc.setLatitude( location.getLatitude() );
loc.setAltitude( location.getAltitude() );
loc.setBearing( location.getBearing() );
loc.setProvider( location.getProvider() );
// onLocationChangedImpl( loc );
}
@Override
public void onLocationChanged(MogoLocation location) {
onLocationChangedImpl(location);
}
private void onLocationChangedImpl(MogoLocation location){
try {
//Logger.d(V2XConst.MODULE_NAME, "V2X预警--onLocationChanged: " + GsonUtil.jsonFromObject(location));
// 刷新角度

View File

@@ -0,0 +1,21 @@
package com.mogo.module.v2x.listener;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.service.connection.IMogoOnMessageListener;
/**
* @author liujing
* @description 车路云—场景预警-云下发数据监听 前车/行人/摩托车/盲区碰撞预警
* @since: 2021/3/31
*/
public class V2XMessageListener_401013 implements IMogoOnMessageListener<V2XWarningEntity> {
@Override
public Class target() {
return null;
}
@Override
public void onMsgReceived(V2XWarningEntity obj) {
}
}

View File

@@ -1,22 +1,22 @@
package com.mogo.module.v2x.listener;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.model.CloundWarningInfo;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.connection.IMogoOnMessageListener;
/**
* desc: 下发的云端预警数据
*/
public class V2XWarnMessageListener implements IMogoOnMessageListener<CloundWarningInfo> {
public class V2XWarnMessageListener implements IMogoOnMessageListener<V2XWarningEntity> {
@Override
public Class<CloundWarningInfo> target() {
return CloundWarningInfo.class;
public Class<V2XWarningEntity> target() {
return V2XWarningEntity.class;
}
@Override
public void onMsgReceived(CloundWarningInfo info) {
public void onMsgReceived(V2XWarningEntity info) {
//Logger.d(MODULE_NAME, "V2XMessageListener_401011==V2X地图气泡数据刷新\n" + GsonUtil.jsonFromObject(response));
V2XUtils.runOnBackgroundThread(() -> {
// 解析不同的Marker类型然后对应的进行绘制

View File

@@ -0,0 +1,27 @@
package com.mogo.module.v2x.manager;
import android.content.Context;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
/**
* 绘制可变宽度和渐变的线,
*/
public interface IMoGoPersonWarnPolylineManager extends IProvider {
/**
* 绘制连接线,人物和二轮车
*
* @param context
* @param info
*/
void drawPersonWarnPolyline(Context context, DrawLineInfo info);
/**
* 移除连接线
*/
void clearLine();
IMogoPolyline getMogoPersonWarnPolyline();
}

View File

@@ -1,7 +1,7 @@
package com.mogo.module.v2x.manager;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.module.v2x.entity.model.CloundWarningInfo;
import com.mogo.module.common.entity.V2XWarningEntity;
/**
* desc: V2X 处理云端预警消息
@@ -11,7 +11,7 @@ public interface IMoGoV2XCloundDataManager extends IProvider {
/**
* 处理下发数据
*/
void analysisV2XCloundDataEvent(CloundWarningInfo cloundWarningInfo);
void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo);
/**
* 清除 所有的 POI

View File

@@ -18,7 +18,7 @@ public interface IMoGoWarnPolylineManager extends IProvider {
* @param context
* @param info
*/
void drawableWarnPolyline(Context context, DrawLineInfo info);
void drawWarnPolyline(Context context, DrawLineInfo info);
/**
* 移除连接线

View File

@@ -0,0 +1,87 @@
package com.mogo.module.v2x.manager.impl;
import android.content.Context;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.module.v2x.MoGoV2XServicePaths;
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.IMoGoPersonWarnPolylineManager;
import java.util.ArrayList;
import java.util.List;
/**
* 当前车辆与道路事件的连接线
*/
@Route(path = MoGoV2XServicePaths.PATH_V2X_PERSON_WARN_POLYLINE_MANAGER)
public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineManager {
private static IMogoPolyline mMogoPolyline;
@Override
public void drawPersonWarnPolyline(Context context, DrawLineInfo info) {
try {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
}
// 连接线参数
MogoPolylineOptions options = new MogoPolylineOptions();
float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getStartLocation().lon,
info.getStartLocation().lat, (float) info.getHeading(), true, true);
// 渐变色
List<Integer> colors = new ArrayList<>();
if (info.getType().equals("1")) { //预警 TODO
colors.add(0xFFFFA31A);
colors.add(0xFFFFA31A);
} else {
colors.add(0xFFE32F46);
colors.add(0xFFE32F46);
}
// 线条粗细,渐变,渐变色值
Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager roadWidth = " + roadWidth);
options.width(roadWidth).useGradient(true).colorValues(colors);
// options.width(60).useGradient(true).colorValues(colors);
// 当前车辆位置
options.add(info.getStartLocation());
// 目标车辆位置
options.add(info.getEndLocation());
// 绘制线的对象
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void clearLine() {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
mMogoPolyline = null;
}
}
@Override
public void init(Context context) {
}
/**
* @return 绘制连接线的对象
*/
@Override
public IMogoPolyline getMogoPersonWarnPolyline() {
return mMogoPolyline;
}
}

View File

@@ -1,23 +1,31 @@
package com.mogo.module.v2x.manager.impl;
import android.content.Context;
import android.location.Location;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.map.MogoLatLng;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.v2x.MoGoV2XServicePaths;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.model.CloundWarningInfo;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager;
import java.util.Arrays;
import static com.mogo.module.v2x.V2XServiceManager.getContext;
/**
* desc : V2X 服务端下发数据处理 点的绘制
*/
@Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER)
public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager {
private static final String TAG = "MoGoV2XCloundDataManager";
public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMogoCarLocationChangedListener2 {
private V2XWarningEntity mCloundWarningInfo;
@Override
public void init(Context context) {
@@ -25,29 +33,43 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager {
}
@Override
public void analysisV2XCloundDataEvent(CloundWarningInfo cloundWarningInfo) {
//TODO
//清理
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) {
mCloundWarningInfo = cloundWarningInfo;
//绘制连接线自车与交汇点连线
DrawLineInfo info1 = new DrawLineInfo();
MogoLatLng startLatlng1 = new MogoLatLng(39.968919,116.407642);
MogoLatLng endLatlng1 = new MogoLatLng(40.010906,116.423821);
info1.setStartLocation(startLatlng1);
info1.setEndLocation(endLatlng1);
V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(getContext(), info1);
//TODO 根据判断条件,决定是否画线或者删除线
//绘制识别物与交汇点连线 TODO
//绘制识别物与交汇点连线,并且更新连线数据
drawOtherObjectLine(cloundWarningInfo);
//二轮车和行人的移动和渲染
// SnapshotSetDataDrawer.getInstance().renderSnapshotData();
//更新数据连线数据 他车和自车
}
//自车的移动
//他车的移动
/**
* 绘制行人和二轮车连线,并且更新数据
*/
private void drawOtherObjectLine(V2XWarningEntity info) {
IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline();
if (info != null) {
if (polyLine != null) {
polyLine.setPoints(Arrays.asList(new MogoLatLng(info.getLat(), info.getLon()),
new MogoLatLng(info.getCollisionLat(), info.getCollisionLon())));
} else {
DrawLineInfo lineInfo = new DrawLineInfo();
// MogoLatLng startLatlng = new MogoLatLng(39.968919,116.407642);
// MogoLatLng endLatlng = new MogoLatLng(40.010906,116.423821);
MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());
MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());
lineInfo.setStartLocation(startLatlng);
lineInfo.setEndLocation(endLatlng);
lineInfo.setHeading(info.heading);
V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo);
}
} else {
Log.e(V2XConst.LOG_NAME_WARN, "mCloundWarningInfo == null");
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
}
}
@@ -55,4 +77,43 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager {
public void clearALLPOI() {
}
/**
* 自车定位 移动完成需要 3s消失 TODO
*/
@Override
public void onCarLocationChanged2(Location latLng) {
Log.d(V2XConst.LOG_NAME_WARN, "latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude());
//当行人经纬度交点 经纬度不为空,开始画线,否则清理
//自车只需要关注移动
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
if (mCloundWarningInfo != null) {
if (mogoPolyline != null) {
mogoPolyline.setPoints(Arrays.asList(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()),
new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon())));
} else {
Log.e(V2XConst.LOG_NAME_WARN, "V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline() == null");
DrawLineInfo info = new DrawLineInfo(); // 对象 TODO
// MogoLatLng startLatlng = new MogoLatLng(39.968919, 116.407642);
// MogoLatLng endLatlng = new MogoLatLng(40.010906, 116.423821);
MogoLatLng startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
MogoLatLng endLatlng = new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon());
info.setHeading(latLng.getBearing());
info.setStartLocation(startLatlng);
info.setEndLocation(endLatlng);
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info);
}
} else {
Log.e(V2XConst.LOG_NAME_WARN, "mCloundWarningInfo == null");
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
}
}
@Override
public void onCarLocationChanged(MogoLatLng latLng) {
}
}

View File

@@ -10,6 +10,7 @@ import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.MoGoV2XServicePaths;
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.IMoGoWarnPolylineManager;
@@ -27,7 +28,11 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
@Override
public void drawableWarnPolyline(Context context, DrawLineInfo info) {
public void drawWarnPolyline(Context context, DrawLineInfo info) {
if (info == null) {
return;
}
try {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
@@ -36,19 +41,29 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
// 连接线参数
MogoPolylineOptions options = new MogoPolylineOptions();
// 渐变色
// float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getStartLocation().lon,
// info.getStartLocation().lat, (float) info.getHeading(), true, true);
List<Integer> colors = new ArrayList<>();
if (info.getType().equals("1")) { //预警 TODO
colors.add(0xFFFFA31A);
colors.add(0xFFFFA31A);
if (info.getType() != null) {
if (info.getType().equals("1")) { //预警 TODO
colors.add(0xFFFFA31A);
colors.add(0xFFFFA31A);
} else {
colors.add(0xFFE32F46);
colors.add(0xFFE32F46);
}
} else {
Log.e(V2XConst.LOG_NAME_WARN, "info.getType() == null ");
colors.add(0xFFE32F46);
colors.add(0xFFE32F46);
}
// Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + roadWidth);
// 线条粗细,渐变,渐变色值
options.width(60).useGradient(true).colorValues(colors);
// options.width(roadWidth).useGradient(true).colorValues(colors);
// 当前车辆位置
options.add(info.getStartLocation());
// 目标车辆位置
@@ -56,7 +71,6 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
// 绘制线的对象
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
Log.d("liyz", "MoGoWarnPolylineManager drawableWarnPolyline -----> ");
} catch (Exception e) {
e.printStackTrace();

View File

@@ -20,9 +20,9 @@ public class AdasDataBroadcastReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
try {
// ADASRecognizedResult adasResult = (ADASRecognizedResult) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
// Logger.d("liyz", "AdasDataBroadcastReceiver -->" + GsonUtil.jsonFromObject(adasResult));
// Logger.d(V2XConst.LOG_NAME_WARN, "AdasDataBroadcastReceiver -->" + GsonUtil.jsonFromObject(adasResult));
String adasResult = (String) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
Log.d("liyz", "AdasDataBroadcastReceiver -----> ");
Log.d(V2XConst.LOG_NAME_WARN, "AdasDataBroadcastReceiver -----> ");
V2XWaringManager.getInstance().registerAdasSocketMessage(context);
} catch (Exception e) {

View File

@@ -25,7 +25,6 @@ public class SceneBroadcastReceiver extends BroadcastReceiver {
try {
V2XMessageEntity v2XMessageEntity = (V2XMessageEntity) intent.getSerializableExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY);
//Logger.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
Log.d("liyz", "SceneBroadcastReceiver ------->");
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
} catch (Exception e) {
e.printStackTrace();

View File

@@ -1,10 +1,7 @@
package com.mogo.module.v2x.scenario.scene.warning;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
@@ -13,9 +10,9 @@ import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
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.v2x.R;
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.scenario.view.IV2XMarker;
import com.mogo.utils.WorkThreadHandler;
@@ -41,19 +38,25 @@ public class V2XWarningMarker implements IV2XMarker {
markerShowEntity.setMarkerType(V2XConst.V2X_FRONT_WARNING_MARKER);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_WARNING_MARKER);
clearPOI();
WorkThreadHandler.getInstance().postDelayed(() -> {
MogoMarkerOptions options = new MogoMarkerOptions()
.object(markerShowEntity)
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon());
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
Bitmap bitmap = BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.v2x_road_front_p_warning);
options.icon(bitmap);
options.icon3DRes(com.mogo.module.service.R.raw.people);
options.anchorColor("#FF4040");
IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);
marker.setToTop();
}, 1000);
}, 0);
//如果有预警碰撞点,识别物与预警碰撞点之间连线,并执行平移动画
if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() != 0) {
drawLine();
smooth();
}
} else {
}
@@ -63,8 +66,21 @@ public class V2XWarningMarker implements IV2XMarker {
}
@Override
public void clearPOI() {
public void drawLine() {
DrawLineInfo drawLineInfo = new DrawLineInfo();
MogoLatLng slatLng = new MogoLatLng(mMarkerEntity.getLat(), mMarkerEntity.getLon());
MogoLatLng endLatLng = new MogoLatLng(mMarkerEntity.getCollisionLat(), mMarkerEntity.getCollisionLon());
drawLineInfo.setStartLocation(slatLng);
drawLineInfo.setEndLocation(endLatLng);
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(mContext, drawLineInfo);
}
public void smooth() {
}
@Override
public void clearPOI() {
V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_WARNING_MARKER);
}
}

View File

@@ -69,15 +69,16 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow {
break;
case 1:
case 2:
typeImage.setImageResource(R.drawable.v2x_road_front_p_warning);
typeImage.setImageResource(R.drawable.v2x_road_front_m_warning);
break;
default:
break;
}
distance.setText(String.valueOf(mV2XWarningEntity.getDistance()) + "");
warningTextView.setText(mV2XWarningEntity.getTipContent());
warningTextView.setText(mV2XWarningEntity.getWarningContent());
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(mV2XWarningEntity.getTts());
}
//3秒后移除提示弹框
if (runnableV2XEvent == null) {
runnableV2XEvent = () -> {
EXPIRE_TIMER = EXPIRE_TIMER - COUNT_DOWN_TIMER;

View File

@@ -103,6 +103,22 @@ public class EventTypeUtils {
case V2XPoiTypeEnum.FOURS_FOG:
src = R.drawable.v2x_icon_nongwu_vr;
break;
// 封路
case V2XPoiTypeEnum.ROAD_CLOSED:
src = R.drawable.v2x_icon_fenglu_vr;
break;
// 施工
case V2XPoiTypeEnum.FOURS_ROAD_WORK:
src = R.drawable.v2x_icon_daolushigong_vr;
break;
// 事故
case V2XPoiTypeEnum.FOURS_ACCIDENT:
src = R.drawable.v2x_icon_jiaotongshigu_vr;
break;
// 交通检查
case V2XPoiTypeEnum.TRAFFIC_CHECK:
src = R.drawable.v2x_icon_jiaotongjiancha_vr;
break;
default:
src = R.drawable.v2x_icon_live_logo;
break;
@@ -125,6 +141,22 @@ public class EventTypeUtils {
case V2XPoiTypeEnum.FOURS_FOG:
str = "浓雾预警";
break;
// 封路
case V2XPoiTypeEnum.ROAD_CLOSED:
str = "前方封路";
break;
// 施工
case V2XPoiTypeEnum.FOURS_ROAD_WORK:
str = "前方施工";
break;
// 事故
case V2XPoiTypeEnum.FOURS_ACCIDENT:
str = "前方交通事故";
break;
// 交通检查
case V2XPoiTypeEnum.TRAFFIC_CHECK:
str = "前方交通检查";
break;
default:
str = "其它道路事件";
break;

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -1,14 +1,18 @@
{
"type":0,
"targetType": "1",
"lat":39.977121,
"lon":116.417537,
"lat":39.977148,
"lon":116.417478,
"distance": 2.22,
"collisionLat": 39.9760799115429,
"collisionLon": 116.411360351446,
"collisionLat": 39.977131,
"collisionLon": 116.417741,
"from": 1,
"angle": 120,
"direction": 10014,
"speed":11.108121
"speed":11.108121,
"targetColor": "#FF4040",
"stopLineDistance":20,
"stopLineLat": 39.977123,
"stopLineLon": 116.417537,
"warningContent": "小心行人",
"heading": 30
}

View File

@@ -38,6 +38,7 @@ import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
import com.mogo.service.strategy.IMogoRefreshStrategyController;
import com.mogo.service.share.IMogoTanluProvider;
import com.mogo.service.share.IMogoTanluUiProvider;
import com.mogo.service.v2x.DisplayEffectsInterface;
import com.mogo.service.v2x.IV2XProvider;
import com.mogo.service.windowview.IMogoTopViewManager;
import com.mogo.service.windowview.IMogoWindowManager;
@@ -212,6 +213,14 @@ public interface IMogoServiceApis extends IProvider {
*/
IMogoTopViewManager getTopViewManager();
/**
* 浓雾等极端事件特殊效果管理类
*
* @return
*/
DisplayEffectsInterface getDisplayEffectsManager();
/**
* 其他模块调用公共的marker打点
*

View File

@@ -179,6 +179,12 @@ public class MogoServicePaths {
@Deprecated
public static final String PATH_EXTENSIONS_TOP_VIEW_MANAGER = "/topview/api";
/**
* 浓雾等极端事件特殊效果
*/
@Deprecated
public static final String PATH_MAIN_DISPLAY_EFFECTS_MANAGER = "/displayeffects/api";
/**
* 其他模块调用公共的marker打点
*/

View File

@@ -0,0 +1,15 @@
package com.mogo.service.v2x;
import com.alibaba.android.arouter.facade.template.IProvider;
/**
* created by wujifei on 2021/3/30 15:41
* describe:
*/
public interface DisplayEffectsInterface extends IProvider {
/**
* 展示浓雾等极端事件特殊效果
* @param type 效果类型
*/
void displayEffects(String type);
}

View File

@@ -47,6 +47,7 @@ import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
import com.mogo.service.strategy.IMogoRefreshStrategyController;
import com.mogo.service.share.IMogoTanluProvider;
import com.mogo.service.share.IMogoTanluUiProvider;
import com.mogo.service.v2x.DisplayEffectsInterface;
import com.mogo.service.v2x.IV2XProvider;
import com.mogo.service.windowview.IMogoTopViewManager;
import com.mogo.service.windowview.IMogoWindowManager;
@@ -189,6 +190,11 @@ public class MogoServiceApis implements IMogoServiceApis {
return getApiInstance(IMogoTopViewManager.class, MogoServicePaths.PATH_EXTENSIONS_TOP_VIEW_MANAGER);
}
@Override
public DisplayEffectsInterface getDisplayEffectsManager() {
return getApiInstance(DisplayEffectsInterface.class, MogoServicePaths.PATH_MAIN_DISPLAY_EFFECTS_MANAGER);
}
@Override
public IMogoMarkerService getMarkerService() {
return getApiInstance(IMogoMarkerService.class, MogoServicePaths.PATH_MARKER_SERVICE);

View File

@@ -29,11 +29,11 @@ public class V2XManager implements IV2XProvider {
@Override
public void registerIntentListener(String intent, IV2XListener listener) {
if (listener == null || intent == null) {
Log.d("V2XManager","listener == null || intent == null");
Log.d("V2XManager", "listener == null || intent == null");
return;
}
if (!mListeners.containsKey(intent)) {
Log.d("V2XManager","intent=="+intent+"listener"+listener);
Log.d("V2XManager", "intent==" + intent + "listener" + listener);
mListeners.put(intent, new CopyOnWriteArrayList<>());
}
mListeners.get(intent).add(listener);