[Upload]
删除冗余代码 MoGoEagleEye.modules.mogo-module-map MoGoEagleEye.modules.mogo-module-service MoGoEagleEye.modules.mogo-module-share MoGoEagleEye.services.mogo-service-api Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
1
libraries/map-autonavi/.gitignore
vendored
1
libraries/map-autonavi/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,66 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility 1.8
|
||||
targetCompatibility 1.8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
} else {
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':libraries:mogo-map-api')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':services:mogo-service-api')
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.map
|
||||
POM_ARTIFACT_ID=map-autonavi
|
||||
VERSION_CODE=1
|
||||
21
libraries/map-autonavi/proguard-rules.pro
vendored
21
libraries/map-autonavi/proguard-rules.pro
vendored
@@ -1,21 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -1,13 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.map.impl.automap">
|
||||
|
||||
<application>
|
||||
<receiver
|
||||
android:name=".navi.AutoNaviReceiver"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="AUTONAVI_STANDARD_BROADCAST_SEND" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -1,229 +0,0 @@
|
||||
package com.mogo.map.impl.automap.navi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.MogoNaviConfig;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/2
|
||||
* <p>
|
||||
* 使用高德车机版导航
|
||||
*/
|
||||
public class AutoNaviClient implements IMogoNavi {
|
||||
|
||||
private static final String TAG = "NaviClient";
|
||||
|
||||
public static final String ACTION_AUTO_MAP = "AUTONAVI_STANDARD_BROADCAST_RECV";
|
||||
|
||||
public static final String KEY_TYPE = "KEY_TYPE";
|
||||
public static final String SOURCE_APP = "SOURCE_APP";
|
||||
public static final String LAT = "LAT";
|
||||
public static final String LON = "LON";
|
||||
public static final String ENTRY_LAT = "ENTRY_LAT";
|
||||
public static final String ENTRY_LON = "ENTRY_LON";
|
||||
public static final String DEV = "DEV"; // (int)是否偏移(0:lat 和 lon 是已经加密后的,不需要国测加密; 1:需要国测加密)
|
||||
|
||||
/**
|
||||
* (必填)(int)导航方式
|
||||
* =1(避免收费)
|
||||
* =2(多策略算路)
|
||||
* =3 (不走高速)
|
||||
* =4(躲避拥堵)
|
||||
* =5(不走高速且避免收费)
|
||||
* =6(不走高速且躲避拥堵)
|
||||
* =7(躲避收费且躲避拥堵)
|
||||
* =8(不走高速躲避收费和拥堵)
|
||||
* =20 (高速优先)
|
||||
* =24(高速优先且躲避拥堵)
|
||||
* =-1(地图内部设置默认规则)
|
||||
*/
|
||||
public static final String STYLE = "STYLE";
|
||||
|
||||
private static volatile AutoNaviClient sInstance;
|
||||
private final Context mContext;
|
||||
|
||||
private AutoNaviClient( Context context ) {
|
||||
mContext = context.getApplicationContext();
|
||||
}
|
||||
|
||||
public static AutoNaviClient getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( AutoNaviClient.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new AutoNaviClient( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void naviTo( MogoLatLng endPoint ) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra( KEY_TYPE, 10038 );
|
||||
intent.putExtra( LAT, endPoint.lat );
|
||||
intent.putExtra( LON, endPoint.lon );
|
||||
// intent.putExtra( ENTRY_LAT, endPoint.lat );
|
||||
// intent.putExtra( ENTRY_LON, endPoint.lon );
|
||||
intent.putExtra( DEV, 0 );
|
||||
intent.putExtra( STYLE, -1 );
|
||||
intent.putExtra( SOURCE_APP, "Third App" );
|
||||
sendByIntent( intent );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint, MogoNaviConfig config ) {
|
||||
naviTo( endPoint );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints ) {
|
||||
naviTo( endPoint );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints, MogoNaviConfig config ) {
|
||||
naviTo( endPoint );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reCalculateRoute( MogoNaviConfig config ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopNavi() {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra( "KEY_TYPE", 10010 );
|
||||
sendByIntent( intent );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startNavi( boolean isRealNavi ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
private void sendByIntent( Intent intent ) {
|
||||
intent.setAction( ACTION_AUTO_MAP );
|
||||
intent.addFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
mContext.sendBroadcast( intent );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNaviing() {
|
||||
return MapState.getInstance().isNaving();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoCalculatePath > getCalculatedStrategies() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoLatLng > getCalculatedPathPos() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OnCalculatePathItemClickInteraction getItemClickInteraction() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction itemClickInteraction ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCalculatePaths() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCalculatePathDisplayBounds( Rect bounds ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoNaviConfig getNaviConfig() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return MogoMapApi.getApiBuilder().getNavi( mContext ).getNaviConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBroadcastMode( int mode ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoLatLng > getNaviPathCoordinates() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCarLocation() {
|
||||
return MogoMapApi.getApiBuilder().getNavi( mContext ).getCarLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getCarLocation2() {
|
||||
return MogoMapApi.getApiBuilder().getNavi( mContext ).getCarLocation2();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
//do not impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startAimlessMode() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopAimlessMode() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAimlessModeStatus( boolean open ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview( Rect bounds ) {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseExtraGPSData( boolean use ) {
|
||||
MogoMapApi.getApiBuilder().getNavi( mContext ).setUseExtraGPSData( use );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtraGPSData( double lon, double lat, float speed, float accuracy, float bearing, long timestamp ) {
|
||||
MogoMapApi.getApiBuilder().getNavi( mContext ).setExtraGPSData( lon, lat, speed, accuracy, bearing, timestamp );
|
||||
}
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
package com.mogo.map.impl.automap.navi;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/2
|
||||
* <p>
|
||||
* 高德公版地图透出信息广播接收者
|
||||
*/
|
||||
public class AutoNaviReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "AutoNaviReceiver";
|
||||
|
||||
public static final String ACTION_AUTONAVI_SEND = "AUTONAVI_STANDARD_BROADCAST_SEND";
|
||||
private static AutoNaviReceiver autoNaviReceiver;
|
||||
private static boolean sRegisterFlag = false;
|
||||
|
||||
private static MogoNaviInfo sNaviInfo;
|
||||
private static MogoTraffic sTraffic;
|
||||
|
||||
|
||||
public static void register( Context context ) {
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction( ACTION_AUTONAVI_SEND );
|
||||
autoNaviReceiver = new AutoNaviReceiver();
|
||||
context.registerReceiver( autoNaviReceiver, filter );
|
||||
sRegisterFlag = true;
|
||||
}
|
||||
|
||||
public static void unregister( Context context ) {
|
||||
if ( autoNaviReceiver != null && sRegisterFlag ) {
|
||||
try {
|
||||
context.unregisterReceiver( autoNaviReceiver );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error. " );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
String action = intent.getAction();
|
||||
|
||||
if ( !TextUtils.equals( ACTION_AUTONAVI_SEND, action ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
int keyType = intent.getIntExtra( "KEY_TYPE", 0 );
|
||||
switch ( keyType ) {
|
||||
case 10001:
|
||||
handleAutoNaviInfo( context, intent );
|
||||
break;
|
||||
case 10019:
|
||||
int state = intent.getIntExtra( "EXTRA_STATE", -1 );
|
||||
handleMapStatusChanged( state );
|
||||
break;
|
||||
case 10056:
|
||||
String json = intent.getStringExtra( "EXTRA_ROAD_INFO" );
|
||||
SpStorage.setNavigationTarget( json );
|
||||
Logger.d( TAG, json );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 在导航/巡航/模拟导航中auto主动将变化的引导信息发送给第三方系统
|
||||
*
|
||||
* @param intent
|
||||
*/
|
||||
private void handleAutoNaviInfo( Context context, Intent intent ) {
|
||||
|
||||
int type = intent.getIntExtra( GuideInfoExtraKey.TYPE, -1 );
|
||||
|
||||
int cameraSpeed = intent.getIntExtra( GuideInfoExtraKey.CAMERA_SPEED, 0 );
|
||||
int cameraDisc = intent.getIntExtra( GuideInfoExtraKey.CAMERA_DIST, 0 );
|
||||
int cameraType = intent.getIntExtra( GuideInfoExtraKey.CAMERA_TYPE, 0 );
|
||||
|
||||
if ( type == 0 || type == 1 ) {
|
||||
if ( !MapState.getInstance().isNaving()
|
||||
&& MogoNaviListenerHandler.getInstance().hasDelegateListener() ) {
|
||||
MapState.getInstance().setNaving( true );
|
||||
MogoNaviListenerHandler.getInstance().onStartNavi();
|
||||
}
|
||||
if ( sNaviInfo == null ) {
|
||||
sNaviInfo = new MogoNaviInfo();
|
||||
}
|
||||
sNaviInfo.setCurrentLimitSpeed( cameraSpeed );
|
||||
sNaviInfo.setCurrentRoadName( intent.getStringExtra( GuideInfoExtraKey.CUR_ROAD_NAME ) );
|
||||
sNaviInfo.setCurrentSpeed( intent.getIntExtra( GuideInfoExtraKey.CUR_SPEED, 0 ) );
|
||||
sNaviInfo.setCurStepRetainDistance( intent.getIntExtra( GuideInfoExtraKey.SEG_REMAIN_DIS, 0 ) );
|
||||
sNaviInfo.setCurStepRetainTime( intent.getIntExtra( GuideInfoExtraKey.SEG_REMAIN_TIME, 0 ) );
|
||||
sNaviInfo.setIconResId( MogoMapApi.getApiBuilder().getResIdByIconType( context, intent.getIntExtra( GuideInfoExtraKey.NEW_ICON, 0 ) ) );
|
||||
sNaviInfo.setNextRoadName( intent.getStringExtra( GuideInfoExtraKey.NEXT_ROAD_NAME ) );
|
||||
sNaviInfo.setPathRetainDistance( intent.getIntExtra( GuideInfoExtraKey.ROUTE_REMAIN_DIS, 0 ) );
|
||||
sNaviInfo.setPathRetainTime( intent.getIntExtra( GuideInfoExtraKey.ROUTE_REMAIN_TIME, 0 ) );
|
||||
MogoNaviListenerHandler.getInstance().onNaviInfoUpdate( sNaviInfo );
|
||||
}
|
||||
if ( sTraffic == null ) {
|
||||
sTraffic = new MogoTraffic( MapState.getInstance().isAimless() ? MogoTraffic.TYPE_AIM : MogoTraffic.TYPE_NAVI );
|
||||
}
|
||||
sTraffic.setFromType( MapState.getInstance().isAimless() ? MogoTraffic.TYPE_AIM : MogoTraffic.TYPE_NAVI );
|
||||
sTraffic.setDistance( cameraDisc );
|
||||
sTraffic.setSpeedLimit( cameraSpeed );
|
||||
sTraffic.setTrafficType( cameraType );
|
||||
MogoNaviListenerHandler.getInstance().onUpdateTraffic2( sTraffic );
|
||||
}
|
||||
|
||||
/**
|
||||
* 当导航发生状态变更时,将相应的状态通知给系统。
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
private void handleMapStatusChanged( int state ) {
|
||||
if ( state == -1 ) {
|
||||
return;
|
||||
}
|
||||
switch ( state ) {
|
||||
case MapStateValue.START_NAVI:
|
||||
case MapStateValue.START_EMULATOR_NAVI:
|
||||
if ( MapState.getInstance().isNaving() ) {
|
||||
Logger.w( TAG, "naving..." );
|
||||
return;
|
||||
}
|
||||
MapState.getInstance().setNaving( true );
|
||||
MogoNaviListenerHandler.getInstance().onStartNavi();
|
||||
break;
|
||||
case MapStateValue.STOP_NAVI:
|
||||
case MapStateValue.STOP_EMULATOR_NAVI:
|
||||
case MapStateValue.APP_START: // 语音退出导航,感觉是杀掉了高德APP了
|
||||
if ( MapState.getInstance().isNaving() ) {
|
||||
MapState.getInstance().setNaving( false );
|
||||
MogoNaviListenerHandler.getInstance().onStopNavi();
|
||||
}
|
||||
break;
|
||||
case MapStateValue.START_AIMLESS_NAVI:
|
||||
MapState.getInstance().setAimless( true );
|
||||
break;
|
||||
case MapStateValue.STOP_AIMLESS_NAVI:
|
||||
MapState.getInstance().setAimless( false );
|
||||
break;
|
||||
case MapStateValue.EXIT_APP:
|
||||
break;
|
||||
case MapStateValue.DESTINATION:
|
||||
MogoNaviListenerHandler.getInstance().onArriveDestination();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
package com.mogo.map.impl.automap.navi;
|
||||
|
||||
//引导信息对应的KEY值机器描述
|
||||
public class GuideInfoExtraKey {
|
||||
/**
|
||||
* 导航类型,对应的值为int类型
|
||||
* 0:GPS导航
|
||||
* 1:模拟导航
|
||||
* 2:巡航
|
||||
*/
|
||||
public static final String TYPE = "TYPE";
|
||||
|
||||
/**
|
||||
* 当前道路名称,对应的值为String类型
|
||||
*/
|
||||
public static final String CUR_ROAD_NAME = "CUR_ROAD_NAME";
|
||||
|
||||
/**
|
||||
* 下一道路名,对应的值为String类型
|
||||
*/
|
||||
public static final String NEXT_ROAD_NAME = "NEXT_ROAD_NAME";
|
||||
|
||||
/**
|
||||
* 电子眼限速度,对应的值为int类型,无限速则为0,单位:公里/小时
|
||||
*/
|
||||
public static final String CAMERA_SPEED = "CAMERA_SPEED";
|
||||
|
||||
/**
|
||||
* 导航转向图标,对应的值为int类型
|
||||
*/
|
||||
public static final String ICON = "ICON";
|
||||
|
||||
/**
|
||||
* 导航最新的转向图标,对应的值为int类型
|
||||
*/
|
||||
public static final String NEW_ICON = "NEW_ICON";
|
||||
|
||||
/**
|
||||
* 路径剩余距离,对应的值为int类型,单位:米
|
||||
*/
|
||||
public static final String ROUTE_REMAIN_DIS = "ROUTE_REMAIN_DIS";
|
||||
/**
|
||||
* 路径剩余时间,对应的值为int类型,单位:秒
|
||||
*/
|
||||
public static final String ROUTE_REMAIN_TIME = "ROUTE_REMAIN_TIME";
|
||||
|
||||
/**
|
||||
* 当前导航段剩余距离,对应的值为int类型,单位:米
|
||||
*/
|
||||
public static final String SEG_REMAIN_DIS = "SEG_REMAIN_DIS";
|
||||
|
||||
/**
|
||||
* 当前导航段剩余时间,对应的值为int类型,单位:秒
|
||||
*/
|
||||
public static final String SEG_REMAIN_TIME = "SEG_REMAIN_TIME";
|
||||
|
||||
/**
|
||||
* 路径总距离,对应的值为int类型,单位:米
|
||||
*/
|
||||
public static final String ROUTE_ALL_DIS = "ROUTE_ALL_DIS";
|
||||
|
||||
/**
|
||||
* 路径总时间,对应的值为int类型,单位:秒
|
||||
*/
|
||||
public static final String ROUTE_ALL_TIME = "ROUTE_ALL_TIME";
|
||||
|
||||
/**
|
||||
* 当前车速,对应的值为int类型,单位:公里/小时
|
||||
*/
|
||||
public static final String CUR_SPEED = "CUR_SPEED";
|
||||
|
||||
/**
|
||||
* 当前道路类型,对应的值为int类型
|
||||
* 0:高速公路
|
||||
* 1:国道
|
||||
* 2:省道
|
||||
* 3:县道
|
||||
* 4:乡公路
|
||||
* 5:县乡村内部道路
|
||||
* 6:主要大街、城市快速道 * 7:主要道路
|
||||
* 8:次要道路
|
||||
* 9:普通道路
|
||||
* 10:非导航道路
|
||||
*/
|
||||
public static final String ROAD_TYPE = "ROAD_TYPE";
|
||||
|
||||
/**
|
||||
* 路径剩余时间,对应的值为String类型,单位:天/小时/分钟 比如:1天2小时, 21小时30分
|
||||
* 钟(只用于长安)
|
||||
*/
|
||||
public static final String ROUTE_REMAIN_TIME_STRING = "ROUTE_REMAIN_TIME_S TRING";
|
||||
|
||||
/**
|
||||
* 下下个路名名称,对应的值为String类型
|
||||
*/
|
||||
public static final String NEXT_NEXT_ROAD_NAME = "NEXT_NEXT_ROAD_NAME";
|
||||
/**
|
||||
* 下下个路口转向图标,对应的值为int类型
|
||||
*/
|
||||
|
||||
public static final String NEXT_NEXT_TURN_ICON = "NEXT_NEXT_TURN_ICON";
|
||||
|
||||
/**
|
||||
* 距离下下个路口剩余距离,对应的值为int类型,单位:米
|
||||
*/
|
||||
public static final String NEXT_SEG_REMAIN_DIS = "NEXT_SEG_REMAIN_DIS";
|
||||
|
||||
/**
|
||||
* 距离下下个路口剩余时间,对应的值为int类型,单位:秒
|
||||
*/
|
||||
public static final String NEXT_SEG_REMAIN_TIME = "NEXT_SEG_REMAIN_TIME";
|
||||
|
||||
/**
|
||||
* 距离最近的电子眼距离,对应的值为int类型,单位:米
|
||||
*/
|
||||
public static final String CAMERA_DIST = "CAMERA_DIST";
|
||||
|
||||
/**
|
||||
* 电子眼类型,对应的值为int类型
|
||||
* 0 测速摄像头
|
||||
* 1为监控摄像头
|
||||
* 2为闯红灯拍照
|
||||
* 3为违章拍照
|
||||
* 4为公交专用道摄像头
|
||||
* 5为应急车道摄像头
|
||||
* 6为非机动车道拍照
|
||||
*/
|
||||
public static final String CAMERA_TYPE = "CAMERA_TYPE";
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.mogo.map.impl.automap.navi;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/3
|
||||
*
|
||||
* 高德地图状态
|
||||
*/
|
||||
class MapState {
|
||||
|
||||
private static volatile MapState sInstance;
|
||||
|
||||
private MapState() {
|
||||
}
|
||||
|
||||
public static MapState getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MapState.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MapState();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private boolean isNaving = false;
|
||||
private boolean isAimless = false;
|
||||
|
||||
public boolean isNaving() {
|
||||
return isNaving;
|
||||
}
|
||||
|
||||
public void setNaving( boolean naving ) {
|
||||
isNaving = naving;
|
||||
}
|
||||
|
||||
public boolean isAimless() {
|
||||
return isAimless;
|
||||
}
|
||||
|
||||
public void setAimless( boolean aimless ) {
|
||||
isAimless = aimless;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.mogo.map.impl.automap.navi;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/6/3
|
||||
* <p>
|
||||
* 高德公版地图状态值
|
||||
*/
|
||||
public interface MapStateValue {
|
||||
|
||||
int START_NAVI = 8;
|
||||
|
||||
int STOP_NAVI = 9;
|
||||
|
||||
int START_EMULATOR_NAVI = 10;
|
||||
|
||||
int STOP_EMULATOR_NAVI = 12;
|
||||
|
||||
int START_AIMLESS_NAVI = 24;
|
||||
|
||||
int STOP_AIMLESS_NAVI = 25;
|
||||
|
||||
int EXIT_APP = 45;
|
||||
|
||||
int DESTINATION = 39;
|
||||
|
||||
int APP_START = 0;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.mogo.map.impl.automap.navi;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.IMogoMapApiBuilder;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/10
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoMapApi {
|
||||
|
||||
private static IMogoMapApiBuilder sApiBuilder;
|
||||
|
||||
public static IMogoMapApiBuilder getApiBuilder() {
|
||||
if (sApiBuilder == null) {
|
||||
synchronized (AutoNaviClient.class) {
|
||||
if (sApiBuilder == null) {
|
||||
sApiBuilder = ARouter.getInstance().navigation(IMogoMapApiBuilder.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sApiBuilder;
|
||||
}
|
||||
}
|
||||
@@ -450,11 +450,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
if (mCurrentUI == EnumMapUI.Type_VR) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (visible && NaviClient.getInstance(getContext()).isNaviing()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkAMapView()) {
|
||||
MyLocationStyle style = mMapView.getMapAutoViewHelper().getMyLocationStyle();
|
||||
if (visible) {
|
||||
@@ -468,9 +463,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
@Override
|
||||
public void showMyLocation(View view) {
|
||||
Logger.d(TAG, "showMyLocation %s", "view");
|
||||
if (NaviClient.getInstance(getContext()).isNaviing()) {
|
||||
return;
|
||||
}
|
||||
if (DebugConfig.isDebug()) {
|
||||
Logger.d(TAG, Log.getStackTraceString(new Throwable()));
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package com.mogo.map.impl.custom.navi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.map.impl.custom.AMapWrapper;
|
||||
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;
|
||||
@@ -26,40 +23,21 @@ import java.util.List;
|
||||
*/
|
||||
public class NaviClient implements IMogoNavi {
|
||||
|
||||
/**
|
||||
* 巡航状态控制
|
||||
*/
|
||||
public static final String KEY_AIMLESS_STATUS = "KEY_AIMLESS_STATUS";
|
||||
|
||||
private static final String TAG = "NaviClient";
|
||||
private final Context mContext;
|
||||
|
||||
private MapAutoViewHelper mAMapNavi;
|
||||
|
||||
/**
|
||||
* 导航策略配置
|
||||
*/
|
||||
|
||||
private MogoNaviConfig mMogoNaviConfig = new MogoNaviConfig();
|
||||
|
||||
private static volatile NaviClient sInstance;
|
||||
private boolean mIsRealNavi;
|
||||
|
||||
private Location mCarLocation = new Location("GPS");
|
||||
/**
|
||||
* 巡航模式配置状态
|
||||
*/
|
||||
private boolean mAimlessModeStatus;
|
||||
|
||||
/**
|
||||
* 巡航状态
|
||||
*/
|
||||
private boolean mAimlessStatus;
|
||||
|
||||
private NaviClient(Context context) {
|
||||
mCarLocation.setLongitude(116.97000);
|
||||
mCarLocation.setLatitude(39.97000);
|
||||
mContext = context;
|
||||
mAMapNavi = AMapWrapper.getAMap();
|
||||
}
|
||||
|
||||
@@ -88,11 +66,6 @@ public class NaviClient implements IMogoNavi {
|
||||
naviTo(endPoint, null, config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo(MogoLatLng endPoint, List<MogoLatLng> wayPoints) {
|
||||
naviTo(endPoint, wayPoints, mMogoNaviConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo(MogoLatLng endPoint, List<MogoLatLng> wayPoints, MogoNaviConfig config) {
|
||||
if (!checkAMapNavi()) {
|
||||
@@ -105,74 +78,16 @@ public class NaviClient implements IMogoNavi {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reCalculateRoute(MogoNaviConfig config) {
|
||||
if (!checkAMapNavi()) {
|
||||
return;
|
||||
}
|
||||
mMogoNaviConfig = config;
|
||||
if (mMogoNaviConfig == null) {
|
||||
mMogoNaviConfig = new MogoNaviConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopNavi() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void startNavi(boolean isRealNavi) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNaviing() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MogoCalculatePath> getCalculatedStrategies() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MogoLatLng> getCalculatedPathPos() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OnCalculatePathItemClickInteraction getItemClickInteraction() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLineClickInteraction(OnCalculatePathItemClickInteraction lineClickInteraction) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCalculatePaths() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCalculatePathDisplayBounds(Rect bounds) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoNaviConfig getNaviConfig() {
|
||||
return mMogoNaviConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBroadcastMode(int mode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MogoLatLng> getNaviPathCoordinates() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCarLocation() {
|
||||
if (mCarLocation != null) {
|
||||
@@ -219,46 +134,4 @@ public class NaviClient implements IMogoNavi {
|
||||
public void stopAimlessMode() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAimlessModeStatus(boolean open) {
|
||||
this.mAimlessModeStatus = open;
|
||||
SharedPrefsMgr.getInstance(mContext).putBoolean(KEY_AIMLESS_STATUS, open);
|
||||
if (open) {
|
||||
if (!mAimlessStatus) {
|
||||
startAimlessMode();
|
||||
}
|
||||
} else {
|
||||
if (mAimlessStatus) {
|
||||
stopAimlessMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview(Rect bounds) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseExtraGPSData(boolean use) {
|
||||
Logger.d(TAG, "设置外部gps源状态 %s", use);
|
||||
mAMapNavi.setIsUseExtraGPSData(use);
|
||||
AMapWrapper.getAMap().setMyLocationEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtraGPSData(double lon, double lat, float speed, float accuracy, float bearing, long timestamp) {
|
||||
if (!mAMapNavi.getIsUseExtraGPSData()) {
|
||||
Logger.d(TAG, "拒绝外部GPS数据");
|
||||
return;
|
||||
}
|
||||
Location location = new Location("外部GPS源");
|
||||
location.setLongitude(lon);
|
||||
location.setLatitude(lat);
|
||||
location.setSpeed(speed);
|
||||
location.setAccuracy(accuracy);
|
||||
location.setBearing(bearing);
|
||||
location.setTime(timestamp);
|
||||
//type字段传1时代表WGS84坐标
|
||||
mAMapNavi.setExtraGPSData(2, location);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
@@ -30,14 +29,6 @@ public interface IMogoNavi extends IMogoCarLocationChangedListenerRegister, IMo
|
||||
*/
|
||||
void naviTo( MogoLatLng endPoint, MogoNaviConfig config );
|
||||
|
||||
/**
|
||||
* 开启路径规划并导航
|
||||
*
|
||||
* @param endPoint 导航目的地
|
||||
* @param wayPoints 途经点
|
||||
*/
|
||||
void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints );
|
||||
|
||||
/**
|
||||
* 开启路径规划并导航
|
||||
*
|
||||
@@ -47,17 +38,6 @@ public interface IMogoNavi extends IMogoCarLocationChangedListenerRegister, IMo
|
||||
*/
|
||||
void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints, MogoNaviConfig config );
|
||||
|
||||
/**
|
||||
* 重新算路
|
||||
*
|
||||
* @param config 规划路线策略
|
||||
*/
|
||||
void reCalculateRoute( MogoNaviConfig config );
|
||||
|
||||
/**
|
||||
* 退出导航
|
||||
*/
|
||||
void stopNavi();
|
||||
|
||||
/**
|
||||
* 开始导航
|
||||
@@ -66,70 +46,6 @@ public interface IMogoNavi extends IMogoCarLocationChangedListenerRegister, IMo
|
||||
*/
|
||||
void startNavi( boolean isRealNavi );
|
||||
|
||||
/**
|
||||
* 是否正在导航
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isNaviing();
|
||||
|
||||
/**
|
||||
* 获取路线规划策略
|
||||
*
|
||||
* @return 规划的路线
|
||||
*/
|
||||
List< MogoCalculatePath > getCalculatedStrategies();
|
||||
|
||||
|
||||
/**
|
||||
* 获取路线坐标点
|
||||
*
|
||||
* @return 规划的路线上所有的坐标点
|
||||
*/
|
||||
List< MogoLatLng > getCalculatedPathPos();
|
||||
|
||||
|
||||
/**
|
||||
* 获取列表Item点击回调
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
OnCalculatePathItemClickInteraction getItemClickInteraction();
|
||||
|
||||
/**
|
||||
* 清除规划的路线
|
||||
*/
|
||||
void clearCalculatePaths();
|
||||
|
||||
/**
|
||||
* 设置显示规划路线的范围
|
||||
*
|
||||
* @param bounds 范围
|
||||
*/
|
||||
void setCalculatePathDisplayBounds( Rect bounds );
|
||||
|
||||
/**
|
||||
* 导航配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
MogoNaviConfig getNaviConfig();
|
||||
|
||||
/**
|
||||
* 设置播报模式
|
||||
*
|
||||
* @param mode
|
||||
* @return
|
||||
*/
|
||||
boolean setBroadcastMode( int mode );
|
||||
|
||||
/**
|
||||
* 获取导航沿途路线的点
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List< MogoLatLng > getNaviPathCoordinates();
|
||||
|
||||
/**
|
||||
* 获取车标经纬度
|
||||
*
|
||||
@@ -154,27 +70,4 @@ public interface IMogoNavi extends IMogoCarLocationChangedListenerRegister, IMo
|
||||
*/
|
||||
void stopAimlessMode();
|
||||
|
||||
/**
|
||||
* 设置巡航模式状态
|
||||
*
|
||||
* @param open
|
||||
*/
|
||||
void setAimlessModeStatus( boolean open );
|
||||
|
||||
/**
|
||||
* 查看全程
|
||||
*/
|
||||
void displayOverview( Rect bounds );
|
||||
|
||||
/**
|
||||
* 设置使用外部定位源
|
||||
*
|
||||
* @param use true - 使用,false - 不适用
|
||||
*/
|
||||
void setUseExtraGPSData( boolean use );
|
||||
|
||||
/**
|
||||
* 设置外部数据源
|
||||
*/
|
||||
void setExtraGPSData( double lon, double lat, float speed, float accuracy, float bearing, long timestamp );
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ dependencies {
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
api rootProject.ext.dependencies.mapautomap
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
@@ -53,7 +52,6 @@ dependencies {
|
||||
} else {
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':libraries:mogo-map-api')
|
||||
api project(':libraries:map-autonavi')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
|
||||
implementation project(':core:mogo-core-data')
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @since 2020-11-05
|
||||
* <p>
|
||||
* 巡航代理
|
||||
*/
|
||||
public class MogoAimless implements IMogoAimless {
|
||||
|
||||
private IMogoAimless mDelegate;
|
||||
|
||||
private static volatile MogoAimless sInstance;
|
||||
|
||||
private MogoAimless( Context context ) {
|
||||
mDelegate = MogoMapDelegateFactory.getAimless( context );
|
||||
}
|
||||
|
||||
public static MogoAimless getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoAimless.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoAimless( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startAimlessMode() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.startAimlessMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopAimlessMode() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.stopAimlessMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAimlessModeStatus( boolean open ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setAimlessModeStatus( open );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,7 @@ package com.mogo.map;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
import com.mogo.map.impl.automap.navi.AutoNaviClient;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
@@ -51,24 +46,10 @@ class MogoMapDelegateFactory {
|
||||
return getApiBuilder().getMapUIController();
|
||||
}
|
||||
|
||||
public static IMogoNavi getNaviDelegate(Context context) {
|
||||
|
||||
if (DebugConfig.isUseCustomNavi()) {
|
||||
return getApiBuilder().getNavi(context);
|
||||
} else if (AppUtils.isAppInstalled(context, "com.autonavi.amapauto")) {
|
||||
return AutoNaviClient.getInstance(context);
|
||||
}
|
||||
return getApiBuilder().getNavi(context);
|
||||
}
|
||||
|
||||
public static IMogoPoiSearch getPoiSearchClientDelegate(Context context, MogoPoiSearchQuery query) {
|
||||
return getApiBuilder().getPoiSearchClient(context, query);
|
||||
}
|
||||
|
||||
public static IMogoAimless getAimless(Context context) {
|
||||
return getApiBuilder().getAimless(context);
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
getApiBuilder().destroy();
|
||||
}
|
||||
|
||||
@@ -1,235 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
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 java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-25
|
||||
* <p>
|
||||
* 导航代理
|
||||
*/
|
||||
public class MogoNavi implements IMogoNavi {
|
||||
|
||||
private IMogoNavi mDelegate;
|
||||
|
||||
private static volatile MogoNavi sInstance;
|
||||
|
||||
private MogoNavi( Context context ) {
|
||||
mDelegate = MogoMapDelegateFactory.getNaviDelegate( context );
|
||||
}
|
||||
|
||||
public static MogoNavi getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoNavi.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoNavi( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.naviTo( endPoint );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint, MogoNaviConfig config ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.naviTo( endPoint, config );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.naviTo( endPoint, wayPoints );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void naviTo( MogoLatLng endPoint, List< MogoLatLng > wayPoints, MogoNaviConfig config ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.naviTo( endPoint, wayPoints, config );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reCalculateRoute( MogoNaviConfig config ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.reCalculateRoute( config );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopNavi() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.stopNavi();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startNavi( boolean isRealNavi ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.startNavi( isRealNavi );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNaviing() {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.isNaviing();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoCalculatePath > getCalculatedStrategies() {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.getCalculatedStrategies();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoLatLng > getCalculatedPathPos() {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.getCalculatedPathPos();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OnCalculatePathItemClickInteraction getItemClickInteraction() {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.getItemClickInteraction();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLineClickInteraction( OnCalculatePathItemClickInteraction itemClickInteraction ) {
|
||||
MogoOperationListenerRegister.getInstance().setLineClickInteraction( itemClickInteraction );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCalculatePaths() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.clearCalculatePaths();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCalculatePathDisplayBounds( Rect bounds ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setCalculatePathDisplayBounds( bounds );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoNaviConfig getNaviConfig() {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.getNaviConfig();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBroadcastMode( int mode ) {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.setBroadcastMode( mode );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoLatLng > getNaviPathCoordinates() {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.getNaviPathCoordinates();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCarLocation() {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.getCarLocation();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getCarLocation2() {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.getCarLocation2();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCarLocationChangedListener( IMogoCarLocationChangedListener2 listener ) {
|
||||
MogoCarLocationChangedListenerRegister.getInstance().registerCarLocationChangedListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startAimlessMode() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.startAimlessMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopAimlessMode() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.stopAimlessMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAimlessModeStatus( boolean open ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setAimlessModeStatus( open );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview( Rect bounds ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.displayOverview( bounds );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUseExtraGPSData( boolean use ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setUseExtraGPSData( use );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtraGPSData( double lon, double lat, float speed, float accuracy, float bearing, long timestamp ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setExtraGPSData( lon, lat, speed, accuracy, bearing, timestamp );
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user