opt
This commit is contained in:
@@ -106,8 +106,8 @@ class SnapshotSetDataDrawer extends BaseDrawer {
|
||||
mPurseCounter++;
|
||||
if ( mPurseCounter >= 100 ) {
|
||||
mPurseCounter = 0;
|
||||
purgeCloudSnapshotData( allDatumsList );
|
||||
}
|
||||
purgeCloudSnapshotData( allDatumsList );
|
||||
for ( CloudRoadData cloudRoadData : allDatumsList ) {
|
||||
if ( cloudRoadData == null ) {
|
||||
continue;
|
||||
@@ -131,13 +131,12 @@ class SnapshotSetDataDrawer extends BaseDrawer {
|
||||
marker.setGps( false );
|
||||
MogoLatLng lastPosition = mLastPositions.get( uniqueKey );
|
||||
double targetPos[] = CoordinateUtils.transformFromWGSToGCJ( target.lat, target.lon );
|
||||
double lastPos[] = CoordinateUtils.transformFromWGSToGCJ( lastPosition.lat, lastPosition.lon );
|
||||
if ( lastPosition != null ) {
|
||||
if ( lastPosition.equals( target ) ) {
|
||||
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
|
||||
marker.setPosition( targetPos[POS_LAT], targetPos[POS_LON] );
|
||||
marker.setPosition( lastPos[POS_LAT], lastPos[POS_LON] );
|
||||
} else {
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
double lastPos[] = CoordinateUtils.transformFromWGSToGCJ( lastPosition.lat, lastPosition.lon );
|
||||
points.add( new MogoLatLng( lastPos[POS_LAT], lastPos[POS_LON] ) );
|
||||
points.add( new MogoLatLng( targetPos[POS_LAT], targetPos[POS_LON] ) );
|
||||
marker.startSmooth( points, 1 );
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.service.imageloader.IMogoImageLoaderListener;
|
||||
import com.mogo.service.imageloader.MogoImageView;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -105,7 +106,7 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV
|
||||
public void onCompleted(Bitmap bitmap) {
|
||||
// 使用view渲染地图marker,刷新纹理的时候,需要重新用view生成纹理,然后在设置
|
||||
if (mMarker != null) {
|
||||
mMarker.setIcon(fromView(MapMarkerBaseView.this));
|
||||
mMarker.setIcon( ViewUtils.fromView(MapMarkerBaseView.this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +133,7 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV
|
||||
Logger.d(TAG, "loadImageWithMarker loaded.");
|
||||
// 使用view渲染地图marker,刷新纹理的时候,需要重新用view生成纹理,然后在设置
|
||||
if ( mMarker != null ) {
|
||||
mMarker.setIcon( fromView( MapMarkerBaseView.this ) );
|
||||
mMarker.setIcon( ViewUtils.fromView( MapMarkerBaseView.this ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,30 +148,6 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV
|
||||
}
|
||||
}
|
||||
|
||||
private Bitmap fromView( View view ) {
|
||||
view.setDrawingCacheEnabled( true );
|
||||
processChildView( view );
|
||||
view.destroyDrawingCache();
|
||||
view.measure( MeasureSpec.makeMeasureSpec( 0, MeasureSpec.UNSPECIFIED ), MeasureSpec.makeMeasureSpec( 0, MeasureSpec.UNSPECIFIED ) );
|
||||
view.layout( 0, 0, view.getMeasuredWidth(), view.getMeasuredHeight() );
|
||||
Bitmap bitmap = null;
|
||||
return ( bitmap = view.getDrawingCache() ) != null ? bitmap.copy( Bitmap.Config.ARGB_8888, false ) : null;
|
||||
}
|
||||
|
||||
private void processChildView( View view ) {
|
||||
if ( !( view instanceof ViewGroup ) ) {
|
||||
if ( view instanceof TextView ) {
|
||||
( ( TextView ) view ).setHorizontallyScrolling( false );
|
||||
}
|
||||
|
||||
} else {
|
||||
for ( int var1 = 0; var1 < ( ( ViewGroup ) view ).getChildCount(); ++var1 ) {
|
||||
processChildView( ( ( ViewGroup ) view ).getChildAt( var1 ) );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class MapMarkerView extends MapMarkerBaseView {
|
||||
public void updateView( MarkerShowEntity markerShowEntity ) {
|
||||
try {
|
||||
Object bindObj = markerShowEntity.getBindObj();
|
||||
if ( MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().isVrMode() ) {
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow_vr );
|
||||
} else {
|
||||
ivCar.setImageResource( R.drawable.icon_map_marker_location_yellow );
|
||||
|
||||
@@ -36,6 +36,7 @@ public class MapCenterPointStrategy {
|
||||
choosePoint.put( "e8xx", point );
|
||||
choosePoint.put( "f80x", point );
|
||||
choosePoint.put( "f8xx", point );
|
||||
choosePoint.put( "f8Amap", point );
|
||||
sCommonStrategies.put( Scene.CHOOSE_POINT, choosePoint );
|
||||
}
|
||||
|
||||
@@ -49,6 +50,7 @@ public class MapCenterPointStrategy {
|
||||
final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.575D );
|
||||
navi.put( "f80x", f80x );
|
||||
navi.put( "f8xx", f80x );
|
||||
navi.put( "f8Amap", f80x );
|
||||
sCommonStrategies.put( Scene.NAVI, navi );
|
||||
}
|
||||
|
||||
@@ -62,6 +64,7 @@ public class MapCenterPointStrategy {
|
||||
final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.683333333333D );
|
||||
naviWithRoadEvent.put( "f80x", f80x );
|
||||
naviWithRoadEvent.put( "f8xx", f80x );
|
||||
naviWithRoadEvent.put( "f8Amap", f80x );
|
||||
sCommonStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent );
|
||||
}
|
||||
|
||||
@@ -75,6 +78,7 @@ public class MapCenterPointStrategy {
|
||||
final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.5D );
|
||||
aimless.put( "f80x", f80x );
|
||||
aimless.put( "f8xx", f80x );
|
||||
aimless.put( "f8Amap", f80x );
|
||||
sCommonStrategies.put( Scene.AIMLESS, aimless );
|
||||
}
|
||||
|
||||
@@ -88,6 +92,7 @@ public class MapCenterPointStrategy {
|
||||
final MapCenterPoint f80x = new MapCenterPoint( 0.705208333D, 0.599074074D );
|
||||
aimlessWithRoadEvent.put( "f80x", f80x );
|
||||
aimlessWithRoadEvent.put( "f8xx", f80x );
|
||||
aimlessWithRoadEvent.put( "f8Amap", f80x );
|
||||
sCommonStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent );
|
||||
}
|
||||
|
||||
@@ -102,6 +107,7 @@ public class MapCenterPointStrategy {
|
||||
final MapCenterPoint f80x = new MapCenterPoint( 0.703125D, 0.6083333D );
|
||||
calculatePath.put( "f80x", f80x );
|
||||
calculatePath.put( "f8xx", f80x );
|
||||
calculatePath.put( "f8Amap", f80x );
|
||||
sCommonStrategies.put( Scene.CALCULATE_PATH, calculatePath );
|
||||
}
|
||||
|
||||
@@ -116,6 +122,7 @@ public class MapCenterPointStrategy {
|
||||
final MapCenterPoint f80x = new MapCenterPoint( 0.733594D, 0.5D );
|
||||
categorySearch.put( "f80x", f80x );
|
||||
categorySearch.put( "f8xx", f80x );
|
||||
categorySearch.put( "f8Amap", f80x );
|
||||
sCommonStrategies.put( Scene.CATEGORY_SEARCH, categorySearch );
|
||||
}
|
||||
|
||||
@@ -130,6 +137,7 @@ public class MapCenterPointStrategy {
|
||||
final MapCenterPoint f80x = new MapCenterPoint( 0.6963541D, 0.65D );
|
||||
categoryV2XEvent.put( "f80x", f80x );
|
||||
categoryV2XEvent.put( "f8xx", f80x );
|
||||
categoryV2XEvent.put( "f8Amap", f80x );
|
||||
sCommonStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent );
|
||||
}
|
||||
|
||||
@@ -138,88 +146,110 @@ public class MapCenterPointStrategy {
|
||||
{
|
||||
// 选点场景,定位中心点
|
||||
Map< String, MapCenterPoint > choosePoint = new HashMap<>();
|
||||
choosePoint.put( "d80x", new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
choosePoint.put( "em4", new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
choosePoint.put( "e8xx", new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
choosePoint.put( "f80x", new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
choosePoint.put( "f8xx", new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
MapCenterPoint point = new MapCenterPoint( 0.5D, 0.5D );
|
||||
choosePoint.put( "d80x", point );
|
||||
choosePoint.put( "em4", point );
|
||||
choosePoint.put( "e8xx", point );
|
||||
choosePoint.put( "f80x", point );
|
||||
choosePoint.put( "f8xx", point );
|
||||
choosePoint.put( "f8Amap", point );
|
||||
sVrStrategies.put( Scene.CHOOSE_POINT, choosePoint );
|
||||
}
|
||||
|
||||
{
|
||||
// 导航场景,定位视图右下角偏下
|
||||
Map< String, MapCenterPoint > navi = new HashMap<>();
|
||||
navi.put( "d80x", new MapCenterPoint( 0.5D, 0.573333333333D ) );
|
||||
navi.put( "em4", new MapCenterPoint( 0.5D, 0.573333333333D ) );
|
||||
navi.put( "e8xx", new MapCenterPoint( 0.5D, 0.573333333333D ) );
|
||||
navi.put( "f80x", new MapCenterPoint( 0.5D, 0.575D ) );
|
||||
navi.put( "f8xx", new MapCenterPoint( 0.5D, 0.575D ) );
|
||||
MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.573333333333D );
|
||||
navi.put( "d80x", point1 );
|
||||
navi.put( "em4", point1 );
|
||||
navi.put( "e8xx", point1 );
|
||||
MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.575D );
|
||||
navi.put( "f80x", point2 );
|
||||
navi.put( "f8xx", point2 );
|
||||
navi.put( "f8Amap", point2 );
|
||||
sVrStrategies.put( Scene.NAVI, navi );
|
||||
}
|
||||
|
||||
{
|
||||
// 导航场景 vs 道路事件展示场景,定位视图右下角偏下
|
||||
Map< String, MapCenterPoint > naviWithRoadEvent = new HashMap<>();
|
||||
naviWithRoadEvent.put( "d80x", new MapCenterPoint( 0.5D, 0.73936170212766D ) );
|
||||
naviWithRoadEvent.put( "em4", new MapCenterPoint( 0.5D, 0.73936170212766D ) );
|
||||
naviWithRoadEvent.put( "e8xx", new MapCenterPoint( 0.5D, 0.73936170212766D ) );
|
||||
naviWithRoadEvent.put( "f80x", new MapCenterPoint( 0.5D, 0.683333333333D ) );
|
||||
naviWithRoadEvent.put( "f8xx", new MapCenterPoint( 0.5D, 0.683333333333D ) );
|
||||
MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.73936170212766D );
|
||||
naviWithRoadEvent.put( "d80x", point1 );
|
||||
naviWithRoadEvent.put( "em4", point1 );
|
||||
naviWithRoadEvent.put( "e8xx", point1 );
|
||||
MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.683333333333D );
|
||||
naviWithRoadEvent.put( "f80x", point2 );
|
||||
naviWithRoadEvent.put( "f8xx", point2 );
|
||||
naviWithRoadEvent.put( "f8Amap", point2 );
|
||||
sVrStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent );
|
||||
}
|
||||
|
||||
{
|
||||
// 巡航场景
|
||||
Map< String, MapCenterPoint > aimless = new HashMap<>();
|
||||
aimless.put( "d80x", new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
aimless.put( "em4", new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
aimless.put( "e8xx", new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
aimless.put( "f80x", new MapCenterPoint( 0.5D, 0.8D ) );
|
||||
aimless.put( "f8xx", new MapCenterPoint( 0.5D, 0.8D ) );
|
||||
MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.575D );
|
||||
aimless.put( "d80x", point1 );
|
||||
aimless.put( "em4", point1 );
|
||||
aimless.put( "e8xx", point1 );
|
||||
MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.8D );
|
||||
aimless.put( "f80x", point2 );
|
||||
aimless.put( "f8xx", point2 );
|
||||
aimless.put( "f8Amap", point2 );
|
||||
sVrStrategies.put( Scene.AIMLESS, aimless );
|
||||
}
|
||||
|
||||
{
|
||||
// 巡航场景 vs 道路事件展示场景
|
||||
Map< String, MapCenterPoint > aimlessWithRoadEvent = new HashMap<>();
|
||||
aimlessWithRoadEvent.put( "d80x", new MapCenterPoint( 0.5D, 0.68617 ) );
|
||||
aimlessWithRoadEvent.put( "em4", new MapCenterPoint( 0.5D, 0.68617 ) );
|
||||
aimlessWithRoadEvent.put( "e8xx", new MapCenterPoint( 0.5D, 0.68617 ) );
|
||||
aimlessWithRoadEvent.put( "f80x", new MapCenterPoint( 0.5D, 0.599074074D ) );
|
||||
aimlessWithRoadEvent.put( "f8xx", new MapCenterPoint( 0.5D, 0.599074074D ) );
|
||||
MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.68617 );
|
||||
aimlessWithRoadEvent.put( "d80x", point1 );
|
||||
aimlessWithRoadEvent.put( "em4", point1 );
|
||||
aimlessWithRoadEvent.put( "e8xx", point1 );
|
||||
MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.599074074D );
|
||||
aimlessWithRoadEvent.put( "f80x", point2 );
|
||||
aimlessWithRoadEvent.put( "f8xx", point2 );
|
||||
aimlessWithRoadEvent.put( "f8Amap", point2 );
|
||||
sVrStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent );
|
||||
}
|
||||
|
||||
{
|
||||
// 规划路线,定位视图右边
|
||||
Map< String, MapCenterPoint > calculatePath = new HashMap<>();
|
||||
calculatePath.put( "d80x", new MapCenterPoint( 0.5D, 0.610833D ) );
|
||||
calculatePath.put( "em4", new MapCenterPoint( 0.5D, 0.610833D ) );
|
||||
calculatePath.put( "e8xx", new MapCenterPoint( 0.5D, 0.610833D ) );
|
||||
calculatePath.put( "f80x", new MapCenterPoint( 0.5D, 0.6083333D ) );
|
||||
calculatePath.put( "f8xx", new MapCenterPoint( 0.5D, 0.6083333D ) );
|
||||
MapCenterPoint point1 = new MapCenterPoint( 0.5D, 0.610833D );
|
||||
calculatePath.put( "d80x", point1 );
|
||||
calculatePath.put( "em4", point1 );
|
||||
calculatePath.put( "e8xx", point1 );
|
||||
MapCenterPoint point2 = new MapCenterPoint( 0.5D, 0.6083333D );
|
||||
calculatePath.put( "f80x", point2 );
|
||||
calculatePath.put( "f8xx", point2 );
|
||||
calculatePath.put( "f8Amap", point2 );
|
||||
sVrStrategies.put( Scene.CALCULATE_PATH, calculatePath );
|
||||
}
|
||||
|
||||
{
|
||||
// 分类搜索,定位视图右边
|
||||
Map< String, MapCenterPoint > categorySearch = new HashMap<>();
|
||||
categorySearch.put( "d80x", new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
categorySearch.put( "em4", new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
categorySearch.put( "e8xx", new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
categorySearch.put( "f80x", new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
categorySearch.put( "f8xx", new MapCenterPoint( 0.5D, 0.5D ) );
|
||||
MapCenterPoint point = new MapCenterPoint( 0.5D, 0.5D );
|
||||
categorySearch.put( "d80x", point );
|
||||
categorySearch.put( "em4", point );
|
||||
categorySearch.put( "e8xx", point );
|
||||
categorySearch.put( "f80x", point );
|
||||
categorySearch.put( "f8xx", point );
|
||||
categorySearch.put( "f8Amap", point );
|
||||
sVrStrategies.put( Scene.CATEGORY_SEARCH, categorySearch );
|
||||
}
|
||||
|
||||
{
|
||||
// V2X,场景视图右边
|
||||
Map< String, MapCenterPoint > categoryV2XEvent = new HashMap<>();
|
||||
categoryV2XEvent.put( "d80x", new MapCenterPoint( 0.5, 0.7D ) );
|
||||
categoryV2XEvent.put( "em4", new MapCenterPoint( 0.5, 0.7D ) );
|
||||
categoryV2XEvent.put( "e8xx", new MapCenterPoint( 0.5, 0.7D ) );
|
||||
categoryV2XEvent.put( "f80x", new MapCenterPoint( 0.5, 0.65D ) );
|
||||
categoryV2XEvent.put( "f8xx", new MapCenterPoint( 0.5, 0.65D ) );
|
||||
MapCenterPoint point1 = new MapCenterPoint( 0.5, 0.7D );
|
||||
categoryV2XEvent.put( "d80x",point1 );
|
||||
categoryV2XEvent.put( "em4",point1 );
|
||||
categoryV2XEvent.put( "e8xx",point1 );
|
||||
MapCenterPoint point2 = new MapCenterPoint( 0.5, 0.65D );
|
||||
categoryV2XEvent.put( "f80x", point2 );
|
||||
categoryV2XEvent.put( "f8xx", point2 );
|
||||
categoryV2XEvent.put( "f8Amap", point2 );
|
||||
sVrStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent );
|
||||
}
|
||||
}
|
||||
@@ -239,7 +269,7 @@ public class MapCenterPointStrategy {
|
||||
return;
|
||||
}
|
||||
Map<Integer, Map<String, MapCenterPoint>> strategies = sCommonStrategies;
|
||||
if ( MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().isVrMode() ) {
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
strategies = sVrStrategies;
|
||||
}
|
||||
if ( !strategies.containsKey( scene ) ) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.glide.GlideApp;
|
||||
|
||||
/**
|
||||
@@ -101,31 +102,6 @@ public class MyLocationUtil {
|
||||
View root = LayoutInflater.from(context).inflate(R.layout.module_common_my_location, null, false);
|
||||
ImageView iv = root.findViewById(R.id.module_map_amap_my_location_iv);
|
||||
iv.setImageBitmap(res);
|
||||
return fromView(root);
|
||||
}
|
||||
|
||||
|
||||
private static Bitmap fromView( View view ) {
|
||||
view.setDrawingCacheEnabled( true );
|
||||
processChildView( view );
|
||||
view.destroyDrawingCache();
|
||||
view.measure( View.MeasureSpec.makeMeasureSpec( 0, View.MeasureSpec.UNSPECIFIED ), View.MeasureSpec.makeMeasureSpec( 0, View.MeasureSpec.UNSPECIFIED ) );
|
||||
view.layout( 0, 0, view.getMeasuredWidth(), view.getMeasuredHeight() );
|
||||
Bitmap bitmap = null;
|
||||
return ( bitmap = view.getDrawingCache() ) != null ? bitmap.copy( Bitmap.Config.ARGB_8888, false ) : null;
|
||||
}
|
||||
|
||||
private static void processChildView( View view ) {
|
||||
if ( !( view instanceof ViewGroup ) ) {
|
||||
if ( view instanceof TextView ) {
|
||||
( ( TextView ) view ).setHorizontallyScrolling( false );
|
||||
}
|
||||
|
||||
} else {
|
||||
for ( int var1 = 0; var1 < ( ( ViewGroup ) view ).getChildCount(); ++var1 ) {
|
||||
processChildView( ( ( ViewGroup ) view ).getChildAt( var1 ) );
|
||||
}
|
||||
|
||||
}
|
||||
return ViewUtils.fromView(root);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user