This commit is contained in:
wangcongtao
2020-10-25 15:51:28 +08:00
40 changed files with 946 additions and 92 deletions

View File

@@ -0,0 +1,149 @@
package com.mogo.commons.utils;
import java.text.DecimalFormat;
/**
* 莫顿编码
*
* @author linyang
* @since 2020.07.09
*/
public class MortonCode {
/**
* morton 转 经纬度 时的中间常量
*/
private static final long NDS_180_DEGREES = 0x7fffffff;
/**
* morton 转 经纬度 时的中间常量
*/
private static final long NDS_360_DEGREES = 4294967295L;
/**
* morton 转 经纬度 时的中间常量
*/
private static final long NDS_90_DEGREES = 0x3fffffff;
/**
* 经纬度转 morton 时的中间常量
*/
private static final double RULE_MORTON = Math.pow( 2, 32 ) / 360;
/**
* morton 转 经纬度 时的中间常量
*/
private static final double RULE_MORTON_TO_LONLAT = 360.0 / Math.pow( 2, 32 );
/**
* @param lon
* @param lat
* @return
*/
public static long wrapEncodeMorton( Double lon, Double lat ) {
DecimalFormat decimalFormat = new DecimalFormat( "#.######" );
return encodeMorton( Double.valueOf( decimalFormat.format( lon ) ),
Double.valueOf( decimalFormat.format( lat ) ) );
}
/**
* 编码 morton code
*
* @param lon
* @param lat
* @return
*/
public static long encodeMorton( Double lon, Double lat ) {
Long bit = 1L;
long mortonCode = 0L;
long x = ( long ) ( lon * RULE_MORTON );
long y = ( long ) ( lat * RULE_MORTON );
if ( y < 0 ) {
y += 0x7FFFFFFF;
}
y = y << 1;
for ( int i = 0; i < 32; i++ ) {
// x-part
mortonCode = mortonCode | ( x & bit );
x = x << 1;
bit = bit << 1;
// y-part
mortonCode = mortonCode | ( y & bit );
y = y << 1;
bit = bit << 1;
}
return mortonCode;
}
/**
* 将莫顿码解码为坐标
*
* @param mortonCode
* @return
*/
public static double[] decodeMorton( long mortonCode ) {
long[] midPoint = mortonCodeToCoord( mortonCode );
normalizeCoord( midPoint );
double[] point = new double[2];
// 将经纬度长整数转化为 浮点类型
point[0] = midPoint[0] * RULE_MORTON_TO_LONLAT;
point[1] = midPoint[1] * RULE_MORTON_TO_LONLAT;
return point;
}
/**
* 莫顿码分别拆解为 编码后的经纬度长整数
*
* @param mortonCode
* @return
*/
private static long[] mortonCodeToCoord( long mortonCode ) {
long bit = 1L;
long[] longPoint = new long[2];
for ( int i = 0; i < 32; i++ ) {
longPoint[0] |= mortonCode & bit;
mortonCode >>= 1;
longPoint[1] |= mortonCode & bit;
bit <<= 1;
}
return longPoint;
}
/**
* 对编码后的经纬度长整数进行解码
*
* @param midPoint
*/
private static void normalizeCoord( long[] midPoint ) {
// if x > 180 degrees, then subtract 360 degrees
if ( midPoint[0] > NDS_180_DEGREES ) {
midPoint[0] -=
NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well
} else if ( midPoint[0] < -NDS_180_DEGREES ) // if x < 180 , x += 360
{
midPoint[0] +=
NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well
}
// if y > 90 degrees, then subtract 180 degrees
if ( midPoint[1] > NDS_90_DEGREES ) {
midPoint[1] -=
NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well
} else if ( midPoint[1] < -NDS_90_DEGREES ) // if y < 90, y += 180
{
midPoint[1] +=
NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well
}
return;
}
public static void main( String[] args ) {
System.out.println( encodeMorton( 116.39584, 39.98152 ) );
}
}

View File

