Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk

This commit is contained in:
wangcongtao
2021-03-10 11:43:35 +08:00
4 changed files with 4275 additions and 9 deletions

1
.idea/gradle.xml generated
View File

@@ -91,6 +91,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

View File

@@ -4,6 +4,7 @@ import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -66,7 +67,23 @@ public class SimpleHandlerThreadPool {
Message msg = Message.obtain();
msg.what = MSG_SET_POINT;
msg.obj = points.get( i );
renderHandler.sendMessageDelayed( msg, ( i + 1 ) * 10 );
renderHandler.sendMessageDelayed( msg, points.get(i).delay );
}
}
private long startMove = 0;
private int lastIndex = 0;
private void slowTest(){
if (startMove == 0) {
startMove = SystemClock.uptimeMillis();
} else {
long diff = SystemClock.uptimeMillis() - startMove;
int index = (int) (diff / 30);
if (index - lastIndex > 1) {
Logger.e("MapRenderSlow", "miss " + (index - lastIndex) + " diff: " + diff);
}
lastIndex = index;
}
}
@@ -75,10 +92,11 @@ public class SimpleHandlerThreadPool {
*
* @param pointData
*/
private void moveMarker( BaseDrawer.MovingPoint pointData ) {
if ( pointData == null ) {
private void moveMarker(BaseDrawer.MovingPoint pointData) {
if (pointData == null) {
return;
}
// slowTest();
pointData.move();
}
@@ -175,6 +193,8 @@ public class SimpleHandlerThreadPool {
return;
}
final long start = System.currentTimeMillis();
IMogoMarker marker = markerCache.get( uniqueKey );
CloudRoadData lastPosition = roadDataCache.put( uniqueKey, cloudRoadData );
if ( marker == null || marker.isDestroyed() ) {
@@ -217,21 +237,26 @@ public class SimpleHandlerThreadPool {
SnapshotSetDataDrawer.getInstance().changeIconResourceIfNecessary( cloudRoadData, marker );
// final IMogoMarker finalMarker = marker;
final IMogoMarker finalMarker = marker;
Logger.d( TAG, "work in " + Thread.currentThread().getName() );
if ( lastPosition != null ) {
MogoLatLng endLatLon = new MogoLatLng( cloudRoadData.getWgslat(),cloudRoadData.getWgslon() );
long interval = SnapshotSetDataDrawer.getInstance().computeAnimDuration( lastPosition.getSystemTime(), cloudRoadData.getSystemTime(), lastPosition.getSatelliteTime(), cloudRoadData.getSatelliteTime() );
long cost = System.currentTimeMillis() - start;
interval -= cost;
MogoLatLng lastPoint = new MogoLatLng( lastPosition.getWgslat(), lastPosition.getWgslon() );
BaseDrawer.MovingPoint endPoint = new BaseDrawer.MovingPoint();
endPoint.point = endLatLon;
endPoint.marker = marker;
endPoint.delay = interval;
endPoint.angle = ( float ) cloudRoadData.getHeading();
BaseDrawer.MovingPoint startPoint = new BaseDrawer.MovingPoint();
startPoint.point = lastPoint;
startPoint.marker = marker;
startPoint.delay = 0;
startPoint.angle = ( float ) lastPosition.getHeading();
List< BaseDrawer.MovingPoint > points = BaseDrawer.interpolate( startPoint, endPoint, interval );
Message msg = new Message();
@@ -258,6 +283,7 @@ public class SimpleHandlerThreadPool {
// // 由于地图现在不支持addDynamicAnchorPosition并发所以工作线程仅做相关计算真正绘制发送到另外一条绘制线程中做
// if ( lastPosition != null && !lastPosition.equals( cloudRoadData ) ) {
// long interval = SystemClock.uptimeMillis() - lastExecutionTimeCache.get( uniqueKey );
// interval = cloudRoadData.getSystemTime() - lastPosition.getSystemTime();
// finalMarker.addDynamicAnchorPosition( new MogoLatLng( cloudRoadData.getWgslat(), cloudRoadData.getWgslon() ), interval );
// Logger.d( TAG, "anim duration: %s in thread: %s", interval, Thread.currentThread().getName() );
// } else {

File diff suppressed because it is too large Load Diff

View File

@@ -559,10 +559,10 @@ public class MockIntentHandler implements IntentHandler {
SnapshotSetDataDrawer.getInstance().renderSnapshotData( GsonUtil.objectFromJson( json, MogoSnapshotSetData.class ) );
break;
case 47:
mLocationMockHandler.sendEmptyMessageDelayed( 1, 200L );
// mLocationMockHandler.sendEmptyMessageDelayed( 2, 0 );
mLocationMockHandler.sendEmptyMessageDelayed( 1, 8200L );
mLocationMockHandler.sendEmptyMessageDelayed( 2, 0 );
// mLocationMockHandler.sendEmptyMessageDelayed( 21, 200 );
mLocationMockHandler.sendEmptyMessageDelayed( 3, 0L );
// mLocationMockHandler.sendEmptyMessageDelayed( 3, 0L );
// mLocationMockHandler.sendEmptyMessageDelayed( 5, 0L );
break;
case 48:
@@ -722,9 +722,11 @@ public class MockIntentHandler implements IntentHandler {
private BufferedReader br2;
private long last = 0;
private boolean handleMockSnapshotIntent() throws Exception {
if ( br2 == null ) {
br2 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "snapshot.txt" ) ) );
br2 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "snapshot2.txt" ) ) );
}
String line = br2.readLine();
if ( line == null ) {
@@ -747,7 +749,12 @@ public class MockIntentHandler implements IntentHandler {
final long start = System.currentTimeMillis();
SnapshotSetDataDrawer.getInstance().renderSnapshotData( data );
Log.i( "mock-timer-snapshot", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
mLocationMockHandler.sendEmptyMessageDelayed( 2, 100L );
long delay = 100;
if (last != 0){
delay = cloudRoadData.getSystemTime() - last;
}
last = cloudRoadData.getSystemTime();
mLocationMockHandler.sendEmptyMessageDelayed( 2, delay );
return true;
}