优化显示逻辑
This commit is contained in:
@@ -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