[Fix]处理合并后报错的地方

This commit is contained in:
chenfufeng
2022-07-20 10:37:21 +08:00
parent d80e1c4188
commit 0dfced49f5
4 changed files with 21 additions and 81 deletions

View File

@@ -12,6 +12,7 @@ import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.amap.api.maps.AMap;
@@ -77,6 +78,7 @@ import java.util.Map;
import ch.hsr.geohash.GeoHash;
import mogo.telematics.pad.MessagePad;
import mogo_msg.MogoReportMsg;
import system_master.SystemStatusInfo;
/**
* 小地图的方向View
@@ -201,7 +203,7 @@ public class AMapCustomView
// options.setTilt((int) tilt);
//自车车标
options.setCarBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.module_small_map_view_my_location_logo));
options.setFourCornersBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.amap_custom_corner));
// options.setFourCornersBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.amap_custom_corner));
options.setStartPointBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.module_small_map_view_dir_start));
options.setWayPointBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.icon_module_small_map_four_corners));
options.setEndPointBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.module_small_map_view_dir_end));
@@ -210,17 +212,22 @@ public class AMapCustomView
//路线纹理自定义
RouteOverlayOptions routeOverlayOptions = new RouteOverlayOptions();
routeOverlayOptions.setTurnArrowIs3D(false);
routeOverlayOptions.setUnknownTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_no));//未知路段
routeOverlayOptions.setSmoothTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.amap_custom_smooth_route));
routeOverlayOptions.setJamTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_bad));//拥堵路段
routeOverlayOptions.setVeryJamTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_grayred));//超级拥堵路段
routeOverlayOptions.setPassRoute(BitmapFactory.decodeResource(getResources(), R.drawable.amap_custom_pass_route));//走过的路段
// routeOverlayOptions.setUnknownTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_no));//未知路段
// routeOverlayOptions.setSmoothTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.amap_custom_smooth_route));
// routeOverlayOptions.setJamTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_bad));//拥堵路段
// routeOverlayOptions.setVeryJamTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_grayred));//超级拥堵路段
// routeOverlayOptions.setPassRoute(BitmapFactory.decodeResource(getResources(), R.drawable.amap_custom_pass_route));//走过的路段
options.setRouteOverlayOptions(routeOverlayOptions);
mAMapNaviView.setViewOptions(options);
}
private final IMoGoAutopilotStatusListener mGoAutopilotStatusListener = new IMoGoAutopilotStatusListener() {
@Override
public void onAutopilotStatusRespByQuery(@NonNull SystemStatusInfo.StatusInfo status) {
}
@Override
public void onAutopilotIpcConnectStatusChanged(int status, @org.jetbrains.annotations.Nullable String reason) {
@@ -330,72 +337,6 @@ public class AMapCustomView
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(TAG);
}
private void initAMapView(Context context) {
mCameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel);
AMapNaviViewOptions options = mAMapNaviView.getViewOptions();
//关闭自动绘制路线,自行绘制路线
// options.setAutoDrawRoute(false);
//不显示导航界面
options.setLayoutVisible(false);
//黑夜模式
options.setNaviNight(true);
//导航全程光柱
options.setTrafficBarEnabled(false);
//指南针
// options.setCompassEnabled(false);
options.setTilt((int) tilt);
//自车车标
options.setCarBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.module_small_map_view_my_location_logo));
options.setFourCornersBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.amap_custom_corner));
options.setStartPointBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.module_small_map_view_dir_start));
options.setWayPointBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.icon_module_small_map_four_corners));
options.setEndPointBitmap(BitmapFactory.decodeResource(this.getResources(), R.drawable.module_small_map_view_dir_end));
//与走过的路线
options.setAfterRouteAutoGray(true);
//路线纹理自定义
RouteOverlayOptions routeOverlayOptions = new RouteOverlayOptions();
routeOverlayOptions.setTurnArrowIs3D(false);
routeOverlayOptions.setUnknownTraffic(BitmapFactory.decodeResource(getResources(),R.drawable.custtexture_no));//未知路段
routeOverlayOptions.setSmoothTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.amap_custom_smooth_route));
routeOverlayOptions.setJamTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_bad));//拥堵路段
routeOverlayOptions.setVeryJamTraffic(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_grayred));//超级拥堵路段
routeOverlayOptions.setPassRoute(BitmapFactory.decodeResource(getResources(), R.drawable.custtexture_slow));//走过的路段
options.setRouteOverlayOptions(routeOverlayOptions);
mAMapNaviView.setViewOptions(options);
mAMap = mAMapNaviView.getMap();
// 地图文字标注
mAMap.showMapText(true);
// 显示实时路况图层aMap是地图控制器对象。
mAMap.setTrafficEnabled(true);
//设置希望展示的地图缩放级别
mAMap.moveCamera(mCameraUpdate);
//设置地图的样式
UiSettings uiSettings = mAMap.getUiSettings();
//地图缩放级别的交换按钮
uiSettings.setZoomControlsEnabled(false);
//所有手势
uiSettings.setAllGesturesEnabled(true);
//隐藏指南针
uiSettings.setCompassEnabled(false);
//设置倾斜手势是否可用。
uiSettings.setTiltGesturesEnabled(true);
//隐藏默认的定位按钮
uiSettings.setMyLocationButtonEnabled(false);
//设置Logo下边界距离屏幕底部的边距,设置为负值即可
uiSettings.setLogoBottomMargin(-150);
int strategy = 0;
try {
//再次强调最后一个参数为true时代表多路径否则代表单路径
strategy = mAMapNavi.strategyConvert(true, false, false, false, false);
} catch (Exception e) {
e.printStackTrace();
}
//指定路径绘制导航路线
mAMapNavi.calculateDriveRoute(sList, eList, mWayPointList, strategy);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return false;
@@ -750,8 +691,8 @@ public class AMapCustomView
// 加载自定义样式
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
.setEnable(true)
.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext(), "over_view_style.data"))
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext(), "over_view_style_extra.data"));
.setStyleData(MapAssetStyleUtils.getAssetsStyle(getContext()))
.setStyleExtraData(MapAssetStyleUtils.getAssetsExtraStyle(getContext()));
// 设置自定义样式
mAMap.setCustomMapStyle(customMapStyleOptions);
}

View File

@@ -65,9 +65,9 @@ public class CarOverlay {
public CarOverlay(Context context, TextureMapView mapView) {
this.mapView = mapView;
fourCornersDescriptor = BitmapDescriptorFactory.fromBitmap(BitmapFactory
.decodeResource(context.getResources(),
R.drawable.module_small_map_navi_direction));
// fourCornersDescriptor = BitmapDescriptorFactory.fromBitmap(BitmapFactory
// .decodeResource(context.getResources(),
// R.drawable.module_small_map_navi_direction));
carDescriptor = BitmapDescriptorFactory.fromBitmap(BitmapFactory
.decodeResource(context.getResources(),
@@ -154,7 +154,7 @@ public class CarOverlay {
carMarker.setVisible(true);
newAngle = bearing;
IPoint resultGeoPnt = IPoint.obtain();
resultGeoPnt = NaviUtil.lonlat2Geo(mLatLng.latitude, mLatLng.longitude, 20);
// resultGeoPnt = NaviUtil.lonlat2Geo(mLatLng.latitude, mLatLng.longitude, 20);
updateCarPosition(resultGeoPnt);
resultGeoPnt.recycle();