Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk
This commit is contained in:
@@ -215,7 +215,11 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
marker.setRotateAngle( ( ( float ) recognizedListResult.heading ) );
|
||||
marker.setPosition( recognizedListResult.lat, recognizedListResult.lon );
|
||||
}
|
||||
marker.setAnchorColor( getModelRenderColor( recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading ) );
|
||||
String carColor = recognizedListResult.color;
|
||||
if ( TextUtils.isEmpty( carColor ) ) {
|
||||
carColor = getModelRenderColor( recognizedListResult.type, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading );
|
||||
}
|
||||
marker.setAnchorColor( carColor );
|
||||
|
||||
if ( shouldShowSpeed( recognizedListResult.type ) ) {
|
||||
Message msg = mRenderThreadHandler.obtainMessage();
|
||||
@@ -243,12 +247,17 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
String resIdVal = null;
|
||||
int resId = getModelRes( recognizedListResult.type );
|
||||
resIdVal = resId + "";
|
||||
|
||||
String carColor = recognizedListResult.color;
|
||||
if ( TextUtils.isEmpty( carColor ) ) {
|
||||
carColor = getModelRenderColor( recognizedListResult.type, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading );
|
||||
}
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( DataTypes.TYPE_MARKER_ADAS )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.set3DMode( true )
|
||||
.gps( true )
|
||||
.anchorColor( getModelRenderColor( recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading ) )
|
||||
.anchorColor( carColor )
|
||||
.controlAngle( true )
|
||||
.resName( mMarkerCachesResMd5Values.get( resIdVal ) )
|
||||
.icon3DRes( resId )
|
||||
|
||||
@@ -10,24 +10,17 @@ import android.util.Log;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
@@ -226,15 +219,16 @@ class BaseDrawer {
|
||||
/**
|
||||
* 获取3D锚点模型资源
|
||||
*
|
||||
* @param type
|
||||
* @param type {@link AdasRecognizedType}
|
||||
* @return
|
||||
*/
|
||||
public int getModelRes( int type ) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type );
|
||||
if ( recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficBus
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck ) {
|
||||
return R.raw.othercar2;
|
||||
return R.raw.othercar;
|
||||
} else if ( recognizedType == AdasRecognizedType.classIdTrafficBus ) {
|
||||
return R.raw.bus;
|
||||
} else if ( recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto ) {
|
||||
return R.raw.motorbike;
|
||||
@@ -250,29 +244,33 @@ class BaseDrawer {
|
||||
* @param lat 纬度
|
||||
* @return 实际车辆颜色
|
||||
*/
|
||||
protected String getModelRenderColor( double speed, double lon, double lat, double angle ) {
|
||||
protected String getModelRenderColor( int type, double speed, double lon, double lat, double angle ) {
|
||||
|
||||
// 距离策略
|
||||
double coordinates[] = getCurCoordinates();
|
||||
double distance = CoordinateUtils.calculateLineDistance( lon, lat, coordinates[0], coordinates[1] ) * 100;
|
||||
if ( distance < 50 ) {
|
||||
return Car3DModelColor.Dangerous.color;
|
||||
} else if ( distance < 100 && distance >= 50 ) {
|
||||
return Car3DModelColor.Warming.color;
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type );
|
||||
if ( recognizedType == AdasRecognizedType.classIdTrafficBus ) {
|
||||
return "#D8D8D8FF";
|
||||
}
|
||||
// 距离策略
|
||||
// double coordinates[] = getCurCoordinates();
|
||||
// double distance = CoordinateUtils.calculateLineDistance( lon, lat, coordinates[0], coordinates[1] ) * 100;
|
||||
// if ( distance < 50 ) {
|
||||
// return Car3DModelColor.Dangerous.color;
|
||||
// } else if ( distance < 100 && distance >= 50 ) {
|
||||
// return Car3DModelColor.Warming.color;
|
||||
// }
|
||||
|
||||
// 他车车速和自车车速对比速度策略
|
||||
// 自车速度 >= 50% 危险
|
||||
// 10% < 自车速度 < 50% 警告
|
||||
double curSpeed = getCurSpeed();
|
||||
if ( curSpeed > 0 && speed > curSpeed ) {
|
||||
double rate = ( ( speed - curSpeed ) / curSpeed ) * 100;
|
||||
if ( rate >= 50 ) {
|
||||
return Car3DModelColor.Dangerous.color;
|
||||
} else if ( rate > 10 && rate < 50 ) {
|
||||
return Car3DModelColor.Warming.color;
|
||||
}
|
||||
}
|
||||
// double curSpeed = getCurSpeed();
|
||||
// if ( curSpeed > 0 && speed > curSpeed ) {
|
||||
// double rate = ( ( speed - curSpeed ) / curSpeed ) * 100;
|
||||
// if ( rate >= 50 ) {
|
||||
// return Car3DModelColor.Dangerous.color;
|
||||
// } else if ( rate > 10 && rate < 50 ) {
|
||||
// return Car3DModelColor.Warming.color;
|
||||
// }
|
||||
// }
|
||||
|
||||
// 默认颜色
|
||||
return Car3DModelColor.Normal.color;
|
||||
|
||||
@@ -290,7 +290,8 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
marker.setPosition( cloudRoadData.getWgslat(), cloudRoadData.getWgslon() );
|
||||
}
|
||||
|
||||
marker.setAnchorColor( getModelRenderColor( cloudRoadData.getSpeed(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading() ) );
|
||||
// TODO: 2021/3/23 后端算法提供显示颜色
|
||||
marker.setAnchorColor( getModelRenderColor( cloudRoadData.getType(), cloudRoadData.getSpeed(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading() ) );
|
||||
|
||||
if ( shouldShowSpeed( cloudRoadData.getType() ) ) {
|
||||
Message msg = mRenderThreadHandler.obtainMessage();
|
||||
@@ -370,7 +371,8 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
String resIdVal = null;
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
options.set3DMode( true );
|
||||
options.anchorColor( getModelRenderColor( data.getSpeed(), data.getWgslon(), data.getWgslat(), data.getHeading() ) );
|
||||
// TODO: 2021/3/23 后端算法提供显示颜色
|
||||
options.anchorColor( getModelRenderColor( data.getType(), data.getSpeed(), data.getWgslon(), data.getWgslat(), data.getHeading() ) );
|
||||
int resId = getModelRes( data.getType() );
|
||||
resIdVal = resId + "";
|
||||
options.resName( mMarkerCachesResMd5Values.get( resIdVal ) );
|
||||
|
||||
BIN
modules/mogo-module-common/src/main/res/raw/bus.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/bus.n3d
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
150
modules/mogo-module-service/src/main/assets/LocParse.java
Normal file
150
modules/mogo-module-service/src/main/assets/LocParse.java
Normal file
@@ -0,0 +1,150 @@
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/26
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class LocParse {
|
||||
|
||||
public static void main( String[] args ) {
|
||||
new Thread( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
LocParse.run();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} ).run();
|
||||
|
||||
}
|
||||
|
||||
private static void run() throws Exception {
|
||||
InputStreamReader isr = new InputStreamReader( new FileInputStream( "loc.csv" ) );
|
||||
BufferedReader br = new BufferedReader( isr );
|
||||
File loc = new File( "loc.txt" );
|
||||
if ( loc.exists() ) {
|
||||
loc.delete();
|
||||
}
|
||||
loc.createNewFile();
|
||||
OutputStreamWriter locOsw = new OutputStreamWriter( new FileOutputStream( loc ) );
|
||||
BufferedWriter locWr = new BufferedWriter( locOsw );
|
||||
|
||||
final int adasRecAmount = 10;
|
||||
final int intervalLineAmount = 50;
|
||||
|
||||
BufferedWriter writers[] = new BufferedWriter[adasRecAmount];
|
||||
|
||||
for ( int i = 0; i < adasRecAmount; i++ ) {
|
||||
File file = new File( "adas" + i + ".txt" );
|
||||
if ( file.exists() ) {
|
||||
file.delete();
|
||||
}
|
||||
file.createNewFile();
|
||||
OutputStreamWriter osw = new OutputStreamWriter( new FileOutputStream( file ) );
|
||||
writers[i] = new BufferedWriter( osw );
|
||||
}
|
||||
|
||||
String line = null;
|
||||
final int pLon = 1;
|
||||
final int pLat = 2;
|
||||
final int pAlt = 3;
|
||||
final int pHeading = 4;
|
||||
final int pSpeed = 6;
|
||||
final int pDistance = 7;
|
||||
final int pReceiverDataTime = 8;
|
||||
final int pAdasSatelliteTime = 9;
|
||||
final int pSystemTime = 10;
|
||||
final int pSatelliteTime = 11;
|
||||
|
||||
int counter = 0;
|
||||
while ( ( line = br.readLine() ) != null ) {
|
||||
line = line.replace( " ", "" );
|
||||
String seg[] = line.split( "," );
|
||||
|
||||
double lon = Double.parseDouble( seg[pLon] );
|
||||
double lat = Double.parseDouble( seg[pLat] );
|
||||
double alt = Double.parseDouble( seg[pAlt] );
|
||||
double heading = Double.parseDouble( seg[pHeading] );
|
||||
double speed = Double.parseDouble( seg[pSpeed] );
|
||||
double distance = Double.parseDouble( seg[pDistance] );
|
||||
long receiverDataTime = Long.parseLong( seg[pReceiverDataTime] );
|
||||
long adasSatelliteTime = Long.parseLong( seg[pAdasSatelliteTime] );
|
||||
long systemTime = Long.parseLong( seg[pSystemTime] );
|
||||
long satelliteTime = Long.parseLong( seg[pSatelliteTime] );
|
||||
|
||||
// 定位
|
||||
StringBuilder locJson = new StringBuilder( "{" );
|
||||
locJson.append( "\"lon\":" + lon );
|
||||
locJson.append( ",\"lat\":" + lat );
|
||||
locJson.append( ",\"alt\":" + alt );
|
||||
locJson.append( ",\"heading\":" + heading );
|
||||
locJson.append( ",\"speed\":" + speed );
|
||||
locJson.append( ",\"systemTime\":" + systemTime );
|
||||
locJson.append( ",\"receiverDataTime\":" + receiverDataTime );
|
||||
locJson.append( ",\"adasSatelliteTime\":" + adasSatelliteTime );
|
||||
locJson.append( ",\"satelliteTime\":" + satelliteTime );
|
||||
locJson.append( "}\n" );
|
||||
locWr.write( locJson.toString() );
|
||||
|
||||
int writersCount = counter++ / intervalLineAmount;
|
||||
if ( writersCount > adasRecAmount ) {
|
||||
writersCount = adasRecAmount;
|
||||
}
|
||||
for ( int i = 0; i < writersCount; i++ ) {
|
||||
|
||||
int type = 3;
|
||||
switch ( i ) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
type = i;
|
||||
break;
|
||||
case 0:
|
||||
case 5:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
type = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
StringBuilder adasJson = new StringBuilder( "{" );
|
||||
adasJson.append( "\"type\":" + type );
|
||||
adasJson.append( ",\"uuid\":" + "\"2_" + i + "\"" );
|
||||
adasJson.append( ",\"lon\":" + lon );
|
||||
adasJson.append( ",\"lat\":" + lat );
|
||||
adasJson.append( ",\"alt\":" + alt );
|
||||
adasJson.append( ",\"heading\":" + heading );
|
||||
adasJson.append( ",\"distance\":" + distance );
|
||||
adasJson.append( ",\"speed\":" + speed );
|
||||
adasJson.append( ",\"systemTime\":" + systemTime );
|
||||
adasJson.append( ",\"satelliteTime\":" + satelliteTime );
|
||||
adasJson.append( ",\"dataAccuracy\":" + 1 );
|
||||
adasJson.append( "}\n" );
|
||||
writers[i].write( adasJson.toString() );
|
||||
}
|
||||
// adas
|
||||
}
|
||||
|
||||
locWr.flush();
|
||||
locWr.close();
|
||||
|
||||
for ( BufferedWriter writer : writers ) {
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
15415
modules/mogo-module-service/src/main/assets/loc.csv
Normal file
15415
modules/mogo-module-service/src/main/assets/loc.csv
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -558,14 +558,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( GsonUtil.objectFromJson( json, MogoSnapshotSetData.class ) );
|
||||
break;
|
||||
case 47:
|
||||
// mLocationMockHandler1.sendEmptyMessageDelayed( 1, 4000L );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 2, 0 );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 21, 200 );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 3, 0L );
|
||||
|
||||
mTimeTickHandler.sendEmptyMessageDelayed( 1, 0L );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 31, 2000L );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 5, 0L );
|
||||
break;
|
||||
case 48:
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
@@ -629,7 +622,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
break;
|
||||
case 53:
|
||||
boolean isUseAdasRecognize = intent.getBooleanExtra( "status", false );
|
||||
DebugConfig.setUseAdasRecognize(isUseAdasRecognize);
|
||||
DebugConfig.setUseAdasRecognize( isUseAdasRecognize );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -703,17 +696,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
br = null;
|
||||
}
|
||||
} else if ( msg.what == 2 ) {
|
||||
try {
|
||||
handleMockSnapshotIntent();
|
||||
} catch ( Exception e ) {
|
||||
try {
|
||||
br2.close();
|
||||
} catch ( IOException ex ) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
br2 = null;
|
||||
}
|
||||
} else if ( msg.what == 21 ) {
|
||||
try {
|
||||
handleMockSnapshotIntent2();
|
||||
@@ -730,51 +712,15 @@ public class MockIntentHandler implements IntentHandler {
|
||||
handleMockAdasIntent();
|
||||
} catch ( Exception e ) {
|
||||
try {
|
||||
br3.close();
|
||||
br31.close();
|
||||
br32.close();
|
||||
br33.close();
|
||||
br34.close();
|
||||
br35.close();
|
||||
br36.close();
|
||||
br37.close();
|
||||
br38.close();
|
||||
br39.close();
|
||||
if ( readers != null ) {
|
||||
for ( BufferedReader reader : readers ) {
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
} catch ( IOException ex ) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
br3 = null;
|
||||
br31 = null;
|
||||
br32 = null;
|
||||
br33 = null;
|
||||
br34 = null;
|
||||
br35 = null;
|
||||
br36 = null;
|
||||
br37 = null;
|
||||
br38 = null;
|
||||
br39 = null;
|
||||
}
|
||||
} else if ( msg.what == 31 ) {
|
||||
try {
|
||||
handleMockAdasIntent3();
|
||||
} catch ( Exception e ) {
|
||||
try {
|
||||
br31.close();
|
||||
} catch ( IOException ex ) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
br31 = null;
|
||||
}
|
||||
} else if ( msg.what == 48 ) {
|
||||
try {
|
||||
handleMockLocationIntent48();
|
||||
} catch ( Exception e ) {
|
||||
try {
|
||||
br48.close();
|
||||
} catch ( IOException ex ) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
br48 = null;
|
||||
readers = null;
|
||||
}
|
||||
} else if ( msg.what == 100 ) {
|
||||
try {
|
||||
@@ -837,7 +783,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
|
||||
private boolean handleMockLocationIntent() throws Exception {
|
||||
if ( br == null ) {
|
||||
br = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "loc5.txt" ) ) );
|
||||
br = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "loc.txt" ) ) );
|
||||
}
|
||||
final long start = System.currentTimeMillis();
|
||||
String line = br.readLine();
|
||||
@@ -845,8 +791,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
throw new Exception( "end of file." );
|
||||
}
|
||||
JSONObject jo = new JSONObject( line );
|
||||
jo.put( "satelliteTime", System.currentTimeMillis() );
|
||||
jo.put( "systemTime", System.currentTimeMillis() );
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( jo );
|
||||
Log.i( "mock-timer-loc-map", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo( jo );
|
||||
@@ -854,59 +798,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
private BufferedReader br48;
|
||||
int count = 0;
|
||||
|
||||
private boolean handleMockLocationIntent48() throws Exception {
|
||||
if ( br48 == null ) {
|
||||
br48 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "loc3.txt" ) ) );
|
||||
}
|
||||
final long start = System.currentTimeMillis();
|
||||
String line = br48.readLine();
|
||||
if ( line == null ) {
|
||||
throw new Exception( "end of file." );
|
||||
}
|
||||
JSONObject jo = new JSONObject( line );
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( jo );
|
||||
Logger.i( "mock-timer-loc", "cost " + ( System.currentTimeMillis() - start ) + "ms: count=%s", ++count );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 48, 100L );
|
||||
return true;
|
||||
}
|
||||
|
||||
private BufferedReader br2;
|
||||
|
||||
private long last = 0;
|
||||
|
||||
private boolean handleMockSnapshotIntent() throws Exception {
|
||||
if ( br2 == null ) {
|
||||
br2 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas6.txt" ) ) );
|
||||
}
|
||||
String line = br2.readLine();
|
||||
if ( line == null ) {
|
||||
throw new Exception( "end of file 2." );
|
||||
}
|
||||
MogoSnapshotSetData data = new MogoSnapshotSetData();
|
||||
List< CloudRoadData > allList = new ArrayList<>();
|
||||
CloudRoadData cloudRoadData = GsonUtil.objectFromJson( line, CloudRoadData.class );
|
||||
if ( cloudRoadData == null ) {
|
||||
return false;
|
||||
}
|
||||
cloudRoadData.setWgslat( cloudRoadData.getLat() );
|
||||
cloudRoadData.setWgslon( cloudRoadData.getLon() );
|
||||
allList.add( cloudRoadData );
|
||||
data.setAllList( allList );
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( data );
|
||||
Log.i( "mock-timer-snapshot", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
long delay = 100;
|
||||
if ( last != 0 ) {
|
||||
delay = cloudRoadData.getSystemTime() - last;
|
||||
}
|
||||
last = cloudRoadData.getSystemTime();
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 2, 50L );
|
||||
return true;
|
||||
}
|
||||
|
||||
private BufferedReader br4;
|
||||
|
||||
@@ -937,278 +828,29 @@ public class MockIntentHandler implements IntentHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
private BufferedReader br3;
|
||||
private BufferedReader br31;
|
||||
private BufferedReader[] readers = null;
|
||||
|
||||
private boolean handleMockAdasIntent() throws Exception {
|
||||
final long start = System.currentTimeMillis();
|
||||
if ( br3 == null ) {
|
||||
br3 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas2.txt" ) ) );
|
||||
}
|
||||
if ( br31 == null ) {
|
||||
br31 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas3.txt" ) ) );
|
||||
}
|
||||
if ( br32 == null ) {
|
||||
br32 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas4.txt" ) ) );
|
||||
}
|
||||
if ( br33 == null ) {
|
||||
br33 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas5.txt" ) ) );
|
||||
}
|
||||
if ( br34 == null ) {
|
||||
br34 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas6.txt" ) ) );
|
||||
|
||||
if ( readers == null ) {
|
||||
readers = new BufferedReader[10];
|
||||
for ( int i = 0; i < 10; i++ ) {
|
||||
readers[i] = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas" + i + ".txt" ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( br35 == null ) {
|
||||
br35 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas3-2.txt" ) ) );
|
||||
}
|
||||
if ( br36 == null ) {
|
||||
br36 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas4-2.txt" ) ) );
|
||||
}
|
||||
if ( br37 == null ) {
|
||||
br37 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas4-4.txt" ) ) );
|
||||
}
|
||||
if ( br38 == null ) {
|
||||
br38 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas5-2.txt" ) ) );
|
||||
}
|
||||
if ( br39 == null ) {
|
||||
br39 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas5-4.txt" ) ) );
|
||||
}
|
||||
String line = br3.readLine();
|
||||
if ( line == null ) {
|
||||
throw new Exception( "end of file 3." );
|
||||
}
|
||||
List< ADASRecognizedResult > allList = new ArrayList<>();
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return false;
|
||||
}
|
||||
allList.add( adasRecognizedResult );
|
||||
ADASRecognizedResult next = handleMockAdasIntent3();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent4();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent5();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent6();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
|
||||
next = handleMockAdasIntent7();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent8();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent9();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent10();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent11();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
for ( BufferedReader reader : readers ) {
|
||||
String line = reader.readLine();
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult != null ) {
|
||||
allList.add( adasRecognizedResult );
|
||||
}
|
||||
}
|
||||
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( allList );
|
||||
Log.i( "mock-timer-adas", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
long delay = 100;
|
||||
if ( last != 0 ) {
|
||||
delay = adasRecognizedResult.satelliteTime - last;
|
||||
}
|
||||
last = adasRecognizedResult.satelliteTime;
|
||||
|
||||
Log.d( "send-delay", "delay: " + delay );
|
||||
return true;
|
||||
}
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent3() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br31.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_2";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br32;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent4() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br32.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_3";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br33;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent5() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br33.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_4";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br34;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent6() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br34.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_5";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br35;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent7() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br35.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_6";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br36;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent8() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br36.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_7";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br37;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent9() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br37.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_8";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br38;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent10() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br38.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_9";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br39;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent11() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br39.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_10";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user