新增snapshot多线程执行
This commit is contained in:
@@ -556,8 +556,9 @@ public class MockIntentHandler implements IntentHandler {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( GsonUtil.objectFromJson( json, MogoSnapshotSetData.class ) );
|
||||
break;
|
||||
case 47:
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 1, 200L );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 1, 400L );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 2, 0 );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 21, 200 );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 3, 300L );
|
||||
break;
|
||||
}
|
||||
@@ -612,6 +613,17 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
br2 = null;
|
||||
}
|
||||
} else if( msg.what == 21 ) {
|
||||
try {
|
||||
handleMockSnapshotIntent2();
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
br4.close();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -693,6 +705,36 @@ public class MockIntentHandler implements IntentHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
private BufferedReader br4;
|
||||
|
||||
private boolean handleMockSnapshotIntent2() throws Exception {
|
||||
if ( br4 == null ) {
|
||||
br4 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "snapshot.txt" ) ) );
|
||||
}
|
||||
String line = br4.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;
|
||||
}
|
||||
double[] coor = CoordinateUtils.transformWgsToGcj( cloudRoadData.getLat(), cloudRoadData.getLon() );
|
||||
cloudRoadData.setUuid("1_21");
|
||||
cloudRoadData.setLon( coor[0] );
|
||||
cloudRoadData.setLat( coor[1] );
|
||||
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" );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 21, 100L );
|
||||
return true;
|
||||
}
|
||||
|
||||
private BufferedReader br3;
|
||||
|
||||
private boolean handleMockAdasIntent() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user