diff --git a/libraries/mapmodule/build.gradle b/libraries/mapmodule/build.gradle new file mode 100644 index 0000000000..3357d377e4 --- /dev/null +++ b/libraries/mapmodule/build.gradle @@ -0,0 +1,71 @@ +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' +apply plugin: 'kotlin-android-extensions' + +android { + compileSdkVersion rootProject.ext.android.compileSdkVersion + + defaultConfig { + minSdkVersion rootProject.ext.android.minSdkVersion + targetSdkVersion rootProject.ext.android.targetSdkVersion + + buildConfigField 'String', 'MAPMODULE_VERSION', '"'+MAP_SDK_VERSION+'"' + multiDexEnabled true + + } + + + buildTypes { + release { + minifyEnabled true + zipAlignEnabled true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + debug { + minifyEnabled false + zipAlignEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + + + packagingOptions { + exclude 'META-INF/proguard/coroutines.pro' + exclude 'META-INF/*' + exclude 'META-INF/io.netty.versions.properties' + exclude 'META-INF/INDEX.LIST' + exclude 'META-INF/MANIFEST.MF' + exclude 'META-INF/LICENSE' + exclude 'META-INF/NOTICE' + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + +} +dependencies { + implementation rootProject.ext.dependencies.coroutinescore + implementation rootProject.ext.dependencies.coroutinesandroid + implementation rootProject.ext.dependencies.kotlinstdlibjdk7 + implementation rootProject.ext.dependencies.androidxrecyclerview + implementation rootProject.ext.dependencies.androidxannotation + implementation rootProject.ext.dependencies.androidxappcompat + implementation rootProject.ext.dependencies.recyclerviewadapterhelper + + implementation rootProject.ext.dependencies.retrofit + implementation rootProject.ext.dependencies.retrofitconvertergson + implementation rootProject.ext.dependencies.okhttpinterceptor + + implementation ('com.alibaba:fastjson:1.2.73'){ + exclude group: 'io.netty', module: 'netty-all' + } + implementation 'io.netty:netty-all:4.1.50.Final' + + + implementation 'com.zhidaoauto.map:net:1.0.1' + implementation 'com.zhidaoauto.machine:mapcore:3.0.0.4' + +} + diff --git a/libraries/mapmodule/proguard-rules.pro b/libraries/mapmodule/proguard-rules.pro new file mode 100644 index 0000000000..dd8c976580 --- /dev/null +++ b/libraries/mapmodule/proguard-rules.pro @@ -0,0 +1,182 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile + +### 忽略警告 +#-ignorewarning +#(Basic 包名不混合大小写 +-dontusemixedcaseclassnames +#(Basic)不忽略非公共的库类 +-dontskipnonpubliclibraryclasses +#(Basic)输出混淆日志 +-verbose + +# Optimization is turned off by default. Dex does not like code run +# through the ProGuard optimize and preverify steps (and performs some +# of these optimizations on its own). +#(Basic)不进行优化 +-dontoptimize +#(Basic)不进行预检验 +-dontpreverify +# Note that if you want to enable optimization, you cannot just +# include optimization flags in your own project configuration file; +# instead you will need to point to the +# "proguard-android-optimize.txt" file instead of this one from your +# project.properties file. + +#混淆注意事项第一条,保留四大组件及Android的其它组件 +-keep public class * extends android.app.Activity +#(Basic) +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} +-keep public class * extends android.app.Application +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep public class * extends android.content.ContentProvider +-keep public class * extends android.app.backup.BackupAgentHelper +-keep public class * extends android.preference.Preference +#(Basic) +-keep public class com.google.vending.licensing.ILicensingService +#(Basic) +-keep public class com.android.vending.licensing.ILicensingService + +#(Basic)混淆注意事项第二条,保持 native 方法不被混淆 +-keepclasseswithmembernames class * { + native ; +} +# 混淆注意事项第四条,保持WebView中JavaScript调用的方法 +-keepclassmembers class * { + @android.webkit.JavascriptInterface ; +} +#混淆注意事项第五条 自定义View (Basic) +-keepclassmembers public class * extends android.view.View { + void set*(***); + *** get*(); +} +# (Basic)混淆注意事项第七条,保持 Parcelable 不被混淆 +-keepclassmembers class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator CREATOR; +} +#(Basic) 混淆注意事项第八条,保持枚举 enum 类不被混淆 +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} +#(Basic) +-keepclassmembers class **.R$* { + public static ; +} +#(Basic)保留注解 +-keepattributes *Annotation* +# (Basic)排除警告 +-dontwarn android.support.** +# Understand the @Keep support annotation. +# (Basic)不混淆指定的类及其类成员 +-keep class android.support.annotation.Keep +# (Basic)不混淆使用注解的类及其类成员 +-keep @android.support.annotation.Keep class * {*;} +# (Basic)不混淆所有类及其类成员中的使用注解的方法 +-keepclasseswithmembers class * { + @android.support.annotation.Keep ; +} +# (Basic)不混淆所有类及其类成员中的使用注解的字段 +-keepclasseswithmembers class * { + @android.support.annotation.Keep ; +} +# 不混淆所有类及其类成员中的使用注解的初始化方法 +-keepclasseswithmembers class * { + @android.support.annotation.Keep (...); +} +#保留源文件以及行号 方便查看具体的崩溃信息 +-keepattributes SourceFile,LineNumberTable +#kotlin +-keep class kotlin.** { *; } +-keep class kotlin.Metadata { *; } +-dontwarn kotlin.** +-keepclassmembers class **$WhenMappings { + ; +} +-keepclassmembers class kotlin.Metadata { + public ; +} +-assumenosideeffects class kotlin.jvm.internal.Intrinsics { + static void checkParameterIsNotNull(java.lang.Object, java.lang.String); +} + +-keep class kotlinx.coroutines.android.** {*;} +# ServiceLoader support +-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {} +-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {} +-keepnames class kotlinx.coroutines.android.AndroidExceptionPreHandler {} +-keepnames class kotlinx.coroutines.android.AndroidDispatcherFactory {} + +# Most of volatile fields are updated with AFU and should not be mangled +-keepclassmembernames class kotlinx.** { + volatile ; +} + +-keepclasseswithmembernames class * { + native ; +} + +-target 1.6 +-useuniqueclassmembernames +-renamesourcefileattribute SourceFile +-adaptresourcefilenames **.properties +-adaptresourcefilecontents **.properties,META-INF/MANIFEST.MF +-verbose + +# Also keep - Enumerations. Keep the special static methods that are required in +# enumeration classes. +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +# Keep names - Native method names. Keep all native class/method names. +-keepclasseswithmembers,allowshrinking class * { + native ; +} +#如果有其它包有warning,在报出warning的包加入下面类似的-dontwarn 报名 +-dontwarn org.apache.*.** +-dontwarn org.dom4j.*.** +-dontwarn com.pdager.*.** +-dontwarn com.*.** +-dontwarn javax.*.** +#如果引用了v4或者v7包 +-dontwarn android.support.** + +-keepattributes EnclosingMethod +-keep class com.autonavi.nge.**{*;} +-keep class io.netty.**{*;} +-keep class com.zhidaoauto.map.sdk.inner.abs.**{*;} +-keep class com.zhidaoauto.map.sdk.inner.panel.**{*;} +-keep class com.zhidaoauto.map.sdk.inner.search.**{*;} +-keep class com.zhidaoauto.map.sdk.inner.element.**{*;} +-keep class com.zhidaoauto.map.sdk.inner.obj.**{*;} +-keep class com.zhidaoauto.map.sdk.open.**{*;} + +-keepattributes Exceptions,InnerClasses +-keep class com.zhidaoauto.map.sdk.open.camera.**{ *; } +-keep class com.zhidaoauto.map.sdk.open.camera.CameraPosition$B { *; } +-keep class com.zhidaoauto.map.sdk.open.camera.CameraPosition$C { *; } + diff --git a/libraries/mapmodule/src/main/AndroidManifest.xml b/libraries/mapmodule/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..0e94969745 --- /dev/null +++ b/libraries/mapmodule/src/main/AndroidManifest.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/dm/INavigationCore.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/dm/INavigationCore.aidl new file mode 100644 index 0000000000..bea7074392 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/dm/INavigationCore.aidl @@ -0,0 +1,85 @@ +//package com.autonavi.nge.dm; +// +//import android.os.IBinder; +//import com.autonavi.nge.guidance.RouteBook; +//import com.autonavi.nge.guidance.NaviInfo; +//import com.autonavi.nge.guidance.RouteImage; +//import com.autonavi.nge.guidance.LaneMask; +//import com.autonavi.nge.obj.Category; +//import com.autonavi.nge.obj.UpdateRegion; +//import com.autonavi.nge.trafficInfo.TMCID; +//import com.autonavi.nge.search.SPPoiItem; +//import com.autonavi.nge.search.SPCategories; +//import com.autonavi.nge.search.SPQuery; +//import com.autonavi.nge.search.SPSearchResult; +//import com.autonavi.nge.map.LonLat; +//import com.autonavi.nge.guidance.GuidanceStatListener; +//interface INavigationCore { +//// IBinder getHandler(); +// void Routing_SetOrigin(float lon, float lat, int sessionid); +// void Routing_SetDest(float lon, float lat, int sessionid); +// void Routing_GetRoute(int sessionid); +// boolean Routing_GetStatus(int sessionid); +// void Routing_Reset(int sessionid); +// void Routing_ClearTour(int sessionid); +// void RoutingSetCostModel(int model, int sessionid); +// void RoutingSetAvoidHighway(boolean isAvoidHighway, int sessionid); +// void RoutingSetAvoidToll(boolean isAvoidToll, int sessionid); +// +// void Traffic_Update(in List ids, int evt); +// void Traffic_UpdateByTile(int tile, in int[] ids, in byte[] speeds); +// void RoutingSetUseTraffic(boolean useTraffic, int sessionid); +// int RoutingGetRouteNum(int sessionid); +// int RoutingGetLength(int route, int sessionid); +// int RoutingGetSTime(int route, int sessionid); +// int RoutingGetDTime(int route, int sessionid); +// void addwaypoint(float lon, float lat, int heading, int sessionid); +// void clearwaypoints(int sessionid); +// +// void Guidance_UpdatePosition(float lon, float lat, float speed, float heading); +// void Guidance_StartNavi(int type); +// void Guidance_StopNavi(); +// void Guidance_SetSimSpeed(int speed); +// void Guidance_PauseSimNavi(); +// void Guidance_ResumeSimNavi(); +// RouteBook Guidance_RouteBook(int session,int start,int end); +// NaviInfo Guidance_NaviInfo(); +// NaviInfo GetNaviInfo(in byte[] datas); +// String Guidance_TTS(); +// RouteImage Guidance_Image(int imageUr,int imageBg,int imageArrow,int type); +// LaneMask Guidance_LaneMask(); +// double Guidance_getRoadAngle(); +// +// List Search_getSearchResult(int productId, double lon, double lat, double radius, int kindfilter, int updateregionId, String keyWord, int pageIdx, int searchType); +// SPPoiItem getPoiItemByPoiId(int poiId); +// List getPoiItemListByLonLat(int prodId, int urId, float lon, float lat, int pageCount, int pageIdx); +// List queryPoiItemByCircle(float centerLon,float centerLat,float radius); +// List queryPoiItemByRect(float topLeftLon,float topLeftLat,float bottomRightLon,float bottomRightLat); +// List queryPoiItemByPolygon(in List latLonPoints); +// List getFTSDataByDA( int urid, String keyStr, int keytype, int maxResultCount); +// List getInputResult(int productId, int updateregionId, String inputStr); +// List getInputResultByDA(); +// List getCatList(int urid); +// List getURListByDA(int prodid); +// void play(String text,boolean forcePlay); +// +// int RoutingGetSearchedCnt(int route, int sessionid); +// +// int [] getMemoryInfo(); +// +// void startServer(); +// +// void stopServer(); +// +// int getMDSVersion(); +// String getDataVersion(); +// String getCopyRight(); +// String getCompilerVersion(); +// +// void onGuidanceStatusChanged(int statCode, in byte[] datas); +// +// void setGuidanceStatListener(GuidanceStatListener listener); +// +// SPCategories getAllPoiCategories(int languageCode); +// List getPoiItemList(in SPQuery query); +//} diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/GuidanceStatListener.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/GuidanceStatListener.aidl new file mode 100644 index 0000000000..3cf96059aa --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/GuidanceStatListener.aidl @@ -0,0 +1,5 @@ +package com.autonavi.nge.guidance; + +oneway interface GuidanceStatListener{ + void onGuidanceStatusChanged(int statCode, in byte[] datas); +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/LaneMask.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/LaneMask.aidl new file mode 100644 index 0000000000..82c7d7c6e7 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/LaneMask.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.guidance; + +parcelable LaneMask; \ No newline at end of file diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/NaviInfo.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/NaviInfo.aidl new file mode 100644 index 0000000000..6d5d12e2e9 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/NaviInfo.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.guidance; + +parcelable NaviInfo; \ No newline at end of file diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/RouteBook.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/RouteBook.aidl new file mode 100644 index 0000000000..5a7056785e --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/RouteBook.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.guidance; + +parcelable RouteBook; \ No newline at end of file diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/RouteImage.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/RouteImage.aidl new file mode 100644 index 0000000000..4c26f0d1f8 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/guidance/RouteImage.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.guidance; + +parcelable RouteImage; \ No newline at end of file diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/hdmap/HDMapBlock.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/hdmap/HDMapBlock.aidl new file mode 100644 index 0000000000..4081299a86 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/hdmap/HDMapBlock.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.hdmap; + +parcelable HDMapBlock; diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/hdmap/LonLat.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/hdmap/LonLat.aidl new file mode 100644 index 0000000000..fb6c8eb425 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/hdmap/LonLat.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.hdmap; + +parcelable LonLat; diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/map/LonLat.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/map/LonLat.aidl new file mode 100644 index 0000000000..60b87d86e9 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/map/LonLat.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.map; + +parcelable LonLat; \ No newline at end of file diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/obj/Category.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/obj/Category.aidl new file mode 100644 index 0000000000..b506014934 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/obj/Category.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.obj; + +parcelable Category; \ No newline at end of file diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/obj/PoiBase.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/obj/PoiBase.aidl new file mode 100644 index 0000000000..7d63e30fe8 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/obj/PoiBase.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.obj; + +parcelable PoiBase; \ No newline at end of file diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/obj/UpdateRegion.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/obj/UpdateRegion.aidl new file mode 100644 index 0000000000..6f84886cce --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/obj/UpdateRegion.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.obj; + +parcelable UpdateRegion; \ No newline at end of file diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/search/SPCategories.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/search/SPCategories.aidl new file mode 100644 index 0000000000..28da280a82 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/search/SPCategories.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.search; + +parcelable SPCategories; diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/search/SPPoiItem.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/search/SPPoiItem.aidl new file mode 100644 index 0000000000..70c53a7b20 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/search/SPPoiItem.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.search; + +parcelable SPPoiItem; \ No newline at end of file diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/search/SPQuery.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/search/SPQuery.aidl new file mode 100644 index 0000000000..85f958b573 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/search/SPQuery.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.search; + +parcelable SPQuery; \ No newline at end of file diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/search/SPSearchResult.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/search/SPSearchResult.aidl new file mode 100644 index 0000000000..9146be6e7c --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/search/SPSearchResult.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.search; + +parcelable SPSearchResult; diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/server/IMapServer.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/server/IMapServer.aidl new file mode 100644 index 0000000000..6323e2be92 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/server/IMapServer.aidl @@ -0,0 +1,11 @@ +package com.autonavi.nge.server; + +import android.os.IBinder; + +interface IMapServer { + IBinder getHandler(); + + void start(IBinder dm); + void stop(); + void heartbeat(); +} diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/trafficInfo/ITrafficClient.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/trafficInfo/ITrafficClient.aidl new file mode 100644 index 0000000000..f13fd2c31b --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/trafficInfo/ITrafficClient.aidl @@ -0,0 +1,10 @@ +package com.autonavi.nge.trafficInfo; + +import android.os.IBinder; +import com.autonavi.nge.trafficInfo.TMCID; + +interface ITrafficClient { + IBinder getHandler(); + void On_Traffic_Update(in List ids, int evt); + void On_Traffic_UpdateByTile(int tile, in int[] links,in byte[] speeds); +} diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/trafficInfo/ITrafficServer.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/trafficInfo/ITrafficServer.aidl new file mode 100644 index 0000000000..7af2377bff --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/trafficInfo/ITrafficServer.aidl @@ -0,0 +1,12 @@ +package com.autonavi.nge.trafficInfo; + +import android.os.IBinder; +import com.autonavi.nge.trafficInfo.ITrafficClient; + +interface ITrafficServer { + IBinder getHandler(); + void register(ITrafficClient client); + + void start(); + void stop(); +} diff --git a/libraries/mapmodule/src/main/aidl/com/autonavi/nge/trafficInfo/TMCID.aidl b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/trafficInfo/TMCID.aidl new file mode 100644 index 0000000000..16c0121f05 --- /dev/null +++ b/libraries/mapmodule/src/main/aidl/com/autonavi/nge/trafficInfo/TMCID.aidl @@ -0,0 +1,3 @@ +package com.autonavi.nge.trafficInfo; + +parcelable TMCID; \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/fBaseColor.glsl b/libraries/mapmodule/src/main/assets/shaders/fBaseColor.glsl new file mode 100644 index 0000000000..6100a4c6ac --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/fBaseColor.glsl @@ -0,0 +1,45 @@ +#version 300 es +precision highp float; +uniform float u_r; +uniform float u_add; +uniform float u_offset; +uniform float u_waveVel; +uniform vec4 u_waveColor; +in lowp float _type; +in lowp float _flag; +in highp float _off; +in highp float _time; +in highp vec3 _pos; +in lowp vec4 _color; +out lowp vec4 color; +void main() +{ + if (_type == 1.0) + { + lowp float r_base= 4.0; + lowp float r_max = u_r * 32.0; + highp vec3 l_pos = vec3(0, 2, -(u_offset+60.0)); + highp vec3 v = _pos - l_pos; + v.x = v.x*2.25; v.z = v.z/2.25; + highp float d = length(v); + highp float r = d - r_base; + color = _color; + if (r < r_max) + { + highp float p = pow((r_max-r)/r_max, 2.0); + highp float t = u_add*p * 0.15; + lowp vec4 c_light = _color + vec4(t,t,t*1.5,0); + color = c_light; + } + } + else if (_type == 2.0) + { + highp float k = clamp(cos(_time/20.0*u_waveVel-_off), 0.0,1.0); + k = pow(k, 25.0); + if (k > 0.98) k = 1.0; + else if (k < 0.02) k = 0.0; + color = u_waveColor * k + _color * (1.0-k); + } + else + color = _color; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/fBaseNor.glsl b/libraries/mapmodule/src/main/assets/shaders/fBaseNor.glsl new file mode 100644 index 0000000000..d0e0f36365 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/fBaseNor.glsl @@ -0,0 +1,82 @@ +#version 300 es +precision highp float; +uniform float u_main_shine; +uniform float u_other_shine; +uniform sampler2D u_texture; +uniform vec4 u_color; +uniform vec4 u_light_diffuse; +uniform vec4 u_light_specular; +uniform float u_shadow_black; +in float _type; +in float _flag; +in float _cmd; +in float _off; +in float _time; +in vec2 _tex; +in vec3 _nor; +in vec3 _v1; +in vec3 _v2; +in vec4 _back; +out vec4 color; +void main() +{ + vec4 tex = texture(u_texture, _tex); + if (_flag == 0.0) + color = texture(u_texture, _tex); + else if (_flag < 10.0) + { + float d = _flag * 0.08; + color = vec4(vec3(0,0,0),(0.4-d)) * u_shadow_black; + } + else + { + float shine1A = 60.0 * u_main_shine; + float shine2A = 30.0 * u_main_shine; + float shine1B = 20.0 * u_other_shine; + float shine2B = 10.0 * u_other_shine; + vec3 v1 = _type == 1.0 ? vec3(0,-1.2,1) : _v1; + float k1 = max(dot(normalize(_nor),normalize(- v1)), 0.0); + float k2 = max(dot(normalize(_nor),normalize(-_v2)), 0.0); + float dif1 = min(max(k1*(_type==1.0?1.2:2.4), 0.40), 0.60); + float dif2 = min(max(k2*(_type==1.0?0.6:1.2), 0.40), 0.60); + float spc1 = min(pow(k1,_type==1.0?shine1A:shine1B)*(_type==1.0?10.0:0.5), _type==1.0?0.2:0.3); + float spc2 = min(pow(k2,_type==1.0?shine2A:shine2B)*(_type==1.0?15.0:0.5), _type==1.0?0.2:0.1); + float dif = min(dif1+dif2, _type==1.0?0.85:0.80); + float spc = min(spc1+spc2, _type==1.0?0.25:0.20); + if (_type == 1.0) + color = tex*u_light_diffuse*dif + vec4(1,1,1,1)*spc1 + _back*spc2; + else if (_type == 2.0) + { + if (_cmd == 0.0) + { + vec4 c = u_color.r+u_color.g+u_color.b > 0.01 ? u_color : tex; + color = c*dif + u_light_specular*spc; + } + else if (_time == 0.0) + { + if (_cmd == 1.0) + color = (tex*0.5+u_color*0.5)*dif + u_light_specular*spc; + else + color = tex*dif + u_light_specular*spc; + } + else + { + vec4 c; + float d = mod(abs(_cmd), 2.0); + vec4 tex_ = tex*0.5 + u_color*0.5; + float t = _cmd > 0.0 ? (d==1.0?_time:1.0-_time) : (d==1.0?1.0-_time:_time); + if (t > _off+0.2) + c = d==1.0 ? tex_ : tex; + else if (t > _off) + { + float k = d==1.0 ? 0.5-(_off+0.2-t)/0.4 : (_off+0.2-t)/0.4; + c = u_color*k + tex*(1.0-k); + } + else + c = d==1.0 ? tex : tex_; + color = c*dif + u_light_specular*spc; + } + } + color.a = 1.0; + } +} diff --git a/libraries/mapmodule/src/main/assets/shaders/fBaseTex.glsl b/libraries/mapmodule/src/main/assets/shaders/fBaseTex.glsl new file mode 100644 index 0000000000..f777e3ff0d --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/fBaseTex.glsl @@ -0,0 +1,64 @@ +#version 300 es +precision highp float; +uniform vec4 u_color; +uniform sampler2D u_texture; +uniform int vr_type; +in float _type; +in float _flag; +in vec3 _pos; +in vec2 _tex; +in vec4 _clr; +out vec4 color; +void main() +{ + if (_type == 1.0) + { + vec4 c = texture(u_texture, _tex); + float a = c.a > 0.8 ? 1.0 : 0.0; + color = vec4(c.rgb, a); + } + else if (_type >= 2.0 && _type < 70.0) + { + float k = 1.0; // 渐进衰减 + if (_flag > 110.0) + k = 0.8; + else if (_flag > 10.0) + k = 1.0 - (_flag-10.0)/500.0; + vec4 c = texture(u_texture, _tex*_type); + float a = c.a > 0.8 ? 1.0 : 0.0; + color = vec4(c.rgb*k, a); + } + else if (_type >= 70.0 && _type < 74.0) + { + float alpha = _flag / 100.0; + float h = _clr.a / 170.0; + float hs = 8.0 * h; + float hi = floor(hs); + float f = (hs) - floor(hs); + float q = 1.0 - f; + if (hi <= 0.0) + if(vr_type == 1) + color = vec4(0.0, 0.9, 1.0, alpha); + else + color = vec4(0.15,0.99,1.0, alpha); + else if (hi <= 1.0) + if(vr_type == 1) + color = vec4(0.0, f, 0.9, alpha); + else + color = vec4(0.20,0.73,0.92, alpha); + else if (hi <= 2.0) + if(vr_type == 1) + color = vec4(0.35, 1.0, 0.8, alpha); + else + color = vec4(0.15,0.99,1.0, alpha); + else + if(vr_type == 1) + color = vec4(0.15, 0.73, 1.0, alpha); + else + color = vec4(0.15,0.99,1.0, alpha); + } + else if (u_color.r+u_color.g+u_color.b > 0.01) + color = u_color; + else + color = texture(u_texture, _tex); +} diff --git a/libraries/mapmodule/src/main/assets/shaders/fMogo_Shader.glsl b/libraries/mapmodule/src/main/assets/shaders/fMogo_Shader.glsl new file mode 100644 index 0000000000..9e5fec89c2 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/fMogo_Shader.glsl @@ -0,0 +1,169 @@ +#version 300 es +precision highp float; +precision highp sampler2DShadow; +precision mediump int; +uniform float colorFac; +uniform bool isTex; //是否是纹理 +uniform bool isShadow; //是否渲染阴影 +uniform bool isNightDay; //是否是白天模式 +uniform bool isRenderZebra; //斑马线渲染 +uniform bool isSpotLight; //是否聚光灯 +uniform bool isPcf; //是否聚光灯 +uniform bool isWave; //流光效果 +uniform sampler2D texId; +uniform sampler2DShadow depthTex; //深度纹理 +uniform bool isRenderSignalLine; //信号线 +uniform float signalLineTime; //信号线时间 +uniform float signalLineCnt; //信号线时间 +uniform int signalLineStep; //信号线时间 +uniform int signalLineObj; //信号线对象 +uniform vec4 shadowColor; +uniform float spotRadius; //聚光灯半径范围 +uniform float spotBright; //聚光灯亮度 +uniform float spotOffset; //聚光灯偏移 +uniform bool isRenderText; //是否是文字渲染 +uniform vec4 textColor; //信号线时间 +uniform bool isWater; //水系 +uniform vec4 waterColor; +uniform vec3 cameraPos; +uniform float shadowResolution; +in vec4 posInLight; +in vec4 _color; +in highp vec3 posInEye; +in vec2 _uv; +in float signalLineTexY; +uniform float waveVel; +uniform vec4 waveColor; +uniform float waveTime; +in highp float waveOff; +out vec4 fragColor; +in float distanceFromCamera; + +uniform bool isFogEnable; +uniform vec3 fogColor; +uniform float fogStart; +uniform float fogEnd; +uniform float fogDensity; +void setSpotLightColor(){ //聚光灯光照效果 + lowp float r_base= 4.0; + lowp float r_max = spotRadius * 32.0; + highp vec3 l_pos = vec3(0, 2, -(spotOffset+60.0)); + highp vec3 v = posInEye - l_pos; + v.x = v.x*2.25; v.z = v.z/2.25; + highp float d = length(v); + highp float r = d - r_base; + if (r < r_max) + { + highp float p = pow((r_max-r)/r_max, 2.0); + lowp float t = spotBright*p * 0.15; + lowp vec4 c_light = fragColor + vec4(t*2.0,t*2.0,t*3.0,0); + fragColor = c_light; + } +} +bool isInScreen(vec4 p){ //是否在包围盒[(0,0)-(1,1)]内 + if(p.x < 0.0 || p.x > 1.0 || p.y < 0.0 || p.y > 1.0) + return false; + else + return true; +} + +void setZebra(){ + vec4 c = texture(texId, _uv); + fragColor = vec4(c.rgb, step(0.8,c.a)); +} +void setColor(){ + fragColor = _color; +} +void setTex(){ + fragColor = texture(texId,_uv); +} +float getShadowOffset(float x, float y) +{ + float pixelSize = 1.0/shadowResolution; + vec4 offset = vec4(x,y,0.0, 0.0)*pixelSize * posInLight.w; + return textureProj(depthTex,posInLight + offset); +} +float getPcf(){ + // 3x3 kernel with 4 taps per sample, effectively 6x6 PCF + float sum = 0.0; + for(int x=-2;x<=2;x+=2) + for(int y=-2;y<=2;y+=2) + sum+=getShadowOffset(float(x),float(y)); + // divide sum by 9.0 + sum = sum * 0.11; + return sum; +} +void setShadow(){ + vec4 p = posInLight / posInLight.w; //ndc坐标 + if(isInScreen(p)){ //坐标不在[0,1]内,光源看不到此片元,那就不用处理此片元的阴影 +// float f = textureProj(depthTex,posInLight); //textureProj在阴影中返回0,否则返回1。即是否通过深度测试 + float k; + if(isPcf) + k = 1.0-getPcf(); + else + k = 1.0-textureProj(depthTex,posInLight); //textureProj在阴影中返回0,否则返回1。即是否通过深度测试 + fragColor = vec4(mix(vec3(fragColor),vec3(shadowColor*k),shadowColor.a*k),fragColor.a); + } +} +void setWave(){ +highp float k = clamp(cos(waveTime/20.0*waveVel-waveOff), 0.0,1.0); + k = clamp(pow(k, 25.0),0.02,0.98); + fragColor = mix(_color,waveColor,k); +} +void setSignalLine(){ + if(signalLineObj==0){ + if(signalLineStep==0 && _uv.y>1.0) + discard; + }else if(signalLineObj==1){ + if(_uv.x<0.0 || _uv.x>1.0) + discard; + if(signalLineStep==1){ + if(_uv.y 0.0 ? (d==1.0?_changeColorRatio:1.0-_changeColorRatio) : (d==1.0?1.0-_changeColorRatio:_changeColorRatio); + if (t > _changeColorOff+0.2) + retColor = d==1.0 ? tex_ : texColor; + else if (t > _changeColorOff) + { + float k = d==1.0 ? 0.5-(_changeColorOff+0.2-t)/0.4 : (_changeColorOff+0.2-t)/0.4; + retColor = replacedColor*k + texColor*(1.0-k); + } + else + retColor = d==1.0 ? texColor : tex_; + } + return retColor; +} +void setLinearFog() +{ + if(!isFogEnable) + return; + float distanceFromCamera = length(posInEye-cameraPos); + if(distanceFromCamera0.0){ + vec3 viewDir = normalize(-v_position); + vec3 reflectDir = normalize(reflect(-lightDir, norm)); + float spec = pow(max(dot(viewDir, reflectDir), 0.0), u_material_shiness); + specular = u_light_specular * spec; + } + o_fragColor = (ambient + diffuse)*v_color + specular; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/fShader_Light.glsl b/libraries/mapmodule/src/main/assets/shaders/fShader_Light.glsl new file mode 100644 index 0000000000..83663ff071 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/fShader_Light.glsl @@ -0,0 +1,32 @@ +#version 300 es +precision mediump float; +uniform vec4 u_light_ambient; +uniform vec4 u_light_diffuse; +uniform vec4 u_light_specular; +uniform vec3 u_light_dir; +uniform vec4 u_material_ambient; +uniform vec4 u_material_diffuse; +uniform vec4 u_material_specular; +uniform float u_material_shiness; +in vec3 v_position; +in vec3 v_normal; +out vec4 o_fragColor; +void main() +{ + // ambient \n" + vec4 ambient = u_material_ambient * u_light_ambient; + // diffuse + vec3 norm = normalize(v_normal.xyz); + vec3 lightDir = normalize(u_light_dir); + float diff = max(dot(norm, lightDir), 0.0); + vec4 diffuse = u_material_diffuse * u_light_diffuse * diff; + // specular + vec4 specular = vec4(0, 0, 0, 1); + if (u_material_shiness>0.0){ + vec3 viewDir = normalize(-v_position); + vec3 reflectDir = normalize(reflect(-lightDir, norm)); + float spec = pow(max(dot(viewDir, reflectDir), 0.0), u_material_shiness); + specular = u_material_specular * u_light_specular * spec; + } + o_fragColor = ambient + diffuse + specular; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/fShader_Texture.glsl b/libraries/mapmodule/src/main/assets/shaders/fShader_Texture.glsl new file mode 100644 index 0000000000..d4c5bb9725 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/fShader_Texture.glsl @@ -0,0 +1,16 @@ +#version 300 es +precision mediump float; +uniform sampler2D s_texture; +uniform int u_texture_env_mode; +in vec4 v_color; +in vec2 v_texcoord; +out vec4 o_fragColor; +void main() +{ + const int texture_env_mode_replace = 0x1E01; + const int texture_env_mode_modulate = 0x2100; + if (u_texture_env_mode==texture_env_mode_replace) + o_fragColor = texture( s_texture, v_texcoord ); + if (u_texture_env_mode==texture_env_mode_modulate) + o_fragColor = texture( s_texture, v_texcoord )*v_color; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/fShader_Texture1.glsl b/libraries/mapmodule/src/main/assets/shaders/fShader_Texture1.glsl new file mode 100644 index 0000000000..e511a5a812 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/fShader_Texture1.glsl @@ -0,0 +1,19 @@ +#version 300 es +precision mediump float; +uniform sampler2D s_texture; +uniform int u_texture_env_mode; +in vec4 v_color; +in vec2 v_texcoord; +out vec4 o_fragColor; +void main() +{ + const int texture_env_mode_replace = 0x1E01; + const int texture_env_mode_modulate = 0x2100; + if (u_texture_env_mode==texture_env_mode_replace) + o_fragColor = texture( s_texture, v_texcoord).aaaa; + if (u_texture_env_mode==texture_env_mode_modulate){ +// o_fragColor = texture( s_texture, v_texcoord).aaaa*v_color; + o_fragColor = vec4(1, 1, 1, texture( s_texture, v_texcoord).a)*v_color; + } +// o_fragColor = v_color; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/fShader_Texture_Light.glsl b/libraries/mapmodule/src/main/assets/shaders/fShader_Texture_Light.glsl new file mode 100644 index 0000000000..47a306bb81 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/fShader_Texture_Light.glsl @@ -0,0 +1,41 @@ +#version 300 es +precision mediump float; +uniform sampler2D s_texture; +uniform int u_texture_env_mode; +uniform vec4 u_light_ambient; +uniform vec4 u_light_diffuse; +uniform vec4 u_light_specular; +uniform vec3 u_light_dir; +uniform float u_material_shiness; +in vec3 v_position; +in vec2 v_texcoord; +in vec3 v_normal; +out vec4 o_fragColor; +void main() +{ + const int texture_env_mode_replace = 0x1E01; + const int texture_env_mode_modulate = 0x2100; + vec4 color = texture( s_texture, v_texcoord ); + if (u_texture_env_mode==texture_env_mode_replace) + o_fragColor = color; + else if (u_texture_env_mode==texture_env_mode_modulate){ + // ambient + vec4 ambient = u_light_ambient; + // diffuse + vec3 norm = normalize(v_normal.xyz); + vec3 lightDir = normalize(u_light_dir); + float diff = max(dot(norm, lightDir), 0.0); + vec4 diffuse = u_light_diffuse * diff; + // specular + vec4 specular = vec4(0, 0, 0, 1); + if (u_material_shiness>0.0){ + vec3 viewDir = normalize(-v_position); + vec3 reflectDir = normalize(reflect(-lightDir, norm)); + float spec = pow(max(dot(viewDir, reflectDir), 0.0), u_material_shiness); + specular = u_light_specular * spec; + } + o_fragColor = (ambient + diffuse)*color + specular; + } + else + o_fragColor = vec4(0, 0, 0, 1); +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/fShader_demo.glsl b/libraries/mapmodule/src/main/assets/shaders/fShader_demo.glsl new file mode 100644 index 0000000000..97a9a9019e --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/fShader_demo.glsl @@ -0,0 +1,9 @@ +#version 300 es +precision mediump float; +in vec4 v_color; +out vec4 o_fragColor; +void main() +{ + o_fragColor = v_color; +} + diff --git a/libraries/mapmodule/src/main/assets/shaders/fSkyBox_Shader.glsl b/libraries/mapmodule/src/main/assets/shaders/fSkyBox_Shader.glsl new file mode 100644 index 0000000000..8aadb2857f --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/fSkyBox_Shader.glsl @@ -0,0 +1,23 @@ +#version 300 es +precision mediump float; +uniform samplerCube texId; +uniform bool isFogEnable; +uniform vec3 fogColor; +uniform float fogStart; +uniform float fogEnd; +uniform float fogDensity; +uniform vec2 resolution; +in vec3 _uv; +out vec4 fragColor; +void setLinearFog() +{ + if(!isFogEnable) + return; + float a = clamp(0.0,1.0,(1.0-gl_FragCoord.y/resolution.y)*3.0); + fragColor.rgb = mix(fragColor.rgb,fogColor,fogDensity*a); +} +void main() +{ + fragColor = texture(texId, _uv); + setLinearFog(); +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/fWeather_Shader.glsl b/libraries/mapmodule/src/main/assets/shaders/fWeather_Shader.glsl new file mode 100644 index 0000000000..90242935ed --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/fWeather_Shader.glsl @@ -0,0 +1,10 @@ +#version 300 es +precision mediump float; +uniform sampler2D tex; +in float _alphaFac; +layout(location = 0) out vec4 color; +void main() +{ + color = texture(tex,gl_PointCoord); + color.a = color.a * _alphaFac; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/vBaseColor.glsl b/libraries/mapmodule/src/main/assets/shaders/vBaseColor.glsl new file mode 100644 index 0000000000..e6e1247e68 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/vBaseColor.glsl @@ -0,0 +1,24 @@ +#version 300 es +precision highp float; +uniform int u_type; +uniform mat4 u_mvMatrix; +uniform mat4 u_projMatrix; +uniform float u_time; +in vec4 pos; +in vec4 color; +out float _type; +out float _flag; +out float _off; +out float _time; +out vec3 _pos; +out vec4 _color; +void main() +{ + _type = float(u_type % 100); + _flag = float(u_type / 100); + _pos = (u_mvMatrix * pos).xyz; + _color = color; + _off = pos.y / 1000.0; + _time = u_time; + gl_Position = u_projMatrix * u_mvMatrix * pos; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/vBaseNor.glsl b/libraries/mapmodule/src/main/assets/shaders/vBaseNor.glsl new file mode 100644 index 0000000000..954e3a608a --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/vBaseNor.glsl @@ -0,0 +1,76 @@ +#version 300 es +uniform int u_type; +uniform mat4 u_mvMatrix; +uniform mat4 u_projMatrix; +uniform vec4 u_light_dir; +uniform int u_cmd; +uniform float u_time; +uniform float u_shadow_offset; +in vec4 pos; +in vec2 tex; +in vec4 nor; +out float _type; +out float _flag; +out float _cmd; +out float _off; +out float _time; +out vec2 _tex; +out vec3 _nor; +out vec3 _v1; +out vec3 _v2; +out vec4 _back; +void main() +{ + _type = float(u_type % 100); + _flag = float(u_type / 100); + vec4 p = pos; + _tex = tex; + _nor = nor.xzy; + _cmd = float(u_cmd); + _time = u_time; + if (_cmd == 0.0) + _off = 0.0; + else if (abs(_cmd) < 3.0) + _off = pos.x/500.0 + 0.5; + else + _off = pos.y/1000.0 + 0.5; + if (_type > 0.0 && _type < 10.0) + { + if (_flag < 10.0) + { + mat4 m = u_projMatrix * u_mvMatrix; + float dk = (2.0 - 0.1*pow((5.0-_flag),2.0)) * u_shadow_offset; + float dx = 0.05 * (_type==1.0 ? dk/4.0 : dk); + float dz = -0.20 * dk * length(m[0].xyz)*110.0; + p *= vec4(1.0+dx,1,1,1); + p = m * p; + p += vec4(0,dz,8,0); + gl_Position = p; + } + else + { + if (_type == 1.0) + { + _back = vec4(0.2,0.2,0.2,1); + if (pos.z > 180.0 && pos.z < 250.0) + { + if (_flag == 40.0) + _back = vec4(1,0,0,1); + else if (_flag == 50.0 || _flag == 20.0 && pos.x < -50.0 || _flag == 30.0 && pos.x > 50.0) + _back = vec4(1,1,0,1); + } + } + _v1 = vec3(u_light_dir.x, -u_light_dir.y, 0); + _v1 = (u_mvMatrix * vec4(_v1,0)).xyz; + _v1.y = length(_v1) * -1.2; + _v2 = (u_mvMatrix * vec4(0,-1,_type==1.0?-0.5:-0.25, 0)).xyz; + gl_Position = u_projMatrix * u_mvMatrix * p; + } + } + else + { + if (_type == 10.0 && _flag > 0.0) + p.x *= _flag / 100.0; + gl_Position = u_projMatrix * u_mvMatrix * p; + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/vBaseTex.glsl b/libraries/mapmodule/src/main/assets/shaders/vBaseTex.glsl new file mode 100644 index 0000000000..db4715bbd3 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/vBaseTex.glsl @@ -0,0 +1,23 @@ +#version 300 es +uniform int u_type; +uniform float point_size; +uniform mat4 u_mvMatrix; +uniform mat4 u_projMatrix; +in vec4 pos; +in vec2 tex; +in vec4 clr; +out float _type; +out float _flag; +out vec3 _pos; +out vec2 _tex; +out vec4 _clr; +void main() +{ + _type = float(u_type % 100); + _flag = float(u_type / 100); + _pos = pos.xyz; + _tex = tex; + _clr = clr; + gl_PointSize = point_size; + gl_Position = u_projMatrix * u_mvMatrix * pos; +} diff --git a/libraries/mapmodule/src/main/assets/shaders/vMogo_Shader.glsl b/libraries/mapmodule/src/main/assets/shaders/vMogo_Shader.glsl new file mode 100644 index 0000000000..bdb3f31ce9 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/vMogo_Shader.glsl @@ -0,0 +1,116 @@ +#version 300 es +precision highp float; +precision mediump int; +uniform mat4 modelMat; +uniform mat4 viewMat; +uniform mat4 projMat; +uniform mat4 mvMat; +uniform mat4 mvpMat; +uniform vec3 zebraPos0; +uniform vec3 zebraPos1; +uniform mat4 lightEyeMat; //光源的lookat矩阵 +uniform mat4 lightProjMat; +uniform mat4 biasMat; //映射矩阵,将[-1,1]映射到[0,1] +uniform bool isRenderZebra; //斑马线渲染 +uniform bool isShadow; //是否渲染阴影 +uniform bool isSpotLight; //是否聚光灯 +uniform bool isTex; //是否是纹理 +uniform bool isWave; //流光效果 +uniform bool isRenderSignalLine; //信号线 +uniform float signalLineTime; //信号线时间 +uniform int signalLineStep; //信号线阶段 +uniform int signalLineObj; //信号线对象 +uniform bool isWater; //水系 +uniform float waterTime; //水系滚动时间 +uniform bool isRenderDivider; +uniform vec3 dividerPos0; +uniform vec3 dividerPos1; +layout( location = 0 ) in vec4 pos; +layout(location = 1) in vec4 color; +layout(location = 3) in vec2 uv; +out vec4 posInLight; //从光源位置看此片元的proj坐标 +out vec4 _color; +out vec3 posInEye; //片元的view坐标 +out vec2 _uv; +out float signalLineTexY; +out float waveOff; +void setZebra(){ + vec4 pos0 = projMat*viewMat*modelMat * vec4(zebraPos0,1.0); + vec4 pos1 = projMat*viewMat*modelMat * vec4(zebraPos1,1.0); + float d = distance(pos0.xy/pos0.w,pos1.xy/pos1.w); //求出斑马线长边的长度 + int cnt = 0; //根据长边的长度决定画几根斑马线 + if(d<0.03) + cnt = 1; + else if(d<0.1) + cnt = 3; + else if(d<0.3) + cnt = 5; + else if(d<0.5) + cnt = 15; + else if(d < 1.4) + cnt = 30; + else + cnt = 30; + _uv = uv*float(cnt); +} +void setColor(){ + _color = color; +} +void setTex(){ + _uv = uv; +} +bool hasSetPosInEye = false; +void setPosInEye(){ + if(!hasSetPosInEye){ + posInEye = (viewMat * modelMat * pos).xyz; + hasSetPosInEye = true; + } +} +void setPosInLight(){ + posInLight = biasMat*lightProjMat * lightEyeMat * modelMat * pos; +} +void setWater(){ + _uv.x = _uv.x + waterTime; +} +void setWave(){ + waveOff = pos.y / 1000.0; +} +void setSignalLine(){ + if(signalLineObj==1 && signalLineStep>0){ + _uv.x = (uv.x - 0.5)*3.0 + 0.5; //x方向缩放 + _uv.y = uv.y; + signalLineTexY = _uv.y; + _uv = _uv + vec2(0.0,1.0)*signalLineTime; + } +} +void main() +{ + setPosInEye(); + if(isRenderDivider){ + vec4 pos0 = projMat*viewMat*modelMat * vec4(dividerPos0,1.0); + vec4 pos1 = projMat*viewMat*modelMat * vec4(dividerPos1,1.0); + float d = distance(pos0.xy/pos0.w,pos1.xy/pos1.w); //求出车道线的宽度 + if(d<0.001) //线宽小于阈值,丢弃 + return; + } + if(isShadow){ + setPosInLight(); + setPosInEye(); + } + if(isSpotLight){ + setPosInEye(); + } + if(isTex) + setTex(); + else + setColor(); + if(isRenderZebra) + setZebra(); + if(isWave) + setWave(); + if(isWater) + setWater(); + if(isRenderSignalLine) + setSignalLine(); + gl_Position = projMat*viewMat*modelMat * pos; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/vSelfCar_Shader.glsl b/libraries/mapmodule/src/main/assets/shaders/vSelfCar_Shader.glsl new file mode 100644 index 0000000000..c7a1b6f707 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/vSelfCar_Shader.glsl @@ -0,0 +1,39 @@ +#version 300 es +precision mediump float; +uniform mat4 modelMat; +uniform mat4 viewMat; +uniform mat4 projMat; +uniform vec3 lightWorldPos; //光源的世界坐标 +uniform int changeColorCmd; +uniform float changeColorRatio; + +layout(location = 0) in vec4 pos; +layout(location = 2) in vec3 normal; +layout(location = 3) in vec2 texCoord; + +out vec2 fragTexCoord; +out vec3 fragEyeNormal; +out vec3 fragEyePos; //光源的人眼坐标 +out vec3 lightEyePos; +out vec3 posInEye; +out float _changeColorCmd; +out float _changeColorRatio; +out float _changeColorOff; +void main() +{ + _changeColorCmd = float(changeColorCmd); + _changeColorRatio = changeColorRatio; + if(_changeColorCmd==0.0) + _changeColorOff = 0.0; + else if(abs(_changeColorCmd)<3.0) + _changeColorOff = pos.x/500.0 + 0.5; + else + _changeColorOff = pos.y/1000.0 + 0.5; + gl_Position = projMat * viewMat * modelMat * pos; + fragTexCoord = texCoord; + mat3 normalMat = mat3(transpose(inverse(viewMat * modelMat))); + fragEyeNormal = normalize(normalMat * normal); //法线矩阵变换 + fragEyePos = (viewMat * modelMat * pos).xyz; + lightEyePos = (viewMat*vec4(lightWorldPos,1.0)).xyz; + posInEye = (modelMat * pos).xyz; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/vShader_Color.glsl b/libraries/mapmodule/src/main/assets/shaders/vShader_Color.glsl new file mode 100644 index 0000000000..e8bdd20208 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/vShader_Color.glsl @@ -0,0 +1,12 @@ +#version 300 es +uniform mat4 u_projMatrix; +uniform mat4 u_mvMatrix; +uniform float u_colorScaleFactor; +layout(location = 0) in vec4 a_position; +layout(location = 1) in vec4 a_color; +out vec4 v_color; +void main() +{ + v_color = a_color*u_colorScaleFactor; + gl_Position = u_projMatrix * u_mvMatrix * a_position; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/vShader_Color_Light.glsl b/libraries/mapmodule/src/main/assets/shaders/vShader_Color_Light.glsl new file mode 100644 index 0000000000..86e0cb0551 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/vShader_Color_Light.glsl @@ -0,0 +1,17 @@ +#version 300 es +uniform mat4 u_projMatrix; +uniform mat4 u_mvMatrix; +uniform float u_colorScaleFactor; +layout(location = 0) in vec4 a_position; +layout(location = 1) in vec4 a_color; +layout(location = 2) in vec4 a_normal; +out vec3 v_position; +out vec4 v_color; +out vec3 v_normal; +void main() +{ + v_position = (u_mvMatrix * a_position).xyz; + v_color = a_color*u_colorScaleFactor; + v_normal = (transpose(inverse(u_mvMatrix)) * a_normal).xyz; + gl_Position = u_projMatrix * u_mvMatrix * a_position; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/vShader_Light.glsl b/libraries/mapmodule/src/main/assets/shaders/vShader_Light.glsl new file mode 100644 index 0000000000..0576e48479 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/vShader_Light.glsl @@ -0,0 +1,13 @@ +#version 300 es +uniform mat4 u_projMatrix; +uniform mat4 u_mvMatrix; +layout(location = 0) in vec4 a_position; +layout(location = 1) in vec4 a_normal; +out vec3 v_position; +out vec3 v_normal; +void main() +{ + v_position = (u_mvMatrix * a_position).xyz; + v_normal = (transpose(inverse(u_mvMatrix)) * a_normal).xyz; + gl_Position = u_projMatrix * u_mvMatrix * a_position; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/vShader_Texture.glsl b/libraries/mapmodule/src/main/assets/shaders/vShader_Texture.glsl new file mode 100644 index 0000000000..2ce3671ea3 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/vShader_Texture.glsl @@ -0,0 +1,15 @@ +#version 300 es +uniform mat4 u_projMatrix; +uniform mat4 u_mvMatrix; +uniform float u_colorScaleFactor; +layout(location = 0) in vec4 a_position; +layout(location = 1) in vec4 a_color; +layout(location = 2) in vec2 a_texcoord; +out vec4 v_color; +out vec2 v_texcoord; +void main() +{ + v_color = a_color*u_colorScaleFactor; + v_texcoord = a_texcoord; + gl_Position = u_projMatrix * u_mvMatrix * a_position; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/vShader_Texture_Light.glsl b/libraries/mapmodule/src/main/assets/shaders/vShader_Texture_Light.glsl new file mode 100644 index 0000000000..79e73b0930 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/vShader_Texture_Light.glsl @@ -0,0 +1,16 @@ +#version 300 es +uniform mat4 u_projMatrix; +uniform mat4 u_mvMatrix; +layout(location = 0) in vec4 a_position; +layout(location = 1) in vec2 a_texcoord; +layout(location = 2) in vec4 a_normal; +out vec3 v_position; +out vec2 v_texcoord; +out vec3 v_normal; +void main() +{ + v_position = (u_mvMatrix * a_position).xyz; + v_texcoord = a_texcoord; + v_normal = (transpose(inverse(u_mvMatrix)) * a_normal).xyz; + gl_Position = u_projMatrix * u_mvMatrix * a_position; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/vShader_demo.glsl b/libraries/mapmodule/src/main/assets/shaders/vShader_demo.glsl new file mode 100644 index 0000000000..0c3db2d1a4 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/vShader_demo.glsl @@ -0,0 +1,11 @@ +#version 300 es +uniform mat4 u_projMatrix; +uniform mat4 u_mvMatrix; +layout(location = 0) in vec4 a_position; +layout(location = 1) in vec4 a_color; +out vec4 v_color; +void main() +{ + v_color = a_color; + gl_Position = u_projMatrix * u_mvMatrix * a_position; +} diff --git a/libraries/mapmodule/src/main/assets/shaders/vSkyBox_Shader.glsl b/libraries/mapmodule/src/main/assets/shaders/vSkyBox_Shader.glsl new file mode 100644 index 0000000000..4f02bf8822 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/vSkyBox_Shader.glsl @@ -0,0 +1,12 @@ +#version 300 es +precision mediump float; +uniform mat4 modelMat; +uniform mat4 viewMat; +uniform mat4 projMat; +layout( location = 0) in vec4 pos; +out vec3 _uv; +void main() +{ + gl_Position = (projMat * viewMat * modelMat * pos).xyww; + _uv = pos.xyz; +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/shaders/vWeather_Shader.glsl b/libraries/mapmodule/src/main/assets/shaders/vWeather_Shader.glsl new file mode 100644 index 0000000000..556aa57115 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/shaders/vWeather_Shader.glsl @@ -0,0 +1,14 @@ +#version 300 es +precision mediump float; +uniform mat4 modelMat; +uniform mat4 viewMat; +uniform mat4 projMat; +uniform float pointSize; +layout(location = 0) in vec4 pos; +out float _alphaFac; +void main() +{ + gl_Position = projMat*viewMat*modelMat*vec4(pos.xyz,1.0); + gl_PointSize = (1.0-gl_Position.z/gl_Position.w)*pointSize; + _alphaFac = pos.w; +} diff --git a/libraries/mapmodule/src/main/assets/style/16_1.dat b/libraries/mapmodule/src/main/assets/style/16_1.dat new file mode 100644 index 0000000000..46d78a2dda Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/16_1.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/16_2.dat b/libraries/mapmodule/src/main/assets/style/16_2.dat new file mode 100644 index 0000000000..1f6ad6bde4 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/16_2.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/1_1.dat b/libraries/mapmodule/src/main/assets/style/1_1.dat new file mode 100644 index 0000000000..f76dd238ad Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/1_1.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/1_2.dat b/libraries/mapmodule/src/main/assets/style/1_2.dat new file mode 100644 index 0000000000..f76dd238ad Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/1_2.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/2_1.dat b/libraries/mapmodule/src/main/assets/style/2_1.dat new file mode 100644 index 0000000000..593f4708db Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/2_1.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/2_2.dat b/libraries/mapmodule/src/main/assets/style/2_2.dat new file mode 100644 index 0000000000..593f4708db Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/2_2.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/32_1.dat b/libraries/mapmodule/src/main/assets/style/32_1.dat new file mode 100644 index 0000000000..ab0854bc98 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/32_1.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/32_2.dat b/libraries/mapmodule/src/main/assets/style/32_2.dat new file mode 100644 index 0000000000..c1a90446f6 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/32_2.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/4_1.dat b/libraries/mapmodule/src/main/assets/style/4_1.dat new file mode 100644 index 0000000000..47ffdce081 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/4_1.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/4_2.dat b/libraries/mapmodule/src/main/assets/style/4_2.dat new file mode 100644 index 0000000000..01d633b27e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/4_2.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/64_1.dat b/libraries/mapmodule/src/main/assets/style/64_1.dat new file mode 100644 index 0000000000..8e51e44015 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/64_1.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/64_2.dat b/libraries/mapmodule/src/main/assets/style/64_2.dat new file mode 100644 index 0000000000..2f698d5362 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/64_2.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/8_1.dat b/libraries/mapmodule/src/main/assets/style/8_1.dat new file mode 100644 index 0000000000..fbba842ed5 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/8_1.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/8_2.dat b/libraries/mapmodule/src/main/assets/style/8_2.dat new file mode 100644 index 0000000000..97cc6d527e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/8_2.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/Thumbs.db b/libraries/mapmodule/src/main/assets/style/Thumbs.db new file mode 100644 index 0000000000..47c1c1a9f3 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/Thumbs.db differ diff --git a/libraries/mapmodule/src/main/assets/style/connector_line.png b/libraries/mapmodule/src/main/assets/style/connector_line.png new file mode 100644 index 0000000000..3772fe1e3d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/connector_line.png differ diff --git a/libraries/mapmodule/src/main/assets/style/connector_line_bg1.png b/libraries/mapmodule/src/main/assets/style/connector_line_bg1.png new file mode 100644 index 0000000000..a21ef1236e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/connector_line_bg1.png differ diff --git a/libraries/mapmodule/src/main/assets/style/connector_line_jian_body.png b/libraries/mapmodule/src/main/assets/style/connector_line_jian_body.png new file mode 100644 index 0000000000..b0e3922ce1 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/connector_line_jian_body.png differ diff --git a/libraries/mapmodule/src/main/assets/style/connector_line_jian_tou.png b/libraries/mapmodule/src/main/assets/style/connector_line_jian_tou.png new file mode 100644 index 0000000000..4aca93c6f7 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/connector_line_jian_tou.png differ diff --git a/libraries/mapmodule/src/main/assets/style/connector_line_jian_tou1.png b/libraries/mapmodule/src/main/assets/style/connector_line_jian_tou1.png new file mode 100644 index 0000000000..cfa4928179 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/connector_line_jian_tou1.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/100-120-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/100-120-speed.png new file mode 100644 index 0000000000..ec5054b5ce Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/100-120-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/16-19_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/16-19_white.png new file mode 100644 index 0000000000..558bc23266 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/16-19_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/16-19_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/16-19_yellow.png new file mode 100644 index 0000000000..c33000b391 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/16-19_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/16_18.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/16_18.png new file mode 100644 index 0000000000..3781dd6740 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/16_18.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/17-19_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/17-19_white.png new file mode 100644 index 0000000000..15b1b42d40 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/17-19_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/17-19_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/17-19_yellow.png new file mode 100644 index 0000000000..d3e41b6ccd Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/17-19_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/17-20_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/17-20_white.png new file mode 100644 index 0000000000..9c088de47b Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/17-20_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/17-20_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/17-20_yellow.png new file mode 100644 index 0000000000..5c4425af71 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/17-20_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/1730-1930-white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/1730-1930-white.png new file mode 100644 index 0000000000..4895fc30ce Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/1730-1930-white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/1730-1930-yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/1730-1930-yellow.png new file mode 100644 index 0000000000..248e737821 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/1730-1930-yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/40-speed-white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/40-speed-white.png new file mode 100644 index 0000000000..bb0a246575 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/40-speed-white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/40-speed-yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/40-speed-yellow.png new file mode 100644 index 0000000000..6bdd37f989 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/40-speed-yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/415_1.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/415_1.png new file mode 100644 index 0000000000..1119936e5a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/415_1.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/416.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/416.png new file mode 100644 index 0000000000..54b4fd54e3 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/416.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/6-20_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/6-20_white.png new file mode 100644 index 0000000000..91100d8ec2 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/6-20_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/6-22_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/6-22_white.png new file mode 100644 index 0000000000..b210f0a54a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/6-22_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/60-100-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/60-100-speed.png new file mode 100644 index 0000000000..1416657c66 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/60-100-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/60-80-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/60-80-speed.png new file mode 100644 index 0000000000..2ac13d6028 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/60-80-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/60-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/60-speed.png new file mode 100644 index 0000000000..6f49d09568 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/60-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/7-10-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/7-10-speed.png new file mode 100644 index 0000000000..619a89fe7c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/7-10-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/7-22.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/7-22.png new file mode 100644 index 0000000000..1e771e45de Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/7-22.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/7-9_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/7-9_white.png new file mode 100644 index 0000000000..c0c1698851 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/7-9_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/7-9_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/7-9_yellow.png new file mode 100644 index 0000000000..c72e383182 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/7-9_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/80-100-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/80-100-speed.png new file mode 100644 index 0000000000..8469614925 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/80-100-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/80-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/80-speed.png new file mode 100644 index 0000000000..f764ae51d6 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/80-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/90-120-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/90-120-speed.png new file mode 100644 index 0000000000..e11daa89be Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/90-120-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/AcrossLane.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/AcrossLane.png new file mode 100644 index 0000000000..adf58d144a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/AcrossLane.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/BigRectForbidArea.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/BigRectForbidArea.png new file mode 100644 index 0000000000..cb65fa5828 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/BigRectForbidArea.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/BigSquareForbidArea.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/BigSquareForbidArea.png new file mode 100644 index 0000000000..028fd4f105 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/BigSquareForbidArea.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/ForbidArea.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/ForbidArea.png new file mode 100644 index 0000000000..b4e5bbb09e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/ForbidArea.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/ParkingLotSign.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/ParkingLotSign.png new file mode 100644 index 0000000000..7416165e3d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/ParkingLotSign.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/ReversibleLane.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/ReversibleLane.png new file mode 100644 index 0000000000..10aee51edb Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/ReversibleLane.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/Rhombus.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/Rhombus.png new file mode 100644 index 0000000000..3b9cd2432b Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/Rhombus.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/School.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/School.png new file mode 100644 index 0000000000..10b1981c47 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/School.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SmaRectForbidArea.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SmaRectForbidArea.png new file mode 100644 index 0000000000..a413245d89 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SmaRectForbidArea.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SmaSquareForbidArea.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SmaSquareForbidArea.png new file mode 100644 index 0000000000..e86d4702a8 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SmaSquareForbidArea.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump1_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump1_red.png new file mode 100644 index 0000000000..8eb59e4286 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump1_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump1_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump1_white.png new file mode 100644 index 0000000000..639c5503a1 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump1_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump1_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump1_yellow.png new file mode 100644 index 0000000000..970a9b97fd Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump1_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump2_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump2_red.png new file mode 100644 index 0000000000..471ad03b6e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump2_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump2_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump2_white.png new file mode 100644 index 0000000000..a340429b36 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump2_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump2_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump2_yellow.png new file mode 100644 index 0000000000..f9c2ffeb99 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump2_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump3_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump3_red.png new file mode 100644 index 0000000000..9fd95da302 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump3_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump3_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump3_white.png new file mode 100644 index 0000000000..fee7cf6166 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump3_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump3_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump3_yellow.png new file mode 100644 index 0000000000..55e8fe663a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump3_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump4_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump4_red.png new file mode 100644 index 0000000000..752f41eeb9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump4_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump4_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump4_white.png new file mode 100644 index 0000000000..b558db79da Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump4_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump4_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump4_yellow.png new file mode 100644 index 0000000000..3d59690706 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump4_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump5_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump5_red.png new file mode 100644 index 0000000000..ad5aa7c5ce Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump5_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump5_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump5_white.png new file mode 100644 index 0000000000..780fe3edbd Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump5_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump5_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump5_yellow.png new file mode 100644 index 0000000000..0900c8e46f Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/SpeedBump5_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/Triangle.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/Triangle.png new file mode 100644 index 0000000000..19d58e3bb7 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/Triangle.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump1_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump1_red.png new file mode 100644 index 0000000000..26540f589f Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump1_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump1_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump1_white.png new file mode 100644 index 0000000000..369ad00b66 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump1_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump1_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump1_yellow.png new file mode 100644 index 0000000000..2eaffd3e21 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump1_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump2_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump2_red.png new file mode 100644 index 0000000000..057c835059 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump2_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump2_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump2_white.png new file mode 100644 index 0000000000..4910f0e515 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump2_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump2_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump2_yellow.png new file mode 100644 index 0000000000..bcd0be6bf5 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump2_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump3_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump3_red.png new file mode 100644 index 0000000000..dedb2a8b81 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump3_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump3_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump3_white.png new file mode 100644 index 0000000000..da9591f15d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump3_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump3_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump3_yellow.png new file mode 100644 index 0000000000..feda70ed7d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump3_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump4_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump4_red.png new file mode 100644 index 0000000000..70f8f5aa61 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump4_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump4_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump4_white.png new file mode 100644 index 0000000000..792a4e7e8c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump4_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump4_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump4_yellow.png new file mode 100644 index 0000000000..85552e04e0 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump4_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump5_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump5_red.png new file mode 100644 index 0000000000..71845fb3aa Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump5_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump5_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump5_white.png new file mode 100644 index 0000000000..53dcf20baf Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump5_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump5_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump5_yellow.png new file mode 100644 index 0000000000..0bece0e9ba Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/UnSpeedBump5_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/VerticalLane.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/VerticalLane.png new file mode 100644 index 0000000000..16b5b21bae Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/VerticalLane.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/WithBusAcross.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/WithBusAcross.png new file mode 100644 index 0000000000..1440d94f9f Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/WithBusAcross.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/WithBusVertical.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/WithBusVertical.png new file mode 100644 index 0000000000..16b5b21bae Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/WithBusVertical.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/battery.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/battery.png new file mode 100644 index 0000000000..f1da3b374a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/battery.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_cross_left.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_cross_left.png new file mode 100644 index 0000000000..185407aa47 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_cross_left.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_cross_right.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_cross_right.png new file mode 100644 index 0000000000..2163faa775 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_cross_right.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_vertical_LL.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_vertical_LL.png new file mode 100644 index 0000000000..804a18b616 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_vertical_LL.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_vertical_left.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_vertical_left.png new file mode 100644 index 0000000000..adc906ced7 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_vertical_left.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_vertical_right.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_vertical_right.png new file mode 100644 index 0000000000..1f1a172071 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_vertical_right.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_vertical_right_down.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_vertical_right_down.png new file mode 100644 index 0000000000..55ada63c09 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bicycle_vertical_right_down.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bus.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bus.png new file mode 100644 index 0000000000..6300f3af11 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bus.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busLaneAcross.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busLaneAcross.png new file mode 100644 index 0000000000..366c7f38c6 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busLaneAcross.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busLaneVertical.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busLaneVertical.png new file mode 100644 index 0000000000..dc545cf304 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busLaneVertical.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busStation.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busStation.png new file mode 100644 index 0000000000..8176386662 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busStation.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busStop.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busStop.png new file mode 100644 index 0000000000..efc25574af Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busStop.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busTransitLaneV.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busTransitLaneV.png new file mode 100644 index 0000000000..7ae2cb3d64 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/busTransitLaneV.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bus_Rapid_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bus_Rapid_white.png new file mode 100644 index 0000000000..702d22ba8c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bus_Rapid_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bus_Rapid_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bus_Rapid_yellow.png new file mode 100644 index 0000000000..fc851ceb4d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/bus_Rapid_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/carpeople.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/carpeople.png new file mode 100644 index 0000000000..4d00789ad6 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/carpeople.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/comityPedestrianC.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/comityPedestrianC.png new file mode 100644 index 0000000000..a4f1ccbb3c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/comityPedestrianC.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/comityPedestrianCShu.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/comityPedestrianCShu.png new file mode 100644 index 0000000000..03d5b0fa79 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/comityPedestrianCShu.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/comity_Pedestrian.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/comity_Pedestrian.png new file mode 100644 index 0000000000..061d909dbe Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/comity_Pedestrian.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/comity_PedestrianShu.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/comity_PedestrianShu.png new file mode 100644 index 0000000000..a2883290dc Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/comity_PedestrianShu.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/divider15_left.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/divider15_left.png new file mode 100644 index 0000000000..f4c9b68ac0 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/divider15_left.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/divider15_right.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/divider15_right.png new file mode 100644 index 0000000000..a69defc03c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/divider15_right.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/exit.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/exit.png new file mode 100644 index 0000000000..26d8002ddb Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/exit.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/goStraightTurnRightLeft.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/goStraightTurnRightLeft.png new file mode 100644 index 0000000000..5f18e4c678 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/goStraightTurnRightLeft.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraight.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraight.png new file mode 100644 index 0000000000..e47c770a7e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraight.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightleft.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightleft.png new file mode 100644 index 0000000000..e76913f9fd Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightleft.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightleftright.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightleftright.png new file mode 100644 index 0000000000..ce81a74093 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightleftright.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightleftround.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightleftround.png new file mode 100644 index 0000000000..fdfa403376 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightleftround.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightrightround.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightrightround.png new file mode 100644 index 0000000000..5536c5297b Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightrightround.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightrightturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightrightturn.png new file mode 100644 index 0000000000..ddc069fdb0 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/gostraightrightturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/hov.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/hov.png new file mode 100644 index 0000000000..9557865592 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/hov.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftleftround.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftleftround.png new file mode 100644 index 0000000000..122a006c85 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftleftround.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftrightturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftrightturn.png new file mode 100644 index 0000000000..d4b5a24ac9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftrightturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftround.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftround.png new file mode 100644 index 0000000000..95b4536dfc Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftround.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftturn.png new file mode 100644 index 0000000000..45613cece0 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftwaitturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftwaitturn.png new file mode 100644 index 0000000000..67dd20451f Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/leftwaitturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/motorVehiclesC.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/motorVehiclesC.png new file mode 100644 index 0000000000..380c6b1815 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/motorVehiclesC.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noCrossLine.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noCrossLine.png new file mode 100644 index 0000000000..e7e6798085 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noCrossLine.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noLeftOrTurn.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noLeftOrTurn.png new file mode 100644 index 0000000000..739b43768c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noLeftOrTurn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noStopMarking.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noStopMarking.png new file mode 100644 index 0000000000..4f4794b68d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noStopMarking.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noTurn.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noTurn.png new file mode 100644 index 0000000000..b63d967ce5 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noTurn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noleftturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noleftturn.png new file mode 100644 index 0000000000..b0fbb66ce1 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/noleftturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/onlyTaxi.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/onlyTaxi.png new file mode 100644 index 0000000000..18b6616da2 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/onlyTaxi.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/policeSpecialV.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/policeSpecialV.png new file mode 100644 index 0000000000..a04ff59982 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/policeSpecialV.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/rightrightround.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/rightrightround.png new file mode 100644 index 0000000000..228546513d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/rightrightround.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/rightround.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/rightround.png new file mode 100644 index 0000000000..07d5c7699d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/rightround.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/rightturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/rightturn.png new file mode 100644 index 0000000000..5c2e751ddf Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/rightturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/rightwaitturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/rightwaitturn.png new file mode 100644 index 0000000000..27be89f406 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/rightwaitturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/schoolZone_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/schoolZone_white.png new file mode 100644 index 0000000000..10b1981c47 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/schoolZone_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/schoolZone_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/schoolZone_yellow.png new file mode 100644 index 0000000000..398b418e05 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/schoolZone_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/sideRoad.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/sideRoad.png new file mode 100644 index 0000000000..416eeb43d9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/sideRoad.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/stop.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/stop.png new file mode 100644 index 0000000000..5705cf6c46 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/stop.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/throughWordsV_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/throughWordsV_white.png new file mode 100644 index 0000000000..6926910472 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/throughWordsV_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/throughWordsV_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/throughWordsV_yellow.png new file mode 100644 index 0000000000..744374c5c6 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/throughWordsV_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/tourRoad.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/tourRoad.png new file mode 100644 index 0000000000..9455fb431a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/tourRoad.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/walk.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/walk.png new file mode 100644 index 0000000000..8e0e5826bb Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/walk.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra.png new file mode 100644 index 0000000000..dbb2c139dd Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing1.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing1.png new file mode 100644 index 0000000000..27bcacb57e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing1.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing10.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing10.png new file mode 100644 index 0000000000..7a239089e3 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing10.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing11.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing11.png new file mode 100644 index 0000000000..412df5d51a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing11.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing12.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing12.png new file mode 100644 index 0000000000..2f15d8af99 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing12.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing13.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing13.png new file mode 100644 index 0000000000..498d64e5b8 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing13.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing2.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing2.png new file mode 100644 index 0000000000..7ea0e12a6c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing2.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing3.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing3.png new file mode 100644 index 0000000000..7b061a85c0 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing3.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing4.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing4.png new file mode 100644 index 0000000000..d142e854aa Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing4.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing5.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing5.png new file mode 100644 index 0000000000..e5064edd2c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing5.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing6.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing6.png new file mode 100644 index 0000000000..ba0f71646a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing6.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing7.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing7.png new file mode 100644 index 0000000000..99e6906cf6 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing7.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing8.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing8.png new file mode 100644 index 0000000000..fad46892bb Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing8.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing9.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing9.png new file mode 100644 index 0000000000..43e3d74cad Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_crossing9.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_polygon.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_polygon.png new file mode 100644 index 0000000000..af2f101c30 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_polygon.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_three.png b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_three.png new file mode 100644 index 0000000000..67c7aabd42 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/day_mode/zebra_three.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/bicyclepoint.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/bicyclepoint.nt3d new file mode 100644 index 0000000000..13e0e51388 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/bicyclepoint.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/big_bus_station.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/big_bus_station.nt3d new file mode 100644 index 0000000000..f3394f4374 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/big_bus_station.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/bridge.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/bridge.nt3d new file mode 100644 index 0000000000..5579b1dc53 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/bridge.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/camera_qiang.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/camera_qiang.nt3d new file mode 100644 index 0000000000..e9b2d3b391 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/camera_qiang.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/camera_yuan.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/camera_yuan.nt3d new file mode 100644 index 0000000000..d21ad95a4a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/camera_yuan.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/denggan.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/denggan.nt3d new file mode 100644 index 0000000000..211995f1f9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/denggan.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/leida.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/leida.nt3d new file mode 100644 index 0000000000..387ed2cc46 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/leida.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/mec.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/mec.nt3d new file mode 100644 index 0000000000..6c4e0628d9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/mec.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/rsu.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/rsu.nt3d new file mode 100644 index 0000000000..0439feec84 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/rsu.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/small_bus_station.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/small_bus_station.nt3d new file mode 100644 index 0000000000..c00047004c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/small_bus_station.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/traffic_camera.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/traffic_camera.nt3d new file mode 100644 index 0000000000..b18cb87df6 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/traffic_camera.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/traffic_light.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/traffic_light.nt3d new file mode 100644 index 0000000000..3e9cafd344 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/traffic_light.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/xinjiandenggan.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/xinjiandenggan.nt3d new file mode 100644 index 0000000000..1a41f96277 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/day_mode/xinjiandenggan.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/bicyclepoint.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/bicyclepoint.nt3d new file mode 100644 index 0000000000..13e0e51388 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/bicyclepoint.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/big_bus_station.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/big_bus_station.nt3d new file mode 100644 index 0000000000..f3394f4374 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/big_bus_station.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/bridge.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/bridge.nt3d new file mode 100644 index 0000000000..5579b1dc53 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/bridge.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/camera_qiang.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/camera_qiang.nt3d new file mode 100644 index 0000000000..e9b2d3b391 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/camera_qiang.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/camera_yuan.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/camera_yuan.nt3d new file mode 100644 index 0000000000..d21ad95a4a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/camera_yuan.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/denggan.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/denggan.nt3d new file mode 100644 index 0000000000..211995f1f9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/denggan.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/leida.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/leida.nt3d new file mode 100644 index 0000000000..387ed2cc46 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/leida.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/mec.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/mec.nt3d new file mode 100644 index 0000000000..6c4e0628d9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/mec.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/rsu.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/rsu.nt3d new file mode 100644 index 0000000000..0439feec84 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/rsu.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/small_bus_station.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/small_bus_station.nt3d new file mode 100644 index 0000000000..c00047004c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/small_bus_station.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/traffic_camera.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/traffic_camera.nt3d new file mode 100644 index 0000000000..b18cb87df6 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/traffic_camera.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/traffic_light.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/traffic_light.nt3d new file mode 100644 index 0000000000..3e9cafd344 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/traffic_light.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/xinjiandenggan.nt3d b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/xinjiandenggan.nt3d new file mode 100644 index 0000000000..1a41f96277 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/hd_n3d/night_mode/xinjiandenggan.nt3d differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/100-120-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/100-120-speed.png new file mode 100644 index 0000000000..72bec383f8 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/100-120-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/16-19_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/16-19_white.png new file mode 100644 index 0000000000..1f8746bd20 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/16-19_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/16-19_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/16-19_yellow.png new file mode 100644 index 0000000000..62757a3436 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/16-19_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/16_18.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/16_18.png new file mode 100644 index 0000000000..9c153bece2 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/16_18.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/17-19_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/17-19_white.png new file mode 100644 index 0000000000..00da2304c5 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/17-19_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/17-19_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/17-19_yellow.png new file mode 100644 index 0000000000..6ac9d3228b Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/17-19_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/17-20_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/17-20_white.png new file mode 100644 index 0000000000..0549ffaf95 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/17-20_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/17-20_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/17-20_yellow.png new file mode 100644 index 0000000000..04d82a65e9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/17-20_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/1730-1930-white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/1730-1930-white.png new file mode 100644 index 0000000000..bf1066368c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/1730-1930-white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/1730-1930-yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/1730-1930-yellow.png new file mode 100644 index 0000000000..b4f59fbe7a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/1730-1930-yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/40-speed-white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/40-speed-white.png new file mode 100644 index 0000000000..796506153e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/40-speed-white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/40-speed-yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/40-speed-yellow.png new file mode 100644 index 0000000000..40ba7a2d01 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/40-speed-yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/415_1.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/415_1.png new file mode 100644 index 0000000000..573c7c0321 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/415_1.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/416.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/416.png new file mode 100644 index 0000000000..54b4fd54e3 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/416.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/6-20_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/6-20_white.png new file mode 100644 index 0000000000..be880ac71a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/6-20_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/6-22_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/6-22_white.png new file mode 100644 index 0000000000..beea975a49 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/6-22_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/60-100-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/60-100-speed.png new file mode 100644 index 0000000000..ca41ee155e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/60-100-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/60-80-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/60-80-speed.png new file mode 100644 index 0000000000..fc89eef7f8 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/60-80-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/60-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/60-speed.png new file mode 100644 index 0000000000..faaea431b6 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/60-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/7-10-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/7-10-speed.png new file mode 100644 index 0000000000..2d5051ba75 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/7-10-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/7-22.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/7-22.png new file mode 100644 index 0000000000..bebed816bb Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/7-22.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/7-9_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/7-9_white.png new file mode 100644 index 0000000000..165cb877ed Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/7-9_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/7-9_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/7-9_yellow.png new file mode 100644 index 0000000000..49df92021e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/7-9_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/80-100-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/80-100-speed.png new file mode 100644 index 0000000000..f4e903a215 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/80-100-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/80-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/80-speed.png new file mode 100644 index 0000000000..c6f32fa5f0 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/80-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/90-120-speed.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/90-120-speed.png new file mode 100644 index 0000000000..926e10864d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/90-120-speed.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/AcrossLane.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/AcrossLane.png new file mode 100644 index 0000000000..5ddf424360 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/AcrossLane.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/BigRectForbidArea.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/BigRectForbidArea.png new file mode 100644 index 0000000000..3b6536d1e5 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/BigRectForbidArea.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/BigSquareForbidArea.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/BigSquareForbidArea.png new file mode 100644 index 0000000000..ff1f8dfc1a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/BigSquareForbidArea.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/ForbidArea.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/ForbidArea.png new file mode 100644 index 0000000000..e86d4702a8 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/ForbidArea.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/ParkingLotSign.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/ParkingLotSign.png new file mode 100644 index 0000000000..217da0e716 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/ParkingLotSign.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/ReversibleLane.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/ReversibleLane.png new file mode 100644 index 0000000000..a3db18f864 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/ReversibleLane.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/Rhombus.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/Rhombus.png new file mode 100644 index 0000000000..58f0c631d9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/Rhombus.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/School.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/School.png new file mode 100644 index 0000000000..303128f379 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/School.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SmaRectForbidArea.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SmaRectForbidArea.png new file mode 100644 index 0000000000..efa145ba72 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SmaRectForbidArea.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SmaSquareForbidArea.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SmaSquareForbidArea.png new file mode 100644 index 0000000000..e86d4702a8 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SmaSquareForbidArea.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump1_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump1_red.png new file mode 100644 index 0000000000..8eb59e4286 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump1_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump1_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump1_white.png new file mode 100644 index 0000000000..4ad88b7d01 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump1_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump1_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump1_yellow.png new file mode 100644 index 0000000000..c75e4bbca2 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump1_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump2_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump2_red.png new file mode 100644 index 0000000000..471ad03b6e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump2_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump2_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump2_white.png new file mode 100644 index 0000000000..50ac4c92f3 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump2_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump2_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump2_yellow.png new file mode 100644 index 0000000000..22a7f70173 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump2_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump3_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump3_red.png new file mode 100644 index 0000000000..9fd95da302 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump3_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump3_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump3_white.png new file mode 100644 index 0000000000..5861b20497 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump3_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump3_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump3_yellow.png new file mode 100644 index 0000000000..42a7844779 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump3_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump4_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump4_red.png new file mode 100644 index 0000000000..752f41eeb9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump4_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump4_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump4_white.png new file mode 100644 index 0000000000..8b01233098 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump4_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump4_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump4_yellow.png new file mode 100644 index 0000000000..a34df9f09d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump4_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump5_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump5_red.png new file mode 100644 index 0000000000..ad5aa7c5ce Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump5_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump5_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump5_white.png new file mode 100644 index 0000000000..5840a050ba Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump5_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump5_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump5_yellow.png new file mode 100644 index 0000000000..250788961f Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/SpeedBump5_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/Thumbs.db b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/Thumbs.db new file mode 100644 index 0000000000..b712b9c586 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/Thumbs.db differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/Triangle.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/Triangle.png new file mode 100644 index 0000000000..ac71b615e2 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/Triangle.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump1_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump1_red.png new file mode 100644 index 0000000000..26540f589f Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump1_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump1_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump1_white.png new file mode 100644 index 0000000000..2ad6a70847 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump1_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump1_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump1_yellow.png new file mode 100644 index 0000000000..f8431bb9c3 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump1_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump2_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump2_red.png new file mode 100644 index 0000000000..057c835059 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump2_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump2_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump2_white.png new file mode 100644 index 0000000000..c551709095 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump2_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump2_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump2_yellow.png new file mode 100644 index 0000000000..a1ccaf4ca5 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump2_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump3_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump3_red.png new file mode 100644 index 0000000000..dedb2a8b81 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump3_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump3_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump3_white.png new file mode 100644 index 0000000000..7b0c6283b4 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump3_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump3_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump3_yellow.png new file mode 100644 index 0000000000..143b165c26 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump3_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump4_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump4_red.png new file mode 100644 index 0000000000..70f8f5aa61 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump4_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump4_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump4_white.png new file mode 100644 index 0000000000..21e05056ed Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump4_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump4_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump4_yellow.png new file mode 100644 index 0000000000..545e04ea31 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump4_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump5_red.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump5_red.png new file mode 100644 index 0000000000..71845fb3aa Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump5_red.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump5_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump5_white.png new file mode 100644 index 0000000000..48a95cc337 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump5_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump5_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump5_yellow.png new file mode 100644 index 0000000000..519a243b0e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/UnSpeedBump5_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/VerticalLane.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/VerticalLane.png new file mode 100644 index 0000000000..0ac71d465e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/VerticalLane.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/WithBusAcross.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/WithBusAcross.png new file mode 100644 index 0000000000..83eb01d818 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/WithBusAcross.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/WithBusVertical.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/WithBusVertical.png new file mode 100644 index 0000000000..0ac71d465e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/WithBusVertical.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/battery.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/battery.png new file mode 100644 index 0000000000..f1da3b374a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/battery.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_cross_left.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_cross_left.png new file mode 100644 index 0000000000..ded287415d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_cross_left.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_cross_right.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_cross_right.png new file mode 100644 index 0000000000..83efff50a4 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_cross_right.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_vertical_LL.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_vertical_LL.png new file mode 100644 index 0000000000..192c62fc16 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_vertical_LL.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_vertical_left.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_vertical_left.png new file mode 100644 index 0000000000..4430562536 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_vertical_left.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_vertical_right.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_vertical_right.png new file mode 100644 index 0000000000..acd6d30b6d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_vertical_right.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_vertical_right_down.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_vertical_right_down.png new file mode 100644 index 0000000000..f789f0d24d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bicycle_vertical_right_down.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bus.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bus.png new file mode 100644 index 0000000000..e66ed013c7 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bus.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busLaneAcross.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busLaneAcross.png new file mode 100644 index 0000000000..6a8124a5a7 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busLaneAcross.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busLaneVertical.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busLaneVertical.png new file mode 100644 index 0000000000..0a6d7f0cc3 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busLaneVertical.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busStation.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busStation.png new file mode 100644 index 0000000000..6156a0f783 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busStation.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busStop.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busStop.png new file mode 100644 index 0000000000..13228b4cb7 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busStop.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busTransitLaneV.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busTransitLaneV.png new file mode 100644 index 0000000000..fe8899bf0c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/busTransitLaneV.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bus_Rapid_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bus_Rapid_white.png new file mode 100644 index 0000000000..6b3c98c1a1 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bus_Rapid_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bus_Rapid_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bus_Rapid_yellow.png new file mode 100644 index 0000000000..cf7dfb58ee Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/bus_Rapid_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/carpeople.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/carpeople.png new file mode 100644 index 0000000000..9b31cce86b Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/carpeople.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/comityPedestrianC.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/comityPedestrianC.png new file mode 100644 index 0000000000..f08babde0b Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/comityPedestrianC.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/comityPedestrianCShu.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/comityPedestrianCShu.png new file mode 100644 index 0000000000..3fb13f3152 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/comityPedestrianCShu.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/comity_Pedestrian.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/comity_Pedestrian.png new file mode 100644 index 0000000000..c7b341dc0c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/comity_Pedestrian.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/comity_PedestrianShu.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/comity_PedestrianShu.png new file mode 100644 index 0000000000..81850b5812 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/comity_PedestrianShu.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/divider15_left.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/divider15_left.png new file mode 100644 index 0000000000..91c4c07e9e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/divider15_left.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/divider15_right.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/divider15_right.png new file mode 100644 index 0000000000..f0c13e57ef Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/divider15_right.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/exit.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/exit.png new file mode 100644 index 0000000000..b07fb67716 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/exit.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/goStraightTurnRightLeft.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/goStraightTurnRightLeft.png new file mode 100644 index 0000000000..9eacb6e809 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/goStraightTurnRightLeft.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraight.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraight.png new file mode 100644 index 0000000000..1802f74354 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraight.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightleft.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightleft.png new file mode 100644 index 0000000000..c4be334a0a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightleft.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightleftright.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightleftright.png new file mode 100644 index 0000000000..376acbb09d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightleftright.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightleftround.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightleftround.png new file mode 100644 index 0000000000..86c067074d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightleftround.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightrightround.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightrightround.png new file mode 100644 index 0000000000..696a298138 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightrightround.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightrightturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightrightturn.png new file mode 100644 index 0000000000..35d966adb9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/gostraightrightturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/hov.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/hov.png new file mode 100644 index 0000000000..9349eb5704 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/hov.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftleftround.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftleftround.png new file mode 100644 index 0000000000..9a07d14374 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftleftround.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftrightturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftrightturn.png new file mode 100644 index 0000000000..f748b09a1a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftrightturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftround.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftround.png new file mode 100644 index 0000000000..06a87f28c4 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftround.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftturn.png new file mode 100644 index 0000000000..826e5efc46 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftwaitturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftwaitturn.png new file mode 100644 index 0000000000..e260807001 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/leftwaitturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/motorVehiclesC.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/motorVehiclesC.png new file mode 100644 index 0000000000..ef84a82305 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/motorVehiclesC.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noCrossLine.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noCrossLine.png new file mode 100644 index 0000000000..c51deb3872 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noCrossLine.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noLeftOrTurn.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noLeftOrTurn.png new file mode 100644 index 0000000000..8922512aa4 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noLeftOrTurn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noStopMarking.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noStopMarking.png new file mode 100644 index 0000000000..cd207419f5 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noStopMarking.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noTurn.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noTurn.png new file mode 100644 index 0000000000..688cb7f248 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noTurn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noleftturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noleftturn.png new file mode 100644 index 0000000000..e9576d9cfd Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/noleftturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/onlyTaxi.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/onlyTaxi.png new file mode 100644 index 0000000000..fa2c45e7d4 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/onlyTaxi.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/policeSpecialV.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/policeSpecialV.png new file mode 100644 index 0000000000..7293d2de45 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/policeSpecialV.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/rightrightround.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/rightrightround.png new file mode 100644 index 0000000000..bbff04ded3 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/rightrightround.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/rightround.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/rightround.png new file mode 100644 index 0000000000..1ef0441a9d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/rightround.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/rightturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/rightturn.png new file mode 100644 index 0000000000..7b02b66773 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/rightturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/rightwaitturn.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/rightwaitturn.png new file mode 100644 index 0000000000..550dca672d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/rightwaitturn.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/schoolZone_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/schoolZone_white.png new file mode 100644 index 0000000000..c110905d65 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/schoolZone_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/schoolZone_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/schoolZone_yellow.png new file mode 100644 index 0000000000..2c4fd00205 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/schoolZone_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/sideRoad.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/sideRoad.png new file mode 100644 index 0000000000..416eeb43d9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/sideRoad.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/stop.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/stop.png new file mode 100644 index 0000000000..d60bceb60d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/stop.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/throughWordsV_white.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/throughWordsV_white.png new file mode 100644 index 0000000000..70b6a03bd0 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/throughWordsV_white.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/throughWordsV_yellow.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/throughWordsV_yellow.png new file mode 100644 index 0000000000..addff60d9d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/throughWordsV_yellow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/tourRoad.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/tourRoad.png new file mode 100644 index 0000000000..9455fb431a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/tourRoad.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/walk.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/walk.png new file mode 100644 index 0000000000..8e0e5826bb Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/walk.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra.png new file mode 100644 index 0000000000..13cbdb1d84 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing1.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing1.png new file mode 100644 index 0000000000..27bcacb57e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing1.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing10.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing10.png new file mode 100644 index 0000000000..7a239089e3 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing10.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing11.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing11.png new file mode 100644 index 0000000000..412df5d51a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing11.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing12.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing12.png new file mode 100644 index 0000000000..2f15d8af99 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing12.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing13.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing13.png new file mode 100644 index 0000000000..498d64e5b8 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing13.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing2.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing2.png new file mode 100644 index 0000000000..7ea0e12a6c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing2.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing3.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing3.png new file mode 100644 index 0000000000..7b061a85c0 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing3.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing4.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing4.png new file mode 100644 index 0000000000..d142e854aa Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing4.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing5.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing5.png new file mode 100644 index 0000000000..e5064edd2c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing5.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing6.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing6.png new file mode 100644 index 0000000000..ba0f71646a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing6.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing7.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing7.png new file mode 100644 index 0000000000..99e6906cf6 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing7.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing8.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing8.png new file mode 100644 index 0000000000..fad46892bb Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing8.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing9.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing9.png new file mode 100644 index 0000000000..43e3d74cad Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_crossing9.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_polygon.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_polygon.png new file mode 100644 index 0000000000..af2f101c30 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_polygon.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_three.png b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_three.png new file mode 100644 index 0000000000..67c7aabd42 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/night_mode/zebra_three.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/1.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/1.png new file mode 100644 index 0000000000..7ebe4d151d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/1.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/10.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/10.png new file mode 100644 index 0000000000..eaf2970acb Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/10.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/11.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/11.png new file mode 100644 index 0000000000..88ed1ae9e0 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/11.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/12.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/12.png new file mode 100644 index 0000000000..0a81a972c0 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/12.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/13.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/13.png new file mode 100644 index 0000000000..bf8134b7d7 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/13.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/2.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/2.png new file mode 100644 index 0000000000..aa4c7e2790 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/2.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/20.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/20.png new file mode 100644 index 0000000000..f7f5287fe0 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/20.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/22.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/22.png new file mode 100644 index 0000000000..f1738b7910 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/22.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/23.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/23.png new file mode 100644 index 0000000000..18dd3afad9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/23.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/24.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/24.png new file mode 100644 index 0000000000..9202f9d44d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/24.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/25.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/25.png new file mode 100644 index 0000000000..a8d9295aab Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/25.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/26.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/26.png new file mode 100644 index 0000000000..bc95d1c48d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/26.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/27.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/27.png new file mode 100644 index 0000000000..8885f7d3b4 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/27.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/28.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/28.png new file mode 100644 index 0000000000..e51ccf8ea5 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/28.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/3.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/3.png new file mode 100644 index 0000000000..f6d3cf9951 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/3.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/31.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/31.png new file mode 100644 index 0000000000..9da6e3fa28 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/31.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/32.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/32.png new file mode 100644 index 0000000000..6c4d22f4e5 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/32.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/33.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/33.png new file mode 100644 index 0000000000..f3bea40e62 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/33.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/34.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/34.png new file mode 100644 index 0000000000..7af7d27bfc Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/34.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/35.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/35.png new file mode 100644 index 0000000000..653a34d237 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/35.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/36.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/36.png new file mode 100644 index 0000000000..ce603d06a1 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/36.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/37.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/37.png new file mode 100644 index 0000000000..42928ab5d0 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/37.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/38.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/38.png new file mode 100644 index 0000000000..76bf23a25b Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/38.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/39.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/39.png new file mode 100644 index 0000000000..3d85d6554e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/39.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/4.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/4.png new file mode 100644 index 0000000000..0dc2a95251 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/4.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/40.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/40.png new file mode 100644 index 0000000000..fb7903226c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/40.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/41.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/41.png new file mode 100644 index 0000000000..fb38e7ab53 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/41.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/42.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/42.png new file mode 100644 index 0000000000..f0eef03074 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/42.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/43.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/43.png new file mode 100644 index 0000000000..0cdf1761f2 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/43.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/44.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/44.png new file mode 100644 index 0000000000..93b5d549e9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/44.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/45.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/45.png new file mode 100644 index 0000000000..8a0d7fccc8 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/45.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/5.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/5.png new file mode 100644 index 0000000000..5f16319f66 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/5.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/6.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/6.png new file mode 100644 index 0000000000..e928a942ae Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/6.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/7.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/7.png new file mode 100644 index 0000000000..8deb4c6563 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/7.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/8.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/8.png new file mode 100644 index 0000000000..d8755935b1 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/8.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/9.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/9.png new file mode 100644 index 0000000000..93ebca5e96 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/9.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210304113721583.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210304113721583.png new file mode 100644 index 0000000000..f8ef226ddb Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210304113721583.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210304114207835.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210304114207835.png new file mode 100644 index 0000000000..29b524306b Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210304114207835.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210304114315198.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210304114315198.png new file mode 100644 index 0000000000..e78da5fad8 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210304114315198.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305112524004.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305112524004.png new file mode 100644 index 0000000000..836ef502e0 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305112524004.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305145549245.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305145549245.png new file mode 100644 index 0000000000..3a0fffb456 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305145549245.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305145713555.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305145713555.png new file mode 100644 index 0000000000..b9f9227ffd Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305145713555.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305145722276.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305145722276.png new file mode 100644 index 0000000000..5684c66be5 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305145722276.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305154245282.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305154245282.png new file mode 100644 index 0000000000..da07bec031 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210305154245282.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210328103938244.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210328103938244.png new file mode 100644 index 0000000000..cc8a60a8fc Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210328103938244.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210526150025835 2.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210526150025835 2.png new file mode 100644 index 0000000000..6c214127b9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210526150025835 2.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210526150025835.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210526150025835.png new file mode 100644 index 0000000000..039d2b3797 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210526150025835.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210526151553354.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210526151553354.png new file mode 100644 index 0000000000..47abcf649d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210526151553354.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210526151617835.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210526151617835.png new file mode 100644 index 0000000000..59b0c875c6 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210526151617835.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210601105015491.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210601105015491.png new file mode 100644 index 0000000000..8a1c57d93c Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210601105015491.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210601105525539.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210601105525539.png new file mode 100644 index 0000000000..ea32b0807e Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210601105525539.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210601105608740.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210601105608740.png new file mode 100644 index 0000000000..360f22b181 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20210601105608740.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20211208105423963.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20211208105423963.png new file mode 100644 index 0000000000..0cd9c89d31 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20211208105423963.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20220224110306291.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20220224110306291.png new file mode 100644 index 0000000000..62b90f1728 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20220224110306291.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20220224112434998.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20220224112434998.png new file mode 100644 index 0000000000..53c7fb5af7 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20220224112434998.png differ diff --git a/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20220224112457839.png b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20220224112457839.png new file mode 100644 index 0000000000..46b19a883f Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/hd_res/traffic_sign/hy20220224112457839.png differ diff --git a/libraries/mapmodule/src/main/assets/style/icon1501.png b/libraries/mapmodule/src/main/assets/style/icon1501.png new file mode 100644 index 0000000000..4c80216131 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/icon1501.png differ diff --git a/libraries/mapmodule/src/main/assets/style/icon1502.png b/libraries/mapmodule/src/main/assets/style/icon1502.png new file mode 100644 index 0000000000..6fc7da8e8f Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/icon1502.png differ diff --git a/libraries/mapmodule/src/main/assets/style/icon1503.png b/libraries/mapmodule/src/main/assets/style/icon1503.png new file mode 100644 index 0000000000..8bb5591c5a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/icon1503.png differ diff --git a/libraries/mapmodule/src/main/assets/style/icon201.png b/libraries/mapmodule/src/main/assets/style/icon201.png new file mode 100644 index 0000000000..b65bb9ced2 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/icon201.png differ diff --git a/libraries/mapmodule/src/main/assets/style/line.png b/libraries/mapmodule/src/main/assets/style/line.png new file mode 100644 index 0000000000..475ab414aa Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/line.png differ diff --git a/libraries/mapmodule/src/main/assets/style/line2.png b/libraries/mapmodule/src/main/assets/style/line2.png new file mode 100644 index 0000000000..f11f060ab9 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/line2.png differ diff --git a/libraries/mapmodule/src/main/assets/style/linemask.dat b/libraries/mapmodule/src/main/assets/style/linemask.dat new file mode 100644 index 0000000000..d11d19188a Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/linemask.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/msyh.ttf b/libraries/mapmodule/src/main/assets/style/msyh.ttf new file mode 100644 index 0000000000..cae95cd280 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/msyh.ttf differ diff --git a/libraries/mapmodule/src/main/assets/style/navarrowacross1.png b/libraries/mapmodule/src/main/assets/style/navarrowacross1.png new file mode 100644 index 0000000000..0033ccfef5 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/navarrowacross1.png differ diff --git a/libraries/mapmodule/src/main/assets/style/navarrowacross2.png b/libraries/mapmodule/src/main/assets/style/navarrowacross2.png new file mode 100644 index 0000000000..18a39c4ecf Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/navarrowacross2.png differ diff --git a/libraries/mapmodule/src/main/assets/style/navarrowcurrent1.png b/libraries/mapmodule/src/main/assets/style/navarrowcurrent1.png new file mode 100644 index 0000000000..6fed881f62 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/navarrowcurrent1.png differ diff --git a/libraries/mapmodule/src/main/assets/style/navarrowcurrent2.png b/libraries/mapmodule/src/main/assets/style/navarrowcurrent2.png new file mode 100644 index 0000000000..38bc12c115 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/navarrowcurrent2.png differ diff --git a/libraries/mapmodule/src/main/assets/style/navarrownormal1.png b/libraries/mapmodule/src/main/assets/style/navarrownormal1.png new file mode 100644 index 0000000000..f6c1f5f563 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/navarrownormal1.png differ diff --git a/libraries/mapmodule/src/main/assets/style/navarrownormal2.png b/libraries/mapmodule/src/main/assets/style/navarrownormal2.png new file mode 100644 index 0000000000..6769b5175d Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/navarrownormal2.png differ diff --git a/libraries/mapmodule/src/main/assets/style/pathtriangle.dat b/libraries/mapmodule/src/main/assets/style/pathtriangle.dat new file mode 100644 index 0000000000..22e2e538b8 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/pathtriangle.dat differ diff --git a/libraries/mapmodule/src/main/assets/style/rain.png b/libraries/mapmodule/src/main/assets/style/rain.png new file mode 100644 index 0000000000..1cab6a75d7 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/rain.png differ diff --git a/libraries/mapmodule/src/main/assets/style/skyDay.png b/libraries/mapmodule/src/main/assets/style/skyDay.png new file mode 100644 index 0000000000..48c8dbf9e4 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/skyDay.png differ diff --git a/libraries/mapmodule/src/main/assets/style/skyNight.png b/libraries/mapmodule/src/main/assets/style/skyNight.png new file mode 100644 index 0000000000..7097a17f23 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/skyNight.png differ diff --git a/libraries/mapmodule/src/main/assets/style/skybox/negx.png b/libraries/mapmodule/src/main/assets/style/skybox/negx.png new file mode 100644 index 0000000000..c281a2e37b Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/skybox/negx.png differ diff --git a/libraries/mapmodule/src/main/assets/style/skybox/negy.png b/libraries/mapmodule/src/main/assets/style/skybox/negy.png new file mode 100644 index 0000000000..60d9d1bdf3 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/skybox/negy.png differ diff --git a/libraries/mapmodule/src/main/assets/style/skybox/negz.png b/libraries/mapmodule/src/main/assets/style/skybox/negz.png new file mode 100644 index 0000000000..e1fef07df2 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/skybox/negz.png differ diff --git a/libraries/mapmodule/src/main/assets/style/skybox/posx.png b/libraries/mapmodule/src/main/assets/style/skybox/posx.png new file mode 100644 index 0000000000..cfdbd058af Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/skybox/posx.png differ diff --git a/libraries/mapmodule/src/main/assets/style/skybox/posy.png b/libraries/mapmodule/src/main/assets/style/skybox/posy.png new file mode 100644 index 0000000000..359d065144 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/skybox/posy.png differ diff --git a/libraries/mapmodule/src/main/assets/style/skybox/posz.png b/libraries/mapmodule/src/main/assets/style/skybox/posz.png new file mode 100644 index 0000000000..a50cbce157 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/skybox/posz.png differ diff --git a/libraries/mapmodule/src/main/assets/style/skymap.png b/libraries/mapmodule/src/main/assets/style/skymap.png new file mode 100644 index 0000000000..6abb1ca146 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/skymap.png differ diff --git a/libraries/mapmodule/src/main/assets/style/snow.png b/libraries/mapmodule/src/main/assets/style/snow.png new file mode 100644 index 0000000000..79701158e3 Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/snow.png differ diff --git a/libraries/mapmodule/src/main/assets/style/style/erhai/vr/day/common.cfg b/libraries/mapmodule/src/main/assets/style/style/erhai/vr/day/common.cfg new file mode 100644 index 0000000000..fcfdbc5047 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/style/erhai/vr/day/common.cfg @@ -0,0 +1,29 @@ +backGround=B0BED1 //背景色 +road=80,92,112 //路面颜色 +arrow.color.fac=0.95 //箭头颜色因子 +alphaNumeric.color.fac=1.0 //地标颜色因子 +zebra.color.fac=0.98 //斑马线颜色因子 +spotLight=2.5;0.5;1 //聚光灯 半径;亮度;偏移 +shadow=70,85,107,200 //阴影颜色 +greenBelt=6C8C86;9EBDB4 //绿化带 底部颜色;顶部颜色 +dividerLine=228,233,250;228,233,250;1.0 //白色;黄色;颜色因子 +pole=8999B0;4E617E //灯杆渐变颜色 +guardBar=9FB4C8;7C8EA5;B8C8E1 //隔离带颜色 +roadPile=1.0,0.84,0.23;0.18,0.18,0.18;0.25,0.25,0.25 //路桩颜色 +bridgePier=d2d6e4;979aa4 //桥墩颜色 +cable=5cd3ff;1e79d6;65f3ff;48b3bc //电缆颜色1;电缆颜色2;光缆颜色1;光缆颜色2 +area.type.2=D0E7DD //绿地颜色 +area.type.3=99C0E7 //水系颜色 +area.type.4=37485E //路面铺装颜色 +area.type.101=B0BED1 //区域块颜色 +regional=889DB5 //人行步道颜色 +building=7fA3B7D0;D0E3FB //建筑物底部颜色;顶部颜色 +camera=BCC3D0 //摄像头颜色 +trafficLight=BCC3D0 //交通灯颜色 +rsu.type.1=BCC3D0 //雷达颜色 +rsu.type.2=BCC3D0 //mec颜色 +rsu.type.3=BCC3D0 //rsu颜色 +//光照 环境光;漫反射;高光;高光的光泽度 +selfCar.light=0.8,0.8,0.8;0.2,0.2,0.2;0.8,0.8,0.8;12.0 //自车 +otherCar.light=0.7,0.7,0.7;0.1,0.1,0.1;0.3,0.3,0.3;11.0 //他车 +others.light=0.7,0.7,0.7;0.1,0.1,0.1;0.6,0.6,0.6;12.0 //除自车和他车外的其他3d锚点 \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/style/erhai/vr/night/common.cfg b/libraries/mapmodule/src/main/assets/style/style/erhai/vr/night/common.cfg new file mode 100644 index 0000000000..2a4a6f6361 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/style/erhai/vr/night/common.cfg @@ -0,0 +1,29 @@ +backGround=60,74,105 //背景色 +road=1E2637 //路面颜色 +arrow.color.fac=1.0 //箭头颜色因子 +alphaNumeric.color.fac=1.0 //地标颜色因子 +zebra.color.fac=1.0 //斑马线颜色因子 +spotLight=1;0.75;-25 //聚光灯 半径;亮度;偏移 +shadow=18,28,56,180 //阴影颜色 +greenBelt=35,50,75;60,74,105 //绿化带 底部颜色;顶部颜色 +dividerLine=102,115,140;230,180,90;1.0 //白色;黄色;颜色因子 +pole=6698B1;335780 //灯杆渐变颜色 +guardBar=344563;273651;506B9A //隔离带颜色 +roadPile=0.9,0.7,0.35;0.16,0.16,0.16;0.24,0.24,0.24 //路桩颜色 +bridgePier=384f76;1e2636 //桥墩颜色 +cable=5cd3ff;1e79d6;65f3ff;48b3bc //电缆颜色1;电缆颜色2;光缆颜色1;光缆颜色2 +area.type.2=D0E7DD //绿地颜色 +area.type.3=8BD0FD //水系颜色 +area.type.4=37485E //路面铺装颜色 +area.type.101=343F5B //区域块颜色 +regional=3C4A69 //人行步道颜色 +building=7fA1B7DD;E3ECFF //建筑物底部颜色;顶部颜色 +camera=0 //摄像头颜色 +trafficLight=0 //交通灯颜色 +rsu.type.1=0 //雷达颜色 +rsu.type.2=0 //mec颜色 +rsu.type.3=0 //rsu颜色 +//光照 环境光;漫反射;高光;高光的光泽度 +selfCar.light=0.6,0.6,0.6;0.1,0.1,0.1;0.6,0.6,0.6;12.0 //自车 +otherCar.light=0.4,0.4,0.4;0.1,0.1,0.1;0.6,0.6,0.6;12.0 //他车 +others.light=0.4,0.4,0.4;0.1,0.1,0.1;0.6,0.6,0.6;12.0 //除自车和他车外的其他3d锚点 \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/style/normal/vr/day/common.cfg b/libraries/mapmodule/src/main/assets/style/style/normal/vr/day/common.cfg new file mode 100644 index 0000000000..57919ed493 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/style/normal/vr/day/common.cfg @@ -0,0 +1,32 @@ +backGround=B0BED1 //背景色 +road=80,92,112 //路面颜色 +arrow.color.fac=0.95 //箭头颜色因子 +alphaNumeric.color.fac=1.0 //地标颜色因子 +zebra.color.fac=0.98 //斑马线颜色因子 +spotLight=2.5;0.5;1 //聚光灯 半径;亮度;偏移 +shadow=70,85,107,200 //阴影颜色 +greenBelt=6C8C86;9EBDB4 //绿化带 底部颜色;顶部颜色 +dividerLine=228,233,250;228,233,250;1.0 //白色;黄色;颜色因子 +pole=8999B0;4E617E //灯杆渐变颜色 +guardBar=9FB4C8;7C8EA5;B8C8E1 //隔离带颜色 +roadPile=1.0,0.84,0.23;0.18,0.18,0.18;0.25,0.25,0.25 //路桩颜色 +bridgePier=d2d6e4;979aa4 //桥墩颜色 +cable=5cd3ff;1e79d6;65f3ff;48b3bc //电缆颜色1;电缆颜色2;光缆颜色1;光缆颜色2 +area.type.2=D0E7DD //绿地颜色 +area.type.3=99C0E7 //水系颜色 +area.type.4=37485E //路面铺装颜色 +area.type.101=B0BED1 //区域块颜色 +regional=889DB5 //人行步道颜色 +building=7fA3B7D0;D0E3FB //建筑物底部颜色;顶部颜色 +camera=BCC3D0 //摄像头颜色 +trafficLight=BCC3D0 //交通灯颜色 +rsu.type.1=BCC3D0 //雷达颜色 +rsu.type.2=BCC3D0 //mec颜色 +rsu.type.3=BCC3D0 //rsu颜色 +//光照 环境光;漫反射;高光;高光的光泽度 +selfCar.light=0.8,0.8,0.8;0.2,0.2,0.2;0.8,0.8,0.8;100.0 //自车 +otherCar.light=0.7,0.7,0.7;0.1,0.1,0.1;0.3,0.3,0.3;11.0 //他车 +others.light=0.7,0.7,0.7;0.1,0.1,0.1;0.6,0.6,0.6;12.0 //除自车和他车外的其他3d锚点 +fog=BFD9FD;50;300;0.8 //雾颜色,起始距离,结束距离,密度 +skybox.lookat=0;-16;12; 0;0;5; 0;1;0 //天空盒lookat参数 +skybox.proj=60;0.1;300 //天空盒fov,近平面,远平面 \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/style/normal/vr/night/common.cfg b/libraries/mapmodule/src/main/assets/style/style/normal/vr/night/common.cfg new file mode 100644 index 0000000000..2a8a35b3b5 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/style/normal/vr/night/common.cfg @@ -0,0 +1,32 @@ +backGround=60,74,105 //背景色 +road=1E2637 //路面颜色 +arrow.color.fac=1.0 //箭头颜色因子 +alphaNumeric.color.fac=1.0 //地标颜色因子 +zebra.color.fac=1.0 //斑马线颜色因子 +spotLight=1;0.75;-25 //聚光灯 半径;亮度;偏移 +shadow=18,28,56,180 //阴影颜色 +greenBelt=35,50,75;60,74,105 //绿化带 底部颜色;顶部颜色 +dividerLine=102,115,140;230,180,90;1.0 //白色;黄色;颜色因子 +pole=6698B1;335780 //灯杆渐变颜色 +guardBar=344563;273651;506B9A //隔离带颜色 +roadPile=0.9,0.7,0.35;0.16,0.16,0.16;0.24,0.24,0.24 //路桩颜色 +bridgePier=384f76;1e2636 //桥墩颜色 +cable=5cd3ff;1e79d6;65f3ff;48b3bc //电缆颜色1;电缆颜色2;光缆颜色1;光缆颜色2 +area.type.2=456A63 //绿地颜色 +area.type.3=426798 //水系颜色 +area.type.4=37485E //路面铺装颜色 +area.type.101=3C4A69 //区域块颜色 +regional=323E58 //人行步道颜色 +building=4D23344E;4B5E89 //建筑物底部颜色;顶部颜色 +camera=0 //摄像头颜色 +trafficLight=0 //交通灯颜色 +rsu.type.1=0 //雷达颜色 +rsu.type.2=0 //mec颜色 +rsu.type.3=0 //rsu颜色 +//光照 环境光;漫反射;高光;高光的光泽度 +selfCar.light=0.6,0.6,0.6;0.1,0.1,0.1;0.6,0.6,0.6;12.0 //自车 +otherCar.light=0.4,0.4,0.4;0.1,0.1,0.1;0.6,0.6,0.6;12.0 //他车 +others.light=0.4,0.4,0.4;0.1,0.1,0.1;0.6,0.6,0.6;12.0 //除自车和他车外的其他3d锚点 +fog=BFD9FD;50;300;0.8 //雾颜色,起始距离,结束距离,密度 +skybox.lookat=0;-16;12; 0;0;5; 0;1;0 //天空盒lookat参数 +skybox.proj=60;0.1;300 //天空盒fov,近平面,远平面 \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/0.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/0.mthm new file mode 100644 index 0000000000..82d1beb75e --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/0.mthm @@ -0,0 +1,144 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/1.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/1.mthm new file mode 100644 index 0000000000..ca592ed1fb --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/1.mthm @@ -0,0 +1,144 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/10.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/10.mthm new file mode 100644 index 0000000000..e883473855 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/10.mthm @@ -0,0 +1,141 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/11.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/11.mthm new file mode 100644 index 0000000000..0aa75a45d1 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/11.mthm @@ -0,0 +1,140 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/12.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/12.mthm new file mode 100644 index 0000000000..54d2ef8328 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/12.mthm @@ -0,0 +1,141 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/13.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/13.mthm new file mode 100644 index 0000000000..926498df5b --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/13.mthm @@ -0,0 +1,152 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/14.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/14.mthm new file mode 100644 index 0000000000..30b20ed47f --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/14.mthm @@ -0,0 +1,166 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/15.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/15.mthm new file mode 100644 index 0000000000..8ac4b6ea20 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/15.mthm @@ -0,0 +1,159 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/16.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/16.mthm new file mode 100644 index 0000000000..a15a652c1e --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/16.mthm @@ -0,0 +1,159 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/17.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/17.mthm new file mode 100644 index 0000000000..d081bf5813 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/17.mthm @@ -0,0 +1,156 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/18.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/18.mthm new file mode 100644 index 0000000000..78e6c004fb --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/18.mthm @@ -0,0 +1,159 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/19.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/19.mthm new file mode 100644 index 0000000000..22d099b039 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/19.mthm @@ -0,0 +1,159 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/2.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/2.mthm new file mode 100644 index 0000000000..82d1beb75e --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/2.mthm @@ -0,0 +1,144 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/3.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/3.mthm new file mode 100644 index 0000000000..82d1beb75e --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/3.mthm @@ -0,0 +1,144 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/4.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/4.mthm new file mode 100644 index 0000000000..82d1beb75e --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/4.mthm @@ -0,0 +1,144 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/5.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/5.mthm new file mode 100644 index 0000000000..16b2a79439 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/5.mthm @@ -0,0 +1,144 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/6.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/6.mthm new file mode 100644 index 0000000000..82d1beb75e --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/6.mthm @@ -0,0 +1,144 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/7.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/7.mthm new file mode 100644 index 0000000000..82d1beb75e --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/7.mthm @@ -0,0 +1,144 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/8.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/8.mthm new file mode 100644 index 0000000000..2414137778 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/8.mthm @@ -0,0 +1,144 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/9.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/9.mthm new file mode 100644 index 0000000000..3342cb6599 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/9.mthm @@ -0,0 +1,143 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daymode/common.mthm b/libraries/mapmodule/src/main/assets/style/theme/daymode/common.mthm new file mode 100644 index 0000000000..a6d7f2ace7 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daymode/common.mthm @@ -0,0 +1,81 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<--省道--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/0.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/0.mthm new file mode 100644 index 0000000000..0ba315eda1 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/0.mthm @@ -0,0 +1,148 @@ + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/1.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/1.mthm new file mode 100644 index 0000000000..0ba315eda1 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/1.mthm @@ -0,0 +1,148 @@ + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/10.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/10.mthm new file mode 100644 index 0000000000..4a4c2ce891 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/10.mthm @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/11.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/11.mthm new file mode 100644 index 0000000000..17a33a7ab8 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/11.mthm @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/12.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/12.mthm new file mode 100644 index 0000000000..7862eec85a --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/12.mthm @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/13.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/13.mthm new file mode 100644 index 0000000000..a2a28ae2c1 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/13.mthm @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/14.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/14.mthm new file mode 100644 index 0000000000..8d32a9f58f --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/14.mthm @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/15.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/15.mthm new file mode 100644 index 0000000000..c8ae39e765 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/15.mthm @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/16.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/16.mthm new file mode 100644 index 0000000000..47cad9f30d --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/16.mthm @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/17.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/17.mthm new file mode 100644 index 0000000000..ab4e827ae0 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/17.mthm @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/18.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/18.mthm new file mode 100644 index 0000000000..df239a7a73 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/18.mthm @@ -0,0 +1,163 @@ + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/19.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/19.mthm new file mode 100644 index 0000000000..7f0665dcd7 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/19.mthm @@ -0,0 +1,163 @@ + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/2.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/2.mthm new file mode 100644 index 0000000000..0ba315eda1 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/2.mthm @@ -0,0 +1,148 @@ + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/3.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/3.mthm new file mode 100644 index 0000000000..0ba315eda1 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/3.mthm @@ -0,0 +1,148 @@ + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/4.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/4.mthm new file mode 100644 index 0000000000..0ba315eda1 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/4.mthm @@ -0,0 +1,148 @@ + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/5.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/5.mthm new file mode 100644 index 0000000000..0ba315eda1 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/5.mthm @@ -0,0 +1,148 @@ + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/6.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/6.mthm new file mode 100644 index 0000000000..0ba315eda1 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/6.mthm @@ -0,0 +1,148 @@ + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/7.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/7.mthm new file mode 100644 index 0000000000..0ba315eda1 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/7.mthm @@ -0,0 +1,148 @@ + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/8.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/8.mthm new file mode 100644 index 0000000000..152d4a31d0 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/8.mthm @@ -0,0 +1,148 @@ + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/9.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/9.mthm new file mode 100644 index 0000000000..20faea5f26 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/9.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + <湖蓝> + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + + + + + + + + +<湖蓝> +<湖蓝> + + + + + + + + + + + + +<湖蓝> + + + + + + + + + + + + + + + + + +<湖蓝> + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/daynavmode/common.mthm b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/common.mthm new file mode 100644 index 0000000000..4a5672d4af --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/daynavmode/common.mthm @@ -0,0 +1,74 @@ + + + + + + + <--默认--> + <学校 医院> + <--绿地--> + <--水域--> + <交通> + <公共设施> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +<--省道--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/0.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/0.mthm new file mode 100644 index 0000000000..d9ad955fe4 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/0.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/1.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/1.mthm new file mode 100644 index 0000000000..6545da462d --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/1.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/10.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/10.mthm new file mode 100644 index 0000000000..f6b1692e09 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/10.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/11.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/11.mthm new file mode 100644 index 0000000000..a13d3088fc --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/11.mthm @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/12.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/12.mthm new file mode 100644 index 0000000000..0a6af2b844 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/12.mthm @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/13.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/13.mthm new file mode 100644 index 0000000000..b7565231ff --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/13.mthm @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/14.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/14.mthm new file mode 100644 index 0000000000..98ba466560 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/14.mthm @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/15.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/15.mthm new file mode 100644 index 0000000000..931741a099 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/15.mthm @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/16.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/16.mthm new file mode 100644 index 0000000000..17cd0247e5 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/16.mthm @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/17.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/17.mthm new file mode 100644 index 0000000000..e8e697c00c --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/17.mthm @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/18.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/18.mthm new file mode 100644 index 0000000000..691a457c1e --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/18.mthm @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/19.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/19.mthm new file mode 100644 index 0000000000..9877f9f49e --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/19.mthm @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/2.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/2.mthm new file mode 100644 index 0000000000..6545da462d --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/2.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/20.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/20.mthm new file mode 100644 index 0000000000..7514247e5c --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/20.mthm @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/3.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/3.mthm new file mode 100644 index 0000000000..6545da462d --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/3.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/4.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/4.mthm new file mode 100644 index 0000000000..e23f8f6f19 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/4.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/5.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/5.mthm new file mode 100644 index 0000000000..45b85626c4 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/5.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/6.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/6.mthm new file mode 100644 index 0000000000..e23f8f6f19 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/6.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/7.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/7.mthm new file mode 100644 index 0000000000..6545da462d --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/7.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/8.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/8.mthm new file mode 100644 index 0000000000..f434dbcf5d --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/8.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/9.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/9.mthm new file mode 100644 index 0000000000..206978bf97 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/9.mthm @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/common.mthm b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/common.mthm new file mode 100644 index 0000000000..6a115a1115 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/dayvrmode/common.mthm @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + <--RouteLineup=33 RouteLinelow=0 显示13层数据 solidLeftWidth 左车道 solidRightWidth 右车道 --> + + + + + + + + + + + + + + + + + + + + + + + + +<--省道--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/0.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/0.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/0.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/1.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/1.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/1.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/10.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/10.mthm new file mode 100644 index 0000000000..40fe1b6e53 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/10.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/11.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/11.mthm new file mode 100644 index 0000000000..35f3301c46 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/11.mthm @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/12.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/12.mthm new file mode 100644 index 0000000000..46544e6774 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/12.mthm @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/13.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/13.mthm new file mode 100644 index 0000000000..4b47d39376 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/13.mthm @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/14.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/14.mthm new file mode 100644 index 0000000000..a05f6e0a64 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/14.mthm @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/15.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/15.mthm new file mode 100644 index 0000000000..0c15a2aca3 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/15.mthm @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/16.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/16.mthm new file mode 100644 index 0000000000..9733e878d2 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/16.mthm @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/17.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/17.mthm new file mode 100644 index 0000000000..3c3a16de3e --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/17.mthm @@ -0,0 +1,170 @@ + + + + + + + + + + + + <默认区域会遮盖绿地等区域> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/18.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/18.mthm new file mode 100644 index 0000000000..41fd03d6d2 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/18.mthm @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/19.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/19.mthm new file mode 100644 index 0000000000..3f8a302be8 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/19.mthm @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/2.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/2.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/2.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/3.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/3.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/3.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/4.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/4.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/4.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/5.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/5.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/5.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/6.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/6.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/6.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/7.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/7.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/7.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/8.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/8.mthm new file mode 100644 index 0000000000..cc29b06bae --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/8.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/9.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/9.mthm new file mode 100644 index 0000000000..3861df34be --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/9.mthm @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightmode/common.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightmode/common.mthm new file mode 100644 index 0000000000..c045474283 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightmode/common.mthm @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + <--RouteLineup=33 RouteLinelow=0 显示13层数据--> + + + + + + + + + + + + + + + + + + + + + + +<--省道--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/0.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/0.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/0.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/1.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/1.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/1.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/10.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/10.mthm new file mode 100644 index 0000000000..3f2025c7eb --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/10.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/11.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/11.mthm new file mode 100644 index 0000000000..b25bc95859 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/11.mthm @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/12.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/12.mthm new file mode 100644 index 0000000000..8c0d0daffd --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/12.mthm @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/13.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/13.mthm new file mode 100644 index 0000000000..559883639b --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/13.mthm @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/14.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/14.mthm new file mode 100644 index 0000000000..53da2a60b8 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/14.mthm @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/15.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/15.mthm new file mode 100644 index 0000000000..c2a6ccf221 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/15.mthm @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/16.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/16.mthm new file mode 100644 index 0000000000..a392323aa2 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/16.mthm @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/17.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/17.mthm new file mode 100644 index 0000000000..c47c1affb3 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/17.mthm @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/18.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/18.mthm new file mode 100644 index 0000000000..8db8d202da --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/18.mthm @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/19.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/19.mthm new file mode 100644 index 0000000000..69de135441 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/19.mthm @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/2.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/2.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/2.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/3.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/3.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/3.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/4.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/4.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/4.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/5.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/5.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/5.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/6.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/6.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/6.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/7.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/7.mthm new file mode 100644 index 0000000000..da461884fa --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/7.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/8.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/8.mthm new file mode 100644 index 0000000000..cc29b06bae --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/8.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/9.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/9.mthm new file mode 100644 index 0000000000..c7b460626a --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/9.mthm @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/common.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/common.mthm new file mode 100644 index 0000000000..c045474283 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightnavmode/common.mthm @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + <--RouteLineup=33 RouteLinelow=0 显示13层数据--> + + + + + + + + + + + + + + + + + + + + + + +<--省道--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/0.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/0.mthm new file mode 100644 index 0000000000..d9ad955fe4 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/0.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/1.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/1.mthm new file mode 100644 index 0000000000..6545da462d --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/1.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/10.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/10.mthm new file mode 100644 index 0000000000..03f12ad64b --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/10.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/11.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/11.mthm new file mode 100644 index 0000000000..354c6d3f61 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/11.mthm @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/12.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/12.mthm new file mode 100644 index 0000000000..ed688efc0c --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/12.mthm @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/13.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/13.mthm new file mode 100644 index 0000000000..cca8ed212f --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/13.mthm @@ -0,0 +1,157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/14.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/14.mthm new file mode 100644 index 0000000000..ab96331007 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/14.mthm @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/15.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/15.mthm new file mode 100644 index 0000000000..df825aad10 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/15.mthm @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/16.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/16.mthm new file mode 100644 index 0000000000..e87d046089 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/16.mthm @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/17.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/17.mthm new file mode 100644 index 0000000000..15f83d43e9 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/17.mthm @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/18.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/18.mthm new file mode 100644 index 0000000000..d3debb1493 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/18.mthm @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/19.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/19.mthm new file mode 100644 index 0000000000..2aa2a491b3 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/19.mthm @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/2.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/2.mthm new file mode 100644 index 0000000000..6545da462d --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/2.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/20.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/20.mthm new file mode 100644 index 0000000000..7514247e5c --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/20.mthm @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/3.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/3.mthm new file mode 100644 index 0000000000..6545da462d --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/3.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/4.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/4.mthm new file mode 100644 index 0000000000..e23f8f6f19 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/4.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/5.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/5.mthm new file mode 100644 index 0000000000..45b85626c4 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/5.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/6.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/6.mthm new file mode 100644 index 0000000000..e23f8f6f19 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/6.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/7.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/7.mthm new file mode 100644 index 0000000000..6545da462d --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/7.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/8.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/8.mthm new file mode 100644 index 0000000000..f434dbcf5d --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/8.mthm @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/9.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/9.mthm new file mode 100644 index 0000000000..97ef5a7438 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/9.mthm @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <--红--> + <--灰--> + + + + + + + + + <--蓝--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/common.mthm b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/common.mthm new file mode 100644 index 0000000000..8a46dd6843 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/theme/nightvrmode/common.mthm @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + <--RouteLineup=33 RouteLinelow=0 显示13层数据 solidLeftWidth 左车道 solidRightWidth 右车道 --> + + + + + + + + + + + + + + + + + + + + + + + +<--省道--> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/mapmodule/src/main/assets/style/waternormals.png b/libraries/mapmodule/src/main/assets/style/waternormals.png new file mode 100644 index 0000000000..a3bd6f74fb Binary files /dev/null and b/libraries/mapmodule/src/main/assets/style/waternormals.png differ diff --git a/libraries/mapmodule/src/main/assets/style/zoomconf.xml b/libraries/mapmodule/src/main/assets/style/zoomconf.xml new file mode 100644 index 0000000000..5754ecead8 --- /dev/null +++ b/libraries/mapmodule/src/main/assets/style/zoomconf.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/Common.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/Common.java new file mode 100644 index 0000000000..ab42186a3d --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/Common.java @@ -0,0 +1,8 @@ +package com.autonavi.nge; + +public class Common { + static { + System.loadLibrary("common"); + } + public native void setCfgKeyVal(String key, String val); +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/MapBox.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/MapBox.java new file mode 100644 index 0000000000..9217fee7f2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/MapBox.java @@ -0,0 +1,60 @@ +package com.autonavi.nge; + +import static com.amap.api.navi.AmapNaviPage.TAG; + +import android.util.Log; + +import com.zhidaoauto.map.sdk.inner.CompileConfig; +import com.zhidaoauto.map.sdk.inner.road.RoadResultController; + +public class MapBox { + static { + System.loadLibrary("map"); + } + public MapBox(){ + llaInit(this); + } + public native void llaInit(MapBox mapBox); + public native void llaGetCenterLine(double dLon, double dLat, float fAngle); + public native void llaStopLine(double dLon, double dLat, float fAngle); + public native void llaGetZebraLine(double dLon, double dLat, float fAngle); + public native void llaGetTrafficLight(double dLon, double dLat, float fAngle); + public native void llaMergedRoadRect(double dLon, double dLat, float fAngle); + public native void llaGetRoadLimitSpeed(double dLon, double dLat, float fAngle); + public native void llaGetCenterLineRange(double dLon, double dLat, float fAngle,float fDis); + public native void llaGetRoadName(double dLon, double dLat, float fAngle); + public native void llaGetCenterLineRoadNode(double dLon, double dLat, float fAngle,float fDis); + public native void llaGetCrossRoad(double dLon, double dLat, float fAngle); + public native void llaGetCrossRoadById(int tileId, long id); + public native void llaIsInZebraLine(double dLon, double dLat, float fAngle); + public native void llaGetZebraLineByDistance(double dLon, double dLat, float fAngle,float dis); + + public native void updateCacheFile(); + public native void modifyRedisFileVersion(int version); + + /*@return value format: cityCode1,chineseCityName1,englishCityName1,isCache1;cityCode2,chineseCityName2,englishCityName2,isCache2;...;*/ + public native void getAllCityCode(); + + public native void cacheHDDataByCity(int id); + + public native void getCityCode(double lon, double lat); + + public native void getCacheProgressByCity(int id); + + public native void cacheHDDataByCityLonLat(double lon,double lat); + public native void cancelCacheHDData(); + public native void initFileCacheByCity(double lon, double lat); + + public native void getHdDataVersionByCity(double lon,double lat); + + public native void llaRelease(); + + static void resultCallback(String key,String result){ + if(CompileConfig.INSTANCE.getDEBUG()){ + Log.d(TAG, "roadop--resultCallback: " +"key:" + key + " result:" + result); + } + RoadResultController.getInstance().dispatchRoadResult(0,key,result); + + } +} + diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/NLogger.kt b/libraries/mapmodule/src/main/java/com/autonavi/nge/NLogger.kt new file mode 100644 index 0000000000..17213fb88a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/NLogger.kt @@ -0,0 +1,17 @@ +package com.autonavi.nge + +object NLog { + + /**设置log等级,控制log输出 + * @param level 0,error,1,warn,2,info + */ + external fun setLevel(level : Int) + /**设置是否输出文件日志 + * @param write 是否输出文件日志 + */ + external fun setWriteFile(write: Boolean) + /** + *关闭log输出 + */ + external fun close() +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/PBJNI.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/PBJNI.java new file mode 100644 index 0000000000..2f0fa1728d --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/PBJNI.java @@ -0,0 +1,48 @@ +package com.autonavi.nge; + +public class PBJNI { + // declaration of id1 + public static final int ID1_NETWORK = 1; + public static final int ID1_ROUTING = 2; + public static final int ID1_SEARCH = 3; + public static final int ID1_GUIDANCE = 4; + public static final int ID1_DISPLAY = 5; + + // delcaration of id2 in network + public static final int ID2_NETWORK = 1; + public static final int ID2_REGION = 2; + public static final int ID2_TILE = 3; + public static final int ID2_NODE = 4; + public static final int ID2_LINK = 5; + public static final int ID2_MAPMATCH = 6; + + // declaration of id2 in routing + public static final int ID2_ROUTE = 1; + public static final int ID2_ETA = 2; + + // declaration of id2 in search + public static final int ID2_AUTOCOMPLETE = 1; + public static final int ID2_POISEARCH = 2; + + // declaration of id2 in guidance + public static final int ID2_GUIDANCE = 1; + + // declaration of id2 in display + public static final int ID2_DISPLAY = 1; + + public byte[] fetchData(int id1, int id2, byte[] data) { + return pb_service(id1, id2, data); + } + + public boolean pbLoad(Object dm) { + return pb_load(dm); + } + + public void pbunload() { + pb_unload(); + } + + private native static boolean pb_load(Object binder); + private native static void pb_unload(); + private static native byte[] pb_service(int id1, int id2, byte[] data); +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/dataaccdss/DataAccessProvider.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/dataaccdss/DataAccessProvider.java new file mode 100644 index 0000000000..3ab342a589 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/dataaccdss/DataAccessProvider.java @@ -0,0 +1,237 @@ +package com.autonavi.nge.dataaccdss; + +import android.os.IBinder; +import android.util.Log; + +import com.autonavi.nge.obj.Category; +import com.autonavi.nge.obj.PoiBase; +import com.autonavi.nge.obj.SubCategory; +import com.autonavi.nge.obj.UpdateRegion; + +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.List; + +public class DataAccessProvider { + + private IBinder mBinder; + public DataAccessProvider(IBinder binder) { + + mBinder = binder; + loadda(mBinder); + } + + { + System.loadLibrary("datascript"); + System.loadLibrary("ndssystem"); + System.loadLibrary("ndssqlite"); + System.loadLibrary("ndsprovider"); + System.loadLibrary("datamgr"); + System.loadLibrary("dataaccess"); + } + + public void destroyProvider() + { + unloadda(); + } +/* + public void getBmdTileByDA(int urid, int tileid) + { + getBmdTile( urid, tileid); + } + + public void getDtmTileByDA(int urid, int tileid) + { + getDtmTile( urid, tileid); + } + + public void getTexImgByDA(int urid, int texid) + { + getTexImg ( urid, texid); + } + + public void getSpaBlobByDA(int urid, int treeid) + { + getSpaBlob( urid, treeid); + } + + public void getGeoBlobByDA(int urid, int objid) + { + getGeoBlob( urid, objid); + } + + public void getRtTileByDA (int urid, int tileid) + { + getRtTile ( urid, tileid); + } + + public void getRtGTileByDA(int urid, int tileid) + { + getRtGTile( urid, tileid); + } +*/ + public List getURListByDA(int prodid) throws Exception { + List list = new ArrayList(); + //native方法 + byte[] urData = getURList(prodid); + if (null != urData && urData.length > 0) { + ByteBuffer databuf = ByteBuffer.wrap(urData); + int urCnt = databuf.getInt(); + for (int iLoop = 0; iLoop < urCnt; ++iLoop) { + UpdateRegion ur = new UpdateRegion(); + ur.setUrId(databuf.getInt()); + ur.setUrNameId(databuf.getInt()); + int strlength = databuf.get(); + String urName = null; + if (strlength > 0) { + byte[] tempStr = new byte[strlength]; + for (int idx = 0; idx < strlength; idx++) { + tempStr[idx] = (byte) databuf.get(); + } + urName = new String(tempStr, "UTF8"); + } + ur.setUrName(urName); + if(urName != null && !urName.contains("null")) { + list.add(ur); + } + } + } + return list; + } + + public List getCatDataByDA(int urid) throws Exception { + List list = new ArrayList(); + byte[] catData = getCatData(urid); + if (null != catData && catData.length > 0) { + ByteBuffer databuf = ByteBuffer.wrap(catData); + int cateCnt = databuf.getInt(); + for (int iLoop = 0; iLoop < cateCnt; ++iLoop) { + Category cate = new Category(); + cate.setSubNum(databuf.getInt()); + List subCateList = new ArrayList(); + for (int jLoop = 0; jLoop < cate.getSubNum(); ++jLoop) { + SubCategory subCate = new SubCategory(); + subCate.setKindId(databuf.getInt()); + int strlength = databuf.get(); + String sSubCatName = null; + if (strlength > 0) { + byte[] tempStr = new byte[strlength]; + for (int idx = 0; idx < strlength; idx++) { + tempStr[idx] = (byte) databuf.get(); + } + sSubCatName = new String(tempStr, "UTF8"); + } + subCate.setCatName(sSubCatName); + subCateList.add(subCate); + } + cate.setSubCategory(subCateList); + cate.setKindId(databuf.getInt()); + int strlength = databuf.get(); + String sCatName = null; + if (strlength > 0) { + byte[] tempStr = new byte[strlength]; + for (int idx = 0; idx < strlength; idx++) { + tempStr[idx] = (byte) databuf.get(); + } + sCatName = new String(tempStr, "UTF8"); + } + cate.setCatName(sCatName); + list.add(cate); + } + } + return list; + } + + public List getFTSDataByDA( int urid, String keyStr, int keytype, int maxResultCount)throws Exception + { + Log.d("liushj", "DataAccess getFTSDataByDA 1"); + List list = new ArrayList(); + Log.d("liushj", "DataAccess getFTSDataByDA 2"); + byte[] poidata = getFTSData( urid, keyStr, keytype, maxResultCount); + Log.d("liushj", "DataAccess getFTSDataByDA 3"); + if (poidata != null && poidata.length > 0) { + ByteBuffer databuf = ByteBuffer.wrap(poidata); + int poiCnt = databuf.getInt(); + for (int i=0; i 0) { + byte[] name = new byte[namelength]; + for (int idx=0; idx < namelength; idx++) { + name[idx] = (byte) databuf.get(); + } + nameStr = new String(name, "UTF8"); + } + + int addrlength = databuf.get(); + String addrStr = null; + if (addrlength > 0) { + byte[] addr = new byte[addrlength]; + for (int idx=0; idx < addrlength; idx++) { + addr[idx] = (byte) databuf.get(); + } + addrStr = new String(addr, "UTF8"); + } + + int phonelength = databuf.get(); + String phoneStr = null; + if (phonelength > 0) { + byte[] phone = new byte[phonelength]; + for (int idx=0; idx < phonelength; idx++) { + phone[idx] = (byte) databuf.get(); + } + phoneStr = new String(phone, "UTF8"); + } + + PoiBase poi = new PoiBase(nameStr, addrStr, phoneStr, lon, lat, poiid); + list.add(poi); + } + } + return list; + } + + public List getInputResultByDA() throws Exception { + List list = new ArrayList(); + byte[] strData = getInputResult(); + if (strData != null && strData.length > 0) { + ByteBuffer databuf = ByteBuffer.wrap(strData); + int strCnt = databuf.getInt(); + for (int i = 0; i < strCnt; i++) { + int strlength = databuf.get(); + String str = null; + if (strlength > 0) { + byte[] tempStr = new byte[strlength]; + for (int idx = 0; idx < strlength; idx++) { + tempStr[idx] = (byte) databuf.get(); + } + str = new String(tempStr, "UTF8"); + } + list.add(str); + } + } + return list; + } + + private native static boolean loadda(IBinder binder); + private native static void unloadda(); + private native static void getBmdTile(int urid, int tileid); + private native static void getDtmTile(int urid, int tileid); + private native static void getTexImg (int urid, int texid); + private native static void getSpaBlob(int urid, int treeid); + private native static void getGeoBlob(int urid, int objid); + private native static void getRtTile (int urid, int tileid); + private native static void getRtGTile(int urid, int tileid); + private native static byte[] getURList (int prodid); + private native static byte[] getCatData(int urid); + //private native static void getSpaSrh (long lonlat, int radius, int kind); + private native static byte[] getFTSData( int urid, String keyStr, int keytype, int maxResultCount); + private native static void getNVCBlob(int urid, int nameid, int scid, int subtreeid, int datatype); + private native static void getRtPath (float slon, float slat, float dlon, float dlat); + private native static byte[] getInputResult(); +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/dm/NavigationCore.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/dm/NavigationCore.java new file mode 100644 index 0000000000..1eee05af19 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/dm/NavigationCore.java @@ -0,0 +1,462 @@ +//package com.autonavi.nge.dm; +// +//import android.os.RemoteException; +//import android.util.Log; +//import android.util.Pair; +// +//import com.autonavi.nge.dataaccdss.DataAccessProvider; +//import com.autonavi.nge.guidance.GuidanceProvider; +//import com.autonavi.nge.guidance.GuidanceStatListener; +//import com.autonavi.nge.guidance.LaneMask; +//import com.autonavi.nge.guidance.NaviInfo; +//import com.autonavi.nge.guidance.RouteBook; +//import com.autonavi.nge.guidance.RouteImage; +//import com.autonavi.nge.map.LonLat; +//import com.autonavi.nge.obj.Category; +//import com.autonavi.nge.obj.PoiBase; +//import com.autonavi.nge.obj.UpdateRegion; +//import com.autonavi.nge.routing.RoutingProvider; +//import com.autonavi.nge.search.SPCategories; +//import com.autonavi.nge.search.SPLatLonPoint; +//import com.autonavi.nge.search.SPPoiItem; +//import com.autonavi.nge.search.SPQuery; +//import com.autonavi.nge.search.SPSearchResult; +//import com.autonavi.nge.search.SearchProvider; +//import com.autonavi.nge.trafficInfo.TMCID; +//import com.pdager.tts.CMDPlayer; +//import com.zhidaoauto.map.sdk.inner.CompileConfig; +//import com.zhidaoauto.map.sdk.inner.controller.CommonController; +// +//import java.util.ArrayList; +//import java.util.List; +// +///** +// * @author Administrator +// */ +//public class NavigationCore extends INavigationCore.Stub { +// +// private static final String TAG = "NavigationCore"; +//// private IBinder mHandler; +// private SharedMemoryService mShM; +// private RoutingProvider mRouteingProvider; +// private GuidanceProvider mGuidanceProvider; +// private SearchProvider mSearchProvider; +// private DataAccessProvider mDataAccessProvider; +// private CMDPlayer mCMDPlayer; +// +// private GuidanceStatListener mListener; +// +// public NavigationCore(SharedMemoryService shm) { +// mShM = shm; +//// mHandler = handler; +// mRouteingProvider = new RoutingProvider(); +// mSearchProvider = new SearchProvider(); +// mGuidanceProvider = new GuidanceProvider( this); +//// mDataAccessProvider = new DataAccessProvider(handler); +// mCMDPlayer = new CMDPlayer(CommonController.getInstance().getContext()); +// try { +// startServer(); +// } catch (RemoteException e) { +// e.printStackTrace(); +// } +// } +// +//// @Override +//// public IBinder getHandler() throws RemoteException { +//// return mHandler; +//// } +// +// @Override +// public void Routing_SetOrigin(float lon, float lat, int sessionid) +// throws RemoteException { +// mRouteingProvider.setOrigin(lon, lat, sessionid); +// } +// +// @Override +// public void Routing_SetDest(float lon, float lat, int sessionid) +// throws RemoteException { +// mRouteingProvider.setDest(lon, lat, sessionid); +// } +// +// @Override +// public void Routing_GetRoute(int sessionid) throws RemoteException { +// mRouteingProvider.getRoute(sessionid); +// } +// +// @Override +// public boolean Routing_GetStatus(int sessionid) throws RemoteException { +// return mRouteingProvider.getStatus(sessionid); +// } +// +// @Override +// public void Routing_Reset(int sessionid) throws RemoteException { +// mRouteingProvider.reset(sessionid); +// } +// +// @Override +// public void Routing_ClearTour(int sessionid) throws RemoteException { +// mRouteingProvider.clearTour(sessionid); +// } +// +// @Override +// public void Guidance_UpdatePosition(float lon, float lat, float speed, float heading) +// throws RemoteException { +// mGuidanceProvider.updatePosition(lon, lat, speed, heading); +// } +// +// @Override +// public void Guidance_StartNavi(int type) throws RemoteException { +// mGuidanceProvider.startNavi(type); +// } +// +// @Override +// public void Guidance_StopNavi() throws RemoteException { +// mGuidanceProvider.stopNavi(); +// } +// +// @Override +// public void Guidance_SetSimSpeed(int speed) throws RemoteException { +// mGuidanceProvider.setSimSpeed(speed); +// } +// +// @Override +// public void Guidance_PauseSimNavi() throws RemoteException { +// mGuidanceProvider.pauseSimNavi(); +// } +// +// @Override +// public void Guidance_ResumeSimNavi() throws RemoteException { +// mGuidanceProvider.resumeSimNavi(); +// } +// +// @Override +// public RouteBook Guidance_RouteBook(int session, int start, int end) throws RemoteException { +// +// try { +// return mGuidanceProvider.getRouteBookData(session, start, end); +// } catch (Exception e) { +// +// e.printStackTrace(); +// return null; +// } +// } +// +// @Override +// public NaviInfo Guidance_NaviInfo() throws RemoteException { +// +// try { +// return mGuidanceProvider.getNaviInfoData(); +// } catch (Exception e) { +// +// e.printStackTrace(); +// return null; +// } +// } +// +// @Override +// public NaviInfo GetNaviInfo(byte[] datas) { +// try { +// return mGuidanceProvider.getNaviInfoData(datas); +// } catch (Exception e) { +// +// e.printStackTrace(); +// return null; +// } +// } +// +// @Override +// public String Guidance_TTS() throws RemoteException { +// try { +// return mGuidanceProvider.getGuidanceTTS();s +// } catch (Exception e) { +// e.printStackTrace(); +// } +// return null; +// } +// +// @Override +// public LaneMask Guidance_LaneMask() throws RemoteException { +// +// try { +// return mGuidanceProvider.getGuidanceNaviLane(); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// return null; +// } +// +// @Override +// public List Search_getSearchResult(int productId, double lon, double lat, double radius, int kindfilterId, int updateregionId, String keyWord, int pageIdx, int searchType) throws RemoteException { +//// int[] kindfilter = new int[1]; +//// if (kindfilterId > 0) { +//// kindfilter[0] = kindfilterId; +//// } +//// try { +//// return SearchProvider.getPoiItemListByType(productId, updateregionId, searchType, keyWord, pageIdx); +//// } catch (Exception e) { +//// +//// e.printStackTrace(); +//// } +// return null; +// } +// +// @Override +// public List getFTSDataByDA(int urid, String keyStr, int keytype, +// int maxResultCount) throws RemoteException { +// +// try { +// return mDataAccessProvider.getFTSDataByDA(urid, keyStr, keytype, maxResultCount); +// } catch (Exception e) { +// +// e.printStackTrace(); +// return null; +// } +// } +// +// @Override +// public void play(String text,boolean forcePlay) throws RemoteException { +// if(CompileConfig.INSTANCE.getDEBUG()){ +// Log.i(TAG, "voiceop--navop--play: "+text+",mCMDPlayer:"+mCMDPlayer); +// } +// mCMDPlayer.play(text, forcePlay); +// } +// +// @Override +// public void RoutingSetCostModel(int model, int sessionid) +// throws RemoteException { +// mRouteingProvider.setCostModel(model, sessionid); +// } +// +// @Override +// public void RoutingSetAvoidHighway(boolean isAvoidHighway, int sessionid) +// throws RemoteException { +// mRouteingProvider.setAvoidHighway(isAvoidHighway, sessionid); +// } +// +// @Override +// public void RoutingSetAvoidToll(boolean isAvoidToll, int sessionid) +// throws RemoteException { +// mRouteingProvider.setAvoidToll(isAvoidToll, sessionid); +// } +// +// @Override +// public List getInputResult(int productId, int updateregionId, String inputStr) +// throws RemoteException { +//// try { +//// return mSearchProvider.getInputResult(productId, updateregionId, inputStr); +//// } catch (UnsupportedEncodingException e) { +//// e.printStackTrace(); +//// } +// return null; +// } +// +// @Override +// public List getInputResultByDA() throws RemoteException { +// try { +// return mDataAccessProvider.getInputResultByDA(); +// } catch (Exception e) { +// e.printStackTrace(); +// return null; +// } +// } +// +// @Override +// public List getCatList(int urid) throws RemoteException { +//// try { +//// return mSearchProvider.getCatList(1, urid); +//// } catch (Exception e) { +//// +//// e.printStackTrace(); +//// } +// return null; +// } +// +// @Override +// public List getURListByDA(int prodid) throws RemoteException { +// try { +// return mDataAccessProvider.getURListByDA(prodid); +// } catch (Exception e) { +// +// e.printStackTrace(); +// return null; +// } +// +// } +// +// @Override +// public RouteImage Guidance_Image(int imageUr, int imageBg, int imageArrow, int type) +// throws RemoteException { +// +// try { +// return mGuidanceProvider.getRouteImage(imageUr, imageBg, imageArrow, type); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// return null; +// } +// +// @Override +// public void RoutingSetUseTraffic(boolean useTraffic, int sessionid) +// throws RemoteException { +// mRouteingProvider.setUseTraffic(useTraffic, sessionid); +// +// } +// +// @Override +// public int RoutingGetRouteNum(int sessionid) throws RemoteException { +// return mRouteingProvider.getRouteNum(sessionid); +// } +// +// @Override +// public int RoutingGetLength(int route, int sessionid) +// throws RemoteException { +// return mRouteingProvider.getLength(route, sessionid); +// } +// +// @Override +// public int RoutingGetSTime(int route, int sessionid) throws RemoteException { +// return mRouteingProvider.getSTime(route, sessionid); +// } +// +// @Override +// public int RoutingGetDTime(int route, int sessionid) throws RemoteException { +// return mRouteingProvider.getDTime(route, sessionid); +// } +// +// @Override +// public void Traffic_Update(List ids, int evt) throws RemoteException { +// mRouteingProvider.setTrafStat(ids, evt); +// } +// +// @Override +// public void Traffic_UpdateByTile(int tile, int[] ids, byte[] speeds) { +// mRouteingProvider.setTrafSpeedByTile(tile, ids, speeds); +// } +// +// //@Override void +// +// @Override +// public int RoutingGetSearchedCnt(int route, int sessionid) throws RemoteException { +// return RoutingProvider.getsearchedcnt(route, sessionid); +// } +// +// @Override +// public int[] getMemoryInfo() throws RemoteException { +// // return mShM.getMemoryInfo(); +// return new int[]{0}; +// } +// +// @Override +// public void startServer() throws RemoteException { +// +// } +// +// @Override +// public void stopServer() throws RemoteException { +// +// } +// +// @Override +// public void addwaypoint(float lon, float lat, int heading, int sessionid) +// throws RemoteException { +// mRouteingProvider.addWayPoint(lon, lat, heading, sessionid); +// } +// +// @Override +// public void clearwaypoints(int sessionid) throws RemoteException { +// mRouteingProvider.clearWayPoints(sessionid); +// } +// +// @Override +// public int getMDSVersion() throws RemoteException { +// +// return 1; +// } +// +// @Override +// public String getDataVersion() throws RemoteException { +// +// return ""; +// } +// +// @Override +// public String getCopyRight() throws RemoteException { +// +// return ""; +// } +// +// @Override +// public String getCompilerVersion() throws RemoteException { +// +// return ""; +// } +// +// @Override +// public double Guidance_getRoadAngle() throws RemoteException { +// +// return mGuidanceProvider.getRoadAngle(); +// } +// +// @Override +// public void onGuidanceStatusChanged(int statCode, byte[] datas) { +// if (mListener != null) { +// try { +// mListener.onGuidanceStatusChanged(statCode, datas); +// } catch (RemoteException e) { +// e.printStackTrace(); +// } +// } +// } +// +// @Override +// public void setGuidanceStatListener(GuidanceStatListener listener) +// throws RemoteException { +// mListener = listener; +// } +// +// @Override +// public SPCategories getAllPoiCategories(int languageCode) throws RemoteException { +// List> list = SearchProvider.getAllPoiCategories(languageCode); +// SPCategories spCategories = new SPCategories(); +// spCategories.setCategories(list); +// return spCategories; +// } +// +// @Override +// public List getPoiItemList(SPQuery query) throws RemoteException { +// return SearchProvider.getPoiItemList(query); +// } +// +// @Override +// public SPPoiItem getPoiItemByPoiId(int poiId) { +// return SearchProvider.getPoiItemByPoiId(poiId); +// } +// +// @Override +// public List getPoiItemListByLonLat(int prodId, int urId, float lon, float lat, int pageCount, int pageIdx) { +// return null;//SearchProvider.getPoiItemListByLonLat(prodId, urId, lon, lat, pageCount, pageIdx); +// } +// +// @Override +// public List queryPoiItemByCircle(float centerLon, float centerLat, float radius) { +// Log.i(TAG, "searchop--queryPoiItemByCircle: " + centerLon + "," + centerLat); +// return null;//SearchProvider.getPoiItemByCircle(new SPLatLonPoint(centerLon, centerLat), radius); +// } +// +// @Override +// public List queryPoiItemByRect(float topLeftLon, float topLeftLat, float bottomRightLon, float bottomRightLat) { +// return null;//SearchProvider.getPoiItemByRect(new SPLatLonPoint(topLeftLon, topLeftLat), new SPLatLonPoint(bottomRightLon, bottomRightLat)); +// } +// +// @Override +// public List queryPoiItemByPolygon(List latLonPoints) { +// if (latLonPoints == null || latLonPoints.size() < 3) { +// return null; +// } +// List list = new ArrayList<>(); +// for (LonLat lonLat : latLonPoints) { +// list.add(new SPLatLonPoint((float) lonLat.getLon(), (float) lonLat.getLat())); +// } +// return null;//SearchProvider.getPoiItemByPolygon(list); +// } +//} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/dm/SharedMemoryService.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/dm/SharedMemoryService.java new file mode 100644 index 0000000000..9ead93cf57 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/dm/SharedMemoryService.java @@ -0,0 +1,75 @@ +package com.autonavi.nge.dm; + +import android.content.Context; +import android.text.TextUtils; +import android.util.Log; + +import com.autonavi.nge.hdmap.HDMapProvider; +import com.zhidaoauto.map.sdk.inner.CompileConfig; +import com.zhidaoauto.map.sdk.inner.common.MapHelper; +import com.zhidaoauto.map.sdk.inner.utils.CommonUtils; +import com.zhidaoauto.map.sdk.inner.utils.Constant; + + +public class SharedMemoryService { + + private static final String TAG = "SharedMemoryService"; + + static { + System.loadLibrary("datamgr"); + } + + private volatile static SharedMemoryService mInstance; + + public static SharedMemoryService getInstance(Context context) { + if (mInstance == null) { + synchronized (SharedMemoryService.class) { + if (mInstance == null) { + mInstance = new SharedMemoryService(context); + } + } + } + return mInstance; + } + + private SharedMemoryService(Context context) { + init(context); + } + + public void exit() { + mInstance = null; + unload(); + } + + private native static int initSharedMemory_Native(String dir, String tilesDir,int[] tileFilter); + + private native static boolean testRoutingTile(int i, int j, int k); + + public native static void unload(); + + + private void init(Context context) { + + HDMapProvider.setDataFileSource(MapHelper.INSTANCE.getMMapParams().getDataFileSource()); + HDMapProvider.setDataRedisSource(MapHelper.INSTANCE.getMMapParams().getDataRedisFileSource()); + if (!TextUtils.isEmpty(MapHelper.INSTANCE.getMMapParams().getHdmapPath())) { + HDMapProvider.setDataDir(MapHelper.INSTANCE.getMMapParams().getHdmapPath()); + } + + String dir = Constant.getNDSDataPath(); + String cachePath = MapHelper.INSTANCE.getMMapParams().getCachePath(); + if (TextUtils.isEmpty(cachePath)) { + cachePath = CommonUtils.INSTANCE.getCachePath(context); + } + if (CompileConfig.INSTANCE.getDEBUG()) { + Log.i(TAG, "autoop-dir:" + dir+",SharedMemory--cachePath:"+cachePath); + } + initSharedMemory_Native(dir, cachePath,MapHelper.INSTANCE.getMMapParams().getQzoneFilterArray()); + } + + + public int[] getMemoryInfo() { + return null; //getMemoryInfo_Native(); + } + +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/GuidanceMessage.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/GuidanceMessage.java new file mode 100644 index 0000000000..63b34d7fdb --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/GuidanceMessage.java @@ -0,0 +1,52 @@ +package com.autonavi.nge.guidance; + + +import com.zhidaoauto.map.sdk.inner.obj.NavMsg; + +public class GuidanceMessage { + public final static int GUIDANCE_MSG_TYPE_NONE = 0; //无效消息 + public final static int GUIDANCE_MSG_TYPE_NEWPOS = 1; //新的位置 + public final static int GUIDANCE_MSG_TYPE_NEWINFO = 2; //新的导航信息 + public final static int GUIDANCE_MSG_TYPE_NEWSPEECH = 3; //新的TTS语音 + public final static int GUIDANCE_MSG_TYPE_NEWSTATUS = 4; //新的导航状态 + public final static int GUIDANCE_MSG_TYPE_ROUTEFOUND = 5; //路线计算完成 + public final static int GUIDANCE_MSG_TYPE_ROUTENORES = 6; //无导航路线 + + public final static int GUIDANCE_STATUS_IDLE = (int) (0x0001); //空闲状态 + public final static int GUIDANCE_STATUS_CALCROUTE = (int) (0x0001 << 1); //正在计算路线 + //public final static int GUIDANCE_STATUS_WAITGPSSTART= (int)(0x0001<<2); //等待GPS位置作为出发地 + public final static int GUIDANCE_STATUS_GPSNAVI = (int) (0x0001 << 3); //正在进行GPS导航 + public final static int GUIDANCE_STATUS_SIMNAVI = (int) (0x0001 << 4); //正在进行模拟导航 + public final static int GUIDANCE_STATUS_NAVIFINISH = (int) (0x0001 << 5); //导航结束 + public final static int GUIDANCE_STATUS_REROUTING = (int) (0x0001 << 6); //正在重新规划路线 + public final static int GUIDANCE_STATUS_OFFROUTE = (int) (0x0001 << 7); //偏离路线 + + public static volatile GuidanceMessage instance = null; + private Guidanceinterface m_GuidanceInterface = null; + + public static GuidanceMessage getInstance() { + if (null == instance) { + synchronized (GuidanceMessage.class) { + if (null == instance) { + instance = new GuidanceMessage(); + } + } + } + return instance; + } + + public void setGuidanceInterfaceAct(Guidanceinterface inter) { + m_GuidanceInterface = inter; + } + + public void OnReceiveMessage(NavMsg navMsg) { + if (m_GuidanceInterface != null) { + m_GuidanceInterface.OnReceiveMessage(navMsg); + } + } + + public void exit() { + instance = null; + m_GuidanceInterface = null; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/GuidanceProvider.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/GuidanceProvider.java new file mode 100644 index 0000000000..92cf6d79de --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/GuidanceProvider.java @@ -0,0 +1,448 @@ +//package com.autonavi.nge.guidance; +// +//import android.util.Log; +// +//import com.autonavi.nge.dm.INavigationCore; +//import com.zhidaoauto.map.sdk.inner.CompileConfig; +//import com.zhidaoauto.map.sdk.inner.common.NavHelper; +// +//import java.nio.ByteBuffer; +//import java.nio.ByteOrder; +//import java.util.ArrayList; +//import java.util.List; +// +//public class GuidanceProvider { +// +// private static final String TAG = "GuidanceProvider"; +// +// public GuidanceProvider(INavigationCore naviCore) { +// load(naviCore); +// } +// +// { +// System.loadLibrary("datascript"); +// System.loadLibrary("ndssystem"); +// System.loadLibrary("ndssqlite"); +// System.loadLibrary("ndsprovider"); +// System.loadLibrary("datamgr"); +// System.loadLibrary("guidance"); +// } +// +// public void destroyProvider() { +// unload(); +// } +// +// public RouteBook getRouteBookData(int session, int start, int end) throws Exception { +// List list = new ArrayList(); +// RouteBook route = null; +// byte[] bookdata = getBookData(session, start, end); +// if (bookdata != null && bookdata.length > 0) { +// ByteBuffer databuf = ByteBuffer.wrap(bookdata); +// databuf.order(ByteOrder.LITTLE_ENDIAN); +// int bufferSize = databuf.getInt(); +// int TotalLengthlength = databuf.getInt(); +// int TotalTime = databuf.getInt(); +// int size = databuf.getInt(); +// { +// RouteBookItem item = new RouteBookItem(); +// list.add(item); +// } +// for (int i = 0; i < size; i++) { +// RouteBookItem item = new RouteBookItem(); +// item.titleID = databuf.getInt(); +// item.linkid = databuf.getInt(); +// item.routelength = databuf.getInt(); +// item.routeTime = databuf.getInt(); +// +// int namelength = databuf.get(); +// String routeName = null; +// if (namelength > 0) { +// byte[] name = new byte[namelength]; +// for (int idx = 0; idx < namelength; idx++) { +// name[idx] = (byte) databuf.get(); +// } +// item.routeName = new String(name, "UTF-8"); +// } +// +// item.lon = databuf.getInt(); +// item.lat = databuf.getInt(); +// item.turnID = databuf.getInt(); +// +// namelength = databuf.get(); +// String turnSpeech = null; +// if (namelength > 0) { +// byte[] name = new byte[namelength]; +// for (int idx = 0; idx < namelength; idx++) { +// name[idx] = (byte) databuf.get(); +// } +// item.routeSpeech = new String(name, "UTF-8"); +// } +// list.add(item); +// } +// route = new RouteBook(TotalLengthlength, TotalTime, size, list); +// } +// +// return route; +// +// } +// +// public NaviInfo getNaviInfoData() throws Exception { +// byte[] data = getNaviInfo(); +// if (data != null) { +// NaviInfo naviinfo = new NaviInfo(); +// ByteBuffer databuf = ByteBuffer.wrap(data); +// databuf.order(ByteOrder.LITTLE_ENDIAN); +// naviinfo.m_nNaviStatus = (byte) databuf.get(); +// naviinfo.m_nDistanceToDest = databuf.getInt(); +// naviinfo.m_nTimeToDest = databuf.getInt(); +// naviinfo.m_nDistanceToTurn = databuf.getInt(); +// naviinfo.m_nDistanceToNextTurn = databuf.getInt(); +// naviinfo.m_nTurnID = databuf.getInt(); +// naviinfo.m_nNextTurnID = databuf.getInt(); +// naviinfo.m_nBindLon = databuf.getInt(); +// naviinfo.m_nBindLat = databuf.getInt(); +// naviinfo.m_nImageUr = databuf.getInt(); +// naviinfo.m_nImageBg = databuf.getInt(); +// naviinfo.m_nImageArrow = databuf.getInt(); +// naviinfo.m_nImageType = (byte) databuf.get(); +// naviinfo.m_nSGPImageUr = databuf.getInt(); +// naviinfo.m_nSGPImageBg = databuf.getInt(); +// naviinfo.m_nSGPImageArrow = databuf.getInt(); +// naviinfo.m_nSGPImageType = (byte) databuf.get(); +// naviinfo.m_nSpeed = databuf.getInt(); +// naviinfo.m_LaneType = (byte) databuf.get();//车道数 +// naviinfo.m_Angle = (short) databuf.getShort(); +// naviinfo.m_IsExport = (byte) databuf.get(); +// naviinfo.m_EntranceDist = databuf.getShort(); +// naviinfo.m_ExitDist = databuf.getShort(); +// naviinfo.m_ServerDist = databuf.getShort(); +// +// int namelength = databuf.get(); +// if (namelength > 0) { +// byte[] name = new byte[namelength]; +// for (int idx = 0; idx < namelength; idx++) { +// name[idx] = (byte) databuf.get(); +// } +// naviinfo.m_pStrCurName = new String(name, "UTF-8"); +// } +// if (naviinfo.m_pStrCurName == null) { +// naviinfo.m_pStrCurName = "无名路"; +// } +// namelength = databuf.get(); +// if (namelength > 0) { +// byte[] name = new byte[namelength]; +// for (int idx = 0; idx < namelength; idx++) { +// name[idx] = (byte) databuf.get(); +// } +// naviinfo.m_pStrNextName = new String(name, "UTF-8"); +// } +// if (naviinfo.m_pStrNextName == null) { +// naviinfo.m_pStrNextName = "无名路"; +// } +// +// namelength = databuf.get(); +// if (namelength > 0) { +// byte[] name = new byte[namelength]; +// for (int idx = 0; idx < namelength; idx++) { +// name[idx] = (byte) databuf.get(); +// } +// naviinfo.m_EntranceName = new String(name, "UTF-8"); +// } +// if (naviinfo.m_EntranceName == null) { +// naviinfo.m_EntranceName = ""; +// } +// +// namelength = databuf.get(); +// if (namelength > 0) { +// byte[] name = new byte[namelength]; +// for (int idx = 0; idx < namelength; idx++) { +// name[idx] = (byte) databuf.get(); +// } +// naviinfo.m_ExitName = new String(name, "UTF-8"); +// } +// if (naviinfo.m_ExitName == null) { +// naviinfo.m_ExitName = ""; +// } +// +// namelength = databuf.get(); +// if (namelength > 0) { +// byte[] name = new byte[namelength]; +// for (int idx = 0; idx < namelength; idx++) { +// name[idx] = (byte) databuf.get(); +// } +// naviinfo.m_ServerName = new String(name, "UTF-8"); +// } +// if (naviinfo.m_ServerName == null) { +// naviinfo.m_ServerName = ""; +// } +// if(!NavHelper.INSTANCE.getMNavParams().isCrossingDrawingEnabled()){ +// naviinfo.m_nImageType = 0; +// } +// if(!NavHelper.INSTANCE.getMNavParams().isOpenNextRoadInfo()){ +// naviinfo.m_nNextTurn = 0; +// }else { +// naviinfo.m_nNextTurn = 1; +// } +// +// if(CompileConfig.INSTANCE.getDEBUG()){ +// Log.i(TAG, "navop-getNaviInfoData: "+naviinfo); +// } +// return naviinfo; +// } else { +// return null; +// } +// } +// +// public NaviInfo getNaviInfoData(byte[] data) throws Exception { +// if (data != null) { +// NaviInfo naviinfo = new NaviInfo(); +// ByteBuffer databuf = ByteBuffer.wrap(data); +// databuf.order(ByteOrder.LITTLE_ENDIAN); +// naviinfo.m_nNaviStatus = (byte) databuf.get(); +// naviinfo.m_nDistanceToDest = databuf.getInt(); +// naviinfo.m_nTimeToDest = databuf.getInt(); +// naviinfo.m_nDistanceToTurn = databuf.getInt(); +// naviinfo.m_nDistanceToNextTurn = databuf.getInt(); +// naviinfo.m_nTurnID = databuf.getInt(); +// naviinfo.m_nNextTurnID = databuf.getInt(); +// naviinfo.m_nBindLon = databuf.getInt(); +// naviinfo.m_nBindLat = databuf.getInt(); +// naviinfo.m_nImageUr = databuf.getInt(); +// naviinfo.m_nImageBg = databuf.getInt(); +// naviinfo.m_nImageArrow = databuf.getInt(); +// naviinfo.m_nImageType = (byte) databuf.get(); +// naviinfo.m_nSGPImageUr = databuf.getInt(); +// naviinfo.m_nSGPImageBg = databuf.getInt(); +// naviinfo.m_nSGPImageArrow = databuf.getInt(); +// naviinfo.m_nSGPImageType = (byte) databuf.get(); +// naviinfo.m_nSpeed = databuf.getInt(); +// naviinfo.m_LaneType = (byte) databuf.get();//车道数 +// naviinfo.m_Angle = (short) databuf.getShort(); +// naviinfo.m_IsExport = (byte) databuf.get(); +// naviinfo.m_EntranceDist = databuf.getShort(); +// naviinfo.m_ExitDist = databuf.getShort(); +// naviinfo.m_ServerDist = databuf.getShort(); +// +// int namelength = databuf.get(); +// if (namelength > 0) { +// byte[] name = new byte[namelength]; +// for (int idx = 0; idx < namelength; idx++) { +// name[idx] = (byte) databuf.get(); +// } +// naviinfo.m_pStrCurName = new String(name, "UTF-8"); +// } +// if (naviinfo.m_pStrCurName == null) { +// naviinfo.m_pStrCurName = "无名路"; +// } +// namelength = databuf.get(); +// if (namelength > 0) { +// byte[] name = new byte[namelength]; +// for (int idx = 0; idx < namelength; idx++) { +// name[idx] = (byte) databuf.get(); +// } +// naviinfo.m_pStrNextName = new String(name, "UTF-8"); +// } +// if (naviinfo.m_pStrNextName == null) { +// naviinfo.m_pStrNextName = "无名路"; +// } +// +// namelength = databuf.get(); +// if (namelength > 0) { +// byte[] name = new byte[namelength]; +// for (int idx = 0; idx < namelength; idx++) { +// name[idx] = (byte) databuf.get(); +// } +// naviinfo.m_EntranceName = new String(name, "UTF-8"); +// } +// if (naviinfo.m_EntranceName == null) { +// naviinfo.m_EntranceName = ""; +// } +// +// namelength = databuf.get(); +// if (namelength > 0) { +// byte[] name = new byte[namelength]; +// for (int idx = 0; idx < namelength; idx++) { +// name[idx] = (byte) databuf.get(); +// } +// naviinfo.m_ExitName = new String(name, "UTF-8"); +// } +// if (naviinfo.m_ExitName == null) { +// naviinfo.m_ExitName = ""; +// } +// +// namelength = databuf.get(); +// if (namelength > 0) { +// byte[] name = new byte[namelength]; +// for (int idx = 0; idx < namelength; idx++) { +// name[idx] = (byte) databuf.get(); +// } +// naviinfo.m_ServerName = new String(name, "UTF-8"); +// } +// if (naviinfo.m_ServerName == null) { +// naviinfo.m_ServerName = ""; +// } +// if(!NavHelper.INSTANCE.getMNavParams().isCrossingDrawingEnabled()){ +// naviinfo.m_nImageType = 0; +// } +// if(!NavHelper.INSTANCE.getMNavParams().isOpenNextRoadInfo()){ +// naviinfo.m_nNextTurn = 0; +// }else { +// naviinfo.m_nNextTurn = 1; +// } +// return naviinfo; +// } else { +// return null; +// } +// } +// +// public String getGuidanceTTS() throws Exception { +// String res = null; +// byte[] data = getGuidanceSpeech(); +// if (data != null) { +// ByteBuffer databuf = ByteBuffer.wrap(data); +// databuf.order(ByteOrder.LITTLE_ENDIAN); +// int isRead = databuf.get(); +// if (isRead == 0) { +// return null; +// } +// int namelength = databuf.get(); +// if (namelength > 0) { +// byte[] name = new byte[namelength]; +// for (int idx = 0; idx < namelength; idx++) { +// name[idx] = (byte) databuf.get(); +// } +// res = new String(name, "UTF-8"); +// } +// } +// return res; +// } +// +// public RouteImage getRouteImage(int imageUr, int imageBg, int imageArrow, int type) { +// byte[] data = getGuidanceImage(imageUr, imageBg, imageArrow, type); +// try { +// RouteImage routeImage = new RouteImage(); +// routeImage.imageArrowID = imageArrow; +// routeImage.imageBgID = imageBg; +// ByteBuffer databuf = ByteBuffer.wrap(data); +// databuf.order(ByteOrder.LITTLE_ENDIAN); +// //记录图片1的长度 -- 背景 +// int bgSize = databuf.getInt(); +// byte[] image = new byte[bgSize]; +// for (int idx = 0; idx < bgSize; idx++) { +// image[idx] = (byte) databuf.get(); +// } +// routeImage.imageBg = image; +// bgSize = databuf.getInt(); +// byte[] imageArrows = new byte[bgSize]; +// for (int idx = 0; idx < bgSize; idx++) { +// imageArrows[idx] = (byte) databuf.get(); +// } +// routeImage.imageArrow = imageArrows; +// return routeImage; +// } catch (Exception e) { +// e.printStackTrace(); +// } +// return null; +// } +// +// public LaneMask getGuidanceNaviLane() { +// byte[] data = getGuidanceLane(); +// +// if (data != null && data.length > 0) { +// LaneMask mask = new LaneMask(); +// ByteBuffer databuf = ByteBuffer.wrap(data); +// databuf.order(ByteOrder.LITTLE_ENDIAN); +// int size = databuf.get();//车道数 +// mask.m_iSzie = size; +// +// List list = new ArrayList(size); +// for (int i = 0; i < size; i++) { +// LaneMarkInfo info = new LaneMarkInfo(); +// +// int type = databuf.get(); +// boolean iST = false; +// if ((type & LaneMarkTools.UTURN_BIT_MASK) > 0) { +// info.isUTurn = true; +// iST = true; +// } +// +// if ((type & LaneMarkTools.AHEAD_BIT_MASK) > 0) { +// info.isAhead = true; +// iST = true; +// } +// +// if ((type & LaneMarkTools.LEFT_ONE_BIT_MASK) > 0) { +// info.isLeftOne = true; +// iST = true; +// } +// +// if ((type & LaneMarkTools.LEFT_THREE_BIT_MASK) > 0) { +// info.isLeftThree = true; +// iST = true; +// } +// +// if ((type & LaneMarkTools.LEFT_TWO_BIT_MASK) > 0) { +// info.isLeftTwo = true; +// iST = true; +// } +// +// if ((type & LaneMarkTools.RIGHT_ONE_BIT_MASK) > 0) { +// info.isRightOne = true; +// iST = true; +// } +// +// if ((type & LaneMarkTools.RIGHT_THREE_BIT_MASK) > 0) { +// info.isRightThree = true; +// iST = true; +// } +// +// if ((type & LaneMarkTools.RIGHT_TWO_BIT_MASK) > 0) { +// info.isRightTwo = true; +// iST = true; +// } +// +// if (iST == false) { +// info.isAhead = true; +// } +// +// list.add(info); +// } +// if (size > 0) { +// mask.isHighLightID = databuf.get();//高亮 +// } +// mask.m_nLaneMark = list; +// return mask; +// } else { +// return null; +// } +// } +// +// private native boolean load( INavigationCore naviCore); +// +// private native void unload(); +// +// public native void startNavi(int type); +// +// public native void stopNavi(); +// +// public native void pauseSimNavi(); +// +// public native void resumeSimNavi(); +// +// public native void updatePosition(float x, float y, float speed, float heading); +// +// public native void setSimSpeed(int speed); +// +// public native byte[] getBookData(int session, int start, int end); +// +// public native byte[] getNaviInfo(); +// +// public native byte[] getGuidanceSpeech(); +// +// public native byte[] getGuidanceImage(int imageUr, int imageBg, int imageArrow, int type); +// +// public native byte[] getGuidanceLane(); +// +// public native double getRoadAngle(); +// +//} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/Guidanceinterface.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/Guidanceinterface.java new file mode 100644 index 0000000000..bc13d30b95 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/Guidanceinterface.java @@ -0,0 +1,7 @@ +package com.autonavi.nge.guidance; + +import com.zhidaoauto.map.sdk.inner.obj.NavMsg; + +public interface Guidanceinterface { + public void OnReceiveMessage(NavMsg navMsg); +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/LaneMarkInfo.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/LaneMarkInfo.java new file mode 100644 index 0000000000..5b86a25719 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/LaneMarkInfo.java @@ -0,0 +1,68 @@ +package com.autonavi.nge.guidance; + +import android.os.Parcel; +import android.os.Parcelable; + +public class LaneMarkInfo implements Parcelable{ + public static final Creator CREATOR = new Creator() { + public LaneMarkInfo createFromParcel(Parcel in) { + LaneMarkInfo info = new LaneMarkInfo(); + info.isUTurn = in.readByte() == 0 ? false : true; + info.isRightOne = in.readByte() == 0 ? false : true; + info.isRightTwo = in.readByte() == 0 ? false : true; + info.isRightThree = in.readByte() == 0 ? false : true; + info.isAhead = in.readByte() == 0 ? false : true; + info.isLeftThree = in.readByte() == 0 ? false : true; + info.isLeftTwo = in.readByte() == 0 ? false : true; + info.isLeftOne = in.readByte() == 0 ? false : true; + + return info; + } + + public LaneMarkInfo[] newArray(int size) { + return new LaneMarkInfo[size]; + } + }; + + + boolean isUTurn = false; + boolean isRightOne = false; + boolean isRightTwo = false; + boolean isRightThree = false; + boolean isAhead = false; + boolean isLeftThree = false; + boolean isLeftTwo = false; + boolean isLeftOne = false; + @Override + public int describeContents() { + + return 0; + } + @Override + public void writeToParcel(Parcel out, int flags) { + + out.writeByte((byte) (isUTurn?1:0)); + out.writeByte((byte) (isRightOne?1:0)); + out.writeByte((byte) (isRightTwo?1:0)); + out.writeByte((byte) (isRightThree?1:0)); + out.writeByte((byte) (isAhead?1:0)); + out.writeByte((byte) (isLeftThree?1:0)); + out.writeByte((byte) (isLeftTwo?1:0)); + out.writeByte((byte) (isLeftOne?1:0)); + + } + + @Override + public String toString() { + return "LaneMarkInfo{" + + "isUTurn=" + isUTurn + + ", isRightOne=" + isRightOne + + ", isRightTwo=" + isRightTwo + + ", isRightThree=" + isRightThree + + ", isAhead=" + isAhead + + ", isLeftThree=" + isLeftThree + + ", isLeftTwo=" + isLeftTwo + + ", isLeftOne=" + isLeftOne + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/LaneMarkTools.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/LaneMarkTools.java new file mode 100644 index 0000000000..4145030de4 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/LaneMarkTools.java @@ -0,0 +1,1241 @@ +package com.autonavi.nge.guidance; + +import android.graphics.Bitmap; +import android.graphics.Bitmap.Config; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.NinePatch; +import android.graphics.Paint; +import android.graphics.Paint.Join; +import android.graphics.Paint.Style; +import android.graphics.Path; +import android.graphics.RectF; + +public class LaneMarkTools { + + float Panel_Image_Scale = 1; + int LANEMARKING_SUM = 13; + + int PANEL_IMAGE_WIDTH = 408; + int PANEL_IMAGE_HEIGHT = 200; + int LANE_PANELBORDER_MARGIN = 5; + int LANE_PANELBORDER_RADIAN = 10; + + int ROAD_BOUNDARY_MARGIN = 10; + + int LANE_WIDTH = (PANEL_IMAGE_WIDTH / 4); + int LANE_HEIGHT = (PANEL_IMAGE_HEIGHT - (4 * LANE_PANELBORDER_MARGIN)); + + int STRAIGHT_SECTION_WIDTH = 10 ; + int STRAIGHT_SECTION_HEIGHT = 100; + + int ARROW_IMAGE_WIDTH = 32; + int ARROW_IMAGE_HEIGHT = 32 ; + int ARROW_THICKNESS = 10; + + int TRIANGLE_IMAGE_WIDTH = (LANE_HEIGHT / 3); + int TRIANGLE_IMAGE_HEIGHT = (TRIANGLE_IMAGE_WIDTH / 4); + + int DASH_STRIPS_IMAGE_WIDTH = (LANE_WIDTH / 15); + int DASH_STRIPS_IMAGE_HEIGHT = LANE_HEIGHT; + int DASH_STRIPS_SOLID_SECTION_UNIT = (DASH_STRIPS_IMAGE_HEIGHT / 8); + int DASH_STRIPS_SPACE_SECTION_UNIT = DASH_STRIPS_SOLID_SECTION_UNIT; + + int SOLID_STRIPS_IMAGE_WIDTH = DASH_STRIPS_IMAGE_WIDTH; + int SOLID_STRIPS_IMAGE_HEIGHT = LANE_HEIGHT; + + int ARC_RADIUS = ((LANE_WIDTH / 3) / 2); + int ARC_INTO_SECTION_WIDTH = STRAIGHT_SECTION_WIDTH; + int ARC_INTO_SECTION_HEIGHT = (LANE_HEIGHT / 3); + int ARC_GOTO_SECTION_WIDTH = ARC_INTO_SECTION_WIDTH; + int ARC_GOTO_SECTION_HEIGHT = (ARC_INTO_SECTION_HEIGHT - ARROW_THICKNESS); + int ARC_START_ANGLE = 0; + int ARC_SWEEP_ANGLE = -180; + boolean ARC_USE_CENTER = false; + + int RIGHT_TURN_VERTICAL_SECTION_WIDTH = STRAIGHT_SECTION_WIDTH; + int RIGHT_TURN_VERTICAL_SECTION_HEIGHT = (LANE_HEIGHT / 3); + int RIGHT_TURN_HORIZONTAL_SECTION_WIDTH = STRAIGHT_SECTION_WIDTH; + int RIGHT_TURN_HORIZONTAL_SECTION_HEIGHT = (LANE_WIDTH / 3); + + int LEFT_TURN_VERTICAL_SECTION_WIDTH = STRAIGHT_SECTION_WIDTH; + int LEFT_TURN_VERTICAL_SECTION_HEIGHT = (LANE_HEIGHT / 3); + int LEFT_TURN_HORIZONTAL_SECTION_WIDTH = STRAIGHT_SECTION_WIDTH; + int LEFT_TURN_HORIZONTAL_SECTION_HEIGHT = (LANE_WIDTH / 3); + + int RIGHT_FRONT_TURN_SLOPE_WIDTH = RIGHT_TURN_HORIZONTAL_SECTION_HEIGHT; + int RIGHT_FRONT_TURN_SLOPE_THICKNESS = RIGHT_TURN_VERTICAL_SECTION_HEIGHT / 3; + + int LEFT_FRONT_TURN_SLOPE_WIDTH = LEFT_TURN_HORIZONTAL_SECTION_HEIGHT; + int LEFT_FRONT_TURN_SLOPE_THICKNESS = LEFT_TURN_VERTICAL_SECTION_HEIGHT / 3; + + + + int HIGH_LIGHT_LAYOUT_ARRAY_CAPACITY = 30; + + public static int UTURN_BIT_MASK = 0x80; + public static int RIGHT_ONE_BIT_MASK = 0x40; + public static int RIGHT_TWO_BIT_MASK = 0x20; + public static int RIGHT_THREE_BIT_MASK = 0x10; + public static int AHEAD_BIT_MASK = 0x8; + public static int LEFT_THREE_BIT_MASK = 0x4; + public static int LEFT_TWO_BIT_MASK = 0x2; + public static int LEFT_ONE_BIT_MASK = 0x1; + + public LaneMarkTools(float scale,int screenWidth,int screenHeight) + { + Panel_Image_Scale = scale; + + PANEL_IMAGE_WIDTH = (int) (screenWidth/4 * Panel_Image_Scale); + PANEL_IMAGE_HEIGHT = (int) (screenHeight/3 * Panel_Image_Scale); + LANE_PANELBORDER_MARGIN = (int) (5 * Panel_Image_Scale); + LANE_PANELBORDER_RADIAN = (int) (10 * Panel_Image_Scale); + + ROAD_BOUNDARY_MARGIN = (int) (10 * Panel_Image_Scale); + + LANE_WIDTH = (PANEL_IMAGE_WIDTH / 4); + LANE_HEIGHT = (PANEL_IMAGE_HEIGHT - (4 * LANE_PANELBORDER_MARGIN)); + + STRAIGHT_SECTION_WIDTH = (int) (10 * Panel_Image_Scale); + STRAIGHT_SECTION_HEIGHT = (int) (100 * Panel_Image_Scale); + + ARROW_IMAGE_WIDTH = (int) (32 * Panel_Image_Scale); + ARROW_IMAGE_HEIGHT = (int) (32 * Panel_Image_Scale); + ARROW_THICKNESS = (int) (10 * Panel_Image_Scale); + + TRIANGLE_IMAGE_WIDTH = (LANE_HEIGHT / 3); + TRIANGLE_IMAGE_HEIGHT = (TRIANGLE_IMAGE_WIDTH / 4); + + DASH_STRIPS_IMAGE_WIDTH = (LANE_WIDTH / 15); + DASH_STRIPS_IMAGE_HEIGHT = LANE_HEIGHT; + DASH_STRIPS_SOLID_SECTION_UNIT = (DASH_STRIPS_IMAGE_HEIGHT / 8); + DASH_STRIPS_SPACE_SECTION_UNIT = DASH_STRIPS_SOLID_SECTION_UNIT; + + SOLID_STRIPS_IMAGE_WIDTH = DASH_STRIPS_IMAGE_WIDTH; + SOLID_STRIPS_IMAGE_HEIGHT = LANE_HEIGHT; + + ARC_RADIUS = ((LANE_WIDTH / 3) / 2); + ARC_INTO_SECTION_WIDTH = STRAIGHT_SECTION_WIDTH; + ARC_INTO_SECTION_HEIGHT = (LANE_HEIGHT / 3); + ARC_GOTO_SECTION_WIDTH = ARC_INTO_SECTION_WIDTH; + ARC_GOTO_SECTION_HEIGHT = (ARC_INTO_SECTION_HEIGHT - ARROW_THICKNESS); + ARC_START_ANGLE = 0; + ARC_SWEEP_ANGLE = -180; + ARC_USE_CENTER = false; + + RIGHT_TURN_VERTICAL_SECTION_WIDTH = STRAIGHT_SECTION_WIDTH; + RIGHT_TURN_VERTICAL_SECTION_HEIGHT = (LANE_HEIGHT / 3); + RIGHT_TURN_HORIZONTAL_SECTION_WIDTH = STRAIGHT_SECTION_WIDTH; + RIGHT_TURN_HORIZONTAL_SECTION_HEIGHT = (LANE_WIDTH / 3); + + LEFT_TURN_VERTICAL_SECTION_WIDTH = STRAIGHT_SECTION_WIDTH; + LEFT_TURN_VERTICAL_SECTION_HEIGHT = (LANE_HEIGHT / 3); + LEFT_TURN_HORIZONTAL_SECTION_WIDTH = STRAIGHT_SECTION_WIDTH; + LEFT_TURN_HORIZONTAL_SECTION_HEIGHT = (LANE_WIDTH / 3); + + RIGHT_FRONT_TURN_SLOPE_WIDTH = RIGHT_TURN_HORIZONTAL_SECTION_HEIGHT; + RIGHT_FRONT_TURN_SLOPE_THICKNESS = RIGHT_TURN_VERTICAL_SECTION_HEIGHT / 3; + + LEFT_FRONT_TURN_SLOPE_WIDTH = LEFT_TURN_HORIZONTAL_SECTION_HEIGHT; + LEFT_FRONT_TURN_SLOPE_THICKNESS = LEFT_TURN_VERTICAL_SECTION_HEIGHT / 3; + } + //渲染箭头图元(标准型) + public BitmapInfo getRenderArrowImage(boolean isW) + { + int width = ARROW_IMAGE_WIDTH; + int height = ARROW_IMAGE_HEIGHT; + int m_iArrowThickness = ARROW_THICKNESS; + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + if(isW) + paint.setColor(Color.WHITE); + else + paint.setColor(Color.GREEN); + paint.setAntiAlias(true); + Path path = new Path(); + path.moveTo(ARROW_IMAGE_WIDTH / 2, 0); + path.lineTo(ARROW_IMAGE_WIDTH, ARROW_IMAGE_HEIGHT / 2); + path.lineTo(ARROW_IMAGE_WIDTH, ARROW_IMAGE_HEIGHT / 2 + ARROW_THICKNESS); + path.lineTo(ARROW_IMAGE_WIDTH / 2, ARROW_THICKNESS); + path.lineTo(0, ARROW_IMAGE_HEIGHT / 2 + ARROW_THICKNESS); + path.lineTo(0, ARROW_IMAGE_HEIGHT / 2); + path.close(); + canvas.drawPath(path, paint); + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; +// Bitmap bitmap = BitmapFactory.decodeByteArray(data, offset, length); + } + + //渲染箭头图元(三角形) + public BitmapInfo getRenderTriangleImage(boolean isW) + { + int width = TRIANGLE_IMAGE_WIDTH; + int height = TRIANGLE_IMAGE_HEIGHT; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + if(isW) + paint.setColor(Color.WHITE); + else + paint.setColor(Color.GREEN); + paint.setAntiAlias(true); + Path path = new Path(); + path.moveTo(TRIANGLE_IMAGE_WIDTH / 2, 0); + path.lineTo(TRIANGLE_IMAGE_WIDTH, TRIANGLE_IMAGE_HEIGHT); + path.lineTo(0, TRIANGLE_IMAGE_HEIGHT); + path.close(); + canvas.drawPath(path, paint); + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + return info; + } + + //车道分隔线(虚线) + public BitmapInfo getRenderDashStripsImage(boolean isW) + { + int width = DASH_STRIPS_IMAGE_WIDTH; + int height = DASH_STRIPS_IMAGE_HEIGHT; + int m_iSolidSectionUnit = DASH_STRIPS_SOLID_SECTION_UNIT; + int m_iSpaceSectionUnit = DASH_STRIPS_SPACE_SECTION_UNIT; + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + if(isW) + paint.setColor(Color.WHITE); + else + paint.setColor(Color.GREEN); + paint.setAntiAlias(true); + + int solidSectionRectLeft = 0; + int solidSectionRectTop = 0; + int solidSectionRectRight = DASH_STRIPS_IMAGE_WIDTH; + int solidSectionRectBottom = DASH_STRIPS_SOLID_SECTION_UNIT; + RectF solidSectionRect = new RectF(); + solidSectionRect.set(solidSectionRectLeft, solidSectionRectTop, solidSectionRectRight, solidSectionRectBottom); + + int translationX = 0; + int translationY = DASH_STRIPS_SOLID_SECTION_UNIT / 2; + canvas.save(); + canvas.translate(translationX, translationY); + + for(int i = 0; i < DASH_STRIPS_IMAGE_HEIGHT / (DASH_STRIPS_SOLID_SECTION_UNIT + DASH_STRIPS_SPACE_SECTION_UNIT); i++){ + canvas.drawRect(solidSectionRect, paint); + translationX = 0; + translationY = DASH_STRIPS_SOLID_SECTION_UNIT + DASH_STRIPS_SPACE_SECTION_UNIT; + canvas.translate(translationX, translationY); + } + canvas.restore(); + + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + + } + + //道路边界线(实线) + public BitmapInfo getRenderSolidStripsImage(boolean isW) + { + int width = SOLID_STRIPS_IMAGE_WIDTH; + int height = SOLID_STRIPS_IMAGE_HEIGHT; + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + if(isW) + paint.setColor(Color.WHITE); + else + paint.setColor(Color.GREEN); + paint.setAntiAlias(true); + + int rectLeft = 0; + int rectTop = DASH_STRIPS_SOLID_SECTION_UNIT / 2; + int rectRight = SOLID_STRIPS_IMAGE_WIDTH; + int rectBottom = SOLID_STRIPS_IMAGE_HEIGHT - (DASH_STRIPS_SOLID_SECTION_UNIT / 2); + + RectF rect = new RectF(); + rect.set(rectLeft, rectTop, rectRight, rectBottom); + + canvas.drawRect(rect, paint); + + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + + + } + + //车道分隔线(虚线) + public BitmapInfo getRenderSolidStripsLowImage() + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + paint.setColor(Color.GREEN); + paint.setStyle(Style.STROKE); + paint.setStrokeWidth(ARC_GOTO_SECTION_WIDTH); + paint.setAntiAlias(true); + float arcGotoSectionPositionX = (LANE_WIDTH - ARC_RADIUS * 2) / 2; + float arcGotoSectionPositionY = LANE_HEIGHT / 3; + canvas.drawLine(arcGotoSectionPositionX, arcGotoSectionPositionY, + arcGotoSectionPositionX, arcGotoSectionPositionY + ARC_INTO_SECTION_HEIGHT, + paint); + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + + } + //调头图元 + public BitmapInfo getRenderUTurnLaneArrow(boolean isW) + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + int typemask = UTURN_BIT_MASK; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + if(isW) + paint.setColor(Color.WHITE); + else + paint.setColor(Color.GREEN); + paint.setStyle(Style.STROKE); + paint.setStrokeWidth(ARC_GOTO_SECTION_WIDTH); + paint.setAntiAlias(true); + + float arcGotoSectionPositionX = (LANE_WIDTH - ARC_RADIUS * 2) / 2; + float arcGotoSectionPositionY = LANE_HEIGHT / 3; + canvas.drawLine(arcGotoSectionPositionX, arcGotoSectionPositionY, + arcGotoSectionPositionX, arcGotoSectionPositionY + ARC_GOTO_SECTION_HEIGHT, + paint); + + float arcIntoSectionPositionX = arcGotoSectionPositionX + ARC_RADIUS * 2; + float arcIntoSectionPositionY = LANE_HEIGHT / 3; + canvas.drawLine(arcIntoSectionPositionX, arcIntoSectionPositionY, + arcIntoSectionPositionX, arcIntoSectionPositionY + ARC_INTO_SECTION_HEIGHT, + paint); + + paint.setStyle(Style.STROKE); + paint.setStrokeWidth(ARC_GOTO_SECTION_WIDTH); + float arcRectLeft = arcGotoSectionPositionX; + float arcRectTop = arcGotoSectionPositionY - ARC_RADIUS; + float arcRectRight = arcRectLeft + ARC_RADIUS * 2; + float arcRectBottom = arcRectTop + ARC_RADIUS * 2; + RectF arcRect = new RectF(); + arcRect.set(arcRectLeft, arcRectTop, arcRectRight, arcRectBottom); + canvas.drawArc(arcRect, ARC_START_ANGLE, ARC_SWEEP_ANGLE, ARC_USE_CENTER, paint); + + Bitmap arrowImage = getRenderArrowImage(isW).bitmap; + float translationX = arcGotoSectionPositionX; + float translationY = arcGotoSectionPositionY + ARC_INTO_SECTION_HEIGHT; + canvas.save(); + canvas.translate(translationX, translationY); + canvas.rotate(180); + canvas.drawBitmap(arrowImage, -(arrowImage.getWidth() / 2),0, paint); + canvas.restore(); + + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + } + + //直行 + public BitmapInfo getRenderStraightLaneArrow(int isW) + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + int typemask = 0x8; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + if(isW != AHEAD_BIT_MASK) + paint.setColor(Color.WHITE); + else + paint.setColor(Color.GREEN); + paint.setStyle(Style.STROKE); + paint.setStrokeJoin(Join.ROUND); + paint.setStrokeWidth(STRAIGHT_SECTION_WIDTH); + paint.setAntiAlias(true); + + Bitmap arrowImage = getRenderArrowImage(isW == AHEAD_BIT_MASK ? false : true).bitmap; + int arrowPositionX = (LANE_WIDTH - arrowImage.getWidth()) / 2; + int arrowPositionY = (LANE_HEIGHT - ARROW_THICKNESS - STRAIGHT_SECTION_HEIGHT) / 2; + canvas.drawBitmap(arrowImage, arrowPositionX, arrowPositionY, paint); + + int straightSectionWidth = STRAIGHT_SECTION_WIDTH; + int straightSectionHeight = STRAIGHT_SECTION_HEIGHT; + int straightSectionPositionX = LANE_WIDTH / 2; + int straightSectionPositionY = arrowPositionY + ARROW_THICKNESS; + canvas.drawLine(straightSectionPositionX, straightSectionPositionY, straightSectionPositionX, straightSectionPositionY + straightSectionHeight, paint); + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + } + + //左转90度 + public BitmapInfo getRenderLeftTwoTurnLaneArrow(int isW) + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + int typemask = 0x2; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + if(isW != LEFT_TWO_BIT_MASK) + paint.setColor(Color.WHITE); + else + paint.setColor(Color.GREEN); + paint.setStyle(Style.STROKE); + paint.setStrokeJoin(Join.ROUND); + paint.setStrokeWidth(LEFT_TURN_VERTICAL_SECTION_WIDTH); + paint.setAntiAlias(true); + + int startX = LANE_WIDTH - LANE_WIDTH / 3; + int startY = LANE_HEIGHT - LANE_HEIGHT / 3; + int throughX = startX; + int throughY = startY - LEFT_TURN_VERTICAL_SECTION_HEIGHT; + int endX = throughX - LEFT_TURN_HORIZONTAL_SECTION_HEIGHT; + int endY = throughY; + + Path path = new Path(); + path.moveTo(startX, startY); + path.lineTo(throughX, throughY); + path.lineTo(endX, endY); + + canvas.drawPath(path, paint); + + Bitmap arrowImage = getRenderArrowImage(isW == LEFT_TWO_BIT_MASK ? false : true).bitmap; + int translationX = endX - ARROW_THICKNESS; + int translationY = endY; + canvas.save(); + canvas.translate(translationX, translationY); + canvas.rotate(-90); + canvas.drawBitmap(arrowImage, -(arrowImage.getWidth() / 2), 0, paint); + canvas.restore(); + + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + } + + //右转90度 + public BitmapInfo getRenderRightTwoTurnLaneArrow(int isW) + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + int typemask = 0x20; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + if(isW != RIGHT_TWO_BIT_MASK) + paint.setColor(Color.WHITE); + else + paint.setColor(Color.GREEN); + paint.setStyle(Style.STROKE); + paint.setStrokeJoin(Join.ROUND); + paint.setStrokeWidth(RIGHT_TURN_VERTICAL_SECTION_WIDTH); + paint.setAntiAlias(true); + + int startX = LANE_WIDTH / 3; + int startY = LANE_HEIGHT - LANE_HEIGHT / 3; + int throughX = startX; + int throughY = startY - RIGHT_TURN_VERTICAL_SECTION_HEIGHT; + int endX = throughX + RIGHT_TURN_HORIZONTAL_SECTION_HEIGHT; + int endY = throughY; + + Path path = new Path(); + path.moveTo(startX, startY); + path.lineTo(throughX, throughY); + path.lineTo(endX, endY); + + canvas.drawPath(path, paint); + + Bitmap arrowImage = getRenderArrowImage(isW == RIGHT_TWO_BIT_MASK ? false : true).bitmap; + int translationX = endX + ARROW_THICKNESS; + int translationY = endY; + canvas.save(); + canvas.translate(translationX, translationY); + canvas.rotate(90); + canvas.drawBitmap(arrowImage, -(arrowImage.getWidth() / 2), 0, paint); + canvas.restore(); + + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + } + + /** + * 直行 + 左转90度 + * @param isW + * @return + */ + public BitmapInfo getRenderStraightAddLeftTwoTurnLaneArrow(int isW) + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + int typemask = 0xA; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + paint.setColor(Color.WHITE); + paint.setStyle(Style.STROKE); + paint.setStrokeJoin(Join.ROUND); + paint.setStrokeWidth(LEFT_TURN_VERTICAL_SECTION_WIDTH); + paint.setAntiAlias(true); + + Bitmap straightLineArrow = getRenderStraightLaneArrow(isW).bitmap; + Bitmap leftTwoTurnArrow = getRenderLeftTwoTurnLaneArrow(isW).bitmap; + + int translationX = LEFT_TURN_HORIZONTAL_SECTION_HEIGHT / 2; + int translationY = 0; + canvas.save(); + if(isW != AHEAD_BIT_MASK) + { + canvas.translate(translationX, translationY); + canvas.drawBitmap(straightLineArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + if(isW != LEFT_TWO_BIT_MASK){ + translationX = 0; + translationY = LANE_HEIGHT / 3 - (LANE_HEIGHT - ARROW_THICKNESS - STRAIGHT_SECTION_HEIGHT) / 2; + canvas.translate(translationX, translationY); + canvas.drawBitmap(leftTwoTurnArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + if(isW == AHEAD_BIT_MASK) + { + translationX = LEFT_TURN_HORIZONTAL_SECTION_HEIGHT / 2; + translationY = 0; + canvas.translate(translationX, translationY); + canvas.drawBitmap(straightLineArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + else if(isW == LEFT_TWO_BIT_MASK){ + translationX = 0; + translationY = LANE_HEIGHT / 3 - (LANE_HEIGHT - ARROW_THICKNESS - STRAIGHT_SECTION_HEIGHT) / 2; + canvas.translate(translationX, translationY); + canvas.drawBitmap(leftTwoTurnArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + canvas.restore(); + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + } + + //直行 + 右转90度 + public BitmapInfo getRenderStraightAddRightTwoTurnLaneArrow(int isW) + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + int typemask = 0x28; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + paint.setColor(Color.WHITE); + paint.setStyle(Style.STROKE); + paint.setStrokeJoin(Join.ROUND); + paint.setStrokeWidth(RIGHT_TURN_VERTICAL_SECTION_WIDTH); + paint.setAntiAlias(true); + + Bitmap straightLineArrow = getRenderStraightLaneArrow(isW).bitmap; + Bitmap rightTwoTurnArrow = getRenderRightTwoTurnLaneArrow(isW).bitmap; + + int translationX = -(RIGHT_TURN_HORIZONTAL_SECTION_HEIGHT / 2); + int translationY = 0; + canvas.save(); + if(isW != AHEAD_BIT_MASK) + { + canvas.translate(translationX, translationY); + canvas.drawBitmap(straightLineArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + if(isW != RIGHT_TWO_BIT_MASK) + { + translationX = 0; + translationY = LANE_HEIGHT / 3 - (LANE_HEIGHT - ARROW_THICKNESS - STRAIGHT_SECTION_HEIGHT) / 2; + canvas.translate(translationX, translationY); + canvas.drawBitmap(rightTwoTurnArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + if(isW == AHEAD_BIT_MASK) + { + translationX = -(RIGHT_TURN_HORIZONTAL_SECTION_HEIGHT / 2); + translationY = 0; + canvas.translate(translationX, translationY); + canvas.drawBitmap(straightLineArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + }else if(isW == RIGHT_TWO_BIT_MASK){ + translationX = 0; + translationY = LANE_HEIGHT / 3 - (LANE_HEIGHT - ARROW_THICKNESS - STRAIGHT_SECTION_HEIGHT) / 2; + canvas.translate(translationX, translationY); + canvas.drawBitmap(rightTwoTurnArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + canvas.restore(); + + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + } + + //左转90度 + 右转90度 + public BitmapInfo getRenderLeftTwoTurnAddRightTwoTurnLaneArrow(int isW) + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + int typemask = 0x22; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + paint.setColor(Color.WHITE); + paint.setStyle(Style.STROKE); + paint.setStrokeJoin(Join.ROUND); + paint.setStrokeWidth(RIGHT_TURN_VERTICAL_SECTION_WIDTH); + paint.setAntiAlias(true); + + Bitmap leftTwoTurnArrow = getRenderLeftTwoTurnLaneArrow(isW).bitmap; + Bitmap rightTwoTurnArrow = getRenderRightTwoTurnLaneArrow(isW).bitmap; + + int translationX = -(LEFT_TURN_HORIZONTAL_SECTION_HEIGHT / 2); + int translationY = 0; + canvas.save(); + if(isW != LEFT_TWO_BIT_MASK) + { + canvas.translate(translationX, translationY); + canvas.drawBitmap(leftTwoTurnArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + if(isW != RIGHT_TWO_BIT_MASK) + { + translationX = RIGHT_TURN_HORIZONTAL_SECTION_HEIGHT / 2; + translationY = 0; + canvas.translate(translationX, translationY); + canvas.drawBitmap(rightTwoTurnArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + if(isW == LEFT_TWO_BIT_MASK) + { + translationX = -(LEFT_TURN_HORIZONTAL_SECTION_HEIGHT / 2); + translationY = 0; + canvas.translate(translationX, translationY); + canvas.drawBitmap(leftTwoTurnArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + else if(isW == RIGHT_TWO_BIT_MASK){ + translationX = RIGHT_TURN_HORIZONTAL_SECTION_HEIGHT / 2; + translationY = 0; + canvas.translate(translationX, translationY); + canvas.drawBitmap(rightTwoTurnArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + canvas.restore(); + + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + } + + //右前方图元 + public BitmapInfo getRenderRightFrontTurnLaneArrow(boolean isW) + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + int typemask = 0x10; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + if(isW) + paint.setColor(Color.WHITE); + else + paint.setColor(Color.GREEN); + paint.setStyle(Style.STROKE); + paint.setStrokeWidth(RIGHT_TURN_VERTICAL_SECTION_WIDTH); + paint.setAntiAlias(true); + + float startX = LANE_WIDTH / 3; + float startY = LANE_HEIGHT - LANE_HEIGHT / 4; + float endX = startX; + float endY = startY - RIGHT_TURN_VERTICAL_SECTION_HEIGHT; + + canvas.drawLine(startX, startY, endX, endY, paint); + + paint.setStyle(Style.FILL); + + Path path = new Path(); + path.moveTo(endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2, endY); + path.lineTo(endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2, endY + RIGHT_FRONT_TURN_SLOPE_THICKNESS); + path.lineTo(endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2 + RIGHT_FRONT_TURN_SLOPE_WIDTH, endY); + path.lineTo(endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2 + RIGHT_FRONT_TURN_SLOPE_WIDTH, endY - RIGHT_FRONT_TURN_SLOPE_THICKNESS); + + canvas.drawPath(path, paint); + + Bitmap triangleImage = getRenderTriangleImage(isW).bitmap; + float translationX = endX - RIGHT_TURN_VERTICAL_SECTION_WIDTH / 2 + RIGHT_FRONT_TURN_SLOPE_WIDTH + TRIANGLE_IMAGE_HEIGHT; + float translationY = endY - RIGHT_FRONT_TURN_SLOPE_THICKNESS / 2; + canvas.save(); + canvas.translate(translationX, translationY); + canvas.rotate(90); + canvas.drawBitmap(triangleImage, -(triangleImage.getWidth() / 2), 0, paint); + canvas.restore(); + + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + + } + + //左前方图元 + public BitmapInfo getRenderLeftFrontTurnLaneArrow(boolean isW) + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + int typemask = 0x4; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + if(isW) + paint.setColor(Color.WHITE); + else + paint.setColor(Color.GREEN); + paint.setStyle(Style.STROKE); + paint.setStrokeWidth(LEFT_TURN_VERTICAL_SECTION_WIDTH); + paint.setAntiAlias(true); + + int startX = LANE_WIDTH - LANE_WIDTH / 3; + int startY = LANE_HEIGHT - LANE_HEIGHT / 4; + int endX = startX; + int endY = startY - LEFT_TURN_VERTICAL_SECTION_HEIGHT; + + canvas.drawLine(startX, startY, endX, endY, paint); + paint.setStyle(Style.FILL); + + Path path = new Path(); + path.moveTo(endX + LEFT_TURN_VERTICAL_SECTION_WIDTH / 2, endY); + path.lineTo(endX + LEFT_TURN_VERTICAL_SECTION_WIDTH / 2, endY + LEFT_FRONT_TURN_SLOPE_THICKNESS); + path.lineTo(endX + LEFT_TURN_VERTICAL_SECTION_WIDTH / 2 - LEFT_FRONT_TURN_SLOPE_WIDTH, endY); + path.lineTo(endX + LEFT_TURN_VERTICAL_SECTION_WIDTH / 2 - LEFT_FRONT_TURN_SLOPE_WIDTH, endY - LEFT_FRONT_TURN_SLOPE_THICKNESS); + + canvas.drawPath(path, paint); + + Bitmap triangleImage = getRenderTriangleImage(isW).bitmap; + int translationX = endX + LEFT_TURN_VERTICAL_SECTION_WIDTH / 2 - LEFT_FRONT_TURN_SLOPE_WIDTH - TRIANGLE_IMAGE_HEIGHT; + int translationY = endY - LEFT_FRONT_TURN_SLOPE_THICKNESS / 2; + canvas.save(); + canvas.translate(translationX, translationY); + canvas.rotate(-90); + canvas.drawBitmap(triangleImage, -(triangleImage.getWidth() / 2), 0, paint); + canvas.restore(); + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + } + + //左转 + 调头 + public BitmapInfo getRenderLeftFrontTurnAddUTurnLaneArrow(int isW) + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + int typemask = 0x82; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + paint.setColor(Color.WHITE); + paint.setStyle(Style.STROKE); + paint.setStrokeWidth(LEFT_TURN_VERTICAL_SECTION_WIDTH); + paint.setAntiAlias(true); + + Bitmap leftFrontTurnLaneArrow = getRenderLeftFrontTurnLaneArrow(isW == LEFT_TWO_BIT_MASK?false : true).bitmap; + Bitmap UTurnLaneArrow = getRenderUTurnLaneArrow(isW == UTURN_BIT_MASK?false : true).bitmap; + + int translationX = 0; + int translationY = LANE_HEIGHT / 4; + canvas.save(); + if(isW != UTURN_BIT_MASK) + { + canvas.translate(translationX, translationY); + canvas.drawBitmap(UTurnLaneArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + if(isW != LEFT_TWO_BIT_MASK) + { + translationX = 0; + translationY = -(LANE_HEIGHT / 8); + canvas.translate(translationX, translationY); + canvas.drawBitmap(leftFrontTurnLaneArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + if(isW == UTURN_BIT_MASK) + { + translationX = 0; + translationY = LANE_HEIGHT / 4; + canvas.translate(translationX, translationY); + canvas.drawBitmap(UTurnLaneArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + else if(isW == LEFT_TWO_BIT_MASK) + { + translationX = 0; + translationY = -(LANE_HEIGHT / 8); + canvas.translate(translationX, translationY); + canvas.drawBitmap(leftFrontTurnLaneArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + canvas.restore(); + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + } + + //右转 + 调头 + public BitmapInfo getRenderRightFrontTurnAddUTurnLaneArrow(int isW) + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + int typemask = 0xA0; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Bitmap UTurnLaneArrow = getRenderUTurnLaneArrow(isW == UTURN_BIT_MASK ? false : true).bitmap; + Bitmap rightFrontTurnLaneArrow = getRenderRightFrontTurnLaneArrow(isW == RIGHT_TWO_BIT_MASK ? false : true).bitmap; + Paint paint = new Paint(); + paint.setColor(Color.WHITE); + paint.setStyle(Style.STROKE); + paint.setStrokeWidth(RIGHT_TURN_VERTICAL_SECTION_WIDTH); + paint.setAntiAlias(true); + + float translationX = -ARC_RADIUS; + float translationY = LANE_HEIGHT / 4; + canvas.save(); + if(isW != UTURN_BIT_MASK) + { + canvas.translate(translationX, translationY); + canvas.drawBitmap(UTurnLaneArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + if(isW != RIGHT_TWO_BIT_MASK) + { + translationX = RIGHT_FRONT_TURN_SLOPE_WIDTH / 2; + translationY = -(LANE_HEIGHT / 8); + canvas.translate(translationX, translationY); + canvas.drawBitmap(rightFrontTurnLaneArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + if(isW == UTURN_BIT_MASK) + { + translationX = -ARC_RADIUS; + translationY = LANE_HEIGHT / 4; + canvas.translate(translationX, translationY); + canvas.drawBitmap(UTurnLaneArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + else if(isW == RIGHT_TWO_BIT_MASK) + { + translationX = RIGHT_FRONT_TURN_SLOPE_WIDTH / 2; + translationY = -(LANE_HEIGHT / 8); + canvas.translate(translationX, translationY); + canvas.drawBitmap(rightFrontTurnLaneArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + canvas.restore(); + + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + } + + //直行 + 左转 + 右转ֱ�� + ��ת + ��ת + public BitmapInfo getRenderStraightAddLeftRightTurnLaneArrow(int isW) + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + int typemask = 0x2A; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + Paint paint = new Paint(); + paint.setColor(Color.WHITE); + paint.setStyle(Style.STROKE); + paint.setStrokeWidth(STRAIGHT_SECTION_WIDTH); + paint.setAntiAlias(true); + + Bitmap straightLaneArrow = getRenderStraightLaneArrow(isW).bitmap; + Bitmap leftFrontTurnArrow = getRenderLeftFrontTurnLaneArrow(isW == LEFT_TWO_BIT_MASK ? false : true).bitmap; + Bitmap RightFrontTurnArrow = getRenderRightFrontTurnLaneArrow(isW == RIGHT_TWO_BIT_MASK ? false : true).bitmap; + int translationX = -(LEFT_FRONT_TURN_SLOPE_WIDTH / 2); + int translationY = LANE_HEIGHT / 6; + canvas.save(); + + if(isW != LEFT_TWO_BIT_MASK) + { + canvas.translate(translationX, translationY); + canvas.drawBitmap(leftFrontTurnArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + if(isW != RIGHT_TWO_BIT_MASK) + { + translationX = RIGHT_FRONT_TURN_SLOPE_WIDTH / 2; + translationY = LANE_HEIGHT / 6; + canvas.translate(translationX, translationY); + canvas.drawBitmap(RightFrontTurnArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + if(isW != AHEAD_BIT_MASK) + { + translationX = 0; + translationY = 0; + canvas.translate(translationX, translationY); + canvas.drawBitmap(straightLaneArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + if(isW == LEFT_TWO_BIT_MASK) + { + translationX = -(LEFT_FRONT_TURN_SLOPE_WIDTH / 2); + translationY = LANE_HEIGHT / 6; + canvas.translate(translationX, translationY); + canvas.drawBitmap(leftFrontTurnArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + }else if(isW == RIGHT_TWO_BIT_MASK) + { + translationX = RIGHT_FRONT_TURN_SLOPE_WIDTH / 2; + translationY = LANE_HEIGHT / 6; + canvas.translate(translationX, translationY); + canvas.drawBitmap(RightFrontTurnArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + }else if(isW == AHEAD_BIT_MASK) + { + translationX = 0; + translationY = 0; + canvas.translate(translationX, translationY); + canvas.drawBitmap(straightLaneArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + } + + canvas.restore(); + + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + } + + //直行 + 调头 + public BitmapInfo getRenderStraightAddUTurnLaneArrow(int type) + { + int width = LANE_WIDTH; + int height = LANE_HEIGHT; + int typemask = 0x88; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Canvas canvas = new Canvas(bitmap); + + Paint paint = new Paint(); + paint.setColor(Color.WHITE); + paint.setStyle(Style.STROKE); + paint.setStrokeWidth(STRAIGHT_SECTION_WIDTH); + paint.setAntiAlias(true); + + Bitmap straightLaneArrow = getRenderStraightLaneArrow(type).bitmap; + Bitmap UTurnLaneArrow = getRenderUTurnLaneArrow(type == UTURN_BIT_MASK ? false : true).bitmap; + + int translationX = -ARC_RADIUS; + int translationY = LANE_HEIGHT / 4; + + if(type != UTURN_BIT_MASK) + { + canvas.save(); + canvas.translate(translationX, translationY); + canvas.drawBitmap(UTurnLaneArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + translationX = 0; + translationY = 0; + canvas.translate(translationX, translationY); + canvas.drawBitmap(straightLaneArrow, 0, 0, paint); + canvas.restore(); + }else + { + canvas.save(); + translationX = 0; + translationY = 0; + canvas.translate(translationX, translationY); + canvas.drawBitmap(straightLaneArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + translationX = -ARC_RADIUS; + translationY = LANE_HEIGHT / 4; + canvas.translate(translationX, translationY); + canvas.drawBitmap(UTurnLaneArrow, 0, 0, paint); + canvas.translate(-translationX, -translationY); + canvas.restore(); + } + + + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + } + + //车道图背景板 + public BitmapInfo getPanelImage(int width,int height) + { +// int width = PANEL_IMAGE_WIDTH; +// int height = PANEL_IMAGE_HEIGHT; + int typemask = 0x88; + int m_iLanePanelBorderMargin = LANE_PANELBORDER_MARGIN; + int m_iLanePanelBorderRadian = LANE_PANELBORDER_RADIAN; + + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + Paint paint = new Paint(); + paint.setARGB(255, 8, 72, 152); + Canvas canvas = new Canvas(bitmap); + canvas.drawPaint(paint); + + paint.setColor(Color.WHITE); + paint.setStrokeWidth(5); + paint.setStyle(Style.STROKE); + paint.setAntiAlias(true); + + RectF rect = new RectF(); + rect.set(LANE_PANELBORDER_MARGIN, + LANE_PANELBORDER_MARGIN, + width - LANE_PANELBORDER_MARGIN, + height - LANE_PANELBORDER_MARGIN); + + canvas.drawRoundRect(rect, LANE_PANELBORDER_RADIAN, LANE_PANELBORDER_RADIAN, paint); + + BitmapInfo info = new BitmapInfo(); + info.bitmap = bitmap; + info.width = width; + info.height = height; + + return info; + } + + //使用LaneMask信息,拼接完整车道图 + public Bitmap getComposeLaneInfo(LaneMask info) + { + if(info == null || info.m_iSzie == 0) + return null; + //info.m_iSzie 有几条道路 + int composeBitmapWidth = (info.m_iSzie * LANE_WIDTH) + + (info.m_iSzie - 1) * DASH_STRIPS_IMAGE_WIDTH + + SOLID_STRIPS_IMAGE_WIDTH * 2 + + ROAD_BOUNDARY_MARGIN * 2 + + (LANE_PANELBORDER_MARGIN * 4); + + Bitmap bitmap = Bitmap.createBitmap(composeBitmapWidth,PANEL_IMAGE_HEIGHT,Config.ARGB_8888); + + //获取车道图背景板 + BitmapInfo panelImage = getPanelImage(composeBitmapWidth,PANEL_IMAGE_HEIGHT); + //获取车道分隔线图元 + BitmapInfo dashStripsImage = getRenderDashStripsImage(true); + //获取道路边界线图元 + BitmapInfo solidStripsImage = getRenderSolidStripsImage(true); + + Canvas canvas = new Canvas(panelImage.bitmap); + Paint paint = new Paint(); + + int positionX = 0; + int positionY = 0; + canvas.save(); + positionY = LANE_PANELBORDER_MARGIN * 2; + canvas.translate(positionX, positionY); + positionY = 0; + + positionX = LANE_PANELBORDER_MARGIN * 2 + ROAD_BOUNDARY_MARGIN; + canvas.translate(positionX, positionY); + + canvas.drawBitmap(solidStripsImage.bitmap, 0, 0, paint); + positionX = SOLID_STRIPS_IMAGE_WIDTH; + canvas.translate(positionX, positionY); + + for(int i = 0; i < info.m_iSzie -1; i++){ + + BitmapInfo bitmapMask = null; + LaneMarkInfo mark = info.m_nLaneMark.get(i); + bitmapMask = getPanelBitMap(mark,info.isHighLightID); + + canvas.drawBitmap(bitmapMask.bitmap, 0, 0, paint); + positionX = bitmapMask.width; + canvas.translate(positionX, positionY); + canvas.drawBitmap(dashStripsImage.bitmap, 0, 0, paint); + positionX = dashStripsImage.width ; + canvas.translate(positionX, positionY); + } + + LaneMarkInfo infoLast = info.m_nLaneMark.get(info.m_iSzie -1); + BitmapInfo lastInfo = getPanelBitMap(infoLast,info.isHighLightID ); + + canvas.drawBitmap(lastInfo.bitmap, 0, 0, paint); + positionX = lastInfo.width; + canvas.translate(positionX, positionY); + canvas.drawBitmap(solidStripsImage.bitmap, 0, 0, paint); + + canvas.restore(); + + return panelImage.bitmap; + } + + class BitmapInfo + { + Bitmap bitmap ; + int width; + int height; + int status; + } + public BitmapInfo getPanelBitMap(LaneMarkInfo mark,int highType) + { + BitmapInfo bitmap = null; + if(mark.isAhead && mark.isLeftTwo && mark.isRightTwo) + { + //获取 "直行 + 左转 + 右转" 车道箭头图元 + bitmap = getRenderStraightAddLeftRightTurnLaneArrow(highType); + }else if(mark.isUTurn && mark.isAhead) + { + //获取 "直行 + 调头"车道箭头图元 + bitmap = getRenderStraightAddUTurnLaneArrow(highType); + }else if(mark.isUTurn && mark.isLeftOne) + { + //TODO... + }else if(mark.isUTurn && mark.isLeftThree) + { + //TODO... + }else if(mark.isUTurn && mark.isLeftTwo) + { + //获取 "调头 + 左转" 车道箭头图元 + bitmap = getRenderLeftFrontTurnAddUTurnLaneArrow(highType); + }else if(mark.isUTurn && mark.isRightTwo) + { + //获取 "调头 + 右转" 车道箭头图元 + bitmap = getRenderRightFrontTurnAddUTurnLaneArrow(highType); + }else if(mark.isAhead && mark.isLeftOne) + { + //TODO... + }else if(mark.isAhead && mark.isLeftTwo) + { + //获取 "直行 + 左转" 车道箭头图元 + bitmap = getRenderStraightAddLeftTwoTurnLaneArrow(highType); + }else if(mark.isAhead && mark.isLeftThree) + { + //TODO... + }else if(mark.isAhead && mark.isRightOne) + { + //TODO... + }else if(mark.isAhead && mark.isRightTwo) + { + //获取 "直行 + 右转" 车道箭头图元 + bitmap = getRenderStraightAddRightTwoTurnLaneArrow(highType); + }else if(mark.isLeftTwo && mark.isRightTwo) + { + //获取 "左转 + 右转" 车道箭头图元 + bitmap = getRenderLeftTwoTurnAddRightTwoTurnLaneArrow(highType); + }else if(mark.isAhead && mark.isRightThree) + { + //TODO... + }else if(mark.isRightTwo) + { + //获取 "右转" 车道箭头图元 + bitmap = getRenderRightTwoTurnLaneArrow(highType); + }else if(mark.isLeftTwo) + { + //获取 "左转" 车道箭头图元 + bitmap = getRenderLeftTwoTurnLaneArrow(highType); + }else if(mark.isAhead) + { + //获取 "直行" 车道箭头图元 + bitmap = getRenderStraightLaneArrow(highType); + }else if(mark.isUTurn) + { + //获取 "调头" 车道箭头图元 + bitmap = getRenderUTurnLaneArrow(highType == UTURN_BIT_MASK ? false : true); + } + + return bitmap; + } + + public void drawNinepath(Canvas c, Bitmap bmp,RectF r1){ + NinePatch patch = new NinePatch(bmp, bmp.getNinePatchChunk(), null); + patch.draw(c, r1); + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/LaneMask.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/LaneMask.java new file mode 100644 index 0000000000..3d96d6c835 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/LaneMask.java @@ -0,0 +1,75 @@ +package com.autonavi.nge.guidance; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.ArrayList; +import java.util.List; + +public class LaneMask implements Parcelable{ + + public static final Creator CREATOR = new Creator() { + public LaneMask createFromParcel(Parcel in) { + int size = in.readByte(); + int hight = in.readByte(); + List item = (ArrayList)(in.readArrayList(LaneMarkInfo.class.getClassLoader())); + return new LaneMask(size, hight, item); + } + + public LaneMask[] newArray(int size) { + return new LaneMask[size]; + } + }; + + + int m_iSzie; + List m_nLaneMark = new ArrayList(); + int isHighLightID = 0; + + public LaneMask() + {} + + public LaneMask(int size,int highID,List info) + { + m_iSzie = size; + isHighLightID = highID; + m_nLaneMark = info; + } + + @Override + public int describeContents() { + + return 0; + } + @Override + public void writeToParcel(Parcel out, int flags) { + + out.writeByte((byte) m_iSzie); + out.writeByte((byte) isHighLightID); + out.writeList(m_nLaneMark); + } + + public int getM_iSzie() { + return m_iSzie; + } + + public void setM_iSzie(int m_iSzie) { + this.m_iSzie = m_iSzie; + } + + public List getM_nLaneMark() { + return m_nLaneMark; + } + + public void setM_nLaneMark(List m_nLaneMark) { + this.m_nLaneMark = m_nLaneMark; + } + + public int getIsHighLightID() { + return isHighLightID; + } + + public void setIsHighLightID(int isHighLightID) { + this.isHighLightID = isHighLightID; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/NaviDirRes.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/NaviDirRes.java new file mode 100644 index 0000000000..5e3ab5134b --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/NaviDirRes.java @@ -0,0 +1,134 @@ +package com.autonavi.nge.guidance; + + +import com.zhidaoauto.map.sdk.R; + +public class NaviDirRes { + private static int m_idirNum = 50; + private static int[] m_idirID = new int[m_idirNum]; + private static int[] m_iresID = new int[m_idirNum]; + private static int[] m_iNaviResID = new int[m_idirNum]; + + static { + int i = 0; + m_idirID[i] = 1; + m_iresID[i] = R.mipmap.icon1001; + m_iNaviResID[i++] = R.mipmap.navi_s_1; + m_idirID[i] = 2; + m_iresID[i] = R.mipmap.icon1002; + m_iNaviResID[i++] = R.mipmap.navi_s_2; + m_idirID[i] = 3; + m_iresID[i] = R.mipmap.icon1003; + m_iNaviResID[i++] = R.mipmap.navi_s_3; + m_idirID[i] = 4; + m_iresID[i] = R.mipmap.icon1004; + m_iNaviResID[i++] = R.mipmap.navi_s_4; + m_idirID[i] = 5; + m_iresID[i] = R.mipmap.icon1005; + m_iNaviResID[i++] = R.mipmap.navi_s_5; + m_idirID[i] = 6; + m_iresID[i] = R.mipmap.icon1006; + m_iNaviResID[i++] = R.mipmap.navi_s_6; + m_idirID[i] = 7; + m_iresID[i] = R.mipmap.icon1007; + m_iNaviResID[i++] = R.mipmap.navi_s_7; + m_idirID[i] = 8; + m_iresID[i] = R.mipmap.icon1008; + m_iNaviResID[i++] = R.mipmap.navi_s_8; + m_idirID[i] = 9; + m_iresID[i] = R.mipmap.icon1009; + m_iNaviResID[i++] = R.mipmap.navi_s_9; + m_idirID[i] = 10; + m_iresID[i] = R.mipmap.icon1010; + m_iNaviResID[i++] = R.mipmap.navi_s_10; + m_idirID[i] = 11; + m_iresID[i] = R.mipmap.icon1011; + m_iNaviResID[i++] = R.mipmap.navi_s_11; + m_idirID[i] = 12; + m_iresID[i] = R.mipmap.icon1012; + m_iNaviResID[i++] = R.mipmap.navi_s_12; + m_idirID[i] = 13; + m_iresID[i] = R.mipmap.icon1013; + m_iNaviResID[i++] = R.mipmap.navi_s_13; + m_idirID[i] = 14; + m_iresID[i] = R.mipmap.icon1014; + m_iNaviResID[i++] = R.mipmap.navi_s_14; + m_idirID[i] = 15; + m_iresID[i] = R.mipmap.icon1015; + m_iNaviResID[i++] = R.mipmap.navi_s_15; + m_idirID[i] = 22; + m_iresID[i] = R.mipmap.icon1022; + m_iNaviResID[i++] = R.mipmap.navi_s_22; + m_idirID[i] = 27; + m_iresID[i] = R.mipmap.icon1027; + m_iNaviResID[i++] = R.mipmap.navi_s_27; + m_idirID[i] = 28; + m_iresID[i] = R.mipmap.icon1028; + m_iNaviResID[i++] = R.mipmap.navi_s_28; + m_idirID[i] = 29; + m_iresID[i] = R.mipmap.icon1029; + m_iNaviResID[i++] = R.mipmap.navi_s_29; + /*m_idirID[i] = 30; + m_iresID[i] = R.mipmap.icon1030; + */ + m_idirID[i] = 35; + m_iresID[i] = R.mipmap.icon1035; + m_iNaviResID[i++] = R.mipmap.navi_s_35; + m_idirID[i] = 42; + m_iresID[i] = R.mipmap.icon1042; + m_iNaviResID[i++] = R.mipmap.navi_s_42; + m_idirID[i] = 43; + m_iresID[i] = R.mipmap.icon1043; + m_iNaviResID[i++] = R.mipmap.navi_s_43; + m_idirID[i] = 44; + m_iresID[i] = R.mipmap.icon1044; + m_iNaviResID[i++] = R.mipmap.navi_s_44; + /*m_idirID[i] = 45; + m_iresID[i] = R.mipmap.icon1045;*/ + m_idirID[i] = 501; + m_iresID[i] = R.mipmap.icon1501; + m_iNaviResID[i++] = R.mipmap.navi_s_501; + m_idirID[i] = 502; + m_iresID[i] = R.mipmap.icon1502; + m_iNaviResID[i++] = R.mipmap.navi_s_502; + m_idirID[i] = 503; + m_iresID[i] = R.mipmap.icon1503; + m_iNaviResID[i++] = R.mipmap.navi_s_503; + + } + + public static int getNextNaviResID(int nID) + { + + for (int i = 0; i < m_idirID.length; i++) { + if (m_idirID[i] == nID) { + return m_iresID[i]; + } + } + return R.mipmap.icon1001; + + } + + public static int getNaviResID(int nID) + { + for (int i = 0; i < m_idirID.length; i++) { + if (m_idirID[i] == nID) { + return m_iNaviResID[i]; + } + } + return R.mipmap.navi_s_1; + } + /** + * @param nID + * @return + */ + public static int getResID(int nID) { + for (int i = 0; i < m_idirID.length; i++) { + if (m_idirID[i] == nID) { + return m_iresID[i]; + } + } + + return R.mipmap.icon1001; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/NaviInfo.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/NaviInfo.java new file mode 100644 index 0000000000..0d55aeb296 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/NaviInfo.java @@ -0,0 +1,204 @@ +package com.autonavi.nge.guidance; + +import android.os.Parcel; +import android.os.Parcelable; + +public class NaviInfo implements Parcelable { + + public static final Creator CREATOR = new Creator() { + public NaviInfo createFromParcel(Parcel in) { + int nDistanceToDest = in.readInt(); + int nTimeToDest = in.readInt(); + int nDistanceToTurn = in.readInt(); + int nDistanceToNextTurn = in.readInt(); + int nTurnID = in.readInt(); + int nNextTurnID = in.readInt(); + int lon = in.readInt(); + int lat = in.readInt(); + int imageur = in.readInt(); + int imagebg = in.readInt(); + int imagearrow = in.readInt(); + byte imagetype = in.readByte(); + int sgpimageur = in.readInt(); + int sgpimagebg = in.readInt(); + int sgpimagearrow = in.readInt(); + byte sgpimagetype = in.readByte(); + String pStrCurName = in.readString(); + String pStrNextName = in.readString(); + int speed = in.readInt(); + byte laneType = in.readByte(); + short angle = (short) in.readInt(); + byte export = in.readByte(); + byte status = in.readByte(); + int entrance = in.readInt(); + int server = in.readInt(); + int exit = in.readInt(); + String servername = in.readString(); + String exitname = in.readString(); + String entrancename = in.readString(); + + return new NaviInfo(nDistanceToDest, nTimeToDest, nDistanceToTurn, nDistanceToNextTurn, nTurnID, nNextTurnID, lon, lat, imageur, + imagebg, imagearrow, imagetype, sgpimageur, sgpimagebg, sgpimagearrow, sgpimagetype, pStrCurName, + pStrNextName, speed, laneType, angle, export, status, entrance, server, exit, servername, exitname, entrancename); + } + + public NaviInfo[] newArray(int size) { + return new NaviInfo[size]; + } + }; + + public byte m_nNaviStatus;//导航状态 + public int m_nDistanceToDest;//到达目的地的距离 + public int m_nTimeToDest;//到达目的地的时间 + public int m_nDistanceToTurn;//距离转向点距离 + public int m_nDistanceToNextTurn;//距离下一个转向点距离 + public int m_nTurnID;//转向点图标id + public int m_nNextTurnID; //下一转向点图标id + + public int m_nBindLon; //绑定点经度 + public int m_nBindLat; //绑定点纬度 + + public int m_nSpeed; //速度 + + public int m_nImageUr; //UR id, 省 + public int m_nImageBg; //背景id + public int m_nImageArrow;//箭头id + public byte m_nImageType;//是否显示 0 不显示 1 显示 + + public int m_nSGPImageUr;//方向看板 UR id + public int m_nSGPImageBg;//方向看板 背景id + public int m_nSGPImageArrow;//方向看板 箭头id + public byte m_nSGPImageType;//方向看板 是否显示 + + public String m_pStrCurName;//当前路名 + public String m_pStrNextName;//下一条路名 + + public byte m_LaneType; //车道标记 + + public short m_Angle; //车头角度 + + public byte m_IsExport; //是否是出口 + public int m_ServerDist; //服务区距离 + public int m_EntranceDist; //入口距离 + public int m_ExitDist; //出口距离 + + public String m_ServerName; //服务器名称 + public String m_ExitName; //出口名称 + public String m_EntranceName;//入口名称 + public int m_nNextTurn; //第二个路口转向是否显示 0 不显示 1 显示 + + public NaviInfo() { + } + + + + public NaviInfo(int disTodest, int time, int disToturn, int disToNextTurn, int turnID, int nextruenID, int bindlon, int bindlat, int imageur, int imagebg, int imagearrow, byte imagetype, + int sgpimageur, int sgpimagebg, int sgpimagearrow, byte sgpimagetype, String curName, String nextName, + int speed, byte lane, short angle, byte export, byte status, int entrance, int server, int exit, String servername, String exitname, String enterfacename) { + m_nDistanceToDest = disTodest; + m_nTimeToDest = time; + m_nDistanceToTurn = disToturn; + m_nDistanceToNextTurn = disToNextTurn; + m_nTurnID = turnID; + m_pStrCurName = curName; + m_pStrNextName = nextName; + m_nBindLon = bindlon; + m_nBindLat = bindlat; + m_nImageUr = imageur; + m_nImageBg = imagebg; + m_nImageArrow = imagearrow; + m_nImageType = imagetype; + m_nSGPImageUr = sgpimageur; + m_nSGPImageBg = sgpimagebg; + m_nSGPImageArrow = sgpimagearrow; + m_nSGPImageType = sgpimagetype; + m_nNextTurnID = nextruenID; + m_nSpeed = speed; + m_LaneType = lane; + m_Angle = angle; + m_IsExport = export; + m_nNaviStatus = status; + m_ServerDist = server; + m_EntranceDist = entrance; + m_ExitDist = exit; + + m_ServerName = servername; + m_ExitName = exitname; + m_EntranceName = enterfacename; + } + + @Override + public int describeContents() { + + return 0; + } + + @Override + public void writeToParcel(Parcel out, int flags) { + + out.writeInt(m_nDistanceToDest); + out.writeInt(m_nTimeToDest); + out.writeInt(m_nDistanceToTurn); + out.writeInt(m_nDistanceToNextTurn); + out.writeInt(m_nTurnID); + out.writeInt(m_nNextTurnID); + out.writeInt(m_nBindLon); + out.writeInt(m_nBindLat); + out.writeInt(m_nImageUr); + out.writeInt(m_nImageBg); + out.writeInt(m_nImageArrow); + out.writeByte(m_nImageType); + out.writeInt(m_nSGPImageUr); + out.writeInt(m_nSGPImageBg); + out.writeInt(m_nSGPImageArrow); + out.writeByte(m_nSGPImageType); + out.writeString(m_pStrCurName); + out.writeString(m_pStrNextName); + out.writeInt(m_nSpeed); + out.writeByte(m_LaneType); + out.writeInt(m_Angle); + out.writeByte(m_IsExport); + out.writeByte(m_nNaviStatus); + out.writeInt(m_EntranceDist); + out.writeInt(m_ServerDist); + out.writeInt(m_ExitDist); + out.writeString(m_ServerName); + out.writeString(m_ExitName); + out.writeString(m_EntranceName); + } + + @Override + public String toString() { + return "NaviInfo{" + + "m_nNaviStatus=" + m_nNaviStatus + + ", m_nDistanceToDest=" + m_nDistanceToDest + + ", m_nTimeToDest=" + m_nTimeToDest + + ", m_nDistanceToTurn=" + m_nDistanceToTurn + + ", m_nDistanceToNextTurn=" + m_nDistanceToNextTurn + + ", m_nTurnID=" + m_nTurnID + + ", m_nNextTurnID=" + m_nNextTurnID + + ", m_nBindLon=" + m_nBindLon + + ", m_nBindLat=" + m_nBindLat + + ", m_nSpeed=" + m_nSpeed + + ", m_nImageUr=" + m_nImageUr + + ", m_nImageBg=" + m_nImageBg + + ", m_nImageArrow=" + m_nImageArrow + + ", m_nImageType=" + m_nImageType + + ", m_nSGPImageUr=" + m_nSGPImageUr + + ", m_nSGPImageBg=" + m_nSGPImageBg + + ", m_nSGPImageArrow=" + m_nSGPImageArrow + + ", m_nSGPImageType=" + m_nSGPImageType + + ", m_pStrCurName='" + m_pStrCurName + '\'' + + ", m_pStrNextName='" + m_pStrNextName + '\'' + + ", m_LaneType=" + m_LaneType + + ", m_Angle=" + m_Angle + + ", m_IsExport=" + m_IsExport + + ", m_ServerDist=" + m_ServerDist + + ", m_EntranceDist=" + m_EntranceDist + + ", m_ExitDist=" + m_ExitDist + + ", m_ServerName='" + m_ServerName + '\'' + + ", m_ExitName='" + m_ExitName + '\'' + + ", m_EntranceName='" + m_EntranceName + '\'' + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/RouteBook.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/RouteBook.java new file mode 100644 index 0000000000..93b686a734 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/RouteBook.java @@ -0,0 +1,60 @@ +package com.autonavi.nge.guidance; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.ArrayList; +import java.util.List; + +public class RouteBook implements Parcelable{ + + public static final Creator CREATOR = new Creator() { + public RouteBook createFromParcel(Parcel in) { + int totalLength = in.readInt(); + int totalTime = in.readInt(); + int itemLength = in.readInt(); + List item = (ArrayList)(in.readArrayList(RouteBookItem.class.getClassLoader())); + return new RouteBook(totalLength, totalTime, itemLength, item); + } + + public RouteBook[] newArray(int size) { + return new RouteBook[size]; + } + }; + + public int totalLength; + public int totalTime; + public int itemSize; + public List bookdata = new ArrayList(); + + public RouteBook(int totalLength,int totalTime,int itemSize,List items) + { + this.totalLength = totalLength; + this.totalTime = totalTime; + this.itemSize = itemSize; + this.bookdata = items; + } + @Override + public int describeContents() { + + return 0; + } + @Override + public void writeToParcel(Parcel out, int paramInt) { + + out.writeInt(totalLength); + out.writeInt(totalTime); + out.writeInt(itemSize); + out.writeList(bookdata); + } + + @Override + public String toString() { + return "RouteBook{" + + "totalLength=" + totalLength + + ", totalTime=" + totalTime + + ", itemSize=" + itemSize + + ", bookdata=" + bookdata + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/RouteBookAdapter.kt b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/RouteBookAdapter.kt new file mode 100644 index 0000000000..8bd3267734 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/RouteBookAdapter.kt @@ -0,0 +1,58 @@ +package com.autonavi.nge.guidance + +import android.util.Log +import android.view.View +import android.widget.ImageView +import android.widget.LinearLayout +import android.widget.TextView +import com.chad.library.adapter.base.BaseQuickAdapter +import com.chad.library.adapter.base.viewholder.BaseViewHolder +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.inner.CompileConfig +import java.text.DecimalFormat + +class RouteBookAdapter : BaseQuickAdapter(R.layout.routebook_child_item) { + + private val TAG = javaClass.simpleName + + + override fun getDefItemCount(): Int { + return super.getDefItemCount() + } + + override fun convert(helper: BaseViewHolder, item: RouteBookItem) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "routebookop--helper.adapterPosition:${helper.adapterPosition}") + } + when (helper.adapterPosition) { + 0 -> { + helper.getView(R.id.routebook_child_item_info_ll).visibility = View.VISIBLE + helper.getView(R.id.imgView).setImageResource(NaviDirRes.getResID(501)) + helper.getView(R.id.orientation).text = "从${item.routeName?:"起点"}出发" + helper.getView(R.id.length).visibility = View.GONE + } + else -> { + helper.getView(R.id.orientation).text = item.routeName + helper.getView(R.id.imgView).setImageResource(NaviDirRes.getResID(item.turnID)) + if (item.routeName == "目的地") { + helper.getView(R.id.length).visibility = View.GONE + } else { + helper.getView(R.id.length).visibility = View.VISIBLE + val i = item.routelength + if (i > 1000) { + val df = DecimalFormat("#.0") + val string = df.format(i.toDouble() / 1000) + val strs = string.split(".") + if (strs.size >= 2 && strs[1] == "0") { + helper.getView(R.id.length).text = """继续前行${strs[0]}km${item.routeSpeech}""".trimIndent() + } else { + helper.getView(R.id.length).text = """继续前行${string}km${item.routeSpeech}""".trimIndent() + } + } else { + helper.getView(R.id.length).text = """继续前行${i}m${item.routeSpeech}""".trimIndent() + } + } + } + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/RouteBookItem.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/RouteBookItem.java new file mode 100644 index 0000000000..de0b40a440 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/RouteBookItem.java @@ -0,0 +1,100 @@ +package com.autonavi.nge.guidance; + +import android.os.Parcel; +import android.os.Parcelable; + +public class RouteBookItem implements Parcelable{ + + public static final Creator CREATOR = new Creator() { + public RouteBookItem createFromParcel(Parcel in) { + int titleID = in.readInt(); + int linkid = in.readInt(); + int routelength = in.readInt(); + int routeTime = in.readInt(); + String routeName = in.readString(); + String routeSpeech = in.readString(); + int lon = in.readInt(); + int lat = in.readInt(); + int turnID = in.readInt(); + + return new RouteBookItem(titleID,linkid,routelength,routeTime,routeName,routeSpeech,lon,lat,turnID); + } + + public RouteBookItem[] newArray(int size) { + return new RouteBookItem[size]; + } + }; + public RouteBookItem() + {} + + public RouteBookItem(int titleID,int linkid,int routelength,int routeTime,String routeName, + String routeSpeech,int lon,int lat,int turnID) + { + this.titleID = titleID; + this.linkid = linkid; + this.routelength = routelength; + this.routeTime = routeTime; + this.routeName = routeName; + this.routeSpeech = routeSpeech; + this.lon = lon; + this.lat = lat; + this.turnID = turnID; + } + + public int titleID; + public int linkid; + public int routelength; + public int routeTime; + public String routeName; + public String routeSpeech; + public int lon; + public int lat; + public int turnID; + // 显示使用 + public int type = 0; + @Override + public int describeContents() { + + return 0; + } + @Override + public void writeToParcel(Parcel out, int paramInt) { + + out.writeInt(titleID); + out.writeInt(linkid); + out.writeInt(routelength); + out.writeInt(routeTime); + out.writeString(routeName); + out.writeString(routeSpeech); + out.writeInt(lon); + out.writeInt(lat); + out.writeInt(turnID); + } + + public void readFromParcel(Parcel in) { + titleID = in.readInt(); + linkid = in.readInt(); + routelength = in.readInt(); + routeTime = in.readInt(); + routeName = in.readString(); + routeSpeech = in.readString(); + lon = in.readInt(); + lat = in.readInt(); + turnID = in.readInt(); + } + + @Override + public String toString() { + return "RouteBookItem{" + + "titleID=" + titleID + + ", linkid=" + linkid + + ", routelength=" + routelength + + ", routeTime=" + routeTime + + ", routeName='" + routeName + '\'' + + ", routeSpeech='" + routeSpeech + '\'' + + ", lon=" + lon + + ", lat=" + lat + + ", turnID=" + turnID + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/RouteImage.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/RouteImage.java new file mode 100644 index 0000000000..d417643137 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/guidance/RouteImage.java @@ -0,0 +1,57 @@ +package com.autonavi.nge.guidance; + +import android.os.Parcel; +import android.os.Parcelable; + +public class RouteImage implements Parcelable{ + + public static final Creator CREATOR = new Creator() { + public RouteImage createFromParcel(Parcel in) { + int imageBgID = in.readInt(); + int imageBgSize = in.readInt(); + byte[] imageBg = new byte[imageBgSize]; + in.readByteArray(imageBg); + int imageArrowID = in.readInt(); + int imageArrowSize = in.readInt(); + byte[] imageArrow = new byte[imageArrowSize]; + in.readByteArray(imageArrow); + + return new RouteImage(imageBg, imageArrow); + } + + public RouteImage[] newArray(int size) { + return new RouteImage[size]; + } + }; + + public RouteImage() + {} + public RouteImage(byte[] imageBgs,byte[] imageArrows) + { + imageBg = imageBgs; + imageArrow = imageArrows; + } + + public int imageBgID = 0; + public int imageArrowID = 0; + public byte[] imageBg = new byte[0]; + public byte[] imageArrow = new byte[0]; + @Override + public int describeContents() { + + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + + dest.writeInt(imageBgID); + dest.writeInt(imageBg.length); + dest.writeByteArray(imageBg); + dest.writeInt(imageArrowID); + dest.writeInt(imageArrow.length); + dest.writeByteArray(imageArrow); + } + + +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/HDMapBlock.kt b/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/HDMapBlock.kt new file mode 100644 index 0000000000..dcc5e94184 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/HDMapBlock.kt @@ -0,0 +1,49 @@ +package com.autonavi.nge.hdmap; + +class HDMapBlock { + private var laneNo = 0 + private var routeId = 0 + private var lonLats: ArrayList? = null + private var width = 0f + + fun getLaneNo(): Int { + return laneNo + } + + fun setLaneNo(laneNo: Int) { + this.laneNo = laneNo + } + + fun getRouteId(): Int { + return routeId + } + + fun setRouteId(routeId: Int) { + this.routeId = routeId + } + + fun getLonLats(): ArrayList? { + return lonLats + } + + fun setLonLats(lonLats: ArrayList?) { + this.lonLats = lonLats + } + + fun getWidth(): Float { + return width + } + + fun setWidth(width: Float) { + this.width = width + } + + override fun toString(): String { + return "HDMapBlock{" + + "laneNo=" + laneNo + + ", routeId=" + routeId + + ", lonLats=" + lonLats + + ", width=" + width + + '}' + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/HDMapProvider.kt b/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/HDMapProvider.kt new file mode 100644 index 0000000000..e35e4d45da --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/HDMapProvider.kt @@ -0,0 +1,47 @@ +package com.autonavi.nge.hdmap + +class HDMapProvider { + companion object { + @JvmStatic external fun setDataDir(dataDir: String?) + + /**f:设置数据的源。参数说明: 1,本地文件。非1,redis获取。默认,非1 */ + @JvmStatic external fun setDataFileSource(source: Int) + + /**f:设置redis源。1,测试redis(42)。非1,正式redis(根据域名访问的)。默认,非1 */ + @JvmStatic external fun setDataRedisSource(source: Int) + + init { + System.loadLibrary("hdmap") + } + } + + fun getLaneCenterLine(tileId: Int, routeId: Int): ArrayList? { + return if (mObj != 0L) { + getLaneCenterLineJni(mObj, tileId, routeId) + } else null + } + + fun getTrafficSign(tileId: Int): ArrayList? { + return if (mObj != 0L) { + getTrafficSignJni(mObj, tileId) + } else null + } + + fun release() { + if (mObj != 0L) { + releaseJni(mObj) + mObj = 0 + } + } + private external fun initJni(): Long + private external fun getLaneCenterLineJni(obj: Long, tileId: Int, routeId: Int): ArrayList? + private external fun getTrafficLightJni(obj: Long, tileId: Int, routeId: Int): ArrayList? + private external fun getTrafficLightJni(obj: Long, lon: Double, lat: Double, angle: Float): ArrayList? + private external fun getTrafficSignJni(obj: Long, tileId: Int): ArrayList? + private external fun releaseJni(obj: Long) + private var mObj: Long = 0 + + init { + mObj = initJni() + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/LonLat.kt b/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/LonLat.kt new file mode 100644 index 0000000000..515b2158c2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/LonLat.kt @@ -0,0 +1,29 @@ +package com.autonavi.nge.hdmap; + +class LonLat { + private var lon = 0.0 + private var lat = 0.0 + + fun getLon(): Double { + return lon + } + + fun setLon(lon: Double) { + this.lon = lon + } + + fun getLat(): Double { + return lat + } + + fun setLat(lat: Double) { + this.lat = lat + } + + override fun toString(): String { + return "LonLat{" + + "lon=" + lon + + ", lat=" + lat + + '}' + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/TrafficLight.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/TrafficLight.java new file mode 100644 index 0000000000..4ec0934c4a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/TrafficLight.java @@ -0,0 +1,86 @@ +package com.autonavi.nge.hdmap; + +import java.util.ArrayList; + +public class TrafficLight { + public TrafficLight() { + + } + + private int tileId; + private int roadId; + private int type; + private ArrayList laneNo; + private int shape; + private LonLat start; + private LonLat end; + + public int getTileId() { + return tileId; + } + + public void setTileId(int tileId) { + this.tileId = tileId; + } + + public int getRoadId() { + return roadId; + } + + public void setRoadId(int roadId) { + this.roadId = roadId; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public ArrayList getLaneNo() { + return laneNo; + } + + public void setLaneNo(ArrayList laneNo) { + this.laneNo = laneNo; + } + + public int getShape() { + return shape; + } + + public void setShape(int shape) { + this.shape = shape; + } + + public LonLat getStart() { + return start; + } + + public void setStart(LonLat start) { + this.start = start; + } + + public LonLat getEnd() { + return end; + } + + public void setEnd(LonLat end) { + this.end = end; + } + + @Override + public String toString() { + return "TrafficLight{" + + "tileId=" + tileId + + ", roadId=" + roadId + + ", type=" + type + + ", laneNo=" + laneNo + + ", shape=" + shape + + ", start=" + start + + ", end=" + end + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/TrafficSign.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/TrafficSign.java new file mode 100644 index 0000000000..7cb1ede0cd --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/TrafficSign.java @@ -0,0 +1,78 @@ +package com.autonavi.nge.hdmap; + +import java.util.ArrayList; + +public class TrafficSign { + public TrafficSign(){ + } + + private int id; + private int tileId; + private int roadId; + private int type; + private int shape; + private int color; + private int content; + private ArrayList position; + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getTileId() { + return tileId; + } + + public void setTileId(int tileId) { + this.tileId = tileId; + } + + public int getRoadId() { + return roadId; + } + public void setRoadId(int roadId) { + this.roadId = roadId; + } + + public int getType() { + return type; + } + public void setType(int type) { + this.type = type; + } + + public int getShape() { return shape; } + public void setShape(int shape) { this.shape = shape; } + + public int getColor() { return color; } + public void setColor(int color) { this.color = color; } + + public int getContent() { return content; } + public void setContent(int content) { this.content = content; } + + public ArrayList getPosition() { + return position; + } + + public void setPosition(ArrayList position) { + this.position = position; + } + + @Override + public String toString() { + return "TrafficSign{" + + "tileId=" + tileId + + ", roadId=" + roadId + + ", type=" + type + + ", shape=" + shape + + ", color=" + color + + ", content="+ content+ + ", position=" + position + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/TrafficSignPosition.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/TrafficSignPosition.java new file mode 100644 index 0000000000..4e87d128cf --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/hdmap/TrafficSignPosition.java @@ -0,0 +1,43 @@ +package com.autonavi.nge.hdmap; + +public class TrafficSignPosition { + public TrafficSignPosition(){ + + } + private double lon; + private double lat; + private double hight; + + public double getLon() { + return lon; + } + + public void setLon(double lon) { + this.lon = lon; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public double getHight() { + return hight; + } + + public void setHight(double hight) { + this.hight = hight; + } + + @Override + public String toString() { + return "TrafficSignPosition{" + + "lon=" + lon + + ", lat=" + lat + + ", hight=" + hight + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/map/LonLat.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/LonLat.java new file mode 100644 index 0000000000..9d867411a0 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/LonLat.java @@ -0,0 +1,75 @@ +package com.autonavi.nge.map; + +import android.os.Parcel; +import android.os.Parcelable; + +public class LonLat implements Parcelable { + private double lon; + private double lat; + private double alt; + + + public LonLat() { + } + + public LonLat(double lon, double lat) { + this.lon = lon; + this.lat = lat; + } + public LonLat(double lon, double lat, double alt) { + this.lon = lon; + this.lat = lat; + this.alt = alt; + } + + protected LonLat(Parcel in) { + lon = in.readDouble(); + lat = in.readDouble(); + alt = in.readDouble(); + } + + public static final Creator CREATOR = new Creator() { + @Override + public LonLat createFromParcel(Parcel in) { + return new LonLat(in); + } + + @Override + public LonLat[] newArray(int size) { + return new LonLat[size]; + } + }; + + public double getLon() { + return lon; + } + + public double getLat() { + return lat; + } + + public double getAlt() { + return alt; + } + + @Override + public String toString() { + return "LonLat{" + + "lon=" + lon + + ", lat=" + lat + + ", alt=" + alt + + '}'; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeDouble(lon); + dest.writeDouble(lat); + dest.writeDouble(alt); + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapEngine.kt b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapEngine.kt new file mode 100644 index 0000000000..3c29120ff9 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapEngine.kt @@ -0,0 +1,1603 @@ +package com.autonavi.nge.map + +import android.content.res.AssetManager +import android.util.Log + +class MapEngine { + + private val TAG = javaClass.simpleName + + private var mObj: Long = 0 + + fun MapEngine() { + + } + + fun load(dataDir: String, mapView: MapView,assetManager: AssetManager): Boolean { + if (mObj == 0L) { + mObj = loadJni(dataDir, mapView, assetManager) + } + return mObj != 0L + } + + fun render() { + if (mObj != 0L) { + renderJni(mObj) + } + } + + fun resize(newWidth: Int, newHeight: Int) { + if (mObj != 0L) { + resizeJni(mObj, newWidth, newHeight) + } + } + + fun scroll(dx: Float, dy: Float) { + if (mObj != 0L) { + scrollJni(mObj, dx, dy) + } + } + + fun scrollByAnim(dx: Float, dy: Float) { + if (mObj != 0L) { + scrollByAnimJni(mObj, dx, dy) + } + } + + fun setZoomIndex(zoomIndex: Int) { + if (mObj != 0L) { + setZoomIndexJni(mObj, zoomIndex) + } + } + + fun getZoomIndex(): Int { + return if (mObj != 0L) { + getZoomIndexJni(mObj) + } else 0 + } + + fun setZoomValue(zoomValue: Float) { + if (mObj != 0L) { + setZoomValueJni(mObj, zoomValue) + } + } + + fun getZoomValue(): Float { + return if (mObj != 0L) { + getZoomValueJni(mObj) + } else 0.0f + } + + fun zoomIn() { + if (mObj != 0L) { + zoomInJni(mObj) + } + } + + fun zoomOut() { + if (mObj != 0L) { + zoomOutJni(mObj) + } + } + + fun scale(scale: Float) { + if (mObj != 0L) { + scaleJni(mObj, scale) + } + } + + fun scaleByCenter(centerX: Int, centerY: Int, scale: Float) { + if (mObj != 0L) { + scaleByCenterJni(mObj, centerX, centerY, scale) + } + } + + fun rotate(angle: Float) { + if (mObj != 0L) { + rotateJni(mObj, angle) + } + } + + fun lookUpDown(look: Float) { + if (mObj != 0L) { + lookUpDownJni(mObj, look) + } + } + + fun setCenter(lon: Double, lat: Double) { + if (mObj != 0L) { + setCenterJni(mObj, lon, lat) + } + } + + fun getCenter(point: DoubleArray) { + if (mObj != 0L) { + getCenterJni(mObj, point) + } + } + + fun animateTo( + lon: Double, + lat: Double, + alt: Float, + zoom: Float, + rotateAngle: Float, + overlookAngle: Float, + eyeHeight: Float, + duration: Int, + fov: Float + ) { + if (mObj != 0L) { + animateToJni( + mObj, lon, lat, alt, zoom, rotateAngle, overlookAngle, eyeHeight, duration,fov + ) + } + } + + fun setRouteProp(prop: Int, lon: Int, lat: Int) { + if (mObj != 0L) { + setRoutePropJni(mObj, prop, lon, lat) + } + } + + fun drawRoute() { + if (mObj != 0L) { + drawRouteJni(mObj) + } + } + + fun drawNavArrow() { + if (mObj != 0L) { + drawNavArrowJni(mObj) + } + } + + fun getRulerInfo(): Float { + return if (mObj != 0L) { + getRulerInfoJni(mObj) + } else 0.0f + } + + fun showAllRouteLine() { + if (mObj != 0L) { + showAllRouteLineJni(mObj) + } + } + + fun showRouteLine(pOneX: Float, pOneY: Float, pTwoX: Float, pTwoY: Float) { + if (mObj != 0L) { + showRouteLineJni(mObj, pOneX, pOneY, pTwoX, pTwoY) + } + } + + fun addAntCoor(sessionId: Int, lon: Int, lat: Int, time: Int) { + if (mObj != 0L) { + addAntCoorJni(mObj, sessionId, lon, lat, time) + } + } + + fun drawMapMatchedPosition() { + if (mObj != 0L) { + drawMapMatchedPositionJni(mObj) + } + } + + fun drawCar( + lon: Long, + lat: Long, + z: Short, + angle: Short, + scale: Int, + rate: Float, + data: ByteArray?, + len: Int + ) { + if (mObj != 0L) { + drawCarJni(mObj, lon, lat, z, angle, scale, rate, data, len) + } + } + + fun updateCar(lon: Long, lat: Long, z: Short, angle: Short) { + if (mObj != 0L) { + updateCarJni(mObj, lon, lat, z, angle) + } + } + + fun getCarPosition(position: IntArray?): Int { + return if (mObj != 0L) { + getCarPositionJni(mObj, position) + } else 0 + } + + fun setTrafIDStat(locCode: Int, dir: Int, evtCode: Int) { + if (mObj != 0L) { + setTrafIDStatJni(mObj, locCode, dir, evtCode) + } + } + + fun getTrafIDStat(tileId: Int, linkId: Int): Int { + return if (mObj != 0L) { + getTrafIDStatJni(mObj, tileId, linkId) + } else 0 + } + + fun setTraffic(stat: Int) { + if (mObj != 0L) { + setTrafficJni(mObj, stat) + } + } + + fun isTrafficOn(): Boolean { + return if (mObj != 0L) { + isTrafficOnJni(mObj) + } else false + } + + fun commitTrafficStat(locTableCode: Int) { + if (mObj != 0L) { + commitTrafficStatJni(mObj, locTableCode) + } + } + + fun routeSearching(showcnt: Int) { + if (mObj != 0L) { + routeSearchingJni(mObj, showcnt) + } + } + + fun getDAngle(): Float { + return if (mObj != 0L) { + getDAngleJni(mObj) + } else 45.0f + } + + fun setDAngle(angle: Float) { + if (mObj != 0L) { + setDAngleJni(mObj, angle) + } + } + + fun getRotateAngle(): Float { + return if (mObj != 0L) { + getRotateAngleJni(mObj) + } else 0.0f + } + + fun setRotateAngle(angle: Float) { + if (mObj != 0L) { + setRotateAngleJni(mObj, angle) + } + } + + fun setVerticalViewFieldAngle(angle: Float) { + if (mObj != 0L) { + setVerticalViewFieldAngleJni(mObj, angle) + } + } + + fun getVerticalViewFieldAngle(): Float { + return if (mObj != 0L) { + getVerticalViewFieldAngleJni(mObj) + } else 45.0f + } + + fun getEyeHeight(): Float { + return if (mObj != 0L) { + getEyeHeightJni(mObj) + } else 45.0f + } + + fun setEyeHeight(eyeHeight: Float) { + if (mObj != 0L) { + setEyeHeightJni(mObj, eyeHeight) + } + } + + fun clearRouteObjs() { + if (mObj != 0L) { + clearRouteObjsJni(mObj) + } + } + + fun clearRouteSearchedObjs() { + if (mObj != 0L) { + clearRouteSearchedObjsJni(mObj) + } + } + + fun drawSearchResult() { + if (mObj != 0L) { + drawSearchResultJni(mObj) + } + } + + fun clearSearchResult() { + if (mObj != 0L) { + clearSearchResultJni(mObj) + } + } + + fun setMapStyle(styleMode: Int) { + if (mObj != 0L) { + setMapStyleJni(mObj, styleMode) + } + } + + fun getMapStyle(): Int { + return if (mObj != 0L) { + getMapStyleJni(mObj) + } else 1 + } + + fun set3DBuildingVisible(isVisibel: Boolean) { + if (mObj != 0L) { + set3DBuildingVisibleJni(mObj, isVisibel) + } + } + + fun lonlatToPixels(lon: Double, lat: Double): Pixels? { + return if (mObj != 0L) { + lonlatToPixelsJni(mObj, lon, lat) + } else null + } + + fun pixelsToLonlat(x: Float, y: Float): LonLat? { + return if (mObj != 0L) { + pixelsToLonlatJni(mObj, x, y) + } else null + } + + fun shakeSceneManual() { + if (mObj != 0L) { + shakeSceneManualJni(mObj) + } + } + + fun shakeMapManual() { + if (mObj != 0L) { + shakeMapManualJni(mObj) + } + } + + fun getResulation(): Float { + return if (mObj != 0L) { + getResulationJni(mObj) + } else 0.0f + } + + fun drawTraffic(trafficJson: String) { + if (mObj != 0L) { + drawTrafficJni(mObj, trafficJson) + } + } + + fun addImage(imageKey: String, imageData: ByteArray?, width: Int, height: Int): Int { + return if (mObj != 0L) { + addImageJni(mObj, imageKey, imageData, width, height) + } else 10001 + } + + fun removeImage(imageKey: String) { + if (mObj != 0L) { + removeImageJni(mObj, imageKey) + } + } + + fun updateImage(imageKey: String, imageData: ByteArray?, width: Int, height: Int) { + if (mObj != 0L) { + updateImageJni(mObj, imageKey, imageData, width, height) + } + } + + fun getSuitableZoom(minLon: Double, minLat: Double, maxLon: Double, maxLat: Double): Int { + return if (mObj != 0L) { + getSuitableZoomJni(mObj, minLon, minLat, maxLon, maxLat) + } else -1 + } + + fun clearAllTmcLines() { + if (mObj != 0L) { + clearAllTmcLinesJni(mObj) + } + } + + fun setTmcData(tmcData: ByteArray?) { + if (mObj != 0L) { + setTmcDataJni(mObj, tmcData) + } + } + + fun setEyeToOriginDis(eyeToOriginDis: Float) { + if (mObj != 0L) { + setEyeToOriginDisJni(mObj, eyeToOriginDis) + } + } + + fun setScreenToOriginDis(screenToOriginDis: Float) { + if (mObj != 0L) { + setScreenToOriginDisJni(mObj, screenToOriginDis) + } + } + + fun setScaleMapCenter(lon: Double, lat: Double) { + if (mObj != 0L) { + setScaleMapCenterJni(mObj, lon, lat) + } + } + + fun setStyleDir(dir: String) { + setStyleDirJni(dir) + } + + fun setOffset(lon: Int, lat: Int) { + if (mObj != 0L) { + setOffsetJni(mObj, lon, lat) + } + } + + fun setOffsetByRate(rateX: Float, rateY: Float, angle: Float) { + if (mObj != 0L) { + setOffsetByRateJni(mObj, rateX, rateY, angle) + } + } + + fun setPointToCenter(xRate: Float, yRate: Float) { + if (mObj != 0L) { + setPointToCenterJni(mObj, xRate, yRate) + } + } + + fun setRenderFrequency(enable: Boolean, renderTimePer: Int) { + if (mObj != 0L) { + setRenderFrequencyJni(mObj, enable, renderTimePer) + } + } + + fun setLightPosition(position: FloatArray) { + if (mObj != 0L) { + setLightPositionJni(mObj, position) + } + } + + fun setLightDiffuse(color: FloatArray) { + if (mObj != 0L) { + setLightDiffuseJni(mObj, color) + } + } + + fun setLightSpecular(color: FloatArray) { + if (mObj != 0L) { + setLightSpecularJni(mObj, color) + } + } + + fun setFrontFaceShiness(frontFaceShiness: Float) { + if (mObj != 0L) { + setFrontFaceShinessJni(mObj, frontFaceShiness) + } + } + + fun updatePointCloudDataByPb( + dataArray: ByteArray?, + isTrasformer: Boolean, + isResidual: Boolean, + isReset: Boolean + ): Boolean { + return if (mObj != 0L) { + updatePointCloudDataByPbJni(mObj, dataArray, isTrasformer, isResidual, isReset) + } else false + } + + fun updatePointCloudData( + dataStr: String, + isTrasformer: Boolean, + isResidual: Boolean, + isReset: Boolean + ): Boolean { + return if (mObj != 0L) { + updatePointCloudDataJni(mObj, dataStr, isTrasformer, isResidual, isReset) + } else false + } + + fun setIsDrawPointCloud(isDrawPointCloud: Boolean) { + if (mObj != 0L) { + setIsDrawPointCloudJni(mObj, isDrawPointCloud) + } + } + + fun setPointCloudDisplayFllowAnim(isDisplayFllowAnim: Boolean, totalAnimTime: Int) { + if (mObj != 0L) { + setPointCloudDisplayFllowAnimJni(mObj, isDisplayFllowAnim, totalAnimTime) + } + } + + fun setPointCloudSize(pointCloudSize: Float) { + if (mObj != 0L) { + setPointCloudSizeJni(mObj, pointCloudSize) + } + } + + fun setPointCloudColor(color: String) { + if (mObj != 0L) { + setPointCloudColorJni(mObj, color) + } + } + + fun setIsEnableShadow(b: Boolean) { + if (mObj != 0L) { + setIsEnableShadowJni(mObj, b) + } + } + + fun setHDTypeVisibile(type: IntArray?) { + if (mObj != 0L) { + setHDTypeVisibileJni(mObj, type) + } + } + + fun switchData(x: Double, y: Double, isWgs84: Boolean): DoubleArray? { + return if (mObj != 0L) { + switchDataJni(mObj, x, y, isWgs84) + } else null + } + + fun updateAnchorByJson( + anchorId: String, + json: String, + infobitmap: ByteArray?, + infoWidth: Int, + infoHeight: Int + ): Boolean { + return if (mObj != 0L) { + updateAnchorByJsonJni(mObj, anchorId, json, infobitmap, infoWidth, infoHeight) + } else false + } + + fun setSomeAnchorZIndex(anchorId: String, zIndex: Int) { + if (mObj != 0L) { + setSomeAnchorZIndexJni(mObj, anchorId, zIndex) + } + } + + fun drawAnchor(nameId: String, lon: Double, lat: Double, imagePath: String) { + if (mObj != 0L) { + drawAnchorJni(mObj, nameId, lon, lat, imagePath) + } + } + + fun removeAnchor(anchorId: String) { + if (mObj != 0L) { + removeAnchorJni(mObj, anchorId) + } + } + + fun findAnchorAtScreen(x: Int, y: Int): String { + return if (mObj != 0L) { + findAnchorAtScreenJni(mObj, x, y) + } else "" + } + + fun startAnimation(anchorId: String) { + if (mObj != 0L) { + startAnimationJni(mObj, anchorId) + } + } + + fun endAnimation(anchorId: String) { + if (mObj != 0L) { + endAnimationJni(mObj, anchorId) + } + } + + fun addDynamicAnchorPostion( + anchorId: String, + points: DoubleArray, + angle: Float, + current: Long, + duration: Int + ) { + if (mObj != 0L) { + addDynamicAnchorPostionJni(mObj, anchorId, points, angle, current, duration) + } + } + + fun addTranslateAnimationToAnchor(anchorId: String, points: DoubleArray, duration: Int) { + if (mObj != 0L) { + addTranslateAnimationToAnchorJni(mObj, anchorId, points, duration) + } + } + + fun addScaleAnimationToAnchor(anchorId: String, min: Float, max: Float, duration: Int) { + if (mObj != 0L) { + addScaleAnimationToAnchorJni(mObj, anchorId, min, max, duration) + } + } + + fun addFlashAnimationToAnchor(anchorId: String, imageJson: String, duration: Int) { + if (mObj != 0L) { + addFlashAnimationToAnchorJni(mObj, anchorId, imageJson, duration) + } + } + + fun addRotateAnimationToAnchor( + anchorId: String, + startAngle: Float, + endAngle: Float, + duration: Int + ) { + if (mObj != 0L) { + addRotateAnimationToAnchorJni(mObj, anchorId, startAngle, endAngle, duration) + } + } + + fun setSomeAnchorCanClickable(anchorId: String, canClickable: Boolean) { + if (mObj != 0L) { + setSomeAnchorCanClickableJni(mObj, anchorId, canClickable) + } + } + + fun setSomeAnchorUnTop(anchorId: String) { + if (mObj != 0L) { + setSomeAnchorUnTopJni(mObj, anchorId) + } + } + + fun setSomeAnchorTop(anchorId: String) { + if (mObj != 0L) { + setSomeAnchorTopJni(mObj, anchorId) + } + } + + fun setSomeAnchorInfowindowOffset(anchorId: String, disx: Int, disy: Int) { + if (mObj != 0L) { + setSomeAnchorInfowindowOffsetJni(mObj, anchorId, disx, disy) + } + } + + fun setSomeAnchorFlat(anchorId: String, isFlat: Boolean) { + if (mObj != 0L) { + setSomeAnchorFlatJni(mObj, anchorId, isFlat) + } + } + + fun setSomeAnchorDrawModel(anchorId: String, dragModel: Boolean) { + if (mObj != 0L) { + setSomeAnchorDrawModelJni(mObj, anchorId, dragModel) + } + } + + fun setSomeDrawModelPointScreenPosition(screenx: Int, screeny: Int): Boolean { + return if (mObj != 0L) { + setSomeDrawModelPointScreenPositionJni(mObj, screenx, screeny) + } else false + } + + fun addManyAnchors(json: String, count: Int) { + if (mObj != 0L) { + addManyAnchorsJni(mObj, json, count) + } + } + + fun addManyAnchorByJson(json: String, count: Int) { + if (mObj != 0L) { + addManyAnchorByJsonJni(mObj, json, count) + } + } + + fun removeClusterByClusterid(clusterId: String) { + if (mObj != 0L) { + removeClusterByClusteridJni(mObj, clusterId) + } + } + + fun removeManyAnchor(allAnchorJson: String, count: Int) { + if (mObj != 0L) { + removeManyAnchorJni(mObj, allAnchorJson, count) + } + } + + fun clearAllCluster() { + if (mObj != 0L) { + clearAllClusterJni(mObj) + } + } + + fun createConstAnchor( + attribute: String, + infoBitmap: ByteArray?, + infoWidth: Int, + infoHeight: Int + ): Boolean { + return if (mObj != 0L) { + createConstAnchorJni(mObj, attribute, infoBitmap, infoWidth, infoHeight) + } else false + } + + fun addAnchorAsync(json: String) { + if (mObj != 0L) { + addAnchorAsyncJni(mObj, json) + } + } + + fun executeAnchorAdd() { + if (mObj != 0L) { + executeAnchorAddJni(mObj) + } + } + + fun setConstAnchorPositionFlag(isUpdate: Boolean) { + if (mObj != 0L) { + setConstAnchorPositionFlagJni(mObj, isUpdate) + } + } + + fun addAnchor(json: String, infoBitmap: ByteArray?, infoWidth: Int, infoHeight: Int): Boolean { + return if (mObj != 0L) { + addAnchorJni(mObj, json, infoBitmap, infoWidth, infoHeight) + } else false + } + + fun getAnchorProperty(id: String, propertyName: String): String { + return if (mObj != 0L) { + getAnchorPropertyJni(mObj, id, propertyName) + } else "" + } + + fun updateAnchorProperty(id: String, propertyName: String, propertyValue: String): Boolean { + return if (mObj != 0L) { + updateAnchorPropertyJni(mObj, id, propertyName, propertyValue) + } else false + } + + fun updateInfoWindowWithBitMap( + id: String, + imageData: ByteArray, + width: Int, + height: Int + ): Boolean { + return if (mObj != 0L) { + updateInfoWindowWithBitMapJni(mObj, id, imageData, width, height) + } else false + } + + fun updateAnchorWithBitmap(id: String, imageKey: String): Boolean { + return if (mObj != 0L) { + updateAnchorWithBitmapJni(mObj, id, imageKey) + } else false + } + + fun clearAllAnchors(): Boolean { + return if (mObj != 0L) { + clearAllAnchorsJni(mObj) + } else false + } + + fun showInfoWindow(id: String) { + if (mObj != 0L) { + showInfoWindowJni(mObj, id) + } + } + + fun hideInfoWindow(id: String) { + if (mObj != 0L) { + hideInfoWindowJni(mObj, id) + } + } + + fun setAnchorRate(rate: Float) { + if (mObj != 0L) { + setAnchorRateJni(mObj, rate) + } + } + + fun setAnchorScale(wideLeft: Float, wideRight: Float, highUp: Float, hightDown: Float) { + if (mObj != 0L) { + setAnchorScaleJni(mObj, wideLeft, wideRight, highUp, hightDown) + } + } + + fun setNameMode(mode: Int, recordCnt: Int) { + if (mObj != 0L) { + setNameModeJni(mObj, mode, recordCnt) + } + } + + fun setSelfLocaionControl(mode: Int) { + if (mObj != 0L) { + setSelfLocaionControlJni(mObj, mode) + } + } + + fun setLockSelfCar(enable: Boolean) { + if (mObj != 0L) { + setLockSelfCarJni(mObj, enable) + } + } + + fun isAnchorDynamicMoving(anchorID: String): Boolean { + return if (mObj != 0L) { + isAnchorDynamicMovingJni(mObj, anchorID) + } else false + } + + fun updateBatchAnchorPositon(dataStr: String): Boolean { + return if (mObj != 0L) { + updateBatchAnchorPositonJni(mObj, dataStr) + } else false + } + + fun setAnchorFlash(id: String, colorType: Int, color: String, time: Float, angle: Float) { + if (mObj != 0L) { + setAnchorFlashJni(mObj, id, colorType, color, time, angle) + } + } + + fun setAnchorGradientColor( + startColor: String, + endColor: String, + startDistance: Float, + endDistance: Float + ) { + if (mObj != 0L) { + setAnchorGradientColorJni(mObj, startColor, endColor, startDistance, endDistance) + } + } + + fun setTailLightsType(type: Int, time: Int) { + if (mObj != 0L) { + setTailLightsTypeJni(mObj, type, time) + } + } + + fun drawLine( + name: String, + points: DoubleArray, + lineWidth: Int, + r: Char, + g: Char, + b: Char, + a: Char, + isLoop: Boolean + ) { + if (mObj != 0L) { + drawLineJni(mObj, name, points, lineWidth, r, g, b, a, isLoop) + } + } + + fun drawCircle(name: String, lonlats: DoubleArray, r: Char, g: Char, b: Char, a: Char) { + if (mObj != 0L) { + drawCircleJni(mObj, name, lonlats, r, g, b, a) + } + } + + fun drawEllipse(name: String, lonlats: DoubleArray, r: Char, g: Char, b: Char, a: Char) { + if (mObj != 0L) { + drawEllipseJni(mObj, name, lonlats, r, g, b, a) + } + } + + fun drawPolygon(name: String, lonlats: DoubleArray, r: Char, g: Char, b: Char, a: Char) { + if (mObj != 0L) { + drawPolygonJni(mObj, name, lonlats, r, g, b, a) + } + } + + fun removePrimitiveByNameId(name: String) { + if (mObj != 0L) { + removePrimitiveByNameIdJni(mObj, name) + } + } + + fun drawLine(jsonOption: String) { + if (mObj != 0L) { + drawLineJni(mObj, jsonOption) + } + } + + fun drawThickLine(strJsonOption: String) { + if (mObj != 0L) { + drawThickLineJni(mObj, strJsonOption) + } + } + + fun setVisiable(id: String, bVisiable: Boolean) { + if (mObj != 0L) { + setVisiableJni(mObj, id, bVisiable) + } + } + + fun setWidth(id: String, width: Float) { + if (mObj != 0L) { + setWidthJni(mObj, id, width) + } + } + + fun setGeodesic(id: String, bGeodesic: Boolean) { + if (mObj != 0L) { + setGeodesicJni(mObj, id, bGeodesic) + } + } + + fun setTransparency(id: String, transparency: Float) { + if (mObj != 0L) { + setTransparencyJni(mObj, id, transparency) + } + } + + fun setColor(id: String, color: Int) { + if (mObj != 0L) { + setColorJni(mObj, id, color) + } + } + + fun setZIndex(id: String, zIndex: Float) { + if (mObj != 0L) { + setZIndexJni(mObj, id, zIndex) + } + } + + fun useGradient(id: String, bUseGradient: Boolean) { + if (mObj != 0L) { + useGradientJni(mObj, id, bUseGradient) + } + } + + fun setDottedLineType(id: String, type: Int) { + if (mObj != 0L) { + setDottedLineTypeJni(mObj, id, type) + } + } + + fun setOption(id: String, strJsonOption: String) { + if (mObj != 0L) { + setOptionJni(mObj, id, strJsonOption) + } + } + + fun draw3DPolygon( + id: String, + lonlatArr: DoubleArray, + height: Float, + width: Float, + count: Int, + color: FloatArray + ) { + if (mObj != 0L) { + draw3DPolygonJni(mObj, id, lonlatArr, height, width, count, color) + } + } + + fun clearAllPrimitives(): Boolean { + return if (mObj != 0L) { + clearAllPrimitivesJni(mObj) + } else false + } + + fun setDeadZoneVisiable(enable: Boolean) { + if (mObj != 0L) { + setDeadZoneVisiableJni(mObj,enable) + } + } + + fun drawDeadZone(strJsonOption:String?) { + if (mObj != 0L) { + drawDeadZoneJni(mObj,strJsonOption) + } + } + + fun unload() { + Log.i(TAG, "MapEngine: unload") + if (mObj != 0L) { + unloadJni(mObj) + mObj = 0 + } + } + + private external fun loadJni(projectDir: String, mapView: MapView?,assetManager: AssetManager?): Long + + private external fun resizeJni(obj:Long,newWidth: Int, newHeight: Int) + + private external fun renderJni(obj:Long) + + private external fun scrollJni(obj:Long,dx: Float, dy: Float) + + private external fun scrollByAnimJni(obj:Long,dx: Float, dy: Float) + + private external fun setZoomIndexJni(obj:Long,zoomIndex: Int) + + private external fun getZoomIndexJni(obj:Long): Int + + private external fun setZoomValueJni(obj:Long,zoomValue: Float) + + private external fun getZoomValueJni(obj:Long): Float + + private external fun zoomInJni(obj:Long) + + private external fun zoomOutJni(obj:Long) + + private external fun scaleJni(obj:Long,scale: Float) + + private external fun scaleByCenterJni(obj:Long,centerX: Int, centerY: Int, scale: Float) + + private external fun rotateJni(obj:Long,angle: Float) + + private external fun lookUpDownJni(obj:Long,look: Float) + + private external fun setCenterJni(obj:Long,lon: Double, lat: Double) + + private external fun getCenterJni(obj:Long,point: DoubleArray) + + private external fun animateToJni(obj:Long,lon: Double, lat: Double, alt: Float, zoom: Float, rotateAngle: Float, overlookAngle: Float, eyeHeight: Float, duration: Int,fov: Float) + /** + * 导航 设置导航参数 + */ + private external fun setRoutePropJni(obj:Long,prop: Int, lon: Int, lat: Int) + /** + * 导航 绘制导航 + */ + private external fun drawRouteJni(obj:Long) + /** + * 导航 绘制导航指向标 + */ + private external fun drawNavArrowJni(obj:Long) + /** + * 导航 获取导航路线 + */ + private external fun getRulerInfoJni(obj:Long): Float + /** + * 导航 显示所有导航路线 + */ + private external fun showAllRouteLineJni(obj:Long) + /** + * 导航 显示导航路线 + */ + private external fun showRouteLineJni(obj:Long,pOneX: Float, pOneY: Float, pTwoX: Float, pTwoY: Float) + + private external fun addAntCoorJni(obj:Long,sessionId: Int, lon: Int, lat: Int, time: Int) + + private external fun drawMapMatchedPositionJni(obj:Long) + /** + * 导航 添加车标 + */ + private external fun drawCarJni(obj:Long,lon: Long, lat: Long, z: Short, angle: Short, scale: Int, rate: Float, data: ByteArray?, len: Int) + /** + * 导航 更新车标 + */ + private external fun updateCarJni(obj:Long,lon: Long, lat: Long, z: Short, angle: Short) + /** + * 导航 获取车的位置 + */ + private external fun getCarPositionJni(obj:Long,position: IntArray?): Int + /** + * TMC + */ + private external fun setTrafIDStatJni(obj:Long,locCode: Int, dir: Int, evtCode: Int) + /** + * TMC + */ + private external fun getTrafIDStatJni(obj:Long,tileId: Int, linkId: Int): Int + /** + * TMC 开关 + */ + private external fun setTrafficJni(obj:Long,stat: Int) + /** + * TMC 是否开启 + */ + private external fun isTrafficOnJni(obj:Long): Boolean + /** + * TMC + */ + private external fun commitTrafficStatJni(obj:Long,locTableCode: Int) + /** + * 导航 + */ + private external fun routeSearchingJni(obj:Long,showcnt: Int) + /** + * 地图 获取3D角 + */ + private external fun getDAngleJni(obj:Long): Float + /** + * 地图 设置3D角 + */ + private external fun setDAngleJni(obj:Long,angle: Float) + /** + * 地图 获取偏转角 + */ + private external fun getRotateAngleJni(obj:Long): Float + /** + * 地图 设置偏转角 + */ + private external fun setRotateAngleJni(obj:Long,angle: Float) + + //视域调整 + private external fun setVerticalViewFieldAngleJni(obj:Long,angle: Float) + + //获取视域角 + private external fun getVerticalViewFieldAngleJni(obj:Long): Float + + //获取眼睛高度 + private external fun getEyeHeightJni(obj:Long): Float + + //设置眼睛高度 + private external fun setEyeHeightJni(obj:Long,eyeHeight: Float) + /** + * 导航 清理路由信息 + */ + private external fun clearRouteObjsJni(obj:Long) + /** + * 导航 清理路由信息 + */ + private external fun clearRouteSearchedObjsJni(obj:Long) + /** + * 搜索 绘制poi结果 + */ + private external fun drawSearchResultJni(obj:Long) + /** + * 搜索 清理poi结果 + */ + private external fun clearSearchResultJni(obj:Long) + + // 视图模式 + // 0: 日间模式 + // 1:夜间模式 + // 2:SATEL模式 + // 3:日间导航模式 + // 4:夜间导航模式 + // 5.VR模式 + private external fun setMapStyleJni(obj:Long,styleMode: Int) + + private external fun getMapStyleJni(obj:Long): Int + + private external fun set3DBuildingVisibleJni(obj:Long,isVisibel: Boolean) + /** + * 地图 经纬度转屏幕坐标 + */ + private external fun lonlatToPixelsJni(obj:Long,lon: Double, lat: Double): Pixels? + /** + * 地图 屏幕坐标转经纬度 + */ + private external fun pixelsToLonlatJni(obj:Long,x: Float, y: Float): LonLat? + + //场景刷新 + private external fun shakeSceneManualJni(obj:Long) + + //地图刷新 + private external fun shakeMapManualJni(obj:Long) + //获取屏幕分辨率 + private external fun getResulationJni(obj:Long): Float + + private external fun drawTrafficJni(obj:Long,trafficJson: String) + + private external fun addImageJni(obj:Long,imageKey: String, imageData: ByteArray?, width: Int, height: Int): Int + + private external fun removeImageJni(obj:Long,imageKey: String) + + private external fun updateImageJni(obj:Long,imageKey: String, imageData: ByteArray?, width: Int, height: Int) + + private external fun getSuitableZoomJni(obj:Long,minLon: Double, minLat: Double, maxLon: Double, maxLat: Double): Int + /** + * TMC 清理TMC已绘制数据 + */ + private external fun clearAllTmcLinesJni(obj:Long) + /** + * TMC 设置TMC数据 + */ + private external fun setTmcDataJni(obj:Long,tmcData: ByteArray?) + + private external fun setEyeToOriginDisJni(obj:Long,eyeToOriginDis: Float) + + private external fun setScreenToOriginDisJni(obj:Long,screenToOriginDis: Float) + // 设置缩放中心点 + private external fun setScaleMapCenterJni(obj:Long,lon: Double, lat: Double) + //自定义路径 + private external fun setStyleDirJni(dir: String) + /** + * 地图 设置屏幕中心偏移 + */ + private external fun setOffsetJni(obj:Long,lon: Int, lat: Int) + + private external fun setOffsetByRateJni(obj:Long,rateX: Float, rateY: Float, angle: Float) + //设置屏幕上的某个像素点为地图中心点。 + private external fun setPointToCenterJni(obj:Long,xRate: Float, yRate: Float) + //设置同频渲染相关参数 + private external fun setRenderFrequencyJni(obj:Long,enable: Boolean, renderTimePer: Int) + //设置灯光位置 + private external fun setLightPositionJni(obj:Long,position: FloatArray) + + //漫反射 + private external fun setLightDiffuseJni(obj:Long,color: FloatArray) + + //镜面反射 + private external fun setLightSpecularJni(obj:Long,color: FloatArray) + + private external fun setFrontFaceShinessJni(obj:Long,frontFaceShiness: Float) + + /** + * 更新点云数据 + * @param dataStr 点云数据 + * @param isTrasformer 是否需要转换坐标 + * @param isResidual 是否需要差量更新 + * @param isReset 是否重置数据 + * @return 是否执行 + */ + private external fun updatePointCloudDataByPbJni(obj:Long,dataArray: ByteArray?, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean): Boolean + + /** + * 更新点云数据 + * @param dataStr 点云数据 + * @param isTrasformer 是否需要转换坐标 + * @param isResidual 是否需要差量更新 + * @param isReset 是否重置数据 + * @return 是否执行 + */ + private external fun updatePointCloudDataJni(obj:Long,dataStr: String, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean): Boolean + + /** + * 设置是否绘制点云 + * @param isDrawPointCloud 是否绘制 默认false 不绘制 + */ + private external fun setIsDrawPointCloudJni(obj:Long,isDrawPointCloud: Boolean) + + /** + * 绘制点云是否有动画 + * @param isDisplayFllowAnim 是否有动画 + * @param totalAnimTime 动画时间(100-10000) + */ + private external fun setPointCloudDisplayFllowAnimJni(obj:Long,isDisplayFllowAnim: Boolean, totalAnimTime: Int) + + // 点云大小设置(0.1-20) + private external fun setPointCloudSizeJni(obj:Long,pointCloudSize: Float) + + // 点云颜色 + private external fun setPointCloudColorJni(obj:Long,color: String) + + //更新高精地图显示元素 + private external fun setHDTypeVisibileJni(obj:Long,type: IntArray?) + + private external fun unloadJni(obj:Long) + + //是否启用阴影 + private external fun setIsEnableShadowJni(obj:Long,b: Boolean) + + external fun isCollision(data: String): String + + //转换数据 + private external fun switchDataJni(obj:Long,x: Double, y: Double, isWgs84: Boolean): DoubleArray + + private external fun setStyleNameJni(obj:Long,name: String) + + private external fun updateAnchorByJsonJni( + obj: Long, + anchorId: String, + json: String, + infobitmap: ByteArray?, + infoWidth: Int, + infoHeight: Int + ): Boolean + + private external fun setSomeAnchorZIndexJni(obj: Long, anchorId: String, zIndex: Int) + private external fun drawAnchorJni( + obj: Long, + nameId: String, + lon: Double, + lat: Double, + imagePath: String + ) + + private external fun removeAnchorJni(obj: Long, anchorId: String) + private external fun findAnchorAtScreenJni(obj: Long, x: Int, y: Int): String + + private external fun startAnimationJni(obj: Long, anchorId: String) + + private external fun endAnimationJni(obj: Long, anchorId: String) + + //动态平移 + private external fun addDynamicAnchorPostionJni( + obj: Long, + anchorId: String, + points: DoubleArray, + angle: Float, + current: Long, + duration: Int + ) + + //平移 + private external fun addTranslateAnimationToAnchorJni( + obj: Long, + anchorId: String, + points: DoubleArray, + duration: Int + ) + + //缩放 + private external fun addScaleAnimationToAnchorJni( + obj: Long, + anchorId: String, + min: Float, + max: Float, + duration: Int + ) + + private external fun addFlashAnimationToAnchorJni( + obj: Long, + anchorId: String, + imageJson: String, + duration: Int + ) + + //旋转 + private external fun addRotateAnimationToAnchorJni( + obj: Long, + anchorId: String, + startAngle: Float, + endAngle: Float, + duration: Int + ) + + private external fun setSomeAnchorCanClickableJni( + obj: Long, + anchorId: String, + canClickable: Boolean + ) + + // 非置顶 + private external fun setSomeAnchorUnTopJni(obj: Long, anchorId: String) + + private external fun setSomeAnchorTopJni(obj: Long, anchorId: String) + + private external fun setSomeAnchorInfowindowOffsetJni( + obj: Long, + anchorId: String, + disx: Int, + disy: Int + ) + + // 设置是否是平贴 + private external fun setSomeAnchorFlatJni(obj: Long, anchorId: String, isFlat: Boolean) + + // 设置拖拽 + private external fun setSomeAnchorDrawModelJni(obj: Long, anchorId: String, dragModel: Boolean) + + // 设置拖拽位置 + private external fun setSomeDrawModelPointScreenPositionJni( + obj: Long, + screenx: Int, + screeny: Int + ): Boolean + + private external fun addManyAnchorsJni(obj: Long, json: String, count: Int) + + // 添加海量点 + private external fun addManyAnchorByJsonJni(obj: Long, json: String, count: Int) + + // 删除海量点 + private external fun removeClusterByClusteridJni(obj: Long, clusterId: String) + + private external fun removeManyAnchorJni(obj: Long, allAnchorJson: String, count: Int) + + private external fun clearAllClusterJni(obj: Long) + + private external fun createConstAnchorJni( + obj: Long, + attribute: String, + infoBitmap: ByteArray?, + infoWidth: Int, + infoHeight: Int + ): Boolean + + private external fun addAnchorAsyncJni(obj: Long, json: String) + + private external fun executeAnchorAddJni(obj: Long) + + private external fun setConstAnchorPositionFlagJni(obj: Long, isUpdate: Boolean) + + private external fun addAnchorJni( + obj: Long, + json: String, + infoBitmap: ByteArray?, + infoWidth: Int, + infoHeight: Int + ): Boolean + + /** + * 返回anchor的对象属性值 + * + * @param id anchor的id + * @param propertyName 属性名字 + * @return 属性值 + */ + private external fun getAnchorPropertyJni(obj: Long, id: String, propertyName: String): String + + /** + * 更新anchor的属性 + * + * @param id anchor的id + * @param propertyName 要更新的anchor的属性名 + * @param propertyValue 要更新的属性值 + * @return + */ + private external fun updateAnchorPropertyJni( + obj: Long, + id: String, + propertyName: String, + propertyValue: String + ): Boolean + + /** + * 更新infowindow内容 + * + * @param id infowindow的id + * @param imageData 更新的图片byte数组数据 + * @param width 图片宽度 + * @param height 图片高度 + * @return true 更新成功 false 更新失败 + */ + private external fun updateInfoWindowWithBitMapJni( + obj: Long, + id: String, + imageData: ByteArray, + width: Int, + height: Int + ): Boolean + + /** + * 更新anchor + * + * @param id anchor的id + * @return true 更新成功 false 更新失败 + */ + private external fun updateAnchorWithBitmapJni(obj: Long, id: String, imageKey: String): Boolean + + /** + * 清除所有anchor + * + * @return true 删除成功 false 删除失败 + */ + private external fun clearAllAnchorsJni(obj: Long): Boolean + + /** + * 显示infowindow + * + * @param id Anchor的id + */ + private external fun showInfoWindowJni(obj: Long, id: String) + + /** + * 隐藏infoWindow + * + * @param id Anchor的id + */ + private external fun hideInfoWindowJni(obj: Long, id: String) + + private external fun setAnchorRateJni(obj: Long, rate: Float) + + //For Test 四个顶点设置锚点变形 左宽 右宽 上高 下高 + private external fun setAnchorScaleJni( + obj: Long, + wideLeft: Float, + wideRight: Float, + highUp: Float, + hightDown: Float + ) + + //nMode 1:按Tile存储 2:按文件存储 nRecordCnt 单个文件存储的记录个数 + private external fun setNameModeJni(obj: Long, mode: Int, recordCnt: Int) + + /** + * 设置地图中心点的旋转方式 + * 3 正北向上 4 车头向上 + * + * @param mode + */ + private external fun setSelfLocaionControlJni(obj: Long, mode: Int) + + private external fun setLockSelfCarJni(obj: Long, enable: Boolean) + + //锚点是否在动态移动中 + private external fun isAnchorDynamicMovingJni(obj: Long, anchorID: String): Boolean + + //批量更新 + private external fun updateBatchAnchorPositonJni(obj: Long, dataStr: String): Boolean + + private external fun setAnchorFlashJni( + obj: Long, + id: String, + colorType: Int, + color: String, + time: Float, + angle: Float + ) + + private external fun setAnchorGradientColorJni( + obj: Long, + startColor: String, + endColor: String, + startDistance: Float, + endDistance: Float + ) + + private external fun setTailLightsTypeJni(obj: Long, type: Int, time: Int) + + + /*图元接口*/ + private external fun drawLineJni( + obj: Long, name: String, + points: DoubleArray, + lineWidth: Int, + r: Char, + g: Char, + b: Char, + a: Char, + isLoop: Boolean + ) + + private external fun drawCircleJni( + obj: Long, + name: String, + lonlats: DoubleArray, + r: Char, + g: Char, + b: Char, + a: Char + ) + + private external fun drawEllipseJni( + obj: Long, + name: String, + lonlats: DoubleArray, + r: Char, + g: Char, + b: Char, + a: Char + ) + + private external fun drawPolygonJni( + obj: Long, + name: String, + lonlats: DoubleArray, + r: Char, + g: Char, + b: Char, + a: Char + ) + + private external fun removePrimitiveByNameIdJni(obj: Long, name: String) + + private external fun drawLineJni(obj: Long, jsonOption: String) + + private external fun drawThickLineJni(obj: Long, strJsonOption: String) + + private external fun setVisiableJni(obj: Long, id: String, bVisiable: Boolean) + + private external fun setWidthJni(obj: Long, id: String, width: Float) + + private external fun setGeodesicJni(obj: Long, id: String, bGeodesic: Boolean) + + private external fun setTransparencyJni(obj: Long, id: String, transparency: Float) + + private external fun setColorJni(obj: Long, id: String, color: Int) + + private external fun setZIndexJni(obj: Long, id: String, zIndex: Float) + + private external fun useGradientJni(obj: Long, id: String, bUseGradient: Boolean) + + private external fun setDottedLineTypeJni(obj: Long, id: String, type: Int) + + private external fun setOptionJni(obj: Long, id: String, strJsonOption: String) + + private external fun draw3DPolygonJni( + obj: Long, + id: String, + lonlatArr: DoubleArray, + height: Float, + width: Float, + count: Int, + color: FloatArray + ) + + private external fun clearAllPrimitivesJni(obj: Long): Boolean + + private external fun drawDeadZoneJni(obj: Long,strJsonOption: String?) + + private external fun setDeadZoneVisiableJni(obj:Long,b: Boolean) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapView.kt b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapView.kt new file mode 100644 index 0000000000..754d49cd0c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/MapView.kt @@ -0,0 +1,1367 @@ +package com.autonavi.nge.map + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.Point +import android.opengl.GLException +import android.opengl.GLSurfaceView +import android.os.Build +import android.os.Handler +import android.os.Message +import android.text.TextUtils +import android.util.Log +import android.view.GestureDetector +import android.view.GestureDetector.OnDoubleTapListener +import android.view.MotionEvent +import android.view.SurfaceHolder +import android.view.View +import com.alibaba.fastjson.JSON +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG +import com.zhidaoauto.map.sdk.inner.abs.IEventController +import com.zhidaoauto.map.sdk.inner.abs.ILockLocation +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.abs.IMapView +import com.zhidaoauto.map.sdk.inner.abs.IMarkerCall +import com.zhidaoauto.map.sdk.inner.abs.ITraffic +import com.zhidaoauto.map.sdk.inner.common.ConstantExt +import com.zhidaoauto.map.sdk.inner.common.MapHelper.mMapParams +import com.zhidaoauto.map.sdk.inner.utils.Constant +import com.zhidaoauto.map.sdk.open.MapAutoApi +import com.zhidaoauto.map.sdk.open.abs.IRenderData +import com.zhidaoauto.map.sdk.open.abs.marker.OnMarkerDragListener +import com.zhidaoauto.map.sdk.open.abs.view.IMapStyleParams +import com.zhidaoauto.map.sdk.open.marker.Marker +import com.zhidaoauto.map.sdk.open.marker.MarkerInfo +import com.zhidaoauto.map.sdk.open.marker.MarkerOptions +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.tools.MapTools +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.SupervisorJob +import kotlinx.coroutines.cancel +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import java.nio.IntBuffer +import java.util.concurrent.atomic.AtomicBoolean +import javax.microedition.khronos.egl.EGL10 +import javax.microedition.khronos.egl.EGLConfig +import javax.microedition.khronos.opengles.GL10 +import kotlin.math.absoluteValue + +class MapView(context: Context, private val mMapStyleParams: IMapStyleParams, private val mILockLocation: ILockLocation) : + GLSurfaceView(context), GLSurfaceView.Renderer, IMapView { + //init 相关 + private var mMarkerCall:IMarkerCall? = null + + private val mShowTouchInfo: Boolean = false + private var m_iLastX0 = 0f + private var m_iLastY0 = 0f + private var m_iLastX1 = 0f + private var m_iLastY1 = 0f + private var m_iLastAngle: Int + + //弯曲度 + private var m_bBending = false + + //旋转状态 + private var m_bRotating = false + + //样式路径 + private var mStylePath: String? = null + + // 多指触控状态 + private var m_bLastMultiple = false + private var mDealScale: Boolean = false + private var mScaleCenterLonLat: LonLat? = null + private var mScaleCenterX: Int = 0 + private var mScaleCenterY: Int = 0 + private var m_fCurAverageDistanceFromCenter = -1f + private var m_fLastAverageDistanceFromCenter = -1f + private var m_iMultiTouchCnt = 0 + private var m_FPS = 60 + private var lastUpdateTime: Long = 0 + private val mGestureDetector: GestureDetector + //The controller of map + private var mMapController: IMapController? = null + //The controller of event + protected var mEventController: IEventController? = null + + private var tilt = 0f + + // down事件时间 + private var lastDownTime = 0L + + // 上次ScaleBy事件时间 + private var lastScaleByTime = 0L + + // 上次时间 + private var lastTime = 0L + + // 事件间隔 + private final val eventScaleInterval = 30L // 事件间隔 + + private final val eventInterval = 30L + + //已初始化Surface + private var mSurfaceCreated: AtomicBoolean = AtomicBoolean(false) + + //已加载完成 + private var loaded = false + + // 地图POI是否允许点击。 + private var mPoiTouchEnable = true + private var viewWidth = 1920 + private var viewHeight = 1040 + var mLonLat: LonLat? = null + private val ZOOM_CHANGE = 0x7F + private val FOCUS_CHANGE = 0x9F + private val ROTATE_CHANGE = 0x11F + private val DAngle_CHANGE = 0x13F + private val RENDER_COMPLETE = 0x15F + private val LOAD_COMPLETE = 0x17F + private val RENDER_CHANGE = 0x19F + private val LISTENER_TYPE_SCREEN = 0x5F + private val DELAY_TIME: Long = 500 + private val VELOCITY_MEASURE: Float = 3000f + private val SCALE_SMALL_DISTANCE: Float = 0.5f + private var mOnMarkerDragListener: OnMarkerDragListener? = null + var mITraffic: ITraffic? = null + var mLockCarJob: Job? = null + var mAnimJob: Job? = null + var mMarkerJob: Job? = null + var mLongPressJob: Job? = null + var mLockCar: Job? = null + + //是否第一次加载完成 + private var isFirst = true + //是否已回收 + private var isDestory = false + + private var lastClickMarker: Marker? = null + private var dragMarker: Marker? = null + private var renderDataCall: IRenderData? = null + + private var enableSync = false + private var renderTimePer:Int = 0 + private var waitTime = 5000L + private var isAutoLockCar = true + + // 协程 + lateinit var mScope: CoroutineScope + // 耗时专用协程 + lateinit var mDemaningScope: CoroutineScope + + + private val mHandler: Handler = object : Handler() { + override fun handleMessage(msg: Message) { + when (msg.what) { + ZOOM_CHANGE -> mMapController?.dispatchZoomChanged() + ROTATE_CHANGE ->mMapController?.dispatchRotationAngleChanged((msg.obj as Float)) + DAngle_CHANGE -> mMapController?.dispatchDAngleChanged() + FOCUS_CHANGE -> mMapController?.dispatchFocusChanged() + RENDER_CHANGE -> { + mEventController?.dispatchRenderListener(msg.arg1) + } + RENDER_COMPLETE -> { + if (DEBUG) { + Log.i(TAG, "mapop--load render complete-start") + } +// CommonEventController.instance?.dispatchCameraChangeFinishListener(CommonController.instance.mapAutoView?.getMapAutoViewHelper()?.getCameraPosition() ?: null) + if (DEBUG) { + Log.i(TAG, "mapop--load render complete-end") + } + } + LOAD_COMPLETE -> { + if (DEBUG) { + Log.i(TAG, "mapop--load complete-start") + } +// setAnchorScale(1.01f,2.5f) + mEventController?.dispatchMapLoadedListener() +// CommonController.instance.naviAutoView?.mNaviViewListener?.onNaviViewLoaded() + + } + else -> { + } + } + } + } + + + + + override fun getMapEngine(): MapEngine { + return mMapEngine + } + + override fun setMarkerCall(markerCall: IMarkerCall) { + this.mMarkerCall = markerCall + } + + override fun setEventController(eventController: IEventController?) { + this.mEventController = eventController + } + + private val mMapEngine: MapEngine = MapEngine() + + + override fun toScreen() { + isScreen = true + } + + override fun setVrMode(isVr: Boolean) { + this.isVr = isVr + } + + override fun setWaitTime(time: Long){ + waitTime = time + } + + + override fun setIsAutoLockCar(isLockCar: Boolean){ + isAutoLockCar = isLockCar + } + + + override fun destory() { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-destory") + } + isFirst = true + loaded = false + isDestory = true + mHandler.removeCallbacksAndMessages(null) + mMapController = null + mITraffic = null + } + + //surfaceview截屏 + private fun createBitmapFromGLSurface(x: Int, y: Int, w: Int, h: Int, gl: GL10): Bitmap? { + val bitmapBuffer = IntArray(w * h) + val bitmapSource = IntArray(w * h) + val intBuffer = IntBuffer.wrap(bitmapBuffer) + intBuffer.position(0) + try { + gl.glReadPixels(x, y, w, h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, intBuffer) + var offset1: Int + var offset2: Int + for (i in 0 until h) { + offset1 = i * w + offset2 = (h - i - 1) * w + for (j in 0 until w) { + val texturePixel = bitmapBuffer[offset1 + j] + val blue = texturePixel shr 16 and 0xff + val red = texturePixel shl 16 and 0x00ff0000 + val pixel = texturePixel and -0xff0100 or red or blue + bitmapSource[offset2 + j] = pixel + } + } + } catch (e: GLException) { + return null + } + return Bitmap.createBitmap(bitmapSource, w, h, Bitmap.Config.ARGB_8888) + } + + + + + + fun setMapController(mMapController: IMapController?) { + this.mMapController = mMapController + } + + + + override fun onPause() { + super.onPause() + } + + override fun onResume() { + super.onResume() + } + + open fun loadOverCallbak() { +// if (DEBUG) { +// Log.i(TAG, "mapop---renderop-loadOverCallbak- isFirst:${isFirst}") +// } + if (isFirst) { + loaded = true + isFirst = false +// setAnchorScale(1.01f,2.5f) + mHandler.sendEmptyMessage(LOAD_COMPLETE) + } + } + + + //渲染完成回调 + open fun renderOverCallbak() { + if (DEBUG) { + Log.i(TAG, "mapop---renderop-renderOverCallbak: ") + } + mHandler.sendEmptyMessage(RENDER_COMPLETE) + } + + + fun setRenderDataCall(renderDataCall: IRenderData?) { + this.renderDataCall = renderDataCall + } + + open fun clipedRouteLineCbk( + tileId: Int, leftTopLon: Double, leftTopLat: Double, leftBottomLon: Double, leftBottomLat: Double, + rightTopLon: Double, rightTopLat: Double, rightBottomLon: Double, rightBottomLat: Double, clipedRouteInfo: String? + ) { + if (DEBUG) { + Log.i(TAG, "autoop--${clipedRouteInfo}") + } + mITraffic?.onRoadLoaded(tileId, leftTopLon, leftTopLat, leftBottomLon, leftBottomLat, rightTopLon, rightTopLat, rightBottomLon, rightBottomLat, clipedRouteInfo) + mEventController?.dispatchRoadLoadedListener(clipedRouteInfo) + } + + //type==2 代表的缩放结束 + //type==1 代表平移结束 + //type== 0 代表所有动画结束 + fun AnimateFinishCallback(markerId: String, type: Int) { + if (DEBUG) { + Log.d("AnimateFinishCallback", "markerop-AnimateFinishCallback:${markerId},type =${type}") + } + val animationListener = mMarkerCall?.getAnimationListener(markerId) + animationListener?.let { + mAnimJob?.cancel() + mAnimJob = mScope?.launch(Dispatchers.IO){ + it.onAnimationFinish(markerId, type) + } + } + } + + private fun markerBatchCallback(dataStr: String) { + mMarkerCall?.updateMarkerResource(dataStr) + if(DEBUG) { + Log.d("markerBatchCallback", "threadop--markerBatchCallback:" + dataStr + "," + Thread.currentThread().id) + } + } + + override fun removeTouch(){ + mLockCarJob?.cancel() + } + + + private var x = 0.0 + private var y = 0.0 + private fun jsonToObj(json: String?): MarkerInfo? { + return JSON.parseObject(json, MarkerInfo::class.java) + } + + var isTouchingFlag = false + + var lonlat: LonLat? = null + override fun onTouchEvent(ev: MotionEvent): Boolean { + if (ev.action == MotionEvent.ACTION_MOVE && dragMarker != null) { + dragMarker?.let { + Log.i(TAG, "markerop--dragMarker:ev.getX().toInt()${ev.getX().toInt()} ev.getY().toInt()${ev.getY().toInt()}") + mMapEngine.setSomeDrawModelPointScreenPosition(ev.getX().toInt(), ev.getY().toInt()) + mOnMarkerDragListener?.onMarkerDrag(dragMarker) + return true + } + + } + + isTouchingFlag = true + + if (!(mEventController?.isMapTouchListenerListEmpty()?:true)) { + val flag = mEventController?.dispatchMapTouchListener(ev) + if (flag != null && flag) { + return flag + } + } + if (ev.action == MotionEvent.ACTION_UP || ev.action == MotionEvent.ACTION_CANCEL) { + mDealScale = true + isTouchingFlag = false + dragMarker?.let { + dragMarker?.getId()?.let { + mMapEngine.setSomeAnchorDrawModel(it, false) + mOnMarkerDragListener?.onMarkerDragEnd(dragMarker) + } + dragMarker = null + mOnMarkerDragListener = null + } + } + //marker相关点击事件 + if (ev.action == MotionEvent.ACTION_DOWN) { + // 解锁锁车模式 + if (DEBUG){ + Log.i(TAG, "lockop--onTouchEvent:VrAngleMode: ${mMapStyleParams.getVrAngleMode()}") + } + if(mMapStyleParams.getVrAngleMode() != ConstantExt.MAP_STYLE_VR_ROAM && mMapStyleParams.getVrAngleMode() != ConstantExt.MAP_STYLE_VR_ANGLE_FAR) { + + mILockLocation.setLockCar(false) + if(isAutoLockCar) { + mLockCarJob?.cancel() + mLockCarJob = mDemaningScope?.launch(Dispatchers.IO) { + if (DEBUG) { + Log.i(TAG, "lockop--onTouchEvent:mLockCarJob start: ${mMapStyleParams.getVrAngleMode()}") + } + delay(waitTime) + mILockLocation.setLockCar(true) + if (DEBUG) { + Log.i(TAG, "lockop--onTouchEvent:mLockCarJob end") + } + } + } + } + + lastDownTime = ev.eventTime + if (1 == ev.pointerCount) { + m_bLastMultiple = false + x = ev.x.toDouble() + y = ev.y.toDouble() + } + + } + if (2 <= ev.pointerCount) { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--onTouchEvent: 2 <= ev.pointerCount") + } + var angle = 0 + + // 两指切换3D效果 + if (m_bLastMultiple && !m_bRotating) { + //跳到3d效果 + val dy0 = m_iLastY0 - ev.getY(0) + val dy1 = m_iLastY1 - ev.getY(1) + if (Math.abs(dy0) > 1 || Math.abs(dy1) > 1) { + if (dy1 * dy0 > 1 && dy1 / dy0 < 3 && dy0 / dy1 < 3) { + + if (isFling) { + m_bBending = true + val value = (dy0 + dy1) / 8f + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--lookUpDown:${value}") + } + tilt(value) + } + } + } + } + //旋转效果 + if (!m_bBending) { + val dx = ev.getX(1) - ev.getX(0) + val dy = ev.getY(1) - ev.getY(0) + val dist = Math.sqrt(dx * dx + dy * dy.toDouble()).toFloat() + //角度 + angle = (Math.acos(dx / dist.toDouble()) * 180.0 / Math.PI).toInt() + if (dy < 0) { + angle = 360 - angle + } + } + if (m_bLastMultiple + && (Math.abs(angle - m_iLastAngle) > 10 || m_bRotating) + && !m_bBending + ) { + val dx0 = m_iLastX0 - ev.getX(0) + val dy0 = m_iLastY0 - ev.getY(0) + val dx1 = m_iLastX1 - ev.getX(1) + val dy1 = m_iLastY1 - ev.getY(1) + if (dx0 * dx1 < -10 || dy0 * dy1 < -10) { + m_bRotating = true + //m_MapCtrl.stopAnimation(MapAnimator.ANITYPE_NANGLE, false); + if (isRotate && m_bRotating) { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--rotateBy") + } + val rotateAngle = angle - m_iLastAngle.toFloat() + mMapEngine.rotate(rotateAngle) + requestRender() + mMapController?.rotate(rotateAngle) + } else { + m_bRotating = false + } + } + } + getMotionEventDetail(ev) + //缩放时根据触摸位置进行居中处理 + mScaleCenterLonLat?.let { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--scaleop--scaleCenter:${mScaleCenterLonLat},${mScaleCenterX},${mScaleCenterY}") + } + mMapEngine.setScaleMapCenter(it.lon, it.lat) + mScaleCenterLonLat = null + } + val interValue = Math.abs(m_fCurAverageDistanceFromCenter - m_fLastAverageDistanceFromCenter) + if (m_iMultiTouchCnt > 5 && m_fLastAverageDistanceFromCenter != -1f && interValue > SCALE_SMALL_DISTANCE && ev.action and MotionEvent.ACTION_MASK == MotionEvent.ACTION_MOVE) { + val zoomFactor = m_fCurAverageDistanceFromCenter / m_fLastAverageDistanceFromCenter + if (isCanZoom) { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--scaleop--lastDownTime:${lastDownTime},${ev.eventTime}") + } + // 增加两次事件执行间隔 +// if (lastScaleByTime == 0L || ev.eventTime - lastDownTime > eventScaleInterval) { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--scaleop--zoomFactor-scaleBy2:${zoomFactor},${mScaleCenterX},${mScaleCenterY}") + } +// lastScaleByTime = SystemClock.uptimeMillis() + if(isVr && (mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_NIGHT_VR || mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_DAY_VR)){ + if(DEBUG) { + Log.d(TAG, "getZoomVal(): ${mMapEngine.getZoomValue()}, ${zoomFactor}") + } + //zoomFactor 缩放比例 > 1 放大 < 1 缩小 getZoomVal() / zoomFactor 缩放到的值 + if(mMapEngine.getZoomValue() / zoomFactor < 3.0) { + mMapEngine.scaleByCenter(mScaleCenterX, mScaleCenterY, zoomFactor) + }else{ + + } + }else { + mMapEngine.scaleByCenter(mScaleCenterX, mScaleCenterY, zoomFactor) + } + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--scaleop:over") + } + requestRender() +// } + + } + } + m_iMultiTouchCnt++ + m_fLastAverageDistanceFromCenter = m_fCurAverageDistanceFromCenter + m_bLastMultiple = true + if (NOT_A_ANGLE == m_iLastAngle || m_bRotating) { + m_iLastAngle = angle + } + m_iLastX0 = ev.getX(0) + m_iLastY0 = ev.getY(0) + m_iLastX1 = ev.getX(1) + m_iLastY1 = ev.getY(1) + if (ev.action == MotionEvent.ACTION_UP || ev.action == MotionEvent.ACTION_CANCEL) { + m_iLastAngle = NOT_A_ANGLE + //m_bLastMultiple = false; + m_bBending = false + m_bRotating = false + } + } else { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--onTouchEvent: 2 > ev.pointerCount") + } + if (!m_bLastMultiple) { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--mGestureDetector--onTouchEvent") + } + mGestureDetector.onTouchEvent(ev) + } + m_iLastAngle = NOT_A_ANGLE + //m_bLastMultiple = false; + m_bBending = false + m_bRotating = false + m_iMultiTouchCnt = 0 + m_fCurAverageDistanceFromCenter = -1f + m_fLastAverageDistanceFromCenter = -1f + } + return true + } + + private fun getMotionEventDetail(ev: MotionEvent) { + var centerx = 0 + var centery = 0 + for (i in 0 until ev.pointerCount) { + centerx += ev.getX(i).toInt() + centery += ev.getY(i).toInt() + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "mapop--scaleop--getMotionEventDetail--:${ev.getX(i).toInt()},${ev.getY(i).toInt()},center:${centerx},${centery}") + } + } + + centerx /= ev.pointerCount + centery /= ev.pointerCount +// if (DEBUG && mShowTouchInfo) { +// Log.i(TAG, "mapop--scaleop-/-${centerx},${centery}") +// } + for (i in 0 until ev.pointerCount) { + val dx = ev.getX(i) - centerx + val dy = ev.getY(i) - centery + m_fCurAverageDistanceFromCenter += Math.sqrt(dx * dx + (dy * dy).toDouble()).toFloat() +// if (DEBUG && mShowTouchInfo) { +// Log.i(TAG, "mapop--scaleop-m_fCurAverageDistanceFromCenter:${m_fCurAverageDistanceFromCenter}") +// } + } + + mScaleCenterX = centerx + mScaleCenterY = centery + m_fCurAverageDistanceFromCenter /= ev.pointerCount.toFloat() + + if (m_iMultiTouchCnt > 3 && mDealScale) { + mDealScale = false + mScaleCenterLonLat = mMapEngine.pixelsToLonlat(mScaleCenterX.absoluteValue.toFloat(), mScaleCenterY.absoluteValue.toFloat()) + } + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "mapop--scaleop-m_fCurAverageDistanceFromCenter--/--:${m_fCurAverageDistanceFromCenter},m_iMultiTouchCnt:${m_iMultiTouchCnt},${mScaleCenterX},${mScaleCenterY}") + } + } + + var snapshotBitmap: Bitmap? = null + var isScreen = false + + private var doubles = doubleArrayOf() + open fun getDoubles(): DoubleArray { + return doubles + } + + open override fun setDoubles(doubles: DoubleArray) { + this.doubles = doubles + } + + private var time: Long = 0 + + private var isRenderFirst = true + + override fun onDrawFrame(gl: GL10) { + + if (isDestory) { + return + } + time = System.currentTimeMillis() + + if(mSurfaceCreated.get()){ + mMapEngine.render() + } + if (isRenderFirst) { + isRenderFirst = false + if(mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_NIGHT_VR || mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_DAY_VR) { + mMapController?.setMapViewVisualAngle(mMapStyleParams.getDefaultPerspective()) + } + mEventController?.dispatchMapLoadedInitListener() + if(DEBUG){ + Log.i(TAG, "mapop-surfaceop--onDrawFrame:threadop:${Thread.currentThread().id}") + } + } + if(enableSync){ + // 2ms是每次耗时补充 + var sTime = renderTimePer-(System.currentTimeMillis()-time)-2 + if(sTime > 0 && sTime < 100){ + try { + Thread.sleep(sTime) + } catch (e:Exception) { + } + } + } + val msg = Message.obtain() + msg.what = RENDER_CHANGE + msg.arg1 = (System.currentTimeMillis()-time).toInt() + mHandler.sendMessage(msg) + if (isScreen) { + isScreen = false + snapshotBitmap = createBitmapFromGLSurface(0, 0, width, height, gl) + mEventController?.dispatchScreenShotListener(snapshotBitmap) + } + } + + override fun onSurfaceChanged(gl: GL10, width: Int, height: Int) { + if (DEBUG) { + Log.i(TAG, "mapop--surfaceop--resize:${width},${height}") + } + if (width == 0 || height == 0 || (viewWidth == width && viewHeight == height)) { + return + } +// gl.glViewport(0, 0, width, height) + viewWidth = width + viewHeight = height + MapTools.viewHeight = viewWidth + MapTools.viewWidth = viewHeight + if (DEBUG) { + Log.i(TAG, "mapop--surfaceop--resize:${width},${height}") + } + if(mSurfaceCreated.get()){ + mMapEngine.resize(width, height) + } + } + + override fun surfaceDestroyed(holder: SurfaceHolder) { + try{ + super.surfaceDestroyed(holder) + }catch (e:Exception){ + Log.e(TAG, "mapop--surfaceop--surfaceDestroyed:",e) + } + if (DEBUG) { + Log.i(TAG, "mapop--surfaceop--surfaceDestroyed:") + } + } + + + override fun onWindowVisibilityChanged(visibility: Int) { + if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O){ + super.onWindowVisibilityChanged(View.VISIBLE) + }else{ + super.onWindowVisibilityChanged(visibility) + } + + if (DEBUG) { + Log.i(TAG, "mapop-surfaceop----onWindowVisibilityChanged:${visibility}") + } +// if (visibility == View.VISIBLE) { +// ResumeAllThread() +// } else { +// SuspendAllThread() +// } + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + isRenderFirst = true + isDestory = false + isFirst = true + if (DEBUG) { + Log.i(TAG, "mapop-surfaceop----onAttachedToWindow:") + } + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + if (DEBUG) { + Log.i(TAG, "destroyop-mapop-surfaceop----onDetachedFromWindow-start:") + } + mLongPressJob?.cancel() + mMarkerJob?.cancel() + mAnimJob?.cancel() + mLockCar?.cancel() + mScope.cancel() + mDemaningScope.cancel() + mHandler?.removeCallbacksAndMessages(null) + if (CompileConfig.DEBUG) { + Log.i(TAG, "destroyop--MapEngine.unload-start") + } + mMapEngine.unload() + if (DEBUG) { + Log.i(TAG, "destroyop-mapop-surfaceop----onDetachedFromWindow-over:") + } + + } + + + override fun onSurfaceCreated(gl: GL10, config: EGLConfig) { + if (DEBUG) { + Log.i(TAG, "mapop-surfaceop----onSurfaceCreated:,threadop:${Thread.currentThread().id}") + } + // setStyleDir("sdcard/shmdata/style"); + var styleMode = mMapStyleParams.getStyleMode() + val dir = Constant.nDSDataPath + mMapEngine.setIsEnableShadow(mMapStyleParams.isShadowEnable()) + if(!loadP(dir)){ + return + } + loadOverCallbak() + if(mMapStyleParams.getHDVisibileArray().isNotEmpty()){ + mMapEngine.setHDTypeVisibile(mMapStyleParams.getHDVisibileArray()) + } + //默认锁车模式 + mMapEngine.setLockSelfCar(true) + mMapController?.setMapStyle(styleMode) + val param = mMapStyleParams.getCarPosition() +// if(param>0f) +// { + mMapEngine.setScreenToOriginDis(param) +// } + if (mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_NIGHT_VR || mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_DAY_VR) { + if (DEBUG) { + Log.i(TAG, "mapop-surfaceop----onSurfaceCreated:,Vr") + } + + mMapEngine.setDAngle(ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_MIDDLE) + mMapEngine.setZoomValue(ConstantExt.MAP_STYLE_VR_ZOOM_VAL_MIDDLE) + mMapEngine.setEyeHeight(ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_MIDDLE) + } else { + mMapEngine.setSelfLocaionControl(MapAutoApi.MAP_PERSPECTIVE_UP_CAR) + mMapEngine.setDAngle(90f) + //缩放级别 + mMapEngine.setZoomIndex(mMapStyleParams.getZoom()) + // setPointToCenter(mMapParams.getOffsetX(), mMapParams.getOffsetY()) +// mMapEngine.setOffset((MapTools.viewWidth * (mMapStyleParams.getOffsetX() - 0.5f)).toInt(), ((MapTools.viewWidth * (mMapParams.getOffsetY() - 0.5f)).toInt())) + } + if(mMapStyleParams.getPerspectiveMode()>2){ + mMapEngine.setSelfLocaionControl(mMapStyleParams.getPerspectiveMode()) + } + if(mMapStyleParams.getIsSkyBoxEnable()) { + mMapController?.setSkyBoxMode() + } + isFling = false + isCanZoom = true + isRotate = false + mSurfaceCreated.set(true) + if (DEBUG) { + Log.i(TAG, "mapop-surfaceop--selfop--onSurfaceCreated:${mSurfaceCreated}") + } + mHandler.post(object :Runnable{ + override fun run() { + mILockLocation.switchStyle(mMapStyleParams.getStyleMode()) + } + }) + } + + fun setMapViewVisualAngle(type: Int){ + mLockCarJob?.cancel() + mMapController?.setMapViewVisualAngle(type) + } + + private inner class DoubleClickDetecter : OnDoubleTapListener { + override fun onDoubleTap(e: MotionEvent): Boolean { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--onDoubleTap: ") + } + if (e.pointerCount >= 2) { + return false + } + if(!mSurfaceCreated.get()){ + return true + } + if (isCanZoom) { + if(mMapStyleParams.isSwitchViewAngle() && (mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_NIGHT_VR || mMapStyleParams.getStyleMode() == MapAutoApi.MAP_STYLE_DAY_VR)){ + var type = mMapStyleParams.getDefaultPerspective() + when(mMapStyleParams.getVrAngleMode()){ + mMapStyleParams.getDefaultPerspective()->{ + type = ConstantExt.MAP_STYLE_VR_ANGLE_FAR + } + ConstantExt.MAP_STYLE_VR_ANGLE_FAR->{ + type = mMapStyleParams.getDefaultPerspective() + } + } + setMapViewVisualAngle(type) + + }else { + mMapEngine.zoomIn() + } + } + return true + } + + override fun onDoubleTapEvent(e: MotionEvent): Boolean { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--onDoubleTapEvent: ") + } + return false + } + + override fun onSingleTapConfirmed(e: MotionEvent): Boolean { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--onSingleTapConfirmed: ${e.action},${e.x},${e.y}") + } +// if (e.getPointerCount() >= 2) { +// return false +// } +// var y = e.getY() +// val sxy = M3DEsngine.glToPixel(0, getHeight() * 2, 0); +// val miny = Math.max(0, (short)(sxy & 0xFFFF)); +// if(y < miny){ +// y = miny; +// return true; +// } +// var lonLat = pixelsToLonlat(e.getX().toInt(), y.toInt()); +// lonLat?.let { +// animateTo(lonLat.lon.toFloat(), lonLat.lat.toFloat(),-1f,-1f,-1f); +// } +// return true + return false + } + } + + + /** + * Marker event click + */ + private fun markerEvent(e: MotionEvent) { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--markerEvent: ${e.action},${e.x},${e.y}") + } + //resultInfo = unableBeTouch 不可点击 + val x = e.x.toInt() + val y = e.y.toInt() + mMarkerJob?.cancel() + mMarkerJob = mDemaningScope?.launch(Dispatchers.IO) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--findAnchorAtScreenPoint:start") + } + if(!mSurfaceCreated.get()){ + return@launch + } + val resultInfo = mMapEngine.findAnchorAtScreen(x, y) + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--findAnchorAtScreenPoint:${resultInfo}") + } + if (TextUtils.isEmpty(resultInfo) || resultInfo == "unableBeTouch") { + } else { + val markerInfo = jsonToObj(resultInfo) + + if (markerInfo != null) { + var marker: Marker = Marker(MarkerOptions(markerInfo.id,null).setGps(true).position(LonLatPoint(markerInfo.lon, markerInfo.lat)).setAssInfo(markerInfo.assInfo),mMapController,mMarkerCall) + lastClickMarker?.let { + if (!TextUtils.equals(it.getId(), marker.getId())) { + it.hideInfoWindow() + } + } + lastClickMarker = marker + + if (markerInfo.type == "1") { + if (!(mEventController?.isMarkClickListenerListEmpty()?:true)) { + withContext(Dispatchers.Main) { mEventController?.dispatchMarkClickListener(marker) } + } + val onMarkClickListener = mMarkerCall?.getMarkClickListener(markerInfo.id) + onMarkClickListener?.let { + withContext(Dispatchers.Main) { + mILockLocation.setLockCar(false) + it.onMarkClick(marker) + mLockCarJob?.cancel() + mLockCarJob = mDemaningScope?.launch(Dispatchers.IO) { + delay(waitTime) + mILockLocation.setLockCar(true) + } + } + } + } else if (markerInfo.type == "2") { + // 触发InfoWindow子view的点击事件 + var clickFlag = false + val clickMap = mMarkerCall?.getInfoViewClick(markerInfo.getId()) + clickMap?.let { + for (rect in it.keys) { + if (rect.contains(markerInfo.hitx, markerInfo.hity)) { + withContext(Dispatchers.Main) { + it.get(rect)?.click() + } + clickFlag = true + break + } + } + } + if (clickFlag) { + return@launch + } + val onInfoWindowClickListener = mMarkerCall?.getInfoWindowClickListener(markerInfo.id) + onInfoWindowClickListener?.let { + withContext(Dispatchers.Main) { + it.onInfoWindowClick(marker) + } + } + + } + } + } + } + } + + inner class TouchGestureDetecter : GestureDetector.OnGestureListener { + override fun onLongPress(e: MotionEvent) { + if (dragMarker != null) { + return + } + mLongPressJob?.cancel() + mLongPressJob = mScope?.launch(Dispatchers.IO) { + if(!mSurfaceCreated.get()){ + return@launch + } + val resultInfo = mMapEngine.findAnchorAtScreen(x.toInt(), y.toInt()) + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--touch--findAnchorAtScreenPoint:${resultInfo}") + } + if (TextUtils.isEmpty(resultInfo) || resultInfo == "unableBeTouch") { + } else { + val markerInfo = jsonToObj(resultInfo) + if (markerInfo != null) { + val isDraggable = mMapEngine.getAnchorProperty(markerInfo.id, "draggable").toBoolean() + if (isDraggable) { + dragMarker = Marker(MarkerOptions(markerInfo.id,null).lonLatPoint(LonLat(markerInfo.lon, markerInfo.lat)),mMapController,mMarkerCall) + markerInfo.id?.let { infoId-> + mOnMarkerDragListener = mMarkerCall?.getMarkDragListener(infoId) + mOnMarkerDragListener?.let { + withContext(Dispatchers.Main) { + dragMarker?.getId()?.let { id-> + mMapEngine.setSomeAnchorDrawModel(id, true) + Log.i(TAG, "markerop--markerDragStart") + it.onMarkerDragStart(dragMarker) + } + + } + } + } + + } + + } + + + } + } + } + + override fun onShowPress(e: MotionEvent) {} + override fun onDown(e: MotionEvent): Boolean { + return true + } + + override fun onSingleTapUp(e: MotionEvent): Boolean { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--mGestureDetector--onSingleTapUp") + } + if(!mSurfaceCreated.get()){ + return false + } + //Marker Event + markerEvent(e) + + if (!(mEventController?.isMarkClickListenerListEmpty()?:true)) { + val x = e.x.toInt() + val y = e.y.toInt() + var latLonPoint = MapTools.fromScreenLocation(Point(x, y),mMapController) + mEventController?.dispatchMapClickListener(latLonPoint) + return true + } + return false + } + + + // 参数: + // e1:第1个ACTION_DOWN MotionEvent + // e2:ACTION_UP MotionEvent + // velocityX:X轴上的移动速度,像素/秒 + // velocityY:Y轴上的移动速度,像素/秒 + override fun onFling( + e1: MotionEvent, + e2: MotionEvent, + velocityX: Float, + velocityY: Float + ): Boolean { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--mGestureDetector--onFling:e1:${e1.x},${e1.y},e2:${e2.x},${e2.y},${velocityX},${velocityY}") + } + if (e1.pointerCount >= 2 || e2.pointerCount >= 2) { + return false + } + if(!mSurfaceCreated.get()){ + return false + } + // VR模式下禁止拖动有惯性 + if (mMapStyleParams.getStyleMode() >= MapAutoApi.MAP_STYLE_NIGHT_VR) { + return false + } + if (velocityX.absoluteValue > 200 || velocityY.absoluteValue > 200) { + var x1 = e1.x + var y1 = e1.y + var x2 = e2.x + var y2 = e2.y + var distanceX = x2 - x1 + var distanceY = y2 - y1 + var inertiaX = 1 + velocityX.absoluteValue / VELOCITY_MEASURE + var inertiaY = 1 + velocityY.absoluteValue / VELOCITY_MEASURE + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--mGestureDetector--onFling--inertia:${inertiaX},${inertiaY},distance:${distanceX},${distanceY},scrollby:${inertiaX * distanceX},${-inertiaY * distanceY}") + } + + val scrollX = -1 * inertiaX * distanceX + val scrollY = inertiaY * distanceY + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--onFling --scrollByAnim: $scrollX,$scrollY") + } + if(mSurfaceCreated.get()){ + mMapEngine.scrollByAnim(scrollX, scrollY) + } + } + + return if (!isFling) { + false + } else true + } + + // 参数: + // e1:第1个ACTION_DOWN MotionEvent + // e2:最近的ACTION_MOVE MotionEvent + override fun onScroll( + e1: MotionEvent, + e2: MotionEvent, + distanceX: Float, + distanceY: Float + ): Boolean { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--mGestureDetector--onScroll:e1:${e1.pointerCount},${e1.x},${e1.y},,e2:${e2.pointerCount},${e2.x},${e2.y},$distanceX,$distanceY,time:${e2.eventTime}") + } + if (e1.pointerCount >= 2 || e2.pointerCount >= 2) { + return false + } + if(!mSurfaceCreated.get()){ + return false + } + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--onScroll: $distanceX,$distanceY") + } + mMapController?.dispatchFocusChanged() + if (!isScroll) { + return false + } + // 增加两次事件执行间隔 + if (e2.eventTime - e1.eventTime < eventInterval) { + return true + } + try{ + if(mSurfaceCreated.get()) { + mMapEngine.scroll(1f * distanceX, -1f * distanceY) + } + }catch (e:java.lang.Exception){ + Log.e(TAG, "touchop--mapop--scrollBy:over",e) + } + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--mapop--scrollBy:over") + } + requestRender() + mEventController?.dispatchScrollListener(distanceX.toDouble(), -distanceY.toDouble()) + return true + } + } + + //可以滑动 + private var isScroll = true + + //可以斜滑 + private var isFling = true + + //可以旋转 + private var isRotate = true + + //可以缩放 + private var isCanZoom = true + + private var isVr = false + + override fun isTouching(): Boolean { + return isTouchingFlag + } + + override fun isCanZoom(): Boolean { + return isCanZoom + } + + override fun setCanZoom(isCanZoom: Boolean) { + this.isCanZoom = isCanZoom + } + + override fun setRotate(isRotate: Boolean) { + this.isRotate = isRotate + } + + override fun isRotate(): Boolean { + return isRotate + } + + override fun isScroll(): Boolean { + return isScroll + } + + override fun setScroll(scroll: Boolean) { + isScroll = scroll + } + + override fun isFling(): Boolean { + return isFling + } + + override fun setFling(isFling: Boolean) { + this.isFling = isFling + } + + + override fun getmContext(): Context? { + return context + } + + override fun isLoaded(): Boolean { + return loaded + } + + override fun isSurfaceCreated(): Boolean { + return mSurfaceCreated.get() + } + + fun onMapFocusChanging() { + if (DEBUG) { + Log.i(TAG, "mapop--onMapFocusChanging") + } + mHandler.sendEmptyMessage(FOCUS_CHANGE) + } + + fun onMapZoomChanging() { + if (DEBUG) { + Log.i(TAG, "mapop--onMapZoomChanging") + } + mHandler.sendEmptyMessage(ZOOM_CHANGE) + } + + fun onMapRAngleChanging(angle:Float) { + if (DEBUG) { + Log.i(TAG, "mapop--onMapRAngleChanging") + } + val msg = Message.obtain() + msg.what = ROTATE_CHANGE + msg.obj = angle + mHandler.sendMessage(msg) + } + + fun onMapDAngleChanging() { + if (DEBUG) { + Log.i(TAG, "mapop--onMapDAngleChanging") + } + mHandler.sendEmptyMessage(DAngle_CHANGE) + } + + override fun loadP( + dir: String + ): Boolean { + if (DEBUG) { + Log.i(TAG, "loadop--${mMapParams.getStyleDir()}") + } + if (!TextUtils.isEmpty(mMapParams.getStyleDir())) { + mMapEngine.setStyleDir(mMapParams.getStyleDir()!!) + } else if (!TextUtils.isEmpty(mStylePath)) { + mMapEngine.setStyleDir(mStylePath!!) + } +// if(!TextUtils.isEmpty(mMapParams.getStyleName())){ +// mMapEngine.setStyleName(mMapParams.getStyleName()) +// } + return mMapEngine.load(dir, this,context.assets) + } + + override fun unloadP() { + isFirst = true + loaded = false +// unload() + } + + override fun setCustomStyleDir(path: String) { + mStylePath = path + } + + override fun resizeP(w: Int, h: Int) { + mMapEngine.resize(w, h) + } + + override fun renderP() { + mMapEngine.render() + } + + override fun scrollByP(dx: Float, dy: Float) { + if (DEBUG && mShowTouchInfo) { + Log.i(TAG, "touchop--mapop----scrollByP--scrollBy:") + } + mMapEngine.scroll(dx, dy) + } + + override fun addAntCoorP(sessionId: Int, lon: Int, lat: Int, time: Int) { + mMapEngine.addAntCoor(sessionId, lon, lat, time) + } + + override fun tilt(tilt: Float) { + this.tilt = tilt + if(mMapEngine.getDAngle() + tilt > 90){ + this.tilt = 90 - mMapEngine.getDAngle() + } + mMapEngine.lookUpDown(this.tilt) + requestRender() + mMapController?.lookUpDown() + } + + //设置刷新帧率 + override fun setRenderFps(fps: Int) { + m_FPS = fps + + } + + //设置刷新帧率 + override fun getRenderFps(): Int { + return m_FPS + } + + override fun rotateByP(r: Float) { + mMapEngine.rotate(r) + } + + override fun getTilt(): Float { + return tilt + } + + + + override fun setTouchPoiEnable(enable: Boolean) { + mPoiTouchEnable = enable + } + + override fun getTouchPoiEnable(): Boolean { + return mPoiTouchEnable + } + + + override fun setSyncRenderFrequency(enable: Boolean, renderTimePer: Int){ + mMapEngine.setRenderFrequency(enable, renderTimePer) + this.enableSync = enable + this.renderTimePer = renderTimePer + } + + private fun renderDataCallback(data: String) { + if(CompileConfig.DEBUG){ + Log.d("renderDataCallback", "renderDataCallback:$data") + } + renderDataCall?.renderDataResult(data) + } + + + override fun getScope():CoroutineScope?{ + return mScope + } + + override fun getDemaningScope():CoroutineScope?{ + return mDemaningScope + } + + companion object { + private const val TAG = "MapView" + private const val SECOND = 1000 + private const val FRAME_TIME = 16 + private const val NOT_A_ANGLE = -2147483648 + + const val LISTENER_TYPE_SCROLL = 0x11111 + } + + init { + System.loadLibrary("map") + System.loadLibrary("common") + } + + init { + if (DEBUG) { + Log.i(TAG, "mapop---renderop-init:${this} ") + } + isFirst = true + getHolder().setType(SurfaceHolder.SURFACE_TYPE_HARDWARE); + //setEGLContextClientVersion(3) + setEGLConfigChooser { egl, display -> + + val attributes = intArrayOf( + EGL10.EGL_RED_SIZE, 8, //指定RGB中的R大小(bits) + EGL10.EGL_GREEN_SIZE, 8, //指定G大小 + EGL10.EGL_BLUE_SIZE, 8, //指定B大小 + EGL10.EGL_ALPHA_SIZE, 8, //指定Alpha大小,以上四项实际上指定了像素格式 + EGL10.EGL_STENCIL_SIZE, 8, //指定模版缓存大小,以上四项实际上指定了像素格式 + EGL10.EGL_DEPTH_SIZE, 16, //指定深度缓存(Z Buffer)大小 + EGL10.EGL_SAMPLE_BUFFERS, 1, + EGL10.EGL_SAMPLES, 4, + EGL10.EGL_RENDERABLE_TYPE, 4, //指定渲染api类别, 如上一小节描述,这里或者是硬编码的4,或者是EGL14.EGL_OPENGL_ES2_BIT + EGL10.EGL_NONE + ) //总是以EGL10.EGL_NONE结尾 + + val configs = arrayOfNulls(1) + val result = IntArray(1) + egl.eglChooseConfig(display, attributes, configs, 1, result) + configs[0] + } + setEGLContextClientVersion(3); + setRenderer(this) + //getHolder().setFormat(PixelFormat.TRANSLUCENT) + mGestureDetector = GestureDetector(context, TouchGestureDetecter()) + mGestureDetector.setOnDoubleTapListener(DoubleClickDetecter()) + m_iLastAngle = NOT_A_ANGLE + mScope = CoroutineScope(SupervisorJob() + Dispatchers.Default) + mDemaningScope = CoroutineScope(SupervisorJob() + Dispatchers.IO) + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/map/OnMapScreenShotListener.kt b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/OnMapScreenShotListener.kt new file mode 100644 index 0000000000..fbdda8b1df --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/OnMapScreenShotListener.kt @@ -0,0 +1,7 @@ +package com.autonavi.nge.map + +import android.graphics.Bitmap + +interface OnMapScreenShotListener { + fun onMapScreenShot(bitmap: Bitmap?) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/map/OnMapStatusChangeListener.kt b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/OnMapStatusChangeListener.kt new file mode 100644 index 0000000000..531934856e --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/OnMapStatusChangeListener.kt @@ -0,0 +1,5 @@ +package com.autonavi.nge.map + +interface OnMapStatusChangeListener { + fun onMapStatusChangeListener(type: Int, value: Int) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/map/Pixels.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/Pixels.java new file mode 100644 index 0000000000..4d1889746e --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/Pixels.java @@ -0,0 +1,22 @@ +package com.autonavi.nge.map; + +public class Pixels { + private float x; + private float y; + + public float getX() { + return x; + } + + public float getY() { + return y; + } + + @Override + public String toString() { + return "Pixels{" + + "x=" + x + + ", y=" + y + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/map/PrimitiveManager.kt b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/PrimitiveManager.kt new file mode 100644 index 0000000000..ee064b6cd3 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/map/PrimitiveManager.kt @@ -0,0 +1,53 @@ +package com.autonavi.nge.map + + +internal object PrimitiveManager { + external fun drawLine( + name: String?, + points: DoubleArray?, + lineWidth: Int, + r: Char, + g: Char, + b: Char, + a: Char, + isLoop: Boolean + ) + + external fun drawCircle(name: String?, lonlats: DoubleArray?, r: Char, g: Char, b: Char, a: Char) + + external fun drawEllipse(name: String?, lonlats: DoubleArray?, r: Char, g: Char, b: Char, a: Char) + + external fun drawPolygon(name: String?, lonlats: DoubleArray?, r: Char, g: Char, b: Char, a: Char) + + external fun removePrimitiveByNameId(name: String?) + + external fun drawLine(jsonOption: String?) + + external fun drawThickLine(strJsonOption: String?) + + external fun setVisiable(id: String?, bVisiable: Boolean) + + external fun setWidth(id: String?, width: Float) + + external fun setGeodesic(id: String?, bGeodesic: Boolean) + + external fun setTransparency(id: String?, transparency: Float) + + external fun setColor(id: String?, color: Int) + + external fun setZIndex(id: String?, zIndex: Float) + + external fun useGradient(id: String?, bUseGradient: Boolean) + + external fun setDottedLineType(id: String?, type: Int) + + external fun setOption(id: String?, strJsonOption: String?) + + external fun draw3DPolygon(id: String?, lonlatArr: DoubleArray?, height: Float, width: Float, count: Int, color: FloatArray?) + + external fun clearAllPrimitives(): Boolean + + external fun drawDeadZone(strJsonOption: String?) + + external fun setDeadZoneVisiable(b: Boolean) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/Category.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/Category.java new file mode 100644 index 0000000000..682dbd7594 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/Category.java @@ -0,0 +1,81 @@ +package com.autonavi.nge.obj; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.List; + +public class Category implements Parcelable{ + + public static final Creator CREATOR = new Creator() { + public Category createFromParcel(Parcel in) { + Category category = new Category(); + category.setCatName(in.readString()); + category.setKindId(in.readInt()); + category.setSubCategory(in.readArrayList(SubCategory.class.getClassLoader())); + category.setSubNum(in.readInt()); + return category; + } + + public Category[] newArray(int size) { + return new Category[size]; + } + }; + + private String m_sCatName = ""; + private int m_iKindId = 0; + private List m_oSubCategory = null; + private int m_iSubNum = 0; + + public String getCatName() { + return m_sCatName; + } + + public int getKindId() { + return m_iKindId; + } + + public List getSubCategory() { + return m_oSubCategory; + } + + public int getSubNum() { + return m_iSubNum; + } + + public void setCatName(String sCatName) { + this.m_sCatName = sCatName; + } + + public void setKindId(int iKindId) { + this.m_iKindId = iKindId; + } + + public void setSubCategory(List subCateList) { + this.m_oSubCategory = subCateList; + } + + public void setSubNum(int iSubNum) { + this.m_iSubNum = iSubNum; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel out, int arg1) { + out.writeString(m_sCatName); + out.writeInt(m_iKindId); + out.writeList(m_oSubCategory); + out.writeInt(m_iSubNum); + } + + public void readFromParcel(Parcel in) { + m_sCatName = in.readString(); + m_iKindId = in.readInt(); + m_oSubCategory = in.readArrayList(SubCategory.class.getClassLoader()); + m_iSubNum = in.readInt(); + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/DestObj.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/DestObj.java new file mode 100644 index 0000000000..9dccfafce4 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/DestObj.java @@ -0,0 +1,76 @@ +package com.autonavi.nge.obj; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * Dest + * @author + * + */ +public class DestObj implements Serializable{ + private static final long serialVersionUID = 1L; + + private PoiBase poi; + private long ID; + //0:添加的 1:回家 2:上班 + private int kind = 0; + //创建时间 + private String strCreateDate; + + public DestObj() { + + } + /** + * 一般用于添加新Dest + * @param poi + * @param kind + */ + public DestObj(PoiBase poi) { + this.poi = poi; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm"); + this.strCreateDate = sdf.format(new Date()); + } + + /** + * 一般用于更新Dest + * @param id + * @param name + * @param deslon + * @param deslat + * @param desname + */ + public DestObj(long id, String name, int deslon, int deslat, String desname) { + PoiBase mPoiBase = new PoiBase(name, desname, deslon, deslat); + this.poi = mPoiBase; + this.ID = id; + } + + public PoiBase getPoi() { + if(poi == null) //不应该出现 + poi = new PoiBase("", "", 0, 0); + return poi; + } + public void setPoi(PoiBase poi) { + this.poi = poi; + } + public long getId() { + return ID; + } + public void setId(long ID) { + this.ID = ID; + } + public int getKind() { + return kind; + } + public void setKind(int kind) { + this.kind = kind; + } + public String getCreateDate() { + return strCreateDate; + } + public void setCreateDate(String strCreateDate) { + this.strCreateDate = strCreateDate; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/History.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/History.java new file mode 100644 index 0000000000..5e414024b9 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/History.java @@ -0,0 +1,23 @@ +package com.autonavi.nge.obj; + +import java.io.Serializable; + +public class History implements Serializable { + private static final long serialVersionUID = 759861585179477287L; + + private PoiBase poi; + private int ID; + + public PoiBase getPoi() { + return poi; + } + public void setPoi(PoiBase poi) { + this.poi = poi; + } + public int getID() { + return ID; + } + public void setID(int ID) { + this.ID = ID; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/OverlayItem.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/OverlayItem.java new file mode 100644 index 0000000000..f511d4e868 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/OverlayItem.java @@ -0,0 +1,80 @@ +package com.autonavi.nge.obj; + +import android.R; +import android.graphics.drawable.Drawable; + +import com.zhidaoauto.map.sdk.inner.element.MapCoordinate; + + +public class OverlayItem +{ + protected final MapCoordinate m_Coordinate; + protected final String m_Title; + protected final String m_Snippet; + protected Drawable m_Marker; + + public static final int ITEM_STATE_FOCUSED_MASK = 4; + public static final int ITEM_STATE_SELECTED_MASK = 2; + public static final int ITEM_STATE_PRESSED_MASK = 1; + private static final int ITEM_STATE_TO_STATE_SET[][] = { + { + -R.attr.state_focused, -R.attr.state_selected, -R.attr.state_pressed + }, { + -R.attr.state_focused, -R.attr.state_selected, R.attr.state_pressed + }, { + -R.attr.state_focused, R.attr.state_selected, -R.attr.state_pressed + }, { + -R.attr.state_focused, R.attr.state_selected, R.attr.state_pressed + }, { + R.attr.state_focused, -R.attr.state_selected, -R.attr.state_pressed + }, { + R.attr.state_focused, -R.attr.state_selected, R.attr.state_pressed + }, { + R.attr.state_focused, R.attr.state_selected, -R.attr.state_pressed + }, { + R.attr.state_focused, R.attr.state_selected, R.attr.state_pressed + } + }; + + public OverlayItem(MapCoordinate point, String title, String snippet) + { + m_Marker = null; + m_Coordinate = point; + m_Title = title; + m_Snippet = snippet; + } + + public void setMarker(Drawable marker) + { + m_Marker = marker; + } + + public Drawable getMarker(int stateBitset) + { + if(m_Marker != null) + { + setState(m_Marker, stateBitset); + } + return m_Marker; + } + + public static void setState(Drawable drawable, int stateBitset) + { + drawable.setState(ITEM_STATE_TO_STATE_SET[stateBitset]); + } + + public String getTitle() + { + return m_Title; + } + + public String getSnippet() + { + return m_Snippet; + } + + public MapCoordinate getPoint() + { + return m_Coordinate; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/PoiBase.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/PoiBase.java new file mode 100644 index 0000000000..4001a36dd2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/PoiBase.java @@ -0,0 +1,185 @@ +package com.autonavi.nge.obj; + +import android.graphics.drawable.Drawable; +import android.os.Parcel; +import android.os.Parcelable; + +import com.zhidaoauto.map.sdk.inner.element.MapCoordinate; + +import java.io.Serializable; + +public class PoiBase extends OverlayItem implements Parcelable, Serializable { + + public static final Creator CREATOR = new Creator() { + @Override + public PoiBase createFromParcel(Parcel in) { + String name = in.readString(); + String address = in.readString(); + String tel = in.readString(); + int x = in.readInt(); + int y = in.readInt(); + int id = in.readInt(); + return new PoiBase(name, address, tel, x, y, id); + } + + @Override + public PoiBase[] newArray(int size) { + return new PoiBase[size]; + } + }; + + private static final long serialVersionUID = 1L; + public String name = ""; + public String address = ""; + public String tel = ""; + public String sDeepDetail = ""; + public int nPicId = 0; + public int x = 0; + public int y = 0; + public int id = 0; + + public PoiBase(String name, String address, int x, int y) { + super(new MapCoordinate(x, y), name, null); + this.name = name; + this.address = address; + this.x = x; + this.y = y; + } + + public PoiBase(String name, String address, String tel, int x, int y) { + super(new MapCoordinate(x, y), name, null); + this.name = name; + this.address = address; + this.tel = tel; + this.x = x; + this.y = y; + } + + public PoiBase(String name, String address, String tel, int x, int y, int id) { + super(new MapCoordinate(x, y), name, null); + this.name = name; + this.address = address; + this.tel = tel; + this.x = x; + this.y = y; + this.id = id; + } + + public PoiBase(String name, String address, String sDeepDetail, String tel, int picId, int x, int y, int id, Drawable icon) { + super(new MapCoordinate(x, y), name, null); + this.name = name; + this.address = address; + this.tel = tel; + this.x = x; + this.y = y; + this.id = id; + this.nPicId = picId; + this.sDeepDetail = sDeepDetail; + if (null != icon) { + m_Marker = icon; + } + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getsDeepDetail() { + return sDeepDetail; + } + + public void setsDeepDetail(String sDeepDetail) { + this.sDeepDetail = sDeepDetail; + } + + public int getnPicId() { + return nPicId; + } + + public void setnPicId(int nPicId) { + this.nPicId = nPicId; + } + + public int getX() { + return x; + } + + public void setX(int x) { + this.x = x; + } + + public int getY() { + return y; + } + + public void setY(int y) { + this.y = y; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel out, int arg1) { + out.writeString(name); + out.writeString(address); + out.writeString(tel); + out.writeInt(x); + out.writeInt(y); + out.writeInt(id); + } + + public void readFromParcel(Parcel in) { + name = in.readString(); + address = in.readString(); + tel = in.readString(); + x = in.readInt(); + y = in.readInt(); + id = in.readInt(); + } + + @Override + public String toString() { + return "PoiBase{" + + "name='" + name + '\'' + + ", address='" + address + '\'' + + ", tel='" + tel + '\'' + + ", sDeepDetail='" + sDeepDetail + '\'' + + ", nPicId=" + nPicId + + ", x=" + x + + ", y=" + y + + ", id=" + id + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/StaticResult.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/StaticResult.java new file mode 100644 index 0000000000..4be75eb105 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/StaticResult.java @@ -0,0 +1,97 @@ +package com.autonavi.nge.obj; + +public class StaticResult { + public long startTime = 0; + public double totalDuration; + public int index; + public double travelDuration; + public double meanSpeed = 0; + public double MaxSpeed; + public double tollSpeed; + public int num; + public double idlingDuration; + public double lowSpeedDuration; + public double midSpeedDuration; + public double highSpeedDuration; + public double hotCarDuration; + public double stopCarDuration; + public double roallSpeed; + public int rpSpeedUpNum; + public int rpSpeedDownNum; + public int rpTurnNum; + public int rspeedUpnum; + public int rspeedDownnum; + public int rturn; + public double computationalLoad; + public double batteryVoltageL; + public double coolantTemperature; + public double throttlePosition; + public double faultcode; + public double speed; + private static StaticResult instance = null; + + public StaticResult() { + totalDuration = 0; + travelDuration = 0; + meanSpeed = 0; + MaxSpeed = 0; + tollSpeed = 0; + num = 0; + idlingDuration = 0; + lowSpeedDuration = 0; + midSpeedDuration = 0; + highSpeedDuration = 0; + hotCarDuration = 0; + stopCarDuration = 0; + rpSpeedUpNum = 0; + rpSpeedDownNum = 0; + rpTurnNum = 0; + roallSpeed = -1; + rspeedUpnum = 0; + rspeedDownnum = 0; + rturn = 0; + faultcode = 0; + computationalLoad = -Double.MAX_VALUE; + batteryVoltageL = -Double.MAX_VALUE; + coolantTemperature = -Double.MAX_VALUE; + throttlePosition = -Double.MAX_VALUE; + speed = 0; + } + + public static StaticResult getInstance() { + if (instance == null) { + instance = new StaticResult(); + } + return instance; + } + + public void initialize(long startTime) { + this.startTime = startTime; + totalDuration = 0; + travelDuration = 0; + meanSpeed = 0; + MaxSpeed = 0; + tollSpeed = 0; + num = 0; + idlingDuration = 0; + lowSpeedDuration = 0; + midSpeedDuration = 0; + highSpeedDuration = 0; + hotCarDuration = 0; + stopCarDuration = 0; + rpSpeedUpNum = 0; + rpSpeedDownNum = 0; + rpTurnNum = 0; + roallSpeed = -1; + rspeedUpnum = 0; + rspeedDownnum = 0; + rturn = 0; + faultcode = 0; + computationalLoad = -Double.MAX_VALUE; + batteryVoltageL = -Double.MAX_VALUE; + coolantTemperature = -Double.MAX_VALUE; + throttlePosition = -Double.MAX_VALUE; + speed = 0; + } + +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/SubCategory.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/SubCategory.java new file mode 100644 index 0000000000..fb210ef0f9 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/SubCategory.java @@ -0,0 +1,59 @@ +package com.autonavi.nge.obj; + +import android.os.Parcel; +import android.os.Parcelable; + +public class SubCategory implements Parcelable{ + + public static final Creator CREATOR = new Creator() { + @Override + public SubCategory[] newArray(int size) { + + return new SubCategory[size]; + } + + @Override + public SubCategory createFromParcel(Parcel in) { + SubCategory subCategory = new SubCategory(); + subCategory.setKindId(in.readInt()); + subCategory.setCatName(in.readString()); + return subCategory; + } + + }; + + int m_iKindId = 0; + String m_sCatName = ""; + + public int getKindId() { + return m_iKindId; + } + + public String getCatName() { + return m_sCatName; + } + + public void setKindId(int iKindId) { + this.m_iKindId = iKindId; + } + + public void setCatName(String sCatName) { + this.m_sCatName = sCatName; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel out, int arg1) { + out.writeInt(m_iKindId); + out.writeString(m_sCatName); + } + + public void readFromParcel(Parcel in) { + m_iKindId = in.readInt(); + m_sCatName = in.readString(); + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/UpdateRegion.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/UpdateRegion.java new file mode 100644 index 0000000000..4a7dc24397 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/obj/UpdateRegion.java @@ -0,0 +1,81 @@ +package com.autonavi.nge.obj; + +import android.os.Parcel; +import android.os.Parcelable; + +public class UpdateRegion implements Parcelable{ + + public static final Creator CREATOR = new Creator() { + + @Override + public UpdateRegion[] newArray(int size) { + + return new UpdateRegion[size]; + } + + @Override + public UpdateRegion createFromParcel(Parcel in) { + UpdateRegion updateRegion = new UpdateRegion(); + updateRegion.setUrId(in.readInt()); + updateRegion.setUrNameId(in.readInt()); + updateRegion.setUrName(in.readString()); + return updateRegion; + } + + }; + + int m_urId; + int m_urNameId; + String m_urName; + + public int getUrId() { + return m_urId; + } + + public void setUrId(int urId) { + this.m_urId = urId; + } + + public int getUrNameId() { + return m_urNameId; + } + + public void setUrNameId(int urNameId) { + this.m_urNameId = urNameId; + } + + public String getUrName() { + return m_urName; + } + + public void setUrName(String urName) { + this.m_urName = urName; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel out, int arg1) { + out.writeInt(m_urId); + out.writeInt(m_urNameId); + out.writeString(m_urName); + } + + public void readFromParcel(Parcel in) { + m_urId = in.readInt(); + m_urNameId = in.readInt(); + m_urName = in.readString(); + } + + @Override + public String toString() { + return "UpdateRegion{" + + "m_urId=" + m_urId + + ", m_urNameId=" + m_urNameId + + ", m_urName='" + m_urName + '\'' + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/routeinfo/RouteInfoProvider.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/routeinfo/RouteInfoProvider.java new file mode 100644 index 0000000000..55054370b6 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/routeinfo/RouteInfoProvider.java @@ -0,0 +1,39 @@ +package com.autonavi.nge.routeinfo; + +import android.os.Environment; +import android.util.Log; + +import com.zhidaoauto.map.sdk.inner.CompileConfig; + +public class RouteInfoProvider { + + { + System.loadLibrary("map"); + } + + + private static final String TAG = "RouteInfoProvider"; + + public RouteInfoProvider() { + if (CompileConfig.INSTANCE.getDEBUG()) { + Log.i(TAG, "roadop load database"); + } + + String shmdataDir = Environment.getExternalStorageDirectory().getAbsolutePath() + "/shmdata/"; + RouteInfoProvider.init(shmdataDir); + } + + private native static boolean init(String dir); + @Deprecated + public native String getRouteInfo(float centerLon, float centerLat,int type, int nFuncClass); + @Deprecated + public native float getRouteAngle(float startLon, float startLat,float endLon, float endLat); + @Deprecated + public native double [] matchPointOnRoad(double[] allPoint, boolean bGetAllPoints); + @Deprecated + public native String matchSinglePointOnRoad(float fLon, float fLat, float fAngle); + + public native String matchHDSinglePointOnRoad(double fLon, double fLat, float fAngle, float fDistance, float fDetaAngle, boolean isZeroNo); + public native double getOffRoadDistance(double dLon, double dLat, double dAngle); + public native static void release(); +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/routing/RoutingProvider.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/routing/RoutingProvider.java new file mode 100644 index 0000000000..239e8fba59 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/routing/RoutingProvider.java @@ -0,0 +1,178 @@ +package com.autonavi.nge.routing; + +import android.util.Log; + +import com.autonavi.nge.trafficInfo.TMCID; +import com.zhidaoauto.map.sdk.inner.CompileConfig; +import com.zhidaoauto.map.sdk.inner.utils.Constant; + +import java.util.List; + +public class RoutingProvider { + + private static final String TAG = "RoutingProvider"; + + // cost model + public static final int COSTMODEL_DEFAULT = 0; // default cost model + public static final int COSTMODEL_FASTEST = 1; // fast test cost model, consider eta mostly + public static final int COSTMODEL_SHORTEST = 2; // shortest cost model, consider distance mostly + public static final int COSTMODEL_SUGGEST = 3; // suggested cost model, consider varius factors + public static final int COSTMODEL_ECO = 4; // eco cost model ,consider economy factor mostly + + // route style definition + public static final int ROUTESTYLE_DEFAULT = 0; // default route style + public static final int ROUTESTYLE_VEHICLE = 1; // vehicle route style + public static final int ROUTESTYLE_PEDESTRIAN = 2; // pedestrian route style, for walking + public static final int ROUTESTYLE_BICYCLE = 3; // bicycle route style + public static final int ROUTESTYLE_TRUCK = 4; // truck route style + + private boolean enableAlter = false; + + public RoutingProvider() { + String dir = Constant.getNDSDataPath(); + load(dir, "autonavi", null); + //setloglevel(1, 4); + } + + { +// System.loadLibrary("datascript"); +// System.loadLibrary("ndssqlite"); +// System.loadLibrary("ndssystem"); +// System.loadLibrary("ndsprovider"); +// System.loadLibrary("datamgr"); + System.loadLibrary("routing"); +// System.loadLibrary("pbjni"); + } + + public void destroyProvider() { unload(); } + + public void setOrigin(double lon, double lat, int sessionid) { + setorigin(lon, lat, -1, sessionid); + //setloglevel(1, 4); + } + + public void setDest(double lon, double lat, int sessionid) { + setdest(lon, lat, sessionid); + } + public void getRoute(int sessionid) { + if (CompileConfig.INSTANCE.getDEBUG()) { + Log.i(TAG, "navop-getRoute:start:sessionid:"+sessionid); + } + if (enableAlter) { + startnavi(1, sessionid); + } else { + startnavi(0, sessionid); + } + if (CompileConfig.INSTANCE.getDEBUG()) { + Log.i(TAG, "navop-getRoute:end:sessionid:"+sessionid); + } + } + + public void setCostModel(int costmodel, int sessionid) { + setcostmodel(costmodel, sessionid); + } + + public void setRouteStyle(int costmodel, int sessionid) { + setroutestyle(costmodel, sessionid); + } + + public void setAvoidHighway(boolean avoidHwy, int sessionid) { + if (avoidHwy) { + setavoidhighway(1, sessionid); + } else { + setavoidhighway(0, sessionid); + } + } + + public void setAvoidToll(boolean avoidToll, int sessionid) { + if (avoidToll) { + setavoidtoll(1, sessionid); + } else { + setavoidtoll(0, sessionid); + } + } + + public void setUseTraffic(boolean useTraffic, int sessionid) { + if (useTraffic) { + setusetraffic(1, sessionid); + } else { + setusetraffic(0, sessionid); + } + } + + public int getRouteNum(int sessionid) { + return getroutenum(sessionid); + } + + public int getLength(int route, int sessionid) { + return getlength(route, sessionid); + } + + // get static time + public int getSTime(int route, int sessionid) { + return getstime(route, sessionid); + } + + // get dynamic time + public int getDTime(int route, int sessionid) { + return getdtime(route, sessionid); + } + + public void setTrafStat(List ids, int evt) { + int[] tmcs = new int[ids.size()]; + byte[] dirs = new byte[ids.size()]; + + for (int i = 0; i < ids.size(); i++) { + tmcs[i] = ids.get(i).getId(); + dirs[i] = ids.get(i).getDir(); + } + + settrafstat(tmcs, dirs, evt); + } + + public void setTrafSpeedByTile(int tile, int[] ids, byte[] speeds) { + settrafspeedbytile(tile, ids, speeds); + } + + public void addWayPoint(float lon, float lat, int heading, int sessionid){ + addwaypoint(lon, lat, heading, sessionid); + } + + public void clearWayPoints(int sessionid){ + clearwaypoints(sessionid); + } + + + private native static void setavoidtoll(boolean avoidtoll); + private native static void setroutestyle(int routestyle); + + public boolean getStatus(int sessionid) { return getstatus(sessionid); } + public void reset(int sessionid) { resetnavi(sessionid); } + public void clearTour(int sessionid) { cleartour(sessionid); } + + + private native static boolean load(String dir, String vendor, String region); + private native static void unload(); + private native static void setorigin(double lon, double lat, int heading, int sessionid); + private native static void setdest(double lon, double lat, int sessionid); + private native static void addwaypoint(float lon, float lat, int heading, int sessionid); + private native static void clearwaypoints(int sessionid); + private native static void setpreferroad(String roadname, int sessionid); + private native static void startnavi(int isalter, int sessionid); + private native static boolean getstatus(int sessionid); + private native static void resetnavi(int sessionid); + private native static void cleartour(int sessionid); + private native static void setcostmodel(int costmodel, int sessionid); + private native static void setavoidhighway(int avoidhwy, int sessionid); + private native static void setavoidtoll(int avoidtoll, int sessionid); + private native static void setroutestyle(int routestyle, int sessionid); + private native static void setusetraffic(int usetraffic, int sessionid); + private native static int getroutenum(int sessionid); + private native static int getlength(int route, int sessionid); + private native static int getstime(int route, int sessionid); + private native static int getdtime(int route, int sessionid); + private native static void settrafstat(int[] ids, byte[] dirs, int evt); + private native static void settrafspeedbytile(int tile, int[] ids, byte[] speeds); + private native static void setloglevel(int appender, int level); + public native static int getsearchedcnt(int route, int sessionid); +} /// class RoutingProvider diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPCategories.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPCategories.java new file mode 100644 index 0000000000..978024538f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPCategories.java @@ -0,0 +1,55 @@ +package com.autonavi.nge.search; + +import android.os.Parcel; +import android.os.Parcelable; +import android.util.Pair; + +import java.io.Serializable; +import java.util.List; + +public class SPCategories implements Parcelable, Serializable { + private List> categories; + + + public SPCategories() { + } + + protected SPCategories(Parcel in) { + } + + public static final Creator CREATOR = new Creator() { + @Override + public SPCategories createFromParcel(Parcel in) { + return new SPCategories(in); + } + + @Override + public SPCategories[] newArray(int size) { + return new SPCategories[size]; + } + }; + + public List> getCategories() { + return categories; + } + + public void setCategories(List> categories) { + this.categories = categories; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + } + + @Override + public String toString() { + return "SPCategories{" + + "categories=" + categories + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPConstants.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPConstants.java new file mode 100644 index 0000000000..7af012c3e1 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPConstants.java @@ -0,0 +1,20 @@ +package com.autonavi.nge.search; + +public final class SPConstants { + // 语言码 + public static int LANGUAGE_CODE_ZH_CN = 31; + public static int LANGUAGE_CODE_EN = 182; + + // 检索关键字的类型。NOTE: 注释的部分为暂时不支持的检索方式 + public static int SEARCH_TYPE_POI = 0; + public static int SEARCH_TYPE_POI_NAME = 1; +// public static int SEARCH_TYPE_POI_ADDRESS = 2; + public static int SEARCH_TYPE_POI_TELEPHONE = 3; +// public static int SEARCH_TYPE_POI_POSTCODE = 4; +// public static int SEARCH_TYPE_ROAD = 5; +// public static int SEARCH_TYPE_ROAD_NAME = 6; +// public static int SEARCH_TYPE_CROSS_ROAD = 7; +// public static int SEARCH_TYPE_ADMIN = 8; +// public static int SEARCH_TYPE_FTS_BOUND = 9; +// public static int SEARCH_TYPE_POI_BOUND = 10; +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPLatLonPoint.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPLatLonPoint.java new file mode 100644 index 0000000000..bdd9cf174f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPLatLonPoint.java @@ -0,0 +1,65 @@ +package com.autonavi.nge.search; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.io.Serializable; + +public class SPLatLonPoint implements Parcelable, Serializable { + public float lat; + public float lon; + public SPLatLonPoint(float lat, float lon) { + this.lat = lat; + this.lon = lon; + } + + public SPLatLonPoint(double lat, double lon) { + this((float)lat,(float)lon); + } + + public SPLatLonPoint(int latE6, int lonE6) { + this.lat = E6ToDMS(latE6); + this.lon = E6ToDMS(lonE6); + } + + protected SPLatLonPoint(Parcel in) { + lat = in.readFloat(); + lon = in.readFloat(); + } + + public static final Creator CREATOR = new Creator() { + @Override + public SPLatLonPoint createFromParcel(Parcel in) { + return new SPLatLonPoint(in); + } + + @Override + public SPLatLonPoint[] newArray(int size) { + return new SPLatLonPoint[size]; + } + }; + + @Override + public String toString() { + return String.format("(%.7f, %.7f)", lon, lat); + } + + /** + * 将 E6 标准的经纬度转换成 DMS 标准 + * @param lonOrLat 经纬度 + */ + private static float E6ToDMS(int lonOrLat) { + return lonOrLat / 1e6f; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeFloat(lat); + dest.writeFloat(lon); + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPPoiItem.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPPoiItem.java new file mode 100644 index 0000000000..09ae10538d --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPPoiItem.java @@ -0,0 +1,68 @@ +package com.autonavi.nge.search; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.io.Serializable; + +public class SPPoiItem implements Parcelable,Serializable { + public int poiId; + public int kind; + public SPLatLonPoint location; // 经纬度 + public String title; // 名字 + public String snippet; // 地址 + public String tel; // 电话 + public String postcode; // 邮编 + + public SPPoiItem() { + } + + protected SPPoiItem(Parcel in) { + poiId = in.readInt(); + kind = in.readInt(); + title = in.readString(); + snippet = in.readString(); + tel = in.readString(); + postcode = in.readString(); + } + + public static final Creator CREATOR = new Creator() { + @Override + public SPPoiItem createFromParcel(Parcel in) { + return new SPPoiItem(in); + } + + @Override + public SPPoiItem[] newArray(int size) { + return new SPPoiItem[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(poiId); + dest.writeInt(kind); + dest.writeString(title); + dest.writeString(snippet); + dest.writeString(tel); + dest.writeString(postcode); + } + + @Override + public String toString() { + return "SPPoiItem{" + + "poiId=" + poiId + + ", kind=" + kind + + ", location=" + location + + ", title='" + title + '\'' + + ", snippet='" + snippet + '\'' + + ", tel='" + tel + '\'' + + ", postcode='" + postcode + '\'' + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPQuery.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPQuery.java new file mode 100644 index 0000000000..f9d0859baf --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPQuery.java @@ -0,0 +1,90 @@ +package com.autonavi.nge.search; + +import android.os.Parcel; +import android.os.Parcelable; +import android.text.TextUtils; + +import java.io.Serializable; + +public class SPQuery implements Parcelable, Serializable { + // 每页最多有多少个数据 + private static int PAGE_SIZE_LIMIT = 50; + + // 检索关键字 + public String keyword = null; + // 检索范围。通过指定范围即可获取某个点附近的poi + public SPSearchBound bound = null; + // 检索的类型 + public int searchType = SPConstants.SEARCH_TYPE_POI; + // 分页大小 + public int pageSize = 10; + // 0 表示从头开始。其他值,表示上一次查询结果里面 poiId 的最大值 + public int pageStart = 0; + // 语种。(NOTE: 该参数目前为保留参数。修改也无实际效果) + public int languageCode = SPConstants.LANGUAGE_CODE_ZH_CN; + // 分类。0 表示不限制 + public int categoryId = 0; + // 限制搜索的区域 null 表示全国,"北京市" 这样的表示指定城市,"昌平区,北京市" 这样的表示更具体的区级别指定 + // 在指定了 bound 的情况下,将忽略 region 参数 + public String region = null; + + public SPQuery() { + } + + protected SPQuery(Parcel in) { + keyword = in.readString(); + searchType = in.readInt(); + pageSize = in.readInt(); + pageStart = in.readInt(); + languageCode = in.readInt(); + categoryId = in.readInt(); + region = in.readString(); + } + + public static final Creator CREATOR = new Creator() { + @Override + public SPQuery createFromParcel(Parcel in) { + return new SPQuery(in); + } + + @Override + public SPQuery[] newArray(int size) { + return new SPQuery[size]; + } + }; + + public boolean isValid() { + if (bound != null && !bound.isValid()) return false; + return (pageSize > 0 && pageSize <= PAGE_SIZE_LIMIT && pageStart >= 0 && !TextUtils.isEmpty(keyword)); + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeString(keyword); + dest.writeInt(searchType); + dest.writeInt(pageSize); + dest.writeInt(pageStart); + dest.writeInt(languageCode); + dest.writeInt(categoryId); + dest.writeString(region); + } + + @Override + public String toString() { + return "SPQuery{" + + "keyword='" + keyword + '\'' + + ", bound=" + bound + + ", searchType=" + searchType + + ", pageSize=" + pageSize + + ", pageStart=" + pageStart + + ", languageCode=" + languageCode + + ", categoryId=" + categoryId + + ", region='" + region + '\'' + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPSearchBound.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPSearchBound.java new file mode 100644 index 0000000000..5c269d5340 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPSearchBound.java @@ -0,0 +1,189 @@ +package com.autonavi.nge.search; + + +import android.os.Parcel; +import android.os.Parcelable; + +import androidx.annotation.NonNull; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.List; + +public class SPSearchBound implements Parcelable, Serializable { + protected SPSearchBound(Parcel in) { + this.shape = NONE; + points = null; + } + + public SPSearchBound() { + this.shape = NONE; + points = null; + } + + public static final Creator CREATOR = new Creator() { + @Override + public SPSearchBound createFromParcel(Parcel in) { + return new SPSearchBound(in); + } + + @Override + public SPSearchBound[] newArray(int size) { + return new SPSearchBound[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel dest, int flags) { + } + + public static final int CIRCLE = 0; + public static final int RECT = 1; + public static final int POLYGON = 2; + public static final int NONE = 3; + + public final int shape; + public final SPLatLonPoint[] points; + + // 可以用来配置最大允许的检索范围上限 + // 目前建议不要超过 3000m 否则会对速度有影响 + public float maxDistance = 3000; + + /** + * 圆形检索。或者用于检索距离一个目标点附近的点并按距离排序 + * @param center + * @param m 需要大于 0 + * @param isSortByDistance + */ + public SPSearchBound(@NonNull final SPLatLonPoint center, float m, boolean isSortByDistance) { + this.shape = SPSearchBound.CIRCLE; + points = new SPLatLonPoint[2]; + points[0] = center; + points[1] = new SPLatLonPoint(m, isSortByDistance ? 1f : 0f); + } + + public SPSearchBound(@NonNull final SPLatLonPoint leftBottom, @NonNull final SPLatLonPoint rightTop) { + this.shape = SPSearchBound.RECT; + points = new SPLatLonPoint[2]; + points[0] = leftBottom; + points[1] = rightTop; + } + + /** + * 需要是凸多边形 + * @param points + */ + public SPSearchBound(@NonNull final List points) { + this.shape = SPSearchBound.POLYGON; + this.points = new SPLatLonPoint[points.size()]; + for (int i = 0; i < points.size(); ++i) { + this.points[i] = points.get(i); + } + } + + /** + * 判定参数是否有效。包含了最大点距离检测,是否为凸多边形 + * @return + */ + public boolean isValid() { + switch (this.shape) { + case SPSearchBound.CIRCLE: + return isValidCircle(); + case SPSearchBound.RECT: + return isValidRect(); + case SPSearchBound.POLYGON: + return isValidPolygon(); + } + return false; + } + + /** + * 通过经纬度的差值求距离 + * @param deltaDegree + * @return 距离单位为 + */ + static public float getDistance(float deltaDegree) { + return (40075e3f * deltaDegree) / 360; + } + + /** + * 判断一组点是否能组成凸多边形 + * @param points + * @return + */ + static public boolean isConvexPolygon(@NonNull final SPLatLonPoint[] points) { + int n = points.length; + if (n < 3) return false; + + // 先根据获取到的一个非0 向量叉积来定义点是顺是真还是逆时针的 + int dir = 0; + for (int i = 0; i < n; ++i) { + SPLatLonPoint a = points[i]; + SPLatLonPoint b = points[(i + 1) % n]; + SPLatLonPoint c = points[(i + 2) % n]; + + // 求叉积 + double t = (double)(a.lon - c.lon) * (double)(b.lat - c.lat) - (double)(b.lon - c.lon) * (double)(a.lat - c.lat); + // 浮点数计算是有误差的。如果t的绝对值小于一个预订值,我们就认为他是0 + if (Math.abs(t) < 0.0000001) continue; + // 定下来点排列的方向 + if (dir == 0) { + // 三个点称顺时针排列 + if (t < 0) { + dir = -1; + } else { + dir = 1; + } + } + // 和第一组有顺逆时针方向的点趋势不一致的时候就可以断定非凸多边形 + if ((t * dir) < 0) return false; + } + return dir != 0; + } + + private boolean isValidCircle() { + // 检测半径是否超了 + float r = points[1].lat; + return r > 0 && r <= maxDistance; + } + + private boolean isValidRect() { + // 判断点的位置是否正确 + SPLatLonPoint lb = points[0]; + SPLatLonPoint rt = points[1]; + if (lb.lat >= rt.lat || lb.lon >= rt.lon) return false; + + // 判定距离是否合法 + float d2 = maxDistance + maxDistance; + return getDistance(rt.lat - lb.lat) <= d2 && getDistance(rt.lon - lb.lon) <= d2; + } + + private boolean isValidPolygon() { + // 先检测是否是凸多边形 + if (!isConvexPolygon(points)) return false; + // 检测点和点之间的距离。作为最大允许的圆形范围的内接多边形检测距离 + double d22 = Math.pow(maxDistance + maxDistance, 2); + for (int i = 0; i < points.length - 1; ++i) { + SPLatLonPoint a = points[i]; + for (int j = i + 1; j < points.length; ++j) { + SPLatLonPoint b = points[j]; + if (Math.pow((a.lat - b.lat), 2) + Math.pow((a.lon - b.lon), 2) > d22) return false; + } + } + return true; + } + + @Override + public String toString() { + return "SPSearchBound{" + + "shape=" + shape + + ", points=" + Arrays.toString(points) + + ", maxDistance=" + maxDistance + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPSearchResult.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPSearchResult.java new file mode 100644 index 0000000000..6be5fe2903 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SPSearchResult.java @@ -0,0 +1,55 @@ +package com.autonavi.nge.search; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.io.Serializable; + +public final class SPSearchResult implements Parcelable, Serializable { + // poi 信息 + public SPPoiItem poi; + // 排序用 ID + public int orderId; + + public SPSearchResult(SPPoiItem item, int orderId) { + this.orderId = orderId; + this.poi = item; + } + + protected SPSearchResult(Parcel in) { + poi = in.readParcelable(SPPoiItem.class.getClassLoader()); + orderId = in.readInt(); + } + + public static final Creator CREATOR = new Creator() { + @Override + public SPSearchResult createFromParcel(Parcel in) { + return new SPSearchResult(in); + } + + @Override + public SPSearchResult[] newArray(int size) { + return new SPSearchResult[size]; + } + }; + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel parcel, int i) { + parcel.writeParcelable(poi, i); + parcel.writeInt(orderId); + } + + @Override + public String toString() { + return "SPSearchResult{" + + "poi=" + poi + + ", orderId=" + orderId + + '}'; + } +} + diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SearchAutoApi.kt b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SearchAutoApi.kt new file mode 100644 index 0000000000..51b8fc79a6 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SearchAutoApi.kt @@ -0,0 +1,14 @@ +//package com.autonavi.nge.search +// +//import com.autonavi.nge.dm.NavigationCore +//import com.autonavi.nge.dm.SharedMemoryService +//import com.zhidaoauto.map.sdk.inner.controller.CommonController +// +//object SearchAutoApi { +// +// fun init(){ +// if(CommonController.instance.iNavigationCore == null){ +// CommonController.instance.iNavigationCore = NavigationCore(SharedMemoryService.getInstance()) +// }s +// } +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SearchProvider.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SearchProvider.java new file mode 100644 index 0000000000..bde268342f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/search/SearchProvider.java @@ -0,0 +1,173 @@ +package com.autonavi.nge.search; + +import android.util.Log; +import android.util.Pair; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import com.zhidaoauto.map.sdk.inner.CompileConfig; + +import java.io.UnsupportedEncodingException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.util.ArrayList; +import java.util.List; + +public class SearchProvider { + + private static final String TAG = "SearchProvider"; + + { + System.loadLibrary("datamgr"); + System.loadLibrary("search"); + } + + public SearchProvider() { + + if(CompileConfig.INSTANCE.getDEBUG()){ + Log.i(TAG, "searchop--SearchProvider load start"); + } + load(); + if(CompileConfig.INSTANCE.getDEBUG()){ + Log.i(TAG, "searchop--SearchProvider load over"); + } + } + + /** + * 初始化。使用所有接口前应先调用该接口 + */ + public static void load() { + init(); + } + + /** + * 释放数据 + */ + public static void unload() { + release(); + } + + /** + * 获取所有分类列表。应在初始化的时候调用一次 + * @param languageCode SPConstants.LANGUAGE_CODE_xxx + * @return 返回 categoryId, categoryName 组成的列表 + */ + public synchronized static @Nullable + List> getAllPoiCategories(int languageCode) { + byte[] data = queryAllPoiCategories(languageCode); + return parseIntStrPairList(bytes2ByteBuffer(data)); + } + + public synchronized static @Nullable List getPoiItemList(@NonNull final SPQuery query) { + // 参数检测 + if (!query.isValid()) { + return null; + } + if (CompileConfig.INSTANCE.getDEBUG()) { + Log.i(TAG, "searchop--getPoiItemList--start--"+query); + } + + byte[] data = queryPoiItemList(query); + if (CompileConfig.INSTANCE.getDEBUG()) { + Log.i(TAG, "searchop--getPoiItemList--end--"+Thread.currentThread().getId()); + } + return parseSPSearchResultList(bytes2ByteBuffer(data)); + } + + public synchronized static @Nullable SPPoiItem getPoiItemByPoiId(int poiId) { + byte[] data = queryPoiItemByPoiId(poiId); + return parseSPPoiItem(bytes2ByteBuffer(data)); + } + + /// private methods + private static String buf2Str(final ByteBuffer buf) { + int l = buf.getShort(); + String ret = null; + if (l > 0) { + byte[] tmp = new byte[l]; + for (int idx = 0; idx < l; idx++) { + tmp[idx] = (byte) buf.get(); + } + try { + ret = new String(tmp, "UTF8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + return ret; + } + + private static ByteBuffer bytes2ByteBuffer(final byte[] data) { + // 对数据进行格式化 + if (data == null || data.length < 1) { + return null; + } + + ByteBuffer buf = ByteBuffer.wrap(data); + buf.order(ByteOrder.LITTLE_ENDIAN); + return buf; + } + + private static SPPoiItem parseSPPoiItem(final ByteBuffer buf) { + if (buf == null) { + return null; + } + + SPPoiItem item = new SPPoiItem(); + item.poiId = buf.getInt(); + item.kind = buf.getInt(); + item.location = new SPLatLonPoint(buf.getInt(), buf.getInt()); + item.title = buf2Str(buf); + item.snippet = buf2Str(buf); + item.tel = buf2Str(buf); + item.postcode = buf2Str(buf); + return item; + } + + private static SPSearchResult parseSPSearchResult(final ByteBuffer buf) { + SPPoiItem item = parseSPPoiItem(buf); + if (item == null) return null; + return new SPSearchResult(item, buf.getInt()); + } + + private static List parseSPSearchResultList(final ByteBuffer buf) { + if (buf == null) { + return null; + } + int itemCount = buf.getInt(); + + List ret = new ArrayList(itemCount); + while (itemCount --> 0) { + ret.add(parseSPSearchResult(buf)); + } + return ret; + } + + private static Pair parseIntStrPair(final ByteBuffer buf) { + if (buf == null) { + return null; + } + return new Pair(new Integer(buf.getInt()), buf2Str(buf)); + } + + private static List> parseIntStrPairList(final ByteBuffer buf) { + if (buf == null) { + return null; + } + int cnt = buf.getInt(); + + List> ret = new ArrayList>(cnt); + while (cnt --> 0) { + ret.add(parseIntStrPair(buf)); + } + return ret; + } + + /// native methods + private static native boolean init(); + private static native void release(); + private static native byte[] queryPoiItemList(SPQuery query); + private static native byte[] queryPoiItemByPoiId(int poiId); + private static native byte[] queryAllPoiCategories(int languageCode); +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/autonavi/nge/trafficInfo/TMCID.java b/libraries/mapmodule/src/main/java/com/autonavi/nge/trafficInfo/TMCID.java new file mode 100644 index 0000000000..0c20808bdc --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/autonavi/nge/trafficInfo/TMCID.java @@ -0,0 +1,58 @@ +package com.autonavi.nge.trafficInfo; + +import android.os.Parcel; +import android.os.Parcelable; + +public class TMCID implements Parcelable{ + + public static final Creator CREATOR = new Creator() { + public TMCID createFromParcel(Parcel in) { + TMCID id = new TMCID(); + id.setId(in.readInt()); + id.setDir(in.readByte()); + return id; + } + + public TMCID[] newArray(int size) { + return new TMCID[size]; + } + }; + + private int id; + private byte dir; + + public TMCID(int id, byte dir) { + this.id = id; + this.dir = dir; + } + + public TMCID() { + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel arg0, int arg1) { + arg0.writeInt(id); + arg0.writeByte(dir); + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public byte getDir() { + return dir; + } + + public void setDir(byte dir) { + this.dir = dir; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/CompileConfig.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/CompileConfig.kt new file mode 100644 index 0000000000..54c504d14f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/CompileConfig.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.inner + +import com.zhidaoauto.map.sdk.inner.common.MapHelper + +object CompileConfig { + var DEBUG = MapHelper.debug + + fun setDebug(debug: Boolean){ + DEBUG = debug + + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/CancelableCallback.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/CancelableCallback.kt new file mode 100644 index 0000000000..b5cb39e70c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/CancelableCallback.kt @@ -0,0 +1,6 @@ +package com.zhidaoauto.map.sdk.inner.abs + +interface CancelableCallback { + fun onFinish() + fun onCancel() +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IEventController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IEventController.kt new file mode 100644 index 0000000000..baf541820f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IEventController.kt @@ -0,0 +1,90 @@ +package com.zhidaoauto.map.sdk.inner.abs + +import android.graphics.Bitmap +import android.view.MotionEvent +import com.autonavi.nge.map.OnMapScreenShotListener +import com.zhidaoauto.map.sdk.open.abs.MapStatusListener +import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener +import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener +import com.zhidaoauto.map.sdk.open.abs.OnMapChangeListener +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.abs.OnMapViewVisualAngleChangeListener +import com.zhidaoauto.map.sdk.open.abs.OnRenderListener +import com.zhidaoauto.map.sdk.open.abs.OnRoadInfoListener +import com.zhidaoauto.map.sdk.open.abs.OnRoamStatusListener +import com.zhidaoauto.map.sdk.open.abs.OnScrollListener +import com.zhidaoauto.map.sdk.open.abs.log.ILog +import com.zhidaoauto.map.sdk.open.camera.CameraPosition +import com.zhidaoauto.map.sdk.open.location.MogoLocation +import com.zhidaoauto.map.sdk.open.marker.Marker +import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.road.RoadCross +import com.zhidaoauto.map.sdk.open.road.StopLine + +interface IEventController { + + fun exit() + fun addHdDataDownListener(id: Int, onHdDataDownByCityListener: OnHdDataDownByCityListener) + fun removeHdDataDownListener(id: Int) + fun dispatchHdDataDownListener(id: Int, progress: Double) + fun dispatchHdDataDownStateListener(id: Int, state: Int) + fun addCameraChangeListener(cameraChangeListener: OnCameraChangeListener) + fun removeCameraChangeListener(cameraChangeListener: OnCameraChangeListener) + fun dispatchCameraChangeListener(type: Int, value: Int) + fun dispatchCameraChangeFinishListener(position: CameraPosition?) + fun addMapTouchListener(mapTouchListener: OnMapTouchListener) + fun removeMapTouchListener(mapTouchListener: OnMapTouchListener) + fun dispatchMapTouchListener(event: MotionEvent?): Boolean + fun isMapTouchListenerListEmpty(): Boolean + fun addMapClickListener(mapClickListener: OnMapClickListener) + fun removeMapClickListener(mapClickListener: OnMapClickListener) + fun dispatchMapClickListener(lonLatPoint: LonLatPoint) + fun addMapLoadedListener(mapLoadedListener: OnMapLoadedListener) + fun removeMapLoadedListener(mapLoadedListener: OnMapLoadedListener) + fun dispatchMapLoadedInitListener() + fun dispatchMapLoadedListener() + fun dispatchRoadLoadedListener(roadInfo: String?) + fun addMapViewVisualAngleChangeListener(mapViewVisualAngleChangeListener: OnMapViewVisualAngleChangeListener) + fun removeMapViewVisualAngleChangeListener(mapViewVisualAngleChangeListener: OnMapViewVisualAngleChangeListener) + fun dispatchMapViewVisualAngleChangeListener(type: Int) + fun addScrollListener(scrollListener: OnScrollListener) + fun removeScrollListener(scrollListener: OnScrollListener) + fun dispatchScrollListener(x: Double, y: Double) + fun addMapStyleListener(mapStyleListener: OnMapStyleListener) + fun removeMapStyleListener(mapStyleListener: OnMapStyleListener) + fun dispatchMapStyleListener(type: Int) + fun addScreenShotListener(screenShotListener: OnMapScreenShotListener) + fun removeScreenShotListener(screenShotListener: OnMapScreenShotListener) + fun dispatchScreenShotListener(bitmap: Bitmap?) + fun addMapChangeListener(mapChangeListener: OnMapChangeListener) + fun removeMapChangeListener(mapChangeListener: OnMapChangeListener) + fun dispatchMapChangeListener(mogoLocation: MogoLocation) + fun addMarkClickListener(markClickListener: OnMarkClickListener) + fun removeMarkClickListener(markClickListener: OnMarkClickListener) + fun dispatchMarkClickListener(marker: Marker) + fun isMarkClickListenerListEmpty():Boolean + fun addMapStatusListener(mapStatusListener: MapStatusListener, type: Int) + fun removeMapStatusListener(mapStatusListener: MapStatusListener, type: Int) + fun dispatchMapStatusListener(type:Int, value: Int) + fun addRenderListener(renderListener : OnRenderListener) + fun removeRenderListener(renderListener : OnRenderListener) + fun dispatchRenderListener(duration:Int) + fun addRoadInfoListener(roadInfoListener: OnRoadInfoListener) + fun removeRoadInfoListener(roadInfoListener : OnRoadInfoListener) + fun dispatchStopLineInfo(stopLine: StopLine?) + fun dispatchRoadIdInfo(roadId: String?, laneId: String?) + fun dispatchRoadCrossInfo(roadCross: RoadCross?) + fun addLogListener(listener: ILog) + fun removeLogListener(listener : ILog) + fun dispatchLog(path: String) + + fun addRoamStatusListener(onRoamStatusListener: OnRoamStatusListener) + + fun removeRoamStatusListener(onRoamStatusListener: OnRoamStatusListener) + + fun dispatchRoamStatusListener(status: Int, msg: String) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/ILocationView.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/ILocationView.kt new file mode 100644 index 0000000000..3f0a3bc079 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/ILocationView.kt @@ -0,0 +1,14 @@ +package com.zhidaoauto.map.sdk.inner.abs + +import com.zhidaoauto.map.sdk.open.location.MyLocationStyle + +interface ILocationView { + + + fun setMyLocationEnabled(myLocationEnabled: Boolean) + fun getMyLocationEnabled(): Boolean + fun setMyLocationStyle(myLocationStyle: MyLocationStyle) + fun getMyLocationStyle(): MyLocationStyle? + fun switch(style: Int) + fun exit() +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/ILockLocation.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/ILockLocation.kt new file mode 100644 index 0000000000..862d65d759 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/ILockLocation.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.inner.abs + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +interface ILockLocation { + fun setLockCar(lock: Boolean) + fun getLockCar(): Boolean + fun getCurrentLonLatPoint(): LonLatPoint + fun getLastUpdateTime(): Long + fun getAgainLastUpdateTime(): Long + fun switchStyle(style : Int) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/ILonLatProxy.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/ILonLatProxy.kt new file mode 100644 index 0000000000..b694cc6687 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/ILonLatProxy.kt @@ -0,0 +1,9 @@ +package com.zhidaoauto.map.sdk.inner.abs + +import com.autonavi.nge.map.LonLat +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +interface ILonLatProxy { + open fun switchLonLat(lonLat: LonLat):LonLatPoint + open fun switchLonLat(lonLatPoint: LonLatPoint):LonLat +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IMapController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IMapController.kt new file mode 100644 index 0000000000..b241378ebd --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IMapController.kt @@ -0,0 +1,466 @@ +package com.zhidaoauto.map.sdk.inner.abs + +import android.content.Context +import android.graphics.Bitmap +import android.view.View +import com.autonavi.nge.map.LonLat +import com.autonavi.nge.map.OnMapScreenShotListener +import com.autonavi.nge.map.Pixels +import com.zhidaoauto.map.sdk.inner.element.MapCoordinate +import com.zhidaoauto.map.sdk.inner.use.Clerk +import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener +import com.zhidaoauto.map.sdk.open.abs.view.IMapStyleParams +import com.zhidaoauto.map.sdk.open.circle.CircleController +import com.zhidaoauto.map.sdk.open.circle.CircleOptions +import com.zhidaoauto.map.sdk.open.deadzone.DeadZone +import com.zhidaoauto.map.sdk.open.deadzone.DeadZoneOptions +import com.zhidaoauto.map.sdk.open.poyline.Polyline +import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.weather.WeatherResult +import kotlinx.coroutines.CoroutineScope + +interface IMapController { + + //init相关 + fun getContext():Context? + fun setMarkerCall(markerCall:IMarkerCall) + fun setLocalView(localView: ILocationView?) + fun getMarkerCall():IMarkerCall? + fun getMapStyleParams(): IMapStyleParams + fun getClerk():Clerk? + + fun setMarkerController(markerController:IMarkerController?) + fun getMarkerController():IMarkerController? + + //The controller of event + fun getEventController():IEventController? + + fun isSurfaceCreated():Boolean + + //search相关 + fun clearSearchResult() + + // MapView相关 + fun lookUpDown() + fun setDAngle(r: Float) + fun getCarPosition(pos: MapCoordinate?): Int + fun rotate(rotateAngle: Float) + fun updateCar(lon: Long, lat: Long, z: Int, r: Int, carResId: Int) + fun updateCar(lon: Long, lat: Long, z: Int, r: Int, bitmap: Bitmap) + fun updateCar(lon: Long, lat: Long, z: Short, angle: Short) + fun getFollowCarMode(): Boolean + fun setCenter(lon: Double, lat: Double) + fun animateTo(lon: Double, lat: Double, alt: Float, rotateAngle: Float, mDuration: Int) + fun dispatchFocusChanged() + fun dispatchZoomChanged() + fun dispatchRotationAngleChanged(rotateAngle: Float) + fun dispatchDAngleChanged() + fun getMapScreenShot(var1: OnMapScreenShotListener) + + //NaviController相关 + fun isMapNorth(): Boolean + + fun setMapViewRotation(rotation: Float) + fun setMapStyle(stylemode: Int) + fun getMapStyle(): Int + fun setFollowCarMode(followCarMode: Boolean) + fun setMapNorth(mapNorth: Boolean) + fun clearRoute() + fun setNaviModeZoom() + fun setMapViewPerspective(mapPerspective: Int) + fun setShowAllRouteLine(isShowAllRouteLine: Boolean) + + // RouteBookAdapter + fun drawNavArrow() + + // POISearchThread + fun getCenter(): MapCoordinate? + + + fun getDAngle(): Float + + fun getMapViewRotation(): Float + + fun getMapViewPerspective(): Float + + fun zoomIn() + + fun zoomOut() + + fun setZoom(zoom: Int) + + fun getZoom(): Int + + fun getRulerInfo(): Float + + + fun removePel(names: String) + fun drawLine(polylineOptions: PolylineOptions): Polyline? + fun drawThickLine(polylineOptions: PolylineOptions): Polyline? + fun drawDeadZone(deadZoneOptions: DeadZoneOptions): DeadZone? + fun drawCircle(circleOptions: CircleOptions?): CircleController + fun drawEllipse(polylineOptions: PolylineOptions): Polyline? + fun drawRect(polylineOptions: PolylineOptions): Polyline? + fun drawPolygon(polylineOptions: PolylineOptions): Polyline? + fun clearPel(): Boolean + + //设置同步 + fun setRenderFrequency(enableSync: Boolean, renderTimePer: Int) + fun setMapViewVisualAngle(type: Int) + fun resetChangeAngleTime() + fun setNearViewAnglePosition(lonLat: LonLat) + fun setRoamStyle(isUseTrace: Int, dis: Float, speed: Float) + fun setRoamTrajectory(travel: String) + fun getIsRoam(): Boolean + + fun testMapViewAngle(type: Int) + + fun interpolation(eyeHeight: Float, angle: Float, zoomVal: Float, mode: Int, duration: Int) + fun setStartFrame(zoomVal: Float, lookAngle: Float, eyeHeight: Float) + + fun setScreenToOriginDis(screenToOriginDis: Float) + fun setEyeToOriginDis(eyeToOriginDis: Float) + fun getCenter(point: DoubleArray) + fun setOffset(lon: Int, lat: Int) + fun setRotateAngle(angle: Float) + fun set3DBuildingVisible(isVisibel: Boolean) + fun getResulation(): Float + fun getSuitableZoom(minLon: Double, minLat: Double, maxLon: Double, maxLat: Double): Int + fun drawTraffic(trafficJson: String) + fun addImage(imageKey: String, imageData: ByteArray, width: Int, height: Int): Int + fun clearAllTmcLines() + fun isTrafficOn(): Boolean + fun setTraffic(stat: Int) + fun setZoomValue(zoomValue: Float) + fun getEyeHeight(): Float + fun setEyeHeight(eyeHeight: Float) + fun setVerticalViewFieldAngle(angle: Float) + fun getVerticalViewFieldAngle(): Float + fun getRotateAngle(): Float + fun updatePointCloudData( + dataStr: String, + isTrasformer: Boolean, + isResidual: Boolean, + isReset: Boolean + ): Boolean + + fun updatePointCloudDataByPb( + dataArray: ByteArray, + isTrasformer: Boolean, + isResidual: Boolean, + isReset: Boolean + ): Boolean + + fun setIsDrawPointCloud(isDrawPointCloud: Boolean) + fun setPointCloudDisplayFllowAnim(isDisplayFllowAnim: Boolean, totalAnimTime: Int) + fun setPointCloudSize(pointCloudSize: Float) + fun setPointCloudColor(color: String) + fun shakeSceneManual() + fun shakeMapManual() + fun setRouteProp(prop: Int, lon: Int, lat: Int) + fun drawRoute() + fun removeImage(imageKey: String) + fun lonlatToPixels(lon: Double, lat: Double): Pixels? + fun pixelsToLonlat(x: Float, y: Float): LonLat? + fun setTmcData(tmcData: ByteArray?) + fun draw3DPolygon( + id: String, + lonlatArr: DoubleArray, + height: Float, + width: Float, + count: Int, + color: FloatArray + ) + + fun setGeodesic(id: String, bGeodesic: Boolean) + fun setDottedLineType(id: String, type: Int) + fun setVisiable(id: String, bVisiable: Boolean) + fun setWidth(id: String, width: Float) + fun setTransparency(id: String, transparency: Float) + fun setColor(id: String, color: Int) + fun setZIndex(id: String, zIndex: Float) + fun useGradient(id: String, bUseGradient: Boolean) + fun setOption(id: String, strJsonOption: String) + fun clearAllPrimitives(): Boolean + fun drawDeadZone(strJsonOption: String) + fun setDeadZoneVisible(b: Boolean) + fun cacheHDDataByCity(id: Int, listener: OnHdDataDownByCityListener) + fun cacheHDDataByCityLonLat(lon: Double, lat: Double, listener: OnHdDataDownByCityListener) + fun cancelCacheHDData() + + /** + * 锚点 更新锚点属性 + */ + fun updateAnchorByJson( + anchorId: String, + json: String, + infobitmap: ByteArray?, + infoWidth: Int, + infoHeight: Int + ): Boolean + + /** + * 锚点 设置层级 + */ + fun setSomeAnchorZIndex(anchorId: String, zIndex: Int) + + fun drawAnchor(nameId: String, lon: Double, lat: Double, imagePath: String) + + /** + * 清除指定marker + * + */ + fun removeAnchor(anchorId: String) + + + fun getRecycleId():String + /** + * 点击事件 + * + * @param x x坐标 + * @param y y坐标 + * @return 底层返回的信息 + */ + fun findAnchorAtScreen(x: Int, y: Int): String + + /** + * 锚点开始动画 + */ + fun startAnimation(anchorId: String) + + /** + * 锚点结束动画 + */ + fun endAnimation(anchorId: String) + + //动态平移 + fun addDynamicAnchorPostion( + anchorId: String, + points: DoubleArray, + angle: Float, + current: Long, + duration: Int + ) + + //平移 + fun addTranslateAnimationToAnchor(anchorId: String, points: DoubleArray, duration: Int) + + //缩放 + fun addScaleAnimationToAnchor(anchorId: String, min: Float, max: Float, duration: Int) + + fun addFlashAnimationToAnchor(anchorId: String, imageJson: String, duration: Int) + + //旋转 + fun addRotateAnimationToAnchor( + anchorId: String, + startAngle: Float, + endAngle: Float, + duration: Int + ) + + //锚点 设置是否可点击 + fun setSomeAnchorCanClickable(anchorId: String, canClickable: Boolean) + + /** + * 锚点 设置锚点不置顶 + */ + fun setSomeAnchorUnTop(anchorId: String) + + /** + * 锚点 设置锚点置顶 + */ + fun setSomeAnchorTop(anchorId: String) + + /** + * 锚点 infowindow的偏移量 + */ + fun setSomeAnchorInfowindowOffset(anchorId: String, disx: Int, disy: Int) + + // 设置是否是平贴 + fun setSomeAnchorFlat(anchorId: String, isFlat: Boolean) + + // 设置拖拽 + fun setSomeAnchorDrawModel(anchorId: String, dragModel: Boolean) + + // 设置拖拽位置 + fun setSomeDrawModelPointScreenPosition(screenx: Int, screeny: Int): Boolean + + fun addManyAnchors(json: String, count: Int) + + // 添加海量点 + fun addManyAnchorByJson(json: String, count: Int) + + // 删除海量点 + fun removeClusterByClusterid(clusterId: String) + + fun removeManyAnchor(allAnchorJson: String, count: Int) + + fun clearAllCluster() + + /** + * 锚点 创建自车锚点 + */ + fun createConstAnchor( + attribute: String, + infoBitmap: ByteArray?, + infoWidth: Int, + infoHeight: Int + ): Boolean + + fun addAnchorAsync(json: String) + + fun executeAnchorAdd() + + //锚点更新位置标记 + fun setConstAnchorPositionFlag(isUpdate: Boolean) + + fun addAnchor(json: String, infoBitmap: ByteArray?, infoWidth: Int, infoHeight: Int): Boolean + + /** + * 返回anchor的对象属性值 + * + * @param id anchor的id + * @param propertyName 属性名字 + * @return 属性值 + */ + fun getAnchorProperty(id: String, propertyName: String): String + + /** + * 更新anchor的属性 + * + * @param id anchor的id + * @param propertyName 要更新的anchor的属性名 + * @param propertyValue 要更新的属性值 + * @return + */ + fun updateAnchorProperty(id: String, propertyName: String, propertyValue: String): Boolean + + /** + * 更新infowindow内容 + * + * @param id infowindow的id + * @param imageData 更新的图片byte数组数据 + * @param width 图片宽度 + * @param height 图片高度 + * @return true 更新成功 false 更新失败 + */ + fun updateInfoWindowWithBitMap( + id: String, + imageData: ByteArray, + width: Int, + height: Int + ): Boolean + + /** + * 更新anchor + * + * @param id anchor的id + * @return true 更新成功 false 更新失败 + */ + fun updateAnchorWithBitmap(id: String, imageKey: String): Boolean + + /** + * 清除所有anchor + * + * @return true 删除成功 false 删除失败 + */ + fun clearAllAnchors(): Boolean + + /** + * 显示infowindow + * + * @param id Anchor的id + */ + fun showInfoWindow(id: String) + + /** + * 隐藏infoWindow + * + * @param id Anchor的id + */ + fun hideInfoWindow(id: String) + + //设置锚点缩放比例 + fun setAnchorRate(rate: Float) + + //For Test 四个顶点设置锚点变形 左宽 右宽 上高 下高 + fun setAnchorScale(wideLeft: Float, wideRight: Float, highUp: Float, hightDown: Float) + + //nMode 1:按Tile存储 2:按文件存储 nRecordCnt 单个文件存储的记录个数 + fun setNameMode(mode: Int, recordCnt: Int) + + /** + * 设置地图中心点的旋转方式 + * 3 正北向上 4 车头向上 + * + * @param mode + */ + fun setSelfLocaionControl(mode: Int) + + /** + * 设置是否锁车 + */ + fun setLockSelfCar(enable: Boolean) + + //锚点是否在动态移动中 + fun isAnchorDynamicMoving(anchorID: String): Boolean + + //批量更新 + fun updateBatchAnchorPositon(dataStr: String): Boolean + + fun setAnchorFlash(id: String, colorType: Int, color: String, time: Float, angle: Float) + + fun setAnchorGradientColor( + startColor: String, + endColor: String, + startDistance: Float, + endDistance: Float + ) + + fun setTailLightsType(type: Int, time: Int) + fun exit() + fun isCollision(data: String): String + fun switchData(x: Double, y: Double, isWgs84: Boolean): DoubleArray? + + + //mapView中迁移出来的部分方法 + fun setTouchPoiEnable(enable: Boolean) + fun getTouchPoiEnable(): Boolean + fun isTouching(): Boolean + fun setCanZoom(boolean: Boolean) + fun isCanZoom(): Boolean + fun setOnTouchListener(listener: View.OnTouchListener) + fun setScroll(boolean: Boolean) + fun setFling(boolean: Boolean) + fun setRotate(boolean: Boolean) + fun isScroll(): Boolean + fun isFling(): Boolean + fun isRotate(): Boolean + fun toScreen() + fun tilt(tilt: Float) + fun getTilt(): Float + fun renderP() + //设置刷新帧率 + fun setRenderFps(fps: Int) + //设置刷新帧率 + fun getRenderFps(): Int + fun setVrMode(isVr: Boolean) + fun setWaitTime(time: Long) + fun setIsAutoLockCar(isLockCar: Boolean) + + //协程 + fun getScope(): CoroutineScope? + //耗时协程 + fun getDemaningScope():CoroutineScope? + + fun setWeatherType(type: String) + fun getWeatherInfo(lon: Double, lat: Double, call: WeatherResult) + fun setSkyBoxMode() + + fun getLastKnownMogoLocation(): LonLatPoint + + fun setFogMode(isEnable: Boolean) + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IMapView.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IMapView.kt new file mode 100644 index 0000000000..43d13fa359 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IMapView.kt @@ -0,0 +1,119 @@ +package com.zhidaoauto.map.sdk.inner.abs + +import android.content.Context +import android.view.View +import com.autonavi.nge.map.MapEngine +import kotlinx.coroutines.CoroutineScope + +interface IMapView { + + //init + fun getmContext(): Context? + fun getMapEngine(): MapEngine + fun setMarkerCall(markerCall: IMarkerCall) + //The controller of event + fun setEventController(eventController: IEventController?) + + + fun isSurfaceCreated(): Boolean + fun isLoaded(): Boolean + fun isTouching(): Boolean + fun getWidth(): Int + fun getHeight(): Int + + fun getTilt(): Float + + fun loadP(dir: String): Boolean + + fun unloadP() + + fun resizeP(w: Int, h: Int) + + fun renderP() + +// fun renderLocationP(lon: Float, lat: Float, providerType: Int): Int + + fun scrollByP(dx: Float, dy: Float) + + fun addAntCoorP(sessionId: Int, lon: Int, lat: Int, time: Int) + + fun rotateByP(r: Float) + + fun setCanZoom(boolean: Boolean) + fun setScroll(boolean: Boolean) + fun setFling(boolean: Boolean) + fun setRotate(boolean: Boolean) + fun isCanZoom(): Boolean + fun isScroll(): Boolean + fun isFling(): Boolean + fun isRotate(): Boolean + fun setOnTouchListener(listener: View.OnTouchListener) + fun setDoubles(doubleArray: DoubleArray) + fun destory() + + //设置刷新帧率 + fun setRenderFps(fps: Int) + + //设置刷新帧率 + fun getRenderFps(): Int + + fun setTouchPoiEnable(enable: Boolean) + fun getTouchPoiEnable(): Boolean + + //自定义样式路径 + fun setCustomStyleDir(path: String) + + //设置同频渲染相关参数 + fun setSyncRenderFrequency(enable: Boolean, renderTimePer: Int) + + fun toScreen() + + fun setVrMode(isVr: Boolean) + + fun tilt(tilt: Float) + + fun removeTouch() + + fun setWaitTime(time: Long) + + fun setIsAutoLockCar(isLockCar: Boolean) + + //协程 + fun getScope(): CoroutineScope? + //耗时协程 + fun getDemaningScope():CoroutineScope? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// fun setIsFarViewAngel(isFar: Boolean) +// +// fun setUpdateCount(updateCount: Int) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IMarkerCall.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IMarkerCall.kt new file mode 100644 index 0000000000..f628a08fa4 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IMarkerCall.kt @@ -0,0 +1,56 @@ +package com.zhidaoauto.map.sdk.inner.abs + +import android.graphics.Rect +import com.zhidaoauto.map.sdk.inner.marker.IInfoViewClick +import com.zhidaoauto.map.sdk.open.abs.marker.OnMarkerDragListener +import com.zhidaoauto.map.sdk.open.marker.OnAnimationListener +import com.zhidaoauto.map.sdk.open.marker.OnInfoWindowClickListener +import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener + +interface IMarkerCall { + + fun exit() + /** + * 更新marker资源 + * + * @return + */ + fun updateMarkerResource(dataStr:String?) + + fun getMarkDragListener(markerID: String): OnMarkerDragListener? + + fun getAnimationListener(markerID: String): OnAnimationListener? + + fun addAnimationListener(markerID: String, onAnimationListener: OnAnimationListener?) + + fun getMarkClickListener(markerID: String): OnMarkClickListener? + + fun getInfoWindowClickListener(markerID: String): OnInfoWindowClickListener? + + fun addInfoWindowClickListener(markerID: String, onInfoWindowClickListener: OnInfoWindowClickListener?) + + fun addMarkDragListener(markerID: String, onMarkerDragListener: OnMarkerDragListener?) + + fun addMarkClickListener(markerID: String, onMarkClickListener: OnMarkClickListener?) + + fun containMarkerIcon(icon:String?):Boolean + + fun removeMarkerIcon(icon:String?):Boolean + + fun addMarkerIcon(icon:String):Boolean + + fun containMarkerIconCache(id:Int):Boolean + + fun removeMarkerIconCache(id:Int) + + fun addMarkerIconCache(id:Int,icon:String) + + fun getMarkerIconCache(id:Int):String? + + fun addInfoViewClick(markerId: String, rect: Rect, iInfoViewClick: IInfoViewClick) + + fun getInfoViewClick(markerId: String): HashMap? + + fun removeInfoViewClick(markerId: String) + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IMarkerController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IMarkerController.kt new file mode 100644 index 0000000000..88669d5e71 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IMarkerController.kt @@ -0,0 +1,48 @@ +package com.zhidaoauto.map.sdk.inner.abs + +import com.zhidaoauto.map.sdk.open.abs.marker.InfoWindowAdapter +import com.zhidaoauto.map.sdk.open.marker.BatchMarkerOptions +import com.zhidaoauto.map.sdk.open.marker.CarInfo +import com.zhidaoauto.map.sdk.open.marker.Marker +import com.zhidaoauto.map.sdk.open.marker.MarkerOptions +import com.zhidaoauto.map.sdk.open.marker.MultiPointController +import com.zhidaoauto.map.sdk.open.marker.MultiPointOverlayOptions + +interface IMarkerController { + + //设置infowindow适配器 + fun setInfoWindow(infoWindowAdapter: InfoWindowAdapter) + //获取infowindow适配器 + fun getInfoWindow(): InfoWindowAdapter? + //添加锚点 + fun addMarker(markerOptions: MarkerOptions): Marker? + //添加自车锚点 + fun addSelfCar(markerOptions: MarkerOptions): Marker? + //添加多个锚点 + fun addMarkers(multiPointOverlayOptions: MultiPointOverlayOptions): MultiPointController + //回收 + fun destory() + //删除锚点 + fun removeMarker(id:String) + /** + * 批量更新他车 + */ + fun updateBatchMarkerPositon(batchMarkerOptions: BatchMarkerOptions) + //根据车辆类型预添加车辆模型 + fun addPreVehicleModel(type:Int,modelRes:Int):String? + //添加普通模型 + fun addPreModel(modelRes:Int):String? + /** + * 更新车辆的大小 + * @param type 车辆类型 + * @param width 车辆宽度 + * @param length 车辆长度 + */ + fun updateCarSize(type:Int,width:Double,length:Double) + /** + * 检查车辆是否叠加 + * @param list 他车数据列表 + * @return 返回车辆叠加数据 + */ + fun checkCollision(list:ArrayList):Map> +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/INaviController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/INaviController.kt new file mode 100644 index 0000000000..df15e70359 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/INaviController.kt @@ -0,0 +1,93 @@ +package com.zhidaoauto.map.sdk.inner.abs + +import com.zhidaoauto.map.sdk.open.nav.NavPoi +import com.zhidaoauto.map.sdk.open.nav.abs.NaviListener +import com.zhidaoauto.map.sdk.open.nav.model.NaviPath +import com.zhidaoauto.map.sdk.open.nav.model.NaviSetting + +interface INaviController { + + //设置导航策略 + fun setNaviStrategy(strategy: Int) + + //设置导航语音是否播报 + fun setSpeakStatus(status:Boolean) + //播报输入文案 + fun playTTS(tts: String, forcePlay: Boolean): Boolean + //获取导航类型 + fun getNaviType(): Int + //导航状态 + fun getNaviStat(): Boolean + //重置状态 + fun reset() + //设置出发地点 + fun setStart(start: NavPoi) + // 设置终点 + fun setDest(dest: NavPoi) + //显示详情信息 -- 只设置了终点情况下 + fun startNaviDetail() + // 开始导航(是否模拟) + fun startNavi(isSimulator: Boolean):Boolean + //停止导航 + fun stopNavi() + //刷新位置 + fun updatePosition( + lon: Double, + lat: Double, + provider: String?, + speed: Float, + heading: Float + ) + // 重置导航 + fun reSetRoute():Boolean + //添加沿途点 + fun addWayPoint( + poi: NavPoi, + heading: Int, + sessionid: Int + ) + + //添加沿途点 + fun addWayPoints( + wayPoints: ArrayList + ) + //清除沿途点 + fun clearWayPoints(sessionid: Int) + //重置路线 + fun resetRouteSetPanel() + //是否模拟导航 + fun setSimNavi(simNavi: Boolean) + //是否模拟导航 + fun isSimNavi(): Boolean + //获取起点 + fun getStartPoi(): NavPoi? + //获取终点 + fun getEndPoi(): NavPoi? + //获取沿途点 + fun getWayPoi(): NavPoi? + //设置模拟导航速度 + fun setSimNaviSpeed(speed: Int) + //是否暂停模拟导航 + fun isSimNaviPaused(): Boolean + //设置暂停模拟导航 + fun setSimNaviPaused(isPaused: Boolean) + //是否已设置起点 + fun isStartSet(): Boolean + //是否已设置终点 + fun isDestSet(): Boolean + //是否设置沿途点 + fun isTuSet(): Boolean + + fun destory() + + //复读 + fun readCurrentTts():Boolean + + fun setNaviListener(naviListener: NaviListener) + + fun removeNaviListener() + + fun getNavPath(): NaviPath + + fun getNaviSetting(): NaviSetting +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IRoadData.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IRoadData.kt new file mode 100644 index 0000000000..ac470f101f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/IRoadData.kt @@ -0,0 +1,6 @@ +package com.zhidaoauto.map.sdk.inner.abs + +interface IRoadData { + + fun result(code:Int,result:String?) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/ITraffic.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/ITraffic.kt new file mode 100644 index 0000000000..b2a620f424 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/abs/ITraffic.kt @@ -0,0 +1,6 @@ +package com.zhidaoauto.map.sdk.inner.abs + +interface ITraffic { + fun onRoadLoaded(tileId: Int, leftTopLon: Double, leftTopLat: Double, leftBottomLon: Double, leftBottomLat: Double, + rightTopLon: Double, rightTopLat: Double, rightBottomLon: Double, rightBottomLat: Double,roadInfo:String?) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/aspect/KotlinExtern.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/aspect/KotlinExtern.kt new file mode 100644 index 0000000000..18125c469b --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/aspect/KotlinExtern.kt @@ -0,0 +1,11 @@ +package com.zhidaoauto.map.sdk.inner.aspect + +object KotlinExtern { + fun Double.toTenDecimalsStr():String{ + return String.format("%.10f", this) + } + + fun Float.toTenDecimalsStr():String{ + return String.format("%.10f", this) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/aspect/LonLatAspect.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/aspect/LonLatAspect.java new file mode 100644 index 0000000000..9191deedd7 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/aspect/LonLatAspect.java @@ -0,0 +1,36 @@ +package com.zhidaoauto.map.sdk.inner.aspect; + + +//@Aspect +public class LonLatAspect { +// @Pointcut("execution(* com.lqr.androidaopdemo.MainActivity.test(..))") +// public void pointcut() { +// +// } +// +// @Before("pointcut()") +// public void before(JoinPoint point) { +// System.out.println("@Before"); +// } +// +// @Around("pointcut()") +// public void around(ProceedingJoinPoint joinPoint) throws Throwable { +// System.out.println("@Around"); +// } +// +// @After("pointcut()") +// public void after(JoinPoint point) { +// System.out.println("@After"); +// } +// +// @AfterReturning("pointcut()") +// public void afterReturning(JoinPoint point, Object returnValue) { +// System.out.println("@AfterReturning"); +// } +// +// @AfterThrowing(value = "pointcut()", throwing = "ex") +// public void afterThrowing(Throwable ex) { +// System.out.println("@afterThrowing"); +// System.out.println("ex = " + ex.getMessage()); +// } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/CodecProprety.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/CodecProprety.java new file mode 100644 index 0000000000..55527d7bfd --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/CodecProprety.java @@ -0,0 +1,23 @@ +package com.zhidaoauto.map.sdk.inner.byteh; + + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD}) +public @interface CodecProprety { + /** + * 属性顺序 + * @return + */ + int order(); + + /** + * 数据长度。解码时用,除了简单数据类型之外才起作用(如:String)。 + * @return + */ + int length() default 0; +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/Codecable.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/Codecable.java new file mode 100644 index 0000000000..01f4500abe --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/Codecable.java @@ -0,0 +1,35 @@ +package com.zhidaoauto.map.sdk.inner.byteh; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public abstract class Codecable { + + public static List resolveFileldWrapperList(Class clazz){ + Field[] fields = clazz.getDeclaredFields(); + List fieldWrapperList = new ArrayList<>(); + for (Field field : fields) { + CodecProprety codecProprety = field.getAnnotation(CodecProprety.class); + if (codecProprety == null) { + continue; + } + FieldWrapper fw = new FieldWrapper(field, codecProprety); + fieldWrapperList.add(fw); + } + + Collections.sort(fieldWrapperList, new Comparator() { + @Override + public int compare(FieldWrapper o1, FieldWrapper o2) { + return o1.getCodecProprety().order() - o2.getCodecProprety().order(); + } + }); + + return fieldWrapperList; + } + + + public abstract List getFieldWrapperList(); +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/FieldWrapper.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/FieldWrapper.java new file mode 100644 index 0000000000..9f878ef592 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/FieldWrapper.java @@ -0,0 +1,35 @@ +package com.zhidaoauto.map.sdk.inner.byteh; + +import java.lang.reflect.Field; + +public class FieldWrapper { + /** + * 上下行数据属性 + */ + private Field field; + /** + * 上下行数据属性上的注解 + */ + private CodecProprety codecProprety; + + public FieldWrapper(Field field, CodecProprety codecProprety) { + this.field = field; + this.codecProprety = codecProprety; + } + + public Field getField() { + return field; + } + + public void setField(Field field) { + this.field = field; + } + + public CodecProprety getCodecProprety() { + return codecProprety; + } + + public void setCodecProprety(CodecProprety codecProprety) { + this.codecProprety = codecProprety; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/PayloadDecoder.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/PayloadDecoder.java new file mode 100644 index 0000000000..66fc8022e7 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/PayloadDecoder.java @@ -0,0 +1,89 @@ +package com.zhidaoauto.map.sdk.inner.byteh; + +import java.lang.reflect.Field; +import java.nio.charset.Charset; +import java.util.List; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +public class PayloadDecoder { + + public static T resolve(byte[] src, Class clazz) { + T instance = null; + try { + instance = clazz.newInstance(); + } catch (Exception e) { + throw new RuntimeException("实例化类失败", e); + } + + List fieldWrapperList = instance.getFieldWrapperList(); + ByteBuf buffer = Unpooled.buffer().writeBytes(src); + for (FieldWrapper fieldWrapper : fieldWrapperList) { + fillData(fieldWrapper, instance, buffer); + } + + return instance; + } + + private static void fillData(FieldWrapper fieldWrapper, Object instance, ByteBuf buffer) { + Field field = fieldWrapper.getField(); + field.setAccessible(true); + String typeName = field.getType().getName(); + try { + switch (typeName) { + case "java.lang.Boolean": + case "boolean": + boolean b = buffer.readBoolean(); + field.set(instance, b); + break; + + case "java.lang.Character": + case "char": + CharSequence charSequence = buffer.readCharSequence(fieldWrapper.getCodecProprety().length(), Charset.forName("UTF-8")); + field.set(instance, charSequence); + break; + case "java.lang.Byte": + case "byte": + byte b1 = buffer.readByte(); + field.set(instance, b1); + break; + case "java.lang.Short": + case "short": + short readShort = buffer.readShort(); + field.set(instance, readShort); + break; + case "java.lang.Integer": + case "int": + int readInt = buffer.readInt(); + field.set(instance, readInt); + break; + case "java.lang.Long": + case "long": + long l = buffer.readLong(); + field.set(instance, l); + break; + case "java.lang.Float": + case "float": + float readFloat = buffer.readFloat(); + field.set(instance, readFloat); + break; + case "java.lang.Double": + case "double": + double readDouble = buffer.readDouble(); + field.set(instance, readDouble); + break; + case "java.lang.String": + String readString = buffer.readCharSequence(fieldWrapper.getCodecProprety().length(), Charset.forName("UTF-8")).toString(); + field.set(instance, readString); + break; + default: + throw new RuntimeException(typeName + "不支持,bug"); + } + } catch (Exception e) { + throw new RuntimeException(typeName + "读取失败,field:" + field.getName(), e); + } + } + + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/PayloadEncoder.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/PayloadEncoder.java new file mode 100644 index 0000000000..6f3f27d43e --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/byteh/PayloadEncoder.java @@ -0,0 +1,93 @@ +package com.zhidaoauto.map.sdk.inner.byteh; + +import com.autonavi.nge.map.LonLat; + +import java.lang.reflect.Field; +import java.nio.charset.Charset; +import java.util.List; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; + +public class PayloadEncoder { + public static byte[] getPayload(T command) { + List fieldWrapperList = command.getFieldWrapperList(); + ByteBuf buffer = Unpooled.buffer(); + for(FieldWrapper fieldWrapper :fieldWrapperList){ + write2ByteBuf(fieldWrapper, command, buffer); + } + return buffer.array(); + } + + /** + * 数据写入到ByteBuf + * + * @param fieldWrapper + * @param instance + * @param buffer + */ + private static void write2ByteBuf(FieldWrapper fieldWrapper, Object instance, ByteBuf buffer) { + Field field = fieldWrapper.getField(); + String typeName = field.getType().getName(); + field.setAccessible(true); + Object value = null; + try { + value = field.get(instance); + } catch (IllegalAccessException e) { + new RuntimeException("反射获取值失败,filed:" + field.getName(), e); + } + switch (typeName) { + case "com.autonavi.nge.map.LonLat": + LonLat lonLat = (LonLat) value; + buffer.writeDouble(lonLat.getLon()); + buffer.writeDouble(lonLat.getLat()); + break; + case "java.lang.Boolean": + case "kotlin.Boolean": + case "boolean": + buffer.writeBoolean((Boolean) value); + break; + case "java.lang.Character": + case "kotlin.Character": + case "char": + buffer.writeCharSequence((CharSequence) value, Charset.forName("UTF-8")); + break; + case "java.lang.Byte": + case "kotlin.Byte": + case "byte": + buffer.writeByte((byte) value); + break; + case "java.lang.Short": + case "kotlin.Short": + case "short": + buffer.writeShort((short) value); + break; + case "java.lang.Integer": + case "kotlin.Int": + case "int": + buffer.writeInt((int) value); + break; + case "java.lang.Long": + case "kotlin.Long": + case "long": + buffer.writeLong((long) value); + break; + case "java.lang.Float": + case "kotlin.Float": + case "float": + buffer.writeFloat((float) value); + break; + case "java.lang.Double": + case "kotlin.Double": + case "double": + buffer.writeDouble((double) value); + break; + case "java.lang.String": + case "kotlin.String": + buffer.writeCharSequence((CharSequence) value, Charset.forName("UTF-8")); + break; + default: + throw new RuntimeException(typeName + "不支持,bug"); + } + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/CommonHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/CommonHelper.kt new file mode 100644 index 0000000000..8f8e0d3105 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/CommonHelper.kt @@ -0,0 +1,29 @@ +package com.zhidaoauto.map.sdk.inner.common + +import com.autonavi.nge.Common + +class CommonHelper { + private var common: Common + + private constructor() { + common = Common() + + } + + + companion object{ + var sInstance: CommonHelper? = null + + @Synchronized + fun getInstance(): CommonHelper? { + if (sInstance == null) { + sInstance = CommonHelper() + } + return sInstance + } + } + + fun setCfgKeyVal(key: String, value: String){ + common.setCfgKeyVal(key, value) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/ConstantExt.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/ConstantExt.kt new file mode 100644 index 0000000000..debe60b15b --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/ConstantExt.kt @@ -0,0 +1,298 @@ +package com.zhidaoauto.map.sdk.inner.common + +import android.os.Environment +import java.io.File + +object ConstantExt { + + + //近视角模式 + const val MAP_STYLE_VR_ANGLE_NEAR = 0 + //默认视角模式 + const val MAP_STYLE_VR_ANGLE_MIDDLE = 1 + //远视角模式 + const val MAP_STYLE_VR_ANGLE_FAR = 2 + //300米视角模式 + const val MAP_STYLE_VR_ANGLE_300 = 3 + //顶视角模式 + const val MAP_STYLE_VR_ANGLE_TOP = 4 + //十字路口视角 + const val MAP_STYLE_VR_ANGLE_CROSS = 5 + //小巴默认视角 + const val MAP_STYLE_VR_ANGLE_MIDDLE_XIAOBA = 6 + //漫游模式 + const val MAP_STYLE_VR_ROAM = 7 + //过渡模式 + const val MAP_STYLE_VR_TRANS = 8 + //洱海B2车辆模式 + const val MAP_STYLE_VR_ERHAI_B2 = 9 + //天空盒模式 + const val MAP_STYLE_VR_SKY_BOX = 10 + + //漫游距离1公里 + const val ROAM_DIS_1KM = 1000f + //漫游距离3公里 + const val ROAM_DIS_3KM = 3000f + //漫游距离5公里 + const val ROAM_DIS_5KM = 5000f + //漫游距离8公里 + const val ROAM_DIS_8KM = 8000f + + //漫游速度30m/s + const val ROAM_SPEED_30 = 30f + //漫游速度40m/s + const val ROAM_SPEED_40 = 40f + //漫游速度60m/s + const val ROAM_SPEED_60 = 60f + //漫游速度80m/s + const val ROAM_SPEED_80 = 80f + + + //VR模式下的缩放 + const val MAP_STYLE_VR_ZOOM: Int = 20 + + //VR模式下的远视角 角度 + const val MAP_STYLE_VR_OVER_LOOK_ANGLE_FAR = 11.5f + //VR模式下的远视角 缩放值 + const val MAP_STYLE_VR_ZOOM_VAL_FAR = 1f + //VR模式下的远视角 高度 + const val MAP_STYLE_VR_EYE_HEIGHT_FAR = 40f + + + //VR模式下的近视角 角度 + const val MAP_STYLE_VR_OVER_LOOK_ANGLE_NEAR =13.5f + //VR模式下的近视角 缩放值 + const val MAP_STYLE_VR_ZOOM_VAL_NEAR = 0.35f + //VR模式下的近视角 高度 + const val MAP_STYLE_VR_EYE_HEIGHT_NEAR = 22f + + //VR模式下的中视角默认视角 小车位置 + const val MAP_STYLE_VR_POSITION_MIDDLE = 2.6f + //VR模式下的中视角默认视角 角度 + const val MAP_STYLE_VR_OVER_LOOK_ANGLE_MIDDLE = 12.5f + //VR模式下的中视角 缩放值 + const val MAP_STYLE_VR_ZOOM_VAL_MIDDLE = 0.8f + //VR模式下的中视角 高度 + const val MAP_STYLE_VR_EYE_HEIGHT_MIDDLE = 15f + + //VR模式下的小巴车默认视角 角度 + const val MAP_STYLE_VR_OVER_LOOK_ANGLE_MIDDLE_XIAOBA = 15.3f + //VR模式下的小巴车默认视角 缩放值 + const val MAP_STYLE_VR_ZOOM_VAL_MIDDLE_XIAOBA = 0.8f + //VR模式下的小巴车默认视角 高度 + const val MAP_STYLE_VR_EYE_HEIGHT_MIDDLE_XIAOBA = 19f + + + //VR模式下的洱海默认视角 角度 + const val MAP_STYLE_VR_OVER_LOOK_ANGLE_ERHAI = 13f + //VR模式下的洱海默认视角 缩放值 + const val MAP_STYLE_VR_ZOOM_VAL_ERHAI = 1f + //VR模式下的洱海默认视角 高度 + const val MAP_STYLE_VR_EYE_HEIGHT_ERHAI = 15f + + + //后方来车300米视角 高度 + const val MAP_STYLE_VR_EYE_HEIGHT_300 = 27f + //后方来车300米视角 角度 + const val MAP_STYLE_VR_OVER_LOOK_ANGLE_300 = 16.5f + //后方来车300米视角 缩放值 + const val MAP_STYLE_VR_ZOOM_VAL_300 = 1.24f + + + //顶视角 高度 + const val MAP_STYLE_VR_EYE_HEIGHT_TOP = 70f + //顶视角 角度 + const val MAP_STYLE_VR_OVER_LOOK_ANGLE_TOP = 45f + //顶视角 缩放值 + const val MAP_STYLE_VR_ZOOM_VAL_TOP = 1f + + + //十字路口视角 高度 + const val MAP_STYLE_VR_EYE_HEIGHT_CROSS = 14f + //十字路口视角 角度 + const val MAP_STYLE_VR_OVER_LOOK_ANGLE_CROSS = 20.7f + //十字路口视角 缩放值 + const val MAP_STYLE_VR_ZOOM_VAL_CROSS = 1f + + + //漫游模式 角度 + const val MAP_STYLE_VR_OVER_LOOK_ANGLE_ROAM = 12.5f + //漫游模式 缩放值 + const val MAP_STYLE_VR_ZOOM_VAL_ROAM = 0.8f + //漫游模式 高度 + const val MAP_STYLE_VR_EYE_HEIGHT_ROAM = 23f + + //过渡模式 角度 + const val MAP_STYLE_VR_OVER_LOOK_ANGLE_TRANS = 12.5f + //过渡模式 缩放值 + const val MAP_STYLE_VR_ZOOM_VAL_TRANS = 0.8f + //过渡模式 高度 + const val MAP_STYLE_VR_EYE_HEIGHT_TRANS = 30f + + //天空盒模式 + const val MAP_STYLE_VR_OVER_LOOK_ANGLE_SKYBOX = 28f//视角 + const val MAP_STYLE_VR_ZOOM_VAL_SKYBOX = 0.8f//缩放 + const val MAP_STYLE_VR_EYE_HEIGHT_SKYBOX = 12f//高度 + + //默认尾灯不亮 + const val SELF_CAR_DEFAULT = 0 + //尾灯左黄 + const val SELF_CAR_TURN_LEFT_YELLOW = 1 + //尾灯右黄 + const val SELF_CAR_TURN_RIGHT_YELLOW = 2 + //尾灯双黄 + const val SELF_CAR_STOP_LIGHT_YELLOW = 3 + //尾灯双红 + const val SELF_CAR_STOP_LIGHT_RED = 4 + + + //VR模式下的近视角视域 + const val MAP_STYLE_VR_VIEW_FIELD_ANGLE_NEAR = 18f + //VR模式下的远视角视域 + const val MAP_STYLE_VR_VIEW_FIELD_ANGLE_FAR = 20f + //VR模式下的中视角视域 + const val MAP_STYLE_VR_VIEW_FIELD_ANGLE_MIDDLE = 20f + + + //设置天气 + const val WEATHER = "wheatherType" + //没有天气效果 + const val WEATHER_DEFULT = "0" + //雨天 + const val WEATHER_RAIN = "1" + //雪天 + const val WEATHER_SNOW = "2" + + //设置天空盒 + const val FOG = "fog" + const val SKYBOX = "skybox" + + //地图视角测试 + //地图测试视角角度 + const val MAP_TEST_ANGLE = 18.5f + //地图测试100米视角 高度 + const val MAP_100_EYE_HEIGHT = 16f + //地图测试80米视角 高度 + const val MAP_80_EYE_HEIGHT = 12.5f + + const val CAR_CENTER_100 = 1 + + const val CAR_QUARTER_100 = 2 + + const val CAR_TWO_FIFTHS_100 = 3 + + const val CAR_TWO_FIFTHS_80= 4 + + const val CAR_AFTER_30_FRONT_80 = 5 + + const val CAR_AFTER_30_FRONT_100 = 6 + + const val CAR_AFTER_30_FRONT_120 = 7 + + const val CAR_AFTER_40_FRONT_80= 8 + + const val CAR_AFTER_40_FRONT_100 = 9 + + const val CAR_AFTER_40_FRONT_120 = 10 + + const val CAR_AFTER_30_FRONT_80_ANGLE = 16.1f + const val CAR_AFTER_30_FRONT_80_EYEHEIGHT = 11.2f + const val CAR_AFTER_30_FRONT_80_POSITION = -1.8f + + const val CAR_AFTER_30_FRONT_100_ANGLE = 15.2f + const val CAR_AFTER_30_FRONT_100_EYEHEIGHT = 11f + const val CAR_AFTER_30_FRONT_100_POSITION = -1.4f + + + const val CAR_AFTER_30_FRONT_120_ANGLE = 14.3f + const val CAR_AFTER_30_FRONT_120_EYEHEIGHT = 10.2f + const val CAR_AFTER_30_FRONT_120_POSITION = -1.4f + + const val CAR_AFTER_40_FRONT_80_ANGLE = 13.8f + const val CAR_AFTER_40_FRONT_80_EYEHEIGHT = 7f + const val CAR_AFTER_40_FRONT_80_POSITION = -4.2f + + const val CAR_AFTER_40_FRONT_100_ANGLE = 13.2f + const val CAR_AFTER_40_FRONT_100_EYEHEIGHT = 6.7f + const val CAR_AFTER_40_FRONT_100_POSITION = -4f + + const val CAR_AFTER_40_FRONT_120_ANGLE = 12.8f + const val CAR_AFTER_40_FRONT_120_EYEHEIGHT = 6.6f + const val CAR_AFTER_40_FRONT_120_POSITION = -3.8f + + + // 2D模式下的俯视角 + const val MAP_STYLE_2D_OVER_LOOK_ANGLE: Float = 90f + //2D模式下的缩放 + const val MAP_STYLE_2D_ZOOM: Int = 16 + //2D模式下的高度 + const val MAP_STYLE_2D_EYE_HEIGHT: Float = 149f + + // nav模式下的俯视角 + const val MAP_STYLE_NAV_OVER_LOOK_ANGLE: Float = 30f + // nav模式下的缩放 + const val MAP_STYLE_NAV_ZOOM: Int = 18 + + //动画时长 + const val MAP_ANIM_DEFAULT_DURATION: Int = 350 + + + const val RULE_ZERO_SIX_INT: Float = 1000000.0f + + // 经纬度转int标注 + const val RULE_FLOAT_TO_INT: Float = 3.6f + + // 经纬度转int标注 + const val RULE_INT: Float = 3.6f * RULE_ZERO_SIX_INT + + const val SHARED_KEY_LOCATION: String = "SHARED_KEY_LOCATION" + + const val SHARED_KEY_LONLAT: String = "SHARED_KEY_LONLAT" + + //样式版本 + const val SHARED_KEY_STYLE_VERSION: String = "SHARED_KEY_STYLE_VERSION" + //数据版本 + const val SHARED_KEY_DATA_VERSION: String = "SHARED_KEY_DATA_VERSION" + //高精数据版本 + const val SHARED_KEY_HDDATA_VERSION: String = "SHARED_KEY_HDDATA_VERSION" + + /** + * authority + */ + val AUTHORITY = ".data" + + //查询 + val STR_QUERY = "str_query" + + val KEY = "key" + val VALUE = "value" + + //查询 + val CODE_QUERY = 1001 + + fun getNDSDataPath(): String { + var mNDSDataPath: String = "" + val NDSFileName = "/shmdata/" + val paths = arrayOf( + "/storage/extSdCard$NDSFileName", + "/storage/sdcard0$NDSFileName", + "/storage/sdcard1$NDSFileName", + "/sdcard/sd$NDSFileName", + "/sdcard/external_sd$NDSFileName", + "/sdcard-ext$NDSFileName", + "/sdcard$NDSFileName", + "/sdcard/ext_sd$NDSFileName", + "/mnt/extsd$NDSFileName" + ) + for (i in paths.indices) { + if (File(paths[i]).exists()) { + mNDSDataPath = paths[i] + break + } else { + mNDSDataPath = + Environment.getExternalStorageDirectory().absolutePath + NDSFileName + } + } + return mNDSDataPath + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/MapHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/MapHelper.kt new file mode 100644 index 0000000000..b1eaa277cb --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/MapHelper.kt @@ -0,0 +1,34 @@ +package com.zhidaoauto.map.sdk.inner.common + +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +import com.zhidaoauto.map.sdk.inner.proxy.LonLatProxy +import com.zhidaoauto.map.sdk.inner.utils.Recorder +import com.zhidaoauto.map.sdk.open.MapParams + +object MapHelper { + private val TAG = javaClass.simpleName + var debug = true + var mMapParams:MapParams = MapParams.init() + + fun init(mapParams: MapParams){ + if(debug){ + Log.i(TAG,"initop MapParams") + } + mMapParams = mapParams + debug = mapParams.getDebugMode() + setDebugMode(debug) + //TODO MATT +// Clerk.isWork = mapParams.getRecordLogs() + Recorder.isWork = mapParams.getRecordLogs() + if(debug){ + Log.i(TAG,"initop setLonLatProxy") + } + CommonProxy.getInstance().setLonLatProxy(LonLatProxy()) + } + + fun setDebugMode(debug: Boolean) { + CompileConfig.setDebug(debug) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/NavHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/NavHelper.kt new file mode 100644 index 0000000000..588b1b6148 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/common/NavHelper.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.inner.common + +import com.zhidaoauto.map.sdk.open.NavParams + +object NavHelper { + + var mNavParams:NavParams = NavParams.init() + + fun init(navParams: NavParams){ + mNavParams = navParams + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/controller/CommonController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/controller/CommonController.kt new file mode 100644 index 0000000000..de324958a3 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/controller/CommonController.kt @@ -0,0 +1,78 @@ +package com.zhidaoauto.map.sdk.inner.controller + +import android.content.Context +import android.os.Process +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.utils.Constant.getWorkingDirectory +import com.zhidaoauto.map.sdk.inner.utils.Constant.killProcesses +import com.zhidaoauto.map.sdk.inner.utils.Recorder +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.MainScope +import kotlinx.coroutines.cancel + +/** + * @author Matt + */ +class CommonController private constructor() { + + + private val TAG = javaClass.simpleName + + private var mContext:Context? = null + var scope: CoroutineScope? = null + + + //获取工作空间 + var workingDirectory: String? = null + private set + + + + //初始化 + fun init(context: Context?) { + if(this.mContext == null){ + this.mContext = context + } + if (this.scope == null) { + this.scope = MainScope() + } + + initInner() +// MarkerCacheController.instance.init() + } + + fun initInner() { + if (workingDirectory == null) { + workingDirectory = getWorkingDirectory(mContext!!) + } + Recorder.mWorkingDirectory = workingDirectory + } + + //退出 + fun exit() { + // 回收scope + scope?.cancel() + scope = null + + mContext = null + } + + //杀死进程 + private fun finilize() { + Process.killProcess(0) + mContext?.let { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-finilize-killProcesses") + } + killProcesses(it, it.packageName) + } + } + + companion object { + //单例 + @JvmStatic val instance: CommonController by lazy((LazyThreadSafetyMode.SYNCHRONIZED)) { + CommonController() + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/controller/MapEventController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/controller/MapEventController.kt new file mode 100644 index 0000000000..49d2c01875 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/controller/MapEventController.kt @@ -0,0 +1,577 @@ +package com.zhidaoauto.map.sdk.inner.controller + +import android.graphics.Bitmap +import android.view.MotionEvent +import com.autonavi.nge.map.OnMapScreenShotListener +import com.zhidaoauto.map.sdk.inner.abs.IEventController +import com.zhidaoauto.map.sdk.open.MapAutoApi +import com.zhidaoauto.map.sdk.open.abs.MapStatusListener +import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener +import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener +import com.zhidaoauto.map.sdk.open.abs.OnMapChangeListener +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.abs.OnMapViewVisualAngleChangeListener +import com.zhidaoauto.map.sdk.open.abs.OnRenderListener +import com.zhidaoauto.map.sdk.open.abs.OnRoadInfoListener +import com.zhidaoauto.map.sdk.open.abs.OnRoamStatusListener +import com.zhidaoauto.map.sdk.open.abs.OnScrollListener +import com.zhidaoauto.map.sdk.open.abs.log.ILog +import com.zhidaoauto.map.sdk.open.camera.CameraPosition +import com.zhidaoauto.map.sdk.open.location.MogoLocation +import com.zhidaoauto.map.sdk.open.marker.Marker +import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.road.RoadCross +import com.zhidaoauto.map.sdk.open.road.StopLine + +class MapEventController(): IEventController { + + private var mCameraChangeListenerList: ArrayList? = null + private var mMapTouchListenerList: ArrayList? = null + private var mMapClickListenerList: ArrayList? = null + private var mMapLoadedListenerList: ArrayList? = null + private var mMarkClickListenerList: ArrayList? = null + private var mScrollListenerList: ArrayList? = null + private var mMapStyleListenerList: ArrayList? = null + private var mScreenListenerList: ArrayList? = null + private var mMapChangeListenerList: ArrayList? = null + private var mMapViewVisualAngleChangeListenerList: ArrayList? =null + private var mFocusListenerList: ArrayList? = null + private var mRotateListenerList: ArrayList? = null + private var mZoomListenerList: ArrayList? = null + private var mDAngleListenerList: ArrayList? = null + private var renderListenerList : ArrayList? = null + private var mRoadInfoListenerList : ArrayList? = null + private var mLogListenerList : ArrayList? = null + private var mHdDataDownloadListener: HashMap? = null + private var mRoamStatusListenerList: ArrayList? = null + + + override fun exit(){ + mCameraChangeListenerList?.clear() + mCameraChangeListenerList = null + mMapTouchListenerList?.clear() + mMapTouchListenerList = null + mMapClickListenerList?.clear() + mMapClickListenerList = null + mMapLoadedListenerList?.clear() + mMapLoadedListenerList = null + mMarkClickListenerList?.clear() + mMarkClickListenerList = null + mScrollListenerList?.clear() + mScrollListenerList = null + mMapStyleListenerList?.clear() + mMapStyleListenerList = null + mScreenListenerList?.clear() + mScreenListenerList = null + mMapChangeListenerList?.clear() + mMapChangeListenerList = null + mMapViewVisualAngleChangeListenerList?.clear() + mMapViewVisualAngleChangeListenerList = null + mFocusListenerList?.clear() + mFocusListenerList = null + mRotateListenerList?.clear() + mRotateListenerList = null + mZoomListenerList?.clear() + mZoomListenerList = null + mDAngleListenerList?.clear() + mDAngleListenerList = null + mRoadInfoListenerList?.clear() + mRoadInfoListenerList = null + renderListenerList?.clear() + renderListenerList = null + mLogListenerList?.clear() + mLogListenerList = null + mHdDataDownloadListener?.clear() + mHdDataDownloadListener = null + mRoamStatusListenerList?.clear() + mRoamStatusListenerList = null + } + + override fun addHdDataDownListener(id: Int, onHdDataDownByCityListener: OnHdDataDownByCityListener){ + if(mHdDataDownloadListener == null){ + mHdDataDownloadListener = HashMap() + } + if(!mHdDataDownloadListener!!.keys.contains(id)) { + mHdDataDownloadListener?.put(id, onHdDataDownByCityListener) + } + } + + override fun removeHdDataDownListener(id: Int){ + mHdDataDownloadListener?.let { + if(it.keys.contains(id)) { + it.remove(id) + } + } + + } + + override fun dispatchHdDataDownListener(id: Int, progress: Double){ + mHdDataDownloadListener?.let { + for(listener in it.values){ + listener.onMapHDDataCacheProgressByCity(id,progress) + } + } + } + + override fun dispatchHdDataDownStateListener(id: Int, state: Int){ + mHdDataDownloadListener?.let { + for(listener in it.values){ + listener.onMapHDDataCacheStateByCity(id,state) + } + } + } + + + override fun addCameraChangeListener(cameraChangeListener: OnCameraChangeListener){ + if(mCameraChangeListenerList == null){ + mCameraChangeListenerList = ArrayList() + } + if(!mCameraChangeListenerList!!.contains(cameraChangeListener)) { + mCameraChangeListenerList?.add(cameraChangeListener) + } + } + + override fun removeCameraChangeListener(cameraChangeListener: OnCameraChangeListener){ + mCameraChangeListenerList?.remove(cameraChangeListener) + } + + override fun dispatchCameraChangeListener(type: Int, value: Int){ + mCameraChangeListenerList?.let { + for(listener in it){ + listener.onCameraChange(type, value) + } + } + } + override fun dispatchCameraChangeFinishListener(position: CameraPosition?){ + mCameraChangeListenerList?.let { + for(listener in it){ + listener.onCameraChangeFinish(position) + } + } + } + + + override fun addMapTouchListener(mapTouchListener: OnMapTouchListener){ + if(mMapTouchListenerList == null){ + mMapTouchListenerList = ArrayList() + } + if(!mMapTouchListenerList!!.contains(mapTouchListener)) { + mMapTouchListenerList?.add(mapTouchListener) + } + } + + override fun removeMapTouchListener(mapTouchListener: OnMapTouchListener){ + mMapTouchListenerList?.remove(mapTouchListener) + } + + + override fun dispatchMapTouchListener(event: MotionEvent?): Boolean{ + mMapTouchListenerList?.let { + for(listener in it){ + return listener.onTouch(event) + } + } + return false + } + + override fun isMapTouchListenerListEmpty(): Boolean{ + return mMapTouchListenerList?.isEmpty()?:true + } + + + + override fun addMapClickListener(mapClickListener: OnMapClickListener){ + if(mMapClickListenerList == null){ + mMapClickListenerList = ArrayList() + } + if(!mMapClickListenerList!!.contains(mapClickListener)) { + mMapClickListenerList?.add(mapClickListener) + } + } + + override fun removeMapClickListener(mapClickListener: OnMapClickListener){ + mMapClickListenerList?.remove(mapClickListener) + } + + override fun dispatchMapClickListener(lonLatPoint: LonLatPoint){ + mMapClickListenerList?.let { + for(listener in it){ + listener.onMapClick(lonLatPoint) + } + } + } + + override fun addMapLoadedListener(mapLoadedListener: OnMapLoadedListener){ + if(mMapLoadedListenerList == null){ + mMapLoadedListenerList = ArrayList() + } + if(!mMapLoadedListenerList!!.contains(mapLoadedListener)) { + mMapLoadedListenerList?.add(mapLoadedListener) + } + } + + override fun removeMapLoadedListener(mapLoadedListener: OnMapLoadedListener){ + mMapLoadedListenerList?.remove(mapLoadedListener) + } + + override fun dispatchMapLoadedInitListener(){ + mMapLoadedListenerList?.let { + for(listener in it){ + listener.onMapInit() + } + } + } + + override fun dispatchMapLoadedListener(){ + mMapLoadedListenerList?.let { + for(listener in it){ + listener.onMapLoaded() + } + } + } + + override fun dispatchRoadLoadedListener(roadInfo: String?){ + mMapLoadedListenerList?.let { + for(listener in it){ + listener.onRoadLoaded(roadInfo) + } + } + } + + + + override fun addMapViewVisualAngleChangeListener(mapViewVisualAngleChangeListener: OnMapViewVisualAngleChangeListener){ + if(mMapViewVisualAngleChangeListenerList == null){ + mMapViewVisualAngleChangeListenerList = ArrayList() + } + if(!mMapViewVisualAngleChangeListenerList!!.contains(mapViewVisualAngleChangeListener)) { + mMapViewVisualAngleChangeListenerList?.add(mapViewVisualAngleChangeListener) + } + } + + override fun removeMapViewVisualAngleChangeListener(mapViewVisualAngleChangeListener: OnMapViewVisualAngleChangeListener){ + mMapViewVisualAngleChangeListenerList?.remove(mapViewVisualAngleChangeListener) + } + + override fun dispatchMapViewVisualAngleChangeListener(type: Int){ + mMapViewVisualAngleChangeListenerList?.let { + for(listener in it){ + listener.onMapViewVisualAngleChange(type) + } + } + } + + override fun addScrollListener(scrollListener: OnScrollListener){ + if(mScrollListenerList == null){ + mScrollListenerList = ArrayList() + } + if(!mScrollListenerList!!.contains(scrollListener)) { + mScrollListenerList?.add(scrollListener) + } + } + + override fun removeScrollListener(scrollListener: OnScrollListener){ + mScrollListenerList?.remove(scrollListener) + } + + override fun dispatchScrollListener(x: Double, y: Double){ + mScrollListenerList?.let { + for(listener in it){ + listener.scrollBy(x,y) + } + } + } + + override fun addMapStyleListener(mapStyleListener: OnMapStyleListener){ + if(mMapStyleListenerList == null){ + mMapStyleListenerList = ArrayList() + } + if(!mMapStyleListenerList!!.contains(mapStyleListener)) { + mMapStyleListenerList?.add(mapStyleListener) + } + } + + override fun removeMapStyleListener(mapStyleListener: OnMapStyleListener){ + mMapStyleListenerList?.remove(mapStyleListener) + } + + override fun dispatchMapStyleListener(type: Int){ + mMapStyleListenerList?.let { + for(listener in it){ + listener.onChangeMapStyle(type) + } + } + } + + + override fun addScreenShotListener(screenShotListener: OnMapScreenShotListener){ + if(mScreenListenerList == null){ + mScreenListenerList = ArrayList() + } + if(!mScreenListenerList!!.contains(screenShotListener)) { + mScreenListenerList?.add(screenShotListener) + } + } + + override fun removeScreenShotListener(screenShotListener: OnMapScreenShotListener){ + mScreenListenerList?.remove(screenShotListener) + } + + override fun dispatchScreenShotListener(bitmap: Bitmap?){ + mScreenListenerList?.let { + for(listener in it){ + listener.onMapScreenShot(bitmap) + } + } + } + + + override fun addMapChangeListener(mapChangeListener: OnMapChangeListener){ + if(mMapChangeListenerList == null){ + mMapChangeListenerList = ArrayList() + } + if(!mMapChangeListenerList!!.contains(mapChangeListener)) { + mMapChangeListenerList?.add(mapChangeListener) + } + } + + override fun removeMapChangeListener(mapChangeListener: OnMapChangeListener){ + mMapChangeListenerList?.remove(mapChangeListener) + } + + override fun dispatchMapChangeListener(mogoLocation: MogoLocation){ + mMapChangeListenerList?.let { + for(listener in it){ + listener.onMapChange(mogoLocation) + } + } + } + + override fun addMarkClickListener(markClickListener: OnMarkClickListener){ + if(mMarkClickListenerList == null){ + mMarkClickListenerList = ArrayList() + } + if(!mMarkClickListenerList!!.contains(markClickListener)) { + mMarkClickListenerList?.add(markClickListener) + } + } + + override fun removeMarkClickListener(markClickListener: OnMarkClickListener){ + mMarkClickListenerList?.remove(markClickListener) + } + + override fun dispatchMarkClickListener(marker: Marker){ + mMarkClickListenerList?.let { + for(listener in it){ + listener.onMarkClick(marker) + } + } + } + + override fun isMarkClickListenerListEmpty():Boolean{ + return mMarkClickListenerList?.isEmpty()?:true + } + + + override fun addMapStatusListener(mapStatusListener: MapStatusListener, type: Int){ + when(type){ + MapAutoApi.LISTENER_TYPE_FOCUS->{ + if(mFocusListenerList == null){ + mFocusListenerList = ArrayList() + } + if(!mFocusListenerList!!.contains(mapStatusListener)) { + mFocusListenerList?.add(mapStatusListener) + } + + } + MapAutoApi.LISTENER_TYPE_ROTATE->{ + if(mRotateListenerList == null){ + mRotateListenerList = ArrayList() + } + if(!mRotateListenerList!!.contains(mapStatusListener)) { + mRotateListenerList?.add(mapStatusListener) + } + } + MapAutoApi.LISTENER_TYPE_ZOOM->{ + if(mZoomListenerList == null){ + mZoomListenerList = ArrayList() + } + if(!mZoomListenerList!!.contains(mapStatusListener)) { + mZoomListenerList?.add(mapStatusListener) + } + + } + MapAutoApi.LISTENER_TYPE_3D ->{ + if(mDAngleListenerList == null){ + mDAngleListenerList = ArrayList() + } + if(!mDAngleListenerList!!.contains(mapStatusListener)) { + mDAngleListenerList?.add(mapStatusListener) + } + } + } + } + + override fun removeMapStatusListener(mapStatusListener: MapStatusListener, type: Int){ + when(type){ + MapAutoApi.LISTENER_TYPE_FOCUS->{ + mFocusListenerList?.remove(mapStatusListener) + + } + MapAutoApi.LISTENER_TYPE_ROTATE->{ + mRotateListenerList?.remove(mapStatusListener) + } + MapAutoApi.LISTENER_TYPE_ZOOM->{ + mZoomListenerList?.remove(mapStatusListener) + } + MapAutoApi.LISTENER_TYPE_3D->{ + mDAngleListenerList?.remove(mapStatusListener) + } + } + } + + + override fun dispatchMapStatusListener(type:Int, value: Int){ + when(type){ + MapAutoApi.LISTENER_TYPE_FOCUS->{ + mFocusListenerList?.let { + for(listener in it){ + listener.onMapStatusChanged(type, value) + } + } + + } + MapAutoApi.LISTENER_TYPE_ROTATE->{ + mRotateListenerList?.let{ + for(listener in it){ + listener.onMapStatusChanged(type, value) + } + } + } + MapAutoApi.LISTENER_TYPE_ZOOM->{ + mZoomListenerList?.let { + for(listener in it){ + listener.onMapStatusChanged(type, value) + } + } + } + MapAutoApi.LISTENER_TYPE_3D->{ + mDAngleListenerList?.let{ + for(listener in it){ + listener.onMapStatusChanged(type, value) + } + } + } + } + } + + + + override fun addRenderListener(renderListener : OnRenderListener){ + if(renderListenerList == null){ + renderListenerList = ArrayList() + } + if(!renderListenerList!!.contains(renderListener)) { + renderListenerList?.add(renderListener) + } + } + + override fun removeRenderListener(renderListener : OnRenderListener){ + renderListenerList?.remove(renderListener) + } + + override fun dispatchRenderListener(duration:Int){ + renderListenerList?.let { + for(listener in it){ + listener.renderTime(duration) + } + } + } + + + override fun addRoadInfoListener(roadInfoListener: OnRoadInfoListener){ + if(mRoadInfoListenerList == null){ + mRoadInfoListenerList = ArrayList() + } + if(!mRoadInfoListenerList!!.contains(roadInfoListener)) { + mRoadInfoListenerList?.add(roadInfoListener) + } + } + + override fun removeRoadInfoListener(roadInfoListener : OnRoadInfoListener){ + mRoadInfoListenerList?.remove(roadInfoListener) + } + + override fun dispatchStopLineInfo(stopLine: StopLine?){ + mRoadInfoListenerList?.let { + for(listener in it){ + listener.onStopLineInfo(stopLine) + } + } + } + + override fun dispatchRoadIdInfo(roadId: String?, laneId: String?){ + mRoadInfoListenerList?.let { + for(listener in it){ + listener.onRoadIdInfo(roadId, laneId) + } + } + } + + override fun dispatchRoadCrossInfo(roadCross: RoadCross?){ + mRoadInfoListenerList?.let { + for(listener in it){ + listener.onRoadCrossInfo(roadCross) + } + } + } + + override fun addLogListener(listener: ILog){ + if(mLogListenerList == null){ + mLogListenerList = ArrayList() + } + if(!mLogListenerList!!.contains(listener)) { + mLogListenerList?.add(listener) + } + } + + override fun removeLogListener(listener : ILog){ + mLogListenerList?.remove(listener) + } + + override fun dispatchLog(path: String){ + mLogListenerList?.let { + for(listener in it){ + listener.result(path) + } + } + } + + override fun addRoamStatusListener(onRoamStatusListener: OnRoamStatusListener){ + if(mRoamStatusListenerList == null){ + mRoamStatusListenerList = ArrayList() + } + if(!mRoamStatusListenerList!!.contains(onRoamStatusListener)) { + mRoamStatusListenerList?.add(onRoamStatusListener) + } + } + + override fun removeRoamStatusListener(onRoamStatusListener: OnRoamStatusListener){ + mRoamStatusListenerList?.let { + it.remove(onRoamStatusListener) + } + + } + + override fun dispatchRoamStatusListener(status: Int, msg: String){ + mRoamStatusListenerList?.let { + for(listener in it){ + listener.onRoamStatus(status, msg) + } + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/db/DataStorageManager.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/db/DataStorageManager.java new file mode 100644 index 0000000000..86662b149a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/db/DataStorageManager.java @@ -0,0 +1,120 @@ +package com.zhidaoauto.map.sdk.inner.db; + +import android.location.Location; + +import com.autonavi.nge.obj.DestObj; +import com.autonavi.nge.obj.PoiBase; +import com.zhidaoauto.map.sdk.open.nav.NavPoi; + +import java.util.List; +import java.util.Vector; + +/** + * 存储所有的数据信息 + * @author + * + */ +public class DataStorageManager { + + private static DataStorageManager mDataStorageManager; + +// private TrafficDatabase mTrafficDatabase; + //不同组件之间的poi对象传输 + private NavPoi mNavPoi; + //当前位置 + private Location mCurLocation; + //搜索结果列表 + private Vector mResultList; + //工作目录 + private String mWorkingDirectory; + + private List searchList; + private String searchkey; + private int poibub; + + private DestObj mCurEditDest;//当前正在编辑的目的地 + + + + private DataStorageManager(){ + } + + public static DataStorageManager getInstance(){ + if(mDataStorageManager == null) { + mDataStorageManager = new DataStorageManager(); + } + return mDataStorageManager; + } + +// public void init(Context context){ +// SettingService service = new SettingService(context); +// Setting settings = service.getSettings(); +// MainInfo.GetInstance().setBGMusicStat(settings.isBg_music()); +// MainInfo.GetInstance().SetBusInfo(settings.getAddrDescribe() == 0?true:false); +// } + + + /** + * 搜索列表 + */ + public void setPoiList(List searchList) + { + this.searchList = searchList; + } + + public List getPoiList() + { + return searchList; + + } + /** + * 搜索关键字 + */ + + public void setPoiKey(String searchkey) + { + this.searchkey = searchkey; + } + + public String getPoiKey() + { + return searchkey; + + } + + public void setNavPoi(NavPoi navpoi) { + this.mNavPoi = navpoi; + } + + public NavPoi getNavPoi() { + return mNavPoi; + } + + /** + * 当前是第几个气泡 + */ + + public void setPoiBub(int poibub) + { + this.poibub = poibub; + } + + public int getPoiBub() + { + return poibub; + + } + + /** + * 设置正在编辑的目的地 + * @param mChannel + */ + public void setCurEditDest(DestObj mChannel) { + this.mCurEditDest = mChannel; + } + + public DestObj getCurEditDest() { + return mCurEditDest; + } + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/db/Setting.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/db/Setting.java new file mode 100644 index 0000000000..423d6bbf0c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/db/Setting.java @@ -0,0 +1,65 @@ +package com.zhidaoauto.map.sdk.inner.db; + +public class Setting { + public boolean isBg_music() { + return bg_music; + } + public void setBg_music(boolean bg_music) { + this.bg_music = bg_music; + } + public boolean isDisclaimer() { + return disclaimer; + } + public void setDisclaimer(boolean disclaimer) { + this.disclaimer = disclaimer; + } + public boolean isAuto_play() { + return auto_play; + } + public void setAuto_play(boolean auto_play) { + this.auto_play = auto_play; + } + public boolean isAlways() { + return always; + } + public void setAlways(boolean always) { + this.always = always; + } + public String getUserName() { + return userName; + } + public void setUserName(String userName) { + this.userName = userName; + } + public String geteMail() { + return eMail; + } + public void seteMail(String eMail) { + this.eMail = eMail; + } + + public int getAddrDescribe() { + return AddrDescribe; + } + public void setAddrDescribe(int addrDescribe) { + AddrDescribe = addrDescribe; + } + + public void setRegisted(boolean isRegisted) { + this.isRegisted = isRegisted; + } + + public boolean isRegisted() { + return isRegisted; + } + + private boolean bg_music; //背景音乐设置 + private boolean disclaimer; //启动时显示免责声明 + private boolean auto_play; //启动时开启路况播报 + private boolean always; //使用中保持屏幕常亮 + private int AddrDescribe ; //拥堵地点描述方式 :0- 优先使用地名描述 1-优先使用交叉口描述 + private String userName; //用户名 + private String eMail; //用户邮箱 + private boolean isRegisted = false;//是否注册 + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/db/SettingService.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/db/SettingService.java new file mode 100644 index 0000000000..6bc75c43fb --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/db/SettingService.java @@ -0,0 +1,345 @@ +package com.zhidaoauto.map.sdk.inner.db; + +import android.content.Context; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; + +import com.autonavi.nge.routing.RoutingProvider; + +public class SettingService { + private SharedPreferences mSharedPreferences; + + private static final String PREFERENCES_ADDR_DESTRIBE = "list_preference"; + private static final String PREFERENCES_ALWAYS = "always"; + private static final String PREFERENCES_MAP_MODE = "map_mode"; + private static final String PREFERENCES_USER_ROUTE = "user_route"; + private static final String PREFERENCES_AUTO_PLAY = "auto_play"; + private static final String PREFERENCES_AUTO_GO = "auto_go"; + private static final String PREFERENCES_PLAY_ROAD = "play_road"; + private static final String PREFERENCES_BG_MUSIC = "bg_music"; + private static final String PREFERENCES_SHOW_DISCLAIMER = "disclaimer"; + private static final String PREFERENCES_EMAIL = "eMail"; + private static final String PREFERENCES_USER_NAME = "userName"; + private static final String PREFERENCES_IMSI = "imsi"; + private static final String PREFERENCES_IS_REGISTED = "isRegisted"; + private static final String PREFERENCES_IS_DOWNLOAD_MAP_SHOW = "downloadMap"; + private static final String PREFERENCES_LOCATION_LON = "MapCenterX"; + private static final String PREFERENCES_LOCATION_LAT = "MapCenterY"; + private static final String PREFERENCES_MEDIA_BOTTOM = "mediaBottom"; + private static final String PREFERENCES_MEDIA_AUTO_PLAY = "mediaAutoPlay"; + private static final String PREFERENCES_BT_ADS = "bluetoothAddress"; + private static final String PREFERENCES_ROUTING_MODEL = "routingModel"; + private static final String PREFERENCES_ROUTING_AVOID_HWAY = "routingAvoidHWay"; + private static final String PREFERENCES_ROUTING_AVOID_TOLL = "routingAvoidToll"; + private static final String PREFERENCES_SEARCH_UPDATEREGION = "searchUpdateRegion"; + private static final String PREFERENCES_SEARCH_UPDATEREGION_NAME = "searchUpdateRegionName"; + private static final String PREFERENCES_ROUTE_SELECT_SHOW = "RouteSelectShow"; + private static final String PREFERENCES_TRACK = "track"; + private static final String PREFERENCES_SPEED_HIGHWAY = "highway_speed"; + private static final String PREFERENCES_SPEED_FAST = "fast_speed"; + private static final String PREFERENCES_SPEED_GENERAL = "general_speed"; + private static final String PREFERENCES_SPEED_HIGHWAY_TIP = "highway_speed_tip"; + private static final String PREFERENCES_SPEED_FAST_TIP = "fast_speed_tip"; + private static final String PREFERENCES_SPEED_GENERAL_TIP = "general_speed_tip"; + private static final String PREFERENCES_MAP_STYLE = "map_style"; + + public SettingService(Context context){ + mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); + } + + public Setting getSettings(){ + Setting mSetting = new Setting(); + String addrDescrbe = mSharedPreferences.getString(PREFERENCES_ADDR_DESTRIBE, "0"); + int id = 0; + try { + id = Integer.parseInt(addrDescrbe); + } catch (NumberFormatException e) { + id = 0; + } + mSetting.setAddrDescribe(id); + mSetting.setAlways(mSharedPreferences.getBoolean(PREFERENCES_ALWAYS, true)); + mSetting.setAuto_play(mSharedPreferences.getBoolean(PREFERENCES_AUTO_PLAY, true)); + mSetting.setBg_music(mSharedPreferences.getBoolean(PREFERENCES_BG_MUSIC, true)); + mSetting.setDisclaimer(mSharedPreferences.getBoolean(PREFERENCES_SHOW_DISCLAIMER, true)); + mSetting.seteMail(mSharedPreferences.getString(PREFERENCES_EMAIL, "")); + mSetting.setUserName(mSharedPreferences.getString(PREFERENCES_USER_NAME,"")); + mSetting.setUserName(mSharedPreferences.getString(PREFERENCES_IMSI,"")); + mSetting.setRegisted(mSharedPreferences.getBoolean(PREFERENCES_IS_REGISTED, false)); + return mSetting; + } + + public boolean isShowBGMusic(){ + return mSharedPreferences.getBoolean(PREFERENCES_BG_MUSIC, true); + } + + public boolean updateShowBGMusic(boolean show){ + return mSharedPreferences.edit().putBoolean(PREFERENCES_BG_MUSIC, show).commit(); + } + + public boolean isShowDisclaimer(){ + return mSharedPreferences.getBoolean(PREFERENCES_SHOW_DISCLAIMER, true); + } + + public boolean updateShowDisclaimer(boolean show){ + return mSharedPreferences.edit().putBoolean(PREFERENCES_SHOW_DISCLAIMER, show).commit(); + } + + public boolean isShowAutoPlay(){ + return mSharedPreferences.getBoolean(PREFERENCES_AUTO_PLAY, true); + } + + public boolean updateAutoPlay(boolean show){ + return mSharedPreferences.edit().putBoolean(PREFERENCES_AUTO_PLAY, show).commit(); + } + + public boolean isShowAllwaysScreenOn(){ + return mSharedPreferences.getBoolean(PREFERENCES_ALWAYS, true); + } + + public boolean updateShowAllwaysScreenOn(boolean show){ + return mSharedPreferences.edit().putBoolean(PREFERENCES_ALWAYS, show).commit(); + } + + public String getUserName(){ + return mSharedPreferences.getString(PREFERENCES_USER_NAME, ""); + } + + public boolean setUserName(String userName){ + return mSharedPreferences.edit().putString(PREFERENCES_USER_NAME, userName).commit(); + } + + public String getEmail(){ + return mSharedPreferences.getString(PREFERENCES_EMAIL, ""); + } + + public boolean setEmail(String eMail){ + return mSharedPreferences.edit().putString(PREFERENCES_EMAIL, eMail).commit(); + } + + public String getIMSI() + { + return mSharedPreferences.getString(PREFERENCES_IMSI, ""); + } + + public boolean setIMSI(String imsi) + { + return mSharedPreferences.edit().putString(PREFERENCES_IMSI, imsi).commit(); + } + + + public int getAddrDescribe(){ + String addrDescrbe = mSharedPreferences.getString(PREFERENCES_ADDR_DESTRIBE, "0"); + int id = 0; + try { + id = Integer.parseInt(addrDescrbe); + } catch (NumberFormatException e) { + id = 0; + } + return id; + } + + public boolean setAddrDescribe(int describe){ + return mSharedPreferences.edit().putString(PREFERENCES_ADDR_DESTRIBE, String.valueOf(describe)).commit(); + } + + public boolean setRegisted(boolean isRegisted){ + return mSharedPreferences.edit().putBoolean(PREFERENCES_IS_REGISTED, isRegisted).commit(); + } + + public boolean isRegisted(){ + return mSharedPreferences.getBoolean(PREFERENCES_IS_REGISTED, false); + } + + public boolean isDownloadMapShow(){ + return mSharedPreferences.getBoolean(PREFERENCES_IS_DOWNLOAD_MAP_SHOW, true); + } + + public boolean setDownloadMapShow(boolean DownloadMapShow){ + return mSharedPreferences.edit().putBoolean(PREFERENCES_IS_DOWNLOAD_MAP_SHOW, DownloadMapShow).commit(); + } + + public int getLocationLon(){ + return mSharedPreferences.getInt(PREFERENCES_LOCATION_LON, 419031495); + } + + public boolean setLocationLon(int LocLon){ + return mSharedPreferences.edit().putInt(PREFERENCES_LOCATION_LON, LocLon).commit(); + } + + public int getLocationLat(){ + return mSharedPreferences.getInt(PREFERENCES_LOCATION_LAT, 143664145); + } + + public boolean setLocationLat(int LocLat){ + return mSharedPreferences.edit().putInt(PREFERENCES_LOCATION_LAT, LocLat).commit(); + } + + public boolean isAutoGo() { + return mSharedPreferences.getBoolean(PREFERENCES_AUTO_GO, true); + } + + public boolean updateAutoGo(boolean b) { + return mSharedPreferences.edit().putBoolean(PREFERENCES_AUTO_GO, b).commit(); + } + + public boolean isDriverMap() { + return mSharedPreferences.getBoolean(PREFERENCES_MAP_MODE, false); + } + + public boolean updateDriverMap(boolean b) { + return mSharedPreferences.edit().putBoolean(PREFERENCES_MAP_MODE, b).commit(); + } + + public boolean isLastUserRoute() { + return mSharedPreferences.getBoolean(PREFERENCES_USER_ROUTE, true); + } + + public boolean updateUserRoute(boolean b) { + return mSharedPreferences.edit().putBoolean(PREFERENCES_USER_ROUTE, b).commit(); + } + + public boolean isPlayRoad() { + return mSharedPreferences.getBoolean(PREFERENCES_PLAY_ROAD, true); + } + + public boolean updatePlayRoad(boolean b) { + return mSharedPreferences.edit().putBoolean(PREFERENCES_PLAY_ROAD, b).commit(); + } + + public int getMediaBottom(){ + return mSharedPreferences.getInt(PREFERENCES_MEDIA_BOTTOM, 0); + } + + public boolean updateMediaBottom(int bottom){ + return mSharedPreferences.edit().putInt(PREFERENCES_MEDIA_BOTTOM, bottom).commit(); + } + + public boolean isMediaAutoPlay() { + return mSharedPreferences.getBoolean(PREFERENCES_MEDIA_AUTO_PLAY, true); + } + + public boolean updateMediaAutoPlay(boolean b) { + return mSharedPreferences.edit().putBoolean(PREFERENCES_MEDIA_AUTO_PLAY, b).commit(); + } + + public String getBtAddr(){ + return mSharedPreferences.getString(PREFERENCES_BT_ADS, ""); + } + + public boolean updateBtAddr(String btAddr){ + return mSharedPreferences.edit().putString(PREFERENCES_BT_ADS, btAddr).commit(); + } + + public int getRoutingModel(){ + return mSharedPreferences.getInt(PREFERENCES_ROUTING_MODEL, RoutingProvider.COSTMODEL_FASTEST); + } + + public boolean setRoutingModel(int model){ + return mSharedPreferences.edit().putInt(PREFERENCES_ROUTING_MODEL, model).commit(); + } + + public boolean isRoutingAvoidHighway(){ + return mSharedPreferences.getBoolean(PREFERENCES_ROUTING_AVOID_HWAY, false); + } + + public boolean setRoutingAvoidHighway(boolean isRoutingAvoidHighway){ + return mSharedPreferences.edit().putBoolean(PREFERENCES_ROUTING_AVOID_HWAY, isRoutingAvoidHighway).commit(); + } + + public boolean isRoutingAvoidToll(){ + return mSharedPreferences.getBoolean(PREFERENCES_ROUTING_AVOID_TOLL, false); + } + + public boolean setRoutingAvoidToll(boolean isRoutingAvoidToll){ + return mSharedPreferences.edit().putBoolean(PREFERENCES_ROUTING_AVOID_TOLL, isRoutingAvoidToll).commit(); + } + + public int getUpdateRegion(){ + return mSharedPreferences.getInt(PREFERENCES_SEARCH_UPDATEREGION, 1); + } + + public boolean setUpdateRegion(int urId){ + return mSharedPreferences.edit().putInt(PREFERENCES_SEARCH_UPDATEREGION, urId).commit(); + } + + public String getUpdataRegionName(){ + return mSharedPreferences.getString(PREFERENCES_SEARCH_UPDATEREGION_NAME, "北京市"); + } + + public boolean setUpdataRegionName(String name){ + return mSharedPreferences.edit().putString(PREFERENCES_SEARCH_UPDATEREGION_NAME, name).commit(); + } + + public boolean isRouteSelectShow() { + return mSharedPreferences.getBoolean(PREFERENCES_ROUTE_SELECT_SHOW, true); + } + + public boolean setRouteSelectShow(boolean isRouteSelectShow){ + return mSharedPreferences.edit().putBoolean(PREFERENCES_ROUTE_SELECT_SHOW, isRouteSelectShow).commit(); + } + + public boolean isTrack(){ + return mSharedPreferences.getBoolean(PREFERENCES_TRACK, false); + } + + public boolean setTrack(boolean isTrack){ + return mSharedPreferences.edit().putBoolean(PREFERENCES_TRACK, isTrack).commit(); + } + + public boolean setSpeedHighWay(int speed){ + return mSharedPreferences.edit().putInt(PREFERENCES_SPEED_HIGHWAY, speed).commit(); + } + + public int getSpeedHighWay(){ + return mSharedPreferences.getInt(PREFERENCES_SPEED_HIGHWAY, 120); + } + + public boolean setSpeedFast(int speed){ + return mSharedPreferences.edit().putInt(PREFERENCES_SPEED_FAST, speed).commit(); + } + + public int getSpeedFast(){ + return mSharedPreferences.getInt(PREFERENCES_SPEED_FAST, 90); + } + + public boolean setSpeedGeneral(int speed){ + return mSharedPreferences.edit().putInt(PREFERENCES_SPEED_GENERAL, speed).commit(); + } + + public int getSpeedGeneral(){ + return mSharedPreferences.getInt(PREFERENCES_SPEED_GENERAL, 60); + } + + public boolean getSpeedHighWayTip(){ + return mSharedPreferences.getBoolean(PREFERENCES_SPEED_HIGHWAY_TIP, true); + } + + public boolean setSpeedHighWayTip(boolean tipOn){ + return mSharedPreferences.edit().putBoolean(PREFERENCES_SPEED_HIGHWAY_TIP, tipOn).commit(); + } + + public boolean setSpeedFastTip(boolean tipOn){ + return mSharedPreferences.edit().putBoolean(PREFERENCES_SPEED_FAST_TIP, tipOn).commit(); + } + + public boolean getSpeedFastTip(){ + return mSharedPreferences.getBoolean(PREFERENCES_SPEED_FAST_TIP, true); + } + + public boolean setSpeedGeneralTip(boolean tipOn){ + return mSharedPreferences.edit().putBoolean(PREFERENCES_SPEED_GENERAL_TIP, tipOn).commit(); + } + + public boolean getSpeedGeneralTip(){ + return mSharedPreferences.getBoolean(PREFERENCES_SPEED_GENERAL_TIP, true); + } + + public boolean setMapStyle(String style){ + return mSharedPreferences.edit().putString(PREFERENCES_MAP_STYLE, style).commit(); + } + + public String getMapStyle(){ + return mSharedPreferences.getString(PREFERENCES_MAP_STYLE, "0"); + } + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/element/M3DCar.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/element/M3DCar.java new file mode 100644 index 0000000000..6b2afa8ef1 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/element/M3DCar.java @@ -0,0 +1,43 @@ +package com.zhidaoauto.map.sdk.inner.element; + +import android.content.Context; + +import java.io.DataInputStream; +import java.io.IOException; + +public class M3DCar { + private Context context; + private int resid; + public byte[] totBuffer = null; + public int totSize = 0; + + public M3DCar(Context context, int resid) { + this.resid = resid; + this.context = context; + loadData(); + } + + private void loadData() { + if (null != totBuffer) + return; + DataInputStream dis = new DataInputStream(context.getResources().openRawResource(resid)); + int curTotSize = 64 * 1024; + totBuffer = new byte[curTotSize]; + byte[] buffer = new byte[1024]; + int size = 0; + try { + while ((size = dis.read(buffer)) >= 0) { + if (totSize + size > curTotSize) { + curTotSize = (totSize + size) * 3 / 2; + byte[] newTotBuffer = new byte[curTotSize]; + System.arraycopy(totBuffer, 0, newTotBuffer, 0, totSize); + totBuffer = newTotBuffer; + } + System.arraycopy(buffer, 0, totBuffer, totSize, size); + totSize += size; + } + dis.close(); + } catch (IOException e) { + } + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/element/MapCoordinate.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/element/MapCoordinate.java new file mode 100644 index 0000000000..d9b0a9f899 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/element/MapCoordinate.java @@ -0,0 +1,16 @@ +package com.zhidaoauto.map.sdk.inner.element; + +public class MapCoordinate { + public int x; + public int y; + + public MapCoordinate(){} + public MapCoordinate(int x, int y){ + this.x = x; + this.y = y; + } + @Override + public String toString(){ + return "x=" + x + " y=" + y; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/location/LocationHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/location/LocationHelper.kt new file mode 100644 index 0000000000..1732ce3641 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/location/LocationHelper.kt @@ -0,0 +1,99 @@ +package com.zhidaoauto.map.sdk.inner.location + +import android.content.Context +import android.graphics.BitmapFactory +import android.util.Log +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.ILocationView +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.abs.IMarkerController +import com.zhidaoauto.map.sdk.open.MapAutoApi +import com.zhidaoauto.map.sdk.open.location.MyLocationStyle +import io.netty.util.internal.StringUtil + +class LocationHelper(private var mContext: Context?, private var mMarkerController: IMarkerController?, private var mMapController: IMapController?):ILocationView { + private val TAG = "LocationHelper" + + private var myLocationEnabled: Boolean = false + private lateinit var myLocationStyle: MyLocationStyle + + init { + if (CompileConfig.DEBUG) { + Log.i(TAG, "selfop---markerop-LocationHelper constructor") + } + myLocationStyle = MyLocationStyle(mContext, mMarkerController, mMapController) + val mMapStyle = mMapController?.getMapStyleParams()?.getStyleMode()?:MapAutoApi.MAP_STYLE_NIGHT + switch(mMapStyle) + + } + + override fun exit() { + myLocationStyle?.exit() + } + + override fun switch(style: Int) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "selfop---markerop-carCursorRes switch:${style}") + } + + if (style >= MapAutoApi.MAP_STYLE_NIGHT_VR) { + myLocationStyle?.let { + if (style == MapAutoApi.MAP_STYLE_NIGHT_VR) { + it.setAnimMarkerRes( + R.raw.guangquan, + MyLocationStyle.ANIM_WAIT_FRAME_NIGHT, + MyLocationStyle.ANIM_PERIOD_NIGHT + ) + } else { + it.setAnimMarkerRes( + R.raw.guangquan_day, + MyLocationStyle.ANIM_WAIT_FRAME_DAY, + MyLocationStyle.ANIM_PERIOD_DAY + ) + } + it.myLocationIcon(it.car3DResId, true) + } + + } else { + myLocationStyle?.let { + var bitmap = it.myLocationIcon + if (bitmap == null) { + it.myLocationIcon(it.carResId) + } else { + if (!StringUtil.isNullOrEmpty(it.locationPath)) { + bitmap = BitmapFactory.decodeFile(it.locationPath) + } + if (bitmap != null) { + if (bitmap.isRecycled) { + it.myLocationIcon(it.carResId) + return@let + } + it.myLocationIcon(bitmap) + } else { + it.myLocationIcon(it.carResId) + } + + } + } + } + } + + override fun setMyLocationEnabled(myLocationEnabled: Boolean) { + this.myLocationEnabled = myLocationEnabled + } + + override fun getMyLocationEnabled(): Boolean { + return this.myLocationEnabled + } + + override fun setMyLocationStyle(myLocationStyle: MyLocationStyle) { + this.myLocationStyle = myLocationStyle + } + + override fun getMyLocationStyle(): MyLocationStyle? { + return myLocationStyle + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapAnimate.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapAnimate.kt new file mode 100644 index 0000000000..e0afa21fcc --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapAnimate.kt @@ -0,0 +1,126 @@ +package com.zhidaoauto.map.sdk.inner.map + +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.common.ConstantExt +import com.zhidaoauto.map.sdk.open.MapAutoApi + +class MapAnimate(private val mMapController: IMapController) { + private var TAG = javaClass.simpleName + private var startEyeHeight: Float + private var startLookAngle: Float + private var startZoomVal: Float + + private var endEyeHeight:Float? = null + private var endLookAngle:Float? = null + private var endZoomVal:Float? = null + private var duration = 1000 + private var startTime = 0L + private var isRuning:Boolean = false + + init { + if(mMapController.getMapStyleParams().getStyleMode() == MapAutoApi.MAP_STYLE_NIGHT){ + startEyeHeight = ConstantExt.MAP_STYLE_2D_EYE_HEIGHT + startLookAngle = ConstantExt.MAP_STYLE_2D_OVER_LOOK_ANGLE + startZoomVal = ConstantExt.MAP_STYLE_2D_ZOOM.toFloat() + }else{ + startEyeHeight = ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_MIDDLE + startLookAngle = ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_MIDDLE + startZoomVal = ConstantExt.MAP_STYLE_VR_ZOOM_VAL_MIDDLE + } + + } + + fun setStartFrame(zoomVal: Float, lookAngle: Float, eyeHeight: Float){ + if(zoomVal != -1f){ + startZoomVal = zoomVal + } + if(lookAngle != -1f){ + startLookAngle = lookAngle + } + if(eyeHeight != -1f){ + startEyeHeight = eyeHeight + } + } + + fun executeAnim(zoomVal:Float, eyeHeight:Float, lookAngle:Float, duration: Int){ + if(zoomVal == -1f){ + endZoomVal = startZoomVal + }else { + endZoomVal = zoomVal + } + if(eyeHeight == -1f){ + endEyeHeight = startEyeHeight + }else { + endEyeHeight = eyeHeight + } + if(lookAngle == -1f){ + endLookAngle = startLookAngle + }else { + endLookAngle = lookAngle + } + if(duration != -1){ + this.duration = duration + }else{ + this.duration = 1000 + } + startTime= System.currentTimeMillis() + isRuning = true + } + + fun isAnimationing():Boolean{ + if(startTime == 0L + || !isRuning + || (System.currentTimeMillis()-startTime)>duration){ + return false + } + return true + } + + fun endAnimation(){ + startTime = 0L + isRuning = false + endZoomVal?.let { + startZoomVal = it + } + endLookAngle?.let { + startLookAngle = it + } + endEyeHeight?.let { + startEyeHeight = it + } + } + + fun stepAnimation(): FloatArray{ + if(!isRuning){ + return floatArrayOf(startZoomVal,startLookAngle,startEyeHeight) + } + if(!isAnimationing()){ + endAnimation() + return floatArrayOf(startZoomVal,startLookAngle,startEyeHeight) + } + + var eyeHeight = 0f + var angle = 0f + var zoomVal = 0f + var factor = ((System.currentTimeMillis() - startTime) / duration.toFloat()) + + if( factor >=1){ + endAnimation() + return floatArrayOf(startZoomVal, startLookAngle,startEyeHeight) + }else{ + eyeHeight = startEyeHeight + factor * (endEyeHeight!! - startEyeHeight) + angle = startLookAngle + factor * (endLookAngle!! - startLookAngle) + zoomVal = startZoomVal + factor * (endZoomVal!! - startZoomVal) + } + + if(CompileConfig.DEBUG){ + Log.d(TAG, "angle: ${angle}, height: ${eyeHeight}, zoomVal: ${zoomVal}") + } + return floatArrayOf(zoomVal,angle,eyeHeight) + } + + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapCameraMessageImpl.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapCameraMessageImpl.kt new file mode 100644 index 0000000000..697aa74235 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapCameraMessageImpl.kt @@ -0,0 +1,136 @@ +package com.zhidaoauto.map.sdk.inner.map + +import android.graphics.Point +import com.zhidaoauto.map.sdk.open.camera.CameraPosition +import com.zhidaoauto.map.sdk.open.camera.LatLngBounds +import com.zhidaoauto.map.sdk.open.camera.MapCameraMessage +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class MapCameraMessageImpl private constructor() : MapCameraMessage() { +/* private var a: Float = 0.toFloat() + private var b: Float = 0.toFloat() + private var c: ae? = null*/ + + companion object { + + fun createNewInstance(): MapCameraMessageImpl { + return MapCameraMessageImpl() + } + + fun createZoomInInstance(): MapCameraMessageImpl { + val instance = createNewInstance() + instance.nowType = Type.zoomIn + return instance + } + + fun createZoomOutInstance(): MapCameraMessageImpl { + val instance = createNewInstance() + instance.nowType = Type.zoomOut + return instance + } + + fun createNewInstance(xPixel: Float, yPixel: Float): MapCameraMessageImpl { + val instance = createNewInstance() + instance.nowType = Type.scrollBy + instance.xPixel = xPixel + instance.yPixel = yPixel + return instance + } + + fun createNewInstance(zoom: Float): MapCameraMessageImpl { + val instance = createNewInstance() + instance.nowType = Type.zoomTo + instance.zoom = zoom + return instance + } + + fun createAmountInstance(amount: Float): MapCameraMessageImpl { + return createNewInstance(amount, null as Point?) + } + + fun createNewInstance(amount: Float, point: Point?): MapCameraMessageImpl { + val instance = createNewInstance() + instance.nowType = Type.zoomBy + instance.amount = amount + instance.focus = point + return instance + } + + fun createNewInstance(cameraPosition: CameraPosition?): MapCameraMessageImpl { + val instance = createNewInstance() + instance.nowType = Type.newCameraPosition + instance.cameraPosition = cameraPosition + return instance + } + + fun createNewInstance(latLng: LonLatPoint): MapCameraMessageImpl { + val instance = createNewInstance() + instance.nowType = Type.changeCenter + instance.cameraPosition = + CameraPosition( + latLng, + 0.0f, + 0.0f, + 0.0f + ) + return instance + } + + fun createInstance(latLng: LonLatPoint): MapCameraMessageImpl? { + return createNewInstance(CameraPosition.builder().target(latLng).build()) + } + + fun createNewInstance(latLng: LonLatPoint, zoomLevel: Float): MapCameraMessageImpl { + return createNewInstance(CameraPosition.builder().target(latLng).zoom(zoomLevel).build()) + } + + fun createNewInstance( + latLng: LonLatPoint, + zoomLevel: Float, + bearing: Float, + tilt: Float + ): MapCameraMessageImpl? { + return createNewInstance( + CameraPosition.builder().target(latLng).zoom(zoomLevel).bearing( + bearing + ).tilt(tilt).build() + ) + } + + + fun createNewInstance(latLngBounds: LatLngBounds, padding: Int): MapCameraMessageImpl { + val instance = createNewInstance() + instance.nowType = Type.newLatLngBounds + instance.bounds = latLngBounds + instance.paddingLeft = padding + instance.paddingRight = padding + instance.paddingTop = padding + instance.paddingBottom = padding + return instance + } + + fun createNewInstance(latLngBounds: LatLngBounds, width: Int, height: Int, padding: Int): MapCameraMessageImpl { + val instance = createNewInstance() + instance.nowType = Type.newLatLngBoundsWithSize + instance.bounds = latLngBounds + instance.paddingLeft = padding + instance.paddingRight = padding + instance.paddingTop = padding + instance.paddingBottom = padding + instance.width = width + instance.height = height + return instance + } + + fun createNewInstance(latLngBounds: LatLngBounds, paddingLeft: Int, paddingRight: Int, paddingTop: Int, paddingBottom: Int): MapCameraMessage { + val instance = createNewInstance() + instance.nowType = Type.newLatLngBounds + instance.bounds = latLngBounds + instance.paddingLeft = paddingLeft + instance.paddingRight = paddingRight + instance.paddingTop = paddingTop + instance.paddingBottom = paddingBottom + return instance + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapController.kt new file mode 100644 index 0000000000..329901d3d5 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapController.kt @@ -0,0 +1,2134 @@ +package com.zhidaoauto.map.sdk.inner.map + +import android.content.Context +import android.graphics.Bitmap +import android.os.Handler +import android.os.Message +import android.util.Log +import android.view.View +import com.alibaba.fastjson.JSON +import com.autonavi.nge.map.LonLat +import com.autonavi.nge.map.OnMapScreenShotListener +import com.autonavi.nge.map.Pixels +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG +import com.zhidaoauto.map.sdk.inner.abs.IEventController +import com.zhidaoauto.map.sdk.inner.abs.ILocationView +import com.zhidaoauto.map.sdk.inner.abs.ILockLocation +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.abs.IMapView +import com.zhidaoauto.map.sdk.inner.abs.IMarkerCall +import com.zhidaoauto.map.sdk.inner.abs.IMarkerController +import com.zhidaoauto.map.sdk.inner.common.CommonHelper +import com.zhidaoauto.map.sdk.inner.common.ConstantExt +import com.zhidaoauto.map.sdk.inner.element.M3DCar +import com.zhidaoauto.map.sdk.inner.element.MapCoordinate +import com.zhidaoauto.map.sdk.inner.marker.RecycleController +import com.zhidaoauto.map.sdk.inner.panel.PolyLineView +import com.zhidaoauto.map.sdk.inner.road.RoadHelper +import com.zhidaoauto.map.sdk.inner.use.Clerk +import com.zhidaoauto.map.sdk.inner.utils.GisGeomTool +import com.zhidaoauto.map.sdk.inner.utils.LogHelper +import com.zhidaoauto.map.sdk.inner.utils.MathUtils +import com.zhidaoauto.map.sdk.inner.utils.TransformUtils +import com.zhidaoauto.map.sdk.open.MapAutoApi +import com.zhidaoauto.map.sdk.open.abs.IResult +import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener +import com.zhidaoauto.map.sdk.open.abs.view.IMapStyleParams +import com.zhidaoauto.map.sdk.open.circle.CircleController +import com.zhidaoauto.map.sdk.open.circle.CircleOptions +import com.zhidaoauto.map.sdk.open.deadzone.DeadZone +import com.zhidaoauto.map.sdk.open.deadzone.DeadZoneOptions +import com.zhidaoauto.map.sdk.open.poyline.Polyline +import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.road.CenterLine +import com.zhidaoauto.map.sdk.open.tools.MapTools +import com.zhidaoauto.map.sdk.open.weather.WeatherModel +import com.zhidaoauto.map.sdk.open.weather.WeatherResult +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import java.util.concurrent.CopyOnWriteArrayList +import java.util.concurrent.atomic.AtomicBoolean + +class MapController(private var context: Context?, private val mMapView: IMapView + ,private val mLockLocation:ILockLocation,private val mEventController:IEventController?,private val mMapStyleParams: IMapStyleParams +) : IMapController { + + + private var mCar: M3DCar? = null + private var mZoomAdj: MapZoomAdjuster? = null + private val polyLineView: PolyLineView? = null + private var mMapPerspective = MAP_PERSPECTIVE_2D + private var isFollowCarMode = true + private var isMapNorth = false + private var lastZoom = 16 + private var lonLat: LonLat? = null + private var isSetMapStyle = false + private var mRoamDis = ConstantExt.ROAM_DIS_1KM + private var mSpeed = ConstantExt.ROAM_SPEED_30 + private val DEFAULT_ROAM_DIS = 1800f + private var isRoam:AtomicBoolean = AtomicBoolean(false) + private var mTravel = "" + private var isUseTrace = 1// 0 不使用轨迹 1 使用轨迹 + private lateinit var mapAnimate: MapAnimate + private var roadLineJob: Job? = null + private var roadLeaveLineJob: Job? = null + private var roadLineTimeJob: Job? = null + private var roamJob: Job? = null + private var cacheHdDataProgressJob: Job? = null + private var transJob: Job? = null + private var destLonLatPoint: LonLatPoint? = null + private var destAngle = 0f + private var angle = 0f + + private val pelNames: List + + protected var mMarkerCall: IMarkerCall? = null + + //The controller of marker + protected var mMarkerController: IMarkerController? = null + + private var mILocationView:ILocationView? = null + //The Clerk + private var mClerk: Clerk? = null + + private lateinit var mRecyClerController:RecycleController + + + init { + mClerk = Clerk(this) + mRecyClerController = RecycleController() + } + /** + * 重新绘制 + * + * @param paintColor + * @param paintWidth + */ + private fun refreshCustomView(paintColor: Int, paintWidth: Int) { + polyLineView?.paintColor = paintColor + polyLineView?.paintWidth = paintWidth + polyLineView?.invalidate() + } + + override fun getMapScreenShot(var1: OnMapScreenShotListener) {} + + // return mMapView.getVersion(); + val version: String + get() =// return mMapView.getVersion(); + "" + + fun createMapViewInstance() {} + fun releaseMapViewInstance() {} + + /** + * 设置中心位置 + * + * @param lon 经度 + * @param lat 纬度 + */ + override fun setCenter(lon: Double, lat: Double) { + if (TransformUtils.outOfChina(lat, lon)) { + return + } +// val listeners = mMapView.getMapStatusChangeListeners() +// if (listeners != null && listeners.size > 0) { +// for (lis in listeners) { +// lis.onMapStatusChangeListener(LISTENER_TYPE_CENTER, 0) +// } +// } + mMapView.getMapEngine().setCenter(lon, lat) + if (DEBUG) { + Log.i(TAG, "centerop-lockop-setCenter: $lon,$lat") + } + } + + override fun getCenter(): MapCoordinate? { + val mCenter = DoubleArray(2) + mMapView.getMapEngine().getCenter(mCenter) + return MapCoordinate((mCenter[0] * ConstantExt.RULE_INT).toInt(), (mCenter[1] * ConstantExt.RULE_INT).toInt()) + } + + override fun getCenter(point: DoubleArray) { + mMapView.getMapEngine().getCenter(point) + } + + //获取车辆的位置 + override fun getCarPosition(pos: MapCoordinate?): Int { + val mCenter = IntArray(2) + val res = mMapView.getMapEngine().getCarPosition(mCenter) + pos?.x = mCenter[0] + pos?.y = mCenter[1] + return res + } + + fun displayRoute(): Boolean { +// return mMapView.displayRoute(); + return true + } + + fun hideRoute(): Boolean { +// return mMapView.hideRoute(); + return true + } + + fun ConvertPixelCoordsToGeoCoords(x: Int, y: Int, lon: Double, lat: Double) { +// mMapView.ConvertPixelCoordsToGeoCoords(int x, int y, double lon, double lat); + } + + fun ConvertGeoCoordsToPixelCoords(x: Int, y: Int, lon: Double, lat: Double) { +// mMapView.ConvertGeoCoordsToPixelCoords(int x, int y, double lon, double lat); + } + + fun addOverLay(lon: Double, lat: Double /*, OverLay overLay*/) { +// mMapView.addOverLay(double lon, double lat, OverLay overLay); + } + + override fun rotate(rotateAngle: Float) { + dispatchRotationAngleChanged(rotateAngle) + } + + + override fun getContext(): Context? { + return context + } + override fun setMarkerCall(markerCall: IMarkerCall) { + this.mMarkerCall = markerCall + mMapView.setMarkerCall(markerCall) + } + + override fun setLocalView(localView: ILocationView?) { + mILocationView = localView + } + + override fun getMarkerCall(): IMarkerCall? { + return mMarkerCall + } + + override fun getMapStyleParams(): IMapStyleParams { + return mMapStyleParams + } + + override fun getClerk(): Clerk? { + return mClerk + } + + override fun setMarkerController(markerController: IMarkerController?) { + this.mMarkerController = markerController + } + + override fun getMarkerController(): IMarkerController? { + return mMarkerController + } + + override fun getEventController():IEventController?{ + return mEventController + } + + override fun isSurfaceCreated(): Boolean { + return mMapView.isSurfaceCreated() + } + + override fun clearSearchResult() { + mMapView.getMapEngine().clearSearchResult() + } + + override fun lookUpDown() { + dispatchDAngleChanged() + } + + override fun zoomIn() { + mMapView.getMapEngine().zoomIn() + } + + override fun zoomOut() { + mMapView.getMapEngine().zoomOut() + } + + fun canZoomIn(): Boolean { + // return mMapView.canZoomIn(); + return true + } + + fun canZoomOut(): Boolean { + // return mMapView.canZoomOut(); + return true + } + + override fun drawRoute() { + mMapView.getMapEngine().drawRoute() + } + + override fun removeImage(imageKey: String) { + mMapView.getMapEngine().removeImage(imageKey) + } + + override fun lonlatToPixels(lon: Double, lat: Double): Pixels? { + return mMapView.getMapEngine().lonlatToPixels(lon, lat) + } + + override fun pixelsToLonlat(x: Float, y: Float): LonLat? { + return mMapView.getMapEngine().pixelsToLonlat(x,y) + } + + override fun setTmcData(tmcData: ByteArray?) { + mMapView.getMapEngine().setTmcData(tmcData) + } + + override fun draw3DPolygon(id: String, lonlatArr: DoubleArray, height: Float, width: Float, count: Int, color: FloatArray) { + mMapView.getMapEngine().draw3DPolygon(id, lonlatArr, height, width, count, color) + } + + override fun setGeodesic(id: String, bGeodesic: Boolean) { + mMapView.getMapEngine().setGeodesic(id,bGeodesic) + } + + override fun setDottedLineType(id: String, type: Int) { + mMapView.getMapEngine().setDottedLineType(id, type) + } + + override fun setVisiable(id: String, bVisiable: Boolean) { + mMapView.getMapEngine().setVisiable(id, bVisiable) + } + + override fun setWidth(id: String, width: Float) { + mMapView.getMapEngine().setWidth(id, width) + } + + override fun setTransparency(id: String, transparency: Float) { + mMapView.getMapEngine().setTransparency(id, transparency) + } + + override fun setColor(id: String, color: Int) { + mMapView.getMapEngine().setColor(id, color) + } + + override fun setZIndex(id: String, zIndex: Float) { + mMapView.getMapEngine().setZIndex(id, zIndex) + } + + override fun useGradient(id: String, bUseGradient: Boolean) { + mMapView.getMapEngine().useGradient(id, bUseGradient) + } + + override fun setOption(id: String, strJsonOption: String) { + mMapView.getMapEngine().setOption(id, strJsonOption) + } + + override fun clearAllPrimitives(): Boolean { + return mMapView.getMapEngine().clearAllPrimitives() + } + + override fun drawDeadZone(strJsonOption: String){ + mMapView.getMapEngine().drawDeadZone(strJsonOption) + } + + override fun setDeadZoneVisible(b: Boolean){ + mMapView.getMapEngine().setDeadZoneVisiable(b) + } + + override fun updateAnchorByJson(anchorId: String, json: String, infobitmap: ByteArray?, infoWidth: Int, infoHeight: Int): Boolean { + return mMapView.getMapEngine().updateAnchorByJson(anchorId, json, infobitmap, infoWidth, infoHeight) + } + + override fun setSomeAnchorZIndex(anchorId: String, zIndex: Int) { + mMapView.getMapEngine().setSomeAnchorZIndex(anchorId, zIndex) + } + + override fun drawAnchor(nameId: String, lon: Double, lat: Double, imagePath: String) { + mMapView.getMapEngine().drawAnchor(nameId, lon, lat, imagePath) + } + + override fun removeAnchor(anchorId: String) { + mRecyClerController.addRecycle(anchorId) + mMapView.getMapEngine().removeAnchor(anchorId) + } + + override fun getRecycleId():String{ + return mRecyClerController.getRecycle() + } + + override fun findAnchorAtScreen(x: Int, y: Int): String { + return mMapView.getMapEngine().findAnchorAtScreen(x, y) + } + + override fun startAnimation(anchorId: String) { + mMapView.getMapEngine().startAnimation(anchorId) + } + + override fun endAnimation(anchorId: String) { + mMapView.getMapEngine().endAnimation(anchorId) + } + + override fun addDynamicAnchorPostion(anchorId: String, points: DoubleArray, angle: Float, current: Long, duration: Int) { + mMapView.getMapEngine().addDynamicAnchorPostion(anchorId, points, angle, current, duration) + } + + override fun addTranslateAnimationToAnchor(anchorId: String, points: DoubleArray, duration: Int) { + mMapView.getMapEngine().addTranslateAnimationToAnchor(anchorId, points, duration) + } + + override fun addScaleAnimationToAnchor(anchorId: String, min: Float, max: Float, duration: Int) { + mMapView.getMapEngine().addScaleAnimationToAnchor(anchorId, min, max, duration) + } + + override fun addFlashAnimationToAnchor(anchorId: String, imageJson: String, duration: Int) { + mMapView.getMapEngine().addFlashAnimationToAnchor(anchorId, imageJson, duration) + } + + override fun addRotateAnimationToAnchor(anchorId: String, startAngle: Float, endAngle: Float, duration: Int) { + mMapView.getMapEngine().addRotateAnimationToAnchor(anchorId, startAngle, endAngle, duration) + } + + override fun setSomeAnchorCanClickable(anchorId: String, canClickable: Boolean) { + mMapView.getMapEngine().setSomeAnchorCanClickable(anchorId, canClickable) + } + + override fun setSomeAnchorUnTop(anchorId: String) { + mMapView.getMapEngine().setSomeAnchorUnTop(anchorId) + } + + override fun setSomeAnchorTop(anchorId: String) { + mMapView.getMapEngine().setSomeAnchorTop(anchorId) + } + + override fun setSomeAnchorInfowindowOffset(anchorId: String, disx: Int, disy: Int) { + mMapView.getMapEngine().setSomeAnchorInfowindowOffset(anchorId, disx, disy) + } + + override fun setSomeAnchorFlat(anchorId: String, isFlat: Boolean) { + mMapView.getMapEngine().setSomeAnchorFlat(anchorId, isFlat) + } + + override fun setSomeAnchorDrawModel(anchorId: String, dragModel: Boolean) { + mMapView.getMapEngine().setSomeAnchorDrawModel(anchorId, dragModel) + } + + override fun setSomeDrawModelPointScreenPosition(screenx: Int, screeny: Int): Boolean { + return mMapView.getMapEngine().setSomeDrawModelPointScreenPosition(screenx, screeny) + } + + override fun addManyAnchors(json: String, count: Int) { + mMapView.getMapEngine().addManyAnchors(json, count) + } + + override fun addManyAnchorByJson(json: String, count: Int) { + mMapView.getMapEngine().addManyAnchorByJson(json, count) + } + + override fun removeClusterByClusterid(clusterId: String) { + mMapView.getMapEngine().removeClusterByClusterid(clusterId) + } + + override fun removeManyAnchor(allAnchorJson: String, count: Int) { + mMapView.getMapEngine().removeManyAnchor(allAnchorJson, count) + } + + override fun clearAllCluster() { + mMapView.getMapEngine().clearAllCluster() + } + + override fun createConstAnchor(attribute: String, infoBitmap: ByteArray?, infoWidth: Int, infoHeight: Int): Boolean { + return mMapView.getMapEngine().createConstAnchor(attribute, infoBitmap, infoWidth, infoHeight) + } + + override fun addAnchorAsync(json: String) { + mMapView.getMapEngine().addAnchorAsync(json) + } + + override fun executeAnchorAdd() { + mMapView.getMapEngine().executeAnchorAdd() + } + + override fun setConstAnchorPositionFlag(isUpdate: Boolean) { + mMapView.getMapEngine().setConstAnchorPositionFlag(isUpdate) + } + + override fun addAnchor(json: String, infoBitmap: ByteArray?, infoWidth: Int, infoHeight: Int): Boolean { + return mMapView.getMapEngine().addAnchor(json, infoBitmap, infoWidth, infoHeight) + } + + override fun getAnchorProperty(id: String, propertyName: String): String { + return mMapView.getMapEngine().getAnchorProperty(id, propertyName) + } + + override fun updateAnchorProperty(id: String, propertyName: String, propertyValue: String): Boolean { + return mMapView.getMapEngine().updateAnchorProperty(id, propertyName, propertyValue) + } + + override fun updateInfoWindowWithBitMap(id: String, imageData: ByteArray, width: Int, height: Int): Boolean { + return mMapView.getMapEngine().updateInfoWindowWithBitMap(id, imageData, width, height) + } + + override fun updateAnchorWithBitmap(id: String, imageKey: String): Boolean { + return mMapView.getMapEngine().updateAnchorWithBitmap(id, imageKey) + } + + override fun clearAllAnchors(): Boolean { + return mMapView.getMapEngine().clearAllAnchors() + } + + override fun showInfoWindow(id: String) { + mMapView.getMapEngine().showInfoWindow(id) + } + + override fun hideInfoWindow(id: String) { + mMapView.getMapEngine().hideInfoWindow(id) + } + + override fun setAnchorRate(rate: Float) { + mMapView.getMapEngine().setAnchorRate(rate) + } + + override fun setAnchorScale(wideLeft: Float, wideRight: Float, highUp: Float, hightDown: Float) { + mMapView.getMapEngine().setAnchorScale(wideLeft, wideRight, highUp, hightDown) + } + + override fun setNameMode(mode: Int, recordCnt: Int) { + mMapView.getMapEngine().setNameMode(mode, recordCnt) + } + + override fun setSelfLocaionControl(mode: Int) { + mMapView.getMapEngine().setSelfLocaionControl(mode) + } + + override fun setLockSelfCar(enable: Boolean) { + mMapView.getMapEngine().setLockSelfCar(enable) + } + + override fun isAnchorDynamicMoving(anchorID: String): Boolean { + return mMapView.getMapEngine().isAnchorDynamicMoving(anchorID) + } + + override fun updateBatchAnchorPositon(dataStr: String): Boolean { + return mMapView.getMapEngine().updateBatchAnchorPositon(dataStr) + } + + override fun setAnchorFlash(id: String, colorType: Int, color: String, time: Float, angle: Float) { + mMapView.getMapEngine().setAnchorFlash(id, colorType, color, time, angle) + } + + override fun setAnchorGradientColor(startColor: String, endColor: String, startDistance: Float, endDistance: Float) { + mMapView.getMapEngine().setAnchorGradientColor(startColor, endColor, startDistance, endDistance) + } + + override fun setTailLightsType(type: Int, time: Int) { + mMapView.getMapEngine().setTailLightsType(type, time) + } + + override fun drawNavArrow() { + mMapView.getMapEngine().drawNavArrow() + } + + override fun getRulerInfo(): Float { + return mMapView.getMapEngine().getRulerInfo() + } + + override fun setShowAllRouteLine(isShowAllRouteLine: Boolean) { +// if (isShowAllRouteLine) { +// if (!instance.naviAutoView!!.isFirst) { +// instance.naviAutoView?.mNaviViewListener?.onLockMap(false) +// instance.naviAutoView?.mNaviViewListener?.onNaviViewShowMode(NaviViewShowMode.SHOW_MODE_DISPLAY_OVERVIEW) +// } else { +// instance.naviAutoView!!.isFirst = false +// } +// setFollowCarMode(false) +// setMapViewPerspective(MAP_PERSPECTIVE_2D) +// mMapView.getMapEngine().showAllRouteLine() +// setMapViewRotation(0f) +// } else { +// if (!instance.naviAutoView!!.isFirst) { +// instance.naviAutoView?.mNaviViewListener?.onLockMap(true) +// instance.naviAutoView?.mNaviViewListener?.onNaviViewShowMode(NaviViewShowMode.SHOW_MODE_LOCK_CAR) +// } else { +// instance.naviAutoView!!.isFirst = false +// } +// setFollowCarMode(true) +// setNaviModeZoom() +// setMapNorth(false) +// } + } + + fun showRouteLine(pOneX: Float, pOneY: Float, pTwoX: Float, pTwoY: Float) { + mMapView.getMapEngine().showRouteLine(pOneX, pOneY, pTwoX, pTwoY) + } + + fun drawMapMatchedPosition() { + mMapView.getMapEngine().drawMapMatchedPosition() + } + + override fun clearRoute() { + mMapView.getMapEngine().clearRouteObjs() + } + + /** + * 初始化车辆 + * + * @param lon 经度 + * @param lat 纬度 + * @param z + * @param r + */ + fun initCar(lon: Long, lat: Long, z: Int, r: Int, carResId: Int) { + if (null == mCar) { + mCar = M3DCar(context, carResId) + mMapView.getMapEngine().drawCar(lon, lat, z.toShort(), r.toShort(), 65536, 1f, mCar!!.totBuffer, mCar!!.totSize); + } + } + + override fun updateCar(lon: Long, lat: Long, z: Int, r: Int, carResId: Int) { + if (null == mCar) { + initCar(lon, lat, z, r, carResId) + } + mMapView.getMapEngine().updateCar(lon, lat, z.toShort(), r.toShort()) + } + + override fun updateCar(lon: Long, lat: Long, z: Int, r: Int, bitmap: Bitmap) { +// Marker marker = drawMarker(bitmap); + } + + override fun updateCar(lon: Long, lat: Long, z: Short, angle: Short) { + mMapView.getMapEngine().updateCar(lon, lat, z, angle) + } + + fun routeSearching(showcnt: Int) { + mMapView.getMapEngine().routeSearching(showcnt) + } + + + //旋转角度变化的时候 + @Synchronized override fun dispatchRotationAngleChanged(rotateAngle: Float) { +// val listeners = mMapView.getM_RotateListenerList() +// if (listeners != null && listeners.size > 0) { +// for (lis in listeners) { +// lis.onMapStatusChangeListener(LISTENER_TYPE_ROTATE, rotateAngle.toInt()) +// } +// } + mEventController?.dispatchMapStatusListener(LISTENER_TYPE_ROTATE, rotateAngle.toInt()) + mEventController?.dispatchCameraChangeListener(LISTENER_TYPE_ROTATE, rotateAngle.toInt()) + } + + //焦点变化时的事件 + @Synchronized override fun dispatchFocusChanged() { +// val listeners = mMapView.getM_FocusListenerList() +// if (listeners != null && listeners.size > 0) { +// for (lis in listeners) { +// lis.onMapStatusChangeListener(LISTENER_TYPE_FOCUS, 0) +// } +// } + mEventController?.dispatchMapStatusListener(LISTENER_TYPE_FOCUS, 0) + mEventController?.dispatchCameraChangeListener(LISTENER_TYPE_FOCUS, 0) + } + + + @Synchronized override fun dispatchZoomChanged() { + setMarkerScale() + val currentZoom = getZoom() + if (DEBUG) { + Log.d(TAG, "styleop--dispatchZoomChanged: currentZoom:${currentZoom},lastZoom:${lastZoom} ${mMapView.isTouching()}") + } + if (currentZoom == lastZoom) { + return + }else{ + lastZoom = currentZoom + //TODO 暂时去掉无用的逻辑 +// mMapView.ClearAllTmcLines() + } + mEventController?.dispatchMapStatusListener(LISTENER_TYPE_ZOOM, currentZoom) + mEventController?.dispatchCameraChangeListener(LISTENER_TYPE_ZOOM, currentZoom) + if (DEBUG) { + Log.d(TAG, "styleop--dispatchZoomChanged: currentZoom:${currentZoom}, isSetMapStyle: ${isSetMapStyle}") + } + if(getMapStyle() >= 5 && currentZoom >= 19){ + isSetMapStyle = false + }else if(getMapStyle() < 5 && currentZoom < 19){ + isSetMapStyle = false + } + if(!isSetMapStyle){ + if (currentZoom < 19 && mMapStyleParams.getStyleMode() >= MapAutoApi.MAP_STYLE_NIGHT_VR) { + setMapStyle(MapAutoApi.MAP_STYLE_NIGHT,false) + } else if (currentZoom >= 19 && mMapStyleParams.getStyleMode() < MapAutoApi.MAP_STYLE_NIGHT_VR) { + setMapStyle(MapAutoApi.MAP_STYLE_NIGHT_VR,false) + } + } + + } + + private fun setMarkerScale(){ + var currentZoomVal = mMapView.getMapEngine().getZoomValue() + if (DEBUG) { + Log.d(TAG, "dispatchZoomChanged--currentZoomVal: ${currentZoomVal}") + } + var scale = 0.1f + if (currentZoomVal >= 0.125 && currentZoomVal < 0.25) { + scale = currentZoomVal * (-28f) + 11f + } else if (currentZoomVal >= 0.25 && currentZoomVal < 0.5) { + scale = currentZoomVal * (-7.2f) + 5.8f + } else if (currentZoomVal >= 0.5 && currentZoomVal < 1) { + scale = currentZoomVal * (-2f) + 3.2f + } else if (currentZoomVal >= 1 && currentZoomVal < 2) { + scale = currentZoomVal * (-0.6f) + 1.8f + } else if (currentZoomVal >= 2 && currentZoomVal < 3) { + scale = currentZoomVal * (-0.2f) + 1f + }else if(currentZoomVal >= 3 && currentZoomVal < 24){ + scale = currentZoomVal * (-0.014f) + 0.404f + } + mMapView.getMapEngine().setAnchorRate(scale) + if (DEBUG) { + Log.d(TAG, "dispatchZoomChanged--scale: ${scale}") + } + } + + //车辆摆动变化事件 + @Synchronized override fun dispatchDAngleChanged() { + val angle = getDAngle().toInt() + if (DEBUG) { + Log.d(TAG, "styleop-DAngle: ${angle}") + } +// val listeners = mMapView.getM_DAngleListenerList() +// if (listeners != null && listeners.size > 0) { +// for (lis in listeners) { +// lis.onMapStatusChangeListener(LISTENER_TYPE_3D, angle) +// } +// } + mEventController?.dispatchMapStatusListener(LISTENER_TYPE_3D, angle) + mEventController?.dispatchCameraChangeListener(LISTENER_TYPE_3D, angle) + } + + //来回摆动 + override fun getDAngle(): Float { + //dispatchDAngleChanged(); + return mMapView.getMapEngine().getDAngle() + } + + override fun setDAngle(r: Float) { + mMapView.getMapEngine().setDAngle(r) + } + + override fun getMapViewPerspective(): Float { + return mMapPerspective.toFloat() + } + + /** + * 设置地图渲染 + * + * @param mapPerspective + */ + override fun setMapViewPerspective(mapPerspective: Int) { + mMapPerspective = mapPerspective + when (mapPerspective) { + MAP_PERSPECTIVE_2D -> //mMapView.setDAngle(90); + interpolation(ConstantExt.MAP_STYLE_2D_EYE_HEIGHT, ConstantExt.MAP_STYLE_2D_OVER_LOOK_ANGLE, ConstantExt.MAP_STYLE_2D_ZOOM.toFloat(), -1, -1) + MAP_PERSPECTIVE_3D -> { + //mMapView.setDAngle(45); + setMapViewVisualAngle(mMapStyleParams.getDefaultPerspective()) + mMapView.getMapEngine().lookUpDown(-1f) + lookUpDown() + } + MAP_PERSPECTIVE_UP_NORTH -> { + setMapNorth(true) + mMapView.getMapEngine().setSelfLocaionControl(MAP_PERSPECTIVE_UP_NORTH) + } + MAP_PERSPECTIVE_UP_CAR -> { + setMapNorth(false) + mMapView.getMapEngine().setSelfLocaionControl(MAP_PERSPECTIVE_UP_CAR) + } + } + + } + + //获取地图旋转 + override fun getMapViewRotation(): Float { + return mMapView.getMapEngine().getRotateAngle() + } + + //转动旋转 + override fun setMapViewRotation(rotation: Float) { + isMapNorth = rotation == 0f + mMapView.getMapEngine().setRotateAngle(rotation) + } + + var mMapStyleMode = 0 + + //设置地图风格 + @Synchronized override fun setMapStyle(stylemode: Int) { + setMapStyle(stylemode,true) + isSetMapStyle = true + } + + /** + * @param stylemode 模式 + * @param isZoom true 需要缩放到指定缩放值 false 不需要缩放到指定缩放值 + * + */ + private fun setMapStyle(stylemode:Int,isZoom:Boolean){ + if (CompileConfig.DEBUG) { + Log.i(TAG, "styleop-setMapStyle-start:${stylemode},${isZoom}}") + } + if(mMapStyleMode == stylemode){ + return + } + + + if (stylemode >=5 && mMapStyleMode < 5) { + if(isZoom){ + mMapStyleParams.setZoom(20) + } + mMapView.getMapEngine().setOffset(0, 0) +// + if(mMapStyleParams.getDefaultPerspective() == ConstantExt.MAP_STYLE_VR_ANGLE_MIDDLE) { + interpolation(ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_MIDDLE, ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_MIDDLE, ConstantExt.MAP_STYLE_VR_ZOOM_VAL_MIDDLE, ConstantExt.MAP_STYLE_VR_ANGLE_MIDDLE, -1) + }else{ + interpolation(ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_ERHAI, ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_ERHAI, ConstantExt.MAP_STYLE_VR_ZOOM_VAL_ERHAI, ConstantExt.MAP_STYLE_VR_ERHAI_B2, -1) + } + + } else if(mMapStyleMode >= 5 && stylemode < 5){ + if(isZoom){ + mMapStyleParams.setZoom(16) + } +// mMapView.getMapEngine().setOffset((MapTools.viewWidth * (mMapStyleParams.getOffsetX() - 0.5f)).toInt(), ((MapTools.viewWidth * (MapHelper.mMapParams.getOffsetY() - 0.5f)).toInt())) + + interpolation(ConstantExt.MAP_STYLE_2D_EYE_HEIGHT, ConstantExt.MAP_STYLE_2D_OVER_LOOK_ANGLE, ConstantExt.MAP_STYLE_2D_ZOOM.toFloat(), -1, -1) + } + mMapView.getMapEngine().setMapStyle(stylemode) + mMapStyleMode = stylemode + mMapStyleParams.setStyleMode(mMapStyleMode) +// mMapView.getMapEngine().shakeSceneManual() +// instance.naviAutoView?.let{naviAutoView-> +// naviAutoView.getLazyZoomButtonView()?.let { +// it.processNightMode(stylemode == MapAutoApi.MAP_STYLE_NIGHT_NAV || stylemode == MapAutoApi.MAP_STYLE_NIGHT) +// } +// naviAutoView.getLazyTrafficButtonView()?.let { +// it.processNightMode(stylemode == MapAutoApi.MAP_STYLE_NIGHT_NAV || stylemode == MapAutoApi.MAP_STYLE_NIGHT) +// } +// if (stylemode == MapAutoApi.MAP_STYLE_DAY_NAV || stylemode == MapAutoApi.MAP_STYLE_NIGHT_NAV) { +// naviAutoView.mNaviViewListener?.onMapTypeChanged(stylemode) +// } +// } + + mILocationView?.switch(stylemode) + if (CompileConfig.DEBUG) { + Log.i(TAG, "styleop-setMapStyle-end:${stylemode}") + } + mEventController?.dispatchMapStyleListener(stylemode) + } + + @Synchronized override fun getMapStyle(): Int { + return mMapStyleMode + } + + override fun getZoom(): Int { + return mMapView.getMapEngine().getZoomIndex() + } + + //设置增长速度 + override fun setZoom(zoom: Int) { + var zoom = zoom + if (zoom > 22) { + zoom = 22 + } + if (getZoom() == zoom) { + return + } + mMapView.getMapEngine().setZoomIndex(zoom) + } + + /** + * 判断车辆方向是否朝北 + * + * @return + */ + override fun isMapNorth(): Boolean { + return isMapNorth + } + + override fun setMapNorth(mapNorth: Boolean) { + isMapNorth = mapNorth + } + + //设置跟随车辆的模式 + override fun setFollowCarMode(followCarMode: Boolean) { + isFollowCarMode = followCarMode + mZoomAdj?.setFollowCarMode(followCarMode) + } + + override fun getFollowCarMode(): Boolean { + return isFollowCarMode + } + + //画搜寻到的poi + fun drawSearchPoi() { + mMapView.getMapEngine().drawSearchResult() + } + + var lastAnimZoom = 0f + var lastOverLookAngle = 0f + var lastEyeHeight = 0f + override fun animateTo( + lon: Double, + lat: Double, + alt: Float, + rotateAngle: Float, + mDuration: Int + ) { + var arrays = mapAnimate.stepAnimation() + if (CompileConfig.DEBUG) { + Log.d( + TAG, + "animaop--n:${lon},t:${lat},a:${rotateAngle},z: ${arrays[0]}, la: ${arrays[1]}, eh: ${arrays[2]}" + ) + } + mMapStyleParams.setVrPerspectiveMode(arrays[0]) + mMapStyleParams.setVrEyeHeight(arrays[1]) + if (lastAnimZoom == arrays[0] && lastOverLookAngle == arrays[1] && lastEyeHeight == arrays[2]) { + mMapView.getMapEngine() + .animateTo(lon, lat, alt, -1f, rotateAngle, -1f, -1f, mDuration, -1f) + } else { + lastAnimZoom = arrays[0] + lastOverLookAngle = arrays[1] + lastEyeHeight = arrays[2] + mMapView.getMapEngine().animateTo( + lon, + lat, + alt, + arrays[0], + rotateAngle, + arrays[1], + arrays[2], + mDuration, + -1f + ) + } + + } + + //设置navi的层级 + override fun setNaviModeZoom() { + mMapView.getMapEngine().setZoomIndex(18) + } + + override fun removePel(name: String) { + mMapView.getMapEngine().removePrimitiveByNameId(name) + //mMapView.shakeSceneManual() + } + + /** + * 绘制线 + * + * @param polylineOptions + * @return + */ + override fun drawLine(polylineOptions: PolylineOptions): Polyline? { + val data = polylineOptions.lonLats + var polyline: Polyline? = null + try { + if (data == null || data.size <= 1) { + throw RuntimeException("传入的坐标数必须大于1") + } + val strOptionsJson = JSON.toJSONString(polylineOptions) + if (DEBUG) { + Log.i(TAG, "drawop--drawLine:$strOptionsJson") + } + mMapView.getMapEngine().drawLine(strOptionsJson) + //mMapView.shakeSceneManual() + polyline = Polyline(polylineOptions, this) + } catch (e: Exception) { + e.printStackTrace() + } + return polyline + } + + + /** + * 绘制线 + * + * @param polylineOptions + * @return + */ + override fun drawThickLine(polylineOptions: PolylineOptions): Polyline? { + val data = polylineOptions.lonLats + val colorValues = polylineOptions.getmColorValues() + val colorSize = colorValues?.size ?: 0 + var polyline: Polyline? = null + try { + if (data == null || data.size <= 1) { + throw RuntimeException("传入的坐标数必须大于1") + } + if (polylineOptions.getIsGradient() && colorSize > data.size) { + val colors = colorValues?.subList(0, data.size) + polylineOptions.colorValues(colors) + } + + if (polylineOptions.getIsColorful() && colorSize > data.size - 1) { + val colors = colorValues?.subList(0, data.size - 1) + polylineOptions.colorValues(colors) + } + + val strOptionsJson = JSON.toJSONString(polylineOptions) + if (DEBUG) { + LogHelper.info(TAG, "drawop--drawThickLine:$strOptionsJson") + } + mMapView.getMapEngine().drawThickLine(strOptionsJson) + //mMapView.shakeSceneManual() + polyline = Polyline(polylineOptions, this) + } catch (e: Exception) { + e.printStackTrace() + } + return polyline + } + + /** + * 绘制盲区 + * + * @param deadZoneOptions + * @return DeadZone + */ + override fun drawDeadZone(deadZoneOptions: DeadZoneOptions): DeadZone? { + val data = deadZoneOptions.getPosition() + var deadZone: DeadZone? = null + try { + if (data == null || data.size <= 1) { + throw RuntimeException("传入的坐标数必须大于1") + } + val strOptionsJson = JSON.toJSONString(deadZoneOptions) + if (DEBUG) { + Log.i(TAG, "deadZoneOptions: ${strOptionsJson}") + } + + drawDeadZone(strOptionsJson) + deadZone = DeadZone(deadZoneOptions, this) + } catch (e: Exception) { + e.printStackTrace() + } + return deadZone + } + + /** + * 绘制圆 + * + * @param circleOptions + * @return + */ + override fun drawCircle(circleOptions: CircleOptions?): CircleController { + val data = circleOptions!!.lonLatPoints + val paintColor = circleOptions.color + val id = circleOptions.id + val radius = circleOptions.radius + val paintWidth = circleOptions.lineWidth + var circleController: CircleController? = null + try { + + //绘制圆传的数据不能少于2个 + if (data == null || data.size <= 1) { + throw RuntimeException("传入的坐标数必须大于1") + } + val doubles = MapTools.listToArray(data) + val alpha = (paintColor shr 24 and 0xff).toChar() + val red = (paintColor shr 16 and 0xff).toChar() + val green = (paintColor shr 8 and 0xff).toChar() + val blue = (paintColor and 0xff).toChar() + mMapView.getMapEngine().drawCircle(id, doubles, red, green, blue, alpha) + //mMapView.shakeSceneManual() + circleController = CircleController(id) + } catch (e: Exception) { + e.printStackTrace() + } + return circleController!! + } + + /** + * 绘制椭圆 + * + * @param polylineOptions + * @return + */ + override fun drawEllipse(polylineOptions: PolylineOptions): Polyline? { + val data = polylineOptions.lonLatPoints + val paintColor = polylineOptions.color + val id = polylineOptions.id + val paintWidth = polylineOptions.lineWidth + var polyline: Polyline? = null + try { + + //绘制椭圆不能少于3个点 + if (data == null || data.size <= 2) { + throw RuntimeException("传入的坐标数必须大于3") + } + val doubles = MapTools.listToArray(data) + val alpha = (paintColor shr 24 and 0xff).toChar() + val red = (paintColor shr 16 and 0xff).toChar() + val green = (paintColor shr 8 and 0xff).toChar() + val blue = (paintColor and 0xff).toChar() + //native实现 + if (id != null) { + mMapView.getMapEngine().drawEllipse(id, doubles, red, green, blue, alpha) + } + //mMapView.shakeSceneManual() + polyline = Polyline(polylineOptions, this) + } catch (e: Exception) { + e.printStackTrace() + } + return polyline + } + + /** + * 绘制矩形 + * + * @param polylineOptions + * @return + */ + override fun drawRect(polylineOptions: PolylineOptions): Polyline? { + val data = polylineOptions.lonLatPoints + val paintColor = polylineOptions.color + val id = polylineOptions.id + val paintWidth = polylineOptions.lineWidth + var polyline: Polyline? = null + try { + + //绘制矩形不能少于4个点 + if (data == null || data.size <= 3) { + throw RuntimeException("传入的坐标数必须大于3") + } + val doubles = MapTools.listToArray(data) + val alpha = (paintColor shr 24 and 0xff).toChar() + val red = (paintColor shr 16 and 0xff).toChar() + val green = (paintColor shr 8 and 0xff).toChar() + val blue = (paintColor and 0xff).toChar() + //native实现 + if (id != null) { + mMapView.getMapEngine().drawPolygon(id, doubles, red, green, blue, alpha) + } + //mMapView.shakeSceneManual() + polyline = Polyline(polylineOptions, this) + } catch (e: Exception) { + e.printStackTrace() + } + return polyline + } + + /** + * 绘制多边形 + * + * @param polylineOptions + * @return + */ + override fun drawPolygon(polylineOptions: PolylineOptions): Polyline? { + val data = polylineOptions.lonLatPoints + data?.add(data[0]) + polylineOptions.lonLatPoints(data) + val paintColor = polylineOptions.color + val id = polylineOptions.id + val paintWidth = polylineOptions.lineWidth + var polyline: Polyline? = null + try { + if (data == null || data.size <= 1) { + throw RuntimeException("传入的坐标数必须大于1") + } + val alpha = (paintColor shr 24 and 0xff).toChar() + val red = (paintColor shr 16 and 0xff).toChar() + val green = (paintColor shr 8 and 0xff).toChar() + val blue = (paintColor and 0xff).toChar() + val doubles = MapTools.listToArray(data) + val strOptionsJson = JSON.toJSONString(polylineOptions) + if (DEBUG) { + Log.i(TAG, "drawop--drawLine:$strOptionsJson") + } + mMapView.getMapEngine().drawThickLine(strOptionsJson) + //mMapView.shakeSceneManual() + polyline = Polyline(polylineOptions, this) + } catch (e: Exception) { + e.printStackTrace() + } + return polyline + } + + override fun clearPel(): Boolean { + val clear = mMapView.getMapEngine().clearAllPrimitives() + //mMapView.shakeSceneManual() + return clear + } + + + override fun setRenderFrequency(enableSync: Boolean, renderTimePer: Int) { + mMapView.setSyncRenderFrequency(enableSync, renderTimePer) + } + + private val mHandler: Handler = object : Handler() { + override fun handleMessage(msg: Message) { + when (msg.what) { + LOCK_CAR -> { + mLockLocation.setLockCar(true) + this.sendEmptyMessageDelayed(NO_LOCK_CAR, 300) + this.sendEmptyMessageDelayed(LOCK_CAR, 30000) + } + + NO_LOCK_CAR -> { + mLockLocation.setLockCar(false) +// mMapView.setUpdateCount(250) + } + + CHANGE_VIEW_ANGLE -> { + setMapViewVisualAngle(mMapStyleParams.getDefaultPerspective()) + } + } + } + } + var list = CopyOnWriteArrayList() + var remainList = CopyOnWriteArrayList() + var lastlonlat = LonLatPoint() + var postion = 0 + override fun setMapViewVisualAngle(type: Int) { + mHandler.removeMessages(LOCK_CAR) + mHandler.removeMessages(CHANGE_VIEW_ANGLE) + mHandler.removeMessages(NO_LOCK_CAR) + //还原漫游模式状态开始 + if (isRoam.get()) { + if (DEBUG) { + Log.i(TAG, "Roam--op--status: 结束漫游 切换视角:${type}") + } + mEventController?.dispatchRoamStatusListener(3, "切换视角结束漫游:$type") + } + isRoam.set(false) + postion = 0 + list.clear() + remainList.clear() + roadLineJob?.cancel() + roadLeaveLineJob?.cancel() + roadLineTimeJob?.cancel() + roamJob?.cancel() + transJob?.cancel() + //还原漫游模式状态结束 + if (mLockLocation.getLockCar() == false && type != ConstantExt.MAP_STYLE_VR_ROAM) { + mLockLocation.setLockCar(true) + } + if (type != ConstantExt.MAP_STYLE_VR_SKY_BOX) { + CommonHelper.getInstance()?.setCfgKeyVal(ConstantExt.FOG, "disable") + CommonHelper.getInstance()?.setCfgKeyVal(ConstantExt.SKYBOX, "disable") + } +// mMapView.setIsFarViewAngel(false) + when (type) { + ConstantExt.MAP_STYLE_VR_ANGLE_MIDDLE -> { + interpolation( + ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_MIDDLE, + ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_MIDDLE, + ConstantExt.MAP_STYLE_VR_ZOOM_VAL_MIDDLE, + ConstantExt.MAP_STYLE_VR_ANGLE_MIDDLE, + -1 + ) + } + + ConstantExt.MAP_STYLE_VR_ANGLE_MIDDLE_XIAOBA -> { + interpolation( + ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_MIDDLE_XIAOBA, + ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_MIDDLE_XIAOBA, + ConstantExt.MAP_STYLE_VR_ZOOM_VAL_MIDDLE_XIAOBA, + ConstantExt.MAP_STYLE_VR_ANGLE_MIDDLE_XIAOBA, + -1 + ); + } + + ConstantExt.MAP_STYLE_VR_ERHAI_B2 -> { + interpolation( + ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_ERHAI, + ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_ERHAI, + ConstantExt.MAP_STYLE_VR_ZOOM_VAL_ERHAI, + ConstantExt.MAP_STYLE_VR_ERHAI_B2, + -1 + ) + } + + ConstantExt.MAP_STYLE_VR_SKY_BOX -> { + CommonHelper.getInstance()?.setCfgKeyVal(ConstantExt.FOG, "enable") + CommonHelper.getInstance()?.setCfgKeyVal(ConstantExt.SKYBOX, "enable") + } + + ConstantExt.MAP_STYLE_VR_ANGLE_FAR -> { +// mMapView.setScreenToOriginDis(ConstantExt.MAP_STYLE_VR_POSITION_FAR) +// mMapView.setDAngle(ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_FAR) + interpolation( + ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_FAR, + ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_FAR, + ConstantExt.MAP_STYLE_VR_ZOOM_VAL_FAR, + ConstantExt.MAP_STYLE_VR_ANGLE_FAR, + 3000 + ) +// instance.mapAutoView?.getMapAutoViewHelper()?.animateTo(ConstantExt.MAP_STYLE_VR_ZOOM_VAL_FAR, ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_FAR, ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_FAR, 500) + mMapStyleParams.setVrAngleMode(ConstantExt.MAP_STYLE_VR_ANGLE_FAR) + mHandler.sendEmptyMessageDelayed(NO_LOCK_CAR, 3000) +// mMapView.getMapEngine().setDAngle(mMapView.getMapEngine().getDAngle()+0.1f); +// mHandler.sendEmptyMessageDelayed(MAP_STYLE_FAR, 1100) +// mMapView.setIsFarViewAngel(true) +// mMapView.setUpdateCount(200) + mHandler.sendEmptyMessageDelayed(LOCK_CAR, 30000) + + } + + ConstantExt.MAP_STYLE_VR_ANGLE_NEAR -> { + if (lonLat != null && lonLat!!.lon != 0.0 && lonLat!!.lat != 0.0) { + mLockLocation.setLockCar(false) + mHandler.sendEmptyMessageDelayed(CHANGE_VIEW_ANGLE, 5000) + mapAnimate.setStartFrame( + ConstantExt.MAP_STYLE_VR_ZOOM_VAL_NEAR, + ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_NEAR, + ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_NEAR + ) + animateTo(lonLat!!.lon, lonLat!!.lat, 0f, -1f, 500) + lonLat = null + } else { + interpolation( + ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_NEAR, + ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_NEAR, + ConstantExt.MAP_STYLE_VR_ZOOM_VAL_NEAR, + ConstantExt.MAP_STYLE_VR_ANGLE_NEAR, + -1 + ) + } + + mMapStyleParams.setVrAngleMode(ConstantExt.MAP_STYLE_VR_ANGLE_NEAR) + mMapView.getMapEngine() + .setVerticalViewFieldAngle(ConstantExt.MAP_STYLE_VR_VIEW_FIELD_ANGLE_NEAR) + + } + + ConstantExt.MAP_STYLE_VR_ANGLE_300 -> { + interpolation( + ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_300, + ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_300, + ConstantExt.MAP_STYLE_VR_ZOOM_VAL_300, + ConstantExt.MAP_STYLE_VR_ANGLE_300, + -1 + ) + + } + + ConstantExt.MAP_STYLE_VR_ANGLE_TOP -> { + interpolation( + ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_TOP, + ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_TOP, + ConstantExt.MAP_STYLE_VR_ZOOM_VAL_TOP, + ConstantExt.MAP_STYLE_VR_ANGLE_TOP, + -1 + ) + + } + + ConstantExt.MAP_STYLE_VR_ANGLE_CROSS -> { + interpolation( + ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_CROSS, + ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_CROSS, + ConstantExt.MAP_STYLE_VR_ZOOM_VAL_CROSS, + ConstantExt.MAP_STYLE_VR_ANGLE_CROSS, + -1 + ) + + } + + ConstantExt.MAP_STYLE_VR_ROAM -> { + setRoamStyle() + } + + ConstantExt.MAP_STYLE_VR_TRANS -> { + transJob = getDemaningScope()?.launch(Dispatchers.IO) { + destLonLatPoint = mLockLocation.getCurrentLonLatPoint() + destLonLatPoint?.let { + interpolation( + ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_TRANS, + ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_TRANS, + ConstantExt.MAP_STYLE_VR_ZOOM_VAL_TRANS, + ConstantExt.MAP_STYLE_VR_TRANS, + -1 + ) + delay(1000) + destAngle = it.angle.toFloat() + angle = it.angle.toFloat() + 360f + if (mLockLocation.getLockCar()) { + mLockLocation.setLockCar(false) + } + while (destAngle < angle) { + destLonLatPoint = mLockLocation.getCurrentLonLatPoint() + destLonLatPoint?.let { + destAngle += 60 + animateTo(it.longitude, it.latitude, 0f, -destAngle, 1500) + delay(1500) + } + } + withContext(Dispatchers.Main) { + setMapViewVisualAngle(mMapStyleParams.getDefaultPerspective()) + } + } + + } + + } + } + mEventController?.dispatchMapViewVisualAngleChangeListener(type) + + } + + fun setRoamStyle() { + roadLineTimeJob?.cancel() + roadLineTimeJob = getScope()?.launch(Dispatchers.Default) + { + delay(3000) + Log.d(TAG, "Roam--op--status:获取数据超时") + roadLineJob?.cancel() + mEventController?.dispatchRoamStatusListener( + 1, + "进入漫游模式失败:获取数据超时" + ) + } + roadLineJob?.cancel() + roadLineJob = getScope()?.launch(Dispatchers.IO) { + var currentLonLat = mLockLocation.getCurrentLonLatPoint() + lastlonlat = currentLonLat + if (mTravel.isNotEmpty() && isUseTrace == 1) { + list = CopyOnWriteArrayList( + MathUtils.getSmoothPoints( + MathUtils.getSubList( + currentLonLat, + MathUtils.getPoints(MathUtils.getTravelList(mTravel), mSpeed * 0.1f), + mRoamDis + ) + ) + ) + } + if (list.size < 2) { + var dis = mRoamDis + var leaveDis = 0f + if (mRoamDis > DEFAULT_ROAM_DIS) { + dis = DEFAULT_ROAM_DIS + leaveDis = mRoamDis - dis + } + RoadHelper.getInstance()?.getCenterLineRoadNode( + currentLonLat.longitude, + currentLonLat.latitude, + currentLonLat.angle.toFloat(), + dis, + object : IResult { + override fun result(code: Int, rodeCenterLine: CenterLine?) { + + if (rodeCenterLine != null && rodeCenterLine!!.points != null && rodeCenterLine.points!!.size >= 2) { + roadLineTimeJob?.cancel() + list = CopyOnWriteArrayList( + MathUtils.getSmoothPoints( + MathUtils.getPoints( + ArrayList(rodeCenterLine.points), mSpeed * 0.1f + ) + ) + ) + + if (list.size >= 2) { + startRoam() + if (leaveDis > 0f) { + getLeaveData(leaveDis) + } + } else { + if (DEBUG) { + Log.i( + TAG, + "Roam--op--status: 进入漫游模式失败:获取数据无效:${list.size}" + ) + } + mEventController?.dispatchRoamStatusListener( + 1, + "进入漫游模式失败:获取数据无效:${list.size}" + ) + } + } else { + roadLineTimeJob?.cancel() + if (DEBUG) { + Log.i( + TAG, + "Roam--op--status: 进入漫游模式失败:获取数据无效:${list.size}" + ) + } + mEventController?.dispatchRoamStatusListener( + 1, + "进入漫游模式失败:获取数据无效:${list.size}" + ) + } + + } + + } + ) + } else { + roadLineTimeJob?.cancel() + startRoam() + } + } + } + + + private fun getLeaveData(leaveDis: Float) { + + if (DEBUG) { + Log.i(TAG, "Roam--op--status: 获取剩余数据,leaveDis:${leaveDis}米") + } + var size = list.size + if (size < 2) { + return + } + try { + var startLonLatPoint = list[size - 2] + var endLonLatPoint = list[size - 1] + var angle = GisGeomTool.GetLineAngle( + startLonLatPoint.longitude, + startLonLatPoint.latitude, + endLonLatPoint.longitude, + endLonLatPoint.latitude + ) + RoadHelper.getInstance()?.getCenterLineRoadNode( + endLonLatPoint.longitude, + endLonLatPoint.latitude, + angle.toFloat(), + leaveDis, + object : IResult { + override fun result(code: Int, rodeCenterLineLeave: CenterLine?) { + if (rodeCenterLineLeave != null && rodeCenterLineLeave!!.points != null && rodeCenterLineLeave.points!!.size >= 2) { + remainList = CopyOnWriteArrayList( + MathUtils.getSmoothPoints( + MathUtils.getPoints( + ArrayList(rodeCenterLineLeave.points), mSpeed * 0.1f + ) + ) + ) + if (remainList.size >= 2) { + var disRoam = + MathUtils.distance(remainList.first(), remainList.last()) + if (disRoam < 300) { + Log.e( + TAG, + "Roam--op--status: 获取剩余数据失败,剩余数据距离: ${disRoam}米" + ) + remainList.clear() + } else { + if (DEBUG) { + Log.i( + TAG, + "Roam--op--status: 获取剩余数据成功:${remainList.size}" + ) + } else { + } + } + } else { + Log.e(TAG, "Roam--op--status: 获取剩余数据无效:${remainList.size}") + } + } else { + Log.e(TAG, "Roam--op--status: 获取剩余数据无效") + } + } + + } + ) + + } catch (e: Exception) { + e.printStackTrace() + + } + } + + + private fun startRoam() { + + + try { + var disRoam = MathUtils.distance(list.first(), list.last()) + + + if (disRoam < 300) { + + Log.e( + TAG, + "Roam--op--status: 进入漫游模式失败:获取数据距离太短: ${disRoam}米" + ) + mEventController?.dispatchRoamStatusListener( + 1, + "进入漫游模式失败:获取数据距离太短: ${disRoam}米" + ) + + } + roamJob?.cancel() + + roamJob = getDemaningScope()?.launch(Dispatchers.IO) { + isRoam.set(true) + interpolation( + ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_ROAM, + ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_ROAM, + ConstantExt.MAP_STYLE_VR_ZOOM_VAL_ROAM, + ConstantExt.MAP_STYLE_VR_ROAM, + 100 + ) + delay(100) + mMapView.removeTouch() + if (mLockLocation.getLockCar()) { + mLockLocation.setLockCar(false) + } + if (DEBUG) { + Log.i(TAG, "Roam--op--status: 进入漫游模式成功:${list.size}") + } + withContext(Dispatchers.Main) { + mEventController?.dispatchRoamStatusListener( + 0, + "进入漫游模式成功:${list.size}" + ) + } + withContext(Dispatchers.IO) { + while (isRoam.get()) { + dealRoamMode() + } + } + + + } + }catch (e: NoSuchElementException) { + Log.e( + TAG, + "Roam--op--status: 进入漫游模式失败" + ) + mEventController?.dispatchRoamStatusListener( + 1, + "进入漫游模式失败" + ) + } + } + suspend fun dealRoamMode(){ + if (postion < list.size) { + var location = list[postion] + var angle = GisGeomTool.GetLineAngle( + lastlonlat.longitude, + lastlonlat.latitude, + location.longitude, + location.latitude + ) + + if(postion == 0){ + angle = lastlonlat.angle + } + if (Math.abs(lastlonlat.angle - angle) < 3.5) { + angle = lastlonlat.angle + } + + location.angle = angle + animateTo(location.longitude, location.latitude, 0f, -location.angle.toFloat(), 100) + lastlonlat = location + postion += 1 + delay(100) + }else{ + postion = 0 + list.clear() + if(remainList.size >= 2){ + list.addAll(remainList) + if (DEBUG) { + Log.i(TAG, "Roam--op--status: 剩余轨迹:${list.size}") + } + remainList.clear() + }else { + isRoam.set(false) + withContext(Dispatchers.Main) { + if (DEBUG) { + Log.i(TAG, "Roam--op--status: 漫游轨迹已完成,结束漫游") + } + mEventController?.dispatchRoamStatusListener(2, "漫游轨迹已完成,结束漫游") + setMapViewVisualAngle(mMapStyleParams.getDefaultPerspective()) + } + } + } + } + + override fun setNearViewAnglePosition(lonLat: LonLat){ + this.lonLat = lonLat + setMapViewVisualAngle(ConstantExt.MAP_STYLE_VR_ANGLE_NEAR) + } + + override fun setRoamStyle(isUseTrace: Int, dis: Float, speed: Float) { + if(isRoam.get()){ + return + } + mRoamDis = dis + mSpeed = speed + this.isUseTrace = isUseTrace + setMapViewVisualAngle(ConstantExt.MAP_STYLE_VR_ROAM) + } + + + override fun setRoamTrajectory(travel: String){ + this.mTravel = travel + } + + + + override fun getIsRoam(): Boolean{ + return isRoam.get() + } + + override fun testMapViewAngle(type: Int) { + + when(type) { + ConstantExt.CAR_TWO_FIFTHS_80 -> { + setTestAngle(2f, ConstantExt.MAP_80_EYE_HEIGHT,ConstantExt.MAP_TEST_ANGLE) + mMapView.getMapEngine().setDAngle(ConstantExt.MAP_TEST_ANGLE + 1) + mMapView.getMapEngine().setDAngle(ConstantExt.MAP_TEST_ANGLE) + + } + ConstantExt.CAR_CENTER_100 -> { + setTestAngle(1f, ConstantExt.MAP_100_EYE_HEIGHT,ConstantExt.MAP_TEST_ANGLE) + mMapView.getMapEngine().setDAngle(ConstantExt.MAP_TEST_ANGLE + 1) + mMapView.getMapEngine().setDAngle(ConstantExt.MAP_TEST_ANGLE) + } + ConstantExt.CAR_QUARTER_100 -> { + setTestAngle(4f, ConstantExt.MAP_100_EYE_HEIGHT,ConstantExt.MAP_TEST_ANGLE) + mMapView.getMapEngine().setDAngle(ConstantExt.MAP_TEST_ANGLE + 1) + mMapView.getMapEngine().setDAngle(ConstantExt.MAP_TEST_ANGLE) + } + ConstantExt.CAR_TWO_FIFTHS_100 -> { + setTestAngle(2f, ConstantExt.MAP_100_EYE_HEIGHT,ConstantExt.MAP_TEST_ANGLE) + mMapView.getMapEngine().setDAngle(ConstantExt.MAP_TEST_ANGLE + 1) + mMapView.getMapEngine().setDAngle(ConstantExt.MAP_TEST_ANGLE) + } + ConstantExt.CAR_AFTER_30_FRONT_80 -> { + setTestAngle(ConstantExt.CAR_AFTER_30_FRONT_80_POSITION, ConstantExt.CAR_AFTER_30_FRONT_80_EYEHEIGHT,ConstantExt.CAR_AFTER_30_FRONT_80_ANGLE) + } + ConstantExt.CAR_AFTER_30_FRONT_100 -> { + setTestAngle(ConstantExt.CAR_AFTER_30_FRONT_100_POSITION, ConstantExt.CAR_AFTER_30_FRONT_100_EYEHEIGHT,ConstantExt.CAR_AFTER_30_FRONT_100_ANGLE) + } + + ConstantExt.CAR_AFTER_30_FRONT_120 -> { + setTestAngle(ConstantExt.CAR_AFTER_30_FRONT_120_POSITION, ConstantExt.CAR_AFTER_30_FRONT_120_EYEHEIGHT,ConstantExt.CAR_AFTER_30_FRONT_120_ANGLE) + } + + ConstantExt.CAR_AFTER_40_FRONT_80 -> { + setTestAngle(ConstantExt.CAR_AFTER_40_FRONT_80_POSITION, ConstantExt.CAR_AFTER_40_FRONT_80_EYEHEIGHT,ConstantExt.CAR_AFTER_40_FRONT_80_ANGLE) + } + + ConstantExt.CAR_AFTER_40_FRONT_100 -> { + setTestAngle(ConstantExt.CAR_AFTER_40_FRONT_100_POSITION, ConstantExt.CAR_AFTER_40_FRONT_100_EYEHEIGHT,ConstantExt.CAR_AFTER_40_FRONT_100_ANGLE) + } + + ConstantExt.CAR_AFTER_40_FRONT_120 -> { + setTestAngle(ConstantExt.CAR_AFTER_40_FRONT_120_POSITION, ConstantExt.CAR_AFTER_40_FRONT_120_EYEHEIGHT,ConstantExt.CAR_AFTER_40_FRONT_120_ANGLE) + } + + + + } + + + } + + fun setTestAngle(postion: Float, eyeHeight: Float, angle: Float){ + mMapStyleParams.setVrPerspectiveMode(angle) + mMapStyleParams.setVrEyeHeight(eyeHeight) + mMapView.getMapEngine().setScreenToOriginDis(postion) + mMapView.getMapEngine().setDAngle(angle) + mMapView.getMapEngine().setEyeHeight(eyeHeight) + + } + + private var mIsExecute: AtomicBoolean = AtomicBoolean(true) + private var cacheList = CopyOnWriteArrayList() + override fun cacheHDDataByCity(id: Int, listener: OnHdDataDownByCityListener){ + if(id == 0) { + return + } + // 检查特定城市是否已经有一个缓存操作正在进行 + if(cacheList.contains(id)){ + return + } + mEventController?.addHdDataDownListener(id,listener) + + cancelCacheHDData() + cacheList.add(id) + RoadHelper.getInstance()?.cacheHDDataByCity(id,object : IResult { + override fun result(code: Int, result: Boolean?) { + mIsExecute.set(result?:false) + if (DEBUG) { + Log.i(TAG, "cacheHDDataByCity--op--isDown--: ${id}, ${mIsExecute.get()},${Thread.currentThread()}") + } + if(!mIsExecute.get()){ + mEventController?.dispatchHdDataDownStateListener(id, 0) + mEventController?.removeHdDataDownListener(id) + } + + // 任务完成后从 cacheJobs map 中移除该任务 + cacheList.remove(id) + } + + }) + cacheHdDataProgressJob?.cancel() + cacheHdDataProgressJob = getDemaningScope()?.launch(Dispatchers.IO) { + var progress = 0.0 + while (progress < 1.0) { + RoadHelper.getInstance()?.getCacheProgressByCity(id,object : IResult { + override fun result(code: Int, result: Double?) { + progress = result?:0.0 + if (DEBUG) { + Log.i(TAG, "cacheHDDataByCity--op--id: ${id}, progress:${progress}") + } + mEventController?.dispatchHdDataDownListener(id, progress) + if (DEBUG) { + Log.i(TAG, "cacheHDDataByCity--op--listener:${listener},id: ${id}, progress:${progress}") + } + if (progress == 1.0) { + mEventController?.dispatchHdDataDownStateListener(id, 1) + mEventController?.removeHdDataDownListener(id) + } + } + + }) + + + delay(1000) + } + } + + } + + + override fun cacheHDDataByCityLonLat(lon: Double, lat: Double, listener: OnHdDataDownByCityListener){ + if (TransformUtils.outOfChina(lat, lon)) { + return + } + RoadHelper.getInstance()?.getCityCode(lon, lat, object : IResult { + override fun result(code: Int, id: Int?) { + if (id == 0) { + return + } + if (DEBUG) { + Log.i(TAG, "cacheHDDataByCityLonLat--op--id: ${id}") + } + id?.let { + cacheHDDataByCity(id, listener) + } + } + + }) + + } + + override fun cancelCacheHDData(){ + cacheHdDataProgressJob?.cancel() + cacheList.clear() + RoadHelper.getInstance()?.cancelCacheHDData() + } + + + override fun interpolation(eyeHeight: Float, angle: Float, zoomVal: Float, mode: Int, duration: Int) { + if(System.currentTimeMillis() - mLockLocation.getLastUpdateTime() > 500 + || mLockLocation.getLastUpdateTime() - mLockLocation.getAgainLastUpdateTime() >= 900){ + mapAnimate.setStartFrame(zoomVal, angle, eyeHeight) + var center = mLockLocation.getCurrentLonLatPoint() + var lon: Double = center.longitude + var lat: Double = center.latitude + animateTo(lon, lat, 0f,-1f, 1000) + }else { + + mapAnimate.executeAnim(zoomVal, eyeHeight, angle, duration) + } + + mMapStyleParams.setVrAngleMode(mode) + } + override fun setStartFrame(zoomVal: Float, lookAngle: Float, eyeHeight: Float) { + mapAnimate.setStartFrame(zoomVal, lookAngle, eyeHeight) + } + + override fun setScreenToOriginDis(screenToOriginDis: Float) { + mMapView.getMapEngine().setScreenToOriginDis(screenToOriginDis) + } + + override fun setEyeToOriginDis(eyeToOriginDis: Float) { + mMapView.getMapEngine().setEyeToOriginDis(eyeToOriginDis) + } + + override fun setOffset(lon: Int, lat: Int) { + mMapView.getMapEngine().setOffset(lon,lat) + } + + override fun setRotateAngle(angle: Float) { + mMapView.getMapEngine().setRotateAngle(angle) + } + + override fun set3DBuildingVisible(isVisibel: Boolean) { + mMapView.getMapEngine().set3DBuildingVisible(isVisibel) + } + + override fun getResulation(): Float { + return mMapView.getMapEngine().getResulation() + } + + override fun getSuitableZoom(minLon: Double, minLat: Double, maxLon: Double, maxLat: Double): Int { + return mMapView.getMapEngine().getSuitableZoom(minLon, minLat,maxLon,maxLat) + } + + override fun drawTraffic(trafficJson: String) { + mMapView.getMapEngine().drawTraffic(trafficJson) + } + + override fun addImage(imageKey: String, imageData: ByteArray, width: Int, height: Int): Int { + return mMapView.getMapEngine().addImage(imageKey, imageData, width, height) + } + + override fun clearAllTmcLines() { + mMapView.getMapEngine().clearAllTmcLines() + } + + override fun isTrafficOn(): Boolean { + return mMapView.getMapEngine().isTrafficOn() + } + + override fun setTraffic(stat: Int) { + mMapView.getMapEngine().setTraffic(stat) + } + + override fun setZoomValue(zoomValue: Float) { + mMapView.getMapEngine().setZoomValue(zoomValue) + } + + override fun getEyeHeight(): Float { + return mMapView.getMapEngine().getEyeHeight() + } + + override fun setEyeHeight(eyeHeight: Float) { + mMapView.getMapEngine().setEyeHeight(eyeHeight) + } + + override fun setVerticalViewFieldAngle(angle: Float) { + mMapView.getMapEngine().setVerticalViewFieldAngle(angle) + } + + override fun getVerticalViewFieldAngle(): Float { + return mMapView.getMapEngine().getVerticalViewFieldAngle() + } + + override fun getRotateAngle(): Float { + return mMapView.getMapEngine().getRotateAngle() + } + + override fun updatePointCloudData(dataStr: String, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean): Boolean { + return mMapView.getMapEngine().updatePointCloudData(dataStr, isTrasformer, isResidual, isReset) + } + + override fun updatePointCloudDataByPb(dataArray: ByteArray, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean): Boolean { + return mMapView.getMapEngine().updatePointCloudDataByPb(dataArray, isTrasformer, isResidual, isReset) + } + + override fun setIsDrawPointCloud(isDrawPointCloud: Boolean) { + mMapView.getMapEngine().setIsDrawPointCloud(isDrawPointCloud) + } + + override fun setPointCloudDisplayFllowAnim(isDisplayFllowAnim: Boolean, totalAnimTime: Int) { + mMapView.getMapEngine().setPointCloudDisplayFllowAnim(isDisplayFllowAnim, totalAnimTime) + } + + override fun setPointCloudSize(pointCloudSize: Float) { + mMapView.getMapEngine().setPointCloudSize(pointCloudSize) + } + + override fun setPointCloudColor(color: String) { + mMapView.getMapEngine().setPointCloudColor(color) + } + + override fun shakeSceneManual() { + mMapView.getMapEngine().shakeSceneManual() + } + + override fun shakeMapManual() { + mMapView.getMapEngine().shakeMapManual() + } + + override fun setRouteProp(prop: Int, lon: Int, lat: Int) { + mMapView.getMapEngine().setRouteProp(prop, lon, lat) + } + + override fun resetChangeAngleTime(){ + mHandler.removeMessages(LOCK_CAR) + mHandler.sendEmptyMessageDelayed(LOCK_CAR, 30000) + } + + + companion object { + private const val TAG = "MapController" + const val LISTENER_TYPE_FOCUS = 0x1 + const val LISTENER_TYPE_ROTATE = 0x2 + const val LISTENER_TYPE_ZOOM = 0x4 + const val LISTENER_TYPE_3D = 0x8 + const val LISTENER_TYPE_ALL = 0x1F + const val LISTENER_TYPE_CENTER = 0x2F + const val LISTENER_VALUE_ANI_START = 1 + const val LISTENER_VALUE_ANI_END = 2 + const val MAP_PERSPECTIVE_INVALID = 0 + const val MAP_PERSPECTIVE_2D = 1 + const val MAP_PERSPECTIVE_3D = 2 + const val MAP_PERSPECTIVE_UP_NORTH = 3 + const val MAP_PERSPECTIVE_UP_CAR = 4 + const val LOCK_CAR = 0x12 + const val NO_LOCK_CAR = 0x13 + const val CHANGE_VIEW_ANGLE = 0x14 + } + + init { + pelNames = ArrayList() + mZoomAdj = MapZoomAdjuster(context, this) + mapAnimate = MapAnimate(this) + } + + + override fun exit(){ + mHandler.removeCallbacksAndMessages(null) + roadLineJob?.cancel() + roadLineJob = null + + roadLineTimeJob?.cancel() + roadLineTimeJob = null + + roadLeaveLineJob?.cancel() + roadLeaveLineJob = null + + roamJob?.cancel() + roamJob = null + + transJob?.cancel() + transJob = null + + + cacheHdDataProgressJob?.cancel() + cacheHdDataProgressJob = null + + RoadHelper.getInstance()?.cancelCacheHDData() + isRoam.set(false) + + mRecyClerController.clear() + } + + + override fun isCollision(data: String): String{ + return mMapView.getMapEngine().isCollision(data) + } + + override fun switchData(x: Double, y: Double, isWgs84: Boolean): DoubleArray?{ + return mMapView.getMapEngine().switchData(x,y,isWgs84) + } + + override fun setTouchPoiEnable(enable: Boolean) { + mMapView.setTouchPoiEnable(enable) + } + + override fun getTouchPoiEnable(): Boolean { + return mMapView.getTouchPoiEnable() + } + + override fun isTouching(): Boolean { + return mMapView.isTouching() + } + + override fun setCanZoom(enable: Boolean) { + mMapView.setCanZoom(enable) + } + + override fun isCanZoom(): Boolean { + return mMapView.isCanZoom() + } + + override fun setOnTouchListener(listener: View.OnTouchListener) { + mMapView.setOnTouchListener(listener) + } + + override fun setScroll(enable: Boolean) { + mMapView.setScroll(enable) + } + + override fun setFling(enable: Boolean) { + mMapView.setFling(enable) + } + + override fun setRotate(enable: Boolean) { + mMapView.setRotate(enable) + } + + override fun isScroll(): Boolean { + return mMapView.isScroll() + } + + override fun isFling(): Boolean { + return mMapView.isFling() + } + + override fun isRotate(): Boolean { + return mMapView.isRotate() + } + + override fun toScreen() { + mMapView.toScreen() + } + + override fun tilt(tilt: Float) { + mMapView.tilt(tilt) + } + + override fun getTilt(): Float { + return mMapView.getTilt() + } + + override fun renderP() { + mMapView.renderP() + } + + override fun setRenderFps(fps: Int) { + mMapView.setRenderFps(fps) + } + + override fun getRenderFps(): Int { + return mMapView.getRenderFps() + } + + override fun setVrMode(isVr: Boolean) { + mMapView.setVrMode(isVr) + } + + override fun setWaitTime(time: Long) { + mMapView.setWaitTime(time) + } + + override fun setIsAutoLockCar(isLockCar: Boolean) { + mMapView.setIsAutoLockCar(isLockCar) + } + + override fun getScope(): CoroutineScope? { + return mMapView.getScope() + } + + override fun getDemaningScope(): CoroutineScope? { + return mMapView.getDemaningScope() + } + + override fun setWeatherType(type: String) { + CommonHelper.getInstance()?.setCfgKeyVal(ConstantExt.WEATHER, type) + } + + override fun getWeatherInfo(lon: Double, lat: Double, call: WeatherResult) { + WeatherModel.getWeatherInfo(lon, lat, call) + } + + override fun setSkyBoxMode() { + setMapViewVisualAngle(ConstantExt.MAP_STYLE_VR_SKY_BOX) + } + + override fun getLastKnownMogoLocation(): LonLatPoint { + return mLockLocation.getCurrentLonLatPoint() + } + + override fun setFogMode(isEnable: Boolean) + { + if(isEnable){ + CommonHelper.getInstance()?.setCfgKeyVal(ConstantExt.FOG, "enable") + }else{ + CommonHelper.getInstance()?.setCfgKeyVal(ConstantExt.FOG, "disable") + } + + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapDataHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapDataHelper.kt new file mode 100644 index 0000000000..0b47317ead --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapDataHelper.kt @@ -0,0 +1,59 @@ +package com.zhidaoauto.map.sdk.inner.map + +import android.content.Context +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.common.ConstantExt +import com.zhidaoauto.map.sdk.inner.controller.CommonController +import com.zhidaoauto.map.sdk.inner.utils.FileUtils +import com.zhidaoauto.map.sdk.inner.utils.SharedPrefsMgr +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.launch +import java.io.File + +object MapDataHelper { + + + private val TAG = javaClass.simpleName + + //更新数据时版本+1 + val currentDataVersion = 5 + + private var deleteJob:Job? = null + + fun updateData(context: Context, dir: String) { + val oldVersion = SharedPrefsMgr.getInstance(context).getInt(ConstantExt.SHARED_KEY_DATA_VERSION, 0) + if (oldVersion < currentDataVersion) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"dataop--delete old verion ${oldVersion} for update version ${currentDataVersion}") + } + SharedPrefsMgr.getInstance(context).putInt(ConstantExt.SHARED_KEY_DATA_VERSION, currentDataVersion) + deleteDataDir(dir) + } + } + + private fun deleteDataDir(dir: String) { + deleteJob?.cancel() + deleteJob = CommonController.instance.scope?.launch(Dispatchers.IO) { + val fileOld = File(dir) + val fileNew = File("${dir}_temp") + try { + val result = fileOld.renameTo(fileNew) + if(CompileConfig.DEBUG){ + Log.i(TAG,"dataop--rename ${fileOld.absolutePath} delete ${fileNew.absolutePath} ,result:${result}") + } + }catch (e:Exception){ + if(CompileConfig.DEBUG){ + Log.e(TAG,"dataop--exception",e) + } + } + FileUtils.deleteDirectory(fileNew.absolutePath) + } + } + + fun exit(){ + deleteJob?.cancel() + deleteJob = null + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapHdDataHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapHdDataHelper.kt new file mode 100644 index 0000000000..bae1deabbd --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapHdDataHelper.kt @@ -0,0 +1,107 @@ +package com.zhidaoauto.map.sdk.inner.map + +import android.content.Context +import android.content.res.AssetManager +import android.util.Log +import com.autonavi.nge.dm.SharedMemoryService +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.common.ConstantExt +import com.zhidaoauto.map.sdk.inner.controller.CommonController +import com.zhidaoauto.map.sdk.inner.utils.FileUtils +import com.zhidaoauto.map.sdk.inner.utils.SharedPrefsMgr +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.launch +import java.io.File +import java.util.concurrent.atomic.AtomicBoolean + +object MapHdDataHelper { + + private val TAG = javaClass.simpleName + + //更新样式时版本+1 + val currentDataVersion = 61 + + private var initJob:Job? = null + private var copyJob:Job? = null + private var context:Context? = null + + var loadDataOver:AtomicBoolean = AtomicBoolean(false) + + private fun updateData(context: Context, dir: String) { + val oldVersion = SharedPrefsMgr.getInstance(context).getInt(ConstantExt.SHARED_KEY_HDDATA_VERSION, 0) + if (oldVersion < currentDataVersion) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"hdmapop--delete old verion ${oldVersion} for update version ${currentDataVersion}") + } + FileUtils.deleteDirectory(dir) + } + } + + fun copyAssetsToSdcard(context: Context, assetDir: String, dir: String) { + val assetManager = context.resources.assets + copyJob?.cancel() + copyJob = CommonController.instance.scope?.launch(Dispatchers.IO) { + updateData(context, dir) + val file = File(dir) + if (file.isDirectory && file.list() != null && file.list().size > 1) { + if(FileUtils.isSameFiles(assetManager, assetDir, dir)) { + loadDataOver.set(true) + return@launch + }else{ + FileUtils.deleteDirectory(dir) + } + + } + dealAssetsToSdcard(context, assetManager, assetDir, dir) + } + } + + private suspend fun dealAssetsToSdcard(context: Context, assetManager : AssetManager, assetDir: String, dir: String){ + SharedPrefsMgr.getInstance(context).putInt(ConstantExt.SHARED_KEY_HDDATA_VERSION, currentDataVersion) + val start = System.currentTimeMillis() + var result = FileUtils.copyDirect(assetManager, assetDir, dir) + if(CompileConfig.DEBUG){ + Log.i(TAG,"hdmapop-assetop-copy to ${dir} cost:${System.currentTimeMillis()-start}ms") + } + if(!result){ + if(CompileConfig.DEBUG){ + Log.i(TAG,"hdmapop --assetop-copy fail") + } + FileUtils.deleteDirectory(dir) + result = FileUtils.copyDirect(assetManager, assetDir, dir) + loadDataOver.set(true) + if(CompileConfig.DEBUG){ + Log.i(TAG,"hdmapop --assetop-second-copy result:${result}") + } + }else{ + loadDataOver.set(true) + if(CompileConfig.DEBUG){ + Log.i(TAG,"hdmapop --assetop-copy success") + } + } + } + + + fun initDataMgr(context: Context){ + initJob?.cancel() + this.context = context + initJob = CommonController.instance.scope?.launch(Dispatchers.IO) { + SharedMemoryService.getInstance(context) + loadDataOver.set(true) + } + } + + + fun exit(){ + initJob?.cancel() + initJob = null + copyJob?.cancel() + copyJob = null + SharedMemoryService.getInstance(context).exit() + } + + + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapStyleHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapStyleHelper.kt new file mode 100644 index 0000000000..8509e669a6 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapStyleHelper.kt @@ -0,0 +1,90 @@ +package com.zhidaoauto.map.sdk.inner.map + +import android.content.Context +import android.content.res.AssetManager +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.common.ConstantExt +import com.zhidaoauto.map.sdk.inner.controller.CommonController +import com.zhidaoauto.map.sdk.inner.utils.FileUtils +import com.zhidaoauto.map.sdk.inner.utils.SharedPrefsMgr +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.launch +import java.io.File +import java.util.concurrent.atomic.AtomicBoolean + +object MapStyleHelper { + + private val TAG = javaClass.simpleName + + //更新样式时版本+1 + val currentStyleVersion = 65 + + private var copyJob:Job? = null + + var loadStyleOver:AtomicBoolean = AtomicBoolean(false) + + private fun updateStyle(context: Context, dir: String) { + val oldVersion = SharedPrefsMgr.getInstance(context).getInt(ConstantExt.SHARED_KEY_STYLE_VERSION, 0) + if (oldVersion < currentStyleVersion) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"styleop--delete old verion ${oldVersion} for update version ${currentStyleVersion}") + } + FileUtils.deleteDirectory(dir) + } + } + + fun copyAssetsToSdcard(context: Context, assetDir: String, dir: String) { + + val assetManager = context.resources.assets + copyJob?.cancel() + copyJob = CommonController.instance.scope?.launch(Dispatchers.IO) { + updateStyle(context, dir) + val file = File(dir) + if (file.isDirectory && file.list() != null && file.list().size > 1) { + if(FileUtils.isSameFiles(assetManager, assetDir, dir)) { + loadStyleOver.set(true) + return@launch + }else{ + FileUtils.deleteDirectory(dir) + } + } + dealAssetsToSdcard(context, assetManager, assetDir, dir) + } + } + + private fun dealAssetsToSdcard(context: Context, assetManager :AssetManager,assetDir: String, dir: String){ + SharedPrefsMgr.getInstance(context).putInt(ConstantExt.SHARED_KEY_STYLE_VERSION, currentStyleVersion) + val start = System.currentTimeMillis() + var result = FileUtils.copyDirect(assetManager, assetDir, dir) + if(CompileConfig.DEBUG){ + Log.i(TAG,"styleop-assetop-copy to ${dir} cost:${System.currentTimeMillis()-start}ms") + } + if(!result){ + if(CompileConfig.DEBUG){ + Log.i(TAG,"styleop --assetop-copy fail") + } + FileUtils.deleteDirectory(dir) + result = FileUtils.copyDirect(assetManager, assetDir, dir) + loadStyleOver.set(true) + if(CompileConfig.DEBUG){ + Log.i(TAG,"styleop --assetop-second-copy result:${result}") + } + }else{ + loadStyleOver.set(true) + if(CompileConfig.DEBUG){ + Log.i(TAG,"styleop --assetop-copy success") + } + } + } + + fun exit(){ + copyJob?.cancel() + copyJob = null + } + + + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapZoomAdjuster.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapZoomAdjuster.java new file mode 100644 index 0000000000..23137c440a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/map/MapZoomAdjuster.java @@ -0,0 +1,80 @@ +package com.zhidaoauto.map.sdk.inner.map; + +import android.content.Context; +import android.os.Handler; +import android.os.Message; + +import com.zhidaoauto.map.sdk.inner.abs.IMapController; +import com.zhidaoauto.map.sdk.open.abs.MapStatusListener; + + +public class MapZoomAdjuster implements MapStatusListener { + + private static final int NAVMODE = 3; + private static final int NAVZOOMLEVEL = 19; + + private static final int MSG_ZOOM_CHANGED = 1; + + private IMapController mMapCtrl = null; + private int mMapMode = 0; + private boolean mFollowCarMode = false; + + public MapZoomAdjuster(Context context, IMapController controller) { + mMapCtrl = controller; + mMapCtrl.getEventController().addMapStatusListener(this, MapController.LISTENER_TYPE_ZOOM); + } + + void setMapStyle(int stylemode) { + mMapMode = stylemode; + if (mMapMode >= NAVMODE) { + cancelAdjustZoomChange(); + } + } + + void setFollowCarMode(boolean followCarMode) { + mFollowCarMode = followCarMode; + if (true == followCarMode) { + adjustZoomChange(mMapCtrl.getZoom(), 5); + } else { + cancelAdjustZoomChange(); + } + } + + @Override + public void onMapStatusChanged(int type, int value) { + + if (MapController.LISTENER_TYPE_ZOOM == type) { + adjustZoomChange(value, 10); + } + } + + void adjustZoomChange(int value, int delaysecond) { + if (mMapMode >= NAVMODE && true == mFollowCarMode && value != NAVZOOMLEVEL) { + cancelAdjustZoomChange(); + mNaviControllerHandler.sendEmptyMessageDelayed(MSG_ZOOM_CHANGED, 1000*delaysecond); /* delay 10s */ + } + } + + void cancelAdjustZoomChange() { + mNaviControllerHandler.removeMessages(MSG_ZOOM_CHANGED); + } + + + private Handler mNaviControllerHandler = new Handler() { + + @Override + public void handleMessage(Message msg) { + + switch(msg.what) { + case MSG_ZOOM_CHANGED: + if (null != mMapCtrl) { + mMapCtrl.setZoom(NAVZOOMLEVEL); + } + break; + default: + } + } + }; + + +}; \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/IInfoViewClick.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/IInfoViewClick.kt new file mode 100644 index 0000000000..4c4f181f43 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/IInfoViewClick.kt @@ -0,0 +1,5 @@ +package com.zhidaoauto.map.sdk.inner.marker + +interface IInfoViewClick { + fun click() +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/MarkerAdapterManager.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/MarkerAdapterManager.kt new file mode 100644 index 0000000000..64c341f970 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/MarkerAdapterManager.kt @@ -0,0 +1,27 @@ +package com.zhidaoauto.map.sdk.inner.marker + +import com.zhidaoauto.map.sdk.open.abs.marker.InfoWindowAdapter + +class MarkerAdapterManager { + + var mInfoWindowAdapter:InfoWindowAdapter? = null + + private constructor(){ + + } + + companion object { + var mInstance: MarkerAdapterManager? = null + fun getInstance(): MarkerAdapterManager { + if (mInstance == null) { + synchronized(MarkerAdapterManager::class.java) { + if (mInstance == null) { + mInstance = MarkerAdapterManager() + } + } + } + return mInstance!! + } + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/MarkerInfoViewClickController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/MarkerInfoViewClickController.kt new file mode 100644 index 0000000000..56e39b8b36 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/MarkerInfoViewClickController.kt @@ -0,0 +1,42 @@ +package com.zhidaoauto.map.sdk.inner.marker + +import android.graphics.Rect + +class MarkerInfoViewClickController { + private val TAG = javaClass.simpleName + + private constructor() { + + } + + companion object { + val instance by lazy { MarkerInfoViewClickController() } + } + + private val infoViewClickMap = HashMap>() + + fun add(markerId: String, rect: Rect, iInfoViewClick: IInfoViewClick) { + var map: HashMap? + if (infoViewClickMap.containsKey(markerId)) { + map = infoViewClickMap.get(markerId) + } else { + map = HashMap() + } + map?.let { + it.put(rect, iInfoViewClick) + infoViewClickMap.put(markerId, it) + } + } + + fun get(markerId: String): HashMap? { + return infoViewClickMap.get(markerId) + } + + fun remove(markerId: String) { + infoViewClickMap.remove(markerId) + } + + fun clear() { + infoViewClickMap.clear() + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/MarkerNativeInterface.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/MarkerNativeInterface.kt new file mode 100644 index 0000000000..0086af4949 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/MarkerNativeInterface.kt @@ -0,0 +1,761 @@ +package com.zhidaoauto.map.sdk.inner.marker + +import android.graphics.Rect +import android.text.TextUtils +import android.util.Log +import com.alibaba.fastjson.JSON +import com.autonavi.nge.map.LonLat +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.abs.IMarkerCall +import com.zhidaoauto.map.sdk.open.abs.marker.OnMarkerDragListener +import com.zhidaoauto.map.sdk.open.marker.* +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.tools.MD5Utils +import com.zhidaoauto.map.sdk.open.tools.MapTools +import io.netty.buffer.Unpooled +import java.nio.charset.Charset +import java.util.* +import java.util.concurrent.ConcurrentHashMap + +class MarkerNativeInterface(private val mMapController: IMapController): IMarkerCall { + + private val TAG = "MarkerNativeInterface" + + + private val markerIconList = ArrayList() + private val markClickListenerMap: MutableMap = HashMap() + private val infoWindowClickListenerMap: MutableMap = HashMap() + private val animationListenerMap: MutableMap = HashMap() + private val markDragListenerMap: MutableMap = HashMap() + private val markerIconCacheMap = HashMap() + private val markerInfoCacheMap = ConcurrentHashMap() + + //点击infoview区域 + private val infoViewClickMap = HashMap>() + + override fun exit(){ + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--MarkerNativeInterface:exit") + } + markerIconList.clear() + markClickListenerMap.clear() + infoWindowClickListenerMap.clear() + animationListenerMap.clear() + markDragListenerMap.clear() + markerIconCacheMap.clear() + markerInfoCacheMap.clear() + infoViewClickMap.clear() + } + + override fun addInfoViewClick(markerId: String, rect: Rect, iInfoViewClick: IInfoViewClick) { + var map: HashMap? + if (infoViewClickMap.containsKey(markerId)) { + map = infoViewClickMap.get(markerId) + } else { + map = HashMap() + } + map?.let { + it.put(rect, iInfoViewClick) + infoViewClickMap.put(markerId, it) + } + } + + override fun getInfoViewClick(markerId: String): HashMap? { + return infoViewClickMap.get(markerId) + } + + override fun removeInfoViewClick(markerId: String) { + infoViewClickMap.remove(markerId) + } + + @Synchronized + override fun addMarkerIcon(icon:String):Boolean{ + return markerIconList.add(icon) + } + + override fun containMarkerIconCache(id: Int): Boolean { + return markerIconCacheMap.containsKey(id) + } + + override fun removeMarkerIconCache(id: Int) { + markerIconCacheMap.remove(id) + } + + override fun addMarkerIconCache(id: Int, icon: String) { + markerIconCacheMap.put(id,icon) + } + + override fun getMarkerIconCache(id:Int):String?{ + return markerIconCacheMap.get(id) + } + + @Synchronized + override fun removeMarkerIcon(icon:String?):Boolean{ + return markerIconList.remove(icon) + } + + @Synchronized + override fun containMarkerIcon(icon:String?):Boolean{ + return markerIconList.contains(icon) + } + /** + * 清除所有marker + * + * @return + */ + fun clearAllMarkers(): Boolean? { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--clearAllMarkers:") + } +// CommonController.instance.scope?.launch(Dispatchers.Main) { + val isSuccess = mMapController.clearAllAnchors() + refreshMap() +// } + return true + } + + /** + * 设置infowindow的title值 + * + * @param id + * @param title + */ + fun setTitle(id: String?, title: String?) { + + updateMarkerProperty(id!!, "title", title!!) + + } + + /** + * 获取infowindow的标题 + * + * @param id + * @return + */ + fun getTitle(id: String?): String { + return getMarkerProperty(id!!, "title")?:"" + } + + /** + * 设置infowindow的内容 + * + * @param id + * @param snippet + */ + fun setSnippet(id: String?, snippet: String?) { + updateMarkerProperty(id!!, "snippet", snippet!!) + } + + /** + * 获取infowindow属性snippet的值 + * + * @param id + * @return + */ + fun getSnippet(id: String?): String { + return getMarkerProperty(id!!, "snippet")?:"" + } + + fun isAnchorDynamicMoving(id: String): Boolean { + return mMapController.isAnchorDynamicMoving(id)?:false + } + + /** + * 更换marker的图片 + * + * @param id + * @param bitmapDescriptor + */ + fun setIcon(id: String?, bitmapDescriptor: BitmapDescriptor) { + val markerBytes = bitmapDescriptor.getBytes() + if(markerBytes.size == 0){ + return + } + MD5Utils.getInstanse() + val markerIconName = MD5Utils.getMD5String(markerBytes) + //缓存图片 + if (!containMarkerIcon(markerIconName)) { + if(DEBUG){ + Log.i(TAG,"markerop--setIcon--addImagetoImageManager:${markerIconName}") + } + + val result = mMapController.addImage( + markerIconName, + markerBytes, + bitmapDescriptor.width, + bitmapDescriptor.height + ) ?:-1 + if(result ==0 ){ + addMarkerIcon( markerIconName) + } + } +// CommonController.instance.scope?.launch(Dispatchers.Main) { + mMapController.updateAnchorWithBitmap(id!!, markerIconName) + refreshMap() +// } + } + + /** + * 设置marker的水平和垂直范围的比例 + * + * @param id + * @param anchorU + * @param anchorV + */ + fun setAnchor(id: String?, anchorU: Float, anchorV: Float) { + updateMarkerProperty(id!!, "anchorUV", "${anchorU},${anchorV}" ) + refreshMap() + } + + /** + * 设置marker的位置(经纬度) + * + * @param id + * @param latitude + * @param longitude + * @return + */ + fun setPosition(id: String?, latitude: Double, longitude: Double): Boolean { + if (DEBUG) { + Log.i(TAG, "autoop-markerop--setPosition: ${id},$latitude,$longitude") + } + val isSuccess = updateMarkerProperty(id!!, "lonLatPoint", "$longitude,$latitude") + refreshMap() + return isSuccess?:false + } + + /** + * 设置marker的上诉缩放 + * + * @param id + * @param latitude + * @param longitude + * @return + */ + fun setScale(id: String?, scale: Float): Boolean { + if (DEBUG) { + Log.i(TAG, "autoop-markerop--setScale: ${id},$scale") + } + val isSuccess = updateMarkerProperty(id!!, "scale", "$scale") + refreshMap() + return isSuccess?:false + } + + /** + * 获取marker的经纬度 + * + * @param id + * @return + */ + fun getPosition(id: String?): LonLat? { + val lonlstStr = getMarkerProperty(id!!, "lonLatPoint") + val lonlat = lonlstStr?.split(",")?.toTypedArray() + lonlat?.let{ + return LonLat(lonlat[0].toDouble(), lonlat[1].toDouble()) + } + return null + } + + /** + * 移除marker + * + * @param id + * @return + */ + fun removeMarker(id: String?): Boolean { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--removeMarker:${id}") + } + mMapController.removeAnchor(id!!) + refreshMap() + return true + } + + /** + * infowindow是否显示 + * + * @param id + * @return + */ + fun isInfoWindowShown(id: String?): Boolean { + val isInfoWindowShown = getMarkerProperty(id!!, "isInfoWindowShown") + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--isInfoWindowShown:${isInfoWindowShown}") + } + return isInfoWindowShown?.toBoolean()?:false + } + + fun setInfoWindowShown(id: String?,flag:Boolean):Boolean{ + val isSuccess = updateMarkerProperty(id!!, "isInfoWindowShown", "$flag") + refreshMap() + return isSuccess?:false + } + + fun setInfoWindowEnabled(id: String?,flag:Boolean):Boolean{ + val isSuccess = updateMarkerProperty(id!!, "infoWindowEnabled", "$flag") + refreshMap() + return isSuccess?:false + } + + /** + * infowindow是否可以显示 + * + * @param id + * @return + */ + fun isInfoWindowEnabled(id: String?): Boolean { + val infoWindowEnabled = getMarkerProperty(id!!, "infoWindowEnabled") + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--infoWindowEnabled:${infoWindowEnabled}") + } + return infoWindowEnabled?.toBoolean()?:false + } + + fun setVisible(id: String?, visible: Boolean) { + updateMarkerProperty(id!!, "visible",visible.toString()) + refreshMap() + } + + fun isVisible(id: String?): Boolean { + return getMarkerProperty(id!!, "visible")?.toBoolean()?:false + } + + fun setRotateAngle(id: String?, rotateAngle: Float) { + updateMarkerProperty(id!!, "rotateAngle", rotateAngle.toString()) + refreshMap() + } + + fun getRoateAngle(id: String?): Float { + val rotateAngle = getMarkerProperty(id!!, "rotateAngle") + return java.lang.Float.valueOf(rotateAngle) + } + + fun getDraggable(id: String?): Boolean { + val draggable = getMarkerProperty(id!!, "draggable") + return draggable!!.toBoolean() + } + + fun setPeriod(id: String?, period: Int) { + updateMarkerProperty(id!!, "period", period.toString()) + } + + fun getPeriod(id: String?): Int { + val period = getMarkerProperty(id!!, "period") + return period!!.toInt() + } + + fun showInfoWindow(id: String?) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--showInfoWindow:${id}") + } + mMapController.showInfoWindow(id!!) + refreshMap() + } + + fun hideInfoWindow(id: String?) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--hideInfoWindow:${id}") + } + mMapController.hideInfoWindow(id!!) + refreshMap() + } + + fun setInfoWindowIcon(id: String?, markerInfoName: String) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--setInfoWindowIcon:${id}") + } + updateMarkerProperty(id!!, "markerInfoName", markerInfoName) +// CommonController.instance.mapView?.updateInfoWindowWithBitMap(id!!, bitmapDescriptor.getBytes(), bitmapDescriptor.width, bitmapDescriptor.height) + showInfoWindow(id) + refreshMap() + } + + private fun getMarkerProperty(id:String,propertyName:String):String{ + return mMapController.getAnchorProperty(id,propertyName)?:"" + } + + private fun updateMarkerProperty(id:String,propertyName:String,value:String):Boolean{ + val flag = mMapController.updateAnchorProperty(id,propertyName,value) + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--updateMarkerProperty:${id},${propertyName},${value},result:${flag}") + } + return true + } + + fun clear(): Boolean { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--clear clearAllAluster --clearAllMarkers:") + } +// CommonController.instance.scope?.launch(Dispatchers.Main) { + val isSuccess = mMapController.clearAllAnchors() + mMapController.clearAllCluster() + refreshMap() + +// } + return true + } + + + + override fun getAnimationListener(markerID: String): OnAnimationListener? { + if (animationListenerMap == null || animationListenerMap.size == 0) { + return null + } + for (id in animationListenerMap.keys) { + if (TextUtils.equals(id, markerID)) { + return animationListenerMap[markerID] + } + } + return null + } + + override fun addAnimationListener(markerID: String, onAnimationListener: OnAnimationListener?) { + if(onAnimationListener == null){ + animationListenerMap.remove(markerID) + }else{ + animationListenerMap[markerID] = onAnimationListener + } + } + + override fun getInfoWindowClickListener(markerID: String): OnInfoWindowClickListener? { + if (infoWindowClickListenerMap == null || infoWindowClickListenerMap.size == 0) { + return null + } + for (id in infoWindowClickListenerMap.keys) { + if (TextUtils.equals(id, markerID)) { + return infoWindowClickListenerMap[markerID] + } + } + return null + } + + override fun addInfoWindowClickListener(markerID: String, onInfoWindowClickListener: OnInfoWindowClickListener?) { + if(onInfoWindowClickListener == null){ + infoWindowClickListenerMap.remove(markerID) + }else{ + infoWindowClickListenerMap[markerID] = onInfoWindowClickListener + } + } + + override fun addMarkClickListener(markerID: String, onMarkClickListener: OnMarkClickListener?) { + if(onMarkClickListener == null){ + markClickListenerMap.remove(markerID) + }else{ + markClickListenerMap[markerID] = onMarkClickListener + } + } + + override fun addMarkDragListener(markerID: String, onMarkerDragListener: OnMarkerDragListener?) { + if(onMarkerDragListener == null){ + markDragListenerMap.remove(markerID) + }else{ + markDragListenerMap[markerID] = onMarkerDragListener + } + } + + override fun getMarkDragListener(markerID: String): OnMarkerDragListener?{ + if (markDragListenerMap == null || markDragListenerMap.size == 0) { + return null + } + for (id in markDragListenerMap.keys) { + if (TextUtils.equals(id, markerID)) { + return markDragListenerMap[markerID] + } + } + return null + } + override fun getMarkClickListener(markerID: String): OnMarkClickListener? { + if (markClickListenerMap == null || markClickListenerMap.size == 0) { + return null + } + for (id in markClickListenerMap.keys) { + if (TextUtils.equals(id, markerID)) { + return markClickListenerMap[markerID] + } + } + return null + } + + fun setAlpha(id: String?, alpha: Float) { + updateMarkerProperty(id!!, "alpha", java.lang.Float.toString(alpha)) + refreshMap() + } + + fun getAlpha(id: String): Float { + return java.lang.Float.valueOf(getMarkerProperty(id, "alpha")) + } + + fun setClickable(id: String?, clickable: Boolean) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--setClickable:${id}") + } + mMapController.setSomeAnchorCanClickable(id!!, clickable) + refreshMap() + } + + fun addDynamicAnchorPostion(id: String, points: List,angle:Float, isGps:Boolean,current:Long,duration: Int) { + val data = MapTools.listToArray(points,!isGps) + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--addDynamicAnchorPostion:${id},${points},isGps:${isGps},duration:${duration}") + } + mMapController.addDynamicAnchorPostion(id, data,angle,current, duration) + } + + fun addTranslateAnimationToAnchor(id: String, points: DoubleArray, duration: Int) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--addTranslateAnimationToAnchor:${id}") + } +// CommonController.instance.scope?.launch(Dispatchers.Main) { + mMapController.addTranslateAnimationToAnchor(id, points, duration) +// } + } + + fun addScaleAnimationToAnchor(id: String, startScale: Float, endScale: Float, duration: Int) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--addScaleAnimationToAnchor:${id}") + } +// CommonController.instance.scope?.launch(Dispatchers.Main) { + mMapController.addScaleAnimationToAnchor(id, startScale, endScale, duration) +// } + } + + fun addFlashAnimationToAnchorPoint(id: String, images: String, duration: Int){ + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--addFlashAnimationToAnchorPoint:${id}") + } +// CommonController.instance.scope?.launch(Dispatchers.Main) { + mMapController.addFlashAnimationToAnchor(id, images, duration) +// } + } + + fun addRotateAnimationToAnchorPoint(id: String, startAng: Float, endAng: Float, duration: Int){ + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--addRotateAnimationToAnchorPoint:${id}") + } +// CommonController.instance.scope?.launch(Dispatchers.Main) { + mMapController.addRotateAnimationToAnchor(id, startAng, endAng, duration) +// } + } + fun startAnimation(id: String) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--startAnimation:${id}") + } +// CommonController.instance.scope?.launch(Dispatchers.Main) { + mMapController.startAnimation(id) +// } + } + + fun endAnimation(id: String) { +// CommonController.instance.scope?.launch(Dispatchers.Main) { + mMapController.endAnimation(id) +// } + } + + fun setToTop(id: String) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--SetSomeAnchorTop:${id}") + } +// CommonController.instance.scope?.launch(Dispatchers.Main) { + mMapController.setSomeAnchorTop(id) + refreshMap() +// } + } + + fun setZIndex(id: String, zIndex: Int) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--setZIndex:${id},${zIndex}") + } +// CommonController.instance.scope?.launch(Dispatchers.Main) { + mMapController.setSomeAnchorZIndex(id, zIndex) + refreshMap() +// } + } + + //设置marker是否可以拖拽 + fun setDraggable(id: String, draggable: Boolean) { + updateMarkerProperty(id!!, "draggable", draggable.toString()) + } + + //设置marker是否需要指定方向 + fun setControlAngle(id: String, enable: Boolean) { + updateMarkerProperty(id, "controlAngle", java.lang.Boolean.toString(enable)) + refreshMap() + } + + //设置marker 模型顔色 + fun set3DAnchorColor(id: String, color: String) { + updateMarkerProperty(id!!, "anchorColor", color) + } + + fun vrIcon(id: String, flag: Boolean) { + updateMarkerProperty(id, "vrIcon", java.lang.Boolean.toString(flag)) + refreshMap() + } + + //设置marker是否可以平贴 + fun setFlat(id: String, flat: Boolean) { + updateMarkerProperty(id!!, "flat", flat.toString()) + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--setFlat:${id},${flat}") + } + mMapController.setSomeAnchorFlat(id, flat) + } + + + //设置infowindow的偏移量 + fun setInfoWindowOffset(id: String, offsetX: Int, offsetY: Int) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--setInfoWindowOffset:${id},${offsetX},${offsetY}") + } + mMapController.setSomeAnchorInfowindowOffset(id, offsetX, offsetY) + refreshMap() + } + + fun setMarkerOptions(id: String?, markerPtions: MarkerOptions) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"markerop--setMarkerOptions:${id},${markerPtions}") + } + mMapController.updateAnchorByJson(id!!, JSON.toJSONString(markerPtions), ByteArray(0), 0, 0) + refreshMap() + } + + fun setUnTop(id: String) { + mMapController.setSomeAnchorUnTop(id) + refreshMap() + } + + private fun refreshMap() { +// val isRefresh = CommonController.instance.mapAutoView?.getLockCar()?:false +// if(isRefresh){ +// CommonController.instance.mapView?.shakeSceneManual() +// } + } + + + fun addImagetoImageManager(markerIconName: String, markerBytes: ByteArray, width: Int, height: Int ){ + if (!containMarkerIcon(markerIconName)) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--setIcon--addImagetoImageManager:${markerIconName}") + } + val result = mMapController.addImage( + markerIconName, + markerBytes, + width, + height + )?:-1 + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--setIcon--addImagetoImageManager:${markerIconName},result:${result},threadop:${Thread.currentThread().id}") + } + if (result == 0) { + addMarkerIcon(markerIconName) + } + } + + } + /** + * 更新marker资源 + * + * @return + */ + override fun updateMarkerResource(dataStr:String?) { + dataStr?.let { + val array = it.split(",") + if(array.isEmpty()){ + return@let + } + val deleteList:ArrayList = ArrayList() + for(id in markerInfoCacheMap.keys){ + if(!array.contains(id)){ + deleteList.add(id) + } + } + for(id in deleteList){ + markerInfoCacheMap.remove(id) + } + deleteList.clear() + + } + } + + /** + * 设置锚点的动画资源 + */ + fun setMarkerAnimResource(id: String?, resName: String) { + mMapController.updateAnchorProperty(id!!, "animAnchorResource", resName) + } + + /** + * 设置锚点的动画开关 + */ + fun setMarkerDisplayAnimEnable(id: String?, isDisplayAnim: Boolean) { + mMapController.updateAnchorProperty(id!!, "isDisplayAnim", "${isDisplayAnim}") + } + + /** + * 设置锚点的动画停顿帧数 + */ + fun setMarkerAnimWaitFrame(id: String?, animWaitFrame: Int) { + mMapController.updateAnchorProperty(id!!, "animWaitFrame", "${animWaitFrame}") + } + + /** + * 设置锚点的动画类型 + */ + fun setMarkerAnimType(id: String?, animType: Int) { + mMapController.updateAnchorProperty(id!!, "animType", "${animType}") + } + + fun setMarkerAnchorType(id: String?, anchorType: Int) { + mMapController.updateAnchorProperty(id!!, "anchorType", "${anchorType}") + } + + fun setMarkerAnchorShadow(id: String?, anchorShadow: Int) { + mMapController.updateAnchorProperty(id!!, "anchorShadow", "${anchorShadow}") + } + + fun setMarkerColorType(id: String?, colorType: Int) { + mMapController.updateAnchorProperty(id!!, "colorType", "${colorType}") + } + + fun setMarkerChangerColorTime(id: String?, changerColorTime: Float) { + mMapController.updateAnchorProperty(id!!, "changeColorTime", "${changerColorTime}") + } + + fun setMarkerChangeColorAngle(id: String?, changeColorAngle: Float) { + mMapController.updateAnchorProperty(id!!, "changeColorAngle", "${changeColorAngle}") + } + + fun setMarkerFlash(id: String, colorType: Int, color: String, time: Float, angle: Float){ + mMapController.setAnchorFlash(id, colorType, color, time, angle) + } + + val charset = Charset.forName("UTF-8") + + private fun dealMarker(markerPtions: MarkerOptions):ByteArray?{ + val buffer = Unpooled.buffer() + buffer.writeCharSequence(markerPtions.getId(), charset) + buffer.writeDouble(markerPtions.getLonLatPoint()!!.lon) + buffer.writeDouble(markerPtions.getLonLatPoint()!!.lat) + buffer.writeCharSequence(markerPtions.getTitle(), charset) + buffer.writeCharSequence(markerPtions.getSnippet(), charset) + buffer.writeFloat(markerPtions.getAnchorU()) + buffer.writeFloat(markerPtions.getAnchorV()) + buffer.writeBoolean(markerPtions.isVisible()) + buffer.writeFloat(markerPtions.getRotateAngle()) + buffer.writeBoolean(markerPtions.isInfoWindowEnable()) + buffer.writeBoolean(markerPtions.isInfoWindowShown()) + buffer.writeFloat(markerPtions.getAlpha()) + buffer.writeInt(markerPtions.getOffectX()) + buffer.writeInt(markerPtions.getOffectY()) + buffer.writeInt(markerPtions.period) + buffer.writeBoolean(markerPtions.isClickable()) + buffer.writeInt(markerPtions.getZIndex()) + buffer.writeCharSequence(markerPtions.getMarkerIconName(),charset) + return buffer.array() + } + + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/RecycleController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/RecycleController.kt new file mode 100644 index 0000000000..80bb64ef46 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/marker/RecycleController.kt @@ -0,0 +1,70 @@ +package com.zhidaoauto.map.sdk.inner.marker + +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import java.util.concurrent.CopyOnWriteArrayList +import java.util.concurrent.atomic.AtomicLong + + +class RecycleController { + private val TAG = javaClass.simpleName + + public constructor() { + + } + + + + private val renderList: HashSet = HashSet() + private val recycleList: CopyOnWriteArrayList = CopyOnWriteArrayList() + + private val idStart:AtomicLong = AtomicLong(99999999) + + fun addRecycle(markerId: String) { + if(!recycleList.contains(markerId)){ + recycleList.add(markerId) + } + if(CompileConfig.DEBUG){ + Log.i(TAG, "RecycleController--addRecycle: ${markerId},total:${recycleList.size}") + } + } + + fun getRecycle(): String { + var id ="" + if(recycleList.isEmpty()){ +// id = UUID.randomUUID().toString().replace("-","") + id = idStart.addAndGet(1).toString() + }else{ + id = recycleList.removeAt(0) + if(id.isEmpty()){ +// id = UUID.randomUUID().toString().replace("-","") + id = idStart.addAndGet(1).toString() + } + } + if(CompileConfig.DEBUG){ + Log.i(TAG, "RecycleController--getRecycle: ${id},total:${recycleList.size}") + } + return id + } + + fun addRender(markerId: String){ + renderList.add(markerId) + if(CompileConfig.DEBUG){ + Log.i(TAG, "RecycleController--addRender: ${markerId},total:${renderList.size}") + } + } + + + fun removeRender(markerId: String){ + renderList.remove(markerId) + if(CompileConfig.DEBUG){ + Log.i(TAG, "RecycleController--removeRender: ${markerId},total:${renderList.size}") + } + } + + fun clear() { + idStart.set(1) + renderList.clear() + recycleList.clear() + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/nav/NaviController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/nav/NaviController.kt new file mode 100644 index 0000000000..c1594fe865 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/nav/NaviController.kt @@ -0,0 +1,1051 @@ +//package com.zhidaoauto.map.sdk.inner.nav +// +//import android.content.Context +//import android.graphics.Bitmap +//import android.graphics.BitmapFactory +//import android.os.Handler +//import android.os.Message +//import android.os.RemoteException +//import android.text.TextUtils +//import android.util.Log +//import android.widget.Toast +//import com.autonavi.nge.dm.INavigationCore +//import com.autonavi.nge.guidance.GuidanceStatListener +//import com.autonavi.nge.guidance.NaviInfo +//import com.autonavi.nge.routing.RoutingProvider +//import com.zhidaoauto.map.sdk.R +//import com.zhidaoauto.map.sdk.inner.CompileConfig +//import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG +//import com.zhidaoauto.map.sdk.inner.abs.IMapController +//import com.zhidaoauto.map.sdk.inner.abs.IMapView +//import com.zhidaoauto.map.sdk.inner.abs.INaviController +//import com.zhidaoauto.map.sdk.inner.common.ConstantExt +//import com.zhidaoauto.map.sdk.inner.common.MapHelper +//import com.zhidaoauto.map.sdk.inner.common.NavHelper +//import com.zhidaoauto.map.sdk.inner.controller.CommonController +//import com.zhidaoauto.map.sdk.inner.map.MapController +//import com.zhidaoauto.map.sdk.inner.panel.PanelManager +//import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +//import com.zhidaoauto.map.sdk.inner.utils.CommonUtils +//import com.zhidaoauto.map.sdk.inner.utils.Constant +//import com.zhidaoauto.map.sdk.inner.utils.Recorder +//import com.zhidaoauto.map.sdk.open.MapAutoApi +//import com.zhidaoauto.map.sdk.open.dialog.BaseDialog +//import com.zhidaoauto.map.sdk.open.dialog.TipDialog +//import com.zhidaoauto.map.sdk.open.dialog.WaitDialog +//import com.zhidaoauto.map.sdk.open.location.MogoLocation +//import com.zhidaoauto.map.sdk.open.nav.NavInfo +//import com.zhidaoauto.map.sdk.open.nav.NavPoi +//import com.zhidaoauto.map.sdk.open.nav.PathPlanningStrategy +//import com.zhidaoauto.map.sdk.open.nav.abs.NaviListener +//import com.zhidaoauto.map.sdk.open.nav.model.* +//import com.zhidaoauto.map.sdk.open.query.LonLatPoint +//import kotlinx.coroutines.Dispatchers +//import kotlinx.coroutines.Job +//import kotlinx.coroutines.launch +//import java.nio.charset.Charset +// +// +//class NaviController( +// private val mContext: Context, +// private val mNavigationCore: INavigationCore +//) : GuidanceStatListener.Stub(), INaviController { +// +// +// val TAG = javaClass.simpleName +// +// // 算路任务 +// private var naviJob: Job? = null +// +// //是否设置起始位置 +// private var mIsStartSet = false +// +// //是否设置目的地位置 +// private var mIsDestSet = false +// +// //是否设置途径点位置 +// private var mIsTuSet = false +// +// //是否导航中 +// private var m_Status_Navi = false +// +// //是否重新导航中 +// private var mReNavi = false +// +// //导航类型(模拟和实时) +// private var mNaviType = 0 +// +// private var sLon: Double = 0.0 +// private var sLat: Double = 0.0 +// private var eLon: Double = 0.0 +// private var eLat: Double = 0.0 +// +// //起始位置 +// private var mStart: NavPoi? = null +// +// //终点位置 +// private var mEnd: NavPoi? = null +// +// //途径点位置 +// private var mWayPoi: NavPoi? = null +// +// //是否模拟导航暂停中 +// private var isSimNaviPaused = false +// +// //是否模拟导航 +// private var isSimNavi = false +// +// //是否语音播报 +// private var isSpeakStatus = true +// +// //最后一次语音 +// private var currentTts: String = "" +// +// private var m_BGID = 0 +// private var m_ArrowID = 0 +// private var m_BGBitmap: Bitmap? = null +// private var m_ArrowBitmap: Bitmap? = null +// private var bitmap: Bitmap? = null +// private var isShow = false +// +// +// private val mapController: IMapController? +// private get() = CommonController.instance.mapController +// +// private val mapView: IMapView? +// private get() = CommonController.instance.mapView +// +// private val panelManager: PanelManager? +// private get() = CommonController.instance.panelManager +// +// private var naviListener: NaviListener? = null +// +// override fun isSimNavi(): Boolean { +// return isSimNavi +// } +// +// override fun setSimNavi(simNavi: Boolean) { +// isSimNavi = simNavi +// } +// +// override fun isSimNaviPaused(): Boolean { +// return isSimNaviPaused +// } +// +// override fun getNaviType(): Int { +// return if (mNaviType == TYPE_SIMULATOR_NAVI) { +// 2 +// } else if (mNaviType == TYPE_GPS_NAVI || mNaviType == TYPE_NAVI_DETAIL) { +// 1 +// } else { +// 0 +// } +// } +// +// //设置导航语音是否播报 +// override fun setSpeakStatus(status: Boolean) { +// isSpeakStatus = status +// } +// +// /** +// * 设置模拟导航状态 +// */ +// override fun setSimNaviPaused(isPaused: Boolean) { +// isSimNaviPaused = isPaused +// try { +// if (isSimNaviPaused) { +// mNavigationCore.Guidance_PauseSimNavi() +// } else { +// mNavigationCore.Guidance_ResumeSimNavi() +// } +// } catch (e: Exception) { +// e.printStackTrace() +// } +// } +// +// /** +// * 设置模拟导航速度 +// */ +// override fun setSimNaviSpeed(speed: Int) { +// try { +// mNavigationCore.Guidance_SetSimSpeed(speed) +// } catch (e: Exception) { +// e.printStackTrace() +// } +// } +// +// +// /** +// * 复读 +// */ +// override fun readCurrentTts(): Boolean { +// if(CompileConfig.DEBUG){ +// Log.i(TAG,"navop--readCurrentTts:${currentTts}") +// } +// if (!TextUtils.isEmpty(currentTts)) { +// mNavigationCore.play(currentTts,true) +// return true +// } +// return false +// } +// +// //播报输入文案 +// override fun playTTS(tts: String, forcePlay: Boolean): Boolean { +// try { +// mNavigationCore.play(tts,forcePlay) +// } catch (e: Exception) { +// return false +// } +// return true +// } +// +// +// +// private val mNaviControllerHandler: Handler = object : Handler() { +// var lon = 0.0 +// var lat = 0.0 +// override fun handleMessage(msg: Message) { +// when (msg.what) { +// MSG_GET_TTS -> try { +// if (DEBUG) { +// Log.i(TAG, "navop-msg-getTts") +// } +// val datas = msg.obj as ByteArray +// currentTts = String(datas, Charset.forName("utf-8")) +// if (DEBUG) { +// Log.i(TAG, "navop-msg-getTts:${currentTts}") +// } +// if (!TextUtils.isEmpty(currentTts)) { +// mNavigationCore.play(currentTts,true) +// Recorder.i(currentTts) +// naviListener?.onGetNavigationText(currentTts) +// } +// } catch (e: Exception) { +// e.printStackTrace() +// } +// MSG_GET_NAVIINFO -> { +// if (DEBUG) { +// Log.i(TAG, "navop-msg-getnaviinfo") +// } +// var naviinfo: NaviInfo? = null +// try { +// val datas = msg.obj as ByteArray +// naviinfo = mNavigationCore.GetNaviInfo(datas) +// } catch (e1: Exception) { +// e1.printStackTrace() +// } +// if (naviinfo != null) { +// if (naviinfo.m_nNaviStatus.toInt() == 1) { //偏离路线 +// reNavi(naviinfo.m_nBindLon, naviinfo.m_nBindLat) +// return +// } else if (naviinfo.m_nNaviStatus.toInt() == 2) { //到达目的地 +// stopNavi() +// if(isSimNavi) +// naviListener?.onEndEmulatorNavi() +// else +// naviListener?.onArriveDestination() +// return +// } +// panelManager?.setPanel(PanelManager.PANEL_WHAT_RESET, PanelManager.PANEL_MODE_GUIDANCE) +// if (naviinfo.m_nBindLon > 0 && naviinfo.m_nBindLat > 0) { +// val curlon = naviinfo.m_nBindLon / ConstantExt.RULE_ZERO_SIX_INT +// val curlat = naviinfo.m_nBindLat / ConstantExt.RULE_ZERO_SIX_INT +// val curlonInt = (naviinfo.m_nBindLon * ConstantExt.RULE_FLOAT_TO_INT).toLong() +// val curlatInt = (naviinfo.m_nBindLat * ConstantExt.RULE_FLOAT_TO_INT).toLong() +// var zoom = -1.0f +// if (mapController != null && mapController!!.getFollowCarMode()) { +// if (mapController!!.isMapNorth()) { +// mapController?.animateTo(curlon.toDouble(), curlat.toDouble(), 0f, -1f, 350) +// } else { +// mapController?.animateTo(curlon.toDouble(), curlat.toDouble(), 0f, -naviinfo.m_Angle.toFloat(), 350) +// } +// } +// mapController?.drawNavArrow() +// mapController?.updateCar(curlonInt, curlatInt, 0.toShort(), (-naviinfo.m_Angle).toShort()) +// val lonLatPoint = MogoLocation() +// lonLatPoint.lon = curlon.toDouble() +// lonLatPoint.lat = curlat.toDouble() +// naviListener?.onLocationChange(lonLatPoint) +// } +// naviListener?.onNaviInfoUpdate(getNavInfo(naviinfo)) +// if(isShow && (naviinfo.m_nImageType.toInt() == 0 || m_BGID != naviinfo.m_nImageBg || m_ArrowID != naviinfo.m_nImageArrow)){ +// isShow = false +// naviListener?.hideCross() +// CommonController.instance.naviAutoView?.getLazyZoomInIntersectionView()?.let{ +// it.recycleResource() +// } +// } +// if (m_BGID != naviinfo.m_nImageBg +// || m_ArrowID != naviinfo.m_nImageArrow +// ) { +// val routeimage = CommonController.instance.iNavigationCore?.Guidance_Image( +// naviinfo.m_nImageUr, +// naviinfo.m_nImageBg, +// naviinfo.m_nImageArrow, 0 +// ) +// if (m_BGBitmap != null) { +// m_BGBitmap!!.recycle() +// } +// m_BGBitmap = null +// if (m_ArrowBitmap != null) { +// m_ArrowBitmap!!.recycle() +// } +// m_ArrowBitmap = null +// +// // 记录下载历史的展现的图片 +// m_BGBitmap = BitmapFactory.decodeByteArray( +// routeimage?.imageBg, 0, routeimage?.imageBg?.size ?: 0 +// ) +// m_ArrowBitmap = BitmapFactory.decodeByteArray( +// routeimage?.imageArrow, 0, +// routeimage?.imageArrow?.size ?: 0 +// ) +// // 记录历史现实的图片,如果相同,在新的展现路口上 不在重新获取。 +// m_BGID = naviinfo.m_nImageBg +// m_ArrowID = naviinfo.m_nImageArrow +// if (bitmap != null) { +// bitmap!!.recycle() +// } +// bitmap = null +// bitmap = CommonUtils.combineBitmap(m_BGBitmap, m_ArrowBitmap!!) +// isShow = true +// naviListener?.showCross(NaviCross(bitmap!!)) +// CommonController.instance.naviAutoView?.getLazyZoomInIntersectionView()?.let{ +// it.setIntersectionBitMap(NaviCross(bitmap!!)) +// } +// } +// var nextTurnTipView = CommonController.instance.naviAutoView?.getLazyNextTurnTipView() +// if(nextTurnTipView != null){ +// nextTurnTipView.setIconType(naviinfo.m_nTurnID) +// } +// } +// } +// MSG_NET_LOCATION -> try { +// if (DEBUG) { +// Log.i(TAG, "navop-msg-net-location") +// } +// val location = CommonController.instance.lastKnownMogoLocation +// location?.let { +// val lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(LonLatPoint(it.lon, it.lat)) +// val lon = lonLat.lon * ConstantExt.RULE_INT +// val lat = lonLat.lat * ConstantExt.RULE_INT +// //经度纬度都存在 +// if (lon > 0 && lat > 0) { +// sendEmptyMessage(MSG_CANCEL_DLG) +// this.removeMessages(MSG_NET_LOCATION) +// setStart(NavPoi(lon, lat)) +// } else { +// sendEmptyMessage(MSG_NET_LOCATION) +// } +// } +// +// } catch (e1: RemoteException) { +// e1.printStackTrace() +// } +// MSG_LOCATION -> try { +// if (DEBUG) { +// Log.i(TAG, "navop-msg-location") +// } +// val location = CommonController.instance.lastKnownMogoLocation +// if (location == null || location.lon <= 0 || !location.provider.contains("gps")) { +// sendEmptyMessage(MSG_LOCATION) +// } else { +// sendEmptyMessage(MSG_CANCEL_DLG) +// this.removeMessages(MSG_LOCATION) +// val lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(LonLatPoint(location.lon, location.lat)) +// setStart(NavPoi(lonLat.lon, lonLat.lat)) +// } +// } catch (e: RemoteException) { +// e.printStackTrace() +// } +// MSG_SET_START -> { +// if (DEBUG) { +// Log.i(TAG, "navop-msg-set-start") +// } +// val startPoi = msg.obj as NavPoi +// lon = startPoi.lon +// lat = startPoi.lat +// sLon = lon +// sLat = lat +// mapController?.setRouteProp(1, (lon * (1 shl 29) / 45.0f).toInt(), (lat * (1 shl 29) / 45.0f).toInt()) +// try { +// mNavigationCore.Routing_SetOrigin(lon.toFloat(), lat.toFloat(), 0) +// Recorder.i("设置出发地 $lon $lat") +// } catch (e: RemoteException) { +// e.printStackTrace() +// } +// } +// MSG_SET_DEST -> { +// if (DEBUG) { +// Log.i(TAG, "navop-msg-set-dest") +// } +// val endPoi = msg.obj as NavPoi +// lon = endPoi.lon +// lat = endPoi.lat +// eLon = lon +// eLat = lat +// //设置目的地 +// mapController?.setRouteProp(2, (lon * (1 shl 29) / 45.0f).toInt(), (lat * (1 shl 29) / 45.0f).toInt()) +// try { +// mNavigationCore.Routing_SetDest(lon.toFloat(), lat.toFloat(), 0) +// Recorder.i("设置目的地 $lon $lat") +// if (mIsStartSet) { +// sendEmptyMessage(MSG_GET_ROUTE) +// } +// } catch (e: RemoteException) { +// e.printStackTrace() +// } +// } +// MSG_GET_ROUTE -> { +// if (DEBUG) { +// Log.i(TAG, "navop-msg-getRoute:") +// } +// WaitDialog.show(mContext, "计算路线中...") +// Recorder.i("启动路线计算") +// naviJob?.cancel() +// naviJob = CommonController.instance.scope?.launch(Dispatchers.IO) { +// try { +// if (DEBUG) { +// Log.i(TAG, "navop-msg-thread-getRoute:") +// } +// mNavigationCore.Routing_GetRoute(0) +// if (DEBUG) { +// Log.i(TAG, "navop-msg-thread-Routing_GetStatus:") +// } +// val calcRouteResult = CalcRouteResult() +// if (mNavigationCore.Routing_GetStatus(0)) { +// if (DEBUG) { +// Log.i(TAG, "navop-msg-thread-getRoute:success") +// } +// mapController?.drawRoute() +// if (DEBUG) { +// Log.i(TAG, "navop-msg-thread-getRoute:drawRoute") +// } +// sendEmptyMessage(MSG_SHOW_ROUTE_SELECT) +// calcRouteResult.errorCode = 0 +// naviListener?.onCalculateRouteSuccess(calcRouteResult) +// } else { +// calcRouteResult.errorCode = 1 +// naviListener?.onCalculateRouteFailure(calcRouteResult) +// Recorder.i("路线计算失败") +// sendEmptyMessage(MSG_SHOW_DIALOG) +// return@launch +// } +// sendEmptyMessage(MSG_CANCEL_DLG) +// } catch (e: RemoteException) { +// e.printStackTrace() +// } +// } +// } +// MSG_MAPMATCHEDPOSITION -> { +// //TODO matt 崩溃待解决 +// //mapView?.drawMapMatchedPosition() +// } +// MSG_CANCEL_DLG -> { +// BaseDialog.unloadAllDialog() +// resetRouteSetPanel() +// } +// MSG_SHOW_DIALOG -> { +// BaseDialog.unloadAllDialog() +// TipDialog.show(mContext, "路线计算失败") +// } +// MSG_SHOW_ROUTE_SELECT -> { +// if (DEBUG) { +// Log.i(TAG, "navop-msg-route-select") +// } +// if(CommonController.instance.naviAutoView?.getViewOptions()!!.isLayoutVisible()) { +// panelManager?.setPanel(PanelManager.PANEL_WHAT_SHOW, PanelManager.PANEL_MODE_ROUTING_SELECT) +// panelManager?.setPanel(PanelManager.PANEL_WHAT_ONRESUME, PanelManager.PANEL_MODE_ROUTING_SELECT) +// } +// if (DEBUG) { +// Log.i(TAG, "navop-msg-route-select-setShowAllRouteLine") +// } +// mapController?.setShowAllRouteLine(true) +// } +// } +// } +// } +// +// +// /** +// * 设置导航策略 +// */ +// override fun setNaviStrategy(strategy: Int) { +// when (strategy) { +// +// PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_PRIORITY_HIGHSPEED -> { +// NavHelper.mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_FASTEST) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_FASTEST, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidHighway(false, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidToll(false, 0) +// } +// PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_COST -> { +// NavHelper.mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_FASTEST) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_FASTEST, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidHighway(false, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidToll(true, 0) +// } +// PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_HIGHSPEED -> { +// NavHelper.mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_FASTEST) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_FASTEST, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidHighway(true, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidToll(false, 0) +// } +// PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_HIGHTSPEED_COST -> { +// NavHelper.mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_SHORTEST) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_SHORTEST, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidHighway(true, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidToll(false, 0) +// } +// PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_CONGESTION -> { +// NavHelper.mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_SUGGEST) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_SUGGEST, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidHighway(false, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidToll(false, 0) +// } +// PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_PRIORITY_HIGHSPEED_AVOID_CONGESTION -> { +// NavHelper.mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_SUGGEST) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_SUGGEST, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidHighway(false, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidToll(false, 0) +// } +// PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_COST_CONGESTION -> { +// NavHelper.mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_SUGGEST) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_SUGGEST, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidHighway(false, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidToll(true, 0) +// } +// PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_HIGHSPEED_CONGESTION -> { +// NavHelper.mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_SUGGEST) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_SUGGEST, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidHighway(true, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidToll(true, 0) +// } +// PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_HIGHSPEED_COST_CONGESTION -> { +// NavHelper.mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_SUGGEST) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_SUGGEST, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidHighway(true, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidToll(true, 0) +// } +// PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT -> { +// NavHelper.mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_DEFAULT) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_DEFAULT, 0) +// } +// else -> { +// NavHelper.mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_DEFAULT) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_DEFAULT, 0) +// } +// } +// } +// +// //重置路线 +// override fun resetRouteSetPanel() { +// if (DEBUG) { +// Log.i(TAG, "navop-resetRouteSetPanel:") +// } +// } +// +// override fun setStart(start: NavPoi) { +// if (DEBUG) { +// Log.i(TAG, "navop-setStart:${start}") +// } +// mIsStartSet = true +// mStart = start +// mNaviControllerHandler.obtainMessage(MSG_SET_START, start).sendToTarget() +// } +// +// /** +// * 设置目的地 +// * +// * @param end +// */ +// override fun setDest(end: NavPoi) { +// if (DEBUG) { +// Log.i(TAG, "navop-setDest:${end}") +// } +// mIsDestSet = true +// mEnd = end +// mNaviControllerHandler.obtainMessage( +// MSG_SET_DEST, +// end +// ).sendToTarget() +// /* +// try { +// mApplication.getMapAct().getINavigationCore().stopServer(); +// } catch (RemoteException e) { +// +// e.printStackTrace(); +// }*/if (mStart == null) { +// mNaviControllerHandler.sendEmptyMessage(MSG_NET_LOCATION) +// } +// } +// +// //显示详情信息 -- 只设置了终点情况下 +// override fun startNaviDetail() { +// if (DEBUG) { +// Log.i(TAG, "navop-startNaviDetail:") +// } +// m_Status_Navi = false +// mNaviType = TYPE_NAVI_DETAIL +// WaitDialog.show(mContext, "正在获取您的位置,请稍候...") +// +// mNaviControllerHandler.sendEmptyMessage(MSG_NET_LOCATION) +// } +// +// /** +// * 开始导航系统 +// * +// * @param isSimulator +// */ +// override fun startNavi(isSimulator: Boolean): Boolean { +// if (DEBUG) { +// Log.i(TAG, "navop-startNavi:isSimulator${isSimulator}") +// } +// var curMapMode = MapHelper.mMapParams?.getStyleMode() +// curMapMode = curMapMode + 3 +// mapController?.setMapStyle(curMapMode) +// mapController?.clearSearchPoi() +// mapController?.setFollowCarMode(true) +// mapController?.setMapNorth(false) +// mapController?.setNaviModeZoom() +// isSimNavi = isSimulator +// isSimNaviPaused = false +// if (!mIsDestSet) { +// TipDialog.show(mContext, "请设置目的地") +// return false +// } +// val naviType = if (isSimulator) "模拟" else "GPS" +// Recorder.i("启动" + naviType + "导航") +// m_Status_Navi = true +// +// mNaviType = if (isSimulator) TYPE_SIMULATOR_NAVI else TYPE_GPS_NAVI +// try { +// if (!mIsStartSet) { +// //如果没有设置起点,先定位在规划,在开始导航,定位 -- 计算路线 -- 页面刷新 +// WaitDialog.show(mContext, "正在获取您的位置,请稍候...") +// Constant.progressDialog!!.setOnCancelListener { +// mNaviControllerHandler.sendEmptyMessage(MSG_CANCEL_DLG) +// mNaviControllerHandler.removeMessages(MSG_NET_LOCATION) +// } +// mNaviControllerHandler.sendEmptyMessage(MSG_NET_LOCATION) +// } else if (!mNavigationCore.Routing_GetStatus(0)) { +// //设置了起点,但是没有路线 +// Toast.makeText(mContext, "没有可导航的路线", Toast.LENGTH_LONG).show() +// return false +// } else if (mNavigationCore.Routing_GetStatus(0)) { +// //起点终点已经确定,这个地方路线必须存在了。 +// if (DEBUG) { +// Log.i(TAG, "navop-startNavi:start") +// } +// if(CommonController.instance.naviAutoView?.getViewOptions()!!.isLayoutVisible()) { +// panelManager?.setPanel(PanelManager.PANEL_WHAT_HID, PanelManager.PANEL_MODE_RESULTLIST) +// panelManager?.setPanel(PanelManager.PANEL_WHAT_HID, PanelManager.PANEL_MODE_SEARCH) +// panelManager?.setPanel(PanelManager.PANEL_WHAT_RESET, PanelManager.PANEL_MODE_PANEL_BTN_LEFT) +// panelManager?.setPanel(PanelManager.PANEL_WHAT_SET_MODE, PanelManager.PANEL_MODE_GUIDANCE) +// } +//// mNavigationCore.Guidance_SetSimSpeed(60) +// mNavigationCore.Guidance_SetSimSpeed(200) +// mNavigationCore.Guidance_StartNavi(mNaviType) +// naviListener?.onStartNavi(0) +// mapController?.setMapViewPerspective(MapController.MAP_PERSPECTIVE_3D) +// if (isSimulator) { +// mapController?.updateCar( +// (sLon * ConstantExt.RULE_INT).toLong(), +// (sLat * ConstantExt.RULE_INT).toLong(), +// 0, +// 0, +// R.raw.car +// ) +// //setCenter不起作用 +// mapController?.setCenter(sLon, sLat); +// mapController?.animateTo( +// sLon, +// sLat, +// 0f, +// -1.0f, +// 350 +// ) +// } +// } +// } catch (e: Exception) { +// e.printStackTrace() +// return false +// } +// return true +// } +// +// override fun reset() { +// if (DEBUG) { +// Log.i(TAG, "navop-reset: ") +// } +// mIsStartSet = false +// mIsDestSet = false +// mIsTuSet = false +// mStart = null +// mEnd = null +// mWayPoi = null +// mNaviControllerHandler.removeMessages(MSG_LOCATION) +// mNaviControllerHandler.removeMessages(MSG_NET_LOCATION) +// WaitDialog.dismiss() +// mapController?.clearRoute() +// if (m_Status_Navi) { +// stopNavi() +// } else { +// resetView() +// } +// try { +// mNavigationCore.Routing_Reset(0) +// } catch (e: RemoteException) { +// e.printStackTrace() +// } +// clearWayPoints(0) +// +// +// } +// +// private fun resetView() { +// MapHelper.mMapParams.setPerspectiveMode(MapAutoApi.MAP_PERSPECTIVE_2D) +// mapController?.setMapViewPerspective(MapAutoApi.MAP_PERSPECTIVE_2D) +// mapController?.setMapViewRotation(0f) +// panelManager?.setPanel(PanelManager.PANEL_WHAT_BACK, PanelManager.PANEL_MODE_NONE) +// panelManager?.setPanel(PanelManager.PANEL_WHAT_HID, PanelManager.PANEL_MODE_ROUTING_SELECT) +// mapController?.updateCar(0, 0, 0, 0, R.raw.car) +// mapController?.setMapStyle(MapHelper.mMapParams.getStyleMode()) +// mapController?.setZoom(MapHelper.mMapParams.getZoom()) +// resetRouteSetPanel() +// } +// +// /** +// * 停止导航 +// */ +// override fun stopNavi() { +// if (DEBUG) { +// Log.i(TAG, "navop-stopNavi: ") +// } +// naviJob?.cancel() +// +// m_Status_Navi = false +// mNaviType = -1 +// mNaviControllerHandler.removeMessages(MSG_LOCATION) +// mNaviControllerHandler.removeMessages(MSG_NET_LOCATION) +// try { +// mNavigationCore.Guidance_StopNavi() +// } catch (e: RemoteException) { +// e.printStackTrace() +// } +// resetView() +// } +// +// override fun isStartSet(): Boolean { +// return mIsStartSet +// } +// +// override fun isDestSet(): Boolean { +// return mIsDestSet +// } +// +// override fun isTuSet(): Boolean { +// return mIsTuSet +// } +// +// override fun destory() { +// mNavigationCore.setGuidanceStatListener(null) +// mNaviControllerHandler.removeCallbacksAndMessages(null) +// } +// +// override fun setNaviListener(naviListener: NaviListener) { +// this.naviListener = naviListener +// this.naviListener!!.onInitNaviSuccess() +// } +// +// override fun removeNaviListener() { +// this.naviListener = null +// } +// +// override fun getNavPath(): NaviPath{ +// val routeBook = CommonController.instance.iNavigationCore?.Guidance_RouteBook(0, 0, Int.MAX_VALUE) +// var naviPath = NaviPath() +// naviPath.allLength = routeBook!!.totalLength +// naviPath.allTime = routeBook!!.totalTime +// var guideGroups: ArrayList? = ArrayList() +// for(routeBookItem in routeBook.bookdata){ +// var naviRouteGuideGroup = NaviRouteGuideGroup() +// naviRouteGuideGroup.groupEnterCoord = LonLatPoint(routeBookItem.lon.toDouble(), routeBookItem.lat.toDouble()) +// naviRouteGuideGroup.groupLen = routeBookItem.routelength +// naviRouteGuideGroup.groupTime = routeBookItem.routeTime +// naviRouteGuideGroup.groupName = routeBookItem.routeName +// naviRouteGuideGroup.groupIconType = routeBookItem.turnID +// guideGroups?.add(naviRouteGuideGroup) +// } +// naviPath.guideGroups = guideGroups +// return naviPath +// } +// +// +// private fun getNavInfo(naviInfo: NaviInfo): NavInfo { +// var navInfo = NavInfo() +// navInfo.pathID = 0 +// navInfo.m_Type = getNaviType() +// navInfo.m_CurRoadName = naviInfo.m_pStrCurName +// navInfo.m_NextRoadName = naviInfo.m_pStrNextName +// navInfo.m_SAPADist = naviInfo.m_ServerDist +// navInfo.m_CameraDist = 0 //还没有 +// navInfo.m_CameraType = 0//还没有 +// navInfo.m_CameraSpeed = 0 //还没有 +// navInfo.m_Icon = naviInfo.m_nTurnID +// navInfo.m_RouteRemainDis = naviInfo.m_nDistanceToDest +// navInfo.m_RouteRemainTime = naviInfo.m_nTimeToDest +// navInfo.m_SegRemainDis = naviInfo.m_nDistanceToTurn +// navInfo.m_SegRemainTime = 0//还没有 +// navInfo.m_CarDirection = naviInfo.m_Angle.toInt() +// navInfo.m_LimitedSpeed = 0//还没有 +// navInfo.m_CurSegNum = 0//还没有 +// navInfo.m_CurLinkNum = 0 //还没有 +// navInfo.m_CurPointNum = 0//还没有 +//// navInfo.m_Split +//// navInfo.m_HawkIndex +//// navInfo.m_SegTipsDis +// navInfo.currentSpeed = naviInfo.m_nSpeed +// navInfo.notAvoidInfo = null//还没有 +// navInfo.iconBitmap = null//还没有 +//// navInfo.naviExitDirectionInfo//还没有 +// navInfo.routeRemainLightCount = 0//还没有 +// return navInfo +// } +// +// +// override fun getNaviSetting(): NaviSetting { +// return NaviSetting() +// } +// +// /** +// * 更新位置 +// * +// * @param lon 经度 +// * @param lat 纬度 +// * @param provider gps +// * @param speed 速度 +// * @param heading +// */ +// override fun updatePosition( +// lon: Double, +// lat: Double, +// provider: String?, +// speed: Float, +// heading: Float +// ) { +// if (DEBUG) { +// Log.i(TAG, "navop--centerop-updatePosition:${lon},${lat} ") +// } +// mapController?.setCenter(lon, lat) +// try { +//// if ("gps" == provider) { +// mNavigationCore.Guidance_UpdatePosition( +// lon.toFloat(), +// lat.toFloat(), +// speed, +// heading +// ) +// mNaviControllerHandler.sendEmptyMessage(MSG_MAPMATCHEDPOSITION) +// if (m_Status_Navi && !mReNavi) { +//// mNaviControllerHandler.removeMessages(MSG_GET_NAVIINFO); +//// mNaviControllerHandler.sendEmptyMessage(MSG_GET_NAVIINFO); +//// mNaviControllerHandler.removeMessages(MSG_GET_TTS); +//// mNaviControllerHandler.sendEmptyMessage(MSG_GET_TTS); +// } +//// } +// } catch (e: RemoteException) { +// e.printStackTrace() +// } +// } +// +// /** +// * 重新设置路线 +// */ +// override fun reSetRoute(): Boolean { +// if (DEBUG) { +// Log.i(TAG, "navop-reSetRoute ") +// } +// if (isStartSet() && isDestSet()) { +// mNaviControllerHandler.sendEmptyMessage(MSG_GET_ROUTE) +// return true +// } +// return false +// } +// +// override fun getNaviStat(): Boolean { +// return m_Status_Navi +// } +// +// /** +// * 重新导航 +// * +// * @param lon 经度 +// * @param lat 纬度 +// */ +// fun reNavi(lon: Int, lat: Int) { +// if (DEBUG) { +// Log.i(TAG, "navop-reNavi:NavPoi:${lon},${lat} ") +// } +// mReNavi = true +// Recorder.i("偏离路线 $lon $lat") +// try { +// mNavigationCore.play("偏离路线",true) +// mNavigationCore.Routing_SetOrigin( +// lon.toFloat() / 1000000, +// lat.toFloat() / 1000000, +// 0 +// ) +// mNavigationCore.Routing_GetRoute(0) +// if (mNavigationCore.Routing_GetStatus(0)) { +// mapController?.drawRoute() +// mNavigationCore.Guidance_StartNavi(mNaviType) +// mReNavi = false +// Recorder.i("偏离路线计算成功") +// } else { +// //算路失败 +// Recorder.i("偏离路线计算失败") +// } +// } catch (e: RemoteException) { +// e.printStackTrace() +// } +// } +// +// /** +// * 增加途经点 +// * +// * @param poi poi点 +// * @param heading 起点 +// * @param sessionid +// */ +// override fun addWayPoint(poi: NavPoi, heading: Int, sessionid: Int) { +// if (DEBUG) { +// Log.i(TAG, "navop-addWayPoints:NavPoi:${poi} ") +// } +// try { +// mWayPoi = poi +// mNavigationCore.clearwaypoints(sessionid) //暂时支持一个途经点,添加前需要清空 +// mNavigationCore.addwaypoint(poi.lon.toFloat(), poi.lat.toFloat(), heading, sessionid) +// mIsTuSet = true +// Recorder.i("设置途经点 " + poi?.lon.toString() + " " + poi?.lat) +// reSetRoute() +// } catch (e: RemoteException) { +// e.printStackTrace() +// } +// } +// +// //添加沿途点 +// override fun addWayPoints(wayPoint: ArrayList) { +// if (DEBUG) { +// Log.i(TAG, "navop-addWayPoints:size:${wayPoint.size} ") +// } +// if (wayPoint.isNullOrEmpty()) { +// return +// } +// try { +// mNavigationCore.clearwaypoints(0) //暂时支持一个途经点,添加前需要清空 +// for (navPoi in wayPoint) { +// mNavigationCore.addwaypoint(navPoi.lon.toFloat(), navPoi.lat.toFloat(), 0, 0) +// Recorder.i("设置途经点 " + navPoi.lat + " " + navPoi.lat) +// } +// mIsTuSet = true +// reSetRoute() +// } catch (e: Exception) { +// e.printStackTrace() +// } +// } +// +// /** +// * 清楚途经点 +// * +// * @param sessionid +// */ +// override fun clearWayPoints(sessionid: Int) { +// if (DEBUG) { +// Log.i(TAG, "navop-clearWayPoints:sessionid:${sessionid} ") +// } +// try { +// mWayPoi = null +// mNavigationCore.clearwaypoints(sessionid) +// mIsTuSet = false +// reSetRoute() +// } catch (e: Exception) { +// e.printStackTrace() +// } +// } +// +// override fun getStartPoi(): NavPoi? { +// return mStart +// } +// +// override fun getEndPoi(): NavPoi? { +// return mEnd +// } +// +// override fun getWayPoi(): NavPoi? { +// return mWayPoi +// } +// +// +// /** +// * 导航状态改变 +// * +// * @param statCode +// * @param datas +// */ +// override fun onGuidanceStatusChanged( +// statCode: Int, +// datas: ByteArray +// ) { +// if (DEBUG) { +// Log.i(TAG, "navop-onGuidanceStatusChanged: code:$statCode") +// } +// if (!m_Status_Navi || datas == null) { +// return +// } +// when (statCode) { +// LISTENER_TYPE_TTS -> { +// if (isSpeakStatus) { +// val msg = Message.obtain() +// msg.what = MSG_GET_TTS +// msg.obj = datas +// mNaviControllerHandler.sendMessage(msg) +// } +// } +// LISTENER_TYPE_NAVI_INFO -> { +// val msg = Message.obtain() +// msg.what = +// MSG_GET_NAVIINFO +// msg.obj = datas +// mNaviControllerHandler.sendMessage(msg) +// } +// } +// } +// +// companion object { +// private const val TYPE_NAVI_DETAIL = 1 +// private const val TYPE_SIMULATOR_NAVI = 2 +// private const val TYPE_GPS_NAVI = 3 +// private const val MSG_LOCATION = 1 +// private const val MSG_GET_ROUTE = 2 +// private const val MSG_SET_START = 3 +// private const val MSG_SET_DEST = 4 +// private const val MSG_NET_LOCATION = 5 +// private const val MSG_MAPMATCHEDPOSITION = 6 +// private const val MSG_GET_TTS = 7 +// private const val MSG_GET_NAVIINFO = 8 +// private const val MSG_CANCEL_DLG = 9 +// private const val MSG_SHOW_DIALOG = 10 +// private const val MSG_SHOW_ROUTE_SELECT = 11 +// const val LISTENER_TYPE_TTS = 101 +// const val LISTENER_TYPE_NAVI_INFO = 102 +// } +// +// init { +// try { +// mNavigationCore.setGuidanceStatListener(this) +// } catch (e: RemoteException) { +// e.printStackTrace() +// } +// } +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/Category.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/Category.java new file mode 100644 index 0000000000..5b6d224ef5 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/Category.java @@ -0,0 +1,83 @@ +package com.zhidaoauto.map.sdk.inner.obj; + +import android.os.Parcel; +import android.os.Parcelable; + +import com.autonavi.nge.obj.SubCategory; + +import java.util.List; + +public class Category implements Parcelable{ + + public static final Creator CREATOR = new Creator() { + public com.autonavi.nge.obj.Category createFromParcel(Parcel in) { + com.autonavi.nge.obj.Category category = new com.autonavi.nge.obj.Category(); + category.setCatName(in.readString()); + category.setKindId(in.readInt()); + category.setSubCategory(in.readArrayList(SubCategory.class.getClassLoader())); + category.setSubNum(in.readInt()); + return category; + } + + public com.autonavi.nge.obj.Category[] newArray(int size) { + return new com.autonavi.nge.obj.Category[size]; + } + }; + + private String m_sCatName = ""; + private int m_iKindId = 0; + private List m_oSubCategory = null; + private int m_iSubNum = 0; + + public String getCatName() { + return m_sCatName; + } + + public int getKindId() { + return m_iKindId; + } + + public List getSubCategory() { + return m_oSubCategory; + } + + public int getSubNum() { + return m_iSubNum; + } + + public void setCatName(String sCatName) { + this.m_sCatName = sCatName; + } + + public void setKindId(int iKindId) { + this.m_iKindId = iKindId; + } + + public void setSubCategory(List subCateList) { + this.m_oSubCategory = subCateList; + } + + public void setSubNum(int iSubNum) { + this.m_iSubNum = iSubNum; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel out, int arg1) { + out.writeString(m_sCatName); + out.writeInt(m_iKindId); + out.writeList(m_oSubCategory); + out.writeInt(m_iSubNum); + } + + public void readFromParcel(Parcel in) { + m_sCatName = in.readString(); + m_iKindId = in.readInt(); + m_oSubCategory = in.readArrayList(SubCategory.class.getClassLoader()); + m_iSubNum = in.readInt(); + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/Coordinate.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/Coordinate.java new file mode 100644 index 0000000000..9db0588721 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/Coordinate.java @@ -0,0 +1,30 @@ +package com.zhidaoauto.map.sdk.inner.obj; + +/** + * 坐标基类 + */ +public class Coordinate { + private double x; + private double y; + + public Coordinate(double x, double y) { + this.x = x; + this.y = y; + } + + public double getX() { + return x; + } + + public void setX(double x) { + this.x = x; + } + + public double getY() { + return y; + } + + public void setY(double y) { + this.y = y; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/CustomDriveStep.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/CustomDriveStep.kt new file mode 100644 index 0000000000..2022837473 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/CustomDriveStep.kt @@ -0,0 +1,10 @@ +package com.zhidaoauto.map.sdk.inner.obj + +class CustomDriveStep { + // private String road; + // private String orientation; + // private float distance; + // private float duration; + var customTmcList: List? = null + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/CustomTMC.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/CustomTMC.kt new file mode 100644 index 0000000000..da64752bb8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/CustomTMC.kt @@ -0,0 +1,14 @@ +package com.zhidaoauto.map.sdk.inner.obj + +import com.autonavi.nge.map.LonLat + +class CustomTMC { + //长度 + // private int distance; + //状态 0 畅通 1 缓行 2 拥堵 3 严重拥堵 + var status = 0 + + //道路点 + var polylines: List = ArrayList() + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/DestObj.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/DestObj.java new file mode 100644 index 0000000000..dba1701d44 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/DestObj.java @@ -0,0 +1,78 @@ +package com.zhidaoauto.map.sdk.inner.obj; + +import com.autonavi.nge.obj.PoiBase; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * Dest + * @author + * + */ +public class DestObj implements Serializable{ + private static final long serialVersionUID = 1L; + + private PoiBase poi; + private long ID; + //0:添加的 1:回家 2:上班 + private int kind = 0; + //创建时间 + private String strCreateDate; + + public DestObj() { + + } + /** + * 一般用于添加新Dest + * @param poi + * @param kind + */ + public DestObj(PoiBase poi) { + this.poi = poi; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm"); + this.strCreateDate = sdf.format(new Date()); + } + + /** + * 一般用于更新Dest + * @param id + * @param name + * @param deslon + * @param deslat + * @param desname + */ + public DestObj(long id, String name, int deslon, int deslat, String desname) { + PoiBase mPoiBase = new PoiBase(name, desname, deslon, deslat); + this.poi = mPoiBase; + this.ID = id; + } + + public PoiBase getPoi() { + if(poi == null) //不应该出现 + poi = new PoiBase("", "", 0, 0); + return poi; + } + public void setPoi(PoiBase poi) { + this.poi = poi; + } + public long getId() { + return ID; + } + public void setId(long ID) { + this.ID = ID; + } + public int getKind() { + return kind; + } + public void setKind(int kind) { + this.kind = kind; + } + public String getCreateDate() { + return strCreateDate; + } + public void setCreateDate(String strCreateDate) { + this.strCreateDate = strCreateDate; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/History.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/History.java new file mode 100644 index 0000000000..8fc7da701a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/History.java @@ -0,0 +1,25 @@ +package com.zhidaoauto.map.sdk.inner.obj; + +import com.autonavi.nge.obj.PoiBase; + +import java.io.Serializable; + +public class History implements Serializable { + private static final long serialVersionUID = 759861585179477287L; + + private PoiBase poi; + private int ID; + + public PoiBase getPoi() { + return poi; + } + public void setPoi(PoiBase poi) { + this.poi = poi; + } + public int getID() { + return ID; + } + public void setID(int ID) { + this.ID = ID; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/NavMsg.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/NavMsg.kt new file mode 100644 index 0000000000..34e2df476e --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/NavMsg.kt @@ -0,0 +1,21 @@ +package com.zhidaoauto.map.sdk.inner.obj + +import com.zhidaoauto.map.sdk.open.nav.NavInfo + +class NavMsg { + var msgType:Int? = null + var staus:Int? = null + var navInfo:NavInfo? = null + + constructor(msgType: Int?) { + this.msgType = msgType + } + + constructor(msgType: Int?, staus: Int?, navInfo: NavInfo?) { + this.msgType = msgType + this.staus = staus + this.navInfo = navInfo + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/NdsPoint.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/NdsPoint.kt new file mode 100644 index 0000000000..d82c045227 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/NdsPoint.kt @@ -0,0 +1,6 @@ +package com.zhidaoauto.map.sdk.inner.obj + +class NdsPoint { + var lon:Long = 0L + var lat:Long = 0L +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/OverlayItem.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/OverlayItem.java new file mode 100644 index 0000000000..193291f11a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/OverlayItem.java @@ -0,0 +1,79 @@ +package com.zhidaoauto.map.sdk.inner.obj; + +import android.R; +import android.graphics.drawable.Drawable; + +import com.zhidaoauto.map.sdk.inner.element.MapCoordinate; + +public class OverlayItem +{ + protected final MapCoordinate m_Coordinate; + protected final String m_Title; + protected final String m_Snippet; + protected Drawable m_Marker; + + public static final int ITEM_STATE_FOCUSED_MASK = 4; + public static final int ITEM_STATE_SELECTED_MASK = 2; + public static final int ITEM_STATE_PRESSED_MASK = 1; + private static final int ITEM_STATE_TO_STATE_SET[][] = { + { + -R.attr.state_focused, -R.attr.state_selected, -R.attr.state_pressed + }, { + -R.attr.state_focused, -R.attr.state_selected, R.attr.state_pressed + }, { + -R.attr.state_focused, R.attr.state_selected, -R.attr.state_pressed + }, { + -R.attr.state_focused, R.attr.state_selected, R.attr.state_pressed + }, { + R.attr.state_focused, -R.attr.state_selected, -R.attr.state_pressed + }, { + R.attr.state_focused, -R.attr.state_selected, R.attr.state_pressed + }, { + R.attr.state_focused, R.attr.state_selected, -R.attr.state_pressed + }, { + R.attr.state_focused, R.attr.state_selected, R.attr.state_pressed + } + }; + + public OverlayItem(MapCoordinate point, String title, String snippet) + { + m_Marker = null; + m_Coordinate = point; + m_Title = title; + m_Snippet = snippet; + } + + public void setMarker(Drawable marker) + { + m_Marker = marker; + } + + public Drawable getMarker(int stateBitset) + { + if(m_Marker != null) + { + setState(m_Marker, stateBitset); + } + return m_Marker; + } + + public static void setState(Drawable drawable, int stateBitset) + { + drawable.setState(ITEM_STATE_TO_STATE_SET[stateBitset]); + } + + public String getTitle() + { + return m_Title; + } + + public String getSnippet() + { + return m_Snippet; + } + + public MapCoordinate getPoint() + { + return m_Coordinate; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/PoiBase.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/PoiBase.java new file mode 100644 index 0000000000..57105294cd --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/PoiBase.java @@ -0,0 +1,185 @@ +package com.zhidaoauto.map.sdk.inner.obj; + +import android.graphics.drawable.Drawable; +import android.os.Parcel; +import android.os.Parcelable; + +import com.autonavi.nge.obj.OverlayItem; +import com.zhidaoauto.map.sdk.inner.element.MapCoordinate; + +import java.io.Serializable; + +public class PoiBase extends OverlayItem implements Parcelable, Serializable { + + public static final Creator CREATOR = new Creator() { + @Override + public PoiBase createFromParcel(Parcel in) { + String name = in.readString(); + String address = in.readString(); + String tel = in.readString(); + int x = in.readInt(); + int y = in.readInt(); + int id = in.readInt(); + return new PoiBase(name, address, tel, x, y, id); + } + + @Override + public PoiBase[] newArray(int size) { + return new PoiBase[size]; + } + }; + + private static final long serialVersionUID = 1L; + public String name = ""; + public String address = ""; + public String tel = ""; + public String sDeepDetail = ""; + public int nPicId = 0; + public int x = 0; + public int y = 0; + public int id = 0; + + public PoiBase(String name, String address, int x, int y) { + super(new MapCoordinate(x, y), name, null); + this.name = name; + this.address = address; + this.x = x; + this.y = y; + } + + public PoiBase(String name, String address, String tel, int x, int y) { + super(new MapCoordinate(x, y), name, null); + this.name = name; + this.address = address; + this.tel = tel; + this.x = x; + this.y = y; + } + + public PoiBase(String name, String address, String tel, int x, int y, int id) { + super(new MapCoordinate(x, y), name, null); + this.name = name; + this.address = address; + this.tel = tel; + this.x = x; + this.y = y; + this.id = id; + } + public PoiBase(String name, String address, String sDeepDetail ,String tel, int picId, int x, int y, int id, Drawable icon) { + super(new MapCoordinate(x, y), name, null); + this.name = name; + this.address = address; + this.tel = tel; + this.x = x; + this.y = y; + this.id = id; + this.nPicId = picId; + this.sDeepDetail = sDeepDetail; + if(null != icon) { + m_Marker = icon; + } + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getTel() { + return tel; + } + + public void setTel(String tel) { + this.tel = tel; + } + + public String getsDeepDetail() { + return sDeepDetail; + } + + public void setsDeepDetail(String sDeepDetail) { + this.sDeepDetail = sDeepDetail; + } + + public int getnPicId() { + return nPicId; + } + + public void setnPicId(int nPicId) { + this.nPicId = nPicId; + } + + public int getX() { + return x; + } + + public void setX(int x) { + this.x = x; + } + + public int getY() { + return y; + } + + public void setY(int y) { + this.y = y; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel out, int arg1) { + out.writeString(name); + out.writeString(address); + out.writeString(tel); + out.writeInt(x); + out.writeInt(y); + out.writeInt(id); + } + + public void readFromParcel(Parcel in) { + name = in.readString(); + address = in.readString(); + tel = in.readString(); + x = in.readInt(); + y = in.readInt(); + id = in.readInt(); + } + + @Override + public String toString() { + return "PoiBase{" + + "name='" + name + '\'' + + ", address='" + address + '\'' + + ", tel='" + tel + '\'' + + ", sDeepDetail='" + sDeepDetail + '\'' + + ", nPicId=" + nPicId + + ", x=" + x + + ", y=" + y + + ", id=" + id + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/Point.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/Point.kt new file mode 100644 index 0000000000..c1192699f2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/Point.kt @@ -0,0 +1,6 @@ +package com.zhidaoauto.map.sdk.inner.obj + +class Point { + var x = 0.0 + var y = 0.0 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/PointData.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/PointData.kt new file mode 100644 index 0000000000..afcc7c1826 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/PointData.kt @@ -0,0 +1,7 @@ +package com.zhidaoauto.map.sdk.inner.obj + +class PointData { + var x:Double = 0.0 + var y:Double = 0.0 + var z:Double = 0.0 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/ResultData.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/ResultData.java new file mode 100644 index 0000000000..bbab791fc6 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/ResultData.java @@ -0,0 +1,29 @@ +package com.zhidaoauto.map.sdk.inner.obj; + + +import java.io.Serializable; + +/** + * 数据传输类 + */ +public class ResultData implements Serializable { + + private String key; + private String value; + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/SubCategory.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/SubCategory.java new file mode 100644 index 0000000000..e2abaec91a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/SubCategory.java @@ -0,0 +1,58 @@ +package com.zhidaoauto.map.sdk.inner.obj; + +import android.os.Parcel; +import android.os.Parcelable; + +public class SubCategory implements Parcelable{ + + public static final Creator CREATOR = new Creator() { + @Override + public com.autonavi.nge.obj.SubCategory[] newArray(int size) { + return new com.autonavi.nge.obj.SubCategory[size]; + } + + @Override + public com.autonavi.nge.obj.SubCategory createFromParcel(Parcel in) { + com.autonavi.nge.obj.SubCategory subCategory = new com.autonavi.nge.obj.SubCategory(); + subCategory.setKindId(in.readInt()); + subCategory.setCatName(in.readString()); + return subCategory; + } + + }; + + int m_iKindId = 0; + String m_sCatName = ""; + + public int getKindId() { + return m_iKindId; + } + + public String getCatName() { + return m_sCatName; + } + + public void setKindId(int iKindId) { + this.m_iKindId = iKindId; + } + + public void setCatName(String sCatName) { + this.m_sCatName = sCatName; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel out, int arg1) { + out.writeInt(m_iKindId); + out.writeString(m_sCatName); + } + + public void readFromParcel(Parcel in) { + m_iKindId = in.readInt(); + m_sCatName = in.readString(); + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/TrafficResult.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/TrafficResult.kt new file mode 100644 index 0000000000..ef6fc4412a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/TrafficResult.kt @@ -0,0 +1,6 @@ +package com.zhidaoauto.map.sdk.inner.obj + +class TrafficResult { + var customDriveSteps: List? = null + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/UpdateRegion.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/UpdateRegion.java new file mode 100644 index 0000000000..8434632c90 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/obj/UpdateRegion.java @@ -0,0 +1,72 @@ +package com.zhidaoauto.map.sdk.inner.obj; + +import android.os.Parcel; +import android.os.Parcelable; + +public class UpdateRegion implements Parcelable{ + + public static final Creator CREATOR = new Creator() { + + @Override + public com.autonavi.nge.obj.UpdateRegion[] newArray(int size) { + + return new com.autonavi.nge.obj.UpdateRegion[size]; + } + + @Override + public com.autonavi.nge.obj.UpdateRegion createFromParcel(Parcel in) { + com.autonavi.nge.obj.UpdateRegion updateRegion = new com.autonavi.nge.obj.UpdateRegion(); + updateRegion.setUrId(in.readInt()); + updateRegion.setUrNameId(in.readInt()); + updateRegion.setUrName(in.readString()); + return updateRegion; + } + + }; + + int m_urId; + int m_urNameId; + String m_urName; + + public int getUrId() { + return m_urId; + } + + public void setUrId(int urId) { + this.m_urId = urId; + } + + public int getUrNameId() { + return m_urNameId; + } + + public void setUrNameId(int urNameId) { + this.m_urNameId = urNameId; + } + + public String getUrName() { + return m_urName; + } + + public void setUrName(String urName) { + this.m_urName = urName; + } + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel out, int arg1) { + out.writeInt(m_urId); + out.writeInt(m_urNameId); + out.writeString(m_urName); + } + + public void readFromParcel(Parcel in) { + m_urId = in.readInt(); + m_urNameId = in.readInt(); + m_urName = in.readString(); + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/DirectionLayer.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/DirectionLayer.java new file mode 100644 index 0000000000..ca863d4d06 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/DirectionLayer.java @@ -0,0 +1,122 @@ +package com.zhidaoauto.map.sdk.inner.panel; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.graphics.Camera; +import android.graphics.Canvas; +import android.graphics.Matrix; +import android.graphics.drawable.Drawable; +import android.util.Log; +import android.view.MotionEvent; +import android.view.ViewGroup.LayoutParams; +import android.widget.ImageView; + +import com.zhidaoauto.map.sdk.R; +import com.zhidaoauto.map.sdk.inner.CompileConfig; +import com.zhidaoauto.map.sdk.inner.abs.IMapController; +import com.zhidaoauto.map.sdk.inner.map.MapController; +import com.zhidaoauto.map.sdk.open.abs.MapStatusListener; + +@SuppressLint("AppCompatCustomView") +public class DirectionLayer extends ImageView implements MapStatusListener { + + private static final String TAG = "DirectionLayer"; + private Drawable icon; + private IMapController mMapController; + private Matrix matrix = new Matrix(); + private Camera mCamera = new Camera(); + + public DirectionLayer(Context context){ + super(context); + try{ + icon = context.getResources().getDrawable(R.mipmap.mapdir); + }catch(Exception e){ + icon = null; + } + if(null == icon) { + return; + } + if(CompileConfig.INSTANCE.getDEBUG()){ + Log.i(TAG,"autoop--DirectionLayer show"); + } + icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight()); + //setBackgroundResource(R.drawable.btn_selecter); + final float scale = getResources().getDisplayMetrics().density; + int btnSize = getResources().getDimensionPixelSize(R.dimen.btn_size); + setLayoutParams(new LayoutParams(btnSize, btnSize)); + int padding = (int) (5 * scale + 0.5f); + setPadding(padding, padding, padding, padding); + setImageDrawable(icon); + } + + public DirectionLayer(Context context,IMapController mapController){ + super(context); + try{ + icon = context.getResources().getDrawable(R.mipmap.mapdir); + }catch(Exception e){ + icon = null; + } + if(null == icon) { + return; + } + if(CompileConfig.INSTANCE.getDEBUG()){ + Log.i(TAG,"autoop--DirectionLayer show"); + } + icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight()); + //setBackgroundResource(R.drawable.btn_selecter); + final float scale = getResources().getDisplayMetrics().density; + int btnSize = getResources().getDimensionPixelSize(R.dimen.btn_size); + setLayoutParams(new LayoutParams(btnSize, btnSize)); + int padding = (int) (5 * scale + 0.5f); + setPadding(padding, padding, padding, padding); + setImageDrawable(icon); + mMapController = mapController; + if(mMapController.getEventController() != null){ + mMapController.getEventController().addMapStatusListener(this, MapController.LISTENER_TYPE_3D | MapController.LISTENER_TYPE_ROTATE); + } + } + @Override + public void onDraw(Canvas canvas){ + if(null == mMapController) { + return; + } + canvas.save(); + canvas.translate(getWidth() / 2, getHeight() / 2); +// mCamera.save(); +// mCamera.rotateX(90 - mapController.getDAngle()); +// mCamera.getMatrix(matrix); +// mCamera.restore(); + canvas.concat(matrix); + canvas.rotate(mMapController.getMapViewRotation()); + canvas.translate(-getWidth() / 2, -getHeight() / 2); + super.onDraw(canvas); + canvas.restore(); + postInvalidate(); + } + @Override + public boolean onTouchEvent(MotionEvent ev){ + if(null == mMapController) { + return true; + } + if(ev.getAction() == MotionEvent.ACTION_UP){ +// if(!CommonController.getInstance().getNaviController().getNaviStat()){ +// mapController.setMapViewRotation(0); +// } + if(mMapController.getMapViewPerspective() == MapController.MAP_PERSPECTIVE_2D){ + mMapController.setMapViewPerspective(MapController.MAP_PERSPECTIVE_3D); + }else if(mMapController.getMapViewPerspective() == MapController.MAP_PERSPECTIVE_3D){ + mMapController.setMapViewPerspective(MapController.MAP_PERSPECTIVE_2D); + } + postInvalidate(); + } + return true; + } + @Override + public void onMapStatusChanged(int type, int value) { + postInvalidate(); + } + + public static void main(String[] args) { + + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/Panel.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/Panel.java new file mode 100644 index 0000000000..34e95247ab --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/Panel.java @@ -0,0 +1,119 @@ +package com.zhidaoauto.map.sdk.inner.panel; + +import android.content.Context; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewParent; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.widget.FrameLayout; +import android.widget.LinearLayout; + +import com.zhidaoauto.map.sdk.R; +import com.zhidaoauto.map.sdk.inner.abs.IMapController; + +public abstract class Panel extends LinearLayout{ + protected Context mContext; + protected IMapController mMapController; + protected FrameLayout.LayoutParams mLayoutParams; + protected View mView; + + protected Animation mTopInAnimation; + protected Animation mTopOutAnimation; + + protected Animation mLeftInAnimation; + protected Animation mLeftOutAnimation; + + protected Animation mRightInAnimation; + protected Animation mRightOutAnimation; + + public Panel(Context context) { + super(context); + mContext = context; + this.setClickable(true); + mTopInAnimation = AnimationUtils.loadAnimation(mContext, R.anim.top_in); + mTopOutAnimation = AnimationUtils.loadAnimation(mContext, R.anim.top_out); + + mLeftInAnimation = AnimationUtils.loadAnimation(mContext, R.anim.left_in); + mLeftOutAnimation = AnimationUtils.loadAnimation(mContext, R.anim.left_out); + + mRightInAnimation = AnimationUtils.loadAnimation(mContext, R.anim.right_in); + mRightOutAnimation = AnimationUtils.loadAnimation(mContext, R.anim.right_out); + } + + public Panel(Context context, IMapController mapController) { + super(context); + mContext = context; + this.mMapController = mapController; + this.setClickable(true); + mTopInAnimation = AnimationUtils.loadAnimation(mContext, R.anim.top_in); + mTopOutAnimation = AnimationUtils.loadAnimation(mContext, R.anim.top_out); + + mLeftInAnimation = AnimationUtils.loadAnimation(mContext, R.anim.left_in); + mLeftOutAnimation = AnimationUtils.loadAnimation(mContext, R.anim.left_out); + + mRightInAnimation = AnimationUtils.loadAnimation(mContext, R.anim.right_in); + mRightOutAnimation = AnimationUtils.loadAnimation(mContext, R.anim.right_out); + } + + protected void remove(){ + ViewParent parent = this.getParent(); + if(parent != null && parent instanceof ViewGroup){ + ((ViewGroup)parent).removeView(this); + } + } + + protected boolean dispatchPanelKeyEvent(KeyEvent event){ + return false; + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + + return super.onTouchEvent(event); + } + + + protected void setContentView(int layoutResID, LayoutParams lauoutParams){ + if(mView == null){ + mView = LayoutInflater.from(mContext).inflate(layoutResID, null); + addView(mView, lauoutParams); + } + } + + protected View findVievById(int id){ + return mView.findViewById(id); + } + + protected void setMyGravity(int gravity){ + if(mLayoutParams == null){ + mLayoutParams = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); + } + mLayoutParams.gravity = gravity; + setLayoutParams(mLayoutParams); + } + + protected void setMargin(Integer top, Integer bottom, Integer left, Integer right){ + if(mLayoutParams == null){ + mLayoutParams = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); + } + mLayoutParams.topMargin = top; + mLayoutParams.bottomMargin = bottom; + mLayoutParams.leftMargin = left; + mLayoutParams.rightMargin = right; + setLayoutParams(mLayoutParams); + } + + protected abstract void onShowPanel(); + protected abstract boolean onHidPanel(); + protected abstract void onPausePanel(); + protected abstract void onResumePanel(); + protected abstract void reset(); + protected abstract void setPos(Integer top, Integer bottom, Integer left, Integer right); + protected abstract boolean onPrepareOptionsMenu(Menu menu); + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnLocation.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnLocation.kt new file mode 100644 index 0000000000..70bb50915c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnLocation.kt @@ -0,0 +1,67 @@ +package com.zhidaoauto.map.sdk.inner.panel + +import android.content.Context +import android.view.Gravity +import android.view.Menu +import android.view.View +import android.widget.Toast +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.open.MapAutoApi +import kotlinx.android.synthetic.main.panel_btn_location.view.btn_pos + +class PanelBtnLocation(context: Context?,private val mMapController: IMapController) : Panel(context,mMapController), View.OnClickListener { + override fun onClick(v: View) { + if (v.id == R.id.btn_pos) { + try { + var location = mMapController.getLastKnownMogoLocation() + if (location != null && location.longitude > 0 && location.latitude > 0) { + mMapController!!.setCenter(location.longitude, location.latitude) + mMapController.setFollowCarMode(true) + } else { + Toast.makeText(mContext, "定位中,请稍后", Toast.LENGTH_SHORT) + .show() + } + } catch (e: Exception) { + e.printStackTrace() + } + } + } + + override fun onShowPanel() {} + override fun onHidPanel(): Boolean { + return true + } + + override fun onPausePanel() {} + override fun onResumePanel() {} + override fun reset() {} + override fun setPos( + top: Int, bottom: Int, left: Int, + right: Int + ) { + setMargin(top, bottom, left, right) + } + + override fun onPrepareOptionsMenu(menu: Menu): Boolean { + return false + } + + init { + setContentView( + R.layout.panel_btn_location, LayoutParams( + LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT + ) + ) + setPos(0, 20, 10, 25) + setMyGravity(Gravity.BOTTOM or Gravity.RIGHT) + val style = mMapController.getMapStyleParams().getStyleMode() + if(style == MapAutoApi.MAP_STYLE_DAY || style == MapAutoApi.MAP_STYLE_DAY_VR){ + btn_pos.setImageResource(R.mipmap.icon_location_day) + }else{ + btn_pos.setImageResource(R.mipmap.icon_location_night) + } + isClickable = false + btn_pos.setOnClickListener(this) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnLogo.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnLogo.java new file mode 100644 index 0000000000..656bda192c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnLogo.java @@ -0,0 +1,64 @@ +package com.zhidaoauto.map.sdk.inner.panel; + +import android.content.Context; +import android.view.Gravity; +import android.view.Menu; + +import com.zhidaoauto.map.sdk.R; + + +public class PanelBtnLogo extends Panel { + public PanelBtnLogo(Context context) { + super(context); + + setContentView(R.layout.panel_btn_logo, new LayoutParams( + LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); + setPos(0, 30, 100, 0); + setMyGravity(Gravity.LEFT | Gravity.BOTTOM); + + this.setFocusableInTouchMode(false); + this.setFocusable(false); + this.setClickable(false); + } + + + @Override + protected void onShowPanel() { + + } + + @Override + protected boolean onHidPanel() { + return true; + } + + @Override + protected void onPausePanel() { + + + } + + @Override + protected void onResumePanel() { + + + } + + @Override + protected void reset() { + + + } + + @Override + protected void setPos(Integer top, Integer bottom, Integer left, + Integer right) { + setMargin(top, bottom, left, right); + } + + @Override + protected boolean onPrepareOptionsMenu(Menu menu) { + + return false; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnRightTop.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnRightTop.java new file mode 100644 index 0000000000..41e5e234e2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnRightTop.java @@ -0,0 +1,123 @@ +package com.zhidaoauto.map.sdk.inner.panel; + +import android.app.Activity; +import android.app.Dialog; +import android.content.Context; +import android.os.Handler; +import android.os.Message; +import android.view.Gravity; +import android.view.Menu; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.FrameLayout; +import android.widget.LinearLayout; +import android.widget.TextView; + +import com.zhidaoauto.map.sdk.R; + +public class PanelBtnRightTop extends Panel implements OnClickListener { + + private FrameLayout mBtnGPS; + private TextView mTvGpsNun; + private SatelliteSkyView mSkyView; + private Dialog mDialogGPS; + +// private Button mBtnScale; + + private static final int MSG_RESET = 0; + + private long[] mHits; + + private Handler mResetHandler = new Handler() { + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_RESET: + mTvGpsNun.setText(String.valueOf(mSkyView.getGPSSatellites())); + break; + } + } + }; + + public PanelBtnRightTop(Context context) { + super(context); + this.setClickable(false); + setContentView(R.layout.layout_panel_btn_top_right, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); + setGravity(Gravity.RIGHT | Gravity.TOP); + setPadding(0, 10, 10, 0); + + mBtnGPS = (FrameLayout) findVievById(R.id.panel_btn_gps); + mBtnGPS.setOnClickListener(this); + + mTvGpsNun = (TextView) findVievById(R.id.panel_text_gps); + + mSkyView = new SatelliteSkyView(context); + mSkyView.Resume(); + mDialogGPS = new Dialog(mContext, R.style.Dialog_Fullscreen); + mDialogGPS.setOwnerActivity((Activity) mContext); + LinearLayout layout = new LinearLayout(mContext); + layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); + layout.addView(mSkyView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); + mDialogGPS.addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); + + mHits = new long[3]; + } + + @Override + public void onClick(View v) { + if (v.getId() == R.id.panel_btn_gps) { + mDialogGPS.show(); +// case R.id.panel_btn_scale: +// System.arraycopy(mHits, 1, mHits, 0, mHits.length-1); +// mHits[mHits.length-1] = SystemClock.uptimeMillis(); +// if (mHits[0] >= (SystemClock.uptimeMillis()-500)) { +// Toast.makeText(mContext, "guidanceView", Toast.LENGTH_SHORT).show(); +// mApplication.getMapAct().getPanelManager().setPanel(PanelManager.PANEL_WHAT_SET_MODE, PanelManager.PANEL_MODE_GUIDANCE); +// } +// break; + } + + } + + + @Override + protected void onShowPanel() { + + + } + + @Override + protected boolean onHidPanel() { + + return true; + } + + @Override + protected void onPausePanel() { + + + } + + @Override + protected void onResumePanel() { + + + } + + @Override + protected void reset() { + mResetHandler.sendEmptyMessage(MSG_RESET); + } + + @Override + protected void setPos(Integer top, Integer bottom, Integer left, + Integer right) { + setMargin(top, bottom, left, right); + } + + @Override + protected boolean onPrepareOptionsMenu(Menu menu) { + + return false; + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnScale.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnScale.java new file mode 100644 index 0000000000..b82e4d6338 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnScale.java @@ -0,0 +1,192 @@ +package com.zhidaoauto.map.sdk.inner.panel; + +import android.content.Context; +import android.content.res.Resources; +import android.os.Handler; +import android.os.Message; +import android.view.Gravity; +import android.view.Menu; +import android.widget.RelativeLayout; +import android.widget.TextView; +import android.widget.Toast; + +import com.zhidaoauto.map.sdk.R; +import com.zhidaoauto.map.sdk.inner.abs.IMapController; +import com.zhidaoauto.map.sdk.inner.map.MapController; +import com.zhidaoauto.map.sdk.open.abs.MapStatusListener; + + +public class PanelBtnScale extends Panel implements MapStatusListener { + + private static final int MSG_SETSCALE = 1; + int baseLenght; + /** + * 比例尺 + */ + TextView tv_scale, tv_scale_bg; + protected Handler mHandler = new Handler() { + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_SETSCALE: + if (msg.arg1 < mapscale.length) { + tv_scale.setText(mapscale[msg.arg1]); + if (msg.arg2 > 0) { + RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) tv_scale + .getLayoutParams(); + if (params != null) { + params.width = msg.arg2; + tv_scale_bg.setLayoutParams(params); + } + } + } else { + Toast.makeText(mContext, "传入的地图级别错误", Toast.LENGTH_SHORT) + .show(); + } + break; + } + } + }; + + /** + * 地图级别文字 + */ + String[] mapscale; + Resources res; + float[] mapdist; + + public PanelBtnScale(Context context,IMapController mapController) { + super(context,mapController); + + setContentView(R.layout.panel_btn_scale, new LayoutParams( + LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); + setPos(0, 75, 100, 0); + setMyGravity(Gravity.LEFT | Gravity.BOTTOM); + + tv_scale = (TextView) findVievById(R.id.tv_scale); + tv_scale_bg = (TextView) findVievById(R.id.tv_scale_bg); + res = context.getResources(); + mapscale = res.getStringArray(R.array.mapscale); + baseLenght = (int) res.getDimensionPixelSize(R.dimen.scale); + if (res.getDisplayMetrics().widthPixels < 1000) { + baseLenght = 5; + } + String[] distStr = res.getStringArray(R.array.mapdist); + mapdist = new float[distStr.length]; + for (int i = 0; i < distStr.length; i++) { + mapdist[i] = Float.parseFloat(distStr[i]); + } + + tv_scale.setClickable(false); + this.setFocusableInTouchMode(false); + this.setFocusable(false); + this.setClickable(false); + + if(mMapController.getEventController() != null){ + mMapController.getEventController().addMapStatusListener(this, MapController.LISTENER_TYPE_ZOOM); + } + mMapController.dispatchZoomChanged(); + } + + + /** + * 设置地图级别 + * + * @param level 地图级别 + * @param scaleLength 比例尺的长度 scaleLength<=0表示使用默认参数 此处传入dp即可,代码里已做转换 + */ + public void setMapScale(int level, int scaleLength) { + mHandler.removeMessages(MSG_SETSCALE);// 取消不必要的放大缩小 + Message msg = new Message(); + msg.what = MSG_SETSCALE; + msg.arg1 = level; + // msg.arg2 = DensityChangeUtil.dip2px(mContext,(float)scaleLength); + msg.arg2 = scaleLength; + mHandler.sendMessageDelayed(msg, 300); + } + + @Override + protected void onShowPanel() { + + } + + @Override + protected boolean onHidPanel() { + return true; + } + + @Override + protected void onPausePanel() { + + + } + + @Override + protected void onResumePanel() { + + + } + + @Override + protected void reset() { + + + } + + @Override + protected void setPos(Integer top, Integer bottom, Integer left, + Integer right) { + setMargin(top, bottom, left, right); + } + + @Override + protected boolean onPrepareOptionsMenu(Menu menu) { + + return false; + } + + @Override + public void onMapStatusChanged(int type, int value) { + if(mMapController ==null){ + return; + } + float dist = mMapController.getRulerInfo(); + + //南北极 + if (0.5f >= dist) { + dist = 50000.0f; + } + + int index = mapdist.length - 1; + for (int i = 0; i < mapdist.length; i++) { + if (dist <= mapdist[i]) { + index = i; + break; + } + } + if (index > mapscale.length - 1) { + index = mapscale.length - 1; + } + String ltext = mapscale[index]; + float scale = 0; + if (ltext.endsWith("km")) { + scale = Float.parseFloat(ltext.substring(0, ltext.length() - 2)) * 1000; + } else if (ltext.endsWith("m")) { + scale = Float.parseFloat(ltext.substring(0, ltext.length() - 1)); + } + int scaleLength = (int) (100 * scale / dist); + setMapScale(index, baseLenght + scaleLength); +// setMapScale(index, scaleLength); + } + + @Override + protected void onDetachedFromWindow() { + mHandler.removeCallbacksAndMessages(null); + if(mMapController ==null){ + return; + } + if(mMapController.getEventController() != null) { + mMapController.getEventController().removeMapStatusListener(this, MapController.LISTENER_TYPE_ZOOM); + } + super.onDetachedFromWindow(); + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnZoom.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnZoom.java new file mode 100644 index 0000000000..b32db5684c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelBtnZoom.java @@ -0,0 +1,157 @@ +package com.zhidaoauto.map.sdk.inner.panel; + +import android.content.Context; +import android.os.Handler; +import android.os.Message; +import android.view.Gravity; +import android.view.Menu; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.Toast; + +import com.zhidaoauto.map.sdk.R; +import com.zhidaoauto.map.sdk.inner.abs.IMapController; + + +public class PanelBtnZoom extends Panel implements OnClickListener { + + private Button mBtnZoomOut, mBtnZoomIn, mBtnZoomCountry, + mBtnZoomProvincial, mBtnZoomCity, mBtnZoomRoad; + private LinearLayout mLayoutZoom, mLayoutZoomValue; + private boolean isLayoutZoomValueShow = false; + private static final int MSG_HID = 0; + + protected Handler mHandler = new Handler() { + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_HID: + mLayoutZoomValue.setVisibility(View.GONE); + isLayoutZoomValueShow = false; + break; + } + } + }; + + + public PanelBtnZoom(Context context,IMapController mMapController) { + super(context,mMapController); + + setContentView(R.layout.panel_btn_zoom_ctrl, new LayoutParams( + LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); + setMyGravity(Gravity.RIGHT | Gravity.CENTER); + setPos(0, 0, 0, 10); + mBtnZoomOut = (Button) findVievById(R.id.btn_zoom_out); + mBtnZoomOut.setOnClickListener(this); + mBtnZoomIn = (Button) findVievById(R.id.btn_zoom_in); + mBtnZoomIn.setOnClickListener(this); + + mLayoutZoom = (LinearLayout) findVievById(R.id.layout_zoom); + mLayoutZoom.setOnClickListener(this); + mLayoutZoomValue = (LinearLayout) findVievById(R.id.layout_zoom_value); + + mBtnZoomCountry = (Button) findVievById(R.id.btn_zoom_country); + mBtnZoomCountry.setOnClickListener(this); + + mBtnZoomProvincial = (Button) findVievById(R.id.btn_zoom_provincial); + mBtnZoomProvincial.setOnClickListener(this); + + mBtnZoomCity = (Button) findVievById(R.id.btn_zoom_city); + mBtnZoomCity.setOnClickListener(this); + + mBtnZoomRoad = (Button) findVievById(R.id.btn_zoom_road); + mBtnZoomRoad.setOnClickListener(this); + + + this.setFocusableInTouchMode(false); + this.setFocusable(false); + this.setClickable(false); + + } + + @Override + public void onClick(View v) { + mHandler.removeMessages(MSG_HID); + int id = v.getId(); + if (id == R.id.btn_zoom_out) { + mMapController.zoomOut(); + + } else if (id == R.id.btn_zoom_in) { + mMapController.zoomIn(); + } else if (id == R.id.layout_zoom) { + if (isLayoutZoomValueShow) { + mLayoutZoomValue.setVisibility(View.GONE); + isLayoutZoomValueShow = false; + } else { + mLayoutZoomValue.setVisibility(View.VISIBLE); + isLayoutZoomValueShow = true; + } + hidZoomValueLayout(); + } else if (id == R.id.btn_zoom_country) { + Toast.makeText(mContext, "国家", Toast.LENGTH_SHORT).show(); + hidZoomValueLayout(); + mMapController.setZoom(8); + } else if (id == R.id.btn_zoom_provincial) { + Toast.makeText(mContext, "省际", Toast.LENGTH_SHORT).show(); + hidZoomValueLayout(); + mMapController.setZoom(8); + } else if (id == R.id.btn_zoom_city) { + Toast.makeText(mContext, "城市", Toast.LENGTH_SHORT).show(); + hidZoomValueLayout(); + mMapController.setZoom(16); + } else if (id == R.id.btn_zoom_road) { + Toast.makeText(mContext, "街道", Toast.LENGTH_SHORT).show(); + hidZoomValueLayout(); + mMapController.setZoom(19); + } + + } + + @Override + protected void onShowPanel() { + + + } + + @Override + protected boolean onHidPanel() { + + return true; + } + + @Override + protected void onPausePanel() { + + + } + + @Override + protected void onResumePanel() { + + + } + + @Override + protected void reset() { + + + } + + @Override + protected void setPos(Integer top, Integer bottom, Integer left, + Integer right) { + setMargin(top, bottom, left, right); + } + + @Override + protected boolean onPrepareOptionsMenu(Menu menu) { + + return false; + } + + private void hidZoomValueLayout() { + mHandler.removeMessages(MSG_HID); + mHandler.sendEmptyMessageDelayed(MSG_HID, 3000); + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelConstructor.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelConstructor.java new file mode 100644 index 0000000000..b53e7d2b78 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelConstructor.java @@ -0,0 +1,26 @@ +package com.zhidaoauto.map.sdk.inner.panel; + +import android.content.Context; + +import com.zhidaoauto.map.sdk.inner.abs.IMapController; + +import java.lang.reflect.Constructor; + +public class PanelConstructor { + protected static Panel construct(String className, Context context, IMapController mapController){ + try { + Class clazz = Class.forName(className); //创建一个Class对象,用于描述Person类 + + /** + * 调用有参的构造方法 + */ + Class[] argTypes = {Context.class}; //指明所要调用的构造方法的形参 + Constructor constructor = clazz.getConstructor(argTypes);//获取指定参数的构造方法 + Panel panel = (Panel) constructor.newInstance(context,mapController); + return panel; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelDirction.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelDirction.java new file mode 100644 index 0000000000..1b990c5557 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelDirction.java @@ -0,0 +1,78 @@ +package com.zhidaoauto.map.sdk.inner.panel; + +import android.content.Context; +import android.view.Gravity; +import android.view.Menu; +import android.view.View; + +import com.zhidaoauto.map.sdk.inner.abs.IMapController; + +public class PanelDirction extends Panel{ + private DirectionLayer directionLayer; + + public PanelDirction(Context context) { + super(context); + setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); + setGravity(Gravity.LEFT | Gravity.TOP); + setPadding(10, 10, 0, 0); + directionLayer = new DirectionLayer(mContext); + this.addView(directionLayer); + } + + public PanelDirction(Context context, IMapController mapController) { + super(context,mapController); + setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); + setGravity(Gravity.LEFT | Gravity.TOP); + setPadding(10, 10, 0, 0); + directionLayer = new DirectionLayer(mContext); + this.addView(directionLayer); + } + + @Override + protected void onShowPanel() { + if( View.VISIBLE == getVisibility()) { + return; + } + setVisibility(View.VISIBLE); + } + + @Override + protected boolean onHidPanel() { + if( View.VISIBLE == getVisibility()) + { + setVisibility(View.INVISIBLE); + } + return false; + } + + @Override + protected void onPausePanel() { + + + } + + @Override + protected void onResumePanel() { + + + } + + @Override + protected void reset() { + + + } + + @Override + protected void setPos(Integer top, Integer bottom, Integer left, + Integer right) { + setMargin(top, bottom, left, right); + } + + @Override + protected boolean onPrepareOptionsMenu(Menu menu) { + + return false; + } + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelGuidance.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelGuidance.kt new file mode 100644 index 0000000000..03674e0f57 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelGuidance.kt @@ -0,0 +1,579 @@ +//package com.zhidaoauto.map.sdk.inner.panel +// +//import android.content.Context +//import android.graphics.* +//import android.graphics.drawable.BitmapDrawable +//import android.graphics.drawable.Drawable +//import android.util.Log +//import android.view.Gravity +//import android.view.KeyEvent +//import android.view.Menu +//import android.view.View +//import android.widget.LinearLayout +//import android.widget.Toast +//import com.autonavi.nge.guidance.LaneMarkTools +//import com.autonavi.nge.guidance.NaviDirRes +//import com.autonavi.nge.guidance.NaviInfo +//import com.zhidaoauto.map.sdk.R +//import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG +//import com.zhidaoauto.map.sdk.inner.controller.CommonController +//import com.zhidaoauto.map.sdk.inner.element.MapCoordinate +//import com.zhidaoauto.map.sdk.inner.utils.CommonUtils +//import com.zhidaoauto.map.sdk.inner.utils.Constant.getDisString +//import com.zhidaoauto.map.sdk.inner.utils.Constant.getRoadIsHighRoad +//import com.zhidaoauto.map.sdk.inner.utils.Constant.getTimeString +//import com.zhidaoauto.map.sdk.inner.utils.PubFunction +//import kotlinx.android.synthetic.main.layout_panel_guidance.view.* +// +//class PanelGuidance(context: Context?) : +// Panel(context), View.OnClickListener { +//// private val mBtnRouteShowMode: Button +// private var isShowAllRoute = false +//// private val iv_guidance_next_road: ImageView +//// private val iv_guidance_line: ImageView +//// private val iv_next_guidance_icon: ImageView +//// private val tv_guidance_over_time: TextView +//// private val tv_guidance_over_mileage: TextView +//// private val iv_guidance_over_mileage: ImageView +//// private val tv_guidance_next_road: TextView +//// private val iv_guidance_next_road_over_mileage //当前路口距离 +//// : TextView +//// private val iv_guidance_next_turn_over_mileage //下一路口距离 +//// : TextView +//// private val iv_3d_route_BG //看版图背景 +//// : ImageView +//// private val iv_3d_route_Arrow //看版图箭头 +//// : ImageView +// +// private var m_BGBitmap: Bitmap? = null +// private var m_ArrowBitmap: Bitmap? = null +// private var m_SGPBGBitmap: Bitmap? = null +// private var m_SGPArrowBitmap: Bitmap? = null +// private var m_BGID = 0 +// private var m_ArrowID = 0 +// private var m_SGPBGID = 0 +// private var m_SGPArrowID = 0 +// private var mSimNaviSpeed = 1 +// +// var layout: LinearLayout +// var mLayoutParams_next_road: LinearLayout.LayoutParams +//// var mLayoutParams_progress: LinearLayout.LayoutParams +// private var isProgressShow = false +// private var mMatrix = Matrix() +// var m_LaneTools: LaneMarkTools? = null +// var mWidth: Int = 0 +// var mHeight: Int = 0 +// var progress = 0 +// override fun onShowPanel() { +// if (DEBUG) { +// Log.i(TAG, "navop-onShowPanel:") +// } +// mWidth = this.resources.displayMetrics.widthPixels +// +// CommonController.instance.panelManager?.setPanelPos( +// PanelManager.PANEL_MODE_MAP, +// 0, +// 0, +// 0, +// 0 +// ) +// if (CommonController.instance.naviController!!.isSimNavi()) { +// mSimNaviSpeed = 4 +// } +// if (DEBUG) { +// Log.i(TAG, "navop-PanelGuidance: onShowPanel") +// } +// } +// +// override fun onHidPanel(): Boolean { +// CommonController.instance.panelManager?.setPanelPos(PanelManager.PANEL_MODE_MAP, 0, 0, 0, 0) +// if (DEBUG) { +// Log.i(TAG, "navop-PanelGuidance: onHidPanel") +// } +// return true +// } +// +// override fun onPausePanel() {} +// override fun onResumePanel() {} +// override fun reset() { +// if (DEBUG) { +// Log.i( +// TAG, +// "navop-PanelGuidance: reset" +// ) +// } +// var naviinfo: NaviInfo? = null +// try { +// naviinfo = CommonController.instance.iNavigationCore?.Guidance_NaviInfo() +// if (naviinfo == null) { +// return +// } +// // 当前中心点 +// val center = +// CommonController.instance +// .mapController +// ?.getCenter() +// // 目的地 +// val dest = +// CommonController.instance +// .naviController +// ?.getEndPoi() +// // 绑定点 +// val bind = +// MapCoordinate( +// (naviinfo.m_nBindLon * 3.6).toInt(), +// (naviinfo.m_nBindLat * 3.6).toInt() +// ) +// val angle_centerToEnd = +// PubFunction.GetLineAngle( +// center, +// dest +// ).toFloat() +// val angle_mapView = +// CommonController.instance +// .mapController +// ?.getMapViewRotation() ?: 0f +// val angle_bindToEnd = PubFunction +// .GetLineAngle(bind, dest).toFloat() +// var bitmap1 = (resources.getDrawable( +// R.mipmap.ui_navigate +// ) as BitmapDrawable).bitmap +// // 设 +// mMatrix.setRotate(angle_centerToEnd + angle_mapView) +// // 重新绘制Bitmap +// bitmap1 = Bitmap.createBitmap( +// bitmap1, 0, 0, bitmap1.width, +// bitmap1.height, mMatrix, true +// ) +// iv_guidance_over_mileage.setImageBitmap(bitmap1) +// val carPos = MapCoordinate() +// val type = CommonController.instance.mapController?.getCarPosition(carPos) ?: 0 +// if (type > 0) { +// val x = carPos.x +// val y = carPos.y +// var angle = 0 +// when (type) { +// 1 -> angle = 270 +// 2 -> angle = 0 +// 3 -> angle = 90 +// 4 -> angle = 180 +// } +// var bitmap2 = (resources.getDrawable( +// R.mipmap.arrow +// ) as BitmapDrawable).bitmap // 设 +// val matrix = Matrix() +// matrix.setRotate(angle.toFloat()) +// bitmap2 = Bitmap.createBitmap( +// bitmap2, 0, 0, +// bitmap2.width, bitmap2.height, matrix, true +// ) +// iv_guidance_bind_car_arrow.setImageBitmap(bitmap2) +// iv_guidance_bind_car_arrow.setPadding(x, y, 0, 0) +// iv_guidance_bind_car_arrow.visibility = View.VISIBLE +// } else { +// iv_guidance_bind_car_arrow.visibility = View.INVISIBLE +// } +// guidance_tv_speed.text = naviinfo.m_nSpeed.toString() + "km/h" +// if (naviinfo.m_EntranceDist == 0 && naviinfo.m_ServerDist == 0 && naviinfo.m_ExitDist == 0 +// ) { +// guidance_layout_server_enter.visibility = View.GONE +// } +// if (naviinfo.m_EntranceDist > 0) { +// guidance_enter_image.visibility = View.VISIBLE +// tv_guidance_enter_dis.text = ("" +// + getDisString(naviinfo.m_EntranceDist)) +// iv_guidance_enter_icon.text = "入口" +// iv_guidance_enter_icon +// .setBackgroundDrawable( +// getPanelImage( +// Color.argb( +// 255, 0, +// 51, 255 +// ) +// ) +// ) +// } else { +// guidance_enter_image.visibility = View.GONE +// } +// if (naviinfo.m_ExitDist > 0) { +// guidance_exit_image.visibility = View.VISIBLE +// tv_guidance_exit_dis.text = ("" +// + getDisString(naviinfo.m_ExitDist)) +// iv_guidance_exit_icon.text = "出口" +// iv_guidance_exit_icon.setBackgroundDrawable( +// getPanelImage( +// Color +// .argb(255, 0, 51, 255) +// ) +// ) +// } else { +// guidance_exit_image.visibility = View.GONE +// } +// if (naviinfo.m_ServerDist > 0) { +// guidance_server_image.visibility = View.VISIBLE +// tv_guidance_server_dis.text = ("" +// + getDisString(naviinfo.m_ServerDist)) +// iv_guidance_server_icon.text = "服务区" +// iv_guidance_server_icon +// .setBackgroundDrawable( +// getPanelImage( +// Color.argb( +// 255, +// 36, 36, 219 +// ) +// ) +// ) +// } else { +// guidance_server_image.visibility = View.GONE +// } +// tv_guidance_over_mileage.text = getDisString(naviinfo.m_nDistanceToDest) +// tv_guidance_over_time.text = getTimeString(naviinfo.m_nTimeToDest) +// tv_next_road.text = naviinfo.m_pStrNextName +// tv_guidance_next_road.text = naviinfo.m_pStrNextName +// iv_guidance_next_road.setImageResource(NaviDirRes.getNaviResID(naviinfo.m_nTurnID)) +// iv_guidance_next_road_over_mileage.text = getDisString(naviinfo.m_nDistanceToTurn) +// if(naviinfo.m_nNextTurn == 1) { +// lin_next_turn.visibility = VISIBLE +// iv_guidance_next_turn.setImageResource(NaviDirRes.getNextNaviResID(naviinfo.m_nNextTurnID)) +// iv_guidance_next_road_trun_mileage.text = getDisString(naviinfo.m_nDistanceToNextTurn) +// }else{ +// lin_next_turn.visibility = GONE +// } +//// tv_guidance_progress.text = "" + naviinfo.m_nDistanceToTurn +// val name = getRoadIsHighRoad(naviinfo.m_pStrNextName) +// if (name != null) { +// tv_guidance_next_road_two_name.visibility = View.VISIBLE +// tv_guidance_next_road_two_name.text = name +// tv_guidance_next_road_two_name.setBackgroundDrawable( +// getPanelImage( +// Color +// .argb(255, 8, 72, 152) +// ) +// ) +// } else { +// tv_guidance_next_road_two_name.visibility = View.GONE +// } +// if (naviinfo.m_IsExport.toInt() == 1) { +// tv_guidance_next_export.visibility = View.VISIBLE +// tv_guidance_next_export.text = "出" +// tv_guidance_next_export.setBackgroundDrawable( +// getPanelImage( +// Color.argb( +// 255, 204, 204, 33 +// ) +// ) +// ) +// } else { +// tv_guidance_next_export.visibility = View.GONE +// } +// if (naviinfo.m_nImageType.toInt() == 1 && naviinfo.m_nImageBg > 0 && naviinfo.m_nImageArrow > 0 +// ) { +// iv_guidance_3d_route_bg.visibility = View.VISIBLE +// iv_guidance_3d_route_arrow.visibility = View.VISIBLE +// iv_guidance_next_road.visibility = View.VISIBLE +// guidance_progressBar.visibility = VISIBLE +// if(progress == 0) { +// guidance_progressBar.setMax(naviinfo.m_nDistanceToTurn) +// } +// guidance_progressBar.setProgress(naviinfo.m_nDistanceToTurn) +// progress = naviinfo.m_nDistanceToTurn +// if (m_BGID != naviinfo.m_nImageBg +// || m_ArrowID != naviinfo.m_nImageArrow +// ) { +// val routeimage = CommonController.instance.iNavigationCore?.Guidance_Image( +// naviinfo.m_nImageUr, +// naviinfo.m_nImageBg, +// naviinfo.m_nImageArrow, 0 +// ) +// if (m_BGBitmap != null) { +// m_BGBitmap!!.recycle() +// } +// m_BGBitmap = null +// if (m_ArrowBitmap != null) { +// m_ArrowBitmap!!.recycle() +// } +// m_ArrowBitmap = null +// +// // 记录下载历史的展现的图片 +// m_BGBitmap = BitmapFactory.decodeByteArray( +// routeimage?.imageBg, 0, routeimage?.imageBg?.size ?: 0 +// ) +// m_ArrowBitmap = BitmapFactory.decodeByteArray( +// routeimage?.imageArrow, 0, +// routeimage?.imageArrow?.size ?: 0 +// ) +// // 记录历史现实的图片,如果相同,在新的展现路口上 不在重新获取。 +// m_BGID = naviinfo.m_nImageBg +// m_ArrowID = naviinfo.m_nImageArrow +// } +// if (m_BGBitmap != null) { +// // iv_guidance_3d_route_bg.setImageBitmap(m_BGBitmap) +// } +// if (m_ArrowBitmap != null) { +// //iv_guidance_3d_route_arrow.setImageBitmap(m_ArrowBitmap) +// } +// +// val img = CommonUtils.combineBitmap(m_BGBitmap, m_ArrowBitmap!!) +// iv_guidance_3d_route_bg.setImageBitmap(img) +// } else { +// iv_guidance_3d_route_bg.visibility = View.GONE +// iv_guidance_3d_route_arrow.visibility = View.GONE +// guidance_progressBar.visibility = GONE +// guidance_progressBar.setProgress(100) +// guidance_progressBar.setMax(100) +// iv_guidance_next_road.visibility = View.VISIBLE +// progress = 0 +// } +// if (naviinfo.m_nSGPImageType.toInt() == 1 && naviinfo.m_nSGPImageBg > 0 && naviinfo.m_nSGPImageArrow > 0 +// ) { +// iv_guidance_board_bg.visibility = View.VISIBLE +// iv_guidance_board_arrow.visibility = View.VISIBLE +// if (m_SGPBGID != naviinfo.m_nSGPImageBg +// || m_SGPArrowID != naviinfo.m_nSGPImageArrow +// ) { +// val routeimage = +// CommonController.instance.iNavigationCore?.Guidance_Image( +// naviinfo.m_nSGPImageUr, +// naviinfo.m_nSGPImageBg, +// naviinfo.m_nSGPImageArrow, 1 +// ) +// if (m_SGPBGBitmap != null) { +// m_SGPBGBitmap!!.recycle() +// } +// m_SGPBGBitmap = null +// if (m_SGPArrowBitmap != null) { +// m_SGPArrowBitmap!!.recycle() +// } +// m_SGPArrowBitmap = null +// +// // 记录下载历史的展现的图片 +// m_SGPBGBitmap = BitmapFactory.decodeByteArray( +// routeimage?.imageBg, 0, routeimage?.imageBg?.size ?: 0 +// ) +// m_SGPArrowBitmap = BitmapFactory.decodeByteArray( +// routeimage?.imageArrow, 0, +// routeimage?.imageArrow?.size ?: 0 +// ) +// // 记录历史现实的图片,如果相同,在新的展现路口上 不在重新获取。 +// m_SGPBGID = naviinfo.m_nSGPImageBg +// m_SGPArrowID = naviinfo.m_nSGPImageArrow +// } +// if (m_SGPBGBitmap != null) { +// iv_guidance_board_bg.setImageBitmap(m_SGPBGBitmap) +// } +// if (m_SGPArrowBitmap != null) { +// iv_guidance_board_arrow.setImageBitmap(m_SGPArrowBitmap) +// } +// } else { +// iv_guidance_board_bg.visibility = View.GONE +// iv_guidance_board_arrow.visibility = View.GONE +// } +// if (naviinfo.m_LaneType.toInt() == 1) { +// val lan = CommonController.instance.iNavigationCore?.Guidance_LaneMask() +// val bitmap = m_LaneTools!!.getComposeLaneInfo(lan) +// iv_guidance_lane_bg.visibility = View.GONE +// iv_guidance_lane_arrow.visibility = View.VISIBLE +// if (bitmap != null) { +// iv_guidance_lane_arrow.setImageBitmap(bitmap) +// } +// } +// } catch (e: Exception) { +// Log.e( +// TAG, +// e.message +// ) +// e.printStackTrace() +// } +// if (DEBUG) { +// Log.i( +// TAG, +// "navop-PanelGuidance: reset-end" +// ) +// } +// } +// +// override fun setPos( +// top: Int, bottom: Int, left: Int, +// right: Int +// ) { +// } +// +// override fun onPrepareOptionsMenu(menu: Menu): Boolean { +// return false +// } +// +// public override fun dispatchPanelKeyEvent(event: KeyEvent): Boolean { +// if (this.visibility == View.VISIBLE +// && event.keyCode == KeyEvent.KEYCODE_BACK +// && event.action == KeyEvent.ACTION_UP +// ) { +// Toast.makeText( +// CommonController.instance.mapView?.getmContext(), "退出导航", Toast.LENGTH_LONG +// ).show() +// CommonController.instance.naviController?.stopNavi() +// return true +// } +// return super.dispatchPanelKeyEvent(event) +// } +// +// private fun showProgressView() { +// isProgressShow = true +// guidance_progressBar.visibility = View.VISIBLE +//// tv_guidance_progress.visibility = View.VISIBLE +// guidance_layout_next_road_name.visibility = View.GONE +//// layout_guidance_next_road.visibility = View.GONE +//// iv_guidance_line.visibility = View.GONE +// tv_next_road.visibility = View.GONE +// mLayoutParams_next_road.rightMargin = 40 +// iv_guidance_next_road.layoutParams = mLayoutParams_next_road +// } +// +// private fun hidProgressView() { +// isProgressShow = false +// guidance_progressBar.visibility = View.GONE +//// tv_guidance_progress.visibility = View.GONE +// //guidance_layout_next_road_name.visibility = View.VISIBLE +// //layout_guidance_next_road.visibility = View.VISIBLE +//// iv_guidance_line.visibility = View.VISIBLE +// tv_next_road.visibility = View.VISIBLE +// mLayoutParams_next_road.rightMargin = 0 +// mLayoutParams_next_road.gravity = Gravity.CENTER +// iv_guidance_next_road.layoutParams = mLayoutParams_next_road +// } +// +// fun getPanelImage(colorID: Int): Drawable { +// val typemask = 0x88 +// val m_iLanePanelBorderMargin = 40 +// val m_iLanePanelBorderRadian = 40 +// val bitmap = +// Bitmap.createBitmap(40, 40, Bitmap.Config.ARGB_8888) +// val paint = Paint() +// paint.setARGB(0, 0, 0, 0) +// val canvas = Canvas(bitmap) +// canvas.drawPaint(paint) +// paint.color = colorID +// paint.style = Paint.Style.FILL +// paint.isAntiAlias = true +// val rect1 = RectF() +// rect1[0f, 0f, 40f] = 40f +// canvas.drawRoundRect(rect1, 5f, 5f, paint) +// paint.color = Color.WHITE +// paint.strokeWidth = 2f +// paint.style = Paint.Style.STROKE +// paint.isAntiAlias = true +// val rect = RectF() +// rect[3f, 3f, 37f] = 37f +// canvas.drawRoundRect(rect, 5f, 5f, paint) +// return BitmapDrawable( +// mContext.resources, +// bitmap +// ) +// } +// +// override fun onClick(v: View) { +// if (v.id == R.id.iv_guidance_next_road) { +// if (isProgressShow) { +// hidProgressView() +// } else { +// showProgressView() +// } +// } else if (v.id == R.id.sim_navi_start) { +// if (CommonController.instance +// .naviController!!.isSimNaviPaused() +// ) { +// sim_navi_start?.setImageResource(R.mipmap.icon_pause_night) +// } else { +// Toast.makeText(mContext, "暂停", Toast.LENGTH_SHORT) +// .show() +// sim_navi_start?.setImageResource(R.mipmap.icon_play_night) +// } +// val isSimNaviPaused = CommonController.instance.naviController!!.isSimNaviPaused() +// CommonController.instance.naviController?.setSimNaviPaused(!isSimNaviPaused) +// } else if (v.id == R.id.guidance_btn_show_route_mode) { +// isShowAllRoute = !isShowAllRoute +// CommonController.instance.mapController?.setShowAllRouteLine(isShowAllRoute) +// if (isShowAllRoute) { +// guidance_btn_show_route_mode.text = "返回" +// } else { +// guidance_btn_show_route_mode.text = "全貌" +// } +//// CommonController.instance.naviAutoView?.mNaviViewListener?.onScanViewButtonClick() +// } else if (v.id == R.id.guidance_tv_speed) { +//// Log.d("ouou", "点击速度"+sim_navi_control.getVisibility()); +// if (CommonController.instance.naviController!!.isSimNavi() +// ) { +// mSimNaviSpeed *= 2 +// if (mSimNaviSpeed > 8) +// mSimNaviSpeed = 1 +// +// CommonController.instance.naviController?.setSimNaviSpeed(mSimNaviSpeed * 20) +// } +// } +// } +// +// companion object { +// private const val TAG = "PanelGuidance" +// } +// +// init { +// if (DEBUG) { +// Log.i( +// TAG, +// "navop-PanelGuidance: start" +// ) +// } +// setContentView( +// R.layout.layout_panel_guidance, +// LayoutParams( +// LayoutParams.MATCH_PARENT, +// LayoutParams.MATCH_PARENT +// ) +// ) +// isClickable = false +// mLayoutParams_next_road = LinearLayout.LayoutParams( +// LayoutParams.WRAP_CONTENT, +// LayoutParams.WRAP_CONTENT +// ) +// mLayoutParams_next_road.rightMargin = 0 +// mLayoutParams_next_road.gravity = Gravity.CENTER +// +// iv_guidance_next_road.layoutParams = mLayoutParams_next_road +//// iv_guidance_next_road.setOnClickListener(this) +// +//// +// +//// mLayoutParams_progress = LinearLayout.LayoutParams( +//// LayoutParams.WRAP_CONTENT, +//// LayoutParams.WRAP_CONTENT +//// ) +//// mLayoutParams_progress.width = (this.resources +//// .getDrawable(R.mipmap.navi_s_1).intrinsicHeight + this +//// .resources.displayMetrics.density * 10).toInt() +//// mLayoutParams_progress.gravity = Gravity.CENTER +//// mLayoutParams_progress.leftMargin = (mLayoutParams_progress.width / 2 + this +//// .resources.displayMetrics.density * 20).toInt() +//// mProgressBar.layoutParams = mLayoutParams_progress +//// +// +// guidance_tv_speed.setOnClickListener(this) +//// +// layout = +// findVievById(R.id.panel_guidance_right) as LinearLayout +// // TODO: 2020/5/12 Matt 设置导航显示 +//// mApplication.getMapAct().setRequestedOrientation( +//// ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); +// // m_LaneTools = new LaneMarkTools(400.0f / +// // this.getResources().getDisplayMetrics().widthPixels); +// m_LaneTools = LaneMarkTools( +// 0.5f, this.resources +// .displayMetrics.widthPixels, this.resources +// .displayMetrics.heightPixels +// ) +// if (CommonController.instance.naviController!!.isSimNavi()) { +// +// guidance_btn_show_route_mode.setOnClickListener(this) +// sim_navi_start.setOnClickListener(this) +// hidProgressView() +// } +// } +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelManager.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelManager.java new file mode 100644 index 0000000000..aecb06f622 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelManager.java @@ -0,0 +1,409 @@ +package com.zhidaoauto.map.sdk.inner.panel; + +import android.content.Context; +import android.view.KeyEvent; +import android.view.Menu; +import android.view.View; +import android.widget.FrameLayout; + +import com.zhidaoauto.map.sdk.inner.abs.IMapController; + +import java.util.ArrayList; +import java.util.List; + +public class PanelManager { + + private static final int PANEL_WHAT_BASE = 1000; + public static final int PANEL_WHAT_SET_MODE = PANEL_WHAT_BASE + 1; + public static final int PANEL_WHAT_SHOW = PANEL_WHAT_BASE + 2; + public static final int PANEL_WHAT_HID = PANEL_WHAT_BASE + 3; + public static final int PANEL_WHAT_RESET = PANEL_WHAT_BASE + 4; + public static final int PANEL_WHAT_BACK = PANEL_WHAT_BASE + 5; + public static final int PANEL_WHAT_ONPAUSE = PANEL_WHAT_BASE + 6; + public static final int PANEL_WHAT_ONRESUME = PANEL_WHAT_BASE + 7; + public static final int PANEL_WHAT_INVERSION = PANEL_WHAT_BASE + 8; + + private static final int PANEL_BTN_LEFT = 0x4; + private static final int PANEL_BTN_RIGHT = 0x8; + public static final int PANEL_BTN_ZOOM = 0x10; + public static final int PANEL_BTN_DIRECTION = 0x20; + private static final int PANEL_SEARCH_MENU = 0x40; + private static final int PANEL_RESULTLIST = 0x80; + public static final int PANEL_RIGHT_TOP = 0x100; + private static final int PANEL_TEST_TEXT = 0x200; + private static final int PANEL_ATTITUDE_SHOW = 0x400; + private static final int PANEL_BT_SENSOR = 0x800; + private static final int PANEL_MENU = 0x1000; + private static final int PANEL_GUIDANCE = 0x2000; + private static final int PANEL_MAP = 0x4000; + private static final int PANEL_ROUTING_SELECT = 0x8000; + private static final int PANEL_FRAME_COUNTER = 0x10000; + private static final int PANEL_HIS_LIST = 0x20000; + private static final int PANEL_MENU_COMMON = 0x40000; + private static final int PANEL_ROUTE_SET = 0x80000; + private static final int PANEL_CATEGORY_LIST = 0x100000; + private static final int PANEL_MAC_SHOW = 0x200000; + private static final int PANEL_STATE_SHOW = 0x400000; + private static final int PANEL_RTINFO_SHOW = 0x800000; + public static final int PANEL_BTN_LOCATION = 0x1000000; + public static final int PANEL_BTN_SCALE = 0x2000000; + public static final int PANEL_BTN_LOGO = 0x4000000; + public static final int PANEL_BTN_CAR = 0x8000000; + + public static final int PANEL_POLYGON = 0x40000000; + public static final int PANEL_BTN_CARS = 0x20000000; + + public static final int PANEL_TRAFFIC_SIGN = 0x10000000; + + public static final int PANEL_MODE_NONE = 0; + public static final int PANEL_MODE_RESULTLIST = PANEL_RESULTLIST; + public static final int PANEL_MODE_SDK_MAIN = PANEL_MAP ;//| PANEL_TRAFFIC_SIGN + public static final int PANEL_MODE_VIEW_MAIN = PANEL_BTN_DIRECTION | PANEL_BTN_ZOOM | PANEL_BTN_LOCATION | PANEL_BTN_SCALE | PANEL_BTN_LOGO | PANEL_BTN_CAR | PANEL_POLYGON | PANEL_BTN_CARS; + public static final int PANEL_MODE_MAIN = PANEL_MAP | PANEL_BTN_LEFT | PANEL_BTN_RIGHT | PANEL_BTN_ZOOM | PANEL_RIGHT_TOP | PANEL_BTN_DIRECTION | PANEL_FRAME_COUNTER; + public static final int PANEL_MODE_RIGHT_TOP = PANEL_RIGHT_TOP; + public static final int PANEL_MODE_SEARCH = PANEL_SEARCH_MENU; + public static final int PANEL_MODE_PANEL_BTN_LEFT = PANEL_BTN_LEFT; + public static final int PANEL_MODE_PANEL_TEST_TEXT = PANEL_TEST_TEXT; + public static final int PANEL_MODE_PANEL_ATTITUDE_SHOW = PANEL_ATTITUDE_SHOW; + public static final int PANEL_MODE_PANEL_BT_SENSOR = PANEL_BT_SENSOR; + public static final int PANEL_MODE_MENU = PANEL_MENU; + public static final int PANEL_MODE_GUIDANCE = PANEL_MAP | PANEL_GUIDANCE | PANEL_BTN_DIRECTION; + public static final int PANEL_MODE_MAP = PANEL_MAP; + public static final int PANEL_MODE_ROUTING_SELECT = PANEL_ROUTING_SELECT; + public static final int PANEL_MODE_COUNTER = PANEL_FRAME_COUNTER; + public static final int PANEL_MODE_HIS_LIST = PANEL_HIS_LIST; + public static final int PANEL_MODE_MENU_COMMON = PANEL_MENU_COMMON; + public static final int PANEL_MODE_ROUTE_SET = PANEL_ROUTE_SET; + public static final int PANEL_MODE_CATEGORY_LIST = PANEL_CATEGORY_LIST; + public static final int PANEL_MODE_PANEL_MAC_SHOW = PANEL_MAC_SHOW; + public static final int PANEL_MODE_PANEL_STATE_SHOW = PANEL_STATE_SHOW; + public static final int PANEL_MODE_RTINFO_SHOW = PANEL_RTINFO_SHOW; + public static final int PANEL_MODE_GUIDANCE_SHOW = PANEL_GUIDANCE | PANEL_BTN_DIRECTION; + + + private Context mContext; + private FrameLayout mContainer; + //store all panel's class name, used to construct the class + private String[] classNames; + //store all panels + private Panel[] panels; + //store all modes corresponding to the panel + private int[] mPanelModes; + private int childCountAlreaday = 0; + private List mChildAlreadyList = null; + + private List mHistoryModeSetList = null; + + private int m_iCurModes = 0; + + private IMapController mMapController; + + + public PanelManager(FrameLayout container, Context context, IMapController mapController) { + mContext = context; + mMapController = mapController; + classNames = new String[]{ + "com.zhidaoauto.map.sdk.inner.panel.PanelMap", + "com.zhidaoauto.map.sdk.inner.panel.PanelDirction", + + "com.zhidaoauto.map.sdk.inner.panel.PanelFrameCounter", + "com.zhidaoauto.map.sdk.inner.panel.PanelTestText", + "com.zhidaoauto.map.sdk.inner.panel.PanelBtnLeft", + "com.zhidaoauto.map.sdk.inner.panel.PanelBtnRight", + "com.zhidaoauto.map.sdk.inner.panel.PanelZoom", + "com.zhidaoauto.map.sdk.inner.panel.PanelBtnRightTop", + + "com.zhidaoauto.map.sdk.inner.panel.PanelSelectRoute", + + "com.zhidaoauto.map.sdk.inner.panel.PanelHisList", + "com.zhidaoauto.map.sdk.inner.panel.PanelMenuCommon", + "com.zhidaoauto.map.sdk.inner.panel.PanelRouteSet", + + "com.zhidaoauto.map.sdk.inner.panel.PanelMenu", + "com.zhidaoauto.map.sdk.inner.panel.PanelSearchMenu", + + "com.zhidaoauto.map.sdk.inner.panel.PanelAttitudeShow", + "com.zhidaoauto.map.sdk.inner.panel.PanelBTSensor", + "com.zhidaoauto.map.sdk.inner.panel.PanelGuidance", + "com.zhidaoauto.map.sdk.inner.panel.PanelCategoryList", + + "com.zhidaoauto.map.sdk.inner.panel.PanelResultList", + + "com.zhidaoauto.map.sdk.inner.panel.PanelMac", + "com.zhidaoauto.map.sdk.inner.panel.PanelCarstateShow", + "com.zhidaoauto.map.sdk.inner.panel.PanelStaticShow", + "com.zhidaoauto.map.sdk.inner.panel.PanelBtnLocation", + "com.zhidaoauto.map.sdk.inner.panel.PanelBtnScale", + "com.zhidaoauto.map.sdk.inner.panel.PanelBtnLogo", + "com.zhidaoauto.map.sdk.inner.panel.PanelCar", + "com.zhidaoauto.map.sdk.inner.panel.PanelBtnLogo", + "com.zhidaoauto.map.sdk.inner.panel.PanelPolyGon", + "com.zhidaoauto.map.sdk.inner.panel.PanelCars", + "com.zhidaoauto.map.sdk.inner.panel.PanelTrafficSign" + + }; + mPanelModes = new int[]{ + PANEL_MAP, + PANEL_BTN_DIRECTION, +// PANEL_ROUTING_SELECT, + PANEL_FRAME_COUNTER, + PANEL_MODE_PANEL_TEST_TEXT, + PANEL_BTN_LEFT, + PANEL_BTN_RIGHT, + PANEL_BTN_ZOOM, + PANEL_RIGHT_TOP, + + PANEL_ROUTING_SELECT, + + PANEL_MODE_HIS_LIST, + PANEL_MODE_MENU_COMMON, + PANEL_ROUTE_SET, + + + PANEL_MENU, + PANEL_SEARCH_MENU, + + PANEL_ATTITUDE_SHOW, + PANEL_BT_SENSOR, + PANEL_GUIDANCE, + PANEL_CATEGORY_LIST, + + PANEL_RESULTLIST, + + PANEL_MAC_SHOW, + PANEL_STATE_SHOW, + PANEL_RTINFO_SHOW, + + PANEL_BTN_LOCATION, + PANEL_BTN_SCALE, + PANEL_BTN_LOGO, + PANEL_BTN_CAR, + PANEL_BTN_LOGO, + PANEL_POLYGON, + PANEL_BTN_CARS, + PANEL_TRAFFIC_SIGN + + + }; + panels = new Panel[classNames.length]; + mContainer = container; + childCountAlreaday = mContainer.getChildCount(); + + mHistoryModeSetList = new ArrayList(); + m_iCurModes = PANEL_MODE_SDK_MAIN; + mChildAlreadyList = new ArrayList(); + } + + private int getPanelIndexInAdd(int index) { + int size = mChildAlreadyList.size(); + if (size == 0) { + mChildAlreadyList.add(index); + return 0; + } + int i = size > index ? index : size - 1; + for (; i >= 0; i--) { + if (index == mChildAlreadyList.get(i)) { + return ++i; + } + if (index > mChildAlreadyList.get(i)) { + mChildAlreadyList.add(++i, index); + return i; + } + if (i == 0) { + mChildAlreadyList.add(0, index); + return 0; + } + } + return -1; + } + + private void showPanel(int index) { + if (index >= panels.length || index < 0) { + throw new IndexOutOfBoundsException("index = " + index + " count = " + panels.length); + } + Panel panel = panels[index]; + if (panel == null) { + panel = panels[index] = PanelConstructor.construct(classNames[index], mContext,mMapController); + + if (panel == null) { + return; + } + } + //not contained in the container + if (panel.getParent() == null) { + int mIndex = getPanelIndexInAdd(index); + if (mIndex == -1) { + mContainer.addView(panel); + } else { + //the container may already have child views beside panel + mContainer.addView(panel, mIndex + childCountAlreaday); + } + } + if (panel.getVisibility() != View.VISIBLE) { + panel.setVisibility(View.VISIBLE); + } + panel.onShowPanel(); + } + + private void HidePannel(int index) { + if (index >= panels.length || index < 0) { + throw new IndexOutOfBoundsException("index = " + index + " count = " + panels.length); + } + Panel panel = panels[index]; + if (panel != null) { + if (panel.onHidPanel()) { + //make sure the panel has already been removed + if (panel.getParent() != null) { + panel.setVisibility(View.INVISIBLE); + panel.remove(); + } + int size = mChildAlreadyList.size(); + int i = size > index ? index : size - 1; + for (; i >= 0; i--) { + if (index == mChildAlreadyList.get(i)) { + mChildAlreadyList.remove(i); + } + } + //release the panel + panels[index] = null; + } + } + } + + private void resetPanel(int mode) { + for (int index = 0; index < mPanelModes.length; index++) { + if ((mode & mPanelModes[index]) > 0 && panels[index] != null) { + panels[index].reset(); + } + } + } + + private void switchToMode(int mode) { + for (int index = 0; index < mPanelModes.length; index++) { + if ((mode & mPanelModes[index]) > 0) { + showPanel(index); + } else { + HidePannel(index); + } + } + m_iCurModes = mode; + } + + private void inverseMode(int mode) { + if ((m_iCurModes & mode) == 0) { + switchToMode(m_iCurModes | mode); + } else { + switchToMode(m_iCurModes & ~mode); + } + } + + public boolean setPanel(int what, int panemMode) { + switch (what) { + case PANEL_WHAT_SET_MODE: + // 保存上一次设置的状态 + if (panemMode == PANEL_MODE_SDK_MAIN) { + mHistoryModeSetList.clear(); + mHistoryModeSetList.add(panemMode); + } else if (m_iCurModes != panemMode && (mHistoryModeSetList.size() == 0 || m_iCurModes != mHistoryModeSetList.get(mHistoryModeSetList.size() - 1))) { + mHistoryModeSetList.add(m_iCurModes); + } + switchToMode(panemMode); + return true; + case PANEL_WHAT_SHOW: + // 保存上一次设置的状态 + if (m_iCurModes != panemMode && (mHistoryModeSetList.size() == 0 || m_iCurModes != mHistoryModeSetList.get(mHistoryModeSetList.size() - 1))) { + mHistoryModeSetList.add(m_iCurModes); + } + if ((m_iCurModes & panemMode) == 0) { + switchToMode(m_iCurModes | panemMode); + } + return true; + case PANEL_WHAT_HID: + // 保存上一次设置的状态 + if (m_iCurModes != panemMode && (mHistoryModeSetList.size() == 0 || m_iCurModes != mHistoryModeSetList.get(mHistoryModeSetList.size() - 1))) { + mHistoryModeSetList.add(m_iCurModes); + } + if ((m_iCurModes & panemMode) > 0) { + switchToMode(m_iCurModes & ~panemMode); + } + return true; + case PANEL_WHAT_INVERSION: + // 保存上一次设置的状态for menu, not need +// if (m_iCurModes != mode && (mHistoryModeSetList.size() ==0 || m_iCurModes != mHistoryModeSetList.get(mHistoryModeSetList.size() -1))) { +// mHistoryModeSetList.add(m_iCurModes); +// } + inverseMode(panemMode); + return true; + case PANEL_WHAT_RESET: + resetPanel(panemMode); + return true; + case PANEL_WHAT_BACK: + int size = mHistoryModeSetList.size(); + if (size > 0) { + // 上一个状态 + panemMode = mHistoryModeSetList.get(size - 1); + // 删除上一个状态 + mHistoryModeSetList.remove(size - 1); + } + switchToMode(panemMode); + return true; + case PANEL_WHAT_ONPAUSE: + for (Panel panel : panels) { + if (panel != null) { + panel.onPausePanel(); + } + } + return true; + case PANEL_WHAT_ONRESUME: + for (Panel panel : panels) { + if (panel != null) { + panel.onResumePanel(); + } + } + return true; + } + return false; + } + + public void setPanelPos(int panelMode, int top, int bottom, int left, int right) { + for (int index = 0; index < mPanelModes.length; index++) { + if ((panelMode & mPanelModes[index]) > 0 && panels[index] != null) { + panels[index].setPos(top, bottom, left, right); + } + } + } + + public boolean dispatchKeyEvent(KeyEvent event) { + for (int i = panels.length - 1; i >= 0; i--) { + Panel panel = panels[i]; + if (panel != null && panel.dispatchPanelKeyEvent(event)) { + return true; + } + } + return false; + } + + public boolean onPrepareOptionsMenu(Menu menu) { + for (int i = panels.length - 1; i >= 0; i--) { + Panel panel = panels[i]; + if (panel != null && panel.onPrepareOptionsMenu(menu)) { + return true; + } + } + return false; + } + + public void setPanelPos(int panelMode, int gravity, int top, int bottom, int left, int right) { + for (int index = 0; index < mPanelModes.length; index++) { + if ((panelMode & mPanelModes[index]) > 0 && panels[index] != null) { + panels[index].setMyGravity(gravity); + panels[index].setPos(top, bottom, left, right); + } + } + } + + public void destory() { + mContainer.removeAllViews(); + mContainer = null; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelMap.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelMap.java new file mode 100644 index 0000000000..ac0ed0c17d --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelMap.java @@ -0,0 +1,65 @@ +package com.zhidaoauto.map.sdk.inner.panel; + + +import android.content.Context; +import android.util.Log; +import android.view.Menu; + +import com.zhidaoauto.map.sdk.inner.CompileConfig; + +public class PanelMap extends Panel{ + + private static final String TAG = "PanelMap"; + + public PanelMap(Context context) { + super(context); + if (CompileConfig.INSTANCE.getDEBUG()) { + Log.i(TAG, "autoop-mapop-PanelMap:init"); + } +// addView((MapView) CommonController.getInstance().getMapView()); + setMargin(0, 0, 0, 0); + } + + @Override + protected void onShowPanel() { + if (CompileConfig.INSTANCE.getDEBUG()) { + Log.i(TAG, "autoop-mapop-PanelMap:onShowPanel"); + } + } + + @Override + protected boolean onHidPanel() { + if (CompileConfig.INSTANCE.getDEBUG()) { + Log.i(TAG, "autoop-mapop-PanelMap:onHidPanel"); + } + return true; + } + + @Override + protected void onPausePanel() { + + + } + + @Override + protected void onResumePanel() { + + + } + + @Override + protected void reset() { + } + + @Override + protected void setPos(Integer top, Integer bottom, Integer left, Integer right) { + setMargin(top, bottom, left, right); + } + + @Override + protected boolean onPrepareOptionsMenu(Menu menu) { + + return false; + } + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelRouteSet.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelRouteSet.kt new file mode 100644 index 0000000000..f6386e2e2a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelRouteSet.kt @@ -0,0 +1,197 @@ +//package com.zhidaoauto.map.sdk.inner.panel +// +//import android.content.Context +//import android.content.res.Configuration +//import android.graphics.Color +//import android.os.RemoteException +//import android.view.KeyEvent +//import android.view.Menu +//import android.view.View +//import android.widget.Button +//import android.widget.LinearLayout +//import com.zhidaoauto.map.sdk.R +//import com.zhidaoauto.map.sdk.inner.common.ConstantExt +//import com.zhidaoauto.map.sdk.inner.controller.CommonController +//import com.zhidaoauto.map.sdk.inner.db.DataStorageManager +//import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +//import com.zhidaoauto.map.sdk.inner.utils.Constant.initRouteSetting +//import com.zhidaoauto.map.sdk.open.nav.NavPoi +//import com.zhidaoauto.map.sdk.open.query.LonLatPoint +// +//class PanelRouteSet(context: Context?) : +// Panel(context), View.OnClickListener { +// private val mBtnSetStart: Button +// private val mBtnSetWayPoi: Button +// private val mBtnSetEnd: Button +// private val mBtnOk: Button +// private var mRouteSetStat = 0 +// private var mPoiStart: NavPoi? = null +// private var mPoiWay: NavPoi? = null +// private var mPoiEnd: NavPoi? = null +// override fun onClick(v: View) { +// mRouteSetStat = v.id +// when (v.id) { +// R.id.route_set_start, R.id.route_set_waypoi, R.id.route_set_end -> CommonController.instance +// .panelManager?.setPanel( +// PanelManager.PANEL_WHAT_SHOW, +// PanelManager.PANEL_MODE_SEARCH +// ) +// R.id.route_set_ok -> { +// mPoiStart?.let { +// CommonController.instance.naviController?.setStart(it) +// } +// mPoiWay?.let { +// CommonController.instance +// .naviController?.addWayPoint(it, 0, 0) +// } +// mPoiEnd?.let { +// CommonController.instance.naviController?.setDest(it) +// } +// if (mPoiStart == null && mPoiEnd == null) { +// CommonController.instance.naviController?.reSetRoute() +// } +// } +// } +// } +// +// public override fun dispatchPanelKeyEvent(event: KeyEvent): Boolean { +// if (this.visibility == View.VISIBLE && event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) { +// CommonController.instance.panelManager?.setPanel( +// PanelManager.PANEL_WHAT_HID, +// PanelManager.PANEL_MODE_ROUTE_SET +// ) +// mPoiStart = null +// mPoiWay = null +// mPoiEnd = null +// return true +// } +// return super.dispatchPanelKeyEvent(event) +// } +// +// override fun onConfigurationChanged(newConfig: Configuration) {} +// override fun onPausePanel() {} +// override fun onResumePanel() {} +// override fun onShowPanel() {} +// override fun onHidPanel(): Boolean { +// this.visibility = View.GONE +// return true +// } +// +// override fun reset() { +// setRoute() +// if (DataStorageManager.getInstance().navPoi == null) +// return; +// when (mRouteSetStat) { +// R.id.route_set_start -> { +// mBtnSetStart.setText(mPoiStart?.name); +// } +// R.id.route_set_waypoi -> { +// mPoiWay = DataStorageManager.getInstance().navPoi; +// mBtnSetWayPoi.setText(mPoiWay?.name); +// } +// R.id.route_set_end -> { +// mPoiEnd = DataStorageManager.getInstance().navPoi; +// mBtnSetEnd.setText(mPoiEnd?.name); +// } +// } +// if (mPoiEnd != null || (CommonController.instance.naviController!!.isDestSet() && CommonController.instance.naviController!!.getEndPoi() != null)) { +// mBtnOk.setClickable(true); +// mBtnOk.setTextColor(mContext.getResources().getColor(R.color.text_btn_color)); +// mBtnOk.setBackgroundResource(R.drawable.btn_selecter); +// } else { +// mBtnOk.setClickable(false); +// mBtnOk.setBackgroundResource(R.drawable.btn); +// mBtnOk.setTextColor(Color.GRAY); +// } +// DataStorageManager.getInstance().setNavPoi(null); +// CommonController.instance.mapController?.clearSearchPoi(); +// } +// +// override fun setPos( +// top: Int, bottom: Int, left: Int, +// right: Int +// ) { +// } +// +// override fun onPrepareOptionsMenu(menu: Menu): Boolean { +// return false +// } +// +// private fun setRoute() { +// if (CommonController.instance.naviController!!.isStartSet() +// && CommonController.instance.naviController?.getStartPoi() != null +// ) { +// mBtnSetStart.text = CommonController.instance +// .naviController?.getStartPoi().toString() +// } else { +// try { +// val location = CommonController.instance.lastKnownMogoLocation +// location?.let { +// val lonLat = CommonProxy.getInstance().getLonLatProxy() +// .switchLonLat(LonLatPoint(it.lon, it.lat)) +// val lon = lonLat.lon * ConstantExt.RULE_INT +// val lat = lonLat.lat * ConstantExt.RULE_INT +// +// if (lon > 0 && lat > 0) { +// mBtnSetStart.text = "我的位置" +// } else { +// mBtnSetStart.text = "未设置" +// } +// } +// +// } catch (e: RemoteException) { +// e.printStackTrace() +// } +// } +// if (CommonController.instance.naviController!!.isDestSet() +// && CommonController.instance.naviController?.getEndPoi() != null +// ) { +// mBtnSetEnd.text = CommonController.instance +// .naviController?.getEndPoi().toString() +// mBtnOk.isClickable = true +// mBtnOk.setTextColor( +// mContext.resources.getColor(R.color.text_btn_color) +// ) +// mBtnOk.setBackgroundResource(R.drawable.btn_selecter) +// } else { +// mBtnSetEnd.text = "未设置" +// mBtnOk.isClickable = false +// mBtnOk.setBackgroundResource(R.drawable.btn) +// mBtnOk.setTextColor(Color.GRAY) +// } +// if (CommonController.instance.naviController!!.isTuSet() +// && CommonController.instance.naviController?.getWayPoi() != null +// ) { +// mBtnSetWayPoi.text = CommonController.instance +// .naviController?.getWayPoi().toString() +// } else { +// mBtnSetWayPoi.text = "未设置" +// } +// } +// +// init { +// setContentView( +// R.layout.panel_route_set, +// LayoutParams( +// LayoutParams.FILL_PARENT, +// LayoutParams.FILL_PARENT +// ) +// ) +// mBtnSetStart = +// findVievById(R.id.route_set_start) as Button +// mBtnSetStart.setOnClickListener(this) +// mBtnSetWayPoi = +// findVievById(R.id.route_set_waypoi) as Button +// mBtnSetWayPoi.setOnClickListener(this) +// mBtnSetEnd = +// findVievById(R.id.route_set_end) as Button +// mBtnSetEnd.setOnClickListener(this) +// val mLayoutRouteSet = +// findVievById(R.id.route_set_layout) as LinearLayout +// initRouteSetting(mContext, mLayoutRouteSet) +// mBtnOk = +// mLayoutRouteSet.findViewById(R.id.route_set_ok) as Button +// mBtnOk.setOnClickListener(this) +// setRoute() +// } +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelSelectRoute.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelSelectRoute.kt new file mode 100644 index 0000000000..f1ca39af4f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelSelectRoute.kt @@ -0,0 +1,324 @@ +//package com.zhidaoauto.map.sdk.inner.panel +// +//import android.content.Context +//import android.os.RemoteException +//import android.text.TextUtils +//import android.util.Log +//import android.view.Gravity +//import android.view.KeyEvent +//import android.view.Menu +//import android.view.View +//import android.widget.LinearLayout +//import android.widget.RadioButton +//import android.widget.RadioGroup +//import android.widget.TextView +//import androidx.recyclerview.widget.LinearLayoutManager +//import androidx.recyclerview.widget.RecyclerView +//import com.autonavi.nge.guidance.RouteBook +//import com.autonavi.nge.guidance.RouteBookAdapter +//import com.autonavi.nge.guidance.RouteBookItem +//import com.autonavi.nge.routing.RoutingProvider +//import com.zhidaoauto.map.sdk.R +//import com.zhidaoauto.map.sdk.inner.CompileConfig +//import com.zhidaoauto.map.sdk.inner.common.NavHelper.mNavParams +//import com.zhidaoauto.map.sdk.inner.controller.CommonController +//import com.zhidaoauto.map.sdk.inner.utils.Constant.getDisString +//import com.zhidaoauto.map.sdk.inner.utils.Constant.getTimeString +//import com.zhidaoauto.map.sdk.open.nav.model.NaviPath +//import kotlinx.android.synthetic.main.panel_route_select.view.* +//import kotlinx.coroutines.Dispatchers +//import kotlinx.coroutines.launch +//import kotlinx.coroutines.withContext +// +//class PanelSelectRoute(context: Context?) : Panel(context), View.OnClickListener { +// +// private val TAG = javaClass.simpleName +// private var mLayoutSelectSetting: LinearLayout? = null +// private val mLayoutStart: LinearLayout +// private var mRbSelect: RadioButton? = null +// private val isShow: Boolean +// private var isLoadMore: Boolean = false +// private var mTvSelect: TextView? = null +// private val routeBookAdapter = RouteBookAdapter() +// +// private fun initRouteSetting(layoutRouteSet: LinearLayout) { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop-initRouteSetting") +// } +// val rg_routing_model = layoutRouteSet.findViewById(R.id.rg_routing_set) as RadioGroup +// when (mNavParams.getRoutingModel()) { +// RoutingProvider.COSTMODEL_DEFAULT -> rg_routing_model.check(R.id.routing_set_default) +// RoutingProvider.COSTMODEL_FASTEST -> { +// rg_routing_model.check(R.id.routing_set_fast) +// mRbSelect = rg_routing_model.getChildAt(2) as RadioButton +// refreshRouteTime() +// } +// RoutingProvider.COSTMODEL_SHORTEST -> { +// rg_routing_model.check(R.id.routing_set_short) +// mRbSelect = rg_routing_model.getChildAt(4) as RadioButton +// refreshRouteTime() +// } +// RoutingProvider.COSTMODEL_SUGGEST -> { +// rg_routing_model.check(R.id.routing_set_avoidhwy) +// mRbSelect = rg_routing_model.getChildAt(6) as RadioButton +// refreshRouteTime() +// } +// RoutingProvider.COSTMODEL_ECO -> { +// rg_routing_model.check(R.id.routing_set_avoidtoll) +// mRbSelect = rg_routing_model.getChildAt(8) as RadioButton +// refreshRouteTime() +// } +// } +// rg_routing_model.setOnCheckedChangeListener { group, checkedId -> +// when (checkedId) { +// R.id.routing_set_default -> { +// mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_DEFAULT) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_DEFAULT, 0) +// } +// R.id.routing_set_fast -> { +// mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_FASTEST) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_FASTEST, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidHighway(false, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidToll(false, 0) +// CommonController.instance.naviController?.reSetRoute() +// } +// R.id.routing_set_short -> { +// mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_SHORTEST) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_SHORTEST, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidHighway(false, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidToll(false, 0) +// CommonController.instance.naviController?.reSetRoute() +// } +// R.id.routing_set_avoidhwy -> { +// mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_SUGGEST) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_FASTEST, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidHighway(true, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidToll(false, 0) +// CommonController.instance.naviController?.reSetRoute() +// } +// R.id.routing_set_avoidtoll -> { +// mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_ECO) +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_FASTEST, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidHighway(false, 0) +// CommonController.instance.iNavigationCore?.RoutingSetAvoidToll(true, 0) +// CommonController.instance.naviController?.reSetRoute() +// } +// } +// } +// +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop-initRouteSetting-over") +// } +// } +// +// override fun onClick(v: View) { +// when (v.id) { +// R.id.route_select_start_navi -> { +// CommonController.instance.naviController?.startNavi(false) +// } +// R.id.route_select_sim_navi -> { +// CommonController.instance.naviController?.startNavi(true) +// } +// R.id.route_select_ok -> { +// showStartView() +// } +// R.id.iv_back -> { +// route_select_start.visibility = GONE +// route_select_setting.visibility = VISIBLE +// } +// } +// } +// +// override fun onShowPanel() { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop-onShowPanel") +// } +// } +// +// override fun onHidPanel(): Boolean { +// CommonController.instance.panelManager?.setPanelPos(PanelManager.PANEL_MODE_MAP, 0, 0, 0, 0) +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop-onHidPanel") +// } +// return true +// } +// +// override fun onPausePanel() {} +// override fun onResumePanel() { +// refreshRouteTime() +// } +// +// override fun reset() { +// showStartView() +// } +// +// override fun setPos(top: Int, bottom: Int, left: Int, right: Int) { +// } +// +// override fun onPrepareOptionsMenu(menu: Menu): Boolean { +// return false +// } +// +// public override fun dispatchPanelKeyEvent(event: KeyEvent): Boolean { +// if (this.visibility == View.VISIBLE && event.keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_UP) { +// if (mLayoutSelectSetting != null && mLayoutSelectSetting!!.visibility == View.GONE && isShow) { +// showRouteSettingView() +// } else { +// CommonController.instance.panelManager?.setPanel(PanelManager.PANEL_WHAT_SET_MODE, PanelManager.PANEL_MODE_MAIN) +// CommonController.instance.panelManager?.setPanelPos(PanelManager.PANEL_MODE_MAP, 0, 0, 0, 0) +// } +// return true +// } +// return super.dispatchPanelKeyEvent(event) +// } +// +// private fun showRouteSettingView() { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop-showRouteSettingView") +// } +// if (mLayoutSelectSetting == null) { +// mLayoutSelectSetting = findVievById(R.id.route_select_setting) as LinearLayout +// } +// mLayoutSelectSetting?.isClickable = true +// mLayoutSelectSetting?.visibility = View.VISIBLE +// mLayoutStart.visibility = View.GONE +// initRouteSetting(this) +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop-showRouteSettingView-over") +// } +// } +// +// private fun showStartView() { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop-showStartView") +// } +// if (mLayoutSelectSetting == null) { +// mLayoutSelectSetting = findVievById(R.id.route_select_setting) as LinearLayout +// } +// mLayoutSelectSetting?.visibility = View.GONE +// mLayoutStart.visibility = View.VISIBLE +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop-showStartView-over") +// } +// refreshRouteBook() +// } +// +// var list: List? = null +// private fun refreshRouteBook() { +// CommonController.instance.scope?.launch(Dispatchers.IO) { +// var routebook: RouteBook? = null +// if(isLoadMore){ +// var start = list!!.size +// routebook = CommonController.instance.iNavigationCore?.Guidance_RouteBook(0, start, start?.plus(50)) +// }else { +// routebook = CommonController.instance.iNavigationCore?.Guidance_RouteBook(0, 0, Int.MAX_VALUE) +// } +// list = routebook?.bookdata +// Log.i(TAG, "navop--refreshRouteBook:${list?.size}") +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop--refreshRouteBook:${routebook?.itemSize}") +// } +// +// +// withContext(Dispatchers.Main) { +// if (lv_info.adapter == null) { +// lv_info.adapter = routeBookAdapter +// } +// if (routeBookAdapter.itemCount == 0) { +// routeBookAdapter.setNewInstance(routebook?.bookdata) +// } else { +// routeBookAdapter.setList(routebook?.bookdata) +// routeBookAdapter.notifyDataSetChanged() +// } +// tv_dis.text = "距离:${getDisString(routebook?.totalLength ?: 0)}\n时间:${getTimeString(routebook?.totalTime ?: 0)}" +// } +// } +// +// +// } +// +// private fun refreshRouteTime() { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop-setRouteTime") +// } +// try { +// val sTime = CommonController.instance.iNavigationCore?.RoutingGetSTime(0, 0) ?: 0 +// val dTime = CommonController.instance.iNavigationCore?.RoutingGetDTime(0, 0) ?: 0 +// val distance = CommonController.instance.iNavigationCore?.RoutingGetLength(0, 0) ?: 0 +// if(CompileConfig.DEBUG){ +// Log.i(TAG,"navop--refreshRouteTime:${sTime},${dTime},${distance}") +// } +// val length = getDisString(distance) +// val text = "耗时:${getTimeString(sTime)}\n距离:${length}" +// if (mTvSelect == null) { +// mTvSelect = findVievById(R.id.route_select_time) as TextView +// } +// mTvSelect?.text = text +// } catch (e: RemoteException) { +// e.printStackTrace() +// } +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop-setRouteTime-over") +// } +// } +// +// init { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop-init") +// } +// val width = if (this.resources.displayMetrics.widthPixels > this.resources.displayMetrics.heightPixels) { +// this.resources.displayMetrics.widthPixels +// } else { +// this.resources.displayMetrics.heightPixels +// } +// val layoutW = (width / 3.5f).toInt() +// setContentView(R.layout.panel_route_select, LayoutParams(layoutW, LayoutParams.MATCH_PARENT)) +// CommonController.instance.panelManager?.setPanelPos(PanelManager.PANEL_MODE_MAP, 0, 0, 0, 0) +// setGravity(Gravity.LEFT) +// isClickable = false +// mLayoutStart = findVievById(R.id.route_select_start) as LinearLayout +// isShow = mNavParams.getRouteSelectShow() +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop-init--getRouteSelectShow:$isShow") +// } +// if (!isShow) { +// showStartView() +// } else { +// showRouteSettingView() +// } +// val lv_info = findVievById(R.id.lv_info) as RecyclerView +// lv_info.setLayoutManager(LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)); +// lv_info.adapter = routeBookAdapter +//// routeBookAdapter.setOnItemClickListener { adapter, view, position -> +//// if (position == routeBookAdapter.itemCount - 1 +//// && !TextUtils.equals("目的地", routeBookAdapter.getItem(position - 1).routeName) +//// ) { +//// refreshRouteBook() +//// } +//// } +// lv_info.setOnScrollListener(object : RecyclerView.OnScrollListener() { +// override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { +// super.onScrollStateChanged(recyclerView, newState) +// val manager = recyclerView.layoutManager as LinearLayoutManager +// if (newState === RecyclerView.SCROLL_STATE_IDLE) { +// val lastVisibleItem = manager.findLastCompletelyVisibleItemPosition() +// val totalItemCount = manager.itemCount +// if (lastVisibleItem == totalItemCount - 1 +// && !TextUtils.equals("目的地", routeBookAdapter.getItem(lastVisibleItem).routeName) +// ) { +// isLoadMore = true +// refreshRouteBook() +// } +// } +// } +// }) +// +// iv_back.setOnClickListener(this) +// route_select_start_navi.setOnClickListener(this) +// route_select_sim_navi.setOnClickListener(this) +// route_select_ok.setOnClickListener(this) +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "navop-init-over") +// } +// } +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelTrafficSign.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelTrafficSign.kt new file mode 100644 index 0000000000..8754b60395 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelTrafficSign.kt @@ -0,0 +1,287 @@ +package com.zhidaoauto.map.sdk.inner.panel + +import android.content.Context +import android.util.Log +import android.view.Gravity +import android.view.Menu +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.road.RoadHelper +import com.zhidaoauto.map.sdk.inner.utils.MathUtils +import com.zhidaoauto.map.sdk.open.MapAutoApi +import com.zhidaoauto.map.sdk.open.abs.OnMapChangeListener +import com.zhidaoauto.map.sdk.open.location.MogoLocation +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.road.Lane +import com.zhidaoauto.map.sdk.open.road.RoadSign +import kotlinx.android.synthetic.main.panel_traffic_sign.view.iv_traffic +import kotlin.math.abs + +class PanelTrafficSign(context: Context,private val mMapController: IMapController) : Panel(context,mMapController), OnMapChangeListener { + private val TAG = javaClass.simpleName + + private var lastLonLatPoint: LonLatPoint? = null + private var lastTitleId: Long = 0L + private var roadSigns: ArrayList? = ArrayList() + private var mRoadSign: RoadSign? = null + private var lanes: ArrayList? = ArrayList() + private val roadSignDisMap: MutableMap = HashMap() + private val roadSignAngleMap: MutableMap = HashMap() + + + init{ + setContentView(R.layout.panel_traffic_sign, LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)) + setPos(context.getResources().getDimensionPixelSize(R.dimen.road_sign_top), 0, 0, context.getResources().getDimensionPixelSize(R.dimen.road_sign_right)) + setMyGravity(Gravity.TOP or Gravity.RIGHT) + mMapController.getEventController()?.addMapChangeListener(this) + + } + override fun onShowPanel() { + + } + + override fun onHidPanel(): Boolean { + return true + } + + override fun onPausePanel() { + + } + + override fun onResumePanel() { + + } + + override fun reset() { + } + + override fun setPos(top: Int?, bottom: Int?, left: Int?, right: Int?) { + setMargin(top, bottom, left, right) + } + + override fun onPrepareOptionsMenu(menu: Menu?): Boolean { + return false + + } + + + override fun onMapChange(mogoLocation: MogoLocation) { +// val flag = !(CommonController.instance.mapView?.isSurfaceCreated()?:false) +// if(flag){ +// return +// } + if(mMapController.getMapStyleParams().getStyleMode() < MapAutoApi.MAP_STYLE_NIGHT_VR){ + return + } + val lonlatPoint = LonLatPoint(mogoLocation.lon, mogoLocation.lat,mogoLocation.heading) + if(lastLonLatPoint == null){ + lastLonLatPoint = lonlatPoint + } + + var dis = 0.0 + lastLonLatPoint?.let { + dis = MathUtils.distance(it.longitude, it.latitude, lonlatPoint.longitude, lonlatPoint.latitude) + } + if (dis > 20) { + lastLonLatPoint = lonlatPoint + var tileId = MapAutoApi.getTileID(lonlatPoint.longitude, lonlatPoint.latitude, 13) + if (CompileConfig.DEBUG) { + Log.d(TAG, "tileId: ${tileId}") + } + if (lastTitleId != tileId) { + roadSigns = RoadHelper.getInstance()?.getRoadSign(tileId) + } + var distance = 0.0 + mRoadSign = null + roadSigns?.let { roadSigns -> + if (roadSigns.size > 0) { + for (roadSign in roadSigns) { + if(roadSign.content == 0) { + continue + } + roadSign.position?.let { + var lon = 0.0 + var lat = 0.0 + + for (i in 0..3) { + lon += it[i].lon + lat += it[i].lat + } + lon /= 4 + lat /= 4 + distance = MathUtils.distance(lon, lat, lonlatPoint.longitude, lonlatPoint.latitude) + + if (lastTitleId != tileId) { +// lanes = MapDataApi.getLaneInfo(tileId, roadSign.roadId) +// lanes?.let { lanes -> +// if (lanes.size > 0) { +// val lane = lanes[0] +// if (lane.laneLatLonPoints != null && lane.laneLatLonPoints.size > 1) { +// val angle = GisGeomTool.getAngleToNorth(lane.laneLatLonPoints[1].longitude - lane.laneLatLonPoints[0].longitude, lane.laneLatLonPoints[1].latitude - lane.laneLatLonPoints[0].latitude) +// roadSignAngleMap.put(roadSign.id, angle) +// } +// } +// } + +// val angle = GisGeomTool.getAngleToNorth(it[1].lon - it[0].lon, it[1].lat - it[0].lat) +// roadSignAngleMap.put(roadSign.id, angle) + } + + var disAngle = 0.0 + roadSignAngleMap[roadSign.id]?.let { + disAngle = abs(lonlatPoint.angle - it) + if(disAngle > 300){ + disAngle = 360 - disAngle + } + } + roadSignDisMap[roadSign.id]?.let { + if (CompileConfig.DEBUG) { + Log.d(TAG, "id: ${roadSign.id},content: ${roadSign.content}, distance: ${distance}, lastDis: ${it}, carangle: ${lonlatPoint.angle}, angle:${roadSignAngleMap[roadSign.id]}, disAngle: ${disAngle}") + } + if (distance <= 50 && it > distance && disAngle < 90) { + mRoadSign = roadSign + } + } + roadSignDisMap.put(roadSign.id, distance) + } + + } + + } + + + if (mRoadSign != null) { + if (CompileConfig.DEBUG) { + Log.d(TAG, "mRoadSign--id: ${mRoadSign!!.id},content: ${mRoadSign!!.content}") + } + var resID = 0 + mRoadSign?.let { + when (it.content) { + 1 -> { + resID = R.mipmap.traffic_sign_1 + } + 2 -> { + resID = R.mipmap.traffic_sign_2 + } + 3 -> { + resID = R.mipmap.traffic_sign_3 + } + 4 -> { + resID = R.mipmap.traffic_sign_4 + } + 5 -> { + resID = R.mipmap.traffic_sign_5 + } + 6 -> { + resID = R.mipmap.traffic_sign_6 + } + 7 -> { + resID = R.mipmap.traffic_sign_7 + } + 8 -> { + resID = R.mipmap.traffic_sign_8 + } +// 9 -> { +// resID = R.mipmap.traffic_sign_9 +// } + 10 -> { + resID = R.mipmap.traffic_sign_10 + } + 11 -> { + resID = R.mipmap.traffic_sign_11 + } + 12 -> { + resID = R.mipmap.traffic_sign_12 + } + 13 -> { + resID = R.mipmap.traffic_sign_13 + } + 20 -> { + resID = R.mipmap.traffic_sign_20 + } + 22 -> { + resID = R.mipmap.traffic_sign_22 + } + 23 -> { + resID = R.mipmap.traffic_sign_23 + } + 24 -> { + resID = R.mipmap.traffic_sign_24 + } + 25 -> { + resID = R.mipmap.traffic_sign_25 + } + 26 -> { + resID = R.mipmap.traffic_sign_26 + } + 27 -> { + resID = R.mipmap.traffic_sign_27 + } + 28 -> { + resID = R.mipmap.traffic_sign_28 + } + 31 -> { + resID = R.mipmap.traffic_sign_31 + } + 32 -> { + resID = R.mipmap.traffic_sign_32 + } + 33 -> { + resID = R.mipmap.traffic_sign_33 + } + 34 -> { + resID = R.mipmap.traffic_sign_34 + } + 35 -> { + resID = R.mipmap.traffic_sign_35 + } + 36 -> { + resID = R.mipmap.traffic_sign_36 + } + 37 -> { + resID = R.mipmap.traffic_sign_37 + } + 38 -> { + resID = R.mipmap.traffic_sign_38 + } + 39 -> { + resID = R.mipmap.traffic_sign_39 + } + 40 -> { + resID = R.mipmap.traffic_sign_40 + } + 41 -> { + resID = R.mipmap.traffic_sign_41 + } + 42 -> { + resID = R.mipmap.traffic_sign_42 + } + 43 -> { + resID = R.mipmap.traffic_sign_43 + } + 44 -> { + resID = R.mipmap.traffic_sign_44 + } + 45 -> { + resID = R.mipmap.traffic_sign_45 + } + } + if (CompileConfig.DEBUG) { + Log.d(TAG, "mRoadSign--resID: ${resID}") + } + if(resID != 0) { + iv_traffic.visibility = VISIBLE + iv_traffic.setImageResource(resID) + }else{ + iv_traffic.visibility = GONE + } + } + } else { + iv_traffic.visibility = GONE + } + } + lastTitleId = tileId + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelZoom.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelZoom.kt new file mode 100644 index 0000000000..8b1c8f866e --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PanelZoom.kt @@ -0,0 +1,67 @@ +package com.zhidaoauto.map.sdk.inner.panel + +import android.content.Context +import android.view.Gravity +import android.view.Menu +import android.view.View +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.open.MapAutoApi +import kotlinx.android.synthetic.main.panel_btn_zoom.view.img_zoom_in +import kotlinx.android.synthetic.main.panel_btn_zoom.view.img_zoom_out + +class PanelZoom(context: Context?,private val mMapController:IMapController) : Panel(context,mMapController), View.OnClickListener { + + + + override fun onClick(v: View) { + when(v.id){ + R.id.img_zoom_in->{ + mMapController?.zoomIn() + } + R.id.img_zoom_out->{ + mMapController?.zoomOut() + } + } + + } + + override fun onShowPanel() {} + override fun onHidPanel(): Boolean { + return true + } + + override fun onPausePanel() {} + override fun onResumePanel() {} + override fun reset() {} + override fun setPos( + top: Int, bottom: Int, left: Int, + right: Int + ) { + setMargin(top, bottom, left, right) + } + + override fun onPrepareOptionsMenu(menu: Menu): Boolean { + return false + } + + + init { + setContentView(R.layout.panel_btn_zoom, LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)) + setMyGravity(Gravity.RIGHT or Gravity.BOTTOM) + setPos(0, 165, 0, 25) + val style = mMapController.getMapStyleParams().getStyleMode() + if(style == MapAutoApi.MAP_STYLE_DAY || style == MapAutoApi.MAP_STYLE_DAY_VR){ + img_zoom_in.setImageResource(R.mipmap.icon_zoom_in_day) + img_zoom_out.setImageResource(R.mipmap.icon_zoom_out_day) + }else{ + img_zoom_in.setImageResource(R.mipmap.icon_zoom_in_night) + img_zoom_out.setImageResource(R.mipmap.icon_zoom_out_night) + } + img_zoom_in.setOnClickListener(this) + img_zoom_out.setOnClickListener(this) + this.isFocusableInTouchMode = false + this.isFocusable = false + this.isClickable = false + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PolyLineView.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PolyLineView.java new file mode 100644 index 0000000000..820a279fe8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/PolyLineView.java @@ -0,0 +1,181 @@ +package com.zhidaoauto.map.sdk.inner.panel; + +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Point; +import android.util.AttributeSet; +import android.view.View; + +import com.zhidaoauto.map.sdk.open.abs.MapStatusListener; +import com.zhidaoauto.map.sdk.open.query.LonLatPoint; + +import java.util.List; + +/** + * 绘制线面的自定义view + */ +public class PolyLineView extends View implements MapStatusListener { + public static int TYPE_LINE = 0x00000; + public static int TYPE_CIRCLE = 0x00001; + public static int TYPE_RECT = 0x00002; + public static int TYPE_OVIL = 0x00003; + public static int TYPE_POLYGON = 0x00004; + private List data; + private Context context; + private int type; + private float radius; + private int paintWidth; + private int paintColor; + private final int LISTENER_TYPE_LINE = 0x111; + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + //CommonController.getInstance().getMapController().registerStatusListener(this,LISTENER_TYPE_LINE); + + } + + public float getRadius() { + return radius; + } + + public void setRadius(float radius) { + this.radius = radius; + if (radius <= 5) { + this.radius = 5; + } + } + + public PolyLineView(Context context) { + super(context); + this.context = context; + } + + public PolyLineView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public PolyLineView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + + public int getPaintWidth() { + return paintWidth; + } + + public void setPaintWidth(int paintWidth) { + this.paintWidth = paintWidth; + if (paintWidth <= 5) { + this.paintWidth = 5; + } + } + + public int getPaintColor() { + return paintColor; + } + + public void setPaintColor(int paintColor) { + this.paintColor = paintColor; + if (paintColor == 0) { + this.paintColor = Color.GRAY; + } + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); +// Paint paint = new Paint(); +// paint.setAntiAlias(true); +// paint.setDither(true); +// paint.setColor(paintColor); +// //设置画笔宽度 +// paint.setStrokeWidth(paintWidth); +// if (type == TYPE_LINE) { +// //设置空心 +// paint.setStyle(Paint.Style.STROKE); +// } else { +// paint.setStyle(Paint.Style.FILL_AND_STROKE); +// paint.setAlpha(200); +// } +// +// if (type == TYPE_LINE) { +// // 画直线 +// Path path = new Path(); +// if (lonLatPoints != null && lonLatPoints.size() > 0) { +// Point point = MapTools.INSTANCE.toScreenLocation(lonLatPoints.get(0)); +// path.moveTo(point.x, point.y); +// for (int i = 0; i < lonLatPoints.size(); i++) { +// Point point1 = MapTools.INSTANCE.toScreenLocation(lonLatPoints.get(i)); +// path.lineTo(point1.x, point1.y); +// } +// } +// canvas.drawPath(path, paint); +// +// } else if (type == TYPE_CIRCLE) { +// Point point = MapTools.INSTANCE.toScreenLocation(lonLatPoint); +// //绘制圆 +// canvas.drawCircle(point.x, point.y, radius, paint); +// } else if (type == TYPE_RECT) { +// List points = MapTools.INSTANCE.toScreenLocations(lonLatPoints); +// //矩形 +// Rect rect = new Rect(points.get(0).x, points.get(0).y, points.get(3).x, points.get(3).y); +// canvas.drawRect(rect, paint); +// } else if (type == TYPE_OVIL) { +// List points = MapTools.INSTANCE.toScreenLocations(lonLatPoints); +// //定义一个矩形区域 +// RectF oval = new RectF(points.get(0).x, points.get(0).y, points.get(3).x, points.get(3).y); +// //矩形区域内切椭圆 +// canvas.drawOval(oval, paint);// drawOval 绘制椭圆 +// } else if (type == TYPE_POLYGON) { +// Path mPathRect = new Path(); +// if (lonLatPoints != null && lonLatPoints.size() > 0) { +// Point point = MapTools.INSTANCE.toScreenLocation(lonLatPoints.get(0)); +// mPathRect.moveTo(point.x, point.y); +// for (int i = 0; i < lonLatPoints.size(); i++) { +// Point point1 = MapTools.INSTANCE.toScreenLocation(lonLatPoints.get(i)); +// mPathRect.lineTo(point1.x, point1.y); +// } +// } +// paint.setStyle(Paint.Style.STROKE); +// mPathRect.close();//效果和mPath.lineTo(200,200);//将最后到达的点和第一个点连接起来 +// canvas.drawPath(mPathRect, paint);//画出路径 +// +// +// } + } + + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + // CommonController.getInstance().getMapController().unRegisterStatusListener(this,LISTENER_TYPE_LINE); + } + + private List lonLatPoints; + private LonLatPoint lonLatPoint; + + public void setLonlatPoints(List lonLatPoints) { + this.lonLatPoints = lonLatPoints; + } + + public void setLonLatPoint(LonLatPoint lonLatPoint) { + this.lonLatPoint = lonLatPoint; + } + + + @Override + public void onMapStatusChanged(int type, int value) { + invalidate(); + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/SatelliteSkyView.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/SatelliteSkyView.java new file mode 100644 index 0000000000..5ca03e064a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/panel/SatelliteSkyView.java @@ -0,0 +1,879 @@ +package com.zhidaoauto.map.sdk.inner.panel; + +import android.content.Context; +import android.content.res.Configuration; +import android.content.res.Resources; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.Paint; +import android.graphics.Paint.Align; +import android.graphics.Paint.Style; +import android.graphics.Rect; +import android.graphics.drawable.GradientDrawable; +import android.hardware.Sensor; +import android.hardware.SensorEvent; +import android.hardware.SensorEventListener; +import android.hardware.SensorManager; +import android.location.GpsSatellite; +import android.location.GpsStatus; +import android.view.HapticFeedbackConstants; +import android.view.MotionEvent; +import android.view.View; + +import com.zhidaoauto.map.sdk.R; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Iterator; + +public class SatelliteSkyView extends View { + + private int text1_x = 66; + private int text2_x = 165; + private int text3_x = 340; + private int text4_x = 46; + private int text5_x = 210; + private int text6_x = 377; + private int text1_y = 57; + private int text2_y = 57; + private int text3_y = 57; + private int text4_y = 133; + private int text5_y = 133; + private int text6_y = 133; + private int radius = 130;// 星球半径 + private int centerX = 240;// 星球中心点x值 + private int centerY = 425;// 星球中心点y值 + private int ballR = 35; // 小球半径 + private int redR = 175; + private int settingX=460; + private int settingY=670; + + private Paint mGridPaint; + private Paint mTextPaint; + private Paint mBackground; + + private Bitmap mbg; + private Bitmap[] number = new Bitmap[10]; + private Bitmap[] lNumber = new Bitmap[10]; + private Bitmap water; + private Bitmap arrow; + private Bitmap sector; + private Bitmap dot; + private Bitmap greenDot; + private Bitmap grayDot; + private Bitmap yellowDot; + + private int signalBottom; + private int signalTop; + private int[] signalX = new int[12]; + private int signalWidth; + private float degree = 0; + private float acc = 0; + private float dirX = 0; + private float dirY = 0; + private float m_sensorDir = 0; + private float[] lastA = new float[3]; + private float[] initA = new float[3]; + private boolean start = false; + private int count = 0; + private int m_nScreenWidth = 0; + private int m_nScreenHeight = 0; + int nDispH = this.getHeight(); + + private float x; //水珠坐标 + private float y; + private float nx;//水珠重力坐标 + private float ny; + private float sx = -80; //雷达坐标 + private float sy = -165; + private double dx;//三角变换 + private double dy; + private int delayCount = 0; + private float m_AccX; + private float m_AccY; + private int lastDir = 0; + private float v = 2; + private GradientDrawable mDrawable; + private Paint blackPaint; + + private float mBitmapAdjustment; + + public final static int MAX_SATS = 12; + + private int mSatellites; + private int[] mPrns = null; + private float[] mElevation = null; + private float[] mAzimuth = null; + private float[] mSnrs = null; + private float[] mX = null; + private float[] mY = null; + private int mUsedInFixMask = 0; + private double lon = 0; + private double lat = 0; + + // 画信号强度 + private Paint mLinePaint; + private Paint mBarPaintUsed; + private Paint mBarPaintUnused; + private Paint mBarPaintNoFix; + private Paint mBarOutlinePaint; + + private double mAlt = 0; + private long mTime = -1; + private int mSpeed = 0; + // 横竖屏模式 + private boolean m_bW = false; + private int m_nDensity = 240; + private boolean flagDir = false; + private boolean flagBall = false; + private SensorManager sensorManager; + + private float fltScale = 0f; + + private Bitmap bitmap; + + private Bitmap setting; + + private GpsStatus gsv = null;; + + public void setExtraInfo(double a, long t, int s) { + this.mAlt = a; + this.mTime = t; + this.mSpeed = s; + } + + private void computeXY() { + for (int i = 0; i < mSatellites; ++i) { + double theta = -(mAzimuth[i] - 90); + double rad = theta * Math.PI / 180.0; + mX[i] = (float) Math.cos(rad); + mY[i] = -(float) Math.sin(rad); + mElevation[i] = 90 - mElevation[i]; + } + } + + private float[] gacc = new float[3]; + private float[] dir = new float[3]; + private float[] lacc = new float[3]; + private long curTime = 0; + + private final SensorEventListener sensorEventListener = new SensorEventListener() { + @Override + public void onSensorChanged(SensorEvent event) { + if (event.sensor.getType() == Sensor.TYPE_LINEAR_ACCELERATION) { + lacc[0] = event.values[0]; + lacc[1] = event.values[1]; + lacc[2] = event.values[2]; + }else if(event.sensor.getType() == Sensor.TYPE_ORIENTATION){ + dir[0] = event.values[0]; + dir[1] = event.values[1]; + dir[2] = event.values[2]; + }else if(event.sensor.getType() == Sensor.TYPE_ACCELEROMETER){ + gacc[0] = event.values[0]; + gacc[1] = event.values[1]; + gacc[2] = event.values[2]; + } + if(curTime == 0) { + curTime = System.currentTimeMillis(); + } else if(System.currentTimeMillis() - curTime > 50){ + curTime = System.currentTimeMillis(); + update(gacc, dir, lacc); + invalidate(); + } + } + + @Override + public void onAccuracyChanged(Sensor arg0, int arg1) { + + + } + }; + private Context mContext; + + public void Resume() { + sensorManager.registerListener( + sensorEventListener, + sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), + SensorManager.SENSOR_DELAY_FASTEST + ); + sensorManager.registerListener( + sensorEventListener, + sensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION), + SensorManager.SENSOR_DELAY_FASTEST + ); + sensorManager.registerListener( + sensorEventListener, + sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), + SensorManager.SENSOR_DELAY_FASTEST + ); + } + + public void Destroy() { + sensorManager.unregisterListener(sensorEventListener); + } + + public SatelliteSkyView(Context context) { + super(context); + mContext = context; + sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); + curTime = 0; + int nbgID = R.mipmap.navi_gpssv; + { + // 竖屏 + x = centerX; + y = centerY; + + //信号显示位置设置 + signalTop = 719; + signalBottom = 782; + signalWidth = 13; + signalX[0] =31; + for(int i=1 ; i<12; i++){ + signalX[i] = signalX[i-1]+37; + if(i>=3 && i<=6){ + signalX[i]++; + } + } + } + mDrawable = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, + new int[] { 0xff7bd497, 0x557bd497 });//13d346 + blackPaint = new Paint(); + blackPaint.setStrokeWidth(13); + blackPaint.setAlpha(255); + blackPaint.setARGB(255, 7, 7, 7); + + try { + mbg = decodeResource(this.getResources(), nbgID); + setting = decodeResource(this.getResources(), R.mipmap.navi_gps_set); + number[0] = decodeResource(this.getResources(), R.mipmap.n0); + number[1] = decodeResource(this.getResources(), R.mipmap.n1); + number[2] = decodeResource(this.getResources(), R.mipmap.n2); + number[3] = decodeResource(this.getResources(), R.mipmap.n3); + number[4] = decodeResource(this.getResources(), R.mipmap.n4); + number[5] = decodeResource(this.getResources(), R.mipmap.n5); + number[6] = decodeResource(this.getResources(), R.mipmap.n6); + number[7] = decodeResource(this.getResources(), R.mipmap.n7); + number[8] = decodeResource(this.getResources(), R.mipmap.n8); + number[9] = decodeResource(this.getResources(), R.mipmap.n9); + + lNumber[0] = decodeResource(this.getResources(), R.mipmap.l0); + lNumber[1] = decodeResource(this.getResources(), R.mipmap.l1); + lNumber[2] = decodeResource(this.getResources(), R.mipmap.l2); + lNumber[3] = decodeResource(this.getResources(), R.mipmap.l3); + lNumber[4] = decodeResource(this.getResources(), R.mipmap.l4); + lNumber[5] = decodeResource(this.getResources(), R.mipmap.l5); + lNumber[6] = decodeResource(this.getResources(), R.mipmap.l6); + lNumber[7] = decodeResource(this.getResources(), R.mipmap.l7); + lNumber[8] = decodeResource(this.getResources(), R.mipmap.l8); + lNumber[9] = decodeResource(this.getResources(), R.mipmap.l9); + + water = decodeResource(this.getResources(), R.mipmap.water); + arrow = decodeResource(this.getResources(), R.mipmap.arrow); + sector = decodeResource(this.getResources(), R.mipmap.sector); + dot = decodeResource(this.getResources(), R.mipmap.dot); + + greenDot = decodeResource(this.getResources(), R.mipmap.green_dot); + grayDot = decodeResource(this.getResources(), R.mipmap.gray_dot); + yellowDot = decodeResource(this.getResources(), R.mipmap.yellow_dot); + + float fltWScale = 1.0f * this.getWidth() / mbg.getWidth(); + float fltHScale = 1.0f * this.getHeight() / mbg.getHeight(); + + if(fltWScale > fltHScale){ + fltScale = fltHScale; + } + else{ + fltScale = fltWScale; + } + } catch (Exception ex) { + ex.printStackTrace(); + } + + mGridPaint = new Paint(); + mGridPaint.setColor(0xFFDDDDDD); + mGridPaint.setAntiAlias(true); + mGridPaint.setStyle(Style.STROKE); + mGridPaint.setStrokeWidth(1.0f); + + mBackground = new Paint(); + mBackground.setColor(0xFF4444DD); + + mTextPaint = new Paint(); + mTextPaint.setAntiAlias(true); + mTextPaint.setColor(0xFFFFFFFF); + + mTextPaint.setTextSize(16); + mTextPaint.setTextAlign(Align.CENTER); + + mBitmapAdjustment = 10; + + mLinePaint = new Paint(); + mLinePaint.setColor(0xFFDDDDDD); + mLinePaint.setAntiAlias(true); + mLinePaint.setStyle(Style.STROKE); + mLinePaint.setStrokeWidth(1.0f); + + mBarPaintUsed = new Paint(); + mBarPaintUsed.setColor(0xFF00BB00); + mBarPaintUsed.setAntiAlias(true); + mBarPaintUsed.setStyle(Style.FILL); + mBarPaintUsed.setStrokeWidth(1.0f); + + mBarPaintUnused = new Paint(mBarPaintUsed); + mBarPaintUnused.setColor(0xFFFFCC33); + + mBarPaintNoFix = new Paint(mBarPaintUsed); + mBarPaintNoFix.setStyle(Style.STROKE); + + mBarOutlinePaint = new Paint(); + mBarOutlinePaint.setColor(0xFFFFFFFF); + mBarOutlinePaint.setAntiAlias(true); + mBarOutlinePaint.setStyle(Style.STROKE); + mBarOutlinePaint.setStrokeWidth(1.0f); + } + + public void setLonLat(double lon, double lat) { + this.lon = lon; + this.lat = lat; + } + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + + boolean bReset = false; + int nbgID = R.mipmap.navi_gpssv; + mbg = decodeResource(this.getResources(), nbgID); + + float fltWScale = 1.0f * w / mbg.getWidth(); + float fltHScale = 1.0f * h / mbg.getHeight(); + + if(fltWScale > fltHScale){ + fltScale = fltHScale; + } + else{ + fltScale = fltWScale; + } + if (this.getContext().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { + if (!m_bW) { + return; + } + + bReset = true; + // 竖屏 + text1_x = 111; + text2_x = 280; + text3_x = 540; + text4_x = 94; + text5_x = 334; + text6_x = 565; + text1_y = 95; + text2_y = 95; + text3_y = 95; + text4_y = 208; + text5_y = 208; + text6_y = 208; + + settingX=460; + settingY=670; + + radius = 186; + centerX = 360; + centerY = 638; + x = centerX; + y = centerY; + redR = 295; + sx = -185; + sy = -195; + //信号显示位置设置 + signalTop = 1074; + signalBottom = 1171; + signalWidth = 20; + signalX[0] =48; + for(int i=1 ; i<12; i++){ + signalX[i] = signalX[i-1]+55; + if(i>=3 && i<=6){ + signalX[i]++; + } + } + sector = decodeResource(this.getResources(), R.mipmap.sector); + m_bW = false; + } else { + if (m_bW) { + return; + } + + bReset = true; + // 横屏 + text1_x = 135; + text2_x = 60; + text3_x = 85; + text4_x = 120; + text5_x = 120; + text6_x = 135; + text1_y = 85; + text2_y = 600; + text3_y = 290; + text4_y = 500; + text5_y = 400; + text6_y = 190; + + radius = 172; + centerX = 645; + centerY = 335; + x = centerX; + y = centerY; + sx = -184; + sy = -186; + redR = 275; + //信号显示位置设置 + signalTop = 1193; + signalBottom = 1089; + signalWidth = 20; + signalX[0] =57; + for(int i=1 ; i<12; i++){ + signalX[i] = signalX[i-1]+50; + if(i>=3 && i<=6){ + signalX[i]++; + } + } + m_nScreenWidth = this.getWidth(); + m_nScreenHeight = this.getHeight(); + //nbgID = R.mipmap.navi_gpssv_h; + //sector = decodeResource(this.getResources(), R.mipmap.sector1); + m_bW = true; + } + + if (bReset) { + try { + mbg = decodeResource(this.getResources(), nbgID); + if(bitmap != null){ + bitmap.recycle(); + bitmap = null; + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + super.onSizeChanged(w, h, oldw, oldh); + } + + @Override + protected void onDraw(Canvas canvas) { + + super.onDraw(canvas); + int nDispW = this.getWidth(); + int nDispH = this.getHeight(); + int nBgWidth = mbg.getWidth(); + int nBgHeight = mbg.getHeight(); + + m_nScreenWidth = nDispW; + m_nScreenHeight = nDispH; + + if(bitmap == null){ + bitmap = Bitmap.createBitmap(mbg.getWidth(), mbg.getHeight(), Bitmap.Config.RGB_565); + } + + canvas.setDensity(m_nDensity); + bitmap.setDensity(m_nDensity); + Canvas tmpCanvas = new Canvas(bitmap); + drawView(tmpCanvas); + + int nBgW = (int)(fltScale * nBgWidth); + int nBgH = (int)(fltScale * nBgHeight); + Rect src = new Rect(0, 0, nBgWidth, nBgHeight); + Rect dst = new Rect((nDispW-nBgW)/2, (nDispH-nBgH)/2, (nDispW+nBgW)/2, (nDispH+nBgH)/2); + canvas.drawBitmap(bitmap, src, dst, null); + } + + private void drawView(Canvas canvas){ + if(null == canvas){ + return; + } + canvas.drawBitmap(mbg, 0, 0, null); + canvas.drawBitmap(setting, settingX-setting.getWidth(), settingY-setting.getHeight(), null); + //气泡 + if(!m_bW) { + canvas.drawBitmap(water, x-ballR, y-ballR, null); + } else{ + if(m_AccX > 3){ + canvas.drawBitmap(water, centerX + (y - centerY) - ballR, centerY - (x - centerX) - ballR, null); + flagBall = true; + }else if(m_AccX < -3){ + canvas.drawBitmap(water, centerX - (y - centerY) - ballR, centerY + (x - centerX) - ballR, null); + flagBall = false; + }else{ + if(flagBall) { + canvas.drawBitmap(water, centerX + (y - centerY) - ballR, centerY - (x - centerX) - ballR, null); + } else { + canvas.drawBitmap(water, centerX - (y - centerY) - ballR, centerY + (x - centerX) - ballR, null); + } + } + } + + + //罗盘箭头 + float dirTmp = m_sensorDir; + if(m_bW){ + if(m_AccX > 3){ + m_sensorDir = (m_sensorDir + 90) % 360; + flagDir = true; + }else if(m_AccX < -3){ + m_sensorDir = (m_sensorDir - 90 + 360) % 360; + flagDir = false; + }else{ + if(flagDir) { + m_sensorDir = (m_sensorDir + 90) % 360; + } else { + m_sensorDir = (m_sensorDir - 90 + 360) % 360; + } + } + } + canvas.save(); + canvas.translate(centerX, centerY); + int ndir = (int)m_sensorDir; + m_sensorDir = dirTmp; + int delta = ((360 - ndir) - lastDir + 360) % 360; + if(delta > 2){ + if(delta < 180){ + lastDir = (lastDir + 1 + delta / 3) % 360; + }else{ + lastDir = (lastDir - 1 - (360-delta) / 3+ 360) % 360; + } + } + canvas.rotate(lastDir); + canvas.drawBitmap(arrow, (float)-15, (float)(-redR-45), null); + canvas.restore(); + + //扫描扇形进行旋转 + canvas.save(); + canvas.translate(centerX, centerY); + canvas.rotate((degree += 3)%360); + canvas.drawBitmap(sector, sx, sy, null); + canvas.restore(); + +// GpsStatus gsv = MainInfo.GetInstance().getNaviControler().GetCurGSV(); + + if(gsv == null){ +// gsv = CommonController.getInstance().getLocationMgr(mContext).getGpsStatus(gsv); + } + + if (gsv != null) { + Iterable sats = gsv.getSatellites(); + Iterator iter = sats.iterator(); + + int nMaxNum = gsv.getMaxSatellites(); + if( nMaxNum <= 0) { + return; + } + + mPrns = new int[nMaxNum]; + mElevation = new float[nMaxNum]; + mAzimuth = new float[nMaxNum]; + mSnrs = new float[nMaxNum]; + mX = new float[nMaxNum]; + mY = new float[nMaxNum]; + + int count = 0; + mUsedInFixMask = 0; + + while (iter.hasNext()) { + GpsSatellite sat = (GpsSatellite) iter.next(); + + int mPrn = sat.getPrn(); + float mSnr = sat.getSnr(); + float mElev = sat.getElevation(); + float mAzi = sat.getAzimuth(); + + if (mElev >= 90 || mAzi< 0 || mPrn <= 0 || mSnr < 0) { + continue; + } + + mPrns[count] = mPrn; + mSnrs[count] = mSnr; + mElevation[count] = mElev; + mAzimuth[count] = mAzi; + + if (sat.usedInFix()) { + mUsedInFixMask += 1; + } + + mUsedInFixMask <<= 1; + count++; + } + + mSatellites = count; + computeXY(); + } + + final Paint gridPaint = mGridPaint; + final Paint textPaint = mTextPaint; + + double scale = radius / 90.0; + + for (int i = 0; i < mSatellites; ++i) { + //屏蔽无效星历 + if (mElevation[i] >= 90 || mAzimuth[i] <= 0) { + continue; + } + double a = mElevation[i] * scale; + + int x = (int) Math.round(centerX + (mX[i] * a) - mBitmapAdjustment); + int y = (int) Math.round(centerY + (mY[i] * a) - mBitmapAdjustment); + + if (0 == mUsedInFixMask || mSnrs[i] <= 0) { + //gridPaint.setColor(Color.GRAY); + // 地图上的卫星符号 + canvas.drawBitmap(grayDot, x, y,null); + } else if (0 != (mUsedInFixMask & (1 << (mSatellites - i)))) { + // 可用 + gridPaint.setColor(Color.GREEN); + canvas.drawBitmap(greenDot, x, y,null); + } else { + gridPaint.setColor(Color.YELLOW); + canvas.drawBitmap(yellowDot, x, y,null); + } + } + + + // * GPS状态: 搜索中 已连接 速度 高程 方向 卫星颗数(有效的) 时间 + final int fill = 18; + float slotWidth = 36; + float barWidth = slotWidth - fill; + + // 宽13 11 间隔 11 + if (gsv != null) { + for (int i = 0; i < mSatellites; ++i) { + if (mSnrs[i] < 0) { + mSnrs[i] = 0; +// MainInfo.GetInstance().LogAdd("GPS: i=" + i + "<0"); + }else if(mSnrs[i] >= 70){ + mSnrs[i] = 70; + } + } + } + + int mSatellitesInUsed = 0; + + for (int i = 0; i < mSatellites; ++i) { + if (mPrns[i] <= 0 || mSnrs[i] < 0) { + continue; + } + if(mSatellitesInUsed >= MAX_SATS){ + break; + } + if(!m_bW){//竖屏 + mDrawable.setBounds(new Rect(signalX[i],signalTop,signalX[i] + signalWidth,signalBottom)); + mDrawable.setGradientType(GradientDrawable.LINEAR_GRADIENT); + + + if (0 == mUsedInFixMask) { + mDrawable.setColor(0xff858585); + } else if (0 != (mUsedInFixMask & (1 << (mSatellites - i)))) { + mDrawable.setColor(0xff7bd497); + } else { + mDrawable.setColor(0xffffa300); + } + mDrawable.draw(canvas); + canvas.drawLine(signalX[i] + signalWidth/2, signalTop, signalX[i] + signalWidth/2, signalBottom - mSnrs[i], blackPaint); + int n = mPrns[i]%100/10; + if(n > 0){ + canvas.drawBitmap(lNumber[n], signalX[i]-12, signalBottom -5,null); + canvas.drawBitmap(lNumber[mPrns[i]%10], signalX[i]-1, signalBottom -5 ,null); + }else{ + canvas.drawBitmap(lNumber[mPrns[i]%10], signalX[i]-8, signalBottom -5 ,null); + } + } else { + mDrawable.setBounds(new Rect(signalBottom,signalX[i],signalTop,signalX[i] + signalWidth)); + mDrawable.setGradientType(GradientDrawable.LINEAR_GRADIENT); + mDrawable.draw(canvas); + + canvas.drawLine(signalTop, signalX[i] + signalWidth/2, signalBottom + mSnrs[i],signalX[i] + signalWidth/2, blackPaint); + canvas.drawBitmap(lNumber[mPrns[i]%100/10], signalBottom -38,signalX[i]-10, null); + canvas.drawBitmap(lNumber[mPrns[i]%10], signalBottom-25,signalX[i]-10, null); + } + mSatellitesInUsed++; + + } + + //卫星颗数 + if(mSatellites < 10){ + //canvas.drawBitmap(number[0], text1_x, text1_y,null); + canvas.drawBitmap(number[mSatellites], text1_x, text1_y,null); + } + else{ + canvas.drawBitmap(number[mSatellites%100/10], text1_x, text1_y,null); + canvas.drawBitmap(number[mSatellites%10], text1_x+25, text1_y,null); + } + //时间 + Date date = new Date(); + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); + String s = sdf.format(date); + //System.out.println(s); + canvas.drawBitmap(number[(int)(s.charAt(0)-'0')], text2_x, text2_y,null); + canvas.drawBitmap(number[(int)(s.charAt(1)-'0')], text2_x+20, text2_y,null); + canvas.drawBitmap(dot, text2_x+40, text2_y-2,null); + canvas.drawBitmap(dot, text2_x+40, text2_y+10,null); + canvas.drawBitmap(number[(int)(s.charAt(3)-'0')], text2_x+55, text2_y,null); + canvas.drawBitmap(number[(int)(s.charAt(4)-'0')], text2_x+75, text2_y,null); + canvas.drawBitmap(dot, text2_x+95, text2_y-2,null); + canvas.drawBitmap(dot, text2_x+95, text2_y+10,null); + canvas.drawBitmap(number[(int)(s.charAt(6)-'0')], text2_x+110, text2_y,null); + canvas.drawBitmap(number[(int)(s.charAt(7)-'0')], text2_x+130, text2_y,null); + //方向角 + dirX = ((dirX % 360) + 360) % 360; + s = String.valueOf(dirX); + int startLocation = text3_x; + for(int i = 0 ; i < s.length() ; i++){ + if(s.charAt(i) == '.'){ + canvas.drawBitmap(dot, startLocation, text3_y+12,null); + startLocation +=15 ; + canvas.drawBitmap(number[s.charAt(i+1)-'0'], startLocation, text3_y,null); + break; + } + canvas.drawBitmap(number[s.charAt(i)-'0'], startLocation, text3_y,null); + startLocation +=20 ; + } + //俯仰角 + s = String.valueOf(dirY); + startLocation = text4_x; + for(int i = 0 ; i < s.length() ; i++){ + if(s.charAt(i) == '.'){ + canvas.drawBitmap(dot, startLocation, text4_y+12,null); + startLocation +=15 ; + canvas.drawBitmap(number[s.charAt(i+1)-'0'], startLocation, text4_y,null); + break; + } + canvas.drawBitmap(number[s.charAt(i)-'0'], startLocation, text4_y,null); + startLocation +=20 ; + } + //加速度 + s= String.valueOf(acc); + startLocation = text5_x; + for(int i = 0; i < s.length(); i++ ){ + if(s.charAt(i) == '.'){ + canvas.drawBitmap(dot, startLocation, text5_y+12,null); + startLocation +=15 ; + canvas.drawBitmap(number[s.charAt(i+1)-'0'], startLocation, text5_y,null); + break; + } + canvas.drawBitmap(number[s.charAt(i)-'0'], startLocation, text5_y,null); + startLocation += 20; + } + + //速度 + s= String.valueOf(mSpeed); + startLocation = text6_x - (s.length()-1) * 10; + for(int i = 0; i < s.length() ; i++ ){ + if(s.charAt(i) == '.') { + canvas.drawBitmap(dot, startLocation, text6_y+12,null); + } else { + canvas.drawBitmap(number[s.charAt(i)-'0'], startLocation, text6_y,null); + } + startLocation += 20; + } + } + + private Bitmap decodeResource(Resources resources, int id) { + BitmapFactory.Options opts = new BitmapFactory.Options(); + opts.inTargetDensity = m_nDensity; + return BitmapFactory.decodeResource(resources, id, opts); + } + + public void update(float[] a, float dir[], float[] la) { + m_AccX = a[0]; + m_AccY = a[1]; + m_sensorDir = dir[0]; + if(delayCount % 20 == 0){ + acc = (float) Math.sqrt(la[0]*la[0] + la[1]*la[1] + la[2]*la[2]); + dirX = dir[0]; + dirY = (-dir[1] + 360) % 360; + delayCount = 0; + } + delayCount++; + if(!start){ + if(count == 0){ + initA[0] = a[0]; + initA[1] = a[1]; + count++; + return; + }else if(count < 10){ + initA[0] = (float) (initA[0] * 0.8 + a[0] * 0.2); + initA[1] = (float) (initA[1] * 0.8 + a[1] * 0.2); + count++; + return; + }else{ + start = true; + lastA[0] = initA[0]; + lastA[1] = initA[1]; + } + } + float mod = (a[0] - lastA[0]) * (a[0] - lastA[0]) + (a[1] - lastA[1]) * (a[1] - lastA[1]); + if(mod > 0.1){ + nx = centerX + (a[0] - initA[0]) * 70; + ny = centerY - (a[1] - initA[1]) * 70; + double d = Math.sqrt((nx - x) * (nx - x) + (ny - y) * (ny - y)); + dx = (nx - x) / d; + dy = (ny - y) / d; + lastA[0] = a[0]- initA[0]; + lastA[1] = a[1]- initA[1]; + + } + float dist = (float) Math.sqrt((x-nx)*(x-nx) + (y-ny)*(y-ny)); + if(dist > 15){ + x += dx * v; + y += dy * v; + } + float temp = (float) Math.sqrt((x-centerX)*(x-centerX) + (y-centerY)*(y-centerY)); + + if(temp > radius){ + x = radius * (x-centerX) / temp; + y = radius * (y-centerY) / temp; + x += centerX; + y += centerY; + } + } + + @Override + public boolean dispatchTouchEvent(MotionEvent ev) { + + switch( ev.getAction() ) + { + case MotionEvent.ACTION_DOWN: + int m_nX = (int)ev.getX(); + int m_nY = (int)ev.getY(); + int nDisToCenter =(int) Math.sqrt((m_nScreenWidth/2 - m_nX) * (m_nScreenWidth/2 - m_nX) + (m_nScreenHeight/2 - m_nY) * (m_nScreenHeight/2 - m_nY)); + if(nDisToCenter < radius){ + x = centerX; + y = centerY; + initA[0] = m_AccX; + initA[1] = m_AccY; + } + int nBgW = (int)(fltScale * mbg.getWidth()); + int nBgH = (int)(fltScale * mbg.getHeight()); + float x = (m_nX) / fltScale - (this.getWidth() - nBgW)/2; + float y = (m_nY ) / fltScale -(this.getHeight() - nBgH)/2; + if( xsettingX - setting.getWidth() && ysettingY-setting.getHeight()){ + this.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); +// MainInfo.GetInstance().getNaviControler().removeDialog(DialogManager.DIALOG_GPS_TEST_MAIN); +// MainInfo.GetInstance().getNaviControler().showDialog(DialogManager.DIALOG_GPS_TEST_MAIN); +// MainInfo.GetInstance().getAppInfo().addActionInfo("NaviControler", "gpstest", null); + } + break; + + case MotionEvent.ACTION_UP: + break; + + case MotionEvent.ACTION_MOVE: + break; + } + return true; + } + + public int getGPSSatellites() { + return mSatellites; + } + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/provider/MapDataHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/provider/MapDataHelper.kt new file mode 100644 index 0000000000..5ce02f0d26 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/provider/MapDataHelper.kt @@ -0,0 +1,34 @@ +package com.zhidaoauto.map.sdk.inner.provider + +import com.alibaba.fastjson.JSON +import com.zhidaoauto.map.sdk.inner.obj.ResultData +import com.zhidaoauto.map.sdk.open.routeinfo.SPRouteLine + + +class MapDataHelper private constructor() { + val TAG = javaClass.simpleName + + companion object { + val instance: MapDataHelper by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) { + MapDataHelper() } + } + + + + fun dealValue(key: String,value:String): String { + val result = ResultData() + result.setKey(key) + result.setValue(value) + return JSON.toJSONString(result) + } + + + fun dealValue(key: String, value:ArrayList): String { + val result = ResultData() + result.setKey(key) + result.setValue(JSON.toJSONString(value)) + return JSON.toJSONString(result) + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/provider/MapDataProvider.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/provider/MapDataProvider.kt new file mode 100644 index 0000000000..469abdae94 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/provider/MapDataProvider.kt @@ -0,0 +1,116 @@ +package com.zhidaoauto.map.sdk.inner.provider + +import android.content.ContentProvider +import android.content.ContentValues +import android.content.Context +import android.content.UriMatcher +import android.database.Cursor +import android.database.MatrixCursor +import android.net.Uri +import android.text.TextUtils +import android.util.Log +import androidx.annotation.NonNull +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.common.ConstantExt +import com.zhidaoauto.map.sdk.inner.road.RoadHelper +import com.zhidaoauto.map.sdk.open.data.MapDataApi +import org.jetbrains.annotations.Nullable + +class MapDataProvider : ContentProvider() { + + private val TAG = javaClass.simpleName + private var mContext: Context? = null + + override fun onCreate(): Boolean { + mContext = context + if (CompileConfig.DEBUG) { + Log.i(TAG, "queryop MapDataProvider onCreate") + } + mMatcher.addURI(context.packageName+ConstantExt.AUTHORITY, ConstantExt.STR_QUERY, ConstantExt.CODE_QUERY) + + return true + } + + override fun update( + uri: Uri, + values: ContentValues?, + selection: String?, + selectionArgs: Array? + ): Int { + return 0 + } + + override fun delete(uri: Uri, selection: String?, selectionArgs: Array?): Int { + return 0 + } + + override fun insert(uri: Uri, values: ContentValues?): Uri? { + return uri + } + + override fun query( + @NonNull uri: Uri, projection: Array?, @Nullable key: String?, + @Nullable selectionArgs: Array?, @Nullable sortOrder: String? + ): Cursor? { + if (CompileConfig.DEBUG) { + Log.i(TAG, "queryop = key:${key}") + } + var cursor: MatrixCursor = MatrixCursor(arrayOf("value")) + if (TextUtils.isEmpty(key)) { + return cursor + } + var result: String? = null + + when (mMatcher.match(uri)) { + ConstantExt.CODE_QUERY -> { + if (CompileConfig.DEBUG) { + Log.i(TAG, "queryop key= ${key}") + } + var array = key!!.split(",") + if (array.size < 2) { + return cursor + } + var coor = 0 + if(array.size >2){ + coor = array[2].toInt() + } + var roadType = 5 + if(array.size >3){ + roadType = array[3].toInt() + } + MapDataApi.startZeus(context) + Log.i(TAG,"roadop-queryop-start:query:getRouteInfo") + val start = System.currentTimeMillis() + var value = RoadHelper.getInstance()?.getRoadInfo(array[0].toFloat(),array[1].toFloat(),coor,roadType) + Log.i(TAG,"roadop-queryop-coor:${coor}-end:${(System.currentTimeMillis()-start)}ms") + if(value == null || value.isEmpty()){ + if (CompileConfig.DEBUG) { + Log.i(TAG, "queryop result= null") + } + return cursor + } + result = MapDataHelper.instance.dealValue(key!!, value!!) + + if (CompileConfig.DEBUG) { + Log.i(TAG, "queryop result= ${result}") + } + cursor.addRow(arrayOf(result)) + } + } + return cursor + } + + override fun getType(@NonNull uri: Uri): String? { + return null + } + + companion object { + + private val mMatcher: UriMatcher + + init { + mMatcher = UriMatcher(UriMatcher.NO_MATCH) + } + } + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/proxy/CommonProxy.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/proxy/CommonProxy.kt new file mode 100644 index 0000000000..e0bcfc0f23 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/proxy/CommonProxy.kt @@ -0,0 +1,44 @@ +package com.zhidaoauto.map.sdk.inner.proxy + +import android.util.Log +import com.zhidaoauto.map.sdk.inner.abs.ILonLatProxy +import com.zhidaoauto.map.sdk.inner.common.MapHelper +import com.zhidaoauto.map.sdk.open.exception.MapException + +class CommonProxy { + + private val TAG = javaClass.simpleName + companion object { + var mInstance: CommonProxy? = null + fun getInstance(): CommonProxy { + if (mInstance == null) { + synchronized(CommonProxy.javaClass) { + if (mInstance == null) { + mInstance = CommonProxy() + } + } + } + return mInstance!! + } + } + + private var mLonLatProxy: ILonLatProxy? = null + + fun setLonLatProxy(lonLatProxy: ILonLatProxy) { + if(MapHelper.debug){ + Log.i(TAG,"initop setLonLatProxy") + } + mLonLatProxy = lonLatProxy + } + + fun getLonLatProxy(): ILonLatProxy { + if(mLonLatProxy == null){ + mLonLatProxy = LonLatProxy() + } + mLonLatProxy?.let{ + return it + } + throw MapException(MapException.AUTO_INIT_ERROR_LONLATPROXY) + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/proxy/LonLatProxy.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/proxy/LonLatProxy.kt new file mode 100644 index 0000000000..1c473c8409 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/proxy/LonLatProxy.kt @@ -0,0 +1,75 @@ +package com.zhidaoauto.map.sdk.inner.proxy + +import android.util.Log +import com.autonavi.nge.map.LonLat +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.ILonLatProxy +import com.zhidaoauto.map.sdk.inner.common.MapHelper +import com.zhidaoauto.map.sdk.inner.utils.TransformUtils +import com.zhidaoauto.map.sdk.open.MapParams +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class LonLatProxy : ILonLatProxy { + + val TAG = javaClass.simpleName + /** + * 转换为外部使用坐标 + */ + override fun switchLonLat(lonLat: LonLat): LonLatPoint { + var array: DoubleArray? = null; + when (MapHelper.mMapParams.getCoordinateType()) { + MapParams.COORDINATETYPE_GCJ02 -> { + array = TransformUtils.transformWgsToGcj(lonLat.lat, lonLat.lon) + + } + MapParams.COORDINATETYPE_BD09 -> { + array = TransformUtils.transformWgs84ToGcj02(lonLat.lat, lonLat.lon) + array = TransformUtils.transformGcj02ToBd09(array[1], array[0]) + } + else -> { + array = null + } + } + + var lonLatPoint = LonLatPoint(lonLat.lon, lonLat.lat) + array?.let { + lonLatPoint = LonLatPoint(it[0], it[1]) + } + if (CompileConfig.DEBUG) { + Log.i(TAG, "lonlatop--toOuter-before:${lonLat},after:${lonLatPoint}") + } + return lonLatPoint + } + + /** + * 转换为内部使用坐标 + */ + override fun switchLonLat(lonLatPoint: LonLatPoint): LonLat { + var array: DoubleArray? = null + + when (MapHelper.mMapParams.getCoordinateType()) { + MapParams.COORDINATETYPE_GCJ02 -> { + array = TransformUtils.transformGcj02toWgs84( + lonLatPoint.latitude, + lonLatPoint.longitude + ) + } + MapParams.COORDINATETYPE_BD09 -> { + array = TransformUtils.transformBd09ToGcj02(lonLatPoint.latitude, lonLatPoint.longitude) + array = TransformUtils.transformGcj02toWgs84(array[1], array[0]) + } + else -> { + array = null + } + } + var lonLat = LonLat(lonLatPoint.longitude, lonLatPoint.latitude) + array?.let { + lonLat = LonLat(it[0], it[1]) + } + if (CompileConfig.DEBUG) { + Log.i(TAG, "lonlatop--toInner-before:${lonLatPoint},after:${lonLat}") + } + return lonLat + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/road/RoadHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/road/RoadHelper.kt new file mode 100644 index 0000000000..e936112644 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/road/RoadHelper.kt @@ -0,0 +1,1059 @@ +package com.zhidaoauto.map.sdk.inner.road + +import android.text.TextUtils +import android.util.Log +import com.autonavi.nge.MapBox +import com.autonavi.nge.hdmap.HDMapProvider +import com.autonavi.nge.map.LonLat +import com.autonavi.nge.routeinfo.RouteInfoProvider +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.IRoadData +import com.zhidaoauto.map.sdk.inner.aspect.KotlinExtern.toTenDecimalsStr +import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +import com.zhidaoauto.map.sdk.inner.utils.ConcurrentLRUCache +import com.zhidaoauto.map.sdk.open.abs.IResult +import com.zhidaoauto.map.sdk.open.data.CityInfo +import com.zhidaoauto.map.sdk.open.data.MapDataApi +import com.zhidaoauto.map.sdk.open.data.SinglePointRoadInfo +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.road.* +import com.zhidaoauto.map.sdk.open.routeinfo.RoadInfo + + +class RoadHelper { + + val TAG = javaClass.simpleName + + private var routeInfoProvider: RouteInfoProvider + private var hdMapProvider: HDMapProvider + private var mapBox: MapBox + //GPS匹配最小距离 + private val minGPSDistance = 15f; + //GPS匹配最小角度 + private val minGPSAngle = 15f; + //RTK匹配最小距离 + private val minRTKDistance = 5f; + //RTK匹配最小角度 + private val minRTKAngle = 5f; + + private val MAX_CACHE_SIZE = 20 // Set the maximum size of the cache + + //限速相关 + var lastSpeed = 60 + + + + private constructor() { + routeInfoProvider = RouteInfoProvider() + hdMapProvider = HDMapProvider() + mapBox = MapBox() + } + + fun release(){ + + RouteInfoProvider.release() + if(CompileConfig.DEBUG){ + Log.w(TAG, "destroyop--:RouteInfoProvider.destory") + } + hdMapProvider.release() + if(CompileConfig.DEBUG){ + Log.w(TAG, "destroyop--:hdMapProvider.destory") + } + RoadResultController.instance.exit() + if(CompileConfig.DEBUG){ + Log.w(TAG, "destroyop--:RoadResultController.destory") + } + mapBox.llaRelease(); + if(CompileConfig.DEBUG){ + Log.w(TAG, "destroyop--:mapBox.destory") + } + sInstance = null + } + +// companion object { +// val instance: RoadHelper by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { RoadHelper() } +// } + + companion object{ + var sInstance: RoadHelper? = null + + @Synchronized + fun getInstance(): RoadHelper? { + if (sInstance == null) { + sInstance = RoadHelper() + } + return sInstance + } + } + + /** + * 获取道路信息 + * coor 坐标系,0 GPS ,1 gcj + */ + @Deprecated(message = "replace getLaneInfo") + fun getRoadInfo( + centerLon: Float, + centerLat: Float, coor: Int, roadType: Int + ): String { + if (CompileConfig.DEBUG) { + Log.i(TAG, "roadop getRoadInfo") + } + return routeInfoProvider.getRouteInfo(centerLon, centerLat, coor, roadType); + } + + + /** + * 获取行车方向 + * + */ + @Deprecated(message = "replace getCenterLine") + fun getRouteAngle(startLon: Float, startLat: Float, endLon: Float, endLat: Float): Float { + if (CompileConfig.DEBUG) { + Log.i(TAG, "roadop getRouteAngle") + } + return routeInfoProvider.getRouteAngle(startLon, startLat, endLon, endLat) + } + + /** + * 获取道路关键点数据 + * + */ + @Deprecated(message = "replace getLaneInfo") + fun getMatchRoadInfo(allPoint: DoubleArray, bGetAllPoints: Boolean): DoubleArray? { + if (CompileConfig.DEBUG) { + Log.i(TAG, "roadop getMatchRoadInfo") + } + val result = routeInfoProvider.matchPointOnRoad(allPoint, bGetAllPoints) + if (CompileConfig.DEBUG) { + Log.i(TAG, "roadop getMatchRoadInfo-result:${result}") + } + return result + } + + /** + * 获取点与道路边界的距离 + * + */ + fun getOffRoadDistance(lon: Double, lat: Double, angle: Float): Double { + if (CompileConfig.DEBUG) { + Log.i(TAG, "roadop getOffRoadDistance") + } + val result = routeInfoProvider.getOffRoadDistance(lon,lat,angle.toDouble()) + if (CompileConfig.DEBUG) { + Log.i(TAG, "roadop getOffRoadDistance-result:${result}") + } + return result + } + + + /** + * 转换道路信息经纬度 + */ + private fun dealLonLatList(data: ArrayList): ArrayList { + var result = ArrayList() + for (lonLat in data) { + result.add(CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLat)) + } + return result + } + + + /** + * 获取匹配道路 + * + */ + fun getSinglePointMatchRoad(lon: Double, lat: Double, angle: Float, isGPS: Boolean,isRTK:Boolean): SinglePointRoadInfo? { + + var result = "" + var rulerDistance = minGPSDistance + var rulerAngle = minGPSAngle + if(isRTK){ + rulerDistance = minRTKDistance + rulerAngle = minRTKAngle + } + if (!isGPS) { + val lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(LonLatPoint(lon.toDouble(), lat.toDouble())) + if (CompileConfig.DEBUG) { + Log.i(TAG, "roadop--gisop getSinglePointMatchRoad:${lonLat.lon},${lonLat.lat},${angle},${isGPS}") + } + result = routeInfoProvider.matchHDSinglePointOnRoad(lonLat.lon, lonLat.lat, angle,rulerDistance,rulerAngle,!isRTK) + } else { + if (CompileConfig.DEBUG) { + Log.i(TAG, "roadop--gisop getSinglePointMatchRoad:${lon},${lat},${angle},${isGPS}") + } + result = routeInfoProvider.matchHDSinglePointOnRoad(lon, lat, angle,rulerDistance,rulerAngle,!isRTK) + } + if (CompileConfig.DEBUG) { + Log.i(TAG, "roadop--gisop getSinglePointMatchRoad:result:${result}") + } + var singlePointRoadInfo: SinglePointRoadInfo? = null + if (!TextUtils.isEmpty(result)) { + val array = result.split(":") + if (CompileConfig.DEBUG) { + Log.i(TAG, "roadop--gisop getSinglePointMatchRoad:array:${array.size}") + } + if (array.size >= 14) { + singlePointRoadInfo = SinglePointRoadInfo() + singlePointRoadInfo.tileId = array[1].toLong() + singlePointRoadInfo.roadId = array[3].toLong() + singlePointRoadInfo.laneNo = array[5].toInt() + singlePointRoadInfo.laneWidth = array[7].toFloat() + val coordsStr = array[9] + val coordsList: ArrayList = parseLonLatPointNoAngleStr(coordsStr) + singlePointRoadInfo.coords = coordsList + val leftCoordsStr = array[11] + val leftCoordsList: ArrayList = parseLonLatPointStr(leftCoordsStr) + singlePointRoadInfo.leftCoords = leftCoordsList + singlePointRoadInfo.leftLen = array[13].toFloat() + } + } + if (CompileConfig.DEBUG) { + Log.i(TAG, "roadop--gisop getSinglePointMatchRoad--:${result}") + } + return singlePointRoadInfo + } + + /** + * 解析经纬度方向字符串 + */ + private fun parseLonLatPointStr(coordsStr: String): ArrayList { + val array = coordsStr.split(",") + val list = ArrayList() + var lonLatPoint: LonLatPoint + if (array.size % 3 != 0) { + return list + } + for (i in 0..array.size - 1 step 3) { + lonLatPoint = LonLatPoint() + lonLatPoint.longitude = array[i].toDouble() + lonLatPoint.latitude = array[i + 1].toDouble() + if (array[i + 2].equals("nan")) { + lonLatPoint.angle = Double.NaN + } else { + lonLatPoint.angle = array[i + 2].toDouble() + } + list.add(lonLatPoint) + } + return list + } + + /** + * 解析经纬度字符串 + */ + private fun parseLonLatPointNoAngleStr(coordsStr: String): ArrayList { + val array = coordsStr.split(",") + val list = ArrayList() + var lonLatPoint: LonLatPoint + if (array.size % 2 != 0) { + return list + } + for (i in 0..array.size - 1 step 2) { + lonLatPoint = LonLatPoint() + lonLatPoint.longitude = array[i].toDouble() + lonLatPoint.latitude = array[i + 1].toDouble() + list.add(lonLatPoint) + } + return list + } + + fun getLaneInfo(tileId: Long, routeId: Int): ArrayList { + if(CompileConfig.DEBUG){ + Log.d(TAG, "roadop--getLaneInfo--routeId: ${routeId}") + } + val data = hdMapProvider.getLaneCenterLine(tileId.toInt(), routeId) + val subLaneInfos = ArrayList() + if (data != null) { + for (hdMapBlock in data) { + val subLaneInfo = Lane() + subLaneInfo.laneId = hdMapBlock.getLaneNo() + subLaneInfo.laneWidth = hdMapBlock.getWidth() + val list = ArrayList() + val lonlats = hdMapBlock.getLonLats() + lonlats?.let { + for (lonlat in lonlats) { + val lon = lonlat?.getLon() + val lat = lonlat?.getLat() + val lonLatPoint = LonLatPoint(lon!!, lat!!) + list.add(lonLatPoint) + } + } + subLaneInfo.laneLatLonPoints = list + subLaneInfos.add(subLaneInfo) + } + } + if(CompileConfig.DEBUG){ + Log.d(TAG, "roadop--getLaneInfo--result: ${subLaneInfos}") + } + return subLaneInfos + } + + fun getRoadSign(tileId: Long): ArrayList{ + val data = hdMapProvider.getTrafficSign(tileId.toInt()) + val roadSignList = ArrayList() + if(data != null){ + for(trafficSign in data){ + val roadSign = RoadSign() + roadSign.id = trafficSign.id + roadSign.color = trafficSign.color + roadSign.content = trafficSign.content + roadSign.roadId = trafficSign.roadId + roadSign.shape = trafficSign.shape + roadSign.tileId = trafficSign.tileId + roadSign.type = trafficSign.type + val postion = ArrayList() + for (trafficSignPosition in trafficSign.position){ + val roadSignPostion = RoadSignPostion() + roadSignPostion.lon = trafficSignPosition.lon + roadSignPostion.lat = trafficSignPosition.lat + roadSignPostion.hight = trafficSignPosition.hight + postion.add(roadSignPostion) + } + roadSign.position = postion + roadSignList.add(roadSign) + } + + } + + return roadSignList + + } + + private val roadLimitSpeedCache = ConcurrentLRUCache(MAX_CACHE_SIZE) + + fun getRoadLimitSpeed(dLon: Double, dLat: Double, fAngle: Float,call:IResult) { + // Use input parameters to create a unique cache key + val key = "$dLon,$dLat,$fAngle" + + // Get cached value from LinkedHashMap + val cachedValue = roadLimitSpeedCache.get(key) + if (cachedValue != null) { + // If cached value exists, return it directly + call.result(0,cachedValue) + return + } + + // If cached value does not exist, call llaGetRoadLimitSpeed method to get new value + RoadResultController.instance.addRoadResultListener("llaGetRoadLimitSpeed_${dLon.toTenDecimalsStr()}_${dLat.toTenDecimalsStr()}_${fAngle.toTenDecimalsStr()}",object :IRoadData{ + override fun result(code: Int, result: String?) { + if(CompileConfig.DEBUG){ + Log.i(TAG, "roadop--getRoadLimitSpeed-code:$code-result: $result") + } + if (TextUtils.isEmpty(result)){ + call.result(1,null) + return + } + result?.let { + val array = result.split(",") + if(array.size < 3){ + call.result(1,null) + return + } + var roadInfo = RoadInfo() + roadInfo.tileID = array[0].toLong() + roadInfo.roadID = array[1].toLong() + roadInfo.speed = array[2].toInt() + if(roadInfo.speed>250){ + roadInfo.speed = lastSpeed + }else{ + lastSpeed = roadInfo.speed + } + + // Add new value to LinkedHashMap + roadLimitSpeedCache.put(key,roadInfo) + call.result(0,roadInfo) + return + } + call.result(1,null) + } + + }) + mapBox.llaGetRoadLimitSpeed(dLon, dLat, fAngle) + } + + fun getZebraLine(lon: Double,lat: Double,angle: Float,call:IResult){ + RoadResultController.instance.addRoadResultListener("llaGetZebraLine_${lon.toTenDecimalsStr()}_${lat.toTenDecimalsStr()}_${angle.toTenDecimalsStr()}",object :IRoadData{ + override fun result(code: Int, result: String?) { + if(CompileConfig.DEBUG){ + Log.i(TAG, "roadop--getZebraLine-code:$code-result: $result") + } + call.result(code,result) + } + + }) + mapBox.llaGetZebraLine(lon,lat,angle) + } + + + fun getTrafficLight(lon: Double,lat: Double,angle: Float,call:IResult){ + RoadResultController.instance.addRoadResultListener("llaGetTrafficLight_${lon.toTenDecimalsStr()}_${lat.toTenDecimalsStr()}_${angle.toTenDecimalsStr()}",object :IRoadData{ + override fun result(code: Int, result: String?) { + if(CompileConfig.DEBUG){ + Log.i(TAG, "roadop--getTrafficLight-code:$code-result: $result") + } + call.result(code,result) + } + + }) + mapBox.llaGetTrafficLight(lon,lat,angle) + } + + // Set the maximum size of the cache to be MAX_CACHE_SIZE items. + private val centerLineSingleCache = ConcurrentLRUCache(MAX_CACHE_SIZE) + + /** + * This function returns the center line of a given road segment. + * + * @param dLon The longitude of the starting point of the road segment. + * @param dlat The latitude of the starting point of the road segment. + * @param fAngle The angle of the road segment. + * @return The center line of the road segment. + */ + + fun getCenterLine(dLon: Double, dLat: Double, fAngle: Float,call: IResult) { + // Generate a unique key for this request. + val cacheKey = "$dLon:$dLat:$fAngle" + + // If the center line for this request is already in the cache, return it. + centerLineSingleCache.get(cacheKey)?.let { centerLine -> + call.result(0,centerLine) + return + } + + // If the center line is not in the cache, fetch it from the server. + RoadResultController.instance.addRoadResultListener("llaGetCenterLine_${dLon.toTenDecimalsStr()}_${dLat.toTenDecimalsStr()}_${fAngle.toTenDecimalsStr()}",object :IRoadData{ + override fun result(code: Int, result: String?) { + if(CompileConfig.DEBUG){ + Log.i(TAG, "roadop--getCenterLine-code:$code-result: $result") + } + if (TextUtils.isEmpty(result)){ + call.result(1,null) + return + } + result?.let { + val array = result.split(",") + if (array.size > 5) { + val centerLine = CenterLine( + array[0], array[1], array[2], array[3], + (4..array.size - 1 step 2).map { i -> + LonLatPoint(array[i].toDouble(), array[i + 1].toDouble()) + }.toMutableList() + ) + + // Calculate the angle of the center line. + val pMatch = LonLatPoint() + MapDataApi.GetDisFromPointToLine(LonLatPoint(dLon, dLat), ArrayList(centerLine.points), pMatch, 1) + centerLine.angle = pMatch.angle + + // Add the center line to the cache. + centerLineSingleCache.put(cacheKey,centerLine) + // Return the center line. + call.result(0,centerLine) + return + } + + } + call.result(0,null) + } + + }) + mapBox.llaGetCenterLine(dLon, dLat, fAngle) + } + + + // Use LRU cache to store previously computed results + private val stopLineCache = ConcurrentLRUCache(MAX_CACHE_SIZE) + + /** + * Get the stop line information for a given longitude, latitude, and angle. + * This function returns a StopLine object that contains information such as tile ID, road ID, lane ID, length, and points. + * It also calculates the distance from the current location to the stop line using MapDataApi.getNearstFromPointToSegment function. + * + * @param dLon The longitude of the point of interest. + * @param dlat The latitude of the point of interest. + * @param fAngle The angle in degrees of the vehicle at the point of interest. + * @return A StopLine object that contains information about the stop line, or null if no stop line was found. + */ + + fun getStopLine(dLon: Double, dLat: Double , fAngle: Float,call: IResult) { + + val key = "$dLon,$dLat,$fAngle" + + // Check if the result is in the cache + val cachedResult = stopLineCache.get(key) + if (cachedResult != null) { + call.result(0,cachedResult) + return + } + + // Get the stop line information from the MapBox SDK. + RoadResultController.instance.addRoadResultListener("llaStopLine_${dLon.toTenDecimalsStr()}_${dLat.toTenDecimalsStr()}_${fAngle.toTenDecimalsStr()}",object :IRoadData{ + override fun result(code: Int, result: String?) { + if(CompileConfig.DEBUG){ + Log.i(TAG, "roadop--getStopLine-code:$code-result: $result") + } + if (TextUtils.isEmpty(result)){ + call.result(1,null) + return + } + result?.let { + var result = it + // Remove the trailing comma if present. + if (result.endsWith(",")) { + result = result.trim(',') + } + + // Parse the result into an array of strings. + val array = result.split(",") + + // Create a new StopLine object. + var stopLine = StopLine() + + // If the array contains at least six elements, parse them into the StopLine object. + if (array != null && array.size > 5) { + stopLine.tile_id = array[0] + var roadId = array[1] + if (array[1].endsWith("*")) { + roadId = array[1].trim('*') + } + stopLine.road_id = roadId.split("*") + var laneId = array[2] + if (array[2].endsWith("*")) { + laneId = array[2].trim('*') + } + stopLine.lane_id = laneId.split("*") + stopLine.length = array[3].toDouble() + var points = ArrayList() + for (i in 4..array.size - 1 step 2) { + var lonLatPoint = LonLatPoint(array[i].toDouble(), array[i + 1].toDouble()) + points.add(lonLatPoint) + } + stopLine.points = points + } + + // Print the stop line object to the log if debugging is enabled. + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--getStopLine--stopLine: ${stopLine}") + } + stopLineCache.put(key,stopLine) + call.result(0,stopLine) + return + } + call.result(1,null) + + } + + }) + mapBox.llaStopLine(dLon, dLat, fAngle) + } + + + // Use LRU cache to store previously computed results + private val roadRectCache = ConcurrentLRUCache(MAX_CACHE_SIZE) + + /** + * Computes the road rectangle information at the given longitude, latitude and angle. + * @param lon The longitude value. + * @param lat The latitude value. + * @param angle The angle value. + * @return The road rectangle information. + */ + + fun getRoadRect(lon: Double, lat: Double, angle: Float,call : IResult) { + val key = "$lon,$lat,$angle" + + // Check if the result is in the cache + val cachedResult = roadRectCache.get(key) + if (cachedResult != null) { + call.result(0,cachedResult) + return + } + + // Compute the result if it's not in the cache + RoadResultController.instance.addRoadResultListener("llaMergedRoadRect_${lon.toTenDecimalsStr()}_${lat.toTenDecimalsStr()}_${angle.toTenDecimalsStr()}",object :IRoadData{ + override fun result(code: Int, result: String?) { + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--getRoadRect--code:${code},result: $result") + } + if (TextUtils.isEmpty(result)){ + call.result(1,null) + return + } + result?.let { + val array = result.split(",") + val roadRectInfos = RoadRectInfos() + val rectList = ArrayList() + if (array != null && array.size >= 9) { + roadRectInfos.angle = array[0].toDouble() + for (i in 1..array.size - 1 step 8) { + val rect = RoadRect() + rect.topLeft = LonLatPoint(array[i].toDouble(), array[i + 1].toDouble()) + rect.topRight = LonLatPoint(array[i + 2].toDouble(), array[i + 3].toDouble()) + rect.bottomLeft = LonLatPoint(array[i + 4].toDouble(), array[i + 5].toDouble()) + rect.bottomRight = LonLatPoint(array[i + 6].toDouble(), array[i + 7].toDouble()) + rectList.add(rect) + } + } + roadRectInfos.roadRects = rectList + + // Add the result to the cache + roadRectCache.put(key,roadRectInfos) + call.result(0,roadRectInfos) + return + } + call.result(1,null) + + } + + }) + mapBox.llaMergedRoadRect(lon, lat, angle) + } + + + fun modifyRedisFileVersion(version:Int){ + mapBox.modifyRedisFileVersion(version) + } + + fun updateCacheFile(){ + mapBox.updateCacheFile() + } + + + //获取行驶方向一定长度的中心线 + //dDis:正 行驶方向前方距离 负 行驶方向后方距离 + + fun getCenterLineRange(dLon: Double, dlat: Double , fAngle: Float, fDis: Float,call:IResult){ + // Combine the four parameters into a single string as the cache key + val cacheKey = "$dLon,$dlat,$fAngle,$fDis" + + // Check if the result is already cached + // If yes, return the cached result + centerLineCache.get(cacheKey)?.let { + call.result(0,it) + return + } + RoadResultController.instance.addRoadResultListener("llaGetCenterLineRange_${dLon.toTenDecimalsStr()}_${dlat.toTenDecimalsStr()}_${fAngle.toTenDecimalsStr()}_${fDis.toTenDecimalsStr()}",object :IRoadData{ + override fun result(code: Int, result: String?) { + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--getCenterLineRange--code:${code},result: $result") + } + if (TextUtils.isEmpty(result)){ + call.result(1,null) + return + } + result?.let { + var result = it + if(result.endsWith(",")){ + result = result.trim(',') + } + val array = result.split(",") + + if(array != null && array.size > 5) { + var centerLine = CenterLine() + centerLine.id = array[0] + centerLine.tile_id = array[1] + centerLine.road_id = array[2] + centerLine.lane_id = array[3] + var points = ArrayList() + for(i in 4..array.size-1 step 2){ + var lonLatPoint = LonLatPoint(array[i].toDouble(), array[i+1].toDouble()) + points.add(lonLatPoint) + } + centerLine.points = points + var pMatch = LonLatPoint() + MapDataApi.GetDisFromPointToLine(LonLatPoint(dLon, dlat), points, pMatch, 1) + centerLine.angle = pMatch.angle + // Add the result to the cache + centerLineCache.put(cacheKey,centerLine) + call.result(0,centerLine) + return + } + + } + call.result(1,null) + + } + + }) + mapBox.llaGetCenterLineRange(dLon,dlat,fAngle, fDis) + } + + + // Use LRU cache to store previously computed results + private val centerLineCache = ConcurrentLRUCache(MAX_CACHE_SIZE) + + //获取行驶方向一定长度的中心线 + //dDis:正 行驶方向前方距离 负 行驶方向后方距离 + + fun getCenterLineRoadNode(dLon: Double, dLat: Double, fAngle: Float, fDis: Float,call: IResult) { + // Combine the four parameters into a single string as the cache key + var start = System.currentTimeMillis() + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--getCenterLineRoadNode--: ${dLon}, ${dLat}, ${fAngle}") + } + val cacheKey = "$dLon,$dLat,$fAngle,$fDis" + + // Check if the result is already cached + if (centerLineCache.containsKey(cacheKey)) { + // If yes, return the cached result + if (CompileConfig.DEBUG) { + Log.d(TAG, "Roam--op--status--getDataTime: ${cacheKey}, ${System.currentTimeMillis()-start}") + } + call.result(0,centerLineCache.get(cacheKey)) + return + } + + // If the result is not cached, calculate it + RoadResultController.instance.addRoadResultListener("llaGetCenterLineRoadNode_${dLon.toTenDecimalsStr()}_${dLat.toTenDecimalsStr()}_${fAngle.toTenDecimalsStr()}_${fDis.toTenDecimalsStr()}",object :IRoadData{ + override fun result(code: Int, result: String?) { + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--getCenterLineRoadNode--code:${code},result: $result") + } + if (TextUtils.isEmpty(result)){ + call.result(1,null) + return + } + result?.let { + var result = it + if (result.endsWith(",")) { + result = result.trim(',') + } + val array = result.split(",") + if (array != null && array.size > 5) { + var centerLine = CenterLine() + centerLine.id = array[0] + centerLine.tile_id = array[1] + centerLine.road_id = array[2] + centerLine.lane_id = array[3] + val points = ArrayList() + for (i in 4..array.size - 1 step 2) { + val lonLatPoint = LonLatPoint(array[i].toDouble(), array[i + 1].toDouble()) + points.add(lonLatPoint) + } + centerLine.points = points + centerLineCache.put(cacheKey,centerLine) + call.result(code,centerLine) + return + } + } + call.result(1,null) + + } + + }) + mapBox.llaGetCenterLineRoadNode(dLon, dLat, fAngle, fDis) + } + + + + fun getRoadName(dLon: Double, dlat: Double, fAngle: Float,call: IResult){ + RoadResultController.instance.addRoadResultListener("llaGetRoadName_${dLon.toTenDecimalsStr()}_${dlat.toTenDecimalsStr()}_${fAngle.toTenDecimalsStr()}",object :IRoadData{ + override fun result(code: Int, result: String?) { + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--getRoadName--code:${code},result: $result") + } + if (TextUtils.isEmpty(result)){ + call.result(1,null) + return + } + result?.let { + val array = result.split(",") + var roadNameInfo = RoadNameInfo() + if(array != null && array.size > 2) { + roadNameInfo.tile_id = array[0] + roadNameInfo.road_id = array[1] + roadNameInfo.road_name = array[2] + call.result(code,roadNameInfo) + return + } + } + call.result(1,null) + } + + }) + mapBox.llaGetRoadName(dLon,dlat,fAngle) + } + + + // Use LRU cache to store previously computed results + private val crossRoadCache = ConcurrentLRUCache(MAX_CACHE_SIZE) + /** + * 获取路口信息 + */ + + fun getCrossRoad(dLon: Double, dlat: Double, fAngle: Float,call: IResult) { + val cacheKey = "$dLon,$dlat,$fAngle" + + // Check if the result is already in the cache + crossRoadCache.get(cacheKey)?.let { + call.result(0,it) + return + } + + // Otherwise, call the mapBox.llaGetCrossRoad function to get the result + RoadResultController.instance.addRoadResultListener("llaGetCrossRoad_${dLon.toTenDecimalsStr()}_${dlat.toTenDecimalsStr()}_${fAngle.toTenDecimalsStr()}",object :IRoadData{ + override fun result(code: Int, result: String?) { + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--getCrossRoad--code:${code},result: $result") + } + if (TextUtils.isEmpty(result)){ + call.result(1,null) + return + } + result?.let { + val array = result.split(",") + if (array != null && array.size > 2) { + var roadCross = RoadCross() + roadCross.status = array[0].toInt() + roadCross.tile_id = array[1] + roadCross.cross_id = array[2] + if (array.size > 4) { + roadCross.tile_id_end = array[3] + roadCross.cross_id_end = array[4] + } + // Store the result in the cache before returning it + crossRoadCache.put(cacheKey,roadCross) + call.result(code,roadCross) + return + } + } + call.result(1,null) + + } + + }) + mapBox.llaGetCrossRoad(dLon, dlat, fAngle) + } + + + fun getCrossRoadById(tileId: Int, id: Long,call: IResult>){ + RoadResultController.instance.addRoadResultListener("llaGetCrossRoadById_${tileId}_${id}",object :IRoadData{ + override fun result(code: Int, result: String?) { + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--getCrossRoadById--code:${code},result: $result") + } + if (TextUtils.isEmpty(result)){ + call.result(1,null) + return + } + result?.let { + val array = result.split(",") + if(array != null && array.size >= 2) { + var list = ArrayList() + for(i in 0 until array.size step 2){ + var lonLatPoint = LonLatPoint(array[i].toDouble(), array[i+1].toDouble()) + list.add(lonLatPoint) + } + call.result(code,list) + return + } + } + call.result(1,null) + } + + }) + mapBox.llaGetCrossRoadById(tileId,id) + } + + + + + fun initFileCacheByCity( lon :Double, lat: Double){ + mapBox.initFileCacheByCity(lon, lat) + } + + fun cacheHDDataByCityLonLat(lon: Double, lat: Double,call: IResult){ + val key = "cacheHDDataByCityLonLat_${lon.toTenDecimalsStr()}_${lat.toTenDecimalsStr()}" + RoadResultController.instance.addRoadResultListener(key,object :IRoadData{ + override fun result(code: Int, result: String?) { + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--${key}--code:${code},result: $result") + } + call.result(code,result?.toIntOrNull()?:0) + } + + }) + mapBox.cacheHDDataByCityLonLat(lon, lat) + } + + fun cacheHDDataByCity(id: Int,call: IResult){ + val key = "cacheHDDataByCity_${id}" + RoadResultController.instance.addRoadResultListener(key,object :IRoadData{ + override fun result(code: Int, result: String?) { + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--cacheHDDataByCity-${key}-code:${code},result: $result") + } + call.result(code,result?.toBoolean()?:false) + } + }) + mapBox.cacheHDDataByCity(id) + } + + fun getCacheProgressByCity(id: Int,call: IResult){ + val key = "getCacheProgressByCity_${id}" + RoadResultController.instance.addRoadResultListener(key,object :IRoadData{ + override fun result(code: Int, result: String?) { + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--getCacheProgressByCity-${key}-code:${code},result: $result") + } + call.result(code,result?.toDouble()?:0.0) + } + + }) + mapBox.getCacheProgressByCity(id) + } + + fun getCityCode(lon: Double, lat: Double, call: IResult){ + val key = "getCityCode_${lon.toTenDecimalsStr()}_${lat.toTenDecimalsStr()}" + RoadResultController.instance.addRoadResultListener(key,object :IRoadData{ + override fun result(code: Int, result: String?) { + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--getCityCode-${key}-code:${code},result: $result") + } + val cityCode = result?.toIntOrNull()?:0 + val code = if(cityCode>0){0}else{1} + call.result(code,cityCode) + } + + }) + mapBox.getCityCode(lon, lat) + } + + fun cancelCacheHDData() { + RoadResultController.instance.removeRoadResultListenerByTag("cacheHDDataBy") + RoadResultController.instance.removeRoadResultListenerByTag("getCacheProgressByCity") + mapBox.cancelCacheHDData() + } + + fun isCityDataCached(lon: Double,lat: Double,call: IResult){ + getCityCode(lon, lat,object : IResult { + override fun result(code: Int, id: Int?) { + if(id == 0) { + call.result(1,false) + return + } + getAllCityCode(object : IResult> { + override fun result(code: Int, cityList: ArrayList?) { + if(cityList == null || cityList.size == 0){ + call.result(1,false) + return + } + for(city in cityList){ + if(id == city.cityCode){ + call.result(code,city.isCache) + return + } + } + call.result(1,false) + } + + }) + } + + }) + } + + fun getAllCityCode(call: IResult>) { + val key = "getAllCityCode" + RoadResultController.instance.addRoadResultListener(key,object :IRoadData{ + override fun result(code: Int, result: String?) { + if(CompileConfig.DEBUG){ + Log.d(TAG, "roadop--getAllCityCode--result: ${result}") + } + var cityList = ArrayList() + result?.let { + val array = result.split(";") + if(array!= null && array.isNotEmpty()){ + for(str in array){ + if(str.isNotEmpty()){ + var cityInfo = CityInfo() + val city = str.trim().split(",") + if(city.isNotEmpty() && city.size >= 4){ + cityInfo.cityCode = city[0].trim().toIntOrNull()?:0 + cityInfo.chineseCityName = city[1] + cityInfo.englishCityName = city[2] + cityInfo.isCache = city[3].toIntOrNull()?:0 == 1 + cityList.add(cityInfo) + } + + } + } + + } + } + if(CompileConfig.DEBUG){ + Log.d(TAG, "roadop--getAllCityCode--cityList: ${cityList}") + } + call.result(code,cityList) + } + + }) + mapBox.getAllCityCode() + + } + + fun getHdDataVersionByCity(lon: Double,lat: Double,call: IResult){ + val key = "getHdDataVersionByCity_${lon.toTenDecimalsStr()}_${lat.toTenDecimalsStr()}" + RoadResultController.instance.addRoadResultListener(key,object :IRoadData{ + override fun result(code: Int, result: String?) { + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--${key}-code:${code},result: $result") + } + call.result(0,result?:"") + } + }) + mapBox.getHdDataVersionByCity(lon,lat) + } + + fun getZebraLineByDistance(dLon: Double, dlat: Double , fAngle: Float, dis: Float,call: IResult>){ + RoadResultController.instance.addRoadResultListener("llaGetZebraLineByDistance_${dLon.toTenDecimalsStr()}_${dlat.toTenDecimalsStr()}_${fAngle.toTenDecimalsStr()}_${dis.toTenDecimalsStr()}",object :IRoadData{ + override fun result(code: Int, result: String?) { + if (CompileConfig.DEBUG) { + Log.d(TAG, "roadop--getZebraLineByDistance--code:${code},result: $result") + } + if (TextUtils.isEmpty(result)){ + call.result(1,null) + return + } + result?.let { + var list = ArrayList() + val array = result.split(";") + if(!array.isEmpty()) { + for(arr in array){ + if(arr.isEmpty()) { + continue + } + val line = arr.split(",") + if (line.isNotEmpty() && line.size > 5) { + val zebraLine = ZebraLine() + val dis = line[0].toFloatOrNull() + dis?.let { + zebraLine.dis = it + } + zebraLine.tileId = line[1] + zebraLine.id = line[2] + val lonlats = ArrayList() + for(i in 3 until line.size step 2){ + var lonLatPoint = LonLatPoint(line[i].toDouble(), line[i+1].toDouble()) + lonlats.add(lonLatPoint) + } + zebraLine.zebraLineList = lonlats + list.add(zebraLine) + + } + + } + if(list.isNotEmpty()){ + call.result(0,list) + return + } + } + + } + call.result(1,null) + + } + + }) + mapBox.llaGetZebraLineByDistance(dLon,dlat,fAngle,dis) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/road/RoadResultController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/road/RoadResultController.kt new file mode 100644 index 0000000000..00ac24526b --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/road/RoadResultController.kt @@ -0,0 +1,68 @@ +package com.zhidaoauto.map.sdk.inner.road + +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.IRoadData +import com.zhidaoauto.map.sdk.inner.controller.CommonController +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import java.util.concurrent.ConcurrentHashMap + +class RoadResultController { + + private val TAG = javaClass.simpleName + + private var mRoadResultList: ConcurrentHashMap = ConcurrentHashMap() + + + + fun addRoadResultListener(key:String,listener:IRoadData){ + if(CompileConfig.DEBUG){ + Log.i(TAG, "roadop--addRoadResultListener:$key ") + } + mRoadResultList.put(key,listener) + } + + fun removeRoadResultListenerByTag(tag:String){ + if(CompileConfig.DEBUG){ + Log.i(TAG, "roadop--removeRoadResultListenerByTag:$tag ") + } + val keysToRemove = mutableListOf() + mRoadResultList.forEach { (key, value) -> + if (key.contains(tag)) { + keysToRemove.add(key) + } + } + keysToRemove.forEach { key -> + if(CompileConfig.DEBUG){ + Log.i(TAG, "roadop--removeRoadResultListenerByTag::$tag--remove:$key ") + } + mRoadResultList.remove(key) + } + + } + + fun dispatchRoadResult(code:Int,key:String,result:String){ + if(CompileConfig.DEBUG){ + Log.i(TAG, "roadop--dispatchRoadResult:$key,result:$result ") + } + val call = mRoadResultList.get(key) + call?.let { + CommonController.instance.scope?.launch(Dispatchers.Main) { + it.result(code,result) + } + mRoadResultList.remove(key) + } + } + + fun exit(){ + mRoadResultList.clear() + } + + companion object { + //单例 + @JvmStatic val instance: RoadResultController by lazy((LazyThreadSafetyMode.SYNCHRONIZED)) { + RoadResultController() + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/search/BaseSearchHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/search/BaseSearchHelper.kt new file mode 100644 index 0000000000..42b60fa28d --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/search/BaseSearchHelper.kt @@ -0,0 +1,12 @@ +//package com.zhidaoauto.map.sdk.inner.search +// +//import com.autonavi.nge.search.SearchAutoApi +//import com.zhidaoauto.map.sdk.inner.controller.CommonController +// +//open class BaseSearchHelper { +// constructor(){ +// if(CommonController.instance.iNavigationCore == null){ +// SearchAutoApi.init() +// } +// } +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/search/GeocoderSearchHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/search/GeocoderSearchHelper.kt new file mode 100644 index 0000000000..2a7b95dc32 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/search/GeocoderSearchHelper.kt @@ -0,0 +1,227 @@ +//package com.zhidaoauto.map.sdk.inner.search +// +//import android.content.Context +//import android.util.Log +//import com.autonavi.nge.map.LonLat +//import com.autonavi.nge.search.SPLatLonPoint +//import com.autonavi.nge.search.SPQuery +//import com.autonavi.nge.search.SPSearchBound +//import com.autonavi.nge.search.SPSearchResult +//import com.zhidaoauto.map.sdk.inner.CompileConfig +//import com.zhidaoauto.map.sdk.inner.controller.CommonController +//import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +//import com.zhidaoauto.map.sdk.open.abs.search.IGeocodeSearch +//import com.zhidaoauto.map.sdk.open.query.* +//import kotlinx.coroutines.Dispatchers +//import kotlinx.coroutines.launch +//import kotlinx.coroutines.withContext +// +//class GeocoderSearchHelper : BaseSearchHelper, IGeocodeSearch { +// val TAG = javaClass.simpleName +// +// private var mContext: Context +// private var mOnGeocodeSearchListener: OnGeocodeSearchListener? = null +// +// constructor(context: Context):super() { +// mContext = context +// } +// +// +// private fun search(geocodeQuery: GeocodeQuery?): List? { +// +// val result = CommonController.instance.iNavigationCore?.getPoiItemList(dealSpQuery(geocodeQuery!!)) +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop-${result}") +// } +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop- center point is null") +// } +// return result +// } +// +// private fun search(regeocodeQuery: RegeocodeQuery?): List? { +// +// val result = CommonController.instance.iNavigationCore?.getPoiItemList(dealSpQuery(regeocodeQuery!!)) +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop-${result}") +// } +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop- center point is null") +// } +// return result +// } +// +// +// private fun dealgeocodeResult(list: List?): GeocodeResult? { +// if (list == null) { +// return null +// } +// val results = ArrayList() +// for (poiBase in list) { +// results.add(dealGeocodeAddress(poiBase)) +// } +// +// val regeocodeResult = GeocodeResult(results) +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop - result:${regeocodeResult}") +// } +// return regeocodeResult +// } +// +// +// private fun dealRegeocodeResult(list: List?): RegeocodeResult? { +// if (list == null) { +// return null +// } +// var regeocodeAddress: RegeocodeAddress? = null +// var poiItems = ArrayList() +// for ((i,poiBase) in list.withIndex()) { +// if (i == 0) { +// regeocodeAddress = dealRegeocodeAddress(poiBase) +// } else { +// poiItems.add(dealPoiItem(poiBase)) +// } +// } +// regeocodeAddress?.poiList = poiItems +// +// val results = RegeocodeResult(regeocodeAddress!!) +// +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop - result:${results}") +// } +// return results +// } +// +// private fun dealPoiItem(result: SPSearchResult): PoiItem { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop--${result}") +// } +// val poiBase = result.poi +// var poiItem = PoiItem() +//// poiItem.adName = poiBase.name +// poiItem.typeDes = poiBase.snippet +// poiItem.businessArea = poiBase.snippet +// poiItem.tel = poiBase.tel +// poiItem.title = poiBase.title +// poiItem.snippet = poiBase.snippet +// poiItem.adCode = "${poiBase.poiId}" +// poiItem.typeCode = "${poiBase.kind}" +// poiItem.poiId = "${poiBase.poiId}" +// poiItem.lonLatPoint = +// getLonLatPoint(LonLat(poiBase.location.lon.toDouble(), poiBase.location.lat.toDouble())) +// +// return poiItem +// } +// +// private fun dealRegeocodeAddress(result: SPSearchResult): RegeocodeAddress { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop--${result}") +// } +// val poiBase = result.poi +// var regeocodeAddress = RegeocodeAddress() +//// poiItem.adName = poiBase.name +// regeocodeAddress.formatAddress = poiBase.title +// regeocodeAddress.district = poiBase.snippet +// regeocodeAddress.poiId = "${poiBase.poiId}" +// return regeocodeAddress +// } +// +// +// private fun dealGeocodeAddress(result: SPSearchResult): GeocodeAddress { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop--${result}") +// } +// val poiBase = result.poi +// var geocodeAddress = GeocodeAddress() +//// poiItem.adName = poiBase.name +// geocodeAddress.formatAddress = poiBase.title +// geocodeAddress.district = poiBase.snippet +// geocodeAddress.poiId = "${poiBase.poiId}" +// geocodeAddress.lonlat = +// getLonLatPoint(LonLat(poiBase.location.lon.toDouble(), poiBase.location.lat.toDouble())) +// +// return geocodeAddress +// } +// +// +// private fun getLonLat(lonLatPoint: LonLatPoint): LonLat { +// return CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint) +// } +// +// private fun getLonLatPoint(lonLat: LonLat): LonLatPoint { +// return CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLat) +// } +// +// +// private fun dealSpQuery(geocodeQuery: GeocodeQuery?): SPQuery { +// var spQuery = SPQuery() +// geocodeQuery?.let { query -> +// spQuery.searchType = 0 +// spQuery.categoryId = 0//query.category.toInt() +// spQuery.keyword = query.locationName +// } +// return spQuery +// +// } +// +// +// private fun dealSpQuery(regeocodeQuery: RegeocodeQuery?): SPQuery { +// var spQuery = SPQuery() +// regeocodeQuery?.let { query -> +// spQuery.searchType = 0 +// spQuery.categoryId = 0//query.category.toInt() +// spQuery.keyword = "" +// var searchBound: SPSearchBound? = null +// searchBound = SPSearchBound( +// SPLatLonPoint( +// query.lonLatPoint!!.latitude.toFloat(), +// query.lonLatPoint!!.longitude.toFloat() +// ), query.radius, true +// ) +// +// spQuery.bound = searchBound +// } +// return spQuery +// +// } +// +// override fun getFromLocation(regeocodeQuery: RegeocodeQuery): RegeocodeAddress? { +// val result = search(regeocodeQuery) +// return dealRegeocodeResult(result)?.regeocodeAddress +// } +// +// override fun getFromLocationName(geocodeQuery: GeocodeQuery?): List? { +// val result = search(geocodeQuery) +// return dealgeocodeResult(result)?.geocodeAddressList +// } +// +// override fun setOnGeocodeSearchListener(listener: OnGeocodeSearchListener?) { +// this.mOnGeocodeSearchListener = listener +// } +// +// override fun getFromLocationAsyn(regeocodeQuery: RegeocodeQuery?) { +// CommonController.instance.scope?.launch(Dispatchers.IO) { +// val result = search(regeocodeQuery) +// withContext(Dispatchers.Main) { +// mOnGeocodeSearchListener?.let { +// it.onRegeocodeSearched(dealRegeocodeResult(result), 0) +// } +// } +// } +// +// } +// +// override fun getFromLocationNameAsyn(geocodeQuery: GeocodeQuery?) { +// CommonController.instance.scope?.launch(Dispatchers.IO) { +// val result = search(geocodeQuery) +// withContext(Dispatchers.Main) { +// mOnGeocodeSearchListener?.let { +// it.onGeocodeSearched(dealgeocodeResult(result), 0) +// } +// } +// } +// +// } +// +// +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/search/InputSearchHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/search/InputSearchHelper.kt new file mode 100644 index 0000000000..655ac3ace5 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/search/InputSearchHelper.kt @@ -0,0 +1,147 @@ +//package com.zhidaoauto.map.sdk.inner.search +// +//import android.content.Context +//import android.util.Log +//import com.autonavi.nge.map.LonLat +//import com.autonavi.nge.search.SPConstants +//import com.autonavi.nge.search.SPQuery +//import com.autonavi.nge.search.SPSearchResult +//import com.zhidaoauto.map.sdk.inner.CompileConfig +//import com.zhidaoauto.map.sdk.inner.controller.CommonController +//import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +//import com.zhidaoauto.map.sdk.open.abs.search.IInputtipsSearch +//import com.zhidaoauto.map.sdk.open.exception.MapException +//import com.zhidaoauto.map.sdk.open.query.InputtipsListener +//import com.zhidaoauto.map.sdk.open.query.InputtipsQuery +//import com.zhidaoauto.map.sdk.open.query.LonLatPoint +//import com.zhidaoauto.map.sdk.open.query.Tip +//import kotlinx.coroutines.Dispatchers +//import kotlinx.coroutines.launch +//import kotlinx.coroutines.withContext +// +//class InputSearchHelper :BaseSearchHelper, IInputtipsSearch { +// val TAG = javaClass.simpleName +// +// private var mQuery: InputtipsQuery +// private var mContext: Context +// private var mInputtipsListener: InputtipsListener? = null +// +// constructor(mContext: Context, mQuery: InputtipsQuery):super() { +// this.mContext = mContext +// this.mQuery = mQuery +// +// } +// +// +// override fun getQuery(): InputtipsQuery? { +// return mQuery +// } +// +// override fun setQuery(query: InputtipsQuery) { +// mQuery = query +// +// } +// +// override fun setInputtipsListener(listener: InputtipsListener?) { +// mInputtipsListener = listener +// +// } +// +// override fun requestInputtipsAsyn() { +// CommonController.instance.scope?.launch(Dispatchers.IO) { +// val result = search() +// withContext(Dispatchers.Main) { +// mInputtipsListener?.let { +// it.onGetInputtips(dealTipResults(result), 0) +// } +// } +// } +// +// } +// +// @Throws(MapException::class) +// override fun requestInputtips(): ArrayList? { +// var list = search() as ArrayList +// return dealTipResults(list) +// } +// +// private fun getLonLat(lonLatPoint: LonLatPoint): LonLat { +// return CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint) +// } +// +// private fun getLonLatPoint(lonLat: LonLat): LonLatPoint { +// return CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLat) +// } +// +// +// private fun dealTipResults(list: List?): ArrayList? { +// if (list == null) { +// return null +// } +// val results = ArrayList() +// for (tip in list) { +// results.add(dealTipResult(tip)) +// } +// +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop - result:${results}") +// } +// return results +// } +// +// private fun dealTipResult(result: SPSearchResult): Tip { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop--${result}") +// } +// val poiBase = result.poi +// var tip = Tip() +//// poiItem.adName = poiBase.name +// tip.tip = poiBase.title +// tip.address = poiBase.snippet +// tip.name = poiBase.title +// tip.district = poiBase.snippet +// tip.adcode = "${poiBase.poiId}" +// tip.typeCode = "${poiBase.kind}" +// tip.poiID = "${poiBase.poiId}" +// tip.latPoint = +// getLonLatPoint(LonLat(poiBase.location.lon.toDouble(), poiBase.location.lat.toDouble())) +// tip.orderId = result.orderId +// return tip +// } +// +// +// @Synchronized +// private fun search(): List? { +// val query = dealSpQuery() +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop-start:${query}") +// } +// val result = CommonController.instance.iNavigationCore?.getPoiItemList(query) +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop-${result}") +// } +// return result +// } +// +// private fun dealSpQuery(): SPQuery { +// var spQuery = SPQuery() +// mQuery?.let { query -> +// spQuery.searchType = SPConstants.SEARCH_TYPE_POI +// spQuery.pageSize = query.pageSize +// spQuery.pageStart = query.pageStart +// spQuery.categoryId = 0 +// spQuery.keyword = query.keyword +//// val mCenter = FloatArray(2) +//// CommonController.instance.mapView?.getCenter(mCenter) +//// mCenter?.let { +//// var lon: Float = mCenter[0] +//// var lat: Float = mCenter[1] +//// spQuery.bound = SPSearchBound(SPLatLonPoint(lat, lon), 3000f, true) +//// } +// } +// return spQuery +// +// } +// +// +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/search/SearchHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/search/SearchHelper.kt new file mode 100644 index 0000000000..fb18b9168f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/search/SearchHelper.kt @@ -0,0 +1,263 @@ +//package com.zhidaoauto.map.sdk.inner.search +// +//import android.content.Context +//import android.text.TextUtils +//import android.util.Log +//import com.autonavi.nge.map.LonLat +//import com.autonavi.nge.search.* +//import com.zhidaoauto.map.sdk.inner.CompileConfig +//import com.zhidaoauto.map.sdk.inner.controller.CommonController +//import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +//import com.zhidaoauto.map.sdk.open.abs.search.IPoiSearch +//import com.zhidaoauto.map.sdk.open.query.* +//import kotlinx.coroutines.Dispatchers +//import kotlinx.coroutines.launch +//import kotlinx.coroutines.withContext +// +//class SearchHelper : BaseSearchHelper,IPoiSearch { +// val TAG = javaClass.simpleName +// +// private var mContext: Context +// private var mQuery: Query +// private var mPoiID: String? = null +// private var mSearchBound: SearchBound? = null +// private var mOnPoiSearchListener: OnPoiSearchListener? = null +// +// constructor(context: Context, query: Query):super() { +// mContext = context +// mQuery = query +// +// } +// +// +// private fun getAllCateGory(): SPCategories? { +// var category = CommonController.instance.iNavigationCore?.getAllPoiCategories(31) +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop-${category}") +// } +// return category +// } +// +// +// private fun search(): List? { +// val query = dealSpQuery() +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop-param:${query}") +// } +// val result = CommonController.instance.iNavigationCore?.getPoiItemList(query) +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop-${result}") +// } +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop- center point is null") +// } +// return result +// } +// +// override fun searchPOIAsyn() { +// CommonController.instance.scope?.launch(Dispatchers.IO) { +// val result = search() +// withContext(Dispatchers.Main) { +// mOnPoiSearchListener?.let { +// it.onPoiSearched(dealPoiResult(result), 0) +// } +// } +// } +// +// } +// +// override fun searchPOIId(id: String?): PoiItem? { +// return null +// } +// +// override fun searchPOICateGoryAsyn() { +// CommonController.instance.scope?.launch(Dispatchers.IO) { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop-searchPOICateGoryAsyn") +// } +// val result = getAllCateGory() +// withContext(Dispatchers.Main) { +// mOnPoiSearchListener?.let { +// it.onPoiCategorySearched(dealPoiCategories(result), 0) +// } +// } +// } +// } +// +// override fun getQuery(): Query { +// return mQuery +// } +// +// override fun setOnPoiSearchListener(onPoiSearchListener: OnPoiSearchListener?) { +// this.mOnPoiSearchListener = onPoiSearchListener +// } +// +// override fun searchPOI(): PoiSearchResult? { +// val result = search() +// return dealPoiResult(result) +// } +// +// override fun setQuery(query: Query?) { +// mQuery = query!! +// } +// +// override fun getBound(): SearchBound? { +// return mSearchBound +// } +// +// override fun searchPOIIdAsyn(id: String?) { +// mPoiID = id +// searchPoi() +// } +// +// override fun setBound(searchBound: SearchBound?) { +// mSearchBound = searchBound +// } +// +// +// private fun searchPoi() { +// val urId: Int = 0 +// var productId: Int = 1; +// mPoiID?.let { +// var sPPoiItem = CommonController.instance.iNavigationCore?.getPoiItemByPoiId(it.toInt()) +// var poiSearchResult = dealPoiSearchResult(SPSearchResult(sPPoiItem, -1)) +// mOnPoiSearchListener?.onPoiItemSearched(poiSearchResult.poi, 0) +// return +// } +// mOnPoiSearchListener?.onPoiItemSearched(null, -1) +// } +// +// private fun dealPoiCategories(spCategories: SPCategories?): List? { +// if (spCategories?.categories == null) { +// return null +// } +// val results = ArrayList() +// for (poiBase in spCategories.categories) { +// var poiCategory = PoiCategory() +// poiCategory.id = poiBase.first +// poiCategory.category = poiBase.second +// results.add(poiCategory) +// } +// return results +// } +// +// private fun dealPoiResult(list: List?): PoiSearchResult? { +// if (list == null) { +// return null +// } +// val results = ArrayList() +// for (poiBase in list) { +// results.add(dealPoiSearchResult(poiBase)) +// } +// +// val poiResult = PoiSearchResult.createPagedResult( +// mQuery, +// mSearchBound, +// ArrayList(), +// ArrayList(), +// results +// ) +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop - result:${poiResult}") +// } +// return poiResult +// } +// +// private fun dealPoiSearchResult(result: SPSearchResult): PoiSearchItem { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "searchop--${result}") +// } +// val poiBase = result.poi +// var poiItem = PoiItem() +//// poiItem.adName = poiBase.name +// poiItem.typeDes = poiBase.snippet +// poiItem.businessArea = poiBase.snippet +// poiItem.tel = poiBase.tel +// poiItem.title = poiBase.title +// poiItem.snippet = poiBase.snippet +// poiItem.adCode = "${poiBase.poiId}" +// poiItem.typeCode = "${poiBase.kind}" +// poiItem.poiId = "${poiBase.poiId}" +// poiItem.lonLatPoint = +// getLonLatPoint(LonLat(poiBase.location.lon.toDouble(), poiBase.location.lat.toDouble())) +// return PoiSearchItem(poiItem, result.orderId) +// } +// +// +// private fun getLonLat(lonLatPoint: LonLatPoint): LonLat { +// return CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint) +// } +// +// private fun getLonLatPoint(lonLat: LonLat): LonLatPoint { +// return CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLat) +// } +// +// +// private fun dealSpQuery(): SPQuery { +// var spQuery = SPQuery(); +// mQuery?.let { query -> +// spQuery.searchType = 0 +// if (!TextUtils.isEmpty(query.category)) +// spQuery.categoryId = query.category.toInt() +// spQuery.keyword = query.keyword +// spQuery.pageSize = query.pageSize +// spQuery.pageStart = query.pageNum +// spQuery.region = query.region +// } +// mSearchBound?.let { +// var searchBound: SPSearchBound? = null; +// when (it.shape) { +// "Bound" -> { +// searchBound = SPSearchBound( +// SPLatLonPoint( +// it.center!!.latitude.toFloat(), +// it.center!!.longitude.toFloat() +// ), it.range.toFloat(), it.isDistanceSort +// ) +// } +// "Rectangle" -> { +// searchBound = SPSearchBound( +// SPLatLonPoint( +// it.lowerLeft!!.latitude.toFloat(), +// it.lowerLeft!!.longitude.toFloat() +// ), +// SPLatLonPoint( +// it.upperRight!!.latitude.toFloat(), +// it.upperRight!!.longitude.toFloat() +// ) +// ) +// } +// "Polygon" -> { +// +// it.polyGonList?.let { polyGonList -> +// val list = ArrayList() +// for (point in polyGonList) { +// list.add(SPLatLonPoint(point.latitude, point.longitude)) +// } +// searchBound = SPSearchBound(list) +// } +// +// } +// else -> { +// +// } +// } +// +// spQuery.bound = searchBound +// } +// if (spQuery.bound == null && TextUtils.isEmpty(spQuery.region)) { +// val mCenter = DoubleArray(2) +// CommonController.instance.mapController?.getCenter(mCenter) +// mCenter?.let { +// var lon: Double = mCenter[0] +// var lat: Double = mCenter[1] +// spQuery.bound = SPSearchBound(SPLatLonPoint(lat, lon), 3000f, true) +// +// } +// } +// return spQuery; +// +// } +// +// +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/service/ZeusManager.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/service/ZeusManager.kt new file mode 100644 index 0000000000..a95d5c715c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/service/ZeusManager.kt @@ -0,0 +1,44 @@ +package com.zhidaoauto.map.sdk.inner.service + +import android.app.ActivityManager +import android.content.Context +import android.text.TextUtils + +object ZeusManager { + + private val TAG = javaClass.simpleName + + /** + * 判断服务是否开启 + * + * @return + */ + fun isServiceRunning(context: Context, ServiceName: String): Boolean { + if (TextUtils.isEmpty(ServiceName)) { + return false + } + val myManager = context + .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + val runningServices = myManager + .getRunningServices(50) as ArrayList + for (info in runningServices) { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "zeusop-start--service:${info.service.className}") +// } + if (info.service.className.equals(ServiceName)) { + return true + } + } + return false + } + + +// fun adbSwipe() { +// val cmd = " input swipe 100 0 100 460 " +// execCommand(cmd) +// } +// +// fun execCommand(cmd: String) { +// CommandExecution.execCommand(cmd) +// } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/traffic/TrafficHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/traffic/TrafficHelper.kt new file mode 100644 index 0000000000..94b8377b25 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/traffic/TrafficHelper.kt @@ -0,0 +1,251 @@ +package com.zhidaoauto.map.sdk.inner.traffic + +import android.text.TextUtils +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class TrafficHelper { + + val TAG = javaClass.simpleName + + + constructor() { + } + + /** + * 加载TMC数据入口 + */ + fun loadTraffic( + tileId: Int, leftTopLon: Double, leftTopLat: Double, leftBottomLon: Double, leftBottomLat: Double, + rightTopLon: Double, rightTopLat: Double, rightBottomLon: Double, rightBottomLat: Double, roadInfo: String? + ) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "tmc --tmcop--${roadInfo}") + } + if (TextUtils.isEmpty(roadInfo) || !roadInfo!!.contains(",")) { + return + } + val roadArray = roadInfo.split(",") + if (roadArray.size % 4 != 0) { + return + } + val points = ArrayList() + for (index in 0..roadArray.size - 1 step 4) { + points.add( + LonLatPoint( + roadArray[index].toDouble(), + roadArray[index + 1].toDouble() + ) + ) + points.add( + LonLatPoint( + roadArray[index + 2].toDouble(), + roadArray[index + 3].toDouble() + ) + ) + if (CompileConfig.DEBUG) { + Log.i(TAG, "tmcop---${tileId},${index},${points.size}") + } + } + val start = LonLatPoint(leftTopLon, leftTopLat) + val end = LonLatPoint(rightBottomLon, rightBottomLat) +// getRouteTMC(CommonController.instance.context, tileId, start, end, points) + } + + + //调用接口获取TMC信息 +// private fun getRouteTMC( +// context: Context?, +// tileId: Int, +// start: LonLatPoint, +// end: LonLatPoint, +// wayPoints: List? +// ) { +// Log.i(TAG, "tmcop--getRouteTMC:${start}") +// val fromAndTo = RouteSearch.FromAndTo( +// LatLonPoint(start.latitude, start.longitude), +// LatLonPoint(end.latitude, end.longitude) +// ) +// val ways: MutableList = java.util.ArrayList() +// +// if (!wayPoints.isNullOrEmpty()) { +// if (CompileConfig.DEBUG) { +// val content = "tmcop--getRouteTMC--wayPoints:${wayPoints.size}" +// Log.i(TAG, content) +// Recorder.i(content) +// } +// +// for (index in 0..wayPoints.size-1 step 2) { +// val wayPoint = wayPoints[index] +// ways.add(LatLonPoint(wayPoint.latitude, wayPoint.longitude)) +// } +// } +// +// val query = RouteSearch.DriveRouteQuery(fromAndTo, 0, ways, null, "") +// val routeSearch = RouteSearch(context) +// routeSearch.calculateDriveRouteAsyn(query) +// routeSearch.setRouteSearchListener(object : RouteSearch.OnRouteSearchListener { +// override fun onDriveRouteSearched(driveRouteResult: DriveRouteResult?, code: Int) { +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "tmcop--driveRouteResult:${driveRouteResult},code:${code}") +// } +// CommonController.instance.scope?.launch(Dispatchers.IO) { +// val result = dealRouteResult(tileId, driveRouteResult) +// result?.let { +// CommonController.instance.mapController?.setTmcData(it) +// } +// } +// } +// +// override fun onBusRouteSearched(p0: BusRouteResult?, p1: Int) { +// TODO("Not yet implemented") +// } +// +// override fun onRideRouteSearched(p0: RideRouteResult?, p1: Int) { +// TODO("Not yet implemented") +// } +// +// override fun onWalkRouteSearched(p0: WalkRouteResult?, p1: Int) { +// TODO("Not yet implemented") +// } +// }) +// } + +// //封装返回数据给底层处理 +// private fun dealDriveRouteResult(driveRouteResult: DriveRouteResult?): List? { +// driveRouteResult?.let { +// val pathList = driveRouteResult.paths +// Log.i(TAG, "tmcop--pathList:${pathList.size}") +// if (pathList.isNullOrEmpty()) { +// return null +// } +// val trafficResultList = ArrayList(pathList.size) +// val trafficResult = TrafficResult(); +// var customSteps = ArrayList() +// var customDriveStep = +// CustomDriveStep() +// var customTmc = CustomTMC() +// var customTmcList = ArrayList() +// var polylineList: ArrayList = ArrayList() +// for (drivePath in pathList) { +// customSteps = ArrayList(pathList.size) +// val steps = drivePath.steps; +// for (step in steps) { +// customDriveStep = CustomDriveStep() +//// customDriveStep.distance = step.distance +//// customDriveStep.duration = step.duration +//// customDriveStep.road = step.road +//// customDriveStep.orientation = step.orientation +// customTmcList = ArrayList() +// +// val tmcs = step.tmCs; +// var status = 0 +// for (tmc in tmcs) { +// if (TextUtils.equals("严重拥堵", tmc.status)) { +// status = 3 +// } else if (TextUtils.equals("拥堵", tmc.status)) { +// status = 2 +// } else if (TextUtils.equals("缓行", tmc.status)) { +// status = 1 +// } else { +// status = 0 +// } +// if (status == 0) { +// break +// } +// customTmc = CustomTMC() +// customTmc.status = status +// polylineList = ArrayList() +// for (latlon in tmc.polyline) { +// polylineList.add( +// CommonProxy.getInstance().getLonLatProxy() +// .switchLonLat(LonLatPoint(latlon.longitude, latlon.latitude)) +// ) +// } +// customTmc.polylines = polylineList +// customTmcList.add(customTmc) +// } +// if (!customTmcList.isEmpty()) { +// customDriveStep.customTmcList = customTmcList +// customSteps.add(customDriveStep) +// } +// } +// if (!customSteps.isEmpty()) { +// trafficResult.customDriveSteps = customSteps +// trafficResultList.add(trafficResult) +// } +// } +// return trafficResultList +// } +// return null; +// } + + +// //封装返回数据给底层处理 +// private fun dealRouteResult(tileId: Int, driveRouteResult: DriveRouteResult?): ByteArray? { +// driveRouteResult?.let { +// val pathList = driveRouteResult.paths +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "tmcop--dealRouteResult--pathList:${pathList.size}") +// } +// if (pathList.isNullOrEmpty()) { +// return null +// } +// val bufferDetail = Unpooled.buffer() +// var count = 0 +// for (drivePath in pathList) { +// val steps = drivePath.steps; +// for (step in steps) { +// if (CompileConfig.DEBUG) { +// val content = "tmcop--dealRouteResult--step:${step.polyline.size},${step.tmCs.size}" +// Log.i(TAG, content) +//// Recorder.i(content) +// } +// val tmcs = step.tmCs; +// var status = 0 +// for (tmc in tmcs) { +// if (TextUtils.equals("严重拥堵", tmc.status)) { +// status = 3 +// } else if (TextUtils.equals("拥堵", tmc.status)) { +// status = 2 +// } else if (TextUtils.equals("缓行", tmc.status)) { +// status = 1 +// } else { +// status = 0 +// } +// if (status == 0) { +// break +// } +// count++ +// bufferDetail.writeInt(status) +// bufferDetail.writeInt(tmc.polyline.size) +// var lonLat: LonLat +// for (latlon in tmc.polyline) { +// lonLat = CommonProxy.getInstance().getLonLatProxy() +// .switchLonLat(LonLatPoint(latlon.longitude, latlon.latitude)) +// bufferDetail.writeDouble(lonLat.lon) +// bufferDetail.writeDouble(lonLat.lat) +// } +// } +// } +// } +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "tmcop--dealDriveRouteResult--result:${tileId},count:${count}") +// } +// if (count == 0) { +// return null +// } +// val buffer = Unpooled.buffer() +// buffer.writeInt(tileId) +// buffer.writeInt(count) +// buffer.writeBytes(bufferDetail) +// return buffer.array() +// } +// if (CompileConfig.DEBUG) { +// Log.i(TAG, "tmcop--dealDriveRouteResult--driveRouteResult:${driveRouteResult}") +// } +// return null; +// } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/use/Clerk.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/use/Clerk.kt new file mode 100644 index 0000000000..d52008c0d4 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/use/Clerk.kt @@ -0,0 +1,193 @@ +package com.zhidaoauto.map.sdk.inner.use + +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.utils.Recorder +import io.netty.util.internal.ConcurrentSet +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.launch +import java.io.File +import java.util.concurrent.ConcurrentHashMap + +class Clerk(private val mMapController: IMapController?) { + + private val TAG = "note" + + private val cacheMap:ConcurrentHashMap = ConcurrentHashMap() + + private var saveJob: Job? = null + private var uploadJob: Job? = null + + + private val saveJobList = ConcurrentSet() + + private var mLastPath:String? = null + +// private val repository by lazy { LogRepository()} + + val places = 3 + //是否记录操作日志 + var isWork = true + + fun add(){ + if(!isWork){ + return + } + var className:String = "" + var methodName:String = "" + try{ + className = Thread.currentThread().stackTrace[3].className + methodName = Thread.currentThread().stackTrace[3].methodName + }catch (e:Exception){ + + } + add(className, methodName, "") + } + + fun add(param:String?){ + if(!isWork){ + return + } + var className:String = "" + var methodName:String = "" + try{ + className = Thread.currentThread().stackTrace[3].className + methodName = Thread.currentThread().stackTrace[3].methodName + }catch (e:Exception){ + + } + add(className, methodName, param) + } + + fun add(className:String,methodName:String,param:String?){ + if(!isWork){ + return + } + if (CompileConfig.DEBUG){ + Log.i(TAG, "add: $className,$methodName,$param") + } + val key = System.currentTimeMillis().shr(places) + if(CompileConfig.DEBUG){ + Log.i(TAG, "add: ${System.currentTimeMillis()}-$key") + } + var stringBuffer = cacheMap.get(key) + if(stringBuffer == null){ + stringBuffer = StringBuffer() + } + val content = "${System.currentTimeMillis()},$className,$methodName,$param" + if(stringBuffer.length > 0){ + stringBuffer?.append("\n") + } + stringBuffer?.append(content) + cacheMap.put(key,stringBuffer) + if(cacheMap.size > 2){ + save() + } + } + + private fun save(){ + if(!isWork){ + return + } + if (CompileConfig.DEBUG){ + Log.i(TAG, "save:") + } + val scope = mMapController?.getDemaningScope() + if(saveJobList.size>10){ + val needDeleteSize = saveJobList.size - 5 + if(CompileConfig.DEBUG){ + Log.i(TAG, "i-cancel: $needDeleteSize") + } + var deleteIndex = 0 + val it = saveJobList.iterator() + while(it.hasNext() && deleteIndex() + for((key,buffer) in cacheMap){ + if(key == currentKey){ + continue + } + if (CompileConfig.DEBUG){ + Log.i(TAG, "save:$key") + } + val path = Recorder.write(TAG, "${mMapController.hashCode()}",buffer.toString()) + //处理回调逻辑 + mLastPath?.let{ + if(!it.equals(path)){ + //TODO MATT +// CommonEventController.instance.dispatchLog(it) + Recorder.checkLog(TAG) + } + } + mLastPath = path + deleteList.add(key) + } + + for(key in deleteList){ + cacheMap.remove(key) + } + deleteList.clear() + } + saveJobList.add(saveJob) + } + + private fun consume(){ + if(!isWork){ + return + } + val scope = mMapController?.getDemaningScope() + uploadJob?.cancel() + uploadJob = scope?.launch(Dispatchers.IO) { + val path = Recorder.getLogDirectory(TAG) + val file = File(path) + if(!file.isDirectory){ + return@launch + } + val firstlist = file.list() + for(p in firstlist){ + val f = File(p) + if(!f.isDirectory){ + break + } + val secondlist = f.list() + for(child in secondlist){ + val childFile = File(child) + upload(childFile) + } + } + + } + } + + private suspend fun upload(file:File){ + return + val content = file.readText() +// repository.uploadLogInfo(content) + } + + fun setIsRecordLogs(isRecord: Boolean){ + isWork = isRecord + + } + + fun exit(){ + if(saveJobList.size > 0){ + val it = saveJobList.iterator() + while(it.hasNext()){ + val job = it.next() + job?.cancel() + it.remove() + } + } + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/use/DeviceHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/use/DeviceHelper.kt new file mode 100644 index 0000000000..1d981f3c9c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/use/DeviceHelper.kt @@ -0,0 +1,42 @@ +package com.zhidaoauto.map.sdk.inner.use + +import java.io.File +import java.util.UUID + +object DeviceHelper { + + private val deviceFilePath = "sdcard/Android/data/map/" + private val deviceFileName = "uuid.ini" + + private var file:File? = null + + suspend fun getDeviceId():String{ + val existDeviceFile = existDeviceFile() + if(!existDeviceFile){ + write() + } + return read() + } + + + fun existDeviceFile(): Boolean{ + file = File(deviceFilePath + deviceFileName) + return file?.exists()?:false + } + + private suspend fun read():String{ + return file?.readText()?:"" + } + + private suspend fun write(){ + val parent = File(deviceFilePath) + if(!parent.exists()){ + parent.mkdirs() + } + val existFile = file?.exists()?:false + if(!existFile){ + file?.createNewFile() + } + file?.writeText(UUID.randomUUID().toString()) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/use/LogRepository.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/use/LogRepository.kt new file mode 100644 index 0000000000..50d0c9b69f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/use/LogRepository.kt @@ -0,0 +1,20 @@ +//package com.zhidaoauto.map.sdk.inner.use +// +//import com.zhidao.map.net.api.BaseRepository +//import com.zhidao.map.net.api.Result +//import com.zhidaoauto.map.sdk.open.net.LogRetrofitClient +// +//class LogRepository : BaseRepository() { +// +// +// suspend fun uploadLogInfo(content: String): Result { +// return safeApiCall( +// call = { executeResponse(LogRetrofitClient.service.uploadLogInfo(content,DeviceHelper.getDeviceId()), {}) }, +// errorMessage = "获取数据失败!" +// ) +// } +// +// +// +// +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/AMapUtils.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/AMapUtils.java new file mode 100644 index 0000000000..76c6645cde --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/AMapUtils.java @@ -0,0 +1,105 @@ +package com.zhidaoauto.map.sdk.inner.utils; + +import android.content.Context; +import android.hardware.Sensor; +import android.hardware.SensorManager; +import android.location.LocationManager; + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint; + +import java.util.List; + +public class AMapUtils { + public static final int DRIVING_DEFAULT = 0; + public static final int DRIVING_SAVE_MONEY = 1; + public static final int DRIVING_SHORT_DISTANCE = 2; + public static final int DRIVING_NO_HIGHWAY = 3; + public static final int DRIVING_AVOID_CONGESTION = 4; + public static final int DRIVING_NO_HIGHWAY_AVOID_SHORT_MONEY = 5; + public static final int DRIVING_NO_HIGHWAY_AVOID_CONGESTION = 6; + public static final int DRIVING_SAVE_MONEY_AVOID_CONGESTION = 7; + public static final int DRIVING_NO_HIGHWAY_SAVE_MONEY_AVOID_CONGESTION = 8; + public static final int BUS_TIME_FIRST = 0; + public static final int BUS_MONEY_LITTLE = 1; + public static final int BUS_TRANSFER_LITTLE = 2; + public static final int BUS_WALK_LITTLE = 3; + public static final int BUS_COMFORT = 4; + public static final int BUS_NO_SUBWAY = 5; + + public static float calculateLineDistance(LonLatPoint var0, LonLatPoint var1) { + if (var0 != null && var1 != null) { + try { + double var2 = var0.getLongitude(); + double var4 = var0.getLatitude(); + double var6 = var1.getLongitude(); + double var8 = var1.getLatitude(); + var2 *= 0.01745329251994329D; + var4 *= 0.01745329251994329D; + var6 *= 0.01745329251994329D; + var8 *= 0.01745329251994329D; + double var10 = Math.sin(var2); + double var12 = Math.sin(var4); + double var14 = Math.cos(var2); + double var16 = Math.cos(var4); + double var18 = Math.sin(var6); + double var20 = Math.sin(var8); + double var22 = Math.cos(var6); + double var24 = Math.cos(var8); + double[] var28 = new double[3]; + double[] var29 = new double[3]; + var28[0] = var16 * var14; + var28[1] = var16 * var10; + var28[2] = var12; + var29[0] = var24 * var22; + var29[1] = var24 * var18; + var29[2] = var20; + return (float)(Math.asin(Math.sqrt((var28[0] - var29[0]) * (var28[0] - var29[0]) + (var28[1] - var29[1]) * (var28[1] - var29[1]) + (var28[2] - var29[2]) * (var28[2] - var29[2])) / 2.0D) * 1.27420015798544E7D); + } catch (Throwable var26) { + var26.printStackTrace(); + return 0.0F; + } + } else { + try { + throw new Exception("非法坐标值"); + } catch (Exception var27) { + var27.printStackTrace(); + return 0.0F; + } + } + } + + + /** + * 判断是否存在光传感器来判断是否为模拟器 + * 部分真机也不存在温度和压力传感器。其余传感器模拟器也存在。 + * + * @return true 为模拟器 + */ + public static Boolean notHasLightSensorManager(Context context) { + SensorManager sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); + Sensor sensor8 = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT); //光 + if (null == sensor8) { + return true; + } else { + return false; + } + } + + /** + * 是否有GPS + * @param context + * @return + */ + public static boolean hasGPSDevice(Context context) { + final LocationManager mgr = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); + if (mgr == null) { + return false; + } + final List providers = mgr.getAllProviders(); + if (providers == null) { + return false; + } + return providers.contains(LocationManager.GPS_PROVIDER); + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/BitmapUtils.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/BitmapUtils.kt new file mode 100644 index 0000000000..ad2c6c488d --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/BitmapUtils.kt @@ -0,0 +1,57 @@ +package com.zhidaoauto.map.sdk.inner.utils + +import android.graphics.Bitmap +import com.zhidaoauto.map.sdk.inner.controller.CommonController +import java.io.File +import java.io.FileNotFoundException +import java.io.FileOutputStream +import java.io.IOException +import java.nio.ByteBuffer + +object BitmapUtils { + + fun bitmapToByteArray(bitmap: Bitmap): ByteArray { + val bytes = bitmap.byteCount + val buf = ByteBuffer.allocate(bytes) + bitmap.copyPixelsToBuffer(buf) + bitmap.recycle() + return buf.array() + } + + fun copyBitmap(bitmap: Bitmap):Bitmap?{ + if(bitmap.isRecycled){ + return null; + } + try{ + val result = bitmap.copy(bitmap.getConfig(), true); +// val canvasBmp2 = Canvas( result ); +// canvasBmp2.drawBitmap(bitmap,null, Paint()) + return result + }catch (e: Exception){ + + } + return null; + } + + + fun saveBitmap(bitmap: Bitmap): String? { + val path = CommonController.instance.workingDirectory+"image/" + val dir = File(path) + if (!dir.exists()) { + dir.mkdirs() + } + val img = File(path+"location.png") + try { + val out = FileOutputStream(img) + bitmap.compress(Bitmap.CompressFormat.PNG, 90, out) + out.flush() + out.close() + return img.path + } catch (e: FileNotFoundException) { + e.printStackTrace() + } catch (e: IOException) { + e.printStackTrace() + } + return null + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/ByteBufferHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/ByteBufferHelper.kt new file mode 100644 index 0000000000..1acf60cf73 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/ByteBufferHelper.kt @@ -0,0 +1,40 @@ +package com.zhidaoauto.map.sdk.inner.utils + +import java.io.UnsupportedEncodingException +import java.nio.ByteBuffer +import java.nio.ByteOrder + +object ByteBufferHelper { + + + fun dealStr(str: String?): ByteBuffer { + return ByteBuffer.wrap(str?.toByteArray(charset("utf-8"))) + } + + fun buf2Str(buf: ByteBuffer): String? { + val l = buf.short.toInt() + var ret: String? = null + if (l > 0) { + val tmp = ByteArray(l) + for (idx in 0 until l) { + tmp[idx] = buf.get() + } + try { + ret = String(tmp, charset("UTF-8")) + } catch (e: UnsupportedEncodingException) { + e.printStackTrace() + } + } + return ret + } + + fun bytes2ByteBuffer(data: ByteArray?): ByteBuffer? { + // 对数据进行格式化 + if (data == null || data.size < 1) { + return null + } + val buf = ByteBuffer.wrap(data) + buf.order(ByteOrder.LITTLE_ENDIAN) + return buf + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/CheckStorageSpaceTool.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/CheckStorageSpaceTool.java new file mode 100644 index 0000000000..a61e16c4f8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/CheckStorageSpaceTool.java @@ -0,0 +1,65 @@ +package com.zhidaoauto.map.sdk.inner.utils; + +import android.content.Context; +import android.os.Handler; +import android.os.Message; +import android.os.StatFs; + +import com.zhidaoauto.map.sdk.inner.controller.CommonController; + +import java.io.File; + +public class CheckStorageSpaceTool { + + private final static int MSG_CHKSDCARD = 0; + private Context mContext; + + public interface StorageSpaceListener { + public void onLackSpace(); + } + + private StorageSpaceListener mStorageSpaceListener; + + private Handler mHandler = new Handler() { + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_CHKSDCARD: + checkStorageSpace(); + mHandler.sendEmptyMessageDelayed(MSG_CHKSDCARD, 1800000); + break; + } + } + }; + + public CheckStorageSpaceTool(Context context) { + mContext = context; + } + + public void stopStorageSpaceListener(){ + mHandler.removeMessages(MSG_CHKSDCARD); + } + + public void setStorageSpaceListener(StorageSpaceListener storageSpaceListener){ + mStorageSpaceListener = storageSpaceListener; + mHandler.removeMessages(MSG_CHKSDCARD); + mHandler.sendEmptyMessageDelayed(MSG_CHKSDCARD, 3000); + } + + private boolean checkStorageSpace() { + long avalible = 0; + try { + String dir = CommonController.getInstance().getWorkingDirectory(); + if (new File(dir).exists()) { + StatFs fss = new StatFs(dir); + avalible = (long) fss.getAvailableBlocks() * fss.getBlockSize(); + } + } catch (Exception e) { + } + if (avalible < 1048576) { +// if (avalible < 1000000000) { + mStorageSpaceListener.onLackSpace(); + return false; + } + return true; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/CommonUtils.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/CommonUtils.kt new file mode 100644 index 0000000000..bfbf78df07 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/CommonUtils.kt @@ -0,0 +1,55 @@ +package com.zhidaoauto.map.sdk.inner.utils + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.Canvas + + +object CommonUtils { + + fun getScreenWidth(context: Context): Int { + val displayMetrics = context.resources.getDisplayMetrics() + return displayMetrics.widthPixels + } + + fun getScreenHeight(context: Context): Int { + val displayMetrics = context.resources.getDisplayMetrics() + return displayMetrics.heightPixels + } + + /** + * 合并两张bitmap为一张 + * @param background + * @param foreground + * @return Bitmap + */ + fun combineBitmap(background: Bitmap?, foreground: Bitmap): Bitmap? { + if (background == null) { + return null + } + val bgWidth = background.width + val bgHeight = background.height + val fgWidth = foreground.width + val fgHeight = foreground.height + val newmap = Bitmap.createBitmap(bgWidth, bgHeight, Bitmap.Config.ARGB_8888) + val canvas = Canvas(newmap) + canvas.drawBitmap(background, 0f, 0f, null) + canvas.drawBitmap( + foreground, (bgWidth - fgWidth) / 2f, + (bgHeight - fgHeight) / 2f, null + ) + canvas.save() + canvas.restore() + return newmap + } + + fun getCachePath(context: Context?): String{ + var cachePath = "" + cachePath = if (context != null) { + context.filesDir.absolutePath + "/vr_tiles" + } else { + "sdcard/vr_tiles" + } + return cachePath + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/ConcurrentLRUCache.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/ConcurrentLRUCache.kt new file mode 100644 index 0000000000..f63c68a6c7 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/ConcurrentLRUCache.kt @@ -0,0 +1,42 @@ +package com.zhidaoauto.map.sdk.inner.utils + +import java.util.concurrent.locks.ReentrantReadWriteLock + +class ConcurrentLRUCache(private val capacity: Int) { + + private val map = LinkedHashMap(capacity, 0.75f, true) + private val lock = ReentrantReadWriteLock() + + fun put(key: K, value: V) { + lock.writeLock().lock() + try { + map.put(key, value) + if (map.size > capacity) { + val eldest = map.entries.iterator().next() + map.remove(eldest.key) + } + } finally { + lock.writeLock().unlock() + } + } + + fun get(key: K): V? { + lock.readLock().lock() + try { + return map.get(key) + } finally { + lock.readLock().unlock() + } + } + + fun containsKey(key: K): Boolean { + lock.readLock().lock() + try { + return map.containsKey(key) + } finally { + lock.readLock().unlock() + } + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/Constant.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/Constant.kt new file mode 100644 index 0000000000..658050da52 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/Constant.kt @@ -0,0 +1,745 @@ +package com.zhidaoauto.map.sdk.inner.utils + +import android.app.Activity +import android.app.ActivityManager +import android.app.AlertDialog +import android.app.Dialog +import android.app.ProgressDialog +import android.content.Context +import android.content.Intent +import android.content.pm.PackageManager +import android.graphics.Color +import android.location.LocationManager +import android.os.Build +import android.os.Environment +import android.os.RemoteException +import android.provider.Settings +import android.text.format.Formatter +import android.view.Gravity +import android.view.KeyEvent +import android.view.LayoutInflater +import android.view.View +import android.widget.LinearLayout +import android.widget.RadioGroup +import android.widget.TextView +import android.widget.Toast +import androidx.recyclerview.widget.RecyclerView +import com.autonavi.nge.guidance.RouteBook +import com.autonavi.nge.guidance.RouteBookAdapter +import com.autonavi.nge.obj.SubCategory +import com.autonavi.nge.routing.RoutingProvider +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.inner.common.NavHelper.mNavParams +import java.io.File +import java.net.NetworkInterface +import java.util.Enumeration + +object Constant { + + const val GPS_RTK = "GPS_RTK" + const val GPS = "GPS" + const val AGPS = "AGPS" + const val AGPS_RTK = "AGPS_RTK" + const val MOVE_INTERVAL = 800L + const val GATEWAY = "http://ant.maplay.cn/enavigate/" + const val URL_TRAFFIC = GATEWAY //网关服务语音 + const val URL_REGISTER = GATEWAY //网关注册 + const val URL_MEDIA = "http://ant.maplay.cn" //媒体 + + //测试地址 + // public static final String URL_REGISTER = "http://124.205.62.213:8080"; //注册 + // public static final String URL_UPLOAD = "http://124.205.62.213:8080"; //用户上报 + // public static final String URL_FEEDBACK = "http://124.205.62.213:8080"; //用户反馈、Bug反馈 + // public static final String URL_MAP = "http://124.205.62.213:8080"; //地图绘制 + // public static final String URL_POI_SEARCH = "http://124.205.62.213:8080"; //搜索 + // public static final String URL_APK_UPDATE = "http://124.205.62.213:8080"; //APK + // public static final String URL_TTS_DOWNLOAD = "http://124.205.62.213:8080"; //TTS + // public static final String URL_MAP_TRAFFIC = "http://124.205.62.213:8080"; //地图路况 + // public static final String URL_TRAFFIC = "http://124.205.62.213:8080"; //语音 + // public static final String URL_CURCITY = "http://engine.tuyulbs.com/car"; //经纬度获取城市ID + //Demo地址 + // public static final String URL_REGISTER = "http://demo.a-traffic.com:8081"; //注册 + // public static final String URL_UPLOAD = "http://demo.a-traffic.com:8080"; //用户上报 + // public static final String URL_FEEDBACK = "http://demo.a-traffic.com:8080"; //用户反馈、Bug反馈 + // public static final String URL_MAP = "http://demo.a-traffic.com:8080"; //地图绘制 + // public static final String URL_POI_SEARCH = "http://demo.a-traffic.com:8082"; //搜索 + // public static final String URL_APK_UPDATE = "http://demo.a-traffic.com:8082"; //APK + // public static final String URL_TTS_DOWNLOAD = "http://demo.a-traffic.com:8082"; //TTS + // public static final String URL_MAP_TRAFFIC = "http://demo.a-traffic.com:8081"; //地图路况 + // public static final String URL_TRAFFIC = "http://demo.a-traffic.com:8081"; //语音 + // public static final String URL_CURCITY = "http://demo.a-traffic.com/poi"; //经纬度获取城市ID + const val URL_MAPDATADOWNLOAD = "http://192.168.0.86:8080" + const val URL_LIUSHJ_TEST = "http://192.168.0.18:8080" + + //正式地址 + // public static final String URL_REGISTER = "http://app1.a-traffic.com:8082"; //注册 + const val URL_UPLOAD = "http://app1.a-traffic.com:8081" //用户上报 + const val URL_FEEDBACK = "http://app1.a-traffic.com:8083" //用户反馈、Bug反馈 + const val URL_MAP = "http://app1.a-traffic.com:8084" //地图绘制 + const val URL_POI_SEARCH = "http://app2.a-traffic.com:8081" //搜索 + const val URL_APK_UPDATE = "http://app2.a-traffic.com:8083" //APK + const val URL_TTS_DOWNLOAD = "http://app2.a-traffic.com:8084" //TTS + const val URL_MAP_TRAFFIC = "http://app2.a-traffic.com:8085" //地图路况 + + // public static final String URL_TRAFFIC = "http://app0.a-traffic.com:8082"; //语音 + const val URL_CURCITY = "http://app0.a-traffic.com:8081/cgi-bin" //经纬度获取城市ID + + //Message值从0x200开始?? + const val MSG_BASE = 0x200 + const val MSG_PROGRESS_DIALOG = MSG_BASE + 1 + const val MSG_PROGRESS_DIALOG_DISMISS = MSG_BASE + 2 + const val MSG_SUBMIT = MSG_BASE + 3 + const val MSG_NO_RESULT = MSG_BASE + 4 + const val MSG_SUCCESS = MSG_BASE + 5 + const val MSG_LOC_SUCCESS = MSG_BASE + 7 + const val MSG_DEL_NET_PHOTO = MSG_BASE + 8 + const val MSG_SHOW_MAP = MSG_BASE + 9 + const val MSG_IS_REGISTER = MSG_BASE + 10 + const val MSG_UN_REGISTER = MSG_BASE + 11 + const val MSG_SHOW_PHOTO = MSG_BASE + 12 + const val MSG_DEL_NET_PHOTO_ERROR = MSG_BASE + 13 + const val MSG_PROGRESS_DIALOG_GETPHOTOLIST = + MSG_BASE + 14 + const val MSG_NO_MDN = MSG_BASE + 15 + const val MSG_PROGRESS_DIALOG_CHECKNICK = + MSG_BASE + 16 + const val MSG_ERR = MSG_BASE + 17 + const val MSG_POI_END = MSG_BASE + 18 + const val MSG_DIALOG_STOPNAVI = MSG_BASE + 19 + const val MSG_NET_ERR = MSG_BASE + 20 + const val MSG_SEARCH_NULL = MSG_BASE + 21 + const val MSG_ENTER = MSG_BASE + 22 + const val MSG_CHANNEL_ADD = MSG_BASE + 23 + const val ACT_REQ_NEWCNL = MSG_BASE + 24 + const val ACT_REQ_ADDCH = MSG_BASE + 25 + + // public final static int ACT_REQ_MAP = MSG_BASE + 23; + const val MSG_NET_TIMEOUT = MSG_BASE + 26 + const val MSG_EXPORT = MSG_BASE + 27 + const val MSG_POI_CANCEL = MSG_BASE + 28 + const val MSG_SERV_ERR = MSG_BASE + 29 + const val MSG_REG_SUB = MSG_BASE + 30 + const val MSG_ROAM_START = MSG_BASE + 31 //无目的地路况 + const val MSG_SET_MEDIA_VOL_UP = MSG_BASE + 32 + const val MSG_SET_MEDIA_VOL_DOWN = MSG_BASE + 33 + const val MSG_SET_LOC_ERRCODE = MSG_BASE + 34 + const val MSG_NET_RETRYING = MSG_BASE + 35 + const val POI_FTS_TABLE_SEARCH = 0 //全文搜 + const val TELE_SEARCH = 1 //电话搜 + const val CROSS_SEARCH = 2 //交叉路口 + const val ROAD_SEARCH = 3 //道路 + const val ADM_SEARCH = 4 //行政区划 + const val FTS_BOUND_SEARCH = 5 //周边+全文 + const val POI_BOUND_SEARCH = 10 //周边 + const val SEARCH_TYPE_POI = 0 + const val SEARCH_TYPE_POI_NAME = 1 + const val SEARCH_TYPE_POI_ADDRESS = 2 + const val SEARCH_TYPE_POI_TELEPHONE = 3 + const val SEARCH_TYPE_POI_POSTAL_CODE = 4 + const val SEARCH_TYPE_ROAD = 5 + const val SEARCH_TYPE_ROAD_NAME = 6 + const val SEARCH_TYPE_CROSS_ROAD = 7 + const val SEARCH_TYPE_ADMIN = 8 + const val SEARCH_TYPE_FTS_BOUND = 9 + const val SEARCH_TYPE_POI_BOUND = 10 + + @JvmField + var mbExternalStorage = false + + @JvmField + var progressDialog: ProgressDialog? = null + private var m_iLastNotifyTime: Long = 0 + private var mIP: String? = null + private var mMDN: String? = null + private const val mIMSI = "" + private val mobileType: String? = null + private var mDeviceID: String? = null + private var viewDialog: AlertDialog? = null + private var mNDSDataPath: String = "" + private var mMemoryInfo: ActivityManager.MemoryInfo? = null + private var mActivityManager: ActivityManager? = null + + @JvmStatic + fun getRoadIsHighRoad(name: String?): String? { + if (name == null) { + return null + } + var nameChar = + ToDBC(name).toCharArray() + if (nameChar == null || nameChar.size <= 1) { + return null + } + var isNum = false + var length = -1 + for (i in nameChar.indices) { + if (isNum == false && isNum( + nameChar[i].toString() + ) == true + ) { + if (i == 0) { + return null + } + isNum = true + } else if (isNum == true && isNum( + nameChar[i].toString() + ) == false + ) { + length = i + break + } + } + if (length != -1) { + nameChar = name.substring(0, length).toCharArray() + } + var NameStr: String? = null + if (nameChar[0] == 'G' || nameChar[0] == 'G') { + NameStr = String(nameChar, 0, nameChar.size) + } else if (nameChar[0] == 'S' || nameChar[0] == 'S') { + if (nameChar.size == 4) { + //省道 S后面三位数字 + } else { + NameStr = String(nameChar, 0, nameChar.size) + } + } + return NameStr + } + + //判断字符串是否都是数字 + fun isNum(str: String): Boolean { + return str.matches(Regex("^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$")) + } + + /** + * 全角转半角方法 + * @param input + * @return + */ + fun ToDBC(input: String): String { + val c = input.toCharArray() + for (i in c.indices) { + if (c[i] == '\u3000') { + c[i] = ' ' + } else if (c[i] > '\uFF00' && c[i] < '\uFF5F') { + c[i] = (c[i] - 65248) + } + } + return String(c) + } + + @JvmStatic + fun getDisString(dis: Int): String { + var str = "" + if (dis < 1000) { + str = dis.toString() + "米" + } else { + val b = dis / 1000 + if (b > 0) { + str += b.toString() + "公里" + } + val c = dis % 1000 + if (c > 0) { + val d = c / 100 + if (d > 0 && b > 0) { + str = b.toString() + "." + d + "公里" + } else if (d > 0 && b == 0) { + str = d.toString() + "米" + } + } + } + return str + } + + @JvmStatic + fun getTimeString(nTimeLeft: Int): String? { + var timeStr: StringBuffer? = null + var hour = 0 + var minute = 0 + var second = 0 + if (nTimeLeft >= 0) { + hour = nTimeLeft / 3600 + minute = nTimeLeft % 3600 / 60 + second = nTimeLeft % 3600 % 60 + timeStr = StringBuffer() + + if (hour > 0) { +// if (hour < 10) { +// timeStr.append(0) +// } + timeStr.append(hour) + timeStr.append("小时") + } +// if (minute < 10) { +// timeStr.append(0) +// } + if (minute == 0 && hour == 0) { + timeStr.append(1) + } else { + timeStr.append(minute) + } + timeStr.append("分") + } + return timeStr?.toString() + } + + @JvmStatic + fun getWorkingDirectory(context: Context): String { + var res: String? = null + if (Environment.getExternalStorageState() == + Environment.MEDIA_MOUNTED + ) { + mbExternalStorage = true + res = context.externalCacheDir.absolutePath +"/map/" +// res = (Environment.getExternalStorageDirectory().absolutePath +// + "/Android/data/" + context.packageName+"/map/") + } else { + mbExternalStorage = false + res = context.filesDir.absolutePath + "/map/" + } + if (!res.endsWith("/")) { + res += "/" + } + val f = File(res) + if (!f.exists()) { + f.mkdirs() + } + return res + } + + @JvmStatic + fun showToast(context: Context?, msg: String?) { + if (System.currentTimeMillis() - m_iLastNotifyTime > 7000) { + Toast.makeText(context, msg, Toast.LENGTH_LONG).show() + m_iLastNotifyTime = + System.currentTimeMillis() + } + } + + fun getSoftVersion(context: Context): String { + var version: String? = null + try { + version = context.packageManager.getPackageInfo( + context.packageName, 0 + ).versionName + } catch (e: PackageManager.NameNotFoundException) { + + //e.printStackTrace(); + } + return "V" + version + "自研版" + } + +// fun getIMSI(context: Context): String { +// val mTelephonyMgr = +// context.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager +// return mTelephonyMgr.subscriberId +// } + + fun GetIPAddress(applicationContext: Context?): String? { + if (null != mIP) { + return mIP + } + var netInterfaces: Enumeration? = null + try { + netInterfaces = NetworkInterface.getNetworkInterfaces() + while (netInterfaces.hasMoreElements()) { + val ni = netInterfaces.nextElement() + val ips = ni.inetAddresses + while (ips.hasMoreElements()) { + val ip = ips.nextElement() + if (!ip.isLoopbackAddress) { + mIP = ip.hostAddress + return mIP + } + } + } + } catch (e: Exception) { + } + mIP = "" + return mIP + } + +// fun getMDN(applicationContext: Context): String? { +// if (null != mMDN) { +// return mMDN +// } +// val mTelephonyMgr = +// applicationContext.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager +// mMDN = mTelephonyMgr.line1Number +// if (null == mMDN) { +// mMDN = "" +// } +// return mMDN +// } + + fun getSoftChannel(applicationContext: Context): String { + var version: String? = null + try { + version = applicationContext.packageManager.getPackageInfo( + applicationContext.packageName, 0 + ).versionName + } catch (e: PackageManager.NameNotFoundException) { + } + return "Ant v$version update" + } + + val phoneTypeCode: String + get() = Build.MODEL + + val androidVersion: String + get() = if (Build.VERSION.RELEASE != null) { + "Android " + Build.VERSION.RELEASE + } else { + "" + } + +// fun getDeviceID(applicationContext: Context): String? { +// if (null != mDeviceID) { +// return mDeviceID +// } +// val mTelephonyMgr = +// applicationContext.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager +// mDeviceID = mTelephonyMgr.deviceId +// if (null == mDeviceID) { +// mDeviceID = "" +// } +// return mDeviceID +// } + + fun getViewDialog( + context: Context?, + view: View?, + title: String? + ): Dialog? { + viewDialog = + AlertDialog.Builder(context).setView(view).setTitle(title) + .setNegativeButton("关闭") { dialog, which -> }.create() + return viewDialog + } + + @JvmStatic + fun getRouteBookDialog(act: Activity): Dialog { + val dialog = Dialog(act, R.style.Dialog_Fullscreen) + var routebook: RouteBook? = null + try { +// routebook = CommonController.instance.iNavigationCore?.Guidance_RouteBook(0, 0, 4) + } catch (e: RemoteException) { + e.printStackTrace() + } + val adapter = RouteBookAdapter() + val view = RecyclerView(act) + view.adapter = adapter + adapter.setDiffNewData(routebook?.bookdata) + // 线性布局 + val layout = LinearLayout(act) + // 设置布局垂直方向 + layout.orientation = LinearLayout.VERTICAL + val m_TextView = TextView(act) + m_TextView.layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + m_TextView.setBackgroundColor(Color.BLACK) + m_TextView.textSize = 18f + m_TextView.setTextColor(Color.WHITE) + m_TextView.text = "距离:" + getDisString(routebook?.totalLength ?: 0) + " 时间:" + getTimeString(routebook?.totalTime ?: 0) + m_TextView.gravity = Gravity.CENTER_HORIZONTAL + m_TextView.setPadding(0, 10, 0, 20) + layout.addView( + m_TextView, + LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ) + ) + layout.addView( + view, + LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.MATCH_PARENT + ) + ) + dialog.setContentView(layout) + dialog.setOnCancelListener { dialog.dismiss() } + dialog.setOnKeyListener { paramDialogInterface, paramInt, paramKeyEvent -> false } + return dialog + } + + fun getNaviDialog(act: Activity): Dialog { + val items = + arrayOf("开始导航", "模拟导航", "路线详情", "导航设置", "语音设置") + val dialog: Dialog = AlertDialog.Builder(act).setTitle("导航") + .setItems(items) { dialog, which -> + when (which) { +// 0 -> CommonController.instance.naviController?.startNavi(false) +// 1 -> CommonController.instance.naviController?.startNavi(true) + 2 -> try { +// if (CommonController.instance.iNavigationCore!!.Routing_GetStatus(0) +// ) { +// getRouteBookDialog(act) +// .show() +// //Toast.makeText(act, "路线详情", Toast.LENGTH_SHORT).show(); +// } else { +// //先定位 -- 在路线计算 -- 在显示 +// CommonController.instance +// .naviController?.startNaviDetail() +// } + } catch (e: Exception) { + e.printStackTrace() + } + 3 -> getRoutingSettingDialog(act) + .show() + 4 -> Toast.makeText( + act, + "语音设置", + Toast.LENGTH_SHORT + ).show() + } + }.create() + dialog.setOnCancelListener { } + return dialog + } + + fun getRoutingSettingDialog(act: Activity): Dialog { + val layout = LayoutInflater.from(act).inflate( + R.layout.dialog_routing_set, + null + ) as LinearLayout + initRouteSetting(act, layout) + return AlertDialog.Builder(act).setView(layout).setTitle("导航设置") + .setNegativeButton("返回") { dialog, which -> getNaviDialog(act).show() } + .setPositiveButton("确定") { paramDialogInterface, paramInt -> +// CommonController.instance.naviController?.reSetRoute() + } + .create() + } + + fun getExitDialog(act: Activity): Dialog { + return AlertDialog.Builder(act).setTitle("注意!") + .setMessage("确定要退出吗?") + .setPositiveButton("确定") { dialog, which -> act.finish() } + .setNegativeButton("取消") { dialog, which -> }.create() + } + + @JvmStatic + val nDSDataPath: String + get() { + mNDSDataPath = Environment.getExternalStorageDirectory().absolutePath + "/shmdata/" +// if (TextUtils.isEmpty(mNDSDataPath)) { +// val NDSFileName = "/shmdata/" +// val paths = arrayOf( +// "/storage/extSdCard$NDSFileName", +// "/storage/sdcard0$NDSFileName", +// "/storage/sdcard1$NDSFileName", +// "/sdcard/sd$NDSFileName", +// "/sdcard/external_sd$NDSFileName", +// "/sdcard-ext$NDSFileName", +// "/sdcard$NDSFileName", +// "/sdcard/ext_sd$NDSFileName", +// "/mnt/extsd$NDSFileName" +// ) +// for (i in paths.indices) { +// if (File(paths[i]).exists()) { +// mNDSDataPath = paths[i] +// break +// } else { +// mNDSDataPath = +// Environment.getExternalStorageDirectory() +// .absolutePath + NDSFileName +// } +// } +// } + return mNDSDataPath + } + + fun initRouteSetting( + context: Context?, + layoutRouteSet: LinearLayout + ) { + // LinearLayout layout = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.dialog_routing_set, null); + val rg_routing_model = + layoutRouteSet.findViewById(R.id.rg_routing_set) as RadioGroup + when (mNavParams.getRoutingModel()) { + RoutingProvider.COSTMODEL_DEFAULT -> rg_routing_model.check(R.id.routing_set_default) + RoutingProvider.COSTMODEL_FASTEST -> rg_routing_model.check(R.id.routing_set_fast) + RoutingProvider.COSTMODEL_SHORTEST -> rg_routing_model.check( + R.id.routing_set_short + ) + RoutingProvider.COSTMODEL_SUGGEST -> rg_routing_model.check(R.id.routing_set_avoidhwy) + RoutingProvider.COSTMODEL_ECO -> rg_routing_model.check(R.id.routing_set_avoidtoll) + } + rg_routing_model.setOnCheckedChangeListener { group, checkedId -> + try { +// when (checkedId) { +// R.id.routing_set_default -> { +// mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_DEFAULT) +// CommonController.instance +// .iNavigationCore?.RoutingSetCostModel( +// RoutingProvider.COSTMODEL_DEFAULT, +// 0 +// ) +// } +// R.id.routing_set_fast -> { +// mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_FASTEST) +// CommonController.instance +// .iNavigationCore?.RoutingSetCostModel( +// RoutingProvider.COSTMODEL_FASTEST, +// 0 +// ) +// CommonController.instance +// .iNavigationCore?.RoutingSetAvoidHighway(false, 0) +// CommonController.instance +// .iNavigationCore?.RoutingSetAvoidToll(false, 0) +// } +// R.id.routing_set_short -> { +// mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_SHORTEST) +// CommonController.instance +// .iNavigationCore?.RoutingSetCostModel( +// RoutingProvider.COSTMODEL_SHORTEST, +// 0 +// ) +// CommonController.instance +// .iNavigationCore?.RoutingSetAvoidHighway(false, 0) +// CommonController.instance +// .iNavigationCore?.RoutingSetAvoidToll(false, 0) +// } +// R.id.routing_set_avoidhwy -> { +// mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_SUGGEST) +// CommonController.instance +// .iNavigationCore?.RoutingSetCostModel( +// RoutingProvider.COSTMODEL_FASTEST, +// 0 +// ) +// CommonController.instance +// .iNavigationCore?.RoutingSetAvoidHighway(true, 0) +// CommonController.instance +// .iNavigationCore?.RoutingSetAvoidToll(false, 0) +// } +// R.id.routing_set_avoidtoll -> { +// mNavParams.setRoutingModel(RoutingProvider.COSTMODEL_ECO) +// CommonController.instance +// .iNavigationCore?.RoutingSetCostModel( +// RoutingProvider.COSTMODEL_FASTEST, +// 0 +// ) +// CommonController.instance +// .iNavigationCore?.RoutingSetAvoidHighway(false, 0) +// CommonController.instance +// .iNavigationCore?.RoutingSetAvoidToll(true, 0) +// } +// } + } catch (e: RemoteException) { + e.printStackTrace() + } + } + } + + fun getSystemAvaialbeMemorySize(context: Context): String { + //获得MemoryInfo对象 + if (mMemoryInfo == null) { + mMemoryInfo = + ActivityManager.MemoryInfo() + } + if (mActivityManager == null) { + mActivityManager = + context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + } + mActivityManager!!.getMemoryInfo(mMemoryInfo) + val memSize = mMemoryInfo!!.availMem + return Formatter.formatFileSize(context, memSize) + } + + @JvmStatic + fun killProcesses(context: Context, pName: String?) { + val manager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + manager.killBackgroundProcesses(pName) + } + + private val mSubCategoryList: List? = null + + // public static void getCategorySettingDialog(final Context context){ + // final ApplicationEx mApplication = (ApplicationEx) context.getApplicationContext(); + // final List categoryList; + // int urId = CommonController.getInstance().getSettingService().getUpdateRegion(); + // try { + // categoryList = CommonController.getInstance().getINavigationCore().getCatDataByDA(urId); + // if(categoryList != null && categoryList.size() > 0){ + // CharSequence[] items = new CharSequence[categoryList.size()]; + // for(int i = 0; i < categoryList.size(); i++){ + // items[i] = (CharSequence) categoryList.get(i).getCatName(); + // } + // Dialog urDialog = new AlertDialog.Builder((Activity) context).setTitle("按类别搜索") + // .setItems(items, new DialogInterface.OnClickListener() { + // @Override + // public void onClick(DialogInterface dialog, int which) { + // mSubCategoryList = categoryList.get(which).getSubCategory(); + // CharSequence[] subItems = new CharSequence[mSubCategoryList.size()]; + // for(int i = 0; i < mSubCategoryList.size(); i++){ + // subItems[i] = mSubCategoryList.get(i).getCatName(); + // } + // getSubCategorySettingDialog(context, subItems); + // } + // }) + // .create(); + // urDialog.show(); + // }else{ + // Constant.getDialog((Activity) context, "获取类别列表失败").show(); + // } + // } catch (RemoteException e) { + // + // e.printStackTrace(); + // } + // } + private val mSubCategoryName: String? = null + + // public static void getSubCategorySettingDialog(final Context context, CharSequence[] subItems){ + // Dialog dialog = new AlertDialog.Builder((Activity) context).setTitle("请选择搜索类别") + // .setItems(subItems, new DialogInterface.OnClickListener() { + // + // ApplicationEx mApplication = (ApplicationEx) context.getApplicationContext(); + // @Override + // public void onClick(DialogInterface dialog, int which) { + // mSubCategoryName = mSubCategoryList.get(which).getCatName(); + // DataStorageManager.getInstance().setPoiKey(mSubCategoryName); + // SearchManager.GetInstance().StartPOISearch(context, 1, mSubCategoryName, mSubCategoryList.get(which).getKindId(), CommonController.getInstance().getSearchHandler().obtainMessage(MapActivity.MSG_POI_RES)); + // mApplication.setIsSearchStatInput(false); + // } + // }) + // .setNegativeButton("返回", new DialogInterface.OnClickListener() { + // @Override + // public void onClick(DialogInterface paramDialogInterface, int paramInt) { + // getCategorySettingDialog(context); + // } + // }) + // .setOnCancelListener(new OnCancelListener() { + // + // @Override + // public void onCancel(DialogInterface paramDialogInterface) { + // getCategorySettingDialog(context); + // } + // }) + // .create(); + // dialog.show(); + // } + fun getGpsDialog(act: Activity): Dialog { + return AlertDialog.Builder(act).setTitle("提高“我的位置”精度") + .setMessage("如需获取更精确的位置服务,请您执行以下操作:\n\n在位置设置中打开GPS") + .setPositiveButton("设置") { dialog, which -> + try { + val gpsOptionsIntent = + Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS) + act.startActivity(gpsOptionsIntent) + } catch (ex: Exception) { + } + }.setNegativeButton("取消") { dialog, which -> } + .setOnKeyListener { dialog, keyCode, event -> + if (keyCode == KeyEvent.KEYCODE_SEARCH) { + true + } else false + }.create() + } + + fun CheckGPS(context: Context): Boolean { + val locManager = + context.getSystemService(Context.LOCATION_SERVICE) as LocationManager + return locManager.isProviderEnabled(LocationManager.GPS_PROVIDER) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/Constants.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/Constants.java new file mode 100644 index 0000000000..a401bb4d63 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/Constants.java @@ -0,0 +1,28 @@ +package com.zhidaoauto.map.sdk.inner.utils; + + +import com.autonavi.nge.map.LonLat; + +public class Constants { + + public static final int ERROR = 1001;// 网络异常 + public static final int ROUTE_START_SEARCH = 2000; + public static final int ROUTE_END_SEARCH = 2001; + public static final int ROUTE_BUS_RESULT = 2002;// 路径规划中公交模式 + public static final int ROUTE_DRIVING_RESULT = 2003;// 路径规划中驾车模式 + public static final int ROUTE_WALK_RESULT = 2004;// 路径规划中步行模式 + public static final int ROUTE_NO_RESULT = 2005;// 路径规划没有搜索到结果 + + public static final int GEOCODER_RESULT = 3000;// 地理编码或者逆地理编码成功 + public static final int GEOCODER_NO_RESULT = 3001;// 地理编码或者逆地理编码没有数据 + + public static final int POISEARCH = 4000;// poi搜索到结果 + public static final int POISEARCH_NO_RESULT = 4001;// poi没有搜索到结果 + public static final int POISEARCH_NEXT = 5000;// poi搜索下一页 + + public static final int BUSLINE_LINE_RESULT = 6001;// 公交线路查询 + public static final int BUSLINE_id_RESULT = 6002;// 公交id查询 + public static final int BUSLINE_NO_RESULT = 6003;// 异常情况 + + public static final LonLat BEIJING = new LonLat(116.4109,39.968284);// 北京市经纬度 +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/DateUtils.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/DateUtils.kt new file mode 100644 index 0000000000..b449dd1510 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/DateUtils.kt @@ -0,0 +1,24 @@ +package com.zhidaoauto.map.sdk.inner.utils + +import java.text.SimpleDateFormat +import java.util.Date + +object DateUtils { + + private val dateFormat = SimpleDateFormat("yyyyMMdd") + private val timeFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS") + + /** + * 获取当前日期 + */ + fun getCurrentDate(): String { + return dateFormat.format(Date()) + } + + /** + * 获取当前时间 + */ + fun getCurrentTime(): String { + return timeFormat.format(Date()) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/DistanceHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/DistanceHelper.kt new file mode 100644 index 0000000000..bed5748c43 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/DistanceHelper.kt @@ -0,0 +1,223 @@ +package com.zhidaoauto.map.sdk.inner.utils + +class DistanceHelper { + private val EARTH_RADIUS = 6378137.0 + + companion object { + /// + /// 根据一个给定经纬度的点和距离,进行附近地点查询 + /// + /// 经度 + /// 纬度 + /// 距离(单位:公里或千米) + /// 返回一个范围的4个点,最小纬度和纬度,最大经度和纬度 + // public static PositionModel FindNeighPosition(double longitude, double latitude, double distance) { + // //先计算查询点的经纬度范围 + // double r = 6378.137;//地球半径千米 + // double dis = distance;//千米距离 + // double dlng = 2 * Math.asin(Math.sin(dis / (2 * r)) / Math.cos(latitude * Math.PI / 180)); + // dlng = dlng * 180 / Math.PI;//角度转为弧度 + // double dlat = dis / r; + // dlat = dlat * 180 / Math.PI; + // double minlat = latitude - dlat; + // double maxlat = latitude + dlat; + // double minlng = longitude - dlng; + // double maxlng = longitude + dlng; + // return new PositionModel + // { + // MinLat = minlat, + // MaxLat = maxlat, + // MinLng = minlng, + // MaxLng = maxlng + // } ; + // } + /// + /// 计算两点位置的距离,返回两点的距离,单位:公里或千米 + /// 该公式为GOOGLE提供,误差小于0.2米 + /// + /// 第一点经度 + /// 第一点纬度 + /// 第二点经度 + /// 第二点纬度 + /// 返回两点的距离,单位:公里或千米 + // public static double GetDistance(double lng1, double lat1, double lng2, double lat2) { + // //地球半径,单位米 + // double radLat1 = Rad(lat1); + // double radLng1 = Rad(lng1); + // double radLat2 = Rad(lat2); + // double radLng2 = Rad(lng2); + // double a = radLat2 - radLat1; + // double b = radLng2 - radLng1; + // double result = 2 * Math.Asin(Math.Sqrt(Math.Pow(Math.Sin(a / 2), 2) + Math.Cos(radLat1) * Math.Cos(radLat2) * Math.Pow(Math.Sin(b / 2), 2))) * EARTH_RADIUS; + // return result / 1000; + // } + /// + /// 经纬度转化成弧度 + /// + /// + /// + private fun Rad(d: Double): Double { + return d * Math.PI / 180.0 + } + + /// + /// 通过两点的经纬度A,B,计算B相对于A的方向角--球面正弦公式法 + /// + /// + /// + /// + /// + /// + // 有问题 + fun GetDirection(lng1: Double, lat1: Double, lng2: Double, lat2: Double): Double { + //地球半径,单位米 + val radLng1 = Rad(lng1) + val radLat1 = Rad(lat1) + val radLng2 = Rad(lng2) + val radLat2 = Rad(lat2) + val a = Rad(90 - lat2) + val b = Rad(90 - lat1) + val c = Rad(lng2 - lng1) + val cos_c = Math.cos(b) * Math.cos(a) + Math.sin(b) * Math.sin(a) * Math.cos(c) + val sin_c = Math.sqrt(1 - Math.pow(cos_c, 2.0)) + val sin_a = Math.sin(Math.sin(b) * Math.sin(c) / sin_c) + val Azimuth = Math.asin(sin_a) * 180 / Math.PI + val x = lng2 - lng1 //经度 + val y = lat2 - lat1 //纬度 + return if (x > 0 && y > 0) //第一象限 + { + Azimuth + } else if (y > 0 && x < 0) //第二象限 + { + 360 + Azimuth + } else //第三第四象限 + { + 180 - Azimuth + } + // return quadrant(lat1, lng1, lat2, lng2, Azimuth); + } + + /// + /// 通过两点的经纬度A,B,计算B相对于A的方向角-平面直角坐标系法 只能用于短距离求算,中纬度地区建议40km以下 + /// + /// + /// + /// + /// + /// + // 有问题 + fun GetDirection2(lng1: Double, lat1: Double, lng2: Double, lat2: Double): Double { + //double reslt1 = Math.Tan(Rad(90)); + //double reslt = Math.Atan(reslt1) *180/ Math.PI; + val radLng1 = Rad(lng1) + val radLat1 = Rad(lat1) + val radLng2 = Rad(lng2) + val radLat2 = Rad(lat2) + //double a = radLng2 - radLng1; + //double b = radLat2 - radLat1; + //double c = Math.Cos(lat2); + val a = Rad(lng2 - lng1) + val b = Rad(lat2 - lat1) + val c = Math.cos(radLat2) + val result1 = Math.tan(a * c / b) + val result = Math.atan(result1) * 180f / Math.PI + val x = lng2 - lng1 //经度 + val y = lat2 - lat1 //纬度 + return if (x > 0 && y > 0) //第一象限 + { + result + } else if (y > 0 && x < 0) //第二象限 + { + 360f+ result + } else //第三第四象限 + { + 180f + result + } + } + + fun GetAzimuth( + lon1: Double, lat1: Double, lon2: Double, + lat2: Double + ): Double { + var lon1 = lon1 + var lat1 = lat1 + var lon2 = lon2 + var lat2 = lat2 + lat1 = Rad(lat1) + lat2 = Rad(lat2) + lon1 = Rad(lon1) + lon2 = Rad(lon2) + var azimuth = Math.sin(lat1) * Math.sin(lat2) + (Math.cos(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1)) + azimuth = Math.sqrt(1.0 - azimuth * azimuth) + azimuth = Math.cos(lat2) * Math.sin(lon2 - lon1) / azimuth + azimuth = Math.asin(azimuth) * 180f / Math.PI + if (java.lang.Double.isNaN(azimuth)) { + azimuth = if (lon1 < lon2) { + 90.0 + } else { + 270.0 + } + } + return azimuth + } + } + + + // 有问题 + fun getAngle(lon1: Double, lat1: Double, lon2: Double, lat2: Double): Float { + val x = lat1 - lat2; + val y = lon1 - lon2; + var angle = -1f; + if (y == 0.0 && x > 0.0) + angle = 0.0f; + if (y == 0.0 && x < 0.0) + angle = 180.0f; + if (x == 0.0 && y > 0.0) + angle = 90.0f; + if (x == 0.0 && y < 0.0) + angle = 270.0f; + if (angle == -1f) { + val dislon = get_distance(lon1, lat2, lon2, lat2); + val dislat = get_distance(lon2, lat1, lon2, lat2); + if (x > 0 && y > 0) + angle = (Math.atan2(dislon, dislat) / Math.PI * 180.0).toFloat(); + if (x < 0 && y > 0) + angle = (Math.atan2(dislat, dislon) / Math.PI * 180 + 90).toFloat(); + if (x < 0 && y < 0) + angle = (Math.atan2(dislon, dislat) / Math.PI * 180 + 180).toFloat(); + if (x > 0 && y < 0) + angle = (Math.atan2(dislat, dislon) / Math.PI * 180 + 270).toFloat(); + } + return angle; + } + + fun HaverSin(thera: Double): Double { + val v = Math.sin(thera / 2); + return v * v; + } + + //角度转换为弧度 + fun ConvertDegreesToRadians(degrees: Double): Double { + return degrees * Math.PI / 180f; + } + + //弧度转换为角度 + fun ConvertRadiansToDegrees(radian: Double): Double { + return radian * 180.0 / Math.PI; + } + + //计算两个经纬度坐标间的距离(单位:米) +//参数:lon1为经度1;lat1为纬度1;lon2为经度2;lat2为纬度2 + fun get_distance(lon1: Double, lat1: Double, lon2: Double, lat2: Double): Double { + var lat1 = ConvertDegreesToRadians(lat1); + var lon1 = ConvertDegreesToRadians(lon1); + var lat2 = ConvertDegreesToRadians(lat2); + var lon2 = ConvertDegreesToRadians(lon2); + + val vLon = Math.abs(lon1 - lon2); + val vLat = Math.abs(lat1 - lat2); + val h = HaverSin(vLat) + Math.cos(lat1) * Math.cos(lat2) * HaverSin(vLon); + val distance = 2 * 6371 * Math.asin(Math.sqrt(h)); + return distance * 1000; + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/FileUtils.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/FileUtils.kt new file mode 100644 index 0000000000..d480537ac3 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/FileUtils.kt @@ -0,0 +1,305 @@ +package com.zhidaoauto.map.sdk.inner.utils + +import android.content.res.AssetManager +import android.graphics.Bitmap +import android.os.Environment +import android.text.TextUtils +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import java.io.File +import java.io.FileOutputStream +import java.io.IOException +import java.io.InputStream +import java.text.SimpleDateFormat + +object FileUtils { + + val TAG = javaClass.simpleName + + fun copyDirect(assetManager: AssetManager, assetDir: String, dir: String): Boolean { + + val mWorkingPath = File(dir); + if (CompileConfig.DEBUG) { + Log.i(TAG, "assetop--copyDirect:parent:${dir},${mWorkingPath.exists()}") + } + // 如果文件路径不存在 + if (!mWorkingPath.exists()) { + mWorkingPath.mkdirs() + } + // 如果文件路径不存在 + if (!mWorkingPath.exists()) { + mWorkingPath.mkdirs() + } + var files: Array + try { + // 获得Assets文件夹下指定文件夹一共有多少文件 + files = assetManager.list(assetDir); + } catch (e1: IOException) { + Log.e(TAG, "assetop-e1", e1) + return false + } + if(files == null || files.isEmpty()){ + return false + } + var result = true; + for (i in 0 until files.size) { + val finalI = i + try { + // 获得每个文件的名字 + val fileName = files[finalI]; + + val outFile = File("${mWorkingPath}/${fileName}"); + // 判断文件是否存在 + if (CompileConfig.DEBUG) { + Log.i(TAG, "assetop--${outFile.name},${outFile.exists()}") + } + val assetSecondName = "${assetDir}/${outFile.name}" + val secondList = assetManager.list(assetSecondName) + if (secondList != null && secondList.size > 0) { + result = copyDirect(assetManager, assetSecondName, "${dir}/${outFile.name}") + } else if (!outFile.exists()) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "assetop--exists:false,path:${outFile.absolutePath}") + } + try { + outFile.createNewFile(); + }catch (e1:Exception){ + e1.printStackTrace() + if(!outFile.exists()){ + return false +// continue + } + } + val out = FileOutputStream(outFile); + var inputStream: InputStream? = null; + try{ + if (0 != assetDir.length) { + inputStream = assetManager.open(assetDir + "/" + fileName); + }else { + inputStream = assetManager.open(fileName); + } + // Transfer bytes from in to out + val buf = ByteArray(2048) + var len: Int = -1 + while (inputStream?.read(buf).also { len = it!! } != -1) { + out.write(buf, 0, len); + } + }catch (e2:Exception){ + + }finally { + inputStream?.close() + out.close() + } + + } + } catch (e: Exception) { + Log.e(TAG, "assetop-e", e) + result = false + break + } + } + + return result + } + + /** + * 删除目录及目录下的文件 + * + * @param dir + * 要删除的目录的文件路径 + * @return 目录删除成功返回true,否则返回false + */ + fun deleteDirectory(dir: String): Boolean { + // 如果dir不以文件分隔符结尾,自动添加文件分隔符 + + var dir = dir + if (!dir.endsWith(File.separator)) dir = dir + File.separator + val dirFile = File(dir) + // 如果dir对应的文件不存在,或者不是一个目录,则退出 + if (dirFile == null || !dirFile.exists() || !dirFile.isDirectory) { + return false + } + var flag = true + // 删除文件夹中的所有文件包括子目录 + val files = dirFile.listFiles() + if(files == null || files.isEmpty()){ + return false + } + for (f in files) { + // 删除子文件 + if (f.isFile) { + flag = deleteFile(f.absolutePath) + if (!flag) break + } else if (f.isDirectory) { + flag = deleteDirectory(f.absolutePath) + if (!flag) break + } + } + if (!flag) { + return false + } + // 删除当前目录 + return if (dirFile.delete()) { + true + } else { + false + } + } + + /** + * 删除单个文件 + * + * @param fileName + * 要删除的文件的文件名 + * @return 单个文件删除成功返回true,否则返回false + */ + fun deleteFile(fileName: String): Boolean { + val file = File(fileName) + // 如果文件路径所对应的文件存在,并且是一个文件,则直接删除 + return if (file.exists() && file.isFile) { + if (file.delete()) { + true + } else { + false + } + } else { + false + } + } + + + private fun getDirectory(): String? { + var res: String = if (!TextUtils.isEmpty(Recorder.mWorkingDirectory)) { + "${Recorder.mWorkingDirectory}/img" + } else { + Environment.getExternalStorageDirectory().absolutePath + "/Android/data/map/recorders/img" + } + if (!res.endsWith("/")) { + res = "$res/" + } + val f = File(res) + if (!f.exists()) { + f.mkdirs() + } + return res + } + + fun saveBitmap(bitmap: Bitmap, name: String) { + val sdf = SimpleDateFormat("yyyyMMddHHmmss") + if (null == bitmap) { + return + } + try { + var path = "${getDirectory()}/${name}" + val fos = FileOutputStream(path) + val b = bitmap?.compress(Bitmap.CompressFormat.PNG, 100, fos) + try { + fos.flush() + } catch (e: IOException) { + e.printStackTrace() + } + try { + fos.close() + } catch (e: IOException) { + e.printStackTrace() + } + + } catch (e: Exception) { + e.printStackTrace() + } + } + + fun isSame(assetManager: AssetManager, assetDir: String, dir: String): Boolean { + var fileDir = File(dir) + var fileAsset = assetManager.list(assetDir) + if(fileDir.list() == null || fileDir.list().isEmpty() || fileAsset ==null || fileAsset.isEmpty()){ + return false; + } + var count = 0 + if (CompileConfig.DEBUG) { + Log.d(TAG, "isSame--fileAsset.size:${fileAsset.size} fileDir.list().size:${fileDir.list().size}") + } + if (fileDir.isDirectory && fileAsset.size == fileDir.list().size) { + val subDirFile = fileDir.listFiles().toMutableList() + for (path in fileAsset) { + val file = File(path) + for (dirFile in subDirFile) { + val secondList = assetManager.list("${assetDir}/${file.name}") + if (secondList.isNotEmpty() && dirFile.isDirectory && file.name.equals(dirFile.name)) { + if (isSame(assetManager, "${assetDir}/${file.name}", dirFile.path)) { + count++ + subDirFile.remove(dirFile) + break + } + } else if (!file.isDirectory && !dirFile.isDirectory) { + if (file.name.equals(dirFile.name)) { + count++ + subDirFile.remove(dirFile) + break + } + + } + } + + } + if (CompileConfig.DEBUG) { + Log.d(TAG, "isSame--count:${count}") + } + if (count == fileAsset.size) { + return true + } + + } + return false + } + + fun isSameFiles(assetManager: AssetManager, assetDir: String, dir: String): Boolean { + var fileAsset = assetManager.list(assetDir) + if (fileAsset == null || fileAsset.isEmpty()){ + return false; + } + var result = true; + for (i in 0 until fileAsset.size) { + val finalI = i + try { + // 获得每个文件的名字 + val fileName = fileAsset[finalI]; + val outFile = File("${dir}/${fileName}"); + // 判断文件是否存在 + if (CompileConfig.DEBUG) { + Log.i(TAG, "assetop--${outFile.name},${outFile.isDirectory}") + } + val assetSecondName = "${assetDir}/${outFile.name}" + val secondList = assetManager.list(assetSecondName) + if (secondList != null && secondList.size > 0) { + result = isSameFiles(assetManager, assetSecondName, outFile.absolutePath) + if(!result){ + return false + } + } else { + if (!outFile.exists()) { + return false + } else { + //判断大小 + var inputStream: InputStream? = assetManager.open( "${assetDir}/${fileName}") + val length = inputStream?.available() + inputStream?.close() + if (CompileConfig.DEBUG) { + Log.w(TAG, "assetop--isSameFiles-length:${length},outFile:${outFile.length().toInt()}") + } + if(outFile.length().toInt() != length){ + return false + } + } + } + } catch (e: Exception) { + Log.e(TAG, "assetop--isSameFiles-e", e) + return false + } + } + + return result + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/GisGeomTool.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/GisGeomTool.java new file mode 100644 index 0000000000..94f2fc1415 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/GisGeomTool.java @@ -0,0 +1,771 @@ +package com.zhidaoauto.map.sdk.inner.utils; + +import android.util.Log; + +import com.zhidaoauto.map.sdk.inner.CompileConfig; +import com.zhidaoauto.map.sdk.open.query.LonLatPoint; + +import java.util.ArrayList; + +public class GisGeomTool { + + private static final String TAG = "GisGeomTool"; + + public static final float PI = 3.1415926535897932384626433832795f; + public static final double DOUBLE_ZERO = Double.valueOf(1E-307); + + ///////////////////////////////////////////////////////////////////////// + /// @brief 判断点是否在线段范围(线段两端点的垂线区间)内 + /// @param[in] ptStart 线段起点坐标 + /// @param[in] ptEnd 线段终点坐标 + /// @param[in] ptSrc 要判断的点坐标 + /// @return 点在线段之间。返回true;否则返回false + ///////////////////////////////////////////////////////////////////////// + public static boolean IsInsideLineSeagmentRange(LonLatPoint ptStart, LonLatPoint ptEnd, LonLatPoint ptSrc) { + //用余弦绝对值判断,如果ptSrc与startptSrc、ptEnd连线的夹角都小于90度,则垂足落在线段上,否则在线段外 + double a = (ptSrc.getLongitude() - ptStart.getLongitude()) * (ptSrc.getLongitude() - ptStart.getLongitude()) + (ptSrc.getLatitude() - ptStart.getLatitude()) * (ptSrc.getLatitude() - ptStart.getLatitude()); + double b = (ptSrc.getLongitude() - ptEnd.getLongitude()) * (ptSrc.getLongitude() - ptEnd.getLongitude()) + (ptSrc.getLatitude() - ptEnd.getLatitude()) * (ptSrc.getLatitude() - ptEnd.getLatitude()); + double c = (ptStart.getLongitude() - ptEnd.getLongitude()) * (ptStart.getLongitude() - ptEnd.getLongitude()) + (ptStart.getLatitude() - ptEnd.getLatitude()) * (ptStart.getLatitude() - ptEnd.getLatitude()); + + double abs1 = a + c - b; + double abs2 = b + c - a; + if ((abs1 > 0 && abs2 >= 0) || (abs1 >= 0 && abs2 > 0)) { + return true; + } else { + return false; + } + } + + ///////////////////////////////////////////////////////////////////////// + /// @brief 计算点到线的距离 + /// @param[in] ptOrg 待计算的点 + /// @param[in] pLine 线坐标 + /// @param[in] nPtNum 线坐标数目 + /// @param[out] ptMatch 点在线上匹配点 + /// @param[out] nSegmentOrder 匹配点在线上的段数 + /// @return 点到线的距离 + ///////////////////////////////////////////////////////////////////////// + public static double GetDisFromPointToLine(LonLatPoint ptOrg, ArrayList pLine, int nPtNum, LonLatPoint ptMatch, int nSegmentOrder) { + LonLatPoint ptStartPoint = pLine.get(0); + LonLatPoint ptEndPoint = new LonLatPoint(); + + double x1, x2, y1, y2; + double k; //斜率 + double dLength = Double.MAX_VALUE; + double l1 = 0.0; + double l2 = Double.MAX_VALUE; + double dCurSemMatchDis = 0.0; //当前线段的匹配距离 + + double xx = ptOrg.getLongitude(); + double yy = ptOrg.getLatitude(); + + double dCurMatchX = 0.0; //当前匹配点X坐标 + double dCurMatchY = 0.0; //当前匹配点Y坐标 + + //循环查找最近的线段 + for (int n = 1; n < pLine.size(); n++) { + ptEndPoint.setLongitude(pLine.get(n).getLongitude()); + ptEndPoint.setLatitude(pLine.get(n).getLatitude()); + + x1 = ptStartPoint.getLongitude(); + y1 = ptStartPoint.getLatitude(); + x2 = ptEndPoint.getLongitude(); + y2 = ptEndPoint.getLatitude(); + + if ((Math.abs(x2 - x1) < DOUBLE_ZERO) && (Math.abs(y1 - y2) < DOUBLE_ZERO)) { + continue; + } + + if (Math.abs(x2 - x1) < DOUBLE_ZERO) // 垂直 + { + if (IsInsideLineSeagmentRange(ptStartPoint, ptEndPoint, ptOrg)) //如果在此线段之间上 + { + dCurSemMatchDis = Math.abs(xx - x1); + dCurMatchX = x1; //x与起点的相同,因为是垂直,三个点起点都相同 + dCurMatchY = yy; //y使用自己的y + } else { + l1 = Math.sqrt((xx - x1) * (xx - x1) + (yy - y1) * (yy - y1)); + l2 = Math.sqrt((xx - x2) * (xx - x2) + (yy - y2) * (yy - y2)); + + if (l1 < l2) { + dCurSemMatchDis = l1; + dCurMatchX = x1; + dCurMatchY = y1; + } else { + dCurSemMatchDis = l2; + dCurMatchX = x2; + dCurMatchY = y2; + } + } + } else if (Math.abs(y1 - y2) < DOUBLE_ZERO) //水平 + { + if ((xx < Math.max(x1, x2)) && (xx > Math.min(x1, x2))) { + dCurSemMatchDis = Math.abs(yy - y1); + dCurMatchX = xx; + dCurMatchY = y1; + } else { + l1 = Math.sqrt((xx - x1) * (xx - x1) + (yy - y1) * (yy - y1)); + l2 = Math.sqrt((xx - x2) * (xx - x2) + (yy - y2) * (yy - y2)); + if (l1 < l2) { + dCurSemMatchDis = l1; + dCurMatchX = x1; + dCurMatchY = y1; + } else { + dCurSemMatchDis = l2; + dCurMatchX = x2; + dCurMatchY = y2; + } + } + } else { + + if ((Math.abs(xx - x2) < DOUBLE_ZERO && Math.abs(yy - y2) < DOUBLE_ZERO) || + (Math.abs(xx - x1) < DOUBLE_ZERO && Math.abs(yy - y1) < DOUBLE_ZERO)) //判断是否是首末点 + { + dCurSemMatchDis = 0.0; + dCurMatchX = xx; + dCurMatchY = yy; + } else if (IsInsideLineSeagmentRange(ptStartPoint, ptEndPoint, ptOrg)) //如果在此线段之间上 + { + k = (y2 - y1) / (x2 - x1); + dCurMatchX = (xx + k * k * x2 - y2 * k + yy * k) / (k * k + 1); //求出交点X + dCurMatchY = (dCurMatchX - x2) * k + y2; //求出交点Y + + dCurSemMatchDis = Math.sqrt((xx - dCurMatchX) * (xx - dCurMatchX) + (yy - dCurMatchY) * (yy - dCurMatchY)); + //xx = (xd + k*k*x2-y2*k+yd*k)/(k*k+1);//求出交点 + //yy = (xx - x2 )*k+y2; //坐标 + } else { //不在此线段上,求与节点的距离 + l1 = Math.sqrt((xx - x1) * (xx - x1) + (yy - y1) * (yy - y1)); + l2 = Math.sqrt((xx - x2) * (xx - x2) + (yy - y2) * (yy - y2)); + + if (l1 < l2) { + dCurSemMatchDis = l1; + dCurMatchX = x1; + dCurMatchY = y1; + } else { + dCurSemMatchDis = l2; + dCurMatchX = x2; + dCurMatchY = y2; + } + } + } + + if (dCurSemMatchDis < dLength) { + ptMatch.setLongitude(dCurMatchX); + ptMatch.setLatitude(dCurMatchY); + dLength = dCurSemMatchDis; + nSegmentOrder = n; + } + ptStartPoint.setLongitude(ptEndPoint.getLongitude()); + ptStartPoint.setLatitude(ptEndPoint.getLatitude()); + }// end for + return dLength; + } + + ///////////////////////////////////////////////////////////////////////// + /// @brief 计算点到线的距离 + /// @param[in] ptOrg 待计算的点 + /// @param[in] pLine 线坐标 + /// @param[in] nPtNum 线坐标数目 + /// @param[out] ptMatch 点在线上匹配点 + /// @param[out] nSegmentOrder 匹配点在线上的段数 + /// @return 点到线的距离 + ///////////////////////////////////////////////////////////////////////// + public static double GetDisFromPointToLine(LonLatPoint ptOrg, ArrayList pLine, LonLatPoint ptMatch, int nSegmentOrder) { + if(pLine == null || pLine.size() <= 0){ + return -1; + } + + if(pLine.size()>=2){ +// boolean flag = MathUtils.INSTANCE.isPointVerticalLine(ptOrg.getLongitude(),ptOrg.getLatitude(), +// pLine.get(0).getLongitude(),pLine.get(0).getLatitude(), +// pLine.get(pLine.size()-1).getLongitude(),pLine.get(pLine.size()-1).getLatitude()); + boolean flag = IsInsideLineSeagmentRange(pLine.get(0), + pLine.get(pLine.size()-1), + ptOrg); + if(!flag){ + return -1; + } + } + if(CompileConfig.INSTANCE.getDEBUG()){ + Log.i(TAG, "PointToLineop---GetDisFromPointToLine: start"); + } + LonLatPoint ptStartPoint = new LonLatPoint(pLine.get(0).getLongitude(), pLine.get(0).getLatitude()); + LonLatPoint ptEndPoint = new LonLatPoint(); + + double x1, x2, y1, y2; + double k; //斜率 + double dLength = Double.MAX_VALUE; + double l1 = 0; + double l2 = Double.MAX_VALUE; + double dCurSemMatchDis = 0; //当前线段的匹配距离 + + double xx = ptOrg.getLongitude(); + double yy = ptOrg.getLatitude(); + + double dCurMatchX = 0; //当前匹配点X坐标 + double dCurMatchY = 0; //当前匹配点Y坐标 + + //循环查找最近的线段 + for (int n = 1; n < pLine.size(); n++) { + ptEndPoint.setLongitude(pLine.get(n).getLongitude()); + ptEndPoint.setLatitude(pLine.get(n).getLatitude()); + + x1 = ptStartPoint.getLongitude(); + y1 = ptStartPoint.getLatitude(); + x2 = ptEndPoint.getLongitude(); + y2 = ptEndPoint.getLatitude(); + + if ((Math.abs(x2 - x1) < DOUBLE_ZERO) && (Math.abs(y1 - y2) < DOUBLE_ZERO)) { + continue; + } + + if (Math.abs(x2 - x1) < DOUBLE_ZERO) // 垂直 + { + if (IsInsideLineSeagmentRange(ptStartPoint, ptEndPoint, ptOrg)) //如果在此线段之间上 + { + dCurSemMatchDis = Math.abs(xx - x1); + dCurMatchX = x1; //x与起点的相同,因为是垂直,三个点起点都相同 + dCurMatchY = yy; //y使用自己的y + } else { + l1 = Math.sqrt((xx - x1) * (xx - x1) + (yy - y1) * (yy - y1)); + l2 = Math.sqrt((xx - x2) * (xx - x2) + (yy - y2) * (yy - y2)); + + if (l1 < l2) { + dCurSemMatchDis = l1; + dCurMatchX = x1; + dCurMatchY = y1; + } else { + dCurSemMatchDis = l2; + dCurMatchX = x2; + dCurMatchY = y2; + } + } + } else if (Math.abs(y1 - y2) < DOUBLE_ZERO) //水平 + { + if ((xx < Math.max(x1, x2)) && (xx > Math.min(x1, x2))) { + dCurSemMatchDis = Math.abs(yy - y1); + dCurMatchX = xx; + dCurMatchY = y1; + } else { + l1 = Math.sqrt((xx - x1) * (xx - x1) + (yy - y1) * (yy - y1)); + l2 = Math.sqrt((xx - x2) * (xx - x2) + (yy - y2) * (yy - y2)); + if (l1 < l2) { + dCurSemMatchDis = l1; + dCurMatchX = x1; + dCurMatchY = y1; + } else { + dCurSemMatchDis = l2; + dCurMatchX = x2; + dCurMatchY = y2; + } + } + } else { + + if ((Math.abs(xx - x2) < DOUBLE_ZERO && Math.abs(yy - y2) < DOUBLE_ZERO) || + (Math.abs(xx - x1) < DOUBLE_ZERO && Math.abs(yy - y1) < DOUBLE_ZERO)) //判断是否是首末点 + { + dCurSemMatchDis = 0; + dCurMatchX = xx; + dCurMatchY = yy; + } else if (IsInsideLineSeagmentRange(ptStartPoint, ptEndPoint, ptOrg)) //如果在此线段之间上 + { + k = (double) (y2 - y1) / (double) (x2 - x1); + dCurMatchX = (xx + k * k * x2 - y2 * k + yy * k) / (k * k + 1); //求出交点X + dCurMatchY = (dCurMatchX - x2) * k + y2; //求出交点Y + + dCurSemMatchDis = Math.sqrt((xx - dCurMatchX) * (xx - dCurMatchX) + (yy - dCurMatchY) * (yy - dCurMatchY)); + //xx = (xd + k*k*x2-y2*k+yd*k)/(k*k+1);//求出交点 + //yy = (xx - x2 )*k+y2; //坐标 + } else { //不在此线段上,求与节点的距离 + l1 = Math.sqrt((xx - x1) * (xx - x1) + (yy - y1) * (yy - y1)); + l2 = Math.sqrt((xx - x2) * (xx - x2) + (yy - y2) * (yy - y2)); + + if (l1 < l2) { + dCurSemMatchDis = l1; + dCurMatchX = x1; + dCurMatchY = y1; + } else { + dCurSemMatchDis = l2; + dCurMatchX = x2; + dCurMatchY = y2; + } + } + } + + if (dCurSemMatchDis < dLength) { + ptMatch.setLongitude(dCurMatchX); + ptMatch.setLatitude(dCurMatchY); + dLength = dCurSemMatchDis; + nSegmentOrder = n; + } + ptStartPoint.setLongitude(ptEndPoint.getLongitude()); + ptStartPoint.setLatitude(ptEndPoint.getLatitude()); + }// end for + + if(CompileConfig.INSTANCE.getDEBUG()){ + Log.i(TAG, "PointToLineop---GetDisFromPointToLine: middle "+nSegmentOrder); + } + + if((nSegmentOrder - 1) < pLine.size() && nSegmentOrder < pLine.size()) { + double angle = GetLineAngle(pLine.get(nSegmentOrder - 1).getLongitude(), pLine.get(nSegmentOrder - 1).getLatitude(), pLine.get(nSegmentOrder).getLongitude(), pLine.get(nSegmentOrder).getLatitude()); + +// double dTotal = distance(pLine.get(nSegmentOrder).getLongitude(), pLine.get(nSegmentOrder).getLatitude(), pLine.get(nSegmentOrder - 1).getLongitude(), pLine.get(nSegmentOrder - 1).getLatitude()); +// double dFront = distance(ptMatch.getLongitude(), ptMatch.getLatitude(), pLine.get(nSegmentOrder - 1).getLongitude(), pLine.get(nSegmentOrder - 1).getLatitude()); +// float angle = (float) (pLine.get(nSegmentOrder - 1).getAngle() + (pLine.get(nSegmentOrder).getAngle() - pLine.get(nSegmentOrder - 1).getAngle()) * (dFront / dTotal)); + ptMatch.setAngle((float) angle); + } + if(CompileConfig.INSTANCE.getDEBUG()){ + Log.i(TAG, "PointToLineop---GetDisFromPointToLine: end "+ptMatch+",dLength:"+dLength); + } + return dLength; + } + + + + static double minDistance(double x, double y, double x1, double y1, double x2, double y2) + { + double cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1); +// System.out.println("1.cross:"+cross); + if (cross <= 0){ + return Math.sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)); + } + + double d2 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); +// System.out.println("2.d2:"+cross); + if (cross >= d2){ + return Math.sqrt((x - x2) * (x - x2) + (y - y2) * (y - y2)); + } + + double r = cross / d2; + double px = x1 + (x2 - x1) * r; + double py = y1 + (y2 - y1) * r; +// System.out.println("3.r:"+r+",px:"+px+",py:"+py); + return Math.sqrt((x - px) * (x - px) + (py - y) * (py - y)); + } + + //判断点是否在平面内,如果点在平面边上也算是在平面内 + public static int SignOfDet2x2(double x1, double y1, double x2, double y2) { + // returns -1 if the determinant is negative, + // returns 1 if the determinant is positive, + // retunrs 0 if the determinant is null. + int sign; + double swap; + double k; + int count = 0; + + //callCount++; // debugging only + + sign = 1; + + /* + * testing null entries + */ + if ((x1 == 0.0) || (y2 == 0.0)) { + if ((y1 == 0.0) || (x2 == 0.0)) { + return 0; + } else if (y1 > 0) { + if (x2 > 0) { + return -sign; + } else { + return sign; + } + } else { + if (x2 > 0) { + return sign; + } else { + return -sign; + } + } + } + if ((y1 == 0.0) || (x2 == 0.0)) { + if (y2 > 0) { + if (x1 > 0) { + return sign; + } else { + return -sign; + } + } else { + if (x1 > 0) { + return -sign; + } else { + return sign; + } + } + } + + /* + * making y coordinates positive and permuting the entries + */ + /* + * so that y2 is the biggest one + */ + if (0.0 < y1) { + if (0.0 < y2) { + if (y1 <= y2) { + ; + } else { + sign = -sign; + swap = x1; + x1 = x2; + x2 = swap; + swap = y1; + y1 = y2; + y2 = swap; + } + } else { + if (y1 <= -y2) { + sign = -sign; + x2 = -x2; + y2 = -y2; + } else { + swap = x1; + x1 = -x2; + x2 = swap; + swap = y1; + y1 = -y2; + y2 = swap; + } + } + } else { + if (0.0 < y2) { + if (-y1 <= y2) { + sign = -sign; + x1 = -x1; + y1 = -y1; + } else { + swap = -x1; + x1 = x2; + x2 = swap; + swap = -y1; + y1 = y2; + y2 = swap; + } + } else { + if (y1 >= y2) { + x1 = -x1; + y1 = -y1; + x2 = -x2; + y2 = -y2; + ; + } else { + sign = -sign; + swap = -x1; + x1 = -x2; + x2 = swap; + swap = -y1; + y1 = -y2; + y2 = swap; + } + } + } + + /* + * making x coordinates positive + */ + /* + * if |x2| < |x1| one can conclude + */ + if (0.0 < x1) { + if (0.0 < x2) { + if (x1 <= x2) { + ; + } else { + return sign; + } + } else { + return sign; + } + } else { + if (0.0 < x2) { + return -sign; + } else { + if (x1 >= x2) { + sign = -sign; + x1 = -x1; + x2 = -x2; + ; + } else { + return -sign; + } + } + } + + /* + * all entries strictly positive x1 <= x2 and y1 <= y2 + */ + while (true) { + count = count + 1; + k = Math.floor(x2 / x1); + x2 = x2 - k * x1; + y2 = y2 - k * y1; + + /* + * testing if R (new U2) is in U1 rectangle + */ + if (y2 < 0.0) { + return -sign; + } + if (y2 > y1) { + return sign; + } + + /* + * finding R' + */ + if (x1 > x2 + x2) { + if (y1 < y2 + y2) { + return sign; + } + } else { + if (y1 > y2 + y2) { + return -sign; + } else { + x2 = x1 - x2; + y2 = y1 - y2; + sign = -sign; + } + } + if (y2 == 0.0) { + if (x2 == 0.0) { + return 0; + } else { + return -sign; + } + } + if (x2 == 0.0) { + return sign; + } + + /* + * exchange 1 and 2 role. + */ + k = (float) Math.floor(x1 / x2); + x1 = x1 - k * x2; + y1 = y1 - k * y2; + + /* + * testing if R (new U1) is in U2 rectangle + */ + if (y1 < 0.0) { + return sign; + } + if (y1 > y2) { + return -sign; + } + + /* + * finding R' + */ + if (x2 > x1 + x1) { + if (y2 < y1 + y1) { + return -sign; + } + } else { + if (y2 > y1 + y1) { + return sign; + } else { + x1 = x2 - x1; + y1 = y2 - y1; + sign = -sign; + } + } + if (y1 == 0.0) { + if (x1 == 0.0) { + return 0; + } else { + return sign; + } + } + if (x1 == 0.0) { + return -sign; + } + } + } + + public static boolean incPoint(ArrayList lon, ArrayList lat, int length, double px, double py) { + int i = 0; + + double p1x = 0; + double p1y = 0; + double p2x = 0; + double p2y = 0; + + double x1 = 0; + double y1 = 0; + double x2 = 0; + double y2 = 0; + + double xInt = 0; + int crossings = 0; + + p2x = lon.get(0); + p2y = lat.get(0); + for (i = 1; i < length; i++) { + p1x = lon.get(i); + p1y = lat.get(i); + if (((p1y > py) && (p2y <= py)) || ((p2y > py) && (p1y <= py))) { + x1 = p1x - px; + y1 = p1y - py; + x2 = p2x - px; + y2 = p2y - py; + + xInt = SignOfDet2x2(x1, y1, x2, y2) / (y2 - y1); + + if (xInt > 0.0) { + crossings++; + } + } + p2x = p1x; + p2y = p1y; + } + if ((crossings % 2) == 1) { + return true; + } else { + return false; + } + } + + public static boolean incPoint(ArrayList vecClose, double px, double py) { + int i = 0; + + double p1x = 0; + double p1y = 0; + double p2x = 0; + double p2y = 0; + + double x1 = 0; + double y1 = 0; + double x2 = 0; + double y2 = 0; + + double xInt = 0; + int crossings = 0; + + p2x = vecClose.get(0).getLongitude(); + p2y = vecClose.get(0).getLatitude(); + for (i = 1; i < vecClose.size(); i++) { + p1x = vecClose.get(i).getLongitude(); + p1y = vecClose.get(i).getLatitude(); + if (((p1y > py) && (p2y <= py)) || ((p2y > py) && (p1y <= py))) { + x1 = p1x - px; + y1 = p1y - py; + x2 = p2x - px; + y2 = p2y - py; + + xInt = SignOfDet2x2(x1, y1, x2, y2) / (y2 - y1); + + if (xInt > 0.0) { + crossings++; + } + } + p2x = p1x; + p2y = p1y; + } + if ((crossings % 2) == 1) { + return true; + } else { + return false; + } + } + + public static boolean incLonLatPoint(ArrayList vecClose, double px, double py) { + int i = 0; + + double p1x = 0; + double p1y = 0; + double p2x = 0; + double p2y = 0; + + double x1 = 0; + double y1 = 0; + double x2 = 0; + double y2 = 0; + + double xInt = 0; + int crossings = 0; + + p2x = vecClose.get(0).getLongitude(); + p2y = vecClose.get(0).getLatitude(); + for (i = 1; i < vecClose.size(); i++) { + p1x = vecClose.get(i).getLongitude(); + p1y = vecClose.get(i).getLatitude(); + if (((p1y > py) && (p2y <= py)) || ((p2y > py) && (p1y <= py))) { + x1 = p1x - px; + y1 = p1y - py; + x2 = p2x - px; + y2 = p2y - py; + + xInt = SignOfDet2x2(x1, y1, x2, y2) / (y2 - y1); + + if (xInt > 0.0) { + crossings++; + } + } + p2x = p1x; + p2y = p1y; + } + if ((crossings % 2) == 1) { + return true; + } else { + return false; + } + } + + public static double distance(LonLatPoint P1, LonLatPoint P2) { + double dx = P1.getLongitude() - P2.getLongitude(); + double dy = P1.getLatitude() - P2.getLatitude(); + double dz = P1.getAngle() - P2.getAngle(); + + return Math.sqrt(dx * dx + dy * dy + dz * dz); + } + + public static double distance(double x1, double y1, double x2, double y2) { + double dx = x2 - x1; + double dy = y2 - y1; + + return Math.sqrt(dx * dx + dy * dy); + } + + public static double getAngleToNorth(double x, double y) { + double resAngle = 0; + + if (0 == x && 0 == y) { + resAngle = -400; + } else if (0 == y) { + if (0 < x) { + resAngle = 90; + } else { + resAngle = 270; + } + } else if (0 == x) { + if (0 < y) { + resAngle = 0; + } else { + resAngle = 180; + } + } else if (0 < y) { + resAngle = (Math.atan((x / y)) * 180 / PI); + if (0 > resAngle) { + resAngle += 360; + } + } else { + resAngle = (180 + Math.atan((x / y)) * 180 / PI); + } + return resAngle; + } + + //求正北夹角 + public static double GetLineAngle(double dX1, double dY1, double dX2, double dY2) { + return getAngleToNorth((dX2 - dX1), (dY2 - dY1)); + } + + + public static void main(String[] args) { + double angle = GetLineAngle(116.72335739,40.20216178,116.72340208,40.20221491); + System.out.println("angle:"+angle); + System.out.println("Radians:"+Math.toRadians(angle)); + } + + + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/LogHelper.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/LogHelper.java new file mode 100644 index 0000000000..e887623627 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/LogHelper.java @@ -0,0 +1,44 @@ +package com.zhidaoauto.map.sdk.inner.utils; + +import android.util.Log; + +public class LogHelper { + + private static boolean mIsDebug = true; + private static String mLogTag = "map_sdk"; + private static final String CLASS_METHOD_LINE_FORMAT = "%s.%s() Line:%d (%s)"; + + public static void i(String s){ + if(mIsDebug){ + StackTraceElement traceElement = Thread.currentThread() + .getStackTrace()[3]; + String log = String.format(CLASS_METHOD_LINE_FORMAT, + traceElement.getClassName(), traceElement.getMethodName(), + traceElement.getLineNumber(), traceElement.getFileName()); + Log.i(mLogTag, log + ":" + s); + } + } + + private static int showLength = 3800; + + public static void info(String tag, String logContent) { + if(!mIsDebug){ + return; + } + if (logContent.length() > showLength) { + String show = logContent.substring(0, showLength); + Log.i(tag, show); + /*剩余的字符串如果大于规定显示的长度,截取剩余字符串进行递归,否则打印结果*/ + if ((logContent.length() - showLength) > showLength) { + String partLog = logContent.substring(showLength, logContent.length()); + info(tag, partLog); + } else { + String printLog = logContent.substring(showLength, logContent.length()); + Log.i(tag, printLog); + } + } else { + Log.e(tag, logContent); + } + } + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/MainInfo.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/MainInfo.java new file mode 100644 index 0000000000..130e91f0ac --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/MainInfo.java @@ -0,0 +1,88 @@ +package com.zhidaoauto.map.sdk.inner.utils; + +import java.io.File; +import java.io.FileWriter; +import java.io.PrintWriter; +import java.text.SimpleDateFormat; +import java.util.Date; + +public class MainInfo { + private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS"); + private static MainInfo m_hinst = null; + private boolean mbUserLog = true; + private static boolean mbDebug = false; + public String mWorkingDirectory = null; + + public void setUserLog(boolean mbUserLog) { + this.mbUserLog = mbUserLog; + } + + public static MainInfo GetInstance() { + if (m_hinst != null) { + return m_hinst; + } + m_hinst = new MainInfo(); + return m_hinst; + } + + public void AddLog(String log) { + if (!mbUserLog) { + return; + } + String dir = getLogDirectory(); + if (null == dir) { + return; + } + try { + FileWriter fw = new FileWriter((dir + "log.txt"), true); + String date = dateFormat.format(new Date()); + fw.write(date + " " + log + "\r\n"); + fw.close(); + } catch (Exception ex) { + } + } + + public void AddLog(Exception e) { + if (!mbUserLog) { + return; + } + String dir = getLogDirectory(); + if (null == dir) { + return; + } + try { + FileWriter fw = new FileWriter((dir + "log.txt"), true); + e.printStackTrace(new PrintWriter(fw)); + fw.close(); + } catch (Exception ex) { + } + } + + private String getLogDirectory() { + String res = mWorkingDirectory; + if (res != null) { + if (!res.endsWith("/")) { + res += "/"; + } + res += "log/"; + File f = new File(res); + if (!f.exists()) { + f.mkdirs(); + } + } + return res; + } + + public boolean isDebug() { + return mbDebug; + } + + public void setDebug(boolean debug) { + mbDebug = debug; + } + + public void setWorkDirectory(String dir) { + mWorkingDirectory = dir; + } + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/MathUtils.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/MathUtils.kt new file mode 100644 index 0000000000..8de0ccb8e3 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/MathUtils.kt @@ -0,0 +1,835 @@ +package com.zhidaoauto.map.sdk.inner.utils + +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import java.math.BigDecimal +import java.text.DateFormat +import java.text.SimpleDateFormat +import java.util.Calendar +import java.util.TimeZone +import kotlin.math.absoluteValue + +object MathUtils { + + private val TAG = javaClass.simpleName + + + /* + * 大地坐标系资料WGS-84 长半径a=6378137 短半径b=6356752.3142 扁率f=1/298.2572236 + */ + /** 长半径a=6378137 */ + private val EARTH_R = 6378137 + private val a = 6378137.0; + /** 短半径b=6356752.3142 */ + private val b = 6356752.3142; + /** 扁率f=1/298.2572236 */ + private val f = 1 / 298.2572236; + + private val jl_jd = 102834.74258026089786013677476285 // 每经度单位米; + private val jl_wd = 111712.69150641055729984301412873 // 每纬度单位米; + + fun getRound(value: Double, scale: Int): Double { + val bg = BigDecimal(value) + val result: Double = bg.setScale(scale, BigDecimal.ROUND_HALF_UP).toDouble() + return result + } + + fun getRound(value: Double): Double { + return getRound(value, 7) + } + + /** + * 获取拟合后的点 + */ + fun getFitLonLatPoint(current: LonLatPoint, list: ArrayList): LonLatPoint { + if (list.size < 2) { + return current + } + val lastOfLast = list[list.size - 2] + val last = list[list.size - 1] + val includeAngle = getIncludeAngle(lastOfLast, last, current) + if (CompileConfig.DEBUG) { + Log.i(TAG, "getFitLonLatPoint:includeAngle:${includeAngle} ") + } + if (includeAngle >= 1.0) { + return current + } + // 先获取直线的系数u ,基于两线垂直,以及三点一线 + val dx = lastOfLast.longitude - last.longitude + val dy = lastOfLast.latitude - last.latitude + var u = dx * (current.longitude - lastOfLast.longitude) + dy * (current.latitude - lastOfLast.latitude) + u /= Math.pow(dx, 2.0) + Math.pow(dy, 2.0) + val targetX = lastOfLast.longitude + u * dx + val targetY = lastOfLast.latitude + u * dy + if (CompileConfig.DEBUG) { + Log.i(TAG, "getFitLonLatPoint:origin:${current.longitude},${current.latitude}-->${targetX},${targetY} ") + } + current.longitude = targetX + current.latitude = targetY + return current + } + + /** + * 根据向量内积计算夹角 + */ + fun getIncludeAngle(zero: LonLatPoint, one: LonLatPoint, two: LonLatPoint): Double { + val dx1 = one.longitude - zero.longitude + val dy1 = one.latitude - zero.latitude + val dx2 = two.longitude - zero.longitude + val dy2 = two.latitude - zero.latitude + val innerVector = dx1 * dx2 + dy1 * dy2 + var radins = Math.acos(innerVector / (Math.sqrt(Math.pow(dx1, 2.0) + Math.pow(dy1, 2.0)) * Math.sqrt(Math.pow(dx2, 2.0) + Math.pow(dy2, 2.0)))) + return Math.toDegrees(radins) + } + + /** + * UTM角度转换为经纬度对应的角度 + */ + fun convertAngle(angle: Double, lon: Double, lat: Double): Double { + var angleOrigin = 450 - angle + var radianOrigin = Math.toRadians(angleOrigin.toDouble()) + var radianLat = Math.toRadians(lat) + val radianDeal = Math.atan2(Math.tan(radianOrigin) * Math.cos(radianLat),1.0) + var ruler = 270 + if (angle >= 0 && angle < 180) { + ruler = 90 + } else { + ruler = 270 + } + val result = ruler - Math.toDegrees(radianDeal) + return result + } + + /** + * 角度转换为经纬度对应的角度 + */ + fun convertFlatAngle(angle: Double, lon: Double, lat: Double): Double { + var angleOrigin = angle + var radianOrigin = Math.toRadians(angleOrigin.toDouble()) + var radianLat = Math.toRadians(lat) + val radianDeal = Math.atan2(Math.tan(radianOrigin) * Math.cos(radianLat),1.0) + var ruler = 270 + if (angle >= 0 && angle < 180) { + ruler = 90 + } else { + ruler = 270 + } + val result = ruler - Math.toDegrees(radianDeal) + return result + } + + + //点到线段的最小距离 + fun minDistance(x: Double, y: Double, x1: Double, y1: Double, x2: Double, y2: Double): Double { + val cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1) +// println("1.cross:$cross") + if (cross <= 0) { + return Math.sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1)) + } + val d2 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) +// println("2.d2:$cross") + if (cross > d2) { + return Math.sqrt((x - x2) * (x - x2) + (y - y2) * (y - y2)) + } + val r = cross / d2 + val px = x1 + (x2 - x1) * r + val py = y1 + (y2 - y1) * r +// println("3.r:$r,px:$px,py:$py") + return Math.sqrt((x - px) * (x - px) + (py - y) * (py - y)) + } + + //某点与线段垂直点是否在线段范围内 + fun isPointVerticalLine(x: Double, y: Double, x1: Double, y1: Double, x2: Double, y2: Double): Boolean { + val cross = (x2 - x1) * (x - x1) + (y2 - y1) * (y - y1) +// println("1.cross:$cross") + val d2 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1) +// println("2.d2:$cross") + val r = cross / d2 + if (r >= 0 && r <= 1) { + return true + } else { + return false + } + } + + fun distance(x1: Double, y1: Double, x2: Double, y2: Double): Double { + val dx = (x2 - x1)*jl_jd + val dy = (y2 - y1)*jl_wd + return Math.sqrt(dx * dx + dy * dy) + } + + fun distance(front: LonLatPoint, end: LonLatPoint): Double { + return distance(front.longitude,front.latitude,end.longitude,end.latitude) + } + + fun getDistance(lon1:Double ,lat1:Double ,lon2:Double ,lat2:Double):Double { + var radLat1 = Math.toRadians(lat1); + var radLat2 = Math.toRadians(lat2); + var a = radLat1 - radLat2; + var b = Math.toRadians(lon1) - Math.toRadians(lon2); + var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2.0) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2.0))); + s = s * EARTH_R; + s = Math.round(s * 10000) / 10000.0; + return s; + } + + + + fun calucateNewPoint(lon: Double, lat: Double, angle: Double, distance: Float): LonLatPoint? { + if (distance == 0f) { + return null + } + val radian = Math.toRadians(angle.toDouble()) + val radianCoangle = Math.toRadians(90.0 - angle.toDouble()) + var nLon = lon + distance * Math.sin(radian)/100000.0 + var nLat = lat + distance * Math.sin(radianCoangle)/100000.0 + return LonLatPoint(nLon, nLat, 0.0,angle) + } + + /** + * 度换成弧度 + * + * @param d + * 度 + * @return 弧度 + */ + private fun rad(d: Double): Double { + return d * Math.PI / 180.0 + } + + /** + * + * @Title: right + * @Description: 根据原点向右平移指定距离(纬度不变,经度变化) + * @param @param lon 经度 + * @param @param lat 纬度 + * @param @param dist 距离,单位:米 + * @param @return 参数 + * @return String 平移后的经纬度 返回类型 + */ + fun right(lon: Double, lat: Double, dist: Double): String? { + val d: Double = dist / a + val cs = Math.cos(rad(lat)) + val c = d / cs * 180.0 / Math.PI + return (lon + c).toString() + "," + lat + } + + + /** + * + * @Title: top + * @Description: 根据原点向上平移指定距离(经度不变,纬度变化) + * @param @param lon 经度 + * @param @param lat 纬度 + * @param @param dist 距离,单位:米 + * @param @return 参数 + * @return String 平移后的经纬度 返回类型 + */ + fun top(lon: Double, lat: Double, dist: Double): String? { + val d: Double = dist / a + val c = d / Math.PI * 180.0 + return lon.toString() + "," + (lat + c) + } + + /** + * 根据最近两点距离决定与哪个历史点进行方向匹配 + */ + fun getAngle(pLine: ArrayList): Float { + var tempAngle = 0.0 + if (pLine.size == 1) { + tempAngle = pLine.get(0).angle + } else { + var lonLatPoint = pLine.get(pLine.size - 1) + var lastlonLatPoint: LonLatPoint? = null + pLine?.let { + if (it.size < 5) { + lastlonLatPoint = pLine.get(0); + } else { + lastlonLatPoint = pLine.get(3); + var dis = distance(lonLatPoint.longitude, lonLatPoint.latitude, lastlonLatPoint!!.longitude, lastlonLatPoint!!.latitude) + + if (dis < 0.2) { + lastlonLatPoint = pLine.get(0) + } else if (dis < 0.8) { + lastlonLatPoint = pLine.get(1) + } else if (dis < 1.2) { + lastlonLatPoint = pLine.get(2) + } else { + lastlonLatPoint = pLine.get(3) + } + } + } + if (lonLatPoint != null && lastlonLatPoint != null) { + tempAngle = GisGeomTool.getAngleToNorth( + getRound(lonLatPoint.longitude) - getRound(lastlonLatPoint!!.longitude), + getRound(lonLatPoint.latitude) - getRound(lastlonLatPoint!!.latitude) + ) + } + + if (tempAngle == -400.0) { + tempAngle = lonLatPoint.angle + } + } + if (DEBUG) { + Log.i(TAG, "angleop--tempAngle: ${tempAngle}") + } + return tempAngle.toFloat() + + } + + /** + * 根据最近两点距离决定与哪个历史点进行方向匹配 + */ + fun getAngle(pLine: ArrayList, angles: ArrayList?): Float { + var tempAngle = 0.0 + var index = 0 + var diffValOrigin = 0.0f + var diffValCal = 0.0f + var lonLatPoint = pLine.get(pLine.size - 1) + if (pLine.size == 1) { + tempAngle = lonLatPoint.angle + } else { + var lastlonLatPoint: LonLatPoint? = null + lastlonLatPoint = pLine.get(pLine.size - 2); + var dis = distance(lonLatPoint.longitude, lonLatPoint.latitude, lastlonLatPoint!!.longitude, lastlonLatPoint!!.latitude) + + if (dis < 0.2) { + index = 0 + } else if (dis < 0.8) { + index = 1 + } else if (dis < 1.2) { + index = 2 + } else { + index = 3 + } + if (index >= pLine.size) { + index = pLine.size-2 + } + lastlonLatPoint = pLine.get(index) + if (lonLatPoint != null && lastlonLatPoint != null) { + tempAngle = GisGeomTool.getAngleToNorth( + getRound(lonLatPoint.longitude) - getRound(lastlonLatPoint!!.longitude), + getRound(lonLatPoint.latitude) - getRound(lastlonLatPoint!!.latitude) + ) + } + + if (tempAngle == -400.0) { + if (angles != null && angles.size > 0){ + tempAngle = angles.get(angles.size - 1) + }else { + tempAngle = lonLatPoint.angle + } + } + var midAngle = tempAngle + } + + return tempAngle.toFloat() + + } + + + + fun getLocationAngle(pLine: ArrayList): Float { + var tempAngle = 0.0 + val MAX_DISTANCE = 6 + var index = 0 + var lonLatPoint = pLine.get(pLine.size - 1) + if (pLine.size == 1) { + tempAngle = lonLatPoint.angle + } else { + var lastlonLatPoint: LonLatPoint? = null + var dis = 0.0 + for (i in 1 .. pLine.size-1){ + lastlonLatPoint = pLine.get(pLine.size - 1 - i) + lastlonLatPoint?.let{ + dis = distance(lonLatPoint.longitude, lonLatPoint.latitude, it.longitude, it.latitude) + index = pLine.size - 1 - i + Log.d(TAG, "angleooo--distance: ${dis}, index: ${index}") + } + if(dis >= MAX_DISTANCE){ + break + } + } + if (lonLatPoint != null && lastlonLatPoint != null) { + tempAngle = GisGeomTool.getAngleToNorth( + lonLatPoint.longitude - lastlonLatPoint!!.longitude, + lonLatPoint.latitude - lastlonLatPoint!!.latitude + ) + } + + if (tempAngle == -400.0) { + tempAngle = lonLatPoint.angle + } + + if (DEBUG) { + Log.d(TAG, "angleooo-lastlonLatPoint: ${lastlonLatPoint},distance:${dis},index:${index}, tempAngle:${tempAngle}") + } + if(DEBUG) { + for (lonlat in pLine) { + Log.d(TAG, "angleooo-lonlat: ${lonlat}") + } + } + + } + return tempAngle.toFloat() + } + + fun utcToUnix(time: Long):Long{ + val calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")) + calendar.timeInMillis = time + val localFormater = DateFormat.getInstance();//当地时间格式 + localFormater.setTimeZone(TimeZone.getDefault()); + val localTime = localFormater.format(calendar.getTime()); + return SimpleDateFormat().parse(localTime).time + } + + fun getSmoothPoints(line: ArrayList):ArrayList{ + if (DEBUG) { + Log.i(TAG, "getSmoothPoints: 平滑原始数据:${line.size}") + } + var list: ArrayList = ArrayList() + if(line.size < 11){ + return line + } + for(i in 0 until line.size){ + var numBefore = i-5 + var numAfter = i+6 + var sumX = 0.0 + var sumY = 0.0 + if(i <= 5){ + numBefore = 0 + numAfter = i*2+1 + + } + if(i >= line.size - 5){ + numBefore = line.size - (line.size-i)*2+1 + numAfter = line.size + } + + for(j in i until numAfter){ + sumX += line[j].longitude + } + for (j in numBefore until i){ + sumX += line[j].longitude + } + + for(j in i until numAfter){ + sumY += line[j].latitude + } + for (j in numBefore until i){ + sumY += line[j].latitude + } + var num = numAfter - numBefore + var x = sumX/num + var y = sumY/num + val lonlatPoint = LonLatPoint(x, y) + list.add(lonlatPoint) + } + if (DEBUG) { + Log.i(TAG, "getSmoothPoints: 平滑数据:${list.size}") + } + return list + + } + fun getPoints(line: ArrayList , factor: Float): ArrayList { + if (DEBUG) { + Log.i(TAG, "getPoints: 插值原始数据:${line.size}") + } + var lonLatPoints: ArrayList = ArrayList() + if(line != null && line.size > 0) { + var startLonLatPoint = line[0] + for (i in 0 until line.size - 1) { + var start = startLonLatPoint + var end = line[i + 1] + if (i == 0) { + lonLatPoints.add(start) + } + val x = end.latitude - start.latitude + val y = end.longitude - start.longitude + val dis = Math.sqrt(x * x + y * y).absoluteValue * 100000 + val unit = dis / factor + val num = unit.toInt() + if(num <= 0){ + continue + } + val numX = x / unit + val numY = y / unit + + for (i in 1..num) { + val lon = start.longitude + numY * i + val lat = start.latitude + numX * i + val lonlatPoint = LonLatPoint(lon, lat) + if (i == num) { + startLonLatPoint = lonlatPoint + } + lonLatPoints.add(lonlatPoint) + } + + } + } + if (DEBUG) { + Log.i(TAG, "getPoints: 插值数据:${lonLatPoints.size}") + } + return lonLatPoints + + } + + + fun getTravelList(travel: String): ArrayList{ + var list = ArrayList() + var mTravel = travel.trim() + if(mTravel.isNotEmpty()){ + if(mTravel.endsWith(",")){ + mTravel = mTravel.trim(',') + } + + var array = mTravel.split(",") + if(array != null && array.size >= 2 && array.size%2 == 0){ + for(i in 0..array.size-1 step 2){ + val lonLatPoint = LonLatPoint(array[i].toDouble(), array[i+1].toDouble()) + list.add(lonLatPoint) + } + } + } + return list + } + + fun getSubList(currentPosition: LonLatPoint, list: ArrayList, maxDis: Float): ArrayList { + var dis = Double.MAX_VALUE + var sIndex = 0 + var eIndex = list.size + for (i in 0 until list.size) { + val lonLatPoint = list[i] + val nowDis = distance(currentPosition, lonLatPoint) + if(DEBUG) { + Log.d(TAG, "getSubList--op: ${nowDis}, ${maxDis}, ${i}") + } + if (dis > nowDis) { + dis = nowDis + sIndex = i + + } + if(eIndex == list.size && nowDis > maxDis){ + eIndex = i + } + + } + if(sIndex > eIndex){ + eIndex = list.size + } + val subList = ArrayList(list.subList(sIndex, eIndex)) + if(DEBUG) { + Log.d(TAG, "getSubList--op--sIndex: ${sIndex}, eIndex: ${eIndex}, size: ${subList.size}") + } + return subList + + } + + + /** + * 计算新的点 + */ + fun destination(lng: Double, lat: Double, heading: Double, distance: Double): DoubleArray { + //计算扇形的眯点坐标 + val heading = (heading + 360) % 360 + val rad = Math.PI / 180 + val radInv = 180 / Math.PI + var lonRad = lng * rad + var latRad = lat * rad + var rheading = heading * rad + var sinLatRad = Math.sin(latRad) + var cosLatRad = Math.cos(latRad) + var cosDistR = Math.cos(distance / EARTH_R) + var sinDistR = Math.sin(distance / EARTH_R) + var lat2 = Math.asin( + sinLatRad * cosDistR + cosLatRad * sinDistR * Math.cos(rheading) + ) + var lon2 = lonRad + + Math.atan2( + Math.sin(rheading) * sinDistR * cosLatRad, + cosDistR - sinLatRad * Math.sin(lat2) + ); + lon2 = lon2 * radInv; + lon2 = if (lon2 > 180) { + lon2 - 360 + } else { + if (lon2 < -180) { + lon2 + 360 + } else { + lon2 + } + } + lat2 = lat2 * radInv + return doubleArrayOf(lon2, lat2) + } + + /** + * 处理角度在0-360之间 + */ + fun dealAngle(angle:Double):Double{ + var tempAngle = angle + if(tempAngle < 0){ + tempAngle %= 360 + tempAngle += 360 + }else if(angle >= 360){ + tempAngle %= 360 + } + return tempAngle + } + + //计算两线交点 + fun getIntersection(lineSelf: ArrayList, lineOther: ArrayList): Pair{ + + // 将两个点集转化为线段 + val segmentsOther = getSegmentsFromPoints(lineOther) + val segmentsSelf = getSegmentsFromPoints(lineSelf) + + + // 检查每对线段是否相交,并计算它们的交点 + for (segmentOther in segmentsOther) { + for (segmentSelf in segmentsSelf) { + val intersection = intersection(segmentOther, segmentSelf) + val angle = computeAngle(segmentOther, segmentSelf) + if (intersection != null) { + if(DEBUG){ + Log.d(TAG, "getIntersection--op--intersection: ${intersection}, angle: ${angle}") + } + return Pair(intersection, angle) + } + + } + } + + return Pair(null, null) + } + + // 将一个点集表示为一组线段 + private fun getSegmentsFromPoints(points: ArrayList): ArrayList> { + val segments = ArrayList>() + + for (i in 0 until points.size - 1) { + segments.add(Pair(points[i], points[i + 1])) + } + + return segments + } + + + + // 计算两个线段是否相交 相交返回交点 + fun intersection(segment1: Pair, segment2: Pair): LonLatPoint? { + // 快速排斥 + val p1 = segment1.first + val p2 = segment1.second + val q1 = segment2.first + val q2 = segment2.second + + // 快速排斥实验 + val minX1 = minOf(p1.longitude, p2.longitude) + val maxX1 = maxOf(p1.longitude, p2.longitude) + val minY1 = minOf(p1.latitude, p2.latitude) + val maxY1 = maxOf(p1.latitude, p2.latitude) + val minX2 = minOf(q1.longitude, q2.longitude) + val maxX2 = maxOf(q1.longitude, q2.longitude) + val minY2 = minOf(q1.latitude, q2.latitude) + val maxY2 = maxOf(q1.latitude, q2.latitude) + if (maxX1 < minX2 || maxX2 < minX1 || maxY1 < minY2 || maxY2 < minY1) { + return null + } + + // 跨立实验 + val v1 = LonLatPoint(q1.longitude - p1.longitude, q1.latitude - p1.latitude) + val v2 = LonLatPoint(p2.longitude - p1.longitude, p2.latitude - p1.latitude) + val v3 = LonLatPoint(q2.longitude - p1.longitude, q2.latitude - p1.latitude) + val c1 = v1.longitude * v2.latitude - v2.longitude * v1.latitude + val c2 = v3.longitude * v2.latitude - v2.longitude * v3.latitude + if (c1 * c2 >= 0) { + return null + } + + val v4 = LonLatPoint(p1.longitude - q1.longitude, p1.latitude - q1.latitude) + val v5 = LonLatPoint(q2.longitude - q1.longitude, q2.latitude - q1.latitude) + val v6 = LonLatPoint(p2.longitude - q1.longitude, p2.latitude - q1.latitude) + val c3 = v4.longitude * v5.latitude - v5.longitude * v4.latitude + val c4 = v6.longitude * v5.latitude - v5.longitude * v6.latitude + if (c3 * c4 >= 0) { + return null + } + + // 计算交点 + val denom = v2.longitude * v5.latitude - v2.latitude * v5.longitude + val s = (v1.longitude * v5.latitude - v1.latitude * v5.longitude) / denom + val t = (v4.longitude * v2.latitude - v4.latitude * v2.longitude) / denom + val longitude = p1.longitude + s * v2.longitude + val latitude = p1.latitude + s * v2.latitude + return LonLatPoint(longitude, latitude) + } + + // 计算两个线段的夹角 + fun computeAngle(segment1: Pair, segment2: Pair): Double? { + // 计算线段1的方向向量 + val v1 = LonLatPoint(segment1.second.longitude - segment1.first.longitude, segment1.second.latitude - segment1.first.latitude) + // 计算线段2的方向向量 + val v2 = LonLatPoint(segment2.second.longitude - segment2.first.longitude, segment2.second.latitude - segment2.first.latitude) + // 计算向量夹角的余弦值 + val cosAngle = (v1.longitude * v2.longitude + v1.latitude * v2.latitude) / (Math.sqrt(v1.longitude * v1.longitude + v1.latitude * v1.latitude) * Math.sqrt(v2.longitude * v2.longitude + v2.latitude * v2.latitude)) + // 返回角度值 + return Math.toDegrees(Math.acos(cosAngle)) + } + + + // 获取距离自车最近的点及其下标 + fun getNearestPoints(mLonlatPoint: LonLatPoint, pointList: MutableList): MutableList?{ + if (pointList.isEmpty()) { + return null + } + var minDistance = Double.MAX_VALUE + var nearestIndex = -1 + + for ((index, point) in pointList.withIndex()) { + val distance = distance(mLonlatPoint, point) + if (distance < minDistance) { + minDistance = distance + nearestIndex = index + + } + } + return pointList.subList(nearestIndex, pointList.size) + } + + fun isInRegion(lon: Double, lat: Double, list: List>?): Boolean { + var iSum: Int + val iCount: Int + var iIndex: Int + var dLon1 = 0.0 + var dLon2 = 0.0 + var dLat1 = 0.0 + var dLat2 = 0.0 + var dLon: Double + list?: return false + if (list.size < 3) { + return false + } + iSum = 0 + iCount = list.size + iIndex = 0 + while (iIndex < iCount) { + if (iIndex == iCount - 1) { + dLon1 = list[iIndex][0] + dLat1 = list[iIndex][1] + dLon2 = list[0][0] + dLat2 = list[0][1] + } else { + dLon1 = list[iIndex][0] + dLat1 = list[iIndex][1] + dLon2 = list[iIndex + 1][0] + dLat2 = list[iIndex + 1][1] + } + // 以下语句判断A点是否在边的两端点的水平平行线之间,在则可能有交点,开始判断交点是否在左射线上 + if (lat >= dLat1 && lat < dLat2 || lat >= dLat2 && lat < dLat1) { + if (Math.abs(dLat1 - dLat2) > 0) { + //得到 A点向左射线与边的交点的x坐标: + dLon = dLon1 - (dLon1 - dLon2) * (dLat1 - lat) / (dLat1 - dLat2) + // 如果交点在A点左侧(说明是做射线与 边的交点),则射线与边的全部交点数加一: + if (dLon < lon) { + iSum++ + } + } + } + iIndex++ + } + return iSum % 2 != 0 + } + + + @JvmStatic + fun main(args: Array) { + println("a--------------") + var distance = minDistance(1.0, 0.0, 1.0, 1.0, 2.0, 2.0) + println("a.distance:$distance") + println("b--------------") + distance = minDistance(0.0, 0.0, 1.0, 1.0, 2.0, 2.0) + println("b.distance:$distance") + println("c--------------") + distance = minDistance(1.5, 1.5, 1.0, 1.0, 2.0, 2.0) + println("c.distance:$distance") + println("d--------------") + distance = minDistance(1.5, 1.0, 1.0, 1.0, 2.0, 2.0) + println("d.distance:$distance") + println("e--------------") + distance = minDistance(1.0, 1.0, 1.0, 1.0, 2.0, 2.0) + println("e.distance:$distance") + println("f--------------") + distance = minDistance(3.0, 2.0, 1.0, 1.0, 2.0, 2.0) + println("f.distance:$distance") + println("g--------------") + distance = minDistance(2.0, 2.0, 1.0, 1.0, 2.0, 2.0) + println("g.distance:$distance") + + + println("isPointVerticalLine------------------------------------------") + println("a--------------") + var flag = isPointVerticalLine(1.0, 0.0, 1.0, 1.0, 2.0, 2.0) + println("a.flag:$flag") + println("b--------------") + flag = isPointVerticalLine(0.0, 0.0, 1.0, 1.0, 2.0, 2.0) + println("b.flag:$flag") + println("c--------------") + flag = isPointVerticalLine(1.5, 1.5, 1.0, 1.0, 2.0, 2.0) + println("c.flag:$flag") + println("d--------------") + flag = isPointVerticalLine(1.5, 1.0, 1.0, 1.0, 2.0, 2.0) + println("d.flag:$flag") + println("e--------------") + flag = isPointVerticalLine(1.0, 1.0, 1.0, 1.0, 2.0, 2.0) + println("e.flag:$flag") + println("f--------------") + flag = isPointVerticalLine(3.0, 2.0, 1.0, 1.0, 2.0, 2.0) + println("f.flag:$flag") + println("g--------------") + flag = isPointVerticalLine(2.0, 2.0, 1.0, 1.0, 2.0, 2.0) + println("g.flag:$flag") + + println("distance------------------------------------------") + + distance = distance(116.7327352, 40.199253, 116.7327352, 40.1992529) + println("distance1:$distance") + distance = GisGeomTool.GetLineAngle(116.4075717, 39.9578039, 116.4075726, 39.9578039) + println("distance2:$distance") + + println("distance11------------------------------------------") + distance = distance(116.414434199793, 39.97574147679, 116.414433569562, 39.975741521839) + println("distance3:$distance") + distance = GisGeomTool.GetLineAngle(116.414434199793, 39.97574147679, 116.414433569562, 39.975741521839) + println("angle3:$distance") + + + distance = distance(getRound(116.414434199793), getRound(39.97574147679), getRound(116.414433569562), getRound(39.975741521839)) + println("distance4:$distance") + distance = GisGeomTool.GetLineAngle(getRound(116.414434199793), getRound(39.97574147679), getRound(116.414433569562), getRound(39.975741521839)) + println("angle4:$distance") + + + distance = distance(116.411195483042, 39.981447687294, 116.411194644118, 39.981482518607) + println("distance3:$distance") + distance = GisGeomTool.GetLineAngle(116.411187354498, 39.981700976276, 116.411194408955, 39.981491094841) + println("angle3:$distance") + val t1:Long = 123456789 + print(utcToUnix(t1)) + + + val start = LonLatPoint(116.411110,39.981907,0.0,354.777771) + val des = LonLatPoint(116.411185,39.982323,0.0,354.522797) + distance = distance(start,des)*0.5f + //116.411110,39.981907,354.777771,--116.411185,39.982323--angle:354.522797,dis:21.112982-result-116.411165,39.982533 + val forea = calucateNewPoint(des.longitude,des.latitude,des.angle,distance.toFloat()) + println("main: ${distance},,${forea}") + + + val angle1 = convertAngle(359.99,112.0,39.9764534) + println("angle1: ${angle1},") + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/OBB.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/OBB.java new file mode 100644 index 0000000000..3059bfb66d --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/OBB.java @@ -0,0 +1,203 @@ +package com.zhidaoauto.map.sdk.inner.utils; + +import java.util.Arrays; + +public class OBB { + + + private double[] centerPoint; + + private double halfWidth; + + private double halfHeight; + + + private double worldCenterX; + private double worldCenterY; + + // unit vector of x axis + private double[] axisX; + // unit vector of y axis + private double[] axisY; + + // 0 -360 + private double rotation; + + private double scaleX; + private double scaleY; + + + private float offsetAxisPointDistance; + + + /** + * Create default OBB + * @param bornCenterX x + * @param bornCenterY Y + * @param worldCenterX ox + * @param worldCenterY oy + * @param halfWidth + * @param halfHeight + * @param angle + */ + public OBB(double bornCenterX, double bornCenterY, double worldCenterX, double worldCenterY, double halfWidth, double halfHeight, double angle) { + + this.halfWidth = halfWidth; + this.halfHeight = halfHeight; + this.worldCenterX = worldCenterX; + this.worldCenterY = worldCenterY; + + this.scaleX = 1.0f; + this.scaleY = 1.0f; + + this.centerPoint = new double[] { + bornCenterX, + bornCenterY + }; + + this.axisX = new double[2]; + this.axisY = new double[2]; + + double[] offsetAxisPoint = new double[] { + bornCenterX - worldCenterX, + bornCenterY - worldCenterY + }; + + this.offsetAxisPointDistance = (float) Math.sqrt(this.dot(offsetAxisPoint, offsetAxisPoint)); + + this.setRotation(angle); + } + + /** + * Get axisX and axisY projection radius distance on axis + */ + public double getProjectionRadius(double[] axis) { + + // axis, axisX and axisY are unit vector + + // projected axisX to axis + double projectionAxisX = this.dot(axis, this.axisX); + // projected axisY to axis + double projectionAxisY = this.dot(axis, this.axisY); + + + return this.halfWidth * this.scaleX * projectionAxisX + this.halfHeight * this.scaleY * projectionAxisY; + } + + /** + * OBB is collision with other OBB + */ + public boolean isCollision(OBB obb) { + // two OBB center distance vector + double[] centerDistanceVertor = { + this.centerPoint[0] - obb.centerPoint[0], + this.centerPoint[1] - obb.centerPoint[1] + }; + + + double[][] axes = { + this.axisX, + this.axisY, + obb.axisX, + obb.axisY, + }; + + for(int i = 0; i < axes.length; i++) { + // compare OBB1 radius projection add OBB2 radius projection to centerDistance projection + if(this.getProjectionRadius(axes[i]) + obb.getProjectionRadius(axes[i]) + <= this.dot(centerDistanceVertor, axes[i])) { + return false; + } + } + + return true; + } + + + /** + * dot-multiply + */ + private double dot(double[] axisA, double[] axisB) { + return Math.abs(axisA[0] * axisB[0] + axisA[1] * axisB[1]); + } + + /** + * Set axis x and y by rotation + * + * @param angle float 0 - 360 + */ + public OBB setRotation(double angle) { + this.rotation = Math.toRadians(angle); + + this.axisX[0] = (float)Math.cos(rotation); + this.axisX[1] = (float)Math.sin(rotation); + + this.axisY[0] = -(float)Math.sin(rotation); + this.axisY[1] = (float)Math.cos(rotation); + +// this.setCenter(this.centerPoint[0], this.centerPoint[1]); + + return this; + } + + /** + * Set OBB center point and will add offsetAxis value + */ + public OBB setCenter(double x, double y) { + float offsetX = this.offsetAxisPointDistance * (float)Math.cos(this.rotation); + float offsetY = this.offsetAxisPointDistance * (float)Math.sin(this.rotation); + + this.centerPoint[0] = x + offsetX; + this.centerPoint[1] = y + offsetY; + + return this; + } + + /** + * Set OBB scale x, y + */ + public OBB setScale(double scaleX, double scaleY) { + this.scaleX = scaleX; + this.scaleY = scaleY; + + return this; + } + + + public double getRotation() { + return this.rotation; + } + + public double getCenterX() { + return this.centerPoint[0]; + } + + public double getCenterY() { + return this.centerPoint[1]; + } + + public double getHalfWidth() { + return this.halfWidth * this.scaleX; + } + + public double getHalfHeight() { + return this.halfHeight * this.scaleY; + } + + @Override + public String toString() { + return "OBB{" + + "centerPoint=" + Arrays.toString(centerPoint) + + ", halfWidth=" + halfWidth + + ", halfHeight=" + halfHeight + + ", worldCenterX=" + worldCenterX + + ", worldCenterY=" + worldCenterY + + ", axisX=" + Arrays.toString(axisX) + + ", axisY=" + Arrays.toString(axisY) + + ", rotation=" + rotation + + ", scaleX=" + scaleX + + ", scaleY=" + scaleY + + ", offsetAxisPointDistance=" + offsetAxisPointDistance + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/OperationUtils.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/OperationUtils.kt new file mode 100644 index 0000000000..b75e89e527 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/OperationUtils.kt @@ -0,0 +1,35 @@ +package com.zhidaoauto.map.sdk.inner.utils + +import android.content.Context +import java.io.DataInputStream +import java.io.IOException + +object OperationUtils { + + fun fromRawResource(resId: Int,context: Context?) :ByteArray?{ + val dis = DataInputStream(context?.getResources()?.openRawResource(resId)) + var curTotSize = 64 * 1024 + var totBuffer = ByteArray(curTotSize) + val buffer = ByteArray(1024) + var size = 0 + var totSize = 0 + try { + while (dis.read(buffer).also { size = it } >= 0) { + if (totSize + size > curTotSize) { + curTotSize = (totSize + size) * 3 / 2 + val newTotBuffer = ByteArray(curTotSize) + System.arraycopy(totBuffer, 0, newTotBuffer, 0, totSize) + totBuffer = newTotBuffer + } + System.arraycopy(buffer, 0, totBuffer, totSize, size) + totSize += size + } + dis.close() + } catch (e: IOException) { + e.printStackTrace() + return null + } + + return totBuffer + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/PubFunction.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/PubFunction.java new file mode 100644 index 0000000000..87c6de7251 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/PubFunction.java @@ -0,0 +1,71 @@ +package com.zhidaoauto.map.sdk.inner.utils; + +import com.zhidaoauto.map.sdk.inner.element.MapCoordinate; +import com.zhidaoauto.map.sdk.open.nav.NavPoi; + +public class PubFunction +{ + /** + * 计算正北与(x,y)和原点组成的线段的夹角角度 + * @param x 横坐标 + * @param y 纵坐标 + * @return y轴(即正北)与(x,y)和原点组成的线段的角度,顺时针计算,值域[0, 360) + */ + public static double getAngleToNorth(double x, double y) { + double resAngle = 0; + + if (0 == x && 0 == y) //若该点与原点重合,认为是0度 + { + resAngle = 0; + } else if (0 == y) //若该点在X轴,则在正轴角度为90,在负轴角度为270 + { + if (0 < x) { + resAngle = 90; + } else { + resAngle = 270; + } + } else if (0 == x) //若该点在Y轴,则在正轴角度为0,在负轴角度为180 + { + if (0 < y) { + resAngle = 0; + } else { + resAngle = 180; + } + } else if (0 < y) //若该点在第一、二象限,角度值为 (x/y) 的反正切,若值为负,加一个周期360 + { + resAngle = (Math.atan((x / y)) * 180 / Math.PI); + if (0 > resAngle) { + resAngle += 360; + } + } else //若该点在第三、四象限,角度值为 180 与 (x/y) 的反正切之和 + { + resAngle = (180 + Math.atan((x / y)) * 180 / Math.PI); + } + return resAngle; +} + + /** + * * 计算(x1,y1),(x2,y2)连线与正北夹角 + * @param pos1 + * @param pos2 + * @return (x1,y1),(x2,y2)连线与正北夹角 + */ + public static double GetLineAngle(MapCoordinate pos1, NavPoi pos2) + { + return getAngleToNorth((pos2.getLon() - pos1.x)/5, (pos2.getLat() - pos1.y)/4); + } + + /** + * 计算(x1,y1),(x2,y2)连线与正北夹角 + * @param nX1 + * @param nY1 + * @param nX2 + * @param nY2 + * @return (x1,y1),(x2,y2)连线与正北夹角 + */ + public static double GetLineAngle(int nX1, int nY1, int nX2, int nY2) + { + return getAngleToNorth((nX2 - nX1)/5, (nY2 - nY1)/4); + } + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/Recorder.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/Recorder.kt new file mode 100644 index 0000000000..b4355a4daa --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/Recorder.kt @@ -0,0 +1,218 @@ +package com.zhidaoauto.map.sdk.inner.utils + +import android.content.Context +import android.os.Environment +import android.text.TextUtils +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.controller.CommonController +import com.zhidaoauto.map.sdk.open.data.MapDataApi +import io.netty.util.internal.ConcurrentSet +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.launch +import java.io.File +import java.io.FileWriter +import java.io.IOException +import java.util.Collections + +object Recorder { + + var mWorkingDirectory: String? = null + + private val TAG = "self" + + private val DEFAULT_INSTANCE = "common" + + private var saveJob: Job? = null + + private val FILE_MAX_SIZE = 20 * 1024 * 1024 + + private var mLastPath:String? = null + + //任务列表 + private val saveJobList = ConcurrentSet() + //是否记录操作日志 + var isWork = true + + private val comparator = object : Comparator { + override fun compare(o1: String?, o2: String?): Int { + return if (!TextUtils.isEmpty(o1) + && !TextUtils.isEmpty(o2) + && o1!!.replace("-","").toLong() < o2!!.replace("-","").toLong() + ) -1 else 1 + } + } + fun add(content: String) { + i(DEFAULT_INSTANCE,"${System.currentTimeMillis()},$content") + } + + fun i(instance: String,content: String) { + if(!isWork){ + return + } + val scope = CommonController.instance.scope + if(saveJobList.size > 10){ + + val needDeleteSize = saveJobList.size - 5 + if(CompileConfig.DEBUG){ + Log.i(TAG, "i-cancel: $needDeleteSize") + } + var deleteIndex = 0 + val it = saveJobList.iterator() + while(it.hasNext() && deleteIndex < needDeleteSize){ + val job = it.next() + job?.cancel() + it.remove() + deleteIndex += 1 + + + } + } + saveJob = scope?.launch(Dispatchers.IO) { + val path = write(TAG,instance,content) + //处理回调逻辑 + mLastPath?.let{ + if(!it.equals(path)){ + //TODO MATT +// CommonEventController.instance.dispatchLog(it) + //检查是否需要删除文件 + checkLog(TAG) + } + } + mLastPath = path + + } + saveJob?.let { + saveJobList.add(it) + } + } + + suspend fun checkLog(name:String) { + val dir = getLogDirectory(name) + if (dir != null) { + Log.i(TAG, "checkLog: $dir") + val file = File(dir) + if (file != null && file.exists()) { + val array = file.list() + if (array == null || array.size <= 3) { + return + } + Log.i(TAG, "checkLog: ${array.contentDeepToString()}") + val list = array.asList() + Collections.sort(list, comparator) + val it = list.subList(0, list.size - 3).iterator() + while (it.hasNext()) { + val name = it.next() + delete(File("${dir}/${name}")) + } + } + + } + } + + suspend fun delete(file: File) { + if (file.isDirectory) { + val list = file.listFiles() + if(list == null){ + return + } + for (f in list) { + delete(f) + } + file.delete() + } else if (file.exists()) { + file.delete() + } + } + + + suspend fun write(fileName:String,instance: String,content: String):String { + val dir = dealFilePath(fileName,instance) + if (dir != null) { + try { + val fw = FileWriter("${dir}", true) + fw.write("$content\r\n") + fw.close() + } catch (e: Exception) { + e.printStackTrace() + } + } + return dir + } + + private fun dealName(name: String): String { + return if (!name.contains("_")) { + name + "_1" + } else { + val array = name.split("_").toTypedArray() + if (array.size == 2) { + var nameIndex = array[1].toInt() + ++nameIndex + array[0] + "_" + nameIndex + } else { + array[0] + "_11" + } + } + } + //处理log 路径 + private fun dealFilePath(name:String,instance:String):String{ + val fileDir: String = DateUtils.getCurrentDate() + val path = File(getLogDirectory(name) + "/" + fileDir+"/$instance") + if (!path.exists()) { + path.mkdirs() + } + return dealLogFile(path,name) + } + + //处理log文件名称 + private fun dealLogFile(path: File,filename: String): String { + var filename = filename + val file = File(path.absolutePath + "/${filename}.txt") + if (!file.exists()) { + try { + file.createNewFile() + } catch (var5: IOException) { + var5.printStackTrace() + } + } else if (file.length() > FILE_MAX_SIZE) { + filename = dealName(filename) + return dealLogFile(path,filename) + } + return file.absolutePath + } + + + fun getLogDirectory(name: String): String? { + var res: String = if (!TextUtils.isEmpty(mWorkingDirectory)) { + "${mWorkingDirectory}$name" + } else { + val context:Context? = MapDataApi.getContext() + if(context != null){ + context.externalCacheDir.absolutePath +"/map/$name" + + }else{ + Environment.getExternalStorageDirectory().absolutePath + "/Android/data/map/$name" + } + } + if (!res.endsWith("/")) { + res = "$res/" + } + val f = File(res) + if (!f.exists()) { + f.mkdirs() + } + return res + } + + fun exit(){ + if(saveJobList.size > 0){ + val it = saveJobList.iterator() + while(it.hasNext()){ + val job = it.next() + job?.cancel() + it.remove() + } + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/SharedPrefsMgr.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/SharedPrefsMgr.java new file mode 100644 index 0000000000..5eb58065d4 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/SharedPrefsMgr.java @@ -0,0 +1,146 @@ +package com.zhidaoauto.map.sdk.inner.utils; + +import android.content.Context; +import android.content.SharedPreferences; + +import androidx.annotation.NonNull; + +import java.util.Set; + +public class SharedPrefsMgr { + + private static final String File_Name = "map_shared_pref"; + private static SharedPrefsMgr sInstance; + private static SharedPreferences sSharedPrefs; + + public synchronized static SharedPrefsMgr getInstance( @NonNull Context context ) { + if ( sInstance == null ) { + try { + sInstance = new SharedPrefsMgr( context.getApplicationContext() ); + } catch ( Exception e ) { + sInstance = new SharedPrefsMgr(); + } + } + return sInstance; + } + + private SharedPrefsMgr() { + + } + + private SharedPrefsMgr(Context context ) { + try { + sSharedPrefs = context.getSharedPreferences( File_Name, Context.MODE_PRIVATE ); + } catch ( Exception e ) { + e.printStackTrace(); + } + } + + public void putString(String key, String value ) { + try { + SharedPreferences.Editor editor = sSharedPrefs.edit(); + editor.putString( key, value ); + editor.apply(); + } catch ( Exception e ) { + } + } + + public String getString(String tag ) { + try { + return sSharedPrefs.getString( tag, "" ); + } catch ( Exception e ) { + return ""; + } + } + + public boolean getBoolean(String key, boolean defaultValue ) { + try { + return sSharedPrefs.getBoolean( key, defaultValue ); + } catch ( Exception e ) { + return defaultValue; + } + } + + public long getLong(String key, long defaultValue ) { + try { + return sSharedPrefs.getLong( key, defaultValue ); + } catch ( Exception e ) { + return defaultValue; + } + } + + public float getFloat(String key, float defaultValue ) { + try { + return sSharedPrefs.getFloat( key, defaultValue ); + } catch ( Exception e ) { + return defaultValue; + } + } + + public int getInt(String key, int value ) { + try { + return sSharedPrefs.getInt( key, value ); + } catch ( Exception e ) { + return value; + } + } + + public void putBoolean(String key, boolean value ) { + try { + SharedPreferences.Editor editor = sSharedPrefs.edit(); + editor.putBoolean( key, value ); + editor.apply(); + } catch ( Exception e ) { + } + } + + public void putLong(String key, long value ) { + try { + SharedPreferences.Editor editor = sSharedPrefs.edit(); + editor.putLong( key, value ); + editor.apply(); + } catch ( Exception e ) { + } + } + + public void putInt(String key, int value ) { + try { + SharedPreferences.Editor editor = sSharedPrefs.edit(); + editor.putInt( key, value ); + editor.apply(); + } catch ( Exception e ) { + } + } + + public void putFloat(String key, float value ) { + try { + SharedPreferences.Editor editor = sSharedPrefs.edit(); + editor.putFloat( key, value ); + editor.apply(); + } catch ( Exception e ) { + } + } + + public void remove( String key ) { + try { + SharedPreferences.Editor editor = sSharedPrefs.edit(); + editor.remove( key ); + editor.apply(); + } catch ( Exception e ) { + } + } + + public void putStringSet(String key, Set values ) { + try { + SharedPreferences.Editor editor = sSharedPrefs.edit(); + editor.putStringSet( key, values ); + editor.apply(); + } catch ( Exception e ) { + } + } + + public Set getStringSet(String key ) { + return sSharedPrefs.getStringSet( key, null ); + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/SunriseSunset.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/SunriseSunset.java new file mode 100644 index 0000000000..7015f153c9 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/SunriseSunset.java @@ -0,0 +1,629 @@ +package com.zhidaoauto.map.sdk.inner.utils; + +import com.zhidaoauto.map.sdk.inner.common.ConstantExt; + +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; + +public class SunriseSunset { + + // Declare and initialize variables + private double dfLat; // latitude from user + private double dfLon; // latitude from user + private Date dateInput; // date/time from user + private double dfTimeZone; // time zone from user + + private Date dateSunrise; // date and time of sunrise + private Date dateSunset; // date and time of sunset + private boolean bSunriseToday = false; // flag for sunrise on this date + private boolean bSunsetToday = false; // flag for sunset on this date + private boolean bSunUpAllDay = false; // flag for sun up all day + private boolean bSunDownAllDay = false; // flag for sun down all day + private boolean bDaytime = false; // flag for daytime, given + // hour and min in dateInput + private boolean bSunrise = false; // sunrise during hour checked + private boolean bSunset = false; // sunset during hour checked + private boolean bGregorian = false; // flag for Gregorian calendar + private int iJulian; // Julian day + private int iYear; // year of date of interest + private int iMonth; // month of date of interest + private int iDay; // day of date of interest + private int iCount; // a simple counter + private int iSign; // SUNUP.BAS: S + private double dfHourRise, dfHourSet; // hour of event: SUNUP.BAS H3 + private double dfMinRise, dfMinSet; // minute of event: SUNUP.BAS M3 + private double dfSinLat, dfCosLat; // sin and cos of latitude + private double dfZenith; // SUNUP.BAS Z: Zenith + // private SimpleDateFormat dfmtDate; // formatting for date alone + private SimpleDateFormat dfmtDateTime; // formatting for date and time + private SimpleDateFormat dfmtYear; // formatting for year + private SimpleDateFormat dfmtMonth; // formatting for month + private SimpleDateFormat dfmtDay; // formatting for day + // Many variables in SUNUP.BAS have undocumented meanings, + // and so are translated rather directly to avoid confusion: + private double dfAA1 = 0, dfAA2 = 0; // SUNUP.BAS A(2) + private double dfDD1 = 0, dfDD2 = 0; // SUNUP.BAS D(2) + private double dfC0; // SUNUP.BAS C0 + private double dfK1; // SUNUP.BAS K1 + private double dfP; // SUNUP.BAS P + private double dfJ; // SUNUP.BAS J + private double dfJ3; // SUNUP.BAS J3 + private double dfA; // SUNUP.BAS A + private double dfA0, dfA2, dfA5; // SUNUP.BAS A0, A2, A5 + private double dfD0, dfD1, dfD2, dfD5; // SUNUP.BAS D0, D1, D2, D5 + private double dfDA, dfDD; // SUNUP.BAS DA, DD + private double dfH0, dfH1, dfH2; // SUNUP.BAS H0, H1, H2 + private double dfL0, dfL2; // SUNUP.BAS L0, L2 + private double dfT, dfT0, dfTT; // SUNUP.BAS T, T0, TT + private double dfV0, dfV1, dfV2; // SUNUP.BAS V0, V1, V2 + + private TimeZone tz = TimeZone.getTimeZone("GMT"); + private double origTimeZone; + + /****************************************************************************** + * method: SunriseSunset + ******************************************************************************* + * + * Constructor for SunriseSunset class. + * + * ------------------------------------------------------------------------ + * ---- + */ + public SunriseSunset(double dfLatIn, // latitude + double dfLonIn, // longitude + Date dateInputIn, // date + TimeZone tzIn // time zone + ) { + // Calculate internal representation of timezone offset as fraction of + // hours from GMT + // Our calculations consider offsets to the West as positive, so we must + // invert + // the signal of the values provided by the standard library + double dfTimeZoneIn = 1.0 * tzIn.getOffset(dateInputIn.getTime()) / ConstantExt.RULE_INT; + + // Copy values supplied as agruments to local variables. + dfLat = dfLatIn; + dfLon = dfLonIn; + dateInput = dateInputIn; + dfTimeZone = dfTimeZoneIn; + origTimeZone = dfTimeZoneIn; + + // Call the method to do the calculations. + doCalculations(); + + } // end of class constructor + + public SunriseSunset(){ + + } + + public void set(double dfLatIn, // latitude + double dfLonIn, // longitude + Date dateInputIn, // date + TimeZone tzIn // time zone + ){ + double dfTimeZoneIn = 1.0 * tzIn.getOffset(dateInputIn.getTime()) / ConstantExt.RULE_INT; + + // Copy values supplied as agruments to local variables. + dfLat = dfLatIn; + dfLon = dfLonIn; + dateInput = dateInputIn; + dfTimeZone = dfTimeZoneIn; + origTimeZone = dfTimeZoneIn; + + // Call the method to do the calculations. + doCalculations(); + } + + /****************************************************************************** + * method: doCalculations + ******************************************************************************* + * + * Method for performing the calculations done in SUNUP.BAS. + * + * ------------------------------------------------------------------------ + * ---- + */ + private void doCalculations() { + try { + // Break out day, month, and year from date provided. + // (This is necesary for the math algorithms.) + + dfmtYear = new SimpleDateFormat("yyyy"); + dfmtYear.setLenient(false); + dfmtYear.setTimeZone(tz); + + dfmtMonth = new SimpleDateFormat("M"); + dfmtMonth.setLenient(false); + dfmtMonth.setTimeZone(tz); + + dfmtDay = new SimpleDateFormat("d"); + dfmtDay.setLenient(false); + dfmtDay.setTimeZone(tz); + + iYear = Integer.parseInt(dfmtYear.format(dateInput)); + iMonth = Integer.parseInt(dfmtMonth.format(dateInput)); + iDay = Integer.parseInt(dfmtDay.format(dateInput)); + + // Convert time zone hours to decimal days (SUNUP.BAS line 50) + dfTimeZone = dfTimeZone / 24.0; + + // NOTE: (7 Feb 2001) Here is a non-standard part of SUNUP.BAS: + // It (and this algorithm) assumes that the time zone is + // positive west, instead of the standard negative west. + // Classes calling SunriseSunset will be assuming that + // times zones are specified in negative west, so here the + // sign is changed so that the SUNUP algorithm works: + dfTimeZone = -dfTimeZone; + + // Convert longitude to fraction (SUNUP.BAS line 50) + dfLon = dfLon / 360.0; + + // Convert calendar date to Julian date: + // Check to see if it's later than 1583: Gregorian calendar + // When declared, bGregorian is initialized to false. + // ** Consider making a separate class of this function. ** + if (iYear >= 1583) { + bGregorian = true; + } + // SUNUP.BAS 1210 + dfJ = -Math.floor(7.0 // SUNUP used INT, not floor + * (Math.floor((iMonth + 9.0) / 12.0) + iYear) / 4.0) + // add SUNUP.BAS 1240 and 1250 for G = 0 + + Math.floor(iMonth * 275.0 / 9.0) + iDay + 1721027.0 + + iYear * 367.0; + + if (bGregorian) { + // SUNUP.BAS 1230 + if ((iMonth - 9.0) < 0.0) { + iSign = -1; + } else { + iSign = 1; + } + dfA = Math.abs(iMonth - 9.0); + // SUNUP.BAS 1240 and 1250 + dfJ3 = -Math + .floor((Math.floor(Math.floor(iYear + (double) iSign + * Math.floor(dfA / 7.0)) / 100.0) + 1.0) * 0.75); + // correct dfJ as in SUNUP.BAS 1240 and 1250 for G = 1 + dfJ = dfJ + dfJ3 + 2.0; + } + // SUNUP.BAS 1290 + iJulian = (int) dfJ - 1; + + // SUNUP.BAS 60 and 70 (see also line 1290) + dfT = (double) iJulian - 2451545.0 + 0.5; + dfTT = dfT / 36525.0 + 1.0; // centuries since 1900 + + // Calculate local sidereal time at 0h in zone time + // SUNUP.BAS 410 through 460 + dfT0 = (dfT * 8640184.813 / 36525.0 + 24110.5 + dfTimeZone + * 86636.6 + dfLon * 86400.0) / 86400.0; + dfT0 = dfT0 - Math.floor(dfT0); // NOTE: SUNUP.BAS uses INT() + dfT0 = dfT0 * 2.0 * Math.PI; + // SUNUP.BAS 90 + dfT = dfT + dfTimeZone; + + // SUNUP.BAS 110: Get Sun's position + for (iCount = 0; iCount <= 1; iCount++) // Loop thru only twice + { + // Calculate Sun's right ascension and declination + // at the start and end of each day. + // SUNUP.BAS 910 - 1160: Fundamental arguments + // from van Flandern and Pulkkinen, 1979 + + // declare local temporary doubles for calculations + double dfGG; // SUNUP.BAS G + double dfLL; // SUNUP.BAS L + double dfSS; // SUNUP.BAS S + double dfUU; // SUNUP.BAS U + double dfVV; // SUNUP.BAS V + double dfWW; // SUNUP.BAS W + + dfLL = 0.779072 + 0.00273790931 * dfT; + dfLL = dfLL - Math.floor(dfLL); + dfLL = dfLL * 2.0 * Math.PI; + + dfGG = 0.993126 + 0.0027377785 * dfT; + dfGG = dfGG - Math.floor(dfGG); + dfGG = dfGG * 2.0 * Math.PI; + + dfVV = 0.39785 * Math.sin(dfLL) - 0.01000 + * Math.sin(dfLL - dfGG) + 0.00333 + * Math.sin(dfLL + dfGG) - 0.00021 * Math.sin(dfLL) + * dfTT; + + dfUU = 1 - 0.03349 * Math.cos(dfGG) - 0.00014 + * Math.cos(dfLL * 2.0) + 0.00008 * Math.cos(dfLL); + + dfWW = -0.00010 - 0.04129 * Math.sin(dfLL * 2.0) + 0.03211 + * Math.sin(dfGG) - 0.00104 + * Math.sin(2.0 * dfLL - dfGG) - 0.00035 + * Math.sin(2.0 * dfLL + dfGG) - 0.00008 + * Math.sin(dfGG) * dfTT; + + // Compute Sun's RA and Dec; SUNUP.BAS 1120 - 1140 + dfSS = dfWW / Math.sqrt(dfUU - dfVV * dfVV); + dfA5 = dfLL + Math.atan(dfSS / Math.sqrt(1.0 - dfSS * dfSS)); + + dfSS = dfVV / Math.sqrt(dfUU); + dfD5 = Math.atan(dfSS / Math.sqrt(1 - dfSS * dfSS)); + + // Set values and increment t + if (iCount == 0) // SUNUP.BAS 125 + { + dfAA1 = dfA5; + dfDD1 = dfD5; + } else // SUNUP.BAS 145 + { + dfAA2 = dfA5; + dfDD2 = dfD5; + } + dfT = dfT + 1.0; // SUNUP.BAS 130 + } // end of Get Sun's Position for loop + + if (dfAA2 < dfAA1) { + dfAA2 = dfAA2 + 2.0 * Math.PI; + } + // SUNUP.BAS 150 + + dfZenith = Math.PI * 90.833 / 180.0; // SUNUP.BAS 160 + dfSinLat = Math.sin(dfLat * Math.PI / 180.0); // SUNUP.BAS 170 + dfCosLat = Math.cos(dfLat * Math.PI / 180.0); // SUNUP.BAS 170 + + dfA0 = dfAA1; // SUNUP.BAS 190 + dfD0 = dfDD1; // SUNUP.BAS 190 + dfDA = dfAA2 - dfAA1; // SUNUP.BAS 200 + dfDD = dfDD2 - dfDD1; // SUNUP.BAS 200 + + dfK1 = 15.0 * 1.0027379 * Math.PI / 180.0; // SUNUP.BAS 330 + + // Initialize sunrise and sunset times, and other variables + // hr and min are set to impossible times to make errors obvious + dfHourRise = 99.0; + dfMinRise = 99.0; + dfHourSet = 99.0; + dfMinSet = 99.0; + dfV0 = 0.0; // initialization implied by absence in SUNUP.BAS + dfV2 = 0.0; // initialization implied by absence in SUNUP.BAS + + // Test each hour to see if the Sun crosses the horizon + // and which way it is heading. + for (iCount = 0; iCount < 24; iCount++) // SUNUP.BAS 210 + { + double tempA; // SUNUP.BAS A + double tempB; // SUNUP.BAS B + double tempD; // SUNUP.BAS D + double tempE; // SUNUP.BAS E + + dfC0 = (double) iCount; + dfP = (dfC0 + 1.0) / 24.0; // SUNUP.BAS 220 + dfA2 = dfAA1 + dfP * dfDA; // SUNUP.BAS 230 + dfD2 = dfDD1 + dfP * dfDD; // SUNUP.BAS 230 + dfL0 = dfT0 + dfC0 * dfK1; // SUNUP.BAS 500 + dfL2 = dfL0 + dfK1; // SUNUP.BAS 500 + dfH0 = dfL0 - dfA0; // SUNUP.BAS 510 + dfH2 = dfL2 - dfA2; // SUNUP.BAS 510 + // hour angle at half hour + dfH1 = (dfH2 + dfH0) / 2.0; // SUNUP.BAS 520 + // declination at half hour + dfD1 = (dfD2 + dfD0) / 2.0; // SUNUP.BAS 530 + + // Set value of dfV0 only if this is the first hour, + // otherwise, it will get set to the last dfV2 (SUNUP.BAS 250) + if (iCount == 0) // SUNUP.BAS 550 + { + dfV0 = dfSinLat * Math.sin(dfD0) + dfCosLat + * Math.cos(dfD0) * Math.cos(dfH0) + - Math.cos(dfZenith); // SUNUP.BAS 560 + } else { + dfV0 = dfV2; // That is, dfV2 from the previous hour. + } + + dfV2 = dfSinLat * Math.sin(dfD2) + dfCosLat * Math.cos(dfD2) + * Math.cos(dfH2) - Math.cos(dfZenith); // SUNUP.BAS 570 + + // if dfV0 and dfV2 have the same sign, then proceed to next hr + if ((dfV0 >= 0.0 && dfV2 >= 0.0) // both are positive + || // or + (dfV0 < 0.0 && dfV2 < 0.0) // both are negative + ) { + // Break iteration and proceed to test next hour + dfA0 = dfA2; // SUNUP.BAS 250 + dfD0 = dfD2; // SUNUP.BAS 250 + continue; // SUNUP.BAS 610 + } + + dfV1 = dfSinLat * Math.sin(dfD1) + dfCosLat * Math.cos(dfD1) + * Math.cos(dfH1) - Math.cos(dfZenith); // SUNUP.BAS 590 + + tempA = 2.0 * dfV2 - 4.0 * dfV1 + 2.0 * dfV0; + // SUNUP.BAS 600 + tempB = 4.0 * dfV1 - 3.0 * dfV0 - dfV2; // SUNUP.BAS 600 + tempD = tempB * tempB - 4.0 * tempA * dfV0; // SUNUP.BAS 610 + + if (tempD < 0.0) { + // Break iteration and proceed to test next hour + dfA0 = dfA2; // SUNUP.BAS 250 + dfD0 = dfD2; // SUNUP.BAS 250 + continue; // SUNUP.BAS 610 + } + + tempD = Math.sqrt(tempD); // SUNUP.BAS 620 + + // Determine occurence of sunrise or sunset. + + // Flags to identify occurrence during this day are + // bSunriseToday and bSunsetToday, and are initialized false. + // These are set true only if sunrise or sunset occurs + // at any point in the hourly loop. Never set to false. + + // Flags to identify occurrence during this hour: + bSunrise = false; // reset before test + bSunset = false; // reset before test + + if (dfV0 < 0.0 && dfV2 > 0.0) // sunrise occurs this hour + { + bSunrise = true; // SUNUP.BAS 640 + bSunriseToday = true; // sunrise occurred today + } + + if (dfV0 > 0.0 && dfV2 < 0.0) // sunset occurs this hour + { + bSunset = true; // SUNUP.BAS 660 + bSunsetToday = true; // sunset occurred today + } + + tempE = (tempD - tempB) / (2.0 * tempA); + if (tempE > 1.0 || tempE < 0.0) // SUNUP.BAS 670, 680 + { + tempE = (-tempD - tempB) / (2.0 * tempA); + } + + // Set values of hour and minute of sunset or sunrise + // only if sunrise/set occurred this hour. + if (bSunrise) { + dfHourRise = Math.floor(dfC0 + tempE + 1.0 / 120.0); + dfMinRise = Math + .floor((dfC0 + tempE + 1.0 / 120.0 - dfHourRise) * 60.0); + } + + if (bSunset) { + dfHourSet = Math.floor(dfC0 + tempE + 1.0 / 120.0); + dfMinSet = Math + .floor((dfC0 + tempE + 1.0 / 120.0 - dfHourSet) * 60.0); + } + + // Change settings of variables for next loop + dfA0 = dfA2; // SUNUP.BAS 250 + dfD0 = dfD2; // SUNUP.BAS 250 + + } // end of loop testing each hour for an event + + // After having checked all hours, set flags if no rise or set + // bSunUpAllDay and bSundownAllDay are initialized as false + if (!bSunriseToday && !bSunsetToday) { + if (dfV2 < 0.0) { + bSunDownAllDay = true; + } else { + bSunUpAllDay = true; + } + } + + // Load dateSunrise with data + dfmtDateTime = new SimpleDateFormat("d M yyyy HH:mm z"); + + // Timezone signal is reversed in SunriseSunset class + String tz_signal = origTimeZone <= 0 ? "-" : "+"; + double abs_tz = Math.abs(origTimeZone); + NumberFormat formatter = new DecimalFormat("00"); + + String tz_offset_hours = formatter.format((int) abs_tz); + String tz_offset_minutes = formatter + .format((int) (60 * (abs_tz - (int) abs_tz))); + + if (bSunriseToday) { + dateSunrise = dfmtDateTime.parse(iDay + " " + iMonth + " " + + iYear + " " + (int) dfHourRise + ":" + + (int) dfMinRise + " GMT" + tz_signal + + tz_offset_hours + ":" + tz_offset_minutes); + } + + // Load dateSunset with data + if (bSunsetToday) { + dateSunset = dfmtDateTime.parse(iDay + " " + iMonth + " " + + iYear + " " + (int) dfHourSet + ":" + (int) dfMinSet + + " GMT" + tz_signal + tz_offset_hours + ":" + + tz_offset_minutes); + } + } // end of try + + // Catch errors + catch (ParseException e) { + e.printStackTrace(); + } // end of catch + + } + + /****************************************************************************** + * method: getSunrise() + ******************************************************************************* + * + * Gets the date and time of sunrise. If there is no sunrise, returns null. + * + * Member of SunriseSunset class + * + * ------------------------------------------------------------------------ + * -- + */ + public Date getSunrise() { + if (bSunriseToday) { + return (dateSunrise); + } else { + return (null); + } + } + + /****************************************************************************** + * method: getSunset() + ******************************************************************************* + * + * Gets the date and time of sunset. If there is no sunset, returns null. + * + * Member of SunriseSunset class + * + * ------------------------------------------------------------------------ + * -- + */ + public Date getSunset() { + if (bSunsetToday) { + return (dateSunset); + } else { + return (null); + } + } + + /****************************************************************************** + * method: isSunrise() + ******************************************************************************* + * + * Returns a boolean identifying if there was a sunrise. + * + * Member of SunriseSunset class + * + * ------------------------------------------------------------------------ + * -- + */ + public boolean isSunrise() { + return (bSunriseToday); + } + + /****************************************************************************** + * method: isSunset() + ******************************************************************************* + * + * Returns a boolean identifying if there was a sunset. + * + * Member of SunriseSunset class + * + * ------------------------------------------------------------------------ + * -- + */ + public boolean isSunset() { + return (bSunsetToday); + } + + /****************************************************************************** + * method: isSunUp() + ******************************************************************************* + * + * Returns a boolean identifying if the sun is up all day. + * + * Member of SunriseSunset class + * + * ------------------------------------------------------------------------ + * -- + */ + public boolean isSunUp() { + return (bSunUpAllDay); + } + + /****************************************************************************** + * method: isSunDown() + ******************************************************************************* + * + * Returns a boolean identifying if the sun is down all day. + * + * Member of SunriseSunset class + * + * ------------------------------------------------------------------------ + * -- + */ + public boolean isSunDown() { + return (bSunDownAllDay); + } + + /****************************************************************************** + * method: isDaytime() + ******************************************************************************* + * + * Returns a boolean identifying if it is daytime at the hour contained in + * the Date object passed to SunriseSunset on construction. + * + * Member of SunriseSunset class + * + * ------------------------------------------------------------------------ + * -- + */ + public boolean isDaytime() { + // Determine if it is daytime (at sunrise or later) + // or nighttime (at sunset or later) at the location of interest + // but expressed in the time zone requested. + if (bSunriseToday && bSunsetToday) // sunrise and sunset + { + if (dateSunrise.before(dateSunset)) // sunrise < sunset + { + if ((dateInput.after(dateSunrise) || dateInput + .equals(dateSunrise)) && dateInput.before(dateSunset)) { + bDaytime = true; + } else { + bDaytime = false; + } + } else // sunrise comes after sunset (in opposite time zones) + { + if ((dateInput.after(dateSunrise) || dateInput + .equals(dateSunrise)) || // use OR rather than AND + dateInput.before(dateSunset)) { + bDaytime = true; + } else { + bDaytime = false; + } + } + } else if (bSunUpAllDay) // sun is up all day + { + bDaytime = true; + } else if (bSunDownAllDay) // sun is down all day + { + bDaytime = false; + } else if (bSunriseToday) // sunrise but no sunset + { + if (dateInput.before(dateSunrise)) { + bDaytime = false; + } else { + bDaytime = true; + } + } else if (bSunsetToday) // sunset but no sunrise + { + if (dateInput.before(dateSunset)) { + bDaytime = true; + } else { + bDaytime = false; + } + } else { + bDaytime = false; // this should never execute + } + + return (bDaytime); + } + + public void setDfLat(double dfLat) { + this.dfLat = dfLat; + } + + public void setDfLon(double dfLon) { + this.dfLon = dfLon; + } + + public void setDateInput(Date dateInput) { + this.dateInput = dateInput; + } + + public void setDfTimeZone(double dfTimeZone) { + this.dfTimeZone = dfTimeZone; + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/TransformUtils.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/TransformUtils.kt new file mode 100644 index 0000000000..65adb8d6f1 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/TransformUtils.kt @@ -0,0 +1,255 @@ +package com.zhidaoauto.map.sdk.inner.utils + +import android.content.Context +import com.amap.api.location.CoordinateConverter +import com.amap.api.location.CoordinateConverter.CoordType +import com.amap.api.location.DPoint +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import java.math.BigDecimal + + +object TransformUtils { + + fun outOfChina( + lat: Double, + lng: Double + ): Boolean { // 纬度3.86~53.55,经度73.66~135.05 + return !(lng > 73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55) + } + + private fun transformLat(lng: Double, lat: Double): Double { + var ret = + -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt( + Math.abs(lng) + ) + ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0 + ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0 + ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0 + return ret + } + + private fun transformLon(lng: Double, lat: Double): Double { + var ret = + 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt( + Math.abs(lng) + ) + ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0 + ret += (20.0 * Math.sin(lng * PI) + 40.0 * Math.sin(lng / 3.0 * PI)) * 2.0 / 3.0 + ret += (150.0 * Math.sin(lng / 12.0 * PI) + 300.0 * Math.sin(lng / 30.0 * PI)) * 2.0 / 3.0 + return ret + } + + private const val x_PI = 3.14159265358979324 * 3000.0 / 180.0 + //圆周率 + private const val PI = 3.1415926535897932384626 + //克拉索夫斯基椭球参数长半轴a + private const val a = 6378245.0 + //克拉索夫斯基椭球参数第一偏心率平方 + private const val ee = 0.00669342162296594323 + + // + // World Geodetic System ==> Mars Geodetic System + fun transformWgsToGcj(wgLat: Double, wgLon: Double): DoubleArray { + val point = DoubleArray(2) + var mgLat = wgLat + var mgLon = wgLon + if (outOfChina(wgLat, wgLon)) { + point[0] = mgLon + point[1] = mgLat + return point + } + var dLat = transformLat(wgLon - 105.0, wgLat - 35.0) + var dLon = transformLon(wgLon - 105.0, wgLat - 35.0) + val radLat = wgLat / 180.0 * PI + var magic = Math.sin(radLat) + magic = 1 - ee * magic * magic + val sqrtMagic = Math.sqrt(magic) + dLat = dLat * 180.0 / (a * (1 - ee) / (magic * sqrtMagic) * PI) + dLon = dLon * 180.0 / (a / sqrtMagic * Math.cos(radLat) * PI) + mgLat = wgLat + dLat + mgLon = wgLon + dLon + point[0] = dealRound(mgLon) + point[1] = dealRound(mgLat) + return point + } + + + /** + * 百度坐标系 (BD-09) 与 火星坐标系 (GCJ-02)的转换 + * 即 百度 转 谷歌、高德 + * + * @param bd_lon + * @param bd_lat + * @returns {*[]} + */ + fun transformBd09ToGcj02( + bd_lat: Double, + bd_lon: Double + ): DoubleArray { + val x = bd_lon - 0.0065 + val y = bd_lat - 0.006 + val z = + Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_PI) + val theta = + Math.atan2(y, x) - 0.000003 * Math.cos(x * x_PI) + val gg_lng = z * Math.cos(theta) + val gg_lat = z * Math.sin(theta) + return doubleArrayOf(dealRound(gg_lng), dealRound(gg_lat)) + } + + /** + * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换 + * 即谷歌、高德 转 百度 + * + * @param lng + * @param lat + * @returns {*[]} + */ + fun transformGcj02ToBd09( + lat: Double, + lng: Double + ): DoubleArray { + val z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * x_PI) + val theta = + Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * x_PI) + val bd_lng = z * Math.cos(theta) + 0.0065 + val bd_lat = z * Math.sin(theta) + 0.006 + return doubleArrayOf(dealRound(bd_lng), dealRound(bd_lat)) + } + + /** + * WGS84转GCj02 + * + * @param lng + * @param lat + * @returns {*[]} + */ + fun transformWgs84ToGcj02( + lat: Double, + lng: Double + ): DoubleArray { + return if (outOfChina(lat, lng)) { + doubleArrayOf(lng, lat) + } else { + var dlat = transformLat(lng - 105.0, lat - 35.0) + var dlng = transformLon(lng - 105.0, lat - 35.0) + val radlat = lat / 180.0 * PI + var magic = Math.sin(radlat) + magic = 1.0 - ee * magic * magic + val sqrtmagic = Math.sqrt(magic) + dlat = dlat * 180.0 / (a * (1.0 - ee) / (magic * sqrtmagic) * PI) + dlng = dlng * 180.0 / (a / sqrtmagic * Math.cos(radlat) * PI) + val mglat = lat + dlat + val mglng = lng + dlng + doubleArrayOf(dealRound(mglng), dealRound(mglat)) + } + } + + /** + * GCJ02 转换为 WGS84 + * + * @param lng + * @param lat + * @returns {*[]} + */ + fun transformGcj02toWgs84( + lat: Double, + lng: Double + ): DoubleArray { + return if (outOfChina(lat, lng)) { + doubleArrayOf(lng, lat) + } else { + var dlat = transformLat(lng - 105.0, lat - 35.0) + var dlng = transformLon(lng - 105.0, lat - 35.0) + val radlat = lat / 180.0 * PI + var magic = Math.sin(radlat) + magic = 1.0 - ee * magic * magic + val sqrtmagic = Math.sqrt(magic) + dlat = dlat * 180.0 / (a * (1 - ee) / (magic * sqrtmagic) * PI) + dlng = dlng * 180.0 / (a / sqrtmagic * Math.cos(radlat) * PI) + val mglat = lat + dlat + val mglng = lng + dlng + doubleArrayOf(dealRound(lng * 2.0 - mglng), dealRound(lat * 2.0 - mglat)) + } + } + + private fun dealRound(value: Double): Double { + val bg = BigDecimal.valueOf(value) + val result: Double = bg.setScale(8, BigDecimal.ROUND_HALF_UP).toDouble() + return result + } + + @JvmStatic + fun main(args: Array) { +// System.out.println(outOfChina(40.057719, 119.942505)) +// var lonlatPoint = LonLatPoint(116.411196,39.968048) +// System.out.println("$lonlatPoint") + var doubleArray = transformGcj02toWgs84(40.01958683440374,116.32221523390801) + System.out.println("transformGcj02toWgs84--${doubleArray[0]},${doubleArray[1]}") + var doubleArray1 = transformWgs84ToGcj02(doubleArray[1], doubleArray[0]) + System.out.println("transformWgs84ToGcj02--${doubleArray1[0]},${doubleArray1[1]}") +// var doubleArray2 = transformWgsToGcj(doubleArray[1], doubleArray[0]) +// System.out.println("transformWgs84ToGcj02--${dealRound(doubleArray1!![0])},${doubleArray1!![1]}") +// System.out.println("transformWgs84ToGcj02--${dealRound(doubleArray2!![0])},${doubleArray2!![1]}") + +// tempTrans(doubleArrayOf(116.411196,39.968022)) +// tempTrans(doubleArrayOf(112.411196,36.968033)) +// tempTrans(doubleArrayOf(106.411196,34.968044)) +// tempTrans(doubleArrayOf(103.411196,30.968055)) +// tempTrans(doubleArrayOf(102.411196,33.968066)) + + } + + + fun tempTrans(param:DoubleArray,context: Context?){ + var doubleArrayParam = param +// System.out.println("origin:${doubleArrayParam.joinToString() }"); + transform(doubleArrayParam,context) +// System.out.println("middle:${index},${if(index%2==0){"GPS:"}else{"GCJ:"}}--${doubleArrayParam.joinToString()}") +// System.out.println("result:${doubleArrayParam.joinToString()}") + } + + + fun transform(doubleArray: DoubleArray,context: Context?){ + System.out.println("origin:${doubleArray.joinToString()}") + val point = gd_Transform(context, DPoint(doubleArray[1],doubleArray[0])) + val gdarray = doubleArrayOf(point.longitude,point.latitude) + System.out.println("gaode:${gdarray.joinToString()}") + + val mogo = transformWgs84ToGcj02(doubleArray[1], doubleArray[0]) + System.out.println("mogo:${mogo.joinToString()}") + + val gaodetoOrigin = transformGcj02toWgs84(gdarray[1], gdarray[0]) + System.out.println("gaode-to-origin:${gaodetoOrigin.joinToString()}") + + val mogotoOrigin = transformGcj02toWgs84(mogo[1], mogo[0]) + System.out.println("mogo-to-origin:${mogotoOrigin.joinToString()}") + } + + + fun gd_Transform(context: Context?,sourceLatLng:DPoint):DPoint{ + val converter = CoordinateConverter(context) + // CoordType.GPS 待转换坐标类型 + converter.from(CoordType.GPS) + // sourceLatLng待转换坐标点 LatLng类型 + converter.coord(sourceLatLng) + // 执行转换操作 + return converter.convert() + } + + fun outOfScreen(context: Context, lon: Double, lat: Double,mapController: IMapController?): Boolean{ + val displayMetrics = context.resources.getDisplayMetrics() + val screenWidth = displayMetrics.widthPixels + val screenHight = displayMetrics.heightPixels + val topLeft = mapController?.pixelsToLonlat(700f, 100f) + val topRight = mapController?.pixelsToLonlat(screenWidth.toFloat()-700f, 100f) + val bottomLeft = mapController?.pixelsToLonlat(700f, screenHight.toFloat()-100f) + val bottomRight = mapController?.pixelsToLonlat(screenWidth.toFloat()-700f, screenHight.toFloat()-100f) + val minLon = Math.min(Math.min(bottomLeft!!.lon, bottomRight!!.lon), Math.min(topLeft!!.lon, topRight!!.lon)) + val maxLon = Math.max(Math.max(bottomLeft.lon, bottomRight.lon), Math.max(topLeft.lon, topRight.lon)) + val minLat = Math.min(Math.min(bottomLeft.lat, bottomRight.lat), Math.min(topLeft.lat, topRight.lat)) + val maxLat = Math.max(Math.max(bottomLeft.lat, bottomRight.lat), Math.max(topLeft.lat, topRight.lat)) + return !(lon > minLon && lon < maxLon && lat > minLat && lat < maxLat) + + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/ZipUtils.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/ZipUtils.kt new file mode 100644 index 0000000000..d48490ce9d --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/inner/utils/ZipUtils.kt @@ -0,0 +1,203 @@ +package com.zhidaoauto.map.sdk.inner.utils + +import java.io.* +import java.math.BigInteger +import java.nio.file.attribute.FileTime +import java.security.MessageDigest +import java.util.zip.ZipEntry +import java.util.zip.ZipOutputStream + +object ZipUtils { + private const val BUFFER_SIZE = 2 * 1024 + + /** + * 压缩成ZIP 方法1 + * @param srcDir 压缩文件夹路径 + * @param out 压缩文件输出流 + * @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构; + * false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败) + * @throws RuntimeException 压缩失败会抛出运行时异常 + */ + @Throws(RuntimeException::class) fun toZip(srcDir: String?, out: OutputStream?, KeepDirStructure: Boolean) { + val start = System.currentTimeMillis() + var zos: ZipOutputStream? = null + try { + zos = ZipOutputStream(out) + val sourceFile = File(srcDir) + compress(sourceFile, zos, sourceFile.getName(), KeepDirStructure) + val end = System.currentTimeMillis() + println("压缩完成,耗时:" + (end - start) + " ms") + } catch (e: Exception) { + throw RuntimeException("zip error from ZipUtils", e) + } finally { + if (zos != null) { + try { + zos.close() + } catch (e: IOException) { + e.printStackTrace() + } + } + } + } + + /** + * 压缩成ZIP 方法2 + * @param srcFiles 需要压缩的文件列表 + * @param out 压缩文件输出流 + * @throws RuntimeException 压缩失败会抛出运行时异常 + */ + @Throws(RuntimeException::class) fun toZip(srcFiles: List, out: OutputStream?) { + val start = System.currentTimeMillis() + var zos: ZipOutputStream? = null + try { + zos = ZipOutputStream(out) + for (srcFile in srcFiles) { + val buf = ByteArray(BUFFER_SIZE) + val zipEntry = ZipEntry(srcFile.getName()) + val fileTime = FileTime.fromMillis(0) + zipEntry.lastAccessTime = fileTime + zipEntry.lastModifiedTime = fileTime + zipEntry.creationTime = fileTime + zipEntry.extra = null + zos.putNextEntry(zipEntry) + var len: Int = 0 + val fileInputStream = FileInputStream(srcFile) + while (fileInputStream.read(buf).also({ len = it }) != -1) { + zos.write(buf, 0, len) + } + zos.closeEntry() + fileInputStream.close() + } + val end = System.currentTimeMillis() + println("压缩完成,耗时:" + (end - start) + " ms") + } catch (e: Exception) { + throw RuntimeException("zip error from ZipUtils", e) + } finally { + if (zos != null) { + try { + zos.close() + } catch (e: IOException) { + e.printStackTrace() + } + } + } + } + + + /** + * 递归压缩方法 + * @param sourceFile 源文件 + * @param zos zip输出流 + * @param name 压缩后的名称 + * @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构; + * false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败) + * + * @throws Exception + */ + @Throws(Exception::class) private fun compress( + sourceFile: File, zos: ZipOutputStream?, name: String, + KeepDirStructure: Boolean + ) { + val buf = ByteArray(BUFFER_SIZE) + if (sourceFile.isFile()) { + + // 向zip输出流中添加一个zip实体,构造器中name为zip实体的文件的名字 + val zipEntry = ZipEntry(name) + val fileTime = FileTime.fromMillis(0) + zipEntry.lastAccessTime = fileTime + zipEntry.lastModifiedTime = fileTime + zipEntry.creationTime = fileTime + zipEntry.extra = null + zos?.putNextEntry(zipEntry) + + // copy文件到zip输出流中 + var len: Int = 0 + val fileInputStream = FileInputStream(sourceFile) + while (fileInputStream.read(buf).also({ len = it }) != -1) { + zos?.write(buf, 0, len) + } + + // Complete the entry + zos?.closeEntry() + fileInputStream.close() + } else { + val listFiles: Array = sourceFile.listFiles() + if (listFiles == null || listFiles.size == 0) { + + // 需要保留原来的文件结构时,需要对空文件夹进行处理 + if (KeepDirStructure) { + // 空文件夹的处理 + val zipEntry = ZipEntry("$name/") + val fileTime = FileTime.fromMillis(0) + zipEntry.lastAccessTime = fileTime + zipEntry.lastModifiedTime = fileTime + zipEntry.creationTime = fileTime + zipEntry.extra = null + zos?.putNextEntry(zipEntry) + + // 没有文件,不需要文件的copy + zos?.closeEntry() + } + } else { + for (file in listFiles) { + + // 判断是否需要保留原来的文件结构 + if (KeepDirStructure) { + + // 注意:file.getName()前面需要带上父文件夹的名字加一斜杠, + + // 不然最后压缩包中就不能保留原来的文件结构,即:所有文件都跑到压缩包根目录下了 + compress(file, zos, name + "/" + file.getName(), KeepDirStructure) + } else { + compress(file, zos, file.getName(), KeepDirStructure) + } + } + } + } + } + + fun getMD5(file: File): String? { + var len: Int + var digest: MessageDigest? = null + var inputStream: InputStream? = null + val buffer = ByteArray(1024) + try { + digest = MessageDigest.getInstance("MD5") + inputStream = if (file.javaClass == File::class.java) { + BufferedInputStream(FileInputStream(file as File)) + } else return null + while (-1 != inputStream.read(buffer, 0, 1024).also { len = it }) { + digest.update(buffer, 0, len) + } + inputStream.close() + } catch (e: java.lang.Exception) { + e.printStackTrace() + return null + } + val bigInteger = BigInteger(1, digest.digest()) + var md5Value = bigInteger.toString(16) +// if(md5Value.length == 31){ +// md5Value = "0${md5Value}" +// } + return md5Value + } + + + @Throws(Exception::class) @JvmStatic fun main(args: Array) { + /** 测试压缩方法1 */ + val file = File("D:/StudioProjects/map_sdk_new/mapmodule/src/main/assets/style.zip") + if(file.exists()){ + file.delete() + } + val fos1 = FileOutputStream(file) + toZip("D:/StudioProjects/map_sdk_new/mapmodule/src/main/assets/style", fos1, true) + println(getMD5(file)) + /** 测试压缩方法2 */ +// val fileList: MutableList = ArrayList() +// fileList.add(File("D:/Java/jdk1.7.0_45_64bit/bin/jar.exe")) +// fileList.add(File("D:/Java/jdk1.7.0_45_64bit/bin/java.exe")) +// val fos2 = FileOutputStream(File("c:/mytest02.zip")) +// toZip(fileList, fos2) + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/CityCode.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/CityCode.kt new file mode 100644 index 0000000000..eb423a10c2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/CityCode.kt @@ -0,0 +1,17 @@ +package com.zhidaoauto.map.sdk.open + +enum class CityCode( + val type: Int +) { + HENGYANG(4304), //衡阳 + BEIJING(1101), //北京 + WUHAN(4201), //武汉 + EZHOU(4207), //鄂州 + LANZHOU(6201), //兰州 + CHENGDU(5101), //成都 + SUZHOU(3205), //苏州 + YANTAI(3706), //烟台 + YIBIN(5115), //宜宾 + DALI(5329), //大理 + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/HDTypes.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/HDTypes.kt new file mode 100644 index 0000000000..9f4efab3c6 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/HDTypes.kt @@ -0,0 +1,29 @@ +package com.zhidaoauto.map.sdk.open + +enum class HDTypes( + val type: Int +) { + DIVIDER(1), //车道线 + ROAD_AREA(2), //路面 + STOP_LINE(3), //停止线 + ARROW(4), //地标 + STATION_BRIDGE(5), //车站和桥梁 + ZEBRA_LINE(6), //斑马线 + GREEN_BELT(7), //绿化带 + DIVERSION(8), //引导区 + SAFE_ISLAND(9), //安全岛 + ALPHANUMERIC(10), //地面文字 + GUARDBAR(11), //隔离带 + TREE(12), //树 + TRAFFIC_DEVICE(13),//红绿灯、杆、摄像头等 + CABLE(14), //电缆,光缆 + SIGNAL_LINE(15), //信号线 + TRAFFIC_SIGN(16), //路牌,包括标志性路牌和指示性路牌 + building(17), //建筑物 + streetLight(18), //路灯 + area(19), //景点区域 + regional(20), //人行步道 + geometricLinear(21), //线区域,路测智能体等 + geometricSurface(22); //面区域,自行 + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/LogLevels.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/LogLevels.kt new file mode 100644 index 0000000000..006130fae1 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/LogLevels.kt @@ -0,0 +1,9 @@ +package com.zhidaoauto.map.sdk.open + +enum class LogLevels( + val type: Int +) { + ERROR(0), //error + WARN(1), //warn + INFO(2), //info +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/MapAutoApi.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/MapAutoApi.kt new file mode 100644 index 0000000000..ab39b5834a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/MapAutoApi.kt @@ -0,0 +1,586 @@ +package com.zhidaoauto.map.sdk.open + +import android.content.Context +import android.text.TextUtils +import android.util.Log +import com.autonavi.nge.NLog +import com.autonavi.nge.map.LonLat +import com.autonavi.nge.map.MapView +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.IEventController +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.abs.IMarkerController +import com.zhidaoauto.map.sdk.inner.common.ConstantExt +import com.zhidaoauto.map.sdk.inner.common.MapHelper +import com.zhidaoauto.map.sdk.inner.controller.CommonController +import com.zhidaoauto.map.sdk.inner.map.MapController +import com.zhidaoauto.map.sdk.inner.map.MapDataHelper +import com.zhidaoauto.map.sdk.inner.map.MapHdDataHelper +import com.zhidaoauto.map.sdk.inner.map.MapStyleHelper +import com.zhidaoauto.map.sdk.inner.utils.CommonUtils +import com.zhidaoauto.map.sdk.inner.utils.Constant +import com.zhidaoauto.map.sdk.inner.utils.GisGeomTool +import com.zhidaoauto.map.sdk.inner.utils.MathUtils +import com.zhidaoauto.map.sdk.inner.utils.Recorder +import com.zhidaoauto.map.sdk.inner.utils.TransformUtils +import com.zhidaoauto.map.sdk.open.abs.log.ILog +import com.zhidaoauto.map.sdk.open.abs.marker.InfoWindowAdapter +import com.zhidaoauto.map.sdk.open.abs.navi.INaviResult +import com.zhidaoauto.map.sdk.open.data.MapDataApi +import com.zhidaoauto.map.sdk.open.location.MyLocationStyle +import com.zhidaoauto.map.sdk.open.navi.NaviModel +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.tools.MapTools +import com.zhidaoauto.map.sdk.open.view.MapAutoView +import io.netty.buffer.Unpooled +import java.math.BigDecimal +import java.nio.charset.Charset + + +object MapAutoApi { + private val TAG = javaClass.simpleName + const val MAP_PERSPECTIVE_2D = MapController.MAP_PERSPECTIVE_2D //2D视图 + const val MAP_PERSPECTIVE_3D = MapController.MAP_PERSPECTIVE_3D //3D视图 + const val MAP_PERSPECTIVE_UP_CAR = MapController.MAP_PERSPECTIVE_UP_CAR //车头向上 + const val MAP_PERSPECTIVE_UP_NORTH = MapController.MAP_PERSPECTIVE_UP_NORTH //正北向上 + const val LISTENER_TYPE_ZOOM = MapController.LISTENER_TYPE_ZOOM //监听缩放 + const val LISTENER_TYPE_ROTATE = MapController.LISTENER_TYPE_ROTATE //监听旋转 + const val LISTENER_TYPE_3D = MapController.LISTENER_TYPE_3D //监听视角切换 + const val LISTENER_TYPE_FOCUS = MapController.LISTENER_TYPE_FOCUS//移动监听 + const val LISTENER_TYPE_SCROLL = MapView.LISTENER_TYPE_SCROLL //移动监听 + const val MAP_STYLE_DAY = 0 //日间模式 + const val MAP_STYLE_NIGHT = 1 //夜间模式 + const val MAP_STYLE_SATEL = 2 //SATEL模式 + const val MAP_STYLE_DAY_NAV = 3 //日间导航模式 + const val MAP_STYLE_NIGHT_NAV = 4 //夜间导航模式 + const val MAP_STYLE_NIGHT_VR = 5 //夜间VR模式 + const val MAP_STYLE_DAY_VR = 6 //白天VR + const val MAP_STYLE_VR_ROAM = 7 //漫游模式 + const val MAP_STYLE_VR_TRANS = 8//过渡模式 + const val MAP_STYLE_VR_ERHAI_B2 = 9//洱海模式 + + const val MAP_STYLE_VR_ANGLE_NEAR = 0 + const val MAP_STYLE_VR_ANGLE_MIDDLE = 1 + const val MAP_STYLE_VR_ANGLE_FAR = 2 + const val MAP_STYLE_VR_ANGLE_300 = 3 + const val MAP_STYLE_VR_ANGLE_TOP = 4 + const val MAP_STYLE_VR_ANGLE_CROSS = 5 + const val MAP_STYLE_VR_ANGLE_MIDDLE_XIAOBA = 6 + + + const val ROAM_DIS_1KM = 1000f + const val ROAM_DIS_3KM = 3000f + const val ROAM_DIS_5KM = 5000f + const val ROAM_DIS_8KM = 8000f + + const val ROAM_SPEED_30 = 30f + const val ROAM_SPEED_40 = 40f + const val ROAM_SPEED_60 = 60f + const val ROAM_SPEED_80 = 80f + + const val CAR_CENTER_100 = 1 + const val CAR_QUARTER_100 = 2 + const val CAR_TWO_FIFTHS_100 = 3 + const val CAR_TWO_FIFTHS_80= 4 + + const val CAR_AFTER_30_FRONT_80 = 5 + + const val CAR_AFTER_30_FRONT_100 = 6 + + const val CAR_AFTER_30_FRONT_120 = 7 + + const val CAR_AFTER_40_FRONT_80= 8 + + const val CAR_AFTER_40_FRONT_100 = 9 + + const val CAR_AFTER_40_FRONT_120 = 10 + + const val GPS_FLAG = Constant.GPS_RTK + + const val AGPS = Constant.AGPS + + + const val SELF_CAR_STOP_LIGHT_RED = ConstantExt.SELF_CAR_STOP_LIGHT_RED + const val SELF_CAR_STOP_LIGHT_YELLOW = ConstantExt.SELF_CAR_STOP_LIGHT_YELLOW + const val SELF_CAR_TURN_RIGHT_YELLOW = ConstantExt.SELF_CAR_TURN_RIGHT_YELLOW + const val SELF_CAR_DEFAULT = ConstantExt.SELF_CAR_DEFAULT + const val SELF_CAR_TURN_LEFT_YELLOW = ConstantExt.SELF_CAR_TURN_LEFT_YELLOW + + /** + * 初始化 + */ + fun init(context: Context, mapParams: MapParams) { + CommonController.instance.init(context) + Recorder.i("common","$mapParams") + val customPath = context.filesDir.absolutePath + if (com.zhidaoauto.map.sdk.BuildConfig.ONLINE) { + if (TextUtils.isEmpty(mapParams.getStyleDir())) { + val stylePath = "${customPath}/shmdata/mogo_style" + mapParams.setStyleDir(stylePath) + MapStyleHelper.copyAssetsToSdcard(context, "style", stylePath) + }else{ + MapStyleHelper.loadStyleOver.set(true) + } + if (!TextUtils.isEmpty(mapParams.getCachePath())) { + MapDataHelper.updateData(context, mapParams.getCachePath()!!) + }else{ + MapDataHelper.updateData(context, CommonUtils.getCachePath(context)) + } + + } + + if (com.zhidaoauto.map.sdk.BuildConfig.MODE == 3) { + // VR + if(mapParams.getDataFileSource() == 0){ + MapHdDataHelper.initDataMgr(context) + }else if (TextUtils.isEmpty(mapParams.getHdmapPath())) { + mapParams.setHdmapPath("${customPath}/shmdata") + MapHdDataHelper.copyAssetsToSdcard(context, "hdmapData", "${customPath}/shmdata/hdmapData") + }else{ + MapHdDataHelper.loadDataOver.set(true) + } + } + MapHelper.init(mapParams) + } + + fun addLog(instance:String,content: String) { + Recorder.i(instance,content) + } + + fun addLog(content: String) { + Recorder.add(content) + } + + fun destory() { + if(CompileConfig.DEBUG){ + Log.w(TAG, "destroyop--:start") + } + CommonController.instance.exit() + if(CompileConfig.DEBUG){ + Log.w(TAG, "destroyop--:CommonController.instance.exit()") + } + MapDataApi.destory() + if(CompileConfig.DEBUG){ + Log.w(TAG, "destroyop--:MapDataApi.destory") + } + } + + //获取地图参数 + fun getMapParams(): MapParams { + return MapHelper.mMapParams + } + + fun setMyLocationEnabled(myLocationEnabled: Boolean,mapAutoView: MapAutoView) { + mapAutoView.getLocationView()?.setMyLocationEnabled(myLocationEnabled) + } + + fun getMyLocationEnabled(mapAutoView: MapAutoView): Boolean { + return mapAutoView.getLocationView()?.getMyLocationEnabled()?:false + } + + fun setMyLocationStyle(myLocationStyle: MyLocationStyle,mapAutoView: MapAutoView) { + mapAutoView.getLocationView()?.setMyLocationStyle(myLocationStyle) + } + + fun getMyLocationStyle(mapAutoView: MapAutoView): MyLocationStyle? { + return mapAutoView.getLocationView()?.getMyLocationStyle() + } + + + fun setInfoWindowAdapter(infoWindowAdapter: InfoWindowAdapter,markerController: IMarkerController?) { + markerController?.setInfoWindow(infoWindowAdapter) + } + + /** + * Calculate the tile ID based on longitude, latitude, and tile level. + * + * @param lon longitude + * @param lat latitude + * @param level tile level + * @return tile ID + */ + fun getTileID(lon: Double, lat: Double, level: Int): Long { + // Convert the longitude and latitude to Morton code + val code = toMortonCode(lon, lat) + // Calculate the tile ID based on the Morton code and the tile level + val tileId = getTileIdByMortonCode(code, level) + return tileId + } + + + fun setDebugMode(debug: Boolean){ + MapHelper.setDebugMode(debug) + if(debug){ + setLogLevel(2) + }else{ + setLogLevel(-1) + } + } + + fun setIsRecordLogs(isRecordLogs: Boolean,mapAutoView: MapAutoView) { + mapAutoView.getClerk()?.setIsRecordLogs(isRecordLogs) + } + + private val RULE_MORTON: Double = Math.pow(2.0, 32.0) / 360.0 + private val RULE_MORTON_TO_LONLAT: Double = 360.0 / Math.pow(2.0, 32.0) + private val NDS_90_DEGREES: Long = 0x3fffffff + private val NDS_180_DEGREES: Long = 0x7fffffff + private val NDS_360_DEGREES: Long = 4294967295 + + /** + * Convert the longitude and latitude to Morton code. + * + * @param lon longitude + * @param lat latitude + * @return Morton code + */ + private fun toMortonCode(lon: Double, lat: Double): Long { + var bit: Long = 1 + var mortonCode: Long = 0 + var x: Long = (lon * RULE_MORTON).toLong() + var y: Long = (lat * RULE_MORTON).toLong() + + // Adjust y value for negative values + if (y < 0) { + y += 0x7FFFFFFF + } + y = y shl 1 + + // Convert longitude and latitude to Morton code + for (i in 0 until 32) { + // Calculate Morton code for x-coordinate + mortonCode = mortonCode or (x and bit) + x = x shl 1 + bit = bit shl 1 + + // Calculate Morton code for y-coordinate + mortonCode = mortonCode or (y and bit) + y = y shl 1 + bit = bit shl 1 + } + + return mortonCode + } + + + + /** + * 莫顿码转换为经纬度 + */ + private fun fromMortonCode(mortonCode: Long): LonLat { + var coord: Coord = mortonCodeToCoord(mortonCode) + + normalizeCoord(coord) + var lon = String.format("%.8f", coord.x * RULE_MORTON_TO_LONLAT).toDouble() + var lat = String.format("%.8f", coord.y * RULE_MORTON_TO_LONLAT).toDouble() + return LonLat(lon, lat) + } + + /** + * 莫顿码转换为莫顿坐标 + */ + private fun mortonCodeToCoord(mortonCodeParam: Long):Coord { + var coord: Coord = Coord() + var mortonCode = mortonCodeParam + var bit: Long = 1 + coord.x = 0 + coord.y = 0 + + for (i in 0 until 32) { + coord.x = coord.x or (mortonCode and bit) + mortonCode = mortonCode shr 1 + coord.y = coord.y or (mortonCode and bit) + bit = bit shl 1 + } + return coord + } + + /** + * 纠偏 + */ + private fun normalizeCoord(result: Coord) { +// Clerk.add() + // if x > 180 degrees, then subtract 360 degrees + if (result.x > NDS_180_DEGREES) { + result.x -= NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well + } else if (result.x < -NDS_180_DEGREES) // if x < 180 , x += 360 + { + result.x += NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well + } + + // if y > 90 degrees, then subtract 180 degrees + if (result.y > NDS_90_DEGREES) { + result.y -= NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well + } else if (result.y < -NDS_90_DEGREES) // if y < 90, y += 180 + { + result.y += NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well + } + } + + private fun getTileIdByMortonCode(mortonCode:Long, level:Int):Long { + val left = ((mortonCode shr (2 * (31 - level))) and 0xffffffff) + val right = (Math.pow(2.0,(16.0 + level)).toLong()) +// println("tile:$left,$right") + return (left +right) + } + + class Coord { + var x: Long = 0L + var y: Long = 0L + } + + class Box { + var lbLon: Double = 0.0 + var lbLat: Double = 0.0 + var rtLon: Double = 0.0 + var rtLat: Double = 0.0 + } + + class Coord_d { + var lon: Double = 0.0 + var lat: Double = 0.0 + } + + //lng>73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55 + fun randomLonlat(): LonLatPoint { + +// return randomLonLatArea(73.66, 135.05, 3.86, 53.55) + return randomLonLatArea(100.01, 118.02, 21.36, 43.55) + } + + fun randomLonLatArea(MinLon: Double, MaxLon: Double, MinLat: Double, MaxLat: Double): LonLatPoint { + + val lonArea = (MaxLon - MinLon) + val latArea = (MaxLat - MinLat) + var db = BigDecimal(Math.random() * lonArea + MinLon) + val lon: Double = db.setScale(6, BigDecimal.ROUND_HALF_UP).toDouble() + db = BigDecimal(Math.random() * latArea + MinLat) + val lat: Double = db.setScale(6, BigDecimal.ROUND_HALF_UP).toDouble() + return LonLatPoint(lon, lat) + } + + fun getAngle( lon1: Double, lat1: Double, lon2: Double, lat2: Double): Float{ + Recorder.add("$lon1,$lat1,$lon2,$lat2") + return GisGeomTool.GetLineAngle(lon1, lat1, lon2, lat2).toFloat() + } + + fun distance(x1: Double, y1: Double, x2: Double, y2: Double): Double { + Recorder.add("$x1,$y1,$x2,$y2") + return MapTools.distance(x1, y1, x2, y2) + } + + fun angleDiff(a:Double,b:Double):Double{ + val d1: Double = a - b + var d2: Double = 360 - Math.abs(d1) + //d1>0,那么相当于从b顺时针旋转d1能到a,那么当这个旋转角度大于180度时,不如从b逆时针旋d2转到a(取反那一步就代表逆时针旋转) + if (d1 > 0){ + d2 *= -1.0 + } + if (Math.abs(d1) < Math.abs(d2)){ + return d1 + } else{ + return d2 + } + + } + + fun addImagetoImageManager(imageKey: String, imageByteArray: ByteArray, width: Int, height: Int,mapController: IMapController?):Int?{ + return mapController?.addImage( + imageKey, + imageByteArray, + width, + height + ) + } + + + fun getSDKVersion():String{ + return com.zhidaoauto.map.sdk.BuildConfig.MAPMODULE_VERSION + } + + private fun getLevelOfTileId(tileId: Long): Int { + var level = 0 + var tId: Long = tileId shr 16 + level = 0 + while (tId > 1) { + tId = tId shr 1 + level++ + } + return level + } + + private fun getLeftBottomOfTile(tileId:Long):Coord { + return getLeftBottomOfTileWithLevel(tileId, getLevelOfTileId(tileId)); + } + + fun getLonlatOfTile(tileId: Long):Coord_d{ +// Clerk.add("$tileId") + val coord = getLeftBottomOfTile(tileId) + val result = Coord_d(); + var lon = String.format("%.9f", coord.x * RULE_MORTON_TO_LONLAT).toDouble() + var lat = String.format("%.9f", coord.y * RULE_MORTON_TO_LONLAT).toDouble() + result.lon = lon + result.lat = lat + // System.out.println("getLonlatOfTile:${lon},${lat}") + return result + } + + private fun getIndexOfTileIdWithLevel(tileId: Long, level: Int): Long { + val offset = 1L shl (16 + level) + //System.out.println("getIndexOfTileIdWithLevel:offset:${offset}") + return tileId - offset + } + + private fun getLeftBottomOfTileWithLevel(tileId:Long, level:Int):Coord { + val indexOfTile = getIndexOfTileIdWithLevel(tileId,level).toLong() + //System.out.println("indexOfTile:level:${level},${indexOfTile}") + val mortonCode = indexOfTile shl (2 * (31 - level)) +// val mortonCode1 = tileId*Math.pow(2.0,2.0*(31-level)).toLong() + //System.out.println("mortonCode:${mortonCode}") + var coord = mortonCodeToCoord(mortonCode) + + //System.out.println("mortonCodeToCoord:${coord.x},${coord.y}") + normalizeCoord(coord) + // NOTE: 处理边界的偏移问题 + coord.x += 1; + coord.y += 1; + //System.out.println("normalizeCoord:${coord.x},${coord.y}") + return coord; + } + + fun getTileBoundingBox(tileId:Long):Box{ +// Clerk.add("$tileId") + val level = getLevelOfTileId(tileId) +// println("level:$level") + val coord = getLeftBottomOfTileWithLevel(tileId, level) + val result = Box(); + var lon = String.format("%.9f", coord.x * RULE_MORTON_TO_LONLAT).toDouble() + var lat = String.format("%.9f", coord.y * RULE_MORTON_TO_LONLAT).toDouble() + result.lbLon = lon + result.lbLat = lat + val c: Int = getTileSize(level) - 1 +// println("边长:$c") + // 加个(边长 - 1)就可以转换成右上角坐标右上角坐标 + result.rtLon = String.format("%.9f", (coord.x + c) * RULE_MORTON_TO_LONLAT).toDouble() + result.rtLat = String.format("%.9f", (coord.y + c) * RULE_MORTON_TO_LONLAT).toDouble() + return result + } + + + fun registerLogListener(listener:ILog,eventController: IEventController?){ + eventController?.addLogListener(listener) + } + + fun unregisterLogListener(listener:ILog,eventController: IEventController?){ + eventController?.removeLogListener(listener) + } + + private fun getTileSize(level: Int): Int { + return 1 shl 31 - level + } + + /** + * 设置输出日志级别 + * @param level -1关闭 0=error 1=warn 2=info + */ + fun setLogLevel(level: Int){ + if(level < 0){ + NLog.close() + }else{ + NLog.setLevel(level) + } + } + + /** + * 算路接口 + * @param lon 起始经度 + * @param lat 起始纬度 + * @param targetLon 目标经度 + * @param targetLat 目标纬度 + * @param wayPoints 途经点 lon,lat,lon,lat... + * @param call 回调函数 + */ + fun route(lon:Double,lat:Double,targetLon:Double,targetLat:Double, wayPoints: String,call: INaviResult){ + NaviModel.route(lon, lat, targetLon, targetLat, wayPoints, call) + } + + @JvmStatic + fun main(args: Array) { + + //112.59231238564,26.83079549695 + + var array1 = TransformUtils.transformGcj02toWgs84(26.875038,112.538527) + System.out.println("GPS:${array1!![0]},${array1!![1]}") + var array = TransformUtils.transformGcj02toWgs84(26.83079549695, 112.59231238564) + System.out.println("GPS:${array!![0]},${array!![1]}") + val code = toMortonCode(array!![0], array!![1]) + System.out.println("code:${code}") + var tileId = getTileIdByMortonCode(code,13) + System.out.println("tileId:${tileId}") + val lonLat = fromMortonCode(code) + System.out.println("LonLat--GPS:${lonLat}") + System.out.println("getTileID-13:${getTileID(100.14754525, 25.76392892,13)}") + System.out.println("getTileID-13:${getTileID(112.577272,26.828447,13)}") + System.out.println("getTileID-14:${getTileID(112.5719037958,26.8208054862,14)}") + System.out.println("getTileID-15:${getTileID(112.5719037958,26.8208054862,15)}") + System.out.println("getTileID-16:${getTileID(112.5719037958,26.8208054862,16)}") + val curLon = 112.598977 + val curLat = 26.831300 + println("---$curLon,$curLat-----") + tileId = getTileID(curLon,curLat,16) + tileId = 5572659558 + System.out.println("getTileID-16:${tileId}") + var box = getTileBoundingBox(tileId) + System.out.println("getTileBoundingBox:${box.lbLon},${box.lbLat},${box.rtLon},${box.rtLat}") + + var unitLon = (box.rtLon-box.lbLon)/1250.0 + var unitLat = (box.rtLon-box.lbLon)/1250.0 + val upX = (box.rtLon-curLon) + val upY = (box.rtLat-curLat) + val downX = (box.rtLon-box.lbLon) + val downY = (box.rtLat-box.lbLat) + val positionX = upX/downX*1250 + val positionY = upY/downY*1250 + println("up:$upX,$upY--down:$downX,$downY") + println("unit:$unitLon,$unitLat--position:$positionX,$positionY") + println("--------") +// System.out.println("getLevelOfTileId:${getLevelOfTileId(5572666657)}") +// val coord = getLeftBottomOfTile(5572659558) +// System.out.println("getLeftBottomOfTile:${coord.x},${coord.y}") + + val coord_d = getLonlatOfTile(5613151104) + System.out.println("getLonlatOfTile:${coord_d.lon},${coord_d.lat}") + box = getTileBoundingBox(5613151104) + System.out.println("getTileBoundingBox:${box.lbLon},${box.lbLat},${box.rtLon},${box.rtLat}") + box = getTileBoundingBox(5572660368) + System.out.println("-getTileBoundingBox:${box.lbLon},${box.lbLat},${box.rtLon},${box.rtLat}") + println("--------") + val byteBuffer = Unpooled.buffer() + val str = "1111112345678sjkfdhdkb" + byteBuffer.writeInt(str.length) + byteBuffer.writeCharSequence(str, Charset.forName("utf-8")) + byteBuffer.writeBoolean(true) + byteBuffer.writeInt(999) + byteBuffer.writeInt(12) + val length = byteBuffer.readInt() + System.out.println("${length}") + System.out.println("${byteBuffer.readCharSequence(length, Charset.forName("utf-8"))}") + System.out.println("${byteBuffer.readBoolean()}") + System.out.println("${byteBuffer.readInt()}") + + val lon = 116.410669178793 + val lat = 39.9908766892266 + val angle = 179.9999991082 + val res = MathUtils.convertAngle(angle,lon, lat) + System.out.println("$res") + System.out.println("${Math.toDegrees(3.62347793579102)}") + System.out.println("${Math.toDegrees(1.13428950309753)}") + } + + + + + + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/MapParams.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/MapParams.kt new file mode 100644 index 0000000000..530246c5b5 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/MapParams.kt @@ -0,0 +1,183 @@ +package com.zhidaoauto.map.sdk.open + +import com.zhidaoauto.map.sdk.inner.common.MapHelper +import com.zhidaoauto.map.sdk.inner.map.MapController + +class MapParams { + + private var debugMode: Boolean = MapHelper.debug + + // GPS(WGS84) 0 ;GCJ-02(高德) 1; BD09(百度) 2; + private var coordinateType: Int = COORDINATETYPE_GCJ02 + + // 样式 + private var stylePath: String = "" + + // 缓存数据目录 + private var cachePath: String = "" + + // 高精数据目录 + private var hdmapPath: String = "" + + private var dataFileSource = 0 // 1,本地文件。非1,redis获取 + private var dataRedisSource = 0 // 1,测试redis(42)。2 长期测试redis 3 演示redis 0正式redis(根据域名访问的) + + private var qzoneFilterArray = IntArray(0) + + //开启日志 + private var isRecordLogs = true + + private constructor() + + + companion object { + // 地图坐标系统GPS(WGS84) + const val COORDINATETYPE_WGS84 = 1 + + // 地图坐标系统GCJ-02(高德) + const val COORDINATETYPE_GCJ02 = 2 + + // 地图坐标系统BD09(百度) + const val COORDINATETYPE_BD09 = 3 + + const val MAP_PERSPECTIVE_2D = MapController.MAP_PERSPECTIVE_2D //2D视图 + const val MAP_PERSPECTIVE_3D = MapController.MAP_PERSPECTIVE_3D //3D视图 + const val MAP_PERSPECTIVE_UP_CAR = MapController.MAP_PERSPECTIVE_UP_CAR //车头向上 + const val MAP_PERSPECTIVE_UP_NORTH = MapController.MAP_PERSPECTIVE_UP_NORTH //正北向上 + + const val STYLE_ERHAI = "erhai" + const val STYLE_NORMAL = "normal" + + + fun init(): MapParams { + return MapParams() + } + + + } + + /** + * 设置默认坐标系 + * @param coordinateType 坐标系类型 + */ + fun setCoordinateType(coordinateType: Int): MapParams { + this.coordinateType = coordinateType + return this; + } + + /** + * 设置是否debug模式 + * @param debug + */ + fun setDebugMode(debug: Boolean): MapParams { + this.debugMode = debug + return this; + } + + /** + * 设置样式文件路径 + * @param stylePath 路径 + */ + fun setStyleDir(stylePath: String): MapParams { + this.stylePath = stylePath + return this; + } + + /** + * 设置缓存数据路径 + * @param cachePath 路径 + */ + fun setCachePath(cachePath: String): MapParams { + this.cachePath = cachePath + return this; + } + + /** + * 设置数据路径 + * @param hdmapPath 路径 + */ + fun setHdmapPath(hdmapPath: String): MapParams { + this.hdmapPath = hdmapPath + return this; + } + + fun getCoordinateType(): Int { + return coordinateType + } + + fun getQzoneFilterArray(): IntArray { + return qzoneFilterArray + } + + /** + * 设置数据区域 + * @param filter 区域数组 + */ + fun setQzoneFilterArray(filter: IntArray): MapParams { + this.qzoneFilterArray = filter + return this; + } + + fun getCachePath(): String? { + return cachePath + } + + + fun getHdmapPath(): String? { + return hdmapPath + } + + fun getStyleDir(): String? { + return stylePath + } + + fun getDebugMode(): Boolean { + return debugMode + } + + /** + * 设置地图数据来源 + * @param dataFileSource 1,本地文件。非1,redis获取 + */ + fun setDataFileSource(dataFileSource: Int): MapParams{ + this.dataFileSource = dataFileSource + return this + } + + fun getDataFileSource(): Int{ + return this.dataFileSource + } + + /** + * 设置数据环境 + * @param dataRedisFileSource // 1,测试redis(42)。2 长期测试redis 3 演示redis 0正式redis + */ + fun setDataRedisFileSource(dataRedisFileSource: Int): MapParams{ + this.dataRedisSource = dataRedisFileSource + return this + } + + fun getDataRedisFileSource(): Int{ + return this.dataRedisSource + } + + /** + * 设置是否记录日志 + * @param isRecordLogs 默认true + */ + fun setIsRecordLogs(isRecordLogs: Boolean): MapParams{ + this.isRecordLogs = isRecordLogs + return this + } + + + fun getRecordLogs(): Boolean{ + return isRecordLogs + } + + override fun toString(): String { + return "MapParams(debugMode=$debugMode, stylePath='$stylePath', cachePath='$cachePath', hdmapPath='$hdmapPath', dataFileSource=$dataFileSource, dataRedisSource=$dataRedisSource, qzoneFilterArray=${qzoneFilterArray.contentToString()}, isRecordLogs=$isRecordLogs)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/NavAutoApi.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/NavAutoApi.kt new file mode 100644 index 0000000000..5284c78267 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/NavAutoApi.kt @@ -0,0 +1,181 @@ +package com.zhidaoauto.map.sdk.open + +import android.content.Context +import com.autonavi.nge.map.LonLat +import com.autonavi.nge.map.MapView +import com.zhidaoauto.map.sdk.inner.common.MapHelper +import com.zhidaoauto.map.sdk.inner.common.NavHelper +import com.zhidaoauto.map.sdk.inner.controller.CommonController +import com.zhidaoauto.map.sdk.inner.map.MapController +import com.zhidaoauto.map.sdk.inner.utils.Recorder +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import io.netty.buffer.Unpooled +import java.math.BigDecimal +import java.nio.charset.Charset + +object NavAutoApi { + private val TAG = javaClass.simpleName + const val MAP_PERSPECTIVE_2D = MapController.MAP_PERSPECTIVE_2D //2D视图 + const val MAP_PERSPECTIVE_3D = MapController.MAP_PERSPECTIVE_3D //3D视图 + const val LISTENER_TYPE_ZOOM = MapController.LISTENER_TYPE_ZOOM //监听缩放 + const val LISTENER_TYPE_ROTATE = MapController.LISTENER_TYPE_ROTATE //监听旋转 + const val LISTENER_TYPE_3D = MapController.LISTENER_TYPE_3D //监听视角切换 + const val LISTENER_TYPE_FOCUS = MapController.LISTENER_TYPE_FOCUS//移动监听 + const val LISTENER_TYPE_SCROLL = MapView.LISTENER_TYPE_SCROLL //移动监听 + const val MAP_STYLE_DAY = 0 //日间模式 + const val MAP_STYLE_NIGHT = 1 //夜间模式 + const val MAP_STYLE_SATEL = 2 //SATEL模式 + const val MAP_STYLE_DAY_NAV = 3 //日间导航模式 + const val MAP_STYLE_NIGHT_NAV = 4 //夜间导航模式 + + /** + * 初始化 + */ + fun init(context: Context, mapParams: MapParams, navParams: NavParams) { + MapAutoApi.init(context,mapParams) + NavHelper.init(navParams) + } + + fun addLog(instance:String,content:String){ + Recorder.i(instance,content) + } + + fun destory() { + CommonController.instance.exit() + } + + //获取地图参数 + fun getMapParams(): MapParams { + return MapHelper.mMapParams + } + + val RULE_MORTON: Double = Math.pow(2.0, 32.0) / 360.0 + val RULE_MORTON_TO_LONLAT: Double = 360.0 / Math.pow(2.0, 32.0) + val NDS_90_DEGREES: Long = 0x3fffffff + val NDS_180_DEGREES: Long = 0x7fffffff + val NDS_360_DEGREES: Long = 4294967295 + + /** + * 经纬度转换莫顿码 + */ + fun toMortonCode(lon: Double, lat: Double): Long { + var bit: Long = 1 + var mortonCode: Long = 0; + var x: Long = (lon * RULE_MORTON).toLong() + var y: Long = (lat * RULE_MORTON).toLong() + System.out.println("morton---:${x},${y}") + if (y < 0) { + y += 0x7FFFFFFF; + } + y = y shl 1 + for (i in 0 until 32) { + // x-part + mortonCode = mortonCode or (x and bit) + x = x shl 1 + bit = bit shl 1 + // y-part + mortonCode = mortonCode or (y and bit) + y = y shl 1 + bit = bit shl 1 + } + return mortonCode + } + + + /** + * 莫顿码转换为经纬度 + */ + fun fromMortonCode(mortonCode: Long): LonLat { + var coord: Coord = Coord() + mortonCodeToCoord(mortonCode, coord) + System.out.println("morton---:${coord.x},${coord.y}") + normalizeCoord(coord) + var lon = String.format("%.6f", coord.x * RULE_MORTON_TO_LONLAT).toDouble() + var lat = String.format("%.6f", coord.y * RULE_MORTON_TO_LONLAT).toDouble() + return LonLat(lon, lat) + } + + /** + * 莫顿码转换为莫顿坐标 + */ + private fun mortonCodeToCoord(mortonCodeParam: Long, coord: Coord) { + var mortonCode = mortonCodeParam + var bit: Long = 1 + coord.x = 0 + coord.y = 0 + + for (i in 0 until 32) { + coord.x = coord.x or (mortonCode and bit) + mortonCode = mortonCode shr 1 + coord.y = coord.y or (mortonCode and bit) + bit = bit shl 1 + } + } + + /** + * 纠偏 + */ + fun normalizeCoord(result: Coord) { + // if x > 180 degrees, then subtract 360 degrees + if (result.x > NDS_180_DEGREES) { + result.x -= NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well + } else if (result.x < -NDS_180_DEGREES) // if x < 180 , x += 360 + { + result.x += NDS_360_DEGREES + 1; // add 1 because 0 must be counted as well + } + + // if y > 90 degrees, then subtract 180 degrees + if (result.y > NDS_90_DEGREES) { + result.y -= NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well + } else if (result.y < -NDS_90_DEGREES) // if y < 90, y += 180 + { + result.y += NDS_180_DEGREES + 1; // add 1 because 0 must be counted as well + } + } + + class Coord { + var x: Long = 0L + var y: Long = 0L + } + + //lng>73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55 + fun randomLonlat(): LonLatPoint { +// return randomLonLatArea(73.66, 135.05, 3.86, 53.55) + return randomLonLatArea(100.01, 118.02, 21.36, 43.55) + } + + fun randomLonLatArea(MinLon: Double, MaxLon: Double, MinLat: Double, MaxLat: Double): LonLatPoint { + val lonArea = (MaxLon - MinLon) + val latArea = (MaxLat - MinLat) + var db = BigDecimal(Math.random() * lonArea + MinLon) + val lon: Double = db.setScale(6, BigDecimal.ROUND_HALF_UP).toDouble() + db = BigDecimal(Math.random() * latArea + MinLat) + val lat: Double = db.setScale(6, BigDecimal.ROUND_HALF_UP).toDouble() + return LonLatPoint(lon, lat) + } + + @JvmStatic + fun main(args: Array) { +// var array = TransformUtils.transformGcj02toWgs84(39.982932, 116.402089) +// System.out.println("GPS:${array!![0]},${array!![1]}") +// val code = toMortonCode(array!![0], array!![1]) +// System.out.println("code:${code}") +// val lonLat = fromMortonCode(code) +// System.out.println("LonLat--GPS:${lonLat}") + + val byteBuffer = Unpooled.buffer() + val str = "1111112345678sjkfdhdkb" + byteBuffer.writeInt(str.length) + byteBuffer.writeCharSequence(str, Charset.forName("utf-8")) + byteBuffer.writeBoolean(true) + byteBuffer.writeInt(999) + byteBuffer.writeInt(12) + val length = byteBuffer.readInt() + System.out.println("${length}") + System.out.println("${byteBuffer.readCharSequence(length, Charset.forName("utf-8"))}") + System.out.println("${byteBuffer.readBoolean()}") + System.out.println("${byteBuffer.readInt()}") + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/NavParams.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/NavParams.kt new file mode 100644 index 0000000000..c20043d18e --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/NavParams.kt @@ -0,0 +1,181 @@ +package com.zhidaoauto.map.sdk.open + +import com.autonavi.nge.routing.RoutingProvider +import com.zhidaoauto.map.sdk.open.nav.NaviViewShowMode + +class NavParams { + + + + //是否选择导航路线 + private var isRouteSelectShow: Boolean = true + // 导航类型 + private var routingModel: Int = COSTMODEL_DEFAULT + + private var mIsMonitorCameraEnabled = true //HUD模式下,设置限速信息是否显示 + //获取交通状态是否更新 需要动态交通信息相关功能时需要调用此接口打开交通信息功能, + // 默认动态交通功能是开启的, 打开后会每2分钟请求一次新的交通信息来更新交通信息。 + private var trafficStatusUpdateEnabled = true + //设置是否打开移动交通台功能 默认是开启的,打开此功能后将有整体路况概览与前方路况播报功能, + // 打开此功能后TBT会基本1分钟请求 一次前方路况(此时间间隔不是固定的)。 + private var trafficInfoUpdateEnabled = true + //获取电子眼播报是否开启,默认开启 + private var mCameraInfoUpdateEnabled = true + //路口放大图 是否显示; + private var crossingDrawingEnabled = true + //屏幕是否常亮,默认开启 + private var screenAlwaysBright = true + //是否开启第二个路口转向提示 + private var isOpenNextRoadInfo = false + //是否允许移动网络下载离线语音dex,默认为不允许 + private var isIgnoreWifi = false + + private var mode = 0 + private var showMode = NaviViewShowMode.SHOW_MODE_LOCK_CAR + + + private constructor() + + + companion object { + // default cost model + const val COSTMODEL_DEFAULT = RoutingProvider.COSTMODEL_DEFAULT + // fast test cost model, consider eta mostly + const val COSTMODEL_FASTEST = RoutingProvider.COSTMODEL_FASTEST + // shortest cost model, consider distance mostly + const val COSTMODEL_SHORTEST = RoutingProvider.COSTMODEL_SHORTEST + // suggested cost model, consider varius factors + const val COSTMODEL_SUGGEST = RoutingProvider.COSTMODEL_SUGGEST + + const val COSTMODEL_ECO = RoutingProvider.COSTMODEL_ECO + + fun init(): NavParams { + return NavParams() + } + + + } + + fun setRouteSelectShow(isRouteSelectShow: Boolean): NavParams { + this.isRouteSelectShow = isRouteSelectShow + return this; + } + fun setRoutingModel(routingModel: Int): NavParams { + this.routingModel = routingModel + return this; + } + + fun getRouteSelectShow(): Boolean { + return isRouteSelectShow + } + fun getRoutingModel(): Int { + return routingModel + } + + + //HUD模式下,设置限速信息是否显示 + fun setMonitorCameraEnabled(monitorCameraEnabled: Boolean): NavParams{ + this.mIsMonitorCameraEnabled = monitorCameraEnabled + return this + } + + //设置交通状态是否更新 + //需要动态交通信息相关功能时需要调用此接口打开交通信息功能,默认是开启的, 打开后会每2分钟请求一次 + // 新的交通信息来更新交通信息。 + fun setTrafficStatusUpdateEnabled(enable: Boolean): NavParams{ + this.trafficStatusUpdateEnabled = enable + return this + } + + //设置是否打开移动交通台功能 默认是开启的,打开此功能后将有整体路况概览与前方路况播报功能, + //打开此功能后TBT会基本1分钟请求 一次前方路况(此时间间隔不是固定的)。 + fun setTrafficInfoUpdateEnabled(enable: Boolean): NavParams{ + this.trafficInfoUpdateEnabled = enable + return this + + } + + //设置电子眼播报是否开启 + //初始电子眼播报是打开的,当电子眼播报打开时,电子眼数据中有限速信息时,同时会播报限速信息 + fun setCameraInfoUpdateEnabled(enable: Boolean): NavParams{ + this.mCameraInfoUpdateEnabled = enable + return this + + } + + //设置路口放大图 是否显示 + fun setCrossingDrawingEnabled(crossingDrawingEnabled: Boolean): NavParams{ + this.crossingDrawingEnabled = crossingDrawingEnabled + return this + } + + + //设置屏幕是否常亮,默认开启 + fun setScreenAlwaysBright(isAlwaysBright: Boolean): NavParams{ + this.screenAlwaysBright = isAlwaysBright + return this + } + + //是否开启第二个路口转向提示 + fun setOpenNextRoadInfo(open: Boolean): NavParams{ + this.isOpenNextRoadInfo = open + return this + } + + + //是否允许移动网络下载离线语音dex,默认为不允许 + fun setIgnoreWifi(ignore: Boolean): NavParams{ + this.isIgnoreWifi = ignore + return this + } + + fun isIsIgnoreWifi(): Boolean{ + return isIgnoreWifi + } + + fun isTrafficStatusUpdateEnabled(): Boolean{ + return trafficStatusUpdateEnabled + } + + fun isTrafficInfoUpdateEnabled(): Boolean{ + return trafficInfoUpdateEnabled + } + + fun isCameraInfoUpdateEnabled(): Boolean{ + return mCameraInfoUpdateEnabled + } + + fun isCrossingDrawingEnabled(): Boolean{ + return crossingDrawingEnabled + } + + fun isScreenAlwaysBright(): Boolean{ + return screenAlwaysBright + } + + fun isOpenNextRoadInfo(): Boolean{ + return isOpenNextRoadInfo + } + + fun isMonitorCameraEnabled(): Boolean { + return mIsMonitorCameraEnabled + } + + fun setNaviMode(mode: Int){ + this.mode = mode + } + + fun getNaviMode(): Int{ + return mode + } + + fun setShowMode(showMode: Int){ + this.showMode = mode + } + + fun getShowMode(): Int{ + return mode + } +} + +//interface MapSty \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/IRenderData.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/IRenderData.kt new file mode 100644 index 0000000000..79a91afbd3 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/IRenderData.kt @@ -0,0 +1,5 @@ +package com.zhidaoauto.map.sdk.open.abs + +interface IRenderData { + fun renderDataResult(data:String); +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/IResult.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/IResult.kt new file mode 100644 index 0000000000..63057b2aa9 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/IResult.kt @@ -0,0 +1,6 @@ +package com.zhidaoauto.map.sdk.open.abs + +interface IResult { + + fun result(code:Int,result: T?) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/MapScreenListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/MapScreenListener.kt new file mode 100644 index 0000000000..1280228dcf --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/MapScreenListener.kt @@ -0,0 +1,8 @@ +package com.zhidaoauto.map.sdk.open.abs + +import android.graphics.Bitmap +import com.autonavi.nge.map.OnMapScreenShotListener + +interface MapScreenListener : OnMapScreenShotListener { + override fun onMapScreenShot(bitmap: Bitmap?) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/MapStatusListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/MapStatusListener.kt new file mode 100644 index 0000000000..be2ff38858 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/MapStatusListener.kt @@ -0,0 +1,11 @@ +package com.zhidaoauto.map.sdk.open.abs + +/** + * 地图状态监听 + * + * @param type 监听模式 LISTENER_TYPE_ZOOM 缩放 LISTENER_TYPE_ROTATE 旋转 LISTENER_TYPE_3D 视角切换 LISTENER_TYPE_STYLE 地图模式 + * @param value 当前状态值 + */ +interface MapStatusListener { + fun onMapStatusChanged(type: Int, value: Int) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnCameraChangeListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnCameraChangeListener.kt new file mode 100644 index 0000000000..c1d314f36a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnCameraChangeListener.kt @@ -0,0 +1,10 @@ +package com.zhidaoauto.map.sdk.open.abs + +import com.zhidaoauto.map.sdk.open.camera.CameraPosition + +interface OnCameraChangeListener { + + fun onCameraChange(type:Int,value:Int) + + fun onCameraChangeFinish(position: CameraPosition?) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnHdDataDownByCityListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnHdDataDownByCityListener.kt new file mode 100644 index 0000000000..ea2325c85d --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnHdDataDownByCityListener.kt @@ -0,0 +1,7 @@ +package com.zhidaoauto.map.sdk.open.abs + +interface OnHdDataDownByCityListener { + fun onMapHDDataCacheProgressByCity(id: Int, progress: Double) + //state 0: 失败 1: 成功 + fun onMapHDDataCacheStateByCity(id: Int, state: Int) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapChangeListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapChangeListener.kt new file mode 100644 index 0000000000..5974d857b0 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapChangeListener.kt @@ -0,0 +1,7 @@ +package com.zhidaoauto.map.sdk.open.abs + +import com.zhidaoauto.map.sdk.open.location.MogoLocation + +interface OnMapChangeListener { + fun onMapChange(mogoLocation: MogoLocation) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapClickListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapClickListener.kt new file mode 100644 index 0000000000..7925707a98 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapClickListener.kt @@ -0,0 +1,7 @@ +package com.zhidaoauto.map.sdk.open.abs + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +interface OnMapClickListener { + fun onMapClick(lonLatPoint: LonLatPoint) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapLoadedListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapLoadedListener.kt new file mode 100644 index 0000000000..1d591ce038 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapLoadedListener.kt @@ -0,0 +1,7 @@ +package com.zhidaoauto.map.sdk.open.abs + +interface OnMapLoadedListener { + fun onMapInit() + fun onMapLoaded() + fun onRoadLoaded(roadInfo:String?) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapStyleListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapStyleListener.kt new file mode 100644 index 0000000000..b41c999f50 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapStyleListener.kt @@ -0,0 +1,5 @@ +package com.zhidaoauto.map.sdk.open.abs + +interface OnMapStyleListener { + fun onChangeMapStyle(style: Int) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapTouchListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapTouchListener.kt new file mode 100644 index 0000000000..f7269a854b --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapTouchListener.kt @@ -0,0 +1,7 @@ +package com.zhidaoauto.map.sdk.open.abs + +import android.view.MotionEvent + +interface OnMapTouchListener { + fun onTouch(event: MotionEvent?):Boolean +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapViewVisualAngleChangeListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapViewVisualAngleChangeListener.kt new file mode 100644 index 0000000000..ec4098612a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMapViewVisualAngleChangeListener.kt @@ -0,0 +1,5 @@ +package com.zhidaoauto.map.sdk.open.abs + +interface OnMapViewVisualAngleChangeListener { + fun onMapViewVisualAngleChange(type: Int) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMyLocationChangeListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMyLocationChangeListener.kt new file mode 100644 index 0000000000..d07798a07c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnMyLocationChangeListener.kt @@ -0,0 +1,7 @@ +package com.zhidaoauto.map.sdk.open.abs + +import android.location.Location + +interface OnMyLocationChangeListener { + fun onMyLocationChange(location: Location) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnRenderListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnRenderListener.kt new file mode 100644 index 0000000000..2d69aa27c3 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnRenderListener.kt @@ -0,0 +1,5 @@ +package com.zhidaoauto.map.sdk.open.abs + +interface OnRenderListener { + fun renderTime(time:Int) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnRoadInfoListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnRoadInfoListener.kt new file mode 100644 index 0000000000..9db58a0c8e --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnRoadInfoListener.kt @@ -0,0 +1,11 @@ +package com.zhidaoauto.map.sdk.open.abs + +import com.zhidaoauto.map.sdk.open.road.RoadCross +import com.zhidaoauto.map.sdk.open.road.StopLine + + +interface OnRoadInfoListener { + fun onStopLineInfo(stopLine: StopLine?) + fun onRoadIdInfo(roadId: String?, laneId: String?) + fun onRoadCrossInfo(roadCross: RoadCross?) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnRoamStatusListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnRoamStatusListener.kt new file mode 100644 index 0000000000..ecbb1284cf --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnRoamStatusListener.kt @@ -0,0 +1,6 @@ +package com.zhidaoauto.map.sdk.open.abs + +interface OnRoamStatusListener { + //status 0:进入漫游模式成功 1;进入漫游模式失败 2:正常结束漫游 3:切换视角结束漫游 + fun onRoamStatus(status: Int, msg: String) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnScrollListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnScrollListener.kt new file mode 100644 index 0000000000..ec96dbbbf1 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnScrollListener.kt @@ -0,0 +1,6 @@ +package com.zhidaoauto.map.sdk.open.abs + + +interface OnScrollListener{ + fun scrollBy(x:Double,y:Double) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnTrailChangeListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnTrailChangeListener.kt new file mode 100644 index 0000000000..c78ba6c929 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/OnTrailChangeListener.kt @@ -0,0 +1,8 @@ +package com.zhidaoauto.map.sdk.open.abs + +/** + * 轨迹绘制完成监听 + */ +interface OnTrailChangeListener { + fun onFinish() +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/log/ILog.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/log/ILog.kt new file mode 100644 index 0000000000..37dd0c15a7 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/log/ILog.kt @@ -0,0 +1,5 @@ +package com.zhidaoauto.map.sdk.open.abs.log + +interface ILog { + fun result(path:String) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/marker/InfoWindowAdapter.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/marker/InfoWindowAdapter.kt new file mode 100644 index 0000000000..57de8bbb8c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/marker/InfoWindowAdapter.kt @@ -0,0 +1,9 @@ +package com.zhidaoauto.map.sdk.open.abs.marker + +import android.view.View +import com.zhidaoauto.map.sdk.open.marker.Marker + +interface InfoWindowAdapter{ + fun getInfoWindow(marker: Marker?): View? + fun getInfoContents(marker: Marker?):View? +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/marker/MarkerAnimationListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/marker/MarkerAnimationListener.kt new file mode 100644 index 0000000000..d703a4952a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/marker/MarkerAnimationListener.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.open.abs.marker + +import com.zhidaoauto.map.sdk.open.marker.Animation + + +interface MarkerAnimationListener { + fun onAnimationStart(animation: Animation) + + fun onAnimationEnd(animation: Animation) + + fun onAnimationRepeat(animation: Animation) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/marker/OnMarkerDragListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/marker/OnMarkerDragListener.kt new file mode 100644 index 0000000000..faeb7aa48f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/marker/OnMarkerDragListener.kt @@ -0,0 +1,9 @@ +package com.zhidaoauto.map.sdk.open.abs.marker + +import com.zhidaoauto.map.sdk.open.marker.Marker + +interface OnMarkerDragListener { + fun onMarkerDragStart(var1: Marker?) + fun onMarkerDrag(var1: Marker?) + fun onMarkerDragEnd(var1: Marker?) + } \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/navi/INaviResult.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/navi/INaviResult.kt new file mode 100644 index 0000000000..e32db6e328 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/navi/INaviResult.kt @@ -0,0 +1,8 @@ +package com.zhidaoauto.map.sdk.open.abs.navi + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +interface INaviResult { + + fun result(code:Int,data: ArrayList?,message: String?) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/search/IGeocodeSearch.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/search/IGeocodeSearch.kt new file mode 100644 index 0000000000..e6d07e84c2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/search/IGeocodeSearch.kt @@ -0,0 +1,25 @@ +package com.zhidaoauto.map.sdk.open.abs.search + +import com.zhidaoauto.map.sdk.open.exception.MapException +import com.zhidaoauto.map.sdk.open.query.GeocodeAddress +import com.zhidaoauto.map.sdk.open.query.GeocodeQuery +import com.zhidaoauto.map.sdk.open.query.OnGeocodeSearchListener + + +import com.zhidaoauto.map.sdk.open.query.RegeocodeAddress +import com.zhidaoauto.map.sdk.open.query.RegeocodeQuery + +interface IGeocodeSearch { + @Throws(MapException::class) + fun getFromLocation(regeocodeQuery: RegeocodeQuery): RegeocodeAddress? + + @Throws(MapException::class) + fun getFromLocationName(geocodeQuery: GeocodeQuery?): List? + + fun setOnGeocodeSearchListener(listener: OnGeocodeSearchListener?) + + fun getFromLocationAsyn(regeocodeQuery: RegeocodeQuery?) + + fun getFromLocationNameAsyn(geocodeQuery: GeocodeQuery?) + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/search/IInputtipsSearch.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/search/IInputtipsSearch.kt new file mode 100644 index 0000000000..99dcc9d724 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/search/IInputtipsSearch.kt @@ -0,0 +1,19 @@ +package com.zhidaoauto.map.sdk.open.abs.search + +import com.zhidaoauto.map.sdk.open.exception.MapException +import com.zhidaoauto.map.sdk.open.query.InputtipsListener +import com.zhidaoauto.map.sdk.open.query.InputtipsQuery +import com.zhidaoauto.map.sdk.open.query.Tip + +interface IInputtipsSearch { + + fun getQuery(): InputtipsQuery? + fun setQuery(query: InputtipsQuery) + + fun setInputtipsListener(listener: InputtipsListener?) + + fun requestInputtipsAsyn() + + @Throws(MapException::class) + fun requestInputtips(): ArrayList? +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/search/IPoiSearch.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/search/IPoiSearch.kt new file mode 100644 index 0000000000..d6db44b34a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/search/IPoiSearch.kt @@ -0,0 +1,24 @@ +package com.zhidaoauto.map.sdk.open.abs.search + +import com.zhidaoauto.map.sdk.open.exception.MapException +import com.zhidaoauto.map.sdk.open.query.OnPoiSearchListener +import com.zhidaoauto.map.sdk.open.query.PoiItem +import com.zhidaoauto.map.sdk.open.query.PoiSearchResult +import com.zhidaoauto.map.sdk.open.query.Query +import com.zhidaoauto.map.sdk.open.query.SearchBound + +interface IPoiSearch { + fun setOnPoiSearchListener(onPoiSearchListener: OnPoiSearchListener?) + @Throws(MapException::class) + fun searchPOI(): PoiSearchResult? + + fun searchPOIAsyn() + @Throws(MapException::class) + fun searchPOIId(id: String?): PoiItem? + fun searchPOICateGoryAsyn() + fun searchPOIIdAsyn(id: String?) + fun setQuery(query: Query?) + fun getQuery(): Query + fun getBound(): SearchBound? + fun setBound(searchBound: SearchBound?) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/view/IMapStyleParams.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/view/IMapStyleParams.kt new file mode 100644 index 0000000000..3d5e3cb9c4 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/abs/view/IMapStyleParams.kt @@ -0,0 +1,108 @@ +package com.zhidaoauto.map.sdk.open.abs.view + +import com.zhidaoauto.map.sdk.open.view.MapStyleParams + +interface IMapStyleParams { + + /** + * 设置是否开启阴影渲染 + * @param enable 默认true + */ + fun setShadowEnable(enable: Boolean): MapStyleParams + + fun setZoom(zoom: Int): MapStyleParams + + /** + * 设置自车位置 + * @param offset 1.0-6.0, <4.0车向上,>4.0车向下 + */ + fun setCarPosition(offset: Float): MapStyleParams + /** + * 设置模式 + * @param styleMode 模式 + */ + fun setStyleMode(styleMode: Int): MapStyleParams + /** + * 设置视图模式 + * @param perspectiveMode 视图模 + */ + fun setPerspectiveMode(perspectiveMode: Int): MapStyleParams + /** + * 设置需要渲染显示的图层 + * @param filter 参照 HDTypes + */ + fun setHDVisibileArray(filter: IntArray): MapStyleParams + + /** + * @param isAutoSwitch 是否自动切换白天黑夜模式 + */ + fun setAutoSwitch(isAutoSwitch: Boolean): MapStyleParams + + fun setVrPerspectiveMode(vrPerspectiveMode: Float): MapStyleParams + + fun setVrAngleMode(vrAngleMode: Int): MapStyleParams + + fun setSwitchViewAngle(isSwitchViewAngle: Boolean): MapStyleParams + + fun setVrEyeHeight(vrEyeHeight: Float):MapStyleParams + + /** + * 设置是否开启自动定位 + * @param isAutoLocation 默认true + */ + fun setAutoLocation(isAutoLocation: Boolean): MapStyleParams + + fun setZoomVal(zoomVal: Float):MapStyleParams + + /** + * 设置定位更新变动的最小距离 + * @param minDistanceForPosition 距离 + */ + fun setMinDistanceForPosition(minDistanceForPosition: Float): MapStyleParams + + fun setStyleName(name: String): MapStyleParams + + + fun getHDVisibileArray(): IntArray + + fun getStyleMode(): Int + + fun getPerspectiveMode(): Int + + fun getZoom(): Int + + fun getCarPosition(): Float + + fun isAutoSwitch(): Boolean + + fun getVrPerspectiveMode(): Float + + fun getVrAngleMode(): Int + + fun isSwitchViewAngle(): Boolean + + fun getVrEyeHeight(): Float + + fun getAutoLocation(): Boolean + + fun getZoomVal(): Float + + fun getMinDistanceForPosition(): Float + + fun isShadowEnable(): Boolean + + fun getStyleName(): String + + fun getDefaultPerspective(): Int + + fun setDefaultPerspective(type: Int): MapStyleParams + + fun setIsSkyBoxEnable(isEnable: Boolean): MapStyleParams + + fun getIsSkyBoxEnable(): Boolean + + fun setIsWeatherEnable(isEnable: Boolean): MapStyleParams + + fun getIsWeatherEnable(): Boolean + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/business/DeadZoneHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/business/DeadZoneHelper.kt new file mode 100644 index 0000000000..94d62b6835 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/business/DeadZoneHelper.kt @@ -0,0 +1,50 @@ +package com.zhidaoauto.map.sdk.open.business + +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.tools.MapTools + + +object DeadZoneHelper { + + private val TAG = javaClass.simpleName + + /** + * 处理盲区数据 + * @param param 盲区数据 数据格式:时间戳,经度,纬度,高度,yaw,角度间隔v,i*v对应的距离,(i+1)*v对应的距离,.... + */ + fun dealParam(param:String):List{ + var dataLineIndex = 0 + val lines = param.split(",") + val time = lines[dataLineIndex++].trim().toLong() + + val lon = lines[dataLineIndex++].trim().toDouble() + val lat = lines[dataLineIndex++].trim().toDouble() + dataLineIndex++ + var angle = Math.toDegrees(lines[dataLineIndex++].trim().toDouble()) + if(CompileConfig.DEBUG){ + Log.i(TAG, "dealParam: ${System.currentTimeMillis()},$time,$lon,$lat,$angle,${MapTools.convertAngle((450-angle)%360, lon, lat)}") + } + angle = MapTools.convertAngle((450-angle)%360, lon, lat) + var circleAngleInterval = lines[dataLineIndex++].trim().toFloat() + + var count = (360 / circleAngleInterval).toInt() + var countIndex = 1 + val list = ArrayList() + while (countIndex <= count && dataLineIndex + countIndex < lines.size) { + val desArray = MapTools.destination( + lon, + lat, + MapTools.dealAngle(angle - countIndex * circleAngleInterval), + lines[dataLineIndex + countIndex].trim().toDouble()/100.0 + ) + list.add(LonLatPoint(desArray[0], desArray[1])) + + countIndex++ + } + return list + + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/business/PointCloudHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/business/PointCloudHelper.kt new file mode 100644 index 0000000000..47f7e86ee0 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/business/PointCloudHelper.kt @@ -0,0 +1,67 @@ +package com.zhidaoauto.map.sdk.open.business + +import com.zhidaoauto.map.sdk.inner.abs.IMapController + + +object PointCloudHelper { + + private val TAG = javaClass.simpleName + + /** + * 更新点云数据 + * @param dataStr 点云数据 + * @param isTrasformer 是否需要转换坐标 + * @param isResidual 是否需要差量更新 + * @param isReset 是否重置数据 + * @return 是否执行 + */ + fun updatePointCloudData(dataStr:String,isTrasformer: Boolean,isResidual: Boolean,isReset: Boolean,mapController: IMapController?):Boolean{ + return mapController?.updatePointCloudData(dataStr,isTrasformer,isResidual,isReset)?:false + } + + /** + * 更新点云数据 + * @param dataStr 点云数据pb数据 + * @param isTrasformer 是否需要转换坐标 + * @param isResidual 是否需要差量更新 + * @param isReset 是否重置数据 + * @return 是否执行 + */ + fun updatePointCloudDataByPb(dataArray: ByteArray, isTrasformer: Boolean, isResidual: Boolean, isReset: Boolean,mapController: IMapController?):Boolean{ + return mapController?.updatePointCloudDataByPb(dataArray,isTrasformer,isResidual,isReset)?:false + } + + /** + * 设置点云大小 + * @param pointCloudSize (0.1-20) + */ + fun setPointCloudSize(pointCloudSize: Float,mapController: IMapController?){ + mapController?.setPointCloudSize(pointCloudSize) + } + + /** + * 设置点云颜色 + * @param color 颜色 + */ + fun setPointCloudColor(color: String,mapController: IMapController?){ + mapController?.setPointCloudColor(color) + } + + /** + * 设置是否绘制点云 + * @param isDrawPointCloud 是否绘制 默认false 不绘制 + */ + fun setIsDrawPointCloud(isDrawPointCloud: Boolean,mapController: IMapController?){ + mapController?.setIsDrawPointCloud(isDrawPointCloud) + } + + /** + * 绘制点云是否有动画 + * @param isDisplayFllowAnim 是否有动画 + * @param totalAnimTime 动画时间(100-10000) + */ + fun setPointCloudDisplayFllowAnim(isDisplayFllowAnim: Boolean, totalAnimTime: Int,mapController: IMapController?){ + mapController?.setPointCloudDisplayFllowAnim(isDisplayFllowAnim, totalAnimTime) + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/CameraPosition.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/CameraPosition.kt new file mode 100644 index 0000000000..3c3edd127c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/CameraPosition.kt @@ -0,0 +1,118 @@ +package com.zhidaoauto.map.sdk.open.camera + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class CameraPosition( + val target: LonLatPoint, + zoom: Float, //缩放 + tilt: Float,//俯仰角 + bearing: Float //偏航角 +) /*: Parcelable*/ { + val zoom: Float + val tilt: Float + val bearing: Float + + init { + + this.zoom = zoom + this.tilt = validTilt(tilt) + this.bearing = + (if (bearing.toDouble() <= 0.0) bearing % 360.0f + 360.0f else bearing) % 360.0f + } + + /* override fun writeToParcel(parcel: Parcel, var2: Int) { + parcel.writeFloat(this.bearing) + if (this.target != null) { + parcel.writeFloat(this.target!!.mLatitude as Float) + parcel.writeFloat(this.target!!.mLongitude as Float) + } + + parcel.writeFloat(this.tilt) + parcel.writeFloat(this.zoom) + } + */ + + private fun validTilt(tiltParam: Float): Float { + var result: Float = tiltParam + if (tiltParam < 0) { + result = 0.toFloat() + } else if (tiltParam > 90) { + result = 90.toFloat() + } + return result + } + + override fun toString(): String { + return "CameraPosition(target=$target, zoom=$zoom, tilt=$tilt, bearing=$bearing)" + } + + + class Builder { + private lateinit var target: LonLatPoint + private var zoom: Float = 0.toFloat() + private var tilt: Float = 0.toFloat() + private var bearing: Float = 0.toFloat() + + constructor() { + + } + + constructor(cameraPosition: CameraPosition) { + this.target(cameraPosition.target).bearing(cameraPosition.bearing) + .tilt(cameraPosition.tilt).zoom(cameraPosition.zoom) + } + + fun target(latLng: LonLatPoint): Builder { + this.target = latLng + return this + } + + fun zoom(zoom: Float): Builder { + this.zoom = zoom + return this + } + + fun tilt(tilt: Float): Builder { + this.tilt = tilt + return this + } + + fun bearing(bearing: Float): Builder { + this.bearing = bearing + return this + } + + fun build(): CameraPosition { + /* if (this.target == null) { + this.target = LatLng() + } */ + return CameraPosition( + this.target, + this.zoom, + this.tilt, + this.bearing + ) + } + } + + companion object { + + fun fromLatLngZoom(latLng: LonLatPoint, zoom: Float): CameraPosition { + return CameraPosition( + latLng, + zoom, + 0.0f, + 0.0f + ) + } + + fun builder(): Builder { + return Builder() + } + + fun builder(cameraPosition: CameraPosition): Builder { + return CameraPosition.Builder(cameraPosition) + } + } +} + diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/CameraUpdate.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/CameraUpdate.kt new file mode 100644 index 0000000000..074809c6e2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/CameraUpdate.kt @@ -0,0 +1,3 @@ +package com.zhidaoauto.map.sdk.open.camera + +class CameraUpdate(val cameraUpdateFactoryDelegate: MapCameraMessage) \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/CameraUpdateFactory.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/CameraUpdateFactory.kt new file mode 100644 index 0000000000..4420d34db0 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/CameraUpdateFactory.kt @@ -0,0 +1,105 @@ +package com.zhidaoauto.map.sdk.open.camera + +import android.graphics.Point +import com.zhidaoauto.map.sdk.inner.map.MapCameraMessageImpl +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +object CameraUpdateFactory { + + fun zoomIn(): CameraUpdate { + return CameraUpdate( + MapCameraMessageImpl.createZoomInInstance() + ) + } + + fun zoomOut(): CameraUpdate { + return CameraUpdate( + MapCameraMessageImpl.createZoomOutInstance() + ) + } + + fun scrollBy(xPixel: Float, yPixel: Float): CameraUpdate { + return CameraUpdate( + MapCameraMessageImpl.createNewInstance( + xPixel, + yPixel + ) + ) + } + + fun zoomTo(zoomLevel: Float): CameraUpdate { + return CameraUpdate( + MapCameraMessageImpl.createNewInstance( + zoomLevel + ) + ) + } + + fun zoomBy(zoomLevel: Float): CameraUpdate { + return CameraUpdate( + MapCameraMessageImpl.createAmountInstance( + zoomLevel + ) + ) + } + + fun zoomBy(amount: Float, point: Point): CameraUpdate { + return CameraUpdate( + MapCameraMessageImpl.createNewInstance( + amount, + point + ) + ) + } + + fun newCameraPosition(cameraPosition: CameraPosition): CameraUpdate { + return CameraUpdate( + MapCameraMessageImpl.createNewInstance( + cameraPosition + ) + ) + } + + fun newLatLng(latLng: LonLatPoint): CameraUpdate { + return CameraUpdate( + MapCameraMessageImpl.createNewInstance( + latLng + ) + ) + } + + fun newLatLngZoom(latLng: LonLatPoint, zoomLevel: Float): CameraUpdate { + return CameraUpdate( + MapCameraMessageImpl.createNewInstance( + latLng, + zoomLevel + ) + ) + } + + fun newLatLngBounds(var0: LatLngBounds, var1: Int): CameraUpdate { + return CameraUpdate(MapCameraMessageImpl.createNewInstance(var0, var1)) + } + + fun newLatLngBounds( + var0: LatLngBounds, + var1: Int, + var2: Int, + var3: Int, + var4: Int + ): CameraUpdate { + return CameraUpdate(MapCameraMessageImpl.createNewInstance(var0, var1, var2, var3, var4)) + } + + fun changeLatLng(latLng: LonLatPoint): CameraUpdate { + return CameraUpdate( + MapCameraMessageImpl.createNewInstance( + latLng + ) + ) + } + + /* fun newLatLngBounds(latLngBounds: LatLngBounds, var1: Int, var2: Int, var3: Int): CameraUpdate { + return CameraUpdate(MapCameraMessageImpl.createNewInstance(latLngBounds, var1, var2, var3)) + }*/ +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/LatLngBounds.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/LatLngBounds.kt new file mode 100644 index 0000000000..f1cf14d16a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/LatLngBounds.kt @@ -0,0 +1,87 @@ +package com.zhidaoauto.map.sdk.open.camera + +import com.zhidaoauto.map.sdk.inner.utils.TransformUtils +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class LatLngBounds { + + var southwest: LonLatPoint? = null + var northeast: LonLatPoint? = null + + constructor(southwest: LonLatPoint?, northeast: LonLatPoint?) { + this.southwest = southwest + this.northeast = northeast + } + + + companion object { + fun c(var0: Double, var2: Double): Double { + return (var0 - var2 + 360.0) % 360.0 + } + + fun d(var0: Double, var2: Double): Double { + return (var2 - var0 + 360.0) % 360.0 + } + } + + class Builder { + private var mSouth:Double = 1.0 + private var mNorth:Double = -1.0 + private var mWest:Double = 0.0 + private var mEast:Double = 0.0 + fun include(lonLatPoint: LonLatPoint?): Builder { + return if (lonLatPoint == null) { + this + } else { + mSouth = Math.min(mSouth, lonLatPoint.latitude) + mNorth = Math.max(mNorth, lonLatPoint.latitude) + val var2: Double = lonLatPoint.longitude + if (java.lang.Double.isNaN(mWest)) { + mWest = var2 + } else { + if (if (mWest <= mEast) mWest <= var2 && var2 <= mEast else mWest <= var2 || var2 <= mEast) { + return this + } + if (LatLngBounds.c(mWest, var2) < LatLngBounds.d(mEast, var2)) { + mWest = var2 + return this + } + } + mEast = var2 + this + } + } + + fun build(): LatLngBounds? { + return if (java.lang.Double.isNaN(mWest)) { + null + } else { + if (mWest > mEast) { + val var1 = mWest + mWest = mEast + mEast = var1 + } + if (mSouth > mNorth) { + val var3 = mSouth + mSouth = mNorth + mNorth = var3 + } + LatLngBounds(LonLatPoint(mSouth, mWest), LonLatPoint(mNorth, mEast)) + } + } + } + + override fun toString(): String { + return "LatLngBounds(southwest=$southwest, northeast=$northeast)" + } + + fun isLegal():Boolean{ + if(northeast != null &&southwest != null ){ + return !TransformUtils.outOfChina(southwest!!.latitude, southwest!!.longitude) && + !TransformUtils.outOfChina(northeast!!.latitude, northeast!!.longitude) + } + return false + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/MapCameraMessage.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/MapCameraMessage.kt new file mode 100644 index 0000000000..4e9b8f3ca8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/camera/MapCameraMessage.kt @@ -0,0 +1,44 @@ +package com.zhidaoauto.map.sdk.open.camera + +import android.graphics.Point + + +abstract class MapCameraMessage { + var nowType: Type + var xPixel: Float = 0.toFloat() + var yPixel: Float = 0.toFloat() + var zoom: Float = 0.toFloat() + var amount: Float = 0.toFloat() + var cameraPosition: CameraPosition? = null + var isChangeFinished: Boolean = false + var focus: Point? = null + var bounds: LatLngBounds? = null + var paddingLeft: Int = 0 + var paddingRight: Int = 0 + var paddingTop: Int = 0 + var paddingBottom: Int = 0 + var width: Int = 0 + var height: Int = 0 + + init { + this.nowType = + Type.none + this.isChangeFinished = false + this.focus = null + } + + enum class Type private constructor() { + none, + zoomIn, + changeCenter, + changeGeoCenterZoom, + zoomOut, + zoomTo, + zoomBy, + scrollBy, + newCameraPosition, + newLatLngBounds, + newLatLngBoundsWithSize, + changeGeoCenterZoomTiltBearing + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/circle/CircleController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/circle/CircleController.kt new file mode 100644 index 0000000000..b9b2a7ae91 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/circle/CircleController.kt @@ -0,0 +1,25 @@ +package com.zhidaoauto.map.sdk.open.circle + +import com.zhidaoauto.map.sdk.inner.abs.IMapController + + +class CircleController { + private var id: String? = null + constructor(id: String?) { + this.id = id + } + + fun getId(): String? { + return id + } + + fun setId(id: String?) { + this.id = id + } + + fun removePel(mapController: IMapController?) { + id?.let { + mapController?.removePel(it) + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/circle/CircleOptions.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/circle/CircleOptions.java new file mode 100644 index 0000000000..646675d173 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/circle/CircleOptions.java @@ -0,0 +1,65 @@ +package com.zhidaoauto.map.sdk.open.circle; + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint; + +import java.util.List; +import java.util.UUID; + +public class CircleOptions { + private String id; + private int color; + private int lineWidth; + private List lonLatPoints; + private int radius; + + public int getRadius() { + return radius; + } + + public CircleOptions setRadius(int radius) { + this.radius = radius; + return this; + } + + public CircleOptions() { + this.id = UUID.randomUUID().toString(); + } + + public CircleOptions(String id, int color, int lineWidth, List lonLatPoints) { + this.id = id; + this.color = color; + this.lineWidth = lineWidth; + this.lonLatPoints = lonLatPoints; + } + + public String getId() { + return id; + } + + public int getColor() { + return color; + } + + public CircleOptions setColor(int color) { + this.color = color; + return this; + } + + public int getLineWidth() { + return lineWidth; + } + + public CircleOptions setLineWidth(int lineWidth) { + this.lineWidth = lineWidth; + return this; + } + + public List getLonLatPoints() { + return lonLatPoints; + } + + public CircleOptions setLonLatPoints(List lonLatPoints) { + this.lonLatPoints = lonLatPoints; + return this; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/data/CityInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/data/CityInfo.kt new file mode 100644 index 0000000000..876bc89ba5 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/data/CityInfo.kt @@ -0,0 +1,14 @@ +package com.zhidaoauto.map.sdk.open.data + +class CityInfo{ + var cityCode: Int = 0 + var chineseCityName: String = "" + var englishCityName: String = "" + var isCache: Boolean = false + override fun toString(): String { + return "CityInfo(cityCode=$cityCode, chineseCityName='$chineseCityName', englishCityName='$englishCityName', isCache=$isCache)" + } + + +} + diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/data/MapDataApi.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/data/MapDataApi.kt new file mode 100644 index 0000000000..504b9d0d50 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/data/MapDataApi.kt @@ -0,0 +1,302 @@ +package com.zhidaoauto.map.sdk.open.data + +import android.app.ActivityManager +import android.content.Context +import android.text.TextUtils +import android.util.Log +import com.autonavi.nge.dm.SharedMemoryService +import com.autonavi.nge.map.LonLat +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +import com.zhidaoauto.map.sdk.inner.road.RoadHelper +import com.zhidaoauto.map.sdk.inner.utils.GisGeomTool +import com.zhidaoauto.map.sdk.inner.utils.LogHelper +import com.zhidaoauto.map.sdk.inner.utils.MathUtils +import com.zhidaoauto.map.sdk.inner.utils.Recorder +import com.zhidaoauto.map.sdk.open.abs.IResult +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.road.CenterLine +import com.zhidaoauto.map.sdk.open.road.Lane +import com.zhidaoauto.map.sdk.open.road.RoadCross +import com.zhidaoauto.map.sdk.open.road.RoadNameInfo +import com.zhidaoauto.map.sdk.open.road.RoadRectInfos +import com.zhidaoauto.map.sdk.open.road.StopLine +import com.zhidaoauto.map.sdk.open.road.ZebraLine +import com.zhidaoauto.map.sdk.open.routeinfo.RoadInfo + +object MapDataApi { + + private val TAG = javaClass.simpleName + + private var mContext:Context? = null + + fun getContext():Context?{ + return mContext + } + + fun startZeus(context: Context) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-start") + } + mContext = context + SharedMemoryService.getInstance(context) + } + + fun destory(){ + RoadHelper.getInstance()?.release() + if(CompileConfig.DEBUG){ + Log.w(TAG, "destroyop--:RoadHelper.destory") + } + SharedMemoryService.getInstance(mContext).exit() + if(CompileConfig.DEBUG){ + Log.w(TAG, "destroyop--:SharedMemoryService.destory") + } + } + + /** + * 判断服务是否开启 + * + * @return + */ + fun isServiceRunning(context: Context, ServiceName: String): Boolean { + if (true) { + return false + } + if (TextUtils.isEmpty(ServiceName)) { + return false + } + val myManager = context + .getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager + val runningServices = myManager + .getRunningServices(50) as ArrayList + for (info in runningServices) { + if (info.service.className.equals(ServiceName)) { + return true + } + } + return false + } + + + fun getRouteInfo( + centerLon: Float, + centerLat: Float, coor: Int, type: Int + ): String { + Recorder.add("roadop-getRouteInfo:$centerLon,$centerLat,$coor,$type") + return RoadHelper.getInstance()?.getRoadInfo(centerLon, centerLat, coor, type)?:"" + } + + /** + * 获取道路关键点数据 + * + */ + fun getMatchRoadInfo( + lonLatPoints: List, + bGetAllPoints: Boolean + ): List? { + if (CompileConfig.DEBUG) { + Log.i(TAG, "roadop getMatchRoadInfo") + } + val originArray = DoubleArray(lonLatPoints.size * 2) + var lonLat: LonLat? + for ((index, lonLatPoint) in lonLatPoints.withIndex()) { + lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint) + originArray[index * 2] = lonLat.lon + originArray[index * 2 + 1] = lonLat.lat + } + if (CompileConfig.DEBUG) { + LogHelper.info(TAG, "roadop getMatchRoadInfo--param:${originArray.joinToString()}") +// Recorder.i("${originArray.joinToString()}") + } + val resultArray = RoadHelper.getInstance()?.getMatchRoadInfo(originArray, bGetAllPoints) + if (CompileConfig.DEBUG) { + LogHelper.info(TAG, "roadop getMatchRoadInfo--resultArray:${resultArray?.joinToString()}") + } + resultArray?.let { array -> + if (resultArray.isEmpty()) { + return null + } + var lonLatPoint: LonLatPoint? + val resultList = ArrayList(resultArray.size / 2) + for (index in 0..array.size - 1 step 2) { + lonLatPoint = CommonProxy.getInstance().getLonLatProxy() + .switchLonLat(LonLat(array[index], array[index + 1])) + resultList.add(lonLatPoint) + } + return resultList + } + return null + } + + + /** + * 获取行车方向 + * + */ + fun getRouteAngle(startLonLat: LonLatPoint, endLonLat: LonLatPoint): Float { + if (CompileConfig.DEBUG) { + Log.i(TAG, "queryop getRouteAngle") + } + val startLonLat = + CommonProxy.getInstance().getLonLatProxy().switchLonLat(startLonLat) + val endLonLat = + CommonProxy.getInstance().getLonLatProxy().switchLonLat(endLonLat) + return RoadHelper.getInstance()?.getRouteAngle( + startLonLat.lon.toFloat(), + startLonLat.lat.toFloat(), + endLonLat.lon.toFloat(), + endLonLat.lat.toFloat() + )?:0f + } + + // 匹配车道中心线数据 + @Deprecated(message = "replace getCenterLineInfo") + fun getSinglePointMatchRoad(lon: Double, lat: Double, angle: Float, isGps: Boolean, isRTK: Boolean): SinglePointRoadInfo? { + Recorder.add("roadop-getLimitSpeed:$lon,$lat,$angle") + return RoadHelper.getInstance()?.getSinglePointMatchRoad(lon, lat, angle, isGps,isRTK) + } + + // 获取车道中心线数据 + fun getLaneInfo(tileId: Long, routeId: Int): ArrayList? { + Recorder.add("roadop-getLimitSpeed:$tileId,$routeId") + return RoadHelper.getInstance()?.getLaneInfo(tileId, routeId) + } + + // 获取点到线段的距离 + fun GetDisFromPointToLine( ptOrg:LonLatPoint, pLine:ArrayList, ptMatch:LonLatPoint, nSegmentOrder:Int):Double { + return GisGeomTool.GetDisFromPointToLine(ptOrg, pLine, ptMatch, nSegmentOrder) + } + + // 获取点到线段的最近距离 + fun getNearstFromPointToSegment(x: Double, y: Double, x1: Double, y1: Double, x2: Double, y2: Double): Double { + return MathUtils.minDistance(x, y, x1, y1, x2, y2) + } + + //获取限速接口 + fun getLimitSpeed(lon: Double,lat: Double,angle: Float,call: IResult){ + Recorder.add("roadop-getLimitSpeed:$lon,$lat,$angle") + RoadHelper.getInstance()?.getRoadLimitSpeed(lon,lat,angle,call) + } + + /** + * 获取点与道路边界的距离 + * + */ + fun getOffRoadDistance(lon: Double, lat: Double, angle: Float): Double { + Recorder.add("roadop-getOffRoadDistance:$lon,$lat,$angle") + return RoadHelper.getInstance()?.getOffRoadDistance(lon, lat, angle)?:0.0 + } + + /** + * 获取停止线信息 + */ + fun getStopLineInfo(lon: Double, lat: Double, angle: Float,call: IResult) { + Recorder.add("roadop-getStopLineInfo:$lon,$lat,$angle") + RoadHelper.getInstance()?.getStopLine(lon, lat, angle,call) + } + + /** + * 获取行驶方向一定长度的中心线 + * lon:经度 + * lat:纬度 + * angle:航向角 + * dis:获取车道中心线的长度 正 行驶方向前方距离 负 行驶方向后方距离 + */ + fun getCenterLineRangeInfo(lon: Double, lat: Double, angle: Float, dis: Float,call: IResult) { + Recorder.add("roadop-getCenterLineRangeInfo:$lon,$lat,$angle,$dis") + RoadHelper.getInstance()?.getCenterLineRange(lon, lat, angle,dis,call) + } + + + /** + * 获取行驶方向一定长度的中心线 + * lon:经度 + * lat:纬度 + * angle:航向角 + * dis:获取车道中心线的长度 正 行驶方向前方距离 负 行驶方向后方距离 + */ + fun getCenterLineRoadNode(lon: Double, lat: Double, angle: Float, dis: Float,call: IResult){ + Recorder.add("roadop-getCenterLineRoadNode:$lon,$lat,$angle,$dis") + RoadHelper.getInstance()?.getCenterLineRoadNode(lon, lat, angle,dis,call) + } + + + fun getRoadName(lon: Double, lat: Double, angle: Float, call: IResult){ + Recorder.add("roadop-getRoadName:$lon,$lat,$angle") + RoadHelper.getInstance()?.getRoadName(lon, lat, angle,call) + } + + /** + * 获取道路路口信息 + */ + fun getCrossRoad(dLon: Double, dlat: Double , fAngle: Float,call: IResult){ + Recorder.add("roadop-getCrossRoad:$dLon,$dlat,$fAngle") + RoadHelper.getInstance()?.getCrossRoad(dLon, dlat, fAngle,call) + } + /** + * 根据路口id获取道路信息 + */ + fun getCrossRoadById(tileId: Int, id: Long,call: IResult>){ + Recorder.add("roadop-getCrossRoadById:$tileId,$id") + RoadHelper.getInstance()?.getCrossRoadById(tileId, id,call) + } + + + /** + * 获取道路矩形点 + */ + fun getRoadRectInfo(lon: Double, lat: Double, angle: Float,call : IResult) { + RoadHelper.getInstance()?.getRoadRect(lon, lat, angle,call) + } + + /** + * 获取车道中心线信息 + */ + fun getCenterLineInfo(lon: Double, lat: Double, angle: Float,call: IResult) { + Recorder.add("roadop-getCenterLineInfo:$lon,$lat,$angle") + RoadHelper.getInstance()?.getCenterLine(lon, lat, angle,call) + } + /** + * 是否合法的经纬度 + */ + fun isRightLonLat(lon:Double,lat:Double):Boolean{ + var rightLon = false; + var rightLat = false; + if (lon > -180.0 && lon < 180.0) { + rightLon = true; + } + if (lat > -90.0 && lat < 90.0) { + rightLat = true; + } + return rightLon && rightLat; + + } + + fun modifyRedisFileVersion(version:Int){ + RoadHelper.getInstance()?.modifyRedisFileVersion(version) + } + + fun updateCacheFile(){ + RoadHelper.getInstance()?.updateCacheFile() + } + + + fun getZebraLineByDistance(dLon: Double, dlat: Double , fAngle: Float, dis: Float,call: IResult>){ + Recorder.add("$dLon,$dlat,$fAngle,$dis") + RoadHelper.getInstance()?.getZebraLineByDistance(dLon, dlat, fAngle, dis,call) + } + + //计算两线交点 + fun getIntersection(lineSelf: ArrayList, lineOther: ArrayList): Pair { + return MathUtils.getIntersection(lineSelf, lineOther) + } + //获取动态线 + fun getDynamicLinePoints(centerLonLatPoint: LonLatPoint, pointList: MutableList): MutableList?{ + return MathUtils.getNearestPoints(centerLonLatPoint, pointList) + } + + fun initFileCacheByCity(lon :Double, lat: Double){ + RoadHelper.getInstance()?.initFileCacheByCity(lon, lat) + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/data/SinglePointRoadInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/data/SinglePointRoadInfo.kt new file mode 100644 index 0000000000..fdfb269277 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/data/SinglePointRoadInfo.kt @@ -0,0 +1,23 @@ +package com.zhidaoauto.map.sdk.open.data + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class SinglePointRoadInfo { + var tileId: Long? = null + var roadId: Long? = null + // 车道编号: + //按照参考线数字化方向从左到右、从大到小编号; 中心线编号为0, 中心线右侧编号为负数,中心线左侧编号为正数。如:一个双向6车道通行Road的车道编号, 3,2,1,0,-1,-2,-3 + var laneNo: Int? = null + //车道宽度 + var laneWidth: Float? = null + //当前车道信息 + var coords: ArrayList? = null + //剩余车道信息 + var leftCoords: ArrayList? = null + //剩余车道长度 + var leftLen: Float? = null + override fun toString(): String { + return "SinglePointRoadInfo(tileId=$tileId, roadId=$roadId, laneNo=$laneNo, laneWidth=$laneWidth, coords=$coords, leftCoords=$leftCoords, leftLen=$leftLen)" + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/deadzone/DeadZone.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/deadzone/DeadZone.kt new file mode 100644 index 0000000000..cfccce546a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/deadzone/DeadZone.kt @@ -0,0 +1,69 @@ +package com.zhidaoauto.map.sdk.open.deadzone + +import android.util.Log +import com.alibaba.fastjson.JSON +import com.alibaba.fastjson.JSONException +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class DeadZone { + private val TAG = "DeadZone" + + private var id: String? = null + private var mDeadZoneOptions: DeadZoneOptions? = null + private var mMapController:IMapController? = null + + constructor(deadZoneOptions: DeadZoneOptions,mapController: IMapController?){ + mDeadZoneOptions = deadZoneOptions + mMapController = mapController + id = deadZoneOptions.getId() + } + + + fun remove() { + // 移除单个盲区 + id?.let { + mMapController?.removePel(it) + } + } + + fun getId(): String? { + return id + } + + + fun setVisible(visible: Boolean) { + if (mDeadZoneOptions != null) { + mDeadZoneOptions?.setVisible(visible) + id?.let { + mMapController?.setVisiable(it, visible) + } + } + } + + fun isVisible(): Boolean { + return if (mDeadZoneOptions != null) mDeadZoneOptions!!.isVisible() else false + } + + fun setOption(option: DeadZoneOptions?) { + mDeadZoneOptions = option + try { + val strJsonOptions = JSON.toJSONString(option) + Log.i(TAG, "setOption: $strJsonOptions") + mMapController?.drawDeadZone(strJsonOptions) + + } catch (e: JSONException) { + } + } + + fun setPoints(lonLatPoints: List?) { + if (mDeadZoneOptions != null) { + mDeadZoneOptions!!.setPosition(lonLatPoints) + setOption(mDeadZoneOptions) + } + } + + fun destroy() { + mDeadZoneOptions = null + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/deadzone/DeadZoneOptions.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/deadzone/DeadZoneOptions.kt new file mode 100644 index 0000000000..d22bd0eb3e --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/deadzone/DeadZoneOptions.kt @@ -0,0 +1,100 @@ +package com.zhidaoauto.map.sdk.open.deadzone + +import com.autonavi.nge.map.LonLat +import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy.Companion.getInstance +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import java.util.UUID + +class DeadZoneOptions { + + //id + private var id:String = "" + //颜色 + private var color:Int = 0 + //是否GPS + private var isGps:Boolean = false + //盲区数据 + private var position = ArrayList() + + //是否显示 + private var visible:Boolean = false + + constructor(id: String) { + this.id = id + } + + constructor(){ + this.id = UUID.randomUUID().toString() + } + + + + fun setPosition(list:List?):DeadZoneOptions{ + list?.let { + try { + val lonLats = ArrayList() + var lonLat:LonLat? + for (i in list.indices) { + if (list.get(i) == null) { + continue + } + if (!isGps) { + lonLat = getInstance().getLonLatProxy().switchLonLat(list.get(i)) + } else { + lonLat = LonLat(list.get(i).longitude, list.get(i).latitude) + } + lonLats.add(lonLat) + } + this.position = lonLats + } catch (e: Exception) { + } + } + return this + } + + fun getPosition():ArrayList{ + return position + } + + + fun setGps(gps:Boolean):DeadZoneOptions{ + this.isGps = gps + return this + } + + fun isGps():Boolean{ + return isGps + } + + fun setVisible(visible:Boolean):DeadZoneOptions{ + this.visible = visible + return this + } + + fun isVisible():Boolean{ + return visible + } + + fun setId(id:String):DeadZoneOptions{ + this.id = id + return this + } + + fun getId():String{ + return id + } + + fun setColor(color:Int):DeadZoneOptions{ + this.color = color + return this + } + + fun getColor():Int{ + return color + } + + override fun toString(): String { + return "DeadZoneOptions(id='$id', isGps=$isGps, position=$position)" + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/BaseDialog.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/BaseDialog.kt new file mode 100644 index 0000000000..1f1f83c283 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/BaseDialog.kt @@ -0,0 +1,58 @@ +package com.zhidaoauto.map.sdk.open.dialog + +import android.app.Dialog +import android.util.Log + +abstract class BaseDialog { + var isDialogShown = false + private var dialogLifeCycleListener: DialogLifeCycleListener? = null + var onDismissListener: OnDismissListener? = null + get() { + if (field == null) field = object : OnDismissListener { + override fun onDismiss() {} + } + return field + } + + fun log(o: Any) { + } + + fun setDialogLifeCycleListener(listener: DialogLifeCycleListener?) { + dialogLifeCycleListener = listener + } + + fun getDialogLifeCycleListener(): DialogLifeCycleListener { + if (dialogLifeCycleListener == null) dialogLifeCycleListener = object : DialogLifeCycleListener { + override fun onCreate(alertDialog: Dialog?) {} + override fun onShow(alertDialog: Dialog?) {} + override fun onDismiss() {} + } + return dialogLifeCycleListener!! + } + + fun cleanDialogLifeCycleListener() { + dialogLifeCycleListener = null + } + + abstract fun showDialog() + abstract fun doDismiss() + + companion object { + @JvmField + var dialogList: ArrayList = ArrayList() //对话框队列 + fun unloadAllDialog() { + try { + for (baseDialog in dialogList) { + baseDialog.doDismiss() + } + dialogList = ArrayList() + } catch (e: Exception) { + e.printStackTrace() + } + } + fun showNextModalDialog() { + Log.i("###", "showNextModalDialog: " + dialogList.size) + dialogList.get(0).showDialog() + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/BindView.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/BindView.kt new file mode 100644 index 0000000000..cd267b6d16 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/BindView.kt @@ -0,0 +1,7 @@ +package com.zhidaoauto.map.sdk.open.dialog + +import android.view.View + +interface BindView { + fun onBind(dialog: CustomDialog?, rootView: View?) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/BlurView.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/BlurView.java new file mode 100644 index 0000000000..8eff359642 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/BlurView.java @@ -0,0 +1,394 @@ +package com.zhidaoauto.map.sdk.open.dialog; + +import android.app.Activity; +import android.content.Context; +import android.content.ContextWrapper; +import android.content.pm.ApplicationInfo; +import android.content.res.TypedArray; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.graphics.PorterDuff; +import android.graphics.PorterDuffXfermode; +import android.graphics.Rect; +import android.graphics.RectF; +import android.renderscript.Allocation; +import android.renderscript.Element; +import android.renderscript.RSRuntimeException; +import android.renderscript.RenderScript; +import android.renderscript.ScriptIntrinsicBlur; +import android.util.AttributeSet; +import android.util.TypedValue; +import android.view.View; +import android.view.ViewTreeObserver; + +import com.zhidaoauto.map.sdk.R; + +public class BlurView extends View { + private float mDownsampleFactor; // default 4 + private int mOverlayColor; // default #aaffffff + private float mBlurRadius; // default 10dp (0 < r <= 25) + + private boolean mDirty; + private Bitmap mBitmapToBlur, mBlurredBitmap; + private Canvas mBlurringCanvas; + private RenderScript mRenderScript; + private ScriptIntrinsicBlur mBlurScript; + private Allocation mBlurInput, mBlurOutput; + private boolean mIsRendering; + private final Rect mRectSrc = new Rect(), mRectDst = new Rect(); + // mDecorView should be the root view of the activity (even if you are on a different window like a dialog) + private View mDecorView; + // If the view is on different root view (usually means we are on a PopupWindow), + // we need to manually call invalidate() in onPreDraw(), otherwise we will not be able to see the changes + private boolean mDifferentRoot; + private static int RENDERING_COUNT; + + private Paint mPaint; + private RectF mRectF; + private float mXRadius; + private float mYRadius; + + private Bitmap mRoundBitmap; + private Canvas mTmpCanvas; + + public BlurView(Context context, AttributeSet attrs) { + super(context, attrs); + + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RealtimeBlurView); + mBlurRadius = a.getDimension( + R.styleable.RealtimeBlurView_realtimeBlurRadius, + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 28, context.getResources().getDisplayMetrics()) + ); + mDownsampleFactor = a.getFloat(R.styleable.RealtimeBlurView_realtimeDownsampleFactor, 4); + mOverlayColor = a.getColor(R.styleable.RealtimeBlurView_realtimeOverlayColor, 0x00ffffff); + + //ready rounded corner + mPaint = new Paint(); + mPaint.setAntiAlias(true); + mRectF = new RectF(); + + mXRadius = a.getDimension(R.styleable.RealtimeBlurView_xRadius, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, context.getResources().getDisplayMetrics())); + mYRadius = a.getDimension(R.styleable.RealtimeBlurView_yRadius, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, context.getResources().getDisplayMetrics())); + a.recycle(); + } + + public void setBlurRadius(float radius) { + if (mBlurRadius != radius) { + mBlurRadius = radius; + mDirty = true; + invalidate(); + } + } + + public void setRadius(Context context, float x, float y) { + if (mXRadius != x || mYRadius != y) { + mXRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, x, context.getResources().getDisplayMetrics()); + mYRadius = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, y, context.getResources().getDisplayMetrics()); + mDirty = true; + invalidate(); + } + } + + public void setDownsampleFactor(float factor) { + if (factor <= 0) { + throw new IllegalArgumentException("Downsample factor must be greater than 0."); + } + + if (mDownsampleFactor != factor) { + mDownsampleFactor = factor; + mDirty = true; // may also change blur radius + releaseBitmap(); + invalidate(); + } + } + + public void setOverlayColor(int color) { + if (mOverlayColor != color) { + mOverlayColor = color; + invalidate(); + } + } + + private void releaseBitmap() { + if (mBlurInput != null) { + mBlurInput.destroy(); + mBlurInput = null; + } + if (mBlurOutput != null) { + mBlurOutput.destroy(); + mBlurOutput = null; + } + if (mBitmapToBlur != null) { + mBitmapToBlur.recycle(); + mBitmapToBlur = null; + } + if (mBlurredBitmap != null) { + mBlurredBitmap.recycle(); + mBlurredBitmap = null; + } + } + + private void releaseScript() { + if (mRenderScript != null) { + mRenderScript.destroy(); + mRenderScript = null; + } + if (mBlurScript != null) { + mBlurScript.destroy(); + mBlurScript = null; + } + } + + protected void release() { + releaseBitmap(); + releaseScript(); + } + + protected boolean prepare() { + if (mBlurRadius == 0) { + release(); + return false; + } + + float downsampleFactor = mDownsampleFactor; + + if (mDirty || mRenderScript == null) { + if (mRenderScript == null) { + try { + mRenderScript = RenderScript.create(getContext()); + mBlurScript = ScriptIntrinsicBlur.create(mRenderScript, Element.U8_4(mRenderScript)); + } catch (RSRuntimeException e) { + if (isDebug(getContext())) { + if (e.getMessage() != null && e.getMessage().startsWith("Error loading RS jni library: java.lang.UnsatisfiedLinkError:")) { + throw new RuntimeException("Error loading RS jni library, Upgrade buildToolsVersion=\"24.0.2\" or higher may solve this issue"); + } else { + throw e; + } + } else { + // In release mode, just ignore + releaseScript(); + return false; + } + } + } + + mDirty = false; + float radius = mBlurRadius / downsampleFactor; + if (radius > 25) { + downsampleFactor = downsampleFactor * radius / 25; + radius = 25; + } + mBlurScript.setRadius(radius); + } + + final int width = getWidth(); + final int height = getHeight(); + + int scaledWidth = Math.max(1, (int) (width / downsampleFactor)); + int scaledHeight = Math.max(1, (int) (height / downsampleFactor)); + + if (mBlurringCanvas == null || mBlurredBitmap == null + || mBlurredBitmap.getWidth() != scaledWidth + || mBlurredBitmap.getHeight() != scaledHeight) { + releaseBitmap(); + + boolean r = false; + try { + mBitmapToBlur = Bitmap.createBitmap(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888); + if (mBitmapToBlur == null) { + return false; + } + mBlurringCanvas = new Canvas(mBitmapToBlur); + + mBlurInput = Allocation.createFromBitmap(mRenderScript, mBitmapToBlur, + Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT + ); + mBlurOutput = Allocation.createTyped(mRenderScript, mBlurInput.getType()); + + mBlurredBitmap = Bitmap.createBitmap(scaledWidth, scaledHeight, Bitmap.Config.ARGB_8888); + if (mBlurredBitmap == null) { + return false; + } + + r = true; + } catch (OutOfMemoryError e) { + // Bitmap.createBitmap() may cause OOM error + // Simply ignore and fallback + } finally { + if (!r) { + releaseBitmap(); + return false; + } + } + } + return true; + } + + protected void blur(Bitmap bitmapToBlur, Bitmap blurredBitmap) { + mBlurInput.copyFrom(bitmapToBlur); + mBlurScript.setInput(mBlurInput); + mBlurScript.forEach(mBlurOutput); + mBlurOutput.copyTo(blurredBitmap); + } + + private final ViewTreeObserver.OnPreDrawListener preDrawListener = new ViewTreeObserver.OnPreDrawListener() { + @Override + public boolean onPreDraw() { + final int[] locations = new int[2]; + Bitmap oldBmp = mBlurredBitmap; + View decor = mDecorView; + if (decor != null && isShown() && prepare()) { + boolean redrawBitmap = mBlurredBitmap != oldBmp; + oldBmp = null; + decor.getLocationOnScreen(locations); + int x = -locations[0]; + int y = -locations[1]; + + getLocationOnScreen(locations); + x += locations[0]; + y += locations[1]; + + // just erase transparent + mBitmapToBlur.eraseColor(mOverlayColor & 0xffffff); + + int rc = mBlurringCanvas.save(); + mIsRendering = true; + RENDERING_COUNT++; + try { + mBlurringCanvas.scale(1.f * mBitmapToBlur.getWidth() / getWidth(), 1.f * mBitmapToBlur.getHeight() / getHeight()); + mBlurringCanvas.translate(-x, -y); + if (decor.getBackground() != null) { + decor.getBackground().draw(mBlurringCanvas); + } + decor.draw(mBlurringCanvas); + } catch (StopException e) { + } finally { + mIsRendering = false; + RENDERING_COUNT--; + mBlurringCanvas.restoreToCount(rc); + } + + blur(mBitmapToBlur, mBlurredBitmap); + + if (redrawBitmap || mDifferentRoot) { + invalidate(); + } + } + + return true; + } + }; + + protected View getActivityDecorView() { + Context ctx = getContext(); + for (int i = 0; i < 4 && ctx != null && !(ctx instanceof Activity) && ctx instanceof ContextWrapper; i++) { + ctx = ((ContextWrapper) ctx).getBaseContext(); + } + if (ctx instanceof Activity) { + return ((Activity) ctx).getWindow().getDecorView(); + } else { + return null; + } + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + mDecorView = getActivityDecorView(); + if (mDecorView != null) { + mDecorView.getViewTreeObserver().addOnPreDrawListener(preDrawListener); + mDifferentRoot = mDecorView.getRootView() != getRootView(); + if (mDifferentRoot) { + mDecorView.postInvalidate(); + } + } else { + mDifferentRoot = false; + } + } + + @Override + protected void onDetachedFromWindow() { + if (mDecorView != null) { + mDecorView.getViewTreeObserver().removeOnPreDrawListener(preDrawListener); + } + release(); + super.onDetachedFromWindow(); + } + + @Override + public void draw(Canvas canvas) { + if (mIsRendering) { + // Quit here, don't draw views above me + throw STOP_EXCEPTION; + } else if (RENDERING_COUNT > 0) { + // Doesn't support blurview overlap on another blurview + } else { + super.draw(canvas); + } + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + drawBlurredBitmap(canvas, mBlurredBitmap, mOverlayColor); + } + + /** + * Custom draw the blurred bitmap and color to define your own shape + * + * @param canvas + * @param blurredBitmap + * @param overlayColor + */ + protected void drawBlurredBitmap(Canvas canvas, Bitmap blurredBitmap, int overlayColor) { + if (blurredBitmap != null) { + mRectSrc.right = blurredBitmap.getWidth(); + mRectSrc.bottom = blurredBitmap.getHeight(); + mRectDst.right = getWidth(); + mRectDst.bottom = getHeight(); + canvas.drawBitmap(blurredBitmap, mRectSrc, mRectDst, null); + } + canvas.drawColor(overlayColor); + + if (getWidth() > 0 && getHeight() > 0) { + //Rounded corner + mRectF.right = getWidth(); + mRectF.bottom = getHeight(); + if (mRoundBitmap == null) { + mRoundBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888); + } + if (mTmpCanvas == null) { + mTmpCanvas = new Canvas(mRoundBitmap); + } + mTmpCanvas.drawRoundRect(mRectF, mXRadius, mYRadius, mPaint); + } + + mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN)); + canvas.drawBitmap(mRoundBitmap, 0, 0, mPaint); + } + + private static class StopException extends RuntimeException { + } + + private static StopException STOP_EXCEPTION = new StopException(); + + static { +// try { +// BlurView.class.getClassLoader().loadClass("androidx.renderscript.RenderScript"); +// } catch (ClassNotFoundException e) { +// throw new RuntimeException("\n错误!\nRenderScript支持库未启用,要启用模糊效果,请在您的app的Gradle配置文件中添加以下语句:" + +// "\nandroid { \n...\n defaultConfig { \n ...\n renderscriptTargetApi 19 \n renderscriptSupportModeEnabled true \n }\n}"); +// } + } + + // android:debuggable="true" in AndroidManifest.xml (auto set by build tool) + static Boolean DEBUG = null; + + static boolean isDebug(Context ctx) { + if (DEBUG == null && ctx != null) { + DEBUG = (ctx.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; + } + return DEBUG.equals(Boolean.TRUE); + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/CustomDialog.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/CustomDialog.kt new file mode 100644 index 0000000000..a7793920d4 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/CustomDialog.kt @@ -0,0 +1,117 @@ +package com.zhidaoauto.map.sdk.open.dialog + +import android.app.Activity +import android.app.AlertDialog +import android.content.Context +import android.view.Gravity +import android.view.LayoutInflater +import android.view.View +import android.view.Window +import com.zhidaoauto.map.sdk.R + +class CustomDialog:BaseDialog { + + private var isCanCancel = false + private var customDialog: CustomDialog? = null + private var alertDialog: AlertDialog? = null + private var rootView: View? = null + private var mContext: Context? = null + private var bindView: BindView? = null + private var mGravity = 0 + private var mDialogHelper:DialogHelper? = null + + + constructor(){ + } + + companion object{ + protected var dialogList: ArrayList = ArrayList() + + fun show(context: Context?, layoutResId: Int): CustomDialog { + val customView = LayoutInflater.from(context).inflate(layoutResId, null) + return show(context, customView, null) + } + + fun show(context: Context?, layoutResId: Int, bindView: BindView?): CustomDialog { + val customView = LayoutInflater.from(context).inflate(layoutResId, null) + return show(context, customView, bindView) + } + + fun show(context: Context?, layoutResId: Int, bindView: BindView?, gravity: Int): CustomDialog { + val customView = LayoutInflater.from(context).inflate(layoutResId, null) + return show(context, customView, bindView, gravity) + } + + fun show(context: Context?, rootView: View?, bindView: BindView?): CustomDialog { + val customDialog: CustomDialog = build(context, rootView, bindView, Gravity.CENTER) + customDialog.showDialog() + return customDialog + } + + fun show(context: Context?, rootView: View?, bindView: BindView?, gravity: Int): CustomDialog { + val customDialog: CustomDialog = build(context, rootView, bindView, gravity) + customDialog.showDialog() + return customDialog + } + + fun build(context: Context?, layoutResId: Int, bindView: BindView?): CustomDialog { + val customView = LayoutInflater.from(context).inflate(layoutResId, null) + return build(context, customView, bindView, Gravity.CENTER) + } + + fun build(context: Context?, rootView: View?, bindView: BindView?, gravity: Int): CustomDialog { + synchronized(CustomDialog::class.java) { + val customDialog: CustomDialog = CustomDialog() + customDialog.cleanDialogLifeCycleListener() + customDialog.alertDialog = null + customDialog.mContext = context + customDialog.bindView = bindView + customDialog.rootView = rootView + customDialog.mGravity = gravity + customDialog.customDialog = customDialog + dialogList.add(customDialog) + return customDialog + } + } + + + + } + + + override fun doDismiss(){ + mDialogHelper?.dismiss() + } + + fun getAlertDialog(): AlertDialog? { + return alertDialog + } + + + override fun showDialog() { + val builder: AlertDialog.Builder = AlertDialog.Builder(mContext, R.style.lightMode) + builder.setCancelable(isCanCancel) + alertDialog = builder.create() + alertDialog?.setView(rootView) + val window: Window? = alertDialog?.getWindow() + window?.setGravity(mGravity) + getDialogLifeCycleListener().onCreate(alertDialog) + if (isCanCancel){ + alertDialog?.setCanceledOnTouchOutside(true) + } + val fragmentManager = (mContext as Activity).fragmentManager + mDialogHelper = DialogHelper().setAlertDialog(alertDialog, object : OnDismissListener { + override fun onDismiss() { + rootView = null + getDialogLifeCycleListener().onDismiss() + onDismissListener?.onDismiss() + isDialogShown = false + mContext = null + } + }) + getDialogLifeCycleListener().onShow(alertDialog) + if (bindView != null) bindView?.onBind(this, rootView) + mDialogHelper?.show(fragmentManager, "customDialog") + mDialogHelper?.setCancelable(isCanCancel) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/DialogHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/DialogHelper.kt new file mode 100644 index 0000000000..ba29555680 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/DialogHelper.kt @@ -0,0 +1,46 @@ +package com.zhidaoauto.map.sdk.open.dialog + +import android.app.AlertDialog +import android.app.Dialog +import android.app.DialogFragment +import android.app.FragmentManager +import android.content.DialogInterface +import android.os.Bundle + +class DialogHelper: DialogFragment() { + + private var alertDialog: AlertDialog? = null + private var onDismissListener: OnDismissListener? = null + + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + return alertDialog!! + } + + fun setAlertDialog(alertDialog: AlertDialog?, onDismissListener: OnDismissListener?): DialogHelper { + this.alertDialog = alertDialog + this.onDismissListener = onDismissListener + return this + } + + override fun onDismiss(dialog: DialogInterface) { + super.onDismiss(dialog!!) + if (onDismissListener != null) onDismissListener!!.onDismiss() + } + + override fun show(manager: FragmentManager, tag: String?) { + try { + val ft = manager.beginTransaction() + ft.add(this, tag) + ft.commitAllowingStateLoss() + } catch (e: IllegalStateException) { + e.printStackTrace() + } + } + + override fun onActivityCreated(savedInstanceState: Bundle?) { + if (dialog == null) { + showsDialog = false + } + super.onActivityCreated(savedInstanceState) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/DialogLifeCycleListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/DialogLifeCycleListener.kt new file mode 100644 index 0000000000..d6d984ecc4 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/DialogLifeCycleListener.kt @@ -0,0 +1,9 @@ +package com.zhidaoauto.map.sdk.open.dialog + +import android.app.Dialog + +interface DialogLifeCycleListener { + fun onCreate(alertDialog: Dialog?) + fun onShow(alertDialog: Dialog?) + fun onDismiss() +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/DialogSettings.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/DialogSettings.kt new file mode 100644 index 0000000000..44e006efd8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/DialogSettings.kt @@ -0,0 +1,71 @@ +package com.zhidaoauto.map.sdk.open.dialog + +object DialogSettings { + const val THEME_LIGHT = 0 + const val THEME_DARK = 1 + + @Deprecated("") + val TYPE_MATERIAL = 0 + + @Deprecated("") + val TYPE_KONGZUE = 1 + + @Deprecated("") + val TYPE_IOS = 2 + const val STYLE_MATERIAL = 0 + const val STYLE_KONGZUE = 1 + const val STYLE_IOS = 2 + + //是否打印日志 + var DEBUGMODE = true + + //决定等待框、提示框以及iOS风格的对话框是否启用模糊背景 + var use_blur = true + + //决定等待框、提示框以及iOS风格的对话框的模糊背景透明度(50-255) + var blur_alpha = 200 + + //决定对话框的默认样式,请使用 STYLE_MATERIAL、STYLE_KONGZUE、STYLE_IOS 赋值 + var style = 0 + + //决定对话框的模式(亮色和暗色两种),请使用 THEME_LIGHT、THEME_DARK 赋值 + var dialog_theme = 0 + + //决定对话框的默认背景色 + var dialog_background_color = -1 + + //决定提示框的模式(亮色和暗色两种),请使用 THEME_LIGHT、THEME_DARK 赋值 + var tip_theme = 1 + + /* + * 文字大小设定 + * 注意,此值必须大于0才生效,否则使用默认值。另外,我们使用的是dp单位,非sp单位,若有特殊需要请自行转换 + * 另外,暂时不支持Material风格对话框设定字体大小 + */ + //决定对话框标题文字样式 + var dialogTitleTextInfo = TextInfo() + + //决定对话框内容文字样式 + var dialogContentTextInfo = TextInfo() + + //决定对话框按钮文字样式 + var dialogButtonTextInfo = TextInfo() + + //决定对话框积极按钮(一般为确定按钮)文字样式,若未设置此样式则会使用 dialogButtonTextInfo 代替 + var dialogOkButtonTextInfo: TextInfo? = null + + //决定提示框文本样式 + var tipTextInfo = TextInfo() + + //决定菜单文字样式 + var menuTextInfo = TextInfo() + + //决定 Notification 默认文字样式信息 + var notificationTextInfo = TextInfo() + + //决定输入框输入文本字样大小(单位:dp),当值<=0时使用默认大小 + var dialog_input_text_size = 0 + + //决定对话框组件默认是否可点击遮罩区域关闭 + var dialog_cancelable_default = false +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/InputDialog.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/InputDialog.kt new file mode 100644 index 0000000000..0233d75ab5 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/InputDialog.kt @@ -0,0 +1,326 @@ +package com.zhidaoauto.map.sdk.open.dialog + +import android.app.Activity +import android.app.AlertDialog +import android.content.Context +import android.content.DialogInterface +import android.graphics.Typeface +import android.text.InputFilter +import android.text.InputFilter.LengthFilter +import android.text.InputType +import android.util.TypedValue +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.view.inputmethod.InputMethodManager +import android.widget.EditText +import android.widget.ImageView +import android.widget.LinearLayout +import android.widget.RelativeLayout +import android.widget.TextView +import com.zhidaoauto.map.sdk.R + +class InputDialog private constructor() : BaseDialog() { + private var inputDialog: InputDialog? = null + var alertDialog: AlertDialog? = null + private set + private var isCanCancel = false + private var inputInfo: InputInfo? = null + private var style = -1 + private var customTitleTextInfo: TextInfo? = null + private var customContentTextInfo: TextInfo? = null + private var customButtonTextInfo: TextInfo? = null + private var customOkButtonTextInfo: TextInfo? = null + private var context: Context? = null + private var title: String? = null + private var message: String? = null + private var defaultInputText = "" + private var defaultInputHint = "" + private var okButtonCaption = "确定" + private var cancelButtonCaption = "取消" + private var onOkButtonClickListener: InputDialogOkButtonClickListener? = null + private var onCancelButtonClickListener: DialogInterface.OnClickListener? = null + + companion object { + //Fast Function + fun show(context: Context?, title: String?, message: String, onOkButtonClickListener: InputDialogOkButtonClickListener?): InputDialog { + val inputDialog = build(context, title, message, "确定", onOkButtonClickListener, "取消", null) + inputDialog.showDialog() + return inputDialog + } + + fun show( + context: Context?, title: String?, message: String, okButtonCaption: String, onOkButtonClickListener: InputDialogOkButtonClickListener?, + cancelButtonCaption: String, onCancelButtonClickListener: DialogInterface.OnClickListener? + ): InputDialog { + val inputDialog = build(context, title, message, okButtonCaption, onOkButtonClickListener, cancelButtonCaption, onCancelButtonClickListener) + inputDialog.showDialog() + return inputDialog + } + + fun build( + context: Context?, title: String?, message: String, okButtonCaption: String, onOkButtonClickListener: InputDialogOkButtonClickListener?, + cancelButtonCaption: String, onCancelButtonClickListener: DialogInterface.OnClickListener? + ): InputDialog { + synchronized(InputDialog::class.java) { + val inputDialog = InputDialog() + inputDialog.cleanDialogLifeCycleListener() + inputDialog.alertDialog = null + inputDialog.context = context + inputDialog.title = title + inputDialog.message = message + inputDialog.okButtonCaption = okButtonCaption + inputDialog.cancelButtonCaption = cancelButtonCaption + inputDialog.onOkButtonClickListener = onOkButtonClickListener + inputDialog.onCancelButtonClickListener = onCancelButtonClickListener + inputDialog.isCanCancel = false + inputDialog.log("装载输入对话框 -> $message") + inputDialog.inputDialog = inputDialog + dialogList.add(inputDialog) + return inputDialog + } + } + } + + + private var blur: BlurView? = null + private var bkg: ViewGroup? = null + private var txtDialogTitle: TextView? = null + private var txtDialogTip: TextView? = null + private var txtInput: EditText? = null + private var splitHorizontal: ImageView? = null + private var btnSelectNegative: TextView? = null + private var splitVertical: ImageView? = null + private var btnSelectPositive: TextView? = null + private var customView: RelativeLayout? = null + var blur_front_color = 0 + private var mDialogHelper: DialogHelper? = null + override fun showDialog() { + if (customTitleTextInfo == null) { + customTitleTextInfo = TextInfo() + } + if (customContentTextInfo == null) { + customContentTextInfo = TextInfo() + } + if (customButtonTextInfo == null) { + customButtonTextInfo = TextInfo() + } + if (customOkButtonTextInfo == null) { + customOkButtonTextInfo = TextInfo() + } + dialogList.add(inputDialog!!) + log("启动输入对话框 -> $message") + if (style == -1) style = DialogSettings.style + dialogList.remove(inputDialog!!) + val builder: AlertDialog.Builder + builder = AlertDialog.Builder(context!!) + alertDialog = builder.create() + alertDialog!!.setView(EditText(context)) + getDialogLifeCycleListener().onCreate(alertDialog) + if (isCanCancel) alertDialog!!.setCanceledOnTouchOutside(true) + val rootView: View + val fragmentManager = (context as Activity?)!!.fragmentManager + mDialogHelper = DialogHelper().setAlertDialog(alertDialog, object : OnDismissListener { + override fun onDismiss() { + dialogList.remove(inputDialog!!) + if (bkg != null) bkg!!.removeAllViews() + if (mDialogHelper != null) mDialogHelper!!.dismissAllowingStateLoss() + if (customView != null) customView!!.removeAllViews() + if (onCancelButtonClickListener != null) onCancelButtonClickListener!!.onClick(alertDialog, DialogInterface.BUTTON_NEGATIVE) + getDialogLifeCycleListener().onDismiss() + onDismissListener!!.onDismiss() + isDialogShown = false + if (!dialogList.isEmpty()) { + showNextModalDialog() + } + context = null + } + }) + val window = alertDialog?.getWindow(); + rootView = LayoutInflater.from(context).inflate(R.layout.dialog_select, null); + alertDialog?.setView(rootView); + mDialogHelper?.show(fragmentManager, "kongzueDialog"); + + bkg = rootView?.findViewById(R.id.bkg) as LinearLayout + txtDialogTitle = rootView.findViewById(R.id.txt_dialog_title); + txtDialogTip = rootView.findViewById(R.id.txt_dialog_tip); + txtInput = rootView.findViewById(R.id.txt_input); + btnSelectNegative = rootView.findViewById(R.id.btn_selectNegative); + btnSelectPositive = rootView.findViewById(R.id.btn_selectPositive); + customView = rootView.findViewById(R.id.box_custom); + + if (inputInfo != null) { + + txtInput?.setFilters(arrayOf(LengthFilter(inputInfo!!.maX_LENGTH))) + txtInput?.setInputType(inputInfo!!.getInputType()); + } + + if (isNull(title)) { + txtDialogTitle?.setVisibility(View.GONE); + } else { + txtDialogTitle?.setVisibility(View.VISIBLE); + txtDialogTitle?.setText(title); + } + if (isNull(message)) { + txtDialogTip?.setVisibility(View.GONE); + } else { + txtDialogTip?.setVisibility(View.VISIBLE); + txtDialogTip?.setText(message); + } + + + txtInput?.setVisibility(View.VISIBLE); + txtInput?.setText(defaultInputText); + txtInput?.setHint(defaultInputHint); + + btnSelectNegative?.setVisibility(View.VISIBLE); + btnSelectPositive?.setText(okButtonCaption); + btnSelectPositive?.setOnClickListener({ + fun onClick(v: View) { + setIMMStatus(false, txtInput); + onOkButtonClickListener?.onClick(alertDialog, txtInput?.getText().toString()); + onCancelButtonClickListener = null; + } + }) + btnSelectNegative?.setText(cancelButtonCaption); + btnSelectNegative?.setOnClickListener({ + fun onClick(v: View) { + mDialogHelper?.dismissAllowingStateLoss(); + onCancelButtonClickListener?.onClick(alertDialog, DialogInterface.BUTTON_NEGATIVE); + onCancelButtonClickListener = null; + } + }) + +// if (dialog_theme == THEME_DARK) { +// bkg.setBackgroundResource(R.color.dlg_bkg_dark); +// btnSelectNegative.setBackgroundResource(R.drawable.button_dialog_kongzue_gray_dark); +// btnSelectPositive.setBackgroundResource(R.drawable.button_dialog_kongzue_blue_dark); +// btnSelectNegative.setTextColor(Color.rgb(255, 255, 255)); +// btnSelectPositive.setTextColor(Color.rgb(255, 255, 255)); +// txtInput.setTextColor(Color.rgb(255, 255, 255)); +// txtInput.setBackgroundResource(R.drawable.editbox_bkg_dark); +// } + + useTextInfo(txtDialogTitle, customTitleTextInfo); + useTextInfo(txtDialogTip, customContentTextInfo); + useTextInfo(btnSelectNegative, customButtonTextInfo); + useTextInfo(btnSelectPositive, customOkButtonTextInfo); + +// if (dialog_background_color != -1) { +// bkg.setBackgroundResource(dialog_background_color); +// } + + mDialogHelper?.show(fragmentManager!!, "customDialog") + isDialogShown = true + getDialogLifeCycleListener().onShow(alertDialog) + mDialogHelper!!.isCancelable = true + } + + private fun useTextInfo(textView: TextView?, textInfo: TextInfo?) { + if (textInfo!!.fontSize > 0) { + textView!!.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textInfo.fontSize.toFloat()) + } + if (textInfo.fontColor != 1) { + textView!!.setTextColor(textInfo.fontColor) + } + if (textInfo.gravity != -1) { + textView!!.gravity = textInfo.gravity + } + val font = Typeface.create(Typeface.SANS_SERIF, if (textInfo.isBold) Typeface.BOLD else Typeface.NORMAL) + textView!!.typeface = font + } + + override fun doDismiss() { + if (mDialogHelper != null) mDialogHelper!!.dismissAllowingStateLoss() + } + + fun setCanCancel(canCancel: Boolean): InputDialog { + isCanCancel = canCancel + if (mDialogHelper != null) mDialogHelper!!.isCancelable = canCancel + return this + } + + fun setDefaultInputText(defaultInputText: String): InputDialog { + this.defaultInputText = defaultInputText + if (alertDialog != null) { + txtInput!!.setText(defaultInputText) + txtInput!!.hint = defaultInputHint + } + return this + } + + fun setDefaultInputHint(defaultInputHint: String): InputDialog { + this.defaultInputHint = defaultInputHint + if (alertDialog != null) { + txtInput!!.setText(defaultInputText) + txtInput!!.hint = defaultInputHint + } + return this + } + + private fun dip2px(context: Context?, dpValue: Float): Int { + val scale = context!!.resources.displayMetrics.density + return (dpValue * scale + 0.5f).toInt() + } + + fun setCustomView(view: View?): InputDialog { + if (alertDialog != null && view != null) { + customView!!.visibility = View.VISIBLE + customView!!.addView(view) + } + return this + } + + private fun isNull(s: String?): Boolean { + return if (s == null || s.trim { it <= ' ' }.isEmpty() || s == "null") { + true + } else false + } + + private fun setIMMStatus(show: Boolean, editText: EditText?) { + if (show) { + editText!!.requestFocus() + editText.isFocusableInTouchMode = true + val imm = context!!.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + imm.showSoftInput(editText, InputMethodManager.SHOW_FORCED) + } else { + val imm = context!!.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager + imm.hideSoftInputFromWindow(editText!!.windowToken, 0) + } + } + + //输入内容设置 + fun setInputInfo(inputInfo: InputInfo): InputDialog { + if (txtInput != null) { + txtInput!!.filters = arrayOf(LengthFilter(inputInfo.maX_LENGTH)) + txtInput!!.inputType = InputType.TYPE_CLASS_TEXT or inputInfo.inputType + } + this.inputInfo = inputInfo + return this + } + + fun setTitleTextInfo(textInfo: TextInfo?): InputDialog { + customTitleTextInfo = textInfo + return this + } + + fun setContentTextInfo(textInfo: TextInfo?): InputDialog { + customContentTextInfo = textInfo + return this + } + + fun setButtonTextInfo(textInfo: TextInfo?): InputDialog { + customButtonTextInfo = textInfo + return this + } + + fun setOkButtonTextInfo(textInfo: TextInfo?): InputDialog { + customOkButtonTextInfo = textInfo + return this + } + + fun setDialogStyle(style: Int): InputDialog { + this.style = style + return this + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/InputDialogOkButtonClickListener.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/InputDialogOkButtonClickListener.java new file mode 100644 index 0000000000..03151f68c8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/InputDialogOkButtonClickListener.java @@ -0,0 +1,7 @@ +package com.zhidaoauto.map.sdk.open.dialog; + +import android.app.Dialog; + +public interface InputDialogOkButtonClickListener { + void onClick(Dialog dialog, String inputText); +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/InputInfo.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/InputInfo.java new file mode 100644 index 0000000000..8380ef8c77 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/InputInfo.java @@ -0,0 +1,33 @@ +package com.zhidaoauto.map.sdk.open.dialog; + +import android.text.InputType; + + +public class InputInfo { + + private int MAX_LENGTH; + private int inputType; //类型详见 android.text.InputType + + public int getMAX_LENGTH() { + return MAX_LENGTH; + } + + public InputInfo setMAX_LENGTH(int MAX_LENGTH) { + this.MAX_LENGTH = MAX_LENGTH; + return this; + } + + public int getInputType() { + return inputType; + } + + /** + * 文本输入类型 + * {@link InputType}. + * @see InputType + */ + public InputInfo setInputType(int inputType) { + this.inputType = inputType; + return this; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/OnBackPressListener.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/OnBackPressListener.java new file mode 100644 index 0000000000..ca20bdc6f9 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/OnBackPressListener.java @@ -0,0 +1,8 @@ +package com.zhidaoauto.map.sdk.open.dialog; + + +import android.app.AlertDialog; + +public interface OnBackPressListener { + void OnBackPress(AlertDialog alertDialog); +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/OnDismissListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/OnDismissListener.kt new file mode 100644 index 0000000000..653d0a1f91 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/OnDismissListener.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.open.dialog + +/** + * Author: @Kongzue + * Github: https://github.com/kongzue/ + * Homepage: http://kongzue.com/ + * Mail: myzcxhh@live.cn + * CreateTime: 2018/12/14 14:25 + */ +interface OnDismissListener { + fun onDismiss() +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/ProgressView.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/ProgressView.java new file mode 100644 index 0000000000..ac2f247a4e --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/ProgressView.java @@ -0,0 +1,802 @@ +package com.zhidaoauto.map.sdk.open.dialog; + +import android.annotation.TargetApi; +import android.content.Context; +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.ColorFilter; +import android.graphics.Paint; +import android.graphics.PixelFormat; +import android.graphics.Rect; +import android.graphics.RectF; +import android.graphics.drawable.Animatable; +import android.graphics.drawable.Drawable; +import android.os.Build; +import android.os.SystemClock; +import android.util.AttributeSet; +import android.util.DisplayMetrics; +import android.util.TypedValue; +import android.view.View; +import android.view.animation.AnimationUtils; +import android.view.animation.DecelerateInterpolator; +import android.view.animation.Interpolator; + +import androidx.annotation.NonNull; + +import com.zhidaoauto.map.sdk.R; + + +public class ProgressView extends View { + public static final int MODE_DETERMINATE = 0; + public static final int MODE_INDETERMINATE = 1; + private CircularProgressDrawable circularProgressDrawable; + private boolean isStart = false; + private boolean isAutoStart = true; + + public ProgressView(Context context, AttributeSet attrs) { + super(context, attrs); + init(context); + } + + protected void init(Context context) { + applyStyle(context); + } + + /** + * set progress's style + */ + protected void applyStyle(Context context) { + int mProgressId = R.style.CircularProgress; + circularProgressDrawable = new CircularProgressDrawable.Builder(context, mProgressId).build(); + ViewUtil.setBackground(this, circularProgressDrawable); + } + + public CircularProgressDrawable getCircularProgressDrawable() { + return circularProgressDrawable; + } + + public void setAutoStart(boolean autoStart) { + isAutoStart = autoStart; + } + + /** + * set the stroke size with px + */ + public void setStrokeSizePx(int px) { + getCircularProgressDrawable().setmStrokeSize(px); + } + + /** + * set the stroke size with dp + */ + public void setStrokeSizeDp(Context context, float dp) { + int px = dipToPixels(context, dp); + getCircularProgressDrawable().setmStrokeSize(px); + } + + /** + * set the colors with int[] + */ + public void setStrokeColors(int[] strokeColors) { + getCircularProgressDrawable().setmStrokeColors(strokeColors); + } + + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + if (isAutoStart) { + start(); + } + + } + + @Override + protected void onVisibilityChanged(@NonNull View changedView, int visibility) { + super.onVisibilityChanged(changedView, visibility); + if (visibility == GONE || visibility == INVISIBLE && isStart) { + stop(); + } else { + if (isAutoStart) { + start(); + } + } + + + } + + @Override + protected void onDetachedFromWindow() { + if (isStart && getVisibility() == View.VISIBLE) { + stop(); + } + super.onDetachedFromWindow(); + } + + /** + * Start showing progress. + */ + public void start() { + if (circularProgressDrawable != null) { + circularProgressDrawable.start(); + isStart = true; + } + } + + /** + * Stop showing progress. + */ + public void stop() { + if (circularProgressDrawable != null && isStart) { + circularProgressDrawable.stop(); + isStart = false; + } + + } + + /** + * convert dip tp px + */ + private int dipToPixels(Context context, float dipValue) { + DisplayMetrics metrics = context.getResources().getDisplayMetrics(); + return (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, metrics) + 0.5f); + } + + + static class CircularProgressDrawable extends Drawable implements Animatable { + + private long mLastUpdateTime; + private long mLastProgressStateTime; + private long mLastRunStateTime; + + private int mProgressState; + + private static final int PROGRESS_STATE_HIDE = -1; + private static final int PROGRESS_STATE_STRETCH = 0; + private static final int PROGRESS_STATE_KEEP_STRETCH = 1; + private static final int PROGRESS_STATE_SHRINK = 2; + private static final int PROGRESS_STATE_KEEP_SHRINK = 3; + + private int mRunState = RUN_STATE_STOPPED; + + private static final int RUN_STATE_STOPPED = 0; + private static final int RUN_STATE_STARTING = 1; + private static final int RUN_STATE_STARTED = 2; + private static final int RUN_STATE_RUNNING = 3; + private static final int RUN_STATE_STOPPING = 4; + + private Paint mPaint; + private RectF mRect; + private float mStartAngle; + private float mSweepAngle; + private int mStrokeColorIndex; + + private int mPadding; + private float mInitialAngle; + private float mMaxSweepAngle; + private float mMinSweepAngle; + private int mStrokeSize; + private int[] mStrokeColors; + private boolean mReverse; + private int mRotateDuration; + private int mTransformDuration; + private int mKeepDuration; + private float mInStepPercent; + private int[] mInColors; + private int mInAnimationDuration; + private int mOutAnimationDuration; + private int mProgressMode; + private Interpolator mTransformInterpolator; + + private CircularProgressDrawable(int padding, float initialAngle, float maxSweepAngle, float minSweepAngle, + int strokeSize, int[] strokeColors, boolean reverse, + int rotateDuration, int transformDuration, int keepDuration, + Interpolator transformInterpolator, int progressMode, int inAnimDuration, + float inStepPercent, int[] inStepColors, int outAnimDuration) { + mPadding = padding; + mInitialAngle = initialAngle; + mMaxSweepAngle = maxSweepAngle; + mMinSweepAngle = minSweepAngle; + mStrokeSize = strokeSize; + mStrokeColors = strokeColors; + mReverse = reverse; + mRotateDuration = rotateDuration; + mTransformDuration = transformDuration; + mKeepDuration = keepDuration; + mTransformInterpolator = transformInterpolator; + mProgressMode = progressMode; + mInAnimationDuration = inAnimDuration; + mInStepPercent = inStepPercent; + mInColors = inStepColors; + mOutAnimationDuration = outAnimDuration; + + mPaint = new Paint(); + mPaint.setAntiAlias(true); + mPaint.setStrokeCap(Paint.Cap.ROUND); + mPaint.setStrokeJoin(Paint.Join.ROUND); + + mRect = new RectF(); + } + + @Override + public void draw(@NonNull Canvas canvas) { + drawIndeterminate(canvas); + } + + private int getIndeterminateStrokeColor() { + if (mProgressState != PROGRESS_STATE_KEEP_SHRINK || mStrokeColors.length == 1) { + return mStrokeColors[mStrokeColorIndex]; + } + + float value = Math.max(0f, Math.min(1f, (float) (SystemClock.uptimeMillis() - mLastProgressStateTime) / mKeepDuration)); + int prev_index = mStrokeColorIndex == 0 ? mStrokeColors.length - 1 : mStrokeColorIndex - 1; + + return ColorUtil.getMiddleColor(mStrokeColors[prev_index], mStrokeColors[mStrokeColorIndex], value); + } + + private void drawIndeterminate(Canvas canvas) { + if (mRunState == RUN_STATE_STARTING) { + Rect bounds = getBounds(); + float x = (bounds.left + bounds.right) / 2f; + float y = (bounds.top + bounds.bottom) / 2f; + float maxRadius = (Math.min(bounds.width(), bounds.height()) - mPadding * 2) / 2f; + + float stepTime = 1f / (mInStepPercent * (mInColors.length + 2) + 1); + float time = (float) (SystemClock.uptimeMillis() - mLastRunStateTime) / mInAnimationDuration; + float steps = time / stepTime; + + float outerRadius = 0f; + float innerRadius = 0f; + + for (int i = (int) Math.floor(steps); i >= 0; i--) { + innerRadius = outerRadius; + outerRadius = Math.min(1f, (steps - i) * mInStepPercent) * maxRadius; + + if (i >= mInColors.length) { + continue; + } + + if (innerRadius == 0) { + mPaint.setColor(mInColors[i]); + mPaint.setStyle(Paint.Style.FILL); + canvas.drawCircle(x, y, outerRadius, mPaint); + } else if (outerRadius > innerRadius) { + float radius = (innerRadius + outerRadius) / 2; + mRect.set(x - radius, y - radius, x + radius, y + radius); + + mPaint.setStrokeWidth(outerRadius - innerRadius); + mPaint.setStyle(Paint.Style.STROKE); + mPaint.setColor(mInColors[i]); + + canvas.drawCircle(x, y, radius, mPaint); + } else { + break; + } + } + + if (mProgressState == PROGRESS_STATE_HIDE) { + if (steps >= 1 / mInStepPercent || time >= 1) { + resetAnimation(); + mProgressState = PROGRESS_STATE_STRETCH; + } + } else { + float radius = maxRadius - mStrokeSize / 2f; + + mRect.set(x - radius, y - radius, x + radius, y + radius); + mPaint.setStrokeWidth(mStrokeSize); + mPaint.setStyle(Paint.Style.STROKE); + mPaint.setColor(getIndeterminateStrokeColor()); + + canvas.drawArc(mRect, mStartAngle, mSweepAngle, false, mPaint); + } + } else if (mRunState == RUN_STATE_STOPPING) { + float size = (float) mStrokeSize * Math.max(0, (mOutAnimationDuration - SystemClock.uptimeMillis() + mLastRunStateTime)) / mOutAnimationDuration; + + if (size > 0) { + Rect bounds = getBounds(); + float radius = (Math.min(bounds.width(), bounds.height()) - mPadding * 2 - mStrokeSize * 2 + size) / 2f; + float x = (bounds.left + bounds.right) / 2f; + float y = (bounds.top + bounds.bottom) / 2f; + + mRect.set(x - radius, y - radius, x + radius, y + radius); + mPaint.setStrokeWidth(size); + mPaint.setStyle(Paint.Style.STROKE); + mPaint.setColor(getIndeterminateStrokeColor()); + + canvas.drawArc(mRect, mStartAngle, mSweepAngle, false, mPaint); + } + } else if (mRunState != RUN_STATE_STOPPED) { + Rect bounds = getBounds(); + float radius = (Math.min(bounds.width(), bounds.height()) - mPadding * 2 - mStrokeSize) / 2f; + float x = (bounds.left + bounds.right) / 2f; + float y = (bounds.top + bounds.bottom) / 2f; + + mRect.set(x - radius, y - radius, x + radius, y + radius); + mPaint.setStrokeWidth(mStrokeSize); + mPaint.setStyle(Paint.Style.STROKE); + mPaint.setColor(getIndeterminateStrokeColor()); + + canvas.drawArc(mRect, mStartAngle, mSweepAngle, false, mPaint); + } + } + + public void setmStrokeSize(int mStrokeSize) { + this.mStrokeSize = mStrokeSize; + } + + public void setmStrokeColors(int[] mStrokeColors) { + this.mStrokeColors = mStrokeColors; + } + + @Override + public void setAlpha(int alpha) { + mPaint.setAlpha(alpha); + } + + @Override + public void setColorFilter(ColorFilter cf) { + mPaint.setColorFilter(cf); + } + + @Override + public int getOpacity() { + return PixelFormat.TRANSLUCENT; + } + + private void resetAnimation() { + mLastUpdateTime = SystemClock.uptimeMillis(); + mLastProgressStateTime = mLastUpdateTime; + mStartAngle = mInitialAngle; + mStrokeColorIndex = 0; + mSweepAngle = mReverse ? -mMinSweepAngle : mMinSweepAngle; + } + + @Override + public void start() { + start(mInAnimationDuration > 0); + } + + @Override + public void stop() { + stop(mOutAnimationDuration > 0); + } + + private void start(boolean withAnimation) { + if (isRunning()) { + return; + } + + resetAnimation(); + + if (withAnimation) { + mRunState = RUN_STATE_STARTING; + mLastRunStateTime = SystemClock.uptimeMillis(); + mProgressState = PROGRESS_STATE_HIDE; + } + + scheduleSelf(mUpdater, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION); + invalidateSelf(); + } + + private void stop(boolean withAnimation) { + if (!isRunning()) { + return; + } + + if (withAnimation) { + mLastRunStateTime = SystemClock.uptimeMillis(); + if (mRunState == RUN_STATE_STARTED) { + scheduleSelf(mUpdater, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION); + invalidateSelf(); + } + mRunState = RUN_STATE_STOPPING; + } else { + mRunState = RUN_STATE_STOPPED; + unscheduleSelf(mUpdater); + invalidateSelf(); + } + } + + @Override + public boolean isRunning() { + return mRunState != RUN_STATE_STOPPED; + } + + @Override + public void scheduleSelf(Runnable what, long when) { + if (mRunState == RUN_STATE_STOPPED) { + mRunState = mInAnimationDuration > 0 ? RUN_STATE_STARTING : RUN_STATE_RUNNING; + } + super.scheduleSelf(what, when); + } + + private final Runnable mUpdater = new Runnable() { + + @Override + public void run() { + update(); + } + + }; + + private void update() { + switch (mProgressMode) { + case ProgressView.MODE_DETERMINATE: + updateDeterminate(); + break; + case ProgressView.MODE_INDETERMINATE: + updateIndeterminate(); + break; + } + } + + private void updateDeterminate() { + long curTime = SystemClock.uptimeMillis(); + float rotateOffset = (curTime - mLastUpdateTime) * 360f / mRotateDuration; + if (mReverse) { + rotateOffset = -rotateOffset; + } + mLastUpdateTime = curTime; + + mStartAngle += rotateOffset; + + if (mRunState == RUN_STATE_STARTING) { + if (curTime - mLastRunStateTime > mInAnimationDuration) { + mRunState = RUN_STATE_RUNNING; + } + } else if (mRunState == RUN_STATE_STOPPING) { + if (curTime - mLastRunStateTime > mOutAnimationDuration) { + stop(false); + return; + } + } + + if (isRunning()) { + scheduleSelf(mUpdater, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION); + } + + invalidateSelf(); + } + + private void updateIndeterminate() { + //update animation + long curTime = SystemClock.uptimeMillis(); + float rotateOffset = (curTime - mLastUpdateTime) * 360f / mRotateDuration; + if (mReverse) { + rotateOffset = -rotateOffset; + } + mLastUpdateTime = curTime; + + switch (mProgressState) { + case PROGRESS_STATE_STRETCH: + if (mTransformDuration <= 0) { + mSweepAngle = mReverse ? -mMinSweepAngle : mMinSweepAngle; + mProgressState = PROGRESS_STATE_KEEP_STRETCH; + mStartAngle += rotateOffset; + mLastProgressStateTime = curTime; + } else { + float value = (curTime - mLastProgressStateTime) / (float) mTransformDuration; + float maxAngle = mReverse ? -mMaxSweepAngle : mMaxSweepAngle; + float minAngle = mReverse ? -mMinSweepAngle : mMinSweepAngle; + + mStartAngle += rotateOffset; + mSweepAngle = mTransformInterpolator.getInterpolation(value) * (maxAngle - minAngle) + minAngle; + + if (value > 1f) { + mSweepAngle = maxAngle; + mProgressState = PROGRESS_STATE_KEEP_STRETCH; + mLastProgressStateTime = curTime; + } + } + break; + case PROGRESS_STATE_KEEP_STRETCH: + mStartAngle += rotateOffset; + + if (curTime - mLastProgressStateTime > mKeepDuration) { + mProgressState = PROGRESS_STATE_SHRINK; + mLastProgressStateTime = curTime; + } + break; + case PROGRESS_STATE_SHRINK: + if (mTransformDuration <= 0) { + mSweepAngle = mReverse ? -mMinSweepAngle : mMinSweepAngle; + mProgressState = PROGRESS_STATE_KEEP_SHRINK; + mStartAngle += rotateOffset; + mLastProgressStateTime = curTime; + mStrokeColorIndex = (mStrokeColorIndex + 1) % mStrokeColors.length; + } else { + float value = (curTime - mLastProgressStateTime) / (float) mTransformDuration; + float maxAngle = mReverse ? -mMaxSweepAngle : mMaxSweepAngle; + float minAngle = mReverse ? -mMinSweepAngle : mMinSweepAngle; + + float newSweepAngle = (1f - mTransformInterpolator.getInterpolation(value)) * (maxAngle - minAngle) + minAngle; + mStartAngle += rotateOffset + mSweepAngle - newSweepAngle; + mSweepAngle = newSweepAngle; + + if (value > 1f) { + mSweepAngle = minAngle; + mProgressState = PROGRESS_STATE_KEEP_SHRINK; + mLastProgressStateTime = curTime; + mStrokeColorIndex = (mStrokeColorIndex + 1) % mStrokeColors.length; + } + } + break; + case PROGRESS_STATE_KEEP_SHRINK: + mStartAngle += rotateOffset; + + if (curTime - mLastProgressStateTime > mKeepDuration) { + mProgressState = PROGRESS_STATE_STRETCH; + mLastProgressStateTime = curTime; + } + break; + } + + if (mRunState == RUN_STATE_STARTING) { + if (curTime - mLastRunStateTime > mInAnimationDuration) { + mRunState = RUN_STATE_RUNNING; + if (mProgressState == PROGRESS_STATE_HIDE) { + resetAnimation(); + mProgressState = PROGRESS_STATE_STRETCH; + } + } + } else if (mRunState == RUN_STATE_STOPPING) { + if (curTime - mLastRunStateTime > mOutAnimationDuration) { + stop(false); + return; + } + } + + if (isRunning()) { + scheduleSelf(mUpdater, SystemClock.uptimeMillis() + ViewUtil.FRAME_DURATION); + } + + invalidateSelf(); + } + + public static class Builder { + private int mPadding; + private float mInitialAngle; + private float mMaxSweepAngle; + private float mMinSweepAngle; + private int mStrokeSize; + private int[] mStrokeColors; + private boolean mReverse; + private int mRotateDuration; + private int mTransformDuration; + private int mKeepDuration; + private Interpolator mTransformInterpolator; + private int mProgressMode; + private float mInStepPercent; + private int[] mInColors; + private int mInAnimationDuration; + private int mOutAnimationDuration; + + public Builder(Context context, int defStyleRes) { + this(context, null, 0, defStyleRes); + } + + public Builder(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircularProgressDrawable, defStyleAttr, defStyleRes); + int resId; + + padding(a.getDimensionPixelSize(R.styleable.CircularProgressDrawable_cpd_padding, 0)); + initialAngle(a.getInteger(R.styleable.CircularProgressDrawable_cpd_initialAngle, 0)); + maxSweepAngle(a.getInteger(R.styleable.CircularProgressDrawable_cpd_maxSweepAngle, 270)); + minSweepAngle(a.getInteger(R.styleable.CircularProgressDrawable_cpd_minSweepAngle, 1)); + strokeSize(a.getDimensionPixelSize(R.styleable.CircularProgressDrawable_cpd_strokeSize, ThemeUtil.dpToPx(context, 4))); + strokeColors(a.getColor(R.styleable.CircularProgressDrawable_cpd_strokeColor, ThemeUtil.colorPrimary(context, 0xFF000000))); + if ((resId = a.getResourceId(R.styleable.CircularProgressDrawable_cpd_strokeColors, 0)) != 0) { + TypedArray ta = context.getResources().obtainTypedArray(resId); + int[] colors = new int[ta.length()]; + for (int j = 0; j < ta.length(); j++) { + colors[j] = ta.getColor(j, 0); + } + ta.recycle(); + strokeColors(colors); + } + reverse(a.getBoolean(R.styleable.CircularProgressDrawable_cpd_reverse, false)); + rotateDuration(a.getInteger(R.styleable.CircularProgressDrawable_cpd_rotateDuration, context.getResources().getInteger(android.R.integer.config_longAnimTime))); + transformDuration(a.getInteger(R.styleable.CircularProgressDrawable_cpd_transformDuration, context.getResources().getInteger(android.R.integer.config_mediumAnimTime))); + keepDuration(a.getInteger(R.styleable.CircularProgressDrawable_cpd_keepDuration, context.getResources().getInteger(android.R.integer.config_shortAnimTime))); + if ((resId = a.getResourceId(R.styleable.CircularProgressDrawable_cpd_transformInterpolator, 0)) != 0) { + transformInterpolator(AnimationUtils.loadInterpolator(context, resId)); + } + progressMode(a.getInteger(R.styleable.CircularProgressDrawable_pv_progressMode, ProgressView.MODE_INDETERMINATE)); + inAnimDuration(a.getInteger(R.styleable.CircularProgressDrawable_cpd_inAnimDuration, context.getResources().getInteger(android.R.integer.config_mediumAnimTime))); + if ((resId = a.getResourceId(R.styleable.CircularProgressDrawable_cpd_inStepColors, 0)) != 0) { + TypedArray ta = context.getResources().obtainTypedArray(resId); + int[] colors = new int[ta.length()]; + for (int j = 0; j < ta.length(); j++) { + colors[j] = ta.getColor(j, 0); + } + ta.recycle(); + inStepColors(colors); + } + inStepPercent(a.getFloat(R.styleable.CircularProgressDrawable_cpd_inStepPercent, 0.5f)); + outAnimDuration(a.getInteger(R.styleable.CircularProgressDrawable_cpd_outAnimDuration, context.getResources().getInteger(android.R.integer.config_mediumAnimTime))); + a.recycle(); + } + + public CircularProgressDrawable build() { + if (mStrokeColors == null) { + mStrokeColors = new int[]{0xFF0099FF}; + } + + if (mInColors == null && mInAnimationDuration > 0) { + mInColors = new int[]{0xFFB5D4FF, 0xFFDEEAFC, 0xFFFAFFFE}; + } + + if (mTransformInterpolator == null) { + mTransformInterpolator = new DecelerateInterpolator(); + } + + return new CircularProgressDrawable(mPadding, mInitialAngle, mMaxSweepAngle, mMinSweepAngle, mStrokeSize, + mStrokeColors, mReverse, mRotateDuration, mTransformDuration, mKeepDuration, + mTransformInterpolator, mProgressMode, mInAnimationDuration, mInStepPercent, mInColors, mOutAnimationDuration); + } + + public Builder padding(int padding) { + mPadding = padding; + return this; + } + + public Builder initialAngle(float angle) { + mInitialAngle = angle; + return this; + } + + public Builder maxSweepAngle(float angle) { + mMaxSweepAngle = angle; + return this; + } + + public Builder minSweepAngle(float angle) { + mMinSweepAngle = angle; + return this; + } + + public Builder strokeSize(int strokeSize) { + mStrokeSize = strokeSize; + return this; + } + + public Builder strokeColors(int... strokeColors) { + mStrokeColors = strokeColors; + return this; + } + + public Builder reverse(boolean reverse) { + mReverse = reverse; + return this; + } + + public Builder rotateDuration(int duration) { + mRotateDuration = duration; + return this; + } + + public Builder transformDuration(int duration) { + mTransformDuration = duration; + return this; + } + + public Builder keepDuration(int duration) { + mKeepDuration = duration; + return this; + } + + public Builder transformInterpolator(Interpolator interpolator) { + mTransformInterpolator = interpolator; + return this; + } + + public Builder progressMode(int mode) { + mProgressMode = mode; + return this; + } + + public Builder inAnimDuration(int duration) { + mInAnimationDuration = duration; + return this; + } + + public Builder inStepPercent(float percent) { + mInStepPercent = percent; + return this; + } + + public Builder inStepColors(int... colors) { + mInColors = colors; + return this; + } + + public Builder outAnimDuration(int duration) { + mOutAnimationDuration = duration; + return this; + } + + } + } + + static class ViewUtil { + + public static final long FRAME_DURATION = 1000 / 60; + + public static void setBackground(View v, Drawable drawable) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + v.setBackground(drawable); + } else { + v.setBackgroundDrawable(drawable); + } + } + + } + + static class ColorUtil { + + private static int getMiddleValue(int prev, int next, float factor) { + return Math.round(prev + (next - prev) * factor); + } + + public static int getMiddleColor(int prevColor, int curColor, float factor) { + if (prevColor == curColor) { + return curColor; + } + + if (factor == 0f) { + return prevColor; + } else if (factor == 1f) { + return curColor; + } + + int a = getMiddleValue(Color.alpha(prevColor), Color.alpha(curColor), factor); + int r = getMiddleValue(Color.red(prevColor), Color.red(curColor), factor); + int g = getMiddleValue(Color.green(prevColor), Color.green(curColor), factor); + int b = getMiddleValue(Color.blue(prevColor), Color.blue(curColor), factor); + + return Color.argb(a, r, g, b); + } + } + + static class ThemeUtil { + + private static TypedValue value; + + public static int dpToPx(Context context, int dp) { + return (int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.getResources().getDisplayMetrics()) + 0.5f); + } + + + private static int getColor(Context context, int id, int defaultValue) { + if (value == null) { + value = new TypedValue(); + } + + try { + Resources.Theme theme = context.getTheme(); + if (theme != null && theme.resolveAttribute(id, value, true)) { + if (value.type >= TypedValue.TYPE_FIRST_INT && value.type <= TypedValue.TYPE_LAST_INT) { + return value.data; + } else if (value.type == TypedValue.TYPE_STRING) { + return context.getResources().getColor(value.resourceId); + } + } + } catch (Exception ex) { + + } + + return defaultValue; + } + + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + public static int colorPrimary(Context context, int defaultValue) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + return getColor(context, android.R.attr.colorPrimary, defaultValue); + } + + return getColor(context, R.attr.colorPrimary, defaultValue); + } + + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/TextInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/TextInfo.kt new file mode 100644 index 0000000000..b660af6930 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/TextInfo.kt @@ -0,0 +1,32 @@ +package com.zhidaoauto.map.sdk.open.dialog + +class TextInfo { + var fontSize = -1 //字号大小,值为-1时使用默认样式,单位:dp + private set + var gravity = -1 //对齐方式,值为-1时使用默认样式,取值可使用Gravity.CENTER等对齐方式 + private set + var fontColor = 1 //文字颜色,值为1时使用默认样式,取值可以用Color.rgb(r,g,b)等方式获取 + private set + var isBold = false //是否粗体 + private set + + fun setFontSize(fontSize: Int): TextInfo { + this.fontSize = fontSize + return this + } + + fun setGravity(gravity: Int): TextInfo { + this.gravity = gravity + return this + } + + fun setFontColor(fontColor: Int): TextInfo { + this.fontColor = fontColor + return this + } + + fun setBold(bold: Boolean): TextInfo { + isBold = bold + return this + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/TipDialog.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/TipDialog.kt new file mode 100644 index 0000000000..cd7536ae1c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/TipDialog.kt @@ -0,0 +1,252 @@ +package com.zhidaoauto.map.sdk.open.dialog + +import android.app.Activity +import android.app.AlertDialog +import android.content.Context +import android.graphics.Bitmap +import android.graphics.Color +import android.graphics.Typeface +import android.graphics.drawable.Drawable +import android.util.TypedValue +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.ImageView +import android.widget.RelativeLayout +import android.widget.TextView +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.open.dialog.DialogSettings.THEME_LIGHT +import com.zhidaoauto.map.sdk.open.dialog.DialogSettings.blur_alpha +import com.zhidaoauto.map.sdk.open.dialog.DialogSettings.tip_theme +import java.util.Timer +import java.util.TimerTask + +class TipDialog private constructor() : BaseDialog() { + var alertDialog: AlertDialog? = null + private set + private var tipDialog: TipDialog? = null + private var customDrawable: Drawable? = null + private var customBitmap: Bitmap? = null + private var isCanCancel = false + private var customTextInfo: TextInfo? = null + private var context: Context? = null + private var tip: String? = null + private var howLong = 0 + private var type = 0 + private var boxInfo: RelativeLayout? = null + private var boxBkg: RelativeLayout? = null + private var image: ImageView? = null + private var txtInfo: TextView? = null + private var blur: BlurView? = null + private var blur_front_color = 0 + private var font_color = 0 + private var mDialogHelper: DialogHelper? = null + override fun showDialog() { + if (customTextInfo == null) { + customTextInfo = TextInfo() + } + val builder: AlertDialog.Builder + log("显示提示对话框 -> $tip") + dialogList.add(tipDialog!!) + val bkgResId: Int + when (tip_theme) { + THEME_LIGHT -> { + builder = AlertDialog.Builder(context, R.style.lightMode) + bkgResId = R.drawable.rect_light + blur_front_color = Color.argb(blur_alpha - 50, 255, 255, 255) + font_color = Color.rgb(0, 0, 0) + } + else -> { + builder = AlertDialog.Builder(context!!, R.style.darkMode) + bkgResId = R.drawable.rect_dark + blur_front_color = Color.argb(blur_alpha, 0, 0, 0) + font_color = Color.rgb(255, 255, 255) + } + } + alertDialog = builder.create() + getDialogLifeCycleListener().onCreate(alertDialog) + if (isCanCancel) alertDialog?.setCanceledOnTouchOutside(true) + val fragmentManager = (context as Activity?)?.fragmentManager + mDialogHelper = DialogHelper().setAlertDialog(alertDialog, object : OnDismissListener { + override fun onDismiss() { + dialogList.remove(tipDialog!!) + if (boxBkg != null) boxBkg!!.removeAllViews() + getDialogLifeCycleListener().onDismiss() + onDismissListener!!.onDismiss() + } + }) + val rootView = LayoutInflater.from(context).inflate(R.layout.dialog_tip, null) + alertDialog?.setView(rootView) + boxInfo = rootView.findViewById(R.id.box_info) + boxBkg = rootView.findViewById(R.id.box_bkg) + image = rootView.findViewById(R.id.image) + txtInfo = rootView.findViewById(R.id.txt_info) + txtInfo?.setTextColor(font_color) + if (true) { + blur = BlurView(context, null) + boxBkg?.post(Runnable { + val params = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) + blur?.layoutParams = params + blur?.setOverlayColor(blur_front_color) + boxBkg?.addView(blur, 0, params) + }) + boxBkg?.getViewTreeObserver()?.addOnGlobalLayoutListener { + val boxBkgLayoutParams = boxBkg?.getLayoutParams() + boxBkgLayoutParams?.width = boxInfo?.getWidth() + boxBkgLayoutParams?.height = boxInfo?.getHeight() + boxBkg?.setLayoutParams(boxBkgLayoutParams) + } + } else { + boxInfo?.setBackgroundResource(bkgResId) + } + when (type) { + TYPE_WARNING -> if (tip_theme === THEME_LIGHT) { + image?.setImageResource(R.mipmap.img_warning_dark) + } else { + image?.setImageResource(R.mipmap.img_warning) + } + TYPE_ERROR -> if (tip_theme === THEME_LIGHT) { + image?.setImageResource(R.mipmap.img_error_dark) + } else { + image?.setImageResource(R.mipmap.img_error) + } + TYPE_FINISH -> if (tip_theme === THEME_LIGHT) { + image?.setImageResource(R.mipmap.img_finish_dark) + } else { + image?.setImageResource(R.mipmap.img_finish) + } + TYPE_CUSTOM_BITMAP -> image?.setImageBitmap(customBitmap) + TYPE_CUSTOM_DRAWABLE -> image?.setImageDrawable(customDrawable) + } + if (!tip!!.isEmpty()) { + boxInfo?.setVisibility(View.VISIBLE) + txtInfo?.setText(tip) + } else { + boxInfo?.setVisibility(View.GONE) + } + if (customTextInfo!!.fontSize > 0) { + txtInfo?.setTextSize(TypedValue.COMPLEX_UNIT_DIP, customTextInfo!!.fontSize.toFloat()) + } + if (customTextInfo!!.fontColor != 1) { + txtInfo?.setTextColor(customTextInfo!!.fontColor) + } + if (customTextInfo!!.gravity != -1) { + txtInfo?.setGravity(customTextInfo!!.gravity) + } + val font = Typeface.create(Typeface.SANS_SERIF, if (customTextInfo!!.isBold) Typeface.BOLD else Typeface.NORMAL) + txtInfo?.setTypeface(font) + getDialogLifeCycleListener().onShow(alertDialog) + var time = 1500 + when (howLong) { + SHOW_TIME_SHORT -> time = 1500 + SHOW_TIME_LONG -> time = 3000 + } + Timer().schedule(object : TimerTask() { + override fun run() { + if (mDialogHelper != null) mDialogHelper!!.dismissAllowingStateLoss() + } + }, time.toLong()) + mDialogHelper?.show(fragmentManager!!, "customDialog") + mDialogHelper?.isCancelable = isCanCancel + } + + override fun doDismiss() { + if (mDialogHelper != null) mDialogHelper!!.dismissAllowingStateLoss() + } + + fun setCanCancel(canCancel: Boolean): TipDialog { + isCanCancel = canCancel + if (mDialogHelper != null) mDialogHelper!!.isCancelable = canCancel + return this + } + + fun setTxtInfo(txtInfo: TextView?): TipDialog { + this.txtInfo = txtInfo + return this + } + + companion object { + const val SHOW_TIME_SHORT = 0 + const val SHOW_TIME_LONG = 1 + const val TYPE_CUSTOM_DRAWABLE = -2 + const val TYPE_CUSTOM_BITMAP = -1 + const val TYPE_WARNING = 0 + const val TYPE_ERROR = 1 + const val TYPE_FINISH = 2 + + //Fast Function + fun show(context: Context?, tip: String): TipDialog { + val tipDialog = build(context, tip, SHOW_TIME_SHORT, TYPE_WARNING) + tipDialog.showDialog() + return tipDialog + } + + fun show(context: Context?, tip: String, type: Int): TipDialog { + val tipDialog = build(context, tip, SHOW_TIME_SHORT, type) + tipDialog.showDialog() + return tipDialog + } + + fun show(context: Context?, tip: String, howLong: Int, type: Int): TipDialog { + val tipDialog = build(context, tip, howLong, type) + tipDialog.showDialog() + return tipDialog + } + + fun build(context: Context?, tip: String, howLong: Int, type: Int): TipDialog { + synchronized(TipDialog::class.java) { + val tipDialog = TipDialog() + tipDialog.cleanDialogLifeCycleListener() + tipDialog.context = context + tipDialog.tip = tip + tipDialog.howLong = howLong + tipDialog.type = type + tipDialog.log("装载提示对话框 -> $tip") + tipDialog.tipDialog = tipDialog + return tipDialog + } + } + + fun show(context: Context?, tip: String, howLong: Int, customDrawable: Drawable?): TipDialog { + val tipDialog = build(context, tip, howLong, customDrawable) + tipDialog.showDialog() + return tipDialog + } + + fun build(context: Context?, tip: String, howLong: Int, customDrawable: Drawable?): TipDialog { + synchronized(TipDialog::class.java) { + val tipDialog = TipDialog() + tipDialog.cleanDialogLifeCycleListener() + tipDialog.context = context + tipDialog.tip = tip + tipDialog.customDrawable = customDrawable + tipDialog.howLong = howLong + tipDialog.type = TYPE_CUSTOM_DRAWABLE + tipDialog.log("装载提示对话框 -> $tip") + tipDialog.tipDialog = tipDialog + return tipDialog + } + } + + fun show(context: Context?, tip: String, howLong: Int, customBitmap: Bitmap?): TipDialog { + val tipDialog = build(context, tip, howLong, customBitmap) + tipDialog.showDialog() + return tipDialog + } + + fun build(context: Context?, tip: String, howLong: Int, customBitmap: Bitmap?): TipDialog { + synchronized(TipDialog::class.java) { + val tipDialog = TipDialog() + tipDialog.cleanDialogLifeCycleListener() + tipDialog.context = context + tipDialog.tip = tip + tipDialog.customBitmap = customBitmap + tipDialog.howLong = howLong + tipDialog.type = TYPE_CUSTOM_BITMAP + tipDialog.log("装载提示对话框 -> $tip") + tipDialog.tipDialog = tipDialog + return tipDialog + } + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/WaitDialog.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/WaitDialog.kt new file mode 100644 index 0000000000..3e78e69df5 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/dialog/WaitDialog.kt @@ -0,0 +1,224 @@ +package com.zhidaoauto.map.sdk.open.dialog + +import android.app.Activity +import android.app.AlertDialog +import android.content.Context +import android.content.DialogInterface +import android.graphics.Color +import android.graphics.Typeface +import android.util.TypedValue +import android.view.KeyEvent +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.RelativeLayout +import android.widget.TextView +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.open.dialog.DialogSettings.THEME_LIGHT +import com.zhidaoauto.map.sdk.open.dialog.DialogSettings.tip_theme + +class WaitDialog private constructor() : BaseDialog() { + private var onBackPressListener: OnBackPressListener? = null + + var use_blur = false + var alertDialog: AlertDialog? = null + private set + private var waitDialog: WaitDialog? = null + private var customView: View? = null + private var customTextInfo: TextInfo? = null + private var context: Context? = null + private var tip: String? = null + private var blur_front_color = 0 + private var font_color = 0 + private var boxInfo: RelativeLayout? = null + private var boxBkg: RelativeLayout? = null + private var boxProgress: RelativeLayout? = null + private var progress: ProgressView? = null + private var txtInfo: TextView? = null + private var mDialogHelper: DialogHelper? = null + private var blur: BlurView? = null + + override fun showDialog() { + if (customTextInfo == null) { + customTextInfo = TextInfo() + } + dialogList.add(waitDialog!!) + log("显示等待对话框 -> $tip") + val builder: AlertDialog.Builder + val bkgResId: Int + when (DialogSettings.tip_theme) { + THEME_LIGHT -> { + builder = AlertDialog.Builder(context, R.style.lightMode) + bkgResId = R.drawable.rect_light + blur_front_color = Color.argb(DialogSettings.blur_alpha - 50, 255, 255, 255) + font_color = Color.rgb(0, 0, 0) + } + else -> { + builder = AlertDialog.Builder(context, R.style.darkMode) + bkgResId = R.drawable.rect_dark + blur_front_color = Color.argb(DialogSettings.blur_alpha, 0, 0, 0) + font_color = Color.rgb(255, 255, 255) + } + } + alertDialog = builder.create() + getDialogLifeCycleListener().onCreate(alertDialog) + if (isCanCancel) { + alertDialog?.setCanceledOnTouchOutside(true) + } + val fragmentManager = (context as Activity?)!!.fragmentManager + mDialogHelper = DialogHelper().setAlertDialog(alertDialog, object : OnDismissListener { + override fun onDismiss() { + dialogList.remove(waitDialog!!) + if (boxProgress != null) { + boxProgress!!.removeAllViews() + } + if (boxBkg != null) { + boxBkg!!.removeAllViews() + } + getDialogLifeCycleListener().onDismiss() + alertDialog = null + onDismissListener!!.onDismiss() + } + }) + val rootView = LayoutInflater.from(context).inflate(R.layout.dialog_wait, null) + alertDialog?.setView(rootView) + boxInfo = rootView.findViewById(R.id.box_info) + boxBkg = rootView.findViewById(R.id.box_bkg) + boxProgress = rootView.findViewById(R.id.box_progress) + progress = rootView.findViewById(R.id.progress) + txtInfo = rootView.findViewById(R.id.txt_info) + txtInfo?.setTextColor(font_color) + if (customView != null) { + progress?.setVisibility(View.GONE) + boxProgress?.removeAllViews() + boxProgress?.addView(customView) + } + if (tip_theme === THEME_LIGHT) { + progress?.setStrokeColors(intArrayOf(Color.rgb(0, 0, 0))) + } else { + progress?.setStrokeColors(intArrayOf(Color.rgb(255, 255, 255))) + } + if (use_blur) { + blur = BlurView(context, null) + boxBkg?.post(Runnable { + val params = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT) + blur!!.layoutParams = params + blur!!.setOverlayColor(blur_front_color) + boxBkg?.addView(blur, 0, params) + }) + boxBkg?.getViewTreeObserver()?.addOnGlobalLayoutListener { + val boxBkgLayoutParams = boxBkg?.getLayoutParams() + boxBkgLayoutParams?.width = boxInfo?.getWidth() + boxBkgLayoutParams?.height = boxInfo?.getHeight() + boxBkg?.setLayoutParams(boxBkgLayoutParams) + } + } else { + boxBkg?.setBackgroundResource(bkgResId) + } + if (tip != null && !tip!!.isEmpty()) { + txtInfo?.setVisibility(View.VISIBLE) + txtInfo?.setText(tip) + } else { + txtInfo?.setVisibility(View.GONE) + val lp = boxProgress?.getLayoutParams() as RelativeLayout.LayoutParams + lp.setMargins(0, 0, 0, 0) + lp.addRule(RelativeLayout.CENTER_IN_PARENT) + boxProgress?.setLayoutParams(lp) + } + if (customTextInfo!!.fontSize > 0) { + txtInfo?.setTextSize(TypedValue.COMPLEX_UNIT_DIP, customTextInfo!!.fontSize.toFloat()) + } + if (customTextInfo!!.fontColor != 1) { + txtInfo?.setTextColor(customTextInfo!!.fontColor) + } + if (customTextInfo!!.gravity != -1) { + txtInfo?.setGravity(customTextInfo!!.gravity) + } + val font = Typeface.create(Typeface.SANS_SERIF, if (customTextInfo!!.isBold) Typeface.BOLD else Typeface.NORMAL) + txtInfo?.setTypeface(font) + alertDialog?.setOnKeyListener(DialogInterface.OnKeyListener { dialog, keyCode, event -> + if (event.action == KeyEvent.ACTION_UP) { + if (keyCode == KeyEvent.KEYCODE_BACK) { + if (onBackPressListener != null) { + onBackPressListener!!.OnBackPress(alertDialog) + return@OnKeyListener true + } + } + } + false + }) + getDialogLifeCycleListener().onShow(alertDialog) + mDialogHelper!!.show(fragmentManager, "kongzueDialog") + mDialogHelper!!.isCancelable = isCanCancel + } + + override fun doDismiss() { + if (mDialogHelper != null) { + mDialogHelper!!.dismissAllowingStateLoss() + } + } + + fun setCanCancel(canCancel: Boolean): WaitDialog { + if (mDialogHelper != null) { + mDialogHelper!!.isCancelable = canCancel + } + return this + } + + fun setOnBackPressListener(onBackPressListener: OnBackPressListener?): WaitDialog { + this.onBackPressListener = onBackPressListener + return this + } + + fun setText(s: String?) { + if (waitDialog != null && waitDialog!!.txtInfo != null) { + waitDialog!!.txtInfo!!.text = s + } + } + + companion object { + private var isCanCancel = false + fun show(context: Context?, tip: String, lifeCycleListener: DialogLifeCycleListener?): WaitDialog { + return show(context, tip, null, null, lifeCycleListener) + } + + fun show(context: Context?, tip: String, customView: View?, lifeCycleListener: DialogLifeCycleListener?): WaitDialog { + return show(context, tip, customView, null, lifeCycleListener) + } + + fun show(context: Context?, tip: String, textInfo: TextInfo?): WaitDialog { + return show(context, tip, null, textInfo, null) + } + + fun show(context: Context?, tip: String, textInfo: TextInfo?, lifeCycleListener: DialogLifeCycleListener?): WaitDialog { + return show(context, tip, null, textInfo, lifeCycleListener) + } + + @JvmOverloads + fun show(context: Context?, tip: String, customView: View? = null, textInfo: TextInfo? = null, lifeCycleListener: DialogLifeCycleListener? = null): WaitDialog { + synchronized(WaitDialog::class.java) { + val waitDialog = WaitDialog() + waitDialog.cleanDialogLifeCycleListener() + waitDialog.context = context + waitDialog.tip = tip + waitDialog.log("装载等待对话框 -> $tip") + waitDialog.waitDialog = waitDialog + waitDialog.customView = customView + waitDialog.customTextInfo = textInfo + waitDialog.setDialogLifeCycleListener(lifeCycleListener) + waitDialog.showDialog() + return waitDialog + } + } + + fun setCanCancelGlobal(canCancel: Boolean) { + isCanCancel = canCancel + } + + fun dismiss() { + for (dialog in dialogList) { + (dialog as? WaitDialog)?.doDismiss() + } + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/exception/MapException.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/exception/MapException.kt new file mode 100644 index 0000000000..e574d31a05 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/exception/MapException.kt @@ -0,0 +1,264 @@ +package com.zhidaoauto.map.sdk.open.exception + +class MapException : Exception { + var errorLevel = 0 + private set + var errorType: String? = null + private set + var errorMessage = "" + private set + var errorCode = 1000 + private set + + constructor(msg: String) : super(msg) { + errorMessage = msg + errorLevel = 0 + init(msg) + } + + constructor(msg: String, level: Int, type: String?) : super(msg) { + errorMessage = msg + errorLevel = level + errorType = type + init(msg) + } + + constructor(code: Int) { + errorCode = code + initCode(code) + } + + private fun initCode(code: Int) { + if(code == AUTO_INIT_ERROR_LONLATPROXY){ + errorMessage = "未初始化经纬度代理" + } + if(code == AUTO_INIT_ERROR_CAR){ + errorMessage = "车辆未绘制" + + }else if (code == DATA_ERROR){ + errorMessage = "传入的数据有问题" + } + } + + private fun init(msg: String) { + if ("用户签名未通过" == msg) { + errorCode = 1001 + } else if ("用户key不正确或过期" == msg) { + errorCode = 1002 + } else if ("请求服务不存在" == msg) { + errorCode = 1003 + } else if ("访问已超出日访问量" == msg) { + errorCode = 1004 + } else if ("用户访问过于频繁" == msg) { + errorCode = 1005 + } else if ("用户IP无效" == msg) { + errorCode = 1006 + } else if ("用户域名无效" == msg) { + errorCode = 1007 + } else if ("用户MD5安全码未通过" == msg) { + errorCode = 1008 + } else if ("请求key与绑定平台不符" == msg) { + errorCode = 1009 + } else if ("IP访问超限" == msg) { + errorCode = 1010 + } else if ("服务不支持https请求" == msg) { + errorCode = 1011 + } else if ("权限不足,服务请求被拒绝" == msg) { + errorCode = 1012 + } else if ("开发者删除了key,key被删除后无法正常使用" == msg) { + errorCode = 1013 + } else if ("请求服务响应错误" == msg) { + errorCode = 1100 + } else if ("引擎返回数据异常" == msg) { + errorCode = 1101 + } else if ("服务端请求链接超时" == msg) { + errorCode = 1102 + } else if ("读取服务结果超时" == msg) { + errorCode = 1103 + } else if ("请求参数非法" == msg) { + errorCode = 1200 + } else if ("缺少必填参数" == msg) { + errorCode = 1201 + } else if ("请求协议非法" == msg) { + errorCode = 1202 + } else if ("其他未知错误" == msg) { + errorCode = 1203 + } else if ("协议解析错误 - ProtocolException" == msg) { + errorCode = 1801 + } else if ("socket 连接超时 - SocketTimeoutException" == msg) { + errorCode = 1802 + } else if ("url异常 - MalformedURLException" == msg) { + errorCode = 1803 + } else if ("未知主机 - UnKnowHostException" == msg) { + errorCode = 1804 + } else if ("无效的参数 - IllegalArgumentException" == msg) { + errorCode = 1901 + } else if ("http或socket连接失败 - ConnectionException" == msg) { + errorCode = 1806 + } else if ("IO 操作异常 - IOException" == msg) { + errorCode = 1902 + } else if ("空指针异常 - NullPointException" == msg) { + errorCode = 1903 + } else if ("tableID格式不正确不存在" == msg) { + errorCode = 2000 + } else if ("ID不存在" == msg) { + errorCode = 2001 + } else if ("服务器维护中" == msg) { + errorCode = 2002 + } else if ("key对应的tableID不存在" == msg) { + errorCode = 2003 + } else if ("找不到对应的userid信息,请检查您提供的userid是否存在" == msg) { + errorCode = 2100 + } else if ("App key未开通“附近”功能,请注册附近KEY" == msg) { + errorCode = 2101 + } else if ("规划点(包括起点、终点、途经点)不在中国陆地范围内" == msg) { + errorCode = 3000 + } else if ("规划点(起点、终点、途经点)附近搜不到路" == msg) { + errorCode = 3001 + } else if ("MapAutoApi,通常是由于道路连通关系导致" == msg) { + errorCode = 3002 + } else if ("起点终点距离过长" == msg) { + errorCode = 3003 + } else if ("已开启自动上传" == msg) { + errorCode = 2200 + } else if ("USERID非法" == msg) { + errorCode = 2201 + } else if ("NearbyInfo对象为空" == msg) { + errorCode = 2202 + } else if ("两次单次上传的间隔低于7秒" == msg) { + errorCode = 2203 + } else if ("Point为空,或与前次上传的相同" == msg) { + errorCode = 2204 + } else if ("短串分享认证失败" == msg) { + errorCode = 4000 + } else if ("短串请求失败" == msg) { + errorCode = 4001 + } else if ("用户签名未通过" == msg) { + errorCode = 4002 + } else if ("未知错误" == msg) { + errorCode = 1900 + errorType = "CLIENT_UNKNOWN_ERROR" + } else { + errorCode = 1800 + errorType = "AMAP_CLIENT_ERRORCODE_MISSSING" + } + } + + companion object { + const val CODE_AMAP_SUCCESS = 1000 + const val AMAP_SIGNATURE_ERROR = "用户签名未通过" + const val AMAP_INVALID_USER_KEY = "用户key不正确或过期" + const val AMAP_SERVICE_NOT_AVAILBALE = "请求服务不存在" + const val AMAP_DAILY_QUERY_OVER_LIMIT = "访问已超出日访问量" + const val AMAP_ACCESS_TOO_FREQUENT = "用户访问过于频繁" + const val AMAP_INVALID_USER_IP = "用户IP无效" + const val AMAP_INVALID_USER_DOMAIN = "用户域名无效" + const val AMAP_INVALID_USER_SCODE = "用户MD5安全码未通过" + const val AMAP_USERKEY_PLAT_NOMATCH = "请求key与绑定平台不符" + const val AMAP_IP_QUERY_OVER_LIMIT = "IP访问超限" + const val AMAP_NOT_SUPPORT_HTTPS = "服务不支持https请求" + const val AMAP_INSUFFICIENT_PRIVILEGES = "权限不足,服务请求被拒绝" + const val AMAP_USER_KEY_RECYCLED = "开发者删除了key,key被删除后无法正常使用" + const val AMAP_ENGINE_RESPONSE_ERROR = "请求服务响应错误" + const val AMAP_ENGINE_RESPONSE_DATA_ERROR = "引擎返回数据异常" + const val AMAP_ENGINE_CONNECT_TIMEOUT = "服务端请求链接超时" + const val AMAP_ENGINE_RETURN_TIMEOUT = "读取服务结果超时" + const val AMAP_SERVICE_INVALID_PARAMS = "请求参数非法" + const val AMAP_SERVICE_MISSING_REQUIRED_PARAMS = "缺少必填参数" + const val AMAP_SERVICE_ILLEGAL_REQUEST = "请求协议非法" + const val AMAP_SERVICE_UNKNOWN_ERROR = "其他未知错误" + const val AMAP_CLIENT_ERROR_PROTOCOL = "协议解析错误 - ProtocolException" + const val AMAP_CLIENT_SOCKET_TIMEOUT_EXCEPTION = + "socket 连接超时 - SocketTimeoutException" + const val AMAP_CLIENT_URL_EXCEPTION = "url异常 - MalformedURLException" + const val AMAP_CLIENT_UNKNOWHOST_EXCEPTION = "未知主机 - UnKnowHostException" + const val AMAP_CLIENT_NETWORK_EXCEPTION = "http或socket连接失败 - ConnectionException" + const val AMAP_CLIENT_UNKNOWN_ERROR = "未知错误" + const val AMAP_CLIENT_UNKNOWN_ERROR_TYPE = "CLIENT_UNKNOWN_ERROR" + const val AMAP_CLIENT_INVALID_PARAMETER = "无效的参数 - IllegalArgumentException" + const val AMAP_CLIENT_IO_EXCEPTION = "IO 操作异常 - IOException" + const val AMAP_CLIENT_NULLPOINT_EXCEPTION = "空指针异常 - NullPointException" + const val AMAP_CLIENT_ERRORCODE_MISSSING = "没有对应的错误" + const val AMAP_CLIENT_ERRORCODE_MISSSING_TPPE = "AMAP_CLIENT_ERRORCODE_MISSSING" + const val AMAP_SERVICE_TABLEID_NOT_EXIST = "tableID格式不正确不存在" + const val AMAP_ID_NOT_EXIST = "ID不存在" + const val AMAP_SERVICE_MAINTENANCE = "服务器维护中" + const val AMAP_ENGINE_TABLEID_NOT_EXIST = "key对应的tableID不存在" + const val AMAP_NEARBY_INVALID_USERID = "找不到对应的userid信息,请检查您提供的userid是否存在" + const val AMAP_NEARBY_KEY_NOT_BIND = "App key未开通“附近”功能,请注册附近KEY" + const val AMAP_CLIENT_UPLOADAUTO_STARTED_ERROR = "已开启自动上传" + const val AMAP_CLIENT_USERID_ILLEGAL = "USERID非法" + const val AMAP_CLIENT_NEARBY_NULL_RESULT = "NearbyInfo对象为空" + const val AMAP_CLIENT_UPLOAD_TOO_FREQUENT = "两次单次上传的间隔低于7秒" + const val AMAP_CLIENT_UPLOAD_LOCATION_ERROR = "Point为空,或与前次上传的相同" + const val AMAP_ROUTE_OUT_OF_SERVICE = "规划点(包括起点、终点、途经点)不在中国陆地范围内" + const val AMAP_ROUTE_NO_ROADS_NEARBY = "规划点(起点、终点、途经点)附近搜不到路" + const val AMAP_ROUTE_FAIL = "路线计算失败,通常是由于道路连通关系导致" + const val AMAP_OVER_DIRECTION_RANGE = "起点终点距离过长" + const val AMAP_SHARE_LICENSE_IS_EXPIRED = "短串分享认证失败" + const val AMAP_SHARE_FAILURE = "短串请求失败" + const val AMAP_SHARE_SIGNATURE_FAILURE = "用户签名未通过" + const val CODE_AMAP_SIGNATURE_ERROR = 1001 + const val CODE_AMAP_INVALID_USER_KEY = 1002 + const val CODE_AMAP_SERVICE_NOT_AVAILBALE = 1003 + const val CODE_AMAP_DAILY_QUERY_OVER_LIMIT = 1004 + const val CODE_AMAP_ACCESS_TOO_FREQUENT = 1005 + const val CODE_AMAP_INVALID_USER_IP = 1006 + const val CODE_AMAP_INVALID_USER_DOMAIN = 1007 + const val CODE_AMAP_INVALID_USER_SCODE = 1008 + const val CODE_AMAP_USERKEY_PLAT_NOMATCH = 1009 + const val CODE_AMAP_IP_QUERY_OVER_LIMIT = 1010 + const val CODE_AMAP_NOT_SUPPORT_HTTPS = 1011 + const val CODE_AMAP_INSUFFICIENT_PRIVILEGES = 1012 + const val CODE_AMAP_USER_KEY_RECYCLED = 1013 + const val CODE_AMAP_ENGINE_RESPONSE_ERROR = 1100 + const val CODE_AMAP_ENGINE_RESPONSE_DATA_ERROR = 1101 + const val CODE_AMAP_ENGINE_CONNECT_TIMEOUT = 1102 + const val CODE_AMAP_ENGINE_RETURN_TIMEOUT = 1103 + const val CODE_AMAP_SERVICE_INVALID_PARAMS = 1200 + const val CODE_AMAP_SERVICE_MISSING_REQUIRED_PARAMS = 1201 + const val CODE_AMAP_SERVICE_ILLEGAL_REQUEST = 1202 + const val CODE_AMAP_SERVICE_UNKNOWN_ERROR = 1203 + const val CODE_AMAP_CLIENT_ERRORCODE_MISSSING = 1800 + const val CODE_AMAP_CLIENT_ERROR_PROTOCOL = 1801 + const val CODE_AMAP_CLIENT_SOCKET_TIMEOUT_EXCEPTION = 1802 + const val CODE_AMAP_CLIENT_URL_EXCEPTION = 1803 + const val CODE_AMAP_CLIENT_UNKNOWHOST_EXCEPTION = 1804 + const val CODE_AMAP_CLIENT_NETWORK_EXCEPTION = 1806 + const val CODE_AMAP_CLIENT_UNKNOWN_ERROR = 1900 + const val CODE_AMAP_CLIENT_INVALID_PARAMETER = 1901 + const val CODE_AMAP_CLIENT_IO_EXCEPTION = 1902 + const val CODE_AMAP_CLIENT_NULLPOINT_EXCEPTION = 1903 + const val CODE_AMAP_SERVICE_TABLEID_NOT_EXIST = 2000 + const val CODE_AMAP_ID_NOT_EXIST = 2001 + const val CODE_AMAP_SERVICE_MAINTENANCE = 2002 + const val CODE_AMAP_ENGINE_TABLEID_NOT_EXIST = 2003 + const val CODE_AMAP_NEARBY_INVALID_USERID = 2100 + const val CODE_AMAP_NEARBY_KEY_NOT_BIND = 2101 + const val CODE_AMAP_CLIENT_UPLOADAUTO_STARTED_ERROR = 2200 + const val CODE_AMAP_CLIENT_USERID_ILLEGAL = 2201 + const val CODE_AMAP_CLIENT_NEARBY_NULL_RESULT = 2202 + const val CODE_AMAP_CLIENT_UPLOAD_TOO_FREQUENT = 2203 + const val CODE_AMAP_CLIENT_UPLOAD_LOCATION_ERROR = 2204 + const val CODE_AMAP_ROUTE_OUT_OF_SERVICE = 3000 + const val CODE_AMAP_ROUTE_NO_ROADS_NEARBY = 3001 + const val CODE_AMAP_ROUTE_FAIL = 3002 + const val CODE_AMAP_OVER_DIRECTION_RANGE = 3003 + const val CODE_AMAP_SHARE_LICENSE_IS_EXPIRED = 4000 + const val CODE_AMAP_SHARE_FAILURE = 4001 + const val CODE_AMAP_SHARE_SIGNATURE_FAILURE = 4002 + const val AMAP_ERROR_REST = 2 + const val AMAP_ERROR_CORE = 1 + const val AMAP_ERROR_LOCAL = 0 + const val AMAP_ERROR_LOCAL_STANDARDIZED = 4 + + + //lonLatProxy未初始化 + const val AUTO_INIT_ERROR_LONLATPROXY = 90001 + + //车辆未绘制 + const val AUTO_INIT_ERROR_CAR = 90002 + //数据错误 + const val DATA_ERROR = 90003 + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/exception/NotImplementException.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/exception/NotImplementException.kt new file mode 100644 index 0000000000..56d1693d09 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/exception/NotImplementException.kt @@ -0,0 +1,7 @@ +package com.zhidaoauto.map.sdk.open.exception + +/** + * 当前未实现的异常 + */ +class NotImplementException(detailMessage: String = "该功能还没有实现!") : + RuntimeException(detailMessage) \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/exception/RuntimeRemoteException.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/exception/RuntimeRemoteException.kt new file mode 100644 index 0000000000..ee19db8594 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/exception/RuntimeRemoteException.kt @@ -0,0 +1,5 @@ +package com.zhidaoauto.map.sdk.open.exception + +class RuntimeRemoteException : RuntimeException { + constructor(exception: Throwable) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/LocationClient.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/LocationClient.kt new file mode 100644 index 0000000000..948a99750c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/LocationClient.kt @@ -0,0 +1,632 @@ +package com.zhidaoauto.map.sdk.open.location + +import android.Manifest +import android.content.Context +import android.content.pm.PackageManager +import android.location.Criteria +import android.location.LocationManager +import android.os.Bundle +import android.text.TextUtils +import android.util.Log +import androidx.core.app.ActivityCompat +import com.autonavi.nge.map.LonLat +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +import com.zhidaoauto.map.sdk.inner.utils.Constant +import com.zhidaoauto.map.sdk.inner.utils.GisGeomTool +import com.zhidaoauto.map.sdk.inner.utils.MathUtils +import com.zhidaoauto.map.sdk.open.MapAutoApi +import com.zhidaoauto.map.sdk.open.data.MapDataApi +import com.zhidaoauto.map.sdk.open.data.SinglePointRoadInfo +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.launch +import java.util.concurrent.atomic.AtomicBoolean + + +class LocationClient : android.location.LocationListener { + + private val TAG = javaClass.simpleName + + // 监听事件 + private val listeners = ArrayList() + private val gpsListeners = ArrayList() + var mapLocationListener : LonLatPointListener? = null + var mContext: Context? + var mMapController: IMapController? + var lastKnownMogoLocation: MogoLocation? = null + + var sysTimeAndGpsTimeInterval:Long = 0L; + //定位间隔 + var mIntervalMinLocation = 100L + + //定位最小距离 + var mIntervalDistance = 0.0f + + // GPS是否优先 + var mGPSFirst = true + + // 定位精度 + var mCriteria = Criteria.ACCURACY_HIGH + + var isDebug = false + + var isRecorderTrack:Boolean = false + + + // + private var mLocationManager: LocationManager? = null + + // 是否用外部数据 + private var mIsUseExtraGPSData: AtomicBoolean = AtomicBoolean(false) + + + // 是否已开始系统定位 + private var isNativeStarted : AtomicBoolean = AtomicBoolean(false) + + //高精道路数据 + private var mSinglePointRoadInfo: SinglePointRoadInfo? = null + + //道路段数 + private var nSegmentOrder: Int = 1 + + //上一次使用的角度 + private var mLastHeading: Float = 400f + + //是否需要匹配道路 + private var isMatchRoad = false + + //是否过滤停车点 + private var isFilterSpeed = true + + //是否高精定位 + private var isRTK = true + + //是否移远RTK高精定位 + private var isYiYuanRTK = false + + //是否输出位置 + private var isOutputLocation = false + + private var mLastLocationTime = 0L + private var mLastEqualLocationTime = 0L + //如果两次坐标以及角度相同 则不会分发 + private var lastLonLatPoint: LonLatPoint? = null + //过滤点数 + private var stepMax: Int = 1 + private var lastUseLocation: MogoLocation? = null + private var lastAlocation: android.location.Location? = null + private var lastRtkAutopilotLocationBean: RTKAutopilotLocationBean? = null + private var historyLocationList: ArrayList? = null + private var historyAngleList: ArrayList? = null + private var tempAngleList: ArrayList? = null + + + private var mLocationJob:Job? = null + + + constructor(context: Context,mapController: IMapController?) { + mContext = context + mMapController = mapController + } + + fun matchRoadEnable(enable: Boolean) { + isMatchRoad = enable + } + + fun rtkEnable(enable: Boolean) { + isRTK = enable + } + + fun outputLocationEnable(enable: Boolean) { + isOutputLocation = enable + } + + fun stepMax(max: Int) { + stepMax = max + } + + fun isUseExtraGPSData(): Boolean { + return mIsUseExtraGPSData.get() + } + + fun start() { + if (mIsUseExtraGPSData.get()) { + return + } + isNativeStarted.set(true) + mLocationManager = mContext?.getSystemService(Context.LOCATION_SERVICE) as LocationManager + mContext?.let { + if (ActivityCompat.checkSelfPermission( + it, + Manifest.permission.ACCESS_FINE_LOCATION + ) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission( + it, + Manifest.permission.ACCESS_COARSE_LOCATION + ) != PackageManager.PERMISSION_GRANTED + ) { + // TODO: Consider calling + // ActivityCompat#requestPermissions + // here to request the missing permissions, and then overriding + // public void onRequestPermissionsResult(int requestCode, String[] permissions, + // int[] grantResults) + // to handle the case where the user grants the permission. See the documentation + // for ActivityCompat#requestPermissions for more details. + return + } + } + Log.i(TAG, "start: ${mLocationManager?.isProviderEnabled(LocationManager.GPS_PROVIDER)}") + if(mLocationManager?.isProviderEnabled(LocationManager.GPS_PROVIDER) == true) { + mLocationManager?.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0f, this) + } + } + + fun stop() { + isNativeStarted.set(false) + if(!mIsUseExtraGPSData.get()){ + listeners.clear() + } + mLocationManager?.removeUpdates(this) + mLocationManager = null + } + + fun reset(){ + historyLocationList?.clear() + historyAngleList?.clear() + tempAngleList?.clear() + } + + + fun destory() { + mLocationJob?.cancel() + mLocationJob = null + stop() + mContext = null + } + + /** + * 注册监听器 + */ + fun registerListener(listener: LocationListener?) { + listener?.let { + listeners.add(it) + } + } + + /** + * 注册监听器 + */ + fun registerGpsListener(listener: LocationListener?) { + listener?.let { + gpsListeners.add(it) + } + } + + + /** + * + */ + fun unRegisterListener(listener: LocationListener?) { + listener?.let { + listeners.remove(it) + gpsListeners.remove(it) + } + //如果是最后一个解绑的Listener,就将定位服务也解绑 + if (gpsListeners.isEmpty() && listeners.isEmpty()) { + if (mIsUseExtraGPSData.get()) { + return + } + if (isNativeStarted.get()) { + isNativeStarted.set(false) + mLocationManager?.removeUpdates(this) + mLocationManager = null + } + } + } + + //是否使用外部数据 + fun setIsUseExtraGPSData(isUseExtraGPSData: Boolean) { + if(isUseExtraGPSData == mIsUseExtraGPSData.get()){ + return + } + if (isUseExtraGPSData != mIsUseExtraGPSData.get()) { + historyLocationList?.clear() + } + mIsUseExtraGPSData.set(isUseExtraGPSData) + if(mIsUseExtraGPSData.get()){ + stop() + }else{ + start() + } + } + + //使用外部数据 coor是坐标系 + fun setExtraGPSData(coor: Int, location: android.location.Location) { + if (!mIsUseExtraGPSData.get()) { + return + } + var lon = location.longitude + var lat = location.latitude + + var localLocation = MogoLocation() + localLocation.lon = lon + localLocation.lat = lat + localLocation.provider = location.provider + localLocation.speed = location.speed + localLocation.altitude = location.altitude +// mContext?.let { +// SharedPrefsMgr.getInstance(it).putString(ConstantExt.SHARED_KEY_LOCATION, JSON.toJSONString(location)) +// } + optimizeLocation(localLocation, TextUtils.equals(location.provider, Constant.GPS_RTK),location.provider.contains("RTK")) + } + + //使用外部数据 coor是坐标系 + fun setExtraSelfGPSData(location: MogoLocation) { + if (!mIsUseExtraGPSData.get()) { + return + } +// mContext?.let { +// SharedPrefsMgr.getInstance(it).putString(ConstantExt.SHARED_KEY_LOCATION, JSON.toJSONString(location)) +// } + optimizeLocation(location, TextUtils.equals(location.provider, Constant.GPS_RTK),location.provider.contains("RTK")) + } + + override fun onLocationChanged(alocation: android.location.Location?) { + if (mIsUseExtraGPSData.get()) { + return; + } + alocation?.let { + if (CompileConfig.DEBUG) { + Log.i(TAG, "locationop--onLocationChanged--:${it}") + } + sysTimeAndGpsTimeInterval = System.currentTimeMillis()-it.time + var location = MogoLocation() + location.lon = it.longitude + location.lat = it.latitude + location.provider = Constant.GPS + location.speed = it.speed + location.altitude = it.altitude + location.heading = it.bearing.toDouble() + if (isOutputLocation) { + var outputCalAngle = it.bearing + lastAlocation?.let { last -> + outputCalAngle = GisGeomTool.GetLineAngle(last.longitude, last.latitude, it.longitude, it.latitude).toFloat() + } + lastAlocation = alocation + MapAutoApi.addLog("nmap","${System.currentTimeMillis()},${it.longitude},${it.latitude},${it.altitude},${it.bearing},${outputCalAngle},${it.time},${it.speed}") + } + optimizeLocation(location, false,false) + } + } + + override fun onStatusChanged(provider: String?, status: Int, extras: Bundle?) { + } + + override fun onProviderEnabled(provider: String?) { + } + + override fun onProviderDisabled(provider: String?) { + } + + + /** + * Optimize the location with the given MogoLocation object. + * + * @param mogoLocation The location object to optimize. + * @param isGps Whether the location is from GPS. + * @param rtkEnable Whether RTK is enabled. + */ + private fun optimizeLocation(mogoLocation: MogoLocation, isGps: Boolean, rtkEnable: Boolean) { + // Check if the location is valid. + if (!MapDataApi.isRightLonLat(mogoLocation.lon, mogoLocation.lat)) { + Log.e(TAG, "Location is invalid: ${mogoLocation.lon}, ${mogoLocation.lat}") + return + } + + // Calculate the duration based on the satellite time. + var duration = mogoLocation.duration + if (duration == 0) { + // Use the time interval as the animation duration. + duration = if (mLastLocationTime > 0L) { + (mogoLocation.satelliteTime - mLastLocationTime).toInt() + } else { + 50 + } + mLastLocationTime = mogoLocation.satelliteTime + } + + // Adjust the duration based on whether RTK is enabled and the duration value. + duration = when { + rtkEnable && (duration > 300 || duration == 0) -> 50 + !rtkEnable && duration > 1000 -> 1000 + else -> duration + } + + // Copy the location object to avoid modifying the original object. + var location = mogoLocation.copy() + + // Convert the angle to the correct format. + location.heading = MathUtils.convertAngle((location.heading % 360.0), location.lon, location.lat) + + // If the duration is short, notify the listeners and return. + if (duration <= 10) { + dealListener(location, isGps, rtkEnable, false) + return + } + location.duration = duration + + // Check if the location is the same as the last location and update accordingly. + val currentTimestamp = System.currentTimeMillis() + if (lastLonLatPoint?.let { it.latitude == location.lat && it.longitude == location.lon && it.angle == location.heading && (currentTimestamp - mLastEqualLocationTime) < 3000 } == true) { + dealListener(location, isGps, rtkEnable, false) + return + } + mLastEqualLocationTime = currentTimestamp + lastLonLatPoint = LonLatPoint(location.lon, location.lat, location.altitude, location.heading) + + // Calculate the distance between the current and last locations for RTK. + if (rtkEnable) { + lastUseLocation?.let { + location.distance = MathUtils.distance(it.lon, it.lat, location.lon, location.lat) + } + lastUseLocation = location + } + + // Notify the listeners of the optimized location. + dealListener(location, isGps, rtkEnable, true) + } + + + /** + * Process the location update and notify the listeners. + * + * @param lonLatPoint The updated location object. + * @param isGps Whether the location is obtained from GPS. + * @param rtkEnable Whether the RTK is enabled. + * @param isCallMap Whether to notify the map location listener. + */ + private fun dealListener(lonLatPoint: LonLatPoint, isGps: Boolean, rtkEnable: Boolean, isCallMap: Boolean) { + // Notify the map location listener if needed. + if (isCallMap && isGps) { + mapLocationListener?.onLocationChanged(lonLatPoint) + } + + // Convert the GPS coordinates if the location is not obtained from GPS. + var gpsLon: Double + var gpsLat: Double + var lon: Double + var lat: Double + if (isGps) { + gpsLon = lonLatPoint.longitude + gpsLat = lonLatPoint.latitude + val temp = CommonProxy.getInstance().getLonLatProxy().switchLonLat(LonLat(gpsLon, gpsLat)) + lon = temp.longitude + lat = temp.latitude + } else { + lon = lonLatPoint.longitude + lat = lonLatPoint.latitude + val temp = CommonProxy.getInstance().getLonLatProxy().switchLonLat(LonLatPoint(lon, lat)) + gpsLon = temp.lon + gpsLat = temp.lat + } + + // Create the location object and notify the listeners. + val location = MogoLocation() + location.lon = gpsLon + location.lat = gpsLat + location.heading = lonLatPoint.angle + location.alt = lonLatPoint.altitude + if (rtkEnable) { + location.provider = Constant.GPS_RTK + } else { + location.provider = Constant.GPS + } + location.distance = lonLatPoint.distance + location.speed = lonLatPoint.speed.toFloat() + lastKnownMogoLocation = location.copy() + + // Notify the GPS listeners on the main thread. + mLocationJob?.cancel() + mLocationJob = mMapController?.getScope()?.launch(Dispatchers.Main) { + for (listener in gpsListeners) { + listener.onLocationChanged(location) + } + + // Convert the coordinates and update the provider for the non-GPS listeners. + location.lon = lon + location.lat = lat + if (rtkEnable) { + location.provider = Constant.AGPS_RTK + } else { + location.provider = Constant.AGPS + } + for (listener in listeners) { + listener.onLocationChanged(location) + } + } + } + + /** + * Handle the location update and notify the registered location listeners. + * + * @param location The updated location object. + * @param isGps A flag indicating whether the location data is from GPS or network. + * @param rtkEnable A flag indicating whether the RTK is enabled or not. + * @param isCallMap A flag indicating whether to call the `onLocationChanged` method of the registered map location listener. + */ + private fun dealListener(location: MogoLocation, isGps: Boolean, rtkEnable: Boolean, isCallMap: Boolean) { + mLocationJob?.cancel() + mLocationJob = mMapController?.getScope()?.launch(Dispatchers.Main) { + // Use the main thread to perform the location update and notify the listeners. + if (isGps) { + // Set the location provider based on whether the RTK is enabled. + location.provider = if (rtkEnable) Constant.GPS_RTK else Constant.GPS + // Notify the map location listener with the updated location data. + if (isCallMap) { + val lonLatPoint = LonLatPoint(location.lon, location.lat) + lonLatPoint.angle = location.heading + lonLatPoint.provider = location.provider + lonLatPoint.duration = location.duration + lonLatPoint.distance = location.distance + mapLocationListener?.onLocationChanged(lonLatPoint) + } + // Notify the GPS listeners with the updated location data. + gpsListeners.forEach { it.onLocationChanged(location) } + // Update the last known location. + lastKnownMogoLocation = location.copy() + // Switch the coordinate system from WGS84 to GCJ02 and set the location provider to "AGPS". + val lonLatPoint = CommonProxy.getInstance().getLonLatProxy().switchLonLat(LonLat(location.lon, location.lat)) + location.lon = lonLatPoint.longitude + location.lat = lonLatPoint.latitude + location.provider = if (rtkEnable) Constant.AGPS_RTK else Constant.AGPS + // Notify the location listeners with the updated location data. + listeners.forEach { it.onLocationChanged(location) } + } else { + // Set the location provider based on whether the RTK is enabled. + location.provider = if (rtkEnable) Constant.AGPS_RTK else Constant.AGPS + // Notify the location listeners with the updated location data. + listeners.forEach { it.onLocationChanged(location) } + // Switch the coordinate system from WGS84 to GCJ02 and set the location provider to "GPS". + val lonLatPoint = CommonProxy.getInstance().getLonLatProxy().switchLonLat(LonLatPoint(location.lon, location.lat)) + location.lon = lonLatPoint.lon + location.lat = lonLatPoint.lat + location.provider = if (rtkEnable) Constant.GPS_RTK else Constant.GPS + // Notify the GPS listeners with the updated location data. + gpsListeners.forEach { it.onLocationChanged(location) } + // Notify the map location listener with the updated location data. + if (isCallMap) { + val lonLatPoint = LonLatPoint(location.lon, location.lat) + lonLatPoint.angle = location.heading + lonLatPoint.provider = location.provider + lonLatPoint.duration = location.duration + lonLatPoint.distance = location.distance + mapLocationListener?.onLocationChanged(lonLatPoint) + } + // Update the last known location. + lastKnownMogoLocation = location.copy() + + } + } + } + + /** + * Update the location with the given LonLatPoint object. + * + * @param temp The updated location object. + */ + fun updateLocation(temp: LonLatPoint) { + // Check if the location is valid. + if(!MapDataApi.isRightLonLat(temp.longitude,temp.latitude)){ + Log.e(TAG, "LocationClient-Location is error:${temp.longitude},${temp.latitude}") + return; + } + // Enable the use of extra GPS data. + setIsUseExtraGPSData(true) + var lonLatPoint = temp + var duration = lonLatPoint.duration; + if(duration == 0){ + // Set the duration as the animation duration. + if (mLastLocationTime > 0L) { + duration = (temp.satelliteTime - mLastLocationTime).toInt() + }else{ + duration = 50; + } + mLastLocationTime = temp.satelliteTime + } + // Set the duration based on whether the RTK is enabled. + if(isRTK && (duration>300 || duration == 0)){ + duration = 50 + }else if(!isRTK && duration>1000){ + duration = 1000 + } + lonLatPoint.duration = duration + // Convert the angle if needed. + if(lonLatPoint.isConvertAngle){ + lonLatPoint.angle = MathUtils.convertAngle(lonLatPoint.angle%360,lonLatPoint.longitude,lonLatPoint.latitude) + } + // Calculate the distance between the current and last locations. + lastLonLatPoint?.let{ + val distance = MathUtils.distance(it.longitude, it.latitude, lonLatPoint.longitude, lonLatPoint.latitude) + lonLatPoint.distance = distance + } + // Set the distance to 1 if there is no last location. + if(lastLonLatPoint == null){ + lonLatPoint.distance = 1.0 + } + // Update the last location and notify the listeners. + lastLonLatPoint = lonLatPoint + dealListener(lonLatPoint,true,true,true) + // Output the location data if needed. + if (isOutputLocation) { + MapAutoApi.addLog("rtk","${System.currentTimeMillis()},${temp.longitude},${temp.latitude},${temp.altitude},${temp.angle},0,${lonLatPoint.speed},${lonLatPoint.distance},${lonLatPoint.satelliteTime}") + } + } + + + + /** + * Updates the RTK autopilot location with the given RTKAutopilotLocationBean object. + * + * @param rtkAutopilotLocationBean The RTKAutopilotLocationBean object containing the location information. + */ + fun updateRTKAutoPilotLocation(rtkAutopilotLocationBean: RTKAutopilotLocationBean) { + // Set the RTK flag and enable the use of extra GPS data. + isRTK = true + setIsUseExtraGPSData(true) + + // Disable the speed filter. + isFilterSpeed = false + + // Create a new MogoLocation object to hold the location information. + val location = MogoLocation() + + // Set the provider to GPS RTK. + location.provider = Constant.GPS_RTK + + // Set the latitude, longitude, and altitude. + location.lat = rtkAutopilotLocationBean.lat + location.lon = rtkAutopilotLocationBean.lon + location.altitude = rtkAutopilotLocationBean.alt + + // Set the turn light and speed. + location.turnLight = rtkAutopilotLocationBean.turn_light + location.speed = rtkAutopilotLocationBean.gnss_speed + + // Set the heading, duration, and satellite time. + location.heading = rtkAutopilotLocationBean.heading + location.duration = rtkAutopilotLocationBean.duration + location.satelliteTime = rtkAutopilotLocationBean.satelliteTime + + // Optimize the location. + optimizeLocation(location, true, true) + + // Output the location information if the flag is set. + if (isOutputLocation) { + lastRtkAutopilotLocationBean?.let { + // Calculate the distance between the current and last locations. + val distance = MathUtils.distance(it.lon, it.lat, rtkAutopilotLocationBean.lon, rtkAutopilotLocationBean.lat) + + // Calculate the angle between the current and last locations. + var outputCalAngle = GisGeomTool.GetLineAngle(it.lon, it.lat, rtkAutopilotLocationBean.lon, rtkAutopilotLocationBean.lat) + + // Add the location information to the log. + MapAutoApi.addLog("rtk","${rtkAutopilotLocationBean?.satelliteTime},${rtkAutopilotLocationBean?.lon},${rtkAutopilotLocationBean?.lat},${rtkAutopilotLocationBean?.alt},${rtkAutopilotLocationBean?.heading},${outputCalAngle},${rtkAutopilotLocationBean?.gnss_speed},${distance},${System.currentTimeMillis()}") + } + } + + // Set the last RTK autopilot location bean. + lastRtkAutopilotLocationBean = rtkAutopilotLocationBean + } + +} + + +interface LocationListener { + fun onLocationChanged(mogoLocation: MogoLocation) +} +interface LonLatPointListener { + fun onLocationChanged(lonLatPoint: LonLatPoint) +} + diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/MogoLocation.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/MogoLocation.kt new file mode 100644 index 0000000000..0ec364fa5d --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/MogoLocation.kt @@ -0,0 +1,69 @@ +package com.zhidaoauto.map.sdk.open.location + +import java.io.Serializable + +class MogoLocation: Serializable { + + var lon: Double = 0.0 + var lat: Double = 0.0 + var speed: Float = 0.0f + var provider: String = "" + var altitude: Double = 0.0 + var heading: Double = 0.0 + var alt: Double= 0.0 + var acceleration: Float = 0.0f + var yawRate: Float = 0.0f + //转向灯状态 0是正常 1是左转 2是右转 + var turnLight: Int = 0 + var flashLight: Int = 0 + var brakeLight: Int = 0 + var duration: Int = 0 + var road: String = "" + var address: String = "" + var cityCode: String = "" + var adCode: String = "" + var country: String = "" + var province: String = "" + var city: String = "" + var district: String = "" + var street: String = "" + + var distance:Double = 0.0 + //GPS time + var satelliteTime: Long = 0 + + override fun toString(): String { + return "MogoLocation(lon=$lon, lat=$lat, speed=$speed, provider='$provider', altitude=$altitude, heading=$heading')" + } + + + fun copy():MogoLocation{ + val mogoLocation = MogoLocation() + mogoLocation.satelliteTime = satelliteTime + mogoLocation.speed = speed + mogoLocation.lon = lon + mogoLocation.lat = lat + mogoLocation.heading = heading + mogoLocation.provider = provider + mogoLocation.altitude = altitude + mogoLocation.alt = alt + mogoLocation.acceleration = acceleration + mogoLocation.yawRate = yawRate + mogoLocation.turnLight = turnLight + mogoLocation.flashLight = flashLight + mogoLocation.brakeLight = brakeLight + mogoLocation.duration = duration + mogoLocation.road = road + mogoLocation.address = address + mogoLocation.cityCode = cityCode + mogoLocation.adCode = adCode + mogoLocation.country = country + mogoLocation.province = province + mogoLocation.city = city + mogoLocation.district = district + mogoLocation.street = street + return mogoLocation + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/MyLocationStyle.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/MyLocationStyle.kt new file mode 100644 index 0000000000..cac544b3e1 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/MyLocationStyle.kt @@ -0,0 +1,415 @@ +package com.zhidaoauto.map.sdk.open.location + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import android.text.TextUtils +import android.util.Log +import com.autonavi.nge.map.LonLat +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.abs.IMarkerController +import com.zhidaoauto.map.sdk.inner.utils.BitmapUtils +import com.zhidaoauto.map.sdk.inner.utils.Constants +import com.zhidaoauto.map.sdk.open.marker.Marker +import com.zhidaoauto.map.sdk.open.marker.MarkerOptions +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class MyLocationStyle(private var mContext:Context?,private var mMarkerController: IMarkerController?,private var mMapController: IMapController?) { + val TAG = javaClass.simpleName + + companion object { + const val SELF_CAR_ID = "selfcar123" + + const val LOCATION_TYPE_SHOW = 0 //只定位一次。 + const val LOCATION_TYPE_LOCATE = 1 //定位一次,且将视角移动到地图中心点 + const val LOCATION_TYPE_FOLLOW = 2//连续定位、且将视角移动到地图中心点,定位蓝点跟随设备移动。(1秒1次定位) 默认执行此种模式 + const val LOCATION_TYPE_FOLLOW_NO_CENTER = 3 //连续定位、蓝点不会移动到地图中心点,并且蓝点会跟随设备移动。 + + const val ANIM_WAIT_FRAME_NIGHT = 150 + const val ANIM_PERIOD_NIGHT = 20 + const val ANIM_WAIT_FRAME_DAY = 60 + const val ANIM_PERIOD_DAY = 45 + } + + + private var mLonLat:LonLat = LonLat(Constants.BEIJING.lon,Constants.BEIJING.lat) + private var mAngle:Float = 0.0f + private var locationCount = 0 + private var is3D: Boolean = false + private var carId: Int = 0 + private var isDisplayAnim: Boolean = true + private var mMarker: Marker? = null + + private var lastExecuteTime = -1L + private var lastLonLatPoint :LonLatPoint? = null + + + private val zIndex = 1 + private val anchorU = 0.5f + private val anchorV = 0.5f + + var myLocationIcon: Bitmap? = null + var intervalTime: Long = 1000 + // 2D资源 + var carResId: Int = R.mipmap.map_custom_self_car_night + // 3D夜间资源 + var car3DResId: Int = R.raw.car + + //执行标记 + private var executeFlag:AtomicBoolean = AtomicBoolean() + + var guangquanResId: Int = R.raw.guangquan + var locationPath: String? = null + + private var animWaitFrame = ANIM_WAIT_FRAME_NIGHT + private var animPeriod = ANIM_PERIOD_NIGHT + + + fun getSelfMarker():Marker?{ + return mMarker + } + + fun setDisplayAnimEnable(enable:Boolean){ + mMapController?.getClerk()?.add("$enable,$guangquanResId") + isDisplayAnim = enable + mMarker?.setDisplayAnimEnable(isDisplayAnim) + if(isDisplayAnim){ + mMarker?.getMarkeOptions()?.let { + it.animMarkerRes(guangquanResId,mMapController)?. + animWaitFrame(animWaitFrame)?. + period(animPeriod) + mMarker?.setMarkerOptions(it) + } + }else{ + //待增加删除之前动画模型的逻辑 + } + } + + + fun myLocationIcon(myLocationIcon: Bitmap): MyLocationStyle { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--selfop--myLocationIcon --Bitmap--drawCar:${mMarker}") + } + mMapController?.getClerk()?.add() + + locationPath = BitmapUtils.saveBitmap(myLocationIcon) +// val bitmap = BitmapUtils.copyBitmap(myLocationIcon) +// if(bitmap == null){ +// return this +// } + if(this.myLocationIcon != null){ + this.myLocationIcon?.recycle() + this.myLocationIcon = null + } + this.myLocationIcon = myLocationIcon + carId = 0 + if (mMarker == null) { + drawCar(myLocationIcon) + } else { + mMarker?.setIcon(myLocationIcon) + } + return this + } + + @Synchronized + private fun drawCar(bitmap: Bitmap) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop---selfop--drawCar:start") + } + if (mMarker != null) { + mMarker?.setIcon(bitmap) + return + } + if((mMapController?.isSurfaceCreated())?:false){ + var lon = mLonLat.lon + var lat = mLonLat.lat + var angle = mAngle + try { + val options = MarkerOptions(SELF_CAR_ID,mMapController).setGps(true) + .position(LonLatPoint(lon, lat)) + .markerIcon(bitmap,mMapController).zIndex(1).title("self").rotateAngle(angle.toFloat()).controlAngle(true).anchor(0.5f,0.5f) + + addConstMarker(options) + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop--selfop--markerop--drawCar:${mMarker?.getId()}") + } + } catch (e: Exception) { + mMarker = null + } + } + } + + + private fun draw3DCar(resId: Int) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop---selfop--draw3DCar:start:${resId},old:${mMarker?.getMarkeOptions()?.getMarkerIconName()}") + } + if (mMarker != null) { + + val markerOptions = mMarker?.getMarkeOptions()?.displayAnimEnable(isDisplayAnim) + + if(isDisplayAnim){ + markerOptions?.animWaitFrame(animWaitFrame)?.period(animPeriod) + ?.animType(1)?.anchorType(1) + markerOptions?.animMarkerRes(guangquanResId,mMapController) + }else{ + //待增加删除之前动画模型的逻辑 + } + + val markerIconName = mMarker?.getMarkeOptions()?.getMarkerIconName() + if(TextUtils.isEmpty(markerIconName) || carId != resId){ + markerOptions?.marker3DIcon(resId,mMapController) + } + markerOptions?.let { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop-draw3DCar--:${resId},${it} ") + } + mMarker?.setMarkerOptions(it) + } + return + } + if((mMapController?.isSurfaceCreated())?:false){ + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop---selfop--draw3DCar:start:mapView SurfaceCreated") + } + var lon = mLonLat.lon + var lat = mLonLat.lat + var angle = mAngle + try { + val options = MarkerOptions(SELF_CAR_ID,mMapController) + .setGps(true) + .position(LonLatPoint(lon, lat)) + .marker3DIcon(resId,mMapController) + .displayAnimEnable(isDisplayAnim) + .zIndex(zIndex) + .title("self") + .rotateAngle(angle.toFloat()) + .anchor(anchorU , anchorV) + .controlAngle(true) + .animType(1) + .anchorType(1) + .animWaitFrame(animWaitFrame) + .period(animPeriod) + if(isDisplayAnim){ + options?.animMarkerRes(guangquanResId,mMapController) + } + addConstMarker(options) + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop--selfop--markerop--draw3DCar:${mMarker?.getId()},${resId},${options.getMarkerIconName()}") + } + } catch (e: Exception) { + if (CompileConfig.DEBUG) { + Log.e(TAG, "autoop--selfop--markerop--draw3DCar:${mMarker?.getId()}",e) + } + mMarker = null + } + } + + } + + + fun setLonLat(lonLat: LonLat, angle: Double) { + mMapController?.getClerk()?.add("${lonLat.lon},${lonLat.lat},${angle}") + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop--markerop---selfop-setLonLat-${lonLat},mMarker:${mMarker?.getId()}") + } + this.mLonLat = lonLat + this.mAngle = angle.toFloat() + if (mMarker == null) { + if(is3D){ + myLocationIcon(car3DResId, is3D) + }else{ + myLocationIcon(carResId, is3D) + } + } + + mMarker?.setGps(true) + if(lastLonLatPoint != null){ + executeTransAnim(lonLat,angle,System.currentTimeMillis() - lastExecuteTime) + lastExecuteTime = System.currentTimeMillis() + }else{ + val lonLatPoint = LonLatPoint(lonLat.lon, lonLat.lat,0.0,angle) + mMarker?.setRotateAngle(angle.toFloat()) + mMarker?.setPosition(lonLatPoint) + lastLonLatPoint = lonLatPoint + lastExecuteTime = System.currentTimeMillis() + } + + } + + fun setLonLat(lonLat: LonLat, angle: Float,duration: Long) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop--markerop---selfop-setLonLat-${lonLat},mMarker:${mMarker?.getId()}") + } + this.mLonLat = lonLat + this.mAngle = angle + + if (mMarker == null) { + if(is3D){ + myLocationIcon(car3DResId, is3D) + }else{ + myLocationIcon(carResId, is3D) + } + } + mMarker?.setGps(true) + val lonLatPoint = LonLatPoint(lonLat.lon, lonLat.lat) + mMarker?.setPosition(lonLatPoint) + mMarker?.setRotateAngle(angle) + } + + + private fun executeTransAnim(lonLat: LonLat,angle:Double, duration: Long) { + val lonLatPoint = LonLatPoint(lonLat.lon,lonLat.lat,0.0,angle) + var curDuration = duration + if(curDuration > 300){ + curDuration = 50 + } + mMarker?.addDynamicAnchorPostion(lonLatPoint,System.currentTimeMillis(),curDuration.toInt(),1f,-1f) + lastLonLatPoint = lonLatPoint + + } + + + fun resetPosition(){ +// mMapController?.getClerk()?.add() + lastLonLatPoint = null + } + + + fun hideCar() { + mMarker?.setVisible(false) + } + + fun showCar() { + mMarker?.setVisible(true) + } + + + fun setScale(scale:Float){ + mMarker?.setScale(scale) + } + + fun myLocationIcon(carResId: Int, is3D: Boolean): MyLocationStyle { + mMapController?.getClerk()?.add("$is3D,$carResId") + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--selfop--myLocationIcon draw3DCar:${mMarker?.getId()},${carResId},${is3D}") + } + if (carResId != 0) { + + this.is3D = is3D + if (is3D) { + this.car3DResId = carResId + draw3DCar(carResId) + } else { + this.carResId = carResId + val bitmap = BitmapFactory.decodeResource(mContext?.resources, carResId) + bitmap?.let { + if(this.myLocationIcon != null){ + this.myLocationIcon?.recycle() + this.myLocationIcon = null + } + drawCar(it) + } + } + carId = carResId + } + + return this + } + + fun myLocationIcon(carResId: Int): MyLocationStyle { + mMapController?.getClerk()?.add("$carResId") + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--selfop--myLocationIcon drawCar:${mMarker},carResId:${carResId},res:${R.mipmap.map_custom_self_car_night}") + } + myLocationIcon(carResId, false) + return this + } + + //设置光圈 + fun setAnimMarkerRes(resId: Int, waitFrame: Int, period: Int){ + if(animWaitFrame != waitFrame){ + animWaitFrame = waitFrame + } + if(animPeriod != period){ + animPeriod = period + } + + if(guangquanResId != resId){ +// val markerOptions = mMarker?.getMarkeOptions()?.animMarkerRes(resId) +// markerOptions?.let { +// mMarker?.setMarkerOptions(it) +// } + guangquanResId = resId + } + + + } + + + fun setRotateAngle(angle: Float) { +// mMapController?.getClerk()?.add("$angle") + this.mAngle = angle + mMarker?.setRotateAngle(angle) + } + + fun getMyLocationIcon(): Int { + if(is3D){ + return this.car3DResId + } + return this.carResId + } + + + fun interval(intervalTime: Long): MyLocationStyle { + if (intervalTime > 1000) { + this.intervalTime = intervalTime + } + return this + } + + /** + * + */ + fun locateCount() { + if (locationCount < 10) { + locationCount++ + } + } + + fun carCursorRes(carResId: Int): MyLocationStyle { + if (CompileConfig.DEBUG) { + Log.i(TAG, "selfop---markerop-carCursorRes") + } + if (carResId != 0) { + myLocationIcon(carResId,false) + } + return this + } + + fun naviCursorRes(naviResId: Int) { + //设置导航的图片 + } + + fun exit() { + executeFlag.set(false) + mMarker?.remove() + mMarker?.destroy() + mMarker = null + } + + private fun addConstMarker(markerOptions: MarkerOptions){ + if(executeFlag.get()){ + return + } + if(mMarker == null){ + executeFlag.set(true) + mMarker = MarkerHelper.addSelfCar(markerOptions) + executeFlag.set(false) + + } + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/RTKAutopilotLocationBean.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/RTKAutopilotLocationBean.kt new file mode 100644 index 0000000000..ec24b97003 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/RTKAutopilotLocationBean.kt @@ -0,0 +1,63 @@ +package com.zhidaoauto.map.sdk.open.location + +import com.alibaba.fastjson.annotation.JSONField +import java.io.Serializable + +open class RTKAutopilotLocationBean : Serializable { + //经度 + @JSONField(name = "lon") + var lon: Double = 0.0 + //纬度 + @JSONField(name = "lat") + var lat: Double = 0.0 + //高度 + @JSONField(name = "alt") + var alt: Double = 0.0 + //方向 + @JSONField(name = "heading") + var heading: Double = 0.0 + //惯导速度m/s + @JSONField(name = "gnss_speed") + var gnss_speed: Float = 0.0f + //车辆速度m/s + @JSONField(name = "vehicle_speed") + var vehicle_speed: Float = 0.0f + + @JSONField(name = "acceleration") + var acceleration: Double = 0.0 + + @JSONField(name = "yaw_rate") + var yaw_rate: Double = 0.0 + //转向灯状态 0是正常 1是左转 2是右转 + @JSONField(name = "turn_light") + var turn_light: Int = 0 + //双闪灯状态 + @JSONField(name = "flash_light") + var flash_light: Int = 0 + //刹车灯状态 + @JSONField(name = "brake_light") + var brake_light: Int = 0 + //中控机发送系统时间 + @JSONField(name = "systemTime") + var systemTime: Long = 0 + //中控机发送卫星时间 + @JSONField(name = "satelliteTime") + var satelliteTime: Long = 0 + + //adas接受到的时间 + @JSONField(name = "receiverDataTime") + var receiverDataTime: Long = 0 + //adas接受到的 gps时间 + @JSONField(name = "adasSatelliteTime") + var adasSatelliteTime: Long = 0 + + var duration:Int =0 + + constructor() + + override fun toString(): String { + return "RTKAutopilotLocationBean(lon=$lon, lat=$lat, alt=$alt, heading=$heading, gnss_speed=$gnss_speed, vehicle_speed=$vehicle_speed, acceleration=$acceleration, yaw_rate=$yaw_rate, turn_light=$turn_light, flash_light=$flash_light, brake_light=$brake_light, systemTime=$systemTime, satelliteTime=$satelliteTime, receiverDataTime=$receiverDataTime, adasSatelliteTime=$adasSatelliteTime)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/sys/LocationApi.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/sys/LocationApi.kt new file mode 100644 index 0000000000..396d49909b --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/location/sys/LocationApi.kt @@ -0,0 +1,314 @@ +package com.zhidaoauto.map.sdk.open.location.sys + +import android.Manifest +import android.annotation.SuppressLint +import android.app.Service +import android.content.Context +import android.content.Intent +import android.content.pm.PackageManager +import android.location.* +import android.os.Bundle +import android.provider.Settings +import android.util.Log +import android.widget.Toast +import androidx.core.app.ActivityCompat +import com.zhidaoauto.map.sdk.inner.CompileConfig +import java.io.IOException +import java.util.* + +object LocationApi { + val TAG = javaClass.simpleName + + var mLocationManager: LocationManager? = null + var mListener: OnLocationChangeListener? = null + var myLocationListener: LocationListener? = null + + fun init(context: Context) { + var locationManager = context.getSystemService(Service.LOCATION_SERVICE) as LocationManager + val providerEnabled: Boolean = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) + if (providerEnabled) { + if (ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED + && ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + return + } + locationManager.requestLocationUpdates( + LocationManager.GPS_PROVIDER, + 0, + 0.0f, + object : LocationListener { + override fun onLocationChanged(location: Location?) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "locationop-onLocationChanged-${location}") + } + } + + override fun onStatusChanged(provider: String?, status: Int, extras: Bundle?) { + if (CompileConfig.DEBUG) { + Log.i( + TAG, + "locationop-onStatusChanged-provider:${provider},status:${status}" + ) + } + } + + override fun onProviderEnabled(provider: String?) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "locationop-onProviderEnabled-${provider}") + } + } + + override fun onProviderDisabled(provider: String?) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "locationop-onProviderDisabled-${provider}") + } + } + + }) + } + } + + + /** + * 判断Gps是否可用 + * + * @return {@code true}: 是
{@code false}: 否 + */ + fun isGpsEnabled(context: Context): Boolean { + var lm = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager + return lm.isProviderEnabled(LocationManager.GPS_PROVIDER); + } + + /** + * 判断定位是否可用 + * + * @return {@code true}: 是
{@code false}: 否 + */ + fun isLocationEnabled(context: Context): Boolean { + var lm = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager + return lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER) || lm.isProviderEnabled( + LocationManager.GPS_PROVIDER + ) + } + + /** + * 打开Gps设置界面 + */ + fun openGpsSettings(context: Context) { + var intent = Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS) + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + context.startActivity(intent) + } + + /** + * 注册 + *

使用完记得调用{@link #unregister()}

+ *

需添加权限 {@code }

+ *

需添加权限 {@code }

+ *

需添加权限 {@code }

+ *

如果{@code minDistance}为0,则通过{@code minTime}来定时更新;

+ *

{@code minDistance}不为0,则以{@code minDistance}为准;

+ *

两者都为0,则随时刷新。

+ * + * @param minTime 位置信息更新周期(单位:毫秒) + * @param minDistance 位置变化最小距离:当位置距离变化超过此值时,将更新位置信息(单位:米) + * @param listener 位置刷新的回调接口 + * @return {@code true}: 初始化成功
{@code false}: 初始化失败 + */ + @SuppressLint("MissingPermission") fun register( + context: Context, + minTime: Long, + minDistance: Float, + listener: OnLocationChangeListener? + ): Boolean { + if (CompileConfig.DEBUG) { + Log.e(TAG, "locationop-register") + } + if (listener == null) + return false + mLocationManager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager + mListener = listener + if (!isLocationEnabled(context)) { + Toast.makeText(context, "无法定位,请打开定位服务", Toast.LENGTH_SHORT).show(); + return false; + } + var provider = mLocationManager?.getBestProvider(getCriteria(), true); + var location = mLocationManager?.getLastKnownLocation(provider); + + if (location != null) { + Log.i(TAG,"locationop-getLastKnownLocation-${location}") + listener.getLastKnownLocation(location); + } + myLocationListener = object : LocationListener { + override fun onLocationChanged(location: Location?) { + Log.i(TAG,"locationop-onLocationChanged-${location}") + mListener?.onLocationChanged(location) + } + + override fun onStatusChanged(provider: String?, status: Int, extras: Bundle?) { + mListener?.onStatusChanged(provider, status, extras) + when (status) { + LocationProvider.AVAILABLE -> + if (CompileConfig.DEBUG) { + Log.e("onStatusChanged", "locationop-当前GPS状态为可见状态") + }; + LocationProvider.OUT_OF_SERVICE -> + if (CompileConfig.DEBUG) { + Log.e("onStatusChanged", "locationop-当前GPS状态为服务区外状态") + } + LocationProvider.TEMPORARILY_UNAVAILABLE -> + if (CompileConfig.DEBUG) { + Log.e("onStatusChanged", "locationop-当前GPS状态为暂停服务状态") + }; + } + } + + override fun onProviderEnabled(provider: String?) { + } + + override fun onProviderDisabled(provider: String?) { + } + + } + mLocationManager?.requestLocationUpdates( + provider, + minTime, + minDistance, + myLocationListener + ); + return true; + } + + + /** + * 注销 + */ + fun unregister() { + if (mLocationManager != null) { + if (myLocationListener != null) { + mLocationManager?.removeUpdates(myLocationListener); + myLocationListener = null; + } + mLocationManager = null; + } + } + + /** + * 设置定位参数 + * + * @return {@link Criteria} + */ + fun getCriteria(): Criteria { + var criteria = Criteria() + //设置定位精确度 Criteria.ACCURACY_COARSE比较粗略,Criteria.ACCURACY_FINE则比较精细 + criteria.setAccuracy(Criteria.ACCURACY_FINE); + //设置是否要求速度 + criteria.setSpeedRequired(true); + // 设置是否允许运营商收费 + criteria.setCostAllowed(true); + //设置是否需要方位信息 + criteria.setBearingRequired(true); + //设置是否需要海拔信息 + criteria.setAltitudeRequired(true); + // 设置对电源的需求 + criteria.setPowerRequirement(Criteria.POWER_HIGH); + return criteria; + } + + /** + * 根据经纬度获取地理位置 + * + * @param context 上下文 + * @param latitude 纬度 + * @param longitude 经度 + * @return {@link Address} + */ + fun getAddress(context: Context, latitude: Double, longitude: Double): Address? { + var geocoder = Geocoder(context, Locale.getDefault()); + try { + var addresses = geocoder.getFromLocation(latitude, longitude, 1) + if (addresses.size > 0) + return addresses.get(0); + + } catch (e: IOException) { + e.printStackTrace(); + } + return null + } + + /** + * 根据经纬度获取所在国家 + * + * @param context 上下文 + * @param latitude 纬度 + * @param longitude 经度 + * @return 所在国家 + */ + fun getCountryName(context: Context, latitude: Double, longitude: Double): String { + var address = getAddress(context, latitude, longitude); + address?.let { + return it.getCountryName() + } + return "unknown" + } + + /** + * 根据经纬度获取所在地 + * + * @param context 上下文 + * @param latitude 纬度 + * @param longitude 经度 + * @return 所在地 + */ + fun getLocality(context: Context, latitude: Double, longitude: Double): String { + var address = getAddress(context, latitude, longitude) + address?.let { + return it.getLocality() + } + return "unknown" + } + + /** + * 根据经纬度获取所在街道 + * + * @param context 上下文 + * @param latitude 纬度 + * @param longitude 经度 + * @return 所在街道 + */ + + fun getStreet(context: Context, latitude: Double, longitude: Double): String { + var address = getAddress(context, latitude, longitude) + address?.let { + return it.getAddressLine(0) + } + return "unknown" + } + + interface OnLocationChangeListener { + + /** + * 获取最后一次保留的坐标 + * + * @param location 坐标 + */ + fun getLastKnownLocation(location: Location) + + /** + * 当坐标改变时触发此函数,如果Provider传进相同的坐标,它就不会被触发 + * + * @param location 坐标 + */ + fun onLocationChanged(location: Location?) + + /** + * provider的在可用、暂时不可用和无服务三个状态直接切换时触发此函数 + * + * @param provider 提供者 + * @param status 状态 + * @param extras provider可选包 + */ + fun onStatusChanged(provider: String?, status: Int, extras: Bundle?);//位置状态发生改变 + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/Animation.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/Animation.kt new file mode 100644 index 0000000000..cc0b6c60e0 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/Animation.kt @@ -0,0 +1,23 @@ +package com.zhidaoauto.map.sdk.open.marker + +import com.zhidaoauto.map.sdk.open.abs.marker.MarkerAnimationListener + +open class Animation{ + private var listener: MarkerAnimationListener? = null + private var repeatCount = 0 + val INFINITE = -1 + fun setAnimationListener(listener: MarkerAnimationListener){ + this.listener = listener + } + fun getAnimationListener():MarkerAnimationListener?{ + return this.listener + } + + fun setRepeatCount(repeatCount: Int){ + this.repeatCount = repeatCount + } + + fun getRepeatCount(): Int{ + return this.repeatCount + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/BatchMarkerOptions.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/BatchMarkerOptions.kt new file mode 100644 index 0000000000..18916fccab --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/BatchMarkerOptions.kt @@ -0,0 +1,41 @@ +package com.zhidaoauto.map.sdk.open.marker + +class BatchMarkerOptions { + + // 他车数据列表 + var list:ArrayList? = null + // 他车数据拼接字符串 + var othersStr:String = "" + // 是否延时处理 1= 延迟 0 =不延迟 + var delayStrategy:Boolean = false + // 在指定角度范围内不改变车辆的航向角 + var ruleAngle:Float = 0.0f + //控制资源传入是固定值还是资源编号 1= 固定值 0 =资源编号(md5) + var controlIcon:Int = 1 + //GPS时间 + var satelliteTime: Long=0L + //删除策略 1= 管理删除 0 =不管理删除 + var deleteRule:Int = 1 + //显示infowindow 1= 显示 0 =不显示 + var showInfo:Int = 0 + //动画间隔时长 + var duration: Int = 0 + //重置数据 + var isReset:Boolean = false + //是否替换上一个动画周期 + var isReplaceDuration:Int = 0 + + //平均速度标记 + var averageFlag: Int = 1 + + + constructor(list:ArrayList?){ + this.list = list + } + + constructor(){ + + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/BitmapDescriptor.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/BitmapDescriptor.kt new file mode 100644 index 0000000000..3211db14f8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/BitmapDescriptor.kt @@ -0,0 +1,101 @@ +package com.zhidaoauto.map.sdk.open.marker + +import android.graphics.Bitmap +import android.os.Parcel +import android.os.Parcelable +import java.nio.ByteBuffer + +public class BitmapDescriptor : Parcelable, Cloneable { + var width = 0 + private set + var height = 0 + private set + var bitmap: Bitmap? = null + private set + + internal constructor(parcel: Parcel) { + width = parcel.readInt() + height = parcel.readInt() + bitmap = parcel.readParcelable(Bitmap::class.java.classLoader) + } + + constructor(bitmap: Bitmap?) { + if (bitmap != null) { + width = bitmap.width + height = bitmap.height + this.bitmap = bitmap + } + } + + private constructor(bitmap: Bitmap, width: Int, height: Int) { + this.width = width + this.height = height + this.bitmap = bitmap + } + + public override fun clone(): BitmapDescriptor { + return try { + BitmapDescriptor( + Bitmap.createBitmap(bitmap), + width, + height + ) + } catch (var3: Throwable) { + return BitmapDescriptor( + Bitmap.createBitmap(bitmap), + width, + height + ) + } + } + + /** + * 获取 描述Marker图标的Bitmap的 ByteArray + */ + public fun getBytes(): ByteArray { + bitmap?.let { + if(it.isRecycled){ + return ByteArray(0) + } + val bytes = it.byteCount + var buf = ByteBuffer.allocateDirect(bytes) + it.copyPixelsToBuffer(buf) +// it.recycle() + return buf.array() + + } + return ByteArray(0) + } + + override fun describeContents(): Int { + return 0 + } + + override fun writeToParcel(parcel: Parcel, var2: Int) { + parcel.writeInt(width) + parcel.writeInt(height) + parcel.writeParcelable(bitmap, var2) + } + + fun recycle() { + bitmap?.let { + if (!it.isRecycled) { + it.recycle() + bitmap = null + } + } + } + + companion object { + @JvmField val CREATOR: Parcelable.Creator = + object : Parcelable.Creator { + override fun createFromParcel(`in`: Parcel): BitmapDescriptor? { + return BitmapDescriptor(`in`) + } + + override fun newArray(size: Int): Array { + return arrayOfNulls(size) + } + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/BitmapDescriptorFactory.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/BitmapDescriptorFactory.kt new file mode 100644 index 0000000000..b66d16f515 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/BitmapDescriptorFactory.kt @@ -0,0 +1,100 @@ +package com.zhidaoauto.map.sdk.open.marker + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import android.graphics.Canvas +import android.graphics.Color +import android.view.View +import androidx.annotation.DrawableRes +import java.io.DataInputStream +import java.io.IOException + +object BitmapDescriptorFactory { + + //图片转换 + fun fromBitmap(bitmap: Bitmap): BitmapDescriptor { + return BitmapDescriptor(bitmap) + } + + //图片资源转换 + fun fromResource(context:Context,@DrawableRes resId: Int): BitmapDescriptor { + return BitmapDescriptor(BitmapFactory.decodeResource(context.resources,resId)) + } + + fun from3DResource(context:Context,resId: Int) :ByteArray?{ + var totBuffer:ByteArray? = null + var dis:DataInputStream? = null + try { + dis = DataInputStream(context.getResources()?.openRawResource(resId)) + var curTotSize = 64 * 1024 + totBuffer = ByteArray(curTotSize) + val buffer = ByteArray(1024) + var size = 0 + var totSize = 0 + try { + while (dis.read(buffer).also { size = it } >= 0) { + if (totSize + size > curTotSize) { + curTotSize = (totSize + size) * 3 / 2 + val newTotBuffer = ByteArray(curTotSize) + System.arraycopy(totBuffer, 0, newTotBuffer, 0, totSize) + totBuffer = newTotBuffer + } + System.arraycopy(buffer, 0, totBuffer, totSize, size) + totSize += size + } + dis.close() + } catch (e: IOException) { + e.printStackTrace() + } + }catch (e:Exception){ + e.printStackTrace() + }finally{ + dis?.close() + } + return totBuffer + } + + fun fromView(view: View): BitmapDescriptor { + return BitmapDescriptor(convertViewToBitmap(view)) + } + + fun convertViewToBitmap(view: View): Bitmap { + view.measure( + View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), + View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED) + ) + view.layout(0, 0, view.measuredWidth, view.measuredHeight) + val bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888); + val canvas = Canvas(bitmap) +// canvas.drawColor(Color.WHITE); + view.draw(canvas); +// view.setDrawingCacheEnabled(true) +// var bitmap = view.drawingCache +// view.setDrawingCacheEnabled(false) +// view.postDelayed({ +// }, 1000) + return bitmap + } + + fun loadBitmapFromView(v: View): Bitmap? { + val w = v.width + val h = v.height + val bmp = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888) + val c = Canvas(bmp) + c.drawColor(Color.WHITE) + /** 如果不设置canvas画布为白色,则生成透明 */ + v.layout(0, 0, w, h) + v.draw(c) + return bmp + } + + fun createBitmap(view: View): Bitmap? { + view.isDrawingCacheEnabled = true + view.buildDrawingCache() //启用DrawingCache并创建位图 + val bitmap = Bitmap.createBitmap(view.drawingCache) //创建一个DrawingCache的拷贝,因为DrawingCache得到的位图在禁用后会被回收 + view.isDrawingCacheEnabled = false //禁用DrawingCahce否则会影响性能 + return bitmap + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/CarInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/CarInfo.kt new file mode 100644 index 0000000000..c223737056 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/CarInfo.kt @@ -0,0 +1,14 @@ +package com.zhidaoauto.map.sdk.open.marker + +/** + * @param id + * @param lon 经度 + * @param lat 纬度 + * @param angle 角度 + * @param type 车类型 + */ +data class CarInfo(val id:Long, + val lon:Double, + val lat:Double, + val angle:Double, + val type:Int) diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/CarManager.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/CarManager.kt new file mode 100644 index 0000000000..95045cb4c8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/CarManager.kt @@ -0,0 +1,172 @@ +package com.zhidaoauto.map.sdk.open.marker + +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.utils.OBB + + +object CarManager { + + var carSizeMap:HashMap = HashMap() + + init { + carSizeMap.put(1, doubleArrayOf(112.0 / 2, 74.0 / 2)) + carSizeMap.put(2, doubleArrayOf(57.0 / 2, 539.0 / 2)) + carSizeMap.put(3, doubleArrayOf(429.0 / 2, 1001.0 / 2)) //429/1001是类型3对应渲染模型的x/y的长度 + carSizeMap.put(4, doubleArrayOf(247.0 / 2, 794.0 / 2)) + carSizeMap.put(6, doubleArrayOf(475.0 / 2, 1429.0 / 2)) + carSizeMap.put(101,doubleArrayOf(529.0 / 2, 1021.0 / 2))//东风 + carSizeMap.put(102,doubleArrayOf(435.0 / 2, 1041.0 / 2))//红旗 + carSizeMap.put(103,doubleArrayOf(581.0 / 2, 1449.0 / 2))//小巴 + carSizeMap.put(104,doubleArrayOf(845.0 / 2, 2501.0 / 2))//环卫 + +// carSizeMap.put(0, doubleArrayOf(1.4 / 2, 4.0 / 2)) + } + + /** + * 更新车辆的大小 + * @param type 车辆类型 + * @param width 车辆宽度 + * @param length 车辆长度 + */ + fun updateCarSize(type:Int,width:Double,length:Double){ + carSizeMap.put(type, doubleArrayOf(width/2,length/2)) + } + + /** + * 检查车辆是否叠加 + * @param selfLon 自车经度 + * @param selfLat 自车纬度度 + * @param list 他车数据列表 + * @return 返回车辆叠加数据 + */ + fun checkCollision(selfLon:Double,selfLat:Double,list:ArrayList,mapController: IMapController?):Map>{ + val map = HashMap>() + val carInfoMap = HashMap() + val size = list.size + var buffer = StringBuffer() + for(i in 0 until size) { + val carInfoOne = list[i] + if (!carSizeMap.containsKey(carInfoOne.type)) { + continue + } + val carSizeOne = carSizeMap[carInfoOne.type] + if (carSizeOne == null) { + continue + } + carInfoMap.put(carInfoOne.id,carInfoOne) + if(i > 0){ + buffer.append(",") + } + buffer.append("${carInfoOne.id}").append(",") + .append("${carInfoOne.lon}").append(",") + .append("${carInfoOne.lat}").append(",") + .append("${carInfoOne.angle}").append(",") + .append("${carSizeOne[0]}").append(",") + .append("${carSizeOne[1]}") + } + if(buffer.isNullOrEmpty()){ + return map + } + var coliRet = mapController?.isCollision(buffer.toString()) + coliRet?.let{ + val li1 = coliRet?.split("|") + for(i in 0 until li1.size){ + val li2 = li1[i].split(",") + val first = li2[0] + if(first.isNullOrEmpty()) + continue + val collList = ArrayList() + for(j in 1 until li2.size){ + carInfoMap[li2[j].toLong()]?.let { collList.add(it) } + } + carInfoMap[first.toLong()]?.let { collList.add(it) } + map.put(first.toLong(),collList) + } + } + + return map + } + + /** + * 检查车辆是否叠加 + * @param selfLon 自车经度 + * @param selfLat 自车纬度度 + * @param list 他车数据列表 + * @return 返回车辆叠加数据 + */ + fun checkCollision1(selfLon:Double,selfLat:Double,list:ArrayList):Map>{ + val map = HashMap>() + + val size = list.size + for(i in 0 until size){ + if(i == size - 1){ + continue + } + val carInfoOne = list[i] + if(!carSizeMap.containsKey(carInfoOne.type)){ + continue + } + val carSizeOne = carSizeMap[carInfoOne.type] + if(carSizeOne == null){ + continue + } + val collList = ArrayList() + val obbOne = OBB(carInfoOne.lon,carInfoOne.lat,selfLon,selfLat,carSizeOne[0],carSizeOne[1],carInfoOne.angle) + System.out.println("$i:"+obbOne.toString()) + for(j in i+1 until size){ + val carInfoTwo = list[j] + if(!carSizeMap.containsKey(carInfoTwo.type)){ + continue + } + val carSizeTwo = carSizeMap[carInfoTwo.type] + if(carSizeTwo == null){ + continue + } + val obbTwo = OBB(carInfoTwo.lon,carInfoTwo.lat,selfLon,selfLat,carSizeTwo[0],carSizeTwo[1],carInfoTwo.angle) + System.out.println("$j:"+obbTwo.toString()) + if(obbOne.isCollision(obbTwo)){ + collList.add(carInfoTwo) + } + + } + if(!collList.isEmpty()){ + collList.add(carInfoOne) + map.put(carInfoOne.id,collList) + } + } + return map + } + + /** + * 处理角度在0-360之间 + */ + fun dealAngle(angle:Double):Double{ + var tempAngle = angle + if(tempAngle < 0){ + tempAngle %= 360 + tempAngle += 360 + }else if(angle >= 360){ + tempAngle %= 360 + } + return tempAngle + } + + @JvmStatic + fun main(args: Array) { + val colllist = ArrayList() + colllist.add(CarInfo(1,112.57328025528763, 26.889715639334263, 1.18040,0)) +// colllist.add(CarInfo(1,28.025528763, 71.5639334263, 1.18040,0)) + colllist.add(CarInfo(2,112.57331961293521, 26.8896993761348, 1.18040,0)) +// colllist.add(CarInfo(2,31.961293521, 69.93761348, 1.18040,0)) +// val resultMap = checkCollision(0.0,0.0,colllist) +// for(key in resultMap.keys){ +// val buffer = StringBuffer() +// for(car in resultMap.getValue(key)){ +// buffer.append("${car.id}").append(",") +// } +// System.out.println("checkCollision--op:${key}--${buffer.toString()}") +// +// } + + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/InfoWindowParams.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/InfoWindowParams.kt new file mode 100644 index 0000000000..644a1a5a02 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/InfoWindowParams.kt @@ -0,0 +1,11 @@ +package com.zhidaoauto.map.sdk.open.marker + +import android.view.View + +class InfoWindowParams { + var infoWindowType:Int = 2 + var infoWindow: View? = null + var infoContent:View? = null + var infoWindowUpdateTime:Long? = null + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/Marker.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/Marker.kt new file mode 100644 index 0000000000..23fe03d9c8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/Marker.kt @@ -0,0 +1,902 @@ +package com.zhidaoauto.map.sdk.open.marker + + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.Rect +import android.os.Handler +import android.os.Looper +import android.os.Message +import android.text.TextUtils +import android.util.Log +import android.view.View +import android.view.ViewGroup +import android.widget.FrameLayout +import android.widget.TextView +import com.alibaba.fastjson.JSON +import com.autonavi.nge.map.LonLat +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.abs.IMarkerCall +import com.zhidaoauto.map.sdk.inner.marker.IInfoViewClick +import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +import com.zhidaoauto.map.sdk.inner.utils.MathUtils +import com.zhidaoauto.map.sdk.open.abs.marker.InfoWindowAdapter +import com.zhidaoauto.map.sdk.open.abs.marker.MarkerAnimationListener +import com.zhidaoauto.map.sdk.open.abs.marker.OnMarkerDragListener +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.tools.MD5Utils +import com.zhidaoauto.map.sdk.open.tools.MapTools +import org.json.JSONArray +import org.json.JSONObject +import kotlin.math.absoluteValue + + +public class Marker(private var markerOptions: MarkerOptions,private var mMapController: IMapController?,private var mMarkerCall:IMarkerCall?) { + private val TAG = javaClass.simpleName + private var id: String + private var mSaveBitmapEnable: Boolean = false + + + private val ANIMATION_FULL: Int = 0 + private val ANIMATION_TRANSLATE: Int = 1 + private val ANIMATION_SCALE: Int = 2 + private val ANIMATION_ROTATE: Int = 3 + private val ANIMATION_FLASH: Int = 4 + private val MSG_DEAL_LISTENER = 0 + private val START_ANIMATION = 0 + private val END_ANIMATION = 1 + + var mObject: Any? = null + + private var mInfoWindowAdapter: InfoWindowAdapter? = null + private var markerAnimationListenerList: ArrayList? = null + private var markerAnimationMap: HashMap = HashMap() + private var isExecuteAnimation: Boolean = false + + private var historyLocationList: ArrayList? = null + + private var mHandler: Handler = object : Handler(Looper.getMainLooper()) { + override fun handleMessage(msg: Message?) { + super.handleMessage(msg) + var type = msg?.arg1 + var animation: Animation? = markerAnimationMap.get(type) + animation?.let { + var listener: MarkerAnimationListener? = animation.getAnimationListener() + when (msg?.arg2) { + START_ANIMATION -> { + listener?.onAnimationStart(it) + } + END_ANIMATION -> { + listener?.onAnimationEnd(it) + markerAnimationMap.remove(type) + } + else -> { + + } + } + } + + + } + } + + init { + id = markerOptions.getId() + } + + fun setOnMarkClickListener(onMarkClickListener: OnMarkClickListener?) { + mMarkerCall?.addMarkClickListener(id, onMarkClickListener) + } + + fun setOnMarkerDragListener(onMarkerDragListener: OnMarkerDragListener?) { + mMarkerCall?.addMarkDragListener(id, onMarkerDragListener) + } + + fun setOnInfoWindowClickListener(onInfoWindowClickListener: OnInfoWindowClickListener?) { + mMarkerCall?.addInfoWindowClickListener(id, onInfoWindowClickListener) + } + + fun setMarkerOptions(markerPtions: MarkerOptions) { + this.markerOptions = markerOptions + mMapController?.updateAnchorByJson(id, JSON.toJSONString(markerPtions), ByteArray(0), 0, 0) + } + + fun getMarkeOptions(): MarkerOptions? { + return markerOptions + } + + fun setMarkerInfoName(markerInfoName: String) { + markerOptions?.setMarkerInfoName(markerInfoName,mMapController,mMarkerCall) + } + + fun setClickable(clickable: Boolean) { + markerOptions?.clickable(clickable) + mMapController?.setSomeAnchorCanClickable(id, clickable) + } + + fun setScale(scale: Float) { + markerOptions?.scale(scale) + mMapController?.updateAnchorProperty(id,"scale","${markerOptions?.scale ?: scale}") + } + + fun getClickable(): Boolean { + return markerOptions?.isClickable()!! + } + + fun setSaveBitmapEnable(enable: Boolean) { + mSaveBitmapEnable = enable + } + + //设置marker是否需要显示动画 + fun setDisplayAnimEnable(enable: Boolean) { + markerOptions?.displayAnimEnable(enable) + mMapController?.updateAnchorProperty(id, "isDisplayAnim", "${enable}") + } + + //设置marker动画停顿帧数 + fun setAnimWaitFrame(animWaitFrame: Int) { + markerOptions?.animWaitFrame(animWaitFrame) + mMapController?.updateAnchorProperty(id, "animWaitFrame", "${animWaitFrame}") + } + + //设置marker动画资源 + fun setAnimResource(resId: Int) { + markerOptions?.animMarkerRes(resId,mMapController) + markerOptions?.animAnchorResource?.let{ + mMapController?.updateAnchorProperty(id, "animAnchorResource", it) + } + } + + fun setAverageFlag(averageFlag: Int) { + markerOptions?.averageFlag(averageFlag) + mMapController?.updateAnchorProperty(id, "averageFlag", "${averageFlag}") + } + + //设置marker动画资源 + fun setAnimResourceStr(resStr: String) { + markerOptions?.animAnchorResource = resStr; + mMapController?.updateAnchorProperty(id, "animAnchorResource", resStr) + } + + fun setAnimType(animType: Int) { + markerOptions?.animType(animType) + mMapController?.updateAnchorProperty(id, "animType", "$animType") + } + + fun setAnchorType(anchorType: Int) { + markerOptions?.anchorType(anchorType) + mMapController?.updateAnchorProperty(id, "anchorType", "$anchorType") + } + + fun setAnchorShadow(anchorShadow: Int) { + markerOptions?.anchorShadow(anchorShadow) + mMapController?.updateAnchorProperty(id, "anchorShadow", "$anchorShadow") + } + + fun setColorType(colorType: Int) { + markerOptions?.colorType(colorType) + mMapController?.updateAnchorProperty(id, "colorType", "$colorType") + } + + + fun setchangeColorTime(changeColorTime: Float) { + markerOptions?.changeColorTime(changeColorTime) + mMapController?.updateAnchorProperty(id, "changeColorTime", "$changeColorTime") + } + + + fun setChangeColorAngle(changeColorAngle: Float) { + markerOptions?.changeColorAngle(changeColorAngle) + mMapController?.updateAnchorProperty(id, "changeColorAngle", "$changeColorAngle") + } + + /** + * 更改marker的坐标 + */ + fun setPosition(latLng: LonLatPoint): Boolean { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-markerop-setPosition-${latLng},mMarker:${markerOptions?.getId()}") + } + markerOptions?.position(latLng) + return mMapController?.updateAnchorProperty(id, "lonLatPoint", + "${markerOptions?.getLonLatPoint()?.lon ?: latLng.longitude}, ${markerOptions?.getLonLatPoint()?.lat ?: latLng.latitude}")?:false + } + + + /** + * 更改marker的坐标 + */ + fun setPositionOnly(latLng: LonLatPoint) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-markerop-setPositionOnly-${latLng},mMarker:${markerOptions?.getId()}") + } + markerOptions?.position(latLng) + } + + /** + * 获取marker的位置(经纬度) + */ + fun getPosition(): LonLatPoint? { + if (isExecuteAnimation) { + val lonlstStr = mMapController?.getAnchorProperty(id, "lonLatPoint") + val lonlatArray = lonlstStr?.split(",")?.toTypedArray() + var lonLat:LonLat? = null + lonlatArray?.let{ + lonLat = LonLat(lonlatArray[0].toDouble(), lonlatArray[1].toDouble()) + } + lonLat?.let { + setPosition(CommonProxy.getInstance().getLonLatProxy().switchLonLat(it)) + } + } + return markerOptions?.getPosition() + } + + fun getLonLatOrigin(): LonLatPoint? { + return markerOptions?.getLonLatOrigin() + } + + /** + * 删除marker + */ + fun remove() { + mHandler.removeCallbacksAndMessages(null) + this.id = markerOptions.getId()?:"" + if (!TextUtils.isEmpty(id)) { + markerOptions?.reset() + mMapController?.removeAnchor(id) + mMarkerCall?.removeInfoViewClick(id) +// RecycleController.instance.removeRender(id) + id = "" + } + historyLocationList?.clear() + } + + fun destroy() { + historyLocationList?.clear() + } + + /** + * 获取marker的id + */ + fun getId(): String? { + return this.id + } + + /** + * 设置infowindow的标题 + */ + fun setTitle(title: String) { + markerOptions?.title(title) + mMapController?.updateAnchorProperty(id, "title", title) + if (markerOptions?.isInfoWindowEnable()!!) { + showInfoWindow() + } + } + + fun getTitle(): String? { + return mMapController?.getAnchorProperty(id, "title") + } + + /** + * 设置infowindow的内容 + */ + fun setSnippet(snippet: String) { + markerOptions?.snippet(snippet) + mMapController?.updateAnchorProperty(id, "snippet", snippet) + if (markerOptions?.isInfoWindowEnable() ?: true) { + showInfoWindow() + } + } + + //设置Marker覆盖物的InfoWindow是否允许显示,默认为false + fun setInfoWindowEnable(isEnable: Boolean) { + markerOptions?.infoWindowEnable(isEnable) + mMapController?.updateAnchorProperty(id, "infoWindowEnable", "$isEnable") + } + + fun startAnimation() { + mMarkerCall?.addAnimationListener(id, object : OnAnimationListener { + override fun onAnimationFinish(markerId: String, type: Int) { + isExecuteAnimation = false + dealMarkerAnimationListener(false, type) + val lonlstStr = mMapController?.getAnchorProperty(id, "lonLatPoint") + val lonlatArray = lonlstStr?.split(",")?.toTypedArray() + var lonLat:LonLat? = null + lonlatArray?.let{ + lonLat = LonLat(lonlatArray[0].toDouble(), lonlatArray[1].toDouble()) + } + lonLat?.let { + setPosition(CommonProxy.getInstance().getLonLatProxy().switchLonLat(it)) + } + } + }) + dealMarkerAnimationListener(true, ANIMATION_FULL) + mMapController?.startAnimation(id) + isExecuteAnimation = true + } + + /** + * 获取infowindow的内容 + */ + fun getSnippet(): String? { + return mMapController?.getAnchorProperty(id, "snippet") + } + + /** + * 更新marker的图片 + */ + fun setIcon(bitmap: Bitmap) { + markerOptions?.updateMarkerIcon(bitmap,mMapController) + } + + fun setIcon(view: View) { + BitmapDescriptorFactory.fromView(view).bitmap?.let { + markerOptions?.updateMarkerIcon(it,mMapController) + } + } + + fun marker3DIcon(resId: Int) { + markerOptions?.marker3DIcon(resId,mMapController)?.let { + setMarkerOptions(it) + } + } + + /** + * @param anchorU Marker覆盖物锚点在水平范围的比例 + * @param anchorV Marker覆盖物锚点在垂直范围的比例 + */ + fun setAnchor(anchorU: Float, anchorV: Float) { + markerOptions?.anchor(anchorU, anchorV) + mMapController?.updateAnchorProperty(id, "anchorUV", "${anchorU},${anchorV}" ) + } + + /** + * 隐藏infowindow + */ + fun hideInfoWindow() { + markerOptions?.setInfoWindowShown(false) + mMapController?.hideInfoWindow(id) + } + + /** + *返回Marker覆盖物的信息窗口是否显示,true: 显示,false: 不显示。 + */ + fun isInfoWindowShown(): Boolean { + return markerOptions?.isInfoWindowShown() ?: false + } + + /** + * marker是否可见 + */ + fun setVisible(visible: Boolean) { + markerOptions?.visible(visible) + mMapController?.updateAnchorProperty(id, "visible",visible.toString()) + } + + fun isVisible(): Boolean { + return mMapController?.getAnchorProperty(id,"visible")?.toBoolean()?:false + } + + /** + * marker的图片旋转角度 + */ + fun setRotateAngle(rotageAngle: Float) { + markerOptions?.rotateAngle(rotageAngle) + mMapController?.updateAnchorProperty(id,"rotateAngle","$rotageAngle") + } + + fun getRotateAngle(): Float { + return 360 - (mMapController?.getAnchorProperty(id,"rotateAngle")?.toFloat()?:0.0f) + } + + /** + * 设置marker的透明度 + */ + fun setAlpha(alpha: Float) { + markerOptions?.setAlpha(alpha) + mMapController?.updateAnchorProperty(id,"alpha","$alpha") + } + + fun getAlpha(): Float { + return mMapController?.getAnchorProperty(id,"alpha")?.toFloat()?:0.0f + } + + //设置多少帧刷新一次图片资源,Marker动画的间隔时间,值越小动画越快。 + fun setPeriod(period: Int) { + markerOptions?.period(period) + mMapController?.updateAnchorProperty(id,"period","$period") + } + + //设置infowindow偏移量 + fun setInfoWindowOffset(offsetX: Int, offsetY: Int) { + markerOptions?.setInfoWindowOffset(offsetX, offsetY) + mMapController?.setSomeAnchorInfowindowOffset(id, offsetX, offsetY) + } + + fun setInfoWindowView(infoView: View) { + markerOptions?.updateInfowindowView(infoView,mMapController) + } + + //设置marker置顶 + fun setToTop() { + mMapController?.setSomeAnchorTop(id) + } + + fun setUnTop() { + mMapController?.setSomeAnchorUnTop(id) + } + + //设置z轴的值 + fun setZIndex(zIndex: Int) { + markerOptions?.zIndex(zIndex) + mMapController?.setSomeAnchorZIndex(id, zIndex) + } + + + /** + * 设置3D锚点颜色 + * @param color "#RRGGBBAA" + */ + fun setAnchorColor(color: String) { + markerOptions?.anchorColor(color) + mMapController?.updateAnchorProperty(id, "anchorColor", color) + } + + //设置marker是否可以拖拽 + fun setDraggable(isDraggable: Boolean) { + markerOptions?.draggable(isDraggable) + mMapController?.updateAnchorProperty(id!!, "draggable", "$isDraggable") + } + + //设置marker是否需要方向 + fun setControlAngle(enable: Boolean) { + markerOptions?.controlAngle(enable) + mMapController?.updateAnchorProperty(id, "controlAngle", "$enable") + } + + + //设置marker是否可以拖拽 + fun getDraggable(): Boolean { + return mMapController?.getAnchorProperty(id,"draggable").toBoolean() + } + + //锚点多个经纬度移动轨迹 + fun startSmooth(points: List, duration: Int) { + if (points.size < 2) { + return + } + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--startSmooth--MarkerNativeInterface:start:${duration}") + } + val data = MapTools.listToArray(points, !(markerOptions?.isGps() ?: true)) + mMapController?.addTranslateAnimationToAnchor(id, data, duration) + startAnimation() + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--startSmooth--MarkerNativeInterface:over") + } + + } + + + //锚点多个经纬度移动轨迹 + fun startSmooth(points: List, duration: Int, animation: MarkerTranslateAnimation) { + if (points.size < 2) { + return + } + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--startSmooth--MarkerNativeInterface:start:${duration}") + } + addMarkerAnimation(animation) + val data = MapTools.listToArray(points, !(markerOptions?.isGps() ?: true)) + mMapController?.addTranslateAnimationToAnchor(id, data, duration) + startAnimation() + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--startSmooth--MarkerNativeInterface:over") + } + + } + + fun setGps(isGps: Boolean) { + markerOptions?.setGps(isGps) + } + + fun setFlat(flat: Boolean) { + markerOptions?.setFlat(flat) + mMapController?.setSomeAnchorFlat(id, flat) + } + + fun isFlat(): Boolean { + return markerOptions?.getFlat() ?: false + } + + fun setIcons(icons: ArrayList<*>) { + if(icons.isEmpty()){ + return + } + var animation = MarkerFlashAnimation(icons) + animation.setDuration(getPeriod().toLong()) + setFlashAnimation(animation) + startAnimation() + } + + //返回Marker动画帧的图标列表。 + fun getIcons(): ArrayList? { + return markerOptions?.getIcons() + } + + //设置marker覆盖物在屏幕的像素坐标 + fun setPositionByPixels(x: Int, y: Int) { + + } + + //得到多少帧刷新一次图片资源 + fun getPeriod(): Int { + return markerOptions?.period ?: 10 + } + + fun showInfoWindow() { + var infoWindowAdapter = mMapController?.getMarkerController()?.getInfoWindow() + if (infoWindowAdapter == null) { + return + } + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--matt--showInfoWindow--start:${id}") + } + val view = infoWindowAdapter.getInfoWindow(this) + view?.let { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--matt--showInfoWindow--view is not null") + } + var bitmapDescriptor = BitmapDescriptorFactory.fromView(it) + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--bitmap:${bitmapDescriptor.getBytes().size},${id}") + } + markerOptions?.setInfoWindowShown(true) + markerOptions?.infoWindowEnable(true) + + mMapController?.updateAnchorProperty(id, "infoWindowEnabled", "true") + mMapController?.updateAnchorProperty(id, "isInfoWindowShown", "true") + + markerOptions?.updateInfowindowBitmap(bitmapDescriptor,mMapController) + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--matt--showInfoWindow--bitmapDescriptor:${bitmapDescriptor.width},${bitmapDescriptor.height}") + } + mMarkerCall?.removeInfoViewClick(id) + dealInfoWindowViewClick(it) + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--matt--showInfoWindow--dealInfoWindowViewClick:over") + } + } + + } + + fun showIDInfoWindow(context:Context?) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--matt--showInfoWindow--start:${id}") + } + val view = TextView(context); + view.layoutParams = FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,FrameLayout.LayoutParams.WRAP_CONTENT) + view.textSize = 10.0f + view.text = id + view?.let { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--matt--showInfoWindow--view is not null") + } + var bitmapDescriptor = BitmapDescriptorFactory.fromView(it) + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--bitmap:${bitmapDescriptor.getBytes().size},${id}") + } + markerOptions?.setInfoWindowShown(true) + markerOptions?.infoWindowEnable(true) + + + mMapController?.updateAnchorProperty(id, "infoWindowEnabled", "true") + mMapController?.updateAnchorProperty(id, "isInfoWindowShown", "true") + + markerOptions?.updateInfowindowBitmap(bitmapDescriptor,mMapController) + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--matt--showInfoWindow--bitmapDescriptor:${bitmapDescriptor.width},${bitmapDescriptor.height}") + } + mMarkerCall?.removeInfoViewClick(id) + dealInfoWindowViewClick(it) + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--matt--showInfoWindow--dealInfoWindowViewClick:over") + } + } + + } + + + + private fun dealInfoWindowViewClick(view: View) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--matt--dealInfoWindowViewClick-start") + } + if (view is ViewGroup) { + view as ViewGroup + for (index in 0 until view.childCount) { + val child = view.getChildAt(index) + if (child is ViewGroup) { + dealInfoWindowViewClick(child, child.left, child.top) + } + if (child.hasOnClickListeners()) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--matt--dealInfoWindowViewClick:${Rect(child.left, child.top, child.right, child.bottom)},child:${child}") + } + mMarkerCall?.addInfoViewClick(id, Rect(child.left, child.top, child.right, child.bottom), object : IInfoViewClick { + override fun click() { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--dealInfoWindowViewClick-onInfoWindowClick:${child}") + } + child.performClick() + } + + }) + } + + } + } + } + + + private fun dealInfoWindowViewClick(view: View, left: Int, top: Int) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--matt--dealInfoWindowViewClick-start:${view},${left},${top}") + } + if (view is ViewGroup) { + view as ViewGroup + for (index in 0 until view.childCount) { + val child = view.getChildAt(index) + if (child.hasOnClickListeners()) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--matt--dealInfoWindowViewClick:${Rect(child.left + left, child.top + top, child.right + left, child.bottom + top)},child:${child}") + } + if (child is ViewGroup) { + dealInfoWindowViewClick(child, child.left + left, child.top + top) + } + mMarkerCall?.addInfoViewClick(id, Rect(child.left + left, child.top + top, child.right + left, child.bottom + top), object : IInfoViewClick { + override fun click() { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--dealInfoWindowViewClick-onInfoWindowClick:${child}") + } + child.performClick() + } + + }) + } + + } + } + } + + fun addDynamicAnchorPostion(lonLatPoint: LonLatPoint, current:Long,duration: Int) { + addDynamicAnchorPostion(lonLatPoint, current, duration,1f,-1f) + } + + fun addDynamicAnchorPostion(lonLatPoint: LonLatPoint, current:Long,duration: Int,forecastMultiples:Float,ruleAngle:Float) { + if(lonLatPoint.longitude <=0 || lonLatPoint.latitude<=0){ + return + } + markerOptions?.let { + + if(ruleAngle != -1f){ + val currentAngle = it.getRotateAngle() + var desAngle = lonLatPoint.angle + while(desAngle - currentAngle > 180){ + desAngle -= 360; + } + while(desAngle - currentAngle < -180){ + desAngle += 360; + } + if((currentAngle-desAngle).absoluteValue >= ruleAngle){ + mMapController?.endAnimation(id) + setRotateAngle(lonLatPoint.angle.toFloat()) + setPosition(lonLatPoint) + return@let + } + } + it.rotateAngle(lonLatPoint.angle.toFloat()) + + var lonlatpoints: ArrayList = ArrayList() + var nextLonLatPoint = LonLatPoint(lonLatPoint.longitude,lonLatPoint.latitude,lonLatPoint.altitude,lonLatPoint.angle) + var dur = duration + if(forecastMultiples > 1f){ + it.getPosition()?.let{current -> + val dis = MathUtils.distance(current,lonLatPoint).times(forecastMultiples-1) + val forecastLonLatPoint = MathUtils.calucateNewPoint(lonLatPoint.longitude,lonLatPoint.latitude,lonLatPoint.angle,dis.toFloat()) + forecastLonLatPoint?.let {forecast-> + nextLonLatPoint = forecast + dur = duration.times(forecastMultiples).toInt() + } + } + } + lonlatpoints.add(nextLonLatPoint) + it.position(lonLatPoint) + val data = MapTools.listToArray(lonlatpoints,!it.isGps()) + mMapController?.addDynamicAnchorPostion(id, data,lonLatPoint.angle.toFloat(),current, dur) + } + } + + + + fun setTranslateAnimation(animation: MarkerTranslateAnimation) { + markerOptions?.let { + var duration = animation.getDuration().toInt() + addMarkerAnimation(animation) + val data = MapTools.listToArray(animation.getLonlatPoint(), !(markerOptions?.isGps() ?: true)) + mMapController?.addTranslateAnimationToAnchor(id, data, duration) + } + } + + fun setMarkerScaleAnimation(animation: MarkerScaleAnimation) { + var duration = animation.getDuration().toInt() + addMarkerAnimation(animation) + mMapController?.addScaleAnimationToAnchor(id, animation.scaleStart, animation.scaleEnd, duration) + } + + + private fun addMarkerAnimation(animation: Animation) { + animation.getAnimationListener()?.let { + when (animation) { + is MarkerTranslateAnimation -> + markerAnimationMap.put(ANIMATION_TRANSLATE, animation) + + is MarkerScaleAnimation -> + markerAnimationMap.put(ANIMATION_SCALE, animation) + + is MarkerFlashAnimation -> + markerAnimationMap.put(ANIMATION_FLASH, animation) + + is MarkerRotateAnimation -> + markerAnimationMap.put(ANIMATION_ROTATE, animation) + + else -> { + + } + } + } + } + + /** + * 处理动画监听事件的调用 + *startOrFinish true=开始 false = 结束 + * type 0 =全部,1=平移 2=缩放 + */ + private fun dealMarkerAnimationListener(startOrFinish: Boolean, type: Int) { + if (markerAnimationMap.isNullOrEmpty()) { + return + } + when (type) { + ANIMATION_FULL -> { + var listener: MarkerAnimationListener? = null + markerAnimationMap.forEach { + listener = it.value.getAnimationListener() + if (startOrFinish) { + listener?.onAnimationStart(it.value) + } +// else { +// listener?.onAnimationEnd(it.value) +// } + } + } + else -> { + var msg = Message() + msg.what = MSG_DEAL_LISTENER + msg.arg1 = type + if (startOrFinish) { + msg.arg2 = START_ANIMATION + } else { + msg.arg2 = END_ANIMATION + } + mHandler.sendMessage(msg) + + } + } + + } + + + private fun setFlashAnimation(animation: MarkerFlashAnimation) { + var jsonObject = JSONObject() + var jsonArray = JSONArray() + val duration = animation.getDuration().toInt() + if(markerOptions?.vrIcon!!) { + val icons3D = animation.getIcons() as ArrayList + if (icons3D != null && icons3D.size <= 10 && icons3D.size > 0) { + for (icon in icons3D) { + mMapController?.getContext()?.let {context-> + var markerView = BitmapDescriptorFactory.from3DResource(context, icon) + markerView?.let { + MD5Utils.getInstanse() + var anchor3dName = MD5Utils.getMD5String(markerView) + val markerIconName = anchor3dName + if (!(mMarkerCall?.containMarkerIcon(markerIconName)?:true)) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--marker3DIcon--addImagetoImageManager:${markerIconName},${markerView.size}") + } + val result = mMapController?.addImage( + markerIconName, + markerView, + markerView.size, + 0 + )?:-1 + if (result == 0) { + mMarkerCall?.addMarkerIcon(markerIconName) + } + } + jsonArray.put(markerIconName) + } + } + + } + }else{ + throw RuntimeException("最多支持10个3D模型") + } + }else { + val icons = animation.getIcons() as ArrayList + if (icons != null) { + for (icon in icons) { + var markerView = icon.getBytes() + MD5Utils.getInstanse() + var markerIconName = MD5Utils.getMD5String(markerView) + if (!(mMarkerCall?.containMarkerIcon(markerIconName)?:true)) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--setIcon--addImagetoImageManager:${markerIconName}") + } + val result = mMapController?.addImage( + markerIconName, + markerView, + icon.width, icon.height + )?:-1 + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--setIcon--addImagetoImageManager:${markerIconName},result:${result},threadop:${Thread.currentThread().id}") + } + if (result == 0) { + mMarkerCall?.addMarkerIcon(markerIconName) + } + } + jsonArray.put(markerIconName) + } + } + } + jsonObject.put("images", jsonArray) + val images = jsonObject.toString() + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--addFlashAnimationToAnchorPoint--id: ${id}, images: ${images}, duration: ${duration}") + } + addMarkerAnimation(animation) + mMapController?.addFlashAnimationToAnchor(id, images, duration) + } + + + fun setRotateAnimation(animation: MarkerRotateAnimation) { + addMarkerAnimation(animation) + mMapController?.addRotateAnimationToAnchor(id, animation.getStartAng(), animation.getEndAng(), animation.getDuration().toInt()) + } + + override fun toString(): String { + return "Marker(id='$id', markerOptions=$markerOptions)" + } + + + fun isAnchorDynamicMoving():Boolean{ + return mMapController?.isAnchorDynamicMoving(id)?:false + } + + /** + * @param colorType 上色类型 1=由原色变为指定色 2=由指定色变为原色 + * @param color 颜色 + * @param time 渐变过程时间 + * @param angle 角度 范围(0,90,180,270) + */ + fun setMarkerFlash(colorType: Int, color: String, time: Float, angle: Float){ + markerOptions?.colorType(colorType) + markerOptions?.anchorColor(color) + markerOptions?.changeColorTime(time) + markerOptions?.changeColorAngle(angle) + mMapController?.setAnchorFlash(id, colorType, color, time, angle) + + } + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerBatchData.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerBatchData.kt new file mode 100644 index 0000000000..f104d68729 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerBatchData.kt @@ -0,0 +1,20 @@ +package com.zhidaoauto.map.sdk.open.marker + + +class MarkerBatchData { + //自车相关属性 + var centerMarkerOptions:MarkerSimpleOptions? = null + var others:ArrayList? = null + + fun copy(): MarkerBatchData { + val dataSet = MarkerBatchData() + dataSet.centerMarkerOptions =centerMarkerOptions + dataSet.others = others + return dataSet + } + + override fun toString(): String { + return "MarkerDataSet(centerMarkerOptions=$centerMarkerOptions, others=${others?.size})" + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerCacheController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerCacheController.kt new file mode 100644 index 0000000000..578ee1269c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerCacheController.kt @@ -0,0 +1,579 @@ +package com.zhidaoauto.map.sdk.open.marker + +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.utils.GisGeomTool +import com.zhidaoauto.map.sdk.inner.utils.MathUtils +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.view.MapAutoView +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.CopyOnWriteArrayList + + +class MarkerCacheController(private val mapAutoView: MapAutoView) { + private val TAG = javaClass.simpleName + + private var taskJob: Job? = null + var cacheInterval = 300 + private var exit: Boolean = false + + //设置是否开启更新锚点策略,默认关闭 + var delayStrategy: Boolean = false + + //设置是否插值策略,默认关闭 + var interStrategy: Boolean = false + + //设置每次轮询等待时间,默认20ms + var delayTime: Long = 20 + + //设置不执行动画角度(大于该角度不执行动画),默认8 + var ruleAngle: Float = 8f + + //控制资源传入是固定值还是资源编号 1= 固定值 0 =资源编号 + var controlIcon: Int = 1 + + //设置数据策略 + var dataStrategy: Boolean = false + + //设置删除策略 + var deleteStrategy: Boolean = true + + //插值间隔 + private val INTERPOLATION_INTERVAL = 50 + + //上一次addCache时对应的时间 + private var lastPreTime = 0L + + //显示infowindow + var showInfo: Boolean = true + + init { + lastPreTime = 0L + exit = false + lastPreTime = 0L + } + + //时间列表 + private val timeList: CopyOnWriteArrayList = CopyOnWriteArrayList() + + // 按时间存的数据缓存池 + private val cacheMap: ConcurrentHashMap = + ConcurrentHashMap() + + //按照id存储的他车数据 + private val preMarkerMap: HashMap = HashMap() + + //按照时间存储自车数据 + private val selfMarkerMap: HashMap = HashMap() + + // 按时间存的数据缓存池 + private val cacheDataSetMap: ConcurrentHashMap = + ConcurrentHashMap() + + private fun parseDataSet(dataStr: String?): ArrayList? { + if (dataStr == null || dataStr.length < 1) { + return null + } + var dataStrTemp = dataStr.substring(0, dataStr.length - 1) + val array = dataStrTemp.split(",") + if (array.isEmpty() || array.size % 7 != 0) { + return null + } + //id,lon,lat,alt,angle,model,duration + val resultList = ArrayList() + + for (i in 0 until array.size step 7) { + var markerSimpleData = MarkerSimpleData() + markerSimpleData.id = array[i].toLong() + markerSimpleData.lon = array[i + 1].toDouble() + markerSimpleData.lat = array[i + 2].toDouble() + markerSimpleData.alt = array[i + 3].toDouble() + markerSimpleData.rotateAngle = array[i + 4].toFloat() + markerSimpleData.markerType = array[i + 5].toInt() + markerSimpleData.duration = array[i + 6].toInt() + resultList.add(markerSimpleData) + } + return resultList + } + +// fun addCache(dataSet: MarkerDataSet?) { +// if(dataSet == null){ +// return +// } +// val temp = dataSet.copy() +// val current = System.currentTimeMillis() +// cacheMap.put(current,temp); +// timeList.add(current) +// if(CompileConfig.DEBUG){ +// Log.i(TAG, "MarkerRecycleController--cacheMap: ${cacheMap.size},timeList:${timeList.size},arrayList:${temp}") +// } +// } + + var dis: Double = 0.0 + var lastLon: Double = 0.0 + var lastLat: Double = 0.0 + + fun addCache(dataSet: MarkerDataSet?) { + if(taskJob == null){ + execute() + } + if (dataSet == null) { + return + } +// if(CompileConfig.DEBUG){ +// dataSet.centerMarkerOptions?.let{ +// if(lastLon>0 && lastLat>0){ +// dis = MathUtils.distance(lastLon,lastLat,it.lon,it.lat) +// } +// lastLon = it.lon +// lastLat = it.lat +// RecorderUtils.i("selflog","${System.currentTimeMillis()},${it.lon},${it.lat},${it.rotateAngle},${dis}") +// dis = 0.0 +// } +// +// } + if (interStrategy) { + val arrayList: ArrayList? = parseDataSet(dataSet.others) + val batchData = MarkerBatchData() + batchData.centerMarkerOptions = dataSet.centerMarkerOptions + batchData.others = arrayList + addCache(batchData) + } else { + val temp = dataSet.copy() + val current = System.currentTimeMillis() + timeList.add(current) +// timeList.sort() + cacheMap.put(current, temp); + } + + } + + @Synchronized + fun addCache(originBatchData: MarkerBatchData?) { + if(taskJob == null){ + execute() + } + if (CompileConfig.DEBUG) { + Log.i(TAG, "addCache:life-start") + } + if (originBatchData == null) { + return + } + var batchData = originBatchData.copy() + val current = System.currentTimeMillis() + val arrayList = batchData.others + if (arrayList == null || arrayList.isEmpty()) { + cacheDataSetMap.put(current, batchData) + timeList.add(current) + batchData.centerMarkerOptions?.let { + val simpleData = MarkerSimpleData() + simpleData?.lon = it.lon + simpleData?.lat = it.lat + simpleData?.alt = it.alt + simpleData?.rotateAngle = it.rotateAngle + simpleData?.time = current + preMarkerMap[current] = simpleData + } + return + } + //先预存时间 +// if(timeList.size>1){ +// val preTime = timeList.last() +// var duration = INTERPOLATION_INTERVAL +// while((preTime+duration)= 1 && lastPreTime > 0L) { + var preTime = lastPreTime + if (preTime > 0L) { + var duration = INTERPOLATION_INTERVAL + while ((preTime + duration) < current) { + timeList.add(preTime + duration) + duration = duration + INTERPOLATION_INTERVAL + } + } + } + //按照时间存储他车补帧数据 + val interpolationDataSetMap: HashMap> = + HashMap>() + batchData.centerMarkerOptions?.time = current + lastPreTime = current + for (markerOptions in arrayList) { + val id = markerOptions.id + + val markerSimpleData = MarkerSimpleData() + markerSimpleData.id = id + markerSimpleData.lon = markerOptions.lon + markerSimpleData.lat = markerOptions.lat + markerSimpleData.alt = markerOptions.alt + markerSimpleData.markerType = markerOptions.markerType + markerSimpleData.rotateAngle = markerOptions.rotateAngle + markerSimpleData.time = current + markerSimpleData.color = markerOptions.color + markerSimpleData.text = markerOptions.text + markerSimpleData.status = markerOptions.status + + if (preMarkerMap.containsKey(id)) { + // pre data + val preMarkerOptions = preMarkerMap.get(id)!! + // 距离 + val disInterval = MathUtils.distance( + preMarkerOptions.lon, + preMarkerOptions.lat, + markerSimpleData.lon, + markerSimpleData.lat + ) + + //帧间隔 + val timeInterval = current - preMarkerOptions.time +// if(CompileConfig.DEBUG){ +// Log.i(TAG, "addCache--id:${id},timeInterval: ${timeInterval},disInterval:${disInterval}") +// } + + for (time in timeList) { + if (time < preMarkerOptions.time) { + continue + } + var duration = (time - preMarkerOptions.time).toInt() + + // 每次插值离首点(pre)距离 + val stepDistance = (disInterval * duration) / timeInterval.toDouble() + val angle = GisGeomTool.GetLineAngle( + preMarkerOptions.lon, + preMarkerOptions.lat, + markerSimpleData.lon, + markerSimpleData.lat + ) +// if(CompileConfig.DEBUG){ +// Log.i(TAG, "getSelfInterceptionData--id:,stepDistance: ${stepDistance},front:${preMarkerOptions.rotateAngle},end:${markerSimpleData.rotateAngle},angle:${angle}") +// } + + var newLonLatPoint = MathUtils.calucateNewPoint( + preMarkerOptions.lon, preMarkerOptions.lat, + angle, stepDistance.toFloat() + ) + if (newLonLatPoint == null) { + newLonLatPoint = LonLatPoint(preMarkerOptions.lon, preMarkerOptions.lat) + } + val tempSimpleData = MarkerSimpleData() + tempSimpleData.id = markerSimpleData.id + tempSimpleData.lon = newLonLatPoint.longitude + tempSimpleData.lat = newLonLatPoint.latitude + tempSimpleData.alt = markerSimpleData.alt + tempSimpleData.rotateAngle = markerSimpleData.rotateAngle + tempSimpleData.markerType = markerSimpleData.markerType + tempSimpleData.color = markerSimpleData.color + tempSimpleData.text = markerSimpleData.text + tempSimpleData.status = markerSimpleData.status + var tempList = interpolationDataSetMap.get(time) + if (tempList == null) { + tempList = ArrayList() + } + tempList.add(tempSimpleData) + interpolationDataSetMap.put(time, tempList) + } + + } + preMarkerMap[id] = markerSimpleData + } + + for ((key, list) in interpolationDataSetMap) { + var markerBatchData = cacheDataSetMap.get(key) + if (markerBatchData == null) { + markerBatchData = MarkerBatchData() + markerBatchData.centerMarkerOptions = + getSelfInterceptionData(key, current, batchData.centerMarkerOptions) + markerBatchData.others = list + cacheDataSetMap[key] = markerBatchData + } else { + if (list.isEmpty()) { + continue + } + val tempList = markerBatchData.others + tempList?.addAll(list) + markerBatchData.others = tempList + cacheDataSetMap[key] = markerBatchData + } +// if(CompileConfig.DEBUG){ +// Log.i(TAG, "addCache--interpolationDataSetMap: ${interpolationDataSetMap.size}--list:${cacheDataSetMap[key]?.others?.size}") +// } + } + + interpolationDataSetMap.clear() + timeList.add(current) +// timeList.sort() + cacheDataSetMap.put(current, batchData) + val preIt = preMarkerMap.keys.iterator() + while (preIt.hasNext()) { + val key = preIt.next() + val value = preMarkerMap[key] + value?.let { + if (System.currentTimeMillis() - it.time >= cacheInterval) { + preIt.remove() + } + } + + } + batchData.centerMarkerOptions?.let { + val simpleData = MarkerSimpleData() + simpleData?.lon = it.lon + simpleData?.lat = it.lat + simpleData?.alt = it.alt + simpleData?.rotateAngle = it.rotateAngle + simpleData?.time = current +// simpleData?.markerType = it.markerIconName.toInt() + selfMarkerMap.put(current, simpleData) + } + + val selfIt = selfMarkerMap.keys.iterator() + while (selfIt.hasNext()) { + val key = selfIt.next() + if (System.currentTimeMillis() - key >= cacheInterval) { + selfIt.remove() + } + + } + if (CompileConfig.DEBUG) { + Log.i( + TAG, + "addCache--life-end: ${cacheDataSetMap.size},timeList:${timeList.size},preMarkerMap:${preMarkerMap.size},cost: ${System.currentTimeMillis() - current}" + ) + } + + } + + //自车上下帧插值 + private fun getSelfInterceptionData( + time: Long, + current: Long, + markerSimpleOptions: MarkerSimpleOptions? + ): MarkerSimpleOptions? { + var choiceKey: Long = 0L + for ((key, value) in selfMarkerMap) { + if (key <= time && key >= current) { + if (choiceKey == 0L) { + choiceKey = key + } else { + if (choiceKey < key) { + choiceKey = key + } + } + + } + } + if (choiceKey == 0L || markerSimpleOptions == null) { + return markerSimpleOptions + } + val selfMarkerSimpleData = selfMarkerMap.get(choiceKey) + + selfMarkerSimpleData?.let { + // 距离 + val disInterval = + MathUtils.distance(it.lon, it.lat, markerSimpleOptions.lon, markerSimpleOptions.lat) + if (disInterval > 0.0) { + //帧间隔 + val timeInterval = markerSimpleOptions.time - it.time + val duration = time - it.time + if (duration <= 0) { + val interMarker = MarkerSimpleOptions(markerSimpleOptions.id) + interMarker.lon = it.lon + interMarker.lat = it.lat + interMarker.alt = it.alt + interMarker.rotateAngle = it.rotateAngle + interMarker.time = time + return interMarker + } + if (duration > 0 && duration < timeInterval) { + // 每次插值离首点(pre)距离 + val stepDistance = (disInterval * duration) / timeInterval.toDouble() + + val angle = GisGeomTool.GetLineAngle( + it.lon, + it.lat, + markerSimpleOptions.lon, + markerSimpleOptions.lat + ) + val newLonLatPoint = + MathUtils.calucateNewPoint(it.lon, it.lat, angle, stepDistance.toFloat()) + if (newLonLatPoint != null) { + val interMarker = MarkerSimpleOptions(markerSimpleOptions.id) + interMarker.lon = newLonLatPoint.longitude + interMarker.lat = newLonLatPoint.latitude + interMarker.alt = markerSimpleOptions.alt + interMarker.rotateAngle = markerSimpleOptions.rotateAngle + interMarker.time = time + return interMarker + } + + } + } + } + return markerSimpleOptions + + } + + fun destory() { + exit = true + taskJob?.cancel() + taskJob = null + timeList.clear() + cacheMap.clear() + cacheDataSetMap.clear() + lastPreTime = 0L + } + + private var lastTime = 0L + + @Synchronized + private fun execute() { + taskJob?.cancel() + taskJob = mapAutoView.getMapController()?.getDemaningScope()?.launch(Dispatchers.IO) { + while (!exit) { + + if (dataStrategy) { + if (!timeList.isEmpty() && !cacheMap.isEmpty()) { + for (frameTime in timeList) { + if (System.currentTimeMillis() - frameTime >= cacheInterval) { + val dataSet = cacheMap.remove(frameTime) + if (lastTime != frameTime) { + updateMarker(dataSet) + lastTime = frameTime + } + timeList.remove(frameTime) + } else { + break + } + } + } else { + lastPreTime = 0L + } + + } else { + if (!timeList.isEmpty() && !cacheDataSetMap.isEmpty()) { + for (frameTime in timeList) { + if (System.currentTimeMillis() - frameTime >= cacheInterval) { + val dataSet = cacheDataSetMap.remove(frameTime) + if (lastTime != frameTime) { + updateMarker(dataSet) + lastTime = frameTime + } + timeList.remove(frameTime) + } else { + break + } + } + } else { + lastPreTime = 0L + } + } + + + delay(delayTime) + } + } + + } + + private var mLastLocationTime = 0L + private var duration: Int = 0 + + private fun updateMarker(batchData: MarkerBatchData?) { + if (batchData == null) { + return + } + val markerOptions = batchData.centerMarkerOptions + if (CompileConfig.DEBUG) { + Log.i(TAG, "updateMarker:others: ${batchData.others?.size}") + } + if (mLastLocationTime > 0L) { + duration = (System.currentTimeMillis() - mLastLocationTime).toInt() + } else { + duration = 100; + } + mLastLocationTime = System.currentTimeMillis() + if (batchData.others != null) { + val list = ArrayList(batchData.others) + val batchMarkerOptions = BatchMarkerOptions() + batchMarkerOptions.list = list + batchMarkerOptions.delayStrategy = delayStrategy + batchMarkerOptions.ruleAngle = ruleAngle + batchMarkerOptions.controlIcon = controlIcon + batchMarkerOptions.duration = duration + batchMarkerOptions.deleteRule = if (deleteStrategy) { + 1 + } else { + 0 + } + batchMarkerOptions.showInfo = if (showInfo) { + 1 + } else { + 0 + } + mapAutoView.getMarkerController()?.updateBatchMarkerPositon(batchMarkerOptions) + } + if (markerOptions != null) { + val lonLatPoint = LonLatPoint(markerOptions.lon, markerOptions.lat) + lonLatPoint.duration = duration + lonLatPoint.speed = markerOptions.speed + lonLatPoint.angle = markerOptions.rotateAngle.toDouble() + mapAutoView.getLocationClient()?.updateLocation(lonLatPoint) + + } + + } + + + private fun updateMarker(dataSet: MarkerDataSet?) { + if (dataSet == null) { + return + } + if (CompileConfig.DEBUG) { + Log.i(TAG, "MarkerRecycleController--updateMarker: ${dataSet}") + } + var localDataSet = dataSet.copy() + if (localDataSet.others == null) { + return + } + if (mLastLocationTime > 0L) { + duration = (System.currentTimeMillis() - mLastLocationTime).toInt() + } else { + duration = 100; + } + mLastLocationTime = System.currentTimeMillis() + val satelliteTime: Long = + localDataSet.centerMarkerOptions?.satelliteTime ?: System.currentTimeMillis() + val batchMarkerOptions = BatchMarkerOptions() + batchMarkerOptions.othersStr = localDataSet.others!! + batchMarkerOptions.delayStrategy = delayStrategy + batchMarkerOptions.ruleAngle = ruleAngle + batchMarkerOptions.controlIcon = controlIcon + batchMarkerOptions.satelliteTime = satelliteTime + batchMarkerOptions.deleteRule = if (deleteStrategy) { + 1 + } else { + 0 + } + mapAutoView.getMarkerController()?.updateBatchMarkerPositon(batchMarkerOptions) + val markerOptions = localDataSet.centerMarkerOptions + if (markerOptions != null) { + val lonLatPoint = LonLatPoint(markerOptions.lon, markerOptions.lat) + lonLatPoint.duration = duration + lonLatPoint.angle = markerOptions.rotateAngle.toDouble() + lonLatPoint.speed = markerOptions.speed + if (CompileConfig.DEBUG) { + Log.i(TAG, "MarkerRecycleController--updateMarker: ${lonLatPoint}") + } + mapAutoView.getLocationClient()?.updateLocation(lonLatPoint) + } + + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerController.kt new file mode 100644 index 0000000000..aa9e6a691c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerController.kt @@ -0,0 +1,328 @@ +package com.zhidaoauto.map.sdk.open.marker + +import android.util.Log +import com.alibaba.fastjson.JSON +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.abs.IMarkerCall +import com.zhidaoauto.map.sdk.inner.abs.IMarkerController +import com.zhidaoauto.map.sdk.inner.marker.MarkerNativeInterface +import com.zhidaoauto.map.sdk.inner.utils.OperationUtils +import com.zhidaoauto.map.sdk.open.abs.OnRenderListener +import com.zhidaoauto.map.sdk.open.abs.marker.InfoWindowAdapter +import com.zhidaoauto.map.sdk.open.data.MapDataApi +import com.zhidaoauto.map.sdk.open.tools.MD5Utils +import org.json.JSONArray +import org.json.JSONObject + + +class MarkerController: IMarkerController { + + private val TAG = javaClass.simpleName + + private lateinit var mMapController: IMapController + private lateinit var mMarkerCall: IMarkerCall + + constructor(mapController: IMapController){ + this.mMapController = mapController + this.mMarkerCall = MarkerNativeInterface(mMapController) + this.mMapController.setMarkerCall(this.mMarkerCall) + } + + + private var mLastBatchSatelliteTime:Long = 0L + + private var infoWindowAdapter: InfoWindowAdapter? = null + + override fun setInfoWindow(infoWindowAdapter: InfoWindowAdapter) { + mMapController?.getClerk()?.add() + this.infoWindowAdapter = infoWindowAdapter + } + + override fun getInfoWindow(): InfoWindowAdapter? { + mMapController?.getClerk()?.add() + return infoWindowAdapter + } + + override fun addMarker(markerOptions: MarkerOptions): Marker? { + mMapController?.getClerk()?.add("$markerOptions") + var marker: Marker + var isSuccess = false + var jsonStr = toJson(markerOptions) + if (CompileConfig.DEBUG) { + Log.d(TAG, "markerop--addMarker:${jsonStr}") + } + isSuccess = mMapController.addAnchor( + jsonStr, + byteArrayOf(), + 0, + 0 + ) ?: false + if (CompileConfig.DEBUG) { + Log.d(TAG, "markerop--addMarker:over--shakeSceneManual") + } + if (isSuccess) { + marker = Marker(markerOptions,mMapController,mMarkerCall) +// RecycleController.instance.addRender(markerOptions.getId()) + val icons = marker.getIcons() + if(icons != null){ + var jsonObject = JSONObject() + var jsonArray = JSONArray(icons) + jsonObject.put("images", jsonArray) + val images = jsonObject.toString() + marker.getId()?.let { + mMapController.addFlashAnimationToAnchor(it, images, marker.getPeriod()) + mMapController.startAnimation(it) + } + + } + return marker + } + return null + } + + private fun toJson(markerOptions: MarkerOptions): String { + return JSON.toJSONString(markerOptions) + + } + + + override fun addSelfCar(markerOptions: MarkerOptions): Marker? { + mMapController?.getClerk()?.add() + val jsonStr = toJson(markerOptions) + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop--selfop---markerop--addSelfCar: ${jsonStr}") + } + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop--selfop---markerop--addSelfCar mapView is not null") + } + val flag = mMapController.createConstAnchor( + jsonStr, + byteArrayOf(), + 0, + 0 + )?: false + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop--selfop---markerop--addSelfCar ${flag}") + } + if(flag){ + var marker = Marker(markerOptions,mMapController, mMarkerCall) + return marker + } + return null + + } + + //添加多个锚点 + override fun addMarkers(multiPointOverlayOptions: MultiPointOverlayOptions): MultiPointController { + mMapController?.getClerk()?.add() + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--addMarkers::multiPointOverlayOptions:${multiPointOverlayOptions}") + } + var strJson = toJson(multiPointOverlayOptions) + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--addMarkers--toJson:${strJson}") + } + mMapController.addManyAnchorByJson( + strJson, + multiPointOverlayOptions.data.size + ) + var multiPointController = MultiPointController(multiPointOverlayOptions) + return multiPointController + } + + private fun toJson(markersController: MultiPointOverlayOptions): String { + return JSON.toJSONString(markersController) + } + + + + override fun destory(){ + mMapController?.getClerk()?.add() + mMarkerCall.exit() + infoWindowAdapter = null + } + + override fun removeMarker(id:String){ + mMapController?.getClerk()?.add("$id") + mMapController.removeAnchor(id) + mMarkerCall?.removeInfoViewClick(id) + } + + + /** + * 批量更新他车 + */ + override fun updateBatchMarkerPositon(batchMarkerOptions: BatchMarkerOptions){ + mMapController?.getClerk()?.add("${batchMarkerOptions.list?.size},${batchMarkerOptions.othersStr.length}") + + var otherStr = batchMarkerOptions.othersStr + var duration:Int = batchMarkerOptions.duration + + if(batchMarkerOptions.list?.isNotEmpty()?:false){ + val otherBuffer = StringBuffer() + batchMarkerOptions.list?.let { + for(markerOption in it){ + if(!MapDataApi.isRightLonLat(markerOption.lon,markerOption.lat)){ + continue + } + //id,lon,lat,alt,angle,model,duration + otherBuffer.append(markerOption.id).append(",") + .append(markerOption.lon).append(",") + .append(markerOption.lat).append(",") + .append(markerOption.alt).append(",") + .append(markerOption.rotateAngle).append(",") + .append(markerOption.markerType).append(",") + .append(duration).append(",") + .append(markerOption.color).append(",") + .append(markerOption.text.trim()).append(",") + .append(markerOption.status).append(",") + } + if(otherBuffer.length>1){ + otherBuffer.deleteCharAt(otherBuffer.length-1) + otherStr = otherBuffer.toString() + } + } + } + + + if(batchMarkerOptions.isReset){ + mLastBatchSatelliteTime = 0 + } + if(batchMarkerOptions.satelliteTime>0L){ + if(mLastBatchSatelliteTime > 0L){ + duration = (batchMarkerOptions.satelliteTime - mLastBatchSatelliteTime).toInt() + if(duration < 0 || duration > 1000){ + duration = 0 + } + } + mLastBatchSatelliteTime = batchMarkerOptions.satelliteTime + } + + val buffer = StringBuffer() + buffer.append(System.currentTimeMillis()).append(",") + if(batchMarkerOptions.delayStrategy){ + buffer.append("1").append(",") + }else{ + buffer.append("0").append(",") + } + buffer.append(batchMarkerOptions.ruleAngle).append(",") + buffer.append(batchMarkerOptions.controlIcon).append(",") + buffer.append(batchMarkerOptions.deleteRule).append(",") + buffer.append(duration).append(",") + buffer.append(batchMarkerOptions.showInfo).append(",") + buffer.append(batchMarkerOptions.isReplaceDuration).append(",") + buffer.append(batchMarkerOptions.averageFlag).append(",") + buffer.append(otherStr) + + if(CompileConfig.DEBUG){ + Log.i(TAG, "updateBatchMarkerPositon: list:${batchMarkerOptions.list?.size}--") + } + //处理相关逻辑 + mMapController.updateBatchAnchorPositon(buffer.toString()) + } + + var isUpdate = false; + var driverTme :Long= 0; + var renderListener :OnRenderListener? = null + + + //预添加车辆模型 + override fun addPreVehicleModel(type:Int,modelRes:Int):String?{ + mMapController?.getClerk()?.add("$type,$modelRes") + + val modelKey ="vehicle_${type}" + if(mMarkerCall.containMarkerIcon(modelKey)){ + if(!mMarkerCall.containMarkerIconCache(modelRes)){ + mMarkerCall.removeMarkerIcon(modelKey) + }else{ + return modelKey + } + } + var markerView = OperationUtils.fromRawResource(modelRes,mMapController.getContext()) + if(markerView != null){ + mMarkerCall.addMarkerIconCache(modelRes,modelKey) + val result = mMapController.addImage( + modelKey, + markerView, + markerView.size, + 0 + )?:-1 + if (result == 0) { + mMarkerCall.addMarkerIcon(modelKey) + return modelKey + }else{ + return null + } + }else{ + return null + } + + return modelKey + } + + //添加普通模型 + override fun addPreModel(modelRes:Int):String?{ + mMapController?.getClerk()?.add() + if(mMarkerCall.containMarkerIconCache(modelRes)){ + return mMarkerCall.getMarkerIconCache(modelRes) + } + var markerView = OperationUtils.fromRawResource(modelRes,mMapController.getContext()) + if(markerView != null){ + MD5Utils.getInstanse() + val modelKey = MD5Utils.getMD5String(markerView) + + mMarkerCall.addMarkerIconCache(modelRes,modelKey) + if (!mMarkerCall.containMarkerIcon(modelKey)) { + val result = mMapController.addImage( + modelKey, + markerView, + markerView.size, + 0 + )?:-1 + if (result == 0) { + mMarkerCall.addMarkerIcon(modelKey) + return modelKey + }else{ + return null + } + } + return modelKey + }else{ + return null + } + + } + + /** + * 更新车辆的大小 + * @param type 车辆类型 + * @param width 车辆宽度 + * @param length 车辆长度 + */ + override fun updateCarSize(type:Int,width:Double,length:Double){ + CarManager.updateCarSize(type, width, length) + } + + /** + * 检查车辆是否叠加 + * @param list 他车数据列表 + * @return 返回车辆叠加数据 + */ + override fun checkCollision(list:ArrayList):Map>{ + return CarManager.checkCollision(0.0,0.0,list,mMapController) + } + + /** + * 检查车辆是否叠加 + * @param selfLon 自车经度 + * @param selfLat 自车纬度 + * @param list 他车数据列表 + * @return 返回车辆叠加数据 + */ + private fun checkCollision(selfLon:Double,selfLat:Double,list:ArrayList):Map>{ + return CarManager.checkCollision(selfLon,selfLat,list,mMapController) + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerDataSet.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerDataSet.kt new file mode 100644 index 0000000000..9fb414f473 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerDataSet.kt @@ -0,0 +1,21 @@ +package com.zhidaoauto.map.sdk.open.marker + + +class MarkerDataSet { + //自车相关属性 + var centerMarkerOptions:MarkerSimpleOptions? = null + //他车所有锚点 id,lon,lat,alt,angle,model,duration,... + var others:String? = null + + fun copy(): MarkerDataSet { + val dataSet = MarkerDataSet() + dataSet.centerMarkerOptions =centerMarkerOptions + dataSet.others = others + return dataSet + } + + override fun toString(): String { + return "MarkerDataSet(centerMarkerOptions=$centerMarkerOptions, others=${others?.length})" + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerFlashAnimation.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerFlashAnimation.kt new file mode 100644 index 0000000000..af6e30b4fb --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerFlashAnimation.kt @@ -0,0 +1,22 @@ +package com.zhidaoauto.map.sdk.open.marker + + +class MarkerFlashAnimation: Animation { + private var icons: ArrayList<*>? = null + private var duration:Long = 0 + + constructor(icons: ArrayList<*>){ + this.icons = icons + } + fun setDuration(duration: Long) { + this.duration =duration + } + fun getDuration():Long{ + return duration + } + + fun getIcons(): ArrayList<*>? { + return icons + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerInfo.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerInfo.java new file mode 100644 index 0000000000..f6ea6c8fed --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerInfo.java @@ -0,0 +1,89 @@ +package com.zhidaoauto.map.sdk.open.marker; + +import com.alibaba.fastjson.annotation.JSONField; + +public class MarkerInfo { + @JSONField(name="id") + private String id; + @JSONField(name="type") + private String type; + @JSONField(name="ass_info") + private String assInfo; + @JSONField(name="lon") + private double lon; + @JSONField(name="lat") + private double lat; + @JSONField(name="hitx") + private int hitx; + @JSONField(name="hity") + private int hity; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getAssInfo() { + return assInfo; + } + + public void setAssInfo(String assInfo) { + this.assInfo = assInfo; + } + + public double getLon() { + return lon; + } + + public void setLon(double lon) { + this.lon = lon; + } + + public double getLat() { + return lat; + } + + public void setLat(double lat) { + this.lat = lat; + } + + public int getHitx() { + return hitx; + } + + public void setHitx(int hitx) { + this.hitx = hitx; + } + + public int getHity() { + return hity; + } + + public void setHity(int hity) { + this.hity = hity; + } + + @Override + public String toString() { + return "MarkerInfo{" + + "id='" + id + '\'' + + ", type='" + type + '\'' + + ", lon=" + lon + + ", lat=" + lat + + ", hitx=" + hitx + + ", hity=" + hity + + ", assInfo=" + assInfo + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerOptions.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerOptions.kt new file mode 100644 index 0000000000..3a214fd39f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerOptions.kt @@ -0,0 +1,759 @@ +package com.zhidaoauto.map.sdk.open.marker + +import android.graphics.Bitmap +import android.text.TextUtils +import android.util.Log +import android.view.View +import com.alibaba.fastjson.annotation.JSONField +import com.autonavi.nge.map.LonLat +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.abs.IMarkerCall +import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +import com.zhidaoauto.map.sdk.inner.utils.OperationUtils +import com.zhidaoauto.map.sdk.open.data.MapDataApi +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.tools.MD5Utils +import java.util.UUID + + +class MarkerOptions { + + private val TAG = javaClass.simpleName + + @JSONField(name = "id") + private var id: String = "" + + @JSONField(name = "anchorColor") + var anchorColor: String = "" + + //状态 + var status: Int = 0 + + @JSONField(name = "lonLatPoint") + private var lonLatPoint: LonLat? = null + + @JSONField(serialize = false) + private var originLonLatPoint: LonLatPoint? = null + + @JSONField(name = "title") + private var title: String = "" + + @JSONField(name = "snippet") + private var snippet: String = "" + + @JSONField(name = "anchorU") + private var anchorU: Float = 0.5f + + @JSONField(name = "anchorV") + private var anchorV: Float = 0.5f + + @JSONField(name = "visible") + private var visible: Boolean = true + + @JSONField(name = "rotateAngle") + private var rotateAngle: Float = 0f + + @JSONField(name = "markerInfoUseCache") + private var markerInfoUseCache: Boolean = false; + + @JSONField(name = "infoWindowEnabled") + private var infoWindowEnabled: Boolean = true + private var infoWindowShown: Boolean = false + + @JSONField(name = "alpha") + private var alpha: Float = 1.0F + var scale: Float = 0.7F + private var offsetX: Int = 0 + private var offsetY: Int = 0 + var period: Int = 0 + private var clickable: Boolean = true + private var zIndex: Int = 1 + private var isDraggable: Boolean = false + private var isGps: Boolean = false + + //平贴地图 + private var flat: Boolean = false + + @JSONField(name = "markerIconName") + private var markerIconName: String = "" + + @JSONField(name = "markerInfoName") + private var markerInfoName: String = "" + + //控制是否需要方向 + var controlAngle: Boolean = false + + var vrIcon: Boolean = false + + //动态移动时长 + var duration: Int = 0 + + //关联信息 + private var assInfo: String = "" + + //是否显示动画 + var isDisplayAnim:Boolean = false + //动画结束停顿帧数 + var animWaitFrame:Int = 0 + //动画资源 + var animAnchorResource:String = "" + + var animType: Int = 0 + + // 锚点类型 0=默认 1=自车 2=他车 3=动画锚点 + var anchorType: Int = 0 + + // 锚点阴影 0=有阴影 1 没有阴影 + var anchorShadow: Int = 0 + + //锚点颜色类型 0:默认变色 1:由原色变为指定色 2:由指定色变为原色 + var colorType: Int = 0 + //锚点颜色变化时间 + var changeColorTime: Float = 0f + + var changeColorAngle: Float = 0f + + private var icons: ArrayList = ArrayList() + + var averageFlag: Int = 1 + + + constructor(mapController: IMapController?) { + this.id = mapController?.getRecycleId() ?: UUID.randomUUID().toString() + + } + + constructor(id: String?,mapController: IMapController?) { + if(!TextUtils.isEmpty(id)){ + this.id = id!! + }else{ + this.id = mapController?.getRecycleId() ?: UUID.randomUUID().toString() + } + } + + fun reset(){ + id="" + offsetX = 0 + offsetY = 0 + scale = 0.7f + anchorColor = "" + rotateAngle = 0f + visible = true + lonLatPoint = null + originLonLatPoint = null + markerIconName ="" + markerInfoName ="" + controlAngle = false + vrIcon = false + icons.clear() + } + + fun averageFlag(averageFlag: Int): MarkerOptions { + this.averageFlag = averageFlag + return this + } + + fun displayAnimEnable(enable: Boolean): MarkerOptions { + this.isDisplayAnim = enable + return this + } + + fun animWaitFrame(animWaitFrame: Int): MarkerOptions { + this.animWaitFrame = animWaitFrame + return this + } + + fun animType(animType: Int): MarkerOptions { + this.animType = animType + return this + } + + fun anchorType(anchorType: Int): MarkerOptions { + this.anchorType = anchorType + return this + } + + fun anchorShadow(anchorShadow: Int): MarkerOptions { + this.anchorShadow = anchorShadow + return this + } + + fun colorType(colorType: Int): MarkerOptions { + this.colorType = colorType + return this + } + + fun changeColorTime(changeColorTime: Float): MarkerOptions { + this.changeColorTime = changeColorTime + return this + } + + fun changeColorAngle(changeColorAngle: Float): MarkerOptions { + this.changeColorAngle = changeColorAngle + return this + } + + + fun updateInfowindowBitmap(markerInfoBitmap: BitmapDescriptor,mapController: IMapController?): MarkerOptions { + var markerInfoView = markerInfoBitmap.getBytes() + if(markerInfoView.size == 0){ + return this + } + MD5Utils.getInstanse() + val markerInfoMd5 = MD5Utils.getMD5String(markerInfoView) + if(!markerInfoUseCache){ + if(!TextUtils.isEmpty(markerInfoName) && !TextUtils.equals(markerInfoMd5,markerInfoName)){ + mapController?.getMarkerCall()?.removeMarkerIcon(markerInfoName) + mapController?.removeImage(markerInfoName) + } + } + this.markerInfoName = markerInfoMd5 + if (CompileConfig.DEBUG) { + Log.i(TAG, "updateInfowindowBitmap--${markerInfoBitmap.width},${markerInfoBitmap.height}") + } + addImageLogic(markerInfoName, markerInfoView, markerInfoBitmap.width, markerInfoBitmap.height,mapController) + mapController?.updateAnchorProperty(id, "markerInfoName", markerInfoName) + markerInfoBitmap.recycle() + return this + } + + fun updateInfowindowView(view: View,mapController: IMapController?): MarkerOptions { + updateInfowindowBitmap(BitmapDescriptorFactory.fromView(view),mapController) + return this + } + + fun markerIcon(bitmap: Bitmap,mapController: IMapController?): MarkerOptions { + var markerBitmap = BitmapDescriptorFactory.fromBitmap(bitmap) + var markerView = markerBitmap.getBytes() + MD5Utils.getInstanse() + var markerIconName = MD5Utils.getMD5String(markerView) + this.markerIconName = markerIconName + this.vrIcon = false + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerIcon--${markerBitmap.width},${markerBitmap.height}") + } + addImageLogic(markerIconName, markerView, markerBitmap.width, markerBitmap.height,mapController) + return this + } + + fun updateMarkerIcon(bitmap: Bitmap,mapController: IMapController?): MarkerOptions { + markerIcon(bitmap,mapController) + mapController?.updateAnchorWithBitmap(id, markerIconName) + mapController?.updateAnchorProperty(id, "vrIcon", java.lang.Boolean.toString(vrIcon)) + return this + } + + fun setMarkerIconName(markerIconName: String): MarkerOptions { + this.markerIconName = markerIconName + return this + } + + fun setAssInfo(info: String): MarkerOptions { + this.assInfo = info + return this + } + + fun getAssInfo():String{ + return assInfo + } + + fun controlAngle(enable: Boolean): MarkerOptions { + this.controlAngle = enable + return this + } + + fun getMarkerIconName(): String { + return markerIconName + } + + fun setMarkerInfoName(markerInfoName: String,mapController: IMapController?,markerCall: IMarkerCall?) { + this.markerInfoName = markerInfoName + mapController?.updateAnchorProperty(id, "markerInfoName", markerInfoName) + mapController?.showInfoWindow(id) + } + + fun getMarkerInfoName(): String { + return markerInfoName + } + + fun markerIcon(markerBitmap: BitmapDescriptor,mapController: IMapController?): MarkerOptions { + var markerView = markerBitmap.getBytes() + MD5Utils.getInstanse() + var markerIconName = MD5Utils.getMD5String(markerView) + this.markerIconName = markerIconName + this.vrIcon = false + addImageLogic(markerIconName, markerView, markerBitmap.width, markerBitmap.height,mapController) + return this + } + + fun setInfoWindowShown(isShow: Boolean) { + this.infoWindowShown = isShow + } + + fun isInfoWindowShown(): Boolean { + return this.infoWindowShown + } + + fun icons(icons: ArrayList<*>,mapController: IMapController?): MarkerOptions { + this.icons.clear() + if (icons != null && icons.size > 0) { + if(vrIcon){ + if(icons.size > 10){ + throw RuntimeException("最多支持10个3D模型") + }else { + for (icon in icons as ArrayList) { + mapController?.getContext()?.let { + var markerView = BitmapDescriptorFactory.from3DResource(it, icon) + markerView?.let { + MD5Utils.getInstanse() + var anchor3dName = MD5Utils.getMD5String(markerView) + val markerIconName = anchor3dName + this.icons.add(markerIconName) + if (!(mapController.getMarkerCall()?.containMarkerIcon(markerIconName)?:true)) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--marker3DIcon--addImagetoImageManager:${markerIconName},${markerView.size}") + } + val result = mapController?.addImage( + markerIconName, + markerView, + markerView.size, + 0 + ) ?: -1 + if (result == 0) { + mapController.getMarkerCall()?.addMarkerIcon(markerIconName) + } + } + } + } + + + } + } + + }else { + for (icon in icons as ArrayList ) { + var markerView = icon.getBytes() + MD5Utils.getInstanse() + var markerIconName = MD5Utils.getMD5String(markerView) + this.icons.add(markerIconName) + if (!(mapController?.getMarkerCall()?.containMarkerIcon(markerIconName)?:true)) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--setIcon--addImagetoImageManager:${markerIconName}") + } + val result = mapController?.addImage( + markerIconName, + markerView, icon.width, icon.height + )?:-1 + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--setIcon--addImagetoImageManager:${markerIconName},result:${result},threadop:${Thread.currentThread().id}") + } + if (result == 0) { + mapController?.getMarkerCall()?.addMarkerIcon(markerIconName) + } + } + } + } + } + + return this + } + + fun getIcons(): ArrayList? { + return if (!icons.isEmpty()) { + icons + } else { + null + } + } + + fun markerIcon(resId: Int,mapController: IMapController?): MarkerOptions { + if(mapController?.getMarkerCall()?.containMarkerIconCache(resId)?:false){ + this.markerIconName = mapController?.getMarkerCall()?.getMarkerIconCache(resId)?:"" + this.vrIcon = false + return this + } + mapController?.getContext()?.let { + var markerBitmap = BitmapDescriptorFactory.fromResource(it, resId) + var markerView = markerBitmap.getBytes() + MD5Utils.getInstanse() + var markerIconName = MD5Utils.getMD5String(markerView) + this.markerIconName = markerIconName + this.vrIcon = false + mapController?.getMarkerCall()?.addMarkerIconCache(resId,markerIconName) + addImageLogic(markerIconName, markerView, markerBitmap.width, markerBitmap.height,mapController) + } + + return this + } + + + fun marker3DIcon(resId: Int,mapController: IMapController?): MarkerOptions { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--marker3DIcon--start: ${resId}") + } + if(mapController?.getMarkerCall()?.containMarkerIconCache(resId)?:false){ + this.markerIconName = mapController?.getMarkerCall()?.getMarkerIconCache(resId)?:"" + this.vrIcon = true + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--marker3DIcon--cache: ${resId},${markerIconName}") + } + return this + } + var markerView: ByteArray? = null + mapController?.getContext()?.let { + markerView = BitmapDescriptorFactory.from3DResource(it, resId) + } + + if(markerView != null) { + MD5Utils.getInstanse() + var anchor3dName = MD5Utils.getMD5String(markerView) + + if (!(mapController?.getMarkerCall()?.containMarkerIcon(anchor3dName)?:true)) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--marker3DIcon--addImagetoImageManager:${resId},${anchor3dName},${markerView!! + .size}") + } + val result = mapController?.addImage( + anchor3dName, + markerView!!, + markerView!!.size, + 0 + )?:-1 + if (result == 0 || result == 10003) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--marker3DIcon--addImagetoImageManager:success:${resId},${anchor3dName}") + } + this.markerIconName = anchor3dName + this.vrIcon = true + mapController?.getMarkerCall()?.addMarkerIconCache(resId,anchor3dName) + mapController?.getMarkerCall()?.addMarkerIcon(anchor3dName) + } + }else{ + this.markerIconName = anchor3dName + this.vrIcon = true + mapController?.getMarkerCall()?.addMarkerIconCache(resId,anchor3dName) + } + }else{ + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--marker3DIcon--addImagetoImageManager:fail:${resId}") + } + } + return this; + } + + fun animMarkerRes(resId: Int,mapController: IMapController?): MarkerOptions { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--animMarkerRes--start: ${resId}") + } + if(mapController?.getMarkerCall()?.containMarkerIconCache(resId)?:false){ + this.animAnchorResource = mapController?.getMarkerCall()?.getMarkerIconCache(resId)?:"" + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--animMarkerRes--cache:${resId},${animAnchorResource}") + } + return this + } + var markerView = OperationUtils.fromRawResource(resId,mapController?.getContext()) + if(markerView != null) { + MD5Utils.getInstanse() + var anchor3dName = MD5Utils.getMD5String(markerView) + + if (!(mapController?.getMarkerCall()?.containMarkerIcon(anchor3dName)?:true)) { + val result = mapController?.addImage( + anchor3dName, + markerView, + markerView.size, + 0 + )?:-1 + if (result == 0 || result == 10003 ) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--animMarkerRes--addImagetoImageManager:success:${resId},${anchor3dName}") + } + this.animAnchorResource = anchor3dName + mapController?.getMarkerCall()?.addMarkerIconCache(resId,animAnchorResource) + mapController?.getMarkerCall()?.addMarkerIcon(animAnchorResource) + } + }else{ + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--animMarkerRes--repeat:${resId},${animAnchorResource}") + } + this.animAnchorResource = anchor3dName + mapController?.getMarkerCall()?.addMarkerIconCache(resId,animAnchorResource) + } + }else{ + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--animMarkerRes--addImagetoImageManager:fail:${resId}") + } + } + + + return this; + } + + + + private fun addImageLogic(markerIconName: String, imageByteArray: ByteArray, width: Int, height: Int,mapController: IMapController?) { + if (!(mapController?.getMarkerCall()?.containMarkerIcon(markerIconName)?:false)) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--setIcon--addImagetoImageManager:${markerIconName}") + } + val result = mapController?.addImage( + markerIconName, + imageByteArray, + width, + height + )?:-1 + if (CompileConfig.DEBUG) { + Log.i(TAG, "markerop--setIcon--addImagetoImageManager:${markerIconName},result:${result},threadop:${Thread.currentThread().id}") + } + if (result == 0) { + mapController?.getMarkerCall()?.addMarkerIcon(markerIconName) + } + + } + } + + fun anchorColor(color:String):MarkerOptions{ + anchorColor = color + return this + } + + fun vrEnable(enable: Boolean) { + vrIcon = enable + } + + fun position(lonLatPoint: LonLatPoint): MarkerOptions { + if(!MapDataApi.isRightLonLat(lonLatPoint.longitude,lonLatPoint.latitude)){ + Log.e(TAG, "position is error :${lonLatPoint.longitude},${lonLatPoint.latitude} ") + return this; + } + originLonLatPoint = lonLatPoint + if (isGps) { + this.lonLatPoint = LonLat(lonLatPoint.longitude, lonLatPoint.latitude) + } else { + this.lonLatPoint = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint) + } + return this + } + + fun getLonLatOrigin(): LonLatPoint? { + return originLonLatPoint + } + + fun anchor(anchorU: Float, anchorV: Float): MarkerOptions { + this.anchorU = anchorU + this.anchorV = anchorV + return this + } + + fun title(title: String): MarkerOptions { + this.title = title + return this + } + + fun snippet(snippet: String): MarkerOptions { + this.snippet = snippet + return this + } + + fun getFlat(): Boolean { + return this.flat + } + + fun draggable(isDraggable: Boolean): MarkerOptions { + this.isDraggable = isDraggable + return this + } + + fun visible(visible: Boolean): MarkerOptions { + this.visible = visible + return this + } + + fun clickable(clickable: Boolean): MarkerOptions { + this.clickable = clickable + return this + } + + fun setGps(gps: Boolean): MarkerOptions { + this.isGps = gps + return this + } + + fun getZIndex(): Int { + return this.zIndex + } + + fun scale(scale: Float): MarkerOptions { + this.scale = 0.7f*scale + return this + } + + fun getPosition(): LonLatPoint? { + return originLonLatPoint + } + + fun getTitle(): String? { + return this.title + } + + fun getText(): String? { + return this.title + } + + fun getSnippet(): String? { + return this.snippet + } + + fun getAnchorU(): Float { + return this.anchorU + } + + fun getAnchorV(): Float { + return this.anchorV + } + + fun getDraggable(): Boolean { + return this.isDraggable + } + + fun isVisible(): Boolean { + return this.visible + } + + fun isGps(): Boolean { + return this.isGps + } + + + fun setMarkerInfoUseCache(use: Boolean): MarkerOptions { + this.markerInfoUseCache = use + return this + } + + fun getMarkerInfoUseCache():Boolean{ + return markerInfoUseCache; + } + + fun getLonLatPoint(): LonLat? { + return this.lonLatPoint + } +// private fun initBitmapDesList() { +// if (this.bitmapDescriptorList == null) { +// this.bitmapDescriptorList = ArrayList() +// } +// } + + public fun alpha(alpha: Float): MarkerOptions { + this.alpha = alpha; + return this; + } + + fun getAlpha(): Float { + return this.alpha + } + + fun getRotateAngle(): Float { + return this.rotateAngle + } + + fun rotateAngle(rotateAngle: Float): MarkerOptions { + this.rotateAngle = rotateAngle; + return this; + } + + //获取Marker覆盖物是否允许InfoWindow显示, 可以通过 Marker.setInfoWindowEnable(boolean) 进行设置 + fun isInfoWindowEnable(): Boolean { + return this.infoWindowEnabled + } + + fun infoWindowEnable(enabled: Boolean): MarkerOptions { + this.infoWindowEnabled = enabled; + return this; + } + + fun getId(): String { + return this.id + } + + fun lonLatPoint(lonLatPoint: LonLat): MarkerOptions { + this.lonLatPoint = lonLatPoint + return this + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + + other as MarkerOptions + + if (lonLatPoint != other.lonLatPoint) return false + + return true + } + + override fun hashCode(): Int { + return lonLatPoint?.hashCode() ?: 0 + } + + fun setAlpha(alpha: Float): MarkerOptions { + this.alpha = alpha + return this + } + + fun zIndex(zIndex: Int): MarkerOptions { + this.zIndex = 100 + zIndex + return this + } + + fun period(period: Int): MarkerOptions { + if(period < 1){ + this.period = 1 + }else { + this.period = period + } + return this + + } + + + fun setFlat(flat: Boolean): MarkerOptions { + this.flat = flat + return this + } + + fun setInfoWindowOffset(offsetX: Int, offsetY: Int): MarkerOptions { + this.offsetX = offsetX + this.offsetY = offsetY + return this + } + + fun isClickable(): Boolean { + return clickable + } + + fun getOffectX(): Int { + return offsetX + } + + fun getOffectY(): Int { + return offsetY + } + + fun duration(duration: Int): MarkerOptions { + this.duration = duration + return this + } + + override fun toString(): String { + return "MarkerOptions(id='$id', lonLatPoint=$lonLatPoint, rotateAngle=$rotateAngle, scale=$scale,zIndex=$zIndex, isGps=$isGps, markerIconName='$markerIconName', vrIcon=$vrIcon,assInfo=$assInfo,anchorShadow=$anchorShadow)" + } + + +// override fun getFieldWrapperList(): MutableList { +// return resolveFileldWrapperList(MarkerOptions::class.java) +// } + + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerRotateAnimation.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerRotateAnimation.kt new file mode 100644 index 0000000000..7ee36f29a1 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerRotateAnimation.kt @@ -0,0 +1,29 @@ +package com.zhidaoauto.map.sdk.open.marker + + + +class MarkerRotateAnimation: Animation { + private var startAng: Float = 0f + private var endAng: Float = 0f + private var duration:Long = 0 + + constructor(startAng: Float, endAng: Float){ + this.startAng = startAng + this.endAng = endAng + } + fun setDuration(duration: Long) { + this.duration =duration + } + fun getDuration():Long{ + return duration + } + + fun getStartAng():Float{ + return startAng + } + + fun getEndAng():Float{ + return endAng + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerScaleAnimation.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerScaleAnimation.kt new file mode 100644 index 0000000000..60ee8b0e4f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerScaleAnimation.kt @@ -0,0 +1,21 @@ +package com.zhidaoauto.map.sdk.open.marker + + +class MarkerScaleAnimation : Animation { + var scaleStart: Float = 1.0f + var scaleEnd: Float = 0f + private var duration: Long = 0 + + constructor(scaleStart: Float, scaleEnd: Float) { + this.scaleStart = scaleStart + this.scaleEnd = scaleEnd + } + + fun setDuration(duration: Long) { + this.duration = duration + } + + fun getDuration(): Long { + return duration + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerSimpleData.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerSimpleData.kt new file mode 100644 index 0000000000..f59775ebbd --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerSimpleData.kt @@ -0,0 +1,37 @@ +package com.zhidaoauto.map.sdk.open.marker + + +class MarkerSimpleData { + + var id: Long = 0 + //经度 + var lon:Double = 0.0 + //纬度 + var lat:Double = 0.0 + //高度 + var alt:Double = 0.0 + //速度 + var speed:Double = 0.0 + //航向角 + var rotateAngle: Float = 0f + //模型 + var markerType: Int = 0 + //间隔 + var duration: Int = 0 + //位置时间 + var time: Long = 0L + //颜色 + var color: String = "" + //文本 + var text: String = "" + //状态 + var status: Int = 0 + + + + override fun toString(): String { + return "MarkerSimpleData(id=$id, lon=$lon, lat=$lat, alt=$alt, speed=$speed, rotateAngle=$rotateAngle, markerType=$markerType, time=$time, color=$color)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerSimpleOptions.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerSimpleOptions.kt new file mode 100644 index 0000000000..0793d29195 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerSimpleOptions.kt @@ -0,0 +1,37 @@ +package com.zhidaoauto.map.sdk.open.marker + + +class MarkerSimpleOptions { + + var id: String = "" + //经度 + var lon:Double = 0.0 + //纬度 + var lat:Double = 0.0 + //高度 + var alt:Double = 0.0 + //速度 + var speed:Double = 0.0 + //航向角 + var rotateAngle: Float = 0f + //模型 + var markerIconName: String = "" + //动态移动时长 + var duration: Int = 0 + //数据接受时间 + var time: Long = 0 + //数据接受时间 + var satelliteTime: Long = 0 + + constructor() { + } + constructor(id: String) { + this.id = id + } + + override fun toString(): String { + return "MarkerSimpleOptions(id='$id', lon=$lon, lat=$lat, alt=$alt, speed=$speed, rotateAngle=$rotateAngle, markerIconName='$markerIconName', duration=$duration)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerTranslateAnimation.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerTranslateAnimation.kt new file mode 100644 index 0000000000..54f0cf11c8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MarkerTranslateAnimation.kt @@ -0,0 +1,28 @@ +package com.zhidaoauto.map.sdk.open.marker + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class MarkerTranslateAnimation: Animation { + private var lonLatPoints = ArrayList() + private var duration:Long = 0 + + constructor(lonLatPoint: LonLatPoint){ + this.lonLatPoints.clear() + this.lonLatPoints.add(lonLatPoint) + } + + constructor(lonLatPoints: ArrayList){ + this.lonLatPoints.clear() + this.lonLatPoints.addAll(lonLatPoints) + } + fun setDuration(duration: Long) { + this.duration =duration + } + fun getDuration():Long{ + return duration + } + fun getLonlatPoint():ArrayList{ + return lonLatPoints + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MultiPointController.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MultiPointController.kt new file mode 100644 index 0000000000..8f6a298ab2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MultiPointController.kt @@ -0,0 +1,53 @@ +package com.zhidaoauto.map.sdk.open.marker + +import com.alibaba.fastjson.JSONObject +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class MultiPointController { + private val id:String + private var multiPointOverlayOptions: MultiPointOverlayOptions? = null + constructor(multiPointOverlayOptions: MultiPointOverlayOptions){ + this.id = multiPointOverlayOptions.id + this.multiPointOverlayOptions = multiPointOverlayOptions + } + + fun remove(mapController: IMapController?) { + val json = JSONObject() + json.put("id",id) + multiPointOverlayOptions?.data?.size?.let { mapController?.removeManyAnchor(json.toString(), it) } + //CommonController.instance.mapView?.shakeSceneManual() + } + + //批量移动 + fun startSmooth(lonlatPoints: List>, duration: Int,mapController: IMapController?) { + val data = multiPointOverlayOptions?.data!! + for (i in data.indices) { + if (lonlatPoints[i].size < 2) { + continue + } + Marker(data[i],mapController,mapController?.getMarkerCall()).startSmooth(lonlatPoints[i], duration) + } + } + + fun getOptions(): MultiPointOverlayOptions { + return multiPointOverlayOptions!! + } + + fun setOptions(options: MultiPointOverlayOptions) { + this.multiPointOverlayOptions = options + } + + //更新海量点的图片 + fun upDateMultiPointIcon(resId: Int) { +// val bitmapDescriptor = BitmapDescriptorFactory.fromResource( +// CommonController.getInstance().mapAutoView.context, +// resId +// ) +// CommonController.getInstance().mapView.upDateMultiPointIcon( +// bitmapDescriptor.getBytes(), +// bitmapDescriptor.width, +// bitmapDescriptor.height +// ) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MultiPointOverlayOptions.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MultiPointOverlayOptions.kt new file mode 100644 index 0000000000..6a731224d4 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/MultiPointOverlayOptions.kt @@ -0,0 +1,70 @@ +package com.zhidaoauto.map.sdk.open.marker + +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptorFactory.fromResource +import com.zhidaoauto.map.sdk.open.tools.MD5Utils +import java.util.UUID + +class MultiPointOverlayOptions { + var id: String + var data: List = ArrayList() + var markerIconName: String = "111" + private var icon = 0 + + fun setMarkerIcon(icon: Int,mapController: IMapController?): MultiPointOverlayOptions { + this.icon = icon + mapController?.getContext()?.let { + val descriptor = fromResource(it, icon) + val markerBytes = descriptor.getBytes() + MD5Utils.getInstanse() + this.markerIconName = MD5Utils.getMD5String(markerBytes) + if (!(mapController?.getMarkerCall()?.containMarkerIcon(markerIconName)?:true)) { + if(DEBUG){ + Log.i(TAG,"markerop--setIcon--addImagetoImageManager:${markerIconName}") + } + val result = mapController?.addImage( + this.markerIconName, + markerBytes, + descriptor.width, + descriptor.height + ) + if (DEBUG) { + Log.i(TAG, "markerop--setIcon--addImagetoImageManager:${markerIconName},result:${result}") + } + if (result == 0) { + mapController.getMarkerCall()?.addMarkerIcon(markerIconName) + } + } + if (DEBUG) { + Log.i(TAG, "markerop--setIcon:width: " + descriptor.width + "," + descriptor.height + "," + markerIconName + "," + id) + } + } + + + + return this + } + + fun setMarkerData(data: List): MultiPointOverlayOptions { + this.data = data + return this + } + + override fun toString(): String { + return "MultiPointOverlayOptions{" + + "id='" + id + '\'' + + ", icon=" + icon + + ", markerIconName='" + markerIconName + '\'' + + '}' + } + + companion object { + private const val TAG = "MultiPointOverlayOption" + } + + init { + id = UUID.randomUUID().toString() + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/OnAnimationListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/OnAnimationListener.kt new file mode 100644 index 0000000000..57a846bca6 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/OnAnimationListener.kt @@ -0,0 +1,5 @@ +package com.zhidaoauto.map.sdk.open.marker + +interface OnAnimationListener { + fun onAnimationFinish(markerId: String, type: Int) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/OnInfoWindowClickListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/OnInfoWindowClickListener.kt new file mode 100644 index 0000000000..150a42a7dc --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/OnInfoWindowClickListener.kt @@ -0,0 +1,5 @@ +package com.zhidaoauto.map.sdk.open.marker + +interface OnInfoWindowClickListener { + fun onInfoWindowClick(marker: Marker) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/OnMarkClickListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/OnMarkClickListener.kt new file mode 100644 index 0000000000..00af6c5b10 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/marker/OnMarkClickListener.kt @@ -0,0 +1,5 @@ +package com.zhidaoauto.map.sdk.open.marker + +interface OnMarkClickListener { + fun onMarkClick(marker: Marker) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/BroadcastMode.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/BroadcastMode.kt new file mode 100644 index 0000000000..2ee9d5cdbd --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/BroadcastMode.kt @@ -0,0 +1,11 @@ +package com.zhidaoauto.map.sdk.open.nav + +/** + * 语音播报模式 + */ +object BroadcastMode { + //简洁明了 + const val CONCISE = 1 + //详细 + const val DETAIL = 2 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/INavi.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/INavi.kt new file mode 100644 index 0000000000..2d4fdd62d0 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/INavi.kt @@ -0,0 +1,332 @@ +package com.zhidaoauto.map.sdk.open.nav + +import android.location.Location +import com.zhidaoauto.map.sdk.open.nav.abs.AimlessModeListener +import com.zhidaoauto.map.sdk.open.nav.abs.NaviListener +import com.zhidaoauto.map.sdk.open.nav.abs.ParallelRoadListener +import com.zhidaoauto.map.sdk.open.nav.model.NaviCarInfo +import com.zhidaoauto.map.sdk.open.nav.model.NaviOnlineCarHailingType +import com.zhidaoauto.map.sdk.open.nav.model.NaviPath +import com.zhidaoauto.map.sdk.open.nav.model.NaviSetting +import com.zhidaoauto.map.sdk.open.nav.model.TrafficStatus +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +interface INavi { + + + /** + * + * 进行算路策略转换,将传入的特定规则转换成PathPlanningStrategy的枚举值。 + * 参数: + avoidCongestion - 是否躲避拥堵 + avoidHighway - 是否不走高速 + avoidCost - 是否避免收费 + prioritiseHighway - 是否高速优先 + multipleRoute - 单路径or多路径,6.3版本以后该参数已经无效,统一使用多路线算路。 + 返回: + 策略ID,可以将此策略ID传入calculateDriveRoute方法进行相应的算路。 + */ + fun strategyConvert(avoidCongestion: Boolean, avoidHighway: Boolean, avoidCost: Boolean, prioritiseHighway: Boolean, multipleRoute: Boolean): Int + + //释放导航对象资源 + fun destroy() + + /** + * 开始导航。实时导航会自动打开手机卫星定位功能。模拟导航则不需要使用定位功能。 + * + * 参数:naviType - 导航类型,1:实时导航 2:模拟导航。 + * 返回:启动成功或者失败。true是成功,false是失败。 + */ + fun startNavi(naviType: Int): Boolean + + // 暂停导航,仅支持模拟导航。 + fun pauseNavi() + + //停止导航,包含实时导航和模拟导航。 + fun stopNavi() + + // 继续导航,仅支持模拟导航。 + fun resumeNavi() + + /** + * 触发一次导航播报提示【驾车有效】。 注意:该接口仅驾车和步行模式有效 + * 返回: + * 是否请求成功。true是成功,false是失败。 + */ + fun readNaviInfo(): Boolean + + + /** + * 计算驾车路径(包含起点)。 + * 参数: + * from - 指定的导航起点。支持多个起点,起点列表的尾点为实际导航起点,其他坐标点为辅助信息,带有方向性,可有效避免算路到马路的另一侧; + * to - 指定的导航终点。支持多个终点,终点列表的尾点为实际导航终点,其他坐标点为辅助信息,带有方向性,可有效避免算路到马路的另一侧。 + * wayPoints - 途经点,同时支持最多16个途经点的路径规划; + * strategy - 驾车路径规划的计算策略,建议使用策略10,与高德地图默认策略一致。参见PathPlanningStrategy + * 返回: + * 算路是否成功,true-成功;false-失败。注意:返回true,只表示路径计算方法执行,但是否返回规划的路线,请参见AMapNaviListener的回调。 + */ + fun calculateDriveRoute(from: List, to: List, wayPoints: List?, strategy: Int): Boolean + + + /** + * 计算驾车路径(不带起点,起点默认为当前位置)。 + * 参数: + * to - 指定的导航终点。支持多个终点,终点列表的尾点为实际导航终点,其他坐标点为辅助信息,带有方向性,可有效避免算路到马路的另一侧。 + * wayPoints - 途经点,同时支持最多16个途经点的路径规划。 + * strategy - 驾车路径规划的计算策略,建议使用策略10,与高德地图默认策略一致。参见PathPlanningStrategy + * 返回: + * 算路是否成功,true-成功;false-失败。说明:返回true,只表示路径计算方法执行,但是否返回规划的路线,请参见AMapNaviListener的回调。 + */ + fun calculateDriveRoute(to: List, wayPoints: List?, strategy: Int): Boolean + + +// fun calculateDriveRoute(var1: NaviPoi?, var2: NaviPoi?, var3: List?, var4: Int): Boolean + +// fun calculateDriveRoute(var1: String?, var2: String?, var3: List?, var4: Int): Boolean + +// fun calculateDriveRoute(var1: String?, var2: List?, var3: Int): Boolean + + +// fun calculateWalkRoute(to: LonLatPoint): Boolean + +// fun calculateWalkRoute(from: LonLatPoint, to: LonLatPoint): Boolean + +// fun calculateWalkRoute(var1: NaviPoi?, var2: NaviPoi?, var3: TravelStrategy?): Boolean + +// fun calculateRideRoute(var1: LonLatPoint?): Boolean + +// fun calculateRideRoute(from: LonLatPoint, to: LonLatPoint): Boolean + +// fun calculateRideRoute(var1: NaviPoi?, var2: NaviPoi?, var3: TravelStrategy?): Boolean + + /** + * 设置车辆信息(包括车型,车牌,车高,车重等),路径规划时会躲避车辆限行区域和路线。 + * 目前小客车算路只考虑车牌因素,货车算路会考虑车高、车重等信息, 其中NaviCarInfo.setRestriction(boolean)}用于控制是否规避限行路段。 + */ + fun setCarInfo(carInfo: NaviCarInfo) + + /** + * 导航过程中重新规划路线(起点为当前位置,途经点、终点位置不变) + * 参数: + * strategy - 指定的驾车策略常量值,参见PathPlanningStrategy; 骑步行忽略此参数,传0即可。 + * 返回: + * 算路是否成功。true-成功;false-失败。 + */ + fun reCalculateRoute(strategy: Int): Boolean + + /** + * 获取当前导航路线的路况信息。 注意:该接口仅驾车模式有效 + * 返回: + * 返回主路线整体路况信息数组,用于绘制光柱。 + */ + fun getTrafficStatuses(): List? + + /** + * 获取当前规划的路线方案 获取当前计算出的路线,步行和驾车共用这一个对象。 + * 返回: + * 当前规划的路线信息。 + */ + fun getNaviPath(): NaviPath? + + /** + * 获取计算的多条路径 + * 返回: + * 路线Map对象,key存储的是路线id,value存储的是NaviPath对象 + */ + fun getNaviPaths(): HashMap? + + /** + * 获取导航配置类 + */ + fun getNaviSetting(): NaviSetting? + + /** + * 设置模拟导航的速度。 + * 驾车默认速度为60km/h,设置的模拟值区间应该在10-120之间. + * 步行默认速度为20km/h,设置的模拟值区间应该在10-30之间. + * 骑行默认速度为35km/h,设置的模拟值区间应该在10-50之间. + * 参数: + * speed - 模拟导航的速度,单位:km/h。 + */ + fun setEmulatorNaviSpeed(speed: Int) + + //添加导航事件回调监听。 + fun addAMapNaviListener(naviListener: NaviListener) + + //移除导航事件回调监听。 + fun removeAMapNaviListener(naviListener: NaviListener) + + /** + * 启动手机卫星定位。 + * 用户可以手动启动卫星定位功能,如果没有启动,在导航启动时(startNavi)会自动启动。默认定位时间间隔为1秒,变化距离为0。 + * 返回: + * 返回手机卫星定位启动是否成功。true代表成功,false代表失败。 + */ + fun startGPS(): Boolean + + + /** + * 启动手机卫星定位, 带距离和时间参数。 + * 用户可以手动启动手机卫星定位,如果没有启动,在导航启动时(startNavi)会自动启动。 + * 参数: + * time - 位置更新的时间间隔, 单位:毫秒。 + * dis - 位置更新的距离间隔,单位:米。 + * 返回: + * 返回手机卫星定位启动是否成功。true代表成功,false代表失败。 + */ + fun startGPS(time: Long, dis: Int): Boolean + + //停止手机卫星定位。 + fun stopGPS(): Boolean + + //获取导航位置变化驱动类型 + fun getNaviType(): Int + + /** + * 设置在巡航模式(无路线规划)的状态下,智能播报的类型 + * 用户一旦设置,在巡航模式(无路线规划)的状态下,会获得以下回调: + * NaviListener.OnUpdateTrafficFacility(NaviTrafficFacilityInfo[]) 可以用于获得道路设施(包括电子眼,转弯提示等) + * NaviListener.updateAimlessModeCongestionInfo(AimLessModeCongestionInfo) 可以用于获得周边道路拥堵信息 + * NaviListener.updateAimlessModeStatistics(AimLessModeStat) 可以用于巡航模式的统计信息,巡航开启时间,巡航移动距离 + * NaviListener.onGetNavigationText(int, String) 可以用户获得语音播报 + * 注意:该接口仅驾车模式有效 + * 参数: + * aimlessMode - 1:只播报电子眼 2:只播报特殊路段 3:播报电子眼和特殊路段 + */ + fun startAimlessMode(aimlessMode: Int) + + //停止巡航模式 + fun stopAimlessMode() + + //设置建立连接超时时间,单位毫秒级,最低3000,默认10000. + fun setConnectionTimeout(connectionTimeOut: Int) + + //设置服务器返回超时时间,单位毫秒级,最低3000,默认10000. + fun setSoTimeout(soTimeOut: Int) + + /** + * 导航前选主路线 + * 参数: + * id - 路线ID + */ + fun selectRouteId(id: Int): Boolean + + /** + * 获取手机卫星定位是否准备就绪 + * 返回: + * 准备就绪,返回true;否则,返回false + */ + fun isGpsReady(): Boolean + + /** + * 设置语音播报模式为"专家模式"还是"新手模式"【驾车有效】,导航中设置需要下次算路才生效,如偏航或刷新重算. 注意:该接口仅驾车模式有效 + * 参数: + * mode - 参见BroadcastMode + * 返回: + * 设置成功,返回true;否则,返回false + */ + fun setBroadcastMode(mode: Int): Boolean + + /** + * 获取是否使用外部定位数据 + * 返回: + * 是否使用外部定位数据 + */ + fun getIsUseExtraGPSData(): Boolean + + /** + * 设置是否使用外部定位数据. 只有将此开关打开后,AMapNavi.setExtraGPSData(int, Location)方法才会生效。 + * 参数: + * isUseExtraData - 是否使用外部定位数据 + */ + fun setIsUseExtraGPSData(isUseExtraData: Boolean) + + /** + * 此方法用于设置外部定位数据,并使用外部定位数据进行导航 使用此方法前需要先调用AMapNavi.setIsUseExtraGPSData(boolean)将开关打开. + * 参数: + * type - 坐标类型。如果使用系统默认返回的定位坐标,type值为1。使用高德坐标,type值传2 + * location - 外部定位数据。Longitude、Latitude、Accuracy、Speed、Bearing、Time 缺一不可 + */ + fun setExtraGPSData(type: Int, location: Location) + + /** + * 设置使用内部语音播报, 默认为false, 为true时,用户设置NaviListener.onGetNavigationText(int, java.lang.String) 方法将不再回调 + * 参数: + * isUseInnerVoice - 是否使用内部语音播报 + */ + fun setUseInnerVoice(isUseInnerVoice: Boolean) + + /** + * 设置使用内部语音播报 + * 参数: + * isUseInnerVoice - 是否使用内部语音播报, 默认为false + * isCallBackText - isUseInnerVoice设置为true以后,NaviListener.onGetNavigationText(int, java.lang.String)接口是否继续返回文字,默认为false + */ + fun setUseInnerVoice(isUseInnerVoice: Boolean, isCallBackText: Boolean) + + /** + * 获取是否使用内部语音播报 + * 返回: + * true 使用内部语音; false 不适用内部语音 + */ + fun getIsUseInnerVoice(): Boolean + + /** + * 设置多路线导航模式(导航中拥有若干条备选路线供用户选择), 或单路线导航模式(默认模式). + * 注意:此方法需要在算路前调用,下次主动算路的时候生效,步行与骑行导航无效,以下情况不会出现多备选路线:模拟导航、货车导航、路线存在途经点、路线长度超过80KM。 注意:该接口仅驾车模式有效 + * 参数: + * multipleRouteNaviMode - true:多路线导航模式, false:单路线导航模式(默认) + */ + fun setMultipleRouteNaviMode(multipleRouteNaviMode: Boolean) + + //停止内置语音播报,只有在使用内置语音的情况下有效 注意:7.1.0版本以后,调用该接口,会停止播放导航语音,但是仍然可以播放自定义语音 + fun stopSpeak() + + //开始内置语音播报,只有在使用内置语音的情况下才有效 + fun startSpeak() + + //设置网约车导航模式,包括非网约车模式,网约车接驾模式、网约车送驾模式,默认为非网约车模式 注意:该接口仅驾车模式有效 + fun setNaviOnlineCarHailingType(var1: NaviOnlineCarHailingType) + + /** + * 添加平行路切换监听,包括主辅路切换和高架上下切换 注意:该接口仅驾车模式有效 + */ + fun addParallelRoadListener(var1: ParallelRoadListener) + + //移除平行路切换监听 + fun removeParallelRoadListener(var1: ParallelRoadListener) + + //注册巡航模式信息回调监听 + fun addAimlessModeListener(var1: AimlessModeListener) + + //移除巡航模式信息回调监听 + fun removeAimlessModeListener(var1: AimlessModeListener) + + /** + * 切换平行路,目前支持主辅路和高架上下切换。 + * 此函数只有在实时导航开始后才能使用,用来将路径的起点切换到当前导航路径平行的其它路径上 + * 例如: 当前路径在主路上,调用此接口将把路径切换到辅路上,如果当前道路周围没有平行道路,则路径不变,切换成功后将自动开始导航。 注意:该接口仅驾车模式有效 + * 参数: + * parallelType - 1-主辅路切换,2-高架上下切换 + */ + fun switchParallelRoad(parallelType: Int) + + /** + * 设置触发手机卫星定位信号弱的时间间隔,默认为10秒。 表示有连续的10s,卫星定位信号质量都比较差,就会触发手机卫星定位信号弱的回调。值越小,就越容易触发, 支持的时间间隔范围为5~15秒 + * 参数: + * delayTime - 时间间隔,单位为毫秒 + */ + fun setGpsWeakDetecedInterval(delayTime: Long) + + /** + * 播放自定义文字,注意如果当前正在播放导航语音,可能导致播放失败,只在内置语音下生效 + * 参数: + * tts - 要播放的文字 + * forcePlay - 是否强制进行播报 true 如果当前有其他导航语音,会等导航语音播放完毕后播放该文字,但是可能导致导航丢失掉关键引导信息 false 如果当前有其他导航语音,则不播报 + * 返回: + * 播放是否成功 true 成功,false 失败 + */ + fun playTTS(tts: String, forcePlay: Boolean): Boolean + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NavAutoHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NavAutoHelper.kt new file mode 100644 index 0000000000..8d50c73959 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NavAutoHelper.kt @@ -0,0 +1,307 @@ +package com.zhidaoauto.map.sdk.open.nav + +import android.location.Location +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +import com.zhidaoauto.map.sdk.open.nav.abs.AimlessModeListener +import com.zhidaoauto.map.sdk.open.nav.abs.NaviListener +import com.zhidaoauto.map.sdk.open.nav.abs.ParallelRoadListener +import com.zhidaoauto.map.sdk.open.nav.model.NaviCarInfo +import com.zhidaoauto.map.sdk.open.nav.model.NaviOnlineCarHailingType +import com.zhidaoauto.map.sdk.open.nav.model.NaviPath +import com.zhidaoauto.map.sdk.open.nav.model.NaviSetting +import com.zhidaoauto.map.sdk.open.nav.model.TrafficStatus +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class NavAutoHelper : INavi { + + private val TAG = javaClass.simpleName + + fun calculateDriveRoute(startPoint: LonLatPoint, endPoint: LonLatPoint) { + val startLonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(startPoint) + val endLonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(endPoint) + if (CompileConfig.DEBUG) { + Log.i(TAG, "navop--calculateDriveRoute:start:${startLonLat},end:${endLonLat}") + } +// CommonController.instance.naviController?.setSimNavi(true) +// CommonController.instance.naviController?.setStart(NavPoi(startLonLat.lon, startLonLat.lat)) +// CommonController.instance.naviController?.setDest(NavPoi(endLonLat.lon, endLonLat.lat)) + } + + override fun strategyConvert(avoidCongestion: Boolean, avoidHighway: Boolean, avoidCost: Boolean, prioritiseHighway: Boolean, multipleRoute: Boolean): Int { + var strategy: Int = PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT + + try { + when (((if (avoidCongestion) "1" else "0") + (if (avoidHighway) "1" else "0") + (if (avoidCost) "1" else "0") + if (prioritiseHighway) "1" else "0").toInt()) { + 0 -> strategy = PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_DEFAULT + 1 -> strategy = PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_PRIORITY_HIGHSPEED + 10 -> strategy = PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_COST + 11 -> throw IllegalArgumentException("高速优先与避免收费不能同时为true") + 100 -> strategy = PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_HIGHSPEED + 101 -> throw IllegalArgumentException("高速优先与不走高速不能同时为true") + 110 -> strategy = PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_HIGHTSPEED_COST + 1000 -> strategy = PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_CONGESTION + 1001 -> strategy = PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_PRIORITY_HIGHSPEED_AVOID_CONGESTION + 1010 -> strategy = PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_COST_CONGESTION + 1100 -> strategy = PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_HIGHSPEED_CONGESTION + 1110 -> strategy = PathPlanningStrategy.DRIVING_MULTIPLE_ROUTES_AVOID_HIGHSPEED_COST_CONGESTION + } + } catch (e: Exception) { + e.printStackTrace() + } + return strategy + } + + override fun destroy() { +// CommonController.instance.naviController?.destory() + } + + override fun startNavi(naviType: Int): Boolean { +// CommonController.instance.iNavigationCore?.RoutingSetCostModel(RoutingProvider.COSTMODEL_DEFAULT, 0) +// return CommonController.instance.naviController?.startNavi(naviType == NaviType.EMULATOR.value) ?: false + return false + } + + override fun pauseNavi() { +// CommonController.instance.naviController?.setSimNaviPaused(true) + } + + override fun stopNavi() { +// CommonController.instance.naviController?.stopNavi() + } + + override fun resumeNavi() { +// CommonController.instance.naviController?.setSimNaviPaused(false) + } + + //触发一次导航播报提示 + override fun readNaviInfo(): Boolean { +// return CommonController.instance.naviController?.readCurrentTts() ?: false + return false + } + + override fun calculateDriveRoute(from: List, to: List, wayPoints: List?, strategy: Int): Boolean { + if (from.isNullOrEmpty() || to.isNullOrEmpty()) { + return false + } + val startLonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(from[0]) + val endLonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(to[0]) + if (CompileConfig.DEBUG) { + Log.i(TAG, "navop--calculateDriveRoute:start:${startLonLat},end:${endLonLat}") + } +// CommonController.instance.naviController?.setNaviStrategy(strategy) +// CommonController.instance.naviController?.setStart(NavPoi(startLonLat.lon, startLonLat.lat)) +// if (!wayPoints.isNullOrEmpty()) { +// val wayPoint = CommonProxy.getInstance().getLonLatProxy().switchLonLat(wayPoints[0]) +// CommonController.instance.naviController?.addWayPoint(NavPoi(wayPoint.lon, wayPoint.lat), 0, 0) +// } +// CommonController.instance.naviController?.setDest(NavPoi(endLonLat.lon, endLonLat.lat)) + return true + } + + override fun calculateDriveRoute(to: List, wayPoints: List?, strategy: Int): Boolean { +// if (CommonController.instance.lastLonLat == null || to.isNullOrEmpty()) { +// return false +// } +// val from = ArrayList() +// from.add(CommonController.instance.lastLonLat!!) +// return calculateDriveRoute(from, to, wayPoints, strategy) + return false + } + + override fun setCarInfo(carInfo: NaviCarInfo) { + //TODO MATT待实现 + } + + override fun reCalculateRoute(strategy: Int): Boolean { +// CommonController.instance.naviController?.setNaviStrategy(strategy) +// return CommonController.instance.naviController?.reSetRoute() ?: false + return false + } + + override fun getTrafficStatuses(): List? { + //TODO MATT待实现 + return null + } + + override fun getNaviPath(): NaviPath? { +// return CommonController.instance.naviController?.getNavPath() + return null + } + + override fun getNaviPaths(): HashMap? { + //TODO MATT待实现 + return null + } + + override fun getNaviSetting(): NaviSetting? { +// return CommonController.instance.naviController?.getNaviSetting() + + return null + } + + override fun setEmulatorNaviSpeed(speed: Int) { +// CommonController.instance.naviController?.setSimNaviSpeed(speed) + } + + override fun addAMapNaviListener(naviListener: NaviListener) { +// CommonController.instance.naviController?.setNaviListener(naviListener) + } + + override fun removeAMapNaviListener(naviListener: NaviListener) { +// CommonController.instance.naviController?.removeNaviListener() + } + + override fun startGPS(): Boolean { + //TODO MATT待实现 + return false + } + + override fun startGPS(time: Long, dis: Int): Boolean { + //TODO MATT待实现 + return false + } + + override fun stopGPS(): Boolean { + //TODO MATT待实现 + return false + } + + /** + * 导航状态:1:实时导航 2:模拟导航。 + */ + override fun getNaviType(): Int { +// return CommonController.instance.naviController?.getNaviType() ?: 0 + return 0 + } + + + /** + * 设置在巡航模式(无路线规划)的状态下,智能播报的类型 + * 用户一旦设置,在巡航模式(无路线规划)的状态下,会获得以下回调: + * NaviListener.OnUpdateTrafficFacility(NaviTrafficFacilityInfo[]) 可以用于获得道路设施(包括电子眼,转弯提示等) + * NaviListener.updateAimlessModeCongestionInfo(AimLessModeCongestionInfo) 可以用于获得周边道路拥堵信息 + * NaviListener.updateAimlessModeStatistics(AimLessModeStat) 可以用于巡航模式的统计信息,巡航开启时间,巡航移动距离 + * NaviListener.onGetNavigationText(int, String) 可以用户获得语音播报 + * 注意:该接口仅驾车模式有效 + * 参数: + * aimlessMode - 1:只播报电子眼 2:只播报特殊路段 3:播报电子眼和特殊路段 + */ + override fun startAimlessMode(aimlessMode: Int) { + //TODO MATT待实现 + } + + override fun stopAimlessMode() { + //TODO MATT待实现 + } + + override fun setConnectionTimeout(connectionTimeOut: Int) { + //TODO MATT待实现 + } + + override fun setSoTimeout(soTimeOut: Int) { + //TODO MATT待实现 + } + + override fun selectRouteId(id: Int): Boolean { + //TODO MATT待实现 + return false + } + + override fun isGpsReady(): Boolean { + //TODO MATT待实现 + return false + } + + /** + * 设置语音播报模式为"专家模式"还是"新手模式"【驾车有效】,导航中设置需要下次算路才生效,如偏航或刷新重算. 注意:该接口仅驾车模式有效 + * 参数: + * mode - 参见BroadcastMode + * 返回: + * 设置成功,返回true;否则,返回false + */ + override fun setBroadcastMode(mode: Int): Boolean { + //TODO MATT待实现 + return false + } + + override fun getIsUseExtraGPSData(): Boolean { +// return CommonController.instance.mapAutoView?.getLocationClient()?.isUseExtraGPSData() ?: false + return false + } + + override fun setIsUseExtraGPSData(isUseExtraData: Boolean) { +// CommonController.instance.mapAutoView?.getLocationClient()?.setIsUseExtraGPSData(isUseExtraData) + } + + override fun setExtraGPSData(type: Int, location: Location) { +// CommonController.instance.mapAutoView?.getLocationClient()?.setExtraGPSData(type, location) + } + + override fun setUseInnerVoice(isUseInnerVoice: Boolean) { + //TODO MATT待实现 + } + + override fun setUseInnerVoice(isUseInnerVoice: Boolean, isCallBackText: Boolean) { + //TODO MATT待实现 + } + + override fun getIsUseInnerVoice(): Boolean { + //TODO MATT待实现 + return true + } + + override fun stopSpeak() { +// CommonController.instance.naviController?.setSpeakStatus(false) + } + + override fun startSpeak() { +// CommonController.instance.naviController?.setSpeakStatus(true) + } + + /** + * 设置多路线导航模式(导航中拥有若干条备选路线供用户选择), 或单路线导航模式(默认模式). + * 注意:此方法需要在算路前调用,下次主动算路的时候生效,步行与骑行导航无效,以下情况不会出现多备选路线:模拟导航、货车导航、路线存在途经点、路线长度超过80KM。 注意:该接口仅驾车模式有效 + * 参数: + * multipleRouteNaviMode - true:多路线导航模式, false:单路线导航模式(默认) + */ + override fun setMultipleRouteNaviMode(multipleRouteNaviMode: Boolean) { + //TODO MATT待实现 + } + + override fun setNaviOnlineCarHailingType(naviOnlineCarHailingType: NaviOnlineCarHailingType) { + //TODO MATT待实现 + } + + override fun addParallelRoadListener(parallelRoadListener: ParallelRoadListener) { + //TODO MATT待实现 + } + + override fun removeParallelRoadListener(parallelRoadListener: ParallelRoadListener) { + //TODO MATT待实现 + } + + override fun addAimlessModeListener(aimlessModeListener: AimlessModeListener) { + //TODO MATT待实现 + } + + override fun removeAimlessModeListener(aimlessModeListener: AimlessModeListener) { + //TODO MATT待实现 + } + + override fun switchParallelRoad(parallelType: Int) { + //TODO MATT待实现 + } + + override fun setGpsWeakDetecedInterval(delayTime: Long) { + //TODO MATT待实现 + } + + override fun playTTS(tts: String, forcePlay: Boolean): Boolean { +// return CommonController.instance.naviController?.playTTS(tts, forcePlay) ?: false + return false + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NavInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NavInfo.kt new file mode 100644 index 0000000000..ab3df66ed7 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NavInfo.kt @@ -0,0 +1,71 @@ +package com.zhidaoauto.map.sdk.open.nav + +import android.graphics.Bitmap +import com.zhidaoauto.map.sdk.open.nav.model.NaviExitDirectionInfo +import com.zhidaoauto.map.sdk.open.nav.model.NaviNotAvoidInfo + +class NavInfo { + //路线id + var pathID: Long = 0 + //导航信息类型 1-实时导航 2-模拟导航 + var m_Type = 0 + //当前路名 + var m_CurRoadName: String? = null + //下条路名 + var m_NextRoadName: String? = null + //距服务区的距离,单位:米 + var m_SAPADist = 0 + + //距摄像头的距离,单位:米 + @Deprecated("") + var m_CameraDist = 0 + //电子眼类型 + @Deprecated("") + var m_CameraType = 0 + //限速大小。单位:公里/时 + @Deprecated("") + var m_CameraSpeed = 0 + //导航转向图标 + var m_Icon = 0 + //路线剩余距离 + var m_RouteRemainDis = 0 + //路线剩余时间 + var m_RouteRemainTime = 0 + //当前路段剩余距离 + var m_SegRemainDis = 0 + //当前路段剩余时间 + var m_SegRemainTime = 0 + + @Deprecated("") + //自车方向。单位:度 + var m_CarDirection = 0 + + var m_LimitedSpeed = 0 + //当前大路段索引 + var m_CurSegNum = 0 + //自车所在小路段索引 + var m_CurLinkNum = 0 + //当前位置所在link上的点索引 + var m_CurPointNum = 0 + // + var m_Split = 0 + var m_HawkIndex = 0 + var m_SegTipsDis = 0 + + //导航过程中当前的车速 + var currentSpeed = 0 + //限制、禁止图标信息 + var notAvoidInfo: NaviNotAvoidInfo? = null + //转向图标bitmap + var iconBitmap: Bitmap? = null + //出口方向信息 + var naviExitDirectionInfo: NaviExitDirectionInfo? = null + //路径剩余红绿灯数量 + var routeRemainLightCount = 0 + + override fun toString(): String { + return "NavInfo(pathID=$pathID, m_Type=$m_Type, m_CurRoadName=$m_CurRoadName, m_NextRoadName=$m_NextRoadName, m_SAPADist=$m_SAPADist, m_CameraDist=$m_CameraDist, m_CameraType=$m_CameraType, m_CameraSpeed=$m_CameraSpeed, m_Icon=$m_Icon, m_RouteRemainDis=$m_RouteRemainDis, m_RouteRemainTime=$m_RouteRemainTime, m_SegRemainDis=$m_SegRemainDis, m_SegRemainTime=$m_SegRemainTime, m_CarDirection=$m_CarDirection, m_LimitedSpeed=$m_LimitedSpeed, m_CurSegNum=$m_CurSegNum, m_CurLinkNum=$m_CurLinkNum, m_CurPointNum=$m_CurPointNum, m_Split=$m_Split, m_HawkIndex=$m_HawkIndex, m_SegTipsDis=$m_SegTipsDis, currentSpeed=$currentSpeed, notAvoidInfo=$notAvoidInfo, iconBitmap=$iconBitmap, naviExitDirectionInfo=$naviExitDirectionInfo, routeRemainLightCount=$routeRemainLightCount)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NavPoi.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NavPoi.kt new file mode 100644 index 0000000000..477e7c5f6c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NavPoi.kt @@ -0,0 +1,28 @@ +package com.zhidaoauto.map.sdk.open.nav + +import java.io.Serializable + +class NavPoi : Serializable { + var name: String? = null + var address: String? = null + var lon: Double = 0.0 + var lat: Double = 0.0 + + constructor(name: String?, address: String?, lon: Double, lat: Double){ + this.name = name + this.address = address + this.lon = lon + this.lat = lat + } + + constructor(lon: Double, lat: Double){ + this.lon = lon + this.lat = lat + } + + override fun toString(): String { + return "NavPoi(name=$name, address=$address, lon=$lon, lat=$lat)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NaviAutoView.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NaviAutoView.kt new file mode 100644 index 0000000000..67eb621144 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NaviAutoView.kt @@ -0,0 +1,385 @@ +//package com.zhidaoauto.map.sdk.open.nav +// +//import android.content.Context +//import android.util.AttributeSet +//import android.view.View.OnClickListener +//import com.autonavi.nge.dm.INavigationCore +//import com.autonavi.nge.dm.NavigationCore +//import com.autonavi.nge.dm.SharedMemoryService +//import com.autonavi.nge.guidance.GuidanceMessage +//import com.autonavi.nge.guidance.Guidanceinterface +//import com.zhidaoauto.map.sdk.inner.common.NavHelper +//import com.zhidaoauto.map.sdk.inner.controller.CommonController +//import com.zhidaoauto.map.sdk.inner.nav.NaviController +//import com.zhidaoauto.map.sdk.inner.obj.NavMsg +//import com.zhidaoauto.map.sdk.open.location.MogoLocation +//import com.zhidaoauto.map.sdk.open.nav.abs.NaviViewListener +//import com.zhidaoauto.map.sdk.open.nav.abs.OnPolylineClickListener +//import com.zhidaoauto.map.sdk.open.nav.view.* +//import com.zhidaoauto.map.sdk.open.view.MapAutoView +// +//class NaviAutoView : MapAutoView, Guidanceinterface { +// +// val CAR_UP_MODE = 0 +// val NORTH_UP_MODE = 1 +// private var mINavigationCore: INavigationCore? = null +// private var mNaviController: NaviController? = null +// private var mNavAutoHelper: NavAutoHelper? = null +// var mNaviViewListener: NaviViewListener? = null +// private var lockZoom = 18 +// private var lockTilt = 45 +// private var naviViewOptions: NaviViewOptions? = null +// private var nextTurnTipView: NextTurnTipView? = null +// private var trafficProgressBar: TrafficProgressBar? = null +// private var zoomButtonView: ZoomButtonView? = null +// private var zoomInIntersectionView: ZoomInIntersectionView? = null +// private var trafficButtonView: TrafficButtonView? = null +// private var directionView: DirectionView? = null +// private var overviewButtonView: OverviewButtonView? = null +// var isFirst = true +// +// +// constructor(context: Context) : super(context) { +// initNaviView() +// } +// +// constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { +// initNaviView() +// } +// +// constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( +// context, +// attrs, +// defStyleAttr +// ) { +// initNaviView() +// } +// +// private fun initNaviView() { +// // init NavigationCore +// CommonController.instance.naviAutoView = this +// if (CommonController.instance.iNavigationCore == null) { +// mINavigationCore = NavigationCore(SharedMemoryService.getInstance()) +// CommonController.instance.iNavigationCore = mINavigationCore +// } +// // init NaviController +// mINavigationCore?.let { +// mNaviController = NaviController(context, it) +// CommonController.instance.naviController = mNaviController +// } +// mNavAutoHelper = NavAutoHelper() +// GuidanceMessage.getInstance().setGuidanceInterfaceAct(this) +// GuidanceMessage.getInstance().OnReceiveMessage(NavMsg(GuidanceMessage.GUIDANCE_MSG_TYPE_NEWPOS)) +// } +// +// fun getNavAutoHelper(): NavAutoHelper? { +// return this.mNavAutoHelper +// } +// +// override fun onResume() { +// super.onResume() +// } +// +// override fun onPause() { +// super.onPause() +// } +// +// override fun onDestroy() { +// super.onDestroy() +// GuidanceMessage.getInstance().exit() +// mNaviController?.destory() +// mNaviController = null +// mINavigationCore = null +// mNavAutoHelper = null +// } +// +// override fun OnReceiveMessage(navMsg: NavMsg) { +// when (navMsg.msgType) { +// GuidanceMessage.GUIDANCE_MSG_TYPE_NEWPOS -> { +// +// } +// GuidanceMessage.GUIDANCE_MSG_TYPE_NEWINFO -> { +// } +// GuidanceMessage.GUIDANCE_MSG_TYPE_NEWSPEECH -> { +// } +// GuidanceMessage.GUIDANCE_MSG_TYPE_NEWSTATUS -> { +// } +// GuidanceMessage.GUIDANCE_MSG_TYPE_ROUTEFOUND -> { +// } +// GuidanceMessage.GUIDANCE_MSG_TYPE_ROUTENORES -> { +// } +// else -> { +// } +// } +// } +// +// override fun extendLocationChanged(location: MogoLocation) { +// mNaviController?.let { +// it.updatePosition( +// location.lon, +// location.lat, +// location.provider, +// location.speed, +// location.heading.toFloat() +// ) +// } +// } +// +// //自车位置锁定在x轴的位置,范围:0-1 +// fun getAnchorX(): Double { +// return 0.0 +// } +// +// //自车位置锁定在Y轴的位置,范围:0-1 +// fun getAnchorY(): Double { +// return 0.0 +// } +// +// //获取锁车缩放级别 +// fun getLockZoom(): Int { +// return lockZoom +// } +// +// //设置锁车缩放级别 +// fun setLockZoom(lockZoom: Int) { +// // CommonController.instance.mapController?.setNaviModeZoom(true) +// +// } +// +// //获取锁车倾斜角度 +// fun getLockTilt(): Int { +// return 30 +// } +// +// //设置锁车倾斜角度 +// fun setLockTilt(lockTilt: Int) { +// } +// +// //获取导航模式 +// fun getNaviMode(): Int? { +// return NavHelper.mNavParams.getNaviMode() +// +// } +// +// //设置导航模式 +// fun setNaviMode(mode: Int) { +// when(mode){ +// CAR_UP_MODE ->{ +// CommonController.instance.mapController?.setMapNorth(false) +// } +// NORTH_UP_MODE ->{ +// CommonController.instance.mapController?.setMapNorth(true) +// } +// } +// NavHelper.mNavParams.setNaviMode(mode) +// mNaviViewListener?.onNaviMapMode(mode) +// +// } +// +// //是否自动去进行缩放变化 +// fun isAutoChangeZoom(): Boolean { +// return false +// +// } +// +// +// //返回导航视图设置的AMapNaviViewOptions对象。 +// fun getViewOptions(): NaviViewOptions? { +// if(naviViewOptions == null) +// naviViewOptions = NaviViewOptions() +// return naviViewOptions +// +// +// } +// +// //设置导航视图界面option对象,用于控制导航地图的仰角,是否展示车道信息,是否显示路况放大图等等(AMapNaviViewOptions)。 +// fun setViewOptions(naviViewOptions: NaviViewOptions) { +// this.naviViewOptions = naviViewOptions +// +// +// } +// +// +// +// //设置导航页面显示模式 showMode - 1-锁车态 2-全览态 3-普通态 +// fun setShowMode(showMode: Int) { +// when(showMode){ +// NaviViewShowMode.SHOW_MODE_LOCK_CAR -> { +// CommonController.instance.mapController?.setShowAllRouteLine(false) +// } +// NaviViewShowMode.SHOW_MODE_DISPLAY_OVERVIEW -> { +// CommonController.instance.mapController?.setShowAllRouteLine(true) +// } +// NaviViewShowMode.SHOW_MODE_DEFAULT -> { +// CommonController.instance.mapController?.setFollowCarMode(false) +// +// } +// } +// NavHelper.mNavParams.setShowMode(showMode) +// } +// +// //实时路况当前显示状态;true-当前显示实时路况,false-当前不显示 +// fun isTrafficLine(): Boolean { +// return true +// +// } +// +// //设置实时路况显示状态(请使用此方法实现自定义的路况按钮) +// fun setTrafficLine(var1: Boolean) { +// +// } +// +// //设置导航界面按钮的回调监听。 +// fun setNaviViewListener(naviViewListener: NaviViewListener?) { +// this.mNaviViewListener = naviViewListener +// } +// +// //当前是否显示了路口放大图 +// fun isShowRoadEnlarge(): Boolean { +// return NavHelper.mNavParams.isCrossingDrawingEnabled() +// +// } +// +// //返回当前屏幕状态横屏,竖屏 +// fun isOrientationLandscape(): Boolean { +// return false +// +// } +// +// +// //获取用户自定义的车道线 +// fun getLazyDriveWayView(): DriveWayView? { +// return null +// } +// +// //设置用户自定义的车道线 +// fun setLazyDriveWayView(lazyDriveWayView: DriveWayView?) { +// +// } +// +// +// //获取自定义的路口放大图 +// fun getLazyZoomInIntersectionView(): ZoomInIntersectionView? { +// return zoomInIntersectionView +// +// } +// +// //设置用户自定义的路口放大图 +// fun setLazyZoomInIntersectionView(zoomInIntersectionView: ZoomInIntersectionView?) { +// this.zoomInIntersectionView = zoomInIntersectionView +// } +// +// +// //获取用户自定义的指南针 +// fun getLazyDirectionView(): DirectionView? { +// return directionView +// +// } +// +// //设置用户自定义的指南针 +// fun setLazyDirectionView(directionView: DirectionView?) { +// this.directionView = directionView +// } +// +// +// //获取用户自定义的路况按钮 +// fun getLazyTrafficButtonView(): TrafficButtonView? { +// return trafficButtonView +// +// } +// +// //设置用户自定义的路况按钮 +// fun setLazyTrafficButtonView(trafficButtonView: TrafficButtonView?) { +// this.trafficButtonView = trafficButtonView +// getMapAutoViewHelper()?.isTrafficOn()?.let { this.trafficButtonView?.setIsTrafficOpen(it) } +// this.trafficButtonView?.setOnClickListener(OnClickListener { +// getMapAutoViewHelper()?.setTraffic(!this.trafficButtonView?.getIsTrafficOpen()!!) +// this.trafficButtonView?.setIsTrafficOpen(!this.trafficButtonView?.getIsTrafficOpen()!!) +// }) +// +// } +// +// //获取用户自定义的转向图标 +// fun getLazyNextTurnTipView(): NextTurnTipView? { +// return nextTurnTipView +// } +// +// //设置用户自定义的转向图标 +// fun setLazyNextTurnTipView(nextTurnTipView: NextTurnTipView?) { +// this.nextTurnTipView = nextTurnTipView +// } +// +// //设置用户自定义的地图缩放按钮 +// fun setLazyZoomButtonView(zoomButtonView: ZoomButtonView?) { +// this.zoomButtonView = zoomButtonView +// +// } +// +// fun getLazyZoomButtonView(): ZoomButtonView?{ +// return zoomButtonView +// } +// +// //设置用户自定义的全览按钮 +// fun setLazyOverviewButtonView(overviewButtonView: OverviewButtonView?) { +// this.overviewButtonView = overviewButtonView +// this.overviewButtonView?.setOnClickListener(OnClickListener { +// var isOverView = !this.overviewButtonView?.getIsOverView()!! +// this.overviewButtonView?.setOverView(isOverView) +// if(isOverView) +// setShowMode(NaviViewShowMode.SHOW_MODE_DISPLAY_OVERVIEW) +// else +// setShowMode(NaviViewShowMode.SHOW_MODE_LOCK_CAR) +// mNaviViewListener?.onScanViewButtonClick() +// +// }) +// +// +// } +// +// //设置用户自定义的导航光柱条View 设置自定义的光柱条view,只需要设置位置和宽、高即可、颜色车标等元素, +// // 导航SDK内部会帮助进行更新操作 +// fun setLazyTrafficProgressBarView(trafficProgressBar: TrafficProgressBar?) { +// this.trafficProgressBar = trafficProgressBar +// +// } +// +// //获取自定义导航光柱条View +// fun getLazyTrafficProgressBarView(): TrafficProgressBar? { +// return trafficProgressBar +// +// } +// +// //是否是路线全览模式 true代表当前是全览,false代表当前非全览模式 +// fun isRouteOverviewNow(): Boolean { +// var showMode = NavHelper.mNavParams.getShowMode() +// if(showMode == NaviViewShowMode.SHOW_MODE_DISPLAY_OVERVIEW) +// return true +// return false +// } +// +// //设置是否隐藏AMapNaviView上的CarOverlay,包括自车、罗盘 +// fun setCarOverlayVisible(isVisible: Boolean) { +// +// } +// +// //设置是否隐藏路线上的交通信号灯 +// fun setTrafficLightsVisible(isVisible: Boolean) { +// +// } +// +// /* +// *是否显示 起终途点\步行轮渡扎点\禁行限行封路icon +// * showStartEndVia - 是否显示起终途点 +// * showFootFerry - 是否显示步行轮渡扎点 +// * showForbidden - 是否显示禁行限行图标 +// */ +// fun setRouteMarkerVisible(showStartEndVia: Boolean, showFootFerry: Boolean, showForbidden: Boolean) { +// +// } +// +// //设置polyline点击事件 +// fun setOnPolylineClickListener(onPolylineClickListener: OnPolylineClickListener?) { +// } +// +// +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NaviType.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NaviType.kt new file mode 100644 index 0000000000..422cf8c73f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NaviType.kt @@ -0,0 +1,8 @@ +package com.zhidaoauto.map.sdk.open.nav + +enum class NaviType(val value: Int) { + NONE(-1),//未开始导航 + GPS(1),//实时导航 + EMULATOR(2),//模拟导航 + CRUISE(3);//巡航模式 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NaviViewOptions.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NaviViewOptions.kt new file mode 100644 index 0000000000..4392005d38 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NaviViewOptions.kt @@ -0,0 +1,518 @@ +package com.zhidaoauto.map.sdk.open.nav + +import android.graphics.Bitmap +import android.graphics.Rect +import com.zhidaoauto.map.sdk.open.nav.model.RouteOverlayOptions + +class NaviViewOptions { + //HUD正向显示(数值:1) + val HUD_NORMAL_SHOW = 1 + //HUD镜像显示(数值:2) + val HUD_MIRROR_SHOW = 2 + //起点位图 + private var startBitmap: Bitmap? = null + //终点位图 + private var endBitmap: Bitmap? = null + //途经点位图 + private var wayBitmap: Bitmap? = null + //导航路线上的摄像头监控图标(只适用于驾车导航) + private var monitorBitmap: Bitmap? = null + //车标的bitmap对象 + private var carBitmap: Bitmap? = null + //罗盘位图对象 + private var fourCornersBitmap: Bitmap? = null + //路况按钮的开启态图片 + private var defaultTrafficBitmap: Bitmap? = null + //设置路况按钮的关闭态图片 + private var pressedTrafficBitmap: Bitmap? = null + //全览按钮的默认图片 + private var defaultOverBitmap: Bitmap? = null + //全览按钮的点击图片 + private var pressedOverBitmap: Bitmap? = null + //牵引线颜色 + private var leaderLineColor = -1 + //自车位置锁定在x轴的位置,范围:0-1 + private var mapCenterX = 0.0 + //自车位置锁定在y轴的位置,范围:0-1 + private var mapCenterY = 0.0 + //锁定地图延迟毫秒数。 + private var lockMapDelayed = 7000L + //地图自定义样式文件的路径 + private var mapStylePath: String? = null + //横屏路口放大图显示位置。 + private var landscape: Rect? = null + //竖屏路口放大图显示位置。 + private var vertical: Rect? = null + //锁车下地图缩放等级(仅在关闭了动态比例尺下生效) + private var zoom = 16 + //锁车下地图倾角 + private var tilt = 35 + //路线相关的配置属性 + private var mRouteOverlayOptions: RouteOverlayOptions? = null + //是否自动画路,默认为True,此时当算路成功后会立即自动画路 + private var autoDrawRoute = true + //是否显示路口放大图(路口模型图) + private var isModelCrossDisplayShow = true + //是否显示路口放大图(实景图) + private var isRealCrossDisplayShow = true + //是否显示道路信息view + private var isLaneInfoShow = true + //指南针图标是否显示。 + private var isCompassEnabled = true + //路况光柱条是否显示(只适用于驾车导航,需要联网)。 + private var isTrafficBarEnabled = true + //显示实时交通图层开关按钮(只适用于驾车导航,需要联网) + private var isTrafficLayerEnabled = true + //显示路线全览按钮 + private var isRouteListButtonShow = true + //路线转向箭头隐藏和显示 + private var isNaviArrowVisible = true + //导航状态下屏幕是否常亮。 + private var isScreenAlwaysBright = true + //交通播报是否打开(只适用于驾车导航,需要联网)。 + private var isTrafficInfoUpdateEnabled = true + //摄像头播报是否打开(只适用于驾车导航)。 + private var isCameraInfoUpdateEnabled = true + //偏航时是否重新计算路径(计算路径需要联网)。 + private var isReCalculateRouteForYaw = true + //前方拥堵时是否重新计算路径(只适用于驾车导航,需要联网)。 + private var isReCalculateRouteForTrafficJam = false + //菜单按钮是否显示 + private var isSettingMenuEnabled = false + //是否绘制显示交通路况的线路(彩虹线),拥堵-红色,畅通-绿色,缓慢-黄色,未知-蓝色。 + private var isTrafficLine = true + //当前导航界面是否显示 + private var isLayoutVisible = true + //开启了动态比例尺 (锁车态下自动进行地图缩放变化) + private var isAutoChangeZoom = false + //自车图标是否使用陀螺仪方向(只在骑行导航和步行导航下有效) + private var isSensorEnable = true + //路线上的摄像头气泡是否显示 + private var isCameraBubbleShow = true + //设置6秒后是否自动锁车 + private var isAutoLockCar = false + //是否自动全览模式,即在算路成功后自动进入全览模式 + private var isAutoDisplayOverview = false + //导航界面是否显示黑夜模式。 + private var isNaviNight = false + //是否开启自动黑夜模式切换,默认为false,不自动切换 + private var isAutoNaviViewNightMode = false + //通过路线是否自动置灰 可以使用RouteOverlayOptions.setPassRoute(Bitmap)改变纹理 + private var afterRouteAutoGray = false + private var isDrawBackUpOverlay = true + private var mIsEyrieCrossShow = true + private var mEyrieCrossLandscape: Rect? = null + private var mEyrieCrossVertical: Rect? = null + + fun AMapNaviViewOptions() {} + + fun isDrawBackUpOverlay(): Boolean { + return isDrawBackUpOverlay + } + + fun setDrawBackUpOverlay(var1: Boolean) { + isDrawBackUpOverlay = var1 + } + + fun isAfterRouteAutoGray(): Boolean { + return afterRouteAutoGray + } + + fun setAfterRouteAutoGray(var1: Boolean) { + afterRouteAutoGray = var1 + } + + fun isAutoNaviViewNightMode(): Boolean { + return isAutoNaviViewNightMode + } + + fun setAutoNaviViewNightMode(var1: Boolean) { + isAutoNaviViewNightMode = var1 + } + + fun isAutoLockCar(): Boolean { + return isAutoLockCar + } + + fun setAutoLockCar(var1: Boolean) { + isAutoLockCar = var1 + } + + fun isCameraBubbleShow(): Boolean { + return isCameraBubbleShow + } + + fun setCameraBubbleShow(var1: Boolean) { + isCameraBubbleShow = var1 + } + + fun setSensorEnable(var1: Boolean) { + isSensorEnable = var1 + } + + fun isSensorEnable(): Boolean { + return isSensorEnable + } + + fun getRouteOverlayOptions(): RouteOverlayOptions? { + return mRouteOverlayOptions + } + + fun setRouteOverlayOptions(var1: RouteOverlayOptions?) { + if (var1 != null) { + mRouteOverlayOptions = var1 + } + } + + fun setCrossLocation(var1: Rect?, var2: Rect?) { + if (var1 != null) { + landscape = var1 + } + if (var2 != null) { + vertical = var2 + } + } + + fun getLandscapeCross(): Rect? { + return landscape + } + + fun getVerticalCross(): Rect? { + return vertical + } + + fun getCarBitmap(): Bitmap? { + return carBitmap + } + + fun setCarBitmap(var1: Bitmap?) { + carBitmap = var1 + } + + fun getFourCornersBitmap(): Bitmap? { + return fourCornersBitmap + } + + fun setFourCornersBitmap(var1: Bitmap?) { + fourCornersBitmap = var1 + } + + fun isCompassEnabled(): Boolean { + return isCompassEnabled + } + + fun setCompassEnabled(var1: Boolean) { + isCompassEnabled = var1 + } + + fun isTrafficBarEnabled(): Boolean { + return isTrafficBarEnabled + } + + fun setTrafficBarEnabled(var1: Boolean) { + isTrafficBarEnabled = var1 + } + + fun isTrafficLayerEnabled(): Boolean { + return isTrafficLayerEnabled + } + + fun setTrafficLayerEnabled(var1: Boolean) { + isTrafficLayerEnabled = var1 + } + + fun isRouteListButtonShow(): Boolean { + return isRouteListButtonShow + } + + fun setRouteListButtonShow(var1: Boolean) { + isRouteListButtonShow = var1 + } + + fun isNaviNight(): Boolean { + return isNaviNight + } + + fun setNaviNight(var1: Boolean) { + isNaviNight = var1 + mapStylePath = "" + } + + fun setCustomMapStylePath(var1: String?) { + mapStylePath = var1 + } + + fun getCustomMapStylePath(): String? { + return mapStylePath + } + + fun setStartPointBitmap(var1: Bitmap?) { + startBitmap = var1 + } + + fun getStartMarker(): Bitmap? { + return startBitmap + } + + fun setEndPointBitmap(var1: Bitmap?) { + endBitmap = var1 + } + + fun getEndMarker(): Bitmap? { + return endBitmap + } + + fun setWayPointBitmap(var1: Bitmap?) { + wayBitmap = var1 + } + + fun getWayMarker(): Bitmap? { + return wayBitmap + } + + fun setMonitorCameraBitmap(var1: Bitmap?) { + monitorBitmap = var1 + } + + fun getMonitorMarker(): Bitmap? { + return monitorBitmap + } + + + @Deprecated("") fun setMonitorCameraEnabled(var1: Boolean?) {} + + fun isScreenAlwaysBright(): Boolean { + return isScreenAlwaysBright + } + + fun setScreenAlwaysBright(var1: Boolean) { + isScreenAlwaysBright = var1 + } + + fun isTrafficInfoUpdateEnabled(): Boolean { + return isTrafficInfoUpdateEnabled + } + + fun setTrafficInfoUpdateEnabled(var1: Boolean) { + isTrafficInfoUpdateEnabled = var1 + } + + fun isCameraInfoUpdateEnabled(): Boolean { + return isCameraInfoUpdateEnabled + } + + fun setCameraInfoUpdateEnabled(var1: Boolean) { + isCameraInfoUpdateEnabled = var1 + } + + fun isReCalculateRouteForYaw(): Boolean { + return isReCalculateRouteForYaw + } + + + @Deprecated("") fun setReCalculateRouteForYaw(var1: Boolean) { + isReCalculateRouteForYaw = var1 + } + + fun isReCalculateRouteForTrafficJam(): Boolean { + return isReCalculateRouteForTrafficJam + } + + + @Deprecated("") fun setReCalculateRouteForTrafficJam(var1: Boolean) { + isReCalculateRouteForTrafficJam = var1 + } + + fun isSettingMenuEnabled(): Boolean { + return isSettingMenuEnabled + } + + fun setSettingMenuEnabled(var1: Boolean) { + isSettingMenuEnabled = var1 + } + + fun isTrafficLine(): Boolean { + return isTrafficLine + } + + fun setTrafficLine(var1: Boolean) { + isTrafficLine = var1 + } + + fun getLeaderLineColor(): Int { + return leaderLineColor + } + + fun isLeaderLineEnabled(): Boolean { + return leaderLineColor != -1 + } + + fun setLeaderLineEnabled(var1: Int) { + leaderLineColor = var1 + } + + fun isLayoutVisible(): Boolean { + return isLayoutVisible + } + + fun setLayoutVisible(var1: Boolean) { + isLayoutVisible = var1 + } + + fun getLockMapDelayed(): Long { + return lockMapDelayed + } + + fun setLockMapDelayed(var1: Long) { + lockMapDelayed = var1 + } + + fun isAutoDrawRoute(): Boolean { + return autoDrawRoute + } + + fun setAutoDrawRoute(var1: Boolean) { + autoDrawRoute = var1 + } + + fun isRealCrossDisplayShow(): Boolean { + return isRealCrossDisplayShow + } + + fun setRealCrossDisplayShow(var1: Boolean) { + isRealCrossDisplayShow = var1 + } + + fun isModelCrossDisplayShow(): Boolean { + return isModelCrossDisplayShow + } + + + @Deprecated("") fun setCrossDisplayShow(var1: Boolean) { + isModelCrossDisplayShow = var1 + } + + fun setModeCrossDisplayShow(var1: Boolean) { + isModelCrossDisplayShow = var1 + } + + fun isLaneInfoShow(): Boolean { + return isLaneInfoShow + } + + fun setLaneInfoShow(var1: Boolean) { + isLaneInfoShow = var1 + } + + fun getZoom(): Int { + return zoom + } + + fun setZoom(var1: Int) { + var var1 = var1 + if (var1 < 14) { + var1 = 14 + } else if (var1 > 18) { + var1 = 18 + } + zoom = var1 + } + + fun getTilt(): Int { + return tilt + } + + fun setTilt(var1: Int) { + var var1 = var1 + if (var1 < 0) { + var1 = 0 + } else if (var1 > 60) { + var1 = 60 + } + tilt = var1 + } + + fun isAutoChangeZoom(): Boolean { + return isAutoChangeZoom + } + + fun setAutoChangeZoom(var1: Boolean) { + isAutoChangeZoom = var1 + } + + fun setPointToCenter(var1: Double, var3: Double) { + mapCenterX = var1 + mapCenterY = var3 + } + + fun getMapCenter_X(): Double { + return mapCenterX + } + + fun getMapCenter_Y(): Double { + return mapCenterY + } + + fun setTrafficBitmap(var1: Bitmap?, var2: Bitmap?) { + defaultTrafficBitmap = var1 + pressedTrafficBitmap = var2 + } + + fun setOverBitmap(var1: Bitmap?, var2: Bitmap?) { + defaultOverBitmap = var1 + pressedOverBitmap = var2 + } + + fun getDefaultTrafficBitmap(): Bitmap? { + return defaultTrafficBitmap + } + + fun getPressedTrafficBitmap(): Bitmap? { + return pressedTrafficBitmap + } + + fun getDefaultOverBitmap(): Bitmap? { + return defaultOverBitmap + } + + fun getPressedOverBitmap(): Bitmap? { + return pressedOverBitmap + } + + fun setAutoDisplayOverview(var1: Boolean) { + isAutoDisplayOverview = var1 + } + + fun isAutoDisplayOverview(): Boolean { + return isAutoDisplayOverview + } + + fun isNaviArrowVisible(): Boolean { + return isNaviArrowVisible + } + + fun setNaviArrowVisible(var1: Boolean) { + isNaviArrowVisible = var1 + } + + fun setEyrieCrossDisplay(var1: Boolean) { + mIsEyrieCrossShow = var1 + } + + fun isEyrieCrossDisplay(): Boolean { + return mIsEyrieCrossShow + } + + fun setEyrieCrossLocation(var1: Rect?, var2: Rect?) { + mEyrieCrossLandscape = var1 + mEyrieCrossVertical = var2 + } + + fun getEyrieCrossLandscape(): Rect? { + return mEyrieCrossLandscape + } + + fun getEyrieCrossVertical(): Rect? { + return mEyrieCrossVertical + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NaviViewShowMode.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NaviViewShowMode.kt new file mode 100644 index 0000000000..449b77aa92 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/NaviViewShowMode.kt @@ -0,0 +1,13 @@ +package com.zhidaoauto.map.sdk.open.nav + +object NaviViewShowMode { + + //锁车状态 + const val SHOW_MODE_LOCK_CAR = 1 + + //全览状态 + const val SHOW_MODE_DISPLAY_OVERVIEW = 2 + + //普通状态 + const val SHOW_MODE_DEFAULT = 3 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/PathPlanningStrategy.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/PathPlanningStrategy.kt new file mode 100644 index 0000000000..7ba1366bee --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/PathPlanningStrategy.kt @@ -0,0 +1,31 @@ +package com.zhidaoauto.map.sdk.open.nav + +object PathPlanningStrategy { + + + const val NO_STRATEGY = -1 + + const val DRIVING_SAVE_MONEY = 1 + + const val DRIVING_NO_EXPRESS_WAYS = 3 + + const val DRIVING_AVOID_CONGESTION = 4 + + const val DRIVING_SINGLE_ROUTE_AVOID_HIGHSPEED = 6 + const val DRIVING_SINGLE_ROUTE_AVOID_HIGHSPEED_COST = 7 + const val DRIVING_SINGLE_ROUTE_AVOID_CONGESTION_COST = 8 + const val DRIVING_SINGLE_ROUTE_AVOID_HIGHSPEED_COST_CONGESTION = 9 + + const val DRIVING_MULTIPLE_ROUTES_DEFAULT = 10 + const val DRIVING_MULTIPLE_ROUTES_AVOID_CONGESTION = 12 + + const val DRIVING_MULTIPLE_ROUTES_AVOID_HIGHSPEED = 13 + const val DRIVING_MULTIPLE_ROUTES_AVOID_COST = 14 + const val DRIVING_MULTIPLE_ROUTES_AVOID_HIGHSPEED_CONGESTION = 15 + const val DRIVING_MULTIPLE_ROUTES_AVOID_HIGHTSPEED_COST = 16 + + const val DRIVING_MULTIPLE_ROUTES_AVOID_COST_CONGESTION = 17 + const val DRIVING_MULTIPLE_ROUTES_AVOID_HIGHSPEED_COST_CONGESTION = 18 + const val DRIVING_MULTIPLE_ROUTES_PRIORITY_HIGHSPEED = 19 + const val DRIVING_MULTIPLE_ROUTES_PRIORITY_HIGHSPEED_AVOID_CONGESTION = 20 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/AimlessModeListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/AimlessModeListener.kt new file mode 100644 index 0000000000..5234490ecf --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/AimlessModeListener.kt @@ -0,0 +1,19 @@ +package com.zhidaoauto.map.sdk.open.nav.abs + +import com.zhidaoauto.map.sdk.open.nav.model.AimLessModeCongestionInfo +import com.zhidaoauto.map.sdk.open.nav.model.AimLessModeStat +import com.zhidaoauto.map.sdk.open.nav.model.NaviTrafficFacilityInfo + +interface AimlessModeListener { + //巡航模式(无路线规划)下,道路设施信息更新回调,回调为空时,表示当前没有道路信息 + fun onUpdateTrafficFacility(var1: Array?) + + //巡航模式(无路线规划)下, 电子眼信息更新回调,回调为空时,表示当前没有电子眼信息 + fun onUpdateAimlessModeElecCameraInfo(var1: Array?) + + //巡航模式(无路线规划)下,统计信息更新回调 连续5个点大于15km/h后开始回调 + fun updateAimlessModeStatistics(var1: AimLessModeStat?) + + //巡航模式(无路线规划)下,拥堵信息更新回调 当前方无拥堵信息时,回调的AimLessModeCongestionInfo对象为空 + fun updateAimlessModeCongestionInfo(var1: AimLessModeCongestionInfo?) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/NaviListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/NaviListener.kt new file mode 100644 index 0000000000..3849270bd9 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/NaviListener.kt @@ -0,0 +1,171 @@ +package com.zhidaoauto.map.sdk.open.nav.abs + +import com.zhidaoauto.map.sdk.open.location.MogoLocation +import com.zhidaoauto.map.sdk.open.nav.NavInfo +import com.zhidaoauto.map.sdk.open.nav.model.CalcRouteResult +import com.zhidaoauto.map.sdk.open.nav.model.LaneInfo +import com.zhidaoauto.map.sdk.open.nav.model.ModelCross +import com.zhidaoauto.map.sdk.open.nav.model.NaviCameraInfo +import com.zhidaoauto.map.sdk.open.nav.model.NaviCross +import com.zhidaoauto.map.sdk.open.nav.model.NaviRouteNotifyData +import com.zhidaoauto.map.sdk.open.nav.model.ServiceAreaInfo + +interface NaviListener { + + /** + * 导航初始化失败时的回调函数。 + */ + fun onInitNaviFailure() + + /** + * 导航初始化成功时的回调函数。 + */ + fun onInitNaviSuccess() + + /** + * 启动导航后的回调函数 + * type - 导航类型参见NaviType + */ + fun onStartNavi(type: Int) + + /** + * 当前方路况光柱信息有更新时回调函数 + */ + fun onTrafficStatusUpdate() + + /** + * 当位置信息有更新时的回调函数。 + */ + fun onLocationChange(location: MogoLocation) + + /** + * 导航播报信息回调函数。 + * 参数: + * text - 播报文字。 + */ + fun onGetNavigationText(text: String?) + + /** + * 模拟导航停止后回调函数。 + */ + fun onEndEmulatorNavi() + + /** + * 到达目的地后回调函数。 + */ + fun onArriveDestination() + + /** + * 驾车路径导航到达某个途经点的回调函数。 注意:该接口仅驾车模式有效 + * 参数: + * wayID - 到达途径点的编号,标号从0开始,依次累加 + */ + fun onArrivedWayPoint(var1: Int) + + /** + * 用户手机位置信息设置是否开启的回调函数。 + * 参数: + * enabled - true,开启;false,未开启。 + */ + fun onGpsOpenStatus(enabled: Boolean) + + /** + * 导航引导信息回调。 + * 参数: + * naviInfo - 导航信息类对象。 + */ + fun onNaviInfoUpdate(navInfo: NavInfo?) + + /** + * 导航过程中的摄像头信息回调函数 注意:该接口仅驾车模式有效 + * 参数: + * infoArray - 摄像头对象数组 + */ + fun updateCameraInfo(infoArray: Array?) + + /** + * 导航过程中的区间测速信息回调函数 注意:该接口仅驾车模式有效 + * 参数: + * startCameraInfo - 区间测速起点信息 + * endCameraInfo - 区间测速终点信息 + * status - 具体类型可参考CarEnterCameraStatus + */ + fun updateIntervalCameraInfo(startCameraInfo: NaviCameraInfo?, endCameraInfo: NaviCameraInfo?, status: Int) + + /** + * 服务区信息回调函数 注意:该接口仅驾车模式有效 + * 参数: + * infoArray - 服务区对象数组 + */ + fun onServiceAreaUpdate(infoArray: Array?) + + /** + * 显示路口放大图回调(实景图)。 注意:该接口仅驾车模式有效 + * 参数: + * naviCross - 路口放大图类,可以获得此路口放大图bitmap + */ + fun showCross(naviCross: NaviCross?) + + /** + * 关闭路口放大图回调(实景图) + */ + fun hideCross() + + /** + * 显示路口放大图回调(模型图)。 注意:该接口仅驾车模式有效 + * 参数: + * modelCross - 模型图数据类,可以获取绘制模型图需要的矢量数据 + */ + fun showModeCross(modelCross: ModelCross?) + + /** + * 关闭路口放大图回调(模型图) + */ + fun hideModeCross() + + /** + * 显示道路信息回调。 注意:该接口仅驾车模式有效 + * 参数: + * laneInfo - 道路信息,可获得当前道路信息,可用于用户使用自己的素材完全自定义显示。 + */ + fun showLaneInfo(laneInfo: LaneInfo?) + + /** + * 关闭道路信息回调 + */ + fun hideLaneInfo() + + /** + * 回调各种类型的提示音,类似高德导航"叮". 注意:该接口仅驾车模式有效 + * 参数: + * type - 提示音类型 + * 提示音类型使用常量表示,具体类型可参考NaviRingType + */ + fun onPlayRing(var1: Int) + + /** + * 路线规划成功回调,包括算路、导航中偏航、用户改变算路策略、行程点等触发的重算,具体算路结果可以通过CalcRouteResult获取 可以通过CalcRouteResult获取算路错误码、算路类型以及路线id + */ + fun onCalculateRouteSuccess(var1: CalcRouteResult?) + + /** + * 路线规划失败回调,包括算路、导航中偏航、用户改变算路策略、行程点等触发的重算,具体算路结果可以通过CalcRouteResult获取 可以通过CalcRouteResult获取算路错误码、算路类型以及路线id + */ + fun onCalculateRouteFailure(var1: CalcRouteResult?) + + /** + * 导航过程中道路信息通知 注意:该接口仅驾车模式有效 + * 导航过程中针对拥堵区域、限行区域、禁行区域、道路封闭等情况的躲避通知。 + * 通知和避让信息结果可以通过NaviRouteNotifyData获取 + * 参数: + * notifyData - 通知和避让信息,详细信息请参考NaviRouteNotifyData + */ + fun onNaviRouteNotify(var1: NaviRouteNotifyData?) + + /** + * 手机卫星定位信号强弱变化的回调 + * 参数: + * isWeak - true: 信号弱;false:信号强 + */ + fun onGpsSignalWeak(var1: Boolean) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/NaviViewListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/NaviViewListener.kt new file mode 100644 index 0000000000..d4b1d885a8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/NaviViewListener.kt @@ -0,0 +1,46 @@ +package com.zhidaoauto.map.sdk.open.nav.abs + +interface NaviViewListener { + + //界面右下角设置按钮的点击回调 + fun onNaviSetting() + + //导航页面左下角返回按钮点击后弹出的『退出导航』对话框中选择『确定』后的回调接口。 + fun onNaviCancel() + + /** + *导航页面左下角"退出"按钮的点击回调 + * 返回值:false-由SDK主动弹出『退出导航』对话框,true-SDK不主动弹出『退出导航』对话框,由用户自定义 + */ + fun onNaviBackClick(): Boolean + + /** + * 导航视角变化回调 + * naviMode - 导航视角,0:车头朝上状态;1:正北朝上模式。 + */ + fun onNaviMapMode(naviMode: Int) + + //界面全览按钮的点击回调。 + fun onScanViewButtonClick() + + /** + * 是否锁定地图的回调 + * 参数:isLock - true代表锁车状态,地图未锁定。false代表非锁车状态,地图锁定。 + */ + fun onLockMap(isLock: Boolean) + + //导航view加载完成回调。 + fun onNaviViewLoaded() + + /** + * 地图白天黑夜模式切换回调 + * mapType - 枚举值参考MapAutoApi 3-日间导航模式 4-夜间导航模式 + */ + fun onMapTypeChanged(mapType: Int) + + /** + * 导航视图展示模式变化回调 + * showMode - 展示模式,具体类型可参考CustomNaviViewShowMode + */ + fun onNaviViewShowMode(showMode: Int) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/OnPolylineClickListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/OnPolylineClickListener.kt new file mode 100644 index 0000000000..fbbcfde585 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/OnPolylineClickListener.kt @@ -0,0 +1,8 @@ +package com.zhidaoauto.map.sdk.open.nav.abs + +import com.zhidaoauto.map.sdk.open.poyline.Polyline + +interface OnPolylineClickListener { + fun onPolylineClick(var1: Polyline?) + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/ParallelRoadListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/ParallelRoadListener.kt new file mode 100644 index 0000000000..92c6e4b3ba --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/abs/ParallelRoadListener.kt @@ -0,0 +1,8 @@ +package com.zhidaoauto.map.sdk.open.nav.abs + +import com.zhidaoauto.map.sdk.open.nav.model.NaviParallelRoadStatus + +interface ParallelRoadListener { + //通知当前可以进行平行道路切换,包括主路、辅路以及高架桥上、高架桥下 + fun notifyParallelRoad(naviParallelRoadStatus: NaviParallelRoadStatus) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/AimLessModeCongestionInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/AimLessModeCongestionInfo.kt new file mode 100644 index 0000000000..cce6980874 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/AimLessModeCongestionInfo.kt @@ -0,0 +1,20 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +class AimLessModeCongestionInfo { + //该条道路的拥堵信息数组 仅当拥堵长度大于500米且拥堵时间大于5分钟时,服务才下发拥堵路段形状点 + var amapCongestionLinks: Array? = null + //预计通过拥堵区域时间,单位:秒 + var time = 0 + //拥堵区域路径长度,单位:米 + var length = 0 + //拥堵区域道路名称 + var roadName: String? = null + //拥堵区域的整体拥堵状态 + var congestionStatus = 0 + //事件类型 + var eventType = 0 + //事件经度(水平方向) + var eventLon = 0.0 + //事件纬度(竖直方向) + var eventLat = 0.0 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/AimLessModeStat.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/AimLessModeStat.kt new file mode 100644 index 0000000000..0bc76c2ff7 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/AimLessModeStat.kt @@ -0,0 +1,10 @@ +package com.zhidaoauto.map.sdk.open.nav.model +/* + * 巡航模式(无路线规划)统计类 + */ +class AimLessModeStat { + //巡航模式(无路线规划)下运行时间 进入电子狗巡航满足连续5个点大于15km/h,就开始计时,认为用户启用了电子狗巡航 + var aimlessModeTime = 0 + //巡航模式(无路线规划)下轨迹距离 距离就是用户自车在该模式下的轨迹累积的距离 进入电子狗巡航满足连续5个点大于15km/h,就开始记录轨迹距离,认为用户启用了电子狗巡航 + var aimlessModeDistance = 0 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/CalcRouteResult.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/CalcRouteResult.kt new file mode 100644 index 0000000000..0781f790e3 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/CalcRouteResult.kt @@ -0,0 +1,15 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +class CalcRouteResult { + var errorCode = 0//算路错误码,0为算路成功 + var routeId: IntArray? = null //路线id数组,通过路线id获取数据,只有errorcode为0的时候才有值 + var calcRouteType = 0 //算路类型,0为直接算路 + var errorDetail = "" //错误的详细信息 + var errorDescription: String? = null //错误描述 + + override fun toString(): String { + return "CalcRouteResult(errorCode=$errorCode, routeId=${routeId?.contentToString()}, calcRouteType=$calcRouteType, errorDetail='$errorDetail', errorDescription=$errorDescription)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/CongestionLink.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/CongestionLink.kt new file mode 100644 index 0000000000..3bb2e34f10 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/CongestionLink.kt @@ -0,0 +1,13 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +/* + * 拥堵道路link的拥堵信息 + */ +class CongestionLink { + //获取拥堵道路link形状点集 + var mCoords: ArrayList? = null + //获取拥堵道路link拥堵状态 + var mCongestionStatus = 0 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/LaneInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/LaneInfo.kt new file mode 100644 index 0000000000..223d710b56 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/LaneInfo.kt @@ -0,0 +1,8 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +class LaneInfo { + var backgroundLane: IntArray? = null //背景车道 + var frontLane: IntArray? = null //前景车道 + var laneCount = 0 //车道个数 + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/ModelCross.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/ModelCross.kt new file mode 100644 index 0000000000..7bad79819a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/ModelCross.kt @@ -0,0 +1,5 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +class ModelCross { + var picBuf1: ByteArray? = null //导航模型路口放大图数据 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviCameraInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviCameraInfo.kt new file mode 100644 index 0000000000..2ae7f5a247 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviCameraInfo.kt @@ -0,0 +1,24 @@ +package com.zhidaoauto.map.sdk.open.nav.model +/* + * 导航过程中的摄像头信息类。 + */ +class NaviCameraInfo { + //摄像头的经度 + var longitude = 0.0 + //摄像头的纬度 + var latitude = 0.0 + //获取当前位置到摄像头的距离 + var cameraDistance = 0 + //获取摄像头的类型 + var cameraType = 0 + //获取当前摄像头的限速大小 + var cameraSpeed = 0 + //进入区间测速区域后的实时平均速度,注意:只有在类型为区间测速时才有值 + var averageSpeed = 0 + //获取区间测速剩余路段的合理车速,注意:只有在类型为区间测速时才有值 + var reasonableSpeedInRemainDist = 0 + //获取区间测速电子眼长度,注意:只有在类型为区间测速时才有值 + var intervalLength = 0 + //获取进入区间测速路段后实时的区间路段剩余长度,-1表示没有信息 + var intervalRemainDistance = 0 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviCarInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviCarInfo.kt new file mode 100644 index 0000000000..54bad76663 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviCarInfo.kt @@ -0,0 +1,26 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +class NaviCarInfo { + //车辆的车牌号码. + var mCarNumber: String? = null + //是否躲避车辆限行。 + var isRestriction = true + //车辆类型,0小车,1货车,2纯电动车,3纯电动货车 + var mCarType = 0 + //货车的高度,单位:米。 + var mVehicleHeight = 0f + //货车的核定载重,单位:吨。 + var mVehicleWeight = 0f + //货车的总重,即车重+核定载重,单位:吨 + var mVehicleLoad = 0f + //算路时是否忽略车辆的载重因素 - true代表忽略,重量不会参与算路,false 不忽略,重量会参与算路,默认为false + var mVehicleLoadSwitch = false + //货车的最大宽度,单位:米。 如:1.8,1.5等等。 + var mVehicleWidth = 0f + //货车的最大长度,单位:米。 如:1.8,1.5等等。 + var mVehicleLength = 0f + //货车的大小 - 1-微型货车 2-轻型/小型货车 3-中型货车 4-重型货车 + var mVehicleSize = 0 + //货车的轴数 + var mVehicleAxis = 0 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviCross.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviCross.kt new file mode 100644 index 0000000000..befbb8409c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviCross.kt @@ -0,0 +1,14 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +import android.graphics.Bitmap + +class NaviCross { + var mWidth = 0 //图片宽度 + var mHeight = 0 //图片高度 + var mBitmap: Bitmap? = null //路口放大图的bitmap。 + var mPicFormat = 0 //图片格式类型,1 为栅格PNG图片,2 为矢量BMP图片 + + constructor(mBitmap: Bitmap) { + this.mBitmap = mBitmap + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviExitDirectionInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviExitDirectionInfo.kt new file mode 100644 index 0000000000..41f08949ef --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviExitDirectionInfo.kt @@ -0,0 +1,24 @@ +package com.zhidaoauto.map.sdk.open.nav.model +// +class NaviExitDirectionInfo { + //出口名称信息 + private var exitNameInfo: Array? = null + //出口方向信息 + private var directionInfo: Array? = null + + fun getExitNameInfo(): Array? { + return exitNameInfo + } + + fun setExitNameInfo(exitNameInfo: Array) { + this.exitNameInfo = exitNameInfo + } + + fun getDirectionInfo(): Array? { + return directionInfo + } + + fun setDirectionInfo(directionInfo: Array) { + this.directionInfo = directionInfo + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviForbiddenInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviForbiddenInfo.kt new file mode 100644 index 0000000000..b9cd22449f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviForbiddenInfo.kt @@ -0,0 +1,35 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +import java.util.LinkedList + +/* + * 导航禁止信息(例如 货车) + */ +class NaviForbiddenInfo { + //禁止信息对应路线id + var pathId: Long = 0 + //禁止类型 + var forbiddenType = 0 + //禁止时间 + var forbiddenTime: String? = null + //限制车辆类型类型 第1位:全部车型 第2位:小车 第3位:微型货车 第4位:轻型货车 第5位:中型货车 + // 第6位:重型货车 第7位:拖挂 第8位:保留 车型, 用一个长度为8的字符串表示,每一位上的数字如果为1, 表示该车型禁行, + // 如果为0, 表示该车型不禁行 如 '00001110' 表示'中型货车、重型货车、拖挂'禁行 + var carType: String? = null + //限制位置的经度 + var longitude = 0.0 + //限制位置的纬度 + var latitude = 0.0 + //限制的当前路段名称 + var roadName: String? = null + //限制的下一段路段名称 + var nextRoadName: String? = null + //限制位置所在的step索引 + var segIndex = 0 + //限制位置所在的link索引 + var linkIndex = 0 + //限制车辆类型描述 + var carTypeDesc: String? = null + var carTypes: LinkedList = LinkedList() + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviGuide.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviGuide.kt new file mode 100644 index 0000000000..b2c7bc4fd8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviGuide.kt @@ -0,0 +1,22 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +/* + * 导航段信息类 + */ +class NaviGuide { + //聚合段入口点的坐标 + var coord: LonLatPoint? = null + //聚合段长度 + var mLength = 0 + //聚合段行驶耗时 + var mUseTime = 0 + //聚合段转向类型 + var mIcon = 0 + //聚合段名称 + var mName: String? = null + var segCount = 0 + var startSegId = 0 + //聚合段的收费金额 + var toll = 0 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviLimitInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviLimitInfo.kt new file mode 100644 index 0000000000..66bbcbce93 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviLimitInfo.kt @@ -0,0 +1,16 @@ +package com.zhidaoauto.map.sdk.open.nav.model +/* + * 导航限制信息(例如 货车) + */ +class NaviLimitInfo { + //禁止信息对应路线id + var pathId: Long = 0 + //限制类型 + var type: Byte = 0 + //当前限制的经度 + var longitude = 0.0 + //当前限制的纬度 + var latitude = 0.0 + //限制的当前路段名称 + var currentRoadName: String? = null +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviLink.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviLink.kt new file mode 100644 index 0000000000..e436f6d7a8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviLink.kt @@ -0,0 +1,28 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +/* + * 道路link类 + */ +class NaviLink { + //该Link道路坐标点集 + var mCoords: List? = null + //该Link道路名称 + var mRoadName: String? = null + //该Link道路长度 + var mLength = 0 + //该Link道路耗时. + var mTime = 0 + //该Link道路等级 * 0 高速公路 * 1 国道 * 2 省道 * 3 县道 * 4 乡公路 * 5 县乡村内部道路 + // * 6 主要大街、城市快速道 * 7 主要道路 * 8 次要道路 * 9 普通道路 * 10 非导航道路 + var mRoadClass = 0 + //该Link道路是否有红绿灯 + var mIsTrafficLightIn = false + //获取该Link道路类型 1 主路 2 路口内部道路 3 JCT道路 4 环岛 5 服务区 6 匝道 7 辅路 8 匝道与JCT + // 9 出口 10 入口 11 A类右转专用道 12 B类右转专用道 13 A类左转专用道 14 B类左转专用道 15 普通道路 + // 16 左右转专用道 56 服务区与匝道 53 服务区与JCT 58 服务区与匝道以及JCT + var mRoadType = 0 + var ownership = 0 + var mLinkType = 0 + var trafficStatus = 0 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviNotAvoidInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviNotAvoidInfo.kt new file mode 100644 index 0000000000..9682db9df7 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviNotAvoidInfo.kt @@ -0,0 +1,68 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +import com.zhidaoauto.map.sdk.open.location.MogoLocation + +class NaviNotAvoidInfo { + + //类型:1-限高,2-限宽,3-限重,4-禁行 + var type = 0 + //禁行类型 0:禁止左转 1:禁止右转 2:禁止左掉头 3:禁止右掉头 4:禁止直行 + var forbidType = -1 + //到自车的距离 + var distToCar = 0 + //二维位置 + var coord2D: MogoLocation? = null + //三维位置 + var coord3D: MogoLocation? = null + //是否有效 + var valid = false + //限高 + val LIMIT_HEIGHT = 1 + //限宽 + val LIMIT_WIDTH = 2 + //限重 + val LIMIT_WEIGHT = 3 + //限行 + val LIMIT_RUN = 4 + //禁止左转 + val FORBID_TURN_LEFT = 0 + //禁止右转 + val FORBID_TURN_RIGHT = 1 + //禁止左掉头 + val FORBID_TURN_LEFT_ROUND = 2 + //禁止右掉头 + val FORBID_TURN_RIGHT_ROUND = 3 + //禁止直行 + val FORBID_GO_STRAIGHT = 4 + + + fun getLimitText(var0: Int): String? { + return if (var0 == 1) { + "限高" + } else if (var0 == 2) { + "限宽" + } else if (var0 == 3) { + "限重" + } else { + if (var0 == 4) "禁行" else null + } + } + + fun getForbiddenText(var0: Int): String? { + return if (var0 == 0) { + "禁止左转" + } else if (var0 == 1) { + "禁止右转" + } else if (var0 == 2) { + "禁止左掉头" + } else if (var0 == 3) { + "禁止右调头" + } else { + if (var0 == 4) "禁止直行" else null + } + } + + fun isValid(): Boolean { + return (forbidType != -1 || type != 0) && distToCar > 0 + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviOnlineCarHailingType.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviOnlineCarHailingType.kt new file mode 100644 index 0000000000..0f940d38c3 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviOnlineCarHailingType.kt @@ -0,0 +1,13 @@ +package com.zhidaoauto.map.sdk.open.nav.model +/* + * NONE + * 非网约车模式, 即正常的默认模式 + * PICKUP + * 网约车接驾模式,此模式会对路线做特殊处理,更符合网约车场景 + * TRANSPORT + * 网约车送驾模式,此模式会对路线做特殊处理,更符合网约车场景 + * + */ +enum class NaviOnlineCarHailingType(val value: Int) { + NONE(0), PICKUP(1), TRANSPORT(2); +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviParallelRoadStatus.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviParallelRoadStatus.kt new file mode 100644 index 0000000000..bf9e5d52a1 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviParallelRoadStatus.kt @@ -0,0 +1,14 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +class NaviParallelRoadStatus { + + companion object{ + val STATUS_NONE = 0 //无主辅路(无高架)态 + val STATUS_MAIN_ROAD = 1 //在主路(高架上)态 + val STATUS_SIDE_ROAD = 2 //在辅路(高架下)态 + } + + var mParallelRoadStatusFlag = 0 //主辅路标识(默认0) 0:无主辅路(车标所在道路旁无主辅路) 1:车标在主路(车标所在道路旁有辅路) 2:车标在辅路(车标所在道路旁有主路) + var mElevatedRoadStatusFlag = 0 //高架上下标识(默认0) 0:无高架 1:车标在高架上(车标所在道路有对应高架下) 2:车标在高架下(车标所在道路有对应高架上) + var status = 0 //道路切换切换状态 0:非路线切换期间 1:道路切换期间 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviPath.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviPath.kt new file mode 100644 index 0000000000..10c848692b --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviPath.kt @@ -0,0 +1,43 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +import com.zhidaoauto.map.sdk.open.camera.LatLngBounds +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class NaviPath { + var allLength = 0 //当前导航路线的总长度。 + var strategy = -1 //当前导航路线的路径计算策略。 + var allTime = 0 //当前导航路径所需的时间,单位为秒。 + var stepsCount = 0 //当前导航路线上分段的总数。 + var tollCost = 0 //导航段的花费金额,单位元。 注意:该接口仅驾车模式有效 + var dataVersion = 0 // + var routeType = 0 + var pathId: Long = 0 //路线id + var mMainRoadInfo: String? = null //主道路信息 注意:该接口仅驾车模式有效 + var center: LonLatPoint? = null //当前导航路线的中心点。 + var bounds: LatLngBounds? = null //该导航路线最小坐标点和最大坐标点围成的矩形区域。 + var labelId: String? = null + var labels: String? = null //当前路线的策略标签,如:距离最短,费用最少 注意:该接口仅驾车模式有效 + var wayPointIndex: IntArray? = null //途经点index数组 注意:该接口仅驾车模式有效 + var cityAdcodeList: IntArray? = null//驾车导航路线上沿途城市adcode列表 注意:该接口仅驾车模式有效 + var trafficStatuses: List = ArrayList() //当前路线的交通状态 注意:该接口仅驾车模式有效 + var mSteps: List? = null //当前导航路线上分段AMapNaviStep + var list: List? = null//当前导航路线的所有坐标点。 + var startPoi: LonLatPoint? = null //当前路线方案的起点坐标。 + var endPoi: LonLatPoint? = null //当前路线方案的终点坐标。 + var carToFootPoint: LonLatPoint? = null + var lightList: List? = null//道路上的红绿灯列表 + var wayPoi: List? = null //当前路径的途经点坐标 注意:该接口仅驾车模式有效 + var cameras: List? = null//全路段的所有摄像头 注意:该接口仅驾车模式有效 + var restrictionInfo: RestrictionInfo? = null //当前导航路线的限行信息。 + var guideGroups: List? = null //路线详情 + var trafficIncidentInfo: List? = null //路径交通事件信息 注意:该接口仅货车模式有效 + var limitInfos: List? = null //货车导航的限制信息列表 注意:该接口仅货车模式有效 + var forbiddenInfos: List? = null //货车导航的禁止信息列表 注意:该接口仅货车模式有效 + + + override fun toString(): String { + return "NaviPath(allLength=$allLength, strategy=$strategy, allTime=$allTime, stepsCount=$stepsCount, tollCost=$tollCost, dataVersion=$dataVersion, routeType=$routeType, pathId=$pathId, mMainRoadInfo=$mMainRoadInfo, center=$center, bounds=$bounds, labelId=$labelId, labels=$labels, wayPointIndex=${wayPointIndex?.contentToString()}, cityAdcodeList=${cityAdcodeList?.contentToString()}, trafficStatuses=$trafficStatuses, mSteps=$mSteps, list=$list, startPoi=$startPoi, endPoi=$endPoi, carToFootPoint=$carToFootPoint, lightList=$lightList, wayPoi=$wayPoi, cameras=$cameras, restrictionInfo=$restrictionInfo, guideGroups=$guideGroups, trafficIncidentInfo=$trafficIncidentInfo, limitInfos=$limitInfos, forbiddenInfos=$forbiddenInfos)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviRouteGuideGroup.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviRouteGuideGroup.kt new file mode 100644 index 0000000000..ea3b0696c3 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviRouteGuideGroup.kt @@ -0,0 +1,21 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class NaviRouteGuideGroup { + + var groupEnterCoord: LonLatPoint? = null//该路线详情分组的起点坐标 + var groupName: String? = null//路线详情分组名称 + var groupLen = 0 //该路线详情分组的长度 (米) + var groupTime = 0 //该路线详情分组的预计行驶时间(单位秒) + var groupTrafficLightsCount = 0 //该路线详情分组的红绿灯数量 注意:该接口仅驾车模式有效 + var groupIconType = 0 //该路线详情分组的转向 + var segments: List = ArrayList() //该路线详情分组包含的详情分段 + + + override fun toString(): String { + return "NaviRouteGuideGroup(groupEnterCoord=$groupEnterCoord, groupName=$groupName, groupLen=$groupLen, groupTime=$groupTime, groupTrafficLightsCount=$groupTrafficLightsCount, groupIconType=$groupIconType, segments=$segments)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviRouteGuideSegment.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviRouteGuideSegment.kt new file mode 100644 index 0000000000..91c5a59d89 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviRouteGuideSegment.kt @@ -0,0 +1,7 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +class NaviRouteGuideSegment { + var stepIconType = 0 //该详情分段的转向 + var description: String? = null //该详情分段的描述信息 + var isArriveWayPoint = false //该详情分段是否经过途经点 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviRouteNotifyData.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviRouteNotifyData.kt new file mode 100644 index 0000000000..6401ab89b5 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviRouteNotifyData.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +class NaviRouteNotifyData { + var notifyType = 0 //通知类型 具体类型 + var success = false //是否成功避开 + var distance = 0 //事件点与当前点的距离 -1:代表距离无效 0:代表当前已处在信息发生的范围内 + var latitude = 0.0 //事件点的纬度 + var longitude = 0.0 //事件点的经度 + var roadName: String? = null //事件点的路名 + var reason: String? = null //事件的主要原因,例如:道路封闭、限行、禁行 + var subTitle: String? = null //事件原因的补充说明 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviSetting.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviSetting.kt new file mode 100644 index 0000000000..fdfd06b2d4 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviSetting.kt @@ -0,0 +1,90 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +import com.zhidaoauto.map.sdk.inner.common.NavHelper + +class NaviSetting { + + //HUD模式下,设置限速信息是否显示 + fun setMonitorCameraEnabled(monitorCameraEnabled: Boolean){ + TODO("Not yet implemented") + } + + //设置交通状态是否更新 + //需要动态交通信息相关功能时需要调用此接口打开交通信息功能,默认是开启的, 打开后会每2分钟请求一次 + // 新的交通信息来更新交通信息。 + fun setTrafficStatusUpdateEnabled(enable: Boolean){ + TODO("Not yet implemented") + } + + //设置是否打开移动交通台功能 默认是开启的,打开此功能后将有整体路况概览与前方路况播报功能, + //打开此功能后TBT会基本1分钟请求 一次前方路况(此时间间隔不是固定的)。 + fun setTrafficInfoUpdateEnabled(enable: Boolean){ + TODO("Not yet implemented") + + } + + //设置电子眼播报是否开启 + //初始电子眼播报是打开的,当电子眼播报打开时,电子眼数据中有限速信息时,同时会播报限速信息 + fun setCameraInfoUpdateEnabled(enable: Boolean){ + TODO("Not yet implemented") + + } + + //设置路口放大图 是否显示 + fun setCrossingDrawingEnabled(crossingDrawingEnabled: Boolean){ + NavHelper.mNavParams.setCrossingDrawingEnabled(crossingDrawingEnabled) + + } + + + //设置屏幕是否常亮,默认开启 + fun setScreenAlwaysBright(isAlwaysBright: Boolean){ + NavHelper.mNavParams.setScreenAlwaysBright(isAlwaysBright) + + } + + //是否开启第二个路口转向提示 + fun setOpenNextRoadInfo(open: Boolean){ + NavHelper.mNavParams.setOpenNextRoadInfo(open) + + } + + + //是否允许移动网络下载离线语音dex,默认为不允许 + fun setIgnoreWifi(ignore: Boolean){ + NavHelper.mNavParams.setIgnoreWifi(ignore) + + } + + fun isIsIgnoreWifi(): Boolean{ + return NavHelper.mNavParams.isIsIgnoreWifi() + } + + fun isTrafficStatusUpdateEnabled(): Boolean{ + return NavHelper.mNavParams.isTrafficStatusUpdateEnabled() + } + + fun isTrafficInfoUpdateEnabled(): Boolean{ + return NavHelper.mNavParams.isTrafficInfoUpdateEnabled() + } + + fun isCameraInfoUpdateEnabled(): Boolean{ + return NavHelper.mNavParams.isCameraInfoUpdateEnabled() + } + + fun isCrossingDrawingEnabled(): Boolean{ + return NavHelper.mNavParams.isCrossingDrawingEnabled() + } + + fun isScreenAlwaysBright(): Boolean{ + return NavHelper.mNavParams.isScreenAlwaysBright() + } + + fun isOpenNextRoadInfo(): Boolean{ + return NavHelper.mNavParams.isOpenNextRoadInfo() + } + + fun isMonitorCameraEnabled(): Boolean { + return NavHelper.mNavParams.isMonitorCameraEnabled() + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviStep.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviStep.kt new file mode 100644 index 0000000000..0a0357a044 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviStep.kt @@ -0,0 +1,34 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class NaviStep { + //路段长度 + var mLength = 0 + //该路段耗时 + var mTime = 0 + //该路段的收费金额 注意 + var mTollCost = 0 + //该路段红绿灯总数 + var mTrafficLightCount = 0 + //是否经过途经点 + var mIsArriveWayPoint = false + //该路段收费路段距离 注意 + var mChargeLength = 0 + //该路段起点index + var mStartIndex = 0 + //该路段终点index + var mEndIndex = 0 + //该路段坐标点集 + var mCoords: List? = null + //该路段Link集 + var mAMapNaviLinks: List? = null + //当前路段的转向动作类型 + var iconType = 0 + + override fun toString(): String { + return "NaviStep(mLength=$mLength, mTime=$mTime, mTollCost=$mTollCost, mTrafficLightCount=$mTrafficLightCount, mIsArriveWayPoint=$mIsArriveWayPoint, mChargeLength=$mChargeLength, mStartIndex=$mStartIndex, mEndIndex=$mEndIndex, mCoords=$mCoords, mAMapNaviLinks=$mAMapNaviLinks, iconType=$iconType)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviTrafficFacilityInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviTrafficFacilityInfo.kt new file mode 100644 index 0000000000..fc9b678d19 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/NaviTrafficFacilityInfo.kt @@ -0,0 +1,9 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +class NaviTrafficFacilityInfo { + var longitude = 0.0 //道路设施经度 + var latitude = 0.0 //道路设施维度 + var type = 0 //道路设施类型 + var distance = 0 //距离设施的剩余距离,单位:米 + var limitSpeed = 0 //道路设施限速速度 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/RestrictionInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/RestrictionInfo.kt new file mode 100644 index 0000000000..ad7420fac3 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/RestrictionInfo.kt @@ -0,0 +1,9 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +class RestrictionInfo { + + var restrictionTitle: String? = null //当前限行信息的标题 + var titleType = 0 //当前限行标题类型。 + var tips: String? = null //限行提示文案 + var cityCode = 0 //城市代码 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/RouteOverlayOptions.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/RouteOverlayOptions.kt new file mode 100644 index 0000000000..171b9e932c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/RouteOverlayOptions.kt @@ -0,0 +1,30 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +import android.graphics.Bitmap +import android.graphics.Rect + +class RouteOverlayOptions { + var smoothTraffic: Bitmap? = null//交通状况情况良好下的纹理位图 + var unknownTraffic: Bitmap? = null//交通状况未知下的纹理位图 + var slowTraffic: Bitmap? = null//交通状况迟缓下的纹理位图 + var jamTraffic: Bitmap? = null//交通状况拥堵下的纹理位图 + var veryJamTraffic: Bitmap? = null //交通状况非常拥堵下的纹理位图 + var arrowOnTrafficRoute: Bitmap? = null//浮于道路上的『小箭头』图标的纹理位图 + var normalRoute: Bitmap? = null//路线的图标 + var passRoute: Bitmap? = null//自定义走过的路线纹理(实线) 默认走过路线置灰功能为关,需要在 + var fairWayRes: Bitmap? = null//路线虚线纹理 + var passFairWayRes: Bitmap? = null//自定义走过的步行路线纹理(虚线) 默认走过路线置灰功能为关,需要在 + var arrowSideColor = 0//设置3D箭头侧面颜色,只有显示 3D箭头情况加才有效 + var arrowColor = -1 //路线上转弯处箭头的颜色 + var isTurnArrowIs3D = true//是否显示3D箭头,默认显示 + var isShowCameOnRoute = true + var rect: Rect? = null//全览状态下,路线距离四周的边距 + var lineWidth = 0f//导航线路的宽度 + fun setPassFairRoute(var1: Bitmap?) { + passFairWayRes = var1 + } + + fun setOnRouteCameShow(var1: Boolean) { + isShowCameOnRoute = var1 + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/ServiceAreaInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/ServiceAreaInfo.kt new file mode 100644 index 0000000000..1885e93590 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/ServiceAreaInfo.kt @@ -0,0 +1,10 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class ServiceAreaInfo { + var remainDist = 0 //当前位置到服务区的距离 + var type = 0 //服务区的类型 + var name: String? = null //服务区的名称 + var coordinate: LonLatPoint = LonLatPoint() //服务区位置 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/TrafficIncidentInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/TrafficIncidentInfo.kt new file mode 100644 index 0000000000..94045f6616 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/TrafficIncidentInfo.kt @@ -0,0 +1,9 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +class TrafficIncidentInfo { + + var longitude = 0f//事件地点的经度 + var latitude = 0f//事件地点的纬度 + var title: String? = null//事件标题 + var type = 0//事件类型 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/TrafficStatus.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/TrafficStatus.kt new file mode 100644 index 0000000000..4c189cb0d5 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/model/TrafficStatus.kt @@ -0,0 +1,19 @@ +package com.zhidaoauto.map.sdk.open.nav.model + +class TrafficStatus { + var linkIndex = 0 //当前路况在整条路线的link下标位置 + var mStatus = 0 //交通状态。 0未知状态,1通畅,2缓行,3阻塞,4严重阻塞 + var mLength = 0 //该交通状态路段的拥堵状态长度。 + + fun getLength(): Int{ + return mLength + } + + fun getStatus(): Int{ + return mStatus + } + + fun getlinkIndex(): Int{ + return linkIndex + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/DirectionView.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/DirectionView.kt new file mode 100644 index 0000000000..3ae74ea0a6 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/DirectionView.kt @@ -0,0 +1,75 @@ +package com.zhidaoauto.map.sdk.open.nav.view + +import android.annotation.SuppressLint +import android.content.Context +import android.graphics.Bitmap +import android.graphics.Canvas +import android.graphics.drawable.Drawable +import android.util.AttributeSet +import android.view.ViewGroup +import android.widget.ImageView +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.open.abs.MapStatusListener + +@SuppressLint("AppCompatCustomView") +class DirectionView: ImageView, MapStatusListener { + private var icon: Drawable? = null + private var mapController: IMapController? = null + + + constructor(var1: Context?, var2: AttributeSet?, var3: Int) : super(var1, var2, var3) { + init() + } + + constructor(var1: Context?, var2: AttributeSet?) : super(var1, var2) { + init() + } + + constructor(var1: Context?) : super(var1) { + init() + } + + public override fun onDraw(canvas: Canvas) { + if (null == mapController) { + return + } + canvas.save() + canvas.translate(width / 2.toFloat(), height / 2.toFloat()) + canvas.concat(matrix) + canvas.rotate(mapController!!.getMapViewRotation()) + canvas.translate(-width / 2.toFloat(), -height / 2.toFloat()) + super.onDraw(canvas) + canvas.restore() + postInvalidate() + } + + + override fun onMapStatusChanged(type: Int, value: Int) { + postInvalidate() + } + + private fun init(){ + icon = try { + context.resources.getDrawable(R.mipmap.mapdir) + } catch (e: Exception) { + null + } + if (null != icon) { + icon!!.setBounds(0, 0, icon!!.intrinsicWidth, icon!!.intrinsicHeight) + val scale = resources.displayMetrics.density + val btnSize = resources.getDimensionPixelSize(R.dimen.btn_size) + layoutParams = ViewGroup.LayoutParams(btnSize, btnSize) + val padding = (5 * scale + 0.5f).toInt() + setPadding(padding, padding, padding, padding) + setImageDrawable(icon) +// mapController = instance.mapController +// CommonEventController.instance.addMapStatusListener(this, MapController.LISTENER_TYPE_3D or MapController.LISTENER_TYPE_ROTATE) + } + } + + + fun setDirectionBitmap(bitmap: Bitmap) { + setImageBitmap(bitmap) + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/DriveWayView.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/DriveWayView.kt new file mode 100644 index 0000000000..06288b399b --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/DriveWayView.kt @@ -0,0 +1,11 @@ +package com.zhidaoauto.map.sdk.open.nav.view + + +class DriveWayView { + private val driveWayWidth = 0 //单车道控件宽度 + private val driveWayHeight = 0 //单车道控件高度 + private val driveWaySize = 0 //车道数量 + private val mItemLineWidth = 0 + + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/NextTurnTipView.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/NextTurnTipView.kt new file mode 100644 index 0000000000..d4a8d1d149 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/NextTurnTipView.kt @@ -0,0 +1,103 @@ +package com.zhidaoauto.map.sdk.open.nav.view + +import android.content.Context +import android.content.res.Resources +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import android.util.AttributeSet +import android.widget.ImageView +import com.zhidaoauto.map.sdk.R + +class NextTurnTipView : ImageView { + var customIconTypeDrawables: IntArray? = null//图片数组 + var nextTurnBitmap: Bitmap? = null + var mLastIconType = -1L + var customResources: Resources? = resources + + + /** + * 用于设置自定义的icon图片数组。 + * + * + * 此方法与NextTurnTipView.setIconType(int)相互配合。 + * 导航过程中,SDK会调用NextTurnTipView.setIconType(int)设置转向图片,其中图片 + * 就是通过customIconTypes[]数组对应index下标获取的。 + * + * @param res Resource资源 + * @param customIconTypes icon数组,数组中存放图片的顺序需要与IconType依次对应 + */ + fun setCustomIconTypes(res: Resources?, customIconTypes: IntArray?) { + try { + if (res == null || customIconTypes == null) { + return + } + this.customResources = res + customIconTypeDrawables = IntArray(customIconTypes.size + 2) + for ((i,type) in customIconTypes.withIndex()) { + customIconTypeDrawables!![i] = type + } + } catch (e: Throwable) { + e.printStackTrace() + } + } + + constructor(context: Context?, attrs: AttributeSet?, defStyle: Int) : super(context, attrs, defStyle) {} + constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {} + constructor(context: Context?) : super(context) {} + + fun recycleResource() { + try { + if (nextTurnBitmap != null) { + nextTurnBitmap!!.recycle() + nextTurnBitmap = null + } + } catch (e: Throwable) { + e.printStackTrace() + } + } + + fun setIconType(iconType: Int) { + try { + if (mLastIconType == iconType.toLong()) { + return + } + recycleResource() + nextTurnBitmap = BitmapFactory.decodeResource(customResources, getIcon(iconType)) + setImageBitmap(nextTurnBitmap) + mLastIconType = iconType.toLong() + } catch (e: Exception) { + e.printStackTrace() + } + } + + fun setIconBitmap(bitmap: Bitmap?) { + setImageBitmap(bitmap) + } + + private fun getIcon(nID: Int): Int{ + for ((i,icon) in defaultIconId.withIndex()) { + if (icon == nID) { + if (customIconTypeDrawables != null && customResources != null) + return customIconTypeDrawables!!.get(i) + else + return defaultIconTypes.get(i) + } + } + return defaultIconTypes[0] + } + + companion object { + var defaultIconTypes = intArrayOf( + R.mipmap.navi_s_1, R.mipmap.navi_s_2, R.mipmap.navi_s_3, R.mipmap.navi_s_4, + R.mipmap.navi_s_5, R.mipmap.navi_s_6, R.mipmap.navi_s_7, R.mipmap.navi_s_8, R.mipmap.navi_s_9, R.mipmap.navi_s_10, + R.mipmap.navi_s_11, R.mipmap.navi_s_12, R.mipmap.navi_s_13, R.mipmap.navi_s_14, R.mipmap.navi_s_15, R.mipmap.navi_s_22, + R.mipmap.navi_s_27, R.mipmap.navi_s_28, R.mipmap.navi_s_29, R.mipmap.navi_s_35, R.mipmap.navi_s_42, R.mipmap.navi_s_43, + R.mipmap.navi_s_44, R.mipmap.navi_s_501, R.mipmap.navi_s_502, R.mipmap.navi_s_503 + ) + + var defaultIconId = intArrayOf( + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 22, 27, 28, 29, 35, 42, 43, 44, + 501, 502, 503 + ) + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/OverviewButtonView.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/OverviewButtonView.kt new file mode 100644 index 0000000000..2ce2220fcd --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/OverviewButtonView.kt @@ -0,0 +1,43 @@ +package com.zhidaoauto.map.sdk.open.nav.view + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.widget.LinearLayout +import com.zhidaoauto.map.sdk.R +import kotlinx.android.synthetic.main.view_over_view.view.tv_over_view + +class OverviewButtonView: LinearLayout{ + private var isOverView = false + + constructor(context: Context?, attrs: AttributeSet?, defStyle: Int) : super(context, attrs, defStyle) { + init() + } + constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) { + init() + } + constructor(context: Context?) : super(context) { + init() + } + + private fun init() { + val view = LayoutInflater.from(context).inflate(R.layout.view_over_view, null) + addView(view) + } + + + fun setOverView(isOverView: Boolean) { + this.isOverView = isOverView + if(isOverView){ + tv_over_view.text = "返回" + } else { + tv_over_view.text = "全貌" + } + + } + + fun getIsOverView(): Boolean{ + return isOverView + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/RouteOverLay.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/RouteOverLay.kt new file mode 100644 index 0000000000..21106074a4 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/RouteOverLay.kt @@ -0,0 +1,74 @@ +package com.zhidaoauto.map.sdk.open.nav.view + +import android.content.Context +import android.graphics.Bitmap +import com.zhidaoauto.map.sdk.open.marker.BitmapDescriptor +import com.zhidaoauto.map.sdk.open.marker.Marker +import com.zhidaoauto.map.sdk.open.nav.model.NaviPath +import com.zhidaoauto.map.sdk.open.nav.model.RouteOverlayOptions +import com.zhidaoauto.map.sdk.open.poyline.Polyline +import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class RouteOverLay{ + private var startMarker: Marker? = null + private var endMarker: Marker? = null + private var footMarker: Marker? = null + private val wayMarkers: MutableList = ArrayList() + private val mTrafficLights: MutableList = ArrayList() + private val ferryMarkers: MutableList = ArrayList() + var bubbleMarker: Marker? = null + private var startBitmap: Bitmap? = null + private var endBitmap: Bitmap? = null + private var wayBitmap: Bitmap? = null + private var footBitmap: Bitmap? = null + private var arrowOnRoute: BitmapDescriptor? = null + private var normalRoute: BitmapDescriptor? = null + private var unknownTraffic: BitmapDescriptor? = null + private var smoothTraffic: BitmapDescriptor? = null + private var slowTraffic: BitmapDescriptor? = null + private var jamTraffic: BitmapDescriptor? = null + private var veryJamTraffic: BitmapDescriptor? = null + private var fairWayRes: BitmapDescriptor? = null + private var passRoute: BitmapDescriptor? = null + private var passFairWayRes: BitmapDescriptor? = null + private var passDefaultRes: BitmapDescriptor? = null + private var trafficLightRes: BitmapDescriptor? = null + private val wayPoisRes: Array = arrayOfNulls(3) + private var mRouteOverlayOptions: RouteOverlayOptions? = null + private var mPassDefaultPolyline: Polyline? = null + var mTrafficColorfulPolyline: Polyline? = null + var mPassTrafficColorfulPolyline: Polyline? = null + protected var passStartUnNaviPolyline: Polyline? = null + protected var passEndUnNaviPolyline: Polyline? = null + protected var arrowOnRoutePolyline: Polyline? = null + var mTrafficColorfulPolylineOptions: PolylineOptions? = null + var mPassTrafficColorfulPolylineOptions: PolylineOptions? = null + private var mContext: Context? = null + private var mWidth = 0f + private var mAMapNaviPath: NaviPath? = null + private val mLatLngsOfPath: MutableList = ArrayList() + private val carLinkCoods: MutableList = ArrayList() + private val mCustomPolyLines: MutableList = ArrayList() + protected var mLineTextureMap: HashMap = HashMap() + private var arrowColor = -1 + private var arrowSideColor = 1990523135 + private var turnArrowIs3D = true + private var showTurnArrow = true + private var showArrowOnRoute = true + private var showTrafficLights = true + private var isTrafficLine = true + private var isAllOverlayVisible = true + private var isAlwaysLightsVisible = true + private var showStartMarker = true + private var showEndMarker = true + private var showViaMarker = true + private var showFootFerryMarker = true + private var showForbiddenMarker = true + var mapWidth = 0 + var mapHeight = 0 + var independentStepStartIndexList: List? = null + var independentStepEndIndexList: List? = null + var independentLinkStartIndexList: List? = null + var independentLinkEndIndexList: List? = null +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/TmcBarView.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/TmcBarView.kt new file mode 100644 index 0000000000..6a2b2548f9 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/TmcBarView.kt @@ -0,0 +1,280 @@ +package com.zhidaoauto.map.sdk.open.nav.view + +import android.content.Context +import android.graphics.* +import android.os.Build +import android.util.AttributeSet +import android.view.View +import android.widget.ImageView +import com.zhidaoauto.map.sdk.open.nav.model.TrafficStatus +import java.util.* + +class TmcBarView : View { + /** + * 绘制TmcBar的公用画笔 + */ + private var mPaint: Paint? = null + private var mTmcBarItems: List? = null + private var mRouteTotalLength = 0 + + /** + * 光标位置 + */ + private var mCursorPos = 0f //值由大到小递减 + + /** + * Tmc状态监听 + */ + private var mTmcBarListener: TmcBarListener? = null + + /** + * 由于canvas中操作tmcTag对象过于频繁,性能考虑cache一份 + */ + private val mTagCache = TmcTag() + + //因为上边的遮罩有问题,矩形有可能有透出,所以clip下,防止透出 // fix #9826694 + private var mPathHeight = 0 + private val mPath = Path() + private val radiusArray = FloatArray(8) + private var unknownTrafficColor = 0 + private var smoothTrafficColor = 0 + private var slowTrafficColor = 0 + private var jamTrafficColor = 0 + private var veryJamTrafficColor = 0 + + constructor(context: Context?) : super(context) { + init() + } + + constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) { + init() + } + + constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { + init() + } + + private fun init() { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { + setLayerType(LAYER_TYPE_SOFTWARE, null) + } + } + + fun setData(items: List?, totalLength: Int) { + mTmcBarItems = items + mRouteTotalLength = totalLength + } + + /** + * 设置自车View对象 + * @param mDefaultTmcBarCarView + */ + var mDefaultTmcBarCarView: ImageView? = null + var mCarHeight = 0 + fun setCarView(carView: ImageView?) { + mDefaultTmcBarCarView = carView + mDefaultTmcBarCarView?.let{ + mCarHeight = it.layoutParams.height - 3 + } + + } + + /** + * 设置游标位置 + * + * @param cursorPos + */ + var mCursorRatio = 1.0f + fun setCursorPos(retainLength: Int) { + mCursorRatio = retainLength * 1.0f / (mRouteTotalLength.toFloat() * 1.0f) + } + + override fun onDraw(canvas: Canvas) { + try { + val width = this.width + val height = this.height - mCarHeight + if (mCursorRatio > 1.0f) { + mCursorRatio = 1.0f + } + mCursorPos = mCursorRatio * height.toFloat() + if (mDefaultTmcBarCarView != null) { + mDefaultTmcBarCarView!!.translationY = mCursorPos + mDefaultTmcBarCarView!!.invalidate() + } + //计算矩形内的填充高度 + if (mTmcBarItems != null && this.height > 0) { + if (mPathHeight != this.height) { + mPath.reset() + Arrays.fill(radiusArray, width.toFloat() / 2.0f) + mPath.addRoundRect(RectF(0.0f, 0.0f, width.toFloat(), this.height.toFloat()), radiusArray, Path.Direction.CW) + mPathHeight = this.height + } + canvas.save() + canvas.clipPath(mPath) + //计算过程中实际距离的累加 + var realDistanceSum = 0.0f + //距离和View高度的比率,用于在view高度和实际距离之间进行转换,单位:像素/米 + val rateDistanceToViewHeight = height.toFloat() * 1.0f / (mRouteTotalLength.toFloat() * 1.0f) + var tmcBarLength = mTmcBarItems!!.size - 1 + //从上往下绘制 + while (tmcBarLength >= 0) { + var trafficStatus = mTmcBarItems!![tmcBarLength] + ////计算tmcBar在绘制过程中每一小段的长度 + val itemHeight = Math.round(trafficStatus.getLength() * rateDistanceToViewHeight * 100.0f) * 0.01f + realDistanceSum += itemHeight + canvas.drawRect(0.0f, realDistanceSum - itemHeight, width.toFloat(), realDistanceSum, getPaintInColor(getColor(trafficStatus.getStatus()))) + --tmcBarLength + } + tmcBarLength = height + (mCarHeight shr 1) + //补全光柱图,使用颜色==第一段的颜色 + if (realDistanceSum < tmcBarLength.toFloat()) { + canvas.drawRect(0.0f, realDistanceSum, width.toFloat(), tmcBarLength.toFloat(), getPaintInColor(getColor((mTmcBarItems!![0]).getStatus()))) + } + //补全光柱图,使用颜色==第一段的颜色 + if (this.height.toFloat() > mCursorPos) { + canvas.drawRect(0.0f, mCursorPos + (mCarHeight shr 1).toFloat(), width.toFloat(), this.height.toFloat(), getPaintInColor(getColor(-1))) + } + if (mTmcBarListener != null) { + mTmcBarListener!!.dismissBottomTag() + } + canvas.restore() + } + } catch (e: Throwable) { + e.printStackTrace() + } + } + + /** + * 获取指定颜色的画笔. + * + * @param color 画笔颜色 + * @return 设置成指定颜色的画笔 + * @author jiawu.ljw + */ + private fun getPaintInColor(color: Int): Paint? { + if (mPaint == null) { + mPaint = Paint() + mPaint!!.isAntiAlias = true + mPaint!!.style = Paint.Style.FILL + } + mPaint!!.color = color + return mPaint + } + + fun setUnknownTrafficColor(unknownTrafficColor: Int) { + this.unknownTrafficColor = unknownTrafficColor + } + + fun setSmoothTrafficColor(smoothTrafficColor: Int) { + this.smoothTrafficColor = smoothTrafficColor + } + + fun setSlowTrafficColor(slowTrafficColor: Int) { + this.slowTrafficColor = slowTrafficColor + } + + fun setJamTrafficColor(jamTrafficColor: Int) { + this.jamTrafficColor = jamTrafficColor + } + + fun setVeryJamTrafficColor(veryJamTrafficColor: Int) { + this.veryJamTrafficColor = veryJamTrafficColor + } + /** + * 根据路况取对应的颜色值 + * + * @param status + * @return + */ + private fun getColor(status: Int): Int { + return when (status) { + 0 -> { + if (this.unknownTrafficColor != 0) { + return this.unknownTrafficColor + } + Color.parseColor("#0091FF") + } + 1 -> { + if (smoothTrafficColor != 0) { + return smoothTrafficColor + } + Color.parseColor("#00BA1F") + } + 2 -> { + if (slowTrafficColor != 0) { + return slowTrafficColor + } + Color.parseColor("#FFBA00") + } + 3 -> { + if (jamTrafficColor != 0) { + return jamTrafficColor + } + Color.parseColor("#F31D20") + } + 4 -> { + if (veryJamTrafficColor != 0) { + return veryJamTrafficColor + } + + Color.parseColor("#A8090B") + } + else -> Color.parseColor("#D1D1D1") + } + } + + /** + * 设置Pop状态监听. + * + * @param listener + */ + fun setTacBarListener(listener: TmcBarListener?) { + mTmcBarListener = listener + } + + /** + * TmcBar状态监听,用于是否显示Pop信息 + */ + interface TmcBarListener { + fun showBottomTag(tmcTag: TmcTag?) //显示底部tag + fun dismissBottomTag() //隐藏底部tag + } + + /** + * 光柱图左侧标签显示内容封装类 + */ + class TmcTag { + var status = 0 //状态 + + var translationY = 0 //相对坐标 + + var roadLength = 0//道路长度 + + var bgResId = 0 //textview控件背景资源 + + var textColor = 0 //字体颜色 + + var viewHeight = 0f //tag对应的拥堵段在光柱图上的高度 + + var index = 0 //在数组中的序号 + + } + + + companion object { + /** + * 显示Pop距离的最小阈值 + */ + private const val DISTANCE_MIN = 10 + + /** + * 显示Pop距离的最大阈值 + */ + private const val DISTANCE_MID = 5 * 1000 + + /** + * 显示Pop距离的最大阈值 + */ + private const val DISTANCE_MAX = 50 * 1000 + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/TrafficButtonView.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/TrafficButtonView.kt new file mode 100644 index 0000000000..86dba5bcd8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/TrafficButtonView.kt @@ -0,0 +1,79 @@ +package com.zhidaoauto.map.sdk.open.nav.view + +import android.content.Context +import android.graphics.Bitmap +import android.util.AttributeSet +import android.view.LayoutInflater +import android.widget.LinearLayout +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.open.MapAutoApi +import kotlinx.android.synthetic.main.view_traffic_button.view.img_traffic + + +class TrafficButtonView : LinearLayout { + private var mIsTrafficOpen = false + private var mTrafficOpen: Bitmap? = null + private var mTrafficClose: Bitmap? = null + private var isNight = true + + constructor(var1: Context?, var2: AttributeSet?, var3: Int) : super(var1, var2, var3) { + init() + } + + constructor(var1: Context?, var2: AttributeSet?) : super(var1, var2) { + init() + } + + constructor(var1: Context?) : super(var1) { + init() + } + + private fun init() { + val view = LayoutInflater.from(context).inflate(R.layout.view_traffic_button, null) + addView(view) + val style = MapAutoApi.MAP_STYLE_NIGHT_VR + isNight = !(style == MapAutoApi.MAP_STYLE_DAY || style == MapAutoApi.MAP_STYLE_DAY_NAV) + setIsTrafficOpen(mIsTrafficOpen) + } + + fun setTrafficResource(trafficOpen: Bitmap, trafficClose: Bitmap) { + mTrafficOpen = trafficOpen + mTrafficClose = trafficClose + setIsTrafficOpen(mIsTrafficOpen) + } + + fun getIsTrafficOpen(): Boolean { + return mIsTrafficOpen + } + + fun setIsTrafficOpen(isTrafficOpen: Boolean) { + mIsTrafficOpen = isTrafficOpen + if(mTrafficOpen !=null && mTrafficClose !=null){ + if(mIsTrafficOpen) + img_traffic.setImageBitmap(mTrafficOpen) + else + img_traffic.setImageBitmap(mTrafficClose) + }else{ + if(isNight){ + img_traffic.setBackgroundResource(R.drawable.btn_selecter_night) + if(mIsTrafficOpen) + img_traffic.setImageResource(R.mipmap.icon_traffic_open_night) + else + img_traffic.setImageResource(R.mipmap.icon_traffic_close_night) + }else{ + img_traffic.setBackgroundResource(R.drawable.btn_selecter_day) + if(mIsTrafficOpen) + img_traffic.setImageResource(R.mipmap.icon_traffic_open_day) + else + img_traffic.setImageResource(R.mipmap.icon_traffic_close_day) + } + + } + } + + + fun processNightMode(isNight: Boolean) { + this.isNight = isNight + setIsTrafficOpen(mIsTrafficOpen) + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/TrafficProgressBar.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/TrafficProgressBar.kt new file mode 100644 index 0000000000..85bd8989eb --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/TrafficProgressBar.kt @@ -0,0 +1,106 @@ +package com.zhidaoauto.map.sdk.open.nav.view + +import android.content.Context +import android.graphics.Color +import android.util.AttributeSet +import android.view.LayoutInflater +import android.widget.FrameLayout +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.open.nav.model.TrafficStatus +import kotlinx.android.synthetic.main.view_trafficbar.view.tmcBarCar +import kotlinx.android.synthetic.main.view_trafficbar.view.tmcBarTxt +import kotlinx.android.synthetic.main.view_trafficbar.view.tmcBarView + +class TrafficProgressBar : FrameLayout { + constructor(context: Context?, attrs: AttributeSet?, defStyle: Int) : super(context, attrs, defStyle) { + init() + } + constructor(context: Context?) : super(context) { + init() + } + constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) { + init() + } + + + private fun init() { + val view = LayoutInflater.from(context).inflate(R.layout.view_trafficbar, null) + addView(view) + tmcBarView!!.setCarView(tmcBarCar) + + } + + /** + * 更新光柱条 + * + * @param allLength 整条路线长度 + * @param retainLength 剩余距离 + * @param traffics 交通状态列表 + */ + fun update(allLength: Int, retainLength: Int, traffics: List?) { + try { + tmcBarView?.setData(traffics, allLength) + tmcBarView?.setCursorPos(retainLength) + tmcBarView?.invalidate() + } catch (var4: Throwable) { + var4.printStackTrace() + } + } + + fun updateTmcBarTxtColor(isNight: Boolean) { + if(isNight) + tmcBarTxt.setTextColor(Color.WHITE) + else + tmcBarTxt.setTextColor(Color.BLACK) + } + + fun setUnknownTrafficColor(unknownTrafficColor: Int) { + try { + if (tmcBarView!= null) { + tmcBarView!!.setUnknownTrafficColor(unknownTrafficColor) + } + } catch (throwable: Throwable) { + throwable.printStackTrace() + } + } + + fun setSmoothTrafficColor(slowTrafficColor: Int) { + try { + if (tmcBarView != null) { + tmcBarView!!.setSmoothTrafficColor(slowTrafficColor) + } + } catch (throwable: Throwable) { + throwable.printStackTrace() + } + } + + fun setSlowTrafficColor(slowTrafficColor: Int) { + try { + if (tmcBarView != null) { + tmcBarView!!.setSlowTrafficColor(slowTrafficColor) + } + } catch (throwable: Throwable) { + throwable.printStackTrace() + } + } + + fun setJamTrafficColor(jamTrafficColor: Int) { + try { + if (tmcBarView != null) { + tmcBarView!!.setJamTrafficColor(jamTrafficColor) + } + } catch (throwable: Throwable) { + throwable.printStackTrace() + } + } + + fun setVeryJamTrafficColor(veryJamTrafficColor: Int) { + try { + if (tmcBarView != null) { + tmcBarView!!.setVeryJamTrafficColor(veryJamTrafficColor) + } + } catch (throwable: Throwable) { + throwable.printStackTrace() + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/ZoomButtonView.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/ZoomButtonView.kt new file mode 100644 index 0000000000..2226730f57 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/ZoomButtonView.kt @@ -0,0 +1,72 @@ +package com.zhidaoauto.map.sdk.open.nav.view + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.View +import android.widget.ImageView +import android.widget.LinearLayout +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.open.MapAutoApi +import kotlinx.android.synthetic.main.panel_btn_zoom.view.img_zoom_in +import kotlinx.android.synthetic.main.panel_btn_zoom.view.img_zoom_out + +class ZoomButtonView : LinearLayout, View.OnClickListener{ + + constructor(context: Context?, attrs: AttributeSet?, defStyle: Int) : super(context, attrs, defStyle) { + init() + } + constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) { + init() + } + constructor(context: Context?) : super(context) { + init() + } + + private fun init() { + val view = LayoutInflater.from(context).inflate(R.layout.view_zoom, null) + addView(view) + img_zoom_in.setOnClickListener(this) + img_zoom_out.setOnClickListener(this) + val style = MapAutoApi.MAP_STYLE_NIGHT_VR + if(style == MapAutoApi.MAP_STYLE_DAY || style == MapAutoApi.MAP_STYLE_DAY_NAV){ + img_zoom_in.setImageResource(R.mipmap.icon_zoom_in_day) + img_zoom_out.setImageResource(R.mipmap.icon_zoom_out_day) + }else{ + img_zoom_in.setImageResource(R.mipmap.icon_zoom_in_night) + img_zoom_out.setImageResource(R.mipmap.icon_zoom_out_night) + } + } + + override fun onClick(v: View?) { + when(v?.id){ + R.id.img_zoom_in -> { +// CommonController.instance.mapController?.zoomIn() + } + R.id.img_zoom_out -> { +// CommonController.instance.mapController?.zoomOut() + } + } + + } + + fun getZoomOutBtn(): ImageView? { + return img_zoom_out + } + + fun getZoomInBtn(): ImageView? { + return img_zoom_in + } + + + fun processNightMode(isNight: Boolean) { + if(isNight){ + img_zoom_in.setImageResource(R.mipmap.icon_zoom_in_night) + img_zoom_out.setImageResource(R.mipmap.icon_zoom_out_night) + }else{ + img_zoom_in.setImageResource(R.mipmap.icon_zoom_in_day) + img_zoom_out.setImageResource(R.mipmap.icon_zoom_out_day) + } + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/ZoomInIntersectionView.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/ZoomInIntersectionView.kt new file mode 100644 index 0000000000..53822a9076 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/nav/view/ZoomInIntersectionView.kt @@ -0,0 +1,40 @@ +package com.zhidaoauto.map.sdk.open.nav.view + +import android.content.Context +import android.graphics.Bitmap +import android.util.AttributeSet +import android.view.MotionEvent +import android.widget.ImageView +import com.zhidaoauto.map.sdk.open.nav.model.NaviCross + +class ZoomInIntersectionView : ImageView { + private var zoomInBitmap: Bitmap? = null + + constructor(var1: Context?, var2: AttributeSet?, var3: Int) : super(var1, var2, var3) {} + constructor(var1: Context?, var2: AttributeSet?) : super(var1, var2) {} + constructor(var1: Context?) : super(var1) {} + + fun setIntersectionBitMap(naviCross: NaviCross) { + try { + zoomInBitmap = naviCross.mBitmap + setImageBitmap(zoomInBitmap) + } catch (var2: Throwable) { + var2.printStackTrace() + } + } + + override fun onTouchEvent(var1: MotionEvent?): Boolean { + return true + } + + fun recycleResource() { + try { + if (zoomInBitmap != null) { + zoomInBitmap!!.recycle() + zoomInBitmap = null + } + } catch (var1: Throwable) { + var1.printStackTrace() + } + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/navi/NaviModel.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/navi/NaviModel.kt new file mode 100644 index 0000000000..6ade4ed925 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/navi/NaviModel.kt @@ -0,0 +1,39 @@ +package com.zhidaoauto.map.sdk.open.navi + +import com.zhidao.map.net.api.Result +import com.zhidaoauto.map.sdk.inner.controller.CommonController +import com.zhidaoauto.map.sdk.open.abs.navi.INaviResult +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.launch + +object NaviModel { + + private var routeJob:Job? = null + + private val naviRepository by lazy { NaviRepository() } + + fun route(lon:Double,lat:Double,targetLon:Double,targetLat:Double, wayPoints: String,call: INaviResult){ + routeJob?.cancel() + routeJob = CommonController.instance.scope?.launch(Dispatchers.IO) { + val result = naviRepository.route(lon, lat, targetLon, targetLat, wayPoints) + if (result is Result.Success) { + val list = ArrayList() + result.data?.let { + for (ll in it.routeSolution.paths){ + list.add(LonLatPoint(ll.lon.toDouble()/100000000,ll.lat.toDouble()/100000000)) + } + } + call.result(0,list,null) + }else{ + call.result(-1,null,"失败") + } + } + } + + fun exit(){ + routeJob?.cancel() + routeJob = null + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/navi/NaviRepository.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/navi/NaviRepository.kt new file mode 100644 index 0000000000..0bc2c4fa08 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/navi/NaviRepository.kt @@ -0,0 +1,27 @@ +package com.zhidaoauto.map.sdk.open.navi + +import com.zhidao.map.net.api.BaseRepository +import com.zhidao.map.net.api.Result +import com.zhidaoauto.map.sdk.open.net.NavRetrofitClient + +class NaviRepository: BaseRepository() { + + suspend fun route(lon:Double,lat:Double,targetLon:Double,targetLat:Double, wayPoints: String): Result { + val map = HashMap() + map.put("lon","$lon") + map.put("lat","$lat") + map.put("targetLon","$targetLon") + map.put("targetLat","$targetLat") + map.put("isVr","1") + map.put("barricadeTileId","0") + map.put("barricadeLinkId","0") + map.put("resultType","0") + map.put("wayPoints","") + + return safeApiCall( + + call = { executeResponse(NavRetrofitClient.service.route(map), {}) }, + errorMessage = "返回失败!" + ) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/navi/NaviResponse.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/navi/NaviResponse.kt new file mode 100644 index 0000000000..90df5d5aaa --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/navi/NaviResponse.kt @@ -0,0 +1,14 @@ +package com.zhidaoauto.map.sdk.open.navi + +data class NaviResponse( + val routeSolution:NaviPath, +) + +data class NaviPath( + val paths:List +) + +data class LonLatLL( + val lon:Long, + val lat:Long +) \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/LogRetrofitClient.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/LogRetrofitClient.kt new file mode 100644 index 0000000000..0167b769a9 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/LogRetrofitClient.kt @@ -0,0 +1,26 @@ +//package com.zhidaoauto.map.sdk.open.net +// +// +//import com.zhidao.map.net.api.BaseRetrofitClient +//import okhttp3.Interceptor +//import okhttp3.OkHttpClient +// +// +//object LogRetrofitClient : BaseRetrofitClient() { +// +// +// val service by lazy { getService( +// LogService::class.java, +// LogService.BASE_URL +// ) } +// +// override fun handleBuilder(builder: OkHttpClient.Builder) { +// builder.addInterceptor(bodyInterceptor) +// } +// +// private val bodyInterceptor = Interceptor { chain -> +// val requestBuilder = chain.request().newBuilder() +// requestBuilder.url(chain.request().url()) +// chain.proceed(requestBuilder.build()) +// } +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/LogService.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/LogService.kt new file mode 100644 index 0000000000..2d67f2c4e5 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/LogService.kt @@ -0,0 +1,57 @@ +//package com.zhidaoauto.map.sdk.open.net +// +//import com.zhidao.map.net.api.BaseResponse +//import retrofit2.http.* +// +// +//interface LogService { +// +// companion object { +// const val BASE_URL = ""//BuildConfig.BaseUrl +// } +// +// +// @GET("/uploadLogInfo") +// suspend fun uploadLogInfo( +// @Body content: String, +// @Query("device") deviceID: String +// ): BaseResponse +// +// +//// @Multipart +//// @POST("/broadcast/car/file/v1/auth/fileUpload") +//// suspend fun fileUpload( +//// @Part part: MultipartBody.Part +//// +//// ): BaseResponse +//// +//// @Multipart +//// @POST +//// suspend fun videoUpload( +//// @Url url: String = "/broadcast/car/file/v1/auth/videoUpload", +//// @Part part: MultipartBody.Part +//// //@Body part:RequestBody +//// +//// ): BaseResponse +//// +//// +//// @POST +//// suspend fun videoUpload( +//// @Url url: String = "/broadcast/car/file/v1/auth/videoUpload", +//// @Body body: RequestBody +//// +//// ): BaseResponse +//// +//// // 删除视频 +//// @GET("/broadcast/car/videoShoot/v1/auth/deleteVideo") +//// suspend fun deleteVideo( +//// @Query("ids") ids: String, +//// @Query("sn") sn: String +//// ): BaseResponse +//// +//// // 置顶视频 +//// @GET("/broadcast/car/videoShoot/v1/auth/topVideos") +//// suspend fun getTopVideos( +//// @Query("sn") sn: String +//// ): BaseResponse +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/NavRetrofitClient.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/NavRetrofitClient.kt new file mode 100644 index 0000000000..775691416c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/NavRetrofitClient.kt @@ -0,0 +1,82 @@ +package com.zhidaoauto.map.sdk.open.net + + +import android.util.Log +import com.zhidao.map.net.api.BaseRetrofitClient +import com.zhidaoauto.map.sdk.inner.CompileConfig +import okhttp3.Interceptor +import okhttp3.OkHttpClient + + +object NavRetrofitClient : BaseRetrofitClient() { + + + val service by lazy { getService( + NavService::class.java, + NavService.BASE_URL + ) } + +// private val cookieJar by lazy { +// PersistentCookieJar( +// SetCookieCache(), +// SharedPrefsCookiePersistor(VideoApplication.sContext) +// ) +// } + + override fun handleBuilder(builder: OkHttpClient.Builder) { + +// val httpCacheDirectory = File(TinyApplication.sContext.cacheDir, "responses") +// val cacheSize = 10 * 1024 * 1024L // 10 MiB +// val cache = Cache(httpCacheDirectory, cacheSize) +// builder.cache(cache) +// .cookieJar(cookieJar) +// .addInterceptor { chain -> +// var request = chain.request() +// if (!NetworkUtils.isConnected()) { +// request = request.newBuilder() +// .cacheControl(CacheControl.FORCE_CACHE) +// .build() +// } +// val response = chain.proceed(request) +// if (!NetworkUtils.isConnected()) { +// val maxAge = 60 * 60 +// response.newBuilder() +// .removeHeader("Pragma") +// .header("Cache-Control", "public, max-age=$maxAge") +// .build() +// } else { +// val maxStale = 60 * 60 * 24 * 28 // tolerate 4-weeks stale +// response.newBuilder() +// .removeHeader("Pragma") +// .header("Cache-Control", "public, only-if-cached, max-stale=$maxStale") +// .build() +// } +// +// response +// } + builder.addInterceptor(bodyInterceptor) + } + + private val bodyInterceptor = Interceptor { chain -> + val requestBuilder = chain.request().newBuilder() + val url = chain.request().url().toString() + if (CompileConfig.DEBUG) { + Log.i("httpop", "intercept: $url") + } +// if (checkTokenUrl(url)) { +// val token by Preference(Preference.USER_GSON, "") +// if (!TextUtils.isEmpty(token)) { +// requestBuilder.addHeader("token", token) +// } +// } + requestBuilder.addHeader("Content-Type","application/x-www-form-urlencoded") + requestBuilder.url(chain.request().url()) + chain.proceed(requestBuilder.build()) + } + + private fun checkTokenUrl(url: String): Boolean { + return if (url.contains("/login")) { + false + } else true + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/NavService.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/NavService.kt new file mode 100644 index 0000000000..91702fd19f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/NavService.kt @@ -0,0 +1,23 @@ +package com.zhidaoauto.map.sdk.open.net + + +import com.zhidao.map.net.api.BaseResponse +import com.zhidaoauto.map.sdk.open.navi.NaviResponse +import retrofit2.http.* + + +interface NavService { + + companion object { + const val BASE_URL = "http://hdmapnav.zhidaozhixing.com"//BuildConfig.BaseUrl + } + + + // 获取两点之间相关信息 + @FormUrlEncoded + @POST("/routingForAndroid") + suspend fun route( + @FieldMap content: Map? + ): BaseResponse + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/WeatherRetrofitClient.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/WeatherRetrofitClient.kt new file mode 100644 index 0000000000..2674cb5718 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/WeatherRetrofitClient.kt @@ -0,0 +1,82 @@ +package com.zhidaoauto.map.sdk.open.net + + +import android.util.Log +import com.zhidao.map.net.api.BaseRetrofitClient +import com.zhidaoauto.map.sdk.inner.CompileConfig +import okhttp3.Interceptor +import okhttp3.OkHttpClient + + +object WeatherRetrofitClient : BaseRetrofitClient() { + + + val service by lazy { getService( + WeatherService::class.java, + WeatherService.BASE_URL + ) } + +// private val cookieJar by lazy { +// PersistentCookieJar( +// SetCookieCache(), +// SharedPrefsCookiePersistor(VideoApplication.sContext) +// ) +// } + + override fun handleBuilder(builder: OkHttpClient.Builder) { + +// val httpCacheDirectory = File(TinyApplication.sContext.cacheDir, "responses") +// val cacheSize = 10 * 1024 * 1024L // 10 MiB +// val cache = Cache(httpCacheDirectory, cacheSize) +// builder.cache(cache) +// .cookieJar(cookieJar) +// .addInterceptor { chain -> +// var request = chain.request() +// if (!NetworkUtils.isConnected()) { +// request = request.newBuilder() +// .cacheControl(CacheControl.FORCE_CACHE) +// .build() +// } +// val response = chain.proceed(request) +// if (!NetworkUtils.isConnected()) { +// val maxAge = 60 * 60 +// response.newBuilder() +// .removeHeader("Pragma") +// .header("Cache-Control", "public, max-age=$maxAge") +// .build() +// } else { +// val maxStale = 60 * 60 * 24 * 28 // tolerate 4-weeks stale +// response.newBuilder() +// .removeHeader("Pragma") +// .header("Cache-Control", "public, only-if-cached, max-stale=$maxStale") +// .build() +// } +// +// response +// } + builder.addInterceptor(bodyInterceptor) + } + + private val bodyInterceptor = Interceptor { chain -> + val requestBuilder = chain.request().newBuilder() + val url = chain.request().url().toString() + if (CompileConfig.DEBUG) { + Log.i("httpop", "intercept: $url") + } +// if (checkTokenUrl(url)) { +// val token by Preference(Preference.USER_GSON, "") +// if (!TextUtils.isEmpty(token)) { +// requestBuilder.addHeader("token", token) +// } +// } + requestBuilder.addHeader("Content-Type","application/x-www-form-urlencoded") + requestBuilder.url(chain.request().url()) + chain.proceed(requestBuilder.build()) + } + + private fun checkTokenUrl(url: String): Boolean { + return if (url.contains("/login")) { + false + } else true + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/WeatherService.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/WeatherService.kt new file mode 100644 index 0000000000..fc8ef2ae5b --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/net/WeatherService.kt @@ -0,0 +1,22 @@ +package com.zhidaoauto.map.sdk.open.net + +import com.zhidao.map.net.api.BaseResponse +import com.zhidaoauto.map.sdk.open.weather.WeatherInfo +import retrofit2.http.FieldMap +import retrofit2.http.FormUrlEncoded +import retrofit2.http.POST + +interface WeatherService { + companion object { + const val BASE_URL = "https://webhdmap.zhidaozhixing.com"//BuildConfig.BaseUrl + } + + + // 获取两点之间相关信息 + @FormUrlEncoded + @POST("/weatherInfo") + suspend fun getInfo( + @FieldMap content: Map? + ): BaseResponse + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/polygon/Polygon3D.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/polygon/Polygon3D.kt new file mode 100644 index 0000000000..14e969e274 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/polygon/Polygon3D.kt @@ -0,0 +1,93 @@ +package com.zhidaoauto.map.sdk.open.polygon + +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class Polygon3D { + + private var id: String + private var polygon3DOption: Polygon3DOption? = null + + constructor(polygon3DOption: Polygon3DOption){ + this.polygon3DOption = polygon3DOption + id = polygon3DOption.id + } + fun remove(mapController: IMapController?) { + mapController?.removePel(id) + } + + fun getId(): String? { + return id + } + + fun getPolygon3DOption(): Polygon3DOption? { + return polygon3DOption + } + + //设置线段宽度 +// fun setWidth(width: Float) { +// if (polygon3DOption != null) { +// polygon3DOption!!.setLineWidth(width) +// +// } +// } +// + fun getWidth(): Float { + return if (polygon3DOption != null) polygon3DOption!!.getLineWidth() else 0.0f + } +// +// fun setColor(color: Int) { +// if (polygon3DOption != null) { +// polygon3DOption!!.setColor(color) +// } +// } +// + fun getColor(): Int { + return if (polygon3DOption != null) polygon3DOption!!.getColor() else 0 + } +// +// fun setHeight(height: Float) { +// if (polygon3DOption != null) { +// polygon3DOption!!.setHeight(height) +// +// } +// } +// + fun getHeight(): Float { + return if (polygon3DOption != null) polygon3DOption!!.getHeight() else 0.0f + } +// +// +// +// +// +// fun setOption(option: Polygon3DOption?) { +// polygon3DOption = option +// try { +// val strJsonOptions = JSON.toJSONString(option) +// +// } catch (e: JSONException) { +// } +// +// } +// + +// +// fun setPoints(lonLatPoints: List?) { +// if (polygon3DOption != null) { +// polygon3DOption!!.setLonLatPoints(lonLatPoints) +// setOption(polygon3DOption) +// } +// } +// + fun getPoints(): List? { + return polygon3DOption!!.getLonLatPoints() + } +// + fun destroy() { + polygon3DOption = null + } + + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/polygon/Polygon3DHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/polygon/Polygon3DHelper.kt new file mode 100644 index 0000000000..da9943f5c0 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/polygon/Polygon3DHelper.kt @@ -0,0 +1,38 @@ +package com.zhidaoauto.map.sdk.open.polygon + +import com.zhidaoauto.map.sdk.open.tools.MapTools +import com.zhidaoauto.map.sdk.open.view.MapAutoView + + +object Polygon3DHelper { + private val TAG = javaClass.simpleName + + fun draw3DPolygon(polygon3DOption: Polygon3DOption,mapAutoView: MapAutoView): Polygon3D? { + val data = polygon3DOption.getLonLatPoints() + + var polygon3D: Polygon3D? = null + try { + if (data == null || data.size <= 1) { + throw RuntimeException("传入的坐标数必须大于1") + } + val id = polygon3DOption.id + val point = MapTools.listToArray(data, !polygon3DOption.getGps()) + val height = polygon3DOption.getHeight() + val width = polygon3DOption.getLineWidth() + val count = polygon3DOption.getCount() + val color = polygon3DOption.getColor() + val alpha = color shr 24 and 0xff + val red = color shr 16 and 0xff + val green = color shr 8 and 0xff + val blue = color and 0xff + + val colorArray = floatArrayOf(red/255f, green/255f, blue/255f, alpha/255f) + + mapAutoView.getMapController()?.draw3DPolygon(id, point, height, width,count,colorArray) + polygon3D = Polygon3D(polygon3DOption) + } catch (e: Exception) { + e.printStackTrace() + } + return polygon3D + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/polygon/Polygon3DOption.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/polygon/Polygon3DOption.kt new file mode 100644 index 0000000000..16ae9db68e --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/polygon/Polygon3DOption.kt @@ -0,0 +1,89 @@ +package com.zhidaoauto.map.sdk.open.polygon + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import java.util.UUID + +class Polygon3DOption { + var id: String + private var color = 0 + private var lineWidth = 0f + + private var lonLatPoints: List? = null + + private var height = 0f + + private var count = 0 + + private var isGps = false + + constructor(){ + id = UUID.randomUUID().toString() + } + + fun setId(id:String): Polygon3DOption? { + this.id = id + return this + } + + fun setColor(color: Int): Polygon3DOption? { + this.color = color + return this + } + + fun getColor(): Int{ + return this.color + } + + + fun getLineWidth(): Float { + return lineWidth + } + + fun setLineWidth(lineWidth: Float): Polygon3DOption? { + this.lineWidth = lineWidth + return this + } + + + fun getLonLatPoints(): List? { + return lonLatPoints + } + + + fun setLonLatPoints(points: List?): Polygon3DOption? { + if (points == null || points.isEmpty()) { + return this + } + lonLatPoints = points + + return this + } + + fun setHeight(height: Float): Polygon3DOption { + this.height = height + return this + } + + fun getHeight(): Float { + return height + } + + + fun setCount(count: Int): Polygon3DOption{ + this.count = count + return this + } + + fun getCount(): Int{ + return this.count + } + + fun setGps(isGps: Boolean): Polygon3DOption { + this.isGps = isGps + return this + } + + fun getGps(): Boolean{ + return isGps + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/poyline/Polyline.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/poyline/Polyline.kt new file mode 100644 index 0000000000..53accf2594 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/poyline/Polyline.kt @@ -0,0 +1,163 @@ +package com.zhidaoauto.map.sdk.open.poyline + +import com.alibaba.fastjson.JSON +import com.alibaba.fastjson.JSONException +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class Polyline { + private var id: String = "" + private var polylineOptions: PolylineOptions? = null + + private var mMapController:IMapController? = null + + constructor(polylineOptions: PolylineOptions,mapController: IMapController?) { + this.polylineOptions = polylineOptions + this.mMapController = mapController + id = polylineOptions.id + } + + fun remove() { + // 移除单个线 + id?.let{ + mMapController?.removePel(it) + } + refreshMap() + } + + fun getId(): String? { + return id + } + + fun setGeodesic(draw: Boolean) { + if (polylineOptions != null) { + polylineOptions?.geodesic(draw) + id?.let { + mMapController?.setGeodesic(it, draw) + refreshMap() + } + } + } + + //是否透明 + fun isGeodesic(): Boolean { + return if (polylineOptions != null) polylineOptions!!.isGeodesic() else false + } + + fun setDottedLine(dottedLine: Boolean) { + if (polylineOptions != null) { + polylineOptions?.dottedLine(dottedLine) + id?.let{ + mMapController?.setDottedLineType(it, 0) + refreshMap() + } + } + } + + //是否是虚线 + fun isDottedLine(): Boolean { + return if (polylineOptions != null) polylineOptions!!.isDottedLine() else false + } + + //设置线段宽度 + fun setWidth(width: Float) { + if (polylineOptions != null) { + polylineOptions?.lineWidth = width + id?.let { + mMapController?.setWidth(it, width) + refreshMap() + } + } + } + + fun getWidth(): Float { + return if (polylineOptions != null) polylineOptions!!.lineWidth else 0.0f + } + + fun setColor(color: Int) { + if (polylineOptions != null) { + polylineOptions?.color(color) + id.let { + mMapController?.setColor(it, color) + refreshMap() + } + + } + } + + fun getColor(): Int { + return if (polylineOptions != null) polylineOptions!!.color else 0 + } + + fun setZIndex(zIndex: Float) { + if (polylineOptions != null) { + polylineOptions?.zIndex(zIndex) + id.let { + mMapController?.setZIndex(it, zIndex) + refreshMap() + } + } + } + + fun getZIndex(): Float { + return if (polylineOptions != null) polylineOptions!!.getZIndex() else 0.0f + } + + fun setVisible(visible: Boolean) { + if (polylineOptions != null) { + polylineOptions?.setVisible(visible) + id.let { + mMapController?.setVisiable(it, visible) + refreshMap() + } + } + } + + fun isVisible(): Boolean { + return if (polylineOptions != null) polylineOptions!!.isVisible() else false + } + + //透明度 + fun setTransparency(transparency: Float) { + if (polylineOptions != null) { + polylineOptions?.transparency(transparency) + id.let { + mMapController?.setTransparency(it, transparency) + refreshMap() + } + } + } + + fun setOption(option: PolylineOptions?) { + polylineOptions = option + try { + val strJsonOptions = JSON.toJSONString(option) + mMapController?.setOption(id, strJsonOptions) + refreshMap() + } catch (e: JSONException) { + } + } + + fun getPolyLineOptions(): PolylineOptions { + return polylineOptions!! + } + + fun setPoints(lonLatPoints: MutableList?) { + if (polylineOptions != null) { + polylineOptions!!.lonLatPoints(lonLatPoints) + setOption(polylineOptions) + } + } + + fun getPoints(): List? { + return polylineOptions!!.lonLatPoints + } + + fun destroy() { + polylineOptions = null + } + + private fun refreshMap() { + //CommonController.getInstance().getMapView().shakeSceneManual(); + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/poyline/PolylineOptions.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/poyline/PolylineOptions.kt new file mode 100644 index 0000000000..2d872d7550 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/poyline/PolylineOptions.kt @@ -0,0 +1,314 @@ +package com.zhidaoauto.map.sdk.open.poyline + +import android.graphics.Bitmap +import android.util.Log +import com.alibaba.fastjson.annotation.JSONField +import com.autonavi.nge.map.LonLat +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy.Companion.getInstance +import com.zhidaoauto.map.sdk.open.MapAutoApi.addImagetoImageManager +import com.zhidaoauto.map.sdk.open.data.MapDataApi +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.tools.BitmapTools.bitmapToByteArray +import java.util.UUID + +class PolylineOptions { + + private val TAG = javaClass.simpleName + @JSONField(serialize = false) + private var mMapController:IMapController? = null + var id: String = "" + var color = 0 + var lineWidth = 0f + private var zIndex = 12000f + private var isGps = false + + //设置透明度 + private var transparency = 0f + + @JSONField(serialize = false) + var lonLatPoints: MutableList? = null + var lonLats = ArrayList() + + //是否大地曲线 + private var geodesic = false + + //是否是虚线 + private var dottedLine = false + + //是否可见 + private var visible = true + + //是否使用渐变色 + private var isGradient = false + + //是否使用多彩色 + private var isColorful = false + + + //颜色 + private var mColorValues: List? = null + + //虚线形状 + private var dottedLineType = 0 + + //是否使用纹理贴图 + private var useTexture = false + + private var customTexture: Bitmap? = null + + //是否使用立面 + private var isFacade = false + + //立面层叠最大值 + private var maxIndex = 200000f + + private var brightSpeed = 0.25f + + private var brightColor = 1 + + private var isBright = false + + companion object { + //空隙长 + val DOT_LINE_TYPE_SHORT_LINE = 1 + + //实线长 + val DOT_LINE_TYPE_LONG_LINE = 2 + } + + + constructor(mapController: IMapController?){ + this.mMapController = mapController + id = UUID.randomUUID().toString() + } + constructor(mapController: IMapController?, id: String, color: Int, lineWidth: Int, lonLatPoints: MutableList?){ + this.mMapController = mapController + this.id = id + this.color = color + this.lineWidth = lineWidth.toFloat() + this.lonLatPoints = lonLatPoints + } + + fun color(color: Int): PolylineOptions{ + this.color = color + return this + } + + fun lineWidth(lineWidth: Float): PolylineOptions { + this.lineWidth = lineWidth + return this + } + + + fun setGps(isGps: Boolean): PolylineOptions{ + this.isGps = isGps + return this + } + + fun getGps(): Boolean{ + return isGps + } + + fun lonLatPoints(lonLatPoints: MutableList?): PolylineOptions { + if (lonLatPoints == null || lonLatPoints.isEmpty()) { + return this + } + this.lonLatPoints = lonLatPoints + lonLats.clear() + var lonLat: LonLat? = null + var lastLonlat: LonLat? = null + for ((i,lonlatPoint) in lonLatPoints.withIndex()) { + if (lonlatPoint == null) { + continue + } + if(!MapDataApi.isRightLonLat(lonlatPoint.longitude,lonlatPoint.latitude)){ + Log.e(TAG, "position is error :${lonlatPoint.longitude},${lonlatPoint.latitude} ") + return this; + } + if(isGps){ + lonLat = LonLat(lonlatPoint.longitude, lonlatPoint.latitude) + } else{ + lonLat = getInstance().getLonLatProxy().switchLonLat(lonlatPoint) + } + if(i == 0){ + lonLats.add(lonLat) + lastLonlat = lonLat + }else{ + if(lastLonlat?.lat == lonLat.lat && lastLonlat?.lon == lonLat.lon){ + + }else{ + lonLats.add(lonLat) + lastLonlat = lonLat + } + } + } + return this + } + + //如果不设置maxIndex,则使用默认值 + fun maxIndex(maxIndex: Float): PolylineOptions { + this.maxIndex = this.maxIndex + maxIndex + return this + } + + fun getMaxIndex(): Float { + return maxIndex + } + + fun useFacade(isFacade: Boolean): PolylineOptions { + this.isFacade = isFacade + return this + } + + fun getIsFacade(): Boolean { + return isFacade + } + + fun geodesic(geodesic: Boolean) { + this.geodesic = geodesic + } + + fun isGeodesic(): Boolean { + return geodesic + } + + fun isDottedLine(): Boolean { + return dottedLine + } + + fun zIndex(zIndex: Float):PolylineOptions { + this.zIndex = 12000 + zIndex + return this + } + + fun getZIndex(): Float { + return zIndex + } + + fun setVisible(visible: Boolean) { + this.visible = visible + } + + fun isVisible(): Boolean { + return visible + } + + fun transparency(transparency: Float) { + this.transparency = transparency + } + + //设置渐变 + fun useGradient(isGradient: Boolean): PolylineOptions { + this.isGradient = isGradient + return this + } + + fun getIsGradient(): Boolean { + return isGradient + } + //设置多彩 + fun useColorful(isColorful: Boolean): PolylineOptions { + this.isColorful = isColorful + return this + } + + fun getIsColorful(): Boolean { + return isColorful + } + + /** + * @param colors + * @return + */ + fun colorValues(colors: List?): PolylineOptions { + mColorValues = colors + return this + } + + fun getmColorValues(): List? { + return mColorValues + } + + fun dottedLineType(type: Int): PolylineOptions { + dottedLineType = if (type == 0) 0 else 1 + return this + } + + //使用纹理贴图 + fun useTexture(useTexture: Boolean): PolylineOptions { + this.useTexture = useTexture + return this + } + + fun dottedLine(dottedLine: Boolean): PolylineOptions { + this.dottedLine = dottedLine + return this + } + + fun getDottedLineType(): Int { + return dottedLineType + } + + + + fun customTexture(bitmap: Bitmap): PolylineOptions { + customTexture = bitmap + val bitmapArr = bitmapToByteArray(bitmap) + addImagetoImageManager("thickline", bitmapArr, bitmap.width, bitmap.height,mMapController) + return this + } + + //设置亮斑颜色 + fun setBrightColor(color: Int): PolylineOptions{ + brightColor = color + return this + } + + //设置亮斑速度 + fun setBrightSpeed(speed: Float): PolylineOptions { + brightSpeed = speed + return this + } + + //使用使用亮版 + fun setIsBright(isBright: Boolean): PolylineOptions { + this.isBright = isBright + return this + } + + fun getBrightSpeed(): Float { + return brightSpeed + } + + fun getBrightColor(): Int { + return brightColor + } + + fun getIsBright(): Boolean { + return isBright + } + + + override fun toString(): String{ + return "PolylineOptions{" + + "id='" + id + '\'' + + ", color=" + color + + ", lineWidth=" + lineWidth + + ", zIndex=" + zIndex + + ", transparency=" + transparency + + ", lonLatPoints=" + lonLatPoints + + ", lonLats=" + lonLats + + ", geodesic=" + geodesic + + ", dottedLine=" + dottedLine + + ", visible=" + visible + + ", isGradient=" + isGradient + + ", isColorful=" + isColorful + + ", mColorValues=" + mColorValues + + ", dottedLineType=" + dottedLineType + + ", useTexture=" + useTexture + + ", maxIndex=" + maxIndex + + ", isFacade=" + isFacade + + '}' + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/GeocodeAddress.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/GeocodeAddress.kt new file mode 100644 index 0000000000..23bc37275b --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/GeocodeAddress.kt @@ -0,0 +1,21 @@ +package com.zhidaoauto.map.sdk.open.query + + +class GeocodeAddress{ + var poiId: String? = null + var formatAddress: String? = null + var province: String? = null + var city: String? = null + var district: String? = null + var township: String? = null + var neighborhood: String? = null + var building: String? = null + var adcode: String? = null + var lonlat: LonLatPoint? = null + var level: String? = null + override fun toString(): String { + return "GeocodeAddress(poiId=$poiId, formatAddress=$formatAddress, province=$province, city=$city, district=$district, township=$township, neighborhood=$neighborhood, building=$building, adcode=$adcode, lonlat=$lonlat, level=$level)" + } + + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/GeocodeQuery.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/GeocodeQuery.kt new file mode 100644 index 0000000000..a15389cf55 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/GeocodeQuery.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.open.query + +class GeocodeQuery{ + var locationName: String? = null + var city: String? = null + + constructor(locationName: String?, city: String?) { + this.locationName = locationName + this.city = city + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/GeocodeResult.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/GeocodeResult.kt new file mode 100644 index 0000000000..97f7d4eb30 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/GeocodeResult.kt @@ -0,0 +1,18 @@ +package com.zhidaoauto.map.sdk.open.query + + +class GeocodeResult( + geocodeAddressList: List +) { + var geocodeAddressList: List = ArrayList() + + init { + this.geocodeAddressList = geocodeAddressList + } + + override fun toString(): String { + return "GeocodeResult(geocodeAddressList=$geocodeAddressList)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/GeocodeSearch.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/GeocodeSearch.kt new file mode 100644 index 0000000000..8f3a83a00d --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/GeocodeSearch.kt @@ -0,0 +1,50 @@ +//package com.zhidaoauto.map.sdk.open.query +// +//import android.content.Context +//import com.zhidaoauto.map.sdk.inner.search.GeocoderSearchHelper +//import com.zhidaoauto.map.sdk.open.abs.search.IGeocodeSearch +//import com.zhidaoauto.map.sdk.open.exception.MapException +// +//class GeocodeSearch(context: Context) { +// private var mIGeocodeSearch: IGeocodeSearch? = null +// private var mContext: Context? = null +// @Throws(MapException::class) +// fun getFromLocation(regeocodeQuery: RegeocodeQuery?): RegeocodeAddress? { +// return if (mIGeocodeSearch != null) mIGeocodeSearch!!.getFromLocation(regeocodeQuery!!) else null +// } +// +// @Throws(MapException::class) +// fun getFromLocationName(geocodeQuery: GeocodeQuery?): List? { +// return if (mIGeocodeSearch != null) mIGeocodeSearch!!.getFromLocationName(geocodeQuery!!) else null +// } +// +// fun setOnGeocodeSearchListener(listener: OnGeocodeSearchListener?) { +// if (mIGeocodeSearch != null) { +// mIGeocodeSearch!!.setOnGeocodeSearchListener(listener) +// } +// } +// +// fun getFromLocationAsyn(regeocodeQuery: RegeocodeQuery?) { +// if (mIGeocodeSearch != null) { +// mIGeocodeSearch!!.getFromLocationAsyn(regeocodeQuery) +// } +// } +// +// fun getFromLocationNameAsyn(geocodeQuery: GeocodeQuery?) { +// if (mIGeocodeSearch != null) { +// mIGeocodeSearch!!.getFromLocationNameAsyn(geocodeQuery) +// } +// } +// +// +// +// companion object { +// const val GPS = "gps" +// const val AMAP = "autonavi" +// } +// +// init { +// this.mContext = context +// mIGeocodeSearch = GeocoderSearchHelper(mContext!!) +// } +//} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/IndoorData.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/IndoorData.kt new file mode 100644 index 0000000000..a963b87617 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/IndoorData.kt @@ -0,0 +1,8 @@ +package com.zhidaoauto.map.sdk.open.query + +class IndoorData { + var poiId: String? = null + var floor = 0 + var floorName: String? = null + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/Inputtips.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/Inputtips.kt new file mode 100644 index 0000000000..8765c98f07 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/Inputtips.kt @@ -0,0 +1,40 @@ +//package com.zhidaoauto.map.sdk.open.query +// +//import android.content.Context +//import com.zhidaoauto.map.sdk.inner.search.InputSearchHelper +//import com.zhidaoauto.map.sdk.open.abs.search.IInputtipsSearch +//import com.zhidaoauto.map.sdk.open.exception.MapException +// +//class Inputtips(context: Context, query: InputtipsQuery) { +// private var inputtipsSearch: IInputtipsSearch +// +// var query: InputtipsQuery? +// get() = if (inputtipsSearch != null) inputtipsSearch.getQuery() else null +// set(query) { +// if (inputtipsSearch != null && query != null) { +// inputtipsSearch.setQuery(query) +// } +// } +// +// fun setInputtipsListener(listener: InputtipsListener?) { +// if (inputtipsSearch != null) { +// inputtipsSearch.setInputtipsListener(listener) +// } +// } +// +// fun requestInputtipsAsyn() { +// if (inputtipsSearch != null) { +// inputtipsSearch.requestInputtipsAsyn() +// } +// } +// +// @Throws(MapException::class) +// fun requestInputtips(): List? { +// return if (inputtipsSearch != null) inputtipsSearch.requestInputtips() else null +// } +// +// +// init { +// inputtipsSearch = InputSearchHelper(context, query) +// } +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/InputtipsListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/InputtipsListener.kt new file mode 100644 index 0000000000..af70151039 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/InputtipsListener.kt @@ -0,0 +1,5 @@ +package com.zhidaoauto.map.sdk.open.query + +interface InputtipsListener { + fun onGetInputtips(tipList: List?, code: Int) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/InputtipsQuery.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/InputtipsQuery.kt new file mode 100644 index 0000000000..08f0e9f2a2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/InputtipsQuery.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.open.query + +class InputtipsQuery(val keyword: String, val city: String) : Cloneable { + var cityLimit = false + var type: String? = null + var location: LonLatPoint? = null + // 每页总数 + var pageSize: Int = 20 + // 页码 + var pageStart: Int = 0 + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/LonLatPoint.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/LonLatPoint.java new file mode 100644 index 0000000000..af882d8fdf --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/LonLatPoint.java @@ -0,0 +1,136 @@ +package com.zhidaoauto.map.sdk.open.query; + +import com.alibaba.fastjson.annotation.JSONField; + +import java.io.Serializable; + +public class LonLatPoint implements Serializable { + + @JSONField(name="lon") + private double longitude; + @JSONField(name="lat") + private double latitude; + @JSONField(name="alt") + private double altitude; + @JSONField(serialize = false) + private int duration; + @JSONField(serialize = false) + private double angle = 0; + @JSONField(serialize = false) + private String provider; + @JSONField(serialize = false) + private double distance; + @JSONField(serialize = false) + private double speed; + private long satelliteTime; + + private boolean isConvertAngle = true; + + public LonLatPoint() { + } + + public LonLatPoint(double longitude, double latitude) { + this.longitude = longitude; + this.latitude = latitude; + } + public LonLatPoint(double longitude, double latitude, double angle) { + this.longitude = longitude; + this.latitude = latitude; + this.angle = angle; + } + public LonLatPoint(double longitude, double latitude, double altitude,double angle) { + this.longitude = longitude; + this.latitude = latitude; + this.altitude = altitude; + this.angle = angle; + } + + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public int getDuration() { + return duration; + } + + public void setDuration(int duration) { + this.duration = duration; + } + + public double getLongitude() { + return longitude; + } + + public void setLongitude(double longitude) { + this.longitude = longitude; + } + + public double getLatitude() { + return latitude; + } + + public void setLatitude(double latitude) { + this.latitude = latitude; + } + + public double getAltitude() { + return altitude; + } + + public void setAltitude(double altitude) { + this.altitude = altitude; + } + + public double getAngle() { + return angle; + } + + public void setAngle(double angle) { + this.angle = angle; + } + + public double getDistance() { + return distance; + } + + public void setDistance(double distance) { + this.distance = distance; + } + + public double getSpeed() { + return speed; + } + + public void setSpeed(double speed) { + this.speed = speed; + } + + public boolean isConvertAngle() { + return isConvertAngle; + } + + public void setConvertAngle(boolean convertAngle) { + isConvertAngle = convertAngle; + } + + public long getSatelliteTime() { + return satelliteTime; + } + + public void setSatelliteTime(long satelliteTime) { + this.satelliteTime = satelliteTime; + } + + @Override + public String toString() { + return "{" + + "lon=" + longitude + + ", lat=" + latitude + + ", angle=" + angle + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/OnGeocodeSearchListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/OnGeocodeSearchListener.kt new file mode 100644 index 0000000000..43478b3037 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/OnGeocodeSearchListener.kt @@ -0,0 +1,6 @@ +package com.zhidaoauto.map.sdk.open.query + +interface OnGeocodeSearchListener { + fun onRegeocodeSearched(result: RegeocodeResult?, code: Int) + fun onGeocodeSearched(result: GeocodeResult?, code: Int) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/OnPoiSearchListener.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/OnPoiSearchListener.kt new file mode 100644 index 0000000000..d460d48e3b --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/OnPoiSearchListener.kt @@ -0,0 +1,14 @@ +package com.zhidaoauto.map.sdk.open.query + + +interface OnPoiSearchListener { + fun onPoiSearched(poiSearchResult: PoiSearchResult?, code: Int) + fun onPoiItemSearched( + poiItem: PoiItem?, + code: Int + ) + fun onPoiCategorySearched( + list: List?, + code: Int + ) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/Photo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/Photo.kt new file mode 100644 index 0000000000..bf3e8c6b17 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/Photo.kt @@ -0,0 +1,7 @@ +package com.zhidaoauto.map.sdk.open.query + +class Photo { + var title: String? = null + var url: String? = null + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiCategory.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiCategory.kt new file mode 100644 index 0000000000..fde09a3417 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiCategory.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.open.query + + +class PoiCategory{ + var id: Int? = 0 + var category: String? = null + override fun toString(): String { + return "PoiCategory(id=$id, category=$category)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiItem.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiItem.kt new file mode 100644 index 0000000000..0339ad286f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiItem.kt @@ -0,0 +1,65 @@ +package com.zhidaoauto.map.sdk.open.query + +class PoiItem { + var poiId: String? = null + var tel: String? = null + var adCode: String? = null + var cityCode: String? = null + var typeDes: String? = null + var distance = -1 + var lonLatPoint: LonLatPoint? = null + var title: String? = null + var snippet: String? = null + var enter: LonLatPoint? = null + var exit: LonLatPoint? = null + var website: String? = null + var postcode: String? = null + var email: String? = null + var direction: String? = null + var provinceName: String? = null + var cityName: String? = null + var adName: String? = null + var indoorMap = false + var indoorData: IndoorData? = null + var provinceCode: String? = null + var businessArea: String? = null + var parkingType: String? = null + var subPois: List = ArrayList() + var photos: List = + ArrayList() + var poiExtension: PoiItemExtension? = null + var typeCode: String? = null + var shopID: String? = null + override fun equals(var1: Any?): Boolean { + return if (this === var1) { + true + } else if (var1 == null) { + false + } else if (this.javaClass != var1.javaClass) { + false + } else { + var var2 = + var1 as PoiItem + if (poiId == null) { + if (var2.poiId != null) { + return false + } + } else if (poiId != var2.poiId) { + return false + } + true + } + } + + override fun hashCode(): Int { + var var1 = true + var var2: Byte = 1 + return 31 * var2 + (poiId?.hashCode() ?: 0) + } + + override fun toString(): String { + return "PoiItem(poiId=$poiId, tel=$tel, adCode=$adCode, cityCode=$cityCode, typeDes=$typeDes, distance=$distance, latLonPoint=$lonLatPoint, title=$title, snippet=$snippet, enter=$enter, exit=$exit, website=$website, postcode=$postcode, email=$email, direction=$direction, provinceName=$provinceName, cityName=$cityName, adName=$adName, indoorMap=$indoorMap, indoorData=$indoorData, provinceCode=$provinceCode, businessArea=$businessArea, parkingType=$parkingType, subPois=$subPois, photos=$photos, poiExtension=$poiExtension, typeCode=$typeCode, shopID=$shopID)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiItemExtension.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiItemExtension.kt new file mode 100644 index 0000000000..dfe16393f9 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiItemExtension.kt @@ -0,0 +1,14 @@ +package com.zhidaoauto.map.sdk.open.query + +class PoiItemExtension { + var opentime: String? = null + private var mRating: String? = null + + fun getmRating(): String? { + return mRating + } + + fun setmRating(mRating: String?) { + this.mRating = mRating + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiSearch.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiSearch.kt new file mode 100644 index 0000000000..c1d18b2b86 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiSearch.kt @@ -0,0 +1,64 @@ +//package com.zhidaoauto.map.sdk.open.query +// +//import android.content.Context +//import com.zhidaoauto.map.sdk.inner.search.SearchHelper +//import com.zhidaoauto.map.sdk.open.abs.search.IPoiSearch +//import com.zhidaoauto.map.sdk.open.exception.MapException +// +//class PoiSearch( +// context: Context?, +// query: Query? +//) { +// private var mIPoiSearch: IPoiSearch +// private var mContext: Context? = null +// private var mQuery: Query? = null +// fun setOnPoiSearchListener(onPoiSearchListener: OnPoiSearchListener?) { +// mIPoiSearch.setOnPoiSearchListener(onPoiSearchListener) +// } +// +// @Throws(MapException::class) +// fun searchPOI(): PoiSearchResult? { +// return mIPoiSearch.searchPOI() +// } +// +// fun searchPOIAsyn() { +// mIPoiSearch.searchPOIAsyn() +// } +// +// @Throws(MapException::class) +// fun searchPOIId(var1: String?): PoiItem? { +// return mIPoiSearch.searchPOIId(var1) +// } +// +// fun searchPOIIdAsyn(var1: String?) { +// mIPoiSearch.searchPOIIdAsyn(var1) +// } +// +// fun searchPOICateGoryAsyn() { +// mIPoiSearch.searchPOICateGoryAsyn() +// } +// +// var query: Query? +// get() = mIPoiSearch.getQuery() +// set(query) { +// mIPoiSearch.setQuery(query) +// } +// +// var bound: SearchBound? +// get() = mIPoiSearch.getBound() +// set(searchBound) { +// mIPoiSearch.setBound(searchBound) +// } +// +// +// companion object { +// const val ENGLISH = "en" +// const val CHINESE = "zh-CN" +// } +// +// init { +// mContext = context +// mQuery = query +// mIPoiSearch = SearchHelper(context!!, query!!) +// } +//} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiSearchItem.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiSearchItem.kt new file mode 100644 index 0000000000..3009279b71 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiSearchItem.kt @@ -0,0 +1,17 @@ +package com.zhidaoauto.map.sdk.open.query + +class PoiSearchItem { + var poi: PoiItem? = null + var orderId: Int = -1 + + constructor(poi: PoiItem,orderId: Int) { + this.poi = poi + this.orderId = orderId + } + + override fun toString(): String { + return "PoiSearchResult(poi=$poi, orderId=$orderId)" + } + + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiSearchResult.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiSearchResult.kt new file mode 100644 index 0000000000..fcc732cd1c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/PoiSearchResult.kt @@ -0,0 +1,36 @@ +package com.zhidaoauto.map.sdk.open.query + +class PoiSearchResult private constructor( + val query: Query, + val bound: SearchBound?, + val searchSuggestionKeywords: List, + val searchSuggestionCitys: List, + items: ArrayList? +) { + val pageCount = 1 + var items: ArrayList = + ArrayList() + private val pagePerSize = 10 + + companion object { + fun createPagedResult( + var0: Query, + var1: SearchBound?, + var2: List, + var3: List, + var6: ArrayList? + ): PoiSearchResult { + return PoiSearchResult(var0, var1, var2, var3, var6) + } + } + + init { + this.items = items!! + } + + override fun toString(): String { + return "PoiResult(query=$query, bound=$bound, searchSuggestionKeywords=$searchSuggestionKeywords, searchSuggestionCitys=$searchSuggestionCitys, pageCount=$pageCount, results=$items, pagePerSize=$pagePerSize)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/Query.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/Query.kt new file mode 100644 index 0000000000..d9259733c3 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/Query.kt @@ -0,0 +1,202 @@ +package com.zhidaoauto.map.sdk.open.query + +import android.util.Log + + +class Query { + //查询语言 + var queryLanguage: String = "zh-CN" + // + var category: String = "00" + // 关键字 + var keyword: String = "" + // 城市 + var city: String = "" + // 每页总数 + var pageSize: Int = 20 + // 页码 + var pageNum: Int = 0 + // 城市限制 + var CityLimit: Boolean = false + // 子poi + var requireSubPois: Boolean = false + // 按距离排序 + var distanceSort: Boolean = true + // 当前坐标 + var location: LonLatPoint? = null + // 区域 + var region: String = "" + + constructor(keyword: String, city: String, category: String) { + this.category = category + this.keyword = keyword + this.city = city + } + + constructor(keyword: String, city: String) { + this.keyword = keyword + this.city = city + } +} + +class SearchBound : Cloneable { + var lowerLeft: LonLatPoint? = null + private set + var upperRight: LonLatPoint? = null + private set + var range = 3000 + private set + var center: LonLatPoint? = null + private set + var shape: String? + private set + var isDistanceSort = true + private set + var polyGonList: List? = null + private set + + constructor(var1: LonLatPoint?, var2: Int) { + shape = "Bound" + range = var2 + center = var1 + } + + constructor(var1: LonLatPoint?, var2: Int, var3: Boolean) { + shape = "Bound" + range = var2 + center = var1 + isDistanceSort = var3 + } + + constructor(var1: LonLatPoint, var2: LonLatPoint) { + shape = "Rectangle" + a(var1, var2) + } + + constructor(var1: List?) { + shape = "Polygon" + polyGonList = var1 + } + + private constructor( + var1: LonLatPoint?, + var2: LonLatPoint?, + var3: Int, + var4: LonLatPoint?, + var5: String?, + var6: List?, + var7: Boolean + ) { + lowerLeft = var1 + upperRight = var2 + range = var3 + center = var4 + shape = var5 + polyGonList = var6 + isDistanceSort = var7 + } + + private fun a(var1: LonLatPoint, var2: LonLatPoint) { + lowerLeft = var1 + upperRight = var2 + if (lowerLeft == null || upperRight == null) { + IllegalArgumentException("invalid rect ").printStackTrace() + return + } + if (lowerLeft!!.latitude >= upperRight!!.latitude || lowerLeft!!.longitude >= upperRight!!.longitude) { + IllegalArgumentException("invalid rect ").printStackTrace() + } + center = LonLatPoint( + (lowerLeft!!.longitude + upperRight!!.longitude) / 2.0, + (lowerLeft!!.latitude + upperRight!!.latitude) / 2.0 + ) + } + + override fun hashCode(): Int { + val var2: Byte = 1 + var var3 = 31 * var2 + if (center == null) 0 else center.hashCode() + var3 = 31 * var3 + if (isDistanceSort) 1231 else 1237 + var3 = 31 * var3 + if (lowerLeft == null) 0 else lowerLeft.hashCode() + var3 = 31 * var3 + if (upperRight == null) 0 else upperRight.hashCode() + var3 = 31 * var3 + if (polyGonList == null) 0 else polyGonList.hashCode() + var3 = 31 * var3 + range + var3 = 31 * var3 + if (shape == null) 0 else shape.hashCode() + return var3 + } + + override fun equals(var1: Any?): Boolean { + return if (this === var1) { + true + } else if (var1 == null) { + false + } else if (this.javaClass != var1.javaClass) { + false + } else { + val var2 = var1 as SearchBound + if (center == null) { + if (var2.center != null) { + return false + } + } else if (!center!!.equals(var2.center)) { + return false + } + if (isDistanceSort != var2.isDistanceSort) { + false + } else { + if (lowerLeft == null) { + if (var2.lowerLeft != null) { + return false + } + } else if (!lowerLeft!!.equals(var2.lowerLeft)) { + return false + } + if (upperRight == null) { + if (var2.upperRight != null) { + return false + } + } else if (!upperRight!!.equals(var2.upperRight)) { + return false + } + if (polyGonList == null) { + if (var2.polyGonList != null) { + return false + } + } else if (polyGonList != var2.polyGonList) { + return false + } + if (range != var2.range) { + false + } else { + if (shape == null) { + if (var2.shape != null) { + return false + } + } else if (shape != var2.shape) { + return false + } + true + } + } + } + } + + public override fun clone(): SearchBound { + try { + super.clone() + } catch (var2: CloneNotSupportedException) { + Log.e("PoiSearch", "PoiSearch-SearchBoundClone:$var2") + } + return SearchBound( + lowerLeft, + upperRight, range, center, shape, polyGonList, isDistanceSort + ) + } + + companion object { + const val BOUND_SHAPE = "Bound" + const val POLYGON_SHAPE = "Polygon" + const val RECTANGLE_SHAPE = "Rectangle" + const val ELLIPSE_SHAPE = "Ellipse" + } +} + diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/RegeocodeAddress.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/RegeocodeAddress.kt new file mode 100644 index 0000000000..02612f26a2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/RegeocodeAddress.kt @@ -0,0 +1,23 @@ +package com.zhidaoauto.map.sdk.open.query + +class RegeocodeAddress { + var poiId: String? = null + var formatAddress: String? = null + var province: String? = null + var city: String? = null + var district: String? = null + var township: String? = null + var neighborhood: String? = null + var building: String? = null + var cityCode: String? = null + var adCode: String? = null + var towncode: String? = null + var poiList: List? = null + var country: String? = null + + override fun toString(): String { + return "RegeocodeAddress(poiId=$poiId, formatAddress=$formatAddress, province=$province, city=$city, district=$district, township=$township, neighborhood=$neighborhood, building=$building, cityCode=$cityCode, adCode=$adCode, towncode=$towncode, poiList=$poiList, country=$country)" + } + + +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/RegeocodeQuery.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/RegeocodeQuery.kt new file mode 100644 index 0000000000..e2de59e8ca --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/RegeocodeQuery.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.open.query + +class RegeocodeQuery(lonLatPoint: LonLatPoint?, radius: Float) { + var lonLatPoint: LonLatPoint? = null + var radius = 1000.0f + var latLonType: String? = "autonavi" + + init { + this.lonLatPoint = lonLatPoint + this.radius = radius + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/RegeocodeResult.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/RegeocodeResult.kt new file mode 100644 index 0000000000..81e75bc369 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/RegeocodeResult.kt @@ -0,0 +1,18 @@ +package com.zhidaoauto.map.sdk.open.query + + +class RegeocodeResult( + regeocodeAddress: RegeocodeAddress +) { + var regeocodeAddress: RegeocodeAddress? = null + + init { + this.regeocodeAddress = regeocodeAddress + } + + override fun toString(): String { + return "RegeocodeResult(regeocodeAddress=$regeocodeAddress)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/SubPoiItem.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/SubPoiItem.kt new file mode 100644 index 0000000000..bb96ed0dd2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/SubPoiItem.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.open.query + +class SubPoiItem { + var poiId: String? = null + var title: String? = null + var subName: String? = null + var distance = 0 + var lonLatPoint: LonLatPoint? = null + var snippet: String? = null + var subTypeDes: String? = null + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/SuggestionCity.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/SuggestionCity.kt new file mode 100644 index 0000000000..3beff4b525 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/SuggestionCity.kt @@ -0,0 +1,8 @@ +package com.zhidaoauto.map.sdk.open.query + +class SuggestionCity( + val CityName: String, + val CityCode: String, + val AdCode: String, + val SuggestionNum: Int +) \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/Tip.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/Tip.kt new file mode 100644 index 0000000000..2538ce2ed2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/query/Tip.kt @@ -0,0 +1,16 @@ +package com.zhidaoauto.map.sdk.open.query + +import java.io.Serializable + +class Tip : Serializable { + var poiID: String = "" + var latPoint: LonLatPoint? = null + var name: String? = null + var district: String? = null + var adcode: String? = null + var address: String? = null + var typeCode: String? = null + var tip: String? = null + var orderId:Int = 0 + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/CenterLine.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/CenterLine.kt new file mode 100644 index 0000000000..c7540f14f3 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/CenterLine.kt @@ -0,0 +1,31 @@ +package com.zhidaoauto.map.sdk.open.road + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + + +class CenterLine { + var id = "" //id + var tile_id ="" //瓦片id + var road_id = ""//道路id + var lane_id = ""//车道id + var points: MutableList? = null//道路经纬度 + var angle: Double? = 0.0//道路角度 + + + constructor(id: String, tile_id: String, road_id: String, lane_id: String, points: MutableList?) { + this.id = id + this.tile_id = tile_id + this.road_id = road_id + this.lane_id = lane_id + this.points = points + } + + constructor() + + + override fun toString(): String { + return "CenterLine(id='$id', tile_id='$tile_id', road_id='$road_id', lane_id='$lane_id', points=$points, angle=$angle)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/Lane.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/Lane.kt new file mode 100644 index 0000000000..1e3fc82573 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/Lane.kt @@ -0,0 +1,15 @@ +package com.zhidaoauto.map.sdk.open.road + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + + +class Lane { + var laneId: Int = 0 + var laneWidth: Float = 0f + var laneLatLonPoints: List = ArrayList() + + override fun toString(): String { + return "SubLaneInfo(laneId='$laneId', laneWidth=$laneWidth, laneLatlonPoints=$laneLatLonPoints)" + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadCross.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadCross.kt new file mode 100644 index 0000000000..da2115fbbb --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadCross.kt @@ -0,0 +1,14 @@ +package com.zhidaoauto.map.sdk.open.road + +class RoadCross { + var status = 0 // 0: 不在路口 1:在路口 + var tile_id ="" //起始路口tile id或当前路口tile id + var cross_id = ""//起始路口id或当前路口tile id + var tile_id_end = ""//结束路口tile id + var cross_id_end = ""//结束路口id + override fun toString(): String { + return "RoadCross(status=$status, tile_id='$tile_id', cross_id='$cross_id', tile_id_end='$tile_id_end', cross_id_end='$cross_id_end')" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadNameInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadNameInfo.kt new file mode 100644 index 0000000000..6d811d2f16 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadNameInfo.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.open.road + +class RoadNameInfo { + var tile_id ="" //瓦片id + var road_id = ""//道路id + var road_name = ""//道路名称 + override fun toString(): String { + return "RoadNameInfo(tile_id='$tile_id', road_id='$road_id', road_name='$road_name')" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadRect.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadRect.kt new file mode 100644 index 0000000000..1d3158d3a4 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadRect.kt @@ -0,0 +1,15 @@ +package com.zhidaoauto.map.sdk.open.road + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class RoadRect { + var topLeft: LonLatPoint? = null + var topRight: LonLatPoint? = null + var bottomLeft: LonLatPoint? = null + var bottomRight: LonLatPoint? = null + override fun toString(): String { + return "RoadRect(topLeft=$topLeft, topRight=$topRight, bottomLeft=$bottomLeft, bottomRight=$bottomRight)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadRectInfos.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadRectInfos.kt new file mode 100644 index 0000000000..e566faf68c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadRectInfos.kt @@ -0,0 +1,10 @@ +package com.zhidaoauto.map.sdk.open.road + +class RoadRectInfos { + var angle = 0.0//道路弯曲程度 + var roadRects: ArrayList? = null + override fun toString(): String { + return "RoadRectInfos(angle=$angle, roadRects=$roadRects)" + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadSign.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadSign.kt new file mode 100644 index 0000000000..3c97bebe13 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadSign.kt @@ -0,0 +1,17 @@ +package com.zhidaoauto.map.sdk.open.road + +class RoadSign { + var id = 0 + var tileId = 0 + var roadId = 0 + var type = 0 + var shape = 0 + var color = 0 + var content = 0 + var position: ArrayList? = null + override fun toString(): String { + return "RoadSign(tileId=$tileId, roadId=$roadId, type=$type, shape=$shape, color=$color, content=$content, position=$position)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadSignPostion.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadSignPostion.kt new file mode 100644 index 0000000000..56bec37b1a --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RoadSignPostion.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.open.road + +class RoadSignPostion { + var lon = 0.0 + var lat = 0.0 + var hight = 0.0 + override fun toString(): String { + return "RoadSignPostion(lon=$lon, lat=$lat, hight=$hight)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RouteInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RouteInfo.kt new file mode 100644 index 0000000000..df828f6673 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RouteInfo.kt @@ -0,0 +1,11 @@ +package com.zhidaoauto.map.sdk.open.road + +class RouteInfo { + + var routeLines: ArrayList? = null + override fun toString(): String { + return "RouteInfo{" + + "routeLines=" + routeLines + + '}' + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RouteLine.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RouteLine.kt new file mode 100644 index 0000000000..cbbdd27959 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/RouteLine.kt @@ -0,0 +1,28 @@ +package com.zhidaoauto.map.sdk.open.road + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + + +class RouteLine { + var funcRoadClass = 0 + var linkType = 0 + var linkDir = 0 + var ferry = false + var tunnel = false + var bridge = false + var name: String? = null + var CoorArray: ArrayList? = null + override fun toString(): String { + return "RouteLine{" + + "funcRoadClass=" + funcRoadClass + + ", linkType=" + linkType + + ", linkDir=" + linkDir + + ", ferry=" + ferry + + ", tunnel=" + tunnel + + ", bridge=" + bridge + + ", name='" + name + '\'' + + ", CoorArraySize=" + CoorArray!!.size + + ", CoorArray=" + CoorArray + + '}' + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/StopLine.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/StopLine.kt new file mode 100644 index 0000000000..5c31927e33 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/StopLine.kt @@ -0,0 +1,18 @@ +package com.zhidaoauto.map.sdk.open.road + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + + +class StopLine { + var tile_id =""//瓦片id + var road_id: List? = null//道路id + var lane_id: List? = null//车道id + var length = 0.0//停止线长度 + var points: ArrayList? = null//停止线经纬度 + var distance = 0.0//自车到停止线距离 + override fun toString(): String { + return "StopLine(tile_id='$tile_id', road_id=$road_id, lane_id=$lane_id, length=$length, points=$points, distance=$distance)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/ZebraLine.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/ZebraLine.kt new file mode 100644 index 0000000000..03d8be945c --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/road/ZebraLine.kt @@ -0,0 +1,16 @@ +package com.zhidaoauto.map.sdk.open.road + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + + +class ZebraLine { + var dis = 0f + var tileId = "" + var id = "" + var zebraLineList = mutableListOf() + override fun toString(): String { + return "ZebraLine(dis=$dis, tileId='$tileId', id='$id', zebraLineList=$zebraLineList)" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/LineLonLat.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/LineLonLat.kt new file mode 100644 index 0000000000..3fceab79ce --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/LineLonLat.kt @@ -0,0 +1,12 @@ +package com.zhidaoauto.map.sdk.open.routeinfo + +import com.alibaba.fastjson.annotation.JSONField + +class LineLonLat { + + @JSONField(name="t") + var lat: Double = 0.0 + + @JSONField(name="n") + var lon: Double = 0.0 +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/RoadInfo.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/RoadInfo.java new file mode 100644 index 0000000000..223e52d094 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/RoadInfo.java @@ -0,0 +1,32 @@ +package com.zhidaoauto.map.sdk.open.routeinfo; + +public class RoadInfo { + + private long tileID; + private long roadID; + private int speed; + + public long getTileID() { + return tileID; + } + + public void setTileID(long tileID) { + this.tileID = tileID; + } + + public long getRoadID() { + return roadID; + } + + public void setRoadID(long roadID) { + this.roadID = roadID; + } + + public int getSpeed() { + return speed; + } + + public void setSpeed(int speed) { + this.speed = speed; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/SPRouteLine.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/SPRouteLine.java new file mode 100644 index 0000000000..852b917c98 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/SPRouteLine.java @@ -0,0 +1,36 @@ +package com.zhidaoauto.map.sdk.open.routeinfo; + +import com.alibaba.fastjson.annotation.JSONField; + +import java.util.ArrayList; + +public class SPRouteLine { + @JSONField(name="f") + public int funcRoadClass; + @JSONField(name="l") + public int linkType; + @JSONField(name="d") + public int linkDir; + @JSONField(name="e") + public int ferry; + @JSONField(name="t") + public int tunnel; + @JSONField(name="b") + public int bridge; + @JSONField(name="c") + public ArrayList coorArray; + + @Override + public String toString() { + return "RouteLine{" + + "funcRoadClass=" + funcRoadClass + + ", linkType=" + linkType + + ", linkDir=" + linkDir + + ", ferry=" + ferry + + ", tunnel=" + tunnel + + ", bridge=" + bridge + + ", CoorArraySize=" + coorArray.size() + + ", CoorArray=" + coorArray + + '}'; + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/TileLine.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/TileLine.java new file mode 100644 index 0000000000..a9ec0bb0aa --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/TileLine.java @@ -0,0 +1,10 @@ +package com.zhidaoauto.map.sdk.open.routeinfo; + +import com.alibaba.fastjson.annotation.JSONField; + +import java.util.ArrayList; + +public class TileLine { + @JSONField(name="ls") + public ArrayList ls; +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/TilesInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/TilesInfo.kt new file mode 100644 index 0000000000..435e3072d5 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/routeinfo/TilesInfo.kt @@ -0,0 +1,8 @@ +package com.zhidaoauto.map.sdk.open.routeinfo + +import com.alibaba.fastjson.annotation.JSONField + +class TilesInfo { + @JSONField(name="tiles") + var tiles: ArrayList? = null +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/style/CustomMapStyleOptions.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/style/CustomMapStyleOptions.kt new file mode 100644 index 0000000000..4cef4d7b5f --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/style/CustomMapStyleOptions.kt @@ -0,0 +1,101 @@ +package com.zhidaoauto.map.sdk.open.style + +class CustomMapStyleOptions { + private var styleDataPath: String? = null//自定义样式路径 + private var styleData: ByteArray? = null//自定义样式二进制,使用二进制可以更快加载出自定义样式 + private var styleTexturePath: String? = null//自定义样式纹理路径 + private var styleTextureData: ByteArray? = null//自定义样式纹理二进制,使用二进制可以更快加载出自定义样式 + private var styleId: String? = null//底图自定义样式对应的styleID + private var enable = true//是否开启底图自定义样式, 默认为开启 + private var styleExtraData: ByteArray? = null //样式额外的配置,比如路况,背景颜色等,使用二进制可以更快加载出自定义样式,如果设置了则不会读取 + private var styleExtraPath: String? = null//样式额外的配置,比如路况,背景颜色等 文件路径 + + //自定义样式路径 + fun getStyleDataPath(): String? { + return styleDataPath + } + + //设置自定义样式路径 + fun setStyleDataPath(styleDataPath: String?): CustomMapStyleOptions? { + this.styleDataPath = styleDataPath + return this + } + + //自定义样式纹理路径 + fun getStyleTexturePath(): String? { + return styleTexturePath + } + + //设置自定义样式纹理路径 + fun setStyleTexturePath(styleTexturePath: String?): CustomMapStyleOptions? { + this.styleTexturePath = styleTexturePath + return this + } + + //自定义样式二进制,使用二进制可以更快加载出自定义样式 + fun getStyleData(): ByteArray? { + return styleData + } + + //设置自定义样式二进制,使用二进制可以更快加载出自定义样式 + fun setStyleData(styleData: ByteArray?): CustomMapStyleOptions? { + this.styleData = styleData + return this + } + + //自定义样式纹理二进制,使用二进制可以更快加载出自定义样式 + fun getStyleTextureData(): ByteArray? { + return styleTextureData + } + + //设置自定义样式纹理二进制,使用二进制可以更快加载出自定义样式 + fun setStyleTextureData(styleTextureData: ByteArray?): CustomMapStyleOptions? { + this.styleTextureData = styleTextureData + return this + } + + //底图自定义样式对应的styleID + fun getStyleId(): String? { + return styleId + } + + //设置的底图自定义样式对应的styleID + fun setStyleId(styleId: String?): CustomMapStyleOptions? { + this.styleId = styleId + return this + } + + //是否开启底图自定义样式, 默认为开启 + fun isEnable(): Boolean { + return enable + } + + //设置是否开启底图自定义样式, 默认为开启 + fun setEnable(enable: Boolean): CustomMapStyleOptions? { + this.enable = enable + return this + } + + //样式额外的配置,比如路况,背景颜色等,使用二进制可以更快加载出自定义样式,如果设置了则不会读取 + fun getStyleExtraData(): ByteArray? { + return styleExtraData + } + + //设置样式额外的配置,比如路况,背景颜色等,使用二进制可以更快加载出自定义样式,如果设置了则不会读取 + fun setStyleExtraData(styleExtraData: ByteArray?): CustomMapStyleOptions? { + this.styleExtraData = styleExtraData + return this + } + + //样式额外的配置,比如路况,背景颜色等 文件路径 + fun getStyleExtraPath(): String? { + return styleExtraPath + } + + //设置样式额外的配置,比如路况,背景颜色等 文件路径 + fun setStyleExtraPath(styleExtraPath: String?): CustomMapStyleOptions? { + this.styleExtraPath = styleExtraPath + return this + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/BitmapTools.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/BitmapTools.kt new file mode 100644 index 0000000000..de6ee2075d --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/BitmapTools.kt @@ -0,0 +1,11 @@ +package com.zhidaoauto.map.sdk.open.tools + +import android.graphics.Bitmap +import com.zhidaoauto.map.sdk.inner.utils.BitmapUtils + +object BitmapTools { + + fun bitmapToByteArray(bitmap: Bitmap): ByteArray { + return BitmapUtils.bitmapToByteArray(bitmap) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/MD5Utils.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/MD5Utils.java new file mode 100644 index 0000000000..a9bb773378 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/MD5Utils.java @@ -0,0 +1,67 @@ +package com.zhidaoauto.map.sdk.open.tools; + +import android.content.Context; + +import com.zhidaoauto.map.sdk.inner.utils.SharedPrefsMgr; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public class MD5Utils { + protected static char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + protected static MessageDigest messagedigest = null; + + /** + * * MessageDigest初始化 + * *  + *                   + */ + public static MessageDigest getInstanse() { + if (messagedigest == null) { + + try { + messagedigest = MessageDigest.getInstance("MD5"); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + } + return messagedigest; + } + public static String getMD5String(byte[] bytes) { + messagedigest.update(bytes); + return bufferToHex(messagedigest.digest()); + } + public static String bufferToHex(byte bytes[]) { + return bufferToHex(bytes, 0, bytes.length); + } + + private static String bufferToHex(byte bytes[], int m, int n) { + StringBuffer stringbuffer = new StringBuffer(2 * n); + int k = m + n; + for (int l = m; l < k; l++) { + char c0 = hexDigits[(bytes[l] & 0xf0) >> 4]; + char c1 = hexDigits[bytes[l] & 0xf]; + stringbuffer.append(c0); + stringbuffer.append(c1); + } + return stringbuffer.toString(); + } + public static String MARKERIMAGE = "markerImage"; + + public static boolean isSameImage(byte[] bytes, Context context){ + SharedPrefsMgr mgr = SharedPrefsMgr.getInstance(context); + String imageStr = mgr.getString(MARKERIMAGE); + MessageDigest md = MD5Utils.getInstanse(); + StringBuffer buffer = new StringBuffer(); + buffer.append(imageStr); + md.update(bytes); + String Md5Str = MD5Utils.bufferToHex(md.digest()); + if (imageStr.contains(Md5Str)){ + return true; + }else{ + buffer.append(Md5Str); + mgr.putString(MARKERIMAGE,buffer.toString()); + return false; + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/MapTools.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/MapTools.kt new file mode 100644 index 0000000000..c8954c4fcb --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/MapTools.kt @@ -0,0 +1,313 @@ +package com.zhidaoauto.map.sdk.open.tools + +import android.graphics.Point +import android.util.Log +import com.autonavi.nge.map.LonLat +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.CompileConfig.DEBUG +import com.zhidaoauto.map.sdk.inner.abs.IMapController +import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +import com.zhidaoauto.map.sdk.inner.utils.MathUtils +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import kotlin.math.absoluteValue + +object MapTools { + + val TAG = javaClass.simpleName + var viewHeight = 1040 + var viewWidth = 1920 + + /** + * 屏幕坐标转经纬度 + */ + fun fromScreenLocation(paramPoint: Point,mMapController: IMapController?): LonLatPoint { + if (CompileConfig.DEBUG) { + Log.i(TAG, "lonlatop--fromScreenLocation--${paramPoint.toString()}") + } + var lonLat = mMapController?.pixelsToLonlat(paramPoint.x.toFloat(), paramPoint.y.toFloat()) + lonLat?.let { + val lonLatPoint = CommonProxy.getInstance().getLonLatProxy().switchLonLat(it) + if (CompileConfig.DEBUG) { + Log.i( + TAG, + "lonlatop-toScreenLocation-toOuter-before:${lonLat},after:${lonLatPoint}" + ) + } + return lonLatPoint + } + return LonLatPoint(0.0, 0.0) + } + + /** + * 经纬度转屏幕坐标 + */ + fun toScreenLocation(lonLatPoint: LonLatPoint,mMapController: IMapController?): Point { + var lonLat: LonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint) + if (CompileConfig.DEBUG) { + Log.i(TAG, "lonlatop-toScreenLocation-toInner-before:${lonLatPoint},after:${lonLat}") + } + var point = mMapController?.lonlatToPixels( + lonLat.lon, + lonLat.lat + ) + point?.let { + if (CompileConfig.DEBUG) { + Log.i(TAG, "lonlatop-toScreenLocation-result-${point}") + } + return Point(point.x.toInt(), point.y.toInt()) + } + return Point(0, 0) + } + + /** + * 返回一个在屏幕坐标与地理经纬度坐标之间的可见区域 + */ + fun getVisibleRegion(mMapController: IMapController?): VisibleRegion { + val visibleRegion = VisibleRegion() + val leftTopPoint: LonLatPoint = fromScreenLocation(Point(0, 0),mMapController) + val leftBottomPoint: LonLatPoint = fromScreenLocation(Point(0, viewHeight),mMapController) + val rightTopPoint: LonLatPoint = fromScreenLocation(Point(viewWidth, 0),mMapController) + val rightBottomPoint: LonLatPoint = fromScreenLocation(Point(viewWidth, viewHeight),mMapController) + visibleRegion.leftTopPoint = leftTopPoint + visibleRegion.leftBottomPoint = leftBottomPoint + visibleRegion.rightTopPoint = rightTopPoint + visibleRegion.rightBottomPoint = rightBottomPoint + return visibleRegion + } + + /** + * 批量经纬度转屏幕坐标 + */ + fun toScreenLocations(data: List,mMapController: IMapController?): List { + var arrayList: ArrayList = ArrayList() + for (pp in data) { + var point = toScreenLocation(pp,mMapController) + arrayList.add(point) + } + return arrayList + } + + /** + * 批量屏幕坐标转经纬度 + */ + fun fromScreenLocations(data: List,mMapController: IMapController?): List { + var arrayList: ArrayList = ArrayList() + for (pp in data) { + var lonLat = fromScreenLocation(pp,mMapController) + arrayList.add(lonLat) + } + return arrayList + } + + fun listToArray(data: List): DoubleArray { + return listToArray(data,true,false) + } + + fun listToArray(data: List,isSwitch:Boolean): DoubleArray { + return listToArray(data, isSwitch,true) + } + + /** + * list转换为数组 + * + * @param data + * @return + */ + fun listToArray(data: List,isSwitch:Boolean,isFilter:Boolean): DoubleArray { + val doubles = DoubleArray(data.size*2) + var i = 0 + for (lonlatPoint in data) { + if(isSwitch){ + val lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonlatPoint) + doubles[i] = lonLat.lon + doubles[i+1] = lonLat.lat + }else{ + doubles[i] = lonlatPoint.longitude + doubles[i+1] = lonlatPoint.latitude + } + i+=2 + } + return doubles + } + + fun getLonLats(start: LonLatPoint, end: LonLatPoint): List { + var lonLatPoints: ArrayList = ArrayList() + val x = end.latitude - start.latitude + val y = end.longitude - start.longitude + val dis = Math.sqrt(x * x + y * y).absoluteValue + val num = (dis / 0.000001).toInt() + val numX = x / num.toDouble() + val numY = y / num.toDouble() + for (i in 1..num) { + val lon = start.longitude + numY * i + val lat = start.latitude + numX * i + val lonlatPoint = LonLatPoint(lon, lat) + if (DEBUG) { + Log.d(TAG, "lonlatPoint: ${lonlatPoint}") + } + lonLatPoints.add(lonlatPoint) + + } + if (DEBUG) { + Log.d(TAG, "size: ${lonLatPoints.size}") + } + return lonLatPoints + + } + + fun HaverSin(theta: Double): Double { + val v = Math.sin(theta / 2) + return v * v + } + + + var EARTH_RADIUS = 6378137.0 //m 地球半径 平均值,米 + var EARTH_RADIUS_KM = 6378.0 //m 地球半径 平均值,千米 + + + /// + /// 给定的经度1,纬度1;经度2,纬度2. 计算2个经纬度之间的距离。 + /// + /// 经度1 + /// 纬度1 + /// 经度2 + /// 纬度2 + /// 距离(米) + fun getDistance(lat1: Double, lon1: Double, lat2: Double, lon2: Double): Double { + //用haversine公式计算球面两点间的距离。 + //经纬度转换成弧度 + var lat1 = lat1 + var lon1 = lon1 + var lat2 = lat2 + var lon2 = lon2 + lat1 = ConvertDegreesToRadians(lat1) + lon1 = ConvertDegreesToRadians(lon1) + lat2 = ConvertDegreesToRadians(lat2) + lon2 = ConvertDegreesToRadians(lon2) + + //差值 + val vLon = Math.abs(lon1 - lon2) + val vLat = Math.abs(lat1 - lat2) + + //h is the great circle distance in radians, great circle就是一个球体上的切面,它的圆心即是球心的一个周长最大的圆。 + val h = HaverSin(vLat) + Math.cos(lat1) * Math.cos(lat2) * HaverSin(vLon) + return 2 * EARTH_RADIUS * Math.asin(Math.sqrt(h)) + } + + /// + /// 将角度换算为弧度。 + /// + /// 角度 + /// 弧度 + fun ConvertDegreesToRadians(degrees: Double): Double { + return degrees * Math.PI / 180 + } + + fun ConvertRadiansToDegrees(radian: Double): Double { + return radian * 180.0 / Math.PI + } + + val f = 1 / 298.257223563 + val b = 6356752.3142 + val a = 6378137 + + fun getDestinceLonLat(lonlat: LonLat, angle: Double, dist: Float): LonLat { + var angleRadHeading = angle / 180 * Math.PI + var newLat = 0.0 + var newLong = 0.0 + + val distRatio = dist / EARTH_RADIUS + val distRatioSine = Math.sin(distRatio) + val distRatioCosine = Math.cos(distRatio) + + val startLatRad = lonlat.lat / 180 * Math.PI + val startLonRad = lonlat.lon / 180 * Math.PI + + val startLatCos = Math.cos(startLatRad) + val startLatSin = Math.sin(startLatRad) + + val endLatRads = Math.asin(startLatSin * distRatioCosine + startLatCos * distRatioSine * Math.cos(angleRadHeading)) + val endLonRads = (startLonRad + + Math.atan2( + Math.sin(angleRadHeading) * distRatioSine * startLatCos, + distRatioCosine - startLatSin * Math.sin(endLatRads) + )) + newLat = endLatRads / Math.PI * 180 + newLong = endLonRads / Math.PI * 180 + + return LonLat(newLong, newLat) + } + + fun getDistance(lastLonlat: LonLat, lonlat: LonLat): Double { + val x = lonlat.lat - lastLonlat.lat + val y = lonlat.lon - lastLonlat.lon + return Math.sqrt(x * x + y * y).absoluteValue + } + + fun getNextLonLat(lastLonlat: LonLat, lonlat: LonLat, length: Double): LonLat { + val x = lonlat.lat - lastLonlat.lat + val y = lonlat.lon - lastLonlat.lon + val distance = Math.sqrt(x * x + y * y).absoluteValue + val scale = length / distance + if(CompileConfig.DEBUG){ + Log.i(TAG,"centerop-mattop:length:${length},distance:${distance},scale:${scale}") + } + val lon = lastLonlat.lon + y * scale + val lat = lastLonlat.lat + x * scale + return LonLat(lon, lat) + } + + fun distance(x1: Double, y1: Double, x2: Double, y2: Double): Double { + return MathUtils.getDistance(x1, y1, x2, y2) + } + + fun utcToUnix(time:Long):Long{ + return MathUtils.utcToUnix(time); + } + + //转换WGS_84坐标 + fun switchLonLatWGS84(lonLatPoint: LonLatPoint): LonLatPoint{ + val lonlat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint) + val lonLatPoint_WGS84 = LonLatPoint(lonlat.lon, lonlat.lat) + return lonLatPoint_WGS84 + } + //转换高德坐标 + fun switchLonLat(lonLatPoint: LonLatPoint): LonLatPoint{ + val lonlat = LonLat(lonLatPoint.longitude, lonLatPoint.latitude) + val lonLatPoint = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonlat) + return lonLatPoint + } + + /** + * UTM东北天角度转换为经纬度对应的角度 + */ + fun convertAngle(angle: Double, lon: Double, lat: Double): Double { + return MathUtils.convertAngle(angle, lon, lat) + } + + /** + * 平面角度转换为经纬度对应的角度 + */ + fun convertFlatAngle(angle: Double, lon: Double, lat: Double): Double { + return MathUtils.convertFlatAngle(angle, lon, lat) + } + + /** + * 处理角度在0-360之间 + */ + fun dealAngle(angle:Double):Double{ + return MathUtils.dealAngle(angle) + } + + /** + * 计算新的点 + */ + fun destination(lng: Double, lat: Double, heading: Double, distance: Double): DoubleArray { + return MathUtils.destination(lng, lat, heading, distance) + } + + fun isInRegion(lon: Double, lat: Double, list: List>?): Boolean{ + return MathUtils.isInRegion(lon, lat, list) + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/MonitorPressApi.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/MonitorPressApi.kt new file mode 100644 index 0000000000..f27d0e59fe --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/MonitorPressApi.kt @@ -0,0 +1,173 @@ +package com.zhidaoauto.map.sdk.open.tools + +import android.content.Context +import android.util.Log +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.open.view.MapAutoView +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import java.io.IOException + +class MonitorPressApi { + + private val TAG = javaClass.simpleName + + companion object { + //单例 + @JvmStatic val instance: MonitorPressApi by lazy((LazyThreadSafetyMode.SYNCHRONIZED)) { + MonitorPressApi() + } + } + + private constructor(){ + + } + + private var mContext: Context? = null + //main job + private var mMainJob: Job? = null + private var mainFlag = true; + + private var mTrackDir:String = "track" + private var mOtherCarPath:String = "othercar/hui_othercar_1119.txt" + // 模拟数据 + private var mFiles: ArrayList? = null + + + fun init(context: Context?) { + if(CompileConfig.DEBUG){ + Log.i(TAG, "init: ") + } + this.mContext = context + TaskManager.instance.init(context) + } + + fun init(context: Context?,trackDir:String?,otherCarPath:String?) { + if(CompileConfig.DEBUG){ + Log.i(TAG, "init: trackDir:$trackDir,otherCarPath:${otherCarPath}") + } + trackDir?.let{ + mTrackDir = trackDir + } + otherCarPath?.let{ + mOtherCarPath = otherCarPath + } + this.mContext = context + TaskManager.instance.init(context) + } + + fun exit() { + mainFlag = false + TaskManager.instance.exit() + mMainJob?.cancel() + } + + fun monitor(mapAutoView: MapAutoView){ + if(CompileConfig.DEBUG){ + Log.i(TAG, "monitor: ") + } + mainFlag = true + mMainJob?.cancel() + mMainJob = TaskManager.instance.getTaskScope()?.launch(Dispatchers.IO) { + try { + // 获得Assets文件夹下指定文件夹一共有多少文件 + val list = mContext?.assets?.list(mTrackDir) + if (list == null || list.isEmpty()) { + return@launch + } + TaskManager.instance.resetData() + mFiles?.clear() + mFiles = ArrayList(list.size) + for ((index, file) in list.withIndex()) { + mFiles?.add(file) + TaskManager.instance.loadTrackDataToMemory("$mTrackDir/$file", index, true) + } + } catch (e1: IOException) { + Log.e(TAG, "memoryop-e1", e1) + } + TaskManager.instance.LoadOtherCarsToMemory(mOtherCarPath) + var i = 0; + var randomsq = 10 + while (mainFlag) { + TaskManager.instance.resetTask() + + + val rv = (Math.random() * 16).toInt() + var trackIndex = (Math.random() * (mFiles!!.size - 1)).toInt() + if(CompileConfig.DEBUG){ + Log.i(TAG, "onClick--randomop: rv:${rv},trackIndex:${trackIndex}") + } + when (rv) { + 1 -> { + TaskManager.instance.monitorOtherCars(mapAutoView) + } + 2 -> { + TaskManager.instance.monitorSelfCar(trackIndex,mapAutoView) + } + 3 -> { + TaskManager.instance.monitorStyle(mapAutoView) + } + 4 -> { + TaskManager.instance.monitorDataAPI(trackIndex,mapAutoView) + } + 5 -> { + TaskManager.instance.monitorMarkerAdd(trackIndex,mapAutoView) + } + 6 -> { +// TaskManager.instance.monitorWifiEnable() + TaskManager.instance.monitorGetDataVersion(mapAutoView) + } + 7 -> { + TaskManager.instance.monitorPolygin3DAdd(trackIndex,mapAutoView) + + } + 8->{ + TaskManager.instance.monitorCarLight(mapAutoView) + } + 9->{ + TaskManager.instance.delMarker() + + } + 10->{ + TaskManager.instance.monitorUpdateCache() + } + 11->{ + TaskManager.instance.monitorShowInfoWindow() + } + 12->{ + TaskManager.instance.logTest() +// TaskManager.instance.monitorThreadPool() + } + 13->{ +// TaskManager.instance.monitorThread() + TaskManager.instance.monitorCacheHdData(mapAutoView) + } + 14 -> { +// TaskManager.instance.monitorMarkerAdd(trackIndex,mapAutoView) + TaskManager.instance.monitorGetAllCityCode() + } + 15 -> { +// TaskManager.instance.monitorMarkerAdd(trackIndex,mapAutoView) + TaskManager.instance.monitorCancleCacheHdData() + } + + else -> { + TaskManager.instance.monitor2DMarkerAdd(trackIndex,mapAutoView) + } + + } + if (i++ > randomsq) { + i = 0 + randomsq = (Math.random() * 10).toInt() + delay((Math.random() * 100).toLong()) + } + + } + + + } + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/RecorderUtils.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/RecorderUtils.kt new file mode 100644 index 0000000000..18bd3d82a2 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/RecorderUtils.kt @@ -0,0 +1,180 @@ +package com.zhidaoauto.map.sdk.open.tools + +import android.os.Environment +import android.text.TextUtils +import com.zhidaoauto.map.sdk.inner.controller.CommonController +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch +import java.io.File +import java.io.FileWriter +import java.io.IOException +import java.text.SimpleDateFormat +import java.util.Collections +import java.util.Date + +object RecorderUtils { + + + private val TAG = javaClass.simpleName + + //读取指定目录下的所有TXT文件的文件名 + fun getFileName(files: Array?, end: String): ArrayList? { + var list = ArrayList() + if (files != null) { // 先判断目录是否为空,否则会报空指针 + for (file in files) { + val fileName: String = file.getName() + if (fileName.endsWith(end)) { + list.add(fileName) + } + } + } + return list + } + + var mWorkingDirectory: String? = null + + private val FILE_MAX_SIZE = 6 * 1024 * 1024 + + private val comparator = object : Comparator { + override fun compare(o1: String?, o2: String?): Int { + return if (!TextUtils.isEmpty(o1) + && !TextUtils.isEmpty(o2) + && o1!!.replace("-","").toLong() < o2!!.replace("-","").toLong() + ) -1 else 1 + } + } + fun i(content: String) { + i("others",content) + } + + fun i(name:String,content: String) { + val scope = CommonController.instance.scope + scope?.launch(Dispatchers.IO) { + write(name,content) + checkLog() + } + } + + private fun checkLog() { + val dir = getLogDirectory() + if (dir != null) { + val file = File(dir) + if (file != null && file.exists()) { + val array = file.list() + if (array == null || array.size <= 10) { + return + } + val list = array.asList() + Collections.sort(list, comparator) + val it = list.subList(0, list.size - 9).iterator() + while (it.hasNext()) { + val name = it.next() + delete(File("${dir}/${name}")) + } + } + + } + } + + private fun delete(file: File) { + if (file.isDirectory) { + val list = file.listFiles() + for (f in list) { + delete(f) + } + file.delete() + } else if (file.exists()) { + file.delete() + } + } + + + private fun write(name:String,content: String) { + val dir = dealLogFile(name) + if (dir != null) { + try { + val fw = FileWriter("${dir}", true) +// fw.write("${DateUtils.getCurrentTime()} $content\r\n") + fw.write("$content\r\n") + fw.close() + } catch (var5: Exception) { + } + } +// if(CompileConfig.DEBUG){ +// Log.i(TAG, "write: path:${dir}") +// } + } + + private fun dealName(name: String): String { + return if (TextUtils.isEmpty(name)) { + name + } else if (!name.contains("_")) { + name + "_1" + } else { + val array = name.split("_").toTypedArray() + if (array.size == 2) { + var nameIndex = array[1].toInt() + ++nameIndex + array[0] + "_" + nameIndex + } else { + array[0] + "_11" + } + } + } + + + private fun dealLogFile(name: String): String { + var filename = name + val fileDir: String = getCurrentDate() + val path = File(getLogDirectory() + "/" + fileDir) + if (!path.exists()) { + path.mkdirs() + } + val file = File(path.absolutePath + "/" + filename + ".txt") + if (!file.exists()) { + try { + file.createNewFile() + } catch (var5: IOException) { + var5.printStackTrace() + } + } else if (file.length() > FILE_MAX_SIZE) { + filename = dealName(filename) + return dealLogFile(filename) + } + return file.absolutePath + } + + + private fun getLogDirectory(): String? { + var res: String = if (!TextUtils.isEmpty(mWorkingDirectory)) { + "$mWorkingDirectory/log" + } else { + Environment.getExternalStorageDirectory().absolutePath + "/oth/log" + } + if (!res.endsWith("/")) { + res = "$res/" + } + val f = File(res) + if (!f.exists()) { + f.mkdirs() + } + return res + } + + private val dateFormat = SimpleDateFormat("yyyyMMdd") + private val timeFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS") + + /** + * 获取当前日期 + */ + fun getCurrentDate(): String { + return dateFormat.format(Date()) + } + + /** + * 获取当前时间 + */ + fun getCurrentTime(): String { + return timeFormat.format(Date()) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/TaskManager.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/TaskManager.kt new file mode 100644 index 0000000000..f47634fbed --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/TaskManager.kt @@ -0,0 +1,1441 @@ +package com.zhidaoauto.map.sdk.open.tools + +import android.content.Context +import android.graphics.Color +import android.net.wifi.WifiManager +import android.text.TextUtils +import android.util.Log +import android.widget.TextView +import com.autonavi.nge.NLog +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.inner.common.ConstantExt +import com.zhidaoauto.map.sdk.inner.controller.CommonController +import com.zhidaoauto.map.sdk.inner.road.RoadHelper +import com.zhidaoauto.map.sdk.open.MapAutoApi +import com.zhidaoauto.map.sdk.open.abs.IResult +import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener +import com.zhidaoauto.map.sdk.open.circle.CircleController +import com.zhidaoauto.map.sdk.open.circle.CircleOptions +import com.zhidaoauto.map.sdk.open.data.CityInfo +import com.zhidaoauto.map.sdk.open.data.MapDataApi +import com.zhidaoauto.map.sdk.open.location.MogoLocation +import com.zhidaoauto.map.sdk.open.marker.Marker +import com.zhidaoauto.map.sdk.open.marker.MarkerBatchData +import com.zhidaoauto.map.sdk.open.marker.MarkerCacheController +import com.zhidaoauto.map.sdk.open.marker.MarkerOptions +import com.zhidaoauto.map.sdk.open.marker.MarkerSimpleData +import com.zhidaoauto.map.sdk.open.marker.MarkerSimpleOptions +import com.zhidaoauto.map.sdk.open.polygon.Polygon3D +import com.zhidaoauto.map.sdk.open.polygon.Polygon3DHelper +import com.zhidaoauto.map.sdk.open.polygon.Polygon3DOption +import com.zhidaoauto.map.sdk.open.poyline.Polyline +import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.road.CenterLine +import com.zhidaoauto.map.sdk.open.road.RoadCross +import com.zhidaoauto.map.sdk.open.road.RoadRectInfos +import com.zhidaoauto.map.sdk.open.road.StopLine +import com.zhidaoauto.map.sdk.open.road.ZebraLine +import com.zhidaoauto.map.sdk.open.routeinfo.RoadInfo +import com.zhidaoauto.map.sdk.open.view.MapAutoView +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.Job +import kotlinx.coroutines.MainScope +import kotlinx.coroutines.Runnable +import kotlinx.coroutines.cancel +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch +import java.io.BufferedReader +import java.io.FileInputStream +import java.io.FileNotFoundException +import java.io.IOException +import java.io.InputStream +import java.io.InputStreamReader +import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.CopyOnWriteArrayList +import java.util.concurrent.Executors +import java.util.concurrent.LinkedBlockingDeque +import java.util.concurrent.ThreadPoolExecutor +import java.util.concurrent.TimeUnit + + +class TaskManager { + + + + companion object { + //单例 + @JvmStatic val instance: TaskManager by lazy((LazyThreadSafetyMode.SYNCHRONIZED)) { + TaskManager() + } + } + + var context: Context? = null + + val TARGET_INDEX_MAX = 20000 + val DURATION_MAX = 10 + + private val trackMap: ConcurrentHashMap> = ConcurrentHashMap() + private val otherCarList: CopyOnWriteArrayList = CopyOnWriteArrayList() + + private var lineDatastep = 0 + //中心线 + var centerLine: Polyline? = null + var centerlons = CopyOnWriteArrayList() + + //停止线 + var stopLine: Polyline? = null + var stoplons = CopyOnWriteArrayList() + + var listRect = CopyOnWriteArrayList() + + private var mTaskScope:CoroutineScope? = null + //other car job + private var othercarFlag = false + private var mOtherCarJob: Job? = null + //track job + private var mTrackJob: Job? = null + var randomTrackFlag = true; + + //data job + private var mDataJob: Job? = null + var dataFlag = true; + + //3D marker job + private var mMarkerJob: Job? = null + var markerFlag = true; + + //2D marker job + private var m2DMarkerJob: Job? = null + var marker2DFlag = true; + + private var polyline: Polyline? = null + private var linestep = 0 + var polygon :Polygon3D? = null + + var rect: Polyline? = null + var ellipse: Polyline? = null + var circle: CircleController? = null + + private var isChangeColor: Boolean = false + private var isShowBirght = false + private var brightSpeed = 0.25f + + private var mPolygonJob: Job? = null + var polygonFlag = true; + + private var mUpdateCacheJob: Job? = null + var mUpdateFlag = true + var threadPoolExecutor: ThreadPoolExecutor? = null + var crossLine: Polyline? = null + val trackStr = "112.577698,26.82026482,112.5776649,26.82024463,112.5776315,26.82022433,112.5775976,26.82020375,112.5775631,26.8201828,112.5775278,26.8201614,112.5774918,26.82013967,112.5774553,26.82011768,112.5774184,26.82009541,112.5773801,26.82007238,112.577343,26.82005009,112.5773046,26.82002699,112.5772689,26.82000566,112.5772343,26.81998499,112.5771981,26.8199634,112.5771604,26.81994093,112.5771241,26.81991927,112.5770863,26.81989686,112.577048,26.81987432,112.5770092,26.81985169,112.5769702,26.81982908,112.5769311,26.8198067,112.5768912,26.81978399,112.5768525,26.81976202,112.5768148,26.81974082,112.5767765,26.81971934,112.5767375,26.8196976,112.5767005,26.81967709,112.5766627,26.81965632,112.5766243,26.8196354,112.5765873,26.81961534,112.5765514,26.81959614,112.5765094,26.81957391,112.5764739,26.81955537,112.5764377,26.81953663,112.5763962,26.8195154,112.5763611,26.81949759,112.5763253,26.81947942,112.5762886,26.81946081,112.5762538,26.81944299,112.5762181,26.81942459,112.5761771,26.81940327,112.5761425,26.81938516,112.5761026,26.81936424,112.5760665,26.81934525,112.5760283,26.81932496,112.5759929,26.81930612,112.5759553,26.81928594,112.5759164,26.819265,112.5758797,26.81924523,112.5758431,26.81922557,112.5758043,26.81920481,112.5757701,26.81918656,112.5757372,26.81916931,112.575705,26.81915323,112.5756723,26.8191394,112.5756388,26.81913008,112.5756042,26.81912741,112.5755689,26.81913241,112.5755345,26.81914523,112.575501,26.81916323,112.5754702,26.81918345,112.5754414,26.81920591,112.5754142,26.81923028,112.5753873,26.8192577,112.5753624,26.81928628,112.5753385,26.81931747,112.575318,26.81934811,112.5752981,26.81938112,112.575279,26.81941509,112.5752615,26.81944712,112.5752441,26.81947941,112.5752259,26.8195132,112.5752073,26.81954787,112.5751884,26.81958344,112.5751691,26.81961976,112.5751494,26.81965723,112.57513,26.81969415,112.575111,26.81973053,112.5750914,26.81976802,112.5750718,26.81980571,112.5750521,26.81984347,112.5750319,26.81988209,112.5750139,26.81991636,112.5749962,26.81995017,112.5749754,26.81998984,112.5749573,26.82002443,112.5749386,26.8200601,112.5749197,26.82009614,112.5749008,26.82013245,112.5748813,26.82016981,112.5748627,26.82020577,112.574843,26.82024356,112.5748242,26.82027988,112.5748048,26.8203173,112.5747853,26.82035503,112.5747657,26.82039302,112.5747457,26.82043198,112.5747264,26.82046932,112.5747067,26.82050756,112.5746869,26.82054576,112.5746677,26.82058291,112.5746479,26.82062126,112.5746291,26.82065783,112.5746089,26.82069715,112.5745902,26.82073333,112.5745732,26.82076629,112.5745548,26.82080203,112.5745377,26.82083496,112.5745212,26.82086682,112.574505,26.82089828,112.5744891,26.82092935,112.574473,26.82096083,112.5744574,26.82099114,112.5744427,26.82102038,112.5744341,26.82105102,112.5744217,26.82108217,112.5744034,26.82111193,112.5743842,26.821142,112.5743648,26.82117413,112.5743472,26.82120453,112.5743279,26.82123795,112.5743097,26.82127083,112.5742903,26.82130636,112.5742724,26.8213397,112.5742548,26.82137277,112.574237,26.8214064,112.5742188,26.82144091,112.5742005,26.82147546,112.5741813,26.82151155,112.5741619,26.8215485,112.5741421,26.82158628,112.574124,26.82162082,112.5741058,26.8216558,112.5740873,26.82169111,112.5740687,26.82172683,112.5740495,26.8217638,112.5740308,26.82179956,112.5740115,26.82183663,112.5739919,26.82187428,112.573972,26.82191258,112.5739519,26.82195149,112.5739332,26.82198747,112.5739153,26.82202211,112.5738944,26.82206251,112.5738756,26.82209882,112.5738567,26.8221355,112.5738378,26.82217255,112.5738182,26.82221085,112.5737995,26.82224751,112.5737803,26.82228527,112.5737607,26.82232415,112.5737419,26.82236124,112.5737225,26.82239931,112.5737029,26.82243731,112.5736827,26.82247603,112.5736634,26.82251246,112.5736438,26.82254928,112.5736243,26.82258572,112.5736043,26.82262308,112.5735852,26.82265864,112.5735657,26.82269511,112.5735457,26.82273244,112.5735268,26.82276772,112.5735077,26.82280347,112.5734861,26.82284394,112.5734658,26.822882,112.5734452,26.82292018,112.5734247,26.82295753,112.5734042,26.82299402,112.5733832,26.82303027,112.5733626,26.82306378,112.5733406,26.82309759,112.573319,26.82312874,112.5732941,26.82316277,112.5732689,26.82319562,112.5732434,26.82322829,112.5732177,26.82326103,112.573125,26.823276,112.5730926,26.82319509,112.5731186,26.82316135,112.5731418,26.82313049,112.5731671,26.82309585,112.5731906,26.82306251,112.5732133,26.82302916,112.5732356,26.82299504,112.5732575,26.82296012,112.5732792,26.8229244,112.5733004,26.82288868,112.5733224,26.82285045,112.5733415,26.82281652,112.5733631,26.82277759,112.5733823,26.82274233,112.5734012,26.8227074,112.5734232,26.82266644,112.5734429,26.82262949,112.5734628,26.82259213,112.5734828,26.82255438,112.573503,26.82251618,112.5735232,26.82247772,112.5735441,26.82243805,112.573564,26.82240019,112.5735849,26.82236028,112.5736054,26.82232125,112.5736254,26.82228313,112.5736465,26.82224299,112.5736666,26.82220471,112.5736877,26.82216437,112.5737079,26.8221259,112.5737285,26.8220863,112.5737493,26.82204643,112.5737701,26.82200633,112.5737916,26.82196499,112.5738122,26.82192543,112.5738339,26.82188365,112.5738547,26.82184377,112.5738767,26.82180167,112.5738956,26.82176558,112.5739167,26.82172515,112.5739391,26.82168239,112.5739605,26.82164148,112.573983,26.8215983,112.5740045,26.82155708,112.5740266,26.82151468,112.5740465,26.8214764,112.5740659,26.8214391,112.5740854,26.82140175,112.574105,26.82136438,112.5741274,26.8213217,112.5741469,26.82128434,112.5741666,26.82124703,112.5741861,26.82120977,112.5742058,26.82117251,112.5742277,26.82113096,112.574248,26.82109253,112.5742678,26.8210551,112.5742876,26.82101759,112.5743103,26.82097465,112.5743301,26.82093699,112.5743495,26.82090037,112.5743727,26.82085623,112.5743926,26.82081862,112.5744124,26.82078108,112.5744321,26.82074358,112.5744518,26.82070609,112.5744715,26.82066866,112.5744938,26.82062594,112.5745133,26.82058863,112.574535,26.82054716,112.5745549,26.82050899,112.5745741,26.82047199,112.5745933,26.82043511,112.5746145,26.82039418,112.574634,26.82035661,112.5746549,26.82031624,112.574676,26.82027535,112.5746968,26.82023518,112.5747177,26.82019483,112.5747373,26.82015724,112.5747573,26.82011956,112.5747776,26.82008238,112.5747981,26.82004564,112.5748193,26.82000863,112.5748421,26.81996979,112.5748629,26.81993507,112.5748842,26.81989978,112.574907,26.81986224,112.5749281,26.81982769,112.5749484,26.81979457,112.5749701,26.8197589,112.5749921,26.81972245,112.5750122,26.81968835,112.5750325,26.81965318,112.5750515,26.81961904,112.5750695,26.81958583,112.5750898,26.81954748,112.5751093,26.81951021,112.5751277,26.81947433,112.5751461,26.81943786,112.5751632,26.8194037,112.5751818,26.81936582,112.575199,26.81933074,112.5752154,26.81929703,112.575232,26.81926305,112.5752475,26.81923084,112.5752623,26.81920053,112.5752764,26.8191712,112.5752904,26.81914362,112.5753061,26.81911433,112.5753237,26.81908528,112.5753441,26.81905648,112.5753677,26.81902905,112.5753944,26.81900493,112.5754244,26.81898445,112.5754583,26.81896707,112.575493,26.81895367,112.5755294,26.81894349,112.575567,26.81893672,112.5756041,26.81893372,112.5756415,26.8189344,112.5756798,26.81893869,112.5757186,26.81894678,112.5757544,26.81895756,112.5757898,26.81897108,112.5758268,26.81898715,112.5758655,26.81900556,112.5759008,26.81902323,112.5759373,26.81904202,112.5759748,26.81906168,112.5760131,26.81908211,112.5760514,26.81910281,112.5760868,26.81912227,112.5761239,26.81914281,112.5761608,26.81916343,112.5761975,26.81918408,112.5762367,26.81920643,112.5762756,26.81922888,112.5763151,26.81925176,112.57635,26.81927208,112.5763891,26.81929497,112.5764295,26.81931871,112.5764661,26.81934025,112.5765068,26.81936437,112.5765425,26.81938563,112.5765836,26.81941011,112.5766186,26.81943106,112.5766557,26.81945345,112.5766919,26.81947536,112.5767284,26.81949747,112.576764,26.81951916,112.5768011,26.81954171,112.5768394,26.81956507,112.5768758,26.81958727,112.5769144,26.81961095,112.5769511,26.81963345,112.576989,26.81965674,112.5770281,26.81968076,112.5770662,26.81970418,112.5771043,26.81972764,112.5771414,26.81975049,112.5771808,26.81977472,112.5772192,26.81979831,112.5772577,26.81982191,112.5772952,26.81984484,112.577335,26.81986907,112.5773736,26.81989259,112.5774123,26.81991606,112.5774498,26.81993877,112.5774882,26.81996205,112.5775276,26.81998588,112.5775644,26.82000825,112.5776031,26.82003178,112.5776393,26.82005387,112.5776772,26.82007712,112.5777137,26.82009957,112.5777488,26.82012121,112.5777907,26.82014706,112.5778261,26.82016891,112.5778652,26.820193,112.577905,26.82021753,112.5779449,26.82024206,112.5779859,26.8202672,112.5780257,26.82029165,112.5780603,26.82031297,112.5780997,26.82033728,112.578138,26.82036083,112.5781768,26.82038473,112.5782161,26.82040883,112.5782537,26.82043183,112.5782895,26.82045365,112.5783251,26.82047532,112.5783596,26.82049637,112.5783979,26.82051971,112.5784329,26.82054099,112.5784705,26.82056384,112.5785066,26.82058588,112.57854,26.82060632,112.5785745,26.82062766,112.5786093,26.82064924,112.5786404,26.82066849,112.5786713,26.82068759,112.5787014,26.82070605,112.5787297,26.82072339,112.5787569,26.82074014,112.5787857,26.8207589,112.5788141,26.82077914,112.5788421,26.82080214,112.5788692,26.8208285,112.578893,26.82085669,112.578913,26.82088621,112.5789302,26.82091859,112.5789438,26.82095338,112.5789539,26.82098972,112.5789601,26.82102729,112.5789619,26.8210634,112.5789595,26.82110054,112.5789525,26.82113842,112.5789405,26.8211768,112.5789249,26.82121207,112.5789047,26.82124716,112.5788828,26.82127905,112.5788587,26.82131182,112.5788364,26.8213422,112.5788121,26.82137567,112.5787872,26.82140995,112.5787614,26.82144538,112.5787355,26.82148084,112.5787084,26.82151799,112.5786832,26.82155261,112.5786581,26.82158701,112.5786326,26.82162203,112.5786075,26.82165672,112.5785815,26.82169273,112.5785547,26.82172993,112.5785284,26.82176648,112.5785021,26.82180326,112.5784763,26.8218394,112.5784498,26.82187675,112.5784225,26.8219154,112.5783962,26.82195248,112.5783691,26.82199081,112.5783411,26.82203039,112.5783137,26.82206924,112.5782862,26.82210834,112.5782587,26.82214764,112.5782353,26.82218122,112.5782077,26.82222088,112.5781836,26.82225567,112.5781588,26.82229152,112.5781347,26.82232641,112.5781077,26.82236534,112.5780829,26.82240132,112.5780587,26.82243632,112.5780345,26.82247136,112.578011,26.82250546,112.5779827,26.82254669,112.5779586,26.82258199,112.5779345,26.82261734,112.5779112,26.82265173,112.5778864,26.82268825,112.577863,26.82272287,112.5778382,26.82275969,112.5778141,26.82279565,112.5777908,26.82283063,112.5777662,26.82286771,112.5777431,26.8229028,112.5777187,26.82294001,112.577695,26.82297621,112.5776713,26.8230124,112.5776476,26.82304855,112.5776247,26.82308364,112.5775972,26.82312593,112.5775744,26.82316101,112.5775477,26.82320226,112.5775237,26.82323937,112.5775004,26.82327543,112.5774737,26.82331663,112.5774504,26.82335271,112.5774237,26.82339398,112.5774004,26.82343015,112.5773771,26.82346637,112.5773538,26.82350264,112.5773311,26.82353795,112.5773045,26.82357962,112.5772805,26.82361727,112.5772579,26.82365292,112.5772305,26.82369605,112.5772038,26.82373828,112.5771804,26.82377537,112.5771576,26.82381151,112.5771335,26.8238499,112.57711,26.82388731,112.5770866,26.82392483,112.5770632,26.82396247,112.5770399,26.82400024,112.5770172,26.82403706,112.5769932,26.8240762,112.5769706,26.82411333,112.5769466,26.82415281,112.5769239,26.82419023,112.5769006,26.8242289,112.5768766,26.82426888,112.5768538,26.82430686,112.5768304,26.82434619,112.5768062,26.82438686,112.5767826,26.82442659,112.576759,26.8244664,112.5767362,26.82450513,112.576712,26.82454613,112.5766887,26.82458599,112.5766654,26.82462584,112.5766429,26.82466453,112.5766198,26.82470431,112.5765961,26.82474519,112.5765731,26.82478489,112.5765508,26.82482342,112.5765272,26.8248642,112.5765044,26.82490376,112.5764823,26.82494211,112.5764597,26.82498158,112.5764365,26.82502214,112.5764141,26.82506156,112.5763923,26.82509987,112.5763694,26.82514046,112.5763479,26.82517884,112.5763253,26.82521944,112.5763041,26.82525765,112.5762819,26.82529789,112.5762605,26.82533679,112.5762399,26.82537422,112.5762184,26.82541343,112.5761953,26.82545571,112.5761739,26.82549472,112.5761508,26.82553699,112.5761295,26.82557604,112.5761059,26.82561945,112.5760853,26.82565746,112.5760653,26.8256944,112.5760443,26.82573355,112.5760238,26.82577161,112.5760035,26.82580955,112.5759834,26.82584724,112.5759607,26.82588994,112.5759383,26.82593221,112.5759161,26.82597406,112.5758938,26.82601648,112.5758733,26.82605542,112.5758519,26.8260963,112.5758305,26.82613716,112.5758087,26.82617896,112.5757879,26.82621856,112.5757669,26.82625897,112.5757456,26.82630002,112.5757251,26.82633968,112.5757048,26.82637922,112.5756853,26.82641773,112.5756651,26.82645798,112.5756464,26.82649596,112.5756275,26.82653452,112.575609,26.82657262,112.5755908,26.82661047,112.5755725,26.82664893,112.575555,26.82668614,112.5755378,26.82672289,112.5755189,26.82676373,112.5755008,26.82680306,112.5754827,26.82684261,112.5754649,26.82688149,112.5754474,26.82691971,112.5754297,26.82695807,112.5754129,26.82699406,112.5753942,26.8270344,112.5753769,26.82707138,112.5753601,26.82710745,112.5753433,26.82714345,112.5753269,26.82717861,112.5753107,26.82721345,112.5752958,26.8272458,112.5752809,26.82727812,112.5752663,26.82730994,112.5752524,26.82734051,112.5752393,26.82736945,112.575226,26.82739794,112.5752118,26.82742821,112.5751971,26.82745922,112.5751817,26.82749174,112.5751666,26.8275242,112.5751515,26.8275565,112.5751352,26.82759177,112.5751203,26.82762466,112.5751043,26.8276599,112.5750881,26.82769574,112.5750729,26.82772944,112.5750574,26.82776339,112.5750421,26.82779694,112.5750261,26.82783198,112.5750105,26.82786635,112.5749952,26.82790045,112.5749799,26.82793441,112.5749647,26.82796847,112.5749503,26.82800031,112.5749367,26.82803037,112.5749241,26.82805848,112.5749101,26.82808862,112.5748948,26.8281212,112.574879,26.82815463,112.5748635,26.82818708,112.5748472,26.8282214,112.5748312,26.82825531,112.574814,26.82829177,112.5747983,26.82832525,112.5747814,26.82836176,112.5747645,26.82839855,112.574748,26.82843472,112.5747317,26.82847055,112.5747144,26.82850911,112.5746971,26.82854794,112.5746795,26.82858784,112.5746636,26.82862412,112.5746474,26.82866127,112.5746311,26.8286993,112.5746145,26.82873817,112.5745982,26.82877687,112.5745814,26.82881732,112.5745645,26.82885843,112.5745476,26.82890018,112.5745304,26.8289424,112.5745128,26.82898606,112.5744961,26.82902786,112.5744789,26.82907101,112.5744616,26.82911452,112.5744436,26.82915967,112.5744281,26.82919867,112.5744125,26.82923804,112.5743967,26.82927771,112.5743813,26.82931649,112.5743654,26.82935656,112.5743471,26.82940243,112.5743307,26.82944378,112.5743129,26.82948851,112.5742967,26.82952975,112.5742814,26.82956861,112.5742631,26.82961532,112.5742459,26.8296596,112.5742301,26.82970036,112.5742151,26.82973993,112.5742002,26.82977939,112.5741854,26.82981876,112.5741692,26.82986254,112.5741527,26.8299073,112.5741363,26.82995202,112.5741217,26.82999225,112.5741054,26.83003703,112.5740891,26.83008201,112.5740748,26.83012154,112.574061,26.8301602,112.5740467,26.83020022,112.5740318,26.83024179,112.5740173,26.83028262,112.5740027,26.83032378,112.5739884,26.83036406,112.5739736,26.83040576,112.5739583,26.83044889,112.5739435,26.83049099,112.5739291,26.83053203,112.5739143,26.83057443,112.5738996,26.83061691,112.573885,26.83065939,112.57387,26.83070302,112.5738554,26.83074539,112.5738409,26.83078771,112.5738269,26.8308288,112.5738121,26.83087228,112.5737977,26.83091457,112.5737834,26.83095689,112.5737692,26.83099924,112.5737555,26.83104042,112.5737416,26.83108282,112.5737276,26.83112527,112.5737134,26.83116903,112.5736999,26.83121044,112.5736861,26.83125311,112.5736724,26.83129583,112.5736587,26.83133862,112.5736452,26.83138146,112.5736317,26.83142437,112.5736183,26.83146737,112.5736045,26.83151168,112.5735913,26.83155482,112.573578,26.83159803,112.5735648,26.83164125,112.5735517,26.83168446,112.573539,26.83172641,112.5735257,26.83177076,112.5735132,26.83181264,112.5735001,26.83185701,112.5734872,26.83190019,112.5734744,26.83194343,112.5734616,26.83198674,112.5734487,26.83203012,112.573436,26.8320736,112.5734232,26.83211711,112.5734109,26.83215929,112.573398,26.83220391,112.5733859,26.832246,112.573373,26.83229048,112.5733606,26.83233362,112.5733483,26.83237662,112.573336,26.83241948,112.5733237,26.83246218,112.5733116,26.83250468,112.5732998,26.83254575,112.5732879,26.83258779,112.5732757,26.83263079,112.5732641,26.8326724,112.5732526,26.83271382,112.5732416,26.83275385,112.5732301,26.83279609,112.573219,26.83283702,112.5732079,26.83287792,112.5731968,26.83291878,112.573186,26.83295848,112.5731747,26.83300056,112.5731637,26.8330415,112.5731527,26.83308249,112.5731421,26.83312245,112.573131,26.83316484,112.5731204,26.8332061,112.5731098,26.83324731,112.5730979,26.83329449,112.5730876,26.83333567,112.5730774,26.83337685,112.5730674,26.83341796,112.5730575,26.83345902,112.5730477,26.83350006,112.5730378,26.83354109,112.5730281,26.833581,112.5730183,26.83362208,112.5730082,26.83366432,112.5729983,26.83370531,112.5729885,26.83374624,112.5729785,26.83378717,112.5729685,26.8338281,112.5729587,26.83386787,112.5729483,26.83391,112.5729369,26.83395684,112.572927,26.83399787,112.5729158,26.83404479,112.5729065,26.83408467,112.5728968,26.83412688,112.5728875,26.83416797,112.5728781,26.83420907,112.5728687,26.83425023,112.5728593,26.83429146,112.5728499,26.83433277,112.5728405,26.83437417,112.5728311,26.83441559,112.5728217,26.83445712,112.5728109,26.83450465,112.5728015,26.83454636,112.5727922,26.83458807,112.572783,26.83462974,112.572774,26.83467145,112.5727651,26.83471318,112.5727564,26.83475493,112.5727478,26.83479672,112.5727393,26.8348385,112.5727311,26.83487906,112.5727225,26.834922,112.5727129,26.83496964,112.5727046,26.83501131,112.5726952,26.83505885,112.5726858,26.83510637,112.5726778,26.83514682,112.5726694,26.83518971,112.5726604,26.83523626,112.572651,26.83528532,112.5726431,26.83532732,112.5726343,26.83537423,112.5726263,26.83541764,112.5726186,26.83545991,112.5726109,26.83550227,112.5726032,26.83554476,112.5725955,26.83558734,112.5725881,26.83562882,112.5725802,26.83567289,112.5725726,26.83571591,112.5725653,26.83575785,112.5725575,26.83580247,112.57255,26.83584605,112.5725425,26.83588981,112.5725352,26.83593248,112.5725275,26.83597781,112.5725202,26.83602077,112.5725125,26.83606641,112.5725052,26.83610966,112.5724976,26.83615563,112.5724904,26.83619918,112.5724828,26.83624548,112.5724754,26.8362907,112.572468,26.83633612,112.5724609,26.83638041,112.5724534,26.8364275,112.5724462,26.83647349,112.5724391,26.83651971,112.5724323,26.83656468,112.5724255,26.83661082,112.5724187,26.83665804,112.5724124,26.83670237,112.5724058,26.83674911,112.5723994,26.83679439,112.5723933,26.8368383,112.5723872,26.83688345,112.5723811,26.83692856,112.572375,26.83697362,112.572369,26.83701871,112.5723627,26.8370651,112.5723568,26.83710893,112.5723507,26.83715406,112.5723446,26.83719921,112.5723385,26.83724439,112.5723325,26.83728967,112.5723264,26.83733635,112.5723206,26.8373818,112.5723149,26.83742737,112.5723092,26.83747304,112.5723036,26.83751881,112.5722983,26.83756338,112.5722929,26.8376094,112.5722875,26.83765684,112.5722823,26.83770308,112.5722773,26.83774945,112.5722725,26.83779601,112.5722678,26.83784277,112.5722633,26.83788973,112.5722588,26.83793682,112.5722543,26.83798399,112.5722497,26.83803128,112.5722451,26.83807868,112.5722402,26.83812616,112.5722352,26.83817373,112.5722301,26.8382214,112.5722251,26.83826772,112.5722199,26.83831666,112.572215,26.83836403,112.5722103,26.83841106,112.5722058,26.83845773,112.5722014,26.83850393,112.5721972,26.83854851,112.5721929,26.83859432,112.5721884,26.83864135,112.572184,26.83868696,112.5721797,26.8387312,112.5721753,26.83877669,112.5721707,26.83882212,112.5721662,26.83886751,112.5721616,26.83891288,112.5721568,26.83895952,112.5721522,26.83900354,112.5721474,26.83905014,112.5721427,26.83909412,112.572138,26.83913936,112.5721333,26.83918457,112.5721286,26.83922975,112.5721238,26.83927622,112.5721192,26.83932139,112.5721145,26.83936654,112.5721098,26.83941167,112.5721051,26.83945547,112.5721002,26.83950183,112.5720954,26.83954687,112.5720907,26.83959058,112.5720858,26.83963502,112.5720807,26.83968067,112.5720758,26.83972506,112.572071,26.83976819,112.5720661,26.83981385,112.5720613,26.83985821,112.5720565,26.83990258,112.5720519,26.83994566,112.5720472,26.83998988,112.5720423,26.84003533,112.5720376,26.84007955,112.5720328,26.84012386,112.5720282,26.840167,112.5720233,26.8402128,112.5720184,26.84025612,112.5720131,26.84030211,112.5720077,26.84034695,112.5720023,26.84039055,112.5719966,26.84043554,112.5719906,26.8404819,112.5719847,26.84052699,112.5719789,26.8405721,112.5719732,26.84061592,112.5719672,26.84066228,112.5719614,26.84070739,112.5719557,26.84075117,112.5719497,26.84079748,112.5719438,26.84084247,112.5719378,26.84088749,112.5719317,26.84093258,112.5719255,26.8409777,112.5719194,26.84102155,112.5719129,26.84106808,112.5719066,26.84111343,112.5719001,26.84115892,112.5718937,26.84120458,112.5718873,26.84124916,112.5718806,26.84129651,112.571874,26.84134262,112.5718675,26.84138874,112.5718608,26.84143489,112.5718543,26.84147982,112.5718473,26.84152753,112.5718406,26.84157434,112.5718338,26.84162116,112.571827,26.84166798,112.5718201,26.84171482,112.5718132,26.84176168,112.5718062,26.84180853,112.571799,26.84185535,112.5717918,26.84190218,112.5717847,26.84194764,112.5717774,26.84199439,112.57177,26.84204102,112.5717624,26.84208882,112.5717551,26.842135,112.571748,26.84218082,112.571741,26.84222489,112.5717337,26.8422711,112.5717265,26.84231576,112.5717193,26.84236021,112.5717122,26.84240319,112.5717047,26.84244857,112.5716978,26.84249013,112.5716902,26.84253673,112.571683,26.84258083,112.5716761,26.8426237,112.5716691,26.84266786,112.5716618,26.84271345,112.5716548,26.84275665,112.5716475,26.84280248,112.5716403,26.8428471,112.571633,26.84289176,112.5716258,26.84293515,112.5716182,26.8429798,112.5716103,26.84302571,112.5716025,26.84307036,112.5715949,26.84311377,112.5715869,26.84315974,112.5715793,26.84320316,112.5715712,26.84324916,112.5715633,26.84329394,112.5715553,26.84333875,112.5715476,26.84338234,112.5715393,26.84342858,112.5715315,26.84347232,112.5715233,26.84351873,112.5715153,26.84356395,112.5715074,26.84360923,112.5714995,26.84365337,112.5714912,26.8437002,112.5714831,26.84374579,112.571475,26.84379143,112.5714669,26.84383711,112.5714587,26.8438828,112.5714505,26.84392853,112.5714423,26.84397429,112.5714343,26.84401877,112.5714258,26.8440659,112.5714176,26.8441118,112.5714093,26.84415776,112.5714009,26.84420378,112.5713925,26.84424984,112.5713842,26.84429593,112.5713758,26.84434205,112.5713676,26.8443869,112.571359,26.8444344,112.5713509,26.8444793,112.5713422,26.84452688,112.5713338,26.84457314,112.5713253,26.84461935,112.571317,26.84466415,112.5713082,26.84471147,112.5712998,26.84475603,112.5712908,26.8448031,112.5712818,26.84484878,112.5712726,26.84489446,112.5712634,26.84493882,112.5712539,26.84498451,112.571244,26.84503151,112.5712344,26.84507722,112.5712247,26.84512285,112.571215,26.84516837,112.5712056,26.84521246,112.5711957,26.84525888,112.5711865,26.84530236,112.5711768,26.84534804,112.5711673,26.84539214,112.5711581,26.84543471,112.5711487,26.84547826,112.571139,26.84552282,112.5711298,26.84556473,112.5711205,26.84560765,112.5711094,26.84565769,112.5711001,26.84569896,112.5710906,26.84574134,112.5710807,26.84578481,112.5710712,26.845827,112.5710616,26.84586907,112.5710521,26.84591106,112.5710431,26.84595172,112.5710323,26.84600064,112.5710232,26.84604221,112.5710128,26.84608957,112.5710037,26.84613087,112.5709946,26.84617214,112.5709854,26.8462134,112.5709763,26.84625465,112.5709672,26.84629582,112.570958,26.84633685,112.5709476,26.84638355,112.5709371,26.84642991,112.5709267,26.84647585,112.5709174,26.84651581,112.5709081,26.8465556,112.5708976,26.84659976,112.5708866,26.84664595,112.5708764,26.84668976,112.5708658,26.84673575,112.5708558,26.8467794,112.5708455,26.84682522,112.570836,26.84686882,112.570826,26.84691518,112.5708163,26.84696026,112.5708066,26.84700418,112.5707964,26.84705038,112.5707865,26.84709444,112.5707758,26.84714031,112.5707649,26.84718482,112.5707539,26.84722957,112.5707432,26.84727344,112.5707332,26.84731397,112.5707221,26.84735914,112.5707124,26.84739878,112.5707014,26.84744421,112.5706908,26.84748863,112.5706798,26.84753517,112.5706693,26.84757924,112.5706585,26.84762413,112.5706477,26.84766855,112.5706365,26.8477134,112.5706258,26.84775556,112.5706145,26.8477995,112.5706039,26.84784073,112.5705931,26.84788232,112.5705824,26.84792412,112.5705709,26.84796921,112.5705607,26.84800877,112.5705505,26.84804796,112.5705404,26.84808688,112.5705302,26.84812575,112.5705201,26.84816464,112.5705102,26.8482027,112.5704998,26.84824295,112.5704882,26.84828748,112.5704779,26.84832742,112.5704675,26.84836772,112.5704572,26.84840838,112.5704468,26.8484494,112.5704366,26.84848975,112.5704257,26.84853252,112.5704151,26.84857458,112.5704046,26.84861591,112.5703934,26.84865968,112.5703825,26.84870272,112.5703715,26.84874608,112.5703607,26.84878861,112.5703493,26.84883365,112.5703381,26.84887792,112.5703271,26.84892137,112.5703159,26.84896625,112.5703043,26.84901253,112.5702932,26.84905668,112.5702818,26.84910205,112.5702699,26.84914862,112.5702583,26.84919407,112.570248,26.84923387,112.5702366,26.84927827,112.5702249,26.84932388,112.5702129,26.84937066,112.5702026,26.84941056,112.570191,26.84945605,112.5701797,26.84950019,112.5701679,26.8495464,112.5701565,26.84959133,112.570145,26.84963618,112.570135,26.84967543,112.5701235,26.84972039,112.5701119,26.84976556,112.5701018,26.84980523,112.5700904,26.8498496,112.5700788,26.84989509,112.5700673,26.84994037,112.5700558,26.84998543,112.5700441,26.85003142,112.5700328,26.85007603,112.5700216,26.85012033,112.5700109,26.85016313,112.5699998,26.85020753,112.5699894,26.85024901,112.5699787,26.85029197,112.5699684,26.85033356,112.5699584,26.85037394,112.5699483,26.85041524,112.5699381,26.85045745,112.5699282,26.85049851,112.5699184,26.85053943,112.5699088,26.8505802,112.5698993,26.85062075,112.5698899,26.85066102,112.5698808,26.85070076,112.5698709,26.8507441,112.5698615,26.85078546,112.5698527,26.85082356,112.5698434,26.85086429,112.5698344,26.85090363,112.5698259,26.85094065,112.5698172,26.85097788,112.5698084,26.85101497,112.5698,26.85105005,112.5697919,26.85108314,112.5697842,26.8511138,112.5697767,26.85114401,112.5697686,26.85117697,112.5697602,26.85121048,112.5697515,26.85124505,112.5697425,26.85128118,112.5697337,26.8513163,112.5697242,26.85135425,112.5697152,26.8513906,112.5697064,26.85142572,112.5696974,26.85146147,112.5696879,26.85149941,112.5696783,26.85153659,112.5696681,26.85157572,112.5696578,26.85161485,112.5696472,26.8516542,112.5696371,26.85169159,112.5696266,26.85172999,112.5696155,26.85177033,112.5696046,26.85181023,112.5695929,26.85185299,112.5695823,26.85189162,112.5695719,26.85193022,112.569561,26.85197066,112.5695497,26.85201321,112.5695382,26.85205596,112.5695279,26.85209482,112.5695174,26.85213436,112.5695067,26.85217449,112.5694959,26.85221516,112.569485,26.85225633,112.5694743,26.85229688,112.5694633,26.85233886,112.5694524,26.85238113,112.5694413,26.85242466,112.5694308,26.8524661,112.5694198,26.85250956,112.5694092,26.85255178,112.5693988,26.85259279,112.569388,26.85263469,112.5693769,26.85267757,112.569366,26.8527194,112.5693554,26.85276025,112.5693443,26.85280333,112.5693334,26.85284558,112.5693225,26.85288805,112.5693117,26.85292966,112.5693002,26.85297363,112.5692891,26.85301569,112.5692777,26.85305902,112.569266,26.85310356,112.5692546,26.85314714,112.5692431,26.85319091,112.5692317,26.85323497,112.5692202,26.85327933,112.5692087,26.85332392,112.5691972,26.85336863,112.5691858,26.85341325,112.5691749,26.85345641,112.5691636,26.85350087,112.5691531,26.85354275,112.569143,26.85358335,112.5691331,26.85362307,112.5691222,26.85366725,112.5691124,26.85370644,112.5691027,26.85374561,112.569093,26.85378487,112.5690831,26.85382439,112.5690719,26.85386919,112.5690621,26.85390839,112.5690516,26.85395007,112.5690412,26.85399127,112.5690308,26.85403196,112.5690199,26.85407429,112.5690085,26.85411835,112.5689974,26.85416091,112.5689856,26.85420639,112.5689743,26.8542504,112.5689637,26.85429169,112.5689535,26.85433115,112.5689427,26.85437326,112.5689326,26.85441331,112.568922,26.8544548,112.568911,26.8544977,112.5689005,26.85453841,112.5688894,26.8545817,112.568879,26.85462277,112.5688678,26.85466638,112.5688567,26.85470901,112.5688457,26.8547519,112.5688345,26.85479502,112.5688235,26.8548371,112.5688122,26.85488059,112.5688006,26.85492545,112.5687893,26.85496911,112.5687782,26.85501151,112.5687664,26.85505634,112.568755,26.85509972,112.5687435,26.85514281,112.5687322,26.85518554,112.5687208,26.85522789,112.5687097,26.85526979,112.5686988,26.85531119,112.5686882,26.85535218,112.5686777,26.85539307,112.5686676,26.85543275,112.5686555,26.85548062,112.5686452,26.8555216,112.5686348,26.85556272,112.5686242,26.85560399,112.5686136,26.85564545,112.5686028,26.85568712,112.568592,26.855729,112.5685811,26.85577112,112.5685701,26.85581347,112.5685591,26.85585607,112.5685481,26.85589891,112.568537,26.85594198,112.5685261,26.85598526,112.5685154,26.85602751,112.568504,26.85607247,112.568493,26.85611635,112.5684822,26.85615918,112.5684712,26.85620345,112.5684604,26.85624665,112.5684487,26.85629386,112.568438,26.85633727,112.5684268,26.85638327,112.568416,26.85642808,112.5684053,26.85647302,112.5683947,26.85651807,112.5683842,26.85656321,112.5683738,26.85660839,112.5683637,26.85665351,112.568354,26.8566972,112.5683439,26.85674318,112.5683342,26.85678752,112.5683248,26.85683053,112.5683149,26.85687604,112.5683053,26.85692029,112.5682957,26.85696459,112.5682862,26.85700893,112.5682767,26.85705329,112.5682672,26.85709769,112.5682579,26.85714209,112.5682488,26.8571852,112.5682394,26.85723081,112.5682305,26.8572739,112.5682215,26.85731824,112.5682123,26.85736381,112.5682036,26.85740683,112.5681948,26.85745103,112.5681859,26.85749648,112.5681773,26.85754054,112.568169,26.85758313,112.5681604,26.8576279,112.568152,26.85767111,112.5681425,26.85772013,112.5681341,26.85776279,112.5681257,26.85780527,112.5681174,26.85784767,112.5681094,26.85788874,112.5681013,26.85793112,112.5680933,26.85797353,112.5680849,26.8580172,112.5680771,26.85805841,112.5680686,26.85810201,112.5680605,26.8581444,112.5680523,26.85818672,112.5680441,26.85822898,112.5680359,26.85827112,112.5680278,26.85831313,112.5680202,26.85835379,112.5680122,26.85839662,112.5680046,26.85843805,112.5679972,26.85847932,112.5679899,26.85852052,112.5679818,26.85856636,112.5679745,26.85860858,112.5679665,26.85865545,112.5679588,26.8587011,112.567951,26.85874787,112.5679442,26.85878995,112.5679376,26.85883087,112.5679301,26.85887767,112.5679228,26.85892331,112.5679156,26.85897016,112.5679081,26.85901824,112.5679019,26.85905934,112.5678958,26.85910045,112.5678899,26.85914155,112.5678832,26.85918852,112.5678766,26.85923428,112.5678697,26.85928233,112.5678631,26.85932918,112.5678564,26.859376,112.5678505,26.85941691,112.5678441,26.85946248,112.5678372,26.85951028,112.5678314,26.85955104,112.5678251,26.85959643,112.5678187,26.85964302,112.5678123,26.8596896,112.5678067,26.85973154,112.5678013,26.85977234,112.5677951,26.85981906,112.5677898,26.85986003,112.5677839,26.85990581,112.5677779,26.85995296,112.5677725,26.85999563,112.5677668,26.86004212,112.5677617,26.86008411,112.5677566,26.86012636,112.5677515,26.86017008,112.5677466,26.86021286,112.5677419,26.86025591,112.5677373,26.86029923,112.5677327,26.86034278,112.5677282,26.86038529,112.5677236,26.86043051,112.5677192,26.86047342,112.5677146,26.86051896,112.5677102,26.86056344,112.5677058,26.86060811,112.5677013,26.86065295,112.5676968,26.86069794,112.5676924,26.86074306,112.5676879,26.86078835,112.5676836,26.8608324,112.5676792,26.86087911,112.567675,26.86092323,112.5676707,26.86096996,112.5676667,26.86101413,112.5676625,26.86106091,112.5676586,26.86110507,112.5676547,26.86115052,112.5676509,26.86119722,112.5676471,26.86124256,112.5676436,26.86128659,112.5676401,26.86133193,112.5676365,26.86137856,112.567633,26.86142383,112.5676298,26.86146768,112.5676264,26.86151389,112.5676232,26.86155733,112.5676199,26.86160315,112.5676169,26.86164637,112.5676139,26.86169085,112.567611,26.8617353,112.5676082,26.86177972,112.5676055,26.8618241,112.567603,26.86186844,112.5676005,26.86191278,112.5675981,26.86195711,112.5675956,26.86200143,112.5675931,26.86204698,112.5675907,26.86209002,112.5675883,26.86213433,112.5675859,26.86217863,112.5675836,26.86222282,112.5675814,26.86226677,112.5675792,26.86231036,112.5675767,26.86236083,112.5675747,26.86240343,112.5675729,26.86244457,112.5675711,26.86248692,112.5675695,26.8625294,112.567568,26.8625734,112.5675665,26.86261653,112.5675649,26.86266005,112.5675634,26.86270397,112.5675619,26.86274699,112.5675604,26.8627929,112.5675589,26.86283793,112.5675573,26.86288327,112.5675557,26.86292896,112.5675542,26.86297495,112.5675527,26.86302126,112.5675513,26.8630665,112.5675498,26.86311466,112.5675484,26.86316171,112.567547,26.86320891,112.5675455,26.86325623,112.5675442,26.86330222,112.567543,26.86335091,112.567542,26.86339822,112.5675411,26.86344545,112.5675403,26.86349126,112.5675397,26.86353966,112.5675393,26.86358666,112.5675392,26.86363231,112.5675391,26.86368061,112.5675392,26.86372751,112.5675393,26.86377292,112.5675394,26.86381943,112.5675396,26.86386562,112.5675399,26.86391154,112.5675403,26.86395865,112.5675408,26.86400441,112.5675413,26.86405016,112.5675417,26.8640946,112.5675422,26.86414172,112.5675425,26.86418629,112.5675429,26.86423223,112.5675434,26.86427959,112.5675438,26.86432449,112.5675443,26.86437088,112.567545,26.86441879,112.5675456,26.86446553,112.5675463,26.86451242,112.567547,26.86455813,112.5675478,26.86460532,112.5675487,26.86465255,112.5675497,26.86469973,112.5675508,26.86474818,112.5675518,26.8647952,112.5675528,26.86484079,112.5675538,26.86488894,112.5675547,26.86493564,112.5675556,26.8649809,112.5675565,26.86502875,112.5675575,26.86507392,112.5675586,26.86512044,112.5675598,26.86516698,112.5675611,26.86521358,112.5675624,26.86526024,112.5675639,26.8653083,112.5675654,26.86535509,112.5675669,26.86540063,112.5675684,26.86544893,112.5675698,26.86549465,112.5675713,26.86554177,112.5675728,26.86558895,112.5675744,26.86563619,112.567576,26.86568345,112.5675777,26.86573073,112.5675794,26.86577797,112.5675811,26.86582519,112.5675828,26.86587235,112.5675845,26.86591946,112.5675862,26.86596643,112.5675879,26.86601314,112.5675896,26.86605953,112.5675914,26.86610556,112.5675931,26.8661511,112.5675948,26.86619611,112.5675965,26.86624066,112.5675981,26.86628506,112.5675997,26.86632938,112.5676012,26.8663736,112.5676026,26.86641774,112.567604,26.86646184,112.5676053,26.86650591,112.5676066,26.86654994,112.567608,26.86659387,112.5676093,26.86663766,112.5676107,26.86668755,112.5676122,26.86673861,112.5676135,26.86678214,112.5676148,26.86682564,112.5676161,26.86686787,112.5676175,26.86691253,112.5676188,26.86695465,112.5676203,26.86699922,112.5676217,26.86704242,112.5676234,26.86709151,112.5676248,26.86713429,112.5676263,26.867177,112.5676277,26.86721962,112.5676292,26.86726217,112.5676306,26.86730467,112.5676321,26.86734711,112.5676336,26.8673895,112.5676351,26.86743181,112.5676366,26.8674741,112.5676382,26.8675163,112.5676398,26.86755835,112.5676415,26.86760491,112.5676433,26.86765356,112.567645,26.86769974,112.5676466,26.86774824,112.5676482,26.86779427,112.5676499,26.86784246,112.5676513,26.86788327,112.5676529,26.86792937,112.5676544,26.86797508,112.567656,26.86801958,112.5676575,26.86806627,112.5676588,26.86811174,112.56766,26.86815602,112.5676612,26.86820255,112.5676624,26.86824785,112.5676636,26.86829295,112.5676648,26.86833755,112.567666,26.86838151,112.5676672,26.86842482,112.5676684,26.8684664,112.5676697,26.86850838,112.5676711,26.86855089,112.5676725,26.86859187,112.567674,26.86863133,112.5676758,26.86867703,112.5676775,26.8687205,112.5676792,26.86876492,112.567681,26.86881031,112.5676825,26.86884977,112.5676843,26.86889408,112.567686,26.86893806,112.5676878,26.86898149,112.5676896,26.86902318,112.5676916,26.86906601,112.5676934,26.8691061,112.5676951,26.86914758,112.5676967,26.86918727,112.5676983,26.86922862,112.5676999,26.86926787,112.5677015,26.86930793,112.5677032,26.86934797,112.5677049,26.86938941,112.5677064,26.86942616,112.5677079,26.86946374,112.5677094,26.86950196,112.5677106,26.86954073,112.5677116,26.86957671,112.5677125,26.86961395,112.5677133,26.86965285,112.5677139,26.86968931,112.5677145,26.86972855,112.5677152,26.8697684,112.5677158,26.86980514,112.5677164,26.86984473,112.5677172,26.8698842,112.567718,26.86992669,112.5677189,26.86996511,112.5677198,26.8700034,112.5677211,26.87004334,112.5677225,26.87008406,112.5677242,26.87012649,112.567726,26.8701677,112.5677276,26.87020653,112.5677294,26.87024957,112.5677313,26.87029304,112.5677331,26.8703369,112.5677348,26.87038102,112.5677365,26.87042525,112.567738,26.87046473,112.5677394,26.8705044,112.5677409,26.8705492,112.5677422,26.87058911,112.5677437,26.87063399,112.5677452,26.87067786,112.5677468,26.87072362,112.5677482,26.87076329,112.5677498,26.87080678,112.5677515,26.87085218,112.5677531,26.87089667,112.5677545,26.87093638,112.5677562,26.87098112,112.5677578,26.87102582,112.5677592,26.87107049,112.5677606,26.87111427,112.567762,26.87115923,112.5677631,26.87120044,112.5677642,26.87123993,112.5677654,26.87128176,112.5677665,26.87132284,112.5677676,26.8713641,112.5677689,26.87140948,112.5677702,26.87145066,112.5677716,26.87149177,112.5677732,26.87153386,112.5677748,26.87157488,112.5677765,26.87161593,112.5677786,26.8716622,112.5677808,26.87170338,112.5677835,26.87174867,112.5677865,26.87179597,112.5677896,26.87184229,112.5677925,26.87188359,112.5677954,26.87192509,112.5677982,26.8719657,112.5678013,26.87200843,112.5678045,26.87205014,112.5678077,26.87209078,112.5678113,26.87213258,112.567815,26.87217562,112.5678187,26.8722168,112.5678227,26.87225928,112.5678271,26.8723031,112.5678317,26.87234609,112.5678365,26.87238934,112.5678416,26.87243287,112.5678467,26.87247555,112.5678524,26.87252062,112.567858,26.87256366,112.5678641,26.87260796,112.5678706,26.87265354,112.5678773,26.87269815,112.5678839,26.8727407,112.5678915,26.87278791,112.567899,26.87283305,112.5679065,26.8728772,112.5679145,26.87292261,112.5679226,26.87296804,112.567931,26.87301448,112.5679391,26.87305842,112.5679478,26.87310415,112.5679564,26.87314812,112.5679649,26.87319042,112.5679736,26.87323363,112.5679826,26.87327784,112.5679916,26.87332101,112.5680006,26.87336323,112.5680102,26.87340774,112.5680196,26.87345008,112.5680296,26.8734945,112.5680396,26.87353764,112.5680496,26.87357952,112.5680603,26.87362338,112.5680708,26.87366498,112.5680817,26.87370763,112.5680931,26.87375136,112.5681043,26.87379404,112.5681154,26.87383572,112.5681271,26.87387854,112.5681393,26.87392248,112.5681511,26.87396431,112.5681637,26.87400834,112.5681759,26.87405007,112.5681886,26.8740926,112.5682013,26.87413495,112.5682144,26.87417813,112.5682272,26.87421989,112.56824,26.87426146,112.5682525,26.87430187,112.5682659,26.87434423,112.5682791,26.87438543,112.5682921,26.87442549,112.5683057,26.87446646,112.56832,26.87450832,112.568334,26.87454804,112.5683486,26.87458865,112.568364,26.87463007,112.5683791,26.87467028,112.5683941,26.87470935,112.56841,26.87475022,112.5684256,26.87478982,112.5684413,26.87482925,112.5684568,26.87486759,112.5684732,26.87490781,112.568489,26.87494607,112.5685057,26.87498631,112.5685218,26.87502462,112.5685388,26.87506496,112.5685556,26.87510438,112.5685721,26.87514287,112.5685892,26.8751824,112.5686068,26.87522304,112.568624,26.87526283,112.568641,26.87530174,112.5686592,26.87534279,112.568677,26.87538192,112.5686957,26.87542207,112.5687154,26.87546328,112.5687351,26.87550355,112.568755,26.87554395,112.5687746,26.87558345,112.5687955,26.87562508,112.5688159,26.87566582,112.5688355,26.87570463,112.5688567,26.87574661,112.568878,26.87578862,112.5688985,26.87582857,112.5689196,26.87586951,112.568941,26.87591038,112.5689627,26.87595119,112.5689853,26.87599293,112.569007,26.8760326,112.5690296,26.87607324,112.56905,26.8761098,112.5690701,26.87614531,112.5690904,26.87618078,112.5691108,26.87621621,112.5691343,26.87625667,112.5691573,26.87629595,112.5691788,26.87633201,112.5692021,26.87637086,112.5692267,26.87641147,112.5692478,26.87644601,112.5692713,26.87648445,112.5692954,26.87652374,112.5693195,26.87656287,112.5693444,26.87660277,112.5693688,26.87664153,112.5693928,26.87667913,112.5694177,26.8767176,112.5694428,26.87675601,112.5694681,26.87679436,112.5694934,26.8768325,112.5695192,26.87687128,112.5695444,26.87690883,112.5695692,26.87694517,112.5695956,26.87698314,112.5696213,26.8770199,112.5696464,26.87705539,112.569672,26.87709121,112.5696972,26.87712641,112.569723,26.87716213,112.5697476,26.8771959,112.5697728,26.87723028,112.5697986,26.87726528,112.5698239,26.8772992,112.5698491,26.87733279,112.5698735,26.87736502,112.5698982,26.87739742,112.5699227,26.87742931,112.5699511,26.87746567,112.5699759,26.87749705,112.5700034,26.87753144,112.5700292,26.87756355,112.5700572,26.87759807,112.5700836,26.87763027,112.5701094,26.87766161,112.5701346,26.87769192,112.5701602,26.87772271,112.5701894,26.87775754,112.5702175,26.8777908,112.5702444,26.8778225,112.5702724,26.87785521,112.570299,26.87788639,112.5703262,26.87791827,112.5703535,26.87795024,112.5703812,26.87798232,112.570409,26.87801452,112.5704378,26.87804762,112.5704656,26.87807942,112.5704943,26.87811207,112.5705239,26.87814573,112.57055,26.87817517,112.5705795,26.87820838,112.5706086,26.87824094,112.5706386,26.87827435,112.570666,26.87830487,112.5706921,26.87833411,112.5707197,26.87836502,112.5707467,26.8783954,112.570773,26.87842527,112.5708042,26.87846069,112.5708307,26.87849089,112.5708578,26.87852192,112.5708848,26.8785529,112.570912,26.87858398,112.5709392,26.87861513,112.5709665,26.87864642,112.5709939,26.87867787,112.5710219,26.8787103,112.5710486,26.87874138,112.5710768,26.87877439,112.5711043,26.87880694,112.571132,26.87883986,112.5711591,26.87887224,112.5711876,26.87890658,112.5712147,26.87893953,112.5712425,26.87897356,112.5712712,26.87900876,112.5712984,26.87904251,112.5713269,26.87907826,112.5713541,26.8791125,112.5713825,26.87914884,112.57141,26.87918475,112.5714367,26.8792201,112.571464,26.87925676,112.5714918,26.87929472,112.5715181,26.87933117,112.5715449,26.87936889,112.5715714,26.87940687,112.5715983,26.8794462,112.5716211,26.87948,112.5716464,26.87951792,112.5716723,26.87955689,112.5716984,26.87959697,112.5717229,26.87963516,112.5717477,26.87967437,112.5717729,26.87971472,112.5717972,26.87975423,112.5718185,26.8797889,112.5718396,26.87982372,112.5718608,26.87985863,112.5718819,26.87989362,112.571903,26.87992869,112.5719239,26.87996384,112.5719447,26.87999908,112.5719653,26.88003445,112.5719887,26.88007503,112.5720089,26.88011061,112.572029,26.88014626,112.5720489,26.88018204,112.5720709,26.88022205,112.5720934,26.88026317,112.5721136,26.8803002,112.572136,26.88034131,112.5721555,26.88037712,112.5721749,26.88041272,112.5721961,26.88045213,112.5722175,26.8804922,112.572239,26.88053295,112.5722596,26.88057256,112.5722793,26.88061094,112.5722997,26.88065126,112.5723193,26.88069069,112.5723382,26.88072932,112.5723575,26.88076921,112.5723772,26.88081047,112.5723963,26.88085103,112.5724146,26.88089089,112.5724336,26.88093314,112.5724515,26.88097353,112.5724694,26.88101512,112.5724872,26.88105683,112.5725052,26.88109967,112.5725227,26.8811415,112.5725395,26.88118231,112.572557,26.88122519,112.5725734,26.88126585,112.5725904,26.88130857,112.5726065,26.88134921,112.5726229,26.88139095,112.5726396,26.88143384," + val trackStr1 = "112.5726552,26.88147476,112.5726711,26.88151689,112.5726866,26.8815592,112.5727023,26.88160268,112.5727169,26.88164415,112.5727321,26.88168776,112.5727464,26.88173044,112.57276,26.88177213,112.5727736,26.88181505,112.5727873,26.88185923,112.5728003,26.8819025,112.5728126,26.88194482,112.5728253,26.88198937,112.572837,26.88203166,112.5728489,26.88207502,112.5728608,26.88211844,112.5728729,26.882163,112.5728846,26.88220661,112.5728961,26.88224934,112.5729081,26.88229451,112.5729196,26.88233889,112.572931,26.88238354,112.5729418,26.88242734,112.5729529,26.88247365,112.5729622,26.88251337,112.5729727,26.88255892,112.5729816,26.88259894,112.5729912,26.88264369,112.5730007,26.8826898,112.5730102,26.88273723,112.5730191,26.8827836,112.5730274,26.88282886,112.5730357,26.88287527,112.573043,26.88291695,112.5730506,26.88296203,112.5730574,26.8830035,112.5730637,26.88304359,112.5730707,26.88308921,112.5730772,26.88313361,112.5730837,26.88318019,112.5730898,26.88322456,112.5730956,26.88327006,112.573101,26.88331559,112.573106,26.8833612,112.5731108,26.88340803,112.5731151,26.88345264,112.5731193,26.88349962,112.5731233,26.88354552,112.573127,26.88359032,112.5731309,26.88363636,112.5731351,26.8836824,112.5731394,26.8837294,112.573143,26.88377382,112.5731465,26.88382025,112.5731496,26.88386438,112.5731524,26.88390964,112.5731552,26.88395614,112.5731577,26.88400177,112.57316,26.88404771,112.5731619,26.88409275,112.5731635,26.88414031,112.5731646,26.88418646,112.5731655,26.88422689,112.5731662,26.88426731,112.573167,26.88431228,112.5731677,26.88435821,112.5731684,26.8844051,112.573169,26.88444973,112.5731696,26.88449555,112.5731703,26.88454143,112.5731709,26.88458853,112.5731715,26.88463453,112.5731721,26.88467941,112.5731728,26.88472542,112.5731736,26.88477119,112.5731744,26.88481672,112.5731753,26.88486222,112.5731762,26.88490886,112.5731771,26.88495433,112.5731779,26.8849986,112.5731787,26.88504505,112.5731794,26.88509026,112.5731799,26.88513432,112.5731805,26.8851807,112.5731811,26.88522601,112.5731816,26.88526913,112.573182,26.8853157,112.5731824,26.8853622,112.5731827,26.88540748,112.573183,26.88545269,112.5731833,26.88549665,112.5731835,26.88554242,112.5731839,26.885587,112.5731845,26.88563051,112.5731855,26.8856763,112.5731867,26.88571988,112.5731879,26.88576573,112.5731892,26.88580938,112.5731906,26.88585532,112.573192,26.88590019,112.5731937,26.88594398,112.5731957,26.8859888,112.5731981,26.88603332,112.5732009,26.88607752,112.5732041,26.88612163,112.5732075,26.88616681,112.5732105,26.88620981,112.5732134,26.886254,112.573216,26.8862994,112.5732182,26.88634383,112.5732201,26.88638838,112.573222,26.88643187,112.5732235,26.8864765,112.5732247,26.88652111,112.5732257,26.8865668,112.5732264,26.88661012,112.5732272,26.88665429,112.5732279,26.8866991,112.5732287,26.88674112,112.5732294,26.88678376,112.5732302,26.88682736,112.5732311,26.88686979,112.573232,26.88691107,112.5732329,26.88695441,112.5732338,26.88699665,112.5732348,26.88703772,112.5732358,26.88707964,112.5732369,26.88712224,112.5732379,26.88716342,112.5732389,26.88720337,112.57324,26.88724526,112.5732411,26.88728608,112.5732423,26.88732683,112.5732435,26.88737261,112.5732447,26.88741327,112.573246,26.88745799,112.5732472,26.88749974,112.5732483,26.88754058,112.5732495,26.88758659,112.5732505,26.88762748,112.5732515,26.88766725,112.5732527,26.88771383,112.5732537,26.88775403,112.5732548,26.88779323,112.5732559,26.88783443,112.573257,26.88787467,112.5732581,26.88791397,112.5732592,26.88795426,112.5732604,26.88799539,112.5732615,26.8880351,112.5732628,26.88807811,112.5732642,26.88812219,112.5732656,26.88816439,112.5732669,26.88820476,112.5732681,26.88824514,112.5732693,26.88828462,112.5732704,26.88832748,112.5732712,26.88836919,112.573272,26.88841039,112.573273,26.88845229,112.5732744,26.88849209,112.5732763,26.88853272,112.5732786,26.8885709,112.5732813,26.88860951,112.5732843,26.88864863,112.5732876,26.88868959,112.5732905,26.88872781,112.5732929,26.88876477,112.5732951,26.88880399,112.5732967,26.88884312,112.573298,26.88888136,112.5732992,26.88892276,112.5733003,26.8889593,112.5733014,26.88899739,112.5733025,26.8890355,112.5733035,26.88907108,112.5733047,26.88910874,112.5733058,26.88914569,112.5733066,26.88917961,112.5733074,26.88921312,112.5733083,26.88924725,112.5733091,26.88928032,112.5733103,26.88931571,112.5733115,26.88934913,112.5733125,26.88938455,112.5733134,26.88941967,112.5733143,26.8894553,112.5733152,26.88949305,112.573316,26.88953007,112.5733168,26.88956712,112.5733176,26.88960438,112.5733185,26.88964099,112.5733192,26.88967683,112.5733199,26.8897127,112.5733206,26.88974841,112.5733212,26.88978519,112.5733219,26.88982266,112.5733226,26.88985869,112.5733237,26.88989748,112.5733249,26.88993489,112.5733263,26.88997389,112.5733277,26.8900134,112.573329,26.8900502,112.5733303,26.89008916,112.5733317,26.89012966,112.5733332,26.89017157,112.5733347,26.89021087,112.5733361,26.89025122,112.5733373,26.89029287,112.5733381,26.89033146,112.5733386,26.89037135,112.5733389,26.89040761,112.5733389,26.89044447,112.5733388,26.89048254,112.5733387,26.89051882,112.5733386,26.89055676,112.5733386,26.8905955,112.5733387,26.89063273,112.5733388,26.89067132,112.5733391,26.89071264,112.5733393,26.89075182,112.5733397,26.89079314,112.5733402,26.89083474,112.5733409,26.89087733,112.5733415,26.89091545,112.5733423,26.89096038,112.5733432,26.8910007,112.5733441,26.89104087,112.573345,26.89108273,112.5733458,26.89112539,112.5733466,26.89116976,112.5733473,26.89121255,112.5733479,26.89125243,112.5733484,26.89129414,112.573349,26.89133951,112.5733495,26.89138274,112.5733501,26.89142482,112.5733507,26.89146856,112.5733513,26.89150994,112.573352,26.89155147,112.5733526,26.89159204,112.5733532,26.89163237,112.5733538,26.89167485,112.5733543,26.89171622,112.5733548,26.89175582,112.5733552,26.89179554,112.5733555,26.89183582,112.5733557,26.89187439,112.5733559,26.89191337,112.5733562,26.89195256,112.5733565,26.89199002,112.5733569,26.89203278,112.5733573,26.89207054,112.5733578,26.89210966,112.5733582,26.89214979,112.5733586,26.89219126,112.5733589,26.89223355,112.5733593,26.89227699,112.5733597,26.89231949,112.5733601,26.89236064,112.5733606,26.89240248,112.5733612,26.89244543,112.5733618,26.89248381,112.5733625,26.89252191,112.5733633,26.89256242,112.573364,26.89260178,112.5733649,26.89264348,112.5733658,26.89268478,112.5733666,26.89272566,112.5733673,26.89276889,112.573368,26.89281071,112.5733688,26.89285489,112.5733695,26.89289371,112.5733705,26.89293683,112.5733713,26.8929815,112.5733722,26.89302808,112.5733729,26.89306938,112.5733733,26.89311028,112.5733737,26.89315388,112.5733739,26.89319699,112.573374,26.89323947,112.5733742,26.89328454,112.5733746,26.89332775,112.5733751,26.89337233,112.5733757,26.89341704,112.5733763,26.89346293,112.573377,26.89350663,112.5733776,26.8935515,112.573378,26.89359639,112.5733785,26.89364237,112.5733789,26.89368712,112.5733794,26.8937306,112.5733801,26.89377614,112.5733808,26.89382037,112.5733815,26.89386435,112.5733822,26.89390691,112.573383,26.89395145,112.5733837,26.89399472,112.5733844,26.89403673,112.5733851,26.89407956,112.5733857,26.89412318,112.5733862,26.89416548,112.5733868,26.89420647,112.5733873,26.8942483,112.5733878,26.89428988,112.5733883,26.89433615,112.5733888,26.8943777,112.5733893,26.89441781,112.5733899,26.89446164,112.5733907,26.89450614,112.5733915,26.89455137,112.5733923,26.89459049,112.5733931,26.89463334,112.5733939,26.89467329,112.5733947,26.89471224,112.5733956,26.89475591,112.5733964,26.89479847,112.5733971,26.89484176,112.5733979,26.89488484,112.5733985,26.89492867,112.5733989,26.8949712,112.5733991,26.89501312,112.5733994,26.89505325,112.5733996,26.89509321,112.5733999,26.89513677,112.5734002,26.89517651,112.5734006,26.89521431,112.573401,26.89525288,112.5734013,26.89529152,112.5734017,26.89533116,112.5734021,26.89536936,112.5734025,26.89540959,112.5734029,26.89545278,112.5734034,26.89549274,112.5734039,26.89553381,112.5734043,26.89557331,112.5734049,26.89561481,112.5734053,26.89565445,112.5734057,26.89569472,112.5734059,26.89573454,112.5734062,26.8957736,112.5734064,26.89581245,112.5734065,26.89585335,112.5734066,26.89589289,112.5734068,26.89593014,112.573407,26.89596891,112.5734072,26.89600663,112.5734071,26.89604329,112.5734065,26.89607874,112.5734033,26.8961115,112.5733885,26.89614048,112.5733594,26.89615626,112.5733261,26.89616072,112.5732919,26.89616149,112.5732556,26.89616183,112.573221,26.89616196,112.5731862,26.89616097,112.5731528,26.89615707,112.57312,26.89614683,112.5730933,26.89612524,112.5730807,26.89609266,112.5730791,26.89605794,112.5730796,26.89602181,112.5730799,26.89598458,112.57308,26.89594866,112.5730801,26.89591138,112.5730804,26.89586999,112.5730807,26.89583017,112.5730809,26.89579278,112.5730809,26.89575293,112.5730811,26.89571153,112.5730813,26.89566893,112.5730815,26.89562531,112.5730817,26.89558522,112.5730818,26.89554443,112.5730816,26.89550201,112.5730812,26.89546086,112.5730807,26.89541728,112.5730801,26.89537506,112.5730794,26.89533041,112.5730788,26.89528732,112.5730781,26.89524696,112.5730773,26.89520359,112.5730763,26.89515832,112.5730753,26.89511534,112.5730741,26.895072,112.573073,26.89502936,112.573072,26.89498744,112.573071,26.89494533,112.5730702,26.89490572,112.5730693,26.89486505,112.5730684,26.89482173,112.5730676,26.89478014,112.573067,26.89473705,112.5730666,26.8946958,112.5730665,26.8946542,112.5730664,26.89461166,112.5730661,26.89456982,112.5730655,26.8945277,112.5730648,26.89448509,112.5730641,26.89444724,112.5730633,26.89440734,112.5730627,26.8943688,112.5730623,26.89432806,112.573062,26.89428862,112.5730619,26.89424679,112.5730619,26.89420622,112.5730619,26.89416428,112.5730617,26.894122,112.5730614,26.89407948,112.5730611,26.89403586,112.5730608,26.89399505,112.5730604,26.89395071,112.57306,26.89390857,112.5730596,26.89386637,112.5730592,26.89382411,112.5730588,26.89378642,112.5730584,26.89374473,112.5730579,26.89370185,112.5730574,26.89365882,112.5730569,26.89361566,112.5730563,26.89357237,112.5730557,26.89352906,112.5730552,26.89348503,112.5730547,26.89344298,112.5730542,26.89339899,112.5730537,26.89335682,112.5730532,26.89331263,112.5730527,26.89326926,112.5730523,26.8932269,112.5730518,26.89318296,112.5730513,26.89314193,112.5730508,26.89309986,112.5730501,26.89305483,112.5730493,26.89301059,112.5730485,26.89296809,112.5730477,26.89292827,112.5730469,26.89288538,112.5730462,26.89284648,112.5730456,26.89280284,112.5730449,26.89275812,112.5730442,26.89271515,112.5730434,26.89267005,112.5730426,26.89262685,112.5730418,26.89258263,112.5730412,26.89253851,112.5730411,26.89249867,112.5730408,26.89245598,112.5730404,26.89241124,112.57304,26.89236733,112.5730397,26.89232821,112.5730395,26.8922852,112.5730393,26.89224026,112.573039,26.89219719,112.5730386,26.89215689,112.5730382,26.89211347,112.5730377,26.89206894,112.5730371,26.89202329,112.5730364,26.89198359,112.5730357,26.89194406,112.5730348,26.89190081,112.573034,26.89186042,112.5730331,26.89181692,112.5730323,26.89177132,112.5730315,26.89172754,112.5730306,26.89168257,112.5730298,26.8916364,112.5730292,26.8915963,112.5730286,26.89155153,112.573028,26.89151226,112.5730275,26.89146971,112.5730269,26.89142553,112.5730263,26.89138216,112.5730257,26.89134344,112.5730252,26.8913007,112.5730247,26.89125681,112.5730242,26.89121279,112.5730237,26.89116805,112.5730232,26.89112542,112.5730228,26.89108565,112.5730222,26.89104309,112.5730216,26.891,112.573021,26.89095657,112.5730204,26.89091571,112.5730197,26.89087365,112.573019,26.89083393,112.5730182,26.89079307,112.5730175,26.89075464,112.5730167,26.89071179,112.5730158,26.890669,112.573015,26.89062799,112.5730143,26.8905879,112.5730137,26.89054827,112.5730132,26.89050954,112.5730129,26.89047035,112.5730126,26.89043179,112.5730124,26.89039326,112.5730124,26.89035626,112.5730126,26.8903165,112.5730128,26.89027831,112.5730131,26.89023978,112.5730135,26.89020133,112.5730142,26.89016195,112.573015,26.8901229,112.573016,26.89008347,112.5730169,26.8900436,112.5730175,26.89000409,112.5730179,26.88996363,112.573018,26.88992305,112.573018,26.88988251,112.5730178,26.88984153,112.5730175,26.88980195,112.5730172,26.889763,112.5730168,26.88972426,112.5730164,26.88968621,112.5730159,26.8896472,112.5730156,26.8896077,112.5730153,26.88956763,112.5730149,26.8895263,112.573015,26.88948602,112.5730154,26.88944825,112.5730163,26.88941028,112.5730175,26.88937211,112.5730192,26.88933369,112.5730211,26.88929501,112.5730231,26.88925521,112.5730251,26.88921664,112.5730272,26.88917695,112.5730293,26.88913726,112.5730312,26.88909752,112.5730329,26.88905761,112.5730342,26.88901694,112.5730351,26.88897695,112.5730358,26.88893662,112.5730363,26.88889578,112.5730366,26.88885506,112.5730368,26.88881282,112.5730368,26.88877344,112.5730367,26.88873567,112.5730363,26.88869385,112.5730358,26.88865167,112.5730355,26.88861355,112.5730352,26.88857604,112.5730353,26.88853783,112.573036,26.88850285,112.5730381,26.8884678,112.5730414,26.88843287,112.5730459,26.88839641,112.5730501,26.88836049,112.5730538,26.88832288,112.5730569,26.8882834,112.5730593,26.88824441,112.5730612,26.88820407,112.5730624,26.88816653,112.5730632,26.88812675,112.5730636,26.88808468,112.5730638,26.88804298,112.5730638,26.88800383,112.5730637,26.8879638,112.5730636,26.88792198,112.5730633,26.88788025,112.573063,26.88783868,112.5730628,26.88779446,112.5730627,26.88775538,112.5730626,26.88771081,112.5730625,26.88767077,112.5730624,26.88763149,112.5730622,26.8875858,112.5730618,26.88754374,112.5730614,26.88750332,112.5730609,26.88746145,112.5730603,26.88741917,112.5730596,26.8873754,112.573059,26.88733334,112.5730582,26.88728878,112.5730574,26.88724606,112.5730566,26.88720198,112.5730558,26.88715766,112.573055,26.88711198,112.5730542,26.88706716,112.5730535,26.88702326,112.5730528,26.88697691,112.5730521,26.88693149,112.5730515,26.88688703,112.5730509,26.88684114,112.5730503,26.88679492,112.5730497,26.886753,112.5730491,26.88670608,112.5730486,26.88666481,112.573048,26.88661866,112.5730474,26.88657015,112.5730468,26.88652287,112.5730463,26.8864815,112.5730457,26.88643422,112.5730451,26.8863882,112.5730444,26.88634004,112.5730438,26.88629326,112.5730432,26.88624779,112.5730427,26.88620128,112.5730422,26.88615365,112.5730418,26.886113,112.5730414,26.88607235,112.5730409,26.88603171,112.5730404,26.88599109,112.5730399,26.88594474,112.5730393,26.88590428,112.5730388,26.88585928,112.5730381,26.88581315,112.5730375,26.88576584,112.573037,26.8857254,112.5730363,26.88568022,112.5730356,26.88563363,112.5730349,26.88558562,112.5730342,26.88554445,112.5730335,26.88550318,112.5730328,26.88546189,112.5730319,26.88541473,112.5730311,26.88537343,112.5730303,26.88533212,112.5730294,26.88529089,112.5730285,26.88524512,112.5730277,26.88519833,112.5730271,26.88515065,112.5730267,26.88511019,112.5730263,26.88506425,112.573026,26.88502088,112.5730257,26.88497335,112.5730256,26.88492856,112.5730256,26.88488519,112.5730258,26.88484095,112.5730259,26.88479582,112.5730259,26.88475206,112.5730256,26.88470963,112.5730251,26.88466503,112.5730246,26.88462156,112.5730239,26.88457918,112.5730232,26.88453565,112.5730224,26.88449103,112.5730216,26.8844475,112.5730207,26.88440509,112.5730197,26.88436157,112.5730186,26.88431671,112.5730174,26.88427269,112.5730161,26.8842295,112.5730145,26.8841838,112.5730127,26.88413884,112.5730109,26.88409464,112.573009,26.884049,112.573007,26.88400193,112.5730051,26.8839615,112.5730028,26.883915,112.5730006,26.88387428,112.5729984,26.88383342,112.5729959,26.88379245,112.5729932,26.8837514,112.5729903,26.88371044,112.5729871,26.88366959,112.5729834,26.88362416,112.5729793,26.88357766,112.5729748,26.88353023,112.5729708,26.8834899,112.5729666,26.88344952,112.5729623,26.88340907,112.5729577,26.88336862,112.5729529,26.88332817,112.5729479,26.8832878,112.5729426,26.88324749,112.572937,26.88320728,112.5729312,26.88316723,112.5729244,26.88312256,112.5729171,26.8830766,112.5729094,26.88303051,112.5729012,26.88298303,112.572894,26.88294231,112.5728871,26.88290217,112.5728796,26.8828595,112.572872,26.88281792,112.5728644,26.88277586,112.5728569,26.88273482,112.5728484,26.88269156,112.5728399,26.88264966,112.5728312,26.88260788,112.572822,26.88256629,112.5728127,26.88252487,112.572803,26.88248338,112.5727931,26.88244204,112.5727834,26.88240206,112.5727731,26.88236009,112.572763,26.88231966,112.5727512,26.88227392,112.5727396,26.88222985,112.5727291,26.88219079,112.5727169,26.88214677,112.5727042,26.88210204,112.572692,26.8820596,112.5726793,26.88201625,112.5726665,26.88197324,112.5726533,26.88192965,112.5726405,26.88188865,112.5726268,26.88184561,112.5726132,26.8818036,112.5725997,26.88176259,112.5725855,26.88172043,112.5725707,26.8816771,112.5725565,26.8816358,112.5725415,26.88159334,112.5725264,26.88155081,112.572511,26.88150823,112.5724954,26.8814657,112.5724795,26.88142339,112.5724634,26.8813813,112.5724465,26.8813382,112.57243,26.88129717,112.5724129,26.88125502,112.5723955,26.88121281,112.5723774,26.88116959,112.5723601,26.8811287,112.5723417,26.88108614,112.5723237,26.88104504,112.5723062,26.88100556,112.5722884,26.88096593,112.5722703,26.88092599,112.5722526,26.88088738,112.5722353,26.88085008,112.5722176,26.88081218,112.5721995,26.8807741,112.572182,26.88073772,112.5721629,26.88069858,112.5721449,26.88066292,112.5721255,26.88062533,112.5721058,26.88058778,112.5720862,26.88055066,112.5720664,26.88051342,112.5720459,26.88047514,112.5720259,26.88043827,112.5720047,26.88039948,112.5719839,26.88036225,112.5719622,26.88032409,112.5719404,26.88028602,112.5719179,26.88024716,112.5718961,26.88020984,112.5718754,26.88017492,112.5718528,26.88013739,112.5718313,26.8801023,112.5718101,26.88006792,112.571789,26.88003419,112.5717638,26.87999408,112.5717419,26.87995981,112.5717189,26.87992442,112.5716948,26.8798879,112.5716709,26.87985208,112.5716472,26.87981711,112.571622,26.87978042,112.571597,26.87974467,112.5715723,26.8797097,112.5715467,26.87967372,112.5715206,26.8796376,112.5714936,26.87960038,112.5714675,26.87956482,112.5714407,26.87952843,112.5714134,26.87949148,112.5713876,26.87945693,112.5713616,26.87942227,112.5713353,26.87938759,112.5713099,26.87935455,112.5712856,26.87932296,112.5712568,26.8792859,112.5712316,26.87925359,112.5712068,26.87922198,112.571181,26.87918931,112.5711542,26.87915546,112.5711282,26.87912288,112.571101,26.87908911,112.5710725,26.87905404,112.5710447,26.8790202,112.5710158,26.87898511,112.5709866,26.87894977,112.5709565,26.87891343,112.5709276,26.87887888,112.5708978,26.87884366,112.5708673,26.87880792,112.5708378,26.87877355,112.5708093,26.87874059,112.5707796,26.87870656,112.570751,26.87867398,112.570723,26.87864244,112.5706941,26.87861029,112.5706641,26.87857742,112.5706344,26.87854533,112.5706052,26.878514,112.5705752,26.87848191,112.570545,26.87844992,112.5705142,26.87841731,112.5704852,26.87838658,112.5704558,26.87835547,112.5704261,26.87832404,112.5703985,26.87829459,112.5703672,26.87826116,112.5703368,26.87822827,112.5703064,26.87819522,112.5702777,26.87816376,112.5702477,26.87813063,112.570219,26.87809865,112.5701894,26.87806568,112.5701592,26.87803168,112.5701329,26.87800179,112.5701039,26.87796856,112.5700766,26.87793705,112.5700499,26.87790587,112.5700237,26.87787493,112.569996,26.87784169,112.5699686,26.8778085,112.5699416,26.87777537,112.5699135,26.87774068,112.5698846,26.8777044,112.5698576,26.87767022,112.5698286,26.87763295,112.5698002,26.87759619,112.5697744,26.87756276,112.5697462,26.87752631,112.5697199,26.87749247,112.5696942,26.87745934,112.5696691,26.87742689,112.5696431,26.87739326,112.5696164,26.87735855,112.5695906,26.87732475,112.569565,26.87729089,112.5695402,26.87725792,112.5695106,26.87721804,112.5694856,26.87718389,112.5694607,26.87714969,112.569436,26.87711554,112.5694115,26.87708153,112.5693874,26.87704768,112.5693611,26.8770101,112.5693345,26.87697143,112.5693076,26.87693169,112.5692849,26.87689765,112.5692599,26.87685958,112.5692347,26.87682032,112.5692129,26.87678588,112.5691882,26.8767465,112.5691633,26.87670629,112.5691402,26.87666829,112.5691169,26.87662984,112.569094,26.87659195,112.5690706,26.8765532,112.5690484,26.87651636,112.5690252,26.87647757,112.5690028,26.8764397,112.5689811,26.87640275,112.5689591,26.87636474,112.5689367,26.87632568,112.568915,26.8762874,112.568894,26.8762499,112.5688728,26.87621139,112.5688515,26.87617194,112.5688316,26.87613461,112.5688116,26.87609641,112.5687913,26.87605717,112.5687715,26.87601885,112.5687522,26.87598143,112.5687323,26.87594291,112.5687123,26.87590424,112.5686917,26.87586442,112.568672,26.87582637,112.5686514,26.87578619,112.5686319,26.8757478,112.568612,26.87570831,112.5685921,26.87566873,112.568572,26.87562808,112.5685524,26.87558833,112.5685336,26.87554945,112.5685142,26.87550855,112.5684958,26.8754687,112.5684783,26.87542992,112.5684608,26.87539031,112.5684435,26.87535077,112.5684264,26.87531125,112.5684095,26.87527174,112.5683928,26.87523232,112.5683759,26.87519204,112.5683599,26.87515375,112.5683436,26.87511442,112.5683268,26.87507399,112.568311,26.87503544,112.5682949,26.87499591,112.568279,26.87495635,112.5682629,26.8749157,112.5682473,26.87487598,112.5682324,26.87483724,112.5682169,26.87479641,112.5682019,26.87475651,112.5681875,26.87471759,112.568173,26.87467768,112.5681584,26.87463682,112.5681444,26.87459696,112.5681311,26.87455821,112.5681179,26.87451876,112.5681048,26.87447884,112.5680927,26.8744415,112.5680788,26.87439836,112.5680659,26.874358,112.5680528,26.87431705,112.5680408,26.87427962,112.5680289,26.87424188,112.568016,26.87420139,112.5680032,26.87416169,112.56799,26.87412103,112.5679778,26.8740834,112.5679648,26.87404224,112.5679536,26.87400567,112.5679423,26.87396694,112.5679319,26.87392933,112.5679214,26.87389029,112.5679109,26.87384999,112.567901,26.87381101,112.5678909,26.87376984,112.5678812,26.87373004,112.567871,26.87368804,112.5678611,26.87364741,112.5678508,26.87360523,112.5678402,26.87356236,112.5678304,26.87352268,112.5678211,26.87348436,112.5678103,26.87343955,112.5678007,26.87339815,112.5677916,26.87335822,112.5677825,26.87331672,112.5677733,26.87327368,112.5677649,26.87323236,112.5677563,26.87318953,112.5677481,26.87314629,112.5677399,26.87310163,112.5677323,26.87305885,112.5677249,26.87301482,112.5677177,26.87296977,112.5677112,26.8729271,112.5677047,26.87288338,112.5676982,26.87283962,112.5676916,26.87279458,112.5676853,26.87275153,112.5676788,26.87270728,112.5676724,26.87266312,112.5676659,26.87261775,112.5676599,26.87257434,112.5676537,26.87252853,112.5676479,26.87248363,112.5676424,26.87243961,112.5676371,26.87239419,112.5676319,26.87234731,112.5676275,26.87230706,112.5676225,26.87226078,112.5676182,26.87222008,112.5676139,26.87217914,112.5676096,26.87213798,112.5676051,26.87209184,112.5676007,26.87204309,112.5675971,26.87200134,112.5675937,26.87196062,112.5675905,26.8719185,112.5675875,26.87187621,112.5675849,26.87183377,112.5675826,26.87179121,112.5675808,26.87174733,112.5675795,26.87170582,112.5675783,26.87166177,112.5675774,26.87162009,112.5675765,26.87157093,112.5675757,26.87152664,112.5675747,26.87148478,112.5675736,26.87144041,112.5675724,26.87139718,112.5675711,26.87135386,112.5675699,26.87131048,112.5675688,26.87126725,112.5675673,26.87122412,112.5675654,26.8711811,112.5675634,26.87113938,112.5675611,26.87109529,112.567559,26.87105253,112.5675571,26.87100987,112.5675554,26.87096736,112.5675537,26.87092512,112.567552,26.87087727,112.5675504,26.87083084,112.5675488,26.87078346,112.5675474,26.87073649,112.5675462,26.87069473,112.5675448,26.87064901,112.5675435,26.87060517,112.5675421,26.87056099,112.5675407,26.87051645,112.5675395,26.8704748,112.5675383,26.87043287,112.567537,26.87039053,112.5675358,26.87034983,112.5675346,26.87031065,112.5675331,26.87026466,112.5675317,26.87022081,112.5675299,26.87017502,112.5675282,26.87013109,112.5675264,26.87009001,112.5675247,26.87004982,112.5675232,26.87001052,112.5675214,26.8699641,112.5675199,26.86992484,112.5675183,26.86988464,112.5675165,26.86984338,112.5675144,26.86979907,112.5675123,26.86975781,112.5675103,26.8697176,112.5675084,26.86967842,112.5675064,26.86963225,112.5675048,26.8695931,112.567503,26.86954786,112.5675014,26.86950648,112.5675001,26.86946691,112.5674988,26.86942606,112.5674976,26.86938392,112.5674965,26.86934351,112.5674954,26.86930177,112.5674943,26.86925977,112.5674932,26.86921749,112.5674921,26.86917495,112.567491,26.86913224,112.5674898,26.86908935,112.5674886,26.86904525,112.5674874,26.86900313,112.5674863,26.86895978,112.5674852,26.8689163,112.567484,26.86887162,112.5674827,26.86882903,112.5674813,26.86878515,112.5674798,26.86873992,112.5674783,26.86869666,112.5674766,26.86865197,112.5674749,26.86860584,112.5674731,26.8685605,112.5674712,26.868516,112.5674694,26.86847009,112.5674675,26.86842391,112.5674659,26.86838218,112.5674642,26.86834152,112.5674626,26.86830078,112.5674609,26.86825999,112.5674592,26.86821914,112.5674574,26.86817355,112.5674555,26.86812672,112.5674536,26.86807979,112.5674518,26.86803165,112.5674501,26.86799053,112.5674485,26.86794938,112.5674468,26.86790817,112.567445,26.86786215,112.5674431,26.86781487,112.5674412,26.86776628,112.5674395,26.86771875,112.5674379,26.86767233,112.5674362,26.86762341,112.5674346,26.86757562,112.5674331,26.86752895,112.5674315,26.86748102,112.5674298,26.86743174,112.5674284,26.8673908,112.567427,26.86734857,112.5674256,26.86730509,112.5674242,26.86726398,112.5674228,26.8672216,112.5674214,26.86717915,112.56742,26.86713666,112.5674185,26.86709288,112.567417,26.86705026,112.5674156,26.86700761,112.5674142,26.86696616,112.5674127,26.86692347,112.5674112,26.86687958,112.5674097,26.86683694,112.5674082,26.86679552,112.5674066,26.86675284,112.5674051,26.86671013,112.5674036,26.86666735,112.567402,26.8666245,112.5674003,26.86658036,112.5673988,26.86653862,112.5673972,26.86649561,112.5673955,26.86645253,112.5673936,26.86640201,112.567392,26.86635884,112.56739,26.86630946,112.5673881,26.86626128,112.5673862,26.86621183,112.5673844,26.86616862,112.5673828,26.86612551,112.5673811,26.86608121,112.5673795,26.86603937,112.5673779,26.86599629,112.5673764,26.8659532,112.567375,26.86591009,112.5673736,26.86586696,112.567372,26.86582258,112.5673705,26.86578066,112.5673689,26.86573754,112.567367,26.86569438,112.5673651,26.86565124,112.5673632,26.86560809,112.5673614,26.86556491,112.5673597,26.86552172,112.567358,26.8654711,112.5673566,26.8654279,112.5673553,26.86538593,112.567354,26.86534148,112.5673527,26.86529826,112.5673513,26.86525503,112.5673501,26.86521301,112.5673488,26.86516974,112.5673475,26.86512644,112.5673463,26.86508189,112.5673452,26.8650398,112.567344,26.86499649,112.5673427,26.86495199,112.5673416,26.86490877,112.5673405,26.86486555,112.5673396,26.86482358,112.5673386,26.86478042,112.5673378,26.8647373,112.5673369,26.86469429,112.5673361,26.86465025,112.5673354,26.86460882,112.5673348,26.86456629,112.5673343,26.86452384,112.5673338,26.86448017,112.5673334,26.86443894,112.5673331,26.86439528,112.5673328,26.86435283,112.5673325,26.86431159,112.5673322,26.86426913,112.5673319,26.86422543,112.5673317,26.86418416,112.5673316,26.86414044,112.5673315,26.86409911,112.5673315,26.86405653,112.5673316,26.86401274,112.5673317,26.86397137,112.5673318,26.86392876,112.567332,26.86388614,112.5673321,26.86384351,112.5673322,26.86380086,112.5673322,26.86375816,112.5673321,26.86371536,112.5673321,26.86367248,112.5673321,26.86362955,112.5673326,26.86357924,112.5673332,26.86353624,112.5673342,26.86349317,112.5673352,26.86345126,112.5673365,26.86340684,112.5673378,26.86336361,112.5673391,26.86332033,112.5673403,26.86327822,112.5673412,26.86323356,112.5673419,26.86319004,112.5673425,26.86314639,112.5673432,26.86310264,112.5673439,26.86306,112.5673446,26.86301475,112.5673455,26.86297064,112.5673465,26.86292645,112.5673477,26.86288212,112.567349,26.86283769,112.5673504,26.86279316,112.5673518,26.86274854,112.5673534,26.8627051,112.567355,26.86265906,112.5673568,26.86261425,112.5673586,26.86257067,112.5673607,26.86252576,112.5673629,26.8624808,112.5673651,26.8624345,112.5673673,26.86239072,112.5673697,26.86234436,112.5673719,26.86230063,112.5673743,26.86225443,112.5673767,26.86220961,112.5673791,26.8621662,112.5673816,26.8621217,112.5673844,26.86207613,112.5673871,26.86203196,112.5673898,26.86198919,112.5673927,26.86194408,112.5673957,26.86190044,112.5673986,26.86185828,112.5674016,26.86181519,112.5674047,26.86177236,112.5674078,26.86172852,112.5674109,26.86168607,112.5674139,26.86164492,112.5674171,26.86160136,112.5674202,26.86155902,112.5674234,26.86151665,112.5674267,26.86147546,112.5674301,26.86143301,112.5674335,26.86139048,112.567437,26.86134783,112.5674405,26.861305,112.5674442,26.86126202,112.5674481,26.86121756,112.5674518,26.86117533,112.5674556,26.86113159,112.5674595,26.86108761,112.5674634,26.86104335,112.5674673,26.86099883,112.5674714,26.86095276,112.5674752,26.860909,112.5674793,26.86086241,112.5674832,26.8608182,112.5674871,26.86077258,112.5674911,26.86072692,112.5674952,26.86068139,112.5674993,26.86063475,112.5675033,26.86059091,112.5675075,26.86054592,112.5675119,26.86050102,112.5675163,26.86045621,112.5675209,26.8604115,112.5675255,26.86036692,112.5675301,26.86032249,112.5675347,26.86027832,112.5675395,26.86023447,112.5675443,26.86019094,112.5675499,26.86014143,112.5675551,26.86009704,112.5675602,26.86005525,112.5675657,26.86001113,112.5675712,26.85996839,112.5675769,26.85992583,112.5675827,26.85988345,112.5675885,26.85984244,112.5675945,26.85979918,112.5676003,26.8597573,112.5676061,26.85971567,112.5676127,26.85966849,112.5676184,26.85962746,112.5676248,26.85958196,112.5676315,26.8595343,112.567638,26.85948797,112.5676438,26.85944753,112.5676496,26.85940715,112.5676555,26.85936687,112.567662,26.85932217,112.5676688,26.85927647,112.5676758,26.85922972,112.5676827,26.85918415,112.5676895,26.85913975,112.5676964,26.85909433,112.5677036,26.85904794,112.5677103,26.859004,112.5677173,26.8589591,112.5677244,26.85891326,112.5677315,26.85886871,112.5677384,26.85882537,112.5677455,26.85878094,112.5677529,26.85873538,112.5677601,26.85869095,112.5677673,26.85864762,112.567775,26.85860196,112.5677826,26.85855723,112.5677901,26.85851344,112.5677978,26.85846829,112.5678058,26.85842178,112.5678136,26.85837618,112.5678205,26.8583361,112.5678275,26.85829587,112.5678355,26.85825086,112.5678437,26.85820449,112.5678512,26.85816261,112.5678596,26.85811587,112.567868,26.85807012,112.5678758,26.85802773,112.5678835,26.85798637,112.5678914,26.8579449,112.5678993,26.8579033,112.5679074,26.85786158,112.5679155,26.85781974,112.5679237,26.85777775,112.5679318,26.85773564,112.56794,26.85769342,112.5679492,26.85764624,112.5679588,26.8575977,112.5679674,26.85755387,112.5679756,26.85751238,112.5679844,26.85746833,112.5679928,26.85742662,112.5680018,26.85738235,112.5680105,26.85734049,112.5680197,26.85729609,112.5680285,26.8572541,112.5680377,26.85721086,112.5680468,26.85716763,112.5680559,26.85712438,112.5680653,26.85707988,112.5680744,26.85703659,112.5680834,26.85699454,112.5680927,26.85695129,112.5681021,26.85690798,112.5681117,26.85686472,112.5681214,26.85682142,112.5681316,26.85677687,112.5681412,26.85673477,112.5681512,26.85669142,112.5681612,26.85664807,112.5681713,26.85660471,112.5681815,26.8565613,112.5681918,26.85651784,112.5682022,26.85647436,112.5682125,26.85643085,112.568223,26.85638731,112.5682334,26.85634374,112.5682438,26.85630014,112.5682542,26.85625653,112.5682646,26.85621292,112.568275,26.85616934,112.5682856,26.85612576,112.5682961,26.85608222,112.5683068,26.85603871,112.5683175,26.85599523,112.5683283,26.85595174,112.5683391,26.85590827,112.56835,26.85586481,112.5683608,26.85582135,112.5683716,26.8557779,112.5683824,26.85573445,112.5683932,26.85569109,112.5684039,26.85564784,112.5684146,26.85560469,112.5684253,26.85556164,112.5684359,26.85551869,112.5684465,26.85547585,112.5684571,26.8554331,112.5684692,26.85538435,112.5684798,26.85534179,112.5684907,26.855298,112.568501,26.85525659,112.5685119,26.85521269,112.5685225,26.85516999,112.5685328,26.85512851,112.5685435,26.85508584,112.5685545,26.85504202,112.5685652,26.85499958,112.568576,26.85495741,112.5685865,26.85491681,112.5685972,26.85487547,112.5686081,26.85483341,112.56862,26.85478737,112.5686301,26.85474766,112.5686411,26.85470406,112.5686521,26.85466006,112.568663,26.85461675,112.5686741,26.85457261,112.5686845,26.85453065,112.5686953,26.85448763,112.5687062,26.85444347,112.5687171,26.85440031,112.5687278,26.85435814,112.568739,26.85431482,112.5687505,26.85427036,112.5687615,26.854228,112.5687728,26.85418444,112.5687842,26.85414074,112.568796,26.85409578,112.5688072,26.85405281,112.5688186,26.85400854,112.5688303,26.85396292,112.5688403,26.8539238,112.5688516,26.85387999,112.5688634,26.85383485,112.5688757,26.85378837,112.5688879,26.85374282,112.5688998,26.85369813,112.5689122,26.85365202,112.5689231,26.85361148,112.568934,26.85357073,112.568945,26.85352976,112.5689563,26.85348742,112.5689669,26.85344729,112.5689777,26.85340595,112.5689884,26.85336456,112.568999,26.85332314,112.5690095,26.85328177,112.5690201,26.85323937,112.5690301,26.85319962,112.5690419,26.85315203,112.5690519,26.85311185,112.5690618,26.85307214,112.5690725,26.85302843,112.5690834,26.85298416,112.5690945,26.85293939,112.5691052,26.85289631,112.5691153,26.85285525,112.5691254,26.85281427,112.5691363,26.85276925,112.5691467,26.85272479,112.5691558,26.85268448,112.5691642,26.85264604,112.5691739,26.85260068,112.5691823,26.85256148,112.5691914,26.85251902,112.5692006,26.85247698,112.5692099,26.85243617,112.5692195,26.85239528,112.5692291,26.85235591,112.5692383,26.85231832,112.5692483,26.85227828,112.5692577,26.85224057,112.5692673,26.85220256,112.5692765,26.85216641,112.5692852,26.85213217,112.5692934,26.85209921,112.5693012,26.85206782,112.5693088,26.8520366,112.5693165,26.85200596,112.5693244,26.85197473,112.5693329,26.85194174,112.5693415,26.85190886,112.5693505,26.85187391,112.5693596,26.85183913,112.5693689,26.8518038,112.5693786,26.85176767,112.5693886,26.85173053,112.5693987,26.85169321,112.5694093,26.8516548,112.5694193,26.85161924,112.5694299,26.85158166,112.5694409,26.85154281,112.5694525,26.85150268,112.5694646,26.85146038,112.5694754,26.85142303,112.5694865,26.85138403,112.5694981,26.85134331,112.5695094,26.8513035,112.5695209,26.85126192,112.5695315,26.85122334,112.5695429,26.85118118,112.5695535,26.85114123,112.5695636,26.8511028,112.5695755,26.85105703,112.569586,26.85101676,112.5695962,26.85097701,112.5696067,26.85093573,112.5696177,26.85089286,112.5696282,26.85085165,112.5696391,26.85080916,112.5696501,26.85076663,112.5696614,26.8507231,112.5696721,26.85068191,112.5696831,26.85064005,112.5696943,26.85059766,112.5697049,26.8505579,112.5697157,26.8505174,112.5697268,26.8504759,112.5697376,26.85043546,112.5697479,26.85039631,112.5697583,26.85035632,112.569769,26.85031532,112.5697793,26.85027546,112.5697893,26.85023657,112.5697997,26.85019564,112.5698107,26.85015163,112.5698219,26.85010653,112.5698321,26.8500653,112.5698417,26.85002598,112.5698515,26.84998557,112.5698615,26.84994409,112.5698711,26.84990454,112.5698812,26.84986385,112.5698918,26.84982193,112.5699024,26.84978088,112.5699128,26.84974064,112.5699238,26.84969806,112.5699346,26.84965622,112.569945,26.84961514,112.5699557,26.84957283,112.5699663,26.84953049,112.5699772,26.84948722,112.5699876,26.84944638,112.5699983,26.84940488,112.570009,26.84936345,112.57002,26.84932117,112.5700303,26.84928134,112.5700409,26.84924079,112.5700518,26.8491992,112.5700621,26.84915954,112.5700727,26.8491187,112.5700833,26.8490776,112.5700944,26.84903516,112.5701051,26.8489945,112.5701161,26.84895247,112.5701271,26.84891002,112.5701384,26.84886612,112.5701492,26.84882402,112.5701606,26.84877956,112.5701718,26.84873609,112.5701827,26.84869375,112.5701938,26.84865055,112.5702048,26.84860776,112.5702158,26.84856529,112.5702268,26.8485228,112.5702382,26.84847919,112.5702493,26.84843653,112.5702603,26.84839485,112.5702715,26.848352,112.5702828,26.84830902,112.5702945,26.84826488,112.5703052,26.8482239,112.5703166,26.84817971,112.5703278,26.84813556,112.5703382,26.84809355,112.5703487,26.84805035,112.5703592,26.84800699,112.57037,26.8479623,112.5703803,26.8479196,112.5703909,26.84787565,112.5704018,26.84783026,112.570412,26.84778789,112.5704233,26.84774191,112.5704349,26.84769563,112.570446,26.84765133,112.5704563,26.84761025,112.5704663,26.8475702,112.5704764,26.84753009,112.5704865,26.84748987,112.5704967,26.8474496,112.5705069,26.84740932,112.5705171,26.84736909,112.5705271,26.84732902,112.5705369,26.84728922,112.5705466,26.84724972,112.5705562,26.84721025,112.5705668,26.84716626,112.5705776,26.84712107,112.5705886,26.84707583,112.5705999,26.84702942,112.5706107,26.84698518,112.5706216,26.84693969,112.5706323,26.84689405,112.5706416,26.84685284,112.5706517,26.84680806,112.5706608,26.84676669,112.5706698,26.84672647,112.5706787,26.84668626,112.5706888,26.84664152,112.5706994,26.84659467,112.5707094,26.84655054,112.5707195,26.84650579,112.5707294,26.84646167,112.5707392,26.8464178,112.5707492,26.84637281,112.5707587,26.84633008,112.5707686,26.84628626,112.5707786,26.8462413,112.5707883,26.84619855,112.5707984,26.84615469,112.5708087,26.84610965,112.5708187,26.84606559,112.5708286,26.84602245,112.5708386,26.84597801,112.5708489,26.84593231,112.5708586,26.84588861,112.5708685,26.84584351,112.5708785,26.84579714,112.5708871,26.84575753,112.5708955,26.84571792,112.5709038,26.84567829,112.5709132,26.84563323,112.5709222,26.84558947,112.5709313,26.84554459,112.5709406,26.84549855,112.5709496,26.84545356,112.5709584,26.84540959,112.5709675,26.84536402,112.5709769,26.84531752,112.5709851,26.84527773,112.5709933,26.84523775,112.5710016,26.84519755,112.5710098,26.84515713,112.5710181,26.84511659,112.5710263,26.84507603,112.5710345,26.84503528,112.5710427,26.84499453,112.5710509,26.84495367,112.5710591,26.84491286,112.5710672,26.84487214,112.5710754,26.84483149,112.5710846,26.84478523,112.5710925,26.84474496,112.5711013,26.8447002,112.5711105,26.84465306,112.5711191,26.84460815,112.571127,26.84456655,112.5711347,26.84452593,112.5711424,26.84448508,112.57115,26.84444403,112.5711577,26.8444028,112.571165,26.8443626,112.5711726,26.84432108,112.5711805,26.84427818,112.571188,26.8442375,112.5711962,26.84419424,112.5712043,26.84415208,112.5712123,26.8441098,112.5712203,26.84406849,112.5712286,26.84402576,112.5712372,26.84398154,112.5712456,26.84393827,112.571254,26.84389472,112.5712622,26.84385088,112.5712704,26.84380676,112.5712782,26.84376361,112.5712865,26.84371764,112.5712944,26.84367271,112.5713022,26.84362883,112.5713104,26.84358216,112.5713184,26.84353655,112.5713263,26.84349208,112.5713344,26.84344615,112.5713428,26.8433988,112.571351,26.84335266,112.5713591,26.84330645,112.5713672,26.84326013,112.5713751,26.84321383,112.5713831,26.84316752,112.571391,26.84312124,112.571399,26.84307506,112.5714069,26.84302917,112.5714143,26.8429849,112.5714221,26.84293842,112.5714296,26.84289371,112.5714368,26.84285079,112.5714443,26.84280575,112.5714514,26.84276205,112.5714584,26.8427197,112.5714654,26.8426762,112.5714726,26.84263154,112.5714795,26.84258815,112.5714863,26.84254605,112.5714934,26.84250158,112.5715002,26.84245846,112.5715068,26.84241668,112.5715137,26.8423725,112.5715205,26.84232956,112.5715271,26.8422866,112.5715338,26.84224355,112.5715404,26.84220166,112.5715471,26.84215849,112.5715539,26.84211527,112.5715609,26.84207078,112.5715677,26.84202744,112.5715745,26.84198409,112.5715811,26.84194197,112.5715878,26.84189863,112.5715945,26.84185531,112.5716012,26.84181201,112.5716083,26.84176755,112.5716152,26.84172559,112.5716224,26.84168113,112.5716292,26.84163906,112.5716361,26.84159567,112.5716428,26.84155208,112.5716495,26.84150697,112.5716558,26.8414629,112.5716621,26.84141857,112.5716681,26.84137527,112.5716743,26.84133048,112.5716804,26.84128548,112.5716863,26.84124022,112.5716922,26.8411947,112.5716982,26.84114767,112.5717038,26.84110308,112.5717098,26.84105704,112.5717158,26.84101086,112.5717222,26.84096328,112.5717283,26.84091824,112.5717347,26.84087052,112.5717408,26.84082539,112.5717472,26.84077764,112.5717533,26.84073261,112.5717595,26.84068633,112.5717657,26.84064021,112.5717717,26.8405942,112.5717776,26.84054829,112.5717835,26.84050127,112.571789,26.84045706,112.5717946,26.84041174,112.5718002,26.84036654,112.5718058,26.84032018,112.5718112,26.84027644,112.5718166,26.84023153,112.5718221,26.84018682,112.5718275,26.84014242,112.5718329,26.84009818,112.5718382,26.84005414,112.5718435,26.84001029,112.5718487,26.8399667,112.5718545,26.83991705,112.5718596,26.8398725,112.5718645,26.83982929,112.5718693,26.83978622,112.571874,26.83974449,112.5718789,26.83970042,112.5718836,26.83965766,112.5718883,26.83961497,112.5718927,26.83957366,112.5718974,26.83953004,112.5719019,26.8394877,112.5719061,26.83944662,112.5719104,26.83940439,112.5719148,26.83936105,112.5719191,26.83931893,112.5719233,26.83927806,112.5719275,26.83923605,112.5719317,26.83919408,112.5719358,26.83915211,112.57194,26.83910895,112.571944,26.83906821,112.5719481,26.83902626,112.5719523,26.8389844,112.5719566,26.83894137,112.571961,26.83890078,112.5719663,26.83885186,112.5719707,26.83881012,112.571975,26.83876837,112.5719791,26.83872667,112.5719834,26.83868499,112.571988,26.83863857,112.5719926,26.83859103,112.5719972,26.83854363,112.5720014,26.83850125,112.5720058,26.83845578,112.5720098,26.83841426,112.5720141,26.8383695,112.5720184,26.83832369,112.5720227,26.83827689,112.572027,26.83823128,112.5720312,26.83818691,112.5720357,26.83814037,112.57204,26.83809507,112.5720443,26.83805101,112.5720486,26.8380059,112.5720531,26.83795988,112.5720575,26.83791423,112.5720617,26.83787247,112.5720662,26.83782923,112.572071,26.8377853,112.5720758,26.83774361,112.5720807,26.83770091,112.5720857,26.83765715,112.5720904,26.83761439,112.5720949,26.83757271,112.5720996,26.83753004,112.5721046,26.83748653,112.5721096,26.83744437,112.5721145,26.83740363,112.5721197,26.83736224,112.572125,26.83732131,112.5721303,26.83728088,112.5721354,26.83724088,112.5721413,26.83719506,112.5721463,26.83715633,112.5721522,26.83711078,112.572158,26.83706731,112.5721641,26.837023,112.5721705,26.83697868,112.5721765,26.83693825,112.5721825,26.83689968,112.5721886,26.83685976,112.5721949,26.83681839,112.5722009,26.83677757,112.5722068,26.83673729,112.5722129,26.83669555,112.5722192,26.83665242,112.5722255,26.83660994,112.5722316,26.83656812,112.572238,26.83652481,112.5722444,26.83648114,112.5722509,26.83643723,112.5722575,26.83639331,112.5722642,26.83634823,112.5722708,26.83630512,112.5722776,26.83626056,112.5722846,26.83621557,112.5722919,26.83616898,112.5722982,26.83612874,112.5723046,26.83608814,112.5723111,26.83604724,112.5723177,26.83600605,112.5723245,26.83596463,112.5723311,26.83592419,112.5723382,26.83588113,112.5723453,26.83583914,112.5723523,26.83579702,112.5723594,26.83575467,112.5723666,26.83571207,112.572374,26.83566922,112.5723817,26.83562614,112.5723895,26.83558271,112.5723976,26.83553901,112.5724059,26.83549503,112.5724143,26.83545079,112.5724229,26.83540627,112.5724315,26.83536147,112.5724401,26.83531642,112.5724488,26.83527114,112.5724575,26.83522564,112.5724664,26.83517992,112.5724752,26.83513403,112.5724842,26.83508794,112.5724933,26.83504165,112.5725024,26.83499516,112.5725118,26.83494849,112.5725209,26.834903,112.5725308,26.83485461,112.5725403,26.8348087,112.5725506,26.8347599,112.5725606,26.83471224,112.5725708,26.8346645,112.5725806,26.83461812,112.5725911,26.83456913,112.5726011,26.83452165,112.5726109,26.83447571,112.572621,26.83442874,112.572631,26.8343821,112.5726414,26.83433449,112.5726516,26.83428852,112.5726613,26.83424417,112.5726714,26.83419885,112.5726813,26.83415383,112.5726916,26.83410786,112.5727013,26.83406474,112.5727114,26.83402068,112.5727214,26.83397694,112.5727315,26.83393352,112.5727418,26.83388918,112.5727515,26.83384759,112.5727615,26.83380507,112.5727715,26.83376283,112.5727815,26.83371968,112.5727909,26.8336792,112.5728009,26.83363665,112.5728104,26.83359677,112.5728217,26.83354905,112.5728314,26.83350861,112.572841,26.83346845,112.5728507,26.83342848,112.5728616,26.8333838,112.572873,26.83333783,112.5728849,26.83329071,112.5728965,26.83324462,112.5729067,26.83320424,112.572917,26.83316383,112.5729284,26.83311875,112.5729402,26.83307238,112.5729525,26.83302465,112.5729631,26.83298372,112.5729738,26.8329426,112.5729844,26.8329025,112.5729958,26.83285996,112.5730072,26.83281861,112.5730184,26.83277862,112.5730303,26.83273646,112.5730417,26.83269686,112.5730539,26.83265527,112.5730674,26.83260946,112.5730807,26.83256518,112.5730945,26.83251871,112.5731065,26.83247888,112.57312,26.83243315,112.5731319,26.83239295,112.5731433,26.83235378,112.5731555,26.83231219,112.5731674,26.83227166,112.5731794,26.83223112,112.5731914,26.83219068,112.5732032,26.83215049,112.5732161,26.83210599,112.5732293,26.83206025,112.5732425,26.83201454,112.573256,26.83196793,112.5732675,26.83192843,112.5732791,26.83188899,112.5732908,26.83184951,112.5733039,26.83180549,112.5733175,26.8317603,112.5733316,26.8317139,112.5733436,26.83167425,112.5733558,26.83163458,112.5733698,26.8315893,112.5733821,26.83154987,112.5733944,26.83151079,112.5734066,26.83147204,112.5734202,26.83142885,112.5734342,26.83138452,112.5734487,26.83133903,112.5734624,26.83129566,112.5734767,26.83125107,112.5734911,26.83120637,112.5735061,26.83116058,112.573519,26.83112147,112.573532,26.83108228,112.5735451,26.83104302,112.5735599,26.83099919,112.5735752,26.8309542,112.5735908,26.83090917,112.573607,26.83086304,112.573621,26.83082368,112.5736349,26.83078442,112.5736503,26.83074088,112.5736657,26.83069655,112.5736812,26.83065148,112.5736957,26.83060895,112.5737105,26.83056584,112.5737252,26.83052315,112.5737404,26.83047951,112.573755,26.83043811,112.5737699,26.83039589,112.5737851,26.83035311,112.5737998,26.83031175,112.5738143,26.83027152,112.5738295,26.83022924,112.5738443,26.83018799,112.5738588,26.83014777,112.5738736,26.83010652,112.5738883,26.83006519,112.5739035,26.8300227,112.573918,26.82998218,112.5739327,26.82994066,112.5739474,26.82989933,112.573962,26.82985842,112.5739762,26.82981797,112.5739904,26.82977773,112.5740048,26.82973659,112.5740185,26.82969752,112.5740324,26.82965751,112.5740466,26.82961668,112.57406,26.82957815,112.5740736,26.82953912,112.5740889,26.82949478,112.5741018,26.82945758,112.574115,26.82941969,112.5741286,26.82938128,112.5741418,26.82934446,112.5741565,26.82930484,112.5741718,26.82926535,112.5741873,26.82922699,112.5742027,26.82918967,112.5742192,26.82914978,112.5742349,26.82911184,112.5742491,26.82907713,112.5742631,26.82904236,112.5742775,26.82900665,112.5742914,26.82897283,112.5743051,26.82893948,112.5743175,26.82890905,112.5743294,26.82887934,112.5743412,26.82884938,112.5743534,26.82881806,112.5743662,26.82878494,112.5743792,26.82875159,112.5743932,26.82871695,112.5744066,26.82868419,112.574421,26.82864938,112.5744352,26.82861544,112.5744495,26.82858142,112.5744645,26.82854579,112.5744802,26.82850912,112.5744965,26.82847139,112.5745119,26.82843644,112.5745277,26.82840103,112.5745437,26.82836521,112.5745602,26.82832832,112.5745767,26.82829174,112.5745933,26.82825533,112.5746107,26.82821768,112.5746284,26.82817956,112.5746464,26.82814074,112.5746648,26.82810122,112.5746816,26.82806509,112.5746987,26.82802857,112.5747161,26.82799153,112.5747337,26.82795388,112.5747518,26.82791476,112.5747694,26.82787675,112.574788,26.82783641,112.574806,26.82779729,112.5748231,26.8277604,112.5748395,26.82772485,112.5748564,26.82768796,112.5748761,26.82764503,112.5748931,26.82760822,112.5749106,26.82757017,112.5749288,26.82753095,112.5749462,26.82749347,112.5749641,26.82745489,112.5749821,26.82741615,112.5750005,26.82737629,112.5750181,26.82733827,112.5750362,26.82729917,112.5750545,26.82725996,112.5750729,26.82722067,112.5750915,26.82718128,112.5751103,26.82714182,112.5751297,26.82710132,112.5751483,26.82706278,112.5751674,26.82702322,112.5751871,26.82698264,112.5752058,26.826944,112.5752251,26.82690436,112.5752444,26.82686463,112.5752644,26.8268238,112.5752836,26.82678487,112.5753034,26.82674487,112.5753233,26.82670481,112.5753432,26.82666475,112.5753631,26.82662487,112.5753828,26.82658516,112.5754031,26.82654453,112.5754223,26.82650587,112.5754421,26.82646619,112.5754619,26.82642647,112.5754823,26.82638576,112.5755017,26.826347,112.5755218,26.8263072,112.5755424,26.82626639,112.5755621,26.82622756,112.5755823,26.82618778,112.5756025,26.82614805,112.5756233,26.82610736,112.575643,26.82606871,112.5756633,26.82602905,112.5756843,26.82598828,112.5757044,26.8259494,112.5757253,26.8259094,112.5757462,26.82586928,112.5757678,26.82582818,112.5757884,26.82578909,112.5758095,26.82574899,112.5758308,26.82570888,112.5758521,26.8256687,112.5758736,26.82562842,112.5758957,26.82558697,112.5759169,26.82554742,112.5759365,26.82551078,112.5759557,26.82547503,112.575975,26.82543918,112.5759945,26.82540325,112.5760165,26.82536312,112.576037,26.82532598,112.5760593,26.82528568,112.5760823,26.82524415,112.5761058,26.82520135,112.5761282,26.82516047,112.5761512,26.8251184,112.5761715,26.82508155,112.5761918,26.8250446,112.5762122,26.8250075,112.5762328,26.82497025,112.5762536,26.8249329,112.5762747,26.82489549,112.576296,26.82485808,112.5763176,26.82482065,112.5763394,26.82478315,112.5763614,26.82474563,112.5763836,26.82470807,112.5764059,26.82467045,112.5764282,26.82463279,112.5764507,26.82459504,112.5764732,26.82455714,112.5764959,26.82451906,112.5765187,26.8244808,112.5765414,26.82444236,112.5765643,26.82440377,112.5765873,26.82436503,112.5766103,26.8243262,112.5766333,26.8242873,112.5766563,26.82424836,112.5766793,26.82420936,112.5767024,26.82417035,112.5767255,26.82413139,112.5767486,26.82409266,112.5767718,26.82405426,112.5767952,26.82401617,112.5768184,26.82397842,112.5768415,26.82394106,112.5768675,26.82389881,112.57689,26.8238624,112.5769121,26.82382648,112.5769377,26.82378503,112.5769617,26.82374607,112.5769862,26.82370623,112.5770106,26.82366648,112.5770325,26.8236307,112.577056,26.82359184,112.5770776,26.82355585,112.5770985,26.82352077,112.5771191,26.82348565,112.5771395,26.82345051,112.5771598,26.82341535,112.5771798,26.82338019,112.5772019,26.82334115,112.5772242,26.82330145,112.5772462,26.82326217,112.5772682,26.82322307,112.5772905,26.82318416,112.577313,26.82314536,112.5773362,26.82310578,112.5773584,26.8230684,112.5773813,26.82303052,112.5774047,26.82299227,112.5774275,26.82295555,112.5774498,26.82292036,112.5774726,26.82288478,112.577496,26.82284873,112.577518,26.82281481,112.5775436,26.82277584,112.5775668,26.8227404,112.5775889,26.82270667,112.5776116,26.82267202,112.577635,26.82263636,112.5776572,26.82260227,112.5776799,26.82256708,112.5777022,26.82253158,112.5777246,26.82249483,112.5777455,26.82245955,112.5777668,26.8224232,112.5777883,26.82238602,112.5778084,26.82235089,112.5778313,26.82231089,112.5778521,26.82227511,112.5778746,26.82223755,112.5778983,26.82219925,112.5779212,26.82216358,112.5779447,26.82212803,112.5779687,26.82209266,112.5779915,26.82205946,112.5780155,26.82202476,112.5780386,26.82199153,112.578063,26.82195673,112.5780866,26.82192336,112.5781108,26.82188914,112.5781349,26.82185496,112.5781588,26.82182106,112.578183,26.82178691,112.5782056,26.82175498,112.5782284,26.82172268,112.578252,26.82168907,112.5782738,26.82165769,112.578297,26.82162352,112.578319,26.82159035,112.57834,26.82155755,112.5783603,26.82152419,112.578379,26.82149185,112.5783968,26.82146083,112.5784156,26.8214279,112.5784338,26.82139713,112.5784526,26.82136704,112.5784737,26.82133537,112.5784954,26.82130434,112.5785179,26.82127371,112.5785392,26.82124509,112.5785613,26.82121474,112.5785826,26.82118459,112.578603,26.82115312,112.5786192,26.82112113,112.5786297,26.82108804,112.5786344,26.82105208,112.5786328,26.82101569,112.5786258,26.82097918,112.5786153,26.82094473,112.5786011,26.8209112,112.5785817,26.82087705,112.5785582,26.82084558,112.5785324,26.82081834,112.5785038,26.82079259,112.5784737,26.8207676,112.5784418,26.82074259,112.5784091,26.82071846,112.578379,26.82069718,112.5783473,26.82067552,112.5783147,26.82065364,112.5782815,26.82063157,112.5782474,26.82060937,112.5782152,26.82058867,112.5781801,26.8205663,112.5781471,26.8205455,112.5781091,26.82052165,112.5780759,26.82050087,112.578042,26.82047964,112.5780081,26.8204585,112.5779742,26.82043738,112.5779398,26.82041587,112.577907,26.82039532,112.5778726,26.82037382,112.57784,26.82035339,112.5778063,26.82033228,112.5777708,26.82030994,112.5777338,26.82028685" + private var mMarkerCacheController:MarkerCacheController? = null + + private constructor(){ + + } + + fun init(context: Context?) { + this.context = context + mTaskScope = MainScope() + threadPoolExecutor = ThreadPoolExecutor(32, 32, 5, + TimeUnit.SECONDS, + LinkedBlockingDeque(), + Executors.defaultThreadFactory(), + ThreadPoolExecutor.AbortPolicy()) + resetData() + } + + fun resetData(){ + trackMap.clear() + otherCarList.clear() + } + fun resetTask(){ + othercarFlag = false + mOtherCarJob?.cancel() + + othercarFlag = false + mOtherCarJob?.cancel() + + randomTrackFlag = false + mTrackJob?.cancel() + + dataFlag = false + mDataJob?.cancel() + + markerFlag = false + mMarkerJob?.cancel() + + polygonFlag = false + mPolygonJob?.cancel() + + mUpdateFlag = false + mUpdateCacheJob?.cancel() + + marker2DFlag = false + m2DMarkerJob?.cancel() + + } + + fun exit() { + mMarkerCacheController?.destory() + markerMap.clear() + resetTask() + threadPoolExecutor?.shutdown() + threadPoolExecutor = null + mTaskScope?.cancel() + mTaskScope = null + } + + fun getTaskScope():CoroutineScope?{ + return mTaskScope + } + + + + private val markerMap = ConcurrentHashMap() + + fun add2DMarker(id:String?,lon:Double,lat:Double,angle:Double,mapAutoView: MapAutoView){ + var marker :Marker? = null + if(!TextUtils.isEmpty(id)){ + marker = markerMap.get(id) + } + val lonLatPoint = LonLatPoint(lon,lat,angle) + if(marker != null){ + marker.setAnchorColor(getRandomColorStr()) + marker.setPosition(lonLatPoint) + marker.setRotateAngle(angle.toFloat()) + }else{ + val markerOptions = MarkerOptions(id,null).position(lonLatPoint) + .rotateAngle(angle.toFloat()) + .markerIcon(R.mipmap.map_custom_self_car,mapAutoView.getMapController()) + .anchorColor(getRandomColorStr()) + .controlAngle(true) + marker = mapAutoView.getMarkerController()?.addMarker(markerOptions) + marker?.let{ + markerMap.put(markerOptions.getId(),it) + } + } + } + + fun add3DMarker(id:String?,lon:Double,lat:Double,angle:Double,mapAutoView: MapAutoView){ + var marker :Marker? = null + if(!TextUtils.isEmpty(id)){ + marker = markerMap.get(id) + } + val lonLatPoint = LonLatPoint(lon,lat,angle) + if(marker != null){ + marker.setAnchorColor(getRandomColorStr()) + marker.setPosition(lonLatPoint) + marker.setRotateAngle(angle.toFloat()) + }else{ + val markerOptions = MarkerOptions(mapAutoView.getMapController()) + .setGps(true) + .position(lonLatPoint) + .rotateAngle(angle.toFloat()) + .marker3DIcon(R.raw.car,mapAutoView.getMapController()) + .anchorColor(getRandomColorStr()) + .controlAngle(true) + .colorType((Math.random()*4).toInt()) + .changeColorTime(2f) + .changeColorAngle(90f) + marker = mapAutoView.getMarkerController()?.addMarker(markerOptions) + marker?.let{ + markerMap.put(markerOptions.getId(),it) + } + } + } + + fun delMarker(){ + if(!markerMap.isEmpty()){ + val size = markerMap.keys.size + if(size > 150) { + for (key in markerMap.keys) { + if (markerMap.keys.size > 150) { + if(markerMap.containsKey(key)){ + var marker = markerMap.get(key) + marker?.remove() + markerMap.remove(key) + + } + + } + } + } else if(size > 0){ + for (key in markerMap.keys) { + if(markerMap.containsKey(key)){ + var marker = markerMap.get(key) + marker?.remove() + markerMap.remove(key) + return + + } + + } + } + } + } + + fun add3DPolygin(lon:Double,lat:Double,mapAutoView: MapAutoView){ + val type = (Math.random()*3+2).toInt() + val height = (Math.random()*10).toFloat()+ 10 + val lons = java.util.ArrayList() + lons.add(LonLatPoint(lon + 0.00002, lat - 0.00001)) + lons.add(LonLatPoint(lon + 0.00004, lat - 0.00001)) + lons.add(LonLatPoint(lon + 0.00004, lat - 0.00002)) + when(type){ + 4->{ + lons.add(LonLatPoint(lon + 0.00002, lat - 0.00002)) + } + 5->{ + lons.add(LonLatPoint(lon + 0.00002, lat - 0.00002)) + lons.add(LonLatPoint(lon + 0.00003, lat + 0.000015)) + } + } + + var polygonOption = Polygon3DOption().setColor(Color.argb(255, 255, 255, 0)) + ?.setLineWidth(10f)?.setGps(true)?.setLonLatPoints(lons)?.setHeight(height)?.setCount(lons.size) + polygonOption?.let { + if (polygon == null) + polygon = Polygon3DHelper.draw3DPolygon(it,mapAutoView) + else { + polygon?.remove(mapAutoView.getMapController()) + polygon = Polygon3DHelper.draw3DPolygon(it,mapAutoView) + } + + + } + } + + + fun addCircle(lon:Double,lat:Double,mapAutoView: MapAutoView){ + val lons = java.util.ArrayList() + lons.add(LonLatPoint(lon + 0.00002, lat - 0.00001)) + lons.add(LonLatPoint(lon + 0.00004, lat - 0.00001)) + var circleOptions = CircleOptions().setRadius(100).setColor(Color.argb(100, 0, 255, 0)) + .setLineWidth(10).setLonLatPoints(lons) + if(circle == null){ + circle = mapAutoView.getMapAutoViewHelper()?.drawCircle(circleOptions) + }else{ + circle?.removePel(mapAutoView.getMapController()) + circle = mapAutoView.getMapAutoViewHelper()?.drawCircle(circleOptions) + } + + + } + + fun addRect(lon:Double,lat:Double,mapAutoView: MapAutoView){ + val lons = java.util.ArrayList() + lons.add(LonLatPoint(lon + 0.00002, lat - 0.00001)) + lons.add(LonLatPoint(lon + 0.00004, lat - 0.00001)) + lons.add(LonLatPoint(lon + 0.00004, lat - 0.00002)) + lons.add(LonLatPoint(lon + 0.00002, lat - 0.00002)) + var polylineOptions = PolylineOptions(mapAutoView.getMapController()).color(Color.argb(100, 0, 100, 255)) + .lineWidth(10f).lonLatPoints(lons) + if(rect == null){ + rect = mapAutoView.getMapAutoViewHelper()?.drawRect(polylineOptions) + }else{ + rect?.remove() + rect = mapAutoView.getMapAutoViewHelper()?.drawRect(polylineOptions) + } + + } + + + fun addOvil(lon:Double,lat:Double,mapAutoView: MapAutoView){ + val lons = java.util.ArrayList() + lons.add(LonLatPoint(lon + 0.00002, lat - 0.00001)) + lons.add(LonLatPoint(lon + 0.00004, lat - 0.00001)) + lons.add(LonLatPoint(lon + 0.00004, lat - 0.00002)) + lons.add(LonLatPoint(lon + 0.00002, lat - 0.00002)) + var polylineOptions = PolylineOptions(mapAutoView.getMapController()).color(Color.argb(100, 0, 255, 255)) + .lineWidth(10f).lonLatPoints(lons) + if(ellipse == null){ + ellipse = mapAutoView.getMapAutoViewHelper()?.drawEllipse(polylineOptions) + }else{ + ellipse?.remove() + ellipse = mapAutoView.getMapAutoViewHelper()?.drawEllipse(polylineOptions) + } + + } + + fun delPolygon(mapAutoView: MapAutoView){ + polygon?.remove(mapAutoView.getMapController()) + polygon = null + } + + fun delPel(mapAutoView: MapAutoView){ + circle?.removePel(mapAutoView.getMapController()) + ellipse?.remove() + rect?.remove() + circle = null + ellipse = null + rect = null + } + + private var lastWifiEnable = true + + fun updateWifiEnable(enable:Boolean){ + if(lastWifiEnable != enable){ + lastWifiEnable = enable + val wifi = context?.getSystemService(Context.WIFI_SERVICE) as WifiManager? + val isEnable = wifi?.isWifiEnabled + if(isEnable!= enable){ + wifi?.isWifiEnabled = enable + } + } + + + } + + //随机颜色字符库 + fun getRandomColorStr():String { + + val KeyStr = "1234567890ABCDEF"; + val sb = StringBuffer(); + val len = KeyStr.length; + sb.append("#"); + for (i in 0 until 8) { + sb.append(KeyStr.get( Math.round(Math.random() * (len - 1)).toInt())); + } + return sb.toString(); + } + + private var isVr = true + //模拟样式设置 + fun monitorStyle(mapAutoView: MapAutoView?) { + val i = (Math.random() * 12).toInt() + if ( i > 0 && i <= 7) { + mapAutoView?.getMapAutoViewHelper()?.setMapViewVisualAngle(i) + } else { + val j = (Math.random() * 20).toInt() + if(j==1){ + isVr = false + }else{ + isVr = true + } + + if (isVr) { + mapAutoView?.getMapAutoViewHelper()?.setMapStyle(5) + } else { +// mapAutoView?.getMapAutoViewHelper()?.setMapStyle(6) + } + } + } + + + fun monitorRoamStyle(mapAutoView: MapAutoView){ + val type = (Math.random() * 2).toInt() + mapAutoView.getMapAutoViewHelper()?.setRoamStyle(0, ConstantExt.ROAM_DIS_1KM, ConstantExt.ROAM_SPEED_80) + } + + fun setRoamPath(mapAutoView: MapAutoView){ + mapAutoView.getMapAutoViewHelper()?.setRoamTrajectory(trackStr + trackStr1) + } + + fun monitorTransStyle(mapAutoView: MapAutoView){ + mapAutoView.getMapAutoViewHelper()?.setMapViewVisualAngle(ConstantExt.MAP_STYLE_VR_TRANS) + } + + //模拟定位数据 + fun monitorLocation(lonlatPoint:LonLatPoint,mapAutoView: MapAutoView) { + val location = MogoLocation() + location.provider = "GPS_RTK" + location.lon = lonlatPoint.longitude + location.lat = lonlatPoint.latitude + location.heading = lonlatPoint.angle + mapAutoView?.getLocationClient()?.setExtraSelfGPSData(location.copy()) + } + + //模拟加载车道线等数据 + fun loadDataAPI(lonlatPoint:LonLatPoint, mapAutoView: MapAutoView, isDrawStop: Boolean, isDrawRect: Boolean, isDrawCenterLine: Boolean, isDrawRoadCross: Boolean) { + val location = MogoLocation() + location.provider = "GPS_RTK" + location.lon = lonlatPoint.longitude + location.lat = lonlatPoint.latitude + location.heading = lonlatPoint.angle + +// mapAutoView?.getLocationClient()?.setExtraSelfGPSData(location.copy()) + + if(isDrawCenterLine) { + MapDataApi.getCenterLineInfo( + lonlatPoint.longitude, + lonlatPoint.latitude, + lonlatPoint.angle.toFloat(), + object : IResult { + override fun result(code: Int, line: CenterLine?) { + var valuesArr = arrayListOf() + line?.let { + centerlons.clear() + it.points?.let { + centerlons = CopyOnWriteArrayList(it) + if (centerLine == null) { + valuesArr.clear() + valuesArr.add(Color.argb(255, 46, 220, 255)) + valuesArr.add(Color.argb(0, 46, 220, 255)) + + centerLine = mapAutoView?.getMapAutoViewHelper()?.drawThickLine( + PolylineOptions(mapAutoView.getMapController()).setGps(true) + .colorValues(valuesArr) + .useGradient(true).lineWidth(20f) + .lonLatPoints(centerlons).zIndex(65000f) + .setBrightColor(Color.argb(255, 255, 255, 255)) + .setBrightSpeed(brightSpeed) + .setIsBright(isShowBirght) + ) + } else { + centerLine?.setPoints(centerlons) + if(isChangeColor){ + valuesArr.clear() + valuesArr.add(Color.argb(255, 255, 77, 0)) + valuesArr.add(Color.argb(255, 255, 188, 43)) + valuesArr.add(Color.argb(0, 46, 220, 255)) + centerLine?.setOption(centerLine?.getPolyLineOptions()?.colorValues(valuesArr)?.setIsBright(isShowBirght)?.setBrightSpeed(brightSpeed)) + }else{ + valuesArr.clear() + valuesArr.add(Color.argb(255, 46, 220, 255)) + valuesArr.add(Color.argb(0, 46, 220, 255)) + centerLine?.setOption(centerLine?.getPolyLineOptions()?.colorValues(valuesArr)?.setIsBright(isShowBirght)?.setBrightSpeed(brightSpeed)) + } + } + } + } + } + } + ) + + } + if (isDrawStop) { + MapDataApi.getStopLineInfo( + lonlatPoint.longitude, + lonlatPoint.latitude, + lonlatPoint.angle.toFloat(), + object : IResult{ + override fun result(code: Int, stoplineData: StopLine?) { + stoplineData?.let { + stoplons.clear() + it.points?.let { + stoplons = CopyOnWriteArrayList(it) + if (stopLine == null && stoplons.size > 1) { + var colors = ArrayList() + colors.add(Color.argb(255, 188, 236, 246)) + colors.add(Color.argb(255, 230, 239, 244)) + stopLine = mapAutoView?.getMapAutoViewHelper()?.drawThickLine( + PolylineOptions(mapAutoView.getMapController()).setGps(true) + .colorValues(colors) + .lonLatPoints(stoplons).zIndex(65000f) + .lineWidth(1f) + .useGradient(true) + .useFacade(true)//立面 + .maxIndex(2000000f)//高度 + ) + } else { + stopLine?.setPoints(stoplons) + } + } + } + } + + } + ) + + } + + if(isDrawRect) { + MapDataApi.getRoadRectInfo( + lonlatPoint.longitude, + lonlatPoint.latitude, + lonlatPoint.angle.toFloat(), + object : IResult{ + override fun result(code: Int, roadInfos: RoadRectInfos?) { + var list = roadInfos?.roadRects + if (list != null && list.size > 0) { + if (listRect.size == 0) { + + for (i in 0..list.size - 1) { + var rect = list[i] + val lons = ArrayList() + lons.add(rect.topLeft!!) + lons.add(rect.topRight!!) + lons.add(rect.bottomLeft!!) + lons.add(rect.bottomRight!!) + lons.add(rect.topLeft!!) + var polylineOptions = + PolylineOptions(mapAutoView.getMapController()).setGps(true).zIndex(35000f) + .color(Color.argb(255, 0, 255, 255)) + .lineWidth(5f).lonLatPoints(lons) + var line = mapAutoView.getMapAutoViewHelper()?.drawThickLine(polylineOptions) + line?.let { + listRect.add(it) + } + + + } + } else if (listRect.size < list.size) { + for (i in 0..listRect.size - 1) { + var rect = list[i] + val lons = ArrayList() + lons.add(rect.topLeft!!) + lons.add(rect.topRight!!) + lons.add(rect.bottomLeft!!) + lons.add(rect.bottomRight!!) + lons.add(rect.topLeft!!) + listRect[i].setPoints(lons) + } + for (i in listRect.size until list.size) { + var rect = list[i] + val lons = ArrayList() + lons.add(rect.topLeft!!) + lons.add(rect.topRight!!) + lons.add(rect.bottomLeft!!) + lons.add(rect.bottomRight!!) + lons.add(rect.topLeft!!) + var polylineOptions = + PolylineOptions(mapAutoView.getMapController()).setGps(true).zIndex(35000f) + .color(Color.argb(255, 0, 255, 255)) + .lineWidth(5f).lonLatPoints(lons) + var line = mapAutoView.getMapAutoViewHelper()?.drawThickLine(polylineOptions) + line?.let { + listRect.add(it) + } + } + + + } else { + for (i in 0..list.size - 1) { + var rect = list[i] + val lons = ArrayList() + lons.add(rect.topLeft!!) + lons.add(rect.topRight!!) + lons.add(rect.bottomLeft!!) + lons.add(rect.bottomRight!!) + lons.add(rect.topLeft!!) + listRect[i].setPoints(lons) + } + } + } + } + + } + ) + + + } + + if(isDrawRoadCross){ + RoadHelper.getInstance()?.getCrossRoad(lonlatPoint.longitude, lonlatPoint.latitude,lonlatPoint.angle.toFloat(), + object:IResult{ + override fun result(code: Int, roadCross: RoadCross?) { + roadCross?.let { + if(it.status == 1) { + RoadHelper.getInstance() + ?.getCrossRoadById(it.tile_id.toInt(), it.cross_id.toLong(),object : + IResult>{ + override fun result( + code: Int, + list: ArrayList? + ) { + list?.let{ list-> + if (crossLine == null) { + crossLine = mapAutoView?.getMapAutoViewHelper()?.drawThickLine( + PolylineOptions(mapAutoView.getMapController()).setGps(true) + .color(Color.argb(255, 255, 0, 0)) + .lineWidth(5f).lonLatPoints(list) + ) + } else { + crossLine?.setPoints(list) + } + } + } + + }) + + } + } + } + + }) + + + } + + monitorGetZebraLine(lonlatPoint, mapAutoView) + + } + + fun monitorDelLine(){ + if(centerLine != null){ + centerLine?.remove() + centerLine = null + } + if(stopLine != null){ + stopLine?.remove() + stopLine = null + } + if(listRect != null && listRect.size > 0){ + for (line in listRect){ + line.remove() + } + listRect.clear() + } + + } + + + fun monitorWifiEnable() { + val j = (Math.random() * 1000).toInt() + if(j==1){ + val enable = (Math.random() * 200).toInt() < 100 + updateWifiEnable(enable) + } + } + + + fun monitorOtherCars(mapAutoView: MapAutoView) { + mMarkerCacheController?.destory() + mMarkerCacheController = MarkerCacheController(mapAutoView) + mapAutoView.getMapAutoViewHelper()?.setAnchorGradientColor("#6EC9F9FF","#CA4E56FF",10f, 5f) + othercarFlag = true + mapAutoView?.getLocationClient()?.setIsUseExtraGPSData(true) + mOtherCarJob?.cancel() + mOtherCarJob = mTaskScope?.launch(Dispatchers.Default) { + var duration: Long = (Math.random() * DURATION_MAX).toLong() + + var targetIndex = (Math.random() * TARGET_INDEX_MAX).toInt() + try { + //分行读取 + for ((index, batchData) in otherCarList.withIndex()) { + if (othercarFlag) { + break + } + if (index < targetIndex) { + continue + } + + mMarkerCacheController?.addCache(batchData) + val centerMarkerOptions = batchData.centerMarkerOptions + if(centerMarkerOptions == null){ + continue + } + //绘制中心线以及停止线 + lineDatastep++ + if (lineDatastep >= 2) { + lineDatastep = 0 + loadDataAPI(LonLatPoint(centerMarkerOptions?.lon,centerMarkerOptions?.lat,centerMarkerOptions?.rotateAngle.toDouble()),mapAutoView, true, true, true, true) + } + delay(duration) + } + + } catch (e: IOException) { + e.printStackTrace() + } + } + } + + + + suspend fun loadTrackDataToMemory(path: String, index: Int, isAssets: Boolean) { + var inputreader: InputStreamReader? = null + var buffreader: BufferedReader? = null + var inputStream: InputStream? = null + try{ + try { + if(isAssets) { + inputStream = context?.assets?.open(path) + }else{ + inputStream = FileInputStream(path) + } + } catch (e: FileNotFoundException) { + return + } + var line: String? = null + inputreader = InputStreamReader(inputStream) + buffreader = BufferedReader(inputreader) + var list = ArrayList() + //分行读取 + while (buffreader != null && buffreader?.readLine().also({ line = it }) != null) { + val lines = line!!.split(",") + val lonLatPoint = LonLatPoint() + lonLatPoint.longitude = lines[1].trim().toDouble() + lonLatPoint.latitude = lines[2].trim().toDouble() + lonLatPoint.angle = lines[4].trim().toDouble() + list.add(lonLatPoint) + } + trackMap.put(index, list) + } catch (e: IOException) { + e.printStackTrace() + } finally { + + try { + buffreader?.close() + } catch (e: IOException) { + } + try { + inputreader?.close() + } catch (e: IOException) { + } + try { + inputStream?.close() + } catch (e: IOException) { + } + } + + } + + suspend fun LoadOtherCarsToMemory(path: String) { + + var inputreader: InputStreamReader? = null + var buffreader: BufferedReader? = null + var inputStream: InputStream? = null + try { + inputStream = context?.assets?.open(path) + } catch (e: FileNotFoundException) { + return + } + inputreader = InputStreamReader(inputStream) + buffreader = BufferedReader(inputreader) + var line: String? = null + try { + //分行读取 + while (buffreader != null && buffreader?.readLine().also({ line = it }) != null) { + val lines = line!!.split(";") + val count = lines.size + var batchData = MarkerBatchData() + var centerMarkerOptions = MarkerSimpleOptions() + val idList = ArrayList() + val currentMarkerList = ArrayList() + for (i in 0 until count) { + val other = lines[i].split(",") + var id:Long + var lon:Double + var lat:Double + var angle:Double + var type:Int + if (i == 0) { + id = other[1].trim().toLong() + lon = other[2].trim().toDouble() + lat = other[3].trim().toDouble() + angle = other[5].trim().toDouble() + type = other[7].trim().toInt() + } else { + id = other[0].trim().toLong() + lon = other[1].trim().toDouble() + lat = other[2].trim().toDouble() + angle = other[4].trim().toDouble() + type = other[6].trim().toInt() + } + if (i == count - 1) { + centerMarkerOptions.lon = lon + centerMarkerOptions.lat = lat + centerMarkerOptions.alt = 0.0 + centerMarkerOptions.rotateAngle = angle.toFloat() + batchData.centerMarkerOptions = centerMarkerOptions + }else{ + val simpleData = MarkerSimpleData() + simpleData.id = id + simpleData.lon = lon + simpleData.lat = lat + simpleData.rotateAngle = angle.toFloat() + simpleData.markerType = type + simpleData.color = TaskManager.instance.getRandomColorStr() + if (idList.contains(id)) { + continue + } + idList.add(id) + currentMarkerList.add(simpleData) + } + + } + batchData.others = currentMarkerList + otherCarList.add(batchData) + + } + + } catch (e: IOException) { + e.printStackTrace() + } finally { + + try { + buffreader?.close() + } catch (e: IOException) { + } + try { + inputreader?.close() + } catch (e: IOException) { + } + try { + inputStream?.close() + } catch (e: IOException) { + } + } + } + + suspend fun monitorSelfCar(trackIndex: Int,mapAutoView:MapAutoView) { + randomTrackFlag = true + mTrackJob?.cancel() + mapAutoView?.getLocationClient()?.setIsUseExtraGPSData(true) + mTrackJob = mTaskScope?.launch(Dispatchers.Default) { + var duration: Long = (Math.random() * DURATION_MAX).toLong() + try { + var targetIndex = (Math.random() * TARGET_INDEX_MAX).toInt() + //分行读取 + val list = trackMap.get(trackIndex) + if (list == null || list.isEmpty()) { + return@launch + } + for ((index, lonlatPoint) in list.withIndex()) { + if (!randomTrackFlag) { + break + } + if (index < targetIndex) { + continue + } + monitorLocation(lonlatPoint,mapAutoView) + MapDataApi.getLimitSpeed(lonlatPoint.longitude,lonlatPoint.latitude,lonlatPoint.angle.toFloat(),object : + IResult{ + override fun result(code: Int, roadInfo: RoadInfo?) { + + } + }) + RoadHelper.getInstance()?.getZebraLine(lonlatPoint.longitude,lonlatPoint.latitude,lonlatPoint.angle.toFloat(),object : + IResult{ + override fun result(code: Int, result: String?) { + + } + + }) + RoadHelper.getInstance()?.getTrafficLight(lonlatPoint.longitude,lonlatPoint.latitude,lonlatPoint.angle.toFloat(),object :IResult{ + override fun result(code: Int, result: String?) { + + } + + }) + RoadHelper.getInstance()?.getCenterLineRange(lonlatPoint.longitude,lonlatPoint.latitude,lonlatPoint.angle.toFloat(), 10f,object :IResult{ + override fun result(code: Int, result: CenterLine?) { + + } + + }) + RoadHelper.getInstance()?.getCenterLineRoadNode(lonlatPoint.latitude, lonlatPoint.latitude, lonlatPoint.angle.toFloat(), 300f,object :IResult{ + override fun result(code: Int, result: CenterLine?) { + + } + + }) + delay(duration) + } + } catch (e: Exception) { + e.printStackTrace() + } + } + + } + + + suspend fun monitorSelfCar(mapAutoView: MapAutoView, trackIndex: Int) { + randomTrackFlag = true + mTrackJob?.cancel() + mapAutoView?.getLocationClient()?.setIsUseExtraGPSData(true) + mTrackJob = mTaskScope?.launch(Dispatchers.Default) { + while (true) { + var duration: Long = (Math.random() * DURATION_MAX).toLong() + try { + for (i in 0 until trackIndex) { + //分行读取 + val list = trackMap.get(i) + if (list == null || list.isEmpty()) { + return@launch + } + for ((index, lonlatPoint) in list.withIndex()) { + if (!randomTrackFlag) { + break + } + monitorLocation(lonlatPoint, mapAutoView) + + delay(duration) + + } + } + } catch (e: Exception) { + e.printStackTrace() + Log.d("wyj", e.printStackTrace().toString()) + } + } + } + + } + + suspend fun monitorDataAPI(trackIndex: Int,mapAutoView: MapAutoView) { + dataFlag = true + mDataJob?.cancel() + mDataJob = mTaskScope?.launch(Dispatchers.Default) { + var duration: Long = (Math.random() * DURATION_MAX).toLong() + try { + var targetIndex = (Math.random() * 2000).toInt() + //分行读取 + val list = trackMap.get(trackIndex) + if (list == null || list.isEmpty()) { + return@launch + } + for ((index, lonlatPoint) in list.withIndex()) { + if (!dataFlag) { + break + } + if (index < targetIndex) { + continue + } + loadDataAPI(lonlatPoint,mapAutoView, true, true, true, true) + delay(duration) + } + } catch (e: Exception) { + e.printStackTrace() + } + } + + } + + suspend fun monitorMarkerAdd(trackIndex: Int,mapAutoView: MapAutoView) { + markerFlag = true + mapAutoView?.getLocationClient()?.setIsUseExtraGPSData(true) + mMarkerJob?.cancel() + mMarkerJob = mTaskScope?.launch(Dispatchers.Default) { + var targetIndex = (Math.random() * TARGET_INDEX_MAX).toInt() + var duration: Long = (Math.random() * DURATION_MAX).toLong() + try { + val list = trackMap.get(trackIndex) + if (list == null || list.isEmpty()) { + return@launch + } + for ((index, lonlatPoint) in list.withIndex()) { + if (!markerFlag) { + break + } + if (index < targetIndex) { + continue + } + monitorLocation(lonlatPoint, mapAutoView) + add3DMarker((Math.random() * 1000).toString(),lonlatPoint.longitude, lonlatPoint.latitude, lonlatPoint.angle, mapAutoView) + delay(duration) + } + + } catch (e: IOException) { + e.printStackTrace() + } finally { + + } + } + + } + + suspend fun monitor2DMarkerAdd(trackIndex: Int, mapAutoView: MapAutoView) { + marker2DFlag = true + mapAutoView.getMapAutoViewHelper()?.setIsUseExtraGPSData(true) + m2DMarkerJob?.cancel() + m2DMarkerJob = mTaskScope?.launch(Dispatchers.Default) { + var targetIndex = (Math.random() * TARGET_INDEX_MAX).toInt() + var duration: Long = (Math.random() * DURATION_MAX).toLong() + val location = MogoLocation() + try { + val list = trackMap.get(trackIndex) + if (list == null || list.isEmpty()) { + return@launch + } + for ((index, lonlatPoint) in list.withIndex()) { + if (!marker2DFlag) { + break + } + if (index < targetIndex) { + continue + } + monitorLocation(lonlatPoint, mapAutoView) + + add2DMarker((Math.random() * 100).toString(),lonlatPoint.longitude,lonlatPoint.latitude,lonlatPoint.angle, mapAutoView) + delay(duration) + } + + } catch (e: IOException) { + e.printStackTrace() + } finally { + + } + } + + } + suspend fun monitorPolygin3DAdd(trackIndex: Int,mapAutoView: MapAutoView) { + polygonFlag = true + mapAutoView?.getLocationClient()?.setIsUseExtraGPSData(true) + mPolygonJob?.cancel() + mPolygonJob = mTaskScope?.launch(Dispatchers.Default) { + var targetIndex = (Math.random() * TARGET_INDEX_MAX).toInt() + var duration: Long = (Math.random() * DURATION_MAX).toLong() + try { + val list = trackMap.get(trackIndex) + if (list == null || list.isEmpty()) { + return@launch + } + for ((index, lonlatPoint) in list.withIndex()) { + if (!polygonFlag) { + break + } + if (index < targetIndex) { + continue + } + monitorLocation(lonlatPoint, mapAutoView) + when(trackIndex%4){ + 0->{ + add3DPolygin(lonlatPoint.longitude, lonlatPoint.latitude, mapAutoView) + } + 1->{ + addCircle(lonlatPoint.longitude, lonlatPoint.latitude, mapAutoView) + } + 2->{ + addRect(lonlatPoint.longitude, lonlatPoint.latitude, mapAutoView) + } + 3->{ + addOvil(lonlatPoint.longitude, lonlatPoint.latitude, mapAutoView) + } + } + delay(duration) + } + + } catch (e: IOException) { + e.printStackTrace() + } finally { + + } + } + + } + + + suspend fun monitorCarLight(mapAutoView: MapAutoView) { + val mode = (Math.random()*20 % 5).toInt() + mapAutoView.getMapAutoViewHelper()?.setTailLightsType(mode, 500) + + } + + fun setIsChangeColor(isChange: Boolean){ + isChangeColor = isChange + + } + + fun setIsShowBright(isShow: Boolean){ + isShowBirght = isShow + + } + fun setBrightSpeed(brightSpeed: Float){ + this.brightSpeed = brightSpeed + + } + + fun monitorUpdateCache(){ + mUpdateFlag = true + mUpdateCacheJob?.cancel() + mUpdateCacheJob = mTaskScope?.launch(Dispatchers.Default) { + while (mUpdateFlag){ + MapDataApi.modifyRedisFileVersion(288) + MapDataApi.updateCacheFile() + delay(5*1000) + } + } + } + + fun logTest(){ + MapAutoApi.setLogLevel((Math.random() * 3).toInt()) + } + + fun monitorShowInfoWindow(){ + if(!markerMap.isEmpty()){ + for (key in markerMap.keys) { + if(markerMap.containsKey(key)){ + if ((Math.random()*100).toInt()%3 == 0) { + var marker = markerMap.get(key) + if(marker?.isInfoWindowShown()!!){ + marker?.hideInfoWindow() + }else { + marker?.showInfoWindow() + } + } + + } + } + } + } + + fun monitorThreadPool(){ + threadPoolExecutor?.execute(Runnable { + try { +// FileUtils.copyDirect(context?.resources?.assets!!, "othercar", "test") + Thread.sleep(1000) + } catch (e: InterruptedException) { + e.printStackTrace() + } + }) + + } + + fun monitorThread(){ + for(i in 0 .. 8){ + val thread: Thread = object : Thread() { + override fun run() { +// FileUtils.deleteDirectory( "test") + sleep(1000) + } + } + thread.start() + } + } + + + fun logTest(tv: TextView){ + val type = (Math.random() * 3).toInt() + CommonController.instance.scope?.launch(Dispatchers.Main) { + when(type){ + + 0->{ + tv.text = "error" + } + 1->{ + tv.text = "warn" + } + 2->{ + tv.text = "info" + } + } + } + + NLog.setLevel(type) + + } + + + fun monitorCacheHdData(mapAutoView: MapAutoView) { + val lonLatPoint = mapAutoView.getCurrentLonLatPoint() + RoadHelper.getInstance()?.getCityCode(lonLatPoint.longitude, lonLatPoint.latitude,object : + IResult { + override fun result(code: Int, id: Int?) { + id?.let { + mapAutoView.getMapAutoViewHelper()?.cacheHDDataByCity(id, object : + OnHdDataDownByCityListener { + override fun onMapHDDataCacheProgressByCity(id: Int, progress: Double) { + Log.d("TAG", "id: ${id}, progerss: ${progress}") + } + + override fun onMapHDDataCacheStateByCity(id: Int, state: Int) { + Log.d("TAG", "id: ${id}, state: ${state}") + } + }) + } + + } + }) + + } + + fun monitorCacheHdData(mapAutoView: MapAutoView, tv: TextView){ + val lonLatPoint = mapAutoView.getCurrentLonLatPoint() + RoadHelper.getInstance()?.getCityCode(lonLatPoint.longitude, lonLatPoint.latitude,object : + IResult { + override fun result(code: Int, id: Int?) { + id?.let { + mapAutoView.getMapAutoViewHelper()?.cacheHDDataByCity(id, object : + OnHdDataDownByCityListener { + override fun onMapHDDataCacheProgressByCity(id: Int, progress: Double) { + CommonController.instance.scope?.launch(Dispatchers.Main) { + tv.text = "${id}, ${progress}" + } + + } + + override fun onMapHDDataCacheStateByCity(id: Int, state: Int) { + CommonController.instance.scope?.launch(Dispatchers.Main) { + if (state == 0) { + tv.text = "下载失败" + + } else { + tv.text = "下载成功" + } + } + } + }) + + } + } + }) + + + } + + fun monitorGetAllCityCode(){ + RoadHelper.getInstance()?.getAllCityCode(object :IResult>{ + override fun result(code: Int, result: ArrayList?) { + + } + + }) + + } + + fun monitorGetAllCityCode(tv: TextView){ + RoadHelper.getInstance()?.getAllCityCode(object :IResult>{ + override fun result(code: Int, result: ArrayList?) { + tv.text = "${result}" + } + }) + } + + + fun monitorCancleCacheHdData() { + RoadHelper.Companion.getInstance()?.cancelCacheHDData() + } + + fun monitorGetDataVersion(mapAutoView: MapAutoView){ + var center = DoubleArray(2) + mapAutoView.getMapController()?.getCenter(center) + RoadHelper.getInstance()?.getHdDataVersionByCity(center[0], center[1],object: + IResult { + override fun result(code: Int, result: String?) { + + } + + }) + } + + fun monitorGetDataVersion(tv: TextView, mapAutoView: MapAutoView){ + var center = DoubleArray(2) + mapAutoView.getMapController()?.getCenter(center) + RoadHelper.getInstance()?.getHdDataVersionByCity(center[0], center[1],object: + IResult { + override fun result(code: Int, version: String?) { + tv.text = "数据版本:${version}" + } + + }) + + } + + + fun monitorGetCenterLineRange(lonlatPoint: LonLatPoint, mapAutoView: MapAutoView) { + + val location = MogoLocation() + location.provider = "GPS_RTK" + location.lon = lonlatPoint.longitude + location.lat = lonlatPoint.latitude + location.heading = lonlatPoint.angle + + + MapDataApi.getCenterLineRangeInfo(lonlatPoint.longitude, lonlatPoint.latitude,lonlatPoint.angle.toFloat(), 300f,object :IResult{ + override fun result(code: Int, line: CenterLine?) { + var valuesArr = arrayListOf() + line?.let { + centerlons.clear() + it.points?.let { + centerlons = CopyOnWriteArrayList(it) + if (centerLine == null) { + valuesArr.clear() + valuesArr.add(Color.argb(255, 46, 220, 255)) + valuesArr.add(Color.argb(0, 46, 220, 255)) + + centerLine = mapAutoView?.getMapAutoViewHelper()?.drawThickLine( + PolylineOptions(mapAutoView.getMapController()).setGps(true) + .colorValues(valuesArr) + .useGradient(true).lineWidth(20f) + .lonLatPoints(centerlons).zIndex(65000f) + .setBrightColor(Color.argb(255, 255, 255, 255)) + .setBrightSpeed(brightSpeed) + .setIsBright(isShowBirght) + ) + } else { + centerLine?.setPoints(centerlons) + if (isChangeColor) { + valuesArr.clear() + valuesArr.add(Color.argb(255, 255, 77, 0)) + valuesArr.add(Color.argb(255, 255, 188, 43)) + valuesArr.add(Color.argb(0, 46, 220, 255)) + centerLine?.setOption( + centerLine?.getPolyLineOptions()?.colorValues(valuesArr) + ?.setIsBright(isShowBirght)?.setBrightSpeed(brightSpeed) + ) + } else { + valuesArr.clear() + valuesArr.add(Color.argb(255, 46, 220, 255)) + valuesArr.add(Color.argb(0, 46, 220, 255)) + centerLine?.setOption( + centerLine?.getPolyLineOptions()?.colorValues(valuesArr) + ?.setIsBright(isShowBirght)?.setBrightSpeed(brightSpeed) + ) + } + } + } + } + } + + }) + + } + + private var zebraLineMap: ConcurrentHashMap = ConcurrentHashMap() + fun monitorGetZebraLine(lonlatPoint: LonLatPoint, mapAutoView: MapAutoView){ + val delelteLineList = CopyOnWriteArrayList() + val currentLineList = CopyOnWriteArrayList() + RoadHelper.getInstance()?.getZebraLineByDistance(lonlatPoint.longitude, lonlatPoint.latitude, lonlatPoint.angle.toFloat(), 100f,object : + IResult>{ + override fun result(code: Int, zebraLineList: MutableList?) { + zebraLineList?.let{ + val list = CopyOnWriteArrayList(it) + var colors = java.util.ArrayList() + colors.add(Color.argb(255, 0, 255, 0)) + colors.add(Color.argb(0, 0, 255, 0)) + for(zebraLine in list) { + var line = zebraLineMap.get(zebraLine.id) + if (line == null) { + zebraLine.zebraLineList?.let { + val list = java.util.ArrayList() + list.addAll(it) + list.add(it[0]) + line = mapAutoView?.getMapAutoViewHelper()?.drawThickLine( + PolylineOptions(mapAutoView.getMapController()).setGps(true) + .colorValues(colors) + .lonLatPoints(list) + .zIndex(65000f) + .lineWidth(1f) + .useGradient(true) + .useFacade(true)//立面 + .maxIndex(2000000f) + )//高度 + } + } + line?.let { + zebraLineMap.put(zebraLine.id, it) + } + currentLineList.add(zebraLine.id) + } + + } + } + + }) + + + + + + for (key in zebraLineMap.keys) { + if (!currentLineList.contains(key)) { + delelteLineList.add(key) + } + } + + for (value in delelteLineList) { + val zebraLine = zebraLineMap.get(value) + zebraLine?.remove() + zebraLineMap.remove(value) + } + + } + + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/ThreadPoolUtils.java b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/ThreadPoolUtils.java new file mode 100644 index 0000000000..4133a09f37 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/ThreadPoolUtils.java @@ -0,0 +1,23 @@ +package com.zhidaoauto.map.sdk.open.tools; + +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +public class ThreadPoolUtils { + public static ThreadPoolExecutor executor; + + public static ThreadPoolExecutor getThreadPool() { + if (executor == null) { + executor = new ThreadPoolExecutor(5, 10, 200, TimeUnit.MILLISECONDS, + new ArrayBlockingQueue(5)); + } + return executor; + } + + public static void shutDown() { + if (executor != null) { + executor.shutdown(); + } + } +} diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/VisibleRegion.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/VisibleRegion.kt new file mode 100644 index 0000000000..7f806f20bb --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/tools/VisibleRegion.kt @@ -0,0 +1,10 @@ +package com.zhidaoauto.map.sdk.open.tools + +import com.zhidaoauto.map.sdk.open.query.LonLatPoint + +class VisibleRegion { + var leftTopPoint: LonLatPoint? = null + var leftBottomPoint: LonLatPoint? = null + var rightTopPoint: LonLatPoint? = null + var rightBottomPoint: LonLatPoint? = null +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/view/MapAutoView.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/view/MapAutoView.kt new file mode 100644 index 0000000000..f0a572321b --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/view/MapAutoView.kt @@ -0,0 +1,1043 @@ +package com.zhidaoauto.map.sdk.open.view + +import android.content.Context +import android.os.Bundle +import android.os.Handler +import android.os.Message +import android.util.AttributeSet +import android.util.Log +import android.widget.FrameLayout +import com.autonavi.nge.map.* +import com.zhidao.map.net.api.Result +import com.zhidaoauto.map.sdk.BuildConfig +import com.zhidaoauto.map.sdk.R +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.* +import com.zhidaoauto.map.sdk.inner.common.ConstantExt +import com.zhidaoauto.map.sdk.inner.controller.MapEventController +import com.zhidaoauto.map.sdk.inner.location.LocationHelper +import com.zhidaoauto.map.sdk.inner.map.MapController +import com.zhidaoauto.map.sdk.inner.map.MapHdDataHelper +import com.zhidaoauto.map.sdk.inner.map.MapStyleHelper +import com.zhidaoauto.map.sdk.inner.panel.PanelManager +import com.zhidaoauto.map.sdk.inner.road.RoadHelper +import com.zhidaoauto.map.sdk.inner.traffic.TrafficHelper +import com.zhidaoauto.map.sdk.inner.use.Clerk +import com.zhidaoauto.map.sdk.inner.utils.Constants +import com.zhidaoauto.map.sdk.inner.utils.SunriseSunset +import com.zhidaoauto.map.sdk.inner.utils.TransformUtils +import com.zhidaoauto.map.sdk.open.MapAutoApi +import com.zhidaoauto.map.sdk.open.MapParams +import com.zhidaoauto.map.sdk.open.abs.* +import com.zhidaoauto.map.sdk.open.abs.view.IMapStyleParams +import com.zhidaoauto.map.sdk.open.data.MapDataApi +import com.zhidaoauto.map.sdk.open.location.LocationClient +import com.zhidaoauto.map.sdk.open.location.LonLatPointListener +import com.zhidaoauto.map.sdk.open.location.MogoLocation +import com.zhidaoauto.map.sdk.open.marker.MarkerController +import com.zhidaoauto.map.sdk.open.marker.OnMarkClickListener +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.road.CenterLine +import com.zhidaoauto.map.sdk.open.road.RoadCross +import com.zhidaoauto.map.sdk.open.road.StopLine +import com.zhidaoauto.map.sdk.open.view.MapStyleParams.Companion.MAP_PERSPECTIVE_3D +import com.zhidaoauto.map.sdk.open.weather.WeatherRepository +import com.zhidaoauto.map.sdk.open.weather.WeatherType +import kotlinx.coroutines.* +import java.lang.Runnable +import java.util.* + +open class MapAutoView : FrameLayout, LonLatPointListener, ITraffic,ILockLocation { + + private val TAG = javaClass.simpleName + + //The instance of MapView + private var mMapView: MapView? = null + //The instance of IMapStyleParams + private var mMapStyleParams: IMapStyleParams? = null + //The controller of map + protected var mMapController: IMapController? = null + //The controller of marker + protected var mMarkerController: IMarkerController? = null + //The controller of event + protected var mEventController: IEventController? = null + //The manager of panel + protected var mPanelManager: PanelManager? = null + //The view of location + protected var mLocationView: ILocationView? = null + //The helper of MapView + private var mMapAutoViewHelper: MapAutoViewHelper? = null + + + //Longtitude + private var mLocationLon: Double = 0.0 + //Latitude + private var mLocationLat: Double = 0.0 + //Alt + private var mLocationAlt: Float = 0f + //Angle + private var mLocationHeading: Double = 0.0 + + //The status of init + private var isFirst = true; + //The model of lock the car + private var lockMode: Boolean = true + //The moving status of animal + private var isMoveAnim: Boolean = true + + //The module of locaton + private var locationClient: LocationClient? = null + //The helper of TMC + private var mTrafficHelper: TrafficHelper? = null + + //The last time of update + private var lastUpdateTime: Long = 0 + //The last of the last time of update + private var againLastUpdateTime: Long = 0 + //The last time of load the info of the road + private var mLastTimeRoadInfo = 0L + //The interval time of load the info of the road + private var mIntervalTimeRoadInfo = 3000L + //The job of load the info of the road + private var roadInfoJob: Job? = null + //The job of update Cache + private var updateCacheJob: Job? = null + //The job of update weather + private var updateWeatherJob: Job? = null + + //The message of the update style of the map + private val MSG_MAP_STYLE = 0 + //The message of the update center of the map + private val MSG_SET_CENTER = 1 + //The message of the update location of the map + private val MSG_DRAW_LOCATION = 2 + //The message of the update init status of the map + private val MSG_MAP_INIT = 3 + + //The instance of SunriseSunset + private var mSunriseSunset: SunriseSunset? = null + + //The animation interval of Map + private var duration = 100 + //whether to set weather + private var isWeatherEnable = true + private var isFirstLocation = true + private var loopFlag: Boolean = false + private val weatherRepository by lazy { WeatherRepository() } + private var isFirstInit = true + + constructor(context: Context) : super(context) { + initView() + } + + constructor(context: Context,mapStyleParams: MapStyleParams) : super(context) { + this.mMapStyleParams = mapStyleParams + initView() + } + + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { + obtainMapStyleParams(context,attrs) + initView() + } + + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( + context, + attrs, + defStyleAttr + ) { + obtainMapStyleParams(context,attrs) + initView() + } + + private fun initView() { + init(context) + } + + + fun obtainMapStyleParams(context: Context, attrs: AttributeSet?){ + // 获取自定义属性值 + val typedArray = context.obtainStyledAttributes(attrs, R.styleable.MapAutoView) + var zoom = typedArray.getInt(R.styleable.MapAutoView_zoom, 20) + if(zoom < 9 && zoom > 23){ + zoom = 20 + } + val carPosition = typedArray.getFloat(R.styleable.MapAutoView_carPosition, ConstantExt.MAP_STYLE_VR_POSITION_MIDDLE) + val isAutoSwitch = typedArray.getBoolean(R.styleable.MapAutoView_isAutoSwitch, false) + val isAutoLocation = typedArray.getBoolean(R.styleable.MapAutoView_isAutoLocation, true) + val styleMode = typedArray.getInt(R.styleable.MapAutoView_styleMode, MapAutoApi.MAP_STYLE_NIGHT_VR) + val perspectiveMode = typedArray.getInt(R.styleable.MapAutoView_perspectiveMode, MAP_PERSPECTIVE_3D) + val vrPerspectiveMode = typedArray.getFloat(R.styleable.MapAutoView_vrPerspectiveMode, ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_MIDDLE) + val vrAngleMode = typedArray.getInt(R.styleable.MapAutoView_vrAngleMode, ConstantExt.MAP_STYLE_VR_ANGLE_MIDDLE) + val isSwitchViewAngle = typedArray.getBoolean(R.styleable.MapAutoView_isSwitchViewAngle, false) + val vrEyeHeight = typedArray.getFloat(R.styleable.MapAutoView_vrEyeHeight, ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_MIDDLE) + val zoomVal = typedArray.getFloat(R.styleable.MapAutoView_zoomVal, ConstantExt.MAP_STYLE_VR_ZOOM_VAL_MIDDLE) + val minDistanceForPosition = typedArray.getFloat(R.styleable.MapAutoView_minDistanceForPosition, 0.02f) + val isShadowEnable = typedArray.getBoolean(R.styleable.MapAutoView_isShadowEnable, true) + val styleName = typedArray.getString(R.styleable.MapAutoView_styleName) ?: "" + val defaultPerspective = typedArray.getInt(R.styleable.MapAutoView_default_perspective, ConstantExt.MAP_STYLE_VR_ANGLE_MIDDLE) + val isSkyBoxEnable = typedArray.getBoolean(R.styleable.MapAutoView_isSkyBoxEnable, false) + val isWeatherEnable = typedArray.getBoolean(R.styleable.MapAutoView_isWeatherEnable, true) + typedArray.recycle() + val mapStyleParams = MapStyleParams() + mapStyleParams.setZoom(zoom) + mapStyleParams.setCarPosition(carPosition) + mapStyleParams.setAutoSwitch(isAutoSwitch) + mapStyleParams.setAutoLocation(isAutoLocation) + mapStyleParams.setStyleMode(styleMode) + mapStyleParams.setVrPerspectiveMode(vrPerspectiveMode) + mapStyleParams.setPerspectiveMode(perspectiveMode) + mapStyleParams.setVrAngleMode(vrAngleMode) + mapStyleParams.setSwitchViewAngle(isSwitchViewAngle) + mapStyleParams.setVrEyeHeight(vrEyeHeight) + mapStyleParams.setZoomVal(zoomVal) + mapStyleParams.setMinDistanceForPosition(minDistanceForPosition) + mapStyleParams.setShadowEnable(isShadowEnable) + mapStyleParams.setStyleName(styleName) + mapStyleParams.setDefaultPerspective(defaultPerspective) + mapStyleParams.setIsSkyBoxEnable(isSkyBoxEnable) + mapStyleParams.setIsWeatherEnable(isWeatherEnable) + this.mMapStyleParams = mapStyleParams + } + + /** + * init map + */ + private fun init(context: Context) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-mapop-loadop-start--init--renderop") + } + if(mMapStyleParams == null){ + mMapStyleParams = MapStyleParams() + } +// CommonController.instance.init(context) + handlerInitMapView() + locationClient = LocationClient(context,mMapController) + locationClient?.outputLocationEnable(true) + locationClient?.mapLocationListener = this + mMapStyleParams?.let { + if(it.getAutoLocation()) { + locationClient?.start() + } + } + isWeatherEnable = mMapStyleParams?.getIsWeatherEnable()?:true + + +// mTrafficHelper = TrafficHelper() + } + + /** + * processing map initialization + */ + private fun handlerInitMapView() { + //BuildConfig.MODE: 1.offline 2.online 3.VR + if (MapStyleHelper.loadStyleOver.get() && ((MapHdDataHelper.loadDataOver.get() && BuildConfig.MODE >= 3) || BuildConfig.MODE < 3)) { + initMapView() + } else { + mHandler.removeCallbacksAndMessages(MSG_MAP_INIT) + mHandler.sendEmptyMessageDelayed(MSG_MAP_INIT, 50) + } + } + + fun getMapStyleParams():IMapStyleParams?{ + return mMapStyleParams + } + + fun getLocationView():ILocationView?{ + return mLocationView + } + + fun getMapController():IMapController?{ + return mMapController + } + + fun getMarkerController():IMarkerController?{ + return mMarkerController + } + + fun getEventController():IEventController?{ + return mEventController + } + + fun getPanelManager():PanelManager?{ + return mPanelManager + } + + fun getLocationClient(): LocationClient? { + return locationClient + } + + fun getClerk():Clerk?{ + return mMapController?.getClerk() + } + + + override fun setLockCar(lock: Boolean) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-lockop-mapop-lockcarop--setLockCar:${lockMode}-->${lock}:${Thread.currentThread().id}") + } + mMapController?.setLockSelfCar(lock) + if (!lock) { + mMapController?.setConstAnchorPositionFlag(true) + mMapController?.shakeMapManual() + } else { + isMoveAnim = false; + if(mLocationLon > 0 && mLocationLat > 0){ + setCenter() + } + } + lockMode = lock + } + + override fun getLockCar(): Boolean { + return lockMode + } + + + fun initMapView() { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-mapop-initMapView--start") + } + + mMapStyleParams?.let { mMapStyleParams -> + // init MapView + mMapView = MapView(context, mMapStyleParams, this@MapAutoView) + + + if(mEventController == null){ + mEventController = MapEventController() + } + + mMapView?.let { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-mapop-create--${mMapView}") + } + it.setEventController(mEventController) + addView(it) + + mMapController = + MapController(context, it, this@MapAutoView, mEventController, mMapStyleParams) + + mMapController?.let { mapController -> + mMarkerController = MarkerController(mapController) + mapController.setMarkerController(mMarkerController) + } + + + + mLocationView = LocationHelper(context, mMarkerController, mMapController) + mMapController?.setLocalView(mLocationView) + + it.setMapController(mMapController) + it.mITraffic = this@MapAutoView + // init PanelManager + mPanelManager = PanelManager(this@MapAutoView, context, mMapController) + } + } + + + + mMapAutoViewHelper = MapAutoViewHelper(this@MapAutoView) + mPanelManager?.setPanel(PanelManager.PANEL_WHAT_SET_MODE, PanelManager.PANEL_MODE_SDK_MAIN) + mMapController?.setFollowCarMode(true) + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-mapop-initMapView--over") + } +// mHandler.sendEmptyMessage(MSG_MAP_STYLE) + } + + fun onLocationChanged(mogoLocation: MogoLocation) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-locationop-lockop-onLocationChanged-location:${mogoLocation},${mLocationLat},${mLocationLon},${mMapView}") + } + if (mMapView == null) { + return; + } + mMapStyleParams?.let { + // Use the previous position for small displacements + if(mogoLocation.distance != 0.0 && mogoLocation.distance < it.getMinDistanceForPosition()){ + if(mLocationLon != 0.0 && mLocationLat != 0.0){ + mogoLocation.lon = mLocationLon + mogoLocation.lat = mLocationLat + mogoLocation.alt = mLocationAlt.toDouble() + mogoLocation.heading = mLocationHeading + } + } + } + + val lonLatPoint = LonLatPoint(mogoLocation.lon, mogoLocation.lat,mogoLocation.altitude,mogoLocation.heading) + lonLatPoint.provider = mogoLocation.provider + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop---locationop-lockop-centerop--getMyLocationStyle-setLonLat:${lonLatPoint},lockMode:${getLockCar()}") + } + onLocationChanged(lonLatPoint) + extendLocationChanged(mogoLocation) + } + + override fun onLocationChanged(lonLatPoint: LonLatPoint){ + if(mMapView == null){ + return + } + mMapStyleParams?.let { + // Use the previous position for small displacement + if(lonLatPoint.distance != 0.0 && lonLatPoint.distance < it.getMinDistanceForPosition()){ + if(mLocationLon != 0.0 && mLocationLat != 0.0){ + lonLatPoint.longitude = mLocationLon + lonLatPoint.latitude = mLocationLat + lonLatPoint.altitude = mLocationAlt.toDouble() + lonLatPoint.angle = mLocationHeading + } + } + } + + if(CompileConfig.DEBUG) { + Log.i(TAG, "autoop-locationop-lockop-onLocationChanged-location:${lonLatPoint}") + } + if (isFirst || getLockCar()) { + isFirst = false + //The loading status of the map + if (isLoad()) { + // The loaded status + updateMapPosition(lonLatPoint) + } else { + // The other status + val msg = Message.obtain() + msg.what = MSG_DRAW_LOCATION + msg.obj = lonLatPoint + mHandler.sendMessage(msg) + } + } else { + var lonLat = LonLat(lonLatPoint.longitude, lonLatPoint.latitude) + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop---locationop-lockop-centerop--elseop-setLonLat:${lonLat},${lonLatPoint.angle}") + } + mLocationLon = lonLatPoint.longitude + mLocationLat = lonLatPoint.latitude + mLocationAlt = lonLatPoint.altitude.toFloat() + mLocationHeading = lonLatPoint.angle + mLocationView?.getMyLocationStyle()?.setLonLat(lonLat, lonLatPoint.angle) + mMapStyleParams?.let { + if(it.getVrAngleMode() == ConstantExt.MAP_STYLE_VR_ANGLE_FAR + && TransformUtils.outOfScreen(context, lonLatPoint.longitude, lonLatPoint.latitude,mMapController)){ + setCenter() + mMapController?.resetChangeAngleTime() + } + } + + + } + val mogoLocation = MogoLocation() + mogoLocation.lon = lonLatPoint.longitude + mogoLocation.lat = lonLatPoint.latitude + mogoLocation.alt = lonLatPoint.altitude + mogoLocation.heading= lonLatPoint.angle + mEventController?.dispatchMapChangeListener(mogoLocation) + extendLocationChanged(mogoLocation) + if(lastUpdateTime != 0L){ + againLastUpdateTime = lastUpdateTime + } + lastUpdateTime = System.currentTimeMillis() + getRoadInfo(mogoLocation) + if(isFirstInit){ + isFirstInit = false + updateCacheByCityCode(mogoLocation) + } + if(isWeatherEnable && isFirstLocation){ + isFirstLocation = false + loopFlag = true + getWeatherInfo() + }else if(!isWeatherEnable && loopFlag){ + loopFlag = false + isFirstLocation = true + updateWeatherJob?.cancel() + mMapController?.setWeatherType(WeatherType.DEFULT.type) + + + } + } + + + fun setCenter() { + if (TransformUtils.outOfChina(mLocationLat, mLocationLon)) { + return + } + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop---setCenter--centerop-lockMode:${getLockCar()},${mLocationLon},${mLocationLat},${mLocationHeading}") + } + + mMapController?.animateTo(mLocationLon, mLocationLat, mLocationAlt, -mLocationHeading.toFloat(), 100) + } + + + private val mHandler = object : Handler() { + override fun handleMessage(msg: Message) { + when (msg.what) { + MSG_MAP_INIT -> { + handlerInitMapView() + } + MSG_SET_CENTER -> mMapController?.setFollowCarMode(true) + MSG_DRAW_LOCATION -> { + if (isLoad()) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop--centerop--MSG_DRAW_LOCATION-${msg.obj}") + } + val lonLatPoint = msg.obj as LonLatPoint + updateMapPosition(lonLatPoint) + removeMessages(MSG_DRAW_LOCATION) + } else { + removeMessages(MSG_DRAW_LOCATION) + val newMsg = Message.obtain(msg) + sendMessageDelayed(newMsg, 300) + } + } + MSG_MAP_STYLE -> { + mMapStyleParams?.let { + val mapStyle = it.getStyleMode() + val isAutoSwitch = it.isAutoSwitch() + if ((mLocationLon == 0.0) or (mLocationLat == 0.0)) { + mLocationLat = Constants.BEIJING.lat + mLocationLon = Constants.BEIJING.lon + } + if (mSunriseSunset == null) { + mSunriseSunset = SunriseSunset() + } + mSunriseSunset?.set(mLocationLat, mLocationLon, Date(), TimeZone.getDefault()) + if (isAutoSwitch) { + if (mSunriseSunset?.isDaytime() ?: true) { + if (mapStyle != MapAutoApi.MAP_STYLE_DAY) { + mMapController?.setMapStyle(MapAutoApi.MAP_STYLE_DAY) + mLocationView?.switch(MapAutoApi.MAP_STYLE_DAY) + } + } else { + if (mapStyle != MapAutoApi.MAP_STYLE_NIGHT) { + mMapController?.setMapStyle(MapAutoApi.MAP_STYLE_NIGHT) + mLocationView?.switch(MapAutoApi.MAP_STYLE_NIGHT) + } + } + } + } + + this.sendEmptyMessageDelayed(MSG_MAP_STYLE, 300000) + } + } + } + } + + + + override fun getLastUpdateTime(): Long{ + return lastUpdateTime + } + + override fun getAgainLastUpdateTime(): Long{ + return againLastUpdateTime + } + + override fun switchStyle(style: Int) { + mLocationView?.switch(style) + } + + private fun updateMapPosition(lonLatPoint: LonLatPoint) { + + duration = lonLatPoint.duration + mLocationLat = lonLatPoint.latitude + mLocationLon = lonLatPoint.longitude + mLocationAlt = lonLatPoint.altitude.toFloat() + mLocationHeading = lonLatPoint.angle + var heading = lonLatPoint.angle + + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop--centerop--lockcarop:-start:${lonLatPoint}") + } + if (!isMoveAnim) { + duration = 100 + } + var modeHeading = -heading.toFloat() + mMapStyleParams?.let { + when (it.getPerspectiveMode()) { + MapParams.MAP_PERSPECTIVE_UP_NORTH -> { + modeHeading = 0.0f + mMapController?.setSelfLocaionControl(MapAutoApi.MAP_PERSPECTIVE_UP_NORTH) + } + MapParams.MAP_PERSPECTIVE_UP_CAR -> { + modeHeading = -heading.toFloat() + mMapController?.setSelfLocaionControl(MapAutoApi.MAP_PERSPECTIVE_UP_CAR) + } + else -> { + + } + + } + } + + + mMapController?.animateTo(lonLatPoint.longitude, lonLatPoint.latitude, lonLatPoint.altitude.toFloat(), modeHeading, duration) + + if (CompileConfig.DEBUG) { + Log.i(TAG, "headingop --:::${heading},${modeHeading},") + } + // When operating the map, the center of the map does not move according to the vehicle position + if (!isMoveAnim) { + isMoveAnim = true + mLocationView?.getMyLocationStyle()?.setLonLat(LonLat(lonLatPoint.longitude, lonLatPoint.latitude),heading) + if(handler != null) { + handler.postDelayed(Runnable { + mMapController?.setConstAnchorPositionFlag(false) + mMapController?.shakeMapManual() + }, 60) + } + }else{ + mLocationView?.getMyLocationStyle()?.resetPosition() + mLocationView?.getMyLocationStyle()?.setRotateAngle(heading.toFloat()) + } + + } + + @Suppress("UNUSED_PARAMETER") + fun onCreate(savedInstanceState: Bundle?) { + } + + @Suppress("UNUSED_PARAMETER") + fun onSaveInstanceState(savedInstanceState: Bundle?) { + } + + open fun onResume() { + mMapView?.onResume() + } + + open fun onPause() { +// mMapView?.onPause() + } + + open fun onDestroy() { + if (CompileConfig.DEBUG) { + Log.i(TAG, "destroyop--autoop--onDestroy--start") + } + mMapController?.getClerk()?.add() + mMarkerController?.destory() + mLocationView?.exit() + mMapView?.onPause() + mMapAutoViewHelper?.clearPanel() + mPanelManager?.destory() + mHandler.removeCallbacksAndMessages(null) + locationClient?.destory() + mMapAutoViewHelper?.clearPel() + roadInfoJob?.cancel() + updateCacheJob?.cancel() + + loopFlag = false + updateWeatherJob?.cancel() + + mPanelManager = null; + mMapController = null; + mMapAutoViewHelper = null + mTrafficHelper = null; + mEventController?.exit() + mPanelManager = null + mMapView = null + if (CompileConfig.DEBUG) { + Log.i(TAG, "destroyop--autoop--onDestroy--removeAllViews-start") + } + removeAllViews() + if (CompileConfig.DEBUG) { + Log.i(TAG, "destroyop--autoop--onDestroy--over") + } + } + + /** + * Set the layout parameters(t,b,l,r) associated with this mapview + */ + fun resetMap(top: Int, bottom: Int, left: Int, right: Int) { + mMapController?.getClerk()?.add() + val layoutParams = layoutParams as LayoutParams + layoutParams.topMargin = top + layoutParams.bottomMargin = bottom + layoutParams.leftMargin = left + layoutParams.rightMargin = right + setLayoutParams(layoutParams) + } + + /** + * The loading status of the map + */ + private fun isLoad():Boolean{ + var isLoad = false + mMapView?.let{ + isLoad = it.isLoaded() + } + return isLoad + } + + fun getMapAutoViewHelper(): MapAutoViewHelper? { + return this.mMapAutoViewHelper + } + + fun setOnMapLoadedListener(onMapLoadedListener: OnMapLoadedListener?) { + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + onMapLoadedListener?.let { + mEventController?.addMapLoadedListener(it) + } + + } + + fun removeMapLoadedListener(onMapLoadedListener: OnMapLoadedListener) { + mMapController?.getClerk()?.add() + mEventController?.removeMapLoadedListener(onMapLoadedListener) + } + + + fun setOnMapClickListener(onMapClickListener: OnMapClickListener?) { + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + onMapClickListener?.let { + mEventController?.addMapClickListener(it) + } + + } + + fun removeMapClickListener(mapClickListener: OnMapClickListener){ + mMapController?.getClerk()?.add() + mEventController?.removeMapClickListener(mapClickListener) + } + + fun setOnMapTouchListener(onMapTouchListener: OnMapTouchListener?) { + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + onMapTouchListener?.let { + mEventController?.addMapTouchListener(it) + } + + } + + fun removeMapTouchListener(onMapTouchListener: OnMapTouchListener){ + mMapController?.getClerk()?.add() + mEventController?.removeMapTouchListener(onMapTouchListener) + } + + fun setOnCameraChangeListener(onCameraChangeListener: OnCameraChangeListener?){ + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + onCameraChangeListener?.let { + mEventController?.addCameraChangeListener(it) + } + + } + + fun removeCameraChangeListener(onCameraChangeListener: OnCameraChangeListener){ + mMapController?.getClerk()?.add() + mEventController?.removeCameraChangeListener(onCameraChangeListener) + } + + fun setOnMapStyleListener(onMapStyleListener: OnMapStyleListener?) { + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + if (CompileConfig.DEBUG) { + Log.i(TAG, "styleop-setOnMapStyleListener:${onMapStyleListener},mapAutoView:${this}") + } + onMapStyleListener?.let { + mEventController?.addMapStyleListener(it) + } + + } + + fun removeMapStyleListener(onMapStyleListener: OnMapStyleListener){ + mMapController?.getClerk()?.add() + mEventController?.removeMapStyleListener(onMapStyleListener) + } + + fun setOnMarkClickListener(onMarkClickListener: OnMarkClickListener?) { + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + onMarkClickListener?.let { + mEventController?.addMarkClickListener(it) + } + } + + fun removeMarkClickListener(onMarkClickListener: OnMarkClickListener){ + mMapController?.getClerk()?.add() + mEventController?.removeMarkClickListener(onMarkClickListener) + } + + fun setOnMapViewVisualAngleChangeListener(onMapViewVisualAngleChangeListener: OnMapViewVisualAngleChangeListener?) { + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + onMapViewVisualAngleChangeListener?.let { + mEventController?.addMapViewVisualAngleChangeListener(it) + } + } + + fun removeMapViewVisualAngleChangeListener(onMapViewVisualAngleChangeListener: OnMapViewVisualAngleChangeListener){ + mMapController?.getClerk()?.add() + mEventController?.removeMapViewVisualAngleChangeListener(onMapViewVisualAngleChangeListener) + } + + /** + * Add the listener of the status of map + * @param lis The listener + * @param type The status + */ + fun registerListener(lis: MapStatusListener, type: Int) { + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + mEventController?.addMapStatusListener(lis, type) + } + + /** + * cancel the listener of the status of map + * @param lis The listener + * @param type The status + */ + fun unRegisterListener(lis: MapStatusListener, type: Int) { + mMapController?.getClerk()?.add() + mEventController?.removeMapStatusListener(lis, type) + } + + fun registerScrollListener(lis: OnScrollListener?) { + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + lis?.let { + mEventController?.addScrollListener(it) + } + + } + + + fun unRegisterScrollListener(lis: OnScrollListener) { + mMapController?.getClerk()?.add() + mEventController?.removeScrollListener(lis) + } + + + fun registerScreenListener(mapScreenListener: OnMapScreenShotListener?) { + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + mapScreenListener?.let { + mEventController?.addScreenShotListener(it) + } + } + + fun unRegisterScreenListener(mapScreenListener: OnMapScreenShotListener) { + mMapController?.getClerk()?.add() + mEventController?.removeScreenShotListener(mapScreenListener) + } + + fun registerRenderListener(renderListener: OnRenderListener?){ + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + renderListener?.let { + mEventController?.addRenderListener(it) + } + } + + fun unRegisterRenderListener(renderListener: OnRenderListener) { + mMapController?.getClerk()?.add() + mEventController?.removeRenderListener(renderListener) + } + + fun setOnMapChangerListener(onMapChangeListener: OnMapChangeListener){ + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + onMapChangeListener?.let { + mEventController?.addMapChangeListener(it) + } + } + + fun removeMapChangeListener(onMapChangeListener: OnMapChangeListener) { + mMapController?.getClerk()?.add() + mEventController?.removeMapChangeListener(onMapChangeListener) + } + + fun setOnRoadInfoListener(onRoadInfoListener: OnRoadInfoListener, intervalTime: Long){ + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + onRoadInfoListener?.let { + mEventController?.addRoadInfoListener(it) + } + if(intervalTime == 0L){ + return + }else if(intervalTime < 1000){ + mIntervalTimeRoadInfo = 1000 + }else { + mIntervalTimeRoadInfo = intervalTime + } + + } + + fun removeRoadInfoListener(onRoadInfoListener: OnRoadInfoListener){ + mMapController?.getClerk()?.add() + mEventController?.removeRoadInfoListener(onRoadInfoListener) + } + + fun setOnHdDataDownListener(id: Int,onHdDataDownByCityListener: OnHdDataDownByCityListener){ + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + onHdDataDownByCityListener?.let { + mEventController?.addHdDataDownListener(id, it) + } + } + + fun removeHdDataDownListener(id: Int){ + mMapController?.getClerk()?.add() + mEventController?.removeHdDataDownListener(id) + } + + fun setOnRoamStatusListener(onRoamStatusListener: OnRoamStatusListener){ + mMapController?.getClerk()?.add() + if(mEventController == null){ + mEventController = MapEventController() + } + mEventController?.addRoamStatusListener(onRoamStatusListener) + } + + fun removeOnRoamStatusListener(onRoamStatusListener: OnRoamStatusListener){ + mMapController?.getClerk()?.add() + mEventController?.removeRoamStatusListener(onRoamStatusListener) + } + + override fun onRoadLoaded( + tileId: Int, leftTopLon: Double, leftTopLat: Double, leftBottomLon: Double, leftBottomLat: Double, + rightTopLon: Double, rightTopLat: Double, rightBottomLon: Double, rightBottomLat: Double, roadInfo: String? + ) { + //Temporarily ignore + return + mMapView?.let{ + if (mMapController?.isTrafficOn()?: false) { + mTrafficHelper?.loadTraffic(tileId, leftTopLon, leftTopLat, leftBottomLon, leftBottomLat, rightTopLon, rightTopLat, rightBottomLon, rightBottomLat, roadInfo) + } + } + + } + + open fun extendLocationChanged(location: MogoLocation) { + } + + + fun setRenderDataCall(renderDataCall: IRenderData) { + mMapController?.getClerk()?.add() + mMapView?.setRenderDataCall(renderDataCall) + } + + private fun getRoadInfo(mogoLocation: MogoLocation) { + if (System.currentTimeMillis() - mLastTimeRoadInfo > mIntervalTimeRoadInfo) { + mLastTimeRoadInfo = System.currentTimeMillis() + + RoadHelper.getInstance()?.getCenterLine( + mogoLocation.lon, + mogoLocation.lat, + mogoLocation.heading.toFloat(), + object : + IResult { + override fun result(code: Int, centerLine: CenterLine?) { + mEventController?.dispatchRoadIdInfo( + centerLine?.road_id, + centerLine?.lane_id + ) + } + }) + RoadHelper.getInstance()?.getStopLine( + mogoLocation.lon, + mogoLocation.lat, + mogoLocation.heading.toFloat(), + object : IResult { + override fun result(code: Int, stopLine: StopLine?) { + mEventController?.dispatchStopLineInfo(stopLine) + } + + }) + RoadHelper.getInstance()?.getCrossRoad( + mogoLocation.lon, + mogoLocation.lat, + mogoLocation.heading.toFloat(), + object : IResult { + override fun result(code: Int, roadCross: RoadCross?) { + mEventController?.dispatchRoadCrossInfo(roadCross) + } + + }) + + } + } + + override fun getCurrentLonLatPoint(): LonLatPoint{ + var lonLatPoint = LonLatPoint(mLocationLon, mLocationLat, mLocationAlt.toDouble(), mLocationHeading) + return lonLatPoint + } + + fun setWeatherEnable(isEnable: Boolean){ + isWeatherEnable = isEnable + mMapStyleParams?.setIsWeatherEnable(isEnable) + + } + + private fun updateCacheByCityCode(mogoLocation: MogoLocation){ + updateCacheJob?.cancel() + updateCacheJob = mMapController?.getScope()?.launch(Dispatchers.IO) { + RoadHelper.getInstance()?.initFileCacheByCity(mogoLocation.lon,mogoLocation.lat) + } + } + + private fun getWeatherInfo(){ + updateWeatherJob?.cancel() + updateWeatherJob = mMapController?.getScope()?.launch(Dispatchers.IO) { + while (loopFlag) { + if (MapDataApi.isRightLonLat(mLocationLon, mLocationLat)) { + val result = weatherRepository.getInfo(mLocationLon, mLocationLat) + if (CompileConfig.DEBUG) { + Log.d(TAG, "getWeatherInfo--result: ${result}") + } + + if (result is Result.Success) { + val weatherInfo = result.data + val rainSet = setOf("小雨", "中雨", "大雨","暴雨") + val snowSet = setOf("小雪", "中雪", "大雪","暴雪") + if(rainSet.contains(weatherInfo.weather)) { + mMapController?.setWeatherType(WeatherType.RAIN.type) + }else if(snowSet.contains(weatherInfo.weather)){ + mMapController?.setWeatherType(WeatherType.SNOW.type) + }else{ + mMapController?.setWeatherType(WeatherType.DEFULT.type) + } + + delay(15 * 60 * 1000) + + } else { + Log.d(TAG, "获取天气信息失败!") + + } + + + } + delay(10000) + } + } + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/view/MapAutoViewHelper.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/view/MapAutoViewHelper.kt new file mode 100644 index 0000000000..63a8d4ef30 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/view/MapAutoViewHelper.kt @@ -0,0 +1,1425 @@ +package com.zhidaoauto.map.sdk.open.view + +import android.util.Log +import com.autonavi.nge.map.* +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.abs.IMarkerController +import com.zhidaoauto.map.sdk.inner.common.ConstantExt +import com.zhidaoauto.map.sdk.inner.panel.PanelManager +import com.zhidaoauto.map.sdk.inner.proxy.CommonProxy +import com.zhidaoauto.map.sdk.inner.road.RoadHelper +import com.zhidaoauto.map.sdk.inner.utils.TransformUtils +import com.zhidaoauto.map.sdk.open.MapAutoApi +import com.zhidaoauto.map.sdk.open.abs.IResult +import com.zhidaoauto.map.sdk.open.abs.OnHdDataDownByCityListener +import com.zhidaoauto.map.sdk.open.abs.marker.InfoWindowAdapter +import com.zhidaoauto.map.sdk.open.camera.CameraPosition +import com.zhidaoauto.map.sdk.open.camera.CameraUpdate +import com.zhidaoauto.map.sdk.open.camera.MapCameraMessage +import com.zhidaoauto.map.sdk.open.circle.CircleController +import com.zhidaoauto.map.sdk.open.circle.CircleOptions +import com.zhidaoauto.map.sdk.open.data.CityInfo +import com.zhidaoauto.map.sdk.open.deadzone.DeadZone +import com.zhidaoauto.map.sdk.open.deadzone.DeadZoneOptions +import com.zhidaoauto.map.sdk.open.exception.NotImplementException +import com.zhidaoauto.map.sdk.open.location.MogoLocation +import com.zhidaoauto.map.sdk.open.location.MyLocationStyle +import com.zhidaoauto.map.sdk.open.marker.* +import com.zhidaoauto.map.sdk.open.poyline.Polyline +import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions +import com.zhidaoauto.map.sdk.open.query.LonLatPoint +import com.zhidaoauto.map.sdk.open.tools.MapTools +import com.zhidaoauto.map.sdk.open.weather.WeatherResult + +class MapAutoViewHelper(mapAutoView: MapAutoView) { + private val mMapAutoView: MapAutoView + + val TAG = javaClass.simpleName + + init { + mMapAutoView = mapAutoView + } + + /** + * 设置地图的刷新状态以及频率 + * @param enableSync + */ + fun setRenderFrequency(enableSync: Boolean,renderTimePer:Int){ + mMapAutoView.getClerk()?.add("$enableSync,$renderTimePer") + mMapAutoView.getMapController()?.setRenderFrequency( + enableSync,renderTimePer + ) + } + + /** + * 设置在车在屏幕的相对位置 + * param defult = 4 range (1..6) 设置自车位置 offset 1.0-6.0, <4.0车向上,>4.0车向下 + */ + fun setSelfCarPosition(param:Float){ + mMapAutoView.getClerk()?.add("$param") + var overAngle = (getMapDAngle())?:6.5f + mMapAutoView.getMapController()?.setScreenToOriginDis(param); + overAngle = overAngle+0.01f + setMapDAngle(overAngle) + overAngle = overAngle-0.01f + setMapDAngle(overAngle) + } + + + /** + * 设置视点位置 + * eyeToOrigin defult = 33 + * screenToOrigin defult = 4 + */ + @Deprecated(message = "dead") + fun setEyePosition(eyeToOrigin:Float,screenToOrigin:Float){ + mMapAutoView.getClerk()?.add("$eyeToOrigin,$screenToOrigin") + mMapAutoView.getMapController()?.setEyeToOriginDis(eyeToOrigin); + mMapAutoView.getMapController()?.setScreenToOriginDis(screenToOrigin); + + } + + /** + * 设置当前定位 + * @param lonLatPoint + */ + fun setLocation(lonLatPoint: LonLatPoint) { + mMapAutoView.getClerk()?.add("${lonLatPoint.longitude},${lonLatPoint.latitude}") + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-centerop-setLocation:${lonLatPoint}") + } + if (getLockMode()) { + return + } + var lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint) + if (TransformUtils.outOfChina(lonLat.lat, lonLat.lon)) { + return + } + mMapAutoView.getMapController()?.setCenter( + lonLat.lon, + lonLat.lat + ) + } + + /** + * 设置地图中心点 + * @param lonLatPoint + */ + fun setCenter(lonLatPoint: LonLatPoint) { + mMapAutoView.getClerk()?.add("${lonLatPoint.longitude},${lonLatPoint.latitude}") + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop--centerop-setCenter:${lonLatPoint}") + } + if (getLockMode()) { + return + } + var lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint) + if (TransformUtils.outOfChina(lonLat.lat, lonLat.lon)) { + return + } + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop--centerop-setCenter-success:${lonLatPoint}") + } + mMapAutoView.getMapController()?.setCenter( + lonLat.lon, + lonLat.lat + ) + } + + + /** + * 获取当前中心点位置 + * @return + */ + fun getCenter(): LonLatPoint { + mMapAutoView.getClerk()?.add() + var center = DoubleArray(2) + mMapAutoView.getMapController()?.getCenter(center) + var lon: Double = center[0] + var lat: Double = center[1] + return CommonProxy.getInstance().getLonLatProxy().switchLonLat(LonLat(lon, lat)) + } + + /** + * 获取上一次定位位置 + */ + fun getLastKnownLocation(): MogoLocation? { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getLocationClient()?.lastKnownMogoLocation + } + + /** + * 设置地图偏移量 + */ + fun setOffset(left: Int, top: Int) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop--centerop--lockop-setOffset --offsetop") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setOffset(left, top) + } + + //地图放大 + fun zoomIn() { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-zoomIn") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.zoomIn() + } + + //地图缩小 + fun zoomOut() { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-zoomOut") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.zoomOut() + } + + /** + * 地图放大 + * cx 横向比例 + * cy 竖向比例 + */ + fun zoomIn(cx: Float, cy: Float) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-zoomIn:${cx},${cy}") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.zoomIn() + mMapAutoView.getMapController()?.dispatchZoomChanged() + } + + /** + * 获取地图缩放值 + * + * @return int 地图缩放值 + */ + fun getZoom(): Int { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.getZoom()?: 16 + + } + + /** + * 设置地图缩放值 + * + * @param zoomIndex 地图缩放值 + */ + fun setZoom(zoomIndex: Int) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-setZoom:${zoomIndex}") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setZoom(zoomIndex) + } + + /** + * 设置地图视角 + * + * @param angle 视角 + */ + fun setMapViewAngle(angle: Float) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-setMapViewAngle:${angle}") + } + mMapAutoView.getClerk()?.add() +// mMapAutoView.getMapController()?.setDAngle(angle) + val center = getCenter() + val lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(center) + mMapAutoView.getMapController()?.interpolation(-1f, angle, -1f, -1, -1) + } + + /** + * 设置地图视角 + * + * @param angle 视角 + */ + fun setVrEyeHeight(eyeHeight: Float) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.interpolation(eyeHeight,-1f, -1f, -1, -1) + } + + + /** + * 地图移动 + * @param lon 经度 + * @param lat 纬度 + * @param zoom 缩放值 + * @param rotateAngle 旋转角度 + * @param overlookAngle 视角角度 + * @param eyeHeight 眼睛高度 + * @param mDuration 动画时长 + * @param isGPS 是否wgs84坐标系 + */ + fun animateTo( lon: Double, + lat: Double, + zoom: Float, + rotateAngle: Float, + overlookAngle: Float, + eyeHeight: Float, + mDuration:Int, + isGPS: Boolean) { + if(CompileConfig.DEBUG){ + Log.i(TAG,"animateTo:lon:${lon},lat:${lat},zoom:${zoom},rotateAngle:${rotateAngle},overlookAngle:${overlookAngle},mDuration:${mDuration}") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setStartFrame(zoom, overlookAngle, eyeHeight) + if(!isGPS) { + val lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(LonLatPoint(lon, lat)) + mMapAutoView.getMapController()?.animateTo(lonLat.lon, lonLat.lat, 0f,rotateAngle, mDuration) + }else{ + mMapAutoView.getMapController()?.animateTo(lon, lat, 0f,rotateAngle, mDuration) + } + + } + + /** + * 地图移动 + * @param lon 经度 + * @param lat 纬度 + * @param rotateAngle 旋转角度 + * @param mDuration 动画时长 + * @param isGPS 是否wgs84坐标系 + */ + fun animateTo( lon: Double, + lat: Double, + rotateAngle: Float, + mDuration:Int, + isGPS: Boolean) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setStartFrame(-1f, -1f, -1f) + if(!isGPS) { + val lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(LonLatPoint(lon, lat)) + mMapAutoView.getMapController()?.animateTo(lonLat.lon, lonLat.lat, 0f, rotateAngle, mDuration) + }else{ + mMapAutoView.getMapController()?.animateTo(lon, lat, 0f, rotateAngle, mDuration) + } + } + + /** + * 地图视角变换 + * @param zoom 缩放值 + * @param overlookAngle 视角角度 + * @param eyeHeight 眼睛高度 + * @param mDuration 动画时长 + */ + fun animateTo(zoom: Float, overlookAngle: Float, eyeHeight: Float, mDuration:Int) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.interpolation(eyeHeight, overlookAngle, zoom, -1, -1) + } + + /** + * 设置地图视角 + * @param angle 视角 + */ + fun setMapDAngle(angle: Float) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-setMapDAngle:${angle}") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setDAngle(angle) + } + + fun getMapDAngle(): Float?{ + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.getDAngle() + } + + /** + * 设置地图旋转角度 + * + * @param angle 视角 + */ + fun setMapViewRotateAngle(rotateAngle: Float) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-setMapViewAngle:${rotateAngle}") + } + mMapAutoView.getClerk()?.add() + val center = getCenter() + val lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(center) + mMapAutoView.getMapController()?.setStartFrame(-1f,-1f,-1f) + mMapAutoView.getMapController()?.animateTo(lonLat.lon, lonLat.lat, 0f, rotateAngle,ConstantExt.MAP_ANIM_DEFAULT_DURATION) + } + + /** + * 设置地图旋转角度 + *V + * @param rotation 地图旋转角度 + */ + fun setMapViewRotation(rotation: Float) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-setMapViewRotation:${rotation}") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setMapViewRotation(rotation) + } + + /** + * 获取地图旋转角度 + * + * @return Float 地图旋转角度 + */ + fun getMapViewRotation(): Float { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.getRotateAngle() ?: 0.0f + + } + + /** + * 设置地图视图模式 + * + * @param mapPerspective 视图模式 1: 2D模式 2: 3D模式 3:车头向上 4:正北模式 + */ + fun setMapViewPerspective(mapPerspective: Int) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.getMapStyleParams()?.setPerspectiveMode(mapPerspective) + mMapAutoView.getMapController()?.setMapViewPerspective(mapPerspective) + + } + + /** + * 获取地图视图模式 + * + * @return Int 地图视图模式 1: 2D模式 2: 3D模式 + */ + fun getMapViewPerspective(): Float { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.getMapViewPerspective() ?: MapAutoApi.MAP_PERSPECTIVE_2D.toFloat() + } + + /** + * 获取地图比例 + * + * @return Float 地图比例 + */ + fun getRulerInfo(): Float { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.getRulerInfo() ?: 0.0f + } + + /** + * 清除搜寻的poi + */ + fun clearSearchPoi() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.clearSearchResult() + mMapAutoView.getPanelManager()?.setPanel(PanelManager.PANEL_WHAT_RESET, PanelManager.PANEL_MODE_PANEL_BTN_LEFT) + } + + /** + * 设置地图模式 + * + * @param stylemode 视图模式 0: 日间模式 1:夜间模式 2:SATEL模式 3:日间导航模式 4:夜间导航模式 + */ + fun setMapStyle(stylemode: Int) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "styleop-setMapStyle:${stylemode}") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setMapStyle(stylemode) + + } + + /** + * 返回地图模式 + *setMyLocationStyle + * @ return 视图模式 0: 日间模式 1:夜间模式 2:SATEL模式 3:日间导航模式 4:夜间导航模式 + */ + fun getMapStyle(): Int { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.getMapStyleParams()?.getStyleMode()?:MapAutoApi.MAP_STYLE_NIGHT_VR + } + + + fun setMyLocationEnabled(myLocationEnabled: Boolean) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getLocationView()?.setMyLocationEnabled(myLocationEnabled) + } + + fun getMyLocationEnabled(): Boolean { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getLocationView()?.getMyLocationEnabled()?:false + } + + /** + * 更新自车样式 + * @param myLocationStyle + */ + fun setMyLocationStyle(myLocationStyle: MyLocationStyle) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop--centerop--custommap--lockop-setMyLocationStyle") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getLocationView()?.setMyLocationStyle(myLocationStyle) + } + + /** + * 获取自车样式 + */ + fun getMyLocationStyle(): MyLocationStyle? { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop--centerop--custommap--lockop-getMyLocationStyle") + } + mMapAutoView.getClerk()?.add() + return mMapAutoView.getLocationView()?.getMyLocationStyle() + } + + + fun showDirection() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanel(PanelManager.PANEL_WHAT_SHOW, PanelManager.PANEL_BTN_DIRECTION) + } + + fun hiddenDirection() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanel(PanelManager.PANEL_WHAT_HID, PanelManager.PANEL_BTN_DIRECTION) + } + + + /** + * 设置方向按钮位置 + * + * @param gravity 位置 + * @param top 顶部边距 + * @param bottom 底部边距 + * @param left 左边距 + * @param right 右边距 + */ + fun setDirectionPosition(gravity: Int, top: Int, bottom: Int, left: Int, right: Int) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanelPos(PanelManager.PANEL_BTN_DIRECTION, gravity, top, bottom, left, right) + } + + + fun setDirectionPosition(top: Int, bottom: Int, left: Int, right: Int) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanelPos(PanelManager.PANEL_BTN_DIRECTION, top, bottom, left, right) + } + + //更新指南针显示 + fun updateCompassPanel(isShow: Boolean) { + mMapAutoView.getClerk()?.add() + updatePanel(isShow, PanelManager.PANEL_RIGHT_TOP) + } + + fun updatePanel(isShow: Boolean, panelId: Int) { + mMapAutoView.getClerk()?.add() + if (isShow) { + mMapAutoView.getPanelManager() + ?.setPanel(PanelManager.PANEL_WHAT_SHOW, panelId) + } else { + mMapAutoView.getPanelManager() + ?.setPanel(PanelManager.PANEL_WHAT_HID, panelId) + } + } + + //缩放是否生效 + fun isZoomGesturesEnabled(): Boolean { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.isCanZoom() ?: false + } + + //关闭所有手势 + fun setAllGesturesEnabled(boolean: Boolean) { + mMapAutoView.getClerk()?.add() + setZoomGesturesEnabled(boolean) + setScrollGesturesEnabled(boolean) + setTiltGesturesEnabled(boolean) + setRotateGesturesEnabled(boolean) + + } + + /** + * 设置缩放按钮位置 + * + * @param gravity 位置 + * @param top 顶部边距 + * @param bottom 底部边距 + * @param left 左边距 + * @param right 右边距 + */ + fun setZoomPosition(gravity: Int, top: Int, bottom: Int, left: Int, right: Int) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanelPos(PanelManager.PANEL_BTN_ZOOM, gravity, top, bottom, left, right) + } + + /** + * 设置缩放按钮位置 + * + * @param top 顶部边距 + * @param bottom 底部边距 + * @param left 左边距 + * @param right 右边距 + */ + fun setZoomPosition(top: Int, bottom: Int, left: Int, right: Int) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanelPos(PanelManager.PANEL_BTN_ZOOM, top, bottom, left, right) + } + + + //地图缩放手势 + fun setZoomGesturesEnabled(boolean: Boolean) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setCanZoom(boolean) + } + + //设置滑动是否生效 + fun setScrollGesturesEnabled(boolean: Boolean) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setScroll(boolean) + } + + //获取滑动是否生效 + fun isScrollGesturesEnabled(): Boolean { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.isScroll() ?: false + } + + //倾斜手势 + fun setTiltGesturesEnabled(boolean: Boolean) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setFling(boolean) + } + + //获取倾斜手势是否生效 + fun isTiltGesturesEnabled(): Boolean { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.isFling() ?: false + } + + //旋转手势 + fun setRotateGesturesEnabled(boolean: Boolean) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setRotate(boolean) + } + + //旋转是否生效 + fun isRotateGesturesEnabled(): Boolean { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.isRotate() ?: false + } + + //显示缩放按钮 + fun showZoom() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanel(PanelManager.PANEL_WHAT_SHOW, PanelManager.PANEL_BTN_ZOOM) + } + + //隐藏缩放按钮 + fun hiddenZoom() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager()?.setPanel(PanelManager.PANEL_WHAT_HID, PanelManager.PANEL_BTN_ZOOM) + } + + /** + * 设置定位按钮位置 + * + * @param gravity 位置 + * @param top 顶部边距 + * @param bottom 底部边距 + * @param left 左边距 + * @param right 右边距 + */ + fun setLocationPosition(gravity: Int, top: Int, bottom: Int, left: Int, right: Int) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanelPos(PanelManager.PANEL_BTN_LOCATION, gravity, top, bottom, left, right) + } + + /** + * 设置定位按钮位置 + * + * @param top 顶部边距 + * @param bottom 底部边距 + * @param left 左边距 + * @param right 右边距 + */ + fun setLocationPosition(top: Int, bottom: Int, left: Int, right: Int) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanelPos(PanelManager.PANEL_BTN_LOCATION, top, bottom, left, right) + } + + //显示定位按钮 + fun showLocation() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanel(PanelManager.PANEL_WHAT_SHOW, PanelManager.PANEL_BTN_LOCATION) + } + + //隐藏定位按钮 + fun hiddenLocation() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanel(PanelManager.PANEL_WHAT_HID, PanelManager.PANEL_BTN_LOCATION) + } + + /** + * 设置比例尺位置 + * + * @param gravity 位置 + * @param top 顶部边距 + * @param bottom 底部边距 + * @param left 左边距 + * @param right 右边距 + */ + fun setScalePosition(gravity: Int, top: Int, bottom: Int, left: Int, right: Int) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanelPos(PanelManager.PANEL_BTN_SCALE, gravity, top, bottom, left, right) + } + + /** + * 设置比例尺位置 + * + * @param top 顶部边距 + * @param bottom 底部边距 + * @param left 左边距 + * @param right 右边距 + */ + fun setScalePosition(top: Int, bottom: Int, left: Int, right: Int) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanelPos(PanelManager.PANEL_BTN_SCALE, top, bottom, left, right) + } + + //显示比例尺 + fun showScale() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanel(PanelManager.PANEL_WHAT_SHOW, PanelManager.PANEL_BTN_SCALE) + } + + //隐藏比例尺 + fun hiddenScale() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanel(PanelManager.PANEL_WHAT_HID, PanelManager.PANEL_BTN_SCALE) + } + + + /** + * 设置logo位置 + * + * @param top 顶部边距 + * @param bottom 底部边距 + * @param left 左边距 + * @param right 右边距 + */ + fun setLogoPosition(top: Int, bottom: Int, left: Int, right: Int) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanelPos(PanelManager.PANEL_BTN_LOGO, top, bottom, left, right) + } + + /** + * 设置logo位置 + * + * @param gravity 位置 + * @param top 顶部边距 + * @param bottom 底部边距 + * @param left 左边距 + * @param right 右边距 + */ + fun setLogoPosition(gravity: Int, top: Int, bottom: Int, left: Int, right: Int) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanelPos(PanelManager.PANEL_BTN_LOGO, gravity, top, bottom, left, right) + } + + //显示logo + fun showLogo() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanel(PanelManager.PANEL_WHAT_SHOW, PanelManager.PANEL_BTN_LOGO) + } + + //隐藏logo + fun hiddenLogo() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager() + ?.setPanel(PanelManager.PANEL_WHAT_HID, PanelManager.PANEL_BTN_LOGO) + } + + + + /** + * 地图截屏 + */ + fun toScreen() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.toScreen() + } + + fun moveCamera(cameraUpdate: CameraUpdate) { + mMapAutoView.getClerk()?.add() + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop--centerop--custommap--lockop-moveCamera") + } + + val mapCameraMessage = cameraUpdate.cameraUpdateFactoryDelegate + when (mapCameraMessage.nowType) { + MapCameraMessage.Type.newCameraPosition -> { + //1. center 、俯仰角、缩放比例、偏航角 + mapCameraMessage.cameraPosition?.let { + var centerTarget = it.target + if (CompileConfig.DEBUG) { + Log.e(TAG, "target:${centerTarget}") + } + setCenter(centerTarget) + mMapAutoView.getMapController()?.setZoom(it.zoom.toInt()) + var tilt = it.tilt + mMapAutoView.getMapController()?.tilt(tilt) + if (CompileConfig.DEBUG) { + Log.e("test", "warnning!现在还不支持偏航角~~") + } + } + } + MapCameraMessage.Type.zoomTo -> { + mMapAutoView.getMapController()?.setZoom(mapCameraMessage.zoom.toInt()) + + } + MapCameraMessage.Type.zoomOut -> { + mMapAutoView.getMapController()?.zoomOut() + } + MapCameraMessage.Type.newLatLngBounds -> { + val latLngBounds = mapCameraMessage.bounds + if (latLngBounds != null && latLngBounds.isLegal()) { + val zoomIndex = autoZoom(latLngBounds.southwest!!, latLngBounds.northeast!!) + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-moveCamera-newLatLngBounds:,${latLngBounds},zoom:${zoomIndex}") + } + mMapAutoView.getMapController()?.setZoom(zoomIndex) + } + } + else -> { + throw NotImplementException() + } + } + } + + /** + * 删除图元 + */ + fun removePel(name: String) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.removePel(name) + + } + + /** + * 删除图元 + */ + fun clearPel(): Boolean { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.clearPel() ?: false + + } + + + /** + * 添加锚点 + */ + fun addMarker(markerOptions: MarkerOptions): Marker? { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMarkerController()?.addMarker(markerOptions) + } + + /** + * 绘制线 + */ + fun drawLine(polylineOptions: PolylineOptions): Polyline? { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.drawLine(polylineOptions) + } + + /** + * 绘制线可控制宽度 + */ + fun drawThickLine(polylineOptions: PolylineOptions): Polyline? { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.drawThickLine(polylineOptions) + } + /** + * 绘制圆 + */ + fun drawCircle(circleOptions: CircleOptions): CircleController? { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.drawCircle(circleOptions) + } + + /** + * 绘制椭圆 + */ + fun drawEllipse(polylineOptions: PolylineOptions): Polyline? { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.drawEllipse(polylineOptions) + } + + /** + * 绘制矩形 + */ + fun drawRect(polylineOptions: PolylineOptions): Polyline? { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.drawRect(polylineOptions) + } + + /** + * 绘制多边形 + */ + fun drawPolygon(polylineOptions: PolylineOptions): Polyline? { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.drawPolygon(polylineOptions) + } + + // 渲染一次 + fun runOnDrawFrame() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.renderP() + } + + //设置刷新帧率 + fun setRenderFps(fps: Int) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setRenderFps(fps) + } + + //设置刷新帧率 + fun getRenderFps(): Int { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.getRenderFps() ?: 60 + } + + // 设置屏幕上的某个像素点为地图中心点。 + fun setPointToCenter(x: Float, y: Float) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap--setPointToCenter") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setOffset((MapTools.viewWidth*(x-0.5f)).toInt(), ((MapTools.viewWidth*(y-0.5f)).toInt())) +// mMapAutoView.getPanelManager()?.setPanelPos(PanelManager.PANEL_MODE_MAP,0,0,0,0) + } + + // 移动到某个点 + fun animateCamera(lonLatPoint: LonLatPoint) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap-animateCamera--") + } + mMapAutoView.getClerk()?.add() + setCenter(lonLatPoint) + } + + //清除添加布局 + fun clearPanel() { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap--clearPanel") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getPanelManager()?.setPanel(PanelManager.PANEL_WHAT_HID, PanelManager.PANEL_MODE_VIEW_MAIN) + } + + // 自动切换夜间模式开关 + fun setAutoSwitchStyle(isAutoSwitch: Boolean) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap--setAutoSwitchStyle") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.getMapStyleParams()?.setAutoSwitch(isAutoSwitch) + } + + //修改是否允许传入外部数据 + fun setIsUseExtraGPSData(isUseExtraGPSData: Boolean) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap--setIsUseExtraGPSData:${isUseExtraGPSData}") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getLocationClient()?.setIsUseExtraGPSData(isUseExtraGPSData) + } + + //获取是否允许传入外部数据 + fun getIsUseExtraGPSData(): Boolean { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap--getIsUseExtraGPSData") + } + mMapAutoView.getClerk()?.add() + return mMapAutoView.getLocationClient()?.isUseExtraGPSData()?:false + } + + //传入外部数据 + fun setExtraGPSData(coor: Int, location: android.location.Location) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap--setExtraGPSData") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getLocationClient()?.setExtraGPSData(coor, location) + } + + // 设置地图POI是否允许点击。 + fun setTouchPoiEnable(enadbled: Boolean) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap--setTouchPoiEnable") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setTouchPoiEnable(enadbled) + } + + // 获取地图POI是否允许点击。 + fun isTouchPoiEnable(): Boolean { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap--isTouchPoiEnable") + } + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.getTouchPoiEnable() ?: false + } + + + //设置是否显示3D建筑物,默认显示。 + fun showBuildings(enabled: Boolean) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap--showBuildings:${enabled}") + } + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.set3DBuildingVisible(enabled) + } + + //设置是否显示底图文字标注,默认显示。 + fun showMapText(enabled: Boolean) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap--showMapText") + } + mMapAutoView.getClerk()?.add() + } + + //设置锁车 + fun setLockMode(enabled: Boolean) { + if (CompileConfig.DEBUG) { + Log.i(TAG, "autoop-lockop--custommap-setLockMode:${enabled}") + } + if (mMapAutoView.getMapController()?.isTouching() ?: false) { + return + } + mMapAutoView.getClerk()?.add() + mMapAutoView.setLockCar(enabled) + } + + fun getLockMode(): Boolean { + mMapAutoView.getClerk()?.add() + val result = mMapAutoView.getLockCar() ?: true + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap--getLockMode:${result}") + } + return result + } + + //获取当前缩放级别下,地图上1像素点对应的长度,单位米。 + fun getScalePerPixel(): Float { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap--getScalePerPixel") + } + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.getResulation() ?: 0.0f + } + + //自动缩放 + fun autoZoom(minLonLatPoint: LonLatPoint, maxLonLatPoint: LonLatPoint): Int { + if (CompileConfig.DEBUG) { + Log.i(TAG, "mapop-custommap--autoZoom") + } + mMapAutoView.getClerk()?.add() + val minLonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(minLonLatPoint) + val maxLonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(maxLonLatPoint) + return mMapAutoView.getMapController()?.getSuitableZoom(minLonLat.lon, minLonLat.lat, maxLonLat.lon, maxLonLat.lat) ?: 16 + } + + + fun drawTraffic(result: String) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.drawTraffic(result) + } + + fun clearTrafficLines() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.clearAllTmcLines() + } + + fun isTrafficOn(): Boolean { + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.isTrafficOn()?: false + } + + //设置是否打开交通路况图层 + fun setTraffic(stat: Boolean) { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setTraffic( + if (stat) { + 1 + } else { + 0 + } + ) + } + + fun setInfoWindowAdapter(infoWindowAdapter: InfoWindowAdapter) { + mMapAutoView.getMarkerController()?.setInfoWindow(infoWindowAdapter) + } + + fun getCameraPosition(): CameraPosition { + mMapAutoView.getClerk()?.add() + val centerArray = DoubleArray(2) + mMapAutoView.getMapController()?.getCenter(centerArray) + val centerLonLatPoint = CommonProxy.getInstance().getLonLatProxy().switchLonLat(LonLat(centerArray[0], centerArray[1])) + val zoom = mMapAutoView.getMapController()?.getZoom() ?: 16 + val tilt = mMapAutoView.getMapController()?.getTilt() ?: 0f + val heading = mMapAutoView.getLocationClient()?.lastKnownMogoLocation?.heading + var bearing = 0.0 + if (heading != null) { + bearing = heading + } + val cameraPosition = CameraPosition(centerLonLatPoint, zoom.toFloat(), tilt, bearing.toFloat()) + return cameraPosition + } + + /** + * 清除所有锚点 + */ + fun clearAllMarkers() { + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.clearAllAnchors() + } + + /** + * 修改锚点的显示比例 默认0.014 + */ + fun setAnchorRate(rate: Float) { + mMapAutoView.getClerk()?.add("$rate") + mMapAutoView.getMapController()?.setAnchorRate(rate) + } + + /** + * 修改锚点的变形比例 + */ + fun setAnchorScale(wRate: Float,hRate: Float) { + mMapAutoView.getClerk()?.add() +// mMapAutoView.getMapController()?.setAnchorScale(wRate, hRate) + } + + /** + * 设置缩放 + * @param zoomVal + */ + fun setZoomVal(zoomVal:Float){ + mMapAutoView.getClerk()?.add("$zoomVal") + mMapAutoView.getMapController()?.setZoomValue(zoomVal) + } + + + + //获取眼睛高度 + fun getEyeHeight(): Float{ + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.getEyeHeight()?: ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_MIDDLE + } + + //设置眼睛高度 + fun setEyeHeight(eyeHeight: Float){ + mMapAutoView.getClerk()?.add("$eyeHeight") + mMapAutoView.getMapController()?.setEyeHeight(eyeHeight) + } + + /** + * 设置视阈 + */ + fun setVerticalViewFieldAngle(r: Float){ + mMapAutoView.getClerk()?.add("$r") + mMapAutoView.getMapController()?.setVerticalViewFieldAngle(r) + } + + fun getVerticalViewFieldAngle(): Float?{ + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.getVerticalViewFieldAngle() + } + + /** + * 设置是否自动切换视角 + */ + fun setSwitchViewAngle(isSwitchViewAngle: Boolean){ + mMapAutoView.getClerk()?.add("$isSwitchViewAngle") + mMapAutoView.getMapController()?.getMapStyleParams()?.setSwitchViewAngle(isSwitchViewAngle) + + } + + fun isSwitchViewAngle(): Boolean{ + mMapAutoView.getClerk()?.add() + return mMapAutoView.getMapController()?.getMapStyleParams()?.isSwitchViewAngle()?:false + } + + /** + * 设置视角模式 + * @param type 参考 + * const val MAP_STYLE_VR_ANGLE_NEAR = 0 + * const val MAP_STYLE_VR_ANGLE_MIDDLE = 1 + * const val MAP_STYLE_VR_ANGLE_FAR = 2 + * const val MAP_STYLE_VR_ANGLE_300 = 3 + * const val MAP_STYLE_VR_ANGLE_TOP = 4 + * const val MAP_STYLE_VR_ANGLE_CROSS = 5 + * const val MAP_STYLE_VR_ANGLE_MIDDLE_XIAOBA = 6 + * const val MAP_STYLE_VR_ROAM = 7 + * const val MAP_STYLE_VR_TRANS = 8 + */ + fun setMapViewVisualAngle(type: Int){ + mMapAutoView.getClerk()?.add("$type") + if (CompileConfig.DEBUG) { + Log.i(TAG, "setMapViewVisualAngle:${type}") + } + mMapAutoView.getMapController()?.setMapViewVisualAngle(type) + } + + + fun setScaleVRMode(isScaleVr: Boolean){ + mMapAutoView.getClerk()?.add("$isScaleVr") + mMapAutoView.getMapController()?.setVrMode(isScaleVr) + } + + + + fun setNearViewAnglePosition(lonLatPoint: LonLatPoint, isGps: Boolean){ + mMapAutoView.getClerk()?.add("$lonLatPoint,$isGps") + var lonLat: LonLat? = null + if(!isGps) { + lonLat = CommonProxy.getInstance().getLonLatProxy().switchLonLat(lonLatPoint) + }else{ + lonLat = LonLat(lonLatPoint.longitude, lonLatPoint.latitude) + } + mMapAutoView.getMapController()?.setNearViewAnglePosition(lonLat) + + } + + + fun testMapViewAngle(type: Int){ + mMapAutoView.getClerk()?.add("$type") + mMapAutoView.getMapController()?.testMapViewAngle(type) + } + + /** + * 设置尾灯 + * @param type 0=默认 1=左黄 2=右黄 3=双黄 4=双红 + * @param time 闪烁时间 + */ + fun setTailLightsType(type: Int, time: Int){ + mMapAutoView.getClerk()?.add("$type,$time") + var flashTime = time + if(flashTime < 500) { + flashTime = 500 + } + mMapAutoView.getMapController()?.setTailLightsType(type, flashTime) + } + + /** + * 设置锚点渐变色 + */ + fun setAnchorGradientColor(startColor: String, endColor: String, startDistance: Float, endDistance: Float){ + mMapAutoView.getClerk()?.add("$startColor,$endColor,$startDistance,$endDistance") + mMapAutoView.getMapController()?.setAnchorGradientColor(startColor, endColor, startDistance, endDistance) + } + /** + * @param isUseTrace 1:使用轨迹 0:自有漫游模式 + * @param dis: 漫游长度 + * @param speed: 速度 + */ + fun setRoamStyle(isUseTrace: Int, dis: Float, speed: Float){ + mMapAutoView.getClerk()?.add("$isUseTrace,$dis,$speed") + + var roamDis = dis + if(roamDis > ConstantExt.ROAM_DIS_8KM){ + roamDis = ConstantExt.ROAM_DIS_8KM + } else if(roamDis < ConstantExt.ROAM_DIS_1KM){ + roamDis = ConstantExt.ROAM_DIS_1KM + } + var roamSpeed = speed + + if(roamSpeed > ConstantExt.ROAM_SPEED_80){ + roamSpeed = ConstantExt.ROAM_SPEED_80 + } else if(roamSpeed < ConstantExt.ROAM_SPEED_30){ + roamSpeed = ConstantExt.ROAM_SPEED_30 + } + mMapAutoView.getMapController()?.setRoamStyle(isUseTrace, roamDis, roamSpeed) + } + + /** + * @param travel 轨迹路径 格式 112.5775862,26.82019681,112.5775592,26.82018045,...... + */ + fun setRoamTrajectory(travel: String){ + mMapAutoView.getClerk()?.add() + mMapAutoView.getMapController()?.setRoamTrajectory(travel) + } + + /** + * 按照城市缓存高精数据 + */ + fun cacheHDDataByCity(id: Int, listener: OnHdDataDownByCityListener){ + mMapAutoView.getClerk()?.add("$id") + if(CompileConfig.DEBUG){ + Log.i(TAG, "cacheop-cacheHDDataByCity: $id") + } + mMapAutoView.getMapController()?.cacheHDDataByCity(id, listener) + } + + /** + * 按照经纬度缓存城市数据 + */ + fun cacheHDDataByCityByLonLat(lon: Double, lat: Double, listener: OnHdDataDownByCityListener){ + mMapAutoView.getClerk()?.add("$lon,$lat") + if(CompileConfig.DEBUG){ + Log.i(TAG, "cacheop-cacheHDDataByCityByLonLat: $lon,$lat") + } + mMapAutoView.getMapController()?.cacheHDDataByCityLonLat(lon, lat, listener) + } + + /** + * 获取城市列表 + */ + fun getAllCityCode(call:IResult>){ + mMapAutoView.getClerk()?.add() + if(CompileConfig.DEBUG){ + Log.i(TAG, "cacheop-getAllCityCode") + } + RoadHelper.getInstance()?.getAllCityCode(call) + } + + + fun getCityCode(lon: Double, lat: Double,call:IResult){ + mMapAutoView.getClerk()?.add() + if(CompileConfig.DEBUG){ + Log.i(TAG, "cacheop-getCityCode") + } + RoadHelper.getInstance()?.getCityCode(lon, lat,call) + } + + fun isCacheCity(lon: Double, lat: Double,call:IResult){ + mMapAutoView.getClerk()?.add() + if(CompileConfig.DEBUG){ + Log.i(TAG, "cacheop-isCacheCity") + } + RoadHelper.getInstance()?.isCityDataCached(lon, lat,call) + } + + /** + * 获取城市数据版本 + */ + fun getHdDataVersionByCity(lon: Double,lat: Double,call:IResult){ + mMapAutoView.getClerk()?.add("$lon,$lat") + if(CompileConfig.DEBUG){ + Log.i(TAG, "cacheop-getHdDataVersionByCity:$lon,$lat") + } + RoadHelper.getInstance()?.getHdDataVersionByCity(lon, lat,call) + } + + /** + * 取消缓存数据 + */ + fun cancelCacheHDData(){ + mMapAutoView.getClerk()?.add() + if(CompileConfig.DEBUG){ + Log.i(TAG, "cacheop-cancelCacheHDData:") + } + mMapAutoView.getMapController()?.cancelCacheHDData() + } + + /** + * 设置锁车后的恢复时间 + * @param time 等待时间 + */ + fun setLockCarRecycleWaitTime(time: Long){ + mMapAutoView.getClerk()?.add("$time") + mMapAutoView.getMapController()?.setWaitTime(time) + } + + /** + * 设置锁车状态 + */ + fun setIsAutoLockCar(isLockCar: Boolean){ + mMapAutoView.getClerk()?.add("$isLockCar") + mMapAutoView.getMapController()?.setIsAutoLockCar(isLockCar) + } + + /** + * 转换UTM坐标和经纬度坐标数据 + */ + fun switchData(x: Double, y: Double, isWgs84: Boolean): DoubleArray?{ + mMapAutoView.getClerk()?.add("$x,$y,$isWgs84") + return mMapAutoView.getMapController()?.switchData(x,y,isWgs84) + } + + /** + * 设置漫游模式 + */ + fun setTransitionStyle(){ + mMapAutoView.getClerk()?.add() + setMapViewVisualAngle(MapAutoApi.MAP_STYLE_VR_TRANS) + } + + /** + * 绘制盲区 + */ + fun drawDeadZone(deadZoneOptions: DeadZoneOptions): DeadZone? { + mMapAutoView.getClerk()?.add("$deadZoneOptions") + return mMapAutoView.getMapController()?.drawDeadZone(deadZoneOptions) + } + + /** + * 是否显示盲区 + * @param visible true 显示 false 隐藏 + */ + fun setDeadZoneVisible(visible: Boolean){ + mMapAutoView.getMapController()?.setDeadZoneVisible(visible) + } + + + /** + * 设置天气接口 + * @param type 0:没有天气效果 1:雨天 2:雪天 + */ + fun setWeatherType(type: String){ + if (CompileConfig.DEBUG){ + Log.i(TAG, "setWeatherType:${type}") + } + mMapAutoView.getMapController()?.setWeatherType(type) + } + + fun setWeatherEnable(isEnable: Boolean){ + if (CompileConfig.DEBUG){ + Log.i(TAG, "setWeatherEnable:${isEnable}") + } + mMapAutoView.setWeatherEnable(isEnable) + } + + fun getWeatherInfo(lon: Double, lat: Double, call: WeatherResult){ + if (CompileConfig.DEBUG){ + Log.i(TAG, "getWeatherInfo:${lon},$lat") + } + mMapAutoView.getMapController()?.getWeatherInfo(lon,lat,call) + } + + fun setSkyBoxMode(){ + if (CompileConfig.DEBUG){ + Log.i(TAG, "setSkyBoxMode") + } + mMapAutoView.getMapController()?.setSkyBoxMode() + } + + fun setFogMode(isEnable: Boolean){ + if (CompileConfig.DEBUG){ + Log.i(TAG, "setFogMode") + } + mMapAutoView.getMapController()?.setFogMode(isEnable) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/view/MapStyleParams.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/view/MapStyleParams.kt new file mode 100644 index 0000000000..14fdc79c91 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/view/MapStyleParams.kt @@ -0,0 +1,330 @@ +package com.zhidaoauto.map.sdk.open.view + +import com.zhidaoauto.map.sdk.inner.common.ConstantExt +import com.zhidaoauto.map.sdk.inner.map.MapController +import com.zhidaoauto.map.sdk.open.HDTypes +import com.zhidaoauto.map.sdk.open.MapAutoApi +import com.zhidaoauto.map.sdk.open.abs.view.IMapStyleParams + +class MapStyleParams: IMapStyleParams { + + + + // zoom级别 + private var zoom: Int = 20 + + // 小车位置 设置自车位置 offset 1.0-6.0, <4.0车向上,>4.0车向下 + private var carPosition: Float = ConstantExt.MAP_STYLE_VR_POSITION_MIDDLE + + + private var isAutoSwitch: Boolean = false + private var isAutoLocation = true + + //显示高精地图元素 + private var hdVisibileArray = intArrayOf( + HDTypes.DIVIDER.type, + HDTypes.ROAD_AREA.type, + HDTypes.STOP_LINE.type, + HDTypes.ARROW.type, + HDTypes.STATION_BRIDGE.type, + HDTypes.ZEBRA_LINE.type, + HDTypes.GREEN_BELT.type, + HDTypes.DIVERSION.type, + HDTypes.SAFE_ISLAND.type, + HDTypes.ALPHANUMERIC.type, + HDTypes.GUARDBAR.type, + HDTypes.TRAFFIC_DEVICE.type, + HDTypes.CABLE.type, + HDTypes.SIGNAL_LINE.type, + HDTypes.building.type, + HDTypes.streetLight.type, + HDTypes.area.type, + HDTypes.regional.type, + HDTypes.geometricLinear.type, + HDTypes.geometricSurface.type, +// HDTypes.TREE.type, + ) + /** + * 默认样式 + * const val MAP_STYLE_DAY = 0 //日间模式 + * const val MAP_STYLE_NIGHT = 1 //夜间模式 + * const val MAP_STYLE_SATEL = 2 //SATEL模式 + * const val MAP_STYLE_DAY_NAV = 3 //日间导航模式 + * const val MAP_STYLE_NIGHT_NAV = 4 //夜间导航模式 + */ + private var styleMode: Int = MapAutoApi.MAP_STYLE_NIGHT_VR + + /** + * 视图模式 + * 2D = 1 + * 3D = 2 + */ + private var perspectiveMode: Int = MAP_PERSPECTIVE_3D + + private var vrPerspectiveMode: Float = ConstantExt.MAP_STYLE_VR_OVER_LOOK_ANGLE_MIDDLE + + private var vrAngleMode: Int = ConstantExt.MAP_STYLE_VR_ANGLE_MIDDLE + + private var isSwitchViewAngle = false + + private var vrEyeHeight : Float = ConstantExt.MAP_STYLE_VR_EYE_HEIGHT_MIDDLE + + // zoom级别 + private var zoomVal = ConstantExt.MAP_STYLE_VR_ZOOM_VAL_MIDDLE + + private var minDistanceForPosition = 0.02f + + //开启阴影 + private var isShadowEnable = true + + private var styleName = "" + + private var default_perspective = ConstantExt.MAP_STYLE_VR_ANGLE_MIDDLE + + private var isSkyBoxEnable = false + + private var isWeatherEnable = true + + + companion object { + + const val MAP_PERSPECTIVE_2D = MapController.MAP_PERSPECTIVE_2D //2D视图 + const val MAP_PERSPECTIVE_3D = MapController.MAP_PERSPECTIVE_3D //3D视图 + const val MAP_PERSPECTIVE_UP_CAR = MapController.MAP_PERSPECTIVE_UP_CAR //车头向上 + const val MAP_PERSPECTIVE_UP_NORTH = MapController.MAP_PERSPECTIVE_UP_NORTH //正北向上 + + const val STYLE_ERHAI = "erhai" + const val STYLE_NORMAL = "normal" + //近视角模式 + const val MAP_STYLE_VR_ANGLE_NEAR = 0 + //默认视角模式 + const val MAP_STYLE_VR_ANGLE_MIDDLE = 1 + //远视角模式 + const val MAP_STYLE_VR_ANGLE_FAR = 2 + //300米视角模式 + const val MAP_STYLE_VR_ANGLE_300 = 3 + //顶视角模式 + const val MAP_STYLE_VR_ANGLE_TOP = 4 + //十字路口视角 + const val MAP_STYLE_VR_ANGLE_CROSS = 5 + //小巴默认视角 + const val MAP_STYLE_VR_ANGLE_MIDDLE_XIAOBA = 6 + //漫游模式 + const val MAP_STYLE_VR_ROAM = 7 + //过渡模式 + const val MAP_STYLE_VR_TRANS = 8 + //洱海B2车辆模式 + const val MAP_STYLE_VR_ERHAI_B2 = 9 + + + } + + /** + * 设置是否开启阴影渲染 + * @param enable 默认true + */ + override fun setShadowEnable(enable: Boolean): MapStyleParams { + this.isShadowEnable = enable + return this; + } + + + + + override fun setZoom(zoom: Int): MapStyleParams { + this.zoom = zoom + return this; + } + + /** + * 设置自车位置 + * @param offset 1.0-6.0, <4.0车向上,>4.0车向下 + */ + override fun setCarPosition(offset: Float): MapStyleParams { + this.carPosition = offset + return this; + } + + + /** + * 设置模式 + * @param styleMode 模式 + */ + override fun setStyleMode(styleMode: Int): MapStyleParams { + this.styleMode = styleMode + return this; + } + + /** + * 设置视图模式 + * @param perspectiveMode 视图模 + */ + override fun setPerspectiveMode(perspectiveMode: Int): MapStyleParams { + this.perspectiveMode = perspectiveMode + return this; + } + + + override fun getHDVisibileArray(): IntArray { + return hdVisibileArray + } + + /** + * 设置需要渲染显示的图层 + * @param filter 参照 HDTypes + */ + override fun setHDVisibileArray(filter: IntArray): MapStyleParams { + this.hdVisibileArray = filter + return this; + } + + override fun getStyleMode(): Int { + return styleMode + } + + override fun getPerspectiveMode(): Int { + return perspectiveMode + } + + override fun getZoom(): Int { + return zoom + } + + override fun getCarPosition(): Float { + return carPosition + } + + override fun setAutoSwitch(isAutoSwitch: Boolean): MapStyleParams { + this.isAutoSwitch = isAutoSwitch + return this + } + + override fun isAutoSwitch(): Boolean { + return isAutoSwitch + } + + override fun getVrPerspectiveMode(): Float{ + return vrPerspectiveMode + } + + override fun setVrPerspectiveMode(vrPerspectiveMode: Float): MapStyleParams{ + this.vrPerspectiveMode = vrPerspectiveMode + return this + } + + override fun setVrAngleMode(vrAngleMode: Int): MapStyleParams{ + this.vrAngleMode = vrAngleMode + return this + } + + override fun getVrAngleMode(): Int{ + return this.vrAngleMode + } + + override fun setSwitchViewAngle(isSwitchViewAngle: Boolean): MapStyleParams{ + this.isSwitchViewAngle = isSwitchViewAngle + return this + } + override fun isSwitchViewAngle(): Boolean{ + return this.isSwitchViewAngle + } + + override fun getVrEyeHeight(): Float{ + return vrEyeHeight + } + + override fun setVrEyeHeight(vrEyeHeight: Float):MapStyleParams{ + this.vrEyeHeight = vrEyeHeight + return this + } + + /** + * 设置是否开启自动定位 + * @param isAutoLocation 默认true + */ + override fun setAutoLocation(isAutoLocation: Boolean): MapStyleParams{ + this.isAutoLocation = isAutoLocation + return this + } + + + override fun getAutoLocation(): Boolean{ + return this.isAutoLocation + } + + override fun getZoomVal(): Float { + return zoomVal + } + + override fun setZoomVal(zoomVal: Float):MapStyleParams { + this.zoomVal = zoomVal + return this + } + + override fun getMinDistanceForPosition(): Float { + return minDistanceForPosition + } + + /** + * 设置定位更新变动的最小距离 + * @param minDistanceForPosition 距离 + */ + override fun setMinDistanceForPosition(minDistanceForPosition: Float): MapStyleParams { + this.minDistanceForPosition = minDistanceForPosition + return this + } + + + override fun isShadowEnable(): Boolean{ + return isShadowEnable + } + + + override fun getStyleName(): String{ + return styleName + } + + + override fun setStyleName(name: String): MapStyleParams{ + styleName = name + return this + } + + override fun getDefaultPerspective(): Int{ + return default_perspective + } + + + override fun setDefaultPerspective(type: Int): MapStyleParams{ + default_perspective = type + return this + } + + override fun setIsSkyBoxEnable(isEnable: Boolean): MapStyleParams{ + isSkyBoxEnable = isEnable + return this + } + + + override fun getIsSkyBoxEnable(): Boolean{ + return isSkyBoxEnable + } + + + override fun setIsWeatherEnable(isEnable: Boolean): MapStyleParams{ + isWeatherEnable = isEnable + return this + } + + + override fun getIsWeatherEnable(): Boolean{ + return isWeatherEnable + } + + + override fun toString(): String { + return "MapStyleParams( zoom=$zoom, carPosition=$carPosition, isAutoSwitch=$isAutoSwitch, isAutoLocation=$isAutoLocation, hdVisibileArray=${hdVisibileArray.contentToString()}, styleMode=$styleMode, perspectiveMode=$perspectiveMode, vrPerspectiveMode=$vrPerspectiveMode, vrAngleMode=$vrAngleMode, isSwitchViewAngle=$isSwitchViewAngle, vrEyeHeight=$vrEyeHeight, zoomVal=$zoomVal, minDistanceForPosition=$minDistanceForPosition, isShadowEnable=$isShadowEnable, styleName='$styleName')" + } + + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherInfo.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherInfo.kt new file mode 100644 index 0000000000..e608a07fae --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherInfo.kt @@ -0,0 +1,15 @@ +package com.zhidaoauto.map.sdk.open.weather + +class WeatherInfo { + val province:String = ""// 省份名 + val city:String = ""// 城市名 + val weather:String = ""// 天气现象(汉字描述) + val temperature:String=""// 实时气温,单位:摄氏度 + val winddirection: String=""// 风向描述 + val windpower: String=""// 风力级别,单位:级 + val humidity:String=""// 空气湿度 + override fun toString(): String { + return "WeatherInfo(province='$province', city='$city', weather='$weather', temperature='$temperature', winddirection='$winddirection', windpower='$windpower', humidity='$humidity')" + } + +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherModel.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherModel.kt new file mode 100644 index 0000000000..225e624af8 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherModel.kt @@ -0,0 +1,31 @@ +package com.zhidaoauto.map.sdk.open.weather + +import android.util.Log +import com.zhidao.map.net.api.Result +import com.zhidaoauto.map.sdk.inner.CompileConfig +import com.zhidaoauto.map.sdk.inner.controller.CommonController +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch + +object WeatherModel { + + private val weatherRepository by lazy { WeatherRepository() } + + fun getWeatherInfo(lon:Double,lat:Double, call: WeatherResult){ + var weatherInfo = WeatherInfo() + CommonController.instance.scope?.launch(Dispatchers.IO) { + val result = weatherRepository.getInfo(lon, lat) + if(CompileConfig.DEBUG) { + Log.d("getWeatherInfo", "result: ${result}") + } + if (result is Result.Success) { + if(result.data != null){ + weatherInfo = result.data + } + call.result(0, weatherInfo, "获取天气信息成功") + }else{ + call.result(1, weatherInfo, "获取天气信息失败") + } + } + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherRepository.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherRepository.kt new file mode 100644 index 0000000000..20a37c7c35 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherRepository.kt @@ -0,0 +1,21 @@ +package com.zhidaoauto.map.sdk.open.weather + +import com.zhidao.map.net.api.BaseRepository +import com.zhidao.map.net.api.Result +import com.zhidaoauto.map.sdk.open.net.WeatherRetrofitClient + + +class WeatherRepository: BaseRepository() { + + suspend fun getInfo(lon:Double,lat:Double): Result { + val map = HashMap() + map.put("lon","$lon") + map.put("lat","$lat") + + return safeApiCall( + + call = { executeResponse(WeatherRetrofitClient.service.getInfo(map), {}) }, + errorMessage = "返回失败!" + ) + } +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherResult.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherResult.kt new file mode 100644 index 0000000000..055ceb1dc1 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherResult.kt @@ -0,0 +1,5 @@ +package com.zhidaoauto.map.sdk.open.weather + +interface WeatherResult { + fun result(code:Int, data: WeatherInfo?, message: String?) +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherType.kt b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherType.kt new file mode 100644 index 0000000000..4a9b6c3192 --- /dev/null +++ b/libraries/mapmodule/src/main/java/com/zhidaoauto/map/sdk/open/weather/WeatherType.kt @@ -0,0 +1,9 @@ +package com.zhidaoauto.map.sdk.open.weather + +enum class WeatherType( + val type: String +) { + DEFULT("0"), + RAIN("1"), + SNOW("2") +} \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/anim/bottom_in.xml b/libraries/mapmodule/src/main/res/anim/bottom_in.xml new file mode 100644 index 0000000000..936cdb8010 --- /dev/null +++ b/libraries/mapmodule/src/main/res/anim/bottom_in.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/anim/bottom_out.xml b/libraries/mapmodule/src/main/res/anim/bottom_out.xml new file mode 100644 index 0000000000..4848c61744 --- /dev/null +++ b/libraries/mapmodule/src/main/res/anim/bottom_out.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/anim/cycle_7_1.xml b/libraries/mapmodule/src/main/res/anim/cycle_7_1.xml new file mode 100644 index 0000000000..02fb699177 --- /dev/null +++ b/libraries/mapmodule/src/main/res/anim/cycle_7_1.xml @@ -0,0 +1,17 @@ + + + + diff --git a/libraries/mapmodule/src/main/res/anim/left_in.xml b/libraries/mapmodule/src/main/res/anim/left_in.xml new file mode 100644 index 0000000000..e6e33e3915 --- /dev/null +++ b/libraries/mapmodule/src/main/res/anim/left_in.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/anim/left_out.xml b/libraries/mapmodule/src/main/res/anim/left_out.xml new file mode 100644 index 0000000000..b845b4b1d5 --- /dev/null +++ b/libraries/mapmodule/src/main/res/anim/left_out.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/anim/push_left_in.xml b/libraries/mapmodule/src/main/res/anim/push_left_in.xml new file mode 100644 index 0000000000..95973ebb74 --- /dev/null +++ b/libraries/mapmodule/src/main/res/anim/push_left_in.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/libraries/mapmodule/src/main/res/anim/right_in.xml b/libraries/mapmodule/src/main/res/anim/right_in.xml new file mode 100644 index 0000000000..c744a6519b --- /dev/null +++ b/libraries/mapmodule/src/main/res/anim/right_in.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/anim/right_out.xml b/libraries/mapmodule/src/main/res/anim/right_out.xml new file mode 100644 index 0000000000..7e580cfc67 --- /dev/null +++ b/libraries/mapmodule/src/main/res/anim/right_out.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/anim/shake.xml b/libraries/mapmodule/src/main/res/anim/shake.xml new file mode 100644 index 0000000000..e9758d7705 --- /dev/null +++ b/libraries/mapmodule/src/main/res/anim/shake.xml @@ -0,0 +1,18 @@ + + + + diff --git a/libraries/mapmodule/src/main/res/anim/slide_top_to_bottom.xml b/libraries/mapmodule/src/main/res/anim/slide_top_to_bottom.xml new file mode 100644 index 0000000000..e2120fe052 --- /dev/null +++ b/libraries/mapmodule/src/main/res/anim/slide_top_to_bottom.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/libraries/mapmodule/src/main/res/anim/top_in.xml b/libraries/mapmodule/src/main/res/anim/top_in.xml new file mode 100644 index 0000000000..2aca3e1827 --- /dev/null +++ b/libraries/mapmodule/src/main/res/anim/top_in.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/anim/top_out.xml b/libraries/mapmodule/src/main/res/anim/top_out.xml new file mode 100644 index 0000000000..9c25a501e7 --- /dev/null +++ b/libraries/mapmodule/src/main/res/anim/top_out.xml @@ -0,0 +1,25 @@ + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/color/selector_white_gray.xml b/libraries/mapmodule/src/main/res/color/selector_white_gray.xml new file mode 100644 index 0000000000..2836a4e625 --- /dev/null +++ b/libraries/mapmodule/src/main/res/color/selector_white_gray.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/bg_menu_n.9.png b/libraries/mapmodule/src/main/res/drawable/bg_menu_n.9.png new file mode 100644 index 0000000000..880289e14c Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/bg_menu_n.9.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/bg_menu_p.9.png b/libraries/mapmodule/src/main/res/drawable/bg_menu_p.9.png new file mode 100644 index 0000000000..b0e6c1e255 Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/bg_menu_p.9.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/bg_search_edit.9.png b/libraries/mapmodule/src/main/res/drawable/bg_search_edit.9.png new file mode 100644 index 0000000000..ffd3e25aee Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/bg_search_edit.9.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/btn.xml b/libraries/mapmodule/src/main/res/drawable/btn.xml new file mode 100644 index 0000000000..fd893e0413 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/btn.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/btn_day.xml b/libraries/mapmodule/src/main/res/drawable/btn_day.xml new file mode 100644 index 0000000000..5c0b760abe --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/btn_day.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/libraries/mapmodule/src/main/res/drawable/btn_day_press.xml b/libraries/mapmodule/src/main/res/drawable/btn_day_press.xml new file mode 100644 index 0000000000..005576c0e1 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/btn_day_press.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/libraries/mapmodule/src/main/res/drawable/btn_guidance_selecter.xml b/libraries/mapmodule/src/main/res/drawable/btn_guidance_selecter.xml new file mode 100644 index 0000000000..c527a933e9 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/btn_guidance_selecter.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/btn_keyboard_key_ics.xml b/libraries/mapmodule/src/main/res/drawable/btn_keyboard_key_ics.xml new file mode 100644 index 0000000000..7d4ce4265c --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/btn_keyboard_key_ics.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/btn_night.xml b/libraries/mapmodule/src/main/res/drawable/btn_night.xml new file mode 100644 index 0000000000..20aa53e9d2 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/btn_night.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/libraries/mapmodule/src/main/res/drawable/btn_night_press.xml b/libraries/mapmodule/src/main/res/drawable/btn_night_press.xml new file mode 100644 index 0000000000..6b0221b739 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/btn_night_press.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/libraries/mapmodule/src/main/res/drawable/btn_p.xml b/libraries/mapmodule/src/main/res/drawable/btn_p.xml new file mode 100644 index 0000000000..1a7fcdec1d --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/btn_p.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/btn_selecter.xml b/libraries/mapmodule/src/main/res/drawable/btn_selecter.xml new file mode 100644 index 0000000000..5ef75b7f28 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/btn_selecter.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/btn_selecter_day.xml b/libraries/mapmodule/src/main/res/drawable/btn_selecter_day.xml new file mode 100644 index 0000000000..0673a74934 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/btn_selecter_day.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/btn_selecter_night.xml b/libraries/mapmodule/src/main/res/drawable/btn_selecter_night.xml new file mode 100644 index 0000000000..9e27ec3e1a --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/btn_selecter_night.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/btn_selecter_s.xml b/libraries/mapmodule/src/main/res/drawable/btn_selecter_s.xml new file mode 100644 index 0000000000..4d11f04f61 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/btn_selecter_s.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/button_selectordialog_gray.xml b/libraries/mapmodule/src/main/res/drawable/button_selectordialog_gray.xml new file mode 100644 index 0000000000..9ef47f57c6 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/button_selectordialog_gray.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/custom_info_bubble.9.png b/libraries/mapmodule/src/main/res/drawable/custom_info_bubble.9.png new file mode 100644 index 0000000000..d6440b0c14 Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/custom_info_bubble.9.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/editbox_bkg.xml b/libraries/mapmodule/src/main/res/drawable/editbox_bkg.xml new file mode 100644 index 0000000000..1328e9c0fe --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/editbox_bkg.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/guidance_speed_bg.xml b/libraries/mapmodule/src/main/res/drawable/guidance_speed_bg.xml new file mode 100644 index 0000000000..a9ca68d599 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/guidance_speed_bg.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/guidance_speed_p_bg.xml b/libraries/mapmodule/src/main/res/drawable/guidance_speed_p_bg.xml new file mode 100644 index 0000000000..ee434ffe78 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/guidance_speed_p_bg.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/ic_amap_navi_cursor.png b/libraries/mapmodule/src/main/res/drawable/ic_amap_navi_cursor.png new file mode 100644 index 0000000000..6957c2c84c Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/ic_amap_navi_cursor.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/ic_map_textview_bg.9.png b/libraries/mapmodule/src/main/res/drawable/ic_map_textview_bg.9.png new file mode 100644 index 0000000000..537b773fa3 Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/ic_map_textview_bg.9.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/ic_panel_route_select.9.png b/libraries/mapmodule/src/main/res/drawable/ic_panel_route_select.9.png new file mode 100644 index 0000000000..c3d8e691e9 Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/ic_panel_route_select.9.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/ic_panel_route_select_down.9.png b/libraries/mapmodule/src/main/res/drawable/ic_panel_route_select_down.9.png new file mode 100644 index 0000000000..7a69dc7cf5 Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/ic_panel_route_select_down.9.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/ic_search_input.9.png b/libraries/mapmodule/src/main/res/drawable/ic_search_input.9.png new file mode 100644 index 0000000000..d648d58d12 Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/ic_search_input.9.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/keyboard_background_holo.9.png b/libraries/mapmodule/src/main/res/drawable/keyboard_background_holo.9.png new file mode 100644 index 0000000000..73868751ce Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/keyboard_background_holo.9.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/line_v.9.png b/libraries/mapmodule/src/main/res/drawable/line_v.9.png new file mode 100644 index 0000000000..44b4cf0409 Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/line_v.9.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/list_line.9.png b/libraries/mapmodule/src/main/res/drawable/list_line.9.png new file mode 100644 index 0000000000..53a1ee0d3e Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/list_line.9.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/listview_bg_dark.xml b/libraries/mapmodule/src/main/res/drawable/listview_bg_dark.xml new file mode 100644 index 0000000000..413e982120 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/listview_bg_dark.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/map_api_ic_current_location2.png b/libraries/mapmodule/src/main/res/drawable/map_api_ic_current_location2.png new file mode 100644 index 0000000000..5219b2f620 Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/map_api_ic_current_location2.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/mapscale.9.png b/libraries/mapmodule/src/main/res/drawable/mapscale.9.png new file mode 100644 index 0000000000..a9ebf4b259 Binary files /dev/null and b/libraries/mapmodule/src/main/res/drawable/mapscale.9.png differ diff --git a/libraries/mapmodule/src/main/res/drawable/menu_left_btn_p.xml b/libraries/mapmodule/src/main/res/drawable/menu_left_btn_p.xml new file mode 100644 index 0000000000..7d24530f90 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/menu_left_btn_p.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/navi_tmcbar_bg.xml b/libraries/mapmodule/src/main/res/drawable/navi_tmcbar_bg.xml new file mode 100644 index 0000000000..3e745198b1 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/navi_tmcbar_bg.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/panel_channellist_detail.xml b/libraries/mapmodule/src/main/res/drawable/panel_channellist_detail.xml new file mode 100644 index 0000000000..42a94a229d --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/panel_channellist_detail.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/panel_menu_selector.xml b/libraries/mapmodule/src/main/res/drawable/panel_menu_selector.xml new file mode 100644 index 0000000000..d3ec2defb4 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/panel_menu_selector.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/panel_route_selecter.xml b/libraries/mapmodule/src/main/res/drawable/panel_route_selecter.xml new file mode 100644 index 0000000000..144d2df679 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/panel_route_selecter.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/panel_route_selecter_p.xml b/libraries/mapmodule/src/main/res/drawable/panel_route_selecter_p.xml new file mode 100644 index 0000000000..8ac7f62f42 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/panel_route_selecter_p.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/panel_search_btn_selector.xml b/libraries/mapmodule/src/main/res/drawable/panel_search_btn_selector.xml new file mode 100644 index 0000000000..b19e97cee4 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/panel_search_btn_selector.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/panel_search_indicator_selector.xml b/libraries/mapmodule/src/main/res/drawable/panel_search_indicator_selector.xml new file mode 100644 index 0000000000..aa440dc1d8 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/panel_search_indicator_selector.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/panel_search_voice_selector.xml b/libraries/mapmodule/src/main/res/drawable/panel_search_voice_selector.xml new file mode 100644 index 0000000000..169b87e2db --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/panel_search_voice_selector.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/progress_bg.xml b/libraries/mapmodule/src/main/res/drawable/progress_bg.xml new file mode 100644 index 0000000000..ca76cf6c3d --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/progress_bg.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/rect_dark.xml b/libraries/mapmodule/src/main/res/drawable/rect_dark.xml new file mode 100644 index 0000000000..694ee67858 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/rect_dark.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/rect_light.xml b/libraries/mapmodule/src/main/res/drawable/rect_light.xml new file mode 100644 index 0000000000..9c26ee1c6d --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/rect_light.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/selector_nav_btn.xml b/libraries/mapmodule/src/main/res/drawable/selector_nav_btn.xml new file mode 100644 index 0000000000..d485aa28f7 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/selector_nav_btn.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/shadow_left.xml b/libraries/mapmodule/src/main/res/drawable/shadow_left.xml new file mode 100644 index 0000000000..cba565064a --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/shadow_left.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/shadow_line.xml b/libraries/mapmodule/src/main/res/drawable/shadow_line.xml new file mode 100644 index 0000000000..2af1aa9b33 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/shadow_line.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/shadow_line2.xml b/libraries/mapmodule/src/main/res/drawable/shadow_line2.xml new file mode 100644 index 0000000000..bf789c7144 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/shadow_line2.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/shadow_progress.xml b/libraries/mapmodule/src/main/res/drawable/shadow_progress.xml new file mode 100644 index 0000000000..bebd0b78ba --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/shadow_progress.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/shadow_right.xml b/libraries/mapmodule/src/main/res/drawable/shadow_right.xml new file mode 100644 index 0000000000..de9ecf0834 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/shadow_right.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/shape_blue_trans.xml b/libraries/mapmodule/src/main/res/drawable/shape_blue_trans.xml new file mode 100644 index 0000000000..fbdd6ae83c --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/shape_blue_trans.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/stat_sys_download.xml b/libraries/mapmodule/src/main/res/drawable/stat_sys_download.xml new file mode 100644 index 0000000000..d117307ad5 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/stat_sys_download.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + diff --git a/libraries/mapmodule/src/main/res/drawable/text_bg.xml b/libraries/mapmodule/src/main/res/drawable/text_bg.xml new file mode 100644 index 0000000000..8d58501442 --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/text_bg.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/drawable/transparent_drawable.xml b/libraries/mapmodule/src/main/res/drawable/transparent_drawable.xml new file mode 100644 index 0000000000..9b15941adb --- /dev/null +++ b/libraries/mapmodule/src/main/res/drawable/transparent_drawable.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/layout/dialog_routing_set.xml b/libraries/mapmodule/src/main/res/layout/dialog_routing_set.xml new file mode 100644 index 0000000000..2bc21afc82 --- /dev/null +++ b/libraries/mapmodule/src/main/res/layout/dialog_routing_set.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/layout/dialog_select.xml b/libraries/mapmodule/src/main/res/layout/dialog_select.xml new file mode 100644 index 0000000000..f5ad05e54e --- /dev/null +++ b/libraries/mapmodule/src/main/res/layout/dialog_select.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/layout/dialog_tip.xml b/libraries/mapmodule/src/main/res/layout/dialog_tip.xml new file mode 100644 index 0000000000..b5ba283689 --- /dev/null +++ b/libraries/mapmodule/src/main/res/layout/dialog_tip.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + diff --git a/libraries/mapmodule/src/main/res/layout/dialog_wait.xml b/libraries/mapmodule/src/main/res/layout/dialog_wait.xml new file mode 100644 index 0000000000..9374ab3398 --- /dev/null +++ b/libraries/mapmodule/src/main/res/layout/dialog_wait.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/libraries/mapmodule/src/main/res/layout/layout_custom_info.xml b/libraries/mapmodule/src/main/res/layout/layout_custom_info.xml new file mode 100644 index 0000000000..a12ebecf73 --- /dev/null +++ b/libraries/mapmodule/src/main/res/layout/layout_custom_info.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + diff --git a/libraries/mapmodule/src/main/res/layout/layout_map_auto_view.xml b/libraries/mapmodule/src/main/res/layout/layout_map_auto_view.xml new file mode 100644 index 0000000000..90c85bcf10 --- /dev/null +++ b/libraries/mapmodule/src/main/res/layout/layout_map_auto_view.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/layout/layout_marker_infowindow_layer.xml b/libraries/mapmodule/src/main/res/layout/layout_marker_infowindow_layer.xml new file mode 100644 index 0000000000..a7c8b43b44 --- /dev/null +++ b/libraries/mapmodule/src/main/res/layout/layout_marker_infowindow_layer.xml @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/libraries/mapmodule/src/main/res/layout/layout_normal_info_window_style.xml b/libraries/mapmodule/src/main/res/layout/layout_normal_info_window_style.xml new file mode 100644 index 0000000000..554ac0213d --- /dev/null +++ b/libraries/mapmodule/src/main/res/layout/layout_normal_info_window_style.xml @@ -0,0 +1,29 @@ + + + + + + + diff --git a/libraries/mapmodule/src/main/res/layout/layout_panel_btn_top_right.xml b/libraries/mapmodule/src/main/res/layout/layout_panel_btn_top_right.xml new file mode 100644 index 0000000000..dd00b63162 --- /dev/null +++ b/libraries/mapmodule/src/main/res/layout/layout_panel_btn_top_right.xml @@ -0,0 +1,27 @@ + + + + + + + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/layout/layout_panel_guidance.xml b/libraries/mapmodule/src/main/res/layout/layout_panel_guidance.xml new file mode 100644 index 0000000000..72071cd9ca --- /dev/null +++ b/libraries/mapmodule/src/main/res/layout/layout_panel_guidance.xml @@ -0,0 +1,470 @@ + + + + + + + + + + + + + + + + + + + + +
+ + \ No newline at end of file diff --git a/libraries/mapmodule/src/main/res/layout/panel_route_set.xml b/libraries/mapmodule/src/main/res/layout/panel_route_set.xml new file mode 100644 index 0000000000..26e58dd9a0 --- /dev/null +++ b/libraries/mapmodule/src/main/res/layout/panel_route_set.xml @@ -0,0 +1,120 @@ + + + + + + + + +