Merge branch 'demo/shunyi_vr_map' of http://gitlab.zhidaoauto.com/ecos/yycp-service/Launcher into demo/shunyi_vr_map
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_shell_name"
|
||||
android:largeHeap="true"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme.App"
|
||||
android:resizeableActivity="false"
|
||||
|
||||
@@ -156,8 +156,8 @@ targetSdkVersion : 22,
|
||||
gpssimulatordebug : "com.mogo.module:module-gps-simulator-debug:${MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION}",
|
||||
gpssimulatornoop : "com.mogo.module:module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
|
||||
|
||||
adasapi : "com.zhidao.autopilot.support:adas:1.0.5",
|
||||
adasconfigapi : "com.zhidao.adasconfig:adasconfig:1.1.5",
|
||||
adasapi : "com.zhidao.autopilot.support:adas:1.0.6.2",
|
||||
adasconfigapi : "com.zhidao.adasconfig:adasconfig:1.1.4",
|
||||
|
||||
// 个人中心的SDK
|
||||
personalsdk : "com.zhidaoauto.person.info:data:1.0.1",
|
||||
|
||||
@@ -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 ) );
|
||||
}
|
||||
}
|
||||
@@ -19,11 +19,7 @@ class AMapViewHandler {
|
||||
private static IMogoMapView sMapView;
|
||||
|
||||
public static void createMapView( Context context ) {
|
||||
if ( DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE ) {
|
||||
sMapView = new AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
} else {
|
||||
sMapView = new AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
}
|
||||
sMapView = new AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
}
|
||||
|
||||
public static IMogoMapView getMapView() {
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.location.MogoLocationListenerRegister;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.HashSet;
|
||||
@@ -28,7 +29,6 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
private static final String TAG = "LocationClient";
|
||||
private final Context mContext;
|
||||
|
||||
private Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
|
||||
private MogoLocation mLastLocation;
|
||||
private AMapLocationListener mListener = new InternalLocationListener();
|
||||
|
||||
@@ -76,28 +76,12 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
|
||||
@Override
|
||||
public void addLocationListener( IMogoLocationListener listener ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.add( listener );
|
||||
}
|
||||
}
|
||||
// do not impl.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLocationListener( IMogoLocationListener listener ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.remove( listener );
|
||||
}
|
||||
}
|
||||
// do not impl.
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,10 +99,6 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
@Override
|
||||
public synchronized void destroy() {
|
||||
mIsDestroyed = true;
|
||||
if ( sListeners != null ) {
|
||||
sListeners.clear();
|
||||
}
|
||||
sListeners = null;
|
||||
if ( mClient != null ) {
|
||||
mClient.unRegisterLocationListener( mListener );
|
||||
mClient.stopLocation();
|
||||
@@ -142,8 +122,9 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
}
|
||||
Trace.beginSection( "timer.onLocationChanged" );
|
||||
mLastLocation = ObjectUtils.fromAMap( aMapLocation );
|
||||
synchronized ( sListeners ) {
|
||||
Iterator< IMogoLocationListener > listenerIterator = sListeners.iterator();
|
||||
Set<IMogoLocationListener> listeners = MogoLocationListenerRegister.getInstance().getListeners();
|
||||
synchronized ( listeners ) {
|
||||
Iterator< IMogoLocationListener > listenerIterator = listeners.iterator();
|
||||
while ( listenerIterator.hasNext() ) {
|
||||
listenerIterator.next().onLocationChanged( mLastLocation );
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.mogo.map.navi.IMogoCarLocationChangedListener;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
@@ -64,7 +65,6 @@ public class NaviClient implements IMogoNavi {
|
||||
private boolean mIsRealNavi;
|
||||
|
||||
private Location mCarLocation;
|
||||
private IMogoCarLocationChangedListener2 mCarLocationChangedListener;
|
||||
private LocationSource.OnLocationChangedListener mOnLocationChangedListener;
|
||||
/**
|
||||
* 巡航模式配置状态
|
||||
@@ -249,9 +249,7 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
|
||||
if ( mAMapNaviListener != null ) {
|
||||
mAMapNaviListener.setLineClickInteraction( lineClickInteraction );
|
||||
}
|
||||
// do not impl
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -303,15 +301,16 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
mCarLocationChangedListener = listener;
|
||||
// do not impl.
|
||||
}
|
||||
|
||||
// -- end
|
||||
|
||||
public void syncCarLocation( Location location ) {
|
||||
mCarLocation = location;
|
||||
if ( mCarLocationChangedListener != null ) {
|
||||
mCarLocationChangedListener.onCarLocationChanged2( mCarLocation );
|
||||
mCarLocation = location;
|
||||
if ( MogoCarLocationChangedListenerRegister.getInstance().getListener() != null ) {
|
||||
MogoCarLocationChangedListenerRegister.getInstance().getListener().onCarLocationChanged2( location );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -267,12 +267,6 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
|
||||
if ( mNaviOverlayHelper != null ) {
|
||||
mNaviOverlayHelper.setLineClickInteraction( lineClickInteraction );
|
||||
}
|
||||
}
|
||||
|
||||
public void clearCalculatePaths() {
|
||||
if ( mNaviOverlayHelper != null ) {
|
||||
mNaviOverlayHelper.clearCalculatedOverlay();
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.mogo.map.impl.amap.R;
|
||||
import com.mogo.map.impl.amap.overlay.RouteOverLayWrapper;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoOperationListenerRegister;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -64,7 +65,6 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
|
||||
private int mSelectedPathId;
|
||||
private CalculatePathItem mSelectedCalculatePathItem;
|
||||
private OnCalculatePathItemClickInteraction mLineClickInteraction;
|
||||
|
||||
/**
|
||||
* 起点终点marker
|
||||
@@ -299,8 +299,8 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
if ( mPaths != null && !mPaths.isEmpty() ) {
|
||||
for ( MogoCalculatePath path : mPaths ) {
|
||||
if ( TextUtils.equals( path.getTagId(), polyline.getId() ) ) {
|
||||
if ( mLineClickInteraction != null ) {
|
||||
mLineClickInteraction.onItemClicked( path.getTagId() );
|
||||
if ( MogoOperationListenerRegister.getInstance().getItemClickInteraction() != null ) {
|
||||
MogoOperationListenerRegister.getInstance().getItemClickInteraction().onItemClicked( path.getTagId() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -440,10 +440,6 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
|
||||
mLineClickInteraction = lineClickInteraction;
|
||||
}
|
||||
|
||||
public void setCalculatePathDisplayBounds( Rect bounds ) {
|
||||
if ( bounds != null ) {
|
||||
mBoundRect = bounds;
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -195,7 +196,7 @@ public class AutoNaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
NaviClient.getInstance( mContext ).registerCarLocationChangedListener( listener );
|
||||
//do not impl
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,7 +55,7 @@ dependencies {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-online-11'
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-online-13'
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -203,7 +203,7 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
@Override
|
||||
public void onResume() {
|
||||
if (mMapView != null) {
|
||||
// mMapView.onResume();
|
||||
mMapView.onResume();
|
||||
Logger.d(TAG, "map onResume");
|
||||
}
|
||||
}
|
||||
@@ -211,7 +211,7 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
@Override
|
||||
public void onPause() {
|
||||
if (mMapView != null) {
|
||||
// mMapView.onPause();
|
||||
mMapView.onPause();
|
||||
Logger.d(TAG, "map onPause");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.IMogoMapViewCreator;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
@@ -14,21 +15,22 @@ import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AMapBaseMapView implements IMogoMapViewCreator {
|
||||
public class CustomMapView implements IMogoMapViewCreator {
|
||||
|
||||
private static final String TAG = "AMapBaseMapView";
|
||||
|
||||
private MapAutoView mapAutoView;
|
||||
private static IMogoMapView mapView;
|
||||
|
||||
@Override
|
||||
public IMogoMapView create( Context context ) {
|
||||
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init().setDebugMode( false )
|
||||
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init().setDebugMode( DebugConfig.isDebug() )
|
||||
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
|
||||
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
|
||||
.setZoom( 16 )
|
||||
.setPointToCenter( 0.5f, 0.5f )
|
||||
.setStyleMode( MapParams.MAP_STYLE_NIGHT ) );
|
||||
mapAutoView = new MapAutoView( context );
|
||||
return new AMapViewWrapper( mapAutoView );
|
||||
MapAutoView mapAutoView = new MapAutoView( context );
|
||||
mapView = new AMapViewWrapper( mapAutoView );
|
||||
return mapView;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.location.MogoLocationListenerRegister;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.open.location.LocationClient;
|
||||
import com.zhidaoauto.map.sdk.open.location.LocationListener;
|
||||
@@ -27,7 +28,6 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
|
||||
private static final String TAG = "LocationClient";
|
||||
|
||||
private Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
|
||||
private MogoLocation mLastLocation;
|
||||
private LocationListener mListener = new InternalLocationListener();
|
||||
|
||||
@@ -79,28 +79,12 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
|
||||
@Override
|
||||
public void addLocationListener( IMogoLocationListener listener ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.add( listener );
|
||||
}
|
||||
}
|
||||
// do not impl.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLocationListener( IMogoLocationListener listener ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( listener != null ) {
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.remove( listener );
|
||||
}
|
||||
}
|
||||
// do not impl.
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,10 +99,6 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
@Override
|
||||
public synchronized void destroy() {
|
||||
mIsDestroyed = true;
|
||||
if ( sListeners != null ) {
|
||||
sListeners.clear();
|
||||
}
|
||||
sListeners = null;
|
||||
if ( mClient != null ) {
|
||||
mClient.unRegisterListener( mListener );
|
||||
mClient.destory();
|
||||
@@ -130,7 +110,7 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
private class InternalLocationListener implements LocationListener {
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location) {
|
||||
public void onLocationChanged( @NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
@@ -140,10 +120,11 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
location.getLon() == 0.0D ) {
|
||||
return;
|
||||
}
|
||||
Trace.beginSection("timer.onLocationChanged");
|
||||
Trace.beginSection( "timer.onLocationChanged" );
|
||||
mLastLocation = ObjectUtils.fromLocation( location );
|
||||
synchronized ( sListeners ) {
|
||||
Iterator< IMogoLocationListener > listenerIterator = sListeners.iterator();
|
||||
Set< IMogoLocationListener > listeners = MogoLocationListenerRegister.getInstance().getListeners();
|
||||
synchronized ( listeners ) {
|
||||
Iterator< IMogoLocationListener > listenerIterator = listeners.iterator();
|
||||
while ( listenerIterator.hasNext() ) {
|
||||
listenerIterator.next().onLocationChanged( mLastLocation.clone() );
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
@@ -62,7 +63,6 @@ public class NaviClient implements IMogoNavi {
|
||||
private boolean mIsRealNavi;
|
||||
|
||||
private Location mCarLocation = new Location("GPS");
|
||||
private IMogoCarLocationChangedListener2 mCarLocationChangedListener;
|
||||
/**
|
||||
* 巡航模式配置状态
|
||||
*/
|
||||
@@ -217,9 +217,7 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction lineClickInteraction ) {
|
||||
// if ( mAMapNaviListener != null ) {
|
||||
// mAMapNaviListener.setLineClickInteraction( lineClickInteraction );
|
||||
// }
|
||||
// do not impl.
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -268,15 +266,15 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
mCarLocationChangedListener = listener;
|
||||
// do not impl.
|
||||
}
|
||||
|
||||
// -- end
|
||||
|
||||
public void syncCarLocation( Location location ) {
|
||||
mCarLocation = location;
|
||||
if ( mCarLocationChangedListener != null ) {
|
||||
mCarLocationChangedListener.onCarLocationChanged2( mCarLocation );
|
||||
if ( MogoCarLocationChangedListenerRegister.getInstance().getListener() != null ) {
|
||||
MogoCarLocationChangedListenerRegister.getInstance().getListener().onCarLocationChanged2( location );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,14 +3,10 @@ package com.mogo.map;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -22,7 +18,10 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
|
||||
|
||||
private static final String TAG = "MogoBaseMapView";
|
||||
|
||||
private IMogoMapView mMapView;
|
||||
protected IMogoMapView mMapView;
|
||||
|
||||
protected IMogoMapView mAMapView;
|
||||
protected IMogoMapView mCustomMapView;
|
||||
|
||||
public MogoBaseMapView( Context context ) {
|
||||
this( context, null );
|
||||
@@ -38,27 +37,14 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
|
||||
}
|
||||
|
||||
private void init( Context context ) {
|
||||
mMapView = createMapView( context );
|
||||
if ( mMapView != null ) {
|
||||
final View mapView = mMapView.getMapView();
|
||||
if ( mapView != null ) {
|
||||
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
|
||||
MogoMap.getInstance().init( context, getMap() );
|
||||
} else {
|
||||
Logger.e( TAG, "create MapView instance failed." );
|
||||
}
|
||||
} else {
|
||||
Logger.e( TAG, "create IMogoMapView instance failed." );
|
||||
}
|
||||
addDleMaps();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建地图实例
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
protected abstract IMogoMapView createMapView( Context context );
|
||||
protected abstract void addDleMaps();
|
||||
|
||||
public abstract void display2DMap( boolean invokeCreateAuto, boolean invokeResumeAuto );
|
||||
|
||||
public abstract void displayVRMap( boolean invokeCreateAuto, boolean invokeResumeAuto );
|
||||
|
||||
@Override
|
||||
public void onCreate( Bundle bundle ) {
|
||||
@@ -109,8 +95,4 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IMogoMapView getMapView() {
|
||||
return mMapView;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package com.mogo.map.location;
|
||||
* <p>
|
||||
* 定位接口
|
||||
*/
|
||||
public interface IMogoLocationClient {
|
||||
public interface IMogoLocationClient extends IMogoLocationListenerRegister {
|
||||
|
||||
/**
|
||||
* 开始定位
|
||||
@@ -25,20 +25,6 @@ public interface IMogoLocationClient {
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* 注册定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void addLocationListener( IMogoLocationListener listener );
|
||||
|
||||
/**
|
||||
* 注销定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void removeLocationListener( IMogoLocationListener listener );
|
||||
|
||||
/**
|
||||
* 返回上一次有效定位
|
||||
*
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.map.location;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 地图监听注册管理
|
||||
*/
|
||||
public interface IMogoLocationListenerRegister {
|
||||
|
||||
/**
|
||||
* 注册定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void addLocationListener( IMogoLocationListener listener );
|
||||
|
||||
/**
|
||||
* 注销定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void removeLocationListener( IMogoLocationListener listener );
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.mogo.map.location;
|
||||
|
||||
import java.sql.ClientInfoStatus;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 地图监听注册管理
|
||||
*/
|
||||
public class MogoLocationListenerRegister implements IMogoLocationListenerRegister {
|
||||
|
||||
private static volatile MogoLocationListenerRegister sInstance;
|
||||
|
||||
private MogoLocationListenerRegister() {
|
||||
}
|
||||
|
||||
public static MogoLocationListenerRegister getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoLocationListenerRegister.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoLocationListenerRegister();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
|
||||
|
||||
/**
|
||||
* 注册定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
@Override
|
||||
public void addLocationListener( IMogoLocationListener listener ) {
|
||||
if ( listener == null ) {
|
||||
return;
|
||||
}
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.add( listener );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
@Override
|
||||
public void removeLocationListener( IMogoLocationListener listener ) {
|
||||
if ( listener == null ) {
|
||||
return;
|
||||
}
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.remove( listener );
|
||||
}
|
||||
}
|
||||
|
||||
public Set< IMogoLocationListener > getListeners() {
|
||||
return sListeners;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/23
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
interface IMogoCarLocationChangedListenerRegister {
|
||||
|
||||
/**
|
||||
* 注册车辆位置变化监听,非业务使用
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener );
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
* <p>
|
||||
* 导航操作
|
||||
*/
|
||||
public interface IMogoNavi {
|
||||
public interface IMogoNavi extends IMogoCarLocationChangedListenerRegister, IMogoOperationListenerRegister{
|
||||
|
||||
/**
|
||||
* 开启路径规划并导航
|
||||
@@ -97,12 +97,6 @@ public interface IMogoNavi {
|
||||
*/
|
||||
OnCalculatePathItemClickInteraction getItemClickInteraction();
|
||||
|
||||
|
||||
/**
|
||||
* 设置线条点击回调
|
||||
*/
|
||||
void setLineClickInteraction( OnCalculatePathItemClickInteraction itemClickInteraction );
|
||||
|
||||
/**
|
||||
* 清除规划的路线
|
||||
*/
|
||||
@@ -151,13 +145,6 @@ public interface IMogoNavi {
|
||||
*/
|
||||
Location getCarLocation2();
|
||||
|
||||
/**
|
||||
* 注册车辆位置变化监听,非业务使用
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener );
|
||||
|
||||
/**
|
||||
* 打开巡航模式
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/23
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
interface IMogoOperationListenerRegister {
|
||||
|
||||
/**
|
||||
* 设置线条点击回调
|
||||
*/
|
||||
void setLineClickInteraction( OnCalculatePathItemClickInteraction itemClickInteraction );
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/23
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MogoCarLocationChangedListenerRegister implements IMogoCarLocationChangedListenerRegister {
|
||||
|
||||
private static volatile MogoCarLocationChangedListenerRegister sInstance;
|
||||
private IMogoCarLocationChangedListener2 listener;
|
||||
|
||||
private MogoCarLocationChangedListenerRegister(){}
|
||||
|
||||
public static MogoCarLocationChangedListenerRegister getInstance(){
|
||||
if( sInstance == null ){
|
||||
synchronized( MogoCarLocationChangedListenerRegister.class ) {
|
||||
if( sInstance == null ){
|
||||
sInstance = new MogoCarLocationChangedListenerRegister();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release(){
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册车辆位置变化监听,非业务使用
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public IMogoCarLocationChangedListener2 getListener() {
|
||||
return listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/23
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MogoOperationListenerRegister implements IMogoOperationListenerRegister {
|
||||
|
||||
private static volatile MogoOperationListenerRegister sInstance;
|
||||
private OnCalculatePathItemClickInteraction itemClickInteraction;
|
||||
|
||||
private MogoOperationListenerRegister(){}
|
||||
|
||||
public static MogoOperationListenerRegister getInstance(){
|
||||
if( sInstance == null ){
|
||||
synchronized( MogoOperationListenerRegister.class ) {
|
||||
if( sInstance == null ){
|
||||
sInstance = new MogoOperationListenerRegister();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release(){
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置线条点击回调
|
||||
*/
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction itemClickInteraction ) {
|
||||
this.itemClickInteraction = itemClickInteraction;
|
||||
}
|
||||
|
||||
public OnCalculatePathItemClickInteraction getItemClickInteraction() {
|
||||
return itemClickInteraction;
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,11 @@ package com.mogo.map;
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.impl.amap.location.ALocationClient;
|
||||
import com.mogo.map.listener.MogoHosListenerRegister;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.location.MogoLocationListenerRegister;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -56,16 +58,12 @@ public class MogoLocationClient implements IMogoLocationClient {
|
||||
|
||||
@Override
|
||||
public void addLocationListener( IMogoLocationListener listener ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.addLocationListener( listener );
|
||||
}
|
||||
MogoLocationListenerRegister.getInstance().addLocationListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLocationListener( IMogoLocationListener listener ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.removeLocationListener( listener );
|
||||
}
|
||||
MogoLocationListenerRegister.getInstance().removeLocationListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.opengl.Visibility;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.impl.amap.AMapBaseMapView;
|
||||
import com.mogo.map.impl.amap.location.ALocationClient;
|
||||
import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
import com.mogo.map.impl.amap.search.GeocodeSearchClient;
|
||||
@@ -34,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 );
|
||||
}
|
||||
@@ -43,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 );
|
||||
}
|
||||
@@ -51,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 );
|
||||
}
|
||||
@@ -59,32 +65,13 @@ 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();
|
||||
}
|
||||
return AMapUIController.getInstance();
|
||||
}
|
||||
|
||||
private static IMogoMapView sMapView;
|
||||
|
||||
public static void createMapView( Context context ) {
|
||||
if ( DebugConfig.isUseCustomMap() ) {
|
||||
Logger.d( TAG, "use custom IMogoMapViewCreator" );
|
||||
sMapView = new com.mogo.map.impl.custom.AMapBaseMapView().create( context );
|
||||
} else {
|
||||
sMapView = new AMapBaseMapView().create( context );
|
||||
}
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
sMapView = null;
|
||||
}
|
||||
|
||||
public static IMogoMapView getMapView() {
|
||||
return sMapView;
|
||||
}
|
||||
|
||||
public static IMogoNavi getNaviDelegate( Context context ) {
|
||||
|
||||
if ( DebugConfig.isUseCustomNavi() ) {
|
||||
@@ -92,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 );
|
||||
}
|
||||
@@ -109,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();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -23,6 +24,8 @@ import java.util.List;
|
||||
* 描述
|
||||
*/
|
||||
public class MogoMapUIController implements IMogoMapUIController {
|
||||
|
||||
private static final String TAG = "MogoMapUIController";
|
||||
|
||||
private IMogoMapUIController mDelegate;
|
||||
|
||||
@@ -43,6 +46,10 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void setDelegate( IMogoMapUIController mDelegate ) {
|
||||
this.mDelegate = mDelegate;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
@@ -73,6 +80,7 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
@Override
|
||||
public void changeMapMode(EnumMapUI mode) {
|
||||
if (mDelegate != null) {
|
||||
Logger.d( TAG, "set type: %s", mode.name() );
|
||||
mDelegate.changeMapMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,15 @@ package com.mogo.map;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.map.impl.amap.AMapBaseMapView;
|
||||
import com.mogo.map.impl.amap.uicontroller.AMapUIController;
|
||||
import com.mogo.map.impl.custom.CustomMapView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
@@ -30,15 +36,66 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
|
||||
super( context, attrs, defStyleAttr );
|
||||
}
|
||||
|
||||
private boolean mIsFirstDisplayVRMode = true;
|
||||
|
||||
@Override
|
||||
public IMogoMap getMap() {
|
||||
return super.getMap();
|
||||
protected void addDleMaps() {
|
||||
|
||||
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 IMogoMapView instance failed." );
|
||||
}
|
||||
mMapView = mAMapView;
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IMogoMapView createMapView( Context context ) {
|
||||
MogoMapDelegateFactory.createMapView( context );
|
||||
return MogoMapDelegateFactory.getMapView();
|
||||
public void display2DMap( boolean invokeCreateAuto, boolean invokeResumeAuto ) {
|
||||
MogoMap.getInstance().init( getContext(), mAMapView.getMap() );
|
||||
MogoMapUIController.getInstance().setDelegate( AMapUIController.getInstance() );
|
||||
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
|
||||
mCustomMapView.onPause();
|
||||
mCustomMapView.getMapView().setVisibility( View.GONE );
|
||||
mAMapView.onResume();
|
||||
mAMapView.getMapView().setVisibility( View.VISIBLE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayVRMap( boolean invokeCreateAuto, boolean invokeResumeAuto ) {
|
||||
if ( mIsFirstDisplayVRMode ) {
|
||||
mCustomMapView.onCreate( null );
|
||||
mIsFirstDisplayVRMode = false;
|
||||
}
|
||||
MogoMap.getInstance().init( getContext(), mCustomMapView.getMap() );
|
||||
MogoMapUIController.getInstance().setDelegate( com.mogo.map.impl.custom.uicontroller.AMapUIController.getInstance() );
|
||||
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
|
||||
mCustomMapView.onResume();
|
||||
mCustomMapView.getMapView().setVisibility( View.VISIBLE );
|
||||
mAMapView.onPause();
|
||||
mAMapView.getMapView().setVisibility( View.GONE );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,14 +114,12 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
Logger.d( TAG, "onPause" );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
Logger.d( TAG, "onDestroy" );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,9 +131,4 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapView getMapView() {
|
||||
return super.getMapView();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,9 @@ import com.mogo.map.impl.automap.navi.AutoNaviClient;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoCarLocationChangedListenerRegister;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.navi.MogoOperationListenerRegister;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
import com.mogo.utils.AppUtils;
|
||||
|
||||
@@ -132,9 +134,7 @@ public class MogoNavi implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction itemClickInteraction ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setLineClickInteraction( itemClickInteraction );
|
||||
}
|
||||
MogoOperationListenerRegister.getInstance().setLineClickInteraction( itemClickInteraction );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -193,9 +193,7 @@ public class MogoNavi implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.registerCarLocationChangedListener( listener );
|
||||
}
|
||||
MogoCarLocationChangedListenerRegister.getInstance().registerCarLocationChangedListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.mogo.module.extensions.ExtensionsModuleConst;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.navi.NaviInfoView;
|
||||
import com.mogo.module.extensions.userinfo.UserInfo;
|
||||
import com.mogo.module.extensions.utils.AdasNoticeHelper;
|
||||
import com.mogo.module.extensions.utils.EntranceViewHolder;
|
||||
import com.mogo.module.extensions.utils.TopViewAnimHelper;
|
||||
import com.mogo.module.share.manager.ServiceApisManager;
|
||||
@@ -189,6 +190,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
private IFragmentProvider mMessageHistoryPanelProvider;
|
||||
|
||||
private AdasNoticeHelper adasNoticeHelper = new AdasNoticeHelper();
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_ext_layout_entrance;
|
||||
@@ -198,6 +201,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
protected void initViews() {
|
||||
mApis = MogoApisHandler.getInstance().getApis();
|
||||
|
||||
adasNoticeHelper.init(getContext());
|
||||
|
||||
mEntrancePresenter = new EntrancePresenter(getContext(), this);
|
||||
mMogoFragmentManager = mApis.getFragmentManagerApi();
|
||||
EntranceViewHolder.getInstance().initRootViewGroup(mRootView);
|
||||
@@ -417,9 +422,12 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mMsgContainer.setVisibility(View.GONE);
|
||||
|
||||
tvExitVrMode.setVisibility(View.VISIBLE);
|
||||
|
||||
adasNoticeHelper.enterVrMode();
|
||||
}
|
||||
|
||||
private void exitVrMode(){
|
||||
EntranceViewHolder.getInstance().forceHideNoticeView();
|
||||
mApis.getStatusManagerApi().setVrMode(TYPE_ENTRANCE, false);
|
||||
tvEnterVrMode.setVisibility(View.VISIBLE);
|
||||
mMove2CurrentLocation.setVisibility(View.VISIBLE);
|
||||
@@ -428,6 +436,8 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
// mMsgContainer.setVisibility(View.VISIBLE);
|
||||
|
||||
tvExitVrMode.setVisibility(View.GONE);
|
||||
|
||||
adasNoticeHelper.exitVrMode();
|
||||
}
|
||||
|
||||
private void debugCrashWarn(){
|
||||
|
||||
@@ -39,6 +39,26 @@ public class MogoEntranceButtonControllerImpl implements IMogoEntranceButtonCont
|
||||
EntranceViewHolder.getInstance().removeBottomLayerView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLeftNoticeView(View view) {
|
||||
EntranceViewHolder.getInstance().showLeftNoticeView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideLeftNoticeView(View view) {
|
||||
EntranceViewHolder.getInstance().hideLeftNoticeView(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLeftNoticeByType(int noticeType, int iconRes, String content) {
|
||||
EntranceViewHolder.getInstance().showLeftNoticeByType(noticeType, iconRes, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideLeftNoticeByType(int noticeType) {
|
||||
EntranceViewHolder.getInstance().hideLeftNoticeByType(noticeType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.mogo.module.extensions.utils;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.service.adas.IMogoAdasWarnMessageCallback;
|
||||
import com.mogo.service.adas.MogoADASWarnType;
|
||||
import com.mogo.service.adas.entity.ADASWarnMessage;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
|
||||
/**
|
||||
* vr模式下,adas左侧提示框帮助类
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class AdasNoticeHelper implements IMogoAdasWarnMessageCallback {
|
||||
private Context context;
|
||||
private AdasNoticeReceiver adasReceiver = new AdasNoticeReceiver();
|
||||
|
||||
public void init(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void enterVrMode(){
|
||||
IntentFilter filter = new IntentFilter("com.mogo.launcher.adas.app.biz");
|
||||
context.registerReceiver(adasReceiver, filter);
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasWarnMessageCallback(this);
|
||||
}
|
||||
|
||||
public void exitVrMode(){
|
||||
context.unregisterReceiver(adasReceiver);
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().removeAdasWarnMessageCallback(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceiveData(ADASWarnMessage msg) {
|
||||
// 处理adas识别的时间,主要是行人碰撞预警
|
||||
if (msg.type == MogoADASWarnType.ADAS_WARNING_PERSON) {
|
||||
MogoApisHandler.getInstance().getApis().getEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_PEOPLE_WARN, R.drawable.module_ext_people_warn, "前方注意行人");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收智慧驾驶发给adas的展示信息,代替adas做界面展示
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
private class AdasNoticeReceiver extends BroadcastReceiver{
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
// todo 处理发给adas的事件, 主要处理逆向超车和obu行人碰撞
|
||||
String id = intent.getStringExtra("v2x_warning_type");
|
||||
if (id != null) {
|
||||
if ("100003".equals(id)) {// 行人碰撞
|
||||
MogoApisHandler.getInstance().getApis().getEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_PEOPLE_WARN, R.drawable.module_ext_people_warn, "前方注意行人");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private View generateNoticeView(int iconRes, String content) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.item_vr_left_notice, null);
|
||||
ImageView icon = view.findViewById(R.id.module_ext_iv_left_notice_icon);
|
||||
icon.setImageResource(iconRes);
|
||||
TextView tvContent = view.findViewById(R.id.module_ext_vr_mode_left_notice_container);
|
||||
tvContent.setText(content);
|
||||
return view;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,15 @@
|
||||
package com.mogo.module.extensions.utils;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.bean.BottomLayerViewWrapper;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -12,6 +17,8 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.service.entrance.IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP;
|
||||
|
||||
/**
|
||||
* 入口页view管理
|
||||
* @author tongchenfei
|
||||
@@ -19,6 +26,9 @@ import java.util.List;
|
||||
public class EntranceViewHolder {
|
||||
private static final String TAG = "EntranceViewHolder";
|
||||
private List<BottomLayerViewWrapper> preAddView = new ArrayList<>();
|
||||
|
||||
private View preAddLeftNoticeView = null;
|
||||
|
||||
private EntranceViewHolder(){}
|
||||
private volatile static EntranceViewHolder instance = null;
|
||||
public static EntranceViewHolder getInstance(){
|
||||
@@ -32,11 +42,15 @@ public class EntranceViewHolder {
|
||||
return instance;
|
||||
}
|
||||
private ViewGroup rootViewGroup = null;
|
||||
private ViewGroup leftNoticeContainer = null;
|
||||
|
||||
public void initRootViewGroup(View rootView) {
|
||||
Logger.i(TAG, "initRootViewGroup==");
|
||||
if(rootView instanceof ViewGroup) {
|
||||
Logger.d(TAG, "initRootViewGroup 赋值");
|
||||
rootViewGroup = (ViewGroup) rootView.getParent();
|
||||
leftNoticeContainer =
|
||||
rootView.findViewById(R.id.module_ext_vr_mode_left_notice_container);
|
||||
if (!preAddView.isEmpty()) {
|
||||
Logger.d(TAG, "initRootViewGroup 增加底层view: " + preAddView.size());
|
||||
Iterator<BottomLayerViewWrapper> iterator = preAddView.iterator();
|
||||
@@ -46,6 +60,9 @@ public class EntranceViewHolder {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
if (preAddLeftNoticeView != null) {
|
||||
realShowLeftNoticeView(preAddLeftNoticeView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,6 +124,85 @@ public class EntranceViewHolder {
|
||||
}
|
||||
}
|
||||
|
||||
public void showLeftNoticeView(View view) {
|
||||
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (leftNoticeContainer != null) {
|
||||
realShowLeftNoticeView(view);
|
||||
} else {
|
||||
preAddLeftNoticeView = view;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void hideLeftNoticeView(View view) {
|
||||
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (preAddLeftNoticeView != null && preAddLeftNoticeView == view) {
|
||||
preAddLeftNoticeView = null;
|
||||
}
|
||||
if (leftNoticeContainer != null) {
|
||||
realHideLeftNoticeView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void forceHideNoticeView(){
|
||||
preAddLeftNoticeView = null;
|
||||
currentShowNoticeType = 0;
|
||||
if (leftNoticeContainer != null) {
|
||||
leftNoticeContainer.removeAllViews();
|
||||
}
|
||||
}
|
||||
|
||||
private int currentShowNoticeType = 0;
|
||||
public void showLeftNoticeByType(int noticeType, int iconRes, String content){
|
||||
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
currentShowNoticeType = noticeType;
|
||||
if (leftNoticeContainer != null) {
|
||||
realShowLeftNoticeView(generateNoticeViewByType(noticeType, iconRes, content));
|
||||
} else {
|
||||
preAddLeftNoticeView = generateNoticeViewByType(noticeType, iconRes, content);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void hideLeftNoticeByType(int noticeType) {
|
||||
if(MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
if (currentShowNoticeType == noticeType) {
|
||||
forceHideNoticeView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private View generateNoticeViewByType(int noticeType,int iconRes, String content) {
|
||||
View view =
|
||||
LayoutInflater.from(leftNoticeContainer.getContext()).inflate(R.layout.item_vr_left_notice, leftNoticeContainer, false);
|
||||
ImageView icon = view.findViewById(R.id.module_ext_iv_left_notice_icon);
|
||||
if (noticeType == NOTICE_TYPE_SEEK_HELP) {
|
||||
// 自车求助,是橘色的背景
|
||||
icon.setBackgroundResource(R.drawable.module_ext_left_notice_icon_orange_bg);
|
||||
}else{
|
||||
// 其他是红色背景
|
||||
icon.setBackgroundResource(R.drawable.module_ext_left_notice_icon_red_bg);
|
||||
}
|
||||
icon.setImageResource(iconRes);
|
||||
TextView tvContent = view.findViewById(R.id.module_ext_tv_left_notice_content);
|
||||
tvContent.setText(content);
|
||||
return view;
|
||||
}
|
||||
|
||||
private void realShowLeftNoticeView(View view){
|
||||
leftNoticeContainer.setVisibility(View.VISIBLE);
|
||||
leftNoticeContainer.removeAllViews();
|
||||
leftNoticeContainer.addView(view);
|
||||
preAddLeftNoticeView = null;
|
||||
}
|
||||
|
||||
private void realHideLeftNoticeView(View view) {
|
||||
leftNoticeContainer.removeView(view);
|
||||
leftNoticeContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void release(){
|
||||
rootViewGroup = null;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:startColor="#303A51"
|
||||
android:endColor="#4B5974"
|
||||
android:angle="0"/>
|
||||
|
||||
<padding
|
||||
android:top="@dimen/module_ext_vr_mode_left_notice_content_padding_top"
|
||||
android:bottom="@dimen/module_ext_vr_mode_left_notice_content_padding_top"
|
||||
android:left="@dimen/module_ext_vr_mode_left_notice_content_padding_left"
|
||||
android:right="@dimen/module_ext_vr_mode_left_notice_content_padding_left" />
|
||||
|
||||
<corners
|
||||
android:topRightRadius="@dimen/module_ext_common_corner"
|
||||
android:bottomRightRadius="@dimen/module_ext_common_corner" />
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<size
|
||||
android:width="@dimen/module_ext_vr_mode_left_notice_icon_width"
|
||||
android:height="@dimen/module_ext_vr_mode_left_notice_height" />
|
||||
|
||||
<gradient
|
||||
android:startColor="#FA8F36"
|
||||
android:endColor="#DB6B28"
|
||||
android:angle="0"/>
|
||||
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/module_ext_common_corner"
|
||||
android:bottomLeftRadius="@dimen/module_ext_common_corner" />
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<size
|
||||
android:width="@dimen/module_ext_vr_mode_left_notice_icon_width"
|
||||
android:height="@dimen/module_ext_vr_mode_left_notice_height" />
|
||||
|
||||
<gradient
|
||||
android:startColor="#ff4944"
|
||||
android:endColor="#c23632"
|
||||
android:angle="0"/>
|
||||
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/module_ext_common_corner"
|
||||
android:bottomLeftRadius="@dimen/module_ext_common_corner" />
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="@dimen/module_common_shadow_width_pos">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/module_ext_vr_mode_left_notice_icon_width"
|
||||
android:layout_height="@dimen/module_ext_vr_mode_left_notice_height"
|
||||
android:id="@+id/module_ext_iv_left_notice_icon"
|
||||
android:src="@drawable/module_ext_accident_warn"
|
||||
android:background="@drawable/module_ext_left_notice_icon_red_bg"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_ext_tv_left_notice_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/module_ext_vr_mode_left_notice_height"
|
||||
android:text="应急车辆优先通行"
|
||||
android:textSize="@dimen/module_ext_vr_mode_left_notice_content_text_size"
|
||||
android:textColor="@color/module_ext_vr_mode_left_notice_content_text_color"
|
||||
android:background="@drawable/module_ext_left_notice_content_bg"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -137,16 +137,23 @@
|
||||
android:textColor="#fff"
|
||||
android:gravity="center" />
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/module_ext_vr_mode_left_notice_container"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:visibility="gone"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/module_entrance_id_buttons_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginLeft="@dimen/module_common_shadow_width_pos"
|
||||
android:layout_marginLeft="@dimen/module_ext_vr_mode_left_feature_margin_left"
|
||||
app:layout_goneMarginLeft="@dimen/module_common_shadow_width_pos"
|
||||
android:layout_marginBottom="@dimen/module_common_shadow_width_pos"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent">
|
||||
app:layout_constraintLeft_toRightOf="@+id/module_ext_vr_mode_left_notice_container">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_entrance_id_button1"
|
||||
|
||||
@@ -3,4 +3,6 @@
|
||||
<color name="module_ext_color_voice_text">#FFFFFF</color>
|
||||
<color name="module_ext_weather_bkg_color">#BF30334C</color>
|
||||
<color name="module_ext_weather_text_color">#fff</color>
|
||||
<color name="module_ext_vr_mode_left_notice_content_text_color">#f1f1f1</color>
|
||||
|
||||
</resources>
|
||||
@@ -167,4 +167,13 @@
|
||||
<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>
|
||||
|
||||
<dimen name="module_ext_vr_mode_left_notice_width">460px</dimen>
|
||||
<dimen name="module_ext_vr_mode_left_notice_icon_width">120px</dimen>
|
||||
<dimen name="module_ext_vr_mode_left_notice_height">120px</dimen>
|
||||
|
||||
<dimen name="module_ext_vr_mode_left_notice_content_text_size">40px</dimen>
|
||||
<dimen name="module_ext_vr_mode_left_notice_content_padding_top">32px</dimen>
|
||||
<dimen name="module_ext_vr_mode_left_notice_content_padding_left">40px</dimen>
|
||||
<dimen name="module_ext_vr_mode_left_feature_margin_left">50px</dimen>
|
||||
</resources>
|
||||
@@ -157,8 +157,14 @@ public class EventDispatchCenter implements
|
||||
this.mMapLoadedCallback = callback;
|
||||
}
|
||||
|
||||
private boolean mIsMapLoaded = false;
|
||||
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
if ( mIsMapLoaded ) {
|
||||
return;
|
||||
}
|
||||
mIsMapLoaded = true;
|
||||
if ( mMapLoadedCallback != null ) {
|
||||
mMapLoadedCallback.run();
|
||||
mMapLoadedCallback = null;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -12,7 +13,9 @@ import com.mogo.map.IMogoUiSettings;
|
||||
import com.mogo.map.MogoMapView;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapFrameController;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
@@ -24,7 +27,7 @@ import com.mogo.utils.logger.Logger;
|
||||
* <p>
|
||||
* 地图图层,地图操作都在这个图层完成
|
||||
*/
|
||||
public class MapFragment extends MvpFragment< MapView, MapPresenter > implements MapView {
|
||||
public class MapFragment extends MvpFragment< MapView, MapPresenter > implements MapView, IMogoMapFrameController {
|
||||
|
||||
private static final String TAG = "MapFragment";
|
||||
|
||||
@@ -33,6 +36,8 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
|
||||
private boolean mIsControllerByOthersStatus = false;
|
||||
|
||||
private boolean mIsFirstLoadCustomMap = true;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_map_fragment_map;
|
||||
@@ -40,6 +45,30 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().initDelegate( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initDelegate( IMogoMapFrameController controller ) {
|
||||
// do not implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeTo2dMode() {
|
||||
mMogoMapView.display2DMap( false, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeToVRMode() {
|
||||
mMogoMapView.displayVRMap( mIsFirstLoadCustomMap, true );
|
||||
if ( mIsFirstLoadCustomMap ) {
|
||||
mIsFirstLoadCustomMap = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
// do not implement
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,8 +77,10 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
mMogoMapView = findViewById( R.id.module_map_id_map );
|
||||
mMogoMapView.onCreate( savedInstanceState );
|
||||
mMogoMap = mMogoMapView.getMap();
|
||||
mMogoMap.getUIController().showMyLocation( true );
|
||||
mMogoMap.getUIController().recoverLockMode();// 启动锁车
|
||||
if ( mMogoMap.getUIController() != null ) {
|
||||
mMogoMap.getUIController().showMyLocation( true );
|
||||
mMogoMap.getUIController().recoverLockMode();// 启动锁车
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -129,11 +160,18 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
uiSettings.setZoomControlsEnabled( false );
|
||||
//设置双指缩放手势是否可用。
|
||||
uiSettings.setZoomGesturesEnabled( true );
|
||||
mMogoMap.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
if ( mMogoMap.getUIController() != null ) {
|
||||
mMogoMap.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapUIController getUIController() {
|
||||
return mMogoMap.getUIController();
|
||||
@@ -146,5 +184,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
mMogoMapView.onDestroy();
|
||||
}
|
||||
MapBroadCastHelper.getInstance( getContext() ).release();
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.google.gson.internal.$Gson$Preconditions;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapFrameController;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/23
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
|
||||
@Route( path = MogoServicePaths.PATH_MAP_FRAME_CONTROLLER )
|
||||
class MapFrameController implements IMogoMapFrameController {
|
||||
|
||||
private IMogoMapFrameController mController;
|
||||
|
||||
@Override
|
||||
public void initDelegate( IMogoMapFrameController controller ) {
|
||||
mController = controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeTo2dMode() {
|
||||
if ( mController != null ) {
|
||||
mController.changeTo2dMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeToVRMode() {
|
||||
if ( mController != null ) {
|
||||
mController.changeToVRMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
mController = null;
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
|
||||
@@ -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() );
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.service.autopilot;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.adas.RemoteControlAutoPilotParameters;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -22,21 +23,21 @@ class AutoPilotRemoteController {
|
||||
|
||||
private IMogoSocketManager mMogoSocketManager;
|
||||
|
||||
private IMogoOnMessageListener< AutoPilotParameters > mParametersListener = new IMogoOnMessageListener< AutoPilotParameters >() {
|
||||
private IMogoOnMessageListener< RemoteControlAutoPilotParameters > mParametersListener = new IMogoOnMessageListener< RemoteControlAutoPilotParameters >() {
|
||||
@Override
|
||||
public Class< AutoPilotParameters > target() {
|
||||
return AutoPilotParameters.class;
|
||||
public Class< RemoteControlAutoPilotParameters > target() {
|
||||
return RemoteControlAutoPilotParameters.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( AutoPilotParameters obj ) {
|
||||
public void onMsgReceived( RemoteControlAutoPilotParameters obj ) {
|
||||
if ( obj == null ) {
|
||||
Logger.e( TAG, "远端控制参数为null", new NullPointerException() );
|
||||
return;
|
||||
}
|
||||
String json = GsonUtil.jsonFromObject( obj );
|
||||
Logger.d( TAG, json );
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData( json );
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData( obj );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.mogo.map.search.geo.IMogoGeoSearchListener;
|
||||
import com.mogo.map.search.geo.MogoGeocodeResult;
|
||||
import com.mogo.map.search.geo.MogoRegeocodeResult;
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.dialog.WMDialog;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.MogoServiceProvider;
|
||||
@@ -357,6 +358,14 @@ public class MockIntentHandler implements IntentHandler {
|
||||
case 33:
|
||||
AIAssist.getInstance( context ).speakTTSVoice( "庞帆说这个是一个 hard coding." );
|
||||
break;
|
||||
case 34:
|
||||
int type = intent.getIntExtra( "type", 0 );
|
||||
if ( type != 0 ) {
|
||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeToVRMode();
|
||||
} else {
|
||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeTo2dMode();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 ) ) );
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -7,10 +7,11 @@ import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.util.ArrayMap;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XObuEventEntity;
|
||||
@@ -21,6 +22,7 @@ import com.mogo.module.v2x.utils.ADASUtils;
|
||||
import com.mogo.module.v2x.utils.DrivingDirectionUtils;
|
||||
import com.mogo.module.v2x.utils.ObuConfig;
|
||||
import com.mogo.module.v2x.utils.TestOnLineCarUtils;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.mogo.module.obu.ObuConstant;
|
||||
import com.zhidao.mogo.module.obu.ObuManager;
|
||||
@@ -33,8 +35,6 @@ import org.json.JSONObject;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
import static com.mogo.module.v2x.scenario.scene.obu.V2XObuEventScenario.ACTION_LAUNCHER_ADAS_APP_BIZ;
|
||||
@@ -211,6 +211,7 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
urgencyEvent.setDesc(V2XObuEventScenario.URGENCY_COLLISION_WARN_TEXT);
|
||||
messageEntity.setContent(urgencyEvent);
|
||||
V2XObuEventScenario.getInstance().init(messageEntity);
|
||||
V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SUDDENLY_BREAK, R.drawable.module_v2x_suddenly_break, "前车急刹,保持车距");
|
||||
break;
|
||||
case ObuConstant.TYPE_ROAD_USER_COLLISION_WARNING:
|
||||
// 行人预警,给adas发送广播即可
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.widget.TextView;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
|
||||
@@ -15,6 +16,7 @@ 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.entrance.ButtonIndex;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -109,6 +111,7 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().setOnActionListener(this::showDialog);
|
||||
getV2XButton().show();
|
||||
V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP, R.drawable.module_v2x_left_notice_seek_help, "正在发起求助...");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -117,6 +120,7 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
|
||||
public void closeButton() {
|
||||
if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) {
|
||||
Logger.d(TAG, "关闭自车求助按钮!");
|
||||
V2XServiceManager.getMogoEntranceButtonController().hideLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP);
|
||||
V2XServiceManager.getMoGoStatusManager().setSeekHelping(TAG, false);
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().close();
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity;
|
||||
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.module.v2x.utils.ADASUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.4 KiB |
@@ -17,6 +17,7 @@ import com.mogo.service.imageloader.IMogoImageloader;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.launcher.IMogoLauncher;
|
||||
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||
import com.mogo.service.map.IMogoMapFrameController;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.service.module.IMogoAddressManager;
|
||||
@@ -245,42 +246,57 @@ public interface IMogoServiceApis extends IProvider {
|
||||
|
||||
/**
|
||||
* 获取授权服务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoAuthManager getAuthManagerApi();
|
||||
|
||||
/**
|
||||
* 获取探路服务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoTanluProvider getTanluApi();
|
||||
|
||||
/**
|
||||
* 获取Monitor相关api
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoMonitorProvider getMogoMonitorApi();
|
||||
|
||||
/**
|
||||
* 获取探路ui服务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoTanluUiProvider getTanluUiApi();
|
||||
|
||||
/**
|
||||
* 皮肤管理接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoSkinSupportInstaller getSkinSupportInstallerApi();
|
||||
|
||||
/**
|
||||
* 获取crashWarnProvider
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoCrashWarnProvider getCrashWarnProvider();
|
||||
|
||||
/**
|
||||
* 在线车辆面板
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoOnlineCarListPanelProvider getOnlineCarPanelApi();
|
||||
|
||||
/**
|
||||
* 地图图层控制接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoMapFrameController getMapFrameControllerApi();
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ public class MogoServicePaths {
|
||||
* 授权服务
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_AGREEMENT = "/agreement/showFragment";
|
||||
public static final String PATH_AGREEMENT = "/agreement/showFragment";
|
||||
|
||||
/**
|
||||
* 日志上传
|
||||
@@ -272,4 +272,9 @@ public class MogoServicePaths {
|
||||
* 在线好友面板
|
||||
*/
|
||||
public static final String PATH_ONLINE_CAR_PANEL = "/onlinecar/panel";
|
||||
|
||||
/**
|
||||
* 自研地图和高德地图切换
|
||||
*/
|
||||
public static final String PATH_MAP_FRAME_CONTROLLER = "/mapframe/controller";
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -72,7 +75,43 @@ public interface IMogoADASController extends IProvider {
|
||||
/**
|
||||
* 给adas传递数据
|
||||
*
|
||||
* @param json
|
||||
* @param result
|
||||
*/
|
||||
void aiCloudToAdasData( String json );
|
||||
void aiCloudToAdasData( RemoteControlAutoPilotParameters result );
|
||||
|
||||
|
||||
/**
|
||||
* 添加adas数据回调接口
|
||||
*
|
||||
* @param callback 回调接口
|
||||
*/
|
||||
void addAdasDataCallback( IMogoAdasDataCallback callback );
|
||||
|
||||
/**
|
||||
* 移除adas数据回调接口
|
||||
*
|
||||
* @param callback 待移除的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();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.service.adas;
|
||||
|
||||
/**
|
||||
* adas 数据回调接口
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface IMogoAdasDataCallback {
|
||||
/**
|
||||
* adas 数据回调
|
||||
* @param msg 具体数据
|
||||
*/
|
||||
void onAdasDataCallback(String msg);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.service.adas;
|
||||
|
||||
/**
|
||||
* adas 物体识别数据回调接口
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public interface IMogoAdasRecognizedDataCallback {
|
||||
/**
|
||||
* adas 数据回调
|
||||
* @param msg 具体数据
|
||||
*/
|
||||
void onAdasDataCallback( String msg );
|
||||
}
|
||||
@@ -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 );
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.service.autopilot;
|
||||
package com.mogo.service.adas;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -9,7 +9,7 @@ public
|
||||
*
|
||||
* 自动驾驶参数
|
||||
*/
|
||||
class AutoPilotParameters {
|
||||
class RemoteControlAutoPilotParameters {
|
||||
|
||||
public AutoPilotLonLat startLatLon;
|
||||
public List< AutoPilotLonLat > wayLatLons;
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -13,6 +13,49 @@ import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
*/
|
||||
public interface IMogoEntranceButtonController extends IProvider {
|
||||
|
||||
/**
|
||||
* 前车急刹
|
||||
*/
|
||||
public static final int NOTICE_TYPE_SUDDENLY_BREAK = 1001;
|
||||
/**
|
||||
* vip变灯通行
|
||||
*/
|
||||
public static final int NOTICE_TYPE_VIP = 1002;
|
||||
/**
|
||||
* 行人碰撞预警
|
||||
*/
|
||||
public static final int NOTICE_TYPE_PEOPLE_WARN = 1003;
|
||||
/**
|
||||
* 逆向超车
|
||||
*/
|
||||
public static final int NOTICE_TYPE_ILLEGAL_OVERTAKE = 1004;
|
||||
/**
|
||||
* 后方危险车辆提醒
|
||||
*/
|
||||
public static final int NOTICE_TYPE_DANGEROUS_CAR_WARN = 1005;
|
||||
/**
|
||||
* 特殊车辆快速通过
|
||||
*/
|
||||
public static final int NOTICE_TYPE_SPECIAL_CAR_WARN = 1006;
|
||||
/**
|
||||
* 自车求助
|
||||
*/
|
||||
public static final int NOTICE_TYPE_SEEK_HELP = 1007;
|
||||
/**
|
||||
* 交通事故识别
|
||||
*/
|
||||
public static final int NOTICE_TYPE_ACCIDENT_WARN = 1008;
|
||||
|
||||
/**
|
||||
* 障碍物体绕行
|
||||
*/
|
||||
public static final int NOTICE_TYPE_OBSTACLE_WARN = 1009;
|
||||
|
||||
/**
|
||||
* 障碍车辆绕行
|
||||
*/
|
||||
public static final int NOTICE_TYPE_OBSTACLE_CAR_WARN = 1010;
|
||||
|
||||
/**
|
||||
* 获取入口按钮实例
|
||||
*
|
||||
@@ -41,4 +84,30 @@ public interface IMogoEntranceButtonController extends IProvider {
|
||||
* @param view 待移除view
|
||||
*/
|
||||
void removeBottomLayerView(View view);
|
||||
|
||||
/**
|
||||
* 设置vr模式下,左下角提示view
|
||||
* @param view 目前是adas提示和求助
|
||||
*/
|
||||
void showLeftNoticeView(View view);
|
||||
|
||||
/**
|
||||
* 隐藏vr模式下,左下角提示view,需要与{@link #showLeftNoticeView(View)}成对使用
|
||||
* @param view 待隐藏view
|
||||
*/
|
||||
void hideLeftNoticeView(View view);
|
||||
|
||||
/**
|
||||
* 根据noticeType添加左侧提示
|
||||
* @param noticeType {@link #NOTICE_TYPE_SUDDENLY_BREAK}...
|
||||
* @param iconRes 本地 icon res
|
||||
* @param content 提示内容
|
||||
*/
|
||||
void showLeftNoticeByType(int noticeType, int iconRes, String content);
|
||||
|
||||
/**
|
||||
* 移除noticeType,需要与{@link #showLeftNoticeByType(int, int, String)}成对使用
|
||||
* @param noticeType {@link #NOTICE_TYPE_SUDDENLY_BREAK}...
|
||||
*/
|
||||
void hideLeftNoticeByType(int noticeType);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.mogo.service.map;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.IDestroyable;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/23
|
||||
*
|
||||
* 地图图层切换:高德地图 <-> 自研地图,过渡期使用
|
||||
*/
|
||||
interface IMogoMapFrameController extends IProvider, IDestroyable {
|
||||
|
||||
void initDelegate( IMogoMapFrameController controller );
|
||||
|
||||
/**
|
||||
* 切换到高德2D
|
||||
*/
|
||||
void changeTo2dMode();
|
||||
|
||||
/**
|
||||
* 切换到自研vr
|
||||
*/
|
||||
void changeToVRMode();
|
||||
}
|
||||
@@ -42,6 +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.6"
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.mogomap
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.mogo.service.impl.singleton.SingletonsHolder;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.launcher.IMogoLauncher;
|
||||
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||
import com.mogo.service.map.IMogoMapFrameController;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.service.module.IMogoAddressManager;
|
||||
@@ -216,32 +217,37 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
|
||||
@Override
|
||||
public IMogoTanluProvider getTanluApi() {
|
||||
return getApiInstance(IMogoTanluProvider.class, MogoServicePaths.PATH_TANLU_API);
|
||||
return getApiInstance( IMogoTanluProvider.class, MogoServicePaths.PATH_TANLU_API );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMonitorProvider getMogoMonitorApi() {
|
||||
return getApiInstance(IMogoMonitorProvider.class,MogoServicePaths.PATH_MOGO_MONITOR);
|
||||
return getApiInstance( IMogoMonitorProvider.class, MogoServicePaths.PATH_MOGO_MONITOR );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoTanluUiProvider getTanluUiApi(){
|
||||
return getApiInstance(IMogoTanluUiProvider.class, MogoServicePaths.PATH_TANLU_UI_API);
|
||||
public IMogoTanluUiProvider getTanluUiApi() {
|
||||
return getApiInstance( IMogoTanluUiProvider.class, MogoServicePaths.PATH_TANLU_UI_API );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoSkinSupportInstaller getSkinSupportInstallerApi() {
|
||||
return getApiInstance( IMogoSkinSupportInstaller.class, SkinSupportInstallerConstants.PATH);
|
||||
return getApiInstance( IMogoSkinSupportInstaller.class, SkinSupportInstallerConstants.PATH );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoCrashWarnProvider getCrashWarnProvider() {
|
||||
return getApiInstance(IMogoCrashWarnProvider.class, MogoServicePaths.PATH_CRASH_WARNING);
|
||||
return getApiInstance( IMogoCrashWarnProvider.class, MogoServicePaths.PATH_CRASH_WARNING );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoOnlineCarListPanelProvider getOnlineCarPanelApi() {
|
||||
return getApiInstance( IMogoOnlineCarListPanelProvider.class, MogoServicePaths.PATH_ONLINE_CAR_PANEL);
|
||||
return getApiInstance( IMogoOnlineCarListPanelProvider.class, MogoServicePaths.PATH_ONLINE_CAR_PANEL );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapFrameController getMapFrameControllerApi() {
|
||||
return getApiInstance( IMogoMapFrameController.class, MogoServicePaths.PATH_MAP_FRAME_CONTROLLER );
|
||||
}
|
||||
|
||||
private static < T extends IProvider > T getApiInstance( Class< T > clazz, String path ) {
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.service.impl.adas;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/22
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class AdasControlCommandParameter {
|
||||
|
||||
public String action;
|
||||
public Object result;
|
||||
|
||||
public AdasControlCommandParameter( String action, Object result ) {
|
||||
this.action = action;
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.mogo.service.impl.adas;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
@@ -13,10 +12,16 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
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;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
import com.zhidao.adasconfig.api.AdasConfigApiController;
|
||||
import com.zhidao.adasconfig.common.config.EnumCarChatIncognitoMode;
|
||||
@@ -24,10 +29,19 @@ import com.zhidao.adasconfig.common.config.EnumCarHeading;
|
||||
import com.zhidao.adasconfig.common.config.EnumSkinStyle;
|
||||
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
import com.zhidao.autopilot.support.api.IAutopilotServiceStatusListener;
|
||||
import com.zhidao.autopilot.support.api.IAutopolitDataCallBack;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
import com.zhidao.support.adas.high.msg.MyMessageFactory;
|
||||
|
||||
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;
|
||||
|
||||
@@ -56,6 +70,80 @@ public class MogoADASController implements IMogoADASController {
|
||||
|
||||
private boolean mIsReleased = true;
|
||||
|
||||
/**
|
||||
* 获取adas前车距离
|
||||
*/
|
||||
private List< IMogoAdasDataCallback > mAdasDataCallbackList = new CopyOnWriteArrayList<>();
|
||||
|
||||
/**
|
||||
* adas 报警数据回调
|
||||
*/
|
||||
private List< IMogoAdasWarnMessageCallback > mMogoAdasWarnMessageCallbackList = new CopyOnWriteArrayList<>();
|
||||
|
||||
|
||||
private RectInfo mLastFrameData;
|
||||
|
||||
private OnAdasListener mOnAdasListener = new OnAdasListenerAdapter() {
|
||||
|
||||
@Override
|
||||
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
|
||||
public void sendMsg( String msg ) {
|
||||
Logger.d( TAG, "收到adas数据回调: " + msg );
|
||||
for ( IMogoAdasDataCallback callback : mAdasDataCallbackList ) {
|
||||
callback.onAdasDataCallback( msg );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cameraEyeDetectResult( String detectResult ) {
|
||||
try {
|
||||
JSONObject jsonObjectWs = new JSONObject( detectResult );
|
||||
String action = jsonObjectWs.optString( "action" );
|
||||
if ( TextUtils.isEmpty( action ) ) {
|
||||
Logger.w( TAG, "--->action is null" );
|
||||
return;
|
||||
}
|
||||
mAdasMessageFactory.createMessage( action ).handlerMsg( GsonUtil.getGson(), mOnAdasListener, detectResult );
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void openADAS() {
|
||||
showADAS();
|
||||
@@ -89,7 +177,7 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
} );
|
||||
invokeShowADASOperation();
|
||||
|
||||
AutopilotServiceManage.getInstance().registerAutopilotDataListener( mAutoPilotDataCallBack );
|
||||
}
|
||||
|
||||
private void invokeShowADASOperation() {
|
||||
@@ -157,6 +245,7 @@ public class MogoADASController implements IMogoADASController {
|
||||
public void init( Context context ) {
|
||||
AutopilotServiceManage.getInstance().init( context );
|
||||
mIsReleased = false;
|
||||
mAdasMessageFactory = new MyMessageFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -212,25 +301,23 @@ public class MogoADASController implements IMogoADASController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void aiCloudToAdasData( String json ) {
|
||||
public void aiCloudToAdasData( RemoteControlAutoPilotParameters result ) {
|
||||
try {
|
||||
syncControlCmdToADAS( "aiCloudToStartAutopilot", json );
|
||||
syncControlCmdToADAS( "aiCloudToStartAutopilot", result );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "notifyAdas" );
|
||||
Logger.e( TAG, e, "aiCloudToAdasData" );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param action 操作执行
|
||||
* @param json 指令数据
|
||||
* @param action
|
||||
* @param result
|
||||
*/
|
||||
private void syncControlCmdToADAS( String action, String json ) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
private void syncControlCmdToADAS( String action, Object result ) {
|
||||
AdasControlCommandParameter parameter = new AdasControlCommandParameter( action, result );
|
||||
//位置信息 action是aiCloudToStartAutopilot
|
||||
try {
|
||||
jsonObject.put( "action", action );
|
||||
jsonObject.put( "result", json );
|
||||
AutopilotServiceManage.getInstance().aiCloudToAdasData( jsonObject.toString() );
|
||||
AutopilotServiceManage.getInstance().aiCloudToAdasData( GsonUtil.jsonFromObject( parameter ) );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -239,6 +326,50 @@ public class MogoADASController implements IMogoADASController {
|
||||
@Override
|
||||
public void release() {
|
||||
mIsReleased = true;
|
||||
AutopilotServiceManage.getInstance().unRegisterAutopilotDataListener( mAutoPilotDataCallBack );
|
||||
AutopilotServiceManage.getInstance().release();
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.mogo.service.impl.adas;
|
||||
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
import com.zhidao.support.adas.high.bean.CarLaneInfo;
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.LightStatueInfo;
|
||||
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/22
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
abstract class OnAdasListenerAdapter implements OnAdasListener {
|
||||
|
||||
@Override
|
||||
public void onWarnMessage( WarnMessageInfo warnMessageInfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVideoSize( int width, int height ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRectData( RectInfo rectInfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarStateData( CarStateInfo carStateInfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLightStateData( LightStatueInfo lightStatueInfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onObstaclesInfo( ObstaclesInfo obstaclesInfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLaneInfo( CarLaneInfo carLaneInfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autopilotStatus( AutopilotStatus autopilotStatus ) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user