merge origin dev2_aiSdk
1
.idea/gradle.xml
generated
@@ -18,7 +18,6 @@
|
||||
<option value="$PROJECT_DIR$/OCH/mogo-och-noop" />
|
||||
<option value="$PROJECT_DIR$/OCH/mogo-och-taxi" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
<option value="$PROJECT_DIR$/app2" />
|
||||
<option value="$PROJECT_DIR$/foudations" />
|
||||
<option value="$PROJECT_DIR$/foudations/httpdns-base" />
|
||||
<option value="$PROJECT_DIR$/foudations/httpdns-mogo" />
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<corners android:radius="17px" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#152147"
|
||||
android:startColor="#354E8A" />
|
||||
android:endColor="#3B4577"
|
||||
android:startColor="#3B4577" />
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
@@ -18,8 +18,8 @@
|
||||
<corners android:radius="17px" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#141C35"
|
||||
android:startColor="#344687" />
|
||||
android:endColor="#3B4577"
|
||||
android:startColor="#3B4577" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -2,9 +2,9 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:centerColor="#7f080F25"
|
||||
android:endColor="#7f121A35"
|
||||
android:startColor="#7f131D42" />
|
||||
android:centerColor="#80222A4E"
|
||||
android:endColor="#80222A4E"
|
||||
android:startColor="#80222A4E" />
|
||||
<corners
|
||||
android:bottomLeftRadius="17px"
|
||||
android:bottomRightRadius="17px"
|
||||
|
||||
@@ -119,8 +119,6 @@
|
||||
android:id="@+id/module_och_taxi_order_distance_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/module_och_taxi_order_distance_container_height"
|
||||
android:layout_marginLeft="@dimen/module_och_taxi_order_distance_container_marginLeft"
|
||||
android:layout_marginRight="@dimen/module_och_taxi_order_distance_container_marginLeft"
|
||||
android:background="@drawable/module_och_taxi_panel_distance_bkg">
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
android:id="@+id/module_mogo_och_station_panel_container"
|
||||
android:layout_width="300px"
|
||||
android:layout_height="270px"
|
||||
android:layout_marginTop="10px"
|
||||
android:layout_marginTop="16px"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_mogo_och_autopilot_status"
|
||||
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_autopilot_status"
|
||||
app:layout_goneMarginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call" />
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<dimen name="module_mogo_och_margin_bottom">46px</dimen>
|
||||
<dimen name="module_mogo_och_margin_top">24px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_station_panel_container_margin_top_no_call">351px</dimen>
|
||||
<dimen name="module_mogo_och_station_panel_container_margin_top_no_call">345px</dimen>
|
||||
<dimen name="module_mogo_och_station_panel_container_margin_top_with_call">492px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_autopilot_status_bg_corner">24px</dimen>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// 网约车服务:仅小巴车、出租车渠道用
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydautoImplementation rootProject.ext.dependencies.mogoochnoop
|
||||
|
||||
@@ -96,7 +96,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_GAODE_AIMLESS_SHARE, "GaoDeAimlessShare"));
|
||||
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_MOGO_MONITOR, "MogoMonitor"));
|
||||
MogoModulePaths.addModule(new MogoModule(PushUIConstants.PATH, PushUIConstants.NAME));
|
||||
// 碰撞报警模块
|
||||
// 碰撞报警模块
|
||||
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_CRASH_WARNING, "CrashWarning"));
|
||||
// MogoModulePaths.addModule( new MogoModule( IMogoMachineVisionProvider.path, "IMogoMachineVisionProvider" ) );
|
||||
|
||||
|
||||
1
app2/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,71 +0,0 @@
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.freedom.app2"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 22
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
|
||||
multiDexEnabled true
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility 1.8
|
||||
targetCompatibility 1.8
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'META-INF/proguard/coroutines.pro'
|
||||
exclude 'META-INF/*'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
implementation rootProject.ext.dependencies.boostmultidex
|
||||
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation project(":foudations:mogo-utils")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(":foudations:httpdns-base")
|
||||
implementation project(":foudations:httpdns-tencent")
|
||||
implementation project(":modules:mogo-module-common")
|
||||
implementation project(':services:mogo-service-api')
|
||||
implementation project(':services:mogo-service')
|
||||
}
|
||||
21
app2/proguard-rules.pro
vendored
@@ -1,21 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.freedom.app2;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith( AndroidJUnit4.class )
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals( "com.freedom.app2", appContext.getPackageName() );
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.freedom.app2">
|
||||
|
||||
<application
|
||||
android:name=".DemoApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.freedom.app2;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.GET;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/11/18
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
interface ApiServices {
|
||||
|
||||
@GET( "/test/test" )
|
||||
Observable< ResponseBody > requestHttpDns();
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.freedom.app2;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.bytedance.boost_multidex.BoostMultiDex;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/11/18
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class DemoApplication extends AbsMogoApplication {
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
DebugConfig.setDebug( true );
|
||||
super.onCreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext( Context base ) {
|
||||
super.attachBaseContext( base );
|
||||
BoostMultiDex.install( base );
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
package com.freedom.app2;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.httpdns.HttpDnsConst;
|
||||
import com.mogo.httpdns.IHttpDnsCallback;
|
||||
import com.mogo.httpdns.IMogoHttpDns;
|
||||
import com.mogo.httpdns.MogoHttpDnsHandler;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private ApiServices apiServices;
|
||||
private IMogoHttpDns httpDns;
|
||||
|
||||
private View send;
|
||||
private View fresh;
|
||||
private View fresh2;
|
||||
private TextView content;
|
||||
|
||||
@Override
|
||||
protected void onCreate( Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
setContentView( R.layout.activity_main );
|
||||
|
||||
send = findViewById( R.id.send );
|
||||
fresh = findViewById( R.id.fresh );
|
||||
fresh2 = findViewById( R.id.fresh2 );
|
||||
content = findViewById( R.id.content );
|
||||
|
||||
httpDns = MogoHttpDnsHandler.getHttpDnsApi();
|
||||
apiServices = MogoApisHandler.getInstance().getApis().getNetworkApi().create( ApiServices.class, "https://dnstest.zhidaozhixing.com" );
|
||||
|
||||
send.setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
apiServices.requestHttpDns()
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.subscribe( new SubscribeImpl< ResponseBody >( RequestOptions.create( MainActivity.this ).loading( true ) ) {
|
||||
@Override
|
||||
public void onSuccess( ResponseBody o ) {
|
||||
super.onSuccess( o );
|
||||
try {
|
||||
renderResponse( o );
|
||||
} catch ( Exception e ) {
|
||||
content.setText( Log.getStackTraceString( e ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
content.setText( Log.getStackTraceString( e ) );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
fresh.setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
WorkThreadHandler.getInstance().post( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
httpDns.getHttpDnsIp( "dnstest.zhidaozhixing.com", HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_HTTP, false, new IHttpDnsCallback() {
|
||||
@Override
|
||||
public void onParsed( @Nullable String ip ) {
|
||||
StringBuilder sb = new StringBuilder( "httpDns ip:\n" );
|
||||
sb.append( ip ).append( "\n" );
|
||||
UiThreadHandler.post( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
content.setText( sb.toString() );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
fresh2.setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
WorkThreadHandler.getInstance().post( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
httpDns.getHttpDnsIp( "dzt-city.zhidaozhixing.com", HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_HTTP, false, new IHttpDnsCallback() {
|
||||
@Override
|
||||
public void onParsed( @Nullable String ip ) {
|
||||
StringBuilder sb = new StringBuilder( "httpDns ip:\n" );
|
||||
sb.append( ip ).append( "\n" );
|
||||
UiThreadHandler.post( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
content.setText( sb.toString() );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private void renderResponse( ResponseBody body ) {
|
||||
StringBuilder sb = new StringBuilder( "httpDns ip:\n" );
|
||||
String ip = httpDns.getCachedHttpDnsIps( "dnstest.zhidaozhixing.com", HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_HTTP );
|
||||
sb.append( ip ).append( "\n" );
|
||||
sb.append( "\nserverIp: \n" ).append( body.result.serverIp ).append( "\n" );
|
||||
content.setText( sb.toString() );
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.freedom.app2;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/11/18
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class ResponseBody extends BaseData {
|
||||
|
||||
public Result result;
|
||||
|
||||
public static class Result {
|
||||
public String serverIp;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
@@ -1,170 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="20dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/send"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="发起接口请求" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/fresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="发起dns请求" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/fresh2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="发起dns请求2" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:textColor="#000" />
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 16 KiB |
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#6200EE</color>
|
||||
<color name="colorPrimaryDark">#3700B3</color>
|
||||
<color name="colorAccent">#03DAC5</color>
|
||||
</resources>
|
||||
@@ -1,3 +0,0 @@
|
||||
<resources>
|
||||
<string name="app_name">app2</string>
|
||||
</resources>
|
||||
@@ -1,10 +0,0 @@
|
||||
<resources>
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.freedom.app2;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals( 4, 2 + 2 );
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.utils;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -12,60 +14,73 @@ import java.util.regex.Pattern;
|
||||
public class ColorUtils {
|
||||
|
||||
/**
|
||||
* @return 获取渐变色集合
|
||||
* ARGB颜色 转 HEX颜色
|
||||
*/
|
||||
public static List<Integer> gradient(String startColor, String endColor, int step) {
|
||||
// 将HEX转为RGB
|
||||
int[] sColor = hexToRgb(startColor);
|
||||
int[] eColor = hexToRgb(endColor);
|
||||
|
||||
// 计算每一步的差值
|
||||
int rStep = (eColor[0] - sColor[0]) / step;
|
||||
int gStep = (eColor[1] - sColor[1]) / step;
|
||||
int bStep = (eColor[2] - sColor[2]) / step;
|
||||
|
||||
// 生成渐变色
|
||||
List<Integer> gradientColorArr = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < step; i++) {
|
||||
|
||||
public static String argbToHex(int alpha, int red, int green, int blue) {
|
||||
if (alpha < 0 || alpha > 255
|
||||
|| red < 0 || red > 255
|
||||
|| green < 0 || green > 255
|
||||
|| blue < 0 || blue > 255) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return gradientColorArr;
|
||||
String alphaStr = Integer.toHexString(alpha);
|
||||
String redStr = Integer.toHexString(red);
|
||||
String greenStr = Integer.toHexString(green);
|
||||
String blueStr = Integer.toHexString(blue);
|
||||
return ("#" + alphaStr + redStr + greenStr + blueStr).toUpperCase();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* HEX颜色 转 RGB颜色
|
||||
* HEX颜色 转 ARGB颜色
|
||||
*/
|
||||
public static int[] hexToRgb(String hex) {
|
||||
int[] rgb = new int[3];
|
||||
if (!Pattern.matches("^#[0-9a-f[A-F]]{6}", hex)) {
|
||||
public static int[] hexToArgb(String hex) {
|
||||
int[] rgb = new int[4];
|
||||
if (!Pattern.matches("^#[0-9a-f[A-F]]{8}", hex)) {
|
||||
return rgb;
|
||||
}
|
||||
String redStr = hex.substring(1, 3);
|
||||
String greenStr = hex.substring(3, 5);
|
||||
String blueStr = hex.substring(5);
|
||||
String alphaStr = hex.substring(1, 3);
|
||||
String redStr = hex.substring(3, 5);
|
||||
String greenStr = hex.substring(5, 7);
|
||||
String blueStr = hex.substring(7);
|
||||
|
||||
rgb[0] = Integer.valueOf(redStr, 16);
|
||||
rgb[1] = Integer.valueOf(greenStr, 16);
|
||||
rgb[2] = Integer.valueOf(blueStr, 16);
|
||||
rgb[0] = Integer.valueOf(alphaStr, 16);
|
||||
rgb[1] = Integer.valueOf(redStr, 16);
|
||||
rgb[2] = Integer.valueOf(greenStr, 16);
|
||||
rgb[3] = Integer.valueOf(blueStr, 16);
|
||||
|
||||
return rgb;
|
||||
}
|
||||
|
||||
/**
|
||||
* RGB颜色 转 HEX颜色
|
||||
* 对传入颜色生成梯度透明的颜色集合
|
||||
*
|
||||
* @param startColor 开始颜色
|
||||
* @param startColor 结束颜色
|
||||
* @param step 步长
|
||||
* @return 生成的梯度颜色集合
|
||||
*/
|
||||
public static String rgbToHex(int red, int green, int blue) {
|
||||
if (red < 0 || red > 255 || green < 0 || green > 255 || blue < 0
|
||||
|| blue > 255) {
|
||||
return "";
|
||||
public static List<Integer> gradientAlpha(String startColor, String endColor, int step) {
|
||||
// 将HEX转为RGB
|
||||
int[] sColor = hexToArgb(startColor);
|
||||
int[] eColor = hexToArgb(endColor);
|
||||
|
||||
// 计算每一步的差值
|
||||
int aStep = (eColor[0] - sColor[0]) / step;
|
||||
int rStep = (eColor[1] - sColor[1]) / step;
|
||||
int gStep = (eColor[2] - sColor[2]) / step;
|
||||
int bStep = (eColor[3] - sColor[3]) / step;
|
||||
|
||||
// 生成渐变色
|
||||
List<Integer> gradientColorArr = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < step; i++) {
|
||||
gradientColorArr.add(
|
||||
Color.argb(aStep * i + sColor[0],
|
||||
rStep * i + sColor[1],
|
||||
gStep * i + sColor[2],
|
||||
bStep * i + sColor[3]));
|
||||
}
|
||||
String redStr = Integer.toHexString(red);
|
||||
String greenStr = Integer.toHexString(green);
|
||||
String blueStr = Integer.toHexString(blue);
|
||||
return ("#" + redStr + greenStr + blueStr).toUpperCase();
|
||||
return gradientColorArr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ dependencies {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.7'
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.5.8'
|
||||
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -92,8 +93,9 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
|
||||
@Override
|
||||
public IMogoMapView getMapView( Context context ) {
|
||||
Log.d(TAG,"setDebugMode==true");
|
||||
NavAutoApi.INSTANCE.init( context, MapParams.Companion.init()
|
||||
.setDebugMode( false )
|
||||
.setDebugMode( true )
|
||||
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
|
||||
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
|
||||
.setZoom( 20 )
|
||||
|
||||
@@ -23,7 +23,11 @@ enum AdasRecognizedType {
|
||||
//bus
|
||||
classIdTrafficBus( "traffic_bus", 6 ),
|
||||
//truck
|
||||
classIdTrafficTruck( "traffic_truck", 8 );
|
||||
classIdTrafficTruck( "traffic_truck", 8 ),
|
||||
//stopLine
|
||||
classIdStopLine("warning_stop_line",9),
|
||||
//预警箭头
|
||||
classIdWarningArrows("warning_arrows",10);
|
||||
|
||||
AdasRecognizedType( int code ) {
|
||||
this.code = code;
|
||||
@@ -38,7 +42,7 @@ enum AdasRecognizedType {
|
||||
}
|
||||
|
||||
public static AdasRecognizedType[] VAL = {
|
||||
classIdBackground,
|
||||
classIdBackground,//0
|
||||
classIdPerson,
|
||||
classIdBicycle,
|
||||
classIdCar,
|
||||
@@ -47,6 +51,8 @@ enum AdasRecognizedType {
|
||||
classIdTrafficBus,
|
||||
null,
|
||||
classIdTrafficTruck,
|
||||
classIdStopLine,
|
||||
classIdWarningArrows,
|
||||
};
|
||||
|
||||
public String getRes() {
|
||||
|
||||
@@ -19,7 +19,7 @@ class DataTypes {
|
||||
public static final String TYPE_MARKER_CLOUD_DATA = "TYPE_MARKER_CLOUD_DATA";
|
||||
|
||||
/**
|
||||
* 云端下发警告数据
|
||||
* 云端下发识别目标物警告数据
|
||||
*/
|
||||
public static final String TYPE_MARKER_CLOUD_WARN_DATA = "TYPE_MARKER_CLOUD_WARN_DATA";
|
||||
|
||||
|
||||
@@ -226,6 +226,10 @@ class BaseDrawer {
|
||||
} else if (recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto) {
|
||||
return R.raw.motorbike;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdStopLine) {
|
||||
return R.raw.stopline;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdWarningArrows) {
|
||||
return R.raw.arraw;
|
||||
}
|
||||
return R.raw.people;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.util.Log;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
@@ -21,6 +22,9 @@ import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
|
||||
|
||||
@@ -87,8 +91,8 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(data.getCollisionLat(), data.getCollisionLon());
|
||||
//2D资源图片位置调整
|
||||
MogoLatLng stopLineNew = Trigonometric.getNewLocation(data.getStopLines().get(1), 8, 180);
|
||||
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 8, 180);
|
||||
MogoLatLng stopLineNew = Trigonometric.getNewLocation(data.getStopLines().get(1), 5, 180);
|
||||
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 5, 180);
|
||||
|
||||
IMogoMarker marker = drawMarker(markerShowEntity);
|
||||
Log.d("liyz", "renderWarnData marker != null direction = " + data.getDirection());
|
||||
@@ -115,7 +119,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(getModelRes(2)); //TODO
|
||||
options.icon3DRes(getModelRes(1)); //TODO
|
||||
|
||||
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
@@ -125,18 +129,17 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
return marker;
|
||||
}
|
||||
|
||||
public void drawerMarkerWithLocation(MarkerShowEntity markerShowEntity, MogoLatLng location) {
|
||||
public void drawerArrowsMarkerWithLocation(MogoLatLng location, String markerType, int type, int rotate) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.object(markerShowEntity)
|
||||
.latitude(location.getLat())
|
||||
.longitude(location.getLon());
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(getModelRes(2)); //TODO
|
||||
|
||||
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
.longitude(location.getLon())
|
||||
.set3DMode(true)
|
||||
.controlAngle(true)
|
||||
.icon3DRes(getModelRes(type))
|
||||
.anchorColor("#FB3C3CFF")
|
||||
.flat(true);
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerType, options);
|
||||
marker.setRotateAngle(rotate);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -144,7 +147,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
* */
|
||||
private IMogoMarker drawMarkerWith2Resource(MarkerShowEntity markerShowEntity) {
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(markerShowEntity.getMarkerLocation().getLat(), markerShowEntity.getMarkerLocation().getLon());
|
||||
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 8, 180);
|
||||
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 5, 180);
|
||||
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
|
||||
.latitude(newLocation.getLat())
|
||||
.longitude(newLocation.getLon())
|
||||
@@ -182,15 +185,18 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止线绘制
|
||||
*/
|
||||
public IMogoMarker drawStopLineMarker(MarkerShowEntity markerShowEntity) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.object(markerShowEntity)
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
options.icon3DRes(getModelRes(1)); //TODO
|
||||
options.icon3DRes(getModelRes(9));
|
||||
|
||||
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
|
||||
options.anchorColor("#FB3C3CFF");
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options);
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
|
||||
BIN
modules/mogo-module-common/src/main/res/raw/arraw.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/stopline.n3d
Normal file
@@ -3,6 +3,6 @@
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:endColor="#00F03232"
|
||||
android:startColor="#A5F03232"
|
||||
android:startColor="#3FF03232"
|
||||
android:type="linear"></gradient>
|
||||
</shape>
|
||||
@@ -3,6 +3,6 @@
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:endColor="#00F03232"
|
||||
android:startColor="#A5F03232"
|
||||
android:startColor="#3FF03232"
|
||||
android:type="linear"></gradient>
|
||||
</shape>
|
||||
@@ -3,6 +3,6 @@
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#00F03232"
|
||||
android:startColor="#A5F03232"
|
||||
android:startColor="#3FF03232"
|
||||
android:type="linear"></gradient>
|
||||
</shape>
|
||||
@@ -3,6 +3,6 @@
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#00FF0606"
|
||||
android:startColor="#8CFF0606"
|
||||
android:startColor="#3FFF0606"
|
||||
android:type="linear"></gradient>
|
||||
</shape>
|
||||
@@ -1 +0,0 @@
|
||||
{"systemTime":1615529718585,"satelliteTime":1615529718585,"lon":116.411411222501,"lat":39.9753341630918,"alt":34.4018669128417,"heading":0.342695406938048,"speed":0.003303937,"type":3,"uuid":"2_1"}
|
||||
@@ -1 +0,0 @@
|
||||
{"systemTime":1615529718585,"satelliteTime":1615529718585,"lon":116.411411222501,"lat":39.9753341630918,"alt":34.4018669128417,"heading":0.342695406938048,"speed":0.003303937,"type":3,"uuid":"2_1"}
|
||||
1
modules/mogo-module-service/src/main/assets/adascar0.txt
Normal file
1
modules/mogo-module-service/src/main/assets/adascar1.txt
Normal file
1
modules/mogo-module-service/src/main/assets/adascar2.txt
Normal file
@@ -62,7 +62,7 @@ import java.util.List;
|
||||
* @author congtaowang
|
||||
* @since 2020-04-17
|
||||
* <p>
|
||||
* 描述
|
||||
* 使用控制台发送广播,这里接收intent来处理场景
|
||||
*/
|
||||
public class MockIntentHandler implements IntentHandler {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
TipToast.shortTip( msg );
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
case 4:// 测试左侧按钮1
|
||||
TextView button1 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton( ButtonIndex.BUTTON1 );
|
||||
if ( button1 != null ) {
|
||||
button1.setVisibility( View.VISIBLE );
|
||||
@@ -99,18 +99,18 @@ public class MockIntentHandler implements IntentHandler {
|
||||
} );
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
TextView button2 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton( ButtonIndex.BUTTON1 );
|
||||
case 5:// 测试左侧按钮2
|
||||
TextView button2 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton( ButtonIndex.BUTTON2 );
|
||||
if ( button2 != null ) {
|
||||
button2.setOnClickListener( null );
|
||||
button2.setVisibility( View.GONE );
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
case 6://
|
||||
boolean status1 = intent.getBooleanExtra( "status", false );
|
||||
MarkerServiceHandler.getMogoStatusManager().setUploadingStatus( TAG, status1 );
|
||||
break;
|
||||
case 7:
|
||||
case 7:// 打开微信
|
||||
TextView button11 = MarkerServiceHandler.getApis().getEntranceButtonController().getButton( ButtonIndex.BUTTON1 );
|
||||
if ( button11 != null ) {
|
||||
button11.setVisibility( View.VISIBLE );
|
||||
@@ -130,11 +130,11 @@ public class MockIntentHandler implements IntentHandler {
|
||||
} );
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
case 8:// 测试修改车头角度
|
||||
float bearing = intent.getFloatExtra( "bearing", 0 );
|
||||
MarkerServiceHandler.getMapUIController().changeBearing( bearing );
|
||||
break;
|
||||
case 9:
|
||||
case 9:// 测试弹窗
|
||||
new WMDialog.Builder( context )
|
||||
.setOkButton( "确认", ( dlg, which ) -> {
|
||||
dlg.dismiss();
|
||||
@@ -146,7 +146,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
.build()
|
||||
.show();
|
||||
break;
|
||||
case 10:
|
||||
case 10://测试GEO查询
|
||||
IMogoGeoSearch geoSearch = MarkerServiceHandler.getMapService().getGeoSearch( context );
|
||||
geoSearch.setGeoSearchListener( new IMogoGeoSearchListener() {
|
||||
@Override
|
||||
@@ -165,10 +165,10 @@ public class MockIntentHandler implements IntentHandler {
|
||||
query.setRadius( 1000 );
|
||||
geoSearch.getFromLocationAsyn( query );
|
||||
break;
|
||||
case 11:
|
||||
case 11:// 控制ADAS中的设置页面
|
||||
MarkerServiceHandler.getADASController().setSettingStatus( intent.getBooleanExtra( "status", false ) );
|
||||
break;
|
||||
case 12: {
|
||||
case 12: {// 控制ADAS显示隐藏
|
||||
boolean status2 = intent.getBooleanExtra( "status", false );
|
||||
if ( status2 ) {
|
||||
MarkerServiceHandler.getADASController().showADAS();
|
||||
@@ -177,7 +177,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 13: {
|
||||
case 13: {// 唤起高德地图
|
||||
double lat = intent.getFloatExtra( "lat", 0.0f );
|
||||
double lon = intent.getFloatExtra( "lon", 0.0f );
|
||||
boolean real = intent.getBooleanExtra( "real", false );
|
||||
@@ -225,7 +225,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
} );
|
||||
MarkerServiceHandler.getNavi().naviTo( new MogoLatLng( lat, lon ) );
|
||||
}
|
||||
case 14: {
|
||||
case 14: {//测试点的动画移动,模拟周边车辆移动
|
||||
List< MogoLatLng > mogoLatLngs = new ArrayList<>();
|
||||
mogoLatLngs.add( new MogoLatLng( 39.615986, 116.396716 ) );
|
||||
mogoLatLngs.add( new MogoLatLng( 39.616007, 116.396995 ) );
|
||||
@@ -355,30 +355,30 @@ public class MockIntentHandler implements IntentHandler {
|
||||
// case 16:
|
||||
// MarkerServiceHandler.getGpsSimulatorManager().close();
|
||||
// break;
|
||||
case 17:
|
||||
case 17:// 查询在线车辆数据
|
||||
DebugConfig.setRequestOnlineCarData( intent.getBooleanExtra( "status", true ) );
|
||||
break;
|
||||
case 18:
|
||||
case 18:// 设置是否使用自研地图
|
||||
TipToast.shortTip( "设置完成,下次启动生效" );
|
||||
SharedPrefsMgr.getInstance( context ).putBoolean( "useCustomMap", intent.getBooleanExtra( "useCustomMap", false ) );
|
||||
break;
|
||||
case 30:
|
||||
case 30:// 强制刷新地图
|
||||
MarkerServiceHandler.getMapService().getMapUIController().forceRender();
|
||||
break;
|
||||
case 31:
|
||||
case 31://
|
||||
Intent intent3 = new Intent();
|
||||
intent3.setAction( "AUTONAVI_STANDARD_BROADCAST_RECV" );
|
||||
intent3.putExtra( "KEY_TYPE", 12404 );
|
||||
intent3.putExtra( "EXTRA_REQUEST_AUTO_STATE", 0 );
|
||||
context.sendBroadcast( intent3 );
|
||||
break;
|
||||
case 32:
|
||||
case 32:// 控制实时路况
|
||||
MarkerServiceHandler.getMapService().getMapUIController().setTrafficEnabled( true );
|
||||
break;
|
||||
case 33:
|
||||
case 33:// 测试小智语音
|
||||
AIAssist.getInstance( context ).speakTTSVoice( "庞帆说这个是一个 hard coding." );
|
||||
break;
|
||||
case 34:
|
||||
case 34:// 修改地图模式VR OR 2D
|
||||
int type = intent.getIntExtra( "type", 0 );
|
||||
if ( type != 0 ) {
|
||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeToVRMode();
|
||||
@@ -386,10 +386,10 @@ public class MockIntentHandler implements IntentHandler {
|
||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeTo2dMode();
|
||||
}
|
||||
break;
|
||||
case 35:
|
||||
case 35://测试GPS数据
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().testGpsData();
|
||||
break;
|
||||
case 36:
|
||||
case 36:// 测试打点功能
|
||||
MogoLatLng center = MogoApisHandler.getInstance().getApis()
|
||||
.getMapServiceApi().getMapUIController()
|
||||
.getWindowCenterLocation();
|
||||
@@ -399,16 +399,16 @@ public class MockIntentHandler implements IntentHandler {
|
||||
.position( center )
|
||||
.icon( BitmapFactory.decodeResource( context.getResources(), R.drawable.bg_map_marker_red ) ) );
|
||||
break;
|
||||
case 37:
|
||||
case 37:// 销毁测试打点
|
||||
if ( centerMarker != null ) {
|
||||
centerMarker.destroy();
|
||||
}
|
||||
break;
|
||||
case 38:
|
||||
case 38:// 控制RTK
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
|
||||
.rtkEnable( false );
|
||||
break;
|
||||
case 39:
|
||||
case 39:// 使用自动驾驶车的定位数据
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController()
|
||||
.syncLocation2Map( null );
|
||||
break;
|
||||
@@ -494,12 +494,12 @@ public class MockIntentHandler implements IntentHandler {
|
||||
Logger.d( TAG, "偏差值:%s", delta );
|
||||
}
|
||||
break;
|
||||
case 41:
|
||||
case 41://
|
||||
// adb shell am broadcast -a com.mogo.mock --ei oper 41 --ei type 0 平滑移动
|
||||
// adb shell am broadcast -a com.mogo.mock --ei oper 41 --ei type 1 直接打点
|
||||
DebugConfig.setNotSmooth( intent.getIntExtra( "type", 0 ) == 1 );
|
||||
break;
|
||||
case 42:
|
||||
case 42://
|
||||
WorkThreadHandler.getInstance().post( () -> {
|
||||
try {
|
||||
InputStream is = context.getAssets().open( "coors.json" );
|
||||
@@ -531,13 +531,13 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
} );
|
||||
break;
|
||||
case 43:
|
||||
case 43://
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getAdasControllerApi()
|
||||
.onAutopilotArriveLike( intent.getIntExtra( "type", 8 ) );
|
||||
break;
|
||||
case 44:
|
||||
case 44:// 控制自动驾驶
|
||||
RemoteControlAutoPilotParameters parameters = new RemoteControlAutoPilotParameters();
|
||||
parameters.vehicleType = 9;
|
||||
parameters.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( 40.1690522746, 116.567374558 );
|
||||
@@ -547,21 +547,21 @@ public class MockIntentHandler implements IntentHandler {
|
||||
.getAdasControllerApi()
|
||||
.aiCloudToAdasData( parameters );
|
||||
break;
|
||||
case 45:
|
||||
case 45:// 测试开启鹰眼模式
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getMapServiceApi()
|
||||
.getMapUIController()
|
||||
.openVrMode( false );
|
||||
break;
|
||||
case 46:
|
||||
case 46:// 模拟 自车周边数据
|
||||
String json = "{\"allList\":[{\"type\":3,\"uuid\":\"10009-5152\",\"lat\":40.1990809296,\"lon\":116.7393252195,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0},{\"type\":3,\"uuid\":\"10009-5161\",\"lat\":40.1990827227,\"lon\":116.739325826,\"speed\":0.0,\"heading\":0.0,\"systemTime\":1614329151909,\"vehicleType\":0,\"distance\":576.0,\"fromType\":3,\"isOnline\":0}],\"nearList\":[],\"time\":1614329152238}";
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( GsonUtil.objectFromJson( json, MogoSnapshotSetData.class ) );
|
||||
break;
|
||||
case 47:
|
||||
case 47:// 模拟鹰眼模式下绘制车辆周边的数据
|
||||
mTimeTickHandler.sendEmptyMessageDelayed( 1, 0L );
|
||||
break;
|
||||
case 48:
|
||||
case 48:// 模拟3D模型绘制
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( DataTypes.TYPE_MARKER_ADAS )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
@@ -577,7 +577,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
latLngs.add( new MogoLatLng( 39.981990561932, 116.412893641626 ) );
|
||||
marker.startSmoothInMs( latLngs, 20_000L );
|
||||
break;
|
||||
case 49:
|
||||
case 49:// 绘制marker
|
||||
// 39.96741320378243, 116.41045709250723
|
||||
// 39.98232698552779,116.41879656379113;
|
||||
MogoMarkerOptions options1 = new MogoMarkerOptions()
|
||||
@@ -611,20 +611,23 @@ public class MockIntentHandler implements IntentHandler {
|
||||
.rotate( ( float ) 358.526123 );
|
||||
IMogoMarker marker3 = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( context ).addMarker( DataTypes.TYPE_MARKER_ADAS, options3 );
|
||||
break;
|
||||
case 50:
|
||||
case 50://
|
||||
DebugConfig.setSelfCarSpeedYOffset( intent.getIntExtra( "yOffset", 20 ) );
|
||||
break;
|
||||
case 51:
|
||||
case 51:// 模拟路口车辆移动
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 100, 0L );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 101, 1000L );
|
||||
break;
|
||||
case 52:
|
||||
case 52:// 打开连调工控机、ADAS的控制面板
|
||||
EnvStatusManager.getInstance().showPanel( context );
|
||||
break;
|
||||
case 53:
|
||||
case 53:// 控制 Adas识别 是否可用
|
||||
boolean isUseAdasRecognize = intent.getBooleanExtra( "status", false );
|
||||
DebugConfig.setUseAdasRecognize( isUseAdasRecognize );
|
||||
break;
|
||||
case 54:
|
||||
mTimeTickCarHandler.sendEmptyMessageDelayed( 1, 0L );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -679,6 +682,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Handler mLocationMockHandler = new Handler( WorkThreadHandler.newInstance( "loc-mock-thread" ).getLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
@@ -740,9 +744,28 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
roadSizeBr = null;
|
||||
}
|
||||
} else if (msg.what == 8) {
|
||||
try {
|
||||
handleMockAdasCarIntent();
|
||||
} catch ( Exception e ) {
|
||||
try {
|
||||
if ( readers2 != null ) {
|
||||
for ( BufferedReader reader : readers2 ) {
|
||||
if (reader != null) {
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch ( IOException ex ) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
readers2 = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
private Handler mLocationMockHandler1 = new Handler( WorkThreadHandler.newInstance( "loc-mock-thread1" ).getLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
@@ -780,6 +803,19 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
};
|
||||
|
||||
private Handler mTimeTickCarHandler = new Handler( WorkThreadHandler.newInstance( "loc-time-mock-thread" ).getLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
mLocDelay += 50;
|
||||
if ( mLocDelay > 4_000L ) {
|
||||
mLocationMockHandler1.sendEmptyMessageDelayed( 1, 0L );
|
||||
}
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 8, 0L );
|
||||
mTimeTickCarHandler.sendEmptyMessageDelayed( 0, 50L );
|
||||
}
|
||||
};
|
||||
|
||||
private BufferedReader br;
|
||||
|
||||
private boolean handleMockLocationIntent() throws Exception {
|
||||
@@ -792,6 +828,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
throw new Exception( "end of file." );
|
||||
}
|
||||
JSONObject jo = new JSONObject( line );
|
||||
//改变rtk定位数据,触发自车移动
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( jo );
|
||||
Log.i( "mock-timer-loc-map", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo( jo );
|
||||
@@ -830,6 +867,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
|
||||
private BufferedReader[] readers = null;
|
||||
private BufferedReader[] readers2 = null;
|
||||
|
||||
private boolean handleMockAdasIntent() throws Exception {
|
||||
final long start = System.currentTimeMillis();
|
||||
@@ -858,6 +896,33 @@ public class MockIntentHandler implements IntentHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handleMockAdasCarIntent() throws Exception {
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
if ( readers2 == null ) {
|
||||
readers2 = new BufferedReader[3];
|
||||
for ( int i = 0; i < 3; i++ ) {
|
||||
readers2[i] = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adascar" + i + ".txt" ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
List< ADASRecognizedResult > allList = new ArrayList<>();
|
||||
for ( BufferedReader reader : readers2 ) {
|
||||
String line = reader.readLine();
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult != null ) {
|
||||
allList.add( adasRecognizedResult );
|
||||
}
|
||||
}
|
||||
|
||||
AdasRec adasRec = new AdasRec();
|
||||
adasRec.models = allList;
|
||||
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockAdasRecognized( GsonUtil.jsonFromObject( adasRec ) );
|
||||
Log.i( "mock-timer-adas", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class AdasRec{
|
||||
public String action = "view";
|
||||
public List<ADASRecognizedResult> models;
|
||||
|
||||
@@ -153,6 +153,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback( resultList -> {
|
||||
// 绘制近景识别到的车辆
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
|
||||
//绘制他车的线 lixp TODO
|
||||
|
||||
//添加自车的定位图标 TODO
|
||||
|
||||
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.module.v2x;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -80,12 +81,22 @@ public class V2XWaringManager {
|
||||
/**
|
||||
* 测试数据
|
||||
*/
|
||||
private void testData() {
|
||||
private void testData(String adasResult) {
|
||||
|
||||
try {
|
||||
int id = R.raw.scenario_warning_event_data;
|
||||
switch (adasResult) {
|
||||
case "left":
|
||||
id = R.raw.scenario_warning_event_data_left;
|
||||
break;
|
||||
case "pedestrians":
|
||||
id = R.raw.scenario_warning_event_data_pedestrians;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
InputStream inputStream = V2XUtils.getApp()
|
||||
.getResources()
|
||||
.openRawResource(R.raw.scenario_warning_event_data);
|
||||
.openRawResource(id);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
int len = -1;
|
||||
byte[] buffer = new byte[1024];
|
||||
@@ -111,7 +122,7 @@ public class V2XWaringManager {
|
||||
if (v2XWarnMessageListener != null) {
|
||||
V2XServiceManager
|
||||
.getMoGoSocketManager()
|
||||
.unregisterOnMessageListener(10116, v2XWarnMessageListener);
|
||||
.unregisterOnMessageListener(401018, v2XWarnMessageListener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,8 +134,8 @@ public class V2XWaringManager {
|
||||
V2XServiceManager
|
||||
.getMoGoSocketManager()
|
||||
.registerOnMessageListener(
|
||||
10116,
|
||||
v2XWarnMessageListener );
|
||||
401018,
|
||||
v2XWarnMessageListener);
|
||||
}
|
||||
|
||||
public V2XWarnMessageListener getV2XMessageListener() {
|
||||
@@ -135,11 +146,11 @@ public class V2XWaringManager {
|
||||
/**
|
||||
* 处理adas返回的数据
|
||||
*/
|
||||
public void handleAdasData() {
|
||||
public void handleAdasData(Intent intent) {
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "V2XWaringManager ---- handleAdasData ");
|
||||
|
||||
String adasResult = (String) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
|
||||
//测试数据
|
||||
testData();
|
||||
testData(adasResult);
|
||||
|
||||
// adas 每隔一秒传递的他车或行人数据,避免重复。
|
||||
// V2XServiceManager.getmIMogoADASController().addAdasRecognizedDataCallback(resultList -> {
|
||||
@@ -158,6 +169,7 @@ public class V2XWaringManager {
|
||||
|
||||
/**
|
||||
* 添加2d的碰撞 marker
|
||||
*
|
||||
* @param markerShowEntity
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -69,7 +69,7 @@ public class V2XLocationListener
|
||||
private CarLocationSubject mCarLocationSubject;
|
||||
|
||||
private V2XLocationListener() {
|
||||
mCarLocationSubject = new CarLocationSubject();
|
||||
mCarLocationSubject = CarLocationSubject.getInstance();
|
||||
// 注册最优路线的推荐观察者
|
||||
mCarLocationSubject.registerObserver(
|
||||
V2XOptimalRouteObserver.TYPE,
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
|
||||
/**
|
||||
* desc: 下发的云端预警数据
|
||||
*
|
||||
*/
|
||||
public class V2XWarnMessageListener implements IMogoOnMessageListener<V2XWarningEntity> {
|
||||
|
||||
|
||||
@@ -7,11 +7,12 @@ import android.util.Log;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.V2XWarnDataDrawer;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
@@ -20,7 +21,9 @@ import com.mogo.module.v2x.MoGoV2XServicePaths;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.model.DrawLineInfo;
|
||||
import com.mogo.module.v2x.listener.V2XLocationListener;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager;
|
||||
import com.mogo.module.v2x.scenario.scene.warning.V2XFrontWarningScenario;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
@@ -28,6 +31,8 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
|
||||
import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
|
||||
/**
|
||||
@@ -35,6 +40,7 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
*/
|
||||
@Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER)
|
||||
public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMogoCarLocationChangedListener2 {
|
||||
private static String WARNING_ARROWS = "WARNING_ARROWS";
|
||||
private V2XWarningEntity mCloundWarningInfo;
|
||||
private static String TAG = "MoGoV2XCloundDataManager";
|
||||
private boolean isSelfLineClear;
|
||||
@@ -45,7 +51,15 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon()
|
||||
);
|
||||
|
||||
/*
|
||||
* 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算
|
||||
* */
|
||||
private MogoLatLng middleLocationInStopLine;
|
||||
private V2XFrontWarningScenario mV2XScenario;
|
||||
|
||||
private static long showTime = 0;
|
||||
private float bearing;
|
||||
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
@@ -56,27 +70,37 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
@Override
|
||||
public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) {
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> ");
|
||||
mCloundWarningInfo = cloundWarningInfo;
|
||||
showTime = mCloundWarningInfo.getShowTime();
|
||||
pointsBetween();
|
||||
bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing();
|
||||
|
||||
//顶部弹框
|
||||
if (mV2XScenario == null) {
|
||||
mV2XScenario = new V2XFrontWarningScenario();
|
||||
}
|
||||
mV2XScenario.setWarningEntity(cloundWarningInfo);
|
||||
mV2XScenario.init(null);
|
||||
|
||||
//预警蒙层
|
||||
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getType(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
isSelfLineClear = false;
|
||||
isFirstLocation = false;
|
||||
|
||||
if (cloundWarningInfo.getDirection() == 1) { //前方
|
||||
MogoLatLng startLatLng = getMiddleLocationInStopLine();
|
||||
MogoLatLng warningLocation = Trigonometric.getNewLocation(startLatLng, 80, cloundWarningInfo.getAngle());
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
|
||||
if (cloundWarningInfo.getDirection() == 1) { //前方 TODO
|
||||
middleLocationInStopLine = getMiddleLocationInStopLine();
|
||||
MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, 50, cloundWarningInfo.getAngle());
|
||||
//停止线前方画线
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
//二轮车和行人的渲染和移动
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
|
||||
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
|
||||
//绘制识别物与交汇点连线,并且更新连线数据
|
||||
drawStopLine(cloundWarningInfo, startLatLng, warningLocation);
|
||||
drawRedWarningLineFrontOfStopLine(cloundWarningInfo, middleLocationInStopLine, warningLocation);
|
||||
//添加停止线marker
|
||||
handleStopLine();
|
||||
//自车画线
|
||||
drawSlefCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
}, 500);
|
||||
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
@@ -91,7 +115,12 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
//绘制识别物与交汇点连线,并且更新连线数据
|
||||
drawOtherObjectLine(cloundWarningInfo);
|
||||
//二轮车和行人的渲染和移动
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
|
||||
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
|
||||
|
||||
//车辆静止的时候
|
||||
drawSlefCarLine(carLocation.lon, carLocation.lat, bearing);
|
||||
|
||||
}, 500);
|
||||
|
||||
//延迟3秒清理线
|
||||
@@ -104,32 +133,39 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 停止线绘制
|
||||
* */
|
||||
private void handleStopLine() {
|
||||
if (mCloundWarningInfo != null) {
|
||||
for (int i = 0; i < fillPoints.size(); i++) {
|
||||
V2XWarningEntity entity = new V2XWarningEntity();
|
||||
MogoLatLng latLng = (MogoLatLng) fillPoints.get(i);
|
||||
entity.setLat(latLng.lat);
|
||||
entity.setLon(latLng.lon);
|
||||
entity.setCollisionLat(mCloundWarningInfo.getCollisionLat());
|
||||
entity.setCollisionLon(mCloundWarningInfo.getCollisionLon());
|
||||
entity.heading = mCloundWarningInfo.heading;
|
||||
V2XWarnDataDrawer.getInstance().renderStopLineData(entity);
|
||||
try {
|
||||
if (mCloundWarningInfo != null) {
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_STOP_LINE_DATA);
|
||||
for (int i = 0; i < fillPoints.size(); i++) {
|
||||
V2XWarningEntity entity = new V2XWarningEntity();
|
||||
MogoLatLng latLng = (MogoLatLng) fillPoints.get(i);
|
||||
entity.setLat(latLng.lat);
|
||||
entity.setLon(latLng.lon);
|
||||
entity.setCollisionLat(mCloundWarningInfo.getCollisionLat());
|
||||
entity.setCollisionLon(mCloundWarningInfo.getCollisionLon());
|
||||
entity.heading = mCloundWarningInfo.heading;
|
||||
V2XWarnDataDrawer.getInstance().renderStopLineData(entity);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 场景如:车辆行驶正前方绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置
|
||||
*/
|
||||
private void drawStopLine(V2XWarningEntity info, MogoLatLng startLatLng, MogoLatLng mogoLatLng) {
|
||||
private void drawRedWarningLineFrontOfStopLine(V2XWarningEntity info, MogoLatLng startLatLng, MogoLatLng mogoLatLng) {
|
||||
if (info != null) {
|
||||
IMogoPolyline polyLine = V2XServiceManager.getMoGoStopPolylineManager().getMogoStopPolyline();
|
||||
MogoLatLng endLatlng = new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon);
|
||||
float distance = CoordinateUtils.calculateLineDistance(startLatLng.lon, startLatLng.lat, endLatlng.lon, endLatlng.lat);
|
||||
MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatLng, distance / 2, mCloundWarningInfo.getAngle());
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat +
|
||||
Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat +
|
||||
"中间点坐标:" + addMiddleLoc.lon + "," + addMiddleLoc.lat
|
||||
+ "终点" + endLatlng.lon + "," + endLatlng.lat);
|
||||
if (polyLine != null) {
|
||||
@@ -145,11 +181,12 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
lineInfo.setLocations(locations);
|
||||
lineInfo.setHeading(info.heading);
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "drawStopLine width = " + info.getRoadwidth());
|
||||
lineInfo.setWidth(info.getRoadwidth() * 10 + 5);
|
||||
lineInfo.setWidth(info.getRoadwidth() * 14 + 5);
|
||||
V2XServiceManager.getMoGoStopPolylineManager().drawStopPolyline(getContext(), lineInfo);
|
||||
}
|
||||
} else {
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
||||
V2XServiceManager.getMoGoStopPolylineManager().clearLine();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,10 +197,11 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
private void drawOtherObjectLine(V2XWarningEntity info) {
|
||||
if (info != null) {
|
||||
IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline();
|
||||
MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());
|
||||
MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());
|
||||
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
|
||||
MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());
|
||||
MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());//识别物坐标
|
||||
MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());//预碰撞点坐标
|
||||
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);//识别物到碰撞点之间的距离
|
||||
MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2,
|
||||
Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));//补点
|
||||
if (polyLine != null) {
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "polyLine != null");
|
||||
polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
|
||||
@@ -178,8 +216,10 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
lineInfo.setLocations(locations);
|
||||
lineInfo.setHeading(info.heading);
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "drawOtherObjectLine width = " + info.getRoadwidth());
|
||||
lineInfo.setWidth(info.getRoadwidth() * 10 + 5);
|
||||
lineInfo.setWidth(info.getRoadwidth() * 14 + 5);
|
||||
V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo);
|
||||
//识别物到预碰撞点之间的箭头
|
||||
addArrows(startLatlng, endLatlng);
|
||||
}
|
||||
} else {
|
||||
Log.e(V2XConst.LOG_NAME_WARN, "info == null");
|
||||
@@ -189,17 +229,24 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
|
||||
//侧面目标物与碰撞点之间添加多个小箭头
|
||||
private void addArrows(MogoLatLng startLatLng, MogoLatLng endLatLng) {
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
float distance = CoordinateUtils.calculateLineDistance(
|
||||
startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat);
|
||||
double rotate = Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat);
|
||||
Log.d(TAG, "添加小箭头--目标物与预碰撞点之间的距离是" + String.valueOf(distance));
|
||||
if (distance > 5) {
|
||||
int count = (int) (distance / 5);
|
||||
for (int i = 0; i < count; i++) {
|
||||
MogoLatLng newLo = Trigonometric.getNewLocation(
|
||||
startLatLng, 5 * i, mCloundWarningInfo.getAngle());
|
||||
V2XWarnDataDrawer.getInstance().drawerMarkerWithLocation(markerShowEntity, newLo);
|
||||
startLatLng, 5 * (i + 1), Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat));
|
||||
Log.d(TAG, "小箭头位置" + newLo);
|
||||
V2XWarnDataDrawer.getInstance().drawerArrowsMarkerWithLocation(newLo, WARNING_ARROWS, 10, new Double(rotate).intValue());
|
||||
}
|
||||
}
|
||||
//延迟3秒清理线
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
|
||||
}, showTime);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -207,48 +254,52 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 自车定位 移动完成需要 3s消失,这里何时清理,应该是没有数据的时候
|
||||
*/
|
||||
@Override
|
||||
public void onCarLocationChanged2(Location latLng) {
|
||||
// Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
|
||||
// Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 lat = " + latLng.getLatitude() + "--lon =" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
//当行人经纬度交点 开始画线,否则清理
|
||||
if (mCloundWarningInfo != null) {
|
||||
mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
|
||||
}
|
||||
drawSlefCarLine(latLng);
|
||||
drawSlefCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing());
|
||||
}
|
||||
carLocation = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
|
||||
drawSlefCarLine(latLng);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLatLng latLng) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制安全区域,自车与碰撞点之间的蓝色线
|
||||
* 自车为起点绘制(根据设计,前方行人/弱势交通参与者预警 getDirection() == 1 自车与停止线之间为蓝色预警;其他侧方预警自车与预碰撞点之间显示红色预警)
|
||||
*/
|
||||
private void drawSlefCarLine(Location latLng) {
|
||||
private void drawSlefCarLine(double lon, double lat, float bearing) {
|
||||
if (!isSelfLineClear) {
|
||||
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
|
||||
if (mCloundWarningInfo != null) {
|
||||
MogoLatLng startLatlng = null;
|
||||
MogoLatLng endLatlng = null;
|
||||
MogoLatLng addMiddleLoc = null;
|
||||
|
||||
if (!isFirstLocation) {
|
||||
startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
|
||||
carLocation = getMogoLat(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
|
||||
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? carLocation.lat : mCloundWarningInfo.getCollisionLat(),
|
||||
mCloundWarningInfo.getDirection() == 1 ? carLocation.lon : mCloundWarningInfo.getCollisionLon());
|
||||
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
|
||||
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "drawSlefCarLine lon = " + carLocation.lon + "---lat = " + carLocation.lat);
|
||||
carLocation = getMogoLat(new MogoLatLng(lat, lon));
|
||||
isFirstLocation = true;
|
||||
}
|
||||
|
||||
//自车位置
|
||||
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(),
|
||||
mCloundWarningInfo.getDirection() == 1 ? middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon());
|
||||
startLatlng = new MogoLatLng(lat, lon);
|
||||
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
|
||||
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));
|
||||
Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lat + "," + startLatlng.lon +
|
||||
"中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat);
|
||||
|
||||
if (mogoPolyline != null) {
|
||||
mogoPolyline.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng));
|
||||
mogoPolyline.setTransparency(0.5f);
|
||||
@@ -260,8 +311,8 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
||||
locations.add(addMiddleLoc);
|
||||
locations.add(endLatlng);
|
||||
info.setLocations(locations);
|
||||
info.setHeading(latLng.getBearing());
|
||||
info.setWidth(mCloundWarningInfo.getRoadwidth() * 10 + 5);
|
||||
info.setHeading(bearing);
|
||||
info.setWidth(mCloundWarningInfo.getRoadwidth() * 14 + 5);
|
||||
info.setDirection(mCloundWarningInfo.getDirection());
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,9 @@ public class MoGoV2XPolylineManager implements IMoGoV2XPolylineManager {
|
||||
}
|
||||
if ((V2XServiceManager.getMoGoV2XStatusManager().isRoadEventPOIShow()
|
||||
|| V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpPOIShow())
|
||||
&& V2XServiceManager.getV2XStatusManager().getTargetMoGoLatLng() != null) {
|
||||
&& V2XServiceManager.getV2XStatusManager().getTargetMoGoLatLng() != null
|
||||
&& !V2XServiceManager.getMoGoStatusManager().isVrMode()
|
||||
) {
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
|
||||
|
||||
@@ -56,7 +56,6 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
// 线条粗细,渐变,渐变色值
|
||||
// 当前车辆位置
|
||||
options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors);
|
||||
// options.width(60).useGradient(true).colorValues(colors);
|
||||
List<MogoLatLng> locations = info.getLocations();
|
||||
for (int i = 0; i < locations.size(); i++) {
|
||||
options.add(locations.get(i));
|
||||
|
||||
@@ -12,12 +12,27 @@ import java.util.Set;
|
||||
*/
|
||||
public class CarLocationSubject {
|
||||
|
||||
private static CarLocationSubject mCarLocationSubject;
|
||||
// 车辆位置
|
||||
public MogoLocation carLocation;
|
||||
// 观察者集合
|
||||
private HashMap<String, CarLocationObserver> observers = new HashMap<String, CarLocationObserver>();
|
||||
private HashMap<String, CarLocationObserver> mObservers = new HashMap<>();
|
||||
|
||||
|
||||
private CarLocationSubject() {
|
||||
}
|
||||
|
||||
public static CarLocationSubject getInstance() {
|
||||
if (mCarLocationSubject == null) {
|
||||
synchronized (CarLocationSubject.class) {
|
||||
if (mCarLocationSubject == null) {
|
||||
mCarLocationSubject = new CarLocationSubject();
|
||||
}
|
||||
}
|
||||
}
|
||||
return mCarLocationSubject;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置新的车辆位置
|
||||
*
|
||||
@@ -35,7 +50,7 @@ public class CarLocationSubject {
|
||||
* @param observer 新的观察者
|
||||
*/
|
||||
public void registerObserver(String observerType, CarLocationObserver observer) {
|
||||
observers.put(observerType, observer);
|
||||
mObservers.put(observerType, observer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,16 +59,16 @@ public class CarLocationSubject {
|
||||
* @param observerType 观察者类型
|
||||
*/
|
||||
public void removeObserver(String observerType) {
|
||||
observers.remove(observerType);
|
||||
mObservers.remove(observerType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知所有观察者更新
|
||||
*/
|
||||
private void notifyAllObservers() {
|
||||
Set<String> keySet = observers.keySet();
|
||||
Set<String> keySet = mObservers.keySet();
|
||||
for (String s : keySet) {
|
||||
CarLocationObserver observer = observers.get(s);
|
||||
CarLocationObserver observer = mObservers.get(s);
|
||||
if (observer != null) {
|
||||
observer.update(carLocation);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.utils.LocationUtils;
|
||||
import com.mogo.utils.ColorUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -22,16 +23,15 @@ public class V2XOptimalRouteOverlay {
|
||||
private MogoPolylineOptions mPolylineOptions;
|
||||
// 线路径集合
|
||||
private List<MogoLatLng> mPolylinePointList;
|
||||
// 渐变色
|
||||
private List<Integer> mPolylineColors;
|
||||
|
||||
public V2XOptimalRouteOverlay() {
|
||||
mPolylineOptions = new MogoPolylineOptions();
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
colors.add(0xFFF95959);
|
||||
// 线条粗细,渐变,渐变色值
|
||||
mPolylineOptions.width(25).useGradient(true).colorValues(colors);
|
||||
// 绘制路径集合
|
||||
mPolylinePointList = new ArrayList<>();
|
||||
// 引导线颜色
|
||||
mPolylineColors = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,8 +43,10 @@ public class V2XOptimalRouteOverlay {
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mPolylinePointList.clear();
|
||||
mPolylineColors.clear();
|
||||
}
|
||||
if (polylinePoint != null) {
|
||||
|
||||
// 将当前车辆位置放进去
|
||||
mPolylinePointList.add(new MogoLatLng(carLocal.getLatitude(), carLocal.getLongitude()));
|
||||
// 过滤后台推送的推荐路线集合
|
||||
@@ -54,8 +56,13 @@ public class V2XOptimalRouteOverlay {
|
||||
mPolylinePointList.add(polyline);
|
||||
}
|
||||
}
|
||||
|
||||
mPolylineColors.addAll(ColorUtils.gradientAlpha("#002965ED", "#FF2965ED", mPolylinePointList.size() / 3));
|
||||
|
||||
// 替换路径集合
|
||||
mPolylineOptions.points(mPolylinePointList);
|
||||
// 线条粗细,渐变,渐变色值
|
||||
mPolylineOptions.width(25).useGradient(true).colorValues(mPolylineColors);
|
||||
// 绘制线
|
||||
mMoGoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(mPolylineOptions);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class AdasDataBroadcastReceiver extends BroadcastReceiver {
|
||||
// Logger.d(V2XConst.LOG_NAME_WARN, "AdasDataBroadcastReceiver -->" + GsonUtil.jsonFromObject(adasResult));
|
||||
String adasResult = (String) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
|
||||
Log.d(V2XConst.LOG_NAME_WARN, "AdasDataBroadcastReceiver -----> ");
|
||||
V2XWaringManager.getInstance().handleAdasData();
|
||||
V2XWaringManager.getInstance().handleAdasData(intent);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -40,6 +40,9 @@ public class V2XFatigueDrivingScenario extends AbsV2XScenario<V2XPushMessageEnti
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
|
||||
if (V2XServiceManager.getMoGoStatusManager().isVrMode()) {
|
||||
return;
|
||||
}
|
||||
if (!isSameScenario(v2XMessageEntity)) {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
if (v2XMessageEntity != null) {
|
||||
|
||||
@@ -362,17 +362,21 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
});
|
||||
|
||||
/*
|
||||
*障碍物绕行
|
||||
*车路云场景预警-左侧
|
||||
* */
|
||||
btnTriggerObstacleDetour.setOnClickListener(v -> {
|
||||
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_ADAS_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY, "left");
|
||||
getContext().sendBroadcast(intent);
|
||||
});
|
||||
|
||||
/*
|
||||
*行人预警,行人路线预测
|
||||
*行人预警,行人路线预测 车路云预警-前方行人
|
||||
* */
|
||||
btnTriggerPedestrianWarning.setOnClickListener(v -> {
|
||||
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_ADAS_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY, "pedestrians");
|
||||
getContext().sendBroadcast(intent);
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
@@ -48,24 +48,35 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
|
||||
public V2XFrontWarningScenario() {
|
||||
setV2XWindow(new V2XWarningWindow());
|
||||
setV2XMarker(new V2XWarningMarker());
|
||||
// setV2XMarker(new V2XWarningMarker());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity v2XMessageEntity) {
|
||||
try {
|
||||
if (v2XMessageEntity != null && V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) {
|
||||
mMarkerEntity = (V2XWarningEntity) v2XMessageEntity.getContent();
|
||||
if (v2XMessageEntity != null) {
|
||||
if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) {
|
||||
mMarkerEntity = (V2XWarningEntity) v2XMessageEntity.getContent();
|
||||
direction = mMarkerEntity.getDirection();
|
||||
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(direction, MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
show();
|
||||
drawPOI();
|
||||
}
|
||||
} else {
|
||||
direction = mMarkerEntity.getDirection();
|
||||
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(direction, MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
show();
|
||||
drawPOI();
|
||||
// drawPOI();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void setWarningEntity(V2XWarningEntity markerEntity) {
|
||||
mMarkerEntity = markerEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
showWindow();
|
||||
@@ -84,7 +95,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
.getMogoTopViewManager()
|
||||
.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
getV2XWindow().show(mMarkerEntity);
|
||||
getV2XMarker().drawPOI(mMarkerEntity);
|
||||
// getV2XMarker().drawPOI(mMarkerEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,8 +116,10 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
getV2XMarker().drawPOI(mMarkerEntity);
|
||||
Log.d(TAG, "drawPOI");
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().drawPOI(mMarkerEntity);
|
||||
Log.d(TAG, "drawPOI");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -237,6 +237,7 @@
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_22"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTriggerWarningEvent"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -426,7 +427,21 @@
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#00BCD4"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="障碍物绕行"
|
||||
android:text="车路云场景预警-左侧"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAdasDataWarn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#8BC34A"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="车路云场景预警-右侧"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -440,7 +455,7 @@
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#009688"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="行人预警,行人路线预测"
|
||||
android:text="车路云场景预警-前方行人"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -473,21 +488,6 @@
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAdasDataWarn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#8BC34A"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="adas预警数据发送"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</com.google.android.flexbox.FlexboxLayout>
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"type": 10013,
|
||||
"lat": 39.977148,
|
||||
"lon": 116.417478,
|
||||
"lon": 116.417886,
|
||||
"distance": 2,
|
||||
"collisionLat": 39.977094,
|
||||
"collisionLon": 116.417634,
|
||||
@@ -11,13 +11,13 @@
|
||||
"lon": 116.417651
|
||||
},
|
||||
{
|
||||
"lat": 39.976874,
|
||||
"lon": 116.417757
|
||||
"lat": 39.976858,
|
||||
"lon": 116.417683
|
||||
}
|
||||
],
|
||||
"from": 1,
|
||||
"angle": 0,
|
||||
"direction": 1,
|
||||
"direction": 3,
|
||||
"speed": 11.108121,
|
||||
"targetColor": "#FF4040",
|
||||
"stopLineDistance": 60,
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"type": 10013,
|
||||
"lat": 39.977148,
|
||||
"lon": 116.417478,
|
||||
"distance": 2,
|
||||
"collisionLat": 39.977094,
|
||||
"collisionLon": 116.417634,
|
||||
"stopLines": [
|
||||
{
|
||||
"lat": 39.976858,
|
||||
"lon": 116.417651
|
||||
},
|
||||
{
|
||||
"lat": 39.976874,
|
||||
"lon": 116.417757
|
||||
}
|
||||
],
|
||||
"from": 1,
|
||||
"angle": 0,
|
||||
"direction": 3,
|
||||
"speed": 11.108121,
|
||||
"targetColor": "#FF4040",
|
||||
"stopLineDistance": 60,
|
||||
"warningContent": "小心行人",
|
||||
"heading": 0,
|
||||
"showTime": 8000,
|
||||
"roadwidth": 4.0,
|
||||
"carLocation": {
|
||||
"lat": 39.97665425,
|
||||
"lon": 116.41769983
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"type": 10013,
|
||||
"lat": 39.977148,
|
||||
"lon": 116.417886,
|
||||
"distance": 2,
|
||||
"collisionLat": 39.977094,
|
||||
"collisionLon": 116.417634,
|
||||
"stopLines": [
|
||||
{
|
||||
"lat": 39.976858,
|
||||
"lon": 116.417651
|
||||
},
|
||||
{
|
||||
"lat": 39.976858,
|
||||
"lon": 116.417683
|
||||
}
|
||||
],
|
||||
"from": 1,
|
||||
"angle": 0,
|
||||
"direction": 1,
|
||||
"speed": 11.108121,
|
||||
"targetColor": "#FF4040",
|
||||
"stopLineDistance": 60,
|
||||
"warningContent": "小心行人",
|
||||
"heading": 0,
|
||||
"showTime": 8000,
|
||||
"roadwidth": 4.0,
|
||||
"carLocation": {
|
||||
"lat": 39.97665425,
|
||||
"lon": 116.41769983
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public
|
||||
* @author congtaowang
|
||||
* @since 2020/8/12
|
||||
*
|
||||
* 描述
|
||||
* 高德地图启动的时候才会用到这个模块
|
||||
*/
|
||||
@Route( path = MogoWidgetsProvider.PATH )
|
||||
class MogoWidgetsProvider implements IMogoModuleProvider {
|
||||
|
||||
@@ -330,6 +330,7 @@ public class MogoADASController implements IMogoADASController {
|
||||
Logger.w( TAG, "--->action is null" );
|
||||
return;
|
||||
}
|
||||
//识别的他车移动操作
|
||||
mAdasMessageFactory.createMessage( action ).handlerMsg( GsonUtil.getGson(), mOnAdasListener, detectResult );
|
||||
} catch ( JSONException e ) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -2,7 +2,6 @@ include ':foudations:mogo-aicloud-services-sdk'
|
||||
include ':foudations:mogo-aicloud-services-apk'
|
||||
include ':foudations:httpdns-mogo'
|
||||
include ':modules:mogo-module-smp'
|
||||
include ':app2'
|
||||
include ':foudations:httpdns-base'
|
||||
include ':foudations:httpdns-tencent'
|
||||
include ':foudations:httpdns-noop'
|
||||
|
||||