@@ -55,7 +55,7 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-online-12'
implementation 'com.zhidaoauto.machine:map:1.0.0-online-13'
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -240,7 +240,7 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
@Override
public void setTrafficEnabled(boolean visible) {
if (checkAMapView()) {
//mMapView.getMapAutoViewHelper().setTraffic(visible);
// mMapView.getMapAutoViewHelper().setTraffic(visible);
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.map;
import android.content.Context;
import android.opengl.Visibility;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.impl.amap.location.ALocationClient;
@@ -33,8 +34,14 @@ class MogoMapDelegateFactory {
private static final String TAG = "MogoMapDelegateFactory";
private static boolean useCustom = false;
public static boolean isUseCustom() {
return useCustom;
}
public static IMogoGeoSearch getGeoSearchDelegate( Context context ) {
if ( DebugConfig.isUseCustomMap() ) {
if ( useCustom ) {
Logger.d( TAG, "use custom IMogoGeoSearch" );
return new com.mogo.map.impl.custom.search.GeocodeSearchClient( context );
}
@@ -42,7 +49,7 @@ class MogoMapDelegateFactory {
}
public static IMogoInputtipsSearch getInputtipsSearchDelegate( Context context, MogoInputtipsQuery query ) {
if ( DebugConfig.isUseCustomMap() ) {
if ( useCustom ) {
Logger.d( TAG, "use custom IMogoInputtipsSearch" );
return new com.mogo.map.impl.custom.search.InputtipsSearch( context, query );
}
@@ -50,7 +57,7 @@ class MogoMapDelegateFactory {
}
public static IMogoLocationClient getLocationClientDelegate( Context context ) {
if ( DebugConfig.isUseCustomMap() ) {
if ( useCustom ) {
Logger.d( TAG, "use custom IMogoLocationClient" );
return new com.mogo.map.impl.custom.location.ALocationClient( context );
}
@@ -58,7 +65,7 @@ class MogoMapDelegateFactory {
}
public static IMogoMapUIController getMapUIControllerDelegate() {
if ( DebugConfig.isUseCustomMap() ) {
if ( useCustom ) {
Logger.d( TAG, "use custom IMogoMapUIController" );
return com.mogo.map.impl.custom.uicontroller.AMapUIController.getInstance();
}
@@ -72,16 +79,16 @@ class MogoMapDelegateFactory {
} else if ( AppUtils.isAppInstalled( context, "com.autonavi.amapauto" ) ) {
return AutoNaviClient.getInstance( context );
} else {
if ( DebugConfig.isUseCustomMap() ) {
if ( useCustom ) {
Logger.d( TAG, "use custom IMogoNavi" );
return com.mogo.map.impl.custom.navi.NaviClient.getInstance( context );
}
return NaviClient.getInstance( context );
}
return NaviClient.getInstance( context );
}
public static IMogoPoiSearch getPoiSearchClientDelegate( Context context, MogoPoiSearchQuery query ) {
if ( DebugConfig.isUseCustomMap() ) {
if ( useCustom ) {
Logger.d( TAG, "use custom IMogoPoiSearch" );
return new com.mogo.map.impl.custom.search.PoiSearchClient( context, query );
}
@@ -89,7 +96,7 @@ class MogoMapDelegateFactory {
}
public static IMogoRoadSearch getRoadSearchDelegate() {
if ( DebugConfig.isUseCustomMap() ) {
if ( useCustom ) {
Logger.d( TAG, "use custom IMogoRoadSearch" );
return new com.mogo.map.impl.custom.search.RoadSearchClient();
}

View File

@@ -40,32 +40,35 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
@Override
protected void addDleMaps() {
mAMapView = new AMapBaseMapView().create( getContext() );
mCustomMapView = new CustomMapView().create( getContext() );
if ( mAMapView != null ) {
final View mapView = mAMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
if ( !MogoMapDelegateFactory.isUseCustom() ) {
mAMapView = new AMapBaseMapView().create( getContext() );
if ( mAMapView != null ) {
final View mapView = mAMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
} else {
Logger.e( TAG, "create MapView instance failed." );
}
} else {
Logger.e( TAG, "create MapView instance failed." );
Logger.e( TAG, "create IMogoMapView instance failed." );
}
mMapView = mAMapView;
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
mCustomMapView = new CustomMapView().create( getContext() );
if ( mCustomMapView != null ) {
final View mapView = mCustomMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
} else {
Logger.e( TAG, "create MapView instance failed." );
}
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
}
mMapView = mCustomMapView;
}
// if ( mCustomMapView != null ) {
// final View mapView = mCustomMapView.getMapView();
// if ( mapView != null ) {
// addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
// } else {
// Logger.e( TAG, "create MapView instance failed." );
// }
// } else {
// Logger.e( TAG, "create IMogoMapView instance failed." );
// }
mMapView = mAMapView;
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
}

View File

@@ -37,7 +37,7 @@ public class MainIndependentActivity extends MainActivity {
// 事件面板
FrameLayout.LayoutParams eventPanelParams = ( ( FrameLayout.LayoutParams ) mEventPanel.getLayoutParams() );
eventPanelParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft );
mEntrance.setLayoutParams( eventPanelParams );
mEventPanel.setLayoutParams( eventPanelParams );
// 事件面板
FrameLayout.LayoutParams historyMessagePanelParams = ( ( FrameLayout.LayoutParams ) mEventPanel.getLayoutParams() );

View File

@@ -5,6 +5,7 @@ import android.os.Bundle;
import android.os.Process;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import androidx.annotation.Nullable;
@@ -13,6 +14,8 @@ import com.mogo.module.extensions.utils.ExtensionsConfig;
import com.mogo.module.main.MainActivity;
import com.mogo.module.main.cards.MogoModulesManager;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.logger.Logger;
/**
@@ -20,13 +23,15 @@ import com.mogo.utils.logger.Logger;
*
* @author tongchenfei
*/
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener {
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IMogoStatusChangedListener {
private static final String TAG = "MainLauncherActivity";
protected boolean mIsHomeKeyDown = false;
@Override
protected void onCreate( @Nullable Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
ExtensionsConfig.setNeedRequestUserInfo( true );
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG,
StatusDescriptor.VR_MODE, this);
}
@Override
@@ -89,6 +94,8 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
protected void onDestroy() {
super.onDestroy();
mServiceApis.getStatusManagerApi().unregisterStatusChangedListener(TAG,
StatusDescriptor.VR_MODE, this);
try {
// acc off 之后会出现进程还在,但是页面被杀的情况,这个直接杀掉进程,然后让整个进程重启
Process.killProcess( Process.myPid() );
@@ -110,4 +117,17 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
sendBroadcast( intent );
Logger.d( TAG, "send msg to AI Voice" );
}
@Override
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
if (isTrue) {
FrameLayout.LayoutParams entranceParams = ( ( FrameLayout.LayoutParams ) mEntrance.getLayoutParams() );
entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft_in_vr_mode );
mEntrance.setLayoutParams( entranceParams );
}else{
FrameLayout.LayoutParams entranceParams = ( ( FrameLayout.LayoutParams ) mEntrance.getLayoutParams() );
entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft_out_vr_mode );
mEntrance.setLayoutParams( entranceParams );
}
}
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="module_main_entrance_fragment_container_marginLeft_in_vr_mode" >204px</dimen>
<dimen name="module_main_entrance_fragment_container_marginLeft_out_vr_mode" >800px</dimen>
</resources>

View File

@@ -79,6 +79,7 @@ import java.util.Random;
import static com.mogo.module.common.utils.SPConst.getSPGuideRecord;
import static com.mogo.module.common.utils.SPConst.getSpGuide;
import static com.mogo.module.extensions.ExtensionsModuleConst.TYPE_ENTRANCE;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_BUTTON;
import static com.mogo.module.share.constant.ShareConstants.KEY_CLICK_SHARE_TIME;
import static com.mogo.module.share.constant.ShareConstants.KEY_SERVER_SHOW_DAY_COUNT;
@@ -170,6 +171,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
private boolean toggle = false;
private View mOnlineCarEntrance;
private TextView tvEnterVrMode;
private TextView tvExitVrMode;
private Runnable mLockCarRunnable = new Runnable() {
@Override
@@ -387,6 +390,17 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
MogoApisHandler.getInstance().getApis().getAnalyticsApi().track( "APP_Find_Mogoer", properties );
}
} );
tvEnterVrMode = findViewById(R.id.module_ext_enter_vr_mode);
tvEnterVrMode.setOnClickListener((v)->{
// 进入vr模式
enterVrMode();
});
tvExitVrMode = findViewById(R.id.module_ext_exit_vr_mode);
tvExitVrMode.setOnClickListener((v)->{
// 退出vr模式
exitVrMode();
});
dealWeatherContainer();
@@ -394,6 +408,28 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
debugCrashWarn();
}
private void enterVrMode(){
mApis.getStatusManagerApi().setVrMode(TYPE_ENTRANCE, true);
tvEnterVrMode.setVisibility(View.GONE);
mMove2CurrentLocation.setVisibility(View.GONE);
mUploadRoadCondition.setVisibility(View.GONE);
mWeatherContainer.setVisibility(View.GONE);
mMsgContainer.setVisibility(View.GONE);
tvExitVrMode.setVisibility(View.VISIBLE);
}
private void exitVrMode(){
mApis.getStatusManagerApi().setVrMode(TYPE_ENTRANCE, false);
tvEnterVrMode.setVisibility(View.VISIBLE);
mMove2CurrentLocation.setVisibility(View.VISIBLE);
mUploadRoadCondition.setVisibility(View.VISIBLE);
// mWeatherContainer.setVisibility(View.VISIBLE);
// mMsgContainer.setVisibility(View.VISIBLE);
tvExitVrMode.setVisibility(View.GONE);
}
private void debugCrashWarn(){
thresholdSetContainer = findViewById(R.id.thresholdSetContainer);
topEditC = findViewById(R.id.etTopC);
@@ -649,8 +685,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mMogoNavi = mService.getNavi(getContext());
mAnalytics = mApis.getAnalyticsApi();
mMogoRegisterCenter.registerMogoNaviListener(ExtensionsModuleConst.TYPE_ENTRANCE, this);
mMogoRegisterCenter.registerMogoMapListener(ExtensionsModuleConst.TYPE_ENTRANCE, this);
mMogoRegisterCenter.registerMogoNaviListener(TYPE_ENTRANCE, this);
mMogoRegisterCenter.registerMogoMapListener(TYPE_ENTRANCE, this);
mMogoRegisterCenter.registerMogoAimlessModeListener(TAG, this);
mMogoMarkerManager = mService.getMarkerManager(getContext());
@@ -817,6 +853,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
@Override
public void renderWeatherInfo(String temp, String desc, int iconId) {
if(mApis.getStatusManagerApi().isVrMode()){
return;
}
boolean hidden = false;
if (iconId != 0) {
mWeatherIcon.setImageResource(iconId);
@@ -833,6 +872,9 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
@Override
public void renderMsgInfo(boolean hasMsg, int amount) {
if (mApis.getStatusManagerApi().isVrMode()) {
return;
}
mMsgContainer.setVisibility(hasMsg ? View.VISIBLE : View.GONE);
mMsgCounter.setText(amount > MAX_DISPLAY_MSG_AMOUNT ?
getString(R.string.module_ext_str_dots) : String.valueOf(amount));
@@ -954,8 +996,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
public void onDestroy() {
super.onDestroy();
if (mMogoRegisterCenter != null) {
mMogoRegisterCenter.unregisterMogoNaviListener(ExtensionsModuleConst.TYPE_ENTRANCE);
mMogoRegisterCenter.unregisterMogoMapListener(ExtensionsModuleConst.TYPE_ENTRANCE);
mMogoRegisterCenter.unregisterMogoNaviListener(TYPE_ENTRANCE);
mMogoRegisterCenter.unregisterMogoMapListener(TYPE_ENTRANCE);
mMogoRegisterCenter.unregisterMogoAimlessModeListener(TAG);
}
if (mStatusManager != null) {

View File

@@ -1,5 +1,6 @@
package com.mogo.module.extensions.utils;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
@@ -90,6 +91,7 @@ public class EntranceViewHolder {
View v = wrapper.getView();
v.setLayoutParams(params);
rootViewGroup.addView(v, 0);
// rootViewGroup.setBackgroundColor(Color.WHITE);
}
public void removeBottomLayerView(View view) {

View File

@@ -5,7 +5,7 @@
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<View
android:id="@+id/module_map_id_navi_bg"
android:layout_width="match_parent"
android:layout_width="@dimen/module_ext_navi_info_panel_width"
android:layout_height="@dimen/module_ext_navi_info_panel_height"
android:background="@drawable/module_ext_dw_navi_info_panel_bkg"
android:focusable="true"

View File

@@ -31,7 +31,7 @@
android:textSize="@dimen/module_ext_north_textSize"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintRight_toRightOf="@+id/module_entrance_id_upload_road_condition"
app:layout_constraintRight_toRightOf="@+id/module_entrance_id_move2_current_location"
app:layout_constraintTop_toBottomOf="@+id/module_map_id_navi_bg"
app:layout_goneMarginTop="@dimen/module_ext_north_goneMarginTop"
tools:visibility="visible" />
@@ -61,13 +61,12 @@
<com.mogo.module.extensions.navi.TopView
android:id="@+id/module_entrance_id_top_container"
android:layout_width="match_parent"
android:layout_width="@dimen/module_ext_top_view_width"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
app:layout_constraintBottom_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
app:layout_constraintLeft_toLeftOf="parent" />
<LinearLayout
android:id="@+id/module_ext_id_display_overview"
@@ -101,6 +100,20 @@
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/module_ext_enter_vr_mode"
android:layout_marginRight="@dimen/module_common_shadow_width_pos"
android:layout_width="@dimen/module_ext_operation_panel_share_width"
android:layout_height="@dimen/module_ext_operation_panel_share_height"
android:background="@drawable/module_ext_dw_upload_road_condition_bkg"
android:text="VR"
android:textSize="@dimen/module_ext_enter_vr_mode_text_size"
android:textColor="#fff"
app:layout_constraintRight_toRightOf="@+id/module_entrance_id_move2_current_location"
app:layout_constraintBottom_toTopOf="@+id/module_entrance_id_move2_current_location"
android:layout_marginBottom="@dimen/module_ext_enter_vr_mode_margin_bottom"
android:gravity="center"/>
<ImageButton
android:id="@+id/module_entrance_id_move2_current_location"
android:layout_width="@dimen/module_ext_operation_panel_width"
@@ -111,40 +124,19 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<FrameLayout
android:id="@+id/module_entrance_id_upload_road_condition"
android:layout_width="@dimen/module_ext_operation_panel_share_width"
android:layout_height="@dimen/module_ext_operation_panel_share_height"
android:layout_marginBottom="@dimen/module_ext_operation_panel_share_marginBottom"
android:layout_marginEnd="@dimen/module_common_shadow_width_pos"
android:background="@drawable/module_ext_dw_upload_road_condition_bkg"
app:layout_constraintBottom_toTopOf="@+id/module_entrance_id_move2_current_location"
app:layout_constraintRight_toRightOf="@+id/module_entrance_id_move2_current_location"
app:layout_goneMarginBottom="@dimen/module_ext_operation_panel_share_goneMarginBottom">
<TextView
android:id="@+id/module_ext_exit_vr_mode"
android:layout_width="@dimen/module_ext_operation_panel_width"
android:layout_height="@dimen/module_ext_operation_panel_move2_height"
android:text="退出"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:visibility="gone"
android:background="@drawable/module_ext_shadow_bkg"
android:textSize="@dimen/module_ext_exit_vr_mode_text_size"
android:textColor="#fff"
android:gravity="center" />
<TextView
android:id="@+id/module_entrance_id_upload"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/module_map_str_upload_road_condition"
android:textColor="#FFFFFF"
android:textSize="@dimen/module_ext_operation_panel_share_textSize"
android:textStyle="bold"
tools:visibility="gone" />
<ImageView
android:id="@+id/module_entrance_id_uploading"
android:layout_width="@dimen/module_entrance_id_uploading_width"
android:layout_height="@dimen/module_entrance_id_uploading_height"
android:layout_gravity="center"
android:gravity="center"
android:scaleType="fitCenter"
android:src="@drawable/module_ext_ic_uploading_00010"
android:textColor="#FFFFFF"
android:visibility="gone"
tools:visibility="visible" />
</FrameLayout>
<LinearLayout
android:id="@+id/module_entrance_id_buttons_container"
@@ -196,6 +188,36 @@
android:textStyle="bold"
android:visibility="gone"
tools:visibility="visible" />
<FrameLayout
android:id="@+id/module_entrance_id_upload_road_condition"
android:layout_marginTop="@dimen/module_entrance_id_button_marginTop"
android:layout_width="@dimen/module_ext_operation_panel_share_width"
android:layout_height="@dimen/module_ext_operation_panel_share_height"
android:background="@drawable/module_ext_dw_upload_road_condition_bkg">
<TextView
android:id="@+id/module_entrance_id_upload"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/module_map_str_upload_road_condition"
android:textColor="#FFFFFF"
android:textSize="@dimen/module_ext_operation_panel_share_textSize"
android:textStyle="bold"
tools:visibility="gone" />
<ImageView
android:id="@+id/module_entrance_id_uploading"
android:layout_width="@dimen/module_entrance_id_uploading_width"
android:layout_height="@dimen/module_entrance_id_uploading_height"
android:layout_gravity="center"
android:gravity="center"
android:scaleType="fitCenter"
android:src="@drawable/module_ext_ic_uploading_00010"
android:textColor="#FFFFFF"
android:visibility="gone"
tools:visibility="visible" />
</FrameLayout>
</LinearLayout>
@@ -268,6 +290,7 @@
android:visibility="gone"
app:constraint_referenced_ids="btnShowDrawableTipNoSize,btnShowDrawableTip,btnShowTextTip,btnDebugCtrlNaviView,btnDebugCtrlSubView,btnDebugCtrlTopView,btnDebugAddBottomLayerView" />
<include layout="@layout/module_ext_layout_crash_threshold_set" />
<include layout="@layout/module_ext_layout_crash_threshold_set"
android:visibility="gone"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -78,7 +78,8 @@
<dimen name="module_ext_user_img_height">103px</dimen>
<!-- module_map_layout_navi_info_panel.xml-->
<dimen name="module_ext_navi_info_panel_width">1058px</dimen>
<dimen name="module_ext_top_view_width">1058px</dimen>
<dimen name="module_ext_navi_info_panel_width">1038px</dimen>
<dimen name="module_ext_navi_info_panel_height">210px</dimen>
<dimen name="module_ext_navi_info_panel_small_height">144px</dimen>
<dimen name="module_ext_navi_info_panel_turn_icon_width">159px</dimen>
@@ -145,7 +146,7 @@
<dimen name="module_ext_display_overview_icon_marginTop">20px</dimen>
<dimen name="module_ext_top_over_navi_height">34px</dimen>
<dimen name="module_ext_notice_margin_start">161px</dimen>
<dimen name="module_ext_notice_margin_start">10px</dimen>
<dimen name="module_ext_weather_margin_start">10px</dimen>
<dimen name="module_ext_msg_counter_margin">45px</dimen>
<dimen name="module_ext_user_avator_size">120px</dimen>

View File

@@ -83,6 +83,7 @@
<dimen name="module_ext_user_img_height">56px</dimen>
<!-- module_map_layout_navi_info_panel.xml-->
<dimen name="module_ext_top_view_width">1058px</dimen>
<dimen name="module_ext_navi_info_panel_width">544px</dimen>
<dimen name="module_ext_navi_info_panel_height">117px</dimen>
<dimen name="module_ext_navi_info_panel_small_height">80px</dimen>
@@ -162,4 +163,8 @@
<dimen name="module_ext_destination_online_car_paddingRight">14px</dimen>
<dimen name="module_common_shadow_width_pos">8px</dimen>
<dimen name="module_ext_enter_vr_mode_text_size">44px</dimen>
<dimen name="module_ext_exit_vr_mode_text_size">30px</dimen>
<dimen name="module_ext_exit_vr_mode_width">120px</dimen>
<dimen name="module_ext_enter_vr_mode_margin_bottom">170px</dimen>
</resources>

View File

@@ -26,6 +26,6 @@
<dimen name="module_main_entrance_fragment_container_padding_top">16px</dimen>
<dimen name="module_main_entrance_fragment_container_width">658px</dimen>
<dimen name="module_event_fragment_container_padding">8px</dimen>
<dimen name="module_main_apps_fragment_container_paddingTop">2px</dimen>
<dimen name="module_main_apps_fragment_container_paddingTop">8px</dimen>
</resources>

View File

@@ -9,6 +9,7 @@ import android.widget.SeekBar.OnSeekBarChangeListener
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.voice.AIAssist
import com.mogo.map.uicontroller.EnumMapUI
import com.mogo.module.common.MogoApisHandler
import com.mogo.module.navi.R
import com.mogo.module.navi.bean.SearchPoi
import com.mogo.module.navi.constants.DataConstants
@@ -232,7 +233,11 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
tb_custom_map.isChecked = DebugConfig.isUseCustomMap()
tb_custom_map.setOnCheckedChangeListener{ _, isChecked ->
TipToast.shortTip("设置完成,下次启动生效")
SharedPrefsMgr.getInstance(context!!).putBoolean("useCustomMap", isChecked)
if (isChecked) {
MogoApisHandler.getInstance().apis.mapFrameControllerApi.changeToVRMode()
} else {
MogoApisHandler.getInstance().apis.mapFrameControllerApi.changeTo2dMode()
}
}
tb_navi.isChecked = SettingManager.isMonitor()
tb_gps.isChecked = SettingManager.isGpsSimulator()

View File

@@ -6,7 +6,6 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.location.Location;
import android.net.ConnectivityManager;
import android.net.wifi.WifiManager;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
@@ -20,6 +19,7 @@ import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.network.ParamsProvider;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.commons.storage.SpStorage;
import com.mogo.commons.utils.MortonCode;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
import com.mogo.map.IDestroyable;
@@ -53,9 +53,9 @@ import com.mogo.module.service.refresh.AutoRefreshStrategy;
import com.mogo.module.service.refresh.CustomRefreshStrategy;
import com.mogo.module.service.refresh.RefreshObject;
import com.mogo.module.service.strategy.CarIconDisplayStrategy;
import com.mogo.module.service.websocket.LocationResult;
import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.cardmanager.IMogoCardManager;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.service.adas.entity.ADASRecognizedResult;
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
import com.mogo.service.intent.IMogoIntentListener;
@@ -105,6 +105,7 @@ public class MogoServices implements IMogoMapListener,
IDestroyable {
private boolean mInternalUnWakeupRegisterStatus = false;
private Location mLastCarLocation;
private MogoServices() {
// private constructor
@@ -426,6 +427,8 @@ public class MogoServices implements IMogoMapListener,
}
AutoPilotRemoteController.getInstance().start();
mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER, 0 );
}
private void initLocationServiceProcess( Context context ) {
@@ -440,6 +443,23 @@ public class MogoServices implements IMogoMapListener,
}
}
private void startSendCarLocationAndAdasRecognizedResult2Server() {
Location lastCarLocation = mLastCarLocation;
if ( lastCarLocation != null ) {
LocationResult locationResult = new LocationResult();
locationResult.alt = lastCarLocation.getAltitude();
locationResult.heading = lastCarLocation.getBearing();
locationResult.lat = lastCarLocation.getLatitude();
locationResult.lon = lastCarLocation.getLongitude();
locationResult.satelliteTime = lastCarLocation.getTime();
locationResult.systemTime = System.currentTimeMillis();
locationResult.speed = lastCarLocation.getSpeed();
locationResult.mortonCode = MortonCode.wrapEncodeMorton( locationResult.lon, locationResult.lat );
}
List< ADASRecognizedResult > recognizedResults = MarkerServiceHandler.getADASController().getLastADASRecognizedResult();
}
private void initWorkThread() {
mThreadHandler = new Handler( WorkThreadHandler.getInstance().getLooper() ) {
@Override
@@ -473,6 +493,9 @@ public class MogoServices implements IMogoMapListener,
}
mStatusManager.setUserInteractionStatus( TAG, true, false );
mUiController.recoverLockMode();
} else if ( msg.what == ServiceConst.MSG_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER ) {
startSendCarLocationAndAdasRecognizedResult2Server();
mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER, ServiceConst.INTERVAL_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER );
}
}
};
@@ -748,6 +771,7 @@ public class MogoServices implements IMogoMapListener,
if ( latLng == null ) {
return;
}
mLastCarLocation = latLng;
// poi 定位无法获取时,使用该定位
if ( mLastAutoRefreshLocation == null ) {
MogoLatLng point = new MogoLatLng( latLng.getLatitude(), latLng.getLongitude() );

View File

@@ -218,4 +218,14 @@ public class ServiceConst {
*/
public static final long INTERVAL_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH = 60 * 1_000L;
/**
* 发送自车位置和adas识别结果给服务端
*/
public static final int MSG_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER = 0x401;
/**
* 间隔 1s 发送一次
*/
public static final long INTERVAL_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER = 1 * 1_000L;
}

View File

@@ -0,0 +1,139 @@
package com.mogo.module.service.utils;
import java.util.Arrays;
/**
* 莫顿编码
*
* @author linyang
* @since 2020.07.09
*/
public class MortonCode {
/**
* morton 转 经纬度 时的中间常量
*/
private static final long NDS_180_DEGREES = 0x7fffffff;
/**
* morton 转 经纬度 时的中间常量
*/
private static final long NDS_360_DEGREES = 4294967295L;
/**
* morton 转 经纬度 时的中间常量
*/
private static final long NDS_90_DEGREES = 0x3fffffff;
/**
* 经纬度转 morton 时的中间常量
*/
private static final double RULE_MORTON = Math.pow( 2, 32 ) / 360;
/**
* morton 转 经纬度 时的中间常量
*/
private static final double RULE_MORTON_TO_LONLAT = 360.0 / Math.pow( 2, 32 );
/**
* 编码 morton code
*
* @param lon
* @param lat
* @return
*/
public static long encodeMorton( Double lon, Double lat ) {
Long bit = 1L;
long mortonCode = 0L;
long x = ( long ) ( lon * RULE_MORTON );
long y = ( long ) ( lat * RULE_MORTON );
if ( y < 0 ) {
y += 0x7FFFFFFF;
}
y = y << 1;
for ( int i = 0; i < 32; i++ ) {
// x-part
mortonCode = mortonCode | ( x & bit );
x = x << 1;
bit = bit << 1;
// y-part
mortonCode = mortonCode | ( y & bit );
y = y << 1;
bit = bit << 1;
}
return mortonCode;
}
/**
* 将莫顿码解码为坐标
*
* @param mortonCode
* @return
*/
public static double[] decodeMorton( long mortonCode ) {
long[] midPoint = mortonCodeToCoord( mortonCode );
normalizeCoord( midPoint );
double[] point = new double[2];
// 将经纬度长整数转化为 浮点类型
point[0] = midPoint[0] * RULE_MORTON_TO_LONLAT;
point[1] = midPoint[1] * RULE_MORTON_TO_LONLAT;
return point;
}
/**
* 莫顿码分别拆解为 编码后的经纬度长整数
*
* @param mortonCode
* @return
*/
private static long[] mortonCodeToCoord( long mortonCode ) {
long bit = 1L;
long[] longPoint = new long[2];
for ( int i = 0; i < 32; i++ ) {
longPoint[0] |= mortonCode & bit;
mortonCode >>= 1;
longPoint[1] |= mortonCode & bit;
bit <<= 1;
}
return longPoint;
}
/**
* 对编码后的经纬度长整数进行解码
*
* @param midPoint
*/
private static void normalizeCoord( long[] midPoint ) {
// if x > 180 degrees, then subtract 360 degrees
if ( midPoint[0] > NDS_180_DEGREES ) {
midPoint[0] -=
NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well
} else if ( midPoint[0] < -NDS_180_DEGREES ) // if x < 180 , x += 360
{
midPoint[0] +=
NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well
}
// if y > 90 degrees, then subtract 180 degrees
if ( midPoint[1] > NDS_90_DEGREES ) {
midPoint[1] -=
NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well
} else if ( midPoint[1] < -NDS_90_DEGREES ) // if y < 90, y += 180
{
midPoint[1] +=
NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well
}
return;
}
public static void main( String[] args ) {
System.out.println( encodeMorton( 116.39584, 39.98152 ) );
System.out.println( Arrays.toString( decodeMorton( 1415388919630379091L ) ) );
}
}

View File

@@ -0,0 +1,21 @@
package com.mogo.module.service.websocket;
public
/**
* @author congtaowang
* @since 2020/10/25
*
* 自车定位信息
*/
class LocationResult {
public String sn;
public double lat;
public double lon;
public double heading;
public long systemTime;
public long satelliteTime;
public double alt;
public double speed;
public long mortonCode;
}

View File

@@ -0,0 +1,18 @@
package com.mogo.module.service.websocket;
import com.mogo.service.adas.entity.ADASRecognizedResult;
import java.util.List;
public
/**
* @author congtaowang
* @since 2020/10/25
*
* 一秒一次的上行数据
*/
class OnePerSecondSendContent {
public LocationResult self;
public List< ADASRecognizedResult > adas;
}

View File

@@ -106,6 +106,7 @@ import com.mogo.utils.TipToast;
import com.mogo.utils.WorkThreadHandler;
import com.mogo.utils.logger.Logger;
import com.shuyu.gsyvideoplayer.GSYVideoManager;
import com.shuyu.gsyvideoplayer.utils.GSYVideoType;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
@@ -128,6 +129,7 @@ import static com.mogo.module.tanlu.constant.TanluConstants.PLAY_VIDEO_AWAKEN;
import static com.mogo.module.tanlu.constant.TanluConstants.SPECIFIEDROAD_SEARCH;
import static com.mogo.module.tanlu.constant.TanluConstants.TXZ_SPECIFIEDROAD_SEARCH;
import static com.mogo.module.tanlu.video.VideoInitKt.initVideo;
import static com.shuyu.gsyvideoplayer.utils.GSYVideoType.SCREEN_MATCH_FULL;
/**
* @author lixiaopeng
@@ -205,6 +207,7 @@ public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickL
protected void initViews() {
LayoutInflater.from(mContext).inflate(R.layout.tanlu_main_media_recycler_new, this);
initVideo();
GSYVideoType.setShowType(SCREEN_MATCH_FULL);
mLoopRecyclerView = findViewById(R.id.tanlu_rloop_recycleview);
mLoopRecyclerView.setHasFixedSize(true);
mLoopRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);

View File

@@ -10,7 +10,9 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.fragment.app.Fragment
import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.tabs.TabLayoutMediator
import com.mogo.commons.debug.DebugConfig
import com.mogo.commons.mvp.MvpFragment
import com.mogo.module.common.MogoApisHandler
import com.mogo.module.v2x.R
import com.mogo.module.v2x.V2XConst.MODULE_NAME
import com.mogo.module.v2x.V2XServiceManager
@@ -21,6 +23,8 @@ import com.mogo.module.v2x.view.V2XEventPanelHistoryCountView
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener
import com.mogo.module.v2x.voice.V2XVoiceConstants
import com.mogo.module.v2x.voice.V2XVoiceManager
import com.mogo.service.statusmanager.IMogoStatusChangedListener
import com.mogo.service.statusmanager.StatusDescriptor
import com.mogo.utils.logger.Logger
@@ -29,7 +33,7 @@ import com.mogo.utils.logger.Logger
*
* @author tongchenfei
*/
class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPresenter>() {
class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPresenter>(),IMogoStatusChangedListener {
private val TAG = "EventPanelFragment"
@@ -177,15 +181,32 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
}
}
}
val x = resources.getDimensionPixelSize(if (DebugConfig.isLauncher()) {
R.dimen.module_v2x_event_panel_in_launcher_btn_x
} else {
R.dimen.module_v2x_event_panel_btn_x
})
val y = resources.getDimensionPixelSize(R.dimen.module_v2x_event_panel_btn_y)
V2XServiceManager.getMogoEntranceButtonController()
.addBottomLayerView(mV2XEventPanelHistoryCountView)
.addBottomLayerView(mV2XEventPanelHistoryCountView, x, y)
mV2XEventPanelHistoryCountView?.visibility = if (MogoApisHandler.getInstance().apis.statusManagerApi.isVrMode) {
View.GONE
}else{
View.VISIBLE
}
changeEventCount()
MogoApisHandler.getInstance().apis.statusManagerApi.registerStatusChangedListener(MODULE_NAME, StatusDescriptor.VR_MODE, this)
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onDestroyView() {
MogoApisHandler.getInstance().apis.statusManagerApi.unregisterStatusChangedListener(MODULE_NAME, StatusDescriptor.VR_MODE, this)
mediator?.detach()
// 避免内存泄漏
fragment = null
@@ -239,4 +260,13 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
// mV2XEventPanelHistoryCountView?.changeMsgCount(0)
// }
}
override fun onStatusChanged(descriptor: StatusDescriptor?, isTrue: Boolean) {
if (isTrue) {
// 在vr模式
mV2XEventPanelHistoryCountView?.visibility = View.GONE
}else{
mV2XEventPanelHistoryCountView?.visibility = View.VISIBLE
}
}
}

View File

@@ -22,10 +22,12 @@ import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.alarm.V2XAlarmServer;
import com.mogo.module.v2x.network.V2XRefreshCallback;
import com.mogo.module.v2x.scenario.impl.V2XScenarioManager;
import com.mogo.module.v2x.scenario.scene.obu.V2XObuEventScenario;
import com.mogo.module.v2x.utils.ADASUtils;
import com.mogo.module.v2x.utils.DrivingDirectionUtils;
import com.mogo.module.v2x.utils.LocationUtils;
import com.mogo.module.v2x.utils.MarkerUtils;
import com.mogo.module.v2x.utils.ObuConfig;
import com.mogo.module.v2x.utils.TrackUtils;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
@@ -165,6 +167,10 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
v2XMessageEntity.setShowState(true);
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
}
if (!ObuConfig.useObuLocation) {
// 绿波车速引导刷新划线
V2XObuEventScenario.getInstance().updateLocation(location);
}
}
public MogoLocation getLastCarLocation() {

View File

@@ -99,4 +99,7 @@
<dimen name="module_v2x_event_parking_text_size">19px</dimen>
<!--适配 V2X 弹窗 UI-->
<dimen name="module_v2x_event_panel_btn_x">572px</dimen>
<dimen name="module_v2x_event_panel_in_launcher_btn_x">480px</dimen>
<dimen name="module_v2x_event_panel_btn_y">384px</dimen>
</resources>

View File

@@ -100,4 +100,8 @@
<dimen name="module_v2x_event_parking_text_size">19px</dimen>
<!--适配 V2X 弹窗 UI-->
<dimen name="module_v2x_event_panel_btn_x">574px</dimen>
<dimen name="module_v2x_event_panel_in_launcher_btn_x">480px</dimen>
<dimen name="module_v2x_event_panel_btn_y">384px</dimen>
</resources>

View File

@@ -82,4 +82,6 @@
<dimen name="module_v2x_event_parking_text_size">34px</dimen>
<!--适配 V2X 弹窗 UI-->
<dimen name="module_v2x_event_panel_btn_x">940px</dimen>
<dimen name="module_v2x_event_panel_btn_y">701px</dimen>
</resources>

View File

@@ -98,4 +98,8 @@
<dimen name="module_v2x_event_parking_text_size">34px</dimen>
<!--适配 V2X 弹窗 UI-->
<dimen name="module_v2x_event_panel_btn_x">940px</dimen>
<dimen name="module_v2x_event_panel_in_launcher_btn_x">940px</dimen>
<dimen name="module_v2x_event_panel_btn_y">701px</dimen>
</resources>

View File

@@ -91,4 +91,7 @@
<dimen name="module_v2x_event_parking_text_size">34px</dimen>
<!--适配 V2X 弹窗 UI-->
<dimen name="module_v2x_event_panel_btn_x">574px</dimen>
<dimen name="module_v2x_event_panel_in_launcher_btn_x">480px</dimen>
<dimen name="module_v2x_event_panel_btn_y">384px</dimen>
</resources>

View File

@@ -2,6 +2,9 @@ package com.mogo.service.adas;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.service.adas.entity.ADASRecognizedResult;
import java.util.List;
/**
* @author congtaowang
@@ -79,13 +82,36 @@ public interface IMogoADASController extends IProvider {
/**
* 添加adas数据回调接口
*
* @param callback 回调接口
*/
void addAdasDataCallback(IMogoAdasDataCallback callback);
void addAdasDataCallback( IMogoAdasDataCallback callback );
/**
* 移除adas数据回调接口
*
* @param callback 待移除的callback
*/
void removeAdasDataCallback(IMogoAdasDataCallback callback);
void removeAdasDataCallback( IMogoAdasDataCallback callback );
/**
* 添加adas报警数据回调接口
*
* @param callback 回调接口
*/
void addAdasWarnMessageCallback( IMogoAdasWarnMessageCallback callback );
/**
* 移除adas报警数据回调接口
*
* @param callback 待移除的callback
*/
void removeAdasWarnMessageCallback( IMogoAdasWarnMessageCallback callback );
/**
* 获取 adas 识别列表
*
* @return
*/
List< ADASRecognizedResult > getLastADASRecognizedResult();
}

View File

@@ -0,0 +1,16 @@
package com.mogo.service.adas;
import com.mogo.service.adas.entity.ADASWarnMessage;
/**
* adas 数据回调接口
*
* @author tongchenfei
*/
public interface IMogoAdasWarnMessageCallback {
/**
* adas 数据回调
* @param msg 具体数据
*/
void onReceiveData( ADASWarnMessage msg );
}

View File

@@ -0,0 +1,64 @@
package com.mogo.service.adas;
public
/**
* @author congtaowang
* @since 2020/10/25
*
* 描述
*/
interface MogoADASWarnType {
/**
* 行人报警
*/
int ADAS_WARNING_PERSON = 16;
/**
* 前车起步
*/
int ADAS_WARNING_FRONT_CAR_GO = 17;
/**
* ldw 类型 左侧车道线
*/
int ADAS_WARNING_SENCE_LANE_LEFT_LOST = 18;
/**
* 右侧车道线
*/
int ADAS_WARNING_SENCE_LANE_RIGHT_LOST = 19;
/**
* fcw 类型
*/
int ADAS_WARNING_FRONT_CAR = 20;
/**
* 摩托车碰撞
*/
int ADAS_WARNING_MOTORCYCLE = 23;
/**
* 急刹车
*/
int ADAS_WARNING_QUICK_BRAKE = 30;
/**
* 禁止掉头
*/
int ADAS_WARNING_NOT_U_TURN = 40;
/**
* 禁止左转
*/
int ADAS_WARNING_NOT_LEFT_TURN = 41;
/**
* 禁止右转
*/
int ADAS_WARNING_NOT_RIGHT_TURN = 42;
/**
* 禁止鸣喇叭
*/
int ADAS_WARNING_NOT_VOICE = 43;
/**
* 禁止通行
*/
int ADAS_WARNING_DO_NOT_ENTER = 44;
/**
* 限速
*/
int ADAS_WARNING_LIMIT_SPEED = 45;
}

View File

@@ -0,0 +1,25 @@
package com.mogo.service.adas.entity;
public
/**
* @author congtaowang
* @since 2020/10/25
*
* adas 识别物体参数
*/
class ADASRecognizedResult {
public int type;
public String uuid;
public String color;
public String cardId;
public double lat;
public double lon;
public double heading;
public long systemTime;
public long satelliteTime;
public double alt;
public double speed;
public long mortonCode;
}

View File

@@ -0,0 +1,22 @@
package com.mogo.service.adas.entity;
public
/**
* @author congtaowang
* @since 2020/10/25
*
* 描述
*/
class ADASWarnMessage {
public String content;
public String level;
/**
* 警告消息类型
* <p>
* {@link com.mogo.service.adas.MogoADASWarnType}
*/
public int type;
public String value;
}

View File

@@ -10,6 +10,12 @@ import com.alibaba.android.arouter.facade.template.IProvider;
*/
public interface IMogoStatusManager extends IProvider {
/**
* 是否在vr模式
* @return true - 在vr模式 false - 不在vr模式
*/
boolean isVrMode();
/**
* 小智语音 UI 是否在展示
*
@@ -110,6 +116,13 @@ public interface IMogoStatusManager extends IProvider {
*/
boolean isMainPageLaunched();
/**
* 设置vrMode状态
* @param tag 业务类型
* @param vrMode true - 在vr模式 false 不在vr模式
*/
void setVrMode(String tag, boolean vrMode);
/**
* 设置小智语音UI状态
*

View File

@@ -78,5 +78,9 @@ public enum StatusDescriptor {
/**
* 是否已经进入过主页
*/
MAIN_PAGE_CREATED;
MAIN_PAGE_CREATED,
/**
* 是否已经进入vr模式
*/
VR_MODE
}

View File

@@ -42,7 +42,7 @@ dependencies {
annotationProcessor rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.adasapi
implementation rootProject.ext.dependencies.adasconfigapi
implementation "com.zhidao.support.adas:high:1.1.4.4"
implementation "com.zhidao.support.adas:high:1.1.4.6"
if (Boolean.valueOf(RELEASE)) {
api rootProject.ext.dependencies.mogomap
implementation rootProject.ext.dependencies.mogomapapi

View File

@@ -0,0 +1,77 @@
package com.mogo.service.impl.adas;
import com.mogo.commons.utils.MortonCode;
import com.mogo.service.adas.entity.ADASRecognizedResult;
import com.mogo.service.adas.entity.ADASWarnMessage;
import com.zhidao.support.adas.high.bean.RectInfo;
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
import java.util.ArrayList;
import java.util.List;
public
/**
* @author congtaowang
* @since 2020/10/25
*
* 对象转换类
*/
class AdasObjectUtils {
public static ADASWarnMessage fromAdasObject( WarnMessageInfo info ) {
if ( info == null ) {
return null;
}
ADASWarnMessage warnMessage = new ADASWarnMessage();
warnMessage.content = info.getContent();
warnMessage.level = info.getLevel();
try {
warnMessage.type = Integer.valueOf( info.getType() );
} catch ( NumberFormatException e ) {
return null;
}
warnMessage.value = info.getValue();
return warnMessage;
}
public static List< ADASRecognizedResult > fromAdasObject( RectInfo rectInfo ) {
if ( rectInfo == null
|| rectInfo.getModels() == null
|| rectInfo.getModels().isEmpty() ) {
return null;
}
List< ADASRecognizedResult > recognizedResults = new ArrayList<>();
for ( RectInfo.RectBean model : rectInfo.getModels() ) {
try {
ADASRecognizedResult result = fromAdasObject( model );
if ( result != null ) {
recognizedResults.add( result );
}
} catch ( Exception e ) {
e.printStackTrace();
}
}
return recognizedResults;
}
public static ADASRecognizedResult fromAdasObject( RectInfo.RectBean rectBean ) {
if ( rectBean == null ) {
return null;
}
ADASRecognizedResult result = new ADASRecognizedResult();
result.uuid = rectBean.getUuid();
result.lat = rectBean.getLat();
result.lon = rectBean.getLon();
result.type = Integer.valueOf( rectBean.getType() );
result.heading = rectBean.getHeading();
result.systemTime = Long.valueOf( rectBean.getSystemTime() );
result.satelliteTime = Long.valueOf( rectBean.getSatelliteTime() );
result.alt = rectBean.getAlt();
result.color = rectBean.getColor();
result.speed = rectBean.getSpeed();
result.cardId = rectBean.getCarId();
result.mortonCode = MortonCode.encodeMorton( result.lon, result.lat );
return result;
}
}

View File

@@ -13,7 +13,10 @@ import com.mogo.module.common.utils.CarSeries;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.adas.IMogoAdasDataCallback;
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
import com.mogo.service.adas.entity.ADASRecognizedResult;
import com.mogo.service.adas.entity.ADASWarnMessage;
import com.mogo.service.impl.singleton.SingletonsHolder;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.utils.UiThreadHandler;
@@ -36,7 +39,9 @@ import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import static com.mogo.module.common.utils.SPConst.getSpGuide;
@@ -65,7 +70,18 @@ public class MogoADASController implements IMogoADASController {
private boolean mIsReleased = true;
private List< IMogoAdasDataCallback > mAdasDataCallbackList = new ArrayList<>();
/**
* 获取adas前车距离
*/
private List< IMogoAdasDataCallback > mAdasDataCallbackList = new CopyOnWriteArrayList<>();
/**
* adas 报警数据回调
*/
private List< IMogoAdasWarnMessageCallback > mMogoAdasWarnMessageCallbackList = new CopyOnWriteArrayList<>();
private RectInfo mLastFrameData;
private OnAdasListener mOnAdasListener = new OnAdasListenerAdapter() {
@@ -73,16 +89,35 @@ public class MogoADASController implements IMogoADASController {
public void onRectData( RectInfo rectInfo ) {
// 物体识别返回
Logger.d( TAG, "onRectData = %s", rectInfo.toString() );
mLastFrameData = rectInfo;
}
@Override
public void onWarnMessage( WarnMessageInfo warnMessageInfo ) {
if ( warnMessageInfo == null ) {
return;
}
// 警告消息
Logger.d( TAG, "onWarnMessage = %s", warnMessageInfo.toString() );
if ( mMogoAdasWarnMessageCallbackList.isEmpty() ) {
return;
}
final ADASWarnMessage warnMessage = AdasObjectUtils.fromAdasObject( warnMessageInfo );
if ( warnMessage == null ) {
return;
}
UiThreadHandler.post( () -> {
Iterator< IMogoAdasWarnMessageCallback > iMogoAdasWarnMessageCallbackIterator = mMogoAdasWarnMessageCallbackList.iterator();
while ( iMogoAdasWarnMessageCallbackIterator.hasNext() ) {
IMogoAdasWarnMessageCallback callback = iMogoAdasWarnMessageCallbackIterator.next();
if ( callback != null ) {
callback.onReceiveData( warnMessage );
}
}
} );
}
};
private MyMessageFactory mAdasMessageFactory;
private IAutopolitDataCallBack mAutoPilotDataCallBack = new IAutopolitDataCallBack() {
@Override
@@ -297,11 +332,44 @@ public class MogoADASController implements IMogoADASController {
@Override
public void addAdasDataCallback( IMogoAdasDataCallback callback ) {
if ( callback == null ) {
return;
}
if ( !mAdasDataCallbackList.contains( callback ) ) {
mAdasDataCallbackList.add( callback );
}
}
@Override
public void removeAdasDataCallback( IMogoAdasDataCallback callback ) {
if ( callback == null ) {
return;
}
mAdasDataCallbackList.remove( callback );
}
@Override
public void addAdasWarnMessageCallback( IMogoAdasWarnMessageCallback callback ) {
if ( callback == null ) {
return;
}
if ( !mMogoAdasWarnMessageCallbackList.contains( callback ) ) {
mMogoAdasWarnMessageCallbackList.add( callback );
}
}
@Override
public void removeAdasWarnMessageCallback( IMogoAdasWarnMessageCallback callback ) {
if ( callback == null ) {
return;
}
mMogoAdasWarnMessageCallbackList.remove( callback );
}
@Override
public List< ADASRecognizedResult > getLastADASRecognizedResult() {
RectInfo rectInfo = mLastFrameData;
List< ADASRecognizedResult > recognizedResultList = AdasObjectUtils.fromAdasObject( rectInfo );
return recognizedResultList;
}
}

View File

@@ -49,6 +49,11 @@ public class MogoStatusManager implements IMogoStatusManager {
return get_bool_val( StatusDescriptor.VOICE_UI );
}
@Override
public boolean isVrMode() {
return get_bool_val(StatusDescriptor.VR_MODE);
}
@Override
public boolean isADASShow() {
return get_bool_val( StatusDescriptor.ADAS_UI );
@@ -127,6 +132,11 @@ public class MogoStatusManager implements IMogoStatusManager {
return val == null ? false : val;
}
@Override
public void setVrMode(String tag, boolean vrMode) {
doSetStatus(tag, StatusDescriptor.VR_MODE, vrMode);
}
@Override
public void setVoiceUIShow( String tag, boolean show ) {
doSetStatus( tag, StatusDescriptor.VOICE_UI, show );