options与mCarMarker显示冲突,暂时使用options验证行驶效果
工控机外网连接ip
This commit is contained in:
@@ -776,7 +776,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
SharedPrefsMgr.getInstance(context)
|
||||
.getString(MoGoConfig.AUTOPILOT_IP, FunctionBuildConfig.adasConnectIP)
|
||||
|
||||
etAutopilotIP.setText("192.168.1.")
|
||||
etAutopilotIP.setText("172.30.10.10:41102")
|
||||
etAutopilotIP.text?.let { etAutopilotIP.setSelection(it.length) }
|
||||
//设置工控机IP
|
||||
btnSetAutopilotIP.setOnClickListener {
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.graphics.Color;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -32,6 +33,7 @@ import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.amap.api.navi.AMapNaviView;
|
||||
import com.amap.api.navi.AMapNaviViewOptions;
|
||||
import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.amap.api.navi.model.RouteOverlayOptions;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
@@ -64,9 +66,12 @@ public class SmallMapDirectionView
|
||||
private RoundLayout rlSmallMapBorder;
|
||||
private AMapNaviView mAMapNaviView;
|
||||
private AMap mAMap;
|
||||
private Marker mCarMarker;
|
||||
private Marker mStartMarker;
|
||||
private Marker mEndMarker;
|
||||
// private Marker mCarMarker;
|
||||
// private Marker mStartMarker;
|
||||
// private Marker mEndMarker;
|
||||
|
||||
protected final List<NaviLatLng> sList = new ArrayList<NaviLatLng>();
|
||||
protected final List<NaviLatLng> eList = new ArrayList<NaviLatLng>();
|
||||
|
||||
private int zoomLevel = 15;
|
||||
private final List<LatLng> mCoordinatesLatLng = new ArrayList<>();
|
||||
@@ -118,18 +123,16 @@ public class SmallMapDirectionView
|
||||
mAMap = mAMapNaviView.getMap();
|
||||
// 地图文字标注
|
||||
mAMap.showMapText(true);
|
||||
// 设置导航地图模式,aMap是地图控制器对象。
|
||||
mAMap.setMapType(AMap.MAP_TYPE_NORMAL);
|
||||
// 显示实时路况图层,aMap是地图控制器对象。
|
||||
mAMap.setTrafficEnabled(true);
|
||||
// 设置 锚点 图标
|
||||
mCarMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_my_location_logo))
|
||||
.anchor(0.5f, 0.5f));
|
||||
mStartMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_start)));
|
||||
mEndMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_end)));
|
||||
// mCarMarker = mAMap.addMarker(new MarkerOptions()
|
||||
// .icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_my_location_logo))
|
||||
// .anchor(0.5f, 0.5f));
|
||||
// mStartMarker = mAMap.addMarker(new MarkerOptions()
|
||||
// .icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_start)));
|
||||
// mEndMarker = mAMap.addMarker(new MarkerOptions()
|
||||
// .icon(BitmapDescriptorFactory.fromResource(R.drawable.module_small_map_view_dir_end)));
|
||||
// 加载自定义样式
|
||||
CustomMapStyleOptions customMapStyleOptions = new CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
@@ -147,6 +150,8 @@ public class SmallMapDirectionView
|
||||
options.setTrafficBarEnabled(false);
|
||||
//指南针
|
||||
options.setCompassEnabled(false);
|
||||
//关闭自动绘制路线,自行绘制路线
|
||||
options.setAutoDrawRoute(false);
|
||||
//自定义样式
|
||||
RouteOverlayOptions routeOverlayOptions = new RouteOverlayOptions();
|
||||
//自车车标
|
||||
@@ -206,13 +211,14 @@ public class SmallMapDirectionView
|
||||
}
|
||||
LatLng currentLatLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
//更新车辆位置
|
||||
if (mCarMarker != null) {
|
||||
// if (mCarMarker != null) {
|
||||
// mCarMarker.setRotateAngle(location.getBearing());
|
||||
mCarMarker.setPosition(currentLatLng);
|
||||
// mCarMarker.setPosition(currentLatLng);
|
||||
// mCarMarker.setToTop();
|
||||
}
|
||||
// }
|
||||
|
||||
CameraPosition cameraPosition;
|
||||
float tilt = 20f;
|
||||
if (mCoordinatesLatLng.size() > 1) {
|
||||
// mCoordinatesLatLngCurrent.clear();
|
||||
// for (LatLng lng : mCoordinatesLatLng) {
|
||||
@@ -241,10 +247,10 @@ public class SmallMapDirectionView
|
||||
//tilt:倾斜角度的范围为【0.f-45.f】,0度时建筑物没有远近关系,随着角度增加,建筑物的远近效果比较明显,产生立体效果
|
||||
//bearing:旋转角度范围为:【0.f-360.f】,正北方向为0度,逆时针旋转值会增加
|
||||
//zoom:地图缩放级别范围为【4-20级】,值越大地图越详细,反之
|
||||
cameraPosition = new CameraPosition.Builder().target(mCarMarker.getPosition()).tilt(40).bearing(location.getBearing()).zoom(zoomLevel).build();
|
||||
cameraPosition = new CameraPosition.Builder().target(currentLatLng).tilt(tilt).bearing(location.getBearing()).zoom(zoomLevel).build();
|
||||
} else {
|
||||
//设置希望展示的地图缩放级别
|
||||
cameraPosition = new CameraPosition.Builder().target(mCarMarker.getPosition()).tilt(40).bearing(location.getBearing()).zoom(zoomLevel).build();
|
||||
cameraPosition = new CameraPosition.Builder().target(currentLatLng).tilt(tilt).bearing(location.getBearing()).zoom(zoomLevel).build();
|
||||
// mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLatLng, zoomLevel));
|
||||
}
|
||||
mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
|
||||
@@ -285,12 +291,12 @@ public class SmallMapDirectionView
|
||||
if (mAMap != null) {
|
||||
if (mCoordinatesLatLng.size() > 2) {
|
||||
// 设置开始结束Marker位置
|
||||
mStartMarker.setPosition(mCoordinatesLatLng.get(0));
|
||||
mEndMarker.setPosition(mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1));
|
||||
mStartMarker.setToTop();
|
||||
mStartMarker.setVisible(true);
|
||||
mEndMarker.setVisible(true);
|
||||
mEndMarker.setToTop();
|
||||
// mStartMarker.setPosition(mCoordinatesLatLng.get(0));
|
||||
// mEndMarker.setPosition(mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1));
|
||||
// mStartMarker.setToTop();
|
||||
// mStartMarker.setVisible(true);
|
||||
// mEndMarker.setVisible(true);
|
||||
// mEndMarker.setToTop();
|
||||
|
||||
|
||||
//存放所有点的经纬度
|
||||
@@ -340,12 +346,12 @@ public class SmallMapDirectionView
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker.setVisible(false);
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker.setVisible(false);
|
||||
}
|
||||
// if (mStartMarker != null) {
|
||||
// mStartMarker.setVisible(false);
|
||||
// }
|
||||
// if (mEndMarker != null) {
|
||||
// mEndMarker.setVisible(false);
|
||||
// }
|
||||
}
|
||||
|
||||
public void resetPolyLine() {
|
||||
@@ -353,12 +359,12 @@ public class SmallMapDirectionView
|
||||
if (mPolyline != null) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
if (mStartMarker != null) {
|
||||
mStartMarker.setVisible(false);
|
||||
}
|
||||
if (mEndMarker != null) {
|
||||
mEndMarker.setVisible(false);
|
||||
}
|
||||
// if (mStartMarker != null) {
|
||||
// mStartMarker.setVisible(false);
|
||||
// }
|
||||
// if (mEndMarker != null) {
|
||||
// mEndMarker.setVisible(false);
|
||||
// }
|
||||
}
|
||||
|
||||
public void onCreateView(Bundle savedInstanceState) {
|
||||
@@ -388,6 +394,7 @@ public class SmallMapDirectionView
|
||||
public void convert(List<MogoLatLng> coordinates) {
|
||||
mCoordinatesLatLng.clear();
|
||||
List<LatLng> latLngs = CoordinateConverterFrom84ForList(mContext, coordinates);
|
||||
Log.d(TAG, "convert===============:" + latLngs.toString());
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user