地图依赖重构
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -84,7 +84,6 @@
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
|
||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -4,7 +4,7 @@
|
||||
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
||||
<groovy codeStyle="LEGACY" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="SuppressionsComponent">
|
||||
|
||||
@@ -20,12 +20,6 @@ android {
|
||||
}
|
||||
|
||||
multiDexEnabled true
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
@@ -155,6 +149,30 @@ android {
|
||||
// 分享时是否隐藏 adas
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
}
|
||||
// f系列-分体机-高德
|
||||
f8Amap {
|
||||
applicationId rootProject.ext.android.fLauncherApplicationId
|
||||
dimension "product"
|
||||
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
|
||||
// 车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
|
||||
buildConfigField 'boolean', 'ROAD_EVENT_ANIMATED', 'true'
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否支持换肤
|
||||
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
|
||||
// 是否支持查询导航目的地车友
|
||||
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
|
||||
// 是否支持桌面卡片刷新
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
|
||||
// 是否基于地图
|
||||
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'
|
||||
// 是否加载引导模块
|
||||
buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'true'
|
||||
// 分享时是否隐藏 adas
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
}
|
||||
// e系列,采用Launcher方案
|
||||
e8xx {
|
||||
applicationId rootProject.ext.android.launcherApplicationId
|
||||
@@ -385,6 +403,8 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "./functions/abiFilters.gradle"
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/io.netty.versions.properties'
|
||||
}
|
||||
@@ -453,6 +473,7 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-map')
|
||||
}
|
||||
|
||||
apply from: "./functions/basedmap.gradle"
|
||||
apply from: "./functions/perform.gradle"
|
||||
apply from: "./functions/baseservices.gradle"
|
||||
apply from: "./functions/socketpush.gradle"
|
||||
|
||||
112
app/functions/abiFilters.gradle
Normal file
112
app/functions/abiFilters.gradle
Normal file
@@ -0,0 +1,112 @@
|
||||
// 将 install 和 assemble 任务按功能分组
|
||||
|
||||
project.android.productFlavors {
|
||||
// f系列-分体机全系列,未细分
|
||||
f8xx {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "arm64-v8a","armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
// f系列-分体机
|
||||
f80x {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "arm64-v8a","armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
// f系列-分体机-高德
|
||||
f8Amap {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
// e系列,采用Launcher方案
|
||||
e8xx {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
// 同上
|
||||
em4 {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
// e系列-2+32,对标D系列2+32,采用独立app的形式
|
||||
em3 {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
// e系列-1+16,对标D系列1+16,采用独立app形式
|
||||
em1 {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
// e系列-1+16,对标D系列1+16,采用独立app形式
|
||||
em2 {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
// d系列
|
||||
d8xx {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
// d系列 2 + 32
|
||||
d80x {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
// d系列 1+16 版本
|
||||
d82x {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
// 比亚迪
|
||||
bydauto {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
app/functions/basedmap.gradle
Normal file
35
app/functions/basedmap.gradle
Normal file
@@ -0,0 +1,35 @@
|
||||
// 辅助驾驶占位模块,目前部分车机不上辅助驾驶功能,使用该模块能力代替
|
||||
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
|
||||
f8xxImplementation rootProject.ext.dependencies.mapcustom
|
||||
f80xImplementation rootProject.ext.dependencies.mapcustom
|
||||
|
||||
f8AmapImplementation rootProject.ext.dependencies.mapamap
|
||||
bydautoImplementation rootProject.ext.dependencies.mapamap
|
||||
d82xImplementation rootProject.ext.dependencies.mapamap
|
||||
em1Implementation rootProject.ext.dependencies.mapamap
|
||||
em2Implementation rootProject.ext.dependencies.mapamap
|
||||
d8xxImplementation rootProject.ext.dependencies.mapamap
|
||||
d80xImplementation rootProject.ext.dependencies.mapamap
|
||||
em4Implementation rootProject.ext.dependencies.mapamap
|
||||
e8xxImplementation rootProject.ext.dependencies.mapamap
|
||||
e8xxImplementation rootProject.ext.dependencies.mapamap
|
||||
em3Implementation rootProject.ext.dependencies.mapamap
|
||||
} else {
|
||||
f8xxImplementation project(':libraries:map-custom')
|
||||
f80xImplementation project(':libraries:map-custom')
|
||||
|
||||
f8AmapImplementation project(':libraries:map-amap')
|
||||
bydautoImplementation project(':libraries:map-amap')
|
||||
d82xImplementation project(':libraries:map-amap')
|
||||
em1Implementation project(':libraries:map-amap')
|
||||
em2Implementation project(':libraries:map-amap')
|
||||
d8xxImplementation project(':libraries:map-amap')
|
||||
d80xImplementation project(':libraries:map-amap')
|
||||
em4Implementation project(':libraries:map-amap')
|
||||
e8xxImplementation project(':libraries:map-amap')
|
||||
em3Implementation project(':libraries:map-amap')
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ project.dependencies {
|
||||
e8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
f8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
f80xImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
f8AmapImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
em3Implementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
} else {
|
||||
bydautoImplementation project(':foudations:mogo-base-services-sdk')
|
||||
@@ -26,6 +27,7 @@ project.dependencies {
|
||||
e8xxImplementation project(':foudations:mogo-base-services-apk')
|
||||
f8xxImplementation project(':foudations:mogo-base-services-apk')
|
||||
f80xImplementation project(':foudations:mogo-base-services-apk')
|
||||
f8AmapImplementation project(':foudations:mogo-base-services-apk')
|
||||
em3Implementation project(':foudations:mogo-base-services-apk')
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ project.dependencies {
|
||||
e8xxImplementation rootProject.ext.dependencies.mogomoduleguide
|
||||
f8xxImplementation rootProject.ext.dependencies.mogomoduleguide
|
||||
f80xImplementation rootProject.ext.dependencies.mogomoduleguide
|
||||
f8AmapImplementation rootProject.ext.dependencies.mogomoduleguide
|
||||
em3Implementation rootProject.ext.dependencies.mogomoduleguide
|
||||
} else {
|
||||
bydautoImplementation project(':modules:mogo-module-guide')
|
||||
@@ -18,6 +19,7 @@ project.dependencies {
|
||||
e8xxImplementation project(':modules:mogo-module-guide')
|
||||
f8xxImplementation project(':modules:mogo-module-guide')
|
||||
f80xImplementation project(':modules:mogo-module-guide')
|
||||
f8AmapImplementation project(':modules:mogo-module-guide')
|
||||
em3Implementation project(':modules:mogo-module-guide')
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ project.dependencies {
|
||||
e8xxImplementation rootProject.ext.dependencies.httpdnsnoop
|
||||
f8xxImplementation rootProject.ext.dependencies.httpdnstencent
|
||||
f80xImplementation rootProject.ext.dependencies.httpdnstencent
|
||||
f8AmapImplementation rootProject.ext.dependencies.httpdnstencent
|
||||
em3Implementation rootProject.ext.dependencies.httpdnsnoop
|
||||
} else {
|
||||
bydautoImplementation project(':foudations:httpdns-noop')
|
||||
@@ -22,6 +23,7 @@ project.dependencies {
|
||||
e8xxImplementation project(':foudations:httpdns-noop')
|
||||
f8xxImplementation project(':foudations:httpdns-tencent')
|
||||
f80xImplementation project(':foudations:httpdns-tencent')
|
||||
f8AmapImplementation project(':foudations:httpdns-tencent')
|
||||
em3Implementation project(':foudations:httpdns-noop')
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ project.dependencies {
|
||||
e8xxImplementation rootProject.ext.dependencies.moduleleftpanelnoop
|
||||
f8xxImplementation rootProject.ext.dependencies.moduleleftpanelnoop
|
||||
f80xImplementation rootProject.ext.dependencies.moduleleftpanelnoop
|
||||
f8AmapImplementation rootProject.ext.dependencies.moduleleftpanelnoop
|
||||
em3Implementation rootProject.ext.dependencies.moduleleftpanelnoop
|
||||
} else {
|
||||
bydautoImplementation project(':modules:mogo-module-left-panel')
|
||||
@@ -27,6 +28,7 @@ project.dependencies {
|
||||
e8xxImplementation project(':modules:mogo-module-left-panel-noop')
|
||||
f8xxImplementation project(':modules:mogo-module-left-panel-noop')
|
||||
f80xImplementation project(':modules:mogo-module-left-panel-noop')
|
||||
f8AmapImplementation project(':modules:mogo-module-left-panel-noop')
|
||||
em3Implementation project(':modules:mogo-module-left-panel-noop')
|
||||
}
|
||||
}
|
||||
@@ -11,11 +11,13 @@ project.dependencies {
|
||||
d80xImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
f8xxImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
f80xImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
f8AmapImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
em4Implementation rootProject.ext.dependencies.skinsupportimpl
|
||||
e8xxImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
|
||||
f8xxImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
f80xImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
f8AmapImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
em4Implementation rootProject.ext.dependencies.skinsupportlight
|
||||
e8xxImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
d8xxImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
@@ -35,11 +37,13 @@ project.dependencies {
|
||||
d80xImplementation project(':skin:mogo-skin-support-impl')
|
||||
f8xxImplementation project(':skin:mogo-skin-support-impl')
|
||||
f80xImplementation project(':skin:mogo-skin-support-impl')
|
||||
f8AmapImplementation project(':skin:mogo-skin-support-impl')
|
||||
em4Implementation project(':skin:mogo-skin-support-impl')
|
||||
e8xxImplementation project(':skin:mogo-skin-support-impl')
|
||||
|
||||
f8xxImplementation project(':skin:mogo-skin-light')
|
||||
f80xImplementation project(':skin:mogo-skin-light')
|
||||
f8AmapImplementation project(':skin:mogo-skin-light')
|
||||
em4Implementation project(':skin:mogo-skin-light')
|
||||
e8xxImplementation project(':skin:mogo-skin-light')
|
||||
d8xxImplementation project(':skin:mogo-skin-light')
|
||||
|
||||
@@ -9,6 +9,7 @@ project.dependencies {
|
||||
d80xImplementation rootProject.ext.dependencies.ttszhi
|
||||
f8xxImplementation rootProject.ext.dependencies.ttszhi
|
||||
f80xImplementation rootProject.ext.dependencies.ttszhi
|
||||
f8AmapImplementation rootProject.ext.dependencies.ttszhi
|
||||
em4Implementation rootProject.ext.dependencies.ttszhi
|
||||
e8xxImplementation rootProject.ext.dependencies.ttszhi
|
||||
} else {
|
||||
@@ -21,6 +22,7 @@ project.dependencies {
|
||||
d80xImplementation project(':tts:tts-zhi')
|
||||
f8xxImplementation project(':tts:tts-zhi')
|
||||
f80xImplementation project(':tts:tts-zhi')
|
||||
f8AmapImplementation project(':tts:tts-zhi')
|
||||
em4Implementation project(':tts:tts-zhi')
|
||||
e8xxImplementation project(':tts:tts-zhi')
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
afterEvaluate {
|
||||
|
||||
def independent = ["em3", "em1", "d80x", "d82x", "bydauto", "em2"]
|
||||
def launcher = ["f80x", "em4", "e8xx"]
|
||||
def launcher = ["f80x", "f8xx","f8amap", "em4", "e8xx"]
|
||||
|
||||
it.getTasks().iterator().forEachRemaining {
|
||||
def task = it
|
||||
|
||||
@@ -36,11 +36,6 @@ import com.squareup.leakcanary.LeakCanary;
|
||||
import com.zhidao.boot.persistent.lib.PersistentManager;
|
||||
import com.zhidao.mogo.module.left.panel.LeftPanelConst;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.module.guide.GuideConstant.PATH_GUIDE_FRAGMENT;
|
||||
import static com.mogo.module.guide.GuideConstant.PATH_GUIDE_MODULE_NAME;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
@@ -79,7 +74,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_WIDGETS, MogoServicePaths.PATH_WIDGETS ) );
|
||||
if ( DebugConfig.isMapBased() ) {
|
||||
MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) );
|
||||
// MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) );
|
||||
}
|
||||
|
||||
MogoModulePaths.addBaseModule( new MogoModule( ShareConstants.TAG, ShareConstants.MODEL_NAME ) );
|
||||
|
||||
@@ -137,7 +137,7 @@ HTTPDNS_NOOP_VERSION = 1.0.0
|
||||
|
||||
######## 外部依赖引用
|
||||
# 车聊聊
|
||||
CARCHATTING_VERSION=2.2.5
|
||||
CARCHATTING_VERSION=2.2.10
|
||||
# 车聊聊接口
|
||||
CARCHATTINGPROVIDER_VERSION=1.1.7
|
||||
# loglib
|
||||
|
||||
@@ -11,6 +11,12 @@ android {
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@@ -25,6 +31,10 @@ android {
|
||||
targetCompatibility 1.8
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -35,6 +45,9 @@ dependencies {
|
||||
api rootProject.ext.dependencies.amapsearch
|
||||
api rootProject.ext.dependencies.amaplocation
|
||||
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.mogo.map.impl.amap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.IMogoMapApiBuilder;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.MapApiPath;
|
||||
import com.mogo.map.impl.amap.location.ALocationClient;
|
||||
import com.mogo.map.impl.amap.navi.AimlessClient;
|
||||
import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
import com.mogo.map.impl.amap.search.GeocodeSearchClient;
|
||||
import com.mogo.map.impl.amap.search.InputtipsSearch;
|
||||
import com.mogo.map.impl.amap.search.PoiSearchClient;
|
||||
import com.mogo.map.impl.amap.search.RoadSearchClient;
|
||||
import com.mogo.map.impl.amap.search.TrafficSearchClient;
|
||||
import com.mogo.map.impl.amap.uicontroller.AMapUIController;
|
||||
import com.mogo.map.impl.amap.utils.IconTypeUtils;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.search.drive.IMogoRoadSearch;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/9
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = MapApiPath.PATH )
|
||||
class AMapApiBuilder implements IMogoMapApiBuilder {
|
||||
|
||||
private static final String TAG = "AMapApiBuilder";
|
||||
|
||||
@Override
|
||||
public IMogoGeoSearch getGeoSearch( Context context ) {
|
||||
return new GeocodeSearchClient( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoInputtipsSearch getInputtipsSearch( Context context, MogoInputtipsQuery query ) {
|
||||
return new InputtipsSearch( context, query );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationClient getLocationClient( Context context ) {
|
||||
return new ALocationClient( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapUIController getMapUIController() {
|
||||
return AMapUIController.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoNavi getNavi( Context context ) {
|
||||
return NaviClient.getInstance( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoPoiSearch getPoiSearchClient( Context context, MogoPoiSearchQuery query ) {
|
||||
return new PoiSearchClient( context, query );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoRoadSearch getRoadSearch() {
|
||||
return new RoadSearchClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoAimless getAimless( Context context ) {
|
||||
return AimlessClient.getInstance( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMapView( Context context ) {
|
||||
AMapViewHandler.createMapView( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
AMapViewHandler.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapView getMapView( Context context ) {
|
||||
IMogoMapView mapView = AMapViewHandler.getMapView();
|
||||
if ( mapView != null
|
||||
&& mapView.getMapView() != null
|
||||
&& mapView.getMapView().getParent() != null ) {
|
||||
ViewGroup group = ( ViewGroup ) mapView.getMapView().getParent();
|
||||
group.removeView( mapView.getMapView() );
|
||||
}
|
||||
return mapView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoTrafficSearch getTrafficSearch() {
|
||||
return new TrafficSearchClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResIdByIconType( Context context, int iconType ) {
|
||||
return IconTypeUtils.getResIdByIconType( context, iconType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d( TAG, "init." );
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ class AMapViewHandler {
|
||||
|
||||
public static void createMapView( Context context ) {
|
||||
sMapView = new AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
Logger.d( TAG, "created." );
|
||||
}
|
||||
|
||||
public static IMogoMapView getMapView() {
|
||||
|
||||
@@ -33,13 +33,11 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
implementation rootProject.ext.dependencies.mapamap
|
||||
} else {
|
||||
implementation project(':foudations:mogo-utils')
|
||||
implementation project(':libraries:mogo-map-api')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':services:mogo-service-api')
|
||||
implementation project(':libraries:map-amap')
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,9 @@ import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
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;
|
||||
@@ -169,7 +167,7 @@ public class AutoNaviClient implements IMogoNavi {
|
||||
@Override
|
||||
public MogoNaviConfig getNaviConfig() {
|
||||
Logger.w( TAG, "高德车机导航,不支持此设置" );
|
||||
return NaviClient.getInstance( mContext ).getNaviConfig();
|
||||
return MogoMapApi.getApiBuilder().getNavi( mContext ).getNaviConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -186,12 +184,12 @@ public class AutoNaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCarLocation() {
|
||||
return NaviClient.getInstance( mContext ).getCarLocation();
|
||||
return MogoMapApi.getApiBuilder().getNavi( mContext ).getCarLocation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getCarLocation2() {
|
||||
return NaviClient.getInstance( mContext ).getCarLocation2();
|
||||
return MogoMapApi.getApiBuilder().getNavi( mContext ).getCarLocation2();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -221,11 +219,11 @@ public class AutoNaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void setUseExtraGPSData( boolean use ) {
|
||||
NaviClient.getInstance( mContext ).setUseExtraGPSData( use );
|
||||
MogoMapApi.getApiBuilder().getNavi( mContext ).setUseExtraGPSData( use );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtraGPSData( double lon, double lat, float speed, float accuracy, float bearing, long timestamp ) {
|
||||
NaviClient.getInstance( mContext ).setExtraGPSData( lon, lat, speed, accuracy, bearing, timestamp );
|
||||
MogoMapApi.getApiBuilder().getNavi( mContext ).setExtraGPSData( lon, lat, speed, accuracy, bearing, timestamp );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.content.IntentFilter;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.map.impl.amap.utils.IconTypeUtils;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
@@ -68,7 +67,7 @@ public class AutoNaviReceiver extends BroadcastReceiver {
|
||||
break;
|
||||
case 10056:
|
||||
String json = intent.getStringExtra( "EXTRA_ROAD_INFO" );
|
||||
SpStorage.setNavigationTarget(json);
|
||||
SpStorage.setNavigationTarget( json );
|
||||
Logger.d( TAG, json );
|
||||
break;
|
||||
}
|
||||
@@ -101,7 +100,7 @@ public class AutoNaviReceiver extends BroadcastReceiver {
|
||||
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( IconTypeUtils.getResIdByIconType( context, intent.getIntExtra( GuideInfoExtraKey.NEW_ICON, 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 ) );
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.mogo.map.impl.automap.navi;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.IMogoMapApiBuilder;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/10
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MogoMapApi {
|
||||
|
||||
private static IMogoMapApiBuilder sApiBuilder;
|
||||
|
||||
public static IMogoMapApiBuilder getApiBuilder() {
|
||||
if ( sApiBuilder == null ) {
|
||||
synchronized ( AutoNaviClient.class ) {
|
||||
sApiBuilder = ARouter.getInstance().navigation( IMogoMapApiBuilder.class );
|
||||
}
|
||||
}
|
||||
return sApiBuilder;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,12 @@ android {
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@@ -32,6 +38,10 @@ android {
|
||||
exclude 'META-INF/*'
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -40,6 +50,8 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
// api rootProject.ext.dependencies.amapnavi3dmap
|
||||
// api rootProject.ext.dependencies.amapsearch
|
||||
@@ -55,7 +67,7 @@ dependencies {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-online-30'
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-6.5'
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
@@ -27,12 +26,13 @@ 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 com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.MapParams;
|
||||
import com.zhidaoauto.map.sdk.open.abs.MapStatusListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapClickListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapLoadedListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapStyleListener;
|
||||
import com.zhidaoauto.map.sdk.open.abs.OnMapTouchListener;
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraPosition;
|
||||
import com.zhidaoauto.map.sdk.open.camera.CameraUpdateFactory;
|
||||
@@ -52,8 +52,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, LocationListener, OnMapLoadedListener, MapStatusListener, OnCameraChangeListener,
|
||||
OnMapClickListener, OnMapTouchListener, OnMarkClickListener {
|
||||
public class AMapViewWrapper implements IMogoMapView,
|
||||
IMogoMapUIController,
|
||||
LocationListener,
|
||||
OnMapLoadedListener,
|
||||
MapStatusListener,
|
||||
OnCameraChangeListener,
|
||||
OnMapClickListener,
|
||||
OnMapTouchListener,
|
||||
OnMarkClickListener,
|
||||
OnMapStyleListener {
|
||||
|
||||
private static final String TAG = "AMapViewWrapper";
|
||||
private final MapAutoView mMapView;
|
||||
@@ -73,6 +81,8 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
.build();
|
||||
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
|
||||
|
||||
private Location mLastDriveLocationShadow = null;
|
||||
|
||||
public AMapViewWrapper( MapAutoView mMapView ) {
|
||||
startTime = System.currentTimeMillis();
|
||||
Logger.i( TAG, "autoop--AMapViewWrapper: init" );
|
||||
@@ -163,7 +173,6 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
|
||||
// mMapView.setOnPolylineClickListener( this );
|
||||
// mMapView.setAMapNaviViewListener( this );
|
||||
// mMapView.setOnCameraChangeListener( this );
|
||||
//
|
||||
// final AMap aMap = mMapView.getMap();
|
||||
// if ( aMap != null ) {
|
||||
@@ -195,8 +204,7 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
mMapView.onCreate( bundle );
|
||||
Logger.d( TAG, "map onCreate" );
|
||||
initMapView();
|
||||
|
||||
// initMyLocation();
|
||||
initMyLocation();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +248,7 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
@Override
|
||||
public void setTrafficEnabled( boolean visible ) {
|
||||
if ( checkAMapView() ) {
|
||||
// mMapView.getMapAutoViewHelper().setTraffic(visible);
|
||||
mMapView.getMapAutoViewHelper().setTraffic( visible );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,28 +300,29 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
return;
|
||||
}
|
||||
if ( checkAMapView() ) {
|
||||
// switch (ui) {
|
||||
// case CarUp_2D:
|
||||
// case CarUp_3D:
|
||||
// case NorthUP_2D:
|
||||
// break;
|
||||
// case Type_VR:
|
||||
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR);
|
||||
// //setUIMode( ui, options );
|
||||
// return;
|
||||
// case Type_Light:
|
||||
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(false);
|
||||
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_DAY);
|
||||
// break;
|
||||
// case Type_Night:
|
||||
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(false);
|
||||
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_NIGHT);
|
||||
// break;
|
||||
// case Type_AUTO_LIGHT_Night:
|
||||
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(true);
|
||||
// break;
|
||||
}
|
||||
switch ( ui ) {
|
||||
case CarUp_2D:
|
||||
case CarUp_3D:
|
||||
case NorthUP_2D:
|
||||
break;
|
||||
case Type_VR:
|
||||
mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_VR );
|
||||
setUIMode( ui );
|
||||
return;
|
||||
case Type_Light:
|
||||
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false );
|
||||
mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_DAY );
|
||||
break;
|
||||
case Type_Night:
|
||||
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false );
|
||||
mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_NIGHT );
|
||||
break;
|
||||
case Type_AUTO_LIGHT_Night:
|
||||
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( true );
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -442,7 +451,6 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float getScalePerPixel() {
|
||||
return getMap().getScalePerPixel();
|
||||
@@ -458,7 +466,6 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
return ObjectUtils.fromAMap( MapTools.INSTANCE.getVisibleRegion().getRightTopPoint() );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraSouthWestPosition() {
|
||||
try {
|
||||
@@ -482,11 +489,8 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
@Override
|
||||
public void setPointToCenter( double mapCenterX, double mapCenterY ) {
|
||||
if ( checkAMapView() ) {
|
||||
// if (DebugConfig.isDebug()) {
|
||||
// Logger.d(TAG, Log.getStackTraceString(new Throwable()));
|
||||
// }
|
||||
// Logger.d( TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY );
|
||||
// mMapView.getMapAutoViewHelper().setPointToCenter( ( float ) mapCenterX, ( float ) mapCenterY );
|
||||
Logger.d( TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY );
|
||||
mMapView.getMapAutoViewHelper().setPointToCenter( ( float ) mapCenterX, ( float ) mapCenterY );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,7 +662,21 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
sysLocation.setAltitude( location.getAltitude() );
|
||||
sysLocation.setLatitude( location.getLat() );
|
||||
sysLocation.setLongitude( location.getLon() );
|
||||
sysLocation.setProvider( location.getProvider() );
|
||||
sysLocation.setAccuracy( location.getAcceleration() );
|
||||
sysLocation.setTime( location.getDuration() );
|
||||
sysLocation.setBearing( location.getHeading() );
|
||||
sysLocation.setSpeed( location.getSpeed() );
|
||||
|
||||
if ( sysLocation.getSpeed() > 0 ) {
|
||||
mLastDriveLocationShadow = sysLocation;
|
||||
} else {
|
||||
if ( ( int ) sysLocation.getBearing() == 0
|
||||
&& mLastDriveLocationShadow != null ) {
|
||||
// TODO: 2020/12/12 停车时自车图标方向调整
|
||||
}
|
||||
}
|
||||
|
||||
NaviClient.getInstance( getContext() ).syncCarLocation( sysLocation );
|
||||
}
|
||||
|
||||
@@ -741,4 +759,11 @@ public class AMapViewWrapper implements IMogoMapView, IMogoMapUIController, Loca
|
||||
public void emphasizeMyLocation() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeMapStyle( int i ) {
|
||||
if ( i == MapParams.MAP_STYLE_VR ) {
|
||||
MogoMapListenerHandler.getInstance().onMapModeChanged( EnumMapUI.Type_VR );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.IMogoMapApiBuilder;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.MapApiPath;
|
||||
import com.mogo.map.impl.custom.location.ALocationClient;
|
||||
import com.mogo.map.impl.custom.navi.NaviClient;
|
||||
import com.mogo.map.impl.custom.search.GeocodeSearchClient;
|
||||
import com.mogo.map.impl.custom.search.InputtipsSearch;
|
||||
import com.mogo.map.impl.custom.search.PoiSearchClient;
|
||||
import com.mogo.map.impl.custom.search.RoadSearchClient;
|
||||
import com.mogo.map.impl.custom.uicontroller.AMapUIController;
|
||||
import com.mogo.map.impl.custom.utils.IconTypeUtils;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.search.drive.IMogoRoadSearch;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.MapParams;
|
||||
import com.zhidaoauto.map.sdk.open.NavAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.NavParams;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/9
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = MapApiPath.PATH )
|
||||
class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
|
||||
private static final String TAG = "CustomMapApiBuilder";
|
||||
|
||||
@Override
|
||||
public IMogoGeoSearch getGeoSearch( Context context ) {
|
||||
return new GeocodeSearchClient( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoInputtipsSearch getInputtipsSearch( Context context, MogoInputtipsQuery query ) {
|
||||
return new InputtipsSearch( context, query );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationClient getLocationClient( Context context ) {
|
||||
return new ALocationClient( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapUIController getMapUIController() {
|
||||
return AMapUIController.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoNavi getNavi( Context context ) {
|
||||
return NaviClient.getInstance( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoPoiSearch getPoiSearchClient( Context context, MogoPoiSearchQuery query ) {
|
||||
return new PoiSearchClient( context, query );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoRoadSearch getRoadSearch() {
|
||||
return new RoadSearchClient();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoAimless getAimless( Context context ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMapView( Context context ) {
|
||||
// do not implements.
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapView getMapView( Context context ) {
|
||||
NavAutoApi.INSTANCE.init( context, MapParams.Companion.init()
|
||||
// .setCachePath( "sdcard/tiles_vr" )
|
||||
.setStyleDir( "sdcard/shmdata_asset/mogo_style" )
|
||||
.setHdmapPath( "sdcard/shmdata/hdmapData" )
|
||||
.setDebugMode( true )
|
||||
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
|
||||
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
|
||||
.setZoom( 16 )
|
||||
.setPointToCenter( 0.5f, 0.8f )
|
||||
.setStyleMode( MapParams.MAP_STYLE_NIGHT ) , NavParams.Companion.init() );
|
||||
MapAutoView mapAutoView = new MapAutoView( context );
|
||||
IMogoMapView mapView = new AMapViewWrapper( mapAutoView );
|
||||
return mapView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoTrafficSearch getTrafficSearch() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResIdByIconType( Context context, int iconType ) {
|
||||
return IconTypeUtils.getResIdByIconType( context, iconType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d( TAG, "init" );
|
||||
}
|
||||
}
|
||||
@@ -24,12 +24,13 @@ public class CustomMapView implements IMogoMapViewCreator {
|
||||
@Override
|
||||
public IMogoMapView create( Context context ) {
|
||||
if ( mapView == null ) {
|
||||
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init().setDebugMode( false )
|
||||
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init()
|
||||
.setCachePath( "sdcard/tiles_vr" )
|
||||
.setDebugMode( false )
|
||||
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
|
||||
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
|
||||
.setZoom( 16 )
|
||||
.setPointToCenter( 0.5f, 0.8f )
|
||||
.setStyleMode( MapParams.MAP_STYLE_VR ) );
|
||||
.setPointToCenter( 0.5f, 0.8f ) );
|
||||
}
|
||||
MapAutoView mapAutoView = new MapAutoView( context );
|
||||
mapView = new AMapViewWrapper( mapAutoView );
|
||||
|
||||
@@ -12,64 +12,125 @@ import android.util.SparseArray;
|
||||
*/
|
||||
public class IconTypeUtils {
|
||||
|
||||
public class IconType {
|
||||
public static final int NONE = 0;
|
||||
public static final int DEFAULT = 1;
|
||||
public static final int LEFT = 2;
|
||||
public static final int RIGHT = 3;
|
||||
public static final int LEFT_FRONT = 4;
|
||||
public static final int RIGHT_FRONT = 5;
|
||||
public static final int LEFT_BACK = 6;
|
||||
public static final int RIGHT_BACK = 7;
|
||||
public static final int LEFT_TURN_AROUND = 8;
|
||||
public static final int STRAIGHT = 9;
|
||||
public static final int ARRIVED_WAYPOINT = 10;
|
||||
public static final int ENTER_ROUNDABOUT = 11;
|
||||
public static final int OUT_ROUNDABOUT = 12;
|
||||
public static final int ARRIVED_SERVICE_AREA = 13;
|
||||
public static final int ARRIVED_TOLLGATE = 14;
|
||||
public static final int ARRIVED_DESTINATION = 15;
|
||||
public static final int ARRIVED_TUNNEL = 16;
|
||||
public static final int ENTRY_LEFT_RING = 17;
|
||||
public static final int LEAVE_LEFT_RING = 18;
|
||||
public static final int U_TURN_RIGHT = 19;
|
||||
public static final int SPECIAL_CONTINUE = 20;
|
||||
public static final int ENTRY_RING_LEFT = 21;
|
||||
public static final int ENTRY_RING_RIGHT = 22;
|
||||
public static final int ENTRY_RING_CONTINUE = 23;
|
||||
public static final int ENTRY_RING_UTURN = 24;
|
||||
public static final int ENTRY_LEFT_RING_LEFT = 25;
|
||||
public static final int ENTRY_LEFT_RING_RIGHT = 26;
|
||||
public static final int ENTRY_LEFT_RING_CONTINUE = 27;
|
||||
public static final int ENTRY_LEFTRINGU_TURN = 28;
|
||||
public static final int CROSSWALK = 29;
|
||||
public static final int OVERPASS = 30;
|
||||
public static final int UNDERPASS = 31;
|
||||
public static final int SQUARE = 32;
|
||||
public static final int PARK = 33;
|
||||
public static final int STAIRCASE = 34;
|
||||
public static final int LIFT = 35;
|
||||
public static final int CABLEWAY = 36;
|
||||
public static final int SKY_CHANNEL = 37;
|
||||
public static final int CHANNEL = 38;
|
||||
public static final int WALK_ROAD = 39;
|
||||
public static final int CRUISE_ROUTE = 40;
|
||||
public static final int SIGHTSEEING_BUSLINE = 41;
|
||||
public static final int SLIDEWAY = 42;
|
||||
public static final int LADDER = 43;
|
||||
public static final int SLOPE = 44;
|
||||
public static final int BRIDGE = 45;
|
||||
public static final int FERRY = 46;
|
||||
public static final int SUBWAY = 47;
|
||||
public static final int ENTER_BUILDING = 48;
|
||||
public static final int LEAVE_BUILDING = 49;
|
||||
public static final int BY_ELEVATOR = 50;
|
||||
public static final int BY_STAIR = 51;
|
||||
public static final int BY_ESCALATOR = 52;
|
||||
public static final int LOW_TRAFFIC_CROSS = 53;
|
||||
public static final int LOW_CROSS = 54;
|
||||
|
||||
public IconType() {
|
||||
}
|
||||
}
|
||||
|
||||
private static SparseArray< String > sIconName = new SparseArray<>();
|
||||
|
||||
static {
|
||||
// sIconName.put( IconType.ARRIVED_DESTINATION, "到达目的地" );
|
||||
// sIconName.put( IconType.ARRIVED_SERVICE_AREA, "到达服务区" );
|
||||
// sIconName.put( IconType.ARRIVED_TOLLGATE, "到达收费站" );
|
||||
// sIconName.put( IconType.ARRIVED_TUNNEL, "到达隧道" );
|
||||
// sIconName.put( IconType.ARRIVED_WAYPOINT, "到达途经点" );
|
||||
// sIconName.put( IconType.BRIDGE, "通过桥" );
|
||||
// sIconName.put( IconType.BY_ELEVATOR, "电梯换层" );
|
||||
// sIconName.put( IconType.BY_ESCALATOR, "扶梯换层" );
|
||||
// sIconName.put( IconType.BY_STAIR, "楼梯换层" );
|
||||
// sIconName.put( IconType.CABLEWAY, "通过索道" );
|
||||
// sIconName.put( IconType.CHANNEL, "通过通道" );
|
||||
// sIconName.put( IconType.CROSSWALK, "通过人行横道" );
|
||||
// sIconName.put( IconType.CRUISE_ROUTE, "通过游船路线" );
|
||||
// sIconName.put( IconType.DEFAULT, "自车" );
|
||||
// sIconName.put( IconType.ENTER_BUILDING, "进入建筑物" );
|
||||
// sIconName.put( IconType.ENTER_ROUNDABOUT, "进入环岛" );
|
||||
// sIconName.put( IconType.ENTRY_LEFT_RING, "进入环岛" );
|
||||
// sIconName.put( IconType.ENTRY_LEFT_RING_CONTINUE, "绕环岛直行" );
|
||||
// sIconName.put( IconType.ENTRY_LEFT_RING_LEFT, "绕环岛左转" );
|
||||
// sIconName.put( IconType.ENTRY_LEFT_RING_RIGHT, "绕环岛右转" );
|
||||
// sIconName.put( IconType.ENTRY_LEFTRINGU_TURN, "绕环岛调头" );
|
||||
// sIconName.put( IconType.ENTRY_RING_CONTINUE, "绕环岛直行" );
|
||||
// sIconName.put( IconType.ENTRY_RING_LEFT, "绕环岛左转" );
|
||||
// sIconName.put( IconType.ENTRY_RING_RIGHT, "绕环岛右转" );
|
||||
// sIconName.put( IconType.ENTRY_RING_UTURN, "绕环岛调头" );
|
||||
// sIconName.put( IconType.FERRY, "通过轮渡" );
|
||||
// sIconName.put( IconType.LADDER, "通过阶梯" );
|
||||
// sIconName.put( IconType.LEAVE_BUILDING, "离开建筑物" );
|
||||
// sIconName.put( IconType.LEAVE_LEFT_RING, "驶出环岛" );
|
||||
// sIconName.put( IconType.LEFT, "左转" );
|
||||
// sIconName.put( IconType.LEFT_BACK, "左后" );
|
||||
// sIconName.put( IconType.LEFT_FRONT, "左前方" );
|
||||
// sIconName.put( IconType.LEFT_TURN_AROUND, "左转掉头" );
|
||||
// sIconName.put( IconType.LIFT, "通过直梯" );
|
||||
// sIconName.put( IconType.LOW_CROSS, "通过普通路口" );
|
||||
// sIconName.put( IconType.LOW_TRAFFIC_CROSS, "红绿灯路口" );
|
||||
// sIconName.put( IconType.NONE, "无定义" );
|
||||
// sIconName.put( IconType.OUT_ROUNDABOUT, "驶出环岛" );
|
||||
// sIconName.put( IconType.OVERPASS, "通过过街天桥" );
|
||||
// sIconName.put( IconType.PARK, "通过公园" );
|
||||
// sIconName.put( IconType.RIGHT, "右转" );
|
||||
// sIconName.put( IconType.RIGHT_BACK, "右后方" );
|
||||
// sIconName.put( IconType.RIGHT_FRONT, "右前方" );
|
||||
// sIconName.put( IconType.SIGHTSEEING_BUSLINE, "通过观光车路线" );
|
||||
// sIconName.put( IconType.SKY_CHANNEL, "通过空中通道" );
|
||||
// sIconName.put( IconType.SLIDEWAY, "通过滑道" );
|
||||
// sIconName.put( IconType.SLOPE, "通过斜坡" );
|
||||
// sIconName.put( IconType.SPECIAL_CONTINUE, "顺行" );
|
||||
// sIconName.put( IconType.SQUARE, "通过广场" );
|
||||
// sIconName.put( IconType.STAIRCASE, "通过扶梯" );
|
||||
// sIconName.put( IconType.STRAIGHT, "直行" );
|
||||
// sIconName.put( IconType.SUBWAY, "通过地铁通道" );
|
||||
// sIconName.put( IconType.U_TURN_RIGHT, "右转掉头" );
|
||||
// sIconName.put( IconType.UNDERPASS, "通过地下通道" );
|
||||
// sIconName.put( IconType.WALK_ROAD, "通过行人道路" );
|
||||
sIconName.put( IconType.ARRIVED_DESTINATION, "到达目的地" );
|
||||
sIconName.put( IconType.ARRIVED_SERVICE_AREA, "到达服务区" );
|
||||
sIconName.put( IconType.ARRIVED_TOLLGATE, "到达收费站" );
|
||||
sIconName.put( IconType.ARRIVED_TUNNEL, "到达隧道" );
|
||||
sIconName.put( IconType.ARRIVED_WAYPOINT, "到达途经点" );
|
||||
sIconName.put( IconType.BRIDGE, "通过桥" );
|
||||
sIconName.put( IconType.BY_ELEVATOR, "电梯换层" );
|
||||
sIconName.put( IconType.BY_ESCALATOR, "扶梯换层" );
|
||||
sIconName.put( IconType.BY_STAIR, "楼梯换层" );
|
||||
sIconName.put( IconType.CABLEWAY, "通过索道" );
|
||||
sIconName.put( IconType.CHANNEL, "通过通道" );
|
||||
sIconName.put( IconType.CROSSWALK, "通过人行横道" );
|
||||
sIconName.put( IconType.CRUISE_ROUTE, "通过游船路线" );
|
||||
sIconName.put( IconType.DEFAULT, "自车" );
|
||||
sIconName.put( IconType.ENTER_BUILDING, "进入建筑物" );
|
||||
sIconName.put( IconType.ENTER_ROUNDABOUT, "进入环岛" );
|
||||
sIconName.put( IconType.ENTRY_LEFT_RING, "进入环岛" );
|
||||
sIconName.put( IconType.ENTRY_LEFT_RING_CONTINUE, "绕环岛直行" );
|
||||
sIconName.put( IconType.ENTRY_LEFT_RING_LEFT, "绕环岛左转" );
|
||||
sIconName.put( IconType.ENTRY_LEFT_RING_RIGHT, "绕环岛右转" );
|
||||
sIconName.put( IconType.ENTRY_LEFTRINGU_TURN, "绕环岛调头" );
|
||||
sIconName.put( IconType.ENTRY_RING_CONTINUE, "绕环岛直行" );
|
||||
sIconName.put( IconType.ENTRY_RING_LEFT, "绕环岛左转" );
|
||||
sIconName.put( IconType.ENTRY_RING_RIGHT, "绕环岛右转" );
|
||||
sIconName.put( IconType.ENTRY_RING_UTURN, "绕环岛调头" );
|
||||
sIconName.put( IconType.FERRY, "通过轮渡" );
|
||||
sIconName.put( IconType.LADDER, "通过阶梯" );
|
||||
sIconName.put( IconType.LEAVE_BUILDING, "离开建筑物" );
|
||||
sIconName.put( IconType.LEAVE_LEFT_RING, "驶出环岛" );
|
||||
sIconName.put( IconType.LEFT, "左转" );
|
||||
sIconName.put( IconType.LEFT_BACK, "左后" );
|
||||
sIconName.put( IconType.LEFT_FRONT, "左前方" );
|
||||
sIconName.put( IconType.LEFT_TURN_AROUND, "左转掉头" );
|
||||
sIconName.put( IconType.LIFT, "通过直梯" );
|
||||
sIconName.put( IconType.LOW_CROSS, "通过普通路口" );
|
||||
sIconName.put( IconType.LOW_TRAFFIC_CROSS, "红绿灯路口" );
|
||||
sIconName.put( IconType.NONE, "无定义" );
|
||||
sIconName.put( IconType.OUT_ROUNDABOUT, "驶出环岛" );
|
||||
sIconName.put( IconType.OVERPASS, "通过过街天桥" );
|
||||
sIconName.put( IconType.PARK, "通过公园" );
|
||||
sIconName.put( IconType.RIGHT, "右转" );
|
||||
sIconName.put( IconType.RIGHT_BACK, "右后方" );
|
||||
sIconName.put( IconType.RIGHT_FRONT, "右前方" );
|
||||
sIconName.put( IconType.SIGHTSEEING_BUSLINE, "通过观光车路线" );
|
||||
sIconName.put( IconType.SKY_CHANNEL, "通过空中通道" );
|
||||
sIconName.put( IconType.SLIDEWAY, "通过滑道" );
|
||||
sIconName.put( IconType.SLOPE, "通过斜坡" );
|
||||
sIconName.put( IconType.SPECIAL_CONTINUE, "顺行" );
|
||||
sIconName.put( IconType.SQUARE, "通过广场" );
|
||||
sIconName.put( IconType.STAIRCASE, "通过扶梯" );
|
||||
sIconName.put( IconType.STRAIGHT, "直行" );
|
||||
sIconName.put( IconType.SUBWAY, "通过地铁通道" );
|
||||
sIconName.put( IconType.U_TURN_RIGHT, "右转掉头" );
|
||||
sIconName.put( IconType.UNDERPASS, "通过地下通道" );
|
||||
sIconName.put( IconType.WALK_ROAD, "通过行人道路" );
|
||||
}
|
||||
|
||||
private static int lastIconType = 0;
|
||||
|
||||
@@ -59,12 +59,12 @@ import java.util.List;
|
||||
*/
|
||||
public class ObjectUtils {
|
||||
|
||||
public static MarkerOptions fromMogo(MogoMarkerOptions opt ) {
|
||||
public static MarkerOptions fromMogo( MogoMarkerOptions opt ) {
|
||||
|
||||
if ( opt == null ) {
|
||||
return null;
|
||||
}
|
||||
ArrayList<BitmapDescriptor> descriptors = new ArrayList<>();
|
||||
ArrayList< BitmapDescriptor > descriptors = new ArrayList<>();
|
||||
final ArrayList< Bitmap > icons = opt.getIcons();
|
||||
if ( icons != null && !icons.isEmpty() ) {
|
||||
for ( Bitmap icon : icons ) {
|
||||
@@ -72,14 +72,14 @@ public class ObjectUtils {
|
||||
continue;
|
||||
}
|
||||
|
||||
descriptors.add( new BitmapDescriptor(icon) );
|
||||
descriptors.add( new BitmapDescriptor( icon ) );
|
||||
}
|
||||
}
|
||||
BitmapDescriptor descriptor = getBitmapDescriptorFromMogo( opt );
|
||||
|
||||
MarkerOptions markerOptions = new MarkerOptions()
|
||||
.position( new LonLatPoint(opt.getLongitude(), opt.getLatitude() ) )
|
||||
.markerIcon(descriptor )
|
||||
MarkerOptions markerOptions = new MarkerOptions()
|
||||
.position( new LonLatPoint( opt.getLongitude(), opt.getLatitude() ) )
|
||||
.markerIcon( descriptor )
|
||||
.anchor( opt.getU(), opt.getV() )
|
||||
// .icons( descriptors )
|
||||
// .period( opt.getPeriod() )
|
||||
@@ -92,11 +92,11 @@ public class ObjectUtils {
|
||||
// .draggable( opt.isDraggable() )
|
||||
.setInfoWindowOffset( opt.getOffsetX(), opt.getOffsetY() )
|
||||
.zIndex( opt.getzIndex() );
|
||||
if(!TextUtils.isEmpty(opt.getTitle())){
|
||||
markerOptions.title(opt.getTitle());
|
||||
if ( !TextUtils.isEmpty( opt.getTitle() ) ) {
|
||||
markerOptions.title( opt.getTitle() );
|
||||
}
|
||||
if(!TextUtils.isEmpty(opt.getSnippet())){
|
||||
markerOptions.snippet(opt.getSnippet());
|
||||
if ( !TextUtils.isEmpty( opt.getSnippet() ) ) {
|
||||
markerOptions.snippet( opt.getSnippet() );
|
||||
}
|
||||
return markerOptions;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ public class ObjectUtils {
|
||||
if ( latLng == null ) {
|
||||
return null;
|
||||
}
|
||||
return new LonLatPoint( latLng.lon,latLng.lat);
|
||||
return new LonLatPoint( latLng.lon, latLng.lat );
|
||||
}
|
||||
|
||||
// public static NaviLatLng fromMogoAsNavi( MogoLatLng latLng ) {
|
||||
@@ -194,7 +194,7 @@ public class ObjectUtils {
|
||||
return q;
|
||||
}
|
||||
|
||||
public static RegeocodeQuery fromMogo(MogoRegeocodeQuery query ) {
|
||||
public static RegeocodeQuery fromMogo( MogoRegeocodeQuery query ) {
|
||||
if ( query == null ) {
|
||||
return null;
|
||||
}
|
||||
@@ -264,7 +264,7 @@ public class ObjectUtils {
|
||||
}
|
||||
MogoGeocodeResult mogoGeocodeResult = new MogoGeocodeResult();
|
||||
final List< MogoGeocodeAddress > addresses = new ArrayList<>();
|
||||
List< GeocodeAddress > list = result.getGeocodeAddressList();
|
||||
List< GeocodeAddress > list = result.getGeocodeAddressList();
|
||||
for ( GeocodeAddress geocodeAddress : list ) {
|
||||
final MogoGeocodeAddress mogoGeocodeAddress = fromAMap( geocodeAddress );
|
||||
if ( mogoGeocodeAddress != null ) {
|
||||
@@ -348,7 +348,7 @@ public class ObjectUtils {
|
||||
// return mogoSubPoiItem;
|
||||
// }
|
||||
|
||||
public static MogoPoiItem fromAMap( PoiItem poiItem) {
|
||||
public static MogoPoiItem fromAMap( PoiItem poiItem ) {
|
||||
if ( poiItem == null ) {
|
||||
return null;
|
||||
}
|
||||
@@ -450,7 +450,7 @@ public class ObjectUtils {
|
||||
mogoRegeocodeAddress.setNeighborhood( regeocodeAddress.getNeighborhood() );
|
||||
if ( regeocodeAddress.getPoiList() != null ) {
|
||||
List< MogoPoiItem > mogoPoiItems = new ArrayList<>();
|
||||
List<PoiItem> list = regeocodeAddress.getPoiList();
|
||||
List< PoiItem > list = regeocodeAddress.getPoiList();
|
||||
for ( PoiItem pois : list ) {
|
||||
MogoPoiItem mogoPoiItem = fromAMap( pois );
|
||||
mogoPoiItems.add( mogoPoiItem );
|
||||
@@ -483,7 +483,7 @@ public class ObjectUtils {
|
||||
return mogoRegeocodeResult;
|
||||
}
|
||||
|
||||
public static InputtipsQuery fromMogo(MogoInputtipsQuery query ) {
|
||||
public static InputtipsQuery fromMogo( MogoInputtipsQuery query ) {
|
||||
if ( query == null ) {
|
||||
return null;
|
||||
}
|
||||
@@ -534,14 +534,14 @@ public class ObjectUtils {
|
||||
return mogoPoiSearchQuery;
|
||||
}
|
||||
|
||||
public static Query fromMogo(MogoPoiSearchQuery query ) {
|
||||
if ( query == null || query.getQuery() == null) {
|
||||
public static Query fromMogo( MogoPoiSearchQuery query ) {
|
||||
if ( query == null || query.getQuery() == null ) {
|
||||
return null;
|
||||
}
|
||||
Query psq = new Query(query.getQuery(), "", "");
|
||||
String category = getCategory(query.getQuery());
|
||||
if(!category.equals(""))
|
||||
psq = new Query( "", "", getCategory(query.getQuery()));
|
||||
Query psq = new Query( query.getQuery(), "", "" );
|
||||
String category = getCategory( query.getQuery() );
|
||||
if ( !category.equals( "" ) )
|
||||
psq = new Query( "", "", getCategory( query.getQuery() ) );
|
||||
// psq.setBuilding( query.getBuilding() );
|
||||
psq.setCityLimit( query.isCityLimit() );
|
||||
psq.setDistanceSort( query.isDistanceSort() );
|
||||
@@ -608,7 +608,7 @@ public class ObjectUtils {
|
||||
}
|
||||
MogoPoiResult mogoPoiResult = new MogoPoiResult();
|
||||
if ( result.getItems() != null ) {
|
||||
final List<PoiSearchItem> poiItems = result.getItems();
|
||||
final List< PoiSearchItem > poiItems = result.getItems();
|
||||
final ArrayList< MogoPoiItem > mogoPoiItems = new ArrayList<>( poiItems.size() );
|
||||
for ( PoiSearchItem poiItem : poiItems ) {
|
||||
mogoPoiItems.add( fromAMap( poiItem.getPoi() ) );
|
||||
@@ -692,7 +692,7 @@ public class ObjectUtils {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public static PolylineOptions fromMogo(MogoPolylineOptions options ) {
|
||||
public static PolylineOptions fromMogo( MogoPolylineOptions options ) {
|
||||
if ( options == null ) {
|
||||
return null;
|
||||
}
|
||||
@@ -705,11 +705,11 @@ public class ObjectUtils {
|
||||
target.setLonLatPoints( points );
|
||||
}
|
||||
target.setLineWidth( options.getWidth() );
|
||||
target.setColor( options.getColor() );
|
||||
target.setColor( options.getColor());
|
||||
// target.zIndex( options.getWidth() );
|
||||
// target.visible( options.isVisible() );
|
||||
//// target.geodesic( options.isGeodesic() );
|
||||
target.setDottedLine( options.isDottedLine() );
|
||||
// target.setDottedLine( options.isDottedLine() );
|
||||
target.useGradient( options.isGradient() );
|
||||
if ( options.getColorValues() != null ) {
|
||||
target.colorValues( options.getColorValues() );
|
||||
@@ -736,17 +736,17 @@ public class ObjectUtils {
|
||||
return new MapCameraPosition( fromAMap( position.getTarget() ), position.getBearing(), position.getTilt(), position.getZoom() );
|
||||
}
|
||||
|
||||
private static String getCategory(String key){
|
||||
private static String getCategory( String key ) {
|
||||
String category = "";
|
||||
if(key.equals("加油站")){
|
||||
category= "6";
|
||||
}else if(key.equals("停车场")){
|
||||
category= "12";
|
||||
}else if(key.equals("餐馆")){
|
||||
category= "22";
|
||||
}else if(key.equals("洗车")){
|
||||
category= "8";
|
||||
}else if(key.equals("厕所")){
|
||||
if ( key.equals( "加油站" ) ) {
|
||||
category = "6";
|
||||
} else if ( key.equals( "停车场" ) ) {
|
||||
category = "12";
|
||||
} else if ( key.equals( "餐馆" ) ) {
|
||||
category = "22";
|
||||
} else if ( key.equals( "洗车" ) ) {
|
||||
category = "8";
|
||||
} else if ( key.equals( "厕所" ) ) {
|
||||
|
||||
}
|
||||
return category;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_map_amap_my_location_bg_size">360px</dimen>
|
||||
<dimen name="module_map_amap_my_location_icon_width">63px</dimen>
|
||||
<dimen name="module_map_amap_my_location_icon_height">96px</dimen>
|
||||
</resources>
|
||||
@@ -1,4 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="path_width">60px</dimen>
|
||||
<dimen name="module_map_amap_my_location_icon_width">36px</dimen>
|
||||
<dimen name="module_map_amap_my_location_icon_height">53px</dimen>
|
||||
<dimen name="module_map_amap_my_location_bg_size">194px</dimen>
|
||||
</resources>
|
||||
@@ -31,6 +31,7 @@ dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
api rootProject.ext.dependencies.arouter
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.search.drive.IMogoRoadSearch;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/9
|
||||
*
|
||||
* 地图实例构建
|
||||
*/
|
||||
interface IMogoMapApiBuilder extends IProvider {
|
||||
|
||||
IMogoGeoSearch getGeoSearch( Context context );
|
||||
|
||||
IMogoInputtipsSearch getInputtipsSearch( Context context, MogoInputtipsQuery query );
|
||||
|
||||
IMogoLocationClient getLocationClient( Context context );
|
||||
|
||||
IMogoMapUIController getMapUIController();
|
||||
|
||||
IMogoNavi getNavi( Context context );
|
||||
|
||||
IMogoPoiSearch getPoiSearchClient( Context context, MogoPoiSearchQuery query );
|
||||
|
||||
IMogoRoadSearch getRoadSearch();
|
||||
|
||||
IMogoAimless getAimless( Context context );
|
||||
|
||||
void createMapView( Context context );
|
||||
|
||||
void destroy();
|
||||
|
||||
IMogoMapView getMapView( Context context );
|
||||
|
||||
IMogoTrafficSearch getTrafficSearch();
|
||||
|
||||
int getResIdByIconType( Context context, int iconType );
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.map;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/9
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MapApiPath {
|
||||
|
||||
public static final String PATH = "/mogomap/api";
|
||||
}
|
||||
@@ -20,9 +20,6 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
|
||||
|
||||
protected IMogoMapView mMapView;
|
||||
|
||||
protected IMogoMapView mAMapView;
|
||||
protected IMogoMapView mCustomMapView;
|
||||
|
||||
public MogoBaseMapView( Context context ) {
|
||||
this( context, null );
|
||||
}
|
||||
@@ -37,14 +34,10 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
|
||||
}
|
||||
|
||||
private void init( Context context ) {
|
||||
addDleMaps();
|
||||
addMapView( context );
|
||||
}
|
||||
|
||||
protected abstract void addDleMaps();
|
||||
|
||||
public abstract void display2DMap( boolean invokeCreateAuto, boolean invokeResumeAuto );
|
||||
|
||||
public abstract void displayVRMap( boolean invokeCreateAuto, boolean invokeResumeAuto );
|
||||
protected abstract void addMapView( Context context );
|
||||
|
||||
@Override
|
||||
public void onCreate( Bundle bundle ) {
|
||||
|
||||
@@ -24,19 +24,17 @@ android {
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.callchatprovider
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
api rootProject.ext.dependencies.mapamap
|
||||
api rootProject.ext.dependencies.mapcustom
|
||||
api rootProject.ext.dependencies.mapautomap
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
} else {
|
||||
implementation project(':foudations:mogo-utils')
|
||||
implementation project(':libraries:mogo-map-api')
|
||||
api project(':libraries:map-amap')
|
||||
api project(':libraries:map-custom')
|
||||
api project(':libraries:map-autonavi')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
@@ -2,9 +2,7 @@ package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.impl.amap.navi.AimlessClient;
|
||||
import com.mogo.map.navi.IMogoAimless;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
@@ -18,15 +16,15 @@ public class MogoAimless implements IMogoAimless {
|
||||
|
||||
private static volatile MogoAimless sInstance;
|
||||
|
||||
private MogoAimless(Context context) {
|
||||
mDelegate = AimlessClient.getInstance(context);
|
||||
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);
|
||||
public static MogoAimless getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoAimless.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoAimless( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,22 +37,22 @@ public class MogoAimless implements IMogoAimless {
|
||||
|
||||
@Override
|
||||
public void startAimlessMode() {
|
||||
if (mDelegate != null) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.startAimlessMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopAimlessMode() {
|
||||
if (mDelegate != null) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.stopAimlessMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAimlessModeStatus(boolean open) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.setAimlessModeStatus(open);
|
||||
public void setAimlessModeStatus( boolean open ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.setAimlessModeStatus( open );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.map;
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.impl.amap.search.GeocodeSearchClient;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearchListener;
|
||||
import com.mogo.map.search.geo.MogoGeocodeAddress;
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.impl.amap.search.InputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsListener;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
|
||||
@@ -2,8 +2,6 @@ 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;
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.opengl.Visibility;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.impl.amap.location.ALocationClient;
|
||||
import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
import com.mogo.map.impl.amap.search.GeocodeSearchClient;
|
||||
import com.mogo.map.impl.amap.search.InputtipsSearch;
|
||||
import com.mogo.map.impl.amap.search.PoiSearchClient;
|
||||
import com.mogo.map.impl.amap.search.RoadSearchClient;
|
||||
import com.mogo.map.impl.amap.uicontroller.AMapUIController;
|
||||
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.drive.IMogoRoadSearch;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
@@ -20,9 +14,9 @@ import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.utils.AppUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -34,72 +28,109 @@ class MogoMapDelegateFactory {
|
||||
|
||||
private static final String TAG = "MogoMapDelegateFactory";
|
||||
|
||||
private static boolean useCustom = false;
|
||||
// private static boolean useCustom = false;
|
||||
//
|
||||
// public static boolean isUseCustom() {
|
||||
// return useCustom;
|
||||
// }
|
||||
|
||||
public static boolean isUseCustom() {
|
||||
return useCustom;
|
||||
private static IMogoMapApiBuilder sApiBuilder;
|
||||
|
||||
private static IMogoMapApiBuilder getApiBuilder() {
|
||||
if ( sApiBuilder == null ) {
|
||||
synchronized ( MogoMapDelegateFactory.class ) {
|
||||
if ( sApiBuilder == null ) {
|
||||
sApiBuilder = ARouter.getInstance().navigation( IMogoMapApiBuilder.class );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sApiBuilder;
|
||||
}
|
||||
|
||||
public static IMogoGeoSearch getGeoSearchDelegate( Context context ) {
|
||||
if ( useCustom ) {
|
||||
Logger.d( TAG, "use custom IMogoGeoSearch" );
|
||||
return new com.mogo.map.impl.custom.search.GeocodeSearchClient( context );
|
||||
}
|
||||
return new GeocodeSearchClient( context );
|
||||
return getApiBuilder().getGeoSearch( context );
|
||||
// if ( useCustom ) {
|
||||
// Logger.d( TAG, "use custom IMogoGeoSearch" );
|
||||
// return new com.mogo.map.impl.custom.search.GeocodeSearchClient( context );
|
||||
// }
|
||||
// return new com.mogo.map.impl.amap.search.GeocodeSearchClient( context );
|
||||
}
|
||||
|
||||
public static IMogoInputtipsSearch getInputtipsSearchDelegate( Context context, MogoInputtipsQuery query ) {
|
||||
if ( useCustom ) {
|
||||
Logger.d( TAG, "use custom IMogoInputtipsSearch" );
|
||||
return new com.mogo.map.impl.custom.search.InputtipsSearch( context, query );
|
||||
}
|
||||
return new InputtipsSearch( context, query );
|
||||
return getApiBuilder().getInputtipsSearch( context, query );
|
||||
// if ( useCustom ) {
|
||||
// Logger.d( TAG, "use custom IMogoInputtipsSearch" );
|
||||
// return new com.mogo.map.impl.custom.search.InputtipsSearch( context, query );
|
||||
// }
|
||||
// return new com.mogo.map.impl.amap.search.InputtipsSearch( context, query );
|
||||
}
|
||||
|
||||
public static IMogoLocationClient getLocationClientDelegate( Context context ) {
|
||||
if ( useCustom ) {
|
||||
Logger.d( TAG, "use custom IMogoLocationClient" );
|
||||
return new com.mogo.map.impl.custom.location.ALocationClient( context );
|
||||
}
|
||||
return new ALocationClient( context );
|
||||
return getApiBuilder().getLocationClient( context );
|
||||
// if ( useCustom ) {
|
||||
// Logger.d( TAG, "use custom IMogoLocationClient" );
|
||||
// return new com.mogo.map.impl.custom.location.ALocationClient( context );
|
||||
// }
|
||||
// return new com.mogo.map.impl.amap.location.ALocationClient( context );
|
||||
}
|
||||
|
||||
public static IMogoMapUIController getMapUIControllerDelegate() {
|
||||
if ( useCustom ) {
|
||||
Logger.d( TAG, "use custom IMogoMapUIController" );
|
||||
return com.mogo.map.impl.custom.uicontroller.AMapUIController.getInstance();
|
||||
}
|
||||
return AMapUIController.getInstance();
|
||||
return getApiBuilder().getMapUIController();
|
||||
// if ( useCustom ) {
|
||||
// Logger.d( TAG, "use custom IMogoMapUIController" );
|
||||
// return com.mogo.map.impl.custom.uicontroller.AMapUIController.getInstance();
|
||||
// }
|
||||
// return com.mogo.map.impl.amap.uicontroller.AMapUIController.getInstance();
|
||||
}
|
||||
|
||||
public static IMogoNavi getNaviDelegate( Context context ) {
|
||||
|
||||
if ( DebugConfig.isUseCustomNavi() ) {
|
||||
return NaviClient.getInstance( context );
|
||||
return getApiBuilder().getNavi( context );
|
||||
// return com.mogo.map.impl.amap.navi.NaviClient.getInstance( context );
|
||||
} else if ( AppUtils.isAppInstalled( context, "com.autonavi.amapauto" ) ) {
|
||||
return AutoNaviClient.getInstance( context );
|
||||
} else {
|
||||
if ( useCustom ) {
|
||||
Logger.d( TAG, "use custom IMogoNavi" );
|
||||
return com.mogo.map.impl.custom.navi.NaviClient.getInstance( context );
|
||||
}
|
||||
}
|
||||
return NaviClient.getInstance( context );
|
||||
return getApiBuilder().getNavi( context );
|
||||
// return com.mogo.map.impl.amap.navi.NaviClient.getInstance( context );
|
||||
}
|
||||
|
||||
public static IMogoPoiSearch getPoiSearchClientDelegate( Context context, MogoPoiSearchQuery query ) {
|
||||
if ( useCustom ) {
|
||||
Logger.d( TAG, "use custom IMogoPoiSearch" );
|
||||
return new com.mogo.map.impl.custom.search.PoiSearchClient( context, query );
|
||||
}
|
||||
return new PoiSearchClient( context, query );
|
||||
return getApiBuilder().getPoiSearchClient( context, query );
|
||||
// if ( useCustom ) {
|
||||
// Logger.d( TAG, "use custom IMogoPoiSearch" );
|
||||
// return new com.mogo.map.impl.custom.search.PoiSearchClient( context, query );
|
||||
// }
|
||||
// return new com.mogo.map.impl.amap.search.PoiSearchClient( context, query );
|
||||
}
|
||||
|
||||
public static IMogoRoadSearch getRoadSearchDelegate() {
|
||||
if ( useCustom ) {
|
||||
Logger.d( TAG, "use custom IMogoRoadSearch" );
|
||||
return new com.mogo.map.impl.custom.search.RoadSearchClient();
|
||||
}
|
||||
return new RoadSearchClient();
|
||||
return getApiBuilder().getRoadSearch();
|
||||
// if ( useCustom ) {
|
||||
// Logger.d( TAG, "use custom IMogoRoadSearch" );
|
||||
// return new com.mogo.map.impl.custom.search.RoadSearchClient();
|
||||
// }
|
||||
// return new com.mogo.map.impl.amap.search.RoadSearchClient();
|
||||
}
|
||||
|
||||
|
||||
public static IMogoAimless getAimless( Context context ) {
|
||||
return getApiBuilder().getAimless( context );
|
||||
}
|
||||
|
||||
public static void createMapViewInstance( Context context ) {
|
||||
getApiBuilder().createMapView( context );
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
getApiBuilder().destroy();
|
||||
}
|
||||
|
||||
public static IMogoMapView getMapView( Context context ) {
|
||||
return getApiBuilder().getMapView( context );
|
||||
}
|
||||
|
||||
public static IMogoTrafficSearch getTrafficSearch() {
|
||||
return getApiBuilder().getTrafficSearch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.location.Location;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.map.impl.amap.uicontroller.AMapUIController;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
|
||||
@@ -9,9 +9,6 @@ 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;
|
||||
|
||||
/**
|
||||
@@ -39,15 +36,10 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
|
||||
private boolean mIsVrMode = false;
|
||||
|
||||
@Override
|
||||
protected void addDleMaps() {
|
||||
|
||||
display2DMap( true, true );
|
||||
}
|
||||
|
||||
private void addAMapView(){
|
||||
mAMapView = new AMapBaseMapView().create( getContext() );
|
||||
if ( mAMapView != null ) {
|
||||
final View mapView = mAMapView.getMapView();
|
||||
protected void addMapView( Context context ) {
|
||||
mMapView = MogoMapDelegateFactory.getMapView( 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 ) );
|
||||
} else {
|
||||
@@ -58,73 +50,6 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
|
||||
}
|
||||
}
|
||||
|
||||
private void addVrMapView(){
|
||||
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." );
|
||||
}
|
||||
mCustomMapView.onCreate( null );
|
||||
}
|
||||
|
||||
private void removeVrMapView(){
|
||||
try {
|
||||
mCustomMapView.onDestroy();
|
||||
removeView( mCustomMapView.getMapView() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void removeAMapView(){
|
||||
try {
|
||||
mAMapView.onPause();
|
||||
removeView( mAMapView.getMapView() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display2DMap( boolean invokeCreateAuto, boolean invokeResumeAuto ) {
|
||||
mIsVrMode = false;
|
||||
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
|
||||
removeVrMapView();
|
||||
addAMapView();
|
||||
mMapView = mAMapView;
|
||||
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
|
||||
MogoMapUIController.getInstance().setDelegate( AMapUIController.getInstance() );
|
||||
mAMapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayVRMap( boolean invokeCreateAuto, boolean invokeResumeAuto ) {
|
||||
mIsVrMode = true;
|
||||
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
|
||||
removeAMapView();
|
||||
addVrMapView();
|
||||
mMapView = mCustomMapView;
|
||||
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
|
||||
MogoMapUIController.getInstance().setDelegate( com.mogo.map.impl.custom.uicontroller.AMapUIController.getInstance() );
|
||||
mCustomMapView.onResume();
|
||||
post( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
getMap().getUIController().showMyLocation( true );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
public boolean isVrMode() {
|
||||
return mIsVrMode;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.impl.amap.AMapViewHandler;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -39,11 +37,11 @@ class MogoMapViewInstanceHandler implements IMogoMapViewInstanceHandler {
|
||||
|
||||
@Override
|
||||
public void createMapViewInstance( Context context ) {
|
||||
AMapViewHandler.createMapView( context );
|
||||
MogoMapDelegateFactory.createMapViewInstance( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
AMapViewHandler.destroy();
|
||||
MogoMapDelegateFactory.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.map.impl.amap.overlay.RouteOverlayHelper;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -94,11 +91,11 @@ public class MogoMarkerManager implements IMogoMarkerManager {
|
||||
|
||||
@Override
|
||||
public void addRouteWay( Context context, MogoLatLng startPoint, MogoLatLng endPoint, List< MogoLatLng > wayPoints ) {
|
||||
RouteOverlayHelper.getInstance().addRouteWay( context, startPoint, endPoint, wayPoints );
|
||||
// RouteOverlayHelper.getInstance().addRouteWay( context, startPoint, endPoint, wayPoints );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeRouteWayOverlay() {
|
||||
RouteOverlayHelper.getInstance().removeAll();
|
||||
// RouteOverlayHelper.getInstance().removeAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,6 @@ import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
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;
|
||||
@@ -14,7 +11,6 @@ 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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.map;
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.exception.MogoMapException;
|
||||
import com.mogo.map.impl.amap.search.PoiSearchClient;
|
||||
import com.mogo.map.search.geo.MogoPoiItem;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearch;
|
||||
import com.mogo.map.search.poisearch.IMogoPoiSearchListener;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import com.mogo.map.impl.amap.search.TrafficSearchClient;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearch;
|
||||
import com.mogo.map.search.traffic.IMogoTrafficSearchListener;
|
||||
|
||||
@@ -9,7 +8,7 @@ public class MogoTrafficSearch implements IMogoTrafficSearch {
|
||||
private IMogoTrafficSearch mDelegate;
|
||||
|
||||
public MogoTrafficSearch() {
|
||||
mDelegate = new TrafficSearchClient();
|
||||
mDelegate = MogoMapDelegateFactory.getTrafficSearch();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,12 +2,6 @@ package com.zhidao.roadcondition.model
|
||||
|
||||
import android.os.Parcel
|
||||
import android.os.Parcelable
|
||||
import com.amap.api.maps.model.LatLng
|
||||
|
||||
|
||||
fun Informations.toLatLng(): LatLng {
|
||||
return LatLng(lat, lon)
|
||||
}
|
||||
|
||||
class Informations(
|
||||
var type: Int,
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
package com.zhidao.roadcondition.model
|
||||
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.amap.api.services.core.LatLonPoint
|
||||
import com.mogo.map.MogoLatLng
|
||||
|
||||
|
||||
fun LocationInfo.toLatLng(): LatLng {
|
||||
return LatLng(latitude,longitude)
|
||||
}
|
||||
|
||||
fun LocationInfo.toLatLngPoint():LatLonPoint{
|
||||
return LatLonPoint(latitude,longitude)
|
||||
fun LocationInfo.toLatLngPoint():MogoLatLng{
|
||||
return MogoLatLng(latitude,longitude)
|
||||
}
|
||||
|
||||
class LocationInfo {
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
package com.zhidao.roadcondition.util
|
||||
|
||||
import android.util.Log
|
||||
import com.amap.api.location.AMapLocation
|
||||
import com.amap.api.location.AMapLocationClient
|
||||
import com.amap.api.location.AMapLocationClientOption
|
||||
import com.amap.api.location.AMapLocationListener
|
||||
import com.amap.api.services.core.LatLonPoint
|
||||
import com.amap.api.services.geocoder.*
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.map.location.MogoLocation
|
||||
import com.mogo.map.search.geo.IMogoGeoSearchListener
|
||||
import com.mogo.map.search.geo.MogoRegeocodeAddress
|
||||
import com.mogo.map.search.geo.MogoRegeocodeResult
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.zhidao.roadcondition.model.LocationInfo
|
||||
|
||||
|
||||
private fun RegeocodeAddress.toLocInfo(
|
||||
address: RegeocodeAddress,
|
||||
latlngPoint: LatLonPoint
|
||||
private fun MogoRegeocodeAddress.toLocInfo(
|
||||
address: MogoRegeocodeAddress,
|
||||
latlngPoint: MogoLatLng
|
||||
): LocationInfo {
|
||||
return LocationInfo(
|
||||
address.province,
|
||||
address.city,
|
||||
address.cityCode,
|
||||
address.district,
|
||||
address.adCode,
|
||||
address.roads[0].name,
|
||||
latlngPoint.longitude,
|
||||
latlngPoint.latitude,
|
||||
address.formatAddress,
|
||||
System.currentTimeMillis()
|
||||
address.province,
|
||||
address.city,
|
||||
address.cityCode,
|
||||
address.district,
|
||||
address.adCode,
|
||||
address.roads[0].name,
|
||||
latlngPoint.lon,
|
||||
latlngPoint.lat,
|
||||
address.formatAddress,
|
||||
System.currentTimeMillis()
|
||||
)
|
||||
}
|
||||
|
||||
private fun AMapLocation.toLocInfo(location: AMapLocation): LocationInfo {
|
||||
private fun MogoLocation.toLocInfo(location: MogoLocation): LocationInfo {
|
||||
return LocationInfo(
|
||||
location.province,
|
||||
location.city,
|
||||
location.cityCode,
|
||||
location.district,
|
||||
location.adCode,
|
||||
location.street,
|
||||
location.longitude,
|
||||
location.latitude,
|
||||
location.address,
|
||||
location.time,
|
||||
location.bearing
|
||||
location.province,
|
||||
location.cityName,
|
||||
location.cityCode,
|
||||
location.district,
|
||||
location.adCode,
|
||||
location.street,
|
||||
location.longitude,
|
||||
location.latitude,
|
||||
location.address,
|
||||
location.time,
|
||||
location.bearing
|
||||
)
|
||||
}
|
||||
|
||||
@@ -69,89 +69,33 @@ class LocationUtil private constructor() {
|
||||
|
||||
private var init: Boolean = false
|
||||
private var mContext = AbsMogoApplication.getApp().applicationContext
|
||||
private var locationClient: AMapLocationClient? = null
|
||||
private var locationOption: AMapLocationClientOption? = null
|
||||
private var speedListener: SpeedListener? = null
|
||||
private var locationInfo: LocationInfo? = null
|
||||
private var speed: Float = 0.0f
|
||||
|
||||
fun initLocation() {
|
||||
//初始化client
|
||||
locationOption = getDefaultOption()
|
||||
locationClient = AMapLocationClient(mContext)
|
||||
//设置定位参数
|
||||
locationClient!!.setLocationOption(locationOption)
|
||||
// 设置定位监听
|
||||
locationClient!!.setLocationListener(locationListener)
|
||||
init = true
|
||||
startLocation()
|
||||
}
|
||||
|
||||
private fun getDefaultOption(): AMapLocationClientOption {
|
||||
val mOption = AMapLocationClientOption()
|
||||
mOption.locationMode =
|
||||
AMapLocationClientOption.AMapLocationMode.Hight_Accuracy//可选,设置定位模式,可选的模式有高精度、仅设备、仅网络。默认为高精度模式
|
||||
mOption.isGpsFirst = true//可选,设置是否gps优先,只在高精度模式下有效。默认关闭
|
||||
mOption.httpTimeOut = 30000//可选,设置网络请求超时时间。默认为30秒。在仅设备模式下无效
|
||||
mOption.interval = 5000//可选,设置定位间隔。默认为2秒
|
||||
mOption.isNeedAddress = true//可选,设置是否返回逆地理地址信息。默认是true
|
||||
mOption.isOnceLocation = false//可选,设置是否单次定位。默认是false
|
||||
mOption.isOnceLocationLatest = false//可选,设置是否等待wifi刷新,默认为false.如果设置为true,会自动变为单次定位,持续定位时不要使用
|
||||
AMapLocationClientOption.setLocationProtocol(AMapLocationClientOption.AMapLocationProtocol.HTTP)//可选, 设置网络请求的协议。可选HTTP或者HTTPS。默认为HTTP
|
||||
mOption.isSensorEnable = true//可选,设置是否使用传感器。默认是false
|
||||
mOption.isWifiScan =
|
||||
true //可选,设置是否开启wifi扫描。默认为true,如果设置为false会同时停止主动刷新,停止以后完全依赖于系统刷新,定位位置可能存在误差
|
||||
mOption.isLocationCacheEnable = false //可选,设置是否使用缓存定位,默认为true
|
||||
mOption.geoLanguage =
|
||||
AMapLocationClientOption.GeoLanguage.DEFAULT//可选,设置逆地理信息的语言,默认值为默认语言(根据所在地区选择语言)
|
||||
return mOption
|
||||
}
|
||||
|
||||
private fun startLocation() {
|
||||
if (checkInit()) {
|
||||
// 设置定位参数
|
||||
locationClient!!.setLocationOption(locationOption)
|
||||
// 启动定位
|
||||
locationClient!!.startLocation()
|
||||
}
|
||||
}
|
||||
|
||||
fun setOnMapLocationChangedListener(listener: OnMapLocationChangedListener) {
|
||||
this.listener = listener
|
||||
}
|
||||
|
||||
/**
|
||||
* 定位监听
|
||||
*/
|
||||
private var locationListener: AMapLocationListener = AMapLocationListener { location ->
|
||||
if (null != location) {
|
||||
locationInfo = LocationInfo()
|
||||
locationInfo!!.longitude = location.longitude
|
||||
locationInfo!!.latitude = location.latitude
|
||||
locationInfo!!.address = location.address
|
||||
locationInfo!!.time = location.time
|
||||
locationInfo!!.provinceName = location.province
|
||||
locationInfo!!.cityName = location.city
|
||||
locationInfo!!.cityCode = location.cityCode
|
||||
locationInfo!!.areaName = location.district
|
||||
locationInfo!!.areaCode = location.adCode
|
||||
locationInfo!!.street = location.street
|
||||
locationInfo!!.direction = location.bearing
|
||||
listener?.onChanged(locationInfo!!)
|
||||
speed = location.speed
|
||||
speedListener?.onSpeedGet(location.speed)
|
||||
} else {
|
||||
Log.d(TAG, "定位失败 -> location is null")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun checkInit(): Boolean {
|
||||
return if (!init) {
|
||||
initLocation()
|
||||
init
|
||||
} else {
|
||||
true
|
||||
MogoApisHandler.getInstance().apis.mapServiceApi.getSingletonLocationClient(mContext).addLocationListener {location->
|
||||
if (null != location) {
|
||||
locationInfo = LocationInfo()
|
||||
locationInfo!!.longitude = location.longitude
|
||||
locationInfo!!.latitude = location.latitude
|
||||
locationInfo!!.address = location.address
|
||||
locationInfo!!.time = location.time
|
||||
locationInfo!!.provinceName = location.province
|
||||
locationInfo!!.cityName = location.cityName
|
||||
locationInfo!!.cityCode = location.cityCode
|
||||
locationInfo!!.areaName = location.district
|
||||
locationInfo!!.areaCode = location.adCode
|
||||
locationInfo!!.street = location.street
|
||||
locationInfo!!.direction = location.bearing
|
||||
listener?.onChanged(locationInfo!!)
|
||||
speed = location.speed
|
||||
speedListener?.onSpeedGet(location.speed)
|
||||
} else {
|
||||
Log.d(TAG, "定位失败 -> location is null")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,40 +103,40 @@ class LocationUtil private constructor() {
|
||||
return if (null != locationInfo) {
|
||||
locationInfo!!
|
||||
} else {
|
||||
if (null == locationClient) {
|
||||
locationClient = AMapLocationClient(mContext)
|
||||
}
|
||||
val location = locationClient!!.lastKnownLocation
|
||||
val location = MogoApisHandler.getInstance().apis.mapServiceApi.getSingletonLocationClient(mContext).lastKnowLocation
|
||||
location.toLocInfo(location)
|
||||
}
|
||||
}
|
||||
|
||||
//如果获取到的location address为空可以通过高德逆地理编码获得
|
||||
fun geoCodeLocation(
|
||||
latlngPoint: LatLonPoint,
|
||||
latlngPoint: MogoLatLng,
|
||||
locGeoCode: (((locInfo: LocationInfo) -> Unit)),
|
||||
onError: ((msg: String) -> Unit)
|
||||
) {
|
||||
var geocoderSearch = GeocodeSearch(AbsMogoApplication.getApp().applicationContext)
|
||||
var regeocodeQuery = RegeocodeQuery(latlngPoint, 200f, GeocodeSearch.AMAP)
|
||||
var geocoderSearch = MogoApisHandler.getInstance().apis.mapServiceApi.getGeoSearch(AbsMogoApplication.getApp().applicationContext)
|
||||
var regeocodeQuery = MogoRegeocodeQuery()
|
||||
regeocodeQuery.latlngType = ""
|
||||
regeocodeQuery.point = latlngPoint
|
||||
regeocodeQuery.radius = 200
|
||||
geocoderSearch.getFromLocationAsyn(regeocodeQuery)
|
||||
geocoderSearch.setOnGeocodeSearchListener(object : GeocodeSearch.OnGeocodeSearchListener {
|
||||
override fun onRegeocodeSearched(p0: RegeocodeResult?, p1: Int) {
|
||||
if (p1 == 1000) {
|
||||
geocoderSearch.setGeoSearchListener(object : IMogoGeoSearchListener {
|
||||
|
||||
|
||||
override fun onRegeocodeSearched(regeocodeResult: MogoRegeocodeResult?) {
|
||||
super.onRegeocodeSearched(regeocodeResult)
|
||||
if( regeocodeResult == null ){
|
||||
trackUploadGeo(3);
|
||||
onError.invoke("geoCode")
|
||||
} else {
|
||||
trackUploadGeo(2);
|
||||
var regeocodeAddress = p0?.regeocodeAddress
|
||||
var regeocodeAddress = regeocodeResult?.regeocodeAddress
|
||||
regeocodeAddress?.let {
|
||||
var locInfo = regeocodeAddress.toLocInfo(regeocodeAddress, latlngPoint)
|
||||
locGeoCode.invoke(locInfo)
|
||||
}
|
||||
} else {
|
||||
trackUploadGeo(3);
|
||||
onError.invoke("geoCode -> $p1")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onGeocodeSearched(p0: GeocodeResult?, p1: Int) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,13 @@ import android.graphics.drawable.Drawable;
|
||||
import android.os.Looper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.SimpleTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
@@ -97,11 +98,34 @@ public class MyLocationUtil {
|
||||
if (res == null) {
|
||||
throw new IllegalArgumentException("inflate myLocation bitmap can not be null!");
|
||||
}
|
||||
View root =
|
||||
LayoutInflater.from(context).inflate(R.layout.module_common_my_location, null, false);
|
||||
ImageView iv =
|
||||
root.findViewById(R.id.module_map_amap_my_location_iv);
|
||||
View root = LayoutInflater.from(context).inflate(R.layout.module_common_my_location, null, false);
|
||||
ImageView iv = root.findViewById(R.id.module_map_amap_my_location_iv);
|
||||
iv.setImageBitmap(res);
|
||||
return BitmapDescriptorFactory.fromView(root).getBitmap();
|
||||
return fromView(root);
|
||||
}
|
||||
|
||||
|
||||
private static Bitmap fromView( View view ) {
|
||||
view.setDrawingCacheEnabled( true );
|
||||
processChildView( view );
|
||||
view.destroyDrawingCache();
|
||||
view.measure( View.MeasureSpec.makeMeasureSpec( 0, View.MeasureSpec.UNSPECIFIED ), View.MeasureSpec.makeMeasureSpec( 0, View.MeasureSpec.UNSPECIFIED ) );
|
||||
view.layout( 0, 0, view.getMeasuredWidth(), view.getMeasuredHeight() );
|
||||
Bitmap bitmap = null;
|
||||
return ( bitmap = view.getDrawingCache() ) != null ? bitmap.copy( Bitmap.Config.ARGB_8888, false ) : null;
|
||||
}
|
||||
|
||||
private static void processChildView( View view ) {
|
||||
if ( !( view instanceof ViewGroup ) ) {
|
||||
if ( view instanceof TextView ) {
|
||||
( ( TextView ) view ).setHorizontallyScrolling( false );
|
||||
}
|
||||
|
||||
} else {
|
||||
for ( int var1 = 0; var1 < ( ( ViewGroup ) view ).getChildCount(); ++var1 ) {
|
||||
processChildView( ( ( ViewGroup ) view ).getChildAt( var1 ) );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.module.common.utils;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
*/
|
||||
@@ -13,7 +11,6 @@ public class CoordinateUtils {
|
||||
/**
|
||||
* 手机GPS坐标转火星坐标
|
||||
*
|
||||
* @param wgLoc
|
||||
* @return
|
||||
*/
|
||||
public static double[] transformFromWGSToGCJ( double lat, double lon ) {
|
||||
@@ -36,32 +33,6 @@ public class CoordinateUtils {
|
||||
return new double[]{lat + dLat, lon + dLon};
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机GPS坐标转火星坐标
|
||||
*
|
||||
* @param wgLoc
|
||||
* @return
|
||||
*/
|
||||
public static LatLng transformFromWGSToGCJ( LatLng wgLoc ) {
|
||||
|
||||
//如果在国外,则默认不进行转换
|
||||
if ( outOfChina( wgLoc.latitude, wgLoc.longitude ) ) {
|
||||
return new LatLng( wgLoc.latitude, wgLoc.longitude );
|
||||
}
|
||||
double dLat = transformLat( wgLoc.longitude - 105.0,
|
||||
wgLoc.latitude - 35.0 );
|
||||
double dLon = transformLon( wgLoc.longitude - 105.0,
|
||||
wgLoc.latitude - 35.0 );
|
||||
double radLat = wgLoc.latitude / 180.0 * Math.PI;
|
||||
double magic = Math.sin( radLat );
|
||||
magic = 1 - ee * magic * magic;
|
||||
double sqrtMagic = Math.sqrt( magic );
|
||||
dLat = ( dLat * 180.0 ) / ( ( a * ( 1 - ee ) ) / ( magic * sqrtMagic ) * Math.PI );
|
||||
dLon = ( dLon * 180.0 ) / ( a / sqrtMagic * Math.cos( radLat ) * Math.PI );
|
||||
|
||||
return new LatLng( wgLoc.latitude + dLat, wgLoc.longitude + dLon );
|
||||
}
|
||||
|
||||
public static double transformLat( double x, double y ) {
|
||||
double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y
|
||||
+ 0.2 * Math.sqrt( x > 0 ? x : -x );
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.module.extensions.navi;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.map.impl.amap.utils.IconTypeUtils;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -21,10 +20,6 @@ public abstract class BaseNaviInfoView {
|
||||
|
||||
}
|
||||
|
||||
protected void fillNextCrossTurning( TextView target, int nextIconType ) {
|
||||
target.setText( "后" + IconTypeUtils.getNameByIconType( nextIconType ) );
|
||||
}
|
||||
|
||||
protected void fillNextCrossIconType( ImageView target, int iconId ) {
|
||||
if ( iconId > 0 ) {
|
||||
target.setImageResource( iconId );
|
||||
|
||||
@@ -59,33 +59,31 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
|
||||
@Override
|
||||
public void changeTo2dMode() {
|
||||
if ( !isVrMode() ) {
|
||||
return;
|
||||
}
|
||||
mMogoMapView.display2DMap( false, true );
|
||||
afterMapModeChanged();
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().showADAS();
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, false );
|
||||
// if ( !isVrMode() ) {
|
||||
// return;
|
||||
// }
|
||||
// afterMapModeChanged();
|
||||
// MogoApisHandler.getInstance().getApis().getAdasControllerApi().showADAS();
|
||||
// MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeToVRMode() {
|
||||
if ( isVrMode() ) {
|
||||
return;
|
||||
}
|
||||
mMogoMapView.displayVRMap( mIsFirstLoadCustomMap, true );
|
||||
if ( mIsFirstLoadCustomMap ) {
|
||||
// initMapView();
|
||||
// mMogoMap = mMogoMapView.getMap();
|
||||
// if ( mMogoMap.getUIController() != null ) {
|
||||
// mMogoMap.getUIController().showMyLocation( true );
|
||||
// mMogoMap.getUIController().recoverLockMode();// 启动锁车
|
||||
// }
|
||||
// mIsFirstLoadCustomMap = false;
|
||||
}
|
||||
afterMapModeChanged();
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().closeADAS();
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
|
||||
// if ( isVrMode() ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( mIsFirstLoadCustomMap ) {
|
||||
//// initMapView();
|
||||
//// mMogoMap = mMogoMapView.getMap();
|
||||
//// if ( mMogoMap.getUIController() != null ) {
|
||||
//// mMogoMap.getUIController().showMyLocation( true );
|
||||
//// mMogoMap.getUIController().recoverLockMode();// 启动锁车
|
||||
//// }
|
||||
//// mIsFirstLoadCustomMap = false;
|
||||
// }
|
||||
// afterMapModeChanged();
|
||||
// MogoApisHandler.getInstance().getApis().getAdasControllerApi().closeADAS();
|
||||
// MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
|
||||
}
|
||||
|
||||
private void afterMapModeChanged() {
|
||||
@@ -111,10 +109,12 @@ 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 != null ) {
|
||||
mMogoMap.getUIController().showMyLocation( true );
|
||||
mMogoMap.getUIController().recoverLockMode();// 启动锁车
|
||||
}
|
||||
// 根据本地配置设置自车图标
|
||||
MyLocationUtil.setMyLocationIconUrl(getContext(), SharedPrefsMgr.getInstance(getContext()).getString("MY_LOCATION_CONFIG", ""));
|
||||
MyLocationUtil.setMyLocationIconUrl( getContext(), SharedPrefsMgr.getInstance( getContext() ).getString( "MY_LOCATION_CONFIG", "" ) );
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.module.navi.bean;
|
||||
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.services.geocoder.RegeocodeAddress;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.search.inputtips.MogoTip;
|
||||
import com.mogo.module.navi.constants.DataConstants;
|
||||
@@ -93,36 +91,6 @@ public class EntityConvertUtils {
|
||||
MogoTip.getTypeCode() );
|
||||
}
|
||||
|
||||
|
||||
//public static SearchPoi aMapLocation2Poi( AMapLocation location ) {
|
||||
// if ( location == null || location.getErrorCode() != AMapLocation.LOCATION_SUCCESS ) {
|
||||
// return null;
|
||||
// }
|
||||
// return new SearchPoi( System.currentTimeMillis() + "",
|
||||
// location.getPoiName(),
|
||||
// location.getAddress(),
|
||||
// location.getLatitude(),
|
||||
// location.getLongitude(),
|
||||
// location.getDistrict(),
|
||||
// location.getAdCode(),
|
||||
// location.getCoordType() );
|
||||
//}
|
||||
|
||||
public static SearchPoi geocodeAddress2Poi( RegeocodeAddress address, CameraPosition position ) {
|
||||
if ( address == null || position == null ) {
|
||||
return null;
|
||||
}
|
||||
return new SearchPoi( System.currentTimeMillis() + "",
|
||||
address.getFormatAddress(),
|
||||
address.getFormatAddress(),
|
||||
position.target.latitude,
|
||||
position.target.longitude,
|
||||
address.getDistrict(),
|
||||
address.getAdCode(),
|
||||
"" );
|
||||
}
|
||||
|
||||
|
||||
public static SearchPoi geoToPoi( double latitude, double longitude, int type ) {
|
||||
SearchPoi searchPoi = new SearchPoi( System.currentTimeMillis() + "",
|
||||
null,
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.location.Location;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
|
||||
@@ -15,7 +15,6 @@ import android.view.MotionEvent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.ParamsProvider;
|
||||
@@ -46,7 +45,6 @@ import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.common.utils.CoordinateSystemTransformationUtil;
|
||||
import com.mogo.module.common.utils.CoordinateUtils;
|
||||
import com.mogo.module.service.autopilot.AutoPilotRemoteController;
|
||||
import com.mogo.module.service.intent.IntentHandlerFactory;
|
||||
import com.mogo.module.service.launchercard.LauncherCardRefresher;
|
||||
@@ -62,12 +60,11 @@ 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.utils.LocationParseUtil;
|
||||
import com.mogo.module.service.ttsConfig.TtsConfigModleData;
|
||||
import com.mogo.module.service.utils.SimpleLocationCorrectStrategy;
|
||||
import com.mogo.module.service.vrmode.VrModeController;
|
||||
import com.mogo.module.service.websocket.LocationResult;
|
||||
import com.mogo.module.service.websocket.OnePerSecondSendContent;
|
||||
import com.mogo.module.service.ttsConfig.TtsConfigModleData;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.connection.IMogoOnWebSocketMessageListener;
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
package com.mogo.module.share;
|
||||
|
||||
import android.content.Context;
|
||||
import android.nfc.Tag;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.amap.api.services.nearby.UploadInfoCallback;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.navi.IMogoAimlessModeListener;
|
||||
import com.mogo.map.navi.MogoCongestionInfo;
|
||||
import com.mogo.map.navi.MogoCongestionLink;
|
||||
@@ -20,6 +16,7 @@ import com.mogo.module.common.entity.UploadTrafficEntity;
|
||||
import com.mogo.module.share.net.TrafficModelData;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -9,13 +9,12 @@ 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.map.location.MogoLocation;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XObuEventEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.utils.CoordinateUtils;
|
||||
import com.mogo.module.v2x.listener.V2XLocationListener;
|
||||
import com.mogo.module.v2x.scenario.scene.obu.V2XObuEventScenario;
|
||||
import com.mogo.module.v2x.utils.ADASUtils;
|
||||
@@ -260,14 +259,10 @@ public class V2XObuManager implements IObuCallback, Handler.Callback {
|
||||
if (ObuConfig.useObuLocation) {
|
||||
MogoLocation currentLocation = new MogoLocation();
|
||||
|
||||
CoordinateConverter converter = new CoordinateConverter(getContext());
|
||||
converter.from(CoordinateConverter.CoordType.GPS);
|
||||
LatLng latLng = new LatLng(locationInfo.getLat(), locationInfo.getLon());
|
||||
converter.coord(latLng);
|
||||
LatLng convert = converter.convert();
|
||||
double coor[] = CoordinateUtils.transformFromWGSToGCJ( locationInfo.getLat(), locationInfo.getLon() );
|
||||
|
||||
currentLocation.setLatitude(convert.latitude);
|
||||
currentLocation.setLongitude(convert.longitude);
|
||||
currentLocation.setLatitude(coor[0]);
|
||||
currentLocation.setLongitude(coor[1]);
|
||||
currentLocation.setBearing(computeCarAngle(currentLocation));
|
||||
|
||||
V2XObuEventScenario.getInstance().updateLocation(currentLocation);
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
package com.mogo.module.machine.vision;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.MogoBaseMapView;
|
||||
import com.mogo.map.MogoMap;
|
||||
import com.mogo.map.impl.custom.CustomMapView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
@@ -39,33 +32,7 @@ class MachineVisionMapView extends MogoBaseMapView {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addDleMaps() {
|
||||
IMogoMapView machineMapView = new CustomMapView().create( getContext() );
|
||||
if ( machineMapView != null ) {
|
||||
final View mapView = machineMapView.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 = machineMapView;
|
||||
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
|
||||
onCreate( null );
|
||||
postDelayed( ()->{
|
||||
getMap().getUIController().showMyLocation( true );
|
||||
}, 1000 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void display2DMap( boolean invokeCreateAuto, boolean invokeResumeAuto ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayVRMap( boolean invokeCreateAuto, boolean invokeResumeAuto ) {
|
||||
|
||||
protected void addMapView( Context context ) {
|
||||
Logger.d(TAG, "addMapView");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user